diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-12 22:27:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-12 22:27:11 +0100 |
| commit | 4e411ea97b4dab8a5fa282d1d4cf7971ef1e24ad (patch) | |
| tree | 06db8731e77dfeaf537f2814d73c7a599035b95c /src/wx | |
| parent | 8102046b2f29e0c7b234c29bf204b056cb30e64f (diff) | |
| parent | 66162217d93baa3fd50594bb013a44bbd779d02a (diff) | |
Merge master.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/about_dialog.cc | 2 | ||||
| -rw-r--r-- | src/wx/audio_panel.cc | 6 | ||||
| -rw-r--r-- | src/wx/audio_panel.h | 4 | ||||
| -rw-r--r-- | src/wx/config_dialog.cc | 18 | ||||
| -rw-r--r-- | src/wx/content_widget.h | 24 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 40 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 8 | ||||
| -rw-r--r-- | src/wx/isdcf_metadata_dialog.cc (renamed from src/wx/dci_metadata_dialog.cc) | 42 | ||||
| -rw-r--r-- | src/wx/isdcf_metadata_dialog.h (renamed from src/wx/dci_metadata_dialog.h) | 14 | ||||
| -rw-r--r-- | src/wx/timeline.cc | 29 | ||||
| -rw-r--r-- | src/wx/timeline.h | 4 | ||||
| -rw-r--r-- | src/wx/timing_panel.cc | 4 | ||||
| -rw-r--r-- | src/wx/video_panel.cc | 1 | ||||
| -rw-r--r-- | src/wx/wscript | 2 | ||||
| -rw-r--r-- | src/wx/wx_util.cc | 15 | ||||
| -rw-r--r-- | src/wx/wx_util.h | 3 |
16 files changed, 154 insertions, 62 deletions
diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index 105831014..bd4a39811 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -114,6 +114,7 @@ AboutDialog::AboutDialog (wxWindow* parent) wxArrayString supported_by; supported_by.Add (wxT ("Manual AC")); supported_by.Add (wxT ("Kambiz Afshar")); + supported_by.Add (wxT ("Louis Belloisy")); supported_by.Add (wxT ("Jeff Boot")); supported_by.Add (wxT ("Kieran Carroll")); supported_by.Add (wxT ("Frank Cianciolo")); @@ -141,6 +142,7 @@ AboutDialog::AboutDialog (wxWindow* parent) supported_by.Add (wxT ("Lindsay Morris")); supported_by.Add (wxT ("Tim O'Brien")); supported_by.Add (wxT ("Ivan Pullman")); + supported_by.Add (wxT ("Mark Rolfe")); supported_by.Add (wxT ("Andrä Steiner")); supported_by.Add (wxT ("Jussi Siponen")); supported_by.Add (wxT ("Lasse Salling")); diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index ad1990cdc..26237db31 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -51,9 +51,9 @@ AudioPanel::AudioPanel (FilmEditor* e) ++r; add_label_to_grid_bag_sizer (grid, this, _("Audio Gain"), true, wxGBPosition (r, 0)); - _gain = new ContentSpinCtrl<AudioContent> ( + _gain = new ContentSpinCtrlDouble<AudioContent> ( this, - new wxSpinCtrl (this), + new wxSpinCtrlDouble (this), AudioContentProperty::AUDIO_GAIN, boost::mem_fn (&AudioContent::audio_gain), boost::mem_fn (&AudioContent::set_audio_gain) @@ -89,6 +89,8 @@ AudioPanel::AudioPanel (FilmEditor* e) _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6); _gain->wrapped()->SetRange (-60, 60); + _gain->wrapped()->SetDigits (1); + _gain->wrapped()->SetIncrement (0.5); _delay->wrapped()->SetRange (-1000, 1000); _stream->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&AudioPanel::stream_changed, this)); diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h index f1b932e7c..2ba5a9ffc 100644 --- a/src/wx/audio_panel.h +++ b/src/wx/audio_panel.h @@ -21,7 +21,7 @@ #include "film_editor_panel.h" #include "content_widget.h" -class wxSpinCtrl; +class wxSpinCtrlDouble; class wxButton; class wxChoice; class wxStaticText; @@ -44,7 +44,7 @@ private: void mapping_changed (AudioMapping); void setup_stream_description (); - ContentSpinCtrl<AudioContent>* _gain; + ContentSpinCtrlDouble<AudioContent>* _gain; wxButton* _gain_calculate_button; wxButton* _show; ContentSpinCtrl<AudioContent>* _delay; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 631628e1d..68fbc3f1b 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -40,7 +40,7 @@ #include "editable_list.h" #include "filter_dialog.h" #include "dir_picker_ctrl.h" -#include "dci_metadata_dialog.h" +#include "isdcf_metadata_dialog.h" #include "preset_colour_conversion_dialog.h" #include "server_dialog.h" @@ -314,9 +314,9 @@ public: #endif table->Add (_directory, 1, wxEXPAND); - add_label_to_sizer (table, panel, _("Default DCI name details"), true); - _dci_metadata_button = new wxButton (panel, wxID_ANY, _("Edit...")); - table->Add (_dci_metadata_button); + add_label_to_sizer (table, panel, _("Default ISDCF name details"), true); + _isdcf_metadata_button = new wxButton (panel, wxID_ANY, _("Edit...")); + table->Add (_isdcf_metadata_button); add_label_to_sizer (table, panel, _("Default container"), true); _container = new wxChoice (panel, wxID_ANY); @@ -361,7 +361,7 @@ public: _directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); _directory->Bind (wxEVT_COMMAND_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this)); - _dci_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_dci_metadata_clicked, this, parent)); + _isdcf_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_isdcf_metadata_clicked, this, parent)); vector<Ratio const *> ratio = Ratio::all (); int n = 0; @@ -419,11 +419,11 @@ private: Config::instance()->set_default_directory (wx_to_std (_directory->GetPath ())); } - void edit_dci_metadata_clicked (wxWindow* parent) + void edit_isdcf_metadata_clicked (wxWindow* parent) { - DCIMetadataDialog* d = new DCIMetadataDialog (parent, Config::instance()->default_dci_metadata ()); + ISDCFMetadataDialog* d = new ISDCFMetadataDialog (parent, Config::instance()->default_isdcf_metadata ()); d->ShowModal (); - Config::instance()->set_default_dci_metadata (d->dci_metadata ()); + Config::instance()->set_default_isdcf_metadata (d->isdcf_metadata ()); d->Destroy (); } @@ -460,7 +460,7 @@ private: wxSpinCtrl* _j2k_bandwidth; wxSpinCtrl* _audio_delay; - wxButton* _dci_metadata_button; + wxButton* _isdcf_metadata_button; wxSpinCtrl* _still_length; #ifdef DCPOMATIC_USE_OWN_DIR_PICKER DirPickerCtrl* _directory; diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h index 8b7616044..9e1338b7c 100644 --- a/src/wx/content_widget.h +++ b/src/wx/content_widget.h @@ -227,6 +227,30 @@ public: } }; +template <class S> +class ContentSpinCtrlDouble : public ContentWidget<S, wxSpinCtrlDouble, double, double> +{ +public: + ContentSpinCtrlDouble ( + wxWindow* parent, + wxSpinCtrlDouble* wrapped, + int property, + boost::function<double (S*)> getter, + boost::function<void (S*, double)> setter + ) + : ContentWidget<S, wxSpinCtrlDouble, double, double> ( + parent, + wrapped, + property, + getter, setter, + &caster<double, double>, + &caster<double, double> + ) + { + wrapped->Bind (wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, boost::bind (&ContentWidget<S, wxSpinCtrlDouble, double, double>::view_changed, this)); + } +}; + template <class S, class U> class ContentChoice : public ContentWidget<S, wxChoice, U, int> { diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index a6cb77f85..252a89719 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -48,7 +48,7 @@ #include "timecode.h" #include "wx_util.h" #include "film_editor.h" -#include "dci_metadata_dialog.h" +#include "isdcf_metadata_dialog.h" #include "timeline_dialog.h" #include "timing_panel.h" #include "subtitle_panel.h" @@ -125,10 +125,10 @@ FilmEditor::make_dcp_panel () flags |= wxALIGN_RIGHT; #endif - _use_dci_name = new wxCheckBox (_dcp_panel, wxID_ANY, _("Use DCI name")); - grid->Add (_use_dci_name, wxGBPosition (r, 0), wxDefaultSpan, flags); - _edit_dci_button = new wxButton (_dcp_panel, wxID_ANY, _("Details...")); - grid->Add (_edit_dci_button, wxGBPosition (r, 1), wxDefaultSpan); + _use_isdcf_name = new wxCheckBox (_dcp_panel, wxID_ANY, _("Use ISDCF name")); + grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags); + _edit_isdcf_button = new wxButton (_dcp_panel, wxID_ANY, _("Details...")); + grid->Add (_edit_isdcf_button, wxGBPosition (r, 1), wxDefaultSpan); ++r; add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Container"), true, wxGBPosition (r, 0)); @@ -232,8 +232,8 @@ void FilmEditor::connect_to_widgets () { _name->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&FilmEditor::name_changed, this)); - _use_dci_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::use_dci_name_toggled, this)); - _edit_dci_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::edit_dci_button_clicked, this)); + _use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::use_isdcf_name_toggled, this)); + _edit_isdcf_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::edit_isdcf_button_clicked, this)); _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::container_changed, this)); _content->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&FilmEditor::content_selection_changed, this)); _content->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&FilmEditor::content_selection_changed, this)); @@ -468,11 +468,11 @@ FilmEditor::film_changed (Film::Property p) case Film::J2K_BANDWIDTH: checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000); break; - case Film::USE_DCI_NAME: - checked_set (_use_dci_name, _film->use_dci_name ()); + case Film::USE_ISDCF_NAME: + checked_set (_use_isdcf_name, _film->use_isdcf_name ()); setup_dcp_name (); break; - case Film::DCI_METADATA: + case Film::ISDCF_METADATA: setup_dcp_name (); break; case Film::VIDEO_FRAME_RATE: @@ -609,7 +609,7 @@ FilmEditor::set_film (shared_ptr<Film> f) } film_changed (Film::NAME); - film_changed (Film::USE_DCI_NAME); + film_changed (Film::USE_ISDCF_NAME); film_changed (Film::CONTENT); film_changed (Film::DCP_CONTENT_TYPE); film_changed (Film::CONTAINER); @@ -619,7 +619,7 @@ FilmEditor::set_film (shared_ptr<Film> f) film_changed (Film::SIGNED); film_changed (Film::ENCRYPTED); film_changed (Film::J2K_BANDWIDTH); - film_changed (Film::DCI_METADATA); + film_changed (Film::ISDCF_METADATA); film_changed (Film::VIDEO_FRAME_RATE); film_changed (Film::AUDIO_CHANNELS); film_changed (Film::SEQUENCE_VIDEO); @@ -640,8 +640,8 @@ FilmEditor::set_general_sensitivity (bool s) /* Stuff in the Content / DCP tabs */ _name->Enable (s); - _use_dci_name->Enable (s); - _edit_dci_button->Enable (s); + _use_isdcf_name->Enable (s); + _edit_isdcf_button->Enable (s); _content->Enable (s); _content_add_file->Enable (s); _content_add_folder->Enable (s); @@ -691,25 +691,25 @@ FilmEditor::scaler_changed () } void -FilmEditor::use_dci_name_toggled () +FilmEditor::use_isdcf_name_toggled () { if (!_film) { return; } - _film->set_use_dci_name (_use_dci_name->GetValue ()); + _film->set_use_isdcf_name (_use_isdcf_name->GetValue ()); } void -FilmEditor::edit_dci_button_clicked () +FilmEditor::edit_isdcf_button_clicked () { if (!_film) { return; } - DCIMetadataDialog* d = new DCIMetadataDialog (this, _film->dci_metadata ()); + ISDCFMetadataDialog* d = new ISDCFMetadataDialog (this, _film->isdcf_metadata ()); d->ShowModal (); - _film->set_dci_metadata (d->dci_metadata ()); + _film->set_isdcf_metadata (d->isdcf_metadata ()); d->Destroy (); } @@ -863,7 +863,7 @@ FilmEditor::setup_content_sensitivity () _content_remove->Enable (selection.size() == 1 && _generally_sensitive); _content_earlier->Enable (selection.size() == 1 && _generally_sensitive); _content_later->Enable (selection.size() == 1 && _generally_sensitive); - _content_timeline->Enable (_generally_sensitive); + _content_timeline->Enable (!_film->content().empty() && _generally_sensitive); _video_panel->Enable (video_selection.size() > 0 && _generally_sensitive); _audio_panel->Enable (audio_selection.size() > 0 && _generally_sensitive); diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 56e54734b..96cae3900 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -75,8 +75,8 @@ private: /* Handle changes to the view */ void name_changed (); - void use_dci_name_toggled (); - void edit_dci_button_clicked (); + void use_isdcf_name_toggled (); + void edit_isdcf_button_clicked (); void content_selection_changed (); void content_add_file_clicked (); void content_add_folder_clicked (); @@ -131,7 +131,7 @@ private: boost::shared_ptr<Film> _film; wxTextCtrl* _name; wxStaticText* _dcp_name; - wxCheckBox* _use_dci_name; + wxCheckBox* _use_isdcf_name; wxChoice* _container; wxListCtrl* _content; wxButton* _content_add_file; @@ -141,7 +141,7 @@ private: wxButton* _content_later; wxButton* _content_timeline; wxCheckBox* _sequence_video; - wxButton* _edit_dci_button; + wxButton* _edit_isdcf_button; wxChoice* _scaler; wxSpinCtrl* _j2k_bandwidth; wxChoice* _dcp_content_type; diff --git a/src/wx/dci_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc index 700e1b154..e47c944d0 100644 --- a/src/wx/dci_metadata_dialog.cc +++ b/src/wx/isdcf_metadata_dialog.cc @@ -21,13 +21,13 @@ #include <wx/sizer.h> #include <wx/spinctrl.h> #include "lib/film.h" -#include "dci_metadata_dialog.h" +#include "isdcf_metadata_dialog.h" #include "wx_util.h" using boost::shared_ptr; -DCIMetadataDialog::DCIMetadataDialog (wxWindow* parent, DCIMetadata dm) - : TableDialog (parent, _("DCI name"), 2, true) +ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm) + : TableDialog (parent, _("ISDCF name"), 2, true) { add (_("Content version"), true); _content_version = add (new wxSpinCtrl (this, wxID_ANY)); @@ -53,6 +53,24 @@ DCIMetadataDialog::DCIMetadataDialog (wxWindow* parent, DCIMetadata dm) add (_("Package Type (e.g. OV)"), true); _package_type = add (new wxTextCtrl (this, wxID_ANY)); + _temp_version = add (new wxCheckBox (this, wxID_ANY, _("Temp version"))); + add_spacer (); + + _pre_release = add (new wxCheckBox (this, wxID_ANY, _("Pre-release"))); + add_spacer (); + + _red_band = add (new wxCheckBox (this, wxID_ANY, _("Red band"))); + add_spacer (); + + add (_("Chain"), true); + _chain = add (new wxTextCtrl (this, wxID_ANY)); + + _two_d_version_of_three_d = add (new wxCheckBox (this, wxID_ANY, _("2D version of content available in 3D"))); + add_spacer (); + + add (_("Mastered luminance (e.g. 4fl)"), true); + _mastered_luminance = add (new wxTextCtrl (this, wxID_ANY)); + _content_version->SetRange (1, 1024); _content_version->SetValue (dm.content_version); @@ -63,14 +81,20 @@ DCIMetadataDialog::DCIMetadataDialog (wxWindow* parent, DCIMetadata dm) _studio->SetValue (std_to_wx (dm.studio)); _facility->SetValue (std_to_wx (dm.facility)); _package_type->SetValue (std_to_wx (dm.package_type)); + _temp_version->SetValue (dm.temp_version); + _pre_release->SetValue (dm.pre_release); + _red_band->SetValue (dm.red_band); + _chain->SetValue (std_to_wx (dm.chain)); + _two_d_version_of_three_d->SetValue (dm.two_d_version_of_three_d); + _mastered_luminance->SetValue (std_to_wx (dm.mastered_luminance)); layout (); } -DCIMetadata -DCIMetadataDialog::dci_metadata () const +ISDCFMetadata +ISDCFMetadataDialog::isdcf_metadata () const { - DCIMetadata dm; + ISDCFMetadata dm; dm.content_version = _content_version->GetValue (); dm.audio_language = wx_to_std (_audio_language->GetValue ()); @@ -80,6 +104,12 @@ DCIMetadataDialog::dci_metadata () const dm.studio = wx_to_std (_studio->GetValue ()); dm.facility = wx_to_std (_facility->GetValue ()); dm.package_type = wx_to_std (_package_type->GetValue ()); + dm.temp_version = _temp_version->GetValue (); + dm.pre_release = _pre_release->GetValue (); + dm.red_band = _red_band->GetValue (); + dm.chain = wx_to_std (_chain->GetValue ()); + dm.two_d_version_of_three_d = _two_d_version_of_three_d->GetValue (); + dm.mastered_luminance = wx_to_std (_mastered_luminance->GetValue ()); return dm; } diff --git a/src/wx/dci_metadata_dialog.h b/src/wx/isdcf_metadata_dialog.h index 7b93a3ab6..516f83231 100644 --- a/src/wx/dci_metadata_dialog.h +++ b/src/wx/isdcf_metadata_dialog.h @@ -19,18 +19,18 @@ #include <wx/textctrl.h> #include <boost/shared_ptr.hpp> -#include "lib/dci_metadata.h" +#include "lib/isdcf_metadata.h" #include "table_dialog.h" class wxSpinCtrl; class Film; -class DCIMetadataDialog : public TableDialog +class ISDCFMetadataDialog : public TableDialog { public: - DCIMetadataDialog (wxWindow *, DCIMetadata); + ISDCFMetadataDialog (wxWindow *, ISDCFMetadata); - DCIMetadata dci_metadata () const; + ISDCFMetadata isdcf_metadata () const; private: wxSpinCtrl* _content_version; @@ -41,4 +41,10 @@ private: wxTextCtrl* _studio; wxTextCtrl* _facility; wxTextCtrl* _package_type; + wxCheckBox* _temp_version; + wxCheckBox* _pre_release; + wxCheckBox* _red_band; + wxTextCtrl* _chain; + wxCheckBox* _two_d_version_of_three_d; + wxTextCtrl* _mastered_luminance; }; diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index d5643b556..4b56168a1 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -68,7 +68,7 @@ protected: int time_x (DCPTime t) const { - return _timeline.tracks_position().x + t.seconds() * _timeline.pixels_per_second (); + return _timeline.tracks_position().x + t.seconds() * _timeline.pixels_per_second().get_value_or (0); } Timeline& _timeline; @@ -105,7 +105,7 @@ public: return dcpomatic::Rect<int> ( time_x (content->position ()) - 8, y_pos (_track.get()) - 8, - content->length_after_trim().seconds() * _timeline.pixels_per_second() + 16, + content->length_after_trim().seconds() * _timeline.pixels_per_second().get_value_or(0) + 16, _timeline.track_height() + 16 ); } @@ -176,7 +176,7 @@ private: wxDouble name_leading; gc->GetTextExtent (name, &name_width, &name_height, &name_descent, &name_leading); - gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len.seconds() * _timeline.pixels_per_second(), _timeline.track_height())); + gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len.seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.track_height())); gc->DrawText (name, time_x (position) + 12, y_pos (_track.get() + 1) - name_height - 4); gc->ResetClip (); } @@ -292,9 +292,15 @@ private: void do_paint (wxGraphicsContext* gc) { + if (!_timeline.pixels_per_second()) { + return; + } + + double const pps = _timeline.pixels_per_second().get (); + gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID)); - double mark_interval = rint (128 / _timeline.pixels_per_second ()); + double mark_interval = rint (128 / pps); if (mark_interval > 5) { mark_interval -= int (rint (mark_interval)) % 5; } @@ -319,7 +325,7 @@ private: /* Time in seconds */ DCPTime t; - while ((t.seconds() * _timeline.pixels_per_second()) < _timeline.width()) { + while ((t.seconds() * pps) < _timeline.width()) { wxGraphicsPath path = gc->CreatePath (); path.MoveToPoint (time_x (t), _y - 4); path.AddLineToPoint (time_x (t), _y + 4); @@ -339,7 +345,7 @@ private: wxDouble str_leading; gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading); - int const tx = _timeline.x_offset() + t.seconds() * _timeline.pixels_per_second(); + int const tx = _timeline.x_offset() + t.seconds() * pps; if ((tx + str_width) < _timeline.width()) { gc->DrawText (str, time_x (t), _y + 16); } @@ -359,7 +365,6 @@ Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film) , _film (film) , _time_axis_view (new TimeAxisView (*this, 32)) , _tracks (0) - , _pixels_per_second (0) , _left_down (false) , _down_view_position (0) , _first_move (false) @@ -602,6 +607,12 @@ Timeline::right_down (wxMouseEvent& ev) void Timeline::set_position_from_event (wxMouseEvent& ev) { + if (!_pixels_per_second) { + return; + } + + double const pps = _pixels_per_second.get (); + wxPoint const p = ev.GetPosition(); if (!_first_move) { @@ -619,7 +630,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) return; } - DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / _pixels_per_second); + DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / pps); if (_snap) { @@ -660,7 +671,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) if (!first) { /* Snap if it's close; `close' means within a proportion of the time on the timeline */ - if (nearest_distance < DCPTime::from_seconds ((width() / pixels_per_second()) / 32)) { + if (nearest_distance < DCPTime::from_seconds ((width() / pps) / 32)) { new_position = nearest_new_position; } } diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 35153dd17..4ba1cc425 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -52,7 +52,7 @@ public: return 48; } - double pixels_per_second () const { + boost::optional<double> pixels_per_second () const { return _pixels_per_second; } @@ -96,7 +96,7 @@ private: ViewList _views; boost::shared_ptr<TimeAxisView> _time_axis_view; int _tracks; - double _pixels_per_second; + boost::optional<double> _pixels_per_second; bool _left_down; wxPoint _down_point; boost::shared_ptr<ContentView> _down_view; diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index f33e052a1..cc0639b4c 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -19,7 +19,6 @@ #include "lib/content.h" #include "lib/image_content.h" -#include "lib/sndfile_content.h" #include "timing_panel.h" #include "wx_util.h" #include "timecode.h" @@ -134,10 +133,9 @@ TimingPanel::film_content_changed (int property) } shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (content); - shared_ptr<SndfileContent> sc = dynamic_pointer_cast<SndfileContent> (content); _full_length->set_editable (ic && ic->still ()); _play_length->set_editable (!ic || !ic->still ()); - _video_frame_rate->Enable ((ic && !ic->still ()) || sc); + _video_frame_rate->Enable (ic && !ic->still ()); _set_video_frame_rate->Enable (false); } diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 399e71aac..2a5577bc1 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -24,6 +24,7 @@ #include "lib/config.h" #include "lib/util.h" #include "lib/ratio.h" +#include "lib/frame_rate_change.h" #include "filter_dialog.h" #include "video_panel.h" #include "wx_util.h" diff --git a/src/wx/wscript b/src/wx/wscript index cd78f0649..0c87c09be 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -15,7 +15,7 @@ sources = """ config_dialog.cc content_colour_conversion_dialog.cc content_menu.cc - dci_metadata_dialog.cc + isdcf_metadata_dialog.cc dir_picker_ctrl.cc dolby_certificate_dialog.cc doremi_certificate_dialog.cc diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 048f87908..aac35e97a 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -190,6 +190,15 @@ checked_set (wxSpinCtrl* widget, int value) } void +checked_set (wxSpinCtrlDouble* widget, double value) +{ + /* XXX: completely arbitrary epsilon */ + if (fabs (widget->GetValue() - value) < 1e-16) { + widget->SetValue (value); + } +} + +void checked_set (wxChoice* widget, int value) { if (widget->GetSelection() != value) { @@ -297,6 +306,12 @@ wx_get (wxChoice* w) return w->GetSelection (); } +double +wx_get (wxSpinCtrlDouble* w) +{ + return w->GetValue (); +} + void run_gui_loop () { diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 56ed500f6..12a7115d5 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -31,6 +31,7 @@ class wxFilePickerCtrl; class wxSpinCtrl; +class wxSpinCtrlDouble; class wxGridBagSizer; #define DCPOMATIC_SIZER_X_GAP 8 @@ -86,6 +87,7 @@ extern std::string string_client_data (wxClientData* o); extern void checked_set (wxFilePickerCtrl* widget, std::string value); extern void checked_set (wxSpinCtrl* widget, int value); +extern void checked_set (wxSpinCtrlDouble* widget, double value); extern void checked_set (wxChoice* widget, int value); extern void checked_set (wxChoice* widget, std::string value); extern void checked_set (wxTextCtrl* widget, std::string value); @@ -95,6 +97,7 @@ extern void checked_set (wxStaticText* widget, std::string value); extern int wx_get (wxChoice* widget); extern int wx_get (wxSpinCtrl* widget); +extern double wx_get (wxSpinCtrlDouble* widget); /* GTK 2.24.17 has a buggy GtkFileChooserButton and it was put in Ubuntu 13.04. This also seems to apply to 2.24.20 in Ubuntu 13.10 and 2.24.23 in Ubuntu 14.04. |
