summaryrefslogtreecommitdiff
path: root/src/wx/text_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-18 11:41:44 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-18 11:59:54 +0200
commitd8fc4fd042a3ae62ab1b258dbfa032bc7a933dc2 (patch)
tree1bc928ffd7f87a82fd15e511fcaf9dc59fc8863f /src/wx/text_view.cc
parent1aa976b08e0cb7430adeb6c243e1cb9c7b330365 (diff)
Remember position and size of caption list view.
Diffstat (limited to 'src/wx/text_view.cc')
-rw-r--r--src/wx/text_view.cc32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/wx/text_view.cc b/src/wx/text_view.cc
index 7e5267886..7f60e79f0 100644
--- a/src/wx/text_view.cc
+++ b/src/wx/text_view.cc
@@ -42,14 +42,17 @@ 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"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+ : wxDialog(parent, wxID_ANY, _("Captions"), _metrics.position, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, _content (content)
, _film_viewer (viewer)
{
- _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL);
+ _list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, _metrics.size, wxLC_REPORT | wxLC_SINGLE_SEL);
{
wxListItem ip;
@@ -104,10 +107,35 @@ 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();
+}
+
+
+void
+TextView::show()
+{
+ _metrics.show(this);
+}
+
+void
TextView::data_start (ContentStringText cts)
{
for (auto const& i: cts.subs) {