diff options
author | B. Stack <bgstack15@gmail.com> | 2023-06-20 07:46:53 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2023-06-20 07:46:53 -0400 |
commit | f76994f1fb3e25c4563c9d8afce6bbc86701d1d2 (patch) | |
tree | b39389163603195a0169af57712eb0765e5c11f4 /wx+ | |
parent | add upstream 12.3 (diff) | |
download | FreeFileSync-f76994f1fb3e25c4563c9d8afce6bbc86701d1d2.tar.gz FreeFileSync-f76994f1fb3e25c4563c9d8afce6bbc86701d1d2.tar.bz2 FreeFileSync-f76994f1fb3e25c4563c9d8afce6bbc86701d1d2.zip |
add upstream 12.412.4
Diffstat (limited to 'wx+')
-rw-r--r-- | wx+/grid.cpp | 2 | ||||
-rw-r--r-- | wx+/no_flicker.h | 4 | ||||
-rw-r--r-- | wx+/std_button_layout.h | 2 | ||||
-rw-r--r-- | wx+/tooltip.cpp | 2 | ||||
-rw-r--r-- | wx+/window_tools.h | 37 |
5 files changed, 22 insertions, 25 deletions
diff --git a/wx+/grid.cpp b/wx+/grid.cpp index 306d4847..8d3dbea9 100644 --- a/wx+/grid.cpp +++ b/wx+/grid.cpp @@ -1443,7 +1443,7 @@ private: void setMouseHighlight(const std::optional<MouseHighlight>& hl) { - assert(!hl || hl->row < refParent().getRowCount() && hl->rowHover != HoverArea::none); + assert(!hl || (hl->row < refParent().getRowCount() && hl->rowHover != HoverArea::none)); if (highlight_ != hl) { if (highlight_) diff --git a/wx+/no_flicker.h b/wx+/no_flicker.h index 9f91bbdb..8a461db3 100644 --- a/wx+/no_flicker.h +++ b/wx+/no_flicker.h @@ -22,7 +22,7 @@ namespace void setText(wxTextCtrl& control, const wxString& newText, bool* additionalLayoutChange = nullptr) { const wxString& label = control.GetValue(); //perf: don't call twice! - if (additionalLayoutChange && !*additionalLayoutChange) //never revert from true to false! + if (additionalLayoutChange && !*additionalLayoutChange && control.IsShown()) //never revert from true to false! *additionalLayoutChange = label.length() != newText.length(); //avoid screen flicker: update layout only when necessary if (label != newText) @@ -36,7 +36,7 @@ void setText(wxStaticText& control, const wxString& newText, bool* additionalLay //e.g. "filenames in the sync progress dialog": https://sourceforge.net/p/freefilesync/bugs/279/ const wxString& label = control.GetLabelText(); //perf: don't call twice! - if (additionalLayoutChange && !*additionalLayoutChange) + if (additionalLayoutChange && !*additionalLayoutChange && control.IsShown()) //"better" or overkill(?): IsShownOnScreen() *additionalLayoutChange = label.length() != newText.length(); //avoid screen flicker: update layout only when necessary if (label != newText) diff --git a/wx+/std_button_layout.h b/wx+/std_button_layout.h index fbbee1b7..8abc9e3a 100644 --- a/wx+/std_button_layout.h +++ b/wx+/std_button_layout.h @@ -29,7 +29,7 @@ struct StdButtons }; void setStandardButtonLayout(wxBoxSizer& sizer, const StdButtons& buttons = StdButtons()); -//sizer width will change! => call wxWindow::Fit and wxWindow::Layout +//sizer width will change! => call wxWindow::Fit and wxWindow::Dimensions inline diff --git a/wx+/tooltip.cpp b/wx+/tooltip.cpp index 86b9ec8d..19b6ede7 100644 --- a/wx+/tooltip.cpp +++ b/wx+/tooltip.cpp @@ -78,7 +78,7 @@ void Tooltip::show(const wxString& text, wxPoint mousePos, const wxImage* img) } if (imgChanged || txtChanged) - //tipWindow_->Layout(); -> apparently not needed!? + //tipWindow_->Dimensions(); -> apparently not needed!? tipWindow_->GetSizer()->SetSizeHints(tipWindow_); //~=Fit() + SetMinSize() #ifdef __WXGTK3__ //GTK3 size calculation requires visible window: https://github.com/wxWidgets/wxWidgets/issues/16088 diff --git a/wx+/window_tools.h b/wx+/window_tools.h index 179508f8..19b89176 100644 --- a/wx+/window_tools.h +++ b/wx+/window_tools.h @@ -90,52 +90,50 @@ private: }; -namespace -{ class WindowLayout { public: - struct Layout + struct Dimensions { std::optional<wxSize> size; std::optional<wxPoint> pos; bool isMaximized = false; }; - static void setInitial(wxTopLevelWindow& topWin, const Layout& layout, wxSize defaultSize) + static void setInitial(wxTopLevelWindow& topWin, const Dimensions& dim, wxSize defaultSize) { - initialLayouts_[&topWin] = layout; + initialDims_[&topWin] = dim; wxSize newSize = defaultSize; std::optional<wxPoint> newPos; //set dialog size and position: // - width/height are invalid if the window is minimized (eg x,y = -32000; width = 160, height = 28) // - multi-monitor setup: dialog may be placed on second monitor which is currently turned off - if (layout.size && - layout.size->GetWidth () > 0 && - layout.size->GetHeight() > 0) + if (dim.size && + dim.size->GetWidth () > 0 && + dim.size->GetHeight() > 0) { - if (layout.pos) + if (dim.pos) { //calculate how much of the dialog will be visible on screen - const int dlgArea = layout.size->GetWidth() * layout.size->GetHeight(); + const int dlgArea = dim.size->GetWidth() * dim.size->GetHeight(); int dlgAreaMaxVisible = 0; const int monitorCount = wxDisplay::GetCount(); for (int i = 0; i < monitorCount; ++i) { - wxRect overlap = wxDisplay(i).GetClientArea().Intersect(wxRect(*layout.pos, *layout.size)); + wxRect overlap = wxDisplay(i).GetClientArea().Intersect(wxRect(*dim.pos, *dim.size)); dlgAreaMaxVisible = std::max(dlgAreaMaxVisible, overlap.GetWidth() * overlap.GetHeight()); } if (dlgAreaMaxVisible > 0.1 * dlgArea //at least 10% of the dialog should be visible! ) { - newSize = *layout.size; - newPos = layout.pos; + newSize = *dim.size; + newPos = dim.pos; } } else - newSize = *layout.size; + newSize = *dim.size; } //old comment: "wxGTK's wxWindow::SetSize seems unreliable and behaves like a wxWindow::SetClientSize @@ -150,7 +148,7 @@ public: topWin.Center(); } - if (layout.isMaximized) //no real need to support both maximize and full screen functions + if (dim.isMaximized) //no real need to support both maximize and full screen functions { topWin.Maximize(true); } @@ -191,7 +189,7 @@ public: } //destructive! changes window size! - static Layout getBeforeClose(wxTopLevelWindow& topWin) + static Dimensions getBeforeClose(wxTopLevelWindow& topWin) { //we need to portably retrieve non-iconized, non-maximized size and position // non-portable: Win32 GetWindowPlacement(); wxWidgets take: wxTopLevelWindow::SaveGeometry/RestoreToGeometry() @@ -220,8 +218,8 @@ public: } //reuse previous values if current ones are not available: - if (const auto it = initialLayouts_.find(&topWin); - it != initialLayouts_.end()) + if (const auto it = initialDims_.find(&topWin); + it != initialDims_.end()) { if (!size) size = it->second.size; @@ -256,9 +254,8 @@ public: } private: - inline static std::unordered_map<const wxTopLevelWindow* /*don't access! use as key only!*/, Layout> initialLayouts_; + inline static std::unordered_map<const wxTopLevelWindow* /*don't access! use as key only!*/, Dimensions> initialDims_; }; } -} #endif //FOCUS_1084731021985757843 |