Skip to content

Commit

Permalink
Version 1.6.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
svenhb authored Aug 4, 2021
1 parent 1898364 commit 3b7d939
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 47 deletions.
5 changes: 4 additions & 1 deletion GRBL-Plotter/GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ public MainForm()

Grbl.Init(); // load and set grbl messages in grblRelated.cs
ToolTable.Init(); // fill structure in ToolTable.cs
GuiVariables.ResetVariables(); // set variables in MainFormObjects.cs
GuiVariables.ResetVariables(); // set variables in MainFormObjects.cs
// T E S T
Graphic.Init(Graphic.SourceType.SVG, "", null, null); // load class for faster 1st import
VisuGCode.GetGCodeLines(fCTBCode.Lines, null, null);
}

// initialize Main form
Expand Down
16 changes: 8 additions & 8 deletions GRBL-Plotter/GUI/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -6464,25 +6464,25 @@ Langue
<value>&amp;Machine control</value>
</data>
<data name="toolStripViewRuler.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewRuler.Text" xml:space="preserve">
<value>Ruler</value>
</data>
<data name="toolStripViewInfo.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewInfo.Text" xml:space="preserve">
<value>Info</value>
</data>
<data name="toolStripViewPenUp.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewPenUp.Text" xml:space="preserve">
<value>Pen-Up path</value>
</data>
<data name="toolStripViewMachineFix.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewMachineFix.Text" xml:space="preserve">
<value>Fixed Machine area</value>
Expand All @@ -6491,7 +6491,7 @@ Langue
<value>Limit and offset can be set via 'Setup' - 'Control' - 'Maschine area'</value>
</data>
<data name="toolStripViewMachine.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewMachine.Text" xml:space="preserve">
<value>Machine limits</value>
Expand All @@ -6500,13 +6500,13 @@ Langue
<value>Limit and offset can be set via 'Setup' - 'Control' - 'Maschine area'</value>
</data>
<data name="toolStripViewDimension.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewDimension.Text" xml:space="preserve">
<value>G-Code Dimension</value>
</data>
<data name="toolStripViewTool.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewTool.Text" xml:space="preserve">
<value>Tool table</value>
Expand All @@ -6515,7 +6515,7 @@ Langue
<value>Limit and offset can be set via 'Setup' - 'Tool change setup' - 'Tool table'</value>
</data>
<data name="toolStripViewBackground.Size" type="System.Drawing.Size, System.Drawing">
<value>176, 22</value>
<value>180, 22</value>
</data>
<data name="toolStripViewBackground.Text" xml:space="preserve">
<value>Background</value>
Expand Down
21 changes: 12 additions & 9 deletions GRBL-Plotter/GUI/MainFormFCTB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,14 @@ private void FindFigureMarkSelection(XmlMarkerType marker, int clickedLine, bool
}
if (XmlMarker.GetFigure(clickedLine))
{
EnableBlockCommands(SetTextSelection(XmlMarker.lastFigure.LineStart, XmlMarker.lastFigure.LineEnd));
VisuGCode.SetPosMarkerLine(fCTBCodeClickedLineNow, false); //!isStreaming); // 2020-08-24 don't highlight in setPosMarkerLine - was done (or deselect) before in setPosMarkerNearBy
StatusStripSet(2, string.Format("Marked: {0}", fCTBCode.Lines[XmlMarker.lastFigure.LineStart]), highlight);
fCTBCode.Invalidate();
int figStart = XmlMarker.lastFigure.LineStart;
if (figStart < fCTBCode.LinesCount)
{
EnableBlockCommands(SetTextSelection(XmlMarker.lastFigure.LineStart, XmlMarker.lastFigure.LineEnd));
VisuGCode.SetPosMarkerLine(fCTBCodeClickedLineNow, false); //!isStreaming); // 2020-08-24 don't highlight in setPosMarkerLine - was done (or deselect) before in setPosMarkerNearBy
StatusStripSet(2, string.Format("Marked: {0}", fCTBCode.Lines[XmlMarker.lastFigure.LineStart]), highlight);
fCTBCode.Invalidate();
}
}
if (XmlMarker.lastFigure.LineStart < fCTBCode.LinesCount)
{ if (expand) fCTBCode.ExpandFoldedBlock(XmlMarker.lastFigure.LineStart); } // if 2021-03-28
Expand Down Expand Up @@ -647,6 +651,10 @@ private void ClearTextSelection(int line)
}
private bool SetTextSelection(int start, int end)
{
if (start < 0) start = 0; if (start > fCTBCode.LinesCount) start = 0;
if (end < 0) end = 0;
if (end >= fCTBCode.LinesCount) end = fCTBCode.LinesCount - 1;

Place selStart, selEnd;
selStart.iLine = start;
selStart.iChar = 0;
Expand All @@ -662,11 +670,6 @@ private bool SetTextSelection(int start, int end)
fCTBCode.SelectionColor = Color.Red;
return true;
}
/* private Range SetRange(int start, int end)
{
Range mySelection = new Range(fCTBCode, 0, start, fCTBCode.Lines[end].Length, end);
return mySelection;
}*/

private bool deleteMarkedCode = false;
private void DeletenotMarkToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
17 changes: 1 addition & 16 deletions GRBL-Plotter/GUI/MainFormImportWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ public class ImportWorker : System.Windows.Forms.Form
private System.Windows.Forms.Label resultLabel;
private System.ComponentModel.BackgroundWorker backgroundWorker1;

// MainForm mainForm = null;

public ImportWorker()//MainForm handle = null)
public ImportWorker()
{
InitializeComponent();
InitializeBackgroundWorker();
this.Icon = Properties.Resources.Icon;
// mainForm = handle;
}

private Graphic.SourceType type;
Expand Down Expand Up @@ -88,8 +85,6 @@ private void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
case Graphic.SourceType.Gerber:
{ GCodeFromGerber.ConvertFromFile(source, worker, e); break; }
}
// VisuGCode.xyzSize.addDimensionXY(Graphic.actualDimension);
// VisuGCode.calcDrawingArea(); // calc ruler dimension
}

// This event handler deals with the results of the background operation.
Expand All @@ -110,22 +105,12 @@ private void BackgroundWorker1_RunWorkerCompleted(object sender, RunWorkerComple
// This event handler updates the progress bar.
private void BackgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
/* int p1 = e.ProgressPercentage;
if (p1 < 0) { p1 = 0; }
if (p1 > 100) { p1 = 100; }*/

this.progressBar1.Value = e.ProgressPercentage;
if (e.UserState is MyUserState)
{
MyUserState state = e.UserState as MyUserState;
/* int p2 = state.Value;
if (p2 < 0) { p2 = 0; }
if (p2 > 100) { p2 = 100; }*/
this.progressBar2.Value = state.Value;
this.resultLabel.Text = state.Content;

// if (state.Content == "show")
// mainForm.updatePicturebox(); // resfresh view
}
}

Expand Down
22 changes: 13 additions & 9 deletions GRBL-Plotter/GUI/MainFormLoadFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ You should have received a copy of the GNU General Public License
* 2021-03-28 btnSaveFile_Click save last path
* 2021-05-18 line 250 check parser result
* 2021-07-14 code clean up / code quality
* 2021-08-03 remove root from MRU save path line 105
*/

using System;
Expand Down Expand Up @@ -100,6 +101,10 @@ private void SaveRecentFile(string path, bool addPath = true)
saveName = Path.GetFileNameWithoutExtension(path);
toolStripMenuItem2.DropDownItems.Clear();
LoadRecentList(); //load list from file

if (path.StartsWith(Datapath.AppDataFolder))
{ path = path.Substring(Datapath.AppDataFolder.Length+1);}

if (MRUlist.Contains(path)) //prevent duplication on recent list
MRUlist.Remove(path);

Expand Down Expand Up @@ -224,35 +229,34 @@ private void NewCodeEnd(bool imported = false)
if (objectCount <= maxObjects)
{
if (imported) SetFctbCodeText(Graphic.GCode.ToString()); // newCodeEnd
VisuGCode.GetGCodeLines(fCTBCode.Lines, null, null); // get code path
VisuGCode.GetGCodeLines(fCTBCode.Lines, null, null); // get code path
}
else
{
using (VisuWorker f = new VisuWorker())
using (VisuWorker f = new VisuWorker()) // GCodeVisuWorker.cs
{
if (!imported)
{ f.SetTmpGCode(fCTBCode.Lines); }
else
{ f.SetTmpGCode(); }
f.ShowDialog(this);
{ f.SetTmpGCode(); } // take code from Graphic.GCode.ToString()
f.ShowDialog(this); // perform VisuGCode.GetGCodeLines via worker
fCTBCode.Text = "PLEASE WAIT !!!\r\nDisplaying a large number of lines\r\ntakes some seconds.";
}
}
VisuGCode.CalcDrawingArea(); // calc ruler dimension
// if (ToolTable.GetToolCordinates()!=null)
VisuGCode.DrawMachineLimit();// ToolTable.GetToolCordinates());
VisuGCode.DrawMachineLimit();

if (loadTimerStep > 0)
if (loadTimerStep > 0) // will be set in StartConvert if CodeSize > 250kb (showProgress = true)
{
loadTimerStep++;
loadTimerStep++; // will perform SetFctbCodeText(Graphic.GCode.ToString()) in LoadTimer_tick
loadTimer.Stop();
loadTimer.Start();
}

StatusStripClear(0);
Update_GCode_Depending_Controls(); // update GUI controls
timerUpdateControlSource = "newCodeEnd";
UpdateControlEnables(); // update control enable
UpdateControlEnables(); // update control enable
lbInfo.BackColor = SystemColors.Control;
this.Cursor = Cursors.Default;

Expand Down
8 changes: 4 additions & 4 deletions GRBL-Plotter/GUI/MainFormPictureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,25 +360,25 @@ private void PictureBox1_MouseDown(object sender, MouseEventArgs e)
NewCodeEnd();
if (Panel.ModifierKeys == Keys.Alt)
{
line = VisuGCode.SetPosMarkerNearBy(picAbsPos, false); // find line with coord nearby, mark / unmark figure
line = VisuGCode.SetPosMarkerNearBy(picAbsPos, false); // Keys.Alt find line with coord nearby, mark / unmark figure
fCTBCodeClickedLineNow = line;
FindFigureMarkSelection(XmlMarkerType.Line, line, (fold > 0)); // collapse=true
}
else if (Panel.ModifierKeys == Keys.Control)
{
line = VisuGCode.SetPosMarkerNearBy(picAbsPos, false); // find line with coord nearby, mark / unmark figure
line = VisuGCode.SetPosMarkerNearBy(picAbsPos, false); // Keys.Control find line with coord nearby, mark / unmark figure
fCTBCodeClickedLineNow = line;
FindFigureMarkSelection(XmlMarkerType.Group, line, (fold > 0));
}
else if (Panel.ModifierKeys == Keys.Shift)
{
line = VisuGCode.SetPosMarkerNearBy(picAbsPos, false); // find line with coord nearby, mark / unmark figure
line = VisuGCode.SetPosMarkerNearBy(picAbsPos, false); // Keys.Shift find line with coord nearby, mark / unmark figure
fCTBCodeClickedLineNow = line;
FindFigureMarkSelection(XmlMarkerType.Tile, line, (fold > 0));
}
else
{
line = VisuGCode.SetPosMarkerNearBy(picAbsPos); // find line with coord nearby, mark / unmark figure
line = VisuGCode.SetPosMarkerNearBy(picAbsPos, true); // find line with coord nearby, mark / unmark figure
fCTBCodeClickedLineNow = line;
FindFigureMarkSelection(XmlMarkerType.Figure, line, (fold > 0));
}
Expand Down

0 comments on commit 3b7d939

Please sign in to comment.