summaryrefslogtreecommitdiff
path: root/plugins/QuickReplies/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-04 07:23:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-04 07:23:42 +0000
commit66cb770a982a2502456d10d73838df2b7239fd89 (patch)
treefc419dde94a9be3ebe8f2266ff46feb90d2bcbec /plugins/QuickReplies/src
parentbc256df33a57e585367edffe33d3e58d53f82ce8 (diff)
new subclassing functions applied to all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/QuickReplies/src')
-rw-r--r--plugins/QuickReplies/src/options.cpp126
1 files changed, 54 insertions, 72 deletions
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp
index b39cc2caa5..57b8535cc6 100644
--- a/plugins/QuickReplies/src/options.cpp
+++ b/plugins/QuickReplies/src/options.cpp
@@ -19,54 +19,48 @@ Boston, MA 02111-1307, USA.
#include "common.h"
-static WNDPROC OldMessageEditProc;
-
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
- case WM_CHAR:
- {
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000)
- { // ctrl-a
- SendMessage(hwnd, EM_SETSEL, 0, -1);
- return 0;
- }
+ switch(msg) {
+ case WM_CHAR:
+ if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000)
+ { // ctrl-a
+ SendMessage(hwnd, EM_SETSEL, 0, -1);
+ return 0;
+ }
- if (wParam == 26 && GetKeyState(VK_CONTROL) & 0x8000)
- { // ctrl-z
- SendMessage(hwnd, EM_UNDO, 0, 0);
- return 0;
- }
+ if (wParam == 26 && GetKeyState(VK_CONTROL) & 0x8000)
+ { // ctrl-z
+ SendMessage(hwnd, EM_UNDO, 0, 0);
+ return 0;
+ }
- if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000)
- { // ctrl-backspace
- DWORD start, end;
- WCHAR text[1024];
-
- SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
- SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
- SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
- GetWindowText(hwnd, text, 1024);
- MoveMemory(text + start, text + end, sizeof(WCHAR) * (wcslen(text) + 1 - end));
- SetWindowText(hwnd, text);
- //SAFE_FREE((void**)&text);
- SendMessage(hwnd, EM_SETSEL, start, start);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM) hwnd);
- return 0;
- }
+ if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000)
+ { // ctrl-backspace
+ DWORD start, end;
+ WCHAR text[1024];
+
+ SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
+ SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
+ SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
+ GetWindowText(hwnd, text, 1024);
+ MoveMemory(text + start, text + end, sizeof(WCHAR) * (wcslen(text) + 1 - end));
+ SetWindowText(hwnd, text);
+ //SAFE_FREE((void**)&text);
+ SendMessage(hwnd, EM_SETSEL, start, start);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM) hwnd);
+ return 0;
}
break;
}
- return CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg)
- {
- case WM_INITDIALOG:
+ switch(uMsg) {
+ case WM_INITDIALOG:
{
char key[64];
int count = 0;
@@ -77,7 +71,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
variables_skin_helpbutton(hwndDlg, IDC_VARIABLES);
SendDlgItemMessage(hwndDlg, IDC_REPLIES, EM_LIMITTEXT, TEXT_LIMIT, 0);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_REPLIES), GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc);
mir_snprintf(key, 64, "ImmediatelySend_%x", iNumber);
CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, (BYTE)DBGetContactSettingWord(NULL, MODULE_NAME, key, 1));
@@ -97,40 +91,29 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
SetDlgItemText(hwndDlg, IDC_REPLIES, replies.c_str());
DBFreeVariant(&dbv);
-
- return TRUE;
}
- break;
+ return TRUE;
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- switch(LOWORD(wParam))
- {
- case IDC_VARIABLES:
- {
- variables_showhelp(hwndDlg, IDC_REPLIES, VHF_SIMPLEDLG, NULL, NULL);
- }
- break;
+ case WM_COMMAND:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch(LOWORD(wParam)) {
+ case IDC_VARIABLES:
+ variables_showhelp(hwndDlg, IDC_REPLIES, VHF_SIMPLEDLG, NULL, NULL);
+ break;
- case IDC_IMMEDIATELY:
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
+ case IDC_IMMEDIATELY:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
}
}
break;
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
NMHDR *p = ((LPNMHDR)lParam);
- switch (p->code)
- {
- case PSN_APPLY:
+ switch (p->code) {
+ case PSN_APPLY:
{
char key[64];
int count = 0;
@@ -138,7 +121,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
mir_snprintf(key, 64, "RepliesCount_%x", iNumber);
count = DBGetContactSettingByte(NULL, MODULE_NAME, key, 0);
-
+
for (int i = 0; i < count; i++)
{
mir_snprintf(key, 64, "Reply_%x_%x", iNumber, i);
@@ -167,7 +150,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
mir_snprintf(key, 64, "ImmediatelySend_%x", iNumber);
DBWriteContactSettingByte(NULL, MODULE_NAME, key, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
-
+
mir_free(key);
return TRUE;
@@ -189,16 +172,15 @@ int OnOptInitialized(WPARAM wParam, LPARAM lParam)
char tabName[32];
mir_snprintf(tabName, SIZEOF(tabName), "Button %x", iNumber + 1);
- OPTIONSDIALOGPAGE odp = {0};
- odp.cbSize = sizeof(odp);
- odp.pszGroup = LPGEN("Message Sessions");
- odp.pszTitle = LPGEN("Quick Replies");
- odp.pszTab = tabName;
- odp.position = iNumber;
- odp.hInstance = hInstance;
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.pszGroup = LPGEN("Message Sessions");
+ odp.pszTitle = LPGEN("Quick Replies");
+ odp.pszTab = tabName;
+ odp.position = iNumber;
+ odp.hInstance = hInstance;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_PAGE);
- odp.pfnDlgProc = DlgProcOptionsPage;
+ odp.pszTemplate= MAKEINTRESOURCEA(IDD_OPTIONS_PAGE);
+ odp.pfnDlgProc = DlgProcOptionsPage;
Options_AddPage(wParam, &odp);
return 0;