diff --git a/ActionBar/ActionBarBaseControls.cs b/ActionBar/ActionBarBaseControls.cs index 03506d6eb..13838c3bf 100644 --- a/ActionBar/ActionBarBaseControls.cs +++ b/ActionBar/ActionBarBaseControls.cs @@ -110,7 +110,7 @@ namespace MatterHackers.MatterControl.ActionBar protected double borderWidth; protected double borderRadius; protected double padding; - protected double statusTextHeight = 10; + protected double statusTextHeight = 8; TextWidget printerStatusText; TextWidget printerNameText; @@ -133,7 +133,7 @@ namespace MatterHackers.MatterControl.ActionBar this.fillColor = fillColor; this.borderColor = borderColor; this.padding = padding; - this.Padding = new BorderDouble(10, 5); + this.Padding = new BorderDouble(10, 3); this.HAnchor = HAnchor.ParentLeftRight; FlowLayoutWidget textContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); @@ -240,10 +240,10 @@ namespace MatterHackers.MatterControl.ActionBar public class PrinterSelectButton : Button { double width = 180; - double height = 48; + double height = 39; double borderRadius = 0; double borderWidth = 1; - double fontSize = 16; + double fontSize = 14; double padding = 3; BorderDouble margin = new BorderDouble(0, 0); diff --git a/ActionBar/PrinterActionRow.cs b/ActionBar/PrinterActionRow.cs index 70482649b..27176c2bf 100644 --- a/ActionBar/PrinterActionRow.cs +++ b/ActionBar/PrinterActionRow.cs @@ -48,14 +48,14 @@ namespace MatterHackers.MatterControl.ActionBar actionBarButtonFactory.invertImageLocation = false; string connectString = "Connect".Localize().ToUpper(); connectPrinterButton = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png"); - connectPrinterButton.Margin = new BorderDouble(0, 0, 3); - connectPrinterButton.VAnchor = VAnchor.ParentCenter; + connectPrinterButton.Margin = new BorderDouble(0, 0, 3, 6); + connectPrinterButton.VAnchor = VAnchor.ParentTop; connectPrinterButton.Cursor = Cursors.Hand; string disconnectString = "Disconnect".Localize().ToUpper(); disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png"); - disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3); - disconnectPrinterButton.VAnchor = VAnchor.ParentCenter; + disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3, 6); + disconnectPrinterButton.VAnchor = VAnchor.ParentTop; disconnectPrinterButton.Visible = false; disconnectPrinterButton.Cursor = Cursors.Hand; @@ -80,33 +80,6 @@ namespace MatterHackers.MatterControl.ActionBar //this.AddChild(CreateOptionsMenu()); } - GuiWidget CreateOptionsMenu() - { - ImageBuffer gearImage = new ImageBuffer(); - string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "gear_icon.png"); - ImageIO.LoadImageData(imagePathAndFile, gearImage); - - FlowLayoutWidget leftToRight = new FlowLayoutWidget(); - leftToRight.Margin = new BorderDouble(5, 0); - string optionsString = "Options".Localize().ToUpper(); - TextWidget optionsText = new TextWidget(optionsString, textColor: ActiveTheme.Instance.PrimaryTextColor); - optionsText.VAnchor = Agg.UI.VAnchor.ParentCenter; - optionsText.Margin = new BorderDouble(0, 0, 3, 0); - leftToRight.AddChild(optionsText); - GuiWidget gearWidget = new ImageWidget(gearImage); - gearWidget.VAnchor = Agg.UI.VAnchor.ParentCenter; - leftToRight.AddChild(gearWidget); - leftToRight.HAnchor = HAnchor.FitToChildren; - leftToRight.VAnchor = VAnchor.FitToChildren; - - Menu optionMenu = new Menu(leftToRight); - optionMenu.OpenOffset = new Vector2(-2, -10); - optionMenu.VAnchor = Agg.UI.VAnchor.ParentCenter; - optionMenu.MenuItems.Add(new MenuItem(new ThemeColorSelectorWidget())); - - return optionMenu; - } - event EventHandler unregisterEvents; protected override void AddHandlers() { diff --git a/ApplicationView/ApplicationMenuRow.cs b/ApplicationView/ApplicationMenuRow.cs new file mode 100644 index 000000000..e18fcd517 --- /dev/null +++ b/ApplicationView/ApplicationMenuRow.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using MatterHackers.Agg; +using MatterHackers.Agg.Transform; +using MatterHackers.Agg.Image; +using MatterHackers.Agg.VertexSource; +using MatterHackers.Agg.UI; +using MatterHackers.Agg.Font; +using MatterHackers.VectorMath; + +using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.Localizations; + +namespace MatterHackers.MatterControl +{ + public class ApplicationMenuRow : FlowLayoutWidget + { + static FlowLayoutWidget rightElement; + + public ApplicationMenuRow() + :base(FlowDirection.LeftToRight) + { + LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); + linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; + linkButtonFactory.fontSize = 8; + + Button signInLink = linkButtonFactory.Generate("(Sign Out)"); + signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter; + signInLink.Margin = new BorderDouble(top: 0); + + this.HAnchor = HAnchor.ParentLeftRight; + this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; + + MenuOptionFile menuOptionFile = new MenuOptionFile(); + + //TextWidget menuOptionFile = new TextWidget("FILE", pointSize: 10); + + //menuOptionFile.TextColor = ActiveTheme.Instance.PrimaryTextColor; + + MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); + + rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight); + rightElement.Height = 24; + rightElement.Margin = new BorderDouble(bottom: 4); + //rightElement.VAnchor = Agg.UI.VAnchor.ParentCenter; + + this.AddChild(menuOptionFile); + this.AddChild(menuOptionHelp); + this.AddChild(new HorizontalSpacer()); + this.AddChild(rightElement); + + this.Padding = new BorderDouble(0, 0, 6, 0); + + if (privateAddRightElement != null) + { + privateAddRightElement(rightElement); + } + } + + public delegate void AddRightElementDelegate(GuiWidget iconContainer); + private static event AddRightElementDelegate privateAddRightElement; + public static event AddRightElementDelegate AddRightElement + { + add + { + privateAddRightElement += value; + // and call it right away + value(rightElement); + } + + remove + { + privateAddRightElement -= value; + } + } + } + + public class MenuOptionFile : GuiWidget + { + public DropDownMenu MenuDropList; + private TupleList> menuItems; + + public MenuOptionFile() + { + MenuDropList = new DropDownMenu("File".Localize().ToUpper(), Direction.Down,pointSize:10); + MenuDropList.MenuItemsPadding = new BorderDouble(0); + MenuDropList.Margin = new BorderDouble(0); + MenuDropList.Padding = new BorderDouble(0); + + SetMenuItems(); + + AddChild(MenuDropList); + this.Width = 44; + this.Height = 20; + this.Margin = new BorderDouble(0); + this.Padding = new BorderDouble(0); + this.VAnchor = Agg.UI.VAnchor.ParentCenter; + this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); + this.MenuDropList.OpenOffset = new Vector2(0, 0); + } + + void MenuDropList_SelectionChanged(object sender, EventArgs e) + { + string menuSelection = ((DropDownMenu)sender).SelectedValue; + foreach (Tuple> item in menuItems) + { + if (item.Item1 == menuSelection) + { + if (item.Item2 != null) + { + item.Item2(); + } + } + } + } + + void SetMenuItems() + { + menuItems = new TupleList> + { + {LocalizedString.Get("Import File"), doSomething_Click}, + {LocalizedString.Get("Exit"), doSomething_Click}, + }; + + BorderDouble padding = MenuDropList.MenuItemsPadding; + //Add the menu items to the menu itself + foreach (Tuple> item in menuItems) + { + MenuDropList.MenuItemsPadding = new BorderDouble(8,4,8,4); + MenuDropList.AddItem(item.Item1,pointSize:10); + } + MenuDropList.Padding = padding; + } + + bool doSomething_Click() + { + return true; + } + + + + + } + + public class MenuOptionHelp : GuiWidget + { + public DropDownMenu MenuDropList; + private TupleList> menuItems; + + public MenuOptionHelp() + { + MenuDropList = new DropDownMenu("Help".Localize().ToUpper(), Direction.Down, pointSize: 10); + MenuDropList.MenuItemsPadding = new BorderDouble(0); + MenuDropList.Margin = new BorderDouble(0); + MenuDropList.Padding = new BorderDouble(0); + + SetMenuItems(); + + AddChild(MenuDropList); + this.Width = 46; + this.Height = 20; + this.Margin = new BorderDouble(0); + this.Padding = new BorderDouble(0); + this.VAnchor = Agg.UI.VAnchor.ParentCenter; + this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); + this.MenuDropList.OpenOffset = new Vector2(0, 0); + } + + void MenuDropList_SelectionChanged(object sender, EventArgs e) + { + string menuSelection = ((DropDownMenu)sender).SelectedValue; + foreach (Tuple> item in menuItems) + { + if (item.Item1 == menuSelection) + { + if (item.Item2 != null) + { + item.Item2(); + } + } + } + } + + void SetMenuItems() + { + menuItems = new TupleList> + { + {LocalizedString.Get("Getting Started"), doSomething_Click}, + {LocalizedString.Get("View Help"), doSomething_Click}, + {LocalizedString.Get("About"), doSomething_Click}, + }; + + BorderDouble padding = MenuDropList.MenuItemsPadding; + //Add the menu items to the menu itself + foreach (Tuple> item in menuItems) + { + MenuDropList.MenuItemsPadding = new BorderDouble(8, 4, 8, 4); + MenuDropList.AddItem(item.Item1, pointSize: 10); + } + MenuDropList.Padding = padding; + } + + bool doSomething_Click() + { + return true; + } + + + + + } +} diff --git a/ApplicationView/MainApplicationWidget.cs b/ApplicationView/MainApplicationWidget.cs index 4aa53235d..c06a0dd7d 100644 --- a/ApplicationView/MainApplicationWidget.cs +++ b/ApplicationView/MainApplicationWidget.cs @@ -45,6 +45,7 @@ using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.PrintLibrary; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MatterControl.DataStorage; +using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.Localizations; namespace MatterHackers.MatterControl @@ -84,13 +85,30 @@ namespace MatterHackers.MatterControl } WidescreenPanel widescreenPanel; - public void AddElements() + void AddElements() { - //this.AddChild(new CompactSlidePanel()); + this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; + + FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom); + container.AnchorAll(); + + ApplicationMenuRow menuRow = new ApplicationMenuRow(); + container.AddChild(menuRow); + + GuiWidget menuSeparator = new GuiWidget(); + menuSeparator.BackgroundColor = new RGBA_Bytes(200, 200, 200); + menuSeparator.Height = 2; + menuSeparator.HAnchor = HAnchor.ParentLeftRight; + menuSeparator.Margin = new BorderDouble(3, 0); + + container.AddChild(menuSeparator); + widescreenPanel = new WidescreenPanel(); - this.AddChild(widescreenPanel); - this.AnchorAll(); - SetUpdateNotification(this, null); + container.AddChild(widescreenPanel); + + this.AddChild(container); + + } public void ReloadAll(object sender, EventArgs e) @@ -99,19 +117,25 @@ namespace MatterHackers.MatterControl { widescreenPanel.StoreUiState(); this.RemoveAllChildren(); - widescreenPanel = new WidescreenPanel(); - this.AddChild(widescreenPanel); + AddElements(); }); } + void Initialize() + { + this.AnchorAll(); + SetUpdateNotification(this, null); + } + public static ApplicationWidget Instance { get { if (globalInstance == null) { - globalInstance = new ApplicationWidget(); + globalInstance = new ApplicationWidget(); globalInstance.AddElements(); + globalInstance.Initialize(); } return globalInstance; } diff --git a/MatterControl.csproj b/MatterControl.csproj index 2b3e5d365..e0b7d9edd 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -92,6 +92,7 @@ + @@ -105,7 +106,7 @@ - + @@ -151,7 +152,7 @@ - + @@ -170,7 +171,7 @@ - + @@ -195,13 +196,13 @@ - + - + diff --git a/MatterControl.sln b/MatterControl.sln index 534558d99..1e8c8afd6 100644 --- a/MatterControl.sln +++ b/MatterControl.sln @@ -60,6 +60,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterSlice", "..\MatterSli EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launcher.csproj", "{3DF4CB3D-9A03-4256-9A81-70523AAD828B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatterControlAuth", "..\MatterControlAuth\MatterControlAuth\MatterControlAuth.csproj", "{5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -425,6 +427,18 @@ Global {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release64|x64.ActiveCfg = Release64|Any CPU {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release64|x64.Build.0 = Release64|Any CPU {3DF4CB3D-9A03-4256-9A81-70523AAD828B}.Release64|x86.ActiveCfg = Release64|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|x64.ActiveCfg = Debug|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Debug|x86.ActiveCfg = Debug|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|Any CPU.Build.0 = Release|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|x64.ActiveCfg = Release|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release|x86.ActiveCfg = Release|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|Any CPU.ActiveCfg = Release|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|Any CPU.Build.0 = Release|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|x64.ActiveCfg = Release|Any CPU + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3}.Release64|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -433,6 +447,7 @@ Global {291CD87C-2C58-4369-9D85-238C7EB31542} = {DA2BE4E5-5FB2-4C74-9170-0D2513AAFC84} {F49EC1DD-D645-4709-8667-B57318AF67B0} = {DA2BE4E5-5FB2-4C74-9170-0D2513AAFC84} {BEC6FD13-C765-4B90-836B-53823AC12E20} = {DA2BE4E5-5FB2-4C74-9170-0D2513AAFC84} + {5258F3E5-A1BB-4BCA-B899-C5CD6157D0A3} = {DA2BE4E5-5FB2-4C74-9170-0D2513AAFC84} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = MatterControl.csproj diff --git a/PrintQueue/OptionsMenue/ExportToFolderFeedbackWindow.cs b/PrintQueue/OptionsMenu/ExportToFolderFeedbackWindow.cs similarity index 100% rename from PrintQueue/OptionsMenue/ExportToFolderFeedbackWindow.cs rename to PrintQueue/OptionsMenu/ExportToFolderFeedbackWindow.cs diff --git a/PrintQueue/OptionsMenue/ExportToFolderProcess.cs b/PrintQueue/OptionsMenu/ExportToFolderProcess.cs similarity index 100% rename from PrintQueue/OptionsMenue/ExportToFolderProcess.cs rename to PrintQueue/OptionsMenu/ExportToFolderProcess.cs diff --git a/PrintQueue/OptionsMenue/ExportToSdCardFeedbackWindow.cs b/PrintQueue/OptionsMenu/ExportToSdCardFeedbackWindow.cs similarity index 100% rename from PrintQueue/OptionsMenue/ExportToSdCardFeedbackWindow.cs rename to PrintQueue/OptionsMenu/ExportToSdCardFeedbackWindow.cs diff --git a/PrintQueue/OptionsMenue/PartsSheetCreator.cs b/PrintQueue/OptionsMenu/PartsSheetCreator.cs similarity index 100% rename from PrintQueue/OptionsMenue/PartsSheetCreator.cs rename to PrintQueue/OptionsMenu/PartsSheetCreator.cs diff --git a/PrintQueue/OptionsMenue/QueueOptionsMenu.cs b/PrintQueue/OptionsMenu/QueueOptionsMenu.cs similarity index 100% rename from PrintQueue/OptionsMenue/QueueOptionsMenu.cs rename to PrintQueue/OptionsMenu/QueueOptionsMenu.cs