diff --git a/Greenshot/App.config b/Greenshot/App.config
index 61ebd6224..f15ae706e 100644
--- a/Greenshot/App.config
+++ b/Greenshot/App.config
@@ -4,7 +4,10 @@
-
+
+
+
+
diff --git a/Greenshot/Forms/AboutForm.Designer.cs b/Greenshot/Forms/AboutForm.Designer.cs
index f5018e313..1b35f8699 100644
--- a/Greenshot/Forms/AboutForm.Designer.cs
+++ b/Greenshot/Forms/AboutForm.Designer.cs
@@ -67,7 +67,7 @@ namespace Greenshot.Forms {
//
// lblTitle
//
- this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblTitle.Font = new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTitle.Location = new System.Drawing.Point(108, 12);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(263, 19);
@@ -195,8 +195,11 @@ namespace Greenshot.Forms {
//
// AboutForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ //this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96, 96);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+
this.ClientSize = new System.Drawing.Size(530, 293);
this.Controls.Add(this.lblTranslation);
this.Controls.Add(this.pictureBox1);
diff --git a/Greenshot/Forms/CaptureForm.Designer.cs b/Greenshot/Forms/CaptureForm.Designer.cs
index 124a34d3e..ee3b43b99 100644
--- a/Greenshot/Forms/CaptureForm.Designer.cs
+++ b/Greenshot/Forms/CaptureForm.Designer.cs
@@ -55,8 +55,8 @@ namespace Greenshot.Forms {
//
// CaptureForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(0, 0);
this.Cursor = System.Windows.Forms.Cursors.Cross;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
diff --git a/Greenshot/Forms/DropShadowSettingsForm.Designer.cs b/Greenshot/Forms/DropShadowSettingsForm.Designer.cs
index 5791dee14..ba8e7b3bc 100644
--- a/Greenshot/Forms/DropShadowSettingsForm.Designer.cs
+++ b/Greenshot/Forms/DropShadowSettingsForm.Designer.cs
@@ -105,7 +105,6 @@ namespace Greenshot.Forms {
//
// label3
//
- this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(153, 35);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(14, 13);
@@ -166,7 +165,6 @@ namespace Greenshot.Forms {
//
// labelDarkness
//
- this.labelDarkness.AutoSize = true;
this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
this.labelDarkness.Location = new System.Drawing.Point(12, 73);
this.labelDarkness.Name = "labelDarkness";
@@ -175,7 +173,6 @@ namespace Greenshot.Forms {
//
// labelOffset
//
- this.labelOffset.AutoSize = true;
this.labelOffset.LanguageKey = "editor_dropshadow_offset";
this.labelOffset.Location = new System.Drawing.Point(12, 35);
this.labelOffset.Name = "labelOffset";
@@ -184,7 +181,6 @@ namespace Greenshot.Forms {
//
// labelThickness
//
- this.labelThickness.AutoSize = true;
this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
this.labelThickness.Location = new System.Drawing.Point(12, 9);
this.labelThickness.Name = "labelThickness";
@@ -194,8 +190,8 @@ namespace Greenshot.Forms {
// DropShadowSettingsForm
//
this.AcceptButton = this.buttonOK;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(230, 154);
this.ControlBox = false;
diff --git a/Greenshot/Forms/ImageEditorForm.Designer.cs b/Greenshot/Forms/ImageEditorForm.Designer.cs
index 04da3d0a0..cce905007 100644
--- a/Greenshot/Forms/ImageEditorForm.Designer.cs
+++ b/Greenshot/Forms/ImageEditorForm.Designer.cs
@@ -231,8 +231,8 @@ namespace Greenshot {
//
// topToolStripContainer
//
- this.topToolStripContainer.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.topToolStripContainer.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.topToolStripContainer.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.topToolStripContainer.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
//
// topToolStripContainer.BottomToolStripPanel
//
@@ -1037,7 +1037,6 @@ namespace Greenshot {
//
// propertiesToolStrip
//
- this.propertiesToolStrip.AutoSize = false;
this.propertiesToolStrip.ClickThrough = true;
this.propertiesToolStrip.ImageScalingSize = coreConfiguration.ScaledIconSize;
this.propertiesToolStrip.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -1225,7 +1224,6 @@ namespace Greenshot {
// fontFamilyComboBox
//
this.fontFamilyComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.fontFamilyComboBox.AutoSize = false;
this.fontFamilyComboBox.MaxDropDownItems = 20;
this.fontFamilyComboBox.Name = "fontFamilyComboBox";
this.fontFamilyComboBox.Size = new System.Drawing.Size(200, 20);
@@ -1815,8 +1813,8 @@ namespace Greenshot {
//
// ImageEditorForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(785, 485);
this.Controls.Add(this.topToolStripContainer);
this.KeyPreview = true;
diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs
index ab7d037f7..6e19df179 100644
--- a/Greenshot/Forms/ImageEditorForm.cs
+++ b/Greenshot/Forms/ImageEditorForm.cs
@@ -102,13 +102,12 @@ namespace Greenshot {
propertiesToolStrip.ImageScalingSize = newSize;
propertiesToolStrip.MinimumSize = new Size(150, newSize.Height + 10);
- _surface.AdjustToDpi(dpi);
+ _surface?.AdjustToDpi(dpi);
+ UpdateUi();
}
public ImageEditorForm(ISurface iSurface, bool outputMade)
{
- // Make sure we change the icon size depending on the scaling
- DpiChanged += AdjustToDpi;
EditorList.Add(this);
//
@@ -116,6 +115,8 @@ namespace Greenshot {
//
ManualLanguageApply = true;
InitializeComponent();
+ // Make sure we change the icon size depending on the scaling
+ DpiChanged += AdjustToDpi;
Load += delegate {
var thread = new Thread(AddDestinations)
{
@@ -236,7 +237,10 @@ namespace Greenshot {
MouseWheel += PanelMouseWheel;
// Make sure the value is set correctly when starting
- counterUpDown.Value = Surface.CounterStart;
+ if (Surface != null)
+ {
+ counterUpDown.Value = Surface.CounterStart;
+ }
ApplyLanguage();
}
diff --git a/Greenshot/Forms/MainForm.Designer.cs b/Greenshot/Forms/MainForm.Designer.cs
index f94f4b87d..751d43452 100644
--- a/Greenshot/Forms/MainForm.Designer.cs
+++ b/Greenshot/Forms/MainForm.Designer.cs
@@ -50,31 +50,30 @@ namespace Greenshot {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.contextmenu_capturearea = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
+ this.contextmenu_capturearea = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_capturelastregion = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_capturewindow = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_capturefullscreen = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_captureie = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
- this.toolStripListCaptureSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_capturewindowfromlist = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_captureiefromlist = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
- this.toolStripOtherSourcesSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_captureclipboard = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_openfile = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
- this.toolStripOpenFolderSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_openrecentcapture = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
- this.toolStripPluginSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_quicksettings = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_settings = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
- this.toolStripMiscSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_help = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_donate = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_about = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
+ this.contextmenu_exit = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
+ this.toolStripListCaptureSeparator = new System.Windows.Forms.ToolStripSeparator();
+ this.toolStripOtherSourcesSeparator = new System.Windows.Forms.ToolStripSeparator();
+ this.toolStripOpenFolderSeparator = new System.Windows.Forms.ToolStripSeparator();
+ this.toolStripPluginSeparator = new System.Windows.Forms.ToolStripSeparator();
+ this.toolStripMiscSeparator = new System.Windows.Forms.ToolStripSeparator();
this.toolStripCloseSeparator = new System.Windows.Forms.ToolStripSeparator();
- this.contextmenu_exit = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
- this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
- this.contextMenu.SuspendLayout();
- this.SuspendLayout();
+ this.contextMenu.SuspendLayout();
+ this.SuspendLayout();
//
// contextMenu
//
@@ -250,10 +249,11 @@ namespace Greenshot {
//
// notifyIcon
//
+ this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.notifyIcon.ContextMenuStrip = this.contextMenu;
this.notifyIcon.Text = "Greenshot";
this.notifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIconClickTest);
- //
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs
index b96211a97..e7eed651e 100644
--- a/Greenshot/Forms/MainForm.cs
+++ b/Greenshot/Forms/MainForm.cs
@@ -245,7 +245,7 @@ namespace Greenshot {
return;
}
// Make sure we can use forms
- WindowsFormsHost.EnableWindowsFormsInterop();
+ WindowsFormsHost.EnableWindowsFormsInterop();
// BUG-1809: Add message filter, to filter out all the InputLangChanged messages which go to a target control with a handle > 32 bit.
Application.AddMessageFilter(new WmInputLangChangeRequestFilter());
@@ -744,7 +744,10 @@ namespace Greenshot {
}
- private void ContextMenuOpening(object sender, CancelEventArgs e) {
+ private void ContextMenuOpening(object sender, CancelEventArgs e)
+ {
+ var factor = DeviceDpi / 96f;
+ contextMenu.Scale(new SizeF(factor,factor));
contextmenu_captureclipboard.Enabled = ClipboardHelper.ContainsImage();
contextmenu_capturelastregion.Enabled = coreConfiguration.LastCapturedRegion != Rectangle.Empty;
@@ -1025,7 +1028,7 @@ namespace Greenshot {
/// EventArgs
private void Contextmenu_DonateClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
- Process.Start("http://getgreenshot.org/support/?version=" + Assembly.GetEntryAssembly().GetName().Version);
+ Process.Start("http://getgreenshot.org/support/?version=" + EnvironmentInfo.GetGreenshotVersion(true));
});
}
diff --git a/Greenshot/Forms/MovableShowColorForm.Designer.cs b/Greenshot/Forms/MovableShowColorForm.Designer.cs
index 811772d0b..4f614842a 100644
--- a/Greenshot/Forms/MovableShowColorForm.Designer.cs
+++ b/Greenshot/Forms/MovableShowColorForm.Designer.cs
@@ -52,7 +52,6 @@ namespace Greenshot.Forms
//
// label1
//
- this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(40, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(37, 13);
@@ -69,7 +68,6 @@ namespace Greenshot.Forms
//
// label2
//
- this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(2, 37);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(33, 13);
@@ -92,7 +90,6 @@ namespace Greenshot.Forms
//
// label4
//
- this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(2, 50);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(42, 13);
@@ -108,7 +105,6 @@ namespace Greenshot.Forms
//
// label6
//
- this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(2, 63);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(34, 13);
@@ -124,7 +120,6 @@ namespace Greenshot.Forms
//
// label5
//
- this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(2, 76);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(40, 13);
@@ -156,8 +151,8 @@ namespace Greenshot.Forms
//
this.Visible = false;
this.Location = new System.Drawing.Point(-10000,-10000);
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(100, 100);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
diff --git a/Greenshot/Forms/PrintOptionsDialog.Designer.cs b/Greenshot/Forms/PrintOptionsDialog.Designer.cs
index 990fedc5b..43d40c06e 100644
--- a/Greenshot/Forms/PrintOptionsDialog.Designer.cs
+++ b/Greenshot/Forms/PrintOptionsDialog.Designer.cs
@@ -68,7 +68,6 @@ namespace Greenshot.Forms
//
// checkbox_dontaskagain
//
- this.checkbox_dontaskagain.AutoSize = true;
this.checkbox_dontaskagain.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_dontaskagain.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_dontaskagain.LanguageKey = "printoptions_dontaskagain";
@@ -82,7 +81,6 @@ namespace Greenshot.Forms
//
// checkboxAllowShrink
//
- this.checkboxAllowShrink.AutoSize = true;
this.checkboxAllowShrink.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.LanguageKey = "printoptions_allowshrink";
@@ -97,7 +95,6 @@ namespace Greenshot.Forms
//
// checkboxAllowEnlarge
//
- this.checkboxAllowEnlarge.AutoSize = true;
this.checkboxAllowEnlarge.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.LanguageKey = "printoptions_allowenlarge";
@@ -112,7 +109,6 @@ namespace Greenshot.Forms
//
// checkboxAllowCenter
//
- this.checkboxAllowCenter.AutoSize = true;
this.checkboxAllowCenter.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.LanguageKey = "printoptions_allowcenter";
@@ -127,7 +123,6 @@ namespace Greenshot.Forms
//
// checkboxAllowRotate
//
- this.checkboxAllowRotate.AutoSize = true;
this.checkboxAllowRotate.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.LanguageKey = "printoptions_allowrotate";
@@ -155,7 +150,6 @@ namespace Greenshot.Forms
//
// checkboxDateTime
//
- this.checkboxDateTime.AutoSize = true;
this.checkboxDateTime.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.LanguageKey = "printoptions_timestamp";
@@ -182,7 +176,6 @@ namespace Greenshot.Forms
//
// checkboxPrintInverted
//
- this.checkboxPrintInverted.AutoSize = true;
this.checkboxPrintInverted.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.LanguageKey = "printoptions_inverted";
@@ -197,7 +190,6 @@ namespace Greenshot.Forms
//
// radioBtnGrayScale
//
- this.radioBtnGrayScale.AutoSize = true;
this.radioBtnGrayScale.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.LanguageKey = "printoptions_printgrayscale";
@@ -212,7 +204,6 @@ namespace Greenshot.Forms
//
// radioBtnMonochrome
//
- this.radioBtnMonochrome.AutoSize = true;
this.radioBtnMonochrome.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.LanguageKey = "printoptions_printmonochrome";
@@ -227,7 +218,6 @@ namespace Greenshot.Forms
//
// groupBoxPrintLayout
//
- this.groupBoxPrintLayout.AutoSize = true;
this.groupBoxPrintLayout.Controls.Add(this.checkboxDateTime);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowShrink);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowEnlarge);
@@ -243,7 +233,6 @@ namespace Greenshot.Forms
//
// groupBoxColors
//
- this.groupBoxColors.AutoSize = true;
this.groupBoxColors.Controls.Add(this.checkboxPrintInverted);
this.groupBoxColors.Controls.Add(this.radioBtnColorPrint);
this.groupBoxColors.Controls.Add(this.radioBtnGrayScale);
@@ -258,7 +247,6 @@ namespace Greenshot.Forms
//
// radioBtnColorPrint
//
- this.radioBtnColorPrint.AutoSize = true;
this.radioBtnColorPrint.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.LanguageKey = "printoptions_printcolor";
@@ -274,7 +262,6 @@ namespace Greenshot.Forms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(355, 390);
this.Controls.Add(this.groupBoxColors);
this.Controls.Add(this.groupBoxPrintLayout);
diff --git a/Greenshot/Forms/ResizeSettingsForm.Designer.cs b/Greenshot/Forms/ResizeSettingsForm.Designer.cs
index 0cf811fbe..f6a7fad48 100644
--- a/Greenshot/Forms/ResizeSettingsForm.Designer.cs
+++ b/Greenshot/Forms/ResizeSettingsForm.Designer.cs
@@ -76,7 +76,6 @@ namespace Greenshot.Forms {
//
// checkbox_aspectratio
//
- this.checkbox_aspectratio.AutoSize = true;
this.checkbox_aspectratio.LanguageKey = "editor_resize_aspectratio";
this.checkbox_aspectratio.Location = new System.Drawing.Point(22, 64);
this.checkbox_aspectratio.Name = "checkbox_aspectratio";
@@ -86,7 +85,6 @@ namespace Greenshot.Forms {
//
// label_width
//
- this.label_width.AutoSize = true;
this.label_width.LanguageKey = "editor_resize_width";
this.label_width.Location = new System.Drawing.Point(19, 15);
this.label_width.Name = "label_width";
@@ -95,7 +93,6 @@ namespace Greenshot.Forms {
//
// label_height
//
- this.label_height.AutoSize = true;
this.label_height.LanguageKey = "editor_resize_height";
this.label_height.Location = new System.Drawing.Point(19, 38);
this.label_height.Name = "label_height";
@@ -140,8 +137,8 @@ namespace Greenshot.Forms {
// ResizeSettingsForm
//
this.AcceptButton = this.buttonOK;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(244, 122);
this.ControlBox = false;
diff --git a/Greenshot/Forms/SettingsForm.Designer.cs b/Greenshot/Forms/SettingsForm.Designer.cs
index 473463a1e..80cbd9437 100644
--- a/Greenshot/Forms/SettingsForm.Designer.cs
+++ b/Greenshot/Forms/SettingsForm.Designer.cs
@@ -705,7 +705,6 @@ namespace Greenshot {
//
// colorButton_window_background
//
- this.colorButton_window_background.AutoSize = true;
this.colorButton_window_background.Image = ((System.Drawing.Image)(resources.GetObject("colorButton_window_background.Image")));
this.colorButton_window_background.Location = new System.Drawing.Point(374, 37);
this.colorButton_window_background.Name = "colorButton_window_background";
@@ -716,7 +715,6 @@ namespace Greenshot {
//
// radiobuttonWindowCapture
//
- this.radiobuttonWindowCapture.AutoSize = true;
this.radiobuttonWindowCapture.LanguageKey = "settings_window_capture_mode";
this.radiobuttonWindowCapture.Location = new System.Drawing.Point(11, 44);
this.radiobuttonWindowCapture.Name = "radiobuttonWindowCapture";
@@ -727,7 +725,6 @@ namespace Greenshot {
//
// radiobuttonInteractiveCapture
//
- this.radiobuttonInteractiveCapture.AutoSize = true;
this.radiobuttonInteractiveCapture.LanguageKey = "settings_capture_windows_interactive";
this.radiobuttonInteractiveCapture.Location = new System.Drawing.Point(11, 20);
this.radiobuttonInteractiveCapture.Name = "radiobuttonInteractiveCapture";
@@ -868,7 +865,6 @@ namespace Greenshot {
//
// groupBoxColors
//
- this.groupBoxColors.AutoSize = true;
this.groupBoxColors.Controls.Add(this.checkboxPrintInverted);
this.groupBoxColors.Controls.Add(this.radioBtnColorPrint);
this.groupBoxColors.Controls.Add(this.radioBtnGrayScale);
@@ -882,7 +878,6 @@ namespace Greenshot {
//
// checkboxPrintInverted
//
- this.checkboxPrintInverted.AutoSize = true;
this.checkboxPrintInverted.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.LanguageKey = "printoptions_inverted";
@@ -896,7 +891,6 @@ namespace Greenshot {
//
// radioBtnColorPrint
//
- this.radioBtnColorPrint.AutoSize = true;
this.radioBtnColorPrint.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.LanguageKey = "printoptions_printcolor";
@@ -910,7 +904,6 @@ namespace Greenshot {
//
// radioBtnGrayScale
//
- this.radioBtnGrayScale.AutoSize = true;
this.radioBtnGrayScale.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.LanguageKey = "printoptions_printgrayscale";
@@ -925,7 +918,6 @@ namespace Greenshot {
//
// radioBtnMonochrome
//
- this.radioBtnMonochrome.AutoSize = true;
this.radioBtnMonochrome.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.LanguageKey = "printoptions_printmonochrome";
@@ -939,7 +931,6 @@ namespace Greenshot {
//
// groupBoxPrintLayout
//
- this.groupBoxPrintLayout.AutoSize = true;
this.groupBoxPrintLayout.Controls.Add(this.checkboxDateTime);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowShrink);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowEnlarge);
@@ -954,7 +945,6 @@ namespace Greenshot {
//
// checkboxDateTime
//
- this.checkboxDateTime.AutoSize = true;
this.checkboxDateTime.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.LanguageKey = "printoptions_timestamp";
@@ -968,7 +958,6 @@ namespace Greenshot {
//
// checkboxAllowShrink
//
- this.checkboxAllowShrink.AutoSize = true;
this.checkboxAllowShrink.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.LanguageKey = "printoptions_allowshrink";
@@ -982,7 +971,6 @@ namespace Greenshot {
//
// checkboxAllowEnlarge
//
- this.checkboxAllowEnlarge.AutoSize = true;
this.checkboxAllowEnlarge.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.LanguageKey = "printoptions_allowenlarge";
@@ -996,7 +984,6 @@ namespace Greenshot {
//
// checkboxAllowRotate
//
- this.checkboxAllowRotate.AutoSize = true;
this.checkboxAllowRotate.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.LanguageKey = "printoptions_allowrotate";
@@ -1010,7 +997,6 @@ namespace Greenshot {
//
// checkboxAllowCenter
//
- this.checkboxAllowCenter.AutoSize = true;
this.checkboxAllowCenter.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.LanguageKey = "printoptions_allowcenter";
@@ -1075,7 +1061,6 @@ namespace Greenshot {
// button_pluginconfigure
//
this.button_pluginconfigure.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.button_pluginconfigure.AutoSize = true;
this.button_pluginconfigure.Enabled = false;
this.button_pluginconfigure.LanguageKey = "settings_configureplugin";
this.button_pluginconfigure.Location = new System.Drawing.Point(6, 285);
@@ -1164,7 +1149,6 @@ namespace Greenshot {
//
// label_counter
//
- this.label_counter.AutoSize = true;
this.label_counter.LanguageKey = "expertsettings_counter";
this.label_counter.Location = new System.Drawing.Point(7, 285);
this.label_counter.Name = "label_counter";
@@ -1181,7 +1165,6 @@ namespace Greenshot {
//
// label_footerpattern
//
- this.label_footerpattern.AutoSize = true;
this.label_footerpattern.LanguageKey = "expertsettings_footerpattern";
this.label_footerpattern.Location = new System.Drawing.Point(7, 259);
this.label_footerpattern.Name = "label_footerpattern";
@@ -1229,7 +1212,6 @@ namespace Greenshot {
//
// label_clipboardformats
//
- this.label_clipboardformats.AutoSize = true;
this.label_clipboardformats.LanguageKey = "expertsettings_clipboardformats";
this.label_clipboardformats.Location = new System.Drawing.Point(7, 39);
this.label_clipboardformats.Name = "label_clipboardformats";
@@ -1273,7 +1255,6 @@ namespace Greenshot {
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(451, 431);
this.Controls.Add(this.tabcontrol);
this.Controls.Add(this.settings_confirm);
diff --git a/Greenshot/Forms/TornEdgeSettingsForm.Designer.cs b/Greenshot/Forms/TornEdgeSettingsForm.Designer.cs
index c14ed7557..5320e17de 100644
--- a/Greenshot/Forms/TornEdgeSettingsForm.Designer.cs
+++ b/Greenshot/Forms/TornEdgeSettingsForm.Designer.cs
@@ -123,7 +123,6 @@ namespace Greenshot.Forms {
//
// label3
//
- this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(153, 63);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(12, 13);
@@ -184,7 +183,6 @@ namespace Greenshot.Forms {
//
// labelDarkness
//
- this.labelDarkness.AutoSize = true;
this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
this.labelDarkness.Location = new System.Drawing.Point(12, 97);
this.labelDarkness.Name = "labelDarkness";
@@ -194,7 +192,6 @@ namespace Greenshot.Forms {
//
// labelOffset
//
- this.labelOffset.AutoSize = true;
this.labelOffset.LanguageKey = "editor_dropshadow_offset";
this.labelOffset.Location = new System.Drawing.Point(12, 63);
this.labelOffset.Name = "labelOffset";
@@ -203,7 +200,6 @@ namespace Greenshot.Forms {
//
// labelThickness
//
- this.labelThickness.AutoSize = true;
this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
this.labelThickness.Location = new System.Drawing.Point(12, 37);
this.labelThickness.Name = "labelThickness";
@@ -234,7 +230,6 @@ namespace Greenshot.Forms {
//
// label_toothsize
//
- this.label_toothsize.AutoSize = true;
this.label_toothsize.LanguageKey = "editor_tornedge_toothsize";
this.label_toothsize.Location = new System.Drawing.Point(12, 140);
this.label_toothsize.Name = "label_toothsize";
@@ -243,7 +238,6 @@ namespace Greenshot.Forms {
//
// label_horizontaltoothrange
//
- this.label_horizontaltoothrange.AutoSize = true;
this.label_horizontaltoothrange.LanguageKey = "editor_tornedge_horizontaltoothrange";
this.label_horizontaltoothrange.Location = new System.Drawing.Point(12, 166);
this.label_horizontaltoothrange.Name = "label_horizontaltoothrange";
@@ -273,7 +267,6 @@ namespace Greenshot.Forms {
//
// labelVerticaltoothrange
//
- this.labelVerticaltoothrange.AutoSize = true;
this.labelVerticaltoothrange.LanguageKey = "editor_tornedge_verticaltoothrange";
this.labelVerticaltoothrange.Location = new System.Drawing.Point(12, 192);
this.labelVerticaltoothrange.Name = "labelVerticaltoothrange";
@@ -351,7 +344,6 @@ namespace Greenshot.Forms {
//
// shadowCheckbox
//
- this.shadowCheckbox.AutoSize = true;
this.shadowCheckbox.LanguageKey = "editor_tornedge_shadow";
this.shadowCheckbox.Location = new System.Drawing.Point(12, 12);
this.shadowCheckbox.Name = "shadowCheckbox";
@@ -362,7 +354,6 @@ namespace Greenshot.Forms {
//
// all
//
- this.all.AutoSize = true;
this.all.LanguageKey = "editor_tornedge_all";
this.all.Location = new System.Drawing.Point(251, 12);
this.all.Name = "all";
@@ -374,8 +365,8 @@ namespace Greenshot.Forms {
// TornEdgeSettingsForm
//
this.AcceptButton = this.buttonOK;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(502, 223);
this.ControlBox = false;
diff --git a/Greenshot/GreenshotMain.cs b/Greenshot/GreenshotMain.cs
index b6f448c25..6a993d99b 100644
--- a/Greenshot/GreenshotMain.cs
+++ b/Greenshot/GreenshotMain.cs
@@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
- *
+ *
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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 .
*/
diff --git a/Greenshot/Helpers/CaptureHelper.cs b/Greenshot/Helpers/CaptureHelper.cs
index d8a617995..156470802 100644
--- a/Greenshot/Helpers/CaptureHelper.cs
+++ b/Greenshot/Helpers/CaptureHelper.cs
@@ -846,7 +846,7 @@ namespace Greenshot.Helpers {
// Restore the window making sure it's visible!
windowToCapture.Restore();
} else {
- windowToCapture.ToForeground(false);
+ windowToCapture.ToForeground();
}
tmpCapture = windowToCapture.CaptureGdiWindow(captureForWindow);
if (tmpCapture != null) {
@@ -941,7 +941,7 @@ namespace Greenshot.Helpers {
}
private void SetDpi() {
- // Workaround for proble with DPI retrieval, the FromHwnd activates the window...
+ // Workaround for problem with DPI retrieval, the FromHwnd activates the window...
WindowDetails previouslyActiveWindow = WindowDetails.GetActiveWindow();
// Workaround for changed DPI settings in Windows 7
var mainForm = SimpleServiceProvider.Current.GetInstance();
@@ -950,7 +950,7 @@ namespace Greenshot.Helpers {
_capture.CaptureDetails.DpiY = graphics.DpiY;
}
// Set previouslyActiveWindow as foreground window
- previouslyActiveWindow?.ToForeground(false);
+ previouslyActiveWindow?.ToForeground();
if (_capture.CaptureDetails != null) {
((Bitmap) _capture.Image)?.SetResolution(_capture.CaptureDetails.DpiX, _capture.CaptureDetails.DpiY);
}
diff --git a/GreenshotBoxPlugin/Forms/SettingsForm.Designer.cs b/GreenshotBoxPlugin/Forms/SettingsForm.Designer.cs
index dc7991f8d..385452002 100644
--- a/GreenshotBoxPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotBoxPlugin/Forms/SettingsForm.Designer.cs
@@ -109,7 +109,6 @@ namespace GreenshotBoxPlugin {
// checkboxAfterUploadLinkToClipBoard
//
this.checkboxAfterUploadLinkToClipBoard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "box.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(208, 45);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
diff --git a/GreenshotDropboxPlugin/Forms/SettingsForm.Designer.cs b/GreenshotDropboxPlugin/Forms/SettingsForm.Designer.cs
index 3e8226dc9..80c0009b1 100644
--- a/GreenshotDropboxPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotDropboxPlugin/Forms/SettingsForm.Designer.cs
@@ -106,7 +106,6 @@ namespace GreenshotDropboxPlugin {
//
// checkboxAfterUploadLinkToClipBoard
//
- this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "dropbox.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(116, 37);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
diff --git a/GreenshotExternalCommandPlugin/SettingsForm.Designer.cs b/GreenshotExternalCommandPlugin/SettingsForm.Designer.cs
index 17df962df..0a7ed7d7f 100644
--- a/GreenshotExternalCommandPlugin/SettingsForm.Designer.cs
+++ b/GreenshotExternalCommandPlugin/SettingsForm.Designer.cs
@@ -130,8 +130,8 @@ namespace GreenshotExternalCommandPlugin {
// SettingsForm
//
this.AcceptButton = this.buttonOk;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(365, 208);
this.Controls.Add(this.button_edit);
diff --git a/GreenshotExternalCommandPlugin/SettingsFormDetail.Designer.cs b/GreenshotExternalCommandPlugin/SettingsFormDetail.Designer.cs
index 200bd7a30..028efa2cd 100644
--- a/GreenshotExternalCommandPlugin/SettingsFormDetail.Designer.cs
+++ b/GreenshotExternalCommandPlugin/SettingsFormDetail.Designer.cs
@@ -168,8 +168,8 @@ namespace GreenshotExternalCommandPlugin {
// SettingsFormDetail
//
this.AcceptButton = this.buttonOk;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(360, 172);
diff --git a/GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs b/GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs
index 98881585e..498e37d18 100644
--- a/GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs
@@ -105,7 +105,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBoxPublic
//
- this.checkBoxPublic.AutoSize = true;
this.checkBoxPublic.LanguageKey = "flickr.public";
this.checkBoxPublic.Location = new System.Drawing.Point(174, 88);
this.checkBoxPublic.Name = "checkBoxPublic";
@@ -117,7 +116,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBoxFamily
//
- this.checkBoxFamily.AutoSize = true;
this.checkBoxFamily.LanguageKey = "flickr.family";
this.checkBoxFamily.Location = new System.Drawing.Point(265, 88);
this.checkBoxFamily.Name = "checkBoxFamily";
@@ -129,7 +127,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBoxFriend
//
- this.checkBoxFriend.AutoSize = true;
this.checkBoxFriend.LanguageKey = "flickr.friend";
this.checkBoxFriend.Location = new System.Drawing.Point(350, 88);
this.checkBoxFriend.Name = "checkBoxFriend";
@@ -170,7 +167,6 @@ namespace GreenshotFlickrPlugin {
//
// checkboxAfterUploadLinkToClipBoard
//
- this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "flickr.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(173, 116);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
@@ -182,7 +178,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBox_hiddenfromsearch
//
- this.checkBox_hiddenfromsearch.AutoSize = true;
this.checkBox_hiddenfromsearch.LanguageKey = "flickr.label_HiddenFromSearch";
this.checkBox_hiddenfromsearch.Location = new System.Drawing.Point(174, 60);
this.checkBox_hiddenfromsearch.Name = "checkBox_hiddenfromsearch";
diff --git a/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs b/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs
index 6e9b286ae..5b38b0e65 100644
--- a/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs
+++ b/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs
@@ -87,7 +87,6 @@ namespace GreenshotImgurPlugin
// deleteButton
//
this.deleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.deleteButton.AutoSize = true;
this.deleteButton.Location = new System.Drawing.Point(109, 272);
this.deleteButton.Name = "deleteButton";
this.deleteButton.Size = new System.Drawing.Size(75, 23);
@@ -99,7 +98,6 @@ namespace GreenshotImgurPlugin
// openButton
//
this.openButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.openButton.AutoSize = true;
this.openButton.Location = new System.Drawing.Point(109, 305);
this.openButton.Name = "openButton";
this.openButton.Size = new System.Drawing.Size(75, 23);
@@ -122,7 +120,6 @@ namespace GreenshotImgurPlugin
// clipboardButton
//
this.clipboardButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.clipboardButton.AutoSize = true;
this.clipboardButton.Location = new System.Drawing.Point(109, 338);
this.clipboardButton.Name = "clipboardButton";
this.clipboardButton.Size = new System.Drawing.Size(129, 23);
@@ -144,8 +141,8 @@ namespace GreenshotImgurPlugin
//
// ImgurHistory
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(534, 372);
this.Controls.Add(this.clearHistoryButton);
this.Controls.Add(this.clipboardButton);
diff --git a/GreenshotImgurPlugin/Forms/SettingsForm.Designer.cs b/GreenshotImgurPlugin/Forms/SettingsForm.Designer.cs
index 4888dc356..788597c39 100644
--- a/GreenshotImgurPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotImgurPlugin/Forms/SettingsForm.Designer.cs
@@ -109,7 +109,6 @@ namespace GreenshotImgurPlugin {
//
// checkbox_anonymous_access
//
- this.checkbox_anonymous_access.AutoSize = true;
this.checkbox_anonymous_access.LanguageKey = "imgur.anonymous_access";
this.checkbox_anonymous_access.Location = new System.Drawing.Point(15, 38);
this.checkbox_anonymous_access.Name = "checkbox_anonymous_access";
@@ -121,7 +120,6 @@ namespace GreenshotImgurPlugin {
//
// checkbox_usepagelink
//
- this.checkbox_usepagelink.AutoSize = true;
this.checkbox_usepagelink.LanguageKey = "imgur.use_page_link";
this.checkbox_usepagelink.Location = new System.Drawing.Point(15, 57);
this.checkbox_usepagelink.Name = "checkbox_usepagelink";
diff --git a/GreenshotImgurPlugin/ImgurUtils.cs b/GreenshotImgurPlugin/ImgurUtils.cs
index 817ff44fa..a38c12b95 100644
--- a/GreenshotImgurPlugin/ImgurUtils.cs
+++ b/GreenshotImgurPlugin/ImgurUtils.cs
@@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
- *
+ *
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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 .
*/
@@ -171,12 +171,11 @@ namespace GreenshotImgurPlugin {
{
AuthUrlPattern = AuthUrlPattern,
TokenUrl = TokenUrl,
- RedirectUrl = "https://imgur.com",
+ RedirectUrl = "https://getgreenshot.org/oauth/imgur",
CloudServiceName = "Imgur",
ClientId = ImgurCredentials.CONSUMER_KEY,
ClientSecret = ImgurCredentials.CONSUMER_SECRET,
- AuthorizeMode = OAuth2AuthorizeMode.EmbeddedBrowser,
- BrowserSize = new Size(680, 880),
+ AuthorizeMode = OAuth2AuthorizeMode.OutOfBoundAuto,
RefreshToken = Config.RefreshToken,
AccessToken = Config.AccessToken,
AccessTokenExpires = Config.AccessTokenExpires
@@ -280,7 +279,7 @@ namespace GreenshotImgurPlugin {
///
public static void DeleteImgurImage(ImgurInfo imgurInfo) {
Log.InfoFormat("Deleting Imgur image for {0}", imgurInfo.DeleteHash);
-
+
try {
string url = Config.ImgurApi3Url + "/image/" + imgurInfo.DeleteHash + ".xml";
HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(url, HTTPMethod.DELETE);
diff --git a/GreenshotJiraPlugin/Forms/JiraForm.Designer.cs b/GreenshotJiraPlugin/Forms/JiraForm.Designer.cs
index 12e85ca40..ac718241e 100644
--- a/GreenshotJiraPlugin/Forms/JiraForm.Designer.cs
+++ b/GreenshotJiraPlugin/Forms/JiraForm.Designer.cs
@@ -71,7 +71,6 @@ namespace GreenshotJiraPlugin.Forms {
//
// label_jirafilter
//
- this.label_jirafilter.AutoSize = true;
this.label_jirafilter.Location = new System.Drawing.Point(14, 14);
this.label_jirafilter.Name = "label_jirafilter";
this.label_jirafilter.Size = new System.Drawing.Size(52, 13);
@@ -80,7 +79,6 @@ namespace GreenshotJiraPlugin.Forms {
//
// label_jira
//
- this.label_jira.AutoSize = true;
this.label_jira.Location = new System.Drawing.Point(14, 41);
this.label_jira.Name = "label_jira";
this.label_jira.Size = new System.Drawing.Size(30, 13);
@@ -127,7 +125,6 @@ namespace GreenshotJiraPlugin.Forms {
// label_filename
//
this.label_filename.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.label_filename.AutoSize = true;
this.label_filename.Location = new System.Drawing.Point(14, 222);
this.label_filename.Name = "label_filename";
this.label_filename.Size = new System.Drawing.Size(49, 13);
@@ -137,7 +134,6 @@ namespace GreenshotJiraPlugin.Forms {
// label_comment
//
this.label_comment.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.label_comment.AutoSize = true;
this.label_comment.Location = new System.Drawing.Point(14, 248);
this.label_comment.Name = "label_comment";
this.label_comment.Size = new System.Drawing.Size(51, 13);
@@ -167,7 +163,6 @@ namespace GreenshotJiraPlugin.Forms {
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 274);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(23, 13);
diff --git a/GreenshotPhotobucketPlugin/Forms/SettingsForm.Designer.cs b/GreenshotPhotobucketPlugin/Forms/SettingsForm.Designer.cs
index 4cd900c68..a7dcc758e 100644
--- a/GreenshotPhotobucketPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotPhotobucketPlugin/Forms/SettingsForm.Designer.cs
@@ -96,7 +96,6 @@ namespace GreenshotPhotobucketPlugin {
//
// checkbox_usepagelink
//
- this.checkbox_usepagelink.AutoSize = true;
this.checkbox_usepagelink.LanguageKey = "photobucket.use_page_link";
this.checkbox_usepagelink.Location = new System.Drawing.Point(15, 43);
this.checkbox_usepagelink.Name = "checkbox_usepagelink";
diff --git a/GreenshotPicasaPlugin/Forms/SettingsForm.Designer.cs b/GreenshotPicasaPlugin/Forms/SettingsForm.Designer.cs
index 41cb346f9..0d2447e41 100644
--- a/GreenshotPicasaPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotPicasaPlugin/Forms/SettingsForm.Designer.cs
@@ -108,7 +108,6 @@ namespace GreenshotPicasaPlugin {
// checkboxAfterUploadLinkToClipBoard
//
this.checkboxAfterUploadLinkToClipBoard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "picasa.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(197, 50);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
diff --git a/GreenshotPlugin/Controls/BackgroundForm.Designer.cs b/GreenshotPlugin/Controls/BackgroundForm.Designer.cs
index bef6439b5..fbfee52bd 100644
--- a/GreenshotPlugin/Controls/BackgroundForm.Designer.cs
+++ b/GreenshotPlugin/Controls/BackgroundForm.Designer.cs
@@ -55,7 +55,6 @@ namespace GreenshotPlugin.Controls
//
// label_pleasewait
//
- this.label_pleasewait.AutoSize = true;
this.label_pleasewait.Dock = System.Windows.Forms.DockStyle.Fill;
this.label_pleasewait.Location = new System.Drawing.Point(0, 0);
this.label_pleasewait.Name = "label_pleasewait";
@@ -73,9 +72,8 @@ namespace GreenshotPlugin.Controls
//
// BackgroundForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoSize = true;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(169, 52);
this.ControlBox = true;
this.Controls.Add(this.label_pleasewait);
diff --git a/GreenshotPlugin/Controls/GreenshotForm.cs b/GreenshotPlugin/Controls/GreenshotForm.cs
index a7926095f..1f6ce5675 100644
--- a/GreenshotPlugin/Controls/GreenshotForm.cs
+++ b/GreenshotPlugin/Controls/GreenshotForm.cs
@@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
- *
+ *
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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 .
*/
@@ -101,10 +101,10 @@ namespace GreenshotPlugin.Controls {
_designTimeToolStripItems = new Dictionary();
try {
ITypeResolutionService typeResService = GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
-
+
// Add a hard-path if you are using SharpDevelop
// Language.AddLanguageFilePath(@"C:\Greenshot\Greenshot\Languages");
-
+
// this "type"
Assembly currentAssembly = GetType().Assembly;
if (typeResService != null)
@@ -209,11 +209,11 @@ namespace GreenshotPlugin.Controls {
}
private void ClearChangeNotifications() {
- // The m_changeService value is null when not in design mode,
- // as the IComponentChangeService is only available at design time.
+ // The m_changeService value is null when not in design mode,
+ // as the IComponentChangeService is only available at design time.
m_changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
- // Clear our the component change events to prepare for re-siting.
+ // Clear our the component change events to prepare for re-siting.
if (m_changeService != null) {
m_changeService.ComponentChanged -= OnComponentChanged;
m_changeService.ComponentAdded -= OnComponentAdded;
@@ -335,7 +335,7 @@ namespace GreenshotPlugin.Controls {
}
}
}
-
+
///
/// Helper method to cache the fieldinfo values, so we don't need to reflect all the time!
///
@@ -379,8 +379,8 @@ namespace GreenshotPlugin.Controls {
ApplyLanguage(applyToControl);
}
}
-
- if (DesignMode) {
+
+ if (DesignMode) {
foreach (Control designControl in _designTimeControls.Values) {
ApplyLanguage(designControl);
}
@@ -514,7 +514,7 @@ namespace GreenshotPlugin.Controls {
iniValue.Value = comboxBox.GetSelectedEnum();
iniDirty = true;
}
-
+
}
}
}
diff --git a/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs b/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs
index 572829a76..e8ca384a2 100644
--- a/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs
+++ b/GreenshotPlugin/Controls/OAuthLoginForm.Designer.cs
@@ -70,8 +70,8 @@ namespace GreenshotPlugin.Controls {
//
// OAuthLoginForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(595, 315);
this.Controls.Add(this._browser);
this.Controls.Add(this._addressTextBox);
diff --git a/GreenshotPlugin/Controls/PleaseWaitForm.Designer.cs b/GreenshotPlugin/Controls/PleaseWaitForm.Designer.cs
index d287b3dde..c308b4b07 100644
--- a/GreenshotPlugin/Controls/PleaseWaitForm.Designer.cs
+++ b/GreenshotPlugin/Controls/PleaseWaitForm.Designer.cs
@@ -50,7 +50,6 @@ namespace GreenshotPlugin.Controls {
//
// label_pleasewait
//
- this.label_pleasewait.AutoSize = true;
this.label_pleasewait.Dock = System.Windows.Forms.DockStyle.Fill;
this.label_pleasewait.Location = new System.Drawing.Point(0, 0);
this.label_pleasewait.Name = "label_pleasewait";
@@ -77,9 +76,8 @@ namespace GreenshotPlugin.Controls {
//
// PleaseWaitForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoSize = true;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(169, 76);
this.Controls.Add(this.cancelButton);
diff --git a/GreenshotPlugin/Controls/QualityDialog.Designer.cs b/GreenshotPlugin/Controls/QualityDialog.Designer.cs
index cf10c3a2e..eaf714d06 100644
--- a/GreenshotPlugin/Controls/QualityDialog.Designer.cs
+++ b/GreenshotPlugin/Controls/QualityDialog.Designer.cs
@@ -108,7 +108,6 @@ namespace GreenshotPlugin.Controls {
//
// checkBox_reduceColors
//
- this.checkBox_reduceColors.AutoSize = true;
this.checkBox_reduceColors.Location = new System.Drawing.Point(12, 11);
this.checkBox_reduceColors.Name = "checkBox_reduceColors";
this.checkBox_reduceColors.Size = new System.Drawing.Size(95, 17);
@@ -116,7 +115,7 @@ namespace GreenshotPlugin.Controls {
this.checkBox_reduceColors.Text = "settings_reducecolors";
this.checkBox_reduceColors.UseVisualStyleBackColor = true;
//
- // QualityDialog
+ // QualityDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
diff --git a/GreenshotPlugin/Core/AbstractDestination.cs b/GreenshotPlugin/Core/AbstractDestination.cs
index 886dd5dab..ba9878c23 100644
--- a/GreenshotPlugin/Core/AbstractDestination.cs
+++ b/GreenshotPlugin/Core/AbstractDestination.cs
@@ -155,10 +155,16 @@ namespace GreenshotPlugin.Core {
TopLevel = true
};
- menu.Opened += (sender, args) =>
- {
- var scaledIconSize = DpiHelper.ScaleWithDpi(CoreConfig.IconSize, DpiHelper.GetDpi(menu.Handle));
- menu.ImageScalingSize = scaledIconSize;
+ menu.Opening += (sender, args) =>
+ {
+ // find the DPI settings for the screen where this is going to land
+ var screenDpi = DpiHelper.GetDpi(menu.Location);
+ var scaledIconSize = DpiHelper.ScaleWithDpi(CoreConfig.IconSize, screenDpi);
+ menu.SuspendLayout();
+ var fontSize = DpiHelper.ScaleWithDpi(12f, screenDpi);
+ menu.Font = new Font(FontFamily.GenericSansSerif, fontSize, FontStyle.Regular, GraphicsUnit.Pixel);
+ menu.ImageScalingSize = scaledIconSize;
+ menu.ResumeLayout();
};
menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {
@@ -191,7 +197,10 @@ namespace GreenshotPlugin.Core {
menu.MouseEnter += delegate
{
// in case the menu has been unfocused, focus again so that dropdown menus will still open on mouseenter
- if(!menu.ContainsFocus) menu.Focus();
+ if (!menu.ContainsFocus)
+ {
+ menu.Focus();
+ }
};
foreach (IDestination destination in destinations) {
// Fix foreach loop variable for the delegate
diff --git a/GreenshotPlugin/Core/DpiHelper.cs b/GreenshotPlugin/Core/DpiHelper.cs
index 171cf19ee..991f2897e 100644
--- a/GreenshotPlugin/Core/DpiHelper.cs
+++ b/GreenshotPlugin/Core/DpiHelper.cs
@@ -453,6 +453,24 @@ namespace GreenshotPlugin.Core
}
}
+ ///
+ /// Return the DPI for the screen which the location is located on
+ ///
+ /// POINT
+ /// uint
+ public static uint GetDpi(POINT location)
+ {
+ RECT rect = new RECT(location.X, location.Y, 1,1);
+ IntPtr hMonitor = User32.MonitorFromRect(ref rect, User32.MONITOR_DEFAULTTONEAREST);
+ var result = GetDpiForMonitor(hMonitor, MonitorDpiType.EffectiveDpi, out var dpiX, out var dpiY);
+ if (result.Succeeded())
+ {
+ return dpiX;
+ }
+ return DefaultScreenDpi;
+ }
+
+
///
/// Retrieve the DPI value for the supplied window handle
///
@@ -476,7 +494,8 @@ namespace GreenshotPlugin.Core
{
var hMonitor = User32.MonitorFromWindow(hWnd, MonitorFrom.DefaultToNearest);
// ReSharper disable once UnusedVariable
- if (GetDpiForMonitor(hMonitor, MonitorDpiType.EffectiveDpi, out var dpiX, out var dpiY))
+ var result = GetDpiForMonitor(hMonitor, MonitorDpiType.EffectiveDpi, out var dpiX, out var dpiY);
+ if (result.Succeeded())
{
return dpiX;
}
@@ -544,9 +563,8 @@ namespace GreenshotPlugin.Core
/// out int for the horizontal dpi
/// out int for the vertical dpi
/// true if all okay
- [DllImport("shcore")]
- [return: MarshalAs(UnmanagedType.Bool)]
- private static extern bool GetDpiForMonitor(IntPtr hMonitor, MonitorDpiType dpiType, out uint dpiX, out uint dpiY);
+ [DllImport("shcore.dll", SetLastError = true)]
+ private static extern HResult GetDpiForMonitor(IntPtr hMonitor, MonitorDpiType dpiType, out uint dpiX, out uint dpiY);
///
/// See EnableNonClientDpiScaling function
diff --git a/GreenshotPlugin/Core/OAuthHelper.cs b/GreenshotPlugin/Core/OAuthHelper.cs
index 3908a6702..ce059189f 100644
--- a/GreenshotPlugin/Core/OAuthHelper.cs
+++ b/GreenshotPlugin/Core/OAuthHelper.cs
@@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
- *
+ *
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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 .
*/
@@ -32,6 +32,8 @@ using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
+using System.Windows.Forms;
+using GreenshotPlugin.Hooking;
namespace GreenshotPlugin.Core {
///
@@ -41,16 +43,17 @@ namespace GreenshotPlugin.Core {
HMACSHA1,
PLAINTEXT,
}
-
+
///
- /// Specify the autorize mode that is used to get the token from the cloud service.
+ /// Specify the authorize mode that is used to get the token from the cloud service.
///
public enum OAuth2AuthorizeMode {
- Unknown, // Will give an exception, caller needs to specify another value
- LocalServer, // Will specify a redirect URL to http://localhost:port/authorize, while having a HttpListener
- MonitorTitle, // Not implemented yet: Will monitor for title changes
- Pin, // Not implemented yet: Will ask the user to enter the shown PIN
- EmbeddedBrowser // Will open into an embedded _browser (OAuthLoginForm), and catch the redirect
+ Unknown, // Will give an exception, caller needs to specify another value
+ LocalServer, // Will specify a redirect URL to http://localhost:port/authorize, while having a HttpListener
+ MonitorTitle, // Not implemented yet: Will monitor for title changes
+ Pin, // Not implemented yet: Will ask the user to enter the shown PIN
+ EmbeddedBrowser, // Will open into an embedded _browser (OAuthLoginForm), and catch the redirect
+ OutOfBoundAuto
}
///
@@ -211,7 +214,7 @@ namespace GreenshotPlugin.Core {
//
// List of know and used oauth parameters' names
- //
+ //
protected const string OAUTH_CONSUMER_KEY_KEY = "oauth_consumer_key";
protected const string OAUTH_CALLBACK_KEY = "oauth_callback";
protected const string OAUTH_VERSION_KEY = "oauth_version";
@@ -395,7 +398,7 @@ namespace GreenshotPlugin.Core {
}
///
- /// Generate the timestamp for the signature
+ /// Generate the timestamp for the signature
///
///
public static string GenerateTimeStamp() {
@@ -472,7 +475,7 @@ namespace GreenshotPlugin.Core {
///
/// Get the access token
///
- /// The access token.
+ /// The access token.
private string GetAccessToken() {
if (string.IsNullOrEmpty(Token) || (CheckVerifier && string.IsNullOrEmpty(Verifier))) {
Exception e = new Exception("The request token and verifier were not set");
@@ -1121,12 +1124,43 @@ Greenshot received information from CloudServiceName. You can close this browser
{
OAuth2AuthorizeMode.LocalServer => AuthenticateViaLocalServer(settings),
OAuth2AuthorizeMode.EmbeddedBrowser => AuthenticateViaEmbeddedBrowser(settings),
- _ => throw new NotImplementedException($"Authorize mode '{settings.AuthorizeMode}' is not 'yet' implemented."),
+ OAuth2AuthorizeMode.OutOfBoundAuto => AuthenticateViaDefaultBrowser(settings),
+ _ => throw new NotImplementedException($"Authorize mode '{settings.AuthorizeMode}' is not 'yet' implemented."),
};
return completed;
}
- ///
+ ///
+ /// Authenticate via the default browser
+ /// If this works, return the code
+ ///
+ /// OAuth2Settings with the Auth / Token url etc
+ /// true if completed, false if canceled
+ private static bool AuthenticateViaDefaultBrowser(OAuth2Settings settings)
+ {
+ var monitor = new WindowsTitleMonitor();
+
+ string[] code = new string[1];
+ monitor.TitleChangeEvent += args =>
+ {
+ if (args.Title.Contains(settings.State))
+ {
+ code[0] = args.Title;
+ settings.Code = args.Title;
+ }
+ };
+ using (var process = Process.Start(settings.FormattedAuthUrl))
+ {
+ while (string.IsNullOrEmpty(code[0]))
+ {
+ Application.DoEvents();
+ }
+ };
+
+ return true;
+ }
+
+ ///
/// Authenticate via an embedded browser
/// If this works, return the code
///
@@ -1192,7 +1226,7 @@ Greenshot received information from CloudServiceName. You can close this browser
}
///
- /// Check and authenticate or refresh tokens
+ /// Check and authenticate or refresh tokens
///
/// OAuth2Settings
public static void CheckAndAuthenticateOrRefresh(OAuth2Settings settings) {
diff --git a/GreenshotPlugin/Core/WindowDetails.cs b/GreenshotPlugin/Core/WindowDetails.cs
index 883c7aa1e..4fff18959 100644
--- a/GreenshotPlugin/Core/WindowDetails.cs
+++ b/GreenshotPlugin/Core/WindowDetails.cs
@@ -1137,46 +1137,50 @@ namespace GreenshotPlugin.Core
///
/// Set the window as foreground window
///
- /// hWnd of the window to bring to the foreground
- /// bool with true to use a trick to really bring the window to the foreground
- public static void ToForeground(IntPtr handle, bool workaround = true)
+ /// hWnd of the window to bring to the foreground
+ public static void ToForeground(IntPtr hWnd)
{
- var window = new WindowDetails(handle);
+ var foregroundWindow = User32.GetForegroundWindow();
+ if (hWnd == foregroundWindow)
+ {
+ return;
+ }
+
+ var window = new WindowDetails(hWnd);
// Nothing we can do if it's not visible!
if (!window.Visible)
{
return;
}
+
+ var threadId1 = User32.GetWindowThreadProcessId(foregroundWindow, IntPtr.Zero);
+ var threadId2 = User32.GetWindowThreadProcessId(hWnd, IntPtr.Zero);
+
+ // Show window in foreground.
+ if (threadId1 != threadId2)
+ {
+ User32.AttachThreadInput(threadId1, threadId2, 1);
+ User32.SetForegroundWindow(hWnd);
+ User32.AttachThreadInput(threadId1, threadId2, 0);
+ }
+ else
+ {
+ User32.SetForegroundWindow(hWnd);
+ }
+
+ User32.BringWindowToTop(hWnd);
+
if (window.Iconic)
{
window.Iconic = false;
- while (window.Iconic)
- {
- Application.DoEvents();
- }
}
- // See https://msdn.microsoft.com/en-us/library/windows/desktop/ms633539(v=vs.85).aspx
- if (workaround)
- {
- const byte alt = 0xA4;
- const int extendedKey = 0x1;
- const int keyup = 0x2;
- // Simulate an "ALT" key press.
- User32.keybd_event(alt, 0x45, extendedKey | 0, 0);
- // Simulate an "ALT" key release.
- User32.keybd_event(alt, 0x45, extendedKey | keyup, 0);
- }
- // Show window in forground.
- User32.BringWindowToTop(handle);
- User32.SetForegroundWindow(handle);
}
///
/// Set the window as foreground window
///
- /// true to use a workaround, otherwise the window might only flash
- public void ToForeground(bool workaround = true) {
- ToForeground(Handle, workaround);
+ public void ToForeground() {
+ ToForeground(Handle);
}
///
diff --git a/GreenshotPlugin/Interfaces/IDestination.cs b/GreenshotPlugin/Interfaces/IDestination.cs
index 371d2b6b3..e4f39d796 100644
--- a/GreenshotPlugin/Interfaces/IDestination.cs
+++ b/GreenshotPlugin/Interfaces/IDestination.cs
@@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
- *
+ *
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/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 .
*/
@@ -104,8 +104,8 @@ namespace GreenshotPlugin.Interfaces {
Keys EditorShortcutKeys {
get;
}
-
- ///
+
+ ///
/// Gets the dynamic destinations
///
IEnumerable DynamicDestinations();
diff --git a/GreenshotPlugin/UnmanagedHelpers/User32.cs b/GreenshotPlugin/UnmanagedHelpers/User32.cs
index 3c5a90a71..d6ae3acb1 100644
--- a/GreenshotPlugin/UnmanagedHelpers/User32.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/User32.cs
@@ -52,9 +52,6 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public const int MONITOR_DEFAULTTONEAREST = 2;
public const int CURSOR_SHOWING = 0x00000001;
- [DllImport("user32", SetLastError = true)]
- public static extern bool keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
-
///
/// Determines whether the specified window handle identifies an existing window.
///
@@ -72,6 +69,11 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32", SetLastError = true)]
public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int processId);
+ [DllImport("user32", SetLastError = true)]
+ public static extern int GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId);
+ [DllImport("user32")]
+ public static extern IntPtr AttachThreadInput(int idAttach, int idAttachTo, int fAttach);
+
[DllImport("user32", SetLastError = true)]
public static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32", SetLastError = true)]