From cc44b0ef04f9ae90eab1cee831fc10c983032d77 Mon Sep 17 00:00:00 2001 From: kevinepope Date: Sun, 27 Apr 2014 20:24:58 -0700 Subject: [PATCH 1/4] Added menu bar. --- ActionBar/ActionBarBaseControls.cs | 8 +- ActionBar/PrinterActionRow.cs | 35 +-- ApplicationView/ApplicationMenuRow.cs | 215 ++++++++++++++++++ ApplicationView/MainApplicationWidget.cs | 40 +++- MatterControl.csproj | 11 +- MatterControl.sln | 15 ++ .../ExportToFolderFeedbackWindow.cs | 0 .../ExportToFolderProcess.cs | 0 .../ExportToSdCardFeedbackWindow.cs | 0 .../PartsSheetCreator.cs | 0 .../QueueOptionsMenu.cs | 0 11 files changed, 276 insertions(+), 48 deletions(-) create mode 100644 ApplicationView/ApplicationMenuRow.cs rename PrintQueue/{OptionsMenue => OptionsMenu}/ExportToFolderFeedbackWindow.cs (100%) rename PrintQueue/{OptionsMenue => OptionsMenu}/ExportToFolderProcess.cs (100%) rename PrintQueue/{OptionsMenue => OptionsMenu}/ExportToSdCardFeedbackWindow.cs (100%) rename PrintQueue/{OptionsMenue => OptionsMenu}/PartsSheetCreator.cs (100%) rename PrintQueue/{OptionsMenue => OptionsMenu}/QueueOptionsMenu.cs (100%) 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 From 02cc3cf5630b4272c408c67d2c3526cd038266c0 Mon Sep 17 00:00:00 2001 From: kevinepope Date: Sun, 27 Apr 2014 20:40:22 -0700 Subject: [PATCH 2/4] Hooked up functionality for file menu options. --- ApplicationView/ApplicationMenuRow.cs | 42 +++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/ApplicationView/ApplicationMenuRow.cs b/ApplicationView/ApplicationMenuRow.cs index e18fcd517..86fe2cc7e 100644 --- a/ApplicationView/ApplicationMenuRow.cs +++ b/ApplicationView/ApplicationMenuRow.cs @@ -2,6 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.IO; + + using MatterHackers.Agg; using MatterHackers.Agg.Transform; @@ -11,7 +14,9 @@ using MatterHackers.Agg.UI; using MatterHackers.Agg.Font; using MatterHackers.VectorMath; +using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.MatterControl.DataStorage; using MatterHackers.Localizations; namespace MatterHackers.MatterControl @@ -121,8 +126,8 @@ namespace MatterHackers.MatterControl { menuItems = new TupleList> { - {LocalizedString.Get("Import File"), doSomething_Click}, - {LocalizedString.Get("Exit"), doSomething_Click}, + {LocalizedString.Get("Import File"), importFile_Click}, + {LocalizedString.Get("Exit"), exit_Click}, }; BorderDouble padding = MenuDropList.MenuItemsPadding; @@ -135,8 +140,39 @@ namespace MatterHackers.MatterControl MenuDropList.Padding = padding; } - bool doSomething_Click() + bool importFile_Click() { + UiThread.RunOnIdle((state) => + { + OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file, Select a GCODE file|*.stl;*.gcode", multiSelect: true); + openParams.ActionButtonLabel = "Add to Queue"; + openParams.Title = "MatterControl: Select A File"; + + FileDialog.OpenFileDialog(ref openParams); + if (openParams.FileNames != null) + { + foreach (string loadedFileName in openParams.FileNames) + { + QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName)))); + } + } + }); + return true; + } + + bool exit_Click() + { + UiThread.RunOnIdle((state) => + { + GuiWidget parent = this; + while (parent as MatterControlApplication == null) + { + parent = parent.Parent; + } + MatterControlApplication app = parent as MatterControlApplication; + app.RestartOnClose = false; + app.Close(); + }); return true; } From d4b924e5e5471eb9a7d4da61ec47415552747186 Mon Sep 17 00:00:00 2001 From: kevinepope Date: Sun, 27 Apr 2014 20:49:29 -0700 Subject: [PATCH 3/4] Visual adjustments --- ActionBar/ActionBarBaseControls.cs | 2 +- ActionBar/PrinterActionRow.cs | 8 ++++---- ApplicationView/ApplicationMenuRow.cs | 16 ++++------------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/ActionBar/ActionBarBaseControls.cs b/ActionBar/ActionBarBaseControls.cs index 13838c3bf..0920825d8 100644 --- a/ActionBar/ActionBarBaseControls.cs +++ b/ActionBar/ActionBarBaseControls.cs @@ -240,7 +240,7 @@ namespace MatterHackers.MatterControl.ActionBar public class PrinterSelectButton : Button { double width = 180; - double height = 39; + double height = 40; double borderRadius = 0; double borderWidth = 1; double fontSize = 14; diff --git a/ActionBar/PrinterActionRow.cs b/ActionBar/PrinterActionRow.cs index 27176c2bf..d4a7c3a22 100644 --- a/ActionBar/PrinterActionRow.cs +++ b/ActionBar/PrinterActionRow.cs @@ -48,13 +48,13 @@ 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, 6); + connectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3); 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, 6); + disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3); disconnectPrinterButton.VAnchor = VAnchor.ParentTop; disconnectPrinterButton.Visible = false; disconnectPrinterButton.Cursor = Cursors.Hand; @@ -64,11 +64,11 @@ namespace MatterHackers.MatterControl.ActionBar selectActivePrinterButton.Cursor = Cursors.Hand; if (ApplicationWidget.Instance.WidescreenMode) { - selectActivePrinterButton.Margin = new BorderDouble(0, 6); + selectActivePrinterButton.Margin = new BorderDouble(0, 6,0,3); } else { - selectActivePrinterButton.Margin = new BorderDouble(0, 6, 6, 6); + selectActivePrinterButton.Margin = new BorderDouble(0, 6, 6, 3); } diff --git a/ApplicationView/ApplicationMenuRow.cs b/ApplicationView/ApplicationMenuRow.cs index 86fe2cc7e..e52165b2b 100644 --- a/ApplicationView/ApplicationMenuRow.cs +++ b/ApplicationView/ApplicationMenuRow.cs @@ -99,7 +99,7 @@ namespace MatterHackers.MatterControl AddChild(MenuDropList); this.Width = 44; - this.Height = 20; + this.Height = 22; this.Margin = new BorderDouble(0); this.Padding = new BorderDouble(0); this.VAnchor = Agg.UI.VAnchor.ParentCenter; @@ -174,11 +174,7 @@ namespace MatterHackers.MatterControl app.Close(); }); return true; - } - - - - + } } public class MenuOptionHelp : GuiWidget @@ -196,8 +192,8 @@ namespace MatterHackers.MatterControl SetMenuItems(); AddChild(MenuDropList); - this.Width = 46; - this.Height = 20; + this.Width = 48; + this.Height = 22; this.Margin = new BorderDouble(0); this.Padding = new BorderDouble(0); this.VAnchor = Agg.UI.VAnchor.ParentCenter; @@ -243,9 +239,5 @@ namespace MatterHackers.MatterControl { return true; } - - - - } } From 2611bf262f47cde80d4e62e5e1ea03a66cea3ac6 Mon Sep 17 00:00:00 2001 From: kevinepope Date: Sun, 27 Apr 2014 21:00:07 -0700 Subject: [PATCH 4/4] Added help links. --- ApplicationView/ApplicationMenuRow.cs | 31 +++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/ApplicationView/ApplicationMenuRow.cs b/ApplicationView/ApplicationMenuRow.cs index e52165b2b..f54b165a2 100644 --- a/ApplicationView/ApplicationMenuRow.cs +++ b/ApplicationView/ApplicationMenuRow.cs @@ -220,9 +220,9 @@ namespace MatterHackers.MatterControl { menuItems = new TupleList> { - {LocalizedString.Get("Getting Started"), doSomething_Click}, - {LocalizedString.Get("View Help"), doSomething_Click}, - {LocalizedString.Get("About"), doSomething_Click}, + {LocalizedString.Get("Getting Started"), gettingStarted_Click}, + {LocalizedString.Get("View Help"), help_Click}, + {LocalizedString.Get("About"), about_Click}, }; BorderDouble padding = MenuDropList.MenuItemsPadding; @@ -235,8 +235,31 @@ namespace MatterHackers.MatterControl MenuDropList.Padding = padding; } - bool doSomething_Click() + bool help_Click() { + UiThread.RunOnIdle((state) => + { + System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles"); + }); + return true; + } + + bool about_Click() + { + UiThread.RunOnIdle((state) => + { + System.Diagnostics.Process.Start("http://www.mattercontrol.com/"); + }); + return true; + } + + bool gettingStarted_Click() + { + UiThread.RunOnIdle((state) => + { + System.Diagnostics.Process.Start("http://www.mattercontrol.com/articles/mattercontrol-getting-started"); + }); + return true; } }