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

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

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

revision 3747 by schoenebeck, Sat Feb 1 20:39:39 2020 UTC revision 3748 by schoenebeck, Sun Feb 16 17:27:03 2020 UTC
# Line 35  static gboolean onSelectCursorParent(Gtk Line 35  static gboolean onSelectCursorParent(Gtk
35  }  }
36    
37  ScriptPatchVars::ScriptPatchVars() :  ScriptPatchVars::ScriptPatchVars() :
38      m_ignoreTreeViewValueChange(false), m_instrument(NULL)/*, m_editing(false)*/      m_ignoreTreeViewValueChange(false), m_instrument(NULL), m_editing(false)
39  {  {
40      // create treeview (including its data model)      // create treeview (including its data model)
41      m_treeStore = VarsTreeStore::create(m_treeModel);      m_treeStore = VarsTreeStore::create(m_treeModel);
# Line 84  ScriptPatchVars::ScriptPatchVars() : Line 84  ScriptPatchVars::ScriptPatchVars() :
84              dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell());              dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell());
85          column->add_attribute(cellrenderer->property_foreground(), m_treeModel.m_col_value_color);          column->add_attribute(cellrenderer->property_foreground(), m_treeModel.m_col_value_color);
86          column->add_attribute(cellrenderer->property_weight(), m_treeModel.m_col_value_weight);          column->add_attribute(cellrenderer->property_weight(), m_treeModel.m_col_value_weight);
87            cellrenderer->signal_editing_started().connect(
88                [this](Gtk::CellEditable*, const Glib::ustring&) {
89                    m_editing = true;
90                }
91            );
92            cellrenderer->signal_editing_canceled().connect([this]{
93                m_editing = false;
94            });
95      }      }
96      m_treeView.set_headers_visible(true);      m_treeView.set_headers_visible(true);
97      m_treeView.get_selection()->signal_changed().connect(      m_treeView.get_selection()->signal_changed().connect(
# Line 353  void ScriptPatchVars::deleteSelectedRows Line 361  void ScriptPatchVars::deleteSelectedRows
361    
362  void ScriptPatchVars::deleteRows(const std::vector<Gtk::TreeModel::Path>& rows) {  void ScriptPatchVars::deleteRows(const std::vector<Gtk::TreeModel::Path>& rows) {
363      // ignore the backspace key here while user is editing some value      // ignore the backspace key here while user is editing some value
364      if (m_ignoreTreeViewValueChange /*|| m_editing*/) return;      if (m_ignoreTreeViewValueChange || m_editing) return;
365      if (!m_instrument) return; // just to be sure      if (!m_instrument) return; // just to be sure
366    
367      m_ignoreTreeViewValueChange = true;      m_ignoreTreeViewValueChange = true;
# Line 379  void ScriptPatchVars::deleteRows(const s Line 387  void ScriptPatchVars::deleteRows(const s
387  }  }
388    
389  void ScriptPatchVars::onValueCellEdited(const Glib::ustring& sPath, const Glib::ustring& text) {  void ScriptPatchVars::onValueCellEdited(const Glib::ustring& sPath, const Glib::ustring& text) {
390      //m_editing = false;      m_editing = false;
391      Gtk::TreePath path(sPath);      Gtk::TreePath path(sPath);
392      Gtk::TreeModel::iterator iter = m_treeStore->get_iter(path);      Gtk::TreeModel::iterator iter = m_treeStore->get_iter(path);
393      onTreeViewRowValueChanged(path, iter, text);      onTreeViewRowValueChanged(path, iter, text);
# Line 388  void ScriptPatchVars::onValueCellEdited( Line 396  void ScriptPatchVars::onValueCellEdited(
396  void ScriptPatchVars::onTreeViewRowChanged(const Gtk::TreeModel::Path& path,  void ScriptPatchVars::onTreeViewRowChanged(const Gtk::TreeModel::Path& path,
397                                             const Gtk::TreeModel::iterator& iter)                                             const Gtk::TreeModel::iterator& iter)
398  {  {
399      //m_editing = false;      m_editing = false;
400      if (!iter) return;      if (!iter) return;
401      Gtk::TreeModel::Row row = *iter;      Gtk::TreeModel::Row row = *iter;
402      Glib::ustring value = row[m_treeModel.m_col_value];      Glib::ustring value = row[m_treeModel.m_col_value];
# Line 399  void ScriptPatchVars::onTreeViewRowValue Line 407  void ScriptPatchVars::onTreeViewRowValue
407                                                  const Gtk::TreeModel::iterator& iter,                                                  const Gtk::TreeModel::iterator& iter,
408                                                  const Glib::ustring value)                                                  const Glib::ustring value)
409  {  {
410      //m_editing = false;      m_editing = false;
411      if (m_ignoreTreeViewValueChange || !m_instrument) return;      if (m_ignoreTreeViewValueChange || !m_instrument) return;
412    
413      Gtk::TreeModel::Row row = *iter;      Gtk::TreeModel::Row row = *iter;

Legend:
Removed from v.3747  
changed lines
  Added in v.3748

  ViewVC Help
Powered by ViewVC