/[svn]/gigedit/trunk/src/gigedit/mainwindow.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/mainwindow.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3806 by schoenebeck, Thu Aug 13 13:35:33 2020 UTC revision 3808 by schoenebeck, Fri Aug 14 11:24:09 2020 UTC
# Line 1864  void MainWindow::region_changed() Line 1864  void MainWindow::region_changed()
1864    
1865  gig::Instrument* MainWindow::get_instrument()  gig::Instrument* MainWindow::get_instrument()
1866  {  {
1867      gig::Instrument* instrument = 0;      gig::Instrument* instrument = NULL;
1868    
1869        // get indeces of visual selection
1870      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();
1871      if (rows.empty()) return NULL;      if (rows.empty()) return NULL;
1872    
1873        // convert index of visual selection (i.e. if filtered) to index of model
1874        Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_path_to_child_path(rows[0]);
1875        if (!path) return NULL;
1876    
1877      //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.
1878      Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[0]);      Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(path);
1879      if (it) {      if (it) {
1880          Gtk::TreeModel::Row row = *it;          Gtk::TreeModel::Row row = *it;
1881          instrument = row[m_InstrumentsModel.m_col_instr];          instrument = row[m_InstrumentsModel.m_col_instr];
# Line 3721  void MainWindow::show_midi_rules() Line 3728  void MainWindow::show_midi_rules()
3728    
3729  void MainWindow::show_script_slots() {  void MainWindow::show_script_slots() {
3730      if (!file) return;      if (!file) return;
3731    
3732      // get selected instrument      // get selected instrument
3733      std::vector<Gtk::TreeModel::Path> rows = m_TreeViewInstruments.get_selection()->get_selected_rows();      gig::Instrument* instrument = get_instrument();
     if (rows.empty()) return;  
     Gtk::TreeModel::iterator it = m_refInstrumentsTreeModel->get_iter(rows[0]);  
     if (!it) return;  
     Gtk::TreeModel::Row row = *it;  
     gig::Instrument* instrument = row[m_InstrumentsModel.m_col_instr];  
3734      if (!instrument) return;      if (!instrument) return;
3735    
3736      ScriptSlots* window = new ScriptSlots;      ScriptSlots* window = new ScriptSlots;

Legend:
Removed from v.3806  
changed lines
  Added in v.3808

  ViewVC Help
Powered by ViewVC