-public:
- void Draw (wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool)
- {
- wxGridCellStringRenderer::Draw (grid, attr, dc, rect, row, col, false);
+ _menu = new wxMenu;
+ _menu->Append (ID_off, _("Off"));
+ _menu->Append (ID_minus6dB, _("-6dB"));
+ _menu->Append (ID_0dB, _("0dB (unchanged)"));
+ _menu->Append (ID_plus3dB, _("+3dB"));
+ _menu->Append (ID_edit, _("Edit..."));
+
+#ifndef __WXOSX__
+ SetDoubleBuffered (true);
+#endif
+
+ Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, 0), ID_off);
+ Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, db_to_linear(-6)), ID_minus6dB);
+ Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, 1), ID_0dB);
+ Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, db_to_linear(3)), ID_plus3dB);
+ Bind (wxEVT_MENU, boost::bind(&AudioMappingView::edit, this), ID_edit);
+ Bind (wxEVT_PAINT, boost::bind(&AudioMappingView::paint, this));
+ Bind (wxEVT_LEFT_DOWN, boost::bind(&AudioMappingView::left_down, this, _1));
+ Bind (wxEVT_RIGHT_DOWN, boost::bind(&AudioMappingView::right_down, this, _1));
+ Bind (wxEVT_MOTION, boost::bind(&AudioMappingView::motion, this, _1));
+}
+
+
+void
+AudioMappingView::setup ()
+{
+ wxClientDC dc (GetParent());
+ dc.SetFont (wxSWISS_FONT->Bold());
+
+ _column_widths.clear ();
+ _column_widths.reserve (_output_channels.size());
+ _column_widths_total = 0;
+
+ for (auto const& i: _output_channels) {
+ wxCoord width;
+ wxCoord height;
+ dc.GetTextExtent (std_to_wx(i.name), &width, &height);
+ auto const this_width = max(width + COLUMN_PADDING, MINIMUM_COLUMN_WIDTH);
+ _column_widths.push_back (this_width);
+ _column_widths_total += this_width;