diff --git a/localization.c b/localization.c index 50fb1ec7..f62eb96e 100644 --- a/localization.c +++ b/localization.c @@ -38,6 +38,7 @@ #include "options.h" #include "registry.h" #include "misc.h" +#include "tray.h" extern options_t o; @@ -304,8 +305,27 @@ LoadLocalizedIconEx(const UINT iconId, int cxDesired, int cyDesired) { LANGID langId = GetGUILanguage(); + UINT iconId_pref = iconId; + if (o.use_legacy_icons) + { + switch(iconId) + { + case ID_ICO_CONNECTED: + iconId_pref = ID_ICO_CONNECTED_LEGACY; + break; + case ID_ICO_DISCONNECTED: + case ID_ICO_IDLE_ERR: + iconId_pref = ID_ICO_DISCONNECTED_LEGACY; + break; + case ID_ICO_CONNECTING: + case ID_ICO_CONNECTED_ERR: + iconId_pref = ID_ICO_CONNECTING_LEGACY; + break; + } + } + HICON hIcon = - (HICON) LoadImage (o.hInstance, MAKEINTRESOURCE(iconId), + (HICON) LoadImage (o.hInstance, MAKEINTRESOURCE(iconId_pref), IMAGE_ICON, cxDesired, cyDesired, LR_DEFAULTSIZE|LR_SHARED); if (hIcon) return hIcon; @@ -316,7 +336,7 @@ LoadLocalizedIconEx(const UINT iconId, int cxDesired, int cyDesired) * from the first image in the resource */ /* find group icon resource */ - HRSRC res = FindResourceLang(RT_GROUP_ICON, MAKEINTRESOURCE(iconId), langId); + HRSRC res = FindResourceLang(RT_GROUP_ICON, MAKEINTRESOURCE(iconId_pref), langId); if (res == NULL) return NULL; @@ -553,6 +573,8 @@ GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPar Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_PLAP_REG), BST_CHECKED); if (o.enable_auto_restart) Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_AUTO_RESTART), BST_CHECKED); + if (o.use_legacy_icons) + Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_LEGACY_ICONS), BST_CHECKED); break; @@ -601,7 +623,9 @@ GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPar (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_SHOW_SCRIPT_WIN)) == BST_CHECKED); o.enable_auto_restart = (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_AUTO_RESTART)) == BST_CHECKED); - + o.use_legacy_icons = + (Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_LEGACY_ICONS)) == BST_CHECKED); + CheckAndSetTrayIcon(); /* in case icons changed */ SaveRegistryKeys(); diff --git a/openvpn-gui-res.h b/openvpn-gui-res.h index fcc45dd8..f8f4680f 100644 --- a/openvpn-gui-res.h +++ b/openvpn-gui-res.h @@ -27,6 +27,11 @@ #define ID_ICO_CONNECTED 91 #define ID_ICO_CONNECTING 92 #define ID_ICO_DISCONNECTED 93 +#define ID_ICO_CONNECTED_ERR 94 +#define ID_ICO_IDLE_ERR 95 +#define ID_ICO_CONNECTED_LEGACY 96 +#define ID_ICO_CONNECTING_LEGACY 97 +#define ID_ICO_DISCONNECTED_LEGACY 98 /* About Dialog */ #define ID_DLG_ABOUT 100 @@ -124,6 +129,9 @@ #define ID_EDT_PROXY_USER 251 #define ID_EDT_PROXY_PASS 252 +/* General Settings continued */ +#define ID_CHK_LEGACY_ICONS 260 + /* Advanced dialog */ #define ID_DLG_ADVANCED 270 #define ID_TXT_FOLDER 271 diff --git a/options.c b/options.c index 690e1be1..4bb90f49 100644 --- a/options.c +++ b/options.c @@ -379,6 +379,7 @@ InitOptions(options_t *opt) opt->version = MakeVersion (PACKAGE_VERSION_RESOURCE); opt->clr_warning = RGB(0xff, 0, 0); opt->clr_error = RGB(0xff, 0, 0); + opt->use_legacy_icons = 1; } diff --git a/options.h b/options.h index 72757a69..5e445489 100644 --- a/options.h +++ b/options.h @@ -245,6 +245,7 @@ typedef struct { TCHAR *action_arg; HANDLE session_semaphore; HANDLE event_log; + DWORD use_legacy_icons; } options_t; void InitOptions(options_t *); diff --git a/registry.c b/registry.c index 88cb17b2..4f8359fb 100644 --- a/registry.c +++ b/registry.c @@ -67,7 +67,8 @@ struct regkey_int { {L"management_port_offset", &o.mgmt_port_offset, 25340}, {L"enable_peristent_connections", &o.enable_persistent, 2}, {L"enable_auto_restart", &o.enable_auto_restart, 1}, - {L"ovpn_engine", &o.ovpn_engine, OPENVPN_ENGINE_OVPN2} + {L"ovpn_engine", &o.ovpn_engine, OPENVPN_ENGINE_OVPN2}, + {L"use_legacy_icons", &o.use_legacy_icons, 1}, }; static int diff --git a/res/connected.ico b/res/connected.ico index 5d3b5c46..f650d731 100644 Binary files a/res/connected.ico and b/res/connected.ico differ diff --git a/res/connected_error.ico b/res/connected_error.ico new file mode 100644 index 00000000..d3faad49 Binary files /dev/null and b/res/connected_error.ico differ diff --git a/res/connected_old.ico b/res/connected_old.ico new file mode 100644 index 00000000..5d3b5c46 Binary files /dev/null and b/res/connected_old.ico differ diff --git a/res/connecting.ico b/res/connecting.ico index 46364c12..66f2e7ac 100644 Binary files a/res/connecting.ico and b/res/connecting.ico differ diff --git a/res/connecting_old.ico b/res/connecting_old.ico new file mode 100644 index 00000000..46364c12 Binary files /dev/null and b/res/connecting_old.ico differ diff --git a/res/disconnected.ico b/res/disconnected.ico index 5768ffaf..9f2389b3 100644 Binary files a/res/disconnected.ico and b/res/disconnected.ico differ diff --git a/res/disconnected_old.ico b/res/disconnected_old.ico new file mode 100644 index 00000000..5768ffaf Binary files /dev/null and b/res/disconnected_old.ico differ diff --git a/res/idle_error.ico b/res/idle_error.ico new file mode 100644 index 00000000..934d33a2 Binary files /dev/null and b/res/idle_error.ico differ diff --git a/res/openvpn-gui-res-en.rc b/res/openvpn-gui-res-en.rc index 42117efd..569c967a 100644 --- a/res/openvpn-gui-res-en.rc +++ b/res/openvpn-gui-res-en.rc @@ -174,7 +174,7 @@ BEGIN GROUPBOX "Startup", 202, 6, 47, 235, 30 AUTOCHECKBOX "Launch on User &Logon", ID_CHK_STARTUP, 17, 59, 100, 12 - GROUPBOX "Preferences", ID_GROUPBOX3, 6, 82, 235, 165 + GROUPBOX "Preferences", ID_GROUPBOX3, 6, 82, 235, 180 AUTOCHECKBOX "A&ppend to log", ID_CHK_LOG_APPEND, 17, 95, 60, 10 AUTOCHECKBOX "Show script &window", ID_CHK_SHOW_SCRIPT_WIN, 17, 110, 200, 10 AUTOCHECKBOX "S&ilent connection", ID_CHK_SILENT, 17, 125, 200, 10 @@ -189,6 +189,7 @@ BEGIN AUTORADIOBUTTON "&Disable", ID_RB_BALLOON5, 181, 200, 40, 10 AUTOCHECKBOX "Enable Pre-Logon A&ccess Provider (requires admin access)", ID_CHK_PLAP_REG, 17, 215, 200, 10 AUTOCHECKBOX "Enable auto restart of active connections", ID_CHK_AUTO_RESTART, 17, 230, 200, 10 + AUTOCHECKBOX "Use legacy icons", ID_CHK_LEGACY_ICONS, 17, 245, 200, 10 END /* Advanced Dialog */ diff --git a/res/openvpn-gui-res.rc b/res/openvpn-gui-res.rc index c4fbc31d..0f440c9d 100644 --- a/res/openvpn-gui-res.rc +++ b/res/openvpn-gui-res.rc @@ -38,6 +38,11 @@ ID_ICO_APP ICON DISCARDABLE "openvpn-gui.ico" ID_ICO_CONNECTED ICON DISCARDABLE "connected.ico" ID_ICO_CONNECTING ICON DISCARDABLE "connecting.ico" ID_ICO_DISCONNECTED ICON DISCARDABLE "disconnected.ico" +ID_ICO_CONNECTED_ERR ICON DISCARDABLE "connected_error.ico" +ID_ICO_IDLE_ERR ICON DISCARDABLE "idle_error.ico" +ID_ICO_CONNECTED_LEGACY ICON DISCARDABLE "connected_old.ico" +ID_ICO_CONNECTING_LEGACY ICON DISCARDABLE "connecting_old.ico" +ID_ICO_DISCONNECTED_LEGACY ICON DISCARDABLE "disconnected_old.ico" #ifdef ENABLE_OVPN3 #define ADVANCED_DIALOG_HEIGHT 320