diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-07-26 15:58:44 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-07-26 15:58:44 +0100 |
| commit | a650e785467a9d7784d2ece4a477acd8cfa9181a (patch) | |
| tree | 43d5f2c254a437158160f1b93c90a7b5744b17f0 /src | |
| parent | f7c9b384e63dd8917b619d1a66b0cc95c3bf5649 (diff) | |
Try to improve new film a bit.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dvdomatic.cc | 14 | ||||
| -rw-r--r-- | src/wx/new_film_dialog.cc | 60 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
3 files changed, 69 insertions, 6 deletions
diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc index 01f4cd591..131f0bd71 100644 --- a/src/tools/dvdomatic.cc +++ b/src/tools/dvdomatic.cc @@ -29,6 +29,7 @@ #include "wx/job_wrapper.h" //#include "gtk/dvd_title_dialog.h" #include "wx/wx_util.h" +#include "wx/new_film_dialog.h" #include "lib/film.h" #include "lib/format.h" #include "lib/config.h" @@ -248,20 +249,21 @@ public: void file_new (wxCommandEvent &) { - wxDirDialog* c = new wxDirDialog (this, wxT ("New Film"), wxStandardPaths::Get().GetDocumentsDir()); - int const r = c->ShowModal (); - c->Destroy (); + NewFilmDialog* d = new NewFilmDialog (this); + int const r = d->ShowModal (); if (r == wxID_OK) { maybe_save_then_delete_film (); - film = new Film (wx_to_std (c->GetPath ())); + film = new Film (d->get_path (), false); #if BOOST_FILESYSTEM_VERSION == 3 - film->set_name (filesystem::path (wx_to_std (c->GetPath())).filename().generic_string()); + film->set_name (filesystem::path (d->get_path()).filename().generic_string()); #else - film->set_name (filesystem::path (wx_to_std (c->GetPath())).filename()); + film->set_name (filesystem::path (d->get_path()).filename()); #endif set_film (); } + + d->Destroy (); } void file_open (wxCommandEvent &) diff --git a/src/wx/new_film_dialog.cc b/src/wx/new_film_dialog.cc new file mode 100644 index 000000000..c7106633e --- /dev/null +++ b/src/wx/new_film_dialog.cc @@ -0,0 +1,60 @@ +/* + Copyright (C) 2012 Carl Hetherington <cth@carlh.net> + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <boost/filesystem.hpp> +#include "new_film_dialog.h" +#include "wx_util.h" + +using namespace std; +using namespace boost; + +NewFilmDialog::NewFilmDialog (wxWindow* parent) + : wxDialog (parent, wxID_ANY, _("New Film")) +{ + wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); + wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6); + table->AddGrowableCol (1, 1); + overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6); + + add_label_to_sizer (table, this, "Film name"); + _name = new wxTextCtrl (this, wxID_ANY); + table->Add (_name, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Create in folder"); + _folder = new wxDirPickerCtrl (this, wxDD_DIR_MUST_EXIST); + table->Add (_folder, 1, wxEXPAND); + + wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); + if (buttons) { + overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); + } + + SetSizer (overall_sizer); + overall_sizer->Layout (); + overall_sizer->SetSizeHints (this); +} + +string +NewFilmDialog::get_path () const +{ + filesystem::path p; + p /= wx_to_std (_folder->GetPath ()); + p /= wx_to_std (_name->GetValue ()); + return p.string (); +} diff --git a/src/wx/wscript b/src/wx/wscript index 48701407e..258e4df87 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -19,6 +19,7 @@ def build(bld): filter_view.cc dcp_range_dialog.cc server_dialog.cc + new_film_dialog.cc """ # alignment.cc |
