summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-26 13:09:44 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-26 13:09:44 +0100
commit8484d278ec6905502bd1178cc58d8cb7b3c12df0 (patch)
tree9467c07905be6a74f487989431424dce4b6d5435 /src
parent31adaadc4957badc8ae458e2b5848ec550723c82 (diff)
Disable bits of TextPanel when we are making closed captions.
Diffstat (limited to 'src')
-rw-r--r--src/wx/text_panel.cc41
-rw-r--r--src/wx/text_panel.h1
2 files changed, 26 insertions, 16 deletions
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index 980dd36cb..7c2ddd7f9 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -285,18 +285,25 @@ TextPanel::use_toggled ()
}
}
+/** @return the text type that is currently selected in the drop-down */
+TextType
+TextPanel::current_type () const
+{
+ switch (_type->GetSelection()) {
+ case 0:
+ return TEXT_OPEN_SUBTITLE;
+ case 1:
+ return TEXT_CLOSED_CAPTION;
+ }
+
+ return TEXT_UNKNOWN;
+}
+
void
TextPanel::type_changed ()
{
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_text()) {
- switch (_type->GetSelection()) {
- case 0:
- i->text_of_original_type(_original_type)->set_type (TEXT_OPEN_SUBTITLE);
- break;
- case 1:
- i->text_of_original_type(_original_type)->set_type (TEXT_CLOSED_CAPTION);
- break;
- }
+ i->text_of_original_type(_original_type)->set_type (current_type ());
}
}
@@ -344,21 +351,23 @@ TextPanel::setup_sensitivity ()
bool const reference = _reference->GetValue ();
+ TextType const type = current_type ();
+
/* Set up sensitivity */
_use->Enable (!reference && any_subs > 0);
bool const use = _use->GetValue ();
_type->Enable (!reference && any_subs > 0 && use);
- _burn->Enable (!reference && any_subs > 0 && use && _type->GetSelection() == 0);
- _x_offset->Enable (!reference && any_subs > 0 && use);
- _y_offset->Enable (!reference && any_subs > 0 && use);
- _x_scale->Enable (!reference && any_subs > 0 && use);
- _y_scale->Enable (!reference && any_subs > 0 && use);
- _line_spacing->Enable (!reference && use);
+ _burn->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
+ _x_offset->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
+ _y_offset->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
+ _x_scale->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
+ _y_scale->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
+ _line_spacing->Enable (!reference && use && type == TEXT_OPEN_SUBTITLE);
_language->Enable (!reference && any_subs > 0 && use);
_stream->Enable (!reference && ffmpeg_subs == 1);
_text_view_button->Enable (!reference);
- _fonts_dialog_button->Enable (!reference);
- _appearance_dialog_button->Enable (!reference && any_subs > 0 && use);
+ _fonts_dialog_button->Enable (!reference && type == TEXT_OPEN_SUBTITLE);
+ _appearance_dialog_button->Enable (!reference && any_subs > 0 && use && type == TEXT_OPEN_SUBTITLE);
}
void
diff --git a/src/wx/text_panel.h b/src/wx/text_panel.h
index 86381e6ff..3d3483a46 100644
--- a/src/wx/text_panel.h
+++ b/src/wx/text_panel.h
@@ -49,6 +49,7 @@ private:
void fonts_dialog_clicked ();
void reference_clicked ();
void appearance_dialog_clicked ();
+ TextType current_type () const;
void setup_sensitivity ();