Skip to content

Commit 92932f0

Browse files
chandratheltos
andauthored
Add setting to disable live clipboard updates in preview dialog (#89)
Co-authored-by: Eltos <[email protected]>
1 parent a8ef4ed commit 92932f0

File tree

7 files changed

+90
-3
lines changed

7 files changed

+90
-3
lines changed

PasteIntoFile/Dialog.Designer.cs

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PasteIntoFile/Dialog.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ private void updateUiFromSettings() {
179179
_disableUiEvents = true;
180180
chkContinuousMode.Checked = Settings.Default.continuousMode;
181181
chkAutoSave.Checked = Settings.Default.autoSave;
182+
chkEnableLiveClipboardUpdate.Checked = Settings.Default.enableLiveClipboardUpdate;
182183
updateSavebutton();
183184
_disableUiEvents = false;
184185
}
@@ -285,6 +286,9 @@ private bool readClipboard() {
285286

286287

287288
private void ClipboardChanged(Object sender, SharpClipboard.ClipboardChangedEventArgs e) {
289+
// Only process update if live update enabled, or in batch mode
290+
if (!chkEnableLiveClipboardUpdate.Checked && !chkContinuousMode.Checked) return;
291+
288292
var previousClipboardTimestamp = clipData.Timestamp;
289293
readClipboard();
290294

@@ -299,7 +303,6 @@ private void ClipboardChanged(Object sender, SharpClipboard.ClipboardChangedEven
299303
if (!ignore) {
300304
if (!chkAppend.Checked) updateFilename();
301305
save();
302-
updateSavebutton();
303306
}
304307
}
305308
}
@@ -374,6 +377,7 @@ private void updateSavebutton() {
374377
txtFilename.Enabled = !chkContinuousMode.Checked || chkAppend.Checked;
375378
btnSave.Enabled = !chkContinuousMode.Checked;
376379
btnSave.Text = chkContinuousMode.Checked ? string.Format(Resources.str_n_saved, saveCount) : Resources.str_save;
380+
chkEnableLiveClipboardUpdate.Enabled = !chkContinuousMode.Checked;
377381
}
378382

379383
private void btnSave_Click(object sender, EventArgs e) {
@@ -511,6 +515,12 @@ private void chkAppend_CheckedChanged(object sender, EventArgs e) {
511515
updateSavebutton();
512516
}
513517

518+
private void chkEnableLiveClipboardUpdate_CheckedChanged(object sender, EventArgs e) {
519+
if (_disableUiEvents) return;
520+
Settings.Default.enableLiveClipboardUpdate = chkEnableLiveClipboardUpdate.Checked;
521+
Settings.Default.Save();
522+
}
523+
514524
private void chkContinuousMode_CheckedChanged(object sender, EventArgs e) {
515525
if (_disableUiEvents) return;
516526
Settings.Default.continuousMode = chkContinuousMode.Checked; // updates UI via event

PasteIntoFile/Properties/Resources.Designer.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PasteIntoFile/Properties/Resources.resx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ These setting will take effect on the next login.</value>
277277
<data name="str_clear_clipboard_tooltip" xml:space="preserve">
278278
<value>Clears the clipboard after its content has been saved.</value>
279279
</data>
280+
<data name="str_enable_live_clipboard_update" xml:space="preserve">
281+
<value>Live clipboard update</value>
282+
<comment>Checkbox to enable live clipboard updates in the preview/rename dialog</comment>
283+
</data>
284+
<data name="str_enable_live_clipboard_update_tooltip" xml:space="preserve">
285+
<value>When enabled, the preview and filename fields will update automatically when the clipboard changes. Uncheck this to prevent the dialog from being overwritten while you are editing the filename or copying text to use as a filename.</value>
286+
</data>
280287
<data name="str_autosave_tooltip" xml:space="preserve">
281288
<value>Saves clipboard data to default filetype without prompt.
282289
Hold SHIFT to temporarly invert this setting.</value>

PasteIntoFile/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PasteIntoFile/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
<Setting Name="language" Type="System.String" Scope="User">
5454
<Value Profile="(Default)" />
5555
</Setting>
56+
<Setting Name="enableLiveClipboardUpdate" Type="System.Boolean" Scope="User">
57+
<Value Profile="(Default)">True</Value>
58+
</Setting>
5659
</Settings>
5760
</SettingsFile>
5861

PasteIntoFile/Wizard.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ private void menuClearClipboard_CheckedChanged(object sender, EventArgs e) {
213213
}
214214
}
215215

216+
217+
216218
private void finish_Click(object sender, EventArgs e) {
217219
Settings.Default.firstLaunch = false;
218220
Settings.Default.Save();

0 commit comments

Comments
 (0)