Browse Source

Better looking project window
Modify GUIScrollArea layout calculation so it respects GUIDimensions

Marko Pintera 10 years ago
parent
commit
69f264dc21

+ 4 - 3
BansheeEditor/Source/BsEditorApplication.cpp

@@ -143,6 +143,7 @@ namespace BansheeEngine
 		CodeEditorManager::startUp();
 		CodeEditorManager::startUp();
 
 
 		MainEditorWindow* mainWindow = MainEditorWindow::create(getPrimaryWindow());
 		MainEditorWindow* mainWindow = MainEditorWindow::create(getPrimaryWindow());
+		ScriptManager::instance().initialize();
 
 
 		/************************************************************************/
 		/************************************************************************/
 		/* 								DEBUG CODE                      		*/
 		/* 								DEBUG CODE                      		*/
@@ -226,9 +227,9 @@ namespace BansheeEngine
 
 
 	void EditorApplication::loadScriptSystem()
 	void EditorApplication::loadScriptSystem()
 	{
 	{
-		Application::loadScriptSystem();
-
-		loadPlugin("SBansheeEditor", &mSBansheeEditorPlugin); // Managed part of the editor
+		loadPlugin("BansheeMono", &mMonoPlugin);
+		loadPlugin("SBansheeEngine", &mSBansheeEnginePlugin);
+		loadPlugin("SBansheeEditor", &mSBansheeEditorPlugin);
 	}
 	}
 
 
 	void EditorApplication::startUp(RenderAPIPlugin renderAPI)
 	void EditorApplication::startUp(RenderAPIPlugin renderAPI)

+ 1 - 1
BansheeEngine/Include/BsApplication.h

@@ -100,7 +100,7 @@ namespace BansheeEngine
 		 */
 		 */
 		virtual void unloadScriptSystem();
 		virtual void unloadScriptSystem();
 
 
-	private:
+	protected:
 		/**
 		/**
 		 * @brief	Translates render system type into library name.
 		 * @brief	Translates render system type into library name.
 		 */
 		 */

+ 4 - 5
BansheeEngine/Source/BsApplication.cpp

@@ -77,8 +77,8 @@ namespace BansheeEngine
 		Cursor::startUp();
 		Cursor::startUp();
 		Cursor::instance().setCursor(CursorType::Arrow);
 		Cursor::instance().setCursor(CursorType::Arrow);
 
 
+		ScriptManager::startUp();
 		loadScriptSystem();
 		loadScriptSystem();
-		ScriptManager::instance().initialize();
 	}
 	}
 
 
 	void Application::onShutDown()
 	void Application::onShutDown()
@@ -87,6 +87,7 @@ namespace BansheeEngine
 		// could have allocated parts or all of those objects.
 		// could have allocated parts or all of those objects.
 		SceneManager::instance().clearScene(true);
 		SceneManager::instance().clearScene(true);
 
 
+		ScriptManager::shutDown();
 		unloadScriptSystem();
 		unloadScriptSystem();
 
 
 		CoreApplication::onShutDown();
 		CoreApplication::onShutDown();
@@ -113,16 +114,14 @@ namespace BansheeEngine
 
 
 	void Application::loadScriptSystem()
 	void Application::loadScriptSystem()
 	{
 	{
-		ScriptManager::startUp();
-
 		loadPlugin("BansheeMono", &mMonoPlugin);
 		loadPlugin("BansheeMono", &mMonoPlugin);
 		loadPlugin("SBansheeEngine", &mSBansheeEnginePlugin); 
 		loadPlugin("SBansheeEngine", &mSBansheeEnginePlugin); 
+
+		ScriptManager::instance().initialize();
 	}
 	}
 
 
 	void Application::unloadScriptSystem()
 	void Application::unloadScriptSystem()
 	{
 	{
-		ScriptManager::shutDown();
-
 		// These plugins must be unloaded before any other script plugins, because
 		// These plugins must be unloaded before any other script plugins, because
 		// they will cause finalizers to trigger and various modules those finalizers
 		// they will cause finalizers to trigger and various modules those finalizers
 		// might reference must still be active
 		// might reference must still be active

+ 2 - 7
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -71,12 +71,7 @@ namespace BansheeEngine
 		// then they're not needed and the range is valid. And if it doesn't
 		// then they're not needed and the range is valid. And if it doesn't
 		// fit the area will get clipped anyway and including the scroll bars
 		// fit the area will get clipped anyway and including the scroll bars
 		// won't change the size much, but it would complicate this method significantly.
 		// won't change the size much, but it would complicate this method significantly.
-		LayoutSizeRange sizeRange = mContentLayout->_calculateLayoutSizeRange();
-
-		sizeRange.optimal.x = std::max(10, sizeRange.optimal.x);
-		sizeRange.optimal.y = std::max(10, sizeRange.optimal.y);
-
-		return sizeRange;
+		return mDimensions.calculateSizeRange(_getOptimalSize());
 	}
 	}
 
 
 	LayoutSizeRange GUIScrollArea::_getLayoutSizeRange() const
 	LayoutSizeRange GUIScrollArea::_getLayoutSizeRange() const
@@ -99,7 +94,7 @@ namespace BansheeEngine
 			childIdx++;
 			childIdx++;
 		}
 		}
 
 
-		mSizeRange = mContentLayout->_getLayoutSizeRange();
+		mSizeRange = mDimensions.calculateSizeRange(_getOptimalSize());
 	}
 	}
 
 
 	void GUIScrollArea::_getElementAreas(const Rect2I& layoutArea, Rect2I* elementAreas, UINT32 numElements,
 	void GUIScrollArea::_getElementAreas(const Rect2I& layoutArea, Rect2I* elementAreas, UINT32 numElements,

+ 32 - 12
MBansheeEditor/ProjectWindow.cs

@@ -25,46 +25,66 @@ namespace BansheeEditor
             Title = "Project Manager";
             Title = "Project Manager";
 
 
             Width = 500;
             Width = 500;
-            Height = 350;
+            Height = 250;
         }
         }
 
 
         private void OnInitialize()
         private void OnInitialize()
         {
         {
             GUILayout vertLayout = GUI.AddLayoutY();
             GUILayout vertLayout = GUI.AddLayoutY();
+
+            vertLayout.AddSpace(5);
             GUILayout firstRow = vertLayout.AddLayoutX();
             GUILayout firstRow = vertLayout.AddLayoutX();
+            vertLayout.AddFlexibleSpace();
             GUILayout secondRow = vertLayout.AddLayoutX();
             GUILayout secondRow = vertLayout.AddLayoutX();
             GUILayout thirdRow = vertLayout.AddLayoutX();
             GUILayout thirdRow = vertLayout.AddLayoutX();
+            vertLayout.AddFlexibleSpace();
+            GUILayout fourthRow = vertLayout.AddLayoutX();
+            vertLayout.AddSpace(5);
 
 
-            projectInputBox = new GUITextField(new LocEdString("Project path"), 70);
+            projectInputBox = new GUITextField(new LocEdString("Project path"), 70, false, "", GUIOption.FixedWidth(425));
             projectInputBox.Value = EditorSettings.LastOpenProject;
             projectInputBox.Value = EditorSettings.LastOpenProject;
 
 
-            GUIButton openBtn = new GUIButton(new LocEdString("Open"));
+            GUIButton openBtn = new GUIButton(new LocEdString("Open"), GUIOption.FixedWidth(50));
             openBtn.OnClick += OpenProject;
             openBtn.OnClick += OpenProject;
 
 
+            firstRow.AddSpace(5);
             firstRow.AddElement(projectInputBox);
             firstRow.AddElement(projectInputBox);
+            firstRow.AddSpace(15);
             firstRow.AddElement(openBtn);
             firstRow.AddElement(openBtn);
+            firstRow.AddSpace(5);
+
+            GUILabel recentProjectsLabel = new GUILabel(new LocEdString("Recent projects:"));
+
+            secondRow.AddSpace(5);
+            secondRow.AddElement(recentProjectsLabel);
+            secondRow.AddFlexibleSpace();
 
 
-            recentProjectsArea = new GUIScrollArea();
-            secondRow.AddElement(recentProjectsArea);
+            recentProjectsArea = new GUIScrollArea(GUIOption.FixedWidth(425), GUIOption.FixedHeight(150));
+            thirdRow.AddSpace(5);
+            thirdRow.AddElement(recentProjectsArea);
+            thirdRow.AddSpace(15);
 
 
-            GUILayout browseBtnLayout = secondRow.AddLayoutY();
-            GUIButton browseBtn = new GUIButton(new LocEdString("Browse"));
+            GUILayout browseBtnLayout = thirdRow.AddLayoutY();
+            GUIButton browseBtn = new GUIButton(new LocEdString("Browse"), GUIOption.FixedWidth(50));
             browseBtn.OnClick += BrowseClicked;
             browseBtn.OnClick += BrowseClicked;
             browseBtnLayout.AddElement(browseBtn);
             browseBtnLayout.AddElement(browseBtn);
             browseBtnLayout.AddFlexibleSpace();
             browseBtnLayout.AddFlexibleSpace();
+            thirdRow.AddSpace(5);
 
 
             autoLoadToggle = new GUIToggle("");
             autoLoadToggle = new GUIToggle("");
             autoLoadToggle.Value = EditorSettings.AutoLoadLastProject;
             autoLoadToggle.Value = EditorSettings.AutoLoadLastProject;
 
 
             GUILabel autoLoadLabel = new GUILabel(new LocEdString("Automatically load last open project"));
             GUILabel autoLoadLabel = new GUILabel(new LocEdString("Automatically load last open project"));
 
 
-            GUIButton createBtn = new GUIButton(new LocEdString("Create"));
+            GUIButton createBtn = new GUIButton(new LocEdString("Create"), GUIOption.FixedWidth(50));
             createBtn.OnClick += CreateClicked;
             createBtn.OnClick += CreateClicked;
 
 
-            thirdRow.AddElement(autoLoadToggle);
-            thirdRow.AddElement(autoLoadLabel);
-            thirdRow.AddFlexibleSpace();
-            thirdRow.AddElement(createBtn);
+            fourthRow.AddSpace(5);
+            fourthRow.AddElement(autoLoadToggle);
+            fourthRow.AddElement(autoLoadLabel);
+            fourthRow.AddFlexibleSpace();
+            fourthRow.AddElement(createBtn);
+            fourthRow.AddSpace(5);
 
 
             RefreshRecentProjects();
             RefreshRecentProjects();
         }
         }

+ 1 - 0
TODO.txt

@@ -56,6 +56,7 @@ Move data folder within current repo
  - Store default layout asset in Data/Editor folder
  - Store default layout asset in Data/Editor folder
  - Store data generated by editor runtime at Data/Runtime
  - Store data generated by editor runtime at Data/Runtime
 
 
+TODO - Potentially close all windows when unloading project?
 TODO - Test if project loading/unloading/reloading works
 TODO - Test if project loading/unloading/reloading works
 
 
 Ribek use:
 Ribek use: