/[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 2392 by persson, Mon Jan 7 20:41:16 2013 UTC revision 2395 by schoenebeck, Mon Jan 7 23:35:08 2013 UTC
# Line 179  MainWindow::MainWindow() : Line 179  MainWindow::MainWindow() :
179          sigc::mem_fun(*this, &MainWindow::on_action_add_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_add_instrument)
180      );      );
181      actionGroup->add(      actionGroup->add(
182            Gtk::Action::create("DupInstrument", _("_Duplicate Instrument")),
183            sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument)
184        );
185        actionGroup->add(
186          Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE),          Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE),
187          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)
188      );      );
# Line 236  MainWindow::MainWindow() : Line 240  MainWindow::MainWindow() :
240          "  <popup name='PopupMenu'>"          "  <popup name='PopupMenu'>"
241          "    <menuitem action='InstrProperties'/>"          "    <menuitem action='InstrProperties'/>"
242          "    <menuitem action='AddInstrument'/>"          "    <menuitem action='AddInstrument'/>"
243            "    <menuitem action='DupInstrument'/>"
244          "    <separator/>"          "    <separator/>"
245          "    <menuitem action='RemoveInstrument'/>"          "    <menuitem action='RemoveInstrument'/>"
246          "  </popup>"          "  </popup>"
# Line 1328  void MainWindow::on_action_add_instrumen Line 1333  void MainWindow::on_action_add_instrumen
1333      file_changed();      file_changed();
1334  }  }
1335    
1336    void MainWindow::on_action_duplicate_instrument() {
1337        if (!file) return;
1338        
1339        // retrieve the currently selected instrument
1340        // (being the original instrument to be duplicated)
1341        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection();
1342        Gtk::TreeModel::iterator itSelection = sel->get_selected();
1343        if (!itSelection) return;
1344        Gtk::TreeModel::Row row = *itSelection;
1345        gig::Instrument* instrOrig = row[m_Columns.m_col_instr];
1346        if (!instrOrig) return;
1347        
1348        // duplicate the orginal instrument
1349        gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig);
1350        instrNew->pInfo->Name =
1351            instrOrig->pInfo->Name + " (" + _("Copy") + ")";
1352            
1353        // update instrument tree view
1354        Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();
1355        Gtk::TreeModel::Row rowInstr = *iterInstr;
1356        rowInstr[m_Columns.m_col_name] = instrNew->pInfo->Name.c_str();
1357        rowInstr[m_Columns.m_col_instr] = instrNew;
1358        file_changed();
1359    }
1360    
1361  void MainWindow::on_action_remove_instrument() {  void MainWindow::on_action_remove_instrument() {
1362      if (!file) return;      if (!file) return;
1363      if (file_is_shared) {      if (file_is_shared) {

Legend:
Removed from v.2392  
changed lines
  Added in v.2395

  ViewVC Help
Powered by ViewVC