summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdclist/res/resource.rc2
-rw-r--r--src/core/stdclist/src/clcopts.cpp23
-rw-r--r--src/core/stdclist/src/resource.h1
-rw-r--r--src/mir_app/res/resource.rc16
-rw-r--r--src/mir_app/src/clc.h1
-rw-r--r--src/mir_app/src/clcutils.cpp2
-rw-r--r--src/mir_app/src/clistopts.cpp57
-rw-r--r--src/mir_app/src/resource.h1
8 files changed, 71 insertions, 32 deletions
diff --git a/src/core/stdclist/res/resource.rc b/src/core/stdclist/res/resource.rc
index e2db018eeb..c040eff77e 100644
--- a/src/core/stdclist/res/resource.rc
+++ b/src/core/stdclist/res/resource.rc
@@ -130,8 +130,6 @@ BEGIN
CONTROL "Make selection highlight translucent",IDC_NOTNOTRANSLUCENTSEL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,83,179,10
CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,96,153,10
- LTEXT "'Hide offline' means to hide:",IDC_STATIC,191,10,112,8
- CONTROL "Tree1",IDC_HIDEOFFLINEOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,191,20,112,84
GROUPBOX "Groups",IDC_STATIC,2,112,148,136
CONTROL "Draw a line alongside group names",IDC_LINEWITHGROUPS,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,129,131,16
diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp
index d3a7d34a8f..7f0507eb15 100644
--- a/src/core/stdclist/src/clcopts.cpp
+++ b/src/core/stdclist/src/clcopts.cpp
@@ -55,9 +55,8 @@ struct CheckBoxValues_t
{
DWORD style;
wchar_t* szDescr;
-};
-
-static const struct CheckBoxValues_t greyoutValues[] =
+}
+static const greyoutValues[] =
{
{ GREYF_UNFOCUS, LPGENW("Not focused") },
{ MODEF_OFFLINE, LPGENW("Offline") },
@@ -70,18 +69,6 @@ static const struct CheckBoxValues_t greyoutValues[] =
{ PF2_INVISIBLE, LPGENW("Invisible") }
};
-static const struct CheckBoxValues_t offlineValues[] =
-{
- { MODEF_OFFLINE, LPGENW("Offline") },
- { PF2_ONLINE, LPGENW("Online") },
- { PF2_SHORTAWAY, LPGENW("Away") },
- { PF2_LONGAWAY, LPGENW("Not available") },
- { PF2_LIGHTDND, LPGENW("Occupied") },
- { PF2_HEAVYDND, LPGENW("Do not disturb")},
- { PF2_FREECHAT, LPGENW("Free for chat") },
- { PF2_INVISIBLE, LPGENW("Invisible") }
-};
-
static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style)
{
TVINSERTSTRUCT tvis;
@@ -142,8 +129,6 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE,
GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE,
- GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
{
DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", Clist_GetDefaultExStyle());
for (auto &it : checkBoxToStyleEx)
@@ -169,8 +154,6 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, _countof(greyoutValues),
db_get_dw(0, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, _countof(offlineValues),
- db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(0, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_GAMMACORRECT, db_get_b(0, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT) ? BST_CHECKED : BST_UNCHECKED);
{
@@ -214,7 +197,6 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case IDC_GREYOUTOPTS:
- case IDC_HIDEOFFLINEOPTS:
if (((LPNMHDR)lParam)->code == NM_CLICK) {
TVHITTESTINFO hti;
hti.pt.x = (short)LOWORD(GetMessagePos());
@@ -250,7 +232,6 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
db_set_dw(0, "CLC", "GreyoutFlags", 0);
}
db_set_b(0, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
- db_set_dw(0, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
db_set_b(0, "CLC", "LeftMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
db_set_w(0, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
db_set_b(0, "CLC", "GroupIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
diff --git a/src/core/stdclist/src/resource.h b/src/core/stdclist/src/resource.h
index d25ecb5890..b4c544a1d2 100644
--- a/src/core/stdclist/src/resource.h
+++ b/src/core/stdclist/src/resource.h
@@ -74,7 +74,6 @@
#define IDC_SCRIPT 1300
#define IDC_TILEV 1301
#define IDC_GAMMACORRECT 1302
-#define IDC_HIDEOFFLINEOPTS 1308
#define IDC_DONTCYCLE 1315
#define IDC_PRIMARYSTATUS 1316
#define IDC_CYCLE 1317
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index eaee0c1dae..1a3e54ef0b 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -779,14 +779,16 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Contact list",IDC_STATIC,6,5,289,90
- CONTROL "Hide offline users",IDC_HIDEOFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,17,124,10
- CONTROL "Hide empty groups",IDC_HIDEEMPTYGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,29,124,10
- CONTROL "Enable groups",IDC_USEGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,41,124,10
- CONTROL "Ask before deleting contacts",IDC_CONFIRMDELETE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,53,124,10
+ GROUPBOX "Contact list",IDC_STATIC,6,5,289,130
+ CONTROL "Hide offline users",IDC_HIDEOFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,17,166,10
+ CONTROL "Hide empty groups",IDC_HIDEEMPTYGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,29,166,10
+ CONTROL "Enable groups",IDC_USEGROUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,41,166,10
+ CONTROL "Ask before deleting contacts",IDC_CONFIRMDELETE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,53,166,10
CONTROL "Remove temporary contacts on exit",IDC_REMOVETEMP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,65,276,10
- CONTROL "Disable icon blinking",IDC_DISABLEICONBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,77,276,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,65,166,10
+ CONTROL "Disable icon blinking",IDC_DISABLEICONBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,77,166,10
+ CTEXT "'Hide offline' means to hide:",IDC_STATIC,183,14,105,8
+ CONTROL "",IDC_HIDEOFFLINEOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,183,24,105,104
END
IDD_EMPTY DIALOGEX 0, 0, 212, 131
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h
index 7e5bbbb19a..424d705f53 100644
--- a/src/mir_app/src/clc.h
+++ b/src/mir_app/src/clc.h
@@ -96,6 +96,7 @@ int ClcOptInit(WPARAM, LPARAM);
namespace Clist
{
extern CMOption<bool> RemoveTempContacts, DisableIconBlink;
+ extern CMOption<DWORD> OfflineModes;
};
/* clistmenus.c */
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index fec6791349..510d011fa7 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -745,7 +745,7 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
dat->greyoutFlags = db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS);
- dat->offlineModes = db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
+ dat->offlineModes = Clist::OfflineModes;
dat->selBkColour = db_get_dw(0, "CLC", "SelBkColour", CLCDEFAULT_SELBKCOLOUR);
dat->selTextColour = db_get_dw(0, "CLC", "SelTextColour", CLCDEFAULT_SELTEXTCOLOUR);
dat->hotTextColour = db_get_dw(0, "CLC", "HotTextColour", CLCDEFAULT_HOTTEXTCOLOUR);
diff --git a/src/mir_app/src/clistopts.cpp b/src/mir_app/src/clistopts.cpp
index 5678fd1da6..b7c0ec7463 100644
--- a/src/mir_app/src/clistopts.cpp
+++ b/src/mir_app/src/clistopts.cpp
@@ -34,13 +34,36 @@ CMOption<bool> Clist::HideEmptyGroups(MODULENAME, "HideEmptyGroups", false);
CMOption<bool> Clist::DisableIconBlink(MODULENAME, "NoIconBlink", false);
CMOption<bool> Clist::RemoveTempContacts(MODULENAME, "RemoveTempContacts", true);
+CMOption<DWORD> Clist::OfflineModes("CLC", "OfflineModes", MODEF_OFFLINE);
+
+struct
+{
+ DWORD style;
+ wchar_t *szDescr;
+}
+static const offlineValues[] =
+{
+ { MODEF_OFFLINE, LPGENW("Offline") },
+ { PF2_ONLINE, LPGENW("Online") },
+ { PF2_SHORTAWAY, LPGENW("Away") },
+ { PF2_LONGAWAY, LPGENW("Not available") },
+ { PF2_LIGHTDND, LPGENW("Occupied") },
+ { PF2_HEAVYDND, LPGENW("Do not disturb") },
+ { PF2_FREECHAT, LPGENW("Free for chat") },
+ { PF2_INVISIBLE, LPGENW("Invisible") }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
class ClistCommonOptsDlg : public CDlgBase
{
CCtrlCheck chkUseGroups, chkHideOffline, chkConfirmDelete, chkHideEmptyGroups, chkRemoveTempContacts, chkDisableIconBlink;
+ CCtrlTreeView hideStatuses;
public:
ClistCommonOptsDlg() :
CDlgBase(g_plugin, IDD_OPT_CLIST),
+ hideStatuses(this, IDC_HIDEOFFLINEOPTS),
chkUseGroups(this, IDC_USEGROUPS),
chkHideOffline(this, IDC_HIDEOFFLINE),
chkConfirmDelete(this, IDC_CONFIRMDELETE),
@@ -56,8 +79,42 @@ public:
CreateLink(chkRemoveTempContacts, Clist::RemoveTempContacts);
}
+ bool OnInitDialog() override
+ {
+ SetWindowLongPtr(hideStatuses.GetHwnd(), GWL_STYLE,
+ GetWindowLongPtr(hideStatuses.GetHwnd(), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+
+ int style = Clist::OfflineModes;
+
+ TVINSERTSTRUCT tvis;
+ tvis.hParent = nullptr;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ for (auto &it : offlineValues) {
+ tvis.item.lParam = it.style;
+ tvis.item.pszText = TranslateW(it.szDescr);
+ tvis.item.stateMask = TVIS_STATEIMAGEMASK;
+ tvis.item.state = INDEXTOSTATEIMAGEMASK((style & it.style) != 0 ? 2 : 1);
+ hideStatuses.InsertItem(&tvis);
+ }
+ return true;
+ }
+
bool OnApply() override
{
+ DWORD flags = 0;
+
+ TVITEMEX tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ tvi.hItem = hideStatuses.GetRoot();
+ while (tvi.hItem) {
+ hideStatuses.GetItem(&tvi);
+ if ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2)
+ flags |= tvi.lParam;
+ tvi.hItem = hideStatuses.GetNextSibling(tvi.hItem);
+ }
+ Clist::OfflineModes = flags;
+
Clist_LoadContactTree();
Clist_InitAutoRebuild(g_clistApi.hwndContactTree);
return true;
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index 98992615d5..c87062ddd1 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -188,6 +188,7 @@
#define IDC_LANGDATE 1010
#define IDC_LNK_ADDONS 1011
#define IDC_RELOAD 1011
+#define IDC_HIDEOFFLINEOPTS 1012
#define IDC_SPECIFYPORTS 1013
#define IDC_ST_ENTERMSG 1013
#define IDC_ST_ENTERURL 1014