mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Added setting to be able to skip Windows print dialog
This commit is contained in:
parent
10e7260f7b
commit
4d5e05921e
6 changed files with 63 additions and 14 deletions
|
@ -74,6 +74,8 @@ private void LoadSettings()
|
||||||
cbCenterImage.Checked = printSettings.CenterImage;
|
cbCenterImage.Checked = printSettings.CenterImage;
|
||||||
cbAllowEnlarge.Enabled = printSettings.AutoScaleImage;
|
cbAllowEnlarge.Enabled = printSettings.AutoScaleImage;
|
||||||
cbCenterImage.Enabled = printSettings.AutoScaleImage;
|
cbCenterImage.Enabled = printSettings.AutoScaleImage;
|
||||||
|
|
||||||
|
btnPrint.Text = printSettings.ShowPrintDialog ? "Print..." : "Print";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnPrint_Click(object sender, EventArgs e)
|
private void btnPrint_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -96,7 +96,7 @@ public void ShowPreview()
|
||||||
|
|
||||||
public bool Print()
|
public bool Print()
|
||||||
{
|
{
|
||||||
if (Printable && printDialog.ShowDialog() == DialogResult.OK)
|
if (Printable && (!Settings.ShowPrintDialog || printDialog.ShowDialog() == DialogResult.OK))
|
||||||
{
|
{
|
||||||
if (PrintType == PrintType.Text)
|
if (PrintType == PrintType.Text)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class PrintSettings
|
||||||
public bool AllowEnlargeImage { get; set; }
|
public bool AllowEnlargeImage { get; set; }
|
||||||
public bool CenterImage { get; set; }
|
public bool CenterImage { get; set; }
|
||||||
public XmlFont TextFont { get; set; }
|
public XmlFont TextFont { get; set; }
|
||||||
|
public bool ShowPrintDialog { get; set; }
|
||||||
|
|
||||||
public PrintSettings()
|
public PrintSettings()
|
||||||
{
|
{
|
||||||
|
@ -45,6 +46,7 @@ public PrintSettings()
|
||||||
AllowEnlargeImage = false;
|
AllowEnlargeImage = false;
|
||||||
CenterImage = false;
|
CenterImage = false;
|
||||||
TextFont = new XmlFont("Arial", 10);
|
TextFont = new XmlFont("Arial", 10);
|
||||||
|
ShowPrintDialog = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
38
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
38
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
|
@ -116,6 +116,7 @@ private void InitializeComponent()
|
||||||
this.btnEncodersRemove = new System.Windows.Forms.Button();
|
this.btnEncodersRemove = new System.Windows.Forms.Button();
|
||||||
this.tpAdvanced = new System.Windows.Forms.TabPage();
|
this.tpAdvanced = new System.Windows.Forms.TabPage();
|
||||||
this.pgSettings = new System.Windows.Forms.PropertyGrid();
|
this.pgSettings = new System.Windows.Forms.PropertyGrid();
|
||||||
|
this.cbPrintDontShowWindowsDialog = new System.Windows.Forms.CheckBox();
|
||||||
this.tcSettings.SuspendLayout();
|
this.tcSettings.SuspendLayout();
|
||||||
this.tpGeneral.SuspendLayout();
|
this.tpGeneral.SuspendLayout();
|
||||||
this.tpPaths.SuspendLayout();
|
this.tpPaths.SuspendLayout();
|
||||||
|
@ -756,7 +757,7 @@ private void InitializeComponent()
|
||||||
this.tpUploadRetry.Location = new System.Drawing.Point(4, 22);
|
this.tpUploadRetry.Location = new System.Drawing.Point(4, 22);
|
||||||
this.tpUploadRetry.Name = "tpUploadRetry";
|
this.tpUploadRetry.Name = "tpUploadRetry";
|
||||||
this.tpUploadRetry.Padding = new System.Windows.Forms.Padding(3);
|
this.tpUploadRetry.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tpUploadRetry.Size = new System.Drawing.Size(596, 337);
|
this.tpUploadRetry.Size = new System.Drawing.Size(596, 338);
|
||||||
this.tpUploadRetry.TabIndex = 2;
|
this.tpUploadRetry.TabIndex = 2;
|
||||||
this.tpUploadRetry.Text = "Retry";
|
this.tpUploadRetry.Text = "Retry";
|
||||||
this.tpUploadRetry.UseVisualStyleBackColor = true;
|
this.tpUploadRetry.UseVisualStyleBackColor = true;
|
||||||
|
@ -788,7 +789,7 @@ private void InitializeComponent()
|
||||||
this.tlpBackupDestinations.Padding = new System.Windows.Forms.Padding(5);
|
this.tlpBackupDestinations.Padding = new System.Windows.Forms.Padding(5);
|
||||||
this.tlpBackupDestinations.RowCount = 1;
|
this.tlpBackupDestinations.RowCount = 1;
|
||||||
this.tlpBackupDestinations.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
this.tlpBackupDestinations.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tlpBackupDestinations.Size = new System.Drawing.Size(590, 294);
|
this.tlpBackupDestinations.Size = new System.Drawing.Size(590, 295);
|
||||||
this.tlpBackupDestinations.TabIndex = 5;
|
this.tlpBackupDestinations.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// gbSecondaryImageUploaders
|
// gbSecondaryImageUploaders
|
||||||
|
@ -798,7 +799,7 @@ private void InitializeComponent()
|
||||||
this.gbSecondaryImageUploaders.Location = new System.Drawing.Point(8, 8);
|
this.gbSecondaryImageUploaders.Location = new System.Drawing.Point(8, 8);
|
||||||
this.gbSecondaryImageUploaders.Name = "gbSecondaryImageUploaders";
|
this.gbSecondaryImageUploaders.Name = "gbSecondaryImageUploaders";
|
||||||
this.gbSecondaryImageUploaders.Padding = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
this.gbSecondaryImageUploaders.Padding = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
||||||
this.gbSecondaryImageUploaders.Size = new System.Drawing.Size(185, 278);
|
this.gbSecondaryImageUploaders.Size = new System.Drawing.Size(185, 279);
|
||||||
this.gbSecondaryImageUploaders.TabIndex = 3;
|
this.gbSecondaryImageUploaders.TabIndex = 3;
|
||||||
this.gbSecondaryImageUploaders.TabStop = false;
|
this.gbSecondaryImageUploaders.TabStop = false;
|
||||||
this.gbSecondaryImageUploaders.Text = "Secondary image uploaders";
|
this.gbSecondaryImageUploaders.Text = "Secondary image uploaders";
|
||||||
|
@ -817,7 +818,7 @@ private void InitializeComponent()
|
||||||
this.lvSecondaryImageUploaders.Location = new System.Drawing.Point(3, 18);
|
this.lvSecondaryImageUploaders.Location = new System.Drawing.Point(3, 18);
|
||||||
this.lvSecondaryImageUploaders.MultiSelect = false;
|
this.lvSecondaryImageUploaders.MultiSelect = false;
|
||||||
this.lvSecondaryImageUploaders.Name = "lvSecondaryImageUploaders";
|
this.lvSecondaryImageUploaders.Name = "lvSecondaryImageUploaders";
|
||||||
this.lvSecondaryImageUploaders.Size = new System.Drawing.Size(179, 257);
|
this.lvSecondaryImageUploaders.Size = new System.Drawing.Size(179, 258);
|
||||||
this.lvSecondaryImageUploaders.TabIndex = 0;
|
this.lvSecondaryImageUploaders.TabIndex = 0;
|
||||||
this.lvSecondaryImageUploaders.UseCompatibleStateImageBehavior = false;
|
this.lvSecondaryImageUploaders.UseCompatibleStateImageBehavior = false;
|
||||||
this.lvSecondaryImageUploaders.View = System.Windows.Forms.View.Details;
|
this.lvSecondaryImageUploaders.View = System.Windows.Forms.View.Details;
|
||||||
|
@ -830,7 +831,7 @@ private void InitializeComponent()
|
||||||
this.gbSecondaryFileUploaders.Location = new System.Drawing.Point(396, 8);
|
this.gbSecondaryFileUploaders.Location = new System.Drawing.Point(396, 8);
|
||||||
this.gbSecondaryFileUploaders.Name = "gbSecondaryFileUploaders";
|
this.gbSecondaryFileUploaders.Name = "gbSecondaryFileUploaders";
|
||||||
this.gbSecondaryFileUploaders.Padding = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
this.gbSecondaryFileUploaders.Padding = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
||||||
this.gbSecondaryFileUploaders.Size = new System.Drawing.Size(186, 278);
|
this.gbSecondaryFileUploaders.Size = new System.Drawing.Size(186, 279);
|
||||||
this.gbSecondaryFileUploaders.TabIndex = 2;
|
this.gbSecondaryFileUploaders.TabIndex = 2;
|
||||||
this.gbSecondaryFileUploaders.TabStop = false;
|
this.gbSecondaryFileUploaders.TabStop = false;
|
||||||
this.gbSecondaryFileUploaders.Text = "Secondary file uploaders";
|
this.gbSecondaryFileUploaders.Text = "Secondary file uploaders";
|
||||||
|
@ -848,7 +849,7 @@ private void InitializeComponent()
|
||||||
this.lvSecondaryFileUploaders.Location = new System.Drawing.Point(3, 18);
|
this.lvSecondaryFileUploaders.Location = new System.Drawing.Point(3, 18);
|
||||||
this.lvSecondaryFileUploaders.MultiSelect = false;
|
this.lvSecondaryFileUploaders.MultiSelect = false;
|
||||||
this.lvSecondaryFileUploaders.Name = "lvSecondaryFileUploaders";
|
this.lvSecondaryFileUploaders.Name = "lvSecondaryFileUploaders";
|
||||||
this.lvSecondaryFileUploaders.Size = new System.Drawing.Size(180, 257);
|
this.lvSecondaryFileUploaders.Size = new System.Drawing.Size(180, 258);
|
||||||
this.lvSecondaryFileUploaders.TabIndex = 1;
|
this.lvSecondaryFileUploaders.TabIndex = 1;
|
||||||
this.lvSecondaryFileUploaders.UseCompatibleStateImageBehavior = false;
|
this.lvSecondaryFileUploaders.UseCompatibleStateImageBehavior = false;
|
||||||
this.lvSecondaryFileUploaders.View = System.Windows.Forms.View.Details;
|
this.lvSecondaryFileUploaders.View = System.Windows.Forms.View.Details;
|
||||||
|
@ -861,7 +862,7 @@ private void InitializeComponent()
|
||||||
this.gbSecondaryTextUploaders.Location = new System.Drawing.Point(199, 8);
|
this.gbSecondaryTextUploaders.Location = new System.Drawing.Point(199, 8);
|
||||||
this.gbSecondaryTextUploaders.Name = "gbSecondaryTextUploaders";
|
this.gbSecondaryTextUploaders.Name = "gbSecondaryTextUploaders";
|
||||||
this.gbSecondaryTextUploaders.Padding = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
this.gbSecondaryTextUploaders.Padding = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
||||||
this.gbSecondaryTextUploaders.Size = new System.Drawing.Size(191, 278);
|
this.gbSecondaryTextUploaders.Size = new System.Drawing.Size(191, 279);
|
||||||
this.gbSecondaryTextUploaders.TabIndex = 1;
|
this.gbSecondaryTextUploaders.TabIndex = 1;
|
||||||
this.gbSecondaryTextUploaders.TabStop = false;
|
this.gbSecondaryTextUploaders.TabStop = false;
|
||||||
this.gbSecondaryTextUploaders.Text = "Secondary text uploaders";
|
this.gbSecondaryTextUploaders.Text = "Secondary text uploaders";
|
||||||
|
@ -879,7 +880,7 @@ private void InitializeComponent()
|
||||||
this.lvSecondaryTextUploaders.Location = new System.Drawing.Point(3, 18);
|
this.lvSecondaryTextUploaders.Location = new System.Drawing.Point(3, 18);
|
||||||
this.lvSecondaryTextUploaders.MultiSelect = false;
|
this.lvSecondaryTextUploaders.MultiSelect = false;
|
||||||
this.lvSecondaryTextUploaders.Name = "lvSecondaryTextUploaders";
|
this.lvSecondaryTextUploaders.Name = "lvSecondaryTextUploaders";
|
||||||
this.lvSecondaryTextUploaders.Size = new System.Drawing.Size(185, 257);
|
this.lvSecondaryTextUploaders.Size = new System.Drawing.Size(185, 258);
|
||||||
this.lvSecondaryTextUploaders.TabIndex = 1;
|
this.lvSecondaryTextUploaders.TabIndex = 1;
|
||||||
this.lvSecondaryTextUploaders.UseCompatibleStateImageBehavior = false;
|
this.lvSecondaryTextUploaders.UseCompatibleStateImageBehavior = false;
|
||||||
this.lvSecondaryTextUploaders.View = System.Windows.Forms.View.Details;
|
this.lvSecondaryTextUploaders.View = System.Windows.Forms.View.Details;
|
||||||
|
@ -909,6 +910,7 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// tpPrint
|
// tpPrint
|
||||||
//
|
//
|
||||||
|
this.tpPrint.Controls.Add(this.cbPrintDontShowWindowsDialog);
|
||||||
this.tpPrint.Controls.Add(this.cbDontShowPrintSettingDialog);
|
this.tpPrint.Controls.Add(this.cbDontShowPrintSettingDialog);
|
||||||
this.tpPrint.Controls.Add(this.btnShowImagePrintSettings);
|
this.tpPrint.Controls.Add(this.btnShowImagePrintSettings);
|
||||||
this.tpPrint.Location = new System.Drawing.Point(4, 22);
|
this.tpPrint.Location = new System.Drawing.Point(4, 22);
|
||||||
|
@ -924,9 +926,9 @@ private void InitializeComponent()
|
||||||
this.cbDontShowPrintSettingDialog.AutoSize = true;
|
this.cbDontShowPrintSettingDialog.AutoSize = true;
|
||||||
this.cbDontShowPrintSettingDialog.Location = new System.Drawing.Point(16, 16);
|
this.cbDontShowPrintSettingDialog.Location = new System.Drawing.Point(16, 16);
|
||||||
this.cbDontShowPrintSettingDialog.Name = "cbDontShowPrintSettingDialog";
|
this.cbDontShowPrintSettingDialog.Name = "cbDontShowPrintSettingDialog";
|
||||||
this.cbDontShowPrintSettingDialog.Size = new System.Drawing.Size(172, 17);
|
this.cbDontShowPrintSettingDialog.Size = new System.Drawing.Size(203, 17);
|
||||||
this.cbDontShowPrintSettingDialog.TabIndex = 0;
|
this.cbDontShowPrintSettingDialog.TabIndex = 0;
|
||||||
this.cbDontShowPrintSettingDialog.Text = "Don\'t show print settings dialog";
|
this.cbDontShowPrintSettingDialog.Text = "Don\'t show image print settings dialog";
|
||||||
this.cbDontShowPrintSettingDialog.UseVisualStyleBackColor = true;
|
this.cbDontShowPrintSettingDialog.UseVisualStyleBackColor = true;
|
||||||
this.cbDontShowPrintSettingDialog.CheckedChanged += new System.EventHandler(this.cbDontShowPrintSettingDialog_CheckedChanged);
|
this.cbDontShowPrintSettingDialog.CheckedChanged += new System.EventHandler(this.cbDontShowPrintSettingDialog_CheckedChanged);
|
||||||
//
|
//
|
||||||
|
@ -934,9 +936,9 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
this.btnShowImagePrintSettings.Location = new System.Drawing.Point(16, 40);
|
this.btnShowImagePrintSettings.Location = new System.Drawing.Point(16, 40);
|
||||||
this.btnShowImagePrintSettings.Name = "btnShowImagePrintSettings";
|
this.btnShowImagePrintSettings.Name = "btnShowImagePrintSettings";
|
||||||
this.btnShowImagePrintSettings.Size = new System.Drawing.Size(168, 23);
|
this.btnShowImagePrintSettings.Size = new System.Drawing.Size(144, 23);
|
||||||
this.btnShowImagePrintSettings.TabIndex = 1;
|
this.btnShowImagePrintSettings.TabIndex = 1;
|
||||||
this.btnShowImagePrintSettings.Text = "Show image print settings...";
|
this.btnShowImagePrintSettings.Text = "Image print settings...";
|
||||||
this.btnShowImagePrintSettings.UseVisualStyleBackColor = true;
|
this.btnShowImagePrintSettings.UseVisualStyleBackColor = true;
|
||||||
this.btnShowImagePrintSettings.Click += new System.EventHandler(this.btnShowImagePrintSettings_Click);
|
this.btnShowImagePrintSettings.Click += new System.EventHandler(this.btnShowImagePrintSettings_Click);
|
||||||
//
|
//
|
||||||
|
@ -1077,6 +1079,17 @@ private void InitializeComponent()
|
||||||
this.pgSettings.TabIndex = 0;
|
this.pgSettings.TabIndex = 0;
|
||||||
this.pgSettings.ToolbarVisible = false;
|
this.pgSettings.ToolbarVisible = false;
|
||||||
//
|
//
|
||||||
|
// cbPrintDontShowWindowsDialog
|
||||||
|
//
|
||||||
|
this.cbPrintDontShowWindowsDialog.AutoSize = true;
|
||||||
|
this.cbPrintDontShowWindowsDialog.Location = new System.Drawing.Point(16, 72);
|
||||||
|
this.cbPrintDontShowWindowsDialog.Name = "cbPrintDontShowWindowsDialog";
|
||||||
|
this.cbPrintDontShowWindowsDialog.Size = new System.Drawing.Size(180, 17);
|
||||||
|
this.cbPrintDontShowWindowsDialog.TabIndex = 2;
|
||||||
|
this.cbPrintDontShowWindowsDialog.Text = "Don\'t show Windows print dialog";
|
||||||
|
this.cbPrintDontShowWindowsDialog.UseVisualStyleBackColor = true;
|
||||||
|
this.cbPrintDontShowWindowsDialog.CheckedChanged += new System.EventHandler(this.cbPrintDontShowWindowsDialog_CheckedChanged);
|
||||||
|
//
|
||||||
// ApplicationSettingsForm
|
// ApplicationSettingsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -1217,5 +1230,6 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.ColumnHeader chEncoderArgs;
|
private System.Windows.Forms.ColumnHeader chEncoderArgs;
|
||||||
private System.Windows.Forms.ColumnHeader chEncoderOutputExtension;
|
private System.Windows.Forms.ColumnHeader chEncoderOutputExtension;
|
||||||
private System.Windows.Forms.Button btnEncoderDuplicate;
|
private System.Windows.Forms.Button btnEncoderDuplicate;
|
||||||
|
private System.Windows.Forms.CheckBox cbPrintDontShowWindowsDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -119,6 +119,7 @@ private void LoadSettings()
|
||||||
|
|
||||||
// Print
|
// Print
|
||||||
cbDontShowPrintSettingDialog.Checked = Program.Settings.DontShowPrintSettingsDialog;
|
cbDontShowPrintSettingDialog.Checked = Program.Settings.DontShowPrintSettingsDialog;
|
||||||
|
cbPrintDontShowWindowsDialog.Checked = !Program.Settings.PrintSettings.ShowPrintDialog;
|
||||||
|
|
||||||
// Profiles
|
// Profiles
|
||||||
if (Program.Settings.VideoEncoders.Count == 0)
|
if (Program.Settings.VideoEncoders.Count == 0)
|
||||||
|
@ -460,6 +461,11 @@ private void btnShowImagePrintSettings_Click(object sender, EventArgs e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cbPrintDontShowWindowsDialog_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Program.Settings.PrintSettings.ShowPrintDialog = !cbPrintDontShowWindowsDialog.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Print
|
#endregion Print
|
||||||
|
|
||||||
#region Profiles
|
#region Profiles
|
||||||
|
|
|
@ -1,4 +1,29 @@
|
||||||
using HelpersLib;
|
#region License Information (GPL v3)
|
||||||
|
|
||||||
|
/*
|
||||||
|
ShareX - A program that allows you to take screenshots and share any file type
|
||||||
|
Copyright (C) 2008-2014 ShareX Developers
|
||||||
|
|
||||||
|
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 2
|
||||||
|
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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endregion License Information (GPL v3)
|
||||||
|
|
||||||
|
using HelpersLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
Loading…
Reference in a new issue