Merge pull request #3314 from jlewin/design_tools

Use accent color on spinner to improve visibility
This commit is contained in:
johnlewin 2018-05-14 13:50:35 -07:00 committed by GitHub
commit e2198abb7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 50 deletions

View file

@ -2163,7 +2163,12 @@ namespace MatterHackers.MatterControl
systemWindow.AddChild(overlay);
var spinner = new LogoSpinner(overlay, rotateX: -0.05);
var mutedAccentColor = new Color(theme.Colors.PrimaryAccentColor, 185).OverlayOn(Color.White).ToColor();
var spinner = new LogoSpinner(overlay, rotateX: -0.05)
{
MeshColor = mutedAccentColor
};
progressPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
@ -2184,7 +2189,7 @@ namespace MatterHackers.MatterControl
progressPanel.AddChild(progressBar = new ProgressBar()
{
FillColor = theme.Colors.PrimaryAccentColor,
FillColor = mutedAccentColor,
BorderColor = theme.GetBorderColor(75),
Height = 11,
Width = 230,

View file

@ -79,7 +79,7 @@ namespace MatterHackers.MatterControl
}
// Create export button for each plugin
var pluginButton = new RadioButton(new RadioImageWidget(plugin.ButtonText, plugin.Icon))
var pluginButton = new RadioButton(new RadioImageWidget(plugin.ButtonText, theme.Colors.PrimaryTextColor, plugin.Icon))
{
HAnchor = HAnchor.Left,
Margin = commonMargin,

View file

@ -35,8 +35,8 @@ namespace MatterHackers.MatterControl
{
public class RadioImageWidget : RadioButtonViewText
{
public RadioImageWidget(string label, ImageBuffer image)
: base(label)
public RadioImageWidget(string label, Color textColor, ImageBuffer image)
: base(label, textColor)
{
var imageWidget = new ImageWidget(image);
this.AddChild(imageWidget, this.Children.IndexOf(labelTextWidget));

View file

@ -35,8 +35,8 @@ namespace MatterHackers.MatterControl
{
public class RadioPanelWidget : RadioButtonViewText
{
public RadioPanelWidget(string label, string info, ImageBuffer image)
: base(label)
public RadioPanelWidget(string label, Color textColor, string info, ImageBuffer image)
: base(label, textColor)
{
radioCircle.Margin = new BorderDouble(4);
radioCircle.VAnchor = VAnchor.Top;

View file

@ -191,14 +191,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
{
if(ProfileManager.Instance.Profiles.Count > 0)
{
toolbar.AddChild(new TextWidget("Select a printer to continue".Localize() + "...", pointSize: theme.DefaultFontSize)
toolbar.AddChild(new TextWidget("Select a printer to continue".Localize() + "...", textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize)
{
Margin = 15
});
}
else
{
toolbar.AddChild(new TextWidget("Create a printer to continue".Localize() + "...", pointSize: theme.DefaultFontSize)
toolbar.AddChild(new TextWidget("Create a printer to continue".Localize() + "...", textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize)
{
Margin = 15
});

View file

@ -22,18 +22,6 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
: base(label)
{
PortValue = value;
this.EnabledChanged += new EventHandler(onRadioButtonEnabledChanged);
}
private void onRadioButtonEnabledChanged(object sender, EventArgs e)
{
if (this.Enabled)
{
this.TextColor = Color.White;
}
{
this.TextColor = Color.Gray;
}
}
}

View file

@ -118,39 +118,47 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private FlowLayoutWidget createComPortContainer()
{
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.Margin = new BorderDouble(0);
container.VAnchor = VAnchor.Stretch;
var container = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
Margin = new BorderDouble(0),
VAnchor = VAnchor.Stretch
};
BorderDouble elementMargin = new BorderDouble(top: 3);
string serialPortLabel = "Serial Port".Localize();
string serialPortLabelFull = string.Format("{0}:", serialPortLabel);
var comPortLabel = new TextWidget("Serial Port".Localize() + ":", 0, 0, 12)
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
Margin = new BorderDouble(0, 0, 0, 10),
HAnchor = HAnchor.Stretch
};
TextWidget comPortLabel = new TextWidget(serialPortLabelFull, 0, 0, 12);
comPortLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
comPortLabel.Margin = new BorderDouble(0, 0, 0, 10);
comPortLabel.HAnchor = HAnchor.Stretch;
FlowLayoutWidget serialPortContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
var serialPortContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
CreateSerialPortControls(serialPortContainer, null);
FlowLayoutWidget comPortMessageContainer = new FlowLayoutWidget();
comPortMessageContainer.Margin = elementMargin;
comPortMessageContainer.HAnchor = HAnchor.Stretch;
var comPortMessageContainer = new FlowLayoutWidget
{
Margin = elementMargin,
HAnchor = HAnchor.Stretch
};
printerComPortError = new TextWidget("Currently available serial ports.".Localize(), 0, 0, 10);
printerComPortError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerComPortError.AutoExpandBoundsToText = true;
printerComPortError = new TextWidget("Currently available serial ports.".Localize(), 0, 0, 10)
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
AutoExpandBoundsToText = true
};
printerComPortHelpLink = linkButtonFactory.Generate("What's this?".Localize());
printerComPortHelpLink.Margin = new BorderDouble(left: 5);
printerComPortHelpLink.VAnchor = VAnchor.Bottom;
printerComPortHelpLink.Click += (s, e) => printerComPortHelpMessage.Visible = !printerComPortHelpMessage.Visible;
printerComPortHelpMessage = new TextWidget("The 'Serial Port' section lists all available serial\nports on your device. Changing which USB port the printer\nis connected to may change the associated serial port.\n\nTip: If you are uncertain, unplug/plug in your printer\nand hit refresh. The new port that appears should be\nyour printer.".Localize(), 0, 0, 10);
printerComPortHelpMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerComPortHelpMessage.Margin = new BorderDouble(top: 10);
printerComPortHelpMessage.Visible = false;
printerComPortHelpMessage = new TextWidget("The 'Serial Port' section lists all available serial\nports on your device. Changing which USB port the printer\nis connected to may change the associated serial port.\n\nTip: If you are uncertain, unplug/plug in your printer\nand hit refresh. The new port that appears should be\nyour printer.".Localize(), 0, 0, 10)
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
Margin = new BorderDouble(top: 10),
Visible = false
};
comPortMessageContainer.AddChild(printerComPortError);
comPortMessageContainer.AddChild(printerComPortHelpLink);
@ -189,10 +197,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
protected void CreateSerialPortControls(FlowLayoutWidget comPortContainer, string activePrinterSerialPort)
{
int portIndex = 0;
string[] portsToCreate = FrostedSerialPort.GetPortNames();
// Add a radio button for each filtered port
foreach (string portName in portsToCreate)
foreach (string portName in FrostedSerialPort.GetPortNames())
{
SerialPortIndexRadioButton comPortOption = createComPortOption(portName, activePrinterSerialPort == portName);
if (comPortOption.Checked)
@ -220,23 +227,24 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
//If there are still no com ports show a message to that effect
if (portIndex == 0)
{
TextWidget comPortOption = new TextWidget("No COM ports available".Localize());
comPortOption.Margin = new BorderDouble(3, 6, 5, 6);
comPortOption.TextColor = ActiveTheme.Instance.PrimaryTextColor;
var comPortOption = new TextWidget("No COM ports available".Localize())
{
Margin = new BorderDouble(3, 6, 5, 6),
TextColor = ActiveTheme.Instance.PrimaryTextColor
};
comPortContainer.AddChild(comPortOption);
}
}
private SerialPortIndexRadioButton createComPortOption(string portName, bool isActivePrinterPort)
{
SerialPortIndexRadioButton comPortOption = new SerialPortIndexRadioButton(portName, portName)
return new SerialPortIndexRadioButton(portName, portName)
{
HAnchor = HAnchor.Left,
Margin = new BorderDouble(3, 3, 5, 3),
TextColor = ActiveTheme.Instance.PrimaryTextColor,
Checked = isActivePrinterPort
};
return comPortOption;
}
private string GetSelectedSerialPort()

@ -1 +1 @@
Subproject commit 2faecb96628ac12b327deb81805cc5fb2c9e9994
Subproject commit 840a2cdaff743545260ea28e8b6541d3f8f75f5c