diff options
author | Valerio Virgillito | 2012-02-15 16:09:47 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-15 16:09:47 -0800 |
commit | d366c0bd1af6471511217ed574083e15059519b5 (patch) | |
tree | c8c9f9af761457e3c5f4c6774fb0fbba851df0c4 /js/stage | |
parent | 997ce3fb65f27b3d6f331f63b5dc22d3c7fb8f1e (diff) | |
parent | b85bfb54aaca3ccca3c1ef09115de925cd67f4e9 (diff) | |
download | ninja-d366c0bd1af6471511217ed574083e15059519b5.tar.gz |
Merge branch 'refs/heads/integration'
Diffstat (limited to 'js/stage')
-rwxr-xr-x[-rw-r--r--] | js/stage/layout.js | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | js/stage/stage-deps.js | 21 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.css | 37 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.html | 31 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 247 | ||||
-rwxr-xr-x[-rw-r--r--] | js/stage/stage.reel/stage.css | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | js/stage/stage.reel/stage.html | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | js/stage/stage.reel/stage.js | 32 | ||||
-rwxr-xr-x[-rw-r--r--] | js/stage/tool-handle.js | 0 |
9 files changed, 356 insertions, 24 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js index 1a491210..1a491210 100644..100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js | |||
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js index 7c6d58b4..d46e2b81 100644..100755 --- a/js/stage/stage-deps.js +++ b/js/stage/stage-deps.js | |||
@@ -4,18 +4,15 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component, |
9 | 9 | snapManager = require("js/helper-classes/3D/snap-manager").SnapManager, | |
10 | var snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; | 10 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, |
11 | var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils; | 11 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, |
12 | var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; | 12 | ElementPlanes = require("js/helper-classes/3D/element-planes").ElementPlanes, |
13 | var ElementPlanes = require("js/helper-classes/3D/element-planes").ElementPlanes; | 13 | MathUtilsClass = require("js/helper-classes/3D/math-utils").MathUtilsClass, |
14 | var MathUtilsClass = require("js/helper-classes/3D/math-utils").MathUtilsClass; | 14 | VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, |
15 | var VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | 15 | DrawingToolBase = require("js/tools/drawing-tool-base").DrawingToolBase; |
16 | |||
17 | //TODO : This dependency needs to be reworked | ||
18 | var DrawingToolBase = require("js/tools/drawing-tool-base").DrawingToolBase; | ||
19 | 16 | ||
20 | exports.StageDeps = Montage.create(Component, { | 17 | exports.StageDeps = Montage.create(Component, { |
21 | viewUtils: { | 18 | viewUtils: { |
diff --git a/js/stage/stage-view.reel/stage-view.css b/js/stage/stage-view.reel/stage-view.css new file mode 100755 index 00000000..ce7072c7 --- /dev/null +++ b/js/stage/stage-view.reel/stage-view.css | |||
@@ -0,0 +1,37 @@ | |||
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 | .codeViewContainer { | ||
8 | position: absolute; | ||
9 | top: 0px; | ||
10 | left: 0px; | ||
11 | margin: 0px; | ||
12 | padding: 0px; | ||
13 | background-color: #ffffff; | ||
14 | width: 100%; | ||
15 | height: 100%; | ||
16 | overflow:auto; | ||
17 | /*display: none;*/ | ||
18 | } | ||
19 | |||
20 | /* OLD CSS for reference | ||
21 | #mainContent #codeMirror_1 { | ||
22 | height:100%; | ||
23 | } | ||
24 | */ | ||
25 | |||
26 | .CodeMirror { | ||
27 | width: 100%; | ||
28 | height: 100%; | ||
29 | background: white; | ||
30 | } | ||
31 | |||
32 | .CodeMirror .CodeMirror-scroll { | ||
33 | height: 100%; | ||
34 | overflow: scroll; | ||
35 | overflow-x: auto; | ||
36 | overflow-y: auto; | ||
37 | } | ||
diff --git a/js/stage/stage-view.reel/stage-view.html b/js/stage/stage-view.reel/stage-view.html new file mode 100755 index 00000000..ee8fa315 --- /dev/null +++ b/js/stage/stage-view.reel/stage-view.html | |||
@@ -0,0 +1,31 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- <copyright> | ||
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
5 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
6 | </copyright> --> | ||
7 | <html> | ||
8 | <head> | ||
9 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
10 | <link rel="stylesheet" type="text/css" href="stage-view.css"> | ||
11 | |||
12 | <script type="text/montage-serialization"> | ||
13 | { | ||
14 | "owner": { | ||
15 | "module": "js/stage/stage-view.reel", | ||
16 | "name": "StageView", | ||
17 | "properties": { | ||
18 | "element": {"#": "codeViewContainer"} | ||
19 | } | ||
20 | } | ||
21 | } | ||
22 | </script> | ||
23 | |||
24 | </head> | ||
25 | <body> | ||
26 | |||
27 | |||
28 | <section id="codeViewContainer" class="codeViewContainer"></section> | ||
29 | |||
30 | </body> | ||
31 | </html> | ||
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js new file mode 100755 index 00000000..31ace49c --- /dev/null +++ b/js/stage/stage-view.reel/stage-view.js | |||
@@ -0,0 +1,247 @@ | |||
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 | @requires montage/core/core | ||
9 | @requires montage/ui/component | ||
10 | */ | ||
11 | var Montage = require("montage/core/core").Montage, | ||
12 | Component = require("montage/ui/component").Component; | ||
13 | |||
14 | exports.StageView = Montage.create(Component, { | ||
15 | _documents: { | ||
16 | value : [] | ||
17 | }, | ||
18 | |||
19 | docs: { | ||
20 | get: function() { | ||
21 | return this._documents; | ||
22 | }, | ||
23 | set: function(value) { | ||
24 | //console.log(value); | ||
25 | } | ||
26 | }, | ||
27 | |||
28 | templateDidLoad: { | ||
29 | value: function() { | ||
30 | this.eventManager.addEventListener("appLoaded", this, false); | ||
31 | } | ||
32 | }, | ||
33 | |||
34 | didDraw:{ | ||
35 | value: function() { | ||
36 | if(!this.application.ninja.documentController._textHolder) this.application.ninja.documentController._textHolder = this.element; | ||
37 | } | ||
38 | }, | ||
39 | |||
40 | handleAppLoaded: { | ||
41 | value: function() { | ||
42 | |||
43 | // Don't bind for now | ||
44 | /* | ||
45 | Object.defineBinding(this, "docs", { | ||
46 | boundObject: this.application.ninja.documentController, | ||
47 | boundObjectPropertyPath: "_documents" | ||
48 | }); | ||
49 | */ | ||
50 | |||
51 | } | ||
52 | }, | ||
53 | |||
54 | /** | ||
55 | * Creates a text area which will contain the content of the opened text document. | ||
56 | */ | ||
57 | createTextAreaElement: { | ||
58 | value: function(uuid) { | ||
59 | |||
60 | |||
61 | var codeMirrorDiv = document.createElement("div"); | ||
62 | codeMirrorDiv.id = "codeMirror_" + uuid; | ||
63 | codeMirrorDiv.style.display = "block"; | ||
64 | this.element.appendChild(codeMirrorDiv); | ||
65 | |||
66 | var textArea = document.createElement("textarea"); | ||
67 | textArea.id = "code"; | ||
68 | textArea.name = "code"; | ||
69 | |||
70 | codeMirrorDiv.appendChild(textArea); | ||
71 | |||
72 | return textArea; | ||
73 | } | ||
74 | }, | ||
75 | |||
76 | // Temporary function to create a Codemirror text view | ||
77 | createTextView: { | ||
78 | value: function(doc) { | ||
79 | this.application.ninja.documentController._hideCurrentDocument(); | ||
80 | this.hideOtherDocuments(doc.uuid); | ||
81 | var type; | ||
82 | switch(doc.documentType) { | ||
83 | case "css" : | ||
84 | type = "css"; | ||
85 | break; | ||
86 | case "js" : | ||
87 | type = "javascript"; | ||
88 | break; | ||
89 | } | ||
90 | |||
91 | //fix hack | ||
92 | document.getElementById("codeMirror_"+doc.uuid).style.display="block"; | ||
93 | |||
94 | var documentController = this.application.ninja.documentController; | ||
95 | doc.editor = CodeMirror.fromTextArea(doc.textArea, { | ||
96 | lineNumbers: true, | ||
97 | mode: type, | ||
98 | onChange: function(){ | ||
99 | var historySize = doc.editor.historySize(); | ||
100 | if(historySize.undo>0){ | ||
101 | doc.dirtyFlag=true; | ||
102 | }else if(historySize.undo===0 && historySize.redo>0){ | ||
103 | doc.dirtyFlag=false; | ||
104 | } | ||
105 | }, | ||
106 | onCursorActivity: function() { | ||
107 | //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); | ||
108 | //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); | ||
109 | } | ||
110 | }); | ||
111 | |||
112 | //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineC |