diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-11-23 23:53:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-28 19:49:26 +0200 |
| commit | f3275bba73347eef03bbe6f7982e8ca25f2aced6 (patch) | |
| tree | 872667cdb63a4e3372b5cd5235d82c5b868fac3b /src/wx/text_view.cc | |
| parent | eda4ed548e51ab1c231205ec141dac3dd6be2ac4 (diff) | |
Save window metrics in the config file (#1575).
Perhaps these should be in a separate GUI file, like how it's done for
Films, but I can't really see a big advantage (and there already
GUI-only details in there).
In this commit we also save the hints dialog size/position and
start it a bit larger (#2892).
Diffstat (limited to 'src/wx/text_view.cc')
| -rw-r--r-- | src/wx/text_view.cc | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/src/wx/text_view.cc b/src/wx/text_view.cc index bde7b09e9..fd647f050 100644 --- a/src/wx/text_view.cc +++ b/src/wx/text_view.cc @@ -42,17 +42,15 @@ using namespace boost::placeholders; #endif -WindowMetrics TextView::_metrics; - - TextView::TextView ( wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content, shared_ptr<TextContent> text, shared_ptr<Decoder> decoder, FilmViewer& viewer ) - : wxDialog(parent, wxID_ANY, _("Captions"), _metrics.position, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + : wxDialog(parent, wxID_ANY, _("Captions"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , _content (content) , _film_viewer (viewer) + , _metrics(std::string{"text"}, { 800, 600 }, this) { - _list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, _metrics.size, wxLC_REPORT | wxLC_SINGLE_SEL); + _list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); { wxListItem ip; @@ -108,31 +106,14 @@ TextView::TextView ( while (!decoder->pass ()) {} SetSizerAndFit (sizer); - _list->Bind(wxEVT_SIZE, boost::bind(&TextView::list_sized, this, _1)); - Bind(wxEVT_MOVE, boost::bind(&TextView::moved, this, _1)); -} - - -void -TextView::list_sized(wxSizeEvent& ev) -{ - _metrics.size = ev.GetSize(); - ev.Skip(); -} - - -void -TextView::moved(wxMoveEvent& ev) -{ - _metrics.position = ClientToScreen({0, 0}); - ev.Skip(); + _metrics.bind(); } void TextView::show() { - _metrics.show(this); + _metrics.show(); } void |
