From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- js/panels/properties/content.reel/content.css | 299 ++++++++++++++++++ js/panels/properties/content.reel/content.html | 161 ++++++++++ js/panels/properties/content.reel/content.js | 328 +++++++++++++++++++ js/panels/properties/properties-panel.js | 15 + js/panels/properties/section.reel/section.html | 50 +++ js/panels/properties/section.reel/section.js | 30 ++ .../color-select.reel/color-select.html | 51 +++ .../custom-rows/color-select.reel/color-select.js | 62 ++++ .../custom-rows/dual-row.reel/dual-row.html | 67 ++++ .../sections/custom-rows/dual-row.reel/dual-row.js | 53 ++++ .../custom-rows/single-row.reel/single-row.html | 47 +++ .../custom-rows/single-row.reel/single-row.js | 50 +++ .../properties/sections/custom.reel/custom.html | 61 ++++ .../properties/sections/custom.reel/custom.js | 296 ++++++++++++++++++ .../position-and-size.reel/position-and-size.css | 14 + .../position-and-size.reel/position-and-size.html | 142 +++++++++ .../position-and-size.reel/position-and-size.js | 203 ++++++++++++ .../sections/three-d-view.reel/three-d-view.html | 348 +++++++++++++++++++++ .../sections/three-d-view.reel/three-d-view.js | 219 +++++++++++++ 19 files changed, 2496 insertions(+) create mode 100644 js/panels/properties/content.reel/content.css create mode 100644 js/panels/properties/content.reel/content.html create mode 100644 js/panels/properties/content.reel/content.js create mode 100644 js/panels/properties/properties-panel.js create mode 100644 js/panels/properties/section.reel/section.html create mode 100644 js/panels/properties/section.reel/section.js create mode 100644 js/panels/properties/sections/custom-rows/color-select.reel/color-select.html create mode 100644 js/panels/properties/sections/custom-rows/color-select.reel/color-select.js create mode 100644 js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html create mode 100644 js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js create mode 100644 js/panels/properties/sections/custom-rows/single-row.reel/single-row.html create mode 100644 js/panels/properties/sections/custom-rows/single-row.reel/single-row.js create mode 100644 js/panels/properties/sections/custom.reel/custom.html create mode 100644 js/panels/properties/sections/custom.reel/custom.js create mode 100644 js/panels/properties/sections/position-and-size.reel/position-and-size.css create mode 100644 js/panels/properties/sections/position-and-size.reel/position-and-size.html create mode 100644 js/panels/properties/sections/position-and-size.reel/position-and-size.js create mode 100644 js/panels/properties/sections/three-d-view.reel/three-d-view.html create mode 100644 js/panels/properties/sections/three-d-view.reel/three-d-view.js (limited to 'js/panels/properties') diff --git a/js/panels/properties/content.reel/content.css b/js/panels/properties/content.reel/content.css new file mode 100644 index 00000000..2537aea2 --- /dev/null +++ b/js/panels/properties/content.reel/content.css @@ -0,0 +1,299 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +.propertiesPanel { + color:#FFF; + overflow-x: hidden; +} + +.propertiesPanel .fieldCol { + display: -webkit-box; + -webkit-box-orient:horizontal; + position:relative; +} + +.propertiesPanel .fieldCol > label { + -webkit-box-flex:0; + text-align: right; + width:46px; + display:block; + padding: 4px 2px 4px 5px; + height:16px; + line-height: 16px; +} + +.propertiesPanel .fieldRow label { +padding-right:6px; + width:20px; + display: inline-block; + text-align: right; +} + + +.propertiesPanel .fieldRow { + padding: 4px 10px 4px 5px; + height:16px; + line-height: 16px; + display:block; + -webkit-box-flex:1; +} + +.propertiesPanel .fieldRow.oneCol div, .propertiesPanel .fieldRow.twoCol div,.propertiesPanel .fieldRow.threeCol div { + -webkit-box-sizing: content-box; + float:left; + +} + +.propertiesPanel hr { + border: 0; + border-top: 1px solid #3c3c3c; + border-bottom: 1px solid #555; +} + +.propertiesPanel input[type='text'] { + width:100%; + padding: 1px; +} + +.propertiesPanel .montage-textfield { + padding: 1px; +} + +.propertiesPanel .fieldRow.threeCol div input[type='text'] { + width:34px; + display: inline-block; +} + +.propertiesPanel .hottextunit input { + width:38px; +} + +.propertiesPanel .fieldRow.threeCol div .inputField { + width:34px; +} +.propertiesPanel .fieldRow.twoCol label { + width:74px; + display: inline-block; + +} + +.propertiesPanel .fieldRow.oneCol label { + width:auto; + display: inline-block; + +} + +.propertiesPanel .fieldRow.oneCol div input[type='text'] { + width:34px; + display: inline-block; +} +.propertiesPanel .fieldRow.oneCol div .inputField { + width:34px; +} + + +.propertiesPanel .fieldRow.twoCol div input[type='text'] { + width:38px; + display: inline-block; +} +.propertiesPanel .fieldRow.twoCol div .inputField { + width:38px; +} + +.propertiesPanel input[type='text'][readonly], .propertiesPanel input[type='text'][readonly]:focus { + border: none; + background: none; + -webkit-box-shadow:none; +} + +.propertiesPanel h2 { + background: #3E3E3E; + font-size:11px; + height:16px; + line-height: 17px; + display:-webkit-box; + -webkit-box-orient:horizontal; + margin: 0px; + border-bottom: 1px solid #3A3A3A; +} +.propertiesPanel .subSectionHeader .arrow { + -webkit-box-flex:0; + margin: 0px 10px; +} + +.propertiesPanel .subSectionHeader .arrowIcon { + background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5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FARS5OV7L4RixhhcqQ9crMsA/tpIKY3WGuu62sWcw3VdKKXYAaC1RhRF8DwPjuPsFuccnHOM44g4js+fIIRA133+GjdJEgghzgFExO73LyzLcnr5+Xwgz3MQEbMmEEKgbdtTwO2WbhpbAhARU0phnuedaBgGFEUBImJEdP4LP8lN08D3/a1P0/TgbEsAImJ932Oaps29LMvN/U8JAKCqKgRBgCzLrO47wBuZdV1nwjBEXdcAwGwA9homKeX7mdFaw3XdA0ApdQT82zB9DwCCtIRuTJsRWAAAAABJRU5ErkJggg==") 0px 0px no-repeat; + -webkit-background-size:cover; + width:15px; + height:15px; +} + +.propertiesPanel .subSectionHeader.collapsed .arrowIcon { + -webkit-transform: rotate(-90deg); +} + +.propertiesPanel .sectional { + padding: 4px; +} + +.propertiesPanel .animated { + -webkit-transition: 0.2s all linear; +} + +.propertiesPanel div.collapsed { + padding: 0px !important; + height:0px !important; + overflow: hidden; +} + +.propertiesPanel .subSectionHeader section { + -webkit-box-flex:1; +} + +.propertiesPanel { + text-shadow: 1px 1px 1px #000; +} + +/* Dropdown layout */ +.propertiesPanel select { + -webkit-appearance: none; + font-size: 10px; + color: white; + background-color: #444; + border: 1px solid #313131; + width: 100%; + -webkit-box-sizing: border-box; + height: 15px; + outline: none; + background-image: url("../../../../images/dropdown-bg.png"); + background-repeat: no-repeat; + background-position: right center; + border-radius: 0px; + padding-left:5px; +} + +/* File Input Field */ +.propertiesPanel .file { + display:-webkit-box; +} +.propertiesPanel .file input { + -webkit-box-flex:1; + width:auto; + display: block; +} +.propertiesPanel .file .source { + border: 1px solid #313131; + background-color: #444; + color:#FFF; + height:16px; + width:20px; + -webkit-box-flex:0; + cursor: pointer; + padding: 0px; +} + +.propertiesPanel .file .source:hover { + background-color:#555; +} + +.propertiesPanel .file .source:active { + background-color: #666; +} + +/* Checkbox layout */ + +.propertiesPanel .fieldRow.checkbox div .inputField { + width:25px; +} + +.propertiesPanel .fieldRow.colorSelect { + height: 20px; +} + +.propertiesPanel .colortoolbar { + width: 105px; + float:left; +} + +.propertiesPanel .colortoolbar div { + margin: 0px 10px 0px 20px; + clear:none; +} + +/* color select */ +.propertiesPanel .colortoolbar button { + width:40px; + height:20px; + clear:none; +} + +.propertiesPanel .LockToolUp, .propertiesPanel .UnLockToolUp { + position: absolute; + left: 105px; + border: none; + background-color: transparent; + top: 2px; + opacity: 0.7; +} + +.propertiesPanel .button:active { + outline: none; +} + +.propertiesPanel .LockToolUp:hover, .propertiesPanel .UnLockToolUp:hover { + opacity: 1; +} + +.propertiesPanel input[type="checkbox"].nj-skinned, .propertiesPanel input[type="radio"].nj-skinned { + position: relative; + overflow: visible; +} + +.propertiesPanel input[type="checkbox"].nj-skinned:checked::after, .propertiesPanel input[type="radio"].nj-skinned:checked::after { + content: ""; +} + +.propertiesPanel input[type="checkbox"].nj-skinned:checked::before { + content: "✔"; +} + +.propertiesPanel input[type="radio"].nj-skinned:checked::before { + content: "•"; +} + +.propertiesPanel input.nj-skinned label { + position: absolute; + top: 0; + left: 15px; + font-size: 10px; + width:55px; + text-align: left; + font-weight: normal; + color:#FFF; +} + +.propertiesPanel input[type='radio'].nj-skinned { + text-indent: 0px; + line-height: 5px; +} + +.propertiesPanel input[type='radio'].nj-skinned label { + left:15px; +} + +input label { + -webkit-user-select: none; +} + +.propertiesPanel .rotation > label { + padding-left:40px; + padding-right:5px; +} + +.propertiesPanel .rotation .fieldRow { + -webkit-box-flex:0; + width:45px; +} \ No newline at end of file diff --git a/js/panels/properties/content.reel/content.html b/js/panels/properties/content.reel/content.html new file mode 100644 index 00000000..ab485323 --- /dev/null +++ b/js/panels/properties/content.reel/content.html @@ -0,0 +1,161 @@ + + + + + + + + + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js new file mode 100644 index 00000000..fe6faef8 --- /dev/null +++ b/js/panels/properties/content.reel/content.js @@ -0,0 +1,328 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, + PiData = require("js/data/pi/pi-data").PiData, + CustomSection = require("js/panels/properties/sections/custom.reel").CustomSection; + +var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; + +exports.Content = Montage.create(Component, { + + elementName: { + value: null + }, + + elementID: { + value: null + }, + + elementClassName: { + value: null + }, + + customSections: { + value: [] + }, + + _customPi: { + value: null + }, + + customPi: { + get: function() { + return this._customPi; + }, + set: function(value) { + if(this._customPi !== value) { + this._customPi = value; + } + } + }, + + prepareForDraw: { + value : function() { + + this.eventManager.addEventListener("selectionChange", this, false); + + // This will be a toggle option + if(this.application.ninja.appData.PILiveUpdate) { + this.eventManager.addEventListener( "elementChanging", this, false); + } + + this.eventManager.addEventListener( "elementChange", this, false); + + if(this.application.ninja.selectedElements.length === 0) { + this.displayStageProperties(); + } + + this.elementId.element.addEventListener("blur", this, false); + this.elementId.element.addEventListener("keyup", this, false); + } + }, + + /** + * Blur and Key up to handle change in the Element ID field. + */ + handleBlur: { + value: function(event) { + if(this.application.ninja.selectedElements.length) { + ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi"); + } else { + ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id); + } + } + }, + + handleKeyup: { + value: function(event) { + if(event.keyCode === 13) { + this.elementId.element.blur(); + } + } + }, + + handleElementChanging: { + value: function(event) { +// this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "left")); +// this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "top")); + } + }, + + handleElementChange: { + value: function(event) { +// console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update + if(event.detail.source && event.detail.source !== "pi") { + this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "left")); + this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "top")); + } + } + }, + + handleSelectionChange: { + value: function(event) { + if(event.detail.isDocument) { + this.displayStageProperties(); + } else { + if(this.application.ninja.selectedElements.length === 1) { + this.displayElementProperties(this.application.ninja.selectedElements[0]._element); + } else { + this.displayGroupProperties(this.application.ninja.selectedElements); + } + + } + } + }, + + displayStageProperties: { + value: function() { + var stage = this.application.ninja.currentDocument.documentRoot; + //this is test code please remove + this.elementName = "Stage"; + this.elementId.value = stage.elementModel.id; + this.elementClassName = ""; + + this.positionSize.disablePosition = true; + this.threeD.disableTranslation = true; + + this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(stage, "height")); + this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width")); + + if(this.customPi !== stage.elementModel.pi) { + this.customPi = stage.elementModel.pi; + this.displayCustomProperties(stage, stage.elementModel.pi); + } + } + }, + + displayElementProperties: { + value: function (el) { + var customPI; + + this.elementName = el.elementModel.selection; + this.elementId.value = el.getAttribute("id") || ""; + this.elementClassName = el.getAttribute("class"); + + this.positionSize.disablePosition = false; + this.threeD.disableTranslation = false; + + this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left")); + this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top")); + this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height")); + this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width")); + + + if(this.threeD.inGlobalMode) + { + this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D"); + this.threeD.y3D = ElementsMediator.get3DProperty(el, "y3D"); + this.threeD.z3D = ElementsMediator.get3DProperty(el, "z3D"); + this.threeD.xAngle = ElementsMediator.get3DProperty(el, "xAngle"); + this.threeD.yAngle = ElementsMediator.get3DProperty(el, "yAngle"); + this.threeD.zAngle = ElementsMediator.get3DProperty(el, "zAngle"); + } + + // Custom Section + if(this.customPi !== el.elementModel.pi) { + this.customPi = el.elementModel.pi; + this.displayCustomProperties(el, el.elementModel.pi); + } + + customPI = PiData[this.customPi]; + // Get all the custom section for the custom PI + for(var i = 0, customSec; customSec = customPI[i]; i++) { + + // Now set the Fields for the custom PI + for(var j = 0, fields; fields = customSec.Section[j]; j++) { + for(var k = 0, control; control = fields[k]; k++) { + + if(control.prop !== "border-color" && control.prop !== "background-color") { + var currentValue = ElementsMediator.getProperty(el, control.prop, control.valueMutator); + currentValue ? currentValue = currentValue : currentValue = control.defaultValue; + this.customSections[0].content.controls[control.id] = currentValue; + } + } + } + } + + + //TODO: Once logic for color and gradient is established, this needs to be revised + + var color, background, backgroundImage, borderColor = ElementsMediator.getProperty(el, "border-color"), borderImage = ElementsMediator.getProperty(el, "border-image"); + this.application.ninja.colorController.colorModel.input = "stroke"; + if(borderColor || borderImage) { + if (borderImage && borderImage !== 'none' && borderImage.indexOf('-webkit') >= 0) { + //Gradient + color = this.application.ninja.colorController.getColorObjFromCss(borderImage); + if (color && color.value) { + this.application.ninja.colorController.colorModel[color.mode] = {value: color.value, wasSetByCode: true, type: 'change'}; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } else { + //Solid + color = this.application.ninja.colorController.getColorObjFromCss(borderColor); + if (color && color.value) { + color.value.wasSetByCode = true; + color.value.type = 'change'; + if (color.value.a) { + this.application.ninja.colorController.colorModel.alpha = {value: color.value.a, wasSetByCode: true, type: 'change'}; + } + this.application.ninja.colorController.colorModel[color.mode] = color.value; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + // + background = ElementsMediator.getProperty(el, "background-color"); + backgroundImage = ElementsMediator.getProperty(el, "background-image"); + this.application.ninja.colorController.colorModel.input = "fill"; + if(background || backgroundImage) { + if (backgroundImage && backgroundImage !== 'none' && backgroundImage.indexOf('-webkit') >= 0) { + //Gradient + color = this.application.ninja.colorController.getColorObjFromCss(backgroundImage); + if (color && color.value) { + this.application.ninja.colorController.colorModel[color.mode] = {value: color.value, wasSetByCode: true, type: 'change'}; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } else { + //Solid + color = this.application.ninja.colorController.getColorObjFromCss(background); + if (color && color.value) { + color.value.wasSetByCode = true; + color.value.type = 'change'; + if (color.value.a) { + this.application.ninja.colorController.colorModel.alpha = {value: color.value.a, wasSetByCode: true, type: 'change'}; + } + this.application.ninja.colorController.colorModel[color.mode] = color.value; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + + + + + + } + }, + + displayGroupProperties: { + value: function (els) { + this.elementName = "Multiple Elements"; + } + }, + + displayCustomProperties: { + value: function() { + var customPI; + + this.customSections = []; + + customPI = PiData[this.customPi]; + + if(customPI) { + //Get all the custom sections for the custom PI + for(var i = 0, customSec; customSec = customPI[i]; i++) { + var customUI = CustomSection.create(); + customUI.fields = customSec.Section; + this.customSections.push({ + name: customSec.label, + content: customUI + }); + } + } + + for(var j = 0, customSections; customSections = this.customSections[j]; j++) { + customSections.content.addEventListener("propertyChange", this, false); + customSections.content.addEventListener("propertyChanging", this, false); + } + + } + }, + + handlePropertyChange: { + value: function(e) { + var newValue; + + e.units ? newValue = e.value + e.units : newValue = e.value; + + if(e.prop === "border-width") {// || e.prop === "border-style") { + ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-style", [this.customSections[0].content.controls.borderStyle], "Change", "pi"); + } else if(e.prop === "border-style") { + ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-width", [this.customSections[0].content.controls.borderWidth + "px"], "Change", "pi"); + } + + ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [newValue], "Change", "pi"); + + } + }, + + handlePropertyChanging: { + value: function(e) { + +// ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-style", [this.customSections[0].content.controls.borderStyle], "Changing", "pi"); + ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [e.value + "px"], "Changing", "pi"); + + + } + } + +}); diff --git a/js/panels/properties/properties-panel.js b/js/panels/properties/properties-panel.js new file mode 100644 index 00000000..31bc4919 --- /dev/null +++ b/js/panels/properties/properties-panel.js @@ -0,0 +1,15 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage; +var PanelBase = require("js/panels/PanelBase").PanelBase; +var Content = require("js/panels/properties/content.reel").Content; + +exports.PropertiesPanel = Montage.create(PanelBase, { + panelName : { value: "Properties" }, + minHeight : { value: 200 }, + content : { value: Content } +}); \ No newline at end of file diff --git a/js/panels/properties/section.reel/section.html b/js/panels/properties/section.reel/section.html new file mode 100644 index 00000000..8a331119 --- /dev/null +++ b/js/panels/properties/section.reel/section.html @@ -0,0 +1,50 @@ + + + + + + + +
+

+
+
+

+
+
+ + \ No newline at end of file diff --git a/js/panels/properties/section.reel/section.js b/js/panels/properties/section.reel/section.js new file mode 100644 index 00000000..b246c171 --- /dev/null +++ b/js/panels/properties/section.reel/section.js @@ -0,0 +1,30 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage; +var Component = require("montage/ui/component").Component; + +exports.Section = Montage.create(Component, { + + name: { + value: "Panel" + }, + + slot: { + value: null + }, + + content: { + value: null + }, + + prepareForDraw: { + value: function() { + this.element.getElementsByClassName("title")[0].innerHTML = this.name; + this.slot.content = this.content; + } + } +}); \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html new file mode 100644 index 00000000..9c2588b9 --- /dev/null +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html @@ -0,0 +1,51 @@ + + + + + + + +
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js new file mode 100644 index 00000000..60f8efef --- /dev/null +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js @@ -0,0 +1,62 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage; +var Component = require("montage/ui/component").Component; + +exports.ColorSelect = Montage.create(Component, { + + Stroke: { + value: null + }, + + Fill: { + value: null + }, + + handleChange: { + value: function(e) { + + } + }, + + colorVisible: { + value: true + }, + + color2Visible: { + value: true + }, + + divider: { + value: false + }, + + prepareForDraw: { + value: function() { + if (this.divider) { + this.element.appendChild(document.createElement("hr")); + } + if (!this.colorVisible) { + this.Stroke.style.display = "none"; + } + + if (!this.color2Visible) { + this.Fill.style.display = "none"; + } + +// for (var i = 0; i < this.options.length; i ++ ) { +// var tmpOption = new Option(); +// tmpOption.text = this.options[i].name; +// tmpOption.value = this.options[i].value; +// if (i === this.selectedIndex) tmpOption.selected = true +// this.options[i].name = this.element.getElementsByTagName("select")[0].add(tmpOption); +// } + + } + } + +}); \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html b/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html new file mode 100644 index 00000000..0398ff4c --- /dev/null +++ b/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html @@ -0,0 +1,67 @@ + + + + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js b/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js new file mode 100644 index 00000000..72d216ca --- /dev/null +++ b/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js @@ -0,0 +1,53 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage; +var Component = require("montage/ui/component").Component; + +exports.DualRow = Montage.create(Component, { + id: { + value: null + }, + + label: { + value: null + }, + + label2:{ + value: null + }, + + content: { + value: null + }, + + content2: { + value: null + }, + + eventDelegate: { + value: null + }, + + divider: { + value: false + }, + + prepareForDraw: { + value: function() { + if (this.divider) this.element.appendChild(document.createElement("hr")); + if(this.label !== null) { + this.element.getElementsByClassName("lbl")[0].innerHTML = this.label + ":"; + } + if(this.label2 !== null) { + this.element.getElementsByClassName("lbl")[1].innerHTML = this.label2 + ":"; + } else { + this.element.getElementsByClassName("lbl")[1].style.display = "none"; + } + } + } + +}); \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/single-row.reel/single-row.html b/js/panels/properties/sections/custom-rows/single-row.reel/single-row.html new file mode 100644 index 00000000..27c02380 --- /dev/null +++ b/js/panels/properties/sections/custom-rows/single-row.reel/single-row.html @@ -0,0 +1,47 @@ + + + + + + + +
+
+ +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/single-row.reel/single-row.js b/js/panels/properties/sections/custom-rows/single-row.reel/single-row.js new file mode 100644 index 00000000..b606d6b8 --- /dev/null +++ b/js/panels/properties/sections/custom-rows/single-row.reel/single-row.js @@ -0,0 +1,50 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage; +var Component = require("montage/ui/component").Component; + +exports.SingleRow = Montage.create(Component, { + id: { + value: null + }, + + label: { + value: null + }, + + content: { + value: null + }, + + eventDelegate: { + value: null + }, + + + handleChange: { + value: function(event) { + } + }, + + handleChanging: { + value: function(event) { + this.eventDelegate({"type": "changing", "id": this.id, "prop": this.prop, "text": this.label, "value": this.value}); + } + }, + + divider: { + value: false + }, + + prepareForDraw: { + value: function() { + if (this.divider) this.element.appendChild(document.createElement("hr")); + if(this.label !== null) this.element.getElementsByClassName("lbl")[0].innerHTML = this.label + ":"; + } + } + +}); \ No newline at end of file diff --git a/js/panels/properties/sections/custom.reel/custom.html b/js/panels/properties/sections/custom.reel/custom.html new file mode 100644 index 00000000..6d4cf0cd --- /dev/null +++ b/js/panels/properties/sections/custom.reel/custom.html @@ -0,0 +1,61 @@ + + + + + + + + +
+
+
+
+
+ + \ No newline at end of file diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js new file mode 100644 index 00000000..2b5b522a --- /dev/null +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -0,0 +1,296 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage; +var Component = require("montage/ui/component").Component; + +//Custom Rows +var SingleRow = require("js/panels/properties/sections/custom-rows/single-row.reel").SingleRow; +var DualRow = require("js/panels/properties/sections/custom-rows/dual-row.reel").DualRow; +var ColorSelect = require("js/panels/properties/sections/custom-rows/color-select.reel").ColorSelect; + +// Components Needed to make this work +var Hottext = require("js/components/hottextunit.reel").HotTextUnit; +var Dropdown = require("js/components/combobox.reel").Combobox; +var TextField = require("js/components/textfield.reel").TextField; +var FileInput = require("js/components/ui/file-input.reel").FileInput; +var Checkbox = require("js/components/checkbox.reel").Checkbox; + + +exports.CustomSection = Montage.create(Component, { + + repeat: { + value: null + }, + + _fields: { + + }, + + fields: { + get: function() { + return this._fields; + }, + set: function(val) { + this.controls = {}; + this.rows = []; + this._fields = val; + for(var i=0; i < this._fields.length; i++) { + var tmpRow, fields; + if(this._fields[i].length === 1) { + fields = this._fields[i][0]; + tmpRow = SingleRow.create(); + tmpRow.content = this.generateObject(fields); + if (fields.label) tmpRow.label = fields.label; + if (fields.divider) tmpRow.divider = fields.divider; + this.rows.push(tmpRow); + } else if(this._fields[i].length === 2) { + + var obj1 = this._fields[i][0]; + var obj2 = this._fields[i][1]; + + + if (obj1.type == "color" && obj2.type == "color") { + tmpRow = Montage.create(ColorSelect); + if(obj1.visible === false) tmpRow.colorVisible = obj1.visible; + if(obj2.visible === false) tmpRow.color2Visible = obj2.visible; + + } + else + { + tmpRow = DualRow.create(); + if (obj1.label) tmpRow.label = obj1.label; + if (obj2.label) tmpRow.label2 = obj2.label; + tmpRow.content = this.generateObject(obj1); + tmpRow.content2 = this.generateObject(obj2); + } + + if (obj1.divider === true || obj2.divider === true) tmpRow.divider = true; + this.rows.push(tmpRow); + + } else if(this._fields[i].length === 3) { + + } + + } + } + + }, + + rows: { + value: [] + }, + + controls: { + value:{} + }, + + handleChanging: + { + value:function(event) + { + var obj = event.currentTarget; + this._dispatchPropEvent({"type": "changing", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); + } + }, + + handleChange: { + value:function(event) { + if(event._event.wasSetByCode) return; + + var obj = event.currentTarget; + this._dispatchPropEvent({"type": "change", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); + } + }, + + _dispatchPropEvent: { + value: function(event) { +// console.log(event); + var propEvent = document.createEvent("CustomEvent"); + if(event.type === "changing") + { + propEvent.initEvent("propertyChanging", true, true); + propEvent.type = "propertyChanging"; + } + else + { + propEvent.initEvent("propertyChange", true, true); + propEvent.type = "propertyChange"; + } + + propEvent.id = event.id; + propEvent.prop = event.prop; + propEvent.text = event.text; + propEvent.value = event.value; + + event.control.units ? propEvent.units = event.control.units : propEvent.units = ""; + + this.dispatchEvent(propEvent); + } + }, + + generateObject: { + value: function(fields) { + switch(fields.type) { + case "hottext" : return this.createHottext(fields); + case "dropdown" : return this.createDropdown(fields); + case "textbox" : return this.createTextField(fields); + case "file" : return this.createFileInput(fields); + case "checkbox" : return this.createCheckbox(fields); + } + } + }, + + //Breaking Up Switch Case Statement to functions to return a row + createHottext: { + value: function(aField) { + + // Generate Hottext + var obj = Hottext.create(); + + // Set Values for HottextRow + if (aField.id) obj.id = aField.id; + if (aField.value) obj.value = aField.value; + if (aField.acceptableUnits) obj.acceptableUnits = aField.acceptableUnits; + if (aField.unit) obj.units = aField.unit; + if (aField.min) obj._minValue = aField.min; + if (aField.max) obj._maxValue = aField.max; + if (aField.prop) obj.prop = aField.prop; + + //Initiate onChange Events + obj.addEventListener("change", this, false); + obj.addEventListener("changing", this, false); + + //Bind object value to controls list so it can be manipulated + Object.defineBinding(this.controls, aField.id, { + boundObject: obj, + boundObjectPropertyPath: "value" + }); + + return obj; + } + }, + + createDropdown: { + value: function(aField) { + + //Generate Dropdown + var obj = Dropdown.create(); + + // Set Values for Dropdown + if (aField.id) obj.id = aField.id; + if (aField.prop) obj.prop = aField.prop; + if (aField.value) obj.value = aField.value; + if (aField.labelField) obj.labelField = aField.labelField; + if (aField.labelFunction) obj.labelFunction = aField.labelFunction; + if (aField.items) { + if(aField.items.boundObject) { + obj.items = eval(aField.items.boundObject)[aField.items.boundProperty]; + } else { + obj.items = aField.items; + } + } + + obj.addEventListener("change", this, false); +// +// Object.defineBinding(obj, "value", { +// boundObject: this.controls, +// boundObjectPropertyPath: aField.id, +// oneway: false, +// boundValueMutator: function(value) { +// console.log("In the binding ", value); +// return value; +// } +// }); + + Object.defineBinding(this.controls, aField.id, { + boundObject: obj, + boundObjectPropertyPath: "value", + oneway: false + }); + + + obj.needsDraw = true; + + return obj; + } + }, + + createTextField: { + value: function(aField) { + + // Generate Textfield + var obj = TextField.create(); + + // Set Values for TextField + if (aField.id) obj.id = aField.id; + if (aField.value) obj.value = aField.value; + if (aField.prop) obj.prop = aField.prop; + + //Initiate onChange Events + obj.addEventListener("change", this, false); + + //Bind object value to controls list so it can be manipulated + Object.defineBinding(this.controls, aField.id, { + boundObject: obj, + boundObjectPropertyPath: "value" + }); + + return obj; + } + }, + + createFileInput: { + value: function(aField) { + + // Generate Textfield + var obj = TextField.create(); + + // Set Values for TextField + if (aField.id) obj.id = aField.id; + if (aField.value) obj.value = aField.value; + if (aField.prop) obj.prop = aField.prop; + + + //Initiate onChange Events + obj.addEventListener("change", this, false); + + //Bind object value to controls list so it can be manipulated + Object.defineBinding(this.controls, aField.id, { + boundObject: obj, + boundObjectPropertyPath: "value" + }); + + return obj; + } + }, + + createCheckbox: { + value: function(aField) { + + // Generate Textfield + var obj = Checkbox.create(); + + // Set Values for TextField + if (aField.id) obj.id = aField.id; + if (aField.checked) obj.checked = aField.checked; + if (aField.value) obj.label = aField.value; + if (aField.prop) obj.prop = aField.prop; + + //Initiate onChange Events + obj.addEventListener("change", this, false); + + //Bind object value to controls list so it can be manipulated + Object.defineBinding(this.controls, aField.id, { + boundObject: obj, + boundObjectPropertyPath: "checked" + }); + + return obj; + } + } + +}); \ No newline at end of file diff --git a/js/panels/properties/sections/position-and-size.reel/position-and-size.css b/js/panels/properties/sections/position-and-size.reel/position-and-size.css new file mode 100644 index 00000000..227a232b --- /dev/null +++ b/js/panels/properties/sections/position-and-size.reel/position-and-size.css @@ -0,0 +1,14 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +.fieldCol .hide { + display: none; +} + +.fieldCol .disabled +{ + color:#999999; +} \ No newline at end of file diff --git a/js/panels/properties/sections/position-and-size.reel/position-and-size.html b/js/panels/properties/sections/position-and-size.reel/position-and-size.html new file mode 100644 index 00000000..79a55385 --- /dev/null +++ b/js/panels/properties/sections/position-and-size.reel/position-and-size.html @@ -0,0 +1,142 @@ + + + + + +