mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
Code quality changes, and added the possibility to set the amount of colors for the Quantizer.
This commit is contained in:
parent
3b1560390b
commit
77a92d98c3
92 changed files with 690 additions and 653 deletions
|
@ -87,7 +87,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// Initialize the animation
|
||||
/// </summary>
|
||||
protected AnimatingForm() {
|
||||
this.Load += delegate {
|
||||
Load += delegate {
|
||||
if (EnableAnimation) {
|
||||
timer = new Timer();
|
||||
timer.Interval = 1000 / VRefresh;
|
||||
|
@ -97,7 +97,7 @@ namespace GreenshotPlugin.Controls {
|
|||
};
|
||||
|
||||
// Unregister at close
|
||||
this.FormClosing += delegate {
|
||||
FormClosing += delegate {
|
||||
if (timer != null) {
|
||||
timer.Stop();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ using System;
|
|||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
|
@ -31,7 +32,7 @@ namespace GreenshotPlugin.Controls {
|
|||
private volatile bool shouldClose = false;
|
||||
|
||||
private void BackgroundShowDialog() {
|
||||
this.ShowDialog();
|
||||
ShowDialog();
|
||||
}
|
||||
|
||||
public static BackgroundForm ShowAndWait(string title, string text) {
|
||||
|
@ -50,11 +51,11 @@ namespace GreenshotPlugin.Controls {
|
|||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent();
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
Icon = GreenshotResources.getGreenshotIcon();
|
||||
shouldClose = false;
|
||||
this.Text = title;
|
||||
this.label_pleasewait.Text = text;
|
||||
this.FormClosing += PreventFormClose;
|
||||
Text = title;
|
||||
label_pleasewait.Text = text;
|
||||
FormClosing += PreventFormClose;
|
||||
timer_checkforclose.Start();
|
||||
}
|
||||
|
||||
|
@ -65,12 +66,12 @@ namespace GreenshotPlugin.Controls {
|
|||
foreach(Screen screen in Screen.AllScreens) {
|
||||
if (screen.Bounds.Contains(Cursor.Position)) {
|
||||
positioned = true;
|
||||
this.Location = new Point(screen.Bounds.X + (screen.Bounds.Width / 2) - (this.Width / 2), screen.Bounds.Y + (screen.Bounds.Height / 2) - (this.Height / 2));
|
||||
Location = new Point(screen.Bounds.X + (screen.Bounds.Width / 2) - (Width / 2), screen.Bounds.Y + (screen.Bounds.Height / 2) - (Height / 2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!positioned) {
|
||||
this.Location = new Point(Cursor.Position.X - this.Width / 2, Cursor.Position.Y - this.Height / 2);
|
||||
Location = new Point(Cursor.Position.X - Width / 2, Cursor.Position.Y - Height / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +84,7 @@ namespace GreenshotPlugin.Controls {
|
|||
private void Timer_checkforcloseTick(object sender, EventArgs e) {
|
||||
if (shouldClose) {
|
||||
timer_checkforclose.Stop();
|
||||
this.BeginInvoke(new EventHandler( delegate {this.Close();}));
|
||||
BeginInvoke(new EventHandler( delegate {Close();}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
|
||||
public GreenshotComboBox() {
|
||||
this.SelectedIndexChanged += delegate {
|
||||
SelectedIndexChanged += delegate {
|
||||
StoreSelectedEnum();
|
||||
};
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace GreenshotPlugin.Controls {
|
|||
public void SetValue(Enum currentValue) {
|
||||
if (currentValue != null) {
|
||||
selectedEnum = currentValue;
|
||||
this.SelectedItem = Language.Translate(currentValue);
|
||||
SelectedItem = Language.Translate(currentValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,10 +67,10 @@ namespace GreenshotPlugin.Controls {
|
|||
this.enumType = enumType;
|
||||
|
||||
var availableValues = Enum.GetValues(enumType);
|
||||
this.Items.Clear();
|
||||
Items.Clear();
|
||||
string enumTypeName = enumType.Name;
|
||||
foreach (var enumValue in availableValues) {
|
||||
this.Items.Add(Language.Translate((Enum)enumValue));
|
||||
Items.Add(Language.Translate((Enum)enumValue));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
private void StoreSelectedEnum() {
|
||||
string enumTypeName = enumType.Name;
|
||||
string selectedValue = this.SelectedItem as string;
|
||||
string selectedValue = SelectedItem as string;
|
||||
var availableValues = Enum.GetValues(enumType);
|
||||
object returnValue = null;
|
||||
|
||||
|
|
|
@ -27,13 +27,14 @@ using Greenshot.IniFile;
|
|||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.IO;
|
||||
using log4net;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
/// This form is used for automatically binding the elements of the form to the language
|
||||
/// </summary>
|
||||
public class GreenshotForm : Form, IGreenshotLanguageBindable {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(GreenshotForm));
|
||||
private static ILog LOG = LogManager.GetLogger(typeof(GreenshotForm));
|
||||
protected static CoreConfiguration coreConfiguration;
|
||||
private static IDictionary<Type, FieldInfo[]> reflectionCache = new Dictionary<Type, FieldInfo[]>();
|
||||
private IComponentChangeService m_changeService;
|
||||
|
@ -87,7 +88,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// Code to initialize the language etc during design time
|
||||
/// </summary>
|
||||
protected void InitializeForDesigner() {
|
||||
if (this.DesignMode) {
|
||||
if (DesignMode) {
|
||||
designTimeControls = new Dictionary<string, Control>();
|
||||
designTimeToolStripItems = new Dictionary<string, ToolStripItem>();
|
||||
try {
|
||||
|
@ -97,7 +98,7 @@ namespace GreenshotPlugin.Controls {
|
|||
// Language.AddLanguageFilePath(@"C:\Greenshot\Greenshot\Languages");
|
||||
|
||||
// this "type"
|
||||
Assembly currentAssembly = this.GetType().Assembly;
|
||||
Assembly currentAssembly = GetType().Assembly;
|
||||
string assemblyPath = typeResService.GetPathOfAssembly(currentAssembly.GetName());
|
||||
string assemblyDirectory = Path.GetDirectoryName(assemblyPath);
|
||||
if (!Language.AddLanguageFilePath(Path.Combine(assemblyDirectory, @"..\..\Greenshot\Languages\"))) {
|
||||
|
@ -117,7 +118,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e) {
|
||||
if (this.DesignMode) {
|
||||
if (DesignMode) {
|
||||
if (!isDesignModeLanguageSet) {
|
||||
isDesignModeLanguageSet = true;
|
||||
try {
|
||||
|
@ -130,7 +131,7 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e) {
|
||||
if (!this.DesignMode) {
|
||||
if (!DesignMode) {
|
||||
if (!applyLanguageManually) {
|
||||
ApplyLanguage();
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnClosed(EventArgs e) {
|
||||
if (!this.DesignMode && !storeFieldsManually) {
|
||||
if (!DesignMode && !storeFieldsManually) {
|
||||
if (DialogResult == DialogResult.OK) {
|
||||
LOG.Info("Form was closed with OK: storing field values.");
|
||||
StoreFields();
|
||||
|
@ -267,7 +268,7 @@ namespace GreenshotPlugin.Controls {
|
|||
applyTo.Text = langString;
|
||||
return;
|
||||
}
|
||||
if (!this.DesignMode) {
|
||||
if (!DesignMode) {
|
||||
LOG.DebugFormat("Greenshot control without language key: {0}", applyTo.Name);
|
||||
}
|
||||
}
|
||||
|
@ -331,15 +332,15 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
protected void ApplyLanguage() {
|
||||
string langString = null;
|
||||
this.SuspendLayout();
|
||||
SuspendLayout();
|
||||
try {
|
||||
// Set title of the form
|
||||
if (!string.IsNullOrEmpty(LanguageKey) && Language.TryGetString(LanguageKey, out langString)) {
|
||||
this.Text = langString;
|
||||
Text = langString;
|
||||
}
|
||||
|
||||
// Reset the text values for all GreenshotControls
|
||||
foreach (FieldInfo field in GetCachedFields(this.GetType())) {
|
||||
foreach (FieldInfo field in GetCachedFields(GetType())) {
|
||||
Object controlObject = field.GetValue(this);
|
||||
if (controlObject == null) {
|
||||
LOG.DebugFormat("No value: {0}", field.Name);
|
||||
|
@ -367,7 +368,7 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
}
|
||||
} finally {
|
||||
this.ResumeLayout();
|
||||
ResumeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -388,7 +389,7 @@ namespace GreenshotPlugin.Controls {
|
|||
applyTo.Text = langString;
|
||||
return;
|
||||
}
|
||||
if (!this.DesignMode) {
|
||||
if (!DesignMode) {
|
||||
LOG.DebugFormat("Greenshot control without language key: {0}", applyTo.Name);
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +399,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// Fill all GreenshotControls with the values from the configuration
|
||||
/// </summary>
|
||||
protected void FillFields() {
|
||||
foreach (FieldInfo field in GetCachedFields(this.GetType())) {
|
||||
foreach (FieldInfo field in GetCachedFields(GetType())) {
|
||||
Object controlObject = field.GetValue(this);
|
||||
if (controlObject == null) {
|
||||
continue;
|
||||
|
@ -466,7 +467,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
protected void StoreFields() {
|
||||
bool iniDirty = false;
|
||||
foreach (FieldInfo field in GetCachedFields(this.GetType())) {
|
||||
foreach (FieldInfo field in GetCachedFields(GetType())) {
|
||||
Object controlObject = field.GetValue(this);
|
||||
if (controlObject == null) {
|
||||
continue;
|
||||
|
|
|
@ -26,6 +26,7 @@ using System.Text;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using Greenshot.Plugin;
|
||||
using log4net;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
|
@ -34,7 +35,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// But is modified to fit in Greenshot, and have localized support
|
||||
/// </summary>
|
||||
public class HotkeyControl : GreenshotTextBox {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(HotkeyControl));
|
||||
private static ILog LOG = LogManager.GetLogger(typeof(HotkeyControl));
|
||||
|
||||
// Holds the list of hotkeys
|
||||
private static Dictionary<int, HotKeyHandler> keyHandlers = new Dictionary<int, HotKeyHandler>();
|
||||
|
@ -120,13 +121,13 @@ namespace GreenshotPlugin.Controls {
|
|||
/// Creates a new HotkeyControl
|
||||
/// </summary>
|
||||
public HotkeyControl() {
|
||||
this.ContextMenu = dummy; // Disable right-clicking
|
||||
this.Text = "None";
|
||||
ContextMenu = dummy; // Disable right-clicking
|
||||
Text = "None";
|
||||
|
||||
// Handle events that occurs when keys are pressed
|
||||
this.KeyPress += new KeyPressEventHandler(HotkeyControl_KeyPress);
|
||||
this.KeyUp += new KeyEventHandler(HotkeyControl_KeyUp);
|
||||
this.KeyDown += new KeyEventHandler(HotkeyControl_KeyDown);
|
||||
KeyPress += new KeyPressEventHandler(HotkeyControl_KeyPress);
|
||||
KeyUp += new KeyEventHandler(HotkeyControl_KeyUp);
|
||||
KeyDown += new KeyEventHandler(HotkeyControl_KeyDown);
|
||||
|
||||
// Fill the ArrayLists that contain all invalid hotkey combinations
|
||||
needNonShiftModifier = new ArrayList();
|
||||
|
@ -183,8 +184,8 @@ namespace GreenshotPlugin.Controls {
|
|||
/// Resets this hotkey control to None
|
||||
/// </summary>
|
||||
public new void Clear() {
|
||||
this.Hotkey = Keys.None;
|
||||
this.HotkeyModifiers = Keys.None;
|
||||
Hotkey = Keys.None;
|
||||
HotkeyModifiers = Keys.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -197,8 +198,8 @@ namespace GreenshotPlugin.Controls {
|
|||
ResetHotkey();
|
||||
return;
|
||||
} else {
|
||||
this._modifiers = e.Modifiers;
|
||||
this._hotkey = e.KeyCode;
|
||||
_modifiers = e.Modifiers;
|
||||
_hotkey = e.KeyCode;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
@ -210,12 +211,12 @@ namespace GreenshotPlugin.Controls {
|
|||
void HotkeyControl_KeyUp(object sender, KeyEventArgs e) {
|
||||
// Somehow the PrintScreen only comes as a keyup, therefore we handle it here.
|
||||
if (e.KeyCode == Keys.PrintScreen) {
|
||||
this._modifiers = e.Modifiers;
|
||||
this._hotkey = e.KeyCode;
|
||||
_modifiers = e.Modifiers;
|
||||
_hotkey = e.KeyCode;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
if (this._hotkey == Keys.None && Control.ModifierKeys == Keys.None) {
|
||||
if (_hotkey == Keys.None && ModifierKeys == Keys.None) {
|
||||
ResetHotkey();
|
||||
return;
|
||||
}
|
||||
|
@ -251,8 +252,8 @@ namespace GreenshotPlugin.Controls {
|
|||
/// Clears the current hotkey and resets the TextBox
|
||||
/// </summary>
|
||||
public void ResetHotkey() {
|
||||
this._hotkey = Keys.None;
|
||||
this._modifiers = Keys.None;
|
||||
_hotkey = Keys.None;
|
||||
_modifiers = Keys.None;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
|
@ -261,10 +262,10 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
public Keys Hotkey {
|
||||
get {
|
||||
return this._hotkey;
|
||||
return _hotkey;
|
||||
}
|
||||
set {
|
||||
this._hotkey = value;
|
||||
_hotkey = value;
|
||||
Redraw(true);
|
||||
}
|
||||
}
|
||||
|
@ -273,8 +274,8 @@ namespace GreenshotPlugin.Controls {
|
|||
/// Used to get/set the hotkey (e.g. Keys.A)
|
||||
/// </summary>
|
||||
public void SetHotkey(string hotkey) {
|
||||
this._hotkey = HotkeyFromString(hotkey);
|
||||
this._modifiers = HotkeyModifiersFromString(hotkey);
|
||||
_hotkey = HotkeyFromString(hotkey);
|
||||
_modifiers = HotkeyModifiersFromString(hotkey);
|
||||
Redraw(true);
|
||||
}
|
||||
|
||||
|
@ -283,10 +284,10 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
public Keys HotkeyModifiers {
|
||||
get {
|
||||
return this._modifiers;
|
||||
return _modifiers;
|
||||
}
|
||||
set {
|
||||
this._modifiers = value;
|
||||
_modifiers = value;
|
||||
Redraw(true);
|
||||
}
|
||||
}
|
||||
|
@ -304,52 +305,52 @@ namespace GreenshotPlugin.Controls {
|
|||
/// <param name="bCalledProgramatically">Specifies whether this function was called by the Hotkey/HotkeyModifiers properties or by the user.</param>
|
||||
private void Redraw(bool bCalledProgramatically) {
|
||||
// No hotkey set
|
||||
if (this._hotkey == Keys.None) {
|
||||
this.Text = "";
|
||||
if (_hotkey == Keys.None) {
|
||||
Text = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// LWin/RWin doesn't work as hotkeys (neither do they work as modifier keys in .NET 2.0)
|
||||
if (this._hotkey == Keys.LWin || this._hotkey == Keys.RWin) {
|
||||
this.Text = "";
|
||||
if (_hotkey == Keys.LWin || _hotkey == Keys.RWin) {
|
||||
Text = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// Only validate input if it comes from the user
|
||||
if (bCalledProgramatically == false) {
|
||||
// No modifier or shift only, AND a hotkey that needs another modifier
|
||||
if ((this._modifiers == Keys.Shift || this._modifiers == Keys.None) && this.needNonShiftModifier.Contains((int)this._hotkey)) {
|
||||
if (this._modifiers == Keys.None) {
|
||||
if ((_modifiers == Keys.Shift || _modifiers == Keys.None) && needNonShiftModifier.Contains((int)_hotkey)) {
|
||||
if (_modifiers == Keys.None) {
|
||||
// Set Ctrl+Alt as the modifier unless Ctrl+Alt+<key> won't work...
|
||||
if (needNonAltGrModifier.Contains((int)this._hotkey) == false) {
|
||||
this._modifiers = Keys.Alt | Keys.Control;
|
||||
if (needNonAltGrModifier.Contains((int)_hotkey) == false) {
|
||||
_modifiers = Keys.Alt | Keys.Control;
|
||||
} else {
|
||||
// ... in that case, use Shift+Alt instead.
|
||||
this._modifiers = Keys.Alt | Keys.Shift;
|
||||
_modifiers = Keys.Alt | Keys.Shift;
|
||||
}
|
||||
} else {
|
||||
// User pressed Shift and an invalid key (e.g. a letter or a number),
|
||||
// that needs another set of modifier keys
|
||||
this._hotkey = Keys.None;
|
||||
this.Text = "";
|
||||
_hotkey = Keys.None;
|
||||
Text = "";
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Check all Ctrl+Alt keys
|
||||
if ((this._modifiers == (Keys.Alt | Keys.Control)) && this.needNonAltGrModifier.Contains((int)this._hotkey)) {
|
||||
if ((_modifiers == (Keys.Alt | Keys.Control)) && needNonAltGrModifier.Contains((int)_hotkey)) {
|
||||
// Ctrl+Alt+4 etc won't work; reset hotkey and tell the user
|
||||
this._hotkey = Keys.None;
|
||||
this.Text = "";
|
||||
_hotkey = Keys.None;
|
||||
Text = "";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// I have no idea why this is needed, but it is. Without this code, pressing only Ctrl
|
||||
// will show up as "Control + ControlKey", etc.
|
||||
if (this._hotkey == Keys.Menu /* Alt */ || this._hotkey == Keys.ShiftKey || this._hotkey == Keys.ControlKey) {
|
||||
this._hotkey = Keys.None;
|
||||
if (_hotkey == Keys.Menu /* Alt */ || _hotkey == Keys.ShiftKey || _hotkey == Keys.ControlKey) {
|
||||
_hotkey = Keys.None;
|
||||
}
|
||||
this.Text = HotkeyToLocalizedString(this._modifiers, this._hotkey);
|
||||
Text = HotkeyToLocalizedString(_modifiers, _hotkey);
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
|
|
|
@ -27,13 +27,14 @@ using System.Windows.Forms;
|
|||
using System.Web;
|
||||
using System.Collections.Specialized;
|
||||
using GreenshotPlugin.Core;
|
||||
using log4net;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
/// The OAuthLoginForm is used to allow the user to authorize Greenshot with an "Oauth" application
|
||||
/// </summary>
|
||||
public partial class OAuthLoginForm : Form {
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OAuthLoginForm));
|
||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(OAuthLoginForm));
|
||||
private string callbackUrl = null;
|
||||
private IDictionary<string, string> callbackParameters = null;
|
||||
|
||||
|
@ -50,17 +51,17 @@ namespace GreenshotPlugin.Controls {
|
|||
public OAuthLoginForm(string browserTitle, Size size, string authorizationLink, string callbackUrl) {
|
||||
this.callbackUrl = callbackUrl;
|
||||
InitializeComponent();
|
||||
this.ClientSize = size;
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
this.Text = browserTitle;
|
||||
this.addressTextBox.Text = authorizationLink;
|
||||
ClientSize = size;
|
||||
Icon = GreenshotResources.getGreenshotIcon();
|
||||
Text = browserTitle;
|
||||
addressTextBox.Text = authorizationLink;
|
||||
|
||||
// The script errors are suppressed by using the ExtendedWebBrowser
|
||||
browser.ScriptErrorsSuppressed = false;
|
||||
browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
|
||||
browser.Navigate(new Uri(authorizationLink));
|
||||
|
||||
WindowDetails.ToForeground(this.Handle);
|
||||
WindowDetails.ToForeground(Handle);
|
||||
}
|
||||
|
||||
private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
|
||||
|
@ -69,7 +70,7 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
|
||||
LOG.DebugFormat("Navigating to url: {0}", browser.Url);
|
||||
this.addressTextBox.Text = e.Url.ToString();
|
||||
addressTextBox.Text = e.Url.ToString();
|
||||
}
|
||||
|
||||
private void browser_Navigated(object sender, WebBrowserNavigatedEventArgs e) {
|
||||
|
|
|
@ -23,13 +23,14 @@ using System.Drawing;
|
|||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using GreenshotPlugin.Core;
|
||||
using log4net;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
/// Description of PleaseWaitForm.
|
||||
/// </summary>
|
||||
public partial class PleaseWaitForm : Form {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PleaseWaitForm));
|
||||
private static ILog LOG = LogManager.GetLogger(typeof(PleaseWaitForm));
|
||||
private Thread waitFor = null;
|
||||
private string title;
|
||||
public PleaseWaitForm() {
|
||||
|
@ -37,7 +38,7 @@ namespace GreenshotPlugin.Controls {
|
|||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent();
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
Icon = GreenshotResources.getGreenshotIcon();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,9 +62,9 @@ namespace GreenshotPlugin.Controls {
|
|||
/// <param name="waitDelegate">delegate { with your code }</param>
|
||||
public void ShowAndWait(string title, string text, ThreadStart waitDelegate) {
|
||||
this.title = title;
|
||||
this.Text = title;
|
||||
this.label_pleasewait.Text = text;
|
||||
this.cancelButton.Text = Language.GetString("CANCEL");
|
||||
Text = title;
|
||||
label_pleasewait.Text = text;
|
||||
cancelButton.Text = Language.GetString("CANCEL");
|
||||
|
||||
// Make sure the form is shown.
|
||||
Show();
|
||||
|
|
|
@ -41,20 +41,20 @@ namespace GreenshotPlugin.Controls {
|
|||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent();
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
Icon = GreenshotResources.getGreenshotIcon();
|
||||
|
||||
this.checkBox_reduceColors.Checked = Settings.ReduceColors;
|
||||
this.trackBarJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
|
||||
this.trackBarJpegQuality.Value = Settings.JPGQuality;
|
||||
this.textBoxJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
|
||||
this.textBoxJpegQuality.Text = Settings.JPGQuality.ToString();
|
||||
checkBox_reduceColors.Checked = Settings.ReduceColors;
|
||||
trackBarJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
|
||||
trackBarJpegQuality.Value = Settings.JPGQuality;
|
||||
textBoxJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
|
||||
textBoxJpegQuality.Text = Settings.JPGQuality.ToString();
|
||||
WindowDetails.ToForeground(Handle);
|
||||
}
|
||||
|
||||
void Button_okClick(object sender, System.EventArgs e) {
|
||||
Settings.JPGQuality = this.trackBarJpegQuality.Value;
|
||||
void Button_okClick(object sender, EventArgs e) {
|
||||
Settings.JPGQuality = trackBarJpegQuality.Value;
|
||||
Settings.ReduceColors = checkBox_reduceColors.Checked;
|
||||
if (this.checkbox_dontaskagain.Checked) {
|
||||
if (checkbox_dontaskagain.Checked) {
|
||||
conf.OutputFileJpegQuality = Settings.JPGQuality;
|
||||
conf.OutputFilePromptQuality = false;
|
||||
conf.OutputFileReduceColors = Settings.ReduceColors;
|
||||
|
@ -62,7 +62,7 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
}
|
||||
|
||||
void TrackBarJpegQualityScroll(object sender, System.EventArgs e) {
|
||||
void TrackBarJpegQualityScroll(object sender, EventArgs e) {
|
||||
textBoxJpegQuality.Text = trackBarJpegQuality.Value.ToString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ using System.Windows.Forms;
|
|||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Core;
|
||||
using Greenshot.IniFile;
|
||||
using log4net;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
|
@ -32,7 +33,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// For some reason SFD is sealed :(
|
||||
/// </summary>
|
||||
public class SaveImageFileDialog : IDisposable {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(SaveImageFileDialog));
|
||||
private static ILog LOG = LogManager.GetLogger(typeof(SaveImageFileDialog));
|
||||
private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
|
||||
protected SaveFileDialog saveFileDialog;
|
||||
private FilterOption[] filterOptions;
|
||||
|
@ -137,7 +138,7 @@ namespace GreenshotPlugin.Controls {
|
|||
get {
|
||||
string fn = saveFileDialog.FileName;
|
||||
// if the filename contains a valid extension, which is the same like the selected filter item's extension, the filename is okay
|
||||
if(fn.EndsWith(Extension,System.StringComparison.CurrentCultureIgnoreCase)) return fn;
|
||||
if(fn.EndsWith(Extension,StringComparison.CurrentCultureIgnoreCase)) return fn;
|
||||
// otherwise we just add the selected filter item's extension
|
||||
else return fn + "." + Extension;
|
||||
}
|
||||
|
@ -156,7 +157,7 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
set {
|
||||
for(int i=0; i<filterOptions.Length; i++) {
|
||||
if(value.Equals(filterOptions[i].Extension, System.StringComparison.CurrentCultureIgnoreCase)) {
|
||||
if(value.Equals(filterOptions[i].Extension, StringComparison.CurrentCultureIgnoreCase)) {
|
||||
saveFileDialog.FilterIndex = i + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
|
||||
// cleanup at close
|
||||
this.FormClosing += delegate {
|
||||
FormClosing += delegate {
|
||||
UnregisterThumbnail();
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue