video_control (add_label_to_sizer (_sizer, this, "Frames Per Second"));
_frames_per_second = new wxStaticText (this, wxID_ANY, wxT (""));
- _sizer->Add (video_control (_frames_per_second));
+ _sizer->Add (video_control (_frames_per_second), 1, wxALIGN_CENTER_VERTICAL);
video_control (add_label_to_sizer (_sizer, this, "Original Size"));
_original_size = new wxStaticText (this, wxID_ANY, wxT (""));
_audio_delay->SetRange (-1000, 1000);
_still_duration->SetRange (0, 60 * 60);
- vector<Format const *> fmt = Format::all ();
- for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
- _format->Append (std_to_wx ((*i)->name ()));
- }
-
vector<DCPContentType const *> const ct = DCPContentType::all ();
for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
_change_dcp_range_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::change_dcp_range_clicked), 0, this);
setup_visibility ();
+ setup_formats ();
}
/** Called when the left crop widget has been changed */
_film->set_content (wx_to_std (_content->GetPath ()));
} catch (std::exception& e) {
_content->SetPath (std_to_wx (_film->directory ()));
- stringstream m;
- m << "Could not set content: " << e.what() << ".";
- error_dialog (this, m.str ());
+ error_dialog (this, String::compose ("Could not set content: %1", e.what ()));
}
_ignore_changes = Film::NONE;
setup_visibility ();
+ setup_formats ();
}
/** Called when the DCP A/B switch has been toggled */
case Film::CONTENT:
_content->SetPath (std_to_wx (_film->content ()));
setup_visibility ();
+ setup_formats ();
break;
case Film::FORMAT:
- _format->SetSelection (Format::as_index (_film->format ()));
+ {
+ int n = 0;
+ vector<Format const *>::iterator i = _formats.begin ();
+ while (i != _formats.end() && *i != _film->format ()) {
+ ++i;
+ ++n;
+ }
+ _format->SetSelection (n);
break;
+ }
case Film::CROP:
_left_crop->SetValue (_film->crop().left);
_right_crop->SetValue (_film->crop().right);
_ignore_changes = Film::FORMAT;
int const n = _format->GetSelection ();
if (n >= 0) {
- _film->set_format (Format::from_index (n));
+ assert (n < int (_formats.size()));
+ _film->set_format (_formats[n]);
}
_ignore_changes = Film::NONE;
}
{
GainCalculatorDialog* d = new GainCalculatorDialog (this);
d->ShowModal ();
+
+ if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
+ d->Destroy ();
+ return;
+ }
+
_audio_gain->SetValue (
Config::instance()->sound_processor()->db_for_fader_change (
d->wanted_fader (),
d->actual_fader ()
)
);
+
+ /* This appears to be necessary, as the change is not signalled,
+ I think.
+ */
+ wxCommandEvent dummy;
+ audio_gain_changed (dummy);
+
d->Destroy ();
}
+
+void
+FilmEditor::setup_formats ()
+{
+ ContentType c = VIDEO;
+
+ if (_film) {
+ c = _film->content_type ();
+ }
+
+ _formats.clear ();
+
+ vector<Format const *> fmt = Format::all ();
+ for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
+ if (c == VIDEO && dynamic_cast<FixedFormat const *> (*i)) {
+ _formats.push_back (*i);
+ } else if (c == STILL && dynamic_cast<VariableFormat const *> (*i)) {
+ _formats.push_back (*i);
+ }
+ }
+
+ _format->Clear ();
+ for (vector<Format const *>::iterator i = _formats.begin(); i != _formats.end(); ++i) {
+ _format->Append (std_to_wx ((*i)->name ()));
+ }
+
+ _sizer->Layout ();
+}