1 |
/* |
/* |
2 |
* Copyright (C) 2006-2011 Andreas Persson |
* Copyright (C) 2006-2013 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 |
20 |
#include <iostream> |
#include <iostream> |
21 |
#include <cstring> |
#include <cstring> |
22 |
|
|
23 |
|
#include <glibmm/convert.h> |
24 |
|
#include <glibmm/dispatcher.h> |
25 |
|
#include <glibmm/miscutils.h> |
26 |
|
#include <glibmm/stringutils.h> |
27 |
#include <gtkmm/aboutdialog.h> |
#include <gtkmm/aboutdialog.h> |
28 |
#include <gtkmm/filechooserdialog.h> |
#include <gtkmm/filechooserdialog.h> |
29 |
#include <gtkmm/messagedialog.h> |
#include <gtkmm/messagedialog.h> |
30 |
#include <gtkmm/stock.h> |
#include <gtkmm/stock.h> |
31 |
#include <gtkmm/targetentry.h> |
#include <gtkmm/targetentry.h> |
32 |
#include <gtkmm/main.h> |
#include <gtkmm/main.h> |
|
#include <gtkmm/radiomenuitem.h> |
|
33 |
#include <gtkmm/toggleaction.h> |
#include <gtkmm/toggleaction.h> |
34 |
|
#if GTKMM_MAJOR_VERSION < 3 |
35 |
#include "wrapLabel.hh" |
#include "wrapLabel.hh" |
36 |
|
#endif |
37 |
|
|
38 |
#include "global.h" |
#include "global.h" |
39 |
#include "compat.h" |
#include "compat.h" |
46 |
#include "../../gfx/status_attached.xpm" |
#include "../../gfx/status_attached.xpm" |
47 |
#include "../../gfx/status_detached.xpm" |
#include "../../gfx/status_detached.xpm" |
48 |
|
|
|
template<class T> inline std::string ToString(T o) { |
|
|
std::stringstream ss; |
|
|
ss << o; |
|
|
return ss.str(); |
|
|
} |
|
|
|
|
|
Table::Table(int x, int y) : Gtk::Table(x, y), rowno(0) { } |
|
|
|
|
|
void Table::add(BoolEntry& boolentry) |
|
|
{ |
|
|
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
|
|
Gtk::FILL, Gtk::SHRINK); |
|
|
rowno++; |
|
|
} |
|
|
|
|
|
void Table::add(BoolEntryPlus6& boolentry) |
|
|
{ |
|
|
attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
|
|
Gtk::FILL, Gtk::SHRINK); |
|
|
rowno++; |
|
|
} |
|
|
|
|
|
void Table::add(LabelWidget& prop) |
|
|
{ |
|
|
attach(prop.label, 1, 2, rowno, rowno + 1, |
|
|
Gtk::FILL, Gtk::SHRINK); |
|
|
attach(prop.widget, 2, 3, rowno, rowno + 1, |
|
|
Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); |
|
|
rowno++; |
|
|
} |
|
49 |
|
|
50 |
MainWindow::MainWindow() : |
MainWindow::MainWindow() : |
51 |
dimreg_label(_("Changes apply to:")), |
dimreg_label(_("Changes apply to:")), |
60 |
add(m_VBox); |
add(m_VBox); |
61 |
|
|
62 |
// Handle selection |
// Handle selection |
63 |
Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection(); |
m_TreeView.get_selection()->signal_changed().connect( |
|
tree_sel_ref->signal_changed().connect( |
|
64 |
sigc::mem_fun(*this, &MainWindow::on_sel_change)); |
sigc::mem_fun(*this, &MainWindow::on_sel_change)); |
65 |
|
|
66 |
// m_TreeView.set_reorderable(); |
// m_TreeView.set_reorderable(); |
147 |
sigc::mem_fun(*this, &MainWindow::on_action_add_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_add_instrument) |
148 |
); |
); |
149 |
actionGroup->add( |
actionGroup->add( |
150 |
|
Gtk::Action::create("DupInstrument", _("_Duplicate Instrument")), |
151 |
|
sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument) |
152 |
|
); |
153 |
|
actionGroup->add( |
154 |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
155 |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
156 |
); |
); |
208 |
" <popup name='PopupMenu'>" |
" <popup name='PopupMenu'>" |
209 |
" <menuitem action='InstrProperties'/>" |
" <menuitem action='InstrProperties'/>" |
210 |
" <menuitem action='AddInstrument'/>" |
" <menuitem action='AddInstrument'/>" |
211 |
|
" <menuitem action='DupInstrument'/>" |
212 |
" <separator/>" |
" <separator/>" |
213 |
" <menuitem action='RemoveInstrument'/>" |
" <menuitem action='RemoveInstrument'/>" |
214 |
" </popup>" |
" </popup>" |
216 |
" <menuitem action='SampleProperties'/>" |
" <menuitem action='SampleProperties'/>" |
217 |
" <menuitem action='AddGroup'/>" |
" <menuitem action='AddGroup'/>" |
218 |
" <menuitem action='AddSample'/>" |
" <menuitem action='AddSample'/>" |
219 |
" <menuitem action='ReplaceAllSamplesInAllGroups' />" |
" <menuitem action='ReplaceAllSamplesInAllGroups' />" |
220 |
" <separator/>" |
" <separator/>" |
221 |
" <menuitem action='RemoveSample'/>" |
" <menuitem action='RemoveSample'/>" |
222 |
" </popup>" |
" </popup>" |
225 |
|
|
226 |
popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu")); |
popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu")); |
227 |
|
|
228 |
|
instrument_menu = static_cast<Gtk::MenuItem*>( |
229 |
|
uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu(); |
230 |
|
|
231 |
Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar"); |
Gtk::Widget* menuBar = uiManager->get_widget("/MenuBar"); |
232 |
m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK); |
m_VBox.pack_start(*menuBar, Gtk::PACK_SHRINK); |
233 |
m_VBox.pack_start(m_HPaned); |
m_VBox.pack_start(m_HPaned); |
236 |
m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK); |
m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK); |
237 |
m_VBox.pack_start(m_StatusBar, Gtk::PACK_SHRINK); |
m_VBox.pack_start(m_StatusBar, Gtk::PACK_SHRINK); |
238 |
|
|
239 |
|
set_file_is_shared(false); |
240 |
|
|
241 |
// Status Bar: |
// Status Bar: |
242 |
m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK); |
m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK); |
243 |
m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK); |
m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK); |
252 |
// Create the Tree model: |
// Create the Tree model: |
253 |
m_refTreeModel = Gtk::ListStore::create(m_Columns); |
m_refTreeModel = Gtk::ListStore::create(m_Columns); |
254 |
m_TreeView.set_model(m_refTreeModel); |
m_TreeView.set_model(m_refTreeModel); |
255 |
m_refTreeModel->signal_row_changed().connect( |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
256 |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
257 |
); |
); |
258 |
|
|
293 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
294 |
m_DimRegionChooser.signal_region_changed().connect( |
m_DimRegionChooser.signal_region_changed().connect( |
295 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
296 |
instrumentProps.signal_instrument_changed().connect( |
instrumentProps.signal_changed().connect( |
297 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
298 |
propDialog.signal_info_changed().connect( |
propDialog.signal_changed().connect( |
299 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
300 |
|
|
301 |
dimreg_edit.signal_dimreg_to_be_changed().connect( |
dimreg_edit.signal_dimreg_to_be_changed().connect( |
340 |
|
|
341 |
file = 0; |
file = 0; |
342 |
file_is_changed = false; |
file_is_changed = false; |
|
set_file_is_shared(false); |
|
343 |
|
|
344 |
show_all_children(); |
show_all_children(); |
345 |
|
|
370 |
gig::Instrument* MainWindow::get_instrument() |
gig::Instrument* MainWindow::get_instrument() |
371 |
{ |
{ |
372 |
gig::Instrument* instrument = 0; |
gig::Instrument* instrument = 0; |
373 |
Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection(); |
Gtk::TreeModel::const_iterator it = |
374 |
|
m_TreeView.get_selection()->get_selected(); |
|
Gtk::TreeModel::iterator it = tree_sel_ref->get_selected(); |
|
375 |
if (it) { |
if (it) { |
376 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
377 |
instrument = row[m_Columns.m_col_instr]; |
instrument = row[m_Columns.m_col_instr]; |
430 |
|
|
431 |
void MainWindow::on_sel_change() |
void MainWindow::on_sel_change() |
432 |
{ |
{ |
433 |
|
// select item in instrument menu |
434 |
|
Gtk::TreeModel::iterator it = m_TreeView.get_selection()->get_selected(); |
435 |
|
if (it) { |
436 |
|
Gtk::TreePath path(it); |
437 |
|
int index = path[0]; |
438 |
|
const std::vector<Gtk::Widget*> children = |
439 |
|
instrument_menu->get_children(); |
440 |
|
static_cast<Gtk::RadioMenuItem*>(children[index])->set_active(); |
441 |
|
} |
442 |
|
|
443 |
m_RegionChooser.set_instrument(get_instrument()); |
m_RegionChooser.set_instrument(get_instrument()); |
444 |
} |
} |
445 |
|
|
452 |
void Loader::progress_callback(float fraction) |
void Loader::progress_callback(float fraction) |
453 |
{ |
{ |
454 |
{ |
{ |
455 |
Glib::Mutex::Lock lock(progressMutex); |
Glib::Threads::Mutex::Lock lock(progressMutex); |
456 |
progress = fraction; |
progress = fraction; |
457 |
} |
} |
458 |
progress_dispatcher(); |
progress_dispatcher(); |
460 |
|
|
461 |
void Loader::thread_function() |
void Loader::thread_function() |
462 |
{ |
{ |
463 |
printf("thread_function self=%x\n", Glib::Thread::self()); |
printf("thread_function self=%x\n", Glib::Threads::Thread::self()); |
464 |
printf("Start %s\n", filename); |
printf("Start %s\n", filename); |
465 |
RIFF::File* riff = new RIFF::File(filename); |
RIFF::File* riff = new RIFF::File(filename); |
466 |
gig = new gig::File(riff); |
gig = new gig::File(riff); |
480 |
|
|
481 |
void Loader::launch() |
void Loader::launch() |
482 |
{ |
{ |
483 |
|
#ifdef OLD_THREADS |
484 |
thread = Glib::Thread::create(sigc::mem_fun(*this, &Loader::thread_function), true); |
thread = Glib::Thread::create(sigc::mem_fun(*this, &Loader::thread_function), true); |
485 |
|
#else |
486 |
|
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Loader::thread_function)); |
487 |
|
#endif |
488 |
printf("launch thread=%x\n", thread); |
printf("launch thread=%x\n", thread); |
489 |
} |
} |
490 |
|
|
492 |
{ |
{ |
493 |
float res; |
float res; |
494 |
{ |
{ |
495 |
Glib::Mutex::Lock lock(progressMutex); |
Glib::Threads::Mutex::Lock lock(progressMutex); |
496 |
res = progress; |
res = progress; |
497 |
} |
} |
498 |
return res; |
return res; |
518 |
// Clear all GUI elements / controls. This method is typically called |
// Clear all GUI elements / controls. This method is typically called |
519 |
// before a new .gig file is to be created or to be loaded. |
// before a new .gig file is to be created or to be loaded. |
520 |
void MainWindow::__clear() { |
void MainWindow::__clear() { |
|
// remove all entries from "Instrument" menu |
|
|
Gtk::MenuItem* instrument_menu = |
|
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuInstrument")); |
|
|
instrument_menu->hide(); |
|
|
Gtk::Menu* menu = instrument_menu->get_submenu(); |
|
|
while (menu->get_children().size()) { |
|
|
Gtk::Widget* child = *menu->get_children().begin(); |
|
|
menu->remove(*child); |
|
|
delete child; |
|
|
} |
|
521 |
// forget all samples that ought to be imported |
// forget all samples that ought to be imported |
522 |
m_SampleImportQueue.clear(); |
m_SampleImportQueue.clear(); |
523 |
// clear the samples and instruments tree views |
// clear the samples and instruments tree views |
524 |
m_refTreeModel->clear(); |
m_refTreeModel->clear(); |
525 |
m_refSamplesTreeModel->clear(); |
m_refSamplesTreeModel->clear(); |
526 |
|
// remove all entries from "Instrument" menu |
527 |
|
while (!instrument_menu->get_children().empty()) { |
528 |
|
remove_instrument_from_menu(0); |
529 |
|
} |
530 |
// free libgig's gig::File instance |
// free libgig's gig::File instance |
531 |
if (file && !file_is_shared) delete file; |
if (file && !file_is_shared) delete file; |
532 |
file = NULL; |
file = NULL; |
606 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
607 |
std::string filename = dialog.get_filename(); |
std::string filename = dialog.get_filename(); |
608 |
printf("filename=%s\n", filename.c_str()); |
printf("filename=%s\n", filename.c_str()); |
609 |
printf("on_action_file_open self=%x\n", Glib::Thread::self()); |
printf("on_action_file_open self=%x\n", Glib::Threads::Thread::self()); |
610 |
load_file(filename.c_str()); |
load_file(filename.c_str()); |
611 |
current_gig_dir = Glib::path_get_dirname(filename); |
current_gig_dir = Glib::path_get_dirname(filename); |
612 |
} |
} |
648 |
void MainWindow::on_loader_finished() |
void MainWindow::on_loader_finished() |
649 |
{ |
{ |
650 |
printf("Loader finished!\n"); |
printf("Loader finished!\n"); |
651 |
printf("on_loader_finished self=%x\n", Glib::Thread::self()); |
printf("on_loader_finished self=%x\n", Glib::Threads::Thread::self()); |
652 |
load_gig(loader->gig, loader->filename); |
load_gig(loader->gig, loader->filename); |
653 |
load_dialog->hide(); |
load_dialog->hide(); |
654 |
} |
} |
751 |
descriptionArea.set_spacing(15); |
descriptionArea.set_spacing(15); |
752 |
Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); |
Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); |
753 |
descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK); |
descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK); |
754 |
|
#if GTKMM_MAJOR_VERSION < 3 |
755 |
view::WrapLabel description; |
view::WrapLabel description; |
756 |
|
#else |
757 |
|
Gtk::Label description; |
758 |
|
description.set_line_wrap(); |
759 |
|
#endif |
760 |
description.set_markup( |
description.set_markup( |
761 |
_("\n<b>CAUTION:</b> You <b>MUST</b> use the " |
_("\n<b>CAUTION:</b> You <b>MUST</b> use the " |
762 |
"<span style=\"italic\">\"Save\"</span> dialog instead of " |
"<span style=\"italic\">\"Save\"</span> dialog instead of " |
808 |
SF_INFO info; |
SF_INFO info; |
809 |
info.format = 0; |
info.format = 0; |
810 |
SNDFILE* hFile = sf_open((*iter).sample_path.c_str(), SFM_READ, &info); |
SNDFILE* hFile = sf_open((*iter).sample_path.c_str(), SFM_READ, &info); |
811 |
|
sf_command(hFile, SFC_SET_SCALE_FLOAT_INT_READ, 0, SF_TRUE); |
812 |
try { |
try { |
813 |
if (!hFile) throw std::string(_("could not open file")); |
if (!hFile) throw std::string(_("could not open file")); |
814 |
// determine sample's bit depth |
// determine sample's bit depth |
878 |
m_SampleImportQueue.erase(cur); |
m_SampleImportQueue.erase(cur); |
879 |
} catch (std::string what) { |
} catch (std::string what) { |
880 |
// remember the files that made trouble (and their cause) |
// remember the files that made trouble (and their cause) |
881 |
if (error_files.size()) error_files += "\n"; |
if (!error_files.empty()) error_files += "\n"; |
882 |
error_files += (*iter).sample_path += " (" + what + ")"; |
error_files += (*iter).sample_path += " (" + what + ")"; |
883 |
++iter; |
++iter; |
884 |
} |
} |
885 |
} |
} |
886 |
// show error message box when some sample(s) could not be imported |
// show error message box when some sample(s) could not be imported |
887 |
if (error_files.size()) { |
if (!error_files.empty()) { |
888 |
Glib::ustring txt = _("Could not import the following sample(s):\n") + error_files; |
Glib::ustring txt = _("Could not import the following sample(s):\n") + error_files; |
889 |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
890 |
msg.run(); |
msg.run(); |
906 |
dialog.set_name("Gigedit"); |
dialog.set_name("Gigedit"); |
907 |
#endif |
#endif |
908 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
909 |
dialog.set_copyright("Copyright (C) 2006-2011 Andreas Persson"); |
dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson"); |
910 |
dialog.set_comments(_( |
dialog.set_comments(_( |
911 |
"Released under the GNU General Public License.\n" |
"Released under the GNU General Public License.\n" |
912 |
"\n" |
"\n" |
939 |
eCommissioned(_("Commissioned")), |
eCommissioned(_("Commissioned")), |
940 |
eSubject(_("Subject")), |
eSubject(_("Subject")), |
941 |
quitButton(Gtk::Stock::CLOSE), |
quitButton(Gtk::Stock::CLOSE), |
942 |
table(2, 1), |
table(2, 1) |
|
update_model(0) |
|
943 |
{ |
{ |
944 |
set_title(_("File Properties")); |
set_title(_("File Properties")); |
945 |
eName.set_width_chars(50); |
eName.set_width_chars(50); |
999 |
|
|
1000 |
void PropDialog::set_info(DLS::Info* info) |
void PropDialog::set_info(DLS::Info* info) |
1001 |
{ |
{ |
1002 |
this->info = info; |
update(info); |
|
update_model++; |
|
|
eName.set_value(info->Name); |
|
|
eCreationDate.set_value(info->CreationDate); |
|
|
eComments.set_value(info->Comments); |
|
|
eProduct.set_value(info->Product); |
|
|
eCopyright.set_value(info->Copyright); |
|
|
eArtists.set_value(info->Artists); |
|
|
eGenre.set_value(info->Genre); |
|
|
eKeywords.set_value(info->Keywords); |
|
|
eEngineer.set_value(info->Engineer); |
|
|
eTechnician.set_value(info->Technician); |
|
|
eSoftware.set_value(info->Software); |
|
|
eMedium.set_value(info->Medium); |
|
|
eSource.set_value(info->Source); |
|
|
eSourceForm.set_value(info->SourceForm); |
|
|
eCommissioned.set_value(info->Commissioned); |
|
|
eSubject.set_value(info->Subject); |
|
|
update_model--; |
|
1003 |
} |
} |
1004 |
|
|
|
sigc::signal<void>& PropDialog::signal_info_changed() |
|
|
{ |
|
|
return info_changed; |
|
|
} |
|
1005 |
|
|
1006 |
void InstrumentProps::set_IsDrum(bool value) |
void InstrumentProps::set_Name(const gig::String& name) |
1007 |
{ |
{ |
1008 |
instrument->IsDrum = value; |
m->pInfo->Name = name; |
1009 |
} |
} |
1010 |
|
|
1011 |
void InstrumentProps::set_MIDIBank(uint16_t value) |
void InstrumentProps::update_name() |
1012 |
{ |
{ |
1013 |
instrument->MIDIBank = value; |
update_model++; |
1014 |
|
eName.set_value(m->pInfo->Name); |
1015 |
|
update_model--; |
1016 |
} |
} |
1017 |
|
|
1018 |
void InstrumentProps::set_MIDIProgram(uint32_t value) |
void InstrumentProps::set_IsDrum(bool value) |
1019 |
{ |
{ |
1020 |
instrument->MIDIProgram = value; |
m->IsDrum = value; |
1021 |
} |
} |
1022 |
|
|
1023 |
void InstrumentProps::set_DimensionKeyRange_low(uint8_t value) |
void InstrumentProps::set_MIDIBank(uint16_t value) |
1024 |
{ |
{ |
1025 |
instrument->DimensionKeyRange.low = value; |
m->MIDIBank = value; |
|
if (value > instrument->DimensionKeyRange.high) { |
|
|
eDimensionKeyRangeHigh.set_value(value); |
|
|
} |
|
1026 |
} |
} |
1027 |
|
|
1028 |
void InstrumentProps::set_DimensionKeyRange_high(uint8_t value) |
void InstrumentProps::set_MIDIProgram(uint32_t value) |
1029 |
{ |
{ |
1030 |
instrument->DimensionKeyRange.high = value; |
m->MIDIProgram = value; |
|
if (value < instrument->DimensionKeyRange.low) { |
|
|
eDimensionKeyRangeLow.set_value(value); |
|
|
} |
|
1031 |
} |
} |
1032 |
|
|
1033 |
InstrumentProps::InstrumentProps() |
InstrumentProps::InstrumentProps() : |
1034 |
: update_model(0), |
quitButton(Gtk::Stock::CLOSE), |
1035 |
quitButton(Gtk::Stock::CLOSE), |
table(2,1), |
1036 |
table(2,1), |
eName(_("Name")), |
1037 |
eName(_("Name")), |
eIsDrum(_("Is drum")), |
1038 |
eIsDrum(_("Is drum")), |
eMIDIBank(_("MIDI bank"), 0, 16383), |
1039 |
eMIDIBank(_("MIDI bank"), 0, 16383), |
eMIDIProgram(_("MIDI program")), |
1040 |
eMIDIProgram(_("MIDI program")), |
eAttenuation(_("Attenuation"), 0, 96, 0, 1), |
1041 |
eAttenuation(_("Attenuation"), 0, 96, 0, 1), |
eGainPlus6(_("Gain +6dB"), eAttenuation, -6), |
1042 |
eGainPlus6(_("Gain +6dB"), eAttenuation, -6), |
eEffectSend(_("Effect send"), 0, 65535), |
1043 |
eEffectSend(_("Effect send"), 0, 65535), |
eFineTune(_("Fine tune"), -8400, 8400), |
1044 |
eFineTune(_("Fine tune"), -8400, 8400), |
ePitchbendRange(_("Pitchbend range"), 0, 12), |
1045 |
ePitchbendRange(_("Pitchbend range"), 0, 12), |
ePianoReleaseMode(_("Piano release mode")), |
1046 |
ePianoReleaseMode(_("Piano release mode")), |
eDimensionKeyRangeLow(_("Keyswitching range low")), |
1047 |
eDimensionKeyRangeLow(_("Keyswitching range low")), |
eDimensionKeyRangeHigh(_("Keyswitching range high")) |
|
eDimensionKeyRangeHigh(_("Keyswitching range high")) |
|
1048 |
{ |
{ |
1049 |
set_title(_("Instrument Properties")); |
set_title(_("Instrument Properties")); |
1050 |
|
|
1057 |
"\"keyswitching\" dimension") |
"\"keyswitching\" dimension") |
1058 |
); |
); |
1059 |
|
|
1060 |
|
connect(eName, &InstrumentProps::set_Name); |
1061 |
connect(eIsDrum, &InstrumentProps::set_IsDrum); |
connect(eIsDrum, &InstrumentProps::set_IsDrum); |
1062 |
connect(eMIDIBank, &InstrumentProps::set_MIDIBank); |
connect(eMIDIBank, &InstrumentProps::set_MIDIBank); |
1063 |
connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram); |
connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram); |
1067 |
connect(eFineTune, &gig::Instrument::FineTune); |
connect(eFineTune, &gig::Instrument::FineTune); |
1068 |
connect(ePitchbendRange, &gig::Instrument::PitchbendRange); |
connect(ePitchbendRange, &gig::Instrument::PitchbendRange); |
1069 |
connect(ePianoReleaseMode, &gig::Instrument::PianoReleaseMode); |
connect(ePianoReleaseMode, &gig::Instrument::PianoReleaseMode); |
1070 |
connect(eDimensionKeyRangeLow, |
connect(eDimensionKeyRangeLow, eDimensionKeyRangeHigh, |
1071 |
&InstrumentProps::set_DimensionKeyRange_low); |
&gig::Instrument::DimensionKeyRange); |
1072 |
connect(eDimensionKeyRangeHigh, |
|
1073 |
&InstrumentProps::set_DimensionKeyRange_high); |
eName.signal_value_changed().connect(sig_name_changed.make_slot()); |
1074 |
|
|
1075 |
table.set_col_spacings(5); |
table.set_col_spacings(5); |
1076 |
|
|
1109 |
|
|
1110 |
void InstrumentProps::set_instrument(gig::Instrument* instrument) |
void InstrumentProps::set_instrument(gig::Instrument* instrument) |
1111 |
{ |
{ |
1112 |
this->instrument = instrument; |
update(instrument); |
1113 |
|
|
1114 |
update_model++; |
update_model++; |
1115 |
eName.set_value(instrument->pInfo->Name); |
eName.set_value(instrument->pInfo->Name); |
1116 |
eIsDrum.set_value(instrument->IsDrum); |
eIsDrum.set_value(instrument->IsDrum); |
1117 |
eMIDIBank.set_value(instrument->MIDIBank); |
eMIDIBank.set_value(instrument->MIDIBank); |
1118 |
eMIDIProgram.set_value(instrument->MIDIProgram); |
eMIDIProgram.set_value(instrument->MIDIProgram); |
|
eAttenuation.set_value(instrument->Attenuation); |
|
|
eGainPlus6.set_value(instrument->Attenuation); |
|
|
eEffectSend.set_value(instrument->EffectSend); |
|
|
eFineTune.set_value(instrument->FineTune); |
|
|
ePitchbendRange.set_value(instrument->PitchbendRange); |
|
|
ePianoReleaseMode.set_value(instrument->PianoReleaseMode); |
|
|
eDimensionKeyRangeLow.set_value(instrument->DimensionKeyRange.low); |
|
|
eDimensionKeyRangeHigh.set_value(instrument->DimensionKeyRange.high); |
|
1119 |
update_model--; |
update_model--; |
1120 |
} |
} |
1121 |
|
|
|
sigc::signal<void>& InstrumentProps::signal_instrument_changed() |
|
|
{ |
|
|
return instrument_changed; |
|
|
} |
|
1122 |
|
|
1123 |
void MainWindow::file_changed() |
void MainWindow::file_changed() |
1124 |
{ |
{ |
1140 |
|
|
1141 |
propDialog.set_info(gig->pInfo); |
propDialog.set_info(gig->pInfo); |
1142 |
|
|
1143 |
Gtk::MenuItem* instrument_menu = |
instrument_name_connection.block(); |
|
dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuInstrument")); |
|
|
|
|
|
int instrument_index = 0; |
|
|
Gtk::RadioMenuItem::Group instrument_group; |
|
1144 |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
1145 |
instrument = gig->GetNextInstrument()) { |
instrument = gig->GetNextInstrument()) { |
1146 |
|
Glib::ustring name(instrument->pInfo->Name); |
1147 |
|
|
1148 |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
1149 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
1150 |
row[m_Columns.m_col_name] = instrument->pInfo->Name.c_str(); |
row[m_Columns.m_col_name] = name; |
1151 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
1152 |
// create a menu item for this instrument |
|
1153 |
Gtk::RadioMenuItem* item = |
add_instrument_to_menu(name); |
|
new Gtk::RadioMenuItem(instrument_group, instrument->pInfo->Name.c_str()); |
|
|
instrument_menu->get_submenu()->append(*item); |
|
|
item->signal_activate().connect( |
|
|
sigc::bind( |
|
|
sigc::mem_fun(*this, &MainWindow::on_instrument_selection_change), |
|
|
instrument_index |
|
|
) |
|
|
); |
|
|
instrument_index++; |
|
1154 |
} |
} |
1155 |
instrument_menu->show(); |
instrument_name_connection.unblock(); |
1156 |
instrument_menu->get_submenu()->show_all_children(); |
uiManager->get_widget("/MenuBar/MenuInstrument")->show(); |
1157 |
|
|
1158 |
for (gig::Group* group = gig->GetFirstGroup(); group; group = gig->GetNextGroup()) { |
for (gig::Group* group = gig->GetFirstGroup(); group; group = gig->GetNextGroup()) { |
1159 |
if (group->Name != "") { |
if (group->Name != "") { |
1177 |
file = gig; |
file = gig; |
1178 |
|
|
1179 |
// select the first instrument |
// select the first instrument |
1180 |
Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection(); |
m_TreeView.get_selection()->select(Gtk::TreePath("0")); |
1181 |
tree_sel_ref->select(Gtk::TreePath("0")); |
|
1182 |
|
instr_props_set_instrument(); |
1183 |
} |
} |
1184 |
|
|
1185 |
void MainWindow::show_instr_props() |
bool MainWindow::instr_props_set_instrument() |
1186 |
{ |
{ |
1187 |
gig::Instrument* instrument = get_instrument(); |
instrumentProps.signal_name_changed().clear(); |
1188 |
if (instrument) |
|
1189 |
{ |
Gtk::TreeModel::const_iterator it = |
1190 |
|
m_TreeView.get_selection()->get_selected(); |
1191 |
|
if (it) { |
1192 |
|
Gtk::TreeModel::Row row = *it; |
1193 |
|
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
1194 |
|
|
1195 |
instrumentProps.set_instrument(instrument); |
instrumentProps.set_instrument(instrument); |
1196 |
|
|
1197 |
|
// make sure instrument tree is updated when user changes the |
1198 |
|
// instrument name in instrument properties window |
1199 |
|
instrumentProps.signal_name_changed().connect( |
1200 |
|
sigc::bind( |
1201 |
|
sigc::mem_fun(*this, |
1202 |
|
&MainWindow::instr_name_changed_by_instr_props), |
1203 |
|
it)); |
1204 |
|
} else { |
1205 |
|
instrumentProps.hide(); |
1206 |
|
} |
1207 |
|
return it; |
1208 |
|
} |
1209 |
|
|
1210 |
|
void MainWindow::show_instr_props() |
1211 |
|
{ |
1212 |
|
if (instr_props_set_instrument()) { |
1213 |
instrumentProps.show(); |
instrumentProps.show(); |
1214 |
instrumentProps.deiconify(); |
instrumentProps.deiconify(); |
1215 |
} |
} |
1216 |
} |
} |
1217 |
|
|
1218 |
|
void MainWindow::instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it) |
1219 |
|
{ |
1220 |
|
Gtk::TreeModel::Row row = *it; |
1221 |
|
Glib::ustring name = row[m_Columns.m_col_name]; |
1222 |
|
|
1223 |
|
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
1224 |
|
if (instrument->pInfo->Name != name) { |
1225 |
|
row[m_Columns.m_col_name] = instrument->pInfo->Name; |
1226 |
|
} |
1227 |
|
} |
1228 |
|
|
1229 |
void MainWindow::on_action_view_status_bar() { |
void MainWindow::on_action_view_status_bar() { |
1230 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
1231 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
1246 |
} |
} |
1247 |
} |
} |
1248 |
|
|
1249 |
void MainWindow::on_instrument_selection_change(int index) { |
void MainWindow::on_instrument_selection_change(Gtk::RadioMenuItem* item) { |
1250 |
m_RegionChooser.set_instrument(file->GetInstrument(index)); |
if (item->get_active()) { |
1251 |
|
const std::vector<Gtk::Widget*> children = |
1252 |
|
instrument_menu->get_children(); |
1253 |
|
std::vector<Gtk::Widget*>::const_iterator it = |
1254 |
|
find(children.begin(), children.end(), item); |
1255 |
|
if (it != children.end()) { |
1256 |
|
int index = it - children.begin(); |
1257 |
|
m_TreeView.get_selection()->select(Gtk::TreePath(ToString(index))); |
1258 |
|
|
1259 |
|
m_RegionChooser.set_instrument(file->GetInstrument(index)); |
1260 |
|
} |
1261 |
|
} |
1262 |
} |
} |
1263 |
|
|
1264 |
void MainWindow::on_sample_treeview_button_release(GdkEventButton* button) { |
void MainWindow::on_sample_treeview_button_release(GdkEventButton* button) { |
1288 |
} |
} |
1289 |
} |
} |
1290 |
|
|
1291 |
|
|
1292 |
|
Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu( |
1293 |
|
const Glib::ustring& name, int position) { |
1294 |
|
|
1295 |
|
Gtk::RadioMenuItem::Group instrument_group; |
1296 |
|
const std::vector<Gtk::Widget*> children = instrument_menu->get_children(); |
1297 |
|
if (!children.empty()) { |
1298 |
|
instrument_group = |
1299 |
|
static_cast<Gtk::RadioMenuItem*>(children[0])->get_group(); |
1300 |
|
} |
1301 |
|
Gtk::RadioMenuItem* item = |
1302 |
|
new Gtk::RadioMenuItem(instrument_group, name); |
1303 |
|
if (position < 0) { |
1304 |
|
instrument_menu->append(*item); |
1305 |
|
} else { |
1306 |
|
instrument_menu->insert(*item, position); |
1307 |
|
} |
1308 |
|
item->show(); |
1309 |
|
item->signal_activate().connect( |
1310 |
|
sigc::bind( |
1311 |
|
sigc::mem_fun(*this, &MainWindow::on_instrument_selection_change), |
1312 |
|
item)); |
1313 |
|
return item; |
1314 |
|
} |
1315 |
|
|
1316 |
|
void MainWindow::remove_instrument_from_menu(int index) { |
1317 |
|
const std::vector<Gtk::Widget*> children = |
1318 |
|
instrument_menu->get_children(); |
1319 |
|
Gtk::Widget* child = children[index]; |
1320 |
|
instrument_menu->remove(*child); |
1321 |
|
delete child; |
1322 |
|
} |
1323 |
|
|
1324 |
|
void MainWindow::add_instrument(gig::Instrument* instrument) { |
1325 |
|
const char* name = instrument->pInfo->Name.c_str(); |
1326 |
|
|
1327 |
|
// update instrument tree view |
1328 |
|
instrument_name_connection.block(); |
1329 |
|
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
1330 |
|
Gtk::TreeModel::Row rowInstr = *iterInstr; |
1331 |
|
rowInstr[m_Columns.m_col_name] = name; |
1332 |
|
rowInstr[m_Columns.m_col_instr] = instrument; |
1333 |
|
instrument_name_connection.unblock(); |
1334 |
|
|
1335 |
|
add_instrument_to_menu(name); |
1336 |
|
|
1337 |
|
m_TreeView.get_selection()->select(iterInstr); |
1338 |
|
|
1339 |
|
file_changed(); |
1340 |
|
} |
1341 |
|
|
1342 |
void MainWindow::on_action_add_instrument() { |
void MainWindow::on_action_add_instrument() { |
1343 |
static int __instrument_indexer = 0; |
static int __instrument_indexer = 0; |
1344 |
if (!file) return; |
if (!file) return; |
1346 |
__instrument_indexer++; |
__instrument_indexer++; |
1347 |
instrument->pInfo->Name = |
instrument->pInfo->Name = |
1348 |
_("Unnamed Instrument ") + ToString(__instrument_indexer); |
_("Unnamed Instrument ") + ToString(__instrument_indexer); |
1349 |
// update instrument tree view |
|
1350 |
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
add_instrument(instrument); |
1351 |
Gtk::TreeModel::Row rowInstr = *iterInstr; |
} |
1352 |
rowInstr[m_Columns.m_col_name] = instrument->pInfo->Name.c_str(); |
|
1353 |
rowInstr[m_Columns.m_col_instr] = instrument; |
void MainWindow::on_action_duplicate_instrument() { |
1354 |
file_changed(); |
if (!file) return; |
1355 |
|
|
1356 |
|
// retrieve the currently selected instrument |
1357 |
|
// (being the original instrument to be duplicated) |
1358 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
1359 |
|
Gtk::TreeModel::iterator itSelection = sel->get_selected(); |
1360 |
|
if (!itSelection) return; |
1361 |
|
Gtk::TreeModel::Row row = *itSelection; |
1362 |
|
gig::Instrument* instrOrig = row[m_Columns.m_col_instr]; |
1363 |
|
if (!instrOrig) return; |
1364 |
|
|
1365 |
|
// duplicate the orginal instrument |
1366 |
|
gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig); |
1367 |
|
instrNew->pInfo->Name = |
1368 |
|
instrOrig->pInfo->Name + " (" + _("Copy") + ")"; |
1369 |
|
|
1370 |
|
add_instrument(instrNew); |
1371 |
} |
} |
1372 |
|
|
1373 |
void MainWindow::on_action_remove_instrument() { |
void MainWindow::on_action_remove_instrument() { |
1389 |
Gtk::TreeModel::Row row = *it; |
Gtk::TreeModel::Row row = *it; |
1390 |
gig::Instrument* instr = row[m_Columns.m_col_instr]; |
gig::Instrument* instr = row[m_Columns.m_col_instr]; |
1391 |
try { |
try { |
1392 |
|
Gtk::TreePath path(it); |
1393 |
|
int index = path[0]; |
1394 |
|
|
1395 |
// remove instrument from the gig file |
// remove instrument from the gig file |
1396 |
if (instr) file->DeleteInstrument(instr); |
if (instr) file->DeleteInstrument(instr); |
|
// remove respective row from instruments tree view |
|
|
m_refTreeModel->erase(it); |
|
1397 |
file_changed(); |
file_changed(); |
1398 |
|
|
1399 |
|
remove_instrument_from_menu(index); |
1400 |
|
|
1401 |
|
// remove row from instruments tree view |
1402 |
|
m_refTreeModel->erase(it); |
1403 |
|
|
1404 |
|
#if GTKMM_MAJOR_VERSION < 3 |
1405 |
|
// select another instrument (in gtk3 this is done |
1406 |
|
// automatically) |
1407 |
|
if (!m_refTreeModel->children().empty()) { |
1408 |
|
if (index == m_refTreeModel->children().size()) { |
1409 |
|
index--; |
1410 |
|
} |
1411 |
|
m_TreeView.get_selection()->select( |
1412 |
|
Gtk::TreePath(ToString(index))); |
1413 |
|
} |
1414 |
|
#endif |
1415 |
|
instr_props_set_instrument(); |
1416 |
} catch (RIFF::Exception e) { |
} catch (RIFF::Exception e) { |
1417 |
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
1418 |
msg.run(); |
msg.run(); |
1562 |
{ |
{ |
1563 |
sample->MIDIUnityNote = instrument.basenote; |
sample->MIDIUnityNote = instrument.basenote; |
1564 |
|
|
|
#if HAVE_SF_INSTRUMENT_LOOPS |
|
1565 |
if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) { |
if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) { |
1566 |
sample->Loops = 1; |
sample->Loops = 1; |
1567 |
|
|
1581 |
sample->LoopPlayCount = instrument.loops[0].count; |
sample->LoopPlayCount = instrument.loops[0].count; |
1582 |
sample->LoopSize = sample->LoopEnd - sample->LoopStart + 1; |
sample->LoopSize = sample->LoopEnd - sample->LoopStart + 1; |
1583 |
} |
} |
|
#endif |
|
1584 |
} |
} |
1585 |
|
|
1586 |
// schedule resizing the sample (which will be done |
// schedule resizing the sample (which will be done |
1605 |
sf_close(hFile); |
sf_close(hFile); |
1606 |
file_changed(); |
file_changed(); |
1607 |
} catch (std::string what) { // remember the files that made trouble (and their cause) |
} catch (std::string what) { // remember the files that made trouble (and their cause) |
1608 |
if (error_files.size()) error_files += "\n"; |
if (!error_files.empty()) error_files += "\n"; |
1609 |
error_files += *iter += " (" + what + ")"; |
error_files += *iter += " (" + what + ")"; |
1610 |
} |
} |
1611 |
} |
} |
1612 |
// show error message box when some file(s) could not be opened / added |
// show error message box when some file(s) could not be opened / added |
1613 |
if (error_files.size()) { |
if (!error_files.empty()) { |
1614 |
Glib::ustring txt = _("Could not add the following sample(s):\n") + error_files; |
Glib::ustring txt = _("Could not add the following sample(s):\n") + error_files; |
1615 |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
1616 |
msg.run(); |
msg.run(); |
1623 |
if (!file) return; |
if (!file) return; |
1624 |
Gtk::FileChooserDialog dialog(*this, _("Select Folder"), |
Gtk::FileChooserDialog dialog(*this, _("Select Folder"), |
1625 |
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); |
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); |
1626 |
view::WrapLabel description( |
const char* str = |
1627 |
_("This is a very specific function. It tries to replace all samples " |
_("This is a very specific function. It tries to replace all samples " |
1628 |
"in the current gig file by samples located in the chosen " |
"in the current gig file by samples located in the chosen " |
1629 |
"directory.\n\n" |
"directory.\n\n" |
1637 |
"the sample in the gig file accordingly. If you don't need an " |
"the sample in the gig file accordingly. If you don't need an " |
1638 |
"extension, blank the field below. Any gig sample where no " |
"extension, blank the field below. Any gig sample where no " |
1639 |
"appropriate sample file could be found will be reported and left " |
"appropriate sample file could be found will be reported and left " |
1640 |
"untouched.\n") |
"untouched.\n"); |
1641 |
); |
#if GTKMM_MAJOR_VERSION < 3 |
1642 |
|
view::WrapLabel description(str); |
1643 |
|
#else |
1644 |
|
Gtk::Label description(str); |
1645 |
|
description.set_line_wrap(); |
1646 |
|
#endif |
1647 |
Gtk::HBox entryArea; |
Gtk::HBox entryArea; |
1648 |
Gtk::Label entryLabel( _("Add filename extension: "), Gtk::ALIGN_START); |
Gtk::Label entryLabel( _("Add filename extension: "), Gtk::ALIGN_START); |
1649 |
Gtk::Entry postfixEntryBox; |
Gtk::Entry postfixEntryBox; |
1703 |
} |
} |
1704 |
catch (std::string what) |
catch (std::string what) |
1705 |
{ |
{ |
1706 |
if (error_files.size()) error_files += "\n"; |
if (!error_files.empty()) error_files += "\n"; |
1707 |
error_files += filename += " (" + what + ")"; |
error_files += filename += " (" + what + ")"; |
1708 |
} |
} |
1709 |
} |
} |
1710 |
// show error message box when some file(s) could not be opened / added |
// show error message box when some file(s) could not be opened / added |
1711 |
if (error_files.size()) { |
if (!error_files.empty()) { |
1712 |
Glib::ustring txt = |
Glib::ustring txt = |
1713 |
_("Could not replace the following sample(s):\n") + error_files; |
_("Could not replace the following sample(s):\n") + error_files; |
1714 |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
1918 |
if (!iter) return; |
if (!iter) return; |
1919 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
1920 |
Glib::ustring name = row[m_Columns.m_col_name]; |
Glib::ustring name = row[m_Columns.m_col_name]; |
1921 |
|
|
1922 |
|
// change name in instrument menu |
1923 |
|
int index = path[0]; |
1924 |
|
const std::vector<Gtk::Widget*> children = instrument_menu->get_children(); |
1925 |
|
if (index < children.size()) { |
1926 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 16) || GTKMM_MAJOR_VERSION > 2 |
1927 |
|
static_cast<Gtk::RadioMenuItem*>(children[index])->set_label(name); |
1928 |
|
#else |
1929 |
|
remove_instrument_from_menu(index); |
1930 |
|
Gtk::RadioMenuItem* item = add_instrument_to_menu(name, index); |
1931 |
|
item->set_active(); |
1932 |
|
#endif |
1933 |
|
} |
1934 |
|
|
1935 |
|
// change name in gig |
1936 |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
gig::Instrument* instrument = row[m_Columns.m_col_instr]; |
1937 |
if (instrument && instrument->pInfo->Name != name.raw()) { |
if (instrument && instrument->pInfo->Name != name.raw()) { |
1938 |
instrument->pInfo->Name = name.raw(); |
instrument->pInfo->Name = name.raw(); |
1939 |
|
|
1940 |
|
// change name in the instrument properties window |
1941 |
|
if (instrumentProps.get_instrument() == instrument) { |
1942 |
|
instrumentProps.update_name(); |
1943 |
|
} |
1944 |
|
|
1945 |
file_changed(); |
file_changed(); |
1946 |
} |
} |
1947 |
} |
} |