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