File FreeFileSync-gui.patch of Package FreeFileSync
Index: FreeFileSync-14.9/wx+/dc.h
===================================================================
--- FreeFileSync-14.9.orig/wx+/dc.h
+++ FreeFileSync-14.9/wx+/dc.h
@@ -333,7 +333,6 @@ public:
{
assert(wnd.IsDoubleBuffered());
dc_.emplace<wxPaintDC>(&wnd);
- static_cast<wxDC&>(*this).DisableAutomaticBoundingBoxUpdates(); //MOOOAAAR perf!?
}
operator wxDC& ()
Index: FreeFileSync-14.9/wx+/grid.cpp
===================================================================
--- FreeFileSync-14.9.orig/wx+/grid.cpp
+++ FreeFileSync-14.9/wx+/grid.cpp
@@ -172,7 +172,7 @@
wxRect GridData::drawCellBorder(wxDC& dc, const wxRect& rect) //returns remaining rectangle
{
- drawRectangleBorder(dc, rect, wxSystemSettings::GetColour(wxSYS_COLOUR_GRIDLINES), dipToWxsize(1), wxRIGHT | wxBOTTOM);
+ drawRectangleBorder(dc, rect, wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), dipToWxsize(1), wxRIGHT | wxBOTTOM);
return {rect.x, rect.y, rect.width - dipToWxsize(1), rect.height - dipToWxsize(1)};
}
Index: FreeFileSync-14.9/FreeFileSync/Source/ui/gui_status_handler.cpp
===================================================================
--- FreeFileSync-14.9.orig/FreeFileSync/Source/ui/gui_status_handler.cpp
+++ FreeFileSync-14.9/FreeFileSync/Source/ui/gui_status_handler.cpp
@@ -70,27 +70,33 @@ void StatusHandlerTemporaryPanel::showSt
//case wxAUI_DOCK_CENTRE:
}
+ wxAuiPaneInfoArray& paneArray = mainDlg_.auiMgr_.GetAllPanes();
const bool statusRowTaken = [&]
{
- for (wxAuiPaneInfo& paneInfo : mainDlg_.auiMgr_.GetAllPanes())
+ for (size_t i = 0; i < paneArray.size(); ++i)
+ {
+ const wxAuiPaneInfo& paneInfo = paneArray[i];
//doesn't matter if paneInfo.IsShown() or not! => move down in either case!
if (&paneInfo != &statusPanel &&
paneInfo.dock_layer == statusPanel.dock_layer &&
paneInfo.dock_direction == statusPanel.dock_direction &&
paneInfo.dock_row == statusPanel.dock_row)
return true;
-
+ }
return false;
}();
//move all rows that are in the way one step further
if (statusRowTaken)
- for (wxAuiPaneInfo& paneInfo : mainDlg_.auiMgr_.GetAllPanes())
+ for (size_t i = 0; i < paneArray.size(); ++i)
+ {
+ wxAuiPaneInfo& paneInfo = paneArray[i];
if (&paneInfo != &statusPanel &&
paneInfo.dock_layer == statusPanel.dock_layer &&
paneInfo.dock_direction == statusPanel.dock_direction &&
paneInfo.dock_row >= statusPanel.dock_row)
++paneInfo.dock_row;
+ }
//------------------------------------------------------------------
statusPanel.Show();
Index: FreeFileSync-14.9/wx+/darkmode.cpp
===================================================================
--- FreeFileSync-14.9.orig/wx+/darkmode.cpp
+++ FreeFileSync-14.9/wx+/darkmode.cpp
@@ -53,7 +53,7 @@ void zen::colorThemeInit(wxApp& app, Col
{
assert(!refGlobalColorHook());
- globalDefaultThemeIsDark = wxSystemSettings::GetAppearance().AreAppsDark();
+ globalDefaultThemeIsDark = false;
ZEN_ON_SCOPE_EXIT(if (!refGlobalColorHook()) refGlobalColorHook() = std::make_unique<SysColorsHook>()); //*after* SetAppearance() and despite errors
//caveat: on macOS there are more themes than light/dark: https://developer.apple.com/documentation/appkit/nsappearance/name-swift.struct
@@ -86,10 +86,6 @@ void zen::changeColorTheme(ColorTheme co
try
{
ZEN_ON_SCOPE_SUCCESS(refGlobalColorHook() = std::make_unique<SysColorsHook>()); //*after* SetAppearance()
- if (wxApp::AppearanceResult rv = wxTheApp->SetAppearance(colTheme);
- rv != wxApp::AppearanceResult::Ok)
- throw SysError(formatSystemError("wxApp::SetAppearance",
- rv == wxApp::AppearanceResult::CannotChange ? L"CannotChange" : L"Failure", L"" /*errorMsg*/));
}
catch (const SysError& e) { throw FileError(_("Failed to update the color theme."), e.toString()); }
}
Index: FreeFileSync-14.9/wx+/darkmode.h
===================================================================
--- FreeFileSync-14.9.orig/wx+/darkmode.h
+++ FreeFileSync-14.9/wx+/darkmode.h
@@ -9,14 +9,16 @@
#include <zen/file_error.h>
#include <wx/app.h>
+#include <wx/settings.h>
+enum class Appearance{System,Light,Dark};
namespace zen
{
bool darkModeAvailable();
//support not only "dark mode" but dark themes in general
-using ColorTheme = wxApp::Appearance; //why reinvent the wheel?
+using ColorTheme = Appearance; //why reinvent the wheel?
void colorThemeInit(wxApp& app, ColorTheme colTheme); //throw FileError
void colorThemeCleanup();
@@ -25,4 +27,28 @@ bool equalAppearance(ColorTheme colTheme
void changeColorTheme(ColorTheme colTheme); //throw FileError
}
+struct wxColorHook
+{
+ virtual ~wxColorHook() {}
+ virtual wxColour getColor(wxSystemColour index) const = 0;
+};
+WXDLLIMPEXP_CORE inline std::unique_ptr<wxColorHook>& refGlobalColorHook()
+{
+ static std::unique_ptr<wxColorHook> globalColorHook;
+ return globalColorHook;
+}
+
+
+class WXDLLIMPEXP_CORE wxSystemSettings2 : public wxSystemSettingsNative
+{
+public:
+ static wxColour GetColour(wxSystemColour index)
+ {
+ if (refGlobalColorHook())
+ return refGlobalColorHook()->getColor(index);
+
+ return wxSystemSettingsNative::GetColour(index);
+ }
+};
+
#endif //DARKMODE_H_754298057018
Index: FreeFileSync-14.9/FreeFileSync/Source/ui/main_dlg.cpp
===================================================================
--- FreeFileSync-14.9.orig/FreeFileSync/Source/ui/main_dlg.cpp
+++ FreeFileSync-14.9/FreeFileSync/Source/ui/main_dlg.cpp
@@ -1276,11 +1276,11 @@ void MainDialog::setGlobalCfgOnInit(cons
//--------------------------------------------------------------------------------
m_checkBoxMatchCase->SetValue(globalCfg_.mainDlg.textSearchRespectCase);
-
+ wxAuiPaneInfoArray& paneArray = auiMgr_.GetAllPanes();
//work around wxAuiManager::LoadPerspective overwriting pane captions with old values (might be different language!)
std::vector<std::pair<wxAuiPaneInfo*, wxString>> paneCaptions;
- for (wxAuiPaneInfo& paneInfo : auiMgr_.GetAllPanes())
- paneCaptions.emplace_back(&paneInfo, paneInfo.caption);
+ for (size_t i = 0; i < paneArray.size(); ++i)
+ paneCaptions.emplace_back(&paneArray[i], paneArray[i].caption);
//compare progress dialog minimum sizes are layout-dependent + can't be changed by user => don't load stale values from config
std::vector<std::tuple<wxAuiPaneInfo*, wxSize /*min size*/, wxSize /*best size*/>> paneConstraints;
@@ -3144,8 +3144,8 @@ void MainDialog::onSetLayoutContext(wxMo
//----------------------------------------------------------------------------------------
bool addedSeparator = false;
-
- for (wxAuiPaneInfo& paneInfo : auiMgr_.GetAllPanes())
+ const wxAuiPaneInfoArray& paneArray = auiMgr_.GetAllPanes();
+ for (size_t i = 0; i < paneArray.size(); ++i){ wxAuiPaneInfo& paneInfo = paneArray[i];
if (!paneInfo.IsShown() &&
paneInfo.window != compareStatus_->getAsWindow() &&
paneInfo.window != m_panelLog &&
@@ -3163,7 +3163,7 @@ void MainDialog::onSetLayoutContext(wxMo
this->auiMgr_.Update();
});
}
-
+ }
menu.popup(*this);
}