summaryrefslogtreecommitdiff
path: root/protocols/JabberG
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 /protocols/JabberG
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 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_form.cpp8
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp88
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp85
3 files changed, 75 insertions, 106 deletions
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index 41f3eb8de4..b7b60a7c0e 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -24,8 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber.h"
#include "jabber_caps.h"
-
-static BOOL CALLBACK JabberFormMultiLineWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK JabberFormMultiLineWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
//case WM_GETDLGCODE:
@@ -37,7 +36,7 @@ static BOOL CALLBACK JabberFormMultiLineWndProc(HWND hwnd, UINT msg, WPARAM wPar
};
break;
}
- return CallWindowProc((WNDPROC) GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, JabberFormMultiLineWndProc, msg, wParam, lParam);
}
struct TJabberFormControlInfo
@@ -331,8 +330,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN,
0, 0, 0, 0,
hwndStatic, (HMENU) layout_info->id, hInst, NULL);
- WNDPROC oldWndProc = (WNDPROC) SetWindowLongPtr(item->hCtrl, GWLP_WNDPROC, (LONG_PTR)JabberFormMultiLineWndProc);
- SetWindowLongPtr(item->hCtrl, GWLP_USERDATA, (LONG_PTR) oldWndProc);
+ mir_subclassWindow(item->hCtrl, JabberFormMultiLineWndProc);
++layout_info->id;
break;
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index ad47e46892..3c6683eb26 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -581,8 +581,7 @@ private:
return;
m_txtPassword.GetText(pass, SIZEOF(pass));
- if (lstrcmp(buf, pass))
- {
+ if (lstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
}
@@ -591,21 +590,18 @@ private:
m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
- if (m_chkManualHost.GetState() == BST_CHECKED)
- {
+ if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
- } else
- {
+ }
+ else {
regInfo.port = (WORD)m_txtPort.GetInt();
regInfo.manualHost[0] = '\0';
}
- if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port>0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0]))
- {
+ if (regInfo.username[0] && regInfo.password[0] && regInfo.server[0] && regInfo.port>0 && ((m_chkManualHost.GetState() != BST_CHECKED) || regInfo.manualHost[0])) {
CJabberDlgRegister dlg(m_proto, m_hwnd, &regInfo);
dlg.DoModal();
-// DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_OPT_REGISTER), m_hwnd, JabberRegisterDlgProc, (LPARAM)&regInfo);
}
}
@@ -643,13 +639,12 @@ private:
{
CCtrlCheck *chk = (CCtrlCheck *)sender;
- if (chk->GetState() == BST_CHECKED)
- {
+ if (chk->GetState() == BST_CHECKED) {
m_txtManualHost.Enable();
m_txtManualPort.Enable();
m_txtPort.Disable();
- } else
- {
+ }
+ else {
m_txtManualHost.Disable();
m_txtManualPort.Disable();
m_txtPort.Enable();
@@ -969,14 +964,12 @@ enum {
RRA_SYNCDONE
};
-typedef struct _tag_RosterhEditDat{
- WNDPROC OldEditProc;
+struct ROSTEREDITDAT
+{
HWND hList;
int index;
int subindex;
-} ROSTEREDITDAT;
-
-static WNDPROC _RosterOldListProc=NULL;
+};
static int _RosterInsertListItem(HWND hList, const TCHAR * jid, const TCHAR * nick, const TCHAR * group, const TCHAR * subscr, BOOL bChecked)
{
@@ -1223,16 +1216,13 @@ static void _RosterItemEditEnd(HWND hEditor, ROSTEREDITDAT * edat, BOOL bCancel)
DestroyWindow(hEditor);
}
-static BOOL CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wParam, LPARAM lParam)
{
ROSTEREDITDAT * edat = (ROSTEREDITDAT *) GetWindowLongPtr(hEditor,GWLP_USERDATA);
if ( !edat) return 0;
- switch(msg)
- {
-
+ switch(msg) {
case WM_KEYDOWN:
- switch(wParam)
- {
+ switch(wParam) {
case VK_RETURN:
_RosterItemEditEnd(hEditor, edat, FALSE);
return 0;
@@ -1241,6 +1231,7 @@ static BOOL CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wPara
return 0;
}
break;
+
case WM_GETDLGCODE:
if (lParam) {
MSG *msg2 = (MSG*)lParam;
@@ -1248,23 +1239,20 @@ static BOOL CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wPara
if (msg2->message==WM_CHAR && msg2->wParam=='\t') return 0;
}
return DLGC_WANTMESSAGE;
+
case WM_KILLFOCUS:
_RosterItemEditEnd(hEditor, edat, FALSE);
return 0;
- }
- if (msg==WM_DESTROY)
- {
- SetWindowLongPtr(hEditor, GWLP_WNDPROC, (LONG_PTR) edat->OldEditProc);
+ case WM_DESTROY:
SetWindowLongPtr(hEditor, GWLP_USERDATA, (LONG_PTR) 0);
free(edat);
return 0;
}
- else return CallWindowProc(edat->OldEditProc, hEditor, msg, wParam, lParam);
+
+ return mir_callNextSubclass(hEditor, _RosterItemNewEditProc, msg, wParam, lParam);
}
-
-
void CJabberProto::_RosterExportToFile(HWND hwndDlg)
{
TCHAR filename[MAX_PATH]={0};
@@ -1426,12 +1414,10 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg)
SendMessage(hwndDlg, JM_STATUSCHANGED, 0, 0);
}
-static BOOL CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg==WM_MOUSEWHEEL || msg==WM_NCLBUTTONDOWN || msg==WM_NCRBUTTONDOWN)
- {
SetFocus(hList);
- }
if (msg==WM_LBUTTONDOWN)
{
@@ -1458,15 +1444,14 @@ static BOOL CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, LPA
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
ROSTEREDITDAT * edat=(ROSTEREDITDAT *)malloc(sizeof(ROSTEREDITDAT));
- edat->OldEditProc=(WNDPROC)GetWindowLongPtr(hEditor, GWLP_WNDPROC);
- SetWindowLongPtr(hEditor,GWLP_WNDPROC,(LONG_PTR)_RosterItemNewEditProc);
+ mir_subclassWindow(hEditor, _RosterItemNewEditProc);
edat->hList=hList;
edat->index=lvhti.iItem;
edat->subindex=lvhti.iSubItem;
SetWindowLongPtr(hEditor,GWLP_USERDATA,(LONG_PTR)edat);
}
}
- return CallWindowProc(_RosterOldListProc, hList, msg, wParam, lParam);
+ return mir_callNextSubclass(hList, _RosterNewListProc, msg, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1486,8 +1471,6 @@ static int sttRosterEditorResizer(HWND /*hwndDlg*/, LPARAM, UTILRESIZECONTROL *u
case IDC_EXPORT:
case IDC_IMPORT:
return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
-// case IDC_STATUSBAR:
-// return RD_ANCHORX_LEFT|RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
}
return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
}
@@ -1528,16 +1511,15 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
Utils_RestoreWindowPosition(hwndDlg, NULL, ppro->m_szModuleName, "rosterCtrlWnd_");
ListView_SetExtendedListViewStyle(GetDlgItem(hwndDlg,IDC_ROSTER), LVS_EX_CHECKBOXES | LVS_EX_BORDERSELECT /*| LVS_EX_FULLROWSELECT*/ | LVS_EX_GRIDLINES /*| LVS_EX_HEADERDRAGDROP*/);
- _RosterOldListProc=(WNDPROC) GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_ROSTER), GWLP_WNDPROC);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_ROSTER), GWLP_WNDPROC, (LONG_PTR) _RosterNewListProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_ROSTER), _RosterNewListProc);
_RosterListClear(hwndDlg);
ppro->rrud.hwndDlg = hwndDlg;
ppro->rrud.bReadyToDownload = TRUE;
ppro->rrud.bReadyToUpload = FALSE;
SendMessage(hwndDlg, JM_STATUSCHANGED, 0, 0);
-
- return TRUE;
}
+ return TRUE;
+
case WM_GETMINMAXINFO:
{
LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
@@ -1545,17 +1527,19 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
lpmmi->ptMinTrackSize.y = 390;
return 0;
}
+
case WM_SIZE:
- {
- UTILRESIZEDIALOG urd = {0};
- urd.cbSize = sizeof(urd);
- urd.hInstance = hInst;
- urd.hwndDlg = hwndDlg;
- urd.lpTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER3);
- urd.pfnResizer = sttRosterEditorResizer;
- CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ {
+ UTILRESIZEDIALOG urd = {0};
+ urd.cbSize = sizeof(urd);
+ urd.hInstance = hInst;
+ urd.hwndDlg = hwndDlg;
+ urd.lpTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER3);
+ urd.pfnResizer = sttRosterEditorResizer;
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ }
break;
- }
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_DOWNLOAD:
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index bb287e35c9..4581325496 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -861,22 +861,19 @@ void CJabberDlgPrivacyLists::OnInitDialog()
CListFilter(GetDlgItem(m_hwnd, IDC_CLIST));
CListApplyList(GetDlgItem(m_hwnd, IDC_CLIST));
- if (db_get_b(NULL, m_proto->m_szModuleName, "plistsWnd_simpleMode", 1))
- {
+ if ( db_get_b(NULL, m_proto->m_szModuleName, "plistsWnd_simpleMode", 1)) {
UIShowControls(m_hwnd, idSimpleControls, SW_SHOW);
UIShowControls(m_hwnd, idAdvancedControls, SW_HIDE);
CheckDlgButton(m_hwnd, IDC_BTN_SIMPLE, TRUE);
- } else
- {
+ }
+ else {
UIShowControls(m_hwnd, idSimpleControls, SW_HIDE);
UIShowControls(m_hwnd, idAdvancedControls, SW_SHOW);
CheckDlgButton(m_hwnd, IDC_BTN_ADVANCED, TRUE);
}
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LB_LISTS), GWLP_USERDATA,
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LB_LISTS), GWLP_WNDPROC, (LONG_PTR)LstListsSubclassProc));
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PL_RULES_LIST), GWLP_USERDATA,
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PL_RULES_LIST), GWLP_WNDPROC, (LONG_PTR)LstRulesSubclassProc));
+ mir_subclassWindow( GetDlgItem(m_hwnd, IDC_LB_LISTS), LstListsSubclassProc);
+ mir_subclassWindow( GetDlgItem(m_hwnd, IDC_PL_RULES_LIST), LstRulesSubclassProc);
SetStatusText(TranslateT("Loading..."));
@@ -889,8 +886,7 @@ void CJabberDlgPrivacyLists::OnClose()
DestroyWindow(m_hwnd);
CSuper::OnClose();
}
- else
- m_lresult = TRUE;
+ else m_lresult = TRUE;
}
void CJabberDlgPrivacyLists::OnDestroy()
@@ -1696,52 +1692,43 @@ void CJabberDlgPrivacyLists::EnableEditorControls()
LRESULT CALLBACK CJabberDlgPrivacyLists::LstListsSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC sttOldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch (msg)
- {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- {
- if (wParam == VK_INSERT)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_LIST);
- if (wParam == VK_DELETE)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_LIST);
- if (wParam == VK_SPACE)
- {
- if (GetAsyncKeyState(VK_CONTROL))
- return UIEmulateBtnClick(GetParent(hwnd), IDC_SET_DEFAULT);
- return UIEmulateBtnClick(GetParent(hwnd), IDC_ACTIVATE);
- }
-
- break;
+ switch (msg) {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (wParam == VK_INSERT)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_LIST);
+ if (wParam == VK_DELETE)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_LIST);
+ if (wParam == VK_SPACE) {
+ if (GetAsyncKeyState(VK_CONTROL))
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_SET_DEFAULT);
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_ACTIVATE);
}
+
+ break;
}
- return CallWindowProc(sttOldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CJabberDlgPrivacyLists::LstListsSubclassProc, msg, wParam, lParam);
}
LRESULT CALLBACK CJabberDlgPrivacyLists::LstRulesSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC sttOldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch (msg)
- {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- {
- if (wParam == VK_INSERT)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_RULE);
- if (wParam == VK_DELETE)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_RULE);
- if ((wParam == VK_UP) && (lParam & (1UL << 29)))
- return UIEmulateBtnClick(GetParent(hwnd), IDC_UP_RULE);
- if ((wParam == VK_DOWN) && (lParam & (1UL << 29)))
- return UIEmulateBtnClick(GetParent(hwnd), IDC_DOWN_RULE);
- if (wParam == VK_F2)
- return UIEmulateBtnClick(GetParent(hwnd), IDC_EDIT_RULE);
-
- break;
- }
+ switch (msg) {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (wParam == VK_INSERT)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_ADD_RULE);
+ if (wParam == VK_DELETE)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_REMOVE_RULE);
+ if ((wParam == VK_UP) && (lParam & (1UL << 29)))
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_UP_RULE);
+ if ((wParam == VK_DOWN) && (lParam & (1UL << 29)))
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_DOWN_RULE);
+ if (wParam == VK_F2)
+ return UIEmulateBtnClick(GetParent(hwnd), IDC_EDIT_RULE);
+
+ break;
}
- return CallWindowProc(sttOldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, CJabberDlgPrivacyLists::LstRulesSubclassProc, msg, wParam, lParam);
}
BOOL CJabberDlgPrivacyLists::CanExit()