Browse Source

Adding development support for project frame (resources/hierarchy) resizing via Developer->UI menu, CTRL+Click now expands node and all children

Josh Engebretson 8 years ago
parent
commit
2b0deb178a

+ 14 - 0
Script/AtomicEditor/editor/Preferences.ts

@@ -420,6 +420,10 @@ interface EditorFeatures {
     screenshotFormat: string;
 }
 
+interface DevelopmentUI {
+    projectFrameWidthScalar: number;
+}
+
 class PreferencesFormat {
 
     constructor() {
@@ -485,6 +489,10 @@ class PreferencesFormat {
             screenshotFormat: "png"
         };
 
+        this.developmentUI = {
+            projectFrameWidthScalar: 1
+        }
+
     }
 
     /**
@@ -550,6 +558,11 @@ class PreferencesFormat {
             updatedMissingDefaults = true;
         }
 
+        if (!prefs.developmentUI) {
+            prefs.developmentUI = this.developmentUI;
+            updatedMissingDefaults = true;
+        }
+        
         return updatedMissingDefaults;
     }
 
@@ -561,6 +574,7 @@ class PreferencesFormat {
     editorBuildData: EditorBuildData;
     colorHistory: string[];
     editorFeatures: EditorFeatures;
+    developmentUI: DevelopmentUI;
 }
 
 export = Preferences;

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

@@ -48,7 +48,7 @@ class HierarchyFrame extends Atomic.UIWidget {
 
         this.load("AtomicEditor/editor/ui/hierarchyframe.tb.txt");
 
-        this.gravity = Atomic.UI_GRAVITY.UI_GRAVITY_TOP_BOTTOM;
+        this.gravity = Atomic.UI_GRAVITY.UI_GRAVITY_ALL;
 
         this.searchEdit = <Atomic.UIEditField>this.getWidget("filter");
 

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

@@ -89,6 +89,13 @@ class ProjectFrame extends ScriptWidget {
 
         }));
 
+        // Development support for project frame resizing, including hierarchy frame
+        this.subscribeToEvent("DevelopmentUIEvent", (data) => {
+            if (data.subEvent == "ScaleFrameWidth" && data.arg0 == "projectframe") {
+                this.handleScaleWidth(data.arg1);
+            }
+        });
+                
     }
 
     handleAssetRenamed(ev: ToolCore.AssetRenamedEvent) {
@@ -415,8 +422,14 @@ class ProjectFrame extends ScriptWidget {
 
     }
 
+    handleScaleWidth(scale:number) {
+        this.getWidget("projectframe").layoutMinWidth = 220 * scale;
+    }
+
     handleProjectLoaded(data: ToolCore.ProjectLoadedEvent) {
 
+        this.handleScaleWidth(parseFloat(AtomicEditor.instance.getApplicationPreference( "developmentUI", "projectFrameWidthScalar", "1")));
+
         this.folderList.rootList.value = 0;
         this.folderList.setExpanded(this.resourcesID, true);
         this.refreshContent(this.resourceFolder);
@@ -425,6 +438,8 @@ class ProjectFrame extends ScriptWidget {
 
     handleProjectUnloaded(data) {
 
+        this.handleScaleWidth(1);
+
         this.folderList.deleteAllItems();
         this.resourceFolder = null;
 

+ 33 - 3
Script/AtomicEditor/ui/frames/menus/MainFrameMenu.ts

@@ -292,6 +292,26 @@ class MainFrameMenu extends Atomic.ScriptObject {
                 return true;
             }
 
+            // Development UI adjustments for Project Frame
+
+            if (refid.indexOf("developer ui width") != -1) {
+
+                let scale = 1;
+                scale = refid.indexOf("1.5x") == -1 ? scale : 1.5;
+                scale = refid.indexOf("2x") == -1 ? scale : 2;
+                scale = refid.indexOf("3x") == -1 ? scale : 3;
+                scale = refid.indexOf("4x") == -1 ? scale : 4;
+
+                EditorUI.getEditor().setApplicationPreference( "developmentUI", "projectFrameWidthScalar", scale.toString());
+
+                this.sendEvent("DevelopmentUIEvent", {
+                    "subEvent" : "ScaleFrameWidth",
+                    "arg0" : "projectframe",
+                    "arg1" : scale
+                });
+
+            }
+
             // If we got here, then we may have been injected by a plugin.  Notify the plugins
             return ServiceLocator.uiServices.menuItemClicked(refid);
 
@@ -424,9 +444,19 @@ var buildItems = {
 
 
 var developerItems = {
-
-    "Toggle Theme": ["toggle theme"],
-    "Toggle Code Editor Theme": ["toggle codeeditor"],
+    "UI": {
+        "Project Frame": {
+            "1x": ["developer ui width project 1x"],
+            "1.5x": ["developer ui width project 1.5x"],
+            "2x": ["developer ui width project 2x"],
+            "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

+ 12 - 0
Source/Atomic/UI/UIListView.cpp

@@ -344,6 +344,18 @@ bool ListViewItemWidget::OnEvent(const TBWidgetEvent &ev)
     {
         item_->SetExpanded(!item_->GetExpanded());
 
+        // If we're expanding, and CTRL is help down, expand all children
+        if (item_->GetExpanded() && ev.modifierkeys & TB_CTRL)
+        {
+            PODVector<ListViewItem*> children;
+            item_->GetChildren(children, true);
+
+            for (unsigned i = 0; i < children.Size(); i++)
+            {
+                children[i]->SetExpanded(true);
+            }
+        }
+
         source_->uiListView_->UpdateItemVisibility();
 
         // want to bubble