Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add advance option of clipboard restore delay after copy buffer use #569

Merged
merged 3 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 18 additions & 9 deletions AdvGeneral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ END_MESSAGE_MAP()
#define SETTING_FIND_AS_TYPE 16
#define SETTING_ENSURE_WINDOW_IS_VISIBLE 17
#define SETTING_SHOW_GROUP_CLIPS_IN_LIST 18
#define SETTING_PROMP_ON_DELETE 19
#define SETTING_PROMPT_ON_DELETE 19
#define SETTING_ALWAYS_SHOW_SCROLL_BAR 20
#define SETTING_PASTE_AS_ADMIN 21
#define SETTTING_SHOW_IN_TASKBAR 22
Expand Down Expand Up @@ -136,9 +136,10 @@ END_MESSAGE_MAP()
#define SETTING_DEBUG_TO_OUTPUT_STRING 85
#define SETTING_NETWORK_BIND_IP_ADDRESS 86
#define SETTING_DISABLE_FRIENDS 87
#define SETTING_IGNORE_FALSE_COPIES_DEALY 88
#define SETTING_IGNORE_FALSE_COPIES_DELAY 88
#define SETTING_REFRESH_VIEW_AFTER_PASTE 89
#define SETTING_SLUGIFY_SEPARATOR 90
#define SETTING_CLIPBOARD_RESTORE_AFTER_COPY_BUFFER_DELAY 91


BOOL CAdvGeneral::OnInitDialog()
Expand Down Expand Up @@ -200,12 +201,12 @@ BOOL CAdvGeneral::OnInitDialog()
AddTrueFalse(pGroupTest, _T("Ensure entire window is visible"), CGetSetOptions::GetEnsureEntireWindowCanBeSeen(), SETTING_ENSURE_WINDOW_IS_VISIBLE);
AddTrueFalse(pGroupTest, _T("Find as you type"), CGetSetOptions::GetFindAsYouType(), SETTING_FIND_AS_TYPE);

pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("First ten hot heys start index"), (long)CGetSetOptions::GetFirstTenHotKeysStart(), _T(""), SETTING_FIRST_TEN_HOTKEYS_START));
pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("First ten hot heys font size"), (long)CGetSetOptions::GetFirstTenHotKeysFontSize(), _T(""), SETTING_FIRST_TEN_HOTKEYS_FONT_SIZE));
pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("First ten hot keys start index"), (long)CGetSetOptions::GetFirstTenHotKeysStart(), _T(""), SETTING_FIRST_TEN_HOTKEYS_START));
pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("First ten hot keys font size"), (long)CGetSetOptions::GetFirstTenHotKeysFontSize(), _T(""), SETTING_FIRST_TEN_HOTKEYS_FONT_SIZE));

AddTrueFalse(pGroupTest, _T("Hide Ditto on hot key if Ditto is visible"), CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown(), SETTING_HIDE_ON_HOTKEY_IF_VISIBLE);

pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Ignore copies faster than (ms) (default: 500)"), (long)CGetSetOptions::GetSaveClipDelay(), _T(""), SETTING_IGNORE_FALSE_COPIES_DEALY));
pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Ignore copies faster than (ms) (default: 500)"), (long)CGetSetOptions::GetSaveClipDelay(), _T(""), SETTING_IGNORE_FALSE_COPIES_DELAY));

pGroupTest->AddSubItem( new CMFCPropertyGridProperty(_T("Maximum clip size in bytes (0 for no limit)"), g_Opt.m_lMaxClipSizeInBytes, _T(""), SETTING_MAX_CLIP_SIZE));

Expand All @@ -227,12 +228,14 @@ BOOL CAdvGeneral::OnInitDialog()
pGroupTest->AddSubItem(pFileProp);

AddTrueFalse(pGroupTest, _T("Paste clip in active window after selection"), CGetSetOptions::GetSendPasteAfterSelection(), SETTING_PASTE_IN_ACTIVE_WINDOW);
AddTrueFalse(pGroupTest, _T("Prompt when deleting clips"), CGetSetOptions::GetPromptWhenDeletingClips(), SETTING_PROMP_ON_DELETE);
AddTrueFalse(pGroupTest, _T("Prompt when deleting clips"), CGetSetOptions::GetPromptWhenDeletingClips(), SETTING_PROMPT_ON_DELETE);

AddTrueFalse(pGroupTest, _T("Revert to top level group on close"), CGetSetOptions::GetRevertToTopLevelGroup(), SETTING_REVERT_TO_TOP_LEVEL_GROUP);

AddTrueFalse(pGroupTest, _T("Refresh view after paste"), CGetSetOptions::GetRefreshViewAfterPasting(), SETTING_REFRESH_VIEW_AFTER_PASTE);

pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("clipboard restore after copy buffer sent paste delay (ms, default: 750))"), (long)(CGetSetOptions::GetDittoRestoreClipboardDelay()), _T(""), SETTING_CLIPBOARD_RESTORE_AFTER_COPY_BUFFER_DELAY));

pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Save clipboard delay (ms, default: 100))"), (long)(CGetSetOptions::GetProcessDrawClipboardDelay()), _T(""), SETTING_CLIPBOARD_SAVE_DELAY));

AddTrueFalse(pGroupTest, _T("Save multi-pastes"), CGetSetOptions::GetSaveMultiPaste(), SETTING_SAVE_MULTI_PASTE);
Expand Down Expand Up @@ -271,7 +274,7 @@ BOOL CAdvGeneral::OnInitDialog()
AddTrueFalse(pGroupTest, _T("Write debug to file"), CGetSetOptions::GetEnableDebugLogging(), SETTING_DEBUG_TO_FILE);
AddTrueFalse(pGroupTest, _T("Write debug to OutputDebugString"), CGetSetOptions::GetEnableDebugLogging(), SETTING_DEBUG_TO_OUTPUT_STRING);

CMFCPropertyGridProperty * regexFilterGroup = new CMFCPropertyGridProperty(_T("Exlude clips by Regular Expressions"));
CMFCPropertyGridProperty * regexFilterGroup = new CMFCPropertyGridProperty(_T("Exclude clips by Regular Expressions"));
m_propertyGrid.AddProperty(regexFilterGroup);

CString processFilterDesc = _T("Process making the copy first must match this before the Regex will be applied (empty or * for all processes) (separate multiples by ;)");
Expand Down Expand Up @@ -544,7 +547,7 @@ void CAdvGeneral::OnBnClickedOk()
CGetSetOptions::SetShowAllClipsInMainList(val);
}
break;
case SETTING_PROMP_ON_DELETE:
case SETTING_PROMPT_ON_DELETE:
if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
{
BOOL val = false;
Expand Down Expand Up @@ -792,6 +795,12 @@ void CAdvGeneral::OnBnClickedOk()
CGetSetOptions::SetRealSendKeysDelay(pNewValue->lVal);
}
break;
case SETTING_CLIPBOARD_RESTORE_AFTER_COPY_BUFFER_DELAY:
if (pNewValue->lVal != pOrigValue->lVal)
{
CGetSetOptions::SetDittoRestoreClipboardDelay(pNewValue->lVal);
}
break;
case SETTING_DOUBLE_KEYSTROKE_TIMEOUT:
if (pNewValue->lVal != pOrigValue->lVal)
{
Expand Down Expand Up @@ -912,7 +921,7 @@ void CAdvGeneral::OnBnClickedOk()
CGetSetOptions::SetAllowFriends(val);
}
break;
case SETTING_IGNORE_FALSE_COPIES_DEALY:
case SETTING_IGNORE_FALSE_COPIES_DELAY:
if (pNewValue->lVal != pOrigValue->lVal)
{
CGetSetOptions::SetSaveClipDelay(pNewValue->lVal);
Expand Down
8 changes: 4 additions & 4 deletions CP_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ BOOL CCP_MainApp::InitInstance()
else if(cmdInfo.m_bConnect || cmdInfo.m_bDisconnect)
{
//First get the saved hwnd and send it a message
//If ditt is running then this will return 1, meening the running ditto process
//If ditto is running then this will return 1, meaning the running ditto process
//handled this message
//If it didn't handle the message(ditto is not running) then startup this processes of ditto
//disconnected from the clipboard
Expand Down Expand Up @@ -297,23 +297,23 @@ BOOL CCP_MainApp::InitInstance()
else if(cmdInfo.m_bOpenWindow || cmdInfo.m_bCloseWindow)
{
//First get the saved hwnd and send it a message
//If ditt is running then this will return 1, meening the running ditto process
//If ditto is running then this will return 1, meaning the running ditto process
//handled this message
//If it didn't handle the message(ditto is not running) then startup this processes of ditto
//disconnected from the clipboard
LRESULT ret = 0;
HWND hWnd = (HWND)(LONG_PTR)CGetSetOptions::GetMainHWND();
if(hWnd)
{
ret = ::SendMessage(hWnd, WM_OPEN_CLOSE_WINDWOW, cmdInfo.m_bOpenWindow, cmdInfo.m_bCloseWindow);
ret = ::SendMessage(hWnd, WM_OPEN_CLOSE_WINDOW, cmdInfo.m_bOpenWindow, cmdInfo.m_bCloseWindow);
}

return FALSE;
}
else if (cmdInfo.m_exit)
{
//First get the saved hwnd and send it a message
//If ditt is running then this will return 1, meening the running ditto process
//If ditto is running then this will return 1, meaning the running ditto process
//handled this message
//If it didn't handle the message(ditto is not running) then startup this processes of ditto
//disconnected from the clipboard
Expand Down
6 changes: 4 additions & 2 deletions Debug/Language/Korean.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@
<Item English_Text = "Activate Ditto" ID = "2048">Ditto 활성화</Item>
<Item English_Text = "Win" ID = "2035">Win</Item>
<Item English_Text = "Named Copy" ID = "2049">지명 복사</Item>
<!-- No more Named Copy -->
<Item English_Text = "Text Only Paste" ID = "2049">텍스트만 붙이기</Item>
<Item English_Text = "Win" ID = "2036">Win</Item>
<Item English_Text = "Global Hot Keys for Last Ten Items Copied" ID = "2051">최근 10개 클립 접근 단축키</Item>
<Item English_Text = "Send Paste (Otherwise it will just load the item on the clipboard)" ID = "1042">붙여넣기(미선택 시, 붙여넣기 없이 클립보드에 불러오기만 수행)</Item>
Expand Down Expand Up @@ -460,7 +462,7 @@
<Item English_Text = "Backup Database" ID = "32960">데이터베이스 백업</Item>
<Item English_Text = "Restore Database" ID = "32961">데이터베이스 복구</Item>

<Item English_Text = "Delete All Non Used Clips" ID = "32968">미사용 클립 전체 삭제</Item>
<Item English_Text = "Delete All Non Used Clips" ID = "32969">미사용 클립 전체 삭제</Item>

</Ditto_Tray_Icon_Menu>

Expand Down Expand Up @@ -607,7 +609,7 @@
<Item English_Text = "Paste Capitalize" ID = "44">단어별 첫글자만 대문자로 붙여넣기</Item>
<Item English_Text = "Paste Sentence Case" ID = "45">문장별 첫글자만 대문자로 붙여넣기</Item>
<Item English_Text = "Paste Remove Line Feeds" ID = "46">줄바꿈 없이 붙여넣기</Item>
<Item English_Text = "Paste Add One Line Feed" ID = "47">붙여넣고 줄바꿈 추기</Item>
<Item English_Text = "Paste Add One Line Feed" ID = "47">붙여넣고 줄바꿈 추가</Item>
<Item English_Text = "Paste Add Two Line Feeds" ID = "48">붙여넣고 줄바꿈 두번 추가</Item>
<Item English_Text = "Paste Typoglycemia" ID = "49">단어내 글자 섞어 붙여넣기</Item>
<Item English_Text = "Send to friend 1" ID = "50">친구 1에게 보내기</Item>
Expand Down
2 changes: 1 addition & 1 deletion DittoCopyBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ UINT CDittoCopyBuffer::DelayRestoreClipboard(LPVOID pParam)

if(GetKeyState(VK_SHIFT) & 0x8000)
{
Log(_T("Shift key is down not restoring clipbard, custom Buffer on normal clipboard"));
Log(_T("Shift key is down not restoring clipboard, custom Buffer on normal clipboard"));
}
else
{
Expand Down
16 changes: 8 additions & 8 deletions MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_DESTROY()
ON_COMMAND(ID_FIRST_NEWCLIP, OnFirstNewclip)
ON_MESSAGE(WM_SET_CONNECTED, OnSetConnected)
ON_MESSAGE(WM_OPEN_CLOSE_WINDWOW, OnOpenCloseWindow)
ON_MESSAGE(WM_OPEN_CLOSE_WINDOW, OnOpenCloseWindow)
ON_MESSAGE(WM_LOAD_ClIP_ON_CLIPBOARD, OnLoadClipOnClipboard)
ON_COMMAND(ID_FIRST_GLOBALHOTKEYS, &CMainFrame::OnFirstGlobalhotkeys)
ON_MESSAGE(WM_GLOBAL_CLIPS_CLOSED, OnGlobalClipsClosed)
Expand Down Expand Up @@ -287,22 +287,22 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)

if(m_bMovedSelectionMoveKeyState == false)
{
Log(_T("Setting flag m_bMovedSelectionMoveKeyState to true, will paste when modifer keys are up"));
Log(_T("Setting flag m_bMovedSelectionMoveKeyState to true, will paste when modifier keys are up"));
}

m_quickPaste.MoveSelection(true);
m_bMovedSelectionMoveKeyState = true;
}
else if(g_Opt.m_HideDittoOnHotKeyIfAlreadyShown && m_quickPaste.IsWindowTopLevel() && g_Opt.GetShowPersistent() == FALSE)
{
Log(_T("On Show Ditto HotKey, window is alread visible, hiding window"));
Log(_T("On Show Ditto HotKey, window is already visible, hiding window"));
m_quickPaste.HideQPasteWnd();
}
else
{
Log(_T("On Show Ditto HotKey, showing window"));

StartKeyModifyerTimer();
StartKeyModifierTimer();

ShowQPasteWithActiveWindowCheck();
}
Expand Down Expand Up @@ -577,7 +577,7 @@ void CMainFrame::DoFirstTenPositionsPaste(int nPos)
CATCH_SQLITE_EXCEPTION
}

void CMainFrame::StartKeyModifyerTimer()
void CMainFrame::StartKeyModifierTimer()
{
if (g_Opt.m_moveSelectionOnOpenHotkey)
{
Expand Down Expand Up @@ -629,7 +629,7 @@ void CMainFrame::PasteOrShowGroup(int dbId, BOOL updateClipTime, BOOL activeTarg

SetTimer(GROUP_DOUBLE_CLICK, doubleClickTime, 0);

Log(StrF(_T("First Press of group hot key, group Id: %d, timout: %d"), dbId, doubleClickTime));
Log(StrF(_T("First Press of group hot key, group Id: %d, timeout: %d"), dbId, doubleClickTime));
}
}
else
Expand Down Expand Up @@ -786,7 +786,7 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
if (theApp.EnterGroupID(m_doubleClickGroupId, FALSE, TRUE))
{
theApp.m_activeWnd.TrackActiveWnd(true);
StartKeyModifyerTimer();
StartKeyModifierTimer();
m_quickPaste.ShowQPasteWnd(this, false, true, FALSE);
}
}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ LRESULT CMainFrame::OnOpenCloseWindow(WPARAM wParam, LPARAM lParam)
{
if(wParam)
{
StartKeyModifyerTimer();
StartKeyModifierTimer();
ShowQPasteWithActiveWindowCheck();
}
else if(lParam)
Expand Down
2 changes: 1 addition & 1 deletion MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CMainFrame: public CFrameWnd
void DoFirstTenPositionsPaste(int nPos);
void PasteOrShowGroup(int dbId, BOOL updateClipTime, BOOL activeTarget, BOOL sendPaste, bool pastedFromGroup);

void StartKeyModifyerTimer();
void StartKeyModifierTimer();

bool PasteQuickPasteEntry(CString csQuickPaste);
bool SaveQuickPasteEntry(CString csQuickPaste, CClipList *pClipList);
Expand Down
2 changes: 1 addition & 1 deletion Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ __int64 GetLastWriteTime(const CString &csFile);
#define WM_OPTIONS_CLOSED WM_USER + 219
#define WM_SHOW_OPTIONS WM_USER + 220
#define WM_DELETE_CLIPS_CLOSED WM_USER + 221
#define WM_OPEN_CLOSE_WINDWOW WM_USER + 222
#define WM_OPEN_CLOSE_WINDOW WM_USER + 222
#define WM_SAVE_CLIPBOARD WM_USER + 223
#define WM_READD_TASKBAR_ICON WM_USER + 224
#define WM_REOPEN_DATABASE WM_USER + 225
Expand Down
4 changes: 2 additions & 2 deletions QuickPasteKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BEGIN_MESSAGE_MAP(CQuickPasteKeyboard, CPropertyPage)
ON_CBN_SELCHANGE(IDC_COMBO_ALL_ASSIGNED, &CQuickPasteKeyboard::OnCbnSelchangeComboAllAssigned)
ON_BN_CLICKED(IDC_BUTTON_REMOVE, &CQuickPasteKeyboard::OnBnClickedButtonRemove)
ON_BN_CLICKED(IDC_BUTTON_ADD, &CQuickPasteKeyboard::OnBnClickedButtonAdd)
ON_CBN_KILLFOCUS(IDC_COMBO_ENTER_MODIFYER, &CQuickPasteKeyboard::OnCbnKillfocusComboEnterModifyer)
ON_CBN_KILLFOCUS(IDC_COMBO_ENTER_MODIFIER, &CQuickPasteKeyboard::OnCbnKillfocusComboEnterModifier)
ON_EN_KILLFOCUS(IDC_HOTKEY1, &CQuickPasteKeyboard::OnEnKillfocusEdit1)
ON_WM_KILLFOCUS()
ON_BN_CLICKED(IDC_BUTTON_ENTER, &CQuickPasteKeyboard::OnBnClickedButtonEnter)
Expand Down Expand Up @@ -747,7 +747,7 @@ void CQuickPasteKeyboard::SelectMouseTypeCombo(CComboBox &combo, int value)
}


void CQuickPasteKeyboard::OnCbnKillfocusComboEnterModifyer()
void CQuickPasteKeyboard::OnCbnKillfocusComboEnterModifier()
{
// TODO: Add your control notification handler code here
}
Expand Down
2 changes: 1 addition & 1 deletion QuickPasteKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CQuickPasteKeyboard : public CPropertyPage
afx_msg void OnCbnSelchangeComboAllAssigned();
afx_msg void OnBnClickedButtonRemove();
afx_msg void OnBnClickedButtonAdd();
afx_msg void OnCbnKillfocusComboEnterModifyer();
afx_msg void OnCbnKillfocusComboEnterModifier();
afx_msg void OnEnKillfocusEdit1();
afx_msg void OnKillFocus(CWnd* pNewWnd);
virtual BOOL PreTranslateMessage(MSG* pMsg);
Expand Down
4 changes: 2 additions & 2 deletions Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@
#define IDC_RADIO_ENTER 2128
#define IDC_RADIO_CURRENT_TYPES 2128
#define IDC_RADIO_USE_HOST_NAME 2129
#define IDC_COMBO_ENTER_MODIFYER 2129
#define IDC_COMBO_ENTER_MODIFIER 2129
#define IDC_STATIC_REMOTE_FILE_REQUEST 2130
#define IDC_RADIO3 2130
#define IDC_RADIO_MOUSE 2130
Expand All @@ -568,7 +568,7 @@
#define IDC_RADIO_KEYBOARD2 2133
#define IDC_RADIO_KEYBOARD_2 2133
#define IDC_RADIO_ENTER2 2134
#define IDC_COMBO_ENTER_MODIFYER2 2135
#define IDC_COMBO_ENTER_MODIFIER2 2135
#define IDC_BUTTON_ENTER 2135
#define IDC_RADIO4 2136
#define IDC_RADIO_MOUSE_2 2136
Expand Down