Add burn-subtitles button to Subtitle panel.
authorCarl Hetherington <cth@carlh.net>
Thu, 25 Jun 2015 09:29:59 +0000 (10:29 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 25 Jun 2015 12:36:16 +0000 (13:36 +0100)
src/wx/subtitle_panel.cc
src/wx/subtitle_panel.h

index 9823df7a753606b43774080bac9f60b846cdeb1b..bf3e6d72af81fefeb11f9870f69d05196ad2a920 100644 (file)
@@ -50,6 +50,10 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p)
        grid->Add (_use);
        grid->AddSpacer (0);
 
+       _burn = new wxCheckBox (this, wxID_ANY, _("Burn subtitles"));
+       grid->Add (_burn);
+       grid->AddSpacer (0);
+
        {
                add_label_to_sizer (grid, this, _("X Offset"), true);
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
@@ -108,6 +112,7 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p)
        _y_scale->SetRange (10, 1000);
 
        _use->Bind                  (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&SubtitlePanel::use_toggled, this));
+       _burn->Bind                 (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&SubtitlePanel::burn_toggled, this));
        _x_offset->Bind             (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::x_offset_changed, this));
        _y_offset->Bind             (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::y_offset_changed, this));
        _x_scale->Bind              (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::x_scale_changed, this));
@@ -160,6 +165,8 @@ SubtitlePanel::film_content_changed (int property)
        } else if (property == SubtitleContentProperty::USE_SUBTITLES) {
                checked_set (_use, scs ? scs->use_subtitles() : false);
                setup_sensitivity ();
+       } else if (property == SubtitleContentProperty::BURN_SUBTITLES) {
+               checked_set (_burn, scs ? scs->burn_subtitles() : false);
        } else if (property == SubtitleContentProperty::SUBTITLE_X_OFFSET) {
                checked_set (_x_offset, scs ? (scs->subtitle_x_offset() * 100) : 0);
        } else if (property == SubtitleContentProperty::SUBTITLE_Y_OFFSET) {
@@ -182,6 +189,15 @@ SubtitlePanel::use_toggled ()
        }
 }
 
+void
+SubtitlePanel::burn_toggled ()
+{
+       SubtitleContentList c = _parent->selected_subtitle ();
+       for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
+               (*i)->set_burn_subtitles (_burn->GetValue());
+       }
+}
+
 void
 SubtitlePanel::setup_sensitivity ()
 {
@@ -209,6 +225,7 @@ SubtitlePanel::setup_sensitivity ()
        _use->Enable (any_subs > 0);
        bool const use = _use->GetValue ();
 
+       _burn->Enable (any_subs > 0 && use);
        _x_offset->Enable (any_subs > 0 && use);
        _y_offset->Enable (any_subs > 0 && use);
        _x_scale->Enable (any_subs > 0 && use);
@@ -291,6 +308,7 @@ SubtitlePanel::content_selection_changed ()
 {
        film_content_changed (FFmpegContentProperty::SUBTITLE_STREAMS);
        film_content_changed (SubtitleContentProperty::USE_SUBTITLES);
+       film_content_changed (SubtitleContentProperty::BURN_SUBTITLES);
        film_content_changed (SubtitleContentProperty::SUBTITLE_X_OFFSET);
        film_content_changed (SubtitleContentProperty::SUBTITLE_Y_OFFSET);
        film_content_changed (SubtitleContentProperty::SUBTITLE_X_SCALE);
index 5a39f3bcd5e0b437a9946c7566e1a8b99d283363..04f21860fa684f78bdc79eccd58e03e3a55ed226 100644 (file)
@@ -35,6 +35,7 @@ public:
 
 private:
        void use_toggled ();
+       void burn_toggled ();
        void x_offset_changed ();
        void y_offset_changed ();
        void x_scale_changed ();
@@ -47,6 +48,7 @@ private:
        void setup_sensitivity ();
 
        wxCheckBox* _use;
+       wxCheckBox* _burn;
        wxSpinCtrl* _x_offset;
        wxSpinCtrl* _y_offset;
        wxSpinCtrl* _x_scale;