diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-24 23:27:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-24 23:27:23 +0100 |
| commit | 165edfe3bb8afd0531729f732701756d711dde16 (patch) | |
| tree | 548b2b263704dcb3ebfd62af76fc27d5a4ffcce6 /src/wx | |
| parent | abd57c6c2e8526eac93e9d0c9bd0b6080de1e6fa (diff) | |
Try to clean up source length handling.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/dcp_range_dialog.cc | 4 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 8 | ||||
| -rw-r--r-- | src/wx/properties_dialog.cc | 27 |
3 files changed, 22 insertions, 17 deletions
diff --git a/src/wx/dcp_range_dialog.cc b/src/wx/dcp_range_dialog.cc index aed6808cb..6363275ca 100644 --- a/src/wx/dcp_range_dialog.cc +++ b/src/wx/dcp_range_dialog.cc @@ -50,10 +50,10 @@ DCPRangeDialog::DCPRangeDialog (wxWindow* p, Film* f) table->Add (_black_out); _n_frames->SetRange (1, INT_MAX - 1); - if (_film->dcp_frames() > 0) { + if (_film->dcp_frames()) { _whole->SetValue (false); _first->SetValue (true); - _n_frames->SetValue (_film->dcp_frames ()); + _n_frames->SetValue (_film->dcp_frames().get()); } else { _whole->SetValue (true); _first->SetValue (false); diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 542cde7d7..b90731cf3 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -478,10 +478,10 @@ FilmEditor::film_changed (Film::Property p) } break; case Film::LENGTH: - if (_film->frames_per_second() > 0 && _film->length() > 0) { - s << _film->length() << " frames; " << seconds_to_hms (_film->length() / _film->frames_per_second()); - } else if (_film->length() > 0) { - s << _film->length() << " frames"; + if (_film->frames_per_second() > 0 && _film->length()) { + s << _film->length().get() << " frames; " << seconds_to_hms (_film->length().get() / _film->frames_per_second()); + } else if (_film->length()) { + s << _film->length().get() << " frames"; } _length->SetLabel (std_to_wx (s.str ())); break; diff --git a/src/wx/properties_dialog.cc b/src/wx/properties_dialog.cc index 67f1fc91b..b8a47e0e3 100644 --- a/src/wx/properties_dialog.cc +++ b/src/wx/properties_dialog.cc @@ -49,16 +49,21 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, Film* film) add_label_to_sizer (table, this, "Frames already encoded"); _encoded = new ThreadedStaticText (this, "counting...", boost::bind (&PropertiesDialog::frames_already_encoded, this)); table->Add (_encoded, 1, wxALIGN_CENTER_VERTICAL); - - _frames->SetLabel (std_to_wx (lexical_cast<string> (_film->length ()))); - double const disk = ((double) Config::instance()->j2k_bandwidth() / 8) * _film->length() / (_film->frames_per_second () * 1073741824); - stringstream s; - s << fixed << setprecision (1) << disk << "Gb"; - _disk_for_frames->SetLabel (std_to_wx (s.str ())); - stringstream t; - t << fixed << setprecision (1) << (disk * 2) << "Gb"; - _total_disk->SetLabel (std_to_wx (t.str ())); + if (_film->length()) { + _frames->SetLabel (std_to_wx (lexical_cast<string> (_film->length().get()))); + double const disk = ((double) Config::instance()->j2k_bandwidth() / 8) * _film->length().get() / (_film->frames_per_second () * 1073741824); + stringstream s; + s << fixed << setprecision (1) << disk << "Gb"; + _disk_for_frames->SetLabel (std_to_wx (s.str ())); + stringstream t; + t << fixed << setprecision (1) << (disk * 2) << "Gb"; + _total_disk->SetLabel (std_to_wx (t.str ())); + } else { + _frames->SetLabel (_("unknown")); + _disk_for_frames->SetLabel (_("unknown")); + _total_disk->SetLabel (_("unknown")); + } wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); overall_sizer->Add (table, 0, wxALL, 6); @@ -82,8 +87,8 @@ PropertiesDialog::frames_already_encoded () const return ""; } - if (_film->length()) { - u << " (" << (_film->encoded_frames() * 100 / _film->length()) << "%)"; + if (_film->dcp_length()) { + u << " (" << (_film->encoded_frames() * 100 / _film->dcp_length().get()) << "%)"; } return u.str (); } |
