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); |
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 |
|
|
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)) { |
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(); |