Merge pull request #2815 from jlewin/design_tools

Add drop arrows, move printer settings
This commit is contained in:
johnlewin 2017-12-27 18:04:50 -08:00 committed by GitHub
commit 8e68798640
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 329 additions and 231 deletions

View file

@ -10,12 +10,11 @@ namespace MatterHackers.MatterControl.AboutPage
public class CheckForUpdatesPage : DialogPage
{
public CheckForUpdatesPage()
: base("Close")
: base("Close".Localize())
{
AnchorAll();
this.WindowTitle = "Check for Update".Localize();
this.HeaderText = "Check for Update".Localize();
this.WindowTitle = this.HeaderText = "Check for Update".Localize();
var theme = ApplicationController.Instance.Theme;

View file

@ -37,7 +37,7 @@ using MatterHackers.MatterControl.PartPreviewWindow;
namespace MatterHackers.MatterControl.ActionBar
{
internal abstract class TemperatureWidgetBase : PopupButton
internal abstract class TemperatureWidgetBase : PopupMenuButton
{
protected CheckBox heatToggle;
protected TextWidget CurrentTempIndicator;
@ -60,6 +60,8 @@ namespace MatterHackers.MatterControl.ActionBar
public TemperatureWidgetBase(PrinterConfig printer, string textValue)
{
this.AlignToRightEdge = true;
this.DrawArrow = true;
this.printer = printer;
this.HAnchor = HAnchor.Fit;
this.VAnchor = VAnchor.Fit | VAnchor.Center;
@ -71,7 +73,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
HAnchor = HAnchor.Fit,
VAnchor = VAnchor.Fit,
Padding = new BorderDouble(5)
Padding = new BorderDouble(10, 5, 0, 5)
};
this.AddChild(container);

View file

@ -854,8 +854,6 @@ namespace MatterHackers.MatterControl
}
//HtmlWindowTest();
AppContext.IsLoading = false;
}
private static void RunSetupIfRequired()
@ -1572,8 +1570,7 @@ namespace MatterHackers.MatterControl
systemWindow.BackgroundColor = Color.Transparent;
overlay.Close();
// TODO: Still can't figure out the delay between concluding this block and the first actual render with MainView content. Current
// best guess is delays between widget construction and OpenGL texture creation
AppContext.IsLoading = false;
});
};

View file

@ -0,0 +1,94 @@
/*
Copyright (c) 2017, John Lewin
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.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl
{
public class ConfigurePrinterWidget : FlowLayoutWidget
{
public ConfigurePrinterWidget(PartTabPage partTabPage, ThemeConfig theme)
: base(FlowDirection.TopToBottom)
{
var sliceSettingsWidget = partTabPage.ChildrenRecursive<SliceSettingsWidget>().FirstOrDefault();
int tabIndex = 0;
var rowItem = sliceSettingsWidget.CreateItemRow(SliceSettingsOrganizer.SettingsData["printer_name"], ref tabIndex);
var firstChild = rowItem.Children.FirstOrDefault();
firstChild.HAnchor = HAnchor.Absolute;
firstChild.Width = 100;
firstChild.Margin = firstChild.Margin.Clone(right: 0);
var nextChild = rowItem.Children.Skip(1).FirstOrDefault();
nextChild.HAnchor = HAnchor.Stretch;
nextChild.Children.FirstOrDefault().HAnchor = HAnchor.Stretch;
this.AddChild(rowItem);
var primaryTabControl = new TabControl();
primaryTabControl.TabBar.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
primaryTabControl.AnchorAll();
this.AddChild(primaryTabControl);
foreach (var section in SliceSettingsOrganizer.Instance.UserLevels["Printer"].CategoriesList)
{
var tabPage = new TabPage(section.Name.Localize())
{
Padding = new BorderDouble(10, 4)
};
primaryTabControl.AddTab(new TextTab(
tabPage,
section.Name + " Tab",
theme.DefaultFontSize,
ActiveTheme.Instance.TabLabelSelected,
new Color(),
ActiveTheme.Instance.TabLabelUnselected,
new Color(),
useUnderlineStyling: true));
var scrollable = new ScrollableWidget(true)
{
VAnchor = VAnchor.Stretch,
HAnchor = HAnchor.Stretch,
};
scrollable.ScrollArea.HAnchor = HAnchor.Stretch;
scrollable.AddChild(
sliceSettingsWidget.CreateGroupContent(section.GroupsList.FirstOrDefault() , sliceSettingsWidget.settingsContext, sliceSettingsWidget.ShowHelpControls));
tabPage.AddChild(scrollable);
}
}
}
}

View file

@ -62,6 +62,10 @@ namespace MatterHackers.GCodeVisualizer
double zScale = halfHeight / radius;
double xScale = halfWidth / radius;
// Adjust start/end positions to be centered on Z for the given layer height
startPos.Z -= halfHeight;
endPos.Z -= halfHeight;
Vector3 scale = new Vector3(xScale, xScale, zScale);
for (int i = 0; i < steps; i++)

View file

@ -73,6 +73,7 @@
<ItemGroup>
<Compile Include="AboutPage\AboutWindow.cs" />
<Compile Include="AboutPage\CheckForUpdatesPage.cs" />
<Compile Include="CustomWidgets\ConfigurePrinterWidget.cs" />
<Compile Include="AboutPage\HTMLParser\HtmlWidget.cs" />
<Compile Include="AboutPage\HTMLParser\ElementState.cs" />
<Compile Include="AboutPage\UpdateControlData.cs" />
@ -305,7 +306,6 @@
<Compile Include="SetupWizard\DialogPage.cs" />
<Compile Include="SetupWizard\SetupWizardTroubleshooting.cs" />
<Compile Include="SetupWizard\SetupWizardWifi.cs" />
<Compile Include="SlicerConfiguration\SliceSettingListControl.cs" />
<Compile Include="SlicerConfiguration\SliceSettingsRow.cs" />
<Compile Include="SlicerConfiguration\UIFields\BoundDoubleField.cs" />
<Compile Include="SlicerConfiguration\UIFields\UIField.cs" />

View file

@ -161,6 +161,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ApplicationController.Instance.NotifyPrintersTabRightElement(extensionArea);
// Show start page during initial application startup
if (AppContext.IsLoading)
{
tabControl.AddTab(
new MainTab("New Tab".Localize(), tabControl, tabControl.NewTabPage(), theme)
{
MinimumSize = new Vector2(0, theme.shortButtonHeight)
});
}
// When the application is first started, plugins are loaded after the MainView control has been initialized,
// and as such they not around when this constructor executes. In that case, we run the AddRightElement
// delegate after the plugins have been initialized via the PluginsLoaded event

View file

@ -76,6 +76,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
base.OnMouseDown(mouseEvent);
}
private Color stashedColor;
public override void OnMouseUp(MouseEventArgs mouseEvent)
{
// HACK: Child controls seem to be interfering with this.MouseCaptured - this short term workaround ensure we get clicks but likely mean mouse down outside of the control will fire the popup
@ -88,6 +90,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ShowPopup();
// Set a background color while the menu is active
stashedColor = this.BackgroundColor;
this.BackgroundColor = slightShade;
}
@ -125,7 +128,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
popupWidget.Closed += (s, e) =>
{
// Clear the temp background color
this.BackgroundColor = Color.Transparent;
this.BackgroundColor = stashedColor;
menuVisible = false;
popupWidget = null;

View file

@ -30,14 +30,33 @@ either expressed or implied, of the FreeBSD Project.
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
using MatterHackers.MatterControl.CustomWidgets;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class PopupMenuButton : PopupButton
{
public PopupMenuButton()
{
}
public PopupMenuButton(GuiWidget viewWidget)
: base(viewWidget)
{
viewWidget.Selectable = false;
viewWidget.BackgroundColor = Color.Transparent;
this.BackgroundColor = ApplicationController.Instance.Theme.SlightShade;
}
public PopupMenuButton(string text, ThemeConfig theme)
: this (new TextButton(text, theme)
{
Selectable = false,
Padding = theme.ButtonFactory.Options.Margin.Clone(right: 5)
})
{
this.DrawArrow = true;
this.BackgroundColor = theme.SlightShade;
}
private bool _drawArrow = false;

View file

@ -461,6 +461,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
var sideBar = new DockingTabControl(widgetTodockTo, DockSide.Right, ApplicationController.Instance.ActivePrinter)
{
Name = "DockingTabControl",
ControlIsPinned = ApplicationController.Instance.ActivePrinter.ViewState.SliceSettingsTabPinned
};
sideBar.PinStatusChanged += (s, e) =>

View file

@ -46,6 +46,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
public bool Unlocked { get; } = true;
public IEnumerable<Type> SupportedTypes() => new Type[] { typeof(MeshWrapperOperation) };
public GuiWidget Create(IObject3D group, View3DWidget view3DWidget, ThemeConfig theme)
{
this.view3DWidget = view3DWidget;
@ -54,7 +56,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
var mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
if (group is MeshWrapperOperation operationNode
&& operationNode.Mesh == null)
&& operationNode.Children.All(c => c.OutputType != PrintOutputTypes.Hole))
{
bool first = true;
// set all but one mesh to look like holes
@ -70,42 +72,36 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
return mainContainer;
}
public IEnumerable<Type> SupportedTypes() => new Type[]
{
typeof(MeshWrapperOperation),
};
private async void ProcessBooleans(IObject3D group)
{
// spin up a task to remove holes from the objects in the group
await Task.Run(() =>
await Task.Run(() =>
{
var participants = group.Descendants().Where((obj) => obj.OwnerID == group.ID);
if (participants.Count() > 1)
{
var participants = group.Descendants().Where((obj) => obj.OwnerID == group.ID);
var first = participants.First();
if (participants.Count() > 1)
foreach (var remove in participants)
{
var first = participants.First();
foreach (var remove in participants)
if (remove != first)
{
if(remove != first)
{
var transformedRemove = Mesh.Copy(remove.Mesh, CancellationToken.None);
transformedRemove.Transform(remove.WorldMatrix());
var transformedRemove = Mesh.Copy(remove.Mesh, CancellationToken.None);
transformedRemove.Transform(remove.WorldMatrix());
var transformedKeep = Mesh.Copy(first.Mesh, CancellationToken.None);
transformedKeep.Transform(first.WorldMatrix());
var transformedKeep = Mesh.Copy(first.Mesh, CancellationToken.None);
transformedKeep.Transform(first.WorldMatrix());
transformedKeep = PolygonMesh.Csg.CsgOperations.Intersect(transformedKeep, transformedRemove);
var inverse = first.WorldMatrix();
inverse.Invert();
transformedKeep.Transform(inverse);
first.Mesh = transformedKeep;
remove.Visible = false;
}
transformedKeep = PolygonMesh.Csg.CsgOperations.Intersect(transformedKeep, transformedRemove);
var inverse = first.WorldMatrix();
inverse.Invert();
transformedKeep.Transform(inverse);
first.Mesh = transformedKeep;
remove.Visible = false;
}
}
});
}
});
}
}
}

View file

@ -37,7 +37,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class PrintPopupMenu : PopupButton
public class PrintPopupMenu : PopupMenuButton
{
private TextImageButtonFactory buttonFactory = ApplicationController.Instance.Theme.ButtonFactory;
private PrinterConfig printer;
@ -47,6 +47,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
this.printerTabPage = printerTabPage;
this.printer = printer;
this.DrawArrow = true;
this.BackgroundColor = theme.ButtonFactory.Options.NormalFillColor;
//this.HoverColor = theme.ButtonFactory.Options.HoverFillColor;
this.Name = "PrintPopupMenu";
this.HAnchor = HAnchor.Fit;
this.VAnchor = VAnchor.Fit;
@ -92,7 +95,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
HAnchor = HAnchor.Right,
VAnchor = VAnchor.Absolute,
Margin = new BorderDouble(top: 10),
BackgroundColor = theme.MinimalShade
};
button.Click += (s, e) =>
{
@ -119,8 +121,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(new TextButton("Print".Localize(), theme)
{
BackgroundColor = theme.ButtonFactory.Options.NormalFillColor,
HoverColor = theme.ButtonFactory.Options.HoverFillColor,
Selectable = false,
Padding = theme.ButtonFactory.Options.Margin.Clone(right: 5)
});
}

View file

@ -34,6 +34,7 @@ using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.AboutPage;
using MatterHackers.MatterControl.ActionBar;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.EeProm;
@ -123,11 +124,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (printer.Settings.GetValue<bool>(SettingsKey.has_heated_bed))
{
this.AddChild(new TemperatureWidgetBed(printer));
this.AddChild(new TemperatureWidgetBed(printer)
{
Margin = new BorderDouble(right: 35)
});
}
this.OverflowMenu.Name = "Printer Overflow Menu";
this.OverflowMenu.DynamicPopupContent = GeneratePrinterOverflowMenu;
this.OverflowMenu.DynamicPopupContent = () => GeneratePrinterOverflowMenu(theme);
ApplicationController.Instance.ActivePrinter.Connection.ConnectionSucceeded.RegisterEvent((s, e) =>
{
@ -147,7 +151,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
base.OnClosed(e);
}
private GuiWidget GeneratePrinterOverflowMenu()
private GuiWidget GeneratePrinterOverflowMenu(ThemeConfig theme)
{
var menuActions = new NamedAction[]
{
@ -178,6 +182,26 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}));
}
},
new NamedAction()
{
Title = "Configure Printer".Localize(),
Action = () =>
{
var partTabPage = this.Parents<PartTabPage>().FirstOrDefault();
var dockingTabControl = partTabPage.FindNamedChildRecursive("DockingTabControl") as DockingTabControl;
printer.ViewState.SliceSettingsTabIndex = 3;
dockingTabControl.AddPage(
"Printer",
new ConfigurePrinterWidget(partTabPage, theme)
{
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor,
Padding = new BorderDouble(top: 10),
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Stretch,
});
}
},
new NamedAction() { Title = "----" },
new NamedAction()
{

View file

@ -37,22 +37,15 @@ using static MatterHackers.MatterControl.PrinterCommunication.PrinterConnection;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class PopupActionPanel : FlowLayoutWidget, IIgnoredPopupChild
{
public PopupActionPanel() : base(FlowDirection.TopToBottom)
{
this.Padding = 15;
BackgroundColor = Color.White;
}
}
public class MirrorControls : PopupActionPanel
public class MirrorControls : FlowLayoutWidget, IIgnoredPopupChild
{
private InteractiveScene scene;
public MirrorControls(InteractiveScene scene)
{
this.scene = scene;
this.Padding = 15;
FlowLayoutWidget buttonContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonContainer.HAnchor = HAnchor.Fit;

View file

@ -35,7 +35,7 @@ using MatterHackers.DataConverters3D;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public partial class ScaleControls : PopupActionPanel
public partial class ScaleControls : FlowLayoutWidget, IIgnoredPopupChild
{
private EditableNumberDisplay[] sizeDisplay = new EditableNumberDisplay[3];
internal CheckBox uniformScale;
@ -44,11 +44,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private InteractiveScene scene;
public ScaleControls(InteractiveScene scene)
: base (FlowDirection.TopToBottom)
{
this.scene = scene;
var theme = ApplicationController.Instance.Theme;
this.Padding = 15;
List<GuiWidget> scaleControls = new List<GuiWidget>();
// Put in the scale ratio edit field

View file

@ -236,7 +236,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
// put in the material options
var alignButton = new PopupButton(smallMarginButtonFactory.Generate("Align".Localize()))
var alignButton = new PopupMenuButton("Align".Localize(), theme)
{
PopDirection = Direction.Up,
PopupContent = this.AddAlignControls(),
@ -294,10 +294,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
selectionActionBar.AddChild(deleteButton);
// put in the mirror button
var mirrorView = smallMarginButtonFactory.Generate("Mirror".Localize());
var mirrorButton = new PopupButton(mirrorView)
var mirrorButton = new PopupMenuButton("Mirror".Localize(), theme)
{
Name = "Mirror Button",
PopDirection = Direction.Up,
@ -311,10 +308,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
selectionActionBar.AddChild(mirrorButton);
// put in the scale button
var scaleView = smallMarginButtonFactory.Generate("Scale".Localize());
var scaleButton = new PopupButton(scaleView)
var scaleButton = new PopupMenuButton("Scale".Localize(), theme)
{
Name = "Scale Button",
PopDirection = Direction.Up,
@ -329,7 +323,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
selectionActionBar.AddChild(scaleButton);
// put in the material options
var materialsButton = new PopupButton(smallMarginButtonFactory.Generate("Materials".Localize()))
var materialsButton = new PopupMenuButton("Materials".Localize(), theme)
{
PopDirection = Direction.Up,
PopupContent = this.AddMaterialControls(),
@ -412,13 +406,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
bool isPrinterMode = meshViewerWidget.EditorMode == MeshViewerWidget.EditorType.Printer;
var buttonView = smallMarginButtonFactory.Generate(
label: (isPrinterMode) ? "Bed".Localize() : "Part".Localize(),
normalImage: AggContext.StaticData.LoadIcon((isPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme));
var buttonView = new FlowLayoutWidget();
buttonView.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon((isPrinterMode) ? "bed.png" : "cube.png", IconColor.Theme))
{
Margin = new BorderDouble(left: 10),
VAnchor = VAnchor.Center
});
var buttonText = (isPrinterMode) ? "Bed".Localize() : "Part".Localize();
buttonView.AddChild(new TextButton(buttonText, theme)
{
Padding = new BorderDouble(8, 4, 0, 4)
});
selectionActionBar.AddChild(
new PopupButton(buttonView)
new PopupMenuButton(buttonView)
{
DrawArrow = true,
PopDirection = Direction.Up,
DynamicPopupContent = () => theme.CreatePopupMenu(bedMenuActions),
AlignToRightEdge = true,

View file

@ -84,6 +84,7 @@ namespace MatterHackers.MatterControl
// Create the header row for the widget
headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight)
{
Name = "HeaderRow",
Margin = new BorderDouble(0, 3, 0, 0),
Padding = new BorderDouble(0, 12),
HAnchor = HAnchor.Stretch

View file

@ -1,58 +0,0 @@
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
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 MatterHackers.Agg;
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl.SlicerConfiguration
{
internal class SliceSettingListControl : ScrollableWidget
{
private FlowLayoutWidget topToBottomItemList;
public SliceSettingListControl()
{
this.AnchorAll();
this.AutoScroll = true;
this.ScrollArea.HAnchor = HAnchor.Stretch;
this.Padding = new BorderDouble(left: 8);
topToBottomItemList = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.Stretch,
};
base.AddChild(topToBottomItemList);
}
public override void AddChild(GuiWidget child, int indexInChildrenList = -1)
{
topToBottomItemList.AddChild(child, indexInChildrenList);
}
}
}

View file

@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private TabControl primaryTabControl;
internal PresetsToolbar settingsControlBar;
private SettingsContext settingsContext;
internal SettingsContext settingsContext;
private PrinterConfig printer;
private Dictionary<string, UIField> allUiFields = new Dictionary<string, UIField>();
@ -266,87 +266,26 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
child.Padding = new BorderDouble(10);
}
var subGroupLayoutTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
subGroupLayoutTopToBottom.AnchorAll();
bool needToAddSubGroup = false;
foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
FlowLayoutWidget subgroupPanel = CreateGroupContent(group, oemAndUserContext, showHelpControls);
if (subgroupPanel.Children.Count > 0)
{
string subGroupTitle = subGroup.Name;
bool addedSettingToSubGroup = false;
var topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom)
var scrollableWidget = new ScrollableWidget()
{
HAnchor = HAnchor.Stretch
AutoScroll = true,
};
GuiWidget hline = new HorizontalLine(20)
{
Margin = new BorderDouble(top: 5)
};
topToBottomSettings.AddChild(hline);
scrollableWidget.ScrollArea.HAnchor = HAnchor.Stretch;
scrollableWidget.AnchorAll();
scrollableWidget.AddChild(subgroupPanel);
foreach (SliceSettingData settingData in subGroup.SettingDataList)
{
// Note: tab sections may disappear if / when they are empty, as controlled by:
// settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup
bool settingShouldBeShown = CheckIfShouldBeShown(settingData, oemAndUserContext);
if (EngineMappingsMatterSlice.Instance.MapContains(settingData.SlicerConfigName)
&& settingShouldBeShown)
{
addedSettingToSubGroup = true;
topToBottomSettings.AddChild(
CreateItemRow(settingData, ref tabIndexForItem));
hline = new HorizontalLine(20)
{
Margin = 0
};
topToBottomSettings.AddChild(hline);
if (showHelpControls)
{
topToBottomSettings.AddChild(AddInHelpText(topToBottomSettings, settingData));
}
}
}
if (addedSettingToSubGroup)
{
needToAddSubGroup = true;
var groupBox = new AltGroupBox(subGroupTitle.Localize())
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
BorderColor = ActiveTheme.Instance.PrimaryTextColor,
HAnchor = HAnchor.Stretch,
Margin = new BorderDouble(bottom: 8, top: 8),
Padding = new BorderDouble(left: 4),
};
groupBox.AddChild(topToBottomSettings);
subGroupLayoutTopToBottom.AddChild(groupBox);
}
}
if (needToAddSubGroup)
{
SliceSettingListControl scrollOnGroupTab = new SliceSettingListControl();
subGroupLayoutTopToBottom.VAnchor = VAnchor.Fit;
subGroupLayoutTopToBottom.HAnchor = HAnchor.Stretch;
scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom);
groupTabPage.AddChild(scrollOnGroupTab);
groupTabPage.AddChild(scrollableWidget);
secondaryTabControl.AddTab(groupTabWidget);
}
if (group.Name == "Connection")
{
subGroupLayoutTopToBottom.AddChild(SliceSettingsWidget.CreateOemProfileInfoRow(settingsContext, isPrimarySettingsView: true));
subgroupPanel.AddChild(SliceSettingsWidget.CreateOemProfileInfoRow(settingsContext, isPrimarySettingsView: true));
}
}
@ -368,6 +307,74 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return secondaryTabControl;
}
public FlowLayoutWidget CreateGroupContent(OrganizerGroup group, SettingsContext oemAndUserContext, bool showHelpControls)
{
var groupPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
VAnchor = VAnchor.Fit,
HAnchor = HAnchor.Stretch
};
foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
{
var section = AddSettingRowsForSubgroup(subGroup, oemAndUserContext, showHelpControls);
if (section != null)
{
var groupBox = new AltGroupBox(subGroup.Name.Localize())
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
BorderColor = ActiveTheme.Instance.PrimaryTextColor,
HAnchor = HAnchor.Stretch,
Margin = new BorderDouble(bottom: 8, top: 8),
Padding = new BorderDouble(left: 4),
};
groupBox.AddChild(section);
groupPanel.AddChild(groupBox);
}
}
return groupPanel;
}
private GuiWidget AddSettingRowsForSubgroup(OrganizerSubGroup subGroup, SettingsContext oemAndUserContext, bool showHelpControls)
{
var topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.Stretch,
};
topToBottomSettings.AddChild(new HorizontalLine(20)
{
Margin = new BorderDouble(top: 5),
});
foreach (SliceSettingData settingData in subGroup.SettingDataList)
{
// Note: tab sections may disappear if / when they are empty, as controlled by:
// settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup
bool settingShouldBeShown = CheckIfShouldBeShown(settingData, oemAndUserContext);
if (EngineMappingsMatterSlice.Instance.MapContains(settingData.SlicerConfigName)
&& settingShouldBeShown)
{
topToBottomSettings.AddChild(
CreateItemRow(settingData, ref tabIndexForItem));
topToBottomSettings.AddChild(new HorizontalLine(20)
{
Margin = 0
});
if (showHelpControls)
{
topToBottomSettings.AddChild(AddInHelpText(topToBottomSettings, settingData));
}
}
}
return (topToBottomSettings.Children.Count == 1) ? null : topToBottomSettings;
}
private bool CheckIfShouldBeShown(SliceSettingData settingData, SettingsContext settingsContext)
{
bool settingShouldBeShown = settingsContext.ParseShowString(settingData.ShowIfSet);
@ -469,7 +476,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
private GuiWidget CreateItemRow(SliceSettingData settingData, ref int tabIndexForItem)
internal GuiWidget CreateItemRow(SliceSettingData settingData, ref int tabIndexForItem)
{
return CreateItemRow(settingData, settingsContext, printer, ref tabIndexForItem, allUiFields);
}

View file

@ -260,29 +260,49 @@ Advanced
min_print_speed
Enable
cool_extruder_lift
Printer
Connection
Description
printer_name
Details
Printer
General
Common
Settings
auto_connect
baud_rate
com_port
selector_ip_address
ip_address
ip_port
Print Area
Size and Coordinates
bed_size
print_center
build_height
z_offset
bed_shape
Extruders
extruder_count
nozzle_diameter
extruders_share_temperature
extruder_offset
Features
Features
Interface
sla_printer
show_reset_connection
include_firmware_updater
Print Recovery
recover_is_enabled
recover_first_layer_speed
recover_position_before_z_home
Print Leveling
print_leveling_solution
leveling_manual_positions
print_leveling_required_to_print
Leveling Probe
print_leveling_probe_start
use_z_probe
z_probe_samples
z_probe_xy_offset
z_probe_z_offset
z_servo_depolyed_angle
z_servo_retracted_angle
Hardware
has_fan
has_hardware_leveling
@ -307,24 +327,7 @@ Advanced
Advanced
use_firmware_retraction
vibration_limit
Print Leveling
Machine Settings
print_leveling_solution
leveling_manual_positions
print_leveling_required_to_print
Probe Settings
print_leveling_probe_start
use_z_probe
z_probe_samples
z_probe_xy_offset
z_probe_z_offset
z_servo_depolyed_angle
z_servo_retracted_angle
Print Recovery
Recover Settings
recover_is_enabled
recover_first_layer_speed
recover_position_before_z_home
G-Code
Custom G-Code
Custom G-Code
start_gcode
@ -339,9 +342,3 @@ Advanced
Filters
write_regex
read_regex
Extruder
Extruders
extruder_count
nozzle_diameter
extruders_share_temperature
extruder_offset

@ -1 +1 @@
Subproject commit b474fb5f3a2a1c072345bc5960af087a7e9c2564
Subproject commit 8548521009d049dddc9d16719209ff5e830c36b7