/[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 2845 by persson, Sun Sep 20 10:18:22 2015 UTC
# Line 32  static bool isEvent(const Glib::ustring& Line 32  static bool isEvent(const Glib::ustring&
32  }  }
33    
34  ScriptEditor::ScriptEditor() :  ScriptEditor::ScriptEditor() :
35      m_applyButton(Gtk::Stock::APPLY), m_cancelButton(Gtk::Stock::CANCEL)      m_applyButton(_("_Apply"), true),
36        m_cancelButton(_("_Cancel"), true)
37  {  {
38      m_script = NULL;      m_script = NULL;
39    
# Line 44  ScriptEditor::ScriptEditor() : Line 45  ScriptEditor::ScriptEditor() :
45      m_tagTable->add(m_keywordTag);      m_tagTable->add(m_keywordTag);
46      m_eventTag = Gtk::TextBuffer::Tag::create();      m_eventTag = Gtk::TextBuffer::Tag::create();
47      m_eventTag->property_foreground() = "blue";      m_eventTag->property_foreground() = "blue";
48        m_eventTag->property_weight() = PANGO_WEIGHT_BOLD;
49      m_tagTable->add(m_eventTag);      m_tagTable->add(m_eventTag);
50      m_textBuffer = Gtk::TextBuffer::create(m_tagTable);      m_textBuffer = Gtk::TextBuffer::create(m_tagTable);
51      m_textView.set_buffer(m_textBuffer);      m_textView.set_buffer(m_textBuffer);
52      {      {
53          Pango::FontDescription fdesc;          Pango::FontDescription fdesc;
54          fdesc.set_family("monospace");          fdesc.set_family("monospace");
55    #if defined(__APPLE__)
56            fdesc.set_size(12 * PANGO_SCALE);
57    #else
58          fdesc.set_size(10 * PANGO_SCALE);          fdesc.set_size(10 * PANGO_SCALE);
59    #endif
60  #if GTKMM_MAJOR_VERSION < 3  #if GTKMM_MAJOR_VERSION < 3
61          m_textView.modify_font(fdesc);          m_textView.modify_font(fdesc);
62  #else  #else
# Line 118  void ScriptEditor::setScript(gig::Script Line 124  void ScriptEditor::setScript(gig::Script
124  }  }
125    
126  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) {
127      printf("inserted %d\n", length);      //printf("inserted %d\n", length);
128      Gtk::TextBuffer::iterator itStart = itEnd;      Gtk::TextBuffer::iterator itStart = itEnd;
129      itStart.backward_chars(length);      itStart.backward_chars(length);
130    
# Line 134  void ScriptEditor::onTextInserted(const Line 140  void ScriptEditor::onTextInserted(const
140          }          }
141    
142          Glib::ustring s = m_textBuffer->get_text(itWordStart, it, false);          Glib::ustring s = m_textBuffer->get_text(itWordStart, it, false);
143          printf("{%s}\n", s.c_str());          //printf("{%s}\n", s.c_str());
144          if (isKeyword(s))          if (isKeyword(s))
145              m_textBuffer->apply_tag(m_keywordTag, itWordStart, it);              m_textBuffer->apply_tag(m_keywordTag, itWordStart, it);
146          else if (isEvent(s)) {          else if (isEvent(s)) {
# Line 161  void ScriptEditor::onTextInserted(const Line 167  void ScriptEditor::onTextInserted(const
167  }  }
168    
169  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) {
170      printf("erased\n");      //printf("erased\n");
171      Gtk::TextBuffer::iterator itStart2 = itStart;      Gtk::TextBuffer::iterator itStart2 = itStart;
172      if (itStart2.inside_word() || itStart2.ends_word())      if (itStart2.inside_word() || itStart2.ends_word())
173          itStart2.backward_word_start();          itStart2.backward_word_start();

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

  ViewVC Help
Powered by ViewVC