-
Notifications
You must be signed in to change notification settings - Fork 4
/
TriCloud.mxml
437 lines (313 loc) · 11.5 KB
/
TriCloud.mxml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" xmlns:assets="assets.*" xmlns:controllers="controllers.*"
xmlns:panels="panels.*" xmlns:leftPanels="panels.left.*" xmlns:rightPanels="panels.right.*"
xmlns:centerPanels="panels.center.*" xmlns:library="library.*" xmlns:cloudPanels="panels.*"
usePreloader="true" preloader="TriCloudLoader"
width="100%" height="100%"
layout="vertical"
autoLayout="true"
currentState="cloudDesign"
frameRate="60"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
backgroundColor="0xFFFFFF"
initialize="onInitialize()"
creationComplete="onCreationComplete()"
rollOver="onRollOverApp(event)"
rollOut="onRollOutApp(event)"
keyDown="onKeyDown(event)">
<mx:Script>
<![CDATA[
import flash.profiler.profile;
import mx.containers.Canvas;
import mx.containers.Panel;
import mx.controls.Alert;
import mx.core.UIComponent;
import mx.events.DividerEvent;
import mx.events.TweenEvent;
import mx.binding.utils.*;
import mx.managers.CursorManager;
import mx.managers.SystemManager;
import mx.managers.PopUpManager;
import bridge.FABridge;
import core.CanvasController;
import core.CloudController;
import RightClickMenu;
import CloudEngine;
import assets.*;
import library.CloudLibraryBrowseEvent;
private function onInitialize():void
{
// profiler
//flash.profiler.profile(true);
//flash.profiler.heapDump
// Alert Styles
}
private function onCreationComplete():void
{
CloudEngine.GetInstance(); // Create the cloud Engine
centerPanel.init(); // Create center panel before side panels
leftPanel.init();
rightPanel.init();
// Set the Right Click menu for the TriCloud Editor
var rightClickMenu:RightClickMenu = new RightClickMenu("TriCloud");
this.contextMenu = rightClickMenu.triCloudContextMenu;
//this.stage.showDefaultContextMenu = false;
//this.stage.contextMenu = rightClickMenu.triCloudContextMenu;
//http://www.morearty.com/blog/2006/07/17/flex-tip-a-higher-frame-rate-even-makes-text-entry-look-better/
BindingUtils.bindSetter(onFrameRateChange, this.stage, 'frameRate');
// Events from Design view to open the CloudLibrary to browse for...
this.addEventListener('browseCloudLibrary', onBrowseCloudLibrary);
}
// Open Cloud Library to Browse/Search for....
private function onBrowseCloudLibrary(event:CloudLibraryBrowseEvent):void
{
this.setCurrentState('cloudLibrary');
var browseEvent:CloudLibraryBrowseEvent =
new CloudLibraryBrowseEvent("browse", '', event.sortBy, event.itemType);
leftPanel.cloudLibraryPanel.cloudLibraryBrowser.browseString = event.sortBy;
leftPanel.cloudLibraryPanel.cloudLibraryBrowser.itemType = event.itemType;
leftPanel.cloudLibraryPanel.cloudLibraryBrowser.dispatchEvent(browseEvent);
}
private function onRollOverApp(event:MouseEvent):void
{
//CursorManager.showCursor();
}
private function onRollOutApp(event:MouseEvent):void
{
//CursorManager.hideCursor();
}
private function onFrameRateChange(fps:Number):void
{
//frameRateLabel.text = fps.toString();//
}
private function onDividerDrag(event:DividerEvent):void
{
if(this.currentState == "cloudLibrary") // draging center/right and current state = cloudLibrary
{
//mainHDivider.moveDivider((event.dividerIndex == 0)?1:0, mainHDivider.getDividerAt(event.dividerIndex));
}
}
private var oldDivider0X:uint = 0;
private var oldDivider1X:uint = 0;
private function onDoubleClickDivider(event:MouseEvent):void
{
//fudged way to know which divider was double clicked
if(event.stageX >= mainHDivider.getDividerAt(0).x &&
event.stageX < mainHDivider.getDividerAt(0).x + 16)
{
if(mainHDivider.getDividerAt(0).x <= 10) // expand divider 0
{
mainHDivider.moveDivider(0, oldDivider0X);
return;
}
oldDivider0X = mainHDivider.getDividerAt(0).x;
// collapse divider 0
mainHDivider.moveDivider(0, -mainHDivider.getDividerAt(0).x);
}
else if(event.stageX >= mainHDivider.getDividerAt(1).x &&
event.stageX < mainHDivider.getDividerAt(1).x + 16)
{
if(mainHDivider.getDividerAt(1).x >= (this.width - 32)) // expand divider 1
{
mainHDivider.moveDivider(1, oldDivider1X);
return;
}
oldDivider1X = mainHDivider.getDividerAt(1).x;
// collapse divider 1
mainHDivider.moveDivider(1, mainHDivider.getDividerAt(1).x + mainHDivider.getDividerAt(1).width);
}
}
private var oldLeftPaneWidth:int;
private var oldRightPaneWidth:int;
// My Clouds -> Cloud Library
private function onEnterStateCL():void
{
oldLeftPaneWidth = leftPanel.width;
oldRightPaneWidth = rightPanel.width;
mainHDivider.moveDivider(0, (rightPanel.x - 18) - mainHDivider.getDividerAt(0).x);
leftPanel.leftViewStack.selectedIndex = 1;
rightPanel.rightViewStack.selectedIndex = 1;
CloudCursor.SetCursor(CloudCursor.NORMAL); // normal cursor
CloudDialogManager.HideAllDialog(); // Restore hidden dialogs
}
private function onTweenUpdateToCloudLibrary(event:TweenEvent):void
{
mainHDivider.moveDivider(0, 1);
}
// Cloud Library -> My Clouds
private function onExitStateCL():void
{
// todo : animate this
mainHDivider.moveDivider(0, -leftPanel.width + oldLeftPaneWidth);
leftPanel.leftViewStack.selectedIndex = 0;
rightPanel.rightViewStack.selectedIndex = 0;
rightPanel.width = oldRightPaneWidth;
CloudCursor.SetCursor(CloudCursor.NORMAL); // normal cursor
CloudDialogManager.ShowAllDialog(); // Restore hidden dialogs
}
[Bindable]
private var timerVal:Number = 0;
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
//timerVal = getTimer();
}
private function onKeyDown(event:KeyboardEvent):void
{
if(event.ctrlKey)
{
}
}
private function onStageKeyDown(event:KeyboardEvent):void
{
if(event.ctrlKey)
{
}
}
]]>
</mx:Script>
<bridge:FABridge xmlns:bridge="bridge.*" id="bridgeInst" />
<assets:AssetList/>
<mx:HDividedBox id="mainHDivider" liveDragging="true"
width="100%" height="100%"
doubleClickEnabled="true"
dividerColor="0xFFFFFF" dividerAlpha="1.0"
doubleClick="onDoubleClickDivider(event)"
dividerDrag="onDividerDrag(event)">
<leftPanels:LeftPanel id="leftPanel" width="22%" height="100%" metaCloudPanel="{rightPanel.metaCloudPanel}"/>
<centerPanels:CenterPanel id="centerPanel" width="55%" height="100%"/>
<rightPanels:RightPanel id="rightPanel" width="23%" height="100%"/>
</mx:HDividedBox>
<!--mx:Label id="fps" text="{timerVal}" includeInLayout="true" /-->
<mx:states>
<mx:State name="initialization">
</mx:State>
<mx:State name="cloudDesign">
<mx:SetProperty target="{centerPanel}" name="visible" value="true"/>
</mx:State>
<mx:State name="cloudLibrary" enterState="onEnterStateCL()" exitState="onExitStateCL()">
<mx:SetProperty target="{centerPanel}" name="visible" value="false"/>
</mx:State>
<mx:State name="desinitialization">
</mx:State>
</mx:states>
<mx:transitions>
<mx:Transition fromState="cloudDesign" toState="cloudLibrary">
<!--mx:Parallel suspendBackgroundProcessing="true">
<mx:Resize target="{leftPanel}" widthFrom="{leftPanel.width}" widthTo="{rightPanel.x - leftPanel.width}" duration="250" />
</mx:Parallel-->
</mx:Transition>
<mx:Transition fromState="cloudLibrary" toState="cloudDesign">
<!--mx:Parallel suspendBackgroundProcessing="true">
<mx:Resize target="{leftPanel}" widthFrom="{leftPanel.width}" widthTo="{oldLeftPaneWidth}" duration="250" />
</mx:Parallel-->
</mx:Transition>
</mx:transitions>
<mx:Style>
Application
{
backgroundColor: #FFFFFF;
backgroundGradientColors: #FFFFFF, #FFFFFF;
backgroundGradientAlphas: 1.0, 1.0;
paddingLeft: 10; paddingTop: 10; paddingRight: 10; paddingBottom: 10;
themeColor: #99ff00;
}
LinkButton
{
color: blue;
paddingLeft: 0; paddingRight: 0;
textDecoration: normal;
}
ScrollBar
{
track-colors: #ffffff, #ffffff;
fill-colors: #ffffff, #ffffff;
}
/* TriCloud Main Panel (left, center, right) */
.CloudPanel
{
background-color: #EFEFEF; background-alpha: 1.0;
horizontalAlign: left; verticalAlign: top;
horizontalGap:5; verticalGap:5;
paddingTop: 10; paddingLeft: 10; paddingRight: 10; paddingBottom: 10;
headerHeight: 0;
borderThicknessTop: 0; borderThicknessLeft: 0; borderThicknessRight: 0; borderThicknessBottom: 0;
borderStyle: solid; borderColor: #BFBFBF; borderThickness: 1; cornerRadius: 30;
dropShadowEnabled: false; dropShadowColor: #000000;
}
/* TriCloud Popup Dialog */
.CloudDialog
{
headerColors: #DADADA, #DADADA;
footerColors: #DADADA, #DADADA;
background-color: #F7F7F7; background-alpha: 0.85;
horizontalAlign: left; verticalAlign: top;
horizontalGap:5; verticalGap:5;
paddingTop: 5; paddingLeft: 10; paddingRight: 10; paddingBottom: 10;
borderThicknessTop: 1; borderThicknessLeft: 0; borderThicknessRight: 0; borderThicknessBottom: 0;
borderStyle: solid; borderColor: #BFBFBF; borderThickness: 2; cornerRadius: 15;
dropShadowEnabled: true; dropShadowColor: #000000;
}
/* Top Title Bar for every popup dialogs */
.CloudDialogTitle
{
fontWeight: bold;
}
/* doesnt work */
.CloudFormItem : FormItemLabel
{
fontWeight: bold;
}
Alert
{
headerColors: #DADADA, #DADADA;
footerColors: #DADADA, #DADADA;
titleStyleName: CloudDialogTitle;
color: #000000;
background-color: #F7F7F7; background-alpha: 0.75;
horizontalAlign: left; verticalAlign: top;
horizontalGap:5; verticalGap:5;
paddingTop: 0; paddingLeft: 10; paddingRight: 10; paddingBottom: 10;
borderThicknessTop: 0; borderThicknessLeft: 0; borderThicknessRight: 0; borderThicknessBottom: 0;
borderStyle: solid; borderColor: #BFBFBF; borderThickness: 1; cornerRadius: 15;
dropShadowEnabled: true; dropShadowColor: #000000;
}
/* TriCloud Popup Menus */
.CloudMenu
{
background-color: #F7F7F7; background-alpha: 0.85;
verticalGap: 0;
color: blue;
bottom: 5;
top: 5;
paddingTop: 5; paddingLeft: 5; paddingRight: 0; paddingBottom: 2;
borderStyle: solid; borderColor: #BFBFBF; borderThickness: 1; cornerRadius: 15;
dropShadowEnabled: true; dropShadowColor: #000000;
}
/* TriCloud Image Import/Export */
.ImageService
{
horizontalAlign: center; verticalAlign: middle;
horizontalGap:5; verticalGap:5;
paddingTop: 10; paddingLeft: 10; paddingRight: 10; paddingBottom: 10;
borderStyle: none;
dropShadowEnabled: false;
}
/* TriCloud Image Import/Export Button */
.ImageServiceButton
{
width: 30; buttonWidth: 100;
labelPlacement: center;
paddingBottom: 10;
verticalAlign: middle;
}
.OkButton
{
icon:Embed(source="./assets/images/ok.gif");
}
.CancelButton
{
icon:Embed(source="./assets/images/cancel.gif");
}
</mx:Style>
</mx:Application>