aboutsummaryrefslogtreecommitdiff
path: root/js/document/html-document.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-24 00:07:23 -0700
committerJose Antonio Marquez2012-05-24 00:07:23 -0700
commit5914c5b2209c4b8daac4249bb76cda5c9314c4e6 (patch)
treef0910e57f64d1638f00bf7f6449d479fb377bfac /js/document/html-document.js
parent16decc5726eafbb25675c61be6df85a378ac1fac (diff)
downloadninja-5914c5b2209c4b8daac4249bb76cda5c9314c4e6.tar.gz
Cleaning up referencing to 'documentRoot' and '_document'
Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view.
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-xjs/document/html-document.js874
1 files changed, 0 insertions, 874 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
deleted file mode 100755
index 447d90e3..00000000
--- a/js/document/html-document.js
+++ /dev/null
@@ -1,874 +0,0 @@
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
86 // GETTERS / SETTERS
87
88 codeViewDocument:{
89 get: function() { return this._codeViewDocument; },
90 set: function(value) { this._codeViewDocument = value}
91 },
92
93 savedLeftScroll:{
94 get: function() { return this._savedLeftScroll; },
95 set: function(value) { this._savedLeftScroll = value}
96 },
97
98 savedTopScroll:{
99 get: function() { return this._savedTopScroll; },
100 set: function(value) { this._savedTopScroll = value}
101 },
102
103 gridHorizontalSpacing:{
104 get: function() { return this._gridHorizontalSpacing; },
105 set: function(value) { this._gridHorizontalSpacing = value}
106 },
107
108 gridVerticalSpacing:{
109 get: function() { return this._gridVerticalSpacing; },
110 set: function(value) { this._gridVerticalSpacing = value}
111 },
112
113 selectionExclude: {
114 get: function() { return this._selectionExclude; },
115 set: function(value) { this._selectionExclude = value; }
116 },
117
118 iframe: {
119 get: function() { return this._iframe; },
120 set: function(value) { this._iframe = value; }
121 },
122
123 server: {
124 get: function() { return this._server; },
125 set: function(value) { this._server = value; }
126 },
127
128 selectionModel: {
129 get: function() { return this._selectionModel; },
130 set: function(value) { this._selectionModel = value; }
131 },
132
133 undoModel: {
134 get: function() { return this._undoModel; },
135 set: function(value) { this._undoModel.queue = value.queue; this._undoModel.position = value.position; }
136 },
137
138 documentRoot: {
139 get: function() { return this._documentRoot; },
140 set: function(value) { this._documentRoot = value; }
141 },
142
143 stageBG: {
144 get: function() { return this._stageBG; },
145 set: function(value) { this._stageBG = value; }
146 },
147
148 elementCounter: {
149 set: function(value) { this._elementCounter = value; },
150 get: function() { return this._elementCounter; }
151 },
152
153 snapping: {
154 get: function() { return this._snapping; },
155 set: function(value) {
156 if(this._snapping !== value) {
157 this._snapping = value;
158 }
159 }
160 },
161
162 // TODO SEND THE EVENT --> Redraw the desired layout
163 layoutMode: {
164 get: function() { return this._layoutMode; },
165 set: function(mode) { this._layoutMode = mode; }
166 },
167
168 draw3DGrid: {
169 get: function() { return this._draw3DGrid; },
170 set: function(value) {
171 if(this._draw3DGrid !== value) {
172 this._draw3DGrid = value;
173 }
174 }
175 },
176
177 userComponents: {
178 get: function() {
179 return this._userComponents;
180 }
181 },
182// _drawUserComponentsOnOpen:{
183// value:function(){
184// for(var i in this._userComponentSet){
185// console.log(this._userComponentSet[i].control)
186// this._userComponentSet[i].control.needsDraw = true;
187// }
188// }
189// },
190
191 glData: {
192 get: function() {
193 //
194 var elt = this.iframe.contentWindow.document.getElementById("UserContent");
195 //
196 if (elt) {
197 var matLib = MaterialsModel.exportMaterials();
198 this._glData = [matLib];
199 this.collectGLData(elt, this._glData );
200 } else {
201 this._glData = null
202 }
203 //
204 return this._glData;
205 },
206 set: function(value) {
207 var elt = this.documentRoot;
208 if (elt)
209 {
210 /*
211 // Use this code to test the runtime version of WebGL
212 var cvsDataMngr = Object.create(NinjaCvsRt.CanvasDataManager, {});
213 cvsDataMngr.loadGLData(elt, value);
214 */
215
216 // /*
217 var nWorlds= value.length;
218 for (var i=0; i<nWorlds; i++)
219 {
220 // get the data for the next canvas
221 var importStr = value[i];
222
223 // determine if it is the new (JSON) or old style format
224 var id = null;
225 var jObj = null;
226 var index = importStr.indexOf( ';' );
227 if ((importStr[0] === 'v') && (index < 24))
228 {
229 // JSON format. pull off the
230 importStr = importStr.substr( index+1 );
231 jObj = JSON.parse( importStr );
232 id = jObj.id;
233 }
234 else
235 {