/[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 3737 by schoenebeck, Sat Feb 1 20:39:39 2020 UTC revision 3800 by schoenebeck, Sun Jul 26 13:27:16 2020 UTC
# Line 1572  MainWindow::MainWindow() : Line 1572  MainWindow::MainWindow() :
1572              }              }
1573          }          }
1574      );      );
1575        dimreg_edit.scriptVars.signal_edit_script.connect(
1576            [this](gig::Script* script) {
1577                editScript(script);
1578            }
1579        );
1580    
1581      m_RegionChooser.signal_instrument_struct_to_be_changed().connect(      m_RegionChooser.signal_instrument_struct_to_be_changed().connect(
1582          sigc::hide(          sigc::hide(
# Line 3752  void MainWindow::onScriptSlotsModified(g Line 3757  void MainWindow::onScriptSlotsModified(g
3757    
3758      // causes the sampler to reload the instrument with the new script      // causes the sampler to reload the instrument with the new script
3759      on_sel_change();      on_sel_change();
3760    
3761        // force script 'patch' variables editor ("Script" tab) to be refreshed
3762        dimreg_edit.scriptVars.setInstrument(pInstrument, true/*force update*/);
3763  }  }
3764    
3765  void MainWindow::assignScript(gig::Script* pScript) {  void MainWindow::assignScript(gig::Script* pScript) {
# Line 4367  void MainWindow::add_instrument(gig::Ins Line 4375  void MainWindow::add_instrument(gig::Ins
4375      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();
4376      Gtk::TreeModel::Row rowInstr = *iterInstr;      Gtk::TreeModel::Row rowInstr = *iterInstr;
4377      const int index = m_refTreeModel->children().size() - 1;      const int index = m_refTreeModel->children().size() - 1;
4378        const int iScriptSlots = instrument->ScriptSlotCount();
4379      rowInstr[m_Columns.m_col_nr] = index;      rowInstr[m_Columns.m_col_nr] = index;
4380      rowInstr[m_Columns.m_col_name] = name;      rowInstr[m_Columns.m_col_name] = name;
4381      rowInstr[m_Columns.m_col_instr] = instrument;      rowInstr[m_Columns.m_col_instr] = instrument;
4382      rowInstr[m_Columns.m_col_scripts] = "";      rowInstr[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
4383      rowInstr[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);      rowInstr[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
4384      instrument_name_connection.unblock();      instrument_name_connection.unblock();
4385    
# Line 4553  void MainWindow::on_action_edit_script() Line 4562  void MainWindow::on_action_edit_script()
4562      if (!it) return;      if (!it) return;
4563      Gtk::TreeModel::Row row = *it;      Gtk::TreeModel::Row row = *it;
4564      gig::Script* script = row[m_ScriptsModel.m_col_script];      gig::Script* script = row[m_ScriptsModel.m_col_script];
4565      if (!script) return;      editScript(script);
4566    }
4567    
4568    void MainWindow::editScript(gig::Script* script) {
4569        if (!script) return;
4570      ScriptEditor* editor = new ScriptEditor;      ScriptEditor* editor = new ScriptEditor;
4571      editor->signal_script_to_be_changed.connect(      editor->signal_script_to_be_changed.connect(
4572          signal_script_to_be_changed.make_slot()          signal_script_to_be_changed.make_slot()
4573      );      );
4574      editor->signal_script_changed.connect(      editor->signal_script_changed.connect([this](gig::Script* script) {
4575          signal_script_changed.make_slot()          // signal to sampler (which will reload the script due to this)
4576      );          signal_script_changed.emit(script);
4577            // force script 'patch' variables editor ("Script" tab) to be refreshed
4578            gig::Instrument* instr = get_instrument();
4579            dimreg_edit.scriptVars.setInstrument(instr, true/*force update*/);
4580        });
4581      editor->setScript(script);      editor->setScript(script);
4582      //editor->reparent(*this);      //editor->reparent(*this);
4583      editor->show();      editor->show();
# Line 5325  void MainWindow::script_double_clicked(c Line 5341  void MainWindow::script_double_clicked(c
5341      if (!iter) return;      if (!iter) return;
5342      Gtk::TreeModel::Row row = *iter;      Gtk::TreeModel::Row row = *iter;
5343      gig::Script* script = row[m_ScriptsModel.m_col_script];      gig::Script* script = row[m_ScriptsModel.m_col_script];
5344      if (!script) return;      editScript(script);
   
     ScriptEditor* editor = new ScriptEditor;  
     editor->signal_script_to_be_changed.connect(  
         signal_script_to_be_changed.make_slot()  
     );  
     editor->signal_script_changed.connect(  
         signal_script_changed.make_slot()  
     );  
     editor->setScript(script);  
     //editor->reparent(*this);  
     editor->show();  
5345  }  }
5346    
5347  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,

Legend:
Removed from v.3737  
changed lines
  Added in v.3800

  ViewVC Help
Powered by ViewVC