Skip to content

Commit

Permalink
Merge pull request #592 from Sardau/master
Browse files Browse the repository at this point in the history
Modern jog Control
  • Loading branch information
arkypita authored Feb 28, 2019
2 parents 100eee7 + 2a4a4d6 commit ee5f264
Show file tree
Hide file tree
Showing 10 changed files with 1,673 additions and 1,866 deletions.
2 changes: 1 addition & 1 deletion LaserGRBL/Autotrace/Autotrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace LaserGRBL
{
public class Autotrace
{
public static string TempPath { get => $"{GrblCore.DataPath}\\Autotrace\\"; }
public static string TempPath { get { return $"{GrblCore.DataPath}\\Autotrace\\"; } }

public static void CleanupTmpFolder()
{
Expand Down
20 changes: 20 additions & 0 deletions LaserGRBL/GrblCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,26 @@ public bool JogEnabled
}
}

public void Move(Point move)
{
if (JogEnabled)
{
decimal speed = JogSpeed;

string cmd = SupportJogging ? "$J=G91X{0}Y{1}F{2}" : "G0X{0}Y{1}F{2}";
cmd = string.Format(cmd, move.X, move.Y, speed);

if (!SupportJogging)
EnqueueCommand(new GrblCommand("G91"));

EnqueueCommand(new GrblCommand(cmd));

if (!SupportJogging)
EnqueueCommand(new GrblCommand("G90"));

}

}
public void Jog(JogDirection dir)
{
if (JogEnabled)
Expand Down
349 changes: 43 additions & 306 deletions LaserGRBL/JogForm.Designer.cs

Large diffs are not rendered by default.

37 changes: 4 additions & 33 deletions LaserGRBL/JogForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,7 @@ public void SetCore(GrblCore core)
UpdateFMax_Tick(null, null);

TbSpeed.Value = Math.Min((int)Settings.GetObject("Jog Speed", 1000), TbSpeed.Maximum);
TbStep.Value = (int)Settings.GetObject("Jog Step", 10);

TbSpeed_ValueChanged(null, null); //set tooltip
TbStep_ValueChanged(null, null); //set tooltip
}

private void OnJogButtonMouseDown(object sender, MouseEventArgs e)
{
Core.Jog((sender as DirectionButton).JogDirection);
}

private void TbSpeed_ValueChanged(object sender, EventArgs e)
Expand All @@ -40,16 +32,8 @@ private void TbSpeed_ValueChanged(object sender, EventArgs e)
needsave = true;
}

private void TbStep_ValueChanged(object sender, EventArgs e)
{
TT.SetToolTip(TbStep, string.Format("Step: {0}", TbStep.Value));
LblStep.Text = TbStep.Value.ToString();
Settings.SetObject("Jog Step", TbStep.Value);
Core.JogStep = TbStep.Value;
needsave = true;
}

private void BtnHome_Click(object sender, EventArgs e)
private void Home_Click(object sender, EventArgs e)
{
Core.JogHome();
}
Expand Down Expand Up @@ -77,24 +61,11 @@ private void UpdateFMax_Tick(object sender, EventArgs e)
oldVal = curVal;
}
}
}

public class DirectionButton : UserControls.ImageButton
{
private GrblCore.JogDirection mDir = GrblCore.JogDirection.N;

public GrblCore.JogDirection JogDirection
private void Move_Click(object sender, UserControls.Move2DControl.MoveEventArgs e)
{
get { return mDir; }
set { mDir = value; }
}

protected override void OnSizeChanged(EventArgs e)
{
if (Width != Height)
Width = Height;

base.OnSizeChanged(e);
var move = e.Move;
Core.Move(move.Mouvement);
}
}
}
467 changes: 0 additions & 467 deletions LaserGRBL/JogForm.resx

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions LaserGRBL/LaserGRBL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,9 @@
<DependentUpon>ImageButton.cs</DependentUpon>
</Compile>
<Compile Include="UserControls\ImageTransform.cs" />
<Compile Include="UserControls\Move2DControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UserControls\NumericInput\ColoredBorderControl.cs">
<SubType>UserControl</SubType>
</Compile>
Expand Down
4 changes: 2 additions & 2 deletions LaserGRBL/RasterConverter/ImageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ private static Size CalculateResizeToFit(Size imageSize, Size boxSize)

public Bitmap Original { get { return mResized; } }

public int FileDPI { get => mFileDPI; }
public Size FileResolution { get => mFileResolution; }
public int FileDPI { get { return mFileDPI; } }
public Size FileResolution { get { return mFileResolution; } }
}
}
2,050 changes: 1,025 additions & 1,025 deletions LaserGRBL/RasterConverter/RasterToLaserForm.Designer.cs

Large diffs are not rendered by default.

Loading

0 comments on commit ee5f264

Please sign in to comment.