diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-05-09 16:38:36 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-05-09 16:38:36 +0100 |
| commit | 6a11232620e0006f6a2b1e8d2b56e56d84229d5c (patch) | |
| tree | 5ea8d25d95aac54dbf7e45fa72c50215ff5fc437 /src/wx | |
| parent | 837a54744277a5252a1a69b0690305e9a669124d (diff) | |
Basic GUI for export.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/config_dialog.cc | 2 | ||||
| -rw-r--r-- | src/wx/export_dialog.cc | 62 | ||||
| -rw-r--r-- | src/wx/export_dialog.h | 39 | ||||
| -rw-r--r-- | src/wx/file_picker_ctrl.cc | 12 | ||||
| -rw-r--r-- | src/wx/file_picker_ctrl.h | 4 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
6 files changed, 115 insertions, 5 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 49a8a6849..63ce57823 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -205,7 +205,7 @@ private: ++r; add_label_to_sizer (table, _panel, _("Cinema and screen database file"), true, wxGBPosition (r, 0)); - _cinemas_file = new FilePickerCtrl (_panel, _("Select cinema and screen database file"), "*.xml"); + _cinemas_file = new FilePickerCtrl (_panel, _("Select cinema and screen database file"), "*.xml", true); table->Add (_cinemas_file, wxGBPosition (r, 1)); ++r; diff --git a/src/wx/export_dialog.cc b/src/wx/export_dialog.cc new file mode 100644 index 000000000..e21a49e8a --- /dev/null +++ b/src/wx/export_dialog.cc @@ -0,0 +1,62 @@ +/* + Copyright (C) 2017 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "export_dialog.h" +#include "file_picker_ctrl.h" +#include "wx_util.h" +#include <boost/bind.hpp> + +using boost::bind; + +ExportDialog::ExportDialog (wxWindow* parent) + : TableDialog (parent, _("Export film"), 2, 1, true) +{ + add (_("Format"), true); + _format = new wxChoice (this, wxID_ANY); + add (_format); + add (_("Output file"), true); + _file = new FilePickerCtrl (this, _("Select output file"), _("MOV files (*.mov)|*.mov"), false); + add (_file); + + _format->Append (_("ProRes 422")); + _format->SetSelection (0); + + _format->Bind (wxEVT_CHOICE, bind (&ExportDialog::format_changed, this)); + + layout (); +} + +void +ExportDialog::format_changed () +{ + switch (_format->GetSelection()) { + case 0: + _file->SetWildcard (_("MOV files (*.mov)")); + break; + } + + _file->SetPath (""); +} + +boost::filesystem::path +ExportDialog::path () const +{ + return wx_to_std (_file->GetPath ()); +} diff --git a/src/wx/export_dialog.h b/src/wx/export_dialog.h new file mode 100644 index 000000000..8f0be7194 --- /dev/null +++ b/src/wx/export_dialog.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2017 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#include "table_dialog.h" +#include <wx/wx.h> +#include <boost/filesystem.hpp> + +class FilePickerCtrl; + +class ExportDialog : public TableDialog +{ +public: + ExportDialog (wxWindow* parent); + + boost::filesystem::path path () const; + +private: + void format_changed (); + + wxChoice* _format; + FilePickerCtrl* _file; +}; diff --git a/src/wx/file_picker_ctrl.cc b/src/wx/file_picker_ctrl.cc index 03b2880fe..4cd843feb 100644 --- a/src/wx/file_picker_ctrl.cc +++ b/src/wx/file_picker_ctrl.cc @@ -28,10 +28,11 @@ using namespace std; using namespace boost; -FilePickerCtrl::FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wildcard) +FilePickerCtrl::FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wildcard, bool open) : wxPanel (parent) , _prompt (prompt) , _wildcard (wildcard) + , _open (open) { _sizer = new wxBoxSizer (wxHORIZONTAL); @@ -43,7 +44,6 @@ FilePickerCtrl::FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wild _sizer->Add (_file, 1, wxEXPAND, 0); SetSizerAndFit (_sizer); - _file->Bind (wxEVT_BUTTON, boost::bind (&FilePickerCtrl::browse_clicked, this)); } @@ -71,10 +71,16 @@ FilePickerCtrl::GetPath () const void FilePickerCtrl::browse_clicked () { - wxFileDialog* d = new wxFileDialog (this, _prompt, wxEmptyString, wxEmptyString, _wildcard); + wxFileDialog* d = new wxFileDialog (this, _prompt, wxEmptyString, wxEmptyString, _wildcard, _open ? wxFD_OPEN : wxFD_SAVE | wxFD_OVERWRITE_PROMPT); d->SetPath (_path); if (d->ShowModal () == wxID_OK) { SetPath (d->GetPath ()); } d->Destroy (); } + +void +FilePickerCtrl::SetWildcard (wxString w) +{ + _wildcard = w; +} diff --git a/src/wx/file_picker_ctrl.h b/src/wx/file_picker_ctrl.h index 61e7bd55f..d0c4d56c8 100644 --- a/src/wx/file_picker_ctrl.h +++ b/src/wx/file_picker_ctrl.h @@ -23,10 +23,11 @@ class FilePickerCtrl : public wxPanel { public: - FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wildcard); + FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wildcard, bool open); wxString GetPath () const; void SetPath (wxString); + void SetWildcard (wxString); private: void browse_clicked (); @@ -36,4 +37,5 @@ private: wxSizer* _sizer; wxString _prompt; wxString _wildcard; + bool _open; }; diff --git a/src/wx/wscript b/src/wx/wscript index 8297f37c9..abe657341 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -49,6 +49,7 @@ sources = """ dolby_doremi_certificate_panel.cc download_certificate_dialog.cc download_certificate_panel.cc + export_dialog.cc file_picker_ctrl.cc film_editor.cc film_name_location_dialog.cc |
