*/
#include "wx/control_film_viewer.h"
+#include "wx/film_viewer.h"
#include "wx/film_editor.h"
#include "wx/job_manager_view.h"
#include "wx/full_config_dialog.h"
*/
wxPanel* overall_panel = new wxPanel (this, wxID_ANY);
- _film_viewer = new ControlFilmViewer (overall_panel);
+ _film_viewer.reset (new FilmViewer (overall_panel));
+ _controls = new Controls (overall_panel, _film_viewer);
_film_editor = new FilmEditor (overall_panel, _film_viewer);
JobManagerView* job_manager_view = new JobManagerView (overall_panel, false);
wxBoxSizer* right_sizer = new wxBoxSizer (wxVERTICAL);
- right_sizer->Add (_film_viewer, 2, wxEXPAND | wxALL, 6);
+ right_sizer->Add (_film_viewer->panel(), 2, wxEXPAND | wxALL, 6);
+ right_sizer->Add (_controls, 0, wxEXPAND | wxALL, 6);
right_sizer->Add (job_manager_view, 1, wxEXPAND | wxALL, 6);
wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
void back_frame ()
{
- _film_viewer->back_frame ();
+ _film_viewer->move (-_film_viewer->one_video_frame());
}
void forward_frame ()
{
- _film_viewer->forward_frame ();
+ _film_viewer->move (_film_viewer->one_video_frame());
}
FilmEditor* _film_editor;
- ControlFilmViewer* _film_viewer;
+ boost::shared_ptr<FilmViewer> _film_viewer;
+ Controls* _controls;
VideoWaveformDialog* _video_waveform_dialog;
HintsDialog* _hints_dialog;
ServersListDialog* _servers_list_dialog;
*/
+
+#include "wx/wx_signal_manager.h"
+#include "wx/wx_util.h"
+#include "wx/about_dialog.h"
+#include "wx/report_problem_dialog.h"
+#include "wx/film_viewer.h"
+#include "wx/player_information.h"
+#include "wx/update_dialog.h"
+#include "wx/player_config_dialog.h"
+#include "wx/verify_dcp_dialog.h"
+#include "wx/control_film_viewer.h"
#include "lib/cross.h"
#include "lib/config.h"
#include "lib/util.h"
#include "lib/examine_content_job.h"
#include "lib/server.h"
#include "lib/dcpomatic_socket.h"
-#include "wx/wx_signal_manager.h"
-#include "wx/wx_util.h"
-#include "wx/about_dialog.h"
-#include "wx/report_problem_dialog.h"
-#include "wx/control_film_viewer.h"
-#include "wx/player_information.h"
-#include "wx/update_dialog.h"
-#include "wx/player_config_dialog.h"
-#include "wx/verify_dcp_dialog.h"
#include <wx/wx.h>
#include <wx/stdpaths.h>
#include <wx/splash.h>
, _history_items (0)
, _history_position (0)
, _history_separator (0)
- , _viewer (0)
{
#if defined(DCPOMATIC_WINDOWS)
*/
wxPanel* overall_panel = new wxPanel (this, wxID_ANY);
- _viewer = new ControlFilmViewer (overall_panel, false, false);
+ _viewer.reset (new FilmViewer (overall_panel));
+ _controls = new Controls (overall_panel, _viewer);
_viewer->set_dcp_decode_reduction (Config::instance()->decode_reduction ());
_info = new PlayerInformation (overall_panel, _viewer);
wxSizer* main_sizer = new wxBoxSizer (wxVERTICAL);
- main_sizer->Add (_viewer, 1, wxEXPAND | wxALL, 6);
+ main_sizer->Add (_viewer->panel(), 1, wxEXPAND | wxALL, 6);
+ main_sizer->Add (_controls, 0, wxEXPAND | wxALL, 6);
main_sizer->Add (_info, 0, wxEXPAND | wxALL, 6);
overall_panel->SetSizer (main_sizer);
void back_frame ()
{
- _viewer->back_frame ();
+ _viewer->move (-_viewer->one_video_frame());
}
void forward_frame ()
{
- _viewer->forward_frame ();
+ _viewer->move (_viewer->one_video_frame());
}
private:
int _history_items;
int _history_position;
wxMenuItem* _history_separator;
- ControlFilmViewer* _viewer;
+ shared_ptr<FilmViewer> _viewer;
+ Controls* _controls;
boost::shared_ptr<Film> _film;
boost::signals2::scoped_connection _config_changed_connection;
wxMenuItem* _file_add_ov;
#include "timing_panel.h"
#include "timeline_dialog.h"
#include "image_sequence_dialog.h"
-#include "control_film_viewer.h"
+#include "film_viewer.h"
#include "lib/audio_content.h"
#include "lib/text_content.h"
#include "lib/video_content.h"
#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr<Film> film, ControlFilmViewer* viewer)
+ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
: _video_panel (0)
, _audio_panel (0)
, _timeline_dialog (0)
}
if (go_to && Config::instance()->jump_to_selected() && signal_manager) {
- signal_manager->when_idle(boost::bind(&ControlFilmViewer::set_position, _film_viewer, go_to.get().ceil(_film->video_frame_rate())));
+ shared_ptr<FilmViewer> fv = _film_viewer.lock ();
+ DCPOMATIC_ASSERT (fv);
+ signal_manager->when_idle(boost::bind(&FilmViewer::set_position, fv.get(), go_to.get().ceil(_film->video_frame_rate())));
}
if (_timeline_dialog) {
class AudioPanel;
class TimingPanel;
class Film;
-class ControlFilmViewer;
+class FilmViewer;
class ContentPanel : public boost::noncopyable
{
public:
- ContentPanel (wxNotebook *, boost::shared_ptr<Film>, ControlFilmViewer* viewer);
+ ContentPanel (wxNotebook *, boost::shared_ptr<Film>, boost::weak_ptr<FilmViewer> viewer);
boost::shared_ptr<Film> film () const {
return _film;
bool remove_clicked (bool hotkey);
void timeline_clicked ();
- ControlFilmViewer* film_viewer () const {
+ boost::weak_ptr<FilmViewer> film_viewer () const {
return _film_viewer;
}
wxWindow* _last_selected_tab;
boost::shared_ptr<Film> _film;
- ControlFilmViewer* _film_viewer;
+ boost::weak_ptr<FilmViewer> _film_viewer;
bool _generally_sensitive;
bool _ignore_deselect;
};
/** @param outline_content true if viewer should present an "outline content" checkbox.
* @param jump_to_selected true if viewer should present a "jump to selected" checkbox.
*/
-ControlFilmViewer::ControlFilmViewer (wxWindow* parent, bool outline_content, bool jump_to_selected)
+Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outline_content, bool jump_to_selected)
: wxPanel (parent)
- , _viewer (new FilmViewer(this))
+ , _viewer (viewer)
, _slider_being_moved (false)
, _was_running_before_slider (false)
, _outline_content (0)
{
_v_sizer = new wxBoxSizer (wxVERTICAL);
SetSizer (_v_sizer);
- _v_sizer->Add (_viewer->panel(), 1, wxEXPAND);
wxBoxSizer* view_options = new wxBoxSizer (wxHORIZONTAL);
if (outline_content) {
_back_button->SetMinSize (wxSize (32, -1));
_forward_button->SetMinSize (wxSize (32, -1));
- _eye->Bind (wxEVT_CHOICE, boost::bind (&ControlFilmViewer::eye_changed, this));
+ _eye->Bind (wxEVT_CHOICE, boost::bind (&Controls::eye_changed, this));
if (_outline_content) {
- _outline_content->Bind (wxEVT_CHECKBOX, boost::bind (&ControlFilmViewer::outline_content_changed, this));
+ _outline_content->Bind (wxEVT_CHECKBOX, boost::bind (&Controls::outline_content_changed, this));
}
- _slider->Bind (wxEVT_SCROLL_THUMBTRACK, boost::bind (&ControlFilmViewer::slider_moved, this, false));
- _slider->Bind (wxEVT_SCROLL_PAGEUP, boost::bind (&ControlFilmViewer::slider_moved, this, true));
- _slider->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind (&ControlFilmViewer::slider_moved, this, true));
- _slider->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind (&ControlFilmViewer::slider_released, this));
- _play_button->Bind (wxEVT_TOGGLEBUTTON, boost::bind (&ControlFilmViewer::play_clicked, this));
- _rewind_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&ControlFilmViewer::rewind_clicked, this, _1));
- _back_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&ControlFilmViewer::back_clicked, this, _1));
- _forward_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&ControlFilmViewer::forward_clicked, this, _1));
- _frame_number->Bind (wxEVT_LEFT_DOWN, boost::bind (&ControlFilmViewer::frame_number_clicked, this));
- _timecode->Bind (wxEVT_LEFT_DOWN, boost::bind (&ControlFilmViewer::timecode_clicked, this));
+ _slider->Bind (wxEVT_SCROLL_THUMBTRACK, boost::bind (&Controls::slider_moved, this, false));
+ _slider->Bind (wxEVT_SCROLL_PAGEUP, boost::bind (&Controls::slider_moved, this, true));
+ _slider->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind (&Controls::slider_moved, this, true));
+ _slider->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind (&Controls::slider_released, this));
+ _play_button->Bind (wxEVT_TOGGLEBUTTON, boost::bind (&Controls::play_clicked, this));
+ _rewind_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::rewind_clicked, this, _1));
+ _back_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::back_clicked, this, _1));
+ _forward_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::forward_clicked, this, _1));
+ _frame_number->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::frame_number_clicked, this));
+ _timecode->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::timecode_clicked, this));
if (_jump_to_selected) {
- _jump_to_selected->Bind (wxEVT_CHECKBOX, boost::bind (&ControlFilmViewer::jump_to_selected_clicked, this));
+ _jump_to_selected->Bind (wxEVT_CHECKBOX, boost::bind (&Controls::jump_to_selected_clicked, this));
_jump_to_selected->SetValue (Config::instance()->jump_to_selected ());
}
- _viewer->ImageChanged.connect (boost::bind(&ControlFilmViewer::image_changed, this, _1));
- _viewer->PositionChanged.connect (boost::bind(&ControlFilmViewer::position_changed, this));
- _viewer->Started.connect (boost::bind(&ControlFilmViewer::started, this));
- _viewer->Stopped.connect (boost::bind(&ControlFilmViewer::stopped, this));
+ _viewer->PositionChanged.connect (boost::bind(&Controls::position_changed, this));
+ _viewer->Started.connect (boost::bind(&Controls::started, this));
+ _viewer->Stopped.connect (boost::bind(&Controls::stopped, this));
+ _viewer->FilmChanged.connect (boost::bind(&Controls::film_changed, this));
- set_film (shared_ptr<Film> ());
+ film_changed ();
setup_sensitivity ();
JobManager::instance()->ActiveJobsChanged.connect (
- bind (&ControlFilmViewer::active_jobs_changed, this, _2)
+ bind (&Controls::active_jobs_changed, this, _2)
);
}
void
-ControlFilmViewer::started ()
+Controls::started ()
{
_play_button->SetValue (true);
}
void
-ControlFilmViewer::stopped ()
+Controls::stopped ()
{
_play_button->SetValue (false);
}
void
-ControlFilmViewer::position_changed ()
+Controls::position_changed ()
{
update_position_label ();
update_position_slider ();
}
void
-ControlFilmViewer::eye_changed ()
+Controls::eye_changed ()
{
_viewer->set_eyes (_eye->GetSelection() == 0 ? EYES_LEFT : EYES_RIGHT);
}
void
-ControlFilmViewer::outline_content_changed ()
+Controls::outline_content_changed ()
{
_viewer->set_outline_content (_outline_content->GetValue());
}
void
-ControlFilmViewer::film_change (ChangeType type, Film::Property p)
+Controls::film_change (ChangeType type, Film::Property p)
{
if (type != CHANGE_TYPE_DONE) {
return;
}
}
-void
-ControlFilmViewer::image_changed (weak_ptr<PlayerVideo> pv)
-{
- ImageChanged (pv);
-}
-
/** @param page true if this was a PAGEUP/PAGEDOWN event for which we won't receive a THUMBRELEASE */
void
-ControlFilmViewer::slider_moved (bool page)
+Controls::slider_moved (bool page)
{
if (!_film) {
return;
if (!page && !_slider_being_moved) {
/* This is the first event of a drag; stop playback for the duration of the drag */
- _was_running_before_slider = stop ();
+ _was_running_before_slider = _viewer->stop ();
_slider_being_moved = true;
}
}
void
-ControlFilmViewer::slider_released ()
+Controls::slider_released ()
{
if (_was_running_before_slider) {
/* Restart after a drag */
- start ();
+ _viewer->start ();
}
_slider_being_moved = false;
}
void
-ControlFilmViewer::play_clicked ()
+Controls::play_clicked ()
{
check_play_state ();
}
void
-ControlFilmViewer::check_play_state ()
+Controls::check_play_state ()
{
if (!_film || _film->video_frame_rate() == 0) {
return;
}
if (_play_button->GetValue()) {
- start ();
+ _viewer->start ();
} else {
- stop ();
+ _viewer->stop ();
}
}
void
-ControlFilmViewer::update_position_slider ()
+Controls::update_position_slider ()
{
if (!_film) {
_slider->SetValue (0);
}
void
-ControlFilmViewer::update_position_label ()
+Controls::update_position_label ()
{
if (!_film) {
_frame_number->SetLabel ("0");
}
void
-ControlFilmViewer::active_jobs_changed (optional<string> j)
+Controls::active_jobs_changed (optional<string> j)
{
/* examine content is the only job which stops the viewer working */
bool const a = !j || *j != "examine_content";
}
DCPTime
-ControlFilmViewer::nudge_amount (wxKeyboardState& ev)
+Controls::nudge_amount (wxKeyboardState& ev)
{
DCPTime amount = _viewer->one_video_frame ();
}
void
-ControlFilmViewer::rewind_clicked (wxMouseEvent& ev)
+Controls::rewind_clicked (wxMouseEvent& ev)
{
_viewer->go_to (DCPTime());
ev.Skip();
}
void
-ControlFilmViewer::back_frame ()
+Controls::back_frame ()
{
_viewer->move (-_viewer->one_video_frame());
}
void
-ControlFilmViewer::forward_frame ()
+Controls::forward_frame ()
{
_viewer->move (_viewer->one_video_frame());
}
void
-ControlFilmViewer::back_clicked (wxKeyboardState& ev)
+Controls::back_clicked (wxKeyboardState& ev)
{
_viewer->move (-nudge_amount(ev));
}
void
-ControlFilmViewer::forward_clicked (wxKeyboardState& ev)
+Controls::forward_clicked (wxKeyboardState& ev)
{
_viewer->move (nudge_amount(ev));
}
void
-ControlFilmViewer::setup_sensitivity ()
+Controls::setup_sensitivity ()
{
bool const c = _film && !_film->content().empty ();
}
void
-ControlFilmViewer::timecode_clicked ()
+Controls::timecode_clicked ()
{
PlayheadToTimecodeDialog* dialog = new PlayheadToTimecodeDialog (this, _film->video_frame_rate ());
if (dialog->ShowModal() == wxID_OK) {
}
void
-ControlFilmViewer::frame_number_clicked ()
+Controls::frame_number_clicked ()
{
PlayheadToFrameDialog* dialog = new PlayheadToFrameDialog (this, _film->video_frame_rate ());
if (dialog->ShowModal() == wxID_OK) {
}
void
-ControlFilmViewer::jump_to_selected_clicked ()
+Controls::jump_to_selected_clicked ()
{
Config::instance()->set_jump_to_selected (_jump_to_selected->GetValue ());
}
void
-ControlFilmViewer::set_film (shared_ptr<Film> film)
+Controls::film_changed ()
{
- _viewer->set_film (film);
+ shared_ptr<Film> film = _viewer->film ();
if (_film == film) {
return;
update_position_slider ();
update_position_label ();
- _film->Change.connect (boost::bind (&ControlFilmViewer::film_change, this, _1, _2));
-}
-
-void
-ControlFilmViewer::set_position (DCPTime p)
-{
- _viewer->set_position (p);
-}
-
-void
-ControlFilmViewer::set_position (shared_ptr<Content> content, ContentTime t)
-{
- _viewer->set_position (content, t);
-}
-
-void
-ControlFilmViewer::set_dcp_decode_reduction (boost::optional<int> reduction)
-{
- _viewer->set_dcp_decode_reduction (reduction);
-}
-
-void
-ControlFilmViewer::show_closed_captions ()
-{
- _viewer->show_closed_captions ();
-}
-
-void
-ControlFilmViewer::start ()
-{
- _viewer->start ();
-}
-
-bool
-ControlFilmViewer::stop ()
-{
- return _viewer->stop ();
-}
-
-bool
-ControlFilmViewer::playing () const
-{
- return _viewer->playing ();
-}
-
-void
-ControlFilmViewer::slow_refresh ()
-{
- _viewer->slow_refresh ();
-}
-
-int
-ControlFilmViewer::dropped () const
-{
- return _viewer->dropped ();
+ _film->Change.connect (boost::bind (&Controls::film_change, this, _1, _2));
}
shared_ptr<Film>
-ControlFilmViewer::film () const
+Controls::film () const
{
return _film;
}
-
-optional<int>
-ControlFilmViewer::dcp_decode_reduction () const
-{
- return _viewer->dcp_decode_reduction ();
-}
-
-DCPTime
-ControlFilmViewer::position () const
-{
- return _viewer->position ();
-}
-
-void
-ControlFilmViewer::set_coalesce_player_changes (bool c)
-{
- _viewer->set_coalesce_player_changes (c);
-}
class PlayerVideo;
class wxToggleButton;
-class ControlFilmViewer : public wxPanel
+class Controls : public wxPanel
{
public:
- ControlFilmViewer (wxWindow* parent, bool outline_content = true, bool jump_to_selected = true);
+ Controls (wxWindow* parent, boost::shared_ptr<FilmViewer>, bool outline_content = true, bool jump_to_selected = true);
- void set_film (boost::shared_ptr<Film> film);
boost::shared_ptr<Film> film () const;
void back_frame ();
void forward_frame ();
- /* FilmViewer proxies */
- void set_position (DCPTime p);
- void set_position (boost::shared_ptr<Content> content, ContentTime p);
- void set_dcp_decode_reduction (boost::optional<int> reduction);
- void show_closed_captions ();
- void start ();
- bool stop ();
- bool playing () const;
- void slow_refresh ();
- int dropped () const;
- boost::optional<int> dcp_decode_reduction () const;
- DCPTime position () const;
- void set_coalesce_player_changes (bool c);
- boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
-
private:
void update_position_label ();
void update_position_slider ();
void position_changed ();
void started ();
void stopped ();
+ void film_changed ();
boost::shared_ptr<Film> _film;
boost::shared_ptr<FilmViewer> _viewer;
using std::string;
using std::list;
using boost::shared_ptr;
+using boost::weak_ptr;
using boost::optional;
-FilmEditor::FilmEditor (wxWindow* parent, ControlFilmViewer* viewer)
+FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer)
: wxPanel (parent)
{
wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
class Film;
class ContentPanel;
class DCPPanel;
-class ControlFilmViewer;
+class FilmViewer;
/** @class FilmEditor
* @brief A wx widget to edit a film's metadata, and perform various functions.
class FilmEditor : public wxPanel
{
public:
- FilmEditor (wxWindow *, ControlFilmViewer* viewer);
+ FilmEditor (wxWindow *, boost::weak_ptr<FilmViewer> viewer);
void set_film (boost::shared_ptr<Film>);
_film = film;
+ FilmChanged ();
+
_frame.reset ();
_closed_captions_dialog->clear ();
boost::signals2::signal<void ()> PositionChanged;
boost::signals2::signal<void ()> Started;
boost::signals2::signal<void ()> Stopped;
+ boost::signals2::signal<void ()> FilmChanged;
private:
void paint_panel ();
#include "player_information.h"
#include "wx_util.h"
-#include "control_film_viewer.h"
+#include "film_viewer.h"
#include "lib/playlist.h"
#include "lib/compose.hpp"
#include "lib/video_content.h"
using std::cout;
using std::string;
using boost::shared_ptr;
+using boost::weak_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
/* This should be even */
static int const dcp_lines = 6;
-PlayerInformation::PlayerInformation (wxWindow* parent, ControlFilmViewer* viewer)
+PlayerInformation::PlayerInformation (wxWindow* parent, weak_ptr<FilmViewer> viewer)
: wxPanel (parent)
, _viewer (viewer)
, _sizer (new wxBoxSizer (wxHORIZONTAL))
void
PlayerInformation::periodic_update ()
{
- checked_set (_dropped, wxString::Format(_("Dropped frames: %d"), _viewer->dropped()));
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (fv) {
+ checked_set (_dropped, wxString::Format(_("Dropped frames: %d"), fv->dropped()));
+ }
}
void
PlayerInformation::triggered_update ()
{
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (!fv) {
+ return;
+ }
+
shared_ptr<DCPContent> dcp;
- if (_viewer->film()) {
- ContentList content = _viewer->film()->content();
+ if (fv->film()) {
+ ContentList content = fv->film()->content();
if (content.size() == 1) {
dcp = dynamic_pointer_cast<DCPContent>(content.front());
}
checked_set (_dcp[r++], std_to_wx(len));
dcp::Size decode = dcp->video->size();
- optional<int> reduction = _viewer->dcp_decode_reduction();
+ optional<int> reduction = fv->dcp_decode_reduction();
if (reduction) {
decode.width /= pow(2, *reduction);
decode.height /= pow(2, *reduction);
#include <wx/wx.h>
#include <boost/scoped_ptr.hpp>
+#include <boost/weak_ptr.hpp>
-class ControlFilmViewer;
+class FilmViewer;
class PlayerInformation : public wxPanel
{
public:
- PlayerInformation (wxWindow* parent, ControlFilmViewer* viewer);
+ PlayerInformation (wxWindow* parent, boost::weak_ptr<FilmViewer> viewer);
void triggered_update ();
void periodic_update ();
- ControlFilmViewer* _viewer;
+ boost::weak_ptr<FilmViewer> _viewer;
wxSizer* _sizer;
wxStaticText** _dcp;
wxStaticText* _dropped;
*/
+#include "text_view.h"
+#include "film_viewer.h"
+#include "wx_util.h"
#include "lib/string_text_file_decoder.h"
#include "lib/content_text.h"
#include "lib/video_decoder.h"
#include "lib/config.h"
#include "lib/string_text_file_content.h"
#include "lib/text_decoder.h"
-#include "text_view.h"
-#include "control_film_viewer.h"
-#include "wx_util.h"
using std::list;
using boost::shared_ptr;
+using boost::weak_ptr;
using boost::bind;
using boost::dynamic_pointer_cast;
TextView::TextView (
- wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content, shared_ptr<TextContent> text, shared_ptr<Decoder> decoder, ControlFilmViewer* viewer
+ wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content, shared_ptr<TextContent> text, shared_ptr<Decoder> decoder, weak_ptr<FilmViewer> viewer
)
: wxDialog (parent, wxID_ANY, _("Captions"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, _content (content)
}
DCPOMATIC_ASSERT (ev.GetIndex() < int(_start_times.size()));
- shared_ptr<Content> locked = _content.lock ();
- DCPOMATIC_ASSERT (locked);
- _film_viewer->set_position (locked, _start_times[ev.GetIndex()]);
+ shared_ptr<Content> lc = _content.lock ();
+ DCPOMATIC_ASSERT (lc);
+ shared_ptr<FilmViewer> fv = _film_viewer.lock ();
+ DCPOMATIC_ASSERT (fv);
+ fv->set_position (lc, _start_times[ev.GetIndex()]);
}
*/
#include "lib/content_text.h"
-#include <boost/shared_ptr.hpp>
#include <wx/wx.h>
#include <wx/listctrl.h>
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
class Decoder;
-class ControlFilmViewer;
+class FilmViewer;
+class Film;
class TextView : public wxDialog
{
boost::shared_ptr<Content> content,
boost::shared_ptr<TextContent> caption,
boost::shared_ptr<Decoder>,
- ControlFilmViewer* viewer
+ boost::weak_ptr<FilmViewer> viewer
);
private:
boost::optional<int> _last_count;
std::vector<ContentTime> _start_times;
boost::weak_ptr<Content> _content;
- ControlFilmViewer* _film_viewer;
+ boost::weak_ptr<FilmViewer> _film_viewer;
};
#include "timing_panel.h"
#include "wx_util.h"
-#include "control_film_viewer.h"
+#include "film_viewer.h"
#include "timecode.h"
#include "content_panel.h"
#include "move_to_dialog.h"
using std::string;
using std::set;
using boost::shared_ptr;
+using boost::weak_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
using dcp::locale_convert;
-TimingPanel::TimingPanel (ContentPanel* p, ControlFilmViewer* viewer)
+TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
/* horrid hack for apparent lack of context support with wxWidgets i18n code */
/// TRANSLATORS: translate the word "Timing" here; do not include the "Timing|" prefix
: ContentSubPanel (p, S_("Timing|Timing"))
_video_frame_rate->Bind (wxEVT_TEXT, boost::bind (&TimingPanel::video_frame_rate_changed, this));
_set_video_frame_rate->Bind (wxEVT_BUTTON, boost::bind (&TimingPanel::set_video_frame_rate, this));
- _viewer->ImageChanged.connect (boost::bind (&TimingPanel::setup_sensitivity, this));
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ DCPOMATIC_ASSERT (fv);
+ fv->ImageChanged.connect (boost::bind (&TimingPanel::setup_sensitivity, this));
setup_sensitivity ();
add_to_grid ();
void
TimingPanel::trim_start_changed ()
{
- DCPTime const ph = _viewer->position ();
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (!fv) {
+ return;
+ }
+
+ DCPTime const ph = fv->position ();
- _viewer->set_coalesce_player_changes (true);
+ fv->set_coalesce_player_changes (true);
shared_ptr<Content> ref;
optional<FrameRateChange> ref_frc;
}
if (ref) {
- _viewer->set_position (max (DCPTime(), ref_ph.get() + ref->position() - DCPTime (ref->trim_start(), ref_frc.get())));
+ fv->set_position (max (DCPTime(), ref_ph.get() + ref->position() - DCPTime (ref->trim_start(), ref_frc.get())));
}
- _viewer->set_coalesce_player_changes (false);
+ fv->set_coalesce_player_changes (false);
}
void
TimingPanel::trim_end_changed ()
{
- _viewer->set_coalesce_player_changes (true);
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (!fv) {
+ return;
+ }
+
+ fv->set_coalesce_player_changes (true);
ContentTime const trim = _trim_end->get (_parent->film()->video_frame_rate ());
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
}
/* XXX: maybe playhead-off-the-end-of-the-film should be handled elsewhere */
- if (_viewer->position() >= _parent->film()->length()) {
- _viewer->set_position (_parent->film()->length() - DCPTime::from_frames (1, _parent->film()->video_frame_rate()));
+ if (fv->position() >= _parent->film()->length()) {
+ fv->set_position (_parent->film()->length() - DCPTime::from_frames (1, _parent->film()->video_frame_rate()));
}
- _viewer->set_coalesce_player_changes (true);
+ fv->set_coalesce_player_changes (true);
}
void
void
TimingPanel::trim_start_to_playhead_clicked ()
{
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (!fv) {
+ return;
+ }
+
shared_ptr<const Film> film = _parent->film ();
- DCPTime const ph = _viewer->position().floor (film->video_frame_rate ());
+ DCPTime const ph = fv->position().floor (film->video_frame_rate ());
optional<DCPTime> new_ph;
- _viewer->set_coalesce_player_changes (true);
+ fv->set_coalesce_player_changes (true);
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
if (i->position() < ph && ph < i->end ()) {
}
if (new_ph) {
- _viewer->set_position (new_ph.get());
+ fv->set_position (new_ph.get());
}
- _viewer->set_coalesce_player_changes (false);
+ fv->set_coalesce_player_changes (false);
}
void
TimingPanel::trim_end_to_playhead_clicked ()
{
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (!fv) {
+ return;
+ }
+
shared_ptr<const Film> film = _parent->film ();
- DCPTime const ph = _viewer->position().floor (film->video_frame_rate ());
+ DCPTime const ph = fv->position().floor (film->video_frame_rate ());
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
if (i->position() < ph && ph < i->end ()) {
FrameRateChange const frc = film->active_frame_rate_change (i->position ());
_play_length->Enable (e);
_video_frame_rate->Enable (e);
- DCPTime const ph = _viewer->position ();
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ DCPOMATIC_ASSERT (fv);
+ DCPTime const ph = fv->position ();
bool any_over_ph = false;
BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
if (i->position() <= ph && ph < i->end()) {
#include "content_sub_panel.h"
#include "timecode.h"
-class ControlFilmViewer;
+class FilmViewer;
class TimingPanel : public ContentSubPanel
{
public:
- TimingPanel (ContentPanel *, ControlFilmViewer* viewer);
+ TimingPanel (ContentPanel *, boost::weak_ptr<FilmViewer> viewer);
void film_changed (Film::Property);
void film_content_changed (int);
void setup_sensitivity ();
void add_to_grid ();
- ControlFilmViewer* _viewer;
+ boost::weak_ptr<FilmViewer> _viewer;
wxStaticText* _h_label;
wxStaticText* _m_label;
#include "video_waveform_dialog.h"
#include "video_waveform_plot.h"
-#include "control_film_viewer.h"
+#include "film_viewer.h"
#include "wx_util.h"
#include <boost/bind.hpp>
#include <iostream>
using std::cout;
using boost::bind;
using boost::weak_ptr;
+using boost::shared_ptr;
-VideoWaveformDialog::VideoWaveformDialog (wxWindow* parent, weak_ptr<const Film> film, ControlFilmViewer* viewer)
+VideoWaveformDialog::VideoWaveformDialog (wxWindow* parent, weak_ptr<const Film> film, weak_ptr<FilmViewer> viewer)
: wxDialog (
parent,
wxID_ANY,
{
_plot->set_enabled (ev.IsShown ());
if (ev.IsShown ()) {
- _viewer->slow_refresh ();
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ DCPOMATIC_ASSERT (fv);
+ fv->slow_refresh ();
}
}
#include <boost/weak_ptr.hpp>
class VideoWaveformPlot;
-class ControlFilmViewer;
+class FilmViewer;
class Film;
class VideoWaveformDialog : public wxDialog
{
public:
- VideoWaveformDialog (wxWindow* parent, boost::weak_ptr<const Film> film, ControlFilmViewer* viewer);
+ VideoWaveformDialog (wxWindow* parent, boost::weak_ptr<const Film> film, boost::weak_ptr<FilmViewer> viewer);
private:
void shown (wxShowEvent &);
void contrast_changed ();
void mouse_moved (int x1, int x2, int y1, int y2);
- ControlFilmViewer* _viewer;
+ boost::weak_ptr<FilmViewer> _viewer;
VideoWaveformPlot* _plot;
wxChoice* _component;
wxSlider* _contrast;
*/
#include "video_waveform_plot.h"
-#include "control_film_viewer.h"
+#include "film_viewer.h"
#include "wx_util.h"
#include "lib/image.h"
#include "lib/film.h"
int const VideoWaveformPlot::_pixel_values = 4096;
int const VideoWaveformPlot::_x_axis_width = 52;
-VideoWaveformPlot::VideoWaveformPlot (wxWindow* parent, weak_ptr<const Film> film, ControlFilmViewer* viewer)
+VideoWaveformPlot::VideoWaveformPlot (wxWindow* parent, weak_ptr<const Film> film, weak_ptr<FilmViewer> viewer)
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
, _film (film)
, _dirty (true)
SetDoubleBuffered (true);
#endif
- _viewer_connection = viewer->ImageChanged.connect (boost::bind (&VideoWaveformPlot::set_image, this, _1));
+ shared_ptr<FilmViewer> fv = viewer.lock ();
+ DCPOMATIC_ASSERT (fv);
+
+ _viewer_connection = fv->ImageChanged.connect (boost::bind (&VideoWaveformPlot::set_image, this, _1));
Bind (wxEVT_PAINT, boost::bind (&VideoWaveformPlot::paint, this));
Bind (wxEVT_SIZE, boost::bind (&VideoWaveformPlot::sized, this, _1));
class PlayerVideo;
class Image;
class Film;
-class ControlFilmViewer;
+class FilmViewer;
class VideoWaveformPlot : public wxPanel
{
public:
- VideoWaveformPlot (wxWindow* parent, boost::weak_ptr<const Film> film, ControlFilmViewer* viewer);
+ VideoWaveformPlot (wxWindow* parent, boost::weak_ptr<const Film> film, boost::weak_ptr<FilmViewer> viewer);
void set_enabled (bool e);
void set_component (int c);