654 |
// Add the TreeView's view columns: |
// Add the TreeView's view columns: |
655 |
m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr); |
m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr); |
656 |
m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name); |
m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name); |
657 |
|
m_TreeView.append_column(_("Scripts"), m_Columns.m_col_scripts); |
658 |
m_TreeView.set_headers_visible(true); |
m_TreeView.set_headers_visible(true); |
659 |
|
|
660 |
// establish drag&drop within the instrument tree view, allowing to reorder |
// establish drag&drop within the instrument tree view, allowing to reorder |
915 |
); |
); |
916 |
menuMacro->append(*item); |
menuMacro->append(*item); |
917 |
item->set_accel_path("<Macros>/macro_" + ToString(iMacro)); |
item->set_accel_path("<Macros>/macro_" + ToString(iMacro)); |
918 |
|
Glib::ustring comment = macro.comment(); |
919 |
|
if (!comment.empty()) |
920 |
|
item->set_tooltip_text(comment); |
921 |
} |
} |
922 |
// if there are no macros configured at all, then show a dummy entry instead |
// if there are no macros configured at all, then show a dummy entry instead |
923 |
if (m_macros.empty()) { |
if (m_macros.empty()) { |
961 |
|
|
962 |
void MainWindow::setupMacros() { |
void MainWindow::setupMacros() { |
963 |
MacrosSetup* setup = new MacrosSetup(); |
MacrosSetup* setup = new MacrosSetup(); |
964 |
setup->setMacros(m_macros); |
gig::DimensionRegion* pDimRgn = m_DimRegionChooser.get_main_dimregion(); |
965 |
|
setup->setMacros(m_macros, &m_serializationArchive, pDimRgn); |
966 |
setup->signal_macros_changed().connect( |
setup->signal_macros_changed().connect( |
967 |
sigc::mem_fun(*this, &MainWindow::onMacrosSetupChanged) |
sigc::mem_fun(*this, &MainWindow::onMacrosSetupChanged) |
968 |
); |
); |
1205 |
// save the file as separate temporary file first, |
// save the file as separate temporary file first, |
1206 |
// then move the saved file over the old file |
// then move the saved file over the old file |
1207 |
// (may result in performance speedup during save) |
// (may result in performance speedup during save) |
1208 |
String tmpname = filename + ".TMP"; |
gig::String tmpname = filename + ".TMP"; |
1209 |
gig->Save(tmpname, &progress); |
gig->Save(tmpname, &progress); |
1210 |
#if defined(WIN32) |
#if defined(WIN32) |
1211 |
if (!DeleteFile(filename.c_str())) { |
if (!DeleteFile(filename.c_str())) { |
1213 |
} |
} |
1214 |
#else // POSIX ... |
#else // POSIX ... |
1215 |
if (unlink(filename.c_str())) { |
if (unlink(filename.c_str())) { |
1216 |
throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file): " + String(strerror(errno))); |
throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file): " + gig::String(strerror(errno))); |
1217 |
} |
} |
1218 |
#endif |
#endif |
1219 |
if (rename(tmpname.c_str(), filename.c_str())) { |
if (rename(tmpname.c_str(), filename.c_str())) { |
1220 |
#if defined(WIN32) |
#if defined(WIN32) |
1221 |
throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file)."); |
throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file)."); |
1222 |
#else |
#else |
1223 |
throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file): " + String(strerror(errno))); |
throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file): " + gig::String(strerror(errno))); |
1224 |
#endif |
#endif |
1225 |
} |
} |
1226 |
} |
} |
2099 |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; |
2100 |
instrument = gig->GetNextInstrument(), ++index) { |
instrument = gig->GetNextInstrument(), ++index) { |
2101 |
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); |
2102 |
|
const int iScriptSlots = instrument->ScriptSlotCount(); |
2103 |
|
|
2104 |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
Gtk::TreeModel::iterator iter = m_refTreeModel->append(); |
2105 |
Gtk::TreeModel::Row row = *iter; |
Gtk::TreeModel::Row row = *iter; |
2106 |
row[m_Columns.m_col_nr] = index; |
row[m_Columns.m_col_nr] = index; |
2107 |
row[m_Columns.m_col_name] = name; |
row[m_Columns.m_col_name] = name; |
2108 |
row[m_Columns.m_col_instr] = instrument; |
row[m_Columns.m_col_instr] = instrument; |
2109 |
|
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
2110 |
|
|
2111 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
2112 |
} |
} |
2245 |
|
|
2246 |
ScriptSlots* window = new ScriptSlots; |
ScriptSlots* window = new ScriptSlots; |
2247 |
window->setInstrument(instrument); |
window->setInstrument(instrument); |
2248 |
|
window->signal_script_slots_changed().connect( |
2249 |
|
sigc::mem_fun(*this, &MainWindow::onScriptSlotsModified) |
2250 |
|
); |
2251 |
//window->reparent(*this); |
//window->reparent(*this); |
2252 |
window->show(); |
window->show(); |
2253 |
} |
} |
2254 |
|
|
2255 |
|
void MainWindow::onScriptSlotsModified(gig::Instrument* pInstrument) { |
2256 |
|
if (!pInstrument) return; |
2257 |
|
const int iScriptSlots = pInstrument->ScriptSlotCount(); |
2258 |
|
|
2259 |
|
Glib::RefPtr<Gtk::TreeModel> model = m_TreeView.get_model(); |
2260 |
|
for (int i = 0; i < model->children().size(); ++i) { |
2261 |
|
Gtk::TreeModel::Row row = model->children()[i]; |
2262 |
|
if (row[m_Columns.m_col_instr] != pInstrument) continue; |
2263 |
|
row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; |
2264 |
|
break; |
2265 |
|
} |
2266 |
|
} |
2267 |
|
|
2268 |
void MainWindow::on_action_refresh_all() { |
void MainWindow::on_action_refresh_all() { |
2269 |
__refreshEntireGUI(); |
__refreshEntireGUI(); |
2270 |
} |
} |
2579 |
rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; |
rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; |
2580 |
rowInstr[m_Columns.m_col_name] = name; |
rowInstr[m_Columns.m_col_name] = name; |
2581 |
rowInstr[m_Columns.m_col_instr] = instrument; |
rowInstr[m_Columns.m_col_instr] = instrument; |
2582 |
|
rowInstr[m_Columns.m_col_scripts] = ""; |
2583 |
instrument_name_connection.unblock(); |
instrument_name_connection.unblock(); |
2584 |
|
|
2585 |
add_instrument_to_menu(name); |
add_instrument_to_menu(name); |
3893 |
|
|
3894 |
void MainWindow::adjust_clipboard_content() { |
void MainWindow::adjust_clipboard_content() { |
3895 |
MacroEditor* editor = new MacroEditor(); |
MacroEditor* editor = new MacroEditor(); |
3896 |
editor->setMacro(&m_serializationArchive); |
editor->setMacro(&m_serializationArchive, true); |
3897 |
editor->show(); |
editor->show(); |
3898 |
} |
} |
3899 |
|
|
3943 |
itDimReg != dimreg_edit.dimregs.end(); ++itDimReg) |
itDimReg != dimreg_edit.dimregs.end(); ++itDimReg) |
3944 |
{ |
{ |
3945 |
gig::DimensionRegion* pDimRgn = *itDimReg; |
gig::DimensionRegion* pDimRgn = *itDimReg; |
3946 |
dimreg_to_be_changed_signal.emit(pDimRgn); |
DimRegionChangeGuard(this, pDimRgn); |
3947 |
m_serializationArchive.deserialize(pDimRgn); |
macro.deserialize(pDimRgn); |
|
dimreg_changed_signal.emit(pDimRgn); |
|
3948 |
} |
} |
3949 |
//region_changed() |
//region_changed() |
3950 |
file_changed(); |
file_changed(); |