Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions PasteIntoFile/Dialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions PasteIntoFile/Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private void updateUiFromSettings() {
_disableUiEvents = true;
chkContinuousMode.Checked = Settings.Default.continuousMode;
chkAutoSave.Checked = Settings.Default.autoSave;
chkDisableLiveClipboardUpdate.Checked = Settings.Default.disableLiveClipboardUpdate;
updateSavebutton();
_disableUiEvents = false;
}
Expand Down Expand Up @@ -286,22 +287,35 @@ private bool readClipboard() {

private void ClipboardChanged(Object sender, SharpClipboard.ClipboardChangedEventArgs e) {
var previousClipboardTimestamp = clipData.Timestamp;
readClipboard();

// continuous batch mode

// continuous batch mode - must work even when live updates are disabled
if (chkContinuousMode.Checked) {
// Read clipboard to get latest data (needed for batch mode)
readClipboard();

var ignore = false;
// ignore duplicate updates within 100ms
ignore |= (clipData.Timestamp - previousClipboardTimestamp).TotalMilliseconds <= 500;
// ignore internal updates due to clipboard patching
ignore |= Clipboard.ContainsData(Program.PATCHED_CLIPBOARD_MAGIC);

if (!ignore) {
// In batch mode, always update UI and save (filename field is disabled anyway)
updateContentPreview();
if (!chkAppend.Checked) updateFilename();
save();
updateSavebutton();
}
} else if (!chkDisableLiveClipboardUpdate.Checked) {
// Normal mode: only update UI (preview/filename) if live updates are enabled
// Read clipboard to get latest data
readClipboard();
// Use checkbox state (per-session) instead of persistent setting
updateContentPreview();
updateFilename();
}
// If checkbox is checked and not in batch mode, do nothing
// (allows user to edit filename without it being overwritten)
}


Expand Down Expand Up @@ -374,6 +388,7 @@ private void updateSavebutton() {
txtFilename.Enabled = !chkContinuousMode.Checked || chkAppend.Checked;
btnSave.Enabled = !chkContinuousMode.Checked;
btnSave.Text = chkContinuousMode.Checked ? string.Format(Resources.str_n_saved, saveCount) : Resources.str_save;
chkDisableLiveClipboardUpdate.Enabled = !chkContinuousMode.Checked;
}

private void btnSave_Click(object sender, EventArgs e) {
Expand Down Expand Up @@ -511,6 +526,12 @@ private void chkAppend_CheckedChanged(object sender, EventArgs e) {
updateSavebutton();
}

private void chkDisableLiveClipboardUpdate_CheckedChanged(object sender, EventArgs e) {
if (_disableUiEvents) return;
Settings.Default.disableLiveClipboardUpdate = chkDisableLiveClipboardUpdate.Checked;
Settings.Default.Save();
}

private void chkContinuousMode_CheckedChanged(object sender, EventArgs e) {
if (_disableUiEvents) return;
Settings.Default.continuousMode = chkContinuousMode.Checked; // updates UI via event
Expand Down
18 changes: 18 additions & 0 deletions PasteIntoFile/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions PasteIntoFile/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ These setting will take effect on the next login.</value>
<data name="str_clear_clipboard_tooltip" xml:space="preserve">
<value>Clears the clipboard after its content has been saved.</value>
</data>
<data name="str_disable_live_clipboard_update" xml:space="preserve">
<value>Disable live clipboard update</value>
<comment>Checkbox to disable live clipboard updates in the preview/rename dialog</comment>
</data>
<data name="str_disable_live_clipboard_update_tooltip" xml:space="preserve">
<value>When enabled, the preview and filename fields will not update automatically when the clipboard changes. This prevents the dialog from being overwritten while you are editing the filename or copying text to use as a filename.</value>
</data>
<data name="str_autosave_tooltip" xml:space="preserve">
<value>Saves clipboard data to default filetype without prompt.
Hold SHIFT to temporarly invert this setting.</value>
Expand Down
12 changes: 12 additions & 0 deletions PasteIntoFile/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions PasteIntoFile/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
<Setting Name="language" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="disableLiveClipboardUpdate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

2 changes: 2 additions & 0 deletions PasteIntoFile/Wizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ private void menuClearClipboard_CheckedChanged(object sender, EventArgs e) {
}
}



private void finish_Click(object sender, EventArgs e) {
Settings.Default.firstLaunch = false;
Settings.Default.Save();
Expand Down