浏览代码

More scaling fixes, frameless combo box for status bar

Brian Fiete 5 年之前
父节点
当前提交
385fa6dbb5

+ 18 - 8
BeefLibs/Beefy2D/src/theme/dark/DarkComboBox.bf

@@ -41,10 +41,17 @@ namespace Beefy.theme.dark
             }
             }
         }*/
         }*/
 
 
+		public enum FrameKind
+		{
+			OnWindow,
+			Frameless,
+			Transparent
+		}
+
         String mLabel ~ delete _;
         String mLabel ~ delete _;
         public float mLabelX = GS!(8);
         public float mLabelX = GS!(8);
         public FontAlign mLabelAlign = FontAlign.Centered;
         public FontAlign mLabelAlign = FontAlign.Centered;
-        public bool mFrameless = false;
+        public FrameKind mFrameKind = .OnWindow;
 
 
         public Event<Action<Menu>> mPopulateMenuAction ~ _.Dispose();
         public Event<Action<Menu>> mPopulateMenuAction ~ _.Dispose();
         public CBMenuWidget mCurMenuWidget;
         public CBMenuWidget mCurMenuWidget;
@@ -96,12 +103,12 @@ namespace Beefy.theme.dark
                 return;
                 return;
             }
             }
 
 
-            if (!mFrameless)
+            if ((mFrameKind == .OnWindow) || (mFrameKind == .Frameless))
             {
             {
-                Image texture = DarkTheme.sDarkTheme.mImages[(int32)DarkTheme.ImageIdx.ComboBox];
-                g.DrawBox(texture, 0, -2, mWidth, mHeight);
+                Image texture = DarkTheme.sDarkTheme.mImages[(mFrameKind == .OnWindow) ? (int32)DarkTheme.ImageIdx.ComboBox : (int32)DarkTheme.ImageIdx.ComboBoxFrameless];
+                g.DrawBox(texture, 0, GS!(-2), mWidth, mHeight);
             }
             }
-            else 
+            else
             {
             {
                 if (mBkgColor != 0)
                 if (mBkgColor != 0)
                 {
                 {
@@ -125,7 +132,7 @@ namespace Beefy.theme.dark
 						float fontHeight = g.mFont.GetHeight();
 						float fontHeight = g.mFont.GetHeight();
 
 
                         //g.DrawString(label, mLabelX, (mHeight - GS!(24)) / 2, mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
                         //g.DrawString(label, mLabelX, (mHeight - GS!(24)) / 2, mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
-						g.DrawString(label, mLabelX, (mHeight - fontHeight) / 2 - GS!(2) - 1, mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
+						g.DrawString(label, mLabelX, (mHeight - fontHeight) / 2 - (int)GS!(3.5f), mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
                     }
                     }
                 }
                 }
 
 
@@ -134,7 +141,10 @@ namespace Beefy.theme.dark
 				    using (g.PushColor(DarkTheme.COLOR_SELECTED_OUTLINE))
 				    using (g.PushColor(DarkTheme.COLOR_SELECTED_OUTLINE))
 				        g.DrawBox(DarkTheme.sDarkTheme.GetImage(.Outline), GS!(2), 0, mWidth - GS!(4), mHeight - GS!(4));
 				        g.DrawBox(DarkTheme.sDarkTheme.GetImage(.Outline), GS!(2), 0, mWidth - GS!(4), mHeight - GS!(4));
 				}
 				}
-            }            
+            }
+
+			/*using (g.PushColor(0x1FFF0000))
+				g.FillRect(0, 0, mWidth, mHeight);*/
         }
         }
 
 
 		public void GetLabel(String label)
 		public void GetLabel(String label)
@@ -184,7 +194,7 @@ namespace Beefy.theme.dark
                 popupXOfs = GS!(2);
                 popupXOfs = GS!(2);
                 popupYOfs = GS!(2);
                 popupYOfs = GS!(2);
             }
             }
-            else if (mFrameless)
+            else if (mFrameKind == .Transparent)
             {
             {
                 popupXOfs = GS!(2);
                 popupXOfs = GS!(2);
                 popupYOfs = GS!(2);
                 popupYOfs = GS!(2);

+ 2 - 2
BeefLibs/Beefy2D/src/theme/dark/DarkTabbedView.bf

@@ -481,7 +481,7 @@ namespace Beefy.theme.dark
 					useWidth = Math.Max(mWidth - GS!(36), 0);
 					useWidth = Math.Max(mWidth - GS!(36), 0);
 				useWidth = (float)Math.Round(useWidth);
 				useWidth = (float)Math.Round(useWidth);
 
 
-                tabButton.Resize(curX, tabButton.mY, useWidth, tabButton.mHeight);
+                tabButton.Resize(curX, tabButton.mY, useWidth, DarkTheme.sUnitSize);
 
 
                 //float offset = tabIdx - leftObscure;
                 //float offset = tabIdx - leftObscure;
                 float widthSubtract = Math.Max(0, leftObscure);
                 float widthSubtract = Math.Max(0, leftObscure);
@@ -590,7 +590,7 @@ namespace Beefy.theme.dark
 
 
                 mChildWidgets.Insert(0, tabButton);
                 mChildWidgets.Insert(0, tabButton);
 
 
-                tabButton.Resize(curX, tabButton.mY, tabButton.mWidth, tabButton.mHeight);
+                tabButton.Resize(curX, tabButton.mY, tabButton.mWidth, DarkTheme.sUnitSize);
                 
                 
                 curX += showWidth;                
                 curX += showWidth;                
             }
             }

+ 1 - 0
BeefLibs/Beefy2D/src/theme/dark/DarkTheme.bf

@@ -181,6 +181,7 @@ namespace Beefy.theme.dark
 			CheckIndeterminate,
 			CheckIndeterminate,
 			CodeError,
 			CodeError,
 			CodeWarning,
 			CodeWarning,
+			ComboBoxFrameless,
 
 
             COUNT
             COUNT
         };
         };

二进制
IDE/dist/images/DarkUI.png


二进制
IDE/dist/images/DarkUI.psd


二进制
IDE/dist/images/DarkUI_2.png


二进制
IDE/dist/images/DarkUI_4.png


+ 1 - 1
IDE/src/ui/PropertiesDialog.bf

@@ -1877,7 +1877,7 @@ namespace IDE.ui
 					if (propIdx == 0)
 					if (propIdx == 0)
 					{
 					{
 				        var comboBox = new DarkComboBox();
 				        var comboBox = new DarkComboBox();
-				        comboBox.mFrameless = true;
+				        comboBox.mFrameKind = .Transparent;
 				        comboBox.mPopulateMenuAction.Add(new (menu) => { PopulateComboBox(menu, propEntries); });
 				        comboBox.mPopulateMenuAction.Add(new (menu) => { PopulateComboBox(menu, propEntries); });
 				        subItem.AddWidget(comboBox);
 				        subItem.AddWidget(comboBox);
 				        subItem.mOnResized.Add(new (evt) => { comboBox.Resize(0, 0, GetValueEditWidth(subItem), subItem.mHeight + 1); });
 				        subItem.mOnResized.Add(new (evt) => { comboBox.Resize(0, 0, GetValueEditWidth(subItem), subItem.mHeight + 1); });

+ 6 - 4
IDE/src/ui/StatusBar.bf

@@ -27,11 +27,13 @@ namespace IDE.ui
 
 
         public this()
         public this()
         {
         {
-            mConfigComboBox = new DarkComboBox();            
+            mConfigComboBox = new DarkComboBox();
+			mConfigComboBox.mFrameKind = .Frameless;
             mConfigComboBox.mPopulateMenuAction.Add(new => PopulateConfigMenu);
             mConfigComboBox.mPopulateMenuAction.Add(new => PopulateConfigMenu);
             AddWidget(mConfigComboBox);
             AddWidget(mConfigComboBox);
 
 
-            mPlatformComboBox = new DarkComboBox();            
+            mPlatformComboBox = new DarkComboBox();
+			mPlatformComboBox.mFrameKind = .Frameless;
             mPlatformComboBox.mPopulateMenuAction.Add(new => PopulatePlatformMenu);
             mPlatformComboBox.mPopulateMenuAction.Add(new => PopulatePlatformMenu);
             AddWidget(mPlatformComboBox);
             AddWidget(mPlatformComboBox);
         }
         }
@@ -94,8 +96,8 @@ namespace IDE.ui
         void ResizeComponents()
         void ResizeComponents()
         {
         {
 			int btnLeft = gApp.mSettings.mEnableDevMode ? GS!(380) : GS!(300);
 			int btnLeft = gApp.mSettings.mEnableDevMode ? GS!(380) : GS!(300);
-            mConfigComboBox.Resize(mWidth - btnLeft, 0, GS!(120), mHeight + 2);
-            mPlatformComboBox.Resize(mWidth - btnLeft - GS!(120), 0, GS!(120), mHeight + 2);
+            mConfigComboBox.Resize(mWidth - btnLeft, GS!(0), GS!(120), GS!(24));
+            mPlatformComboBox.Resize(mWidth - btnLeft - GS!(120), GS!(0), GS!(120), GS!(24));
 
 
 			if (mCancelSymSrvButton != null)
 			if (mCancelSymSrvButton != null)
 				mCancelSymSrvButton.Resize(GS!(546), 0, GS!(20), GS!(20));
 				mCancelSymSrvButton.Resize(GS!(546), 0, GS!(20), GS!(20));

+ 2 - 2
IDE/src/ui/WorkspaceProperties.bf

@@ -634,7 +634,7 @@ namespace IDE.ui
 					    configItem = listViewItem.CreateSubItem(1);                
 					    configItem = listViewItem.CreateSubItem(1);                
 					    configItem.Label = configSelection.mConfig;
 					    configItem.Label = configSelection.mConfig;
 					    configComboBox = new DarkComboBox();
 					    configComboBox = new DarkComboBox();
-					    configComboBox.mFrameless = true;
+					    configComboBox.mFrameKind = .Transparent;
 					    configComboBox.mPopulateMenuAction.Add(new (menu) => { PopulateProjectConfigMenu(menu, configItem, project, newConfigSelection); });
 					    configComboBox.mPopulateMenuAction.Add(new (menu) => { PopulateProjectConfigMenu(menu, configItem, project, newConfigSelection); });
 					    configItem.AddWidget(configComboBox);                
 					    configItem.AddWidget(configComboBox);                
 					    configItem.mOnResized.Add(new (evt) => { configComboBox.Resize(0, 0, configItem.mWidth, configItem.mHeight + 1); });
 					    configItem.mOnResized.Add(new (evt) => { configComboBox.Resize(0, 0, configItem.mWidth, configItem.mHeight + 1); });
@@ -643,7 +643,7 @@ namespace IDE.ui
 					    platformItem = listViewItem.CreateSubItem(2);                
 					    platformItem = listViewItem.CreateSubItem(2);                
 					    platformItem.Label = configSelection.mPlatform;
 					    platformItem.Label = configSelection.mPlatform;
 					    platformComboBox = new DarkComboBox();
 					    platformComboBox = new DarkComboBox();
-					    platformComboBox.mFrameless = true;
+					    platformComboBox.mFrameKind = .Transparent;
 					    platformComboBox.mPopulateMenuAction.Add(new (menu) => { PopulateProjectPlatformMenu(menu, platformItem, project, newConfigSelection); });
 					    platformComboBox.mPopulateMenuAction.Add(new (menu) => { PopulateProjectPlatformMenu(menu, platformItem, project, newConfigSelection); });
 					    platformItem.AddWidget(platformComboBox);
 					    platformItem.AddWidget(platformComboBox);
 					    platformItem.mOnResized.Add(new (evt) => { platformComboBox.Resize(0, 0, GetValueEditWidth(platformItem), platformItem.mHeight + 1); });
 					    platformItem.mOnResized.Add(new (evt) => { platformComboBox.Resize(0, 0, GetValueEditWidth(platformItem), platformItem.mHeight + 1); });