-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,050 additions
and
720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
awaybuilder-core/src/awaybuilder/utils/enumerators/EMenuItem.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package awaybuilder.utils.enumerators | ||
{ | ||
public class EMenuItem | ||
{ | ||
//file | ||
public static const NEW_DOCUMENT:String = "new"; | ||
public static const OPEN:String = "open"; | ||
public static const IMPORT:String = "import"; | ||
public static const SAVE:String = "save"; | ||
public static const SAVE_AS:String = "saveAs"; | ||
public static const PRINT:String = "print"; | ||
public static const EXIT:String = "exit"; | ||
|
||
//edit | ||
public static const UNDO:String = "undo"; | ||
public static const REDO:String = "redo"; | ||
public static const CUT:String = "cut"; | ||
public static const COPY:String = "copy"; | ||
public static const PASTE:String = "paste"; | ||
public static const SELECT_ALL:String = "selectAll"; | ||
public static const SELECT_NONE:String = "selectNone"; | ||
public static const DELETE:String = "delete"; | ||
public static const ROTATE_LEFT:String = "rotateLeft"; | ||
public static const ROTATE_RIGHT:String = "rotateRight"; | ||
public static const APPLICATION_SETTINGS:String = "applicationSettings"; | ||
public static const DOCUMENT_SETTINGS:String = "documentSettings"; | ||
|
||
//tools | ||
public static const FREE_CAMERA:String = "freeCamera"; | ||
public static const TARGET_CAMERA:String = "targetCamera"; | ||
public static const TRANSLATE_MODE:String = "translateMode"; | ||
public static const ROTATE_MODE:String = "rotateMode"; | ||
public static const SCALE_MODE:String = "scaleMode"; | ||
|
||
//view | ||
public static const ZOOM_IN:String = "zoomIn"; | ||
public static const ZOOM_OUT:String = "zoomOut"; | ||
public static const FOCUS:String = "focusSelected"; | ||
public static const SHOW_GRID:String = "showGrid"; | ||
public static const SNAP_TO_GRID:String = "snapToGrid"; | ||
|
||
//help | ||
public static const SAMPLES:String = "helpSamples"; | ||
public static const ABOUT:String = "about"; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
awaybuilder-core/src/awaybuilder/view/components/popup/AboutPopup.mxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" | ||
xmlns:s="library://ns.adobe.com/flex/spark" | ||
xmlns:mx="library://ns.adobe.com/flex/mx" | ||
title="About" | ||
width="500" height="300" close="titlewindow1_closeHandler(event)" borderVisible="true"> | ||
|
||
<s:layout> | ||
<s:VerticalLayout gap="0" paddingTop="0" paddingRight="0" paddingBottom="0" paddingLeft="0"/> | ||
</s:layout> | ||
|
||
<s:VGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center"> | ||
<s:Label text="{'Ver ' + AwayBuilder.MAJOR_VERSION + '.' + AwayBuilder.MINOR_VERSION + '.' + AwayBuilder.REVISION + ' ' + AwayBuilder.SUFFIX}" /> | ||
</s:VGroup> | ||
|
||
<s:SkinnableContainer id="controlBar" width="100%"> | ||
<s:Spacer width="100%"/> | ||
<s:Button id="okButton" label="Close" click="okButton_clickHandler(event)"/> | ||
</s:SkinnableContainer> | ||
<!-- <s:controlBarContent> | ||
<s:Button id="okButton" label="Close" click="okButton_clickHandler(event)"/> | ||
</s:controlBarContent>--> | ||
<fx:Script> | ||
<![CDATA[ | ||
import awaybuilder.AwayBuilder; | ||
import mx.core.FlexGlobals; | ||
import mx.events.CloseEvent; | ||
import mx.managers.PopUpManager; | ||
public static function show():AboutPopup | ||
{ | ||
var popup:AboutPopup = PopUpManager.createPopUp( DisplayObject(FlexGlobals.topLevelApplication), AboutPopup, true ) as AboutPopup; | ||
PopUpManager.centerPopUp( popup ); | ||
return popup; | ||
} | ||
private function okButton_clickHandler(event:MouseEvent):void | ||
{ | ||
PopUpManager.removePopUp( this ); | ||
} | ||
protected function titlewindow1_closeHandler(event:CloseEvent):void | ||
{ | ||
PopUpManager.removePopUp( this ); | ||
} | ||
]]> | ||
</fx:Script> | ||
</s:TitleWindow> |
180 changes: 180 additions & 0 deletions
180
awaybuilder-core/src/awaybuilder/view/mediators/BaseApplicationMediator.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
package awaybuilder.view.mediators | ||
{ | ||
import awaybuilder.controller.clipboard.events.*; | ||
import awaybuilder.controller.events.*; | ||
import awaybuilder.controller.history.UndoRedoEvent; | ||
import awaybuilder.controller.scene.events.SceneEvent; | ||
import awaybuilder.utils.enumerators.EMenuItem; | ||
import awaybuilder.utils.scene.CameraManager; | ||
import awaybuilder.utils.scene.Scene3DManager; | ||
import awaybuilder.view.components.popup.AboutPopup; | ||
|
||
import flash.events.KeyboardEvent; | ||
import flash.ui.Keyboard; | ||
|
||
import org.robotlegs.mvcs.Mediator; | ||
|
||
public class BaseApplicationMediator extends Mediator | ||
{ | ||
|
||
protected function onKeyDown( event:KeyboardEvent ):void | ||
{ | ||
if(event.keyCode == Keyboard.F1) | ||
{ | ||
onItemSelect( EMenuItem.ABOUT ); | ||
} | ||
else if(event.keyCode == Keyboard.DELETE) | ||
{ | ||
onItemSelect( EMenuItem.DELETE ); | ||
} | ||
|
||
if( !event.ctrlKey ) return; | ||
|
||
switch(String.fromCharCode(event.charCode)) | ||
{ | ||
|
||
case "z": | ||
onItemSelect( EMenuItem.UNDO ); | ||
break; | ||
case "y": | ||
onItemSelect( EMenuItem.REDO ); | ||
break; | ||
case "x": | ||
onItemSelect( EMenuItem.CUT ); | ||
break; | ||
case "c": | ||
onItemSelect( EMenuItem.COPY ); | ||
break; | ||
case "v": | ||
onItemSelect( EMenuItem.SAVE ); | ||
break; | ||
case "+": | ||
case "=": | ||
onItemSelect( EMenuItem.ZOOM_IN ); | ||
break; | ||
case "-": | ||
onItemSelect( EMenuItem.ZOOM_OUT ); | ||
break; | ||
|
||
} | ||
|
||
if(event.keyCode == Keyboard.BACKSPACE) | ||
{ | ||
onItemSelect( EMenuItem.DELETE ); | ||
} | ||
} | ||
protected function onItemSelect( value:String ):void | ||
{ | ||
switch( value ) | ||
{ | ||
case EMenuItem.NEW_DOCUMENT: | ||
this.dispatch(new DocumentRequestEvent(DocumentRequestEvent.REQUEST_NEW_DOCUMENT)); | ||
break; | ||
|
||
case EMenuItem.OPEN: | ||
this.dispatch(new DocumentRequestEvent(DocumentRequestEvent.REQUEST_OPEN_DOCUMENT)); | ||
break; | ||
|
||
case EMenuItem.IMPORT: | ||
this.dispatch(new DocumentRequestEvent(DocumentRequestEvent.REQUEST_IMPORT_DOCUMENT)); | ||
break; | ||
|
||
case EMenuItem.SAVE: | ||
this.dispatch(new SaveDocumentEvent(SaveDocumentEvent.SAVE_DOCUMENT)); | ||
break; | ||
|
||
case EMenuItem.SAVE_AS: | ||
this.dispatch(new SaveDocumentEvent(SaveDocumentEvent.SAVE_DOCUMENT_AS)); | ||
break; | ||
|
||
case EMenuItem.EXIT: | ||
exit(); | ||
break; | ||
|
||
//edit | ||
case EMenuItem.UNDO: | ||
this.dispatch(new UndoRedoEvent(UndoRedoEvent.UNDO)); | ||
break; | ||
|
||
case EMenuItem.REDO: | ||
this.dispatch(new UndoRedoEvent(UndoRedoEvent.REDO)); | ||
break; | ||
|
||
case EMenuItem.CUT: | ||
this.dispatch(new ClipboardEvent(ClipboardEvent.CLIPBOARD_CUT)); | ||
break; | ||
|
||
case EMenuItem.COPY: | ||
this.dispatch(new ClipboardEvent(ClipboardEvent.CLIPBOARD_COPY)); | ||
break; | ||
|
||
case EMenuItem.PASTE: | ||
this.dispatch(new PasteEvent(PasteEvent.CLIPBOARD_PASTE)); | ||
break; | ||
|
||
case EMenuItem.SELECT_ALL: | ||
this.dispatch(new SceneEvent(SceneEvent.SELECT_ALL, null)); | ||
break; | ||
|
||
case EMenuItem.SELECT_NONE: | ||
this.dispatch(new SceneEvent(SceneEvent.SELECT_NONE, null)); | ||
break; | ||
|
||
case EMenuItem.DELETE: | ||
this.dispatch(new SceneEvent(SceneEvent.PERFORM_DELETION)); | ||
break; | ||
|
||
case EMenuItem.DOCUMENT_SETTINGS: | ||
this.dispatch(new SettingsEvent(SettingsEvent.SHOW_DOCUMENT_SETTINGS)); | ||
break; | ||
|
||
//tools | ||
case EMenuItem.FREE_CAMERA: | ||
this.dispatch(new SceneEvent(SceneEvent.SWITCH_CAMERA_TO_FREE, null)); | ||
break; | ||
|
||
case EMenuItem.TARGET_CAMERA: | ||
this.dispatch(new SceneEvent(SceneEvent.SWITCH_CAMERA_TO_TARGET, null)); | ||
break; | ||
|
||
case EMenuItem.TRANSLATE_MODE: | ||
this.dispatch(new SceneEvent(SceneEvent.SWITCH_TRANSFORM_TRANSLATE, null)); | ||
break; | ||
|
||
case EMenuItem.ROTATE_MODE: | ||
this.dispatch(new SceneEvent(SceneEvent.SWITCH_TRANSFORM_ROTATE, null)); | ||
break; | ||
|
||
case EMenuItem.SCALE_MODE: | ||
this.dispatch(new SceneEvent(SceneEvent.SWITCH_TRANSFORM_SCALE, null)); | ||
break; | ||
|
||
//view | ||
case EMenuItem.ZOOM_OUT: | ||
Scene3DManager.zoomDistanceDelta( -CameraManager.ZOOM_DELTA_VALUE ); | ||
break; | ||
|
||
case EMenuItem.ZOOM_IN: | ||
Scene3DManager.zoomDistanceDelta( CameraManager.ZOOM_DELTA_VALUE ); | ||
break; | ||
|
||
case EMenuItem.FOCUS: | ||
this.dispatch(new SceneEvent(SceneEvent.FOCUS_SELECTION)); | ||
break; | ||
|
||
//help | ||
case EMenuItem.ABOUT: | ||
AboutPopup.show(); | ||
break; | ||
|
||
default: | ||
trace("Menu item not implemented: " +value + "."); | ||
} | ||
} | ||
|
||
protected function exit():void | ||
{ | ||
throw new Error( "Abstract methid exception" ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.