diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-12 16:55:11 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-12 16:55:11 +0000 |
commit | a63f23128ea8468ec01e99976d046af8c6dfa807 (patch) | |
tree | b7bf5e1188f98b47afaee73c0d3ba9a3f5a2e89f /plugins/Clist_nicer | |
parent | ec2d0c98145867ab68ab844a469fc26b3da9f820 (diff) |
customized toolbars: initial settings
git-svn-id: http://svn.miranda-ng.org/main/trunk@929 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r-- | plugins/Clist_nicer/INCLUDE/clc.h | 1 | ||||
-rw-r--r-- | plugins/Clist_nicer/SRC/CLCButton.cpp | 30 | ||||
-rw-r--r-- | plugins/Clist_nicer/SRC/clc.cpp | 4 |
3 files changed, 26 insertions, 9 deletions
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"))
|