Browse Source

Allow Editor Plugins to define shortcuts and linting

JimMarlowe 8 years ago
parent
commit
10134293e9

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

@@ -491,7 +491,7 @@ class PreferencesFormat {
 
         this.developmentUI = {
             projectFrameWidthScalar: 1
-        }
+        };
 
     }
 
@@ -562,7 +562,7 @@ class PreferencesFormat {
             prefs.developmentUI = this.developmentUI;
             updatedMissingDefaults = true;
         }
-        
+
         return updatedMissingDefaults;
     }
 

+ 3 - 3
Script/AtomicEditor/ui/AnimationToolbar.ts

@@ -96,11 +96,11 @@ class AnimationToolbar extends Atomic.UIWidget {
     }
 
     handleUpdate(ev) {
-    
+
         var rotspeed = this.rotateModel.value;
         if (rotspeed > 0) {                  // only do work if the spinning is turned on
             this.updateDelta += ev.timeStep; // add some time to the clock
-            if (this.updateDelta > (0.134 * (10-rotspeed))) {  //see if we have reached our limit
+            if (this.updateDelta > (0.134 * (10 - rotspeed))) {  //see if we have reached our limit
                 this.updateDelta = 0.0;      // reset the limit
                 this.updateYaw += 2.1;       // increase the yaw
                 if (this.updateYaw > 26.3)   // clamp the yaw
@@ -110,7 +110,7 @@ class AnimationToolbar extends Atomic.UIWidget {
 
         }
     }
-    
+
     handleWidgetEvent(ev: Atomic.UIWidgetEvent): boolean {
 
         if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) {

+ 1 - 1
Script/AtomicEditor/ui/frames/ProjectFrame.ts

@@ -95,7 +95,7 @@ class ProjectFrame extends ScriptWidget {
                 this.handleScaleWidth(data.arg1);
             }
         });
-                
+
     }
 
     handleAssetRenamed(ev: ToolCore.AssetRenamedEvent) {

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

@@ -351,7 +351,7 @@ class IntAttributeEdit extends AttributeInfoEdit {
                     } else {
                         widget.text = attrInfo.enumNames[value];
                     }
-                
+
                 }
                 else {
                     widget.text = value.toString();

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

@@ -143,7 +143,7 @@ class CreateComponentButton extends Atomic.UIButton {
         var menu = new Atomic.UIMenuWindow(this, "create component popup");
         menu.fontDescription = this.fd;
         menu.show(componentCreateSource);
-    }
+    };
 
     handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
 

+ 2 - 2
Script/AtomicEditor/ui/frames/menus/MainFrameMenu.ts

@@ -452,11 +452,11 @@ var developerItems = {
             "3x": ["developer ui width project 3x"],
             "4x": ["developer ui width project 4x"]
         }
-    },     
+    },
     "Theme": {
         "Toggle Theme": ["toggle theme"],
         "Toggle Code Editor Theme": ["toggle codeeditor"]
-    }, 
+    },
     "ScreenShot": ["screenshot", StringID.ShortcutScreenshot],
     "Show Console": ["developer show console"],
     "Clear Preferences": ["developer clear preferences"], //Adds clear preference to developer menu items list

+ 11 - 5
Script/AtomicEditor/ui/frames/menus/MenuItemSources.ts

@@ -58,14 +58,20 @@ function createMenuItemSourceRecursive(items: any): Atomic.UIMenuItemSource {
 
                 if (value.length == 1)
                     src.addItem(new UIMenuItem(key, value[0]));
-                else if (value.length == 2)
-                    src.addItem(new UIMenuItem(key, value[0], strings.EditorString.GetString(value[1])));
+                else if (value.length == 2) {
+                    var prospectShortcut = value[1]; // raw shortcut or editor shortcut 
+                    if ( strings.EditorString.GetString(value[1]) != undefined )  // editor defined shortcut
+                        prospectShortcut = strings.EditorString.GetString(value[1]);
+                    src.addItem(new UIMenuItem(key, value[0], prospectShortcut));
+                }
                 else if (value.length == 3) {
 
                     var str = "";
-                    if (value[1])
-                        str = strings.EditorString.GetString(value[1]);
-
+                    if (value[1]) {
+                        str = value[1];
+                        if ( strings.EditorString.GetString(value[1]) != undefined )
+                            str = strings.EditorString.GetString(value[1]);
+                    }
                     var skinBg = "";
                     if (value[2])
                         skinBg = value[2];