Fix the alignment of the current position in the playback controls.
[dcpomatic.git] / src / wx / controls.cc
index 29f4aeaa364e2416de48dda239f25e2ebbd8ee27..c02581cc0ec3ad3dff7833481ea5bc1cf89394ba 100644 (file)
 */
 
 
+#include "check_box.h"
+#include "content_view.h"
 #include "controls.h"
+#include "dcpomatic_button.h"
 #include "film_viewer.h"
-#include "wx_util.h"
-#include "playhead_to_timecode_dialog.h"
+#include "markers_panel.h"
 #include "playhead_to_frame_dialog.h"
-#include "content_view.h"
+#include "playhead_to_timecode_dialog.h"
 #include "static_text.h"
-#include "check_box.h"
-#include "dcpomatic_button.h"
-#include "lib/job_manager.h"
-#include "lib/player_video.h"
-#include "lib/dcp_content.h"
-#include "lib/job.h"
-#include "lib/examine_content_job.h"
+#include "wx_util.h"
 #include "lib/content_factory.h"
 #include "lib/cross.h"
-#include <dcp/dcp.h>
+#include "lib/dcp_content.h"
+#include "lib/examine_content_job.h"
+#include "lib/job.h"
+#include "lib/job_manager.h"
+#include "lib/player_video.h"
 #include <dcp/cpl.h>
+#include <dcp/dcp.h>
 #include <dcp/reel.h>
 #include <dcp/reel_picture_asset.h>
-#include <wx/wx.h>
-#include <wx/tglbtn.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/listctrl.h>
 #include <wx/progdlg.h>
+#include <wx/tglbtn.h>
+#include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
 
 
-using std::string;
-using std::list;
 using std::cout;
-using std::make_pair;
+using std::dynamic_pointer_cast;
 using std::exception;
-using boost::optional;
+using std::list;
+using std::make_pair;
 using std::shared_ptr;
+using std::string;
 using std::weak_ptr;
-using std::dynamic_pointer_cast;
+using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
@@ -62,6 +66,7 @@ using namespace dcpomatic;
 
 Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor_controls)
        : wxPanel (parent)
+       , _markers (new MarkersPanel(this, viewer))
        , _slider (new wxSlider(this, wxID_ANY, 0, 0, 4096))
        , _viewer (viewer)
        , _slider_being_moved (false)
@@ -100,14 +105,19 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
        time_sizer->Add (_timecode, 0, wxEXPAND);
 
        h_sizer->Add (_rewind_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
-       h_sizer->Add (time_sizer, 0, wxEXPAND);
+       h_sizer->Add (time_sizer, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
        h_sizer->Add (_back_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
        h_sizer->Add (_forward_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
 
        _button_sizer = new wxBoxSizer (wxHORIZONTAL);
        h_sizer->Add (_button_sizer, 0, wxEXPAND);
 
-       h_sizer->Add (_slider, 1, wxEXPAND);
+       {
+               auto box = new wxBoxSizer (wxVERTICAL);
+               box->Add (_markers, 0, wxEXPAND);
+               box->Add (_slider, 0, wxEXPAND);
+               h_sizer->Add (box, 1, wxEXPAND);
+       }
 
        _v_sizer->Add (h_sizer, 0, wxEXPAND | wxALL, 6);
 
@@ -249,12 +259,6 @@ Controls::slider_moved (bool page)
        }
        viewer->seek (t, accurate);
        update_position_label ();
-
-       log (
-               wxString::Format(
-                       "playback-seeked %s", t.timecode(_film->video_frame_rate()).c_str()
-                       )
-               );
 }
 
 
@@ -472,6 +476,8 @@ Controls::set_film (shared_ptr<Film> film)
 
        _film = film;
 
+       _markers->set_film (_film);
+
        if (_film) {
                _film_change_connection = _film->Change.connect (boost::bind(&Controls::film_change, this, _1, _2));
        }