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

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

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

revision 3390 by schoenebeck, Thu Nov 16 19:18:42 2017 UTC revision 3391 by schoenebeck, Sun Dec 3 16:03:34 2017 UTC
# Line 248  ScriptEditor::ScriptEditor() : Line 248  ScriptEditor::ScriptEditor() :
248  #endif  #endif
249    
250      m_lineNrBuffer = Gtk::TextBuffer::create(m_tagTable);      m_lineNrBuffer = Gtk::TextBuffer::create(m_tagTable);
251        m_lineNrView.set_size_request(22,14);
252      m_lineNrView.set_buffer(m_lineNrBuffer);      m_lineNrView.set_buffer(m_lineNrBuffer);
253      m_lineNrView.set_left_margin(3);      m_lineNrView.set_left_margin(3);
254      m_lineNrView.set_right_margin(3);      m_lineNrView.set_right_margin(3);
255      m_lineNrTextViewSpacer.set_size_request(5);      m_lineNrView.property_editable() = false;
256        m_lineNrView.property_sensitive() = false;
257        m_lineNrTextViewSpacer.set_size_request(5,14);
258        m_lineNrTextViewSpacer.property_editable() = false;
259        m_lineNrTextViewSpacer.property_sensitive() = false;
260      {      {
261  #if 1 //(GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2  #if 1 //(GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
262          Gdk::Color color;          Gdk::Color color;
# Line 443  void ScriptEditor::setScript(gig::Script Line 448  void ScriptEditor::setScript(gig::Script
448      //printf("text : '%s'\n", txt.c_str());      //printf("text : '%s'\n", txt.c_str());
449      m_textBuffer->set_text(txt);      m_textBuffer->set_text(txt);
450      m_textBuffer->set_modified(false);      m_textBuffer->set_modified(false);
451    
452        // on Gtk 3 the respective text change callback would not be called, so force this update here
453        if (txt.empty())
454            updateLineNumbers();
455  }  }
456    
457  void ScriptEditor::updateLineNumbers() {  void ScriptEditor::updateLineNumbers() {
458      const int n = m_textBuffer->get_line_count();      int n = m_textBuffer->get_line_count();
459      const int old = m_lineNrBuffer->get_line_count();      int old = m_lineNrBuffer->get_line_count();
460      if (n == old) return;      if (n == old && old > 1) return;
461        if (n < 1) n = 1;
462      const int digits = log10(n) + 1;      const int digits = log10(n) + 1;
463      const int bufSz = digits + 2;      const int bufSz = digits + 2;
464      char* buf = new char[bufSz];      char* buf = new char[bufSz];

Legend:
Removed from v.3390  
changed lines
  Added in v.3391

  ViewVC Help
Powered by ViewVC