Support CPL metadata.
[dcpomatic.git] / src / wx / language_tag_dialog.h
1 /*
2     Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #include <dcp/language_tag.h>
23 #include <wx/wx.h>
24
25
26 class wxListCtrl;
27 class LanguageSubtagPanel;
28
29
30 class LanguageTagDialog : public wxDialog
31 {
32 public:
33         class Subtag
34         {
35         public:
36                 Subtag (dcp::LanguageTag::SubtagType type_, boost::optional<dcp::LanguageTag::SubtagData> subtag_)
37                         : type (type_)
38                         , subtag (subtag_)
39                 {}
40
41                 dcp::LanguageTag::SubtagType type;
42                 boost::optional<dcp::LanguageTag::SubtagData> subtag;
43                 std::string last_search;
44         };
45
46         LanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag);
47
48         dcp::LanguageTag get () const;
49
50
51 private:
52
53         std::string subtag_type_name (dcp::LanguageTag::SubtagType type);
54         void search_changed (std::string search);
55         void add_to_current_tag (dcp::LanguageTag::SubtagType type, boost::optional<dcp::LanguageTag::SubtagData> subtag);
56         void current_tag_selection_changed ();
57         void chosen_subtag_changed (boost::optional<dcp::LanguageTag::SubtagData> selection);
58         void setup_sensitivity ();
59
60         std::vector<Subtag> _current_tag_subtags;
61         wxListCtrl* _current_tag_list;
62         LanguageSubtagPanel* _choose_subtag_panel;
63         wxButton* _add_script;
64         wxButton* _add_region;
65         wxButton* _add_variant;
66         wxButton* _add_external;
67 };
68
69
70
71 class RegionSubtagDialog : public wxDialog
72 {
73 public:
74         RegionSubtagDialog (wxWindow* parent, dcp::LanguageTag::RegionSubtag region);
75
76         boost::optional<dcp::LanguageTag::RegionSubtag> get () const;
77
78 private:
79         LanguageSubtagPanel* _panel;
80 };
81