From a63f23128ea8468ec01e99976d046af8c6dfa807 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 12 Jul 2012 16:55:11 +0000 Subject: customized toolbars: initial settings git-svn-id: http://svn.miranda-ng.org/main/trunk@929 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/modern_toolbar.cpp | 6 +++--- plugins/Clist_nicer/INCLUDE/clc.h | 1 + plugins/Clist_nicer/SRC/CLCButton.cpp | 30 +++++++++++++++++++++++------- plugins/Clist_nicer/SRC/clc.cpp | 4 ++-- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/plugins/Clist_modern/modern_toolbar.cpp b/plugins/Clist_modern/modern_toolbar.cpp index 33776eacd3..92a46dcd46 100644 --- a/plugins/Clist_modern/modern_toolbar.cpp +++ b/plugins/Clist_modern/modern_toolbar.cpp @@ -57,10 +57,10 @@ static void SetButtonPressed(int i, int state) static int Modern_InitButtons(WPARAM, LPARAM) { - TTBButton tbb = { 0 }; - tbb.cbSize = sizeof(tbb); - for (int i=0; i < SIZEOF(BTNS); i++) { + TTBButton tbb = { 0 }; + tbb.cbSize = sizeof(tbb); + if (BTNS[i].pszButtonID) { tbb.name = LPGEN(BTNS[i].pszButtonID); tbb.pszService = BTNS[i].pszServiceName; diff --git a/plugins/Clist_nicer/INCLUDE/clc.h b/plugins/Clist_nicer/INCLUDE/clc.h index 7a78e52564..eedb76fc43 100644 --- a/plugins/Clist_nicer/INCLUDE/clc.h +++ b/plugins/Clist_nicer/INCLUDE/clc.h @@ -540,6 +540,7 @@ void ReloadExtraInfo(HANDLE hContact); void LoadAvatarForContact(struct ClcContact *p); void ApplyViewMode(const char *name); DWORD CalcXMask(HANDLE hContact); +void ClcSetButtonState(int ctrlId, int status); //clcpaint.c void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint); diff --git a/plugins/Clist_nicer/SRC/CLCButton.cpp b/plugins/Clist_nicer/SRC/CLCButton.cpp index 1b917fea47..2af22400ce 100644 --- a/plugins/Clist_nicer/SRC/CLCButton.cpp +++ b/plugins/Clist_nicer/SRC/CLCButton.cpp @@ -51,14 +51,16 @@ static int g_index = -1; static int InitDefaultButtons(WPARAM, LPARAM) { - TTBButton tbb = { 0 }; - tbb.cbSize = sizeof(tbb); - for (int i=0; i < SIZEOF(BTNS); i++ ) { + TTBButton tbb = { 0 }; + tbb.cbSize = sizeof(tbb); + g_index = i; if (BTNS[i].pszButtonID) { + if ( !BTNS[i].isPush) + tbb.dwFlags |= TTBBF_ASPUSHBUTTON; + tbb.pszTooltipUp = tbb.name = LPGEN(BTNS[i].pszButtonName); - tbb.pszService = BTNS[i].pszButtonID; tbb.hIconHandleUp = Skin_GetIconHandle(BTNS[i].pszButtonID); if (BTNS[i].pszButtonDn) tbb.hIconHandleUp = Skin_GetIconHandle(BTNS[i].pszButtonDn); @@ -69,9 +71,22 @@ static int InitDefaultButtons(WPARAM, LPARAM) BTNS[i].hButton = TopToolbar_AddButton(&tbb); } g_index = -1; + + ClcSetButtonState(IDC_TBHIDEOFFLINE, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); + ClcSetButtonState(IDC_TBHIDEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)); + ClcSetButtonState(IDC_TBSOUND, db_get_b(NULL, "Skin", "UseSound", 1)); return 1; } +void ClcSetButtonState(int ctrlid, int status) +{ + for (int i=0; i < SIZEOF(BTNS); i++) + if (BTNS[i].ctrlid == ctrlid) { + CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)BTNS[i].hButton, status ? TTBST_PUSHED : TTBST_RELEASED); + break; + } +} + ///////////////////////////////////////////////////////////////////////////////////////// struct MButtonExtension : public MButtonCtrl @@ -421,6 +436,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case WM_LBUTTONDOWN: + if (!bct->iCtrlID) return 0; if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) { bct->stateId = PBS_PRESSED; InvalidateRect(bct->hwnd, NULL, TRUE); @@ -433,6 +449,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR return 1; case WM_LBUTTONUP: + if (!bct->iCtrlID) return 0; if (bct->bIsPushBtn) bct->bIsPushed = !bct->bIsPushed; @@ -467,10 +484,9 @@ static void SetButtonAsCustom(HWND hWnd) static LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) { + if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) SendMessage(pcli->hwndContactList, msg, wParam, lParam); - return 1; - } + return 0; } diff --git a/plugins/Clist_nicer/SRC/clc.cpp b/plugins/Clist_nicer/SRC/clc.cpp index 7d6ce337f3..b63a77a7bb 100644 --- a/plugins/Clist_nicer/SRC/clc.cpp +++ b/plugins/Clist_nicer/SRC/clc.cpp @@ -169,8 +169,8 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, wParam, lParam); } if (!__strcmp(cws->szSetting, "UseSound")) { - cfg::dat.soundsOff = cfg::getByte(cws->szModule, cws->szSetting, 0) ? 0 : 1; - CheckDlgButton(pcli->hwndContactList, IDC_TBSOUND, cfg::dat.soundsOff ? BST_UNCHECKED : BST_CHECKED); + cfg::dat.soundsOff = cws->value.bVal ? 0 : 1; + ClcSetButtonState(IDC_TBSOUND, cfg::dat.soundsOff); } } if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, cfg::dat.szMetaName) && !__strcmp(cws->szSetting, "IsSubcontact")) -- cgit v1.2.3