Browse Source

Merge pull request #1432 from AtomicGameEngine/TSH-ATOMIC-1393

1393 - Update editor to use new event signatures
JoshEngebretson 8 years ago
parent
commit
e3cc531612
83 changed files with 881 additions and 930 deletions
  1. 35 37
      Script/AtomicEditor/editor/Editor.ts
  2. 6 164
      Script/AtomicEditor/editor/EditorEvents.ts
  3. 2 2
      Script/AtomicEditor/editor/EditorLicense.ts
  4. 19 21
      Script/AtomicEditor/hostExtensions/HostExtensionServices.ts
  5. 10 2
      Script/AtomicEditor/hostExtensions/ServiceLocator.ts
  6. 1 3
      Script/AtomicEditor/hostExtensions/coreExtensions/ProjectBasedExtensionLoader.ts
  7. 9 10
      Script/AtomicEditor/hostExtensions/languageExtensions/CSharpLanguageExtension.ts
  8. 13 16
      Script/AtomicEditor/hostExtensions/languageExtensions/TypescriptLanguageExtension.ts
  9. 1 1
      Script/AtomicEditor/main.ts
  10. 23 24
      Script/AtomicEditor/resources/ResourceOps.ts
  11. 5 6
      Script/AtomicEditor/ui/AnimationToolbar.ts
  12. 9 14
      Script/AtomicEditor/ui/EditorUI.ts
  13. 16 17
      Script/AtomicEditor/ui/MainToolbar.ts
  14. 1 1
      Script/AtomicEditor/ui/ScriptWidget.ts
  15. 10 10
      Script/AtomicEditor/ui/Shortcuts.ts
  16. 0 24
      Script/AtomicEditor/ui/UIEvents.ts
  17. 30 31
      Script/AtomicEditor/ui/frames/HierarchyFrame.ts
  18. 7 10
      Script/AtomicEditor/ui/frames/MainFrame.ts
  19. 15 16
      Script/AtomicEditor/ui/frames/ProjectFrame.ts
  20. 25 27
      Script/AtomicEditor/ui/frames/ResourceFrame.ts
  21. 4 5
      Script/AtomicEditor/ui/frames/WelcomeFrame.ts
  22. 1 1
      Script/AtomicEditor/ui/frames/inspector/ArrayEditWidget.ts
  23. 1 1
      Script/AtomicEditor/ui/frames/inspector/AssemblyInspector.ts
  24. 33 34
      Script/AtomicEditor/ui/frames/inspector/AttributeInfoEdit.ts
  25. 1 1
      Script/AtomicEditor/ui/frames/inspector/CSComponentClassSelector.ts
  26. 10 10
      Script/AtomicEditor/ui/frames/inspector/ColorChooser.ts
  27. 15 16
      Script/AtomicEditor/ui/frames/inspector/ComponentAttributeUI.ts
  28. 3 3
      Script/AtomicEditor/ui/frames/inspector/CreateComponentButton.ts
  29. 6 7
      Script/AtomicEditor/ui/frames/inspector/InspectorFrame.ts
  30. 1 1
      Script/AtomicEditor/ui/frames/inspector/InspectorWidget.ts
  31. 11 12
      Script/AtomicEditor/ui/frames/inspector/MaterialInspector.ts
  32. 4 5
      Script/AtomicEditor/ui/frames/inspector/ModelInspector.ts
  33. 1 1
      Script/AtomicEditor/ui/frames/inspector/PrefabInspector.ts
  34. 17 24
      Script/AtomicEditor/ui/frames/inspector/SelectionInspector.ts
  35. 5 5
      Script/AtomicEditor/ui/frames/inspector/SelectionPrefabWidget.ts
  36. 4 4
      Script/AtomicEditor/ui/frames/inspector/SelectionSectionCoreUI.ts
  37. 5 5
      Script/AtomicEditor/ui/frames/inspector/SerializableEditType.ts
  38. 0 2
      Script/AtomicEditor/ui/frames/inspector/TextureInspector.ts
  39. 1 1
      Script/AtomicEditor/ui/frames/inspector/TextureSelector.ts
  40. 7 8
      Script/AtomicEditor/ui/frames/menus/HierarchyFrameMenu.ts
  41. 10 11
      Script/AtomicEditor/ui/frames/menus/MainFrameMenu.ts
  42. 0 1
      Script/AtomicEditor/ui/frames/menus/MenuItemSources.ts
  43. 2 3
      Script/AtomicEditor/ui/frames/menus/ProjectFrameMenu.ts
  44. 1 2
      Script/AtomicEditor/ui/modal/CreateProject.ts
  45. 3 4
      Script/AtomicEditor/ui/modal/MessageModal.ts
  46. 2 2
      Script/AtomicEditor/ui/modal/ModalOps.ts
  47. 3 3
      Script/AtomicEditor/ui/modal/ModalWindow.ts
  48. 1 2
      Script/AtomicEditor/ui/modal/ResourceSelection.ts
  49. 7 8
      Script/AtomicEditor/ui/modal/UIResourceOps.ts
  50. 1 1
      Script/AtomicEditor/ui/modal/build/BuildComplete.ts
  51. 4 4
      Script/AtomicEditor/ui/modal/build/BuildOutput.ts
  52. 3 4
      Script/AtomicEditor/ui/modal/build/BuildSettingsWindow.ts
  53. 1 3
      Script/AtomicEditor/ui/modal/build/BuildWindow.ts
  54. 3 3
      Script/AtomicEditor/ui/modal/build/platforms/AndroidSettingsWidget.ts
  55. 1 1
      Script/AtomicEditor/ui/modal/build/platforms/IOSSettingsWidget.ts
  56. 1 1
      Script/AtomicEditor/ui/modal/build/platforms/WebSettingsWidget.ts
  57. 2 3
      Script/AtomicEditor/ui/modal/license/EULAWindow.ts
  58. 4 5
      Script/AtomicEditor/ui/playmode/PlayMode.ts
  59. 3 4
      Script/AtomicEditor/ui/playmode/PlayerOutput.ts
  60. 7 8
      Script/AtomicEditor/ui/resourceEditors/AbstractTextResourceEditorBuilder.ts
  61. 1 2
      Script/AtomicEditor/ui/resourceEditors/Scene3dResourceEditorBuilder.ts
  62. 23 14
      Script/AtomicWebViewEditor/clientExtensions/ClientExtensionServices.ts
  63. 8 2
      Script/AtomicWebViewEditor/clientExtensions/ServiceLocator.ts
  64. 2 2
      Script/AtomicWebViewEditor/clientExtensions/languageExtensions/javascript/JavascriptLanguageExtension.ts
  65. 3 3
      Script/AtomicWebViewEditor/clientExtensions/languageExtensions/turbobadger/TurboBadgerLanguageExtension.ts
  66. 9 9
      Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/TypescriptLanguageExtension.ts
  67. 3 3
      Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/workerprocess/workerProcessTypes.ts
  68. 4 4
      Script/AtomicWebViewEditor/editor/editorCommands.ts
  69. 2 1
      Script/Packages/Atomic/Core.json
  70. 31 3
      Script/TypeScript/AtomicWork.d.ts
  71. 72 154
      Script/TypeScript/EditorWork.d.ts
  72. 0 1
      Script/tsconfig.json
  73. 5 1
      Source/Atomic/UI/UIEvents.h
  74. 114 49
      Source/AtomicEditor/EditorMode/AEEditorEvents.h
  75. 16 0
      Source/AtomicEditor/Editors/SceneEditor3D/SceneEditor3DEvents.h
  76. 30 0
      Source/AtomicJS/Javascript/JSAPI.cpp
  77. 25 0
      Source/AtomicJS/Javascript/JSAtomic.cpp
  78. 27 1
      Source/AtomicJS/Javascript/JSCore.cpp
  79. 32 3
      Source/ToolCore/JSBind/JSBEvent.cpp
  80. 4 2
      Source/ToolCore/JSBind/JSBEvent.h
  81. 37 18
      Source/ToolCore/JSBind/JSBTypeScript.cpp
  82. 3 0
      Source/ToolCore/JSBind/JavaScript/JSModuleWriter.cpp
  83. 4 3
      Source/ToolCore/Project/ProjectEvents.h

+ 35 - 37
Script/AtomicEditor/editor/Editor.ts

@@ -21,19 +21,18 @@
 //
 //
 
 
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
-import UIEvents = require("ui/UIEvents");
 import PlayMode = require("ui/playmode/PlayMode");
 import PlayMode = require("ui/playmode/PlayMode");
 import EditorLicense = require("./EditorLicense");
 import EditorLicense = require("./EditorLicense");
 import EditorEvents = require("./EditorEvents");
 import EditorEvents = require("./EditorEvents");
 import Preferences = require("./Preferences");
 import Preferences = require("./Preferences");
 
 
-class Editor extends Atomic.ScriptObject {
+class AtomicEditor extends Atomic.ScriptObject {
 
 
     project: ToolCore.Project;
     project: ToolCore.Project;
     editorLicense: EditorLicense;
     editorLicense: EditorLicense;
     playMode: PlayMode;
     playMode: PlayMode;
 
 
-    static instance: Editor;
+    static instance: AtomicEditor;
 
 
     projectCloseRequested: boolean;
     projectCloseRequested: boolean;
     exitRequested: boolean;
     exitRequested: boolean;
@@ -47,7 +46,7 @@ class Editor extends Atomic.ScriptObject {
 
 
         Atomic.getEngine().autoExit = false;
         Atomic.getEngine().autoExit = false;
 
 
-        Editor.instance = this;
+        AtomicEditor.instance = this;
 
 
         Preferences.getInstance().read();
         Preferences.getInstance().read();
 
 
@@ -61,14 +60,14 @@ class Editor extends Atomic.ScriptObject {
 
 
         Atomic.getResourceCache().autoReloadResources = true;
         Atomic.getResourceCache().autoReloadResources = true;
 
 
-        this.subscribeToEvent(EditorEvents.LoadProject, (data) => this.handleEditorLoadProject(data));
-        this.subscribeToEvent(EditorEvents.CloseProject, (data) => this.handleEditorCloseProject(data));
-        this.subscribeToEvent(EditorEvents.ProjectUnloadedNotification, (data) => {
+        this.subscribeToEvent(Editor.EditorLoadProjectEvent((data) => this.handleEditorLoadProject(data)));
+        this.subscribeToEvent(Editor.EditorCloseProjectEvent((data) => this.handleEditorCloseProject(data)));
+        this.subscribeToEvent(Editor.ProjectUnloadedNotificationEvent((data) => {
             Atomic.graphics.windowTitle = "AtomicEditor";
             Atomic.graphics.windowTitle = "AtomicEditor";
             this.handleProjectUnloaded(data);
             this.handleProjectUnloaded(data);
-        });
+        }));
 
 
-        this.subscribeToEvent("IPCPlayerWindowChanged", (data) => {
+        this.subscribeToEvent(Atomic.ScriptEvent(EditorEvents.IPCPlayerWindowChangedEventType, (data: AtomicApp.IPCPlayerWindowChangedEvent) => {
             var playerWindow = Preferences.getInstance().playerWindow;
             var playerWindow = Preferences.getInstance().playerWindow;
             //if player window is maximized, then we want keep the window size from the previous state
             //if player window is maximized, then we want keep the window size from the previous state
             if (data.maximized) {
             if (data.maximized) {
@@ -80,25 +79,25 @@ class Editor extends Atomic.ScriptObject {
                 playerWindow = {x: data.posX, y: data.posY, width: data.width, height: data.height, monitor: data.monitor, maximized: data.maximized};
                 playerWindow = {x: data.posX, y: data.posY, width: data.width, height: data.height, monitor: data.monitor, maximized: data.maximized};
             }
             }
             Preferences.getInstance().savePlayerWindowData(playerWindow);
             Preferences.getInstance().savePlayerWindowData(playerWindow);
-        });
+        }));
 
 
-        this.subscribeToEvent("ScreenMode", (data:Atomic.ScreenModeEvent) => this.saveWindowPreferences(data));
-        this.subscribeToEvent("WindowPos", (data:Atomic.ScreenModeEvent) => this.saveWindowPreferences(data));
+        this.subscribeToEvent(Atomic.ScreenModeEvent((data) => this.saveWindowPreferences()));
+        this.subscribeToEvent(Atomic.WindowPosEvent((data) => this.saveWindowPreferences()));
 
 
-        this.subscribeToEvent("ExitRequested", (data) => this.handleExitRequested(data));
+        this.subscribeToEvent(Atomic.ExitRequestedEvent((data) => this.handleExitRequested(data)));
 
 
-        this.subscribeToEvent("ProjectLoaded", (data) => {
+        this.subscribeToEvent(ToolCore.ProjectLoadedEvent((data) => {
             Atomic.graphics.windowTitle = "AtomicEditor - " + data.projectPath;
             Atomic.graphics.windowTitle = "AtomicEditor - " + data.projectPath;
             Preferences.getInstance().registerRecentProject(data.projectPath);
             Preferences.getInstance().registerRecentProject(data.projectPath);
-        });
+        }));
 
 
-        this.subscribeToEvent("EditorResourceCloseCanceled", (data) => {
+        this.subscribeToEvent(Editor.EditorResourceCloseCanceledEvent((data) => {
             //if user canceled closing the resource, then user has changes that he doesn't want to lose
             //if user canceled closing the resource, then user has changes that he doesn't want to lose
             //so cancel exit/project close request and unsubscribe from event to avoid closing all the editors again
             //so cancel exit/project close request and unsubscribe from event to avoid closing all the editors again
             this.exitRequested = false;
             this.exitRequested = false;
             this.projectCloseRequested = false;
             this.projectCloseRequested = false;
-            this.unsubscribeFromEvent(EditorEvents.EditorResourceClose);
-        });
+            this.unsubscribeFromEvent(Editor.EditorResourceCloseEventType);
+        }));
 
 
         this.parseArguments();
         this.parseArguments();
     }
     }
@@ -112,7 +111,7 @@ class Editor extends Atomic.ScriptObject {
         ui.setDefaultFont(uiData.fontName, uiData.fontSize);
         ui.setDefaultFont(uiData.fontName, uiData.fontSize);
     }
     }
 
 
-    saveWindowPreferences(data: Atomic.ScreenModeEvent): boolean {
+    saveWindowPreferences(): boolean {
         var graphics = Atomic.getGraphics();
         var graphics = Atomic.getGraphics();
         if (!graphics) return false;
         if (!graphics) return false;
 
 
@@ -161,12 +160,12 @@ class Editor extends Atomic.ScriptObject {
     setUserPreference(extensionName: string, preferenceName: string, value: number | boolean | string) {
     setUserPreference(extensionName: string, preferenceName: string, value: number | boolean | string) {
         Preferences.getInstance().setUserPreference(extensionName, preferenceName, value);
         Preferences.getInstance().setUserPreference(extensionName, preferenceName, value);
         WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ProjectPreferences", JSON.stringify(Preferences.getInstance().cachedProjectPreferences, null, 2 ));
         WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ProjectPreferences", JSON.stringify(Preferences.getInstance().cachedProjectPreferences, null, 2 ));
-        const eventData: EditorEvents.UserPreferencesChangedEvent = {
+        const eventData: Editor.UserPreferencesChangedNotificationEvent = {
             projectPreferences: JSON.stringify(Preferences.getInstance().cachedProjectPreferences),
             projectPreferences: JSON.stringify(Preferences.getInstance().cachedProjectPreferences),
             applicationPreferences: JSON.stringify(Preferences.getInstance().cachedApplicationPreferences)
             applicationPreferences: JSON.stringify(Preferences.getInstance().cachedApplicationPreferences)
         };
         };
 
 
-        this.sendEvent(EditorEvents.UserPreferencesChangedNotification, eventData);
+        this.sendEvent(Editor.UserPreferencesChangedNotificationEventData(eventData));
     }
     }
 
 
     /**
     /**
@@ -179,21 +178,20 @@ class Editor extends Atomic.ScriptObject {
     setUserPreferenceGroup(settingsGroup: string, groupPreferenceValues: Object) {
     setUserPreferenceGroup(settingsGroup: string, groupPreferenceValues: Object) {
         Preferences.getInstance().setUserPreferenceGroup(settingsGroup, groupPreferenceValues);
         Preferences.getInstance().setUserPreferenceGroup(settingsGroup, groupPreferenceValues);
         WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ProjectPreferences", JSON.stringify(Preferences.getInstance().cachedProjectPreferences, null, 2 ));
         WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ProjectPreferences", JSON.stringify(Preferences.getInstance().cachedProjectPreferences, null, 2 ));
-        const eventData: EditorEvents.UserPreferencesChangedEvent = {
+        const eventData: Editor.UserPreferencesChangedNotificationEvent = {
             projectPreferences: JSON.stringify(Preferences.getInstance().cachedProjectPreferences),
             projectPreferences: JSON.stringify(Preferences.getInstance().cachedProjectPreferences),
             applicationPreferences: JSON.stringify(Preferences.getInstance().cachedApplicationPreferences)
             applicationPreferences: JSON.stringify(Preferences.getInstance().cachedApplicationPreferences)
         };
         };
 
 
-        this.sendEvent(EditorEvents.UserPreferencesChangedNotification, eventData);
+        this.sendEvent(Editor.UserPreferencesChangedNotificationEventData(eventData));
     }
     }
 
 
-    handleEditorLoadProject(event: EditorEvents.LoadProjectEvent): boolean {
+    handleEditorLoadProject(event: Editor.LoadProjectNotificationEvent): boolean {
 
 
         var system = ToolCore.getToolSystem();
         var system = ToolCore.getToolSystem();
         if (system.project) {
         if (system.project) {
 
 
-            this.sendEvent(UIEvents.MessageModalEvent,
-                { type: "error", title: "Project already loaded", message: "Project already loaded" });
+            this.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: "Project already loaded", message: "Project already loaded" }));
 
 
             return false;
             return false;
 
 
@@ -203,7 +201,7 @@ class Editor extends Atomic.ScriptObject {
             Preferences.getInstance().loadUserPrefs();
             Preferences.getInstance().loadUserPrefs();
             WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ProjectPreferences", JSON.stringify(Preferences.getInstance().cachedProjectPreferences, null, 2 ));
             WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ProjectPreferences", JSON.stringify(Preferences.getInstance().cachedProjectPreferences, null, 2 ));
             WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ApplicationPreferences", JSON.stringify(Preferences.getInstance().cachedApplicationPreferences, null, 2 ));
             WebView.WebBrowserHost.setGlobalStringProperty("HOST_Preferences", "ApplicationPreferences", JSON.stringify(Preferences.getInstance().cachedApplicationPreferences, null, 2 ));
-            this.sendEvent(EditorEvents.LoadProjectNotification, event);
+            this.sendEvent(Editor.LoadProjectNotificationEventData(event));
         }
         }
         return loaded;
         return loaded;
     }
     }
@@ -219,35 +217,35 @@ class Editor extends Atomic.ScriptObject {
           return;
           return;
         }
         }
         //wait when we close resource editor to check another resource editor for unsaved changes and close it
         //wait when we close resource editor to check another resource editor for unsaved changes and close it
-        this.subscribeToEvent(EditorEvents.EditorResourceClose, (data) => {
+        this.subscribeToEvent(Editor.EditorResourceCloseEvent((data) => {
             this.closeAllResourceEditors();
             this.closeAllResourceEditors();
-        });
+        }));
         editor.requestClose();
         editor.requestClose();
     }
     }
 
 
-    handleEditorCloseProject(event) {
+    handleEditorCloseProject(event: Editor.ProjectUnloadedNotificationEvent) {
         this.projectCloseRequested = true;
         this.projectCloseRequested = true;
-        this.sendEvent(EditorEvents.ProjectUnloadedNotification, event);
+        this.sendEvent(Editor.ProjectUnloadedNotificationEventData());
         this.closeAllResourceEditors();
         this.closeAllResourceEditors();
     }
     }
 
 
     closeProject() {
     closeProject() {
-        this.sendEvent("IPCPlayerExitRequest");
+        this.sendEvent(EditorEvents.IPCPlayerExitRequestEventType);
         var system = ToolCore.getToolSystem();
         var system = ToolCore.getToolSystem();
 
 
         if (system.project) {
         if (system.project) {
 
 
             system.closeProject();
             system.closeProject();
-            this.sendEvent(EditorEvents.ProjectClosed);
+            this.sendEvent(Editor.EditorProjectClosedEventType);
             this.projectCloseRequested = false;
             this.projectCloseRequested = false;
-            this.unsubscribeFromEvent(EditorEvents.EditorResourceClose);
+            this.unsubscribeFromEvent(Editor.EditorResourceCloseEventType);
         }
         }
 
 
     }
     }
 
 
     handleProjectUnloaded(event) {
     handleProjectUnloaded(event) {
 
 
-        this.sendEvent(EditorEvents.ActiveSceneEditorChange, { sceneEditor: null });
+        this.sendEvent(Editor.EditorActiveSceneEditorChangeEventData({ sceneEditor: null }));
 
 
     }
     }
 
 
@@ -261,7 +259,7 @@ class Editor extends Atomic.ScriptObject {
 
 
             if (args[idx] == "--project") {
             if (args[idx] == "--project") {
 
 
-                this.sendEvent(EditorEvents.LoadProject, { path: args[idx + 1] });
+                this.sendEvent(Editor.EditorLoadProjectEventData({ path: args[idx + 1] }));
 
 
             }
             }
 
 
@@ -287,4 +285,4 @@ class Editor extends Atomic.ScriptObject {
 
 
 }
 }
 
 
-export = Editor;
+export default AtomicEditor;

+ 6 - 164
Script/AtomicEditor/editor/EditorEvents.ts

@@ -20,167 +20,9 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-// TODO: migrate these interfaces out to the d.ts and migrate the static strings to some common location
-export const ModalError = "ModalError";
-export interface ModalErrorEvent {
-
-  title: string;
-  message: string;
-
-}
-export const PlayerStartRequest = "EditorPlayRequest";
-export const PlayerStarted = "EditorPlayerStarted";
-export const PlayerStopped = "EditorPlayerStopped";
-export const PlayerPaused = "EditorPlayerPaused";
-export const PlayerResumed = "EditorPlayerResumed";
-export const PlayerLog = "EditorPlayerLog";
-export interface PlayerLogEvent {
-
-  message: string;
-  level: number;
-
-}
-
-
-export const ActiveSceneEditorChange = "EditorActiveSceneEditorChange";
-export interface ActiveSceneEditorChangeEvent {
-
-  sceneEditor: Editor.SceneEditor3D;
-
-}
-
-
-export const SceneClosed = "EditorSceneClosed";
-export interface SceneClosedEvent {
-
-  scene: Atomic.Scene;
-
-}
-
-export const ContentFolderChanged = "ContentFolderChanged";
-export interface ContentFolderChangedEvent {
-
-  path: string;
-
-}
-
-export const CloseProject = "EditorCloseProject";
-export const ProjectClosed = "EditorProjectClosed";
-export const ProjectUnloadedNotification = "ProjectUnloadedNotification";
-
-export const RequestProjectLoad = "RequestProjectLoad";
-export interface RequestProjectLoadEvent {
-
-  // The full path to the .atomic file
-  path: string;
-
-}
-
-export const LoadProject = "EditorLoadProject";
-export const LoadProjectNotification = "EditorLoadProjectNotification";
-export interface LoadProjectEvent {
-
-  // The full path to the .atomic file
-  path: string;
-
-}
-
-export const SaveAllResources = "EditorSaveAllResources";
-
-export const SaveResource = "EditorSaveResource";
-/**
- * Called once the resource has been saved
- * @type {String}
- */
-export const SaveResourceNotification = "EditorSaveResourceNotification";
-export interface SaveResourceEvent {
-
-  // The full path to the resource to save / empty or undefined for current
-  path: string;
-
-}
-
-export const EditorResourceClose = "EditorResourceClose";
-export interface EditorCloseResourceEvent {
-
-  editor:Editor.ResourceEditor;
-  navigateToAvailableResource:boolean;
-
-}
-
-export const EditResource = "EditorEditResource";
-export interface EditResourceEvent {
-
-  // The full path to the resource to edit
-  path: string;
-
-}
-
-export const DeleteResource = "EditorDeleteResource";
-/**
- * Called once the resource has been deleted
- * @type {String}
- */
-export const DeleteResourceNotification = "DeleteResourceNotification";
-export interface DeleteResourceEvent {
-
-  // The full path to the resource to edit
-  path: string;
-
-}
-
-export const RenameResource = "EditorRenameResource";
-/**
- * Called once the resource has been renamed
- * @type {String}
- */
-export const RenameResourceNotification = "RenameResourceNotification";
-export interface RenameResourceEvent {
-
-  // The full path to the resource to edit
-  path: string;
-  newPath: string;
-  newName: string;
-
-  // the asset to delete
-  asset: ToolCore.Asset;
-}
-
-export const SceneEditStateChange = "SceneEditStateChange";
-export interface SceneEditStateChangeEvent {
-
-  serializable: Atomic.Serializable;
-
-}
-
-export const InspectorProjectReference = "InspectorProjectReference";
-export interface InspectorProjectReferenceEvent {
-
-    // The full path to the resource to edit
-    path: string;
-
-}
-
-export const UserPreferencesChangedNotification  = "UserPreferencesChangedNotification";
-export interface UserPreferencesChangedEvent {
-    /**
-     * JSON string of the project preferences
-     */
-    projectPreferences: string;
-
-    /**
-     * JSON string of the application preferences
-     */
-    applicationPreferences: string;
-}
-
-export const WebViewLoadEnd = "WebViewLoadEnd";
-export const WebMessage = "WebMessage";
-
-// interface to pass modal error messages from core modules
-export const EditorModal = "EditorModal";
-export interface EditorModalEvent {
-    uiType: number;     // EDITOR_ERROR_MODAL, etc)
-    title: string;      // for modal errors, title text
-    message: string;    // for modal errors, error text
-}
+// These are exposed in AtomicApp, but that module is not available to call until the player is playing
+// but we need the event names
+export const IPCPlayerExitRequestEventType: Atomic.EventType = "IPCPlayerExitRequest";
+export const IPCPlayerWindowChangedEventType: Atomic.EventType = "IPCPlayerWindowChanged";
+export const IPCPlayerPauseResumeRequestEventType: Atomic.EventType = "IPCPlayerPauseResumeRequest";
+export const IPCPlayerPauseStepRequestEventType: Atomic.EventType = "IPCPlayerPauseStepRequest";

+ 2 - 2
Script/AtomicEditor/editor/EditorLicense.ts

@@ -29,8 +29,8 @@ class EditorLicense extends Atomic.ScriptObject {
 
 
         super();
         super();
 
 
-        this.subscribeToEvent("LicenseEulaRequired", (eventData) => this.handleLicenseEulaRequired(eventData));
-        this.subscribeToEvent("LicenseEulaAccepted", (eventData) => this.handleLicenseEulaAccepted(eventData));
+        this.subscribeToEvent(ToolCore.LicenseEulaRequiredEvent((eventData) => this.handleLicenseEulaRequired(eventData)));
+        this.subscribeToEvent(ToolCore.LicenseEulaAcceptedEvent((eventData) => this.handleLicenseEulaAccepted(eventData)));
 
 
     }
     }
 
 

+ 19 - 21
Script/AtomicEditor/hostExtensions/HostExtensionServices.ts

@@ -20,13 +20,11 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import * as EditorEvents from "../editor/EditorEvents";
 import * as EditorUI from "../ui/EditorUI";
 import * as EditorUI from "../ui/EditorUI";
 import MainFrame = require("../ui/frames/MainFrame");
 import MainFrame = require("../ui/frames/MainFrame");
 import InspectorFrame = require("../ui/frames/inspector/InspectorFrame");
 import InspectorFrame = require("../ui/frames/inspector/InspectorFrame");
 import ModalOps = require("../ui/modal/ModalOps");
 import ModalOps = require("../ui/modal/ModalOps");
 import ResourceOps = require("../resources/ResourceOps");
 import ResourceOps = require("../resources/ResourceOps");
-import Editor = require("../editor/Editor");
 
 
 /**
 /**
  * Generic registry for storing Editor Extension Services
  * Generic registry for storing Editor Extension Services
@@ -71,9 +69,9 @@ export class ProjectServicesProvider extends ServicesProvider<Editor.HostExtensi
      * @param  {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
      * @param  {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
      */
      */
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
-        eventDispatcher.subscribeToEvent(EditorEvents.LoadProjectNotification, (ev) => this.projectLoaded(ev));
-        eventDispatcher.subscribeToEvent(EditorEvents.CloseProject, (ev) => this.projectUnloaded(ev));
-        eventDispatcher.subscribeToEvent(EditorEvents.PlayerStartRequest, () => this.playerStarted());
+        eventDispatcher.subscribeToEvent(Editor.LoadProjectNotificationEvent((ev) => this.projectLoaded(ev)));
+        eventDispatcher.subscribeToEvent(Editor.EditorCloseProjectEvent((ev) => this.projectUnloaded(ev)));
+        eventDispatcher.subscribeToEvent(Editor.EditorPlayRequestEvent(() => this.playerStarted()));
     }
     }
 
 
     /**
     /**
@@ -99,7 +97,7 @@ export class ProjectServicesProvider extends ServicesProvider<Editor.HostExtensi
      * Called when the project is loaded
      * Called when the project is loaded
      * @param  {[type]} data Event info from the project unloaded event
      * @param  {[type]} data Event info from the project unloaded event
      */
      */
-    projectLoaded(ev: Editor.EditorEvents.LoadProjectEvent) {
+    projectLoaded(ev: Editor.EditorLoadProjectEvent) {
         // Need to use a for loop and don't cache the length because the list of services *may* change while processing.  Extensions could be appended to the end
         // Need to use a for loop and don't cache the length because the list of services *may* change while processing.  Extensions could be appended to the end
         for (let i = 0; i < this.registeredServices.length; i++) {
         for (let i = 0; i < this.registeredServices.length; i++) {
             let service = this.registeredServices[i];
             let service = this.registeredServices[i];
@@ -177,10 +175,10 @@ export class ResourceServicesProvider extends ServicesProvider<Editor.HostExtens
      * @param  {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
      * @param  {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
      */
      */
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
-        eventDispatcher.subscribeToEvent(EditorEvents.SaveResourceNotification, (ev) => this.saveResource(ev));
-        eventDispatcher.subscribeToEvent(EditorEvents.DeleteResourceNotification, (ev) => this.deleteResource(ev));
-        eventDispatcher.subscribeToEvent(EditorEvents.RenameResourceNotification, (ev) => this.renameResource(ev));
-        eventDispatcher.subscribeToEvent(EditorEvents.EditResource, (ev) => this.editResource(ev));
+        eventDispatcher.subscribeToEvent(Editor.EditorSaveResourceNotificationEvent((ev) => this.saveResource(ev)));
+        eventDispatcher.subscribeToEvent(Editor.EditorDeleteResourceNotificationEvent((ev) => this.deleteResource(ev)));
+        eventDispatcher.subscribeToEvent(Editor.EditorRenameResourceNotificationEvent((ev) => this.renameResource(ev)));
+        eventDispatcher.subscribeToEvent(Editor.EditorEditResourceEvent((ev) => this.editResource(ev)));
 
 
     }
     }
 
 
@@ -188,7 +186,7 @@ export class ResourceServicesProvider extends ServicesProvider<Editor.HostExtens
      * Called after a resource has been saved
      * Called after a resource has been saved
      * @param  {Editor.EditorEvents.SaveResourceEvent} ev
      * @param  {Editor.EditorEvents.SaveResourceEvent} ev
      */
      */
-    saveResource(ev: Editor.EditorEvents.SaveResourceEvent) {
+    saveResource(ev: Editor.EditorSaveResourceEvent) {
         // run through and find any services that can handle this.
         // run through and find any services that can handle this.
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
@@ -205,7 +203,7 @@ export class ResourceServicesProvider extends ServicesProvider<Editor.HostExtens
     /**
     /**
      * Called when a resource has been deleted
      * Called when a resource has been deleted
      */
      */
-    deleteResource(ev: Editor.EditorEvents.DeleteResourceEvent) {
+    deleteResource(ev: Editor.EditorDeleteResourceEvent) {
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
                 // Verify that the service contains the appropriate methods and that it can delete
                 // Verify that the service contains the appropriate methods and that it can delete
@@ -220,9 +218,9 @@ export class ResourceServicesProvider extends ServicesProvider<Editor.HostExtens
 
 
     /**
     /**
      * Called when a resource has been renamed
      * Called when a resource has been renamed
-     * @param  {Editor.EditorEvents.RenameResourceEvent} ev
+     * @param  ev
      */
      */
-    renameResource(ev: Editor.EditorEvents.RenameResourceEvent) {
+    renameResource(ev: Editor.EditorRenameResourceNotificationEvent) {
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
                 // Verify that the service contains the appropriate methods and that it can handle the rename
                 // Verify that the service contains the appropriate methods and that it can handle the rename
@@ -239,7 +237,7 @@ export class ResourceServicesProvider extends ServicesProvider<Editor.HostExtens
      * Called when a resource is about to be edited
      * Called when a resource is about to be edited
      * @param  {Editor.EditorEvents.EditResourceEvent} ev
      * @param  {Editor.EditorEvents.EditResourceEvent} ev
      */
      */
-    editResource(ev: Editor.EditorEvents.EditResourceEvent) {
+    editResource(ev: Editor.EditorEditResourceEvent) {
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
                 // Verify that the service contains the appropriate methods and that it can handle the edit
                 // Verify that the service contains the appropriate methods and that it can handle the edit
@@ -277,15 +275,15 @@ export class SceneServicesProvider extends ServicesProvider<Editor.HostExtension
      * @param  {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
      * @param  {Atomic.UIWidget} topLevelWindow The top level window that will be receiving these events
      */
      */
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
-        eventDispatcher.subscribeToEvent(EditorEvents.ActiveSceneEditorChange, (ev) => this.activeSceneEditorChange(ev));
-        eventDispatcher.subscribeToEvent(EditorEvents.SceneClosed, (ev) => this.sceneClosed(ev));
+        eventDispatcher.subscribeToEvent(Editor.EditorActiveSceneEditorChangeEvent((ev) => this.activeSceneEditorChange(ev)));
+        eventDispatcher.subscribeToEvent(Editor.EditorSceneClosedEvent((ev) => this.sceneClosed(ev)));
     }
     }
 
 
     /**
     /**
      * Called after an active scene editor change
      * Called after an active scene editor change
      * @param  {Editor.EditorEvents.ActiveSceneEditorChangeEvent} ev
      * @param  {Editor.EditorEvents.ActiveSceneEditorChangeEvent} ev
      */
      */
-    activeSceneEditorChange(ev: Editor.EditorEvents.ActiveSceneEditorChangeEvent) {
+    activeSceneEditorChange(ev: Editor.EditorActiveSceneEditorChangeEvent) {
         // run through and find any services that can handle this.
         // run through and find any services that can handle this.
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
@@ -303,7 +301,7 @@ export class SceneServicesProvider extends ServicesProvider<Editor.HostExtension
      * Called after a scene is closed
      * Called after a scene is closed
      * @param  {Editor.EditorEvents.SceneClosedEvent} ev
      * @param  {Editor.EditorEvents.SceneClosedEvent} ev
      */
      */
-    sceneClosed(ev: Editor.EditorEvents.SceneClosedEvent) {
+    sceneClosed(ev: Editor.EditorSceneClosedEvent) {
         // run through and find any services that can handle this.
         // run through and find any services that can handle this.
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
@@ -567,7 +565,7 @@ export class UIServicesProvider extends ServicesProvider<Editor.HostExtensions.U
      * Hooks into web messages coming in from web views
      * Hooks into web messages coming in from web views
      * @param  {[String|Object]} data
      * @param  {[String|Object]} data
      */
      */
-    handleWebMessage(data) {
+    handleWebMessage(data: WebView.WebMessageEvent) {
         let messageType;
         let messageType;
         let messageObject;
         let messageObject;
 
 
@@ -598,6 +596,6 @@ export class UIServicesProvider extends ServicesProvider<Editor.HostExtensions.U
      */
      */
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
     subscribeToEvents(eventDispatcher: Editor.Extensions.EventDispatcher) {
         // Placeholder for when UI events published by the editor need to be listened for
         // Placeholder for when UI events published by the editor need to be listened for
-        eventDispatcher.subscribeToEvent(EditorEvents.WebMessage, (ev) => this.handleWebMessage(ev));
+        eventDispatcher.subscribeToEvent(WebView.WebMessageEvent((ev) => this.handleWebMessage(ev)));
     }
     }
 }
 }

+ 10 - 2
Script/AtomicEditor/hostExtensions/ServiceLocator.ts

@@ -81,10 +81,18 @@ export class ServiceLocatorType implements Editor.HostExtensions.HostServiceLoca
      * Subscribe to an event and provide a callback.  This can be used by services to subscribe to custom events
      * Subscribe to an event and provide a callback.  This can be used by services to subscribe to custom events
      * @param  {string} eventType
      * @param  {string} eventType
      * @param  {any} callback
      * @param  {any} callback
+     * or
+     * @param {Atomic.EventMetaData} wrappedEvent A Atomic pre-wrapped event object
      */
      */
-    subscribeToEvent(eventType: string, callback: (data: any) => void) {
+    subscribeToEvent(eventType: string, callback: (data: any) => void);
+    subscribeToEvent(wrappedEvent: Atomic.EventMetaData);
+    subscribeToEvent(eventTypeOrWrapped: any, callback?: any) {
         if (this.eventDispatcher) {
         if (this.eventDispatcher) {
-            this.eventDispatcher.subscribeToEvent(eventType, callback);
+            if (callback) {
+                this.eventDispatcher.subscribeToEvent(eventTypeOrWrapped, callback);
+            } else {
+                this.eventDispatcher.subscribeToEvent(eventTypeOrWrapped);
+            }
         }
         }
     }
     }
 }
 }

+ 1 - 3
Script/AtomicEditor/hostExtensions/coreExtensions/ProjectBasedExtensionLoader.ts

@@ -22,8 +22,6 @@
 
 
 /// <reference path="../../../TypeScript/duktape.d.ts" />
 /// <reference path="../../../TypeScript/duktape.d.ts" />
 
 
-import * as EditorEvents from "../../editor/EditorEvents";
-
 /**
 /**
  * Resource extension that supports the web view typescript extension
  * Resource extension that supports the web view typescript extension
  */
  */
@@ -97,7 +95,7 @@ export default class ProjectBasedExtensionLoader implements Editor.HostExtension
      * Called when the project is being loaded to allow the typescript language service to reset and
      * Called when the project is being loaded to allow the typescript language service to reset and
      * possibly compile
      * possibly compile
      */
      */
-    projectLoaded(ev: Editor.EditorEvents.LoadProjectEvent) {
+    projectLoaded(ev: Editor.EditorLoadProjectEvent) {
         // got a load, we need to reset the language service
         // got a load, we need to reset the language service
         console.log(`${this.name}: received a project loaded event for project at ${ev.path}`);
         console.log(`${this.name}: received a project loaded event for project at ${ev.path}`);
         let system = ToolCore.getToolSystem();
         let system = ToolCore.getToolSystem();

+ 9 - 10
Script/AtomicEditor/hostExtensions/languageExtensions/CSharpLanguageExtension.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import * as EditorEvents from "../../editor/EditorEvents";
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 
 
 /**
 /**
@@ -95,7 +94,7 @@ export default class CSharpLanguageExtension implements Editor.HostExtensions.Re
     * This could be when someone adds a CS or assembly file to a vanilla project
     * This could be when someone adds a CS or assembly file to a vanilla project
     * @param  {Editor.EditorEvents.EditResourceEvent} ev
     * @param  {Editor.EditorEvents.EditResourceEvent} ev
     */
     */
-    edit(ev: Editor.EditorEvents.EditResourceEvent) {
+    edit(ev: Editor.EditorEditResourceEvent) {
         if (this.isValidFiletype(ev.path)) {
         if (this.isValidFiletype(ev.path)) {
 
 
             if (this.isNETProject) {
             if (this.isNETProject) {
@@ -106,17 +105,17 @@ export default class CSharpLanguageExtension implements Editor.HostExtensions.Re
 
 
     /**
     /**
     * Handle the delete.  This should delete the corresponding javascript file
     * Handle the delete.  This should delete the corresponding javascript file
-    * @param  {Editor.EditorEvents.DeleteResourceEvent} ev
+    * @param  {Editor.EditorDeleteResourceEvent} ev
     */
     */
-    delete(ev: Editor.EditorEvents.DeleteResourceEvent) {
+    delete(ev: Editor.EditorDeleteResourceEvent) {
 
 
     }
     }
 
 
     /**
     /**
     * Handle the rename.  Should rename the corresponding .js file
     * Handle the rename.  Should rename the corresponding .js file
-    * @param  {Editor.EditorEvents.RenameResourceEvent} ev
+    * @param  {Editor.EditorRenameResourceNotificationEvent} ev
     */
     */
-    rename(ev: Editor.EditorEvents.RenameResourceEvent) {
+    rename(ev: Editor.EditorRenameResourceNotificationEvent) {
 
 
     }
     }
 
 
@@ -125,7 +124,7 @@ export default class CSharpLanguageExtension implements Editor.HostExtensions.Re
     * @param  {Editor.EditorEvents.SaveResourceEvent} ev
     * @param  {Editor.EditorEvents.SaveResourceEvent} ev
     * @return {[type]}
     * @return {[type]}
     */
     */
-    save(ev: Editor.EditorEvents.SaveResourceEvent) {
+    save(ev: Editor.EditorSaveResourceEvent) {
 
 
         if (Atomic.getExtension(ev.path) != ".cs") {
         if (Atomic.getExtension(ev.path) != ".cs") {
             return;
             return;
@@ -144,7 +143,7 @@ export default class CSharpLanguageExtension implements Editor.HostExtensions.Re
     * Called when the project is being loaded to allow the typescript language service to reset and
     * Called when the project is being loaded to allow the typescript language service to reset and
     * possibly compile
     * possibly compile
     */
     */
-    projectLoaded(ev: Editor.EditorEvents.LoadProjectEvent) {
+    projectLoaded(ev: Editor.EditorLoadProjectEvent) {
         // got a load, we need to reset the language service
         // got a load, we need to reset the language service
         this.isNETProject = false;
         this.isNETProject = false;
 
 
@@ -162,7 +161,7 @@ export default class CSharpLanguageExtension implements Editor.HostExtensions.Re
             this.isNETProject = true;
             this.isNETProject = true;
             this.configureNETProjectMenu();
             this.configureNETProjectMenu();
 
 
-            this.eventObject.subscribeToEvent("NETBuildResult", (eventData:ToolCore.NETBuildResultEvent) => {
+            this.eventObject.subscribeToEvent(ToolCore.NETBuildResultEvent((eventData:ToolCore.NETBuildResultEvent) => {
 
 
                 if (!eventData.success) {
                 if (!eventData.success) {
 
 
@@ -182,7 +181,7 @@ export default class CSharpLanguageExtension implements Editor.HostExtensions.Re
 
 
                 }
                 }
 
 
-            });
+            }));
         }
         }
     }
     }
 
 

+ 13 - 16
Script/AtomicEditor/hostExtensions/languageExtensions/TypescriptLanguageExtension.ts

@@ -20,8 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import * as EditorEvents from "../../editor/EditorEvents";
-
 /**
 /**
  * Default compiler options to use for compilation.  If there
  * Default compiler options to use for compilation.  If there
  * is a compiler option block in a tsconfig.json located in the project,
  * is a compiler option block in a tsconfig.json located in the project,
@@ -199,9 +197,9 @@ export default class TypescriptLanguageExtension implements Editor.HostExtension
     /**
     /**
      * Handle when a new file is loaded and we have not yet configured the editor for TS.
      * Handle when a new file is loaded and we have not yet configured the editor for TS.
      * This could be when someone adds a TS file to a vanilla project
      * This could be when someone adds a TS file to a vanilla project
-     * @param  {Editor.EditorEvents.EditResourceEvent} ev
+     * @param  {Editor.EditorEditResourceEvent} ev
      */
      */
-    edit(ev: Editor.EditorEvents.EditResourceEvent) {
+    edit(ev: Editor.EditorEditResourceEvent) {
         if (this.isValidFiletype(ev.path)) {
         if (this.isValidFiletype(ev.path)) {
             // update ts config in case we have a new resource
             // update ts config in case we have a new resource
             let tsConfig = this.buildTsConfig();
             let tsConfig = this.buildTsConfig();
@@ -215,9 +213,9 @@ export default class TypescriptLanguageExtension implements Editor.HostExtension
 
 
     /**
     /**
      * Handle the delete.  This should delete the corresponding javascript file
      * Handle the delete.  This should delete the corresponding javascript file
-     * @param  {Editor.EditorEvents.DeleteResourceEvent} ev
+     * @param  {Editor.EditorDeleteResourceEvent} ev
      */
      */
-    delete(ev: Editor.EditorEvents.DeleteResourceEvent) {
+    delete(ev: Editor.EditorDeleteResourceEvent) {
         if (this.isValidFiletype(ev.path)) {
         if (this.isValidFiletype(ev.path)) {
             // console.log(`${this.name}: received a delete resource event`);
             // console.log(`${this.name}: received a delete resource event`);
 
 
@@ -228,21 +226,21 @@ export default class TypescriptLanguageExtension implements Editor.HostExtension
                 console.log(`${this.name}: deleting corresponding .js file`);
                 console.log(`${this.name}: deleting corresponding .js file`);
                 ToolCore.assetDatabase.deleteAsset(jsFileAsset);
                 ToolCore.assetDatabase.deleteAsset(jsFileAsset);
 
 
-                let eventData: EditorEvents.DeleteResourceEvent = {
+                let eventData : Editor.EditorDeleteResourceNotificationEvent = {
                     path: jsFile
                     path: jsFile
                 };
                 };
 
 
                 this.setTsConfigOnWebView(this.buildTsConfig());
                 this.setTsConfigOnWebView(this.buildTsConfig());
-                this.serviceRegistry.sendEvent(EditorEvents.DeleteResourceNotification, eventData);
+                this.serviceRegistry.sendEvent<Editor.EditorDeleteResourceNotificationEvent>(Editor.EditorDeleteResourceNotificationEventType, eventData);
             }
             }
         }
         }
     }
     }
 
 
     /**
     /**
      * Handle the rename.  Should rename the corresponding .js file
      * Handle the rename.  Should rename the corresponding .js file
-     * @param  {Editor.EditorEvents.RenameResourceEvent} ev
+     * @param  {Editor.EditorRenameResourceNotificationEvent} ev
      */
      */
-    rename(ev: Editor.EditorEvents.RenameResourceEvent) {
+    rename(ev: Editor.EditorRenameResourceNotificationEvent) {
         if (this.isValidFiletype(ev.path)) {
         if (this.isValidFiletype(ev.path)) {
             // console.log(`${this.name}: received a rename resource event`);
             // console.log(`${this.name}: received a rename resource event`);
 
 
@@ -254,7 +252,7 @@ export default class TypescriptLanguageExtension implements Editor.HostExtension
                 console.log(`${this.name}: renaming corresponding .js file`);
                 console.log(`${this.name}: renaming corresponding .js file`);
                 jsFileAsset.rename(ev.newName);
                 jsFileAsset.rename(ev.newName);
 
 
-                let eventData: EditorEvents.RenameResourceEvent = {
+                let eventData: Editor.EditorRenameResourceNotificationEvent = {
                     path: jsFile,
                     path: jsFile,
                     newPath: jsFileNew,
                     newPath: jsFileNew,
                     newName: ev.newName,
                     newName: ev.newName,
@@ -262,17 +260,16 @@ export default class TypescriptLanguageExtension implements Editor.HostExtension
                 };
                 };
 
 
                 this.setTsConfigOnWebView(this.buildTsConfig());
                 this.setTsConfigOnWebView(this.buildTsConfig());
-                this.serviceRegistry.sendEvent(EditorEvents.RenameResourceNotification, eventData);
+                this.serviceRegistry.sendEvent<Editor.EditorRenameResourceNotificationEvent>(Editor.EditorRenameResourceNotificationEventType, eventData);
             }
             }
         }
         }
     }
     }
 
 
     /**
     /**
      * Handles the save event and detects if a typescript file has been added to a non-typescript project
      * Handles the save event and detects if a typescript file has been added to a non-typescript project
-     * @param  {Editor.EditorEvents.SaveResourceEvent} ev
-     * @return {[type]}
+     * @param  ev
      */
      */
-    save(ev: Editor.EditorEvents.SaveResourceEvent) {
+    save(ev: Editor.EditorSaveResourceEvent) {
         // let's check to see if we have created a typescript file
         // let's check to see if we have created a typescript file
         if (!this.isTypescriptProject) {
         if (!this.isTypescriptProject) {
             if (Atomic.getExtension(ev.path) == ".ts") {
             if (Atomic.getExtension(ev.path) == ".ts") {
@@ -288,7 +285,7 @@ export default class TypescriptLanguageExtension implements Editor.HostExtension
      * Called when the project is being loaded to allow the typescript language service to reset and
      * Called when the project is being loaded to allow the typescript language service to reset and
      * possibly compile
      * possibly compile
      */
      */
-    projectLoaded(ev: Editor.EditorEvents.LoadProjectEvent) {
+    projectLoaded(ev: Editor.EditorLoadProjectEvent) {
         // got a load, we need to reset the language service
         // got a load, we need to reset the language service
         this.isTypescriptProject = false;
         this.isTypescriptProject = false;
         //scan all the files in the project for any typescript files so we can determine if this is a typescript project
         //scan all the files in the project for any typescript files so we can determine if this is a typescript project

+ 1 - 1
Script/AtomicEditor/main.ts

@@ -25,7 +25,7 @@
 /// <reference path="../TypeScript/Editor.d.ts" />
 /// <reference path="../TypeScript/Editor.d.ts" />
 /// <reference path="../TypeScript/AtomicWork.d.ts" />
 /// <reference path="../TypeScript/AtomicWork.d.ts" />
 
 
-import Editor = require("editor/Editor");
+import Editor from "editor/Editor";
 
 
 class Main {
 class Main {
 
 

+ 23 - 24
Script/AtomicEditor/resources/ResourceOps.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("../editor/EditorEvents");
 import EditorUI = require("../ui/EditorUI");
 import EditorUI = require("../ui/EditorUI");
 import ProjectTemplates = require("ProjectTemplates");
 import ProjectTemplates = require("ProjectTemplates");
 
 
@@ -30,22 +29,22 @@ class ResourceOps extends Atomic.ScriptObject {
 
 
         super();
         super();
 
 
-        this.subscribeToEvent("AssetImportError", (ev: ToolCore.AssetImportErrorEvent) => {
+        this.subscribeToEvent(ToolCore.AssetImportErrorEvent((ev: ToolCore.AssetImportErrorEvent) => {
 
 
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: "Asset Import Error", message: ev.error });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: "Asset Import Error", message: ev.error }));
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent(EditorEvents.RequestProjectLoad, (ev: EditorEvents.RequestProjectLoadEvent) => { this.handleRequestProjectLoad(ev); });
+        this.subscribeToEvent(Editor.RequestProjectLoadEvent((ev: Editor.RequestProjectLoadEvent) => { this.handleRequestProjectLoad(ev); }));
 
 
     }
     }
 
 
-    handleRequestProjectLoad(ev:EditorEvents.RequestProjectLoadEvent) {
+    handleRequestProjectLoad(ev:Editor.RequestProjectLoadEvent) {
 
 
         var fs = Atomic.fileSystem;
         var fs = Atomic.fileSystem;
         var projectPath = Atomic.addTrailingSlash(Atomic.getPath(ev.path));
         var projectPath = Atomic.addTrailingSlash(Atomic.getPath(ev.path));
 
 
-        var openProject = () => this.sendEvent(EditorEvents.LoadProject, { path: ev.path });
+        var openProject = () => this.sendEvent(Editor.EditorLoadProjectEventData({ path: ev.path }));
 
 
         // Check whether there is a cache folder, if so, this project has been loaded before
         // Check whether there is a cache folder, if so, this project has been loaded before
         if (Atomic.fileSystem.dirExists(projectPath + "Cache")) {
         if (Atomic.fileSystem.dirExists(projectPath + "Cache")) {
@@ -116,7 +115,7 @@ export function CreateNewFolder(resourcePath: string, reportError: boolean = tru
 
 
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Already exists: " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Already exists: " + resourcePath }));
         return false;
         return false;
 
 
     }
     }
@@ -124,7 +123,7 @@ export function CreateNewFolder(resourcePath: string, reportError: boolean = tru
     if (!fs.createDir(resourcePath)) {
     if (!fs.createDir(resourcePath)) {
 
 
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Could not create " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Could not create " + resourcePath }));
 
 
         return false;
         return false;
     }
     }
@@ -144,7 +143,7 @@ export function CreateNewComponent(resourcePath: string, componentName: string,
 
 
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Already exists: " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Already exists: " + resourcePath }));
         return false;
         return false;
 
 
     }
     }
@@ -155,7 +154,7 @@ export function CreateNewComponent(resourcePath: string, componentName: string,
     if (!file) {
     if (!file) {
 
 
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed to open template: " + templateFilename });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed to open template: " + templateFilename }));
         return false;
         return false;
 
 
     }
     }
@@ -166,7 +165,7 @@ export function CreateNewComponent(resourcePath: string, componentName: string,
 
 
     if (!success) {
     if (!success) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath }));
         return false;
         return false;
     }
     }
 
 
@@ -184,7 +183,7 @@ export function CreateNewScript(resourcePath: string, scriptName: string, templa
 
 
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Already exists: " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Already exists: " + resourcePath }));
         return false;
         return false;
 
 
     }
     }
@@ -195,7 +194,7 @@ export function CreateNewScript(resourcePath: string, scriptName: string, templa
     if (!file) {
     if (!file) {
 
 
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed to open template: " + templateFilename });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed to open template: " + templateFilename }));
         return false;
         return false;
 
 
     }
     }
@@ -206,7 +205,7 @@ export function CreateNewScript(resourcePath: string, scriptName: string, templa
 
 
     if (!success) {
     if (!success) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath }));
         return false;
         return false;
     }
     }
 
 
@@ -224,7 +223,7 @@ export function CreateNewScene(resourcePath: string, sceneName: string, reportEr
 
 
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Already exists: " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Already exists: " + resourcePath }));
         return false;
         return false;
 
 
     }
     }
@@ -235,7 +234,7 @@ export function CreateNewScene(resourcePath: string, sceneName: string, reportEr
     if (!file) {
     if (!file) {
 
 
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed to open template: " + templateFilename });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed to open template: " + templateFilename }));
         return false;
         return false;
 
 
     }
     }
@@ -246,7 +245,7 @@ export function CreateNewScene(resourcePath: string, sceneName: string, reportEr
 
 
     if (!success) {
     if (!success) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath }));
         return false;
         return false;
     }
     }
 
 
@@ -264,7 +263,7 @@ export function CreateNewMaterial(resourcePath: string, materialName: string, re
 
 
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
     if (fs.dirExists(resourcePath) || fs.fileExists(resourcePath)) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Already exists: " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Already exists: " + resourcePath }));
         return false;
         return false;
 
 
     }
     }
@@ -275,7 +274,7 @@ export function CreateNewMaterial(resourcePath: string, materialName: string, re
     if (!file) {
     if (!file) {
 
 
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed to open template: " + templateFilename });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed to open template: " + templateFilename }));
         return false;
         return false;
 
 
     }
     }
@@ -286,7 +285,7 @@ export function CreateNewMaterial(resourcePath: string, materialName: string, re
 
 
     if (!success) {
     if (!success) {
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed template copy: " + templateFilename + " -> " + resourcePath }));
         return false;
         return false;
     }
     }
 
 
@@ -308,7 +307,7 @@ export function CreateNewAnimationPreviewScene(reportError: boolean = true): boo
     if (!templateFile) {
     if (!templateFile) {
 
 
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed to open template scene: " + templateFile });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed to open template scene: " + templateFile }));
         return false;
         return false;
 
 
     }
     }
@@ -319,7 +318,7 @@ export function CreateNewAnimationPreviewScene(reportError: boolean = true): boo
     if (!animFile) {
     if (!animFile) {
 
 
         if (reportError)
         if (reportError)
-            resourceOps.sendEvent(EditorEvents.ModalError, { title: title, message: "Failed to open animation viewer: " + animFilename });
+            resourceOps.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: title, message: "Failed to open animation viewer: " + animFilename }));
         return false;
         return false;
 
 
     }
     }
@@ -327,7 +326,7 @@ export function CreateNewAnimationPreviewScene(reportError: boolean = true): boo
     //Reset the animation viewer scene to a blank scene
     //Reset the animation viewer scene to a blank scene
     animFile = templateFile;
     animFile = templateFile;
 
 
-    resourceOps.sendEvent(EditorEvents.EditResource, { path: animFilename });
+    resourceOps.sendEvent(Editor.EditorEditResourceEventData({ path: animFilename }));
 
 
     return true;
     return true;
 
 

+ 5 - 6
Script/AtomicEditor/ui/AnimationToolbar.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import HierarchyFrame = require("ui/frames/HierarchyFrame");
 import HierarchyFrame = require("ui/frames/HierarchyFrame");
 import InspectorUtils = require("ui/frames/inspector/InspectorUtils");
 import InspectorUtils = require("ui/frames/inspector/InspectorUtils");
@@ -38,9 +37,9 @@ class AnimationToolbar extends Atomic.UIWidget {
         this.leftAnimContainer = <Atomic.UILayout>this.getWidget("leftanimcontainer");
         this.leftAnimContainer = <Atomic.UILayout>this.getWidget("leftanimcontainer");
         this.rightAnimContainer = <Atomic.UILayout>this.getWidget("rightanimcontainer");
         this.rightAnimContainer = <Atomic.UILayout>this.getWidget("rightanimcontainer");
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (ev) => this.handleWidgetEvent(ev));
-        this.subscribeToEvent(EditorEvents.ActiveSceneEditorChange, (data) => this.handleActiveSceneEditorChanged(data));
-        this.subscribeToEvent(EditorEvents.SceneClosed, (data) => this.handleSceneClosed(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((ev) => this.handleWidgetEvent(ev)));
+        this.subscribeToEvent(Editor.EditorActiveSceneEditorChangeEvent((data) => this.handleActiveSceneEditorChanged(data)));
+        this.subscribeToEvent(Editor.EditorSceneClosedEvent((data) => this.handleSceneClosed(data)));
 
 
         var leftAnimationField = InspectorUtils.createAttrEditFieldWithSelectButton("Animation A", this.leftAnimContainer);
         var leftAnimationField = InspectorUtils.createAttrEditFieldWithSelectButton("Animation A", this.leftAnimContainer);
         leftAnimationField.selectButton.onClick = function () { this.openAnimationSelectionBox(leftAnimationField.editField, this.leftAnim); }.bind(this);
         leftAnimationField.selectButton.onClick = function () { this.openAnimationSelectionBox(leftAnimationField.editField, this.leftAnim); }.bind(this);
@@ -122,7 +121,7 @@ class AnimationToolbar extends Atomic.UIWidget {
         return true;
         return true;
     }
     }
 
 
-    handleSceneClosed(ev: EditorEvents.SceneClosedEvent) {
+    handleSceneClosed(ev: Editor.EditorSceneClosedEvent) {
         if (ev.scene == this.scene) {
         if (ev.scene == this.scene) {
             Atomic.fileSystem.delete(this.sceneAssetPath);
             Atomic.fileSystem.delete(this.sceneAssetPath);
 
 
@@ -141,7 +140,7 @@ class AnimationToolbar extends Atomic.UIWidget {
             this.remove();
             this.remove();
     }
     }
 
 
-    handleActiveSceneEditorChanged(event: EditorEvents.ActiveSceneEditorChangeEvent) {
+    handleActiveSceneEditorChanged(event: Editor.EditorActiveSceneEditorChangeEvent) {
 
 
         if (!event.sceneEditor)
         if (!event.sceneEditor)
             return;
             return;

+ 9 - 14
Script/AtomicEditor/ui/EditorUI.ts

@@ -20,12 +20,11 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import MainFrame = require("./frames/MainFrame");
 import MainFrame = require("./frames/MainFrame");
 import ModalOps = require("./modal/ModalOps");
 import ModalOps = require("./modal/ModalOps");
 import Shortcuts = require("./Shortcuts");
 import Shortcuts = require("./Shortcuts");
 import ServiceLocator from "../hostExtensions/ServiceLocator";
 import ServiceLocator from "../hostExtensions/ServiceLocator";
-import Editor = require("editor/Editor");
+import {default as AtomicEditor} from "editor/Editor";
 
 
 // this is designed with public get functions to solve
 // this is designed with public get functions to solve
 // circular dependency issues in TS
 // circular dependency issues in TS
@@ -48,11 +47,11 @@ export function getShortcuts():Shortcuts {
   return editorUI.shortcuts;
   return editorUI.shortcuts;
 }
 }
 
 
-export function initialize(editor: Editor) {
+export function initialize(editor: AtomicEditor) {
   editorUI = new EditorUI(editor);
   editorUI = new EditorUI(editor);
 }
 }
 
 
-export function getEditor(): Editor {
+export function getEditor(): AtomicEditor {
     return editorUI.editor;
     return editorUI.editor;
 }
 }
 
 
@@ -75,7 +74,7 @@ export function getCurrentResourceEditor():Editor.ResourceEditor {
 
 
 class EditorUI extends Atomic.ScriptObject {
 class EditorUI extends Atomic.ScriptObject {
 
 
-  constructor(editor: Editor) {
+  constructor(editor: AtomicEditor) {
 
 
     super();
     super();
 
 
@@ -89,11 +88,11 @@ class EditorUI extends Atomic.ScriptObject {
 
 
     this.editor = editor;
     this.editor = editor;
 
 
-    this.subscribeToEvent("ScreenMode", (ev:Atomic.ScreenModeEvent) => {
+    this.subscribeToEvent(Atomic.ScreenModeEvent((ev:Atomic.ScreenModeEvent) => {
 
 
       this.mainframe.setSize(ev.width, ev.height);
       this.mainframe.setSize(ev.width, ev.height);
 
 
-    });
+    }));
 
 
     // set initial size
     // set initial size
     this.mainframe.setSize(graphics.width, graphics.height);
     this.mainframe.setSize(graphics.width, graphics.height);
@@ -107,13 +106,9 @@ class EditorUI extends Atomic.ScriptObject {
       this.modalOps);
       this.modalOps);
     ServiceLocator.subscribeToEvents(this.mainframe);
     ServiceLocator.subscribeToEvents(this.mainframe);
 
 
-    this.subscribeToEvent(EditorEvents.ModalError, (event:EditorEvents.ModalErrorEvent) => {
+    this.subscribeToEvent(Editor.EditorModalEvent((event:Editor.EditorModalEvent) => {
       this.showModalError(event.title, event.message);
       this.showModalError(event.title, event.message);
-    });
-    
-    this.subscribeToEvent(EditorEvents.EditorModal, (event:EditorEvents.EditorModalEvent) => {
-      this.showModalError(event.title, event.message);
-    });
+    }));
 
 
   }
   }
 
 
@@ -125,6 +120,6 @@ class EditorUI extends Atomic.ScriptObject {
   mainframe: MainFrame;
   mainframe: MainFrame;
   modalOps: ModalOps;
   modalOps: ModalOps;
   shortcuts: Shortcuts;
   shortcuts: Shortcuts;
-  editor: Editor;
+  editor: AtomicEditor;
 
 
 }
 }

+ 16 - 17
Script/AtomicEditor/ui/MainToolbar.ts

@@ -21,7 +21,6 @@
 //
 //
 
 
 import EditorUI = require("./EditorUI");
 import EditorUI = require("./EditorUI");
-import EditorEvents = require("../editor/EditorEvents");
 
 
 class MainToolbar extends Atomic.UIWidget {
 class MainToolbar extends Atomic.UIWidget {
 
 
@@ -55,41 +54,41 @@ class MainToolbar extends Atomic.UIWidget {
 
 
         parent.addChild(this);
         parent.addChild(this);
 
 
-        this.subscribeToEvent("GizmoAxisModeChanged", (ev) => this.handleGizmoAxisModeChanged(ev));
-        this.subscribeToEvent("GizmoEditModeChanged", (ev) => this.handleGizmoEditModeChanged(ev));
+        this.subscribeToEvent(Editor.GizmoAxisModeChangedEvent((ev) => this.handleGizmoAxisModeChanged(ev)));
+        this.subscribeToEvent(Editor.GizmoEditModeChangedEvent((ev) => this.handleGizmoEditModeChanged(ev)));
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
-        this.subscribeToEvent(EditorEvents.PlayerStarted, (data) => {
+        this.subscribeToEvent(Editor.EditorPlayerStartedEvent(() => {
             var skin = <Atomic.UISkinImage> this.playButton.getWidget("skin_image");
             var skin = <Atomic.UISkinImage> this.playButton.getWidget("skin_image");
             skin.setSkinBg("StopButton");
             skin.setSkinBg("StopButton");
             skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             skin.setSkinBg("PauseButton");
             skin.setSkinBg("PauseButton");
-        });
-        this.subscribeToEvent(EditorEvents.PlayerStopped, (data) => {
+        }));
+        this.subscribeToEvent(Editor.EditorPlayerStoppedEvent(() => {
             var skin = <Atomic.UISkinImage> this.playButton.getWidget("skin_image");
             var skin = <Atomic.UISkinImage> this.playButton.getWidget("skin_image");
             skin.setSkinBg("PlayButton");
             skin.setSkinBg("PlayButton");
             skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             skin.setSkinBg("PauseButton");
             skin.setSkinBg("PauseButton");
-        });
-        this.subscribeToEvent(EditorEvents.PlayerPaused, (data) => {
+        }));
+        this.subscribeToEvent(Editor.EditorPlayerPausedEvent(() => {
             var skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             var skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             skin.setSkinBg("PlayButton");
             skin.setSkinBg("PlayButton");
-        });
+        }));
 
 
-        this.subscribeToEvent(EditorEvents.PlayerResumed, (data) => {
+        this.subscribeToEvent(Editor.EditorPlayerResumedEvent(() => {
             var skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             var skin = <Atomic.UISkinImage> this.pauseButton.getWidget("skin_image");
             skin.setSkinBg("PauseButton");
             skin.setSkinBg("PauseButton");
-        });
+        }));
 
 
         // TODO: We need better control over playmode during NET compiles
         // TODO: We need better control over playmode during NET compiles
-        this.subscribeToEvent("NETBuildBegin", (data) => {
+        this.subscribeToEvent(ToolCore.NETBuildBeginEvent((data) => {
             this.playButton.disable();
             this.playButton.disable();
-        });
+        }));
 
 
-        this.subscribeToEvent("NETBuildResult", (data) => {
+        this.subscribeToEvent(ToolCore.NETBuildResultEvent((data) => {
             this.playButton.enable();
             this.playButton.enable();
-        });
+        }));
 
 
     }
     }
 
 
@@ -135,7 +134,7 @@ class MainToolbar extends Atomic.UIWidget {
                 else if (ev.target.id == "3d_scale")
                 else if (ev.target.id == "3d_scale")
                     mode = 3;
                     mode = 3;
 
 
-                this.sendEvent("GizmoEditModeChanged", { mode: mode });
+                this.sendEvent(Editor.GizmoEditModeChangedEventData({ mode: mode }));
 
 
                 return true;
                 return true;
 
 

+ 1 - 1
Script/AtomicEditor/ui/ScriptWidget.ts

@@ -30,7 +30,7 @@ class ScriptWidget extends Atomic.UIWidget {
         // this.subscribeToEvent(this, "WidgetEvent", this.handleWidgetEvent.bind(this));
         // this.subscribeToEvent(this, "WidgetEvent", this.handleWidgetEvent.bind(this));
 
 
         // TypeScript-ey
         // TypeScript-ey
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 10 - 10
Script/AtomicEditor/ui/Shortcuts.ts

@@ -20,9 +20,9 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("../editor/EditorEvents");
 import EditorUI = require("./EditorUI");
 import EditorUI = require("./EditorUI");
 import Preferences = require("editor/Preferences");
 import Preferences = require("editor/Preferences");
+import * as EditorEvents from "../editor/EditorEvents";
 
 
 class Shortcuts extends Atomic.ScriptObject {
 class Shortcuts extends Atomic.ScriptObject {
 
 
@@ -30,9 +30,9 @@ class Shortcuts extends Atomic.ScriptObject {
 
 
         super();
         super();
 
 
-        this.subscribeToEvent(Atomic.UIShortcutEvent ( (ev) => this.handleUIShortcut(ev)));
+        this.subscribeToEvent(Atomic.UIShortcutEvent((ev) => this.handleUIShortcut(ev)));
 
 
-        this.subscribeToEvent(Atomic.KeyDownEvent( (ev) => this.handleKeyDown(ev)));
+        this.subscribeToEvent(Atomic.KeyDownEvent((ev) => this.handleKeyDown(ev)));
 
 
 
 
     }
     }
@@ -40,10 +40,10 @@ class Shortcuts extends Atomic.ScriptObject {
     //this should be moved somewhere else...
     //this should be moved somewhere else...
     invokePlayOrStopPlayer(debug: boolean = false) {
     invokePlayOrStopPlayer(debug: boolean = false) {
 
 
-        this.sendEvent(EditorEvents.SaveAllResources);
+        this.sendEvent(Editor.EditorSaveAllResourcesEventType);
 
 
         if (Atomic.editorMode.isPlayerEnabled()) {
         if (Atomic.editorMode.isPlayerEnabled()) {
-            this.sendEvent("IPCPlayerExitRequest");
+            this.sendEvent(EditorEvents.IPCPlayerExitRequestEventType);
         } else {
         } else {
 
 
             var playerWindow = Preferences.getInstance().playerWindow;
             var playerWindow = Preferences.getInstance().playerWindow;
@@ -92,13 +92,13 @@ class Shortcuts extends Atomic.ScriptObject {
 
 
     invokePauseOrResumePlayer() {
     invokePauseOrResumePlayer() {
         if (Atomic.editorMode.isPlayerEnabled()) {
         if (Atomic.editorMode.isPlayerEnabled()) {
-            this.sendEvent("IPCPlayerPauseResumeRequest");
+            this.sendEvent(EditorEvents.IPCPlayerPauseResumeRequestEventType);
         }
         }
     }
     }
 
 
     invokeStepPausedPlayer() {
     invokeStepPausedPlayer() {
         if (Atomic.editorMode.isPlayerEnabled()) {
         if (Atomic.editorMode.isPlayerEnabled()) {
-            this.sendEvent("IPCPlayerPauseStepRequest");
+            this.sendEvent(EditorEvents.IPCPlayerPauseStepRequestEventType);
         }
         }
     }
     }
 
 
@@ -119,7 +119,7 @@ class Shortcuts extends Atomic.ScriptObject {
     }
     }
 
 
     invokeFileSave() {
     invokeFileSave() {
-        this.sendEvent(EditorEvents.SaveResource);
+        this.sendEvent(Editor.EditorSaveResourceEventType);
     }
     }
 
 
     invokeUndo() {
     invokeUndo() {
@@ -153,7 +153,7 @@ class Shortcuts extends Atomic.ScriptObject {
 
 
     invokeGizmoEditModeChanged(mode: Editor.EditMode) {
     invokeGizmoEditModeChanged(mode: Editor.EditMode) {
 
 
-        this.sendEvent("GizmoEditModeChanged", { mode: mode });
+        this.sendEvent(Editor.GizmoEditModeChangedEventData({ mode: mode }));
 
 
     }
     }
 
 
@@ -162,7 +162,7 @@ class Shortcuts extends Atomic.ScriptObject {
 
 
         if (editor && editor instanceof Editor.SceneEditor3D) {
         if (editor && editor instanceof Editor.SceneEditor3D) {
             var mode = editor.getGizmo().axisMode ? Editor.AxisMode.AXIS_WORLD : Editor.AxisMode.AXIS_LOCAL;
             var mode = editor.getGizmo().axisMode ? Editor.AxisMode.AXIS_WORLD : Editor.AxisMode.AXIS_LOCAL;
-            this.sendEvent("GizmoAxisModeChanged", { mode: mode });
+            this.sendEvent(Editor.GizmoAxisModeChangedEventData({ mode: mode }));
         }
         }
     }
     }
 
 

+ 0 - 24
Script/AtomicEditor/ui/UIEvents.ts

@@ -1,24 +0,0 @@
-//
-// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-export const MessageModalEvent = "MessageModalEvent";
-export const ResourceEditorChanged = "ResourceEditorChanged";

+ 30 - 31
Script/AtomicEditor/ui/frames/HierarchyFrame.ts

@@ -22,7 +22,6 @@
 
 
 import HierarchyFrameMenu = require("./menus/HierarchyFrameMenu");
 import HierarchyFrameMenu = require("./menus/HierarchyFrameMenu");
 import MenuItemSources = require("./menus/MenuItemSources");
 import MenuItemSources = require("./menus/MenuItemSources");
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import SearchBarFiltering = require("resources/SearchBarFiltering");
 import SearchBarFiltering = require("resources/SearchBarFiltering");
 
 
@@ -64,40 +63,40 @@ class HierarchyFrame extends Atomic.UIWidget {
         hierList.multiSelect = true;
         hierList.multiSelect = true;
         hierList.rootList.id = "hierList_";
         hierList.rootList.id = "hierList_";
 
 
-        hierList.subscribeToEvent("UIListViewSelectionChanged", (event: Atomic.UIListViewSelectionChangedEvent) => this.handleHierListSelectionChangedEvent(event));
+        hierList.subscribeToEvent(Atomic.UIListViewSelectionChangedEvent((event: Atomic.UIListViewSelectionChangedEvent) => this.handleHierListSelectionChangedEvent(event)));
 
 
         hierarchycontainer.addChild(hierList);
         hierarchycontainer.addChild(hierList);
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
-        this.subscribeToEvent(EditorEvents.EditorResourceClose, (data) => this.handleEditorResourceClosed(data));
-        this.subscribeToEvent(EditorEvents.ActiveSceneEditorChange, (data) => this.handleActiveSceneEditorChanged(data));
+        this.subscribeToEvent(Editor.EditorResourceCloseEvent((data) => this.handleEditorResourceClosed(data)));
+        this.subscribeToEvent(Editor.EditorActiveSceneEditorChangeEvent((data) => this.handleActiveSceneEditorChanged(data)));
 
 
-        this.searchEdit.subscribeToEvent(this.searchEdit, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.searchEdit.subscribeToEvent(this.searchEdit, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
         // on mouse up clear the list's drag object
         // on mouse up clear the list's drag object
-        this.subscribeToEvent("MouseButtonUp", () => {
+        this.subscribeToEvent(Atomic.MouseButtonUpEvent(() => {
             // handle dropping on hierarchy, moving node, dropping prefabs, etc
             // handle dropping on hierarchy, moving node, dropping prefabs, etc
-            this.subscribeToEvent(this.hierList.rootList, "DragEnded", (data) => this.handleDragEnded(data));
+            this.subscribeToEvent(this.hierList.rootList, Atomic.DragEndedEvent((data) => this.handleDragEnded(data)));
             this.hierList.rootList.dragObject = null;
             this.hierList.rootList.dragObject = null;
-        });
+        }));
 
 
-        this.subscribeToEvent("KeyDown", () => {
+        this.subscribeToEvent(Atomic.KeyDownEvent(() => {
             this.canReparent = false;
             this.canReparent = false;
-        });
+        }));
 
 
-        this.subscribeToEvent("KeyUp", () => {
+        this.subscribeToEvent(Atomic.KeyUpEvent(() => {
             this.canReparent = true;
             this.canReparent = true;
-        });
+        }));
 
 
-        this.subscribeToEvent(EditorEvents.ProjectClosed, (ev) => {
+        this.subscribeToEvent(Editor.EditorProjectClosedEvent((ev) => {
 
 
             this.scene = null;
             this.scene = null;
             this.populate();
             this.populate();
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent(EditorEvents.SceneClosed, (ev: EditorEvents.SceneClosedEvent) => {
+        this.subscribeToEvent(Editor.EditorSceneClosedEvent((ev: Editor.EditorSceneClosedEvent) => {
 
 
             if (ev.scene == this.scene) {
             if (ev.scene == this.scene) {
 
 
@@ -107,9 +106,9 @@ class HierarchyFrame extends Atomic.UIWidget {
 
 
             }
             }
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent("ComponentAdded", (ev: Atomic.ComponentAddedEvent) => {
+        this.subscribeToEvent(Atomic.ComponentAddedEvent((ev: Atomic.ComponentAddedEvent) => {
 
 
             if (!ev.component || ev.component.typeName != "PrefabComponent") return;
             if (!ev.component || ev.component.typeName != "PrefabComponent") return;
 
 
@@ -123,9 +122,9 @@ class HierarchyFrame extends Atomic.UIWidget {
 
 
             }
             }
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent("ComponentRemoved", (ev: Atomic.ComponentRemovedEvent) => {
+        this.subscribeToEvent(Atomic.ComponentRemovedEvent((ev: Atomic.ComponentRemovedEvent) => {
 
 
             if (!ev.component || ev.component.typeName != "PrefabComponent") return;
             if (!ev.component || ev.component.typeName != "PrefabComponent") return;
 
 
@@ -138,9 +137,9 @@ class HierarchyFrame extends Atomic.UIWidget {
                 this.hierList.setItemTextSkin(node.id.toString(), "Folder");
                 this.hierList.setItemTextSkin(node.id.toString(), "Folder");
             }
             }
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent("TemporaryChanged", (ev: Atomic.TemporaryChangedEvent) => {
+        this.subscribeToEvent(Atomic.TemporaryChangedEvent((ev: Atomic.TemporaryChangedEvent) => {
 
 
             // this can happen on a temporary status change on a non-scripted class instance
             // this can happen on a temporary status change on a non-scripted class instance
             if (!ev.serializable) {
             if (!ev.serializable) {
@@ -161,7 +160,7 @@ class HierarchyFrame extends Atomic.UIWidget {
 
 
             }
             }
 
 
-        });
+        }));
 
 
     }
     }
 
 
@@ -210,16 +209,16 @@ class HierarchyFrame extends Atomic.UIWidget {
 
 
         if (this.scene) {
         if (this.scene) {
 
 
-            this.subscribeToEvent(this.scene, "SceneNodeSelected", (event: Editor.SceneNodeSelectedEvent) => this.handleSceneNodeSelected(event));
-            this.subscribeToEvent(this.scene, "SceneEditNodeAdded", (ev: Editor.SceneEditNodeAddedEvent) => this.handleSceneEditNodeAdded(ev));
-            this.subscribeToEvent(this.scene, "SceneEditNodeRemoved", (ev: Editor.SceneEditNodeRemovedEvent) => this.handleSceneEditNodeRemoved(ev));
-            this.subscribeToEvent(this.scene, "NodeNameChanged", (ev: Atomic.NodeNameChangedEvent) => {
+            this.subscribeToEvent(this.scene, Editor.SceneNodeSelectedEvent((event: Editor.SceneNodeSelectedEvent) => this.handleSceneNodeSelected(event)));
+            this.subscribeToEvent(this.scene, Editor.SceneEditNodeAddedEvent((ev: Editor.SceneEditNodeAddedEvent) => this.handleSceneEditNodeAdded(ev)));
+            this.subscribeToEvent(this.scene, Editor.SceneEditNodeRemovedEvent((ev: Editor.SceneEditNodeRemovedEvent) => this.handleSceneEditNodeRemoved(ev)));
+            this.subscribeToEvent(this.scene, Atomic.NodeNameChangedEvent((ev: Atomic.NodeNameChangedEvent) => {
 
 
                 this.hierList.setItemText(ev.node.id.toString(), ev.node.name);
                 this.hierList.setItemText(ev.node.id.toString(), ev.node.name);
 
 
-            });
+            }));
 
 
-            this.subscribeToEvent(this.scene, "SceneEditNodeReparent", (ev) => {
+            this.subscribeToEvent(this.scene, Editor.SceneEditNodeReparentEvent((ev) => {
 
 
                 if (!ev.added) {
                 if (!ev.added) {
                     delete this.nodeIDToItemID[ev.node.id];
                     delete this.nodeIDToItemID[ev.node.id];
@@ -231,7 +230,7 @@ class HierarchyFrame extends Atomic.UIWidget {
 
 
                 }
                 }
 
 
-            });
+            }));
 
 
 
 
         }
         }
@@ -246,7 +245,7 @@ class HierarchyFrame extends Atomic.UIWidget {
 
 
     }
     }
 
 
-    handleActiveSceneEditorChanged(event: EditorEvents.ActiveSceneEditorChangeEvent) {
+    handleActiveSceneEditorChanged(event: Editor.EditorActiveSceneEditorChangeEvent) {
 
 
         this.setSceneEditor(event.sceneEditor);
         this.setSceneEditor(event.sceneEditor);
 
 

+ 7 - 10
Script/AtomicEditor/ui/frames/MainFrame.ts

@@ -28,13 +28,10 @@ import HierarchyFrame = require("./HierarchyFrame");
 import MainToolbar = require("ui//MainToolbar");
 import MainToolbar = require("ui//MainToolbar");
 import AnimationToolbar = require("ui//AnimationToolbar");
 import AnimationToolbar = require("ui//AnimationToolbar");
 
 
-import UIEvents = require("ui/UIEvents");
-
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
 import MainFrameMenu = require("./menus/MainFrameMenu");
 import MainFrameMenu = require("./menus/MainFrameMenu");
 
 
 import MenuItemSources = require("./menus/MenuItemSources");
 import MenuItemSources = require("./menus/MenuItemSources");
-import * as EditorEvents from "../../editor/EditorEvents";
 
 
 class MainFrame extends ScriptWidget {
 class MainFrame extends ScriptWidget {
 
 
@@ -63,17 +60,17 @@ class MainFrame extends ScriptWidget {
 
 
         this.disableProjectMenus();
         this.disableProjectMenus();
 
 
-        this.subscribeToEvent(UIEvents.ResourceEditorChanged, (data) => this.handleResourceEditorChanged(data));
+        this.subscribeToEvent(Editor.EditorResourceEditorChangedEvent((data) => this.handleResourceEditorChanged(data)));
 
 
-        this.subscribeToEvent("ProjectLoaded", (data) => {
+        this.subscribeToEvent(ToolCore.ProjectLoadedEvent((data) => {
             this.showWelcomeFrame(false);
             this.showWelcomeFrame(false);
             this.enableProjectMenus();
             this.enableProjectMenus();
-        });
+        }));
 
 
-        this.subscribeToEvent(EditorEvents.ProjectUnloadedNotification, (data) => {
+        this.subscribeToEvent(Editor.ProjectUnloadedNotificationEvent((data) => {
             this.showWelcomeFrame(true);
             this.showWelcomeFrame(true);
             this.disableProjectMenus();
             this.disableProjectMenus();
-        });
+        }));
 
 
         this.showWelcomeFrame(true);
         this.showWelcomeFrame(true);
 
 
@@ -159,9 +156,9 @@ class MainFrame extends ScriptWidget {
 
 
     }
     }
 
 
-    handleResourceEditorChanged(data): void {
+    handleResourceEditorChanged(data: Editor.EditorResourceEditorChangedEvent): void {
 
 
-        var editor = <Editor.ResourceEditor> data.editor;
+        var editor = data.resourceEditor;
 
 
         if (editor) {
         if (editor) {
 
 

+ 15 - 16
Script/AtomicEditor/ui/frames/ProjectFrame.ts

@@ -21,8 +21,7 @@
 //
 //
 
 
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
-import Editor = require("editor/Editor");
-import EditorEvents = require("editor/EditorEvents");
+import {default as AtomicEditor} from "editor/Editor";
 import ProjectFrameMenu = require("./menus/ProjectFrameMenu");
 import ProjectFrameMenu = require("./menus/ProjectFrameMenu");
 import MenuItemSources = require("./menus/MenuItemSources");
 import MenuItemSources = require("./menus/MenuItemSources");
 import SearchBarFiltering = require("resources/SearchBarFiltering");
 import SearchBarFiltering = require("resources/SearchBarFiltering");
@@ -68,27 +67,27 @@ class ProjectFrame extends ScriptWidget {
         foldercontainer.addChild(folderList);
         foldercontainer.addChild(folderList);
 
 
         // events
         // events
-        this.subscribeToEvent("ProjectLoaded", (data) => this.handleProjectLoaded(data));
-        this.subscribeToEvent(EditorEvents.ProjectUnloadedNotification, (data) => this.handleProjectUnloaded(data));
-        this.subscribeToEvent("DragEnded", (data: Atomic.DragEndedEvent) => this.handleDragEnded(data));
+        this.subscribeToEvent(ToolCore.ProjectLoadedEvent((data) => this.handleProjectLoaded(data)));
+        this.subscribeToEvent(Editor.ProjectUnloadedNotificationEvent((data) => this.handleProjectUnloaded(data)));
+        this.subscribeToEvent(Atomic.DragEndedEvent((data: Atomic.DragEndedEvent) => this.handleDragEnded(data)));
 
 
-        this.subscribeToEvent("ResourceAdded", (ev: ToolCore.ResourceAddedEvent) => this.handleResourceAdded(ev));
-        this.subscribeToEvent("ResourceRemoved", (ev: ToolCore.ResourceRemovedEvent) => this.handleResourceRemoved(ev));
-        this.subscribeToEvent("AssetRenamed", (ev: ToolCore.AssetRenamedEvent) => this.handleAssetRenamed(ev));
-        this.subscribeToEvent(EditorEvents.InspectorProjectReference, (ev: EditorEvents.InspectorProjectReferenceEvent) => { this.handleInspectorProjectReferenceHighlight(ev.path); });
+        this.subscribeToEvent(ToolCore.ResourceAddedEvent((ev: ToolCore.ResourceAddedEvent) => this.handleResourceAdded(ev)));
+        this.subscribeToEvent(ToolCore.ResourceRemovedEvent((ev: ToolCore.ResourceRemovedEvent) => this.handleResourceRemoved(ev)));
+        this.subscribeToEvent(ToolCore.AssetRenamedEvent((ev: ToolCore.AssetRenamedEvent) => this.handleAssetRenamed(ev)));
+        this.subscribeToEvent(Editor.InspectorProjectReferenceEvent((ev: Editor.InspectorProjectReferenceEvent) => { this.handleInspectorProjectReferenceHighlight(ev.path); }));
 
 
-        this.searchEdit.subscribeToEvent(this.searchEdit, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.searchEdit.subscribeToEvent(this.searchEdit, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
-        folderList.subscribeToEvent("UIListViewSelectionChanged", (event: Atomic.UIListViewSelectionChangedEvent) => this.handleFolderListSelectionChangedEvent(event));
+        folderList.subscribeToEvent(Atomic.UIListViewSelectionChangedEvent((event: Atomic.UIListViewSelectionChangedEvent) => this.handleFolderListSelectionChangedEvent(event)));
 
 
         // this.subscribeToEvent(EditorEvents.ResourceFolderCreated, (ev: EditorEvents.ResourceFolderCreatedEvent) => this.handleResourceFolderCreated(ev));
         // this.subscribeToEvent(EditorEvents.ResourceFolderCreated, (ev: EditorEvents.ResourceFolderCreatedEvent) => this.handleResourceFolderCreated(ev));
 
 
         // this uses FileWatcher which doesn't catch subfolder creation
         // this uses FileWatcher which doesn't catch subfolder creation
-        this.subscribeToEvent("FileChanged", (data) => {
+        this.subscribeToEvent(Atomic.FileChangedEvent((data) => {
 
 
             // console.log("File CHANGED! ", data.fileName);
             // console.log("File CHANGED! ", data.fileName);
 
 
-        });
+        }));
 
 
     }
     }
 
 
@@ -260,7 +259,7 @@ class ProjectFrame extends ScriptWidget {
 
 
                     } else {
                     } else {
 
 
-                        this.sendEvent(EditorEvents.EditResource, { "path": asset.path });
+                        this.sendEvent(Editor.EditorEditResourceEventData({ "path": asset.path }));
                     }
                     }
 
 
                 }
                 }
@@ -416,7 +415,7 @@ class ProjectFrame extends ScriptWidget {
 
 
     }
     }
 
 
-    handleProjectLoaded(data) {
+    handleProjectLoaded(data: ToolCore.ProjectLoadedEvent) {
 
 
         this.folderList.rootList.value = 0;
         this.folderList.rootList.value = 0;
         this.folderList.setExpanded(this.resourcesID, true);
         this.folderList.setExpanded(this.resourcesID, true);
@@ -470,7 +469,7 @@ class ProjectFrame extends ScriptWidget {
 
 
         if (this.currentFolder != folder) {
         if (this.currentFolder != folder) {
 
 
-            this.sendEvent(EditorEvents.ContentFolderChanged, { path: folder.path });
+            this.sendEvent(Editor.ContentFolderChangedEventData({ path: folder.path }));
 
 
         }
         }
 
 

+ 25 - 27
Script/AtomicEditor/ui/frames/ResourceFrame.ts

@@ -21,8 +21,6 @@
 //
 //
 
 
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
-import EditorEvents = require("editor/EditorEvents");
-import UIEvents = require("ui/UIEvents");
 import ResourceEditorProvider from "../ResourceEditorProvider";
 import ResourceEditorProvider from "../ResourceEditorProvider";
 
 
 // the root content of editor widgets (rootContentWidget property) are extended with an editor field
 // the root content of editor widgets (rootContentWidget property) are extended with an editor field
@@ -53,19 +51,19 @@ class ResourceFrame extends ScriptWidget {
 
 
     }
     }
 
 
-    handleSaveResource(ev: EditorEvents.SaveResourceEvent) {
+    handleSaveResource(ev: Editor.EditorSaveResourceEvent) {
 
 
         if (this.currentResourceEditor) {
         if (this.currentResourceEditor) {
             this.currentResourceEditor.save();
             this.currentResourceEditor.save();
             // Grab the path to this file and pass it to the save resource
             // Grab the path to this file and pass it to the save resource
-            this.sendEvent(EditorEvents.SaveResourceNotification, {
+            this.sendEvent(Editor.EditorSaveResourceNotificationEventData({
                 path: ev.path || this.currentResourceEditor.fullPath
                 path: ev.path || this.currentResourceEditor.fullPath
-            });
+            }));
         }
         }
 
 
     }
     }
 
 
-    handleDeleteResource(ev: EditorEvents.DeleteResourceEvent) {
+    handleDeleteResource(ev: Editor.EditorDeleteResourceEvent) {
         var editor = this.editors[ev.path];
         var editor = this.editors[ev.path];
         if (editor) {
         if (editor) {
             editor.close(true);
             editor.close(true);
@@ -73,18 +71,18 @@ class ResourceFrame extends ScriptWidget {
         }
         }
     }
     }
 
 
-    handleSaveAllResources(data) {
+    handleSaveAllResources() {
 
 
         for (var i in this.editors) {
         for (var i in this.editors) {
             this.editors[i].save();
             this.editors[i].save();
-            this.sendEvent(EditorEvents.SaveResourceNotification, {
+            this.sendEvent(Editor.EditorSaveResourceNotificationEventData({
                 path: this.editors[i].fullPath
                 path: this.editors[i].fullPath
-            });
+            }));
         }
         }
 
 
     }
     }
 
 
-    handleEditResource(ev: EditorEvents.EditResourceEvent) {
+    handleEditResource(ev: Editor.EditorEditResourceEvent) {
 
 
         var path = ev.path;
         var path = ev.path;
 
 
@@ -151,7 +149,7 @@ class ResourceFrame extends ScriptWidget {
 
 
     }
     }
 
 
-    handleCloseResource(ev: EditorEvents.EditorCloseResourceEvent) {
+    handleCloseResource(ev: Editor.EditorResourceCloseEvent) {
         this.wasClosed = false;
         this.wasClosed = false;
         var editor = ev.editor;
         var editor = ev.editor;
         var navigate = ev.navigateToAvailableResource;
         var navigate = ev.navigateToAvailableResource;
@@ -193,14 +191,14 @@ class ResourceFrame extends ScriptWidget {
 
 
     }
     }
 
 
-    handleResourceEditorChanged(data) {
+    handleResourceEditorChanged(data: Editor.EditorResourceEditorChangedEvent) {
 
 
-        var editor = <Editor.ResourceEditor> data.editor;
+        var editor = data.resourceEditor;
         this.currentResourceEditor = editor;
         this.currentResourceEditor = editor;
 
 
     }
     }
 
 
-    handleRenameResource(ev:EditorEvents.RenameResourceEvent) {
+    handleRenameResource(ev:Editor.EditorRenameResourceNotificationEvent) {
         var editor = this.editors[ev.path];
         var editor = this.editors[ev.path];
         if (editor) {
         if (editor) {
             this.editors[ev.newPath] = editor;
             this.editors[ev.newPath] = editor;
@@ -220,11 +218,11 @@ class ResourceFrame extends ScriptWidget {
 
 
                     if (w.editor.typeName == "SceneEditor3D") {
                     if (w.editor.typeName == "SceneEditor3D") {
 
 
-                        this.sendEvent(EditorEvents.ActiveSceneEditorChange, { sceneEditor: (<Editor.SceneEditor3D> w.editor) });
+                        this.sendEvent(Editor.EditorActiveSceneEditorChangeEventData({ sceneEditor: (<Editor.SceneEditor3D> w.editor) }));
 
 
                     }
                     }
 
 
-                    this.sendEvent(UIEvents.ResourceEditorChanged, { editor: w.editor });
+                    this.sendEvent(Editor.EditorResourceEditorChangedEventData({ resourceEditor: w.editor }));
 
 
                 }
                 }
 
 
@@ -246,7 +244,7 @@ class ResourceFrame extends ScriptWidget {
         // on exit close all open editors
         // on exit close all open editors
         for (var path in this.editors) {
         for (var path in this.editors) {
 
 
-            this.sendEvent(EditorEvents.EditorResourceClose, { editor: this.editors[path], navigateToAvailableResource: false });
+            this.sendEvent(Editor.EditorResourceCloseEventData({ editor: this.editors[path], navigateToAvailableResource: false }));
 
 
         }
         }
 
 
@@ -256,7 +254,7 @@ class ResourceFrame extends ScriptWidget {
 
 
       for (var i in this.editors) {
       for (var i in this.editors) {
           var editor = this.editors[i];
           var editor = this.editors[i];
-           this.sendEvent(EditorEvents.EditorResourceClose, { editor: editor, navigateToAvailableResource: false });
+           this.sendEvent(Editor.EditorResourceCloseEventData({ editor: editor, navigateToAvailableResource: false }));
            editor.close();
            editor.close();
       }
       }
 
 
@@ -278,17 +276,17 @@ class ResourceFrame extends ScriptWidget {
         this.resourceEditorProvider = new ResourceEditorProvider(this);
         this.resourceEditorProvider = new ResourceEditorProvider(this);
         this.resourceEditorProvider.loadStandardEditors();
         this.resourceEditorProvider.loadStandardEditors();
 
 
-        this.subscribeToEvent(EditorEvents.ProjectUnloadedNotification, (data) => this.handleProjectUnloaded(data));
-        this.subscribeToEvent(EditorEvents.EditResource, (data) => this.handleEditResource(data));
-        this.subscribeToEvent(EditorEvents.SaveResource, (data) => this.handleSaveResource(data));
-        this.subscribeToEvent(EditorEvents.SaveAllResources, (data) => this.handleSaveAllResources(data));
-        this.subscribeToEvent(EditorEvents.EditorResourceClose, (ev: EditorEvents.EditorCloseResourceEvent) => this.handleCloseResource(ev));
-        this.subscribeToEvent(EditorEvents.RenameResourceNotification, (ev: EditorEvents.RenameResourceEvent) => this.handleRenameResource(ev));
-        this.subscribeToEvent(EditorEvents.DeleteResourceNotification, (data) => this.handleDeleteResource(data));
+        this.subscribeToEvent(Editor.ProjectUnloadedNotificationEvent((data) => this.handleProjectUnloaded(data)));
+        this.subscribeToEvent(Editor.EditorEditResourceEvent((data) => this.handleEditResource(data)));
+        this.subscribeToEvent(Editor.EditorSaveResourceEvent((data) => this.handleSaveResource(data)));
+        this.subscribeToEvent(Editor.EditorSaveAllResourcesEvent((data) => this.handleSaveAllResources()));
+        this.subscribeToEvent(Editor.EditorResourceCloseEvent((ev: Editor.EditorResourceCloseEvent) => this.handleCloseResource(ev)));
+        this.subscribeToEvent(Editor.EditorRenameResourceNotificationEvent((ev: Editor.EditorRenameResourceNotificationEvent) => this.handleRenameResource(ev)));
+        this.subscribeToEvent(Editor.EditorDeleteResourceNotificationEvent((data) => this.handleDeleteResource(data)));
 
 
-        this.subscribeToEvent(UIEvents.ResourceEditorChanged, (data) => this.handleResourceEditorChanged(data));
+        this.subscribeToEvent(Editor.EditorResourceEditorChangedEvent((data) => this.handleResourceEditorChanged(data)));
 
 
-        this.subscribeToEvent("WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 4 - 5
Script/AtomicEditor/ui/frames/WelcomeFrame.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
 import Preferences = require("editor/Preferences");
 import Preferences = require("editor/Preferences");
@@ -58,9 +57,9 @@ class WelcomeFrame extends ScriptWidget {
 
 
         this.updateRecentProjects();
         this.updateRecentProjects();
 
 
-        this.subscribeToEvent(EditorEvents.CloseProject, () => {
+        this.subscribeToEvent(Editor.EditorCloseProjectEvent(() => {
             this.updateRecentProjects();
             this.updateRecentProjects();
-        });
+        }));
 
 
         this.initExampleBrowser();
         this.initExampleBrowser();
 
 
@@ -233,7 +232,7 @@ class WelcomeFrame extends ScriptWidget {
                 var path = utils.openProjectFileDialog();
                 var path = utils.openProjectFileDialog();
                 if (path) {
                 if (path) {
 
 
-                    this.sendEvent(EditorEvents.RequestProjectLoad, { path: path });
+                    this.sendEvent(Editor.RequestProjectLoadEventData({ path: path }));
 
 
                 }
                 }
 
 
@@ -253,7 +252,7 @@ class WelcomeFrame extends ScriptWidget {
                     return;
                     return;
                 }
                 }
                 var path: string = this.recent[this.recentList.getSelectedItemID()];
                 var path: string = this.recent[this.recentList.getSelectedItemID()];
-                this.sendEvent(EditorEvents.RequestProjectLoad, { path: path });
+                this.sendEvent(Editor.RequestProjectLoadEventData({ path: path }));
             }
             }
 
 
             if (id == "recentProjectsContextMenu") {
             if (id == "recentProjectsContextMenu") {

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/ArrayEditWidget.ts

@@ -46,7 +46,7 @@ class ArrayEditWidget extends Atomic.UILayout {
 
 
         this.countEditField = <Atomic.UIEditField>countEdit.getWidget("editfield");
         this.countEditField = <Atomic.UIEditField>countEdit.getWidget("editfield");
 
 
-        this.subscribeToEvent(this.countEditField, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
+        this.subscribeToEvent(this.countEditField, Atomic.UIWidgetEditCompleteEvent((ev) => this.handleUIWidgetEditCompleteEvent(ev)));
 
 
     }
     }
 
 

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/AssemblyInspector.ts

@@ -29,7 +29,7 @@ class AssemblyInspector extends InspectorWidget {
 
 
         super();
         super();
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 33 - 34
Script/AtomicEditor/ui/frames/inspector/AttributeInfoEdit.ts

@@ -23,7 +23,6 @@
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import InspectorUtils = require("./InspectorUtils");
 import InspectorUtils = require("./InspectorUtils");
 import SerializableEditType = require("./SerializableEditType");
 import SerializableEditType = require("./SerializableEditType");
-import EditorEvents = require("editor/EditorEvents");
 import ColorChooser = require("./ColorChooser");
 import ColorChooser = require("./ColorChooser");
 
 
 class AttributeInfoEdit extends Atomic.UILayout {
 class AttributeInfoEdit extends Atomic.UILayout {
@@ -65,7 +64,7 @@ class AttributeInfoEdit extends Atomic.UILayout {
 
 
         this.createEditWidget();
         this.createEditWidget();
 
 
-        this.editWidget.subscribeToEvent(this.editWidget, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.editWidget.subscribeToEvent(this.editWidget, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
         if (this.attrInfo.tooltip) {
         if (this.attrInfo.tooltip) {
             this.editWidget.tooltip = this.attrInfo.tooltip;
             this.editWidget.tooltip = this.attrInfo.tooltip;
@@ -123,7 +122,7 @@ class AttributeInfoEdit extends Atomic.UILayout {
 
 
     }
     }
 
 
-    static createAttrEdit(editType: SerializableEditType, attrInfo: Atomic.AttributeInfo, nameOverride:string=undefined, typeOverride:Atomic.VariantType = undefined ): AttributeInfoEdit {
+    static createAttrEdit(editType: SerializableEditType, attrInfo: Atomic.AttributeInfo, nameOverride:string = undefined, typeOverride:Atomic.VariantType = undefined ): AttributeInfoEdit {
 
 
         var type: typeof AttributeInfoEdit;
         var type: typeof AttributeInfoEdit;
         var customTypes = AttributeInfoEdit.customAttrEditTypes[editType.typeName];
         var customTypes = AttributeInfoEdit.customAttrEditTypes[editType.typeName];
@@ -244,7 +243,7 @@ class StringAttributeEdit extends AttributeInfoEdit {
         lp.width = 160;
         lp.width = 160;
         field.layoutParams = lp;
         field.layoutParams = lp;
 
 
-        field.subscribeToEvent(field, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
+        field.subscribeToEvent(field, Atomic.UIWidgetEditCompleteEvent((ev) => this.handleUIWidgetEditCompleteEvent(ev)));
 
 
         this.editWidget = field;
         this.editWidget = field;
     }
     }
@@ -327,7 +326,7 @@ class IntAttributeEdit extends AttributeInfoEdit {
             lp.width = 140;
             lp.width = 140;
             field.layoutParams = lp;
             field.layoutParams = lp;
 
 
-            field.subscribeToEvent(field, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
+            field.subscribeToEvent(field, Atomic.UIWidgetEditCompleteEvent((ev) => this.handleUIWidgetEditCompleteEvent(ev)));
 
 
             this.editWidget = field;
             this.editWidget = field;
         }
         }
@@ -422,7 +421,7 @@ class FloatAttributeEdit extends AttributeInfoEdit {
         lp.width = 140;
         lp.width = 140;
         field.layoutParams = lp;
         field.layoutParams = lp;
 
 
-        field.subscribeToEvent(field, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
+        field.subscribeToEvent(field, Atomic.UIWidgetEditCompleteEvent((ev) => this.handleUIWidgetEditCompleteEvent(ev)));
 
 
         this.editWidget = field;
         this.editWidget = field;
 
 
@@ -445,7 +444,7 @@ class FloatAttributeEdit extends AttributeInfoEdit {
                     console.log("WARNING: Undefined value for object: ", this.editType.typeName + "." + attrInfo.name);
                     console.log("WARNING: Undefined value for object: ", this.editType.typeName + "." + attrInfo.name);
                     widget.text = "???";
                     widget.text = "???";
 
 
-                } else {                    
+                } else {
                     widget.text = parseFloat(value.toFixed(5)).toString();
                     widget.text = parseFloat(value.toFixed(5)).toString();
                 }
                 }
 
 
@@ -525,8 +524,8 @@ class NumberArrayAttributeEdit extends AttributeInfoEdit {
             select["_dec"] = select.getWidget("dec");
             select["_dec"] = select.getWidget("dec");
             select["_inc"] = select.getWidget("inc");
             select["_inc"] = select.getWidget("inc");
 
 
-            select.subscribeToEvent(select, "WidgetEvent", (ev) => this.handleWidgetEvent(ev));
-            select.subscribeToEvent(select, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
+            select.subscribeToEvent(select, Atomic.UIWidgetEvent((ev) => this.handleWidgetEvent(ev)));
+            select.subscribeToEvent(select, Atomic.UIWidgetEditCompleteEvent((ev) => this.handleUIWidgetEditCompleteEvent(ev)));
         }
         }
 
 
         this.editWidget = layout;
         this.editWidget = layout;
@@ -661,7 +660,7 @@ class ColorAttributeEdit extends AttributeInfoEdit {
 
 
         this.editWidget = layout;
         this.editWidget = layout;
 
 
-        this.editWidget.subscribeToEvent(this.editWidget, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.editWidget.subscribeToEvent(this.editWidget, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
         selectButton.onClick = () => {
         selectButton.onClick = () => {
 
 
@@ -678,14 +677,14 @@ class ColorAttributeEdit extends AttributeInfoEdit {
             let restore = null;
             let restore = null;
             let chooser = new ColorChooser ( color );
             let chooser = new ColorChooser ( color );
 
 
-            this.subscribeToEvent(chooser, "ColorChooserChanged", (ev) => {
+            this.subscribeToEvent(chooser, Editor.ColorChooserChangedEvent((ev) => {
 
 
                 restore = color;
                 restore = color;
                 this.updateColor(chooser.getRGBA());
                 this.updateColor(chooser.getRGBA());
 
 
-            });
+            }));
 
 
-            this.subscribeToEvent(chooser, "UIWidgetEditCanceled", (ev) => {
+            this.subscribeToEvent(chooser, Atomic.UIWidgetEditCanceledEvent((ev) => {
 
 
                 if (restore) {
                 if (restore) {
 
 
@@ -694,9 +693,9 @@ class ColorAttributeEdit extends AttributeInfoEdit {
 
 
                 }
                 }
 
 
-            });
+            }));
 
 
-            this.subscribeToEvent(chooser, "UIWidgetEditComplete", (ev) => {
+            this.subscribeToEvent(chooser, Atomic.UIWidgetEditCompleteEvent((ev) => {
 
 
                 let newColor = chooser.getRGBA();
                 let newColor = chooser.getRGBA();
 
 
@@ -729,7 +728,7 @@ class ColorAttributeEdit extends AttributeInfoEdit {
 
 
                 }
                 }
 
 
-            });
+            }));
 
 
         };
         };
 
 
@@ -746,7 +745,7 @@ class ColorAttributeEdit extends AttributeInfoEdit {
             this.colorWidget.color = color;
             this.colorWidget.color = color;
         }
         }
 
 
-        
+
     }
     }
 
 
     // updates color on selection without committing to undo/redo for preview
     // updates color on selection without committing to undo/redo for preview
@@ -796,7 +795,7 @@ class ResourceRefAttributeEdit extends AttributeInfoEdit {
 
 
         if (parent) {
         if (parent) {
 
 
-            parent.sendEvent("AttributeEditResourceChanged", { attrInfoEdit: this, resource: resource });
+            parent.sendEvent(Editor.AttributeEditResourceChangedEventData({ attrInfoEdit: this, resource: resource }));
 
 
         }
         }
 
 
@@ -853,7 +852,7 @@ class ResourceRefAttributeEdit extends AttributeInfoEdit {
                 }
                 }
                 this.editField.text = text;
                 this.editField.text = text;
 
 
-                this.editField.subscribeToEvent(this.editField, "WidgetEvent", (ev: Atomic.UIWidgetEvent) => {
+                this.editField.subscribeToEvent(this.editField, Atomic.UIWidgetEvent((ev: Atomic.UIWidgetEvent) => {
 
 
                     if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_POINTER_DOWN) {
                     if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_POINTER_DOWN) {
 
 
@@ -862,18 +861,18 @@ class ResourceRefAttributeEdit extends AttributeInfoEdit {
                         if (resource instanceof Atomic.JSComponentFile) {
                         if (resource instanceof Atomic.JSComponentFile) {
 
 
                             var pathName = resource.name;
                             var pathName = resource.name;
-                            this.sendEvent(EditorEvents.InspectorProjectReference, { "path": pathName });
+                            this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": pathName }));
 
 
                         } else if (resource instanceof Atomic.Model) {
                         } else if (resource instanceof Atomic.Model) {
 
 
                             var asset = ToolCore.assetDatabase.getAssetByCachePath(resource.name);
                             var asset = ToolCore.assetDatabase.getAssetByCachePath(resource.name);
-                            this.sendEvent(EditorEvents.InspectorProjectReference, { "path": asset.getRelativePath() });
+                            this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": asset.getRelativePath() }));
 
 
                         } else if (resource instanceof Atomic.Animation) {
                         } else if (resource instanceof Atomic.Animation) {
 
 
                              var animCacheReferenceName = resource.name.replace( "_" + (<Atomic.Animation>resource).animationName, "");
                              var animCacheReferenceName = resource.name.replace( "_" + (<Atomic.Animation>resource).animationName, "");
                              var asset = ToolCore.assetDatabase.getAssetByCachePath(animCacheReferenceName);
                              var asset = ToolCore.assetDatabase.getAssetByCachePath(animCacheReferenceName);
-                             this.sendEvent(EditorEvents.InspectorProjectReference, { "path": asset.getRelativePath() });
+                             this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": asset.getRelativePath() }));
 
 
                         } else {
                         } else {
 
 
@@ -882,7 +881,7 @@ class ResourceRefAttributeEdit extends AttributeInfoEdit {
                         }
                         }
                     }
                     }
 
 
-                });
+                }));
             }
             }
 
 
 
 
@@ -939,7 +938,7 @@ class ResourceRefAttributeEdit extends AttributeInfoEdit {
         };
         };
 
 
         // handle dropping of component on field
         // handle dropping of component on field
-        this.editField.subscribeToEvent(this.editField, "DragEnded", (ev: Atomic.DragEndedEvent) => {
+        this.editField.subscribeToEvent(this.editField, Atomic.DragEndedEvent((ev: Atomic.DragEndedEvent) => {
 
 
             if (ev.target == o.editField) {
             if (ev.target == o.editField) {
 
 
@@ -969,7 +968,7 @@ class ResourceRefAttributeEdit extends AttributeInfoEdit {
                 }
                 }
             }
             }
 
 
-        });
+        }));
 
 
     }
     }
 
 
@@ -1026,7 +1025,7 @@ class ResourceRefListAttributeEdit extends AttributeInfoEdit {
         lp.width = 160;
         lp.width = 160;
         sizeEdit.layoutParams = lp;
         sizeEdit.layoutParams = lp;
 
 
-        sizeEdit.subscribeToEvent(sizeEdit, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
+        sizeEdit.subscribeToEvent(sizeEdit, Atomic.UIWidgetEditCompleteEvent((ev) => this.handleUIWidgetEditCompleteEvent(ev)));
 
 
         this.editWidget = layout;
         this.editWidget = layout;
 
 
@@ -1036,7 +1035,7 @@ class ResourceRefListAttributeEdit extends AttributeInfoEdit {
 
 
         this.createEditWidget();
         this.createEditWidget();
 
 
-        this.editWidget.subscribeToEvent(this.editWidget, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.editWidget.subscribeToEvent(this.editWidget, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
         this.addChild(this.editWidget);
         this.addChild(this.editWidget);
 
 
@@ -1161,7 +1160,7 @@ class ArrayAttributeEdit extends AttributeInfoEdit {
 
 
         this.layout.addChild(indexEdit);
         this.layout.addChild(indexEdit);
 
 
-        this.indexEdits.push(indexEdit);        
+        this.indexEdits.push(indexEdit);
 
 
     }
     }
 
 
@@ -1196,7 +1195,7 @@ class ArrayAttributeEdit extends AttributeInfoEdit {
         lp.width = 160;
         lp.width = 160;
         sizeEdit.layoutParams = lp;
         sizeEdit.layoutParams = lp;
 
 
-        sizeEdit.subscribeToEvent(sizeEdit, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
+        sizeEdit.subscribeToEvent(sizeEdit, Atomic.UIWidgetEditCompleteEvent((ev) => this.handleUIWidgetEditCompleteEvent(ev)));
 
 
         this.editWidget = layout;
         this.editWidget = layout;
 
 
@@ -1206,7 +1205,7 @@ class ArrayAttributeEdit extends AttributeInfoEdit {
 
 
         this.createEditWidget();
         this.createEditWidget();
 
 
-        this.editWidget.subscribeToEvent(this.editWidget, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.editWidget.subscribeToEvent(this.editWidget, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
         this.addChild(this.editWidget);
         this.addChild(this.editWidget);
 
 
@@ -1237,18 +1236,18 @@ class ArrayAttributeEdit extends AttributeInfoEdit {
                 // record for undo/redo
                 // record for undo/redo
                 let scene = this.editType.getEditScene();
                 let scene = this.editType.getEditScene();
                 if (scene) {
                 if (scene) {
-                    scene.sendEvent("SceneEditEnd");
-                    scene.sendEvent("ComponentEditEnd");                    
+                    scene.sendEvent(Editor.SceneEditEndEventType);
+                    scene.sendEvent(Editor.ComponentEditEndEventType);
                 }
                 }
 
 
                 refresh = true;
                 refresh = true;
-            } 
+            }
 
 
         }
         }
 
 
         if (refresh)
         if (refresh)
             this.refresh();
             this.refresh();
-        
+
     }
     }
 
 
     refresh() {
     refresh() {

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/CSComponentClassSelector.ts

@@ -76,7 +76,7 @@ class CSComponentClassSelector extends Atomic.UIWindow {
 
 
         this.center();
         this.center();
 
 
-        this.subscribeToEvent("WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 10 - 10
Script/AtomicEditor/ui/frames/inspector/ColorChooser.ts

@@ -69,8 +69,8 @@ class ColorChooser extends Atomic.UIWindow {
 
 
         (<Atomic.UIButton>this.getWidget("ccancelbutton")).onClick = () => {
         (<Atomic.UIButton>this.getWidget("ccancelbutton")).onClick = () => {
 
 
-            this.sendEvent("UIWidgetEditCanceled", { widget : this });
-            this.unsubscribeFromEvent("WidgetDeleted");
+            this.sendEvent(Atomic.UIWidgetEditCanceledEventData({ widget : this }));
+            this.unsubscribeFromEvent(Atomic.UIWidgetDeletedEventType);
             this.close();
             this.close();
 
 
         };
         };
@@ -79,18 +79,18 @@ class ColorChooser extends Atomic.UIWindow {
 
 
             Preferences.getInstance().addColorHistory(this.infohex.text);
             Preferences.getInstance().addColorHistory(this.infohex.text);
 
 
-            this.sendEvent("UIWidgetEditComplete", { widget : this });
-            this.unsubscribeFromEvent("WidgetDeleted");
+            this.sendEvent(Atomic.UIWidgetEditCompleteEventData({ widget : this }));
+            this.unsubscribeFromEvent(Atomic.UIWidgetDeletedEventType);
             this.close();
             this.close();
         };
         };
 
 
-        this.subscribeToEvent(this, "WidgetDeleted", (event: Atomic.UIWidgetDeletedEvent) => {
+        this.subscribeToEvent(this, Atomic.UIWidgetDeletedEvent((event: Atomic.UIWidgetDeletedEvent) => {
 
 
-            this.sendEvent("UIWidgetEditCanceled", { widget : this });
+            this.sendEvent(Atomic.UIWidgetEditCanceledEventData({ widget : this }));
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
         this.resizeToFitContent();
         this.resizeToFitContent();
         this.center();
         this.center();
@@ -192,7 +192,7 @@ class ColorChooser extends Atomic.UIWindow {
 
 
         if (changed) {
         if (changed) {
 
 
-            this.sendEvent("ColorChooserChanged", { widget : this });
+            this.sendEvent(Editor.ColorChooserChangedEventData({ widget : this }));
 
 
         }
         }
 
 
@@ -226,7 +226,7 @@ class ColorChooser extends Atomic.UIWindow {
             this.fixcolor();
             this.fixcolor();
             this.update_hslwidgets();
             this.update_hslwidgets();
             this.update_rgbwidgets();
             this.update_rgbwidgets();
-            this.sendEvent("ColorChooserChanged", { widget : this });
+            this.sendEvent(Editor.ColorChooserChangedEventData({ widget : this }));
 
 
         }
         }
 
 

+ 15 - 16
Script/AtomicEditor/ui/frames/inspector/ComponentAttributeUI.ts

@@ -24,7 +24,6 @@ import EditorUI = require("ui/EditorUI");
 import InspectorUtils = require("./InspectorUtils");
 import InspectorUtils = require("./InspectorUtils");
 import AttributeInfoEdit = require("./AttributeInfoEdit");
 import AttributeInfoEdit = require("./AttributeInfoEdit");
 import SerializableEditType = require("./SerializableEditType");
 import SerializableEditType = require("./SerializableEditType");
-import EditorEvents = require("editor/EditorEvents");
 
 
 class LightCascadeAttributeEdit extends AttributeInfoEdit {
 class LightCascadeAttributeEdit extends AttributeInfoEdit {
 
 
@@ -56,7 +55,7 @@ class LightCascadeAttributeEdit extends AttributeInfoEdit {
 
 
                 }
                 }
 
 
-                o.scene.sendEvent("SceneEditEnd");
+                o.scene.sendEvent(Editor.SceneEditEndEventType);
                 _this.refresh();
                 _this.refresh();
 
 
             }.bind({ index: index, field: field });
             }.bind({ index: index, field: field });
@@ -69,7 +68,7 @@ class LightCascadeAttributeEdit extends AttributeInfoEdit {
         for (var i = 0; i < 4; i++) {
         for (var i = 0; i < 4; i++) {
             var field = InspectorUtils.createAttrEditField("Split " + i, panel);
             var field = InspectorUtils.createAttrEditField("Split " + i, panel);
             field.layoutParams = flp;
             field.layoutParams = flp;
-            field.subscribeToEvent(field, "UIWidgetEditComplete", createHandler(i, field));
+            field.subscribeToEvent(field, Atomic.UIWidgetEditCompleteEvent(createHandler(i, field)));
             this.splitFields.push(field);
             this.splitFields.push(field);
         }
         }
 
 
@@ -152,8 +151,8 @@ class SubmeshAttributeEdit extends AttributeInfoEdit {
     openResourceSelectionBox(materialIndex: number, resourceTypeName: string, importerName: string) {
     openResourceSelectionBox(materialIndex: number, resourceTypeName: string, importerName: string) {
 
 
         this.matIndex = materialIndex;
         this.matIndex = materialIndex;
-        
-        EditorUI.getModelOps().showResourceSelection("Select " + resourceTypeName + " Resource", importerName, resourceTypeName, function (retObject: any) {
+
+        EditorUI.getModelOps().showResourceSelection("Select " + resourceTypeName + " Resource", importerName, resourceTypeName, (retObject: any) => {
 
 
             if (retObject == null) {
             if (retObject == null) {
                 this.editType.onAttributeInfoEdited(this.attrInfo, null, this.matIndex);
                 this.editType.onAttributeInfoEdited(this.attrInfo, null, this.matIndex);
@@ -173,11 +172,11 @@ class SubmeshAttributeEdit extends AttributeInfoEdit {
 
 
             }
             }
 
 
-            this.sendEvent(EditorEvents.InspectorProjectReference, { "path": resource.name });
+            this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": resource.name }));
             this.editType.onAttributeInfoEdited(this.attrInfo, resource, materialIndex);
             this.editType.onAttributeInfoEdited(this.attrInfo, resource, materialIndex);
             this.refresh();
             this.refresh();
 
 
-        }.bind(this));
+        });
 
 
     }
     }
 
 
@@ -208,7 +207,7 @@ class SubmeshAttributeEdit extends AttributeInfoEdit {
         };
         };
 
 
         // handle dropping of component on field
         // handle dropping of component on field
-        o.editField.subscribeToEvent(o.editField, "DragEnded", (ev: Atomic.DragEndedEvent) => {
+        o.editField.subscribeToEvent(o.editField, Atomic.DragEndedEvent((ev: Atomic.DragEndedEvent) => {
 
 
             if (ev.target == o.editField) {
             if (ev.target == o.editField) {
 
 
@@ -229,27 +228,27 @@ class SubmeshAttributeEdit extends AttributeInfoEdit {
                 if (importer) {
                 if (importer) {
 
 
                     var resource = asset.getResource(resourceTypeName);
                     var resource = asset.getResource(resourceTypeName);
-                    this.sendEvent(EditorEvents.InspectorProjectReference, { "path": resource.name });
+                    this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": resource.name }));
                     this.editType.onAttributeInfoEdited(this.attrInfo, resource, materialIndex);
                     this.editType.onAttributeInfoEdited(this.attrInfo, resource, materialIndex);
                     this.refresh();
                     this.refresh();
                 }
                 }
             }
             }
 
 
-        });
+        }));
 
 
-        o.editField.subscribeToEvent(o.editField, "WidgetEvent", (ev: Atomic.UIWidgetEvent) => {
+        o.editField.subscribeToEvent(o.editField, Atomic.UIWidgetEvent((ev: Atomic.UIWidgetEvent) => {
 
 
             if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_POINTER_DOWN && o.editField.text != "") {
             if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_POINTER_DOWN && o.editField.text != "") {
 
 
                 var pathName = materialEdit.pathReference;
                 var pathName = materialEdit.pathReference;
-                this.sendEvent(EditorEvents.InspectorProjectReference, { "path": pathName });
+                this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": pathName }));
 
 
             } else if (o.editField.text == "") {
             } else if (o.editField.text == "") {
 
 
                 this.openResourceSelectionBox(materialIndex, resourceTypeName, importerName);
                 this.openResourceSelectionBox(materialIndex, resourceTypeName, importerName);
             }
             }
 
 
-        });
+        }));
     }
     }
 
 
     createEditWidget() {
     createEditWidget() {
@@ -264,7 +263,7 @@ class SubmeshAttributeEdit extends AttributeInfoEdit {
         var cb = InspectorUtils.createAttrCheckBox(this.name, mainLayout);
         var cb = InspectorUtils.createAttrCheckBox(this.name, mainLayout);
         this.enabledCheckBox = cb.checkBox;
         this.enabledCheckBox = cb.checkBox;
 
 
-        cb.checkBox.subscribeToEvent(cb.checkBox, "WidgetEvent", (ev: Atomic.UIWidgetEvent) => {
+        cb.checkBox.subscribeToEvent(cb.checkBox, Atomic.UIWidgetEvent((ev: Atomic.UIWidgetEvent) => {
 
 
             if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) {
             if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) {
 
 
@@ -288,7 +287,7 @@ class SubmeshAttributeEdit extends AttributeInfoEdit {
 
 
                 }
                 }
 
 
-                scene.sendEvent("SceneEditEnd");
+                scene.sendEvent(Editor.SceneEditEndEventType);
 
 
                 return true;
                 return true;
 
 
@@ -297,7 +296,7 @@ class SubmeshAttributeEdit extends AttributeInfoEdit {
             return false;
             return false;
 
 
 
 
-        });
+        }));
 
 
 
 
         this.nameField = cb.textField;
         this.nameField = cb.textField;

+ 3 - 3
Script/AtomicEditor/ui/frames/inspector/CreateComponentButton.ts

@@ -133,7 +133,7 @@ class CreateComponentButton extends Atomic.UIButton {
 
 
         this.text = "Create Component";
         this.text = "Create Component";
 
 
-        this.subscribeToEvent("WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 
@@ -143,7 +143,7 @@ class CreateComponentButton extends Atomic.UIButton {
         var menu = new Atomic.UIMenuWindow(this, "create component popup");
         var menu = new Atomic.UIMenuWindow(this, "create component popup");
         menu.fontDescription = this.fd;
         menu.fontDescription = this.fd;
         menu.show(componentCreateSource);
         menu.show(componentCreateSource);
-    };
+    }
 
 
     handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
     handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
 
 
@@ -152,7 +152,7 @@ class CreateComponentButton extends Atomic.UIButton {
 
 
         if (ev.target && ev.target.id == "create component popup") {
         if (ev.target && ev.target.id == "create component popup") {
 
 
-            this.sendEvent("SelectionCreateComponent", { componentTypeName : ev.refid});
+            this.sendEvent(Editor.SelectionCreateComponentEventData({ componentTypeName : ev.refid}));
 
 
             return true;
             return true;
 
 

+ 6 - 7
Script/AtomicEditor/ui/frames/inspector/InspectorFrame.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
 
 
 // inspectors
 // inspectors
@@ -54,14 +53,14 @@ class InspectorFrame extends ScriptWidget {
 
 
         var container = this.getWidget("inspectorcontainer");
         var container = this.getWidget("inspectorcontainer");
 
 
-        this.subscribeToEvent(EditorEvents.EditResource, (data) => this.handleEditResource(data));
-        this.subscribeToEvent(EditorEvents.ProjectUnloadedNotification, (data) => this.handleProjectUnloaded(data));
+        this.subscribeToEvent(Editor.EditorEditResourceEvent((data) => this.handleEditResource(data)));
+        this.subscribeToEvent(Editor.ProjectUnloadedNotificationEvent((data) => this.handleProjectUnloaded(data)));
 
 
-        this.subscribeToEvent(EditorEvents.ActiveSceneEditorChange, (data) => this.handleActiveSceneEditorChanged(data));
+        this.subscribeToEvent(Editor.EditorActiveSceneEditorChangeEvent((data) => this.handleActiveSceneEditorChanged(data)));
 
 
     }
     }
 
 
-    handleActiveSceneEditorChanged(event: EditorEvents.ActiveSceneEditorChangeEvent) {
+    handleActiveSceneEditorChanged(event: Editor.EditorActiveSceneEditorChangeEvent) {
 
 
         if (this.sceneEditor == event.sceneEditor) {
         if (this.sceneEditor == event.sceneEditor) {
             return;
             return;
@@ -83,7 +82,7 @@ class InspectorFrame extends ScriptWidget {
 
 
         if (this.scene) {
         if (this.scene) {
 
 
-            this.subscribeToEvent(this.scene, "SceneNodeSelected", (event: Editor.SceneNodeSelectedEvent) => this.handleSceneNodeSelected(event));
+            this.subscribeToEvent(this.scene, Editor.SceneNodeSelectedEvent((event: Editor.SceneNodeSelectedEvent) => this.handleSceneNodeSelected(event)));
 
 
             // add the current selection
             // add the current selection
             var selection = this.sceneEditor.selection;
             var selection = this.sceneEditor.selection;
@@ -151,7 +150,7 @@ class InspectorFrame extends ScriptWidget {
     }
     }
 
 
 
 
-    handleEditResource(ev: EditorEvents.EditResourceEvent) {
+    handleEditResource(ev: Editor.EditorEditResourceEvent) {
 
 
         var path = ev.path;
         var path = ev.path;
 
 

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/InspectorWidget.ts

@@ -48,7 +48,7 @@ class InspectorWidget extends ScriptWidget {
         this.gravity = Atomic.UI_GRAVITY.UI_GRAVITY_ALL;
         this.gravity = Atomic.UI_GRAVITY.UI_GRAVITY_ALL;
         this.addChild(layout);
         this.addChild(layout);
 
 
-        this.subscribeToEvent("WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 11 - 12
Script/AtomicEditor/ui/frames/inspector/MaterialInspector.ts

@@ -21,9 +21,7 @@
 //
 //
 
 
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
-import UIEvents = require("ui/UIEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
-import EditorEvents = require("editor/EditorEvents");
 
 
 import TextureSelector = require("./TextureSelector");
 import TextureSelector = require("./TextureSelector");
 
 
@@ -92,7 +90,7 @@ class MaterialInspector extends ScriptWidget {
         this.fd.id = "Vera";
         this.fd.id = "Vera";
         this.fd.size = 11;
         this.fd.size = 11;
 
 
-        this.subscribeToEvent("ResourceAdded", (ev: ToolCore.ResourceAddedEvent) => this.refreshTechniquesPopup());
+        this.subscribeToEvent(ToolCore.ResourceAddedEvent((ev: ToolCore.ResourceAddedEvent) => this.refreshTechniquesPopup()));
     }
     }
 
 
     createShaderParametersSection(): Atomic.UISection {
     createShaderParametersSection(): Atomic.UISection {
@@ -136,7 +134,7 @@ class MaterialInspector extends ScriptWidget {
             field.id = params[i].name;
             field.id = params[i].name;
             field.text = params[i].valueString;
             field.text = params[i].valueString;
 
 
-            field.subscribeToEvent(field, "WidgetEvent", function (ev: Atomic.UIWidgetEvent) {
+            field.subscribeToEvent(field, Atomic.UIWidgetEvent(function (ev: Atomic.UIWidgetEvent) {
 
 
                 if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) {
                 if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) {
 
 
@@ -145,7 +143,7 @@ class MaterialInspector extends ScriptWidget {
 
 
                 }
                 }
 
 
-            }.bind(this));
+            }.bind(this)));
 
 
             attrLayout.addChild(field);
             attrLayout.addChild(field);
 
 
@@ -230,7 +228,7 @@ class MaterialInspector extends ScriptWidget {
             menu.fontDescription = this.fd;
             menu.fontDescription = this.fd;
             menu.show(techniqueSource);
             menu.show(techniqueSource);
 
 
-            button.subscribeToEvent(button, "WidgetEvent", function (ev: Atomic.UIWidgetEvent) {
+            button.subscribeToEvent(button, Atomic.UIWidgetEvent(function (ev: Atomic.UIWidgetEvent) {
 
 
                 if (ev.type != Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK)
                 if (ev.type != Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK)
                     return;
                     return;
@@ -241,7 +239,7 @@ class MaterialInspector extends ScriptWidget {
 
 
                 }
                 }
 
 
-            }.bind(this));
+            }.bind(this)));
 
 
         }.bind(this);
         }.bind(this);
 
 
@@ -275,7 +273,7 @@ class MaterialInspector extends ScriptWidget {
                 this.createTextureRemoveButtonCallback(this.tunit, this.textureWidget);
                 this.createTextureRemoveButtonCallback(this.tunit, this.textureWidget);
                 return;
                 return;
             }
             }
-            
+
             var texture = <Atomic.Texture2D>Atomic.cache.getResource("Texture2D", asset.path);
             var texture = <Atomic.Texture2D>Atomic.cache.getResource("Texture2D", asset.path);
 
 
             if (texture) {
             if (texture) {
@@ -295,7 +293,7 @@ class MaterialInspector extends ScriptWidget {
             var texture = this.material.getTexture(textureUnit);
             var texture = this.material.getTexture(textureUnit);
 
 
             if (textureWidget.getTexture() != null) {
             if (textureWidget.getTexture() != null) {
-                this.sendEvent(EditorEvents.InspectorProjectReference, { "path": texture.getName() });
+                this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": texture.getName() }));
             } else {
             } else {
                 this.openTextureSelectionBox(textureUnit, textureWidget);
                 this.openTextureSelectionBox(textureUnit, textureWidget);
             }
             }
@@ -394,7 +392,7 @@ class MaterialInspector extends ScriptWidget {
             attrsVerticalLayout.addChild(attrLayout);
             attrsVerticalLayout.addChild(attrLayout);
 
 
             // handle dropping of texture on widget
             // handle dropping of texture on widget
-            textureButton.subscribeToEvent(textureButton, "DragEnded", (ev: Atomic.DragEndedEvent) => {
+            textureButton.subscribeToEvent(textureButton, Atomic.DragEndedEvent((ev: Atomic.DragEndedEvent) => {
 
 
                 var importer = this.acceptAssetDrag("TextureImporter", ev);
                 var importer = this.acceptAssetDrag("TextureImporter", ev);
 
 
@@ -410,10 +408,11 @@ class MaterialInspector extends ScriptWidget {
                         this.material.setTexture(ev.target["tunit"], texture);
                         this.material.setTexture(ev.target["tunit"], texture);
                         (<Atomic.UITextureWidget>ev.target["textureWidget"]).texture = this.getTextureThumbnail(texture);
                         (<Atomic.UITextureWidget>ev.target["textureWidget"]).texture = this.getTextureThumbnail(texture);
 
 
-                        this.sendEvent("InspectorProjectReference", { "path": texture.getName(), "ButtonID": texture.getName() });
+                        // note, ButtonID has been commented out because it doesn't appear to be used anywhere
+                        this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": texture.getName() /* "ButtonID": texture.getName() */ }));
                     }
                     }
                 }
                 }
-            });
+            }));
 
 
         }
         }
 
 

+ 4 - 5
Script/AtomicEditor/ui/frames/inspector/ModelInspector.ts

@@ -23,7 +23,6 @@
 import InspectorWidget = require("./InspectorWidget");
 import InspectorWidget = require("./InspectorWidget");
 import ArrayEditWidget = require("./ArrayEditWidget");
 import ArrayEditWidget = require("./ArrayEditWidget");
 import InspectorUtils = require("./InspectorUtils");
 import InspectorUtils = require("./InspectorUtils");
-import EditorEvents = require("editor/EditorEvents");
 
 
 class ModelInspector extends InspectorWidget {
 class ModelInspector extends InspectorWidget {
 
 
@@ -31,7 +30,7 @@ class ModelInspector extends InspectorWidget {
 
 
         super();
         super();
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 
@@ -93,13 +92,13 @@ class ModelInspector extends InspectorWidget {
         editField.text = asset.name;
         editField.text = asset.name;
 
 
         //This should preferably be onClick
         //This should preferably be onClick
-        editField.subscribeToEvent(editField, "UIWidgetFocusChanged", (ev: Atomic.UIWidgetFocusChangedEvent) => {
+        editField.subscribeToEvent(editField, Atomic.UIWidgetFocusChangedEvent((ev: Atomic.UIWidgetFocusChangedEvent) => {
 
 
             if (ev.widget == editField && editField.focus) {
             if (ev.widget == editField && editField.focus) {
-                this.sendEvent(EditorEvents.InspectorProjectReference, { "path": asset.getRelativePath() });
+                this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": asset.getRelativePath() }));
             }
             }
 
 
-        });
+        }));
 
 
         this.scaleEdit = InspectorUtils.createAttrEditField("Scale", modelLayout);
         this.scaleEdit = InspectorUtils.createAttrEditField("Scale", modelLayout);
         this.scaleEdit.text = this.importer.scale.toString();
         this.scaleEdit.text = this.importer.scale.toString();

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/PrefabInspector.ts

@@ -32,7 +32,7 @@ class PrefabInspector extends InspectorWidget {
         this.fd.id = "Vera";
         this.fd.id = "Vera";
         this.fd.size = 11;
         this.fd.size = 11;
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 17 - 24
Script/AtomicEditor/ui/frames/inspector/SelectionInspector.ts

@@ -23,7 +23,6 @@
 import EditorUI = require("../../EditorUI");
 import EditorUI = require("../../EditorUI");
 import CreateComponentButton = require("./CreateComponentButton");
 import CreateComponentButton = require("./CreateComponentButton");
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
-import EditorEvents = require("editor/EditorEvents");
 import SerializableEditType = require("./SerializableEditType");
 import SerializableEditType = require("./SerializableEditType");
 import SelectionSection = require("./SelectionSection");
 import SelectionSection = require("./SelectionSection");
 import SelectionPrefabWidget = require("./SelectionPrefabWidget");
 import SelectionPrefabWidget = require("./SelectionPrefabWidget");
@@ -48,7 +47,7 @@ class NodeSection extends SelectionSection {
         this.transformEdits.push(this.attrEdits["Rotation"]);
         this.transformEdits.push(this.attrEdits["Rotation"]);
         this.transformEdits.push(this.attrEdits["Scale"]);
         this.transformEdits.push(this.attrEdits["Scale"]);
 
 
-        this.subscribeToEvent("Update", (ev) => this.handleUpdate(ev));
+        this.subscribeToEvent(Atomic.UpdateEvent((ev) => this.handleUpdate(ev)));
 
 
     }
     }
 
 
@@ -129,12 +128,6 @@ class SceneSection extends SelectionSection {
 
 
 }
 }
 
 
-interface AttributeEditResourceChangedEvent {
-
-    attrInfoEdit: AttributeInfoEdit;
-    resource: Atomic.Resource;
-
-}
 
 
 class JSComponentSection extends ComponentSection {
 class JSComponentSection extends ComponentSection {
 
 
@@ -144,11 +137,11 @@ class JSComponentSection extends ComponentSection {
 
 
         this.hasDynamicAttr = true;
         this.hasDynamicAttr = true;
 
 
-        this.subscribeToEvent(this, "AttributeEditResourceChanged", (ev) => this.handleAttributeEditResourceChanged(ev));
+        this.subscribeToEvent(this, Editor.AttributeEditResourceChangedEvent((ev) => this.handleAttributeEditResourceChanged(ev)));
         this.updateTitleFromComponentClass();
         this.updateTitleFromComponentClass();
     }
     }
 
 
-    private handleAttributeEditResourceChanged(ev: AttributeEditResourceChangedEvent) {
+    private handleAttributeEditResourceChanged(ev: Editor.AttributeEditResourceChangedEvent) {
 
 
         var jsc = <Atomic.JSComponent>this.editType.getFirstObject();
         var jsc = <Atomic.JSComponent>this.editType.getFirstObject();
 
 
@@ -168,7 +161,7 @@ class JSComponentSection extends ComponentSection {
             let jscf = <Atomic.JSComponentFile> jsc.componentFile;
             let jscf = <Atomic.JSComponentFile> jsc.componentFile;
             if (jscf.typeScriptClass) {
             if (jscf.typeScriptClass) {
                 this.text = this.text.replace(".js", ".ts");
                 this.text = this.text.replace(".js", ".ts");
-            }            
+            }
         }
         }
     }
     }
 
 
@@ -184,11 +177,11 @@ class CSComponentSection extends ComponentSection {
 
 
         this.hasDynamicAttr = true;
         this.hasDynamicAttr = true;
 
 
-        this.subscribeToEvent(this, "AttributeEditResourceChanged", (ev) => this.handleAttributeEditResourceChanged(ev));
+        this.subscribeToEvent(this, Editor.AttributeEditResourceChangedEvent((ev) => this.handleAttributeEditResourceChanged(ev)));
 
 
-        this.subscribeToEvent("CSComponentAssemblyChanged", (ev) => this.handleCSComponentAssemblyChanged(ev));
+        this.subscribeToEvent(AtomicNETScript.CSComponentAssemblyChangedEvent((ev) => this.handleCSComponentAssemblyChanged(ev)));
 
 
-        this.subscribeToEvent("CSComponentClassChanged", (ev) => this.handleCSComponentClassChanged(ev));
+        this.subscribeToEvent(AtomicNETScript.CSComponentClassChangedEvent((ev) => this.handleCSComponentClassChanged(ev)));
 
 
     }
     }
 
 
@@ -222,7 +215,7 @@ class CSComponentSection extends ComponentSection {
     }
     }
 
 
 
 
-    private handleAttributeEditResourceChanged(ev: AttributeEditResourceChangedEvent) {
+    private handleAttributeEditResourceChanged(ev: Editor.AttributeEditResourceChangedEvent) {
 
 
 
 
         var csc = <AtomicNETScript.CSComponent>this.editType.getFirstObject();
         var csc = <AtomicNETScript.CSComponent>this.editType.getFirstObject();
@@ -290,14 +283,14 @@ class SelectionInspector extends ScriptWidget {
         this.createComponentButton = new CreateComponentButton();
         this.createComponentButton = new CreateComponentButton();
         mainLayout.addChild(this.createComponentButton);
         mainLayout.addChild(this.createComponentButton);
 
 
-        this.subscribeToEvent(sceneEditor.scene, "SceneEditStateChangesBegin", (data) => this.handleSceneEditStateChangesBeginEvent());
-        this.subscribeToEvent("SceneEditStateChange", (data) => this.handleSceneEditStateChangeEvent(data));
-        this.subscribeToEvent(sceneEditor.scene, "SceneEditStateChangesEnd", (data) => this.handleSceneEditStateChangesEndEvent());
+        this.subscribeToEvent(sceneEditor.scene, Editor.SceneEditStateChangesBeginEvent((data) => this.handleSceneEditStateChangesBeginEvent()));
+        this.subscribeToEvent(Editor.SceneEditStateChangeEvent((data) => this.handleSceneEditStateChangeEvent(data)));
+        this.subscribeToEvent(sceneEditor.scene, Editor.SceneEditStateChangesEndEvent((data) => this.handleSceneEditStateChangesEndEvent()));
 
 
-        this.subscribeToEvent(sceneEditor.scene, "SceneEditNodeRemoved", (ev: Editor.SceneEditNodeRemovedEvent) => this.handleSceneEditNodeRemoved(ev));
-        this.subscribeToEvent(sceneEditor.scene, "SceneEditComponentAddedRemoved", (ev) => this.handleSceneEditComponentAddedRemovedEvent(ev));
+        this.subscribeToEvent(sceneEditor.scene, Editor.SceneEditNodeRemovedEvent((ev: Editor.SceneEditNodeRemovedEvent) => this.handleSceneEditNodeRemoved(ev)));
+        this.subscribeToEvent(sceneEditor.scene, Editor.SceneEditComponentAddedRemovedEvent((ev) => this.handleSceneEditComponentAddedRemovedEvent(ev)));
 
 
-        this.subscribeToEvent(this.createComponentButton, "SelectionCreateComponent", (data) => this.handleSelectionCreateComponent(data));
+        this.subscribeToEvent(this.createComponentButton, Editor.SelectionCreateComponentEvent((data) => this.handleSelectionCreateComponent(data)));
 
 
     }
     }
 
 
@@ -682,7 +675,7 @@ class SelectionInspector extends ScriptWidget {
 
 
         if (removed.length) {
         if (removed.length) {
 
 
-            this.sceneEditor.scene.sendEvent("SceneEditEnd");
+            this.sceneEditor.scene.sendEvent(Editor.SceneEditEndEventType);
             this.refresh();
             this.refresh();
 
 
         }
         }
@@ -706,7 +699,7 @@ class SelectionInspector extends ScriptWidget {
 
 
             this.component = c;
             this.component = c;
 
 
-            this.sceneEditor.scene.sendEvent("SceneEditComponentCopy", { component: this.component });
+            this.sceneEditor.scene.sendEvent(Editor.SceneEditComponentCopyEventData({ component: this.component }));
             this.refresh();
             this.refresh();
 
 
         }
         }
@@ -728,7 +721,7 @@ class SelectionInspector extends ScriptWidget {
 
 
             this.component = c;
             this.component = c;
 
 
-            this.sceneEditor.scene.sendEvent("SceneEditComponentPaste", { component: this.component });
+            this.sceneEditor.scene.sendEvent(Editor.SceneEditComponentPasteEventData({ component: this.component , end: false}));
             this.refresh();
             this.refresh();
         }
         }
 
 

+ 5 - 5
Script/AtomicEditor/ui/frames/inspector/SelectionPrefabWidget.ts

@@ -57,7 +57,7 @@ class SelectionPrefabWidget extends Atomic.UILayout {
 
 
         saveButton.onClick = () => {
         saveButton.onClick = () => {
 
 
-            this.node.scene.sendEvent("SceneEditPrefabSave", {node : this.node});
+            this.node.scene.sendEvent(Editor.SceneEditPrefabSaveEventData({node : this.node}));
             return true;
             return true;
         };
         };
 
 
@@ -67,7 +67,7 @@ class SelectionPrefabWidget extends Atomic.UILayout {
 
 
         undoButton.onClick = () => {
         undoButton.onClick = () => {
 
 
-            this.node.scene.sendEvent("SceneEditPrefabRevert", {node : this.node});
+            this.node.scene.sendEvent(Editor.SceneEditPrefabRevertEventData({node : this.node}));
             return true;
             return true;
 
 
         };
         };
@@ -192,7 +192,7 @@ class ConfirmPrefabBreak extends Atomic.UIWindow {
 
 
         this.dimmer = new Atomic.UIDimmer();
         this.dimmer = new Atomic.UIDimmer();
 
 
-        this.subscribeToEvent("WidgetEvent", (ev) => { this.handleWidgetEvent(ev); });
+        this.subscribeToEvent(Atomic.UIWidgetEvent((ev) => { this.handleWidgetEvent(ev); }));
 
 
     }
     }
 
 
@@ -206,7 +206,7 @@ class ConfirmPrefabBreak extends Atomic.UIWindow {
 
 
                 this.hide();
                 this.hide();
 
 
-                this.node.scene.sendEvent("SceneEditPrefabBreak", {node : this.node});
+                this.node.scene.sendEvent(Editor.SceneEditPrefabBreakEventData({node : this.node}));
 
 
                 return true;
                 return true;
             }
             }
@@ -215,7 +215,7 @@ class ConfirmPrefabBreak extends Atomic.UIWindow {
 
 
                 this.hide();
                 this.hide();
 
 
-                this.node.scene.sendEvent("SceneEditPrefabRevert", {node : this.node});
+                this.node.scene.sendEvent(Editor.SceneEditPrefabRevertEventData({node : this.node}));
 
 
                 return true;
                 return true;
             }
             }

+ 4 - 4
Script/AtomicEditor/ui/frames/inspector/SelectionSectionCoreUI.ts

@@ -87,20 +87,20 @@ class CubemapGeneratorSectionUI extends SelectionSectionUI {
 
 
                     scene = gen.scene;
                     scene = gen.scene;
 
 
-                    this.subscribeToEvent(scene, "CubemapRenderBegin", () => {
+                    this.subscribeToEvent(scene, Editor.CubemapRenderBeginEvent(() => {
 
 
                         count++;
                         count++;
 
 
-                    });
+                    }));
 
 
-                    this.subscribeToEvent(scene, "CubemapRenderEnd", () => {
+                    this.subscribeToEvent(scene, Editor.CubemapRenderEndEvent(() => {
 
 
                         count--;
                         count--;
 
 
                         if (!count)
                         if (!count)
                             progressModal.hide();
                             progressModal.hide();
 
 
-                    });
+                    }));
 
 
 
 
                 }
                 }

+ 5 - 5
Script/AtomicEditor/ui/frames/inspector/SerializableEditType.ts

@@ -128,15 +128,15 @@ class SerializableEditType {
 
 
         if (scene) {
         if (scene) {
 
 
-            scene.sendEvent("SceneEditEnd");
+            scene.sendEvent(Editor.SceneEditEndEventType);
 
 
             if (editTypeName != "Node") {
             if (editTypeName != "Node") {
 
 
-                scene.sendEvent("ComponentEditEnd");
-                
+                scene.sendEvent(Editor.ComponentEditEndEventType);
+
             }
             }
         }
         }
-            
+
 
 
 
 
     }
     }
@@ -153,7 +153,7 @@ class SerializableEditType {
         if (node)
         if (node)
             return node.scene;
             return node.scene;
 
 
-        return null;        
+        return null;
     }
     }
 
 
     compareTypes(otherType: SerializableEditType, multiSelect:boolean = false): boolean {
     compareTypes(otherType: SerializableEditType, multiSelect:boolean = false): boolean {

+ 0 - 2
Script/AtomicEditor/ui/frames/inspector/TextureInspector.ts

@@ -21,9 +21,7 @@
 //
 //
 
 
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
-import UIEvents = require("ui/UIEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
-import EditorEvents = require("editor/EditorEvents");
 import InspectorWidget = require("./InspectorWidget");
 import InspectorWidget = require("./InspectorWidget");
 import InspectorUtils = require("./InspectorUtils");
 import InspectorUtils = require("./InspectorUtils");
 
 

+ 1 - 1
Script/AtomicEditor/ui/frames/inspector/TextureSelector.ts

@@ -75,7 +75,7 @@ class TextureSelector extends Atomic.UIWindow {
 
 
         this.center();
         this.center();
 
 
-        this.subscribeToEvent("WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 7 - 8
Script/AtomicEditor/ui/frames/menus/HierarchyFrameMenu.ts

@@ -21,7 +21,6 @@
 //
 //
 
 
 import strings = require("ui/EditorStrings");
 import strings = require("ui/EditorStrings");
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import MenuItemSources = require("./MenuItemSources");
 import MenuItemSources = require("./MenuItemSources");
 import ServiceLocator from "../../../hostExtensions/ServiceLocator";
 import ServiceLocator from "../../../hostExtensions/ServiceLocator";
@@ -39,9 +38,9 @@ class HierarchyFrameMenus extends Atomic.ScriptObject {
         MenuItemSources.createMenuItemSource("hierarchy create items", createItems);
         MenuItemSources.createMenuItemSource("hierarchy create items", createItems);
         this.contextMenuItemSource = MenuItemSources.createMenuItemSource("node context general", nodeGeneralContextItems);
         this.contextMenuItemSource = MenuItemSources.createMenuItemSource("node context general", nodeGeneralContextItems);
 
 
-        this.subscribeToEvent(EditorEvents.ContentFolderChanged, (ev: EditorEvents.ContentFolderChangedEvent) => {
+        this.subscribeToEvent(Editor.ContentFolderChangedEvent((ev: Editor.ContentFolderChangedEvent) => {
             this.contentFolder = ev.path;
             this.contentFolder = ev.path;
-        });
+        }));
 
 
     }
     }
 
 
@@ -74,7 +73,7 @@ class HierarchyFrameMenus extends Atomic.ScriptObject {
             }
             }
 
 
             if (child) {
             if (child) {
-                child.scene.sendEvent("SceneEditNodeCreated", { node: child });
+                child.scene.sendEvent(Editor.SceneEditNodeCreatedEventData({ node: child }));
             }
             }
 
 
             return true;
             return true;
@@ -101,10 +100,10 @@ class HierarchyFrameMenus extends Atomic.ScriptObject {
                     return;
                     return;
 
 
                 var scene = node.scene;
                 var scene = node.scene;
-                scene.sendEvent("SceneEditAddRemoveNodes", { end: false });
-                scene.sendEvent("SceneEditNodeRemoved", { node: node, parent: node.parent, scene: scene });
+                scene.sendEvent(Editor.SceneEditAddRemoveNodesEventData({ end: false }));
+                scene.sendEvent(Editor.SceneEditNodeRemovedEventData({ node: node, parent: node.parent, scene: scene }));
                 node.remove();
                 node.remove();
-                scene.sendEvent("SceneEditAddRemoveNodes", { end: true });
+                scene.sendEvent(Editor.SceneEditAddRemoveNodesEventData({ end: true }));
 
 
                 editor.selection.delete();
                 editor.selection.delete();
 
 
@@ -116,7 +115,7 @@ class HierarchyFrameMenus extends Atomic.ScriptObject {
                     return;
                     return;
 
 
                 var newnode = node.clone();
                 var newnode = node.clone();
-                node.scene.sendEvent("SceneEditNodeCreated", { node: newnode });
+                node.scene.sendEvent(Editor.SceneEditNodeCreatedEventData({ node: newnode }));
 
 
                 return true;
                 return true;
             }
             }

+ 10 - 11
Script/AtomicEditor/ui/frames/menus/MainFrameMenu.ts

@@ -21,7 +21,6 @@
 //
 //
 
 
 import strings = require("../../EditorStrings");
 import strings = require("../../EditorStrings");
-import EditorEvents = require("../../../editor/EditorEvents");
 import EditorUI = require("../../EditorUI");
 import EditorUI = require("../../EditorUI");
 import MenuItemSources = require("./MenuItemSources");
 import MenuItemSources = require("./MenuItemSources");
 import Preferences = require("editor/Preferences");
 import Preferences = require("editor/Preferences");
@@ -140,7 +139,7 @@ class MainFrameMenu extends Atomic.ScriptObject {
         } else if (target.id == "menu file popup") {
         } else if (target.id == "menu file popup") {
             if (refid == "quit") {
             if (refid == "quit") {
 
 
-                this.sendEvent("ExitRequested");
+                this.sendEvent(Atomic.ExitRequestedEventType);
                 return true;
                 return true;
 
 
             }
             }
@@ -171,18 +170,18 @@ class MainFrameMenu extends Atomic.ScriptObject {
 
 
                 }
                 }
 
 
-                var requestProjectLoad = () => this.sendEvent(EditorEvents.RequestProjectLoad, { path: path });
+                var requestProjectLoad = () => this.sendEvent(Editor.RequestProjectLoadEventData({ path: path }));
 
 
                 if (ToolCore.toolSystem.project) {
                 if (ToolCore.toolSystem.project) {
 
 
-                    this.subscribeToEvent(EditorEvents.ProjectClosed, () => {
+                    this.subscribeToEvent(Editor.EditorProjectClosedEvent(() => {
 
 
-                        this.unsubscribeFromEvent(EditorEvents.ProjectClosed);
+                        this.unsubscribeFromEvent(Editor.EditorProjectClosedEventType);
                         requestProjectLoad();
                         requestProjectLoad();
 
 
-                    });
+                    }));
 
 
-                    this.sendEvent(EditorEvents.CloseProject);
+                    this.sendEvent(Editor.EditorCloseProjectEventType);
 
 
                 } else {
                 } else {
 
 
@@ -196,7 +195,7 @@ class MainFrameMenu extends Atomic.ScriptObject {
 
 
             if (refid == "file close project") {
             if (refid == "file close project") {
 
 
-                this.sendEvent(EditorEvents.CloseProject);
+                this.sendEvent(Editor.EditorCloseProjectEventType);
 
 
                 return true;
                 return true;
 
 
@@ -213,7 +212,7 @@ class MainFrameMenu extends Atomic.ScriptObject {
             }
             }
 
 
             if (refid == "file save all") {
             if (refid == "file save all") {
-                this.sendEvent(EditorEvents.SaveAllResources);
+                this.sendEvent(Editor.EditorSaveAllResourcesEventType);
                 return true;
                 return true;
             }
             }
 
 
@@ -271,11 +270,11 @@ class MainFrameMenu extends Atomic.ScriptObject {
             if (refid == "tools toggle profiler") {
             if (refid == "tools toggle profiler") {
                 Atomic.ui.toggleDebugHud();
                 Atomic.ui.toggleDebugHud();
                 return true;
                 return true;
-            } if (refid == "tools perf profiler") {                
+            } if (refid == "tools perf profiler") {
                 Atomic.ui.debugHudProfileMode = Atomic.DebugHudProfileMode.DEBUG_HUD_PROFILE_PERFORMANCE;
                 Atomic.ui.debugHudProfileMode = Atomic.DebugHudProfileMode.DEBUG_HUD_PROFILE_PERFORMANCE;
                 Atomic.ui.showDebugHud(true);
                 Atomic.ui.showDebugHud(true);
                 return true;
                 return true;
-            } else if (refid == "tools metrics profiler") {                
+            } else if (refid == "tools metrics profiler") {
                 Atomic.ui.debugHudProfileMode = Atomic.DebugHudProfileMode.DEBUG_HUD_PROFILE_METRICS;
                 Atomic.ui.debugHudProfileMode = Atomic.DebugHudProfileMode.DEBUG_HUD_PROFILE_METRICS;
                 Atomic.ui.showDebugHud(true);
                 Atomic.ui.showDebugHud(true);
                 return true;
                 return true;

+ 0 - 1
Script/AtomicEditor/ui/frames/menus/MenuItemSources.ts

@@ -21,7 +21,6 @@
 //
 //
 
 
 import strings = require("ui/EditorStrings");
 import strings = require("ui/EditorStrings");
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 
 
 var UIMenuItemSource = Atomic.UIMenuItemSource;
 var UIMenuItemSource = Atomic.UIMenuItemSource;

+ 2 - 3
Script/AtomicEditor/ui/frames/menus/ProjectFrameMenu.ts

@@ -21,7 +21,6 @@
 //
 //
 
 
 import strings = require("ui/EditorStrings");
 import strings = require("ui/EditorStrings");
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import MenuItemSources = require("./MenuItemSources");
 import MenuItemSources = require("./MenuItemSources");
 import ServiceLocator from "../../../hostExtensions/ServiceLocator";
 import ServiceLocator from "../../../hostExtensions/ServiceLocator";
@@ -40,9 +39,9 @@ class ProjectFrameMenus extends Atomic.ScriptObject {
         this.contextMenuItemSource = MenuItemSources.createMenuItemSource("asset context general", assetGeneralContextItems);
         this.contextMenuItemSource = MenuItemSources.createMenuItemSource("asset context general", assetGeneralContextItems);
         MenuItemSources.createMenuItemSource("project create items", createItems);
         MenuItemSources.createMenuItemSource("project create items", createItems);
 
 
-        this.subscribeToEvent(EditorEvents.ContentFolderChanged, (ev: EditorEvents.ContentFolderChangedEvent) => {
+        this.subscribeToEvent(Editor.ContentFolderChangedEvent((ev: Editor.ContentFolderChangedEvent) => {
             this.contentFolder = ev.path;
             this.contentFolder = ev.path;
-        });
+        }));
 
 
     }
     }
 
 

+ 1 - 2
Script/AtomicEditor/ui/modal/CreateProject.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("../../editor/EditorEvents");
 import EditorUI = require("../EditorUI");
 import EditorUI = require("../EditorUI");
 import ModalWindow = require("./ModalWindow");
 import ModalWindow = require("./ModalWindow");
 import Preferences = require("../../editor/Preferences");
 import Preferences = require("../../editor/Preferences");
@@ -260,7 +259,7 @@ class CreateProject extends ModalWindow {
 
 
             this.hide();
             this.hide();
 
 
-            this.sendEvent(EditorEvents.LoadProject, { path: folder });
+            this.sendEvent(Editor.EditorLoadProjectEventData({ path: folder }));
             return true;
             return true;
         } else {
         } else {
             let message = [
             let message = [

+ 3 - 4
Script/AtomicEditor/ui/modal/MessageModal.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import UIEvents = require("../UIEvents");
 import EditorUI = require("../EditorUI");
 import EditorUI = require("../EditorUI");
 
 
 export class MessageModal extends Atomic.ScriptObject {
 export class MessageModal extends Atomic.ScriptObject {
@@ -37,15 +36,15 @@ export class MessageModal extends Atomic.ScriptObject {
 
 
     super();
     super();
 
 
-    this.subscribeToEvent(UIEvents.MessageModalEvent, (data) => {
+    this.subscribeToEvent(Editor.EditorModalEvent((data) => {
 
 
-      if (data.type == "error") {
+      if (data.type == Editor.EDITOR_MODALERROR) {
 
 
         this.showErrorWindow(data.title, data.message);
         this.showErrorWindow(data.title, data.message);
 
 
       }
       }
 
 
-    });
+    }));
 
 
   }
   }
 
 

+ 2 - 2
Script/AtomicEditor/ui/modal/ModalOps.ts

@@ -53,14 +53,14 @@ class ModalOps extends Atomic.ScriptObject {
 
 
         this.dimmer = new Atomic.UIDimmer();
         this.dimmer = new Atomic.UIDimmer();
 
 
-        this.subscribeToEvent("WindowClosed", (e) => {
+        this.subscribeToEvent(Atomic.WindowClosedEvent((e) => {
             if (e.window == this.opWindow) {
             if (e.window == this.opWindow) {
                 this.opWindow = null;
                 this.opWindow = null;
                 if (this.dimmer.parent) {
                 if (this.dimmer.parent) {
                     this.dimmer.parent.removeChild(this.dimmer, false);
                     this.dimmer.parent.removeChild(this.dimmer, false);
                 }
                 }
             }
             }
-        });
+        }));
 
 
     }
     }
 
 

+ 3 - 3
Script/AtomicEditor/ui/modal/ModalWindow.ts

@@ -36,13 +36,13 @@ class ModalWindow extends Atomic.UIWindow {
 
 
         this.setFocus();
         this.setFocus();
 
 
-        this.subscribeToEvent(this, "WidgetDeleted", (event: Atomic.UIWidgetDeletedEvent) => {
+        this.subscribeToEvent(this, Atomic.UIWidgetDeletedEvent((event: Atomic.UIWidgetDeletedEvent) => {
 
 
             this.hide();
             this.hide();
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 1 - 2
Script/AtomicEditor/ui/modal/ResourceSelection.ts

@@ -21,7 +21,6 @@
 //
 //
 
 
 import EditorUI = require("../EditorUI");
 import EditorUI = require("../EditorUI");
-import EditorEvents = require("../../editor/EditorEvents");
 import ModalWindow = require("./ModalWindow");
 import ModalWindow = require("./ModalWindow");
 import SearchBarFiltering = require("resources/SearchBarFiltering");
 import SearchBarFiltering = require("resources/SearchBarFiltering");
 
 
@@ -52,7 +51,7 @@ class ResourceSelection extends ModalWindow {
         this.setSize(800, 600);
         this.setSize(800, 600);
         this.center();
         this.center();
 
 
-        this.searchEdit.subscribeToEvent(this.searchEdit, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.searchEdit.subscribeToEvent(this.searchEdit, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 7 - 8
Script/AtomicEditor/ui/modal/UIResourceOps.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("../EditorUI");
 import EditorUI = require("../EditorUI");
 import ModalWindow = require("./ModalWindow");
 import ModalWindow = require("./ModalWindow");
 import ResourceOps = require("resources/ResourceOps");
 import ResourceOps = require("resources/ResourceOps");
@@ -64,7 +63,7 @@ export class ResourceDelete extends ModalWindow {
                 var db = ToolCore.getAssetDatabase();
                 var db = ToolCore.getAssetDatabase();
                 db.deleteAsset(this.asset);
                 db.deleteAsset(this.asset);
 
 
-                this.sendEvent(EditorEvents.DeleteResourceNotification, eventData);
+                this.sendEvent(Editor.EditorDeleteResourceNotificationEventData(eventData));
 
 
                 return true;
                 return true;
             }
             }
@@ -187,7 +186,7 @@ export class CreateComponent extends ModalWindow {
 
 
                         this.hide();
                         this.hide();
 
 
-                        this.sendEvent(EditorEvents.EditResource, { path: outputFile });
+                        this.sendEvent(Editor.EditorEditResourceEventData({ path: outputFile }));
 
 
                     }
                     }
 
 
@@ -273,7 +272,7 @@ export class CreateScript extends ModalWindow {
 
 
                         this.hide();
                         this.hide();
 
 
-                        this.sendEvent(EditorEvents.EditResource, { path: outputFile });
+                        this.sendEvent(Editor.EditorEditResourceEventData({ path: outputFile }));
 
 
                     }
                     }
 
 
@@ -331,7 +330,7 @@ export class CreateScene extends ModalWindow {
 
 
                     this.hide();
                     this.hide();
 
 
-                    this.sendEvent(EditorEvents.EditResource, { path: outputFile });
+                    this.sendEvent(Editor.EditorEditResourceEventData({ path: outputFile }));
 
 
                 }
                 }
 
 
@@ -383,7 +382,7 @@ export class CreateMaterial extends ModalWindow {
 
 
                     this.hide();
                     this.hide();
 
 
-                    this.sendEvent(EditorEvents.EditResource, { path: outputFile });
+                    this.sendEvent(Editor.EditorEditResourceEventData({ path: outputFile }));
 
 
                 }
                 }
 
 
@@ -442,14 +441,14 @@ export class RenameAsset extends ModalWindow {
                     let oldPath = this.asset.path;
                     let oldPath = this.asset.path;
                     this.asset.rename(this.nameEdit.text);
                     this.asset.rename(this.nameEdit.text);
 
 
-                    let eventData: EditorEvents.RenameResourceEvent = {
+                    let eventData: Editor.EditorRenameResourceNotificationEvent = {
                         path: oldPath,
                         path: oldPath,
                         newPath: this.asset.path,
                         newPath: this.asset.path,
                         newName: this.nameEdit.text,
                         newName: this.nameEdit.text,
                         asset: this.asset
                         asset: this.asset
                     };
                     };
 
 
-                    this.sendEvent(EditorEvents.RenameResourceNotification, eventData);
+                    this.sendEvent(Editor.EditorRenameResourceNotificationEventData(eventData));
                 }
                 }
 
 
                 return true;
                 return true;

+ 1 - 1
Script/AtomicEditor/ui/modal/build/BuildComplete.ts

@@ -42,7 +42,7 @@ class BuildComplete extends Atomic.UIWindow {
             reveal.setState(Atomic.UI_WIDGET_STATE.UI_WIDGET_STATE_DISABLED, true);
             reveal.setState(Atomic.UI_WIDGET_STATE.UI_WIDGET_STATE_DISABLED, true);
 
 
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
 
 
     }
     }
 
 

+ 4 - 4
Script/AtomicEditor/ui/modal/build/BuildOutput.ts

@@ -39,19 +39,19 @@ class BuildOutput extends ModalWindow {
         this.resizeToFitContent();
         this.resizeToFitContent();
         this.center();
         this.center();
 
 
-        this.subscribeToEvent(buildBase, "BuildOutput", (ev: ToolCore.BuildOutputEvent) => {
+        this.subscribeToEvent(buildBase, ToolCore.BuildOutputEvent((ev: ToolCore.BuildOutputEvent) => {
 
 
             this.textOutput += ev.text;
             this.textOutput += ev.text;
             this.outputField.text = this.textOutput;
             this.outputField.text = this.textOutput;
             this.outputField.scrollTo(0, 0xffffff);
             this.outputField.scrollTo(0, 0xffffff);
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent("BuildComplete", (ev: ToolCore.BuildCompleteEvent) => {
+        this.subscribeToEvent(ToolCore.BuildCompleteEvent((ev: ToolCore.BuildCompleteEvent) => {
 
 
             new BuildComplete(this, ev);
             new BuildComplete(this, ev);
 
 
-        });
+        }));
 
 
     }
     }
 
 

+ 3 - 4
Script/AtomicEditor/ui/modal/build/BuildSettingsWindow.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import ModalWindow = require("../ModalWindow");
 import ModalWindow = require("../ModalWindow");
 import ProgressModal = require("../ProgressModal");
 import ProgressModal = require("../ProgressModal");
@@ -90,13 +89,13 @@ export class BuildSettingsWindow extends ModalWindow {
         this.resizeToFitContent();
         this.resizeToFitContent();
         this.center();
         this.center();
 
 
-        this.subscribeToEvent("PlatformChanged", (ev: ToolCore.PlatformChangedEvent) => {
+        this.subscribeToEvent(ToolCore.PlatformChangedEvent((ev: ToolCore.PlatformChangedEvent) => {
 
 
             this.platformIndicator.skinBg = this.platformInfo[ev.platform.name].logo;
             this.platformIndicator.skinBg = this.platformInfo[ev.platform.name].logo;
 
 
-        });
+        }));
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (ev) => this.handleWidgetEvent(ev));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((ev) => this.handleWidgetEvent(ev)));
     }
     }
 
 
     commitBuildSettings() {
     commitBuildSettings() {

+ 1 - 3
Script/AtomicEditor/ui/modal/build/BuildWindow.ts

@@ -20,11 +20,9 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import ModalWindow = require("../ModalWindow");
 import ModalWindow = require("../ModalWindow");
 import ProgressModal = require("../ProgressModal");
 import ProgressModal = require("../ProgressModal");
-import UIEvents = require("../../UIEvents");
 
 
 import WindowsSettingsWidget = require("./platforms/WindowsSettingsWidget");
 import WindowsSettingsWidget = require("./platforms/WindowsSettingsWidget");
 import MacSettingsWidget = require("./platforms/MacSettingsWidget");
 import MacSettingsWidget = require("./platforms/MacSettingsWidget");
@@ -59,7 +57,7 @@ class BuildWindow extends ModalWindow {
 
 
         }
         }
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (ev) => this.handleWidgetEvent(ev));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((ev) => this.handleWidgetEvent(ev)));
     }
     }
 
 
     handleWidgetEvent(ev: Atomic.UIWidgetEvent): boolean {
     handleWidgetEvent(ev: Atomic.UIWidgetEvent): boolean {

+ 3 - 3
Script/AtomicEditor/ui/modal/build/platforms/AndroidSettingsWidget.ts

@@ -63,7 +63,7 @@ class AndroidSettingsWidget extends Atomic.UIWidget implements BuildSettingsWind
 
 
         this.refreshWidgets();
         this.refreshWidgets();
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (ev) => this.handleWidgetEvent(ev));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((ev) => this.handleWidgetEvent(ev)));
 
 
     }
     }
 
 
@@ -136,7 +136,7 @@ class AndroidSettingsWidget extends Atomic.UIWidget implements BuildSettingsWind
 
 
         platform.refreshAndroidTargets();
         platform.refreshAndroidTargets();
 
 
-        this.subscribeToEvent(platform, "AndroidTargetsRefreshed", (ev) => {
+        this.subscribeToEvent(platform, ToolCore.AndroidTargetsRefreshedEvent((ev) => {
 
 
             this.sdkTargetSource.clear();
             this.sdkTargetSource.clear();
 
 
@@ -153,7 +153,7 @@ class AndroidSettingsWidget extends Atomic.UIWidget implements BuildSettingsWind
             this.sdkTargetSelect.value = -1;
             this.sdkTargetSelect.value = -1;
             this.sdkTargetSelect.value = 0;
             this.sdkTargetSelect.value = 0;
 
 
-        });
+        }));
 
 
     }
     }
 
 

+ 1 - 1
Script/AtomicEditor/ui/modal/build/platforms/IOSSettingsWidget.ts

@@ -42,7 +42,7 @@ class IOSSettingsWidget extends Atomic.UIWidget implements BuildSettingsWindow.B
 
 
         this.refreshWidgets();
         this.refreshWidgets();
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (ev) => this.handleWidgetEvent(ev));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((ev) => this.handleWidgetEvent(ev)));
 
 
     }
     }
 
 

+ 1 - 1
Script/AtomicEditor/ui/modal/build/platforms/WebSettingsWidget.ts

@@ -45,7 +45,7 @@ class WebSettingsWidget extends Atomic.UIWidget implements BuildSettingsWindow.B
 
 
       this.refreshWidgets();
       this.refreshWidgets();
 
 
-      this.subscribeToEvent(this, "WidgetEvent", (ev) => this.handleWidgetEvent(ev));
+      this.subscribeToEvent(this, Atomic.UIWidgetEvent((ev) => this.handleWidgetEvent(ev)));
     }
     }
 
 
     handleWidgetEvent(ev: Atomic.UIWidgetEvent): boolean {
     handleWidgetEvent(ev: Atomic.UIWidgetEvent): boolean {

+ 2 - 3
Script/AtomicEditor/ui/modal/license/EULAWindow.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("editor/EditorEvents");
 import EditorUI = require("ui/EditorUI");
 import EditorUI = require("ui/EditorUI");
 import ModalWindow = require("../ModalWindow");
 import ModalWindow = require("../ModalWindow");
 
 
@@ -63,7 +62,7 @@ class EULAWindow extends ModalWindow {
 
 
             if (id == "quit") {
             if (id == "quit") {
 
 
-                this.sendEvent("ExitRequested");
+                this.sendEvent(Atomic.ExitRequestedEventType);
                 return true;
                 return true;
 
 
             } else if (id == "ok") {
             } else if (id == "ok") {
@@ -78,7 +77,7 @@ class EULAWindow extends ModalWindow {
                 var licenseSystem = ToolCore.getLicenseSystem();
                 var licenseSystem = ToolCore.getLicenseSystem();
                 licenseSystem.licenseAgreementConfirmed();
                 licenseSystem.licenseAgreementConfirmed();
 
 
-                this.sendEvent("LicenseEulaAccepted");
+                this.sendEvent(ToolCore.LicenseEulaAcceptedEventType);
 
 
                 return true;
                 return true;
             }
             }

+ 4 - 5
Script/AtomicEditor/ui/playmode/PlayMode.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("../../editor/EditorEvents");
 import PlayerOutput = require("./PlayerOutput");
 import PlayerOutput = require("./PlayerOutput");
 import Preferences = require("../../editor/Preferences");
 import Preferences = require("../../editor/Preferences");
 
 
@@ -33,9 +32,9 @@ class PlayMode extends Atomic.ScriptObject {
 
 
         super();
         super();
         this.myPlayer = null;
         this.myPlayer = null;
-        this.subscribeToEvent("IPCJSError", (ev: Atomic.IPCJSErrorEvent) => this.handleIPCJSError(ev));
-        this.subscribeToEvent(EditorEvents.PlayerStarted, (ev) => this.handlePlayerStarted(ev));
-        this.subscribeToEvent(EditorEvents.PlayerStopped, (ev) => this.handlePlayerStopped(ev));
+        this.subscribeToEvent(Atomic.IPCJSErrorEvent((ev: Atomic.IPCJSErrorEvent) => this.handleIPCJSError(ev)));
+        this.subscribeToEvent(Editor.EditorPlayerStartedEvent((ev) => this.handlePlayerStarted(ev)));
+        this.subscribeToEvent(Editor.EditorPlayerStoppedEvent((ev) => this.handlePlayerStopped(ev)));
 
 
     }
     }
 
 
@@ -67,7 +66,7 @@ class PlayMode extends Atomic.ScriptObject {
         this.inErrorState = true;
         this.inErrorState = true;
 
 
         var errorMessage = ev.errorFileName + " - " + ev.errorLineNumber + " : " + ev.errorMessage;
         var errorMessage = ev.errorFileName + " - " + ev.errorLineNumber + " : " + ev.errorMessage;
-        this.sendEvent(EditorEvents.ModalError, { title: "Player JavaScript Error", message: errorMessage });
+        this.sendEvent(Editor.EditorModalEventData({ type: Editor.EDITOR_MODALERROR, title: "Player JavaScript Error", message: errorMessage }));
 
 
         Atomic.graphics.raiseWindow();
         Atomic.graphics.raiseWindow();
 
 

+ 3 - 4
Script/AtomicEditor/ui/playmode/PlayerOutput.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("../../editor/EditorEvents");
 import EditorUI = require("../EditorUI");
 import EditorUI = require("../EditorUI");
 import Preferences = require("../../editor/Preferences");
 import Preferences = require("../../editor/Preferences");
 
 
@@ -51,8 +50,8 @@ class PlayerOutput extends Atomic.UIWindow {
 
 
         };
         };
 
 
-        this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
-        this.subscribeToEvent(EditorEvents.PlayerLog, (ev: EditorEvents.PlayerLogEvent) => this.handlePlayerLog(ev));
+        this.subscribeToEvent(this, Atomic.UIWidgetEvent((data) => this.handleWidgetEvent(data)));
+        this.subscribeToEvent(Editor.EditorPlayerLogEvent((ev: Editor.EditorPlayerLogEvent) => this.handlePlayerLog(ev)));
 
 
         this.resizeToFitContent();
         this.resizeToFitContent();
         this.center();
         this.center();
@@ -60,7 +59,7 @@ class PlayerOutput extends Atomic.UIWindow {
 
 
     }
     }
 
 
-    handlePlayerLog(ev: EditorEvents.PlayerLogEvent) {
+    handlePlayerLog(ev: Editor.EditorPlayerLogEvent) {
 
 
         var text = this.output.text;
         var text = this.output.text;
 
 

+ 7 - 8
Script/AtomicEditor/ui/resourceEditors/AbstractTextResourceEditorBuilder.ts

@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-import EditorEvents = require("../../editor/EditorEvents");
 export abstract class AbstractTextResourceEditorBuilder implements Editor.Extensions.ResourceEditorBuilder {
 export abstract class AbstractTextResourceEditorBuilder implements Editor.Extensions.ResourceEditorBuilder {
 
 
     abstract canHandleResource(resourcePath: string): boolean;
     abstract canHandleResource(resourcePath: string): boolean;
@@ -49,10 +48,10 @@ export abstract class AbstractTextResourceEditorBuilder implements Editor.Extens
         // one time subscriptions waiting for the web view to finish loading.  This event
         // one time subscriptions waiting for the web view to finish loading.  This event
         // actually hits the editor instance before we can hook it, so listen to it on the
         // actually hits the editor instance before we can hook it, so listen to it on the
         // frame and then unhook it
         // frame and then unhook it
-        editor.subscribeToEvent(EditorEvents.WebViewLoadEnd, (data) => {
-            editor.unsubscribeFromEvent(EditorEvents.WebViewLoadEnd);
+        editor.subscribeToEvent(WebView.WebViewLoadEndEvent((data) => {
+            editor.unsubscribeFromEvent(WebView.WebViewLoadEndEventType);
             this.loadCode(<Editor.JSResourceEditor>editor, resourcePath);
             this.loadCode(<Editor.JSResourceEditor>editor, resourcePath);
-        });
+        }));
 
 
         // Cannot subscribe to WebMessage until the .ts side can return a Handler.Success() message
         // Cannot subscribe to WebMessage until the .ts side can return a Handler.Success() message
         // editor.subscribeToEvent(EditorEvents.WebMessage, (data) => {
         // editor.subscribeToEvent(EditorEvents.WebMessage, (data) => {
@@ -68,15 +67,15 @@ export abstract class AbstractTextResourceEditorBuilder implements Editor.Extens
         //     }
         //     }
         // });
         // });
 
 
-        editor.subscribeToEvent(EditorEvents.DeleteResourceNotification, (data) => {
+        editor.subscribeToEvent(Editor.EditorDeleteResourceNotificationEvent((data) => {
             const webClient = editor.webView.webClient;
             const webClient = editor.webView.webClient;
             webClient.executeJavaScript(`HOST_resourceDeleted("${this.getNormalizedPath(data.path)}");`);
             webClient.executeJavaScript(`HOST_resourceDeleted("${this.getNormalizedPath(data.path)}");`);
-        });
+        }));
 
 
-        editor.subscribeToEvent(EditorEvents.UserPreferencesChangedNotification, (data: EditorEvents.UserPreferencesChangedEvent) => {
+        editor.subscribeToEvent(Editor.UserPreferencesChangedNotificationEvent((data: Editor.UserPreferencesChangedNotificationEvent) => {
             const webClient = editor.webView.webClient;
             const webClient = editor.webView.webClient;
             webClient.executeJavaScript(`HOST_preferencesChanged('${data.projectPreferences}','${data.applicationPreferences}');`);
             webClient.executeJavaScript(`HOST_preferencesChanged('${data.projectPreferences}','${data.applicationPreferences}');`);
-        });
+        }));
 
 
         return editor;
         return editor;
     }
     }

+ 1 - 2
Script/AtomicEditor/ui/resourceEditors/Scene3dResourceEditorBuilder.ts

@@ -19,7 +19,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
-import EditorEvents = require("../../editor/EditorEvents");
 
 
 export default class Scene3dResourceEditorBuilder implements Editor.Extensions.ResourceEditorBuilder {
 export default class Scene3dResourceEditorBuilder implements Editor.Extensions.ResourceEditorBuilder {
 
 
@@ -31,7 +30,7 @@ export default class Scene3dResourceEditorBuilder implements Editor.Extensions.R
     getEditor(resourceFram: Atomic.UIWidget, resourcePath: string, tabContainer: Atomic.UITabContainer) : Editor.ResourceEditor {
     getEditor(resourceFram: Atomic.UIWidget, resourcePath: string, tabContainer: Atomic.UITabContainer) : Editor.ResourceEditor {
 
 
         const editor = new Editor.SceneEditor3D(resourcePath, tabContainer);
         const editor = new Editor.SceneEditor3D(resourcePath, tabContainer);
-        editor.sendEvent(EditorEvents.ActiveSceneEditorChange, { sceneEditor: editor });
+        editor.sendEvent(Editor.EditorActiveSceneEditorChangeEventData({ sceneEditor: editor }));
 
 
         return editor;
         return editor;
     }
     }

+ 23 - 14
Script/AtomicWebViewEditor/clientExtensions/ClientExtensionServices.ts

@@ -43,11 +43,20 @@ export class EventDispatcher implements Editor.Extensions.EventDispatcher {
         });
         });
     }
     }
 
 
-    subscribeToEvent(eventType, callback) {
-        this.subscriptions.push({
-            eventName: eventType,
-            callback: callback
-        });
+    subscribeToEvent(eventType: string, callback: (...params) => any);
+    subscribeToEvent(wrapped: Atomic.EventMetaData);
+    subscribeToEvent(eventTypeOrWrapped: any, callback?: any) {
+        if (callback) {
+            this.subscriptions.push({
+                eventName: eventTypeOrWrapped,
+                callback: callback
+            });
+        } else {
+            this.subscriptions.push({
+                eventName: eventTypeOrWrapped._eventType,
+                callback: eventTypeOrWrapped._callback
+            });
+        }
     }
     }
 }
 }
 
 
@@ -106,9 +115,9 @@ export class WebViewServicesProvider extends ServicesProvider<Editor.ClientExten
 
 
     /**
     /**
      * Called when code is loaded
      * Called when code is loaded
-     * @param  {Editor.EditorEvents.CodeLoadedEvent} ev Event info about the file that is being loaded
+     * @param  {Editor.ClientExtensions.CodeLoadedEvent} ev Event info about the file that is being loaded
      */
      */
-    codeLoaded(ev: Editor.EditorEvents.CodeLoadedEvent) {
+    codeLoaded(ev: Editor.ClientExtensions.CodeLoadedEvent) {
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
                 // Notify services that the project has just been loaded
                 // Notify services that the project has just been loaded
@@ -123,9 +132,9 @@ export class WebViewServicesProvider extends ServicesProvider<Editor.ClientExten
 
 
     /**
     /**
      * Called after code has been saved
      * Called after code has been saved
-     * @param  {Editor.EditorEvents.SaveResourceEvent} ev
+     * @param  {Editor.ClientExtensions.SaveResourceEvent} ev
      */
      */
-    saveCode(ev: Editor.EditorEvents.CodeSavedEvent) {
+    saveCode(ev: Editor.ClientExtensions.CodeSavedEvent) {
         // run through and find any services that can handle this.
         // run through and find any services that can handle this.
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
@@ -142,7 +151,7 @@ export class WebViewServicesProvider extends ServicesProvider<Editor.ClientExten
     /**
     /**
      * Called when a resource has been deleted
      * Called when a resource has been deleted
      */
      */
-    deleteResource(ev: Editor.EditorEvents.DeleteResourceEvent) {
+    deleteResource(ev: Editor.ClientExtensions.DeleteResourceEvent) {
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
                 // Verify that the service contains the appropriate methods and that it can delete
                 // Verify that the service contains the appropriate methods and that it can delete
@@ -157,9 +166,9 @@ export class WebViewServicesProvider extends ServicesProvider<Editor.ClientExten
 
 
     /**
     /**
      * Called when a resource has been renamed
      * Called when a resource has been renamed
-     * @param  {Editor.EditorEvents.RenameResourceEvent} ev
+     * @param  {Editor.ClientExtensions.RenameResourceEvent} ev
      */
      */
-    renameResource(ev: Editor.EditorEvents.RenameResourceEvent) {
+    renameResource(ev: Editor.ClientExtensions.RenameResourceEvent) {
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
                 // Verify that the service contains the appropriate methods and that it can handle the rename
                 // Verify that the service contains the appropriate methods and that it can handle the rename
@@ -190,9 +199,9 @@ export class WebViewServicesProvider extends ServicesProvider<Editor.ClientExten
 
 
     /**
     /**
      * Called when the editor is requesting to be configured for a particular file
      * Called when the editor is requesting to be configured for a particular file
-     * @param  {Editor.EditorEvents.EditorFileEvent} ev
+     * @param  {Editor.ClientExtensions.EditorFileEvent} ev
      */
      */
-    configureEditor(ev: Editor.EditorEvents.EditorFileEvent) {
+    configureEditor(ev: Editor.ClientExtensions.EditorFileEvent) {
         this.registeredServices.forEach((service) => {
         this.registeredServices.forEach((service) => {
             try {
             try {
                 // Notify services that the project has just been loaded
                 // Notify services that the project has just been loaded

+ 8 - 2
Script/AtomicWebViewEditor/clientExtensions/ServiceLocator.ts

@@ -64,9 +64,15 @@ export class ClientServiceLocatorType implements Editor.ClientExtensions.ClientS
      * @param  {string} eventType
      * @param  {string} eventType
      * @param  {any} callback
      * @param  {any} callback
      */
      */
-    subscribeToEvent(eventType: string, callback: (data: any) => void) {
+    subscribeToEvent(eventType: string, callback: (...params) => any);
+    subscribeToEvent(wrapped: Atomic.EventMetaData);
+    subscribeToEvent(eventTypeOrWrapped: any, callback?: any) {
         if (this.eventDispatcher) {
         if (this.eventDispatcher) {
-            this.eventDispatcher.subscribeToEvent(eventType, callback);
+            if (callback) {
+                this.eventDispatcher.subscribeToEvent(eventTypeOrWrapped, callback);
+            } else {
+                this.eventDispatcher.subscribeToEvent(eventTypeOrWrapped);
+            }
         }
         }
     }
     }
 
 

+ 2 - 2
Script/AtomicWebViewEditor/clientExtensions/languageExtensions/javascript/JavascriptLanguageExtension.ts

@@ -54,9 +54,9 @@ export default class JavascriptLanguageExtension implements Editor.ClientExtensi
 
 
     /**
     /**
      * Called when the editor needs to be configured for a particular file
      * Called when the editor needs to be configured for a particular file
-     * @param  {Editor.EditorEvents.EditorFileEvent} ev
+     * @param  {Editor.ClientExtensions.EditorFileEvent} ev
      */
      */
-    configureEditor(ev: Editor.EditorEvents.EditorFileEvent) {
+    configureEditor(ev: Editor.ClientExtensions.EditorFileEvent) {
         if (this.isValidFiletype(ev.filename)) {
         if (this.isValidFiletype(ev.filename)) {
             this.editor = ev.editor; // cache this so that we can reference it later
             this.editor = ev.editor; // cache this so that we can reference it later
             this.active = true;
             this.active = true;

+ 3 - 3
Script/AtomicWebViewEditor/clientExtensions/languageExtensions/turbobadger/TurboBadgerLanguageExtension.ts

@@ -51,9 +51,9 @@ export default class TurboBadgerLanguageExtension implements Editor.ClientExtens
 
 
     /**
     /**
      * Called when the editor needs to be configured for a particular file
      * Called when the editor needs to be configured for a particular file
-     * @param  {Editor.EditorEvents.EditorFileEvent} ev
+     * @param  {Editor.ClientExtensions.EditorFileEvent} ev
      */
      */
-    configureEditor(ev: Editor.EditorEvents.EditorFileEvent) {
+    configureEditor(ev: Editor.ClientExtensions.EditorFileEvent) {
         if (this.isValidFiletype(ev.filename)) {
         if (this.isValidFiletype(ev.filename)) {
             this.active = true;
             this.active = true;
             monaco.languages.register({ id: "turbobadger" });
             monaco.languages.register({ id: "turbobadger" });
@@ -73,7 +73,7 @@ export default class TurboBadgerLanguageExtension implements Editor.ClientExtens
      * Called when code is first loaded into the editor
      * Called when code is first loaded into the editor
      * @param  {CodeLoadedEvent} ev
      * @param  {CodeLoadedEvent} ev
      */
      */
-    codeLoaded(ev: Editor.EditorEvents.CodeLoadedEvent) {
+    codeLoaded(ev: Editor.ClientExtensions.CodeLoadedEvent) {
         if (this.isValidFiletype(ev.filename)) {
         if (this.isValidFiletype(ev.filename)) {
             let editor = <monaco.editor.IStandaloneCodeEditor>ev.editor;
             let editor = <monaco.editor.IStandaloneCodeEditor>ev.editor;
             editor.getModel().updateOptions({
             editor.getModel().updateOptions({

+ 9 - 9
Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/TypescriptLanguageExtension.ts

@@ -127,9 +127,9 @@ export default class TypescriptLanguageExtension implements Editor.ClientExtensi
 
 
     /**
     /**
      * Called when the editor needs to be configured for a particular file
      * Called when the editor needs to be configured for a particular file
-     * @param  {Editor.EditorEvents.EditorFileEvent} ev
+     * @param  {Editor.ClientExtensions.EditorFileEvent} ev
      */
      */
-    configureEditor(ev: Editor.EditorEvents.EditorFileEvent) {
+    configureEditor(ev: Editor.ClientExtensions.EditorFileEvent) {
         if (this.isValidFiletype(ev.filename)) {
         if (this.isValidFiletype(ev.filename)) {
             let editor = ev.editor as monaco.editor.IStandaloneCodeEditor;
             let editor = ev.editor as monaco.editor.IStandaloneCodeEditor;
             this.editor = editor; // cache this so that we can reference it later
             this.editor = editor; // cache this so that we can reference it later
@@ -223,7 +223,7 @@ export default class TypescriptLanguageExtension implements Editor.ClientExtensi
      * Called when code is first loaded into the editor
      * Called when code is first loaded into the editor
      * @param  {CodeLoadedEvent} ev
      * @param  {CodeLoadedEvent} ev
      */
      */
-    codeLoaded(ev: Editor.EditorEvents.CodeLoadedEvent) {
+    codeLoaded(ev: Editor.ClientExtensions.CodeLoadedEvent) {
         if (this.isValidFiletype(ev.filename)) {
         if (this.isValidFiletype(ev.filename)) {
 
 
             // Build our worker
             // Build our worker
@@ -374,9 +374,9 @@ export default class TypescriptLanguageExtension implements Editor.ClientExtensi
 
 
     /**
     /**
      * Called once a resource has been saved
      * Called once a resource has been saved
-     * @param  {Editor.EditorEvents.SaveResourceEvent} ev
+     * @param  {Editor.ClientExtensions.SaveResourceEvent} ev
      */
      */
-    save(ev: Editor.EditorEvents.CodeSavedEvent) {
+    save(ev: Editor.ClientExtensions.CodeSavedEvent) {
         if (this.active && this.isValidFiletype(ev.filename)) {
         if (this.active && this.isValidFiletype(ev.filename)) {
             const message: WorkerProcessTypes.SaveMessageData = {
             const message: WorkerProcessTypes.SaveMessageData = {
                 command: ClientExtensionEventNames.CodeSavedEvent,
                 command: ClientExtensionEventNames.CodeSavedEvent,
@@ -392,9 +392,9 @@ export default class TypescriptLanguageExtension implements Editor.ClientExtensi
 
 
     /**
     /**
      * Handle the delete.  This should delete the corresponding javascript file
      * Handle the delete.  This should delete the corresponding javascript file
-     * @param  {Editor.EditorEvents.DeleteResourceEvent} ev
+     * @param  {Editor.ClientExtensions.DeleteResourceEvent} ev
      */
      */
-    delete(ev: Editor.EditorEvents.DeleteResourceEvent) {
+    delete(ev: Editor.ClientExtensions.DeleteResourceEvent) {
         if (this.active && this.isValidFiletype(ev.path)) {
         if (this.active && this.isValidFiletype(ev.path)) {
             // notify the typescript language service that the file has been deleted
             // notify the typescript language service that the file has been deleted
             const message: WorkerProcessTypes.DeleteMessageData = {
             const message: WorkerProcessTypes.DeleteMessageData = {
@@ -408,9 +408,9 @@ export default class TypescriptLanguageExtension implements Editor.ClientExtensi
 
 
     /**
     /**
      * Handle the rename.  Should rename the corresponding .js file
      * Handle the rename.  Should rename the corresponding .js file
-     * @param  {Editor.EditorEvents.RenameResourceEvent} ev
+     * @param  {Editor.ClientExtensions.RenameResourceEvent} ev
      */
      */
-    rename(ev: Editor.EditorEvents.RenameResourceEvent) {
+    rename(ev: Editor.ClientExtensions.RenameResourceEvent) {
         if (this.active && this.isValidFiletype(ev.path)) {
         if (this.active && this.isValidFiletype(ev.path)) {
             // notify the typescript language service that the file has been renamed
             // notify the typescript language service that the file has been renamed
             const message: WorkerProcessTypes.RenameMessageData = {
             const message: WorkerProcessTypes.RenameMessageData = {

+ 3 - 3
Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/workerprocess/workerProcessTypes.ts

@@ -28,10 +28,10 @@ export interface WorkerProcessMessageData {
     command: string;
     command: string;
 }
 }
 
 
-export interface SaveMessageData extends WorkerProcessMessageData, Editor.EditorEvents.CodeSavedEvent { }
+export interface SaveMessageData extends WorkerProcessMessageData, Editor.ClientExtensions.CodeSavedEvent { }
 
 
-export interface DeleteMessageData extends WorkerProcessMessageData, Editor.EditorEvents.DeleteResourceEvent { }
-export interface RenameMessageData extends WorkerProcessMessageData, Editor.EditorEvents.RenameResourceEvent { }
+export interface DeleteMessageData extends WorkerProcessMessageData, Editor.ClientExtensions.DeleteResourceEvent { }
+export interface RenameMessageData extends WorkerProcessMessageData, Editor.ClientExtensions.RenameResourceEvent { }
 
 
 export const SetPreferences = "SET_PREFERENCES";
 export const SetPreferences = "SET_PREFERENCES";
 export interface SetPreferencesMessageData extends WorkerProcessMessageData {
 export interface SetPreferencesMessageData extends WorkerProcessMessageData {

+ 4 - 4
Script/AtomicWebViewEditor/editor/editorCommands.ts

@@ -106,7 +106,7 @@ export function loadCodeIntoEditor(code: string, filename: string, fileExt: stri
  * @param  {string} newPath
  * @param  {string} newPath
  */
  */
 export function resourceRenamed(path: string, newPath: string) {
 export function resourceRenamed(path: string, newPath: string) {
-    let data: Editor.EditorEvents.RenameResourceEvent = {
+    let data: Editor.ClientExtensions.RenameResourceEvent = {
         path: path,
         path: path,
         newPath: newPath
         newPath: newPath
     };
     };
@@ -118,7 +118,7 @@ export function resourceRenamed(path: string, newPath: string) {
  * @param  {string} path
  * @param  {string} path
  */
  */
 export function resourceDeleted(path: string) {
 export function resourceDeleted(path: string) {
-    let data: Editor.EditorEvents.DeleteResourceEvent = {
+    let data: Editor.ClientExtensions.DeleteResourceEvent = {
         path: path
         path: path
     };
     };
     serviceLocator.sendEvent(ClientExtensionEventNames.ResourceDeletedEvent, data);
     serviceLocator.sendEvent(ClientExtensionEventNames.ResourceDeletedEvent, data);
@@ -131,7 +131,7 @@ export function resourceDeleted(path: string) {
  * @param {string} contents
  * @param {string} contents
  */
  */
 export function codeSaved(path: string, fileExt: string, contents: string) {
 export function codeSaved(path: string, fileExt: string, contents: string) {
-    let data: Editor.EditorEvents.CodeSavedEvent = {
+    let data: Editor.ClientExtensions.CodeSavedEvent = {
         filename: path,
         filename: path,
         fileExt: fileExt,
         fileExt: fileExt,
         editor: internalEditor.getInternalEditor(),
         editor: internalEditor.getInternalEditor(),
@@ -187,4 +187,4 @@ export function invokeShortcut(shortcut: Editor.EditorShortcutType) {
             ed.setSelection(ed.getModel().getFullModelRange());
             ed.setSelection(ed.getModel().getFullModelRange());
             break;
             break;
     }
     }
-}
+}

+ 2 - 1
Script/Packages/Atomic/Core.json

@@ -27,10 +27,11 @@
 
 
 		"Object" : [
 		"Object" : [
 			"sendEvent(eventType:string, data?:Object);",
 			"sendEvent(eventType:string, data?:Object);",
+			"sendEvent<T extends Atomic.EventCallbackMetaData>(eventCallbackMetaData:T);",
 			"subscribeToEvent(eventType:string, callback:(data:any) => void);",
 			"subscribeToEvent(eventType:string, callback:(data:any) => void);",
 			"subscribeToEvent(sender:AObject, eventType:string, callback:(data: any) => void);",
 			"subscribeToEvent(sender:AObject, eventType:string, callback:(data: any) => void);",
 			"subscribeToEvent(eventMetaData:Atomic.EventMetaData);",
 			"subscribeToEvent(eventMetaData:Atomic.EventMetaData);",
-			"subscribeToEvent(sender: AObject, eventMetaData:Atomic.EventMetaData);"
+			"subscribeToEvent(sender:AObject, eventMetaData:Atomic.EventMetaData);"
 		]
 		]
 	},
 	},
 	"haxe_decl" : {
 	"haxe_decl" : {

+ 31 - 3
Script/TypeScript/AtomicWork.d.ts

@@ -26,10 +26,26 @@ declare module Atomic {
 
 
     // end subsystems
     // end subsystems
 
 
-    // Base interface for events, contains eventType string and callback
+    /** Base for all event types */
+    type EventType = string;
+
+    /** Base for all event callback data */
+    type EventData = Object;
+
+    /** Base interface for events, contains eventType string and callback */
     interface EventMetaData {
     interface EventMetaData {
-        _eventType: string;
-        _callback: any;
+        /**@internal*/
+        _eventType?: string;
+        /**@internal*/
+        _callback?: (...params) => any;
+    }
+
+    /** Base interface for event data sent to event handlers */
+    interface EventCallbackMetaData {
+        /**@internal*/
+        _eventType?: string;
+        /**@internal*/
+        _callbackData?: any;
     }
     }
 
 
     interface NativeEvent extends EventMetaData { }
     interface NativeEvent extends EventMetaData { }
@@ -39,8 +55,20 @@ declare module Atomic {
     // typed callback generic
     // typed callback generic
     type EventCallback<T extends EventMetaData> = (data: T) => void;
     type EventCallback<T extends EventMetaData> = (data: T) => void;
 
 
+    /**
+     * Utility function to wrap up an event callback to pass to subscribeToEvent
+     * @param eventType The type of event to wrap
+     * @param callback A callback to call when the event is fired
+     */
     export function ScriptEvent<T extends Atomic.EventMetaData>(eventType: string, callback: Atomic.EventCallback<T>): Atomic.EventMetaData;
     export function ScriptEvent<T extends Atomic.EventMetaData>(eventType: string, callback: Atomic.EventCallback<T>): Atomic.EventMetaData;
 
 
+    /**
+     * Utility function to wrap up event data to pass to sendEvent
+     * @param eventType The type of event to wrap
+     * @param callbackData The data to pass to the event subscriber
+     */
+    export function ScriptEventData<T extends Atomic.EventData>(eventType: string, callbackData?: T): Atomic.EventCallbackMetaData;
+
     export interface PathInfo {
     export interface PathInfo {
 
 
         pathName: string;
         pathName: string;

+ 72 - 154
Script/TypeScript/EditorWork.d.ts

@@ -10,145 +10,6 @@
 /// <reference path="ToolCore.d.ts" />
 /// <reference path="ToolCore.d.ts" />
 /// <reference path="WebView.d.ts" />
 /// <reference path="WebView.d.ts" />
 
 
-declare module Editor.EditorEvents {
-
-    export interface ModalErrorEvent {
-
-        title: string;
-        message: string;
-
-    }
-
-    export interface PlayerLogEvent {
-
-        message: string;
-        level: number;
-
-    }
-
-    export interface ActiveSceneEditorChangeEvent {
-
-        sceneEditor: Editor.SceneEditor3D;
-
-    }
-
-    export interface SceneClosedEvent {
-
-        scene: Atomic.Scene;
-
-    }
-
-    export interface ContentFolderChangedEvent {
-
-        path: string;
-
-    }
-
-    export interface LoadProjectEvent {
-
-        // The full path to the .atomic file
-        path: string;
-
-    }
-
-    /**
-     * Called once the resource has been saved
-     * @type {String}
-     */
-    export interface SaveResourceEvent {
-
-        // The full path to the resource to save / empty or undefined for current
-        path: string;
-
-    }
-
-    export interface LoadResourceEvent {
-
-        // The full path to the resource to load
-        path: string;
-
-    }
-
-    export interface EditorFileEvent {
-        filename: string;
-        fileExt: string;
-        editor: any;
-    }
-
-    export interface CodeLoadedEvent extends EditorFileEvent {
-        code: string;
-    }
-
-    export interface CodeSavedEvent extends EditorFileEvent {
-        code: string;
-    }
-
-    export interface EditorCloseResourceEvent {
-
-        editor: Editor.ResourceEditor;
-        navigateToAvailableResource: boolean;
-
-    }
-
-    export interface EditResourceEvent {
-
-        // The full path to the resource to edit
-        path: string;
-
-    }
-
-    /**
-     * Called once the resource has been deleted
-     * @type {String}
-     */
-    export interface DeleteResourceEvent {
-
-        // The full path to the resource to edit
-        path: string;
-
-    }
-
-    /**
-     * Called once the resource has been renamed
-     * @type {String}
-     */
-    export interface RenameResourceEvent {
-
-        /**
-         * Original path of the resource
-         * @type {string}
-         */
-        path: string;
-
-        /**
-         * New path of the resource
-         * @type {string}
-         */
-        newPath: string;
-
-        /**
-         * New base name of the resource (no path or extension)
-         * @type {string}
-         */
-        newName?: string;
-
-        // the asset being changed
-        asset?: ToolCore.Asset;
-    }
-
-    export interface SceneEditStateChangeEvent {
-
-        serializable: Atomic.Serializable;
-
-    }
-
-    export interface PreferencesChangedEvent {
-
-        preferences: any;
-
-    }
-}
-
 declare module Editor.Templates {
 declare module Editor.Templates {
     // Commented out until the TSDoc gets updated to the latest version of TypeScript
     // Commented out until the TSDoc gets updated to the latest version of TypeScript
     //export type TemplateType = "component" | "script";
     //export type TemplateType = "component" | "script";
@@ -202,13 +63,20 @@ declare module Editor.Extensions {
          * @param  {any} data
          * @param  {any} data
          */
          */
         sendEvent(eventType: string, data: any);
         sendEvent(eventType: string, data: any);
+        sendEvent<T extends Atomic.EventMetaData>(eventType:string, data?:T);
 
 
         /**
         /**
          * Subscribe to an event and provide a callback.  This can be used by services to subscribe to custom events
          * Subscribe to an event and provide a callback.  This can be used by services to subscribe to custom events
          * @param  {string} eventType
          * @param  {string} eventType
          * @param  {any} callback
          * @param  {any} callback
          */
          */
-        subscribeToEvent(eventType, callback);
+        subscribeToEvent?(eventType: string, callback: (...params) => any);
+
+        /**
+         * Subscribe to an event with a pre-wrapped event object.  This can be used by services to subscribe to custom events
+         * @param  {Atomic.EventMetaData} wrappedEvent
+         */
+        subscribeToEvent?(wrappedEvent: Atomic.EventMetaData);
     }
     }
 
 
     /**
     /**
@@ -288,19 +156,19 @@ declare module Editor.HostExtensions {
         /**
         /**
          * Called once a resource is saved
          * Called once a resource is saved
          */
          */
-        save?(ev: EditorEvents.SaveResourceEvent);
+        save?(ev: Editor.EditorSaveResourceEvent);
         /**
         /**
          * Called when a resource is deleted
          * Called when a resource is deleted
          */
          */
-        delete?(ev: EditorEvents.DeleteResourceEvent);
+        delete?(ev: Editor.EditorDeleteResourceEvent);
         /**
         /**
          * Called when a resource is renamed
          * Called when a resource is renamed
          */
          */
-        rename?(ev: EditorEvents.RenameResourceEvent);
+        rename?(ev: Editor.EditorRenameResourceNotificationEvent);
         /**
         /**
          * Called when a resource is about to be edited
          * Called when a resource is about to be edited
          */
          */
-        edit?(ev: EditorEvents.EditResourceEvent);
+        edit?(ev: Editor.EditorEditResourceEvent);
     }
     }
 
 
     export interface ResourceServicesProvider extends Editor.Extensions.ServicesProvider<ResourceServicesEventListener> {
     export interface ResourceServicesProvider extends Editor.Extensions.ServicesProvider<ResourceServicesEventListener> {
@@ -309,7 +177,7 @@ declare module Editor.HostExtensions {
 
 
     export interface ProjectServicesEventListener extends Editor.Extensions.ServiceEventListener {
     export interface ProjectServicesEventListener extends Editor.Extensions.ServiceEventListener {
         projectUnloaded?();
         projectUnloaded?();
-        projectLoaded?(ev: EditorEvents.LoadProjectEvent);
+        projectLoaded?(ev: Editor.EditorLoadProjectEvent);
         playerStarted?();
         playerStarted?();
     }
     }
     export interface ProjectServicesProvider extends Editor.Extensions.ServicesProvider<ProjectServicesEventListener> {
     export interface ProjectServicesProvider extends Editor.Extensions.ServicesProvider<ProjectServicesEventListener> {
@@ -335,8 +203,8 @@ declare module Editor.HostExtensions {
     }
     }
 
 
     export interface SceneServicesEventListener extends Editor.Extensions.ServiceEventListener {
     export interface SceneServicesEventListener extends Editor.Extensions.ServiceEventListener {
-        activeSceneEditorChanged?(ev: EditorEvents.ActiveSceneEditorChangeEvent);
-        editorSceneClosed?(ev: EditorEvents.SceneClosedEvent);
+        activeSceneEditorChanged?(ev: Editor.EditorActiveSceneEditorChangeEvent);
+        editorSceneClosed?(ev: Editor.EditorSceneClosedEvent);
     }
     }
     export interface SceneServicesProvider extends Editor.Extensions.ServicesProvider<SceneServicesEventListener> { }
     export interface SceneServicesProvider extends Editor.Extensions.ServicesProvider<SceneServicesEventListener> { }
 
 
@@ -392,6 +260,56 @@ declare module Editor.HostExtensions {
  */
  */
 declare module Editor.ClientExtensions {
 declare module Editor.ClientExtensions {
 
 
+    export interface EditorFileEvent {
+        filename: string;
+        fileExt: string;
+        editor: any;
+    }
+
+    export interface CodeLoadedEvent extends EditorFileEvent {
+        code: string;
+    }
+
+    export interface CodeSavedEvent extends EditorFileEvent {
+        code: string;
+    }
+
+    /**
+     * Called once the resource has been deleted
+     * @type {String}
+     */
+    export interface DeleteResourceEvent {
+
+        // The full path to the resource to edit
+        path: string;
+
+    }
+
+    /**
+     * Called once the resource has been renamed
+     * @type {String}
+     */
+    export interface RenameResourceEvent {
+
+        /**
+         * Original path of the resource
+         * @type {string}
+         */
+        path: string;
+
+        /**
+         * New path of the resource
+         * @type {string}
+         */
+        newPath: string;
+
+        /**
+         * New base name of the resource (no path or extension)
+         * @type {string}
+         */
+        newName?: string;
+    }
+
     /**
     /**
      * Generic service locator of editor services that may be injected by either a plugin
      * Generic service locator of editor services that may be injected by either a plugin
      * or by the editor itself.
      * or by the editor itself.
@@ -412,16 +330,16 @@ declare module Editor.ClientExtensions {
     }
     }
 
 
     export interface PreferencesChangedEventData {
     export interface PreferencesChangedEventData {
-        applicationPreferences? : any,
-        projectPreferences? : any
+        applicationPreferences? : any;
+        projectPreferences? : any;
     }
     }
 
 
     export interface WebViewServiceEventListener extends Editor.Extensions.EditorServiceExtension {
     export interface WebViewServiceEventListener extends Editor.Extensions.EditorServiceExtension {
-        configureEditor?(ev: EditorEvents.EditorFileEvent);
-        codeLoaded?(ev: EditorEvents.CodeLoadedEvent);
-        save?(ev: EditorEvents.CodeSavedEvent);
-        delete?(ev: EditorEvents.DeleteResourceEvent);
-        rename?(ev: EditorEvents.RenameResourceEvent);
+        configureEditor?(ev: EditorFileEvent);
+        codeLoaded?(ev: CodeLoadedEvent);
+        save?(ev: CodeSavedEvent);
+        delete?(ev: DeleteResourceEvent);
+        rename?(ev: RenameResourceEvent);
         projectUnloaded?();
         projectUnloaded?();
         formatCode?();
         formatCode?();
         preferencesChanged?(preferences: PreferencesChangedEventData);
         preferencesChanged?(preferences: PreferencesChangedEventData);

+ 0 - 1
Script/tsconfig.json

@@ -112,7 +112,6 @@
         "./AtomicEditor/ui/resourceEditors/XMLResourceEditorBuilder.ts",
         "./AtomicEditor/ui/resourceEditors/XMLResourceEditorBuilder.ts",
         "./AtomicEditor/ui/ScriptWidget.ts",
         "./AtomicEditor/ui/ScriptWidget.ts",
         "./AtomicEditor/ui/Shortcuts.ts",
         "./AtomicEditor/ui/Shortcuts.ts",
-        "./AtomicEditor/ui/UIEvents.ts",
         "./TypeScript/Atomic.d.ts",
         "./TypeScript/Atomic.d.ts",
         "./TypeScript/AtomicApp.d.ts",
         "./TypeScript/AtomicApp.d.ts",
         "./TypeScript/AtomicNETScript.d.ts",
         "./TypeScript/AtomicNETScript.d.ts",

+ 5 - 1
Source/Atomic/UI/UIEvents.h

@@ -123,6 +123,11 @@ ATOMIC_EVENT(E_UIWIDGETFOCUSESCAPED, UIWidgetFocusEscaped)
 {
 {
 }
 }
 
 
+ATOMIC_EVENT(E_UIWIDGETEDITCANCELED, UIWidgetEditCanceled)
+{
+    ATOMIC_PARAM(P_WIDGET, Widget);         // UIWidget pointer
+}
+
 ATOMIC_EVENT(E_UIWIDGETEDITCOMPLETE, UIWidgetEditComplete)
 ATOMIC_EVENT(E_UIWIDGETEDITCOMPLETE, UIWidgetEditComplete)
 {
 {
     ATOMIC_PARAM(P_WIDGET, Widget);             // UIWidget pointer
     ATOMIC_PARAM(P_WIDGET, Widget);             // UIWidget pointer
@@ -139,5 +144,4 @@ ATOMIC_EVENT(E_UILISTVIEWSELECTIONCHANGED, UIListViewSelectionChanged)
     ATOMIC_PARAM(P_SELECTED, Selected);        // bool
     ATOMIC_PARAM(P_SELECTED, Selected);        // bool
 }
 }
 
 
-
 }
 }

+ 114 - 49
Source/AtomicEditor/EditorMode/AEEditorEvents.h

@@ -36,47 +36,19 @@ static const unsigned FINDTEXT_FLAG_WRAP = 0x4;
 static const unsigned FINDTEXT_FLAG_NEXT = 0x8;
 static const unsigned FINDTEXT_FLAG_NEXT = 0x8;
 static const unsigned FINDTEXT_FLAG_PREV = 0x10;
 static const unsigned FINDTEXT_FLAG_PREV = 0x10;
 
 
-ATOMIC_EVENT(E_FINDTEXT, FindText)
-{
-    ATOMIC_PARAM(P_FLAGS, Flags);    // int
-    ATOMIC_PARAM(P_TEXT, Text);      // string
-}
-
-ATOMIC_EVENT(E_FINDTEXTCLOSE, FindTextClose)
-{
 
 
-}
-
-ATOMIC_EVENT(E_FINDTEXTOPEN, FindTextOpen)
-{
-
-}
-
-ATOMIC_EVENT(E_JAVASCRIPTSAVED, JavascriptSaved)
-{
-
-}
-
-// editor play request
+// emitted when the play button has been pressed in the editor, but the player has not yet started
 ATOMIC_EVENT(E_EDITORPLAYREQUEST, EditorPlayRequest)
 ATOMIC_EVENT(E_EDITORPLAYREQUEST, EditorPlayRequest)
 {
 {
     ATOMIC_PARAM(P_MODE, Mode);    // uint (AEPlayerMode)
     ATOMIC_PARAM(P_MODE, Mode);    // uint (AEPlayerMode)
-
 }
 }
 
 
-// stop play mode
-ATOMIC_EVENT(E_EDITORPLAYSTOP, EditorPlayStop)
-{
-
-}
-
-// stop play mode
+// Called when the active resource editor has changed
 ATOMIC_EVENT(E_EDITORRESOURCEEDITORCHANGED, EditorResourceEditorChanged)
 ATOMIC_EVENT(E_EDITORRESOURCEEDITORCHANGED, EditorResourceEditorChanged)
 {
 {
     ATOMIC_PARAM(P_RESOURCEEDITOR, ResourceEditor); // ResourceEditor*
     ATOMIC_PARAM(P_RESOURCEEDITOR, ResourceEditor); // ResourceEditor*
 }
 }
 
 
-
 // emitted once play has started
 // emitted once play has started
 ATOMIC_EVENT(E_EDITORPLAYERSTARTED, EditorPlayerStarted)
 ATOMIC_EVENT(E_EDITORPLAYERSTARTED, EditorPlayerStarted)
 {
 {
@@ -101,6 +73,7 @@ ATOMIC_EVENT(E_EDITORPLAYERSTOPPED, EditorPlayerStopped)
 
 
 }
 }
 
 
+// NOT CURRENTLY WIRED
 ATOMIC_EVENT(E_EDITORBUILD, EditorBuild)
 ATOMIC_EVENT(E_EDITORBUILD, EditorBuild)
 {
 {
     ATOMIC_PARAM(P_PLATFORM, Platform);      // string
     ATOMIC_PARAM(P_PLATFORM, Platform);      // string
@@ -113,59 +86,151 @@ ATOMIC_EVENT(E_EDITORBUILD, EditorBuild)
 static const unsigned EDITOR_MODALERROR = 0x1;
 static const unsigned EDITOR_MODALERROR = 0x1;
 static const unsigned EDITOR_MODALINFO = 0x2;
 static const unsigned EDITOR_MODALINFO = 0x2;
 
 
-
+// emitted to display a modal message in the editor
 ATOMIC_EVENT(E_EDITORMODAL, EditorModal)
 ATOMIC_EVENT(E_EDITORMODAL, EditorModal)
 {
 {
-    ATOMIC_PARAM(P_TYPE, Type);      // uint (EDITOR_ERROR_MODAL, etc)
-    ATOMIC_PARAM(P_TITLE, Title);      // for modal errors, title text
-    ATOMIC_PARAM(P_MESSAGE, Message);    // for modal errors, error text
+    ATOMIC_PARAM(P_TYPE, Type);      // uint (Type can be EDITOR_MODALERROR, EDITOR_MODAL_INFOT)
+    ATOMIC_PARAM(P_TITLE, Title);      // string (for modal errors, title text)
+    ATOMIC_PARAM(P_MESSAGE, Message);    // string (for modal errors, error text)
 }
 }
 
 
+// emitted when a Scene editor gains focus.  Could be null.
 ATOMIC_EVENT(E_EDITORACTIVESCENEEDITORCHANGE, EditorActiveSceneEditorChange)
 ATOMIC_EVENT(E_EDITORACTIVESCENEEDITORCHANGE, EditorActiveSceneEditorChange)
 {
 {
     ATOMIC_PARAM(P_SCENEEDITOR, SceneEditor);  // SceneEditor3D pointer
     ATOMIC_PARAM(P_SCENEEDITOR, SceneEditor);  // SceneEditor3D pointer
 }
 }
 
 
+// NOTE: This is not triggered by anything
+ATOMIC_EVENT(E_EDITORSCENECLOSED, EditorSceneClosed)
+{
+    ATOMIC_PARAM(P_SCENE, Scene); // Scene pointer
+}
 
 
-ATOMIC_EVENT(E_PLAYERERROR, PlayerError)
+// emitted when a subprocess logs information to the console
+ATOMIC_EVENT(E_SUBPROCESSOUTPUT, SubprocessOutput)
 {
 {
     ATOMIC_PARAM(P_TEXT, Text);      // string
     ATOMIC_PARAM(P_TEXT, Text);      // string
 }
 }
 
 
-ATOMIC_EVENT(E_CONSOLEMESSAGE, ConsoleMessage)
+// emitted when a subprocess has completed
+ATOMIC_EVENT(E_SUBPROCESSCOMPLETE, SubprocessComplete)
 {
 {
-    ATOMIC_PARAM(P_TEXT, Text);      // string
+    ATOMIC_PARAM(P_PROCESSKEY, ProcessKey); // unsigned
+    ATOMIC_PARAM(P_RETCODE, RetCode);      // int (return code of process)
 }
 }
 
 
-ATOMIC_EVENT(E_CONSOLEERRORMESSAGE, ConsoleErrorMessage)
+// Command called to load a new project
+ATOMIC_EVENT(E_EDITORLOADPROJECT, EditorLoadProject)
 {
 {
-    ATOMIC_PARAM(P_TEXT, Text);      // string
+    ATOMIC_PARAM(P_PATH, Path);     // string
 }
 }
 
 
-ATOMIC_EVENT(E_PLATFORMCHANGE, PlatformChange)
+// emitted once a content folder has been refreshed
+ATOMIC_EVENT(E_CONTENTFOLDERCHANGED, ContentFolderChanged)
 {
 {
-    ATOMIC_PARAM(P_PLATFORM, Platform);      // uint (AEEditorPlatform)
+    ATOMIC_PARAM(P_PATH, Path);     // string
 }
 }
 
 
-ATOMIC_EVENT(E_SUBPROCESSOUTPUT, SubprocessOutput)
+// emitted when the editor has been requested to close the current project.
+ATOMIC_EVENT(E_EDITORCLOSEPROJECT, EditorCloseProject)
 {
 {
-    ATOMIC_PARAM(P_TEXT, Text);      // string
+
 }
 }
 
 
-ATOMIC_EVENT(E_SUBPROCESSCOMPLETE, SubprocessComplete)
+// emitted once a project has completed closing
+ATOMIC_EVENT(E_EDITORPROJECTCLOSED, EditorProjectClosed)
 {
 {
-    ATOMIC_PARAM(P_PROCESSKEY, ProcessKey); // unsigned
-    ATOMIC_PARAM(P_RETCODE, RetCode);      // int (return code of process)
+
 }
 }
 
 
-ATOMIC_EVENT(E_CURLCOMPLETE, CurlComplete)
+// command to save all the open editors
+ATOMIC_EVENT(E_EDITORSAVEALLRESOURCES, EditorSaveAllResources)
 {
 {
-    ATOMIC_PARAM(P_CURLREQUEST, Request);      // CurlRequest*
+
+}
+
+// command to save a specific resource
+ATOMIC_EVENT(E_EDITORSAVERESOURCE, EditorSaveResource)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string full path of the current resource
+}
+
+// emitted once the resource has been saved
+ATOMIC_EVENT(E_EDITORSAVERESOURCENOTIFICATION, EditorSaveResourceNotification)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string
 }
 }
 
 
-ATOMIC_EVENT(E_EDITORSHUTDOWN, EditorShutdown)
+// emitted when a resource gains focus
+ATOMIC_EVENT(E_EDITOREDITRESOURCE, EditorEditResource)
 {
 {
+    ATOMIC_PARAM(P_PATH, Path);     // string
+}
 
 
+// command to delete a resource
+ATOMIC_EVENT(E_EDITORDELETERESOURCE, EditorDeleteResource)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string
+}
+
+// emitted once the resource has been deleted
+ATOMIC_EVENT(E_EDITORDELETERESOURCENOTIFICATION, EditorDeleteResourceNotification)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string
+}
+
+// emitted when a resource has been renamed
+ATOMIC_EVENT(E_EDITORRENAMERESOURCENOTIFICATION, EditorRenameResourceNotification)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string (full path of the old resource)
+    ATOMIC_PARAM(P_NEWPATH, NewPath);   // string (full path of the new resource)
+    ATOMIC_PARAM(P_NEWNAME, NewName);    // string (new name of resource)
+    ATOMIC_PARAM(P_ASSET, Asset);       // ToolCore.Asset pointer
+}
+
+// emitted when user preferences have been changed
+ATOMIC_EVENT(E_USERPREFERENCESCHANGEDNOTIFICATION, UserPreferencesChangedNotification)
+{
+   ATOMIC_PARAM(P_PROJECTPREFERENCES, ProjectPreferences);  // string (JSON object)
+   ATOMIC_PARAM(P_APPLICATIONPREFERENCES, ApplicationPreferences);        // string (JSON object)
+}
+
+// emitted when an item is selected in a scene
+ATOMIC_EVENT(E_INSPECTORPROJECTREFERENCE, InspectorProjectReference)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string (Full path of the resource to edit)
+}
+
+// emitted when a component attribute has been changed
+ATOMIC_EVENT(E_ATTRIBUTEEDITRESOURCECHANGED, AttributeEditResourceChanged)
+{
+    ATOMIC_PARAM(P_ATTRINFOEDIT, AttrInfoEdit); // AttrbuteInfoEdit window
+    ATOMIC_PARAM(P_RESOURCE, Resource); // Resource pointer
+}
+
+// emitted when the built in player logs something
+ATOMIC_EVENT(E_EDITORPLAYERLOG, EditorPlayerLog)
+{
+    ATOMIC_PARAM(P_MESSAGE, Message);   // string
+    ATOMIC_PARAM(P_LEVEL, Level);       // int
+}
+
+// emitted right before a project is unloaded
+ATOMIC_EVENT(E_PROJECTUNLOADEDNOTIFICATION, ProjectUnloadedNotification)
+{
+
+}
+
+// command to load a new project
+ATOMIC_EVENT(E_REQUESTPROJECTLOAD, RequestProjectLoad)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string (Full path to the .atomic file)
+}
+
+// emitted once a project has been loaded
+ATOMIC_EVENT(E_LOADPROJECTNOTIFICATION,LoadProjectNotification)
+{
+    ATOMIC_PARAM(P_PATH, Path);     // string (Full path to the .atomic file)
 }
 }
 
 
 }
 }

+ 16 - 0
Source/AtomicEditor/Editors/SceneEditor3D/SceneEditor3DEvents.h

@@ -174,4 +174,20 @@ ATOMIC_EVENT(E_CUBEMAPRENDEREND, CubemapRenderEnd)
 
 
 }
 }
 
 
+ATOMIC_EVENT(E_COMPONENTEDITEND, ComponentEditEnd)
+{
+
+}
+
+ATOMIC_EVENT(E_COLORCHOOSERCHANGED, ColorChooserChanged)
+{
+    ATOMIC_PARAM(P_WIDGET, Widget); // UIWidget
+}
+
+ATOMIC_EVENT(E_SELECTIONCREATECOMPONENT, SelectionCreateComponent)
+{
+    ATOMIC_PARAM(P_COMPONENTTYPENAME, ComponentTypeName);   // string
+}
+
+
 }
 }

+ 30 - 0
Source/AtomicJS/Javascript/JSAPI.cpp

@@ -214,18 +214,48 @@ namespace Atomic
         return 1;
         return 1;
     }
     }
 
 
+    static int js_push_native_event_callbackdata(duk_context* ctx) {
+
+        duk_push_current_function(ctx);
+
+        duk_push_object(ctx);
+        duk_get_prop_string(ctx, -2, "_eventType");
+        duk_put_prop_string(ctx, -2, "_eventType");
+        duk_dup(ctx, 0);
+        duk_put_prop_string(ctx, -2, "_callbackData");
+
+        return 1;
+    }
+
     void js_define_native_event(duk_context* ctx, const String& eventType, const String &eventName)
     void js_define_native_event(duk_context* ctx, const String& eventType, const String &eventName)
     {
     {
+        // Set up the pieces for subscribe to eventj
+
         // push c function which takes 1 argument, the callback
         // push c function which takes 1 argument, the callback
         duk_push_c_function(ctx, js_push_native_event_metadata, 1);
         duk_push_c_function(ctx, js_push_native_event_metadata, 1);
 
 
         // store the event type in the function object
         // store the event type in the function object
+        // function {event}( eventName, callback ) : { _eventType , _callback }
         duk_push_string(ctx, eventType.CString());
         duk_push_string(ctx, eventType.CString());
         duk_put_prop_string(ctx, -2, "_eventType");
         duk_put_prop_string(ctx, -2, "_eventType");
 
 
         // store to module object
         // store to module object
         duk_put_prop_string(ctx, -2, eventName.CString());
         duk_put_prop_string(ctx, -2, eventName.CString());
 
 
+        // Set up the pieces for sendEvent
+
+        // push c function which takes 1 argument, the callback
+        duk_push_c_function(ctx, js_push_native_event_callbackdata, 1);
+
+        // store the event type in the function object
+        // function {event}Data( eventName, callbackData ) : { _eventType , _callbackData }
+        duk_push_string(ctx, eventType.CString());
+        duk_put_prop_string(ctx, -2, "_eventType");
+
+        // store to module object
+        duk_put_prop_string(ctx, -2, ToString("%sData", eventName.CString()).CString());
+
+
     }
     }
 
 
     void js_object_to_variantmap(duk_context* ctx, int objIdx, VariantMap &v)
     void js_object_to_variantmap(duk_context* ctx, int objIdx, VariantMap &v)

+ 25 - 0
Source/AtomicJS/Javascript/JSAtomic.cpp

@@ -237,6 +237,29 @@ static int js_atomic_ScriptEvent(duk_context* ctx)
     return 1;
     return 1;
 }
 }
 
 
+static int js_atomic_ScriptEventData(duk_context* ctx)
+{
+    if (duk_get_top(ctx) != 2 || !duk_is_string(ctx, 0))
+    {
+        duk_push_string(ctx, "Atomic.ScriptEventData(eventType:string, data?:Object); - passed invalid parameters");
+        duk_throw(ctx);
+        return 0;
+    }
+
+    String eventType = duk_get_string(ctx, 0);
+    duk_push_object(ctx);
+    duk_push_string(ctx, eventType.CString());
+    duk_put_prop_string(ctx, -2, "_eventType");
+
+    if (duk_is_object(ctx, 1))
+    {
+        duk_dup(ctx, 1);
+        duk_put_prop_string(ctx, -2, "_callbackData");
+    }
+
+    return 1;
+}
+
 static void js_atomic_destroy_node(Node* node, duk_context* ctx, bool root = false)
 static void js_atomic_destroy_node(Node* node, duk_context* ctx, bool root = false)
 {
 {
 
 
@@ -458,6 +481,8 @@ void jsapi_init_atomic(JSVM* vm)
     duk_push_c_function(ctx, js_atomic_ScriptEvent, 2);
     duk_push_c_function(ctx, js_atomic_ScriptEvent, 2);
     duk_put_prop_string(ctx, -2, "ScriptEvent");
     duk_put_prop_string(ctx, -2, "ScriptEvent");
 
 
+    duk_push_c_function(ctx, js_atomic_ScriptEventData, 2);
+    duk_put_prop_string(ctx, -2, "ScriptEventData");
 
 
     duk_pop(ctx);
     duk_pop(ctx);
 
 

+ 27 - 1
Source/AtomicJS/Javascript/JSCore.cpp

@@ -165,7 +165,33 @@ static int Object_SendEvent(duk_context* ctx)
 
 
     if (top == 1)
     if (top == 1)
     {
     {
-        sender->SendEvent(duk_to_string(ctx, 0));
+        if (duk_is_string(ctx, 0))
+        {
+            sender->SendEvent(duk_to_string(ctx, 0));
+        } else if (duk_is_object(ctx, 0)) {
+            duk_get_prop_string(ctx, 0, "_callbackData");
+            duk_get_prop_string(ctx, 0, "_eventType");
+
+            if (!duk_is_string(ctx, -1))
+            {
+                duk_push_string(ctx, "Object.sendEvent() - Bad callback meta data");
+                duk_throw(ctx);
+            }
+
+            if (duk_is_object(ctx, -2))
+            {
+                VariantMap sendEventVMap;
+                js_object_to_variantmap(ctx, -2, sendEventVMap);
+
+                sender->SendEvent(duk_to_string(ctx, -1), sendEventVMap);
+            } else {
+                sender->SendEvent(duk_to_string(ctx, -1));
+            }
+        } else {
+            duk_push_string(ctx, "Object.sendEvent() - Bad callback meta data");
+            duk_throw(ctx);
+        }
+
     }
     }
     else if (top == 2)
     else if (top == 2)
     {
     {

+ 32 - 3
Source/ToolCore/JSBind/JSBEvent.cpp

@@ -34,12 +34,13 @@ using namespace Atomic;
 namespace ToolCore
 namespace ToolCore
 {
 {
 
 
-JSBEvent::JSBEvent(Context* context, JSBModule* module, const String& eventID, const String& eventName) :
+JSBEvent::JSBEvent(Context* context, JSBModule* module, const String& eventID, const String& eventName, const String& eventComment) :
     Object(context),
     Object(context),
     module_(module), 
     module_(module), 
     header_(0),
     header_(0),
     eventID_(eventID),
     eventID_(eventID),
-    eventName_(eventName)
+    eventName_(eventName),
+    eventComment_(eventComment)
 {
 {
 
 
 }
 }
@@ -100,6 +101,7 @@ bool JSBEvent::ScanModuleEvents(JSBModule* module)
         SharedPtr<JSBEvent> curEvent;
         SharedPtr<JSBEvent> curEvent;
         String eventID;
         String eventID;
         String eventName;
         String eventName;
+        String eventComment;
 
 
         for (unsigned j = 0; j < lines.Size(); j++)
         for (unsigned j = 0; j < lines.Size(); j++)
         {
         {
@@ -109,6 +111,18 @@ bool JSBEvent::ScanModuleEvents(JSBModule* module)
             // Note: processes ATOMIC_EVENT decl in commented blocks
             // Note: processes ATOMIC_EVENT decl in commented blocks
             if (line.StartsWith("ATOMIC_EVENT"))
             if (line.StartsWith("ATOMIC_EVENT"))
             {
             {
+                // First check to see if there is a line comment above this and try to capture it
+                eventComment = NULL;
+
+                if (j > 0) {
+                    String prevLine = lines[j-1].Trimmed();
+                    if (prevLine.StartsWith(("//")))
+                    {
+                        prevLine.Replace("//", "");
+                        eventComment = prevLine.Trimmed();
+                    }
+                }
+
                 StringVector parts = line.Split('(');
                 StringVector parts = line.Split('(');
 
 
                 if (parts.Size() != 2)
                 if (parts.Size() != 2)
@@ -129,7 +143,7 @@ bool JSBEvent::ScanModuleEvents(JSBModule* module)
                 eventName = parts[1].Trimmed();
                 eventName = parts[1].Trimmed();
                 eventName.Replace(")", "");
                 eventName.Replace(")", "");
 
 
-                curEvent = new JSBEvent(module->GetContext(), module, eventID, eventName);
+                curEvent = new JSBEvent(module->GetContext(), module, eventID, eventName, eventComment);
             }            
             }            
 
 
             if (line.Contains("}") && curEvent.NotNull())
             if (line.Contains("}") && curEvent.NotNull())
@@ -162,6 +176,7 @@ bool JSBEvent::ScanModuleEvents(JSBModule* module)
 
 
                 String typeInfo;
                 String typeInfo;
                 String enumTypeName;
                 String enumTypeName;
+                String formalComment;
 
 
                 // comment contains type
                 // comment contains type
                 if (parts[1].Contains("//"))
                 if (parts[1].Contains("//"))
@@ -170,6 +185,7 @@ bool JSBEvent::ScanModuleEvents(JSBModule* module)
                     comment.Replace("//", "");
                     comment.Replace("//", "");
                     comment = comment.Trimmed();
                     comment = comment.Trimmed();
                     StringVector typeVector = comment.Split(' ');
                     StringVector typeVector = comment.Split(' ');
+                    int commentStart = 1;
                     if (typeVector.Size() > 0)
                     if (typeVector.Size() > 0)
                     {
                     {
                         typeInfo = typeVector[0];
                         typeInfo = typeVector[0];
@@ -180,6 +196,18 @@ bool JSBEvent::ScanModuleEvents(JSBModule* module)
                             {
                             {
                                 enumTypeName = typeVector[1];
                                 enumTypeName = typeVector[1];
                             }
                             }
+
+                            commentStart = 1;
+                        }
+
+                        // Check to see if there are any comments following and try to capture them
+                        if (typeVector.Size() > commentStart + 1)
+                        {
+                            formalComment = "";
+                            for (int i = commentStart; i < typeVector.Size(); i++) {
+                                formalComment.Append(" ");
+                                formalComment.Append(typeVector[i]);
+                            }
                         }
                         }
                     }
                     }
                 }
                 }
@@ -207,6 +235,7 @@ bool JSBEvent::ScanModuleEvents(JSBModule* module)
                 param.paramName_ = parts[1].Trimmed();
                 param.paramName_ = parts[1].Trimmed();
                 param.typeInfo_ = typeInfo;
                 param.typeInfo_ = typeInfo;
                 param.enumTypeName_ = enumTypeName;
                 param.enumTypeName_ = enumTypeName;
+                param.comment_ = formalComment;
 
 
                 curEvent->parameters_.Push(param);
                 curEvent->parameters_.Push(param);
 
 

+ 4 - 2
Source/ToolCore/JSBind/JSBEvent.h

@@ -49,19 +49,20 @@ namespace ToolCore
             String paramName_;
             String paramName_;
             String typeInfo_;
             String typeInfo_;
             String enumTypeName_;
             String enumTypeName_;
+            String comment_;
         };
         };
 
 
-        JSBEvent(Context* context, JSBModule* module, const String& eventID, const String& eventName);
+        JSBEvent(Context* context, JSBModule* module, const String& eventID, const String& eventName, const String& eventComment);
         virtual ~JSBEvent();
         virtual ~JSBEvent();
 
 
         const String& GetEventID() const { return eventID_; }
         const String& GetEventID() const { return eventID_; }
         const String& GetEventName() const { return eventName_; }
         const String& GetEventName() const { return eventName_; }
+        const String& GetEventComment() const { return eventComment_; }
         unsigned GetEventHash() const;
         unsigned GetEventHash() const;
         /// Generally this is the EventName + "Event"
         /// Generally this is the EventName + "Event"
         String GetScriptEventName(BindingLanguage language = BINDINGLANGUAGE_ANY) const;
         String GetScriptEventName(BindingLanguage language = BINDINGLANGUAGE_ANY) const;
         const Vector<EventParam>& GetParameters() const { return parameters_;  }
         const Vector<EventParam>& GetParameters() const { return parameters_;  }
 
 
-
         void SetHeader(JSBHeader* header) { header_ = header; }
         void SetHeader(JSBHeader* header) { header_ = header; }
         JSBHeader* GetHeader() { return header_; }
         JSBHeader* GetHeader() { return header_; }
 
 
@@ -77,6 +78,7 @@ namespace ToolCore
 
 
         String eventName_;
         String eventName_;
         String eventID_;
         String eventID_;
+        String eventComment_;
 
 
         Vector<EventParam> parameters_;
         Vector<EventParam> parameters_;
 
 

+ 37 - 18
Source/ToolCore/JSBind/JSBTypeScript.cpp

@@ -370,18 +370,6 @@ void JSBTypeScript::ExportModuleEnums(JSBModule* module)
         }
         }
         source_ += "    }\n";
         source_ += "    }\n";
         source_ += "\n";
         source_ += "\n";
-
-        // legacy support - This should be removed in a couple releases
-        source_ += "   // Legacy JS Access for enum:  " + _enum->GetName() + "\n";
-        valsIter = values.Begin();
-        while (valsIter != values.End())
-        {
-            String name = (*valsIter).first_;
-            source_ += "   /** Deprecated - use: [[" + _enum->GetName() + "." + name + "]]\n@deprecated */\n";
-            source_ += "   export var " + name + ": number;\n";
-            valsIter++;
-        }
-        source_ += "\n";
     }
     }
 
 
 }
 }
@@ -399,7 +387,13 @@ void JSBTypeScript::ExportModuleEvents(JSBModule* module)
         JSBEvent* event = events[i];
         JSBEvent* event = events[i];
         String scriptEventName = event->GetScriptEventName(BINDINGLANGUAGE_JAVASCRIPT);
         String scriptEventName = event->GetScriptEventName(BINDINGLANGUAGE_JAVASCRIPT);
 
 
-        source += ToString("    export interface %s extends Atomic.NativeEvent {\n", scriptEventName.CString());
+        // Write the event type
+        source += ToString("    /** Event type to use in calls requiring the event such as 'sendEvent'.  Event Type is: \"%s\" **/\n", event->GetEventName().CString());
+        source += ToString("    export var %sType : Atomic.EventType;\n\n", scriptEventName.CString());
+
+        // Write the event interface
+        source += ToString("    /** object returned in the callback for the %s event.**/\n", event->GetEventName().CString());
+        source += ToString("    export interface %s extends Atomic.EventData {\n", scriptEventName.CString());
 
 
         // parameters
         // parameters
 
 
@@ -431,11 +425,11 @@ void JSBTypeScript::ExportModuleEvents(JSBModule* module)
 
 
             bool mapped = false;
             bool mapped = false;
 
 
-            if (typeName == "int" || typeName == "float" || typeName == "unsigned" || typeName == "uint")
+            if (typeName == "int" || typeName == "float" || typeName == "unsigned" || typeName == "uint" || typeName == "double")
             {
             {
                 typeName = "number";
                 typeName = "number";
                 mapped = true;
                 mapped = true;
-            } else if (typeName == "bool") {
+            } else if (typeName == "bool" || typeName == "boolean") {
                 typeName = "boolean";
                 typeName = "boolean";
                 mapped = true;
                 mapped = true;
             } else if (typeName == "string") {
             } else if (typeName == "string") {
@@ -452,19 +446,44 @@ void JSBTypeScript::ExportModuleEvents(JSBModule* module)
                 mapped = true;
                 mapped = true;
             }
             }
 
 
+            if (p.comment_.Length())
+            {
+                source += ToString("        /** %s */\n", p.comment_.CString());
+            }
+
             if (mapped == true) {
             if (mapped == true) {
                 source += ToString("        %s : %s;\n", paramName.CString(), typeName.CString());
                 source += ToString("        %s : %s;\n", paramName.CString(), typeName.CString());
             } else {
             } else {
-                source += ToString("        // Unmapped Native Type:%s \n", typeName.CString());
-                source += ToString("        // %s : any;\n", p.paramName_.ToLower().CString());
+                source += ToString("        /** Unmapped Native Type: %s */\n", p.typeInfo_.CString());
+                source += ToString("        %s : any;\n", paramName.CString());
             }
             }
         }
         }
 
 
         source += "    }\n\n";
         source += "    }\n\n";
 
 
         // Write the event function signature
         // Write the event function signature
+        if (event->GetEventComment().Length())
+        {
+            source += "    /**\n";
+            source += ToString("     Wrapper function to generate a properly formatted event handler to pass to 'subscribeToEvent' for the %s event. \n\n", event->GetEventName().CString());
+            source += ToString("     %s\n", event->GetEventComment().CString());
+            source += "    **/\n";
+        } else {
+            source += ToString("    /** Wrapper function to generate a properly formatted event handler to pass to 'subscribeToEvent' for the %s event. **/\n", event->GetEventName().CString());
+        }
+        source += ToString("    export function %s (callback : Atomic.EventCallback<%s>) : Atomic.EventMetaData;\n", scriptEventName.CString(), scriptEventName.CString());
+        source += "\n";
+
+        if (params.Size() > 0)
+        {
+            source += ToString("    /** Wrapper function to construct callback data to pass to 'sendEvent' for the %s event. **/ \n", event->GetEventName().CString());
+            source += ToString("    export function %sData (callbackData : %s) : Atomic.EventCallbackMetaData; \n", scriptEventName.CString(), scriptEventName.CString());
+        } else {
+            source += ToString("    /** Wrapper function to construct object to pass to 'sendEvent' for the %s event. **/ \n", event->GetEventName().CString());
+            source += ToString("    export function %sData () : Atomic.EventCallbackMetaData; \n", scriptEventName.CString());
+        }
 
 
-        source += ToString("\n    export function %s (callback : Atomic.EventCallback<%s>) : Atomic.EventMetaData;\n\n", scriptEventName.CString(), scriptEventName.CString());
+        source += "\n\n";
 
 
     }
     }
     source_ += source;
     source_ += source;

+ 3 - 0
Source/ToolCore/JSBind/JavaScript/JSModuleWriter.cpp

@@ -274,6 +274,9 @@ void JSModuleWriter::WriteModulePreInit(String& source)
 
 
     for (unsigned i = 0; i < events.Size(); i++)
     for (unsigned i = 0; i < events.Size(); i++)
     {
     {
+        source.AppendWithFormat("duk_push_string(ctx, \"%s\");\n", events[i]->GetEventName().CString());
+        source.AppendWithFormat("duk_put_prop_string(ctx, -2, \"%sType\");\n", events[i]->GetScriptEventName(BINDINGLANGUAGE_JAVASCRIPT).CString());
+
         source.AppendWithFormat("js_define_native_event(ctx, \"%s\", \"%s\");\n", events[i]->GetEventName().CString(), events[i]->GetScriptEventName(BINDINGLANGUAGE_JAVASCRIPT).CString());
         source.AppendWithFormat("js_define_native_event(ctx, \"%s\", \"%s\");\n", events[i]->GetEventName().CString(), events[i]->GetScriptEventName(BINDINGLANGUAGE_JAVASCRIPT).CString());
     }
     }
 
 

+ 4 - 3
Source/ToolCore/Project/ProjectEvents.h

@@ -35,11 +35,12 @@ ATOMIC_EVENT(E_PROJECTBEGINLOAD, ProjectBeginLoad)
     ATOMIC_PARAM(P_PROJECT, Project);           // Project *
     ATOMIC_PARAM(P_PROJECT, Project);           // Project *
 }
 }
 
 
+// Event is triggered once a project has been loaded and after prefs have been loaded
 ATOMIC_EVENT(E_PROJECTLOADED, ProjectLoaded)
 ATOMIC_EVENT(E_PROJECTLOADED, ProjectLoaded)
 {
 {
-    ATOMIC_PARAM(P_PROJECTPATH, ProjectPath);   // string
-    ATOMIC_PARAM(P_PROJECT, Project);           // Project *
-    ATOMIC_PARAM(P_RESULT, Result);             // bool
+    ATOMIC_PARAM(P_PROJECTPATH, ProjectPath);   // string (The path to the project that was loaded)
+    ATOMIC_PARAM(P_PROJECT, Project);           // Project * (The reference to the project)
+    ATOMIC_PARAM(P_RESULT, Result);             // bool (whether the project loaded successfully)
 }
 }
 
 
 ATOMIC_EVENT(E_PROJECTUNLOADED, ProjectUnloaded)
 ATOMIC_EVENT(E_PROJECTUNLOADED, ProjectUnloaded)