diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-08 22:00:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-08 22:00:25 +0000 |
commit | 18aec330d11e9e5acdfd032e5f614beed08eaa0c (patch) | |
tree | e31c1794a91738740537092b663ff7e567459ca3 /plugins/Clist_mw/src/CLUIFrames/statusbar.cpp | |
parent | 3be534c7528386c00bc31fca9c15b87d214f5cc1 (diff) |
fix for clicking on extra icons (for all plugins but clist nicer+)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2250 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_mw/src/CLUIFrames/statusbar.cpp')
-rw-r--r-- | plugins/Clist_mw/src/CLUIFrames/statusbar.cpp | 480 |
1 files changed, 193 insertions, 287 deletions
diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp index ba6c8e4304..c8c62c1bd4 100644 --- a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -29,21 +29,22 @@ int extraspace; int OnStatusBarBackgroundChange()
{
- {
+ showOpts = db_get_b(NULL,"CLUI","SBarShow",1);
+ bkColour = DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
+ if (hBmpBackground)
+ DeleteObject(hBmpBackground), hBmpBackground = NULL;
+
+ if ( db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
DBVARIANT dbv;
- showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1);
- bkColour = DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
- if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;}
- if (DBGetContactSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
- hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
- mir_free(dbv.pszVal);
- }
+ if ( !DBGetContactSettingTString(NULL, "StatusBar", "BkBitmap", &dbv)) {
+ hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
}
- backgroundBmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
- extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
}
+ backgroundBmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+ extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
+
RecreateStatusBar(pcli->hwndContactList);
if (pcli->hwndStatus) InvalidateRect(pcli->hwndStatus,NULL,TRUE);
return 0;
@@ -52,27 +53,18 @@ int OnStatusBarBackgroundChange() void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis)
{
- //LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
ProtocolData *PD = (ProtocolData *)dis->itemData;
- char *szProto = (char*)dis->itemData;
- int status,x;
SIZE textSize;
boolean NeedDestroy = FALSE;
- HICON hIcon;
- HRGN hrgn;
-
- if (PD == NULL){return;}
- if (dis->hDC == NULL) {return;}
+ if (PD == NULL || dis->hDC == NULL)
+ return;
//clip it
-
- hrgn = CreateRectRgn(dis->rcItem.left, dis->rcItem.top,
- dis->rcItem.right, dis->rcItem.bottom);
-
+ HRGN hrgn = CreateRectRgn(dis->rcItem.left, dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom);
SelectClipRgn(dis->hDC, hrgn);
- szProto = PD->RealName;
+ char *szProto = PD->RealName;
#ifdef _DEBUG
{
//char buf[512];
@@ -81,44 +73,38 @@ void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis) }
#endif
- status = CallProtoService(szProto,PS_GETSTATUS,0,0);
+ int status = CallProtoService(szProto,PS_GETSTATUS,0,0);
SetBkMode(dis->hDC,TRANSPARENT);
- x = dis->rcItem.left+extraspace;
-
- if (showOpts&1)
- {
- if ((DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) == 1) && status < ID_STATUS_OFFLINE)
- {
- hIcon = (HICON)GetConnectingIconService((WPARAM)szProto,0);
+ int x = dis->rcItem.left+extraspace;
+ if (showOpts & 1) {
+ HICON hIcon;
+ if ( db_get_b(NULL, "CLUI", "UseConnectingIcon", 1) == 1 && status < ID_STATUS_OFFLINE) {
+ hIcon = (HICON)GetConnectingIconService((WPARAM)szProto, 0);
if (hIcon)
- {
NeedDestroy = TRUE;
- }else
- {
+ else
hIcon = LoadSkinnedProtoIcon(szProto,status);
- }
-
- }else
- {
- hIcon = LoadSkinnedProtoIcon(szProto,status);
}
+ else hIcon = LoadSkinnedProtoIcon(szProto,status);
+
DrawIconEx(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-GetSystemMetrics(SM_CYSMICON))>>1,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
if (NeedDestroy) DestroyIcon(hIcon);
x += GetSystemMetrics(SM_CXSMICON)+2;
}
else x += 2;
- if (showOpts&2) {
- TCHAR szName[64];
+ if (showOpts & 2) {
PROTOACCOUNT* pa = ProtoGetAccount(szProto);
+ TCHAR szName[64];
mir_sntprintf(szName, SIZEOF(szName), _T("%s%s"), pa->tszAccountName, showOpts&4 ? _T(" ") : _T(""));
GetTextExtentPoint32(dis->hDC, szName, (int)_tcslen(szName), &textSize);
TextOut(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-textSize.cy)>>1,szName,lstrlen(szName));
x += textSize.cx;
}
- if (showOpts&4) {
+
+ if (showOpts & 4) {
TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (!szStatus)
szStatus = _T("");
@@ -143,18 +129,12 @@ void DrawBackGround(HWND hwnd,HDC mhdc) HFONT oFont;
HBRUSH hBrushAlternateGrey = NULL;
- HFONT hFont;
-
- //InvalidateRect(hwnd,0,FALSE);
-
- hFont = (HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
-
- if (mhdc)
- {
+ HFONT hFont = (HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
+ if (mhdc) {
hdc = mhdc;
rcPaint = NULL;
- }else
- {
+ }
+ else {
hdc = BeginPaint(hwnd,&paintst);
rcPaint = &(paintst.rcPaint);
}
@@ -168,110 +148,103 @@ void DrawBackGround(HWND hwnd,HDC mhdc) holdbmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb);
oFont = (HFONT)SelectObject(hdcMem,hFont);
SetBkMode(hdcMem,TRANSPARENT);
- { HBRUSH hBrush,hoBrush;
-
- hBrush = CreateSolidBrush(bkColour);
- hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush);
- FillRect(hdcMem,rcPaint,hBrush);
- SelectObject(hdcMem,hoBrush);
- DeleteObject(hBrush);
- if (hBmpBackground) {
- BITMAP bmp;
- int x,y;
- int maxx,maxy;
- int destw,desth;
-
- GetObject(hBmpBackground,sizeof(bmp),&bmp);
- HDC hdcBmp = CreateCompatibleDC(hdcMem);
- HDC holdbackbmp = (HDC)SelectObject(hdcBmp,hBmpBackground);
- y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0;
- maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1;
- maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1;
- switch(backgroundBmpUse&CLBM_TYPE) {
- case CLB_STRETCH:
- if (backgroundBmpUse&CLBF_PROPORTIONAL) {
- if (clRect.right*bmp.bmHeight<clRect.bottom*bmp.bmWidth) {
- desth = clRect.bottom;
- destw = desth*bmp.bmWidth/bmp.bmHeight;
+ {
+ HBRUSH hBrush = CreateSolidBrush(bkColour);
+ HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush);
+ FillRect(hdcMem,rcPaint,hBrush);
+ SelectObject(hdcMem,hoBrush);
+ DeleteObject(hBrush);
+ if (hBmpBackground) {
+ BITMAP bmp;
+ int x,y;
+ int maxx,maxy;
+ int destw,desth;
+
+ GetObject(hBmpBackground,sizeof(bmp),&bmp);
+ HDC hdcBmp = CreateCompatibleDC(hdcMem);
+ HDC holdbackbmp = (HDC)SelectObject(hdcBmp,hBmpBackground);
+ y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0;
+ maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1;
+ maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1;
+ switch(backgroundBmpUse&CLBM_TYPE) {
+ case CLB_STRETCH:
+ if (backgroundBmpUse&CLBF_PROPORTIONAL) {
+ if (clRect.right*bmp.bmHeight<clRect.bottom*bmp.bmWidth) {
+ desth = clRect.bottom;
+ destw = desth*bmp.bmWidth/bmp.bmHeight;
+ }
+ else {
+ destw = clRect.right;
+ desth = destw*bmp.bmHeight/bmp.bmWidth;
+ }
}
else {
destw = clRect.right;
+ desth = clRect.bottom;
+ }
+ break;
+
+ case CLB_STRETCHH:
+ if (backgroundBmpUse&CLBF_PROPORTIONAL) {
+ destw = clRect.right;
desth = destw*bmp.bmHeight/bmp.bmWidth;
}
- }
- else {
- destw = clRect.right;
- desth = clRect.bottom;
- }
- break;
- case CLB_STRETCHH:
- if (backgroundBmpUse&CLBF_PROPORTIONAL) {
- destw = clRect.right;
- desth = destw*bmp.bmHeight/bmp.bmWidth;
- }
- else {
- destw = clRect.right;
+ else {
+ destw = clRect.right;
+ desth = bmp.bmHeight;
+ }
+ break;
+
+ case CLB_STRETCHV:
+ if (backgroundBmpUse&CLBF_PROPORTIONAL) {
+ desth = clRect.bottom;
+ destw = desth*bmp.bmWidth/bmp.bmHeight;
+ }
+ else {
+ destw = bmp.bmWidth;
+ desth = clRect.bottom;
+ }
+ break;
+
+ default: //clb_topleft
+ destw = bmp.bmWidth;
desth = bmp.bmHeight;
+ break;
}
- break;
- case CLB_STRETCHV:
- if (backgroundBmpUse&CLBF_PROPORTIONAL) {
- desth = clRect.bottom;
- destw = desth*bmp.bmWidth/bmp.bmHeight;
- }
- else {
- destw = bmp.bmWidth;
- desth = clRect.bottom;
+ desth = clRect.bottom -clRect.top;
+ for (;y<maxy;y += desth) {
+ if (y<rcPaint->top-desth) continue;
+ for (x = 0;x<maxx;x += destw)
+ StretchBlt(hdcMem,x,y,destw,desth,hdcBmp,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
}
- break;
- default: //clb_topleft
- destw = bmp.bmWidth;
- desth = bmp.bmHeight;
- break;
+ SelectObject(hdcBmp,holdbackbmp);
+ DeleteDC(hdcBmp);
}
- desth = clRect.bottom -clRect.top;
- for (;y<maxy;y += desth) {
- if (y<rcPaint->top-desth) continue;
- for (x = 0;x<maxx;x += destw)
- StretchBlt(hdcMem,x,y,destw,desth,hdcBmp,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
- }
- SelectObject(hdcBmp,holdbackbmp);
- DeleteDC(hdcBmp);
- }
}
//call to draw icons
{
- DRAWITEMSTRUCT ds;
- int nParts,nPanel;
- ProtocolData *PD;
- RECT rc,clrc;
- int startoffset,sectwidth;
-
- memset(&ds,0,sizeof(ds));
+ DRAWITEMSTRUCT ds = { 0 };
ds.hwndItem = hwnd;
ds.hDC = hdcMem;
+ int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
+ int extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
+ int nParts = SendMessage(hwnd,SB_GETPARTS,0,0);
- startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
- extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
-
- nParts = SendMessage(hwnd,SB_GETPARTS,0,0);
- memset(&rc,0,sizeof(RECT));
+ RECT rc = { 0 }, clrc;
GetClientRect(hwnd,&clrc);
clrc.right -= clrc.left;
clrc.right -= startoffset;
- sectwidth = clrc.right/nParts;
+ int sectwidth = clrc.right/nParts;
- for (nPanel = 0;nPanel<nParts;nPanel++)
- {
- PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
- if (PD == NULL){
+ for (int nPanel = 0; nPanel < nParts; nPanel++) {
+ ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
+ if (PD == NULL)
continue;
- }
+
SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)&rc);
- //rc.left += startoffset;
- //if (rc.left>=rc.right) rc.left = rc.right-1;
+
rc.top = 0;
rc.left = nPanel*sectwidth+startoffset;
rc.right = rc.left+sectwidth-1;
@@ -289,183 +262,123 @@ void DrawBackGround(HWND hwnd,HDC mhdc) DeleteObject(hBmpOsb);
DeleteDC(hdcMem);
paintst.fErase = FALSE;
- //DeleteObject(hFont);
if (!mhdc)
EndPaint(hwnd,&paintst);
}
-LRESULT CALLBACK StatusBarOwnerDrawProc( HWND hwnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam
-)
-{
-if (UseOwnerDrawStatusBar)
+LRESULT CALLBACK StatusBarOwnerDrawProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg)
- {
- case WM_ERASEBKGND:
- {
-
- //DrawBackGround(hwnd);
+ if (UseOwnerDrawStatusBar) {
+ switch(uMsg) {
+ case WM_ERASEBKGND:
return 0;
- }
- case WM_PRINT:
- {
+
+ case WM_PRINT:
DrawBackGround(hwnd,(HDC)wParam);
return 0;
- }
- case WM_PAINT:
- {
+
+ case WM_PAINT:
DrawBackGround(hwnd,0);
return 0;
}
}
-
-}
-return (CallWindowProc(OldWindowProc,hwnd,uMsg,wParam,lParam)
- );
+ return CallWindowProc(OldWindowProc, hwnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_CREATE:
- {
- {
- tooltipshoing = FALSE;
- //HWND label;
- //label = CreateWindow("static","Top window",WS_VISIBLE|WS_CHILD ,2,2,120,60,hwnd,NULL,g_hInst,0);
- //SendMessage(label,WM_SETFONT,(WPARAM)TitleBarFont,0);
- }
- return(FALSE);
+ tooltipshoing = FALSE;
+ return FALSE;
- }
- case WM_GETMINMAXINFO:{
+ case WM_GETMINMAXINFO:
+ if (pcli->hwndStatus) {
RECT rct;
- if (pcli->hwndStatus == 0){break;}
GetWindowRect(pcli->hwndStatus,&rct);
- memset((LPMINMAXINFO)lParam,0,sizeof(MINMAXINFO));
+ memset((LPMINMAXINFO)lParam, 0, sizeof(MINMAXINFO));
((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 5;
((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom-rct.top;
((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 1600;
((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom-rct.top;
return 0;
- }
+ }
+ break;
case WM_NCHITTEST:
- {
-
- }
case WM_SHOWWINDOW:
- {
- {
- int res;
- if (hFrameHelperStatusBar)
- {
- res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0);
- DBWriteContactSettingByte(0,"CLUI","ShowSBar",(BYTE)((res&F_VISIBLE)?1:0));
- }
- }
-
+ if (hFrameHelperStatusBar) {
+ int res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0);
+ DBWriteContactSettingByte(0, "CLUI", "ShowSBar", (res & F_VISIBLE) != 0);
+ }
- if (tooltipshoing){
- NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
- tooltipshoing = FALSE;
- }
- return 0;
- //
+ if (tooltipshoing){
+ NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0);
+ tooltipshoing = FALSE;
}
+ return 0;
+
case WM_TIMER:
- {
- if (wParam == TM_STATUSBARHIDE)
- {
- KillTimer(hwnd,TM_STATUSBARHIDE);
-
- if (tooltipshoing){
- NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
- tooltipshoing = FALSE;
- }
-
+ if (wParam == TM_STATUSBARHIDE) {
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ if (tooltipshoing){
+ NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
+ tooltipshoing = FALSE;
}
+ }
- if (wParam == TM_STATUSBAR)
- {
- POINT pt;
- KillTimer(hwnd,TM_STATUSBAR);
-
- GetCursorPos(&pt);
- if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
- {
- {
- int i,nParts;
- ProtocolData *PD;
- RECT rc;
- ScreenToClient(pcli->hwndStatus,&pt);
- nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
- for (i = 0;i<nParts;i++) {
- SendMessage(pcli->hwndStatus,SB_GETRECT,i,(LPARAM)&rc);
- if (PtInRect(&rc,pt)) {
- PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,i,0);
- if (PD == NULL){return 0;}
-
- NotifyEventHooks(hStatusBarShowToolTipEvent,(WPARAM)PD->RealName,0);
- SetTimer(hwnd,TM_STATUSBARHIDE,DBGetContactSettingWord(NULL,"CLUIFrames","HideToolTipTime",5000),0);
- tooltipshoing = TRUE;
-
- break;
- }
- }
-
-
-
+ if (wParam == TM_STATUSBAR) {
+ KillTimer(hwnd,TM_STATUSBAR);
+
+ POINT pt;
+ GetCursorPos(&pt);
+ if (pt.x == lastpnt.x&&pt.y == lastpnt.y) {
+ RECT rc;
+ ScreenToClient(pcli->hwndStatus, &pt);
+ int nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
+ for (int i = 0;i<nParts;i++) {
+ SendMessage(pcli->hwndStatus,SB_GETRECT,i,(LPARAM)&rc);
+ if (PtInRect(&rc,pt)) {
+ ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,i,0);
+ if (PD == NULL)
+ return 0;
+
+ NotifyEventHooks(hStatusBarShowToolTipEvent,(WPARAM)PD->RealName,0);
+ SetTimer(hwnd,TM_STATUSBARHIDE,DBGetContactSettingWord(NULL,"CLUIFrames","HideToolTipTime",5000),0);
+ tooltipshoing = TRUE;
+ break;
}
-
-
-
}
-
}
-
- return 0;
}
+ return 0;
case WM_SETCURSOR:
- {
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+ if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
+ return 0;
- {
- POINT pt;
- GetCursorPos(&pt);
- if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
- {
- return 0;
- }
- lastpnt = pt;
- if (tooltipshoing){
- KillTimer(hwnd,TM_STATUSBARHIDE);
- NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
- tooltipshoing = FALSE;
- }
- KillTimer(hwnd,TM_STATUSBAR);
- SetTimer(hwnd,TM_STATUSBAR,DBGetContactSettingWord(NULL,"CLC","InfoTipHoverTime",750),0);
- return 0;
- }
+ lastpnt = pt;
+ if (tooltipshoing){
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
+ tooltipshoing = FALSE;
+ }
+ KillTimer(hwnd,TM_STATUSBAR);
+ SetTimer(hwnd,TM_STATUSBAR,DBGetContactSettingWord(NULL,"CLC","InfoTipHoverTime",750),0);
+ }
+ return 0;
- }
case WM_NOTIFY:
- {
- if (lParam == 0){return 0;}
- if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus)
- {
-
- if (((LPNMHDR)lParam)->code == WM_NCHITTEST)
- {
- LPNMMOUSE lpnmmouse = (LPNMMOUSE) lParam;
- } ;
- }
- }
+ if (lParam == 0)
+ return 0;
+
+ if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus)
+ if (((LPNMHDR)lParam)->code == WM_NCHITTEST)
+ LPNMMOUSE lpnmmouse = (LPNMMOUSE) lParam;
case WM_CONTEXTMENU:
KillTimer(hwnd,TM_STATUSBARHIDE);
@@ -494,7 +407,7 @@ LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (b != 0&&(rc.right-rc.left) != (OldRc.right-OldRc.left)) {
OldRc = rc;
if (canloadstatusbar)
- if (DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0)||DBGetContactSettingByte(NULL,"CLUI","EqualSections",1))
+ if ( db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0)||db_get_b(NULL,"CLUI","EqualSections",1))
CluiProtocolStatusChanged(0,0);
}
if (msg == WM_SIZE) PostMessage(pcli->hwndStatus,WM_SIZE,wParam,lParam);
@@ -536,26 +449,21 @@ HWND CreateStatusHelper(HWND parent) HANDLE CreateStatusBarFrame()
{
- CLISTFrame Frame;
- int h;
RECT rc;
+ GetWindowRect(helperhwnd,&rc);
+ int h = rc.bottom-rc.top;
- memset(&Frame,0,sizeof(Frame));
+ CLISTFrame Frame = { 0 };
Frame.cbSize = sizeof(CLISTFrame);
Frame.hWnd = helperhwnd;
Frame.align = alBottom;
Frame.hIcon = LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
- Frame.Flags = (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_TCHAR;
- GetWindowRect(helperhwnd,&rc);
- h = rc.bottom-rc.top;
- Frame.height = (h == 0)?20:h;
-
-
+ Frame.Flags = ( db_get_b(NULL,"CLUI","ShowSBar",1)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_TCHAR;
+ Frame.height = (h == 0) ? 20 : h;
Frame.tname = _T("Status");
Frame.TBtname = TranslateT("Status Bar");
hFrameHelperStatusBar = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0);
-
return hFrameHelperStatusBar;
}
@@ -569,22 +477,20 @@ int RecreateStatusBar(HWND parent) if (hFrameHelperStatusBar) CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameHelperStatusBar,0);
helperhwnd = CreateStatusHelper(parent);
- UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0);
+ UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0);
//create the status wnd
pcli->hwndStatus = CreateStatusWindow(
- ( DBGetContactSettingByte(0,"CLUI","SBarUseSizeGrip",TRUE) && (!UseOwnerDrawStatusBar)?SBARS_SIZEGRIP:0)|
- WS_CHILD | (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), _T(""), helperhwnd, 0);
+ ( db_get_b(0,"CLUI","SBarUseSizeGrip",TRUE) && (!UseOwnerDrawStatusBar)?SBARS_SIZEGRIP:0)|
+ WS_CHILD | ( db_get_b(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), _T(""), helperhwnd, 0);
OldWindowProc = (WNDPROC)GetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC);
SetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC,(LONG_PTR)&StatusBarOwnerDrawProc);
CreateStatusBarFrame();
- {
- SetWindowPos(helperhwnd,NULL,1,1,1,1,SWP_NOZORDER);
- CluiProtocolStatusChanged(0,0);
- CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0);
- }
+ SetWindowPos(helperhwnd,NULL,1,1,1,1,SWP_NOZORDER);
+ CluiProtocolStatusChanged(0,0);
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0);
return 0;
}
|