mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Changed key handler to make it possible to specify pixel-exact locations.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2336 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
3a9abafdc8
commit
bc6b7c36e4
1 changed files with 67 additions and 37 deletions
|
@ -194,44 +194,74 @@ namespace Greenshot.Forms {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle the key down event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
void CaptureFormKeyDown(object sender, KeyEventArgs e) {
|
void CaptureFormKeyDown(object sender, KeyEventArgs e) {
|
||||||
// Check fixmode
|
switch (e.KeyCode) {
|
||||||
if (e.KeyCode == Keys.ShiftKey) {
|
case Keys.Up:
|
||||||
if (fixMode == FixMode.None) {
|
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y - 1);
|
||||||
fixMode = FixMode.Initiated;
|
break;
|
||||||
return;
|
case Keys.Down:
|
||||||
}
|
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y + 1);
|
||||||
}
|
break;
|
||||||
if (e.KeyCode == Keys.Escape) {
|
case Keys.Left:
|
||||||
DialogResult = DialogResult.Cancel;
|
Cursor.Position = new Point(Cursor.Position.X - 1, Cursor.Position.Y);
|
||||||
} else if (e.KeyCode == Keys.M) {
|
break;
|
||||||
// Toggle mouse cursor
|
case Keys.Right:
|
||||||
capture.CursorVisible = !capture.CursorVisible;
|
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
|
||||||
Invalidate();
|
break;
|
||||||
} else if (e.KeyCode == Keys.V) {
|
case Keys.ShiftKey:
|
||||||
if (capture.CaptureDetails.CaptureMode != CaptureMode.Video) {
|
// Fixmode
|
||||||
capture.CaptureDetails.CaptureMode = CaptureMode.Video;
|
if (fixMode == FixMode.None) {
|
||||||
} else {
|
fixMode = FixMode.Initiated;
|
||||||
capture.CaptureDetails.CaptureMode = captureMode;
|
return;
|
||||||
}
|
}
|
||||||
Invalidate();
|
break;
|
||||||
} else if (e.KeyCode == Keys.Z) {
|
case Keys.Escape:
|
||||||
// Toggle zoom
|
// Cancel
|
||||||
isZooming = !isZooming;
|
DialogResult = DialogResult.Cancel;
|
||||||
} else if (e.KeyCode == Keys.Space) {
|
break;
|
||||||
switch (captureMode) {
|
case Keys.M:
|
||||||
case CaptureMode.Region:
|
// Toggle mouse cursor
|
||||||
captureMode = CaptureMode.Window;
|
capture.CursorVisible = !capture.CursorVisible;
|
||||||
break;
|
Invalidate();
|
||||||
case CaptureMode.Window:
|
break;
|
||||||
captureMode = CaptureMode.Region;
|
case Keys.V:
|
||||||
break;
|
// Video
|
||||||
}
|
if (capture.CaptureDetails.CaptureMode != CaptureMode.Video) {
|
||||||
Invalidate();
|
capture.CaptureDetails.CaptureMode = CaptureMode.Video;
|
||||||
selectedCaptureWindow = null;
|
} else {
|
||||||
OnMouseMove(this, new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0));
|
capture.CaptureDetails.CaptureMode = captureMode;
|
||||||
} else if (e.KeyCode == Keys.Return && captureMode == CaptureMode.Window) {
|
}
|
||||||
DialogResult = DialogResult.OK;
|
Invalidate();
|
||||||
|
break;
|
||||||
|
case Keys.Z:
|
||||||
|
// Toggle zoom
|
||||||
|
isZooming = !isZooming;
|
||||||
|
break;
|
||||||
|
case Keys.Space:
|
||||||
|
// Toggle capture mode
|
||||||
|
switch (captureMode) {
|
||||||
|
case CaptureMode.Region:
|
||||||
|
captureMode = CaptureMode.Window;
|
||||||
|
break;
|
||||||
|
case CaptureMode.Window:
|
||||||
|
captureMode = CaptureMode.Region;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Invalidate();
|
||||||
|
selectedCaptureWindow = null;
|
||||||
|
OnMouseMove(this, new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0));
|
||||||
|
break;
|
||||||
|
case Keys.Return:
|
||||||
|
// Confirm
|
||||||
|
if (captureMode == CaptureMode.Window) {
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue