Adjust ViewControls colors to account for new potentially dark bgcolor
This commit is contained in:
parent
7c4ff5569b
commit
dc0c285156
3 changed files with 52 additions and 97 deletions
|
|
@ -27,31 +27,20 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using System.IO;
|
||||
using MatterHackers.Localizations;
|
||||
using System;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using System.IO;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public class ViewControlsBase : FlowLayoutWidget
|
||||
{
|
||||
protected int buttonHeight;
|
||||
|
||||
public ViewControlsBase()
|
||||
{
|
||||
if (UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
buttonHeight = 40;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonHeight = 20;
|
||||
}
|
||||
}
|
||||
protected int buttonHeight = UserSettings.Instance.IsTouchScreen ? 40 : 20;
|
||||
protected const int overlayAlpha = 50;
|
||||
}
|
||||
|
||||
public class ViewControls2D : ViewControlsBase
|
||||
|
|
@ -63,27 +52,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public event EventHandler ResetView;
|
||||
|
||||
public ViewControls2D()
|
||||
public ViewControls2D(TextImageButtonFactory buttonFactory)
|
||||
{
|
||||
if (UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
buttonHeight = 40;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonHeight = 0;
|
||||
}
|
||||
|
||||
TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory();
|
||||
iconTextImageButtonFactory.AllowThemeToAdjustImage = false;
|
||||
iconTextImageButtonFactory.checkedBorderColor = RGBA_Bytes.White;
|
||||
|
||||
BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
|
||||
iconTextImageButtonFactory.FixedHeight = buttonHeight * GuiWidget.DeviceScale;
|
||||
iconTextImageButtonFactory.FixedWidth = buttonHeight * GuiWidget.DeviceScale;
|
||||
|
||||
this.BackgroundColor = new RGBA_Bytes(0, 0, 0, overlayAlpha);
|
||||
string resetViewIconPath = Path.Combine("ViewTransformControls", "reset.png");
|
||||
resetViewButton = iconTextImageButtonFactory.Generate("", StaticData.Instance.LoadIcon(resetViewIconPath,32,32).InvertLightness());
|
||||
resetViewButton = buttonFactory.Generate("", StaticData.Instance.LoadIcon(resetViewIconPath, 32, 32).InvertLightness());
|
||||
resetViewButton.ToolTipText = "Reset View".Localize();
|
||||
AddChild(resetViewButton);
|
||||
resetViewButton.Click += (sender, e) =>
|
||||
|
|
@ -92,20 +65,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
};
|
||||
|
||||
string translateIconPath = Path.Combine("ViewTransformControls", "translate.png");
|
||||
translateButton = iconTextImageButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon(translateIconPath,32,32));
|
||||
translateButton.ToolTipText = "Move".Localize();
|
||||
translateButton.Margin = new BorderDouble(3);
|
||||
translateButton = buttonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon(translateIconPath, 32, 32));
|
||||
translateButton.ToolTipText = "Move".Localize();
|
||||
translateButton.Margin = new BorderDouble(3);
|
||||
AddChild(translateButton);
|
||||
|
||||
string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png");
|
||||
scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon(scaleIconPath,32,32));
|
||||
scaleButton.ToolTipText = "Zoom".Localize();
|
||||
scaleButton.Margin = new BorderDouble(3);
|
||||
scaleButton = buttonFactory.GenerateRadioButton("", StaticData.Instance.LoadIcon(scaleIconPath, 32, 32));
|
||||
scaleButton.ToolTipText = "Zoom".Localize();
|
||||
scaleButton.Margin = new BorderDouble(3);
|
||||
AddChild(scaleButton);
|
||||
|
||||
Margin = new BorderDouble(5);
|
||||
HAnchor |= Agg.UI.HAnchor.ParentLeft;
|
||||
VAnchor = Agg.UI.VAnchor.ParentTop;
|
||||
HAnchor |= HAnchor.ParentLeft;
|
||||
VAnchor = VAnchor.ParentTop;
|
||||
translateButton.Checked = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -117,29 +90,24 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private static bool userChangedTo3DThisRun = false;
|
||||
|
||||
public ViewControlsToggle()
|
||||
public ViewControlsToggle(TextImageButtonFactory buttonFactory)
|
||||
{
|
||||
TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory();
|
||||
iconTextImageButtonFactory.AllowThemeToAdjustImage = false;
|
||||
iconTextImageButtonFactory.checkedBorderColor = RGBA_Bytes.White;
|
||||
this.BackgroundColor = new RGBA_Bytes(0, 0, 0, overlayAlpha);
|
||||
|
||||
BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
|
||||
|
||||
iconTextImageButtonFactory.FixedHeight = buttonHeight * GuiWidget.DeviceScale;
|
||||
iconTextImageButtonFactory.FixedWidth = buttonHeight * GuiWidget.DeviceScale;
|
||||
|
||||
string select2dIconPath = Path.Combine("ViewTransformControls", "2d.png");
|
||||
twoDimensionButton = iconTextImageButtonFactory.GenerateRadioButton("", select2dIconPath);
|
||||
twoDimensionButton = buttonFactory.GenerateRadioButton("", Path.Combine("ViewTransformControls", "2d.png"));
|
||||
twoDimensionButton.Margin = new BorderDouble(3);
|
||||
AddChild(twoDimensionButton);
|
||||
this.AddChild(twoDimensionButton);
|
||||
|
||||
string select3dIconPath = Path.Combine("ViewTransformControls", "3d.png");
|
||||
threeDimensionButton = iconTextImageButtonFactory.GenerateRadioButton("", select3dIconPath);
|
||||
threeDimensionButton = buttonFactory.GenerateRadioButton("", Path.Combine("ViewTransformControls", "3d.png"));
|
||||
threeDimensionButton.Margin = new BorderDouble(3);
|
||||
threeDimensionButton.Click += (sender, e) =>
|
||||
{
|
||||
userChangedTo3DThisRun = true;
|
||||
};
|
||||
|
||||
if (!UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
AddChild(threeDimensionButton);
|
||||
this.AddChild(threeDimensionButton);
|
||||
|
||||
if (UserSettings.Instance.get("LayerViewDefault") == "3D Layer"
|
||||
&&
|
||||
|
|
@ -159,13 +127,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
twoDimensionButton.Checked = true;
|
||||
}
|
||||
|
||||
threeDimensionButton.Click += (sender, e) =>
|
||||
{
|
||||
userChangedTo3DThisRun = true;
|
||||
};
|
||||
Margin = new BorderDouble(5, 5, 200, 5);
|
||||
HAnchor |= Agg.UI.HAnchor.ParentRight;
|
||||
VAnchor = Agg.UI.VAnchor.ParentTop;
|
||||
this.Margin = new BorderDouble(5, 5, 200, 5);
|
||||
this.HAnchor |= HAnchor.ParentRight;
|
||||
this.VAnchor = VAnchor.ParentTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2017, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -27,20 +27,14 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
using System.IO;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.RenderOpenGl;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
|
|
@ -57,8 +51,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public ViewControls3DButtons TransformMode { get; set; }
|
||||
}
|
||||
|
||||
public class ViewControls3D : FlowLayoutWidget
|
||||
public class ViewControls3D : ViewControlsBase
|
||||
{
|
||||
public event EventHandler ResetView;
|
||||
public event EventHandler<TransformStateChangedEventArgs> TransformStateChanged;
|
||||
|
||||
internal OverflowDropdown OverflowButton;
|
||||
|
||||
private GuiWidget partSelectSeparator;
|
||||
private Button resetViewButton;
|
||||
|
||||
|
|
@ -69,11 +68,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
internal OverflowDropdown OverflowButton;
|
||||
|
||||
public event EventHandler ResetView;
|
||||
|
||||
public event EventHandler<TransformStateChangedEventArgs> TransformStateChanged;
|
||||
private ViewControls3DButtons activeTransformState = ViewControls3DButtons.Rotate;
|
||||
|
||||
public bool PartSelectVisible
|
||||
{
|
||||
|
|
@ -85,8 +80,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private ViewControls3DButtons activeTransformState = ViewControls3DButtons.Rotate;
|
||||
|
||||
public ViewControls3DButtons ActiveButton
|
||||
{
|
||||
get
|
||||
|
|
@ -124,6 +117,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public ViewControls3D(TextImageButtonFactory buttonFactory)
|
||||
{
|
||||
this.BackgroundColor = new RGBA_Bytes(0, 0, 0, overlayAlpha);
|
||||
this.HAnchor |= HAnchor.ParentLeft;
|
||||
this.VAnchor = VAnchor.ParentTop;
|
||||
|
||||
string iconPath;
|
||||
|
||||
iconPath = Path.Combine("ViewTransformControls", "reset.png");
|
||||
|
|
@ -181,11 +178,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
OverflowButton.Margin = 3;
|
||||
AddChild(OverflowButton);
|
||||
|
||||
HAnchor |= Agg.UI.HAnchor.ParentLeft;
|
||||
VAnchor = Agg.UI.VAnchor.ParentTop;
|
||||
|
||||
rotateButton.Checked = true;
|
||||
BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
meshViewerWidget.Visible = false;
|
||||
meshViewerWidget.TrackballTumbleWidget.DrawGlContent += new EventHandler(TrackballTumbleWidget_DrawGlContent);
|
||||
|
||||
viewControls2D = new ViewControls2D();
|
||||
viewControls2D = new ViewControls2D(ApplicationController.Instance.Theme.ViewControlsButtonFactory);
|
||||
viewControls2D.Visible = false;
|
||||
AddChild(viewControls2D);
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
viewControls3D.ActiveButton = ViewControls3DButtons.Rotate;
|
||||
|
||||
viewControlsToggle = new ViewControlsToggle();
|
||||
viewControlsToggle = new ViewControlsToggle(ApplicationController.Instance.Theme.ViewControlsButtonFactory);
|
||||
viewControlsToggle.HAnchor = Agg.UI.HAnchor.ParentRight;
|
||||
AddChild(viewControlsToggle);
|
||||
viewControlsToggle.Visible = false;
|
||||
|
|
@ -575,9 +575,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private GuiWidget GetEstimatedMassInfo()
|
||||
{
|
||||
FlowLayoutWidget estimatedMassInfo = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
string massLabel = "Estimated Mass".Localize();
|
||||
string massLabelFull = string.Format("{0}:", massLabel);
|
||||
estimatedMassInfo.AddChild(new TextWidget(massLabelFull, pointSize: 9, textColor: ActiveTheme.Instance.PrimaryTextColor));
|
||||
estimatedMassInfo.AddChild(new TextWidget("Estimated Mass".Localize() + ":", pointSize: 9, textColor: ActiveTheme.Instance.PrimaryTextColor));
|
||||
massTextWidget = new TextWidget("", pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor)
|
||||
{
|
||||
AutoExpandBoundsToText = true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue