X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Feditable_list.h;h=c6cb28a452e8df35fe339d5498a0987812163705;hb=91bd51ff82e99113860570b519459303802bd98f;hp=481a147415e854aa4e6e2d03d77c8a604ef96702;hpb=cb990adba9c57e5107ef2aa9716cf0a26c1df83d;p=dcpomatic.git diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h index 481a14741..c6cb28a45 100644 --- a/src/wx/editable_list.h +++ b/src/wx/editable_list.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,11 +70,6 @@ public: table->Add (s, 0); } - std::vector current = _get (); - for (typename std::vector::iterator i = current.begin (); i != current.end(); ++i) { - add_to_control (*i); - } - _add->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&EditableList::add_clicked, this)); _copy->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&EditableList::copy_clicked, this)); _edit->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&EditableList::edit_clicked, this)); @@ -87,6 +82,16 @@ public: } + void refresh () + { + _list->DeleteAllItems (); + + std::vector current = _get (); + for (typename std::vector::iterator i = current.begin (); i != current.end(); ++i) { + add_to_control (*i); + } + } + private: void add_to_control (T item) @@ -132,7 +137,7 @@ private: } std::vector all = _get (); - assert (item >= 0 && item < int (all.size ())); + DCPOMATIC_ASSERT (item >= 0 && item < int (all.size ())); T copy (all[item]); add_to_control (copy); @@ -149,7 +154,7 @@ private: } std::vector all = _get (); - assert (item >= 0 && item < int (all.size ())); + DCPOMATIC_ASSERT (item >= 0 && item < int (all.size ())); S* dialog = new S (this); dialog->set (all[item]);