31 |
|
|
32 |
#define _(String) gettext(String) |
#define _(String) gettext(String) |
33 |
|
|
|
|
|
34 |
bool update_gui; |
bool update_gui; |
35 |
|
|
36 |
uint8_t& access_UnityNote(gig::DimensionRegion* dimreg) |
uint8_t& access_UnityNote(gig::DimensionRegion* dimreg) |
523 |
m_TreeView.signal_button_press_event().connect_notify( |
m_TreeView.signal_button_press_event().connect_notify( |
524 |
sigc::mem_fun(*this, &MainWindow::on_button_release)); |
sigc::mem_fun(*this, &MainWindow::on_button_release)); |
525 |
|
|
526 |
// Add the TreeView, inside a ScrolledWindow, with the button underneath: |
// Add the TreeView tab, inside a ScrolledWindow, with the button underneath: |
527 |
m_ScrolledWindow.add(m_TreeView); |
m_ScrolledWindow.add(m_TreeViewNotebook); |
528 |
m_ScrolledWindow.set_size_request(400, 600); |
m_ScrolledWindow.set_size_request(400, 600); |
529 |
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
530 |
|
|
783 |
m_HPaned.add2(m_Notebook); |
m_HPaned.add2(m_Notebook); |
784 |
|
|
785 |
|
|
786 |
|
m_TreeViewNotebook.append_page(m_TreeViewSamples, "Samples"); |
787 |
|
m_TreeViewNotebook.append_page(m_TreeView, "Instruments"); |
788 |
|
|
789 |
|
|
790 |
actionGroup = Gtk::ActionGroup::create(); |
actionGroup = Gtk::ActionGroup::create(); |
791 |
|
|
792 |
actionGroup->add(Gtk::Action::create("MenuFile", _("_File"))); |
actionGroup->add(Gtk::Action::create("MenuFile", _("_File"))); |
820 |
actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT), |
actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT), |
821 |
sigc::mem_fun( |
sigc::mem_fun( |
822 |
*this, &MainWindow::hide)); |
*this, &MainWindow::hide)); |
823 |
|
actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument"))); |
824 |
|
|
825 |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
826 |
actionGroup->add(Gtk::Action::create("MenuHelp", |
actionGroup->add(Gtk::Action::create("MenuHelp", |
827 |
action->property_label())); |
action->property_label())); |
853 |
" <separator/>" |
" <separator/>" |
854 |
" <menuitem action='Quit'/>" |
" <menuitem action='Quit'/>" |
855 |
" </menu>" |
" </menu>" |
856 |
|
" <menu action='MenuInstrument'>" |
857 |
|
" </menu>" |
858 |
#ifdef ABOUT_DIALOG |
#ifdef ABOUT_DIALOG |
859 |
" <menu action='MenuHelp'>" |
" <menu action='MenuHelp'>" |
860 |
" <menuitem action='About'/>" |
" <menuitem action='About'/>" |
890 |
m_TreeView.append_column("Instrument", m_Columns.m_col_name); |
m_TreeView.append_column("Instrument", m_Columns.m_col_name); |
891 |
m_TreeView.set_headers_visible(false); |
m_TreeView.set_headers_visible(false); |
892 |
|
|
893 |
|
// create samples treeview (including its data model) |
894 |
|
m_refSamplesTreeModel = Gtk::TreeStore::create(m_SamplesModel); |
895 |
|
m_TreeViewSamples.set_model(m_refSamplesTreeModel); |
896 |
|
m_TreeViewSamples.append_column("Samples", m_SamplesModel.m_col_name); |
897 |
|
m_TreeViewSamples.set_headers_visible(false); |
898 |
|
|
899 |
file = 0; |
file = 0; |
900 |
|
|
901 |
show_all_children(); |
show_all_children(); |
1255 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
1256 |
printf("filename=%s\n", dialog.get_filename().c_str()); |
printf("filename=%s\n", dialog.get_filename().c_str()); |
1257 |
|
|
1258 |
|
// remove all entries from "Instrument" menu |
1259 |
|
Gtk::MenuItem* instrument_menu = |
1260 |
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuInstrument")); |
1261 |
|
instrument_menu->hide(); |
1262 |
|
for (int i = 0; i < instrument_menu->get_submenu()->items().size(); i++) { |
1263 |
|
delete &instrument_menu->get_submenu()->items()[i]; |
1264 |
|
} |
1265 |
|
instrument_menu->get_submenu()->items().clear(); |
1266 |
|
|
1267 |
m_refTreeModel->clear(); |
m_refTreeModel->clear(); |
1268 |
|
m_refSamplesTreeModel->clear(); |
1269 |
if (file) delete file; |
if (file) delete file; |
1270 |
|
|
1271 |
// getInfo(dialog.get_filename().c_str(), *this); |
// getInfo(dialog.get_filename().c_str(), *this); |
1497 |
|
|
1498 |
propDialog.set_info(gig->pInfo); |
propDialog.set_info(gig->pInfo); |
1499 |
|
|
1500 |
|
Gtk::MenuItem* instrument_menu = |
1501 |
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuInstrument")); |
1502 |
|
|
1503 |
|
int instrument_index = 0; |
1504 |
|
Gtk::RadioMenuItem::Group instrument_group; |
1505 |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
1506 |
instrument = gig->GetNextInstrument()) { |
instrument = gig->GetNextInstrument()) { |
1507 |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
1508 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
1509 |
row[m_Columns.m_col_name] = instrument->pInfo->Name.c_str(); |
row[m_Columns.m_col_name] = instrument->pInfo->Name.c_str(); |
1510 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
1511 |
|
// create a menu item for this instrument |
1512 |
|
Gtk::RadioMenuItem* item= new Gtk::RadioMenuItem(instrument_group, instrument->pInfo->Name.c_str()); |
1513 |
|
instrument_menu->get_submenu()->append(*item); |
1514 |
|
item->signal_activate().connect( |
1515 |
|
sigc::bind( |
1516 |
|
sigc::mem_fun(*this, &MainWindow::on_instrument_selection_change), |
1517 |
|
instrument_index |
1518 |
|
) |
1519 |
|
); |
1520 |
|
instrument_index++; |
1521 |
|
} |
1522 |
|
instrument_menu->show(); |
1523 |
|
instrument_menu->get_submenu()->show_all_children(); |
1524 |
|
|
1525 |
|
for (gig::Group* group = gig->GetFirstGroup(); group; group = gig->GetNextGroup()) { |
1526 |
|
Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append(); |
1527 |
|
Gtk::TreeModel::Row rowGroup = *iterGroup; |
1528 |
|
rowGroup[m_SamplesModel.m_col_name] = group->Name.c_str(); |
1529 |
|
rowGroup[m_SamplesModel.m_col_sample] = group; |
1530 |
|
for (gig::Sample* sample = group->GetFirstSample(); sample; sample = group->GetNextSample()) { |
1531 |
|
Gtk::TreeModel::iterator iterSample = m_refSamplesTreeModel->append(rowGroup.children()); |
1532 |
|
Gtk::TreeModel::Row rowSample = *iterSample; |
1533 |
|
rowSample[m_SamplesModel.m_col_name] = sample->pInfo->Name.c_str(); |
1534 |
|
rowSample[m_SamplesModel.m_col_sample] = sample; |
1535 |
|
} |
1536 |
} |
} |
1537 |
} |
} |
1538 |
|
|
1555 |
popup_menu->popup(button->button, button->time); |
popup_menu->popup(button->button, button->time); |
1556 |
} |
} |
1557 |
} |
} |
1558 |
|
|
1559 |
|
void MainWindow::on_instrument_selection_change(int index) { |
1560 |
|
m_RegionChooser.set_instrument(file->GetInstrument(index)); |
1561 |
|
} |