186 |
actionGroup->add(toggle_action, |
actionGroup->add(toggle_action, |
187 |
sigc::mem_fun( |
sigc::mem_fun( |
188 |
*this, &MainWindow::on_action_view_status_bar)); |
*this, &MainWindow::on_action_view_status_bar)); |
189 |
|
actionGroup->add( |
190 |
|
Gtk::Action::create("RefreshAll", _("_Refresh All")), |
191 |
|
sigc::mem_fun(*this, &MainWindow::on_action_refresh_all) |
192 |
|
); |
193 |
|
|
194 |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
195 |
actionGroup->add(Gtk::Action::create("MenuHelp", |
actionGroup->add(Gtk::Action::create("MenuHelp", |
229 |
sigc::mem_fun(*this, &MainWindow::on_action_sync_sampler_instrument_selection) |
sigc::mem_fun(*this, &MainWindow::on_action_sync_sampler_instrument_selection) |
230 |
); |
); |
231 |
|
|
232 |
|
toggle_action = |
233 |
|
Gtk::ToggleAction::create("MoveRootNoteWithRegionMoved", _("Move root note with region moved")); |
234 |
|
toggle_action->set_active(Settings::singleton()->moveRootNoteWithRegionMoved); |
235 |
|
actionGroup->add( |
236 |
|
toggle_action, |
237 |
|
sigc::mem_fun(*this, &MainWindow::on_action_move_root_note_with_region_moved) |
238 |
|
); |
239 |
|
|
240 |
|
|
241 |
actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools"))); |
actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools"))); |
242 |
|
|
269 |
sigc::mem_fun(*this, &MainWindow::on_action_remove_sample) |
sigc::mem_fun(*this, &MainWindow::on_action_remove_sample) |
270 |
); |
); |
271 |
actionGroup->add( |
actionGroup->add( |
272 |
|
Gtk::Action::create("RemoveUnusedSamples", _("Remove _Unused Samples")), |
273 |
|
sigc::mem_fun(*this, &MainWindow::on_action_remove_unused_samples) |
274 |
|
); |
275 |
|
actionGroup->add( |
276 |
Gtk::Action::create("ShowSampleRefs", _("Show References...")), |
Gtk::Action::create("ShowSampleRefs", _("Show References...")), |
277 |
sigc::mem_fun(*this, &MainWindow::on_action_view_references) |
sigc::mem_fun(*this, &MainWindow::on_action_view_references) |
278 |
); |
); |
337 |
" <menuitem action='ReplaceAllSamplesInAllGroups' />" |
" <menuitem action='ReplaceAllSamplesInAllGroups' />" |
338 |
" <separator/>" |
" <separator/>" |
339 |
" <menuitem action='RemoveSample'/>" |
" <menuitem action='RemoveSample'/>" |
340 |
|
" <menuitem action='RemoveUnusedSamples'/>" |
341 |
" </menu>" |
" </menu>" |
342 |
" <menu action='MenuInstrument'>" |
" <menu action='MenuInstrument'>" |
343 |
" <menu action='AllInstruments'>" |
" <menu action='AllInstruments'>" |
360 |
" </menu>" |
" </menu>" |
361 |
" <menu action='MenuView'>" |
" <menu action='MenuView'>" |
362 |
" <menuitem action='Statusbar'/>" |
" <menuitem action='Statusbar'/>" |
363 |
|
" <separator/>" |
364 |
|
" <menuitem action='RefreshAll'/>" |
365 |
" </menu>" |
" </menu>" |
366 |
" <menu action='MenuTools'>" |
" <menu action='MenuTools'>" |
367 |
" <menuitem action='CombineInstruments'/>" |
" <menuitem action='CombineInstruments'/>" |
370 |
" <menu action='MenuSettings'>" |
" <menu action='MenuSettings'>" |
371 |
" <menuitem action='WarnUserOnExtensions'/>" |
" <menuitem action='WarnUserOnExtensions'/>" |
372 |
" <menuitem action='SyncSamplerInstrumentSelection'/>" |
" <menuitem action='SyncSamplerInstrumentSelection'/>" |
373 |
|
" <menuitem action='MoveRootNoteWithRegionMoved'/>" |
374 |
" </menu>" |
" </menu>" |
375 |
" <menu action='MenuHelp'>" |
" <menu action='MenuHelp'>" |
376 |
" <menuitem action='About'/>" |
" <menuitem action='About'/>" |
394 |
" <menuitem action='ReplaceAllSamplesInAllGroups' />" |
" <menuitem action='ReplaceAllSamplesInAllGroups' />" |
395 |
" <separator/>" |
" <separator/>" |
396 |
" <menuitem action='RemoveSample'/>" |
" <menuitem action='RemoveSample'/>" |
397 |
|
" <menuitem action='RemoveUnusedSamples'/>" |
398 |
" </popup>" |
" </popup>" |
399 |
" <popup name='ScriptPopupMenu'>" |
" <popup name='ScriptPopupMenu'>" |
400 |
" <menuitem action='AddScriptGroup'/>" |
" <menuitem action='AddScriptGroup'/>" |
439 |
} |
} |
440 |
{ |
{ |
441 |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
442 |
|
uiManager->get_widget("/MenuBar/MenuSettings/MoveRootNoteWithRegionMoved")); |
443 |
|
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.")); |
444 |
|
} |
445 |
|
{ |
446 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
447 |
|
uiManager->get_widget("/MenuBar/MenuSample/RemoveUnusedSamples")); |
448 |
|
item->set_tooltip_text(_("Removes all samples that are not referenced by any instrument (i.e. red ones).")); |
449 |
|
// copy tooltip to popup menu |
450 |
|
Gtk::MenuItem* item2 = dynamic_cast<Gtk::MenuItem*>( |
451 |
|
uiManager->get_widget("/SamplePopupMenu/RemoveUnusedSamples")); |
452 |
|
item2->set_tooltip_text(item->get_tooltip_text()); |
453 |
|
} |
454 |
|
{ |
455 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
456 |
|
uiManager->get_widget("/MenuBar/MenuView/RefreshAll")); |
457 |
|
item->set_tooltip_text(_("Reloads the currently open gig file and updates the entire graphical user interface.")); |
458 |
|
} |
459 |
|
{ |
460 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
461 |
uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments")); |
uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments")); |
462 |
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.")); |
463 |
} |
} |
605 |
sigc::hide(sigc::mem_fun(*this, &MainWindow::file_changed))); |
sigc::hide(sigc::mem_fun(*this, &MainWindow::file_changed))); |
606 |
m_RegionChooser.signal_instrument_changed().connect( |
m_RegionChooser.signal_instrument_changed().connect( |
607 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
608 |
|
m_RegionChooser.signal_instrument_changed().connect( |
609 |
|
sigc::mem_fun(*this, &MainWindow::region_changed)); |
610 |
m_DimRegionChooser.signal_region_changed().connect( |
m_DimRegionChooser.signal_region_changed().connect( |
611 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
612 |
instrumentProps.signal_changed().connect( |
instrumentProps.signal_changed().connect( |
1439 |
!Settings::singleton()->syncSamplerInstrumentSelection; |
!Settings::singleton()->syncSamplerInstrumentSelection; |
1440 |
} |
} |
1441 |
|
|
1442 |
|
void MainWindow::on_action_move_root_note_with_region_moved() { |
1443 |
|
Settings::singleton()->moveRootNoteWithRegionMoved = |
1444 |
|
!Settings::singleton()->moveRootNoteWithRegionMoved; |
1445 |
|
} |
1446 |
|
|
1447 |
void MainWindow::on_action_help_about() |
void MainWindow::on_action_help_about() |
1448 |
{ |
{ |
1449 |
Gtk::AboutDialog dialog; |
Gtk::AboutDialog dialog; |
1736 |
file = 0; |
file = 0; |
1737 |
set_file_is_shared(isSharedInstrument); |
set_file_is_shared(isSharedInstrument); |
1738 |
|
|
1739 |
this->filename = filename ? filename : _("Unsaved Gig File"); |
this->filename = |
1740 |
|
(filename && strlen(filename) > 0) ? |
1741 |
|
filename : (!gig->GetFileName().empty()) ? |
1742 |
|
gig->GetFileName() : _("Unsaved Gig File"); |
1743 |
set_title(Glib::filename_display_basename(this->filename)); |
set_title(Glib::filename_display_basename(this->filename)); |
1744 |
file_has_name = filename; |
file_has_name = filename; |
1745 |
file_is_changed = false; |
file_is_changed = false; |
1893 |
window->show(); |
window->show(); |
1894 |
} |
} |
1895 |
|
|
1896 |
|
void MainWindow::on_action_refresh_all() { |
1897 |
|
__refreshEntireGUI(); |
1898 |
|
} |
1899 |
|
|
1900 |
void MainWindow::on_action_view_status_bar() { |
void MainWindow::on_action_view_status_bar() { |
1901 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
1902 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
2768 |
} |
} |
2769 |
} |
} |
2770 |
|
|
2771 |
|
void MainWindow::on_action_remove_unused_samples() { |
2772 |
|
if (!file) return; |
2773 |
|
|
2774 |
|
// collect all samples that are not referenced by any instrument |
2775 |
|
std::list<gig::Sample*> lsamples; |
2776 |
|
for (int iSample = 0; file->GetSample(iSample); ++iSample) { |
2777 |
|
gig::Sample* sample = file->GetSample(iSample); |
2778 |
|
bool isUsed = false; |
2779 |
|
for (gig::Instrument* instrument = file->GetFirstInstrument(); instrument; |
2780 |
|
instrument = file->GetNextInstrument()) |
2781 |
|
{ |
2782 |
|
for (gig::Region* rgn = instrument->GetFirstRegion(); rgn; |
2783 |
|
rgn = instrument->GetNextRegion()) |
2784 |
|
{ |
2785 |
|
for (int i = 0; i < 256; ++i) { |
2786 |
|
if (!rgn->pDimensionRegions[i]) continue; |
2787 |
|
if (rgn->pDimensionRegions[i]->pSample != sample) continue; |
2788 |
|
isUsed = true; |
2789 |
|
goto endOfRefSearch; |
2790 |
|
} |
2791 |
|
} |
2792 |
|
} |
2793 |
|
endOfRefSearch: |
2794 |
|
if (!isUsed) lsamples.push_back(sample); |
2795 |
|
} |
2796 |
|
|
2797 |
|
if (lsamples.empty()) return; |
2798 |
|
|
2799 |
|
// notify everybody that we're going to remove these samples |
2800 |
|
samples_to_be_removed_signal.emit(lsamples); |
2801 |
|
|
2802 |
|
// remove collected samples |
2803 |
|
try { |
2804 |
|
for (std::list<gig::Sample*>::iterator itSample = lsamples.begin(); |
2805 |
|
itSample != lsamples.end(); ++itSample) |
2806 |
|
{ |
2807 |
|
gig::Sample* sample = *itSample; |
2808 |
|
// remove sample from the .gig file |
2809 |
|
file->DeleteSample(sample); |
2810 |
|
// if sample was just previously added, remove it fro the import queue |
2811 |
|
for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin(); |
2812 |
|
iter != m_SampleImportQueue.end(); ++iter) |
2813 |
|
{ |
2814 |
|
if ((*iter).gig_sample == sample) { |
2815 |
|
printf("Removing previously added sample '%s'\n", |
2816 |
|
(*iter).sample_path.c_str()); |
2817 |
|
m_SampleImportQueue.erase(iter); |
2818 |
|
break; |
2819 |
|
} |
2820 |
|
} |
2821 |
|
} |
2822 |
|
} catch (RIFF::Exception e) { |
2823 |
|
// show error message |
2824 |
|
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
2825 |
|
msg.run(); |
2826 |
|
} |
2827 |
|
|
2828 |
|
// notify everybody that we're done with removal |
2829 |
|
samples_removed_signal.emit(); |
2830 |
|
|
2831 |
|
dimreg_changed(); |
2832 |
|
file_changed(); |
2833 |
|
__refreshEntireGUI(); |
2834 |
|
} |
2835 |
|
|
2836 |
// see comment on on_sample_treeview_drag_begin() |
// see comment on on_sample_treeview_drag_begin() |
2837 |
void MainWindow::on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context) |
void MainWindow::on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context) |
2838 |
{ |
{ |
3305 |
} |
} |
3306 |
|
|
3307 |
// update GUI |
// update GUI |
3308 |
__refreshEntireGUI(); |
__refreshEntireGUI(); |
3309 |
} |
} |
3310 |
} |
} |
3311 |
|
|