#include "wx_util.h"
AudioGainDialog::AudioGainDialog (wxWindow* parent, int c, int d, float v)
- : wxDialog (parent, wxID_ANY, _("Channel gain"))
+ : TableDialog (parent, _("Channel gain"), 3, true)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- table->AddGrowableCol (1, 1);
-
- add_label_to_sizer (table, this, wxString::Format (_("Gain for content channel %d in DCP channel %d"), c + 1, d + 1), false);
- _gain = new wxSpinCtrlDouble (this);
- table->Add (_gain);
-
- add_label_to_sizer (table, this, _("dB"), false);
-
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ add (wxString::Format (_("Gain for content channel %d in DCP channel %d"), c + 1, d + 1), false);
+ _gain = add (new wxSpinCtrlDouble (this));
+ add (_("dB"), false);
_gain->SetRange (-144, 0);
_gain->SetDigits (1);
_gain->SetIncrement (0.1);
_gain->SetValue (20 * log10 (v));
+
+ layout ();
}
float
*/
-#include <wx/wx.h>
+#include "table_dialog.h"
class wxSpinCtrlDouble;
-class AudioGainDialog : public wxDialog
+class AudioGainDialog : public TableDialog
{
public:
AudioGainDialog (wxWindow *, int, int, float);
using std::string;
CinemaDialog::CinemaDialog (wxWindow* parent, string title, string name, string email)
- : wxDialog (parent, wxID_ANY, std_to_wx (title))
+ : TableDialog (parent, std_to_wx (title), 2, true)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- table->AddGrowableCol (1, 1);
-
- add_label_to_sizer (table, this, _("Name"), true);
- _name = new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (256, -1));
- table->Add (_name, 1, wxEXPAND);
-
- add_label_to_sizer (table, this, _("Email address for KDM delivery"), true);
- _email = new wxTextCtrl (this, wxID_ANY, std_to_wx (email), wxDefaultPosition, wxSize (256, -1));
- table->Add (_email, 1, wxEXPAND);
-
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ add (_("Name"), true);
+ _name = add (new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (256, -1)));
+
+ add (_("Email address for KDM delivery"), true);
+ _email = add (new wxTextCtrl (this, wxID_ANY, std_to_wx (email), wxDefaultPosition, wxSize (256, -1)));
+
+ layout ();
}
string
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
*/
#include <wx/wx.h>
+#include "table_dialog.h"
-class CinemaDialog : public wxDialog
+class CinemaDialog : public TableDialog
{
public:
CinemaDialog (wxWindow *, std::string, std::string name = "", std::string email = "");
using boost::shared_ptr;
DCIMetadataDialog::DCIMetadataDialog (wxWindow* parent, DCIMetadata dm)
- : wxDialog (parent, wxID_ANY, _("DCI name"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+ : TableDialog (parent, _("DCI name"), 2, true)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- table->AddGrowableCol (1, 1);
+ add (_("Content version"), true);
+ _content_version = add (new wxSpinCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Content version"), true);
- _content_version = new wxSpinCtrl (this, wxID_ANY);
- table->Add (_content_version, 1, wxEXPAND);
+ add (_("Audio Language (e.g. EN)"), true);
+ _audio_language = add (new wxTextCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Audio Language (e.g. EN)"), true);
- _audio_language = new wxTextCtrl (this, wxID_ANY);
- table->Add (_audio_language, 1, wxEXPAND);
-
- add_label_to_sizer (table, this, _("Subtitle Language (e.g. FR)"), true);
- _subtitle_language = new wxTextCtrl (this, wxID_ANY);
- table->Add (_subtitle_language, 1, wxEXPAND);
+ add (_("Subtitle Language (e.g. FR)"), true);
+ _subtitle_language = add (new wxTextCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Territory (e.g. UK)"), true);
- _territory = new wxTextCtrl (this, wxID_ANY);
- table->Add (_territory, 1, wxEXPAND);
+ add (_("Territory (e.g. UK)"), true);
+ _territory = add (new wxTextCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Rating (e.g. 15)"), true);
- _rating = new wxTextCtrl (this, wxID_ANY);
- table->Add (_rating, 1, wxEXPAND);
+ add (_("Rating (e.g. 15)"), true);
+ _rating = add (new wxTextCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Studio (e.g. TCF)"), true);
- _studio = new wxTextCtrl (this, wxID_ANY);
- table->Add (_studio, 1, wxEXPAND);
+ add (_("Studio (e.g. TCF)"), true);
+ _studio = add (new wxTextCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Facility (e.g. DLA)"), true);
- _facility = new wxTextCtrl (this, wxID_ANY);
- table->Add (_facility, 1, wxEXPAND);
+ add (_("Facility (e.g. DLA)"), true);
+ _facility = add (new wxTextCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Package Type (e.g. OV)"), true);
- _package_type = new wxTextCtrl (this, wxID_ANY);
- table->Add (_package_type, 1, wxEXPAND);
+ add (_("Package Type (e.g. OV)"), true);
+ _package_type = add (new wxTextCtrl (this, wxID_ANY));
_content_version->SetRange (1, 1024);
_facility->SetValue (std_to_wx (dm.facility));
_package_type->SetValue (std_to_wx (dm.package_type));
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ layout ();
}
DCIMetadata
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
*/
-#include <wx/dialog.h>
#include <wx/textctrl.h>
#include <boost/shared_ptr.hpp>
#include "lib/dci_metadata.h"
+#include "table_dialog.h"
class wxSpinCtrl;
class Film;
-class DCIMetadataDialog : public wxDialog
+class DCIMetadataDialog : public TableDialog
{
public:
DCIMetadataDialog (wxWindow *, DCIMetadata);
DolbyCertificateDialog::DolbyCertificateDialog (wxWindow* parent, boost::function<void (boost::filesystem::path)> load)
: DownloadCertificateDialog (parent, load)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
-
- _country = new wxChoice (this, wxID_ANY);
- add_label_to_sizer (table, this, _("Country"), true);
- table->Add (_country, 1, wxEXPAND | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+ add (_("Country"), true);
+ _country = add (new wxChoice (this, wxID_ANY));
_country->Append (N_("Hashemite Kingdom of Jordan"));
- _cinema = new wxChoice (this, wxID_ANY);
- add_label_to_sizer (table, this, _("Cinema"), true);
- table->Add (_cinema, 1, wxEXPAND | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
- _cinema->Append (N_("Wometco Dominicana Palacio Del Cine"));
- _overall_sizer->Add (table);
+ add (_("Cinema"), true);
+ _cinema = add (new wxChoice (this, wxID_ANY));
+ _cinema->Append (N_("Motion Picture Solutions London Mobile & QC"));
add_common_widgets ();
_country->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DolbyCertificateDialog::country_selected, this));
_cinema->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DolbyCertificateDialog::cinema_selected, this));
+ Bind (wxEVT_IDLE, boost::bind (&DolbyCertificateDialog::setup_countries, this));
_country->Clear ();
_cinema->Clear ();
}
void
-DolbyCertificateDialog::setup ()
+DolbyCertificateDialog::setup_countries ()
{
- _message->SetLabel (_("Fetching available countries"));
+ if (_country->GetCount() > 0) {
+ /* Already set up */
+ return;
+ }
+
+ _country->Append (_("Fetching..."));
+ _country->SetSelection (0);
run_gui_loop ();
+
list<string> const countries = ftp_ls ("");
+ _country->Clear ();
for (list<string>::const_iterator i = countries.begin(); i != countries.end(); ++i) {
_country->Append (std_to_wx (*i));
}
- _message->SetLabel ("");
}
void
DolbyCertificateDialog::country_selected ()
{
- _message->SetLabel (_("Fetching available cinemas"));
+ _cinema->Clear ();
+ _cinema->Append (_("Fetching..."));
+ _cinema->SetSelection (0);
run_gui_loop ();
+
list<string> const cinemas = ftp_ls (wx_to_std (_country->GetStringSelection()));
_cinema->Clear ();
for (list<string>::const_iterator i = cinemas.begin(); i != cinemas.end(); ++i) {
_cinema->Append (std_to_wx (*i));
}
- _message->SetLabel ("");
}
void
public:
DolbyCertificateDialog (wxWindow *, boost::function<void (boost::filesystem::path)>);
- void setup ();
-
private:
void download ();
+ void setup_countries ();
void country_selected ();
void cinema_selected ();
std::list<std::string> ftp_ls (std::string) const;
DoremiCertificateDialog::DoremiCertificateDialog (wxWindow* parent, function<void (boost::filesystem::path)> load)
: DownloadCertificateDialog (parent, load)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
-
- add_label_to_sizer (table, this, _("Server serial number"), true);
- _serial = new wxTextCtrl (this, wxID_ANY);
- table->Add (_serial, 1, wxEXPAND);
-
- _overall_sizer->Add (table, 1, wxALL, DCPOMATIC_DIALOG_BORDER);
+ add (_("Server serial number"), true);
+ _serial = add (new wxTextCtrl (this, wxID_ANY));
add_common_widgets ();
}
using boost::function;
DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent, function<void (boost::filesystem::path)> load)
- : wxDialog (parent, wxID_ANY, _("Download certificate"))
+ : TableDialog (parent, _("Download certificate"), 2, true)
, _load (load)
{
- _overall_sizer = new wxBoxSizer (wxVERTICAL);
+
}
void
DownloadCertificateDialog::add_common_widgets ()
{
- _download = new wxButton (this, wxID_ANY, _("Download"));
- _overall_sizer->Add (_download, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP);
- _gauge = new wxGauge (this, wxID_ANY, 100);
- _overall_sizer->Add (_gauge, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP);
- _message = new wxStaticText (this, wxID_ANY, wxT (""));
- _overall_sizer->Add (_message, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
- if (buttons) {
- _overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
+ add_spacer ();
+ _download = add (new wxButton (this, wxID_ANY, _("Download")));
- SetSizer (_overall_sizer);
- _overall_sizer->Layout ();
- _overall_sizer->SetSizeHints (this);
+ add_spacer ();
+ _gauge = add (new wxGauge (this, wxID_ANY, 100));
+ add_spacer ();
+ _message = add (new wxStaticText (this, wxID_ANY, wxT ("")));
+
_download->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DownloadCertificateDialog::download, this));
_download->Enable (false);
+
+ layout ();
}
#include <wx/wx.h>
#include <boost/function.hpp>
#include <boost/filesystem.hpp>
+#include "table_dialog.h"
-class DownloadCertificateDialog : public wxDialog
+class DownloadCertificateDialog : public TableDialog
{
public:
DownloadCertificateDialog (wxWindow *, boost::function<void (boost::filesystem::path)>);
- virtual void setup () {}
protected:
void add_common_widgets ();
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
using namespace boost;
GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent)
- : wxDialog (parent, wxID_ANY, _("Gain Calculator"))
+ : TableDialog (parent, _("Gain Calculator"), 2, true)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- table->AddGrowableCol (1, 1);
+ add (_("I want to play this back at fader"), true);
+ _wanted = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC)));
- add_label_to_sizer (table, this, _("I want to play this back at fader"), true);
- _wanted = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC));
- table->Add (_wanted, 1, wxEXPAND);
+ add (_("But I have to use fader"), true);
+ _actual = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC)));
- add_label_to_sizer (table, this, _("But I have to use fader"), true);
- _actual = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC));
- table->Add (_actual, 1, wxEXPAND);
-
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- SetSizer (overall_sizer);
- overall_sizer->SetSizeHints (this);
+ layout ();
}
float
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
*/
#include <wx/wx.h>
+#include "table_dialog.h"
-class GainCalculatorDialog : public wxDialog
+class GainCalculatorDialog : public TableDialog
{
public:
GainCalculatorDialog (wxWindow* parent);
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
boost::optional<boost::filesystem::path> NewFilmDialog::_directory;
NewFilmDialog::NewFilmDialog (wxWindow* parent)
- : wxDialog (parent, wxID_ANY, _("New Film"))
+ : TableDialog (parent, _("New Film"), 2, true)
{
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- SetSizer (overall_sizer);
-
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- table->AddGrowableCol (1, 1);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
-
- add_label_to_sizer (table, this, _("Film name"), true);
- _name = new wxTextCtrl (this, wxID_ANY);
- table->Add (_name, 0, wxEXPAND);
+ add (_("Film name"), true);
+ _name = add (new wxTextCtrl (this, wxID_ANY));
- add_label_to_sizer (table, this, _("Create in folder"), true);
+ add (_("Create in folder"), true);
#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
_folder = new DirPickerCtrl (this);
}
_folder->SetPath (std_to_wx (_directory.get().string()));
- table->Add (_folder, 1, wxEXPAND);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ add (_folder);
_name->SetFocus ();
+
+ layout ();
}
NewFilmDialog::~NewFilmDialog ()
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
#include <wx/wx.h>
#include <wx/filepicker.h>
#include "wx_util.h"
+#include "table_dialog.h"
class DirPickerCtrl;
-class NewFilmDialog : public wxDialog
+class NewFilmDialog : public TableDialog
{
public:
NewFilmDialog (wxWindow *);
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
using boost::lexical_cast;
PropertiesDialog::PropertiesDialog (wxWindow* parent, shared_ptr<Film> film)
- : wxDialog (parent, wxID_ANY, _("Film Properties"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
+ : TableDialog (parent, _("Film Properties"), 2, false)
, _film (film)
{
- _table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ add (_("Frames"), true);
+ _frames = add (new wxStaticText (this, wxID_ANY, wxT ("")));
- add_label_to_sizer (_table, this, _("Frames"), true);
- _frames = new wxStaticText (this, wxID_ANY, wxT (""));
- _table->Add (_frames, 1, wxALIGN_CENTER_VERTICAL);
+ add (_("Disk space required"), true);
+ _disk = add (new wxStaticText (this, wxID_ANY, wxT ("")));
- add_label_to_sizer (_table, this, _("Disk space required"), true);
- _disk = new wxStaticText (this, wxID_ANY, wxT (""));
- _table->Add (_disk, 1, wxALIGN_CENTER_VERTICAL);
-
- add_label_to_sizer (_table, this, _("Frames already encoded"), true);
- _encoded = new ThreadedStaticText (this, _("counting..."), boost::bind (&PropertiesDialog::frames_already_encoded, this));
+ add (_("Frames already encoded"), true);
+ _encoded = add (new ThreadedStaticText (this, _("counting..."), boost::bind (&PropertiesDialog::frames_already_encoded, this)));
_encoded->Finished.connect (boost::bind (&PropertiesDialog::layout, this));
- _table->Add (_encoded, 1, wxALIGN_CENTER_VERTICAL);
-
+
_frames->SetLabel (std_to_wx (lexical_cast<string> (_film->time_to_video_frames (_film->length()))));
double const disk = double (_film->required_disk_space()) / 1073741824.0f;
stringstream s;
s << fixed << setprecision (1) << disk << wx_to_std (_("Gb"));
_disk->SetLabel (std_to_wx (s.str ()));
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (_table, 0, wxALL, DCPOMATIC_DIALOG_BORDER);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- SetSizer (overall_sizer);
- overall_sizer->SetSizeHints (this);
-}
-
-void
-PropertiesDialog::layout ()
-{
- _table->Layout ();
- Fit ();
+ layout ();
}
string
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
*/
#include <wx/wx.h>
+#include "table_dialog.h"
class Film;
class ThreadedStaticText;
-class PropertiesDialog : public wxDialog
+class PropertiesDialog : public TableDialog
{
public:
PropertiesDialog (wxWindow *, boost::shared_ptr<Film>);
private:
std::string frames_already_encoded () const;
- void layout ();
boost::shared_ptr<Film> _film;
- wxFlexGridSizer* _table;
wxStaticText* _frames;
wxStaticText* _disk;
ThreadedStaticText* _encoded;
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2014 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
#include "wx_util.h"
RepeatDialog::RepeatDialog (wxWindow* parent)
- : wxDialog (parent, wxID_ANY, _("Repeat Content"))
+ : TableDialog (parent, _("Repeat Content"), 3, true)
{
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- SetSizer (overall_sizer);
-
- wxFlexGridSizer* table = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- table->AddGrowableCol (1, 1);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
-
- add_label_to_sizer (table, this, _("Repeat"), true);
- _number = new wxSpinCtrl (this, wxID_ANY);
- table->Add (_number, 1);
-
- add_label_to_sizer (table, this, _("times"), false);
+ add (_("Repeat"), true);
+ _number = add (new wxSpinCtrl (this, wxID_ANY));
+ add (_("times"), false);
_number->SetRange (1, 1024);
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ layout ();
}
int
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2014 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
#include <wx/wx.h>
#include <wx/spinctrl.h>
+#include "table_dialog.h"
-class RepeatDialog : public wxDialog
+class RepeatDialog : public TableDialog
{
public:
RepeatDialog (wxWindow *);
using boost::shared_ptr;
ScreenDialog::ScreenDialog (wxWindow* parent, string title, string name, shared_ptr<libdcp::Certificate> certificate)
- : wxDialog (parent, wxID_ANY, std_to_wx (title))
+ : TableDialog (parent, std_to_wx (title), 2, true)
, _certificate (certificate)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
- table->AddGrowableCol (1, 1);
+ add ("Name", true);
+ _name = add (new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (320, -1)));
- add_label_to_sizer (table, this, "Name", true);
- _name = new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (320, -1));
- table->Add (_name, 1, wxEXPAND);
+ add ("Server manufacturer", true);
+ _manufacturer = add (new wxChoice (this, wxID_ANY));
- add_label_to_sizer (table, this, "Server manufacturer", true);
- _manufacturer = new wxChoice (this, wxID_ANY);
- table->Add (_manufacturer, 1, wxEXPAND);
-
- add_label_to_sizer (table, this, _("Certificate"), true);
+ add (_("Certificate"), true);
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_load_certificate = new wxButton (this, wxID_ANY, _("Load from file..."));
_download_certificate = new wxButton (this, wxID_ANY, _("Download"));
s->Add (_load_certificate, 1, wxEXPAND);
s->Add (_download_certificate, 1, wxEXPAND);
- table->Add (s, 1, wxEXPAND);
+ add (s);
- table->AddSpacer (0);
+ add_spacer ();
_certificate_text = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (320, 256), wxTE_MULTILINE | wxTE_READONLY);
if (certificate) {
_certificate_text->SetValue (certificate->certificate ());
wxFont font = wxSystemSettings::GetFont (wxSYS_ANSI_FIXED_FONT);
font.SetPointSize (font.GetPointSize() / 2);
_certificate_text->SetFont (font);
- table->Add (_certificate_text, 1, wxEXPAND);
-
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ add (_certificate_text);
_manufacturer->Append (_("Unknown"));
_manufacturer->Append (_("Doremi"));
_manufacturer->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&ScreenDialog::setup_sensitivity, this));
setup_sensitivity ();
+ layout ();
}
string
{
if (_manufacturer->GetStringSelection() == _("Doremi")) {
DownloadCertificateDialog* d = new DoremiCertificateDialog (this, boost::bind (&ScreenDialog::load_certificate, this, _1));
- d->setup ();
d->ShowModal ();
d->Destroy ();
} else if (_manufacturer->GetStringSelection() == _("Dolby")) {
DownloadCertificateDialog* d = new DolbyCertificateDialog (this, boost::bind (&ScreenDialog::load_certificate, this, _1));
- d->setup ();
d->ShowModal ();
d->Destroy ();
}
#include <wx/wx.h>
#include <boost/shared_ptr.hpp>
#include <libdcp/certificates.h>
+#include "table_dialog.h"
class Progress;
-class ScreenDialog : public wxDialog
+class ScreenDialog : public TableDialog
{
public:
ScreenDialog (wxWindow *, std::string, std::string name = "", boost::shared_ptr<libdcp::Certificate> c = boost::shared_ptr<libdcp::Certificate> ());
using boost::shared_ptr;
ServerDialog::ServerDialog (wxWindow* parent)
- : wxDialog (parent, wxID_ANY, _("Server"))
+ : TableDialog (parent, _("Server"), 2, true)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- table->AddGrowableCol (1, 1);
-
wxClientDC dc (parent);
/* XXX: bit of a mystery why we need such a long string here */
wxSize size = dc.GetTextExtent (wxT ("255.255.255.255.255.255.255.255"));
wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST);
wxArrayString list;
- add_label_to_sizer (table, this, _("Host name or IP address"), true);
- _host = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, size);
- table->Add (_host, 1, wxEXPAND | wxALL);
-
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
+ add (_("Host name or IP address"), true);
+ _host = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, size));
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
+ layout ();
}
void
*/
-#include <wx/wx.h>
+#include "table_dialog.h"
-class ServerDialog : public wxDialog
+class ServerDialog : public TableDialog
{
public:
ServerDialog (wxWindow *);
--- /dev/null
+/*
+ Copyright (C) 2014 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 "table_dialog.h"
+#include "wx_util.h"
+
+TableDialog::TableDialog (wxWindow* parent, wxString title, int columns, bool cancel)
+ : wxDialog (parent, wxID_ANY, title)
+{
+ _overall_sizer = new wxBoxSizer (wxVERTICAL);
+ SetSizer (_overall_sizer);
+
+ _table = new wxFlexGridSizer (columns, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ _table->AddGrowableCol (1, 1);
+
+ _overall_sizer->Add (_table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
+
+ long int flags = wxOK;
+ if (cancel) {
+ flags |= wxCANCEL;
+ }
+
+ wxSizer* buttons = CreateSeparatedButtonSizer (flags);
+ if (buttons) {
+ _overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
+}
+
+void
+TableDialog::layout ()
+{
+ _overall_sizer->Layout ();
+ _overall_sizer->SetSizeHints (this);
+}
+
+void
+TableDialog::add (wxString text, bool label)
+{
+ add_label_to_sizer (_table, this, text, label);
+}
+
+void
+TableDialog::add_spacer ()
+{
+ _table->AddSpacer (0);
+}
--- /dev/null
+/*
+ Copyright (C) 2014 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.
+
+*/
+
+#ifndef DCPOMATIC_TABLE_DIALOG_H
+#define DCPOMATIC_TABLE_DIALOG_H
+
+#include <wx/wx.h>
+
+class TableDialog : public wxDialog
+{
+public:
+ TableDialog (wxWindow* parent, wxString title, int columns, bool cancel);
+
+protected:
+ template<class T>
+ T* add (T* w) {
+ _table->Add (w, 1, wxEXPAND);
+ return w;
+ }
+
+ void add (wxString text, bool label);
+ void add_spacer ();
+
+ void layout ();
+
+private:
+ wxSizer* _overall_sizer;
+ wxFlexGridSizer* _table;
+};
+
+#endif
server_dialog.cc
servers_list_dialog.cc
subtitle_panel.cc
+ table_dialog.cc
timecode.cc
timeline.cc
timeline_dialog.cc