/[svn]/gigedit/trunk/src/gigedit/mainwindow.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/mainwindow.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3162 by schoenebeck, Tue May 9 14:35:23 2017 UTC revision 3225 by schoenebeck, Fri May 26 22:10:16 2017 UTC
# Line 78  MainWindow::MainWindow() : Line 78  MainWindow::MainWindow() :
78      loadBuiltInPix();      loadBuiltInPix();
79    
80  //    set_border_width(5);  //    set_border_width(5);
81  //    set_default_size(400, 200);  
82        if (!Settings::singleton()->autoRestoreWindowDimension) {
83            set_default_size(800, 600);
84            set_position(Gtk::WIN_POS_CENTER);
85        }
86    
87      add(m_VBox);      add(m_VBox);
88    
# Line 654  MainWindow::MainWindow() : Line 658  MainWindow::MainWindow() :
658      // Add the TreeView's view columns:      // Add the TreeView's view columns:
659      m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr);      m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr);
660      m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name);      m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name);
661        m_TreeView.append_column(_("Scripts"), m_Columns.m_col_scripts);
662      m_TreeView.set_headers_visible(true);      m_TreeView.set_headers_visible(true);
663            
664      // establish drag&drop within the instrument tree view, allowing to reorder      // establish drag&drop within the instrument tree view, allowing to reorder
# Line 914  void MainWindow::updateMacroMenu() { Line 919  void MainWindow::updateMacroMenu() {
919          );          );
920          menuMacro->append(*item);          menuMacro->append(*item);
921          item->set_accel_path("<Macros>/macro_" + ToString(iMacro));          item->set_accel_path("<Macros>/macro_" + ToString(iMacro));
922            Glib::ustring comment = macro.comment();
923            if (!comment.empty())
924                item->set_tooltip_text(comment);
925      }      }
926      // 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
927      if (m_macros.empty()) {      if (m_macros.empty()) {
# Line 1201  void Saver::thread_function() Line 1209  void Saver::thread_function()
1209                  // save the file as separate temporary file first,                  // save the file as separate temporary file first,
1210                  // then move the saved file over the old file                  // then move the saved file over the old file
1211                  // (may result in performance speedup during save)                  // (may result in performance speedup during save)
1212                  String tmpname = filename + ".TMP";                  gig::String tmpname = filename + ".TMP";
1213                  gig->Save(tmpname, &progress);                  gig->Save(tmpname, &progress);
1214                  #if defined(WIN32)                  #if defined(WIN32)
1215                  if (!DeleteFile(filename.c_str())) {                  if (!DeleteFile(filename.c_str())) {
# Line 1209  void Saver::thread_function() Line 1217  void Saver::thread_function()
1217                  }                  }
1218                  #else // POSIX ...                  #else // POSIX ...
1219                  if (unlink(filename.c_str())) {                  if (unlink(filename.c_str())) {
1220                      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)));
1221                  }                  }
1222                  #endif                  #endif
1223                  if (rename(tmpname.c_str(), filename.c_str())) {                  if (rename(tmpname.c_str(), filename.c_str())) {
1224                      #if defined(WIN32)                      #if defined(WIN32)
1225                      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).");
1226                      #else                      #else
1227                      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)));
1228                      #endif                      #endif
1229                  }                  }
1230              }              }
# Line 1812  void MainWindow::on_action_help_about() Line 1820  void MainWindow::on_action_help_about()
1820      dialog.set_comments(sComment.c_str());      dialog.set_comments(sComment.c_str());
1821      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
1822      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
1823        dialog.set_position(Gtk::WIN_POS_CENTER);
1824      dialog.run();      dialog.run();
1825  }  }
1826    
# Line 1837  PropDialog::PropDialog() Line 1846  PropDialog::PropDialog()
1846        table(2, 1),        table(2, 1),
1847        m_file(NULL)        m_file(NULL)
1848  {  {
1849        if (!Settings::singleton()->autoRestoreWindowDimension) {
1850            set_default_size(470, 390);
1851            set_position(Gtk::WIN_POS_MOUSE);
1852        }
1853    
1854      set_title(_("File Properties"));      set_title(_("File Properties"));
1855      eName.set_width_chars(50);      eName.set_width_chars(50);
1856    
# Line 1971  InstrumentProps::InstrumentProps() : Line 1985  InstrumentProps::InstrumentProps() :
1985      eDimensionKeyRangeLow(_("Keyswitching range low")),      eDimensionKeyRangeLow(_("Keyswitching range low")),
1986      eDimensionKeyRangeHigh(_("Keyswitching range high"))      eDimensionKeyRangeHigh(_("Keyswitching range high"))
1987  {  {
1988        if (!Settings::singleton()->autoRestoreWindowDimension) {
1989            //set_default_size(470, 390);
1990            set_position(Gtk::WIN_POS_MOUSE);
1991        }
1992    
1993      set_title(_("Instrument Properties"));      set_title(_("Instrument Properties"));
1994    
1995      eDimensionKeyRangeLow.set_tip(      eDimensionKeyRangeLow.set_tip(
# Line 2095  void MainWindow::load_gig(gig::File* gig Line 2114  void MainWindow::load_gig(gig::File* gig
2114      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;
2115           instrument = gig->GetNextInstrument(), ++index) {           instrument = gig->GetNextInstrument(), ++index) {
2116          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
2117            const int iScriptSlots = instrument->ScriptSlotCount();
2118    
2119          Gtk::TreeModel::iterator iter = m_refTreeModel->append();          Gtk::TreeModel::iterator iter = m_refTreeModel->append();
2120          Gtk::TreeModel::Row row = *iter;          Gtk::TreeModel::Row row = *iter;
2121          row[m_Columns.m_col_nr] = index;          row[m_Columns.m_col_nr] = index;
2122          row[m_Columns.m_col_name] = name;          row[m_Columns.m_col_name] = name;
2123          row[m_Columns.m_col_instr] = instrument;          row[m_Columns.m_col_instr] = instrument;
2124            row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
2125    
2126          add_instrument_to_menu(name);          add_instrument_to_menu(name);
2127      }      }
# Line 2239  void MainWindow::show_script_slots() { Line 2260  void MainWindow::show_script_slots() {
2260    
2261      ScriptSlots* window = new ScriptSlots;      ScriptSlots* window = new ScriptSlots;
2262      window->setInstrument(instrument);      window->setInstrument(instrument);
2263        window->signal_script_slots_changed().connect(
2264            sigc::mem_fun(*this, &MainWindow::onScriptSlotsModified)
2265        );
2266      //window->reparent(*this);      //window->reparent(*this);
2267      window->show();      window->show();
2268  }  }
2269    
2270    void MainWindow::onScriptSlotsModified(gig::Instrument* pInstrument) {
2271        if (!pInstrument) return;
2272        const int iScriptSlots = pInstrument->ScriptSlotCount();
2273    
2274        Glib::RefPtr<Gtk::TreeModel> model = m_TreeView.get_model();
2275        for (int i = 0; i < model->children().size(); ++i) {
2276            Gtk::TreeModel::Row row = model->children()[i];
2277            if (row[m_Columns.m_col_instr] != pInstrument) continue;
2278            row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
2279            break;
2280        }
2281    }
2282    
2283  void MainWindow::on_action_refresh_all() {  void MainWindow::on_action_refresh_all() {
2284      __refreshEntireGUI();      __refreshEntireGUI();
2285  }  }
# Line 2557  void MainWindow::add_instrument(gig::Ins Line 2594  void MainWindow::add_instrument(gig::Ins
2594      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;
2595      rowInstr[m_Columns.m_col_name] = name;      rowInstr[m_Columns.m_col_name] = name;
2596      rowInstr[m_Columns.m_col_instr] = instrument;      rowInstr[m_Columns.m_col_instr] = instrument;
2597        rowInstr[m_Columns.m_col_scripts] = "";
2598      instrument_name_connection.unblock();      instrument_name_connection.unblock();
2599    
2600      add_instrument_to_menu(name);      add_instrument_to_menu(name);
# Line 3535  void MainWindow::instrument_name_changed Line 3573  void MainWindow::instrument_name_changed
3573  void MainWindow::on_action_combine_instruments() {  void MainWindow::on_action_combine_instruments() {
3574      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);
3575      d->show_all();      d->show_all();
     d->resize(500, 400);  
3576      d->run();      d->run();
3577      if (d->fileWasChanged()) {      if (d->fileWasChanged()) {
3578          // update GUI with new instrument just created          // update GUI with new instrument just created
# Line 3920  void MainWindow::applyMacro(Serializatio Line 3957  void MainWindow::applyMacro(Serializatio
3957           itDimReg != dimreg_edit.dimregs.end(); ++itDimReg)           itDimReg != dimreg_edit.dimregs.end(); ++itDimReg)
3958      {      {
3959          gig::DimensionRegion* pDimRgn = *itDimReg;          gig::DimensionRegion* pDimRgn = *itDimReg;
3960          dimreg_to_be_changed_signal.emit(pDimRgn);          DimRegionChangeGuard(this, pDimRgn);
3961          macro.deserialize(pDimRgn);          macro.deserialize(pDimRgn);
         dimreg_changed_signal.emit(pDimRgn);  
3962      }      }
3963      //region_changed()      //region_changed()
3964      file_changed();      file_changed();

Legend:
Removed from v.3162  
changed lines
  Added in v.3225

  ViewVC Help
Powered by ViewVC