/[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 3409 by schoenebeck, Tue Jan 23 16:30:56 2018 UTC revision 3469 by persson, Tue Feb 12 18:54:58 2019 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2017 Andreas Persson   * Copyright (C) 2006-2019 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 1356  MainWindow::MainWindow() : Line 1356  MainWindow::MainWindow() :
1356      m_TreeView.set_model(m_refTreeModelFilter);      m_TreeView.set_model(m_refTreeModelFilter);
1357    
1358      m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);      m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
1359      m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules. Drag & drop to change the order of instruments."));      m_TreeView.set_has_tooltip(true);
1360        m_TreeView.signal_query_tooltip().connect(
1361            sigc::mem_fun(*this, &MainWindow::onQueryTreeViewTooltip)
1362        );
1363      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(
1364          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)
1365      );      );
# Line 1513  MainWindow::MainWindow() : Line 1516  MainWindow::MainWindow() :
1516          sigc::hide(          sigc::hide(
1517              sigc::bind(              sigc::bind(
1518                  file_structure_to_be_changed_signal.make_slot(),                  file_structure_to_be_changed_signal.make_slot(),
1519    #if SIGCXX_MAJOR_VERSION > 2 || (SIGCXX_MAJOR_VERSION == 2 && SIGCXX_MINOR_VERSION >= 8)
1520                    std::ref(this->file)
1521    #else
1522                  sigc::ref(this->file)                  sigc::ref(this->file)
1523    #endif
1524              )              )
1525          )          )
1526      );      );
# Line 1521  MainWindow::MainWindow() : Line 1528  MainWindow::MainWindow() :
1528          sigc::hide(          sigc::hide(
1529              sigc::bind(              sigc::bind(
1530                  file_structure_changed_signal.make_slot(),                  file_structure_changed_signal.make_slot(),
1531    #if SIGCXX_MAJOR_VERSION > 2 || (SIGCXX_MAJOR_VERSION == 2 && SIGCXX_MINOR_VERSION >= 8)
1532                    std::ref(this->file)
1533    #else
1534                  sigc::ref(this->file)                  sigc::ref(this->file)
1535    #endif
1536              )              )
1537          )          )
1538      );      );
# Line 1543  MainWindow::MainWindow() : Line 1554  MainWindow::MainWindow() :
1554          sigc::mem_fun(*this, &MainWindow::update_dimregs));          sigc::mem_fun(*this, &MainWindow::update_dimregs));
1555    
1556      m_searchText.signal_changed().connect(      m_searchText.signal_changed().connect(
1557          sigc::mem_fun(m_refTreeModelFilter.operator->(), &Gtk::TreeModelFilter::refilter)          sigc::mem_fun(*m_refTreeModelFilter.operator->(), &Gtk::TreeModelFilter::refilter)
1558      );      );
1559    
1560      file = 0;      file = 0;
# Line 1597  MainWindow::MainWindow() : Line 1608  MainWindow::MainWindow() :
1608          Gtk::AccelMap::add_entry("<Macros>/macro_9", GDK_KEY_F10, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_9", GDK_KEY_F10, noModifier);
1609          Gtk::AccelMap::add_entry("<Macros>/macro_10", GDK_KEY_F11, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_10", GDK_KEY_F11, noModifier);
1610          Gtk::AccelMap::add_entry("<Macros>/macro_11", GDK_KEY_F12, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_11", GDK_KEY_F12, noModifier);
1611            Gtk::AccelMap::add_entry("<Macros>/macro_12", GDK_KEY_F13, noModifier);
1612            Gtk::AccelMap::add_entry("<Macros>/macro_13", GDK_KEY_F14, noModifier);
1613            Gtk::AccelMap::add_entry("<Macros>/macro_14", GDK_KEY_F15, noModifier);
1614            Gtk::AccelMap::add_entry("<Macros>/macro_15", GDK_KEY_F16, noModifier);
1615            Gtk::AccelMap::add_entry("<Macros>/macro_16", GDK_KEY_F17, noModifier);
1616            Gtk::AccelMap::add_entry("<Macros>/macro_17", GDK_KEY_F18, noModifier);
1617            Gtk::AccelMap::add_entry("<Macros>/macro_18", GDK_KEY_F19, noModifier);
1618          Gtk::AccelMap::add_entry("<Macros>/SetupMacros", 'm', primaryModifierKey);          Gtk::AccelMap::add_entry("<Macros>/SetupMacros", 'm', primaryModifierKey);
1619    
1620          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();
# Line 1619  MainWindow::MainWindow() : Line 1637  MainWindow::MainWindow() :
1637          Gtk::AccelMap::add_entry("<Scripts>/script_9", GDK_KEY_F10, Gdk::SHIFT_MASK);          Gtk::AccelMap::add_entry("<Scripts>/script_9", GDK_KEY_F10, Gdk::SHIFT_MASK);
1638          Gtk::AccelMap::add_entry("<Scripts>/script_10", GDK_KEY_F11, Gdk::SHIFT_MASK);          Gtk::AccelMap::add_entry("<Scripts>/script_10", GDK_KEY_F11, Gdk::SHIFT_MASK);
1639          Gtk::AccelMap::add_entry("<Scripts>/script_11", GDK_KEY_F12, Gdk::SHIFT_MASK);          Gtk::AccelMap::add_entry("<Scripts>/script_11", GDK_KEY_F12, Gdk::SHIFT_MASK);
1640            Gtk::AccelMap::add_entry("<Scripts>/script_12", GDK_KEY_F13, Gdk::SHIFT_MASK);
1641            Gtk::AccelMap::add_entry("<Scripts>/script_13", GDK_KEY_F14, Gdk::SHIFT_MASK);
1642            Gtk::AccelMap::add_entry("<Scripts>/script_14", GDK_KEY_F15, Gdk::SHIFT_MASK);
1643            Gtk::AccelMap::add_entry("<Scripts>/script_15", GDK_KEY_F16, Gdk::SHIFT_MASK);
1644            Gtk::AccelMap::add_entry("<Scripts>/script_16", GDK_KEY_F17, Gdk::SHIFT_MASK);
1645            Gtk::AccelMap::add_entry("<Scripts>/script_17", GDK_KEY_F18, Gdk::SHIFT_MASK);
1646            Gtk::AccelMap::add_entry("<Scripts>/script_18", GDK_KEY_F19, Gdk::SHIFT_MASK);
1647            Gtk::AccelMap::add_entry("<Scripts>/DropAllScriptSlots", GDK_KEY_BackSpace, Gdk::SHIFT_MASK);
1648    
1649          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();
1650          assign_scripts_menu->set_accel_group(accelGroup);          assign_scripts_menu->set_accel_group(accelGroup);
# Line 2622  void MainWindow::on_show_tooltips_change Line 2648  void MainWindow::on_show_tooltips_change
2648      dimreg_all_regions.set_has_tooltip(b);      dimreg_all_regions.set_has_tooltip(b);
2649      dimreg_all_dimregs.set_has_tooltip(b);      dimreg_all_dimregs.set_has_tooltip(b);
2650      dimreg_stereo.set_has_tooltip(b);      dimreg_stereo.set_has_tooltip(b);
2651      m_TreeView.set_has_tooltip(b);  
2652        // Not doing this here, we let onQueryTreeViewTooltip() handle this per cell
2653        //m_TreeView.set_has_tooltip(b);
2654    
2655      m_TreeViewSamples.set_has_tooltip(b);      m_TreeViewSamples.set_has_tooltip(b);
2656      m_TreeViewScripts.set_has_tooltip(b);      m_TreeViewScripts.set_has_tooltip(b);
2657    
# Line 2648  void MainWindow::on_action_help_about() Line 2677  void MainWindow::on_action_help_about()
2677      dialog.set_name("Gigedit");      dialog.set_name("Gigedit");
2678  #endif  #endif
2679      dialog.set_version(VERSION);      dialog.set_version(VERSION);
2680      dialog.set_copyright("Copyright (C) 2006-2017 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2019 Andreas Persson");
2681      const std::string sComment =      const std::string sComment =
2682          _("Built " __DATE__ "\nUsing ") +          _("Built " __DATE__ "\nUsing ") +
2683          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +
# Line 2702  PropDialog::PropDialog() Line 2731  PropDialog::PropDialog()
2731      set_title(_("File Properties"));      set_title(_("File Properties"));
2732      eName.set_width_chars(50);      eName.set_width_chars(50);
2733    
2734        connect(eFileFormat, &PropDialog::set_FileFormat);
2735      connect(eName, &DLS::Info::Name);      connect(eName, &DLS::Info::Name);
2736      connect(eCreationDate, &DLS::Info::CreationDate);      connect(eCreationDate, &DLS::Info::CreationDate);
2737      connect(eComments, &DLS::Info::Comments);      connect(eComments, &DLS::Info::Comments);
# Line 2744  PropDialog::PropDialog() Line 2774  PropDialog::PropDialog()
2774  #endif  #endif
2775    
2776      add(vbox);      add(vbox);
2777  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
2778      table.set_margin(5);      table.set_margin(5);
2779  #else  #else
2780      table.set_border_width(5);      table.set_border_width(5);
# Line 2752  PropDialog::PropDialog() Line 2782  PropDialog::PropDialog()
2782      vbox.add(table);      vbox.add(table);
2783      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);
2784      buttonBox.set_layout(Gtk::BUTTONBOX_END);      buttonBox.set_layout(Gtk::BUTTONBOX_END);
2785  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
2786      buttonBox.set_margin(5);      buttonBox.set_margin(5);
2787  #else  #else
2788      buttonBox.set_border_width(5);      buttonBox.set_border_width(5);
# Line 2763  PropDialog::PropDialog() Line 2793  PropDialog::PropDialog()
2793      quitButton.grab_focus();      quitButton.grab_focus();
2794      quitButton.signal_clicked().connect(      quitButton.signal_clicked().connect(
2795          sigc::mem_fun(*this, &PropDialog::hide));          sigc::mem_fun(*this, &PropDialog::hide));
     eFileFormat.signal_value_changed().connect(  
         sigc::mem_fun(*this, &PropDialog::onFileFormatChanged));  
2796    
2797      quitButton.show();      quitButton.show();
2798      vbox.show();      vbox.show();
# Line 2776  PropDialog::PropDialog() Line 2804  PropDialog::PropDialog()
2804  void PropDialog::set_file(gig::File* file)  void PropDialog::set_file(gig::File* file)
2805  {  {
2806      m_file = file;      m_file = file;
2807        update(file->pInfo);
2808    
2809      // update file format version combo box      // update file format version combo box
2810      const std::string sGiga = "Gigasampler/GigaStudio v";      const std::string sGiga = "Gigasampler/GigaStudio v";
# Line 2783  void PropDialog::set_file(gig::File* fil Line 2812  void PropDialog::set_file(gig::File* fil
2812      std::vector<std::string> txts;      std::vector<std::string> txts;
2813      std::vector<int> values;      std::vector<int> values;
2814      txts.push_back(sGiga + "2"); values.push_back(2);      txts.push_back(sGiga + "2"); values.push_back(2);
2815      txts.push_back(sGiga + "3/v4"); values.push_back(3);      txts.push_back(sGiga + "3"); values.push_back(3);
2816      if (major != 2 && major != 3) {      txts.push_back(sGiga + "4"); values.push_back(4);
2817        if (major < 2 || major > 4) {
2818          txts.push_back(sGiga + ToString(major)); values.push_back(major);          txts.push_back(sGiga + ToString(major)); values.push_back(major);
2819      }      }
2820      std::vector<const char*> texts;      std::vector<const char*> texts;
2821      for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str());      for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str());
2822      texts.push_back(NULL); values.push_back(0);      texts.push_back(NULL); values.push_back(0);
2823    
2824        update_model++;
2825      eFileFormat.set_choices(&texts[0], &values[0]);      eFileFormat.set_choices(&texts[0], &values[0]);
2826      eFileFormat.set_value(major);      eFileFormat.set_value(major);
2827        update_model--;
2828  }  }
2829    
2830  void PropDialog::onFileFormatChanged() {  void PropDialog::set_FileFormat(int value)
     const int major = eFileFormat.get_value();  
     if (m_file) m_file->pVersion->major = major;  
 }  
   
 void PropDialog::set_info(DLS::Info* info)  
2831  {  {
2832      update(info);      m_file->pVersion->major = value;
2833  }  }
2834    
2835    
# Line 2903  InstrumentProps::InstrumentProps() : Line 2931  InstrumentProps::InstrumentProps() :
2931      table.add(eDimensionKeyRangeHigh);      table.add(eDimensionKeyRangeHigh);
2932    
2933      add(vbox);      add(vbox);
2934  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
2935      table.set_margin(5);      table.set_margin(5);
2936  #else  #else
2937      table.set_border_width(5);      table.set_border_width(5);
# Line 2912  InstrumentProps::InstrumentProps() : Line 2940  InstrumentProps::InstrumentProps() :
2940      table.show();      table.show();
2941      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);
2942      buttonBox.set_layout(Gtk::BUTTONBOX_END);      buttonBox.set_layout(Gtk::BUTTONBOX_END);
2943  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
2944      buttonBox.set_margin(5);      buttonBox.set_margin(5);
2945  #else  #else
2946      buttonBox.set_border_width(5);      buttonBox.set_border_width(5);
# Line 2974  void MainWindow::updateSampleRefCountMap Line 3002  void MainWindow::updateSampleRefCountMap
3002      }      }
3003  }  }
3004    
3005    bool MainWindow::onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip) {
3006        Gtk::TreeModel::iterator iter;
3007        if (!m_TreeView.get_tooltip_context_iter(x, y, keyboardTip, iter)) {
3008            return false;
3009        }
3010        Gtk::TreeModel::Path path(iter);
3011        Gtk::TreeModel::Row row = *iter;
3012        Gtk::TreeViewColumn* pointedColumn = NULL;
3013        // resolve the precise table column the mouse points to
3014        {
3015            Gtk::TreeModel::Path path; // unused
3016            int cellX, cellY; // unused
3017            m_TreeView.get_path_at_pos(x, y, path, pointedColumn, cellX, cellY);
3018        }
3019        Gtk::TreeViewColumn* scriptsColumn = m_TreeView.get_column(2);
3020        if (pointedColumn == scriptsColumn) { // mouse hovers scripts column ...
3021            // show the script(s) assigned to the hovered instrument as tooltip
3022            tooltip->set_markup( row[m_Columns.m_col_tooltip] );
3023            m_TreeView.set_tooltip_cell(tooltip, &path, scriptsColumn, NULL);
3024        } else {
3025            // if beginners' tooltips is disabled then don't show the following one
3026            if (!Settings::singleton()->showTooltips)
3027                return false;
3028            // yeah, a beginners tooltip
3029            tooltip->set_text(_(
3030                "Right click here for actions on instruments & MIDI Rules. "
3031                "Drag & drop to change the order of instruments."
3032            ));
3033            m_TreeView.set_tooltip_cell(tooltip, &path, pointedColumn, NULL);
3034        }
3035        return true;
3036    }
3037    
3038    static Glib::ustring scriptTooltipFor(gig::Instrument* instrument, int index) {
3039        Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
3040        const int iScriptSlots = instrument->ScriptSlotCount();
3041        Glib::ustring tooltip = "<u>(" + ToString(index) + ") “"  + name + "”</u>\n\n";
3042        if (!iScriptSlots)
3043            tooltip += "<span foreground='red'><i>No script assigned</i></span>";
3044        else {
3045            for (int i = 0; i < iScriptSlots; ++i) {
3046                tooltip += "• " + ToString(i+1) + ". Script: “<span foreground='#46DEFF'><b>" +
3047                           instrument->GetScriptOfSlot(i)->Name + "</b></span>”";
3048                if (i + 1 < iScriptSlots) tooltip += "\n\n";
3049            }
3050        }
3051        return tooltip;
3052    }
3053    
3054  void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument)  void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument)
3055  {  {
3056      file = 0;      file = 0;
# Line 2988  void MainWindow::load_gig(gig::File* gig Line 3065  void MainWindow::load_gig(gig::File* gig
3065      file_is_changed = false;      file_is_changed = false;
3066    
3067      propDialog.set_file(gig);      propDialog.set_file(gig);
     propDialog.set_info(gig->pInfo);  
3068    
3069      instrument_name_connection.block();      instrument_name_connection.block();
3070      int index = 0;      int index = 0;
# Line 3003  void MainWindow::load_gig(gig::File* gig Line 3079  void MainWindow::load_gig(gig::File* gig
3079          row[m_Columns.m_col_name] = name;          row[m_Columns.m_col_name] = name;
3080          row[m_Columns.m_col_instr] = instrument;          row[m_Columns.m_col_instr] = instrument;
3081          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
3082            row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
3083    
3084  #if !USE_GTKMM_BUILDER  #if !USE_GTKMM_BUILDER
3085          add_instrument_to_menu(name);          add_instrument_to_menu(name);
# Line 3120  void MainWindow::instr_name_changed_by_i Line 3197  void MainWindow::instr_name_changed_by_i
3197      gig::Instrument* instrument = row[m_Columns.m_col_instr];      gig::Instrument* instrument = row[m_Columns.m_col_instr];
3198      Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name));      Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name));
3199      if (gigname != name) {      if (gigname != name) {
3200            Gtk::TreeModel::Path path(*it);
3201            const int index = path[0];
3202          row[m_Columns.m_col_name] = gigname;          row[m_Columns.m_col_name] = gigname;
3203            row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
3204      }      }
3205  }  }
3206    
# Line 3166  void MainWindow::onScriptSlotsModified(g Line 3246  void MainWindow::onScriptSlotsModified(g
3246          Gtk::TreeModel::Row row = model->children()[i];          Gtk::TreeModel::Row row = model->children()[i];
3247          if (row[m_Columns.m_col_instr] != pInstrument) continue;          if (row[m_Columns.m_col_instr] != pInstrument) continue;
3248          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
3249            row[m_Columns.m_col_tooltip] = scriptTooltipFor(pInstrument, i);
3250          break;          break;
3251      }      }
3252    
# Line 3191  void MainWindow::assignScript(gig::Scrip Line 3272  void MainWindow::assignScript(gig::Scrip
3272      onScriptSlotsModified(pInstrument);      onScriptSlotsModified(pInstrument);
3273  }  }
3274    
3275    void MainWindow::dropAllScriptSlots() {
3276        gig::Instrument* pInstrument = get_instrument();
3277        if (!pInstrument) {
3278            printf("!instrument\n");
3279            return;
3280        }
3281    
3282        const int iScriptSlots = pInstrument->ScriptSlotCount();
3283        for (int i = iScriptSlots - 1; i >= 0; --i)
3284            pInstrument->RemoveScriptSlot(i);
3285    
3286        onScriptSlotsModified(pInstrument);
3287    }
3288    
3289  void MainWindow::on_action_refresh_all() {  void MainWindow::on_action_refresh_all() {
3290      __refreshEntireGUI();      __refreshEntireGUI();
3291  }  }
# Line 3365  void MainWindow::select_instrument(gig:: Line 3460  void MainWindow::select_instrument(gig::
3460              show_intruments_tab();              show_intruments_tab();
3461              m_TreeView.get_selection()->unselect_all();              m_TreeView.get_selection()->unselect_all();
3462                            
3463  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3464              auto iterSel = model->children()[i].get_iter();              auto iterSel = model->children()[i].get_iter();
3465              m_TreeView.get_selection()->select(iterSel);              m_TreeView.get_selection()->select(iterSel);
3466  #else  #else
# Line 3395  bool MainWindow::select_dimension_region Line 3490  bool MainWindow::select_dimension_region
3490              // select and show the respective instrument in the list view              // select and show the respective instrument in the list view
3491              show_intruments_tab();              show_intruments_tab();
3492              m_TreeView.get_selection()->unselect_all();              m_TreeView.get_selection()->unselect_all();
3493  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3494              auto iterSel = model->children()[i].get_iter();              auto iterSel = model->children()[i].get_iter();
3495              m_TreeView.get_selection()->select(iterSel);              m_TreeView.get_selection()->select(iterSel);
3496  #else  #else
# Line 3431  void MainWindow::select_sample(gig::Samp Line 3526  void MainWindow::select_sample(gig::Samp
3526              if (rowSample[m_SamplesModel.m_col_sample] == sample) {              if (rowSample[m_SamplesModel.m_col_sample] == sample) {
3527                  show_samples_tab();                  show_samples_tab();
3528                  m_TreeViewSamples.get_selection()->unselect_all();                  m_TreeViewSamples.get_selection()->unselect_all();
3529  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3530                  auto iterSel = rowGroup.children()[s].get_iter();                  auto iterSel = rowGroup.children()[s].get_iter();
3531                  m_TreeViewSamples.get_selection()->select(iterSel);                  m_TreeViewSamples.get_selection()->select(iterSel);
3532  #else  #else
# Line 3631  void MainWindow::updateScriptListOfMenu( Line 3726  void MainWindow::updateScriptListOfMenu(
3726          assign_scripts_menu->append(*item);          assign_scripts_menu->append(*item);
3727      }      }
3728    
3729        // add separator line to menu
3730        assign_scripts_menu->append(*new Gtk::SeparatorMenuItem);
3731    
3732        {
3733            Gtk::MenuItem* item = new Gtk::MenuItem(_("Unassign All Scripts"));
3734            item->signal_activate().connect(
3735                sigc::mem_fun(*this, &MainWindow::dropAllScriptSlots)
3736            );
3737            assign_scripts_menu->append(*item);
3738            item->set_accel_path("<Scripts>/DropAllScriptSlots");
3739        }
3740    
3741  #if HAS_GTKMM_SHOW_ALL_CHILDREN  #if HAS_GTKMM_SHOW_ALL_CHILDREN
3742      assign_scripts_menu->show_all_children();      assign_scripts_menu->show_all_children();
3743  #endif  #endif
# Line 3679  void MainWindow::add_instrument(gig::Ins Line 3786  void MainWindow::add_instrument(gig::Ins
3786      instrument_name_connection.block();      instrument_name_connection.block();
3787      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();
3788      Gtk::TreeModel::Row rowInstr = *iterInstr;      Gtk::TreeModel::Row rowInstr = *iterInstr;
3789      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;      const int index = m_refTreeModel->children().size() - 1;
3790        rowInstr[m_Columns.m_col_nr] = index;
3791      rowInstr[m_Columns.m_col_name] = name;      rowInstr[m_Columns.m_col_name] = name;
3792      rowInstr[m_Columns.m_col_instr] = instrument;      rowInstr[m_Columns.m_col_instr] = instrument;
3793      rowInstr[m_Columns.m_col_scripts] = "";      rowInstr[m_Columns.m_col_scripts] = "";
3794        rowInstr[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
3795      instrument_name_connection.unblock();      instrument_name_connection.unblock();
3796    
3797  #if !USE_GTKMM_BUILDER  #if !USE_GTKMM_BUILDER
# Line 3769  void MainWindow::on_action_remove_instru Line 3878  void MainWindow::on_action_remove_instru
3878                       it != m_refTreeModel->children().end(); ++it, ++index)                       it != m_refTreeModel->children().end(); ++it, ++index)
3879                  {                  {
3880                      Gtk::TreeModel::Row row = *it;                      Gtk::TreeModel::Row row = *it;
3881                        gig::Instrument* instrument = row[m_Columns.m_col_instr];
3882                      row[m_Columns.m_col_nr] = index;                      row[m_Columns.m_col_nr] = index;
3883                        row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
3884                  }                  }
3885              }              }
3886    
# Line 4690  bool MainWindow::instrument_row_visible( Line 4801  bool MainWindow::instrument_row_visible(
4801      trim(pattern);      trim(pattern);
4802      if (pattern.empty()) return true;      if (pattern.empty()) return true;
4803    
4804  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
4805      //HACK: on GTKMM4 development branch const_iterator cannot be easily converted to iterator, probably going to be fixed before final GTKMM4 release though.      //HACK: on GTKMM4 development branch const_iterator cannot be easily converted to iterator, probably going to be fixed before final GTKMM4 release though.
4806      Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter);      Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter);
4807  #else  #else

Legend:
Removed from v.3409  
changed lines
  Added in v.3469

  ViewVC Help
Powered by ViewVC