diff options
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/controllers/base-controller.js | 32 | ||||
-rwxr-xr-x | js/document/html-document.js | 538 | ||||
-rwxr-xr-x | js/document/mediators/base-mediator.js | 32 | ||||
-rwxr-xr-x | js/document/models/base-model.js | 32 | ||||
-rwxr-xr-x | js/document/templates/montage-html/default_html.css | 75 | ||||
-rwxr-xr-x | js/document/templates/montage-html/index.html | 50 | ||||
-rw-r--r-- | js/document/templates/montage-html/main.reel/main.js | 54 | ||||
-rwxr-xr-x | js/document/templates/montage-html/package.json | 8 | ||||
-rwxr-xr-x | js/document/templates/montage-html/styles.css | 5 | ||||
-rwxr-xr-x | js/document/text-document.js | 196 | ||||
-rwxr-xr-x | js/document/views/base-view.js | 32 |
11 files changed, 1054 insertions, 0 deletions
diff --git a/js/document/controllers/base-controller.js b/js/document/controllers/base-controller.js new file mode 100755 index 00000000..be441da2 --- /dev/null +++ b/js/document/controllers/base-controller.js | |||
@@ -0,0 +1,32 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | Component = require("montage/ui/component").Component; | ||
11 | //////////////////////////////////////////////////////////////////////// | ||
12 | // | ||
13 | exports.ENTERNAME = Montage.create(Montage, { | ||
14 | //////////////////////////////////////////////////////////////////// | ||
15 | // | ||
16 | hasTemplate: { | ||
17 | enumerable: false, | ||
18 | value: false | ||
19 | }, | ||
20 | //////////////////////////////////////////////////////////////////// | ||
21 | // | ||
22 | deserializedFromTemplate: { | ||
23 | enumerable: false, | ||
24 | value: function () { | ||
25 | // | ||
26 | } | ||
27 | } | ||
28 | //////////////////////////////////////////////////////////////////// | ||
29 | //////////////////////////////////////////////////////////////////// | ||
30 | }); | ||
31 | //////////////////////////////////////////////////////////////////////// | ||
32 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | ||
diff --git a/js/document/html-document.js b/js/document/html-document.js new file mode 100755 index 00000000..9a7755e6 --- /dev/null +++ b/js/document/html-document.js | |||
@@ -0,0 +1,538 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | TextDocument = require("js/document/text-document").TextDocument, | ||
11 | NJUtils = require("js/lib/NJUtils").NJUtils; | ||
12 | //////////////////////////////////////////////////////////////////////// | ||
13 | // | ||
14 | exports.HTMLDocument = Montage.create(TextDocument, { | ||
15 | |||
16 | _selectionExclude: { value: null, enumerable: false }, | ||
17 | _htmlTemplateUrl: { value: "js/document/templates/montage-html/index.html", enumerable: false}, | ||
18 | _iframe: { value: null, enumerable: false }, | ||
19 | _server: { value: null, enumerable: false }, | ||
20 | _templateDocument: { value: null, enumerable: false }, | ||
21 | _selectionModel: { value: [], enumerable: false }, | ||
22 | _undoModel: { value: { "queue" : [], "position" : 0 }, enumerable: false}, | ||
23 | |||
24 | _document: { value: null, enumerable: false }, | ||
25 | _documentRoot: { value: null, enumerable: false }, | ||
26 | _stageBG: { value: null, enumerable: false }, | ||
27 | _window: { value: null, enumerable: false }, | ||
28 | _styles: { value: null, enumerable: false }, | ||
29 | _stylesheets: { value: null, enumerable: false }, | ||
30 | _stageStyleSheetId : { value: 'nj-stage-stylesheet', enumerable: false }, | ||
31 | _userDocument: { value: null, enumerable: false }, | ||
32 | _htmlSource: {value: "<html></html>", enumerable: false}, | ||
33 | _glData: {value: null, enumerable: false }, | ||
34 | _userComponents: { value: {}, enumarable: false}, | ||
35 | |||
36 | _elementCounter: { value: 1, enumerable: false }, | ||
37 | _snapping : { value: true, enumerable: false }, | ||
38 | _layoutMode: { value: "all", enumerable: false }, | ||
39 | _draw3DGrid: { value: false, writable: true }, | ||
40 | _swfObject: { value: false, enumerable: false }, | ||
41 | |||
42 | _zoomFactor: { value: 100, enumerable: false }, | ||
43 | |||
44 | cssLoadInterval: { value: null, enumerable: false }, | ||
45 | |||
46 | _savedLeftScroll: {value:null}, | ||
47 | _savedTopScroll: {value:null}, | ||
48 | |||
49 | _codeViewDocument:{ | ||
50 | writable: true, | ||
51 | enumerable: true, | ||
52 | value:null | ||
53 | }, | ||
54 | |||
55 | |||
56 | |||
57 | // GETTERS / SETTERS | ||
58 | |||
59 | codeViewDocument:{ | ||
60 | get: function() { return this._codeViewDocument; }, | ||
61 | set: function(value) { this._codeViewDocument = value} | ||
62 | }, | ||
63 | |||
64 | savedLeftScroll:{ | ||
65 | get: function() { return this._savedLeftScroll; }, | ||
66 | set: function(value) { this._savedLeftScroll = value} | ||
67 | }, | ||
68 | |||
69 | savedTopScroll:{ | ||
70 | get: function() { return this._savedTopScroll; }, | ||
71 | set: function(value) { this._savedTopScroll = value} | ||
72 | }, | ||
73 | |||
74 | selectionExclude: { | ||
75 | get: function() { return this._selectionExclude; }, | ||
76 | set: function(value) { this._selectionExclude = value; } | ||
77 | }, | ||
78 | |||
79 | iframe: { | ||
80 | get: function() { return this._iframe; }, | ||
81 | set: function(value) { this._iframe = value; } | ||
82 | }, | ||
83 | |||
84 | server: { | ||
85 | get: function() { return this._server; }, | ||
86 | set: function(value) { this._server = value; } | ||
87 | }, | ||
88 | |||
89 | selectionModel: { | ||
90 | get: function() { return this._selectionModel; }, | ||
91 | set: function(value) { this._selectionModel = value; } | ||
92 | }, | ||
93 | |||
94 | undoModel: { | ||
95 | get: function() { return this._undoModel; }, | ||
96 | set: function(value) { this._undoModel.queue = value.queue; this._undoModel.position = value.position; } | ||
97 | }, | ||
98 | |||
99 | documentRoot: { | ||
100 | get: function() { return this._documentRoot; }, | ||
101 | set: function(value) { this._documentRoot = value; } | ||
102 | }, | ||
103 | |||
104 | stageBG: { | ||
105 | get: function() { return this._stageBG; }, | ||
106 | set: function(value) { this._stageBG = value; } | ||
107 | }, | ||
108 | |||
109 | elementCounter: { | ||
110 | set: function(value) { this._elementCounter = value; }, | ||
111 | get: function() { return this._elementCounter; } | ||
112 | }, | ||
113 | |||
114 | snapping: { | ||
115 | get: function() { return this._snapping; }, | ||
116 | set: function(value) { | ||
117 | if(this._snapping !== value) { | ||
118 | this._snapping = value; | ||
119 | } | ||
120 | } | ||
121 | }, | ||
122 | |||
123 | // TODO SEND THE EVENT --> Redraw the desired layout | ||
124 | layoutMode: { | ||
125 | get: function() { return this._layoutMode; }, | ||
126 | set: function(mode) { this._layoutMode = mode; } | ||
127 | }, | ||
128 | |||
129 | draw3DGrid: { | ||
130 | get: function() { return this._draw3DGrid; }, | ||
131 | set: function(value) { | ||
132 | if(this._draw3DGrid !== value) { | ||
133 | this._draw3DGrid = value; | ||
134 | } | ||
135 | } | ||
136 | }, | ||
137 | |||
138 | userComponents: { | ||
139 | get: function() { | ||
140 | return this._userComponents; | ||
141 | } | ||
142 | }, | ||
143 | // _drawUserComponentsOnOpen:{ | ||
144 | // value:function(){ | ||
145 | // for(var i in this._userComponentSet){ | ||
146 | // console.log(this._userComponentSet[i].control) | ||
147 | // this._userComponentSet[i].control.needsDraw = true; | ||
148 | // } | ||
149 | // } | ||
150 | // }, | ||
151 | |||
152 | glData: { | ||
153 | get: function() | ||
154 | { | ||
155 | var elt = this.iframe; | ||
156 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); | ||
157 | this._glData = null; | ||
158 | if (elt) | ||
159 | { | ||
160 | this._glData = new Array(); | ||
161 | this.collectGLData( elt, this._glData ); | ||
162 | } | ||
163 | |||
164 | return this._glData | ||
165 | }, | ||
166 | |||
167 | set: function(value) | ||
168 | { | ||
169 | var nWorlds = value.length; | ||
170 | for (var i=0; i<nWorlds; i++) | ||
171 | { | ||
172 | var importStr = value[i]; | ||
173 | var startIndex = importStr.indexOf( "id: " ); | ||
174 | if (startIndex >= 0) | ||
175 | { | ||
176 | var endIndex = importStr.indexOf( "\n", startIndex ); | ||
177 | if (endIndex > 0) | ||
178 | { | ||
179 | var id = importStr.substring( startIndex+4, endIndex ); | ||
180 | var canvas = this.iframe.contentWindow.document.getElementById( id ); | ||
181 | if (canvas) | ||
182 | { | ||
183 | if (!canvas.elementModel) | ||
184 | { | ||
185 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); | ||