From c5a18da25dd7bba0f65e00312eabc130d5f66fa9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 19 Jul 2013 12:10:37 +0100 Subject: Remove old looping method. --- src/lib/analyse_audio_job.cc | 4 ++-- src/lib/film.cc | 28 +++++---------------------- src/lib/film.h | 9 ++------- src/lib/player.cc | 2 +- src/lib/playlist.cc | 46 ++++---------------------------------------- src/lib/playlist.h | 13 ++----------- src/lib/transcode_job.cc | 2 +- src/lib/writer.cc | 4 ++-- 8 files changed, 19 insertions(+), 89 deletions(-) (limited to 'src/lib') diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 9a9116690..2848c1ed7 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -68,14 +68,14 @@ AnalyseAudioJob::run () player->Audio.connect (bind (&AnalyseAudioJob::audio, this, _1, _2)); - _samples_per_point = max (int64_t (1), _film->time_to_audio_frames (_film->length_without_loop()) / _num_points); + _samples_per_point = max (int64_t (1), _film->time_to_audio_frames (_film->length()) / _num_points); _current.resize (_film->dcp_audio_channels ()); _analysis.reset (new AudioAnalysis (_film->dcp_audio_channels ())); _done = 0; while (!player->pass ()) { - set_progress (double (_film->audio_frames_to_time (_done)) / _film->length_without_loop ()); + set_progress (double (_film->audio_frames_to_time (_done)) / _film->length ()); } _analysis->write (content->audio_analysis_path ()); diff --git a/src/lib/film.cc b/src/lib/film.cc index 2bb8b3155..172fd20ab 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -246,7 +246,7 @@ Film::make_dcp () throw MissingSettingError (_("container")); } - if (content_without_loop().empty()) { + if (content().empty()) { throw StringError (_("You must add some content to the DCP before creating it")); } @@ -729,9 +729,9 @@ Film::playlist () const } Playlist::ContentList -Film::content_without_loop () const +Film::content () const { - return _playlist->content_without_loop (); + return _playlist->content (); } void @@ -769,15 +769,9 @@ Film::remove_content (shared_ptr c) } Time -Film::length_with_loop () const +Film::length () const { - return _playlist->length_with_loop (); -} - -Time -Film::length_without_loop () const -{ - return _playlist->length_without_loop (); + return _playlist->length (); } bool @@ -810,18 +804,6 @@ Film::playlist_changed () signal_changed (CONTENT); } -int -Film::loop () const -{ - return _playlist->loop (); -} - -void -Film::set_loop (int c) -{ - _playlist->set_loop (c); -} - OutputAudioFrame Film::time_to_audio_frames (Time t) const { diff --git a/src/lib/film.h b/src/lib/film.h index 1f3899885..497320c5e 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -106,16 +106,12 @@ public: /* Proxies for some Playlist methods */ - Playlist::ContentList content_without_loop () const; + Playlist::ContentList content () const; - Time length_with_loop () const; - Time length_without_loop () const; + Time length () const; bool has_subtitles () const; OutputVideoFrame best_dcp_video_frame_rate () const; - void set_loop (int); - int loop () const; - void set_sequence_video (bool); /** Identifiers for the parts of our state; @@ -127,7 +123,6 @@ public: USE_DCI_NAME, /** The playlist's content list has changed (i.e. content has been added, moved around or removed) */ CONTENT, - LOOP, DCP_CONTENT_TYPE, CONTAINER, RESOLUTION, diff --git a/src/lib/player.cc b/src/lib/player.cc index f5212f8d0..ec20892ef 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -401,7 +401,7 @@ Player::setup_pieces () _pieces.clear (); - Playlist::ContentList content = _playlist->content_with_loop (); + Playlist::ContentList content = _playlist->content (); sort (content.begin(), content.end(), ContentSorter ()); for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) { diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 172b6fbb9..c70c79972 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -49,8 +49,7 @@ using boost::dynamic_pointer_cast; using boost::lexical_cast; Playlist::Playlist () - : _loop (1) - , _sequence_video (true) + : _sequence_video (true) , _sequencing_video (false) { @@ -109,8 +108,6 @@ Playlist::video_identifier () const } } - t += lexical_cast (_loop); - return md5_digest (t.c_str(), t.length()); } @@ -124,7 +121,6 @@ Playlist::set_from_xml (shared_ptr film, shared_ptrnumber_child ("Loop"); _sequence_video = node->bool_child ("SequenceVideo"); } @@ -136,7 +132,6 @@ Playlist::as_xml (xmlpp::Node* node) (*i)->as_xml (node->add_child ("Content")); } - node->add_child("Loop")->add_child_text(lexical_cast (_loop)); node->add_child("SequenceVideo")->add_child_text(_sequence_video ? "1" : "0"); } @@ -162,13 +157,6 @@ Playlist::remove (shared_ptr c) } } -void -Playlist::set_loop (int l) -{ - _loop = l; - Changed (); -} - bool Playlist::has_subtitles () const { @@ -246,7 +234,7 @@ Playlist::best_dcp_frame_rate () const } Time -Playlist::length_without_loop () const +Playlist::length () const { Time len = 0; for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { @@ -256,12 +244,6 @@ Playlist::length_without_loop () const return len; } -Time -Playlist::length_with_loop () const -{ - return length_without_loop() * _loop; -} - void Playlist::reconnect () { @@ -301,29 +283,9 @@ ContentSorter::operator() (shared_ptr a, shared_ptr b) return a->start() < b->start(); } -/** @return content in an undefined order, not taking looping into account */ +/** @return content in an undefined order */ Playlist::ContentList -Playlist::content_without_loop () const +Playlist::content () const { return _content; } - -/** @return content in an undefined order, taking looping into account */ -Playlist::ContentList -Playlist::content_with_loop () const -{ - ContentList looped = _content; - Time const length = length_without_loop (); - - Time offset = length; - for (int i = 1; i < _loop; ++i) { - for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { - shared_ptr copy = (*i)->clone (); - copy->set_start (copy->start() + offset); - looped.push_back (copy); - } - offset += length; - } - - return looped; -} diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 330681c56..735ef7a43 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -65,19 +65,11 @@ public: typedef std::vector > ContentList; - ContentList content_without_loop () const; - ContentList content_with_loop () const; + ContentList content () const; std::string video_identifier () const; - int loop () const { - return _loop; - } - - void set_loop (int l); - - Time length_without_loop () const; - Time length_with_loop () const; + Time length () const; int best_dcp_frame_rate () const; Time video_end () const; @@ -94,7 +86,6 @@ private: void reconnect (); ContentList _content; - int _loop; bool _sequence_video; bool _sequencing_video; std::list _content_connections; diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index f0faf7c63..6d5edd7c0 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -111,6 +111,6 @@ TranscodeJob::remaining_time () const } /* Compute approximate proposed length here, as it's only here that we need it */ - OutputVideoFrame const left = _film->time_to_video_frames (_film->length_with_loop ()) - _transcoder->video_frames_out(); + OutputVideoFrame const left = _film->time_to_video_frames (_film->length ()) - _transcoder->video_frames_out(); return left / fps; } diff --git a/src/lib/writer.cc b/src/lib/writer.cc index b3d2fdb1c..c5360a122 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -204,9 +204,9 @@ try } lock.lock (); - if (_film->length_with_loop()) { + if (_film->length()) { _job->set_progress ( - float (_full_written + _fake_written + _repeat_written) / _film->time_to_video_frames (_film->length_with_loop()) + float (_full_written + _fake_written + _repeat_written) / _film->time_to_video_frames (_film->length()) ); } -- cgit v1.2.3 From abc6fa5ea5877a3a4d6eb65b7819821ed99a042c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 19 Jul 2013 13:02:41 +0100 Subject: Fix initial length of stills. --- src/lib/imagemagick_content.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/imagemagick_content.cc b/src/lib/imagemagick_content.cc index 79623b21c..d427e00b2 100644 --- a/src/lib/imagemagick_content.cc +++ b/src/lib/imagemagick_content.cc @@ -27,6 +27,7 @@ #include "i18n.h" using std::string; +using std::cout; using std::stringstream; using boost::shared_ptr; @@ -76,8 +77,8 @@ ImageMagickContent::examine (shared_ptr job) shared_ptr examiner (new ImageMagickExaminer (film, shared_from_this())); - set_video_length (Config::instance()->default_still_length() * video_frame_rate()); take_from_video_examiner (examiner); + set_video_length (Config::instance()->default_still_length() * video_frame_rate()); } void -- cgit v1.2.3 From 86461ade4087f8473c1e8b063907d92884813843 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 19 Jul 2013 13:23:54 +0100 Subject: Basic repeat. --- src/lib/playlist.cc | 15 +++++++ src/lib/playlist.h | 2 + src/wx/repeat_dialog.cc | 54 ++++++++++++++++++++++++ src/wx/repeat_dialog.h | 32 ++++++++++++++ src/wx/timeline.cc | 109 ++++++++++++++++++++++++++++++++++++++++++------ src/wx/timeline.h | 9 +++- src/wx/wscript | 1 + 7 files changed, 209 insertions(+), 13 deletions(-) create mode 100644 src/wx/repeat_dialog.cc create mode 100644 src/wx/repeat_dialog.h (limited to 'src/lib') diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index c70c79972..31b16b646 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -289,3 +289,18 @@ Playlist::content () const { return _content; } + +void +Playlist::repeat (shared_ptr c, int n) +{ + Time pos = c->end (); + for (int i = 0; i < n; ++i) { + shared_ptr copy = c->clone (); + copy->set_start (pos); + _content.push_back (copy); + pos = copy->end (); + } + + reconnect (); + Changed (); +} diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 735ef7a43..e949de0ea 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -77,6 +77,8 @@ public: void set_sequence_video (bool); void maybe_sequence_video (); + void repeat (boost::shared_ptr, int); + mutable boost::signals2::signal Changed; /** Third parameter is true if signals are currently being emitted frequently */ mutable boost::signals2::signal, int, bool)> ContentChanged; diff --git a/src/wx/repeat_dialog.cc b/src/wx/repeat_dialog.cc new file mode 100644 index 000000000..9eb02ba57 --- /dev/null +++ b/src/wx/repeat_dialog.cc @@ -0,0 +1,54 @@ +/* + Copyright (C) 2013 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "repeat_dialog.h" +#include "wx_util.h" + +RepeatDialog::RepeatDialog (wxWindow* parent) + : wxDialog (parent, wxID_ANY, _("Repeat Content")) +{ + wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); + SetSizer (overall_sizer); + + wxFlexGridSizer* table = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + table->AddGrowableCol (1, 1); + overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6); + + add_label_to_sizer (table, this, _("Repeat"), true); + _number = new wxSpinCtrl (this, wxID_ANY); + table->Add (_number, 1); + + add_label_to_sizer (table, this, _("times"), false); + + _number->SetRange (1, 1024); + + wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); + if (buttons) { + overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); + } + + overall_sizer->Layout (); + overall_sizer->SetSizeHints (this); +} + +int +RepeatDialog::number () const +{ + return _number->GetValue (); +} diff --git a/src/wx/repeat_dialog.h b/src/wx/repeat_dialog.h new file mode 100644 index 000000000..cbcc6bb7a --- /dev/null +++ b/src/wx/repeat_dialog.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2013 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include + +class RepeatDialog : public wxDialog +{ +public: + RepeatDialog (wxWindow *); + + int number () const; + +private: + wxSpinCtrl* _number; +}; diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 8d70a9381..e3eca8a1d 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -25,6 +25,7 @@ #include "film_editor.h" #include "timeline.h" #include "wx_util.h" +#include "repeat_dialog.h" using std::list; using std::cout; @@ -314,6 +315,10 @@ private: int _y; }; +enum { + ID_repeat +}; + Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr film) : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE) , _film_editor (ed) @@ -324,26 +329,25 @@ Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr film) , _left_down (false) , _down_view_start (0) , _first_move (false) + , _menu (0) { #ifndef __WXOSX__ SetDoubleBuffered (true); #endif - setup_pixels_per_time_unit (); - Connect (wxID_ANY, wxEVT_PAINT, wxPaintEventHandler (Timeline::paint), 0, this); Connect (wxID_ANY, wxEVT_LEFT_DOWN, wxMouseEventHandler (Timeline::left_down), 0, this); Connect (wxID_ANY, wxEVT_LEFT_UP, wxMouseEventHandler (Timeline::left_up), 0, this); + Connect (wxID_ANY, wxEVT_RIGHT_DOWN, wxMouseEventHandler (Timeline::right_down), 0, this); Connect (wxID_ANY, wxEVT_MOTION, wxMouseEventHandler (Timeline::mouse_moved), 0, this); Connect (wxID_ANY, wxEVT_SIZE, wxSizeEventHandler (Timeline::resized), 0, this); + Connect (ID_repeat, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Timeline::repeat), 0, this); playlist_changed (); SetMinSize (wxSize (640, tracks() * track_height() + 96)); _playlist_connection = film->playlist()->Changed.connect (bind (&Timeline::playlist_changed, this)); - - _views.push_back (_time_axis_view); } void @@ -374,6 +378,7 @@ Timeline::playlist_changed () } _views.clear (); + _views.push_back (_time_axis_view); Playlist::ContentList content = fl->playlist()->content (); @@ -387,6 +392,7 @@ Timeline::playlist_changed () } assign_tracks (); + setup_pixels_per_time_unit (); Refresh (); } @@ -463,8 +469,8 @@ Timeline::setup_pixels_per_time_unit () _pixels_per_time_unit = static_cast(width() - x_offset() * 2) / film->length (); } -void -Timeline::left_down (wxMouseEvent& ev) +shared_ptr +Timeline::event_to_view (wxMouseEvent& ev) { list >::iterator i = _views.begin(); Position const p (ev.GetX(), ev.GetY()); @@ -472,21 +478,33 @@ Timeline::left_down (wxMouseEvent& ev) ++i; } + if (i == _views.end ()) { + return shared_ptr (); + } + + return *i; +} + +void +Timeline::left_down (wxMouseEvent& ev) +{ + shared_ptr view = event_to_view (ev); + _down_view.reset (); - if (i != _views.end ()) { - shared_ptr cv = dynamic_pointer_cast (*i); + if (view) { + shared_ptr cv = dynamic_pointer_cast (view); if (cv) { _down_view = cv; _down_view_start = cv->content()->start (); } } - for (list >::iterator j = _views.begin(); j != _views.end(); ++j) { - shared_ptr cv = dynamic_pointer_cast (*j); + for (list >::iterator i = _views.begin(); i != _views.end(); ++i) { + shared_ptr cv = dynamic_pointer_cast (*i); if (cv) { - cv->set_selected (i == j); - if (i == j) { + cv->set_selected (view == *i); + if (view == *i) { _film_editor->set_selection (cv->content ()); } } @@ -523,6 +541,28 @@ Timeline::mouse_moved (wxMouseEvent& ev) set_start_from_event (ev); } +void +Timeline::right_down (wxMouseEvent& ev) +{ + shared_ptr view = event_to_view (ev); + shared_ptr cv = dynamic_pointer_cast (view); + if (!cv) { + return; + } + + if (!cv->selected ()) { + clear_selection (); + cv->set_selected (true); + } + + if (!_menu) { + _menu = new wxMenu; + _menu->Append (ID_repeat, _("Repeat...")); + } + + PopupMenu (_menu, ev.GetPosition ()); +} + void Timeline::set_start_from_event (wxMouseEvent& ev) { @@ -563,3 +603,48 @@ Timeline::resized (wxSizeEvent &) { setup_pixels_per_time_unit (); } + +void +Timeline::clear_selection () +{ + for (list >::iterator i = _views.begin(); i != _views.end(); ++i) { + shared_ptr cv = dynamic_pointer_cast (*i); + if (cv) { + cv->set_selected (false); + } + } +} + +void +Timeline::repeat (wxCommandEvent &) +{ + shared_ptr sel = selected (); + if (!sel) { + return; + } + + RepeatDialog d (this); + d.ShowModal (); + + shared_ptr film = _film.lock (); + if (!film) { + return; + } + + film->playlist()->repeat (sel->content (), d.number ()); + d.Destroy (); +} + +shared_ptr +Timeline::selected () const +{ + for (list >::const_iterator i = _views.begin(); i != _views.end(); ++i) { + shared_ptr cv = dynamic_pointer_cast (*i); + if (cv && cv->selected()) { + return cv; + } + } + + return shared_ptr (); +} + diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 6979d6a78..a50f8e692 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -64,13 +64,19 @@ public: private: void paint (wxPaintEvent &); void left_down (wxMouseEvent &); - void mouse_moved (wxMouseEvent &); void left_up (wxMouseEvent &); + void right_down (wxMouseEvent &); + void mouse_moved (wxMouseEvent &); void playlist_changed (); void setup_pixels_per_time_unit (); void resized (wxSizeEvent &); void assign_tracks (); void set_start_from_event (wxMouseEvent &); + void clear_selection (); + void repeat (wxCommandEvent &); + + boost::shared_ptr event_to_view (wxMouseEvent &); + boost::shared_ptr selected () const; FilmEditor* _film_editor; boost::weak_ptr _film; @@ -83,6 +89,7 @@ private: boost::shared_ptr _down_view; Time _down_view_start; bool _first_move; + wxMenu* _menu; boost::signals2::scoped_connection _playlist_connection; }; diff --git a/src/wx/wscript b/src/wx/wscript index 9dea367c9..3402d4b41 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -21,6 +21,7 @@ sources = """ job_wrapper.cc new_film_dialog.cc properties_dialog.cc + repeat_dialog.cc server_dialog.cc timecode.cc timeline.cc -- cgit v1.2.3 From 3d9fdcf7e6a5d775a2688a071b69264b1a6971c7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 19 Jul 2013 13:39:14 +0100 Subject: Allow repeat of multiple stuff. --- src/lib/playlist.cc | 23 +++++++++++++++++------ src/lib/playlist.h | 2 +- src/wx/timeline.cc | 46 ++++++++++++++++++++++++++++++---------------- src/wx/timeline.h | 2 +- 4 files changed, 49 insertions(+), 24 deletions(-) (limited to 'src/lib') diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 31b16b646..e4494acb0 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -42,6 +42,7 @@ using std::min; using std::max; using std::string; using std::stringstream; +using std::pair; using boost::optional; using boost::shared_ptr; using boost::weak_ptr; @@ -291,14 +292,24 @@ Playlist::content () const } void -Playlist::repeat (shared_ptr c, int n) +Playlist::repeat (list > c, int n) { - Time pos = c->end (); + pair range (TIME_MAX, 0); + for (list >::iterator i = c.begin(); i != c.end(); ++i) { + range.first = min (range.first, (*i)->start ()); + range.second = max (range.second, (*i)->start ()); + range.first = min (range.first, (*i)->end ()); + range.second = max (range.second, (*i)->end ()); + } + + Time pos = range.second; for (int i = 0; i < n; ++i) { - shared_ptr copy = c->clone (); - copy->set_start (pos); - _content.push_back (copy); - pos = copy->end (); + for (list >::iterator i = c.begin(); i != c.end(); ++i) { + shared_ptr copy = (*i)->clone (); + copy->set_start (pos + copy->start() - range.first); + _content.push_back (copy); + } + pos += range.second - range.first; } reconnect (); diff --git a/src/lib/playlist.h b/src/lib/playlist.h index e949de0ea..1d69c34ba 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -77,7 +77,7 @@ public: void set_sequence_video (bool); void maybe_sequence_video (); - void repeat (boost::shared_ptr, int); + void repeat (std::list >, int); mutable boost::signals2::signal Changed; /** Third parameter is true if signals are currently being emitted frequently */ diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index e3eca8a1d..f9205fc5d 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -489,25 +489,32 @@ void Timeline::left_down (wxMouseEvent& ev) { shared_ptr view = event_to_view (ev); + shared_ptr content_view = dynamic_pointer_cast (view); _down_view.reset (); - if (view) { - shared_ptr cv = dynamic_pointer_cast (view); - if (cv) { - _down_view = cv; - _down_view_start = cv->content()->start (); - } + if (content_view) { + _down_view = content_view; + _down_view_start = content_view->content()->start (); } for (list >::iterator i = _views.begin(); i != _views.end(); ++i) { shared_ptr cv = dynamic_pointer_cast (*i); - if (cv) { + if (!cv) { + continue; + } + + if (!ev.ShiftDown ()) { cv->set_selected (view == *i); - if (view == *i) { - _film_editor->set_selection (cv->content ()); - } } + + if (view == *i) { + _film_editor->set_selection (cv->content ()); + } + } + + if (content_view && ev.ShiftDown ()) { + content_view->set_selected (!content_view->selected ()); } _left_down = true; @@ -618,8 +625,8 @@ Timeline::clear_selection () void Timeline::repeat (wxCommandEvent &) { - shared_ptr sel = selected (); - if (!sel) { + list > sel = selected (); + if (sel.empty ()) { return; } @@ -631,20 +638,27 @@ Timeline::repeat (wxCommandEvent &) return; } - film->playlist()->repeat (sel->content (), d.number ()); + list > content; + for (list >::iterator i = sel.begin(); i != sel.end(); ++i) { + content.push_back ((*i)->content ()); + } + + film->playlist()->repeat (content, d.number ()); d.Destroy (); } -shared_ptr +list > Timeline::selected () const { + list > sel; + for (list >::const_iterator i = _views.begin(); i != _views.end(); ++i) { shared_ptr cv = dynamic_pointer_cast (*i); if (cv && cv->selected()) { - return cv; + sel.push_back (cv); } } - return shared_ptr (); + return sel; } diff --git a/src/wx/timeline.h b/src/wx/timeline.h index a50f8e692..99094788f 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -76,7 +76,7 @@ private: void repeat (wxCommandEvent &); boost::shared_ptr event_to_view (wxMouseEvent &); - boost::shared_ptr selected () const; + std::list > selected () const; FilmEditor* _film_editor; boost::weak_ptr _film; -- cgit v1.2.3 From 7370f2b159a539d4a7721a50d0f3dc56ba14c678 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 19 Jul 2013 13:42:27 +0100 Subject: Normalise labelling of types a bit. --- src/lib/ffmpeg_content.cc | 2 +- src/lib/imagemagick_content.cc | 2 +- src/lib/sndfile_content.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index ebad8c8bd..8419fd31f 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -165,7 +165,7 @@ FFmpegContent::examine (shared_ptr job) string FFmpegContent::summary () const { - return String::compose (_("Movie: %1"), file().filename().string()); + return String::compose (_("%1 [movie]"), file().filename().string()); } string diff --git a/src/lib/imagemagick_content.cc b/src/lib/imagemagick_content.cc index d427e00b2..0c4e84015 100644 --- a/src/lib/imagemagick_content.cc +++ b/src/lib/imagemagick_content.cc @@ -48,7 +48,7 @@ ImageMagickContent::ImageMagickContent (shared_ptr f, shared_ptr f, shared_ptr