Remove unused variables.
[dcpomatic.git] / src / wx / timing_panel.cc
index 47019487f8324ed19df12dec0d0aabb86e94a968..3304157e242abfe7ad8d697609110278008fcbfa 100644 (file)
 #include "static_text.h"
 #include "timecode.h"
 #include "timing_panel.h"
-#include "wx_ptr.h"
 #include "wx_util.h"
 #include "lib/audio_content.h"
 #include "lib/content.h"
 #include "lib/dcp_content.h"
 #include "lib/dcp_subtitle_content.h"
 #include "lib/ffmpeg_content.h"
+#include "lib/film.h"
 #include "lib/image_content.h"
-#include "lib/scope_guard.h"
 #include "lib/string_text_file_content.h"
 #include "lib/text_content.h"
 #include "lib/video_content.h"
@@ -83,25 +82,23 @@ TimingPanel::create ()
        }
 
        //// TRANSLATORS: this is an abbreviation for "hours"
-       _h_label = new StaticText (this, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
-#ifdef TIMING_PANEL_ALIGNMENT_HACK
-       /* Hack to work around failure to centre text on GTK */
-       gtk_label_set_line_wrap (GTK_LABEL(_h_label->GetHandle()), FALSE);
-#endif
+       _label.push_back(new StaticText(this, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL));
        //// TRANSLATORS: this is an abbreviation for "minutes"
-       _m_label = new StaticText (this, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
-#ifdef TIMING_PANEL_ALIGNMENT_HACK
-       gtk_label_set_line_wrap (GTK_LABEL (_m_label->GetHandle()), FALSE);
-#endif
+       _label.push_back(new StaticText(this, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL));
        //// TRANSLATORS: this is an abbreviation for "seconds"
-       _s_label = new StaticText (this, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
-#ifdef TIMING_PANEL_ALIGNMENT_HACK
-       gtk_label_set_line_wrap (GTK_LABEL(_s_label->GetHandle()), FALSE);
-#endif
+       _label.push_back(new StaticText (this, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL));
        //// TRANSLATORS: this is an abbreviation for "frames"
-       _f_label = new StaticText (this, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+       _label.push_back(new StaticText (this, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL));
+
+       if (GetLayoutDirection() == wxLayout_RightToLeft) {
+               std::reverse(_label.begin(), _label.end());
+       }
+
 #ifdef TIMING_PANEL_ALIGNMENT_HACK
-       gtk_label_set_line_wrap (GTK_LABEL(_f_label->GetHandle()), FALSE);
+       for (auto label: _label) {
+               /* Hack to work around failure to centre text on GTK */
+               gtk_label_set_line_wrap(GTK_LABEL(label->GetHandle()), FALSE);
+       }
 #endif
 
        _position_label = create_label (this, _("Position"), true);
@@ -140,14 +137,14 @@ TimingPanel::add_to_grid ()
 {
        int r = 0;
 
-       wxSizer* labels = new wxBoxSizer (wxHORIZONTAL);
-       labels->Add (_h_label, 1, wxEXPAND);
-       add_label_to_sizer (labels, _colon[0], false);
-       labels->Add (_m_label, 1, wxEXPAND);
-       add_label_to_sizer (labels, _colon[1], false);
-       labels->Add (_s_label, 1, wxEXPAND);
-       add_label_to_sizer (labels, _colon[2], false);
-       labels->Add (_f_label, 1, wxEXPAND);
+       auto labels = new wxBoxSizer(wxHORIZONTAL);
+       int index = 0;
+       for (auto label: _label) {
+               labels->Add(label, 1, wxEXPAND);
+               if (index < 3) {
+                       add_label_to_sizer(labels, _colon[index++], false);
+               }
+       }
        _grid->Add (labels, wxGBPosition(r, 1));
        ++r;
 
@@ -289,19 +286,15 @@ TimingPanel::film_content_changed (int property)
        if (property == ContentProperty::VIDEO_FRAME_RATE) {
                set<double> check_vc;
                shared_ptr<const Content> content;
-               int count_ac = 0;
-               int count_sc = 0;
                for (auto i: _parent->selected()) {
                        if (i->video && i->video_frame_rate()) {
                                check_vc.insert (i->video_frame_rate().get());
                                content = i;
                        }
                        if (i->audio && i->video_frame_rate()) {
-                               ++count_ac;
                                content = i;
                        }
                        if (!i->text.empty() && i->video_frame_rate()) {
-                               ++count_sc;
                                content = i;
                        }
 
@@ -422,9 +415,9 @@ TimingPanel::content_selection_changed ()
 }
 
 void
-TimingPanel::film_changed (Film::Property p)
+TimingPanel::film_changed(FilmProperty p)
 {
-       if (p == Film::Property::VIDEO_FRAME_RATE) {
+       if (p == FilmProperty::VIDEO_FRAME_RATE) {
                update_full_length ();
                update_play_length ();
        }