diff --git a/LaserGRBL/Core/GrblCore.cs b/LaserGRBL/Core/GrblCore.cs index 519a603d..aa0149a9 100644 --- a/LaserGRBL/Core/GrblCore.cs +++ b/LaserGRBL/Core/GrblCore.cs @@ -1211,7 +1211,7 @@ public void AbortProgram() lock (this) { - mQueue.Clear(); //flush the queue of item to send + ClearQueue(mQueue); //flush the queue of item to send mQueue.Enqueue(new GrblCommand("M5")); //shut down laser } } @@ -2679,10 +2679,19 @@ private void OnProgramEnd() private bool InPause { get { return mMachineStatus != MacStatus.Run && mMachineStatus != MacStatus.Idle; } } - private void ClearQueue(bool sent) + private void ClearQueue(Queue queue) + { + foreach (GrblCommand command in queue) + { + command.Dispose(); + } + queue.Clear(); + } + + private void ClearQueue(bool sent) { - mQueue.Clear(); - mPending.Clear(); + ClearQueue(mQueue); + ClearQueue(mPending); if (sent) mSent.Clear(); mRetryQueue = null; } diff --git a/LaserGRBL/GrblCommand.cs b/LaserGRBL/GrblCommand.cs index 3de1d076..9acc89bd 100644 --- a/LaserGRBL/GrblCommand.cs +++ b/LaserGRBL/GrblCommand.cs @@ -90,7 +90,7 @@ private static void LoadAppropriateErrors(GrblCore.GrblVersionInfo value) } } - public partial class GrblCommand : ICloneable, IGrblRow + public partial class GrblCommand : ICloneable, IGrblRow, IDisposable { public class Element { @@ -474,7 +474,12 @@ public int ImageIndex public override string ToString() { return this.mLine; } - } + + public void Dispose() + { + LinkedDisplayList = null; + } + } public class GrblMessage : IGrblRow { diff --git a/LaserGRBL/GrblFile.cs b/LaserGRBL/GrblFile.cs index eea30bef..9b121698 100644 --- a/LaserGRBL/GrblFile.cs +++ b/LaserGRBL/GrblFile.cs @@ -33,8 +33,9 @@ public enum CartesianQuadrant { I, II, III, IV, Mix, Unknown } private ProgramRange mRange = new ProgramRange(); private TimeSpan mEstimatedTotalTime; public List Commands => list; + private Thread mLoadingThread = null; - public GrblFile() + public GrblFile() { } @@ -43,9 +44,18 @@ public GrblFile(decimal x, decimal y, decimal x1, decimal y1) { mRange.UpdateXYRange(new GrblCommand.Element('X', x), new GrblCommand.Element('Y', y), false); mRange.UpdateXYRange(new GrblCommand.Element('X', x1), new GrblCommand.Element('Y', y1), false); - } - - public void SaveGCODE(string filename, bool header, bool footer, bool between, int cycles, bool useLFLineEndings, GrblCore core) + } + + private void ClearList() + { + foreach (GrblCommand command in list) + { + command.Dispose(); + } + list.Clear(); + } + + public void SaveGCODE(string filename, bool header, bool footer, bool between, int cycles, bool useLFLineEndings, GrblCore core) { try { @@ -90,69 +100,100 @@ private static void EvaluateAddLines(GrblCore core, System.IO.StreamWriter sw, s } } + private void SafeLoadFile(ThreadStart loadFileAction) + { + if (mLoadingThread != null || InUse) + { + MessageBox.Show(Strings.AlreadyLoading); + return; + } + mLoadingThread = new Thread(new ThreadStart(() => + { + try + { + loadFileAction.Invoke(); + } + catch (Exception ex) + { + Logger.LogException("SafeLoadFile", ex); + } + finally + { + mLoadingThread = null; + } + })); + mLoadingThread.Start(); + } + public void LoadFile(string filename, bool append) - { - RiseOnFileLoading(filename); + { + SafeLoadFile(() => + { + RiseOnFileLoading(filename); - long start = Tools.HiResTimer.TotalMilliseconds; + long start = Tools.HiResTimer.TotalMilliseconds; - if (!append) - list.Clear(); + if (!append) + ClearList(); - mRange.ResetRange(); - if (System.IO.File.Exists(filename)) - { - using (System.IO.StreamReader sr = new System.IO.StreamReader(filename)) + mRange.ResetRange(); + if (System.IO.File.Exists(filename)) { - string line = null; - while ((line = sr.ReadLine()) != null) - if ((line = line.Trim()).Length > 0) - { - GrblCommand cmd = new GrblCommand(line); - if (!cmd.IsEmpty) - list.Add(cmd); - } + using (System.IO.StreamReader sr = new System.IO.StreamReader(filename)) + { + string line = null; + while ((line = sr.ReadLine()) != null) + if ((line = line.Trim()).Length > 0) + { + GrblCommand cmd = new GrblCommand(line); + if (!cmd.IsEmpty) + list.Add(cmd); + } + } } - } - Analyze(); - long elapsed = Tools.HiResTimer.TotalMilliseconds - start; + Analyze(); + long elapsed = Tools.HiResTimer.TotalMilliseconds - start; - RiseOnFileLoaded(filename, elapsed); + RiseOnFileLoaded(filename, elapsed); + }); } public void LoadImportedSVG(string filename, bool append, GrblCore core, ColorFilter filter) - { - RiseOnFileLoading(filename); + { + SafeLoadFile(() => + { + RiseOnFileLoading(filename); - long start = Tools.HiResTimer.TotalMilliseconds; + long start = Tools.HiResTimer.TotalMilliseconds; - if (!append) - list.Clear(); + if (!append) + ClearList(); - mRange.ResetRange(); + mRange.ResetRange(); - SvgConverter.GCodeFromSVG converter = new SvgConverter.GCodeFromSVG(); - converter.GCodeXYFeed = Settings.GetObject("GrayScaleConversion.VectorizeOptions.BorderSpeed", 1000); - converter.UseLegacyBezier = !Settings.GetObject($"Vector.UseSmartBezier", true); + SvgConverter.GCodeFromSVG converter = new SvgConverter.GCodeFromSVG(); + converter.GCodeXYFeed = Settings.GetObject("GrayScaleConversion.VectorizeOptions.BorderSpeed", 1000); + converter.UseLegacyBezier = !Settings.GetObject($"Vector.UseSmartBezier", true); - string gcode = converter.convertFromFile(filename, core, filter); - string[] lines = gcode.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); - foreach (string l in lines) - { - string line = l; - if ((line = line.Trim()).Length > 0) + string gcode = converter.convertFromFile(filename, core, filter); + string[] lines = gcode.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + foreach (string l in lines) { - GrblCommand cmd = new GrblCommand(line); - if (!cmd.IsEmpty) - list.Add(cmd); + string line = l; + if ((line = line.Trim()).Length > 0) + { + GrblCommand cmd = new GrblCommand(line); + if (!cmd.IsEmpty) + list.Add(cmd); + } } - } - Analyze(); - long elapsed = Tools.HiResTimer.TotalMilliseconds - start; + Analyze(); + long elapsed = Tools.HiResTimer.TotalMilliseconds - start; - RiseOnFileLoaded(filename, elapsed); - } + RiseOnFileLoaded(filename, elapsed); + }); + } private abstract class ColorSegment @@ -313,7 +354,7 @@ public void LoadImagePotrace(Bitmap bmp, string filename, bool UseSpotRemoval, i long start = Tools.HiResTimer.TotalMilliseconds; if (!append) - list.Clear(); + ClearList(); //list.Add(new GrblCommand("G90")); //absolute (Moved to custom Header) @@ -472,7 +513,7 @@ public void LoadImageL2L(Bitmap bmp, string filename, L2LConf c, bool append, Gr long start = Tools.HiResTimer.TotalMilliseconds; if (!append) - list.Clear(); + ClearList(); mRange.ResetRange(); @@ -519,7 +560,7 @@ internal void GenerateCuttingTest(int f_col, int f_start, int f_end, int p_start long start = Tools.HiResTimer.TotalMilliseconds; - list.Clear(); + ClearList(); mRange.ResetRange(); double f_delta = f_col > 1 ? (f_end - f_start) / (double)(f_col - 1) : 0; @@ -597,7 +638,7 @@ public void GenerateGreyscaleTest(int f_row, int s_col, int f_start, int f_end, long start = Tools.HiResTimer.TotalMilliseconds; - list.Clear(); + ClearList(); mRange.ResetRange(); bool forward = true; @@ -713,7 +754,7 @@ internal void GenerateShakeTest(string axis, int flimit, int axislen, int cpower long start = Tools.HiResTimer.TotalMilliseconds; - list.Clear(); + ClearList(); mRange.ResetRange(); list.Add(new GrblCommand("M5")); //laser OFF @@ -768,58 +809,58 @@ private void GenerateShakeTest2(string axis, int flimit, int axislen, int o, int } } - //internal void GenerateShakeTest(string axis, int flimit, int axislen, int cpower, int cspeed) - //{ - // string filename = $"Shake Test {axis}"; - - // RiseOnFileLoading(filename); - - // long start = Tools.HiResTimer.TotalMilliseconds; - - // list.Clear(); - // mRange.ResetRange(); - - // list.Add(new GrblCommand("M5")); //laser OFF - // list.Add(new GrblCommand("G1 F1000 X0 Y0 S0")); //move to origin (slowly) - // list.Add(new GrblCommand($"G1 F{cspeed} X7 Y10")); //positioning - // list.Add(new GrblCommand("M4")); //laser ON - // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X13 Y10")); //drow cross - // list.Add(new GrblCommand("M5")); //laser OFF - // list.Add(new GrblCommand($"G1 F{cspeed} X10 Y7")); //positioning - // list.Add(new GrblCommand("M4")); //laser ON - // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X10 Y13")); //drow cross - // list.Add(new GrblCommand("M5")); //laser OFF - // list.Add(new GrblCommand("G1 F1000 X10 Y10 S0")); //move to cross center (slowly) - - // int ca = 10; - // int da = 1; - // while ((ca + da) < axislen) - // { - // ca += da; - // list.Add(new GrblCommand($"G1 F{flimit} {axis}{ca}")); - // ca -= da; - // list.Add(new GrblCommand($"G1 F{flimit} {axis}{ca}")); - // da += 5; - // } - - // list.Add(new GrblCommand($"G1 F{cspeed} X7 Y10")); //positioning - // list.Add(new GrblCommand("M4")); //laser ON - // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X13 Y10")); //drow cross - // list.Add(new GrblCommand("M5")); //laser OFF - // list.Add(new GrblCommand($"G1 F{cspeed} X10 Y7")); //positioning - // list.Add(new GrblCommand("M4")); //laser ON - // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X10 Y13")); //drow cross - // list.Add(new GrblCommand("M5")); //laser OFF - - // Analyze(); - // long elapsed = Tools.HiResTimer.TotalMilliseconds - start; - - // RiseOnFileLoaded(filename, elapsed); - //} - - // For Marlin, as we sen M106 command, we need to know last color send - //private int lastColorSend = 0; - private void ImageLine2Line(Bitmap bmp, L2LConf c) + //internal void GenerateShakeTest(string axis, int flimit, int axislen, int cpower, int cspeed) + //{ + // string filename = $"Shake Test {axis}"; + + // RiseOnFileLoading(filename); + + // long start = Tools.HiResTimer.TotalMilliseconds; + + // ClearList(); + // mRange.ResetRange(); + + // list.Add(new GrblCommand("M5")); //laser OFF + // list.Add(new GrblCommand("G1 F1000 X0 Y0 S0")); //move to origin (slowly) + // list.Add(new GrblCommand($"G1 F{cspeed} X7 Y10")); //positioning + // list.Add(new GrblCommand("M4")); //laser ON + // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X13 Y10")); //drow cross + // list.Add(new GrblCommand("M5")); //laser OFF + // list.Add(new GrblCommand($"G1 F{cspeed} X10 Y7")); //positioning + // list.Add(new GrblCommand("M4")); //laser ON + // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X10 Y13")); //drow cross + // list.Add(new GrblCommand("M5")); //laser OFF + // list.Add(new GrblCommand("G1 F1000 X10 Y10 S0")); //move to cross center (slowly) + + // int ca = 10; + // int da = 1; + // while ((ca + da) < axislen) + // { + // ca += da; + // list.Add(new GrblCommand($"G1 F{flimit} {axis}{ca}")); + // ca -= da; + // list.Add(new GrblCommand($"G1 F{flimit} {axis}{ca}")); + // da += 5; + // } + + // list.Add(new GrblCommand($"G1 F{cspeed} X7 Y10")); //positioning + // list.Add(new GrblCommand("M4")); //laser ON + // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X13 Y10")); //drow cross + // list.Add(new GrblCommand("M5")); //laser OFF + // list.Add(new GrblCommand($"G1 F{cspeed} X10 Y7")); //positioning + // list.Add(new GrblCommand("M4")); //laser ON + // list.Add(new GrblCommand($"G1 F{cspeed} S{cpower} X10 Y13")); //drow cross + // list.Add(new GrblCommand("M5")); //laser OFF + + // Analyze(); + // long elapsed = Tools.HiResTimer.TotalMilliseconds - start; + + // RiseOnFileLoaded(filename, elapsed); + //} + + // For Marlin, as we sen M106 command, we need to know last color send + //private int lastColorSend = 0; + private void ImageLine2Line(Bitmap bmp, L2LConf c) { bool fast = true; List segments = GetSegments(bmp, c); @@ -1345,7 +1386,7 @@ internal void LoadImageCenterline(Bitmap bmp, string filename, bool useCornerThr long start = Tools.HiResTimer.TotalMilliseconds; if (!append) - list.Clear(); + ClearList(); mRange.ResetRange(); @@ -1608,7 +1649,9 @@ public System.Collections.IEnumerator GetEnumerator() public ProgramRange Range { get { return mRange; } } - public GrblCommand this[int index] + public bool InUse { get; internal set; } + + public GrblCommand this[int index] { get { return list[index]; } } } diff --git a/LaserGRBL/LaserGRBL.csproj b/LaserGRBL/LaserGRBL.csproj index 5c1828cf..268adcf6 100644 --- a/LaserGRBL/LaserGRBL.csproj +++ b/LaserGRBL/LaserGRBL.csproj @@ -176,6 +176,7 @@ + diff --git a/LaserGRBL/MainForm.cs b/LaserGRBL/MainForm.cs index 753cfa06..00a4a0b4 100644 --- a/LaserGRBL/MainForm.cs +++ b/LaserGRBL/MainForm.cs @@ -181,6 +181,7 @@ public MainForm() IconsMgr.PrepareMenuItem(linguaToolStripMenuItem, "mdi-flag-variant"); IconsMgr.PrepareMenuItem(toolsToolStripMenuItem, "mdi-tools"); IconsMgr.PrepareMenuItem(questionMarkToolStripMenuItem, "mdi-help"); + questionMarkToolStripMenuItem.Text = ""; } else { diff --git a/LaserGRBL/Obj3D/Objects3D.cs b/LaserGRBL/Obj3D/Objects3D.cs index 7375fbfe..03b10111 100644 --- a/LaserGRBL/Obj3D/Objects3D.cs +++ b/LaserGRBL/Obj3D/Objects3D.cs @@ -65,7 +65,7 @@ public abstract class Object3D : SceneElement, IDisposable [XmlIgnore] protected Object3DDisplayList mCurrentDisplayList = null; [XmlIgnore] - protected const int MAX_VECTOR_IN_DISPLAY_LIST = 1000; + protected const int MAX_VECTOR_IN_DISPLAY_LIST = 5000; public ulong VertexCounter { get; private set; } = 0; @@ -136,7 +136,7 @@ public void CheckListSize() if (mCurrentDisplayList.Vertices.Count > MAX_VECTOR_IN_DISPLAY_LIST) NewDisplayList(); } - public void Dispose() + public virtual void Dispose() { foreach (Object3DDisplayList object3DDisplayList in mDisplayLists) { @@ -276,6 +276,7 @@ protected override void Draw() { float zPos = 0; GrblCommand.StatePositionBuilder spb = new GrblCommand.StatePositionBuilder(); + Core.LoadedFile.InUse = true; int commandsCount = Core.LoadedFile.Commands.Count; for (int i = 0; i < commandsCount; i++) { @@ -352,6 +353,7 @@ protected override void Draw() } finally { cmd.DeleteHelper(); } } + Core.LoadedFile.InUse = false; } public void Invalidate() diff --git a/LaserGRBL/Strings.Designer.cs b/LaserGRBL/Strings.Designer.cs index 7b8739d0..2d056c52 100644 --- a/LaserGRBL/Strings.Designer.cs +++ b/LaserGRBL/Strings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Il codice è stato generato da uno strumento. -// Versione runtime:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se -// il codice viene rigenerato. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ namespace LaserGRBL { /// - /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder. - // tramite uno strumento quale ResGen o Visual Studio. - // Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen - // con l'opzione /str oppure ricompilare il progetto VS. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Strings { @@ -33,7 +33,7 @@ internal Strings() { } /// - /// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Strings() { } /// - /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le - /// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Strings() { } /// - /// Cerca una stringa localizzata simile a Right click here to add custom buttons. + /// Looks up a localized string similar to Right click here to add custom buttons. /// internal static string AddCustomButtonsHint { get { @@ -70,7 +70,16 @@ internal static string AddCustomButtonsHint { } /// - /// Cerca una stringa localizzata simile a Abort current job?. + /// Looks up a localized string similar to A file is already loading, please wait.... + /// + internal static string AlreadyLoading { + get { + return ResourceManager.GetString("AlreadyLoading", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Abort current job?. /// internal static string BoxAbortProgramConfirm { get { @@ -79,7 +88,7 @@ internal static string BoxAbortProgramConfirm { } /// - /// Cerca una stringa localizzata simile a Automatic update failed! + /// Looks up a localized string similar to Automatic update failed! ///Please manually download the new version from lasergrbl site.. /// internal static string BoxAutoUpdateFailed { @@ -89,7 +98,7 @@ internal static string BoxAutoUpdateFailed { } /// - /// Cerca una stringa localizzata simile a Update require administrator privilege!. + /// Looks up a localized string similar to Update require administrator privilege!. /// internal static string BoxAutoUpdateRequireAdmin { get { @@ -98,7 +107,7 @@ internal static string BoxAutoUpdateRequireAdmin { } /// - /// Cerca una stringa localizzata simile a Update result. + /// Looks up a localized string similar to Update result. /// internal static string BoxAutoUpdateResult { get { @@ -107,7 +116,7 @@ internal static string BoxAutoUpdateResult { } /// - /// Cerca una stringa localizzata simile a Update success!. + /// Looks up a localized string similar to Update success!. /// internal static string BoxAutoUpdateSuccess { get { @@ -116,7 +125,7 @@ internal static string BoxAutoUpdateSuccess { } /// - /// Cerca una stringa localizzata simile a There are some changes that have not been applied. + /// Looks up a localized string similar to There are some changes that have not been applied. ///Do you want to rewrite the configuration?. /// internal static string BoxConfigDetectedChanges { @@ -126,7 +135,7 @@ internal static string BoxConfigDetectedChanges { } /// - /// Cerca una stringa localizzata simile a Changes detected!. + /// Looks up a localized string similar to Changes detected!. /// internal static string BoxConfigDetectedChangesTitle { get { @@ -135,7 +144,7 @@ internal static string BoxConfigDetectedChangesTitle { } /// - /// Cerca una stringa localizzata simile a Cannot connect to device. + /// Looks up a localized string similar to Cannot connect to device. /// internal static string BoxConnectErrorTitle { get { @@ -144,7 +153,7 @@ internal static string BoxConnectErrorTitle { } /// - /// Cerca una stringa localizzata simile a Please provide GCode commands. + /// Looks up a localized string similar to Please provide GCode commands. /// internal static string BoxCustomButtonPleaseGCodeText { get { @@ -153,7 +162,7 @@ internal static string BoxCustomButtonPleaseGCodeText { } /// - /// Cerca una stringa localizzata simile a Please provide tooltip text. + /// Looks up a localized string similar to Please provide tooltip text. /// internal static string BoxCustomButtonPleaseToolTipText { get { @@ -162,7 +171,7 @@ internal static string BoxCustomButtonPleaseToolTipText { } /// - /// Cerca una stringa localizzata simile a Missing field. + /// Looks up a localized string similar to Missing field. /// internal static string BoxCustomButtonPleaseToolTipTitle { get { @@ -171,7 +180,7 @@ internal static string BoxCustomButtonPleaseToolTipTitle { } /// - /// Cerca una stringa localizzata simile a Are you sure to delete selected button?. + /// Looks up a localized string similar to Are you sure to delete selected button?. /// internal static string BoxDeleteCustomButtonText { get { @@ -180,7 +189,7 @@ internal static string BoxDeleteCustomButtonText { } /// - /// Cerca una stringa localizzata simile a Delete custom button. + /// Looks up a localized string similar to Delete custom button. /// internal static string BoxDeleteCustomButtonTitle { get { @@ -189,7 +198,7 @@ internal static string BoxDeleteCustomButtonTitle { } /// - /// Cerca una stringa localizzata simile a Error exporting config!. + /// Looks up a localized string similar to Error exporting config!. /// internal static string BoxExportConfigError { get { @@ -198,7 +207,7 @@ internal static string BoxExportConfigError { } /// - /// Cerca una stringa localizzata simile a Error. + /// Looks up a localized string similar to Error. /// internal static string BoxExportConfigErrorTitle { get { @@ -207,7 +216,7 @@ internal static string BoxExportConfigErrorTitle { } /// - /// Cerca una stringa localizzata simile a File does not exist!. + /// Looks up a localized string similar to File does not exist!. /// internal static string BoxExportConfigFileNotFound { get { @@ -216,7 +225,7 @@ internal static string BoxExportConfigFileNotFound { } /// - /// Cerca una stringa localizzata simile a {0} Config exported successfully!. + /// Looks up a localized string similar to {0} Config exported successfully!. /// internal static string BoxExportConfigSuccess { get { @@ -225,7 +234,7 @@ internal static string BoxExportConfigSuccess { } /// - /// Cerca una stringa localizzata simile a Success. + /// Looks up a localized string similar to Success. /// internal static string BoxExportConfigSuccessTitle { get { @@ -234,7 +243,7 @@ internal static string BoxExportConfigSuccessTitle { } /// - /// Cerca una stringa localizzata simile a Error reading file!. + /// Looks up a localized string similar to Error reading file!. /// internal static string BoxImportConfigFileError { get { @@ -243,7 +252,7 @@ internal static string BoxImportConfigFileError { } /// - /// Cerca una stringa localizzata simile a {0} Config imported with {1} errors!. + /// Looks up a localized string similar to {0} Config imported with {1} errors!. /// internal static string BoxImportConfigWithError { get { @@ -252,7 +261,7 @@ internal static string BoxImportConfigWithError { } /// - /// Cerca una stringa localizzata simile a {0} Config imported successfully!. + /// Looks up a localized string similar to {0} Config imported successfully!. /// internal static string BoxImportConfigWithoutError { get { @@ -261,7 +270,7 @@ internal static string BoxImportConfigWithoutError { } /// - /// Cerca una stringa localizzata simile a Import custom button. + /// Looks up a localized string similar to Import custom button. /// internal static string BoxImportCustomButtonCaption { get { @@ -270,7 +279,7 @@ internal static string BoxImportCustomButtonCaption { } /// - /// Cerca una stringa localizzata simile a Remove actual buttons? Select yes to remove, no to keep.. + /// Looks up a localized string similar to Remove actual buttons? Select yes to remove, no to keep.. /// internal static string BoxImportCustomButtonClearText { get { @@ -279,7 +288,7 @@ internal static string BoxImportCustomButtonClearText { } /// - /// Cerca una stringa localizzata simile a Confirmation. + /// Looks up a localized string similar to Confirmation. /// internal static string BoxImportCustomButtonrCaption { get { @@ -288,7 +297,7 @@ internal static string BoxImportCustomButtonrCaption { } /// - /// Cerca una stringa localizzata simile a The engraver has some configuration parameters out of range. Please check machine configuration (menu "Grbl", "Grbl Configuration") parameters 130 and 131.. + /// Looks up a localized string similar to The engraver has some configuration parameters out of range. Please check machine configuration (menu "Grbl", "Grbl Configuration") parameters 130 and 131.. /// internal static string BoxMachineSizeOutOfRangeText { get { @@ -297,7 +306,7 @@ internal static string BoxMachineSizeOutOfRangeText { } /// - /// Cerca una stringa localizzata simile a Warning. + /// Looks up a localized string similar to Warning. /// internal static string BoxMachineSizeOutOfRangeTitle { get { @@ -306,7 +315,7 @@ internal static string BoxMachineSizeOutOfRangeTitle { } /// - /// Cerca una stringa localizzata simile a Error reading config!. + /// Looks up a localized string similar to Error reading config!. /// internal static string BoxReadConfigError { get { @@ -315,7 +324,7 @@ internal static string BoxReadConfigError { } /// - /// Cerca una stringa localizzata simile a Showing cached values.... + /// Looks up a localized string similar to Showing cached values.... /// internal static string BoxReadConfigPleaseConnect { get { @@ -324,7 +333,7 @@ internal static string BoxReadConfigPleaseConnect { } /// - /// Cerca una stringa localizzata simile a {0} Config read successfully!. + /// Looks up a localized string similar to {0} Config read successfully!. /// internal static string BoxReadConfigSuccess { get { @@ -333,7 +342,7 @@ internal static string BoxReadConfigSuccess { } /// - /// Cerca una stringa localizzata simile a Test notification has been sent, please check your phone!. + /// Looks up a localized string similar to Test notification has been sent, please check your phone!. /// internal static string BoxTelegramSettingText { get { @@ -342,7 +351,7 @@ internal static string BoxTelegramSettingText { } /// - /// Cerca una stringa localizzata simile a Telegram notification. + /// Looks up a localized string similar to Telegram notification. /// internal static string BoxTelegramSettingTitle { get { @@ -351,7 +360,7 @@ internal static string BoxTelegramSettingTitle { } /// - /// Cerca una stringa localizzata simile a No changes... nothing to write!. + /// Looks up a localized string similar to No changes... nothing to write!. /// internal static string BoxWriteConfigNoChange { get { @@ -360,7 +369,7 @@ internal static string BoxWriteConfigNoChange { } /// - /// Cerca una stringa localizzata simile a {0} Config written with {1} errors!. + /// Looks up a localized string similar to {0} Config written with {1} errors!. /// internal static string BoxWriteConfigWithError { get { @@ -369,7 +378,7 @@ internal static string BoxWriteConfigWithError { } /// - /// Cerca una stringa localizzata simile a {0} Config written successfully!. + /// Looks up a localized string similar to {0} Config written successfully!. /// internal static string BoxWriteConfigWithoutError { get { @@ -378,7 +387,7 @@ internal static string BoxWriteConfigWithoutError { } /// - /// Cerca una stringa localizzata simile a Connect. + /// Looks up a localized string similar to Connect. /// internal static string BtnConnectTT { get { @@ -387,7 +396,7 @@ internal static string BtnConnectTT { } /// - /// Cerca una stringa localizzata simile a Disconnect. + /// Looks up a localized string similar to Disconnect. /// internal static string BtnDisconnectTT { get { @@ -396,7 +405,16 @@ internal static string BtnDisconnectTT { } /// - /// Cerca una stringa localizzata simile a Edit button. + /// Looks up a localized string similar to Clear drawing.... + /// + internal static string ClearDrawing { + get { + return ResourceManager.GetString("ClearDrawing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Edit button. /// internal static string CustomButtonEdit { get { @@ -405,7 +423,7 @@ internal static string CustomButtonEdit { } /// - /// Cerca una stringa localizzata simile a Remove button. + /// Looks up a localized string similar to Remove button. /// internal static string CustomButtonRemove { get { @@ -414,7 +432,7 @@ internal static string CustomButtonRemove { } /// - /// Cerca una stringa localizzata simile a It seems that your computer does not support software rendering. + /// Looks up a localized string similar to It seems that your computer does not support software rendering. ///Do you want to restart LaserGRBL and switch to legacy mode?. /// internal static string DBOIssueSuggestGDI { @@ -424,7 +442,7 @@ internal static string DBOIssueSuggestGDI { } /// - /// Cerca una stringa localizzata simile a Diagonal (old). + /// Looks up a localized string similar to Diagonal (old). /// internal static string DirectionDiagonal { get { @@ -433,7 +451,7 @@ internal static string DirectionDiagonal { } /// - /// Cerca una stringa localizzata simile a Horizontal (old). + /// Looks up a localized string similar to Horizontal (old). /// internal static string DirectionHorizontal { get { @@ -442,7 +460,7 @@ internal static string DirectionHorizontal { } /// - /// Cerca una stringa localizzata simile a Cross Fill. + /// Looks up a localized string similar to Cross Fill. /// internal static string DirectionNewCross { get { @@ -451,7 +469,7 @@ internal static string DirectionNewCross { } /// - /// Cerca una stringa localizzata simile a Diagonal. + /// Looks up a localized string similar to Diagonal. /// internal static string DirectionNewDiagonal { get { @@ -460,7 +478,7 @@ internal static string DirectionNewDiagonal { } /// - /// Cerca una stringa localizzata simile a Diagonal Cross Fill. + /// Looks up a localized string similar to Diagonal Cross Fill. /// internal static string DirectionNewDiagonalCross { get { @@ -469,7 +487,7 @@ internal static string DirectionNewDiagonalCross { } /// - /// Cerca una stringa localizzata simile a Diagonal Grid. + /// Looks up a localized string similar to Diagonal Grid. /// internal static string DirectionNewDiagonalGrid { get { @@ -478,7 +496,7 @@ internal static string DirectionNewDiagonalGrid { } /// - /// Cerca una stringa localizzata simile a Grid. + /// Looks up a localized string similar to Grid. /// internal static string DirectionNewGrid { get { @@ -487,7 +505,7 @@ internal static string DirectionNewGrid { } /// - /// Cerca una stringa localizzata simile a Hilbert. + /// Looks up a localized string similar to Hilbert. /// internal static string DirectionNewHilbert { get { @@ -496,7 +514,7 @@ internal static string DirectionNewHilbert { } /// - /// Cerca una stringa localizzata simile a Horizontal. + /// Looks up a localized string similar to Horizontal. /// internal static string DirectionNewHorizontal { get { @@ -505,7 +523,7 @@ internal static string DirectionNewHorizontal { } /// - /// Cerca una stringa localizzata simile a Inset Filling. + /// Looks up a localized string similar to Inset Filling. /// internal static string DirectionNewInsetFilling { get { @@ -514,7 +532,7 @@ internal static string DirectionNewInsetFilling { } /// - /// Cerca una stringa localizzata simile a Diagonal Reversed. + /// Looks up a localized string similar to Diagonal Reversed. /// internal static string DirectionNewReverseDiagonal { get { @@ -523,7 +541,7 @@ internal static string DirectionNewReverseDiagonal { } /// - /// Cerca una stringa localizzata simile a Squares. + /// Looks up a localized string similar to Squares. /// internal static string DirectionNewSquares { get { @@ -532,7 +550,7 @@ internal static string DirectionNewSquares { } /// - /// Cerca una stringa localizzata simile a Vertical. + /// Looks up a localized string similar to Vertical. /// internal static string DirectionNewVertical { get { @@ -541,7 +559,7 @@ internal static string DirectionNewVertical { } /// - /// Cerca una stringa localizzata simile a Zig Zag. + /// Looks up a localized string similar to Zig Zag. /// internal static string DirectionNewZigZag { get { @@ -550,7 +568,7 @@ internal static string DirectionNewZigZag { } /// - /// Cerca una stringa localizzata simile a No Filling. + /// Looks up a localized string similar to No Filling. /// internal static string DirectionNone { get { @@ -559,7 +577,7 @@ internal static string DirectionNone { } /// - /// Cerca una stringa localizzata simile a Vertical (old). + /// Looks up a localized string similar to Vertical (old). /// internal static string DirectionVertical { get { @@ -568,7 +586,7 @@ internal static string DirectionVertical { } /// - /// Cerca una stringa localizzata simile a File transfer in progress. Disconnect anyway?. + /// Looks up a localized string similar to File transfer in progress. Disconnect anyway?. /// internal static string DisconnectAnyway { get { @@ -577,7 +595,7 @@ internal static string DisconnectAnyway { } /// - /// Cerca una stringa localizzata simile a Dithering Options. + /// Looks up a localized string similar to Dithering Options. /// internal static string DitheringOptions { get { @@ -586,7 +604,7 @@ internal static string DitheringOptions { } /// - /// Cerca una stringa localizzata simile a File transfer in progress. Exit anyway?. + /// Looks up a localized string similar to File transfer in progress. Exit anyway?. /// internal static string ExitAnyway { get { @@ -595,7 +613,7 @@ internal static string ExitAnyway { } /// - /// Cerca una stringa localizzata simile a It seems that your computer does not support hardware acceleration. + /// Looks up a localized string similar to It seems that your computer does not support hardware acceleration. ///Do you want to restart LaserGRBL and switch to software rendering?. /// internal static string FBOIssueSuggestDBO { @@ -605,7 +623,7 @@ internal static string FBOIssueSuggestDBO { } /// - /// Cerca una stringa localizzata simile a Restart required. + /// Looks up a localized string similar to Restart required. /// internal static string FirmwareRequireRestart { get { @@ -614,7 +632,7 @@ internal static string FirmwareRequireRestart { } /// - /// Cerca una stringa localizzata simile a Restart is required to apply Firmware type changes. Restart now?. + /// Looks up a localized string similar to Restart is required to apply Firmware type changes. Restart now?. /// internal static string FirmwareRequireRestartNow { get { @@ -623,7 +641,7 @@ internal static string FirmwareRequireRestartNow { } /// - /// Cerca una stringa localizzata simile a Custom. + /// Looks up a localized string similar to Custom. /// internal static string FormulaCustom { get { @@ -632,7 +650,7 @@ internal static string FormulaCustom { } /// - /// Cerca una stringa localizzata simile a OpticalCorrect. + /// Looks up a localized string similar to OpticalCorrect. /// internal static string FormulaOpticalCorrect { get { @@ -641,7 +659,7 @@ internal static string FormulaOpticalCorrect { } /// - /// Cerca una stringa localizzata simile a SimpleAverage. + /// Looks up a localized string similar to SimpleAverage. /// internal static string FormulaSimpleAverage { get { @@ -650,7 +668,7 @@ internal static string FormulaSimpleAverage { } /// - /// Cerca una stringa localizzata simile a WeightAverage. + /// Looks up a localized string similar to WeightAverage. /// internal static string FormulaWeightAverage { get { @@ -659,7 +677,7 @@ internal static string FormulaWeightAverage { } /// - /// Cerca una stringa localizzata simile a Restart is required to apply icons changes. Restart now?. + /// Looks up a localized string similar to Restart is required to apply icons changes. Restart now?. /// internal static string IconsChangesRequiresRestart { get { @@ -668,7 +686,7 @@ internal static string IconsChangesRequiresRestart { } /// - /// Cerca una stringa localizzata simile a Smooth (HQ Bicubic). + /// Looks up a localized string similar to Smooth (HQ Bicubic). /// internal static string InterpolationModeHighQualityBicubic { get { @@ -677,7 +695,7 @@ internal static string InterpolationModeHighQualityBicubic { } /// - /// Cerca una stringa localizzata simile a Sharp (NearestNeighbor). + /// Looks up a localized string similar to Sharp (NearestNeighbor). /// internal static string InterpolationModeNearestNeighbor { get { @@ -686,7 +704,7 @@ internal static string InterpolationModeNearestNeighbor { } /// - /// Cerca una stringa localizzata simile a Restart required. + /// Looks up a localized string similar to Restart required. /// internal static string LanguageRequireRestart { get { @@ -695,7 +713,7 @@ internal static string LanguageRequireRestart { } /// - /// Cerca una stringa localizzata simile a Require application restart, restart now?. + /// Looks up a localized string similar to Require application restart, restart now?. /// internal static string LanguageRequireRestartNow { get { @@ -704,7 +722,7 @@ internal static string LanguageRequireRestartNow { } /// - /// Cerca una stringa localizzata simile a Line To Line Options. + /// Looks up a localized string similar to Line To Line Options. /// internal static string Line2LineOptions { get { @@ -713,7 +731,16 @@ internal static string Line2LineOptions { } /// - /// Cerca una stringa localizzata simile a Alarm. + /// Looks up a localized string similar to Loading. + /// + internal static string Loading { + get { + return ResourceManager.GetString("Loading", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Alarm. /// internal static string MacStatusAlarm { get { @@ -722,7 +749,7 @@ internal static string MacStatusAlarm { } /// - /// Cerca una stringa localizzata simile a Check. + /// Looks up a localized string similar to Check. /// internal static string MacStatusCheck { get { @@ -731,7 +758,7 @@ internal static string MacStatusCheck { } /// - /// Cerca una stringa localizzata simile a Connecting. + /// Looks up a localized string similar to Connecting. /// internal static string MacStatusConnecting { get { @@ -740,7 +767,7 @@ internal static string MacStatusConnecting { } /// - /// Cerca una stringa localizzata simile a Disconnected. + /// Looks up a localized string similar to Disconnected. /// internal static string MacStatusDisconnected { get { @@ -749,7 +776,7 @@ internal static string MacStatusDisconnected { } /// - /// Cerca una stringa localizzata simile a Door. + /// Looks up a localized string similar to Door. /// internal static string MacStatusDoor { get { @@ -758,7 +785,7 @@ internal static string MacStatusDoor { } /// - /// Cerca una stringa localizzata simile a Hold. + /// Looks up a localized string similar to Hold. /// internal static string MacStatusHold { get { @@ -767,7 +794,7 @@ internal static string MacStatusHold { } /// - /// Cerca una stringa localizzata simile a Home. + /// Looks up a localized string similar to Home. /// internal static string MacStatusHome { get { @@ -776,7 +803,7 @@ internal static string MacStatusHome { } /// - /// Cerca una stringa localizzata simile a Idle. + /// Looks up a localized string similar to Idle. /// internal static string MacStatusIdle { get { @@ -785,7 +812,7 @@ internal static string MacStatusIdle { } /// - /// Cerca una stringa localizzata simile a Jog. + /// Looks up a localized string similar to Jog. /// internal static string MacStatusJog { get { @@ -794,7 +821,7 @@ internal static string MacStatusJog { } /// - /// Cerca una stringa localizzata simile a Run. + /// Looks up a localized string similar to Run. /// internal static string MacStatusRun { get { @@ -803,7 +830,7 @@ internal static string MacStatusRun { } /// - /// Cerca una stringa localizzata simile a Unknown. + /// Looks up a localized string similar to Unknown. /// internal static string MacStatusUnknown { get { @@ -812,7 +839,7 @@ internal static string MacStatusUnknown { } /// - /// Cerca una stringa localizzata simile a Estimated Time:. + /// Looks up a localized string similar to Estimated Time:. /// internal static string MainFormEstimatedTime { get { @@ -821,7 +848,7 @@ internal static string MainFormEstimatedTime { } /// - /// Cerca una stringa localizzata simile a Projected Time:. + /// Looks up a localized string similar to Projected Time:. /// internal static string MainFormProjectedTime { get { @@ -830,7 +857,7 @@ internal static string MainFormProjectedTime { } /// - /// Cerca una stringa localizzata simile a MDI Icon code. + /// Looks up a localized string similar to MDI Icon code. /// internal static string MdiIconCaption { get { @@ -839,7 +866,7 @@ internal static string MdiIconCaption { } /// - /// Cerca una stringa localizzata simile a Cannot open a new file now.. + /// Looks up a localized string similar to Cannot open a new file now.. /// internal static string MsgboxCannotOpenFileNow { get { @@ -848,7 +875,16 @@ internal static string MsgboxCannotOpenFileNow { } /// - /// Cerca una stringa localizzata simile a Restart is required to apply preview changes. Restart now?. + /// Looks up a localized string similar to Prepare drawing.... + /// + internal static string PrepareDrawing { + get { + return ResourceManager.GetString("PrepareDrawing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restart is required to apply preview changes. Restart now?. /// internal static string PreviewChangesRequiresRestart { get { @@ -857,7 +893,7 @@ internal static string PreviewChangesRequiresRestart { } /// - /// Cerca una stringa localizzata simile a Error connecting your engraver. + /// Looks up a localized string similar to Error connecting your engraver. ///If you need help click on "?" button.. /// internal static string ProblemConnectingText { @@ -867,7 +903,7 @@ internal static string ProblemConnectingText { } /// - /// Cerca una stringa localizzata simile a Problem with connection?. + /// Looks up a localized string similar to Problem with connection?. /// internal static string ProblemConnectingTitle { get { @@ -876,7 +912,7 @@ internal static string ProblemConnectingTitle { } /// - /// Cerca una stringa localizzata simile a It seems that the current position is no longer known by Grbl. + /// Looks up a localized string similar to It seems that the current position is no longer known by Grbl. ///Without the Homing Procedure ($H) the result may not be reliable. ///Continue anyway?. /// @@ -887,7 +923,7 @@ internal static string ResumeJobHomingRequired { } /// - /// Cerca una stringa localizzata simile a Unknown position. + /// Looks up a localized string similar to Unknown position. /// internal static string ResumeJobHomingRequiredTitle { get { @@ -896,7 +932,7 @@ internal static string ResumeJobHomingRequiredTitle { } /// - /// Cerca una stringa localizzata simile a Speed:. + /// Looks up a localized string similar to Speed:. /// internal static string SpeedSliderToolTip { get { @@ -905,7 +941,7 @@ internal static string SpeedSliderToolTip { } /// - /// Cerca una stringa localizzata simile a Step:. + /// Looks up a localized string similar to Step:. /// internal static string StepSliderToolTip { get { @@ -914,7 +950,7 @@ internal static string StepSliderToolTip { } /// - /// Cerca una stringa localizzata simile a This file type is not supported.. + /// Looks up a localized string similar to This file type is not supported.. /// internal static string UnsupportedFiletype { get { @@ -923,7 +959,7 @@ internal static string UnsupportedFiletype { } /// - /// Cerca una stringa localizzata simile a If the buffer is blocked, it is because there was some communication problem with your engraver. If you press "OK" LaserGRBL will ignore the full buffer and send the next commands. If this happens often, you should try to understand the causes of this problem. + /// Looks up a localized string similar to If the buffer is blocked, it is because there was some communication problem with your engraver. If you press "OK" LaserGRBL will ignore the full buffer and send the next commands. If this happens often, you should try to understand the causes of this problem. ///Click "?" for more information.. /// internal static string WarnBufferStuckUnlockText { @@ -933,7 +969,7 @@ internal static string WarnBufferStuckUnlockText { } /// - /// Cerca una stringa localizzata simile a Unlock buffer. + /// Looks up a localized string similar to Unlock buffer. /// internal static string WarnBufferStuckUnlockTitle { get { @@ -942,7 +978,7 @@ internal static string WarnBufferStuckUnlockTitle { } /// - /// Cerca una stringa localizzata simile a Centerline option is not compatible with your PC. + /// Looks up a localized string similar to Centerline option is not compatible with your PC. ///64bit OS is needed!. /// internal static string WarnCenterline64bit { @@ -952,7 +988,7 @@ internal static string WarnCenterline64bit { } /// - /// Cerca una stringa localizzata simile a Line2Line option is not compatible with your engraver or with your configuration. PWM-able laser is needed, and PWM support should be enabled in LaserGRBL settings.. + /// Looks up a localized string similar to Line2Line option is not compatible with your engraver or with your configuration. PWM-able laser is needed, and PWM support should be enabled in LaserGRBL settings.. /// internal static string WarnLine2LinePWM { get { @@ -961,7 +997,7 @@ internal static string WarnLine2LinePWM { } /// - /// Cerca una stringa localizzata simile a Warning. + /// Looks up a localized string similar to Warning. /// internal static string WarnMessageBoxHeader { get { @@ -970,7 +1006,7 @@ internal static string WarnMessageBoxHeader { } /// - /// Cerca una stringa localizzata simile a You have set negative offsets, but your engraver is set to use positive space with soft limit alarm enabled ($20=1). + /// Looks up a localized string similar to You have set negative offsets, but your engraver is set to use positive space with soft limit alarm enabled ($20=1). /// ///This could generate a soft-limit error. Are you sure of the entered values?. /// @@ -981,7 +1017,7 @@ internal static string WarnSoftLimitNS { } /// - /// Cerca una stringa localizzata simile a You have set a size and offset that makes the job larger than the workspace configured in your engraver ({0}mm x {1}mm). + /// Looks up a localized string similar to You have set a size and offset that makes the job larger than the workspace configured in your engraver ({0}mm x {1}mm). ///Grbl Parameters $130 and $131. /// ///This could generate a soft-limit error or the machine could crash into the axes boundary. Are you sure of the entered values?. @@ -993,7 +1029,7 @@ internal static string WarnSoftLimitOOB { } /// - /// Cerca una stringa localizzata simile a Job boundary confirmation. + /// Looks up a localized string similar to Job boundary confirmation. /// internal static string WarnSoftLimitTitle { get { @@ -1002,7 +1038,7 @@ internal static string WarnSoftLimitTitle { } /// - /// Cerca una stringa localizzata simile a Freely assigning the width and height of the work can lead to distortion of the image. Do you want to continue?. + /// Looks up a localized string similar to Freely assigning the width and height of the work can lead to distortion of the image. Do you want to continue?. /// internal static string WarnUnlockProportionText { get { @@ -1011,7 +1047,7 @@ internal static string WarnUnlockProportionText { } /// - /// Cerca una stringa localizzata simile a Warning. + /// Looks up a localized string similar to Warning. /// internal static string WarnUnlockProportionTitle { get { @@ -1020,7 +1056,7 @@ internal static string WarnUnlockProportionTitle { } /// - /// Cerca una stringa localizzata simile a "M4 Dynamic Laser Power Mode" has been set, but your engraver doesn't seem to support it. + /// Looks up a localized string similar to "M4 Dynamic Laser Power Mode" has been set, but your engraver doesn't seem to support it. ///Only engravers with grbl version >= 1.1 with "laser mode" enabled ($32=1) can take advantage of M4 option.. /// internal static string WarnWrongLaserMode { @@ -1030,7 +1066,7 @@ internal static string WarnWrongLaserMode { } /// - /// Cerca una stringa localizzata simile a Warning. + /// Looks up a localized string similar to Warning. /// internal static string WarnWrongLaserModeTitle { get { diff --git a/LaserGRBL/Strings.resx b/LaserGRBL/Strings.resx index 740a6ebe..705d7db7 100644 --- a/LaserGRBL/Strings.resx +++ b/LaserGRBL/Strings.resx @@ -453,4 +453,16 @@ Do you want to restart LaserGRBL and switch to legacy mode? It seems that your computer does not support hardware acceleration. Do you want to restart LaserGRBL and switch to software rendering? + + A file is already loading, please wait... + + + Clear drawing... + + + Loading + + + Prepare drawing... + \ No newline at end of file diff --git a/LaserGRBL/Tools/DoubleBufferBmp.cs b/LaserGRBL/Tools/DoubleBufferBmp.cs new file mode 100644 index 00000000..6693c4bb --- /dev/null +++ b/LaserGRBL/Tools/DoubleBufferBmp.cs @@ -0,0 +1,30 @@ +using System.Drawing; +using System.Threading; + +namespace LaserGRBL +{ + internal class DoubleBufferBmp + { + private Bitmap[] mBmps = new Bitmap[2]; + private int mGetIdx = 0; + + public Bitmap Bitmap + { + get + { + return mBmps[Thread.VolatileRead(ref mGetIdx)]; + } + set + { + int setIdx = (Thread.VolatileRead(ref mGetIdx) + 1) % 2; + if (mBmps[setIdx] != null) + { + mBmps[setIdx].Dispose(); + } + mBmps[setIdx] = value; + Thread.VolatileWrite(ref mGetIdx, setIdx); + } + } + + } +} diff --git a/LaserGRBL/UserControls/GrblPanel3D.cs b/LaserGRBL/UserControls/GrblPanel3D.cs index bb79f92d..83132dbd 100644 --- a/LaserGRBL/UserControls/GrblPanel3D.cs +++ b/LaserGRBL/UserControls/GrblPanel3D.cs @@ -5,17 +5,15 @@ using SharpGL.Version; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; using static LaserGRBL.ProgramRange; namespace LaserGRBL.UserControls { - [ToolboxBitmap(typeof(SceneControl), "GrblScene")] + [ToolboxBitmap(typeof(SceneControl), "GrblScene")] public partial class GrblPanel3D : UserControl, IGrblPanel { // last mouse position @@ -39,8 +37,9 @@ public partial class GrblPanel3D : UserControl, IGrblPanel private Grbl3D mGrbl3D = null; private Grbl3D mGrbl3DOff = null; private object mGrbl3DLock = new object(); - // reload request - private bool mReload = false; + private string mMessage = null; + // reload request + private bool mReload = false; // invalidate all request private bool mInvalidateAll = false; // viewport padding @@ -53,9 +52,7 @@ public partial class GrblPanel3D : UserControl, IGrblPanel // drawing thread private Tools.ThreadObject mThreadDraw; // generated 3d bitmap - private Bitmap mBmp = null; - // critical section - private object mBitmapLock = new object(); + private DoubleBufferBmp mBmp = new DoubleBufferBmp(); // open gl object private OpenGL OpenGL; // rulers steps @@ -139,7 +136,7 @@ public GrblPanel3D() mGrid = new Grid3D(); OnColorChange(); - TH = new Tools.ThreadObject(DrawScene, 10, true, "OpenGL", InitializeOpenGL, ThreadPriority.Normal, ApartmentState.STA); + TH = new Tools.ThreadObject(DrawScene, 10, true, "OpenGL", InitializeOpenGL, ThreadPriority.Lowest, ApartmentState.STA); TH.Start(); } @@ -256,14 +253,26 @@ private void DrawScene() if (mReload) { mReload = false; - lock (mGrbl3DLock) - { - mGrbl3D?.Dispose(); - mGrbl3DOff?.Dispose(); - mGrbl3D = new Grbl3D(Core, "LaserOn", false, ColorScheme.PreviewLaserPower); - mGrbl3DOff = new Grbl3D(Core, "LaserOff", true, ColorScheme.PreviewOtherMovement); + Grbl3D oldGrbl3D = mGrbl3D; + Grbl3D oldGrbl3DOff = mGrbl3DOff; + lock (mGrbl3DLock) + { + mGrbl3D = null; + mGrbl3DOff = null; } - mGrbl3DOff.LineWidth = 1; + mMessage = Strings.ClearDrawing; + oldGrbl3D?.Dispose(); + oldGrbl3DOff?.Dispose(); + mMessage = Strings.PrepareDrawing; + Grbl3D newGrbl3D = new Grbl3D(Core, "LaserOn", false, ColorScheme.PreviewLaserPower); + Grbl3D newGrbl3DOff = new Grbl3D(Core, "LaserOff", true, ColorScheme.PreviewOtherMovement); + mMessage = null; + lock (mGrbl3DLock) + { + mGrbl3D = newGrbl3D; + mGrbl3DOff = newGrbl3DOff; + } + mGrbl3DOff.LineWidth = 1; } if (mGrbl3D != null) { @@ -295,24 +304,16 @@ private void DrawScene() CheckError(OpenGL, "Rulers"); OpenGL.Flush(); CheckError(OpenGL, "Flush"); - // enter lock and copy bitmap - lock (mBitmapLock) + Bitmap newBmp = new Bitmap(Width, Height); + // clone opengl graphics + using (Graphics g = Graphics.FromImage(newBmp)) { - // new bitmap if different size - if (mBmp == null || mBmp.Width != Width || mBmp.Height != Height) - { - mBmp?.Dispose(); - mBmp = new Bitmap(Width, Height); - } - // clone opengl graphics - using (Graphics g = Graphics.FromImage(mBmp)) - { - IntPtr handleDeviceContext = g.GetHdc(); - OpenGL.Blit(handleDeviceContext); - CheckError(OpenGL, "Blit"); - g.ReleaseHdc(handleDeviceContext); - } + IntPtr handleDeviceContext = g.GetHdc(); + OpenGL.Blit(handleDeviceContext); + CheckError(OpenGL, "Blit"); + g.ReleaseHdc(handleDeviceContext); } + mBmp.Bitmap = newBmp; RenderTime.EnqueueNewSample(crono.ElapsedTime.TotalMilliseconds); TH.SleepTime = BestSleep(RenderTime.Avg, 10, 100, 10, 50); @@ -518,16 +519,12 @@ protected override void OnPaint(PaintEventArgs e) if (FpsCrono != null) RefreshRate.EnqueueNewSample(FpsCrono.ElapsedTime.TotalMilliseconds); //compute time distance between two OnPaint FpsCrono = new Tools.SimpleCrono(true); - - if (mBmp != null) + Bitmap bmp = mBmp.Bitmap; + if (bmp != null) { try { - // enter lock and copy bitmap to control - lock (mBitmapLock) - { - e.Graphics.DrawImage(mBmp, new Point(0, 0)); - } + e.Graphics.DrawImage(bmp, new Point(0, 0)); DoGDIDraw(e); } catch (Exception ex) { OnPaintException = ex; } @@ -537,7 +534,6 @@ protected override void OnPaint(PaintEventArgs e) // nothing to draw from GL Thread } - if (FatalException != null) DrawException(e, FatalException.ToString()); else if (OnPaintException != null) @@ -560,11 +556,14 @@ private void DrawException(PaintEventArgs e, string text) { try { - Size size = MeasureText(text, Font); - Size size2 = new Size(size.Width + 20, size.Height); - Point point = new Point((Width - size2.Width) / 2, (Height - size2.Height) / 2); - DrawOverlay(e, point, size2, Color.Red, 100); - e.Graphics.DrawString(text, Font, Brushes.White, point.X, point.Y); + using (Font font = new Font(mFontName, 12)) + { + Size size = MeasureText(text, mTextFont); + Size size2 = new Size(size.Width + 20, size.Height); + Point point = new Point((Width - size2.Width) / 2, (Height - size2.Height) / 2); + DrawOverlay(e, point, size2, Color.Red, 100); + e.Graphics.DrawString(text, font, Brushes.White, point.X, point.Y); + } } catch { } } @@ -651,14 +650,14 @@ private void DoGDIDraw(PaintEventArgs e) // loading lock (mGrbl3DLock) { - if (mGrbl3D != null && mGrbl3D.LoadingPercentage < 100 || Core.ShowLaserOffMovements.Value && mGrbl3DOff != null && mGrbl3DOff.LoadingPercentage < 100) + if (mMessage != null || mGrbl3D != null && mGrbl3D.LoadingPercentage < 100 || Core.ShowLaserOffMovements.Value && mGrbl3DOff != null && mGrbl3DOff.LoadingPercentage < 100) { int pos = point.Y + size.Height + 5; double? perc; perc = mGrbl3D?.LoadingPercentage ?? 0; perc += mGrbl3DOff?.LoadingPercentage ?? 0; if (Core.ShowLaserOffMovements.Value) perc /= 2; - text = $"Loading {perc:0.0}%"; + text = mMessage == null ? $"{Strings.Loading} {perc:0.0}%" : mMessage; size = MeasureText(text, font); point = new Point(Width - size.Width - mPadding.Right, pos); DrawOverlay(e, point, size, ColorScheme.PreviewRuler, 100); @@ -742,6 +741,7 @@ private void GrblSceneControl_MouseWheel(object sender, MouseEventArgs e) public void SetCore(GrblCore core) { Core = core; + Core.OnFileLoading += OnFileLoading; Core.OnFileLoaded += OnFileLoaded; Core.ShowExecutedCommands.OnChange += ShowExecutedCommands_OnChange; Core.PreviewLineSize.OnChange += PrerviewLineSize_OnChange; @@ -749,7 +749,12 @@ public void SetCore(GrblCore core) Core.OnProgramEnded += OnProgramEnded; } - private void OnProgramEnded() + private void OnFileLoading(long elapsed, string filename) + { + mMessage = "Loading file..."; + } + + private void OnProgramEnded() { foreach (var command in Core.LoadedFile.Commands) {