+ _map.set (_menu_row, _menu_column - 1, pow (10, -6.0 / 20));
+ map_values_changed ();
+}
+
+void
+AudioMappingView::edit ()
+{
+ int const d = _menu_column - 1;
+
+ AudioGainDialog* dialog = new AudioGainDialog (this, _menu_row, _menu_column - 1, _map.get (_menu_row, d));
+ if (dialog->ShowModal () == wxID_OK) {
+ _map.set (_menu_row, d, dialog->value ());
+ map_values_changed ();
+ }
+
+ dialog->Destroy ();
+}
+
+void
+AudioMappingView::set (AudioMapping map)
+{
+ _map = map;
+ update_cells ();
+}
+
+void
+AudioMappingView::set_input_channels (vector<string> const & names)
+{
+ for (int i = 0; i < _grid->GetNumberRows(); ++i) {
+ _grid->SetCellValue (i, 0, std_to_wx (names[i]));
+ }
+}
+
+void
+AudioMappingView::set_output_channels (vector<string> const & names)
+{
+ int const o = names.size() + 1;
+ if (o < _grid->GetNumberCols ()) {
+ _grid->DeleteCols (o, _grid->GetNumberCols() - o);
+ } else if (o > _grid->GetNumberCols ()) {
+ _grid->InsertCols (_grid->GetNumberCols(), o - _grid->GetNumberCols());
+ }
+
+ _grid->SetColLabelValue (0, _("Content"));
+
+ for (size_t i = 0; i < names.size(); ++i) {
+ _grid->SetColLabelValue (i + 1, std_to_wx (names[i]));
+ }
+
+ update_cells ();
+}
+
+void
+AudioMappingView::update_cells ()
+{
+ vector<string> row_names;
+ for (int i = 0; i < _grid->GetNumberRows (); ++i) {
+ row_names.push_back (wx_to_std (_grid->GetCellValue (i, 0)));
+ }
+