diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-04-29 22:14:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-04-29 22:14:46 +0100 |
| commit | 362a5e86b25374054cee29168b2423346d18e922 (patch) | |
| tree | c7578d35b53357c38e2d30c9cc25a750e93ff8bf /src | |
| parent | b4e9d90b9d83c952563ccabc435a5d4310ee4853 (diff) | |
Hand-apply a2f776bd239ef1a744c1a9fea841ac0a51c4f33b from master; more deflickering.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/content_panel.cc | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index aed208ad6..33308b112 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -43,6 +43,7 @@ using std::list; using std::string; using std::cout; +using std::vector; using boost::shared_ptr; using boost::weak_ptr; using boost::dynamic_pointer_cast; @@ -440,6 +441,36 @@ ContentPanel::film_content_changed (int property) void ContentPanel::setup () { + ContentList content = _film->content (); + sort (content.begin(), content.end(), ContentSorter ()); + + /* First, check to see if anything has changed and bail if not; this avoids + flickering on OS X. + */ + + vector<string> existing; + for (int i = 0; i < _content->GetItemCount(); ++i) { + existing.push_back (wx_to_std (_content->GetItemText (i))); + } + + vector<string> proposed; + for (ContentList::iterator i = content.begin(); i != content.end(); ++i) { + bool const valid = (*i)->paths_valid (); + + string s = (*i)->summary (); + if (!valid) { + s = _("MISSING: ") + s; + } + + proposed.push_back (s); + } + + if (existing == proposed) { + return; + } + + /* Something has changed: set up the control */ + string selected_summary; int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (s != -1) { @@ -448,9 +479,6 @@ ContentPanel::setup () _content->DeleteAllItems (); - ContentList content = _film->content (); - sort (content.begin(), content.end(), ContentSorter ()); - for (ContentList::iterator i = content.begin(); i != content.end(); ++i) { int const t = _content->GetItemCount (); bool const valid = (*i)->paths_valid (); @@ -487,8 +515,6 @@ ContentPanel::setup () void ContentPanel::files_dropped (wxDropFilesEvent& event) { - cout << "SHIT!\n"; - if (!_film) { return; } |
