diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-06 20:23:55 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-06 20:23:55 +0000 |
commit | 2799d3c1c54f5b4681b45b76cfdacb081312ae88 (patch) | |
tree | 7c3fcf6b8bb40fd3226e1c76ba0f70e53fa923a1 /plugins/Clist_modern/modern_statusbar.cpp | |
parent | fd2115f98aca6fa093498cf7a24216a12b05a885 (diff) |
- crash fix in Clist Modern cache
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@800 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/modern_statusbar.cpp')
-rw-r--r-- | plugins/Clist_modern/modern_statusbar.cpp | 600 |
1 files changed, 300 insertions, 300 deletions
diff --git a/plugins/Clist_modern/modern_statusbar.cpp b/plugins/Clist_modern/modern_statusbar.cpp index 487c5d6239..cf46a61696 100644 --- a/plugins/Clist_modern/modern_statusbar.cpp +++ b/plugins/Clist_modern/modern_statusbar.cpp @@ -11,8 +11,8 @@ POINT lastpnt; #define TM_STATUSBAR 23435234
#define TM_STATUSBARHIDE 23435235
-HWND hModernStatusBar=NULL;
-HANDLE hFramehModernStatusBar=NULL;
+HWND hModernStatusBar = NULL;
+HANDLE hFramehModernStatusBar = NULL;
extern void ApplyViewMode(const char *Name, bool onlySelector = false );
extern void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat);
@@ -54,9 +54,9 @@ typedef struct _ProtoItemData } ProtoItemData;
-ProtoItemData *ProtosData=NULL;
-int allocedItemData=0;
-STATUSBARDATA g_StatusBarData={0};
+ProtoItemData *ProtosData = NULL;
+int allocedItemData = 0;
+STATUSBARDATA g_StatusBarData = {0};
char * ApendSubSetting(char * buf, int size, char *first, char *second)
@@ -67,37 +67,37 @@ char * ApendSubSetting(char * buf, int size, char *first, char *second) int LoadStatusBarData()
{
- g_StatusBarData.perProtoConfig=db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
- g_StatusBarData.showProtoIcon=db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&1;
- g_StatusBarData.showProtoName=db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&2;
- g_StatusBarData.showStatusName=db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&4;
- g_StatusBarData.xStatusMode=(BYTE)(db_get_b(NULL,"CLUI","ShowXStatus",SETTING_SHOWXSTATUS_DEFAULT));
- g_StatusBarData.connectingIcon=db_get_b(NULL,"CLUI","UseConnectingIcon",SETTING_USECONNECTINGICON_DEFAULT);
- g_StatusBarData.showProtoEmails=db_get_b(NULL,"CLUI","ShowUnreadEmails",SETTING_SHOWUNREADEMAILS_DEFAULT);
- g_StatusBarData.SBarRightClk=db_get_b(NULL,"CLUI","SBarRightClk",SETTING_SBARRIGHTCLK_DEFAULT);
-
- g_StatusBarData.nProtosPerLine=db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
- g_StatusBarData.Align=db_get_b(NULL,"CLUI","Align",SETTING_ALIGN_DEFAULT);
- g_StatusBarData.VAlign=db_get_b(NULL,"CLUI","VAlign",SETTING_VALIGN_DEFAULT);
- g_StatusBarData.sameWidth=db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT);
- g_StatusBarData.rectBorders.left=db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT);
- g_StatusBarData.rectBorders.right=db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT);
- g_StatusBarData.rectBorders.top=db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT);
- g_StatusBarData.rectBorders.bottom=db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT);
- g_StatusBarData.extraspace=(BYTE)db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT);
+ g_StatusBarData.perProtoConfig = db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
+ g_StatusBarData.showProtoIcon = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&1;
+ g_StatusBarData.showProtoName = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&2;
+ g_StatusBarData.showStatusName = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&4;
+ g_StatusBarData.xStatusMode = (BYTE)(db_get_b(NULL,"CLUI","ShowXStatus",SETTING_SHOWXSTATUS_DEFAULT));
+ g_StatusBarData.connectingIcon = db_get_b(NULL,"CLUI","UseConnectingIcon",SETTING_USECONNECTINGICON_DEFAULT);
+ g_StatusBarData.showProtoEmails = db_get_b(NULL,"CLUI","ShowUnreadEmails",SETTING_SHOWUNREADEMAILS_DEFAULT);
+ g_StatusBarData.SBarRightClk = db_get_b(NULL,"CLUI","SBarRightClk",SETTING_SBARRIGHTCLK_DEFAULT);
+
+ g_StatusBarData.nProtosPerLine = db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
+ g_StatusBarData.Align = db_get_b(NULL,"CLUI","Align",SETTING_ALIGN_DEFAULT);
+ g_StatusBarData.VAlign = db_get_b(NULL,"CLUI","VAlign",SETTING_VALIGN_DEFAULT);
+ g_StatusBarData.sameWidth = db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT);
+ g_StatusBarData.rectBorders.left = db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT);
+ g_StatusBarData.rectBorders.right = db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT);
+ g_StatusBarData.rectBorders.top = db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT);
+ g_StatusBarData.rectBorders.bottom = db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT);
+ g_StatusBarData.extraspace = (BYTE)db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT);
if (g_StatusBarData.BarFont) DeleteObject(g_StatusBarData.BarFont);
- g_StatusBarData.BarFont=NULL;//LoadFontFromDB("ModernData","StatusBar",&g_StatusBarData.fontColor);
+ g_StatusBarData.BarFont = NULL;//LoadFontFromDB("ModernData","StatusBar",&g_StatusBarData.fontColor);
{
- int vis=db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT);
+ int vis = db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT);
int frameopt;
- int frameID=Sync( FindFrameID, hModernStatusBar );
- frameopt=CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),0);
- frameopt=frameopt & (~F_VISIBLE);
- if(vis)
+ int frameID = Sync( FindFrameID, hModernStatusBar );
+ frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),0);
+ frameopt = frameopt & (~F_VISIBLE);
+ if (vis)
{
ShowWindow(hModernStatusBar,SW_SHOW);
- frameopt|=F_VISIBLE;
+ frameopt |= F_VISIBLE;
}
else
{
@@ -105,24 +105,24 @@ int LoadStatusBarData() };
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),frameopt);
}
- g_StatusBarData.TextEffectID=db_get_b(NULL,"StatusBar","TextEffectID",SETTING_TEXTEFFECTID_DEFAULT);
- g_StatusBarData.TextEffectColor1=db_get_dw(NULL,"StatusBar","TextEffectColor1",SETTING_TEXTEFFECTCOLOR1_DEFAULT);
- g_StatusBarData.TextEffectColor2=db_get_dw(NULL,"StatusBar","TextEffectColor2",SETTING_TEXTEFFECTCOLOR2_DEFAULT);
+ g_StatusBarData.TextEffectID = db_get_b(NULL,"StatusBar","TextEffectID",SETTING_TEXTEFFECTID_DEFAULT);
+ g_StatusBarData.TextEffectColor1 = db_get_dw(NULL,"StatusBar","TextEffectColor1",SETTING_TEXTEFFECTCOLOR1_DEFAULT);
+ g_StatusBarData.TextEffectColor2 = db_get_dw(NULL,"StatusBar","TextEffectColor2",SETTING_TEXTEFFECTCOLOR2_DEFAULT);
- if(g_StatusBarData.hBmpBackground) {DeleteObject(g_StatusBarData.hBmpBackground); g_StatusBarData.hBmpBackground=NULL;}
+ if (g_StatusBarData.hBmpBackground) {DeleteObject(g_StatusBarData.hBmpBackground); g_StatusBarData.hBmpBackground = NULL;}
if (g_CluiData.fDisableSkinEngine)
{
DBVARIANT dbv;
- g_StatusBarData.bkColour=sttGetColor("StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
- if(db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+ g_StatusBarData.bkColour = sttGetColor("StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
+ if (db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
- g_StatusBarData.hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
+ g_StatusBarData.hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
db_free(&dbv);
}
}
- g_StatusBarData.bkUseWinColors=db_get_b(NULL,"StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
- g_StatusBarData.backgroundBmpUse=db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+ g_StatusBarData.bkUseWinColors = db_get_b(NULL,"StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+ g_StatusBarData.backgroundBmpUse = db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
}
SendMessage(pcli->hwndContactList,WM_SIZE,0,0);
@@ -144,8 +144,8 @@ int NewStatusPaintCallbackProc(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgn, DWO int ModernDrawStatusBar(HWND hwnd, HDC hDC)
{
- if (hwnd==(HWND)-1) return 0;
- if (GetParent(hwnd)==pcli->hwndContactList)
+ if (hwnd == (HWND)-1) return 0;
+ if (GetParent(hwnd) == pcli->hwndContactList)
return ModernDrawStatusBarWorker(hwnd,hDC);
else
CLUI__cliInvalidateRect(hwnd,NULL,FALSE);
@@ -155,15 +155,15 @@ int ModernDrawStatusBar(HWND hwnd, HDC hDC) int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
{
int line;
- int iconHeight=GetSystemMetrics(SM_CYSMICON)+2;
- int protosperline=0;
- int visProtoCount=0;
+ int iconHeight = GetSystemMetrics(SM_CYSMICON)+2;
+ int protosperline = 0;
+ int visProtoCount = 0;
int protoCount;
- int SumWidth=0;
- int rectwidth=0;
- int aligndx=0;
- int * ProtoWidth=NULL;
- int i,j,po=0;
+ int SumWidth = 0;
+ int rectwidth = 0;
+ int aligndx = 0;
+ int * ProtoWidth = NULL;
+ int i,j,po = 0;
char servName[40];
char protoNameExt[40];
@@ -173,9 +173,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) HFONT hOldFont;
int iconY, textY;
int spaceWidth;
- int maxwidth=0;
- int xstatus=0;
- SIZE textSize={0};
+ int maxwidth = 0;
+ int xstatus = 0;
+ SIZE textSize = {0};
GetClientRect(hWnd,&rc);
if (g_CluiData.fDisableSkinEngine)
{
@@ -188,20 +188,20 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) }
else
{
- SkinDrawGlyph(hDC,&rc,&rc,"Main,ID=StatusBar"); //TBD
+ SkinDrawGlyph(hDC,&rc,&rc,"Main,ID = StatusBar"); //TBD
}
- g_StatusBarData.nProtosPerLine=db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
- hOldFont=g_clcPainter.ChangeToFont(hDC,NULL,FONTID_STATUSBAR_PROTONAME,NULL);
+ g_StatusBarData.nProtosPerLine = db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
+ hOldFont = g_clcPainter.ChangeToFont(hDC,NULL,FONTID_STATUSBAR_PROTONAME,NULL);
- // hOldFont=SelectObject(hDC,g_StatusBarData.BarFont);
+ // hOldFont = SelectObject(hDC,g_StatusBarData.BarFont);
// SetTextColor(hDC,g_StatusBarData.fontColor);
{
GetTextExtentPoint32A(hDC," ",1,&textSize);
- spaceWidth=textSize.cx;
- textY=rc.top+((rc.bottom-rc.top-textSize.cy)>>1);
+ spaceWidth = textSize.cx;
+ textY = rc.top+((rc.bottom-rc.top-textSize.cy)>>1);
}
- iconY=rc.top+((rc.bottom-rc.top-GetSystemMetrics(SM_CXSMICON))>>1);
+ iconY = rc.top+((rc.bottom-rc.top-GetSystemMetrics(SM_CXSMICON))>>1);
{
ProtoEnumAccounts( &protoCount, &accs );
@@ -209,34 +209,34 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) {
int k;
- for (k=0; k<allocedItemData; k++)
+ for (k = 0; k < allocedItemData; k++)
{
- if(ProtosData[k].ProtoXStatus) mir_free_and_nill (ProtosData[k].ProtoXStatus);
- if(ProtosData[k].ProtoName) mir_free_and_nill (ProtosData[k].ProtoName);
- if(ProtosData[k].AccountName) mir_free_and_nill (ProtosData[k].AccountName);
- if(ProtosData[k].ProtoHumanName) mir_free_and_nill (ProtosData[k].ProtoHumanName);
- if(ProtosData[k].ProtoEMailCount) mir_free_and_nill (ProtosData[k].ProtoEMailCount);
- if(ProtosData[k].ProtoStatusText) mir_free_and_nill (ProtosData[k].ProtoStatusText);
+ if (ProtosData[k].ProtoXStatus) mir_free_and_nill (ProtosData[k].ProtoXStatus);
+ if (ProtosData[k].ProtoName) mir_free_and_nill (ProtosData[k].ProtoName);
+ if (ProtosData[k].AccountName) mir_free_and_nill (ProtosData[k].AccountName);
+ if (ProtosData[k].ProtoHumanName) mir_free_and_nill (ProtosData[k].ProtoHumanName);
+ if (ProtosData[k].ProtoEMailCount) mir_free_and_nill (ProtosData[k].ProtoEMailCount);
+ if (ProtosData[k].ProtoStatusText) mir_free_and_nill (ProtosData[k].ProtoStatusText);
}
mir_free_and_nill(ProtosData);
- ProtosData=NULL;
- allocedItemData=0;
+ ProtosData = NULL;
+ allocedItemData = 0;
}
if ( protoCount == 0 )
return 0;
- ProtosData=(ProtoItemData*)mir_alloc(sizeof(ProtoItemData)*protoCount);
+ ProtosData = (ProtoItemData*)mir_alloc(sizeof(ProtoItemData)*protoCount);
memset(ProtosData,0,sizeof(ProtoItemData)*protoCount);
- for (j=0; j<protoCount; j++)
+ for (j = 0; j < protoCount; j++)
{
int vis;
char buf[256];
- i=pcli->pfnGetAccountIndexByPos(j);
- if (i==-1)
- vis=FALSE;
+ i = pcli->pfnGetAccountIndexByPos(j);
+ if (i == -1)
+ vis = FALSE;
else
- vis=pcli->pfnGetProtocolVisibility(accs[i]->szModuleName);
+ vis = pcli->pfnGetProtocolVisibility(accs[i]->szModuleName);
if (!vis) continue;
mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", accs[i]->szModuleName);
@@ -302,12 +302,12 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) ProtosData[visProtoCount].ProtoHumanName = mir_tstrdup(accs[i]->tszAccountName);
ProtosData[visProtoCount].AccountName = mir_strdup(accs[i]->szModuleName);
- ProtosData[visProtoCount].ProtoName = mir_strdup(accs[i]->szProtoName);
+ ProtosData[visProtoCount].ProtoName = mir_strdup(accs[i]->szProtoName);
ProtosData[visProtoCount].ProtoStatusText = mir_strdup((char*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)ProtosData[visProtoCount].ProtoStatus,0));
ProtosData[visProtoCount].ProtoPos = visProtoCount;
ProtosData[visProtoCount].isDimmed = 0;
- if(g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS)
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS)
{
char szTemp[2048];
mir_snprintf(szTemp, SIZEOF(szTemp), "%s|", ProtosData[visProtoCount].AccountName );
@@ -322,114 +322,114 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) //START MULTILINE HERE
{
- int orig_protoCount=protoCount;
- int orig_visProtoCount=visProtoCount;
- ProtoItemData * orig_ProtosData=ProtosData;
+ int orig_protoCount = protoCount;
+ int orig_visProtoCount = visProtoCount;
+ ProtoItemData * orig_ProtosData = ProtosData;
int linecount;
if (g_StatusBarData.nProtosPerLine)
- protosperline=g_StatusBarData.nProtosPerLine;
+ protosperline = g_StatusBarData.nProtosPerLine;
else if (orig_visProtoCount)
- protosperline=orig_visProtoCount;
+ protosperline = orig_visProtoCount;
else if (protoCount)
{
- protosperline=protoCount;
- orig_visProtoCount=protoCount;
+ protosperline = protoCount;
+ orig_visProtoCount = protoCount;
}
else
{
- protosperline=1;
- orig_visProtoCount=1;
+ protosperline = 1;
+ orig_visProtoCount = 1;
}
- protosperline=min(protosperline,orig_visProtoCount);
- linecount=protosperline ? (orig_visProtoCount+(protosperline-1))/protosperline : 1; //divide with rounding to up
- for (line=0; line<linecount; line++)
+ protosperline = min(protosperline,orig_visProtoCount);
+ linecount = protosperline ? (orig_visProtoCount+(protosperline-1))/protosperline : 1; //divide with rounding to up
+ for (line = 0; line < linecount; line++)
{
int height;
int rowsdy;
- int rowheight=max(textSize.cy+2,iconHeight);
- protoCount=min(protosperline,(orig_protoCount-line*protosperline));
- visProtoCount=min(protosperline,(orig_visProtoCount-line*protosperline));
- ProtosData+=line*protosperline;
+ int rowheight = max(textSize.cy+2,iconHeight);
+ protoCount = min(protosperline,(orig_protoCount-line*protosperline));
+ visProtoCount = min(protosperline,(orig_visProtoCount-line*protosperline));
+ ProtosData += line*protosperline;
GetClientRect(hWnd,&rc);
- rc.top += g_StatusBarData.rectBorders.top;
- rc.bottom -= g_StatusBarData.rectBorders.bottom;
+ rc.top += g_StatusBarData.rectBorders.top;
+ rc.bottom -= g_StatusBarData.rectBorders.bottom;
- aligndx=0;
- maxwidth=0;
- xstatus=0;
- SumWidth=0;
- height=(rowheight*linecount);
+ aligndx = 0;
+ maxwidth = 0;
+ xstatus = 0;
+ SumWidth = 0;
+ height = (rowheight*linecount);
if (height > (rc.bottom - rc.top))
{
rowheight = (rc.bottom - rc.top) / linecount;
- height=(rowheight*linecount);
+ height = (rowheight*linecount);
}
- rowsdy=((rc.bottom-rc.top)-height)/2;
- if (rowheight*(line)+rowsdy<rc.top-rowheight) continue;
+ rowsdy = ((rc.bottom-rc.top)-height)/2;
+ if (rowheight*(line)+rowsdy < rc.top-rowheight) continue;
if (rowheight*(line+1)+rowsdy>rc.bottom+rowheight)
{
- ProtosData=orig_ProtosData;
+ ProtosData = orig_ProtosData;
break;
}
if (g_StatusBarData.VAlign == 0) //top
{
- rc.bottom=rc.top+rowheight*(line+1);
- rc.top=rc.top+rowheight*line+1;
+ rc.bottom = rc.top+rowheight*(line+1);
+ rc.top = rc.top+rowheight*line+1;
}
else if (g_StatusBarData.VAlign == 1) //center
{
- rc.bottom=rc.top+rowsdy+rowheight*(line+1);
- rc.top=rc.top+rowsdy+rowheight*line+1;
+ rc.bottom = rc.top+rowsdy+rowheight*(line+1);
+ rc.top = rc.top+rowsdy+rowheight*line+1;
}
else if (g_StatusBarData.VAlign == 2) //bottom
{
- rc.top=rc.bottom - (rowheight*(linecount - line));
- rc.bottom=rc.bottom - (rowheight*(linecount - line - 1)+1);
+ rc.top = rc.bottom - (rowheight*(linecount - line));
+ rc.bottom = rc.bottom - (rowheight*(linecount - line - 1)+1);
}
- textY=rc.top+(((rc.bottom-rc.top)-textSize.cy)/2);
- iconY=rc.top+(((rc.bottom-rc.top)-iconHeight)/2);
+ textY = rc.top+(((rc.bottom-rc.top)-textSize.cy)/2);
+ iconY = rc.top+(((rc.bottom-rc.top)-iconHeight)/2);
{ //Code for each line
{
DWORD sw;
- rectwidth=rc.right-rc.left-g_StatusBarData.rectBorders.left-g_StatusBarData.rectBorders.right;
- if (visProtoCount>1) sw=(rectwidth-(g_StatusBarData.extraspace*(visProtoCount-1)))/visProtoCount;
- else sw=rectwidth;
+ rectwidth = rc.right-rc.left-g_StatusBarData.rectBorders.left-g_StatusBarData.rectBorders.right;
+ if (visProtoCount>1) sw = (rectwidth-(g_StatusBarData.extraspace*(visProtoCount-1)))/visProtoCount;
+ else sw = rectwidth;
if (ProtoWidth) mir_free_and_nill(ProtoWidth);
- ProtoWidth=(int*)mir_alloc(sizeof(int)*visProtoCount);
- for (i=0; i<visProtoCount; i++)
+ ProtoWidth = (int*)mir_alloc(sizeof(int)*visProtoCount);
+ for (i = 0; i < visProtoCount; i++)
{
SIZE textSize;
DWORD w = 0;
// FIXME strange error occurs here due to Dimon log
w = ProtosData[i].PaddingLeft;
- w += ProtosData[i].PaddingRight;
+ w += ProtosData[i].PaddingRight;
if ( ProtosData[i].showProtoIcon )
{
- w += GetSystemMetrics(SM_CXSMICON)+1;
+ w += GetSystemMetrics(SM_CXSMICON)+1;
- ProtosData[i].extraIcon=NULL;
+ ProtosData[i].extraIcon = NULL;
if ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoStatus>ID_STATUS_OFFLINE)
{
char str[MAXMODULELABELLENGTH];
mir_snprintf(str, SIZEOF(str), "%s/GetXStatus", ProtosData[i].AccountName);
if (ServiceExists(str))
{
- char * dbTitle="XStatusName";
- char * dbTitle2=NULL;
- xstatus=CallProtoService(ProtosData[i].AccountName,"/GetXStatus",(WPARAM)&dbTitle,(LPARAM)&dbTitle2);
+ char * dbTitle = "XStatusName";
+ char * dbTitle2 = NULL;
+ xstatus = CallProtoService(ProtosData[i].AccountName,"/GetXStatus",(WPARAM)&dbTitle,(LPARAM)&dbTitle2);
if (dbTitle && xstatus)
{
- DBVARIANT dbv={0};
+ DBVARIANT dbv = {0};
if (!DBGetContactSettingTString(NULL,ProtosData[i].AccountName,dbTitle,&dbv))
{
- ProtosData[i].ProtoXStatus=mir_tstrdup(dbv.ptszVal);
+ ProtosData[i].ProtoXStatus = mir_tstrdup(dbv.ptszVal);
//mir_free_and_nill(dbv.ptszVal);
db_free(&dbv);
}
@@ -443,9 +443,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) char str[MAXMODULELABELLENGTH];
mir_snprintf(str, SIZEOF(str), "%s/GetXStatusIcon", ProtosData[i].AccountName);
if (ServiceExists(str))
- ProtosData[i].extraIcon=(HICON)CallService(str,0,0);
- if (ProtosData[i].extraIcon && (ProtosData[i].xStatusMode&3)==3)
- w+=GetSystemMetrics(SM_CXSMICON)+1;
+ ProtosData[i].extraIcon = (HICON)CallService(str,0,0);
+ if (ProtosData[i].extraIcon && (ProtosData[i].xStatusMode&3) == 3)
+ w += GetSystemMetrics(SM_CXSMICON)+1;
}
}
@@ -454,93 +454,93 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if (ProtosData[i].showProtoName)
{
GetTextExtentPoint32(hDC,ProtosData[i].ProtoHumanName,lstrlen(ProtosData[i].ProtoHumanName),&textSize);
- w += textSize.cx + 3 + spaceWidth;
+ w += textSize.cx + 3 + spaceWidth;
}
if (ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount )
{
GetTextExtentPoint32A(hDC,ProtosData[i].ProtoEMailCount,lstrlenA(ProtosData[i].ProtoEMailCount),&textSize);
- w+=textSize.cx+3+spaceWidth;
+ w += textSize.cx+3+spaceWidth;
}
if (ProtosData[i].showStatusName)
{
GetTextExtentPoint32A(hDC,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText),&textSize);
- w += textSize.cx + 3 + spaceWidth;
+ w += textSize.cx + 3 + spaceWidth;
}
if ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus)
{
GetTextExtentPoint32(hDC,ProtosData[i].ProtoXStatus,lstrlen(ProtosData[i].ProtoXStatus),&textSize);
- w += textSize.cx + 3 + spaceWidth;
+ w += textSize.cx + 3 + spaceWidth;
}
if ( ( ProtosData[i].showProtoName) ||
(ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount ) ||
(ProtosData[i].showStatusName) ||
((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
- w -= spaceWidth;
+ w -= spaceWidth;
- ProtosData[i].fullWidth=w;
+ ProtosData[i].fullWidth = w;
if (g_StatusBarData.sameWidth)
{
- ProtoWidth[i]=sw;
- SumWidth+=w;
+ ProtoWidth[i] = sw;
+ SumWidth += w;
}
else
{
- ProtoWidth[i]=w;
- SumWidth+=w;
+ ProtoWidth[i] = w;
+ SumWidth += w;
}
}
// Reposition rects
- for(i=0; i<visProtoCount; i++)
- if (ProtoWidth[i]>maxwidth) maxwidth=ProtoWidth[i];
+ for(i = 0; i < visProtoCount; i++)
+ if (ProtoWidth[i]>maxwidth) maxwidth = ProtoWidth[i];
if (g_StatusBarData.sameWidth)
{
- for (i=0; i<visProtoCount; i++)
- ProtoWidth[i]=maxwidth;
- SumWidth=maxwidth*visProtoCount;
+ for (i = 0; i < visProtoCount; i++)
+ ProtoWidth[i] = maxwidth;
+ SumWidth = maxwidth*visProtoCount;
}
- SumWidth+=(visProtoCount-1)*(g_StatusBarData.extraspace+1);
+ SumWidth += (visProtoCount-1)*(g_StatusBarData.extraspace+1);
if (SumWidth>rectwidth)
{
- float f=(float)rectwidth/SumWidth;
- //dx=(int)(0.5+(float)dx/visProtoCount);
- //SumWidth-=dx*visProtoCount;
- SumWidth=0;
- for (i=0; i<visProtoCount; i++)
+ float f = (float)rectwidth/SumWidth;
+ //dx = (int)(0.5+(float)dx/visProtoCount);
+ //SumWidth -= dx*visProtoCount;
+ SumWidth = 0;
+ for (i = 0; i < visProtoCount; i++)
{
- ProtoWidth[i]=(int)((float)ProtoWidth[i]*f);
- SumWidth+=ProtoWidth[i];
+ ProtoWidth[i] = (int)((float)ProtoWidth[i]*f);
+ SumWidth += ProtoWidth[i];
}
- SumWidth+=(visProtoCount-1)*(g_StatusBarData.extraspace+1);
+ SumWidth += (visProtoCount-1)*(g_StatusBarData.extraspace+1);
}
}
- if (g_StatusBarData.Align==1) //center
- aligndx=(rectwidth-SumWidth)>>1;
- else if (g_StatusBarData.Align==2) //right
- aligndx=(rectwidth-SumWidth);
+ if (g_StatusBarData.Align == 1) //center
+ aligndx = (rectwidth-SumWidth)>>1;
+ else if (g_StatusBarData.Align == 2) //right
+ aligndx = (rectwidth-SumWidth);
// Draw in rects
//ske_SelectTextEffect(hDC,g_StatusBarData.TextEffectID,g_StatusBarData.TextEffectColor1,g_StatusBarData.TextEffectColor2);
{
- RECT r=rc;
-// r.top+=g_StatusBarData.rectBorders.top;
-// r.bottom-=g_StatusBarData.rectBorders.bottom;
- r.left+=g_StatusBarData.rectBorders.left+aligndx;
- for (i=0; i< visProtoCount; i++)
+ RECT r = rc;
+// r.top += g_StatusBarData.rectBorders.top;
+// r.bottom -= g_StatusBarData.rectBorders.bottom;
+ r.left += g_StatusBarData.rectBorders.left+aligndx;
+ for (i = 0; i < visProtoCount; i++)
{
HRGN rgn;
int x = r.left;
- HICON hIcon=NULL;
- HICON hxIcon=NULL;
- BOOL NeedDestroy=FALSE;
+ HICON hIcon = NULL;
+ HICON hxIcon = NULL;
+ BOOL NeedDestroy = FALSE;
x = r.left;
- x += ProtosData[i].PaddingLeft;
- r.right=r.left+ProtoWidth[i];
+ x += ProtosData[i].PaddingLeft;
+ r.right = r.left+ProtoWidth[i];
if ( ProtosData[i].showProtoIcon )
{
@@ -550,75 +550,75 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) mir_snprintf(str, SIZEOF(str), "%s/GetXStatusIcon", ProtosData[i].AccountName);
if (ServiceExists(str))
{
- hxIcon=ProtosData[i].extraIcon;
+ hxIcon = ProtosData[i].extraIcon;
if (hxIcon)
{
- if (((ProtosData[i].xStatusMode)&3)==2)
+ if (((ProtosData[i].xStatusMode)&3) == 2)
{
- hIcon=GetMainStatusOverlay(ProtosData[i].ProtoStatus);
- NeedDestroy=TRUE;
+ hIcon = GetMainStatusOverlay(ProtosData[i].ProtoStatus);
+ NeedDestroy = TRUE;
}
- else if (((ProtosData[i].xStatusMode)&3)==1)
+ else if (((ProtosData[i].xStatusMode)&3) == 1)
{
- hIcon=hxIcon;
- NeedDestroy=TRUE;
- hxIcon=NULL;
+ hIcon = hxIcon;
+ NeedDestroy = TRUE;
+ hxIcon = NULL;
}
}
}
}
- if (hIcon==NULL && (hxIcon==NULL || (((ProtosData[i].xStatusMode)&3)==3)))
+ if (hIcon == NULL && (hxIcon == NULL || (((ProtosData[i].xStatusMode)&3) == 3)))
{
- if (hIcon==NULL && (ProtosData[i].connectingIcon==1) && ProtosData[i].ProtoStatus>=ID_STATUS_CONNECTING&&ProtosData[i].ProtoStatus<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)
+ if (hIcon == NULL && (ProtosData[i].connectingIcon == 1) && ProtosData[i].ProtoStatus >= ID_STATUS_CONNECTING&&ProtosData[i].ProtoStatus <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)
{
- hIcon=(HICON)CLUI_GetConnectingIconService((WPARAM)ProtosData[i].AccountName,0);
- if (hIcon) NeedDestroy=TRUE;
- else hIcon=LoadSkinnedProtoIcon(ProtosData[i].AccountName,ProtosData[i].ProtoStatus);
+ hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)ProtosData[i].AccountName,0);
+ if (hIcon) NeedDestroy = TRUE;
+ else hIcon = LoadSkinnedProtoIcon(ProtosData[i].AccountName,ProtosData[i].ProtoStatus);
}
- else hIcon=LoadSkinnedProtoIcon(ProtosData[i].AccountName,ProtosData[i].ProtoStatus);
+ else hIcon = LoadSkinnedProtoIcon(ProtosData[i].AccountName,ProtosData[i].ProtoStatus);
}
- rgn=CreateRectRgn(r.left,r.top,r.right,r.bottom);
+ rgn = CreateRectRgn(r.left,r.top,r.right,r.bottom);
//
{
if (g_StatusBarData.sameWidth)
{
- int fw=ProtosData[i].fullWidth;
- int rw=r.right-r.left;
- if (g_StatusBarData.Align==1)
+ int fw = ProtosData[i].fullWidth;
+ int rw = r.right-r.left;
+ if (g_StatusBarData.Align == 1)
{
- x=r.left+((rw-fw)/2);
+ x = r.left+((rw-fw)/2);
}
- else if (g_StatusBarData.Align==2)
+ else if (g_StatusBarData.Align == 2)
{
- x=r.left+((rw-fw));
+ x = r.left+((rw-fw));
}
- else x=r.left;
+ else x = r.left;
}
}
SelectClipRgn(hDC,rgn);
- ProtosData[i].DoubleIcons=FALSE;
+ ProtosData[i].DoubleIcons = FALSE;
- DWORD dim = ProtosData[i].isDimmed ? ( ( 64<<24 ) | 0x80 ) : 0;
+ DWORD dim = ProtosData[i].isDimmed ? ( ( 64 << 24 ) | 0x80 ) : 0;
- if ((ProtosData[i].xStatusMode&3)==3)
+ if ((ProtosData[i].xStatusMode&3) == 3)
{
if (hIcon) mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL, DI_NORMAL|dim );
if (hxIcon)
{
mod_DrawIconEx_helper(hDC,x+GetSystemMetrics(SM_CXSMICON)+1,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim);
- x+=GetSystemMetrics(SM_CXSMICON)+1;
+ x += GetSystemMetrics(SM_CXSMICON)+1;
}
- ProtosData[i].DoubleIcons=hIcon&&hxIcon;
+ ProtosData[i].DoubleIcons = hIcon&&hxIcon;
}
else
{
if (hxIcon) mod_DrawIconEx_helper(hDC,x,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim);
- if (hIcon) mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL| ((hxIcon&&(ProtosData[i].xStatusMode&4))?(192<<24):0 ) | dim );
+ if (hIcon) mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL| ((hxIcon&&(ProtosData[i].xStatusMode&4))?(192 << 24):0 ) | dim );
}
if ( ( hxIcon || hIcon) && TRUE /* TODO g_StatusBarData.bDrawLockOverlay options to draw locked proto*/ )
@@ -626,7 +626,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if ( db_get_b( NULL,ProtosData[i].AccountName,"LockMainStatus",0 ))
{
HICON hLockOverlay = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED);
- if (hLockOverlay != NULL)
+ if (hLockOverlay !=NULL)
{
mod_DrawIconEx_helper(hDC, x, iconY, hLockOverlay, GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL | dim);
CallService(MS_SKIN2_RELEASEICON, (WPARAM)hLockOverlay, 0); }
@@ -635,65 +635,65 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if (hxIcon) DestroyIcon_protect(hxIcon);
if (NeedDestroy) DestroyIcon_protect(hIcon);
else CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
- x+=GetSystemMetrics(SM_CXSMICON)+1;
+ x += GetSystemMetrics(SM_CXSMICON)+1;
}
if (ProtosData[i].showProtoName)
{
SIZE textSize;
- RECT rt=r;
- rt.left=x+(spaceWidth>>1);
- rt.top=textY;
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
ske_DrawText(hDC,ProtosData[i].ProtoHumanName,lstrlen(ProtosData[i].ProtoHumanName),&rt,0);
- if ((ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount!=NULL) || ProtosData[i].showStatusName || ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
+ if ((ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount != NULL) || ProtosData[i].showStatusName || ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
{
GetTextExtentPoint32(hDC, ProtosData[i].ProtoHumanName, lstrlen(ProtosData[i].ProtoHumanName), &textSize);
- x += textSize.cx + 3;
+ x += textSize.cx + 3;
}
}
- if (ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount!=NULL)
+ if (ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount != NULL)
{
SIZE textSize;
- RECT rt=r;
- rt.left=x+(spaceWidth>>1);
- rt.top=textY;
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
ske_DrawTextA(hDC,ProtosData[i].ProtoEMailCount,lstrlenA(ProtosData[i].ProtoEMailCount),&rt,0);
//TextOutS(hDC,x,textY,ProtosData[i].ProtoName,lstrlenA(ProtosData[i].ProtoName));
if (ProtosData[i].showStatusName || ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
{
GetTextExtentPoint32A(hDC,ProtosData[i].ProtoEMailCount,lstrlenA(ProtosData[i].ProtoEMailCount),&textSize);
- x+=textSize.cx+3;
+ x += textSize.cx+3;
}
}
if (ProtosData[i].showStatusName)
{
SIZE textSize;
- RECT rt=r;
- rt.left=x+(spaceWidth>>1);
- rt.top=textY;
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
ske_DrawTextA(hDC, ProtosData[i].ProtoStatusText, lstrlenA(ProtosData[i].ProtoStatusText),&rt,0);
if (((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
{
GetTextExtentPoint32A(hDC,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText),&textSize);
- x+=textSize.cx+3;
+ x += textSize.cx+3;
}
//TextOutS(hDC,x,textY,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText));
}
if ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus)
{
- RECT rt=r;
- rt.left=x+(spaceWidth>>1);
- rt.top=textY;
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
ske_DrawText(hDC,ProtosData[i].ProtoXStatus,lstrlen(ProtosData[i].ProtoXStatus),&rt,0);
//TextOutS(hDC,x,textY,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText));
}
- ProtosData[i].protoRect=r;
+ ProtosData[i].protoRect = r;
- r.left=r.right+g_StatusBarData.extraspace;
+ r.left = r.right+g_StatusBarData.extraspace;
//SelectClipRgn(hDC,NULL);
DeleteObject(rgn);
@@ -702,7 +702,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if (ProtoWidth) mir_free_and_nill(ProtoWidth);
} //code for each line
- ProtosData=orig_ProtosData;
+ ProtosData = orig_ProtosData;
}
}
}
@@ -758,11 +758,11 @@ static BOOL _ModernStatus_OnExtraIconClick( int protoIndex ) #define TOOLTIP_TOLERANCE 5
LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
- static POINT ptToolTipShow={0};
+ static POINT ptToolTipShow = {0};
switch (msg)
{
case WM_CREATE:
- g_StatusBarData.hTheme=xpt_AddThemeHandle(hwnd,L"STATUS");
+ g_StatusBarData.hTheme = xpt_AddThemeHandle(hwnd,L"STATUS");
break;
case WM_DESTROY:
xpt_FreeThemeForWindow(hwnd);
@@ -770,42 +770,42 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam {
int k;
- for (k=0; k<allocedItemData; k++)
+ for (k = 0; k < allocedItemData; k++)
{
- if(ProtosData[k].AccountName) mir_free_and_nill (ProtosData[k].AccountName);
- if(ProtosData[k].ProtoName) mir_free_and_nill (ProtosData[k].ProtoName);
- if(ProtosData[k].ProtoEMailCount) mir_free_and_nill (ProtosData[k].ProtoEMailCount);
- if(ProtosData[k].ProtoHumanName) mir_free_and_nill (ProtosData[k].ProtoHumanName);
- if(ProtosData[k].ProtoStatusText) mir_free_and_nill (ProtosData[k].ProtoStatusText);
- if(ProtosData[k].ProtoEMailCount) mir_free_and_nill (ProtosData[k].ProtoEMailCount);
- if(ProtosData[k].ProtoXStatus) mir_free_and_nill (ProtosData[k].ProtoXStatus);
+ if (ProtosData[k].AccountName) mir_free_and_nill (ProtosData[k].AccountName);
+ if (ProtosData[k].ProtoName) mir_free_and_nill (ProtosData[k].ProtoName);
+ if (ProtosData[k].ProtoEMailCount) mir_free_and_nill (ProtosData[k].ProtoEMailCount);
+ if (ProtosData[k].ProtoHumanName) mir_free_and_nill (ProtosData[k].ProtoHumanName);
+ if (ProtosData[k].ProtoStatusText) mir_free_and_nill (ProtosData[k].ProtoStatusText);
+ if (ProtosData[k].ProtoEMailCount) mir_free_and_nill (ProtosData[k].ProtoEMailCount);
+ if (ProtosData[k].ProtoXStatus) mir_free_and_nill (ProtosData[k].ProtoXStatus);
}
mir_free_and_nill(ProtosData);
- ProtosData=NULL;
- allocedItemData=0;
+ ProtosData = NULL;
+ allocedItemData = 0;
}
break;
case WM_SIZE:
- if (!g_CluiData.fLayered || GetParent(hwnd)!=pcli->hwndContactList)
+ if (!g_CluiData.fLayered || GetParent(hwnd) != pcli->hwndContactList)
InvalidateRect(hwnd,NULL,FALSE);
return DefWindowProc(hwnd, msg, wParam, lParam);
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
- if (GetParent(hwnd)==pcli->hwndContactList && g_CluiData.fLayered)
+ if (GetParent(hwnd) == pcli->hwndContactList && g_CluiData.fLayered)
CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,0);
- else if (GetParent(hwnd)==pcli->hwndContactList && !g_CluiData.fLayered)
+ else if (GetParent(hwnd) == pcli->hwndContactList && !g_CluiData.fLayered)
{
HDC hdc, hdc2;
HBITMAP hbmp,hbmpo;
- RECT rc={0};
+ RECT rc = {0};
GetClientRect(hwnd,&rc);
rc.right++;
rc.bottom++;
hdc = GetDC(hwnd);
- hdc2=CreateCompatibleDC(hdc);
- hbmp=ske_CreateDIB32(rc.right,rc.bottom);
- hbmpo=(HBITMAP)SelectObject(hdc2,hbmp);
+ hdc2 = CreateCompatibleDC(hdc);
+ hbmp = ske_CreateDIB32(rc.right,rc.bottom);
+ hbmpo = (HBITMAP)SelectObject(hdc2,hbmp);
SetBkMode(hdc2,TRANSPARENT);
ske_BltBackImage(hwnd,hdc2,&rc);
ModernDrawStatusBarWorker(hwnd,hdc2);
@@ -825,12 +825,12 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam HBITMAP hbmp, hbmpo;
RECT rc;
PAINTSTRUCT ps;
- HBRUSH br=GetSysColorBrush(COLOR_3DFACE);
+ HBRUSH br = GetSysColorBrush(COLOR_3DFACE);
GetClientRect(hwnd,&rc);
- hdc=BeginPaint(hwnd,&ps);
- hdc2=CreateCompatibleDC(hdc);
- hbmp=ske_CreateDIB32(rc.right,rc.bottom);
- hbmpo=(HBITMAP) SelectObject(hdc2,hbmp);
+ hdc = BeginPaint(hwnd,&ps);
+ hdc2 = CreateCompatibleDC(hdc);
+ hbmp = ske_CreateDIB32(rc.right,rc.bottom);
+ hbmpo = (HBITMAP) SelectObject(hdc2,hbmp);
FillRect(hdc2,&ps.rcPaint,br);
ModernDrawStatusBarWorker(hwnd,hdc2);
//BitBlt(hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right-ps.rcPaint.left,ps.rcPaint.bottom-ps.rcPaint.top,
@@ -840,7 +840,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam SelectObject(hdc2,hbmpo);
DeleteObject(hbmp);
mod_DeleteDC(hdc2);
- ps.fErase=FALSE;
+ ps.fErase = FALSE;
EndPaint(hwnd,&ps);
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -849,10 +849,10 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam RECT rct;
GetWindowRect(hwnd,&rct);
memset((LPMINMAXINFO)lParam,0,sizeof(MINMAXINFO));
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=16;
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=16;
- ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x=1600;
- ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y=1600;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 16;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 16;
+ ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 1600;
+ ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = 1600;
return(0);
}
@@ -862,48 +862,48 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam int ID;
if (tooltipshoing){
NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing=FALSE;
+ tooltipshoing = FALSE;
};
- ID=Sync( FindFrameID, hwnd );
+ ID = Sync( FindFrameID, hwnd );
if (ID)
{
- res=CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,ID),0);
- if (res>=0) db_set_b(0,"CLUI","ShowSBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
+ res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,ID),0);
+ if (res >= 0) db_set_b(0,"CLUI","ShowSBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
}
}
break;
case WM_TIMER:
{
- if (wParam==TM_STATUSBARHIDE)
+ if (wParam == TM_STATUSBARHIDE)
{
KillTimer(hwnd,TM_STATUSBARHIDE);
if (tooltipshoing)
{
NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing=FALSE;
+ tooltipshoing = FALSE;
ReleaseCapture();
};
}
- else if (wParam==TM_STATUSBAR)
+ else if (wParam == TM_STATUSBAR)
{
POINT pt;
KillTimer(hwnd,TM_STATUSBAR);
GetCursorPos(&pt);
- if (pt.x==lastpnt.x&&pt.y==lastpnt.y)
+ if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
{
int i;
RECT rc;
ScreenToClient(hwnd,&pt);
- for (i=0; i<allocedItemData; i++)
+ for (i = 0; i < allocedItemData; i++)
{
- rc=ProtosData[i].protoRect;
- if(PtInRect(&rc,pt))
+ rc = ProtosData[i].protoRect;
+ if (PtInRect(&rc,pt))
{
NotifyEventHooks(g_CluiData.hEventStatusBarShowToolTip,(WPARAM)ProtosData[i].AccountName,0);
CLUI_SafeSetTimer(hwnd,TM_STATUSBARHIDE,db_get_w(NULL,"CLUIFrames","HideToolTipTime",SETTING_HIDETOOLTIPTIME_DEFAULT),0);
- tooltipshoing=TRUE;
+ tooltipshoing = TRUE;
ClientToScreen(hwnd,&pt);
- ptToolTipShow=pt;
+ ptToolTipShow = pt;
SetCapture(hwnd);
return 0;
}
@@ -922,7 +922,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam {
KillTimer(hwnd,TM_STATUSBARHIDE);
NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing=FALSE;
+ tooltipshoing = FALSE;
ReleaseCapture();
}
}
@@ -934,17 +934,17 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam POINT pt;
GetCursorPos(&pt);
SendMessage(GetParent(hwnd),msg,wParam,lParam);
- if (pt.x==lastpnt.x&&pt.y==lastpnt.y)
+ if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
{
return(CLUI_TestCursorOnBorders());
};
- lastpnt=pt;
+ lastpnt = pt;
if (tooltipshoing)
if (abs(pt.x-ptToolTipShow.x)>TOOLTIP_TOLERANCE || abs(pt.y-ptToolTipShow.y)>TOOLTIP_TOLERANCE)
{
KillTimer(hwnd,TM_STATUSBARHIDE);
NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing=FALSE;
+ tooltipshoing = FALSE;
ReleaseCapture();
};
KillTimer(hwnd,TM_STATUSBAR);
@@ -960,40 +960,40 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam RECT rc;
POINT pt;
int i;
- pt.x=(short)LOWORD(lParam);
- pt.y=(short)HIWORD(lParam);
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
KillTimer(hwnd,TM_STATUSBARHIDE);
KillTimer(hwnd,TM_STATUSBAR);
if (tooltipshoing){
NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
};
- tooltipshoing=FALSE;
- for (i=0; i<allocedItemData; i++)
+ tooltipshoing = FALSE;
+ for (i = 0; i < allocedItemData; i++)
{
RECT rc1;
- BOOL isOnExtra=FALSE;
+ BOOL isOnExtra = FALSE;
- rc=ProtosData[i].protoRect;
- rc1=rc;
- rc1.left=rc.left+16;
- rc1.right=rc1.left+16;
+ rc = ProtosData[i].protoRect;
+ rc1 = rc;
+ rc1.left = rc.left+16;
+ rc1.right = rc1.left+16;
if (PtInRect(&rc,pt) && PtInRect(&rc1,pt)&&ProtosData[i].DoubleIcons)
- isOnExtra=TRUE;
- if(PtInRect(&rc,pt))
+ isOnExtra = TRUE;
+ if (PtInRect(&rc,pt))
{
- HMENU hMenu=NULL;
+ HMENU hMenu = NULL;
- BOOL bShift =( GetKeyState( VK_SHIFT )&0x8000 );
- BOOL bCtrl =( GetKeyState( VK_CONTROL )&0x8000 );
+ BOOL bShift = ( GetKeyState( VK_SHIFT )&0x8000 );
+ BOOL bCtrl = ( GetKeyState( VK_CONTROL )&0x8000 );
- if ( ( msg==WM_MBUTTONDOWN || ( msg==WM_RBUTTONDOWN && bCtrl ) || isOnExtra) && _ModernStatus_OnExtraIconClick( i ))
+ if ( ( msg == WM_MBUTTONDOWN || ( msg == WM_RBUTTONDOWN && bCtrl ) || isOnExtra) && _ModernStatus_OnExtraIconClick( i ))
{
return TRUE;
}
if ( msg == WM_LBUTTONDOWN && bCtrl )
{
- if ( g_CluiData.bFilterEffective != CLVM_FILTER_PROTOS || !bShift )
+ if ( g_CluiData.bFilterEffective !=CLVM_FILTER_PROTOS || !bShift )
{
ApplyViewMode( "" );
mir_snprintf( g_CluiData.protoFilter, SIZEOF(g_CluiData.protoFilter), "%s|", ProtosData[i].AccountName );
@@ -1032,11 +1032,11 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam ProtoEnumAccounts( &protoCount, &accs );
bool first = true;
- for ( int pos = 0; pos<protoCount; pos++ )
+ for ( int pos = 0; pos < protoCount; pos++ )
{
int i = pcli->pfnGetAccountIndexByPos( pos );
- if ( i < 0 && i >= protoCount )
+ if ( i < 0 && i >= protoCount )
continue;
char protoF[ sizeof(g_CluiData.protoFilter) ];
@@ -1063,20 +1063,20 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam }
if (!hMenu)
{
- if (msg==WM_RBUTTONDOWN)
+ if (msg == WM_RBUTTONDOWN)
{
BOOL a = ( (g_StatusBarData.perProtoConfig && ProtosData[i].SBarRightClk) || g_StatusBarData.SBarRightClk );
if ( a ^ bShift )
- hMenu=(HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
+ hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
else
- hMenu=(HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
}
else
{
- hMenu=(HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
unsigned int cpnl = 0;
int mcnt = GetMenuItemCount(hMenu);
- for (int j=0; j<mcnt; ++j) {
+ for (int j = 0; j < mcnt; ++j) {
HMENU hMenus = GetSubMenu(hMenu, j);
if (hMenus && cpnl++ == i) {
hMenu = hMenus;
@@ -1087,8 +1087,8 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam }
ClientToScreen(hwnd,&pt);
{
- HWND parent=GetParent(hwnd);
- if (parent!=pcli->hwndContactList) parent=GetParent(parent);
+ HWND parent = GetParent(hwnd);
+ if (parent != pcli->hwndContactList) parent = GetParent(parent);
TrackPopupMenu(hMenu,TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y,0,parent,NULL);
}
return 0;
@@ -1110,10 +1110,10 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam HWND StatusBar_Create(HWND parent)
{
- WNDCLASS wndclass={0};
- TCHAR pluginname[]=TEXT("ModernStatusBar");
- int h=GetSystemMetrics(SM_CYSMICON)+2;
- if (GetClassInfo(g_hInst,pluginname,&wndclass) ==0)
+ WNDCLASS wndclass = {0};
+ TCHAR pluginname[] = TEXT("ModernStatusBar");
+ int h = GetSystemMetrics(SM_CYSMICON)+2;
+ if (GetClassInfo(g_hInst,pluginname,&wndclass) == 0)
{
wndclass.style = 0;
wndclass.lpfnWndProc = ModernStatusProc;
@@ -1127,21 +1127,21 @@ HWND StatusBar_Create(HWND parent) wndclass.lpszClassName = pluginname;
RegisterClass(&wndclass);
}
- hModernStatusBar=CreateWindow(pluginname,pluginname,WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,
+ hModernStatusBar = CreateWindow(pluginname,pluginname,WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,
0,0,0,h,parent,NULL,g_hInst,NULL);
// register frame
{
CLISTFrame Frame;
memset(&Frame,0,sizeof(Frame));
- Frame.cbSize=sizeof(CLISTFrame);
- Frame.hWnd=hModernStatusBar;
- Frame.align=alBottom;
- Frame.hIcon=LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
- Frame.Flags=(db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
- Frame.height=h;
- Frame.tname=_T("Status Bar");
- Frame.TBtname=TranslateT("Status Bar");
- hFramehModernStatusBar=(HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0);
+ Frame.cbSize = sizeof(CLISTFrame);
+ Frame.hWnd = hModernStatusBar;
+ Frame.align = alBottom;
+ Frame.hIcon = LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
+ Frame.Flags = (db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
+ Frame.height = h;
+ Frame.tname = _T("Status Bar");
+ Frame.TBtname = TranslateT("Status Bar");
+ hFramehModernStatusBar = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0);
CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)Frame.hWnd,(LPARAM)NewStatusPaintCallbackProc); //$$$$$ register sub for frame
}
|