aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js22
-rwxr-xr-xjs/document/document-text.js52
-rwxr-xr-xjs/document/html-document.js4
-rwxr-xr-xjs/document/models/base.js2
-rwxr-xr-xjs/document/models/html.js5
-rwxr-xr-xjs/document/models/text.js57
-rwxr-xr-xjs/document/views/base.js2
-rwxr-xr-xjs/document/views/code.js152
-rwxr-xr-xjs/document/views/design.js13
9 files changed, 286 insertions, 23 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 983da966..f92a425c 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -125,9 +125,10 @@ exports.HtmlDocument = Montage.create(Component, {
125 // 125 //
126 closeDocument: { 126 closeDocument: {
127 value: function (context, callback) { 127 value: function (context, callback) {
128 //Closing document and getting outcome
128 var closed = this.model.close(null); 129 var closed = this.model.close(null);
129 130 //Making callback if specified
130 callback.call(context, this); 131 if (callback) callback.call(context, this);
131 } 132 }
132 }, 133 },
133 //////////////////////////////////////////////////////////////////// 134 ////////////////////////////////////////////////////////////////////
@@ -139,23 +140,25 @@ exports.HtmlDocument = Montage.create(Component, {
139 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; 140 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
140 141
141 // Serialize the current scroll position 142 // Serialize the current scroll position
143 //TODO: Move these properties to the design view class
142 this.model.scrollLeft = this.application.ninja.stage._scrollLeft; 144 this.model.scrollLeft = this.application.ninja.stage._scrollLeft;
143 this.model.scrollTop = this.application.ninja.stage._scrollTop; 145 this.model.scrollTop = this.application.ninja.stage._scrollTop;
144 this.model.userContentLeft = this.application.ninja.stage._userContentLeft; 146 this.model.userContentLeft = this.application.ninja.stage._userContentLeft;
145 this.model.userContentTop = this.application.ninja.stage._userContentTop; 147 this.model.userContentTop = this.application.ninja.stage._userContentTop;
146 148
147 149
148 // Serialize the selection 150 // Serialize the selection, the container and grid
151 //TODO: Move this property to the design view class
149 this.model.selection = this.application.ninja.selectedElements.slice(0); 152 this.model.selection = this.application.ninja.selectedElements.slice(0);
153 this.model.selectionContainer = this.application.ninja.currentSelectedContainer;
150 this.draw3DGrid = this.application.ninja.appModel.show3dGrid; 154 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
151 155
152 // Serialize the undo 156 // Serialize the undo
153 // TODO: Save the montage undo queue 157 // TODO: Save the montage undo queue
154 158
155 // Pause the videos 159 // Pause the videos
160 //TODO: Move these to be handled on the show/hide methods in the view
156 this.model.views.design.pauseVideos(); 161 this.model.views.design.pauseVideos();
157
158 this.model.isActive = false;
159 } 162 }
160 }, 163 },
161 //////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////
@@ -167,18 +170,21 @@ exports.HtmlDocument = Montage.create(Component, {
167 //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; 170 //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
168 171
169 // Deserialize the current scroll position 172 // Deserialize the current scroll position
173 //TODO: Move these properties to the design view class
170 this.application.ninja.stage._scrollLeft = this.model.scrollLeft; 174 this.application.ninja.stage._scrollLeft = this.model.scrollLeft;
171 this.application.ninja.stage._scrollTop = this.model.scrollTop; 175 this.application.ninja.stage._scrollTop = this.model.scrollTop;
172 this.application.ninja.stage._userContentLeft = this.model.userContentLeft; 176 this.application.ninja.stage._userContentLeft = this.model.userContentLeft;
173 this.application.ninja.stage._userContentTop = this.model.userContentTop; 177 this.application.ninja.stage._userContentTop = this.model.userContentTop;
174 178
179 //TODO: Move this property to the design view class
175 this.application.ninja.selectedElements = this.model.selection.slice(0); 180 this.application.ninja.selectedElements = this.model.selection.slice(0);
176 181// this.application.ninja.currentSelectedContainer = this.model.selectionContainer;
177 this.application.ninja.appModel.show3dGrid = this.draw3DGrid; 182 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
178 183
179 // Serialize the undo 184 // Serialize the undo
180 // TODO: Save the montage undo queue 185 // TODO: Save the montage undo queue
181 186
187 //TODO: Move this to the document controller
182 this.model.isActive = true; 188 this.model.isActive = true;
183 } 189 }
184 } 190 }
diff --git a/js/document/document-text.js b/js/document/document-text.js
index 2a469144..bb63f5f8 100755
--- a/js/document/document-text.js
+++ b/js/document/document-text.js
@@ -7,7 +7,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component; 10 Component = require("montage/ui/component").Component,
11 TextDocumentModel = require("js/document/models/text").TextDocumentModel,
12 CodeDocumentView = require("js/document/views/code").CodeDocumentView;
11//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
12// 14//
13exports.TextDocument = Montage.create(Component, { 15exports.TextDocument = Montage.create(Component, {
@@ -16,9 +18,53 @@ exports.TextDocument = Montage.create(Component, {
16 hasTemplate: { 18 hasTemplate: {
17 enumerable: false, 19 enumerable: false,
18 value: false 20 value: false
19 } 21 },
20 ////////////////////////////////////////////////////////////////////
21 //////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////
23 //
24 model: {
25 value: null
26 },
27 ////////////////////////////////////////////////////////////////////
28 //
29
30 init:{
31 enumerable: false,
32 value : function(file, context, callback, view){
33 var codeDocumentView = CodeDocumentView.create(), container = null;
34
35 //Creating instance of Text Document Model
36 this.model = Montage.create(TextDocumentModel,{
37 file: {value: file},
38 parentContainer: {value: document.getElementById("codeViewContainer")},
39 views: {value: {'code': codeDocumentView, 'design': null}}
40 });
41
42 codeDocumentView.initialize(this.model.parentContainer);
43
44 codeDocumentView.textArea.value = file.content;
45 codeDocumentView.initializeTextView(file, this);
46
47 if (view === 'code') {
48 //TODO: Remove reference and use as part of model
49 this.currentView = 'code';
50 //Setting current view object to design
51 this.model.currentView = this.model.views.code;
52 }
53
54
55 callback.call(context, this);
56 }
57 },
58////////////////////////////////////////////////////////////////////
59 //
60 closeDocument: {
61 value: function (context, callback) {
62 var closed = this.model.close(null);
63
64 callback.call(context, this);
65 }
66 }
67////////////////////////////////////////////////////////////////////
22}); 68});
23//////////////////////////////////////////////////////////////////////// 69////////////////////////////////////////////////////////////////////////
24//////////////////////////////////////////////////////////////////////// \ No newline at end of file 70//////////////////////////////////////////////////////////////////////// \ No newline at end of file
diff --git a/js/document/html-document.js b/js/document/html-document.js
index bcf2b5c2..447d90e3 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -209,8 +209,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
209 { 209 {
210 /* 210 /*
211 // Use this code to test the runtime version of WebGL 211 // Use this code to test the runtime version of WebGL
212 var cdm = new NinjaCvsRt.CanvasDataManager(); 212 var cvsDataMngr = Object.create(NinjaCvsRt.CanvasDataManager, {});
213 cdm.loadGLData(elt, value, null ); 213 cvsDataMngr.loadGLData(elt, value);
214 */ 214 */
215 215
216 // /* 216 // /*
diff --git a/js/document/models/base.js b/js/document/models/base.js
index c99e36c7..6d9d2e89 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -100,7 +100,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
100 } 100 }
101 break; 101 break;
102 default: 102 default:
103 if (this.template.type === 'banner' || this.template.type === 'animation') { 103 if (this.template && (this.template.type === 'banner' || this.template.type === 'animation')) {
104 window.open('/js/document/templates/preview/banner.html?width='+this.template.size.width+'&height='+this.template.size.height+'&url='+this.url); 104 window.open('/js/document/templates/preview/banner.html?width='+this.template.size.width+'&height='+this.template.size.height+'&url='+this.url);
105 } else { 105 } else {
106 window.open(this.url); 106 window.open(this.url);
diff --git a/js/document/models/html.js b/js/document/models/html.js
index a97b4b5a..9cc8ce92 100755
--- a/js/document/models/html.js
+++ b/js/document/models/html.js
@@ -22,6 +22,11 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, {
22 selection: { 22 selection: {
23 value: [] 23 value: []
24 }, 24 },
25 ////////////////////////////////////////////////////////////////////
26 //
27 selectionContainer: {
28 value: []
29 },
25 //////////////////////////////////////////////////////////////////// 30 ////////////////////////////////////////////////////////////////////
26 // 31 //
27 draw3DGrid: { 32 draw3DGrid: {
diff --git a/js/document/models/text.js b/js/document/models/text.js
index ebf9993e..d1252b7d 100755
--- a/js/document/models/text.js
+++ b/js/document/models/text.js
@@ -7,7 +7,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 BaseDocumentModel = require("js/document/models/text").BaseDocumentModel; 10 BaseDocumentModel = require("js/document/models/base").BaseDocumentModel;
11//////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////
12//