Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modern jog Control #592

Merged
merged 3 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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