+
+ void first_shown(wxWindow* top, wxWindow* bottom)
+ {
+ int const sn = wxDisplay::GetFromWindow(this);
+ /* Fallback for when GetFromWindow fails for reasons that aren't clear */
+ int pos = -600;
+ if (sn >= 0) {
+ wxRect const screen = wxDisplay(sn).GetClientArea();
+ /* This is a hack to try and make the content notebook a sensible size; large on big displays but small
+ enough on small displays to leave space for the content area.
+ */
+ pos = screen.height > 800 ? -600 : -_top_panel_minimum_size;
+ }
+ SplitHorizontally(top, bottom, Config::instance()->main_content_divider_sash_position().get_value_or(pos));
+ _first_shown = true;
+ }
+
+private:
+ void sized(wxSizeEvent& ev)
+ {
+ auto const height = GetSize().GetHeight();
+ if (_first_shown && (!_last_height || *_last_height != height) && height > _top_panel_minimum_size && GetSashPosition() < _top_panel_minimum_size) {
+ /* The window is now fairly big but the top panel is small; this happens when the DCP-o-matic window
+ * is shrunk and then made larger again. Try to set a sensible top panel size in this case (#1839).
+ */
+ SetSashPosition(Config::instance()->main_content_divider_sash_position().get_value_or(_top_panel_minimum_size));
+ }
+
+ ev.Skip ();
+ _last_height = height;
+ }
+
+ bool _first_shown = false;
+ int const _top_panel_minimum_size = 350;
+ boost::optional<int> _last_height;