Emit no audio from DCPs if none is mapped
[dcpomatic.git] / src / wx / markers_panel.cc
index 9942dca8993d9d61d7beafc2733b059bd68bcf78..baf221f3ebb1a8f672006d1a15b8054298dcbf34 100644 (file)
 
 
 #include "film_viewer.h"
+#include "id.h"
 #include "markers.h"
 #include "markers_panel.h"
 #include "wx_util.h"
+#include "lib/film.h"
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
 #include <wx/graphics.h>
@@ -40,7 +42,7 @@ using namespace boost::placeholders;
 
 
 enum {
-       ID_move_marker_to_current_position,
+       ID_move_marker_to_current_position = DCPOMATIC_MARKERS_PANEL_MENU,
        ID_remove_marker,
        ID_add_marker,
        /* Leave some space after this one as we use an ID for each marker type
@@ -65,7 +67,7 @@ MarkersPanel::MarkersPanel(wxWindow* parent, FilmViewer& viewer)
 
        Bind (wxEVT_MENU, boost::bind(&MarkersPanel::move_marker_to_current_position, this), ID_move_marker_to_current_position);
        Bind (wxEVT_MENU, boost::bind(&MarkersPanel::remove_marker, this), ID_remove_marker);
-       Bind (wxEVT_MENU, boost::bind(&MarkersPanel::add_marker, this, _1), ID_add_base, ID_add_base + all_editable_markers().size());
+       Bind(wxEVT_MENU, boost::bind(&MarkersPanel::add_marker, this, _1), ID_add_base, ID_add_base + all_editable_markers().size() + uneditable_markers);
 }
 
 
@@ -82,7 +84,7 @@ MarkersPanel::set_film (weak_ptr<Film> weak_film)
 
 
 void
-MarkersPanel::film_changed (ChangeType type, Film::Property property)
+MarkersPanel::film_changed(ChangeType type, FilmProperty property)
 {
        if (type != ChangeType::DONE) {
                return;
@@ -93,7 +95,7 @@ MarkersPanel::film_changed (ChangeType type, Film::Property property)
                return;
        }
 
-       if (property == Film::Property::MARKERS || property == Film::Property::CONTENT || property == Film::Property::CONTENT_ORDER || property == Film::Property::VIDEO_FRAME_RATE) {
+       if (property == FilmProperty::MARKERS || property == FilmProperty::CONTENT || property == FilmProperty::CONTENT_ORDER || property == FilmProperty::VIDEO_FRAME_RATE) {
                update_from_film (film);
        }
 }
@@ -209,11 +211,23 @@ MarkersPanel::paint ()
                line.MoveToPoint (pos, 0);
                line.AddLineToPoint (pos, panel_height);
                gc->StrokePath (line);
-               if (marker.second.line_before_label) {
-                       gc->DrawText (label, pos + line_to_label_gap, 0);
+
+               auto label_x = 0;
+
+               if (GetLayoutDirection() == wxLayout_RightToLeft) {
+                       auto matrix = dc.GetTransformMatrix();
+                       matrix.Translate(0, 0);
+                       matrix.Mirror(wxHORIZONTAL);
+                       dc.SetTransformMatrix(matrix);
+                       label_x = marker.second.line_before_label ? (pos + line_to_label_gap + marker.second.width) : (pos - line_to_label_gap);
+                       label_x = -label_x;
                } else {
-                       gc->DrawText (label, pos - line_to_label_gap - marker.second.width, 0);
+                       label_x = marker.second.line_before_label ? (pos + line_to_label_gap) : (pos - line_to_label_gap - marker.second.width);
                }
+
+               gc->DrawText(label, label_x, 0);
+
+               dc.ResetTransformMatrix();
        }
 }