diff --git a/BrailleBuilder/View3DBrailleBuilder.cs b/BrailleBuilder/View3DBrailleBuilder.cs index feb73125a..40bb3ae5a 100644 --- a/BrailleBuilder/View3DBrailleBuilder.cs +++ b/BrailleBuilder/View3DBrailleBuilder.cs @@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project. using ClipperLib; using MatterHackers.Agg; using MatterHackers.Agg.Font; +using MatterHackers.Agg.ImageProcessing; using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; using MatterHackers.Agg.VertexSource; @@ -594,7 +595,7 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder // put in the word editing menu { - CheckBox expandWordOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Word Edit".Localize(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + CheckBox expandWordOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Word Edit".Localize(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandWordOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandWordOptions); diff --git a/ControlElements/TextImageButtonFactory.cs b/ControlElements/TextImageButtonFactory.cs index fd7d1badc..eb9c15cf1 100644 --- a/ControlElements/TextImageButtonFactory.cs +++ b/ControlElements/TextImageButtonFactory.cs @@ -263,6 +263,23 @@ namespace MatterHackers.MatterControl return groupLableAndEditControl; } + public CheckBox GenerateCheckBoxButton(string label, ImageBuffer normalImageName = null, ImageBuffer normalToPressedImageName = null, ImageBuffer pressedImageName = null, ImageBuffer pressedToNormalImageName = null, string pressedLabel = null) + { + CheckBoxViewStates checkBoxButtonViewWidget = getCheckBoxButtonView(label, normalImageName, normalToPressedImageName, pressedImageName, pressedToNormalImageName, pressedLabel); + + //Override the width if requested + if (this.FixedWidth != 0) + { + checkBoxButtonViewWidget.Width = this.FixedWidth; + } + + CheckBox textImageCheckBoxButton = new CheckBox(0, 0, checkBoxButtonViewWidget); + textImageCheckBoxButton.Margin = new BorderDouble(0); + textImageCheckBoxButton.Padding = new BorderDouble(0); + + return textImageCheckBoxButton; + } + public CheckBox GenerateCheckBoxButton(string label, string normalImageName = null, string normalToPressedImageName = null, string pressedImageName = null, string pressedToNormalImageName = null, string pressedLabel = null) { CheckBoxViewStates checkBoxButtonViewWidget = getCheckBoxButtonView(label, normalImageName, normalToPressedImageName, pressedImageName, pressedToNormalImageName, pressedLabel); @@ -497,6 +514,74 @@ namespace MatterHackers.MatterControl return checkBoxButtonViewWidget; } + private CheckBoxViewStates getCheckBoxButtonView(string label, ImageBuffer normalImage = null, + ImageBuffer pressedImage = null, + ImageBuffer normalToPressedImage = null, + ImageBuffer pressedToNormalImage = null, + string pressedLabel = null) + { + + string pressedText = pressedLabel; + + if (pressedLabel == null) + { + pressedText = label; + } + + if (normalImage != null) + { + if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) + { + normalImage.InvertLightness(); + } + } + + if (pressedImage != null) + { + if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) + { + pressedImage.InvertLightness(); + } + } + + if (normalToPressedImage != null) + { + if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) + { + normalToPressedImage.InvertLightness(); + } + } + + if (pressedToNormalImage != null) + { + if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) + { + pressedToNormalImage.InvertLightness(); + } + } + + if (invertImageLocation) + { + flowDirection = FlowDirection.RightToLeft; + } + else + { + flowDirection = FlowDirection.LeftToRight; + } + + //Create the multi-state button view + GuiWidget normal = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); + GuiWidget normalHover = new TextImageWidget(label, hoverFillColor, normalBorderColor, hoverTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); + GuiWidget switchNormalToPressed = new TextImageWidget(label, pressedFillColor, normalBorderColor, pressedTextColor, borderWidth, Margin, normalToPressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); + GuiWidget pressed = new TextImageWidget(pressedText, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); + GuiWidget pressedHover = new TextImageWidget(label, hoverFillColor, pressedBorderColor, hoverTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); + GuiWidget switchPressedToNormal = new TextImageWidget(label, normalFillColor, pressedBorderColor, normalTextColor, borderWidth, Margin, pressedToNormalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); + GuiWidget disabled = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight); + + CheckBoxViewStates checkBoxButtonViewWidget = new CheckBoxViewStates(normal, normalHover, switchNormalToPressed, pressed, pressedHover, switchPressedToNormal, disabled); + return checkBoxButtonViewWidget; + } + public RadioButton GenerateRadioButton(string label, ImageBuffer iconImage) { if (iconImage != null ) diff --git a/PartPreviewWindow/View3D/SideBar/MirrorControls.cs b/PartPreviewWindow/View3D/SideBar/MirrorControls.cs index 4f420d6b3..bbfd98fb7 100644 --- a/PartPreviewWindow/View3D/SideBar/MirrorControls.cs +++ b/PartPreviewWindow/View3D/SideBar/MirrorControls.cs @@ -29,6 +29,8 @@ either expressed or implied, of the FreeBSD Project. //#define DoBooleanTest using MatterHackers.Agg; +using MatterHackers.Agg.ImageProcessing; +using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.VectorMath; @@ -50,7 +52,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // put in the mirror options { - expandMirrorOptions = view3DWidget.ExpandMenuOptionFactory.GenerateCheckBoxButton("Mirror".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + expandMirrorOptions = view3DWidget.ExpandMenuOptionFactory.GenerateCheckBoxButton("Mirror".Localize().ToUpper(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32,32).InvertLightness()); expandMirrorOptions.Margin = new BorderDouble(bottom: 2); this.AddChild(expandMirrorOptions); diff --git a/PartPreviewWindow/View3D/SideBar/ScaleControls.cs b/PartPreviewWindow/View3D/SideBar/ScaleControls.cs index 0fc5d564e..3acb6239f 100644 --- a/PartPreviewWindow/View3D/SideBar/ScaleControls.cs +++ b/PartPreviewWindow/View3D/SideBar/ScaleControls.cs @@ -29,6 +29,8 @@ either expressed or implied, of the FreeBSD Project. //#define DoBooleanTest using MatterHackers.Agg; +using MatterHackers.Agg.ImageProcessing; +using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.CustomWidgets; @@ -53,7 +55,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { this.view3DWidget = view3DWidget; { - expandScaleOptions = view3DWidget.ExpandMenuOptionFactory.GenerateCheckBoxButton("Scale".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + expandScaleOptions = view3DWidget.ExpandMenuOptionFactory.GenerateCheckBoxButton("Scale".Localize().ToUpper(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandScaleOptions.Margin = new BorderDouble(bottom: 2); this.AddChild(expandScaleOptions); diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 7aaed7be4..e51ad692b 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -1446,7 +1446,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { BorderDouble buttonMargin = new BorderDouble(top: 3); - expandRotateOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Rotate".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + expandRotateOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Rotate".Localize().ToUpper(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandRotateOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandRotateOptions); expandRotateOptions.CheckedStateChanged += expandRotateOptions_CheckedStateChanged; @@ -1469,7 +1469,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // put in the material options int numberOfExtruders = ActiveSliceSettings.Instance.ExtruderCount(); - expandMaterialOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Materials".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + expandMaterialOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Materials".Localize().ToUpper(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandMaterialOptions.Margin = new BorderDouble(bottom: 2); expandMaterialOptions.CheckedStateChanged += expandMaterialOptions_CheckedStateChanged; @@ -1487,7 +1487,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // put in the view options { - expandViewOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Display".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + expandViewOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Display".Localize().ToUpper(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandViewOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandViewOptions); expandViewOptions.CheckedStateChanged += expandViewOptions_CheckedStateChanged; diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs index 63c1a0f32..f0b8f222d 100644 --- a/PartPreviewWindow/ViewGcodeBasic.cs +++ b/PartPreviewWindow/ViewGcodeBasic.cs @@ -28,6 +28,8 @@ either expressed or implied, of the FreeBSD Project. */ using MatterHackers.Agg; +using MatterHackers.Agg.ImageProcessing; +using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; using MatterHackers.GCodeVisualizer; using MatterHackers.Localizations; @@ -385,7 +387,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow buttonRightPanel.Width = 200; { string label = "Model".Localize().ToUpper(); - expandModelOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton(label, "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + expandModelOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton(label, StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandModelOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandModelOptions); expandModelOptions.Checked = true; @@ -395,7 +397,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow //modelOptionsContainer.Visible = false; buttonRightPanel.AddChild(modelOptionsContainer); - expandDisplayOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Display".Localize().ToUpper(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + expandDisplayOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Display".Localize().ToUpper(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandDisplayOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandDisplayOptions); expandDisplayOptions.Checked = false; diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index ceac9645c..d6321c373 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -4828,3 +4828,18 @@ Translated:Edit Preset: English:Preset Name: Translated:Preset Name: +English:This is the name of your printer that will be displayed in the choose printer menu. +Translated:This is the name of your printer that will be displayed in the choose printer menu. + +English:Local Computer +Translated:Local Computer + +English:Connection +Translated:Connection + +English:Interface +Translated:Interface + +English:Behavior +Translated:Behavior + diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 83a0a763f..1dbb9057f 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 83a0a763f6b254c1024ef67a8f5e7cec45f68db8 +Subproject commit 1dbb9057fe8e38b64d31c25c39e16f11e249f456 diff --git a/TextCreator/View3DTextCreator.cs b/TextCreator/View3DTextCreator.cs index bf427af6f..662f5afee 100644 --- a/TextCreator/View3DTextCreator.cs +++ b/TextCreator/View3DTextCreator.cs @@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project. using MatterHackers.Agg; using MatterHackers.Agg.Font; +using MatterHackers.Agg.ImageProcessing; using MatterHackers.Agg.PlatformAbstract; using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; @@ -607,7 +608,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator // put in the word editing menu { - CheckBox expandWordOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Word Edit".Localize(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + CheckBox expandWordOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Word Edit".Localize(), StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandWordOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandWordOptions); @@ -680,7 +681,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator // put in the letter editing menu { - CheckBox expandLetterOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Letter", "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); + CheckBox expandLetterOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Letter", StaticData.Instance.LoadIcon("icon_arrow_right_no_border_32x32.png", 32, 32).InvertLightness()); expandLetterOptions.Margin = new BorderDouble(bottom: 2); //buttonRightPanel.AddChild(expandLetterOptions);