if (decoder) {
_text_view.reset(this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer());
- _text_view->Show ();
+ _text_view->show();
}
}
#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;
}
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)
{
*/
+
+#include "window_metrics.h"
#include "lib/content_text.h"
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/wx.h>
LIBDCP_ENABLE_WARNINGS
+
class Decoder;
class FilmViewer;
class Film;
+
class TextView : public wxDialog
{
public:
FilmViewer& viewer
);
+ void show();
+
private:
void data_start (ContentStringText cts);
void data_stop (dcpomatic::ContentTime time);
void subtitle_selected (wxListEvent &);
+ void moved(wxMoveEvent& ev);
+ void list_sized(wxSizeEvent& ev);
wxListCtrl* _list;
int _subs;
std::vector<dcpomatic::ContentTime> _start_times;
std::weak_ptr<Content> _content;
FilmViewer& _film_viewer;
+
+ static WindowMetrics _metrics;
};
--- /dev/null
+/*
+ Copyright (C) 2024 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "window_metrics.h"
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
+#include <wx/app.h>
+#include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
+
+
+void
+WindowMetrics::show(wxWindow* window) const
+{
+#ifdef DCPOMATIC_LINUX
+ auto const position_before = position;
+#endif
+
+ window->Show();
+
+#ifdef DCPOMATIC_LINUX
+ wxTheApp->CallAfter([window, position_before] {
+ window->SetPosition(position_before);
+ });
+#endif
+}
+
--- /dev/null
+/*
+ Copyright (C) 2024 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
+#include <wx/gdicmn.h>
+LIBDCP_ENABLE_WARNINGS
+
+
+class wxWindow;
+
+
+class WindowMetrics
+{
+public:
+ void show(wxWindow* window) const;
+
+ wxPoint position = wxDefaultPosition;
+ wxSize size = wxDefaultSize;
+};
+
video_view.cc
video_waveform_dialog.cc
video_waveform_plot.cc
+ window_metrics.cc
wx_signal_manager.cc
wx_util.cc
wx_variant.cc