- NameFormatEditor (wxWindow* parent, T name)
- : _panel (new wxPanel (parent))
- , _example (new wxStaticText (_panel, wxID_ANY, ""))
- , _sizer (new wxBoxSizer (wxVERTICAL))
- , _specification (new wxTextCtrl (_panel, wxID_ANY, ""))
- , _name (name)
- {
- _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)));
- _sizer->Add (t);
- wxFont font = t->GetFont();
- font.SetStyle (wxFONTSTYLE_ITALIC);
- font.SetPointSize (font.GetPointSize() - 1);
- t->SetFont (font);
- t->SetForegroundColour (wxColour (0, 0, 204));
- }
-
- _specification->SetValue (std_to_wx (_name.specification ()));
- _specification->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&NameFormatEditor::changed, this));
-
- update_example ();
- }