24 |
#include <gtkmm/stock.h> |
#include <gtkmm/stock.h> |
25 |
#include <gtkmm/targetentry.h> |
#include <gtkmm/targetentry.h> |
26 |
#include <gtkmm/main.h> |
#include <gtkmm/main.h> |
27 |
|
#include <gtkmm/toggleaction.h> |
28 |
|
|
29 |
#include "global.h" |
#include "global.h" |
30 |
|
|
130 |
*this, &MainWindow::on_action_quit)); |
*this, &MainWindow::on_action_quit)); |
131 |
actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument"))); |
actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument"))); |
132 |
|
|
133 |
|
actionGroup->add(Gtk::Action::create("MenuView", _("_View"))); |
134 |
|
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
135 |
|
Gtk::ToggleAction::create("Statusbar", _("_Statusbar")); |
136 |
|
toggle_action->set_active(true); |
137 |
|
actionGroup->add(toggle_action, |
138 |
|
sigc::mem_fun( |
139 |
|
*this, &MainWindow::on_action_view_status_bar)); |
140 |
|
|
141 |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
142 |
actionGroup->add(Gtk::Action::create("MenuHelp", |
actionGroup->add(Gtk::Action::create("MenuHelp", |
143 |
action->property_label())); |
action->property_label())); |
193 |
" </menu>" |
" </menu>" |
194 |
" <menu action='MenuInstrument'>" |
" <menu action='MenuInstrument'>" |
195 |
" </menu>" |
" </menu>" |
196 |
|
" <menu action='MenuView'>" |
197 |
|
" <menuitem action='Statusbar'/>" |
198 |
|
" </menu>" |
199 |
#ifdef ABOUT_DIALOG |
#ifdef ABOUT_DIALOG |
200 |
" <menu action='MenuHelp'>" |
" <menu action='MenuHelp'>" |
201 |
" <menuitem action='About'/>" |
" <menuitem action='About'/>" |
786 |
#ifdef ABOUT_DIALOG |
#ifdef ABOUT_DIALOG |
787 |
Gtk::AboutDialog dialog; |
Gtk::AboutDialog dialog; |
788 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
789 |
|
dialog.set_copyright("Copyright (C) 2006,2007 Andreas Persson"); |
790 |
|
dialog.set_comments( |
791 |
|
"Released under the GNU General Public License.\n" |
792 |
|
"\n" |
793 |
|
"Please notice that this is still a very young instrument editor. " |
794 |
|
"So better backup your Gigasampler files before editing them with " |
795 |
|
"this application.\n" |
796 |
|
"\n" |
797 |
|
"Please report bugs to: http://bugs.linuxsampler.org" |
798 |
|
); |
799 |
|
dialog.set_website("http://www.linuxsampler.org"); |
800 |
|
dialog.set_website_label("http://www.linuxsampler.org"); |
801 |
dialog.run(); |
dialog.run(); |
802 |
#endif |
#endif |
803 |
} |
} |
858 |
entry[15].set_text(info->Subject); |
entry[15].set_text(info->Subject); |
859 |
} |
} |
860 |
|
|
861 |
|
void InstrumentProps::set_IsDrum(bool value) |
862 |
|
{ |
863 |
|
instrument->IsDrum = value; |
864 |
|
} |
865 |
|
|
866 |
|
void InstrumentProps::set_MIDIBank(uint16_t value) |
867 |
|
{ |
868 |
|
instrument->MIDIBank = value; |
869 |
|
} |
870 |
|
|
871 |
|
void InstrumentProps::set_MIDIProgram(uint32_t value) |
872 |
|
{ |
873 |
|
instrument->MIDIProgram = value; |
874 |
|
} |
875 |
|
|
876 |
|
void InstrumentProps::set_DimensionKeyRange_low(uint8_t value) |
877 |
|
{ |
878 |
|
instrument->DimensionKeyRange.low = value; |
879 |
|
if (value > instrument->DimensionKeyRange.high) { |
880 |
|
eDimensionKeyRangeHigh.set_value(value); |
881 |
|
} |
882 |
|
} |
883 |
|
|
884 |
|
void InstrumentProps::set_DimensionKeyRange_high(uint8_t value) |
885 |
|
{ |
886 |
|
instrument->DimensionKeyRange.high = value; |
887 |
|
if (value < instrument->DimensionKeyRange.low) { |
888 |
|
eDimensionKeyRangeLow.set_value(value); |
889 |
|
} |
890 |
|
} |
891 |
|
|
892 |
void InstrumentProps::add_prop(BoolEntry& boolentry) |
void InstrumentProps::add_prop(BoolEntry& boolentry) |
893 |
{ |
{ |
894 |
table.attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
table.attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
895 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
896 |
rowno++; |
rowno++; |
|
boolentry.signal_changed_by_user().connect(instrument_changed.make_slot()); |
|
897 |
} |
} |
898 |
|
|
899 |
void InstrumentProps::add_prop(BoolEntryPlus6& boolentry) |
void InstrumentProps::add_prop(BoolEntryPlus6& boolentry) |
901 |
table.attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
table.attach(boolentry.widget, 0, 2, rowno, rowno + 1, |
902 |
Gtk::FILL, Gtk::SHRINK); |
Gtk::FILL, Gtk::SHRINK); |
903 |
rowno++; |
rowno++; |
|
boolentry.signal_changed_by_user().connect(instrument_changed.make_slot()); |
|
904 |
} |
} |
905 |
|
|
906 |
void InstrumentProps::add_prop(LabelWidget& prop) |
void InstrumentProps::add_prop(LabelWidget& prop) |
910 |
table.attach(prop.widget, 1, 2, rowno, rowno + 1, |
table.attach(prop.widget, 1, 2, rowno, rowno + 1, |
911 |
Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); |
Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); |
912 |
rowno++; |
rowno++; |
|
prop.signal_changed_by_user().connect(instrument_changed.make_slot()); |
|
913 |
} |
} |
914 |
|
|
915 |
InstrumentProps::InstrumentProps() |
InstrumentProps::InstrumentProps() |
926 |
ePitchbendRange("Pitchbend range", 0, 12), |
ePitchbendRange("Pitchbend range", 0, 12), |
927 |
ePianoReleaseMode("Piano release mode"), |
ePianoReleaseMode("Piano release mode"), |
928 |
eDimensionKeyRangeLow("Dimension key range low"), |
eDimensionKeyRangeLow("Dimension key range low"), |
929 |
eDimensionKeyRangeHigh("Dimension key range high") |
eDimensionKeyRangeHigh("Dimension key range high"), |
930 |
|
update_model(0) |
931 |
{ |
{ |
932 |
set_title("Instrument properties"); |
set_title("Instrument properties"); |
933 |
|
|
934 |
|
connect(eIsDrum, &InstrumentProps::set_IsDrum); |
935 |
|
connect(eMIDIBank, &InstrumentProps::set_MIDIBank); |
936 |
|
connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram); |
937 |
|
connect(eAttenuation, &gig::Instrument::Attenuation); |
938 |
|
connect(eGainPlus6, &gig::Instrument::Attenuation); |
939 |
|
connect(eEffectSend, &gig::Instrument::EffectSend); |
940 |
|
connect(eFineTune, &gig::Instrument::FineTune); |
941 |
|
connect(ePitchbendRange, &gig::Instrument::PitchbendRange); |
942 |
|
connect(ePianoReleaseMode, &gig::Instrument::PianoReleaseMode); |
943 |
|
connect(eDimensionKeyRangeLow, |
944 |
|
&InstrumentProps::set_DimensionKeyRange_low); |
945 |
|
connect(eDimensionKeyRangeHigh, |
946 |
|
&InstrumentProps::set_DimensionKeyRange_high); |
947 |
|
|
948 |
rowno = 0; |
rowno = 0; |
949 |
table.set_col_spacings(5); |
table.set_col_spacings(5); |
950 |
|
|
961 |
add_prop(eDimensionKeyRangeLow); |
add_prop(eDimensionKeyRangeLow); |
962 |
add_prop(eDimensionKeyRangeHigh); |
add_prop(eDimensionKeyRangeHigh); |
963 |
|
|
|
eDimensionKeyRangeLow.signal_changed_by_user().connect( |
|
|
sigc::mem_fun(*this, &InstrumentProps::key_range_low_changed)); |
|
|
eDimensionKeyRangeHigh.signal_changed_by_user().connect( |
|
|
sigc::mem_fun(*this, &InstrumentProps::key_range_high_changed)); |
|
|
|
|
964 |
add(vbox); |
add(vbox); |
965 |
table.set_border_width(5); |
table.set_border_width(5); |
966 |
vbox.pack_start(table); |
vbox.pack_start(table); |
983 |
|
|
984 |
void InstrumentProps::set_instrument(gig::Instrument* instrument) |
void InstrumentProps::set_instrument(gig::Instrument* instrument) |
985 |
{ |
{ |
986 |
|
this->instrument = instrument; |
987 |
|
|
988 |
|
update_model++; |
989 |
eName.set_ptr(&instrument->pInfo->Name); |
eName.set_ptr(&instrument->pInfo->Name); |
990 |
eIsDrum.set_ptr(&instrument->IsDrum); |
eIsDrum.set_value(instrument->IsDrum); |
991 |
eMIDIBank.set_ptr(&instrument->MIDIBank); |
eMIDIBank.set_value(instrument->MIDIBank); |
992 |
eMIDIProgram.set_ptr(&instrument->MIDIProgram); |
eMIDIProgram.set_value(instrument->MIDIProgram); |
993 |
eAttenuation.set_ptr(&instrument->Attenuation); |
eAttenuation.set_value(instrument->Attenuation); |
994 |
eGainPlus6.set_ptr(&instrument->Attenuation); |
eGainPlus6.set_value(instrument->Attenuation); |
995 |
eEffectSend.set_ptr(&instrument->EffectSend); |
eEffectSend.set_value(instrument->EffectSend); |
996 |
eFineTune.set_ptr(&instrument->FineTune); |
eFineTune.set_value(instrument->FineTune); |
997 |
ePitchbendRange.set_ptr(&instrument->PitchbendRange); |
ePitchbendRange.set_value(instrument->PitchbendRange); |
998 |
ePianoReleaseMode.set_ptr(&instrument->PianoReleaseMode); |
ePianoReleaseMode.set_value(instrument->PianoReleaseMode); |
999 |
eDimensionKeyRangeLow.set_ptr(0); |
eDimensionKeyRangeLow.set_value(instrument->DimensionKeyRange.low); |
1000 |
eDimensionKeyRangeHigh.set_ptr(0); |
eDimensionKeyRangeHigh.set_value(instrument->DimensionKeyRange.high); |
1001 |
eDimensionKeyRangeLow.set_ptr(&instrument->DimensionKeyRange.low); |
update_model--; |
|
eDimensionKeyRangeHigh.set_ptr(&instrument->DimensionKeyRange.high); |
|
|
} |
|
|
|
|
|
void InstrumentProps::key_range_low_changed() |
|
|
{ |
|
|
double l = eDimensionKeyRangeLow.get_value(); |
|
|
double h = eDimensionKeyRangeHigh.get_value(); |
|
|
if (h < l) eDimensionKeyRangeHigh.set_value(l); |
|
|
} |
|
|
|
|
|
void InstrumentProps::key_range_high_changed() |
|
|
{ |
|
|
double l = eDimensionKeyRangeLow.get_value(); |
|
|
double h = eDimensionKeyRangeHigh.get_value(); |
|
|
if (h < l) eDimensionKeyRangeLow.set_value(h); |
|
1002 |
} |
} |
1003 |
|
|
1004 |
sigc::signal<void>& InstrumentProps::signal_instrument_changed() |
sigc::signal<void>& InstrumentProps::signal_instrument_changed() |
1094 |
} |
} |
1095 |
} |
} |
1096 |
|
|
1097 |
|
void MainWindow::on_action_view_status_bar() { |
1098 |
|
Gtk::CheckMenuItem* item = |
1099 |
|
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
1100 |
|
if (!item) { |
1101 |
|
std::cerr << "/MenuBar/MenuView/Statusbar == NULL\n"; |
1102 |
|
return; |
1103 |
|
} |
1104 |
|
if (item->get_active()) m_StatusBar.show(); |
1105 |
|
else m_StatusBar.hide(); |
1106 |
|
} |
1107 |
|
|
1108 |
void MainWindow::on_button_release(GdkEventButton* button) |
void MainWindow::on_button_release(GdkEventButton* button) |
1109 |
{ |
{ |
1110 |
if (button->type == GDK_2BUTTON_PRESS) { |
if (button->type == GDK_2BUTTON_PRESS) { |
1532 |
// notify we're done with altering |
// notify we're done with altering |
1533 |
region_changed_signal.emit(region); |
region_changed_signal.emit(region); |
1534 |
|
|
1535 |
|
file_changed(); |
1536 |
|
|
1537 |
return; |
return; |
1538 |
} |
} |
1539 |
// drop failed |
// drop failed |