Fix flicker in timeline view when selecting (in some cases).
[dcpomatic.git] / src / wx / content_panel.cc
index 41a18f4b4a6bfaa3fec493d0fa3fdbb526884750..a860b007918d75adf99337f846a03942708c1a7d 100644 (file)
@@ -89,6 +89,7 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV
        , _film_viewer (viewer)
        , _generally_sensitive (true)
        , _ignore_deselect (false)
+       , _no_check_selection (false)
 {
        for (int i = 0; i < TEXT_COUNT; ++i) {
                _text_panel[i] = 0;
@@ -303,6 +304,10 @@ ContentPanel::check_selection ()
                return;
        }
 
+       if (_no_check_selection) {
+               return;
+       }
+
        _last_selected = selected ();
 
        setup_sensitivity ();
@@ -662,6 +667,8 @@ ContentPanel::set_selection (weak_ptr<Content> wc)
 void
 ContentPanel::set_selection (ContentList cl)
 {
+       _no_check_selection = true;
+
        ContentList content = _film->content ();
        for (size_t i = 0; i < content.size(); ++i) {
                if (find(cl.begin(), cl.end(), content[i]) != cl.end()) {
@@ -670,6 +677,9 @@ ContentPanel::set_selection (ContentList cl)
                        _content->SetItemState (i, 0, wxLIST_STATE_SELECTED);
                }
        }
+
+       _no_check_selection = false;
+       check_selection ();
 }
 
 void