summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-07-29 16:21:40 +0100
committerCarl Hetherington <cth@carlh.net>2016-07-29 16:21:40 +0100
commitfbe2784c136fa1550815babfce89589f66b35a29 (patch)
tree2099493253d82c71e7a1f2036bcbcbf980ab9f95 /src/wx
parentfe9d2a290682021cd12a00bf21fa4db3012e2049 (diff)
Simplification of name format stuff.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/config_dialog.cc12
-rw-r--r--src/wx/kdm_dialog.cc6
-rw-r--r--src/wx/kdm_output_panel.cc21
-rw-r--r--src/wx/name_format_editor.h19
4 files changed, 30 insertions, 28 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index c82956c60..a68f4576d 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -1410,11 +1410,13 @@ private:
table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
}
- _dcp_filename_format = new NameFormatEditor<dcp::FilenameFormat> (_panel, Config::instance()->dcp_filename_format());
- dcp::NameFormat::Map example;
- example["type"] = "j2c";
- example["id"] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64";
- _dcp_filename_format->set_example (example);
+ dcp::NameFormat::Map titles;
+ titles['t'] = "type (j2c/pcm/sub/cpl/pkl)";
+ titles['i'] = "unique ID";
+ dcp::NameFormat::Map examples;
+ examples['t'] = "j2c";
+ examples['i'] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64";
+ _dcp_filename_format = new NameFormatEditor<dcp::FilenameFormat> (_panel, Config::instance()->dcp_filename_format(), titles, examples);
table->Add (_dcp_filename_format->panel(), 1, wxEXPAND | wxALL);
#ifdef __WXOSX__
diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc
index cd018686e..ef7912ee3 100644
--- a/src/wx/kdm_dialog.cc
+++ b/src/wx/kdm_dialog.cc
@@ -134,9 +134,9 @@ KDMDialog::make_clicked ()
);
dcp::NameFormat::Map name_values;
- name_values["film_name"] = film->name();
- name_values["from"] = dcp::LocalTime(_timing->from()).date() + " " + dcp::LocalTime(_timing->from()).time_of_day();
- name_values["to"] = dcp::LocalTime(_timing->until()).date() + " " + dcp::LocalTime(_timing->until()).time_of_day();
+ name_values['f'] = film->name();
+ name_values['b'] = dcp::LocalTime(_timing->from()).date() + " " + dcp::LocalTime(_timing->from()).time_of_day();
+ name_values['e'] = dcp::LocalTime(_timing->until()).date() + " " + dcp::LocalTime(_timing->until()).time_of_day();
if (_output->write_to ()) {
ScreenKDM::write_files (
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc
index 1d9e56f4b..4efb9fb27 100644
--- a/src/wx/kdm_output_panel.cc
+++ b/src/wx/kdm_output_panel.cc
@@ -46,7 +46,7 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
_type->SetSelection (0);
{
- int flags = wxALIGN_TOP | wxTOP | wxLEFT;
+ int flags = wxALIGN_TOP | wxTOP | wxLEFT | wxRIGHT;
wxString t = _("Filename format");
#ifdef __WXOSX__
flags |= wxALIGN_RIGHT;
@@ -56,14 +56,19 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
}
- _filename_format = new NameFormatEditor<KDMNameFormat> (this, Config::instance()->kdm_filename_format());
+ dcp::NameFormat::Map titles;
+ titles['f'] = "film name";
+ titles['c'] = "cinema";
+ titles['s'] = "screen";
+ titles['b'] = "from date/time";
+ titles['e'] = "to date/time";
dcp::NameFormat::Map ex;
- ex["film_name"] = "Bambi";
- ex["cinema"] = "Lumière";
- ex["screen"] = "Screen 1";
- ex["from"] = "2012/03/15 12:30";
- ex["to"] = "2012/03/22 02:30";
- _filename_format->set_example (ex);
+ ex['f'] = "Bambi";
+ ex['c'] = "Lumière";
+ ex['s'] = "Screen 1";
+ ex['b'] = "2012/03/15 12:30";
+ ex['e'] = "2012/03/22 02:30";
+ _filename_format = new NameFormatEditor<KDMNameFormat> (this, Config::instance()->kdm_filename_format(), titles, ex);
table->Add (_filename_format->panel(), 1, wxEXPAND);
_write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
diff --git a/src/wx/name_format_editor.h b/src/wx/name_format_editor.h
index 1ca4c0b71..0f4682127 100644
--- a/src/wx/name_format_editor.h
+++ b/src/wx/name_format_editor.h
@@ -30,19 +30,20 @@ template <class T>
class NameFormatEditor
{
public:
- NameFormatEditor (wxWindow* parent, T name)
+ NameFormatEditor (wxWindow* parent, T name, dcp::NameFormat::Map titles, dcp::NameFormat::Map examples)
: _panel (new wxPanel (parent))
, _example (new wxStaticText (_panel, wxID_ANY, ""))
, _sizer (new wxBoxSizer (wxVERTICAL))
, _specification (new wxTextCtrl (_panel, wxID_ANY, ""))
, _name (name)
+ , _examples (examples)
{
_sizer->Add (_specification, 0, wxEXPAND, DCPOMATIC_SIZER_Y_GAP);
_sizer->Add (_example, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP);
_panel->SetSizer (_sizer);
- BOOST_FOREACH (dcp::NameFormat::Component c, name.components ()) {
- wxStaticText* t = new wxStaticText (_panel, wxID_ANY, std_to_wx (String::compose ("%%%1 %2", c.placeholder, c.title)));
+ BOOST_FOREACH (char c, name.components ()) {
+ wxStaticText* t = new wxStaticText (_panel, wxID_ANY, std_to_wx (String::compose ("%%%1 %2", c, titles[c])));
_sizer->Add (t);
wxFont font = t->GetFont();
font.SetStyle (wxFONTSTYLE_ITALIC);
@@ -57,16 +58,10 @@ public:
update_example ();
}
- wxPanel* panel () const
- {
+ wxPanel* panel () const {
return _panel;
}
- void set_example (dcp::NameFormat::Map v) {
- _example_values = v;
- update_example ();
- }
-
T get () const {
return _name;
}
@@ -85,7 +80,7 @@ private:
{
_name.set_specification (wx_to_std (_specification->GetValue ()));
- wxString example = wxString::Format (_("e.g. %s"), _name.get (_example_values));
+ wxString example = wxString::Format (_("e.g. %s"), _name.get (_examples));
wxString wrapped;
for (size_t i = 0; i < example.Length(); ++i) {
if (i > 0 && (i % 30) == 0) {
@@ -103,7 +98,7 @@ private:
wxTextCtrl* _specification;
T _name;
- dcp::NameFormat::Map _example_values;
+ dcp::NameFormat::Map _examples;
};
#endif