diff options
author | Pushkar Joshi | 2012-06-06 07:54:11 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-06-06 07:54:11 -0700 |
commit | cfa1402ac2ce831a83a9d4263d06c452c157a414 (patch) | |
tree | adb8f1f1ad1c4dd1e7e9eee1bd206f1ec338d20c /js/components/layout | |
parent | 8606ee7ec851cb0a971e7556eba5d9386f1b3639 (diff) | |
parent | 5ba54dc275b07e7b2d0ed14751761d1e663d3d14 (diff) | |
download | ninja-cfa1402ac2ce831a83a9d4263d06c452c157a414.tar.gz |
Merge branch 'pentool' into brushtool
Diffstat (limited to 'js/components/layout')
12 files changed, 219 insertions, 184 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 49dbe3cb..ac131f2c 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -9,21 +9,44 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | exports.Breadcrumb = Montage.create(Component, { | 10 | exports.Breadcrumb = Montage.create(Component, { |
11 | 11 | ||
12 | disabled: { | 12 | _currentDocument: { |
13 | value: true | 13 | enumerable: false, |
14 | value: null | ||
14 | }, | 15 | }, |
15 | 16 | ||
16 | handleOpenDocument: { | 17 | currentDocument: { |
17 | value: function(){ | 18 | enumerable: false, |
18 | this.disabled = false; | 19 | get: function() { |
20 | return this._currentDocument; | ||
21 | }, | ||
22 | set: function(value) { | ||
23 | if (value === this._currentDocument) { | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | this._currentDocument = value; | ||
28 | |||
29 | if(!value) { | ||
30 | this.disabled = true; | ||
31 | } else { | ||
32 | this.disabled = this._currentDocument.currentView !== "design"; | ||
33 | } | ||
34 | |||
19 | } | 35 | } |
20 | }, | 36 | }, |
21 | 37 | ||
22 | handleCloseDocument: { | 38 | |
23 | value: function(){ | 39 | _disabled: { |
24 | if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { | 40 | value: true |
25 | this.disabled = true; | 41 | }, |
26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null); | 42 | |
43 | disabled: { | ||
44 | get: function() { | ||
45 | return this._disabled; | ||
46 | }, | ||
47 | set: function(value) { | ||
48 | if(value !== this._disabled) { | ||
49 | this._disabled = value; | ||
27 | } | 50 | } |
28 | } | 51 | } |
29 | }, | 52 | }, |
@@ -50,8 +73,6 @@ exports.Breadcrumb = Montage.create(Component, { | |||
50 | 73 | ||
51 | prepareForDraw: { | 74 | prepareForDraw: { |
52 | value: function() { | 75 | value: function() { |
53 | this.eventManager.addEventListener("openDocument", this, false); | ||
54 | this.eventManager.addEventListener("closeDocument", this, false); | ||
55 | this.breadcrumbBt.addEventListener("action", this, false); | 76 | this.breadcrumbBt.addEventListener("action", this, false); |
56 | } | 77 | } |
57 | }, | 78 | }, |
@@ -65,7 +86,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
65 | 86 | ||
66 | parentNode = this.container; | 87 | parentNode = this.container; |
67 | 88 | ||
68 | while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) { | 89 | while(parentNode !== this.currentDocument.model.documentRoot) { |
69 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 90 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
70 | parentNode = parentNode.parentNode; | 91 | parentNode = parentNode.parentNode; |
71 | } | 92 | } |
@@ -87,6 +108,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
87 | this.containerElements.pop(); | 108 | this.containerElements.pop(); |
88 | } | 109 | } |
89 | 110 | ||
111 | // TODO: This is bound 2 ways, update the internal property | ||
90 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; | 112 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; |
91 | } | 113 | } |
92 | } | 114 | } |
diff --git a/js/components/layout/document-bar.reel/document-bar.html b/js/components/layout/document-bar.reel/document-bar.html index 760186ba..a35b5590 100755 --- a/js/components/layout/document-bar.reel/document-bar.html +++ b/js/components/layout/document-bar.reel/document-bar.html | |||
@@ -37,11 +37,7 @@ | |||
37 | "element": {"#": "disabledCondition"} | 37 | "element": {"#": "disabledCondition"} |
38 | }, | 38 | }, |
39 | "bindings": { | 39 | "bindings": { |
40 | "condition": { | 40 | "condition": {"<-": "@owner.disabled"} |
41 | "boundObject": {"@": "owner"}, | ||
42 | "boundObjectPropertyPath": "disabled", | ||
43 | "oneway": true | ||
44 | } | ||
45 | } | 41 | } |
46 | }, | 42 | }, |
47 | 43 | ||
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 56b61f1d..1cb0bd90 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js | |||
@@ -9,13 +9,64 @@ var Component = require("montage/ui/component").Component; | |||
9 | 9 | ||
10 | exports.DocumentBar = Montage.create(Component, { | 10 | exports.DocumentBar = Montage.create(Component, { |
11 | 11 | ||
12 | designView: { value: null, enumerable: false}, | 12 | _currentDocument: { |
13 | codeView: { value: null, enumerable: false}, | 13 | enumerable: false, |
14 | zoomControl: { value: null, enumerable: false }, | 14 | value: null |
15 | _type: { enumerable: false, value: null }, | 15 | }, |
16 | disabled: { value: true }, | 16 | |
17 | currentDocument: { | ||
18 | enumerable: false, | ||
19 | get: function() { | ||
20 | return this._currentDocument; | ||
21 | }, | ||
22 | set: function(value) { | ||
23 | if (value === this._currentDocument) { | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | this._currentDocument = value; | ||
28 | |||
29 | this.disabled = !this._currentDocument; | ||
30 | |||
31 | if(this._currentDocument && this._currentDocument.currentView === "design") { | ||
32 | this.visible = true; | ||
33 | } else if(this._currentDocument && this._currentDocument.currentView === "code") { | ||
34 | this.visible = false; | ||
35 | } | ||
36 | } | ||
37 | }, | ||
38 | |||
39 | _visible: { | ||
40 | value: false | ||
41 | }, | ||
42 | |||
43 | visible: { | ||
44 | get: function() { | ||
45 | return this._visible; | ||
46 | }, | ||
47 | set: function(value) { | ||
48 | if(this._visible !== value) { | ||
49 | this._visible = value; | ||
50 | this.needsDraw = true; | ||
51 | } | ||
52 | } | ||
53 | }, | ||
54 | |||
55 | designView: { | ||
56 | value: null | ||
57 | }, | ||
58 | |||
59 | codeView: { | ||
60 | value: null | ||
61 | }, | ||
17 | 62 | ||
63 | zoomControl: { | ||
64 | value: null | ||
65 | }, | ||
18 | 66 | ||
67 | _type: { | ||
68 | value: null | ||
69 | }, | ||
19 | 70 | ||
20 | type: { | 71 | type: { |
21 | enumerable: false, | 72 | enumerable: false, |
@@ -31,7 +82,9 @@ exports.DocumentBar = Montage.create(Component, { | |||
31 | } | 82 | } |
32 | }, | 83 | }, |
33 | 84 | ||
34 | _currentView: { value: null, enumerable: false }, | 85 | _currentView: { |
86 | value: null | ||
87 | }, | ||
35 | 88 | ||
36 | currentView: { | 89 | currentView: { |
37 | get: function() { return this._currentView}, | 90 | get: function() { return this._currentView}, |
@@ -45,7 +98,9 @@ exports.DocumentBar = Montage.create(Component, { | |||
45 | } |