diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/film_viewer.cc | 18 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 1 | ||||
| -rw-r--r-- | src/wx/playhead_to_frame_dialog.cc | 38 | ||||
| -rw-r--r-- | src/wx/playhead_to_frame_dialog.h | 34 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
5 files changed, 89 insertions, 3 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 5389b5d21..8019e9214 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -22,6 +22,10 @@ * @brief A wx widget to view a preview of a Film. */ +#include "film_viewer.h" +#include "playhead_to_timecode_dialog.h" +#include "playhead_to_frame_dialog.h" +#include "wx_util.h" #include "lib/film.h" #include "lib/ratio.h" #include "lib/util.h" @@ -36,9 +40,6 @@ #include "lib/video_decoder.h" #include "lib/timer.h" #include "lib/log.h" -#include "film_viewer.h" -#include "playhead_to_timecode_dialog.h" -#include "wx_util.h" extern "C" { #include <libavutil/pixfmt.h> } @@ -125,6 +126,7 @@ FilmViewer::FilmViewer (wxWindow* p) _timer.Bind (wxEVT_TIMER, boost::bind (&FilmViewer::timer, this)); _back_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::back_clicked, this, _1)); _forward_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::forward_clicked, this, _1)); + _frame_number->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::frame_number_clicked, this)); _timecode->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::timecode_clicked, this)); set_film (shared_ptr<Film> ()); @@ -578,3 +580,13 @@ FilmViewer::timecode_clicked () } dialog->Destroy (); } + +void +FilmViewer::frame_number_clicked () +{ + PlayheadToFrameDialog* dialog = new PlayheadToFrameDialog (this, _film->video_frame_rate ()); + if (dialog->ShowModal() == wxID_OK) { + go_to (dialog->get ()); + } + dialog->Destroy (); +} diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index bec32d814..a67820a8c 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -72,6 +72,7 @@ private: void film_changed (Film::Property); DCPTime nudge_amount (wxMouseEvent &); void timecode_clicked (); + void frame_number_clicked (); void go_to (DCPTime t); boost::shared_ptr<Film> _film; diff --git a/src/wx/playhead_to_frame_dialog.cc b/src/wx/playhead_to_frame_dialog.cc new file mode 100644 index 000000000..bb3c5b5fb --- /dev/null +++ b/src/wx/playhead_to_frame_dialog.cc @@ -0,0 +1,38 @@ +/* + Copyright (C) 2016 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 "playhead_to_frame_dialog.h" +#include "lib/raw_convert.h" + +PlayheadToFrameDialog::PlayheadToFrameDialog (wxWindow* parent, int fps) + : TableDialog (parent, _("Move to frame"), 2, 1, true) + , _fps (fps) +{ + add (_("Go to"), true); + _frame = add (new wxTextCtrl (this, wxID_ANY, wxT (""))); + + layout (); +} + +DCPTime +PlayheadToFrameDialog::get () const +{ + return DCPTime::from_frames (raw_convert<Frame> (wx_to_std (_frame->GetValue ())) - 1, _fps); +} diff --git a/src/wx/playhead_to_frame_dialog.h b/src/wx/playhead_to_frame_dialog.h new file mode 100644 index 000000000..b6a902a55 --- /dev/null +++ b/src/wx/playhead_to_frame_dialog.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2016 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 "table_dialog.h" +#include "timecode.h" + +class PlayheadToFrameDialog : public TableDialog +{ +public: + PlayheadToFrameDialog (wxWindow* parent, int fps); + + DCPTime get () const; + +private: + wxTextCtrl* _frame; + int _fps; +}; diff --git a/src/wx/wscript b/src/wx/wscript index 11241411b..bb56ee5b8 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -70,6 +70,7 @@ sources = """ move_to_dialog.cc new_film_dialog.cc playhead_to_timecode_dialog.cc + playhead_to_frame_dialog.cc repeat_dialog.cc report_problem_dialog.cc rgba_colour_picker.cc |
