Merge master.
[dcpomatic.git] / src / wx / film_editor.cc
index 002f89604289b108c1635c06ee28711610d3f127..ee8ee6d389346598f3e013eeb236c816451eedbd 100644 (file)
@@ -529,6 +529,8 @@ FilmEditor::film_content_changed (int property)
                setup_dcp_name ();
        } else if (property == ContentProperty::PATH) {
                setup_content ();
+       } else if (property == ContentProperty::POSITION) {
+               setup_content ();
        }
 }
 
@@ -749,6 +751,8 @@ FilmEditor::setup_content ()
        _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 ();
@@ -757,7 +761,7 @@ FilmEditor::setup_content ()
                if (!valid) {
                        s = _("MISSING: ") + s;
                }
-                       
+
                _content->InsertItem (t, std_to_wx (s));
 
                if ((*i)->summary() == selected_summary) {
@@ -872,7 +876,7 @@ FilmEditor::selected_content ()
 {
        ContentList sel;
        long int s = -1;
-       while (1) {
+       while (true) {
                s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
                if (s == -1) {
                        break;