aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/document-bar.reel/document-bar.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/layout/document-bar.reel/document-bar.js')
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.js48
1 files changed, 38 insertions, 10 deletions
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js
index 56b61f1d..6a7b0f3f 100755
--- a/js/components/layout/document-bar.reel/document-bar.js
+++ b/js/components/layout/document-bar.reel/document-bar.js
@@ -9,13 +9,32 @@ var Component = require("montage/ui/component").Component;
9 9
10exports.DocumentBar = Montage.create(Component, { 10exports.DocumentBar = Montage.create(Component, {
11 11
12 _currentDocument: {
13 enumerable: false,
14 value: null
15 },
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 }
32 },
33
12 designView: { value: null, enumerable: false}, 34 designView: { value: null, enumerable: false},
13 codeView: { value: null, enumerable: false}, 35 codeView: { value: null, enumerable: false},
14 zoomControl: { value: null, enumerable: false }, 36 zoomControl: { value: null, enumerable: false },
15 _type: { enumerable: false, value: null }, 37 _type: { enumerable: false, value: null },
16 disabled: { value: true },
17
18
19 38
20 type: { 39 type: {
21 enumerable: false, 40 enumerable: false,
@@ -86,7 +105,6 @@ exports.DocumentBar = Montage.create(Component, {
86 105
87 prepareForDraw: { 106 prepareForDraw: {
88 value: function() { 107 value: function() {
89 this.eventManager.addEventListener( "openDocument", this, false);
90 this.eventManager.addEventListener( "closeDocument", this, false); 108 this.eventManager.addEventListener( "closeDocument", this, false);
91 this.designView.addEventListener("click", this, false); 109 this.designView.addEventListener("click", this, false);
92 this.codeView.addEventListener("click", this, false); 110 this.codeView.addEventListener("click", this, false);
@@ -94,6 +112,22 @@ exports.DocumentBar = Montage.create(Component, {
94 } 112 }
95 }, 113 },
96 114
115 _disabled: {
116 value: true
117 },
118
119 disabled: {
120 get: function() {
121 return this._disabled;
122 },
123 set: function(value) {
124 if(value !== this._disabled) {
125 this._disabled = value;
126 }
127 }
128 },
129
130
97 handleClick: { 131 handleClick: {
98 value: function(event) { 132 value: function(event) {
99 if(event._event.target.id === this.currentView) return; 133 if(event._event.target.id === this.currentView) return;
@@ -103,12 +137,6 @@ exports.DocumentBar = Montage.create(Component, {
103 } 137 }
104 }, 138 },
105 139
106 handleOpenDocument: {
107 value: function() {
108 this.disabled = false;
109 }
110 },
111
112 handleCloseDocument: { 140 handleCloseDocument: {
113 value: function() { 141 value: function() {
114 if(!this.application.ninja.documentController.activeDocument) { 142 if(!this.application.ninja.documentController.activeDocument) {