diff --git a/PasteIntoFile/Dialog.Designer.cs b/PasteIntoFile/Dialog.Designer.cs index f730386..b22ba0a 100644 --- a/PasteIntoFile/Dialog.Designer.cs +++ b/PasteIntoFile/Dialog.Designer.cs @@ -41,7 +41,6 @@ private void InitializeComponent() { this.btnBrowseForFolder = new System.Windows.Forms.Button(); this.versionInfoLabel = new System.Windows.Forms.LinkLabel(); this.infoLinkLabel = new System.Windows.Forms.LinkLabel(); - this.chkClrClipboard = new System.Windows.Forms.CheckBox(); this.chkAutoSave = new System.Windows.Forms.CheckBox(); this.box = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); @@ -225,19 +224,6 @@ private void InitializeComponent() { this.infoLinkLabel.Text = Resources.str_main_info; this.infoLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.infoLinkLabel_LinkClicked); // - // chkClrClipboard - // - this.chkClrClipboard.AutoSize = true; - this.chkClrClipboard.Location = new System.Drawing.Point(4, 0); - this.chkClrClipboard.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.chkClrClipboard.Name = "chkClrClipboard"; - this.chkClrClipboard.Size = new System.Drawing.Size(169, 24); - this.chkClrClipboard.TabIndex = 5; - this.chkClrClipboard.Text = Resources.str_clear_clipboard; - this.chkClrClipboard.UseVisualStyleBackColor = true; - this.toolTip.SetToolTip(this.chkClrClipboard, Resources.str_clear_clipboard_tooltip); - this.chkClrClipboard.CheckedChanged += new System.EventHandler(this.ChkClrClipboard_CheckedChanged); - // // chkAutoSave // this.chkAutoSave.AutoSize = true; @@ -358,7 +344,6 @@ private void InitializeComponent() { this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel2.Controls.Add(this.btnSave, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.chkClrClipboard, 0, 0); this.tableLayoutPanel2.Controls.Add(this.chkContinuousMode, 0, 1); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel2.Location = new System.Drawing.Point(15, 125); @@ -462,7 +447,6 @@ private void InitializeComponent() { private System.Windows.Forms.Button btnBrowseForFolder; private System.Windows.Forms.LinkLabel versionInfoLabel; private System.Windows.Forms.LinkLabel infoLinkLabel; - private System.Windows.Forms.CheckBox chkClrClipboard; private System.Windows.Forms.CheckBox chkAutoSave; private System.Windows.Forms.GroupBox box; private System.Windows.Forms.ToolTip toolTip; diff --git a/PasteIntoFile/Dialog.cs b/PasteIntoFile/Dialog.cs index 7eb58ef..cd44605 100644 --- a/PasteIntoFile/Dialog.cs +++ b/PasteIntoFile/Dialog.cs @@ -92,7 +92,6 @@ public Dialog(string location = null, string filename = null, bool? showDialogOv if (saveIntoSubdir) location += @"\" + formatFilenameTemplate(Settings.Default.subdirTemplate); txtCurrentLocation.Text = location; updateUiFromSettings(); - chkClrClipboard.Checked = clearClipboardOverwrite ?? chkClrClipboard.Checked; Settings.Default.PropertyChanged += (sender, args) => updateUiFromSettings(); @@ -114,7 +113,7 @@ public Dialog(string location = null, string filename = null, bool? showDialogOv // directly save without showing a dialog Opacity = 0; // prevent dialog from showing up for a fraction of a second - var file = clipRead ? save(overwriteIfExists) : null; + var file = clipRead ? save(overwriteIfExists, clearClipboardOverwrite) : null; if (file != null) { Environment.ExitCode = 0; @@ -161,7 +160,6 @@ private void CloseAsSoonAsPossible() { private void updateUiFromSettings() { disableUiEvents = true; - chkClrClipboard.Checked = Settings.Default.clrClipboard; chkContinuousMode.Checked = Settings.Default.continuousMode; chkAutoSave.Checked = Settings.Default.autoSave; updateSavebutton(); @@ -341,7 +339,7 @@ private void btnSave_Click(object sender, EventArgs e) { } } - string save(bool overwriteIfExists = false) { + string save(bool overwriteIfExists = false, bool? clearClipboardOverwrite = false) { try { string dirname = Path.GetFullPath(txtCurrentLocation.Text); string ext = comExt.Text.ToLowerInvariant().Trim(); @@ -382,7 +380,7 @@ string save(bool overwriteIfExists = false) { return null; } - if (chkClrClipboard.Checked) { + if (clearClipboardOverwrite ?? Settings.Default.clrClipboard) { clipMonitor.MonitorClipboard = false; // to prevent callback during batch mode Clipboard.Clear(); clipMonitor.MonitorClipboard = true; @@ -431,12 +429,6 @@ private void Main_KeyPress(object sender, KeyPressEventArgs e) { } } - private void ChkClrClipboard_CheckedChanged(object sender, EventArgs e) { - if (disableUiEvents) return; - Settings.Default.clrClipboard = chkClrClipboard.Checked; - Settings.Default.Save(); - } - private void chkContinuousMode_CheckedChanged(object sender, EventArgs e) { if (disableUiEvents) return; if (chkContinuousMode.Checked) { diff --git a/PasteIntoFile/Wizard.Designer.cs b/PasteIntoFile/Wizard.Designer.cs index 77c6eb9..0d738b0 100644 --- a/PasteIntoFile/Wizard.Designer.cs +++ b/PasteIntoFile/Wizard.Designer.cs @@ -302,6 +302,12 @@ private void InitializeComponent() { this.settingsMenuUpdateChecks.CheckedChanged += new EventHandler(this.menuUpdateChecks_CheckedChanged); this.settingsMenuUpdateChecks.Text = Resources.str_wizard_notify_on_updates; this.settingsMenu.Items.Add(this.settingsMenuUpdateChecks); + this.settingsMenuClearClipboard = new ToolStripMenuItem(); + this.settingsMenuClearClipboard.CheckOnClick = true; + this.settingsMenuClearClipboard.CheckedChanged += new EventHandler(this.menuClearClipboard_CheckedChanged); + this.settingsMenuClearClipboard.Text = Resources.str_clear_clipboard; + this.settingsMenuClearClipboard.ToolTipText = Resources.str_clear_clipboard_tooltip; + this.settingsMenu.Items.Add(this.settingsMenuClearClipboard); // // settings button // @@ -338,6 +344,7 @@ private void InitializeComponent() { private System.Windows.Forms.Label settingsButton; private System.Windows.Forms.ContextMenuStrip settingsMenu; private System.Windows.Forms.ToolStripMenuItem settingsMenuUpdateChecks; + private System.Windows.Forms.ToolStripMenuItem settingsMenuClearClipboard; private System.Windows.Forms.LinkLabel version; private System.Windows.Forms.Button finish; private System.Windows.Forms.CheckBox contextEntryCheckBoxPaste; diff --git a/PasteIntoFile/Wizard.cs b/PasteIntoFile/Wizard.cs index 863f9bf..9063fcb 100644 --- a/PasteIntoFile/Wizard.cs +++ b/PasteIntoFile/Wizard.cs @@ -143,6 +143,7 @@ private void ChkPatching_CheckedChanged(object sender, EventArgs e) { private void settingsButton_Click(object sender, EventArgs e) { // update settingsMenuUpdateChecks.Checked = Settings.Default.updateChecksEnabled; + settingsMenuClearClipboard.Checked = Settings.Default.clrClipboard; // show it Point ptLowerLeft = new Point(4, settingsButton.Height); ptLowerLeft = settingsButton.PointToScreen(ptLowerLeft); @@ -156,6 +157,13 @@ private void menuUpdateChecks_CheckedChanged(object sender, EventArgs e) { } } + private void menuClearClipboard_CheckedChanged(object sender, EventArgs e) { + if (Settings.Default.clrClipboard != settingsMenuClearClipboard.Checked) { + Settings.Default.clrClipboard = settingsMenuClearClipboard.Checked; + Settings.Default.Save(); + } + } + private void finish_Click(object sender, EventArgs e) { Settings.Default.firstLaunch = false; Settings.Default.Save();