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 |
457 |
m_actionGroup->add_action_bool("Statusbar", sigc::mem_fun(*this, &MainWindow::on_action_view_status_bar), true); |
m_actionGroup->add_action_bool("Statusbar", sigc::mem_fun(*this, &MainWindow::on_action_view_status_bar), true); |
458 |
m_actionToggleRestoreWinDim = |
m_actionToggleRestoreWinDim = |
459 |
m_actionGroup->add_action_bool("AutoRestoreWinDim", sigc::mem_fun(*this, &MainWindow::on_auto_restore_win_dim), Settings::singleton()->autoRestoreWindowDimension); |
m_actionGroup->add_action_bool("AutoRestoreWinDim", sigc::mem_fun(*this, &MainWindow::on_auto_restore_win_dim), Settings::singleton()->autoRestoreWindowDimension); |
460 |
|
m_actionToggleShowTooltips = m_actionGroup->add_action_bool( |
461 |
|
"ShowTooltips", sigc::mem_fun(*this, &MainWindow::on_action_show_tooltips), |
462 |
|
Settings::singleton()->showTooltips |
463 |
|
); |
464 |
m_actionToggleSaveWithTempFile = |
m_actionToggleSaveWithTempFile = |
465 |
m_actionGroup->add_action_bool("SaveWithTemporaryFile", sigc::mem_fun(*this, &MainWindow::on_save_with_temporary_file), Settings::singleton()->saveWithTemporaryFile); |
m_actionGroup->add_action_bool("SaveWithTemporaryFile", sigc::mem_fun(*this, &MainWindow::on_save_with_temporary_file), Settings::singleton()->saveWithTemporaryFile); |
466 |
m_actionGroup->add_action("RefreshAll", sigc::mem_fun(*this, &MainWindow::on_action_refresh_all)); |
m_actionGroup->add_action("RefreshAll", sigc::mem_fun(*this, &MainWindow::on_action_refresh_all)); |
484 |
*this, &MainWindow::on_auto_restore_win_dim)); |
*this, &MainWindow::on_auto_restore_win_dim)); |
485 |
|
|
486 |
toggle_action = |
toggle_action = |
487 |
|
Gtk::ToggleAction::create("ShowTooltips", _("Tooltips for Beginners")); |
488 |
|
toggle_action->set_active(Settings::singleton()->showTooltips); |
489 |
|
actionGroup->add( |
490 |
|
toggle_action, |
491 |
|
sigc::mem_fun(*this, &MainWindow::on_action_show_tooltips) |
492 |
|
); |
493 |
|
|
494 |
|
toggle_action = |
495 |
Gtk::ToggleAction::create("SaveWithTemporaryFile", _("Save with _temporary file")); |
Gtk::ToggleAction::create("SaveWithTemporaryFile", _("Save with _temporary file")); |
496 |
toggle_action->set_active(Settings::singleton()->saveWithTemporaryFile); |
toggle_action->set_active(Settings::singleton()->saveWithTemporaryFile); |
497 |
actionGroup->add(toggle_action, |
actionGroup->add(toggle_action, |
933 |
" <attribute name='label' translatable='yes'>Statusbar</attribute>" |
" <attribute name='label' translatable='yes'>Statusbar</attribute>" |
934 |
" <attribute name='action'>AppMenu.Statusbar</attribute>" |
" <attribute name='action'>AppMenu.Statusbar</attribute>" |
935 |
" </item>" |
" </item>" |
936 |
|
" <item id='ShowTooltips'>" |
937 |
|
" <attribute name='label' translatable='yes'>Tooltips for Beginners</attribute>" |
938 |
|
" <attribute name='action'>AppMenu.ShowTooltips</attribute>" |
939 |
|
" </item>" |
940 |
" <item id='AutoRestoreWinDim'>" |
" <item id='AutoRestoreWinDim'>" |
941 |
" <attribute name='label' translatable='yes'>Auto restore Window Dimensions</attribute>" |
" <attribute name='label' translatable='yes'>Auto restore Window Dimensions</attribute>" |
942 |
" <attribute name='action'>AppMenu.AutoRestoreWinDim</attribute>" |
" <attribute name='action'>AppMenu.AutoRestoreWinDim</attribute>" |
1167 |
" </menu>" |
" </menu>" |
1168 |
" <menu action='MenuView'>" |
" <menu action='MenuView'>" |
1169 |
" <menuitem action='Statusbar'/>" |
" <menuitem action='Statusbar'/>" |
1170 |
|
" <menuitem action='ShowTooltips'/>" |
1171 |
" <menuitem action='AutoRestoreWinDim'/>" |
" <menuitem action='AutoRestoreWinDim'/>" |
1172 |
" <separator/>" |
" <separator/>" |
1173 |
" <menuitem action='RefreshAll'/>" |
" <menuitem action='RefreshAll'/>" |
1254 |
{ |
{ |
1255 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1256 |
uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop")); |
uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop")); |
1257 |
item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current loop informations to be altered by this action.")); |
item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current loop information to be altered by this action.")); |
1258 |
} |
} |
1259 |
{ |
{ |
1260 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1269 |
{ |
{ |
1270 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1271 |
uiManager->get_widget("/MenuBar/MenuSettings/MoveRootNoteWithRegionMoved")); |
uiManager->get_widget("/MenuBar/MenuSettings/MoveRootNoteWithRegionMoved")); |
1272 |
item->set_tooltip_text(_("If checked, and when a region is moved by dragging it around on the virtual keyboard, the keybord position dependent pitch will move exactly with the amount of semi tones the region was moved around.")); |
item->set_tooltip_text(_("If checked, and when a region is moved by dragging it around on the virtual keyboard, the keyboard position dependent pitch will move exactly with the amount of semi tones the region was moved around.")); |
1273 |
} |
} |
1274 |
{ |
{ |
1275 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
1356 |
m_TreeView.set_model(m_refTreeModelFilter); |
m_TreeView.set_model(m_refTreeModelFilter); |
1357 |
|
|
1358 |
m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); |
m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); |
1359 |
m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules. Drag & drop to change the order of instruments.")); |
m_TreeView.set_has_tooltip(true); |
1360 |
|
m_TreeView.signal_query_tooltip().connect( |
1361 |
|
sigc::mem_fun(*this, &MainWindow::onQueryTreeViewTooltip) |
1362 |
|
); |
1363 |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
1364 |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
1365 |
); |
); |
1516 |
sigc::hide( |
sigc::hide( |
1517 |
sigc::bind( |
sigc::bind( |
1518 |
file_structure_to_be_changed_signal.make_slot(), |
file_structure_to_be_changed_signal.make_slot(), |
1519 |
|
#if SIGCXX_MAJOR_VERSION > 2 || (SIGCXX_MAJOR_VERSION == 2 && SIGCXX_MINOR_VERSION >= 8) |
1520 |
|
std::ref(this->file) |
1521 |
|
#else |
1522 |
sigc::ref(this->file) |
sigc::ref(this->file) |
1523 |
|
#endif |
1524 |
) |
) |
1525 |
) |
) |
1526 |
); |
); |
1528 |
sigc::hide( |
sigc::hide( |
1529 |
sigc::bind( |
sigc::bind( |
1530 |
file_structure_changed_signal.make_slot(), |
file_structure_changed_signal.make_slot(), |
1531 |
|
#if SIGCXX_MAJOR_VERSION > 2 || (SIGCXX_MAJOR_VERSION == 2 && SIGCXX_MINOR_VERSION >= 8) |
1532 |
|
std::ref(this->file) |
1533 |
|
#else |
1534 |
sigc::ref(this->file) |
sigc::ref(this->file) |
1535 |
|
#endif |
1536 |
) |
) |
1537 |
) |
) |
1538 |
); |
); |
1554 |
sigc::mem_fun(*this, &MainWindow::update_dimregs)); |
sigc::mem_fun(*this, &MainWindow::update_dimregs)); |
1555 |
|
|
1556 |
m_searchText.signal_changed().connect( |
m_searchText.signal_changed().connect( |
1557 |
sigc::mem_fun(m_refTreeModelFilter.operator->(), &Gtk::TreeModelFilter::refilter) |
sigc::mem_fun(*m_refTreeModelFilter.operator->(), &Gtk::TreeModelFilter::refilter) |
1558 |
); |
); |
1559 |
|
|
1560 |
file = 0; |
file = 0; |
1608 |
Gtk::AccelMap::add_entry("<Macros>/macro_9", GDK_KEY_F10, noModifier); |
Gtk::AccelMap::add_entry("<Macros>/macro_9", GDK_KEY_F10, noModifier); |
1609 |
Gtk::AccelMap::add_entry("<Macros>/macro_10", GDK_KEY_F11, noModifier); |
Gtk::AccelMap::add_entry("<Macros>/macro_10", GDK_KEY_F11, noModifier); |
1610 |
Gtk::AccelMap::add_entry("<Macros>/macro_11", GDK_KEY_F12, noModifier); |
Gtk::AccelMap::add_entry("<Macros>/macro_11", GDK_KEY_F12, noModifier); |
1611 |
|
Gtk::AccelMap::add_entry("<Macros>/macro_12", GDK_KEY_F13, noModifier); |
1612 |
|
Gtk::AccelMap::add_entry("<Macros>/macro_13", GDK_KEY_F14, noModifier); |
1613 |
|
Gtk::AccelMap::add_entry("<Macros>/macro_14", GDK_KEY_F15, noModifier); |
1614 |
|
Gtk::AccelMap::add_entry("<Macros>/macro_15", GDK_KEY_F16, noModifier); |
1615 |
|
Gtk::AccelMap::add_entry("<Macros>/macro_16", GDK_KEY_F17, noModifier); |
1616 |
|
Gtk::AccelMap::add_entry("<Macros>/macro_17", GDK_KEY_F18, noModifier); |
1617 |
|
Gtk::AccelMap::add_entry("<Macros>/macro_18", GDK_KEY_F19, noModifier); |
1618 |
Gtk::AccelMap::add_entry("<Macros>/SetupMacros", 'm', primaryModifierKey); |
Gtk::AccelMap::add_entry("<Macros>/SetupMacros", 'm', primaryModifierKey); |
1619 |
|
|
1620 |
Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group(); |
Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group(); |
1637 |
Gtk::AccelMap::add_entry("<Scripts>/script_9", GDK_KEY_F10, Gdk::SHIFT_MASK); |
Gtk::AccelMap::add_entry("<Scripts>/script_9", GDK_KEY_F10, Gdk::SHIFT_MASK); |
1638 |
Gtk::AccelMap::add_entry("<Scripts>/script_10", GDK_KEY_F11, Gdk::SHIFT_MASK); |
Gtk::AccelMap::add_entry("<Scripts>/script_10", GDK_KEY_F11, Gdk::SHIFT_MASK); |
1639 |
Gtk::AccelMap::add_entry("<Scripts>/script_11", GDK_KEY_F12, Gdk::SHIFT_MASK); |
Gtk::AccelMap::add_entry("<Scripts>/script_11", GDK_KEY_F12, Gdk::SHIFT_MASK); |
1640 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_12", GDK_KEY_F13, Gdk::SHIFT_MASK); |
1641 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_13", GDK_KEY_F14, Gdk::SHIFT_MASK); |
1642 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_14", GDK_KEY_F15, Gdk::SHIFT_MASK); |
1643 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_15", GDK_KEY_F16, Gdk::SHIFT_MASK); |
1644 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_16", GDK_KEY_F17, Gdk::SHIFT_MASK); |
1645 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_17", GDK_KEY_F18, Gdk::SHIFT_MASK); |
1646 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_18", GDK_KEY_F19, Gdk::SHIFT_MASK); |
1647 |
|
Gtk::AccelMap::add_entry("<Scripts>/DropAllScriptSlots", GDK_KEY_BackSpace, Gdk::SHIFT_MASK); |
1648 |
|
|
1649 |
Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group(); |
Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group(); |
1650 |
assign_scripts_menu->set_accel_group(accelGroup); |
assign_scripts_menu->set_accel_group(accelGroup); |
1651 |
} |
} |
1652 |
|
|
1653 |
|
on_show_tooltips_changed(); |
1654 |
|
|
1655 |
Glib::signal_idle().connect_once( |
Glib::signal_idle().connect_once( |
1656 |
sigc::mem_fun(*this, &MainWindow::bringToFront), |
sigc::mem_fun(*this, &MainWindow::bringToFront), |
1657 |
200 |
200 |
2634 |
!Settings::singleton()->warnUserOnExtensions; |
!Settings::singleton()->warnUserOnExtensions; |
2635 |
} |
} |
2636 |
|
|
2637 |
|
void MainWindow::on_action_show_tooltips() { |
2638 |
|
Settings::singleton()->showTooltips = |
2639 |
|
!Settings::singleton()->showTooltips; |
2640 |
|
|
2641 |
|
on_show_tooltips_changed(); |
2642 |
|
} |
2643 |
|
|
2644 |
|
void MainWindow::on_show_tooltips_changed() { |
2645 |
|
const bool b = Settings::singleton()->showTooltips; |
2646 |
|
|
2647 |
|
dimreg_label.set_has_tooltip(b); |
2648 |
|
dimreg_all_regions.set_has_tooltip(b); |
2649 |
|
dimreg_all_dimregs.set_has_tooltip(b); |
2650 |
|
dimreg_stereo.set_has_tooltip(b); |
2651 |
|
|
2652 |
|
// Not doing this here, we let onQueryTreeViewTooltip() handle this per cell |
2653 |
|
//m_TreeView.set_has_tooltip(b); |
2654 |
|
|
2655 |
|
m_TreeViewSamples.set_has_tooltip(b); |
2656 |
|
m_TreeViewScripts.set_has_tooltip(b); |
2657 |
|
|
2658 |
|
set_has_tooltip(b); |
2659 |
|
} |
2660 |
|
|
2661 |
void MainWindow::on_action_sync_sampler_instrument_selection() { |
void MainWindow::on_action_sync_sampler_instrument_selection() { |
2662 |
Settings::singleton()->syncSamplerInstrumentSelection = |
Settings::singleton()->syncSamplerInstrumentSelection = |
2663 |
!Settings::singleton()->syncSamplerInstrumentSelection; |
!Settings::singleton()->syncSamplerInstrumentSelection; |
2677 |
dialog.set_name("Gigedit"); |
dialog.set_name("Gigedit"); |
2678 |
#endif |
#endif |
2679 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
2680 |
dialog.set_copyright("Copyright (C) 2006-2017 Andreas Persson"); |
dialog.set_copyright("Copyright (C) 2006-2019 Andreas Persson"); |
2681 |
const std::string sComment = |
const std::string sComment = |
2682 |
_("Built " __DATE__ "\nUsing ") + |
_("Built " __DATE__ "\nUsing ") + |
2683 |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
2773 |
#endif |
#endif |
2774 |
|
|
2775 |
add(vbox); |
add(vbox); |
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 |
table.set_margin(5); |
table.set_margin(5); |
2778 |
#else |
#else |
2779 |
table.set_border_width(5); |
table.set_border_width(5); |
2781 |
vbox.add(table); |
vbox.add(table); |
2782 |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
2783 |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
2784 |
#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) |
2785 |
buttonBox.set_margin(5); |
buttonBox.set_margin(5); |
2786 |
#else |
#else |
2787 |
buttonBox.set_border_width(5); |
buttonBox.set_border_width(5); |
2812 |
std::vector<std::string> txts; |
std::vector<std::string> txts; |
2813 |
std::vector<int> values; |
std::vector<int> values; |
2814 |
txts.push_back(sGiga + "2"); values.push_back(2); |
txts.push_back(sGiga + "2"); values.push_back(2); |
2815 |
txts.push_back(sGiga + "3/v4"); values.push_back(3); |
txts.push_back(sGiga + "3"); values.push_back(3); |
2816 |
if (major != 2 && major != 3) { |
txts.push_back(sGiga + "4"); values.push_back(4); |
2817 |
|
if (major < 2 || major > 4) { |
2818 |
txts.push_back(sGiga + ToString(major)); values.push_back(major); |
txts.push_back(sGiga + ToString(major)); values.push_back(major); |
2819 |
} |
} |
2820 |
std::vector<const char*> texts; |
std::vector<const char*> texts; |
2933 |
table.add(eDimensionKeyRangeHigh); |
table.add(eDimensionKeyRangeHigh); |
2934 |
|
|
2935 |
add(vbox); |
add(vbox); |
2936 |
#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) |
2937 |
table.set_margin(5); |
table.set_margin(5); |
2938 |
#else |
#else |
2939 |
table.set_border_width(5); |
table.set_border_width(5); |
2942 |
table.show(); |
table.show(); |
2943 |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
vbox.pack_start(buttonBox, Gtk::PACK_SHRINK); |
2944 |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
buttonBox.set_layout(Gtk::BUTTONBOX_END); |
2945 |
#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) |
2946 |
buttonBox.set_margin(5); |
buttonBox.set_margin(5); |
2947 |
#else |
#else |
2948 |
buttonBox.set_border_width(5); |
buttonBox.set_border_width(5); |
3004 |
} |
} |
3005 |
} |
} |
3006 |
|
|
3007 |
|
bool MainWindow::onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip) { |
3008 |
|
Gtk::TreeModel::iterator iter; |
3009 |
|
if (!m_TreeView.get_tooltip_context_iter(x, y, keyboardTip, iter)) { |
3010 |
|
return false; |
3011 |
|
} |
3012 |
|
Gtk::TreeModel::Path path(iter); |
3013 |
|
Gtk::TreeModel::Row row = *iter; |
3014 |
|
Gtk::TreeViewColumn* pointedColumn = NULL; |
3015 |
|
// resolve the precise table column the mouse points to |
3016 |
|
{ |
3017 |
|
Gtk::TreeModel::Path path; // unused |
3018 |
|
int cellX, cellY; // unused |
3019 |
|
m_TreeView.get_path_at_pos(x, y, path, pointedColumn, cellX, cellY); |
3020 |
|
} |
3021 |
|
Gtk::TreeViewColumn* scriptsColumn = m_TreeView.get_column(2); |
3022 |
|
if (pointedColumn == scriptsColumn) { // mouse hovers scripts column ... |
3023 |
|
// show the script(s) assigned to the hovered instrument as tooltip |
3024 |
|
tooltip->set_markup( row[m_Columns.m_col_tooltip] ); |
3025 |
|
m_TreeView.set_tooltip_cell(tooltip, &path, scriptsColumn, NULL); |
3026 |
|
} else { |
3027 |
|
// if beginners' tooltips is disabled then don't show the following one |
3028 |
|
if (!Settings::singleton()->showTooltips) |
3029 |
|
return false; |
3030 |
|
// yeah, a beginners tooltip |
3031 |
|
tooltip->set_text(_( |
3032 |
|
"Right click here for actions on instruments & MIDI Rules. " |
3033 |
|
"Drag & drop to change the order of instruments." |
3034 |
|
)); |
3035 |
|
m_TreeView.set_tooltip_cell(tooltip, &path, pointedColumn, NULL); |
3036 |
|
} |
3037 |
|
return true; |
3038 |
|
} |
3039 |
|
|
3040 |
|
static Glib::ustring scriptTooltipFor(gig::Instrument* instrument, int index) { |
3041 |
|
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
3042 |
|
const int iScriptSlots = instrument->ScriptSlotCount(); |
3043 |
|
Glib::ustring tooltip = "<u>(" + ToString(index) + ") “" + name + "”</u>\n\n"; |
3044 |
|
if (!iScriptSlots) |
3045 |
|
tooltip += "<span foreground='red'><i>No script assigned</i></span>"; |
3046 |
|
else { |
3047 |
|
for (int i = 0; i < iScriptSlots; ++i) { |
3048 |
|
tooltip += "• " + ToString(i+1) + ". Script: “<span foreground='#46DEFF'><b>" + |
3049 |
|
instrument->GetScriptOfSlot(i)->Name + "</b></span>”"; |
3050 |
|
if (i + 1 < iScriptSlots) tooltip += "\n\n"; |
3051 |
|
} |
3052 |
|
} |
3053 |
|
return tooltip; |
3054 |
|
} |
3055 |
|
|
3056 |
void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument) |
void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument) |
3057 |
{ |
{ |
3058 |
file = 0; |
file = 0; |
3082 |
row[m_Columns.m_col_name] = name; |
row[m_Columns.m_col_name] = name; |
3083 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
3084 |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
3085 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3086 |
|
|
3087 |
#if !USE_GTKMM_BUILDER |
#if !USE_GTKMM_BUILDER |
3088 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
3200 |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
3201 |
Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name)); |
Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name)); |
3202 |
if (gigname != name) { |
if (gigname != name) { |
3203 |
|
Gtk::TreeModel::Path path(*it); |
3204 |
|
const int index = path[0]; |
3205 |
row[m_Columns.m_col_name] = gigname; |
row[m_Columns.m_col_name] = gigname; |
3206 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3207 |
} |
} |
3208 |
} |
} |
3209 |
|
|
3249 |
Gtk::TreeModel::Row row = model->children()[i]; |
Gtk::TreeModel::Row row = model->children()[i]; |
3250 |
if (row[m_Columns.m_col_instr] != pInstrument) continue; |
if (row[m_Columns.m_col_instr] != pInstrument) continue; |
3251 |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
3252 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(pInstrument, i); |
3253 |
break; |
break; |
3254 |
} |
} |
3255 |
|
|
3275 |
onScriptSlotsModified(pInstrument); |
onScriptSlotsModified(pInstrument); |
3276 |
} |
} |
3277 |
|
|
3278 |
|
void MainWindow::dropAllScriptSlots() { |
3279 |
|
gig::Instrument* pInstrument = get_instrument(); |
3280 |
|
if (!pInstrument) { |
3281 |
|
printf("!instrument\n"); |
3282 |
|
return; |
3283 |
|
} |
3284 |
|
|
3285 |
|
const int iScriptSlots = pInstrument->ScriptSlotCount(); |
3286 |
|
for (int i = iScriptSlots - 1; i >= 0; --i) |
3287 |
|
pInstrument->RemoveScriptSlot(i); |
3288 |
|
|
3289 |
|
onScriptSlotsModified(pInstrument); |
3290 |
|
} |
3291 |
|
|
3292 |
void MainWindow::on_action_refresh_all() { |
void MainWindow::on_action_refresh_all() { |
3293 |
__refreshEntireGUI(); |
__refreshEntireGUI(); |
3294 |
} |
} |
3463 |
show_intruments_tab(); |
show_intruments_tab(); |
3464 |
m_TreeView.get_selection()->unselect_all(); |
m_TreeView.get_selection()->unselect_all(); |
3465 |
|
|
3466 |
#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) |
3467 |
auto iterSel = model->children()[i].get_iter(); |
auto iterSel = model->children()[i].get_iter(); |
3468 |
m_TreeView.get_selection()->select(iterSel); |
m_TreeView.get_selection()->select(iterSel); |
3469 |
#else |
#else |
3493 |
// select and show the respective instrument in the list view |
// select and show the respective instrument in the list view |
3494 |
show_intruments_tab(); |
show_intruments_tab(); |
3495 |
m_TreeView.get_selection()->unselect_all(); |
m_TreeView.get_selection()->unselect_all(); |
3496 |
#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) |
3497 |
auto iterSel = model->children()[i].get_iter(); |
auto iterSel = model->children()[i].get_iter(); |
3498 |
m_TreeView.get_selection()->select(iterSel); |
m_TreeView.get_selection()->select(iterSel); |
3499 |
#else |
#else |
3529 |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
if (rowSample[m_SamplesModel.m_col_sample] == sample) { |
3530 |
show_samples_tab(); |
show_samples_tab(); |
3531 |
m_TreeViewSamples.get_selection()->unselect_all(); |
m_TreeViewSamples.get_selection()->unselect_all(); |
3532 |
#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) |
3533 |
auto iterSel = rowGroup.children()[s].get_iter(); |
auto iterSel = rowGroup.children()[s].get_iter(); |
3534 |
m_TreeViewSamples.get_selection()->select(iterSel); |
m_TreeViewSamples.get_selection()->select(iterSel); |
3535 |
#else |
#else |
3729 |
assign_scripts_menu->append(*item); |
assign_scripts_menu->append(*item); |
3730 |
} |
} |
3731 |
|
|
3732 |
|
// add separator line to menu |
3733 |
|
assign_scripts_menu->append(*new Gtk::SeparatorMenuItem); |
3734 |
|
|
3735 |
|
{ |
3736 |
|
Gtk::MenuItem* item = new Gtk::MenuItem(_("Unassign All Scripts")); |
3737 |
|
item->signal_activate().connect( |
3738 |
|
sigc::mem_fun(*this, &MainWindow::dropAllScriptSlots) |
3739 |
|
); |
3740 |
|
assign_scripts_menu->append(*item); |
3741 |
|
item->set_accel_path("<Scripts>/DropAllScriptSlots"); |
3742 |
|
} |
3743 |
|
|
3744 |
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
3745 |
assign_scripts_menu->show_all_children(); |
assign_scripts_menu->show_all_children(); |
3746 |
#endif |
#endif |
3789 |
instrument_name_connection.block(); |
instrument_name_connection.block(); |
3790 |
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
3791 |
Gtk::TreeModel::Row rowInstr = *iterInstr; |
Gtk::TreeModel::Row rowInstr = *iterInstr; |
3792 |
rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; |
const int index = m_refTreeModel->children().size() - 1; |
3793 |
|
rowInstr[m_Columns.m_col_nr] = index; |
3794 |
rowInstr[m_Columns.m_col_name] = name; |
rowInstr[m_Columns.m_col_name] = name; |
3795 |
rowInstr[m_Columns.m_col_instr] = instrument; |
rowInstr[m_Columns.m_col_instr] = instrument; |
3796 |
rowInstr[m_Columns.m_col_scripts] = ""; |
rowInstr[m_Columns.m_col_scripts] = ""; |
3797 |
|
rowInstr[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3798 |
instrument_name_connection.unblock(); |
instrument_name_connection.unblock(); |
3799 |
|
|
3800 |
#if !USE_GTKMM_BUILDER |
#if !USE_GTKMM_BUILDER |
3881 |
it != m_refTreeModel->children().end(); ++it, ++index) |
it != m_refTreeModel->children().end(); ++it, ++index) |
3882 |
{ |
{ |
3883 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
3884 |
|
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
3885 |
row[m_Columns.m_col_nr] = index; |
row[m_Columns.m_col_nr] = index; |
3886 |
|
row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index); |
3887 |
} |
} |
3888 |
} |
} |
3889 |
|
|
4142 |
for (std::vector<std::string>::iterator iter = filenames.begin(); |
for (std::vector<std::string>::iterator iter = filenames.begin(); |
4143 |
iter != filenames.end(); ++iter) { |
iter != filenames.end(); ++iter) { |
4144 |
printf("Adding sample %s\n",(*iter).c_str()); |
printf("Adding sample %s\n",(*iter).c_str()); |
4145 |
// use libsndfile to retrieve file informations |
// use libsndfile to retrieve file information |
4146 |
SF_INFO info; |
SF_INFO info; |
4147 |
info.format = 0; |
info.format = 0; |
4148 |
SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info); |
SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info); |
4804 |
trim(pattern); |
trim(pattern); |
4805 |
if (pattern.empty()) return true; |
if (pattern.empty()) return true; |
4806 |
|
|
4807 |
#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) |
4808 |
//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. |
4809 |
Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter); |
Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter); |
4810 |
#else |
#else |