diff options
author | Jose Antonio Marquez Russo | 2012-02-09 21:37:09 -0800 |
---|---|---|
committer | Jose Antonio Marquez Russo | 2012-02-09 21:37:09 -0800 |
commit | ad9b4d6c90c3a85a3687018f5ee135eea292bc2f (patch) | |
tree | 31484876c697b8eeef56dd83934651fae91c17f5 /js | |
parent | 67a5b6a1fb352bdc69ff05297268c27e7e2ba795 (diff) | |
parent | 26bfb7a4cbf66c35e23eec46def045bd295be2e1 (diff) | |
download | ninja-ad9b4d6c90c3a85a3687018f5ee135eea292bc2f.tar.gz |
Merge pull request #5 from mencio/file-io
FileIO - Disable auto opening a file
Diffstat (limited to 'js')
-rwxr-xr-x | js/io/document/document-controller.js | 43 | ||||
-rwxr-xr-x | js/panels/properties/content.reel/content.js | 9 | ||||
-rwxr-xr-x | js/panels/properties/sections/three-d-view.reel/three-d-view.js | 35 |
3 files changed, 54 insertions, 33 deletions
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js index e36181bf..15f026a3 100755 --- a/js/io/document/document-controller.js +++ b/js/io/document/document-controller.js | |||
@@ -37,7 +37,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
37 | value: "function CodeMirror(place, givenOptions) {" + | 37 | value: "function CodeMirror(place, givenOptions) {" + |
38 | "// Determine effective options based on given values and defaults." + | 38 | "// Determine effective options based on given values and defaults." + |
39 | "var options = {}, defaults = CodeMirror.defaults; }" | 39 | "var options = {}, defaults = CodeMirror.defaults; }" |
40 | }, | 40 | }, |
41 | 41 | ||
42 | activeDocument: { | 42 | activeDocument: { |
43 | get: function() { | 43 | get: function() { |
@@ -45,7 +45,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
45 | }, | 45 | }, |
46 | set: function(doc) { | 46 | set: function(doc) { |
47 | if(this._activeDocument) this._activeDocument.isActive = false; | 47 | if(this._activeDocument) this._activeDocument.isActive = false; |
48 | 48 | ||
49 | if(this._documents.indexOf(doc) === -1) this._documents.push(doc); | 49 | if(this._documents.indexOf(doc) === -1) this._documents.push(doc); |
50 | 50 | ||
51 | this._activeDocument = doc; | 51 | this._activeDocument = doc; |
@@ -66,11 +66,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
66 | this.eventManager.addEventListener("executeSave", this, false); | 66 | this.eventManager.addEventListener("executeSave", this, false); |
67 | 67 | ||
68 | this.eventManager.addEventListener("recordStyleChanged", this, false); | 68 | this.eventManager.addEventListener("recordStyleChanged", this, false); |
69 | |||
70 | // Temporary testing opening a new file after Ninja has loaded | ||
71 | this.eventManager.addEventListener("executeNewProject", this, false); | ||
69 | } | 72 | } |
70 | }, | 73 | }, |
71 | 74 | ||
72 | handleAppLoaded: { | 75 | handleAppLoaded: { |
73 | value: function() { | 76 | value: function() { |
77 | //this.openDocument({"type": "html"}); | ||
78 | } | ||
79 | }, | ||
80 | |||
81 | handleExecuteNewProject: { | ||
82 | value: function() { | ||
74 | this.openDocument({"type": "html"}); | 83 | this.openDocument({"type": "html"}); |
75 | } | 84 | } |
76 | }, | 85 | }, |
@@ -107,9 +116,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
107 | 116 | ||
108 | if((newFileObj.fileExtension !== ".html") && (newFileObj.fileExtension !== ".htm")){//open code view | 117 | if((newFileObj.fileExtension !== ".html") && (newFileObj.fileExtension !== ".htm")){//open code view |
109 | 118 | ||
110 | }else{ | 119 | } else { |
111 | //open design view | 120 | //open design view |
112 | } | 121 | } |
113 | } | 122 | } |
114 | }, | 123 | }, |
115 | 124 | ||
@@ -153,7 +162,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
153 | openFileCallback:{ | 162 | openFileCallback:{ |
154 | value:function(doc){ | 163 | value:function(doc){ |
155 | this.openDocument(doc); | 164 | this.openDocument(doc); |
156 | } | 165 | } |
157 | }, | 166 | }, |
158 | 167 | ||
159 | 168 | ||
@@ -188,7 +197,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
188 | 197 | ||
189 | this.textDocumentOpened(newDoc); | 198 | this.textDocumentOpened(newDoc); |
190 | 199 | ||
191 | } | 200 | } |
192 | 201 | ||
193 | // } catch (err) { | 202 | // } catch (err) { |
194 | // console.log("Could not open Document ", err); | 203 | // console.log("Could not open Document ", err); |
@@ -220,24 +229,24 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
220 | } | 229 | } |
221 | 230 | ||
222 | DocumentManager._codeEditor.editor = CodeMirror.fromTextArea(doc.textArea, { | 231 | DocumentManager._codeEditor.editor = CodeMirror.fromTextArea(doc.textArea, { |
223 | lineNumbers: true, | 232 | lineNumbers: true, |
224 | mode: type, | 233 | mode: type, |
225 | onCursorActivity: function() { | 234 | onCursorActivity: function() { |
226 | DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.hline, null); | 235 | DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.hline, null); |
227 | DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.editor.getCursor().line, "activeline"); | 236 | DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.editor.getCursor().line, "activeline"); |
228 | } | 237 | } |
229 | }); | 238 | }); |
230 | DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(0, "activeline"); | 239 | DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(0, "activeline"); |
231 | */ | 240 | */ |
232 | 241 | ||
233 | } | 242 | } |
234 | }, | 243 | }, |
235 | 244 | ||
236 | closeDocument: { | 245 | closeDocument: { |
237 | value: function(id) { | 246 | value: function(id) { |
238 | if(this.activeDocument.dirtyFlag === true){ | 247 | if(this.activeDocument.dirtyFlag === true){ |
239 | //if file dirty then alert user to save | 248 | //if file dirty then alert user to save |
240 | } | 249 | } |
241 | 250 | ||
242 | var doc = this._findDocumentByUUID(id); | 251 | var doc = this._findDocumentByUUID(id); |
243 | this._removeDocumentView(doc.container); | 252 | this._removeDocumentView(doc.container); |
@@ -362,9 +371,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
362 | this.application.ninja.stage.restoreScroll(); | 371 | this.application.ninja.stage.restoreScroll(); |
363 | this.application.ninja.stage.hideCanvas(false); | 372 | this.application.ninja.stage.hideCanvas(false); |
364 | this.application.ninja.stage.stageView.showRulers(); | 373 | this.application.ninja.stage.stageView.showRulers(); |
365 | } | ||
366 | } | 374 | } |
367 | } | 375 | } |
376 | } | ||
368 | }, | 377 | }, |
369 | 378 | ||
370 | _removeDocumentView: { | 379 | _removeDocumentView: { |
@@ -405,5 +414,5 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
405 | value: function() { | 414 | value: function() { |
406 | return "userDocument_" + (this._iframeCounter++); | 415 | return "userDocument_" + (this._iframeCounter++); |
407 | } | 416 | } |
408 | } | 417 | } |
409 | }); \ No newline at end of file | 418 | }); |
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 0088447a..51b776f1 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js | |||
@@ -54,8 +54,17 @@ exports.Content = Montage.create(Component, { | |||
54 | this.eventManager.addEventListener( "elementChanging", this, false); | 54 | this.eventManager.addEventListener( "elementChanging", this, false); |
55 | } | 55 | } |
56 | 56 | ||
57 | this.eventManager.addEventListener("openDocument", this, false); | ||
58 | } | ||
59 | }, | ||
60 | |||
61 | // Document is opened - Display the current selection | ||
62 | handleOpenDocument: { | ||
63 | value: function() { | ||
64 | |||
57 | this.eventManager.addEventListener( "elementChange", this, false); | 65 | this.eventManager.addEventListener( "elementChange", this, false); |
58 | 66 | ||
67 | // For now always assume that the stage is selected by default | ||
59 | if(this.application.ninja.selectedElements.length === 0) { | 68 | if(this.application.ninja.selectedElements.length === 0) { |
60 | this.displayStageProperties(); | 69 | this.displayStageProperties(); |
61 | } | 70 | } |
diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.js b/js/panels/properties/sections/three-d-view.reel/three-d-view.js index 0c4a9171..35591afa 100755 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.js +++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.js | |||
@@ -207,29 +207,32 @@ exports.ThreeD = Montage.create(Component, { | |||
207 | templateDidLoad : { | 207 | templateDidLoad : { |
208 | value: function() { | 208 | value: function() { |
209 | Object.defineBinding(this, "axisMode", { | 209 | Object.defineBinding(this, "axisMode", { |
210 | boundObject: this.axisModeGroupControl, | 210 | boundObject: this.axisModeGroupControl, |
211 | boundObjectPropertyPath: "selectedIndex", | 211 | boundObjectPropertyPath: "selectedIndex", |
212 | oneway: false | 212 | oneway: false |
213 | }); | 213 | }); |
214 | |||
215 | this.eventManager.addEventListener("openDocument", this, false); | ||
216 | } | ||
217 | }, | ||
218 | |||
219 | handleOpenDocument: { | ||
220 | value: function() { | ||
214 | 221 | ||
215 | Object.defineBinding(this, "item", { | 222 | Object.defineBinding(this, "item", { |
216 | boundObject: this, | 223 | boundObject: this, |
217 | boundObjectPropertyPath: "application.ninja.selectedElements", | 224 | boundObjectPropertyPath: "application.ninja.selectedElements", |
218 | boundValueMutator: this._getSelectedItem, | 225 | boundValueMutator: this._getSelectedItem, |
219 | oneway: true | 226 | oneway: true |
220 | }); | 227 | }); |
221 | } | 228 | } |
222 | }, | 229 | }, |
223 | 230 | ||
224 | _getSelectedItem: { | 231 | _getSelectedItem: { |
225 | value: function(els) | 232 | value: function(els) { |
226 | { | 233 | if(els.length) { |
227 | if(els.length) | ||
228 | { | ||
229 | return els[0]._element || els[0]; | <