diff options
author | Valerio Virgillito | 2012-05-29 15:32:47 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-29 15:32:47 -0700 |
commit | 5d7dff15e1e603e3b37057b9843e4b1eef1b2dca (patch) | |
tree | 25c2a5a1b4a273fc32a555cf662b6963a5770885 /js | |
parent | 4fa08fe2ce439a5f5c248c568f72d3828ee11b36 (diff) | |
download | ninja-5d7dff15e1e603e3b37057b9843e4b1eef1b2dca.tar.gz |
cleanup and handling the document views in the document controller for now.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-x | js/components/layout/document-entry.reel/document-entry.css | 2 | ||||
-rwxr-xr-x | js/components/layout/tools-list.reel/tools-list.js | 9 | ||||
-rwxr-xr-x | js/components/layout/tools-properties.reel/tools-properties.js | 22 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 60 | ||||
-rwxr-xr-x | js/document/_toDelete/html-document.js | 874 | ||||
-rwxr-xr-x | js/document/_toDelete/text-document.js | 198 | ||||
-rwxr-xr-x | js/document/views/code.js | 6 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.html | 5 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 25 |
9 files changed, 40 insertions, 1161 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index 6a2900be..87880b8d 100755 --- a/js/components/layout/document-entry.reel/document-entry.css +++ b/js/components/layout/document-entry.reel/document-entry.css | |||
@@ -42,7 +42,7 @@ | |||
42 | background-color:#7F7F7F; | 42 | background-color:#7F7F7F; |
43 | } | 43 | } |
44 | 44 | ||
45 | .documentEntry img:hover { | 45 | .documentEntry button:hover { |
46 | opacity: 1.0; /* 100% */ | 46 | opacity: 1.0; /* 100% */ |
47 | } | 47 | } |
48 | 48 | ||
diff --git a/js/components/layout/tools-list.reel/tools-list.js b/js/components/layout/tools-list.reel/tools-list.js index 638aea41..c46c065e 100755 --- a/js/components/layout/tools-list.reel/tools-list.js +++ b/js/components/layout/tools-list.reel/tools-list.js | |||
@@ -64,18 +64,9 @@ exports.ToolsList = Montage.create(Component, { | |||
64 | } | 64 | } |
65 | }, | 65 | }, |
66 | 66 | ||
67 | handleCloseDocument: { | ||
68 | value: function(){ | ||
69 | if(!this.application.ninja.documentController.activeDocument) { | ||
70 | this.disabled = true; | ||
71 | } | ||
72 | } | ||
73 | }, | ||
74 | |||
75 | prepareForDraw: { | 67 | prepareForDraw: { |
76 | enumerable: false, | 68 | enumerable: false, |
77 | value: function() { | 69 | value: function() { |
78 | this.eventManager.addEventListener( "closeDocument", this, false); | ||
79 | this.PenTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties;//this.application.Ninja.toolsProperties.penProperties; | 70 | this.PenTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties;//this.application.Ninja.toolsProperties.penProperties; |
80 | 71 | ||
81 | this.SelectionTool.options = this.application.ninja.toolsProperties.selectionProperties; | 72 | this.SelectionTool.options = this.application.ninja.toolsProperties.selectionProperties; |
diff --git a/js/components/layout/tools-properties.reel/tools-properties.js b/js/components/layout/tools-properties.reel/tools-properties.js index c25559ae..6ea4ad85 100755 --- a/js/components/layout/tools-properties.reel/tools-properties.js +++ b/js/components/layout/tools-properties.reel/tools-properties.js | |||
@@ -46,28 +46,6 @@ exports.ToolsProperties = Montage.create(Component, { | |||
46 | } | 46 | } |
47 | }, | 47 | }, |
48 | 48 | ||
49 | handleCloseDocument: { | ||
50 | value: function(){ | ||
51 | if(!this.application.ninja.documentController.activeDocument) { | ||
52 | this.disabled = true; | ||
53 | } | ||
54 | } | ||
55 | }, | ||
56 | |||
57 | prepareForDraw: { | ||
58 | enumerable: false, | ||
59 | value: function() { | ||
60 | this.eventManager.addEventListener( "closeDocument", this, false); | ||
61 | } | ||
62 | }, | ||
63 | |||
64 | draw: { | ||
65 | enumerable: false, | ||
66 | value: function() { | ||
67 | //this.selectionProperties.needsDraw = true; | ||
68 | } | ||
69 | }, | ||
70 | |||
71 | _currentSelectedTool : { | 49 | _currentSelectedTool : { |
72 | value: null | 50 | value: null |
73 | }, | 51 | }, |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 948e4550..eba950b9 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -22,6 +22,30 @@ exports.DocumentController = Montage.create(Component, { | |||
22 | value: [] | 22 | value: [] |
23 | }, | 23 | }, |
24 | 24 | ||
25 | _currentDocument: { | ||
26 | value : null | ||
27 | }, | ||
28 | |||
29 | currentDocument : { | ||
30 | get : function() { | ||
31 | return this._currentDocument; | ||
32 | }, | ||
33 | set : function(value) { | ||
34 | if (value === this._currentDocument || value.getProperty("currentView") !== "design") { | ||
35 | return; | ||
36 | } | ||
37 | |||
38 | if(this._currentDocument) { | ||
39 | this._currentDocument.model.currentView.hide(); | ||
40 | } | ||
41 | |||
42 | this._currentDocument = value; | ||
43 | |||
44 | this._currentDocument.model.currentView.show(); | ||
45 | |||
46 | } | ||
47 | }, | ||
48 | |||
25 | deserializedFromTemplate: { | 49 | deserializedFromTemplate: { |
26 | value: function() { //TODO: Add event naming consistency (save, fileOpen and newFile should be consistent, all file events should be executeFile[operation name]) | 50 | value: function() { //TODO: Add event naming consistency (save, fileOpen and newFile should be consistent, all file events should be executeFile[operation name]) |
27 | this.eventManager.addEventListener("appLoaded", this, false); | 51 | this.eventManager.addEventListener("appLoaded", this, false); |
@@ -280,11 +304,11 @@ exports.DocumentController = Montage.create(Component, { | |||
280 | 304 | ||
281 | //Open in designer view | 305 | //Open in designer view |
282 | this.redirectRequests = false; | 306 | this.redirectRequests = false; |
283 | Montage.create(HTMLDocument).init(file, this, this._onOpenDocument, 'design', template); | 307 | Montage.create(HTMLDocument).init(file, this.application.ninja, this.application.ninja.openDocument, 'design', template); |
284 | break; | 308 | break; |
285 | default: | 309 | default: |
286 | //Open in code view | 310 | //Open in code view |
287 | Montage.create(TextDocument).init(file, this, this._onOpenTextDocument, 'code'); | 311 | Montage.create(TextDocument).init(file, this.application.ninja, this.application.ninja.openDocument, 'code'); |
288 | break; | 312 | break; |
289 | } | 313 | } |
290 | } | 314 | } |
@@ -365,42 +389,10 @@ exports.DocumentController = Montage.create(Component, { | |||
365 | } | 389 | } |
366 | }, | 390 | }, |
367 | 391 | ||
368 | // Open document callback | ||
369 | _onOpenDocument: { | ||
370 | value: function(doc){ | ||
371 | |||
372 | |||
373 | // Bypass all and call main. | ||
374 | // TODO: Call ninja directly once this is all cleaned up. | ||
375 | |||
376 | this.application.ninja.handleOnOpenDocument(doc); | ||
377 | |||
378 | |||
379 | // var currentDocument; | ||
380 | // if(this.activeDocument) { | ||
381 | // There is a document currently opened | ||
382 | // currentDocument = this.activeDocument; | ||
383 | // } else { | ||
384 | // There is no document opened | ||
385 | |||
386 | // } | ||
387 | |||
388 | // Set the active document | ||
389 | // this.activeDocument = doc; | ||
390 | |||
391 | |||
392 | // this.switchDocuments(currentDocument, doc, true); | ||
393 | |||
394 | |||
395 | } | ||
396 | }, | ||
397 | |||
398 | 392 | ||
399 | _onOpenTextDocument: { | 393 | _onOpenTextDocument: { |
400 | value: function(doc) { | 394 | value: function(doc) { |
401 | 395 | ||
402 | this.application.ninja.handleOnOpenDocument(doc); | ||
403 | |||
404 | // Main DIFFERENCE -- | 396 | // Main DIFFERENCE -- |
405 | // TODO: Implement Code View here | 397 | // TODO: Implement Code View here |
406 | //document.getElementById("iframeContainer").style.display = "none"; | 398 | //document.getElementById("iframeContainer").style.display = "none"; |
diff --git a/js/document/_toDelete/html-document.js b/js/document/_toDelete/html-document.js deleted file mode 100755 index 447d90e3..00000000 --- a/js/document/_toDelete/html-document.js +++ /dev/null | |||
@@ -1,874 +0,0 @@ | |||
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 | //////////////////////////////////////////////////////////////////////// | ||
8 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | TextDocument = require("js/document/text-document").TextDocument, | ||
11 | NJUtils = require("js/lib/NJUtils").NJUtils, | ||
12 | GLWorld = require("js/lib/drawing/world").World, | ||
13 | MaterialsModel = require("js/models/materials-model").MaterialsModel; | ||
14 | //////////////////////////////////////////////////////////////////////// | ||
15 | // | ||
16 | exports.HTMLDocument = Montage.create(TextDocument, { | ||
17 | |||
18 | _selectionExclude: { value: null, enumerable: false }, | ||
19 | _htmlTemplateUrl: { value: "js/document/templates/montage-html/index.html", enumerable: false}, | ||
20 | _iframe: { value: null, enumerable: false }, | ||
21 | _server: { value: null, enumerable: false }, | ||
22 | _templateDocument: { value: null, enumerable: false }, | ||
23 | _selectionModel: { value: [], enumerable: false }, | ||
24 | _undoModel: { value: { "queue" : [], "position" : 0 }, enumerable: false}, | ||
25 | |||
26 | _document: { value: null, enumerable: false }, | ||
27 | _documentRoot: { value: null, enumerable: false }, | ||
28 | _liveNodeList: { value: null, enumarable: false }, | ||
29 | _stageBG: { value: null, enumerable: false }, | ||
30 | _window: { value: null, enumerable: false }, | ||
31 | _styles: { value: null, enumerable: false }, | ||
32 | _stylesheets: { value: null, enumerable: false }, | ||
33 | _stageStyleSheetId : { value: 'nj-stage-stylesheet', enumerable: false }, | ||
34 | _userDocument: { value: null, enumerable: false }, | ||
35 | _htmlSource: {value: "<html></html>", enumerable: false}, | ||
36 | _glData: {value: null, enumerable: false }, |