diff options
author | George Hazan <ghazan@miranda.im> | 2017-10-16 13:29:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-10-16 13:29:32 +0300 |
commit | 9d6b20ce1cfc010f9b9cc47d376dd0f01e290ca4 (patch) | |
tree | dd4c8561d6997ccf2186a748cdc867160c2053d4 /plugins | |
parent | 56239808326cc550d0b1bd45a368e89957e7021b (diff) |
StatusManager: atavism (manual options tab) in options removed
Diffstat (limited to 'plugins')
7 files changed, 84 insertions, 287 deletions
diff --git a/plugins/StatusManager/res/resource.rc b/plugins/StatusManager/res/resource.rc index 1b219ecf41..a3cafa0047 100644 --- a/plugins/StatusManager/res/resource.rc +++ b/plugins/StatusManager/res/resource.rc @@ -343,14 +343,6 @@ BEGIN CONTROL "In submenu",IDC_INSUBMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,169,47,119,10 END -IDD_OPT_TABS DIALOGEX 0, 0, 314, 250 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "Tab1",IDC_TABS,"SysTabControl32",0x0,3,4,306,242 -END - IDD_OPT_KS_ADV DIALOGEX 0, 0, 292, 224 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT @@ -459,11 +451,6 @@ BEGIN VERTGUIDE, 267 END - IDD_OPT_TABS, DIALOG - BEGIN - BOTTOMMARGIN, 248 - END - IDD_OPT_KS_ADV, DIALOG BEGIN VERTGUIDE, 11 diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp index 35834d4e75..f9b04fba79 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp @@ -19,7 +19,14 @@ #include "..\stdafx.h" -extern char *StatusModeToDbSetting(int status, const char *suffix); +struct AAMSGSETTING +{ + short useCustom; + int status; + char* msg; +}; + +char *StatusModeToDbSetting(int status, const char *suffix); void DisableDialog(HWND hwndDlg) { diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp index 58b79a22f0..3f48a7bee4 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp @@ -415,102 +415,6 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA } ///////////////////////////////////////////////////////////////////////////////////////// -// Tab window procedure - -static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - { - RECT rcTabs, rcOptions, rcPage; - bSettingSame = db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, FALSE); - - // set tabs - int tabCount = 0; - HWND hTab = GetDlgItem(hwndDlg, IDC_TABS); - GetWindowRect(hTab, &rcTabs); - GetWindowRect(hwndDlg, &rcOptions); - - // general tab - TCITEM tci = { 0 }; - tci.mask = TCIF_TEXT | TCIF_PARAM; - tci.pszText = TranslateT("General"); - HWND hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_GENAUTOAWAY), hwndDlg, DlgProcAutoAwayGeneralOpts, (LPARAM)GetParent(hwndDlg)); - EnableThemeDialogTexture(hPage, ETDT_ENABLETAB); - - tci.lParam = (LPARAM)hPage; - GetClientRect(hPage, &rcPage); - MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right - rcTabs.left) - (rcPage.right - rcPage.left)) / 2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom - rcTabs.top) - (rcPage.bottom - rcPage.top)) / 2, rcPage.right - rcPage.left, rcPage.bottom - rcPage.top, TRUE); - ShowWindow(hPage, SW_HIDE); - TabCtrl_InsertItem(hTab, tabCount++, &tci); - HWND hShow = hPage; - - // rules tab - tci.mask = TCIF_TEXT | TCIF_PARAM; - tci.pszText = TranslateT("Rules"); - hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_AUTOAWAY), hwndDlg, DlgProcAutoAwayRulesOpts, (LPARAM)GetParent(hwndDlg)); - EnableThemeDialogTexture(hPage, ETDT_ENABLETAB); - - tci.lParam = (LPARAM)hPage; - GetClientRect(hPage, &rcPage); - MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right - rcTabs.left) - (rcPage.right - rcPage.left)) / 2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom - rcTabs.top) - (rcPage.bottom - rcPage.top)) / 2, rcPage.right - rcPage.left, rcPage.bottom - rcPage.top, TRUE); - ShowWindow(hPage, SW_HIDE); - TabCtrl_InsertItem(hTab, tabCount++, &tci); - - // messages tab - tci.mask = TCIF_TEXT | TCIF_PARAM; - tci.pszText = TranslateT("Status messages"); - hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_AUTOAWAYMSG), hwndDlg, DlgProcAutoAwayMsgOpts, (LPARAM)GetParent(hwndDlg)); - EnableThemeDialogTexture(hPage, ETDT_ENABLETAB); - - tci.lParam = (LPARAM)hPage; - GetClientRect(hPage, &rcPage); - MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right - rcTabs.left) - (rcPage.right - rcPage.left)) / 2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom - rcTabs.top) - (rcPage.bottom - rcPage.top)) / 2, rcPage.right - rcPage.left, rcPage.bottom - rcPage.top, TRUE); - ShowWindow(hPage, SW_HIDE); - TabCtrl_InsertItem(hTab, tabCount++, &tci); - - ShowWindow(hShow, SW_SHOW); - } - break; - - case PSM_CHANGED: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_NOTIFY: - if ((((NMHDR*)lParam)->idFrom == IDC_TABS)) { - if (((NMHDR*)lParam)->code == TCN_SELCHANGING) { - TCITEM tci; - - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS)), &tci); - ShowWindow((HWND)tci.lParam, SW_HIDE); - } - else if (((NMHDR*)lParam)->code == TCN_SELCHANGE) { - TCITEM tci; - - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS)), &tci); - ShowWindow((HWND)tci.lParam, SW_SHOW); - } - } - if (((LPNMHDR)lParam)->code == PSN_APPLY) { - TCITEM tci; - tci.mask = TCIF_PARAM; - int count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TABS)); - for (int i = 0; i < count; i++) { - TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), i, &tci); - SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam); - } - } - break; - } - - return FALSE; -} - -///////////////////////////////////////////////////////////////////////////////////////// // Options initialization procedure int AutoAwayOptInitialise(WPARAM wParam, LPARAM) @@ -518,11 +422,23 @@ int AutoAwayOptInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 1000000000; odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS); - odp.szTitle.a = LPGEN("Auto away"); - odp.szGroup.a = LPGEN("Status"); - odp.pfnDlgProc = DlgProcAutoAwayTabs; odp.flags = ODPF_BOLDGROUPS; + odp.szGroup.a = LPGEN("Status"); + odp.szTitle.a = LPGEN("Auto away"); + + odp.szTab.a = LPGEN("General"); + odp.pfnDlgProc = DlgProcAutoAwayGeneralOpts; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENAUTOAWAY); + Options_AddPage(wParam, &odp); + + odp.szTab.a = LPGEN("Rules"); + odp.pfnDlgProc = DlgProcAutoAwayRulesOpts; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTOAWAY); + Options_AddPage(wParam, &odp); + + odp.szTab.a = LPGEN("Status messages"); + odp.pfnDlgProc = DlgProcAutoAwayMsgOpts; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTOAWAYMSG); Options_AddPage(wParam, &odp); return 0; } diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h index c529bf69e0..6feb889b99 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h @@ -72,13 +72,6 @@ struct TAAAProtoSetting : public PROTOCOLSETTINGEX, public MZeroedObject int AAACompareSettings(const TAAAProtoSetting *p1, const TAAAProtoSetting *p2); -struct AAMSGSETTING -{ - short useCustom; - int status; - char* msg; -}; - void AdvancedAutoAwayLoad(); void AdvancedAutoAwayUnload(); diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.h b/plugins/StatusManager/src/KeepStatus/keepstatus.h index d9fecb35f5..eac911a3f0 100644 --- a/plugins/StatusManager/src/KeepStatus/keepstatus.h +++ b/plugins/StatusManager/src/KeepStatus/keepstatus.h @@ -76,9 +76,6 @@ #define IDT_CHECKCONTIN 0x08 #define IDT_CHECKCONNECTING 0x10 -#define KS_ISENABLED WM_APP + 10 -#define KS_ENABLEITEMS WM_APP + 11 - // action #define SETTING_ENABLECHECKING "EnableChecking" // trigger diff --git a/plugins/StatusManager/src/KeepStatus/ks_options.cpp b/plugins/StatusManager/src/KeepStatus/ks_options.cpp index 2974818bcd..cafe9d1f39 100644 --- a/plugins/StatusManager/src/KeepStatus/ks_options.cpp +++ b/plugins/StatusManager/src/KeepStatus/ks_options.cpp @@ -19,8 +19,8 @@ #include "..\stdafx.h" - // prototypes -INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +///////////////////////////////////////////////////////////////////////////////////////// +// Basic options static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -43,6 +43,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetDlgItemTextA(hwndDlg, IDC_PINGHOST, dbv.pszVal); db_free(&dbv); } + // proto list HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); @@ -93,14 +94,15 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam case IDC_CHECKCONNECTION: case IDC_CONTCHECK: case IDC_BYPING: - EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_INITDELAY), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHKINET), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CONTCHECK), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_BYPING), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)) ? TRUE : FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_PINGHOST), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)) && (IsDlgButtonChecked(hwndDlg, IDC_BYPING) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)) ? TRUE : FALSE); + BOOL bEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION); + EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE) && bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_INITDELAY), bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST), bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHKINET), bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_CONTCHECK), bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_BYPING), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK) && bEnabled) ? TRUE : FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_PINGHOST), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)) && (IsDlgButtonChecked(hwndDlg, IDC_BYPING) && bEnabled) ? TRUE : FALSE); break; } break; @@ -123,7 +125,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam LVITEM lvItem; db_set_b(0, KSMODULENAME, SETTING_MAXRETRIES, (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXRETRIES, nullptr, FALSE)); - db_set_b(0, KSMODULENAME, SETTING_CHECKCONNECTION, (BYTE)SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); + db_set_b(0, KSMODULENAME, SETTING_CHECKCONNECTION, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); db_set_b(0, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCONNECTIONPOPUPS)); db_set_dw(0, KSMODULENAME, SETTING_INITDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_INITDELAY, nullptr, FALSE)); db_set_b(0, KSMODULENAME, SETTING_CHKINET, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHKINET)); @@ -161,48 +163,47 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam return 0; } +///////////////////////////////////////////////////////////////////////////////////////// +// Advanced options + static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { - case WM_INITDIALOG: { - TranslateDialogDefault(hwndDlg); - SetDlgItemInt(hwndDlg, IDC_MAXDELAY, db_get_dw(0, KSMODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY), FALSE); - SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, db_get_dw(0, KSMODULENAME, SETTING_MAXCONNECTINGTIME, 0), FALSE); - CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, db_get_b(0, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (db_get_b(0, KSMODULENAME, SETTING_CNCOTHERLOC, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LOGINERR, db_get_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_NOTHING ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (db_get_b(0, KSMODULENAME, SETTING_CHECKAPMRESUME, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FIRSTOFFLINE, (db_get_b(0, KSMODULENAME, SETTING_FIRSTOFFLINE, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NOLOCKED, (db_get_b(0, KSMODULENAME, SETTING_NOLOCKED, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - SetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, db_get_dw(0, KSMODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY), FALSE); - SetDlgItemInt(hwndDlg, IDC_PINGCOUNT, db_get_w(0, KSMODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT), FALSE); - SetDlgItemInt(hwndDlg, IDC_CNTDELAY, db_get_dw(0, KSMODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), FALSE); - switch (db_get_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL)) { - case LOGINERR_SETDELAY: - CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_SETDELAY); - break; - default: - case LOGINERR_CANCEL: - CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_CANCEL); - break; - } - SendMessage(hwndDlg, KS_ENABLEITEMS, 0, 0); + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + SetDlgItemInt(hwndDlg, IDC_MAXDELAY, db_get_dw(0, KSMODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY), FALSE); + SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, db_get_dw(0, KSMODULENAME, SETTING_MAXCONNECTINGTIME, 0), FALSE); + CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, db_get_b(0, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (db_get_b(0, KSMODULENAME, SETTING_CNCOTHERLOC, FALSE)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_LOGINERR, db_get_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_NOTHING ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (db_get_b(0, KSMODULENAME, SETTING_CHECKAPMRESUME, FALSE)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FIRSTOFFLINE, (db_get_b(0, KSMODULENAME, SETTING_FIRSTOFFLINE, FALSE)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOLOCKED, (db_get_b(0, KSMODULENAME, SETTING_NOLOCKED, FALSE)) ? BST_CHECKED : BST_UNCHECKED); + SetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, db_get_dw(0, KSMODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY), FALSE); + SetDlgItemInt(hwndDlg, IDC_PINGCOUNT, db_get_w(0, KSMODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT), FALSE); + SetDlgItemInt(hwndDlg, IDC_CNTDELAY, db_get_dw(0, KSMODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), FALSE); + + switch (db_get_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL)) { + case LOGINERR_SETDELAY: + CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_SETDELAY); + break; + default: + case LOGINERR_CANCEL: + CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_CANCEL); break; } + break; + case WM_COMMAND: if (((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus())) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + // something changed switch (LOWORD(wParam)) { - case IDC_INCREASEEXPONENTIAL: - case IDC_LOGINERR: - SendMessage(hwndDlg, KS_ENABLEITEMS, 0, 0); - break; - case IDC_LOGINERR_CANCEL: case IDC_LOGINERR_SETDELAY: CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, LOWORD(wParam)); - EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); + EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); break; } break; @@ -230,125 +231,15 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_dw(0, KSMODULENAME, SETTING_CNTDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_CNTDELAY, nullptr, FALSE) == 0 ? CHECKCONTIN_DELAY : GetDlgItemInt(hwndDlg, IDC_CNTDELAY, nullptr, FALSE)); } break; - - case KS_ENABLEITEMS: - EnableWindow(GetDlgItem(hwndDlg, IDC_INCREASEEXPONENTIAL), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_MAXCONNECTINGTIME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CNCOTHERLOC), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_SETDELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_CANCEL), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_MAXDELAY), (IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)) ? TRUE : FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKAPMRESUME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_FIRSTOFFLINE), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_NOLOCKED), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_PINGCOUNT), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_BYPING, 0)); - EnableWindow(GetDlgItem(hwndDlg, IDC_CNTDELAY), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CONTCHECK, 0)); - break; - - case WM_SHOWWINDOW: - if (wParam) - SendMessage(hwndDlg, KS_ENABLEITEMS, 0, 0); - - break; } return 0; } -static INT_PTR CALLBACK DlgProcKsTabs(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static HWND hBasicTab; - - switch (msg) { - case WM_INITDIALOG: - { - HWND hShow, hPage; - RECT rcTabs, rcOptions, rcPage; - - TranslateDialogDefault(hwndDlg); - - // set tabs - int tabCount = 0; - HWND hTab = GetDlgItem(hwndDlg, IDC_TABS); - GetWindowRect(hTab, &rcTabs); - GetWindowRect(hwndDlg, &rcOptions); - - // basic tab - TCITEM tci; - memset(&tci, 0, sizeof(TCITEM)); - tci.mask = TCIF_TEXT | TCIF_PARAM; - tci.pszText = TranslateT("Basic"); - hShow = hBasicTab = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_KS_BASIC), hwndDlg, DlgProcKSBasicOpts, (LPARAM)GetParent(hwndDlg)); - EnableThemeDialogTexture(hPage, ETDT_ENABLETAB); - - tci.lParam = (LPARAM)hPage; - GetClientRect(hPage, &rcPage); - MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right - rcTabs.left) - (rcPage.right - rcPage.left)) / 2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom - rcTabs.top) - (rcPage.bottom - rcPage.top)) / 2, rcPage.right - rcPage.left, rcPage.bottom - rcPage.top, TRUE); - ShowWindow(hPage, SW_HIDE); - TabCtrl_InsertItem(hTab, tabCount++, &tci); - - // advanced tab - tci.mask = TCIF_TEXT | TCIF_PARAM; - tci.pszText = TranslateT("Advanced"); - hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_KS_ADV), hwndDlg, DlgProcKSAdvOpts, (LPARAM)GetParent(hwndDlg)); - EnableThemeDialogTexture(hPage, ETDT_ENABLETAB); - - tci.lParam = (LPARAM)hPage; - GetClientRect(hPage, &rcPage); - MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right - rcTabs.left) - (rcPage.right - rcPage.left)) / 2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom - rcTabs.top) - (rcPage.bottom - rcPage.top)) / 2, rcPage.right - rcPage.left, rcPage.bottom - rcPage.top, TRUE); - ShowWindow(hPage, SW_HIDE); - TabCtrl_InsertItem(hTab, tabCount++, &tci); - ShowWindow(hShow, SW_SHOW); - } - break; - - case KS_ISENABLED: - SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)IsDlgButtonChecked(hBasicTab, wParam)); - return TRUE; - - case PSM_CHANGED: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - - case WM_NOTIFY: - if ((((NMHDR*)lParam)->idFrom == IDC_TABS)) { - if (((NMHDR*)lParam)->code == TCN_SELCHANGING) { - TCITEM tci; - - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS)), &tci); - ShowWindow((HWND)tci.lParam, SW_HIDE); - } - else if (((NMHDR*)lParam)->code == TCN_SELCHANGE) { - TCITEM tci; +///////////////////////////////////////////////////////////////////////////////////////// +// Popup options - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS)), &tci); - ShowWindow((HWND)tci.lParam, SW_SHOW); - } - } - if (((LPNMHDR)lParam)->code == PSN_APPLY) { - TCITEM tci; - int i, count; - - tci.mask = TCIF_PARAM; - count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TABS)); - for (i = 0; i < count; i++) { - TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), i, &tci); - SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam); - } - // let main reload options - KSLoadOptions(); - } - break; - } - - return FALSE; -} - -INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bFreeze = false; @@ -556,24 +447,31 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int KeepStatusOptionsInit(WPARAM wparam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; + OPTIONSDIALOGPAGE odp = {}; odp.hInstance = hInst; - odp.szGroup.w = LPGENW("Status"); - odp.szTitle.w = LPGENW("Keep status"); - odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS); - odp.pfnDlgProc = DlgProcKsTabs; + odp.szGroup.a = LPGEN("Status"); + odp.szTitle.a = LPGEN("Keep status"); + odp.flags = ODPF_BOLDGROUPS; + + odp.szTab.a = LPGEN("Basic"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KS_BASIC); + odp.pfnDlgProc = DlgProcKSBasicOpts; + Options_AddPage(wparam, &odp); + + odp.szTab.a = LPGEN("Advanced"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KS_ADV); + odp.pfnDlgProc = DlgProcKSAdvOpts; Options_AddPage(wparam, &odp); if (ServiceExists(MS_POPUP_ADDPOPUPT)) { memset(&odp, 0, sizeof(odp)); odp.position = 150000000; - odp.szGroup.w = LPGENW("Popups"); + odp.szGroup.a = LPGEN("Popups"); odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_PUOPT_KEEPSTATUS); - odp.szTitle.w = LPGENW("Keep status"); + odp.szTitle.a = LPGEN("Keep status"); odp.pfnDlgProc = PopupOptDlgProc; - odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; + odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wparam, &odp); } return 0; diff --git a/plugins/StatusManager/src/resource.h b/plugins/StatusManager/src/resource.h index fe80e01f93..05d5dda364 100644 --- a/plugins/StatusManager/src/resource.h +++ b/plugins/StatusManager/src/resource.h @@ -14,7 +14,6 @@ #define IDD_OPT_KS_ACTION 120 #define IDD_SETSTSMSGDIALOG 121 #define IDD_OPT_STATUSPROFILES 123 -#define IDD_OPT_TABS 126 #define IDD_OPT_KS_ADV 127 #define IDD_TRG_AAASTATECHANGE 128 #define IDI_TTBDOWN 129 |