summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-08 00:20:10 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-08 00:20:10 +0100
commitd7801f3fe5a5ac46aa2c512bcd00be2bee39ed17 (patch)
treefcffa66cf84fb08c55e5547c5551d604df03dcec /src/wx
parent7c798f9e215282afb078da53b1d41d4c99e11f5d (diff)
Present fixed formats with video content and variable formats with stills.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/film_editor.cc49
-rw-r--r--src/wx/film_editor.h5
2 files changed, 46 insertions, 8 deletions
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 9171daa5c..3b26a5537 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -182,11 +182,6 @@ FilmEditor::FilmEditor (Film* f, wxWindow* parent)
_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 ()));
@@ -221,6 +216,7 @@ FilmEditor::FilmEditor (Film* f, wxWindow* parent)
_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 */
@@ -295,6 +291,7 @@ FilmEditor::content_changed (wxCommandEvent &)
_ignore_changes = Film::NONE;
setup_visibility ();
+ setup_formats ();
}
/** Called when the DCP A/B switch has been toggled */
@@ -342,10 +339,19 @@ FilmEditor::film_changed (Film::Property p)
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);
@@ -445,7 +451,8 @@ FilmEditor::format_changed (wxCommandEvent &)
_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;
}
@@ -667,3 +674,31 @@ FilmEditor::audio_gain_calculate_button_clicked (wxCommandEvent &)
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 ();
+}
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index ac9a5fb31..c599cd285 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -68,7 +68,8 @@ private:
void change_dcp_range_clicked (wxCommandEvent &);
void set_things_sensitive (bool);
-
+ void setup_formats ();
+
wxControl* video_control (wxControl *);
wxControl* still_control (wxControl *);
@@ -125,5 +126,7 @@ private:
std::list<wxControl*> _video_controls;
std::list<wxControl*> _still_controls;
+ std::vector<Format const *> _formats;
+
wxSizer* _sizer;
};