X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fscreens_panel.h;h=2567725b85ac87e1afe0717cfd5f1871e70596ed;hb=8937b4096aef372dbde07c78d1af9d44b0b0d642;hp=3e9accde556b91f1b69c72ef04cb09acb21577e7;hpb=8b2a3f31b6b4238d8534549f495e7276174ddfba;p=dcpomatic.git diff --git a/src/wx/screens_panel.h b/src/wx/screens_panel.h index 3e9accde5..2567725b8 100644 --- a/src/wx/screens_panel.h +++ b/src/wx/screens_panel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2016 Carl Hetherington + Copyright (C) 2015-2022 Carl Hetherington This file is part of DCP-o-matic. @@ -18,16 +18,26 @@ */ + +#include "lib/warnings.h" +DCPOMATIC_DISABLE_WARNINGS #include +DCPOMATIC_ENABLE_WARNINGS #include -#include -#include +#include #include #include #include + +namespace dcpomatic { + class Screen; +} + + class Cinema; -class Screen; +class UCollator; + class ScreensPanel : public wxPanel { @@ -35,42 +45,67 @@ public: explicit ScreensPanel (wxWindow* parent); ~ScreensPanel (); - std::list > screens () const; + std::vector> screens () const; void setup_sensitivity (); boost::signals2::signal ScreensChanged; private: void add_cinemas (); - void add_cinema (boost::shared_ptr); - boost::optional add_screen (boost::shared_ptr, boost::shared_ptr); + boost::optional add_cinema (std::shared_ptr); + boost::optional add_screen (std::shared_ptr, std::shared_ptr); void add_cinema_clicked (); void edit_cinema_clicked (); void remove_cinema_clicked (); void add_screen_clicked (); void edit_screen_clicked (); void remove_screen_clicked (); - void selection_changed_shim (wxTreeEvent &); + void selection_changed_shim (wxTreeListEvent &); void selection_changed (); void search_changed (); + void checkbox_changed (wxTreeListEvent& ev); + boost::optional>> cinema_for_operation () const; + + typedef std::vector>> Cinemas; + typedef std::vector>> Screens; + + std::shared_ptr item_to_cinema (wxTreeListItem item) const; + std::shared_ptr item_to_screen (wxTreeListItem item) const; + boost::optional cinema_to_item (std::shared_ptr cinema) const; + boost::optional screen_to_item (std::shared_ptr screen) const; wxSearchCtrl* _search; - wxTreeCtrl* _targets; + wxTreeListCtrl* _targets; wxButton* _add_cinema; wxButton* _edit_cinema; wxButton* _remove_cinema; wxButton* _add_screen; wxButton* _edit_screen; wxButton* _remove_screen; - wxTreeItemId _root; - typedef std::map > CinemaMap; - typedef std::map > ScreenMap; + Cinemas _cinemas; + Screens _screens; + Cinemas _selected_cinemas; + Screens _selected_screens; + + std::map> _item_to_cinema; + std::map> _item_to_screen; + std::map, wxTreeListItem> _cinema_to_item; + std::map, wxTreeListItem> _screen_to_item; + + bool _ignore_selection_change = false; + + class Comparator : public wxTreeListItemComparator + { + public: + Comparator (); + ~Comparator (); + + int Compare (wxTreeListCtrl* tree_list, unsigned, wxTreeListItem a, wxTreeListItem b) override; - CinemaMap _cinemas; - ScreenMap _screens; - CinemaMap _selected_cinemas; - ScreenMap _selected_screens; + private: + UCollator* _collator; + }; - bool _ignore_selection_change; + Comparator _comparator; };