mirror of
https://github.com/greenshot/greenshot
synced 2025-07-15 01:23:47 -07:00
This commit is made due to BUG-1775. Although it might not fix it, it ensures that every window has an icon and only than when it loaded. Also added improved error handling.
This commit is contained in:
parent
eed5b66116
commit
7938ab5dad
29 changed files with 32 additions and 34 deletions
|
@ -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;
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace Greenshot.Forms {
|
|||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent();
|
||||
Icon = GreenshotResources.getGreenshotIcon();
|
||||
WindowDetails.ToForeground(Handle);
|
||||
}
|
||||
|
||||
|
|
2
Greenshot/Forms/CaptureForm.Designer.cs
generated
2
Greenshot/Forms/CaptureForm.Designer.cs
generated
|
@ -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);
|
||||
|
|
|
@ -123,6 +123,7 @@ namespace Greenshot.Forms {
|
|||
LOG.Debug("Closing captureform");
|
||||
WindowDetails.UnregisterIgnoreHandle(Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This creates the capture form
|
||||
/// </summary>
|
||||
|
@ -130,7 +131,7 @@ namespace Greenshot.Forms {
|
|||
/// <param name="windows"></param>
|
||||
public CaptureForm(ICapture capture, List<WindowDetails> 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();
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace Greenshot.Forms {
|
|||
public DropShadowSettingsForm(DropShadowEffect effect) {
|
||||
this.effect = effect;
|
||||
InitializeComponent();
|
||||
this.Icon = GreenshotResources.getGreenshotIcon();
|
||||
ShowSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -30,7 +30,6 @@ namespace Greenshot.Forms {
|
|||
public TornEdgeSettingsForm(TornEdgeEffect effect) {
|
||||
this.effect = effect;
|
||||
InitializeComponent();
|
||||
this.Icon = GreenshotResources.getGreenshotIcon();
|
||||
ShowSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -39,8 +39,6 @@ namespace GreenshotBoxPlugin {
|
|||
InitializeComponent();
|
||||
AcceptButton = buttonOK;
|
||||
CancelButton = buttonCancel;
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* 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 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace ExternalCommand {
|
|||
|
||||
public SettingsFormDetail(string commando) {
|
||||
InitializeComponent();
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
AcceptButton = buttonOk;
|
||||
CancelButton = buttonCancel;
|
||||
this.commando = commando;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* 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 System;
|
||||
using GreenshotPlugin.Controls;
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace GreenshotFlickrPlugin {
|
|||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent();
|
||||
Icon = GreenshotResources.getGreenshotIcon();
|
||||
CancelButton = buttonCancel;
|
||||
AcceptButton = buttonOK;
|
||||
}
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
* 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 System;
|
||||
using GreenshotPlugin.Controls;
|
||||
|
||||
namespace GreenshotImgurPlugin {
|
||||
/// <summary>
|
||||
/// This class is needed for design-time resolving of the language files
|
||||
/// </summary>
|
||||
public class ImgurForm : GreenshotPlugin.Controls.GreenshotForm {
|
||||
public class ImgurForm : GreenshotForm {
|
||||
public ImgurForm() : base() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace GreenshotImgurPlugin {
|
|||
InitializeComponent();
|
||||
CancelButton = buttonCancel;
|
||||
AcceptButton = buttonOK;
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
|
||||
ImgurUtils.LoadHistory();
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace GreenshotJiraPlugin {
|
|||
InitializeComponent();
|
||||
AcceptButton = buttonOK;
|
||||
CancelButton = buttonCancel;
|
||||
Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using GreenshotPlugin.Controls;
|
||||
|
||||
namespace GreenshotOCR {
|
||||
/// <summary>
|
||||
/// This class is needed for design-time resolving of the language files
|
||||
/// </summary>
|
||||
public class OCRForm : GreenshotPlugin.Controls.GreenshotForm {
|
||||
public class OCRForm : GreenshotForm {
|
||||
public OCRForm() : base() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace GreenshotOCR {
|
|||
InitializeComponent();
|
||||
AcceptButton = buttonOK;
|
||||
CancelButton = buttonCancel;
|
||||
this.Icon = GreenshotResources.getGreenshotIcon();
|
||||
|
||||
comboBox_languages.Items.Clear();
|
||||
int index=0;
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace GreenshotPhotobucketPlugin {
|
|||
InitializeComponent();
|
||||
AcceptButton = buttonOK;
|
||||
CancelButton = buttonCancel;
|
||||
Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace GreenshotPicasaPlugin {
|
|||
InitializeComponent();
|
||||
CancelButton = buttonCancel;
|
||||
AcceptButton = buttonOK;
|
||||
Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,17 +18,20 @@
|
|||
* 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 System;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Core;
|
||||
using GreenshotPlugin.UnmanagedHelpers;
|
||||
using Greenshot.IniFile;
|
||||
using log4net;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
/// <summary>
|
||||
/// Extend this Form to have the possibility for animations on your form
|
||||
/// </summary>
|
||||
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 {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void timer_Tick(object sender, EventArgs e) {
|
||||
try {
|
||||
Animate();
|
||||
} catch (Exception ex) {
|
||||
LOG.Warn("An exception occured while animating:", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue