--- gigedit/trunk/src/gigedit/mainwindow.cpp 2017/05/09 14:35:23 3162 +++ gigedit/trunk/src/gigedit/mainwindow.cpp 2017/05/20 17:15:36 3197 @@ -654,6 +654,7 @@ // Add the TreeView's view columns: m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr); m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name); + m_TreeView.append_column(_("Scripts"), m_Columns.m_col_scripts); m_TreeView.set_headers_visible(true); // establish drag&drop within the instrument tree view, allowing to reorder @@ -914,6 +915,9 @@ ); menuMacro->append(*item); item->set_accel_path("/macro_" + ToString(iMacro)); + Glib::ustring comment = macro.comment(); + if (!comment.empty()) + item->set_tooltip_text(comment); } // if there are no macros configured at all, then show a dummy entry instead if (m_macros.empty()) { @@ -1201,7 +1205,7 @@ // save the file as separate temporary file first, // then move the saved file over the old file // (may result in performance speedup during save) - String tmpname = filename + ".TMP"; + gig::String tmpname = filename + ".TMP"; gig->Save(tmpname, &progress); #if defined(WIN32) if (!DeleteFile(filename.c_str())) { @@ -1209,14 +1213,14 @@ } #else // POSIX ... if (unlink(filename.c_str())) { - 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))); } #endif if (rename(tmpname.c_str(), filename.c_str())) { #if defined(WIN32) throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file)."); #else - 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))); #endif } } @@ -2095,12 +2099,14 @@ for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ; instrument = gig->GetNextInstrument(), ++index) { Glib::ustring name(gig_to_utf8(instrument->pInfo->Name)); + const int iScriptSlots = instrument->ScriptSlotCount(); Gtk::TreeModel::iterator iter = m_refTreeModel->append(); Gtk::TreeModel::Row row = *iter; row[m_Columns.m_col_nr] = index; row[m_Columns.m_col_name] = name; row[m_Columns.m_col_instr] = instrument; + row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; add_instrument_to_menu(name); } @@ -2239,10 +2245,26 @@ ScriptSlots* window = new ScriptSlots; window->setInstrument(instrument); + window->signal_script_slots_changed().connect( + sigc::mem_fun(*this, &MainWindow::onScriptSlotsModified) + ); //window->reparent(*this); window->show(); } +void MainWindow::onScriptSlotsModified(gig::Instrument* pInstrument) { + if (!pInstrument) return; + const int iScriptSlots = pInstrument->ScriptSlotCount(); + + Glib::RefPtr model = m_TreeView.get_model(); + for (int i = 0; i < model->children().size(); ++i) { + Gtk::TreeModel::Row row = model->children()[i]; + if (row[m_Columns.m_col_instr] != pInstrument) continue; + row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : ""; + break; + } +} + void MainWindow::on_action_refresh_all() { __refreshEntireGUI(); } @@ -2557,6 +2579,7 @@ rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1; rowInstr[m_Columns.m_col_name] = name; rowInstr[m_Columns.m_col_instr] = instrument; + rowInstr[m_Columns.m_col_scripts] = ""; instrument_name_connection.unblock(); add_instrument_to_menu(name); @@ -3920,9 +3943,8 @@ itDimReg != dimreg_edit.dimregs.end(); ++itDimReg) { gig::DimensionRegion* pDimRgn = *itDimReg; - dimreg_to_be_changed_signal.emit(pDimRgn); + DimRegionChangeGuard(this, pDimRgn); macro.deserialize(pDimRgn); - dimreg_changed_signal.emit(pDimRgn); } //region_changed() file_changed();