diff options
33 files changed, 3143 insertions, 147 deletions
diff --git a/js/components/treeview/ninja-leaf.reel/ninja-leaf.js b/js/components/treeview/ninja-leaf.reel/ninja-leaf.js index bd566b26..ec2e7495 100644 --- a/js/components/treeview/ninja-leaf.reel/ninja-leaf.js +++ b/js/components/treeview/ninja-leaf.reel/ninja-leaf.js | |||
@@ -19,14 +19,14 @@ exports.Leaf = Montage.create(TreeNode, { | |||
19 | }, | 19 | }, |
20 | prepareForDraw: { | 20 | prepareForDraw: { |
21 | value : function() { | 21 | value : function() { |
22 | this.activationEvent = this.activationEvent || 'click'; | 22 | this.activationEvent = this.activationEvent || 'dblclick'; |
23 | this.label._element.addEventListener(this.activationEvent, this.handleNodeActivation.bind(this), false); | 23 | this.label._element.addEventListener(this.activationEvent, this.handleNodeActivation.bind(this), false); |
24 | } | 24 | } |
25 | }, | 25 | }, |
26 | handleNodeActivation: { | 26 | handleNodeActivation: { |
27 | value: function(e) { | 27 | value: function(e) { |
28 | console.log(this.sourceObject); | 28 | //console.log(this.sourceObject); |
29 | this.treeView.contentController.delegate.applyPresetSelection(this.sourceObject); | 29 | this.treeView.contentController.delegate.applySelection(this.sourceObject); |
30 | } | 30 | } |
31 | }, | 31 | }, |
32 | draw : { | 32 | draw : { |
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 458e6b46..1b0591be 100644 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js | |||
@@ -9,4 +9,33 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | exports.ComponentController = Montage.create(ElementController, { | 10 | exports.ComponentController = Montage.create(ElementController, { |
11 | 11 | ||
12 | getProperty: { | ||
13 | value: function(el, prop) { | ||
14 | switch(prop) { | ||
15 | case "label": | ||
16 | return this.application.ninja.currentDocument.getComponentFromElement(el).label; | ||
17 | break; | ||
18 | case "enabled": | ||
19 | return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; | ||
20 | break; | ||
21 | default: | ||
22 | return ElementController.getProperty(el, prop, true); | ||
23 | } | ||
24 | } | ||
25 | }, | ||
26 | |||
27 | setProperty: { | ||
28 | value: function(el, p, value) { | ||
29 | switch(p) { | ||
30 | case "label": | ||
31 | this.application.ninja.currentDocument.getComponentFromElement(el).label = value; | ||
32 | break; | ||
33 | case "enabled": | ||
34 | this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; | ||
35 | break; | ||
36 | default: | ||
37 | ElementController.setProperty(el, p, value); | ||
38 | } | ||
39 | } | ||
40 | } | ||
12 | }); | 41 | }); |
diff --git a/js/io/document/html-document.js b/js/io/document/html-document.js index c44dfe75..a8e06c69 100644 --- a/js/io/document/html-document.js +++ b/js/io/document/html-document.js | |||
@@ -27,6 +27,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
27 | _initialUserDocument: { value: null, enumerable: false }, | 27 | _initialUserDocument: { value: null, enumerable: false }, |
28 | _htmlSource: {value: "<html></html>", enumerable: false}, | 28 | _htmlSource: {value: "<html></html>", enumerable: false}, |
29 | _glData: {value: null, enumerable: false }, | 29 | _glData: {value: null, enumerable: false }, |
30 | _userComponents: { value: {}, enumarable: false}, | ||
30 | 31 | ||
31 | _elementCounter: { value: 1, enumerable: false }, | 32 | _elementCounter: { value: 1, enumerable: false }, |
32 | _snapping : { value: true, enumerable: false }, | 33 | _snapping : { value: true, enumerable: false }, |
@@ -108,23 +109,11 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
108 | } | 109 | } |
109 | }, | 110 | }, |
110 | 111 | ||
111 | _userComponentSet: { | 112 | userComponents: { |
112 | value: {}, | 113 | get: function() { |
113 | writable: true, | 114 | return this._userComponents; |
114 | enumerable:true | 115 | } |
115 | }, | 116 | }, |
116 | |||
117 | // userComponentSet:{ | ||
118 | // enumerable: true, | ||
119 | // get: function() { | ||
120 | // return this._userComponentSet; | ||
121 | // }, | ||
122 | // set: function(value) { | ||
123 | // this._userComponentSet = value; | ||
124 | // this._drawUserComponentsOnOpen(); | ||
125 | // } | ||
126 | // }, | ||
127 | // | ||
128 | // _drawUserComponentsOnOpen:{ | 117 | // _drawUserComponentsOnOpen:{ |
129 | // value:function(){ | 118 | // value:function(){ |
130 | // for(var i in this._userComponentSet){ | 119 | // for(var i in this._userComponentSet){ |
@@ -191,6 +180,29 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
191 | set: function(value) { this._zoomFactor = value; } | 180 | set: function(value) { this._zoomFactor = value; } |
192 | }, | 181 | }, |
193 | 182 | ||
183 | /** | ||
184 | * Add a reference to a component instance to the userComponents hash using the | ||
185 | * element UUID | ||
186 | */ | ||
187 | setComponentInstance: { | ||
188 | value: function(instance, el) { | ||
189 | this.userComponents[el.uuid] = instance; | ||
190 | } | ||
191 | }, | ||
192 | |||
193 | /** | ||
194 | * Returns the component instance obj from the element | ||
195 | */ | ||
196 | getComponentFromElement: { | ||
197 | value: function(el) { | ||
198 | if(el) { | ||
199 | if(el.uuid) return this.userComponents[el.uuid]; | ||
200 | } else { | ||
201 | return null; | ||
202 | } | ||
203 | } | ||
204 | }, | ||
205 | |||
194 | //****************************************// | 206 | //****************************************// |
195 | // PUBLIC METHODS | 207 | // PUBLIC METHODS |
196 | initialize: { | 208 | initialize: { |
@@ -353,9 +365,6 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
353 | this.callback(this); | 365 | this.callback(this); |
354 | } | 366 | } |
355 | }.bind(this), 50); | 367 | }.bind(this), 50); |
356 | |||
357 | // TODO - Not sure where this goes | ||
358 | this._userComponentSet = {}; | ||
359 | } else { | 368 | } else { |
360 | this._styles = this._document.styleSheets[this._document.styleSheets.length - 1]; | 369 | this._styles = this._document.styleSheets[this._document.styleSheets.length - 1]; |
361 | this._stylesheets = this._document.styleSheets; // Entire stlyesheets array | 370 | this._stylesheets = this._document.styleSheets; // Entire stlyesheets array |
diff --git a/js/panels/Components/Components.xml b/js/panels/Components/Components.xml deleted file mode 100644 index b3056330..00000000 --- a/js/panels/Components/Components.xml +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <tree id="Components"> | ||
3 | <folder id="montageComponents" label="Montage Components"> | ||
4 | <leaf id="Button" label="Button" /> | ||
5 | <leaf id="Checkbox" label="Checkbox" /> | ||
6 | <leaf id="DynamicText" label="Dynamic Text" /> | ||
7 | <leaf id="FlowController" label="FlowController" /> | ||
8 | <leaf id="HotText" label="HotText" /> | ||
9 | <leaf id="HotTextUnit" label="HotTextUnit" /> | ||
10 | <leaf id="ImageContainer" label="Image Container" /> | ||
11 | <leaf id="Progress" label="Progress" /> | ||
12 | <leaf id="Scrollview" label="Scrollview" /> | ||
13 | <leaf id="Slider" label="Slider" /> | ||
14 |