453 |
{ |
{ |
454 |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(0); |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(0); |
455 |
Gtk::CellRendererText* cellrenderer = |
Gtk::CellRendererText* cellrenderer = |
456 |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer()); |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell()); |
457 |
column->add_attribute( |
column->add_attribute( |
458 |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
459 |
); |
); |
461 |
{ |
{ |
462 |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(1); |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(1); |
463 |
Gtk::CellRendererText* cellrenderer = |
Gtk::CellRendererText* cellrenderer = |
464 |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer()); |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell()); |
465 |
column->add_attribute( |
column->add_attribute( |
466 |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
467 |
); |
); |
902 |
// load the instrument |
// load the instrument |
903 |
gig::File* pFile = (gig::File*) instr->GetParent(); |
gig::File* pFile = (gig::File*) instr->GetParent(); |
904 |
load_gig(pFile, 0 /*file name*/, true /*shared instrument*/); |
load_gig(pFile, 0 /*file name*/, true /*shared instrument*/); |
905 |
//TODO: automatically select the given instrument |
// automatically select the given instrument |
906 |
|
int i = 0; |
907 |
|
for (gig::Instrument* instrument = pFile->GetFirstInstrument(); instrument; |
908 |
|
instrument = pFile->GetNextInstrument(), ++i) |
909 |
|
{ |
910 |
|
if (instrument == instr) { |
911 |
|
// select item in "instruments" tree view |
912 |
|
m_TreeView.get_selection()->select(Gtk::TreePath(ToString(i))); |
913 |
|
// make sure the selected item in the "instruments" tree view is |
914 |
|
// visible (scroll to it) |
915 |
|
m_TreeView.scroll_to_row(Gtk::TreePath(ToString(i))); |
916 |
|
// select item in instrument menu |
917 |
|
{ |
918 |
|
const std::vector<Gtk::Widget*> children = |
919 |
|
instrument_menu->get_children(); |
920 |
|
static_cast<Gtk::RadioMenuItem*>(children[i])->set_active(); |
921 |
|
} |
922 |
|
// update region chooser and dimension region chooser |
923 |
|
m_RegionChooser.set_instrument(instr); |
924 |
|
break; |
925 |
|
} |
926 |
|
} |
927 |
} |
} |
928 |
|
|
929 |
void MainWindow::on_loader_progress() |
void MainWindow::on_loader_progress() |
2854 |
// just in case a new sample is added later with exactly the same memory |
// just in case a new sample is added later with exactly the same memory |
2855 |
// address, which would lead to incorrect refcount if not deleted here |
// address, which would lead to incorrect refcount if not deleted here |
2856 |
for (std::list<gig::Sample*>::const_iterator it = samples.begin(); |
for (std::list<gig::Sample*>::const_iterator it = samples.begin(); |
2857 |
it != samples.end(); it != samples.end()) |
it != samples.end(); ++it) |
2858 |
{ |
{ |
2859 |
sample_ref_count.erase(*it); |
sample_ref_count.erase(*it); |
2860 |
} |
} |