/[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 2615 by schoenebeck, Tue Jun 10 19:14:01 2014 UTC revision 2644 by schoenebeck, Tue Jun 17 22:55:02 2014 UTC
# Line 47  Line 47 
47  #include "CombineInstrumentsDialog.h"  #include "CombineInstrumentsDialog.h"
48  #include "scripteditor.h"  #include "scripteditor.h"
49  #include "scriptslots.h"  #include "scriptslots.h"
50    #include "ReferencesView.h"
51  #include "../../gfx/status_attached.xpm"  #include "../../gfx/status_attached.xpm"
52  #include "../../gfx/status_detached.xpm"  #include "../../gfx/status_detached.xpm"
53    
54    
55  MainWindow::MainWindow() :  MainWindow::MainWindow() :
56        m_DimRegionChooser(*this),
57      dimreg_label(_("Changes apply to:")),      dimreg_label(_("Changes apply to:")),
58      dimreg_all_regions(_("all regions")),      dimreg_all_regions(_("all regions")),
59      dimreg_all_dimregs(_("all dimension splits")),      dimreg_all_dimregs(_("all dimension splits")),
# Line 145  MainWindow::MainWindow() : Line 147  MainWindow::MainWindow() :
147      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),
148                       sigc::mem_fun(                       sigc::mem_fun(
149                           *this, &MainWindow::on_action_quit));                           *this, &MainWindow::on_action_quit));
150      actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument")));      actionGroup->add(
151            Gtk::Action::create("MenuSample", _("_Sample")),
152            sigc::mem_fun(*this, &MainWindow::show_samples_tab)
153        );
154        actionGroup->add(
155            Gtk::Action::create("MenuInstrument", _("_Instrument")),
156            sigc::mem_fun(*this, &MainWindow::show_intruments_tab)
157        );
158        actionGroup->add(
159            Gtk::Action::create("MenuScript", _("S_cript")),
160            sigc::mem_fun(*this, &MainWindow::show_scripts_tab)
161        );
162        actionGroup->add(Gtk::Action::create("AllInstruments", _("_Select")));
163    
164      actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));      actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));
165    
# Line 236  MainWindow::MainWindow() : Line 249  MainWindow::MainWindow() :
249          sigc::mem_fun(*this, &MainWindow::on_action_remove_sample)          sigc::mem_fun(*this, &MainWindow::on_action_remove_sample)
250      );      );
251      actionGroup->add(      actionGroup->add(
252            Gtk::Action::create("ShowSampleRefs", _("Show References...")),
253            sigc::mem_fun(*this, &MainWindow::on_action_view_references)
254        );
255        actionGroup->add(
256          Gtk::Action::create("ReplaceAllSamplesInAllGroups",          Gtk::Action::create("ReplaceAllSamplesInAllGroups",
257                              _("Replace All Samples in All Groups...")),                              _("Replace All Samples in All Groups...")),
258          sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups)          sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups)
# Line 282  MainWindow::MainWindow() : Line 299  MainWindow::MainWindow() :
299          "      <menuitem action='CopySampleTune'/>"          "      <menuitem action='CopySampleTune'/>"
300          "      <menuitem action='CopySampleLoop'/>"          "      <menuitem action='CopySampleLoop'/>"
301          "    </menu>"          "    </menu>"
302            "    <menu action='MenuSample'>"
303            "      <menuitem action='SampleProperties'/>"
304            "      <menuitem action='AddGroup'/>"
305            "      <menuitem action='AddSample'/>"
306            "      <menuitem action='ShowSampleRefs'/>"
307            "      <menuitem action='ReplaceAllSamplesInAllGroups' />"
308            "      <separator/>"
309            "      <menuitem action='RemoveSample'/>"
310            "    </menu>"
311          "    <menu action='MenuInstrument'>"          "    <menu action='MenuInstrument'>"
312            "      <menu action='AllInstruments'>"
313            "      </menu>"
314            "      <separator/>"
315            "      <menuitem action='InstrProperties'/>"
316            "      <menuitem action='MidiRules'/>"
317            "      <menuitem action='ScriptSlots'/>"
318            "      <menuitem action='AddInstrument'/>"
319            "      <menuitem action='DupInstrument'/>"
320            "      <separator/>"
321            "      <menuitem action='RemoveInstrument'/>"
322            "    </menu>"
323            "    <menu action='MenuScript'>"
324            "      <menuitem action='AddScriptGroup'/>"
325            "      <menuitem action='AddScript'/>"
326            "      <menuitem action='EditScript'/>"
327            "      <separator/>"
328            "      <menuitem action='RemoveScript'/>"
329          "    </menu>"          "    </menu>"
330          "    <menu action='MenuView'>"          "    <menu action='MenuView'>"
331          "      <menuitem action='Statusbar'/>"          "      <menuitem action='Statusbar'/>"
# Line 311  MainWindow::MainWindow() : Line 354  MainWindow::MainWindow() :
354          "    <menuitem action='SampleProperties'/>"          "    <menuitem action='SampleProperties'/>"
355          "    <menuitem action='AddGroup'/>"          "    <menuitem action='AddGroup'/>"
356          "    <menuitem action='AddSample'/>"          "    <menuitem action='AddSample'/>"
357            "    <menuitem action='ShowSampleRefs'/>"
358          "    <menuitem action='ReplaceAllSamplesInAllGroups' />"          "    <menuitem action='ReplaceAllSamplesInAllGroups' />"
359          "    <separator/>"          "    <separator/>"
360          "    <menuitem action='RemoveSample'/>"          "    <menuitem action='RemoveSample'/>"
# Line 364  MainWindow::MainWindow() : Line 408  MainWindow::MainWindow() :
408    
409    
410      instrument_menu = static_cast<Gtk::MenuItem*>(      instrument_menu = static_cast<Gtk::MenuItem*>(
411          uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu();          uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments"))->get_submenu();
412    
413      Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar");      Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar");
414      m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK);      m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK);
# Line 404  MainWindow::MainWindow() : Line 448  MainWindow::MainWindow() :
448      m_TreeViewSamples.set_model(m_refSamplesTreeModel);      m_TreeViewSamples.set_model(m_refSamplesTreeModel);
449      m_TreeViewSamples.set_tooltip_text(_("To actually use a sample, drag it from this list view to \"Sample\" -> \"Sample:\" on the region's settings pane on the right.\n\nRight click here for more actions on samples."));      m_TreeViewSamples.set_tooltip_text(_("To actually use a sample, drag it from this list view to \"Sample\" -> \"Sample:\" on the region's settings pane on the right.\n\nRight click here for more actions on samples."));
450      // m_TreeViewSamples.set_reorderable();      // m_TreeViewSamples.set_reorderable();
451      m_TreeViewSamples.append_column_editable("Samples", m_SamplesModel.m_col_name);      m_TreeViewSamples.append_column_editable(_("Name"), m_SamplesModel.m_col_name);
452      m_TreeViewSamples.set_headers_visible(false);      m_TreeViewSamples.append_column(_("Referenced"), m_SamplesModel.m_col_refcount);
453        {
454            Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(0);
455            Gtk::CellRendererText* cellrenderer =
456                dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer());
457            column->add_attribute(
458                cellrenderer->property_foreground(), m_SamplesModel.m_color
459            );
460        }
461        {
462            Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(1);
463            Gtk::CellRendererText* cellrenderer =
464                dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer());
465            column->add_attribute(
466                cellrenderer->property_foreground(), m_SamplesModel.m_color
467            );
468        }
469        m_TreeViewSamples.set_headers_visible(true);
470      m_TreeViewSamples.signal_button_press_event().connect_notify(      m_TreeViewSamples.signal_button_press_event().connect_notify(
471          sigc::mem_fun(*this, &MainWindow::on_sample_treeview_button_release)          sigc::mem_fun(*this, &MainWindow::on_sample_treeview_button_release)
472      );      );
# Line 417  MainWindow::MainWindow() : Line 478  MainWindow::MainWindow() :
478      m_refScriptsTreeModel = ScriptsTreeStore::create(m_ScriptsModel);      m_refScriptsTreeModel = ScriptsTreeStore::create(m_ScriptsModel);
479      m_TreeViewScripts.set_model(m_refScriptsTreeModel);      m_TreeViewScripts.set_model(m_refScriptsTreeModel);
480      m_TreeViewScripts.set_tooltip_text(_(      m_TreeViewScripts.set_tooltip_text(_(
481            "Use CTRL + double click for editing a script."
482            "\n\n"
483          "Note: instrument scripts are a LinuxSampler extension of the gig "          "Note: instrument scripts are a LinuxSampler extension of the gig "
484          "format. This feature will not work with the GigaStudio software!"          "format. This feature will not work with the GigaStudio software!"
485      ));      ));
# Line 426  MainWindow::MainWindow() : Line 489  MainWindow::MainWindow() :
489      m_TreeViewScripts.signal_button_press_event().connect_notify(      m_TreeViewScripts.signal_button_press_event().connect_notify(
490          sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release)          sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release)
491      );      );
492        //FIXME: why the heck does this double click signal_row_activated() only fired while CTRL key is pressed ?
493        m_TreeViewScripts.signal_row_activated().connect(
494            sigc::mem_fun(*this, &MainWindow::script_double_clicked)
495        );
496      m_refScriptsTreeModel->signal_row_changed().connect(      m_refScriptsTreeModel->signal_row_changed().connect(
497          sigc::mem_fun(*this, &MainWindow::script_name_changed)          sigc::mem_fun(*this, &MainWindow::script_name_changed)
498      );      );
# Line 474  MainWindow::MainWindow() : Line 541  MainWindow::MainWindow() :
541          dimreg_changed_signal.make_slot());          dimreg_changed_signal.make_slot());
542      dimreg_edit.signal_sample_ref_changed().connect(      dimreg_edit.signal_sample_ref_changed().connect(
543          sample_ref_changed_signal.make_slot());          sample_ref_changed_signal.make_slot());
544        sample_ref_changed_signal.connect(
545            sigc::mem_fun(*this, &MainWindow::on_sample_ref_changed)
546        );
547        samples_to_be_removed_signal.connect(
548            sigc::mem_fun(*this, &MainWindow::on_samples_to_be_removed)
549        );
550    
551      m_RegionChooser.signal_instrument_struct_to_be_changed().connect(      m_RegionChooser.signal_instrument_struct_to_be_changed().connect(
552          sigc::hide(          sigc::hide(
# Line 599  void MainWindow::dimreg_all_dimregs_togg Line 672  void MainWindow::dimreg_all_dimregs_togg
672  void MainWindow::dimreg_changed()  void MainWindow::dimreg_changed()
673  {  {
674      update_dimregs();      update_dimregs();
675      dimreg_edit.set_dim_region(m_DimRegionChooser.get_dimregion());      dimreg_edit.set_dim_region(m_DimRegionChooser.get_main_dimregion());
676  }  }
677    
678  void MainWindow::on_sel_change()  void MainWindow::on_sel_change()
# Line 1110  void MainWindow::on_action_help_about() Line 1183  void MainWindow::on_action_help_about()
1183          _(          _(
1184              "Gigedit is released under the GNU General Public License.\n"              "Gigedit is released under the GNU General Public License.\n"
1185              "\n"              "\n"
1186              "Please notice that this is still a very young instrument editor. "              "This program is distributed WITHOUT ANY WARRANTY; So better "
1187              "So better backup your Gigasampler files before editing them with "              "backup your Gigasampler/GigaStudio files before editing them with "
1188              "this application.\n"              "this application.\n"
1189              "\n"              "\n"
1190              "Please report bugs to: http://bugs.linuxsampler.org"              "Please report bugs to: http://bugs.linuxsampler.org"
# Line 1360  void MainWindow::file_changed() Line 1433  void MainWindow::file_changed()
1433      }      }
1434  }  }
1435    
1436    void MainWindow::updateSampleRefCountMap(gig::File* gig) {
1437        sample_ref_count.clear();
1438        
1439        if (!gig) return;
1440    
1441        for (gig::Instrument* instrument = gig->GetFirstInstrument(); instrument;
1442             instrument = gig->GetNextInstrument())
1443        {
1444            for (gig::Region* rgn = instrument->GetFirstRegion(); rgn;
1445                 rgn = instrument->GetNextRegion())
1446            {
1447                for (int i = 0; i < 256; ++i) {
1448                    if (!rgn->pDimensionRegions[i]) continue;
1449                    if (rgn->pDimensionRegions[i]->pSample) {
1450                        sample_ref_count[rgn->pDimensionRegions[i]->pSample]++;
1451                    }
1452                }
1453            }
1454        }
1455    }
1456    
1457  void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument)  void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument)
1458  {  {
1459      file = 0;      file = 0;
# Line 1386  void MainWindow::load_gig(gig::File* gig Line 1480  void MainWindow::load_gig(gig::File* gig
1480          add_instrument_to_menu(name);          add_instrument_to_menu(name);
1481      }      }
1482      instrument_name_connection.unblock();      instrument_name_connection.unblock();
1483      uiManager->get_widget("/MenuBar/MenuInstrument")->show();      uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments")->show();
1484    
1485        updateSampleRefCountMap(gig);
1486    
1487      for (gig::Group* group = gig->GetFirstGroup(); group; group = gig->GetNextGroup()) {      for (gig::Group* group = gig->GetFirstGroup(); group; group = gig->GetNextGroup()) {
1488          if (group->Name != "") {          if (group->Name != "") {
# Line 1404  void MainWindow::load_gig(gig::File* gig Line 1500  void MainWindow::load_gig(gig::File* gig
1500                      gig_to_utf8(sample->pInfo->Name);                      gig_to_utf8(sample->pInfo->Name);
1501                  rowSample[m_SamplesModel.m_col_sample] = sample;                  rowSample[m_SamplesModel.m_col_sample] = sample;
1502                  rowSample[m_SamplesModel.m_col_group]  = NULL;                  rowSample[m_SamplesModel.m_col_group]  = NULL;
1503                    int refcount = sample_ref_count.count(sample) ? sample_ref_count[sample] : 0;
1504                    rowSample[m_SamplesModel.m_col_refcount] = ToString(refcount) + " " + _("Refs.");
1505                    rowSample[m_SamplesModel.m_color] = refcount ? "black" : "red";
1506              }              }
1507          }          }
1508      }      }
# Line 1427  void MainWindow::load_gig(gig::File* gig Line 1526  void MainWindow::load_gig(gig::File* gig
1526              rowScript[m_ScriptsModel.m_col_group]  = NULL;              rowScript[m_ScriptsModel.m_col_group]  = NULL;
1527          }          }
1528      }      }
1529      // unfold all script groups by default      // unfold all sample groups & script groups by default
1530        m_TreeViewSamples.expand_all();
1531      m_TreeViewScripts.expand_all();      m_TreeViewScripts.expand_all();
1532    
1533      file = gig;      file = gig;
# Line 1560  void MainWindow::on_button_release(GdkEv Line 1660  void MainWindow::on_button_release(GdkEv
1660          show_instr_props();          show_instr_props();
1661      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
1662          // gig v2 files have no midi rules          // gig v2 files have no midi rules
1663            const bool bEnabled = !(file->pVersion && file->pVersion->major == 2);
1664            static_cast<Gtk::MenuItem*>(
1665                uiManager->get_widget("/MenuBar/MenuInstrument/MidiRules"))->set_sensitive(
1666                    bEnabled
1667                );
1668          static_cast<Gtk::MenuItem*>(          static_cast<Gtk::MenuItem*>(
1669              uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive(              uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive(
1670                  !(file->pVersion && file->pVersion->major == 2));                  bEnabled
1671                );
1672          popup_menu->popup(button->button, button->time);          popup_menu->popup(button->button, button->time);
1673      }      }
1674  }  }
# Line 1596  void MainWindow::on_sample_treeview_butt Line 1702  void MainWindow::on_sample_treeview_butt
1702              group_selected  = row[m_SamplesModel.m_col_group];              group_selected  = row[m_SamplesModel.m_col_group];
1703              sample_selected = row[m_SamplesModel.m_col_sample];              sample_selected = row[m_SamplesModel.m_col_sample];
1704          }          }
1705            
1706                
1707          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/SampleProperties"))->          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/SampleProperties"))->
1708              set_sensitive(group_selected || sample_selected);              set_sensitive(group_selected || sample_selected);
1709          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddSample"))->          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddSample"))->
1710              set_sensitive(group_selected || sample_selected);              set_sensitive(group_selected || sample_selected);
1711          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddGroup"))->          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/AddGroup"))->
1712              set_sensitive(file);              set_sensitive(file);
1713            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/ShowSampleRefs"))->
1714                set_sensitive(sample_selected);
1715          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/RemoveSample"))->          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/SamplePopupMenu/RemoveSample"))->
1716              set_sensitive(group_selected || sample_selected);              set_sensitive(group_selected || sample_selected);
1717          // show sample popup          // show sample popup
1718          sample_popup->popup(button->button, button->time);          sample_popup->popup(button->button, button->time);
1719    
1720            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/SampleProperties"))->
1721                set_sensitive(group_selected || sample_selected);
1722            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddSample"))->
1723                set_sensitive(group_selected || sample_selected);
1724            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/AddGroup"))->
1725                set_sensitive(file);
1726            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/ShowSampleRefs"))->
1727                set_sensitive(sample_selected);
1728            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuSample/RemoveSample"))->
1729                set_sensitive(group_selected || sample_selected);
1730      }      }
1731  }  }
1732    
# Line 1633  void MainWindow::on_script_treeview_butt Line 1754  void MainWindow::on_script_treeview_butt
1754              set_sensitive(group_selected || script_selected);              set_sensitive(group_selected || script_selected);
1755          // show sample popup          // show sample popup
1756          script_popup->popup(button->button, button->time);          script_popup->popup(button->button, button->time);
1757    
1758            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/AddScript"))->
1759                set_sensitive(group_selected || script_selected);
1760            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/AddScriptGroup"))->
1761                set_sensitive(file);
1762            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/EditScript"))->
1763                set_sensitive(script_selected);    
1764            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuScript/RemoveScript"))->
1765                set_sensitive(group_selected || script_selected);
1766      }      }
1767  }  }
1768    
# Line 2440  void MainWindow::script_name_changed(con Line 2570  void MainWindow::script_name_changed(con
2570      }      }
2571  }  }
2572    
2573    void MainWindow::script_double_clicked(const Gtk::TreeModel::Path& path,
2574                                           Gtk::TreeViewColumn* column)
2575    {
2576        Gtk::TreeModel::iterator iter = m_refScriptsTreeModel->get_iter(path);
2577        if (!iter) return;
2578        Gtk::TreeModel::Row row = *iter;
2579        gig::Script* script = row[m_ScriptsModel.m_col_script];
2580        if (!script) return;
2581    
2582        ScriptEditor* editor = new ScriptEditor;
2583        editor->setScript(script);
2584        //editor->reparent(*this);
2585        editor->show();
2586    }
2587    
2588  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,
2589                                           const Gtk::TreeModel::iterator& iter) {                                           const Gtk::TreeModel::iterator& iter) {
2590      if (!iter) return;      if (!iter) return;
# Line 2486  void MainWindow::on_action_combine_instr Line 2631  void MainWindow::on_action_combine_instr
2631      delete d;      delete d;
2632  }  }
2633    
2634    void MainWindow::on_action_view_references() {
2635        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection();
2636        Gtk::TreeModel::iterator it = sel->get_selected();
2637        if (!it) return;
2638        Gtk::TreeModel::Row row = *it;
2639        gig::Sample* sample = row[m_SamplesModel.m_col_sample];
2640        if (!sample) return;
2641    
2642        ReferencesView* d = new ReferencesView(*this);
2643        d->setSample(sample);
2644        d->show_all();
2645        d->resize(500, 400);
2646        d->run();
2647        delete d;
2648    }
2649    
2650  void MainWindow::mergeFiles(const std::vector<std::string>& filenames) {  void MainWindow::mergeFiles(const std::vector<std::string>& filenames) {
2651      struct _Source {      struct _Source {
2652          std::vector<RIFF::File*> riffs;          std::vector<RIFF::File*> riffs;
# Line 2646  void MainWindow::set_file_is_shared(bool Line 2807  void MainWindow::set_file_is_shared(bool
2807      }      }
2808  }  }
2809    
2810    void MainWindow::on_sample_ref_count_incremented(gig::Sample* sample, int offset) {
2811        if (!sample) return;
2812        sample_ref_count[sample] += offset;
2813        const int refcount = sample_ref_count[sample];
2814    
2815        Glib::RefPtr<Gtk::TreeModel> model = m_TreeViewSamples.get_model();
2816        for (int g = 0; g < model->children().size(); ++g) {
2817            Gtk::TreeModel::Row rowGroup = model->children()[g];
2818            for (int s = 0; s < rowGroup.children().size(); ++s) {
2819                Gtk::TreeModel::Row rowSample = rowGroup.children()[s];
2820                if (rowSample[m_SamplesModel.m_col_sample] != sample) continue;
2821                rowSample[m_SamplesModel.m_col_refcount] = ToString(refcount) + " " + _("Refs.");
2822                rowSample[m_SamplesModel.m_color] = refcount ? "black" : "red";
2823            }
2824        }
2825    }
2826    
2827    void MainWindow::on_sample_ref_changed(gig::Sample* oldSample, gig::Sample* newSample) {
2828        on_sample_ref_count_incremented(oldSample, -1);
2829        on_sample_ref_count_incremented(newSample, +1);
2830    }
2831    
2832    void MainWindow::on_samples_to_be_removed(std::list<gig::Sample*> samples) {
2833        // just in case a new sample is added later with exactly the same memory
2834        // address, which would lead to incorrect refcount if not deleted here
2835        for (std::list<gig::Sample*>::const_iterator it = samples.begin();
2836             it != samples.end(); it != samples.end())
2837        {
2838            sample_ref_count.erase(*it);
2839        }
2840    }
2841    
2842    void MainWindow::show_samples_tab() {
2843        m_TreeViewNotebook.set_current_page(0);
2844    }
2845    
2846    void MainWindow::show_intruments_tab() {
2847        m_TreeViewNotebook.set_current_page(1);
2848    }
2849    
2850    void MainWindow::show_scripts_tab() {
2851        m_TreeViewNotebook.set_current_page(2);
2852    }
2853    
2854  sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() {  sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() {
2855      return file_structure_to_be_changed_signal;      return file_structure_to_be_changed_signal;
2856  }  }

Legend:
Removed from v.2615  
changed lines
  Added in v.2644

  ViewVC Help
Powered by ViewVC