--- gigedit/trunk/src/gigedit/mainwindow.cpp 2017/06/28 10:55:28 3298 +++ gigedit/trunk/src/gigedit/mainwindow.cpp 2017/07/09 12:44:59 3299 @@ -66,6 +66,13 @@ # include "MacHelper.h" #endif +static const Gdk::ModifierType primaryModifierKey = + #if defined(__APPLE__) + Gdk::META_MASK; // Cmd key on Mac + #else + Gdk::CONTROL_MASK; // Ctrl key on all other OSs + #endif + MainWindow::MainWindow() : m_DimRegionChooser(*this), dimreg_label(_("Changes apply to:")), @@ -340,6 +347,11 @@ sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument) ); actionGroup->add( + Gtk::Action::create("CombInstruments", _("_Combine Instruments ...")), + Gtk::AccelKey(GDK_KEY_j, primaryModifierKey), + sigc::mem_fun(*this, &MainWindow::on_action_combine_instruments) + ); + actionGroup->add( Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) ); @@ -498,6 +510,7 @@ " " " " " " + " " " " " " " " @@ -534,6 +547,7 @@ " " " " " " + " " " " " " " " @@ -851,13 +865,6 @@ uiManager->get_widget("/MenuBar/MenuMacro") )->get_submenu(); - const Gdk::ModifierType primaryModifierKey = -#if defined(__APPLE__) - Gdk::META_MASK; // Cmd key on Mac -#else - Gdk::CONTROL_MASK; // Ctrl key on all other OSs -#endif - const Gdk::ModifierType noModifier = (Gdk::ModifierType)0; Gtk::AccelMap::add_entry("/macro_0", GDK_KEY_F1, noModifier); Gtk::AccelMap::add_entry("/macro_1", GDK_KEY_F2, noModifier); @@ -3588,6 +3595,24 @@ void MainWindow::on_action_combine_instruments() { CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file); + + // take over selection from instruments list view for the combine dialog's + // list view as pre-selection + std::set indeces; + { + Glib::RefPtr sel = m_TreeView.get_selection(); + std::vector rows = sel->get_selected_rows(); + for (int r = 0; r < rows.size(); ++r) { + Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[r]); + if (it) { + Gtk::TreeModel::Row row = *it; + int index = row[m_Columns.m_col_nr]; + indeces.insert(index); + } + } + } + d->setSelectedInstruments(indeces); + d->show_all(); d->run(); if (d->fileWasChanged()) {