BOOST_FOREACH.
[dcpomatic.git] / src / wx / audio_mapping_view.cc
1 /*
2     Copyright (C) 2013-2020 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.cc
22  *  @brief AudioMappingView class and helpers.
23  */
24
25 #include "audio_mapping_view.h"
26 #include "wx_util.h"
27 #include "audio_gain_dialog.h"
28 #include "lib/audio_mapping.h"
29 #include "lib/util.h"
30 #include "lib/warnings.h"
31 #include <dcp/locale_convert.h>
32 #include <dcp/types.h>
33 DCPOMATIC_DISABLE_WARNINGS
34 #include <wx/wx.h>
35 #include <wx/renderer.h>
36 #include <wx/grid.h>
37 #include <wx/graphics.h>
38 DCPOMATIC_ENABLE_WARNINGS
39 #include <iostream>
40
41 using std::cout;
42 using std::list;
43 using std::string;
44 using std::min;
45 using std::max;
46 using std::vector;
47 using std::pair;
48 using std::make_pair;
49 using std::shared_ptr;
50 using boost::optional;
51 #if BOOST_VERSION >= 106100
52 using namespace boost::placeholders;
53 #endif
54 using dcp::locale_convert;
55
56 #define INDICATOR_SIZE 20
57 #define GRID_SPACING 32
58 #define LEFT_WIDTH (GRID_SPACING * 3)
59 #define TOP_HEIGHT (GRID_SPACING * 2)
60
61 enum {
62         ID_off = 1,
63         ID_minus6dB = 2,
64         ID_0dB = 3,
65         ID_plus3dB = 4,
66         ID_edit = 5
67 };
68
69 AudioMappingView::AudioMappingView (wxWindow* parent, wxString left_label, wxString from, wxString top_label, wxString to)
70         : wxPanel (parent, wxID_ANY)
71         , _menu_input (0)
72         , _menu_output (1)
73         , _left_label (left_label)
74         , _from (from)
75         , _top_label (top_label)
76         , _to (to)
77 {
78         _menu = new wxMenu;
79         _menu->Append (ID_off, _("Off"));
80         _menu->Append (ID_minus6dB, _("-6dB"));
81         _menu->Append (ID_0dB, _("0dB (unchanged)"));
82         _menu->Append (ID_plus3dB, _("+3dB"));
83         _menu->Append (ID_edit, _("Edit..."));
84
85         _body = new wxPanel (this, wxID_ANY);
86         _vertical_scroll = new wxScrollBar (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
87         _horizontal_scroll = new wxScrollBar (this, wxID_ANY);
88
89 #ifndef __WXOSX__
90         SetDoubleBuffered (true);
91 #endif
92
93         Bind (wxEVT_SIZE, boost::bind(&AudioMappingView::size, this, _1));
94         Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, 0), ID_off);
95         Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, db_to_linear(-6)), ID_minus6dB);
96         Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, 1), ID_0dB);
97         Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, db_to_linear(3)), ID_plus3dB);
98         Bind (wxEVT_MENU, boost::bind(&AudioMappingView::edit, this), ID_edit);
99         Bind (wxEVT_MOUSEWHEEL, boost::bind(&AudioMappingView::mouse_wheel, this, _1));
100         _body->Bind (wxEVT_PAINT, boost::bind(&AudioMappingView::paint, this));
101         _body->Bind (wxEVT_LEFT_DOWN, boost::bind(&AudioMappingView::left_down, this, _1));
102         _body->Bind (wxEVT_RIGHT_DOWN, boost::bind(&AudioMappingView::right_down, this, _1));
103         _body->Bind (wxEVT_MOTION, boost::bind(&AudioMappingView::motion, this, _1));
104         _vertical_scroll->Bind (wxEVT_SCROLL_TOP, boost::bind(&AudioMappingView::scroll, this));
105         _vertical_scroll->Bind (wxEVT_SCROLL_BOTTOM, boost::bind(&AudioMappingView::scroll, this));
106         _vertical_scroll->Bind (wxEVT_SCROLL_LINEUP, boost::bind(&AudioMappingView::scroll, this));
107         _vertical_scroll->Bind (wxEVT_SCROLL_LINEDOWN, boost::bind(&AudioMappingView::scroll, this));
108         _vertical_scroll->Bind (wxEVT_SCROLL_PAGEUP, boost::bind(&AudioMappingView::scroll, this));
109         _vertical_scroll->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind(&AudioMappingView::scroll, this));
110         _vertical_scroll->Bind (wxEVT_SCROLL_THUMBTRACK, boost::bind(&AudioMappingView::scroll, this));
111         _vertical_scroll->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind(&AudioMappingView::scroll, this));
112         _horizontal_scroll->Bind (wxEVT_SCROLL_TOP, boost::bind(&AudioMappingView::scroll, this));
113         _horizontal_scroll->Bind (wxEVT_SCROLL_BOTTOM, boost::bind(&AudioMappingView::scroll, this));
114         _horizontal_scroll->Bind (wxEVT_SCROLL_LINEUP, boost::bind(&AudioMappingView::scroll, this));
115         _horizontal_scroll->Bind (wxEVT_SCROLL_LINEDOWN, boost::bind(&AudioMappingView::scroll, this));
116         _horizontal_scroll->Bind (wxEVT_SCROLL_PAGEUP, boost::bind(&AudioMappingView::scroll, this));
117         _horizontal_scroll->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind(&AudioMappingView::scroll, this));
118         _horizontal_scroll->Bind (wxEVT_SCROLL_THUMBTRACK, boost::bind(&AudioMappingView::scroll, this));
119         _horizontal_scroll->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind(&AudioMappingView::scroll, this));
120 }
121
122 void
123 AudioMappingView::size (wxSizeEvent& ev)
124 {
125         setup ();
126         ev.Skip ();
127 }
128
129 void
130 AudioMappingView::setup ()
131 {
132         wxSize const s = GetSize();
133         int const w = _vertical_scroll->GetSize().GetWidth();
134         int const h = _horizontal_scroll->GetSize().GetHeight();
135
136         _vertical_scroll->SetPosition (wxPoint(s.GetWidth() - w, 0));
137         _vertical_scroll->SetSize (wxSize(w, max(0, s.GetHeight() - h)));
138
139         _body->SetSize (wxSize(max(0, s.GetWidth() - w), max(0, s.GetHeight() - h)));
140
141         _horizontal_scroll->SetPosition (wxPoint(0, s.GetHeight() - h));
142         _horizontal_scroll->SetSize (wxSize(max(0, s.GetWidth() - w), h));
143
144         _vertical_scroll->SetScrollbar (
145                 _vertical_scroll->GetThumbPosition(),
146                 s.GetHeight() - h - 8,
147                 GRID_SPACING * (2 + _input_channels.size()),
148                 GRID_SPACING,
149                 true
150                 );
151
152         _horizontal_scroll->SetScrollbar (
153                 _horizontal_scroll->GetThumbPosition(),
154                 s.GetWidth() - w - 8,
155                 GRID_SPACING * (3 + _output_channels.size()),
156                 GRID_SPACING,
157                 true);
158 }
159
160 void
161 AudioMappingView::scroll ()
162 {
163         Refresh ();
164 }
165
166 void
167 AudioMappingView::paint_static (wxDC& dc)
168 {
169         dc.SetFont (wxSWISS_FONT->Bold());
170         wxCoord label_width;
171         wxCoord label_height;
172
173         dc.GetTextExtent (_top_label, &label_width, &label_height);
174         dc.DrawText (_top_label, LEFT_WIDTH + (_output_channels.size() * GRID_SPACING - label_width) / 2, (GRID_SPACING - label_height) / 2);
175
176         dc.GetTextExtent (_left_label, &label_width, &label_height);
177         dc.DrawRotatedText (
178                 _left_label,
179                 (GRID_SPACING - label_height) / 2,
180                 TOP_HEIGHT + (_input_channels.size() * GRID_SPACING + label_width) / 2,
181                 90
182                 );
183
184         dc.SetFont (*wxSWISS_FONT);
185 }
186
187 void
188 AudioMappingView::paint_column_labels (wxDC& dc)
189 {
190         wxCoord label_width;
191         wxCoord label_height;
192         int N = 0;
193         for (auto const& i: _output_channels) {
194                 dc.GetTextExtent (std_to_wx(i.name), &label_width, &label_height);
195                 dc.DrawText (std_to_wx(i.name), LEFT_WIDTH + GRID_SPACING * N + (GRID_SPACING - label_width) / 2, GRID_SPACING + (GRID_SPACING - label_height) / 2);
196                 ++N;
197         }
198
199         dc.DrawLine(wxPoint(LEFT_WIDTH, GRID_SPACING), wxPoint(LEFT_WIDTH + _output_channels.size() * GRID_SPACING, GRID_SPACING));
200         dc.DrawLine(wxPoint(LEFT_WIDTH, GRID_SPACING * 2), wxPoint(LEFT_WIDTH + _output_channels.size() * GRID_SPACING, GRID_SPACING * 2));
201 }
202
203 void
204 AudioMappingView::paint_column_lines (wxDC& dc)
205 {
206         for (size_t i = 0; i < _output_channels.size(); ++i) {
207                 dc.DrawLine (
208                         wxPoint(LEFT_WIDTH + GRID_SPACING * i, GRID_SPACING),
209                         wxPoint(LEFT_WIDTH + GRID_SPACING * i, TOP_HEIGHT + _input_channels.size() * GRID_SPACING)
210                         );
211         }
212
213         dc.DrawLine (
214                 wxPoint(LEFT_WIDTH + GRID_SPACING * _output_channels.size(), GRID_SPACING),
215                 wxPoint(LEFT_WIDTH + GRID_SPACING * _output_channels.size(), TOP_HEIGHT + _input_channels.size() * GRID_SPACING)
216                 );
217 }
218
219 void
220 AudioMappingView::paint_row_labels (wxDC& dc)
221 {
222         wxCoord label_width;
223         wxCoord label_height;
224
225         /* Row channel labels */
226
227         int N = 0;
228         for (auto const& i: _input_channels) {
229                 dc.GetTextExtent (std_to_wx(i.name), &label_width, &label_height);
230                 dc.DrawText (std_to_wx(i.name), GRID_SPACING * 2 + (GRID_SPACING - label_width) / 2, TOP_HEIGHT + GRID_SPACING * N + (GRID_SPACING - label_height) / 2);
231                 ++N;
232         }
233
234         /* Vertical lines on the left */
235
236         for (int i = 1; i < 3; ++i) {
237                 dc.DrawLine (
238                         wxPoint(GRID_SPACING * i, TOP_HEIGHT),
239                         wxPoint(GRID_SPACING * i, TOP_HEIGHT + _input_channels.size() * GRID_SPACING)
240                         );
241         }
242
243         /* Group labels and lines */
244
245         int y = TOP_HEIGHT;
246         for (auto i: _input_groups) {
247                 int const height = (i.to - i.from + 1) * GRID_SPACING;
248                 dc.GetTextExtent (std_to_wx(i.name), &label_width, &label_height);
249                 if (label_width > height) {
250                         label_width = height - 8;
251                 }
252
253                 {
254                         wxDCClipper clip (dc, wxRect(GRID_SPACING, y, GRID_SPACING, height));
255                         int yp = y;
256                         if ((yp - 2 * GRID_SPACING) < dc.GetLogicalOrigin().y) {
257                                 yp += dc.GetLogicalOrigin().y;
258                         }
259
260                         dc.DrawRotatedText (
261                                 std_to_wx(i.name),
262                                 GRID_SPACING + (GRID_SPACING - label_height) / 2,
263                                 y + (height + label_width) / 2,
264                                 90
265                                 );
266                 }
267
268                 dc.DrawLine (wxPoint(GRID_SPACING, y), wxPoint(GRID_SPACING * 2, y));
269                 y += height;
270         }
271
272         dc.DrawLine (wxPoint(GRID_SPACING, y), wxPoint(GRID_SPACING * 2, y));
273 }
274
275 void
276 AudioMappingView::paint_row_lines (wxDC& dc)
277 {
278         for (size_t i = 0; i < _input_channels.size(); ++i) {
279                 dc.DrawLine (
280                         wxPoint(GRID_SPACING * 2, TOP_HEIGHT + GRID_SPACING * i),
281                         wxPoint(LEFT_WIDTH + _output_channels.size() * GRID_SPACING, TOP_HEIGHT + GRID_SPACING * i)
282                         );
283         }
284         dc.DrawLine (
285                 wxPoint(GRID_SPACING * 2, TOP_HEIGHT + GRID_SPACING * _input_channels.size()),
286                 wxPoint(LEFT_WIDTH + _output_channels.size() * GRID_SPACING, TOP_HEIGHT + GRID_SPACING * _input_channels.size())
287                 );
288 }
289
290 void
291 AudioMappingView::paint_indicators (wxDC& dc)
292 {
293         /* _{input,output}_channels and _map may not always be in sync, be careful here */
294         size_t const output = min(_output_channels.size(), size_t(_map.output_channels()));
295         size_t const input = min(_input_channels.size(), size_t(_map.input_channels()));
296
297         for (size_t x = 0; x < output; ++x) {
298                 for (size_t y = 0; y < input; ++y) {
299                         dc.SetBrush (*wxWHITE_BRUSH);
300                         dc.DrawRectangle (
301                                 wxRect(
302                                         LEFT_WIDTH + x * GRID_SPACING + (GRID_SPACING - INDICATOR_SIZE) / 2,
303                                         TOP_HEIGHT + y * GRID_SPACING + (GRID_SPACING - INDICATOR_SIZE) / 2,
304                                         INDICATOR_SIZE, INDICATOR_SIZE
305                                         )
306                                 );
307
308                         float const value_dB = linear_to_db(_map.get(_input_channels[y].index, _output_channels[x].index));
309                         wxColour const colour = value_dB <= 0 ? wxColour(0, 255, 0) : wxColour(255, 150, 0);
310                         int const range = 18;
311                         int height = 0;
312                         if (value_dB > -range) {
313                                 height = min(INDICATOR_SIZE, static_cast<int>(INDICATOR_SIZE * (1 + value_dB / range)));
314                         }
315
316                         dc.SetBrush (*wxTheBrushList->FindOrCreateBrush(colour, wxBRUSHSTYLE_SOLID));
317                         dc.DrawRectangle (
318                                 wxRect(
319                                         LEFT_WIDTH + x * GRID_SPACING + (GRID_SPACING - INDICATOR_SIZE) / 2,
320                                         TOP_HEIGHT + y * GRID_SPACING + (GRID_SPACING - INDICATOR_SIZE) / 2 + INDICATOR_SIZE - height,
321                                         INDICATOR_SIZE, height
322                                         )
323                                 );
324                 }
325         }
326 }
327
328 static
329 void clip (wxDC& dc, int x, int y, int w, int h)
330 {
331         dc.SetClippingRegion (x, y, w, h);
332 }
333
334 static
335 void translate (wxDC& dc, int x, int y)
336 {
337         dc.SetLogicalOrigin (x, y);
338 }
339
340 static
341 void restore (wxDC& dc)
342 {
343         dc.SetLogicalOrigin (0, 0);
344         dc.DestroyClippingRegion ();
345 }
346
347 void
348 AudioMappingView::paint ()
349 {
350         wxPaintDC dc (_body);
351
352         int const hs = _horizontal_scroll->GetThumbPosition ();
353         int const vs = _vertical_scroll->GetThumbPosition ();
354
355         paint_static (dc);
356
357         clip (
358                 dc,
359                 LEFT_WIDTH,
360                 0,
361                 GRID_SPACING * _output_channels.size(),
362                 GRID_SPACING * (2 + _input_channels.size())
363              );
364         translate (dc, hs, 0);
365         paint_column_labels (dc);
366         restore (dc);
367
368         clip (
369                 dc,
370                 0,
371                 TOP_HEIGHT,
372                 GRID_SPACING * 3,
373                 min(int(GRID_SPACING * _input_channels.size()), GetSize().GetHeight() - TOP_HEIGHT)
374              );
375         translate (dc, 0, vs);
376         paint_row_labels (dc);
377         restore (dc);
378
379         clip (
380                 dc,
381                 GRID_SPACING * 2,
382                 TOP_HEIGHT,
383                 GRID_SPACING * (1 + _output_channels.size()),
384                 min(int(GRID_SPACING * (2 + _input_channels.size())), GetSize().GetHeight() - TOP_HEIGHT)
385              );
386         translate (dc, hs, vs);
387         paint_row_lines (dc);
388         restore (dc);
389
390         clip (
391                 dc,
392                 LEFT_WIDTH,
393                 GRID_SPACING,
394                 GRID_SPACING * (1 + _output_channels.size()),
395                 min(int(GRID_SPACING * (1 + _input_channels.size())), GetSize().GetHeight() - GRID_SPACING)
396              );
397         translate (dc, hs, vs);
398         paint_column_lines (dc);
399         restore (dc);
400
401         clip (
402                 dc,
403                 LEFT_WIDTH,
404                 TOP_HEIGHT,
405                 GRID_SPACING * _output_channels.size(),
406                 min(int(GRID_SPACING * _input_channels.size()), GetSize().GetHeight() - TOP_HEIGHT)
407              );
408         translate (dc, hs, vs);
409         paint_indicators (dc);
410         restore (dc);
411 }
412
413 optional<pair<NamedChannel, NamedChannel> >
414 AudioMappingView::mouse_event_to_channels (wxMouseEvent& ev) const
415 {
416         int const x = ev.GetX() + _horizontal_scroll->GetThumbPosition();
417         int const y = ev.GetY() + _vertical_scroll->GetThumbPosition();
418
419         if (x <= LEFT_WIDTH || y < TOP_HEIGHT) {
420                 return optional<pair<NamedChannel, NamedChannel> >();
421         }
422
423         int const input = (y - TOP_HEIGHT) / GRID_SPACING;
424         int const output = (x - LEFT_WIDTH) / GRID_SPACING;
425
426         if (input >= int(_input_channels.size()) || output >= int(_output_channels.size())) {
427                 return optional<pair<NamedChannel, NamedChannel> >();
428         }
429
430         return make_pair (_input_channels[input], _output_channels[output]);
431 }
432
433 optional<string>
434 AudioMappingView::mouse_event_to_input_group_name (wxMouseEvent& ev) const
435 {
436         int const x = ev.GetX() + _horizontal_scroll->GetThumbPosition();
437         if (x < GRID_SPACING || x > (2 * GRID_SPACING)) {
438                 return optional<string>();
439         }
440
441         int y = (ev.GetY() + _vertical_scroll->GetThumbPosition() - (GRID_SPACING * 2)) / GRID_SPACING;
442         for (auto i: _input_groups) {
443                 if (i.from <= y && y <= i.to) {
444                         return i.name;
445                 }
446         }
447
448         return optional<string>();
449 }
450
451 void
452 AudioMappingView::left_down (wxMouseEvent& ev)
453 {
454         optional<pair<NamedChannel, NamedChannel> > channels = mouse_event_to_channels (ev);
455         if (!channels) {
456                 return;
457         }
458
459         if (_map.get(channels->first.index, channels->second.index) > 0) {
460                 _map.set (channels->first.index, channels->second.index, 0);
461         } else {
462                 _map.set (channels->first.index, channels->second.index, 1);
463         }
464
465         map_values_changed ();
466 }
467
468 void
469 AudioMappingView::right_down (wxMouseEvent& ev)
470 {
471         optional<pair<NamedChannel, NamedChannel> > channels = mouse_event_to_channels (ev);
472         if (!channels) {
473                 return;
474         }
475
476         _menu_input = channels->first.index;
477         _menu_output = channels->second.index;
478         PopupMenu (_menu, ev.GetPosition());
479 }
480
481 void
482 AudioMappingView::mouse_wheel (wxMouseEvent& ev)
483 {
484         if (ev.ShiftDown()) {
485                 _horizontal_scroll->SetThumbPosition (
486                         _horizontal_scroll->GetThumbPosition() + (ev.GetWheelRotation() > 0 ? -GRID_SPACING : GRID_SPACING)
487                         );
488
489         } else {
490                 _vertical_scroll->SetThumbPosition (
491                         _vertical_scroll->GetThumbPosition() + (ev.GetWheelRotation() > 0 ? -GRID_SPACING : GRID_SPACING)
492                         );
493         }
494         Refresh ();
495 }
496
497 /** Called when any gain value has changed */
498 void
499 AudioMappingView::map_values_changed ()
500 {
501         Changed (_map);
502         _last_tooltip_channels = optional<pair<NamedChannel, NamedChannel> >();
503         Refresh ();
504 }
505
506 void
507 AudioMappingView::set_gain_from_menu (double linear)
508 {
509         _map.set (_menu_input, _menu_output, linear);
510         map_values_changed ();
511 }
512
513 void
514 AudioMappingView::edit ()
515 {
516         AudioGainDialog* dialog = new AudioGainDialog (this, _menu_input, _menu_output, _map.get(_menu_input, _menu_output));
517         if (dialog->ShowModal() == wxID_OK) {
518                 _map.set (_menu_input, _menu_output, dialog->value ());
519                 map_values_changed ();
520         }
521
522         dialog->Destroy ();
523 }
524
525 void
526 AudioMappingView::set (AudioMapping map)
527 {
528         _map = map;
529         Refresh ();
530 }
531
532 void
533 AudioMappingView::set_input_channels (vector<NamedChannel> const& channels)
534 {
535         _input_channels = channels;
536         setup ();
537         Refresh ();
538 }
539
540 void
541 AudioMappingView::set_output_channels (vector<NamedChannel> const & channels)
542 {
543         _output_channels = channels;
544         setup ();
545         Refresh ();
546 }
547
548
549 wxString
550 AudioMappingView::input_channel_name_with_group (NamedChannel const& n) const
551 {
552         optional<wxString> group;
553         for (auto i: _input_groups) {
554                 if (i.from <= n.index && n.index <= i.to) {
555                         group = std_to_wx (i.name);
556                 }
557         }
558
559         if (group && !group->IsEmpty()) {
560                 return wxString::Format ("%s/%s", group->data(), std_to_wx(n.name).data());
561         }
562
563         return std_to_wx(n.name);
564 }
565
566
567 void
568 AudioMappingView::motion (wxMouseEvent& ev)
569 {
570         optional<pair<NamedChannel, NamedChannel> > channels = mouse_event_to_channels (ev);
571         if (channels) {
572                 if (channels != _last_tooltip_channels) {
573                         wxString s;
574                         float const gain = _map.get(channels->first.index, channels->second.index);
575                         if (gain == 0) {
576                                 s = wxString::Format (
577                                         _("No audio will be passed from %s channel '%s' to %s channel '%s'."),
578                                         _from,
579                                         input_channel_name_with_group(channels->first),
580                                         _to,
581                                         std_to_wx(channels->second.name)
582                                         );
583                         } else if (gain == 1) {
584                                 s = wxString::Format (
585                                         _("Audio will be passed from %s channel %s to %s channel %s unaltered."),
586                                         _from,
587                                         input_channel_name_with_group(channels->first),
588                                         _to,
589                                         std_to_wx(channels->second.name)
590                                         );
591                         } else {
592                                 float const dB = linear_to_db(gain);
593                                 s = wxString::Format (
594                                         _("Audio will be passed from %s channel %s to %s channel %s with gain %.1fdB."),
595                                         _from,
596                                         input_channel_name_with_group(channels->first),
597                                         _to,
598                                         std_to_wx(channels->second.name),
599                                         dB
600                                         );
601                         }
602
603                         SetToolTip (s + " " + _("Right click to change gain."));
604                 }
605         } else {
606                 optional<string> group = mouse_event_to_input_group_name (ev);
607                 if (group) {
608                         SetToolTip (std_to_wx(*group));
609                 } else {
610                         SetToolTip ("");
611                 }
612         }
613
614         _last_tooltip_channels = channels;
615         ev.Skip ();
616 }
617
618 void
619 AudioMappingView::set_input_groups (vector<Group> const & groups)
620 {
621         _input_groups = groups;
622 }