Merge remote-tracking branch 'origin/development-kp' into development
Conflicts: PrinterControls/ManualPrinterControls.cs
This commit is contained in:
commit
f2b11e2a33
22 changed files with 931 additions and 291 deletions
|
|
@ -332,7 +332,7 @@ namespace MatterHackers.MatterControl
|
|||
checkUpdateLink.Visible = false;
|
||||
}
|
||||
|
||||
MainSlidePanel.Instance.SetUpdateNotification(this, null);
|
||||
//MainSlidePanel.Instance.SetUpdateNotification(this, null);
|
||||
}
|
||||
|
||||
void onVersionRequestFailed(object sender, EventArgs e)
|
||||
|
|
@ -454,7 +454,7 @@ namespace MatterHackers.MatterControl
|
|||
learnMoreLink.Margin = new BorderDouble(0, 5);
|
||||
topToBottom.AddChild(learnMoreLink);
|
||||
|
||||
TextWidget copyrightText = new TextWidget(string.Format(new LocalizedString("Copyright © 2013 MatterHackers, Inc.").Translated), textColor: offWhite);
|
||||
TextWidget copyrightText = new TextWidget(string.Format(new LocalizedString("Copyright © 2014 MatterHackers, Inc.").Translated), textColor: offWhite);
|
||||
copyrightText.HAnchor = Agg.UI.HAnchor.ParentCenter;
|
||||
topToBottom.AddChild(copyrightText);
|
||||
|
||||
415
ConfigurationPage/ConfigurationPage.cs
Normal file
415
ConfigurationPage/ConfigurationPage.cs
Normal file
|
|
@ -0,0 +1,415 @@
|
|||
/*
|
||||
Copyright (c) 2014, Kevin Pope
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.IO.Ports;
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class ConfigurationPage : ScrollableWidget
|
||||
{
|
||||
public ConfigurationPage()
|
||||
: base(true)
|
||||
{
|
||||
ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
|
||||
AnchorAll();
|
||||
AddChild(new ConfigurationWidget());
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfigurationWidget : GuiWidget
|
||||
{
|
||||
readonly int TallButtonHeight = 25;
|
||||
|
||||
Button enablePrintLevelingButton;
|
||||
Button disablePrintLevelingButton;
|
||||
|
||||
DisableableWidget eePromControlsContainer;
|
||||
DisableableWidget printLevelContainer;
|
||||
|
||||
TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
|
||||
|
||||
public ConfigurationWidget()
|
||||
{
|
||||
SetDisplayAttributes();
|
||||
|
||||
HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
|
||||
VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
|
||||
FlowLayoutWidget mainLayoutContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
mainLayoutContainer.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
|
||||
mainLayoutContainer.VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
mainLayoutContainer.Padding = new BorderDouble(3, 0, 3, 10);
|
||||
|
||||
AddEePromControls(mainLayoutContainer);
|
||||
AddPrintLevelingControls(mainLayoutContainer);
|
||||
AddChild(mainLayoutContainer);
|
||||
|
||||
AddHandlers();
|
||||
SetVisibleControls();
|
||||
}
|
||||
|
||||
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout)
|
||||
{
|
||||
GroupBox eePromControlsGroupBox = new GroupBox(new LocalizedString("EEProm Settings").Translated);
|
||||
|
||||
eePromControlsGroupBox.Margin = new BorderDouble(0);
|
||||
eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
eePromControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
|
||||
eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
eePromControlsGroupBox.Height = 68;
|
||||
|
||||
{
|
||||
FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget();
|
||||
eePromControlsLayout.HAnchor |= HAnchor.ParentLeftRight;
|
||||
eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter;
|
||||
eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6);
|
||||
eePromControlsLayout.Padding = new BorderDouble(0);
|
||||
{
|
||||
Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer();
|
||||
ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage);
|
||||
ImageWidget eePromIcon = new ImageWidget(eePromImage);
|
||||
eePromIcon.Margin = new BorderDouble (right: 6);
|
||||
|
||||
Button openEePromWindow = textImageButtonFactory.Generate(new LocalizedString("CONFIGURE").Translated);
|
||||
openEePromWindow.Click += (sender, e) =>
|
||||
{
|
||||
#if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware.
|
||||
new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
|
||||
#else
|
||||
switch(PrinterCommunication.Instance.FirmwareType)
|
||||
{
|
||||
case PrinterCommunication.FirmwareTypes.Repetier:
|
||||
new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
|
||||
break;
|
||||
|
||||
case PrinterCommunication.FirmwareTypes.Marlin:
|
||||
new MatterHackers.MatterControl.EeProm.EePromMarlinWidget();
|
||||
break;
|
||||
|
||||
default:
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
string message = new LocalizedString("Oops! There is no eeprom mapping for your printer's firmware.").Translated;
|
||||
StyledMessageBox.ShowMessageBox(message, "Warning no eeprom mapping", StyledMessageBox.MessageType.OK);
|
||||
}
|
||||
);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
//eePromControlsLayout.AddChild(eePromIcon);
|
||||
eePromControlsLayout.AddChild(openEePromWindow);
|
||||
}
|
||||
|
||||
eePromControlsGroupBox.AddChild(eePromControlsLayout);
|
||||
}
|
||||
|
||||
eePromControlsContainer = new DisableableWidget();
|
||||
eePromControlsContainer.AddChild(eePromControlsGroupBox);
|
||||
|
||||
controlsTopToBottomLayout.AddChild(eePromControlsContainer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static GuiWidget CreateSeparatorLine()
|
||||
{
|
||||
GuiWidget topLine = new GuiWidget(10, 1);
|
||||
topLine.Margin = new BorderDouble(0, 5);
|
||||
topLine.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
topLine.BackgroundColor = RGBA_Bytes.White;
|
||||
return topLine;
|
||||
}
|
||||
|
||||
NumberEdit feedRateValue;
|
||||
Slider feedRateRatioSlider;
|
||||
Slider extrusionRatioSlider;
|
||||
NumberEdit extrusionValue;
|
||||
PrintLevelWizardWindow printLevelWizardWindow;
|
||||
|
||||
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
|
||||
TextWidget printLevelingStatusLabel;
|
||||
|
||||
private void AddPrintLevelingControls(FlowLayoutWidget controlsTopToBottomLayout)
|
||||
{
|
||||
printLevelContainer = new DisableableWidget();
|
||||
printLevelContainer.AddChild(CreatePrintLevelingControlsContainer());
|
||||
controlsTopToBottomLayout.AddChild(printLevelContainer);
|
||||
}
|
||||
|
||||
private GuiWidget CreatePrintLevelingControlsContainer()
|
||||
{
|
||||
GroupBox printLevelingControlsContainer;
|
||||
printLevelingControlsContainer = new GroupBox(new LocalizedString("Automatic Calibration").Translated);
|
||||
|
||||
printLevelingControlsContainer.Margin = new BorderDouble(0);
|
||||
printLevelingControlsContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printLevelingControlsContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printLevelingControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
printLevelingControlsContainer.Height = 68;
|
||||
|
||||
{
|
||||
FlowLayoutWidget buttonBar = new FlowLayoutWidget();
|
||||
buttonBar.HAnchor |= HAnchor.ParentLeftRight;
|
||||
buttonBar.VAnchor |= Agg.UI.VAnchor.ParentCenter;
|
||||
buttonBar.Margin = new BorderDouble(0, 0, 0, 0);
|
||||
buttonBar.Padding = new BorderDouble(0);
|
||||
|
||||
this.textImageButtonFactory.FixedHeight = TallButtonHeight;
|
||||
|
||||
Button runPrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("CONFIGURE").Translated);
|
||||
runPrintLevelingButton.Margin = new BorderDouble(left:6);
|
||||
runPrintLevelingButton.VAnchor = VAnchor.ParentCenter;
|
||||
runPrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(runPrintLeveling_Click);
|
||||
|
||||
Agg.Image.ImageBuffer levelingImage = new Agg.Image.ImageBuffer();
|
||||
ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), levelingImage);
|
||||
ImageWidget levelingIcon = new ImageWidget(levelingImage);
|
||||
levelingIcon.Margin = new BorderDouble (right: 6);
|
||||
|
||||
enablePrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("ENABLE").Translated);
|
||||
enablePrintLevelingButton.Margin = new BorderDouble(left:6);
|
||||
enablePrintLevelingButton.VAnchor = VAnchor.ParentCenter;
|
||||
enablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(enablePrintLeveling_Click);
|
||||
|
||||
disablePrintLevelingButton = textImageButtonFactory.Generate(new LocalizedString("DISABLE").Translated);
|
||||
disablePrintLevelingButton.Margin = new BorderDouble(left:6);
|
||||
disablePrintLevelingButton.VAnchor = VAnchor.ParentCenter;
|
||||
disablePrintLevelingButton.Click += new ButtonBase.ButtonEventHandler(disablePrintLeveling_Click);
|
||||
|
||||
CheckBox doLevelingCheckBox = new CheckBox(new LocalizedString("Enable Automatic Print Leveling").Translated);
|
||||
doLevelingCheckBox.Margin = new BorderDouble(left: 3);
|
||||
doLevelingCheckBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
doLevelingCheckBox.VAnchor = VAnchor.ParentCenter;
|
||||
doLevelingCheckBox.Checked = ActivePrinterProfile.Instance.DoPrintLeveling;
|
||||
|
||||
printLevelingStatusLabel = new TextWidget ("");
|
||||
printLevelingStatusLabel.AutoExpandBoundsToText = true;
|
||||
printLevelingStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printLevelingStatusLabel.VAnchor = VAnchor.ParentCenter;
|
||||
|
||||
GuiWidget hSpacer = new GuiWidget ();
|
||||
hSpacer.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
||||
buttonBar.AddChild(levelingIcon);
|
||||
//buttonBar.AddChild(doLevelingCheckBox);
|
||||
buttonBar.AddChild (printLevelingStatusLabel);
|
||||
buttonBar.AddChild (hSpacer);
|
||||
buttonBar.AddChild(enablePrintLevelingButton);
|
||||
buttonBar.AddChild(disablePrintLevelingButton);
|
||||
buttonBar.AddChild(runPrintLevelingButton);
|
||||
doLevelingCheckBox.CheckedStateChanged += (sender, e) =>
|
||||
{
|
||||
ActivePrinterProfile.Instance.DoPrintLeveling = doLevelingCheckBox.Checked;
|
||||
};
|
||||
ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) =>
|
||||
{
|
||||
SetPrintLevelButtonVisiblity();
|
||||
|
||||
}, ref unregisterEvents);
|
||||
|
||||
printLevelingControlsContainer.AddChild(buttonBar);
|
||||
}
|
||||
SetPrintLevelButtonVisiblity ();
|
||||
return printLevelingControlsContainer;
|
||||
}
|
||||
|
||||
private void OpenPrintLevelWizard()
|
||||
{
|
||||
if (printLevelWizardWindow == null)
|
||||
{
|
||||
printLevelWizardWindow = new PrintLevelWizardWindow();
|
||||
printLevelWizardWindow.Closed += (sender, e) =>
|
||||
{
|
||||
printLevelWizardWindow = null;
|
||||
};
|
||||
printLevelWizardWindow.ShowAsSystemWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
printLevelWizardWindow.BringToFront();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetDisplayAttributes()
|
||||
{
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
this.textImageButtonFactory.normalFillColor = RGBA_Bytes.White;
|
||||
this.textImageButtonFactory.disabledFillColor = RGBA_Bytes.White;
|
||||
|
||||
this.textImageButtonFactory.FixedHeight = TallButtonHeight;
|
||||
this.textImageButtonFactory.fontSize = 11;
|
||||
|
||||
this.textImageButtonFactory.disabledTextColor = RGBA_Bytes.DarkGray;
|
||||
this.textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
this.textImageButtonFactory.normalTextColor = RGBA_Bytes.Black;
|
||||
this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
}
|
||||
|
||||
private void SetVisibleControls()
|
||||
{
|
||||
if (ActivePrinterProfile.Instance.ActivePrinter == null)
|
||||
{
|
||||
// no printer selected
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
}
|
||||
else // we at least have a printer selected
|
||||
{
|
||||
switch (PrinterCommunication.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterCommunication.CommunicationStates.Disconnecting:
|
||||
case PrinterCommunication.CommunicationStates.ConnectionLost:
|
||||
case PrinterCommunication.CommunicationStates.Disconnected:
|
||||
case PrinterCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterCommunication.CommunicationStates.FailedToConnect:
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
case PrinterCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterCommunication.CommunicationStates.Connected:
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
break;
|
||||
|
||||
case PrinterCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterCommunication.CommunicationStates.Printing:
|
||||
switch (PrinterCommunication.Instance.PrintingState)
|
||||
{
|
||||
case PrinterCommunication.DetailedPrintingState.HomingAxis:
|
||||
case PrinterCommunication.DetailedPrintingState.HeatingBed:
|
||||
case PrinterCommunication.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterCommunication.DetailedPrintingState.Printing:
|
||||
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
break;
|
||||
|
||||
case PrinterCommunication.CommunicationStates.Paused:
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
event EventHandler unregisterEvents;
|
||||
private void AddHandlers()
|
||||
{
|
||||
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
|
||||
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
SetVisibleControls();
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
private void onThemeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
SetVisibleControls();
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
void enablePrintLeveling_Click(object sender, MouseEventArgs mouseEvent)
|
||||
{
|
||||
ActivePrinterProfile.Instance.DoPrintLeveling = true;
|
||||
}
|
||||
|
||||
void disablePrintLeveling_Click(object sender, MouseEventArgs mouseEvent)
|
||||
{
|
||||
ActivePrinterProfile.Instance.DoPrintLeveling = false;
|
||||
}
|
||||
|
||||
void SetPrintLevelButtonVisiblity()
|
||||
{
|
||||
enablePrintLevelingButton.Visible = !ActivePrinterProfile.Instance.DoPrintLeveling;
|
||||
disablePrintLevelingButton.Visible = ActivePrinterProfile.Instance.DoPrintLeveling;
|
||||
|
||||
if (ActivePrinterProfile.Instance.DoPrintLeveling) {
|
||||
printLevelingStatusLabel.Text = new LocalizedString ("Automatic Print Leveling (enabled)").Translated;
|
||||
}
|
||||
else
|
||||
{
|
||||
printLevelingStatusLabel.Text = new LocalizedString ("Automatic Print Leveling (disabled)").Translated;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClosing(out bool CancelClose)
|
||||
{
|
||||
base.OnClosing(out CancelClose);
|
||||
}
|
||||
|
||||
void runPrintLeveling_Click(object sender, MouseEventArgs mouseEvent)
|
||||
{
|
||||
OpenPrintLevelWizard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,20 @@ namespace MatterHackers.MatterControl
|
|||
private int borderWidth = 0;
|
||||
private RGBA_Bytes borderColor = RGBA_Bytes.Black;
|
||||
|
||||
public ClickWidget()
|
||||
: base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ClickWidget(double width, double height)
|
||||
: base(width, height)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int BorderWidth
|
||||
{
|
||||
get { return borderWidth; }
|
||||
|
|
|
|||
61
CustomWidgets/DisableableWidget.cs
Normal file
61
CustomWidgets/DisableableWidget.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MatterHackers.MatterControl.CustomWidgets
|
||||
{
|
||||
public class DisableableWidget : GuiWidget
|
||||
{
|
||||
public GuiWidget disableOverlay;
|
||||
|
||||
public DisableableWidget()
|
||||
{
|
||||
HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
|
||||
disableOverlay = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
|
||||
disableOverlay.Visible = false;
|
||||
base.AddChild(disableOverlay);
|
||||
}
|
||||
|
||||
public enum EnableLevel { Disabled, ConfigOnly, Enabled };
|
||||
|
||||
public void SetEnableLevel(EnableLevel enabledLevel)
|
||||
{
|
||||
disableOverlay.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 160);
|
||||
switch (enabledLevel)
|
||||
{
|
||||
case EnableLevel.Disabled:
|
||||
disableOverlay.Margin = new BorderDouble(0);
|
||||
disableOverlay.Visible = true;
|
||||
break;
|
||||
|
||||
case EnableLevel.ConfigOnly:
|
||||
disableOverlay.Margin = new BorderDouble(10, 10, 10, 15);
|
||||
disableOverlay.Visible = true;
|
||||
break;
|
||||
|
||||
case EnableLevel.Enabled:
|
||||
disableOverlay.Visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
|
||||
{
|
||||
if (indexInChildrenList == -1)
|
||||
{
|
||||
// put it under the disableOverlay
|
||||
base.AddChild(childToAdd, Children.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.AddChild(childToAdd, indexInChildrenList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ using MatterHackers.Localizations;
|
|||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class MainSlidePanel : SlidePanel
|
||||
public class MainSlidePanel : GuiWidget
|
||||
{
|
||||
SimpleTextTabWidget aboutTabView;
|
||||
static MainSlidePanel globalInstance;
|
||||
|
|
@ -61,10 +61,81 @@ namespace MatterHackers.MatterControl
|
|||
SliceSettingsWidget sliceSettingsWidget;
|
||||
TabControl advancedControls;
|
||||
private delegate void ReloadPanel();
|
||||
event EventHandler unregisterEvents;
|
||||
public RootedObjectEventHandler ReloadPanelTrigger = new RootedObjectEventHandler();
|
||||
public RootedObjectEventHandler SetUpdateNotificationTrigger = new RootedObjectEventHandler();
|
||||
|
||||
|
||||
public MainSlidePanel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddElements()
|
||||
{
|
||||
//this.AddChild(new MainSlide());
|
||||
this.AddChild(new WidescreenPanel());
|
||||
this.AnchorAll();
|
||||
SetUpdateNotification(this, null);
|
||||
}
|
||||
|
||||
public static MainSlidePanel Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (globalInstance == null)
|
||||
{
|
||||
globalInstance = new MainSlidePanel();
|
||||
globalInstance.AddElements();
|
||||
}
|
||||
return globalInstance;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
void DoNotChangePanel()
|
||||
{
|
||||
//Empty function used as placeholder
|
||||
}
|
||||
|
||||
|
||||
public void SetUpdateNotification(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
SetUpdateNotificationTrigger.CallEvents(this, null);
|
||||
}
|
||||
|
||||
public void ReloadBackPanel()
|
||||
{
|
||||
ReloadPanelTrigger.CallEvents(this, null);
|
||||
}
|
||||
|
||||
void OnReloadBackPanel(EventArgs e)
|
||||
{
|
||||
ReloadPanelTrigger.CallEvents(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public class MainSlide : SlidePanel
|
||||
{
|
||||
SimpleTextTabWidget aboutTabView;
|
||||
TabControl advancedControlsTabControl;
|
||||
TabControl mainControlsTabControl;
|
||||
SliceSettingsWidget sliceSettingsWidget;
|
||||
TabControl advancedControls;
|
||||
private delegate void ReloadPanel();
|
||||
public TabPage QueueTabPage;
|
||||
public TabPage AboutTabPage;
|
||||
TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
|
||||
RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;
|
||||
static MainSlide globalInstance;
|
||||
|
||||
GuiWidget LeftPanel
|
||||
{
|
||||
|
|
@ -76,8 +147,13 @@ namespace MatterHackers.MatterControl
|
|||
get { return GetPannel(1); }
|
||||
}
|
||||
|
||||
public MainSlidePanel()
|
||||
public MainSlide()
|
||||
: base(2)
|
||||
{
|
||||
AddElements();
|
||||
}
|
||||
|
||||
public void AddElements()
|
||||
{
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);
|
||||
|
||||
|
|
@ -91,25 +167,26 @@ namespace MatterHackers.MatterControl
|
|||
mainControlsTabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
mainControlsTabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
mainControlsTabControl.TabBar.Margin = new BorderDouble(0, 0);
|
||||
mainControlsTabControl.TabBar.Padding = new BorderDouble(0, 2);
|
||||
mainControlsTabControl.TabBar.Padding = new BorderDouble(0, 2);
|
||||
|
||||
QueueTabPage = new TabPage(new QueueControlsWidget(), "Queue");
|
||||
NumQueueItemsChanged(this, null);
|
||||
|
||||
mainControlsTabControl.AddTab(new SimpleTextTabWidget(QueueTabPage, 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
//mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new GuiWidget(), "History"), 18,
|
||||
// ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string libraryTabLabel = new LocalizedString("Library").Translated;
|
||||
string libraryTabLabel = new LocalizedString("Library").Translated;
|
||||
|
||||
mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new PrintLibraryWidget(),libraryTabLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new PrintLibraryWidget(), libraryTabLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
//mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new ToolsWidget(), "Tools"), 18,
|
||||
//ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
//ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
AboutTabPage = new TabPage(new AboutPage(),new LocalizedString("About").Translated);
|
||||
AboutTabPage = new TabPage(new AboutPage(), new LocalizedString("About").Translated);
|
||||
aboutTabView = new SimpleTextTabWidget(AboutTabPage, 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
|
||||
mainControlsTabControl.AddTab(aboutTabView);
|
||||
|
|
@ -125,8 +202,8 @@ namespace MatterHackers.MatterControl
|
|||
advancedControlsButtonFactory.disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
advancedControlsButtonFactory.invertImageLocation = true;
|
||||
Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(new LocalizedString("Advanced\nControls").Translated, "icon_arrow_right_32x32.png");
|
||||
advancedControlsLinkButton.Margin = new BorderDouble(right:3);
|
||||
Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(new LocalizedString("Advanced\nControls").Translated, "icon_arrow_right_32x32.png");
|
||||
advancedControlsLinkButton.Margin = new BorderDouble(right: 3);
|
||||
advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
|
||||
advancedControlsLinkButton.Cursor = Cursors.Hand;
|
||||
advancedControlsLinkButton.Click += new ButtonBase.ButtonEventHandler(AdvancedControlsButton_Click);
|
||||
|
|
@ -141,7 +218,7 @@ namespace MatterHackers.MatterControl
|
|||
// and add it
|
||||
this.LeftPanel.AddChild(mainControlsTabControl);
|
||||
|
||||
SetUpdateNotification(this, null);
|
||||
|
||||
}
|
||||
|
||||
// do the back panel
|
||||
|
|
@ -155,19 +232,19 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
void AdvancedControlsButton_Click(object sender, MouseEventArgs mouseEvent)
|
||||
{
|
||||
if (MainSlidePanel.Instance.PannelIndex == 0)
|
||||
if (this.PannelIndex == 0)
|
||||
{
|
||||
MainSlidePanel.Instance.PannelIndex = 1;
|
||||
this.PannelIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainSlidePanel.Instance.PannelIndex = 0;
|
||||
this.PannelIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void onMouseEnterBoundsAdvancedControlsLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText(new LocalizedString("View Manual Printer Controls and Slicing Settings").Translated);
|
||||
HelpTextWidget.Instance.ShowHoverText(new LocalizedString("View Manual Printer Controls and Slicing Settings").Translated);
|
||||
}
|
||||
|
||||
void onMouseLeaveBoundsAdvancedControlsLink(Object sender, EventArgs e)
|
||||
|
|
@ -177,7 +254,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
void onMouseEnterBoundsPrintQueueLink(Object sender, EventArgs e)
|
||||
{
|
||||
HelpTextWidget.Instance.ShowHoverText(new LocalizedString("View Queue and Library").Translated);
|
||||
HelpTextWidget.Instance.ShowHoverText(new LocalizedString("View Queue and Library").Translated);
|
||||
}
|
||||
|
||||
void onMouseLeaveBoundsPrintQueueLink(Object sender, EventArgs e)
|
||||
|
|
@ -185,13 +262,13 @@ namespace MatterHackers.MatterControl
|
|||
HelpTextWidget.Instance.HideHoverText();
|
||||
}
|
||||
|
||||
public static MainSlidePanel Instance
|
||||
public static MainSlide Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (globalInstance == null)
|
||||
{
|
||||
globalInstance = new MainSlidePanel();
|
||||
globalInstance = new MainSlide();
|
||||
}
|
||||
return globalInstance;
|
||||
}
|
||||
|
|
@ -226,7 +303,7 @@ namespace MatterHackers.MatterControl
|
|||
// set the selected tab back to the one it was before we replace the control
|
||||
this.advancedControlsTabControl.SelectTab(topTabIndex);
|
||||
|
||||
// This is a hack to make the pannel remain on the screen. It would be great to debug it and understand
|
||||
// This is a hack to make the panel remain on the screen. It would be great to debug it and understand
|
||||
// why it does not work without this code in here.
|
||||
RectangleDouble localBounds = this.LocalBounds;
|
||||
this.LocalBounds = new RectangleDouble(0, 0, this.LocalBounds.Width - 1, 10);
|
||||
|
|
@ -239,10 +316,10 @@ namespace MatterHackers.MatterControl
|
|||
advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
advancedControls.TabBar.BorderColor = RGBA_Bytes.White;
|
||||
advancedControls.TabBar.Margin = new BorderDouble(0, 0);
|
||||
advancedControls.TabBar.Padding = new BorderDouble(0,2);
|
||||
advancedControls.TabBar.Padding = new BorderDouble(0, 2);
|
||||
|
||||
advancedControlsButtonFactory.invertImageLocation = false;
|
||||
Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(new LocalizedString("Print\nQueue").Translated, "icon_arrow_left_32x32.png");
|
||||
Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate(new LocalizedString("Print\nQueue").Translated, "icon_arrow_left_32x32.png");
|
||||
advancedControlsLinkButton.Margin = new BorderDouble(right: 3);
|
||||
advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
|
||||
advancedControlsLinkButton.Cursor = Cursors.Hand;
|
||||
|
|
@ -258,12 +335,19 @@ namespace MatterHackers.MatterControl
|
|||
manualPrinterControlsScrollArea.AnchorAll();
|
||||
manualPrinterControlsScrollArea.AddChild(manualPrinterControls);
|
||||
|
||||
string printerControlsLabel = new LocalizedString ("Printer Controls").Translated;
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), 18,
|
||||
//Add the tab contents for 'Advanced Controls'
|
||||
string printerControlsLabel = new LocalizedString("Controls").Translated;
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string sliceSettingsLabel = new LocalizedString("Slice Settings").Translated;
|
||||
sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, new LocalizedString("Slice Settings").Translated), 18,
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string configurationLabel = new LocalizedString("Configuration").Translated;
|
||||
ScrollableWidget configurationControls = new ConfigurationPage();
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
return advancedControls;
|
||||
|
|
@ -290,6 +374,8 @@ namespace MatterHackers.MatterControl
|
|||
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
|
||||
PrintQueue.PrintQueueControl.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
|
||||
PrintQueue.PrintQueueControl.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
|
||||
MainSlidePanel.Instance.SetUpdateNotificationTrigger.RegisterEvent(OnSetUpdateNotification, ref unregisterEvents);
|
||||
MainSlidePanel.Instance.ReloadPanelTrigger.RegisterEvent(ReloadBackPanel, ref unregisterEvents);
|
||||
}
|
||||
|
||||
class NotificationWidget : GuiWidget
|
||||
|
|
@ -310,7 +396,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
GuiWidget addedUpdateMark = null;
|
||||
public void SetUpdateNotification(object sender, EventArgs widgetEvent)
|
||||
public void OnSetUpdateNotification(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
if (this.UpdateIsAvailable() || UpdateControl.NeedToCheckForUpdateFirstTimeEver)
|
||||
{
|
||||
|
|
@ -322,8 +408,6 @@ namespace MatterHackers.MatterControl
|
|||
addedUpdateMark.OriginRelativeParent = new Vector2(63, 10);
|
||||
aboutTabView.AddChild(addedUpdateMark);
|
||||
}
|
||||
#else
|
||||
AboutTabPage.Text = string.Format("About (!)");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -338,9 +422,9 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
void NumQueueItemsChanged(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
string queueStringBeg = new LocalizedString("Queue").Translated;
|
||||
string queueString = string.Format("{1} ({0})",PrintQueue.PrintQueueControl.Instance.Count, queueStringBeg);
|
||||
QueueTabPage.Text = string.Format(queueString, PrintQueue.PrintQueueControl.Instance.Count);
|
||||
string queueStringBeg = new LocalizedString("Queue").Translated;
|
||||
string queueString = string.Format("{1} ({0})", PrintQueue.PrintQueueControl.Instance.Count, queueStringBeg);
|
||||
QueueTabPage.Text = string.Format(queueString, PrintQueue.PrintQueueControl.Instance.Count);
|
||||
}
|
||||
|
||||
private void onThemeChanged(object sender, EventArgs e)
|
||||
|
|
@ -349,7 +433,7 @@ namespace MatterHackers.MatterControl
|
|||
this.advancedControls.Invalidate();
|
||||
}
|
||||
|
||||
public void ReloadBackPanel()
|
||||
public void ReloadBackPanel(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
sliceSettingsUiState = new SliceSettingsWidget.UiState(sliceSettingsWidget);
|
||||
UiThread.RunOnIdle(DoChangePanel);
|
||||
|
|
|
|||
|
|
@ -72,11 +72,13 @@
|
|||
<Compile Include="ActionBar\PrintActionRow.cs" />
|
||||
<Compile Include="ActionBar\PrinterActionRow.cs" />
|
||||
<Compile Include="ActionBar\PrintStatusRow.cs" />
|
||||
<Compile Include="ActivePrinterProfile.cs" />
|
||||
<Compile Include="PrinterCommunication\ActivePrinterProfile.cs" />
|
||||
<Compile Include="ConfigurationPage\ConfigurationPage.cs" />
|
||||
<Compile Include="CustomWidgets\DisableableWidget.cs" />
|
||||
<Compile Include="CustomWidgets\ExportQueueItemWindow.cs" />
|
||||
<Compile Include="CustomWidgets\ExportToFolderFeedbackWindow.cs" />
|
||||
<Compile Include="EeProm\EePromMarlinSettings.cs" />
|
||||
<Compile Include="FieldValidation.cs" />
|
||||
<Compile Include="Utilities\FieldValidation.cs" />
|
||||
<Compile Include="PartPreviewWindow\CreateDiscreteMeshes.cs" />
|
||||
<Compile Include="CustomWidgets\EditableNumberDisplay.cs" />
|
||||
<Compile Include="PartPreviewWindow\PartPreviewBaseWidget.cs" />
|
||||
|
|
@ -104,8 +106,8 @@
|
|||
<Compile Include="ToolsPage\ToolsListItem.cs" />
|
||||
<Compile Include="ToolsPage\ToolsWidget.cs" />
|
||||
<Compile Include="WidescreenPanel.cs" />
|
||||
<Compile Include="PrintLevelWizard.cs" />
|
||||
<Compile Include="ContactForm.cs" />
|
||||
<Compile Include="ConfigurationPage\PrintLevelWizard.cs" />
|
||||
<Compile Include="AboutPage\ContactForm.cs" />
|
||||
<Compile Include="CustomWidgets\ClickWidget.cs">
|
||||
<DependentUpon>ExportQueueItemWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -127,15 +129,15 @@
|
|||
<Compile Include="DataStorage\SQLiteUnix.cs" />
|
||||
<Compile Include="DataStorage\SQLiteAsync.cs" />
|
||||
<Compile Include="MainSlidePanel.cs" />
|
||||
<Compile Include="ManifestFileHandler.cs">
|
||||
<Compile Include="Utilities\ManifestFileHandler.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ControlElements\MHTextEditWidget.cs" />
|
||||
<Compile Include="PartPreviewWindow\GcodeViewBasic.cs" />
|
||||
<Compile Include="PartPreviewWindow\PartPreviewMainWindow.cs" />
|
||||
<Compile Include="PartsSheet.cs" />
|
||||
<Compile Include="JsonResponseDictionary.cs" />
|
||||
<Compile Include="PrinterCommunication.cs" />
|
||||
<Compile Include="PrintQueue\PartsSheet.cs" />
|
||||
<Compile Include="Utilities\WebUtilities\JsonResponseDictionary.cs" />
|
||||
<Compile Include="PrinterCommunication\PrinterCommunication.cs" />
|
||||
<Compile Include="PrinterControls\PrintLeveling.cs" />
|
||||
<Compile Include="PrinterControls\OutputScrollWindow.cs" />
|
||||
<Compile Include="PrinterControls\PrinterConnections\ChooseConnectionWidget.cs" />
|
||||
|
|
@ -165,9 +167,9 @@
|
|||
<Compile Include="MatterControlApplication.cs" />
|
||||
<Compile Include="PrintQueue\PrintQueueControl.cs" />
|
||||
<Compile Include="PrintQueue\PrintQueueMenu.cs" />
|
||||
<Compile Include="ProjectFileHandler.cs" />
|
||||
<Compile Include="Utilities\ProjectFileHandler.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RequestManager.cs" />
|
||||
<Compile Include="Utilities\WebUtilities\RequestManager.cs" />
|
||||
<Compile Include="PrintQueue\QueueControlsWidget.cs" />
|
||||
<Compile Include="SettingsManagement\ApplicationSettings.cs" />
|
||||
<Compile Include="SettingsManagement\UserSettings.cs" />
|
||||
|
|
@ -177,14 +179,14 @@
|
|||
<Compile Include="SlicerConfiguration\SliceSettingsWidget.cs" />
|
||||
<Compile Include="SlicerConfiguration\SliceSettingsOrganizer.cs" />
|
||||
<Compile Include="SlicerConfiguration\SlicingQueue.cs" />
|
||||
<Compile Include="TupleList.cs" />
|
||||
<Compile Include="Utilities\TupleList.cs" />
|
||||
<Compile Include="FrostedSerial\FrostedSerialPort.cs" />
|
||||
<Compile Include="FrostedSerial\FrostedSerialStream.cs" />
|
||||
<Compile Include="FrostedSerial\IFrostedSerialStream.cs" />
|
||||
<Compile Include="FrostedSerial\WinSerialStream.cs" />
|
||||
<Compile Include="VersionManagement\WebRequestHandler.cs" />
|
||||
<Compile Include="VersionManagement\VersionFileHandler.cs" />
|
||||
<Compile Include="AboutPage.cs" />
|
||||
<Compile Include="AboutPage\AboutPage.cs" />
|
||||
<Compile Include="CustomWidgets\ThemeColorSelectorWidget.cs" />
|
||||
<Compile Include="ControlElements\TextImageButtonFactory.cs" />
|
||||
<Compile Include="FrostedSerial\TermiosH.cs" />
|
||||
|
|
|
|||
|
|
@ -128,8 +128,8 @@ namespace MatterHackers.MatterControl
|
|||
this.AddChild(allControls);
|
||||
this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off
|
||||
|
||||
//allControls.AddChild(CreateMenues());
|
||||
allControls.AddChild(new ActionBarPlus());
|
||||
//allControls.AddChild(WidescreenPanel.Instance);
|
||||
//allControls.AddChild(new ActionBarPlus());
|
||||
allControls.AddChild(MainSlidePanel.Instance);
|
||||
|
||||
#if false // this is to test freeing gcodefile memory
|
||||
|
|
|
|||
|
|
@ -290,9 +290,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
centerPartPreviewAndControls.AddChild(viewArea);
|
||||
mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);
|
||||
|
||||
meshViewerWidget.LoadMesh(printItemWrapper.FileLocation);
|
||||
meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone);
|
||||
|
||||
FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
|
||||
buttonBottomPanel.Padding = new BorderDouble(3, 3);
|
||||
|
|
@ -413,6 +410,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
AddViewControls();
|
||||
|
||||
AddHandlers();
|
||||
|
||||
// don't load the mesh until we get all the rest of the interface built
|
||||
meshViewerWidget.LoadMesh(printItemWrapper.FileLocation);
|
||||
meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone);
|
||||
}
|
||||
|
||||
private void MakeCopyOfMesh()
|
||||
|
|
|
|||
|
|
@ -189,16 +189,24 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
|
||||
public string GetGCodePathAndFileName()
|
||||
{
|
||||
if (Path.GetExtension(FileLocation).ToUpper() == ".GCODE")
|
||||
if (FileLocation.Trim() != "")
|
||||
{
|
||||
return FileLocation;
|
||||
|
||||
if (Path.GetExtension(FileLocation).ToUpper() == ".GCODE")
|
||||
{
|
||||
return FileLocation;
|
||||
}
|
||||
|
||||
string engineString = ((int)ActivePrinterProfile.Instance.ActiveSliceEngineType).ToString();
|
||||
|
||||
string gcodeFileName = this.StlFileHashCode.ToString() + "_" + engineString + "_" + ActiveSliceSettings.Instance.GetHashCode().ToString();
|
||||
string gcodePathAndFileName = Path.Combine(DataStorage.ApplicationDataStorage.Instance.GCodeOutputPath, gcodeFileName + ".gcode");
|
||||
return gcodePathAndFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string engineString = ((int)ActivePrinterProfile.Instance.ActiveSliceEngineType).ToString();
|
||||
|
||||
string gcodeFileName = this.StlFileHashCode.ToString() + "_" + engineString + "_" + ActiveSliceSettings.Instance.GetHashCode().ToString();
|
||||
string gcodePathAndFileName = Path.Combine(DataStorage.ApplicationDataStorage.Instance.GCodeOutputPath, gcodeFileName + ".gcode");
|
||||
return gcodePathAndFileName;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ using MatterHackers.Agg.UI;
|
|||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
|
|
@ -53,56 +54,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public class DisableableWidget : GuiWidget
|
||||
{
|
||||
public GuiWidget disableOverlay;
|
||||
|
||||
public DisableableWidget()
|
||||
{
|
||||
HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
|
||||
disableOverlay = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
|
||||
disableOverlay.Visible = false;
|
||||
base.AddChild(disableOverlay);
|
||||
}
|
||||
|
||||
public enum EnableLevel { Disabled, ConfigOnly, Enabled };
|
||||
|
||||
public void SetEnableLevel(EnableLevel enabledLevel)
|
||||
{
|
||||
disableOverlay.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryAccentColor, 160);
|
||||
switch (enabledLevel)
|
||||
{
|
||||
case EnableLevel.Disabled:
|
||||
disableOverlay.Margin = new BorderDouble(0);
|
||||
disableOverlay.Visible = true;
|
||||
break;
|
||||
|
||||
case EnableLevel.ConfigOnly:
|
||||
disableOverlay.Margin = new BorderDouble(10, 10, 10, 15);
|
||||
disableOverlay.Visible = true;
|
||||
break;
|
||||
|
||||
case EnableLevel.Enabled:
|
||||
disableOverlay.Visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
|
||||
{
|
||||
if (indexInChildrenList == -1)
|
||||
{
|
||||
// put it under the disableOverlay
|
||||
base.AddChild(childToAdd, Children.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.AddChild(childToAdd, indexInChildrenList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ManualPrinterControls : GuiWidget
|
||||
{
|
||||
|
|
@ -219,7 +171,6 @@ namespace MatterHackers.MatterControl
|
|||
rightColumnContainer.VAnchor |= VAnchor.ParentTop;
|
||||
|
||||
AddFanControls(rightColumnContainer);
|
||||
AddEePromControls(rightColumnContainer);
|
||||
|
||||
centerControlsContainer.AddChild(rightColumnContainer);
|
||||
}
|
||||
|
|
@ -239,10 +190,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
AddAdjustmentControls(controlsTopToBottomLayout);
|
||||
|
||||
printLevelContainer = new DisableableWidget();
|
||||
printLevelContainer.AddChild(CreatePrintLevelingControlsContainer());
|
||||
controlsTopToBottomLayout.AddChild(printLevelContainer);
|
||||
|
||||
this.AddChild(controlsTopToBottomLayout);
|
||||
AddHandlers();
|
||||
SetVisibleControls();
|
||||
|
|
@ -742,7 +689,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void SetDisplayAttributes()
|
||||
{
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
this.textImageButtonFactory.normalFillColor = RGBA_Bytes.White;
|
||||
this.textImageButtonFactory.disabledFillColor = RGBA_Bytes.White;
|
||||
|
|
@ -768,7 +715,6 @@ namespace MatterHackers.MatterControl
|
|||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
sdCardManagerContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
}
|
||||
|
|
@ -785,10 +731,8 @@ namespace MatterHackers.MatterControl
|
|||
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
|
||||
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
|
||||
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
sdCardManagerContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
|
||||
break;
|
||||
|
|
@ -799,9 +743,7 @@ namespace MatterHackers.MatterControl
|
|||
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
sdCardManagerContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
|
|
@ -819,10 +761,8 @@ namespace MatterHackers.MatterControl
|
|||
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
|
||||
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
sdCardManagerContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
break;
|
||||
|
|
@ -837,10 +777,8 @@ namespace MatterHackers.MatterControl
|
|||
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
sdCardManagerContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -46,109 +46,99 @@ using MatterHackers.MatterControl.SlicerConfiguration;
|
|||
using MatterHackers.MatterControl.PrintLibrary;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class WidescreenPanel : Splitter
|
||||
{
|
||||
SimpleTextTabWidget aboutTabView;
|
||||
{
|
||||
public class WidescreenPanel : FlowLayoutWidget
|
||||
{
|
||||
static WidescreenPanel globalInstance;
|
||||
TabControl advancedControlsTabControl;
|
||||
TabControl mainControlsTabControl;
|
||||
SliceSettingsWidget sliceSettingsWidget;
|
||||
TabControl advancedControls;
|
||||
private delegate void ReloadPanel();
|
||||
public TabPage QueueTabPage;
|
||||
public TabPage AboutTabPage;
|
||||
TextImageButtonFactory advancedControlsButtonFactory = new TextImageButtonFactory();
|
||||
RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;
|
||||
SliceSettingsWidget.UiState sliceSettingsUiState;
|
||||
|
||||
FlowLayoutWidget ColumnOne;
|
||||
FlowLayoutWidget ColumnTwo;
|
||||
int ColumnTwoMinWidth = 1390;
|
||||
FlowLayoutWidget ColumnThree;
|
||||
int ColumnThreeMinWidth = 990;
|
||||
|
||||
View3DTransformPart part3DView;
|
||||
GcodeViewBasic partGcodeView;
|
||||
|
||||
ClickWidget RightBorderLine;
|
||||
ClickWidget LeftBorderLine;
|
||||
|
||||
bool ColThreeIsHidden = false;
|
||||
|
||||
public WidescreenPanel()
|
||||
: base()
|
||||
: base(FlowDirection.LeftToRight)
|
||||
{
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);
|
||||
|
||||
// do the front panel stuff
|
||||
{
|
||||
// first add the print progress bar
|
||||
this.Panel1.AddChild(new PrintProgressBar());
|
||||
|
||||
// construct the main controls tab control
|
||||
mainControlsTabControl = new TabControl();
|
||||
mainControlsTabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
mainControlsTabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
mainControlsTabControl.TabBar.Margin = new BorderDouble(0, 0);
|
||||
mainControlsTabControl.TabBar.Padding = new BorderDouble(0, 2);
|
||||
//PrintQueueControl.Instance.Initialize();
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
Padding = new BorderDouble(4);
|
||||
|
||||
QueueTabPage = new TabPage(new QueueControlsWidget(), "Queue");
|
||||
NumQueueItemsChanged(this, null);
|
||||
ColumnOne = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
ColumnTwo = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
ColumnThree = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
||||
mainControlsTabControl.AddTab(new SimpleTextTabWidget(QueueTabPage, 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
//mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new GuiWidget(), "History"), 18,
|
||||
// ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
mainControlsTabControl.AddTab(new SimpleTextTabWidget(new TabPage(new PrintLibraryWidget(), "Library"), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
ColumnOne.VAnchor = VAnchor.ParentBottomTop;
|
||||
ColumnOne.AddChild(new ActionBarPlus());
|
||||
ColumnOne.AddChild(new PrintProgressBar());
|
||||
ColumnOne.AddChild(new QueueTab());
|
||||
ColumnOne.Width = 480; //Ordering here matters - must go after children are added
|
||||
|
||||
//ColumnOne.Padding = new BorderDouble(4);
|
||||
//ColumnTwo.Padding = new BorderDouble(4, 0);
|
||||
//ColumnThree.Padding = new BorderDouble(4);
|
||||
|
||||
AboutTabPage = new TabPage(new AboutPage(), "About");
|
||||
aboutTabView = new SimpleTextTabWidget(AboutTabPage, 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
|
||||
mainControlsTabControl.AddTab(aboutTabView);
|
||||
LeftBorderLine = CreateBorderLine();
|
||||
RightBorderLine = CreateBorderLine();
|
||||
|
||||
LoadColumnTwo();
|
||||
|
||||
ColumnThree.VAnchor = VAnchor.ParentBottomTop;
|
||||
|
||||
|
||||
{
|
||||
advancedControlsTabControl = CreateNewAdvancedControlsTab(new SliceSettingsWidget.UiState());
|
||||
ColumnThree.AddChild(advancedControlsTabControl);
|
||||
ColumnThree.Width = 590; //Ordering here matters - must go after children are added
|
||||
}
|
||||
|
||||
advancedControlsButtonFactory.normalTextColor = RGBA_Bytes.White;
|
||||
advancedControlsButtonFactory.hoverTextColor = RGBA_Bytes.White;
|
||||
advancedControlsButtonFactory.pressedTextColor = RGBA_Bytes.White;
|
||||
advancedControlsButtonFactory.fontSize = 10;
|
||||
|
||||
advancedControlsButtonFactory.disabledTextColor = RGBA_Bytes.LightGray;
|
||||
advancedControlsButtonFactory.disabledFillColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
advancedControlsButtonFactory.disabledBorderColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
advancedControlsButtonFactory.invertImageLocation = true;
|
||||
Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate("Advanced\nControls", "icon_arrow_right_32x32.png");
|
||||
advancedControlsLinkButton.Margin = new BorderDouble(right: 3);
|
||||
advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
|
||||
advancedControlsLinkButton.Cursor = Cursors.Hand;
|
||||
advancedControlsLinkButton.Click += new ButtonBase.ButtonEventHandler(AdvancedControlsButton_Click);
|
||||
advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsAdvancedControlsLink);
|
||||
advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsAdvancedControlsLink);
|
||||
|
||||
GuiWidget hSpacer = new GuiWidget();
|
||||
hSpacer.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
||||
mainControlsTabControl.TabBar.AddChild(hSpacer);
|
||||
//mainControlsTabControl.TabBar.AddChild(advancedControlsLinkButton);
|
||||
// and add it
|
||||
this.Panel1.AddChild(mainControlsTabControl);
|
||||
|
||||
SetUpdateNotification(this, null);
|
||||
AddChild(ColumnOne);
|
||||
AddChild(LeftBorderLine);
|
||||
AddChild(ColumnTwo);
|
||||
AddChild(RightBorderLine);
|
||||
AddChild(ColumnThree);
|
||||
}
|
||||
|
||||
// do the back panel
|
||||
{
|
||||
advancedControlsTabControl = CreateNewAdvancedControlsTab(new SliceSettingsWidget.UiState());
|
||||
this.Panel2.AddChild(advancedControlsTabControl);
|
||||
//this.Panel2.AddChild(new PrintProgressBar());
|
||||
}
|
||||
|
||||
|
||||
|
||||
AnchorAll();
|
||||
AddHandlers();
|
||||
SetVisibleStatus();
|
||||
|
||||
}
|
||||
|
||||
void AdvancedControlsButton_Click(object sender, MouseEventArgs mouseEvent)
|
||||
private static ClickWidget CreateBorderLine()
|
||||
{
|
||||
if (MainSlidePanel.Instance.PannelIndex == 0)
|
||||
{
|
||||
MainSlidePanel.Instance.PannelIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainSlidePanel.Instance.PannelIndex = 0;
|
||||
}
|
||||
ClickWidget topLine = new ClickWidget(3, 1);
|
||||
topLine.BackgroundColor = new RGBA_Bytes(200,200,200);
|
||||
topLine.VAnchor = VAnchor.ParentBottomTop;
|
||||
topLine.Margin = new BorderDouble(8, 0);
|
||||
topLine.Cursor = Cursors.Hand;
|
||||
return topLine;
|
||||
}
|
||||
|
||||
void onBoundsChanges(Object sender, EventArgs e)
|
||||
{
|
||||
SetVisibleStatus();
|
||||
}
|
||||
|
||||
void onMouseEnterBoundsAdvancedControlsLink(Object sender, EventArgs e)
|
||||
|
|
@ -197,62 +187,249 @@ namespace MatterHackers.MatterControl
|
|||
//Empty function used as placeholder
|
||||
}
|
||||
|
||||
SliceSettingsWidget.UiState sliceSettingsUiState;
|
||||
|
||||
void DoChangePanel(object state)
|
||||
{
|
||||
// remember which tab we were on
|
||||
int topTabIndex = this.advancedControlsTabControl.SelectedTabIndex;
|
||||
|
||||
// remove the advance control and replace it with new ones build for the selected printer
|
||||
int advancedControlsWidgetIndex = Panel2.GetChildIndex(this.advancedControlsTabControl);
|
||||
Panel2.RemoveChild(advancedControlsWidgetIndex);
|
||||
int advancedControlsWidgetIndex = ColumnThree.GetChildIndex(this.advancedControlsTabControl);
|
||||
ColumnThree.RemoveChild(advancedControlsWidgetIndex);
|
||||
this.advancedControlsTabControl = CreateNewAdvancedControlsTab(sliceSettingsUiState);
|
||||
Panel2.AddChild(this.advancedControlsTabControl, advancedControlsWidgetIndex);
|
||||
ColumnThree.AddChild(this.advancedControlsTabControl, advancedControlsWidgetIndex);
|
||||
ColumnThree.Width = 590;
|
||||
|
||||
// set the selected tab back to the one it was before we replace the control
|
||||
this.advancedControlsTabControl.SelectTab(topTabIndex);
|
||||
|
||||
// This is a hack to make the pannel remain on the screen. It would be great to debug it and understand
|
||||
// why it does not work without this code in here.
|
||||
RectangleDouble localBounds = this.LocalBounds;
|
||||
this.LocalBounds = new RectangleDouble(0, 0, this.LocalBounds.Width - 1, 10);
|
||||
this.LocalBounds = localBounds;
|
||||
}
|
||||
|
||||
|
||||
TabControl CreateNewAdvancedControlsTab(SliceSettingsWidget.UiState sliceSettingsUiState)
|
||||
{
|
||||
advancedControls = new TabControl();
|
||||
advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
advancedControls.TabBar.BorderColor = RGBA_Bytes.White;
|
||||
advancedControls.TabBar.Margin = new BorderDouble(0, 0);
|
||||
advancedControls.TabBar.Padding = new BorderDouble(0, 2);
|
||||
|
||||
advancedControlsButtonFactory.invertImageLocation = false;
|
||||
Button advancedControlsLinkButton = advancedControlsButtonFactory.Generate("Print\nQueue", "icon_arrow_left_32x32.png");
|
||||
advancedControlsLinkButton.Margin = new BorderDouble(right: 3);
|
||||
advancedControlsLinkButton.VAnchor = VAnchor.ParentBottom;
|
||||
advancedControlsLinkButton.Cursor = Cursors.Hand;
|
||||
advancedControlsLinkButton.Click += new ButtonBase.ButtonEventHandler(AdvancedControlsButton_Click);
|
||||
advancedControlsLinkButton.MouseEnterBounds += new EventHandler(onMouseEnterBoundsPrintQueueLink);
|
||||
advancedControlsLinkButton.MouseLeaveBounds += new EventHandler(onMouseLeaveBoundsPrintQueueLink);
|
||||
|
||||
//advancedControls.TabBar.AddChild(advancedControlsLinkButton);
|
||||
|
||||
GuiWidget manualPrinterControls = new ManualPrinterControls();
|
||||
ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
|
||||
manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
|
||||
manualPrinterControlsScrollArea.AnchorAll();
|
||||
manualPrinterControlsScrollArea.AddChild(manualPrinterControls);
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, "Printer Controls"), 18,
|
||||
|
||||
//Add the tab contents for 'Advanced Controls'
|
||||
string printerControlsLabel = new LocalizedString("Controls").Translated;
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(manualPrinterControlsScrollArea, printerControlsLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
string sliceSettingsLabel = new LocalizedString("Slice Settings").Translated;
|
||||
sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, sliceSettingsLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
sliceSettingsWidget = new SliceSettingsWidget(sliceSettingsUiState);
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(sliceSettingsWidget, "Slice Settings"), 18,
|
||||
string configurationLabel = new LocalizedString("Configuration").Translated;
|
||||
ScrollableWidget configurationControls = new ConfigurationPage();
|
||||
advancedControls.AddTab(new SimpleTextTabWidget(new TabPage(configurationControls, configurationLabel), 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
return advancedControls;
|
||||
}
|
||||
|
||||
event EventHandler unregisterEvents;
|
||||
void AddHandlers()
|
||||
{
|
||||
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
|
||||
PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
|
||||
MainSlidePanel.Instance.ReloadPanelTrigger.RegisterEvent(ReloadBackPanel, ref unregisterEvents);
|
||||
this.BoundsChanged += new EventHandler(onBoundsChanges);
|
||||
RightBorderLine.Click += new ClickWidget.ButtonEventHandler(onRightBorderClick); ;
|
||||
|
||||
}
|
||||
|
||||
void onRightBorderClick(object sender, EventArgs e)
|
||||
{
|
||||
ColumnThree.Visible = !ColumnThree.Visible;
|
||||
ColThreeIsHidden = !ColumnThree.Visible;
|
||||
|
||||
}
|
||||
|
||||
void onActivePrintItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
LoadColumnTwo();
|
||||
}
|
||||
|
||||
void LoadColumnTwo()
|
||||
{
|
||||
ColumnTwo.RemoveAllChildren();
|
||||
|
||||
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
|
||||
part3DView = new View3DTransformPart(PrinterCommunication.Instance.ActivePrintItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape);
|
||||
part3DView.Margin = new BorderDouble(bottom: 4);
|
||||
part3DView.AnchorAll();
|
||||
|
||||
partGcodeView = new GcodeViewBasic(PrinterCommunication.Instance.ActivePrintItem, ActiveSliceSettings.Instance.GetBedSize, ActiveSliceSettings.Instance.GetBedCenter);
|
||||
partGcodeView.AnchorAll();
|
||||
|
||||
ColumnTwo.AddChild(part3DView);
|
||||
ColumnTwo.AddChild(partGcodeView);
|
||||
ColumnTwo.AnchorAll();
|
||||
SetVisibleStatus();
|
||||
}
|
||||
|
||||
void SetVisibleStatus()
|
||||
{
|
||||
bool ColThreeVisible = ColumnThree.Visible;
|
||||
|
||||
if (this.Width < ColumnThreeMinWidth)
|
||||
{
|
||||
ColumnThree.Visible = false;
|
||||
ColumnTwo.Visible = false;
|
||||
|
||||
ColumnOne.RemoveAllChildren();
|
||||
ColumnOne.AddChild(new ActionBarPlus());
|
||||
ColumnOne.AddChild(new MainSlide());
|
||||
ColumnOne.AnchorAll();
|
||||
ColumnOne.Visible = true;
|
||||
|
||||
LeftBorderLine.Visible = false;
|
||||
RightBorderLine.Visible = false;
|
||||
|
||||
}
|
||||
else if (this.Width < ColumnTwoMinWidth)
|
||||
{
|
||||
|
||||
ColumnTwo.Visible = false;
|
||||
ColumnThree.Visible = !ColThreeIsHidden;
|
||||
|
||||
ColumnOne.RemoveAllChildren();
|
||||
ColumnOne.AddChild(new ActionBarPlus());
|
||||
ColumnOne.AddChild(new PrintProgressBar());
|
||||
ColumnOne.AddChild(new QueueTab());
|
||||
ColumnOne.AnchorAll();
|
||||
ColumnOne.Visible = true;
|
||||
|
||||
LeftBorderLine.Visible = false;
|
||||
RightBorderLine.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ColumnThree.Visible = !ColThreeIsHidden;
|
||||
ColumnTwo.Visible = true;
|
||||
|
||||
ColumnOne.RemoveAllChildren();
|
||||
ColumnOne.AddChild(new ActionBarPlus());
|
||||
ColumnOne.AddChild(new PrintProgressBar());
|
||||
ColumnOne.AddChild(new QueueTab());
|
||||
ColumnOne.HAnchor = Agg.UI.HAnchor.None;
|
||||
ColumnOne.Width = 480;
|
||||
ColumnOne.Visible = true;
|
||||
|
||||
LeftBorderLine.Visible = true;
|
||||
RightBorderLine.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onThemeChanged(object sender, EventArgs e)
|
||||
{
|
||||
//this.advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
this.advancedControls.Invalidate();
|
||||
}
|
||||
|
||||
public void ReloadBackPanel(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
sliceSettingsUiState = new SliceSettingsWidget.UiState(sliceSettingsWidget);
|
||||
UiThread.RunOnIdle(DoChangePanel);
|
||||
}
|
||||
|
||||
public void LoadSettingsOnPrinterChanged(object sender, EventArgs e)
|
||||
{
|
||||
ActiveSliceSettings.Instance.LoadSettingsForPrinter();
|
||||
MainSlidePanel.Instance.ReloadBackPanel();
|
||||
}
|
||||
}
|
||||
|
||||
class QueueTab : TabControl
|
||||
{
|
||||
|
||||
TabPage QueueTabPage;
|
||||
TabPage LibraryTabPage;
|
||||
TabPage AboutTabPage;
|
||||
SimpleTextTabWidget AboutTabView;
|
||||
RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected;
|
||||
GuiWidget addedUpdateMark = null;
|
||||
|
||||
public QueueTab()
|
||||
{
|
||||
this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
this.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
this.TabBar.Margin = new BorderDouble(0, 0);
|
||||
this.TabBar.Padding = new BorderDouble(0, 2);
|
||||
|
||||
QueueTabPage = new TabPage(new QueueControlsWidget(), "Queue");
|
||||
this.AddTab(new SimpleTextTabWidget(QueueTabPage, 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
LibraryTabPage = new TabPage(new PrintLibraryWidget(), "Library");
|
||||
this.AddTab(new SimpleTextTabWidget(LibraryTabPage, 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
|
||||
AboutTabPage = new TabPage(new AboutPage(), "About");
|
||||
AboutTabView = new SimpleTextTabWidget(AboutTabPage, 18,
|
||||
ActiveTheme.Instance.PrimaryTextColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
|
||||
this.AddTab(AboutTabView);
|
||||
|
||||
NumQueueItemsChanged(this, null);
|
||||
SetUpdateNotification(this, null);
|
||||
|
||||
}
|
||||
|
||||
void NumQueueItemsChanged(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
string queueStringBeg = new LocalizedString("Queue").Translated;
|
||||
string queueString = string.Format("{1} ({0})", PrintQueue.PrintQueueControl.Instance.Count, queueStringBeg);
|
||||
QueueTabPage.Text = string.Format(queueString, PrintQueue.PrintQueueControl.Instance.Count);
|
||||
}
|
||||
|
||||
event EventHandler unregisterEvents;
|
||||
void AddHandlers()
|
||||
{
|
||||
PrintQueue.PrintQueueControl.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
|
||||
PrintQueue.PrintQueueControl.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
|
||||
MainSlidePanel.Instance.SetUpdateNotificationTrigger.RegisterEvent(SetUpdateNotification, ref unregisterEvents);
|
||||
|
||||
}
|
||||
|
||||
public void SetUpdateNotification(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
if (this.UpdateIsAvailable() || UpdateControl.NeedToCheckForUpdateFirstTimeEver)
|
||||
{
|
||||
#if true
|
||||
if (addedUpdateMark == null)
|
||||
{
|
||||
UpdateControl.NeedToCheckForUpdateFirstTimeEver = false;
|
||||
addedUpdateMark = new NotificationWidget();
|
||||
addedUpdateMark.OriginRelativeParent = new Vector2(63, 10);
|
||||
AboutTabView.AddChild(addedUpdateMark);
|
||||
}
|
||||
#else
|
||||
AboutTabPage.Text = string.Format("About (!)");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addedUpdateMark != null)
|
||||
{
|
||||
addedUpdateMark.Visible = false;
|
||||
}
|
||||
AboutTabPage.Text = string.Format("About");
|
||||
}
|
||||
}
|
||||
|
||||
bool UpdateIsAvailable()
|
||||
{
|
||||
string currentBuildToken = ApplicationSettings.Instance.get("CurrentBuildToken");
|
||||
|
|
@ -267,81 +444,21 @@ namespace MatterHackers.MatterControl
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event EventHandler unregisterEvents;
|
||||
void AddHandlers()
|
||||
class NotificationWidget : GuiWidget
|
||||
{
|
||||
public NotificationWidget()
|
||||
: base(12, 12)
|
||||
{
|
||||
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
|
||||
PrintQueue.PrintQueueControl.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
|
||||
PrintQueue.PrintQueueControl.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
class NotificationWidget : GuiWidget
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
public NotificationWidget()
|
||||
: base(12, 12)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
graphics2D.Circle(Width / 2, Height / 2, Width / 2, RGBA_Bytes.White);
|
||||
graphics2D.Circle(Width / 2, Height / 2, Width / 2 - 1, RGBA_Bytes.Red);
|
||||
graphics2D.FillRectangle(Width / 2 - 1, Height / 2 - 3, Width / 2 + 1, Height / 2 + 3, RGBA_Bytes.White);
|
||||
//graphics2D.DrawString("1", Width / 2, Height / 2 + 1, 8, Justification.Center, Baseline.BoundsCenter, RGBA_Bytes.White);
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
}
|
||||
|
||||
GuiWidget addedUpdateMark = null;
|
||||
public void SetUpdateNotification(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
if (this.UpdateIsAvailable() || UpdateControl.NeedToCheckForUpdateFirstTimeEver)
|
||||
{
|
||||
#if true
|
||||
if (addedUpdateMark == null)
|
||||
{
|
||||
UpdateControl.NeedToCheckForUpdateFirstTimeEver = false;
|
||||
addedUpdateMark = new NotificationWidget();
|
||||
addedUpdateMark.OriginRelativeParent = new Vector2(63, 10);
|
||||
aboutTabView.AddChild(addedUpdateMark);
|
||||
}
|
||||
#else
|
||||
AboutTabPage.Text = string.Format("About (!)");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addedUpdateMark != null)
|
||||
{
|
||||
addedUpdateMark.Visible = false;
|
||||
}
|
||||
AboutTabPage.Text = string.Format("About");
|
||||
}
|
||||
}
|
||||
|
||||
void NumQueueItemsChanged(object sender, EventArgs widgetEvent)
|
||||
{
|
||||
string queueString = "Queue ({0})";
|
||||
QueueTabPage.Text = string.Format(queueString, PrintQueue.PrintQueueControl.Instance.Count);
|
||||
}
|
||||
|
||||
private void onThemeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.advancedControls.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
|
||||
this.advancedControls.Invalidate();
|
||||
}
|
||||
|
||||
public void ReloadBackPanel()
|
||||
{
|
||||
sliceSettingsUiState = new SliceSettingsWidget.UiState(sliceSettingsWidget);
|
||||
UiThread.RunOnIdle(DoChangePanel);
|
||||
}
|
||||
|
||||
public void LoadSettingsOnPrinterChanged(object sender, EventArgs e)
|
||||
{
|
||||
ActiveSliceSettings.Instance.LoadSettingsForPrinter();
|
||||
MainSlidePanel.Instance.ReloadBackPanel();
|
||||
graphics2D.Circle(Width / 2, Height / 2, Width / 2, RGBA_Bytes.White);
|
||||
graphics2D.Circle(Width / 2, Height / 2, Width / 2 - 1, RGBA_Bytes.Red);
|
||||
graphics2D.FillRectangle(Width / 2 - 1, Height / 2 - 3, Width / 2 + 1, Height / 2 + 3, RGBA_Bytes.White);
|
||||
base.OnDraw(graphics2D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue