Add a load of explicit keywords.
[dcpomatic.git] / src / wx / audio_mapping_view.h
1 /*
2     Copyright (C) 2013-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 /** @file  src/wx/audio_mapping_view.h
22  *  @brief AudioMappingView class.
23  *
24  */
25
26 #include <boost/signals2.hpp>
27 #include <wx/wx.h>
28 #include <wx/grid.h>
29 #include "lib/audio_mapping.h"
30
31 /** @class AudioMappingView
32  *  @brief This class displays the mapping of one set of audio channels to another,
33  *  with gain values on each node of the map.
34  *
35  *  The AudioMapping passed to set() describes the actual channel mapping,
36  *  and the names passed to set_input_channels() and set_output_channels() are
37  *  used to label the rows and columns.
38  *
39  *  The display's row count is equal to the AudioMapping's input channel count,
40  *  and the column count is equal to the number of name passed to
41  *  set_output_channels().  Any other output channels in the AudioMapping are
42  *  hidden from view.  Thus input channels are never hidden but output channels
43  *  might be.
44  */
45
46 class AudioMappingView : public wxPanel
47 {
48 public:
49         explicit AudioMappingView (wxWindow *);
50
51         void set (AudioMapping);
52         void set_input_channels (std::vector<std::string> const & names);
53         void set_output_channels (std::vector<std::string> const & names);
54
55         struct Group
56         {
57                 Group (int f, int t, std::string n)
58                         : from (f)
59                         , to (t)
60                         , name (n)
61                 {}
62
63                 /** First channel index (from 0) */
64                 int from;
65                 /** Last channel index (from 0) */
66                 int to;
67                 /** Name of this group */
68                 std::string name;
69         };
70
71         void set_input_groups (std::vector<Group> const & groups);
72
73         boost::signals2::signal<void (AudioMapping)> Changed;
74
75 private:
76         void left_click (wxGridEvent &);
77         void right_click (wxGridEvent &);
78         void mouse_moved_grid (wxMouseEvent &);
79         void update_cells ();
80         void map_values_changed ();
81         void sized (wxSizeEvent &);
82         void paint_left_labels ();
83         void paint_top_labels ();
84         void mouse_moved_left_labels (wxMouseEvent &);
85         void setup_sizes ();
86         void grid_scrolled ();
87
88         void off ();
89         void full ();
90         void minus6dB ();
91         void edit ();
92
93         wxGrid* _grid;
94         wxPanel* _left_labels;
95         wxPanel* _top_labels;
96         AudioMapping _map;
97
98         wxMenu* _menu;
99         int _menu_row;
100         int _menu_column;
101
102         std::vector<Group> _input_groups;
103         std::vector<std::pair<int, int> > _input_group_positions;
104
105         int _last_tooltip_row;
106         int _last_tooltip_column;
107 };