From 1cd07657a749b8a3e5f7cccc42ac4afc07cefa3b Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Thu, 28 Apr 2011 10:47:54 +0000 Subject: added action copy to clipboard git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@58 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- popup/src/popup_wnd2.cpp | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'popup/src/popup_wnd2.cpp') diff --git a/popup/src/popup_wnd2.cpp b/popup/src/popup_wnd2.cpp index 1e680c3..8dab680 100644 --- a/popup/src/popup_wnd2.cpp +++ b/popup/src/popup_wnd2.cpp @@ -704,6 +704,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && DBGetContactSettingByte(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) ++m_actionCount; if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) ++m_actionCount; if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) ++m_actionCount; + if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) ++m_actionCount; int iAction = fixActions(theActions, count, m_actionCount); @@ -716,7 +717,6 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) m_actions[iAction].actionA.lParam = ACT_DEF_REPLY; ++iAction; } - if (enableDefaultUsr && isIm && IsActionEnabled("General/Send message")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); @@ -771,6 +771,15 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) m_actions[iAction].actionA.lParam = ACT_DEF_DISMISS; ++iAction; } + if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) + { + m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_COPY,iconSize); + lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Copy to clipboard"); + m_actions[iAction].actionA.wParam = 0; + m_actions[iAction].actionA.lParam = ACT_DEF_COPY; + ++iAction; + } } return m_actionCount; @@ -1371,6 +1380,35 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case ACT_DEF_DISMISS: PUDeletePopUp(m_hwnd); break; + case ACT_DEF_COPY: + { + #ifdef UNICODE + #define CF_TCHAR CF_UNICODETEXT + #else + #define CF_TCHAR CF_TEXT + #endif + HGLOBAL clipbuffer; + static TCHAR * buffer, *text; + char* sztext = NULL; + text = this->m_lpwzText; + if (!text) + { + sztext = this->m_lpzText; + text = mir_a2t(sztext); + } + OpenClipboard(m_hwnd); + EmptyClipboard(); + clipbuffer = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (lstrlen(text)+1) * sizeof(TCHAR)); + buffer = (TCHAR *)GlobalLock(clipbuffer); + lstrcpy(buffer, text); + GlobalUnlock(clipbuffer); + SetClipboardData(CF_TCHAR, clipbuffer); + CloseClipboard(); + if (sztext) + mir_free(text); + PUDeletePopUp(m_hwnd); + break; + } } break; } @@ -1436,6 +1474,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case 4:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MENU); break; case 5:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DISMISS); break; case 6:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_PIN); break; + case 7:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_COPY); break; } }else{ lock(); @@ -1458,6 +1497,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case 4:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MENU); break; case 5:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DISMISS); break; case 6:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_PIN); break; + case 7:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_COPY); break; } } break; @@ -1474,6 +1514,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case 4:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MENU); break; case 5:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DISMISS); break; case 6:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_PIN); break; + case 7:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_COPY); break; } return TRUE; }else{ -- cgit v1.2.3