From d949a7ed17fd90bfc1ee5d85c83812b974037531 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 15 Nov 2012 21:04:26 +0000 Subject: - fix for the Online/Offline button in clist_mw - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@2320 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_mw/src/BkgrCfg.cpp | 16 ++-- plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp | 64 +++++++-------- plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp | 2 +- plugins/Clist_mw/src/CLUIFrames/statusbar.cpp | 12 +-- plugins/Clist_mw/src/clc.cpp | 18 ++-- plugins/Clist_mw/src/clcidents.cpp | 16 ++-- plugins/Clist_mw/src/clcitems.cpp | 48 +++++------ plugins/Clist_mw/src/clcopts.cpp | 52 ++++++------ plugins/Clist_mw/src/clcpaint.cpp | 12 +-- plugins/Clist_mw/src/clcutils.cpp | 6 +- plugins/Clist_mw/src/clist.h | 4 +- plugins/Clist_mw/src/clistmod.cpp | 12 +-- plugins/Clist_mw/src/clistopts.cpp | 48 +++++------ plugins/Clist_mw/src/clistsettings.cpp | 109 +++++++++++-------------- plugins/Clist_mw/src/clisttray.cpp | 2 +- plugins/Clist_mw/src/clui.cpp | 30 +++---- plugins/Clist_mw/src/cluiopts.cpp | 70 ++++++++-------- plugins/Clist_mw/src/cluiservices.cpp | 6 +- plugins/Clist_mw/src/contact.cpp | 35 +++----- plugins/Clist_mw/src/groupmenu.cpp | 14 ++-- plugins/Clist_mw/src/init.cpp | 8 +- plugins/Clist_mw/src/keyboard.cpp | 2 +- plugins/TopToolBar/src/InternalButtons.cpp | 8 +- 23 files changed, 280 insertions(+), 314 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_mw/src/BkgrCfg.cpp b/plugins/Clist_mw/src/BkgrCfg.cpp index dba17a1ca4..33932c7e5f 100644 --- a/plugins/Clist_mw/src/BkgrCfg.cpp +++ b/plugins/Clist_mw/src/BkgrCfg.cpp @@ -69,17 +69,17 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->item[indx].selColor = DBGetContactSettingDword(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR); { DBVARIANT dbv; - if (!DBGetContactSettingString(NULL,module,"BkBitmap",&dbv)) + if ( !DBGetContactSettingString(NULL,module,"BkBitmap",&dbv)) { int retval = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)dat->item[indx].filename); - if (!retval || retval == CALLSERVICE_NOTFOUND) + if ( !retval || retval == CALLSERVICE_NOTFOUND) lstrcpynA(dat->item[indx].filename, dbv.pszVal, MAX_PATH); mir_free(dbv.pszVal); } else *dat->item[indx].filename = 0; } - dat->item[indx].flags = DBGetContactSettingWord(NULL,module,"BkBmpUse", DEFAULT_BKBMPUSE); + dat->item[indx].flags = db_get_w(NULL,module,"BkBmpUse", DEFAULT_BKBMPUSE); jndx = SendMessageA(hList, CB_ADDSTRING, 0, (LPARAM)Translate(bkgrList[indx])); SendMessage(hList, CB_SETITEMDATA, jndx, indx); } @@ -175,7 +175,7 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ofn.nMaxFile = sizeof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) break; + if ( !GetOpenFileNameA(&ofn)) break; SetDlgItemTextA(hwndDlg, IDC_FILENAME, str); } else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) @@ -216,7 +216,7 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->item[indx].changed) { char *module = bkgrList[indx] + strlen(bkgrList[indx]) + 1; - DBWriteContactSettingByte(NULL, module, "UseBitmap", (BYTE)dat->item[indx].useBitmap); + db_set_b(NULL, module, "UseBitmap", (BYTE)dat->item[indx].useBitmap); { COLORREF col; @@ -235,10 +235,10 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int retval = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dat->item[indx].filename, (LPARAM)str); - if (!retval || retval == CALLSERVICE_NOTFOUND) - DBWriteContactSettingString(NULL, module, "BkBitmap", dat->item[indx].filename); + if ( !retval || retval == CALLSERVICE_NOTFOUND) + db_set_s(NULL, module, "BkBitmap", dat->item[indx].filename); else - DBWriteContactSettingString(NULL, module, "BkBitmap", str); + db_set_s(NULL, module, "BkBitmap", str); } DBWriteContactSettingWord(NULL, module, "BkBmpUse", dat->item[indx].flags); dat->item[indx].changed = FALSE; diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index 2226988142..7c9381f7cc 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -492,9 +492,9 @@ int DBLoadFrameSettingsAtPos(int pos,int Frameid) Frames[Frameid].visible = db_get_b(0,CLUIFrameModule,AS(buf,"Visible",sadd),Frames[Frameid].visible); Frames[Frameid].TitleBar.ShowTitleBar = db_get_b(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),Frames[Frameid].TitleBar.ShowTitleBar); - Frames[Frameid].height = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),Frames[Frameid].height); - Frames[Frameid].HeightWhenCollapsed = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),0); - Frames[Frameid].align = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),Frames[Frameid].align); + Frames[Frameid].height = db_get_w(0,CLUIFrameModule,AS(buf,"Height",sadd),Frames[Frameid].height); + Frames[Frameid].HeightWhenCollapsed = db_get_w(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),0); + Frames[Frameid].align = db_get_w(0,CLUIFrameModule,AS(buf,"Align",sadd),Frames[Frameid].align); Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),100,0,1024); Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),100,0,1024); @@ -502,7 +502,7 @@ int DBLoadFrameSettingsAtPos(int pos,int Frameid) Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),100,0,1024); Frames[Frameid].floating = db_get_b(0,CLUIFrameModule,AS(buf,"Floating",sadd),0); - Frames[Frameid].order = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),0); + Frames[Frameid].order = db_get_w(0,CLUIFrameModule,AS(buf,"Order",sadd),0); Frames[Frameid].UseBorder = db_get_b(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),Frames[Frameid].UseBorder); @@ -518,10 +518,10 @@ int DBStoreFrameSettingsAtPos(int pos,int Frameid) DBWriteContactSettingTString(0,CLUIFrameModule,AS(buf,"Name",sadd),Frames[Frameid].name); //boolean - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(Frames[Frameid].collapsed)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(Frames[Frameid].Locked)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),(BYTE)btoint(Frames[Frameid].visible)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),(BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar)); + db_set_b(0,CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(Frames[Frameid].collapsed)); + db_set_b(0,CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(Frames[Frameid].Locked)); + db_set_b(0,CLUIFrameModule,AS(buf,"Visible",sadd),(BYTE)btoint(Frames[Frameid].visible)); + db_set_b(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),(BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar)); DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),(WORD)Frames[Frameid].height); DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),(WORD)Frames[Frameid].HeightWhenCollapsed); @@ -532,10 +532,10 @@ int DBStoreFrameSettingsAtPos(int pos,int Frameid) DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),(WORD)Frames[Frameid].FloatingSize.x); DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),(WORD)Frames[Frameid].FloatingSize.y); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),(BYTE)btoint(Frames[Frameid].floating)); - DBWriteContactSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),(BYTE)btoint(Frames[Frameid].UseBorder)); + db_set_b(0,CLUIFrameModule,AS(buf,"Floating",sadd),(BYTE)btoint(Frames[Frameid].floating)); + db_set_b(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),(BYTE)btoint(Frames[Frameid].UseBorder)); DBWriteContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),(WORD)Frames[Frameid].order); - //DBWriteContactSettingString(0,CLUIFrameModule,AS(buf,"TBName",sadd),Frames[Frameid].TitleBar.tbname); + //db_set_s(0,CLUIFrameModule,AS(buf,"TBName",sadd),Frames[Frameid].TitleBar.tbname); return 0; } @@ -564,7 +564,7 @@ int CLUIFramesLoadFrameSettings(int Frameid) if (Frameid < 0 || Frameid >= nFramescount) return -1; - int maxstored = DBGetContactSettingWord(0,CLUIFrameModule,"StoredFrames",-1); + int maxstored = db_get_w(0,CLUIFrameModule,"StoredFrames",-1); if (maxstored == -1) return 0; @@ -581,7 +581,7 @@ int CLUIFramesStoreFrameSettings(int Frameid) if (Frameid < 0 || Frameid >= nFramescount) return -1; - int maxstored = DBGetContactSettingWord(0,CLUIFrameModule,"StoredFrames",-1); + int maxstored = db_get_w(0,CLUIFrameModule,"StoredFrames",-1); if (maxstored == -1) maxstored = 0; int storpos = LocateStorePosition(Frameid,maxstored); @@ -933,11 +933,11 @@ INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam,LPARAM lParam) case FO_FLAGS: retval = 0; if (Frames[pos].visible) retval |= F_VISIBLE; - if (!Frames[pos].collapsed) retval |= F_UNCOLLAPSED; + if ( !Frames[pos].collapsed) retval |= F_UNCOLLAPSED; if (Frames[pos].Locked) retval |= F_LOCKED; if (Frames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; if (Frames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; - if (!(GetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; + if ( !(GetWindowLongPtr(Frames[pos].hWnd,GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; break; case FO_NAME: @@ -1071,7 +1071,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam,LPARAM lParam) if (lParam<0) {ulockfrm(); return -1;} retval = Frames[pos].height; Frames[pos].height = lParam; - if (!CLUIFramesFitInSize()) Frames[pos].height = retval; + if ( !CLUIFramesFitInSize()) Frames[pos].height = retval; retval = Frames[pos].height; ulockfrm(); @@ -1148,7 +1148,7 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM wParam,LPARAM lParam) CLUIFrameResizeFloatingFrame(pos); ulockfrm(); - if (!Frames[pos].floating) + if ( !Frames[pos].floating) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); return 0; } @@ -1353,8 +1353,8 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam,LPARAM lParam) Frames[FrameId].collapsed = TRUE; } - if (!Frames[FrameId].floating) { - if (!CLUIFramesFitInSize()) { + if ( !Frames[FrameId].floating) { + if ( !CLUIFramesFitInSize()) { //cant collapse,we can resize only for heighthwndContactList,0); else { //SetWindowPos(Frames[FrameId].hWnd,HWND_TOP,0,0,Frames[FrameId].wndSize.right-Frames[FrameId].wndSize.left,Frames[FrameId].height,SWP_SHOWWINDOW|SWP_NOMOVE); @@ -1549,7 +1549,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam,LPARAM lParam) if (pcli->hwndContactList == 0) return -1; if (FramesSysNotStarted) return -1; if (clfrm->cbSize != sizeof(CLISTFrame)) return -1; - if (!(TitleBarFont)) TitleBarFont = CLUILoadTitleBarFont(); + if ( !(TitleBarFont)) TitleBarFont = CLUILoadTitleBarFont(); lockfrm(); if (nFramescount>=MAX_FRAMES) { ulockfrm(); return -1;} @@ -1801,7 +1801,7 @@ int CLUIFramesResize(const RECT newsize) tbh = (TitleBarH+GapBetweenTitlebar)*btoint(Frames[clientfrm].TitleBar.ShowTitleBar); for (i = 0; i < nFramescount; i++) { - if (!Frames[i].floating) { + if ( !Frames[i].floating) { Frames[i].needhide = FALSE; Frames[i].wndSize.left = 0; Frames[i].wndSize.right = newsize.right-0; @@ -1991,12 +1991,12 @@ int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam) if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;} if ( db_get_b(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) { - if (!DBGetContactSetting(NULL,"FrameTitleBar","BkBitmap",&dbv)) { + if ( !DBGetContactSetting(NULL,"FrameTitleBar","BkBitmap",&dbv)) { hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal); mir_free(dbv.pszVal); } } - backgroundBmpUse = DBGetContactSettingWord(NULL,"FrameTitleBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); + backgroundBmpUse = db_get_w(NULL,"FrameTitleBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); CLUIFramesOnClistResize(0,0); return 0; @@ -2119,7 +2119,7 @@ void DrawBackGroundTTB(HWND hwnd,HDC mhdc) DeleteDC(hdcMem); paintst.fErase = FALSE; //DeleteObject(hFont); - if (!mhdc) + if ( !mhdc) EndPaint(hwnd,&paintst); } @@ -2156,7 +2156,7 @@ static int DrawTitleBar(HDC dc,RECT rect,int Frameid) SelBkColour = DBGetContactSettingDword(NULL,"CLUIFrames","FramesTitleBarFontCol",0); if (SelBkColour) SetTextColor(hdcMem,SelBkColour); - if (!AlignCOLLIconToLeft) { + if ( !AlignCOLLIconToLeft) { if (Frames[pos].TitleBar.hicon != NULL) { //(TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1) @@ -2169,7 +2169,7 @@ static int DrawTitleBar(HDC dc,RECT rect,int Frameid) else TextOut(hdcMem,GetSystemMetrics(SM_CXSMICON)+2,0,Frames[pos].TitleBar.tbname,lstrlen(Frames[pos].TitleBar.tbname)); - if (!AlignCOLLIconToLeft) + if ( !AlignCOLLIconToLeft) DrawIconEx(hdcMem,Frames[pos].TitleBar.wndSize.right-GetSystemMetrics(SM_CXSMICON)-2,((TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1)),Frames[pos].collapsed?LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN):LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); else DrawIconEx(hdcMem,0,((TitleBarH>>1)-(GetSystemMetrics(SM_CXSMICON)>>1)),Frames[pos].collapsed?LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN):LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT),GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL); @@ -2417,7 +2417,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA GetWindowRect(pcli->hwndContactList, &rcMiranda ); - if (!IntersectRect( &rcOverlap, &rcwnd, &rcMiranda )) { + if ( !IntersectRect( &rcOverlap, &rcwnd, &rcMiranda )) { ulockfrm(); GetCursorPos(&curpt); GetWindowRect( Frames[pos].hWnd, &rcwnd ); @@ -2543,7 +2543,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (newh > 0) { prevold = Frames[Framemod].height; Frames[Framemod].height = newh; - if (!CLUIFramesFitInSize()) { + if ( !CLUIFramesFitInSize()) { Frames[Framemod].height = prevold; ulockfrm(); return TRUE; @@ -2593,7 +2593,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) int width,height; RECT rect; - if (!Frames[framepos].floating){return 0;} + if ( !Frames[framepos].floating){return 0;} if (Frames[framepos].ContainerWnd == 0){return 0;} GetClientRect(Frames[framepos].ContainerWnd,&rect); @@ -2650,7 +2650,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L lockfrm(); framepos = id2pos(Frameid); if (framepos<0||framepos>=nFramescount){ulockfrm();break;} - if (!Frames[framepos].minmaxenabled){ulockfrm();break;} + if ( !Frames[framepos].minmaxenabled){ulockfrm();break;} if (Frames[framepos].ContainerWnd == 0){ulockfrm();break;} if (Frames[framepos].Locked) { @@ -2777,7 +2777,7 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam) GetWindowRect(frame->hWnd,&rectw); GetWindowRect(frame->TitleBar.hwnd,&recttb); - if (!frame->TitleBar.ShowTitleBar) + if ( !frame->TitleBar.ShowTitleBar) recttb.top = recttb.bottom = recttb.left = recttb.right = 0; frame->ContainerWnd = CreateContainerWindow(pcli->hwndContactList,frame->FloatingPos.x,frame->FloatingPos.y,10,10); diff --git a/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp index d3c0480cd1..f850143c20 100644 --- a/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp @@ -180,7 +180,7 @@ int InitFramesMenus(void) { TMenuParam tmp; - if (!ServiceExists(MO_REMOVEMENUOBJECT)) + if ( !ServiceExists(MO_REMOVEMENUOBJECT)) { InitCustomMenus(); diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp index c8c62c1bd4..2c88c43175 100644 --- a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -42,7 +42,7 @@ int OnStatusBarBackgroundChange() } } - backgroundBmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); + backgroundBmpUse = db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0); RecreateStatusBar(pcli->hwndContactList); @@ -106,7 +106,7 @@ void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis) if (showOpts & 4) { TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0); - if (!szStatus) + if ( !szStatus) szStatus = _T(""); GetTextExtentPoint32(dis->hDC,szStatus,lstrlen(szStatus),&textSize); TextOut(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-textSize.cy)>>1,szStatus,lstrlen(szStatus)); @@ -262,7 +262,7 @@ void DrawBackGround(HWND hwnd,HDC mhdc) DeleteObject(hBmpOsb); DeleteDC(hdcMem); paintst.fErase = FALSE; - if (!mhdc) + if ( !mhdc) EndPaint(hwnd,&paintst); } @@ -309,7 +309,7 @@ LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_SHOWWINDOW: if (hFrameHelperStatusBar) { int res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0); - DBWriteContactSettingByte(0, "CLUI", "ShowSBar", (res & F_VISIBLE) != 0); + db_set_b(0, "CLUI", "ShowSBar", (res & F_VISIBLE) != 0); } if (tooltipshoing){ @@ -345,7 +345,7 @@ LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa return 0; NotifyEventHooks(hStatusBarShowToolTipEvent,(WPARAM)PD->RealName,0); - SetTimer(hwnd,TM_STATUSBARHIDE,DBGetContactSettingWord(NULL,"CLUIFrames","HideToolTipTime",5000),0); + SetTimer(hwnd,TM_STATUSBARHIDE,db_get_w(NULL,"CLUIFrames","HideToolTipTime",5000),0); tooltipshoing = TRUE; break; } @@ -368,7 +368,7 @@ LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa tooltipshoing = FALSE; } KillTimer(hwnd,TM_STATUSBAR); - SetTimer(hwnd,TM_STATUSBAR,DBGetContactSettingWord(NULL,"CLC","InfoTipHoverTime",750),0); + SetTimer(hwnd,TM_STATUSBAR,db_get_w(NULL,"CLC","InfoTipHoverTime",750),0); } return 0; diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index 8735d1c2bd..dce9541b22 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -61,7 +61,7 @@ void StatusUpdaterThread(void*) if ( db_get_b(hContact,"CList","StatusMsgAuto",0)) { for (i = 0; i<5; i++) { if (hContact != NULL) { - pClcCacheEntry pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry((HANDLE)hContact); + ClcCacheEntry *pdnce = (ClcCacheEntry *)pcli->pfnGetCacheEntry((HANDLE)hContact); if (pdnce && !pdnce->protoNotExists && pdnce->szProto) CallContactService(hContact, PSS_GETAWAYMSG, 0, 0); @@ -102,7 +102,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) if ((HANDLE)wParam != NULL && !strcmp(cws->szModule,"CList")) { if ( !strcmp( cws->szSetting, "noOffline" )) pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, wParam, lParam ); - else if (!strcmp(cws->szSetting,"StatusMsg")) + else if ( !strcmp(cws->szSetting,"StatusMsg")) pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED, wParam, lParam ); } return 0; @@ -144,7 +144,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L int recalcScrollBar = 0,shouldShow; HANDLE hSelItem = NULL; struct ClcContact *selcontact = NULL; - pClcCacheEntry cacheEntry = GetContactFullCacheEntry((HANDLE)wParam); + ClcCacheEntry *cacheEntry = GetContactFullCacheEntry((HANDLE)wParam); WORD status; int needsResort = 0; @@ -159,7 +159,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L ClcContact *contact; ClcGroup *group; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) hSelItem = pcli->pfnContactToHItem(selcontact); @@ -180,7 +180,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (contact->iImage == (WORD)lParam) break; if (sortByStatus) dat->needsResort = 1; - if (!shouldShow && !(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { + if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) hSelItem = pcli->pfnContactToHItem(selcontact); RemoveItemFromGroup(hwnd,group,contact,0); @@ -191,7 +191,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L int oldflags; contact->iImage = (WORD)lParam; oldflags = contact->flags; - if (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE; + if ( !pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE; else contact->flags &= ~CONTACTF_ONLINE; if (oldflags != contact->flags) dat->needsResort = 1; @@ -212,14 +212,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L { DBVARIANT dbv; - if (!(dat->style & CLS_SHOWSTATUSMESSAGES)) + if ( !(dat->style & CLS_SHOWSTATUSMESSAGES)) break; ClcContact *contact; ClcGroup *group; if ( FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL) && contact != NULL) { contact->flags &= ~CONTACTF_STATUSMSG; - if (!DBGetContactSettingTString((HANDLE)wParam, "CList", "StatusMsg", &dbv)) { + if ( !DBGetContactSettingTString((HANDLE)wParam, "CList", "StatusMsg", &dbv)) { int j; if (dbv.ptszVal == NULL||_tcslen(dbv.ptszVal) == 0) break; lstrcpyn(contact->szStatusMsg, dbv.ptszVal, SIZEOF(contact->szStatusMsg)); @@ -254,7 +254,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L KillTimer(hwnd,TIMERID_SUBEXPAND); if (hitcontact) { if (hitcontact->SubExpanded) hitcontact->SubExpanded = 0; else hitcontact->SubExpanded = 1; - DBWriteContactSettingByte(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded); + db_set_b(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded); } hitcontact = NULL; dat->needsResort = 1; diff --git a/plugins/Clist_mw/src/clcidents.cpp b/plugins/Clist_mw/src/clcidents.cpp index 8c254fef90..43a34f4e61 100644 --- a/plugins/Clist_mw/src/clcidents.cpp +++ b/plugins/Clist_mw/src/clcidents.cpp @@ -80,7 +80,7 @@ int GetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex) return -1; } -pClcCacheEntry GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) +ClcCacheEntry *GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) { if (hContact == 0) return NULL; @@ -109,14 +109,14 @@ pClcCacheEntry GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) { - pClcCacheEntry cacheEntry; + ClcCacheEntry *cacheEntry; if (hContact == INVALID_HANDLE_VALUE) { int i,tick; tick = GetTickCount(); for (i = 0;i<(dat->lCLCContactsCache.realCount);i++) { - pClcCacheEntry pdnce = (pClcCacheEntry)dat->lCLCContactsCache.items[i]; + ClcCacheEntry *pdnce = (ClcCacheEntry *)dat->lCLCContactsCache.items[i]; pdnce->ClcContact = NULL; } tick = GetTickCount()-tick; @@ -135,7 +135,7 @@ void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) void SetClcContactCacheItem(struct ClcData *dat,HANDLE hContact,void *contact) { - pClcCacheEntry cacheEntry; + ClcCacheEntry *cacheEntry; if ( !IsHContactGroup(hContact) && !IsHContactInfo(hContact)) { cacheEntry = GetCLCFullCacheEntry(dat,hContact); if (cacheEntry != NULL) @@ -153,7 +153,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont if (isVisible == NULL && hItem != NULL && subgroup == NULL && !IsHContactGroup(hItem) && !IsHContactInfo(hItem)) { //try use cache - pClcCacheEntry cacheEntry; + ClcCacheEntry *cacheEntry; cacheEntry = GetCLCFullCacheEntry(dat,hItem); if (cacheEntry != NULL) { if (cacheEntry->ClcContact == NULL) { @@ -185,7 +185,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont nowVisible = 1; for (tgroup = group;tgroup;tgroup = tgroup->parent) - if (!group->expanded) { + if ( !group->expanded) { nowVisible = 0; break; } @@ -198,7 +198,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem&~HCONTACT_ISINFO))) { if (isVisible) { - if (!nowVisible) *isVisible = 0; + if ( !nowVisible) *isVisible = 0; else { if ((index+1)*dat->rowHeightyScroll) *isVisible = 0; else { @@ -242,7 +242,7 @@ ClcGroup *CacheIndex[CacheArrSize] = {NULL}; boolean CacheIndexClear = TRUE; void ClearRowByIndexCache() { - if (!CacheIndexClear) { + if ( !CacheIndexClear) { memset(CacheIndex,0,sizeof(CacheIndex)); CacheIndexClear = TRUE; } diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 5935022209..bea0430653 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -41,7 +41,7 @@ void AddSubcontacts(struct ClcContact * cont) { int subcount,i,j; HANDLE hsub; - pClcCacheEntry cacheEntry; + ClcCacheEntry *cacheEntry; cacheEntry = GetContactFullCacheEntry(cont->hContact); OutputDebugStringA("Proceed AddSubcontacts\r\n"); subcount = (int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0); @@ -50,11 +50,10 @@ void AddSubcontacts(struct ClcContact * cont) cont->subcontacts = (struct ClcContact *) mir_realloc(cont->subcontacts, sizeof(struct ClcContact)*subcount); cont->SubAllocated = subcount; i = 0; - for (j = 0; jhContact,j); cacheEntry = GetContactFullCacheEntry(hsub); - if (!( db_get_b(NULL,"CLC","MetaHideOfflineSub",1) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT))|| + if ( !(db_get_b(NULL,"CLC","MetaHideOfflineSub",1) && db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) || cacheEntry->status != ID_STATUS_OFFLINE ) { cont->subcontacts[i].hContact = cacheEntry->hContact; @@ -69,7 +68,8 @@ void AddSubcontacts(struct ClcContact * cont) } } cont->SubAllocated = i; - if (!i) mir_free(cont->subcontacts); + if (i == 0) + mir_free(cont->subcontacts); } void FreeContact(struct ClcContact *p) @@ -89,11 +89,9 @@ int AddItemToGroup(ClcGroup *group,int iAboveItem) ClcGroup *AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers) { - ClcGroup* result; - ClearRowByIndexCache(); dat->needsResort = 1; - result = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers); + ClcGroup *result = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers); ClearRowByIndexCache(); return result; } @@ -111,7 +109,7 @@ int AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText) return i; } -static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group,pClcCacheEntry cacheEntry) +static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group,ClcCacheEntry *cacheEntry) { char *szProto; WORD apparentMode; @@ -168,7 +166,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group group->cl.items[i]->proto = szProto; if (dat->style & CLS_SHOWSTATUSMESSAGES) { - if (!DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv)) { + if ( !DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv)) { int j; lstrcpyn(group->cl.items[i]->szStatusMsg, dbv.ptszVal, SIZEOF(group->cl.items[i]->szStatusMsg)); for (j = (int)_tcslen(group->cl.items[i]->szStatusMsg)-1;j>=0;j--) { @@ -192,7 +190,7 @@ void AddContactToTree(HWND hwnd, ClcData *dat, HANDLE hContact, int updateTotalC if ( FindItem(hwnd,dat,hContact,NULL,NULL,NULL) == 1) return; - pClcCacheEntry cacheEntry = GetContactFullCacheEntry(hContact); + ClcCacheEntry *cacheEntry = GetContactFullCacheEntry(hContact); if (cacheEntry == NULL) return; @@ -236,10 +234,10 @@ void AddContactToTree(HWND hwnd, ClcData *dat, HANDLE hContact, int updateTotalC TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); if (szGroupName == NULL) return; //never happens - if (!lstrcmp(szGroupName,cacheEntry->tszGroup)) + if ( !lstrcmp(szGroupName,cacheEntry->tszGroup)) break; size_t len = lstrlen(szGroupName); - if (!_tcsncmp(szGroupName,cacheEntry->tszGroup,len) && cacheEntry->tszGroup[len] == '\\') + if ( !_tcsncmp(szGroupName,cacheEntry->tszGroup,len) && cacheEntry->tszGroup[len] == '\\') AddGroup(hwnd,dat,szGroupName,groupFlags,i,1); } group = AddGroup(hwnd,dat,cacheEntry->tszGroup,groupFlags,i,1); @@ -247,7 +245,7 @@ void AddContactToTree(HWND hwnd, ClcData *dat, HANDLE hContact, int updateTotalC } if (checkHideOffline) { - if (pcli->pfnIsHiddenMode(dat,status) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { + if (pcli->pfnIsHiddenMode(dat,status) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { if (updateTotalCount) group->totalMembers++; return; } @@ -288,10 +286,10 @@ void DeleteItemFromTree(HWND hwnd,HANDLE hItem) ClearRowByIndexCache(); dat->needsResort = 1; - if (!FindItem(hwnd,dat,hItem,&contact,&group,NULL)) { + if ( !FindItem(hwnd,dat,hItem,&contact,&group,NULL)) { DBVARIANT dbv; int i,nameOffset; - if (!IsHContactContact(hItem)) return; + if ( !IsHContactContact(hItem)) return; ClearClcContactCache(dat,hItem); if (DBGetContactSettingTString(hItem,"CList","Group",&dbv)) return; @@ -305,7 +303,7 @@ void DeleteItemFromTree(HWND hwnd,HANDLE hItem) if (group->cl.items[i]->type == CLCIT_GROUP) { int len = lstrlen(group->cl.items[i]->szText); - if (!_tcsncmp(group->cl.items[i]->szText,dbv.ptszVal+nameOffset,len) && (dbv.ptszVal[nameOffset+len] == '\\' || dbv.pszVal[nameOffset+len] == '\0')) { + if ( !_tcsncmp(group->cl.items[i]->szText,dbv.ptszVal+nameOffset,len) && (dbv.ptszVal[nameOffset+len] == '\\' || dbv.pszVal[nameOffset+len] == '\0')) { group->totalMembers--; if (dbv.pszVal[nameOffset+len] == '\0') break; @@ -357,7 +355,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) hContact = db_find_first(); while(hContact) { - pClcCacheEntry cacheEntry; + ClcCacheEntry *cacheEntry; cont = NULL; cacheEntry = GetContactFullCacheEntry(hContact); //cacheEntry->ClcContact = NULL; @@ -375,15 +373,13 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) if (group != NULL) { group->totalMembers++; - if (!(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { - //szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { if (cacheEntry->szProto == NULL) { - if (!pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->noHiddenOffline) + if ( !pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->noHiddenOffline) cont = AddContactToGroup(dat,group,cacheEntry); } - else - if (!pcli->pfnIsHiddenMode(dat,cacheEntry->status)||cacheEntry->noHiddenOffline) - cont = AddContactToGroup(dat,group,cacheEntry); + else if ( !pcli->pfnIsHiddenMode(dat,cacheEntry->status)||cacheEntry->noHiddenOffline) + cont = AddContactToGroup(dat,group,cacheEntry); } else cont = AddContactToGroup(dat,group,cacheEntry); } @@ -455,7 +451,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) && (group->cl.items[group->scanIndex]->flags & CONTACTF_STATUSMSG)) { count++; } - if (!direction) { + if ( !direction) { if (count>selection) return lastcount; } if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) { @@ -664,7 +660,7 @@ void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) for (i = 0;ilist; else { - if (!FindItem(hwnd,dat,(HANDLE)(savedInfo[i].parentId|HCONTACT_ISGROUP),&contact,NULL,NULL)) continue; + if ( !FindItem(hwnd,dat,(HANDLE)(savedInfo[i].parentId|HCONTACT_ISGROUP),&contact,NULL,NULL)) continue; group = contact->group; } j = AddInfoItemToGroup(group,savedInfo[i].contact.flags,_T("")); diff --git a/plugins/Clist_mw/src/clcopts.cpp b/plugins/Clist_mw/src/clcopts.cpp index 6ef5e61634..981a03a27e 100644 --- a/plugins/Clist_mw/src/clcopts.cpp +++ b/plugins/Clist_mw/src/clcopts.cpp @@ -60,7 +60,7 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); - if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { + if ( !ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG); odp.pszTitle = LPGEN("List Background"); odp.pfnDlgProc = DlgProcClcBkgOpts; @@ -73,7 +73,7 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = DlgProcClcMetaOpts; Options_AddPage(wParam, &odp); - if (!ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { + if ( !ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG); odp.pszTitle = LPGEN("StatusBar Background"); odp.pfnDlgProc = DlgProcStatusBarBkgOpts; @@ -193,11 +193,11 @@ static INT_PTR CALLBACK DlgProcClcMetaOpts(HWND hwndDlg, UINT msg, WPARAM wParam switch (t->code) { case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CLC","Meta",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_META)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA_IGN)); // by FYR - DBWriteContactSettingByte(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR + db_set_b(NULL,"CLC","Meta",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_META)); // by FYR + db_set_b(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR + db_set_b(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR + db_set_b(NULL,"CLC","MetaIgnoreEmptyExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA_IGN)); // by FYR + db_set_b(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR pcli->pfnClcOptionsChanged(); return TRUE; } @@ -223,7 +223,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam UDACCEL accel[2] = {{0,10},{2,50}}; SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETRANGE,0,MAKELONG(999,0)); SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETACCEL,SIZEOF(accel), (LPARAM)&accel ); - SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME),0)); + SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME),0)); } CheckDlgButton(hwndDlg,IDC_IDLE,db_get_b(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE)?BST_CHECKED:BST_UNCHECKED); @@ -292,12 +292,12 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam else DBWriteContactSettingDword(NULL,"CLC","GreyoutFlags",0); - DBWriteContactSettingByte(NULL,"CLC","ShowIdle",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_IDLE)?1:0)); + db_set_b(NULL,"CLC","ShowIdle",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_IDLE)?1:0)); DBWriteContactSettingDword(NULL,"CLC","OfflineModes",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS))); - DBWriteContactSettingByte(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0)); + db_set_b(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0)); DBWriteContactSettingWord(NULL,"CLC","ScrollTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CLC","GroupIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CLC","NoVScrollBar",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_NOSCROLLBAR)?1:0)); + db_set_b(NULL,"CLC","GroupIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_GETPOS,0,0)); + db_set_b(NULL,"CLC","NoVScrollBar",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_NOSCROLLBAR)?1:0)); pcli->pfnClcOptionsChanged(); return TRUE; @@ -325,7 +325,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR)); { DBVARIANT dbv; - if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) { + if ( !DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) { SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal); if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) { char szPath[MAX_PATH]; @@ -337,7 +337,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w mir_free(dbv.pszVal); } - WORD bmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); + WORD bmpUse = db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE); CheckDlgButton(hwndDlg,IDC_STRETCHH,bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwndDlg,IDC_STRETCHV,bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwndDlg,IDC_TILEH,bmpUse&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); @@ -382,7 +382,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w ofn.nMaxFile = SIZEOF(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) break; + if ( !GetOpenFileNameA(&ofn)) break; SetDlgItemTextA(hwndDlg,IDC_FILENAME,str); } else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) break; @@ -396,7 +396,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - DBWriteContactSettingByte(NULL,"StatusBar","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + db_set_b(NULL,"StatusBar","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); { COLORREF col; col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); @@ -410,10 +410,10 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); if (ServiceExists(MS_UTILS_PATHTORELATIVE)) { if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strrel)) - DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",strrel); - else DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",str); + db_set_s(NULL,"StatusBar","BkBitmap",strrel); + else db_set_s(NULL,"StatusBar","BkBitmap",str); } - else DBWriteContactSettingString(NULL,"StatusBar","BkBitmap",str); + else db_set_s(NULL,"StatusBar","BkBitmap",str); WORD flags = 0; if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; @@ -450,7 +450,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR); SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR)); { DBVARIANT dbv; - if (!DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv)) { + if ( !DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv)) { SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal); if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) { char szPath[MAX_PATH]; @@ -462,7 +462,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } } - { WORD bmpUse = DBGetContactSettingWord(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE); + { WORD bmpUse = db_get_w(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE); CheckDlgButton(hwndDlg,IDC_STRETCHH,bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwndDlg,IDC_STRETCHV,bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwndDlg,IDC_TILEH,bmpUse&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED); @@ -505,7 +505,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ofn.nMaxFile = SIZEOF(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) break; + if ( !GetOpenFileNameA(&ofn)) break; SetDlgItemTextA(hwndDlg,IDC_FILENAME,str); } else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE) break; @@ -518,7 +518,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CLC","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); + db_set_b(NULL,"CLC","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP)); { COLORREF col; col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); if (col == CLCDEFAULT_BKCOLOUR) DBDeleteContactSetting(NULL,"CLC","BkColour"); @@ -532,10 +532,10 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str)); if (ServiceExists(MS_UTILS_PATHTORELATIVE)) { if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strrel)) - DBWriteContactSettingString(NULL,"CLC","BkBitmap",strrel); - else DBWriteContactSettingString(NULL,"CLC","BkBitmap",str); + db_set_s(NULL,"CLC","BkBitmap",strrel); + else db_set_s(NULL,"CLC","BkBitmap",str); } - else DBWriteContactSettingString(NULL,"CLC","BkBitmap",str); + else db_set_s(NULL,"CLC","BkBitmap",str); } { WORD flags = 0; if (IsDlgButtonChecked(hwndDlg,IDC_STRETCHH)) flags |= CLB_STRETCHH; diff --git a/plugins/Clist_mw/src/clcpaint.cpp b/plugins/Clist_mw/src/clcpaint.cpp index ae5e78ec02..529c0420cc 100644 --- a/plugins/Clist_mw/src/clcpaint.cpp +++ b/plugins/Clist_mw/src/clcpaint.cpp @@ -127,9 +127,9 @@ static int GetRealStatus(struct ClcContact * contact, int status) { int i; char *szProto = contact->proto; - if (!szProto) return status; + if ( !szProto) return status; for (i = 0;ihClcProtoCount;i++) { - if (!lstrcmpA(pcli->clcProto[i].szProto,szProto)) { + if ( !lstrcmpA(pcli->clcProto[i].szProto,szProto)) { return pcli->clcProto[i].dwStatus; } } @@ -386,7 +386,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) // THEME if (IsWinVerXPPlus()) { - if (!themeAPIHandle) { + if ( !themeAPIHandle) { themeAPIHandle = GetModuleHandleA("uxtheme"); if (themeAPIHandle) { MyOpenThemeData = (HANDLE (WINAPI *)(HWND,LPCWSTR))MGPROC("OpenThemeData"); @@ -534,7 +534,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) } } - if (!Drawing->isSubcontact || ( db_get_b(NULL,"CLC","MetaHideExtra",0) == 0)) { + if ( !Drawing->isSubcontact || ( db_get_b(NULL,"CLC","MetaHideExtra",0) == 0)) { //extra icons if ( !(style & CLS_EX_MULTICOLUMNALIGNLEFT)) { @@ -558,7 +558,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) testrc.top = (y+((dat->rowHeight-16)>>1)); testrc.right = testrc.left+16; testrc.bottom = testrc.top+16; - if (!PtInRect(&testrc,pt)) + if ( !PtInRect(&testrc,pt)) mode = ILD_NORMAL; ImageList_DrawEx(dat->himlExtraColumns,Drawing->iExtraImage[iImage],hdcMem,clRect.right-dat->extraColumnSpacing*(dat->extraColumnsCount-c),y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode); @@ -642,7 +642,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) SelectObject(hdcMem,hoBrush); DeleteObject(hBrush); } - if (!grey) + if ( !grey) BitBlt(hdc,rcPaint->left,rcPaint->top,rcPaint->right-rcPaint->left,rcPaint->bottom-rcPaint->top,hdcMem,rcPaint->left,rcPaint->top,SRCCOPY); //DeleteDC(hdcMem); if (hBrushAlternateGrey) DeleteObject(hBrushAlternateGrey); diff --git a/plugins/Clist_mw/src/clcutils.cpp b/plugins/Clist_mw/src/clcutils.cpp index 21188e3ddf..9a655f7c74 100644 --- a/plugins/Clist_mw/src/clcutils.cpp +++ b/plugins/Clist_mw/src/clcutils.cpp @@ -169,9 +169,9 @@ void ScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth) if (desty>maxy) desty = maxy; if (desty<0) desty = 0; if (abs(desty-dat->yScroll)<4) noSmooth = 1; - if (!noSmooth && dat->exStyle&CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; + if ( !noSmooth && dat->exStyle&CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; previousy = dat->yScroll; - if (!noSmooth) { + if ( !noSmooth) { startTick = GetTickCount(); for (;;) { nowTick = GetTickCount(); @@ -227,7 +227,7 @@ void RecalcScrollBar(HWND hwnd,struct ClcData *dat) sbar = (dat->noVScrollbar == 1||(int)si.nPage>si.nMax); ShowScrollBar(hwnd,SB_VERT,sbar? FALSE : TRUE); - if (!sbar) { + if ( !sbar) { if ( GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_CONTACTLIST ) { if ( dat->noVScrollbar == 0 ) SetScrollInfo(hwnd,SB_VERT,&si,TRUE); else SetScrollInfo(hwnd,SB_VERT,&si,FALSE); diff --git a/plugins/Clist_mw/src/clist.h b/plugins/Clist_mw/src/clist.h index 56efca3218..2736a08f44 100644 --- a/plugins/Clist_mw/src/clist.h +++ b/plugins/Clist_mw/src/clist.h @@ -48,8 +48,6 @@ struct ClcCacheEntry : public ClcCacheEntryBase boolean isUnknown; }; -typedef ClcCacheEntry *pClcCacheEntry; - -pClcCacheEntry GetContactFullCacheEntry(HANDLE hContact); +ClcCacheEntry* GetContactFullCacheEntry(HANDLE hContact); #endif \ No newline at end of file diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index c03e073457..edf5ca68cd 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -48,12 +48,12 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) char AdvancedService[255] = {0}; int nActStatus = nStatus; HANDLE hActContact = hContact; - if (!db_get_b(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) { + if ( !db_get_b(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) { // substitute params by mostonline contact datas HANDLE hMostOnlineContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0); if (hMostOnlineContact && hMostOnlineContact != (HANDLE)CALLSERVICE_NOTFOUND) { - pClcCacheEntry cacheEntry; - cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hMostOnlineContact); + ClcCacheEntry *cacheEntry; + cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hMostOnlineContact); if (cacheEntry && cacheEntry->szProto) { szActProto = cacheEntry->szProto; nActStatus = cacheEntry->status; @@ -86,7 +86,7 @@ int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status) hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(UINT)hContact,0); if ( hContact != 0 ) { szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(UINT)hContact,0); - status = DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE); + status = db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE); } } }*/ @@ -101,7 +101,7 @@ static int ProtocolAck(WPARAM wParam,LPARAM lParam) ACKDATA *ack = (ACKDATA*)lParam; if (ack->type == ACKTYPE_AWAYMSG && ack->lParam) { DBVARIANT dbv; - if (!DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv)) { + if ( !DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv)) { if ( !_tcscmp(dbv.ptszVal, (TCHAR *)ack->lParam)) { DBFreeVariant(&dbv); return 0; @@ -131,7 +131,7 @@ int LoadContactListModule(void) { HANDLE hContact = db_find_first(); while (hContact != NULL) { - DBWriteContactSettingString(hContact, "CList", "StatusMsg", ""); + db_set_s(hContact, "CList", "StatusMsg", ""); hContact = db_find_next(hContact); } diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp index 0ce16ec41b..2a927efc75 100644 --- a/plugins/Clist_mw/src/clistopts.cpp +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -97,8 +97,8 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); { DWORD caps = CallService(MS_CLUI_GETCAPS,CLUICAPS_FLAGS1,0); - if (!(caps&CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_HIDEEMPTYGROUPS),SW_HIDE); - if (!(caps&CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_DISABLEGROUPS),SW_HIDE); + if ( !(caps&CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_HIDEEMPTYGROUPS),SW_HIDE); + if ( !(caps&CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg,IDC_DISABLEGROUPS),SW_HIDE); if (caps&CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg,IDC_ONTOP),SW_HIDE); if (caps&CLUIF_HASAUTOHIDEOPTION) { ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOHIDE),SW_HIDE); @@ -108,7 +108,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP } } SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1)); - SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); + SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(NULL,"CList","Tray1Click",SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !db_get_b(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); @@ -133,7 +133,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),FALSE); } SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETRANGE,0,MAKELONG(120,1)); - SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT),0)); + SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT),0)); { int i,count,item; PROTOACCOUNT **accs; DBVARIANT dbv = {DBVT_DELETED}; @@ -155,7 +155,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,0,0); SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_BLINKTIME),0); // set buddy SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETRANGE,0,MAKELONG(0x3FFF,250)); - SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","IconFlashTime",550),0)); + SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","IconFlashTime",550),0)); return TRUE; case WM_VSCROLL: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -190,42 +190,42 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE)); + db_set_b(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE)); { DWORD caps = CallService(MS_CLUI_GETCAPS,CLUICAPS_FLAGS1,0); - if (caps & CLUIF_HIDEEMPTYGROUPS) DBWriteContactSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEEMPTYGROUPS)); - if (caps & CLUIF_DISABLEGROUPS) DBWriteContactSettingByte(NULL,"CList","UseGroups",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_DISABLEGROUPS)); + if (caps & CLUIF_HIDEEMPTYGROUPS) db_set_b(NULL,"CList","HideEmptyGroups",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEEMPTYGROUPS)); + if (caps & CLUIF_DISABLEGROUPS) db_set_b(NULL,"CList","UseGroups",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_DISABLEGROUPS)); if ( !(caps & CLUIF_HASONTOPOPTION)) { - DBWriteContactSettingByte(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); + db_set_b(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); SetWindowPos(pcli->hwndContactList,IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } if ( !(caps & CLUIF_HASAUTOHIDEOPTION)) { - DBWriteContactSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + db_set_b(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); } } - DBWriteContactSettingByte(NULL,"CList","SortByStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYSTATUS)); - DBWriteContactSettingByte(NULL,"CList","SortByProto",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYPROTO)); - DBWriteContactSettingByte(NULL,"CList","NoOfflineBottom",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOOFFLINEMOVE)); - DBWriteContactSettingByte(NULL,"CLC","RowHeight",(BYTE)SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CLC","GammaCorrect",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_GAMMACORRECT)); - - DBWriteContactSettingByte(NULL,"CList","ConfirmDelete",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CONFIRMDELETE)); - DBWriteContactSettingByte(NULL,"CList","Tray1Click",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONECLK)); - DBWriteContactSettingByte(NULL,"CList","AlwaysStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYSSTATUS)); - DBWriteContactSettingByte(NULL,"CList","AlwaysMulti",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSMULTI)); - DBWriteContactSettingByte(NULL,"CList","TrayIcon",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)?SETTING_TRAYICON_SINGLE:(IsDlgButtonChecked(hwndDlg,IDC_CYCLE)?SETTING_TRAYICON_CYCLE:SETTING_TRAYICON_MULTI))); + db_set_b(NULL,"CList","SortByStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYSTATUS)); + db_set_b(NULL,"CList","SortByProto",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SORTBYPROTO)); + db_set_b(NULL,"CList","NoOfflineBottom",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOOFFLINEMOVE)); + db_set_b(NULL,"CLC","RowHeight",(BYTE)SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_GETPOS,0,0)); + db_set_b(NULL,"CLC","GammaCorrect",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_GAMMACORRECT)); + + db_set_b(NULL,"CList","ConfirmDelete",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CONFIRMDELETE)); + db_set_b(NULL,"CList","Tray1Click",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONECLK)); + db_set_b(NULL,"CList","AlwaysStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYSSTATUS)); + db_set_b(NULL,"CList","AlwaysMulti",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSMULTI)); + db_set_b(NULL,"CList","TrayIcon",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)?SETTING_TRAYICON_SINGLE:(IsDlgButtonChecked(hwndDlg,IDC_CYCLE)?SETTING_TRAYICON_CYCLE:SETTING_TRAYICON_MULTI))); DBWriteContactSettingWord(NULL,"CList","CycleTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_GETPOS,0,0)); DBWriteContactSettingWord(NULL,"CList","IconFlashTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CList","DisableTrayFlash",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISABLEBLINK)); - DBWriteContactSettingByte(NULL,"CList","NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ICONBLINK)); + db_set_b(NULL,"CList","DisableTrayFlash",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISABLEBLINK)); + db_set_b(NULL,"CList","NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ICONBLINK)); { int cursel = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0); PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETITEMDATA,cursel,0); if ( pa == NULL ) DBDeleteContactSetting(NULL, "CList","PrimaryStatus"); else - DBWriteContactSettingString(NULL,"CList","PrimaryStatus", pa->szModuleName); + db_set_s(NULL,"CList","PrimaryStatus", pa->szModuleName); } pcli->pfnTrayIconIconsChanged(); LoadContactTree(); /* this won't do job properly since it only really works when changes happen */ diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index 90154389a1..fb0c14e989 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -30,7 +30,7 @@ char *GetProtoForContact(HANDLE hContact); int GetStatusForContact(HANDLE hContact,char *szProto); TCHAR *UnknownConctactTranslatedName; extern boolean OnModulesLoadedCalled; -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pClcCacheEntry pdnce,int SettingType); +void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,ClcCacheEntry *pdnce,int SettingType); static int handleCompare( ClcCacheEntry* c1, ClcCacheEntry* c2 ) { @@ -50,7 +50,7 @@ void InitDisplayNameCache(SortedList *list) i = 0; while (hContact != 0) { - ClcCacheEntry *pdnce = (pClcCacheEntry)mir_calloc(sizeof(ClcCacheEntry)); + ClcCacheEntry *pdnce = (ClcCacheEntry *)mir_calloc(sizeof(ClcCacheEntry)); pdnce->hContact = hContact; InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,0); List_GetIndex(list,pdnce,&idx); @@ -59,7 +59,7 @@ void InitDisplayNameCache(SortedList *list) i++; } } -void FreeDisplayNameCacheItem(pClcCacheEntry p) +void FreeDisplayNameCacheItem(ClcCacheEntry *p) { if ( p->tszName) { mir_free(p->tszName); p->tszName = NULL; } if ( p->szProto) { mir_free(p->szProto); p->szProto = NULL; } @@ -78,7 +78,7 @@ void FreeDisplayNameCache(SortedList *list) void CheckPDNCE(ClcCacheEntry *_pdnce) { - pClcCacheEntry pdnce = (pClcCacheEntry)_pdnce; + ClcCacheEntry *pdnce = (ClcCacheEntry *)_pdnce; if (pdnce == NULL) return; @@ -120,7 +120,7 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) { DBVARIANT dbv; - if (!DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv)) + if ( !DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv)) { pdnce->tszGroup = mir_tstrdup(dbv.ptszVal); mir_free(dbv.pszVal); @@ -129,7 +129,7 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) } if (pdnce->bIsHidden == -1) - pdnce->bIsHidden = db_get_b(pdnce->hContact,"CList","bIsHidden",0); + pdnce->bIsHidden = db_get_b(pdnce->hContact,"CList","Hidden",0); if (pdnce->noHiddenOffline == -1) pdnce->noHiddenOffline = db_get_b(pdnce->hContact,"CList","noOffline",0); @@ -138,7 +138,7 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) pdnce->IdleTS = DBGetContactSettingDword(pdnce->hContact,pdnce->szProto,"IdleTS",0); if (pdnce->ApparentMode == -1) - pdnce->ApparentMode = DBGetContactSettingWord(pdnce->hContact,pdnce->szProto,"ApparentMode",0); + pdnce->ApparentMode = db_get_w(pdnce->hContact,pdnce->szProto,"ApparentMode",0); if (pdnce->NotOnList == -1) pdnce->NotOnList = db_get_b(pdnce->hContact,"CList","NotOnList",0); @@ -147,7 +147,7 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) pdnce->IsExpanded = db_get_b(pdnce->hContact,"CList","Expanded",0); } -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pClcCacheEntry pdnce,int SettingType) +void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,ClcCacheEntry *pdnce,int SettingType) { if ( hContact == NULL || pdnce == NULL ) return; @@ -198,7 +198,7 @@ void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pClcCacheEntry pdnce, char *GetContactCachedProtocol(HANDLE hContact) { - pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry&&cacheEntry->szProto) return cacheEntry->szProto; @@ -225,7 +225,7 @@ int GetStatusForContact(HANDLE hContact,char *szProto) { int status = ID_STATUS_OFFLINE; if (szProto) - status = DBGetContactSettingWord((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE); + status = db_get_w((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE); return (status); } @@ -244,9 +244,9 @@ TCHAR* GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown) return result; } -pClcCacheEntry GetContactFullCacheEntry(HANDLE hContact) +ClcCacheEntry *GetContactFullCacheEntry(HANDLE hContact) { - pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry != NULL) return(cacheEntry); @@ -255,7 +255,7 @@ pClcCacheEntry GetContactFullCacheEntry(HANDLE hContact) int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status) { - pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry != NULL) { if (Proto != NULL) *Proto = cacheEntry->szProto; @@ -267,7 +267,7 @@ int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status int GetContactCachedStatus(HANDLE hContact) { - pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry&&cacheEntry->status != 0) return cacheEntry->status; return 0; } @@ -275,91 +275,76 @@ int GetContactCachedStatus(HANDLE hContact) int ContactSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - pClcCacheEntry pdnce; + HANDLE hContact = (HANDLE)wParam; // Early exit - if ((HANDLE)wParam == NULL) + if (hContact == NULL) return 0; __try { - pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry((HANDLE)wParam); - if (pdnce == NULL) - { + ClcCacheEntry *pdnce = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); + if (pdnce == NULL) { OutputDebugStringA("!!! Very bad pdnce not found."); return 0; } - if (pdnce && pdnce->protoNotExists == FALSE && pdnce->szProto) - { - if (!strcmp(cws->szModule,pdnce->szProto)) - { - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + if (pdnce && pdnce->protoNotExists == FALSE && pdnce->szProto) { + if ( !strcmp(cws->szModule,pdnce->szProto)) { + InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,cws->value.type); - if (cws->value.type == DBVT_WORD&&!strcmp(cws->szSetting, "Status")) { - if (!(pdnce->bIsHidden == 1)) { + if (cws->value.type == DBVT_WORD && !strcmp(cws->szSetting, "Status")) { + if ( !(pdnce->bIsHidden == 1)) { - if ( db_get_b((HANDLE)NULL,"CList","ShowStatusMsg",0)||db_get_b((HANDLE)wParam,"CList","StatusMsgAuto",0)) - DBWriteContactSettingString((HANDLE)wParam, "CList", "StatusMsg", ""); + if ( db_get_b((HANDLE)NULL,"CList","ShowStatusMsg",0)||db_get_b(hContact,"CList","StatusMsgAuto",0)) + db_set_s(hContact, "CList", "StatusMsg", ""); if ( db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { // User's state is changing, and we are hideOffline-ing - if (cws->value.wVal == ID_STATUS_OFFLINE) { - ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR + ChangeContactIcon(hContact, ExtIconFromStatusMode(hContact,cws->szModule, cws->value.wVal), 0); //by FYR return 0; } - ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR - } - else - { - ChangeContactIcon((HANDLE)wParam, ExtIconFromStatusMode((HANDLE)wParam,cws->szModule, cws->value.wVal), 0); //by FYR + ChangeContactIcon(hContact, ExtIconFromStatusMode(hContact,cws->szModule, cws->value.wVal), 0); //by FYR } + else ChangeContactIcon(hContact, ExtIconFromStatusMode(hContact,cws->szModule, cws->value.wVal), 0); //by FYR } } - else if (!strcmp(cws->szModule,"MetaContacts")) - { + else if ( !strcmp(cws->szModule,"MetaContacts")) { PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); return 0; } else return 0; SortContacts(); - } } - - if (!strcmp(cws->szModule,"CList")) { - /* - sprintf(buf,"CHANGE: module:CList setting:%s %s\r\n",cws->szSetting,cws->value.pszVal); - OutputDebugStringA(buf); - */ + } + } - //name is null or (setting is myhandle) - if (pdnce->tszName == NULL||(!strcmp(cws->szSetting,"MyHandle"))) - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + if ( !strcmp(cws->szModule,"CList")) { + if (pdnce->tszName == NULL || !strcmp(cws->szSetting,"MyHandle")) + InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,cws->value.type); if ((!strcmp(cws->szSetting,"Group"))) - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,cws->value.type); - if (!strcmp(cws->szSetting,"bIsHidden")) { - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + if ( !strcmp(cws->szSetting,"Hidden")) { + InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,cws->value.type); if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto == NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),1); //by FYR - } } + ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact, szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)), 1); //by FYR + } + } - if (!strcmp(cws->szSetting,"noOffline")) - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); + if ( !strcmp(cws->szSetting, "noOffline")) + InvalidateDisplayNameCacheEntryByPDNE(hContact, pdnce, cws->value.type); } - if (!strcmp(cws->szModule,"Protocol")) { - if (!strcmp(cws->szSetting,"p")) { - char *szProto; - + if ( !strcmp(cws->szModule, "Protocol")) { + if ( !strcmp(cws->szSetting,"p")) { OutputDebugStringA("CHANGE: proto\r\n"); - InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); - if (cws->value.type == DBVT_DELETED) szProto = NULL; - else szProto = cws->value.pszVal; - ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto == NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),0); //by FYR + InvalidateDisplayNameCacheEntryByPDNE(hContact, pdnce, cws->value.type); + char *szProto = (cws->value.type == DBVT_DELETED) ? NULL : cws->value.pszVal; + ChangeContactIcon(hContact, ExtIconFromStatusMode(hContact, szProto, szProto == NULL?ID_STATUS_OFFLINE:db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE)),0); //by FYR } } } diff --git a/plugins/Clist_mw/src/clisttray.cpp b/plugins/Clist_mw/src/clisttray.cpp index 10fadb3c92..d18e90f443 100644 --- a/plugins/Clist_mw/src/clisttray.cpp +++ b/plugins/Clist_mw/src/clisttray.cpp @@ -163,7 +163,7 @@ INT_PTR TrayMenuExecService(WPARAM wParam,LPARAM lParam) { if (wParam != 0) { lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)wParam; - if (!strcmp(mmep->szServiceName,"Help/AboutCommand")) + if ( !strcmp(mmep->szServiceName,"Help/AboutCommand")) { //bug in help.c,it used wparam as parent window handle without reason. mmep->Param1 = 0; diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index 08fb0b97db..19abd6f0a4 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -193,7 +193,7 @@ HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean r _snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); } - if (!UseLibrary) { + if ( !UseLibrary) { hIcon = ExtractIconFromPath(szFullPath); if (hIcon) return hIcon; } @@ -266,7 +266,7 @@ HICON GetConnectingIconForProto_DLL(char *szProto,int b) } #endif - if (!strcmp(szProto,"ICQ")) + if ( !strcmp(szProto,"ICQ")) { #ifdef _DEBUG @@ -303,7 +303,7 @@ INT_PTR GetConnectingIconService(WPARAM wParam,LPARAM lParam) HICON hIcon = NULL; char *szProto = (char *)wParam; - if (!szProto) return 0; + if ( !szProto) return 0; pt = GetProtoTicksByProto(szProto); @@ -321,8 +321,8 @@ int CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) { int status = (int)wParam; char *szProto = (char *)lParam; - if (!szProto) return 0; - if (!status) return 0; + if ( !szProto) return 0; + if ( !status) return 0; if (( db_get_b(NULL,"CLUI","UseConnectingIcon",1) == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) { ProtoTicks *pt = NULL; @@ -337,7 +337,7 @@ int CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) cnt = 8; if (cnt != 0) { - DefaultStep = DBGetContactSettingWord(NULL,"CLUI","DefaultStepConnectingIcon",100); + DefaultStep = db_get_w(NULL,"CLUI","DefaultStepConnectingIcon",100); pt->IconsCount = cnt; SetTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n,(int)(DefaultStep)/1,0); pt->TimerCreated = 1; @@ -357,7 +357,7 @@ int OnSettingChanging(WPARAM wParam,LPARAM lParam) DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam; if (wParam == 0) { if ((dbcws->value.type == DBVT_BYTE)&&!strcmp(dbcws->szModule,"CLUI")) { - if (!strcmp(dbcws->szSetting,"SBarShow")) { + if ( !strcmp(dbcws->szSetting,"SBarShow")) { showOpts = dbcws->value.bVal; return 0; } @@ -371,7 +371,7 @@ HWND PreCreateCLC(HWND parent) pcli->hwndContactTree = CreateWindow(CLISTCONTROL_CLASS,_T(""), WS_CHILD|WS_CLIPCHILDREN|CLS_CONTACTLIST |( db_get_b(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0) - |CLS_HIDEOFFLINE + | CLS_HIDEOFFLINE //|( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0) |( db_get_b(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0) |( db_get_b(NULL,"CList","ShowStatusMessages",1)?CLS_SHOWSTATUSMESSAGES:0) @@ -422,7 +422,7 @@ int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc) ProtocolData *PD; int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0); - if (!UseOwnerDrawStatusBar) startoffset = 0; + if ( !UseOwnerDrawStatusBar) startoffset = 0; nParts = SendMessage(hwnd,SB_GETPARTS,0,0); FillMemory(rc,sizeof(RECT),0); @@ -433,7 +433,7 @@ int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc) if ( PD == NULL ) return 0; - if (!strcmp(szProto,PD->RealName)) + if ( !strcmp(szProto,PD->RealName)) { SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)rc); rc->left += startoffset; @@ -513,7 +513,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l CLUIFramesOnClistResize((WPARAM)hwnd,0); GetWindowRect(hwnd, &rc); - if (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) { + if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) { //if docked, dont remember pos (except for width) DBWriteContactSettingDword(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top)); DBWriteContactSettingDword(NULL,"CList","x",(DWORD)rc.left); @@ -524,9 +524,9 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if ( wParam == SIZE_MINIMIZED ) { if ( db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) { ShowWindow(hwnd, SW_HIDE); - DBWriteContactSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN); + db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN); } - else DBWriteContactSettingByte(NULL,"CList","State",SETTING_STATE_MINIMIZED); + else db_set_b(NULL,"CList","State",SETTING_STATE_MINIMIZED); } return 0; } @@ -550,7 +550,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l pt = &CycleStartTick[i]; if (pt->szProto != NULL&&pt->TimerCreated == 1) { status = CallProtoService(pt->szProto,PS_GETSTATUS,0,0); - if (!(status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) + if ( !(status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) { pt->CycleStartTick = 0; KillTimer(hwnd,TM_STATUSBARUPDATE+pt->n); @@ -728,7 +728,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l pcli->hwndContactList = NULL; UnLoadCLUIFramesModule(); - DBWriteContactSettingByte(NULL, "CList", "State", (BYTE)state); + db_set_b(NULL, "CList", "State", (BYTE)state); PostQuitMessage(0); break; } diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp index ac5faa798b..5a70db69b1 100644 --- a/plugins/Clist_mw/src/cluiopts.cpp +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -65,7 +65,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) { + if ( !IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) { EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),FALSE); @@ -79,11 +79,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL,"CLUI","AutoSizeUpward",0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1)); - SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); + SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0)); EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC01),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - if (!IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)) { + if ( !IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)) { EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC21),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC22),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_MAXSIZEHEIGHT),FALSE); @@ -115,29 +115,29 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L wsprintfA(szUin,"%u",DBGetContactSettingDword(NULL,"ICQ","UIN",0)); SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)szUin); - if (!DBGetContactSettingString(NULL,"ICQ","Nick",&dbv)) { + if ( !DBGetContactSettingString(NULL,"ICQ","Nick",&dbv)) { SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); mir_free(dbv.pszVal); dbv.pszVal = NULL; } - if (!DBGetContactSettingString(NULL,"ICQ","FirstName",&dbv)) { + if ( !DBGetContactSettingString(NULL,"ICQ","FirstName",&dbv)) { SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); mir_free(dbv.pszVal); dbv.pszVal = NULL; } - if (!DBGetContactSettingString(NULL,"ICQ","e-mail",&dbv)) { + if ( !DBGetContactSettingString(NULL,"ICQ","e-mail",&dbv)) { SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal); mir_free(dbv.pszVal); dbv.pszVal = NULL; } } - if (!IsWinVer2000Plus()) { + if ( !IsWinVer2000Plus()) { EnableWindow(GetDlgItem(hwndDlg,IDC_FADEINOUT),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENT),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_DROPSHADOW),FALSE); } else CheckDlgButton(hwndDlg,IDC_TRANSPARENT,db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?BST_CHECKED:BST_UNCHECKED); - if (!IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { + if ( !IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC11),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC12),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSACTIVE),FALSE); @@ -203,11 +203,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - DBWriteContactSettingByte(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); + db_set_b(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP)); SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - DBWriteContactSettingByte(NULL,"CList","ToolWindow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)); - DBWriteContactSettingByte(NULL,"CList","BringToFront",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BRINGTOFRONT)); + db_set_b(NULL,"CList","ToolWindow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)); + db_set_b(NULL,"CList","BringToFront",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BRINGTOFRONT)); if (IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) { // Window must be hidden to dynamically remove the taskbar button. // See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp @@ -228,22 +228,22 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetParent(pcli->hwndContactList,NULL); } - DBWriteContactSettingByte(NULL,"CLUI","ShowCaption",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); - DBWriteContactSettingByte(NULL,"CLUI","ShowMainMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)); - DBWriteContactSettingByte(NULL,"CLUI","ClientAreaDrag",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLIENTDRAG)); + db_set_b(NULL,"CLUI","ShowCaption",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); + db_set_b(NULL,"CLUI","ShowMainMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)); + db_set_b(NULL,"CLUI","ClientAreaDrag",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLIENTDRAG)); if (IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) SetWindowLongPtr(pcli->hwndContactList,GWL_STYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_STYLE)|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX); else SetWindowLongPtr(pcli->hwndContactList,GWL_STYLE,GetWindowLongPtr(pcli->hwndContactList,GWL_STYLE)&~(WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX)); - if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)) SetMenu(pcli->hwndContactList,NULL); + if ( !IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)) SetMenu(pcli->hwndContactList,NULL); else SetMenu(pcli->hwndContactList,hMenuMain); SetWindowPos(pcli->hwndContactList,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_FRAME|RDW_INVALIDATE); - DBWriteContactSettingByte(NULL,"CList","Min2Tray",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)); + db_set_b(NULL,"CList","Min2Tray",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)); if (IsIconic(pcli->hwndContactList) && !IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) ShowWindow(pcli->hwndContactList,IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)?SW_HIDE:SW_SHOW); @@ -252,18 +252,18 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DBWriteContactSettingTString(NULL,"CList","TitleText",title); SetWindowText(pcli->hwndContactList,title); } - DBWriteContactSettingByte(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT)); - DBWriteContactSettingByte(NULL,"CLUI","AutoSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); - DBWriteContactSettingByte(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE)); - DBWriteContactSettingByte(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD)); - DBWriteContactSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); + db_set_b(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT)); + db_set_b(NULL,"CLUI","AutoSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); + db_set_b(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE)); + db_set_b(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD)); + db_set_b(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); DBWriteContactSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CList","Transparent",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); - DBWriteContactSettingByte(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0)); - DBWriteContactSettingByte(NULL,"CList","WindowShadow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DROPSHADOW)); - DBWriteContactSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)); + db_set_b(NULL,"CList","Transparent",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)); + db_set_b(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0)); + db_set_b(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0)); + db_set_b(NULL,"CList","WindowShadow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DROPSHADOW)); + db_set_b(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)); if (IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); @@ -300,7 +300,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLUI","SBarBKColor",CLR_DEFAULT)); - if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) { + if ( !IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)) { EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),FALSE); @@ -343,15 +343,15 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L COLORREF col = SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0); DBWriteContactSettingDword(NULL,"CLUI","SBarBKColor",col); - DBWriteContactSettingByte(NULL,"CLUI","ShowSBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); - DBWriteContactSettingByte(NULL,"CLUI","SBarShow",(BYTE)((IsDlgButtonChecked(hwndDlg,IDC_SHOWICON)?1:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWPROTO)?2:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWSTATUS)?4:0))); - DBWriteContactSettingByte(NULL,"CLUI","SBarRightClk",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA)); - DBWriteContactSettingByte(NULL,"CLUI","EqualSections",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EQUALSECTIONS)); - DBWriteContactSettingByte(NULL,"CLUI","SBarBevel",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SBPANELBEVEL)); - DBWriteContactSettingByte(NULL,"CLUI","SBarUseSizeGrip",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSIZEGRIP)); + db_set_b(NULL,"CLUI","ShowSBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR)); + db_set_b(NULL,"CLUI","SBarShow",(BYTE)((IsDlgButtonChecked(hwndDlg,IDC_SHOWICON)?1:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWPROTO)?2:0)|(IsDlgButtonChecked(hwndDlg,IDC_SHOWSTATUS)?4:0))); + db_set_b(NULL,"CLUI","SBarRightClk",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA)); + db_set_b(NULL,"CLUI","EqualSections",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EQUALSECTIONS)); + db_set_b(NULL,"CLUI","SBarBevel",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SBPANELBEVEL)); + db_set_b(NULL,"CLUI","SBarUseSizeGrip",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSIZEGRIP)); - DBWriteContactSettingByte(NULL,"CLUI","UseConnectingIcon",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USECONNECTINGICON)); - DBWriteContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEOWNERDRAW)); + db_set_b(NULL,"CLUI","UseConnectingIcon",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USECONNECTINGICON)); + db_set_b(NULL,"CLUI","UseOwnerDrawStatusBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEOWNERDRAW)); UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0); int frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0); diff --git a/plugins/Clist_mw/src/cluiservices.cpp b/plugins/Clist_mw/src/cluiservices.cpp index dadea72c01..d57ae77741 100644 --- a/plugins/Clist_mw/src/cluiservices.cpp +++ b/plugins/Clist_mw/src/cluiservices.cpp @@ -116,7 +116,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) if (ind < 0) continue; - if (!pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) + if ( !pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) continue; x = 2; @@ -130,7 +130,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) if (showOpts & 4) { int status = CallProtoService(accs[ind]->szModuleName, PS_GETSTATUS, 0, 0); TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0); - if (!szStatus) + if ( !szStatus) szStatus = _T(""); GetTextExtentPoint32(hdc, szStatus, (int)_tcslen(szStatus), &textSize); x += textSize.cx; @@ -160,7 +160,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) int ind = pcli->pfnGetAccountIndexByPos(i); if (ind < 0) continue; - if (!pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) + if ( !pcli->pfnGetProtocolVisibility(accs[ind]->szModuleName)) continue; ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData)); diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index 6899374b7b..088e125d51 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -53,7 +53,7 @@ static int GetContactStatus(HANDLE hContact) szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); if (szProto == NULL) return ID_STATUS_OFFLINE; - return DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE); + return db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE); */ return (GetContactCachedStatus(hContact)); } @@ -75,30 +75,22 @@ static int GetStatusModeOrdering(int statusMode) void LoadContactTree(void) { - HANDLE hContact; - int i,hideOffline,status,tick; - pClcCacheEntry cacheEntry; - - - - tick = GetTickCount(); + int tick = GetTickCount(); CallService(MS_CLUI_LISTBEGINREBUILD,0,0); - for (i = 1;;i++) { - if ((char*)CallService(MS_CLIST_GROUPGETNAME2,i,(LPARAM)(int*)NULL) == NULL) break; - CallService(MS_CLUI_GROUPADDED,i,0); - } + for (int i=1;; i++) + if ((char*)CallService(MS_CLIST_GROUPGETNAME2, i, 0) != NULL) + CallService(MS_CLUI_GROUPADDED, i, 0); - hideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); - hContact = db_find_first(); + int hideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); + HANDLE hContact = db_find_first(); while(hContact != NULL) { - cacheEntry = GetContactFullCacheEntry(hContact); - if (cacheEntry == NULL) - { + ClcCacheEntry *cacheEntry = GetContactFullCacheEntry(hContact); + if (cacheEntry == NULL) { MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!",0); break; } - status = cacheEntry->status; + int status = cacheEntry->status; if ((!hideOffline || status != ID_STATUS_OFFLINE) && !cacheEntry->bIsHidden) ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)cacheEntry->szProto,status),1); hContact = db_find_next(hContact); @@ -111,13 +103,10 @@ void LoadContactTree(void) CallService(MS_CLUI_LISTENDREBUILD,0,0); tick = GetTickCount()-tick; - { + char buf[255]; - //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); sprintf(buf,"LoadContactTree %d \r\n",tick); - OutputDebugStringA(buf); - } } #define SAFESTRING(a) a?a:"" @@ -191,7 +180,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam) if ((HANDLE)lParam == NULL) DBDeleteContactSetting((HANDLE)wParam,"CList","Group"); else - DBWriteContactSettingString((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL)); + db_set_s((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL)); CallService(MS_CLUI_CONTACTADDED,wParam,ExtIconFromStatusMode((HANDLE)wParam,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0),GetContactStatus((HANDLE)wParam))); return 0; } diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index 9f5f5846ae..ecf2c4aeeb 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -155,7 +155,7 @@ INT_PTR GroupMenuExecService(WPARAM wParam,LPARAM lParam) { if (wParam != 0) { lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)wParam; - if (!strcmp(mmep->szServiceName,"Help/AboutCommand")) + if ( !strcmp(mmep->szServiceName,"Help/AboutCommand")) { //bug in help.c,it used wparam as parent window handle without reason. mmep->Param1 = 0; @@ -184,7 +184,7 @@ return 0; INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam) { int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS); - DBWriteContactSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)newVal); + db_set_b(NULL,"CList","HideEmptyGroups",(BYTE)newVal); SendMessage(pcli->hwndContactTree,CLM_SETHIDEEMPTYGROUPS,newVal,0); return 0; } @@ -192,7 +192,7 @@ INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam) INT_PTR UseGroupsHelper(WPARAM wParam,LPARAM lParam) { int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS); - DBWriteContactSettingByte(NULL,"CList","UseGroups",(BYTE)newVal); + db_set_b(NULL,"CList","UseGroups",(BYTE)newVal); SendMessage(pcli->hwndContactTree,CLM_SETUSEGROUPS,newVal,0); return 0; } @@ -209,11 +209,7 @@ SendMessage( static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) { - CLISTMENUITEM mi; - - - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize = sizeof(mi); + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | ( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi); @@ -530,7 +526,7 @@ INT_PTR SubGroupMenuExecService(WPARAM wParam,LPARAM lParam) { if (wParam != 0) { lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)wParam; - if (!strcmp(mmep->szServiceName,"Help/AboutCommand")) { + if ( !strcmp(mmep->szServiceName,"Help/AboutCommand")) { //bug in help.c,it used wparam as parent window handle without reason. mmep->Param1 = 0; CallService(mmep->szServiceName,mmep->Param1,lParam); diff --git a/plugins/Clist_mw/src/init.cpp b/plugins/Clist_mw/src/init.cpp index 8224186ff0..cbb0c062ad 100644 --- a/plugins/Clist_mw/src/init.cpp +++ b/plugins/Clist_mw/src/init.cpp @@ -125,12 +125,12 @@ INT_PTR SetDrawer(WPARAM wParam,LPARAM lParam) if (DSS->cbSize != sizeof(*DSS)) return -1; if (DSS->PluginName == NULL) return -1; if (DSS->PluginName == NULL) return -1; - if (!ServiceExists(DSS->GetDrawFuncsServiceName)) return -1; + if ( !ServiceExists(DSS->GetDrawFuncsServiceName)) return -1; SED.cbSize = sizeof(SED); SED.PaintClc = (void (__cdecl *)(HWND,struct ClcData *,HDC,RECT *,int ,ClcProtoStatus *,HIMAGELIST))CallService(DSS->GetDrawFuncsServiceName,CLUI_EXT_FUNC_PAINTCLC,0); - if (!SED.PaintClc) return -1; + if ( !SED.PaintClc) return -1; return 0; } @@ -139,9 +139,9 @@ static struct ClcContact* fnCreateClcContact( void ) return (struct ClcContact*)mir_calloc( sizeof( struct ClcContact )); } -static pClcCacheEntry fnCreateCacheItem( HANDLE hContact ) +static ClcCacheEntry *fnCreateCacheItem( HANDLE hContact ) { - pClcCacheEntry p = (pClcCacheEntry)mir_calloc( sizeof( ClcCacheEntry )); + ClcCacheEntry *p = (ClcCacheEntry *)mir_calloc( sizeof( ClcCacheEntry )); if ( p ) p->hContact = hContact; return p; diff --git a/plugins/Clist_mw/src/keyboard.cpp b/plugins/Clist_mw/src/keyboard.cpp index d099fab37c..140067eff5 100644 --- a/plugins/Clist_mw/src/keyboard.cpp +++ b/plugins/Clist_mw/src/keyboard.cpp @@ -31,7 +31,7 @@ INT_PTR hkCloseMiranda(WPARAM wParam,LPARAM lParam) INT_PTR hkRestoreStatus(WPARAM wParam,LPARAM lParam) { - int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE); + int nStatus = db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE); CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); return 0; diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index 7fcdc1cef8..0662c540bf 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -87,10 +87,9 @@ int InitInternalButtons(WPARAM, LPARAM) CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff); CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt); - TTBButton ttb = { 0 }; - ttb.cbSize = sizeof(ttb); - for (int i=0; i < SIZEOF(stdButtons); i++) { + TTBButton ttb = { 0 }; + ttb.cbSize = sizeof(ttb); ttb.name = stdButtons[i].name; ttb.pszService = stdButtons[i].pszService; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_INTERNAL; @@ -104,6 +103,9 @@ int InitInternalButtons(WPARAM, LPARAM) } else ttb.hIconDn = NULL; + if (i == 0) + ttb.wParamUp = 1; + stdButtons[i].hButton = (HANDLE)TTBAddButton((WPARAM)&ttb, 0); } -- cgit v1.2.3