Merge branch 'warnings' into v2.15.x.
[dcpomatic.git] / src / wx / screens_panel.h
1 /*
2     Copyright (C) 2015-2016 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 #include "lib/warnings.h"
22 DCPOMATIC_DISABLE_WARNINGS
23 #include <wx/wx.h>
24 DCPOMATIC_ENABLE_WARNINGS
25 #include <wx/srchctrl.h>
26 #include <wx/treectrl.h>
27 #include <boost/shared_ptr.hpp>
28 #include <boost/signals2.hpp>
29 #include <list>
30 #include <map>
31
32 namespace dcpomatic {
33         class Screen;
34 }
35
36 class Cinema;
37
38 class ScreensPanel : public wxPanel
39 {
40 public:
41         explicit ScreensPanel (wxWindow* parent);
42         ~ScreensPanel ();
43
44         std::list<boost::shared_ptr<dcpomatic::Screen> > screens () const;
45         void setup_sensitivity ();
46
47         boost::signals2::signal<void ()> ScreensChanged;
48
49 private:
50         void add_cinemas ();
51         void add_cinema (boost::shared_ptr<Cinema>);
52         boost::optional<wxTreeItemId> add_screen (boost::shared_ptr<Cinema>, boost::shared_ptr<dcpomatic::Screen>);
53         void add_cinema_clicked ();
54         void edit_cinema_clicked ();
55         void remove_cinema_clicked ();
56         void add_screen_clicked ();
57         void edit_screen_clicked ();
58         void remove_screen_clicked ();
59         void selection_changed_shim (wxTreeEvent &);
60         void selection_changed ();
61         void search_changed ();
62
63         wxSearchCtrl* _search;
64         wxTreeCtrl* _targets;
65         wxButton* _add_cinema;
66         wxButton* _edit_cinema;
67         wxButton* _remove_cinema;
68         wxButton* _add_screen;
69         wxButton* _edit_screen;
70         wxButton* _remove_screen;
71         wxTreeItemId _root;
72
73         typedef std::map<wxTreeItemId, boost::shared_ptr<Cinema> > CinemaMap;
74         typedef std::map<wxTreeItemId, boost::shared_ptr<dcpomatic::Screen> > ScreenMap;
75
76         CinemaMap _cinemas;
77         ScreenMap _screens;
78         CinemaMap _selected_cinemas;
79         ScreenMap _selected_screens;
80
81         bool _ignore_selection_change;
82 };