mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 10:47:02 -07:00
Applied zoom patch, currently needs to be activated by pressing "Z" in the capture form. This will change later.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2272 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
e84b6c8dd4
commit
94efe04377
3 changed files with 153 additions and 1 deletions
|
@ -61,6 +61,7 @@ namespace Greenshot.Forms {
|
|||
|
||||
private Point previousMousePos = Point.Empty;
|
||||
private FixMode fixMode = FixMode.None;
|
||||
private ZoomForm zoomForm = null;
|
||||
|
||||
public Rectangle CaptureRectangle {
|
||||
get {
|
||||
|
@ -91,6 +92,7 @@ namespace Greenshot.Forms {
|
|||
|
||||
// clean up
|
||||
this.FormClosed += delegate {
|
||||
RemoveZoom();
|
||||
currentForm = null;
|
||||
LOG.Debug("Remove CaptureForm from currentForm");
|
||||
};
|
||||
|
@ -127,6 +129,30 @@ namespace Greenshot.Forms {
|
|||
this.TopMost = true;
|
||||
}
|
||||
|
||||
private void CreateZoom() {
|
||||
if (zoomForm == null) {
|
||||
zoomForm = new ZoomForm(capture);
|
||||
zoomForm.Show();
|
||||
WindowDetails.ToForeground(zoomForm.Handle);
|
||||
|
||||
// Fix missing focus issue
|
||||
WindowDetails.ToForeground(this.Handle);
|
||||
this.TopMost = false;
|
||||
zoomForm.TopMost = true;
|
||||
Activate();
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveZoom() {
|
||||
if (zoomForm != null) {
|
||||
zoomForm.Close();
|
||||
// Fix missing focus issue
|
||||
WindowDetails.ToForeground(this.Handle);
|
||||
this.TopMost = true;
|
||||
zoomForm = null;
|
||||
}
|
||||
}
|
||||
|
||||
#region key handling
|
||||
void CaptureFormKeyUp(object sender, KeyEventArgs e) {
|
||||
if (e.KeyCode == Keys.ShiftKey) {
|
||||
|
@ -148,6 +174,13 @@ namespace Greenshot.Forms {
|
|||
// Toggle mouse cursor
|
||||
capture.CursorVisible = !capture.CursorVisible;
|
||||
Invalidate();
|
||||
} else if (e.KeyCode == Keys.Z) {
|
||||
// Toggle zoom
|
||||
if (zoomForm == null) {
|
||||
CreateZoom();
|
||||
} else {
|
||||
RemoveZoom();
|
||||
}
|
||||
} else if (e.KeyCode == Keys.Space) {
|
||||
switch (captureMode) {
|
||||
case CaptureMode.Region:
|
||||
|
@ -231,6 +264,11 @@ namespace Greenshot.Forms {
|
|||
bool horizontalMove = false;
|
||||
bool verticalMove = false;
|
||||
|
||||
// Change the zoom location
|
||||
if (zoomForm != null) {
|
||||
zoomForm.MouseLocation = cursorPos;
|
||||
}
|
||||
|
||||
if (lastPos.X != cursorPos.X) {
|
||||
horizontalMove = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue