aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-16 11:23:12 -0700
committerValerio Virgillito2012-05-16 11:23:12 -0700
commit0ebb822b0535bf1bb100b3f3cb396c8b6d3383f1 (patch)
tree4171cda275fa5b632c2cdc33ee762128fd84be8f
parentb2c8041058ab8d16ca49d70ed24ddd29e79f51d2 (diff)
downloadninja-0ebb822b0535bf1bb100b3f3cb396c8b6d3383f1.tar.gz
fixing some of the document bindings.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-xjs/controllers/styles-controller.js11
-rwxr-xr-xjs/data/menu-data.js35
-rwxr-xr-xjs/ninja.reel/ninja.html14
-rwxr-xr-xjs/stage/stage-deps.js6
-rwxr-xr-xjs/stage/stage.reel/stage.html3
-rwxr-xr-xjs/stage/stage.reel/stage.js23
6 files changed, 49 insertions, 43 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 26485508..ae504f0e 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -53,11 +53,11 @@ var stylesController = exports.StylesController = Montage.create(Component, {
53 ///// Bind app's activeDocument property to 53 ///// Bind app's activeDocument property to
54 ///// styles controller's _activeDocument property 54 ///// styles controller's _activeDocument property
55 55
56 Object.defineBinding(this, "activeDocument", { 56// Object.defineBinding(this, "activeDocument", {
57 boundObject: this.application.ninja, 57// boundObject: this.application.ninja,
58 boundObjectPropertyPath: "currentDocument", 58// boundObjectPropertyPath: "currentDocument",
59 oneway: true 59// oneway: true
60 }); 60// });
61 } 61 }
62 }, 62 },
63 63
@@ -79,7 +79,6 @@ var stylesController = exports.StylesController = Montage.create(Component, {
79 return this._activeDocument; 79 return this._activeDocument;
80 }, 80 },
81 set : function(document) { 81 set : function(document) {
82
83 ///// If the document is null set default stylesheets to null 82 ///// If the document is null set default stylesheets to null
84 83
85 if(!document) { 84 if(!document) {
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 1cde3e8d..7cf40a8a 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -36,11 +36,8 @@ exports.MenuData = Montage.create( Montage, {
36 "enabled": { 36 "enabled": {
37 "value": false, 37 "value": false,
38 "boundObj": "documentController", 38 "boundObj": "documentController",
39 "boundProperty": "activeDocument", 39 "boundProperty": "_documents.count()",
40 "oneway": true, 40 "oneway": true
41 "boundValueMutator": function(activeDocument){
42 return activeDocument !== null;
43 }
44 }, 41 },
45 "action": "executeFileClose" 42 "action": "executeFileClose"
46 }, 43 },
@@ -50,11 +47,8 @@ exports.MenuData = Montage.create( Montage, {
50 "enabled": { 47 "enabled": {
51 "value": false, 48 "value": false,
52 "boundObj": "documentController", 49 "boundObj": "documentController",
53 "boundProperty": "activeDocument", 50 "boundProperty": "_documents.count()",
54 "oneway": true, 51 "oneway": true
55 "boundValueMutator": function(activeDocument){
56 return activeDocument !== null;
57 }
58 }, 52 },
59 "action": "executeFileCloseAll" 53 "action": "executeFileCloseAll"
60 }, 54 },
@@ -68,11 +62,8 @@ exports.MenuData = Montage.create( Montage, {
68 "enabled": { 62 "enabled": {
69 "value": false, 63 "value": false,
70 "boundObj": "documentController", 64 "boundObj": "documentController",
71 "boundProperty": "activeDocument", 65 "boundProperty": "_documents.count()",
72 "oneway": true, 66 "oneway": true
73 "boundValueMutator": function(activeDocument){
74 return activeDocument !== null;
75 }
76 }, 67 },
77 "action": "executeSave" 68 "action": "executeSave"
78 }, 69 },
@@ -82,11 +73,8 @@ exports.MenuData = Montage.create( Montage, {
82 "enabled": { 73 "enabled": {
83 "value": false, 74 "value": false,
84 "boundObj": "documentController", 75 "boundObj": "documentController",
85 "boundProperty": "activeDocument", 76 "boundProperty": "_documents.count()",
86 "oneway": true, 77 "oneway": true
87 "boundValueMutator": function(activeDocument) {
88 return activeDocument !== null;
89 }
90 }, 78 },
91 "action":"executeSaveAs" 79 "action":"executeSaveAs"
92 }, 80 },
@@ -96,11 +84,8 @@ exports.MenuData = Montage.create( Montage, {
96 "enabled": { 84 "enabled": {
97 "value": false, 85 "value": false,
98 "boundObj": "documentController", 86 "boundObj": "documentController",
99 "boundProperty": "activeDocument", 87 "boundProperty": "_documents.count()",
100 "oneway": true, 88 "oneway": true
101 "boundValueMutator": function(activeDocument){
102 return activeDocument !== null;
103 }
104 }, 89 },
105 "action": "executeSaveAll" 90 "action": "executeSaveAll"
106 }, 91 },
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html
index 52a6daa2..51d74cb2 100755
--- a/js/ninja.reel/ninja.html
+++ b/js/ninja.reel/ninja.html
@@ -186,6 +186,9 @@
186 "properties": { 186 "properties": {
187 "element": {"#": "stageAndScenesContainer"}, 187 "element": {"#": "stageAndScenesContainer"},
188 "appModel": {"@": "appModel"} 188 "appModel": {"@": "appModel"}
189 },
190 "bindings": {
191 "activeDocument": {"<-": "@documentController1.activeDocument"}
189 } 192 }
190 }, 193 },
191 194
@@ -263,11 +266,7 @@
263 "selectionController1": { 266 "selectionController1": {
264 "prototype": "js/controllers/selection-controller", 267 "prototype": "js/controllers/selection-controller",
265 "bindings" : { 268 "bindings" : {
266 "selectionContainer": { 269 "selectionContainer": {"<-": "@owner.currentSelectedContainer"}
267 "boundObject": {"@": "owner"},
268 "boundObjectPropertyPath": "currentSelectedContainer",
269 "oneway": true
270 }
271 } 270 }
272 }, 271 },
273 272
@@ -287,7 +286,10 @@
287 }, 286 },
288 287
289 "stylesController": { 288 "stylesController": {
290 "prototype": "js/controllers/styles-controller" 289 "prototype": "js/controllers/styles-controller",
290 "bindings": {
291 "activeDocument": {"<-": "@documentController1.activeDocument"}
292 }
291 }, 293 },
292 294
293 "presetsController": { 295 "presetsController": {
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js
index 33ba2359..1825eb06 100755
--- a/js/stage/stage-deps.js
+++ b/js/stage/stage-deps.js
@@ -95,12 +95,6 @@ exports.StageDeps = Montage.create(Component, {
95 handleAppLoaded: { 95 handleAppLoaded: {
96 value: function() { 96 value: function() {
97 97
98 Object.defineBinding(this, "currentDocument", {
99 boundObject: this.application.ninja,
100 boundObjectPropertyPath: "currentDocument",
101 oneway: true
102 });
103
104 Object.defineBinding(this, "userContentLeft", { 98 Object.defineBinding(this, "userContentLeft", {
105 boundObject: this.stage, 99 boundObject: this.stage,
106 boundObjectPropertyPath: "_userContentLeft", 100 boundObjectPropertyPath: "_userContentLeft",
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html
index 30c3d231..88cd6149 100755
--- a/js/stage/stage.reel/stage.html
+++ b/js/stage/stage.reel/stage.html
@@ -22,6 +22,9 @@
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.activeDocument"}
25 } 28 }
26 }, 29 },
27 30
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index deed4112..125155d8 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -164,6 +164,29 @@ exports.Stage = Montage.create(Component, {
164 set: function(value) { this._userContentBorder = value; } 164 set: function(value) { this._userContentBorder = value; }
165 }, 165 },
166 166
167 _activeDocument : {
168 value : null,
169 enumerable : false
170 },
171
172 activeDocument : {
173 get : function() {
174 return this._activeDocument;
175 },
176 set : function(document) {
177 ///// If the document is null set default stylesheets to null
178
179 if(!document) {
180 return false;
181 }
182
183 ///// setting document via binding
184 this._activeDocument = document;
185
186 },
187 enumerable : false
188 },
189
167 willDraw: { 190 willDraw: {
168 value: function() { 191 value: function() {
169 if(this.resizeCanvases) { 192 if(this.resizeCanvases) {