mirror of
https://github.com/ShareX/ShareX.git
synced 2024-08-15 18:22:04 +12:00
Greenshot updated from 1.2 branch at commit e9ab99c5acc99785cc5045b4b5493c9b6504d016 This solves #1341 and #1079 for allowing support high DPI monitors. Additionally, the following were implemented: - #748 - Objects can be saved to file and loaded from file via menu - #676 - Keyboard shortcuts added for 'Save and close' (Alt+S), 'Close' (Alt+W), and 'Close and cancel tasks' (Alt+C) - #1189 - Editor opens sized to image. Can be disabled via Greenshot ini with `MatchSizeToCapture=False`
108 lines
No EOL
4.3 KiB
C#
108 lines
No EOL
4.3 KiB
C#
/*
|
|
* Greenshot - a free and open source screenshot tool
|
|
* Copyright (C) 2007-2015 Thomas Braun, Jens Klingen, Robin Krom
|
|
*
|
|
* For more information see: http://getgreenshot.org/
|
|
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 1 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
using Greenshot.Core;
|
|
using GreenshotPlugin.Core;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Greenshot.Forms
|
|
{
|
|
public partial class TornEdgeSettingsForm : BaseForm
|
|
{
|
|
private TornEdgeEffect effect;
|
|
|
|
public TornEdgeSettingsForm(TornEdgeEffect effect)
|
|
{
|
|
this.effect = effect;
|
|
InitializeComponent();
|
|
this.Icon = GreenshotResources.getGreenshotIcon();
|
|
shadowCheckbox.Checked = effect.GenerateShadow;
|
|
// Fix to prevent BUG-1753
|
|
shadowDarkness.Value = Math.Max(shadowDarkness.Minimum, Math.Min(shadowDarkness.Maximum, (int)(effect.Darkness * shadowDarkness.Maximum)));
|
|
offsetX.Value = effect.ShadowOffset.X;
|
|
offsetY.Value = effect.ShadowOffset.Y;
|
|
toothsize.Value = effect.ToothHeight;
|
|
verticaltoothrange.Value = effect.VerticalToothRange;
|
|
horizontaltoothrange.Value = effect.HorizontalToothRange;
|
|
top.Checked = effect.Edges[0];
|
|
right.Checked = effect.Edges[1];
|
|
bottom.Checked = effect.Edges[2];
|
|
left.Checked = effect.Edges[3];
|
|
}
|
|
|
|
private void buttonOK_Click(object sender, EventArgs e)
|
|
{
|
|
effect.Darkness = (float)shadowDarkness.Value / (float)40;
|
|
effect.ShadowOffset = new Point((int)offsetX.Value, (int)offsetY.Value);
|
|
effect.ShadowSize = (int)thickness.Value;
|
|
effect.ToothHeight = (int)toothsize.Value;
|
|
effect.VerticalToothRange = (int)verticaltoothrange.Value;
|
|
effect.HorizontalToothRange = (int)horizontaltoothrange.Value;
|
|
effect.Edges = new bool[] { top.Checked, right.Checked, bottom.Checked, left.Checked };
|
|
effect.GenerateShadow = shadowCheckbox.Checked;
|
|
DialogResult = DialogResult.OK;
|
|
}
|
|
|
|
private void shadowCheckbox_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
thickness.Enabled = shadowCheckbox.Checked;
|
|
offsetX.Enabled = shadowCheckbox.Checked;
|
|
offsetY.Enabled = shadowCheckbox.Checked;
|
|
shadowDarkness.Enabled = shadowCheckbox.Checked;
|
|
}
|
|
|
|
private void all_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
AnySideChangeChecked(top, all.Checked);
|
|
AnySideChangeChecked(right, all.Checked);
|
|
AnySideChangeChecked(bottom, all.Checked);
|
|
AnySideChangeChecked(left, all.Checked);
|
|
}
|
|
|
|
private void AnySideCheckedChanged(object sender, EventArgs e)
|
|
{
|
|
all.CheckedChanged -= all_CheckedChanged;
|
|
all.Checked = top.Checked && right.Checked && bottom.Checked && left.Checked;
|
|
all.CheckedChanged += all_CheckedChanged;
|
|
}
|
|
|
|
/// <summary>
|
|
/// changes the Checked property of top/right/bottom/left checkboxes without triggering AnySideCheckedChange
|
|
/// </summary>
|
|
/// <param name="cb">Checkbox to change Checked</param>
|
|
/// <param name="status">true to check</param>
|
|
private void AnySideChangeChecked(CheckBox cb, bool status)
|
|
{
|
|
if (status != cb.Checked)
|
|
{
|
|
cb.CheckedChanged -= AnySideCheckedChanged;
|
|
cb.Checked = status;
|
|
cb.CheckedChanged += AnySideCheckedChanged;
|
|
}
|
|
}
|
|
|
|
private void TornEdgeSettingsForm_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
}
|
|
} |