diff options
Diffstat (limited to 'js/panels/PanelContainer.reel')
-rwxr-xr-x | js/panels/PanelContainer.reel/PanelContainer.html | 27 | ||||
-rwxr-xr-x | js/panels/PanelContainer.reel/PanelContainer.js | 41 |
2 files changed, 45 insertions, 23 deletions
diff --git a/js/panels/PanelContainer.reel/PanelContainer.html b/js/panels/PanelContainer.reel/PanelContainer.html index 7327fb1d..9842a1d1 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.html +++ b/js/panels/PanelContainer.reel/PanelContainer.html | |||
@@ -17,6 +17,9 @@ | |||
17 | "prototype": "js/panels/Panel.reel", | 17 | "prototype": "js/panels/Panel.reel", |
18 | "properties": { | 18 | "properties": { |
19 | "element": {"#": "panel_0"} | 19 | "element": {"#": "panel_0"} |
20 | }, | ||
21 | "bindings": { | ||
22 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
20 | } | 23 | } |
21 | }, | 24 | }, |
22 | 25 | ||
@@ -24,6 +27,9 @@ | |||
24 | "prototype": "js/panels/Panel.reel", | 27 | "prototype": "js/panels/Panel.reel", |
25 | "properties": { | 28 | "properties": { |
26 | "element": {"#": "panel_1"} | 29 | "element": {"#": "panel_1"} |
30 | }, | ||
31 | "bindings": { | ||
32 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
27 | } | 33 | } |
28 | }, | 34 | }, |
29 | 35 | ||
@@ -31,6 +37,9 @@ | |||
31 | "prototype": "js/panels/Panel.reel", | 37 | "prototype": "js/panels/Panel.reel", |
32 | "properties": { | 38 | "properties": { |
33 | "element": {"#": "panel_2"} | 39 | "element": {"#": "panel_2"} |
40 | }, | ||
41 | "bindings": { | ||
42 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
34 | } | 43 | } |
35 | }, | 44 | }, |
36 | 45 | ||
@@ -38,6 +47,9 @@ | |||
38 | "prototype": "js/panels/Panel.reel", | 47 | "prototype": "js/panels/Panel.reel", |
39 | "properties": { | 48 | "properties": { |
40 | "element": {"#": "panel_3"} | 49 | "element": {"#": "panel_3"} |
50 | }, | ||
51 | "bindings": { | ||
52 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
41 | } | 53 | } |
42 | }, | 54 | }, |
43 | 55 | ||
@@ -45,6 +57,9 @@ | |||
45 | "prototype": "js/panels/Panel.reel", | 57 | "prototype": "js/panels/Panel.reel", |
46 | "properties": { | 58 | "properties": { |
47 | "element": {"#": "panel_4"} | 59 | "element": {"#": "panel_4"} |
60 | }, | ||
61 | "bindings": { | ||
62 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
48 | } | 63 | } |
49 | }, | 64 | }, |
50 | 65 | ||
@@ -52,6 +67,9 @@ | |||
52 | "prototype": "js/panels/Panel.reel", | 67 | "prototype": "js/panels/Panel.reel", |
53 | "properties": { | 68 | "properties": { |
54 | "element": {"#": "panel_5"} | 69 | "element": {"#": "panel_5"} |
70 | }, | ||
71 | "bindings": { | ||
72 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
55 | } | 73 | } |
56 | }, | 74 | }, |
57 | 75 | ||
@@ -60,6 +78,9 @@ | |||
60 | "name": "Panel", | 78 | "name": "Panel", |
61 | "properties": { | 79 | "properties": { |
62 | "element": {"#": "panel_6"} | 80 | "element": {"#": "panel_6"} |
81 | }, | ||
82 | "bindings": { | ||
83 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
63 | } | 84 | } |
64 | }, | 85 | }, |
65 | 86 | ||
@@ -67,6 +88,9 @@ | |||
67 | "prototype": "js/panels/Panel.reel", | 88 | "prototype": "js/panels/Panel.reel", |
68 | "properties": { | 89 | "properties": { |
69 | "element": {"#": "panel_7"} | 90 | "element": {"#": "panel_7"} |
91 | }, | ||
92 | "bindings": { | ||
93 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
70 | } | 94 | } |
71 | }, | 95 | }, |
72 | 96 | ||
@@ -74,6 +98,9 @@ | |||
74 | "prototype": "js/panels/Panel.reel", | 98 | "prototype": "js/panels/Panel.reel", |
75 | "properties": { | 99 | "properties": { |
76 | "element": {"#": "panel_8"} | 100 | "element": {"#": "panel_8"} |
101 | }, | ||
102 | "bindings": { | ||
103 | "currentDocument": {"<-": "@owner.currentDocument"} | ||
77 | } | 104 | } |
78 | }, | 105 | }, |
79 | 106 | ||
diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index b4f77317..82069146 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js | |||
@@ -16,7 +16,24 @@ exports.PanelContainer = Montage.create(Component, { | |||
16 | value: null | 16 | value: null |
17 | }, | 17 | }, |
18 | 18 | ||
19 | // This will hold the current loaded panels. | 19 | _currentDocument: { |
20 | value : null, | ||
21 | enumerable : false | ||
22 | }, | ||
23 | |||
24 | currentDocument : { | ||
25 | get : function() { | ||
26 | return this._currentDocument; | ||
27 | }, | ||
28 | set : function(value) { | ||
29 | if (value === this._currentDocument) { | ||
30 | return; | ||
31 | } | ||
32 | |||
33 | this._currentDocument = value; | ||
34 | } | ||
35 | }, | ||
36 | |||
20 | panels: { | 37 | panels: { |
21 | value: [] | 38 | value: [] |
22 | }, | 39 | }, |
@@ -78,10 +95,6 @@ exports.PanelContainer = Montage.create(Component, { | |||
78 | } | 95 | } |
79 | 96 | ||
80 | this.application.localStorage.setItem("panels", this.currentPanelState); | 97 | this.application.localStorage.setItem("panels", this.currentPanelState); |
81 | |||
82 | |||
83 | this.eventManager.addEventListener( "onOpenDocument", this, false); | ||
84 | this.eventManager.addEventListener( "closeDocument", this, false); | ||
85 | } | 98 | } |
86 | }, | 99 | }, |
87 | 100 | ||
@@ -103,24 +116,6 @@ exports.PanelContainer = Montage.create(Component, { | |||
103 | } | 116 | } |
104 | }, | 117 | }, |
105 | 118 | ||
106 | handleOnOpenDocument: { | ||
107 | value: function(){ | ||
108 | this.panels.forEach(function(obj) { | ||
109 | obj.disabled = false; | ||
110 | }); | ||
111 | } | ||
112 | }, | ||
113 | |||
114 | handleCloseDocument: { | ||
115 | value: function(){ | ||
116 | if(!this.application.ninja.documentController.activeDocument) { | ||
117 | this.panels.forEach(function(obj) { | ||
118 | obj.disabled = true; | ||
119 | }); | ||
120 | } | ||
121 | } | ||
122 | }, | ||
123 | |||
124 | handleDropped: { | 119 | handleDropped: { |
125 | value: function(e) { | 120 | value: function(e) { |
126 | var draggedIndex, droppedIndex = 0, len = this.panels.length; | 121 | var draggedIndex, droppedIndex = 0, len = this.panels.length; |