diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-05-08 01:06:52 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-05-08 01:23:55 +0200 |
| commit | 132191cce2c8961ed8e39583468a11db4dbcbaea (patch) | |
| tree | 527b839b751ede79a417e069fa57f7143485d8cf /src | |
| parent | 179d803a11042077c5e431f44e1aea8e917ec357 (diff) | |
Add PKL editing to the editor (#3024).
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dcpomatic_editor.cc | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/src/tools/dcpomatic_editor.cc b/src/tools/dcpomatic_editor.cc index b8262ba8b..cf1b9cb42 100644 --- a/src/tools/dcpomatic_editor.cc +++ b/src/tools/dcpomatic_editor.cc @@ -275,6 +275,64 @@ private: }; +class PKLPanel : public wxPanel +{ +public: + PKLPanel(wxWindow* parent, shared_ptr<dcp::PKL> pkl) + : wxPanel(parent, wxID_ANY) + , _pkl(pkl) + { + auto sizer = new wxGridBagSizer(DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + + int r = 0; + + add_label_to_sizer(sizer, this, _("Annotation text"), true, wxGBPosition(r, 0)); + _annotation_text = new wxTextCtrl(this, wxID_ANY, std_to_wx(pkl->annotation_text().get_value_or("")), wxDefaultPosition, wxSize(600, -1)); + sizer->Add(_annotation_text, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND); + ++r; + + add_label_to_sizer(sizer, this, _("Issuer"), true, wxGBPosition(r, 0)); + _issuer = new wxTextCtrl(this, wxID_ANY, std_to_wx(pkl->issuer()), wxDefaultPosition, wxSize(600, -1)); + sizer->Add(_issuer, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND); + ++r; + + add_label_to_sizer(sizer, this, _("Creator"), true, wxGBPosition(r, 0)); + _creator = new wxTextCtrl(this, wxID_ANY, std_to_wx(pkl->creator()), wxDefaultPosition, wxSize(600, -1)); + sizer->Add(_creator, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND); + ++r; + + auto space = new wxBoxSizer(wxVERTICAL); + space->Add(sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); + SetSizerAndFit(space); + + _annotation_text->Bind(wxEVT_TEXT, boost::bind(&PKLPanel::annotation_text_changed, this)); + _issuer->Bind(wxEVT_TEXT, boost::bind(&PKLPanel::issuer_changed, this)); + _creator->Bind(wxEVT_TEXT, boost::bind(&PKLPanel::creator_changed, this)); + } + +private: + void annotation_text_changed() + { + _pkl->set_annotation_text(wx_to_std(_annotation_text->GetValue())); + } + + void issuer_changed() + { + _pkl->set_issuer(wx_to_std(_issuer->GetValue())); + } + + void creator_changed() + { + _pkl->set_creator(wx_to_std(_creator->GetValue())); + } + + shared_ptr<dcp::PKL> _pkl; + wxTextCtrl* _annotation_text = nullptr; + wxTextCtrl* _issuer = nullptr; + wxTextCtrl* _creator = nullptr; +}; + + class DummyPanel : public wxPanel { public: @@ -343,7 +401,10 @@ public: _notebook->DeleteAllPages(); for (auto cpl: _dcp->cpls()) { - _notebook->AddPage(new CPLPanel(_notebook, cpl), std_to_wx(cpl->annotation_text().get_value_or(cpl->id()))); + _notebook->AddPage(new CPLPanel(_notebook, cpl), wxString::Format(_("CPL: %s"), std_to_wx(cpl->annotation_text().get_value_or(cpl->id())))); + } + for (auto pkl: _dcp->pkls()) { + _notebook->AddPage(new PKLPanel(_notebook, pkl), wxString::Format(_("PKL: %s"), std_to_wx(pkl->annotation_text().get_value_or(pkl->id())))); } } |
