diff options
Diffstat (limited to 'js')
18 files changed, 150 insertions, 109 deletions
diff --git a/js/components/layout/documents-tab.reel/documents-tab.js b/js/components/layout/documents-tab.reel/documents-tab.js index 0be639db..41c98b30 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.js +++ b/js/components/layout/documents-tab.reel/documents-tab.js | |||
@@ -8,40 +8,6 @@ var Montage = require("montage/core/core").Montage; | |||
8 | var Component = require("montage/ui/component").Component; | 8 | var Component = require("montage/ui/component").Component; |
9 | 9 | ||
10 | exports.DocumentsTab = Montage.create(Component, { | 10 | exports.DocumentsTab = Montage.create(Component, { |
11 | |||
12 | /* | ||
13 | openDocuments: { | ||
14 | value: [] | ||
15 | }, | ||
16 | |||
17 | prepareForDraw: { | ||
18 | enumerable: false, | ||
19 | value: function() { | ||
20 | // console.log("Change this to be inside the Ninja Reel"); | ||
21 | this.openDocuments = this.application.ninja.documentController._documents; | ||
22 | // this.eventManager.addEventListener( "appLoaded", this, false); | ||
23 | } | ||
24 | }, | ||
25 | |||
26 | handleAppLoaded: { | ||
27 | value: function() { | ||
28 | // this.openDocuments = this.application.ninja.currentDocument; | ||
29 | } | ||
30 | }, | ||
31 | |||
32 | draw: { | ||
33 | enumerable: false, | ||
34 | value: function() { | ||
35 | |||
36 | } | ||
37 | }, | ||
38 | |||
39 | handleClick: { | ||
40 | value: function(event) { | ||
41 | |||
42 | } | ||
43 | } | ||
44 | */ | ||
45 | contentController: { | 11 | contentController: { |
46 | value: null | 12 | value: null |
47 | } | 13 | } |
diff --git a/js/components/toolbar.reel/toolbar-button.js b/js/components/toolbar.reel/toolbar-button.js new file mode 100644 index 00000000..9ada9b29 --- /dev/null +++ b/js/components/toolbar.reel/toolbar-button.js | |||
@@ -0,0 +1,28 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage").Montage, | ||
8 | Component = require("montage/ui/component").Component, | ||
9 | Button = require("montage/ui/button.reel/button").Button; | ||
10 | |||
11 | var ToolbarButton = exports.ToolbarButton = Montage.create(Button, { | ||
12 | hasTemplate : { | ||
13 | value: false | ||
14 | }, | ||
15 | _sourceObject : { | ||
16 | value: null | ||
17 | }, | ||
18 | sourceObject : { | ||
19 | get: function() { | ||
20 | return this._sourceObject; | ||
21 | }, | ||
22 | set: function(value) { | ||
23 | if(value === this._sourceObject) { return; } | ||
24 | |||
25 | this._sourceObject = value; | ||
26 | } | ||
27 | } | ||
28 | }); \ No newline at end of file | ||
diff --git a/js/components/toolbar.reel/toolbar.html b/js/components/toolbar.reel/toolbar.html index d2c5972a..51e7ebec 100644 --- a/js/components/toolbar.reel/toolbar.html +++ b/js/components/toolbar.reel/toolbar.html | |||
@@ -30,7 +30,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
30 | }, | 30 | }, |
31 | 31 | ||
32 | "button": { | 32 | "button": { |
33 | "prototype": "montage/ui/button.reel", | 33 | "prototype": "js/components/toolbar.reel/toolbar-button", |
34 | "properties": { | 34 | "properties": { |
35 | "element": {"#": "button" }, | 35 | "element": {"#": "button" }, |
36 | "label": " " | 36 | "label": " " |
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js index d0b1f179..d292f838 100644 --- a/js/controllers/code-editor-controller.js +++ b/js/controllers/code-editor-controller.js | |||
@@ -32,6 +32,7 @@ exports.CodeEditorController = Montage.create(Component, { | |||
32 | if(!value) { | 32 | if(!value) { |
33 | 33 | ||
34 | } else if(this._currentDocument.currentView === "code") { | 34 | } else if(this._currentDocument.currentView === "code") { |
35 | this._currentDocument.model.views.code.editor.focus(); | ||
35 | this.applySettings(); | 36 | this.applySettings(); |
36 | } | 37 | } |
37 | } | 38 | } |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index e059e7e1..f85e2f97 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -54,6 +54,7 @@ exports.DocumentController = Montage.create(Component, { | |||
54 | document.getElementById("codeViewContainer").style.display = "block"; | 54 | document.getElementById("codeViewContainer").style.display = "block"; |
55 | } else if(this._currentDocument.currentView === "design") { | 55 | } else if(this._currentDocument.currentView === "design") { |
56 | this._currentDocument.model.currentView.show(); | 56 | this._currentDocument.model.currentView.show(); |
57 | this._currentDocument.model.views.design._liveNodeList = this._currentDocument.model.documentRoot.getElementsByTagName('*'); | ||
57 | } else { | 58 | } else { |
58 | document.getElementById("iframeContainer").style.display = "none"; | 59 | document.getElementById("iframeContainer").style.display = "none"; |
59 | this._currentDocument.model.currentView.show(); | 60 | this._currentDocument.model.currentView.show(); |
@@ -149,10 +150,10 @@ exports.DocumentController = Montage.create(Component, { | |||
149 | handleExecuteSave: { | 150 | handleExecuteSave: { |
150 | value: function(event) { | 151 | value: function(event) { |
151 | // | 152 | // |
152 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ | 153 | if((typeof this.currentDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ |
153 | //Currently we don't need a callback handler | 154 | //Currently we don't need a callback handler |
154 | //this.activeDocument.model.save(this.saveExecuted.bind(this)); | 155 | //this.activeDocument.model.save(this.saveExecuted.bind(this)); |
155 | this.activeDocument.model.save(); | 156 | this.currentDocument.model.save(); |
156 | } else { | 157 | } else { |
157 | //Error: cloud not available and/or no active document | 158 | //Error: cloud not available and/or no active document |
158 | } | 159 | } |
@@ -193,16 +194,13 @@ exports.DocumentController = Montage.create(Component, { | |||
193 | //////////////////////////////////////////////////////////////////// | 194 | //////////////////////////////////////////////////////////////////// |
194 | handleExecuteFileClose:{ | 195 | handleExecuteFileClose:{ |
195 | value: function(event) { | 196 | value: function(event) { |
196 | if (this.activeDocument) { | 197 | this.closeFile(this.currentDocument); |
197 | this.closeFile(this.activeDocument); | ||
198 | } | ||
199 | } | 198 | } |
200 | }, | 199 | }, |
201 | //////////////////////////////////////////////////////////////////// | 200 | //////////////////////////////////////////////////////////////////// |
202 | //TODO: Is this used, should be cleaned up | 201 | //TODO: Is this used, should be cleaned up |
203 | handleExecuteFileCloseAll:{ | 202 | handleExecuteFileCloseAll:{ |
204 | value: function(event) { | 203 | value: function(event) { |
205 | var i=0;//TODO: who is using this?? | ||
206 | if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ | 204 | if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ |
207 | while(this._documents.length > 0){ | 205 | while(this._documents.length > 0){ |
208 | this.closeDocument(this._documents[this._documents.length -1].uuid); | 206 | this.closeDocument(this._documents[this._documents.length -1].uuid); |
@@ -355,14 +353,8 @@ exports.DocumentController = Montage.create(Component, { | |||
355 | if(currentDocument) { | 353 | if(currentDocument) { |
356 | if(currentDocument.currentView === "design") { | 354 | if(currentDocument.currentView === "design") { |
357 | currentDocument.serializeDocument(); | 355 | currentDocument.serializeDocument(); |
358 | this.application.ninja._currentSelectedContainer = this.application.ninja.selectionController._selectionContainer = null; | ||
359 | currentDocument.model.views.design.propertiesPanel.clear(); | ||
360 | } | 356 | } |
361 | 357 | ||
362 | currentDocument.model.isActive = false; | ||
363 | |||
364 | currentDocument.model.currentView.hide(); | ||
365 | |||
366 | if(currentDocument.model.parentContainer !== newDocument.model.parentContainer) { | 358 | if(currentDocument.model.parentContainer !== newDocument.model.parentContainer) { |
367 | currentDocument.model.parentContainer.style["display"] = "none"; | 359 | currentDocument.model.parentContainer.style["display"] = "none"; |
368 | newDocument.model.parentContainer.style["display"] = "block"; | 360 | newDocument.model.parentContainer.style["display"] = "block"; |
@@ -383,13 +375,9 @@ exports.DocumentController = Montage.create(Component, { | |||
383 | this.application.ninja.stage.hideRulers(); | 375 | this.application.ninja.stage.hideRulers(); |
384 | } | 376 | } |
385 | 377 | ||
386 | // this.application.ninja.stage.clearAllCanvas(); | ||
387 | |||
388 | if(didCreate) { | 378 | if(didCreate) { |
389 | // newDocument.model.currentView.show(); | ||
390 | |||
391 | if(newDocument.currentView === "design") { | 379 | if(newDocument.currentView === "design") { |
392 | NJevent("onOpenDocument", newDocument); | 380 | |
393 | } else { | 381 | } els |