1003 |
} |
} |
1004 |
|
|
1005 |
|
|
1006 |
|
void InstrumentProps::set_Name(const gig::String& name) |
1007 |
|
{ |
1008 |
|
m->pInfo->Name = name; |
1009 |
|
} |
1010 |
|
|
1011 |
|
void InstrumentProps::update_name() |
1012 |
|
{ |
1013 |
|
update_model++; |
1014 |
|
eName.set_value(m->pInfo->Name); |
1015 |
|
update_model--; |
1016 |
|
} |
1017 |
|
|
1018 |
void InstrumentProps::set_IsDrum(bool value) |
void InstrumentProps::set_IsDrum(bool value) |
1019 |
{ |
{ |
1020 |
m->IsDrum = value; |
m->IsDrum = value; |
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); |
1070 |
connect(eDimensionKeyRangeLow, eDimensionKeyRangeHigh, |
connect(eDimensionKeyRangeLow, eDimensionKeyRangeHigh, |
1071 |
&gig::Instrument::DimensionKeyRange); |
&gig::Instrument::DimensionKeyRange); |
1072 |
|
|
1073 |
|
eName.signal_value_changed().connect(sig_name_changed.make_slot()); |
1074 |
|
|
1075 |
table.set_col_spacings(5); |
table.set_col_spacings(5); |
1076 |
|
|
1077 |
table.add(eName); |
table.add(eName); |
1112 |
update(instrument); |
update(instrument); |
1113 |
|
|
1114 |
update_model++; |
update_model++; |
1115 |
|
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); |
1179 |
// select the first instrument |
// select the first instrument |
1180 |
m_TreeView.get_selection()->select(Gtk::TreePath("0")); |
m_TreeView.get_selection()->select(Gtk::TreePath("0")); |
1181 |
|
|
1182 |
gig::Instrument* instrument = get_instrument(); |
instr_props_set_instrument(); |
1183 |
if (instrument) { |
} |
1184 |
|
|
1185 |
|
bool MainWindow::instr_props_set_instrument() |
1186 |
|
{ |
1187 |
|
instrumentProps.signal_name_changed().clear(); |
1188 |
|
|
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() |
void MainWindow::show_instr_props() |
1211 |
{ |
{ |
1212 |
gig::Instrument* instrument = get_instrument(); |
if (instr_props_set_instrument()) { |
|
if (instrument) |
|
|
{ |
|
|
instrumentProps.set_instrument(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")); |
1412 |
Gtk::TreePath(ToString(index))); |
Gtk::TreePath(ToString(index))); |
1413 |
} |
} |
1414 |
#endif |
#endif |
1415 |
instr = get_instrument(); |
instr_props_set_instrument(); |
|
if (instr) { |
|
|
instrumentProps.set_instrument(instr); |
|
|
} else { |
|
|
instrumentProps.hide(); |
|
|
} |
|
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(); |
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 |
} |
} |