Skip to content
Browse files

update related to #135

  • Loading branch information...
1 parent 1f25744 commit ef42b8ef6c5526ce41ac50bcfd7fa619a8c5b618 @keyemkey keyemkey committed Jul 10, 2013
Showing with 133 additions and 123 deletions.
  1. +1 −1 awaybuilder-core/src/awaybuilder/CoreContext.as
  2. +2 −0 awaybuilder-core/src/awaybuilder/model/ApplicationModel.as
  3. +38 −37 awaybuilder-core/src/awaybuilder/utils/encoders/AWDEncoder.as
  4. +1 −1 awaybuilder-core/src/awaybuilder/utils/encoders/ISceneGraphEncoder.as
  5. +4 −1 awaybuilder-core/src/awaybuilder/view/components/PropertiesPanel.mxml
  6. +4 −3 awaybuilder-core/src/awaybuilder/view/components/editors/GlobalOptionPropertiesEditor.mxml
  7. +7 −1 awaybuilder-core/src/awaybuilder/view/mediators/PropertiesPanelMediator.as
  8. +4 −6 awaybuilder-desktop/src/AwayBuilderApplication.mxml
  9. +1 −6 awaybuilder-desktop/src/awaybuilder/desktop/DesktopAppContext.as
  10. +5 −4 awaybuilder-desktop/src/awaybuilder/desktop/controller/CloseDocumentCommand.as
  11. +8 −6 awaybuilder-desktop/src/awaybuilder/desktop/controller/DocumentRequestCommand.as
  12. +6 −5 awaybuilder-desktop/src/awaybuilder/desktop/controller/ShowDocumentLoadProgressWindowCommand.as
  13. +6 −4 awaybuilder-desktop/src/awaybuilder/desktop/controller/ShowMessageBoxCommand.as
  14. +3 −3 awaybuilder-desktop/src/awaybuilder/desktop/model/DesktopDocumentService.as
  15. +16 −16 awaybuilder-desktop/src/awaybuilder/desktop/view/mediators/ObjectPropertiesWindowMediator.as
  16. +7 −17 awaybuilder-web/src/AwayBuilderApplication.mxml
  17. +3 −6 awaybuilder-web/src/awaybuilder/web/WebAppContext.as
  18. +0 −2 awaybuilder-web/src/awaybuilder/web/controller/CloseDocumentCommand.as
  19. +0 −3 awaybuilder-web/src/awaybuilder/web/controller/DocumentRequestCommand.as
  20. +5 −1 awaybuilder-web/src/awaybuilder/web/model/DocumentService.as
  21. +12 −0 awaybuilder-web/src/awaybuilder/web/view/mediators/ApplicationMediator.as
View
2 awaybuilder-core/src/awaybuilder/CoreContext.as
@@ -104,7 +104,7 @@ package awaybuilder
public class CoreContext extends Context
{
- public function CoreContext(contextView:DisplayObjectContainer)
+ public function CoreContext()
{
super(contextView);
}
View
2 awaybuilder-core/src/awaybuilder/model/ApplicationModel.as
@@ -9,5 +9,7 @@ package awaybuilder.model
public var isWaitingForClose:Boolean = false;
public var savedNextEvent:Event;
+
+ public var webRestrictionsEnabled:Boolean = false;
}
}
View
75 awaybuilder-core/src/awaybuilder/utils/encoders/AWDEncoder.as
@@ -146,67 +146,68 @@ package awaybuilder.utils.encoders
}
// this function is called from the app...
- public function encode(document : DocumentModel, output : ByteArray) : Boolean
+ public function encode(document : DocumentModel, output : ByteArray, useWebRestriction:Boolean = false) : Boolean
{
-
_body = new ByteArray();
_body.endian = Endian.LITTLE_ENDIAN;
_blockId = 0;
- _nameSpaceID=1;
- _nameSpaceString=document.globalOptions.namespace;
- _embedtextures=document.globalOptions.embedTextures;
+ _nameSpaceID = 1;
+ _nameSpaceString = document.globalOptions.namespace;
+ _embedtextures = document.globalOptions.embedTextures;
+
// get the type of compression to use
- _compression=0;
- if(document.globalOptions.compression=="UNCOMPRESSED")
- _compression=0;
- if(document.globalOptions.compression=="DEFLATE")
- _compression=1;
- if(document.globalOptions.compression=="LZMA")
- _compression=2;
+ switch(document.globalOptions.compression)
+ {
+ case "DEFLATE":
+ _compression = 1;
+ break;
+ case "LZMA":
+ _compression = 2;
+ break;
+ default:
+ _compression = 0;
+ break;
+ }
// if the streaming option is enabled, the compression is set per block
if (document.globalOptions.streaming)
{
- _blockCompress=_compression;
- _compression=0;
+ _blockCompress = _compression;
+ _compression = 0;
}
+
// set the global - storage - precision
- _matrixNrType=FLOAT32;
+ _matrixNrType = FLOAT32;
if (document.globalOptions.matrixStorage=="Precision"){
- _matrixNrType=FLOAT64;
- _matrixStoragePrecision=1;
+ _matrixNrType = FLOAT64;
+ _matrixStoragePrecision = 1;
}
_geoNrType=FLOAT32;
if (document.globalOptions.geometryStorage=="Precision"){
- _geoNrType=FLOAT64;
- _geomStoragePrecision=1;
+ _geoNrType = FLOAT64;
+ _geomStoragePrecision = 1;
}
_propNrType=FLOAT32;
if (document.globalOptions.propertyStorage=="Precision"){
- _propNrType=FLOAT64;
- _propsStoragePrecision=1;
+ _propNrType = FLOAT64;
+ _propsStoragePrecision = 1;
}
_attributeNrType=FLOAT32;
if (document.globalOptions.attributesStorage=="Precision"){
- _attributeNrType=FLOAT64;
- _attrStoragePrecision=1;
+ _attributeNrType = FLOAT64;
+ _attrStoragePrecision = 1;
}
- var _embedtexturesInt:int=0;
- var _exportNormalsInt:int=0;
- var _exportTangentsInt:int=0;
- if (document.globalOptions.embedTextures) {
- _embedtexturesInt=1;
- }
- if (document.globalOptions.includeNormal) {
- _exportNormalsInt=1;
- }
- if (document.globalOptions.includeTangent) {
- _exportTangentsInt=1;
+ var _embedtexturesInt:int = 1;
+ var _exportNormalsInt:int = document.globalOptions.includeNormal?1:0;
+ var _exportTangentsInt:int = document.globalOptions.includeTangent?1:0;
+
+ if( !useWebRestriction )
+ {
+ _embedtexturesInt = document.globalOptions.embedTextures?1:0;
}
-
if(_debug)trace("start encoding");
//create a AWDBlock class for all supported Assets
@@ -2171,8 +2172,8 @@ package awaybuilder.utils.encoders
value=int(copy);
}
if(Number(copy)){
- type=_attributeNrType;
- value=Number(copy);
+ type = _attributeNrType;
+ value = Number(copy);
}
if (type==AWDSTRING){
if((copy=="false")||(copy=="False")||(copy=="FALSE")){
View
2 awaybuilder-core/src/awaybuilder/utils/encoders/ISceneGraphEncoder.as
@@ -6,7 +6,7 @@ package awaybuilder.utils.encoders
public interface ISceneGraphEncoder
{
- function encode(scenegraph : DocumentModel, output : ByteArray) : Boolean;
+ function encode(scenegraph : DocumentModel, output : ByteArray, useWebRestriction:Boolean = false) : Boolean;
function dispose() : void;
}
}
View
5 awaybuilder-core/src/awaybuilder/view/components/PropertiesPanel.mxml
@@ -85,6 +85,9 @@
[Bindable]
public var lightPickers:ArrayCollection;
+ [Bindable]
+ public var embedTexturesOptionEnabled:Boolean = true;
+
public function showEditor( value:String, showNext:Boolean, showPrev:Boolean, data:Object ):void
{
panelImage.drawPanel( panelsContainer );
@@ -146,7 +149,7 @@
<editors:MeshGroupPropertiesEditor data="{data}" includeIn="meshGroup,initAll"/>
<editors:MaterialGroupPropertiesEditor textures="{nullableTextures}" lightPickers="{lightPickers}" prevSelected="{prevSelected}" data="{data}" includeIn="materialGroup,initAll"/>
- <editors:GlobalOptionPropertiesEditor data="{data}" includeIn="global,initAll" />
+ <editors:GlobalOptionPropertiesEditor data="{data}" embedTexturesOptionEnabled="{embedTexturesOptionEnabled}" includeIn="global,initAll" />
</s:Group>
</controls:CrutchScroller>
</controls:CollapsiblePanel>
View
7 awaybuilder-core/src/awaybuilder/view/components/editors/GlobalOptionPropertiesEditor.mxml
@@ -18,8 +18,9 @@
import spark.events.IndexChangeEvent;
- [Bindable]
- private var _asset:GlobalOptionsVO;
+ [Bindable] public var embedTexturesOptionEnabled:Boolean = true;
+
+ [Bindable] private var _asset:GlobalOptionsVO;
override protected function validate():void
{
@@ -94,7 +95,7 @@
</s:VGroup>
<s:Spacer height="6"/>
<s:Form width="100%" skinClass="awaybuilder.view.skins.PropertyFormSkin">
- <s:FormItem label="Embed Textures" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" >
+ <s:FormItem label="Embed Textures" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%" includeInLayout="{embedTexturesOptionEnabled}" visible="{embedTexturesOptionEnabled}" >
<s:CheckBox change="value_changeHandler(event)" selected="@{_asset.embedTextures}" />
</s:FormItem>
<s:FormItem label="Include Normal data" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
View
8 awaybuilder-core/src/awaybuilder/view/mediators/PropertiesPanelMediator.as
@@ -5,6 +5,7 @@ package awaybuilder.view.mediators
import awaybuilder.controller.history.UndoRedoEvent;
import awaybuilder.controller.scene.events.AnimationEvent;
import awaybuilder.controller.scene.events.SceneEvent;
+ import awaybuilder.model.ApplicationModel;
import awaybuilder.model.AssetsModel;
import awaybuilder.model.DocumentModel;
import awaybuilder.model.vo.scene.AnimationNodeVO;
@@ -42,6 +43,7 @@ package awaybuilder.view.mediators
import mx.controls.Alert;
import mx.events.CloseEvent;
+ import org.robotlegs.base.ContextEvent;
import org.robotlegs.mvcs.Mediator;
public class PropertiesPanelMediator extends Mediator
@@ -55,8 +57,13 @@ package awaybuilder.view.mediators
[Inject]
public var document:DocumentModel;
+ [Inject]
+ public var applicationModel:ApplicationModel;
+
override public function onRegister():void
{
+ view.embedTexturesOptionEnabled = !applicationModel.webRestrictionsEnabled;
+
addContextListener(SceneEvent.SELECT, context_itemsSelectHandler);
addContextListener(UndoRedoEvent.UNDO, context_undoHandler);
addContextListener(SceneEvent.DELETE, context_deleteHandler);
@@ -716,7 +723,6 @@ package awaybuilder.view.mediators
//
//----------------------------------------------------------------------
-
private function context_itemsSelectHandler(event:SceneEvent):void
{
if( !event.items || event.items.length == 0)
View
10 awaybuilder-desktop/src/AwayBuilderApplication.mxml
@@ -8,7 +8,7 @@
minWidth="1024" minHeight="720"
backgroundColor="0x333333"
showStatusBar="false" usePreloader="false"
- preinitialize="preinitializeHandler(event)"
+ preinitialize="preinitializeHandler(event)" xmlns:desktop="awaybuilder.desktop.*"
>
<s:menu>
<mx:FlexNativeMenu dataProvider="{menuProvider}" keyEquivalentModifiersFunction="keyEquivalentModifiers"/>
@@ -79,6 +79,9 @@
</fx:children>
</fx:Object>
</fx:Array>
+
+ <desktop:DesktopAppContext contextView="{this}"/>
+
</fx:Declarations>
<fx:Style source="desktop_styles.css"/>
@@ -87,7 +90,6 @@
<fx:Script><![CDATA[
import awaybuilder.AwayBuilder;
- import awaybuilder.desktop.DesktopAppContext;
import awaybuilder.desktop.view.components.UpdatePopup;
import awaybuilder.utils.enumerators.EMenuItem;
@@ -99,8 +101,6 @@
private var _updateCancelled:Boolean = false;
- private var _context:DesktopAppContext;
-
public var splashScreen:SplashScreen;
public var isMac:Boolean;
@@ -111,8 +111,6 @@
isMac = (Capabilities.os.indexOf("Mac OS") >= 0);
- _context = new DesktopAppContext(DisplayObjectContainer(this.systemManager));
-
var urlLoader:URLLoader = new URLLoader();
urlLoader.load( new URLRequest( "https://raw.github.com/awaytools/AwayBuilder/master/awaybuilder-core/src/awaybuilder/AwayBuilder.as" ) );
urlLoader.addEventListener(Event.COMPLETE, urlLoader_completeHandler );
View
7 awaybuilder-desktop/src/awaybuilder/desktop/DesktopAppContext.as
@@ -14,11 +14,11 @@ package awaybuilder.desktop
import awaybuilder.desktop.controller.ShowMessageBoxCommand;
import awaybuilder.desktop.controller.events.OpenFromInvokeEvent;
import awaybuilder.desktop.model.DesktopDocumentService;
- import awaybuilder.view.components.popup.AboutPopup;
import awaybuilder.desktop.view.components.EditedDocumentWarningWindow;
import awaybuilder.desktop.view.mediators.ApplicationMediator;
import awaybuilder.desktop.view.mediators.EditedDocumentWarningWindowMediator;
import awaybuilder.model.IDocumentService;
+ import awaybuilder.view.components.popup.AboutPopup;
import flash.desktop.NativeApplication;
import flash.display.DisplayObjectContainer;
@@ -31,10 +31,6 @@ package awaybuilder.desktop
public class DesktopAppContext extends CoreContext
{
- public function DesktopAppContext(contextView:DisplayObjectContainer)
- {
- super(contextView);
- }
override protected function get mediatorMap():IMediatorMap
{
@@ -59,7 +55,6 @@ package awaybuilder.desktop
this.commandMap.mapEvent(MessageBoxEvent.SHOW_MESSAGE_BOX, ShowMessageBoxCommand);
this.injector.mapSingletonOf(IDocumentService, DesktopDocumentService);
- this.injector.mapValue(AwayBuilderApplication, FlexGlobals.topLevelApplication);
this.mediatorMap.mapView(AwayBuilderApplication, ApplicationMediator);
this.mediatorMap.mapView(EditedDocumentWarningWindow, EditedDocumentWarningWindowMediator);
View
9 awaybuilder-desktop/src/awaybuilder/desktop/controller/CloseDocumentCommand.as
@@ -1,14 +1,14 @@
package awaybuilder.desktop.controller
{
- import awaybuilder.model.DocumentModel;
import awaybuilder.model.ApplicationModel;
+ import awaybuilder.model.DocumentModel;
+
+ import mx.core.FlexGlobals;
import org.robotlegs.mvcs.Command;
public class CloseDocumentCommand extends Command
{
- [Inject]
- public var window:AwayBuilderApplication;
[Inject]
public var windowModel:ApplicationModel;
@@ -22,7 +22,8 @@ package awaybuilder.desktop.controller
{
this.documentModel.edited = false;
}
- this.window.close();
+
+ AwayBuilderApplication(FlexGlobals.topLevelApplication).close();
}
}
}
View
14 awaybuilder-desktop/src/awaybuilder/desktop/controller/DocumentRequestCommand.as
@@ -3,11 +3,15 @@ package awaybuilder.desktop.controller
import awaybuilder.controller.events.DocumentRequestEvent;
import awaybuilder.controller.scene.events.SceneEvent;
import awaybuilder.desktop.view.components.EditedDocumentWarningWindow;
- import awaybuilder.model.DocumentModel;
import awaybuilder.model.ApplicationModel;
+ import awaybuilder.model.DocumentModel;
+
+ import mx.core.FlexGlobals;
import org.robotlegs.mvcs.Command;
+ import spark.components.Application;
+
public class DocumentRequestCommand extends Command
{
[Inject]
@@ -19,9 +23,6 @@ package awaybuilder.desktop.controller
[Inject]
public var windowModel:ApplicationModel;
- [Inject]
- public var mainWindow:AwayBuilderApplication;
-
override public function execute():void
{
if(event.type == DocumentRequestEvent.REQUEST_CLOSE_DOCUMENT)
@@ -44,9 +45,10 @@ package awaybuilder.desktop.controller
var window:EditedDocumentWarningWindow = new EditedDocumentWarningWindow();
this.mediatorMap.createMediator(window);
+ var app:AwayBuilderApplication = FlexGlobals.topLevelApplication as AwayBuilderApplication;
window.open();
- window.nativeWindow.x = mainWindow.nativeWindow.x + (mainWindow.nativeWindow.width - window.nativeWindow.width) / 2;
- window.nativeWindow.y = mainWindow.nativeWindow.y + (mainWindow.nativeWindow.height - window.nativeWindow.height) / 2;
+ window.nativeWindow.x = app.nativeWindow.x + (app.nativeWindow.width - window.nativeWindow.width) / 2;
+ window.nativeWindow.y = app.nativeWindow.y + (app.nativeWindow.height - window.nativeWindow.height) / 2;
return;
}
View
11 ...ilder-desktop/src/awaybuilder/desktop/controller/ShowDocumentLoadProgressWindowCommand.as
@@ -1,15 +1,15 @@
package awaybuilder.desktop.controller
{
+ import awaybuilder.desktop.view.components.DocumentLoadProgressWindow;
+
import flash.display.Screen;
- import awaybuilder.desktop.view.components.DocumentLoadProgressWindow;
+ import mx.core.FlexGlobals;
import org.robotlegs.mvcs.Command;
public class ShowDocumentLoadProgressWindowCommand extends Command
{
- [Inject]
- public var mainWindow:AwayBuilderApplication;
override public function execute():void
{
@@ -19,11 +19,12 @@ package awaybuilder.desktop.controller
this.mediatorMap.createMediator(window);
+ var app:AwayBuilderApplication = FlexGlobals.topLevelApplication as AwayBuilderApplication;
window.width = window.measuredWidth;
window.height = window.measuredHeight;
- window.nativeWindow.x = mainWindow.nativeWindow.x + (mainWindow.nativeWindow.width - window.nativeWindow.width) / 2;
- window.nativeWindow.y = mainWindow.nativeWindow.y + (mainWindow.nativeWindow.height - window.nativeWindow.height) / 2;
+ window.nativeWindow.x = app.nativeWindow.x + (app.nativeWindow.width - window.nativeWindow.width) / 2;
+ window.nativeWindow.y = app.nativeWindow.y + (app.nativeWindow.height - window.nativeWindow.height) / 2;
}
}
}
View
10 awaybuilder-desktop/src/awaybuilder/desktop/controller/ShowMessageBoxCommand.as
@@ -4,12 +4,12 @@ package awaybuilder.desktop.controller
import awaybuilder.controller.scene.events.SceneEvent;
import awaybuilder.desktop.view.components.MessageBox;
+ import mx.core.FlexGlobals;
+
import org.robotlegs.mvcs.Command;
public class ShowMessageBoxCommand extends Command
{
- [Inject]
- public var mainWindow:AwayBuilderApplication;
[Inject]
public var event:MessageBoxEvent;
@@ -33,8 +33,10 @@ package awaybuilder.desktop.controller
messageBox.width = messageBox.measuredWidth;
messageBox.height = messageBox.measuredHeight;
- messageBox.nativeWindow.x = mainWindow.nativeWindow.x + (mainWindow.nativeWindow.width - messageBox.nativeWindow.width) / 2;
- messageBox.nativeWindow.y = mainWindow.nativeWindow.y + (mainWindow.nativeWindow.height - messageBox.nativeWindow.height) / 2;
+ var app:AwayBuilderApplication = FlexGlobals.topLevelApplication as AwayBuilderApplication;
+
+ messageBox.nativeWindow.x = app.nativeWindow.x + (app.nativeWindow.width - messageBox.nativeWindow.width) / 2;
+ messageBox.nativeWindow.y = app.nativeWindow.y + (app.nativeWindow.height - messageBox.nativeWindow.height) / 2;
}
}
}
View
6 awaybuilder-desktop/src/awaybuilder/desktop/model/DesktopDocumentService.as
@@ -50,7 +50,7 @@ package awaybuilder.desktop.model
private var _property:String;
[Inject]
- public var windowModel:ApplicationModel;
+ public var applicationModel:ApplicationModel;
public function load( url:String, name:String, event:Event ):void
{
@@ -174,7 +174,7 @@ package awaybuilder.desktop.model
{
var bytes:ByteArray = new ByteArray();
var encoder:ISceneGraphEncoder = new AWDEncoder();
- var success:Boolean = encoder.encode(document, bytes);
+ var success:Boolean = encoder.encode(document, bytes, applicationModel.webRestrictionsEnabled);
if (!document.globalOptions.embedTextures){
saveExternalTextures(document,path)
@@ -227,7 +227,7 @@ package awaybuilder.desktop.model
private function file_save_cancelHandler(event:Event):void
{
- this.windowModel.isWaitingForClose = false;
+ this.applicationModel.isWaitingForClose = false;
var file:File = File(event.currentTarget);
file.removeEventListener(Event.SELECT, file_save_selectHandler);
View
32 awaybuilder-desktop/src/awaybuilder/desktop/view/mediators/ObjectPropertiesWindowMediator.as
@@ -1,23 +1,24 @@
package awaybuilder.desktop.view.mediators
{
+ import awaybuilder.components.IEditorObjectView;
+ import awaybuilder.controller.events.EditorStateChangeEvent;
+ import awaybuilder.desktop.utils.ModalityManager;
+ import awaybuilder.desktop.view.components.ObjectPropertiesWindow;
+ import awaybuilder.model.DocumentModel;
+ import awaybuilder.model.IEditorModel;
+ import awaybuilder.model.UndoRedoModel;
+ import awaybuilder.view.components.propertyEditors.IObjectPropertyEditor;
+
import flash.desktop.NativeApplication;
import flash.display.NativeWindowDisplayState;
import flash.events.Event;
import flash.events.KeyboardEvent;
+ import mx.core.FlexGlobals;
import mx.core.IIMESupport;
import mx.managers.IFocusManagerComponent;
import mx.skins.ProgrammaticSkin;
- import awaybuilder.components.IEditorObjectView;
- import awaybuilder.desktop.utils.ModalityManager;
- import awaybuilder.desktop.view.components.ObjectPropertiesWindow;
- import awaybuilder.controller.events.EditorStateChangeEvent;
- import awaybuilder.model.DocumentModel;
- import awaybuilder.model.IEditorModel;
- import awaybuilder.model.UndoRedoModel;
- import awaybuilder.view.components.propertyEditors.IObjectPropertyEditor;
-
import org.robotlegs.mvcs.Mediator;
public class ObjectPropertiesWindowMediator extends Mediator
@@ -36,9 +37,6 @@ package awaybuilder.desktop.view.mediators
[Inject]
public var undoRedo:UndoRedoModel;
- [Inject]
- public var mainWindow:AwayBuilderApplication;
-
private var _hasDisplayedWindow:Boolean = false;
override public function onRegister():void
@@ -64,15 +62,17 @@ package awaybuilder.desktop.view.mediators
private function resetWindowPosition():void
{
- if(this.mainWindow.nativeWindow.displayState == NativeWindowDisplayState.MAXIMIZED)
+ var app:AwayBuilderApplication = FlexGlobals.topLevelApplication as AwayBuilderApplication;
+
+ if(app.nativeWindow.displayState == NativeWindowDisplayState.MAXIMIZED)
{
- this.window.nativeWindow.x = this.mainWindow.nativeWindow.x + this.mainWindow.nativeWindow.width - this.window.nativeWindow.width - 20;
+ this.window.nativeWindow.x = app.nativeWindow.x + app.nativeWindow.width - this.window.nativeWindow.width - 20;
}
else
{
- this.window.nativeWindow.x = this.mainWindow.nativeWindow.x + this.mainWindow.nativeWindow.width - this.window.nativeWindow.width / 2;
+ this.window.nativeWindow.x = app.nativeWindow.x + app.nativeWindow.width - this.window.nativeWindow.width / 2;
}
- this.window.nativeWindow.y = this.mainWindow.nativeWindow.y + (this.mainWindow.nativeWindow.height - this.window.nativeWindow.height) / 2;
+ this.window.nativeWindow.y = app.nativeWindow.y + (app.nativeWindow.height - this.window.nativeWindow.height) / 2;
}
private function cleanupOldPropertyEditor():void
View
24 awaybuilder-web/src/AwayBuilderApplication.mxml
@@ -8,11 +8,16 @@
preloader="AwayBuilderPreloader"
minWidth="1000" minHeight="720"
backgroundColor="0x333333"
- preinitialize="preinitializeHandler(event)"
+ xmlns:web="awaybuilder.web.*"
>
<s:layout>
<s:VerticalLayout gap="0"/>
</s:layout>
+ <fx:Script>
+ <![CDATA[
+ import awaybuilder.utils.enumerators.EMenuItem;
+ ]]>
+ </fx:Script>
<fx:Declarations>
<fx:Array id="menuProvider">
<fx:Object label="File">
@@ -75,6 +80,7 @@
</fx:children>
</fx:Object>
</fx:Array>
+ <web:WebAppContext contextView="{this}"/>
</fx:Declarations>
<fx:Style source="web_styles.css"/>
@@ -83,20 +89,4 @@
<components:CoreEditor id="coreEditor" width="100%" height="100%"/>
- <fx:Script><![CDATA[
- import awaybuilder.utils.enumerators.EMenuItem;
- import awaybuilder.web.WebAppContext;
-
- import mx.events.FlexEvent;
- import mx.events.MenuEvent;
-
- private var _context:WebAppContext;
-
- private function preinitializeHandler(event:FlexEvent):void
- {
- _context = new WebAppContext(DisplayObjectContainer(this.systemManager));
- }
-
- ]]></fx:Script>
-
</s:Application>
View
9 awaybuilder-web/src/awaybuilder/web/WebAppContext.as
@@ -4,14 +4,16 @@ package awaybuilder.web
import awaybuilder.controller.events.DocumentEvent;
import awaybuilder.controller.events.DocumentRequestEvent;
import awaybuilder.controller.events.SceneReadyEvent;
+ import awaybuilder.model.ApplicationModel;
+ import awaybuilder.model.IDocumentService;
+ import awaybuilder.view.components.editors.GlobalOptionPropertiesEditor;
import awaybuilder.web.controller.CloseDocumentCommand;
import awaybuilder.web.controller.DocumentRequestCommand;
import awaybuilder.web.controller.OpenFromInvokeCommand;
import awaybuilder.web.controller.SceneReadyCommand;
import awaybuilder.web.controller.events.OpenFromInvokeEvent;
import awaybuilder.web.model.DocumentService;
import awaybuilder.web.view.mediators.ApplicationMediator;
- import awaybuilder.model.IDocumentService;
import flash.display.DisplayObjectContainer;
@@ -21,10 +23,6 @@ package awaybuilder.web
public class WebAppContext extends CoreContext
{
- public function WebAppContext(contextView:DisplayObjectContainer)
- {
- super(contextView);
- }
override public function startup():void
{
@@ -42,7 +40,6 @@ package awaybuilder.web
this.commandMap.mapEvent(DocumentEvent.CLOSE_DOCUMENT, CloseDocumentCommand);
this.injector.mapSingletonOf(IDocumentService, DocumentService);
- this.injector.mapValue(AwayBuilderApplication, FlexGlobals.topLevelApplication);
this.mediatorMap.mapView(AwayBuilderApplication, ApplicationMediator);
View
2 awaybuilder-web/src/awaybuilder/web/controller/CloseDocumentCommand.as
@@ -7,8 +7,6 @@ package awaybuilder.web.controller
public class CloseDocumentCommand extends Command
{
- [Inject]
- public var window:AwayBuilderApplication;
[Inject]
public var windowModel:ApplicationModel;
View
3 awaybuilder-web/src/awaybuilder/web/controller/DocumentRequestCommand.as
@@ -18,9 +18,6 @@ package awaybuilder.web.controller
[Inject]
public var windowModel:ApplicationModel;
- [Inject]
- public var mainWindow:AwayBuilderApplication;
-
override public function execute():void
{
if(event.type == DocumentRequestEvent.REQUEST_CLOSE_DOCUMENT)
View
6 awaybuilder-web/src/awaybuilder/web/model/DocumentService.as
@@ -5,6 +5,7 @@ package awaybuilder.web.model
import awaybuilder.controller.events.SaveDocumentEvent;
import awaybuilder.controller.history.HistoryEvent;
import awaybuilder.controller.scene.events.SceneEvent;
+ import awaybuilder.model.ApplicationModel;
import awaybuilder.model.DocumentModel;
import awaybuilder.model.IDocumentService;
import awaybuilder.model.SmartDocumentServiceBase;
@@ -49,6 +50,9 @@ package awaybuilder.web.model
private var _file:FileReference;
+ [Inject]
+ public var applicationModel:ApplicationModel;
+
public function load( url:String, name:String, event:Event ):void
{
_name = name;
@@ -102,7 +106,7 @@ package awaybuilder.web.model
{
var bytes:ByteArray = new ByteArray();
var encoder:ISceneGraphEncoder = new AWDEncoder();
- var success:Boolean = encoder.encode( data, bytes );
+ var success:Boolean = encoder.encode( data, bytes, applicationModel.webRestrictionsEnabled );
var file:FileReference = new FileReference();
file.save( bytes, defaultName+".awd" );
View
12 awaybuilder-web/src/awaybuilder/web/view/mediators/ApplicationMediator.as
@@ -43,10 +43,21 @@ package awaybuilder.web.view.mediators
[Inject]
public var undoRedoModel:UndoRedoModel;
+ [Inject]
+ public var applicationModel:ApplicationModel;
+
private var _menuCache:Dictionary;
+ [PostConstruct]
+ public function initialize():void
+ {
+ applicationModel.webRestrictionsEnabled = true;
+ }
+
override public function onRegister():void
{
+ applicationModel.webRestrictionsEnabled = true;
+
_menuCache = new Dictionary();
app.menu.addEventListener(MenuEvent.ITEM_CLICK, menu_itemClickHandler );
@@ -76,6 +87,7 @@ package awaybuilder.web.view.mediators
getItemByValue( EMenuItem.CUT ).enabled = false;
getItemByValue( EMenuItem.COPY ).enabled = false;
getItemByValue( EMenuItem.PASTE ).enabled = false;
+
}
private function getItemByValue( value:String ):Object

0 comments on commit ef42b8e

Please sign in to comment.
Something went wrong with that request. Please try again.