Fixed formatting

This commit is contained in:
Robin Krom 2021-02-19 23:12:15 +01:00 committed by GitHub
parent ee9d1325b5
commit c8ade4258b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,6 +66,9 @@ namespace Greenshot {
// whether part of the editor controls are disabled depending on selected item(s) // whether part of the editor controls are disabled depending on selected item(s)
private bool _controlsDisabledDueToConfirmable; private bool _controlsDisabledDueToConfirmable;
// Used for tracking the mouse scrollwheel changes
private DateTime _zoomStartTime = DateTime.Now;
/// <summary> /// <summary>
/// All provided zoom values (in percents) in ascending order. /// All provided zoom values (in percents) in ascending order.
/// </summary> /// </summary>
@ -898,18 +901,24 @@ namespace Greenshot {
} }
} }
} }
DateTime zoomStartTime = DateTime.Now;
/// <summary> /// <summary>
/// This is a "work-around" for the MouseWheel event which doesn't get to the panel /// This is a "work-around" for the MouseWheel event which doesn't get to the panel
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void PanelMouseWheel(object sender, MouseEventArgs e) { /// <summary>
/// This is a "work-around" for the MouseWheel event which doesn't get to the panel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PanelMouseWheel(object sender, MouseEventArgs e)
{
if (System.Windows.Forms.Control.ModifierKeys.Equals(Keys.Control)) if (System.Windows.Forms.Control.ModifierKeys.Equals(Keys.Control))
{ {
if (zoomStartTime.AddMilliseconds(100) < DateTime.Now) //waiting for next zoom step 100 ms if (_zoomStartTime.AddMilliseconds(100) < DateTime.Now) //waiting for next zoom step 100 ms
{ {
zoomStartTime = DateTime.Now; _zoomStartTime = DateTime.Now;
if (e.Delta > 0) if (e.Delta > 0)
{ {
ZoomInMenuItemClick(sender, e); ZoomInMenuItemClick(sender, e);
@ -919,12 +928,12 @@ DateTime zoomStartTime = DateTime.Now;
ZoomOutMenuItemClick(sender, e); ZoomOutMenuItemClick(sender, e);
} }
} }
} }
panel1.Focus(); panel1.Focus();
} }
protected override bool ProcessKeyPreview(ref Message msg) { protected override bool ProcessKeyPreview(ref Message msg) {
// disable default key handling if surface has requested a lock // disable default key handling if surface has requested a lock
if (!_surface.KeysLocked) { if (!_surface.KeysLocked) {
return base.ProcessKeyPreview(ref msg); return base.ProcessKeyPreview(ref msg);