diff --git a/AboutPage/ContactForm.cs b/AboutPage/ContactForm.cs index 6dc5f4306..341260726 100644 --- a/AboutPage/ContactForm.cs +++ b/AboutPage/ContactForm.cs @@ -81,7 +81,7 @@ namespace MatterHackers.MatterControl.ContactForm { GuiWidget labelContainer = new GuiWidget(); labelContainer.HAnchor = HAnchor.ParentLeftRight; - labelContainer.Height = height * TextWidget.GlobalPointSizeScaleRatio; + labelContainer.Height = height * GuiWidget.DeviceScale; TextWidget formLabel = new TextWidget(labelText, pointSize: fontSize); formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; @@ -284,7 +284,7 @@ namespace MatterHackers.MatterControl.ContactForm textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; - whiteButtonFactory.FixedWidth = 138 * TextWidget.GlobalPointSizeScaleRatio; + whiteButtonFactory.FixedWidth = 138 * GuiWidget.DeviceScale; whiteButtonFactory.normalFillColor = RGBA_Bytes.White; whiteButtonFactory.normalTextColor = RGBA_Bytes.Black; whiteButtonFactory.hoverTextColor = RGBA_Bytes.Black; diff --git a/ActionBar/PrintActionRow.cs b/ActionBar/PrintActionRow.cs index 7c66bb4dc..4b0cf07a7 100644 --- a/ActionBar/PrintActionRow.cs +++ b/ActionBar/PrintActionRow.cs @@ -251,7 +251,7 @@ namespace MatterHackers.MatterControl.ActionBar textImageButtonFactory.AllowThemeToAdjustImage = false; textImageButtonFactory.borderWidth = 1; - textImageButtonFactory.FixedHeight = 52 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedHeight = 52 * GuiWidget.DeviceScale; textImageButtonFactory.fontSize = 14; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(255, 255, 255, 100); textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(255, 255, 255, 100); diff --git a/ActionBar/PrintStatusRow.cs b/ActionBar/PrintStatusRow.cs index 703da4efe..0d2ed9180 100644 --- a/ActionBar/PrintStatusRow.cs +++ b/ActionBar/PrintStatusRow.cs @@ -28,6 +28,8 @@ either expressed or implied, of the FreeBSD Project. */ using MatterHackers.Agg; +using MatterHackers.Agg.Image; +using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.CustomWidgets; @@ -232,9 +234,11 @@ namespace MatterHackers.MatterControl.ActionBar { ImageButtonFactory imageButtonFactory = new ImageButtonFactory(); imageButtonFactory.InvertImageColor = false; - string notifyIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png"); - string notifyHoverIconPath = Path.Combine("PrintStatusControls", "leveling-16x16.png"); - Button autoLevelButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath); + ImageBuffer levelingImage = StaticData.Instance.LoadIcon("leveling_32x32.png"); + levelingImage.SetRecieveBlender(new BlenderPreMultBGRA()); + int iconSize = (int)(16 * GuiWidget.DeviceScale); + levelingImage = ImageBuffer.CreateScaledImage(levelingImage, iconSize, iconSize); + Button autoLevelButton = imageButtonFactory.Generate(levelingImage, levelingImage); autoLevelButton.Cursor = Cursors.Hand; autoLevelButton.Margin = new Agg.BorderDouble(top: 3); autoLevelButton.ToolTipText = "Print leveling is enabled.".Localize(); diff --git a/ActionBar/TemperatureWidgetBase.cs b/ActionBar/TemperatureWidgetBase.cs index 11351aeea..5f05b00e5 100644 --- a/ActionBar/TemperatureWidgetBase.cs +++ b/ActionBar/TemperatureWidgetBase.cs @@ -65,15 +65,15 @@ namespace MatterHackers.MatterControl.ActionBar private event EventHandler unregisterEvents; public TemperatureWidgetBase(string textValue) - : base(52 * TextWidget.GlobalPointSizeScaleRatio, 52 * TextWidget.GlobalPointSizeScaleRatio) + : base(52 * GuiWidget.DeviceScale, 52 * GuiWidget.DeviceScale) { - whiteButtonFactory.FixedHeight = 18 * TextWidget.GlobalPointSizeScaleRatio; + whiteButtonFactory.FixedHeight = 18 * GuiWidget.DeviceScale; whiteButtonFactory.fontSize = 7; whiteButtonFactory.normalFillColor = RGBA_Bytes.White; whiteButtonFactory.normalTextColor = RGBA_Bytes.DarkGray; this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 200); - this.Margin = new BorderDouble(0, 2) * TextWidget.GlobalPointSizeScaleRatio; + this.Margin = new BorderDouble(0, 2) * GuiWidget.DeviceScale; temperatureTypeName = new TextWidget("", pointSize: 8); temperatureTypeName.AutoExpandBoundsToText = true; @@ -91,7 +91,7 @@ namespace MatterHackers.MatterControl.ActionBar GuiWidget buttonContainer = new GuiWidget(); buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - buttonContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio; + buttonContainer.Height = 18 * GuiWidget.DeviceScale; preheatButton = whiteButtonFactory.Generate("Preheat".Localize().ToUpper()); preheatButton.Cursor = Cursors.Hand; diff --git a/ApplicationView/MenuRow/MenuBase.cs b/ApplicationView/MenuRow/MenuBase.cs index 2bdfeaa4e..6bd5731b6 100644 --- a/ApplicationView/MenuRow/MenuBase.cs +++ b/ApplicationView/MenuRow/MenuBase.cs @@ -31,6 +31,7 @@ namespace MatterHackers.MatterControl MenuDropList.MenuItemsPadding = new BorderDouble(0); MenuDropList.Margin = new BorderDouble(0); MenuDropList.Padding = new BorderDouble(0); + MenuDropList.MenuItemsPadding = new BorderDouble(8, 6, 8, 6); MenuDropList.DrawDirectionalArrow = false; MenuDropList.MenuAsWideAsItems = false; @@ -40,18 +41,24 @@ namespace MatterHackers.MatterControl //Add the menu items to the menu itself foreach (MenuItemAction item in menuItems) { - MenuDropList.MenuItemsPadding = new BorderDouble(8, 6, 8, 6) * TextWidget.GlobalPointSizeScaleRatio; - MenuItem newItem = MenuDropList.AddItem(item.Title, pointSize: 11); - if (item.Action == null) + if (item.Title.StartsWith("-----")) { - newItem.Enabled = false; + MenuDropList.AddHorizontalLine(); + } + else + { + MenuItem newItem = MenuDropList.AddItem(item.Title, pointSize: 11); + if (item.Action == null) + { + newItem.Enabled = false; + } } } MenuDropList.Padding = padding; AddChild(MenuDropList); this.Width = GetChildrenBoundsIncludingMargins().Width; - this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 22 * GuiWidget.DeviceScale; this.Margin = new BorderDouble(0); this.Padding = new BorderDouble(0); this.VAnchor = Agg.UI.VAnchor.ParentCenter; diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index 59aa14fca..a9b7a2cd7 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -49,8 +49,8 @@ namespace MatterHackers.MatterControl private FlowLayoutWidget ColumnOne; private FlowLayoutWidget ColumnTwo; - private double Force1PanelWidth = 990 * TextWidget.GlobalPointSizeScaleRatio; - private double Force2PanelWidth = 1590 * TextWidget.GlobalPointSizeScaleRatio; + private double Force1PanelWidth = 990 * GuiWidget.DeviceScale; + private double Force2PanelWidth = 1590 * GuiWidget.DeviceScale; private GuiWidget leftBorderLine; diff --git a/BrailleBuilder/View3DBrailleBuilder.cs b/BrailleBuilder/View3DBrailleBuilder.cs index 64c755aaf..feb73125a 100644 --- a/BrailleBuilder/View3DBrailleBuilder.cs +++ b/BrailleBuilder/View3DBrailleBuilder.cs @@ -802,7 +802,7 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder private void AddLetterControls(FlowLayoutWidget buttonPanel) { - textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedWidth = 44 * GuiWidget.DeviceScale; FlowLayoutWidget degreesContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); degreesContainer.HAnchor = HAnchor.ParentLeftRight; diff --git a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs index 5b377877d..7ec6e8b0c 100644 --- a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs +++ b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs @@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage { FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; - buttonRow.Margin = new BorderDouble(0, 4); + buttonRow.Margin = new BorderDouble(3, 4); TextWidget clearHistoryLabel = new TextWidget("Clear Print History".Localize()); clearHistoryLabel.AutoExpandBoundsToText = true; diff --git a/ConfigurationPage/CalibrationSettings/CalibrationSettingsView.cs b/ConfigurationPage/CalibrationSettings/CalibrationSettingsView.cs index 34a627e08..f5b8ef22b 100644 --- a/ConfigurationPage/CalibrationSettings/CalibrationSettingsView.cs +++ b/ConfigurationPage/CalibrationSettings/CalibrationSettingsView.cs @@ -1,4 +1,5 @@ using MatterHackers.Agg; +using MatterHackers.Agg.Image; using MatterHackers.Agg.ImageProcessing; using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; @@ -76,7 +77,11 @@ namespace MatterHackers.MatterControl.ConfigurationPage UiThread.RunOnIdle(() => LevelWizardBase.ShowPrintLevelWizard(LevelWizardBase.RuningState.UserRequestedCalibration)); }; - Agg.Image.ImageBuffer levelingImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "leveling-24x24.png")); + ImageBuffer levelingImage = StaticData.Instance.LoadIcon("leveling_32x32.png"); + levelingImage.SetRecieveBlender(new BlenderPreMultBGRA()); + int iconSize = (int)(24 * GuiWidget.DeviceScale); + levelingImage = ImageBuffer.CreateScaledImage(levelingImage, iconSize, iconSize); + if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(levelingImage); diff --git a/ConfigurationPage/CloudSettings/CloudSettingsView.cs b/ConfigurationPage/CloudSettings/CloudSettingsView.cs index 1d3f6f9ee..4d6cce265 100644 --- a/ConfigurationPage/CloudSettings/CloudSettingsView.cs +++ b/ConfigurationPage/CloudSettings/CloudSettingsView.cs @@ -8,6 +8,7 @@ using MatterHackers.MatterControl.PrinterCommunication; using MatterHackers.MatterControl.PluginSystem; using System; using System.IO; +using MatterHackers.Agg.Image; namespace MatterHackers.MatterControl.ConfigurationPage { @@ -18,31 +19,26 @@ namespace MatterHackers.MatterControl.ConfigurationPage private Button configureNotificationSettingsButton; - private LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); - - public CloudSettingsWidget() : base(LocalizedString.Get("Cloud")) { mainContainer.AddChild(new HorizontalLine(separatorLineColor)); - notificationSettingsContainer = new DisableableWidget(); + notificationSettingsContainer = new DisableableWidget(); notificationSettingsContainer.AddChild(GetNotificationControls()); mainContainer.AddChild(notificationSettingsContainer); - mainContainer.AddChild(new HorizontalLine(separatorLineColor)); - cloudSyncContainer = new DisableableWidget(); - cloudSyncContainer.AddChild(GetCloudSyncDashboardControls()); - mainContainer.AddChild(cloudSyncContainer); + mainContainer.AddChild(new HorizontalLine(separatorLineColor)); + cloudSyncContainer = new DisableableWidget(); + cloudSyncContainer.AddChild(GetCloudSyncDashboardControls()); + mainContainer.AddChild(cloudSyncContainer); AddChild(mainContainer); - AddHandlers(); } private void SetDisplayAttributes() { - this.Margin = new BorderDouble(2, 4, 2, 0); this.textImageButtonFactory.normalFillColor = RGBA_Bytes.White; this.textImageButtonFactory.disabledFillColor = RGBA_Bytes.White; @@ -76,7 +72,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage cloudSyncContainer.Margin = new BorderDouble(0, 0, 0, 0); cloudSyncContainer.Padding = new BorderDouble(0); - Agg.Image.ImageBuffer cloudMonitorImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "cloud-24x24.png")); + ImageBuffer cloudMonitorImage = StaticData.Instance.LoadIcon("cloud-24x24.png"); + cloudMonitorImage.SetRecieveBlender(new BlenderPreMultBGRA()); + int iconSize = (int)(24 * GuiWidget.DeviceScale); if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(cloudMonitorImage); @@ -84,8 +82,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage ImageWidget cloudSyncIcon = new ImageWidget(cloudMonitorImage); cloudSyncIcon.Margin = new BorderDouble(right: 6, bottom: 6); + cloudSyncIcon.VAnchor = VAnchor.ParentCenter; - TextWidget cloudSyncLabel = new TextWidget("Cloud Sync".Localize()); + TextWidget cloudSyncLabel = new TextWidget("Cloud Sync".Localize()); cloudSyncLabel.AutoExpandBoundsToText = true; cloudSyncLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; cloudSyncLabel.VAnchor = VAnchor.ParentCenter; @@ -94,10 +93,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage Button cloudSyncGoLink = linkButtonFactory.Generate("Go to Dashboard".Localize().ToUpper()); cloudSyncGoLink.ToolTipText = "Open cloud sync dashboard in web browser"; cloudSyncGoLink.Click += new EventHandler(cloudSyncGoButton_Click); + cloudSyncGoLink.VAnchor = VAnchor.ParentCenter; - cloudSyncContainer.AddChild(cloudSyncIcon); + + cloudSyncContainer.AddChild(cloudSyncIcon); cloudSyncContainer.AddChild(cloudSyncLabel); - cloudSyncContainer.AddChild(new HorizontalSpacer()); + cloudSyncContainer.AddChild(new HorizontalSpacer() + { + VAnchor = VAnchor.ParentCenter, + }); cloudSyncContainer.AddChild(cloudSyncGoLink); return cloudSyncContainer; @@ -115,13 +119,16 @@ namespace MatterHackers.MatterControl.ConfigurationPage this.textImageButtonFactory.FixedHeight = TallButtonHeight; - Agg.Image.ImageBuffer notificationSettingsImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "notify-24x24.png")); + ImageBuffer notifiImage = StaticData.Instance.LoadIcon("notify-24x24.png"); + notifiImage.SetRecieveBlender(new BlenderPreMultBGRA()); + int iconSize = (int)(24 * GuiWidget.DeviceScale); if (!ActiveTheme.Instance.IsDarkTheme) { - InvertLightness.DoInvertLightness(notificationSettingsImage); + InvertLightness.DoInvertLightness(notifiImage); } - ImageWidget notificationSettingsIcon = new ImageWidget(notificationSettingsImage); + ImageWidget notificationSettingsIcon = new ImageWidget(notifiImage); + notificationSettingsIcon.VAnchor = VAnchor.ParentCenter; notificationSettingsIcon.Margin = new BorderDouble(right: 6, bottom: 6); configureNotificationSettingsButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); diff --git a/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs b/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs index 9e0e4f118..435fff260 100644 --- a/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs +++ b/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs @@ -1,4 +1,5 @@ using MatterHackers.Agg; +using MatterHackers.Agg.Image; using MatterHackers.Agg.ImageProcessing; using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; @@ -69,7 +70,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Margin = new BorderDouble(0, 4); - Agg.Image.ImageBuffer cameraIconImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "camera-24x24.png")); + ImageBuffer cameraIconImage = StaticData.Instance.LoadIcon("camera-24x24.png"); + cameraIconImage.SetRecieveBlender(new BlenderPreMultBGRA()); + int iconSize = (int)(24 * GuiWidget.DeviceScale); + if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(cameraIconImage); @@ -119,7 +123,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Margin = new BorderDouble(0, 4); - Agg.Image.ImageBuffer terminalSettingsImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "terminal-24x24.png")); + ImageBuffer terminalSettingsImage = StaticData.Instance.LoadIcon("terminal-24x24.png"); + terminalSettingsImage.SetRecieveBlender(new BlenderPreMultBGRA()); + int iconSize = (int)(24 * GuiWidget.DeviceScale); + if (!ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(terminalSettingsImage); @@ -161,13 +168,17 @@ namespace MatterHackers.MatterControl.ConfigurationPage notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; notificationSettingsLabel.VAnchor = VAnchor.ParentCenter; - Agg.Image.ImageBuffer eePromImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "leveling-24x24.png")); + ImageBuffer levelingImage = StaticData.Instance.LoadIcon("leveling_32x32.png"); + levelingImage.SetRecieveBlender(new BlenderPreMultBGRA()); + int iconSize = (int)(24 * GuiWidget.DeviceScale); + levelingImage = ImageBuffer.CreateScaledImage(levelingImage, iconSize, iconSize); + if (!ActiveTheme.Instance.IsDarkTheme) { - InvertLightness.DoInvertLightness(eePromImage); + InvertLightness.DoInvertLightness(levelingImage); } - ImageWidget eePromIcon = new ImageWidget(eePromImage); - eePromIcon.Margin = new BorderDouble(right: 6); + ImageWidget levelingIcon = new ImageWidget(levelingImage); + levelingIcon.Margin = new BorderDouble(right: 6); Button configureEePromButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper()); configureEePromButton.Click += new EventHandler(configureEePromButton_Click); diff --git a/ConfigurationPage/SettingsViewBase.cs b/ConfigurationPage/SettingsViewBase.cs index 034c56bb4..2cf70a259 100644 --- a/ConfigurationPage/SettingsViewBase.cs +++ b/ConfigurationPage/SettingsViewBase.cs @@ -5,7 +5,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage { public class SettingsViewBase : AltGroupBox { - protected readonly int TallButtonHeight = (int)(25 * TextWidget.GlobalPointSizeScaleRatio + .5); + protected readonly int TallButtonHeight = (int)(25 * GuiWidget.DeviceScale + .5); protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(); protected LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); protected RGBA_Bytes separatorLineColor; diff --git a/ControlElements/ImageButtonFactory.cs b/ControlElements/ImageButtonFactory.cs index ca88468fc..8e40f0879 100644 --- a/ControlElements/ImageButtonFactory.cs +++ b/ControlElements/ImageButtonFactory.cs @@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl off = off.Localize(); } ToggleSwitchView toggleView = new ToggleSwitchView(on, off, - 60, 24, + 60 * GuiWidget.DeviceScale, 24 * GuiWidget.DeviceScale, ActiveTheme.Instance.PrimaryBackgroundColor, new RGBA_Bytes(220, 220, 220), ActiveTheme.Instance.PrimaryAccentColor, @@ -127,13 +127,6 @@ namespace MatterHackers.MatterControl InvertLightness.DoInvertLightness(disabledImage); } - if (ActiveTheme.Instance.IsTouchScreen) - { - //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); - RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0); - pressedImage.NewGraphics2D().Render(new Stroke(rect, 3), ActiveTheme.Instance.PrimaryTextColor); - } - ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), diff --git a/ControlElements/SplitButtonFactory.cs b/ControlElements/SplitButtonFactory.cs index 9cf80e8a5..1329e0e08 100644 --- a/ControlElements/SplitButtonFactory.cs +++ b/ControlElements/SplitButtonFactory.cs @@ -29,7 +29,7 @@ namespace MatterHackers.MatterControl public bool AllowThemeToAdjustImage = true; private string imageName; - public double FixedHeight = 30 * TextWidget.GlobalPointSizeScaleRatio; + public double FixedHeight = 30 * GuiWidget.DeviceScale; public SplitButtonFactory() { diff --git a/ControlElements/StyledMessageBoxWindow.cs b/ControlElements/StyledMessageBoxWindow.cs index 9aa0d23d3..28f9a8b09 100644 --- a/ControlElements/StyledMessageBoxWindow.cs +++ b/ControlElements/StyledMessageBoxWindow.cs @@ -65,14 +65,14 @@ namespace MatterHackers.MatterControl } else { - topToBottom.Padding = new BorderDouble(3, 0, 3, 5) * TextWidget.GlobalPointSizeScaleRatio; + topToBottom.Padding = new BorderDouble(3, 0, 3, 5); } // Creates Header FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; - headerRow.Margin = new BorderDouble(0, 3, 0, 0) * TextWidget.GlobalPointSizeScaleRatio; - headerRow.Padding = new BorderDouble(0, 3, 0, 3) * TextWidget.GlobalPointSizeScaleRatio; + headerRow.Margin = new BorderDouble(0, 3, 0, 0); + headerRow.Padding = new BorderDouble(0, 3, 0, 3); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; //Creates Text and adds into header @@ -92,7 +92,7 @@ namespace MatterHackers.MatterControl middleRowContainer.HAnchor = HAnchor.ParentLeftRight; middleRowContainer.VAnchor = VAnchor.ParentBottomTop; // normally the padding for the middle container should be just (5) all around. The has extra top space - middleRowContainer.Padding = new BorderDouble(5, 5, 5, 15) * TextWidget.GlobalPointSizeScaleRatio; + middleRowContainer.Padding = new BorderDouble(5, 5, 5, 15); middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } @@ -116,7 +116,7 @@ namespace MatterHackers.MatterControl { BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRow.HAnchor = HAnchor.ParentLeftRight; - buttonRow.Padding = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; + buttonRow.Padding = new BorderDouble(0, 3); } @@ -174,7 +174,7 @@ namespace MatterHackers.MatterControl double wrappingSize = middleRowContainer.Width - (middleRowContainer.Padding.Width + messageContainer.Margin.Width); if (wrappingSize > 0) { - EnglishTextWrapping wrapper = new EnglishTextWrapping(12 * extraTextScaling * TextWidget.GlobalPointSizeScaleRatio); + EnglishTextWrapping wrapper = new EnglishTextWrapping(12 * extraTextScaling * GuiWidget.DeviceScale); string wrappedMessage = wrapper.InsertCRs(unwrappedMessage, wrappingSize); messageContainer.Text = wrappedMessage; } diff --git a/ControlElements/TextImageButtonFactory.cs b/ControlElements/TextImageButtonFactory.cs index 66f104065..6757d252c 100644 --- a/ControlElements/TextImageButtonFactory.cs +++ b/ControlElements/TextImageButtonFactory.cs @@ -226,8 +226,8 @@ namespace MatterHackers.MatterControl public static Button GetThemedEditButton() { - ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_white_32x32.png"); - int iconSize = (int)(16 * TextWidget.GlobalPointSizeScaleRatio); + ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_32x32.png"); + int iconSize = (int)(16 * GuiWidget.DeviceScale); normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize); Button editButton; diff --git a/CustomWidgets/DisableableWidget.cs b/CustomWidgets/DisableableWidget.cs index 71f920b8c..7a7e1506d 100644 --- a/CustomWidgets/DisableableWidget.cs +++ b/CustomWidgets/DisableableWidget.cs @@ -31,7 +31,7 @@ namespace MatterHackers.MatterControl.CustomWidgets break; case EnableLevel.ConfigOnly: - disableOverlay.Margin = new BorderDouble(0, 0, 0, 26) * TextWidget.GlobalPointSizeScaleRatio; ; + disableOverlay.Margin = new BorderDouble(0, 0, 0, 26); disableOverlay.Visible = true; break; diff --git a/CustomWidgets/LibrarySelector/LibrarySelectorRowItem.cs b/CustomWidgets/LibrarySelector/LibrarySelectorRowItem.cs index c36e4081d..f9ed1dca4 100644 --- a/CustomWidgets/LibrarySelector/LibrarySelectorRowItem.cs +++ b/CustomWidgets/LibrarySelector/LibrarySelectorRowItem.cs @@ -115,7 +115,7 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector { //this.VAnchor = Agg.UI.VAnchor.FitToChildren; this.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - this.Height = 50 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 50 * GuiWidget.DeviceScale; this.Padding = new BorderDouble(0); this.Margin = new BorderDouble(6, 0, 6, 6); diff --git a/CustomWidgets/LibrarySelector/LibrarySelectorWidget.cs b/CustomWidgets/LibrarySelector/LibrarySelectorWidget.cs index 0451bd4c6..cf8c15bbc 100644 --- a/CustomWidgets/LibrarySelector/LibrarySelectorWidget.cs +++ b/CustomWidgets/LibrarySelector/LibrarySelectorWidget.cs @@ -317,7 +317,7 @@ namespace MatterHackers.MatterControl.CustomWidgets.LibrarySelector protected GuiWidget GetThumbnailWidget(LibraryProvider parentProvider, PrintItemCollection printItemCollection, ImageBuffer imageBuffer) { - Vector2 expectedSize = new Vector2((int)(50 * TextWidget.GlobalPointSizeScaleRatio), (int)(50 * TextWidget.GlobalPointSizeScaleRatio)); + Vector2 expectedSize = new Vector2((int)(50 * GuiWidget.DeviceScale), (int)(50 * GuiWidget.DeviceScale)); if (imageBuffer.Width != expectedSize.x) { ImageBuffer scaledImageBuffer = new ImageBuffer((int)expectedSize.x, (int)expectedSize.y, 32, new BlenderBGRA()); diff --git a/CustomWidgets/PartThumbnailWidget.cs b/CustomWidgets/PartThumbnailWidget.cs index d5fb29a16..a3b2a0264 100644 --- a/CustomWidgets/PartThumbnailWidget.cs +++ b/CustomWidgets/PartThumbnailWidget.cs @@ -93,13 +93,13 @@ namespace MatterHackers.MatterControl switch (size) { case ImageSizes.Size50x50: - this.Width = 50 * TextWidget.GlobalPointSizeScaleRatio; - this.Height = 50 * TextWidget.GlobalPointSizeScaleRatio; + this.Width = 50 * GuiWidget.DeviceScale; + this.Height = 50 * GuiWidget.DeviceScale; break; case ImageSizes.Size115x115: - this.Width = 115 * TextWidget.GlobalPointSizeScaleRatio; - this.Height = 115 * TextWidget.GlobalPointSizeScaleRatio; + this.Width = 115 * GuiWidget.DeviceScale; + this.Height = 115 * GuiWidget.DeviceScale; break; default: @@ -662,7 +662,7 @@ namespace MatterHackers.MatterControl this.thumbnailImage.SetRecieveBlender(new BlenderPreMultBGRA()); Graphics2D graphics = this.thumbnailImage.NewGraphics2D(); Vector2 center = new Vector2(Width / 2.0, Height / 2.0); - double yOffset = 8 * Width / 50 * TextWidget.GlobalPointSizeScaleRatio * 1.5; + double yOffset = 8 * Width / 50 * GuiWidget.DeviceScale * 1.5; graphics.DrawString("Too Big\nto\nRender", center.x, center.y + yOffset, 8 * Width / 50, Agg.Font.Justification.Center, Agg.Font.Baseline.BoundsCenter, color: RGBA_Bytes.White); UiThread.RunOnIdle(this.EnsureImageUpdated); diff --git a/CustomWidgets/PopOutTextTab.cs b/CustomWidgets/PopOutTextTab.cs index 433e1e016..98212a213 100644 --- a/CustomWidgets/PopOutTextTab.cs +++ b/CustomWidgets/PopOutTextTab.cs @@ -99,7 +99,9 @@ namespace MatterHackers.Agg.UI tabTitle.AutoExpandBoundsToText = true; leftToRight.AddChild(tabTitle); - ImageBuffer popOutImageClick = StaticData.Instance.LoadIcon(Path.Combine("icon_pop_out_32x32.png")); + ImageBuffer popOutImageClick = StaticData.Instance.LoadIcon("icon_pop_out_32x32.png"); + int iconSize = (int)(16 * GuiWidget.DeviceScale); + popOutImageClick = ImageBuffer.CreateScaledImage(popOutImageClick, iconSize, iconSize); if (ActiveTheme.Instance.IsDarkTheme) { InvertLightness.DoInvertLightness(popOutImageClick); diff --git a/CustomWidgets/SplitButton.cs b/CustomWidgets/SplitButton.cs index 12aaacb5e..efe4ea37d 100644 --- a/CustomWidgets/SplitButton.cs +++ b/CustomWidgets/SplitButton.cs @@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl private Button CreateDefaultButton(string buttonText) { TextImageButtonFactory buttonFactory = new TextImageButtonFactory(); - buttonFactory.FixedHeight = 30 * TextWidget.GlobalPointSizeScaleRatio; + buttonFactory.FixedHeight = 30 * GuiWidget.DeviceScale; buttonFactory.normalFillColor = RGBA_Bytes.White; buttonFactory.normalTextColor = RGBA_Bytes.Black; buttonFactory.hoverTextColor = RGBA_Bytes.Black; diff --git a/CustomWidgets/ThemeColorSelectorWidget.cs b/CustomWidgets/ThemeColorSelectorWidget.cs index 3f20bc80a..c84cbf753 100644 --- a/CustomWidgets/ThemeColorSelectorWidget.cs +++ b/CustomWidgets/ThemeColorSelectorWidget.cs @@ -35,8 +35,8 @@ namespace MatterHackers.MatterControl public class ThemeColorSelectorWidget : FlowLayoutWidget { private GuiWidget colorToChangeTo; - private int containerHeight = 34; - private int colorSelectSize = 32; + private int containerHeight = (int)(34 * GuiWidget.DeviceScale + .5); + private int colorSelectSize = (int)(32 * GuiWidget.DeviceScale + .5); public ThemeColorSelectorWidget(GuiWidget colorToChangeTo) { diff --git a/EeProm/EePromMarlinWindow.cs b/EeProm/EePromMarlinWindow.cs index 7aa467e04..610eff8ed 100644 --- a/EeProm/EePromMarlinWindow.cs +++ b/EeProm/EePromMarlinWindow.cs @@ -190,7 +190,7 @@ namespace MatterHackers.MatterControl.EeProm #if true { Button buttonImport = textImageButtonFactory.Generate("Import".Localize() + "..."); - buttonImport.Margin = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; + buttonImport.Margin = new BorderDouble(0, 3); buttonImport.Click += (sender, e) => { UiThread.RunOnIdle(() => @@ -217,7 +217,7 @@ namespace MatterHackers.MatterControl.EeProm // put in the export button { Button buttonExport = textImageButtonFactory.Generate("Export".Localize() + "..."); - buttonExport.Margin = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; + buttonExport.Margin = new BorderDouble(0, 3); buttonExport.Click += (sender, e) => { UiThread.RunOnIdle(() => diff --git a/EeProm/EePromRepetierWindow.cs b/EeProm/EePromRepetierWindow.cs index 7a6a515cd..2b15a9fe6 100644 --- a/EeProm/EePromRepetierWindow.cs +++ b/EeProm/EePromRepetierWindow.cs @@ -58,20 +58,20 @@ namespace MatterHackers.MatterControl.EeProm topToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; topToBottom.HAnchor = Agg.UI.HAnchor.ParentLeftRight; topToBottom.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; - topToBottom.Padding = new BorderDouble(3, 0) * TextWidget.GlobalPointSizeScaleRatio; + topToBottom.Padding = new BorderDouble(3, 0); FlowLayoutWidget row = new FlowLayoutWidget(); row.HAnchor = Agg.UI.HAnchor.ParentLeftRight; row.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; GuiWidget descriptionWidget = AddDescription(LocalizedString.Get("Description")); - descriptionWidget.Margin = new BorderDouble(left: 3) * TextWidget.GlobalPointSizeScaleRatio; + descriptionWidget.Margin = new BorderDouble(left: 3); row.AddChild(descriptionWidget); CreateSpacer(row); GuiWidget valueText = new TextWidget(LocalizedString.Get("Value"), textColor: ActiveTheme.Instance.PrimaryTextColor); valueText.VAnchor = Agg.UI.VAnchor.ParentCenter; - valueText.Margin = new BorderDouble(left: 5, right: 60) * TextWidget.GlobalPointSizeScaleRatio; + valueText.Margin = new BorderDouble(left: 5, right: 60); row.AddChild(valueText); topToBottom.AddChild(row); @@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.EeProm // put in the save button { Button buttonSave = textImageButtonFactory.Generate("Save To EEPROM".Localize()); - buttonSave.Margin = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; + buttonSave.Margin = new BorderDouble(0, 3); buttonSave.Click += (sender, e) => { UiThread.RunOnIdle(() => @@ -115,7 +115,7 @@ namespace MatterHackers.MatterControl.EeProm // put in the import button { Button buttonImport = textImageButtonFactory.Generate("Import".Localize() + "..."); - buttonImport.Margin = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; + buttonImport.Margin = new BorderDouble(0, 3); buttonImport.Click += (sender, e) => { UiThread.RunOnIdle(() => @@ -142,7 +142,7 @@ namespace MatterHackers.MatterControl.EeProm // put in the export button { Button buttonExport = textImageButtonFactory.Generate("Export".Localize() + "..."); - buttonExport.Margin = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; + buttonExport.Margin = new BorderDouble(0, 3); buttonExport.Click += (sender, e) => { UiThread.RunOnIdle(() => @@ -169,7 +169,7 @@ namespace MatterHackers.MatterControl.EeProm // put in the cancel button { Button buttonCancel = textImageButtonFactory.Generate("Close".Localize()); - buttonCancel.Margin = new BorderDouble(10, 3, 0, 3) * TextWidget.GlobalPointSizeScaleRatio; + buttonCancel.Margin = new BorderDouble(10, 3, 0, 3); buttonCancel.Click += (sender, e) => { UiThread.RunOnIdle(() => @@ -272,7 +272,7 @@ namespace MatterHackers.MatterControl.EeProm FlowLayoutWidget row = new FlowLayoutWidget(); row.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; row.AddChild(AddDescription(newSetting.Description)); - row.Padding = new BorderDouble(5, 0) * TextWidget.GlobalPointSizeScaleRatio; + row.Padding = new BorderDouble(5, 0); if ((settingsColmun.Children.Count % 2) == 1) { row.BackgroundColor = new RGBA_Bytes(0, 0, 0, 30); @@ -282,7 +282,7 @@ namespace MatterHackers.MatterControl.EeProm double currentValue; double.TryParse(newSetting.Value, out currentValue); - MHNumberEdit valueEdit = new MHNumberEdit(currentValue, pixelWidth: 80 * TextWidget.GlobalPointSizeScaleRatio, allowNegatives: true, allowDecimals: true); + MHNumberEdit valueEdit = new MHNumberEdit(currentValue, pixelWidth: 80 * GuiWidget.DeviceScale, allowNegatives: true, allowDecimals: true); valueEdit.SelectAllOnFocus = true; valueEdit.TabIndex = currentTabIndex++; valueEdit.VAnchor = Agg.UI.VAnchor.ParentCenter; diff --git a/Library/LibraryDataView.cs b/Library/LibraryDataView.cs index 6ecb80be0..dc23ec11f 100644 --- a/Library/LibraryDataView.cs +++ b/Library/LibraryDataView.cs @@ -309,7 +309,7 @@ namespace MatterHackers.MatterControl.PrintLibrary protected GuiWidget GetThumbnailWidget(LibraryProvider parentProvider, PrintItemCollection printItemCollection, ImageBuffer imageBuffer) { - Vector2 expectedSize = new Vector2((int)(50 * TextWidget.GlobalPointSizeScaleRatio), (int)(50 * TextWidget.GlobalPointSizeScaleRatio)); + Vector2 expectedSize = new Vector2((int)(50 * GuiWidget.DeviceScale), (int)(50 * GuiWidget.DeviceScale)); if (imageBuffer.Width != expectedSize.x) { ImageBuffer scaledImageBuffer = new ImageBuffer((int)expectedSize.x, (int)expectedSize.y, 32, new BlenderBGRA()); diff --git a/Library/LibraryRowItemCollection.cs b/Library/LibraryRowItemCollection.cs index 61f08b635..8ac87dba9 100644 --- a/Library/LibraryRowItemCollection.cs +++ b/Library/LibraryRowItemCollection.cs @@ -191,7 +191,7 @@ namespace MatterHackers.MatterControl.PrintLibrary { //this.VAnchor = Agg.UI.VAnchor.FitToChildren; this.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - this.Height = 50 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 50 * GuiWidget.DeviceScale; this.Padding = new BorderDouble(0); this.Margin = new BorderDouble(6, 0, 6, 6); diff --git a/Library/LibraryRowItemPart.cs b/Library/LibraryRowItemPart.cs index 362814513..5792c4755 100644 --- a/Library/LibraryRowItemPart.cs +++ b/Library/LibraryRowItemPart.cs @@ -131,7 +131,7 @@ namespace MatterHackers.MatterControl.PrintLibrary ProgressControl processingProgressControl; private void AddLoadingProgressBar() { - processingProgressControl = new ProgressControl("Downloading...".Localize(), RGBA_Bytes.Black, ActiveTheme.Instance.SecondaryAccentColor, (int)(100 * TextWidget.GlobalPointSizeScaleRatio), 5, 0) + processingProgressControl = new ProgressControl("Downloading...".Localize(), RGBA_Bytes.Black, ActiveTheme.Instance.SecondaryAccentColor, (int)(100 * GuiWidget.DeviceScale), 5, 0) { PointSize = 8, }; diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index 0d6f7df9e..6cef17da7 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -252,8 +252,9 @@ namespace MatterHackers.MatterControl if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { - TextWidget.GlobalPointSizeScaleRatio = 1.3; + GuiWidget.DeviceScale = 1.3; } + //GuiWidget.DeviceScale = 2; using (new PerformanceTimer("Startup", "MainView")) { diff --git a/PartPreviewWindow/ColorGradientWidget.cs b/PartPreviewWindow/ColorGradientWidget.cs index 46ab53432..c38375d56 100644 --- a/PartPreviewWindow/ColorGradientWidget.cs +++ b/PartPreviewWindow/ColorGradientWidget.cs @@ -74,7 +74,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } Margin = new BorderDouble(5, 5, 200, 50); - Margin *= TextWidget.GlobalPointSizeScaleRatio; HAnchor |= Agg.UI.HAnchor.ParentLeft; VAnchor = Agg.UI.VAnchor.ParentTop; } diff --git a/PartPreviewWindow/View3D/SideBar/ScaleControls.cs b/PartPreviewWindow/View3D/SideBar/ScaleControls.cs index 674787853..0fc5d564e 100644 --- a/PartPreviewWindow/View3D/SideBar/ScaleControls.cs +++ b/PartPreviewWindow/View3D/SideBar/ScaleControls.cs @@ -89,7 +89,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow scaleRatioContainer.AddChild(new HorizontalSpacer()); - scaleRatioControl = new MHNumberEdit(1, pixelWidth: 50 * TextWidget.GlobalPointSizeScaleRatio, allowDecimals: true, increment: .05); + scaleRatioControl = new MHNumberEdit(1, pixelWidth: 50 * GuiWidget.DeviceScale, allowDecimals: true, increment: .05); scaleRatioControl.SelectAllOnFocus = true; scaleRatioControl.VAnchor = VAnchor.ParentCenter; scaleRatioContainer.AddChild(scaleRatioControl); diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 1b29299f4..fe6cbb52f 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -29,6 +29,9 @@ either expressed or implied, of the FreeBSD Project. //#define DoBooleanTest using MatterHackers.Agg; +using MatterHackers.Agg.Image; +using MatterHackers.Agg.ImageProcessing; +using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.Transform; using MatterHackers.Agg.UI; using MatterHackers.Agg.VertexSource; @@ -209,7 +212,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow addButton.Enabled = false; } - Button enterEdittingButton = textImageButtonFactory.Generate("Edit".Localize(), "icon_edit_32x32.png"); + ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_32x32.png"); + int iconSize = (int)(14 * GuiWidget.DeviceScale); + normalImage = ImageBuffer.CreateScaledImage(normalImage, iconSize, iconSize); + + if (!ActiveTheme.Instance.IsDarkTheme) + { + InvertLightness.DoInvertLightness(normalImage); + } + + Button enterEdittingButton = textImageButtonFactory.GenerateFromImages("Edit".Localize(), normalImage); enterEdittingButton.Name = "3D View Edit"; enterEdittingButton.Margin = new BorderDouble(right: 4); enterEdittingButton.Click += (sender, e) => @@ -537,14 +549,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { FlowLayoutWidget container = new FlowLayoutWidget() { - Margin = new BorderDouble(5, 0) * TextWidget.GlobalPointSizeScaleRatio, + Margin = new BorderDouble(5, 0), }; TextWidget snapGridLabel = new TextWidget("Snap Grid".Localize()) { TextColor = ActiveTheme.Instance.PrimaryTextColor, VAnchor = VAnchor.ParentCenter, - Margin = new BorderDouble(3, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio, + Margin = new BorderDouble(3, 0, 0, 0), }; container.AddChild(snapGridLabel); @@ -1228,7 +1240,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }); SplitButtonFactory splitButtonFactory = new SplitButtonFactory(); - splitButtonFactory.FixedHeight = 40 * TextWidget.GlobalPointSizeScaleRatio; + splitButtonFactory.FixedHeight = 40 * GuiWidget.DeviceScale; saveButtons = splitButtonFactory.Generate(buttonList, Direction.Up, imageName: "icon_save_32x32.png"); saveButtons.Visible = false; diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs index 1eb427a41..63c1a0f32 100644 --- a/PartPreviewWindow/ViewGcodeBasic.cs +++ b/PartPreviewWindow/ViewGcodeBasic.cs @@ -430,7 +430,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow buttonPanel.CloseAllChildren(); double oldWidth = textImageButtonFactory.FixedWidth; - textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedWidth = 44 * GuiWidget.DeviceScale; FlowLayoutWidget modelInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); modelInfoContainer.HAnchor = HAnchor.ParentLeftRight; @@ -525,7 +525,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private void AddLayerInfo(FlowLayoutWidget buttonPanel) { double oldWidth = textImageButtonFactory.FixedWidth; - textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedWidth = 44 * GuiWidget.DeviceScale; FlowLayoutWidget layerInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); layerInfoContainer.HAnchor = HAnchor.ParentLeftRight; @@ -551,7 +551,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow buttonPanel.CloseAllChildren(); double oldWidth = textImageButtonFactory.FixedWidth; - textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedWidth = 44 * GuiWidget.DeviceScale; FlowLayoutWidget layerInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); layerInfoContainer.HAnchor = HAnchor.ParentLeftRight; @@ -632,7 +632,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow CheckBox transparentExtrusion = new CheckBox(LocalizedString.Get("Transparent"), textColor: ActiveTheme.Instance.PrimaryTextColor) { Checked = gcodeViewWidget.TransparentExtrusion, - Margin = new BorderDouble(5, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio, + Margin = new BorderDouble(5, 0, 0, 0), HAnchor = HAnchor.ParentLeft, }; diff --git a/PrinterControls/ControlWidgets/AdjustmentControls.cs b/PrinterControls/ControlWidgets/AdjustmentControls.cs index 769bbb65d..418b5a593 100644 --- a/PrinterControls/ControlWidgets/AdjustmentControls.cs +++ b/PrinterControls/ControlWidgets/AdjustmentControls.cs @@ -66,16 +66,15 @@ namespace MatterHackers.MatterControl.PrinterControls { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); - tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio; + tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 0); tuningRatiosLayout.HAnchor = HAnchor.ParentLeftRight; - tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; + tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0); - double sliderWidth = 300; - double sliderThumbWidth = 10; + double sliderWidth = 300 * GuiWidget.DeviceScale; + double sliderThumbWidth = 10 * GuiWidget.DeviceScale; if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { - sliderWidth = 280; - sliderThumbWidth = 20; + sliderThumbWidth = 15 * GuiWidget.DeviceScale; } TextWidget subheader = new TextWidget("", pointSize: 4, textColor: ActiveTheme.Instance.PrimaryTextColor); @@ -85,14 +84,14 @@ namespace MatterHackers.MatterControl.PrinterControls { FlowLayoutWidget feedRateLeftToRight; { - feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio); + feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * GuiWidget.DeviceScale); feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0; feedRateLeftToRight = new FlowLayoutWidget(); feedRateLeftToRight.HAnchor = HAnchor.ParentLeftRight; feedRateDescription = new TextWidget(LocalizedString.Get("Speed Multiplier")); - feedRateDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio; + feedRateDescription.MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale; feedRateDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; feedRateDescription.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(feedRateDescription); @@ -129,15 +128,15 @@ namespace MatterHackers.MatterControl.PrinterControls TextWidget extrusionDescription; { - extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio); + extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * GuiWidget.DeviceScale); extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0; FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.HAnchor = HAnchor.ParentLeftRight; - leftToRight.Margin = new BorderDouble(top: 10) * TextWidget.GlobalPointSizeScaleRatio; + leftToRight.Margin = new BorderDouble(top: 10); extrusionDescription = new TextWidget(LocalizedString.Get("Extrusion Multiplier")); - extrusionDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio; + extrusionDescription.MinimumSize = new Vector2(140, 0) * GuiWidget.DeviceScale; extrusionDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; extrusionDescription.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(extrusionDescription); diff --git a/PrinterControls/ControlWidgets/ControlWidgetBase.cs b/PrinterControls/ControlWidgets/ControlWidgetBase.cs index 700eca6d0..d25561be5 100644 --- a/PrinterControls/ControlWidgets/ControlWidgetBase.cs +++ b/PrinterControls/ControlWidgets/ControlWidgetBase.cs @@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.PrinterControls protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(); - private readonly double TallButtonHeight = 25 * TextWidget.GlobalPointSizeScaleRatio; + private readonly double TallButtonHeight = 25 * GuiWidget.DeviceScale; public ControlWidgetBase() : base() @@ -63,8 +63,8 @@ namespace MatterHackers.MatterControl.PrinterControls protected static GuiWidget CreateSeparatorLine() { - GuiWidget topLine = new GuiWidget(10 * TextWidget.GlobalPointSizeScaleRatio, 1 * TextWidget.GlobalPointSizeScaleRatio); - topLine.Margin = new BorderDouble(0, 5) * TextWidget.GlobalPointSizeScaleRatio; + GuiWidget topLine = new GuiWidget(10 * GuiWidget.DeviceScale, 1 * GuiWidget.DeviceScale); + topLine.Margin = new BorderDouble(0, 5); topLine.HAnchor = Agg.UI.HAnchor.ParentLeftRight; topLine.BackgroundColor = ActiveTheme.Instance.PrimaryTextColor; return topLine; diff --git a/PrinterControls/ControlWidgets/FanControls.cs b/PrinterControls/ControlWidgets/FanControls.cs index 7aac1d2ef..72f492984 100644 --- a/PrinterControls/ControlWidgets/FanControls.cs +++ b/PrinterControls/ControlWidgets/FanControls.cs @@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.PrinterControls FlowLayoutWidget leftToRight = new FlowLayoutWidget(); FlowLayoutWidget fanControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); - fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; + fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0); { fanControlsLayout.AddChild(CreateFanControls()); } @@ -80,8 +80,8 @@ namespace MatterHackers.MatterControl.PrinterControls { this.textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent; - this.textImageButtonFactory.FixedWidth = 38 * TextWidget.GlobalPointSizeScaleRatio; - this.textImageButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; + this.textImageButtonFactory.FixedWidth = 38 * GuiWidget.DeviceScale; + this.textImageButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; this.textImageButtonFactory.fontSize = 10; this.textImageButtonFactory.borderWidth = 1; this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); @@ -109,7 +109,7 @@ namespace MatterHackers.MatterControl.PrinterControls PrinterConnectionAndCommunication.Instance.FanSpeedSet.RegisterEvent(FanSpeedChanged_Event, ref unregisterEvents); FlowLayoutWidget leftToRight = new FlowLayoutWidget(); - leftToRight.Padding = new BorderDouble(3, 0, 0, 5) * TextWidget.GlobalPointSizeScaleRatio; + leftToRight.Padding = new BorderDouble(3, 0, 0, 5); //Matt's test editing to add a on/off toggle switch bool fanActive = PrinterConnectionAndCommunication.Instance.FanSpeed0To255 != 0; diff --git a/PrinterControls/ControlWidgets/MacroControls.cs b/PrinterControls/ControlWidgets/MacroControls.cs index c9ba52380..432ea3ab2 100644 --- a/PrinterControls/ControlWidgets/MacroControls.cs +++ b/PrinterControls/ControlWidgets/MacroControls.cs @@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.PrinterControls private void SetDisplayAttributes() { this.textImageButtonFactory.normalFillColor = RGBA_Bytes.White; - this.textImageButtonFactory.FixedHeight = 24 * TextWidget.GlobalPointSizeScaleRatio; + this.textImageButtonFactory.FixedHeight = 24 * GuiWidget.DeviceScale; this.textImageButtonFactory.fontSize = 12; this.textImageButtonFactory.borderWidth = 1; this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); diff --git a/PrinterControls/ControlWidgets/MovementControls.cs b/PrinterControls/ControlWidgets/MovementControls.cs index bbf8a5d02..1aac0dda6 100644 --- a/PrinterControls/ControlWidgets/MovementControls.cs +++ b/PrinterControls/ControlWidgets/MovementControls.cs @@ -135,7 +135,7 @@ namespace MatterHackers.MatterControl.PrinterControls manualControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); manualControlsLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight; manualControlsLayout.VAnchor = Agg.UI.VAnchor.FitToChildren; - manualControlsLayout.Padding = new BorderDouble(3, 5, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; + manualControlsLayout.Padding = new BorderDouble(3, 5, 3, 0); { FlowLayoutWidget leftToRightContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); @@ -201,7 +201,7 @@ namespace MatterHackers.MatterControl.PrinterControls { FlowLayoutWidget homeButtonBar = new FlowLayoutWidget(); homeButtonBar.HAnchor = HAnchor.ParentLeftRight; - homeButtonBar.Margin = new BorderDouble(3, 0, 3, 6) * TextWidget.GlobalPointSizeScaleRatio; + homeButtonBar.Margin = new BorderDouble(3, 0, 3, 6); homeButtonBar.Padding = new BorderDouble(0); textImageButtonFactory.borderWidth = 1; @@ -210,30 +210,30 @@ namespace MatterHackers.MatterControl.PrinterControls ImageBuffer helpIconImage = StaticData.Instance.LoadIcon("icon_home_white_24x24.png"); ImageWidget homeIconImageWidget = new ImageWidget(helpIconImage); - homeIconImageWidget.Margin = new BorderDouble(0, 0, 6, 0) * TextWidget.GlobalPointSizeScaleRatio; - homeIconImageWidget.OriginRelativeParent += new Vector2(0, 2) * TextWidget.GlobalPointSizeScaleRatio; + homeIconImageWidget.Margin = new BorderDouble(0, 0, 6, 0); + homeIconImageWidget.OriginRelativeParent += new Vector2(0, 2) * GuiWidget.DeviceScale; RGBA_Bytes oldColor = this.textImageButtonFactory.normalFillColor; textImageButtonFactory.normalFillColor = new RGBA_Bytes(180, 180, 180); homeAllButton = textImageButtonFactory.Generate(LocalizedString.Get("ALL")); this.textImageButtonFactory.normalFillColor = oldColor; homeAllButton.ToolTipText = "Home X, Y and Z"; - homeAllButton.Margin = new BorderDouble(0, 0, 6, 0) * TextWidget.GlobalPointSizeScaleRatio; + homeAllButton.Margin = new BorderDouble(0, 0, 6, 0); homeAllButton.Click += new EventHandler(homeAll_Click); - textImageButtonFactory.FixedWidth = (int)homeAllButton.Width * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedWidth = (int)homeAllButton.Width * GuiWidget.DeviceScale; homeXButton = textImageButtonFactory.Generate("X", centerText: true); homeXButton.ToolTipText = "Home X"; - homeXButton.Margin = new BorderDouble(0, 0, 6, 0) * TextWidget.GlobalPointSizeScaleRatio; + homeXButton.Margin = new BorderDouble(0, 0, 6, 0); homeXButton.Click += new EventHandler(homeXButton_Click); homeYButton = textImageButtonFactory.Generate("Y", centerText: true); homeYButton.ToolTipText = "Home Y"; - homeYButton.Margin = new BorderDouble(0, 0, 6, 0) * TextWidget.GlobalPointSizeScaleRatio; + homeYButton.Margin = new BorderDouble(0, 0, 6, 0); homeYButton.Click += new EventHandler(homeYButton_Click); homeZButton = textImageButtonFactory.Generate("Z", centerText: true); homeZButton.ToolTipText = "Home Z"; - homeZButton.Margin = new BorderDouble(0, 0, 6, 0) * TextWidget.GlobalPointSizeScaleRatio; + homeZButton.Margin = new BorderDouble(0, 0, 6, 0); homeZButton.Click += new EventHandler(homeZButton_Click); textImageButtonFactory.normalFillColor = RGBA_Bytes.White; @@ -244,7 +244,7 @@ namespace MatterHackers.MatterControl.PrinterControls disableMotors.Click += new EventHandler(disableMotors_Click); this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; - GuiWidget spacerReleaseShow = new GuiWidget(10 * TextWidget.GlobalPointSizeScaleRatio, 0); + GuiWidget spacerReleaseShow = new GuiWidget(10 * GuiWidget.DeviceScale, 0); homeButtonBar.AddChild(homeIconImageWidget); homeButtonBar.AddChild(homeAllButton); @@ -289,7 +289,7 @@ namespace MatterHackers.MatterControl.PrinterControls { FlowLayoutWidget hwDestinationBar = new FlowLayoutWidget(); hwDestinationBar.HAnchor = HAnchor.ParentLeftRight; - hwDestinationBar.Margin = new BorderDouble(3, 0, 3, 6) * TextWidget.GlobalPointSizeScaleRatio; + hwDestinationBar.Margin = new BorderDouble(3, 0, 3, 6); hwDestinationBar.Padding = new BorderDouble(0); TextWidget xPosition = new TextWidget("X: 0.0 ", pointSize: 12, textColor: ActiveTheme.Instance.PrimaryTextColor); diff --git a/PrinterControls/ControlWidgets/PowerControls.cs b/PrinterControls/ControlWidgets/PowerControls.cs index d2e6ef2b5..d4983d6de 100644 --- a/PrinterControls/ControlWidgets/PowerControls.cs +++ b/PrinterControls/ControlWidgets/PowerControls.cs @@ -79,7 +79,7 @@ namespace MatterHackers.MatterControl.PrinterControls }; FlowLayoutWidget paddingContainer = new FlowLayoutWidget(); - paddingContainer.Padding = new BorderDouble(3, 5, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; + paddingContainer.Padding = new BorderDouble(3, 5, 3, 0); { paddingContainer.AddChild(atxPowertoggleSwitch); } @@ -92,8 +92,8 @@ namespace MatterHackers.MatterControl.PrinterControls { this.textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent; - this.textImageButtonFactory.FixedWidth = 38 * TextWidget.GlobalPointSizeScaleRatio; - this.textImageButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; + this.textImageButtonFactory.FixedWidth = 38 * GuiWidget.DeviceScale; + this.textImageButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; this.textImageButtonFactory.fontSize = 10; this.textImageButtonFactory.borderWidth = 1; this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); diff --git a/PrinterControls/EditLevelingSettingsWindow.cs b/PrinterControls/EditLevelingSettingsWindow.cs index cfb0d7f86..5f9c45631 100644 --- a/PrinterControls/EditLevelingSettingsWindow.cs +++ b/PrinterControls/EditLevelingSettingsWindow.cs @@ -85,7 +85,7 @@ namespace MatterHackers.MatterControl BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; double oldHeight = textImageButtonFactory.FixedHeight; - textImageButtonFactory.FixedHeight = 30 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedHeight = 30 * GuiWidget.DeviceScale; // put in the movement edit controls PrintLevelingData levelingData = ActiveSliceSettings.Instance.GetPrintLevelingData(); diff --git a/PrinterControls/EditManualMovementSpeedsWindow.cs b/PrinterControls/EditManualMovementSpeedsWindow.cs index cc2887898..ed7497a21 100644 --- a/PrinterControls/EditManualMovementSpeedsWindow.cs +++ b/PrinterControls/EditManualMovementSpeedsWindow.cs @@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; double oldHeight = textImageButtonFactory.FixedHeight; - textImageButtonFactory.FixedHeight = 30 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedHeight = 30 * GuiWidget.DeviceScale; TextWidget tempTypeLabel = new TextWidget(windowTitle, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10); tempTypeLabel.Margin = new BorderDouble(3); diff --git a/PrinterControls/EditTemperaturePresetsWindow.cs b/PrinterControls/EditTemperaturePresetsWindow.cs index cfc39548f..8718668ff 100644 --- a/PrinterControls/EditTemperaturePresetsWindow.cs +++ b/PrinterControls/EditTemperaturePresetsWindow.cs @@ -88,7 +88,7 @@ namespace MatterHackers.MatterControl BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; double oldHeight = textImageButtonFactory.FixedHeight; - textImageButtonFactory.FixedHeight = 30 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedHeight = 30 * GuiWidget.DeviceScale; TextWidget tempTypeLabel = new TextWidget(windowTitle, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10); tempTypeLabel.Margin = new BorderDouble(3); diff --git a/PrinterControls/PrinterConnections/ConnectionWindow.cs b/PrinterControls/PrinterConnections/ConnectionWindow.cs index 790bedc5e..8a2b3483b 100644 --- a/PrinterControls/PrinterConnections/ConnectionWindow.cs +++ b/PrinterControls/PrinterConnections/ConnectionWindow.cs @@ -16,7 +16,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections private bool editMode = false; public ConnectionWizard() - : base(350 * TextWidget.GlobalPointSizeScaleRatio, 500 * TextWidget.GlobalPointSizeScaleRatio) + : base(350 * GuiWidget.DeviceScale, 500 * GuiWidget.DeviceScale) { AlwaysOnTopOfMain = true; string connectToPrinterTitle = LocalizedString.Get("MatterControl"); @@ -29,7 +29,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; this.ShowAsSystemWindow(); - MinimumSize = new Vector2(350 * TextWidget.GlobalPointSizeScaleRatio, 400 * TextWidget.GlobalPointSizeScaleRatio); + MinimumSize = new Vector2(350 * GuiWidget.DeviceScale, 400 * GuiWidget.DeviceScale); } private static ConnectionWizard connectionWindow = null; diff --git a/PrinterControls/TemperatureIndicator.cs b/PrinterControls/TemperatureIndicator.cs index 5be1bcf09..94ebd086a 100644 --- a/PrinterControls/TemperatureIndicator.cs +++ b/PrinterControls/TemperatureIndicator.cs @@ -80,8 +80,8 @@ namespace MatterHackers.MatterControl { this.textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent; - this.textImageButtonFactory.FixedWidth = 38 * TextWidget.GlobalPointSizeScaleRatio; - this.textImageButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; + this.textImageButtonFactory.FixedWidth = 38 * GuiWidget.DeviceScale; + this.textImageButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; this.textImageButtonFactory.fontSize = 10; this.textImageButtonFactory.borderWidth = 1; this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); @@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); - controlRow.Margin = new BorderDouble(top: 2) * TextWidget.GlobalPointSizeScaleRatio; + controlRow.Margin = new BorderDouble(top: 2); controlRow.HAnchor |= HAnchor.ParentLeftRight; { // put in the temperature slider and preset buttons @@ -155,14 +155,14 @@ namespace MatterHackers.MatterControl { FlowLayoutWidget temperatureIndicator = new FlowLayoutWidget(); temperatureIndicator.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - temperatureIndicator.Margin = new BorderDouble(bottom: 0) * TextWidget.GlobalPointSizeScaleRatio; - temperatureIndicator.Padding = new BorderDouble(0, 3) * TextWidget.GlobalPointSizeScaleRatio; + temperatureIndicator.Margin = new BorderDouble(bottom: 0); + temperatureIndicator.Padding = new BorderDouble(0, 3); // put in the actual temperature controls { FlowLayoutWidget extruderActualIndicator = new FlowLayoutWidget(Agg.UI.FlowDirection.LeftToRight); - extruderActualIndicator.Margin = new BorderDouble(3, 0) * TextWidget.GlobalPointSizeScaleRatio; + extruderActualIndicator.Margin = new BorderDouble(3, 0); string extruderActualLabelTxt = LocalizedString.Get("Actual"); string extruderActualLabelTxtFull = string.Format("{0}: ", extruderActualLabelTxt); TextWidget extruderActualLabel = new TextWidget(extruderActualLabelTxtFull, pointSize: 10); @@ -181,7 +181,7 @@ namespace MatterHackers.MatterControl string extruderAboutLabelTxtFull = string.Format("{0}: ", extruderAboutLabelTxt); TextWidget extruderTargetLabel = new TextWidget(extruderAboutLabelTxtFull, pointSize: 10); - extruderTargetLabel.Margin = new BorderDouble(left: 10) * TextWidget.GlobalPointSizeScaleRatio; + extruderTargetLabel.Margin = new BorderDouble(left: 10); extruderTargetLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; extruderTargetLabel.VAnchor = VAnchor.ParentCenter; @@ -221,13 +221,13 @@ namespace MatterHackers.MatterControl private FlowLayoutWidget GetPresetsContainer() { FlowLayoutWidget presetsContainer = new FlowLayoutWidget(); - presetsContainer.Margin = new BorderDouble(3, 0) * TextWidget.GlobalPointSizeScaleRatio; + presetsContainer.Margin = new BorderDouble(3, 0); string presetsLabelTxt = LocalizedString.Get("Presets"); string presetsLabelTxtFull = string.Format("{0}: ", presetsLabelTxt); TextWidget presetsLabel = new TextWidget(presetsLabelTxtFull, pointSize: 10); - presetsLabel.Margin = new BorderDouble(right: 5) * TextWidget.GlobalPointSizeScaleRatio; + presetsLabel.Margin = new BorderDouble(right: 5); presetsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor; presetsLabel.VAnchor = VAnchor.ParentCenter; //presetsContainer.AddChild(presetsLabel); @@ -237,7 +237,7 @@ namespace MatterHackers.MatterControl foreach (KeyValuePair keyValue in labels) { Button tempButton = textImageButtonFactory.Generate(keyValue.Value); - tempButton.Margin = new BorderDouble(right: 5) * TextWidget.GlobalPointSizeScaleRatio; + tempButton.Margin = new BorderDouble(right: 5); presetsContainer.AddChild(tempButton); // We push the value into a temp double so that the function will not point to a shared keyValue instance. @@ -252,10 +252,10 @@ namespace MatterHackers.MatterControl }; } - this.textImageButtonFactory.FixedWidth = 76 * TextWidget.GlobalPointSizeScaleRatio; + this.textImageButtonFactory.FixedWidth = 76 * GuiWidget.DeviceScale; { Button tempButton = textImageButtonFactory.Generate("Preheat".Localize().ToUpper()); - tempButton.Margin = new BorderDouble(right: 5) * TextWidget.GlobalPointSizeScaleRatio; + tempButton.Margin = new BorderDouble(right: 5); presetsContainer.AddChild(tempButton); // We push the value into a temp double so that the function will not point to a shared keyValue instance. @@ -268,7 +268,7 @@ namespace MatterHackers.MatterControl }); }; } - this.textImageButtonFactory.FixedWidth = 38 * TextWidget.GlobalPointSizeScaleRatio; + this.textImageButtonFactory.FixedWidth = 38 * GuiWidget.DeviceScale; return presetsContainer; } @@ -291,9 +291,9 @@ namespace MatterHackers.MatterControl private FlowLayoutWidget GetHelpTextWidget() { FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom); - double textRegionWidth = 260 * TextWidget.GlobalPointSizeScaleRatio; - allText.Margin = new BorderDouble(3) * TextWidget.GlobalPointSizeScaleRatio; - allText.Padding = new BorderDouble(3) * TextWidget.GlobalPointSizeScaleRatio; + double textRegionWidth = 260 * GuiWidget.DeviceScale; + allText.Margin = new BorderDouble(3); + allText.Padding = new BorderDouble(3); allText.HAnchor = HAnchor.ParentLeftRight; allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; @@ -339,9 +339,9 @@ namespace MatterHackers.MatterControl { GuiWidget sliderLabels = new GuiWidget(); sliderLabels.HAnchor = HAnchor.ParentLeftRight; - sliderLabels.Height = 20 * TextWidget.GlobalPointSizeScaleRatio; + sliderLabels.Height = 20 * GuiWidget.DeviceScale; { - double buttonOffset = -10 * TextWidget.GlobalPointSizeScaleRatio; + double buttonOffset = -10 * GuiWidget.DeviceScale; var offPosition = buttonOffset; tempOffButton = textImageButtonFactory.Generate("Off"); diff --git a/PrinterControls/XYZJogControls.cs b/PrinterControls/XYZJogControls.cs index 6979c5ee0..0cfcc9874 100644 --- a/PrinterControls/XYZJogControls.cs +++ b/PrinterControls/XYZJogControls.cs @@ -212,8 +212,8 @@ namespace MatterHackers.MatterControl { TextImageButtonFactory buttonFactory = new TextImageButtonFactory(); - buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; - buttonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio; + buttonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; + buttonFactory.FixedWidth = 30 * GuiWidget.DeviceScale; buttonFactory.fontSize = 8; buttonFactory.Margin = new BorderDouble(0); buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; @@ -373,8 +373,8 @@ namespace MatterHackers.MatterControl private FlowLayoutWidget GetHotkeyControlContainer() { TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory(); - hotKeyButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; - hotKeyButtonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio; + hotKeyButtonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; + hotKeyButtonFactory.FixedWidth = 30 * GuiWidget.DeviceScale; hotKeyButtonFactory.fontSize = 8; hotKeyButtonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; @@ -503,8 +503,8 @@ namespace MatterHackers.MatterControl { TextImageButtonFactory buttonFactory = new TextImageButtonFactory(); - buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; - buttonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio; + buttonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; + buttonFactory.FixedWidth = 30 * GuiWidget.DeviceScale; buttonFactory.fontSize = 8; buttonFactory.Margin = new BorderDouble(0); buttonFactory.checkedBorderColor = ActiveTheme.Instance.PrimaryTextColor; @@ -698,13 +698,13 @@ namespace MatterHackers.MatterControl if (levelingButtons) { - this.Height = 45 * TextWidget.GlobalPointSizeScaleRatio; - this.Width = 90 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 45 * GuiWidget.DeviceScale; + this.Width = 90 * GuiWidget.DeviceScale; } else { - this.Height = 40 * TextWidget.GlobalPointSizeScaleRatio; - this.Width = 40 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 40 * GuiWidget.DeviceScale; + this.Width = 40 * GuiWidget.DeviceScale; } } diff --git a/Queue/QueueDataWidget.cs b/Queue/QueueDataWidget.cs index e22eefded..dea41882a 100644 --- a/Queue/QueueDataWidget.cs +++ b/Queue/QueueDataWidget.cs @@ -103,7 +103,6 @@ namespace MatterHackers.MatterControl.PrintQueue editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editButtonFactory.borderWidth = 0; editButtonFactory.Margin = new BorderDouble(10, 0); - editButtonFactory.Margin *= TextWidget.GlobalPointSizeScaleRatio; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { @@ -150,7 +149,7 @@ namespace MatterHackers.MatterControl.PrintQueue { moreMenu = new DropDownMenu("More".Localize() + "... "); moreMenu.NormalColor = new RGBA_Bytes(); - moreMenu.BorderWidth = 1; + moreMenu.BorderWidth = (int)(1 * GuiWidget.DeviceScale + .5); moreMenu.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor,100); moreMenu.MenuAsWideAsItems = false; moreMenu.VAnchor = VAnchor.ParentBottomTop; diff --git a/SlicerConfiguration/SettingsControlBar.cs b/SlicerConfiguration/SettingsControlBar.cs index 4bb25a174..4104d50d1 100644 --- a/SlicerConfiguration/SettingsControlBar.cs +++ b/SlicerConfiguration/SettingsControlBar.cs @@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.AddChild(new PresetSelectorWidget("Material".Localize(), RGBA_Bytes.Orange, "material", 0)); } - this.Height = 60 * TextWidget.GlobalPointSizeScaleRatio; + this.Height = 60 * GuiWidget.DeviceScale; } } diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index cc9bfd68f..bb673063c 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration textImageButtonFactory = new TextImageButtonFactory(); textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent; - textImageButtonFactory.FixedHeight = 15 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedHeight = 15 * GuiWidget.DeviceScale; textImageButtonFactory.fontSize = 8; textImageButtonFactory.borderWidth = 1; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); @@ -117,8 +117,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.textImageButtonFactory.normalTextColor = ActiveTheme.Instance.SecondaryTextColor; this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; - int rightContentWidth = (int)(280 * TextWidget.GlobalPointSizeScaleRatio + .5); - buttonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio; + int rightContentWidth = (int)(280 * GuiWidget.DeviceScale + .5); + buttonFactory.FixedHeight = 20 * GuiWidget.DeviceScale; buttonFactory.fontSize = 10; buttonFactory.normalFillColor = RGBA_Bytes.White; buttonFactory.normalTextColor = RGBA_Bytes.DarkGray; @@ -487,7 +487,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom); allText.HAnchor = HAnchor.ParentLeftRight; - double textRegionWidth = 380 * TextWidget.GlobalPointSizeScaleRatio; + double textRegionWidth = 380 * GuiWidget.DeviceScale; allText.Margin = new BorderDouble(0); allText.Padding = new BorderDouble(5); allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; @@ -622,11 +622,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration var dataArea = new FlowLayoutWidget(); GuiWidget unitsArea = new GuiWidget(HAnchor.AbsolutePosition, VAnchor.FitToChildren | VAnchor.ParentCenter) { - Width = 50 * TextWidget.GlobalPointSizeScaleRatio, + Width = 50 * GuiWidget.DeviceScale, }; GuiWidget restoreArea = new GuiWidget(HAnchor.AbsolutePosition, VAnchor.FitToChildren | VAnchor.ParentCenter) { - Width = 30 * TextWidget.GlobalPointSizeScaleRatio, + Width = 30 * GuiWidget.DeviceScale, }; var settingsRow2 = new SettingsRow() { @@ -649,10 +649,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } else { - int intEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5); - int doubleEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5); - int vectorXYEditWidth = (int)(60 * TextWidget.GlobalPointSizeScaleRatio + .5); - int multiLineEditHeight = (int)(120 * TextWidget.GlobalPointSizeScaleRatio + .5); + int intEditWidth = (int)(60 * GuiWidget.DeviceScale + .5); + int doubleEditWidth = (int)(60 * GuiWidget.DeviceScale + .5); + int vectorXYEditWidth = (int)(60 * GuiWidget.DeviceScale + .5); + int multiLineEditHeight = (int)(120 * GuiWidget.DeviceScale + .5); if (settingData.DataEditType != OrganizerSettingsData.DataEditTypes.MULTI_LINE_TEXT) { @@ -1165,7 +1165,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { ToolTipText = settingData.HelpText, SelectAllOnFocus = true, - Margin = new BorderDouble(20 * TextWidget.GlobalPointSizeScaleRatio, 0, 0, 0), + Margin = new BorderDouble(20, 0, 0, 0), }; xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => @@ -1233,7 +1233,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { ToolTipText = settingData.HelpText, SelectAllOnFocus = true, - Margin = new BorderDouble(20 * TextWidget.GlobalPointSizeScaleRatio, 0, 0, 0), + Margin = new BorderDouble(20, 0, 0, 0), }; xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => @@ -1377,7 +1377,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration static ImageBuffer EnsureRestoreButtonImages() { - int size = (int)(16 * TextWidget.GlobalPointSizeScaleRatio); + int size = (int)(16 * GuiWidget.DeviceScale); restoreNormal = ColorCirle(size, new RGBA_Bytes(128, 128, 128)); if (OsInformation.OperatingSystem == OSType.Android) @@ -1396,8 +1396,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration Graphics2D normalGraphics = imageBuffer.NewGraphics2D(); Vector2 center = new Vector2(size / 2.0, size / 2.0); normalGraphics.Circle(center, size / 2.0, color); - normalGraphics.Line(center + new Vector2(-size / 4.0, -size / 4.0), center + new Vector2(size / 4.0, size / 4.0), RGBA_Bytes.White, 2 * TextWidget.GlobalPointSizeScaleRatio); - normalGraphics.Line(center + new Vector2(-size / 4.0, size / 4.0), center + new Vector2(size / 4.0, -size / 4.0), RGBA_Bytes.White, 2 * TextWidget.GlobalPointSizeScaleRatio); + normalGraphics.Line(center + new Vector2(-size / 4.0, -size / 4.0), center + new Vector2(size / 4.0, size / 4.0), RGBA_Bytes.White, 2 * GuiWidget.DeviceScale); + normalGraphics.Line(center + new Vector2(-size / 4.0, size / 4.0), center + new Vector2(size / 4.0, -size / 4.0), RGBA_Bytes.White, 2 * GuiWidget.DeviceScale); return imageBuffer; } diff --git a/StaticData/Icons/PrintStatusControls/cloud-24x24.png b/StaticData/Icons/PrintStatusControls/cloud-24x24.png deleted file mode 100644 index b40b7f72f..000000000 Binary files a/StaticData/Icons/PrintStatusControls/cloud-24x24.png and /dev/null differ diff --git a/StaticData/Icons/PrintStatusControls/leveling-16x16.png b/StaticData/Icons/PrintStatusControls/leveling-16x16.png deleted file mode 100644 index 2ff387255..000000000 Binary files a/StaticData/Icons/PrintStatusControls/leveling-16x16.png and /dev/null differ diff --git a/StaticData/Icons/PrintStatusControls/camera-24x24.png b/StaticData/Icons/camera-24x24.png old mode 100755 new mode 100644 similarity index 100% rename from StaticData/Icons/PrintStatusControls/camera-24x24.png rename to StaticData/Icons/camera-24x24.png diff --git a/StaticData/Icons/icon_edit_32x32.png b/StaticData/Icons/icon_edit_32x32.png index fec4a8a37..e705bcbec 100644 Binary files a/StaticData/Icons/icon_edit_32x32.png and b/StaticData/Icons/icon_edit_32x32.png differ diff --git a/StaticData/Icons/icon_edit_white.png b/StaticData/Icons/icon_edit_white.png deleted file mode 100644 index b55508ef2..000000000 Binary files a/StaticData/Icons/icon_edit_white.png and /dev/null differ diff --git a/StaticData/Icons/icon_edit_white_32x32.png b/StaticData/Icons/icon_edit_white_32x32.png deleted file mode 100644 index e705bcbec..000000000 Binary files a/StaticData/Icons/icon_edit_white_32x32.png and /dev/null differ diff --git a/StaticData/Icons/icon_pop_out_32x32.png b/StaticData/Icons/icon_pop_out_32x32.png index a0c44c3b9..991bf5430 100644 Binary files a/StaticData/Icons/icon_pop_out_32x32.png and b/StaticData/Icons/icon_pop_out_32x32.png differ diff --git a/StaticData/Icons/PrintStatusControls/leveling-24x24.png b/StaticData/Icons/leveling_32x32.png similarity index 100% rename from StaticData/Icons/PrintStatusControls/leveling-24x24.png rename to StaticData/Icons/leveling_32x32.png diff --git a/StaticData/Icons/PrintStatusControls/notify-24x24.png b/StaticData/Icons/notify-24x24.png similarity index 100% rename from StaticData/Icons/PrintStatusControls/notify-24x24.png rename to StaticData/Icons/notify-24x24.png diff --git a/StaticData/Icons/PrintStatusControls/notify-hover.png b/StaticData/Icons/notify-hover.png similarity index 100% rename from StaticData/Icons/PrintStatusControls/notify-hover.png rename to StaticData/Icons/notify-hover.png diff --git a/StaticData/Icons/PrintStatusControls/notify.png b/StaticData/Icons/notify.png similarity index 100% rename from StaticData/Icons/PrintStatusControls/notify.png rename to StaticData/Icons/notify.png diff --git a/StaticData/Icons/PrintStatusControls/terminal-24x24.png b/StaticData/Icons/terminal-24x24.png similarity index 100% rename from StaticData/Icons/PrintStatusControls/terminal-24x24.png rename to StaticData/Icons/terminal-24x24.png diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 328d6a0a3..772625e61 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 328d6a0a31e56d17b10ae55f48bf1365f2ff37ab +Subproject commit 772625e6147a994e8f6ed342377bbdbe958943d7 diff --git a/TextCreator/View3DTextCreator.cs b/TextCreator/View3DTextCreator.cs index 80869602c..bf427af6f 100644 --- a/TextCreator/View3DTextCreator.cs +++ b/TextCreator/View3DTextCreator.cs @@ -795,7 +795,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator private void AddLetterControls(FlowLayoutWidget buttonPanel) { - textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio; + textImageButtonFactory.FixedWidth = 44 * GuiWidget.DeviceScale; FlowLayoutWidget degreesContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); degreesContainer.HAnchor = HAnchor.ParentLeftRight;