--- gigedit/trunk/src/gigedit/CombineInstrumentsDialog.cpp 2017/06/28 10:55:28 3298 +++ gigedit/trunk/src/gigedit/CombineInstrumentsDialog.cpp 2017/07/09 12:44:59 3299 @@ -840,8 +840,9 @@ "Use SHIFT + left click or CTRL + left click to select the instruments " "you want to combine." )); - m_treeView.append_column("Instrument", m_columns.m_col_name); - m_treeView.set_headers_visible(false); + m_treeView.append_column(_("Nr"), m_columns.m_col_index); + m_treeView.append_column(_("Instrument"), m_columns.m_col_name); + m_treeView.set_headers_visible(true); m_treeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); m_treeView.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &CombineInstrumentsDialog::onSelectionChanged) @@ -866,6 +867,7 @@ Glib::ustring name(gig_to_utf8(instr->pInfo->Name)); Gtk::TreeModel::iterator iter = m_refTreeModel->append(); Gtk::TreeModel::Row row = *iter; + row[m_columns.m_col_index] = i; row[m_columns.m_col_name] = name; row[m_columns.m_col_instr] = instr; } @@ -903,6 +905,19 @@ } } +void CombineInstrumentsDialog::setSelectedInstruments(const std::set& instrumentIndeces) { + typedef Gtk::TreeModel::Children Children; + Children children = m_refTreeModel->children(); + for (Children::iterator iter = children.begin(); + iter != children.end(); ++iter) + { + Gtk::TreeModel::Row row = *iter; + int index = row[m_columns.m_col_index]; + if (instrumentIndeces.count(index)) + m_treeView.get_selection()->select(iter); + } +} + void CombineInstrumentsDialog::combineSelectedInstruments() { std::vector instruments; std::vector v = m_treeView.get_selection()->get_selected_rows();