Fix sizing of audio mapping view.
[dcpomatic.git] / src / wx / audio_mapping_view.h
1 /*
2     Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file  src/wx/audio_mapping_view.h
21  *  @brief AudioMappingView class.
22  *
23  */
24
25 #include <boost/signals2.hpp>
26 #include <wx/wx.h>
27 #include <wx/grid.h>
28 #include "lib/audio_mapping.h"
29
30 /** @class AudioMappingView
31  *  @brief This class displays the mapping of one set of audio channels to another,
32  *  with gain values on each node of the map.
33  *
34  *  The AudioMapping passed to set() describes the actual channel mapping,
35  *  and the names passed to set_input_channels() and set_output_channels() are
36  *  used to label the rows and columns.
37  *
38  *  The display's row count is equal to the AudioMapping's input channel count,
39  *  and the column count is equal to the number of name passed to
40  *  set_output_channels().  Any other output channels in the AudioMapping are
41  *  hidden from view.  Thus input channels are never hidden but output channels
42  *  might be.
43  */
44
45 class AudioMappingView : public wxPanel
46 {
47 public:
48         AudioMappingView (wxWindow *);
49
50         void set (AudioMapping);
51         void set_input_channels (std::vector<std::string> const & names);
52         void set_output_channels (std::vector<std::string> const & names);
53
54         boost::signals2::signal<void (AudioMapping)> Changed;
55
56 private:
57         void left_click (wxGridEvent &);
58         void right_click (wxGridEvent &);
59         void mouse_moved (wxMouseEvent &);
60         void update_cells ();
61         void map_values_changed ();
62         void sized (wxSizeEvent &);
63
64         void off ();
65         void full ();
66         void minus6dB ();
67         void edit ();
68
69         wxGrid* _grid;
70         wxSizer* _sizer;
71         AudioMapping _map;
72
73         wxMenu* _menu;
74         int _menu_row;
75         int _menu_column;
76
77         int _last_tooltip_row;
78         int _last_tooltip_column;
79 };