+ map<wxTreeItemId, shared_ptr<Cinema> >::iterator i = _cinemas.begin ();
+ list<shared_ptr<Screen> > sc = i->second->screens ();
+ while (i != _cinemas.end() && find (sc.begin(), sc.end(), s.second) == sc.end()) {
+ ++i;
+ }
+
+ if (i == _cinemas.end()) {
+ return;
+ }
+
+ i->second->remove_screen (s.second);
+ _targets->Delete (s.first);
+
+ Config::instance()->write ();
+}
+
+list<shared_ptr<Screen> >
+KDMDialog::screens () const
+{
+ list<shared_ptr<Screen> > s;
+
+ list<pair<wxTreeItemId, shared_ptr<Cinema> > > cinemas = selected_cinemas ();
+ for (list<pair<wxTreeItemId, shared_ptr<Cinema> > >::iterator i = cinemas.begin(); i != cinemas.end(); ++i) {
+ list<shared_ptr<Screen> > sc = i->second->screens ();
+ for (list<shared_ptr<Screen> >::const_iterator j = sc.begin(); j != sc.end(); ++j) {
+ s.push_back (*j);
+ }
+ }
+
+ list<pair<wxTreeItemId, shared_ptr<Screen> > > screens = selected_screens ();
+ for (list<pair<wxTreeItemId, shared_ptr<Screen> > >::iterator i = screens.begin(); i != screens.end(); ++i) {
+ s.push_back (i->second);
+ }
+
+ s.sort ();
+ s.unique ();
+
+ return s;
+}
+
+boost::posix_time::ptime
+KDMDialog::from () const
+{
+ return posix_time (_from_date, _from_time);
+}
+
+boost::posix_time::ptime
+KDMDialog::posix_time (wxDatePickerCtrl* date_picker, wxTimePickerCtrl* time_picker)
+{
+ wxDateTime const date = date_picker->GetValue ();
+ wxDateTime const time = time_picker->GetValue ();
+ return boost::posix_time::ptime (
+ boost::gregorian::date (date.GetYear(), date.GetMonth() + 1, date.GetDay()),
+ boost::posix_time::time_duration (time.GetHour(), time.GetMinute(), time.GetSecond())
+ );
+}
+
+boost::posix_time::ptime
+KDMDialog::until () const
+{
+ return posix_time (_until_date, _until_time);
+}
+
+boost::filesystem::path
+KDMDialog::dcp () const
+{
+ int const item = _dcps->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ assert (item >= 0);
+ return wx_to_std (_dcps->GetItemText (item));
+}
+
+boost::filesystem::path
+KDMDialog::directory () const
+{
+ return wx_to_std (_folder->GetPath ());
+}
+
+bool
+KDMDialog::write_to () const
+{
+ return _write_to->GetValue ();