diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-09-27 00:44:25 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-09-27 13:46:16 +0200 |
| commit | 9adbb3c5ab5d90268a3009c4a6f1bbc5f6290d81 (patch) | |
| tree | 47e741a3740aa6beef92f0dd1e3b675fe2df851b /src | |
| parent | d0da1d77b1fc2f65eeab8572e5ee76bf85094dda (diff) | |
Use EnumIndexedVector in ContentPanel.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/content_panel.cc | 20 | ||||
| -rw-r--r-- | src/wx/content_panel.h | 3 |
2 files changed, 10 insertions, 13 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index f51d5ed48..7a0c2eefd 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -80,10 +80,6 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV , _ignore_deselect (false) , _no_check_selection (false) { - for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) { - _text_panel[i] = 0; - } - _splitter = new LimitedSplitter (n); _top_panel = new wxPanel (_splitter); @@ -350,7 +346,7 @@ ContentPanel::check_selection () bool have_video = false; bool have_audio = false; - bool have_text[static_cast<int>(TextType::COUNT)] = { false, false }; + EnumIndexedVector<bool, TextType> have_text; for (auto i: selected()) { if (i->video) { have_video = true; @@ -398,7 +394,7 @@ ContentPanel::check_selection () _text_panel[i]->create (); } else if (!have_text[i] && _text_panel[i]) { _notebook->DeletePage (off); - _text_panel[i] = 0; + _text_panel[i] = nullptr; } if (have_text[i]) { ++off; @@ -613,9 +609,9 @@ ContentPanel::setup_sensitivity () if (_audio_panel) { _audio_panel->Enable (_generally_sensitive && audio_selection.size() > 0); } - for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) { - if (_text_panel[i]) { - _text_panel[i]->Enable (_generally_sensitive && selection.size() == 1 && !selection.front()->text.empty()); + for (auto text: _text_panel) { + if (text) { + text->Enable(_generally_sensitive && selection.size() == 1 && !selection.front()->text.empty()); } } _timing_panel->Enable (_generally_sensitive); @@ -843,9 +839,9 @@ ContentPanel::panels () const if (_audio_panel) { p.push_back (_audio_panel); } - for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) { - if (_text_panel[i]) { - p.push_back (_text_panel[i]); + for (auto text: _text_panel) { + if (text) { + p.push_back(text); } } p.push_back (_timing_panel); diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h index a886b0217..eec062284 100644 --- a/src/wx/content_panel.h +++ b/src/wx/content_panel.h @@ -20,6 +20,7 @@ #include "content_menu.h" +#include "lib/enum_indexed_vector.h" #include "lib/film.h" #include "lib/types.h" #include <dcp/warnings.h> @@ -146,7 +147,7 @@ private: wxButton* _timeline; VideoPanel* _video_panel = nullptr; AudioPanel* _audio_panel = nullptr; - TextPanel* _text_panel[static_cast<int>(TextType::COUNT)]; + EnumIndexedVector<TextPanel*, TextType> _text_panel; TimingPanel* _timing_panel; ContentMenu* _menu; TimelineDialog* _timeline_dialog = nullptr; |
