diff --git a/Library/CreateFolderWindow.cs b/Library/CreateFolderWindow.cs index a4b553b47..404e7c0c4 100644 --- a/Library/CreateFolderWindow.cs +++ b/Library/CreateFolderWindow.cs @@ -106,15 +106,10 @@ namespace MatterHackers.MatterControl ShowAsSystemWindow(); } - bool firstDraw = true; - public override void OnDraw(Graphics2D graphics2D) + public override void OnLoad(EventArgs args) { - if (firstDraw) - { - UiThread.RunOnIdle(folderNameWidget.Focus); - firstDraw = false; - } - base.OnDraw(graphics2D); + UiThread.RunOnIdle(folderNameWidget.Focus); + base.OnLoad(args); } private void ActualTextEditWidget_EnterPressed(object sender, KeyEventArgs keyEvent) diff --git a/Library/RenameItemWindow.cs b/Library/RenameItemWindow.cs index 49a6a46ba..ec8e4db98 100644 --- a/Library/RenameItemWindow.cs +++ b/Library/RenameItemWindow.cs @@ -127,20 +127,14 @@ namespace MatterHackers.MatterControl ShowAsSystemWindow(); } - bool firstDraw = true; - public override void OnDraw(Graphics2D graphics2D) + public override void OnLoad(EventArgs args) { - if (firstDraw) + UiThread.RunOnIdle(() => { - UiThread.RunOnIdle(() => - { - saveAsNameWidget.Focus(); - saveAsNameWidget.ActualTextEditWidget.InternalTextEditWidget.SelectAll(); - }); - - firstDraw = false; - } - base.OnDraw(graphics2D); + saveAsNameWidget.Focus(); + saveAsNameWidget.ActualTextEditWidget.InternalTextEditWidget.SelectAll(); + }); + base.OnLoad(args); } private void ActualTextEditWidget_EnterPressed(object sender, KeyEventArgs keyEvent) diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index b014e579d..a8da65d72 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -69,7 +69,6 @@ namespace MatterHackers.MatterControl private string confirmExit = "Confirm Exit".Localize(); private bool DoCGCollectEveryDraw = false; private int drawCount = 0; - private bool firstDraw = true; private AverageMillisecondTimer millisecondTimer = new AverageMillisecondTimer(); private DataViewGraph msGraph; private string savePartsSheetExitAnywayMessage = "You are currently saving a parts sheet, are you sure you want to exit?".Localize(); @@ -634,22 +633,25 @@ namespace MatterHackers.MatterControl } } - if (firstDraw) + //msGraph.AddData("ms", totalDrawTime.ElapsedMilliseconds); + //msGraph.Draw(MatterHackers.Agg.Transform.Affine.NewIdentity(), graphics2D); + } + + public override void OnLoad(EventArgs args) + { + foreach (string arg in commandLineArgs) { - firstDraw = false; - foreach (string arg in commandLineArgs) + string argExtension = Path.GetExtension(arg).ToUpper(); + if (argExtension.Length > 1 + && MeshFileIo.ValidFileExtensions().Contains(argExtension)) { - string argExtension = Path.GetExtension(arg).ToUpper(); - if (argExtension.Length > 1 - && MeshFileIo.ValidFileExtensions().Contains(argExtension)) - { - QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg)))); - } + QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg)))); } + } - TerminalWindow.ShowIfLeftOpen(); + TerminalWindow.ShowIfLeftOpen(); - ApplicationController.Instance.OnLoadActions(); + ApplicationController.Instance.OnLoadActions(); #if false { @@ -668,10 +670,6 @@ namespace MatterHackers.MatterControl }, 1); } #endif - } - - //msGraph.AddData("ms", totalDrawTime.ElapsedMilliseconds); - //msGraph.Draw(MatterHackers.Agg.Transform.Affine.NewIdentity(), graphics2D); } public override void OnMouseMove(MouseEventArgs mouseEvent) diff --git a/PartPreviewWindow/SaveAsWindow.cs b/PartPreviewWindow/SaveAsWindow.cs index b39f267ba..1fc14c483 100644 --- a/PartPreviewWindow/SaveAsWindow.cs +++ b/PartPreviewWindow/SaveAsWindow.cs @@ -160,19 +160,14 @@ namespace MatterHackers.MatterControl saveAsButton.Enabled = true; } - bool firstDraw = true; - public override void OnDraw(Graphics2D graphics2D) + public override void OnLoad(EventArgs args) { - if (firstDraw) + if (textToAddWidget != null + && !UserSettings.Instance.IsTouchScreen) { - if (textToAddWidget != null - && !UserSettings.Instance.IsTouchScreen) - { - UiThread.RunOnIdle(textToAddWidget.Focus); - } - firstDraw = false; + UiThread.RunOnIdle(textToAddWidget.Focus); } - base.OnDraw(graphics2D); + base.OnLoad(args); } private void ActualTextEditWidget_EnterPressed(object sender, KeyEventArgs keyEvent) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 4b234ed03..c6c9983e8 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -104,7 +104,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private CheckBox expandViewOptions; private ExportPrintItemWindow exportingWindow = null; private ObservableCollection extruderButtons = new ObservableCollection(); - private bool firstDraw = true; private bool hasDrawn = false; private FlowLayoutWidget materialOptionContainer; public List MeshGroupExtraData { get; private set; } @@ -837,14 +836,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow base.OnDragOver(fileDropEventArgs); } + public override void OnLoad(EventArgs args) + { + ClearBedAndLoadPrintItemWrapper(printItemWrapper); + base.OnLoad(args); + } + public override void OnDraw(Graphics2D graphics2D) { - if (firstDraw) - { - ClearBedAndLoadPrintItemWrapper(printItemWrapper); - firstDraw = false; - } - if (HaveSelection) { foreach (InteractionVolume volume in meshViewerWidget.interactionVolumes) diff --git a/PrinterControls/TerminalWindow/TerminalWidget.cs b/PrinterControls/TerminalWindow/TerminalWidget.cs index 4fce4ab08..9bce5fdf0 100644 --- a/PrinterControls/TerminalWindow/TerminalWidget.cs +++ b/PrinterControls/TerminalWindow/TerminalWidget.cs @@ -207,20 +207,14 @@ namespace MatterHackers.MatterControl FileDialog.SaveFileDialog(saveParams, onExportLogFileSelected); } - private bool firstDraw = true; - - public override void OnDraw(Graphics2D graphics2D) - { #if !__ANDROID__ - if (firstDraw) - { - filterOutput.Checked = UserSettings.Instance.Fields.GetBool(TerminalFilterOutputKey, false); - firstDraw = false; - UiThread.RunOnIdle(manualCommandTextEdit.Focus); - } -#endif - base.OnDraw(graphics2D); + public override void OnLoad(EventArgs args) + { + filterOutput.Checked = UserSettings.Instance.Fields.GetBool(TerminalFilterOutputKey, false); + UiThread.RunOnIdle(manualCommandTextEdit.Focus); + base.OnLoad(args); } +#endif readonly static string writeFaildeWaring = "WARNING: Write Failed!".Localize(); readonly static string cantAccessPath = "Can't access '{0}'.".Localize(); diff --git a/Queue/QueueDataView.cs b/Queue/QueueDataView.cs index ca13d3065..f2b36e39d 100644 --- a/Queue/QueueDataView.cs +++ b/Queue/QueueDataView.cs @@ -371,16 +371,10 @@ namespace MatterHackers.MatterControl.PrintQueue throw new NotImplementedException(); } - private bool firstDraw = true; - - public override void OnDraw(Graphics2D graphics2D) + public override void OnLoad(EventArgs args) { - if (firstDraw) - { - firstDraw = false; - EnsureSelection(); - } - base.OnDraw(graphics2D); + EnsureSelection(); + base.OnLoad(args); } public override void OnClosed(EventArgs e) diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 710cefe48..5fe3ead06 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 710cefe4888ea6e48c56455dcc0a81a79f4cb663 +Subproject commit 5fe3ead0688e35778c48e037209d60c1f1d08f34