diff options
author | George Hazan <george.hazan@gmail.com> | 2015-07-25 18:33:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-07-25 18:33:49 +0000 |
commit | 60eb7158c64c215db62ba3df6f248778792cbe5a (patch) | |
tree | b5a7a6140ecb4ac31db19acb3d54d358ffc59d6c /plugins/Clist_blind | |
parent | 886f1ff4d9ba1d3ac3fdc382399d8e6fd083a232 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14697 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_blind')
-rw-r--r-- | plugins/Clist_blind/src/clcopts.cpp | 43 | ||||
-rw-r--r-- | plugins/Clist_blind/src/clcpaint.cpp | 176 | ||||
-rw-r--r-- | plugins/Clist_blind/src/clistmenus.cpp | 7 | ||||
-rw-r--r-- | plugins/Clist_blind/src/clistopts.cpp | 91 | ||||
-rw-r--r-- | plugins/Clist_blind/src/cluiopts.cpp | 78 | ||||
-rw-r--r-- | plugins/Clist_blind/src/init.cpp | 151 |
6 files changed, 251 insertions, 295 deletions
diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index f54710afd9..0f38215701 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def);
-
#define DBFONTF_BOLD 1
#define DBFONTF_ITALIC 2
#define DBFONTF_UNDERLINE 4
@@ -89,12 +88,10 @@ static const struct CheckBoxValues_t offlineValues[] = { static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style)
{
TVINSERTSTRUCT tvis;
- int i;
-
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
- for (i = 0; i < nValues; i++) {
+ for (int i = 0; i < nValues; i++) {
tvis.item.lParam = values[i].style;
tvis.item.pszText = TranslateTS( values[i].szDescr );
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -135,13 +132,13 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", pcli->pfnGetDefaultExStyle());
for (i = 0; i < _countof(checkBoxToStyleEx); i++)
CheckDlgButton(hwndDlg, checkBoxToStyleEx[i].id,
- (exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag *
- checkBoxToStyleEx[i].not) ? BST_CHECKED : BST_UNCHECKED);
+ (exStyle & checkBoxToStyleEx[i].flag) ^ (checkBoxToStyleEx[i].flag *
+ checkBoxToStyleEx[i].not) ? BST_CHECKED : BST_UNCHECKED);
}
{
UDACCEL accel[2] = { {0, 10} , {2, 50} };
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
- SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM) & accel);
+ SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)& accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0,
MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
}
@@ -180,36 +177,36 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (LOWORD(wParam) == IDC_GREYOUT)
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
if ((LOWORD(wParam) == IDC_LEFTMARGIN || LOWORD(wParam) == IDC_SMOOTHTIME || LOWORD(wParam) == IDC_GROUPINDENT)
- && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()))
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return 0;
if ((LOWORD(wParam) == IDC_T_CONTACT || LOWORD(wParam) == IDC_T_GROUP || LOWORD(wParam) == IDC_T_DIVIDER || LOWORD(wParam) == IDC_T_INFO)
- && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()))
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return 0;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_GREYOUTOPTS:
case IDC_HIDEOFFLINEOPTS:
- if (((LPNMHDR) lParam)->code == NM_CLICK) {
+ if (((LPNMHDR)lParam)->code == NM_CLICK) {
TVHITTESTINFO hti;
- hti.pt.x = (short) LOWORD(GetMessagePos());
- hti.pt.y = (short) HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR) lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR) lParam)->hwndFrom, &hti))
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
if (hti.flags & TVHT_ONITEMSTATEICON) {
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
- TreeView_SetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
break;
case 0:
- if (((LPNMHDR) lParam)->code == PSN_APPLY ) {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int i;
DWORD exStyle = 0;
for (i = 0; i < _countof(checkBoxToStyleEx); i++)
@@ -225,15 +222,15 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam else
db_set_dw(NULL, "CLC", "GreyoutFlags", 0);
}
- db_set_b(NULL, "CLC", "ShowIdle", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
+ db_set_b(NULL, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
db_set_dw(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
db_set_b(NULL, "CLC", "LeftMargin",
- (BYTE) SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
+ (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
db_set_w(NULL, "CLC", "ScrollTime",
- (WORD) SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
+ (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 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));
+ (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, _countof(tmp));
db_set_ts(NULL, "CLC", "TemplateContact", tmp);
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index d6eb06480b..c140955921 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -21,6 +21,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "stdafx.h"
extern HIMAGELIST himlCListClc;
@@ -51,7 +52,7 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat) oldLum += 20;
newCol =
RGB(GetRValue(dat->hotTextColour) * oldLum / newLum, GetGValue(dat->hotTextColour) * oldLum / newLum,
- GetBValue(dat->hotTextColour) * oldLum / newLum);
+ GetBValue(dat->hotTextColour) * oldLum / newLum);
}
else if (newLum <= oldLum) {
int r, g, b;
@@ -92,15 +93,15 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat) static int GetStatusOnlineness(int status)
{
switch (status) {
- case ID_STATUS_FREECHAT: return 110;
- case ID_STATUS_ONLINE: return 100;
- case ID_STATUS_OCCUPIED: return 60;
- case ID_STATUS_ONTHEPHONE: return 50;
- case ID_STATUS_DND: return 40;
- case ID_STATUS_AWAY: return 30;
- case ID_STATUS_OUTTOLUNCH: return 20;
- case ID_STATUS_NA: return 10;
- case ID_STATUS_INVISIBLE: return 5;
+ case ID_STATUS_FREECHAT: return 110;
+ case ID_STATUS_ONLINE: return 100;
+ case ID_STATUS_OCCUPIED: return 60;
+ case ID_STATUS_ONTHEPHONE: return 50;
+ case ID_STATUS_DND: return 40;
+ case ID_STATUS_AWAY: return 30;
+ case ID_STATUS_OUTTOLUNCH: return 20;
+ case ID_STATUS_NA: return 10;
+ case ID_STATUS_INVISIBLE: return 5;
}
return 0;
}
@@ -141,7 +142,7 @@ static int GetRealStatus(struct ClcContact *contact, int status) void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
{
RECT clRect;
- int y, indent, index, fontHeight;
+ int indent, index, fontHeight;
struct ClcGroup *group;
HFONT hOldFont;
LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE);
@@ -160,7 +161,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rcPaint = &clRect;
if (IsRectEmpty(rcPaint))
return;
- y = -dat->yScroll;
+
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
@@ -184,9 +185,6 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) FillRect(hdcMem, rcPaint, hBrush);
DeleteObject(hBrush);
if (dat->hBmpBackground) {
- int x, y;
- int destw, desth;
-
// XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98.
SetStretchBltMode(hdcMem, HALFTONE);
@@ -194,9 +192,10 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) GetObject(dat->hBmpBackground, sizeof(bmp), &bmp);
HDC hdcBmp = CreateCompatibleDC(hdcMem);
SelectObject(hdcBmp, dat->hBmpBackground);
- y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0;
+ int y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0;
int maxx = dat->backgroundBmpUse & CLBF_TILEH ? clRect.right : 1;
int maxy = dat->backgroundBmpUse & CLBF_TILEV ? rcPaint->bottom : y + 1;
+ int destw, desth;
switch (dat->backgroundBmpUse & CLBM_TYPE) {
case CLB_STRETCH:
if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) {
@@ -242,12 +241,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) for (; y < maxy; y += desth) {
if (y < rcPaint->top - desth)
continue;
- for (x = 0; x < maxx; x += destw)
+ for (int x = 0; x < maxx; x += destw)
StretchBlt(hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
}
DeleteDC(hdcBmp);
}
}
+
+ int y = -dat->yScroll;
group = &dat->list;
group->scanIndex = 0;
indent = 0;
@@ -260,16 +261,17 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) group->scanIndex++;
continue;
}
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
if (y > rcPaint->top - dat->rowHeight) {
int iImage = -1;
- int selected = index == dat->selection && (dat->showSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd)
- && group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER;
- int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER && dat->iHotTrack == index;
+ int selected = index == dat->selection && (dat->showSelAlways || dat->exStyle & CLS_EX_SHOWSELALWAYS || GetFocus() == hwnd) && cc->type != CLCIT_DIVIDER;
+ int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && cc->type != CLCIT_DIVIDER && dat->iHotTrack == index;
SIZE textSize, countsSize = { 0 }, spaceSize = { 0 };
int width, checkboxWidth;
TCHAR *szCounts = NULL;
- //alternating grey
+ // alternating grey
if (style & CLS_GREYALTERNATE && index & 1) {
RECT rc;
rc.top = y;
@@ -279,38 +281,33 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) FillRect(hdcMem, &rc, hBrushAlternateGrey);
}
- //setup
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP)
+ // setup
+ if (cc->type == CLCIT_GROUP)
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
- else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) {
- if (group->cl.items[group->scanIndex]->flags & CLCIIF_GROUPFONT)
+ else if (cc->type == CLCIT_INFO) {
+ if (cc->flags & CLCIIF_GROUPFONT)
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_DIVIDER)
+ else if (cc->type == CLCIT_DIVIDER)
ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight);
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST)
+ else if (cc->type == CLCIT_CONTACT && cc->flags & CONTACTF_NOTONLIST)
ChangeToFont(hdcMem, dat, FONTID_NOTONLIST, &fontHeight);
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT &&
- ((group->cl.items[group->scanIndex]->flags & CONTACTF_INVISTO
- && GetRealStatus(group->cl.items[group->scanIndex], status) != ID_STATUS_INVISIBLE)
- || (group->cl.items[group->scanIndex]->flags & CONTACTF_VISTO
- && GetRealStatus(group->cl.items[group->scanIndex], status) == ID_STATUS_INVISIBLE)
- )
- ) {
- // the contact is in the always visible list and the proto is invisible
- // the contact is in the always invisible and the proto is in any other mode
- ChangeToFont(hdcMem, dat, group->cl.items[group->scanIndex]->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight);
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && !(group->cl.items[group->scanIndex]->flags & CONTACTF_ONLINE))
+ else if (cc->type == CLCIT_CONTACT &&
+ ((cc->flags & CONTACTF_INVISTO && GetRealStatus(cc, status) != ID_STATUS_INVISIBLE) || (cc->flags & CONTACTF_VISTO && GetRealStatus(cc, status) == ID_STATUS_INVISIBLE))) {
+ // the contact is in the always visible list and the proto is invisible
+ // the contact is in the always invisible and the proto is in any other mode
+ ChangeToFont(hdcMem, dat, cc->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight);
+ }
+ else if (cc->type == CLCIT_CONTACT && !(cc->flags & CONTACTF_ONLINE))
ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_tstrlen(cc->szText), &textSize);
width = textSize.cx;
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- szCounts = pcli->pfnGetGroupCountsText(dat, group->cl.items[group->scanIndex]);
+ if (cc->type == CLCIT_GROUP) {
+ szCounts = pcli->pfnGetGroupCountsText(dat, cc);
if (szCounts[0]) {
GetTextExtentPoint32(hdcMem, _T(" "), 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
@@ -319,14 +316,12 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) }
}
- if ((style & CLS_CHECKBOXES && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) ||
- (style & CLS_GROUPCHECKBOXES && group->cl.items[group->scanIndex]->type == CLCIT_GROUP) ||
- (group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->flags & CLCIIF_CHECKBOX))
+ if ((style & CLS_CHECKBOXES && cc->type == CLCIT_CONTACT) || (style & CLS_GROUPCHECKBOXES && cc->type == CLCIT_GROUP) || (cc->type == CLCIT_INFO && cc->flags & CLCIIF_CHECKBOX))
checkboxWidth = dat->checkboxSize + 2;
else
checkboxWidth = 0;
- //background
+ // background
if (selected) {
int x = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace - 2;
ImageList_DrawEx(dat->himlHighlight, 0, hdcMem, x, y, min(width + 5, clRect.right - x), dat->rowHeight, CLR_NONE, CLR_NONE,
@@ -336,7 +331,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) else if (hottrack)
SetHotTrackColour(hdcMem, dat);
- //checkboxes
+ // checkboxes
if (checkboxWidth) {
RECT rc;
HANDLE hTheme = OpenThemeData(hwnd, L"BUTTON");
@@ -344,56 +339,49 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.right = rc.left + dat->checkboxSize;
rc.top = y + ((dat->rowHeight - dat->checkboxSize) >> 1);
rc.bottom = rc.top + dat->checkboxSize;
- DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED ? (hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc, &rc);
+ DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, cc->flags & CONTACTF_CHECKED ? (hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc, &rc);
CloseThemeData(hTheme);
}
- //icon
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP)
- iImage = group->cl.items[group->scanIndex]->group->expanded ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT;
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT)
- iImage = group->cl.items[group->scanIndex]->iImage;
+ // icon
+ if (cc->type == CLCIT_GROUP)
+ iImage = cc->group->expanded ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT;
+ else if (cc->type == CLCIT_CONTACT)
+ iImage = cc->iImage;
if (iImage != -1) {
- /*COLORREF colourFg=dat->selBkColour;
- int mode=ILD_NORMAL;
- if(selected) mode=ILD_SELECTED;
- else if(hottrack) {mode=ILD_FOCUS; colourFg=dat->hotTextColour;}
- else if(group->cl.items[group->scanIndex]->type==CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags&CONTACTF_NOTONLIST) {colourFg=dat->fontInfo[FONTID_NOTONLIST].colour; mode=ILD_BLEND50;}
- ImageList_DrawEx(himlCListClc,iImage,hdcMem,dat->leftMargin+indent*dat->groupIndent+checkboxWidth,y+((dat->rowHeight-16)>>1),0,0,CLR_NONE,colourFg,mode);
- */
// this doesnt use CLS_CONTACTLIST since the colour prolly wont match anyway
COLORREF colourFg = dat->selBkColour;
int mode = ILD_NORMAL;
if (hottrack) {
colourFg = dat->hotTextColour;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST) {
+ else if (cc->type == CLCIT_CONTACT && cc->flags & CONTACTF_NOTONLIST) {
colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
- if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && dat->showIdle
- && (group->cl.items[group->scanIndex]->flags & CONTACTF_IDLE)
- && GetRealStatus(group->cl.items[group->scanIndex], ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ if (cc->type == CLCIT_CONTACT && dat->showIdle
+ && (cc->flags & CONTACTF_IDLE)
+ && GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
mode = ILD_SELECTED;
ImageList_DrawEx(himlCListClc, iImage, hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth,
y + ((dat->rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
}
- //text
- if (group->cl.items[group->scanIndex]->type == CLCIT_DIVIDER) {
+ // text
+ if (cc->type == CLCIT_DIVIDER) {
RECT rc;
rc.top = y + (dat->rowHeight >> 1);
rc.bottom = rc.top + 2;
rc.left = dat->leftMargin + indent * dat->groupIndent;
rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText));
+ TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText,
+ (int)mir_tstrlen(cc->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect.right;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
+ else if (cc->type == CLCIT_GROUP) {
RECT rc;
if (szCounts[0]) {
fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight;
@@ -411,13 +399,13 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) else if (hottrack)
SetHotTrackColour(hdcMem, dat);
rc.right--;
- ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, group->cl.items[group->scanIndex]->szText,
- (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText), NULL);
+ ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText,
+ (int)mir_tstrlen(cc->szText), NULL);
}
else
TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
- y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText));
+ y + ((dat->rowHeight - fontHeight) >> 1), cc->szText,
+ (int)mir_tstrlen(cc->szText));
if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
rc.top = y + (dat->rowHeight >> 1);
rc.bottom = rc.top + 2;
@@ -428,7 +416,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) }
}
else {
- TCHAR *szText = group->cl.items[group->scanIndex]->szText;
+ TCHAR *szText = cc->szText;
RECT rc;
rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
@@ -437,8 +425,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) DrawText(hdcMem, szText, -1, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
if (selected) {
- if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
- TCHAR *szText = group->cl.items[group->scanIndex]->szText;
+ if (cc->type != CLCIT_DIVIDER) {
+ TCHAR *szText = cc->szText;
RECT rc;
int qlen = (int)mir_tstrlen(dat->szQuickSearch);
SetTextColor(hdcMem, dat->quickSearchColour);
@@ -451,11 +439,11 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) }
}
- //extra icons
+ // extra icons
for (iImage = 0; iImage < dat->extraColumnsCount; iImage++) {
COLORREF colourFg = dat->selBkColour;
int mode = ILD_NORMAL;
- if (group->cl.items[group->scanIndex]->iExtraImage[iImage] == 0xFF)
+ if (cc->iExtraImage[iImage] == 0xFF)
continue;
if (selected)
mode = ILD_SELECTED;
@@ -463,30 +451,29 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) mode = ILD_FOCUS;
colourFg = dat->hotTextColour;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->flags & CONTACTF_NOTONLIST) {
+ else if (cc->type == CLCIT_CONTACT && cc->flags & CONTACTF_NOTONLIST) {
colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
- ImageList_DrawEx(dat->himlExtraColumns, group->cl.items[group->scanIndex]->iExtraImage[iImage], hdcMem,
+ ImageList_DrawEx(dat->himlExtraColumns, cc->iExtraImage[iImage], hdcMem,
clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - iImage), y + ((dat->rowHeight - 16) >> 1), 0, 0,
CLR_NONE, colourFg, mode);
}
}
index++;
y += dat->rowHeight;
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) {
- group = group->cl.items[group->scanIndex]->group;
+ if (cc->type == CLCIT_GROUP && cc->group->expanded) {
+ group = cc->group;
indent++;
group->scanIndex = 0;
continue;
}
group->scanIndex++;
}
- if (dat->iInsertionMark != -1) { //insertion mark
- HBRUSH hBrush;
+
+ // insertion mark
+ if (dat->iInsertionMark != -1) {
POINT pts[8];
- HRGN hRgn;
-
pts[0].x = dat->leftMargin;
pts[0].y = dat->iInsertionMark * dat->rowHeight - dat->yScroll - 4;
pts[1].x = pts[0].x + 2;
@@ -503,17 +490,16 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) pts[6].y = pts[5].y;
pts[7].x = pts[0].x;
pts[7].y = pts[4].y;
- hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
- hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour);
+ HRGN hRgn = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
+ HBRUSH hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour);
FillRgn(hdcMem, hRgn, hBrush);
DeleteObject(hBrush);
DeleteObject(hRgn);
}
if (!grey)
- BitBlt(hdc, rcPaint->left, rcPaint->top, rcPaint->right - rcPaint->left, rcPaint->bottom - rcPaint->top, hdcMem, rcPaint->left, rcPaint->top,
- SRCCOPY);
- SelectObject(hdcMem,hOldBitmap);
- SelectObject(hdcMem,hOldFont);
+ BitBlt(hdc, rcPaint->left, rcPaint->top, rcPaint->right - rcPaint->left, rcPaint->bottom - rcPaint->top, hdcMem, rcPaint->left, rcPaint->top, SRCCOPY);
+ SelectObject(hdcMem, hOldBitmap);
+ SelectObject(hdcMem, hOldFont);
DeleteDC(hdcMem);
if (hBrushAlternateGrey)
DeleteObject(hBrushAlternateGrey);
@@ -525,8 +511,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) bmih.biHeight = -clRect.bottom;
bmih.biPlanes = 1;
bmih.biWidth = clRect.right;
- PBYTE bits = (PBYTE) malloc(4 * bmih.biWidth * -bmih.biHeight);
- GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *) & bmih, DIB_RGB_COLORS);
+ PBYTE bits = (PBYTE)malloc(4 * bmih.biWidth * -bmih.biHeight);
+ GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *)& bmih, DIB_RGB_COLORS);
COLORREF greyColour = GetSysColor(COLOR_3DFACE);
int greyRed = GetRValue(greyColour) * 2;
int greyGreen = GetGValue(greyColour) * 2;
@@ -540,7 +526,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) bits[i + 1] = divide3[bits[i + 1] + greyGreen];
bits[i + 2] = divide3[bits[i + 2] + greyRed];
}
- SetDIBitsToDevice(hdc, 0, 0, clRect.right, clRect.bottom, 0, 0, 0, clRect.bottom, bits, (BITMAPINFO *) & bmih, DIB_RGB_COLORS);
+ SetDIBitsToDevice(hdc, 0, 0, clRect.right, clRect.bottom, 0, 0, 0, clRect.bottom, bits, (BITMAPINFO *)& bmih, DIB_RGB_COLORS);
free(bits);
}
DeleteObject(hBmpOsb);
diff --git a/plugins/Clist_blind/src/clistmenus.cpp b/plugins/Clist_blind/src/clistmenus.cpp index aed1426207..5605e0df17 100644 --- a/plugins/Clist_blind/src/clistmenus.cpp +++ b/plugins/Clist_blind/src/clistmenus.cpp @@ -21,11 +21,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "stdafx.h"
-INT_PTR CloseAction(WPARAM,LPARAM)
+INT_PTR CloseAction(WPARAM, LPARAM)
{
- if (CallService(MS_SYSTEM_OKTOEXIT,0,0))
+ if (CallService(MS_SYSTEM_OKTOEXIT, 0, 0))
DestroyWindow(pcli->hwndContactList);
return 0;
@@ -33,5 +34,5 @@ INT_PTR CloseAction(WPARAM,LPARAM) void InitCustomMenus()
{
- CreateServiceFunction( "CloseAction", CloseAction );
+ CreateServiceFunction("CloseAction", CloseAction);
}
diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index 1c5005b26f..0df49d3135 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -28,22 +28,21 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) {
case WM_USER + 1:
{
- MCONTACT hContact = (MCONTACT) wParam;
- DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam;
- if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL
- && mir_strcmpi(ws->szModule, "CList") == 0 && mir_strcmpi(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) {
- CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED);
- }
- break;
+ MCONTACT hContact = (MCONTACT)wParam;
+ DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam;
+ if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL &&
+ mir_strcmpi(ws->szModule, "CList") == 0 && mir_strcmpi(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg))
+ CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED);
}
+ break;
+
case WM_DESTROY:
- {
- UnhookEvent((HANDLE) GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
- break;
- }
+ UnhookEvent((HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
+ break;
+
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
@@ -81,13 +80,11 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP !db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DONTCYCLE,
db_get_b(NULL, "CList", "TrayIcon",
- SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
+ SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CYCLE,
- db_get_b(NULL, "CList", "TrayIcon",
- SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MULTITRAY,
- db_get_b(NULL, "CList", "TrayIcon",
- SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEBLINK,
db_get_b(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
@@ -114,7 +111,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global"));
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0);
-
+
int count;
PROTOACCOUNT **accs;
Proto_EnumAccounts(&count, &accs);
@@ -128,12 +125,13 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0);
}
}
- if (-1 == (int) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0))
+ if (CB_ERR == (int)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0))
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_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(db_get_w(NULL, "CList", "IconFlashTime", 550), 0));
return TRUE;
+
case WM_COMMAND:
if (LOWORD(wParam) == IDC_AUTOHIDE) {
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
@@ -154,59 +152,60 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE)
break;
- if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()))
+ if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return 0;
- if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return 0; // dont make apply enabled during buddy set crap
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(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)
db_set_b(NULL, "CList", "HideEmptyGroups",
- (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
+ (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
if (caps & CLUIF_DISABLEGROUPS)
- db_set_b(NULL, "CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
+ db_set_b(NULL, "CList", "UseGroups", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
if (!(caps & CLUIF_HASONTOPOPTION)) {
- db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
- SetWindowPos( pcli->hwndContactList,
+ 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)) {
- db_set_b(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
+ db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
db_set_w(NULL, "CList", "HideTime",
- (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
+ (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
}
}
- 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", "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", "SortByStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS));
+ db_set_b(NULL, "CList", "SortByProto", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO));
+ 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)));
+ (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE
+ : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE :
+ SETTING_TRAYICON_MULTI)));
db_set_w(NULL, "CList", "CycleTime",
- (WORD) SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
+ (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
db_set_w(NULL, "CList", "IconFlashTime",
- (WORD) SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
+ (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
{
int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
- PROTOACCOUNT* pa = ( PROTOACCOUNT* )SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0 );
- if ( pa == NULL )
+ PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0);
+ if (pa == NULL)
db_unset(NULL, "CList", "PrimaryStatus");
else
- db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName );
+ db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName);
}
pcli->pfnTrayIconIconsChanged();
diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 043b197b84..2bda2c83ac 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -21,6 +21,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "stdafx.h"
static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -55,11 +56,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MaxSizeHeight", 75));
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);
+ 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(db_get_w(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));
@@ -71,10 +70,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSIZEUPWARD), FALSE);
}
- { DBVARIANT dbv;
- if ( !db_get_ts(NULL, "CList", "TitleText", &dbv)) {
+ {
+ DBVARIANT dbv;
+ if (!db_get_ts(NULL, "CList", "TitleText", &dbv)) {
SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal);
- db_free( &dbv );
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
}
@@ -128,7 +128,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT) &&
- (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()))
+ (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return 0;
// Enable apply button
@@ -147,25 +147,25 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->code == PSN_APPLY) {
- db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
- db_set_b(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
- db_set_b(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
- 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));
- db_set_w(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
- 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));
- 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));
- db_set_b(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ db_set_b(NULL, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
+ db_set_b(NULL, "CList", "ToolWindow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
+ db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
+ 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));
+ db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
+ 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));
+ 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));
+ db_set_b(NULL, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
{
TCHAR title[256];
GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
@@ -197,10 +197,10 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION))
SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE,
- GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX);
+ 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));
+ GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX));
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU))
SetMenu(pcli->hwndContactList, NULL);
else
@@ -265,20 +265,20 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->code == PSN_APPLY ) {
- db_set_b(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ 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));
+ (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));
pcli->pfnLoadCluiGlobalOpts();
- if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
+ if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
HWND parent = GetParent(pcli->hwndStatus);
int flags = WS_CHILD | CCS_BOTTOM;
- db_set_b(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
+ db_set_b(NULL, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
ShowWindow(pcli->hwndStatus, SW_HIDE);
DestroyWindow(pcli->hwndStatus);
flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 6bc9539e89..e75ea0b1d3 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -34,7 +34,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L void RebuildEntireList(HWND hwnd, ClcData *dat);
void RebuildEntireListInternal(HWND hwnd, ClcData *dat, BOOL call_orig);
void SetGroupExpand(HWND hwnd, ClcData *dat, struct ClcGroup *group, int newState);
-void ScrollTo( HWND hwnd, ClcData *dat, int desty, int noSmooth );
+void ScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth);
void RecalcScrollBar(HWND hwnd, ClcData *dat);
void LoadClcOptions(HWND hwnd, ClcData *dat, BOOL);
int GetRowHeight(ClcData *dat, int item);
@@ -43,7 +43,7 @@ void SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort); /////////////////////////////////////////////////////////////////////////////////////////
// external functions
-void InitCustomMenus( void );
+void InitCustomMenus(void);
void PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT * rcPaint);
int ClcOptInit(WPARAM wParam, LPARAM lParam);
@@ -85,7 +85,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) /////////////////////////////////////////////////////////////////////////////////////////
// returns plugin's interfaces information
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_CLIST, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_CLIST, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
// called when number of accounts has been changed
@@ -221,28 +221,23 @@ int CopyData(StringHelper *str, const TCHAR *text, size_t len) totalSize = str->used + len + 1;
- if (totalSize > str->allocated)
- {
+ if (totalSize > str->allocated) {
totalSize += DATA_BLOCK - (totalSize % DATA_BLOCK);
- if (str->text != NULL)
- {
- TCHAR *tmp = (TCHAR *) mir_realloc(str->text, sizeof(TCHAR) * totalSize);
+ if (str->text != NULL) {
+ TCHAR *tmp = (TCHAR *)mir_realloc(str->text, sizeof(TCHAR) * totalSize);
- if (tmp == NULL)
- {
+ if (tmp == NULL) {
mir_free(str->text);
return -1;
}
str->text = tmp;
}
- else
- {
- str->text = (TCHAR *) mir_alloc(sizeof(TCHAR) * totalSize);
+ else {
+ str->text = (TCHAR *)mir_alloc(sizeof(TCHAR) * totalSize);
- if (str->text == NULL)
- {
+ if (str->text == NULL) {
return -2;
}
}
@@ -264,21 +259,18 @@ TCHAR * ParseText(const TCHAR *text, {
size_t length = mir_tstrlen(text);
size_t nextPos = 0;
- StringHelper ret = {0};
+ StringHelper ret = { 0 };
size_t i;
// length - 1 because a % in last char will be a % and point
- for (i = 0 ; i < length - 1 ; i++)
- {
- if (text[i] == _T('%'))
- {
+ for (i = 0; i < length - 1; i++) {
+ if (text[i] == _T('%')) {
BOOL found = FALSE;
if (CopyData(&ret, &text[nextPos], i - nextPos))
return NULL;
- if (text[i + 1] == _T('%'))
- {
+ if (text[i + 1] == _T('%')) {
if (CopyData(&ret, _T("%"), 1))
return NULL;
@@ -286,18 +278,15 @@ TCHAR * ParseText(const TCHAR *text, found = TRUE;
}
- else
- {
+ else {
size_t size = min(variablesSize, dataSize);
size_t j;
// See if can find it
- for(j = 0 ; j < size ; j++)
- {
+ for (j = 0; j < size; j++) {
size_t vlen = mir_tstrlen(variables[j]);
- if (_tcsnicmp(&text[i], variables[j], vlen) == 0)
- {
+ if (_tcsnicmp(&text[i], variables[j], vlen) == 0) {
if (CopyData(&ret, data[j], mir_tstrlen(data[j])))
return NULL;
@@ -328,13 +317,10 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l {
switch (msg) {
case WM_NCCREATE:
- {
- break;
- }
+ break;
+
case WM_CREATE:
- {
- break;
- }
+ break;
}
return coreCli.pfnContactListWndProc(hwnd, msg, wParam, lParam);
}
@@ -346,12 +332,12 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L switch (msg) {
case WM_CREATE:
- dat = (ClcData*)mir_calloc( sizeof(ClcData));
- SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat);
+ dat = (ClcData*)mir_calloc(sizeof(ClcData));
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);
dat->hwnd_list = CreateWindow(_T("LISTBOX"), _T(""),
(WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_VSCROLL),
- 0, 0, 0, 0, hwnd, NULL, g_hInst,0);
+ 0, 0, 0, 0, hwnd, NULL, g_hInst, 0);
dat->need_rebuild = FALSE;
GetClientRect(hwnd, &r);
@@ -390,13 +376,13 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L nmkey.hdr.code = NM_KEYDOWN;
nmkey.nVKey = key;
nmkey.uFlags = 0;
- if ( SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nmkey))
+ if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nmkey))
return -2;
}
return -1;
case WM_COMMAND:
- if ((HANDLE) lParam != dat->hwnd_list || HIWORD(wParam) != LBN_SELCHANGE)
+ if ((HANDLE)lParam != dat->hwnd_list || HIWORD(wParam) != LBN_SELCHANGE)
break;
dat->selection = SendMessage(dat->hwnd_list, LB_GETCURSEL, 0, 0);
@@ -419,7 +405,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L }
TCHAR status_name[128];
-TCHAR *GetStatusName(struct ClcContact *item)
+TCHAR* GetStatusName(struct ClcContact *item)
{
int status;
@@ -441,7 +427,7 @@ TCHAR *GetStatusName(struct ClcContact *item) TCHAR status_message[256];
-TCHAR *GetStatusMessage(struct ClcContact *item)
+TCHAR* GetStatusMessage(struct ClcContact *item)
{
status_message[0] = _T('\0');
if (item->hContact == NULL || item->proto == NULL)
@@ -460,30 +446,26 @@ TCHAR *GetStatusMessage(struct ClcContact *item) TCHAR proto_name[128];
-TCHAR *GetProtoName(struct ClcContact *item)
+TCHAR* GetProtoName(struct ClcContact *item)
{
- PROTOACCOUNT *acc;
-#ifdef UNICODE
+ #ifdef UNICODE
char description[128];
-#endif
+ #endif
proto_name[0] = '\0';
- if (item->hContact == NULL || item->proto == NULL)
- {
+ if (item->hContact == NULL || item->proto == NULL) {
mir_tstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
return proto_name;
}
- acc = Proto_GetAccount(item->proto);
-
- if (acc == NULL)
- {
-#ifdef UNICODE
- CallProtoService(item->proto, PS_GETNAME, sizeof(description),(LPARAM) description);
+ PROTOACCOUNT *acc = Proto_GetAccount(item->proto);
+ if (acc == NULL) {
+ #ifdef UNICODE
+ CallProtoService(item->proto, PS_GETNAME, sizeof(description), (LPARAM)description);
mir_sntprintf(proto_name, _countof(proto_name), L"%S", description);
-#else
- CallProtoService(item->proto, PS_GETNAME, sizeof(proto_name),(LPARAM) proto_name);
-#endif
+ #else
+ CallProtoService(item->proto, PS_GETNAME, sizeof(proto_name), (LPARAM)proto_name);
+ #endif
return proto_name;
}
@@ -495,16 +477,12 @@ TCHAR *GetProtoName(struct ClcContact *item) void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
{
ClcData *dat = (ClcData*)tmp_dat;
- struct ClcGroup *group;
- struct ClcContact *item;
TCHAR tmp[1024];
TCHAR count[128];
TCHAR template_contact[1024];
TCHAR template_group[1024];
TCHAR template_divider[1024];
TCHAR template_info[1024];
- TCHAR *text;
- size_t size;
int selection = dat->selection;
BOOL has_focus = (GetFocus() == dat->hwnd_list || GetFocus() == hwnd);
@@ -522,17 +500,16 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) SendMessage(dat->hwnd_list, LB_RESETCONTENT, 0, 0);
// Set font
- SendMessage(dat->hwnd_list, WM_SETFONT, (WPARAM) dat->fontInfo[FONTID_CONTACTS].hFont, 0);
+ SendMessage(dat->hwnd_list, WM_SETFONT, (WPARAM)dat->fontInfo[FONTID_CONTACTS].hFont, 0);
// Add all items to the list
- group = &dat->list;
+ ClcGroup *group = &dat->list;
group->scanIndex = 0;
- text = tmp;
- size = _countof(tmp);
- while(1)
- {
- if (group->scanIndex == group->cl.count)
- {
+
+ TCHAR *text = tmp;
+ size_t size = _countof(tmp);
+ while (true) {
+ if (group->scanIndex == group->cl.count) {
group = group->parent;
if (group == NULL)
break;
@@ -542,13 +519,12 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) continue;
}
- item = group->cl.items[group->scanIndex];
+ ClcContact *item = group->cl.items[group->scanIndex];
text[0] = _T('\0');
- switch(item->type)
- {
+ switch (item->type) {
case CLCIT_GROUP:
{
- TCHAR *szCounts = pcli->pfnGetGroupCountsText((ClcData*)dat, item);
+ TCHAR *szCounts = pcli->pfnGetGroupCountsText(dat, item);
const TCHAR *t[] = {
_T("%name%"),
_T("%count%"),
@@ -559,19 +535,19 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) count,
item->group->expanded ? TranslateT("Expanded") : TranslateT("Collapsed")
};
- TCHAR *txt;
if (szCounts[0] != '\0')
mir_sntprintf(count, _countof(count), _T("%s "), szCounts);
else
count[0] = _T('\0');
- txt = ParseText(template_group, t, _countof(t), v, _countof(v));
+ TCHAR *txt = ParseText(template_group, t, _countof(t), v, _countof(v));
if (txt != NULL)
- mir_tstrncpy(text, txt, (int)size);
+ mir_tstrncpy(text, txt, size);
mir_free(txt);
- break;
}
+ break;
+
case CLCIT_CONTACT:
{
const TCHAR *t[] = {
@@ -589,26 +565,23 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) TCHAR *txt = ParseText(template_contact, t, _countof(t), v, _countof(v));
if (txt != NULL)
- mir_tstrncpy(text, txt, (int)size);
+ mir_tstrncpy(text, txt, size);
mir_free(txt);
- break;
}
+ break;
+
case CLCIT_DIVIDER:
- {
- mir_sntprintf(text, size, template_divider, item->szText);
- break;
- }
+ mir_sntprintf(text, size, template_divider, item->szText);
+ break;
+
case CLCIT_INFO:
- {
- mir_sntprintf(text, size, template_info, item->szText);
- break;
- }
+ mir_sntprintf(text, size, template_info, item->szText);
+ break;
}
- SendMessage(dat->hwnd_list, LB_ADDSTRING, 0, (LPARAM) tmp);
+ SendMessage(dat->hwnd_list, LB_ADDSTRING, 0, (LPARAM)tmp);
- if (item->type == CLCIT_GROUP && item->group->expanded)
- {
+ if (item->type == CLCIT_GROUP && item->group->expanded) {
group = item->group;
text[0] = _T(' ');
text[1] = _T(' ');
|