summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/delphi/m_clistint.inc2
-rw-r--r--include/m_clistint.h2
-rw-r--r--src/modules/clist/clc.cpp4
-rw-r--r--src/modules/clist/clc.h2
-rw-r--r--src/modules/clist/clcutils.cpp14
-rw-r--r--src/modules/ignore/ignore.cpp2
-rw-r--r--src/modules/visibility/visibility.cpp116
7 files changed, 69 insertions, 73 deletions
diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc
index 74fb61e6c7..c3efe4d858 100644
--- a/include/delphi/m_clistint.inc
+++ b/include/delphi/m_clistint.inc
@@ -387,7 +387,7 @@ type
pfnGetDefaultExStyle : function :dword; cdecl;
pfnGetDefaultFontSetting : procedure (i:int; var lf:LOGFONT; var colour:COLORREF); cdecl;
pfnGetFontSetting : procedure (i:int; var lf:LOGFONT; var colour:COLORREF); cdecl;
- pfnLoadClcOptions : procedure (hwnd:HWND; var dat:TClcData); cdecl;
+ pfnLoadClcOptions : procedure (hwnd:HWND; var dat:TClcData; bFirst: int); cdecl;
pfnRecalculateGroupCheckboxes : procedure (hwnd:HWND; var dat:TClcData); cdecl;
pfnSetGroupChildCheckboxes : procedure (var group:TClcGroup; checked:int); cdecl;
pfnInvalidateItem : procedure (hwnd:HWND; var dat:TClcData; iItem:int); cdecl;
diff --git a/include/m_clistint.h b/include/m_clistint.h
index 8b61830160..25a124d42e 100644
--- a/include/m_clistint.h
+++ b/include/m_clistint.h
@@ -325,7 +325,7 @@ typedef struct
DWORD (*pfnGetDefaultExStyle)(void);
void (*pfnGetDefaultFontSetting)(int i, LOGFONT* lf, COLORREF* colour);
void (*pfnGetFontSetting)(int i, LOGFONT* lf, COLORREF* colour);
- void (*pfnLoadClcOptions)(HWND hwnd, struct ClcData *dat);
+ void (*pfnLoadClcOptions)(HWND hwnd, struct ClcData *dat, BOOL bFirst);
void (*pfnRecalculateGroupCheckboxes)(HWND hwnd, struct ClcData *dat);
void (*pfnSetGroupChildCheckboxes)(ClcGroup *group, int checked);
void (*pfnInvalidateItem)(HWND hwnd, struct ClcData *dat, int iItem);
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 9f41284f6b..b0dfa19bb9 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -297,7 +297,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
dat->extraColumnSpacing = 20;
dat->list.cl.increment = 30;
dat->needsResort = 1;
- cli.pfnLoadClcOptions(hwnd, dat);
+ cli.pfnLoadClcOptions(hwnd, dat, TRUE);
if (!IsWindowVisible(hwnd))
SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL);
else {
@@ -320,7 +320,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_RELOADOPTIONS:
- cli.pfnLoadClcOptions(hwnd, dat);
+ cli.pfnLoadClcOptions(hwnd, dat, FALSE);
cli.pfnSaveStateAndRebuildList(hwnd, dat);
break;
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h
index acb5279007..ba8bee42d2 100644
--- a/src/modules/clist/clc.h
+++ b/src/modules/clist/clc.h
@@ -92,7 +92,7 @@ DWORD fnGetDefaultExStyle(void);
void fnGetSetting(int i, LOGFONT* lf, COLORREF* colour);
void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour);
void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour);
-void fnLoadClcOptions(HWND hwnd, struct ClcData *dat);
+void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst);
void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat);
void fnSetGroupChildCheckboxes(ClcGroup *group, int checked);
void fnSetContactCheckboxes(ClcContact *cc, int checked);
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp
index 92ed6de693..f31aecedd0 100644
--- a/src/modules/clist/clcutils.cpp
+++ b/src/modules/clist/clcutils.cpp
@@ -715,7 +715,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour)
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
}
-void fnLoadClcOptions(HWND hwnd, struct ClcData *dat)
+void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst)
{
dat->rowHeight = db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
@@ -751,17 +751,15 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat)
dat->filterSearch = db_get_b(NULL, "CLC", "FilterSearch", 1);
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
if (!dat->bkChanged) {
- DBVARIANT dbv;
dat->bkColour = db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
if (dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
dat->hBmpBackground = NULL;
}
if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- if (!db_get_s(NULL, "CLC", "BkBitmap", &dbv)) {
- dat->hBmpBackground = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM) dbv.pszVal);
- mir_free(dbv.pszVal);
- }
+ ptrA szBitmap(db_get_sa(NULL, "CLC", "BkBitmap"));
+ if (szBitmap)
+ dat->hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, szBitmap);
}
dat->backgroundBmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
}
@@ -776,8 +774,8 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat)
NMHDR hdr;
hdr.code = CLN_OPTIONSCHANGED;
hdr.hwndFrom = hwnd;
- hdr.idFrom = GetDlgCtrlID(hwnd);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & hdr);
+ hdr.idFrom = (bFirst) ? 0 : GetDlgCtrlID(hwnd);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&hdr);
SendMessage(hwnd, WM_SIZE, 0, 0);
}
diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp
index 0c1c4a6766..23fca20224 100644
--- a/src/modules/ignore/ignore.cpp
+++ b/src/modules/ignore/ignore.cpp
@@ -255,7 +255,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM
SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
break;
case CLN_OPTIONSCHANGED:
- ResetListOptions( GetDlgItem(hwndDlg, IDC_LIST));
+ ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
break;
case CLN_CHECKCHANGED:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp
index 479c476835..678b905fdc 100644
--- a/src/modules/visibility/visibility.cpp
+++ b/src/modules/visibility/visibility.cpp
@@ -155,7 +155,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP
hInvisibleIcon = ImageList_GetIcon(hIml, 2, ILD_NORMAL);
SendDlgItemMessage(hwndDlg, IDC_INVISIBLEICON, STM_SETICON, (WPARAM)hInvisibleIcon, 0);
- ResetListOptions( GetDlgItem(hwndDlg, IDC_LIST));
+ ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRACOLUMNS, 2, 0);
{
CLCINFOITEM cii = { sizeof(cii) };
@@ -163,82 +163,80 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP
cii.pszText = TranslateT("** All contacts **");
hItemAll = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
}
- SetAllContactIcons( GetDlgItem(hwndDlg, IDC_LIST));
- SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
return TRUE;
case WM_SETFOCUS:
- SetFocus( GetDlgItem(hwndDlg, IDC_LIST));
+ SetFocus(GetDlgItem(hwndDlg, IDC_LIST));
break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_LIST:
switch (((LPNMHDR)lParam)->code) {
case CLN_NEWCONTACT:
case CLN_LISTREBUILT:
- SetAllContactIcons( GetDlgItem(hwndDlg, IDC_LIST));
+ SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
//fall through
case CLN_CONTACTMOVED:
- SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
break;
case CLN_OPTIONSCHANGED:
- ResetListOptions( GetDlgItem(hwndDlg, IDC_LIST));
+ ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
break;
case NM_CLICK:
- {
- // Make sure we have an extra column
- NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
- if (nm->iColumn == -1)
- break;
-
- // Find clicked item
- DWORD hitFlags;
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL)
- break;
-
- // It was not a visbility icon
- if (!(hitFlags & CLCHT_ONITEMEXTRA))
- break;
-
- // Get image in clicked column (0 = none, 1 = visible, 2 = invisible)
- int iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
- if (iImage == 0)
- iImage = nm->iColumn + 1;
- else if (iImage == 1 || iImage == 2)
- iImage = 0;
-
- // Get item type (contact, group, etc...)
- int itemType = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
-
- // Update list, making sure that the options are mutually exclusive
- if (itemType == CLCIT_CONTACT) { // A contact
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
- if (iImage && SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0)) != EMPTY_EXTRA_ICON)
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0));
- }
- else if (itemType == CLCIT_INFO) { // All Contacts
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
+ // Make sure we have an extra column
+ NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
+ if (nm->iColumn == -1)
+ break;
+
+ // Find clicked item
+ DWORD hitFlags;
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
+ if (hItem == NULL)
+ break;
+
+ // It was not a visbility icon
+ if (!(hitFlags & CLCHT_ONITEMEXTRA))
+ break;
+
+ // Get image in clicked column (0 = none, 1 = visible, 2 = invisible)
+ int iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
+ if (iImage == 0)
+ iImage = nm->iColumn + 1;
+ else if (iImage == 1 || iImage == 2)
+ iImage = 0;
+
+ // Get item type (contact, group, etc...)
+ int itemType = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
+
+ // Update list, making sure that the options are mutually exclusive
+ if (itemType == CLCIT_CONTACT) { // A contact
+ SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
+ if (iImage && SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn ? 0 : 1, 0)) != EMPTY_EXTRA_ICON)
+ SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn ? 0 : 1, 0));
+ }
+ else if (itemType == CLCIT_INFO) { // All Contacts
+ SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
+ if (iImage)
+ SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn ? 0 : 1, 0);
+ }
+ else if (itemType == CLCIT_GROUP) { // A group
+ hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ if (hItem) {
+ SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
if (iImage)
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn?0:1, 0);
+ SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn ? 0 : 1, 0);
}
- else if (itemType == CLCIT_GROUP) { // A group
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hItem) {
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
- if (iImage)
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn?0:1, 0);
- }
- }
- // Update the all/none icons
- SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
-
- // Activate Apply button
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
+ // Update the all/none icons
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+
+ // Activate Apply button
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -250,10 +248,10 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP
continue;
int set = 0;
- for (int i=0; i < 2; i++) {
+ for (int i = 0; i < 2; i++) {
int iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (iImage == i+1) {
- CallContactService(hContact, PSS_SETAPPARENTMODE, iImage == 1?ID_STATUS_ONLINE:ID_STATUS_OFFLINE, 0);
+ if (iImage == i + 1) {
+ CallContactService(hContact, PSS_SETAPPARENTMODE, iImage == 1 ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE, 0);
set = 1;
break;
}