-
- 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::cpl () const
-{
- int const item = _cpl->GetSelection ();
- DCPOMATIC_ASSERT (item >= 0);
- return _cpls[item].cpl_file;
-}
-
-boost::filesystem::path
-KDMDialog::directory () const
-{
- return wx_to_std (_folder->GetPath ());
-}
-
-bool
-KDMDialog::write_to () const
-{
- return _write_to->GetValue ();
-}
-
-dcp::Formulation
-KDMDialog::formulation () const
-{
- return (dcp::Formulation) reinterpret_cast<intptr_t> (_type->GetClientData (_type->GetSelection()));
-}
-
-void
-KDMDialog::update_cpl_choice ()
-{
- _cpl->Clear ();
-
- for (vector<CPLSummary>::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) {
- _cpl->Append (std_to_wx (i->cpl_id));
-
- if (_cpls.size() > 0) {
- _cpl->SetSelection (0);
- }
- }
-
- update_cpl_summary ();
-}
-
-void
-KDMDialog::update_cpl_summary ()
-{
- int const n = _cpl->GetSelection();
- if (n == wxNOT_FOUND) {
- return;
- }
-
- _dcp_directory->SetLabel (std_to_wx (_cpls[n].dcp_directory));
- _cpl_id->SetLabel (std_to_wx (_cpls[n].cpl_id));
- _cpl_annotation_text->SetLabel (std_to_wx (_cpls[n].cpl_annotation_text));
-}
-
-void
-KDMDialog::cpl_browse_clicked ()
-{
- wxFileDialog* d = new wxFileDialog (this, _("Select CPL XML file"), wxEmptyString, wxEmptyString, "*.xml");
- if (d->ShowModal() == wxID_CANCEL) {
- d->Destroy ();
- return;
- }
-
- boost::filesystem::path cpl_file (wx_to_std (d->GetPath ()));
- boost::filesystem::path dcp_dir = cpl_file.parent_path ();
-
- d->Destroy ();
-
- /* XXX: hack alert */
- cxml::Document cpl_document ("CompositionPlaylist");
- cpl_document.read_file (cpl_file);
-
- try {
- _cpls.push_back (
- CPLSummary (
- dcp_dir.filename().string(),
- cpl_document.string_child("Id").substr (9),
- cpl_document.string_child ("ContentTitleText"),
- cpl_file
- )
- );
- } catch (cxml::Error) {
- error_dialog (this, _("This is not a valid CPL file"));
- return;
- }
-
- update_cpl_choice ();
- _cpl->SetSelection (_cpls.size() - 1);
- update_cpl_summary ();