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

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

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

revision 1101 by schoenebeck, Sat Mar 17 17:46:09 2007 UTC revision 1104 by persson, Sun Mar 18 17:15:00 2007 UTC
# Line 54  MainWindow::MainWindow() Line 54  MainWindow::MainWindow()
54      // Handle selection      // Handle selection
55      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();
56      tree_sel_ref->signal_changed().connect(      tree_sel_ref->signal_changed().connect(
57          sigc::mem_fun(*this, &MainWindow::on_sel_change));          sigc::mem_fun(*this, &MainWindow::on_sel_change));
58    
59      // m_TreeView.set_reorderable();      // m_TreeView.set_reorderable();
60    
# Line 201  MainWindow::MainWindow() Line 201  MainWindow::MainWindow()
201      m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK);      m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK);
202    
203      m_RegionChooser.signal_sel_changed().connect(      m_RegionChooser.signal_sel_changed().connect(
204          sigc::mem_fun(*this, &MainWindow::region_changed) );          sigc::mem_fun(*this, &MainWindow::region_changed) );
205      m_DimRegionChooser.signal_sel_changed().connect(      m_DimRegionChooser.signal_sel_changed().connect(
206          sigc::mem_fun(*this, &MainWindow::dimreg_changed) );          sigc::mem_fun(*this, &MainWindow::dimreg_changed) );
207    
208    
209      // Create the Tree model:      // Create the Tree model:
# Line 266  void MainWindow::on_sel_change() Line 266  void MainWindow::on_sel_change()
266      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();
267    
268      Gtk::TreeModel::iterator it = tree_sel_ref->get_selected();      Gtk::TreeModel::iterator it = tree_sel_ref->get_selected();
269      if (it)      if (it) {
270      {          Gtk::TreeModel::Row row = *it;
271          Gtk::TreeModel::Row row = *it;          std::cout << row[m_Columns.m_col_name] << std::endl;
         std::cout << row[m_Columns.m_col_name] << std::endl;  
272    
273          if (row[m_Columns.m_col_instr])          m_RegionChooser.set_instrument(row[m_Columns.m_col_instr]);
274              m_RegionChooser.set_instrument(row[m_Columns.m_col_instr]);      } else {
275            m_RegionChooser.set_instrument(0);
276      }      }
277  }  }
278    
# Line 418  void MainWindow::on_loader_finished() Line 418  void MainWindow::on_loader_finished()
418      printf("Loader finished!\n");      printf("Loader finished!\n");
419      printf("on_loader_finished self=%x\n", Glib::Thread::self());      printf("on_loader_finished self=%x\n", Glib::Thread::self());
420      load_gig(loader->gig, loader->filename);      load_gig(loader->gig, loader->filename);
   
     Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();  
     tree_sel_ref->select(Gtk::TreePath("0"));  
   
421      load_dialog->hide();      load_dialog->hide();
422  }  }
423    
# Line 665  InstrumentProps::InstrumentProps() Line 661  InstrumentProps::InstrumentProps()
661      quitButton.grab_focus();      quitButton.grab_focus();
662    
663      quitButton.signal_clicked().connect(      quitButton.signal_clicked().connect(
664          sigc::mem_fun(*this, &InstrumentProps::hide));          sigc::mem_fun(*this, &InstrumentProps::hide));
665    
666      // quitButton.grab_default();      // quitButton.grab_default();
667      quitButton.show();      quitButton.show();
# Line 726  void MainWindow::load_gig(gig::File* gig Line 722  void MainWindow::load_gig(gig::File* gig
722      int instrument_index = 0;      int instrument_index = 0;
723      Gtk::RadioMenuItem::Group instrument_group;      Gtk::RadioMenuItem::Group instrument_group;
724      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;
725           instrument = gig->GetNextInstrument()) {           instrument = gig->GetNextInstrument()) {
726          Gtk::TreeModel::iterator iter = m_refTreeModel->append();          Gtk::TreeModel::iterator iter = m_refTreeModel->append();
727          Gtk::TreeModel::Row row = *iter;          Gtk::TreeModel::Row row = *iter;
728          row[m_Columns.m_col_name] = instrument->pInfo->Name.c_str();          row[m_Columns.m_col_name] = instrument->pInfo->Name.c_str();
729          row[m_Columns.m_col_instr] = instrument;          row[m_Columns.m_col_instr] = instrument;
730          // create a menu item for this instrument          // create a menu item for this instrument
731          Gtk::RadioMenuItem* item =          Gtk::RadioMenuItem* item =
732              new Gtk::RadioMenuItem(instrument_group, instrument->pInfo->Name.c_str());              new Gtk::RadioMenuItem(instrument_group, instrument->pInfo->Name.c_str());
# Line 764  void MainWindow::load_gig(gig::File* gig Line 760  void MainWindow::load_gig(gig::File* gig
760              }              }
761          }          }
762      }      }
763    
764        // select the first instrument
765        Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();
766        tree_sel_ref->select(Gtk::TreePath("0"));
767  }  }
768    
769  void MainWindow::show_instr_props()  void MainWindow::show_instr_props()
# Line 827  void MainWindow::on_action_add_instrumen Line 827  void MainWindow::on_action_add_instrumen
827      if (!file) return;      if (!file) return;
828      gig::Instrument* instrument = file->AddInstrument();      gig::Instrument* instrument = file->AddInstrument();
829      __instrument_indexer++;      __instrument_indexer++;
830      instrument->pInfo->Name =      instrument->pInfo->Name =
831          "Unnamed Instrument " + ToString(__instrument_indexer);          "Unnamed Instrument " + ToString(__instrument_indexer);
832      // update instrument tree view      // update instrument tree view
833      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();

Legend:
Removed from v.1101  
changed lines
  Added in v.1104

  ViewVC Help
Powered by ViewVC