diff options
author | George Hazan <ghazan@miranda.im> | 2020-04-20 13:54:27 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-04-20 13:54:27 +0300 |
commit | 4ea593493aeff473146e0baf0d41558ef5dbec05 (patch) | |
tree | cb06498888654476dd41fcdfc8f83ced617d6c7b /plugins/Clist_nicer | |
parent | ac32858e8eb13d9823bf72daad436ab8f9db31ee (diff) |
Clist_Nicer: all tabbed options moved to UI classes
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r-- | plugins/Clist_nicer/src/clcopts.cpp | 402 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clistopts.cpp | 864 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/cluiopts.cpp | 388 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/extBackg.cpp | 85 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/stdafx.h | 19 |
5 files changed, 835 insertions, 923 deletions
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index db73bf5a47..f7ada77509 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -31,85 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DBFONTF_ITALIC 2
#define DBFONTF_UNDERLINE 4
-static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-struct CheckBoxToStyleEx_t {
- int id;
- DWORD flag;
- int not_t;
-} static const checkBoxToStyleEx[] = {
- { IDC_DISABLEDRAGDROP, CLS_EX_DISABLEDRAGDROP, 0 }, { IDC_NOTEDITLABELS, CLS_EX_EDITLABELS, 1 },
- { IDC_SHOWSELALWAYS, CLS_EX_SHOWSELALWAYS, 0 }, { IDC_TRACKSELECT, CLS_EX_TRACKSELECT, 0 },
- { IDC_DIVIDERONOFF, CLS_EX_DIVIDERONOFF, 0 }, { IDC_NOTNOTRANSLUCENTSEL, CLS_EX_NOTRANSLUCENTSEL, 1 },
- { IDC_NOTNOSMOOTHSCROLLING, CLS_EX_NOSMOOTHSCROLLING, 1 }
-};
-
-struct CheckBoxToGroupStyleEx_t {
- int id;
- DWORD flag;
- int not_t;
-} static const checkBoxToGroupStyleEx[] = {
- { IDC_SHOWGROUPCOUNTS, CLS_EX_SHOWGROUPCOUNTS, 0 }, { IDC_HIDECOUNTSWHENEMPTY, CLS_EX_HIDECOUNTSWHENEMPTY, 0 },
- { IDC_LINEWITHGROUPS, CLS_EX_LINEWITHGROUPS, 0 }, { IDC_QUICKSEARCHVISONLY, CLS_EX_QUICKSEARCHVISONLY, 0 },
- { IDC_SORTGROUPSALPHA, CLS_EX_SORTGROUPSALPHA, 0 }
-};
-
-struct CheckBoxValues_t {
- DWORD style;
- wchar_t *szDescr;
-}
-static const greyoutValues[] = {
- { GREYF_UNFOCUS, LPGENW("Not focused") },
- { 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;
- int i;
-
- tvis.hParent = nullptr;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
- for (i = 0; i < nValues; i++) {
- tvis.item.lParam = values[i].style;
- tvis.item.pszText = TranslateW(values[i].szDescr);
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK((style & tvis.item.lParam) != 0 ? 2 : 1);
- TreeView_InsertItem(hwndTree, &tvis);
- }
-}
-
-static DWORD MakeCheckBoxTreeFlags(HWND hwndTree)
-{
- DWORD flags = 0;
- TVITEM tvi;
-
- tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
- tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem) {
- TreeView_GetItem(hwndTree, &tvi);
- if ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2)
- flags |= tvi.lParam;
- tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
- }
- return flags;
-}
-
-static void cfgSetFlag(HWND hwndDlg, int ctrlId, DWORD dwMask)
+void cfgSetFlag(HWND hwndDlg, int ctrlId, DWORD dwMask)
{
if (IsDlgButtonChecked(hwndDlg, ctrlId))
cfg::dat.dwFlags |= dwMask;
@@ -145,24 +67,6 @@ void GetDefaultFontSetting(int i, LOGFONT *lf, COLORREF *colour) /////////////////////////////////////////////////////////////////////////////////////////
-class CRowItemsBaseDlg : public CDlgBase
-{
- void OnFinish(CDlgBase*)
- {
- Clist_ClcOptionsChanged();
- PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
- }
-
-public:
- CRowItemsBaseDlg(int iDlg) :
- CDlgBase(g_plugin, iDlg)
- {
- m_OnFinishWizard = Callback(this, &CRowItemsBaseDlg::OnFinish);
- }
-};
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
static UINT sortCtrlIDs[] = { IDC_SORTPRIMARY, IDC_SORTTHEN, IDC_SORTFINALLY };
class CDspItemsDlg : public CRowItemsBaseDlg
@@ -225,6 +129,21 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
+struct CheckBoxToGroupStyleEx_t
+{
+ int id;
+ DWORD flag;
+ int not_t;
+}
+static const checkBoxToGroupStyleEx[] =
+{
+ { IDC_SHOWGROUPCOUNTS, CLS_EX_SHOWGROUPCOUNTS, 0 },
+ { IDC_HIDECOUNTSWHENEMPTY, CLS_EX_HIDECOUNTSWHENEMPTY, 0 },
+ { IDC_LINEWITHGROUPS, CLS_EX_LINEWITHGROUPS, 0 },
+ { IDC_QUICKSEARCHVISONLY, CLS_EX_QUICKSEARCHVISONLY, 0 },
+ { IDC_SORTGROUPSALPHA, CLS_EX_SORTGROUPSALPHA, 0 }
+};
+
class CDspGroupsDlg : public CRowItemsBaseDlg
{
@@ -318,6 +237,8 @@ public: chkAvaBorder(this, IDC_AVATARSBORDER),
chkLocalTime(this, IDC_SHOWLOCALTIME)
{
+ chkAvaRound.OnChange = Callback(this, &CDspAdvancedDlg::onChange_AvatarsRounded);
+ chkAvaBorder.OnChange = Callback(this, &CDspAdvancedDlg::onChange_AvatarsBorder);
chkLocalTime.OnChange = Callback(this, &CDspAdvancedDlg::onChange_LocalTime);
}
@@ -367,7 +288,6 @@ public: onChange_AvatarsRounded(0);
chkLocalTime.SetState(cfg::dat.bShowLocalTime);
- CheckDlgButton(m_hwnd, IDC_SHOWLOCALTIMEONLYWHENDIFFERENT, cfg::dat.bShowLocalTimeSelective ? BST_CHECKED : BST_UNCHECKED);
onChange_LocalTime(0);
if (cfg::dat.dwFlags & CLUI_FRAME_AVATARSLEFT)
@@ -491,296 +411,22 @@ public: };
/////////////////////////////////////////////////////////////////////////////////////////
+// Module entry point
-static int opt_clc_main_changed = 0;
-
-static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- opt_clc_main_changed = 0;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- {
- DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", Clist_GetDefaultExStyle());
- 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_SETPOS, 0, MAKELONG(db_get_w(0, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
-
- for (auto &it : checkBoxToStyleEx)
- CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.not_t) ? BST_CHECKED : BST_UNCHECKED);
- }
- CheckDlgButton(hwndDlg, IDC_FULLROWSELECT, (cfg::dat.dwFlags & CLUI_FULLROWSELECT) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_DBLCLKAVATARS, cfg::dat.bDblClkAvatars ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_GREYOUT, db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_SMOOTHTIME, IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
- Utils::enableDlgControl(hwndDlg, IDC_GREYOUTOPTS, IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, sizeof(greyoutValues) / sizeof(greyoutValues[0]), db_get_dw(0, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
- CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(0, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
- return TRUE;
-
- case WM_VSCROLL:
- opt_clc_main_changed = 1;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_NOTNOSMOOTHSCROLLING)
- Utils::enableDlgControl(hwndDlg, IDC_SMOOTHTIME, IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
- if (LOWORD(wParam) == IDC_GREYOUT)
- Utils::enableDlgControl(hwndDlg, IDC_GREYOUTOPTS, IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
- if (LOWORD(wParam) == IDC_SMOOTHTIME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- opt_clc_main_changed = 1;
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_GREYOUTOPTS:
- 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))
- 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);
- tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- opt_clc_main_changed = 1;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- break;
-
- case 0:
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- if (!opt_clc_main_changed)
- return TRUE;
-
- DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", CLCDEFAULT_EXSTYLE);
-
- for (auto &it : checkBoxToStyleEx)
- exStyle &= ~(it.flag);
-
- for (auto &it : checkBoxToStyleEx)
- if ((IsDlgButtonChecked(hwndDlg, it.id) == 0) == it.not_t)
- exStyle |= it.flag;
-
- db_set_dw(0, "CLC", "ExStyle", exStyle);
-
- DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS));
- db_set_dw(0, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
- if (IsDlgButtonChecked(hwndDlg, IDC_GREYOUT))
- db_set_dw(0, "CLC", "GreyoutFlags", fullGreyoutFlags);
- else
- db_set_dw(0, "CLC", "GreyoutFlags", 0);
-
- cfgSetFlag(hwndDlg, IDC_FULLROWSELECT, CLUI_FULLROWSELECT);
-
- db_set_w(0, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
- db_set_b(0, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
- cfg::dat.bDblClkAvatars = IsDlgButtonChecked(hwndDlg, IDC_DBLCLKAVATARS) ? TRUE : FALSE;
- db_set_b(0, "CLC", "dblclkav", (BYTE)cfg::dat.bDblClkAvatars);
-
- Clist_ClcOptionsChanged();
- CoolSB_SetupScrollBar();
- PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
- opt_clc_main_changed = 0;
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static int opt_clc_bkg_changed = 0;
-
-static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- opt_clc_bkg_changed = 0;
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_BITMAP, db_get_b(0, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(hwndDlg, WM_USER + 10, 0, 0);
- CheckDlgButton(hwndDlg, IDC_WINCOLOUR, db_get_b(0, "CLC", "UseWinColours", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SKINMODE, cfg::dat.bWallpaperMode ? BST_CHECKED : BST_UNCHECKED);
- {
- DBVARIANT dbv;
- if (!db_get_ws(0, "CLC", "BkBitmap", &dbv)) {
- wchar_t szPath[MAX_PATH];
- if (PathToAbsoluteW(dbv.pwszVal, szPath))
- SetDlgItemText(hwndDlg, IDC_FILENAME, szPath);
-
- db_free(&dbv);
- }
-
- WORD bmpUse = db_get_w(0, "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);
- CheckDlgButton(hwndDlg, IDC_TILEV, bmpUse & CLBF_TILEV ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SCROLL, bmpUse & CLBF_SCROLL ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_PROPORTIONAL, bmpUse & CLBF_PROPORTIONAL ? BST_CHECKED : BST_UNCHECKED);
-
- SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
- }
- return TRUE;
-
- case WM_USER + 10:
- Utils::enableDlgControl(hwndDlg, IDC_FILENAME, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- Utils::enableDlgControl(hwndDlg, IDC_BROWSE, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- Utils::enableDlgControl(hwndDlg, IDC_STRETCHH, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- Utils::enableDlgControl(hwndDlg, IDC_STRETCHV, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- Utils::enableDlgControl(hwndDlg, IDC_TILEH, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- Utils::enableDlgControl(hwndDlg, IDC_TILEV, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- Utils::enableDlgControl(hwndDlg, IDC_SCROLL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- Utils::enableDlgControl(hwndDlg, IDC_PROPORTIONAL, IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- break;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_BROWSE) {
- wchar_t str[MAX_PATH], filter[512];
- GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
- Bitmap_GetFilter(filter, _countof(filter));
-
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = hwndDlg;
- ofn.hInstance = nullptr;
- ofn.lpstrFilter = filter;
- ofn.lpstrFile = str;
- ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = _countof(str);
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.lpstrDefExt = L"bmp";
- if (!GetOpenFileName(&ofn))
- break;
- SetDlgItemText(hwndDlg, IDC_FILENAME, str);
- }
- else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE)
- break;
-
- if (LOWORD(wParam) == IDC_BITMAP)
- SendMessage(hwndDlg, WM_USER + 10, 0, 0);
- if (LOWORD(wParam) == IDC_WINCOLOUR)
- SendMessage(hwndDlg, WM_USER + 11, 0, 0);
- if (LOWORD(wParam) == IDC_FILENAME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
-
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- opt_clc_bkg_changed = 1;
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- if (!opt_clc_bkg_changed)
- return TRUE;
-
- db_set_b(0, "CLC", "UseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- db_set_b(0, "CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR));
-
- char str[MAX_PATH], strrel[MAX_PATH];
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, _countof(str));
- if (PathToRelative(str, strrel))
- db_set_s(0, "CLC", "BkBitmap", strrel);
- else
- db_set_s(0, "CLC", "BkBitmap", str);
-
- WORD flags = 0;
- if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH))
- flags |= CLB_STRETCHH;
- if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHV))
- flags |= CLB_STRETCHV;
- if (IsDlgButtonChecked(hwndDlg, IDC_TILEH))
- flags |= CLBF_TILEH;
- if (IsDlgButtonChecked(hwndDlg, IDC_TILEV))
- flags |= CLBF_TILEV;
- if (IsDlgButtonChecked(hwndDlg, IDC_SCROLL))
- flags |= CLBF_SCROLL;
- if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL))
- flags |= CLBF_PROPORTIONAL;
- db_set_w(0, "CLC", "BkBmpUse", flags);
- cfg::dat.bWallpaperMode = IsDlgButtonChecked(hwndDlg, IDC_SKINMODE) ? 1 : 0;
- db_set_b(0, "CLUI", "UseBkSkin", (BYTE)cfg::dat.bWallpaperMode);
-
- Clist_ClcOptionsChanged();
- PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
- opt_clc_bkg_changed = 0;
- return TRUE;
- }
- break;
- }
- break;
- }
- return FALSE;
-}
+void InitClistOptions(WPARAM);
+void InitSkinOptions(WPARAM);
int ClcOptInit(WPARAM wParam, LPARAM)
{
- ////////////////////////////////////////////////////////////////////////////
- // Main options tabs
+ InitClistOptions(wParam);
+ InitSkinOptions(wParam);
+ // Contact rows tabs
OPTIONSDIALOGPAGE odp = {};
- odp.position = -1000000000;
odp.flags = ODPF_BOLDGROUPS;
- odp.szTitle.a = LPGEN("Contact list");
- odp.szTab.a = LPGEN("General");
- odp.pfnDlgProc = DlgProcGenOpts;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST);
- g_plugin.addOptions(wParam, &odp);
-
- odp.szTab.a = LPGEN("List layout");
- odp.pfnDlgProc = DlgProcClcMainOpts;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC);
- g_plugin.addOptions(wParam, &odp);
-
- odp.szTab.a = LPGEN("Window");
- odp.pfnDlgProc = DlgProcCluiOpts;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI);
- g_plugin.addOptions(wParam, &odp);
-
- odp.szTab.a = LPGEN("Background");
- odp.pfnDlgProc = DlgProcClcBkgOpts;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG);
- g_plugin.addOptions(wParam, &odp);
-
- odp.szTab.a = LPGEN("Status bar");
- odp.pfnDlgProc = DlgProcSBarOpts;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SBAR);
- g_plugin.addOptions(wParam, &odp);
-
- ////////////////////////////////////////////////////////////////////////////
- // Other options
-
- odp.position = 0;
- odp.szGroup.a = LPGEN("Skins");
- odp.szTitle.a = LPGEN("Contact list");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
- odp.pfnDlgProc = OptionsDlgProc;
- g_plugin.addOptions(wParam, &odp);
-
- ////////////////////////////////////////////////////////////////////////////
- // Contact rows tabs
-
odp.szGroup.a = LPGEN("Contact list");
odp.szTitle.a = LPGEN("Row items");
- odp.pfnDlgProc = 0;
- odp.pszTemplate = 0;
odp.szTab.a = LPGEN("Contacts");
odp.pDialog = new CDspItemsDlg();
g_plugin.addOptions(wParam, &odp);
diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index 03fe6d51ee..cc6bc3e3ee 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -24,141 +24,765 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-static int opt_gen_opts_changed = 0;
+void AddToTaskBar(HWND hWnd);
-static void __setFlag(DWORD dwFlag, int iMode)
-{
- cfg::dat.dwFlags = iMode ? cfg::dat.dwFlags | dwFlag : cfg::dat.dwFlags & ~dwFlag;
-}
+void cfgSetFlag(HWND hwndDlg, int ctrlId, DWORD dwMask);
+
+extern COLORREF g_CLUISkinnedBkColorRGB;
-INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Main options : General
+
+class COptGeneralDlg : public CRowItemsBaseDlg
{
- switch (msg) {
- case WM_INITDIALOG:
- opt_gen_opts_changed = 0;
- TranslateDialogDefault(hwndDlg);
- 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);
- CheckDlgButton(hwndDlg, IDC_EVENTAREASUNKEN, (cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONECLK, g_plugin.getByte("Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, g_plugin.getByte("AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !g_plugin.getByte("AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DONTCYCLE, g_plugin.getByte("TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CYCLE, g_plugin.getByte("TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MULTITRAY, g_plugin.getByte("TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, g_plugin.getByte("DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
- if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) {
- Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE);
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) {
- Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE);
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) {
- Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE);
- }
- SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
- SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(g_plugin.getWord("CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
+ CCtrlCheck chkDontCycle, chkCycle, chkMulti;
+
+public:
+ COptGeneralDlg() :
+ CRowItemsBaseDlg(IDD_OPT_CLIST),
+ chkCycle(this, IDC_CYCLE),
+ chkMulti(this, IDC_MULTITRAY),
+ chkDontCycle(this, IDC_DONTCYCLE)
+ {
+ chkCycle.OnChange = chkMulti.OnChange = chkDontCycle.OnChange = Callback(this, &COptGeneralDlg::onChange_Cycle);
+ }
+
+ bool OnInitDialog() override
+ {
+ CheckDlgButton(m_hwnd, IDC_SHOWBOTTOMBUTTONS, cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_CLISTSUNKEN, cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_EVENTAREAAUTOHIDE, cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_EVENTAREASUNKEN, (cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_ONECLK, g_plugin.getByte("Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_ALWAYSSTATUS, g_plugin.getByte("AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_ALWAYSMULTI, !g_plugin.getByte("AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_DISABLEBLINK, g_plugin.getByte("DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+
+ chkCycle.SetState(g_plugin.getByte("TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE);
+ chkMulti.SetState(g_plugin.getByte("TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI);
+ chkDontCycle.SetState(g_plugin.getByte("TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE);
+ onChange_Cycle(0);
+
+ SendDlgItemMessage(m_hwnd, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
+ SendDlgItemMessage(m_hwnd, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(g_plugin.getWord("CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
{
ptrA szPrimaryStatus(g_plugin.getStringA("PrimaryStatus"));
- int item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global"));
- SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0);
+ int item = SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global"));
+ SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0);
for (auto &pa : Accounts()) {
if (!pa->IsEnabled() || CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
continue;
- item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)pa->tszAccountName);
- SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)pa);
+ item = SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)pa->tszAccountName);
+ SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)pa);
if (!mir_strcmp(szPrimaryStatus, pa->szModuleName))
- SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0);
+ SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 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_SETRANGE, 0, MAKELONG(0x3FFF, 250));
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(g_plugin.getWord("IconFlashTime", 550), 0));
- CheckDlgButton(hwndDlg, IDC_NOTRAYINFOTIPS, cfg::dat.bNoTrayTips ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_APPLYLASTVIEWMODE, g_plugin.getByte("AutoApplyLastViewMode", 0) ? BST_CHECKED : BST_UNCHECKED);
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) {
- Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE));
- Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, IsDlgButtonChecked(hwndDlg, IDC_CYCLE));
- Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_CYCLE));
- Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY));
+ if (CB_ERR == (int)SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0))
+ SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0);
+
+ SendDlgItemMessage(m_hwnd, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
+ SendDlgItemMessage(m_hwnd, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(g_plugin.getWord("IconFlashTime", 550), 0));
+ CheckDlgButton(m_hwnd, IDC_NOTRAYINFOTIPS, cfg::dat.bNoTrayTips ? 1 : 0);
+ CheckDlgButton(m_hwnd, IDC_APPLYLASTVIEWMODE, g_plugin.getByte("AutoApplyLastViewMode", 0) ? BST_CHECKED : BST_UNCHECKED);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ g_plugin.setByte("Tray1Click", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_ONECLK));
+ g_plugin.setByte("AlwaysStatus", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_ALWAYSSTATUS));
+ g_plugin.setByte("AlwaysMulti", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_ALWAYSMULTI));
+ g_plugin.setByte("TrayIcon", (BYTE)(chkDontCycle.GetState() ? SETTING_TRAYICON_SINGLE : (chkCycle.GetState() ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI)));
+ g_plugin.setWord("CycleTime", (WORD)SendDlgItemMessage(m_hwnd, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
+ g_plugin.setWord("IconFlashTime", (WORD)SendDlgItemMessage(m_hwnd, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
+ g_plugin.setByte("DisableTrayFlash", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_DISABLEBLINK));
+ g_plugin.setByte("AutoApplyLastViewMode", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_APPLYLASTVIEWMODE));
+
+ cfgSetFlag(m_hwnd, CLUI_FRAME_EVENTAREASUNKEN, IDC_EVENTAREASUNKEN);
+ cfgSetFlag(m_hwnd, CLUI_FRAME_AUTOHIDENOTIFY, IDC_EVENTAREAAUTOHIDE);
+
+ cfgSetFlag(m_hwnd, CLUI_FRAME_SHOWBOTTOMBUTTONS, IDC_SHOWBOTTOMBUTTONS);
+ cfgSetFlag(m_hwnd, CLUI_FRAME_CLISTSUNKEN, IDC_CLISTSUNKEN);
+
+ cfg::dat.bNoTrayTips = IsDlgButtonChecked(m_hwnd, IDC_NOTRAYINFOTIPS) ? 1 : 0;
+ g_plugin.setByte("NoTrayTips", (BYTE)cfg::dat.bNoTrayTips);
+ {
+ int cursel = SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
+ PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(m_hwnd, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cursel, 0);
+ if (!pa)
+ g_plugin.delSetting("PrimaryStatus");
+ else
+ g_plugin.setString("PrimaryStatus", pa->szModuleName);
+ }
+ Clist_TrayIconIconsChanged();
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ ConfigureFrame();
+ ConfigureCLUIGeometry(1);
+ ConfigureEventArea();
+ HideShowNotifyFrame();
+ SendMessage(g_clistApi.hwndContactTree, WM_SIZE, 0, 0);
+ SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
+ Clist_LoadContactTree(); /* this won't do job properly since it only really works when changes happen */
+ Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
+ return true;
+ }
+
+ void onChange_Cycle(CCtrlCheck *)
+ {
+ Utils::enableDlgControl(m_hwnd, IDC_PRIMARYSTATUS, chkDontCycle.GetState());
+ Utils::enableDlgControl(m_hwnd, IDC_CYCLETIME, chkCycle.GetState());
+ Utils::enableDlgControl(m_hwnd, IDC_CYCLETIMESPIN, chkCycle.GetState());
+ Utils::enableDlgControl(m_hwnd, IDC_ALWAYSMULTI, chkMulti.GetState());
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// "List layout" options
+
+struct CheckBoxToStyleEx_t
+{
+ int id;
+ DWORD flag;
+ int not_t;
+}
+static const checkBoxToStyleEx[] = {
+ { IDC_DISABLEDRAGDROP, CLS_EX_DISABLEDRAGDROP, 0 },
+ { IDC_NOTEDITLABELS, CLS_EX_EDITLABELS, 1 },
+ { IDC_SHOWSELALWAYS, CLS_EX_SHOWSELALWAYS, 0 },
+ { IDC_TRACKSELECT, CLS_EX_TRACKSELECT, 0 },
+ { IDC_DIVIDERONOFF, CLS_EX_DIVIDERONOFF, 0 },
+ { IDC_NOTNOTRANSLUCENTSEL, CLS_EX_NOTRANSLUCENTSEL, 1 },
+ { IDC_NOTNOSMOOTHSCROLLING, CLS_EX_NOSMOOTHSCROLLING, 1 }
+};
+
+struct CheckBoxValues_t
+{
+ DWORD style;
+ wchar_t *szDescr;
+}
+static const greyoutValues[] = {
+ { GREYF_UNFOCUS, LPGENW("Not focused") },
+ { 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 COptLayoutDlg : public CRowItemsBaseDlg
+{
+ CCtrlCheck chkSmooth, chkGreyOut;
+ CCtrlTreeView greyOut;
+
+public:
+ COptLayoutDlg() :
+ CRowItemsBaseDlg(IDD_OPT_CLC),
+ greyOut(this, IDC_GREYOUTOPTS),
+ chkSmooth(this, IDC_NOTNOSMOOTHSCROLLING),
+ chkGreyOut(this, IDC_GREYOUT)
+ {
+ chkSmooth.OnChange = Callback(this, &COptLayoutDlg::onChange_Smooth);
+ chkGreyOut.OnChange = Callback(this, &COptLayoutDlg::onChange_GreyOut);
+ }
+
+ bool OnInitDialog() override
+ {
+ SetWindowLongPtr(greyOut.GetHwnd(), GWL_STYLE, GetWindowLongPtr(greyOut.GetHwnd(), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+
+ DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", Clist_GetDefaultExStyle());
+ UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } };
+ SendDlgItemMessage(m_hwnd, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
+ SendDlgItemMessage(m_hwnd, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)&accel);
+ SendDlgItemMessage(m_hwnd, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
+
+ for (auto &it : checkBoxToStyleEx)
+ CheckDlgButton(m_hwnd, it.id, (exStyle & it.flag) ^ (it.flag * it.not_t) ? BST_CHECKED : BST_UNCHECKED);
+ onChange_Smooth(0);
+
+ CheckDlgButton(m_hwnd, IDC_FULLROWSELECT, (cfg::dat.dwFlags & CLUI_FULLROWSELECT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_DBLCLKAVATARS, cfg::dat.bDblClkAvatars ? BST_CHECKED : BST_UNCHECKED);
+
+ chkGreyOut.SetState(db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS));
+ onChange_GreyOut(0);
+
+ DWORD style = db_get_dw(0, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS);
+ TVINSERTSTRUCT tvis;
+ tvis.hParent = nullptr;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ for (auto &it : greyoutValues) {
+ tvis.item.lParam = it.style;
+ tvis.item.pszText = TranslateW(it.szDescr);
+ tvis.item.stateMask = TVIS_STATEIMAGEMASK;
+ tvis.item.state = INDEXTOSTATEIMAGEMASK((style & tvis.item.lParam) != 0 ? 2 : 1);
+ greyOut.InsertItem(&tvis);
+ }
+
+ CheckDlgButton(m_hwnd, IDC_NOSCROLLBAR, db_get_b(0, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", CLCDEFAULT_EXSTYLE);
+
+ for (auto &it : checkBoxToStyleEx)
+ exStyle &= ~(it.flag);
+
+ for (auto &it : checkBoxToStyleEx)
+ if ((IsDlgButtonChecked(m_hwnd, it.id) == 0) == it.not_t)
+ exStyle |= it.flag;
+
+ db_set_dw(0, "CLC", "ExStyle", exStyle);
+
+ DWORD fullGreyoutFlags = 0;
+ TVITEMEX tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ tvi.hItem = greyOut.GetRoot();
+ while (tvi.hItem) {
+ greyOut.GetItem(&tvi);
+ if ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2)
+ fullGreyoutFlags |= tvi.lParam;
+ tvi.hItem = greyOut.GetNextSibling(tvi.hItem);
}
- if (LOWORD(wParam) == IDC_CYCLETIME && HIWORD(wParam) != EN_CHANGE)
- break;
- if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE)
- break;
- if (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()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- opt_gen_opts_changed = TRUE;
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- if (!opt_gen_opts_changed)
- return TRUE;
-
- 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));
- g_plugin.setByte("TrayIcon", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI)));
- g_plugin.setWord("CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
- g_plugin.setWord("IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
- g_plugin.setByte("DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
- g_plugin.setByte("AutoApplyLastViewMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPLYLASTVIEWMODE));
-
- __setFlag(CLUI_FRAME_EVENTAREASUNKEN, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREASUNKEN));
- __setFlag(CLUI_FRAME_AUTOHIDENOTIFY, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREAAUTOHIDE));
-
- __setFlag(CLUI_FRAME_SHOWBOTTOMBUTTONS, IsDlgButtonChecked(hwndDlg, IDC_SHOWBOTTOMBUTTONS));
- __setFlag(CLUI_FRAME_CLISTSUNKEN, IsDlgButtonChecked(hwndDlg, IDC_CLISTSUNKEN));
-
- cfg::dat.bNoTrayTips = IsDlgButtonChecked(hwndDlg, IDC_NOTRAYINFOTIPS) ? 1 : 0;
- g_plugin.setByte("NoTrayTips", (BYTE)cfg::dat.bNoTrayTips);
- {
- int cursel = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
- PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cursel, 0);
- if (!pa)
- g_plugin.delSetting("PrimaryStatus");
- else
- g_plugin.setString("PrimaryStatus", pa->szModuleName);
- }
- Clist_TrayIconIconsChanged();
- db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
- ConfigureFrame();
- ConfigureCLUIGeometry(1);
- ConfigureEventArea();
- HideShowNotifyFrame();
- SendMessage(g_clistApi.hwndContactTree, WM_SIZE, 0, 0);
- SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
- Clist_LoadContactTree(); /* this won't do job properly since it only really works when changes happen */
- Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
- PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
-
- opt_gen_opts_changed = 0;
- return TRUE;
+ db_set_dw(0, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
+
+ if (chkGreyOut.GetState())
+ db_set_dw(0, "CLC", "GreyoutFlags", fullGreyoutFlags);
+ else
+ db_set_dw(0, "CLC", "GreyoutFlags", 0);
+
+ cfgSetFlag(m_hwnd, IDC_FULLROWSELECT, CLUI_FULLROWSELECT);
+
+ db_set_w(0, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(m_hwnd, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(m_hwnd, IDC_NOSCROLLBAR) ? 1 : 0));
+ cfg::dat.bDblClkAvatars = IsDlgButtonChecked(m_hwnd, IDC_DBLCLKAVATARS) ? TRUE : FALSE;
+ db_set_b(0, "CLC", "dblclkav", (BYTE)cfg::dat.bDblClkAvatars);
+
+ Clist_ClcOptionsChanged();
+ CoolSB_SetupScrollBar();
+ PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
+ return true;
+ }
+
+ void onChange_Smooth(CCtrlCheck *)
+ {
+ Utils::enableDlgControl(m_hwnd, IDC_SMOOTHTIME, chkSmooth.GetState());
+ }
+
+ void onChange_GreyOut(CCtrlCheck *)
+ {
+ greyOut.Enable(chkGreyOut.GetState());
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Window options
+
+class COptWindowDlg : public CRowItemsBaseDlg
+{
+ CCtrlCheck chkAutoHide, chkAutoSize, chkTransparent;
+
+public:
+ COptWindowDlg() :
+ CRowItemsBaseDlg(IDD_OPT_CLUI),
+ chkAutoHide(this, IDC_AUTOHIDE),
+ chkAutoSize(this, IDC_AUTOSIZE),
+ chkTransparent(this, IDC_TRANSPARENT)
+ {
+ chkAutoHide.OnChange = Callback(this, &COptWindowDlg::onChange_AutoHide);
+ chkAutoSize.OnChange = Callback(this, &COptWindowDlg::onChange_AutoSize);
+ chkTransparent.OnChange = Callback(this, &COptWindowDlg::onChange_Transparent);
+ }
+
+ bool OnInitDialog() override
+ {
+ CheckDlgButton(m_hwnd, IDC_BRINGTOFRONT, g_plugin.getByte("BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_ALWAYSHIDEONTASKBAR, g_plugin.getByte("AlwaysHideOnTB", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_ONTOP, g_plugin.getByte("OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWMAINMENU, db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_CLIENTDRAG, db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_FADEINOUT, cfg::dat.fadeinout ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_DROPSHADOW, g_plugin.getByte("WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_ONDESKTOP, g_plugin.getByte("OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ chkAutoSize.SetState(cfg::dat.autosize);
+ onChange_AutoSize(0);
+
+ SendDlgItemMessage(m_hwnd, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Title bar"));
+ SendDlgItemMessage(m_hwnd, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tool Window"));
+ SendDlgItemMessage(m_hwnd, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Thin border"));
+ SendDlgItemMessage(m_hwnd, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("No border"));
+ SendDlgItemMessage(m_hwnd, IDC_BORDERSTYLE, CB_SETCURSEL, db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW), 0);
+
+ SendDlgItemMessage(m_hwnd, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+ SendDlgItemMessage(m_hwnd, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "MaxSizeHeight", 75));
+
+ SendDlgItemMessage(m_hwnd, IDC_CLIPBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
+ SendDlgItemMessage(m_hwnd, IDC_CLIPBORDERSPIN, UDM_SETPOS, 0, cfg::dat.bClipBorder);
+
+ SendDlgItemMessage(m_hwnd, IDC_CLEFTSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
+ SendDlgItemMessage(m_hwnd, IDC_CRIGHTSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
+ SendDlgItemMessage(m_hwnd, IDC_CTOPSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
+ SendDlgItemMessage(m_hwnd, IDC_CBOTTOMSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
+
+ SendDlgItemMessage(m_hwnd, IDC_CLEFTSPIN, UDM_SETPOS, 0, cfg::dat.bCLeft - (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? 3 : 0));
+ SendDlgItemMessage(m_hwnd, IDC_CRIGHTSPIN, UDM_SETPOS, 0, cfg::dat.bCRight - (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? 3 : 0));
+ SendDlgItemMessage(m_hwnd, IDC_CTOPSPIN, UDM_SETPOS, 0, cfg::dat.bCTop);
+ SendDlgItemMessage(m_hwnd, IDC_CBOTTOMSPIN, UDM_SETPOS, 0, cfg::dat.bCBottom);
+
+ CheckDlgButton(m_hwnd, IDC_AUTOSIZEUPWARD, db_get_b(0, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ SendDlgItemMessage(m_hwnd, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1));
+ SendDlgItemMessage(m_hwnd, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(g_plugin.getWord("HideTime", SETTING_HIDETIME_DEFAULT), 0));
+
+ chkAutoHide.SetState(g_plugin.getByte("AutoHide", SETTING_AUTOHIDE_DEFAULT));
+ onChange_AutoHide(0);
+
+ ptrW tszTitle(g_plugin.getWStringA("TitleText"));
+ if (tszTitle != NULL)
+ SetDlgItemText(m_hwnd, IDC_TITLETEXT, tszTitle);
+ else
+ SetDlgItemTextA(m_hwnd, IDC_TITLETEXT, MIRANDANAME);
+
+ CheckDlgButton(m_hwnd, IDC_FULLTRANSPARENT, cfg::dat.bFullTransparent ? BST_CHECKED : BST_UNCHECKED);
+
+ chkTransparent.SetState(cfg::dat.isTransparent);
+ onChange_Transparent(0);
+
+ SendDlgItemMessage(m_hwnd, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
+ SendDlgItemMessage(m_hwnd, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
+ SendDlgItemMessage(m_hwnd, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, cfg::dat.alpha);
+ SendDlgItemMessage(m_hwnd, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, cfg::dat.autoalpha);
+ UpdateCounters();
+
+ CheckDlgButton(m_hwnd, IDC_ROUNDEDBORDER, cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(m_hwnd, IDC_FRAMEGAPSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
+ SendDlgItemMessage(m_hwnd, IDC_FRAMEGAPSPIN, UDM_SETPOS, 0, (LPARAM)cfg::dat.gapBetweenFrames);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ BOOL translated;
+ BYTE windowStyle = (BYTE)SendDlgItemMessage(m_hwnd, IDC_BORDERSTYLE, CB_GETCURSEL, 0, 0);
+
+ db_set_b(0, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_FADEINOUT));
+ cfg::dat.fadeinout = IsDlgButtonChecked(m_hwnd, IDC_FADEINOUT) ? 1 : 0;
+ BYTE oldFading = cfg::dat.fadeinout;
+ cfg::dat.fadeinout = FALSE;
+
+ db_set_b(0, "CLUI", "WindowStyle", windowStyle);
+ cfg::dat.gapBetweenFrames = GetDlgItemInt(m_hwnd, IDC_FRAMEGAP, &translated, FALSE);
+
+ db_set_dw(0, "CLUIFrames", "GapBetweenFrames", cfg::dat.gapBetweenFrames);
+ g_plugin.setByte("OnTop", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_ONTOP));
+ SetWindowPos(g_clistApi.hwndContactList, IsDlgButtonChecked(m_hwnd, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+
+ cfg::dat.bCLeft = (BYTE)SendDlgItemMessage(m_hwnd, IDC_CLEFTSPIN, UDM_GETPOS, 0, 0);
+ cfg::dat.bCRight = (BYTE)SendDlgItemMessage(m_hwnd, IDC_CRIGHTSPIN, UDM_GETPOS, 0, 0);
+ cfg::dat.bCTop = (BYTE)SendDlgItemMessage(m_hwnd, IDC_CTOPSPIN, UDM_GETPOS, 0, 0);
+ cfg::dat.bCBottom = (BYTE)SendDlgItemMessage(m_hwnd, IDC_CBOTTOMSPIN, UDM_GETPOS, 0, 0);
+
+ db_set_dw(0, "CLUI", "clmargins", MAKELONG(MAKEWORD(cfg::dat.bCLeft, cfg::dat.bCRight), MAKEWORD(cfg::dat.bCTop, cfg::dat.bCBottom)));
+ SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
+
+ g_plugin.setByte("BringToFront", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_BRINGTOFRONT));
+ g_plugin.setByte("AlwaysHideOnTB", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_ALWAYSHIDEONTASKBAR));
+
+ if (windowStyle != SETTING_WINDOWSTYLE_DEFAULT) {
+ LONG style;
+ // 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
+ WINDOWPLACEMENT p;
+ p.length = sizeof(p);
+ GetWindowPlacement(g_clistApi.hwndContactList, &p);
+ ShowWindow(g_clistApi.hwndContactList, SW_HIDE);
+
+ style = GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE);
+ style |= WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE;
+ style &= ~WS_EX_APPWINDOW;
+ SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, style);
+
+ SetWindowPlacement(g_clistApi.hwndContactList, &p);
+ ShowWindow(g_clistApi.hwndContactList, SW_SHOW);
+ }
+ else {
+ LONG style;
+ style = GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE);
+ style &= ~(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE);
+ if (g_plugin.getByte("AlwaysHideOnTB", 1))
+ style &= ~WS_EX_APPWINDOW;
+ else {
+ style |= WS_EX_APPWINDOW;
+ AddToTaskBar(g_clistApi.hwndContactList);
}
- break;
+ SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, style);
}
- break;
+
+ cfg::dat.bClipBorder = (BYTE)GetDlgItemInt(m_hwnd, IDC_CLIPBORDER, &translated, FALSE);
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ db_set_b(0, "CLUI", "clipborder", cfg::dat.bClipBorder);
+
+ db_set_b(0, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWMAINMENU));
+ db_set_b(0, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_CLIENTDRAG));
+
+ ApplyCLUIBorderStyle();
+
+ if (BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_SHOWMAINMENU))
+ SetMenu(g_clistApi.hwndContactList, nullptr);
+ else
+ SetMenu(g_clistApi.hwndContactList, g_clistApi.hMenuMain);
+
+ wchar_t title[256];
+ GetDlgItemText(m_hwnd, IDC_TITLETEXT, title, _countof(title));
+ g_plugin.setWString("TitleText", title);
+ SetWindowText(g_clistApi.hwndContactList, title);
+
+ cfg::dat.dwFlags = IsDlgButtonChecked(m_hwnd, IDC_ROUNDEDBORDER) ? cfg::dat.dwFlags | CLUI_FRAME_ROUNDEDFRAME : cfg::dat.dwFlags & ~CLUI_FRAME_ROUNDEDFRAME;
+ db_set_b(0, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZE));
+
+ if ((cfg::dat.autosize = IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZE) ? 1 : 0)) {
+ SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
+ SendMessage(g_clistApi.hwndContactTree, WM_SIZE, 0, 0);
+ }
+
+ db_set_b(0, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(m_hwnd, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
+ db_set_b(0, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZEUPWARD));
+ g_plugin.setByte("AutoHide", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_AUTOHIDE));
+ g_plugin.setWord("HideTime", (WORD)SendDlgItemMessage(m_hwnd, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
+
+ g_plugin.setByte("Transparent", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT));
+ cfg::dat.isTransparent = IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT) ? 1 : 0;
+ g_plugin.setByte("Alpha", (BYTE)SendDlgItemMessage(m_hwnd, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
+ cfg::dat.alpha = (BYTE)SendDlgItemMessage(m_hwnd, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0);
+ g_plugin.setByte("AutoAlpha", (BYTE)SendDlgItemMessage(m_hwnd, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
+ cfg::dat.autoalpha = (BYTE)SendDlgItemMessage(m_hwnd, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0);
+ g_plugin.setByte("WindowShadow", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_DROPSHADOW));
+ g_plugin.setByte("OnDesktop", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_ONDESKTOP));
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ cfg::dat.bFullTransparent = IsDlgButtonChecked(m_hwnd, IDC_FULLTRANSPARENT) ? 1 : 0;
+ db_set_b(0, "CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent);
+
+ if (cfg::dat.bLayeredHack)
+ SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
+
+ if (g_CLUISkinnedBkColorRGB)
+ cfg::dat.colorkey = g_CLUISkinnedBkColorRGB;
+ else if (cfg::dat.bClipBorder == 0 && !(cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME))
+ cfg::dat.colorkey = db_get_dw(0, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ else {
+ SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
+ cfg::dat.colorkey = RGB(255, 0, 255);
+ }
+ if (cfg::dat.isTransparent || cfg::dat.bFullTransparent) {
+ SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
+ SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
+ SetLayeredWindowAttributes(g_clistApi.hwndContactList, 0, 255, LWA_ALPHA | LWA_COLORKEY);
+ SetLayeredWindowAttributes(g_clistApi.hwndContactList,
+ (COLORREF)(cfg::dat.bFullTransparent ? cfg::dat.colorkey : 0),
+ (BYTE)(cfg::dat.isTransparent ? cfg::dat.autoalpha : 255),
+ (DWORD)((cfg::dat.isTransparent ? LWA_ALPHA : 0L) | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0L)));
+ }
+ else {
+ SetLayeredWindowAttributes(g_clistApi.hwndContactList, RGB(0, 0, 0), (BYTE)255, LWA_ALPHA);
+ if (!cfg::dat.bLayeredHack)
+ SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
+ }
+
+ ConfigureCLUIGeometry(1);
+ ShowWindow(g_clistApi.hwndContactList, SW_SHOW);
+ SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
+ SetWindowPos(g_clistApi.hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ RedrawWindow(g_clistApi.hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ cfg::dat.fadeinout = oldFading;
+
+ Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
+ return true;
}
- return FALSE;
-}
+
+ void onChange_AutoHide(CCtrlCheck *)
+ {
+ Utils::enableDlgControl(m_hwnd, IDC_HIDETIME, IsDlgButtonChecked(m_hwnd, IDC_AUTOHIDE));
+ Utils::enableDlgControl(m_hwnd, IDC_HIDETIMESPIN, IsDlgButtonChecked(m_hwnd, IDC_AUTOHIDE));
+ Utils::enableDlgControl(m_hwnd, IDC_STATIC01, IsDlgButtonChecked(m_hwnd, IDC_AUTOHIDE));
+ }
+
+ void onChange_AutoSize(CCtrlCheck *)
+ {
+ Utils::enableDlgControl(m_hwnd, IDC_STATIC21, IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZE));
+ Utils::enableDlgControl(m_hwnd, IDC_STATIC22, IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZE));
+ Utils::enableDlgControl(m_hwnd, IDC_MAXSIZEHEIGHT, IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZE));
+ Utils::enableDlgControl(m_hwnd, IDC_MAXSIZESPIN, IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZE));
+ Utils::enableDlgControl(m_hwnd, IDC_AUTOSIZEUPWARD, IsDlgButtonChecked(m_hwnd, IDC_AUTOSIZE));
+ }
+
+ void onChange_Transparent(CCtrlCheck *)
+ {
+ Utils::enableDlgControl(m_hwnd, IDC_STATIC11, IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT));
+ Utils::enableDlgControl(m_hwnd, IDC_STATIC12, IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT));
+ Utils::enableDlgControl(m_hwnd, IDC_TRANSACTIVE, IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT));
+ Utils::enableDlgControl(m_hwnd, IDC_TRANSINACTIVE, IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT));
+ Utils::enableDlgControl(m_hwnd, IDC_ACTIVEPERC, IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT));
+ Utils::enableDlgControl(m_hwnd, IDC_INACTIVEPERC, IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENT));
+ }
+
+ void UpdateCounters()
+ {
+ char str[10];
+ mir_snprintf(str, "%d%%", 100 * SendDlgItemMessage(m_hwnd, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
+ SetDlgItemTextA(m_hwnd, IDC_INACTIVEPERC, str);
+ mir_snprintf(str, "%d%%", 100 * SendDlgItemMessage(m_hwnd, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
+ SetDlgItemTextA(m_hwnd, IDC_ACTIVEPERC, str);
+ }
+
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
+ {
+ if (msg == WM_HSCROLL)
+ UpdateCounters();
+
+ return CDlgBase::DlgProc(msg, wParam, lParam);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// "Background" options page
+
+class COptBackgroundDlg : public CRowItemsBaseDlg
+{
+ CCtrlCheck chkBitmap;
+ CCtrlButton btnBrowse;
+
+public:
+ COptBackgroundDlg() :
+ CRowItemsBaseDlg(IDD_OPT_CLCBKG),
+ chkBitmap(this, IDC_BITMAP),
+ btnBrowse(this, IDC_BROWSE)
+ {
+ chkBitmap.OnChange = Callback(this, &COptBackgroundDlg::onChange_Bitmap);
+
+ btnBrowse.OnClick = Callback(this, &COptBackgroundDlg::onClick_Browse);
+ }
+
+ bool OnInitDialog() override
+ {
+ chkBitmap.SetState(db_get_b(0, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP));
+ onChange_Bitmap(0);
+
+ CheckDlgButton(m_hwnd, IDC_WINCOLOUR, db_get_b(0, "CLC", "UseWinColours", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SKINMODE, cfg::dat.bWallpaperMode ? BST_CHECKED : BST_UNCHECKED);
+
+ DBVARIANT dbv;
+ if (!db_get_ws(0, "CLC", "BkBitmap", &dbv)) {
+ wchar_t szPath[MAX_PATH];
+ if (PathToAbsoluteW(dbv.pwszVal, szPath))
+ SetDlgItemText(m_hwnd, IDC_FILENAME, szPath);
+
+ db_free(&dbv);
+ }
+
+ WORD bmpUse = db_get_w(0, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
+ CheckDlgButton(m_hwnd, IDC_STRETCHH, bmpUse & CLB_STRETCHH ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_STRETCHV, bmpUse & CLB_STRETCHV ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_TILEH, bmpUse & CLBF_TILEH ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_TILEV, bmpUse & CLBF_TILEV ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SCROLL, bmpUse & CLBF_SCROLL ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_PROPORTIONAL, bmpUse & CLBF_PROPORTIONAL ? BST_CHECKED : BST_UNCHECKED);
+
+ SHAutoComplete(GetDlgItem(m_hwnd, IDC_FILENAME), 1);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ db_set_b(0, "CLC", "UseBitmap", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_BITMAP));
+ db_set_b(0, "CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_WINCOLOUR));
+
+ char str[MAX_PATH], strrel[MAX_PATH];
+ GetDlgItemTextA(m_hwnd, IDC_FILENAME, str, _countof(str));
+ if (PathToRelative(str, strrel))
+ db_set_s(0, "CLC", "BkBitmap", strrel);
+ else
+ db_set_s(0, "CLC", "BkBitmap", str);
+
+ WORD flags = 0;
+ if (IsDlgButtonChecked(m_hwnd, IDC_STRETCHH))
+ flags |= CLB_STRETCHH;
+ if (IsDlgButtonChecked(m_hwnd, IDC_STRETCHV))
+ flags |= CLB_STRETCHV;
+ if (IsDlgButtonChecked(m_hwnd, IDC_TILEH))
+ flags |= CLBF_TILEH;
+ if (IsDlgButtonChecked(m_hwnd, IDC_TILEV))
+ flags |= CLBF_TILEV;
+ if (IsDlgButtonChecked(m_hwnd, IDC_SCROLL))
+ flags |= CLBF_SCROLL;
+ if (IsDlgButtonChecked(m_hwnd, IDC_PROPORTIONAL))
+ flags |= CLBF_PROPORTIONAL;
+ db_set_w(0, "CLC", "BkBmpUse", flags);
+ cfg::dat.bWallpaperMode = IsDlgButtonChecked(m_hwnd, IDC_SKINMODE) ? 1 : 0;
+ db_set_b(0, "CLUI", "UseBkSkin", (BYTE)cfg::dat.bWallpaperMode);
+ return true;
+ }
+
+ void onChange_Bitmap(CCtrlCheck *)
+ {
+ bool bEnabled = chkBitmap.GetState();
+ Utils::enableDlgControl(m_hwnd, IDC_FILENAME, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_BROWSE, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_STRETCHH, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_STRETCHV, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_TILEH, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_TILEV, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_SCROLL, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_PROPORTIONAL, bEnabled);
+ }
+
+ void onClick_Browse(CCtrlButton *)
+ {
+ wchar_t str[MAX_PATH], filter[512];
+ GetDlgItemText(m_hwnd, IDC_FILENAME, str, _countof(str));
+ Bitmap_GetFilter(filter, _countof(filter));
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = m_hwnd;
+ ofn.hInstance = nullptr;
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = str;
+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
+ ofn.nMaxFile = _countof(str);
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.lpstrDefExt = L"bmp";
+ if (GetOpenFileName(&ofn))
+ SetDlgItemText(m_hwnd, IDC_FILENAME, str);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class COptStatusDlg : public CRowItemsBaseDlg
+{
+ CCtrlCheck chkShowSbar;
+
+public:
+ COptStatusDlg() :
+ CRowItemsBaseDlg(IDD_OPT_SBAR),
+ chkShowSbar(this, IDC_SHOWSBAR)
+ {
+ chkShowSbar.OnChange = Callback(this, &COptStatusDlg::onChange_Show);
+ }
+
+ bool OnInitDialog() override
+ {
+ chkShowSbar.SetState(db_get_b(0, "CLUI", "ShowSBar", 1));
+ onChange_Show(0);
+
+ BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
+ CheckDlgButton(m_hwnd, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(m_hwnd, IDC_RIGHTSTATUS, db_get_b(0, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_RIGHTMIRANDA, BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_EQUALSECTIONS, cfg::dat.bEqualSections ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SBPANELBEVEL, db_get_b(0, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWGRIP, db_get_b(0, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SKINBACKGROUND, cfg::dat.bSkinnedStatusBar ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWXSTATUS, cfg::dat.bShowXStatusOnSbar ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_MARKLOCKED, db_get_b(0, "CLUI", "sbar_showlocked", 1) ? BST_CHECKED : BST_UNCHECKED);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ db_set_b(0, "CLUI", "ShowSBar", (BYTE)chkShowSbar.GetState());
+ db_set_b(0, "CLUI", "SBarShow", (BYTE)((IsDlgButtonChecked(m_hwnd, IDC_SHOWICON) ? 1 : 0) | (IsDlgButtonChecked(m_hwnd, IDC_SHOWPROTO) ? 2 : 0) | (IsDlgButtonChecked(m_hwnd, IDC_SHOWSTATUS) ? 4 : 0)));
+ db_set_b(0, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_RIGHTMIRANDA));
+ db_set_b(0, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_EQUALSECTIONS));
+ db_set_b(0, "CLUI", "sb_skinned", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SKINBACKGROUND));
+ db_set_b(0, "CLUI", "sbar_showlocked", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_MARKLOCKED));
+
+ cfg::dat.bEqualSections = IsDlgButtonChecked(m_hwnd, IDC_EQUALSECTIONS) ? 1 : 0;
+ cfg::dat.bSkinnedStatusBar = IsDlgButtonChecked(m_hwnd, IDC_SKINBACKGROUND) ? 1 : 0;
+ cfg::dat.bShowXStatusOnSbar = IsDlgButtonChecked(m_hwnd, IDC_SHOWXSTATUS) ? 1 : 0;
+ db_set_b(0, "CLUI", "xstatus_sbar", (BYTE)cfg::dat.bShowXStatusOnSbar);
+ db_set_b(0, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SBPANELBEVEL));
+ if (db_get_b(0, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWGRIP)) {
+ db_set_b(0, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWGRIP));
+ ShowWindow(g_clistApi.hwndStatus, SW_HIDE);
+ mir_unsubclassWindow(g_clistApi.hwndStatus, NewStatusBarWndProc);
+ DestroyWindow(g_clistApi.hwndStatus);
+
+ int flags = WS_CHILD | CCS_BOTTOM;
+ flags |= db_get_b(0, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
+ flags |= db_get_b(0, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
+
+ HWND parent = GetParent(g_clistApi.hwndStatus);
+ g_clistApi.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
+ mir_subclassWindow(g_clistApi.hwndStatus, NewStatusBarWndProc);
+ }
+ if (chkShowSbar.GetState()) {
+ ShowWindow(g_clistApi.hwndStatus, SW_SHOW);
+ SendMessage(g_clistApi.hwndStatus, WM_SIZE, 0, 0);
+ cfg::dat.dwFlags |= CLUI_FRAME_SBARSHOW;
+ }
+ else {
+ ShowWindow(g_clistApi.hwndStatus, SW_HIDE);
+ cfg::dat.dwFlags &= ~CLUI_FRAME_SBARSHOW;
+ }
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ ConfigureCLUIGeometry(1);
+ SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
+ CluiProtocolStatusChanged(0, nullptr);
+ return true;
+ }
+
+ void onChange_Show(CCtrlCheck *)
+ {
+ bool bEnabled = chkShowSbar.GetState();
+ Utils::enableDlgControl(m_hwnd, IDC_SHOWICON, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_SHOWPROTO, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_SHOWSTATUS, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_RIGHTSTATUS, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_RIGHTMIRANDA, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_EQUALSECTIONS, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_SBPANELBEVEL, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_SHOWGRIP, bEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_SKINBACKGROUND, bEnabled);
+ }
+};
+
+void InitClistOptions(WPARAM wParam)
+{
+ // Main options tabs
+ OPTIONSDIALOGPAGE odp = {};
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.szTitle.a = LPGEN("Contact list");
+
+ odp.szTab.a = LPGEN("General");
+ odp.pDialog = new COptGeneralDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.a = LPGEN("List layout");
+ odp.pDialog = new COptLayoutDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.a = LPGEN("Window");
+ odp.pDialog = new COptWindowDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.a = LPGEN("Background");
+ odp.pDialog = new COptBackgroundDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.a = LPGEN("Status bar");
+ odp.pDialog = new COptStatusDlg();
+ g_plugin.addOptions(wParam, &odp);
+}
\ No newline at end of file diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 60bb1e0a8d..d2503494d1 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -24,394 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-extern COLORREF g_CLUISkinnedBkColorRGB;
-
-static int opt_clui_changed = 0;
-
-void AddToTaskBar(HWND hWnd);
-
-INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- opt_clui_changed = 0;
- CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, g_plugin.getByte("BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSHIDEONTASKBAR, g_plugin.getByte("AlwaysHideOnTB", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTOP, g_plugin.getByte("OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_FADEINOUT, cfg::dat.fadeinout ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOSIZE, cfg::dat.autosize ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DROPSHADOW, g_plugin.getByte("WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONDESKTOP, g_plugin.getByte("OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Title bar"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tool Window"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Thin border"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("No border"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_SETCURSEL, db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW), 0);
-
- SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "MaxSizeHeight", 75));
-
- SendDlgItemMessage(hwndDlg, IDC_CLIPBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
- SendDlgItemMessage(hwndDlg, IDC_CLIPBORDERSPIN, UDM_SETPOS, 0, cfg::dat.bClipBorder);
-
- SendDlgItemMessage(hwndDlg, IDC_CLEFTSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
- SendDlgItemMessage(hwndDlg, IDC_CRIGHTSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
- SendDlgItemMessage(hwndDlg, IDC_CTOPSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
- SendDlgItemMessage(hwndDlg, IDC_CBOTTOMSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
-
- SendDlgItemMessage(hwndDlg, IDC_CLEFTSPIN, UDM_SETPOS, 0, cfg::dat.bCLeft - (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? 3 : 0));
- SendDlgItemMessage(hwndDlg, IDC_CRIGHTSPIN, UDM_SETPOS, 0, cfg::dat.bCRight - (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? 3 : 0));
- SendDlgItemMessage(hwndDlg, IDC_CTOPSPIN, UDM_SETPOS, 0, cfg::dat.bCTop);
- SendDlgItemMessage(hwndDlg, IDC_CBOTTOMSPIN, UDM_SETPOS, 0, cfg::dat.bCBottom);
-
- CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(0, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOHIDE, g_plugin.getByte("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(g_plugin.getWord("HideTime", SETTING_HIDETIME_DEFAULT), 0));
- Utils::enableDlgControl(hwndDlg, IDC_HIDETIME, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- Utils::enableDlgControl(hwndDlg, IDC_HIDETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- Utils::enableDlgControl(hwndDlg, IDC_STATIC01, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)) {
- Utils::enableDlgControl(hwndDlg, IDC_STATIC21, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_STATIC22, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_MAXSIZEHEIGHT, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_MAXSIZESPIN, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_AUTOSIZEUPWARD, FALSE);
- }
- {
- ptrW tszTitle(g_plugin.getWStringA("TitleText"));
- if (tszTitle != NULL)
- SetDlgItemText(hwndDlg, IDC_TITLETEXT, tszTitle);
- else
- SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
- }
- CheckDlgButton(hwndDlg, IDC_TRANSPARENT, cfg::dat.isTransparent ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_FULLTRANSPARENT, cfg::dat.bFullTransparent ? BST_CHECKED : BST_UNCHECKED);
-
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
- Utils::enableDlgControl(hwndDlg, IDC_STATIC11, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_STATIC12, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TRANSACTIVE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_TRANSINACTIVE, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_ACTIVEPERC, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_INACTIVEPERC, FALSE);
- }
- SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
- SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
- SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, cfg::dat.alpha);
- SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, cfg::dat.autoalpha);
- SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0);
-
- CheckDlgButton(hwndDlg, IDC_ROUNDEDBORDER, cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_FRAMEGAPSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
- SendDlgItemMessage(hwndDlg, IDC_FRAMEGAPSPIN, UDM_SETPOS, 0, (LPARAM)cfg::dat.gapBetweenFrames);
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_AUTOHIDE) {
- Utils::enableDlgControl(hwndDlg, IDC_HIDETIME, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- Utils::enableDlgControl(hwndDlg, IDC_HIDETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- Utils::enableDlgControl(hwndDlg, IDC_STATIC01, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- }
- else if (LOWORD(wParam) == IDC_TRANSPARENT) {
- Utils::enableDlgControl(hwndDlg, IDC_STATIC11, IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- Utils::enableDlgControl(hwndDlg, IDC_STATIC12, IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- Utils::enableDlgControl(hwndDlg, IDC_TRANSACTIVE, IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- Utils::enableDlgControl(hwndDlg, IDC_TRANSINACTIVE, IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- Utils::enableDlgControl(hwndDlg, IDC_ACTIVEPERC, IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- Utils::enableDlgControl(hwndDlg, IDC_INACTIVEPERC, IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- }
- else if (LOWORD(wParam) == IDC_AUTOSIZE) {
- Utils::enableDlgControl(hwndDlg, IDC_STATIC21, IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- Utils::enableDlgControl(hwndDlg, IDC_STATIC22, IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- Utils::enableDlgControl(hwndDlg, IDC_MAXSIZEHEIGHT, IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- Utils::enableDlgControl(hwndDlg, IDC_MAXSIZESPIN, IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- Utils::enableDlgControl(hwndDlg, IDC_AUTOSIZEUPWARD, IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- }
- if ((LOWORD(wParam) == IDC_FRAMEGAP || LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CLIPBORDER || LOWORD(wParam) == IDC_TITLETEXT ||
- LOWORD(wParam) == IDC_MAXSIZEHEIGHT || LOWORD(wParam) == IDC_CLEFT || LOWORD(wParam) == IDC_CRIGHT || LOWORD(wParam) == IDC_CTOP
- || LOWORD(wParam) == IDC_CBOTTOM) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
- if (LOWORD(wParam) == IDC_BORDERSTYLE && (HIWORD(wParam) != CBN_SELCHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- opt_clui_changed = 1;
- break;
-
- case WM_HSCROLL:
- {
- char str[10];
- mir_snprintf(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255);
- SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str);
- mir_snprintf(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255);
- SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str);
- }
- if (wParam != 0x12345678) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- opt_clui_changed = 1;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- BOOL translated;
- BYTE oldFading;
- BYTE windowStyle = (BYTE)SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_GETCURSEL, 0, 0);
-
- if (!opt_clui_changed)
- return TRUE;
-
- db_set_b(0, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
- cfg::dat.fadeinout = IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT) ? 1 : 0;
- oldFading = cfg::dat.fadeinout;
- cfg::dat.fadeinout = FALSE;
-
- db_set_b(0, "CLUI", "WindowStyle", windowStyle);
- cfg::dat.gapBetweenFrames = GetDlgItemInt(hwndDlg, IDC_FRAMEGAP, &translated, FALSE);
-
- db_set_dw(0, "CLUIFrames", "GapBetweenFrames", cfg::dat.gapBetweenFrames);
- g_plugin.setByte("OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
- SetWindowPos(g_clistApi.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-
- cfg::dat.bCLeft = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLEFTSPIN, UDM_GETPOS, 0, 0);
- cfg::dat.bCRight = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CRIGHTSPIN, UDM_GETPOS, 0, 0);
- cfg::dat.bCTop = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CTOPSPIN, UDM_GETPOS, 0, 0);
- cfg::dat.bCBottom = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CBOTTOMSPIN, UDM_GETPOS, 0, 0);
-
- db_set_dw(0, "CLUI", "clmargins", MAKELONG(MAKEWORD(cfg::dat.bCLeft, cfg::dat.bCRight), MAKEWORD(cfg::dat.bCTop, cfg::dat.bCBottom)));
- SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
-
- g_plugin.setByte("BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
- g_plugin.setByte("AlwaysHideOnTB", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSHIDEONTASKBAR));
-
- if (windowStyle != SETTING_WINDOWSTYLE_DEFAULT) {
- LONG style;
- // 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
- WINDOWPLACEMENT p;
- p.length = sizeof(p);
- GetWindowPlacement(g_clistApi.hwndContactList, &p);
- ShowWindow(g_clistApi.hwndContactList, SW_HIDE);
-
- style = GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE);
- style |= WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE;
- style &= ~WS_EX_APPWINDOW;
- SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, style);
-
- SetWindowPlacement(g_clistApi.hwndContactList, &p);
- ShowWindow(g_clistApi.hwndContactList, SW_SHOW);
- }
- else {
- LONG style;
- style = GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE);
- style &= ~(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE);
- if (g_plugin.getByte("AlwaysHideOnTB", 1))
- style &= ~WS_EX_APPWINDOW;
- else {
- style |= WS_EX_APPWINDOW;
- AddToTaskBar(g_clistApi.hwndContactList);
- }
- SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, style);
- }
-
- cfg::dat.bClipBorder = (BYTE)GetDlgItemInt(hwndDlg, IDC_CLIPBORDER, &translated, FALSE);
- db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
- db_set_b(0, "CLUI", "clipborder", cfg::dat.bClipBorder);
-
- db_set_b(0, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
- db_set_b(0, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
-
- ApplyCLUIBorderStyle();
-
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU))
- SetMenu(g_clistApi.hwndContactList, nullptr);
- else
- SetMenu(g_clistApi.hwndContactList, g_clistApi.hMenuMain);
-
- wchar_t title[256];
- GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
- g_plugin.setWString("TitleText", title);
- SetWindowText(g_clistApi.hwndContactList, title);
-
- cfg::dat.dwFlags = IsDlgButtonChecked(hwndDlg, IDC_ROUNDEDBORDER) ? cfg::dat.dwFlags | CLUI_FRAME_ROUNDEDFRAME : cfg::dat.dwFlags & ~CLUI_FRAME_ROUNDEDFRAME;
- db_set_b(0, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
-
- if ((cfg::dat.autosize = IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE) ? 1 : 0)) {
- SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
- SendMessage(g_clistApi.hwndContactTree, WM_SIZE, 0, 0);
- }
-
- db_set_b(0, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
- db_set_b(0, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
- g_plugin.setByte("AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- g_plugin.setWord("HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
-
- g_plugin.setByte("Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- cfg::dat.isTransparent = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT) ? 1 : 0;
- g_plugin.setByte("Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
- cfg::dat.alpha = (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0);
- g_plugin.setByte("AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
- cfg::dat.autoalpha = (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0);
- g_plugin.setByte("WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
- g_plugin.setByte("OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
- db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
- cfg::dat.bFullTransparent = IsDlgButtonChecked(hwndDlg, IDC_FULLTRANSPARENT) ? 1 : 0;
- db_set_b(0, "CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent);
-
- if (cfg::dat.bLayeredHack)
- SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
-
- if (g_CLUISkinnedBkColorRGB)
- cfg::dat.colorkey = g_CLUISkinnedBkColorRGB;
- else if (cfg::dat.bClipBorder == 0 && !(cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME))
- cfg::dat.colorkey = db_get_dw(0, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
- else {
- SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
- cfg::dat.colorkey = RGB(255, 0, 255);
- }
- if (cfg::dat.isTransparent || cfg::dat.bFullTransparent) {
- SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
- SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
- SetLayeredWindowAttributes(g_clistApi.hwndContactList, 0, 255, LWA_ALPHA | LWA_COLORKEY);
- SetLayeredWindowAttributes(g_clistApi.hwndContactList,
- (COLORREF)(cfg::dat.bFullTransparent ? cfg::dat.colorkey : 0),
- (BYTE)(cfg::dat.isTransparent ? cfg::dat.autoalpha : 255),
- (DWORD)((cfg::dat.isTransparent ? LWA_ALPHA : 0L) | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0L)));
- }
- else {
- SetLayeredWindowAttributes(g_clistApi.hwndContactList, RGB(0, 0, 0), (BYTE)255, LWA_ALPHA);
- if (!cfg::dat.bLayeredHack)
- SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
- }
-
- ConfigureCLUIGeometry(1);
- ShowWindow(g_clistApi.hwndContactList, SW_SHOW);
- SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
- SetWindowPos(g_clistApi.hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
- RedrawWindow(g_clistApi.hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
- cfg::dat.fadeinout = oldFading;
- opt_clui_changed = 0;
-
- Clist_ClcOptionsChanged();
- Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-static int opt_sbar_changed = 0;
-
-INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- opt_sbar_changed = 0;
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(0, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED); {
- BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
- CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED);
- }
- CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(0, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, cfg::dat.bEqualSections ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(0, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(0, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SKINBACKGROUND, cfg::dat.bSkinnedStatusBar ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWXSTATUS, cfg::dat.bShowXStatusOnSbar ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MARKLOCKED, db_get_b(0, "CLUI", "sbar_showlocked", 1) ? BST_CHECKED : BST_UNCHECKED);
-
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
- Utils::enableDlgControl(hwndDlg, IDC_SHOWICON, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_SHOWPROTO, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_SHOWSTATUS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_RIGHTSTATUS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_RIGHTMIRANDA, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_EQUALSECTIONS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_SBPANELBEVEL, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_SHOWGRIP, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_SKINBACKGROUND, FALSE);
- }
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_SHOWSBAR) {
- Utils::enableDlgControl(hwndDlg, IDC_SHOWICON, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_SHOWPROTO, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_SHOWSTATUS, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_RIGHTSTATUS, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_RIGHTMIRANDA, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_EQUALSECTIONS, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_SBPANELBEVEL, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_SHOWGRIP, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- Utils::enableDlgControl(hwndDlg, IDC_SKINBACKGROUND, IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- opt_sbar_changed = 1;
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- if (!opt_sbar_changed)
- return TRUE;
-
- db_set_b(0, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- db_set_b(0, "CLUI", "SBarShow", (BYTE)((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0)));
- db_set_b(0, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
- db_set_b(0, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
- db_set_b(0, "CLUI", "sb_skinned", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SKINBACKGROUND));
- db_set_b(0, "CLUI", "sbar_showlocked", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MARKLOCKED));
-
- cfg::dat.bEqualSections = IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS) ? 1 : 0;
- cfg::dat.bSkinnedStatusBar = IsDlgButtonChecked(hwndDlg, IDC_SKINBACKGROUND) ? 1 : 0;
- cfg::dat.bShowXStatusOnSbar = IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) ? 1 : 0;
- db_set_b(0, "CLUI", "xstatus_sbar", (BYTE)cfg::dat.bShowXStatusOnSbar);
- db_set_b(0, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
- if (db_get_b(0, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
- HWND parent = GetParent(g_clistApi.hwndStatus);
- int flags = WS_CHILD | CCS_BOTTOM;
- db_set_b(0, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
- ShowWindow(g_clistApi.hwndStatus, SW_HIDE);
- mir_unsubclassWindow(g_clistApi.hwndStatus, NewStatusBarWndProc);
- DestroyWindow(g_clistApi.hwndStatus);
-
- flags |= db_get_b(0, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
- flags |= db_get_b(0, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
-
- g_clistApi.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
- mir_subclassWindow(g_clistApi.hwndStatus, NewStatusBarWndProc);
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
- ShowWindow(g_clistApi.hwndStatus, SW_SHOW);
- SendMessage(g_clistApi.hwndStatus, WM_SIZE, 0, 0);
- cfg::dat.dwFlags |= CLUI_FRAME_SBARSHOW;
- }
- else {
- ShowWindow(g_clistApi.hwndStatus, SW_HIDE);
- cfg::dat.dwFlags &= ~CLUI_FRAME_SBARSHOW;
- }
- db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
- ConfigureCLUIGeometry(1);
- SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
- CluiProtocolStatusChanged(0, nullptr);
- PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
- opt_sbar_changed = 0;
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
DWORD GetCLUIWindowStyle(BYTE style)
{
DWORD dwBasic = WS_CLIPCHILDREN;
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index caa585af14..4bc4100332 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -260,6 +260,45 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto) return nullptr;
}
+int CoolSB_SetupScrollBar()
+{
+ /*
+ * a skinned scrollbar is only valid when ALL items are skinned with image items
+ * and no item is set to ignored
+ */
+
+ cfg::dat.bSkinnedScrollbar = !arStatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->IGNORED &&
+ !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->IGNORED;
+
+ if (!arStatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->imageItem ||
+ !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->imageItem)
+ cfg::dat.bSkinnedScrollbar = FALSE;
+
+ if (db_get_b(0, "CLC", "NoVScrollBar", 0)) {
+ UninitializeCoolSB(g_clistApi.hwndContactTree);
+ return 0;
+ }
+
+ if (cfg::dat.bSkinnedScrollbar) {
+ InitializeCoolSB(g_clistApi.hwndContactTree);
+ CoolSB_SetStyle(g_clistApi.hwndContactTree, SB_VERT, CSBS_HOTTRACKED);
+ }
+ else UninitializeCoolSB(g_clistApi.hwndContactTree);
+ return 0;
+}
+
// fills the struct with the settings in the database
void LoadExtBkSettingsFromDB()
{
@@ -1611,7 +1650,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L return FALSE;
}
-INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int iInit = TRUE;
static HWND hwndSkinEdit = nullptr;
@@ -1753,41 +1792,13 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return FALSE;
}
-int CoolSB_SetupScrollBar()
+void InitSkinOptions(WPARAM wParam)
{
- /*
- * a skinned scrollbar is only valid when ALL items are skinned with image items
- * and no item is set to ignored
- */
-
- cfg::dat.bSkinnedScrollbar = !arStatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE]->IGNORED &&
- !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->IGNORED &&
- !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->IGNORED &&
- !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->IGNORED &&
- !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->IGNORED &&
- !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->IGNORED &&
- !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->IGNORED &&
- !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->IGNORED;
-
- if (!arStatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE]->imageItem ||
- !arStatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE]->imageItem ||
- !arStatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE]->imageItem ||
- !arStatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE]->imageItem ||
- !arStatusItems[ID_EXTBKSCROLLTHUMBPRESSED - ID_STATUS_OFFLINE]->imageItem ||
- !arStatusItems[ID_EXTBKSCROLLBUTTON - ID_STATUS_OFFLINE]->imageItem ||
- !arStatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE]->imageItem ||
- !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->imageItem)
- cfg::dat.bSkinnedScrollbar = FALSE;
-
- if (db_get_b(0, "CLC", "NoVScrollBar", 0)) {
- UninitializeCoolSB(g_clistApi.hwndContactTree);
- return 0;
- }
-
- if (cfg::dat.bSkinnedScrollbar) {
- InitializeCoolSB(g_clistApi.hwndContactTree);
- CoolSB_SetStyle(g_clistApi.hwndContactTree, SB_VERT, CSBS_HOTTRACKED);
- }
- else UninitializeCoolSB(g_clistApi.hwndContactTree);
- return 0;
+ OPTIONSDIALOGPAGE odp = {};
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.szGroup.a = LPGEN("Skins");
+ odp.szTitle.a = LPGEN("Contact list");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
+ odp.pfnDlgProc = OptionsDlgProc;
+ g_plugin.addOptions(wParam, &odp);
}
diff --git a/plugins/Clist_nicer/src/stdafx.h b/plugins/Clist_nicer/src/stdafx.h index 500cd55558..bb5b1dec12 100644 --- a/plugins/Clist_nicer/src/stdafx.h +++ b/plugins/Clist_nicer/src/stdafx.h @@ -96,3 +96,22 @@ BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem); void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor2, BOOL transparent, BYTE FLG_GRADIENT, BYTE FLG_CORNER, DWORD BORDERSTYLE, ImageItem *item);
void CustomizeButton(HWND hWnd, bool bIsSkinned, bool bIsThemed, bool bIsFlat = false, bool bIsTTButton = false);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Base class for Clist Nicer options
+
+class CRowItemsBaseDlg : public CDlgBase
+{
+ void OnFinish(CDlgBase *)
+ {
+ Clist_ClcOptionsChanged();
+ PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
+ }
+
+public:
+ CRowItemsBaseDlg(int iDlg) :
+ CDlgBase(g_plugin, iDlg)
+ {
+ m_OnFinishWizard = Callback(this, &CRowItemsBaseDlg::OnFinish);
+ }
+};
|