diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-15 11:44:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-15 11:44:40 +0000 |
commit | f92563fa59cd21d339f98288c60b81a51109fa01 (patch) | |
tree | 3f5831465380a967f0c79d9819a41422b7b2c59c | |
parent | 8e10b13b38995be8e810342d21040a4324cbfeef (diff) |
same clutch removed for MButtonCtrl, mir_subclassWindow won again
git-svn-id: http://svn.miranda-ng.org/main/trunk@5360 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_button.h | 8 | ||||
-rw-r--r-- | include/m_button_int.h | 9 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_cluiframes.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_contact.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_docking.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_gdiplus.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_rowheight_funcs.cpp | 8 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_skinengine.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_statusbar.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_tbbutton.cpp | 52 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/CLCButton.cpp | 22 | ||||
-rw-r--r-- | src/modules/button/button.cpp | 20 |
12 files changed, 50 insertions, 83 deletions
diff --git a/include/m_button.h b/include/m_button.h index d883143793..c3b0dfabd7 100644 --- a/include/m_button.h +++ b/include/m_button.h @@ -77,10 +77,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define BUTTONSETASTHEMEDBTN (WM_USER+6)
// Sets the custom painting procedure for a button
-// wParam = not used
-// lParam = MButtonCustomize* (refer to mbutton_int.h for details)
-// Usage: SendMessage(hwndbutton, BUTTONSETCUSTOM, 0, (LPARAM)&CustomData);
+// wParam = new data block length (inherited from MButtonCtrl)
+// lParam = (pfnPainterFunc)pfnPainter (refer to mbutton_int.h for details)
+// Usage: SendMessage(hwndbutton, BUTTONSETCUSTOM, 0, (LPARAM)MyPainter);
// Only works on MButtonClass buttons
-#define BUTTONSETCUSTOM (WM_USER+7)
+#define BUTTONSETCUSTOMPAINT (WM_USER+7)
#endif // M_BUTTON_H__
diff --git a/include/m_button_int.h b/include/m_button_int.h index 08004b5cb6..a118c3d33b 100644 --- a/include/m_button_int.h +++ b/include/m_button_int.h @@ -51,8 +51,6 @@ struct MButtonCtrl bIsThemed, // themed button
bIsSkinned; // skinned button
- LRESULT lResult; // custom window proc result
- WNDPROC fnWindowProc; // custom window proc
pfnPainterFunc fnPainter; // custom button painter
IAccPropServices* pAccPropServices;
@@ -62,11 +60,4 @@ struct MButtonCtrl typedef void (__cdecl *pfnPainterFunc)(MButtonCtrl*, HDC);
-struct MButtonCustomize
-{
- size_t cbLen; // total length of the internal data structure
- WNDPROC fnWindowProc; // subclassed windows procedure for the custom button
- pfnPainterFunc fnPainter; // custom button painter
-};
-
#endif // M_BUTTON_INT_H__
diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index bbf1f7af69..b0e47e2d3e 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -985,7 +985,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,HGEN static int ModifyMItem(WPARAM wParam,LPARAM lParam)
{
- if ((int) wParam == -1 ) return 0; // FIXME
+ if ((int)wParam == -1 ) return 0; // FIXME
return ModifyMenuItemProxy(wParam,lParam);
};
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 2fe6c81265..52eeef32fc 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -48,7 +48,7 @@ static int GetContactStatus(HANDLE hContact) void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add)
{
- corecli.pfnChangeContactIcon((HANDLE) hContact,(int) iIcon,(int) add);
+ corecli.pfnChangeContactIcon((HANDLE) hContact,(int)iIcon,(int)add);
}
static int GetStatusModeOrdering(int statusMode)
diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index 8f4ddbff8c..08036e2669 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -271,7 +271,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam) case WM_SHOWWINDOW:
{
if (msg->lParam) return 0;
- BOOL toBeDocked = (BOOL) db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT);
+ BOOL toBeDocked = (BOOL)db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT);
if ((msg->wParam && g_CluiData.fDocked < 0) || (!msg->wParam && g_CluiData.fDocked>0)) g_CluiData.fDocked = -g_CluiData.fDocked;
ZeroMemory(&abd,sizeof(abd));
abd.cbSize = sizeof(abd);
diff --git a/plugins/Clist_modern/src/modern_gdiplus.cpp b/plugins/Clist_modern/src/modern_gdiplus.cpp index 733709183a..972105cfb1 100644 --- a/plugins/Clist_modern/src/modern_gdiplus.cpp +++ b/plugins/Clist_modern/src/modern_gdiplus.cpp @@ -181,7 +181,7 @@ BOOL GDIPlus_IsAnimatedGif (TCHAR * szName) delete[] pDimensionIDs;
- return (BOOL) (nFrameCount > 1);
+ return (BOOL)(nFrameCount > 1);
}
void GDIPlus_ExtractAnimatedGIF (TCHAR * szName, int width, int height, HBITMAP * pBitmap, int ** pframesDelay, int * pframesCount, SIZE * pSizeAvatar)
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 02e786571d..b8d4940024 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -367,7 +367,7 @@ BOOL RowHeights_Alloc(ClcData *dat, int size) size_grow += 100 - (size_grow % 100);
if (dat->row_heights != NULL) {
- int *tmp = (int *) realloc((void *)dat->row_heights, sizeof(int) * size_grow);
+ int *tmp = (int *) realloc((void *)dat->row_heights, sizeof(int)* size_grow);
if (tmp == NULL) {
TRACE("Out of memory: realloc returned NULL (RowHeights_Alloc)");
RowHeights_Free(dat);
@@ -375,16 +375,16 @@ BOOL RowHeights_Alloc(ClcData *dat, int size) }
dat->row_heights = tmp;
- memset(dat->row_heights+(dat->row_heights_allocated), 0, sizeof(int) * (size_grow-dat->row_heights_allocated));
+ memset(dat->row_heights+(dat->row_heights_allocated), 0, sizeof(int)* (size_grow-dat->row_heights_allocated));
}
else {
- dat->row_heights = (int *) malloc(sizeof(int) * size_grow);
+ dat->row_heights = (int *) malloc(sizeof(int)* size_grow);
if (dat->row_heights == NULL) {
TRACE("Out of memory: alloc returned NULL (RowHeights_Alloc)");
RowHeights_Free(dat);
return FALSE;
}
- memset(dat->row_heights, 0, sizeof(int) * size_grow);
+ memset(dat->row_heights, 0, sizeof(int)* size_grow);
}
dat->row_heights_allocated = size_grow;
}
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 74b39ef932..6385e65344 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -563,8 +563,8 @@ struct DCBUFFER static int SortBufferList(const DCBUFFER *buf1, const DCBUFFER *buf2)
{
if (buf1->hdcOwnedBy != buf2->hdcOwnedBy) return (int)(buf1->hdcOwnedBy < buf2->hdcOwnedBy);
- else if (buf1->nUsageID != buf2->nUsageID) return (int) (buf1->nUsageID < buf2->nUsageID);
- else return (int) (buf1->hDC < buf2->hDC);
+ else if (buf1->nUsageID != buf2->nUsageID) return (int)(buf1->nUsageID < buf2->nUsageID);
+ else return (int)(buf1->hDC < buf2->hDC);
}
LIST<DCBUFFER> BufferList(2, SortBufferList);
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index a1bf2e2b43..556f8bad1e 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -265,7 +265,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) // create service name
mir_snprintf(servName, SIZEOF(servName), "%s/GetUnreadEmailCount", accs[i]->szModuleName);
if (p->showProtoEmails == 1 && ServiceExists(servName)) {
- mir_snprintf(protoNameExt, SIZEOF(protoNameExt),"[%d]", (int) CallService(servName, 0, 0));
+ mir_snprintf(protoNameExt, SIZEOF(protoNameExt),"[%d]", (int)CallService(servName, 0, 0));
p->ProtoEMailCount = mir_strdup(protoNameExt);
}
}
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index d4b23904bc..a82696884e 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -249,11 +249,11 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_SETFONT:
// remember the font so we can use it later
bct->hFont = (HFONT) wParam; // maybe we should redraw?
- bct->nFontID = (int) lParam - 1;
+ bct->nFontID = (int)lParam - 1;
break;
case BUTTONSETSENDONDOWN:
- bct->fSendOnDown = (BOOL) lParam;
+ bct->fSendOnDown = (BOOL)lParam;
break;
case BUTTONSETMARGINS:
@@ -283,9 +283,8 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam EndPaint(hwndDlg, &ps);
}
}
- ValidateRect(hwndDlg,NULL);
- bct->lResult = 0;
- return 1;
+ ValidateRect(hwndDlg, NULL);
+ return 0;
case WM_CAPTURECHANGED:
if ((HWND)lParam != bct->hwnd && bct->stateId != PBS_DISABLED) {
@@ -316,20 +315,19 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam InvalidateParentRect(bct->hwnd, NULL, TRUE);
}
}
- SetCapture( bct->hwnd );
+ SetCapture(bct->hwnd);
}
}
- bct->lResult = 0;
- return 1;
+ return 0;
case WM_LBUTTONUP:
if ( GetCapture() == bct->hwnd ) {
POINT ptMouse = UNPACK_POINT(lParam);
RECT rcClient;
- GetClientRect( bct->hwnd, &rcClient );
+ GetClientRect(bct->hwnd, &rcClient);
- if ( !PtInRect( &rcClient, ptMouse )) {
+ if ( !PtInRect(&rcClient, ptMouse)) {
bct->fHotMark = FALSE;
ReleaseCapture();
break;
@@ -343,12 +341,13 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam bct->stateId = PBS_HOT;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
}
- if ( !bct->fSendOnDown)
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg);
+ if ( !bct->fSendOnDown) {
+ bct->fHotMark = FALSE;
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg);
+ }
}
- bct->fHotMark = FALSE;
- bct->lResult = 0;
- return 1;
+ else bct->fHotMark = FALSE;
+ return 0;
case WM_MOUSEMOVE:
{
@@ -383,17 +382,13 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam ReleaseCapture();
}
}
- bct->lResult = 0;
- return 1;
+ return 0;
case WM_NCHITTEST:
{
LRESULT lr = SendMessage(GetParent(hwndDlg), WM_NCHITTEST, wParam, lParam);
- if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT
- || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) {
- bct->lResult = HTTRANSPARENT;
- return 1;
- }
+ if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
+ return HTTRANSPARENT;
}
break;
@@ -404,11 +399,9 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam else if (wParam == BST_UNCHECKED)
bct->bIsPushed = 0;
InvalidateRect(bct->hwnd, NULL, TRUE);
- bct->lResult = 0;
- return 1;
+ return 0;
case WM_ERASEBKGND:
- bct->lResult = 1;
return 1;
case MBM_SETICOLIBHANDLE:
@@ -440,16 +433,13 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam }
return 1;
}
- return 0;
+ return mir_callNextSubclass(hwndDlg, ToolbarButtonProc, msg, wParam, lParam);
}
void MakeButtonSkinned(HWND hWnd)
{
- MButtonCustomize Custom;
- Custom.cbLen = sizeof(TBBUTTONDATA);
- Custom.fnPainter = (pfnPainterFunc)PaintWorker;
- Custom.fnWindowProc = ToolbarButtonProc;
- SendMessage(hWnd, BUTTONSETCUSTOM, 0, (LPARAM)&Custom);
+ SendMessage(hWnd, BUTTONSETCUSTOMPAINT, sizeof(TBBUTTONDATA), (LPARAM)PaintWorker);
+ mir_subclassWindow(hWnd, ToolbarButtonProc);
TBBUTTONDATA* p = (TBBUTTONDATA*)GetWindowLongPtr(hWnd, 0);
p->nFontID = -1;
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 01a0b6281d..dc18a6d6b2 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -379,16 +379,14 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int) wParam)) {
if ( !bct->bSendOnDown)
SendMessage(pcli->hwndContactList, WM_COMMAND, MAKELONG(bct->iCtrlID, BN_CLICKED), (LPARAM) hwnd);
- bct->lResult = 0;
- return 1;
+ return 0;
}
break;
case BM_GETIMAGE:
- if (wParam == IMAGE_ICON) {
- bct->lResult = (LRESULT)(bct->hIconPrivate ? bct->hIconPrivate : bct->hIcon);
- return 1;
- }
+ if (wParam == IMAGE_ICON)
+ return (LRESULT)(bct->hIconPrivate ? bct->hIconPrivate : bct->hIcon);
+
break;
case BM_SETIMAGE:
@@ -489,20 +487,16 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR switch( SendMessage(pcli->hwndContactList, WM_NCHITTEST, wParam, lParam)) {
case HTLEFT: case HTRIGHT: case HTBOTTOM: case HTTOP:
case HTTOPLEFT: case HTTOPRIGHT: case HTBOTTOMLEFT: case HTBOTTOMRIGHT:
- bct->lResult = HTTRANSPARENT;
- return 1;
+ return HTTRANSPARENT;
}
}
- return 0;
+ return mir_callNextSubclass(hwnd, TSButtonWndProc, msg, wParam, lParam);
}
static void SetButtonAsCustom(HWND hWnd)
{
- MButtonCustomize Custom;
- Custom.cbLen = sizeof(MButtonExtension);
- Custom.fnPainter = (pfnPainterFunc)PaintWorker;
- Custom.fnWindowProc = TSButtonWndProc;
- SendMessage(hWnd, BUTTONSETCUSTOM, 0, (LPARAM)&Custom);
+ SendMessage(hWnd, BUTTONSETCUSTOMPAINT, sizeof(MButtonExtension), (LPARAM)PaintWorker);
+ mir_subclassWindow(hWnd, TSButtonWndProc);
}
static LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index b619eacceb..d1b06896ea 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -247,9 +247,6 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
MButtonCtrl* bct = (MButtonCtrl *)GetWindowLongPtr(hwnd, 0);
- if (bct && bct->fnWindowProc)
- if ( bct->fnWindowProc(hwnd, msg, wParam, lParam))
- return bct->lResult;
switch(msg) {
case WM_NCCREATE:
@@ -506,19 +503,14 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR }
break;
- case BUTTONSETCUSTOM:
- {
- MButtonCustomize *pCustom = (MButtonCustomize*)lParam;
- if (pCustom == NULL || bct->fnWindowProc)
- break;
-
- bct = (MButtonCtrl*)mir_realloc(bct, pCustom->cbLen);
- if (pCustom->cbLen > sizeof(MButtonCtrl))
- memset(bct+1, 0, pCustom->cbLen - sizeof(MButtonCtrl));
- bct->fnPainter = pCustom->fnPainter;
- bct->fnWindowProc = pCustom->fnWindowProc;
+ case BUTTONSETCUSTOMPAINT:
+ if (wParam > sizeof(MButtonCtrl)) {
+ bct = (MButtonCtrl*)mir_realloc(bct, wParam);
+ memset(bct+1, 0, wParam - sizeof(MButtonCtrl));
SetWindowLongPtr(hwnd, 0, (LONG_PTR)bct);
}
+ if (lParam)
+ bct->fnPainter = pfnPainterFunc(lParam);
break;
case WM_SETFOCUS: // set keybord focus and redraw
|