X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fkdm_dialog.cc;h=f6baecdf2826d06de594e1bd02f424477d963c7d;hb=1858190cff2f960f3d1f0a5cc02c69da86088f5b;hp=3e630148268bfee9f7a7807a901eb67f2d0dcc04;hpb=c30f9b2c7fc20e05e73b0d5ebf9dae9a1d87eeb9;p=dcpomatic.git diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 3e6301482..f6baecdf2 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -17,24 +17,26 @@ */ -#include -#include -#include -#include -#include -#include -#include "lib/cinema.h" -#include "lib/config.h" -#include "lib/film.h" #include "kdm_dialog.h" #include "cinema_dialog.h" #include "screen_dialog.h" #include "wx_util.h" +#include "lib/cinema.h" +#include "lib/config.h" +#include "lib/film.h" +#include "lib/screen.h" +#include #ifdef DCPOMATIC_USE_OWN_DIR_PICKER #include "dir_picker_ctrl.h" #else #include #endif +#include +#include +#include +#include +#include +#include using std::string; using std::map; @@ -60,9 +62,9 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) wxStaticText* h = new wxStaticText (this, wxID_ANY, _("Screens")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL); - + wxBoxSizer* targets = new wxBoxSizer (wxHORIZONTAL); - _targets = new wxTreeCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT | wxTR_MULTIPLE | wxTR_HAS_BUTTONS); + _targets = new wxTreeCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT | wxTR_MULTIPLE | wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT); targets->Add (_targets, 1, wxEXPAND | wxTOP | wxRIGHT, DCPOMATIC_SIZER_GAP); _root = _targets->AddRoot ("Foo"); @@ -82,7 +84,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) target_buttons->Add (_edit_cinema, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); _remove_cinema = new wxButton (this, wxID_ANY, _("Remove Cinema")); target_buttons->Add (_remove_cinema, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - + _add_screen = new wxButton (this, wxID_ANY, _("Add Screen...")); target_buttons->Add (_add_screen, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); _edit_screen = new wxButton (this, wxID_ANY, _("Edit Screen...")); @@ -99,7 +101,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) h = new wxStaticText (this, wxID_ANY, S_("KDM|Timing")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); - + wxFlexGridSizer* table = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); add_label_to_sizer (table, this, _("From"), true); wxDateTime from; @@ -125,7 +127,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) h = new wxStaticText (this, wxID_ANY, _("CPL")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); - + /* CPL choice */ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); add_label_to_sizer (s, this, _("CPL"), true); @@ -147,16 +149,16 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) _cpl_annotation_text = new wxStaticText (this, wxID_ANY, ""); table->Add (_cpl_annotation_text); vertical->Add (table, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP + 2); - + _cpls = film->cpls (); update_cpl_choice (); - + /* Sub-heading: Output */ h = new wxStaticText (this, wxID_ANY, _("Output")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); - + table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0); add_label_to_sizer (table, this, _("KDM type"), true); @@ -173,19 +175,19 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) table->Add (_write_to, 1, wxEXPAND); #ifdef DCPOMATIC_USE_OWN_DIR_PICKER - _folder = new DirPickerCtrl (this); -#else + _folder = new DirPickerCtrl (this); +#else _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1)); #endif _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir()); - + table->Add (_folder, 1, wxEXPAND); _email = new wxRadioButton (this, wxID_ANY, _("Send by email")); table->Add (_email, 1, wxEXPAND); table->AddSpacer (0); - + vertical->Add (table, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP); /* Make an overall sizer to get a nice border, and put some buttons in */ @@ -195,7 +197,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); if (buttons) { - overall_sizer->Add (buttons, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_Y_GAP); + overall_sizer->Add (buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP); } _write_to->SetValue (true); @@ -265,15 +267,15 @@ KDMDialog::setup_sensitivity () bool const sc = selected_cinemas().size() == 1; bool const ss = selected_screens().size() == 1; bool const sd = _cpl->GetSelection() != -1; - + _edit_cinema->Enable (sc); _remove_cinema->Enable (sc); - + _add_screen->Enable (sc); _edit_screen->Enable (ss); _remove_screen->Enable (ss); - wxButton* ok = dynamic_cast (FindWindowById (wxID_OK)); + wxButton* ok = dynamic_cast (FindWindowById (wxID_OK, this)); if (ok) { ok->Enable ((selected_cinemas().size() > 0 || selected_screens().size() > 0) && sd); } @@ -305,6 +307,7 @@ KDMDialog::add_screen (shared_ptr c, shared_ptr s) } _screens[_targets->AppendItem (i->first, std_to_wx (s->name))] = s; + _targets->Expand (i->first); } void @@ -328,7 +331,7 @@ KDMDialog::edit_cinema_clicked () } pair > c = selected_cinemas().front(); - + CinemaDialog* d = new CinemaDialog (this, "Edit cinema", c.second->name, c.second->email); if (d->ShowModal () == wxID_OK) { c.second->name = d->name (); @@ -337,7 +340,7 @@ KDMDialog::edit_cinema_clicked () Config::instance()->changed (); } - d->Destroy (); + d->Destroy (); } void @@ -361,7 +364,7 @@ KDMDialog::add_screen_clicked () } shared_ptr c = selected_cinemas().front().second; - + ScreenDialog* d = new ScreenDialog (this, "Add Screen"); if (d->ShowModal () != wxID_OK) { return; @@ -384,7 +387,7 @@ KDMDialog::edit_screen_clicked () } pair > s = selected_screens().front(); - + ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->certificate); if (d->ShowModal () == wxID_OK) { s.second->name = d->name (); @@ -500,7 +503,7 @@ void KDMDialog::update_cpl_choice () { _cpl->Clear (); - + for (vector::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { _cpl->Append (std_to_wx (i->cpl_id)); @@ -556,7 +559,7 @@ KDMDialog::cpl_browse_clicked () error_dialog (this, _("This is not a valid CPL file")); return; } - + update_cpl_choice (); _cpl->SetSelection (_cpls.size() - 1); update_cpl_summary ();