1 |
/* |
/* |
2 |
* Copyright (C) 2006-2013 Andreas Persson |
* Copyright (C) 2006-2014 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 |
123 |
Gtk::Stock::PROPERTIES), |
Gtk::Stock::PROPERTIES), |
124 |
sigc::mem_fun( |
sigc::mem_fun( |
125 |
*this, &MainWindow::show_instr_props)); |
*this, &MainWindow::show_instr_props)); |
126 |
|
actionGroup->add(Gtk::Action::create("MidiRules", |
127 |
|
_("_Midi Rules")), |
128 |
|
sigc::mem_fun( |
129 |
|
*this, &MainWindow::show_midi_rules)); |
130 |
actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT), |
actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT), |
131 |
sigc::mem_fun( |
sigc::mem_fun( |
132 |
*this, &MainWindow::on_action_quit)); |
*this, &MainWindow::on_action_quit)); |
241 |
" </menubar>" |
" </menubar>" |
242 |
" <popup name='PopupMenu'>" |
" <popup name='PopupMenu'>" |
243 |
" <menuitem action='InstrProperties'/>" |
" <menuitem action='InstrProperties'/>" |
244 |
|
" <menuitem action='MidiRules'/>" |
245 |
" <menuitem action='AddInstrument'/>" |
" <menuitem action='AddInstrument'/>" |
246 |
" <menuitem action='DupInstrument'/>" |
" <menuitem action='DupInstrument'/>" |
247 |
" <separator/>" |
" <separator/>" |
332 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
333 |
propDialog.signal_changed().connect( |
propDialog.signal_changed().connect( |
334 |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
sigc::mem_fun(*this, &MainWindow::file_changed)); |
335 |
|
midiRules.signal_changed().connect( |
336 |
|
sigc::mem_fun(*this, &MainWindow::file_changed)); |
337 |
|
|
338 |
dimreg_edit.signal_dimreg_to_be_changed().connect( |
dimreg_edit.signal_dimreg_to_be_changed().connect( |
339 |
dimreg_to_be_changed_signal.make_slot()); |
dimreg_to_be_changed_signal.make_slot()); |
943 |
dialog.set_name("Gigedit"); |
dialog.set_name("Gigedit"); |
944 |
#endif |
#endif |
945 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
946 |
dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson"); |
dialog.set_copyright("Copyright (C) 2006-2014 Andreas Persson"); |
947 |
dialog.set_comments(_( |
const std::string sComment = |
948 |
"Released under the GNU General Public License.\n" |
_("Built " __DATE__ "\nUsing ") + |
949 |
"\n" |
::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" + |
950 |
"Please notice that this is still a very young instrument editor. " |
_( |
951 |
"So better backup your Gigasampler files before editing them with " |
"Gigedit is released under the GNU General Public License.\n" |
952 |
"this application.\n" |
"\n" |
953 |
"\n" |
"Please notice that this is still a very young instrument editor. " |
954 |
"Please report bugs to: http://bugs.linuxsampler.org") |
"So better backup your Gigasampler files before editing them with " |
955 |
); |
"this application.\n" |
956 |
|
"\n" |
957 |
|
"Please report bugs to: http://bugs.linuxsampler.org" |
958 |
|
); |
959 |
|
dialog.set_comments(sComment.c_str()); |
960 |
dialog.set_website("http://www.linuxsampler.org"); |
dialog.set_website("http://www.linuxsampler.org"); |
961 |
dialog.set_website_label("http://www.linuxsampler.org"); |
dialog.set_website_label("http://www.linuxsampler.org"); |
962 |
dialog.run(); |
dialog.run(); |
1222 |
m_TreeView.get_selection()->select(Gtk::TreePath("0")); |
m_TreeView.get_selection()->select(Gtk::TreePath("0")); |
1223 |
|
|
1224 |
instr_props_set_instrument(); |
instr_props_set_instrument(); |
1225 |
|
gig::Instrument* instrument = get_instrument(); |
1226 |
|
if (instrument) { |
1227 |
|
midiRules.set_instrument(instrument); |
1228 |
|
} |
1229 |
} |
} |
1230 |
|
|
1231 |
bool MainWindow::instr_props_set_instrument() |
bool MainWindow::instr_props_set_instrument() |
1273 |
} |
} |
1274 |
} |
} |
1275 |
|
|
1276 |
|
void MainWindow::show_midi_rules() |
1277 |
|
{ |
1278 |
|
if (gig::Instrument* instrument = get_instrument()) |
1279 |
|
{ |
1280 |
|
midiRules.set_instrument(instrument); |
1281 |
|
midiRules.show(); |
1282 |
|
midiRules.deiconify(); |
1283 |
|
} |
1284 |
|
} |
1285 |
|
|
1286 |
void MainWindow::on_action_view_status_bar() { |
void MainWindow::on_action_view_status_bar() { |
1287 |
Gtk::CheckMenuItem* item = |
Gtk::CheckMenuItem* item = |
1288 |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
1329 |
if (button->type == GDK_2BUTTON_PRESS) { |
if (button->type == GDK_2BUTTON_PRESS) { |
1330 |
show_instr_props(); |
show_instr_props(); |
1331 |
} else if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
} else if (button->type == GDK_BUTTON_PRESS && button->button == 3) { |
1332 |
|
// gig v2 files have no midi rules |
1333 |
|
static_cast<Gtk::MenuItem*>( |
1334 |
|
uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive( |
1335 |
|
!(file->pVersion && file->pVersion->major == 2)); |
1336 |
popup_menu->popup(button->button, button->time); |
popup_menu->popup(button->button, button->time); |
1337 |
} |
} |
1338 |
} |
} |
1505 |
} |
} |
1506 |
#endif |
#endif |
1507 |
instr_props_set_instrument(); |
instr_props_set_instrument(); |
1508 |
|
instr = get_instrument(); |
1509 |
|
if (instr) { |
1510 |
|
midiRules.set_instrument(instr); |
1511 |
|
} else { |
1512 |
|
midiRules.hide(); |
1513 |
|
} |
1514 |
} catch (RIFF::Exception e) { |
} catch (RIFF::Exception e) { |
1515 |
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR); |
1516 |
msg.run(); |
msg.run(); |
1659 |
&instrument, sizeof(instrument)) != SF_FALSE) |
&instrument, sizeof(instrument)) != SF_FALSE) |
1660 |
{ |
{ |
1661 |
sample->MIDIUnityNote = instrument.basenote; |
sample->MIDIUnityNote = instrument.basenote; |
1662 |
|
sample->FineTune = instrument.detune; |
1663 |
|
|
1664 |
if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) { |
if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) { |
1665 |
sample->Loops = 1; |
sample->Loops = 1; |