Fix multi-select in the timeline (#954).
authorCarl Hetherington <cth@carlh.net>
Mon, 26 Sep 2016 11:33:40 +0000 (12:33 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 26 Sep 2016 11:33:40 +0000 (12:33 +0100)
ChangeLog
src/wx/content_panel.cc
src/wx/content_panel.h
src/wx/timeline.cc

index 271b6dec397deb7d213340aed6758799766842fa..46f74aeea4c5606ed445e33c88ab78184658a080 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2016-09-26  c.hetherington  <cth@carlh.net>
 
+       * Fix multi-select in the timeline (#954).
+
        * Add option to Windows installer to add desktop shortcuts (#965).
 
        * Updated zh_CN translation from 刘汉源.
index b28d9ca229fb88e8c730cd0585448b8c0c8570d9..7bea5168757766a9c93c3fd6edae248c1fde4001 100644 (file)
@@ -465,6 +465,19 @@ ContentPanel::set_selection (weak_ptr<Content> wc)
        }
 }
 
+void
+ContentPanel::set_selection (ContentList cl)
+{
+       ContentList content = _film->content ();
+       for (size_t i = 0; i < content.size(); ++i) {
+               if (find(cl.begin(), cl.end(), content[i]) != cl.end()) {
+                       _content->SetItemState (i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+               } else {
+                       _content->SetItemState (i, 0, wxLIST_STATE_SELECTED);
+               }
+       }
+}
+
 void
 ContentPanel::film_content_changed (int property)
 {
index e1a66770c446633fcf72cfda2d9140b26833c26e..e8b31b7f478ef816256d901f69252243c88a3a3f 100644 (file)
@@ -48,6 +48,7 @@ public:
        void set_film (boost::shared_ptr<Film>);
        void set_general_sensitivity (bool s);
        void set_selection (boost::weak_ptr<Content>);
+       void set_selection (ContentList cl);
 
        void film_changed (Film::Property p);
        void film_content_changed (int p);
index 30c2dbddcf6c46cb9818e9ad977cc88351af493a..f93953737781b953751979f9c69177daf4c63158 100644 (file)
@@ -383,9 +383,9 @@ Timeline::left_up (wxMouseEvent& ev)
 
        if (_down_view) {
                _down_view->content()->set_change_signals_frequent (false);
-               _content_panel->set_selection (_down_view->content ());
        }
 
+       _content_panel->set_selection (selected_content ());
        set_position_from_event (ev);
 
        /* Clear up up the stuff we don't do during drag */