+ ScreensChanged ();
+}
+
+
+shared_ptr<Cinema>
+ScreensPanel::item_to_cinema (wxTreeListItem item) const
+{
+ auto iter = _item_to_cinema.find (item);
+ if (iter == _item_to_cinema.end()) {
+ return {};
+ }
+
+ return iter->second;
+}
+
+
+shared_ptr<Screen>
+ScreensPanel::item_to_screen (wxTreeListItem item) const
+{
+ auto iter = _item_to_screen.find (item);
+ if (iter == _item_to_screen.end()) {
+ return {};
+ }
+
+ return iter->second;
+}
+
+
+optional<wxTreeListItem>
+ScreensPanel::cinema_to_item (shared_ptr<Cinema> cinema) const
+{
+ auto iter = _cinema_to_item.find (cinema);
+ if (iter == _cinema_to_item.end()) {
+ return {};
+ }
+
+ return iter->second;
+}
+
+
+optional<wxTreeListItem>
+ScreensPanel::screen_to_item (shared_ptr<Screen> screen) const
+{
+ auto iter = _screen_to_item.find (screen);
+ if (iter == _screen_to_item.end()) {
+ return {};
+ }
+
+ return iter->second;
+}
+
+
+int
+ScreensPanel::compare (string const& utf8_a, string const& utf8_b)
+{
+ if (_collator) {
+ UErrorCode error = U_ZERO_ERROR;
+ boost::scoped_array<uint16_t> utf16_a(new uint16_t[utf8_a.size() + 1]);
+ u_strFromUTF8(reinterpret_cast<UChar*>(utf16_a.get()), utf8_a.size() + 1, nullptr, utf8_a.c_str(), -1, &error);
+ boost::scoped_array<uint16_t> utf16_b(new uint16_t[utf8_b.size() + 1]);
+ u_strFromUTF8(reinterpret_cast<UChar*>(utf16_b.get()), utf8_b.size() + 1, nullptr, utf8_b.c_str(), -1, &error);
+ return ucol_strcoll(_collator, reinterpret_cast<UChar*>(utf16_a.get()), -1, reinterpret_cast<UChar*>(utf16_b.get()), -1);
+ } else {
+ return strcoll(utf8_a.c_str(), utf8_b.c_str());
+ }
+}
+
+
+bool
+ScreensPanel::notify_cinemas_changed()
+{
+ _ignore_cinemas_changed = true;
+ ScopeGuard sg = [this]() { _ignore_cinemas_changed = false; };
+
+ try {
+ Config::instance()->changed(Config::CINEMAS);
+ } catch (FileError& e) {
+ error_dialog(GetParent(), _("Could not write cinema details to the cinemas.xml file. Check that the location of cinemas.xml is valid in DCP-o-matic's preferences."), std_to_wx(e.what()));
+ return false;
+ }
+
+ return true;