summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-10 23:31:28 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-10 23:31:28 +0000
commitd1db495ddf466c47f635ac78eec9229ecfa24722 (patch)
tree174b6a4b995fa691d731385c9ac0c0ce4c4c18b5 /src
parent3021ac636b39e61df5c90f9c3e75fde66d6fb97f (diff)
Allow multiple selection; return multiple selection from FilmEditor methods.
Diffstat (limited to 'src')
-rw-r--r--src/lib/types.h6
-rw-r--r--src/wx/film_editor.cc68
-rw-r--r--src/wx/film_editor.h8
3 files changed, 52 insertions, 30 deletions
diff --git a/src/lib/types.h b/src/lib/types.h
index d4d66387d..ad706270e 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -26,6 +26,9 @@
#include <libdcp/util.h>
class Content;
+class VideoContent;
+class AudioContent;
+class SubtitleContent;
class AudioBuffers;
/** The version number of the protocol used to communicate
@@ -40,6 +43,9 @@ typedef int64_t Time;
typedef int64_t OutputAudioFrame;
typedef int OutputVideoFrame;
typedef std::vector<boost::shared_ptr<Content> > ContentList;
+typedef std::vector<boost::shared_ptr<VideoContent> > VideoContentList;
+typedef std::vector<boost::shared_ptr<AudioContent> > AudioContentList;
+typedef std::vector<boost::shared_ptr<SubtitleContent> > SubtitleContentList;
template<class T>
struct TimedAudioBuffers
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index b789a8266..99b3c59a5 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -258,7 +258,7 @@ FilmEditor::make_content_panel ()
{
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _content = new wxListCtrl (_content_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL);
+ _content = new wxListCtrl (_content_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER);
s->Add (_content, 1, wxEXPAND | wxTOP | wxBOTTOM, 6);
_content->InsertColumn (0, wxT(""));
@@ -832,53 +832,69 @@ FilmEditor::setup_content_sensitivity ()
_timing_panel->Enable (selection && _generally_sensitive);
}
-shared_ptr<Content>
+ContentList
FilmEditor::selected_content ()
{
- int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- if (s == -1) {
- return shared_ptr<Content> ();
- }
+ ContentList sel;
+ long int s = -1;
+ while (1) {
+ s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (s == -1) {
+ break;
+ }
- ContentList c = _film->content ();
- if (s < 0 || size_t (s) >= c.size ()) {
- return shared_ptr<Content> ();
+ sel.push_back (_film->content[s]);
}
-
- return c[s];
+
+ return sel;
}
-shared_ptr<VideoContent>
+VideoContentList
FilmEditor::selected_video_content ()
{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- return shared_ptr<VideoContent> ();
+ ContentList c = selected_content ();
+ VideoContentList vc;
+
+ for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<VideoContent> t = dynamic_pointer_cast<VideoContent> (*i);
+ if (t) {
+ vc.push_back (t);
+ }
}
- return dynamic_pointer_cast<VideoContent> (c);
+ return vc;
}
-shared_ptr<AudioContent>
+AudioContentList
FilmEditor::selected_audio_content ()
{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- return shared_ptr<AudioContent> ();
+ ContentList c = selected_content ();
+ AudioContentList ac;
+
+ for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<AudioContent> t = dynamic_pointer_cast<AudioContent> (*i);
+ if (t) {
+ ac.push_back (t);
+ }
}
- return dynamic_pointer_cast<AudioContent> (c);
+ return ac;
}
-shared_ptr<SubtitleContent>
+SubtitleContentList
FilmEditor::selected_subtitle_content ()
{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- return shared_ptr<SubtitleContent> ();
+ ContentList c = selected_content ();
+ SubtitleContentList sc;
+
+ for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<SubtitleContent> t = dynamic_pointer_cast<SubtitleContent> (*i);
+ if (t) {
+ sc.push_back (t);
+ }
}
- return dynamic_pointer_cast<SubtitleContent> (c);
+ return sc;
}
void
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 80c35d3d8..9808e0d2f 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -62,10 +62,10 @@ public:
return _film;
}
- boost::shared_ptr<Content> selected_content ();
- boost::shared_ptr<VideoContent> selected_video_content ();
- boost::shared_ptr<AudioContent> selected_audio_content ();
- boost::shared_ptr<SubtitleContent> selected_subtitle_content ();
+ ContentList selected_content ();
+ VideoContentList selected_video_content ();
+ AudioContentList selected_audio_content ();
+ SubtitleContentList selected_subtitle_content ();
private:
void make_dcp_panel ();