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 --- .../bread-crumb-button.reel/bread-crumb-button.css | 32 ++++ .../bread-crumb-button.html | 36 ++++ .../bread-crumb-button.reel/bread-crumb-button.js | 58 ++++++ .../layout/bread-crumb.reel/bread-crumb.css | 27 +++ .../layout/bread-crumb.reel/bread-crumb.html | 70 ++++++++ .../layout/bread-crumb.reel/bread-crumb.js | 110 ++++++++++++ .../layout/document-bar.reel/document-bar.css | 43 +++++ .../layout/document-bar.reel/document-bar.html | 58 ++++++ .../layout/document-bar.reel/document-bar.js | 101 +++++++++++ .../layout/document-entry.reel/close_button.gif | Bin 0 -> 139 bytes .../layout/document-entry.reel/document-entry.css | 38 ++++ .../layout/document-entry.reel/document-entry.html | 34 ++++ .../layout/document-entry.reel/document-entry.js | 110 ++++++++++++ .../layout/documents-tab.reel/documents-tab.css | 40 +++++ .../layout/documents-tab.reel/documents-tab.html | 77 ++++++++ .../layout/documents-tab.reel/documents-tab.js | 45 +++++ .../layout/stage-mode.reel/stage-mode.css | 24 +++ .../layout/stage-mode.reel/stage-mode.html | 33 ++++ js/components/layout/stage-mode.reel/stage-mode.js | 52 ++++++ .../layout/subtool-button.reel/subtool-button.css | 22 +++ .../layout/subtool-button.reel/subtool-button.html | 34 ++++ .../layout/subtool-button.reel/subtool-button.js | 65 +++++++ .../layout/tool-button.reel/tool-button.css | 24 +++ .../layout/tool-button.reel/tool-button.html | 35 ++++ .../layout/tool-button.reel/tool-button.js | 112 ++++++++++++ .../layout/tools-list.reel/tools-list.css | 9 + .../layout/tools-list.reel/tools-list.html | 174 ++++++++++++++++++ js/components/layout/tools-list.reel/tools-list.js | 87 +++++++++ .../tools-properties.reel/tools-properties.css | 11 ++ .../tools-properties.reel/tools-properties.html | 196 +++++++++++++++++++++ .../tools-properties.reel/tools-properties.js | 55 ++++++ 31 files changed, 1812 insertions(+) create mode 100644 js/components/layout/bread-crumb-button.reel/bread-crumb-button.css create mode 100644 js/components/layout/bread-crumb-button.reel/bread-crumb-button.html create mode 100644 js/components/layout/bread-crumb-button.reel/bread-crumb-button.js create mode 100644 js/components/layout/bread-crumb.reel/bread-crumb.css create mode 100644 js/components/layout/bread-crumb.reel/bread-crumb.html create mode 100644 js/components/layout/bread-crumb.reel/bread-crumb.js create mode 100644 js/components/layout/document-bar.reel/document-bar.css create mode 100644 js/components/layout/document-bar.reel/document-bar.html create mode 100644 js/components/layout/document-bar.reel/document-bar.js create mode 100644 js/components/layout/document-entry.reel/close_button.gif create mode 100644 js/components/layout/document-entry.reel/document-entry.css create mode 100644 js/components/layout/document-entry.reel/document-entry.html create mode 100644 js/components/layout/document-entry.reel/document-entry.js create mode 100644 js/components/layout/documents-tab.reel/documents-tab.css create mode 100644 js/components/layout/documents-tab.reel/documents-tab.html create mode 100644 js/components/layout/documents-tab.reel/documents-tab.js create mode 100644 js/components/layout/stage-mode.reel/stage-mode.css create mode 100644 js/components/layout/stage-mode.reel/stage-mode.html create mode 100644 js/components/layout/stage-mode.reel/stage-mode.js create mode 100644 js/components/layout/subtool-button.reel/subtool-button.css create mode 100644 js/components/layout/subtool-button.reel/subtool-button.html create mode 100644 js/components/layout/subtool-button.reel/subtool-button.js create mode 100644 js/components/layout/tool-button.reel/tool-button.css create mode 100644 js/components/layout/tool-button.reel/tool-button.html create mode 100644 js/components/layout/tool-button.reel/tool-button.js create mode 100644 js/components/layout/tools-list.reel/tools-list.css create mode 100644 js/components/layout/tools-list.reel/tools-list.html create mode 100644 js/components/layout/tools-list.reel/tools-list.js create mode 100644 js/components/layout/tools-properties.reel/tools-properties.css create mode 100644 js/components/layout/tools-properties.reel/tools-properties.html create mode 100644 js/components/layout/tools-properties.reel/tools-properties.js (limited to 'js/components/layout') diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.css b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.css new file mode 100644 index 00000000..9d0a1eb4 --- /dev/null +++ b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.css @@ -0,0 +1,32 @@ +/* + 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. +
*/ + +.breadcrumbbuttonBackground { + height: 20px; + min-width: 50px; + margin: auto; + border:1px solid black; + float:left; + margin-left:10px; + background:#474747; + margin-top:3px; +} + + +.breadcrumbtoolBarButton { + border: 1px; + color: white; + text-align:-webkit-center; + margin-top : 4px; + cursor :default; + font-family: 'Droid Sans'; + font-size: 12px; + text-shadow: 1px 1px 1px black; + +} + + + diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.html b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.html new file mode 100644 index 00000000..b3fdb0b6 --- /dev/null +++ b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js new file mode 100644 index 00000000..65e5b7c8 --- /dev/null +++ b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js @@ -0,0 +1,58 @@ +/* + 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.BreadcrumbButton = Montage.create(Component, { + + button: { value: null }, + + data: { value: null }, + + prepareForDraw: { + enumerable: false, + value: function() { + this.element.addEventListener("mousedown", this, false); + } + }, + + draw: { + enumerable: false, + value: function() { + + if(this.data.element.id==="UserContent"){ + + this.button.innerHTML = "Body"; + } + + else{ + this.button.innerHTML=this.data.element.nodeName; + } + + } + }, + + handleMousedown: { + value: function(event) { + + if(event.which===1){ + + this.data.selected=true; + NJevent('breadCrumbTrail',this.data); + this.data.selected=false; + } + + } + } + + + + + + +}); \ No newline at end of file diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.css b/js/components/layout/bread-crumb.reel/bread-crumb.css new file mode 100644 index 00000000..f84c6e80 --- /dev/null +++ b/js/components/layout/bread-crumb.reel/bread-crumb.css @@ -0,0 +1,27 @@ +/* + 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. +
*/ + +.bread_crumb{ + border-style: double; + height: 26px; +} +.breadcrumbtrail{ + -webkit-box-flex: 0; +} +.bread_crumb_button{ + background-color: #575757; + float: left; + width: 40px; + height: 20px; + margin-left: 5px; + margin-top: 3px; + + font-family: 'Droid Sans', sans-serif; + font-size: 12px; + text-shadow: 1px 1px 1px black; + + color: white; +} \ No newline at end of file diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.html b/js/components/layout/bread-crumb.reel/bread-crumb.html new file mode 100644 index 00000000..67328479 --- /dev/null +++ b/js/components/layout/bread-crumb.reel/bread-crumb.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js new file mode 100644 index 00000000..9782d9d1 --- /dev/null +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -0,0 +1,110 @@ +/* + 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; + +exports.Breadcrumb = Montage.create(Component, { + + _container:{ + value:null + }, + + + container: { + set: function(value) { + if(this._container !== value) { + this._container = value; + this.createContainerElements(); + } + }, + get: function() { + return this._container; + } + }, + + containerElements: { + value: [] + }, + + deserializedFromTemplate : { + value: function() { + this.eventManager.addEventListener( "appLoaded", this, false); + this.eventManager.addEventListener( "openDocument", this, false); + this.eventManager.addEventListener( "breadCrumbTrail", this, false); + } + }, + + handleAppLoaded : { + value: function() { + + Object.defineBinding(this, "container", { + boundObject: this.application.ninja, + boundObjectPropertyPath: "currentSelectedContainer", + oneway: false + }); + } + }, + + createContainerElements: { + value: function() { + var parentNode; + + while(this.containerElements.pop()){ + // To empty the array to get the new parentNode of the new currentLevel + } + + if(this.container.id === "UserContent") { + this.containerElements.push({selected:false,element:this.container}); + } else { + + parentNode = this.container; + + while(parentNode.id !== "UserContent") { + this.containerElements.unshift ({selected:false,element:parentNode}); + parentNode = parentNode.parentNode; + } + + this.containerElements.unshift({selected:false,element:parentNode}); + + } + + NJevent('layerBinding',this.container); + } + }, + + + handleBreadCrumbTrail: { + value: function(event) { + var newLength, revaluatedLength, tmpvalue, i=0; + + newLength = this.containerElements.length; + + while(i < newLength ) { + if(this.containerElements[i].selected){ + tmpvalue = i ; + break; + } + + i++; + } + + for(i = newLength -1 ; i >= 1 ; i--) { + if(tmpvalue!==i) { + this.containerElements.pop(); + } else { + break; + } + } + + revaluatedLength = this.containerElements.length; + this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; + + } + } + + +}); diff --git a/js/components/layout/document-bar.reel/document-bar.css b/js/components/layout/document-bar.reel/document-bar.css new file mode 100644 index 00000000..588b8952 --- /dev/null +++ b/js/components/layout/document-bar.reel/document-bar.css @@ -0,0 +1,43 @@ +/* + 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. +
*/ +.documentBar { + height: 25px; + width: 1000px; + position: relative; + overflow: hidden; + color: white; +} + +.documentBar .active { + text-decoration: underline; + cursor: pointer; + color: #666666; +} + +.documentBar .active:hover { + color: #ffffff; +} + +.documentBar .selected { + text-decoration: underline; + cursor: default; + color: #ffffff; +} + +.documentBar .selected { + color: #ffffff; +} + +.documentBar span{ + text-decoration: none; + cursor: default; + color: #3a3a3a; +} + +.documentBar .zoomHotText span { + color: white; +} + diff --git a/js/components/layout/document-bar.reel/document-bar.html b/js/components/layout/document-bar.reel/document-bar.html new file mode 100644 index 00000000..d58f0d14 --- /dev/null +++ b/js/components/layout/document-bar.reel/document-bar.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + +
+ + Design View + Code View +
+ + \ No newline at end of file diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js new file mode 100644 index 00000000..3eece273 --- /dev/null +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -0,0 +1,101 @@ +/* +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.DocumentBar = Montage.create(Component, { + + designView: { value: null, enumerable: false}, + codeView: { value: null, enumerable: false}, + zoomControl: { value: null, enumerable: false }, + _type: { enumerable: false, value: null }, + + type: { + enumerable: false, + get: function() { return this._type; }, + set: function(value) { + if (this._type === value) { + return; + } + + this._type = value; + this.needsDraw = true; + + } + }, + + _currentView: { value: null, enumerable: false }, + + currentView: { + get: function() { return this._currentView}, + set: function(value) { + if (this._currentView === value) { + return; + } + + this._currentView = value; + this.needsDraw = true; + } + }, + + _zoomFactor: { value: 100, enumerable: false }, + + zoomFactor: { + get: function() { return this._zoomFactor; }, + + set: function(value) + { + if(value !== this._zoomFactor) + { + this._zoomFactor = value; + if (!this._firstDraw) + { + var viewUtils = this.application.ninja.stage.viewUtils; + this.application.ninja.stage.setZoom(value); + } + } + } + }, + + draw: { + value: function() { + if(this.type === "htm" || this.type === "html") { + this.designView.classList.add("active"); + this.codeView.classList.add("active"); + + if(this.currentView === "design") { + this.designView.classList.add("selected"); + if(this.codeView.classList.contains("selected")) this.codeView.classList.toggle("selected"); + } else { + this.codeView.classList.add("selected"); + if(this.designView.classList.contains("selected")) this.designView.classList.toggle("selected"); + } + + } else if(this.type) { + this.designView.classList.remove("active"); + } + + } + }, + + prepareForDraw: { + value: function() { + this.designView.addEventListener("click", this, false); + this.codeView.addEventListener("click", this, false); + + } + }, + + handleClick: { + value: function(event) { + if(event._event.target.id === this.currentView) return; + + this.currentView = event._event.target.id; + documentManagerModule.DocumentManager.switchViews(); + } + } +}); diff --git a/js/components/layout/document-entry.reel/close_button.gif b/js/components/layout/document-entry.reel/close_button.gif new file mode 100644 index 00000000..00b5904b Binary files /dev/null and b/js/components/layout/document-entry.reel/close_button.gif differ diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css new file mode 100644 index 00000000..ce173cd6 --- /dev/null +++ b/js/components/layout/document-entry.reel/document-entry.css @@ -0,0 +1,38 @@ +/* + 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. +
*/ + +.documentEntry span +{ + /*display: inline-block;*/ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; /* Causes ... to appear ?? */ + max-width:100px; +} + +.documentEntry img { + opacity: 0.5; /* 50% */ + padding-left: 5px; + width: 12px; + height: 12px; + -webkit-transition: opacity 0.2s ease; + transition: opacity 0.2s ease; +} + +.documentEntry:hover, +.documentEntry:active, +.documentEntry.activeTab { + /*background-color: #7f7f7f; *//* rgb(127, 127, 127); */ +} + +.documentEntry img:hover { + opacity: 1.0; /* 100% */ +} + + +.documentEntry span.dirty:before{ + content: "*"; +} diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html new file mode 100644 index 00000000..ba17449a --- /dev/null +++ b/js/components/layout/document-entry.reel/document-entry.html @@ -0,0 +1,34 @@ + + + + + + + + + +
  • +
    +
    + + +
  • + + \ No newline at end of file diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js new file mode 100644 index 00000000..6f265c91 --- /dev/null +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -0,0 +1,110 @@ +/* +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; + +//var documentManagerModule = ("js/document/documentManager"); + +exports.DocumentEntry = Montage.create(Component, { + + dirty: { value: null }, + + _uuid: { + value: null, + enumerable: false + }, + + _document: { + enumerable: false, + value: null + }, + + document: { + enumerable: false, + get: function() { + return this._document; + }, + set: function(value) { + + if (this._document === value) { + return; + } + + this._document = value; + this._uuid = value.uuid; + //this.needsDraw = true; + } + }, + + _name: { value: null }, + + name: { + enumerable: false, + get: function() { + return this._name; + }, + set: function(value) { + + if (this._name === value) { + return; + } + + this._name = value; + this.needsDraw = true; + } + }, + + _active: { + enumerable: false, + value: null + }, + + active: { + get: function() { + return this._active; + }, + set: function(value) { + var previousValue = this._active; + this._active = value; + + if (previousValue !== this._active) { + this.needsDraw = true; + } + } + }, + + + prepareForDraw: { + enumerable: false, + value: function() { + //this.element.addEventListener("click", this, false); + } + }, + + + draw: { + enumerable: false, + value: function() { + this.label.innerText = this._name ? this._name : ""; + + this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); + } + }, + + handleClick: { + value: function(event) { + if(event._event.target.nodeName === "IMG") { + documentManagerModule.DocumentManager.closeDocument(this._uuid); + } else { + if(!this._document.isActive) { + documentManagerModule.DocumentManager.switchDocument(this._uuid); + } + } + } + } + +}); diff --git a/js/components/layout/documents-tab.reel/documents-tab.css b/js/components/layout/documents-tab.reel/documents-tab.css new file mode 100644 index 00000000..689eb777 --- /dev/null +++ b/js/components/layout/documents-tab.reel/documents-tab.css @@ -0,0 +1,40 @@ +/* + 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. +
    */ + +.documentsTab { + height: 25px; + position: relative; + overflow: hidden; + color: white; +} + +.openDocuments { + float: left; + height: 25px; + width: 100%; + font-size: 12px; + list-style: none; + margin: 0; + padding: 0; + position: relative; + text-decoration: none; +} + +.openDocuments li { + border-right: 1px solid black; + cursor: pointer; + display: inline; + float: left; + padding: 0.5em 1em; + text-shadow: 1px 1px 1px #000000; + vertical-align: middle; +} + +.openDocuments li:hover, +.openDocuments li:active, +.openDocuments li.activeTab { + background-color: #7f7f7f; /* rgb(127, 127, 127); */ +} \ No newline at end of file diff --git a/js/components/layout/documents-tab.reel/documents-tab.html b/js/components/layout/documents-tab.reel/documents-tab.html new file mode 100644 index 00000000..94b2e46e --- /dev/null +++ b/js/components/layout/documents-tab.reel/documents-tab.html @@ -0,0 +1,77 @@ + + + + + + + + + + + + + +
    + +
    + + + diff --git a/js/components/layout/documents-tab.reel/documents-tab.js b/js/components/layout/documents-tab.reel/documents-tab.js new file mode 100644 index 00000000..e874a73c --- /dev/null +++ b/js/components/layout/documents-tab.reel/documents-tab.js @@ -0,0 +1,45 @@ +/* +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; + +var documentManagerModule = require("js/io/document/document-controller"); + +exports.DocumentsTab = Montage.create(Component, { + + openDocuments: { + value: [] + }, + + prepareForDraw: { + enumerable: false, + value: function() { +// console.log("Change this to be inside the Ninja Reel"); + this.openDocuments = documentManagerModule.DocumentController._documents; +// this.eventManager.addEventListener( "appLoaded", this, false); + } + }, + + handleAppLoaded: { + value: function() { +// this.openDocuments = this.application.ninja.currentDocument; + } + }, + + draw: { + enumerable: false, + value: function() { + + } + }, + + handleClick: { + value: function(event) { + + } + } +}); \ No newline at end of file diff --git a/js/components/layout/stage-mode.reel/stage-mode.css b/js/components/layout/stage-mode.reel/stage-mode.css new file mode 100644 index 00000000..28424b9f --- /dev/null +++ b/js/components/layout/stage-mode.reel/stage-mode.css @@ -0,0 +1,24 @@ +/* + 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. +
    */ + +.stageMode { + width:26px; + height:23px; + position:absolute; + top:5px; + right:60px; + + opacity: 0.7; + background-repeat:no-repeat; +} + +.editMode { + background-image: url('../../../../images/optionsbar/edit_mode.png'); +} + +.liveMode { + background-image: url('../../../../images/optionsbar/live_mode.png'); +} \ No newline at end of file diff --git a/js/components/layout/stage-mode.reel/stage-mode.html b/js/components/layout/stage-mode.reel/stage-mode.html new file mode 100644 index 00000000..ab111136 --- /dev/null +++ b/js/components/layout/stage-mode.reel/stage-mode.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + +
    + +
    + + + diff --git a/js/components/layout/stage-mode.reel/stage-mode.js b/js/components/layout/stage-mode.reel/stage-mode.js new file mode 100644 index 00000000..cb42276b --- /dev/null +++ b/js/components/layout/stage-mode.reel/stage-mode.js @@ -0,0 +1,52 @@ +/* +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; + +exports.StageMode = Montage.create(Component, { + + _livePreview: { + value: null + }, + + livePreview: { + get: function() { + return this._livePreview; + }, + set: function(value) { + if(value !== this._livePreview) { + this._livePreview = value; + this.needsDraw = true; + } + } + }, + + prepareForDraw: { + value: function() { + this.element.addEventListener("click", this, false); + } + }, + + draw: { + value: function() { + if(this._livePreview) { + this.element.classList.remove("editMode"); + this.element.classList.add("liveMode"); + + } else { + this.element.classList.remove("liveMode"); + this.element.classList.add("editMode"); + } + } + }, + + handleClick: { + value: function(event) { + this.livePreview = !this.livePreview; + } + } +}); \ No newline at end of file diff --git a/js/components/layout/subtool-button.reel/subtool-button.css b/js/components/layout/subtool-button.reel/subtool-button.css new file mode 100644 index 00000000..cda505b0 --- /dev/null +++ b/js/components/layout/subtool-button.reel/subtool-button.css @@ -0,0 +1,22 @@ +/* + 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. +
    */ + +#topPanel .buttonBackground { + float:left; +} + +.buttonSelected { + background: #B2B2B2; +} + +#toolBarButton { + border: 3px; + float: left; +} + +#toolBarButton:hover { + opacity: 1; +} diff --git a/js/components/layout/subtool-button.reel/subtool-button.html b/js/components/layout/subtool-button.reel/subtool-button.html new file mode 100644 index 00000000..9dad007d --- /dev/null +++ b/js/components/layout/subtool-button.reel/subtool-button.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + +
    +
    +
    + + + diff --git a/js/components/layout/subtool-button.reel/subtool-button.js b/js/components/layout/subtool-button.reel/subtool-button.js new file mode 100644 index 00000000..d1adca43 --- /dev/null +++ b/js/components/layout/subtool-button.reel/subtool-button.js @@ -0,0 +1,65 @@ +/* +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.SubToolButton = Montage.create(Component, { + + button: { value: null }, + + data: { value: null }, + + _selected: { value: null }, + + selected: { + get: function() { return this._selected; }, + set: function(value) { + this._selected = value; + this.needsDraw = true; + } + }, + + prepareForDraw: { + enumerable: false, + value: function() { + this.element.addEventListener("click", this, false); + + this.element.title = this.data.toolTip; + + Object.defineBinding(this, "selected", { + boundObject: this.data, + boundObjectPropertyPath: "selected", + oneway: false + }); + + } + }, + + draw: { + enumerable: false, + value: function() { + if(this._selected) { + this.element.classList.add( "buttonSelected" ); + this.button.classList.remove( this.data.id + "Unpressed" ); + this.button.classList.add( this.data.id + "Pressed" ); + } else { + this.element.classList.remove( "buttonSelected" ); + this.button.classList.remove( this.data.id + "Pressed" ); + this.button.classList.add( this.data.id + "Unpressed" ); + } + } + }, + + handleClick: { + value: function(event) { + if(!this._selected) { + NJevent("selectSubTool", this.data); + } + } + } + +}); diff --git a/js/components/layout/tool-button.reel/tool-button.css b/js/components/layout/tool-button.reel/tool-button.css new file mode 100644 index 00000000..46152424 --- /dev/null +++ b/js/components/layout/tool-button.reel/tool-button.css @@ -0,0 +1,24 @@ +/* + 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. +
    */ + +.buttonBackground { + height: 23px; + width: 26px; + margin: auto; +} + +.buttonSelected { + background: #B2B2B2; +} + +#toolBarButton { + border: 3px; + float: left; +} + +#toolBarButton:hover { + opacity: 1; +} diff --git a/js/components/layout/tool-button.reel/tool-button.html b/js/components/layout/tool-button.reel/tool-button.html new file mode 100644 index 00000000..81a9b927 --- /dev/null +++ b/js/components/layout/tool-button.reel/tool-button.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + +
    +
    +
    + + + diff --git a/js/components/layout/tool-button.reel/tool-button.js b/js/components/layout/tool-button.reel/tool-button.js new file mode 100644 index 00000000..509512d0 --- /dev/null +++ b/js/components/layout/tool-button.reel/tool-button.js @@ -0,0 +1,112 @@ +/* +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; +var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; + + +exports.ToolButton = Montage.create(Component, { + + button: { value: null }, + + data: { value: null }, + + _selected: { value: null }, + + selected: { + get: function() { return this._selected; }, + set: function(value) { + this._selected = value; + this.needsDraw = true; + } + }, + + _subselected: { value: 1 }, + + subselected: { + get: function() { return this._subselected; }, + set: function(value) { + + var len = value.length; + for(var i=0; i < len; i++) { + if(value[i]) { + this._subselected = i; + this.needsDraw = true; + } + } + } + }, + + _currentSubSelected: { value: 0}, + + prepareForDraw: { + enumerable: false, + value: function() { + this.element.title = this.data.toolTip; + this.element.addEventListener("mousedown", this, false); + this.element.addEventListener("dblclick", this, false); + + Object.defineBinding(this, "selected", { + boundObject: this.data, + boundObjectPropertyPath: "selected", + oneway: false + }); + + if(this.data.container) { + this.element.title = this.data.subtools[this._subselected].toolTip; + Object.defineBinding(this, "subselected", { + boundObject: this.data.subtools, + boundObjectPropertyPath: "selected", + oneway: true + }); + } + } + }, + + draw: { + enumerable: false, + value: function() { + var buttonid; + + if(this.data.container) { + buttonid = this.data.subtools[this._subselected].id; + this.element.title = this.data.subtools[this._subselected].toolTip; + this.button.classList.remove( this.data.subtools[this._currentSubSelected].id + "Unpressed" ); + this.button.classList.remove( this.data.subtools[this._currentSubSelected].id + "Pressed" ); + this._currentSubSelected = this._subselected; + } else { + buttonid = this.data.id; + } + + if(this._selected) { + this.element.classList.add( "buttonSelected" ); + this.button.classList.remove( buttonid + "Unpressed" ); + this.button.classList.add( buttonid + "Pressed" ); + } else { + this.element.classList.remove( "buttonSelected" ); + this.button.classList.remove( buttonid + "Pressed" ); + this.button.classList.add( buttonid + "Unpressed" ); + } + } + }, + + handleMousedown: { + value: function(event) { + if(!this._selected) { + NJevent("selectTool", this.data); + } + } + }, + + handleDblclick: { + value: function(event) { + NJevent("toolDoubleClick", this.data); + } + } + + +}); \ No newline at end of file diff --git a/js/components/layout/tools-list.reel/tools-list.css b/js/components/layout/tools-list.reel/tools-list.css new file mode 100644 index 00000000..c58397e2 --- /dev/null +++ b/js/components/layout/tools-list.reel/tools-list.css @@ -0,0 +1,9 @@ +/* + 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. +
    */ + +.toolsList { + padding-top:15px; +} \ No newline at end of file diff --git a/js/components/layout/tools-list.reel/tools-list.html b/js/components/layout/tools-list.reel/tools-list.html new file mode 100644 index 00000000..e12fd59b --- /dev/null +++ b/js/components/layout/tools-list.reel/tools-list.html @@ -0,0 +1,174 @@ + + + + + + + + + + + +
    +
    +
    +
    + +
    +
    +
    + + + + diff --git a/js/components/layout/tools-list.reel/tools-list.js b/js/components/layout/tools-list.reel/tools-list.js new file mode 100644 index 00000000..e26ab391 --- /dev/null +++ b/js/components/layout/tools-list.reel/tools-list.js @@ -0,0 +1,87 @@ +/* +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.ToolsList = Montage.create(Component, { + + SelectionTool: { value: null }, + SubselectionTool: { value: null }, + Rotate3DTool: { value: null }, + Translate3DTool: { value: null }, + TagTool: { value: null }, + PenTool: { value: null }, + TextTool: { value: null }, + ShapeTool: { value: null }, + OvalTool: { value: null }, + RectTool: { value: null }, + LineTool: { value: null }, + PencilTool: { value: null }, + BrushTool: { value: null }, + FillTool: { value: null }, + InkBottleTool: { value: null }, + EyedropperTool: { value: null }, + EraserTool: { value: null }, + RotateStageTool3D: { value: null }, + PanTool: { value: null }, + ZoomTool: { value: null }, + + prepareForDraw: { + enumerable: false, + value: function() { + this.PenTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties;//this.application.Ninja.toolsProperties.penProperties; + + this.SelectionTool.options = this.application.ninja.toolsProperties.selectionProperties; + this.SubselectionTool.options = this.application.ninja.toolsProperties.subSelectionProperties; + + this.Rotate3DTool.options = this.application.ninja.toolsProperties.rotate3DProperties; + this.TagTool.options = this.application.ninja.toolsProperties.tagProperties; + this.PenTool.options = this.application.ninja.toolsProperties.penProperties; + this.TextTool.options = this.application.ninja.toolsProperties.textProperties; + + this.FillTool.options = this.application.ninja.toolsProperties.fillProperties; + this.InkBottleTool.options = this.application.ninja.toolsProperties.inkbottleProperties; + + this.ShapeTool.options = this.application.ninja.toolsProperties.shapeProperties; + this.OvalTool.options = this.application.ninja.toolsProperties.shapeProperties.ovalProperties; + this.RectTool.options = this.application.ninja.toolsProperties.shapeProperties.rectProperties; + this.LineTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties; + this.PencilTool.options = this.application.ninja.toolsProperties.pencilProperties; + this.BrushTool.options = this.application.ninja.toolsProperties.brushProperties; + + this.EyedropperTool.options = this.application.ninja.toolsProperties.eyedropperProperties; + this.EraserTool.options = this.application.ninja.toolsProperties.eraserProperties; + this.RotateStageTool3D.options = this.application.ninja.toolsProperties.rotateStageProperties; + this.PanTool.options = this.application.ninja.toolsProperties.panProperties; + this.ZoomTool.options = this.application.ninja.toolsProperties.zoomProperties; + + } + }, + + action: { + value: function(value, args) { + if(this.application.toolsData.selectedTool.container) { + this[this.application.toolsData.selectedTool.subtools[this.application.toolsData._selectedSubToolIndex].action][value](args); + } else { + this[this.application.toolsData.selectedTool.action][value](args); + } + + } + }, + + prop: { + value: function(value, args) { + if(this.application.toolsData.selectedTool.container) { + return this[this.application.toolsData.selectedTool.subtools[this.application.toolsData._selectedSubToolIndex].action][value]; + } else { + return this[this.application.toolsData.selectedTool.action][value]; + } + + } + } + +}); \ No newline at end of file diff --git a/js/components/layout/tools-properties.reel/tools-properties.css b/js/components/layout/tools-properties.reel/tools-properties.css new file mode 100644 index 00000000..e0ece2e8 --- /dev/null +++ b/js/components/layout/tools-properties.reel/tools-properties.css @@ -0,0 +1,11 @@ +/* + 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. +
    */ + +.toolsProperties { + height: 28px; + margin: 0px; + padding: 2px; +} \ No newline at end of file diff --git a/js/components/layout/tools-properties.reel/tools-properties.html b/js/components/layout/tools-properties.reel/tools-properties.html new file mode 100644 index 00000000..49f2d776 --- /dev/null +++ b/js/components/layout/tools-properties.reel/tools-properties.html @@ -0,0 +1,196 @@ + + + + + + + +