From 0b3bbc136bd6eaec7909f38cab1a25d0bc63e809 Mon Sep 17 00:00:00 2001 From: larsbrubaker Date: Sun, 25 Jan 2015 17:54:26 -0800 Subject: [PATCH] Fixed the number edit not to grow on Android. Made it's VAnchor always ParentCenter Made the logic to test if a part should be centered on the bed be if it was output by MatterControl Some other white space changes --- CustomWidgets/EditableNumberDisplay.cs | 4 +-- PartPreviewWindow/View3D/View3DWidget.cs | 29 ++++++++++++++++++- PrinterControls/ControlWidgets/FanControls.cs | 1 - .../ControlWidgets/TemperatureControls.cs | 2 -- PrinterControls/ManualPrinterControls.cs | 1 - PrinterControls/TemperatureIndicator.cs | 3 +- StaticData/Translations/Master.txt | 6 ++++ 7 files changed, 37 insertions(+), 9 deletions(-) diff --git a/CustomWidgets/EditableNumberDisplay.cs b/CustomWidgets/EditableNumberDisplay.cs index c7e564e55..226c47726 100644 --- a/CustomWidgets/EditableNumberDisplay.cs +++ b/CustomWidgets/EditableNumberDisplay.cs @@ -23,7 +23,7 @@ namespace MatterHackers.MatterControl : base(Agg.UI.FlowDirection.LeftToRight) { this.Margin = new BorderDouble(3, 0); - this.VAnchor |= VAnchor.ParentBottomTop; + this.VAnchor = VAnchor.ParentCenter; clickableValueContainer = new ClickWidget(); clickableValueContainer.VAnchor = VAnchor.ParentBottomTop; @@ -70,7 +70,7 @@ namespace MatterHackers.MatterControl setButton.Margin = new BorderDouble(left: 6); setButton.Visible = false; - numberInputField.ActuallNumberEdit.EnterPressed += new KeyEventHandler(ActuallNumberEdit_EnterPressed); + numberInputField.ActuallNumberEdit.EnterPressed += new KeyEventHandler(ActuallNumberEdit_EnterPressed); numberInputField.KeyDown += (sender, e) => { diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 02fb36294..126d883a9 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -659,7 +659,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // parts themselves. For now, simply mock that determination to allow testing of the proposed change and convey // when we would want to autocenter (i.e. autocenter when part was loaded outside of the new closed loop system) MeshVisualizer.MeshViewerWidget.CenterPartAfterLoad centerOnBed = MeshViewerWidget.CenterPartAfterLoad.DO; - if (printItemWrapper.FileLocation.Contains(ApplicationDataStorage.Instance.ApplicationLibraryDataPath)) + if (PartShouldBeCentered(printItemWrapper)) { centerOnBed = MeshViewerWidget.CenterPartAfterLoad.DONT; } @@ -672,6 +672,33 @@ namespace MatterHackers.MatterControl.PartPreviewWindow partHasBeenEdited = false; } + private static bool PartShouldBeCentered(PrintItemWrapper printItemWrapper) + { + if (printItemWrapper.FileLocation.Contains(ApplicationDataStorage.Instance.ApplicationLibraryDataPath)) + { + if (File.Exists(printItemWrapper.FileLocation)) + { + using (Stream uncompressedFileStream = File.OpenRead(printItemWrapper.FileLocation)) + { + using (Stream fileStream = AmfProcessing.GetCompressedStreamIfRequired(uncompressedFileStream)) + { + // read up the first 32k and make sure it says the file was created my MatterControl + int bufferSize = 32000; + byte[] buffer = new byte[bufferSize]; + int numBytesRead = fileStream.Read(buffer, 0, bufferSize); + string startingContent = System.Text.Encoding.UTF8.GetString(buffer); + if (startingContent.Contains("MatterControl")) + { + return false; + } + } + } + } + } + + return true; + } + void ExitEditingAndSaveIfRequired(bool response) { if (response == true) diff --git a/PrinterControls/ControlWidgets/FanControls.cs b/PrinterControls/ControlWidgets/FanControls.cs index 591aa5333..5af8a730e 100644 --- a/PrinterControls/ControlWidgets/FanControls.cs +++ b/PrinterControls/ControlWidgets/FanControls.cs @@ -79,7 +79,6 @@ namespace MatterHackers.MatterControl.PrinterControls SetDisplayAttributes(); fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, "{0}%".FormatWith(PrinterConnectionAndCommunication.Instance.FanSpeed0To255.ToString()), "100%"); - fanSpeedDisplay.VAnchor = VAnchor.ParentCenter; fanSpeedDisplay.EditComplete += (sender, e) => { PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100); diff --git a/PrinterControls/ControlWidgets/TemperatureControls.cs b/PrinterControls/ControlWidgets/TemperatureControls.cs index ea189bd83..595788be7 100644 --- a/PrinterControls/ControlWidgets/TemperatureControls.cs +++ b/PrinterControls/ControlWidgets/TemperatureControls.cs @@ -20,7 +20,6 @@ namespace MatterHackers.MatterControl.PrinterControls { public class TemperatureControls : ControlWidgetBase { - public List ExtruderWidgetContainers = new List(); public DisableableWidget BedTemperatureControlWidget; @@ -55,7 +54,6 @@ namespace MatterHackers.MatterControl.PrinterControls mainContainer.AddChild(extruderTemperatureControlWidget); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); ExtruderWidgetContainers.Add(extruderTemperatureControlWidget); - } } else diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs index 8e199bcc0..88c4712a9 100644 --- a/PrinterControls/ManualPrinterControls.cs +++ b/PrinterControls/ManualPrinterControls.cs @@ -61,7 +61,6 @@ namespace MatterHackers.MatterControl TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(); static public RootedObjectEventHandler AddPluginControls = new RootedObjectEventHandler(); - public ManualPrinterControls() { diff --git a/PrinterControls/TemperatureIndicator.cs b/PrinterControls/TemperatureIndicator.cs index 38af09100..58c82acc6 100644 --- a/PrinterControls/TemperatureIndicator.cs +++ b/PrinterControls/TemperatureIndicator.cs @@ -186,8 +186,7 @@ namespace MatterHackers.MatterControl // put in the target temperature controls temperatureIndicator.AddChild(GetTargetTemperatureDisplay()); - FlowLayoutWidget helperTextWidget = GetHelpTextWidget(); - + FlowLayoutWidget helperTextWidget = GetHelpTextWidget(); GuiWidget hspacer = new GuiWidget(); hspacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 9ecb91e1f..b641e97af 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -3092,3 +3092,9 @@ Translated:Specify if your printer has the ability to do print leveling directly English:Has Hardware Leveling Translated:Has Hardware Leveling +English:The Fill Density must be between 0 and 1 inclusive. +Translated:The Fill Density must be between 0 and 1 inclusive. + +English:Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Infill' +Translated:Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Infill' +