/[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 3258 by schoenebeck, Tue May 30 20:17:12 2017 UTC revision 3299 by schoenebeck, Sun Jul 9 12:44:59 2017 UTC
# Line 66  Line 66 
66  # include "MacHelper.h"  # include "MacHelper.h"
67  #endif  #endif
68    
69    static const Gdk::ModifierType primaryModifierKey =
70        #if defined(__APPLE__)
71        Gdk::META_MASK; // Cmd key on Mac
72        #else
73        Gdk::CONTROL_MASK; // Ctrl key on all other OSs
74        #endif
75    
76  MainWindow::MainWindow() :  MainWindow::MainWindow() :
77      m_DimRegionChooser(*this),      m_DimRegionChooser(*this),
78      dimreg_label(_("Changes apply to:")),      dimreg_label(_("Changes apply to:")),
# Line 340  MainWindow::MainWindow() : Line 347  MainWindow::MainWindow() :
347          sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument)
348      );      );
349      actionGroup->add(      actionGroup->add(
350            Gtk::Action::create("CombInstruments", _("_Combine Instruments ...")),
351            Gtk::AccelKey(GDK_KEY_j, primaryModifierKey),
352            sigc::mem_fun(*this, &MainWindow::on_action_combine_instruments)
353        );
354        actionGroup->add(
355          Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE),          Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE),
356          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)
357      );      );
# Line 498  MainWindow::MainWindow() : Line 510  MainWindow::MainWindow() :
510          "      <menuitem action='ScriptSlots'/>"          "      <menuitem action='ScriptSlots'/>"
511          "      <menuitem action='AddInstrument'/>"          "      <menuitem action='AddInstrument'/>"
512          "      <menuitem action='DupInstrument'/>"          "      <menuitem action='DupInstrument'/>"
513            "      <menuitem action='CombInstruments'/>"
514          "      <separator/>"          "      <separator/>"
515          "      <menuitem action='RemoveInstrument'/>"          "      <menuitem action='RemoveInstrument'/>"
516          "    </menu>"          "    </menu>"
# Line 534  MainWindow::MainWindow() : Line 547  MainWindow::MainWindow() :
547          "    <menuitem action='ScriptSlots'/>"          "    <menuitem action='ScriptSlots'/>"
548          "    <menuitem action='AddInstrument'/>"          "    <menuitem action='AddInstrument'/>"
549          "    <menuitem action='DupInstrument'/>"          "    <menuitem action='DupInstrument'/>"
550            "    <menuitem action='CombInstruments'/>"
551          "    <separator/>"          "    <separator/>"
552          "    <menuitem action='RemoveInstrument'/>"          "    <menuitem action='RemoveInstrument'/>"
553          "  </popup>"          "  </popup>"
# Line 851  MainWindow::MainWindow() : Line 865  MainWindow::MainWindow() :
865              uiManager->get_widget("/MenuBar/MenuMacro")              uiManager->get_widget("/MenuBar/MenuMacro")
866          )->get_submenu();          )->get_submenu();
867    
         const Gdk::ModifierType primaryModifierKey =  
 #if defined(__APPLE__)  
             Gdk::META_MASK; // Cmd key on Mac  
 #else  
             Gdk::CONTROL_MASK; // Ctrl key on all other OSs  
 #endif  
   
868          const Gdk::ModifierType noModifier = (Gdk::ModifierType)0;          const Gdk::ModifierType noModifier = (Gdk::ModifierType)0;
869          Gtk::AccelMap::add_entry("<Macros>/macro_0", GDK_KEY_F1, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_0", GDK_KEY_F1, noModifier);
870          Gtk::AccelMap::add_entry("<Macros>/macro_1", GDK_KEY_F2, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_1", GDK_KEY_F2, noModifier);
# Line 3588  void MainWindow::instrument_name_changed Line 3595  void MainWindow::instrument_name_changed
3595    
3596  void MainWindow::on_action_combine_instruments() {  void MainWindow::on_action_combine_instruments() {
3597      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);
3598    
3599        // take over selection from instruments list view for the combine dialog's
3600        // list view as pre-selection
3601        std::set<int> indeces;
3602        {
3603            Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection();
3604            std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows();
3605            for (int r = 0; r < rows.size(); ++r) {
3606                Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[r]);
3607                if (it) {
3608                    Gtk::TreeModel::Row row = *it;
3609                    int index = row[m_Columns.m_col_nr];
3610                    indeces.insert(index);
3611                }
3612            }
3613        }
3614        d->setSelectedInstruments(indeces);
3615    
3616      d->show_all();      d->show_all();
3617      d->run();      d->run();
3618      if (d->fileWasChanged()) {      if (d->fileWasChanged()) {

Legend:
Removed from v.3258  
changed lines
  Added in v.3299

  ViewVC Help
Powered by ViewVC