aboutsummaryrefslogtreecommitdiff
path: root/js/stage/stage.reel
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-29 00:34:40 -0700
committerValerio Virgillito2012-05-29 00:34:40 -0700
commit4c3aac5eabd93052b1554a03d78235215bb49db4 (patch)
treefe08f4f6d33d81d602f56daeaec845577fb9d8a5 /js/stage/stage.reel
parent9a66ccad0235484643ef6d821315b11b5be4a93e (diff)
downloadninja-4c3aac5eabd93052b1554a03d78235215bb49db4.tar.gz
document bindings phase 1
- using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/stage/stage.reel')
-rwxr-xr-xjs/stage/stage.reel/stage.html18
-rwxr-xr-xjs/stage/stage.reel/stage.js37
2 files changed, 34 insertions, 21 deletions
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html
index 30c3d231..89b674ab 100755
--- a/js/stage/stage.reel/stage.html
+++ b/js/stage/stage.reel/stage.html
@@ -18,25 +18,25 @@
18 } 18 }
19 }, 19 },
20 20
21 "StageDeps1": { 21 "stageDeps": {
22 "prototype": "js/stage/stage-deps", 22 "prototype": "js/stage/stage-deps",
23 "properties": { 23 "properties": {
24 "stage": {"@": "owner"} 24 "stage": {"@": "owner"}
25 },
26 "bindings": {
27 "currentDocument": {"<-": "@owner.currentDocument"}
25 } 28 }
26 }, 29 },
27 30
28 "layout1": { 31 "layout": {
29 "prototype": "js/stage/layout", 32 "prototype": "js/stage/layout",
30 "properties": { 33 "properties": {
31 "canvas": {"#": "layoutCanvas"}, 34 "canvas": {"#": "layoutCanvas"},
32 "stage": {"@": "owner"} 35 "stage": {"@": "owner"}
33 }, 36 },
34 "bindings": { 37 "bindings": {
35 "layoutView": { 38 "layoutView": {"<-": "@owner.appModel.layoutView"},
36 "boundObject": {"@": "owner" }, 39 "currentDocument": {"<-": "@owner.currentDocument"}
37 "boundObjectPropertyPath": "appModel.layoutView",
38 "oneway": true
39 }
40 } 40 }
41 }, 41 },
42 42
@@ -59,8 +59,8 @@
59 "_layoutCanvas": {"#": "layoutCanvas"}, 59 "_layoutCanvas": {"#": "layoutCanvas"},
60 "_canvas": {"#": "stageCanvas"}, 60 "_canvas": {"#": "stageCanvas"},
61 "_drawingCanvas": {"#": "drawingCanvas"}, 61 "_drawingCanvas": {"#": "drawingCanvas"},
62 "stageDeps": {"@": "StageDeps1"}, 62 "stageDeps": {"@": "stageDeps"},
63 "layout": {"@": "layout1"}, 63 "layout": {"@": "layout"},
64 "stageView": {"@": "stageView"}, 64 "stageView": {"@": "stageView"},
65 "textTool": {"@": "textTool"}, 65 "textTool": {"@": "textTool"},
66 "focusManager": {"@": "focusManager"} 66 "focusManager": {"@": "focusManager"}
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index c7afb95c..e00d2b54 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -155,25 +155,41 @@ exports.Stage = Montage.create(Component, {
155 set: function(value) { this._userContentBorder = value; } 155 set: function(value) { this._userContentBorder = value; }
156 }, 156 },
157 157
158 _activeDocument : { 158 _currentDocument: {
159 value : null, 159 value : null,
160 enumerable : false 160 enumerable : false
161 }, 161 },
162 162
163 activeDocument : { 163 currentDocument : {
164 get : function() { 164 get : function() {
165 return this._activeDocument; 165 return this._currentDocument;
166 }, 166 },
167 set : function(document) { 167 set : function(value) {
168 ///// If the document is null set default stylesheets to null 168 // TODO: WRONG! Fails when going from design to code view
169 if (value === this._currentDocument || value.getProperty("currentView") !== "design") {
170 console.log("Stage - current document not set since the same value of " + this._currentDocument + " and value " + value);
171 return;
172 }
169 173
170 if(!document) { 174 if(!value) {
171 return false; 175 // Show the rulers
176 this.showRulers();
177 // Show the canvas
178 this.hideCanvas(false);
172 } 179 }
173 180
174 ///// setting document via binding 181 //console.log("Stage - set current document with value of " + value);
175 this._activeDocument = document; 182 this._currentDocument = value;
183
184 if(this._currentDocument.currentView === "design") {
185 this.clearAllCanvas();
186 this.initWithDocument(false);
187 }
176 188
189 if(!this._currentDocument) {
190 this.hideRulers();
191 this.hideCanvas(true);
192 }
177 }, 193 },
178 enumerable : false 194 enumerable : false
179 }, 195 },
@@ -295,9 +311,6 @@ exports.Stage = Montage.create(Component, {
295 this._scrollLeft = 0; 311 this._scrollLeft = 0;
296 this._scrollTop = 0; 312 this._scrollTop = 0;
297 313
298 this.stageDeps.handleOpenDocument();
299 this.layout.handleOpenDocument();
300
301 if(designView._template) { 314 if(designView._template) {
302 var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); 315 var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2);
303 var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); 316 var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2);