mirror of
https://github.com/ShareX/ShareX.git
synced 2024-08-19 04:02:07 +12:00
Merge pull request #2881 from Jaex/editor-mode-start-maximized
Added option to start image editor window maximized
This commit is contained in:
commit
998df5bc4d
5 changed files with 55 additions and 35 deletions
|
@ -102,16 +102,16 @@ public Color CurrentColor
|
||||||
private Bitmap bmpBackgroundImage;
|
private Bitmap bmpBackgroundImage;
|
||||||
private Cursor defaultCursor;
|
private Cursor defaultCursor;
|
||||||
|
|
||||||
public RegionCaptureForm(RegionCaptureMode mode)
|
public RegionCaptureForm(RegionCaptureMode mode, RegionCaptureOptions options)
|
||||||
{
|
{
|
||||||
Mode = mode;
|
Mode = mode;
|
||||||
|
Config = options;
|
||||||
|
|
||||||
ScreenRectangle0Based = CaptureHelpers.GetScreenBounds0Based();
|
ScreenRectangle0Based = CaptureHelpers.GetScreenBounds0Based();
|
||||||
ImageRectangle = ScreenRectangle0Based;
|
ImageRectangle = ScreenRectangle0Based;
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Config = new RegionCaptureOptions();
|
|
||||||
DrawableObjects = new List<DrawableObject>();
|
DrawableObjects = new List<DrawableObject>();
|
||||||
timerStart = new Stopwatch();
|
timerStart = new Stopwatch();
|
||||||
timerFPS = new Stopwatch();
|
timerFPS = new Stopwatch();
|
||||||
|
@ -162,9 +162,18 @@ private void InitializeComponent()
|
||||||
Text = "ShareX - " + "Annotate"; // TODO: Translate
|
Text = "ShareX - " + "Annotate"; // TODO: Translate
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
FormBorderStyle = FormBorderStyle.Sizable;
|
FormBorderStyle = FormBorderStyle.Sizable;
|
||||||
Size = new Size(800, 600);
|
Size = new Size(900, 700);
|
||||||
MinimumSize = new Size(800, 600);
|
MinimumSize = new Size(900, 600);
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
|
if (Config.EditorModeStartMaximized)
|
||||||
|
{
|
||||||
|
WindowState = FormWindowState.Maximized;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WindowState = FormWindowState.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
ShowInTaskbar = true;
|
ShowInTaskbar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,5 +74,8 @@ public class RegionCaptureOptions
|
||||||
public AnnotationOptions AnnotationOptions = new AnnotationOptions();
|
public AnnotationOptions AnnotationOptions = new AnnotationOptions();
|
||||||
public ShapeType LastRegionTool = ShapeType.RegionRectangle;
|
public ShapeType LastRegionTool = ShapeType.RegionRectangle;
|
||||||
public ShapeType LastAnnotationTool = ShapeType.DrawingRectangle;
|
public ShapeType LastAnnotationTool = ShapeType.DrawingRectangle;
|
||||||
|
|
||||||
|
// Editor mode
|
||||||
|
public bool EditorModeStartMaximized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,11 +35,11 @@ public static class RegionCaptureTasks
|
||||||
{
|
{
|
||||||
public static Image GetRegionImage(RegionCaptureOptions options)
|
public static Image GetRegionImage(RegionCaptureOptions options)
|
||||||
{
|
{
|
||||||
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Default))
|
RegionCaptureOptions newOptions = GetRegionCaptureOptions(options);
|
||||||
{
|
newOptions.ShowHotkeys = false;
|
||||||
form.Config = GetRegionCaptureOptions(options);
|
|
||||||
form.Config.ShowHotkeys = false;
|
|
||||||
|
|
||||||
|
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Default, newOptions))
|
||||||
|
{
|
||||||
form.Prepare();
|
form.Prepare();
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
|
@ -49,11 +49,11 @@ public static Image GetRegionImage(RegionCaptureOptions options)
|
||||||
|
|
||||||
public static bool GetRectangleRegion(out Rectangle rect, RegionCaptureOptions options)
|
public static bool GetRectangleRegion(out Rectangle rect, RegionCaptureOptions options)
|
||||||
{
|
{
|
||||||
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Default))
|
RegionCaptureOptions newOptions = GetRegionCaptureOptions(options);
|
||||||
{
|
newOptions.ShowHotkeys = false;
|
||||||
form.Config = GetRegionCaptureOptions(options);
|
|
||||||
form.Config.ShowHotkeys = false;
|
|
||||||
|
|
||||||
|
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Default, newOptions))
|
||||||
|
{
|
||||||
form.Prepare();
|
form.Prepare();
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
|
@ -94,13 +94,13 @@ public static bool GetRectangleRegion(out Rectangle rect, RegionCaptureOptions o
|
||||||
|
|
||||||
public static PointInfo GetPointInfo(RegionCaptureOptions options)
|
public static PointInfo GetPointInfo(RegionCaptureOptions options)
|
||||||
{
|
{
|
||||||
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.ScreenColorPicker))
|
RegionCaptureOptions newOptions = GetRegionCaptureOptions(options);
|
||||||
{
|
newOptions.DetectWindows = false;
|
||||||
form.Config = GetRegionCaptureOptions(options);
|
newOptions.ShowHotkeys = false;
|
||||||
form.Config.DetectWindows = false;
|
newOptions.UseDimming = false;
|
||||||
form.Config.ShowHotkeys = false;
|
|
||||||
form.Config.UseDimming = false;
|
|
||||||
|
|
||||||
|
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.ScreenColorPicker, newOptions))
|
||||||
|
{
|
||||||
form.Prepare();
|
form.Prepare();
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ public static PointInfo GetPointInfo(RegionCaptureOptions options)
|
||||||
|
|
||||||
public static SimpleWindowInfo GetWindowInfo(RegionCaptureOptions options)
|
public static SimpleWindowInfo GetWindowInfo(RegionCaptureOptions options)
|
||||||
{
|
{
|
||||||
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.OneClick))
|
RegionCaptureOptions newOptions = GetRegionCaptureOptions(options);
|
||||||
{
|
newOptions.UseDimming = false;
|
||||||
form.Config = GetRegionCaptureOptions(options);
|
newOptions.ShowMagnifier = false;
|
||||||
form.Config.UseDimming = false;
|
newOptions.ShowHotkeys = false;
|
||||||
form.Config.ShowMagnifier = false;
|
|
||||||
form.Config.ShowHotkeys = false;
|
|
||||||
|
|
||||||
|
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.OneClick, newOptions))
|
||||||
|
{
|
||||||
form.Prepare();
|
form.Prepare();
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
|
@ -139,12 +139,12 @@ public static SimpleWindowInfo GetWindowInfo(RegionCaptureOptions options)
|
||||||
|
|
||||||
public static void ShowScreenRuler(RegionCaptureOptions options)
|
public static void ShowScreenRuler(RegionCaptureOptions options)
|
||||||
{
|
{
|
||||||
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Ruler))
|
RegionCaptureOptions newOptions = GetRegionCaptureOptions(options);
|
||||||
{
|
newOptions.QuickCrop = false;
|
||||||
form.Config = GetRegionCaptureOptions(options);
|
newOptions.ShowHotkeys = false;
|
||||||
form.Config.QuickCrop = false;
|
|
||||||
form.Config.ShowHotkeys = false;
|
|
||||||
|
|
||||||
|
using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Ruler, newOptions))
|
||||||
|
{
|
||||||
form.Prepare();
|
form.Prepare();
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
@ -160,11 +160,9 @@ public static Image AnnotateImage(Image img, string filePath, RegionCaptureOptio
|
||||||
{
|
{
|
||||||
RegionCaptureMode mode = taskMode ? RegionCaptureMode.TaskEditor : RegionCaptureMode.Editor;
|
RegionCaptureMode mode = taskMode ? RegionCaptureMode.TaskEditor : RegionCaptureMode.Editor;
|
||||||
|
|
||||||
using (RegionCaptureForm form = new RegionCaptureForm(mode))
|
using (RegionCaptureForm form = new RegionCaptureForm(mode, options))
|
||||||
{
|
{
|
||||||
form.Config = options;
|
|
||||||
form.ImageFilePath = filePath;
|
form.ImageFilePath = filePath;
|
||||||
|
|
||||||
form.Prepare(img);
|
form.Prepare(img);
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
|
|
|
@ -715,6 +715,17 @@ internal void CreateToolbar()
|
||||||
tsddbOptions.Image = Resources.gear;
|
tsddbOptions.Image = Resources.gear;
|
||||||
tsMain.Items.Add(tsddbOptions);
|
tsMain.Items.Add(tsddbOptions);
|
||||||
|
|
||||||
|
if (form.IsEditorMode)
|
||||||
|
{
|
||||||
|
ToolStripMenuItem tsmiEditorModeStartMaximized = new ToolStripMenuItem("Start editor maximized");
|
||||||
|
tsmiEditorModeStartMaximized.Checked = Config.EditorModeStartMaximized;
|
||||||
|
tsmiEditorModeStartMaximized.CheckOnClick = true;
|
||||||
|
tsmiEditorModeStartMaximized.Click += (sender, e) => Config.EditorModeStartMaximized = tsmiEditorModeStartMaximized.Checked;
|
||||||
|
tsddbOptions.DropDownItems.Add(tsmiEditorModeStartMaximized);
|
||||||
|
|
||||||
|
tsddbOptions.DropDownItems.Add(new ToolStripSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
if (!form.IsEditorMode)
|
if (!form.IsEditorMode)
|
||||||
{
|
{
|
||||||
tsmiQuickCrop = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Multi_region_mode);
|
tsmiQuickCrop = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Multi_region_mode);
|
||||||
|
|
|
@ -74,11 +74,10 @@ protected ImageInfo ExecuteRegionCapture(TaskSettings taskSettings)
|
||||||
mode = RegionCaptureMode.Annotation;
|
mode = RegionCaptureMode.Annotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionCaptureForm form = new RegionCaptureForm(mode);
|
RegionCaptureForm form = new RegionCaptureForm(mode, taskSettings.CaptureSettingsReference.SurfaceOptions);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
form.Config = taskSettings.CaptureSettingsReference.SurfaceOptions;
|
|
||||||
Screenshot screenshot = TaskHelpers.GetScreenshot(taskSettings);
|
Screenshot screenshot = TaskHelpers.GetScreenshot(taskSettings);
|
||||||
screenshot.CaptureCursor = false;
|
screenshot.CaptureCursor = false;
|
||||||
Image img = screenshot.CaptureFullscreen();
|
Image img = screenshot.CaptureFullscreen();
|
||||||
|
|
Loading…
Reference in a new issue