#314 Added additional click actions to support capture region, not satisfied with the empty editor option though

This commit is contained in:
Robin Krom 2021-05-19 16:24:29 +02:00
commit cf2d9d4148
No known key found for this signature in database
GPG key ID: BCC01364F1371490
4 changed files with 42 additions and 3 deletions

View file

@ -30,6 +30,11 @@ namespace Greenshot.Base.Core.Enums
OPEN_LAST_IN_EXPLORER, OPEN_LAST_IN_EXPLORER,
OPEN_LAST_IN_EDITOR, OPEN_LAST_IN_EDITOR,
OPEN_SETTINGS, OPEN_SETTINGS,
SHOW_CONTEXT_MENU SHOW_CONTEXT_MENU,
CAPTURE_REGION,
CAPTURE_SCREEN,
CAPTURE_CLIPBOARD,
CAPTURE_WINDOW,
OPEN_EMPTY_EDITOR
} }
} }

View file

@ -79,6 +79,10 @@ namespace Greenshot.Editor.Configuration
[IniProperty("TornEdgeEffectSettings", Description = "Settings for the torn edge effect.")] [IniProperty("TornEdgeEffectSettings", Description = "Settings for the torn edge effect.")]
public TornEdgeEffect TornEdgeEffectSettings { get; set; } public TornEdgeEffect TornEdgeEffectSettings { get; set; }
[IniProperty("DefaultEditorSize", Description = "The size for the editor when it's opened without a capture", DefaultValue = "500,500")]
public Size DefaultEditorSize { get; set; }
public override void AfterLoad() public override void AfterLoad()
{ {
base.AfterLoad(); base.AfterLoad();

View file

@ -23,6 +23,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
@ -124,7 +125,19 @@ namespace Greenshot.Editor.Forms
UpdateUi(); UpdateUi();
} }
public ImageEditorForm(ISurface iSurface, bool outputMade) public ImageEditorForm()
{
var image = ImageHelper.CreateEmpty(EditorConfiguration.DefaultEditorSize.Width, EditorConfiguration.DefaultEditorSize.Height, PixelFormat.Format32bppArgb, Color.White, 96f, 96f);
ISurface surface = new Surface(image);
Initialize(surface, false);
}
public ImageEditorForm(ISurface surface, bool outputMade)
{
Initialize(surface, outputMade);
}
private void Initialize(ISurface surface, bool outputMade)
{ {
EditorList.Add(this); EditorList.Add(this);
@ -162,7 +175,7 @@ namespace Greenshot.Editor.Forms
}; };
// init surface // init surface
Surface = iSurface; Surface = surface;
// Initial "saved" flag for asking if the image needs to be save // Initial "saved" flag for asking if the image needs to be save
_surface.Modified = !outputMade; _surface.Modified = !outputMade;

View file

@ -1735,6 +1735,23 @@ namespace Greenshot.Forms
MethodInfo oMethodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo oMethodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
oMethodInfo.Invoke(notifyIcon, null); oMethodInfo.Invoke(notifyIcon, null);
break; break;
case ClickActions.CAPTURE_CLIPBOARD:
CaptureHelper.CaptureClipboard();
break;
case ClickActions.CAPTURE_REGION:
CaptureHelper.CaptureRegion(false);
break;
case ClickActions.CAPTURE_SCREEN:
CaptureHelper.CaptureFullscreen(false, ScreenCaptureMode.FullScreen);
break;
case ClickActions.CAPTURE_WINDOW:
CaptureHelper.CaptureWindowInteractive(false);
break;
case ClickActions.OPEN_EMPTY_EDITOR:
var imageEditor = new ImageEditorForm();
imageEditor.Show();
imageEditor.Activate();
break;
} }
} }