From 74d368f4db202ee18e0fbfb2b2abff18567320d7 Mon Sep 17 00:00:00 2001 From: henrypp Date: Thu, 5 Oct 2017 22:14:42 +0600 Subject: [PATCH] 2.0.15 --- CHANGELOG.md | 7 +++++++ bin/History.txt | 7 +++++++ src/app.hpp | 4 ++-- src/main.cpp | 40 ++++++++++++++++++++++++++++++---------- src/main.hpp | 1 + 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d4d13f..07569701 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +v2.0.15 (6 October 2017) ++ make current settings backup before import +- changed default listview font +- fixed settings listview groups does not changed immediately +- fixed notification window display at startup +- fixed uninstaller do not removed some files + v2.0.14 (5 October 2017) + apply settings on demand (too much faster) - revert listen connections blocking feature (request) diff --git a/bin/History.txt b/bin/History.txt index 47d4d13f..07569701 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -1,3 +1,10 @@ +v2.0.15 (6 October 2017) ++ make current settings backup before import +- changed default listview font +- fixed settings listview groups does not changed immediately +- fixed notification window display at startup +- fixed uninstaller do not removed some files + v2.0.14 (5 October 2017) + apply settings on demand (too much faster) - revert listen connections blocking feature (request) diff --git a/src/app.hpp b/src/app.hpp index 84703092..22a91732 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -6,8 +6,8 @@ #define APP_NAME L"simplewall" #define APP_NAME_SHORT L"simplewall" -#define APP_VERSION L"2.0.14" -#define APP_VERSION_RES 2,0,14,0 +#define APP_VERSION L"2.0.15" +#define APP_VERSION_RES 2,0,15,0 #define APP_COPYRIGHT L"(c) 2016, 2017 " _APP_AUTHOR L". All Rights Reserved." #define _APP_BETA_RC diff --git a/src/main.cpp b/src/main.cpp index 5932e0b6..3db7bf3a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -221,7 +221,7 @@ bool _app_listviewinitfont (PLOGFONT plf) if (!plf) return false; - rstring buffer = app.ConfigGet (L"Font", nullptr); + rstring buffer = app.ConfigGet (L"Font", UI_FONT_DEFAULT); if (buffer.IsEmpty ()) { @@ -3074,7 +3074,7 @@ void _app_notifycreatewindow () const UINT height = app.GetDPI (NOTIFY_HEIGHT); const UINT spacer = app.GetDPI (NOTIFY_SPACER); - config.hnotification = CreateWindowEx (WS_EX_TOOLWINDOW | WS_EX_TOPMOST, NOTIFY_CLASS_DLG, APP_NAME, WS_POPUP, 0, 0, width, height, nullptr, nullptr, wcex.hInstance, nullptr); + config.hnotification = CreateWindowEx (WS_EX_TOOLWINDOW | WS_EX_TOPMOST, NOTIFY_CLASS_DLG, nullptr, WS_POPUP, 0, 0, width, height, nullptr, nullptr, wcex.hInstance, nullptr); if (!config.hnotification) { @@ -5151,7 +5151,7 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) _r_spinlock (&config.lock_checkbox); - _r_listview_setitem (hwnd, IDC_EDITOR, ptr_rule->name, i, 0); + _r_listview_setitem (hwnd, IDC_EDITOR, ptr_rule->name, i, 0, ptr_rule->is_block ? 1 : 0, group_id); _r_listview_setitem (hwnd, IDC_EDITOR, dir, i, 1); _r_listview_setitem (hwnd, IDC_EDITOR, protocol, i, 2); _r_listview_setitem (hwnd, IDC_EDITOR, af, i, 3); @@ -5200,8 +5200,7 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) case _RM_CLOSE: { - _app_profilesave (app.GetHWND ()); - break; + return TRUE; } case _RM_MESSAGE: @@ -5283,6 +5282,9 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) if (page->dlg_id == IDD_SETTINGS_RULES_BLOCKLIST || page->dlg_id == IDD_SETTINGS_RULES_SYSTEM) rules_config[ptr_rule->name] = new_val; + + _app_profilesave (app.GetHWND ()); + settings_callback (page->hwnd, _RM_LOCALIZE, nullptr, page); } } } @@ -5463,6 +5465,7 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) if (ctrl_id != IDC_EDITOR) break; + HMENU menu = LoadMenu (nullptr, MAKEINTRESOURCE (IDM_EDITOR)), submenu = GetSubMenu (menu, 0); // localize @@ -5529,8 +5532,10 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) { rules_custom.push_back (ptr_rule); - settings_callback (page->hwnd, _RM_INITIALIZE, nullptr, page); // reinititalize page - settings_callback (page->hwnd, _RM_LOCALIZE, nullptr, page); // reinititalize page + _app_profilesave (app.GetHWND ()); + + settings_callback (page->hwnd, _RM_INITIALIZE, nullptr, page); + settings_callback (page->hwnd, _RM_LOCALIZE, nullptr, page); } else { @@ -5556,6 +5561,8 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) if (ptr && DialogBoxParam (nullptr, MAKEINTRESOURCE (IDD_EDITOR), hwnd, &EditorProc, (LPARAM)ptr)) { + _app_profilesave (app.GetHWND ()); + settings_callback (page->hwnd, _RM_LOCALIZE, nullptr, page); // re-inititalize page } } @@ -5599,6 +5606,8 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) } } + _app_profilesave (app.GetHWND ()); + _r_listview_redraw (hwnd, IDC_EDITOR); break; @@ -5644,6 +5653,10 @@ BOOL settings_callback (HWND hwnd, DWORD msg, LPVOID lpdata1, LPVOID lpdata2) _r_spinunlock (&config.lock_checkbox); } } + + _app_profilesave (app.GetHWND ()); + + settings_callback (page->hwnd, _RM_LOCALIZE, nullptr, page); // re-inititalize page } break; @@ -7656,6 +7669,13 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) if (GetOpenFileName (&ofn)) { + // make backup + if (LOWORD (wparam) == IDM_IMPORT_APPS) + _r_fs_copy (config.apps_path, _r_fmt (L"%s.bak", config.apps_path)); + + else if (LOWORD (wparam) == IDM_IMPORT_RULES) + _r_fs_copy (config.rules_custom_path, _r_fmt (L"%s.bak", config.rules_custom_path)); + _app_profileload (hwnd, ((LOWORD (wparam) == IDM_IMPORT_APPS) ? path : nullptr), ((LOWORD (wparam) == IDM_IMPORT_RULES) ? path : nullptr)); _app_profilesave (hwnd); @@ -7756,7 +7776,7 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) } else { - app.ConfigSet (L"Font", nullptr); + app.ConfigSet (L"Font", UI_FONT_DEFAULT); } _app_listviewsetfont (hwnd, IDC_LISTVIEW); @@ -8274,10 +8294,10 @@ INT_PTR CALLBACK DlgProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) break; } -} + } return FALSE; - } +} INT APIENTRY wWinMain (HINSTANCE, HINSTANCE, LPWSTR, INT) diff --git a/src/main.hpp b/src/main.hpp index 52bf674f..8081276b 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -32,6 +32,7 @@ #define TAB_SPACE L" " #define ERR_FORMAT L"%s() failed with error code 0x%.8lx (%s)" #define RULE_DELIMETER L";" +#define UI_FONT_DEFAULT L"Segoe UI Light;10;300" // notification timer #define NOTIFY_WIDTH 368