summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-03-30 16:52:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-03-30 16:52:28 +0300
commit64303ec8f7d8fd491247a2c06ee133e4f5f3c942 (patch)
treefd57755518819e33a7ed03c8fef389396c0d61df /plugins/Clist_nicer/src
parent1043ccf5d184151af43a417cd6e6c1a800b678dd (diff)
Contact lists:
- all common options moved to the Clist namespace; - fixes #2281 (Add option to not clear "NotOnList" group at start);
Diffstat (limited to 'plugins/Clist_nicer/src')
-rw-r--r--plugins/Clist_nicer/src/CLCButton.cpp6
-rw-r--r--plugins/Clist_nicer/src/clc.cpp4
-rw-r--r--plugins/Clist_nicer/src/clistopts.cpp22
-rw-r--r--plugins/Clist_nicer/src/clui.cpp12
-rw-r--r--plugins/Clist_nicer/src/resource.h4
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp2
6 files changed, 10 insertions, 40 deletions
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp
index 38bb6e0e2d..aefe2bb6bf 100644
--- a/plugins/Clist_nicer/src/CLCButton.cpp
+++ b/plugins/Clist_nicer/src/CLCButton.cpp
@@ -32,7 +32,7 @@ struct CluiTopButton BTNS[] =
{ IDC_TBFINDANDADD, "CLN_findadd", nullptr, LPGEN("Find and add contacts"), 1, 1, 0 },
{ IDC_TBACCOUNTS, "CLN_accounts", nullptr, LPGEN("Accounts"), 1, 1, 0 },
{ IDC_TBOPTIONS, "CLN_options", nullptr, LPGEN("Open preferences"), 1, 1, 0 },
- { IDC_TBSOUND, "CLN_sound", "CLN_soundsoff", LPGEN("Enable/Disable sounds"), 0, 1, 0 },
+ { IDC_TBSOUND, "CLN_sound", "CLN_soundsoff", LPGEN("Enable/Disable sounds"), 0, 1, 0 },
{ IDC_TBMINIMIZE, "CLN_minimize", nullptr, LPGEN("Minimize contact list"), 1, 0, 0 },
{ IDC_TBTOPSTATUS, "CLN_topstatus", nullptr, LPGEN("Status menu"), 1, 0, 1 },
@@ -65,8 +65,8 @@ static void InitDefaultButtons()
}
g_index = -1;
- ClcSetButtonState(IDC_TBHIDEOFFLINE, g_plugin.getByte("HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
- ClcSetButtonState(IDC_TBHIDEGROUPS, g_plugin.getByte("UseGroups", SETTING_USEGROUPS_DEFAULT));
+ ClcSetButtonState(IDC_TBHIDEOFFLINE, Clist::HideOffline);
+ ClcSetButtonState(IDC_TBHIDEGROUPS, Clist::UseGroups);
ClcSetButtonState(IDC_TBSOUND, db_get_b(0, "Skin", "UseSound", 1) ? BST_UNCHECKED : BST_CHECKED);
}
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index d95f6edce2..b74caf29f5 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -133,7 +133,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
if (!__strcmp(cws->szSetting, "Status")) {
if (!Contact_IsHidden(hContact))
if (cws->value.wVal == ID_STATUS_OFFLINE)
- if (g_plugin.getByte("HideOffline", SETTING_HIDEOFFLINE_DEFAULT))
+ if (Clist::HideOffline)
return 0;
SendMessage(g_clistApi.hwndContactTree, INTM_STATUSCHANGED, hContact, lParam);
@@ -161,7 +161,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
SetButtonStates();
}
else if (!__strcmp(cws->szModule, "CList") && !__strcmp(cws->szSetting, "UseGroups")) {
- ClcSetButtonState(IDC_TBHIDEGROUPS, db_get_b(0, cws->szModule, cws->szSetting, SETTING_USEGROUPS_DEFAULT));
+ ClcSetButtonState(IDC_TBHIDEGROUPS, cws->value.bVal);
SetButtonStates();
}
else if (!__strcmp(cws->szModule, "TopToolBar") && !__strcmp(cws->szSetting, "UseFlatButton")) {
diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp
index cca420dd0a..9aefd129fe 100644
--- a/plugins/Clist_nicer/src/clistopts.cpp
+++ b/plugins/Clist_nicer/src/clistopts.cpp
@@ -34,27 +34,9 @@ static void __setFlag(DWORD dwFlag, int iMode)
INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_USER + 1:
- {
- MCONTACT hContact = wParam;
- DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam;
- if (hContact == NULL && ws != nullptr && ws->szModule != nullptr && ws->szSetting != nullptr && strcmp(ws->szModule, "CList") == 0 && strcmp(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;
-
case WM_INITDIALOG:
opt_gen_opts_changed = 0;
TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
- CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, g_plugin.getByte("HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, g_plugin.getByte("HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, g_plugin.getByte("UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, g_plugin.getByte("ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWBOTTOMBUTTONS, cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CLISTSUNKEN, cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_EVENTAREAAUTOHIDE, cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY ? BST_CHECKED : BST_UNCHECKED);
@@ -135,10 +117,6 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (!opt_gen_opts_changed)
return TRUE;
- g_plugin.setByte("HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
- g_plugin.setByte("HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
- g_plugin.setByte("UseGroups", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
- g_plugin.setByte("ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
g_plugin.setByte("Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
g_plugin.setByte("AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
g_plugin.setByte("AlwaysMulti", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index a1d45b2638..58c9ccfc3a 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -160,11 +160,7 @@ static int FS_FontsChanged(WPARAM, LPARAM)
static HWND PreCreateCLC(HWND parent)
{
g_clistApi.hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"",
- WS_CHILD | CLS_CONTACTLIST
- | (g_plugin.getByte("UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
- | (g_plugin.getByte("HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0)
- | (g_plugin.getByte("HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0)
- | CLS_MULTICOLUMN,
+ WS_CHILD | CLS_CONTACTLIST | (Clist::UseGroups ? CLS_USEGROUPS : 0) | (Clist::HideOffline ? CLS_HIDEOFFLINE : 0) | (Clist::HideEmptyGroups ? CLS_HIDEEMPTYGROUPS : 0) | CLS_MULTICOLUMN,
0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), (LPVOID)0xff00ff00);
cfg::clcdat = (struct ClcData *)GetWindowLongPtr(g_clistApi.hwndContactTree, 0);
@@ -450,10 +446,10 @@ void SetButtonStates()
SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED, 0);
break;
case IDC_STBHIDEOFFLINE:
- SendMessage(buttonItem->hWnd, BM_SETCHECK, g_plugin.getByte("HideOffline", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(buttonItem->hWnd, BM_SETCHECK, Clist::HideOffline, 0);
break;
case IDC_STBHIDEGROUPS:
- SendMessage(buttonItem->hWnd, BM_SETCHECK, g_plugin.getByte("UseGroups", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(buttonItem->hWnd, BM_SETCHECK, Clist::UseGroups, 0);
break;
}
}
@@ -1816,7 +1812,7 @@ void LoadCLUIModule(void)
wndclass.lpszClassName = L"EventAreaClass";
RegisterClass(&wndclass);
- oldhideoffline = g_plugin.getByte("HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
+ oldhideoffline = Clist::HideOffline;
cluiPos.left = g_plugin.getDword("x", 600);
cluiPos.top = g_plugin.getDword("y", 200);
cluiPos.right = g_plugin.getDword("Width", 150);
diff --git a/plugins/Clist_nicer/src/resource.h b/plugins/Clist_nicer/src/resource.h
index c530f2f768..ab925ce8cd 100644
--- a/plugins/Clist_nicer/src/resource.h
+++ b/plugins/Clist_nicer/src/resource.h
@@ -50,12 +50,10 @@
#define IDC_LASTMSG 1023
#define IDC_IGN_AUTH 1023
#define IDC_IGN_ADD 1024
-#define IDC_CONFIRMDELETE 1025
#define IDC_IGN_ONLINE 1025
#define IDC_IGN_ALWAYSONLINE 1026
#define IDC_IGN_ALWAYSOFFLINE 1027
#define IDC_IGN_PRIORITY 1028
-#define IDC_DISABLEGROUPS 1030
#define IDC_DROPSHADOW 1035
#define IDC_EQUALSELECTION 1040
#define IDC_USEPERPROTO 1041
@@ -79,12 +77,10 @@
#define IDC_ONTOP 1074
#define IDC_SHOWMAINMENU 1075
#define IDC_CLIENTDRAG 1076
-#define IDC_HIDEEMPTYGROUPS 1077
#define IDC_CTOPSPIN 1077
#define IDC_CBOTTOM 1078
#define IDC_CBOTTOMSPIN 1079
#define IDC_CRIGHT 1080
-#define IDC_HIDEOFFLINE 1081
#define IDC_CRIGHTSPIN 1081
#define IDC_HIDEOFFLINEOPTS 1082
#define IDC_LEFTMARGINSPIN 1092
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index cc4ffe31a9..8b05e1ef22 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -1100,7 +1100,7 @@ void ApplyViewMode(const char *name)
cfg::dat.bFilterEffective |= CLVM_STICKY_CONTACTS;
if (cfg::dat.boldHideOffline == (BYTE)-1)
- cfg::dat.boldHideOffline = g_plugin.getByte("HideOffline", 0);
+ cfg::dat.boldHideOffline = Clist::HideOffline;
g_clistApi.pfnSetHideOffline(false);
if (name == nullptr) {