diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs
index 89deac829..1aeccdfde 100644
--- a/ApplicationView/WidescreenPanel.cs
+++ b/ApplicationView/WidescreenPanel.cs
@@ -81,7 +81,7 @@ namespace MatterHackers.MatterControl
};
toolbar.BorderColor = ApplicationController.Instance.Theme.SlightShade;
toolbar.Border = new BorderDouble(bottom: 2);
- toolbar.ActionBar.AddChild(new BrandMenuButton(theme)
+ toolbar.ActionArea.AddChild(new BrandMenuButton(theme)
{
MinimumSize = new VectorMath.Vector2(0, 34),
HAnchor = HAnchor.Stretch,
diff --git a/MatterControl.csproj b/MatterControl.csproj
index cce467a21..ea08f6e0a 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -85,6 +85,7 @@
+
diff --git a/PartPreviewWindow/PartPreviewContent.cs b/PartPreviewWindow/PartPreviewContent.cs
index 8589035e3..a4dc7a3ae 100644
--- a/PartPreviewWindow/PartPreviewContent.cs
+++ b/PartPreviewWindow/PartPreviewContent.cs
@@ -126,7 +126,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
});
});
- tabControl.TabBar.ActionBar.AddChild(updateAvailableButton);
+ tabControl.TabBar.ActionArea.AddChild(updateAvailableButton);
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent((s, e) =>
{
diff --git a/PartPreviewWindow/PartTabPage.cs b/PartPreviewWindow/PartTabPage.cs
index 0bd275483..969bc16ea 100644
--- a/PartPreviewWindow/PartTabPage.cs
+++ b/PartPreviewWindow/PartTabPage.cs
@@ -70,6 +70,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
};
viewControls3D.OverflowMenu.DynamicPopupContent = this.GetViewControls3DOverflowMenu;
+ viewControls3D.OverflowMenu.BackgroundColor = theme.ResolveColor(theme.TabBodyBackground, theme.TabBodyBackground);
bool isPrinterType = this is PrinterTabPage;
diff --git a/PartPreviewWindow/PrinterTabPage.cs b/PartPreviewWindow/PrinterTabPage.cs
index 3bc823818..d522b1e16 100644
--- a/PartPreviewWindow/PrinterTabPage.cs
+++ b/PartPreviewWindow/PrinterTabPage.cs
@@ -144,6 +144,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
Padding = new BorderDouble(0, theme.ToolbarPadding.Top, theme.ToolbarPadding.Right, theme.ToolbarPadding.Top)
};
+ printerActionsBar.OverflowMenu.BackgroundColor = theme.ResolveColor(theme.TabBodyBackground, theme.TabBodyBackground);
// Must come after we have an instance of View3DWidget an its undo buffer
topToBottom.AddChild(printerActionsBar, 0);
diff --git a/PartPreviewWindow/Toolbar.cs b/PartPreviewWindow/Toolbar.cs
index b3548fc6c..5faee850b 100644
--- a/PartPreviewWindow/Toolbar.cs
+++ b/PartPreviewWindow/Toolbar.cs
@@ -40,21 +40,35 @@ using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
///
- /// A toolbar with an optional right anchored element and an ActionBar child to add actions to the bar
+ /// A toolbar with an optional right anchored element and an ActionBar child to add actions to the bar
///
- public class Toolbar : Bar
+ public class Toolbar : GuiWidget
{
- public FlowLayoutWidget ActionBar { get; }
+ public FlowLayoutWidget ActionArea { get; }
public Toolbar(GuiWidget rightAnchorItem, ThemeConfig theme, bool bottomBorder = true)
- : base(rightAnchorItem, theme)
{
- this.ActionBar = new FlowLayoutWidget()
+ this.ActionArea = new FlowLayoutWidget()
{
HAnchor = HAnchor.Stretch
};
- this.AddChild(this.ActionBar, 0);
+ base.AddChild(this.ActionArea, 0);
+ this.SetRightAnchorItem(rightAnchorItem);
+ }
+
+ protected void SetRightAnchorItem(GuiWidget rightAnchorItem)
+ {
+ if (rightAnchorItem != null)
+ {
+ rightAnchorItem.HAnchor |= HAnchor.Right;
+ base.AddChild(rightAnchorItem);
+ }
+ }
+
+ public override void AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
+ {
+ ActionArea.AddChild(childToAdd, indexInChildrenList);
}
}
@@ -63,21 +77,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
GuiWidget TabContent { get; }
}
- ///
- /// A toolbar like item with an optional right anchored element
- ///
- public class Bar : GuiWidget
- {
- public Bar(GuiWidget rightAnchorItem, ThemeConfig theme)
- {
- if (rightAnchorItem != null)
- {
- rightAnchorItem.HAnchor |= HAnchor.Right;
- this.AddChild(rightAnchorItem);
- }
- }
- }
-
///
/// A toolbar and associated tab body
///
@@ -117,7 +116,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
tabWidget.Click += TabWidget_Click;
- this.TabBar.ActionBar.AddChild(tabWidget, position);
+ this.TabBar.ActionArea.AddChild(tabWidget, position);
this.body.AddChild(iTab.TabContent);
}
@@ -131,7 +130,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
_allTabs.Remove(tab);
- TabBar.ActionBar.RemoveChild(tab as GuiWidget);
+ TabBar.ActionArea.RemoveChild(tab as GuiWidget);
body.RemoveChild(tab.TabContent);
ActiveTab = _allTabs.LastOrDefault();
@@ -183,7 +182,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var firstItem = this.AllTabs.OfType().FirstOrDefault();
MainTab.DrawTabLowerRight(e.graphics2D, leadingTabAdornment.LocalBounds, (firstItem == this.ActiveTab) ? theme.ActiveTabColor : theme.InactiveTabColor);
};
- this.TabBar.ActionBar.AddChild(leadingTabAdornment);
+ this.TabBar.ActionArea.AddChild(leadingTabAdornment);
// TODO: add in the printers and designs that are currently open (or were open last run).
plusTabButton = new NewTabButton(
@@ -204,12 +203,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
});
};
- this.TabBar.ActionBar.AddChild(plusTabButton);
+ this.TabBar.ActionArea.AddChild(plusTabButton);
}
public void AddTab(GuiWidget tab)
{
- var position = this.TabBar.ActionBar.GetChildIndex(plusTabButton);
+ var position = this.TabBar.ActionArea.GetChildIndex(plusTabButton);
if (tab is MainTab mainTab)
{
diff --git a/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs b/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs
new file mode 100644
index 000000000..ccfcfca30
--- /dev/null
+++ b/PartPreviewWindow/View3D/PrinterBar/OverflowBar.cs
@@ -0,0 +1,59 @@
+/*
+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.Platform;
+
+namespace MatterHackers.MatterControl.PartPreviewWindow
+{
+ public class OverflowBar : Toolbar
+ {
+ public OverflowBar(ThemeConfig theme)
+ : base(null, theme)
+ {
+ this.OverflowMenu = new OverflowMenu(IconColor.Theme)
+ {
+ AlignToRightEdge = true,
+ Margin = theme.ButtonSpacing
+ };
+
+ this.SetRightAnchorItem(this.OverflowMenu);
+ }
+
+ public OverflowMenu OverflowMenu { get; }
+
+ //// On parent changes walk back to the first ancestor with background colors and copy
+ //public override void OnParentChanged(EventArgs e)
+ //{
+ // var firstBackgroundColor = this.Parents().Where(p => p.BackgroundColor != Color.Transparent).FirstOrDefault()?.BackgroundColor;
+ // this.OverflowMenu.BackgroundColor = firstBackgroundColor ?? Color.Transparent;
+
+ // base.OnParentChanged(e);
+ //}
+ }
+}
\ No newline at end of file
diff --git a/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs b/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs
index 55da4d918..fc98c1631 100644
--- a/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs
+++ b/PartPreviewWindow/View3D/PrinterBar/PrinterActionsBar.cs
@@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
+using System.Linq;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
@@ -42,7 +43,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
- public class PrinterActionsBar : FlowLayoutWidget
+ public class PrinterActionsBar : OverflowBar
{
private PrinterConfig printer;
private EventHandler unregisterEvents;
@@ -51,12 +52,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private string noEepromMappingMessage = "Oops! There is no eeprom mapping for your printer's firmware.".Localize() + "\n\n" + "You may need to wait a minute for your printer to finish initializing.".Localize();
private string noEepromMappingTitle = "Warning - No EEProm Mapping".Localize();
- private OverflowMenu overflowMenu;
-
private PrinterTabPage printerTabPage;
internal GuiWidget sliceButton;
public PrinterActionsBar(PrinterConfig printer, PrinterTabPage printerTabPage, ThemeConfig theme)
+ : base(theme)
{
this.printer = printer;
this.printerTabPage = printerTabPage;
@@ -126,20 +126,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(new TemperatureWidgetBed(printer));
}
- overflowMenu = new OverflowMenu(IconColor.Theme)
- {
- AlignToRightEdge = true,
- Name = "Printer Overflow Menu",
- Margin = theme.ButtonSpacing
- };
- overflowMenu.DynamicPopupContent = GeneratePrinterOverflowMenu;
+ this.OverflowMenu.Name = "Printer Overflow Menu";
+ this.OverflowMenu.DynamicPopupContent = GeneratePrinterOverflowMenu;
ApplicationController.Instance.ActivePrinter.Connection.ConnectionSucceeded.RegisterEvent((s, e) =>
{
UiThread.RunOnIdle(PrintRecovery.CheckIfNeedToRecoverPrint);
}, ref unregisterEvents);
-
- this.AddChild(overflowMenu);
}
public override void AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
diff --git a/PartPreviewWindow/ViewControls3D.cs b/PartPreviewWindow/ViewControls3D.cs
index 2008ddee3..273a4f359 100644
--- a/PartPreviewWindow/ViewControls3D.cs
+++ b/PartPreviewWindow/ViewControls3D.cs
@@ -66,14 +66,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public ViewControls3DButtons TransformMode { get; set; }
}
- public class ViewControls3D : FlowLayoutWidget
+ public class ViewControls3D : OverflowBar
{
public event EventHandler ResetView;
public event EventHandler TransformStateChanged;
- internal OverflowMenu OverflowMenu;
-
private GuiWidget partSelectSeparator;
private RadioIconButton translateButton;
@@ -142,6 +140,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
public ViewControls3D(BedConfig sceneContext, ThemeConfig theme, UndoBuffer undoBuffer)
+ : base (theme)
{
this.printer = sceneContext.Printer;
@@ -328,15 +327,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(button);
}
- this.AddChild(new HorizontalSpacer());
-
- this.AddChild(this.OverflowMenu = new OverflowMenu()
- {
- Name = "View3D Overflow Menu",
- AlignToRightEdge = true,
- Margin = 3
- });
-
if (printer != null)
{
printer.ViewState.ViewModeChanged += (s, e) =>