62 |
#include "gfx/builtinpix.h" |
#include "gfx/builtinpix.h" |
63 |
#include "MacroEditor.h" |
#include "MacroEditor.h" |
64 |
#include "MacrosSetup.h" |
#include "MacrosSetup.h" |
65 |
|
#if defined(__APPLE__) |
66 |
|
# include "MacHelper.h" |
67 |
|
#endif |
68 |
|
|
69 |
|
static const Gdk::ModifierType primaryModifierKey = |
70 |
|
#if defined(__APPLE__) |
71 |
|
Gdk::META_MASK; // Cmd key on Mac |
72 |
|
#else |
73 |
|
Gdk::CONTROL_MASK; // Ctrl key on all other OSs |
74 |
|
#endif |
75 |
|
|
76 |
MainWindow::MainWindow() : |
MainWindow::MainWindow() : |
77 |
m_DimRegionChooser(*this), |
m_DimRegionChooser(*this), |
87 |
{ |
{ |
88 |
loadBuiltInPix(); |
loadBuiltInPix(); |
89 |
|
|
90 |
|
this->file = NULL; |
91 |
|
|
92 |
// set_border_width(5); |
// set_border_width(5); |
93 |
// set_default_size(400, 200); |
|
94 |
|
if (!Settings::singleton()->autoRestoreWindowDimension) { |
95 |
|
set_default_size(800, 600); |
96 |
|
set_position(Gtk::WIN_POS_CENTER); |
97 |
|
} |
98 |
|
|
99 |
add(m_VBox); |
add(m_VBox); |
100 |
|
|
223 |
sigc::mem_fun(*this, &MainWindow::show_scripts_tab) |
sigc::mem_fun(*this, &MainWindow::show_scripts_tab) |
224 |
); |
); |
225 |
actionGroup->add(Gtk::Action::create("AllInstruments", _("_Select"))); |
actionGroup->add(Gtk::Action::create("AllInstruments", _("_Select"))); |
226 |
|
actionGroup->add(Gtk::Action::create("AssignScripts", _("Assign Script"))); |
227 |
|
|
228 |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
229 |
|
|
249 |
Gtk::AccelKey(GDK_KEY_x, Gdk::MOD1_MASK), |
Gtk::AccelKey(GDK_KEY_x, Gdk::MOD1_MASK), |
250 |
sigc::mem_fun(*this, &MainWindow::adjust_clipboard_content)); |
sigc::mem_fun(*this, &MainWindow::adjust_clipboard_content)); |
251 |
|
|
252 |
|
actionGroup->add(Gtk::Action::create("SelectPrevInstr", |
253 |
|
_("Select Previous Instrument")), |
254 |
|
Gtk::AccelKey(GDK_KEY_Up, primaryModifierKey), |
255 |
|
sigc::mem_fun(*this, &MainWindow::select_prev_instrument)); |
256 |
|
|
257 |
|
actionGroup->add(Gtk::Action::create("SelectNextInstr", |
258 |
|
_("Select Next Instrument")), |
259 |
|
Gtk::AccelKey(GDK_KEY_Down, primaryModifierKey), |
260 |
|
sigc::mem_fun(*this, &MainWindow::select_next_instrument)); |
261 |
|
|
262 |
actionGroup->add(Gtk::Action::create("SelectPrevRegion", |
actionGroup->add(Gtk::Action::create("SelectPrevRegion", |
263 |
_("Select Previous Region")), |
_("Select Previous Region")), |
264 |
Gtk::AccelKey(GDK_KEY_Left, primaryModifierKey), |
Gtk::AccelKey(GDK_KEY_Left, primaryModifierKey), |
360 |
sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument) |
361 |
); |
); |
362 |
actionGroup->add( |
actionGroup->add( |
363 |
|
Gtk::Action::create("CombInstruments", _("_Combine Instruments ...")), |
364 |
|
Gtk::AccelKey(GDK_KEY_j, primaryModifierKey), |
365 |
|
sigc::mem_fun(*this, &MainWindow::on_action_combine_instruments) |
366 |
|
); |
367 |
|
actionGroup->add( |
368 |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
369 |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
370 |
); |
); |
487 |
" <menuitem action='AdjustClipboard'/>" |
" <menuitem action='AdjustClipboard'/>" |
488 |
" <menuitem action='PasteDimRgn'/>" |
" <menuitem action='PasteDimRgn'/>" |
489 |
" <separator/>" |
" <separator/>" |
490 |
|
" <menuitem action='SelectPrevInstr'/>" |
491 |
|
" <menuitem action='SelectNextInstr'/>" |
492 |
|
" <separator/>" |
493 |
" <menuitem action='SelectPrevRegion'/>" |
" <menuitem action='SelectPrevRegion'/>" |
494 |
" <menuitem action='SelectNextRegion'/>" |
" <menuitem action='SelectNextRegion'/>" |
495 |
" <separator/>" |
" <separator/>" |
524 |
" <menuitem action='InstrProperties'/>" |
" <menuitem action='InstrProperties'/>" |
525 |
" <menuitem action='MidiRules'/>" |
" <menuitem action='MidiRules'/>" |
526 |
" <menuitem action='ScriptSlots'/>" |
" <menuitem action='ScriptSlots'/>" |
527 |
|
" <menu action='AssignScripts'/>" |
528 |
" <menuitem action='AddInstrument'/>" |
" <menuitem action='AddInstrument'/>" |
529 |
" <menuitem action='DupInstrument'/>" |
" <menuitem action='DupInstrument'/>" |
530 |
|
" <menuitem action='CombInstruments'/>" |
531 |
" <separator/>" |
" <separator/>" |
532 |
" <menuitem action='RemoveInstrument'/>" |
" <menuitem action='RemoveInstrument'/>" |
533 |
" </menu>" |
" </menu>" |
564 |
" <menuitem action='ScriptSlots'/>" |
" <menuitem action='ScriptSlots'/>" |
565 |
" <menuitem action='AddInstrument'/>" |
" <menuitem action='AddInstrument'/>" |
566 |
" <menuitem action='DupInstrument'/>" |
" <menuitem action='DupInstrument'/>" |
567 |
|
" <menuitem action='CombInstruments'/>" |
568 |
" <separator/>" |
" <separator/>" |
569 |
" <menuitem action='RemoveInstrument'/>" |
" <menuitem action='RemoveInstrument'/>" |
570 |
" </popup>" |
" </popup>" |
659 |
instrument_menu = static_cast<Gtk::MenuItem*>( |
instrument_menu = static_cast<Gtk::MenuItem*>( |
660 |
uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments"))->get_submenu(); |
uiManager->get_widget("/MenuBar/MenuInstrument/AllInstruments"))->get_submenu(); |
661 |
|
|
662 |
|
assign_scripts_menu = static_cast<Gtk::MenuItem*>( |
663 |
|
uiManager->get_widget("/MenuBar/MenuInstrument/AssignScripts"))->get_submenu(); |
664 |
|
|
665 |
Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar"); |
Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar"); |
666 |
m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK); |
m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK); |
667 |
m_VBox.pack_start(m_HPaned); |
m_VBox.pack_start(m_HPaned); |
695 |
// Add the TreeView's view columns: |
// Add the TreeView's view columns: |
696 |
m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr); |
m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr); |
697 |
m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name); |
m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name); |
698 |
|
m_TreeView.append_column(_("Scripts"), m_Columns.m_col_scripts); |
699 |
m_TreeView.set_headers_visible(true); |
m_TreeView.set_headers_visible(true); |
700 |
|
|
701 |
// establish drag&drop within the instrument tree view, allowing to reorder |
// establish drag&drop within the instrument tree view, allowing to reorder |
885 |
uiManager->get_widget("/MenuBar/MenuMacro") |
uiManager->get_widget("/MenuBar/MenuMacro") |
886 |
)->get_submenu(); |
)->get_submenu(); |
887 |
|
|
|
const Gdk::ModifierType primaryModifierKey = |
|
|
#if defined(__APPLE__) |
|
|
Gdk::META_MASK; // Cmd key on Mac |
|
|
#else |
|
|
Gdk::CONTROL_MASK; // Ctrl key on all other OSs |
|
|
#endif |
|
|
|
|
888 |
const Gdk::ModifierType noModifier = (Gdk::ModifierType)0; |
const Gdk::ModifierType noModifier = (Gdk::ModifierType)0; |
889 |
Gtk::AccelMap::add_entry("<Macros>/macro_0", GDK_KEY_F1, noModifier); |
Gtk::AccelMap::add_entry("<Macros>/macro_0", GDK_KEY_F1, noModifier); |
890 |
Gtk::AccelMap::add_entry("<Macros>/macro_1", GDK_KEY_F2, noModifier); |
Gtk::AccelMap::add_entry("<Macros>/macro_1", GDK_KEY_F2, noModifier); |
905 |
|
|
906 |
updateMacroMenu(); |
updateMacroMenu(); |
907 |
} |
} |
908 |
|
|
909 |
|
// setup "Assign Scripts" keyboard accelerators |
910 |
|
{ |
911 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_0", GDK_KEY_F1, Gdk::SHIFT_MASK); |
912 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_1", GDK_KEY_F2, Gdk::SHIFT_MASK); |
913 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_2", GDK_KEY_F3, Gdk::SHIFT_MASK); |
914 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_3", GDK_KEY_F4, Gdk::SHIFT_MASK); |
915 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_4", GDK_KEY_F5, Gdk::SHIFT_MASK); |
916 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_5", GDK_KEY_F6, Gdk::SHIFT_MASK); |
917 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_6", GDK_KEY_F7, Gdk::SHIFT_MASK); |
918 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_7", GDK_KEY_F8, Gdk::SHIFT_MASK); |
919 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_8", GDK_KEY_F9, Gdk::SHIFT_MASK); |
920 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_9", GDK_KEY_F10, Gdk::SHIFT_MASK); |
921 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_10", GDK_KEY_F11, Gdk::SHIFT_MASK); |
922 |
|
Gtk::AccelMap::add_entry("<Scripts>/script_11", GDK_KEY_F12, Gdk::SHIFT_MASK); |
923 |
|
|
924 |
|
Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group(); |
925 |
|
assign_scripts_menu->set_accel_group(accelGroup); |
926 |
|
} |
927 |
|
|
928 |
|
Glib::signal_idle().connect_once( |
929 |
|
sigc::mem_fun(*this, &MainWindow::bringToFront), |
930 |
|
200 |
931 |
|
); |
932 |
} |
} |
933 |
|
|
934 |
MainWindow::~MainWindow() |
MainWindow::~MainWindow() |
935 |
{ |
{ |
936 |
} |
} |
937 |
|
|
938 |
|
void MainWindow::bringToFront() { |
939 |
|
#if defined(__APPLE__) |
940 |
|
macRaiseAppWindow(); |
941 |
|
#endif |
942 |
|
raise(); |
943 |
|
present(); |
944 |
|
} |
945 |
|
|
946 |
void MainWindow::updateMacroMenu() { |
void MainWindow::updateMacroMenu() { |
947 |
Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>( |
Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>( |
948 |
uiManager->get_widget("/MenuBar/MenuMacro") |
uiManager->get_widget("/MenuBar/MenuMacro") |
1141 |
} |
} |
1142 |
} |
} |
1143 |
|
|
1144 |
|
updateScriptListOfMenu(); |
1145 |
|
|
1146 |
m_RegionChooser.set_instrument(get_instrument()); |
m_RegionChooser.set_instrument(get_instrument()); |
1147 |
|
|
1148 |
if (Settings::singleton()->syncSamplerInstrumentSelection) { |
if (Settings::singleton()->syncSamplerInstrumentSelection) { |
1884 |
dialog.set_comments(sComment.c_str()); |
dialog.set_comments(sComment.c_str()); |
1885 |
dialog.set_website("http://www.linuxsampler.org"); |
dialog.set_website("http://www.linuxsampler.org"); |
1886 |
dialog.set_website_label("http://www.linuxsampler.org"); |
dialog.set_website_label("http://www.linuxsampler.org"); |
1887 |
|
dialog.set_position(Gtk::WIN_POS_CENTER); |
1888 |
dialog.run(); |
dialog.run(); |
1889 |
} |
} |
1890 |
|
|
1910 |
table(2, 1), |
table(2, 1), |
1911 |
m_file(NULL) |
m_file(NULL) |
1912 |
{ |
{ |
1913 |
|
if (!Settings::singleton()->autoRestoreWindowDimension) { |
1914 |
|
set_default_size(470, 390); |
1915 |
|
set_position(Gtk::WIN_POS_MOUSE); |
1916 |
|
} |
1917 |
|
|
1918 |
set_title(_("File Properties")); |
set_title(_("File Properties")); |
1919 |
eName.set_width_chars(50); |
eName.set_width_chars(50); |
1920 |
|
|
2049 |
eDimensionKeyRangeLow(_("Keyswitching range low")), |
eDimensionKeyRangeLow(_("Keyswitching range low")), |
2050 |
eDimensionKeyRangeHigh(_("Keyswitching range high")) |
eDimensionKeyRangeHigh(_("Keyswitching range high")) |
2051 |
{ |
{ |
2052 |
|
if (!Settings::singleton()->autoRestoreWindowDimension) { |
2053 |
|
//set_default_size(470, 390); |
2054 |
|
set_position(Gtk::WIN_POS_MOUSE); |
2055 |
|
} |
2056 |
|
|
2057 |
set_title(_("Instrument Properties")); |
set_title(_("Instrument Properties")); |
2058 |
|
|
2059 |
eDimensionKeyRangeLow.set_tip( |
eDimensionKeyRangeLow.set_tip( |
2178 |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
2179 |
instrument = gig->GetNextInstrument(), ++index) { |
instrument = gig->GetNextInstrument(), ++index) { |
2180 |
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
2181 |
|
const int iScriptSlots = instrument->ScriptSlotCount(); |
2182 |
|
|
2183 |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
2184 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
2185 |
row[m_Columns.m_col_nr] = index; |
row[m_Columns.m_col_nr] = index; |
2186 |
row[m_Columns.m_col_name] = name; |
row[m_Columns.m_col_name] = name; |
2187 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
2188 |
|
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
2189 |
|
|
2190 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
2191 |
} |
} |
2324 |
|
|
2325 |
ScriptSlots* window = new ScriptSlots; |
ScriptSlots* window = new ScriptSlots; |
2326 |
window->setInstrument(instrument); |
window->setInstrument(instrument); |
2327 |
|
window->signal_script_slots_changed().connect( |
2328 |
|
sigc::mem_fun(*this, &MainWindow::onScriptSlotsModified) |
2329 |
|
); |
2330 |
//window->reparent(*this); |
//window->reparent(*this); |
2331 |
window->show(); |
window->show(); |
2332 |
} |
} |
2333 |
|
|
2334 |
|
void MainWindow::onScriptSlotsModified(gig::Instrument* pInstrument) { |
2335 |
|
if (!pInstrument) return; |
2336 |
|
const int iScriptSlots = pInstrument->ScriptSlotCount(); |
2337 |
|
|
2338 |
|
Glib::RefPtr<Gtk::TreeModel> model = m_TreeView.get_model(); |
2339 |
|
for (int i = 0; i < model->children().size(); ++i) { |
2340 |
|
Gtk::TreeModel::Row row = model->children()[i]; |
2341 |
|
if (row[m_Columns.m_col_instr] != pInstrument) continue; |
2342 |
|
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
2343 |
|
break; |
2344 |
|
} |
2345 |
|
|
2346 |
|
// causes the sampler to reload the instrument with the new script |
2347 |
|
on_sel_change(); |
2348 |
|
} |
2349 |
|
|
2350 |
|
void MainWindow::assignScript(gig::Script* pScript) { |
2351 |
|
if (!pScript) { |
2352 |
|
printf("assignScript() : !script\n"); |
2353 |
|
return; |
2354 |
|
} |
2355 |
|
printf("assignScript('%s')\n", pScript->Name.c_str()); |
2356 |
|
|
2357 |
|
gig::Instrument* pInstrument = get_instrument(); |
2358 |
|
if (!pInstrument) { |
2359 |
|
printf("!instrument\n"); |
2360 |
|
return; |
2361 |
|
} |
2362 |
|
|
2363 |
|
pInstrument->AddScriptSlot(pScript); |
2364 |
|
|
2365 |
|
onScriptSlotsModified(pInstrument); |
2366 |
|
} |
2367 |
|
|
2368 |
void MainWindow::on_action_refresh_all() { |
void MainWindow::on_action_refresh_all() { |
2369 |
__refreshEntireGUI(); |
__refreshEntireGUI(); |
2370 |
} |
} |
2637 |
} |
} |
2638 |
} |
} |
2639 |
|
|
2640 |
|
void MainWindow::updateScriptListOfMenu() { |
2641 |
|
// remove all entries from "Assign Script" menu |
2642 |
|
{ |
2643 |
|
const std::vector<Gtk::Widget*> children = assign_scripts_menu->get_children(); |
2644 |
|
for (int i = 0; i < children.size(); ++i) { |
2645 |
|
Gtk::Widget* child = children[i]; |
2646 |
|
assign_scripts_menu->remove(*child); |
2647 |
|
delete child; |
2648 |
|
} |
2649 |
|
} |
2650 |
|
|
2651 |
|
int iTotalScripts = 0; |
2652 |
|
|
2653 |
|
if (!file) goto noScripts; |
2654 |
|
|
2655 |
|
// add all configured macros as menu items to the "Macro" menu |
2656 |
|
for (int iGroup = 0; file->GetScriptGroup(iGroup); ++iGroup) { |
2657 |
|
gig::ScriptGroup* pGroup = file->GetScriptGroup(iGroup); |
2658 |
|
for (int iScript = 0; pGroup->GetScript(iScript); ++iScript, ++iTotalScripts) { |
2659 |
|
gig::Script* pScript = pGroup->GetScript(iScript); |
2660 |
|
std::string name = pScript->Name; |
2661 |
|
|
2662 |
|
Gtk::MenuItem* item = new Gtk::MenuItem(name); |
2663 |
|
item->signal_activate().connect( |
2664 |
|
sigc::bind( |
2665 |
|
sigc::mem_fun(*this, &MainWindow::assignScript), pScript |
2666 |
|
) |
2667 |
|
); |
2668 |
|
assign_scripts_menu->append(*item); |
2669 |
|
item->set_accel_path("<Scripts>/script_" + ToString(iTotalScripts)); |
2670 |
|
//item->set_tooltip_text(comment); |
2671 |
|
} |
2672 |
|
} |
2673 |
|
|
2674 |
|
noScripts: |
2675 |
|
|
2676 |
|
// if there are no macros configured at all, then show a dummy entry instead |
2677 |
|
if (!iTotalScripts) { |
2678 |
|
Gtk::MenuItem* item = new Gtk::MenuItem(_("No Scripts")); |
2679 |
|
item->set_sensitive(false); |
2680 |
|
assign_scripts_menu->append(*item); |
2681 |
|
} |
2682 |
|
|
2683 |
|
assign_scripts_menu->show_all_children(); |
2684 |
|
} |
2685 |
|
|
2686 |
Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu( |
Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu( |
2687 |
const Glib::ustring& name, int position) { |
const Glib::ustring& name, int position) { |
2688 |
|
|
2725 |
rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; |
rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; |
2726 |
rowInstr[m_Columns.m_col_name] = name; |
rowInstr[m_Columns.m_col_name] = name; |
2727 |
rowInstr[m_Columns.m_col_instr] = instrument; |
rowInstr[m_Columns.m_col_instr] = instrument; |
2728 |
|
rowInstr[m_Columns.m_col_scripts] = ""; |
2729 |
instrument_name_connection.unblock(); |
instrument_name_connection.unblock(); |
2730 |
|
|
2731 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
2732 |
|
select_instrument(instrument); |
|
m_TreeView.get_selection()->select(iterInstr); |
|
|
|
|
2733 |
file_changed(); |
file_changed(); |
2734 |
} |
} |
2735 |
|
|
3701 |
|
|
3702 |
void MainWindow::on_action_combine_instruments() { |
void MainWindow::on_action_combine_instruments() { |
3703 |
CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file); |
CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file); |
3704 |
|
|
3705 |
|
// take over selection from instruments list view for the combine dialog's |
3706 |
|
// list view as pre-selection |
3707 |
|
std::set<int> indeces; |
3708 |
|
{ |
3709 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
3710 |
|
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows(); |
3711 |
|
for (int r = 0; r < rows.size(); ++r) { |
3712 |
|
Gtk::TreeModel::iterator it = m_refTreeModel->get_iter(rows[r]); |
3713 |
|
if (it) { |
3714 |
|
Gtk::TreeModel::Row row = *it; |
3715 |
|
int index = row[m_Columns.m_col_nr]; |
3716 |
|
indeces.insert(index); |
3717 |
|
} |
3718 |
|
} |
3719 |
|
} |
3720 |
|
d->setSelectedInstruments(indeces); |
3721 |
|
|
3722 |
d->show_all(); |
d->show_all(); |
|
d->resize(500, 400); |
|
3723 |
d->run(); |
d->run(); |
3724 |
if (d->fileWasChanged()) { |
if (d->fileWasChanged()) { |
3725 |
// update GUI with new instrument just created |
// update GUI with new instrument just created |
3981 |
m_TreeViewNotebook.set_current_page(2); |
m_TreeViewNotebook.set_current_page(2); |
3982 |
} |
} |
3983 |
|
|
3984 |
|
void MainWindow::select_instrument_by_dir(int dir) { |
3985 |
|
if (!file) return; |
3986 |
|
gig::Instrument* pInstrument = get_instrument(); |
3987 |
|
if (!pInstrument) { |
3988 |
|
select_instrument( file->GetInstrument(0) ); |
3989 |
|
return; |
3990 |
|
} |
3991 |
|
for (int i = 0; file->GetInstrument(i); ++i) { |
3992 |
|
if (file->GetInstrument(i) == pInstrument) { |
3993 |
|
select_instrument( file->GetInstrument(i + dir) ); |
3994 |
|
return; |
3995 |
|
} |
3996 |
|
} |
3997 |
|
} |
3998 |
|
|
3999 |
|
void MainWindow::select_prev_instrument() { |
4000 |
|
select_instrument_by_dir(-1); |
4001 |
|
} |
4002 |
|
|
4003 |
|
void MainWindow::select_next_instrument() { |
4004 |
|
select_instrument_by_dir(1); |
4005 |
|
} |
4006 |
|
|
4007 |
void MainWindow::select_prev_region() { |
void MainWindow::select_prev_region() { |
4008 |
m_RegionChooser.select_prev_region(); |
m_RegionChooser.select_prev_region(); |
4009 |
} |
} |