From 3f0850a752894aa57c1f3108637d869a5aa3334b Mon Sep 17 00:00:00 2001 From: Kevin Pope Date: Thu, 9 Oct 2014 12:23:31 -0700 Subject: [PATCH] UI related updates. Work on formatting of print history and print library items. Made slice settings import work asynchronously. --- .../Community.CsharpSqlite.csproj | 12 +++++- CustomWidgets/ClickWidget.cs | 10 +++-- CustomWidgets/SlideWidget.cs | 2 +- MatterControl.csproj | 19 +++------ PluginSystem/MatterControlPluginSystem.csproj | 14 ++++++- PrintHistory/PrintHistoryListItem.cs | 6 +-- PrintLibrary/LibraryRowItem.cs | 26 ++++++------- PrintLibrary/PrintLibraryWidget.cs | 2 +- PrintQueue/QueueRowItem.cs | 8 ++-- PrinterDriverInstaller/InfInstaller.csproj | 15 +++++-- SlicerConfiguration/ActiveSliceSettings.cs | 39 ++++++++++++------- SlicerConfiguration/SliceSettingsWidget.cs | 1 - 12 files changed, 94 insertions(+), 60 deletions(-) diff --git a/Community.CsharpSqlite/Community.CsharpSqlite.csproj b/Community.CsharpSqlite/Community.CsharpSqlite.csproj index a0e05998e..6e5052ed7 100644 --- a/Community.CsharpSqlite/Community.CsharpSqlite.csproj +++ b/Community.CsharpSqlite/Community.CsharpSqlite.csproj @@ -30,7 +30,7 @@ false false true - 0.8.2 + 1.1.4 True @@ -115,6 +115,8 @@ false false false + 4 + false true @@ -127,6 +129,8 @@ false false false + 4 + false true @@ -138,6 +142,8 @@ AllRules.ruleset false false + 4 + false bin\x64\Release\ @@ -148,6 +154,7 @@ AllRules.ruleset false false + 4 bin\x64\Release64\ @@ -163,6 +170,7 @@ false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false + 4 true @@ -174,6 +182,8 @@ AllRules.ruleset false false + 4 + false diff --git a/CustomWidgets/ClickWidget.cs b/CustomWidgets/ClickWidget.cs index ef48cf619..405e46a84 100644 --- a/CustomWidgets/ClickWidget.cs +++ b/CustomWidgets/ClickWidget.cs @@ -90,12 +90,16 @@ namespace MatterHackers.MatterControl PrivateClick(this, mouseEvent); } } - + + public bool GetChildClicks = false; override public void OnMouseUp(MouseEventArgs mouseEvent) { - if (PositionWithinLocalBounds(mouseEvent.X, mouseEvent.Y) && this.MouseCaptured == true) + if (PositionWithinLocalBounds(mouseEvent.X, mouseEvent.Y)) { - ClickButton(mouseEvent); + if (GetChildClicks || this.MouseCaptured == true) + { + ClickButton(mouseEvent); + } } base.OnMouseUp(mouseEvent); diff --git a/CustomWidgets/SlideWidget.cs b/CustomWidgets/SlideWidget.cs index b96e3b5ae..f0a18e953 100644 --- a/CustomWidgets/SlideWidget.cs +++ b/CustomWidgets/SlideWidget.cs @@ -13,7 +13,7 @@ namespace MatterHackers.MatterControl Stopwatch timeHasBeenChanging = new Stopwatch(); public SlideWidget() - :base(0,0) + :base(0.0,0.0) { } diff --git a/MatterControl.csproj b/MatterControl.csproj index 950c469bb..3f3d593ec 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -38,6 +38,7 @@ true 8.0.30703 2.0 + 1.1.4 True @@ -351,10 +352,6 @@ {D3ABF72C-64C2-4E51-A119-E077210FA990} SerialPortCommunication - - {A526DC5D-65F3-461B-805F-D3AC9665F5C9} - WindowsFileDialogs - {C46CA728-DD2F-4DD1-971A-AAA89D9DFF95} MatterSlice @@ -371,10 +368,6 @@ {F1653F20-D47D-4F29-8C55-3C835542AF5F} Community.CsharpSqlite - - {3DF4CB3D-9A03-4256-9A81-70523AAD828B} - Launcher - {990A9AD3-B6A4-407B-9DFC-9C722AF7C9B9} InfInstaller @@ -395,17 +388,17 @@ {670BDDFF-927B-425D-9DD1-22ACB14356EB} PlatformWin32 - - {CA96058C-1A37-465D-A357-D6D695B13D25} - Localizations - {865172A0-A1A9-49C2-9386-F2FDB4E141B7} MatterControlPluginSystem - + {657DBC6D-C3EA-4398-A3FA-DDB73C14F71B} Agg + + {CA96058C-1A37-465D-A357-D6D695B13D25} + Localizations + \ No newline at end of file diff --git a/PluginSystem/MatterControlPluginSystem.csproj b/PluginSystem/MatterControlPluginSystem.csproj index e29abdef0..a4eb9d3d2 100644 --- a/PluginSystem/MatterControlPluginSystem.csproj +++ b/PluginSystem/MatterControlPluginSystem.csproj @@ -1,9 +1,9 @@  - Release + Debug AnyCPU - 8.0.50727 + 8.0.30703 2.0 {865172A0-A1A9-49C2-9386-F2FDB4E141B7} Library @@ -15,6 +15,7 @@ 2.0 + 1.1.4 True @@ -54,6 +55,7 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false false + 4 true @@ -65,6 +67,8 @@ prompt false false + 4 + false true @@ -76,6 +80,8 @@ prompt false false + 4 + false bin\x64\Release\ @@ -87,6 +93,7 @@ prompt false false + 4 bin\x64\Release64\ @@ -103,6 +110,7 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + 4 true @@ -115,6 +123,8 @@ false false false + 4 + false diff --git a/PrintHistory/PrintHistoryListItem.cs b/PrintHistory/PrintHistoryListItem.cs index 362809da6..39b3d2737 100644 --- a/PrintHistory/PrintHistoryListItem.cs +++ b/PrintHistory/PrintHistoryListItem.cs @@ -158,7 +158,7 @@ namespace MatterHackers.MatterControl.PrintHistory actionButtonContainer = new SlideWidget(); actionButtonContainer.VAnchor = VAnchor.ParentBottomTop; - actionButtonContainer.Width = 160; + actionButtonContainer.Width = 200; actionButtonContainer.Visible = false; FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.LeftToRight); @@ -167,7 +167,7 @@ namespace MatterHackers.MatterControl.PrintHistory ClickWidget viewButton = new ClickWidget(); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; - viewButton.Width = 80; + viewButton.Width = 100; TextWidget viewLabel = new TextWidget("View".Localize()); viewLabel.TextColor = RGBA_Bytes.White; @@ -181,7 +181,7 @@ namespace MatterHackers.MatterControl.PrintHistory ClickWidget printButton = new ClickWidget(); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; - printButton.Width = 80; + printButton.Width = 100; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; diff --git a/PrintLibrary/LibraryRowItem.cs b/PrintLibrary/LibraryRowItem.cs index e89799075..36a8920d4 100644 --- a/PrintLibrary/LibraryRowItem.cs +++ b/PrintLibrary/LibraryRowItem.cs @@ -142,7 +142,7 @@ namespace MatterHackers.MatterControl.PrintLibrary selectionCheckBox.HAnchor = HAnchor.ParentCenter; selectionCheckBoxContainer.AddChild(selectionCheckBox); - GuiWidget middleColumn = new GuiWidget(0, 0); + GuiWidget middleColumn = new GuiWidget(0.0, 0.0); middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight; middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop; middleColumn.Margin = new BorderDouble(10, 6); @@ -191,7 +191,7 @@ namespace MatterHackers.MatterControl.PrintLibrary ClickWidget printButton = new ClickWidget(); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; - printButton.Width = 80; + printButton.Width = 100; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; @@ -209,21 +209,21 @@ namespace MatterHackers.MatterControl.PrintLibrary ClickWidget editButton = new ClickWidget(); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; - editButton.Width = 80; + editButton.Width = 100; - TextWidget editLabel = new TextWidget("Edit".Localize()); + TextWidget editLabel = new TextWidget("View".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; editButton.AddChild(editLabel); - editButton.Click += onEditPartClick; + editButton.Click += onViewPartClick; buttonFlowContainer.AddChild(editButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); - buttonContainer.Width = 160; + buttonContainer.Width = 200; return buttonContainer; } @@ -232,7 +232,7 @@ namespace MatterHackers.MatterControl.PrintLibrary { //this.VAnchor = Agg.UI.VAnchor.FitToChildren; this.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - this.Height = 50; + this.Height = 65; this.Padding = new BorderDouble(0); this.Margin = new BorderDouble(6, 0, 6, 6); } @@ -273,10 +273,10 @@ namespace MatterHackers.MatterControl.PrintLibrary { if (this.libraryDataView.EditMode == false) { - UiThread.RunOnIdle((state) => - { - openPartView(state); - }); + //UiThread.RunOnIdle((state) => + //{ + // openPartView(state); + //}); } else { @@ -331,11 +331,11 @@ namespace MatterHackers.MatterControl.PrintLibrary }); } - private void onEditPartClick(object sender, MouseEventArgs e) + private void onViewPartClick(object sender, MouseEventArgs e) { UiThread.RunOnIdle((state) => { - openPartView(state, true); + openPartView(state, false); }); } diff --git a/PrintLibrary/PrintLibraryWidget.cs b/PrintLibrary/PrintLibraryWidget.cs index 264c2be3c..a2fe2e676 100644 --- a/PrintLibrary/PrintLibraryWidget.cs +++ b/PrintLibrary/PrintLibraryWidget.cs @@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.PrintLibrary editButtonFactory.disabledTextColor = ActiveTheme.Instance.SecondaryAccentColor; editButtonFactory.pressedTextColor = RGBA_Bytes.White; editButtonFactory.borderWidth = 0; - editButtonFactory.FixedWidth = 50; + editButtonFactory.FixedWidth = 70; FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); { diff --git a/PrintQueue/QueueRowItem.cs b/PrintQueue/QueueRowItem.cs index 10b555804..33f2b41fe 100644 --- a/PrintQueue/QueueRowItem.cs +++ b/PrintQueue/QueueRowItem.cs @@ -179,7 +179,7 @@ namespace MatterHackers.MatterControl.PrintQueue ClickWidget printButton = new ClickWidget(); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; - printButton.Width = 80; + printButton.Width = 100; TextWidget printLabel = new TextWidget("Remove".Localize()); printLabel.TextColor = RGBA_Bytes.White; @@ -195,7 +195,7 @@ namespace MatterHackers.MatterControl.PrintQueue ClickWidget editButton = new ClickWidget(); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; - editButton.Width = 80; + editButton.Width = 100; TextWidget editLabel = new TextWidget("Edit".Localize()); editLabel.TextColor = RGBA_Bytes.White; @@ -209,8 +209,8 @@ namespace MatterHackers.MatterControl.PrintQueue buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); - //buttonContainer.Width = 160; - buttonContainer.Width = 80; + //buttonContainer.Width = 200; + buttonContainer.Width = 100; return buttonContainer; } diff --git a/PrinterDriverInstaller/InfInstaller.csproj b/PrinterDriverInstaller/InfInstaller.csproj index bc66dfdca..64a0b0ccc 100644 --- a/PrinterDriverInstaller/InfInstaller.csproj +++ b/PrinterDriverInstaller/InfInstaller.csproj @@ -1,9 +1,9 @@  - Release + Debug AnyCPU - 8.0.50727 + 8.0.30703 2.0 {990A9AD3-B6A4-407B-9DFC-9C722AF7C9B9} Exe @@ -16,7 +16,7 @@ 2.0 - 0.8.2 + 1.1.4 True @@ -54,6 +54,7 @@ false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false + 4 true @@ -65,6 +66,8 @@ prompt false false + 4 + false true @@ -76,6 +79,8 @@ prompt false false + 4 + false bin\x64\Release\ @@ -87,6 +92,7 @@ prompt false false + 4 bin\x64\Release64\ @@ -103,6 +109,7 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + 4 true @@ -114,6 +121,8 @@ prompt false false + 4 + false diff --git a/SlicerConfiguration/ActiveSliceSettings.cs b/SlicerConfiguration/ActiveSliceSettings.cs index c861b169a..e62036392 100644 --- a/SlicerConfiguration/ActiveSliceSettings.cs +++ b/SlicerConfiguration/ActiveSliceSettings.cs @@ -509,22 +509,25 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.activeSettingsLayers.Add(defaultSettingsLayer); } - public bool LoadSettingsFromIni() + public void LoadSettingsFromIni(object state) { OpenFileDialogParams openParams = new OpenFileDialogParams("Load Slice Configuration|*.slice;*.ini"); openParams.ActionButtonLabel = "Load Configuration"; openParams.Title = "MatterControl: Select A File"; - FileDialog.OpenFileDialog(ref openParams); - if (openParams.FileNames != null) - { - LoadConfigurationSettingsFromFileAsUnsaved(openParams.FileName); - return true; - } + FileDialog.OpenFileDialog(openParams, onSettingsFileSelected); - return false; } + void onSettingsFileSelected(OpenFileDialogParams openParams) + { + if (openParams.FileNames != null) + { + LoadConfigurationSettingsFromFileAsUnsaved(openParams.FileName); + ApplicationController.Instance.ReloadAdvancedControlsPanel(); + } + } + public SettingsLayer LoadConfigurationSettingsFromFile(string pathAndFileName, DataStorage.SliceSettingsCollection collection) { Dictionary settingsDictionary = new Dictionary(); @@ -640,15 +643,19 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Slice Configuration|*." + configFileExtension,documentsPath); - - System.IO.Stream streamToSaveTo = FileDialog.SaveFileDialog (ref saveParams); - if (streamToSaveTo != null) - { - streamToSaveTo.Close(); - GenerateConfigFile(saveParams.FileName); - } + saveParams.FileName = "default_settings.ini"; + FileDialog.SaveFileDialog(saveParams, onExportFileSelected); } + void onExportFileSelected(SaveFileDialogParams saveParams) + { + if (saveParams.FileName != null) + { + GenerateConfigFile(saveParams.FileName); + } + + } + public override int GetHashCode() { if (this.settingsHashCode == 0) @@ -678,6 +685,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } string configFileAsString = string.Join("\n", configFileAsList.ToArray()); + //To do - add file extension if it doesn't exist + FileStream fs = new FileStream(fileName, FileMode.Create); StreamWriter sw = new System.IO.StreamWriter(fs); sw.Write(configFileAsString); diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 4beee3ccd..d24486229 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -83,7 +83,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration noConnectionMessageContainer = new AltGroupBox(new TextWidget(LocalizedString.Get("No Printer Selected"), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); noConnectionMessageContainer.Margin = new BorderDouble(top: 10); - noConnectionMessageContainer.TextColor = ActiveTheme.Instance.PrimaryTextColor; noConnectionMessageContainer.BorderColor = ActiveTheme.Instance.PrimaryTextColor; noConnectionMessageContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; noConnectionMessageContainer.Height = 80;