diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-04 07:23:42 +0000 |
commit | 66cb770a982a2502456d10d73838df2b7239fd89 (patch) | |
tree | fc419dde94a9be3ebe8f2266ff46feb90d2bcbec /protocols | |
parent | bc256df33a57e585367edffe33d3e58d53f82ce8 (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')
-rw-r--r-- | protocols/IRCG/src/options.cpp | 16 | ||||
-rw-r--r-- | protocols/IRCG/src/windows.cpp | 6 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/changeinfo/editlist.cpp | 298 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/changeinfo/editstring.cpp | 74 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_xstatus.cpp | 12 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_form.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 88 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_privacy.cpp | 85 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 19 | ||||
-rw-r--r-- | protocols/Tlen/src/jabber_opt.cpp | 12 |
10 files changed, 272 insertions, 346 deletions
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index db56f9aded..36f211655f 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -24,9 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "ui_utils.h"
-static WNDPROC OldProc;
-static WNDPROC OldListViewProc;
-
static const CIrcProto* pZero = NULL;
void CIrcProto::ReadSettings( TDbSetting* sets, int count )
@@ -1018,7 +1015,7 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- return CallWindowProc(OldProc, hwndDlg, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, EditSubclassProc, msg, wParam, lParam);
}
COtherPrefsDlg::COtherPrefsDlg( CIrcProto* _pro ) :
@@ -1047,9 +1044,9 @@ COtherPrefsDlg::COtherPrefsDlg( CIrcProto* _pro ) : void COtherPrefsDlg::OnInitDialog()
{
- OldProc = (WNDPROC)SetWindowLongPtr( m_alias.GetHwnd(), GWLP_WNDPROC,(LONG_PTR)EditSubclassProc);
- SetWindowLongPtr( m_quitMessage.GetHwnd(), GWLP_WNDPROC,(LONG_PTR)EditSubclassProc);
- SetWindowLongPtr( m_pertormEdit.GetHwnd(), GWLP_WNDPROC,(LONG_PTR)EditSubclassProc);
+ mir_subclassWindow( m_alias.GetHwnd(), EditSubclassProc);
+ mir_subclassWindow( m_quitMessage.GetHwnd(), EditSubclassProc);
+ mir_subclassWindow( m_pertormEdit.GetHwnd(), EditSubclassProc);
m_alias.SetText( m_proto->m_alias );
m_quitMessage.SetText( m_proto->m_quitMessage );
@@ -1354,7 +1351,7 @@ static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
}
- return CallWindowProc(OldListViewProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, ListviewSubclassProc, msg, wParam, lParam);
}
// Callback for the 'Add ignore' dialog
@@ -1454,7 +1451,7 @@ CIgnorePrefsDlg::CIgnorePrefsDlg( CIrcProto* _pro ) : void CIgnorePrefsDlg::OnInitDialog()
{
m_proto->m_ignoreDlg = this;
- OldListViewProc = (WNDPROC)SetWindowLongPtr( m_list.GetHwnd(),GWLP_WNDPROC, (LONG_PTR)ListviewSubclassProc );
+ mir_subclassWindow(m_list.GetHwnd(), ListviewSubclassProc);
m_enable.SetState( m_proto->m_ignore );
m_ignoreFile.SetState( !m_proto->m_DCCFileEnabled );
@@ -1609,7 +1606,6 @@ void CIgnorePrefsDlg::OnDestroy() }
m_proto->RewriteIgnoreSettings();
- SetWindowLongPtr( m_list.GetHwnd(), GWLP_WNDPROC, (LONG_PTR)OldListViewProc );
}
void CIgnorePrefsDlg::FixButtons()
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 313e99353c..ad8a16fec7 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "irc.h"
-static WNDPROC OldMgrEditProc;
-
/////////////////////////////////////////////////////////////////////////////////////////
// Message Box
@@ -866,7 +864,7 @@ LRESULT CALLBACK MgrEditSubclassProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARA break;
}
- return CallWindowProc(OldMgrEditProc, m_hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(m_hwnd, MgrEditSubclassProc, msg, wParam, lParam);
}
void CManagerDlg::OnInitDialog()
@@ -877,7 +875,7 @@ void CManagerDlg::OnInitDialog() pt.x = 3;
pt.y = 3;
HWND hwndEdit = ChildWindowFromPoint( m_topic.GetHwnd(), pt);
- OldMgrEditProc = (WNDPROC)SetWindowLongPtr(hwndEdit, GWLP_WNDPROC,(LONG_PTR)MgrEditSubclassProc);
+ mir_subclassWindow(hwndEdit, MgrEditSubclassProc);
WindowSetIcon( m_hwnd, IDI_MANAGER );
diff --git a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp index f2a1470fd3..acaa15d861 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp @@ -31,171 +31,167 @@ static ChangeInfoData *dataListEdit = NULL;
static HWND hwndListEdit = NULL;
static BOOL (WINAPI *MyAnimateWindow)(HWND,DWORD,DWORD);
-static WNDPROC OldListEditProc;
static LRESULT CALLBACK ListEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
- case WM_LBUTTONUP:
- CallWindowProc(OldListEditProc, hwnd, msg, wParam, lParam);
- {
- POINT pt;
-
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- ClientToScreen(hwnd, &pt);
- if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL) break;
- }
- {
- int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
-
- if (dataListEdit)
- dataListEdit->EndListEdit(i != LB_ERR);
- }
- return 0;
-
- case WM_CHAR:
- if (wParam != '\r') break;
- {
- int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
-
- if (dataListEdit)
- dataListEdit->EndListEdit(i != LB_ERR);
- }
- return 0;
- case WM_KILLFOCUS:
- if (dataListEdit)
- dataListEdit->EndListEdit(1);
- return 0;
- }
- return CallWindowProc(OldListEditProc, hwnd, msg, wParam, lParam);
+ switch(msg) {
+ case WM_LBUTTONUP:
+ mir_callNextSubclass(hwnd, ListEditSubclassProc, msg, wParam, lParam);
+ {
+ POINT pt;
+
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
+ ClientToScreen(hwnd, &pt);
+ if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL) break;
+ }
+ {
+ int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
+
+ if (dataListEdit)
+ dataListEdit->EndListEdit(i != LB_ERR);
+ }
+ return 0;
+
+ case WM_CHAR:
+ if (wParam != '\r') break;
+ {
+ int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
+
+ if (dataListEdit)
+ dataListEdit->EndListEdit(i != LB_ERR);
+ }
+ return 0;
+ case WM_KILLFOCUS:
+ if (dataListEdit)
+ dataListEdit->EndListEdit(1);
+ return 0;
+ }
+ return mir_callNextSubclass(hwnd, ListEditSubclassProc, msg, wParam, lParam);
}
-
void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey)
{
- int j,n;
- POINT pt;
- int itemHeight;
- char str[MAX_PATH];
-
- if (dataListEdit)
- dataListEdit->EndListEdit(0);
-
- pt.x=pt.y=0;
- ClientToScreen(hwndList,&pt);
- OffsetRect(rc,pt.x,pt.y);
- InflateRect(rc,-2,-2);
- rc->left-=2;
- iEditItem = iItem;
- ListView_RedrawItems(hwndList, iEditItem, iEditItem);
- UpdateWindow(hwndList);
-
- dataListEdit = this;
- hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP|WS_BORDER|WS_VSCROLL, rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL);
- SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
- itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);
-
- FieldNamesItem *list = (FieldNamesItem*)setting[iSetting].pList;
-
- if (list == countryField)
- { // some country codes were changed leaving old details uknown, convert it for the user
- if (settingData[iSetting].value == 420) settingData[iSetting].value = 42; // conversion of obsolete codes (OMG!)
- else if (settingData[iSetting].value == 421) settingData[iSetting].value = 4201;
- else if (settingData[iSetting].value == 102) settingData[iSetting].value = 1201;
- }
-
- n = ListBoxAddStringUtf(hwndListEdit, "Unspecified");
- for (j=0; ; j++)
- if (!list[j].text)
- {
- SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
- if ((settingData[iSetting].value == 0 && list[j].code == 0)
- || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
- SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
- break;
- }
-
- for (j=0; list[j].text; j++)
- {
- n = ListBoxAddStringUtf(hwndListEdit, list[j].text);
- SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
- if ((setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, list[j].text))
- || (setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH))))
- || ((char*)settingData[iSetting].value == NULL && list[j].code == 0))
- || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
- SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
- }
- SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0);
- int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0);
- if (itemHeight * listCount < 150)
- SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER|SWP_NOMOVE);
- OldListEditProc = (WNDPROC)SetWindowLongPtr(hwndListEdit, GWLP_WNDPROC, (LONG_PTR)ListEditSubclassProc);
- if (MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(GetModuleHandleA("user32"), "AnimateWindow"))
- {
- BOOL enabled;
-
- SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &enabled, FALSE);
- if (enabled) MyAnimateWindow(hwndListEdit, 200, AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE);
- }
- ShowWindow(hwndListEdit, SW_SHOW);
- SetFocus(hwndListEdit);
- if (wVKey)
- PostMessage(hwndListEdit, WM_KEYDOWN, wVKey, 0);
+ int j,n;
+ POINT pt;
+ int itemHeight;
+ char str[MAX_PATH];
+
+ if (dataListEdit)
+ dataListEdit->EndListEdit(0);
+
+ pt.x=pt.y=0;
+ ClientToScreen(hwndList,&pt);
+ OffsetRect(rc,pt.x,pt.y);
+ InflateRect(rc,-2,-2);
+ rc->left-=2;
+ iEditItem = iItem;
+ ListView_RedrawItems(hwndList, iEditItem, iEditItem);
+ UpdateWindow(hwndList);
+
+ dataListEdit = this;
+ hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP|WS_BORDER|WS_VSCROLL, rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL);
+ SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
+ itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);
+
+ FieldNamesItem *list = (FieldNamesItem*)setting[iSetting].pList;
+
+ if (list == countryField)
+ { // some country codes were changed leaving old details uknown, convert it for the user
+ if (settingData[iSetting].value == 420) settingData[iSetting].value = 42; // conversion of obsolete codes (OMG!)
+ else if (settingData[iSetting].value == 421) settingData[iSetting].value = 4201;
+ else if (settingData[iSetting].value == 102) settingData[iSetting].value = 1201;
+ }
+
+ n = ListBoxAddStringUtf(hwndListEdit, "Unspecified");
+ for (j=0; ; j++)
+ if (!list[j].text)
+ {
+ SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
+ if ((settingData[iSetting].value == 0 && list[j].code == 0)
+ || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
+ SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
+ break;
+ }
+
+ for (j=0; list[j].text; j++)
+ {
+ n = ListBoxAddStringUtf(hwndListEdit, list[j].text);
+ SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
+ if ((setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, list[j].text))
+ || (setting[iSetting].dbType == DBVT_ASCIIZ && (!strcmpnull((char*)settingData[iSetting].value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH))))
+ || ((char*)settingData[iSetting].value == NULL && list[j].code == 0))
+ || (setting[iSetting].dbType != DBVT_ASCIIZ && settingData[iSetting].value == list[j].code))
+ SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
+ }
+ SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0);
+ int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0);
+ if (itemHeight * listCount < 150)
+ SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER|SWP_NOMOVE);
+ mir_subclassWindow(hwndListEdit, ListEditSubclassProc);
+ if (MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(GetModuleHandleA("user32"), "AnimateWindow"))
+ {
+ BOOL enabled;
+
+ SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &enabled, FALSE);
+ if (enabled) MyAnimateWindow(hwndListEdit, 200, AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE);
+ }
+ ShowWindow(hwndListEdit, SW_SHOW);
+ SetFocus(hwndListEdit);
+ if (wVKey)
+ PostMessage(hwndListEdit, WM_KEYDOWN, wVKey, 0);
}
-
void ChangeInfoData::EndListEdit(int save)
{
- if (hwndListEdit == NULL || iEditItem == -1 || this != dataListEdit) return;
- if (save)
- {
- int iItem = SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0);
- int i = SendMessage(hwndListEdit, LB_GETITEMDATA, iItem, 0);
-
- if (setting[iEditItem].dbType == DBVT_ASCIIZ)
- {
- char *szNewValue = (((FieldNamesItem*)setting[iEditItem].pList)[i].text);
- if (((FieldNamesItem*)setting[iEditItem].pList)[i].code || setting[iEditItem].displayType & LIF_ZEROISVALID)
- {
- settingData[iEditItem].changed = strcmpnull(szNewValue, (char*)settingData[iEditItem].value);
- SAFE_FREE((void**)&settingData[iEditItem].value);
- settingData[iEditItem].value = (LPARAM)null_strdup(szNewValue);
- }
- else
- {
- settingData[iEditItem].changed = (char*)settingData[iEditItem].value!=NULL;
- SAFE_FREE((void**)&settingData[iEditItem].value);
- }
- }
- else
- {
- settingData[iEditItem].changed = ((FieldNamesItem*)setting[iEditItem].pList)[i].code != settingData[iEditItem].value;
- settingData[iEditItem].value = ((FieldNamesItem*)setting[iEditItem].pList)[i].code;
- }
- if (settingData[iEditItem].changed)
- {
- char buf[MAX_PATH];
- TCHAR tbuf[MAX_PATH];
-
- if (utf8_to_tchar_static(ICQTranslateUtfStatic(((FieldNamesItem*)setting[iEditItem].pList)[i].text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf)))
- ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
-
- EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
-
- }
- }
- ListView_RedrawItems(hwndList, iEditItem, iEditItem);
- iEditItem = -1;
- dataListEdit = NULL;
- DestroyWindow(hwndListEdit);
- hwndListEdit = NULL;
+ if (hwndListEdit == NULL || iEditItem == -1 || this != dataListEdit) return;
+ if (save)
+ {
+ int iItem = SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0);
+ int i = SendMessage(hwndListEdit, LB_GETITEMDATA, iItem, 0);
+
+ if (setting[iEditItem].dbType == DBVT_ASCIIZ)
+ {
+ char *szNewValue = (((FieldNamesItem*)setting[iEditItem].pList)[i].text);
+ if (((FieldNamesItem*)setting[iEditItem].pList)[i].code || setting[iEditItem].displayType & LIF_ZEROISVALID)
+ {
+ settingData[iEditItem].changed = strcmpnull(szNewValue, (char*)settingData[iEditItem].value);
+ SAFE_FREE((void**)&settingData[iEditItem].value);
+ settingData[iEditItem].value = (LPARAM)null_strdup(szNewValue);
+ }
+ else
+ {
+ settingData[iEditItem].changed = (char*)settingData[iEditItem].value!=NULL;
+ SAFE_FREE((void**)&settingData[iEditItem].value);
+ }
+ }
+ else
+ {
+ settingData[iEditItem].changed = ((FieldNamesItem*)setting[iEditItem].pList)[i].code != settingData[iEditItem].value;
+ settingData[iEditItem].value = ((FieldNamesItem*)setting[iEditItem].pList)[i].code;
+ }
+ if (settingData[iEditItem].changed)
+ {
+ char buf[MAX_PATH];
+ TCHAR tbuf[MAX_PATH];
+
+ if (utf8_to_tchar_static(ICQTranslateUtfStatic(((FieldNamesItem*)setting[iEditItem].pList)[i].text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf)))
+ ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
+
+ EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
+
+ }
+ }
+ ListView_RedrawItems(hwndList, iEditItem, iEditItem);
+ iEditItem = -1;
+ dataListEdit = NULL;
+ DestroyWindow(hwndListEdit);
+ hwndListEdit = NULL;
}
int IsListEditWindow(HWND hwnd)
{
- if (hwnd == hwndListEdit) return 1;
- return 0;
+ if (hwnd == hwndListEdit) return 1;
+ return 0;
}
diff --git a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp index 288351e8d3..9987ce5223 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp @@ -29,7 +29,6 @@ static ChangeInfoData *dataStringEdit = NULL;
-static WNDPROC OldStringEditProc, OldExpandButtonProc;
static HWND hwndEdit = NULL, hwndExpandButton = NULL, hwndUpDown = NULL;
static const char escapes[]={'a','\a',
@@ -143,42 +142,38 @@ char *BinaryToEscapes(char *str) static LRESULT CALLBACK StringEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_KEYDOWN:
if (wParam==VK_ESCAPE)
{
- if (dataStringEdit)
- dataStringEdit->EndStringEdit(0);
+ if (dataStringEdit)
+ dataStringEdit->EndStringEdit(0);
return 0;
}
if (wParam==VK_RETURN)
{
if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_MULTILINE && !(GetKeyState(VK_CONTROL) & 0x8000)) break;
- if (dataStringEdit)
- dataStringEdit->EndStringEdit(1);
+ if (dataStringEdit)
+ dataStringEdit->EndStringEdit(1);
return 0;
}
break;
case WM_GETDLGCODE:
- return DLGC_WANTALLKEYS|CallWindowProc(OldStringEditProc, hwnd, msg, wParam, lParam);
+ return DLGC_WANTALLKEYS | mir_callNextSubclass(hwnd, StringEditSubclassProc, msg, wParam, lParam);
case WM_KILLFOCUS:
if ((HWND)wParam == hwndExpandButton) break;
- if (dataStringEdit)
- dataStringEdit->EndStringEdit(1);
+ if (dataStringEdit)
+ dataStringEdit->EndStringEdit(1);
return 0;
}
- return CallWindowProc(OldStringEditProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, StringEditSubclassProc, msg, wParam, lParam);
}
-
-
static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_LBUTTONUP:
if(GetCapture()==hwnd)
{
@@ -197,7 +192,7 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wPara EscapesToMultiline(text,&selStart,&selEnd);
hwndEdit=CreateWindowExA(WS_EX_TOOLWINDOW,"EDIT","",WS_POPUP|WS_BORDER|WS_VISIBLE|ES_WANTRETURN|ES_AUTOVSCROLL|WS_VSCROLL|ES_MULTILINE,rcStart.left,rcStart.top,rcStart.right-rcStart.left,rcStart.bottom-rcStart.top,NULL,NULL,hInst,NULL);
SetWindowTextUcs(hwndEdit, text);
- OldStringEditProc=(WNDPROC)SetWindowLongPtr(hwndEdit,GWLP_WNDPROC,(LONG_PTR)StringEditSubclassProc);
+ mir_subclassWindow(hwndEdit, StringEditSubclassProc);
SendMessage(hwndEdit,WM_SETFONT,(WPARAM)dataStringEdit->hListFont,0);
SendMessage(hwndEdit,EM_SETSEL,selStart,selEnd);
SetFocus(hwndEdit);
@@ -228,10 +223,9 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wPara }
break;
}
- return CallWindowProc(OldExpandButtonProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, ExpandButtonSubclassProc, msg, wParam, lParam);
}
-
void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey)
{
char *szValue;
@@ -255,21 +249,21 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) }
else szValue = "";
- iEditItem = iItem;
+ iEditItem = iItem;
if ((setting[i].displayType & LIM_TYPE)==LI_LONGSTRING)
{
rc->right-=rc->bottom-rc->top;
hwndExpandButton=CreateWindowA("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_ICON,rc->right,rc->top,rc->bottom-rc->top,rc->bottom-rc->top,hwndList,NULL,hInst,NULL);
SendMessage(hwndExpandButton,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadImage(hInst,MAKEINTRESOURCE(IDI_EXPANDSTRINGEDIT),IMAGE_ICON,0,0,LR_SHARED));
- OldExpandButtonProc=(WNDPROC)SetWindowLongPtr(hwndExpandButton,GWLP_WNDPROC,(LONG_PTR)ExpandButtonSubclassProc);
+ mir_subclassWindow(hwndExpandButton, ExpandButtonSubclassProc);
}
- dataStringEdit = this;
+ dataStringEdit = this;
hwndEdit = CreateWindow(_T("EDIT"),_T(""),WS_VISIBLE|WS_CHILD|ES_AUTOHSCROLL|((setting[i].displayType&LIM_TYPE)==LI_NUMBER?ES_NUMBER:0)|(setting[i].displayType&LIF_PASSWORD?ES_PASSWORD:0),rc->left,rc->top,rc->right-rc->left,rc->bottom-rc->top,hwndList,NULL,hInst,NULL);
SetWindowTextUtf(hwndEdit, szValue);
if (alloced) SAFE_FREE(&szValue);
- OldStringEditProc=(WNDPROC)SetWindowLongPtr(hwndEdit,GWLP_WNDPROC,(LONG_PTR)StringEditSubclassProc);
+ mir_subclassWindow(hwndEdit, StringEditSubclassProc);
SendMessage(hwndEdit,WM_SETFONT,(WPARAM)hListFont,0);
if ((setting[i].displayType & LIM_TYPE) == LI_NUMBER)
{
@@ -289,12 +283,12 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) PostMessage(hwndEdit,WM_KEYDOWN,wVKey,0);
}
-
void ChangeInfoData::EndStringEdit(int save)
{
- if (hwndEdit == NULL || iEditItem == -1 || this != dataStringEdit) return;
- if (save)
- {
+ if (hwndEdit == NULL || iEditItem == -1 || this != dataStringEdit)
+ return;
+
+ if (save) {
char *text = (char*)SAFE_MALLOC(GetWindowTextLength(hwndEdit)+1);
GetWindowTextA(hwndEdit,(char*)text,GetWindowTextLength(hwndEdit)+1);
@@ -313,10 +307,8 @@ void ChangeInfoData::EndStringEdit(int save) settingData[iEditItem].value = newValue;
SAFE_FREE(&text);
}
- else
- {
- if (!(setting[iEditItem].displayType & LIF_PASSWORD))
- {
+ else {
+ if (!(setting[iEditItem].displayType & LIF_PASSWORD)) {
SAFE_FREE(&text);
text = GetWindowTextUtf(hwndEdit);
EscapesToBinary(text);
@@ -327,27 +319,27 @@ void ChangeInfoData::EndStringEdit(int save) SAFE_FREE((void**)&settingData[iEditItem].value);
if (strlennull(text))
settingData[iEditItem].value = (LPARAM)text;
- else
- {
+ else {
settingData[iEditItem].value = 0;
SAFE_FREE(&text);
}
settingData[iEditItem].changed = 1;
}
}
- if (settingData[iEditItem].changed)
- {
- TCHAR tbuf[MAX_PATH];
- GetWindowText(hwndEdit, tbuf, SIZEOF(tbuf));
- ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
+ if (settingData[iEditItem].changed) {
+ TCHAR tbuf[MAX_PATH];
+
+ GetWindowText(hwndEdit, tbuf, SIZEOF(tbuf));
+ ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
- EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
- }
+ EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
+ }
}
+
ListView_RedrawItems(hwndList, iEditItem, iEditItem);
iEditItem = -1;
- dataStringEdit = NULL;
+ dataStringEdit = NULL;
DestroyWindow(hwndEdit);
hwndEdit = NULL;
if (hwndExpandButton) DestroyWindow(hwndExpandButton);
@@ -356,8 +348,6 @@ void ChangeInfoData::EndStringEdit(int save) hwndUpDown = NULL;
}
-
-
int IsStringEditWindow(HWND hwnd)
{
if (hwnd == hwndEdit) return 1;
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index c434321763..5dc8cbcda1 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -542,8 +542,6 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) SAFE_FREE(&szStatusNote);
}
-static WNDPROC OldMessageEditProc;
-
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
@@ -575,7 +573,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam }
break;
}
- return CallWindowProc(OldMessageEditProc,hwnd,msg,wParam,lParam);
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
struct SetXStatusData
@@ -641,12 +639,12 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara if (!init->bAction) { // set our xStatus
dat->bXStatus = init->bXStatus;
SendDlgItemMessage(hwndDlg, IDC_XMSG, EM_LIMITTEXT, 1024, 0);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XMSG),GWLP_WNDPROC,(LONG_PTR)MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_XMSG), MessageEditSubclassProc);
SetDlgItemTextUtf(hwndDlg, IDC_XMSG, init->szXStatusMsg);
if (dat->ppro->m_bXStatusEnabled) { // custom status enabled, prepare title edit
SendDlgItemMessage(hwndDlg, IDC_XTITLE, EM_LIMITTEXT, 256, 0);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XTITLE),GWLP_WNDPROC,(LONG_PTR)MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg,IDC_XTITLE), MessageEditSubclassProc);
SetDlgItemTextUtf(hwndDlg, IDC_XTITLE, init->szXStatusName);
}
else { // only moods enabled, hide title, resize message edit control
@@ -763,10 +761,6 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara }
}
dat->ppro->updateServerCustomStatus(TRUE);
-
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XMSG),GWLP_WNDPROC,(LONG_PTR)OldMessageEditProc);
- if (dat->ppro->m_bXStatusEnabled)
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_XTITLE),GWLP_WNDPROC,(LONG_PTR)OldMessageEditProc);
}
if (dat->hEvent) UnhookEvent(dat->hEvent);
SAFE_FREE(&dat->okButtonFormat);
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, ®Info);
dlg.DoModal();
-// DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_OPT_REGISTER), m_hwnd, JabberRegisterDlgProc, (LPARAM)®Info);
}
}
@@ -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()
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index f9a569b3d6..7d645b10c8 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1176,9 +1176,6 @@ void EnableControlsArray(HWND hWndDlg, WORD *pwControlsList, size_t dwControlsLi LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- LRESULT lrRet = 0;
- WNDPROC OldMessageEditProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
if (msg == WM_CHAR)
if (GetKeyState(VK_CONTROL) & 0x8000) {
if (wParam == '\n') {
@@ -1195,10 +1192,7 @@ LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA }
}
- if (OldMessageEditProc)
- lrRet = CallWindowProc(OldMessageEditProc, hwnd, msg, wParam, lParam);
-
- return lrRet;
+ return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1215,20 +1209,13 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP dat = (SetXStatusData*)lParam;
if (dat) {
char szValueName[MAX_PATH];
- HWND hWndEdit;
WCHAR szBuff[STATUS_TITLE_MAX+STATUS_DESC_MAX];
- WNDPROC OldMessageEditProc;
dat->hDlgIcon = IconLibGetIcon(hXStatusAdvancedStatusIcons[dat->dwXStatus]);
dat->dwCountdown = 5;
- hWndEdit = GetDlgItem(hWndDlg, IDC_XTITLE);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(hWndEdit, GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc);
- SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)OldMessageEditProc);
-
- hWndEdit = GetDlgItem(hWndDlg, IDC_XMSG);
- OldMessageEditProc = (WNDPROC)SetWindowLongPtr(hWndEdit, GWLP_WNDPROC, (LONG_PTR)MessageEditSubclassProc);
- SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)OldMessageEditProc);
+ mir_subclassWindow( GetDlgItem(hWndDlg, IDC_XTITLE), MessageEditSubclassProc);
+ mir_subclassWindow( GetDlgItem(hWndDlg, IDC_XMSG), MessageEditSubclassProc);
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)dat);
SEND_DLG_ITEM_MESSAGE(hWndDlg, IDC_XTITLE, EM_LIMITTEXT, STATUS_TITLE_MAX, 0);
diff --git a/protocols/Tlen/src/jabber_opt.cpp b/protocols/Tlen/src/jabber_opt.cpp index 6f71238db9..ff6ea7620f 100644 --- a/protocols/Tlen/src/jabber_opt.cpp +++ b/protocols/Tlen/src/jabber_opt.cpp @@ -120,21 +120,18 @@ int TlenOptionsInit(void *ptr, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK JabberValidateUsernameWndProc(HWND hwndEdit, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC oldProc = (WNDPROC) GetWindowLongPtr(hwndEdit, GWLP_USERDATA);
-
switch (msg) {
case WM_CHAR:
if (strchr("\"&'/:<>@", wParam&0xff) != NULL)
return 0;
break;
}
- return CallWindowProc(oldProc, hwndEdit, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndEdit, JabberValidateUsernameWndProc, msg, wParam, lParam);
}
INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
char text[256];
- WNDPROC oldProc;
TlenProtocol *proto = (TlenProtocol *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -155,11 +152,10 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
- oldProc = (WNDPROC) GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_USERDATA, (LONG_PTR) oldProc);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), GWLP_WNDPROC, (LONG_PTR) JabberValidateUsernameWndProc);
- return TRUE;
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), JabberValidateUsernameWndProc);
}
+ return TRUE;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_EDIT_USERNAME:
|