, _y_offset (0)
, _x_scale (1)
, _y_scale (1)
- , _effect (dcp::NONE)
, _line_spacing (1)
, _outline_width (2)
{
root->add_child("Green")->add_child_text (raw_convert<string> (_colour->g));
root->add_child("Blue")->add_child_text (raw_convert<string> (_colour->b));
}
- switch (_effect) {
- case dcp::NONE:
- root->add_child("none");
- break;
- case dcp::BORDER:
- root->add_child("outline");
- break;
- case dcp::SHADOW:
- root->add_child("shadow");
- break;
+ if (_effect) {
+ switch (*_effect) {
+ case dcp::NONE:
+ root->add_child("none");
+ break;
+ case dcp::BORDER:
+ root->add_child("outline");
+ break;
+ case dcp::SHADOW:
+ root->add_child("shadow");
+ break;
+ }
}
if (_effect_colour) {
root->add_child("EffectRed")->add_child_text (raw_convert<string> (_effect_colour->r));
maybe_set (_effect, e, SubtitleContentProperty::EFFECT);
}
+void
+SubtitleContent::unset_effect ()
+{
+ maybe_set (_effect, optional<dcp::Effect>(), SubtitleContentProperty::EFFECT);
+}
+
void
SubtitleContent::set_effect_colour (dcp::Colour colour)
{
} else {
unset_colour ();
}
- set_effect (c->_effect);
+ if (c->_effect) {
+ set_effect (*c->_effect);
+ }
if (c->_effect_colour) {
set_effect_colour (*c->_effect_colour);
} else {
void set_colour (dcp::Colour);
void unset_colour ();
void set_effect (dcp::Effect);
+ void unset_effect ();
void set_effect_colour (dcp::Colour);
void unset_effect_colour ();
void set_line_spacing (double s);
return _colour;
}
- dcp::Effect effect () const {
+ boost::optional<dcp::Effect> effect () const {
boost::mutex::scoped_lock lm (_mutex);
return _effect;
}
double _y_scale;
std::list<boost::shared_ptr<Font> > _fonts;
boost::optional<dcp::Colour> _colour;
- dcp::Effect _effect;
+ boost::optional<dcp::Effect> _effect;
boost::optional<dcp::Colour> _effect_colour;
/** scaling factor for line spacing; 1 is "standard", < 1 is closer together, > 1 is further apart */
double _line_spacing;
++r;
add_label_to_sizer (_table, this, _("Effect"), true, wxGBPosition (r, 0));
- _effect = new wxChoice (this, wxID_ANY);
- _table->Add (_effect, wxGBPosition (r, 1));
+ {
+ wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _force_effect = new wxCheckBox (this, wxID_ANY, _("Set to"));
+ s->Add (_force_effect, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 8);
+ _effect = new wxChoice (this, wxID_ANY);
+ s->Add (_effect, 0, wxALIGN_CENTER_VERTICAL);
+ _table->Add (s, wxGBPosition (r, 1));
+ }
++r;
add_label_to_sizer (_table, this, _("Effect colour"), true, wxGBPosition (r, 0));
_colour->SetColour (wxColour (255, 255, 255));
}
- switch (_content->subtitle->effect()) {
- case dcp::NONE:
+ optional<dcp::Effect> effect = _content->subtitle->effect();
+ if (effect) {
+ _force_effect->SetValue (true);
+ switch (*effect) {
+ case dcp::NONE:
+ _effect->SetSelection (NONE);
+ break;
+ case dcp::BORDER:
+ _effect->SetSelection (OUTLINE);
+ break;
+ case dcp::SHADOW:
+ _effect->SetSelection (SHADOW);
+ break;
+ }
+ } else {
+ _force_effect->SetValue (false);
_effect->SetSelection (NONE);
- break;
- case dcp::BORDER:
- _effect->SetSelection (OUTLINE);
- break;
- case dcp::SHADOW:
- _effect->SetSelection (SHADOW);
- break;
}
optional<dcp::Colour> effect_colour = _content->subtitle->effect_colour();
_force_colour->Bind (wxEVT_CHECKBOX, bind (&SubtitleAppearanceDialog::setup_sensitivity, this));
_force_effect_colour->Bind (wxEVT_CHECKBOX, bind (&SubtitleAppearanceDialog::setup_sensitivity, this));
+ _force_effect->Bind (wxEVT_CHECKBOX, bind (&SubtitleAppearanceDialog::setup_sensitivity, this));
_effect->Bind (wxEVT_CHOICE, bind (&SubtitleAppearanceDialog::setup_sensitivity, this));
_content_connection = _content->Changed.connect (bind (&SubtitleAppearanceDialog::setup_sensitivity, this));
{
_colour->Enable (_force_colour->GetValue ());
_effect_colour->Enable (_force_effect_colour->GetValue ());
+ _effect->Enable (_force_effect->GetValue ());
bool const can_outline_width = _effect->GetSelection() == OUTLINE && _content->subtitle->burn ();
_outline_width->Enable (can_outline_width);