ShareX/Greenshot.ImageEditor/Forms/EditorSettingsForm.cs
campbeb c4f32505ab Size and position Greenshot editor window to be on screen
When Automatically resize window is set:
1. Fixes #1640 which was caused by mixing screen and working area
coordinates
2. Moves window up and left to try and fit it in the working area
3. Adds option to maximize the editor window when it is larger than
working area (such as when capturing full desktop or multi-monitor).
2016-07-09 15:53:28 -04:00

45 lines
No EOL
1.7 KiB
C#

using Greenshot.Configuration;
using Greenshot.IniFile;
using GreenshotPlugin.Core;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Greenshot
{
public partial class EditorSettingsForm : Form
{
private static CoreConfiguration coreConfiguration = IniConfig.GetIniSection<CoreConfiguration>();
private static EditorConfiguration editorConfiguration = IniConfig.GetIniSection<EditorConfiguration>();
public EditorSettingsForm()
{
InitializeComponent();
Icon = GreenshotResources.getGreenshotIcon();
LoadSettings();
}
private void LoadSettings()
{
nudIconSize.Value = (int)Math.Round(coreConfiguration.IconSize.Width / 16.0) * 16;
cbMatchSizeToCapture.Checked = editorConfiguration.MatchSizeToCapture;
cbMaximizeWhenLargeImage.Checked = editorConfiguration.MaximizeWhenLargeImage;
cbSuppressSaveDialogAtClose.Checked = editorConfiguration.SuppressSaveDialogAtClose;
cbRememberLastDrawingMode.Checked = editorConfiguration.RememberLastDrawingMode;
}
private void SaveSettings()
{
coreConfiguration.IconSize = new Size((int)nudIconSize.Value, (int)nudIconSize.Value);
editorConfiguration.MatchSizeToCapture = cbMatchSizeToCapture.Checked;
editorConfiguration.MaximizeWhenLargeImage = cbMaximizeWhenLargeImage.Checked;
editorConfiguration.SuppressSaveDialogAtClose = cbSuppressSaveDialogAtClose.Checked;
editorConfiguration.RememberLastDrawingMode = cbRememberLastDrawingMode.Checked;
}
private void btnOK_Click(object sender, EventArgs e)
{
SaveSettings();
}
}
}