1 |
/* |
/* |
2 |
* Copyright (C) 2006-2014 Andreas Persson |
* Copyright (C) 2006-2015 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 |
217 |
sigc::mem_fun(*this, &MainWindow::on_action_warn_user_on_extensions) |
sigc::mem_fun(*this, &MainWindow::on_action_warn_user_on_extensions) |
218 |
); |
); |
219 |
|
|
220 |
|
toggle_action = |
221 |
|
Gtk::ToggleAction::create("SyncSamplerInstrumentSelection", _("Synchronize sampler's instrument selection")); |
222 |
|
toggle_action->set_active(Settings::singleton()->syncSamplerInstrumentSelection); |
223 |
|
actionGroup->add( |
224 |
|
toggle_action, |
225 |
|
sigc::mem_fun(*this, &MainWindow::on_action_sync_sampler_instrument_selection) |
226 |
|
); |
227 |
|
|
228 |
|
|
229 |
actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools"))); |
actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools"))); |
230 |
|
|
344 |
" </menu>" |
" </menu>" |
345 |
" <menu action='MenuSettings'>" |
" <menu action='MenuSettings'>" |
346 |
" <menuitem action='WarnUserOnExtensions'/>" |
" <menuitem action='WarnUserOnExtensions'/>" |
347 |
|
" <menuitem action='SyncSamplerInstrumentSelection'/>" |
348 |
" </menu>" |
" </menu>" |
349 |
" <menu action='MenuHelp'>" |
" <menu action='MenuHelp'>" |
350 |
" <menuitem action='About'/>" |
" <menuitem action='About'/>" |
406 |
} |
} |
407 |
{ |
{ |
408 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
409 |
|
uiManager->get_widget("/MenuBar/MenuSettings/SyncSamplerInstrumentSelection")); |
410 |
|
item->set_tooltip_text(_("If checked, the sampler's current instrument will automatically be switched whenever another instrument was selected in gigedit (only available in live-mode).")); |
411 |
|
} |
412 |
|
{ |
413 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
414 |
uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments")); |
uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments")); |
415 |
item->set_tooltip_text(_("Create combi sounds out of individual sounds of this .gig file.")); |
item->set_tooltip_text(_("Create combi sounds out of individual sounds of this .gig file.")); |
416 |
} |
} |
467 |
{ |
{ |
468 |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(0); |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(0); |
469 |
Gtk::CellRendererText* cellrenderer = |
Gtk::CellRendererText* cellrenderer = |
470 |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer()); |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell()); |
471 |
column->add_attribute( |
column->add_attribute( |
472 |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
473 |
); |
); |
475 |
{ |
{ |
476 |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(1); |
Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(1); |
477 |
Gtk::CellRendererText* cellrenderer = |
Gtk::CellRendererText* cellrenderer = |
478 |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer()); |
dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell()); |
479 |
column->add_attribute( |
column->add_attribute( |
480 |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
cellrenderer->property_foreground(), m_SamplesModel.m_color |
481 |
); |
); |
702 |
} |
} |
703 |
|
|
704 |
m_RegionChooser.set_instrument(get_instrument()); |
m_RegionChooser.set_instrument(get_instrument()); |
705 |
|
|
706 |
|
if (Settings::singleton()->syncSamplerInstrumentSelection) { |
707 |
|
switch_sampler_instrument_signal.emit(get_instrument()); |
708 |
|
} |
709 |
} |
} |
710 |
|
|
711 |
void loader_progress_callback(gig::progress_t* progress) |
void loader_progress_callback(gig::progress_t* progress) |
726 |
void Loader::thread_function() |
void Loader::thread_function() |
727 |
{ |
{ |
728 |
printf("thread_function self=%x\n", Glib::Threads::Thread::self()); |
printf("thread_function self=%x\n", Glib::Threads::Thread::self()); |
729 |
printf("Start %s\n", filename); |
printf("Start %s\n", filename.c_str()); |
730 |
RIFF::File* riff = new RIFF::File(filename); |
try { |
731 |
gig = new gig::File(riff); |
RIFF::File* riff = new RIFF::File(filename); |
732 |
gig::progress_t progress; |
gig = new gig::File(riff); |
733 |
progress.callback = loader_progress_callback; |
gig::progress_t progress; |
734 |
progress.custom = this; |
progress.callback = loader_progress_callback; |
735 |
|
progress.custom = this; |
736 |
gig->GetInstrument(0, &progress); |
|
737 |
printf("End\n"); |
gig->GetInstrument(0, &progress); |
738 |
finished_dispatcher(); |
printf("End\n"); |
739 |
|
finished_dispatcher(); |
740 |
|
} catch (RIFF::Exception e) { |
741 |
|
error_message = e.Message; |
742 |
|
error_dispatcher.emit(); |
743 |
|
} catch (...) { |
744 |
|
error_message = _("Unknown exception occurred"); |
745 |
|
error_dispatcher.emit(); |
746 |
|
} |
747 |
} |
} |
748 |
|
|
749 |
Loader::Loader(const char* filename) |
Loader::Loader(const char* filename) |
750 |
: filename(filename), thread(0) |
: filename(filename), thread(0), progress(0.f) |
751 |
{ |
{ |
752 |
} |
} |
753 |
|
|
781 |
return finished_dispatcher; |
return finished_dispatcher; |
782 |
} |
} |
783 |
|
|
784 |
LoadDialog::LoadDialog(const Glib::ustring& title, Gtk::Window& parent) |
Glib::Dispatcher& Loader::signal_error() |
785 |
|
{ |
786 |
|
return error_dispatcher; |
787 |
|
} |
788 |
|
|
789 |
|
void saver_progress_callback(gig::progress_t* progress) |
790 |
|
{ |
791 |
|
Saver* saver = static_cast<Saver*>(progress->custom); |
792 |
|
saver->progress_callback(progress->factor); |
793 |
|
} |
794 |
|
|
795 |
|
void Saver::progress_callback(float fraction) |
796 |
|
{ |
797 |
|
{ |
798 |
|
Glib::Threads::Mutex::Lock lock(progressMutex); |
799 |
|
progress = fraction; |
800 |
|
} |
801 |
|
progress_dispatcher.emit(); |
802 |
|
} |
803 |
|
|
804 |
|
void Saver::thread_function() |
805 |
|
{ |
806 |
|
printf("thread_function self=%x\n", Glib::Threads::Thread::self()); |
807 |
|
printf("Start %s\n", filename.c_str()); |
808 |
|
try { |
809 |
|
gig::progress_t progress; |
810 |
|
progress.callback = saver_progress_callback; |
811 |
|
progress.custom = this; |
812 |
|
|
813 |
|
// if no filename was provided, that means "save", if filename was provided means "save as" |
814 |
|
if (filename.empty()) { |
815 |
|
gig->Save(&progress); |
816 |
|
} else { |
817 |
|
gig->Save(filename, &progress); |
818 |
|
} |
819 |
|
|
820 |
|
printf("End\n"); |
821 |
|
finished_dispatcher.emit(); |
822 |
|
} catch (RIFF::Exception e) { |
823 |
|
error_message = e.Message; |
824 |
|
error_dispatcher.emit(); |
825 |
|
} catch (...) { |
826 |
|
error_message = _("Unknown exception occurred"); |
827 |
|
error_dispatcher.emit(); |
828 |
|
} |
829 |
|
} |
830 |
|
|
831 |
|
Saver::Saver(gig::File* file, Glib::ustring filename) |
832 |
|
: gig(file), filename(filename), thread(0), progress(0.f) |
833 |
|
{ |
834 |
|
} |
835 |
|
|
836 |
|
void Saver::launch() |
837 |
|
{ |
838 |
|
#ifdef OLD_THREADS |
839 |
|
thread = Glib::Thread::create(sigc::mem_fun(*this, &Saver::thread_function), true); |
840 |
|
#else |
841 |
|
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Saver::thread_function)); |
842 |
|
#endif |
843 |
|
printf("launch thread=%x\n", thread); |
844 |
|
} |
845 |
|
|
846 |
|
float Saver::get_progress() |
847 |
|
{ |
848 |
|
float res; |
849 |
|
{ |
850 |
|
Glib::Threads::Mutex::Lock lock(progressMutex); |
851 |
|
res = progress; |
852 |
|
} |
853 |
|
return res; |
854 |
|
} |
855 |
|
|
856 |
|
Glib::Dispatcher& Saver::signal_progress() |
857 |
|
{ |
858 |
|
return progress_dispatcher; |
859 |
|
} |
860 |
|
|
861 |
|
Glib::Dispatcher& Saver::signal_finished() |
862 |
|
{ |
863 |
|
return finished_dispatcher; |
864 |
|
} |
865 |
|
|
866 |
|
Glib::Dispatcher& Saver::signal_error() |
867 |
|
{ |
868 |
|
return error_dispatcher; |
869 |
|
} |
870 |
|
|
871 |
|
ProgressDialog::ProgressDialog(const Glib::ustring& title, Gtk::Window& parent) |
872 |
: Gtk::Dialog(title, parent, true) |
: Gtk::Dialog(title, parent, true) |
873 |
{ |
{ |
874 |
get_vbox()->pack_start(progressBar); |
get_vbox()->pack_start(progressBar); |
875 |
show_all_children(); |
show_all_children(); |
876 |
|
resize(600,50); |
877 |
} |
} |
878 |
|
|
879 |
// Clear all GUI elements / controls. This method is typically called |
// Clear all GUI elements / controls. This method is typically called |
942 |
dialog.set_default_response(Gtk::RESPONSE_YES); |
dialog.set_default_response(Gtk::RESPONSE_YES); |
943 |
int response = dialog.run(); |
int response = dialog.run(); |
944 |
dialog.hide(); |
dialog.hide(); |
945 |
if (response == Gtk::RESPONSE_YES) return file_save(); |
|
946 |
return response != Gtk::RESPONSE_CANCEL; |
// TODO: the following return valid is disabled and hard coded instead for |
947 |
|
// now, due to the fact that saving with progress bar is now implemented |
948 |
|
// asynchronously, as a result the app does not close automatically anymore |
949 |
|
// after saving the file has completed |
950 |
|
// |
951 |
|
// if (response == Gtk::RESPONSE_YES) return file_save(); |
952 |
|
// return response != Gtk::RESPONSE_CANCEL; |
953 |
|
// |
954 |
|
if (response == Gtk::RESPONSE_YES) file_save(); |
955 |
|
return false; // always prevent closing the app for now (see comment above) |
956 |
} |
} |
957 |
|
|
958 |
bool MainWindow::leaving_shared_mode_dialog() { |
bool MainWindow::leaving_shared_mode_dialog() { |
1003 |
void MainWindow::load_file(const char* name) |
void MainWindow::load_file(const char* name) |
1004 |
{ |
{ |
1005 |
__clear(); |
__clear(); |
1006 |
load_dialog = new LoadDialog(_("Loading..."), *this); |
|
1007 |
load_dialog->show_all(); |
progress_dialog = new ProgressDialog( //FIXME: memory leak! |
1008 |
loader = new Loader(strdup(name)); |
_("Loading") + Glib::ustring(" '") + |
1009 |
|
Glib::filename_display_basename(name) + "' ...", |
1010 |
|
*this |
1011 |
|
); |
1012 |
|
progress_dialog->show_all(); |
1013 |
|
loader = new Loader(name); //FIXME: memory leak! |
1014 |
loader->signal_progress().connect( |
loader->signal_progress().connect( |
1015 |
sigc::mem_fun(*this, &MainWindow::on_loader_progress)); |
sigc::mem_fun(*this, &MainWindow::on_loader_progress)); |
1016 |
loader->signal_finished().connect( |
loader->signal_finished().connect( |
1017 |
sigc::mem_fun(*this, &MainWindow::on_loader_finished)); |
sigc::mem_fun(*this, &MainWindow::on_loader_finished)); |
1018 |
|
loader->signal_error().connect( |
1019 |
|
sigc::mem_fun(*this, &MainWindow::on_loader_error)); |
1020 |
loader->launch(); |
loader->launch(); |
1021 |
} |
} |
1022 |
|
|
1032 |
// load the instrument |
// load the instrument |
1033 |
gig::File* pFile = (gig::File*) instr->GetParent(); |
gig::File* pFile = (gig::File*) instr->GetParent(); |
1034 |
load_gig(pFile, 0 /*file name*/, true /*shared instrument*/); |
load_gig(pFile, 0 /*file name*/, true /*shared instrument*/); |
1035 |
//TODO: automatically select the given instrument |
// automatically select the given instrument |
1036 |
|
int i = 0; |
1037 |
|
for (gig::Instrument* instrument = pFile->GetFirstInstrument(); instrument; |
1038 |
|
instrument = pFile->GetNextInstrument(), ++i) |
1039 |
|
{ |
1040 |
|
if (instrument == instr) { |
1041 |
|
// select item in "instruments" tree view |
1042 |
|
m_TreeView.get_selection()->select(Gtk::TreePath(ToString(i))); |
1043 |
|
// make sure the selected item in the "instruments" tree view is |
1044 |
|
// visible (scroll to it) |
1045 |
|
m_TreeView.scroll_to_row(Gtk::TreePath(ToString(i))); |
1046 |
|
// select item in instrument menu |
1047 |
|
{ |
1048 |
|
const std::vector<Gtk::Widget*> children = |
1049 |
|
instrument_menu->get_children(); |
1050 |
|
static_cast<Gtk::RadioMenuItem*>(children[i])->set_active(); |
1051 |
|
} |
1052 |
|
// update region chooser and dimension region chooser |
1053 |
|
m_RegionChooser.set_instrument(instr); |
1054 |
|
break; |
1055 |
|
} |
1056 |
|
} |
1057 |
} |
} |
1058 |
|
|
1059 |
void MainWindow::on_loader_progress() |
void MainWindow::on_loader_progress() |
1060 |
{ |
{ |
1061 |
load_dialog->set_fraction(loader->get_progress()); |
progress_dialog->set_fraction(loader->get_progress()); |
1062 |
} |
} |
1063 |
|
|
1064 |
void MainWindow::on_loader_finished() |
void MainWindow::on_loader_finished() |
1065 |
{ |
{ |
1066 |
printf("Loader finished!\n"); |
printf("Loader finished!\n"); |
1067 |
printf("on_loader_finished self=%x\n", Glib::Threads::Thread::self()); |
printf("on_loader_finished self=%x\n", Glib::Threads::Thread::self()); |
1068 |
load_gig(loader->gig, loader->filename); |
load_gig(loader->gig, loader->filename.c_str()); |
1069 |
load_dialog->hide(); |
progress_dialog->hide(); |
1070 |
|
} |
1071 |
|
|
1072 |
|
void MainWindow::on_loader_error() |
1073 |
|
{ |
1074 |
|
Glib::ustring txt = _("Could not load file: ") + loader->error_message; |
1075 |
|
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
1076 |
|
msg.run(); |
1077 |
|
progress_dialog->hide(); |
1078 |
} |
} |
1079 |
|
|
1080 |
void MainWindow::on_action_file_save() |
void MainWindow::on_action_file_save() |
1113 |
|
|
1114 |
std::cout << "Saving file\n" << std::flush; |
std::cout << "Saving file\n" << std::flush; |
1115 |
file_structure_to_be_changed_signal.emit(this->file); |
file_structure_to_be_changed_signal.emit(this->file); |
1116 |
try { |
|
1117 |
file->Save(); |
progress_dialog = new ProgressDialog( //FIXME: memory leak! |
1118 |
if (file_is_changed) { |
_("Saving") + Glib::ustring(" '") + |
1119 |
set_title(get_title().substr(1)); |
Glib::filename_display_basename(this->filename) + "' ...", |
1120 |
file_is_changed = false; |
*this |
1121 |
} |
); |
1122 |
} catch (RIFF::Exception e) { |
progress_dialog->show_all(); |
1123 |
file_structure_changed_signal.emit(this->file); |
saver = new Saver(this->file); //FIXME: memory leak! |
1124 |
Glib::ustring txt = _("Could not save file: ") + e.Message; |
saver->signal_progress().connect( |
1125 |
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
sigc::mem_fun(*this, &MainWindow::on_saver_progress)); |
1126 |
msg.run(); |
saver->signal_finished().connect( |
1127 |
return false; |
sigc::mem_fun(*this, &MainWindow::on_saver_finished)); |
1128 |
} |
saver->signal_error().connect( |
1129 |
std::cout << "Saving file done\n" << std::flush; |
sigc::mem_fun(*this, &MainWindow::on_saver_error)); |
1130 |
|
saver->launch(); |
1131 |
|
|
1132 |
|
return true; |
1133 |
|
} |
1134 |
|
|
1135 |
|
void MainWindow::on_saver_progress() |
1136 |
|
{ |
1137 |
|
progress_dialog->set_fraction(saver->get_progress()); |
1138 |
|
} |
1139 |
|
|
1140 |
|
void MainWindow::on_saver_error() |
1141 |
|
{ |
1142 |
|
file_structure_changed_signal.emit(this->file); |
1143 |
|
Glib::ustring txt = _("Could not save file: ") + saver->error_message; |
1144 |
|
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
1145 |
|
msg.run(); |
1146 |
|
} |
1147 |
|
|
1148 |
|
void MainWindow::on_saver_finished() |
1149 |
|
{ |
1150 |
|
this->file = saver->gig; |
1151 |
|
this->filename = saver->filename; |
1152 |
|
current_gig_dir = Glib::path_get_dirname(filename); |
1153 |
|
set_title(Glib::filename_display_basename(filename)); |
1154 |
|
file_has_name = true; |
1155 |
|
file_is_changed = false; |
1156 |
|
std::cout << "Saving file done. Importing queued samples now ...\n" << std::flush; |
1157 |
__import_queued_samples(); |
__import_queued_samples(); |
1158 |
|
std::cout << "Importing queued samples done.\n" << std::flush; |
1159 |
|
|
1160 |
file_structure_changed_signal.emit(this->file); |
file_structure_changed_signal.emit(this->file); |
1161 |
return true; |
|
1162 |
|
load_gig(this->file, this->filename.c_str()); |
1163 |
|
progress_dialog->hide(); |
1164 |
} |
} |
1165 |
|
|
1166 |
void MainWindow::on_action_file_save_as() |
void MainWindow::on_action_file_save_as() |
1225 |
descriptionArea.show_all(); |
descriptionArea.show_all(); |
1226 |
|
|
1227 |
if (dialog.run() == Gtk::RESPONSE_OK) { |
if (dialog.run() == Gtk::RESPONSE_OK) { |
1228 |
file_structure_to_be_changed_signal.emit(this->file); |
std::string filename = dialog.get_filename(); |
1229 |
try { |
if (!Glib::str_has_suffix(filename, ".gig")) { |
1230 |
std::string filename = dialog.get_filename(); |
filename += ".gig"; |
|
if (!Glib::str_has_suffix(filename, ".gig")) { |
|
|
filename += ".gig"; |
|
|
} |
|
|
printf("filename=%s\n", filename.c_str()); |
|
|
file->Save(filename); |
|
|
this->filename = filename; |
|
|
current_gig_dir = Glib::path_get_dirname(filename); |
|
|
set_title(Glib::filename_display_basename(filename)); |
|
|
file_has_name = true; |
|
|
file_is_changed = false; |
|
|
} catch (RIFF::Exception e) { |
|
|
file_structure_changed_signal.emit(this->file); |
|
|
Glib::ustring txt = _("Could not save file: ") + e.Message; |
|
|
Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR); |
|
|
msg.run(); |
|
|
return false; |
|
1231 |
} |
} |
1232 |
__import_queued_samples(); |
printf("filename=%s\n", filename.c_str()); |
1233 |
file_structure_changed_signal.emit(this->file); |
|
1234 |
|
progress_dialog = new ProgressDialog( //FIXME: memory leak! |
1235 |
|
_("Saving") + Glib::ustring(" '") + |
1236 |
|
Glib::filename_display_basename(filename) + "' ...", |
1237 |
|
*this |
1238 |
|
); |
1239 |
|
progress_dialog->show_all(); |
1240 |
|
|
1241 |
|
saver = new Saver(file, filename); //FIXME: memory leak! |
1242 |
|
saver->signal_progress().connect( |
1243 |
|
sigc::mem_fun(*this, &MainWindow::on_saver_progress)); |
1244 |
|
saver->signal_finished().connect( |
1245 |
|
sigc::mem_fun(*this, &MainWindow::on_saver_finished)); |
1246 |
|
saver->signal_error().connect( |
1247 |
|
sigc::mem_fun(*this, &MainWindow::on_saver_error)); |
1248 |
|
saver->launch(); |
1249 |
|
|
1250 |
return true; |
return true; |
1251 |
} |
} |
1252 |
return false; |
return false; |
1357 |
!Settings::singleton()->warnUserOnExtensions; |
!Settings::singleton()->warnUserOnExtensions; |
1358 |
} |
} |
1359 |
|
|
1360 |
|
void MainWindow::on_action_sync_sampler_instrument_selection() { |
1361 |
|
Settings::singleton()->syncSamplerInstrumentSelection = |
1362 |
|
!Settings::singleton()->syncSamplerInstrumentSelection; |
1363 |
|
} |
1364 |
|
|
1365 |
void MainWindow::on_action_help_about() |
void MainWindow::on_action_help_about() |
1366 |
{ |
{ |
1367 |
Gtk::AboutDialog dialog; |
Gtk::AboutDialog dialog; |
1371 |
dialog.set_name("Gigedit"); |
dialog.set_name("Gigedit"); |
1372 |
#endif |
#endif |
1373 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
1374 |
dialog.set_copyright("Copyright (C) 2006-2014 Andreas Persson"); |
dialog.set_copyright("Copyright (C) 2006-2015 Andreas Persson"); |
1375 |
const std::string sComment = |
const std::string sComment = |
1376 |
_("Built " __DATE__ "\nUsing ") + |
_("Built " __DATE__ "\nUsing ") + |
1377 |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
2909 |
); |
); |
2910 |
} |
} |
2911 |
|
|
2912 |
// Note: requires that this file already has a filename ! |
// Finally save gig file persistently to disk ... |
2913 |
this->file->Save(); |
//NOTE: requires that this gig file already has a filename ! |
2914 |
|
{ |
2915 |
|
std::cout << "Saving file\n" << std::flush; |
2916 |
|
file_structure_to_be_changed_signal.emit(this->file); |
2917 |
|
|
2918 |
|
progress_dialog = new ProgressDialog( //FIXME: memory leak! |
2919 |
|
_("Saving") + Glib::ustring(" '") + |
2920 |
|
Glib::filename_display_basename(this->filename) + "' ...", |
2921 |
|
*this |
2922 |
|
); |
2923 |
|
progress_dialog->show_all(); |
2924 |
|
saver = new Saver(this->file); //FIXME: memory leak! |
2925 |
|
saver->signal_progress().connect( |
2926 |
|
sigc::mem_fun(*this, &MainWindow::on_saver_progress)); |
2927 |
|
saver->signal_finished().connect( |
2928 |
|
sigc::mem_fun(*this, &MainWindow::on_saver_finished)); |
2929 |
|
saver->signal_error().connect( |
2930 |
|
sigc::mem_fun(*this, &MainWindow::on_saver_error)); |
2931 |
|
saver->launch(); |
2932 |
|
} |
2933 |
} |
} |
2934 |
|
|
2935 |
void MainWindow::on_action_merge_files() { |
void MainWindow::on_action_merge_files() { |
3019 |
Gdk::Pixbuf::create_from_xpm_data(status_detached_xpm) |
Gdk::Pixbuf::create_from_xpm_data(status_detached_xpm) |
3020 |
); |
); |
3021 |
} |
} |
3022 |
|
|
3023 |
|
{ |
3024 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
3025 |
|
uiManager->get_widget("/MenuBar/MenuSettings/SyncSamplerInstrumentSelection")); |
3026 |
|
if (item) item->set_sensitive(b); |
3027 |
|
} |
3028 |
} |
} |
3029 |
|
|
3030 |
void MainWindow::on_sample_ref_count_incremented(gig::Sample* sample, int offset) { |
void MainWindow::on_sample_ref_count_incremented(gig::Sample* sample, int offset) { |
3053 |
// just in case a new sample is added later with exactly the same memory |
// just in case a new sample is added later with exactly the same memory |
3054 |
// address, which would lead to incorrect refcount if not deleted here |
// address, which would lead to incorrect refcount if not deleted here |
3055 |
for (std::list<gig::Sample*>::const_iterator it = samples.begin(); |
for (std::list<gig::Sample*>::const_iterator it = samples.begin(); |
3056 |
it != samples.end(); it != samples.end()) |
it != samples.end(); ++it) |
3057 |
{ |
{ |
3058 |
sample_ref_count.erase(*it); |
sample_ref_count.erase(*it); |
3059 |
} |
} |
3126 |
sigc::signal<void, int/*key*/, int/*velocity*/>& MainWindow::signal_keyboard_key_released() { |
sigc::signal<void, int/*key*/, int/*velocity*/>& MainWindow::signal_keyboard_key_released() { |
3127 |
return m_RegionChooser.signal_keyboard_key_released(); |
return m_RegionChooser.signal_keyboard_key_released(); |
3128 |
} |
} |
3129 |
|
|
3130 |
|
sigc::signal<void, gig::Instrument*>& MainWindow::signal_switch_sampler_instrument() { |
3131 |
|
return switch_sampler_instrument_signal; |
3132 |
|
} |