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 |
1636 |
Gtk::AccelMap::add_entry("<Scripts>/script_16", GDK_KEY_F17, Gdk::SHIFT_MASK); |
Gtk::AccelMap::add_entry("<Scripts>/script_16", GDK_KEY_F17, Gdk::SHIFT_MASK); |
1637 |
Gtk::AccelMap::add_entry("<Scripts>/script_17", GDK_KEY_F18, Gdk::SHIFT_MASK); |
Gtk::AccelMap::add_entry("<Scripts>/script_17", GDK_KEY_F18, Gdk::SHIFT_MASK); |
1638 |
Gtk::AccelMap::add_entry("<Scripts>/script_18", GDK_KEY_F19, Gdk::SHIFT_MASK); |
Gtk::AccelMap::add_entry("<Scripts>/script_18", GDK_KEY_F19, Gdk::SHIFT_MASK); |
1639 |
|
Gtk::AccelMap::add_entry("<Scripts>/DropAllScriptSlots", GDK_KEY_BackSpace, Gdk::SHIFT_MASK); |
1640 |
|
|
1641 |
Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group(); |
Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group(); |
1642 |
assign_scripts_menu->set_accel_group(accelGroup); |
assign_scripts_menu->set_accel_group(accelGroup); |
2669 |
dialog.set_name("Gigedit"); |
dialog.set_name("Gigedit"); |
2670 |
#endif |
#endif |
2671 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
2672 |
dialog.set_copyright("Copyright (C) 2006-2017 Andreas Persson"); |
dialog.set_copyright("Copyright (C) 2006-2019 Andreas Persson"); |
2673 |
const std::string sComment = |
const std::string sComment = |
2674 |
_("Built " __DATE__ "\nUsing ") + |
_("Built " __DATE__ "\nUsing ") + |
2675 |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
2765 |
#endif |
#endif |
2766 |
|
|
2767 |
add(vbox); |
add(vbox); |
2768 |
#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) |
2769 |
table.set_margin(5); |
table.set_margin(5); |
2770 |
#else |
#else |
2771 |
table.set_border_width(5); |
table.set_border_width(5); |
2773 |
vbox.add(table); |
vbox.add(table); |
2774 |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
2775 |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
2776 |
#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) |
2777 |
buttonBox.set_margin(5); |
buttonBox.set_margin(5); |
2778 |
#else |
#else |
2779 |
buttonBox.set_border_width(5); |
buttonBox.set_border_width(5); |
2804 |
std::vector<std::string> txts; |
std::vector<std::string> txts; |
2805 |
std::vector<int> values; |
std::vector<int> values; |
2806 |
txts.push_back(sGiga + "2"); values.push_back(2); |
txts.push_back(sGiga + "2"); values.push_back(2); |
2807 |
txts.push_back(sGiga + "3/v4"); values.push_back(3); |
txts.push_back(sGiga + "3"); values.push_back(3); |
2808 |
if (major != 2 && major != 3) { |
txts.push_back(sGiga + "4"); values.push_back(4); |
2809 |
|
if (major < 2 || major > 4) { |
2810 |
txts.push_back(sGiga + ToString(major)); values.push_back(major); |
txts.push_back(sGiga + ToString(major)); values.push_back(major); |
2811 |
} |
} |
2812 |
std::vector<const char*> texts; |
std::vector<const char*> texts; |
2925 |
table.add(eDimensionKeyRangeHigh); |
table.add(eDimensionKeyRangeHigh); |
2926 |
|
|
2927 |
add(vbox); |
add(vbox); |
2928 |
#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) |
2929 |
table.set_margin(5); |
table.set_margin(5); |
2930 |
#else |
#else |
2931 |
table.set_border_width(5); |
table.set_border_width(5); |
2934 |
table.show(); |
table.show(); |
2935 |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
2936 |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
2937 |
#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) |
2938 |
buttonBox.set_margin(5); |
buttonBox.set_margin(5); |
2939 |
#else |
#else |
2940 |
buttonBox.set_border_width(5); |
buttonBox.set_border_width(5); |
3265 |
onScriptSlotsModified(pInstrument); |
onScriptSlotsModified(pInstrument); |
3266 |
} |
} |
3267 |
|
|
3268 |
|
void MainWindow::dropAllScriptSlots() { |
3269 |
|
gig::Instrument* pInstrument = get_instrument(); |
3270 |
|
if (!pInstrument) { |
3271 |
|
printf("!instrument\n"); |
3272 |
|
return; |
3273 |
|
} |
3274 |
|
|
3275 |
|
const int iScriptSlots = pInstrument->ScriptSlotCount(); |
3276 |
|
for (int i = iScriptSlots - 1; i >= 0; --i) |
3277 |
|
pInstrument->RemoveScriptSlot(i); |
3278 |
|
|
3279 |
|
onScriptSlotsModified(pInstrument); |
3280 |
|
} |
3281 |
|
|
3282 |
void MainWindow::on_action_refresh_all() { |
void MainWindow::on_action_refresh_all() { |
3283 |
__refreshEntireGUI(); |
__refreshEntireGUI(); |
3284 |
} |
} |
3453 |
show_intruments_tab(); |
show_intruments_tab(); |
3454 |
m_TreeView.get_selection()->unselect_all(); |
m_TreeView.get_selection()->unselect_all(); |
3455 |
|
|
3456 |
#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) |
3457 |
auto iterSel = model->children()[i].get_iter(); |
auto iterSel = model->children()[i].get_iter(); |
3458 |
m_TreeView.get_selection()->select(iterSel); |
m_TreeView.get_selection()->select(iterSel); |
3459 |
#else |
#else |
3483 |
// select and show the respective instrument in the list view |
// select and show the respective instrument in the list view |
3484 |
show_intruments_tab(); |
show_intruments_tab(); |
3485 |
m_TreeView.get_selection()->unselect_all(); |
m_TreeView.get_selection()->unselect_all(); |
3486 |
#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) |
3487 |
auto iterSel = model->children()[i].get_iter(); |
auto iterSel = model->children()[i].get_iter(); |
3488 |
m_TreeView.get_selection()->select(iterSel); |
m_TreeView.get_selection()->select(iterSel); |
3489 |
#else |
#else |
3519 |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
3520 |
show_samples_tab(); |
show_samples_tab(); |
3521 |
m_TreeViewSamples.get_selection()->unselect_all(); |
m_TreeViewSamples.get_selection()->unselect_all(); |
3522 |
#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) |
3523 |
auto iterSel = rowGroup.children()[s].get_iter(); |
auto iterSel = rowGroup.children()[s].get_iter(); |
3524 |
m_TreeViewSamples.get_selection()->select(iterSel); |
m_TreeViewSamples.get_selection()->select(iterSel); |
3525 |
#else |
#else |
3719 |
assign_scripts_menu->append(*item); |
assign_scripts_menu->append(*item); |
3720 |
} |
} |
3721 |
|
|
3722 |
|
// add separator line to menu |
3723 |
|
assign_scripts_menu->append(*new Gtk::SeparatorMenuItem); |
3724 |
|
|
3725 |
|
{ |
3726 |
|
Gtk::MenuItem* item = new Gtk::MenuItem(_("Unassign All Scripts")); |
3727 |
|
item->signal_activate().connect( |
3728 |
|
sigc::mem_fun(*this, &MainWindow::dropAllScriptSlots) |
3729 |
|
); |
3730 |
|
assign_scripts_menu->append(*item); |
3731 |
|
item->set_accel_path("<Scripts>/DropAllScriptSlots"); |
3732 |
|
} |
3733 |
|
|
3734 |
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
3735 |
assign_scripts_menu->show_all_children(); |
assign_scripts_menu->show_all_children(); |
3736 |
#endif |
#endif |
4794 |
trim(pattern); |
trim(pattern); |
4795 |
if (pattern.empty()) return true; |
if (pattern.empty()) return true; |
4796 |
|
|
4797 |
#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) |
4798 |
//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. |
4799 |
Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter); |
Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter); |
4800 |
#else |
#else |