diff options
Diffstat (limited to 'plugins/StatusManager/src/KeepStatus/ks_options.cpp')
-rw-r--r-- | plugins/StatusManager/src/KeepStatus/ks_options.cpp | 330 |
1 files changed, 161 insertions, 169 deletions
diff --git a/plugins/StatusManager/src/KeepStatus/ks_options.cpp b/plugins/StatusManager/src/KeepStatus/ks_options.cpp index a43d528c34..2974818bcd 100644 --- a/plugins/StatusManager/src/KeepStatus/ks_options.cpp +++ b/plugins/StatusManager/src/KeepStatus/ks_options.cpp @@ -19,7 +19,7 @@ #include "..\stdafx.h" -// prototypes + // prototypes INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -32,14 +32,14 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam LVITEM lvItem; DBVARIANT dbv; - SetDlgItemInt(hwndDlg, IDC_MAXRETRIES, db_get_b(NULL, KSMODULENAME, SETTING_MAXRETRIES, DEFAULT_MAXRETRIES), FALSE); - SetDlgItemInt(hwndDlg, IDC_INITDELAY, db_get_dw(NULL, KSMODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY), FALSE); - CheckDlgButton(hwndDlg, IDC_CHECKCONNECTION, db_get_b(NULL, KSMODULENAME, SETTING_CHECKCONNECTION, FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, (db_get_b(NULL, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) && ServiceExists(MS_POPUP_SHOWMESSAGE)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CHKINET, db_get_b(NULL, KSMODULENAME, SETTING_CHKINET, FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CONTCHECK, db_get_b(NULL, KSMODULENAME, SETTING_CONTCHECK, FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_BYPING, db_get_b(NULL, KSMODULENAME, SETTING_BYPING, FALSE) ? BST_CHECKED : BST_UNCHECKED); - if (!db_get_s(NULL, KSMODULENAME, SETTING_PINGHOST, &dbv)) { + SetDlgItemInt(hwndDlg, IDC_MAXRETRIES, db_get_b(0, KSMODULENAME, SETTING_MAXRETRIES, DEFAULT_MAXRETRIES), FALSE); + SetDlgItemInt(hwndDlg, IDC_INITDELAY, db_get_dw(0, KSMODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY), FALSE); + CheckDlgButton(hwndDlg, IDC_CHECKCONNECTION, db_get_b(0, KSMODULENAME, SETTING_CHECKCONNECTION, FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, (db_get_b(0, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) && ServiceExists(MS_POPUP_SHOWMESSAGE)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CHKINET, db_get_b(0, KSMODULENAME, SETTING_CHKINET, FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CONTCHECK, db_get_b(0, KSMODULENAME, SETTING_CONTCHECK, FALSE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_BYPING, db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE) ? BST_CHECKED : BST_UNCHECKED); + if (!db_get_s(0, KSMODULENAME, SETTING_PINGHOST, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_PINGHOST, dbv.pszVal); db_free(&dbv); } @@ -71,7 +71,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam char dbSetting[128]; mir_snprintf(dbSetting, "%s_enabled", protos[i]->szModuleName); - ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, KSMODULENAME, dbSetting, TRUE)); + ListView_SetCheckState(hList, lvItem.iItem, db_get_b(0, KSMODULENAME, dbSetting, TRUE)); lvItem.iItem++; } EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); @@ -109,12 +109,12 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (((NMHDR*)lParam)->idFrom == IDC_PROTOCOLLIST) { switch (((NMHDR*)lParam)->code) { case LVN_ITEMCHANGED: - { - NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; - if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST)) && ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK)) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - break; + { + NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; + if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST)) && ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK)) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; } } @@ -122,23 +122,23 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam int i; LVITEM lvItem; - db_set_b(NULL, KSMODULENAME, SETTING_MAXRETRIES, (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXRETRIES, NULL, FALSE)); - db_set_b(NULL, KSMODULENAME, SETTING_CHECKCONNECTION, (BYTE)SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)); - db_set_b(NULL, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCONNECTIONPOPUPS)); - db_set_dw(NULL, KSMODULENAME, SETTING_INITDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_INITDELAY, NULL, FALSE)); - db_set_b(NULL, KSMODULENAME, SETTING_CHKINET, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHKINET)); - db_set_b(NULL, KSMODULENAME, SETTING_CONTCHECK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)); - db_set_b(NULL, KSMODULENAME, SETTING_BYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BYPING)); + 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_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)); + db_set_b(0, KSMODULENAME, SETTING_CONTCHECK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)); + db_set_b(0, KSMODULENAME, SETTING_BYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BYPING)); if (IsDlgButtonChecked(hwndDlg, IDC_BYPING)) { char *host; int len = SendDlgItemMessage(hwndDlg, IDC_PINGHOST, WM_GETTEXTLENGTH, 0, 0); if (len > 0) { host = (char*)malloc(len + 1); - if (host != NULL) { + if (host != nullptr) { memset(host, '\0', len + 1); GetDlgItemTextA(hwndDlg, IDC_PINGHOST, host, len + 1); - db_set_s(NULL, KSMODULENAME, SETTING_PINGHOST, host); + db_set_s(0, KSMODULENAME, SETTING_PINGHOST, host); } } } @@ -152,7 +152,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam char dbSetting[128]; mir_snprintf(dbSetting, "%s_enabled", (char *)lvItem.lParam); - db_set_b(NULL, KSMODULENAME, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); + db_set_b(0, KSMODULENAME, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); } } break; @@ -165,30 +165,30 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { switch (msg) { case WM_INITDIALOG: { - TranslateDialogDefault(hwndDlg); - SetDlgItemInt(hwndDlg, IDC_MAXDELAY, db_get_dw(NULL, KSMODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY), FALSE); - SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, db_get_dw(NULL, KSMODULENAME, SETTING_MAXCONNECTINGTIME, 0), FALSE); - CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, db_get_b(NULL, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (db_get_b(NULL, KSMODULENAME, SETTING_CNCOTHERLOC, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LOGINERR, db_get_b(NULL, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_NOTHING ? BST_UNCHECKED : BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (db_get_b(NULL, KSMODULENAME, SETTING_CHECKAPMRESUME, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FIRSTOFFLINE, (db_get_b(NULL, KSMODULENAME, SETTING_FIRSTOFFLINE, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NOLOCKED, (db_get_b(NULL, KSMODULENAME, SETTING_NOLOCKED, FALSE)) ? BST_CHECKED : BST_UNCHECKED); - SetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, db_get_dw(NULL, KSMODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY), FALSE); - SetDlgItemInt(hwndDlg, IDC_PINGCOUNT, db_get_w(NULL, KSMODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT), FALSE); - SetDlgItemInt(hwndDlg, IDC_CNTDELAY, db_get_dw(NULL, KSMODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), FALSE); - switch (db_get_b(NULL, 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); + 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); break; } - SendMessage(hwndDlg, KS_ENABLEITEMS, 0, 0); - break; - } case WM_COMMAND: if (((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus())) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -209,25 +209,25 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - db_set_b(NULL, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL)); - db_set_dw(NULL, KSMODULENAME, SETTING_MAXDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXDELAY, NULL, FALSE)); - db_set_dw(NULL, KSMODULENAME, SETTING_MAXCONNECTINGTIME, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, NULL, FALSE)); - db_set_b(NULL, KSMODULENAME, SETTING_FIRSTOFFLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FIRSTOFFLINE)); - db_set_b(NULL, KSMODULENAME, SETTING_NOLOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOLOCKED)); - db_set_b(NULL, KSMODULENAME, SETTING_CNCOTHERLOC, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CNCOTHERLOC)); - db_set_b(NULL, KSMODULENAME, SETTING_LOGINERR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)); + db_set_b(0, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL)); + db_set_dw(0, KSMODULENAME, SETTING_MAXDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXDELAY, nullptr, FALSE)); + db_set_dw(0, KSMODULENAME, SETTING_MAXCONNECTINGTIME, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, nullptr, FALSE)); + db_set_b(0, KSMODULENAME, SETTING_FIRSTOFFLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FIRSTOFFLINE)); + db_set_b(0, KSMODULENAME, SETTING_NOLOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOLOCKED)); + db_set_b(0, KSMODULENAME, SETTING_CNCOTHERLOC, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CNCOTHERLOC)); + db_set_b(0, KSMODULENAME, SETTING_LOGINERR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)); if (IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)) { if (IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY)) { - db_set_b(NULL, KSMODULENAME, SETTING_LOGINERR, LOGINERR_SETDELAY); - db_set_dw(NULL, KSMODULENAME, SETTING_LOGINERR_DELAY, GetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, NULL, FALSE)); + db_set_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_SETDELAY); + db_set_dw(0, KSMODULENAME, SETTING_LOGINERR_DELAY, GetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, nullptr, FALSE)); } - else db_set_b(NULL, KSMODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL); + else db_set_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL); } - else db_set_b(NULL, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING); + else db_set_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING); - db_set_b(NULL, KSMODULENAME, SETTING_CHECKAPMRESUME, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKAPMRESUME)); - db_set_w(NULL, KSMODULENAME, SETTING_PINGCOUNT, (WORD)GetDlgItemInt(hwndDlg, IDC_PINGCOUNT, NULL, FALSE)); - db_set_dw(NULL, KSMODULENAME, SETTING_CNTDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_CNTDELAY, NULL, FALSE) == 0 ? CHECKCONTIN_DELAY : GetDlgItemInt(hwndDlg, IDC_CNTDELAY, NULL, FALSE)); + db_set_b(0, KSMODULENAME, SETTING_CHECKAPMRESUME, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKAPMRESUME)); + db_set_w(0, KSMODULENAME, SETTING_PINGCOUNT, (WORD)GetDlgItemInt(hwndDlg, IDC_PINGCOUNT, nullptr, FALSE)); + db_set_dw(0, KSMODULENAME, SETTING_CNTDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_CNTDELAY, nullptr, FALSE) == 0 ? CHECKCONTIN_DELAY : GetDlgItemInt(hwndDlg, IDC_CNTDELAY, nullptr, FALSE)); } break; @@ -263,46 +263,46 @@ static INT_PTR CALLBACK DlgProcKsTabs(HWND hwndDlg, UINT msg, WPARAM wParam, LPA switch (msg) { case WM_INITDIALOG: - { - HWND hShow, hPage; - RECT rcTabs, rcOptions, rcPage; + { + HWND hShow, hPage; + RECT rcTabs, rcOptions, rcPage; - TranslateDialogDefault(hwndDlg); + 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; + // 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)); @@ -359,7 +359,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l bFreeze = true; // left action - switch (db_get_b(NULL, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL)) { + switch (db_get_b(0, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL)) { case POPUP_ACT_CLOSEPOPUP: CheckDlgButton(hwndDlg, IDC_LCLOSE, BST_CHECKED); break; @@ -374,7 +374,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; } // right action - switch (db_get_b(NULL, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL)) { + switch (db_get_b(0, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL)) { case POPUP_ACT_CLOSEPOPUP: CheckDlgButton(hwndDlg, IDC_RCLOSE, BST_CHECKED); break; @@ -393,7 +393,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYFROMPU), ServiceExists(MS_POPUP_ADDPOPUPT)); EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYPERMANENT), ServiceExists(MS_POPUP_ADDPOPUPT)); EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUPT)); - switch (db_get_b(NULL, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) { + switch (db_get_b(0, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) { case POPUP_DELAYCUSTOM: CheckDlgButton(hwndDlg, IDC_DELAYCUSTOM, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUPT)); @@ -411,25 +411,25 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; } // delay - SetDlgItemInt(hwndDlg, IDC_DELAY, db_get_dw(NULL, KSMODULENAME, SETTING_POPUP_TIMEOUT, 0), FALSE); + SetDlgItemInt(hwndDlg, IDC_DELAY, db_get_dw(0, KSMODULENAME, SETTING_POPUP_TIMEOUT, 0), FALSE); // back color - SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, KSMODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA)); + SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, db_get_dw(0, KSMODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA)); // text - SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, KSMODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC)); + SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(0, KSMODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC)); // wincolors - CheckDlgButton(hwndDlg, IDC_WINCOLORS, db_get_b(NULL, KSMODULENAME, SETTING_POPUP_USEWINCOLORS, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_WINCOLORS, db_get_b(0, KSMODULENAME, SETTING_POPUP_USEWINCOLORS, 0) ? BST_CHECKED : BST_UNCHECKED); // defaultcolors - CheckDlgButton(hwndDlg, IDC_DEFAULTCOLORS, ((db_get_b(NULL, KSMODULENAME, SETTING_POPUP_USEDEFCOLORS, 0)) && (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS))) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DEFAULTCOLORS, ((db_get_b(0, KSMODULENAME, SETTING_POPUP_USEDEFCOLORS, 0)) && (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS))) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), ((BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) && (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS)))); EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOR), ((BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) && (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS)))); EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULTCOLORS), (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS))); EnableWindow(GetDlgItem(hwndDlg, IDC_WINCOLORS), (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS))); // popup types - CheckDlgButton(hwndDlg, IDC_PUCONNLOST, db_get_b(NULL, KSMODULENAME, SETTING_PUCONNLOST, TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_PUOTHER, db_get_b(NULL, KSMODULENAME, SETTING_PUOTHER, TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_PUCONNRETRY, db_get_b(NULL, KSMODULENAME, SETTING_PUCONNRETRY, TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_PURESULT, db_get_b(NULL, KSMODULENAME, SETTING_PURESULT, TRUE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_PUSHOWEXTRA, db_get_b(NULL, KSMODULENAME, SETTING_PUSHOWEXTRA, TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PUCONNLOST, db_get_b(0, KSMODULENAME, SETTING_PUCONNLOST, TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PUOTHER, db_get_b(0, KSMODULENAME, SETTING_PUOTHER, TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PUCONNRETRY, db_get_b(0, KSMODULENAME, SETTING_PUCONNRETRY, TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PURESULT, db_get_b(0, KSMODULENAME, SETTING_PURESULT, TRUE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PUSHOWEXTRA, db_get_b(0, KSMODULENAME, SETTING_PUSHOWEXTRA, TRUE) ? BST_CHECKED : BST_UNCHECKED); bFreeze = false; break; @@ -474,45 +474,37 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case IDC_PREV: - { - POPUPDATAT ppd = { NULL }; - - ppd.lchContact = NULL; - ppd.lchIcon = Skin_LoadIcon(SKINICON_STATUS_OFFLINE); - wcsncpy(ppd.lptzContactName, TranslateT("Keep status"), MAX_CONTACTNAME); - wcsncpy(ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE); - if (IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) - { - ppd.colorBack = GetSysColor(COLOR_BTNFACE); - ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); - } - else if (IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS)) - { - ppd.colorBack = NULL; - ppd.colorText = NULL; - } - else - { - ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0); - ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0); - } - ppd.PluginWindowProc = KSPopupDlgProc; - ppd.PluginData = NULL; - if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU)) { - ppd.iSeconds = 0; - } - else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM)) - { - ppd.iSeconds = GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); - } - else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT)) - { - ppd.iSeconds = -1; + POPUPDATAT ppd = {}; + ppd.lchIcon = Skin_LoadIcon(SKINICON_STATUS_OFFLINE); + wcsncpy(ppd.lptzContactName, TranslateT("Keep status"), MAX_CONTACTNAME); + wcsncpy(ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE); + if (IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) { + ppd.colorBack = GetSysColor(COLOR_BTNFACE); + ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); + } + else if (IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS)) { + ppd.colorBack = 0; + ppd.colorText = 0; + } + else { + ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0); + ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0); + } + ppd.PluginWindowProc = KSPopupDlgProc; + ppd.PluginData = nullptr; + if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU)) { + ppd.iSeconds = 0; + } + else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM)) { + ppd.iSeconds = GetDlgItemInt(hwndDlg, IDC_DELAY, nullptr, FALSE); + } + else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT)) { + ppd.iSeconds = -1; + } + PUAddPopupT(&ppd); } - PUAddPopupT(&ppd); - } - break; + break; } break; @@ -520,41 +512,41 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (((LPNMHDR)lParam)->code == PSN_APPLY) { // left action if (IsDlgButtonChecked(hwndDlg, IDC_LNOTHING)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_NOTHING); + db_set_b(0, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_NOTHING); else if (IsDlgButtonChecked(hwndDlg, IDC_LCLOSE)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CLOSEPOPUP); + db_set_b(0, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CLOSEPOPUP); else if (IsDlgButtonChecked(hwndDlg, IDC_LCANCEL)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL); + db_set_b(0, KSMODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL); // right action if (IsDlgButtonChecked(hwndDlg, IDC_RNOTHING)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_NOTHING); + db_set_b(0, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_NOTHING); else if (IsDlgButtonChecked(hwndDlg, IDC_RCLOSE)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CLOSEPOPUP); + db_set_b(0, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CLOSEPOPUP); else if (IsDlgButtonChecked(hwndDlg, IDC_RCANCEL)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL); + db_set_b(0, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL); // delay if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU); + db_set_b(0, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU); else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYCUSTOM); + db_set_b(0, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYCUSTOM); else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT)) - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYPERMANENT); + db_set_b(0, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYPERMANENT); // delay - db_set_dw(NULL, KSMODULENAME, SETTING_POPUP_TIMEOUT, GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE)); + db_set_dw(0, KSMODULENAME, SETTING_POPUP_TIMEOUT, GetDlgItemInt(hwndDlg, IDC_DELAY, nullptr, FALSE)); // back color - db_set_dw(NULL, KSMODULENAME, SETTING_POPUP_BACKCOLOR, SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0)); + db_set_dw(0, KSMODULENAME, SETTING_POPUP_BACKCOLOR, SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0)); // text color - db_set_dw(NULL, KSMODULENAME, SETTING_POPUP_TEXTCOLOR, SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0)); + db_set_dw(0, KSMODULENAME, SETTING_POPUP_TEXTCOLOR, SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0)); // use win - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_USEWINCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)); + db_set_b(0, KSMODULENAME, SETTING_POPUP_USEWINCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)); // use def - db_set_b(NULL, KSMODULENAME, SETTING_POPUP_USEDEFCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS)); + db_set_b(0, KSMODULENAME, SETTING_POPUP_USEDEFCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS)); // store types - db_set_b(NULL, KSMODULENAME, SETTING_PUCONNLOST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNLOST)); - db_set_b(NULL, KSMODULENAME, SETTING_PUOTHER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUOTHER)); - db_set_b(NULL, KSMODULENAME, SETTING_PUCONNRETRY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNRETRY)); - db_set_b(NULL, KSMODULENAME, SETTING_PURESULT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PURESULT)); - db_set_b(NULL, KSMODULENAME, SETTING_PUSHOWEXTRA, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUSHOWEXTRA)); + db_set_b(0, KSMODULENAME, SETTING_PUCONNLOST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNLOST)); + db_set_b(0, KSMODULENAME, SETTING_PUOTHER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUOTHER)); + db_set_b(0, KSMODULENAME, SETTING_PUCONNRETRY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNRETRY)); + db_set_b(0, KSMODULENAME, SETTING_PURESULT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PURESULT)); + db_set_b(0, KSMODULENAME, SETTING_PUSHOWEXTRA, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUSHOWEXTRA)); } break; } |