From ab06f83a076ece3aba4a47a107203829b11974db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 13 Dec 2013 13:35:19 +0000 Subject: Tipper: new option for items to show only for particular type of contacts (all, contacts, chatrooms); version bump Useful for not showing last seen or status fields for chatrooms. git-svn-id: http://svn.miranda-ng.org/main/trunk@7174 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TipperYM/src/options.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'plugins/TipperYM/src/options.cpp') diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 6a8ee4e2c9..2d9c01ed4d 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -187,6 +187,8 @@ bool LoadDI(DISPLAYITEM *di, int index) db_free(&dbv); } + mir_snprintf(setting, SIZEOF(setting), "DIType%d", index); + di->type = (DisplayItemType)db_get_b(0, MODULE_ITEMS, setting, DIT_ALL); mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index); di->bLineAbove = (db_get_b(0, MODULE_ITEMS, setting, 0) == 1); mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index); @@ -219,6 +221,8 @@ void SaveDI(DISPLAYITEM *di, int index) db_set_s(0, MODULE_ITEMS, setting, buff); } + mir_snprintf(setting, SIZEOF(setting), "DIType%d", index); + db_set_b(0, MODULE_ITEMS, setting, (BYTE)di->type); mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index); db_set_b(0, MODULE_ITEMS, setting, di->bLineAbove ? 1 : 0); mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index); @@ -580,6 +584,14 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel); SetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue); + for (int i = 0; i < SIZEOF(displayItemTypes); i++) + { + int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateTS(displayItemTypes[i].title)); + SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETITEMDATA, index, (LPARAM)displayItemTypes[i].type); + if (displayItemTypes[i].type == di->type) + SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETCURSEL, index, 0); + } + CheckDlgButton(hwndDlg, IDC_CHK_LINEABOVE, di->bLineAbove ? TRUE : FALSE); CheckDlgButton(hwndDlg, IDC_CHK_VALNEWLINE, di->bValueNewline ? TRUE : FALSE); CheckDlgButton(hwndDlg, IDC_CHK_PARSETIPPERFIRST, di->bParseTipperVarsFirst ? TRUE : FALSE); @@ -603,11 +615,19 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel, LABEL_LEN); GetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue, VALUE_LEN); + int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETCURSEL, 0, 0); + int type = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETITEMDATA, sel, 0); + for (int i = 0; i < SIZEOF(displayItemTypes); i++) + { + if (displayItemTypes[i].type == type) + di->type = displayItemTypes[i].type; + } + di->bLineAbove = (IsDlgButtonChecked(hwndDlg, IDC_CHK_LINEABOVE) ? true : false); di->bValueNewline = (IsDlgButtonChecked(hwndDlg, IDC_CHK_VALNEWLINE) ? true : false); di->bParseTipperVarsFirst = (IsDlgButtonChecked(hwndDlg, IDC_CHK_PARSETIPPERFIRST) ? true : false); - int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0); + sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0); if (sel != CB_ERR) { TCHAR buff[256]; -- cgit v1.2.3