/[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 2604 by schoenebeck, Sat Jun 7 22:34:31 2014 UTC revision 2610 by schoenebeck, Sun Jun 8 19:09:26 2014 UTC
# Line 44  ScriptEditor::ScriptEditor() : Line 44  ScriptEditor::ScriptEditor() :
44      m_tagTable->add(m_keywordTag);      m_tagTable->add(m_keywordTag);
45      m_eventTag = Gtk::TextBuffer::Tag::create();      m_eventTag = Gtk::TextBuffer::Tag::create();
46      m_eventTag->property_foreground() = "blue";      m_eventTag->property_foreground() = "blue";
47        m_eventTag->property_weight() = PANGO_WEIGHT_BOLD;
48      m_tagTable->add(m_eventTag);      m_tagTable->add(m_eventTag);
49      m_textBuffer = Gtk::TextBuffer::create(m_tagTable);      m_textBuffer = Gtk::TextBuffer::create(m_tagTable);
50      m_textView.set_buffer(m_textBuffer);      m_textView.set_buffer(m_textBuffer);
# Line 118  void ScriptEditor::setScript(gig::Script Line 119  void ScriptEditor::setScript(gig::Script
119  }  }
120    
121  void ScriptEditor::onTextInserted(const Gtk::TextBuffer::iterator& itEnd, const Glib::ustring& txt, int length) {  void ScriptEditor::onTextInserted(const Gtk::TextBuffer::iterator& itEnd, const Glib::ustring& txt, int length) {
122      printf("inserted %d\n", length);      //printf("inserted %d\n", length);
123      Gtk::TextBuffer::iterator itStart = itEnd;      Gtk::TextBuffer::iterator itStart = itEnd;
124      itStart.backward_chars(length);      itStart.backward_chars(length);
125    
# Line 134  void ScriptEditor::onTextInserted(const Line 135  void ScriptEditor::onTextInserted(const
135          }          }
136    
137          Glib::ustring s = m_textBuffer->get_text(itWordStart, it, false);          Glib::ustring s = m_textBuffer->get_text(itWordStart, it, false);
138          printf("{%s}\n", s.c_str());          //printf("{%s}\n", s.c_str());
139          if (isKeyword(s))          if (isKeyword(s))
140              m_textBuffer->apply_tag(m_keywordTag, itWordStart, it);              m_textBuffer->apply_tag(m_keywordTag, itWordStart, it);
141          else if (isEvent(s)) {          else if (isEvent(s)) {
# Line 161  void ScriptEditor::onTextInserted(const Line 162  void ScriptEditor::onTextInserted(const
162  }  }
163    
164  void ScriptEditor::onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd) {  void ScriptEditor::onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd) {
165      printf("erased\n");      //printf("erased\n");
166      Gtk::TextBuffer::iterator itStart2 = itStart;      Gtk::TextBuffer::iterator itStart2 = itStart;
167      if (itStart2.inside_word() || itStart2.ends_word())      if (itStart2.inside_word() || itStart2.ends_word())
168          itStart2.backward_word_start();          itStart2.backward_word_start();

Legend:
Removed from v.2604  
changed lines
  Added in v.2610

  ViewVC Help
Powered by ViewVC