From f94b0c5ada403379b3ff8a900c2a2aabcecce49e Mon Sep 17 00:00:00 2001
From: Nivesh Rajbhandari
Date: Mon, 6 Feb 2012 14:03:40 -0800
Subject: Add enabled property for ComboBox to support enabling/disabling
 materials dropdowns in the PI.

Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
---
 js/components/combobox.reel/combobox.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

(limited to 'js/components/combobox.reel/combobox.js')

diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index a68a7d6b..deef2a47 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -76,6 +76,26 @@ exports.Combobox = Montage.create(Component, {
         }
     },
 
+    _enabled: {
+        enumerable: false,
+        value: true
+    },
+
+    enabled: {
+        enumerable: true,
+        serializable: true,
+        get: function() {
+            return this._enabled;
+        },
+        set: function(value) {
+            if(value !== this._enabled)
+            {
+                this._enabled = value;
+                this.needsDraw = true;
+            }
+        }
+    },
+
     handleChange:
     {
         value:function(event)
@@ -117,6 +137,7 @@ exports.Combobox = Montage.create(Component, {
                     }
                     this.element.appendChild(optionItem);
                 }
+                this.element.disabled = !this._enabled;
             }
         }
     },
-- 
cgit v1.2.3


From 486842239c71e7964f38a09aacda4970f2a82e1a Mon Sep 17 00:00:00 2001
From: Nivesh Rajbhandari
Date: Tue, 7 Feb 2012 10:58:14 -0800
Subject: Updated tools and PI to get/set materials by binding to appModel's
 materials property.  This requires us to add FlatMaterial to the list of
 materials in the MaterialsLibrary.

Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
---
 js/components/combobox.reel/combobox.js | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'js/components/combobox.reel/combobox.js')

diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index deef2a47..8906a649 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -27,6 +27,14 @@ exports.Combobox = Montage.create(Component, {
         value: null
     },
 
+    dataField: {
+        value: null
+    },
+
+    dataFunction: {
+        value: null
+    },
+
     _items: {
         value: []
     },
@@ -122,7 +130,19 @@ exports.Combobox = Montage.create(Component, {
                 {
                     var current = items[i];
                     optionItem = document.createElement("option");
-                    optionItem.value = current;
+                    if(this.dataFunction)
+                    {
+                        optionItem.value = this.dataFunction(current);
+                    }
+                    else if(this.dataField)
+                    {
+                        optionItem.value = current[this.dataField];
+                    }
+                    else
+                    {
+                        optionItem.value = current;
+                    }
+
                     if(this.labelFunction)
                     {
                         optionItem.innerText = this.labelFunction(current);
-- 
cgit v1.2.3


From 8ad767b61460984a4031ba630f76ac8247a61857 Mon Sep 17 00:00:00 2001
From: Nivesh Rajbhandari
Date: Tue, 7 Feb 2012 11:42:10 -0800
Subject: Fixed PI to support WebGL materials.

Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
---
 js/components/combobox.reel/combobox.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'js/components/combobox.reel/combobox.js')

diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index 8906a649..ebbfbffa 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -15,7 +15,7 @@ exports.Combobox = Montage.create(Component, {
     },
 
     _wasSetByCode: {
-        enumerable: false,
+        enumerable: true,
         value: true
     },
 
@@ -79,7 +79,7 @@ exports.Combobox = Montage.create(Component, {
                 e.value = this._value;
                 this.dispatchEvent(e);
 
-                this._wasSetByCode = false;
+                this._wasSetByCode = true;
             }
         }
     },
-- 
cgit v1.2.3


From 3a8875c288049b466bfeb8b7f0510fd8cbfb970d Mon Sep 17 00:00:00 2001
From: Nivesh Rajbhandari
Date: Tue, 7 Feb 2012 13:30:08 -0800
Subject: Supporting switching materials in the PI. Also, moved
 makeFillMaterial and makeStrokeMaterial functions into GLGeomObj so shapes
 other than GLRectangle can use these routines.

Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
---
 js/components/combobox.reel/combobox.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'js/components/combobox.reel/combobox.js')

diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index ebbfbffa..3200b01c 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -174,6 +174,22 @@ exports.Combobox = Montage.create(Component, {
 
     prepareForDraw: {
         value: function() {
+            if( (this._value === null) && this._items.length )
+            {
+                var current = this._items[0];
+                if(this.dataFunction)
+                {
+                    this.value = this.dataFunction(current);
+                }
+                else if(this.dataField)
+                {
+                    this.value = current[this.dataField];
+                }
+                else
+                {
+                    this.value = current;
+                }
+            }
             this.element.addEventListener("change", this, false);
         }
     }
-- 
cgit v1.2.3


From 329a859e2666716c3a1d99c6bd2679e10c81fc8d Mon Sep 17 00:00:00 2001
From: Nivesh Rajbhandari
Date: Tue, 7 Feb 2012 15:25:11 -0800
Subject: Added ability to toggle combobox's visibility so we can show/hide
 materials comboboxes in the tool options.

Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
---
 js/components/combobox.reel/combobox.js | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

(limited to 'js/components/combobox.reel/combobox.js')

diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index 3200b01c..bc433f52 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -104,6 +104,26 @@ exports.Combobox = Montage.create(Component, {
         }
     },
 
+    _visible: {
+        enumerable: false,
+        value: true
+    },
+
+    visible: {
+        enumerable: true,
+        serializable: true,
+        get: function() {
+            return this._visible;
+        },
+        set: function(value) {
+            if(value !== this._visible)
+            {
+                this._visible = value;
+                this.needsDraw = true;
+            }
+        }
+    },
+
     handleChange:
     {
         value:function(event)
@@ -158,6 +178,14 @@ exports.Combobox = Montage.create(Component, {
                     this.element.appendChild(optionItem);
                 }
                 this.element.disabled = !this._enabled;
+                if(this._visible)
+                {
+                    this.element.style.visibility = "visible";
+                }
+                else
+                {
+                    this.element.style.visibility = "hidden";
+                }
             }
         }
     },
-- 
cgit v1.2.3