diff --git a/Greenshot/Forms/AboutForm.cs b/Greenshot/Forms/AboutForm.cs index 1fef03d31..64934dea0 100644 --- a/Greenshot/Forms/AboutForm.cs +++ b/Greenshot/Forms/AboutForm.cs @@ -146,9 +146,6 @@ namespace Greenshot { // Only use double-buffering when we are NOT in a Terminal Server session DoubleBuffered = !isTerminalServerSession; - // Not needed for a Tool Window, but still for the task manager it's important - Icon = GreenshotResources.getGreenshotIcon(); - // Use the self drawn image, first we create the background to be the backcolor (as we animate from this) gBitmap = ImageHelper.CreateEmpty(90, 90, PixelFormat.Format24bppRgb, BackColor, 96, 96); pictureBox1.Image = gBitmap; diff --git a/Greenshot/Forms/BugReportForm.cs b/Greenshot/Forms/BugReportForm.cs index 8850a4ea8..dd1112acf 100644 --- a/Greenshot/Forms/BugReportForm.cs +++ b/Greenshot/Forms/BugReportForm.cs @@ -31,7 +31,6 @@ namespace Greenshot.Forms { // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); - Icon = GreenshotResources.getGreenshotIcon(); WindowDetails.ToForeground(Handle); } diff --git a/Greenshot/Forms/CaptureForm.Designer.cs b/Greenshot/Forms/CaptureForm.Designer.cs index 2722f29b0..72deb4ffd 100644 --- a/Greenshot/Forms/CaptureForm.Designer.cs +++ b/Greenshot/Forms/CaptureForm.Designer.cs @@ -61,7 +61,7 @@ namespace Greenshot.Forms { this.Cursor = System.Windows.Forms.Cursors.Cross; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "CaptureForm"; - this.ShowIcon = false; + this.ShowIcon = true; this.ShowInTaskbar = false; this.TopMost = true; this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CaptureFormKeyDown); diff --git a/Greenshot/Forms/CaptureForm.cs b/Greenshot/Forms/CaptureForm.cs index e16291510..998b27618 100644 --- a/Greenshot/Forms/CaptureForm.cs +++ b/Greenshot/Forms/CaptureForm.cs @@ -123,6 +123,7 @@ namespace Greenshot.Forms { LOG.Debug("Closing captureform"); WindowDetails.UnregisterIgnoreHandle(Handle); } + /// /// This creates the capture form /// @@ -130,7 +131,7 @@ namespace Greenshot.Forms { /// public CaptureForm(ICapture capture, List windows) { if (_currentForm != null) { - LOG.Debug("Found currentForm, Closing already opened CaptureForm"); + LOG.Warn("Found currentForm, Closing already opened CaptureForm"); _currentForm.Close(); _currentForm = null; Application.DoEvents(); diff --git a/Greenshot/Forms/DropShadowSettingsForm.cs b/Greenshot/Forms/DropShadowSettingsForm.cs index 2eee65565..1952c6058 100644 --- a/Greenshot/Forms/DropShadowSettingsForm.cs +++ b/Greenshot/Forms/DropShadowSettingsForm.cs @@ -31,7 +31,6 @@ namespace Greenshot.Forms { public DropShadowSettingsForm(DropShadowEffect effect) { this.effect = effect; InitializeComponent(); - this.Icon = GreenshotResources.getGreenshotIcon(); ShowSettings(); } diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs index 1562d642d..c5cc2ddba 100644 --- a/Greenshot/Forms/ImageEditorForm.cs +++ b/Greenshot/Forms/ImageEditorForm.cs @@ -162,8 +162,6 @@ namespace Greenshot { } private void updateUI() { - Icon = GreenshotResources.getGreenshotIcon(); - // Disable access to the settings, for feature #3521446 preferencesToolStripMenuItem.Visible = !coreConfiguration.DisableSettings; toolStripSeparator12.Visible = !coreConfiguration.DisableSettings; diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs index 81e7e9165..5e91d2147 100644 --- a/Greenshot/Forms/MainForm.cs +++ b/Greenshot/Forms/MainForm.cs @@ -359,7 +359,6 @@ namespace Greenshot { throw; } notifyIcon.Icon = GreenshotResources.getGreenshotIcon(); - Icon = GreenshotResources.getGreenshotIcon(); // Disable access to the settings, for feature #3521446 contextmenu_settings.Visible = !_conf.DisableSettings; diff --git a/Greenshot/Forms/PrintOptionsDialog.cs b/Greenshot/Forms/PrintOptionsDialog.cs index 87e6fc7bb..1175bf1dc 100644 --- a/Greenshot/Forms/PrintOptionsDialog.cs +++ b/Greenshot/Forms/PrintOptionsDialog.cs @@ -33,7 +33,6 @@ namespace Greenshot.Forms { // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); - Icon = GreenshotResources.getGreenshotIcon(); checkbox_dontaskagain.Checked = false; } diff --git a/Greenshot/Forms/ResizeSettingsForm.cs b/Greenshot/Forms/ResizeSettingsForm.cs index c3441be33..db8cac328 100644 --- a/Greenshot/Forms/ResizeSettingsForm.cs +++ b/Greenshot/Forms/ResizeSettingsForm.cs @@ -37,7 +37,6 @@ namespace Greenshot.Forms { public ResizeSettingsForm(ResizeEffect effect) { this.effect = effect; InitializeComponent(); - this.Icon = GreenshotResources.getGreenshotIcon(); value_pixel = Language.GetString("editor_resize_pixel"); value_percent = Language.GetString("editor_resize_percent"); combobox_width.Items.Add(value_pixel); diff --git a/Greenshot/Forms/SettingsForm.cs b/Greenshot/Forms/SettingsForm.cs index 819c3d573..b64fdfaf0 100644 --- a/Greenshot/Forms/SettingsForm.cs +++ b/Greenshot/Forms/SettingsForm.cs @@ -57,7 +57,6 @@ namespace Greenshot { protected override void OnLoad(EventArgs e) { base.OnLoad(e); - Icon = GreenshotResources.getGreenshotIcon(); // Fix for Vista/XP differences if (Environment.OSVersion.Version.Major >= 6) { diff --git a/Greenshot/Forms/TornEdgeSettingsForm.cs b/Greenshot/Forms/TornEdgeSettingsForm.cs index edd57a266..63bae471a 100644 --- a/Greenshot/Forms/TornEdgeSettingsForm.cs +++ b/Greenshot/Forms/TornEdgeSettingsForm.cs @@ -30,7 +30,6 @@ namespace Greenshot.Forms { public TornEdgeSettingsForm(TornEdgeEffect effect) { this.effect = effect; InitializeComponent(); - this.Icon = GreenshotResources.getGreenshotIcon(); ShowSettings(); } diff --git a/Greenshot/Helpers/CaptureHelper.cs b/Greenshot/Helpers/CaptureHelper.cs index 943a00d26..301b97c14 100644 --- a/Greenshot/Helpers/CaptureHelper.cs +++ b/Greenshot/Helpers/CaptureHelper.cs @@ -967,7 +967,13 @@ namespace Greenshot.Helpers { //} using (CaptureForm captureForm = new CaptureForm(_capture, _windows)) { - DialogResult result = captureForm.ShowDialog(); + // Make sure the form is hidden after showing, even if an exception occurs, so all errors will be shown + DialogResult result = DialogResult.Cancel; + try { + result = captureForm.ShowDialog(MainForm.Instance); + } finally { + captureForm.Hide(); + } if (result == DialogResult.OK) { _selectedCaptureWindow = captureForm.SelectedCaptureWindow; _captureRect = captureForm.CaptureRectangle; @@ -975,11 +981,11 @@ namespace Greenshot.Helpers { if (_selectedCaptureWindow != null) { _capture.CaptureDetails.Title = _selectedCaptureWindow.Text; } - + if (_captureRect.Height > 0 && _captureRect.Width > 0) { // Take the captureRect, this already is specified as bitmap coordinates _capture.Crop(_captureRect); - + // save for re-capturing later and show recapture context menu option // Important here is that the location needs to be offsetted back to screen coordinates! Rectangle tmpRectangle = _captureRect; diff --git a/GreenshotBoxPlugin/Forms/SettingsForm.cs b/GreenshotBoxPlugin/Forms/SettingsForm.cs index 2e860a665..07b32373d 100644 --- a/GreenshotBoxPlugin/Forms/SettingsForm.cs +++ b/GreenshotBoxPlugin/Forms/SettingsForm.cs @@ -39,8 +39,6 @@ namespace GreenshotBoxPlugin { InitializeComponent(); AcceptButton = buttonOK; CancelButton = buttonCancel; - this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); - } } } diff --git a/GreenshotDropboxPlugin/Forms/SettingsForm.cs b/GreenshotDropboxPlugin/Forms/SettingsForm.cs index 99d6738b8..280ded7f1 100644 --- a/GreenshotDropboxPlugin/Forms/SettingsForm.cs +++ b/GreenshotDropboxPlugin/Forms/SettingsForm.cs @@ -18,6 +18,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + using System; using System.Windows.Forms; using GreenshotDropboxPlugin.Forms; @@ -39,7 +40,6 @@ namespace GreenshotDropboxPlugin { InitializeComponent(); AcceptButton = buttonOK; CancelButton = buttonCancel; - this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); } } diff --git a/GreenshotExternalCommandPlugin/SettingsForm.cs b/GreenshotExternalCommandPlugin/SettingsForm.cs index 025cdb68e..247e38b59 100644 --- a/GreenshotExternalCommandPlugin/SettingsForm.cs +++ b/GreenshotExternalCommandPlugin/SettingsForm.cs @@ -37,7 +37,6 @@ namespace ExternalCommand { // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); - this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); AcceptButton = buttonOk; CancelButton = buttonCancel; UpdateView(); diff --git a/GreenshotExternalCommandPlugin/SettingsFormDetail.cs b/GreenshotExternalCommandPlugin/SettingsFormDetail.cs index 1fff7fc62..ae9d4b030 100644 --- a/GreenshotExternalCommandPlugin/SettingsFormDetail.cs +++ b/GreenshotExternalCommandPlugin/SettingsFormDetail.cs @@ -38,7 +38,6 @@ namespace ExternalCommand { public SettingsFormDetail(string commando) { InitializeComponent(); - this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); AcceptButton = buttonOk; CancelButton = buttonCancel; this.commando = commando; diff --git a/GreenshotFlickrPlugin/Forms/FlickrForm.cs b/GreenshotFlickrPlugin/Forms/FlickrForm.cs index 5aaf18262..59358436e 100644 --- a/GreenshotFlickrPlugin/Forms/FlickrForm.cs +++ b/GreenshotFlickrPlugin/Forms/FlickrForm.cs @@ -18,6 +18,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + using System; using GreenshotPlugin.Controls; diff --git a/GreenshotFlickrPlugin/Forms/SettingsForm.cs b/GreenshotFlickrPlugin/Forms/SettingsForm.cs index 92bd39374..0835e2ea5 100644 --- a/GreenshotFlickrPlugin/Forms/SettingsForm.cs +++ b/GreenshotFlickrPlugin/Forms/SettingsForm.cs @@ -37,7 +37,6 @@ namespace GreenshotFlickrPlugin { // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); - Icon = GreenshotResources.getGreenshotIcon(); CancelButton = buttonCancel; AcceptButton = buttonOK; } diff --git a/GreenshotImgurPlugin/Forms/ImgurForm.cs b/GreenshotImgurPlugin/Forms/ImgurForm.cs index 15de31281..d476f9313 100644 --- a/GreenshotImgurPlugin/Forms/ImgurForm.cs +++ b/GreenshotImgurPlugin/Forms/ImgurForm.cs @@ -18,13 +18,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + using System; +using GreenshotPlugin.Controls; namespace GreenshotImgurPlugin { /// /// This class is needed for design-time resolving of the language files /// - public class ImgurForm : GreenshotPlugin.Controls.GreenshotForm { + public class ImgurForm : GreenshotForm { public ImgurForm() : base() { } } diff --git a/GreenshotImgurPlugin/Forms/ImgurHistory.cs b/GreenshotImgurPlugin/Forms/ImgurHistory.cs index 25c501a1e..597134103 100644 --- a/GreenshotImgurPlugin/Forms/ImgurHistory.cs +++ b/GreenshotImgurPlugin/Forms/ImgurHistory.cs @@ -53,7 +53,6 @@ namespace GreenshotImgurPlugin { // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); - this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); AcceptButton = finishedButton; CancelButton = finishedButton; // Init sorting diff --git a/GreenshotImgurPlugin/Forms/SettingsForm.cs b/GreenshotImgurPlugin/Forms/SettingsForm.cs index bda6270c6..8a35fc06e 100644 --- a/GreenshotImgurPlugin/Forms/SettingsForm.cs +++ b/GreenshotImgurPlugin/Forms/SettingsForm.cs @@ -35,7 +35,6 @@ namespace GreenshotImgurPlugin { InitializeComponent(); CancelButton = buttonCancel; AcceptButton = buttonOK; - this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); ImgurUtils.LoadHistory(); diff --git a/GreenshotJiraPlugin/Forms/SettingsForm.cs b/GreenshotJiraPlugin/Forms/SettingsForm.cs index 383ec7fbf..1ecaecfbf 100644 --- a/GreenshotJiraPlugin/Forms/SettingsForm.cs +++ b/GreenshotJiraPlugin/Forms/SettingsForm.cs @@ -34,7 +34,6 @@ namespace GreenshotJiraPlugin { InitializeComponent(); AcceptButton = buttonOK; CancelButton = buttonCancel; - Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); } } } diff --git a/GreenshotOCRPlugin/OCRForm.cs b/GreenshotOCRPlugin/OCRForm.cs index e7051dccc..f6fe326a2 100644 --- a/GreenshotOCRPlugin/OCRForm.cs +++ b/GreenshotOCRPlugin/OCRForm.cs @@ -19,11 +19,13 @@ * along with this program. If not, see . */ +using GreenshotPlugin.Controls; + namespace GreenshotOCR { /// /// This class is needed for design-time resolving of the language files /// - public class OCRForm : GreenshotPlugin.Controls.GreenshotForm { + public class OCRForm : GreenshotForm { public OCRForm() : base() { } } diff --git a/GreenshotOCRPlugin/SettingsForm.cs b/GreenshotOCRPlugin/SettingsForm.cs index 9d34347c3..88b1d029a 100644 --- a/GreenshotOCRPlugin/SettingsForm.cs +++ b/GreenshotOCRPlugin/SettingsForm.cs @@ -37,7 +37,6 @@ namespace GreenshotOCR { InitializeComponent(); AcceptButton = buttonOK; CancelButton = buttonCancel; - this.Icon = GreenshotResources.getGreenshotIcon(); comboBox_languages.Items.Clear(); int index=0; diff --git a/GreenshotPhotobucketPlugin/Forms/SettingsForm.cs b/GreenshotPhotobucketPlugin/Forms/SettingsForm.cs index 83298e841..560a29b39 100644 --- a/GreenshotPhotobucketPlugin/Forms/SettingsForm.cs +++ b/GreenshotPhotobucketPlugin/Forms/SettingsForm.cs @@ -35,7 +35,6 @@ namespace GreenshotPhotobucketPlugin { InitializeComponent(); AcceptButton = buttonOK; CancelButton = buttonCancel; - Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); } } } diff --git a/GreenshotPicasaPlugin/Forms/SettingsForm.cs b/GreenshotPicasaPlugin/Forms/SettingsForm.cs index 2916a5630..edb7597f0 100644 --- a/GreenshotPicasaPlugin/Forms/SettingsForm.cs +++ b/GreenshotPicasaPlugin/Forms/SettingsForm.cs @@ -38,7 +38,6 @@ namespace GreenshotPicasaPlugin { InitializeComponent(); CancelButton = buttonCancel; AcceptButton = buttonOK; - Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); } } diff --git a/GreenshotPlugin/Controls/AnimatingForm.cs b/GreenshotPlugin/Controls/AnimatingForm.cs index 17897a5c2..17f8baa38 100644 --- a/GreenshotPlugin/Controls/AnimatingForm.cs +++ b/GreenshotPlugin/Controls/AnimatingForm.cs @@ -18,17 +18,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + using System; using System.Windows.Forms; using GreenshotPlugin.Core; using GreenshotPlugin.UnmanagedHelpers; using Greenshot.IniFile; +using log4net; namespace GreenshotPlugin.Controls { /// /// Extend this Form to have the possibility for animations on your form /// public class AnimatingForm : GreenshotForm { + private static readonly ILog LOG = LogManager.GetLogger(typeof(AnimatingForm)); private const int DEFAULT_VREFRESH = 60; private int vRefresh = 0; private Timer timer = null; @@ -110,7 +113,11 @@ namespace GreenshotPlugin.Controls { /// /// void timer_Tick(object sender, EventArgs e) { - Animate(); + try { + Animate(); + } catch (Exception ex) { + LOG.Warn("An exception occured while animating:", ex); + } } /// diff --git a/GreenshotPlugin/Controls/GreenshotForm.cs b/GreenshotPlugin/Controls/GreenshotForm.cs index 62c01bb9f..a872c83c9 100644 --- a/GreenshotPlugin/Controls/GreenshotForm.cs +++ b/GreenshotPlugin/Controls/GreenshotForm.cs @@ -131,6 +131,9 @@ namespace GreenshotPlugin.Controls { } protected override void OnLoad(EventArgs e) { + // Every GreenshotForm should have it's default icon + // And it might not ne needed for a Tool Window, but still for the task manager / switcher it's important + Icon = GreenshotResources.getGreenshotIcon(); if (!DesignMode) { if (!applyLanguageManually) { ApplyLanguage(); @@ -413,7 +416,7 @@ namespace GreenshotPlugin.Controls { if (section != null) { IniValue iniValue = null; if (!section.Values.TryGetValue(configBindable.PropertyName, out iniValue)) { - LOG.WarnFormat("Wrong property '{0}' configured for field '{1}'",configBindable.PropertyName,field.Name); + LOG.DebugFormat("Wrong property '{0}' configured for field '{1}'",configBindable.PropertyName,field.Name); continue; } diff --git a/GreenshotPlugin/Controls/QualityDialog.cs b/GreenshotPlugin/Controls/QualityDialog.cs index 338a396d1..35b9a53d7 100644 --- a/GreenshotPlugin/Controls/QualityDialog.cs +++ b/GreenshotPlugin/Controls/QualityDialog.cs @@ -41,7 +41,6 @@ namespace GreenshotPlugin.Controls { // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); - Icon = GreenshotResources.getGreenshotIcon(); checkBox_reduceColors.Checked = Settings.ReduceColors; trackBarJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);