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.js61
1 files changed, 37 insertions, 24 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..90d3a207 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,40 +105,34 @@ 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);
91 this.designView.addEventListener("click", this, false); 108 this.designView.addEventListener("click", this, false);
92 this.codeView.addEventListener("click", this, false); 109 this.codeView.addEventListener("click", this, false);
93 110
94 } 111 }
95 }, 112 },
96 113
97 handleClick: { 114 _disabled: {
98 value: function(event) { 115 value: true
99 if(event._event.target.id === this.currentView) return;
100
101 this.currentView = event._event.target.id;
102 this.application.ninja.documentController.stage.stageView.switchDesignDocViews(event._event.target.id);//switch between design view
103 }
104 },
105
106 handleOpenDocument: {
107 value: function() {
108 this.disabled = false;
109 }
110 }, 116 },
111 117
112 handleCloseDocument: { 118 disabled: {
113 value: function() { 119 get: function() {
114 if(!this.application.ninja.documentController.activeDocument) { 120 return this._disabled;
115 this.disabled = true; 121 },
122 set: function(value) {
123 if(value !== this._disabled) {
124 this._disabled = value;
116 } 125 }
117 } 126 }
118 }, 127 },
119 128
120 handleOnDocumentChanged:{
121 value:function(event){
122 129
130 handleClick: {
131 value: function(event) {
132 if(event._event.target.id === this.currentView) return;
133
134 this.currentView = event._event.target.id;
135 this.application.ninja.documentController.stage.stageView.switchDesignDocViews(event._event.target.id);//switch between design view
123 } 136 }
124 } 137 }
125}); 138});