1945 |
// select item in instrument menu |
// select item in instrument menu |
1946 |
std::vector<Gtk::TreeModel::Path> rows = m_TreeViewInstruments.get_selection()->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = m_TreeViewInstruments.get_selection()->get_selected_rows(); |
1947 |
if (!rows.empty()) { |
if (!rows.empty()) { |
1948 |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[0]); |
// convert index of visual selection (i.e. if filtered) to index of model |
1949 |
|
Gtk::TreeModel::Path row = m_refInstrumentsModelFilter->convert_path_to_child_path(rows[0]); |
1950 |
|
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(row); |
1951 |
if (it) { |
if (it) { |
1952 |
Gtk::TreePath path(it); |
Gtk::TreePath path(it); |
1953 |
int index = path[0]; |
int index = path[0]; |
3614 |
{ |
{ |
3615 |
instrumentProps.signal_name_changed().clear(); |
instrumentProps.signal_name_changed().clear(); |
3616 |
|
|
3617 |
|
// get visual selection |
3618 |
std::vector<Gtk::TreeModel::Path> rows = m_TreeViewInstruments.get_selection()->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = m_TreeViewInstruments.get_selection()->get_selected_rows(); |
3619 |
if (rows.empty()) { |
if (rows.empty()) { |
3620 |
instrumentProps.hide(); |
instrumentProps.hide(); |
3621 |
return false; |
return false; |
3622 |
} |
} |
3623 |
|
|
3624 |
|
// convert index of visual selection (i.e. if filtered) to index of model |
3625 |
|
Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_path_to_child_path(rows[0]); |
3626 |
|
|
3627 |
//NOTE: was const_iterator before, which did not compile with GTKMM4 development branch, probably going to be fixed before final GTKMM4 release though. |
//NOTE: was const_iterator before, which did not compile with GTKMM4 development branch, probably going to be fixed before final GTKMM4 release though. |
3628 |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[0]); |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(path); |
3629 |
if (it) { |
if (it) { |
3630 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
3631 |
gig::Instrument* instrument = row[m_InstrumentsModel.m_col_instr]; |
gig::Instrument* instrument = row[m_InstrumentsModel.m_col_instr]; |
3976 |
find(children.begin(), children.end(), item); |
find(children.begin(), children.end(), item); |
3977 |
if (it != children.end()) { |
if (it != children.end()) { |
3978 |
int index = it - children.begin(); |
int index = it - children.begin(); |
3979 |
m_TreeViewInstruments.get_selection()->select(Gtk::TreePath(ToString(index))); |
|
3980 |
|
// convert index of model to index of visual presentation (i.e. if filtered) |
3981 |
|
Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_child_path_to_path(Gtk::TreePath(ToString(index))); |
3982 |
|
|
3983 |
|
if (path) |
3984 |
|
m_TreeViewInstruments.get_selection()->select(path); |
3985 |
|
else |
3986 |
|
m_TreeViewInstruments.get_selection()->unselect_all(); |
3987 |
|
|
3988 |
m_RegionChooser.set_instrument(file->GetInstrument(index)); |
m_RegionChooser.set_instrument(file->GetInstrument(index)); |
3989 |
} |
} |
4426 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
4427 |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
4428 |
for (int r = 0; r < rows.size(); ++r) { |
for (int r = 0; r < rows.size(); ++r) { |
4429 |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[r]); |
// convert index of visual selection (i.e. if filtered) to index of model |
4430 |
|
Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_path_to_child_path(rows[r]); |
4431 |
|
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(path); |
4432 |
if (it) { |
if (it) { |
4433 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
4434 |
gig::Instrument* instrOrig = row[m_InstrumentsModel.m_col_instr]; |
gig::Instrument* instrOrig = row[m_InstrumentsModel.m_col_instr]; |
4459 |
} |
} |
4460 |
|
|
4461 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
4462 |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rowsVisual = sel->get_selected_rows(); |
4463 |
|
|
4464 |
|
// convert indeces of visual selection (i.e. if filtered) to indeces of model |
4465 |
|
std::vector<Gtk::TreeModel::Path> rows; |
4466 |
|
for (int rv = 0; rv < rowsVisual.size(); ++rv) { |
4467 |
|
Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_path_to_child_path(rowsVisual[rv]); |
4468 |
|
if (path) |
4469 |
|
rows.push_back(path); |
4470 |
|
} |
4471 |
|
|
4472 |
for (int r = rows.size() - 1; r >= 0; --r) { |
for (int r = rows.size() - 1; r >= 0; --r) { |
4473 |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[r]); |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[r]); |
4474 |
if (!it) continue; |
if (!it) continue; |
5163 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
5164 |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
5165 |
if (!rows.empty()) { |
if (!rows.empty()) { |
5166 |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[0]); |
// convert index of visual selection (i.e. if filtered) to index of model |
5167 |
|
Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_path_to_child_path(rows[0]); |
5168 |
|
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(path); |
5169 |
if (it) { |
if (it) { |
5170 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
5171 |
src = row[m_InstrumentsModel.m_col_instr]; |
src = row[m_InstrumentsModel.m_col_instr]; |
5193 |
const bool found = m_TreeViewInstruments.get_path_at_pos(x, y, path); |
const bool found = m_TreeViewInstruments.get_path_at_pos(x, y, path); |
5194 |
if (!found) return; |
if (!found) return; |
5195 |
|
|
5196 |
|
// convert index of visual selection (i.e. if filtered) to index of model |
5197 |
|
path = m_refInstrumentsModelFilter->convert_path_to_child_path(path); |
5198 |
|
if (!path) return; |
5199 |
|
|
5200 |
Gtk::TreeModel::iterator iter = m_refInstrumentsTreeModel->get_iter(path); |
Gtk::TreeModel::iterator iter = m_refInstrumentsTreeModel->get_iter(path); |
5201 |
if (!iter) return; |
if (!iter) return; |
5202 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
5449 |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewInstruments.get_selection(); |
5450 |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
5451 |
for (int r = 0; r < rows.size(); ++r) { |
for (int r = 0; r < rows.size(); ++r) { |
5452 |
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[r]); |
// convert index of visual selection (i.e. if filtered) to index of model |
5453 |
|
Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_path_to_child_path(rows[r]); |
5454 |
|
Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(path); |
5455 |
if (it) { |
if (it) { |
5456 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
5457 |
int index = row[m_InstrumentsModel.m_col_nr]; |
int index = row[m_InstrumentsModel.m_col_nr]; |