diff options
author | George Hazan <ghazan@miranda.im> | 2018-07-10 23:41:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-07-10 23:41:16 +0300 |
commit | 431b632ec24f13356397323f19d0db4d117c793f (patch) | |
tree | 629eea40228851e9c8d85204f25fe90cdafd7af5 | |
parent | 3d8ca17492f7dcf1d47cddda9afb3797c0f2752b (diff) |
fixes #1455 completely
-rw-r--r-- | plugins/ProxySwitch/res/resource.rc | 94 | ||||
-rw-r--r-- | plugins/ProxySwitch/src/main.cpp | 97 | ||||
-rw-r--r-- | plugins/ProxySwitch/src/opt.cpp | 85 | ||||
-rw-r--r-- | plugins/ProxySwitch/src/resource.h | 3 | ||||
-rw-r--r-- | plugins/ProxySwitch/src/stdafx.h | 2 |
5 files changed, 114 insertions, 167 deletions
diff --git a/plugins/ProxySwitch/res/resource.rc b/plugins/ProxySwitch/res/resource.rc index 470d7a75c0..e28f298e73 100644 --- a/plugins/ProxySwitch/res/resource.rc +++ b/plugins/ProxySwitch/res/resource.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script. +// Microsoft Visual C++ generated resource script. // #include "..\src\resource.h" @@ -40,7 +40,7 @@ IDI_NOTIF_0 ICON "notif-no.ico" // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE +GUIDELINES DESIGNINFO BEGIN IDD_OPTIONS, DIALOG BEGIN @@ -49,6 +49,11 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 184 END + + IDD_HELP, DIALOG + BEGIN + BOTTOMMARGIN, 163 + END END #endif // APSTUDIO_INVOKED @@ -59,94 +64,66 @@ END // IDD_OPTIONS DIALOGEX 0, 0, 302, 191 -STYLE DS_MODALFRAME | WS_CHILD +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Network addresses",IDC_STATIC,7,5,287,56,WS_GROUP - CONTROL "Direct connection",IDC_STATIC,"Static",SS_SIMPLE,15,20, - 84,8 + CONTROL "Direct connection",IDC_STATIC,"Static",SS_SIMPLE,15,20,84,8 EDITTEXT IDC_EDIT_NOPROXY,101,17,183,14,ES_AUTOHSCROLL CONTROL "Use proxy",IDC_STATIC,"Static",SS_SIMPLE,40,40,61,8 EDITTEXT IDC_EDIT_USEPROXY,101,37,183,14,ES_AUTOHSCROLL PUSHBUTTON "?",IDC_BTN_HELP,15,39,14,12,BS_FLAT | NOT WS_TABSTOP GROUPBOX "General",IDC_STATIC,7,65,144,118,WS_GROUP - CONTROL "Manage Miranda NG proxy",IDC_CHECK_MIRANDA,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,78,131,10 - CONTROL "Manage Internet Explorer proxy",IDC_CHECK_IE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,92,132,10 - CONTROL "Manage Firefox proxy",IDC_CHECK_FIREFOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,106,132,10 - CONTROL "Reconnect if IP address changes", - IDC_CHECK_ALWAY_RECONNECT,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,15,120,132,10 - CONTROL "Display 'Show my IP addresses' in menu",IDC_CHECK_SHOWMYIPMENU, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,134,130,10 - CONTROL "Display 'Proxy && IP' submenu",IDC_CHECK_PROXYIPMENU, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,148,131,10 + CONTROL "Manage Miranda NG proxy",IDC_CHECK_MIRANDA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,78,131,10 + CONTROL "Manage Internet Explorer proxy",IDC_CHECK_IE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,92,132,10 + CONTROL "Manage Firefox proxy",IDC_CHECK_FIREFOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,106,132,10 + CONTROL "Reconnect if IP address changes",IDC_CHECK_ALWAY_RECONNECT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,120,132,10 LTEXT "Hide interfaces",IDC_STATIC,15,165,62,8 EDITTEXT IDC_EDIT_HIDEINTF,80,161,62,14,ES_AUTOHSCROLL GROUPBOX "Popup options",IDC_STATIC,160,65,134,118,WS_GROUP - CONTROL "Enable popups",IDC_CHECK_POPUPS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,168,78,122,10 + CONTROL "Enable popups",IDC_CHECK_POPUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,78,122,10 CONTROL "",IDC_TEXTCOLOR,"ColourPicker",WS_TABSTOP,168,94,39,11 CONTROL "Text color",IDC_STATIC,"Static",SS_SIMPLE,215,94,75,8 CONTROL "",IDC_BGCOLOR,"ColourPicker",WS_TABSTOP,168,111,39,11 - CONTROL "Background color",IDC_STATIC,"Static",SS_SIMPLE,215,111, - 75,8 + CONTROL "Background color",IDC_STATIC,"Static",SS_SIMPLE,215,111,75,8 CONTROL "Use default popup colors",IDC_CHECK_DEFAULTCOLORS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,129,122,10 CONTROL "Show proxy status on change",IDC_CHECK_SHOWPROXYSTATUS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,143,123,10 - CTEXT "Restart of Miranda NG is required.",IDC_RESTARTREQUIRED, - 164,164,127,8,NOT WS_VISIBLE - LTEXT "Enter semicolon (;) separated list of IP network addresses in any of the formats below:\n\tIP/bits\t(10.0.0.1/24)\t\tIP/mask\t(10.0.0.1/255.255.255.0)\n\tIP1-2\t(10.0.0.1-50)\t\tIP1-IP2\t(10.0.0.1-10.0.2.255)", - IDC_HELP_1,7,66,287,32,NOT WS_VISIBLE | NOT WS_GROUP - LTEXT "Any entry in the 'Use proxy' list can be prefixed by an exclamation mark (!) to increase its priority. Entries with wrong syntax will be ignored. The plugin checks the IP addresses in the following way:", - IDC_HELP_2,7,98,287,27,NOT WS_VISIBLE | NOT WS_GROUP - LTEXT "\t1) Use proxy if any interface has prioritized 'Use proxy' address\n\t2) Don't use proxy if any interface has 'Direct connection' address\n\t3) Use proxy if any interface has 'Use proxy' address\n\t4) Do nothing if unknown or any at all addresses found", - IDC_HELP_3,7,125,287,59,NOT WS_VISIBLE | NOT WS_GROUP + CTEXT "Restart of Miranda NG is required.",IDC_RESTARTREQUIRED,164,164,127,8,NOT WS_VISIBLE END -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// +IDD_HELP DIALOGEX 0, 0, 302, 167 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_PALETTEWINDOW | WS_EX_APPWINDOW +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Enter semicolon (;) separated list of IP network addresses in any of the formats below:\n\tIP/bits\t(10.0.0.1/24)\t\tIP/mask\t(10.0.0.1/255.255.255.0)\n\tIP1-2\t(10.0.0.1-50)\t\tIP1-IP2\t(10.0.0.1-10.0.2.255)",IDC_HELP_1,8,4,287,32 + LTEXT "Any entry in the 'Use proxy' list can be prefixed by an exclamation mark (!) to increase its priority. Entries with wrong syntax will be ignored. The plugin checks the IP addresses in the following way:",IDC_HELP_2,8,36,287,27 + LTEXT "\t1) Use proxy if any interface has prioritized 'Use proxy' address\n\t2) Don't use proxy if any interface has 'Direct connection' address\n\t3) Use proxy if any interface has 'Use proxy' address\n\t4) Do nothing if unknown or any at all addresses found",IDC_HELP_3,8,70,287,59 + PUSHBUTTON "OK",IDOK,195,149,50,14 + PUSHBUTTON "Cancel",IDCANCEL,250,149,50,14 +END ///////////////////////////////////////////////////////////////////////////// -// Czech resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CSY) -#ifdef _WIN32 -LANGUAGE LANG_CZECH, SUBLANG_DEFAULT -#pragma code_page(1250) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// // -// TEXTINCLUDE +// AFX_DIALOG_LAYOUT // -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE +IDD_HELP AFX_DIALOG_LAYOUT BEGIN - "#include ""afxres.h""\r\n" - "\0" + 0 END -3 TEXTINCLUDE DISCARDABLE +IDD_OPTIONS AFX_DIALOG_LAYOUT BEGIN - "\r\n" - "\0" + 0 END -#endif // APSTUDIO_INVOKED - -#endif // Czech resources +#endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// @@ -160,3 +137,4 @@ END ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED + diff --git a/plugins/ProxySwitch/src/main.cpp b/plugins/ProxySwitch/src/main.cpp index 44fd01e464..06cea7f732 100644 --- a/plugins/ProxySwitch/src/main.cpp +++ b/plugins/ProxySwitch/src/main.cpp @@ -28,6 +28,7 @@ CMPlugin::CMPlugin() : {} HGENMENU hEnableDisablePopupMenu = 0; +HGENMENU hMenuRoot; OBJLIST<ACTIVE_CONNECTION> g_arConnections(10, PtrKeySortT); mir_cs csConnection_List; @@ -46,8 +47,6 @@ UINT opt_showProxyState; UINT opt_miranda; UINT opt_ie; UINT opt_firefox; -UINT opt_showMyIP; -UINT opt_showProxyIP; UINT opt_alwayReconnect; UINT opt_startup; UINT opt_not_restarted; @@ -129,9 +128,6 @@ void UpdateInterfacesMenu(void) { CMenuItem mi(g_plugin); - if (!opt_showProxyIP && !opt_not_restarted) - return; - mir_cslock lck(csNIF_List); for (auto &it : g_arNIF) { if (it->MenuItem) { @@ -146,8 +142,7 @@ void UpdateInterfacesMenu(void) sprintf(svc, "%s%d", MS_PROXYSWITCH_COPYIP2CLIP, idx); mi.position = 0xC00000; mi.flags = CMIF_UNICODE; - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Proxy settings && interfaces"), 0xC0000000); - Menu_ConfigureItem(mi.root, MCI_OPT_UID, "68AB766F-09F1-4C4C-9AE1-4135617741C9"); + mi.root = hMenuRoot; SET_UID(mi, 0x8295e40d, 0xa262, 0x434b, 0xa4, 0xb3, 0x57, 0x6b, 0xe0, 0xfc, 0x8f, 0x68); mi.name.w = Print_NIF(it); @@ -253,68 +248,60 @@ int CMPlugin::Load() int Init(WPARAM, LPARAM) { - CMenuItem mi(g_plugin); - opt_popupPluginInstalled = ServiceExists(MS_POPUP_ADDPOPUP); - hEventRebound = CreateEvent(NULL, TRUE, FALSE, NULL); mir_forkthread(IP_WatchDog, 0); - if (opt_showMyIP) { - hSvcShowMyIP = CreateServiceFunction(MS_PROXYSWITCH_SHOWMYIPADDRS, ShowMyIPAddrs); - //ZeroMemory(&mi, sizeof(mi)); - //mi.cbSize = sizeof(mi); - SET_UID(mi, 0x53b0835b, 0x7162, 0x4272, 0x83, 0x3b, 0x3f, 0x60, 0x9e, 0xe, 0x76, 0x4a); - mi.position = 0xC0000000; - mi.flags = CMIF_UNICODE; - mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO)); - mi.name.w = LPGENW("Show my &IP addresses"); - mi.pszService = MS_PROXYSWITCH_SHOWMYIPADDRS; - Menu_AddMainMenuItem(&mi); + // menu item + CMenuItem mi(g_plugin); + SET_UID(mi, 0x53b0835b, 0x7162, 0x4272, 0x83, 0x3b, 0x3f, 0x60, 0x9e, 0xe, 0x76, 0x4a); + mi.position = 0xC0000000; + mi.flags = CMIF_UNICODE; + mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO)); + mi.name.w = LPGENW("Show my &IP addresses"); + mi.pszService = MS_PROXYSWITCH_SHOWMYIPADDRS; + HGENMENU hMenu = Menu_AddMainMenuItem(&mi); + hSvcShowMyIP = CreateServiceFunction(mi.pszService, ShowMyIPAddrs); + + int opt_showMyIP = db_get_b(NULL, MODULENAME, "ShowMyIP", 100); + if (opt_showMyIP != 100) { + Menu_SetVisible(hMenu, opt_showMyIP != 0); + db_unset(NULL, MODULENAME, "ShowMyIP"); } - if (opt_showProxyIP) { - - hSvcProxyDisable = CreateServiceFunction(MS_PROXYSWITCH_PROXYDISABLE, ProxyDisable); - //ZeroMemory(&mi, sizeof(mi)); - //mi.cbSize = sizeof(mi); - SET_UID(mi, 0xf93289a9, 0x3bad, 0x424b, 0xb2, 0x72, 0x14, 0xa7, 0x45, 0xa5, 0x8, 0x9c); - mi.position = 1; - mi.name.w = LPGENW("Disable proxy"); - mi.pszService = MS_PROXYSWITCH_PROXYDISABLE; - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Proxy settings && interfaces"), 0xC0000000); - Menu_ConfigureItem(mi.root, MCI_OPT_UID, "A9684E9E-E621-4962-986F-576897928D27"); - //mi.pszPopupName = Translate("Proxy settings && interfaces"); - //mi.popupPosition = 0xC0000000; - Menu_AddMainMenuItem(&mi); - - hSvcProxyEnable = CreateServiceFunction(MS_PROXYSWITCH_PROXYENABLE, ProxyEnable); - //ZeroMemory(&mi, sizeof(mi)); - //mi.cbSize = sizeof(mi); - mi.position = 1; - mi.name.w = LPGENW("Enable proxy"); - mi.pszService = MS_PROXYSWITCH_PROXYENABLE; - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Proxy settings && interfaces"), 0xC0000000); - Menu_ConfigureItem(mi.root, MCI_OPT_UID, "B37E5BBE-19CF-4C78-AE53-A0DB11656C36"); - //mi.pszPopupName = Translate("Proxy settings && interfaces"); - //mi.popupPosition = 0xC0000000; - Menu_AddMainMenuItem(&mi); - - UpdateInterfacesMenu(); + hMenuRoot = mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Proxy settings && interfaces"), 0xC0000000); + Menu_ConfigureItem(hMenuRoot, MCI_OPT_UID, "A9684E9E-E621-4962-986F-576897928D27"); + + SET_UID(mi, 0xf93289a9, 0x3bad, 0x424b, 0xb2, 0x72, 0x14, 0xa7, 0x45, 0xa5, 0x8, 0x9c); + mi.position = 1; + mi.name.w = LPGENW("Disable proxy"); + mi.pszService = MS_PROXYSWITCH_PROXYDISABLE; + Menu_AddMainMenuItem(&mi); + hSvcProxyDisable = CreateServiceFunction(mi.pszService, ProxyDisable); + + SET_UID(mi, 0xf93289a9, 0x3bad, 0x424b, 0xb2, 0x72, 0x14, 0xa7, 0x45, 0xa5, 0x8, 0x9D); + mi.position = 2; + mi.name.w = LPGENW("Enable proxy"); + mi.pszService = MS_PROXYSWITCH_PROXYENABLE; + Menu_AddMainMenuItem(&mi); + hSvcProxyEnable = CreateServiceFunction(mi.pszService, ProxyEnable); + + int opt_showProxyIP = db_get_b(NULL, MODULENAME, "ShowProxyIP", 100); + if (opt_showProxyIP != 100) { + Menu_SetVisible(mi.root, opt_showProxyIP != 0); + db_unset(NULL, MODULENAME, "ShowProxyIP"); } + UpdateInterfacesMenu(); + if (opt_popupPluginInstalled) { - hSvcPopupSwitch = CreateServiceFunction(MS_PROXYSWITCH_POPUPSWITCH, PopupSwitch); - //ZeroMemory(&mi, sizeof(mi)); - //mi.cbSize = sizeof(mi); + mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0xC0000000); mi.name.w = LPGENW("IP change notification"); mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO)); - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0xC0000000); - Menu_ConfigureItem(mi.root, MCI_OPT_UID, "185AC334-E90E-46C6-83A2-D4E36CB257D9"); - //mi.pszPopupName = Translate("Popups"); mi.pszService = MS_PROXYSWITCH_POPUPSWITCH; hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); + hSvcPopupSwitch = CreateServiceFunction(mi.pszService, PopupSwitch); UpdatePopupMenu(opt_popups); } diff --git a/plugins/ProxySwitch/src/opt.cpp b/plugins/ProxySwitch/src/opt.cpp index 44c7df46af..416ff92fc8 100644 --- a/plugins/ProxySwitch/src/opt.cpp +++ b/plugins/ProxySwitch/src/opt.cpp @@ -9,27 +9,24 @@ the proxy settings of Miranda and Internet Explorer accordingly. int help_shown; -void ShowHelp(HWND hdlg, int showhide_help) +static INT_PTR CALLBACK HelpProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM) { - int showhide_others = showhide_help == SW_SHOW ? SW_HIDE : SW_SHOW; - help_shown = showhide_help; - - ShowWindow(GetDlgItem(hdlg, IDC_HELP_1), showhide_help); - ShowWindow(GetDlgItem(hdlg, IDC_HELP_2), showhide_help); - ShowWindow(GetDlgItem(hdlg, IDC_HELP_3), showhide_help); - - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_MIRANDA), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_IE), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_FIREFOX), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_PROXYIPMENU), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWMYIPMENU), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWPROXYSTATUS), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_ALWAY_RECONNECT), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_CHECK_POPUPS), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_BGCOLOR), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), showhide_others); - ShowWindow(GetDlgItem(hdlg, IDC_EDIT_HIDEINTF), showhide_others); + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hdlg); + return 1; + + case WM_COMMAND: + if (wParam == IDOK || wParam == IDCANCEL) + EndDialog(hdlg, 0); + break; + + case WM_CLOSE: + EndDialog(hdlg, 0); + break; + } + + return 0; } INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) @@ -39,14 +36,11 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case WM_INITDIALOG: opt_startup = TRUE; LoadSettings(); - ShowHelp(hdlg, SW_HIDE); SetDlgItemText(hdlg, IDC_EDIT_USEPROXY, opt_useProxy); SetDlgItemText(hdlg, IDC_EDIT_NOPROXY, opt_noProxy); CheckDlgButton(hdlg, IDC_CHECK_MIRANDA, opt_miranda ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_CHECK_IE, opt_ie ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_CHECK_FIREFOX, opt_firefox ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_CHECK_SHOWMYIPMENU, opt_showMyIP ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_CHECK_PROXYIPMENU, opt_showProxyIP ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_CHECK_ALWAY_RECONNECT, opt_alwayReconnect ? BST_CHECKED : BST_UNCHECKED); SetDlgItemText(hdlg, IDC_EDIT_HIDEINTF, opt_hideIntf); SendDlgItemMessage(hdlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, opt_bgColor); @@ -68,7 +62,6 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case WM_NOTIFY: switch (((LPNMHDR)lparam)->code) { case PSN_APPLY: - opt_not_restarted = opt_not_restarted || IsDlgButtonChecked(hdlg, IDC_CHECK_PROXYIPMENU) != opt_showProxyIP || IsDlgButtonChecked(hdlg, IDC_CHECK_SHOWMYIPMENU) != opt_showMyIP; ShowWindow(GetDlgItem(hdlg, IDC_RESTARTREQUIRED), opt_not_restarted ? SW_SHOW : SW_HIDE); GetDlgItemText(hdlg, IDC_EDIT_NOPROXY, opt_noProxy, MAX_IPLIST_LENGTH); GetDlgItemText(hdlg, IDC_EDIT_USEPROXY, opt_useProxy, MAX_IPLIST_LENGTH); @@ -76,8 +69,6 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) opt_miranda = IsDlgButtonChecked(hdlg, IDC_CHECK_MIRANDA); opt_ie = IsDlgButtonChecked(hdlg, IDC_CHECK_IE); opt_firefox = IsDlgButtonChecked(hdlg, IDC_CHECK_FIREFOX); - opt_showMyIP = IsDlgButtonChecked(hdlg, IDC_CHECK_SHOWMYIPMENU); - opt_showProxyIP = IsDlgButtonChecked(hdlg, IDC_CHECK_PROXYIPMENU); opt_alwayReconnect = IsDlgButtonChecked(hdlg, IDC_CHECK_ALWAY_RECONNECT); opt_popups = IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS); opt_defaultColors = IsDlgButtonChecked(hdlg, IDC_CHECK_DEFAULTCOLORS); @@ -93,12 +84,13 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case WM_COMMAND: if (opt_startup) return 0; + if (HIWORD(wparam) == BN_CLICKED && GetFocus() == (HWND)lparam && LOWORD(wparam) != IDC_BTN_HELP) SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0); - switch (LOWORD(wparam)) { + switch (LOWORD(wparam)) { case IDC_BTN_HELP: - ShowHelp(hdlg, help_shown == SW_SHOW ? SW_HIDE : SW_SHOW); + DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HELP), 0, HelpProc); break; case IDC_EDIT_USEPROXY: @@ -114,11 +106,6 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0); break; - case IDC_CHECK_PROXYIPMENU: - case IDC_CHECK_SHOWMYIPMENU: - ShowWindow(GetDlgItem(hdlg, IDC_RESTARTREQUIRED), opt_not_restarted || (IsDlgButtonChecked(hdlg, IDC_CHECK_PROXYIPMENU) != opt_showProxyIP || IsDlgButtonChecked(hdlg, IDC_CHECK_SHOWMYIPMENU) != opt_showMyIP) ? SW_SHOW : SW_HIDE); - break; - case IDC_CHECK_DEFAULTCOLORS: case IDC_CHECK_POPUPS: if (!opt_popupPluginInstalled) @@ -156,28 +143,28 @@ int OptInit(WPARAM wParam, LPARAM) void LoadSettings(void) { - DBVARIANT dbv; - if (db_get(NULL, MODULENAME, "UseProxyIPNets", &dbv)) - mir_wstrcpy(opt_useProxy, L""); + ptrW wszStr(db_get_wsa(NULL, MODULENAME, "UseProxyIPNets")); + if (!wszStr) + opt_useProxy[0] = 0; else - mir_wstrcpy(opt_useProxy, dbv.pwszVal); - db_free(&dbv); - if (db_get(NULL, MODULENAME, "NoProxyIPNets", &dbv)) - mir_wstrcpy(opt_noProxy, L""); + wcsncpy_s(opt_useProxy, wszStr, _TRUNCATE); + + wszStr = db_get_wsa(NULL, MODULENAME, "NoProxyIPNets"); + if (!wszStr) + opt_noProxy[0] = 0; else - mir_wstrcpy(opt_noProxy, dbv.pwszVal); - db_free(&dbv); - if (db_get(NULL, MODULENAME, "HideInterfaces", &dbv)) - mir_wstrcpy(opt_hideIntf, L""); + wcsncpy_s(opt_noProxy, wszStr, _TRUNCATE); + + wszStr = db_get_wsa(NULL, MODULENAME, "HideInterfaces"); + if (!wszStr) + opt_hideIntf[0] = 0; else - mir_wstrcpy(opt_hideIntf, dbv.pwszVal); - db_free(&dbv); + wcsncpy_s(opt_hideIntf, wszStr, _TRUNCATE); + opt_miranda = db_get_b(NULL, MODULENAME, "ManageMirandaProxy", TRUE); opt_ie = db_get_b(NULL, MODULENAME, "ManageIEProxy", FALSE); opt_firefox = db_get_b(NULL, MODULENAME, "ManageFirefoxProxy", FALSE) && Firefox_Installed(); opt_alwayReconnect = db_get_b(NULL, MODULENAME, "AlwaysReconnect", FALSE); - opt_showMyIP = db_get_b(NULL, MODULENAME, "ShowMyIP", TRUE); - opt_showProxyIP = db_get_b(NULL, MODULENAME, "ShowProxyIP", TRUE); opt_popups = db_get_b(NULL, MODULENAME, "PopupEnabled", TRUE); opt_defaultColors = db_get_b(NULL, MODULENAME, "PopupDefaultColors", TRUE); opt_showProxyState = db_get_b(NULL, MODULENAME, "ShowProxyStatus", TRUE); @@ -194,8 +181,6 @@ void SaveSettings(void) db_set_b(NULL, MODULENAME, "ManageIEProxy", (BYTE)opt_ie); db_set_b(NULL, MODULENAME, "ManageFirefoxProxy", (BYTE)opt_firefox); db_set_b(NULL, MODULENAME, "AlwaysReconnect", (BYTE)opt_alwayReconnect); - db_set_b(NULL, MODULENAME, "ShowMyIP", (BYTE)opt_showMyIP); - db_set_b(NULL, MODULENAME, "ShowProxyIP", (BYTE)opt_showProxyIP); db_set_b(NULL, MODULENAME, "PopupEnabled", (BYTE)opt_popups); db_set_b(NULL, MODULENAME, "PopupDefaultColors", (BYTE)opt_defaultColors); db_set_b(NULL, MODULENAME, "ShowProxyStatus", (BYTE)opt_showProxyState); diff --git a/plugins/ProxySwitch/src/resource.h b/plugins/ProxySwitch/src/resource.h index 8fa07ce325..5550c2f5a1 100644 --- a/plugins/ProxySwitch/src/resource.h +++ b/plugins/ProxySwitch/src/resource.h @@ -8,6 +8,7 @@ #define IDD_OPTIONS 103 #define IDI_NOTIF_0 104 #define IDI_NOTIF_1 105 +#define IDD_HELP 106 #define IDC_EDIT_USEPROXY 1002 #define IDC_EDIT_NOPROXY 1004 #define IDC_CHECK_DEFAULTCOLORS 1009 @@ -16,8 +17,6 @@ #define IDC_CHECK_IE 1015 #define IDC_CHECK_IE2 1016 #define IDC_CHECK_FIREFOX 1016 -#define IDC_CHECK_SHOWMYIPMENU 1021 -#define IDC_CHECK_PROXYIPMENU 1022 #define IDC_CHECK_ALWAY_RECONNECT 1024 #define IDC_EDIT_HIDEINTF 1025 #define IDC_RESTARTREQUIRED 1026 diff --git a/plugins/ProxySwitch/src/stdafx.h b/plugins/ProxySwitch/src/stdafx.h index 550d21f8ad..0afc33e0dd 100644 --- a/plugins/ProxySwitch/src/stdafx.h +++ b/plugins/ProxySwitch/src/stdafx.h @@ -101,8 +101,6 @@ extern UINT opt_showProxyState; extern UINT opt_miranda; extern UINT opt_ie; extern UINT opt_firefox; -extern UINT opt_showMyIP; -extern UINT opt_showProxyIP; extern UINT opt_alwayReconnect; extern UINT opt_startup; extern UINT opt_not_restarted; |