3976 |
find(children.begin(), children.end(), item); |
find(children.begin(), children.end(), item); |
3977 |
if (it != children.end()) { |
if (it != children.end()) { |
3978 |
int index = it - children.begin(); |
int index = it - children.begin(); |
3979 |
m_TreeViewInstruments.get_selection()->select(Gtk::TreePath(ToString(index))); |
|
3980 |
|
// convert index of model to index of visual presentation (i.e. if filtered) |
3981 |
|
Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_child_path_to_path(Gtk::TreePath(ToString(index))); |
3982 |
|
|
3983 |
|
if (path) |
3984 |
|
m_TreeViewInstruments.get_selection()->select(path); |
3985 |
|
else |
3986 |
|
m_TreeViewInstruments.get_selection()->unselect_all(); |
3987 |
|
|
3988 |
m_RegionChooser.set_instrument(file->GetInstrument(index)); |
m_RegionChooser.set_instrument(file->GetInstrument(index)); |
3989 |
} |
} |
5063 |
if (!file) return; |
if (!file) return; |
5064 |
|
|
5065 |
// collect all samples that are not referenced by any instrument |
// collect all samples that are not referenced by any instrument |
5066 |
std::list<gig::Sample*> lsamples; |
std::list<gig::Sample*> lsamples = unusedSamples(file); |
|
for (int iSample = 0; file->GetSample(iSample); ++iSample) { |
|
|
gig::Sample* sample = file->GetSample(iSample); |
|
|
bool isUsed = false; |
|
|
for (gig::Instrument* instrument = file->GetFirstInstrument(); instrument; |
|
|
instrument = file->GetNextInstrument()) |
|
|
{ |
|
|
for (gig::Region* rgn = instrument->GetFirstRegion(); rgn; |
|
|
rgn = instrument->GetNextRegion()) |
|
|
{ |
|
|
for (int i = 0; i < 256; ++i) { |
|
|
if (!rgn->pDimensionRegions[i]) continue; |
|
|
if (rgn->pDimensionRegions[i]->pSample != sample) continue; |
|
|
isUsed = true; |
|
|
goto endOfRefSearch; |
|
|
} |
|
|
} |
|
|
} |
|
|
endOfRefSearch: |
|
|
if (!isUsed) lsamples.push_back(sample); |
|
|
} |
|
|
|
|
5067 |
if (lsamples.empty()) return; |
if (lsamples.empty()) return; |
5068 |
|
|
5069 |
// notify everybody that we're going to remove these samples |
// notify everybody that we're going to remove these samples |