From adb90eff3323aa780f9a0879572e3cf3b9f0b969 Mon Sep 17 00:00:00 2001
From: Ananya Sen
Date: Tue, 21 Feb 2012 13:04:58 -0800
Subject: - file picker - select file on double click - check cloud
 availability before IO operations [open file, new file, Save, Save As].
 Canceling operation if cloud was unavailable, as per team's agreement.

Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
---
 js/components/ui/icon-list-basic/icon.reel/icon.js |  5 ++++
 .../ui/tree-basic/treeItem.reel/treeItem.js        |  5 ++++
 js/controllers/document-controller.js              | 33 ++++++++++++++++------
 js/data/menu-data.js                               |  2 +-
 .../picker-navigator.reel/picker-navigator.js      | 26 +++++++++++++----
 .../new-file-workflow-controller.js                |  7 -----
 js/io/ui/save-as-dialog.reel/save-as-dialog.js     |  4 +--
 7 files changed, 58 insertions(+), 24 deletions(-)

(limited to 'js')

diff --git a/js/components/ui/icon-list-basic/icon.reel/icon.js b/js/components/ui/icon-list-basic/icon.reel/icon.js
index b0279207..72adbfa1 100755
--- a/js/components/ui/icon-list-basic/icon.reel/icon.js
+++ b/js/components/ui/icon-list-basic/icon.reel/icon.js
@@ -131,6 +131,11 @@ var Icon = exports.Icon = Montage.create(Component, {
                     openFolderEvent.initEvent("openFolder", false, false);
                     openFolderEvent.folderUri = this.icondata.uri;
                     this.element.dispatchEvent(openFolderEvent);
+                }else{
+                    var openFolderEvent = document.createEvent("Events");
+                    openFolderEvent.initEvent("selectFile", false, false);
+                    openFolderEvent.fileUri = this.icondata.uri;
+                    this.element.dispatchEvent(openFolderEvent);
                 }
                 if(evt.bubbles){
                         evt.stopPropagation();
diff --git a/js/components/ui/tree-basic/treeItem.reel/treeItem.js b/js/components/ui/tree-basic/treeItem.reel/treeItem.js
index 755eab8c..4c71cb6b 100755
--- a/js/components/ui/tree-basic/treeItem.reel/treeItem.js
+++ b/js/components/ui/tree-basic/treeItem.reel/treeItem.js
@@ -225,6 +225,11 @@ exports.TreeItem = Montage.create(Component, {
                         openFolderEvent.initEvent("openFolder", false, false);
                         openFolderEvent.folderUri = this.treeItemData.uri;
                         this.element.dispatchEvent(openFolderEvent);
+                    }else{
+                        var openFolderEvent = document.createEvent("Events");
+                        openFolderEvent.initEvent("selectFile", false, false);
+                        openFolderEvent.fileUri = this.treeItemData.uri;
+                        this.element.dispatchEvent(openFolderEvent);
                     }
                     if(evt.bubbles){
                             evt.stopPropagation();
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 9a063280..505daaba 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -58,6 +58,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
             this.eventManager.addEventListener("executeFileOpen", this, false);
             this.eventManager.addEventListener("executeNewFile", this, false);
             this.eventManager.addEventListener("executeSave", this, false);
+            this.eventManager.addEventListener("executeSaveAs", this, false);
 
             this.eventManager.addEventListener("recordStyleChanged", this, false);
             
@@ -100,33 +101,47 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
     handleExecuteFileOpen: {
         value: function(event) {
             var pickerSettings = event._event.settings || {};
-            pickerSettings.callback = this.openFileWithURI.bind(this);
-            pickerSettings.pickerMode = "read";
-            pickerSettings.inFileMode = true;
-            this.application.ninja.filePickerController.showFilePicker(pickerSettings);
+            if (this.application.ninja.coreIoApi.cloudAvailable()) {
+                pickerSettings.callback = this.openFileWithURI.bind(this);
+                pickerSettings.pickerMode = "read";
+                pickerSettings.inFileMode = true;
+                this.application.ninja.filePickerController.showFilePicker(pickerSettings);
+            }
         }
     },
 
     handleExecuteNewFile: {
             value: function(event) {
                 var newFileSettings = event._event.settings || {};
-                newFileSettings.callback = this.createNewFile.bind(this);
-                this.application.ninja.newFileController.showNewFileDialog(newFileSettings);
+                if (this.application.ninja.coreIoApi.cloudAvailable()) {
+                    newFileSettings.callback = this.createNewFile.bind(this);
+                    this.application.ninja.newFileController.showNewFileDialog(newFileSettings);
+                }
             }
     },
-	
-	
 	////////////////////////////////////////////////////////////////////
 	//TODO: Check for appropiate structures
     handleExecuteSave: {
     	value: function(event) {
-            if(!!this.activeDocument){
+            if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
                 //Text and HTML document classes should return the same save object for fileSave
                 this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this));
             }
 		}
     },
     ////////////////////////////////////////////////////////////////////
+    handleExecuteSaveAs: {
+        value: function(event) {
+            var saveAsSettings = event._event.settings || {};
+            if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
+                saveAsSettings.fileName = this.activeDocument.name;
+                saveAsSettings.folderUri = this.activeDocument.uri.substring(0, this.activeDocument.uri.lastIndexOf("/"));
+                //add callback
+                this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings);
+            }
+        }
+    },
+
     //
     fileSaveResult: {
     	value: function (result) {
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 7c3ca5d4..52710b3a 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -44,7 +44,7 @@ exports.MenuData = Montage.create( Montage, {
                         "displayText" : "Save As",
                         "hasSubMenu" : false,
                         "enabled": true,
-                        "action":"saveAs"
+                        "action":"executeSaveAs"
                     },
                     {
                         "displayText" : "Save All",
diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
index 411386f9..428e7bab 100644
--- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
+++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js
@@ -214,6 +214,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
 
             this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data
             this.element.addEventListener("selectedItem", function(evt){that.handlePickerNavSelectedItem(evt);}, false);//for single selection only
+            this.element.addEventListener("selectFile", function(evt){that.handlePickerNavSelectedFile(evt);}, false);//for file selection
             this.element.addEventListener("showMetadata", function(evt){that.handlePickerNavShowMetadata(evt);}, false);//show metadata on hover of icon
             this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon
             //this.addressGo.addEventListener("click", this, false);
@@ -669,14 +670,29 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
             }
     },
 
+    handlePickerNavSelectedFile:{
+        value: function(evt){
+            var uri = evt.fileUri;
+
+            //do selection if in file selection mode
+            if(this.pickerModel.inFileMode && (this.application.ninja.filePickerController._directoryContentCache[uri].type === "file")){
+                this.okButton.removeAttribute("disabled");
+                //put into selectedItems..currently single selection is supported
+                this.selectedItems = [uri];
+                this.currentURI = uri.substring(0, uri.lastIndexOf("/"));
+                this.handleOkButtonAction();
+            }
+        }
+    },
+
     handlePickerNavShowMetadata: {
         value: function(evt){
-                        //update matadata only if nothing is already selected
-                        if(this.currentSelectedNode == null){
-                            //console.log("handle showmetadata - true");
-                            this.metadataSection.innerHTML = evt.metadata;
-                        }
+                //update matadata only if nothing is already selected
+                if(this.currentSelectedNode == null){
+                    //console.log("handle showmetadata - true");
+                    this.metadataSection.innerHTML = evt.metadata;
                 }
+        }
     },
 
     handlePickerNavUpdateMetadata:{
diff --git a/js/io/ui/new-file-dialog/new-file-workflow-controller.js b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
index 7b7f4572..f34ee000 100755
--- a/js/io/ui/new-file-dialog/new-file-workflow-controller.js
+++ b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
@@ -19,12 +19,6 @@ var NewFileWorkflowController =  exports.NewFileWorkflowController = Montage.cre
         writable:false,
         enumerable:true,
         value:function(){
-            var that = this;
-
-            this.eventManager.addEventListener("saveAs", function(evt){
-                var data = evt._event.data || {};//data will contain the current file name, directory location and callback
-                that.showSaveAsDialog(data);
-            }, false);
         }
     },
 
@@ -99,7 +93,6 @@ var NewFileWorkflowController =  exports.NewFileWorkflowController = Montage.cre
             saveAsDialog.fileName = fileName;
             saveAsDialog.folderUri = folderUri;
             saveAsDialog.callback = data.callback;
-            saveAsDialog.callbackScope = data.callbackScope;
             saveAsDialog.element = saveAsDialogContainer;
 
             //remove after rendering and add in modal dialog
diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js
index 55a09fa8..0a322b99 100644
--- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js
+++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js
@@ -117,8 +117,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
                 try{
                     //validate file name and folder path
                     //check if file already exists
-                    if(!!this.callback && !!this.callbackScope){//inform document-controller if save successful
-                        this.callback.call(this.callbackScope, {"filename":filename, "destination": newFileDirectory});//document-controller api
+                    if(!!this.callback){//inform document-controller if save successful
+                        this.callback({"filename":filename, "destination": newFileDirectory});//document-controller api
                     }else{
                         //send save as event
                         var saveAsEvent = document.createEvent("Events");
-- 
cgit v1.2.3


From 86996190d6a4dd59343d4ce482a9c0e6ef0f1eac Mon Sep 17 00:00:00 2001
From: Ananya Sen
Date: Tue, 21 Feb 2012 15:53:37 -0800
Subject: added null check for matchedRules in styles-controller.js, to fix js
 error on reopening and edited html document

Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
---
 js/controllers/styles-controller.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'js')

diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 885d710f..31beb6d0 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -317,7 +317,11 @@ var stylesController = exports.StylesController = Montage.create(Component, {
                     isInlineStyle : true,
                     style         : element.style
                 };
-                
+
+                if((typeof matchedRules === "undefined") || (matchedRules === null)){
+                    return null;
+                }
+
                 ///// Now splice it into the matched rules
                 ///// By inserting the inline style at the beginning,
                 ///// we keep the correct order of specificity
-- 
cgit v1.2.3


From 539fb19b2327a9f6fb39403e27c29a8f8d733198 Mon Sep 17 00:00:00 2001
From: Ananya Sen
Date: Tue, 21 Feb 2012 16:46:24 -0800
Subject: edit by Eric G.: catch the error instead of doing the null check for
 the stale element

Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
---
 js/controllers/styles-controller.js | 46 +++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

(limited to 'js')

diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 31beb6d0..662816f5 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -318,10 +318,6 @@ var stylesController = exports.StylesController = Montage.create(Component, {
                     style         : element.style
                 };
 
-                if((typeof matchedRules === "undefined") || (matchedRules === null)){
-                    return null;
-                }
-
                 ///// Now splice it into the matched rules
                 ///// By inserting the inline style at the beginning,
                 ///// we keep the correct order of specificity
@@ -576,37 +572,36 @@ var stylesController = exports.StylesController = Montage.create(Component, {
                 win = element.ownerDocument.defaultView,
                 self = this;
 
-            if(!win) {
-                return null;
-            }
-                
             if(!omitPseudos) {
                 pseudos.concat(['link', 'visited', 'active', 'hover', 'focus', 'first-letter', 
                                 'first-line', 'first-child', 'before', 'after', 'lang', 'target']);
             }
 
-            pseudos.forEach(function(pseudo) {
-                rules = rules.concat(nj.toArray(win.getMatchedCSSRules(element, pseudo)).filter(function(rule) {
-                    //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet,
-                    //// or only use rules for other stylesheets
+            try {
+                pseudos.forEach(function(pseudo) {
+                    rules = rules.concat(nj.toArray(win.getMatchedCSSRules(element, pseudo)).filter(function(rule) {
+                        //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet,
+                        //// or only use rules for other stylesheets
 
-                    var sheetId = (rule.parentStyleSheet) ? rule.parentStyleSheet.ownerNode.id : null,
-                        isStageStyleSheet = sheetId === this.CONST.STAGE_SHEET_ID;
+                        var sheetId = (rule.parentStyleSheet) ? rule.parentStyleSheet.ownerNode.id : null,
+                            isStageStyleSheet = sheetId === this.CONST.STAGE_SHEET_ID;
 
-                    ///// filter out (return false) depending on flag
-                    if(useStageStyleSheet && !isStageStyleSheet) { return false; }
-                    if(!useStageStyleSheet && isStageStyleSheet) { return false; }
+                        ///// filter out (return false) depending on flag
+                        if(useStageStyleSheet && !isStageStyleSheet) { return false; }
+                        if(!useStageStyleSheet && isStageStyleSheet) { return false; }
 
-                    ///// Non-filter code - just assigning specificity to the rule
-                    if(!rule[this.CONST.SPECIFICITY_KEY]) {
-                        rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText);
-                    }
+                        ///// Non-filter code - just assigning specificity to the rule
+                        if(!rule[this.CONST.SPECIFICITY_KEY]) {
+                            rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText);
+                        }
 
-                    return true;
-
-                }, this));
-            }, this);
+                        return true;
 
+                    }, this));
+                }, this);
+            } catch(ERROR) {
+                console.warn('StylesController::getMatchingRules - Un-attached element queried.');
+            }
             ///// Function for sorting by specificity values
             function sorter(ruleA, ruleB) {
                 var a, b, order, sheetAIndex, sheetBIndex, ruleAIndex, ruleBIndex;
@@ -985,6 +980,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
                 ///// Pass "true" to method to return an override object, which
                 ///// has the rule to override, and whether the !important flag is needed
                 dominantRule = this.getDominantRuleForElement(element, property, true, isStageElement);
+
             }
                
             ///// Did we find a dominant rule?
-- 
cgit v1.2.3


From 9aa442da1ac9fd3212b37fa63a36090af47b6808 Mon Sep 17 00:00:00 2001
From: Ananya Sen
Date: Tue, 21 Feb 2012 17:41:55 -0800
Subject: fix bug when closing the first document tab

Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
---
 js/controllers/document-controller.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'js')

diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 505daaba..7470bae2 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -309,7 +309,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
             if(this.activeDocument.uuid === id && this._documents.length > 0) {//closing the active document tab
                 var nextDocumentIndex = -1 ;
                 if((this._documents.length > 0) && (closeDocumentIndex === 0)){
-                    nextDocumentIndex = 1;
+                    nextDocumentIndex = 0;
                 }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){
                     nextDocumentIndex = closeDocumentIndex - 1;
                 }
-- 
cgit v1.2.3


From f86577d5083aeed2de7a932fe4147e9002e91554 Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Tue, 21 Feb 2012 21:11:54 -0800
Subject: cleanup - Removing temporary div to render the popups

We don't need to render the popup before opening them. Removing that hack.

Signed-off-by: Valerio Virgillito <valerio@motorola.com>
---
 js/io/ui/file-picker/file-picker-controller.js           | 14 --------------
 js/io/ui/new-file-dialog/new-file-workflow-controller.js | 12 ------------
 2 files changed, 26 deletions(-)

(limited to 'js')

diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js
index 129bebad..5e4d0be8 100755
--- a/js/io/ui/file-picker/file-picker-controller.js
+++ b/js/io/ui/file-picker/file-picker-controller.js
@@ -33,7 +33,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
     },
 
     filePickerPopupType:{
-        writable: true,
         enumerable: false,
         value: "filePicker"
     },
@@ -152,15 +151,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
           writable:false,
         enumerable:true,
         value:function(callback, aModel){
-            //render modal dialog
-            var pickerNavContent = document.createElement("div");
-            pickerNavContent.id = "filePicker";
-
-            pickerNavContent.style.color = "#fff";
-
-            //hack (elements needs to be on DOM to be drawn)
-            document.getElementById('modalContainer').appendChild(pickerNavContent);
-
             var pickerNavChoices = Montage.create(pickerNavigatorReel);
             var initUri = aModel.currentRoot;
 
@@ -171,10 +161,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
 
             pickerNavChoices.mainContentData = this.prepareContentList(initUri, aModel);
             pickerNavChoices.pickerModel = aModel;
-            pickerNavChoices.element = pickerNavContent;
-
-            //hack - remove after rendering and add in modal dialog
-            document.getElementById('modalContainer').removeChild(pickerNavContent);
 
             var popup = Popup.create();
             popup.content = pickerNavChoices;
diff --git a/js/io/ui/new-file-dialog/new-file-workflow-controller.js b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
index 7b7f4572..c2be687a 100755
--- a/js/io/ui/new-file-dialog/new-file-workflow-controller.js
+++ b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
@@ -29,7 +29,6 @@ var NewFileWorkflowController =  exports.NewFileWorkflowController = Montage.cre
     },
 
     model:{
-        writable: true,
         enumerable:true,
         value: null
     },
@@ -56,19 +55,8 @@ var NewFileWorkflowController =  exports.NewFileWorkflowController = Montage.cre
                 this.model.defaultProjectType = lastSelectedProjectType;
             }
 
-            //render modal dialog
-            var newFileNavContent = document.createElement("div");
-            newFileNavContent.id = "newFileDialog";
-
-            //elements needs to be on DOM to be drawn
-            document.getElementById('modalContainer').appendChild(newFileNavContent);
-
             var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create();
             newFileOptionsNav.newFileModel = this.model;
-            newFileOptionsNav.element = newFileNavContent;
-
-            //remove after rendering and add in modal dialog
-            document.getElementById('modalContainer').removeChild(newFileNavContent);
 
             var popup = Popup.create();
             popup.content = newFileOptionsNav;
-- 
cgit v1.2.3


From 067ebae166ff82ae113a91517dfa59e7de5ae3d3 Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Tue, 21 Feb 2012 22:36:54 -0800
Subject: cleanup - using montage functions handlers and using the NJevent

Signed-off-by: Valerio Virgillito <valerio@motorola.com>
---
 .../file-input-field.reel/file-input-field.js      | 21 ++++-----------------
 js/io/ui/file-picker/file-picker-controller.js     | 22 ++++++++++------------
 2 files changed, 14 insertions(+), 29 deletions(-)

(limited to 'js')

diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
index 235be8ad..651fd7fa 100755
--- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
+++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
@@ -9,24 +9,13 @@ var Montage = require("montage/core/core").Montage,
 
 var FileInputField = exports.FileInputField = Montage.create(Component, {
 
-	hasReel: {
-        value: true
-    },
-
-    willDraw: {
-        enumerable: false,
-        value: function() {}
-    },
-    draw: {
-        enumerable: false,
-        value: function() {}
-    },
     didDraw: {
         enumerable: false,
         value: function() {
             var that = this;
             this.findDirectory.identifier = "findDirectory";
-            this.findDirectory.addEventListener("click", function(evt){that.handleFindDirectoryClick(evt);}, false);
+
+            this.findDirectory.addEventListener("click", this, false);
 
             this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false);
 
@@ -60,8 +49,6 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
 
     handleFindDirectoryClick: {
         value: function(evt){
-            var openFilePicker = document.createEvent("Events");
-            openFilePicker.initEvent("openFilePicker", false, false);
             var settings = {};
             if(this.selectDirectory === true){
                 settings.inFileMode = false;
@@ -71,8 +58,8 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
                 settings.pickerName = this.pickerName || "fileSelector";
             }
             settings.callback = this.filePickerCallback.bind(this);
-            openFilePicker.settings = settings;
-            this.eventManager.dispatchEvent(openFilePicker);
+
+            NJevent("openFilePicker", settings);
         }
     },
 
diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js
index 5e4d0be8..3b19de83 100755
--- a/js/io/ui/file-picker/file-picker-controller.js
+++ b/js/io/ui/file-picker/file-picker-controller.js
@@ -19,16 +19,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
         writable:false,
         enumerable:true,
         value:function(){
-            var that = this;
-
-            this.eventManager.addEventListener("openFilePicker", function(evt){
-                var settings;
-                if(typeof evt._event.settings !== "undefined"){
-                    settings = evt._event.settings;
-                }
-                that.showFilePicker(settings);
-            }, false);
-
+            this.eventManager.addEventListener("openFilePicker", this, false);
         }
     },
 
@@ -37,6 +28,12 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
         value: "filePicker"
     },
 
+    handleOpenFilePicker: {
+        value: function(evt) {
+            this.showFilePicker(evt.detail);
+        }
+    },
+
     /**
      *this function is used to create an instance of a file picker
      *
@@ -128,7 +125,9 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
             }
 
             if(!!storedUri){
-                aModel.currentRoot = unescape(storedUri);
+                // This is depracated -- use decodeURI instead
+                //aModel.currentRoot = unescape(storedUri);
+                aModel.currentRoot = decodeURI(storedUri);
             }
 
             if(!!allFileFilters){aModel.fileFilters = allFileFilters;}
@@ -137,7 +136,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
             if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;}
 
 
-
             //logic: get file content data onDemand from the REST api for the default or last opened root. Cache the data in page [in local cache ? dirty fs? ]. Filter on client side to reduce network calls.
             this.openFilePickerAsModal(callback, aModel);
 
-- 
cgit v1.2.3


From a8f5dcd8e85af6600f2e2b6a4536f05fd0c9916d Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Tue, 21 Feb 2012 22:37:36 -0800
Subject: Adding the default folder by default when opening a new file dialog.

Adding the default folder name in the new file dialog input field. Also some more cleanup.

Signed-off-by: Valerio Virgillito <valerio@motorola.com>
---
 .../new-file-location.reel/new-file-location.js    | 57 +++++++++++++---------
 1 file changed, 33 insertions(+), 24 deletions(-)

(limited to 'js')

diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
index fae8f9c7..ee2847ca 100755
--- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
+++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
@@ -11,46 +11,55 @@ var newFileWorkflowControllerModule = require("js/io/ui/new-file-dialog/new-file
 var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
 
     templateHeight:{
-        enumerable: true,
         value:"25 px"
     },
 
     templateWidth:{
-        enumerable: true,
         value:"25 px"
     },
 
-    willDraw: {
-       	enumerable: false,
-       	value: function() {}
-       },
+    prepareForDraw: {
+        value: function() {
+            // Populate the file input field by using the session storage or the default user folder
+            var defaultSaveDirectory;
+
+            if(window.sessionStorage) {
+                var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection");
+                if(storedFolder)  defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"));
+            }
+
+            if(!defaultSaveDirectory) {
+                var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"});
+                if(driveData.success){
+                    var topLevelDirectories = (JSON.parse(driveData.content)).children;
+                    defaultSaveDirectory = topLevelDirectories[0].uri;
+                } else {
+                    console.log("** Error ** Cannot get directory listing");
+                    defaultSaveDirectory = "";
+                }
+            }
 
-    draw: {
-       	enumerable: false,
-       	value: function() {}
+            this.fileInputField.newFileDirectory.value = defaultSaveDirectory;
+        }
     },
 
     didDraw: {
-       	enumerable: false,
         value: function() {
-            var that=this;
-
             this.fileInputField.selectDirectory = true;
 
-            this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false);
-    }
-
+            this.newFileName.addEventListener("keyup", this, false);
+        }
     },
 
-    handleNewFileNameOnkeyup:{
-          value:function(evt){
-              if(this.newFileName.value !== ""){
-                  var newFileNameSetEvent = document.createEvent("Events");
-                  newFileNameSetEvent.initEvent("newFileNameSet", false, false);
-                  newFileNameSetEvent.newFileName = this.newFileName.value;
-                  this.eventManager.dispatchEvent(newFileNameSetEvent);
-              }
-          }
+    handleKeyup:{
+        value:function(evt){
+            if(this.newFileName.value !== "") {
+                var newFileNameSetEvent = document.createEvent("Events");
+                newFileNameSetEvent.initEvent("newFileNameSet", false, false);
+                newFileNameSetEvent.newFileName = this.newFileName.value;
+                this.eventManager.dispatchEvent(newFileNameSetEvent);
+            }
+        }
     }
 
 });
\ No newline at end of file
-- 
cgit v1.2.3


From 69983b800d0179fcccd5b61b64ed22c02e22b93a Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Tue, 21 Feb 2012 22:43:45 -0800
Subject: Adding some comments.

Signed-off-by: Valerio Virgillito <valerio@motorola.com>
---
 js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'js')

diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
index ee2847ca..849c665c 100755
--- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
+++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
@@ -18,16 +18,18 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
         value:"25 px"
     },
 
+    // Populating the directory input field with the default save location or the last stored location.
     prepareForDraw: {
         value: function() {
-            // Populate the file input field by using the session storage or the default user folder
             var defaultSaveDirectory;
 
+            // Using session storage location
             if(window.sessionStorage) {
                 var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection");
                 if(storedFolder)  defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"));
             }
 
+            // Use default if none found in session storage
             if(!defaultSaveDirectory) {
                 var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"});
                 if(driveData.success){
@@ -39,6 +41,7 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
                 }
             }
 
+            // Set the input field to the correct directory
             this.fileInputField.newFileDirectory.value = defaultSaveDirectory;
         }
     },
-- 
cgit v1.2.3


From e17fb41feca768d746f89d90cef28192fa60c621 Mon Sep 17 00:00:00 2001
From: Jose Antonio Marquez
Date: Tue, 21 Feb 2012 23:30:01 -0800
Subject: Temp CSS fix (for file open)

Implemented temporary work-around to the css-cross-origin issue on files loaded into Ninja. Fix is for open file, need to implement save functionality and integrate with CSS panel.
---
 js/document/html-document.js | 43 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 6 deletions(-)

(limited to 'js')

diff --git a/js/document/html-document.js b/js/document/html-document.js
index 9a7755e6..bd41bc46 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -382,24 +382,23 @@ exports.HTMLDocument = Montage.create(TextDocument, {
         	//TODO: Remove, also for prototyping
         	this.application.ninja.documentController._hackRootFlag = true;
         	//
-            //this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent");
             this.stageBG = this.iframe.contentWindow.document.getElementById("stageBG");
             this.stageBG.onclick = null;
             this._document = this.iframe.contentWindow.document;
             this._window = this.iframe.contentWindow;
             //
             if(!this.documentRoot.Ninja) this.documentRoot.Ninja = {};
-            //
+            //Inserting user's document into template
             this._templateDocument.head.innerHTML = this._userDocument.content.head;
-            this._templateDocument.body.innerHTML = this._userDocument.content.body;
-
-            // Adding a handler for the main user document reel to finish loading.
+            //this._templateDocument.body.innerHTML = this._userDocument.content.body;
+            
+            //Adding a handler for the main user document reel to finish loading
             this._document.body.addEventListener("userTemplateDidLoad",  this.userTemplateDidLoad.bind(this), false);
 
             
             /* this.iframe.contentWindow.document.addEventListener('DOMSubtreeModified', function (e) { */ //TODO: Remove events upon loading once
 
-            //TODO: When written, the best way to initialize the document is to listen for the DOM tree being modified
+            //TODO: When re-written, the best way to initialize the document is to listen for the DOM tree being modified
             setTimeout(function () {
             	
             	
@@ -408,9 +407,41 @@ exports.HTMLDocument = Montage.create(TextDocument, {
             	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             	if(this._document.styleSheets.length > 1) {
+					//Checking all styleSheets in document
+					for (var i in this._document.styleSheets) {
+						//If rules are null, assuming cross-origin issue
+						if(this._document.styleSheets[i].rules === null) {
+							//Disabling style sheet to reload via inserting in style tag
+							this._document.styleSheets[i].disabled = 'true';
+							//TODO: Revisit URLs and URI creation logic, very hack right now
+							var fileUri, cssUrl, cssData, tag;
+							if (this._document.styleSheets[i].href.indexOf('js/document/templates/montage-html') !== -1) {
+								//Getting the url of the CSS file
+								cssUrl = this._document.styleSheets[i].href.split('js/document/templates/montage-html')[1];
+								//Creating the URI of the file
+								fileUri = this.application.ninja.coreIoApi.cloudData.root+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+cssUrl.split('/')[1];
+								//Loading the data from the file
+								cssData = this.application.ninja.coreIoApi.readFile({uri: fileUri});
+								//Creating tag with file content
+								tag = document.createElement('style');
+								tag.ninjauri = fileUri;
+								tag.innerHTML = cssData.content;
+								this._templateDocument.head.appendChild(tag);
+							}
+                    	}
+					}
+					
+					//TODO: Revisit this logic
 					this._styles = this._document.styleSheets[this._document.styleSheets.length - 1];
 					this._stylesheets = this._document.styleSheets; // Entire stlyesheets array
 					
+					
+					this._templateDocument.body.innerHTML = this._userDocument.content.body;
+					
+					
+					
+					
+					
 					//TODO Finish this implementation once we start caching Core Elements
 					// Assign a model to the UserContent and add the ViewPort reference to it.
 					NJUtils.makeElementModel(this.documentRoot, "Stage", "stage");
-- 
cgit v1.2.3


From 8974ecd564563a991ff96f9cb6d47da172174242 Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Wed, 22 Feb 2012 00:49:47 -0800
Subject: local storage integration and versioning

- Fixed the splitters

Signed-off-by: Valerio Virgillito <valerio@motorola.com>
---
 js/controllers/local-storage-controller.js | 51 +++++++++++++++++++++++-------
 js/data/settings.js                        | 17 ----------
 js/ninja.reel/ninja.html                   | 13 +++++---
 js/panels/Splitter.js                      | 22 +++++++++----
 4 files changed, 64 insertions(+), 39 deletions(-)

(limited to 'js')

diff --git a/js/controllers/local-storage-controller.js b/js/controllers/local-storage-controller.js
index 6963b245..ea763cff 100755
--- a/js/controllers/local-storage-controller.js
+++ b/js/controllers/local-storage-controller.js
@@ -7,7 +7,46 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
 var Montage = require("montage/core/core").Montage,
     Component       = require("montage/ui/component").Component;
 
-exports.LocalStorage = Montage.create( Montage, {
+exports.LocalStorage = Montage.create( Component, {
+
+    canStore: {
+        value: null
+    },
+
+    deserializedFromTemplate: {
+        value: function() {
+            this.canStore = window.localStorage;
+            this.application.localStorage = this;
+
+            // Redefine setItem and getItem if local storage is not available.
+            if(!this.canStore) {
+                this._getItem = function() {
+                    console.log("Local Storage is not supported on your browser");
+                    return "";
+                };
+
+                this._setItem = function() {
+                    console.log("Local Storage is not supported on your browser");
+                    return false;
+                }
+            }
+        }
+    },
+
+    _getItem: {
+        value: function(key) {
+            var value = window.localStorage.getItem("ninja-" + key);
+            if(value !== null) value = JSON.parse(value);
+
+            return value;
+        }
+    },
+
+    _setItem: {
+        value: function(key, value) {
+            window.localStorage.setItem("ninja-" + key, JSON.stringify(value));
+        }
+    },
 
     getItem: {
         value: function(item) {
@@ -22,16 +61,6 @@ exports.LocalStorage = Montage.create( Montage, {
                 return null;
             }
 
-            /*
-            if (window.localStorage) {
-                this.getItem = function(item) {
-                    return window.localStorage.getItem(item);
-                }(item);
-            } else {
-                alert("Local Storage is not supported on your browser");
-
-            }
-            */
         }
     },
 
diff --git a/js/data/settings.js b/js/data/settings.js
index ffea2075..6b1af3fc 100755
--- a/js/data/settings.js
+++ b/js/data/settings.js
@@ -10,10 +10,6 @@ var Montage = require("montage/core/core").Montage,
 
 exports.Settings = Montage.create( Component, {
 
-    version: {
-        value: "11.1213"
-    },
-
     _settings: {
         value: null
     },
@@ -54,18 +50,5 @@ exports.Settings = Montage.create( Component, {
                 return null;
             }
         }
-    },
-    
-    deserializedFromSerialization: {
-        value: function() {
-
-            if (LocalStorage.getItem("version") != this.version) {
-                this.settings = {}
-                LocalStorage.setItem("version",this.version);
-            } else {
-                this.settings = LocalStorage.getItem("settings");
-            }
-
-        }
     }
 });
\ No newline at end of file
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html
index 022b3f0a..43774d30 100755
--- a/js/ninja.reel/ninja.html
+++ b/js/ninja.reel/ninja.html
@@ -22,6 +22,11 @@
                 "name": "Preloader"
             },
 
+            "localStorage": {
+                "module": "js/controllers/local-storage-controller",
+                "name": "LocalStorage"
+            },
+
             "settings1": {
                 "module": "js/data/settings",
                 "name": "Settings"
@@ -324,12 +329,12 @@
             <nav id="mainMenuBar"></nav>
         </section>
 
-        <section id="leftSplitter" class="leftSplitter splitter"></section>
+        <section data-montage-id="leftSplitter" class="leftSplitter splitter"></section>
 
-        <section id="rightSplitter" class="rightSplitter splitter"></section>
+        <section data-montage-id="rightSplitter" class="rightSplitter splitter"></section>
 
         <section id="appContainer">
-            <section id="topSplitter" class="topSplitter splitter"></section>
+            <section data-montage-id="topSplitter" class="topSplitter splitter"></section>
 
             <section id="topPanelContainer" class="panelContainer">
                 <div id="topPanel" class="panel">
@@ -392,7 +397,7 @@
                 </section>
             </section>
 
-            <section id="bottomSplitter" class="bottomSplitter splitter"></section>
+            <section data-montage-id="bottomSplitter" class="bottomSplitter splitter"></section>
         </section>
         
         <section id="popupWindows"></section>
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js
index 9f5b4de7..cb05104d 100755
--- a/js/panels/Splitter.js
+++ b/js/panels/Splitter.js
@@ -9,6 +9,10 @@ var Component = require("montage/ui/component").Component;
 
 exports.Splitter = Montage.create(Component, {
 
+    version: {
+        value: "1.0"
+    },
+
     hasTemplate: {
         value: false
     },
@@ -49,19 +53,23 @@ exports.Splitter = Montage.create(Component, {
         get: function() {
             return this._collapsed;
         },
-        set: function(value)
-        {
+        set: function(value) {
             this._collapsed = value;
-            this.application.ninja.settings.setSetting(this.element.id, "collapsed", this.collapsed);
+
+            this.application.localStorage._setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value});
         }
     },
 
     prepareForDraw: {
         value: function() {
-            //Get Setting from SettingManager
-            this.application.ninja.settings.getSetting(this.element.id, "collapsed");
-            lapsed = false;
-            if (lapsed != null) this._collapsed = lapsed;
+            //Get splitter initial value from SettingManager
+            var storedData = this.application.localStorage._getItem(this.element.getAttribute("data-montage-id"));
+            if(storedData && this.element.getAttribute("data-montage-id") !== null) {
+                this._collapsed = storedData.value;
+            } else {
+                this._collapsed = false;
+            }
+
             this.element.addEventListener("click", this, false);
         }
     },
-- 
cgit v1.2.3


From 9d3589feb0174c09d1c1bac405660f8900259c7d Mon Sep 17 00:00:00 2001
From: hwc487
Date: Wed, 22 Feb 2012 04:44:07 -0800
Subject: Adding bug fixes.

---
 js/helper-classes/3D/snap-manager.js               |   1 +
 js/helper-classes/3D/view-utils.js                 |   8 +
 js/helper-classes/RDGE/GLCircle.js                 |  10 +-
 js/helper-classes/RDGE/GLLine.js                   | 594 +++++++++++----------
 js/helper-classes/RDGE/GLRectangle.js              | 117 +---
 js/helper-classes/RDGE/GLWorld.js                  |  45 +-
 .../RDGE/src/core/script/precompiled.js            |  10 +-
 js/helper-classes/RDGE/src/core/script/runtime.js  |  14 +-
 .../RDGE/src/core/script/scenegraphNodes.js        |   8 +-
 .../RDGE/src/tools/compile-rdge-core.bat           |   4 +
 .../RDGE/src/tools/compile-rdge-core.sh            |   3 +
 js/helper-classes/RDGE/src/tools/compiler.jar      | Bin 0 -> 4927265 bytes
 js/helper-classes/RDGE/src/tools/rdge-compiled.js  | 454 ++++++++++++++++
 js/tools/RotateStage3DTool.js                      |   7 +-
 js/tools/ZoomTool.js                               |   2 +-
 15 files changed, 840 insertions(+), 437 deletions(-)
 create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
 create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
 create mode 100644 js/helper-classes/RDGE/src/tools/compiler.jar
 create mode 100644 js/helper-classes/RDGE/src/tools/rdge-compiled.js

(limited to 'js')

diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 0a950658..ada6960b 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -1087,6 +1087,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
 
 			// we need to check the orientation of the bounds
 			var nrm = MathUtils.getNormalFromBounds3D( bounds3D );
+			if (MathUtils.fpSign(nrm[2]) == 0)  return null;
 			var zNrm = nrm[2];
 			var dist;
 
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index a2fac34f..bedda8bf 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -1226,6 +1226,14 @@ exports.ViewUtils = Montage.create(Component, {
 	    }
     },
 
+	getCurrentDocument:
+	{
+		value: function()
+		{
+			return snapManagerModule.SnapManager.application.ninja.currentDocument;
+		}
+	},
+
 	setStageZoom: {
         value:function( globalPt,  zoomFactor ) {
             var localPt;
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js
index 08057778..5b32547e 100755
--- a/js/helper-classes/RDGE/GLCircle.js
+++ b/js/helper-classes/RDGE/GLCircle.js
@@ -400,7 +400,10 @@ function GLCircle()
 			ctx.lineWidth = 0;
 			ctx.fillStyle   = "#990000";
 			if (this._fillColor)
-				ctx.fillStyle = MathUtils.colorToHex( this._fillColor );
+			{
+				var c = "rgba(" + 255*this._fillColor[0] + "," + 255*this._fillColor[1] + "," + 255*this._fillColor[2] + "," + this._fillColor[3] + ")";  
+				ctx.fillStyle = c;
+			}
 
 			// draw the fill
 			ctx.beginPath();
@@ -460,7 +463,10 @@ function GLCircle()
 			ctx.lineWidth	= lineWidth;
 			ctx.strokeStyle = "#0000ff";
 			if (this._strokeColor)
-				ctx.strokeStyle = MathUtils.colorToHex( this._strokeColor );
+			{
+				var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")";  
+				ctx.strokeStyle = c;
+			}
 			
 			// draw the stroke
 			p = MathUtils.transformPoint( bezPts[0],   mat );
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js
index 5ec51230..0d815145 100755
--- a/js/helper-classes/RDGE/GLLine.js
+++ b/js/helper-classes/RDGE/GLLine.js
@@ -11,74 +11,74 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
 ///////////////////////////////////////////////////////////////////////
 function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj)
 {
-    ///////////////////////////////////////////////////////////////////////
-    // Instance variables
-    ///////////////////////////////////////////////////////////////////////
-    this._width = 2.0;
-    this._height = 2.0;
-    this._xOffset = 0;
-    this._yOffset = 0;
-
-    // If line doesn't fit in canvas world, we had to grow the canvas by this much on either side
-    this._xAdj = 0;
-    this._yAdj = 0;
-    
-    this._slope = 0;
+	///////////////////////////////////////////////////////////////////////
+	// Instance variables
+	///////////////////////////////////////////////////////////////////////
+	this._width = 2.0;
+	this._height = 2.0;
+	this._xOffset = 0;
+	this._yOffset = 0;
+
+	// If line doesn't fit in canvas world, we had to grow the canvas by this much on either side
+	this._xAdj = 0;
+	this._yAdj = 0;
+	
+	this._slope = 0;
 
-    this._strokeWidth = 0.25;
+	this._strokeWidth = 0.25;
 
-    this._strokeStyle = "Solid";
-    this._scaleX = 1.0;
-    this._scaleY = 1.0;
+	this._strokeStyle = "Solid";
+	this._scaleX = 1.0;
+	this._scaleY = 1.0;
 
-    if (arguments.length > 0)
-    {
-        this._width = width;
-        this._height = height;
-        this._xOffset = xOffset;
-        this._yOffset = yOffset;
+	if (arguments.length > 0)
+	{
+		this._width = width;
+		this._height = height;
+		this._xOffset = xOffset;
+		this._yOffset = yOffset;
 
-        this._xAdj = xAdj;
-        this._yAdj = yAdj;
+		this._xAdj = xAdj;
+		this._yAdj = yAdj;
 
-        this._slope = slope;
-        this._strokeWidth = strokeSize;
-        this._strokeColor = strokeColor;
+		this._slope = slope;
+		this._strokeWidth = strokeSize;
+		this._strokeColor = strokeColor;
 
-        this._strokeStyle = strokeStyle;
-        this._scaleX = (world.getViewportWidth())/(world.getViewportHeight());
-    }
+		this._strokeStyle = strokeStyle;
+		this._scaleX = (world.getViewportWidth())/(world.getViewportHeight());
+	}
 
-    this._strokeVerticesLen = 0;
+	this._strokeVerticesLen = 0;
 
-    this.m_world = world;
+	this.m_world = world;
 
 	this._materialAmbient  = [0.2, 0.2, 0.2,  1.0];
 	this._materialDiffuse  = [0.4, 0.4, 0.4,  1.0];
 	this._materialSpecular = [0.4, 0.4, 0.4,  1.0];
 
-    // initialize the inherited members
-    this.inheritedFrom = GLGeomObj;
-    this.inheritedFrom();
+	// initialize the inherited members
+	this.inheritedFrom = GLGeomObj;
+	this.inheritedFrom();
 
-    if(strokeMaterial)
-    {
-        this._strokeMaterial = strokeMaterial;
-    }
+	if(strokeMaterial)
+	{
+		this._strokeMaterial = strokeMaterial;
+	}
 
-    ///////////////////////////////////////////////////////////////////////
-    // Property Accessors
-    ///////////////////////////////////////////////////////////////////////
+	///////////////////////////////////////////////////////////////////////
+	// Property Accessors
+	///////////////////////////////////////////////////////////////////////
 	this.getStrokeWidth		= function()		{  return this._strokeWidth;	}
 	this.setStrokeWidth		= function(w)		{  this._strokeWidth = w;		}
 
 	this.getStrokeMaterial	= function()		{  return this._strokeMaterial;	}
 	this.setStrokeMaterial	= function(m)		{  this._strokeMaterial = m;	}
 
-    this.getStrokeColor		= function()		{  return this._strokeColor;	}
+	this.getStrokeColor		= function()		{  return this._strokeColor;	}
 	//this.setStrokeColor	= function(c)		{  this._strokeColor = c;		}
 
-    this.getStrokeStyle		= function()		{  return this._strokeStyle;	}
+	this.getStrokeStyle		= function()		{  return this._strokeStyle;	}
 	this.setStrokeStyle		= function(s)		{  this._strokeStyle = s;		}
 
 	this.getFillMaterial	= function()		{  return null;		}
@@ -86,24 +86,24 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
 	this.setStrokeMaterial  = function(m)		 {  this._strokeMaterial = m;		 }
 	this.getStrokeMaterial	= function()		{  return this._strokeMaterial;		}
 
-    this.getWidth			= function()		{  return this._width;				}
+	this.getWidth			= function()		{  return this._width;				}
 	this.setWidth			= function(w)		{  this._width = w;					}
 
 	this.getHeight			= function()		{  return this._height;				}
 	this.setHeight			= function(h)		{  this._height = h;				}
 
-    this.getXAdj			= function()		{  return this._xAdj;			}
+	this.getXAdj			= function()		{  return this._xAdj;			}
 	this.setXAdj            = function(x)		{  this._xAdj = x;				}
 
-    this.getYAdj			= function()		{  return this._yAdj;			}
+	this.getYAdj			= function()		{  return this._yAdj;			}
 	this.setYAdj            = function(y)		{  this._yAdj = y;				}
 
-    this.getSlope			= function()		{  return this._slope;			}
+	this.getSlope			= function()		{  return this._slope;			}
 	this.setSlope            = function(m)		{  this._slope = m;				}
 
-    this.geomType	= function()				{  return this.GEOM_TYPE_LINE;	}
+	this.geomType	= function()				{  return this.GEOM_TYPE_LINE;	}
 
-    	///////////////////////////////////////////////////////////////////////
+		///////////////////////////////////////////////////////////////////////
 	// Methods
 	///////////////////////////////////////////////////////////////////////
 	this.export = function()
@@ -137,14 +137,14 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
 		this._yOffset			= Number( this.getPropertyFromString( "yoff: ",			importStr )  );
 		this._width				= Number( this.getPropertyFromString( "width: ",		importStr )  );
 		this._height			= Number( this.getPropertyFromString( "height: ",		importStr )  );
-        this._xAdj			    = Number( this.getPropertyFromString( "xAdj: ",			importStr )  );
-        this._yAdj			    = Number( this.getPropertyFromString( "yAdj: ",			importStr )  );
+		this._xAdj			    = Number( this.getPropertyFromString( "xAdj: ",			importStr )  );
+		this._yAdj			    = Number( this.getPropertyFromString( "yAdj: ",			importStr )  );
 		this._strokeWidth		= Number( this.getPropertyFromString( "strokeWidth: ",	importStr )  );
 		var slope 		        = this.getPropertyFromString( "slope: ",	importStr );
-        if(isNaN(Number(slope)))
-            this._slope		    = slope;
-        else
-            this._slope         = Number(slope);
+		if(isNaN(Number(slope)))
+			this._slope		    = slope;
+		else
+			this._slope         = Number(slope);
 
 		var strokeMaterialName	= this.getPropertyFromString( "strokeMat: ",	importStr );
 		this._strokeStyle		= this.getPropertyFromString( "strokeStyle: ",	importStr );
@@ -160,28 +160,28 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
 
 	}
 
-    ///////////////////////////////////////////////////////////////////////
-    // Methods
-    ///////////////////////////////////////////////////////////////////////
-    this.buildBuffers = function()
-    {
-        // get the world
-        var world = this.getWorld();
-        if (!world)  throw( "null world in buildBuffers" );
+	///////////////////////////////////////////////////////////////////////
+	// Methods
+	///////////////////////////////////////////////////////////////////////
+	this.buildBuffers = function()
+	{
+		// get the world
+		var world = this.getWorld();
+		if (!world)  throw( "null world in buildBuffers" );
 		if (!world._useWebGL)  return;
 		
 		// make sure RDGE has the correct context
 		g_Engine.setContext( world.getCanvas().uuid );
 
-         // create the gl buffer
-        var gl = world.getGLContext();
+		 // create the gl buffer
+		var gl = world.getGLContext();
 
-        this._strokeVerticesLen = 0;
+		this._strokeVerticesLen = 0;
 
-        var strokeVertices = [];
-        var strokeTextures = [];
-        var strokeNormals = [];
-        var strokeColors = [];
+		var strokeVertices = [];
+		var strokeTextures = [];
+		var strokeNormals = [];
+		var strokeColors = [];
 
 //        var scaleMat = Matrix.I(3);
 //        scaleMat.elements[0][0] = this._scaleX;
@@ -193,7 +193,7 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
 		var	vpw = world.getViewportWidth(),  vph = world.getViewportHeight();
 		var	xNDC = 2*this._xOffset/vpw,  yNDC = 2*this._yOffset/vph,
 			xFillNDC = this._width/vpw,  yFillNDC = this._height/vph,
-            xAdjNDC = this._xAdj/vpw,  yAdjNDC = this._yAdj/vph,
+			xAdjNDC = this._xAdj/vpw,  yAdjNDC = this._yAdj/vph,
 			xStrokeNDC = this._strokeWidth/vpw,  yStrokeNDC = this._strokeWidth/vph;
 
 		var aspect = world.getAspect();
@@ -218,160 +218,180 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro
 		var xStroke = -z*(r-l)/(2.0*zn)*xStrokeNDC,
 			yStroke = -z*(t-b)/(2.0*zn)*yStrokeNDC;
 
-        // get the x & y adjustments size
+		// get the x & y adjustments size
 		var xAdj = -z*(r-l)/(2.0*zn)*xAdjNDC*2,
 			yAdj = -z*(t-b)/(2.0*zn)*yAdjNDC*2;
 
 
-        this._primArray = [];
-        this._materialArray = [];
+		this._primArray = [];
+		this._materialArray = [];
 		this._materialTypeArray = [];
-	    this._materialNodeArray = [];
-        
-        this._scaleX = (world._viewportWidth)/(world._viewportHeight);
-        
-        var innerX = xFill-xStroke;
-        var innerY = yFill-yStroke;
-
-//        if( (this._strokeStyle === "Dashed") || (this._strokeStyle === "Dotted") )
-//        {
-//            var sLen = this.createStippledStrokes(strokeVertices, this._strokeWidth, this._slope, this._strokeStyle, innerX, innerY);
-//            this._strokeVerticesLen += sLen;
-//        }
-//        else
-	      {
-            if(this._slope === "vertical")
-            {
-                strokeVertices = [
-                    -xFill+x, yFill+y,  0.0,
-                    xFill+x, yFill+y,  0.0,
-                    -xFill+x, -yFill+y,  0.0,
-
-                    xFill+x, -yFill+y,  0.0,
-                    -xFill+x, -yFill+y,  0.0,
-                    xFill+x, yFill+y,  0.0
-                ];
-            }
-            else if(this._slope === "horizontal")
-            {
-                // right now, this is the same as vertical line because,
-                // our canvas is the same size as us.
-                // But, we will need to use this when drawing in an existing GLWorld with other shapes
-                strokeVertices = [
-                    -xFill+x, yFill+y,  0.0,
-                    xFill+x, yFill+y,  0.0,
-                    -xFill+x, -yFill+y,  0.0,
-
-                     xFill+x, -yFill+y,  0.0,
-                    -xFill+x, -yFill+y,  0.0,
-                    xFill+x, yFill+y,  0.0
-               ];
-            }
-            else if(this._slope > 0)
-            {
-                // if slope is positive, draw a line from top-left to bottom-right
-                strokeVertices = [
-                    -xFill+x, yFill-2*yAdj+y,  0.0,
-                    -xFill+2*xAdj+x, yFill+y,  0.0,
-                    xFill-2*xAdj+x, -yFill+y,  0.0,
-
-                    xFill+x, -yFill+2*yAdj+y,  0.0,
-                    xFill-2*xAdj+x, -yFill+y,  0.0,
-                    -xFill+2*xAdj+x, yFill+y,  0.0
-                ];
-            }
-            else
-            {
-                // else slope is negative, draw a line from bottom-left to top-right
-                strokeVertices = [
-                    -xFill+x, -yFill+2*yAdj+y,  0.0,
-                    -xFill+2*xAdj+x, -yFill+y,  0.0,
-                    xFill-2*xAdj+x, yFill+y,  0.0,
-
-                    xFill+x, yFill-2*yAdj+y,  0.0,
-                    xFill-2*xAdj+x, yFill+y,  0.0,
-                    -xFill+2*xAdj+x, -yFill+y,  0.0
-                ];
-            }
-        }
-        
-        var z = 0;
+		this._materialNodeArray = [];
+		
+		this._scaleX = (world._viewportWidth)/(world._viewportHeight);
+		
+		var innerX = xFill-xStroke;
+		var innerY = yFill-yStroke;
+
+		if(this._slope === "vertical")
+		{
+			strokeVertices = [
+				-xFill+x, yFill+y,  0.0,
+				xFill+x, yFill+y,  0.0,
+				-xFill+x, -yFill+y,  0.0,
+
+				xFill+x, -yFill+y,  0.0,
+				-xFill+x, -yFill+y,  0.0,
+				xFill+x, yFill+y,  0.0
+			];
+
+			strokeTextures = [
+				0, 1,
+				1, 1,
+				0, 0,
+
+				1, 0,
+				0, 0,
+				1, 1
+			];
+		}
+		else if(this._slope === "horizontal")
+		{
+			// right now, this is the same as vertical line because,
+			// our canvas is the same size as us.
+			// But, we will need to use this when drawing in an existing GLWorld with other shapes
+			strokeVertices = [
+				-xFill+x, yFill+y,  0.0,
+				xFill+x, yFill+y,  0.0,
+				-xFill+x, -yFill+y,  0.0,
+
+					xFill+x, -yFill+y,  0.0,
+				-xFill+x, -yFill+y,  0.0,
+				xFill+x, yFill+y,  0.0
+			];
+
+			strokeTextures = [
+				0, 1,
+				1, 1,
+				0, 0,
+
+				1, 0,
+				0, 0,
+				1, 1
+			];
+		}
+		else if(this._slope > 0)
+		{
+			// if slope is positive, draw a line from top-left to bottom-right
+			strokeVertices = [
+				-xFill+x, yFill-2*yAdj+y,  0.0,
+				-xFill+2*xAdj+x, yFill+y,  0.0,
+				xFill-2*xAdj+x, -yFill+y,  0.0,
+
+				xFill+x, -yFill+2*yAdj+y,  0.0,
+				xFill-2*xAdj+x, -yFill+y,  0.0,
+				-xFill+2*xAdj+x, yFill+y,  0.0
+			];
+
+			strokeTextures = [
+				0, 0,
+				0, 1,
+				1, 0,
+
+				1, 1,
+				1, 0,
+				0, 1
+			];
+		}
+		else
+		{
+			// else slope is negative, draw a line from bottom-left to top-right
+			strokeVertices = [
+				xFill-2*xAdj+x, yFill+y,  0.0,
+				-xFill+2*xAdj+x, -yFill+y,  0.0,
+				-xFill+x, -yFill+2*yAdj+y,  0.0,
+
+				-xFill+2*xAdj+x, -yFill+y,  0.0,
+				xFill-2*xAdj+x, yFill+y,  0.0,
+				xFill+x, yFill-2*yAdj+y,  0.0
+			];
+	
+			strokeTextures = [
+				1, 1,
+				0, 0,
+				0, 1,
+
+				0, 0,
+				1, 1,
+				1, 0
+			];
+		}
+		
+		var z = 0;
 		var indices = [];
-        var nVerts = strokeVertices.length/3;
-//        for(var i=0; i<nVerts; i++)
-//        {
-//            var vertex = Vector.create([strokeVertices[i], strokeVertices[i+1], strokeVertices[i+2]]);
-//            strokeTextures.push(vertex.e(1)*0.5 + 0.5);    strokeTextures.push(vertex.e(2)*0.5 + 0.5);
-//        }
-
-		strokeTextures = [
-			0, 1,
-			1, 1,
-			0, 0, 
-
-			1, 1,
-			0, 0,
-			1, 0
-		];
-
-        // stroke normals
+		var nVerts = strokeVertices.length/3;
+
+		// stroke normals
 		var index = 0;
-        for (var i=0;  i<nVerts;  i++)
-        {
-            // push a normal for each vertex in the stroke
-            strokeNormals.push(0.0);  strokeNormals.push(0.0);  strokeNormals.push(1);
+		for (var i=0;  i<nVerts;  i++)
+		{
+			// push a normal for each vertex in the stroke
+			strokeNormals.push(0.0);  strokeNormals.push(0.0);  strokeNormals.push(1);
 			indices.push( index );  index++;
-        }
+		}
 
 		var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, g_Engine.getContext().renderer.TRIANGLES, indices.length);
 
-        var strokeMaterial = this.makeStrokeMaterial();
+		var strokeMaterial = this.makeStrokeMaterial();
 
-        this._primArray.push( prim );
-        this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
+		this._primArray.push( prim );
+		this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
 
-        world.updateObject(this);
-    }
+		world.updateObject(this);
+	}
 
-    this.render = function()
-    {
-        // get the world
-        var world = this.getWorld();
-        if (!world)  throw( "null world in rectangle render" );
+	this.render = function()
+	{
+		// get the world
+		var world = this.getWorld();
+		if (!world)  throw( "null world in rectangle render" );
 
-         // get the context
+		 // get the context
 		var ctx = world.get2DContext();
 		if (!ctx)  return;
-    
+	
 		// set up the stroke style
 		var lineWidth = this._strokeWidth;
 		ctx.beginPath();
 		ctx.lineWidth	= lineWidth;
 		ctx.strokeStyle = "#0000ff";
 		if (this._strokeColor)
-			ctx.strokeStyle = MathUtils.colorToHex( this._strokeColor );
+		{
+			var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255