Merge pull request #2875 from jlewin/design_tools
Use alternate mechanism to sync DockingTabControl width
This commit is contained in:
commit
05b5dbe769
19 changed files with 293 additions and 332 deletions
|
|
@ -12,94 +12,51 @@ namespace MatterHackers.MatterControl.AboutPage
|
|||
public CheckForUpdatesPage()
|
||||
: base("Close".Localize())
|
||||
{
|
||||
AnchorAll();
|
||||
|
||||
this.WindowTitle = this.HeaderText = "Check for Update".Localize();
|
||||
|
||||
var theme = ApplicationController.Instance.Theme;
|
||||
|
||||
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
topToBottom.AnchorAll();
|
||||
topToBottom.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
Padding = 0;
|
||||
this.WindowTitle = this.HeaderText = "Check for Update".Localize();
|
||||
this.Padding = 0;
|
||||
this.AnchorAll();
|
||||
|
||||
FlowLayoutWidget currentFeedAndDropDownContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
currentFeedAndDropDownContainer.VAnchor = VAnchor.Fit;
|
||||
currentFeedAndDropDownContainer.HAnchor = HAnchor.Stretch;
|
||||
currentFeedAndDropDownContainer.Margin = new BorderDouble(0, 5, 0, 0);
|
||||
currentFeedAndDropDownContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
|
||||
UpdateControlView updateStatusWidget = new UpdateControlView(ApplicationController.Instance.Theme);
|
||||
// Clear padding so UpdateControlView toolbar appears like toolbar
|
||||
contentRow.Padding = 0;
|
||||
|
||||
TextWidget feedLabel = new TextWidget("Update Channel".Localize(), pointSize: 12);
|
||||
feedLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
feedLabel.VAnchor = VAnchor.Center;
|
||||
feedLabel.Margin = new BorderDouble(left: 5);
|
||||
// Update Status Widget
|
||||
contentRow.AddChild(
|
||||
new UpdateControlView(ApplicationController.Instance.Theme));
|
||||
|
||||
var releaseOptionsDropList = new DropDownList("Development", ActiveTheme.Instance.PrimaryTextColor, maxHeight: 200);
|
||||
releaseOptionsDropList.HAnchor = HAnchor.Stretch;
|
||||
|
||||
releaseOptionsDropList.AddItem("Stable".Localize(), "release");
|
||||
releaseOptionsDropList.AddItem("Beta".Localize(), "pre-release");
|
||||
releaseOptionsDropList.AddItem("Alpha".Localize(), "development");
|
||||
|
||||
var acceptableUpdateFeedTypeValues = new List<string>() { "release", "pre-release", "development" };
|
||||
|
||||
string currentUpdateFeedType = UserSettings.Instance.get(UserSettingsKey.UpdateFeedType);
|
||||
if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1)
|
||||
var contentPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, "release");
|
||||
}
|
||||
|
||||
releaseOptionsDropList.SelectedValue = currentUpdateFeedType;
|
||||
releaseOptionsDropList.SelectionChanged += (s, e) =>
|
||||
{
|
||||
string releaseCode = releaseOptionsDropList.SelectedValue;
|
||||
if (releaseCode != UserSettings.Instance.get(UserSettingsKey.UpdateFeedType))
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, releaseCode);
|
||||
}
|
||||
|
||||
UpdateControlData.Instance.CheckForUpdateUserRequested();
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Stretch,
|
||||
Padding = 8
|
||||
};
|
||||
contentRow.AddChild(contentPanel);
|
||||
|
||||
var currentBuildInfo = new TextWidget("Current Build".Localize() + $" : {VersionInfo.Instance.BuildVersion}");
|
||||
currentBuildInfo.HAnchor = HAnchor.Stretch;
|
||||
currentBuildInfo.Margin = new BorderDouble(left: 5, bottom: 15, top: 20);
|
||||
currentBuildInfo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
var currentBuildInfo = new TextWidget("Current Build".Localize() + $" : {VersionInfo.Instance.BuildVersion}")
|
||||
{
|
||||
HAnchor = HAnchor.Stretch,
|
||||
Margin = new BorderDouble(left: 5, bottom: 15, top: 20),
|
||||
TextColor = theme.Colors.PrimaryTextColor
|
||||
};
|
||||
contentPanel.AddChild(currentBuildInfo);
|
||||
|
||||
FlowLayoutWidget additionalInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
additionalInfoContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
additionalInfoContainer.HAnchor = HAnchor.Stretch;
|
||||
additionalInfoContainer.Padding = new BorderDouble(left: 6, top: 6);
|
||||
var currentFeedAndDropDownContainer = new FlowLayoutWidget(FlowDirection.LeftToRight)
|
||||
{
|
||||
VAnchor = VAnchor.Fit,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
};
|
||||
contentPanel.AddChild(currentFeedAndDropDownContainer);
|
||||
|
||||
string aboutUpdateChannel = "Changing your update channel will change the version of MatterControl that you receive when updating".Localize() + ":";
|
||||
var updateChannelLabel = new WrappedTextWidget(aboutUpdateChannel);
|
||||
updateChannelLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
updateChannelLabel.HAnchor = HAnchor.Stretch;
|
||||
updateChannelLabel.Margin = new BorderDouble(bottom: 20);
|
||||
additionalInfoContainer.AddChild(updateChannelLabel);
|
||||
var feedLabel = new TextWidget("Update Channel".Localize(), pointSize: 12)
|
||||
{
|
||||
TextColor = theme.Colors.PrimaryTextColor,
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = new BorderDouble(left: 5)
|
||||
};
|
||||
currentFeedAndDropDownContainer.AddChild(feedLabel);
|
||||
|
||||
string stableFeedInfoText = "Stable: The current release version of MatterControl (recommended).".Localize();
|
||||
var stableInfoLabel = new WrappedTextWidget(stableFeedInfoText);
|
||||
stableInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
stableInfoLabel.HAnchor = HAnchor.Stretch;
|
||||
stableInfoLabel.Margin = new BorderDouble(bottom: 10);
|
||||
additionalInfoContainer.AddChild(stableInfoLabel);
|
||||
|
||||
string betaFeedInfoText = "Beta: The release candidate version of MatterControl.".Localize();
|
||||
var betaInfoLabel = new WrappedTextWidget(betaFeedInfoText);
|
||||
betaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
betaInfoLabel.HAnchor = HAnchor.Stretch;
|
||||
betaInfoLabel.Margin = new BorderDouble(bottom: 10);
|
||||
additionalInfoContainer.AddChild(betaInfoLabel);
|
||||
|
||||
string alphaFeedInfoText = "Alpha: The in development version of MatterControl.".Localize();
|
||||
var alphaInfoLabel = new WrappedTextWidget(alphaFeedInfoText);
|
||||
alphaInfoLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
alphaInfoLabel.HAnchor = HAnchor.Stretch;
|
||||
alphaInfoLabel.Margin = new BorderDouble(bottom: 10);
|
||||
additionalInfoContainer.AddChild(alphaInfoLabel);
|
||||
FlowLayoutWidget additionalInfoContainer = null;
|
||||
|
||||
Button whatsThisLink = theme.HelpLinkFactory.Generate("What's this?".Localize());
|
||||
whatsThisLink.VAnchor = VAnchor.Center;
|
||||
|
|
@ -118,22 +75,78 @@ namespace MatterHackers.MatterControl.AboutPage
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
topToBottom.AddChild(updateStatusWidget);
|
||||
topToBottom.AddChild(currentBuildInfo);
|
||||
currentFeedAndDropDownContainer.AddChild(feedLabel);
|
||||
currentFeedAndDropDownContainer.AddChild(whatsThisLink);
|
||||
|
||||
currentFeedAndDropDownContainer.AddChild(new HorizontalSpacer());
|
||||
|
||||
|
||||
var acceptableUpdateFeedTypeValues = new List<string>() { "release", "pre-release", "development" };
|
||||
|
||||
string currentUpdateFeedType = UserSettings.Instance.get(UserSettingsKey.UpdateFeedType);
|
||||
if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1)
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, "release");
|
||||
}
|
||||
|
||||
var releaseOptionsDropList = new DropDownList("Development", theme.Colors.PrimaryTextColor, maxHeight: 200)
|
||||
{
|
||||
HAnchor = HAnchor.Fit
|
||||
};
|
||||
releaseOptionsDropList.AddItem("Stable".Localize(), "release");
|
||||
releaseOptionsDropList.AddItem("Beta".Localize(), "pre-release");
|
||||
releaseOptionsDropList.AddItem("Alpha".Localize(), "development");
|
||||
releaseOptionsDropList.SelectedValue = currentUpdateFeedType;
|
||||
releaseOptionsDropList.SelectionChanged += (s, e) =>
|
||||
{
|
||||
string releaseCode = releaseOptionsDropList.SelectedValue;
|
||||
if (releaseCode != UserSettings.Instance.get(UserSettingsKey.UpdateFeedType))
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.UpdateFeedType, releaseCode);
|
||||
}
|
||||
|
||||
UpdateControlData.Instance.CheckForUpdateUserRequested();
|
||||
};
|
||||
currentFeedAndDropDownContainer.AddChild(releaseOptionsDropList);
|
||||
topToBottom.AddChild(currentFeedAndDropDownContainer);
|
||||
|
||||
topToBottom.AddChild(additionalInfoContainer);
|
||||
additionalInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
Padding = new BorderDouble(left: 6, top: 6),
|
||||
Visible = false
|
||||
};
|
||||
additionalInfoContainer.AddChild(
|
||||
new WrappedTextWidget("Changing your update channel will change the version of MatterControl that you receive when updating".Localize() + ":")
|
||||
{
|
||||
TextColor = theme.Colors.PrimaryTextColor,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
Margin = new BorderDouble(bottom: 20)
|
||||
});
|
||||
|
||||
contentRow.AddChild(topToBottom);
|
||||
additionalInfoContainer.AddChild(
|
||||
new WrappedTextWidget("Stable: The current release version of MatterControl (recommended)".Localize())
|
||||
{
|
||||
TextColor = theme.Colors.PrimaryTextColor,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
Margin = new BorderDouble(bottom: 10)
|
||||
});
|
||||
|
||||
additionalInfoContainer.Visible = false;
|
||||
additionalInfoContainer.AddChild(
|
||||
new WrappedTextWidget("Beta: The release candidate version of MatterControl".Localize())
|
||||
{
|
||||
TextColor = theme.Colors.PrimaryTextColor,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
Margin = new BorderDouble(bottom: 10)
|
||||
});
|
||||
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
additionalInfoContainer.AddChild(
|
||||
new WrappedTextWidget("Alpha: The in development version of MatterControl".Localize())
|
||||
{
|
||||
TextColor = theme.Colors.PrimaryTextColor,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
Margin = new BorderDouble(bottom: 10)
|
||||
});
|
||||
contentPanel.AddChild(additionalInfoContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,11 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -47,40 +49,51 @@ namespace MatterHackers.MatterControl
|
|||
public UpdateControlView(ThemeConfig theme)
|
||||
{
|
||||
this.HAnchor = HAnchor.Stretch;
|
||||
this.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
|
||||
this.Padding = new BorderDouble(6, 5);
|
||||
this.BackgroundColor = theme.MinimalShade;
|
||||
this.Padding = theme.ToolbarPadding.Clone(left: 8);
|
||||
|
||||
updateStatusText = new TextWidget(string.Format(""), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||
updateStatusText.AutoExpandBoundsToText = true;
|
||||
updateStatusText.VAnchor = VAnchor.Center;
|
||||
this.AddChild(updateStatusText);
|
||||
this.AddChild(updateStatusText = new TextWidget(string.Format(""), textColor: ActiveTheme.Instance.PrimaryTextColor)
|
||||
{
|
||||
AutoExpandBoundsToText = true,
|
||||
VAnchor = VAnchor.Center
|
||||
});
|
||||
|
||||
this.AddChild(new HorizontalSpacer());
|
||||
|
||||
checkUpdateLink = theme.GrayButtonFactory.Generate("Check for Update".Localize());
|
||||
checkUpdateLink.VAnchor = VAnchor.Center;
|
||||
checkUpdateLink = new IconButton(AggContext.StaticData.LoadIcon("fa-refresh_14.png", IconColor.Theme), ApplicationController.Instance.Theme)
|
||||
{
|
||||
ToolTipText = "Check for Update".Localize(),
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Cursor = Cursors.Hand,
|
||||
Visible = false
|
||||
};
|
||||
checkUpdateLink.Click += (s, e) =>
|
||||
{
|
||||
UpdateControlData.Instance.CheckForUpdateUserRequested();
|
||||
};
|
||||
checkUpdateLink.Visible = false;
|
||||
this.AddChild(checkUpdateLink);
|
||||
|
||||
downloadUpdateLink = theme.GrayButtonFactory.Generate("Download Update".Localize());
|
||||
downloadUpdateLink.Visible = false;
|
||||
downloadUpdateLink.VAnchor = VAnchor.Center;
|
||||
this.MinimumSize = new Vector2(0, checkUpdateLink.Height);
|
||||
|
||||
downloadUpdateLink = new TextButton("Download Update".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Visible = false
|
||||
};
|
||||
downloadUpdateLink.Click += (s, e) =>
|
||||
{
|
||||
downloadUpdateLink.Visible = false;
|
||||
updateStatusText.Text = string.Format("Retrieving download info...".Localize());
|
||||
updateStatusText.Text = "Retrieving download info...".Localize();
|
||||
|
||||
UpdateControlData.Instance.InitiateUpdateDownload();
|
||||
};
|
||||
this.AddChild(downloadUpdateLink);
|
||||
|
||||
installUpdateLink = theme.GrayButtonFactory.Generate("Install Update".Localize());
|
||||
installUpdateLink.Visible = false;
|
||||
installUpdateLink.VAnchor = VAnchor.Center;
|
||||
installUpdateLink = new TextButton("Install Update".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Visible = false
|
||||
};
|
||||
installUpdateLink.Click += (s, e) =>
|
||||
{
|
||||
try
|
||||
|
|
@ -88,22 +101,20 @@ namespace MatterHackers.MatterControl
|
|||
if (!UpdateControlData.Instance.InstallUpdate())
|
||||
{
|
||||
installUpdateLink.Visible = false;
|
||||
updateStatusText.Text = string.Format("Oops! Unable to install update.".Localize());
|
||||
updateStatusText.Text = "Oops! Unable to install update.".Localize();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
GuiWidget.BreakInDebugger();
|
||||
installUpdateLink.Visible = false;
|
||||
updateStatusText.Text = string.Format("Oops! Unable to install update.".Localize());
|
||||
updateStatusText.Text = "Oops! Unable to install update.".Localize();
|
||||
}
|
||||
};
|
||||
this.AddChild(installUpdateLink);
|
||||
|
||||
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(UpdateStatusChanged, ref unregisterEvents);
|
||||
|
||||
this.MinimumSize = new VectorMath.Vector2(0, 50);
|
||||
|
||||
this.UpdateStatusChanged(null, null);
|
||||
}
|
||||
|
||||
|
|
@ -113,25 +124,25 @@ namespace MatterHackers.MatterControl
|
|||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
string recommendedUpdateAvailable = "There is a recommended update available.".Localize();
|
||||
string requiredUpdateAvailable = "There is a required update available.".Localize();
|
||||
string recommendedUpdateAvailable = "There is a recommended update available".Localize();
|
||||
string requiredUpdateAvailable = "There is a required update available".Localize();
|
||||
|
||||
private void UpdateStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (UpdateControlData.Instance.UpdateStatus)
|
||||
{
|
||||
case UpdateControlData.UpdateStatusStates.MayBeAvailable:
|
||||
updateStatusText.Text = string.Format("New updates may be available.".Localize());
|
||||
updateStatusText.Text = "New updates may be available".Localize();
|
||||
checkUpdateLink.Visible = true;
|
||||
break;
|
||||
|
||||
case UpdateControlData.UpdateStatusStates.CheckingForUpdate:
|
||||
updateStatusText.Text = "Checking for updates...".Localize();
|
||||
checkUpdateLink.Visible = false;
|
||||
//checkUpdateLink.Visible = false;
|
||||
break;
|
||||
|
||||
case UpdateControlData.UpdateStatusStates.UnableToConnectToServer:
|
||||
updateStatusText.Text = "Oops! Unable to connect to server.".Localize();
|
||||
updateStatusText.Text = "Oops! Unable to connect to server".Localize();
|
||||
downloadUpdateLink.Visible = false;
|
||||
installUpdateLink.Visible = false;
|
||||
checkUpdateLink.Visible = true;
|
||||
|
|
@ -152,20 +163,21 @@ namespace MatterHackers.MatterControl
|
|||
break;
|
||||
|
||||
case UpdateControlData.UpdateStatusStates.UpdateDownloading:
|
||||
string newText = "Downloading updates...".Localize();
|
||||
newText = "{0} {1}%".FormatWith(newText, UpdateControlData.Instance.DownloadPercent);
|
||||
updateStatusText.Text = newText;
|
||||
updateStatusText.Text = string.Format(
|
||||
"{0} {1}%",
|
||||
"Downloading updates...".Localize(),
|
||||
UpdateControlData.Instance.DownloadPercent);
|
||||
break;
|
||||
|
||||
case UpdateControlData.UpdateStatusStates.ReadyToInstall:
|
||||
updateStatusText.Text = string.Format("New updates are ready to install.".Localize());
|
||||
updateStatusText.Text = "New updates are ready to install".Localize();
|
||||
downloadUpdateLink.Visible = false;
|
||||
installUpdateLink.Visible = true;
|
||||
checkUpdateLink.Visible = false;
|
||||
break;
|
||||
|
||||
case UpdateControlData.UpdateStatusStates.UpToDate:
|
||||
updateStatusText.Text = string.Format("Your application is up-to-date.".Localize());
|
||||
updateStatusText.Text = "Your application is up-to-date".Localize();
|
||||
downloadUpdateLink.Visible = false;
|
||||
installUpdateLink.Visible = false;
|
||||
checkUpdateLink.Visible = true;
|
||||
|
|
|
|||
|
|
@ -69,12 +69,10 @@ namespace MatterHackers.MatterControl
|
|||
public LinkButtonFactory LinkButtonFactory { get; private set; }
|
||||
public LinkButtonFactory HelpLinkFactory { get; private set; }
|
||||
|
||||
public TextImageButtonFactory ExpandMenuOptionFactory;
|
||||
public TextImageButtonFactory WhiteButtonFactory;
|
||||
|
||||
public TextImageButtonFactory ButtonFactory { get; private set; }
|
||||
public TextImageButtonFactory SmallMarginButtonFactory { get; private set; }
|
||||
public TextImageButtonFactory RadioButtons { get; private set; }
|
||||
public TextImageButtonFactory WizardButtons { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -87,15 +85,8 @@ namespace MatterHackers.MatterControl
|
|||
/// </summary>
|
||||
public TextImageButtonFactory GrayButtonFactory { get; private set; }
|
||||
|
||||
public TextImageButtonFactory imageConverterExpandMenuOptionFactory;
|
||||
|
||||
public TextImageButtonFactory imageConverterButtonFactory;
|
||||
public TextImageButtonFactory imageConverterUnlockButtonFactory;
|
||||
|
||||
public Color TabBodyBackground { get; private set; }
|
||||
|
||||
public TextImageButtonFactory ViewControlsButtonFactory { get; private set; }
|
||||
|
||||
public Color SplitterBackground { get; private set; } = new Color(0, 0, 0, 60);
|
||||
|
||||
public int SplitterWidth => (int)(6 * (GuiWidget.DeviceScale <= 1 ? GuiWidget.DeviceScale : GuiWidget.DeviceScale * 1.4));
|
||||
|
|
@ -124,12 +115,10 @@ namespace MatterHackers.MatterControl
|
|||
sectionWidget.BackgroundColor = this.MinimalShade;
|
||||
}
|
||||
|
||||
public TextImageButtonFactory HomingButtons { get; private set; }
|
||||
public TextImageButtonFactory MicroButton { get; private set; }
|
||||
public TextImageButtonFactory MicroButtonMenu { get; private set; }
|
||||
|
||||
public BorderDouble ButtonSpacing { get; set; } = new BorderDouble(3, 0, 0, 0);
|
||||
public TextImageButtonFactory NoMarginWhite { get; private set; }
|
||||
public BorderDouble ToolbarPadding { get; set; } = 3;
|
||||
public double ButtonHeight { get; internal set; } = 32;
|
||||
|
||||
|
|
@ -208,12 +197,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.ButtonFactory = new TextImageButtonFactory(commonOptions);
|
||||
|
||||
this.NoMarginWhite = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
Margin = 0,
|
||||
AllowThemeToAdjustImage = false
|
||||
});
|
||||
|
||||
this.SmallMarginButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
Margin = new BorderDouble(8, 0),
|
||||
|
|
@ -229,13 +212,6 @@ namespace MatterHackers.MatterControl
|
|||
#endif
|
||||
});
|
||||
|
||||
this.RadioButtons = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
BorderWidth = 1,
|
||||
CheckedBorderColor = Color.White,
|
||||
AllowThemeToAdjustImage = false
|
||||
});
|
||||
|
||||
var commonGray = new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
NormalTextColor = Color.Black,
|
||||
|
|
@ -256,15 +232,6 @@ namespace MatterHackers.MatterControl
|
|||
NormalFillColor = Color.Gray
|
||||
});
|
||||
|
||||
this.ViewControlsButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
DisabledTextColor = theme.PrimaryTextColor,
|
||||
FixedHeight = 0,
|
||||
FixedWidth = 0,
|
||||
AllowThemeToAdjustImage = false,
|
||||
CheckedBorderColor = Color.White
|
||||
});
|
||||
|
||||
this.MicroButton = new TextImageButtonFactory(new ButtonFactoryOptions()
|
||||
{
|
||||
FixedHeight = 20 * GuiWidget.DeviceScale,
|
||||
|
|
@ -304,71 +271,9 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
BorderWidth = 1,
|
||||
});
|
||||
|
||||
ExpandMenuOptionFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
HoverTextColor = theme.PrimaryTextColor,
|
||||
HoverFillColor = new Color(255, 255, 255, 50),
|
||||
|
||||
PressedTextColor = theme.PrimaryTextColor,
|
||||
PressedFillColor = new Color(255, 255, 255, 50),
|
||||
|
||||
DisabledTextColor = theme.PrimaryTextColor,
|
||||
DisabledFillColor = new Color(255, 255, 255, 50),
|
||||
FixedWidth = sideBarButtonWidth,
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageConverter
|
||||
imageConverterButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
FixedWidth = 185,
|
||||
FixedHeight = 30,
|
||||
|
||||
NormalFillColor = Color.White,
|
||||
NormalTextColor = Color.Black,
|
||||
NormalBorderColor = new Color(theme.PrimaryTextColor, 200),
|
||||
|
||||
HoverFillColor = new Color(255, 255, 255, 200),
|
||||
HoverTextColor = Color.Black,
|
||||
HoverBorderColor = new Color(theme.PrimaryTextColor, 200),
|
||||
|
||||
BorderWidth = 1,
|
||||
});
|
||||
|
||||
imageConverterUnlockButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
FixedWidth = 185,
|
||||
FixedHeight = 30,
|
||||
|
||||
NormalFillColor = theme.PrimaryAccentColor.SetLightness(.8).ToColor(),
|
||||
NormalTextColor = Color.Black,
|
||||
NormalBorderColor = new Color(theme.PrimaryAccentColor.SetLightness(.8).ToColor(), 200),
|
||||
|
||||
HoverFillColor = theme.PrimaryAccentColor.SetLightness(.9).ToColor(),
|
||||
HoverTextColor = Color.Black,
|
||||
HoverBorderColor = new Color(theme.PrimaryAccentColor.SetLightness(.9).ToColor(), 200),
|
||||
|
||||
BorderWidth = 1,
|
||||
});
|
||||
|
||||
imageConverterExpandMenuOptionFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
FixedWidth = 200,
|
||||
|
||||
NormalTextColor = theme.PrimaryTextColor,
|
||||
|
||||
HoverTextColor = theme.PrimaryTextColor,
|
||||
HoverFillColor = new Color(255, 255, 255, 50),
|
||||
|
||||
DisabledTextColor = theme.PrimaryTextColor,
|
||||
DisabledFillColor = new Color(255, 255, 255, 50),
|
||||
|
||||
PressedTextColor = theme.PrimaryTextColor,
|
||||
PressedFillColor = new Color(255, 255, 255, 50),
|
||||
});
|
||||
|
||||
// TODO: Need to remain based default ButtonFactionOptions constructor until reviewed for styling issues
|
||||
var disableableControlOptions = new ButtonFactoryOptions()
|
||||
{
|
||||
|
|
@ -383,14 +288,6 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
|
||||
this.DisableableControlBase = new TextImageButtonFactory(disableableControlOptions);
|
||||
this.HomingButtons = new TextImageButtonFactory(new ButtonFactoryOptions(disableableControlOptions)
|
||||
{
|
||||
BorderWidth = 1,
|
||||
NormalBorderColor = new Color(theme.PrimaryTextColor, 200),
|
||||
HoverBorderColor = new Color(theme.PrimaryTextColor, 200),
|
||||
NormalFillColor = new Color(180, 180, 180),
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
this.LinkButtonFactory = new LinkButtonFactory()
|
||||
|
|
@ -461,18 +358,6 @@ namespace MatterHackers.MatterControl
|
|||
return popupMenu;
|
||||
}
|
||||
|
||||
|
||||
internal TabControl CreateTabControl(int height = 1)
|
||||
{
|
||||
var tabControl = new TabControl(separator: new HorizontalLine(alpha: 50, height: height));
|
||||
tabControl.TabBar.BorderColor = Color.Transparent; // theme.SecondaryTextColor;
|
||||
tabControl.TabBar.Margin = 0;
|
||||
tabControl.TabBar.Padding = 0;
|
||||
tabControl.TextPointSize = FontSize12;
|
||||
|
||||
return tabControl;
|
||||
}
|
||||
|
||||
private static ImageBuffer ColorCircle(int size, Color color)
|
||||
{
|
||||
ImageBuffer imageBuffer = new ImageBuffer(size, size);
|
||||
|
|
|
|||
|
|
@ -18,14 +18,25 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
private static Color menuTextColor = Color.Black;
|
||||
|
||||
public SettingsItem(string text, ToggleSwitchConfig toggleSwitchConfig = null, GuiWidget optionalControls = null, ImageBuffer iconImage = null, bool enforceGutter = true)
|
||||
: this(text, CreateToggleSwitch(toggleSwitchConfig), optionalControls, iconImage, enforceGutter)
|
||||
public SettingsItem(string text, Color textColor, ToggleSwitchConfig toggleSwitchConfig = null, GuiWidget optionalControls = null, ImageBuffer iconImage = null, bool enforceGutter = true)
|
||||
: this(text, textColor, CreateToggleSwitch(toggleSwitchConfig, textColor), optionalControls, iconImage, enforceGutter)
|
||||
{
|
||||
}
|
||||
|
||||
public SettingsItem (string text, GuiWidget settingsControls, GuiWidget optionalControls = null, ImageBuffer imageBuffer = null, bool enforceGutter = true)
|
||||
public SettingsItem(string text, ToggleSwitchConfig toggleSwitchConfig = null, GuiWidget optionalControls = null, ImageBuffer iconImage = null, bool enforceGutter = true)
|
||||
: this(text, CreateToggleSwitch(toggleSwitchConfig, menuTextColor), optionalControls, iconImage, enforceGutter)
|
||||
{
|
||||
}
|
||||
|
||||
public SettingsItem(string text, GuiWidget settingsControls, GuiWidget optionalControls = null, ImageBuffer imageBuffer = null, bool enforceGutter = true)
|
||||
: this(text, menuTextColor, settingsControls, optionalControls, imageBuffer, enforceGutter)
|
||||
{
|
||||
}
|
||||
|
||||
public SettingsItem (string text, Color textColor, GuiWidget settingsControls, GuiWidget optionalControls = null, ImageBuffer imageBuffer = null, bool enforceGutter = true)
|
||||
: base (FlowDirection.LeftToRight)
|
||||
{
|
||||
this.SettingsControl = settingsControls;
|
||||
this.HAnchor = HAnchor.Stretch;
|
||||
this.MinimumSize = new Vector2(0, 40);
|
||||
|
||||
|
|
@ -48,10 +59,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
});
|
||||
}
|
||||
|
||||
this.AddChild(new TextWidget(text)
|
||||
this.AddChild(new TextWidget(text, textColor: textColor)
|
||||
{
|
||||
AutoExpandBoundsToText = true,
|
||||
TextColor = menuTextColor,
|
||||
VAnchor = VAnchor.Center,
|
||||
});
|
||||
|
||||
|
|
@ -68,14 +78,16 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
}
|
||||
}
|
||||
|
||||
private static CheckBox CreateToggleSwitch(ToggleSwitchConfig toggleSwitchConfig)
|
||||
public GuiWidget SettingsControl { get; }
|
||||
|
||||
private static CheckBox CreateToggleSwitch(ToggleSwitchConfig toggleSwitchConfig, Color textColor)
|
||||
{
|
||||
if (toggleSwitchConfig == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var toggleSwitch = ImageButtonFactory.CreateToggleSwitch(toggleSwitchConfig.Checked, menuTextColor);
|
||||
var toggleSwitch = ImageButtonFactory.CreateToggleSwitch(toggleSwitchConfig.Checked, textColor);
|
||||
toggleSwitch.VAnchor = VAnchor.Center;
|
||||
toggleSwitch.Margin = new BorderDouble(left: 16);
|
||||
toggleSwitch.CheckedStateChanged += (sender, e) =>
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
private PrinterConfig printer;
|
||||
|
||||
private ThemeConfig theme;
|
||||
private ResizeContainer resizePage;
|
||||
|
||||
public DockingTabControl(GuiWidget widgetTodockTo, DockSide dockSide, PrinterConfig printer)
|
||||
: base (FlowDirection.TopToBottom)
|
||||
{
|
||||
|
|
@ -132,23 +134,28 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
return imageWidget;
|
||||
}
|
||||
|
||||
public override double Width
|
||||
{
|
||||
get => this.PageWidth;
|
||||
set => this.PageWidth = value;
|
||||
}
|
||||
|
||||
// Clamped to MinDockingWidth or value
|
||||
double PageWidth
|
||||
private double _constrainedWidth;
|
||||
private double ConstrainedWidth
|
||||
{
|
||||
get => Math.Max(MinDockingWidth, printer.ViewState.SliceSettingsWidth);
|
||||
set => printer.ViewState.SliceSettingsWidth = Math.Max(MinDockingWidth, value);
|
||||
set
|
||||
{
|
||||
if (value > MinDockingWidth
|
||||
&& _constrainedWidth != value)
|
||||
{
|
||||
_constrainedWidth = value;
|
||||
printer.ViewState.SliceSettingsWidth = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild()
|
||||
{
|
||||
settingsButtons.Clear();
|
||||
Focus();
|
||||
|
||||
this.Focus();
|
||||
|
||||
foreach (var nameWidget in allTabs)
|
||||
{
|
||||
nameWidget.Value.Parent?.RemoveChild(nameWidget.Value);
|
||||
|
|
@ -162,11 +169,15 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
var resizePage = new ResizeContainer(this)
|
||||
{
|
||||
Width = PageWidth,
|
||||
Width = this.ConstrainedWidth,
|
||||
VAnchor = VAnchor.Stretch,
|
||||
SpliterBarColor = theme.SplitterBackground,
|
||||
SplitterWidth = theme.SplitterWidth,
|
||||
MinimumSize = new Vector2(this.MinDockingWidth, 200)
|
||||
MinimumSize = new Vector2(this.MinDockingWidth, 0)
|
||||
};
|
||||
resizePage.BoundsChanged += (s, e) =>
|
||||
{
|
||||
this.ConstrainedWidth = resizePage.Width;
|
||||
};
|
||||
|
||||
tabControl = new SimpleTabs(this.CreatePinButton())
|
||||
|
|
@ -251,7 +262,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
var resizeContainer = new ResizeContainer(this)
|
||||
{
|
||||
Width = PageWidth,
|
||||
Width = this.ConstrainedWidth,
|
||||
VAnchor = VAnchor.Stretch,
|
||||
HAnchor = HAnchor.Right,
|
||||
SpliterBarColor = spliterColor,
|
||||
|
|
@ -260,15 +271,16 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
resizeContainer.AddChild(new DockingWindowContent(this, kvp.Value, tabTitle)
|
||||
{
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor,
|
||||
Width = PageWidth
|
||||
Width = this.ConstrainedWidth
|
||||
});
|
||||
|
||||
settingsButtons.Add(settingsButton);
|
||||
settingsButton.DebugShowBounds = true;
|
||||
settingsButton.PopupContent = resizeContainer;
|
||||
|
||||
settingsButton.Click += (s, e) =>
|
||||
{
|
||||
resizeContainer.Width = PageWidth;
|
||||
resizeContainer.Width = this.ConstrainedWidth;
|
||||
};
|
||||
|
||||
settingsButton.PopupLayoutEngine = new UnpinnedLayoutEngine(settingsButton.PopupContent, widgetTodockTo, DockSide);
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
this.VAnchor = VAnchor.Absolute | VAnchor.Center;
|
||||
this.Height = theme.ButtonFactory.Options.FixedHeight;
|
||||
this.Padding = theme.ButtonFactory.Options.Margin;
|
||||
this.TextColor = textColor;
|
||||
|
||||
this.AddChild(textWidget = new TextWidget(text, pointSize: theme.ButtonFactory.Options.FontSize, textColor: textColor)
|
||||
{
|
||||
|
|
@ -250,6 +251,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
});
|
||||
}
|
||||
|
||||
public Color TextColor { get; }
|
||||
|
||||
public override string Text
|
||||
{
|
||||
get => base.Text;
|
||||
|
|
|
|||
|
|
@ -57,13 +57,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
bool isPrinterType = this is PrinterTabPage;
|
||||
|
||||
viewControls3D = new ViewControls3D(sceneContext, theme, sceneContext.Scene.UndoBuffer)
|
||||
viewControls3D = new ViewControls3D(sceneContext, theme, sceneContext.Scene.UndoBuffer, isPrinterType)
|
||||
{
|
||||
//BackgroundColor = new Color(0, 0, 0, theme.OverlayAlpha),
|
||||
VAnchor = VAnchor.Top | VAnchor.Fit,
|
||||
HAnchor = HAnchor.Left | HAnchor.Stretch,
|
||||
Visible = true,
|
||||
IsPrinterMode = isPrinterType
|
||||
};
|
||||
viewControls3D.ResetView += (sender, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
SpliterBarColor = theme.SplitterBackground,
|
||||
SplitterWidth = theme.SplitterWidth,
|
||||
Visible = false,
|
||||
Border = new BorderDouble(top: 1),
|
||||
BorderColor = theme.MinimalShade
|
||||
};
|
||||
|
||||
this.InteractionLayer.AddChild(selectedObjectContainer);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private ViewControls3DButtons activeTransformState = ViewControls3DButtons.Rotate;
|
||||
private List<(GuiWidget button, SceneSelectionOperation operation)> operationButtons;
|
||||
|
||||
public bool IsPrinterMode { get; set; }
|
||||
public bool IsPrinterMode { get; }
|
||||
|
||||
public ViewControls3DButtons ActiveButton
|
||||
{
|
||||
|
|
@ -152,19 +152,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.view3DWidget = view3DWidget;
|
||||
}
|
||||
|
||||
public ViewControls3D(BedConfig sceneContext, ThemeConfig theme, UndoBuffer undoBuffer)
|
||||
public ViewControls3D(BedConfig sceneContext, ThemeConfig theme, UndoBuffer undoBuffer, bool isPrinterType)
|
||||
: base (theme)
|
||||
{
|
||||
this.printer = sceneContext.Printer;
|
||||
this.IsPrinterMode = isPrinterType;
|
||||
|
||||
string iconPath;
|
||||
|
||||
var commonMargin = theme.ButtonSpacing;
|
||||
|
||||
var buttonFactory = theme.RadioButtons;
|
||||
|
||||
double height = theme.ButtonFactory.Options.FixedHeight;
|
||||
|
||||
this.AddChild(CreateBedMenu(sceneContext, theme));
|
||||
|
||||
var homeButton = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", IconColor.Theme), theme)
|
||||
{
|
||||
ToolTipText = "Reset View".Localize(),
|
||||
|
|
@ -372,41 +373,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.AddChild(button);
|
||||
}
|
||||
|
||||
var buttonView = new FlowLayoutWidget();
|
||||
buttonView.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon((IsPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme))
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
});
|
||||
|
||||
var buttonText = (IsPrinterMode) ? "Bed".Localize() : "Part".Localize();
|
||||
buttonView.AddChild(new TextButton(buttonText, theme)
|
||||
{
|
||||
Padding = new BorderDouble(8, 4, 0, 4)
|
||||
});
|
||||
|
||||
this.AddChild(new HorizontalSpacer());
|
||||
|
||||
var overflowMenu = new OverflowMenu(buttonView)
|
||||
{
|
||||
Name = "Bed Options Menu",
|
||||
DynamicPopupContent = () => theme.CreatePopupMenu(this.BedMenuActions(sceneContext)),
|
||||
DrawArrow = true,
|
||||
AlignToRightEdge = true,
|
||||
Margin = new BorderDouble(right: theme.ButtonSpacing.Left),
|
||||
};
|
||||
|
||||
// HACK: Fix left padding to improve style. Ideally fix this in the underlying button
|
||||
var firstChild = overflowMenu.Children.First();
|
||||
firstChild.Margin = firstChild.Margin.Clone(left: 8);
|
||||
|
||||
overflowMenu.Load += (s, e) =>
|
||||
{
|
||||
var firstBackgroundColor = this.Parents<GuiWidget>().Where(p => p.BackgroundColor.Alpha0To1 == 1).FirstOrDefault()?.BackgroundColor;
|
||||
overflowMenu.BackgroundColor = firstBackgroundColor ?? Color.Transparent;
|
||||
};
|
||||
this.AddChild(overflowMenu);
|
||||
|
||||
if (printer != null)
|
||||
{
|
||||
printer.Bed.Scene.SelectionChanged += Scene_SelectionChanged;
|
||||
|
|
@ -441,6 +407,42 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private OverflowMenu CreateBedMenu(BedConfig sceneContext, ThemeConfig theme)
|
||||
{
|
||||
var buttonView = new FlowLayoutWidget();
|
||||
buttonView.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon((IsPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme))
|
||||
{
|
||||
VAnchor = VAnchor.Center,
|
||||
Margin = theme.ButtonSpacing,
|
||||
});
|
||||
|
||||
var buttonText = (IsPrinterMode) ? "Bed".Localize() : "Part".Localize();
|
||||
buttonView.AddChild(new TextButton(buttonText, theme)
|
||||
{
|
||||
Padding = new BorderDouble(8, 4, 0, 4)
|
||||
});
|
||||
|
||||
var overflowMenu = new OverflowMenu(buttonView)
|
||||
{
|
||||
Name = "Bed Options Menu",
|
||||
DynamicPopupContent = () => theme.CreatePopupMenu(this.BedMenuActions(sceneContext)),
|
||||
DrawArrow = true,
|
||||
AlignToRightEdge = true,
|
||||
Margin = new BorderDouble(right: theme.ButtonSpacing.Left),
|
||||
};
|
||||
|
||||
// HACK: Fix left padding to improve style. Ideally fix this in the underlying button
|
||||
var firstChild = overflowMenu.Children.First();
|
||||
firstChild.Margin = firstChild.Margin.Clone(left: 8);
|
||||
|
||||
overflowMenu.Load += (s, e) =>
|
||||
{
|
||||
var firstBackgroundColor = this.Parents<GuiWidget>().Where(p => p.BackgroundColor.Alpha0To1 == 1).FirstOrDefault()?.BackgroundColor;
|
||||
overflowMenu.BackgroundColor = firstBackgroundColor ?? Color.Transparent;
|
||||
};
|
||||
return overflowMenu;
|
||||
}
|
||||
|
||||
private void SwitchModes_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (sender is GuiWidget widget)
|
||||
|
|
|
|||
|
|
@ -56,8 +56,11 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
foreach (GCodeMacro macro in printer.Settings.GetMacros(MacroUiLocation.Controls))
|
||||
{
|
||||
Button macroButton = theme.HomingButtons.Generate(GCodeMacro.FixMacroName(macro.Name));
|
||||
macroButton.Margin = new BorderDouble(right: 5);
|
||||
var macroButton = new TextButton(GCodeMacro.FixMacroName(macro.Name), theme)
|
||||
{
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = new BorderDouble(right: 5)
|
||||
};
|
||||
macroButton.Click += (s, e) => macro.Run(printer.Connection);
|
||||
|
||||
this.AddChild(macroButton);
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
var homeIcon = new IconButton(AggContext.StaticData.LoadIcon("fa-home_16.png", IconColor.Theme), theme)
|
||||
{
|
||||
ToolTipText = ToolTipText = "Home X, Y and Z".Localize(),
|
||||
BackgroundColor = theme.ActiveTabColor,
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
homeIcon.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ);
|
||||
|
|
@ -157,7 +157,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
var homeXButton = new TextButton("X", theme)
|
||||
{
|
||||
ToolTipText = "Home X".Localize(),
|
||||
BackgroundColor = theme.ActiveTabColor,
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
homeXButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.X);
|
||||
|
|
@ -166,7 +166,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
var homeYButton = new TextButton("Y", theme)
|
||||
{
|
||||
ToolTipText = "Home Y".Localize(),
|
||||
BackgroundColor = theme.ActiveTabColor,
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
homeYButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.Y);
|
||||
|
|
@ -175,7 +175,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
var homeZButton = new TextButton("Z", theme)
|
||||
{
|
||||
ToolTipText = "Home Z".Localize(),
|
||||
BackgroundColor = theme.ActiveTabColor,
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
homeZButton.Click += (s, e) => printer.Connection.HomeAxis(PrinterConnection.Axis.Z);
|
||||
|
|
@ -199,7 +199,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
// Create 'Release' button
|
||||
var disableMotors = new TextButton("Release".Localize(), theme)
|
||||
{
|
||||
BackgroundColor = theme.ActiveTabColor,
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
};
|
||||
disableMotors.Click += (s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.ConfigurationPage;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
||||
|
|
@ -39,44 +40,60 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
public class PowerControls : FlowLayoutWidget
|
||||
{
|
||||
private EventHandler unregisterEvents;
|
||||
private CheckBox atxPowertoggleSwitch;
|
||||
private PrinterConfig printer;
|
||||
private SettingsItem settingsItem;
|
||||
|
||||
private PowerControls(PrinterConfig printer)
|
||||
private PowerControls(PrinterConfig printer, ThemeConfig theme)
|
||||
: base(FlowDirection.TopToBottom)
|
||||
{
|
||||
this.printer = printer;
|
||||
this.HAnchor = HAnchor.Stretch;
|
||||
this.VAnchor = VAnchor.Stretch;
|
||||
this.Visible = printer.Settings.GetValue<bool>(SettingsKey.has_power_control);
|
||||
this.Enabled = printer.Connection.PrinterIsConnected;
|
||||
|
||||
atxPowertoggleSwitch = ImageButtonFactory.CreateToggleSwitch(false);
|
||||
atxPowertoggleSwitch.HAnchor = HAnchor.Left;
|
||||
atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6);
|
||||
atxPowertoggleSwitch.CheckedStateChanged += (sender, e) =>
|
||||
{
|
||||
printer.Connection.AtxPowerEnabled = atxPowertoggleSwitch.Checked;
|
||||
};
|
||||
this.AddChild(atxPowertoggleSwitch);
|
||||
this.AddChild(
|
||||
settingsItem = new SettingsItem(
|
||||
"ATX Power Control".Localize(),
|
||||
theme.Colors.PrimaryTextColor,
|
||||
new SettingsItem.ToggleSwitchConfig()
|
||||
{
|
||||
Checked = printer.Connection.AtxPowerEnabled,
|
||||
ToggleAction = (itemChecked) =>
|
||||
{
|
||||
if (printer.Connection.AtxPowerEnabled != itemChecked)
|
||||
{
|
||||
printer.Connection.AtxPowerEnabled = itemChecked;
|
||||
}
|
||||
}
|
||||
},
|
||||
enforceGutter: false));
|
||||
|
||||
printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
this.Visible = printer.Settings.GetValue<bool>(SettingsKey.has_power_control);
|
||||
this.Enabled = printer.Connection.PrinterIsConnected;
|
||||
this.Enabled = printer.Connection.PrinterIsConnected
|
||||
&& printer.Settings.GetValue<bool>(SettingsKey.has_power_control);
|
||||
}, ref unregisterEvents);
|
||||
|
||||
printer.Connection.AtxPowerStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
this.atxPowertoggleSwitch.Checked = printer.Connection.AtxPowerEnabled;
|
||||
if (settingsItem.SettingsControl is ICheckbox toggleSwitch)
|
||||
{
|
||||
if (toggleSwitch.Checked != printer.Connection.AtxPowerEnabled)
|
||||
{
|
||||
toggleSwitch.Checked = printer.Connection.AtxPowerEnabled;
|
||||
}
|
||||
}
|
||||
}, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public static SectionWidget CreateSection(PrinterConfig printer, ThemeConfig theme)
|
||||
{
|
||||
if (!printer.Settings.GetValue<bool>(SettingsKey.has_power_control))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new SectionWidget(
|
||||
"ATX Power Control".Localize(),
|
||||
new PowerControls(printer),
|
||||
"Power Control".Localize(),
|
||||
new PowerControls(printer, theme),
|
||||
theme);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,12 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public GuiWidget RegisterSection(SectionWidget sectionWidget)
|
||||
{
|
||||
// Section not active due to constraints
|
||||
if (sectionWidget == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ApplicationController.Instance.Theme.BoxStyleSectionWidget(sectionWidget);
|
||||
|
||||
column.AddChild(sectionWidget);
|
||||
|
|
|
|||
|
|
@ -176,10 +176,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
unregisterEvents?.Invoke(this, null);
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public DialogPage(string cancelButtonText = null)
|
||||
{
|
||||
var theme = ApplicationController.Instance.Theme;
|
||||
if (cancelButtonText == null)
|
||||
{
|
||||
cancelButtonText = "Cancel".Localize();
|
||||
|
|
@ -77,7 +78,7 @@ namespace MatterHackers.MatterControl
|
|||
mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
Padding = new BorderDouble(12, 12, 12, 0),
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor
|
||||
BackgroundColor = theme.Colors.PrimaryBackgroundColor
|
||||
};
|
||||
mainContainer.AnchorAll();
|
||||
|
||||
|
|
@ -90,7 +91,7 @@ namespace MatterHackers.MatterControl
|
|||
HAnchor = HAnchor.Stretch
|
||||
};
|
||||
|
||||
headerLabel = new WrappedTextWidget("Setup Wizard".Localize(), pointSize: 24, textColor: ActiveTheme.Instance.SecondaryAccentColor)
|
||||
headerLabel = new WrappedTextWidget("Setup Wizard".Localize(), pointSize: 24, textColor: theme.Colors.SecondaryAccentColor)
|
||||
{
|
||||
HAnchor = HAnchor.Stretch
|
||||
};
|
||||
|
|
@ -100,7 +101,7 @@ namespace MatterHackers.MatterControl
|
|||
contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
Padding = new BorderDouble(10),
|
||||
BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor,
|
||||
BackgroundColor = theme.MinimalShade,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Stretch
|
||||
};
|
||||
|
|
@ -125,7 +126,7 @@ namespace MatterHackers.MatterControl
|
|||
headerRow.Padding = new BorderDouble(0, 3, 0, 3);
|
||||
|
||||
headerLabel.TextWidget.PointSize = 14;
|
||||
headerLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
headerLabel.TextColor = theme.Colors.PrimaryTextColor;
|
||||
contentRow.Padding = new BorderDouble(5);
|
||||
footerRow.Margin = new BorderDouble(0, 3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
VAnchor = VAnchor.Fit,
|
||||
HAnchor = HAnchor.Stretch,
|
||||
Padding = new BorderDouble(10, 10, 13, 6),
|
||||
Padding = new BorderDouble(10, 0, 12, 10),
|
||||
};
|
||||
|
||||
bool isFirstSection = true;
|
||||
|
|
@ -242,12 +242,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
string groupName = (group.Name.Contains("!hidden")) ? "" : group.Name;
|
||||
|
||||
var sectionWidget = new SectionWidget(groupName, groupPanel, theme, expanded: expanded)
|
||||
{
|
||||
Margin = new BorderDouble(bottom: 8),
|
||||
};
|
||||
|
||||
var sectionWidget = new SectionWidget(groupName, groupPanel, theme, expanded: expanded);
|
||||
theme.BoxStyleSectionWidget(sectionWidget);
|
||||
sectionWidget.Margin = new BorderDouble(bottom: 10);
|
||||
|
||||
if (string.IsNullOrEmpty(groupName))
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 614 B After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 590 B After Width: | Height: | Size: 1.2 KiB |
Loading…
Add table
Add a link
Reference in a new issue