aboutsummaryrefslogtreecommitdiff
path: root/js/document/_toDelete
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/_toDelete')
-rwxr-xr-xjs/document/_toDelete/html-document.js873
1 files changed, 873 insertions, 0 deletions
diff --git a/js/document/_toDelete/html-document.js b/js/document/_toDelete/html-document.js
new file mode 100755
index 00000000..1bb643ac
--- /dev/null
+++ b/js/document/_toDelete/html-document.js
@@ -0,0 +1,873 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7////////////////////////////////////////////////////////////////////////
8//
9var Montage = require("montage/core/core").Montage,
10 TextDocument = require("js/document/text-document").TextDocument,
11 NJUtils = require("js/lib/NJUtils").NJUtils,
12 GLWorld = require("js/lib/drawing/world").World,
13 MaterialsModel = require("js/models/materials-model").MaterialsModel;
14////////////////////////////////////////////////////////////////////////
15//
16exports.HTMLDocument = Montage.create(TextDocument, {
17
18 _selectionExclude: { value: null, enumerable: false },
19 _htmlTemplateUrl: { value: "js/document/templates/montage-html/index.html", enumerable: false},
20 _iframe: { value: null, enumerable: false },
21 _server: { value: null, enumerable: false },
22 _templateDocument: { value: null, enumerable: false },
23 _selectionModel: { value: [], enumerable: false },
24 _undoModel: { value: { "queue" : [], "position" : 0 }, enumerable: false},
25
26 _document: { value: null, enumerable: false },
27 _documentRoot: { value: null, enumerable: false },
28 _liveNodeList: { value: null, enumarable: false },
29 _stageBG: { value: null, enumerable: false },
30 _window: { value: null, enumerable: false },
31 _styles: { value: null, enumerable: false },
32 _stylesheets: { value: null, enumerable: false },
33 _stageStyleSheetId : { value: 'nj-stage-stylesheet', enumerable: false },
34 _userDocument: { value: null, enumerable: false },
35 _htmlSource: {value: "<html></html>", enumerable: false},
36 _glData: {value: null, enumerable: false },
37 _userComponents: { value: {}, enumarable: false},
38
39 _elementCounter: { value: 1, enumerable: false },
40 _snapping : { value: true, enumerable: false },
41 _layoutMode: { value: "all", enumerable: false },
42 _draw3DGrid: { value: false, writable: true },
43 _swfObject: { value: false, enumerable: false },
44
45 _zoomFactor: { value: 100, enumerable: false },
46
47 cssLoadInterval: { value: null, enumerable: false },
48
49 _savedLeftScroll: {value:null},
50 _savedTopScroll: {value:null},
51
52 _codeViewDocument:{
53 writable: true,
54 enumerable: true,
55 value:null
56 },
57
58
59 //drawUtils state
60 _gridHorizontalSpacing: {value:0},
61 _gridVerticalSpacing: {value:0},
62 //end - drawUtils state
63
64 _undoStack: { value: [] },
65 undoStack: {
66 get: function() {
67 return this._undoStack;
68 },
69 set:function(value){
70 this._undoStack = value;
71 }
72 },
73
74 _redoStack: { value: [], enumerable: false },
75
76 redoStack: {
77 get: function() {
78 return this._redoStack;
79 },
80 set:function(value){
81 this._redoStack = value;
82 }
83 },
84
85 // GETTERS / SETTERS
86
87 codeViewDocument:{
88 get: function() { return this._codeViewDocument; },
89 set: function(value) { this._codeViewDocument = value}
90 },
91
92 savedLeftScroll:{
93 get: function() { return this._savedLeftScroll; },
94 set: function(value) { this._savedLeftScroll = value}
95 },
96
97 savedTopScroll:{
98 get: function() { return this._savedTopScroll; },
99 set: function(value) { this._savedTopScroll = value}
100 },
101
102 gridHorizontalSpacing:{
103 get: function() { return this._gridHorizontalSpacing; },
104 set: function(value) { this._gridHorizontalSpacing = value}
105 },
106
107 gridVerticalSpacing:{
108 get: function() { return this._gridVerticalSpacing; },
109 set: function(value) { this._gridVerticalSpacing = value}
110 },
111
112 selectionExclude: {
113 get: function() { return this._selectionExclude; },
114 set: function(value) { this._selectionExclude = value; }
115 },
116
117 iframe: {
118 get: function() { return this._iframe; },
119 set: function(value) { this._iframe = value; }
120 },
121
122 server: {
123 get: function() { return this._server; },
124 set: function(value) { this._server = value; }
125 },
126
127 selectionModel: {
128 get: function() { return this._selectionModel; },
129 set: function(value) { this._selectionModel = value; }
130 },
131
132 undoModel: {
133 get: function() { return this._undoModel; },
134 set: function(value) { this._undoModel.queue = value.queue; this._undoModel.position = value.position; }
135 },
136
137 documentRoot: {
138 get: function() { return this._documentRoot; },
139 set: function(value) { this._documentRoot = value; }
140 },
141
142 stageBG: {
143 get: function() { return this._stageBG; },
144 set: function(value) { this._stageBG = value; }
145 },
146
147 elementCounter: {
148 set: function(value) { this._elementCounter = value; },
149 get: function() { return this._elementCounter; }
150 },
151
152 snapping: {
153 get: function() { return this._snapping; },
154 set: function(value) {
155 if(this._snapping !== value) {
156 this._snapping = value;
157 }
158 }
159 },
160
161 // TODO SEND THE EVENT --> Redraw the desired layout
162 layoutMode: {
163 get: function() { return this._layoutMode; },
164 set: function(mode) { this._layoutMode = mode; }
165 },
166
167 draw3DGrid: {
168 get: function() { return this._draw3DGrid; },
169 set: function(value) {
170 if(this._draw3DGrid !== value) {
171 this._draw3DGrid = value;
172 }
173 }
174 },
175
176 userComponents: {
177 get: function() {
178 return this._userComponents;
179 }
180 },
181// _drawUserComponentsOnOpen:{
182// value:function(){
183// for(var i in this._userComponentSet){
184// console.log(this._userComponentSet[i].control)
185// this._userComponentSet[i].control.needsDraw = true;
186// }
187// }
188// },
189
190 glData: {
191 get: function() {
192 //
193 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
194 //
195 if (elt) {
196 var matLib = MaterialsModel.exportMaterials();
197 this._glData = [matLib];
198 this.collectGLData(elt, this._glData );
199 } else {
200 this._glData = null
201 }
202 //
203 return this._glData;
204 },
205 set: function(value) {
206 var elt = this.documentRoot;
207 if (elt)
208 {
209 /*
210 // Use this code to test the runtime version of WebGL
211 var cvsDataMngr = Object.create(NinjaCvsRt.CanvasDataManager, {});
212 cvsDataMngr.loadGLData(elt, value);
213 */
214
215 // /*
216 var nWorlds= value.length;
217 for (var i=0; i<nWorlds; i++)
218 {
219 // get the data for the next canvas
220 var importStr = value[i];
221
222 // determine if it is the new (JSON) or old style format
223 var id = null;
224 var jObj = null;
225 var index = importStr.indexOf( ';' );
226 if ((importStr[0] === 'v') && (index < 24))
227 {
228 // JSON format. pull off the
229 importStr = importStr.substr( index+1 );
230 jObj = JSON.parse( importStr );
231 id = jObj.id;