2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# GtkSource.SearchContext searchcontext" : "null",
7 "# JsRender.JsRender? file" : "null",
8 "# JsRender.Node node" : "null",
9 "# JsRender.NodeProp? prop" : "null",
10 "# Xcls_MainWindow window" : "null",
11 "# bool dirty" : false,
13 "# int last_error_counter" : 0,
14 "# int pos_root_x" : "",
15 "# int pos_root_y" : "",
16 "# string activeEditor" : "\"\"",
17 "$ homogeneous" : false,
20 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
21 "bool hexpand" : true,
22 "bool vexpand" : true,
23 "int last_search_end" : 0,
27 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
28 "bool shrink_end_child" : false,
29 "int width_request" : 200,
33 "* prop" : "start_child",
34 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
38 "$ homogeneous" : false,
40 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
41 "bool hexpand" : false,
42 "bool vexpand" : false,
46 "bool vexpand" : true,
52 " _this.saveContents();",
61 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
62 "bool hexpand" : true,
66 "int margin_start" : 4,
69 "(Lsp.Hover? help) {",
70 "\tif (help == null || help.contents == null",
71 "\t\t|| help.contents.size < 1) {",
72 "\t\tthis.el.set_text(\"\");",
75 "\tvar sig = help.contents.get(0).value.split(\" \");",
76 "\tstring[] str = {};",
77 "\tfor(var i =0; i < sig.length; i++) {",
79 "\t\tswitch(sig[i]) {",
80 "\t\t\tcase \"public\":",
81 "\t\t\tcase \"private\":",
82 "\t\t\tcase \"protected\":",
83 "\t\t\tcase \"async\":",
84 "\t\t\tcase \"class\":",
90 "\t\t\t\tstr += sig[i];",
96 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
97 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
98 "\t\t\t\t\t+\"</span>\");",
102 "\tif (help.contents.size > 1) {",
103 "\t\tsig += (\"\\n\\n\" + help.contents[1].value);",
106 "\tthis.el.set_markup(string.joinv(\" \",str));",
113 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
116 "\t//this.el.set_range(6,30);",
117 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
118 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
120 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
121 " \t\t//\tGLib.debug(\"update range\");",
122 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
123 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
131 "Gtk.Align halign" : "Gtk.Align.END",
132 "bool draw_value" : false,
133 "bool has_origin" : true,
134 "bool sensitive" : true,
136 "int width_request" : 150,
140 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
143 " \tBuilderApplication.settings.editor_font_size = val;",
152 "Gtk.Align halign" : "Gtk.Align.END",
158 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
159 "string icon_name" : "window-close",
166 " _this.saveContents();",
167 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
172 "string icon_name" : "window-close",
180 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
181 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
182 "bool overlay_scrolling" : false,
183 "bool vexpand" : true,
184 "id" : "RightEditor",
187 "# Gtk.CssProvider css" : "null",
188 "$ gboolean auto_indent" : true,
189 "$ xns" : "GtkSource",
196 "this.el.completion.add_provider(",
197 "\tnew Palete.CompletionProvider(_this)",
200 "// hover seems pretty useless.. - ??",
201 "//var hover = this.el.get_hover();",
202 "//hover.add_provider(new Palete.HoverProvider(_this));",
204 "//this.el.completion.unblock_interactive();",
205 "this.el.completion.select_on_show = true; // select",
206 "//this.el.completion.remember_info_visibility\t = true;",
209 "var attrs = new GtkSource.MarkAttributes();",
211 "attrs.set_icon_name ( \"process-stop\"); ",
212 "attrs.query_tooltip_text.connect(( mark) => {",
213 " GLib.debug(\"tooltip query? %s\", mark.name);",
214 " return strdup( mark.name);",
216 " attrs.query_tooltip_markup.connect(( mark) => {",
217 " GLib.debug(\"tooltip query? %s\", mark.name);",
218 " return strdup( mark.name);",
220 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
224 "var wattrs = new GtkSource.MarkAttributes();",
225 "wattrs.set_icon_name ( \"process-stop\"); ",
226 "wattrs.query_tooltip_text.connect(( mark) => {",
227 " GLib.debug(\"tooltip query? %s\", mark.name);",
228 " return strdup(mark.name);",
230 "wattrs.query_tooltip_markup.connect(( mark) => {",
231 " GLib.debug(\"tooltip query? %s\", mark.name);",
232 " return strdup(mark.name);",
234 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
238 "var dattrs = new GtkSource.MarkAttributes();",
240 "dattrs.set_icon_name ( \"process-stop\"); ",
242 "dattrs.query_tooltip_text.connect(( mark) => {",
243 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
244 " return strdup(mark.name);",
246 "//dattrs.query_tooltip_markup.connect(( mark) => {",
247 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
248 " // return strdup(mark.name);",
250 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
253 " this.el.get_space_drawer().set_matrix(null);",
254 " this.el.get_space_drawer().set_types_for_locations( ",
255 "\tGtkSource.SpaceLocationFlags.ALL,",
256 "\tGtkSource.SpaceTypeFlags.ALL",
258 "this.el.get_space_drawer().set_enable_matrix(true);",
262 "bool has_tooltip" : true,
263 "bool hexpand" : true,
264 "bool insert_spaces_instead_of_tabs" : true,
265 "bool vexpand" : true,
266 "boolean show_line_marks" : true,
267 "boolean show_line_numbers" : true,
268 "css_classes" : "{ \"code-editor\" }",
269 "gboolean highlight_current_line" : true,
274 "$ Gee.HashMap<int,string>? xmarks" : "null",
275 "$ xns" : "GtkSource",
276 "$ xtype" : "Buffer",
279 "var buf = this.el;",
280 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
281 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
282 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
283 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
284 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
285 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
286 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
287 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
290 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
291 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
292 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
298 "bool check_queued" : false,
299 "bool enable_undo" : true,
300 "bool highlight_matching_brackets" : true,
301 "bool highlight_syntax" : true,
303 "int error_line" : "-1",
307 " // check syntax??",
309 " _this.save_button.el.sensitive = true;",
310 " print(\"EDITOR CHANGED\");",
311 " this.checkSyntax();",
313 " _this.dirty = true;",
315 " // this.get('/LeftPanel.model').changed( str , false);",
323 "\tGtk.TextIter iter;",
324 "\tthis.el.get_iter_at_offset (",
325 "\t\t\tout iter, this.el.cursor_position);",
327 "\t_this.navigation.updateSelectedLine(",
328 "\t\t\t(uint)iter.get_line(),",
329 "\t\t\t(uint)iter.get_line_offset()",
331 "\tthis.showHelp(iter);",
337 "| bool OLDhighlightErrorsJson" : [
338 "(string type, Json.Object obj) {",
339 "\tGtk.TextIter start;",
340 "\tGtk.TextIter end; ",
341 "\tthis.el.get_bounds (out start, out end);",
343 "\tthis.el.remove_source_marks (start, end, type);",
344 "\tGLib.debug(\"highlight errors\");\t\t ",
346 "\t // we should highlight other types of errors..",
348 "\tif (!obj.has_member(type)) {",
349 "\t\tGLib.debug(\"Return has no errors\\n\");",
353 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
355 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
357 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
362 "\t//this.marks = new Gee.HashMap<int,string>();",
363 "\tvar err = obj.get_object_member(type);",
365 "\tif (_this.file == null) {",
366 "\t\tGLib.debug(\"file is null?\");",
370 "\tvar valafn = _this.file.path;",
372 "\tif (_this.file.xtype != \"PlainFile\") {",
374 "\t\tvalafn = \"\";",
376 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
377 "\t\t\t// should not happen",
378 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
379 "\t\t} catch (GLib.RegexError e) {",
380 "\t\t\treturn true;",
386 "\tif (!err.has_member(valafn)) {",
387 "\t\tGLib.debug(\"File path has no errors\");",
391 "\tvar lines = err.get_object_member(valafn);",
394 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
395 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
399 "\tvar tlines = this.el.get_line_count () +1;",
401 "\tif (_this.prop != null) {",
403 "\t\ttlines = _this.prop.end_line + 1;",
404 "\t\toffset = _this.prop.start_line + 1;",
410 "\tlines.foreach_member((obj, line, node) => {",
412 "\t Gtk.TextIter iter;",
413 "// print(\"get inter\\n\");",
414 "\t var eline = int.parse(line) - offset;",
415 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
418 "\t if (eline > tlines || eline < 0) {",
423 "\t this.el.get_iter_at_line( out iter, eline);",
424 "\t //print(\"mark line\\n\");",
425 "\t var msg = \"\";",
426 "\t var ar = lines.get_array_member(line);",
427 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
428 "\t \tif (ar.get_string_element(i) == \"Success\") {",
431 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
432 "\t\t\tmsg += ar.get_string_element(i);",
434 "\t\tif (msg == \"\") {",
437 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
438 "\t this.el.create_source_mark(msg, type, iter);",
439 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
440 "\t // this.marks.set(eline, msg);",
451 "| bool checkSyntax" : [
455 " var str = this.toString();",
458 " if (this.error_line > 0) {",
459 " Gtk.TextIter start;",
460 " Gtk.TextIter end; ",
461 " this.el.get_bounds (out start, out end);",
463 " this.el.remove_source_marks (start, end, null);",
465 " if (str.length < 1) {",
466 " print(\"checkSyntax - empty string?\\n\");",
470 " // bit presumptiona",
471 " if (_this.file.xtype == \"PlainFile\") {",
473 " // assume it's gtk...",
474 " var oldcode =_this.file.toSource();",
475 " _this.file.setSource(str);",
476 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
477 " \t_this.file.getLanguageServer().document_change(_this.file);",
478 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
479 " _this.file.setSource(oldcode);",
485 " if (_this.file == null) {",
493 " GLib.debug(\"calling validate\"); ",
494 " // clear the buttons.",
495 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
498 "\tvar oldcode = _this.prop.val;",
500 "\t_this.prop.val = str;",
501 "\t_this.node.updated_count++;",
502 " _this.file.getLanguageServer().document_change(_this.file);",
503 " _this.node.updated_count++;",
504 " _this.prop.val = oldcode;",
507 " //print(\"done mark line\\n\");",
509 " return true; // at present allow saving - even if it's invalid..",
513 "| bool highlightErrors" : [
514 "( Gee.HashMap<int,string> validate_res) {",
516 "\tthis.error_line = validate_res.size;",
518 "\tif (this.error_line < 1) {",
521 "\tvar tlines = this.el.get_line_count ();",
522 "\tGtk.TextIter iter;",
523 "\tvar valiter = validate_res.map_iterator();",
524 "\twhile (valiter.next()) {",
526 "\t// print(\"get inter\\n\");",
527 "\t\tvar eline = valiter.get_key();",
528 "\t\tif (eline > tlines) {",
531 "\t\tthis.el.get_iter_at_line( out iter, eline);",
532 "\t\t//print(\"mark line\\n\");",
533 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
538 "| string toString" : [
543 " this.el.get_start_iter(out s);",
544 " this.el.get_end_iter(out e);",
545 " var ret = this.el.get_text(s,e,true);",
546 " //print(\"TO STRING? \" + ret);",
551 "| void showHelp" : [
552 "(Gtk.TextIter iter) {",
553 "\tvar back = iter.copy();",
554 "\tback.backward_char();",
556 "\tvar forward = iter.copy();",
557 "\tforward.forward_char();",
559 "\t// what's the character at the iter?",
560 "\tvar str = back.get_text(iter);",
561 "\tstr += iter.get_text(forward);",
562 "\tif (str.strip().length < 1) {",
565 "\tvar offset = iter.get_line_offset();",
566 "\tvar line = iter.get_line();",
567 "\tif (_this.prop != null) {",
569 "\t\tline += _this.prop.start_line ; ",
570 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
571 "\t\toffset += _this.node.node_pad.length;",
572 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
573 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
574 "\t\t\toffset += 2;",
578 "\tvar ls = _this.file.getLanguageServer();",
580 "\t\t_this.file, line, offset,",
583 "\t\t\t\tvar res = ls.hover.end(o );",
585 "\t\t\t\t_this.helper.setHelp(res);",
586 "\t\t\t} catch (GLib.Error e) {",
596 "# bool is_control" : false,
601 "(keyval, keycode, state) => {",
603 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
604 " \t\tthis.is_control = true;",
611 "(keyval, keycode, state) => {",
613 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
614 " \t\tthis.is_control = false;",
616 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
617 " GLib.debug(\"SAVE: ctrl-S pressed\");",
618 " _this.saveContents();",
622 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
623 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
624 "\t\t_this.forwardSearch(true);",
627 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
628 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
629 "\t\t_this.search_entry.el.grab_focus();",
630 "\t\t_this.search_entry.el.select_region(0,-1);",
633 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
634 "\t\t_this.view.el.show_completion();",
637 "\tGtk.TextIter iter;",
638 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
639 "\tvar line = iter.get_line();",
640 "\tvar offset = iter.get_line_offset();",
641 "\tGLib.debug(\"line %d off %d\", line ,offset);",
642 "\tif (_this.prop != null) {",
643 "\t\tline += _this.prop.start_line + 1; // i think..",
644 "\t\toffset += 12; // should probably be 8 without namespaced ",
645 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
647 " //_this.view.el.show_completion();",
648 " // print(event.key.keyval)",
658 "xtype" : "EventControllerKey"
661 "# double distance" : "0.0f",
663 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
667 "\tif (!_this.keystate.is_control) {",
670 "\t //GLib.debug(\"scroll %f\", dy);",
672 "\tthis.distance += dy;",
674 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
676 "\t if (this.distance < -1) {",
678 "\t\tBuilderApplication.settings.editor_font_size ++;",
679 "\t\tthis.distance = 0;",
681 "\tif (this.distance > 1) {",
682 "\t\tBuilderApplication.settings.editor_font_size --;",
683 "\t\tthis.distance = 0;",
691 "xtype" : "EventControllerScroll"
697 "(n_press, x, y) => {",
698 "\tGtk.TextIter iter;",
699 "\tint buffer_x, buffer_y;",
700 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
702 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
703 "\t\t(int)x - gut.get_width(), (int)y,",
704 " \t\tout buffer_x, out buffer_y);",
705 "\t_this.view.el.get_iter_at_location (out iter, ",
706 "\t\t\tbuffer_x, buffer_y);;",
709 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
710 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
714 "\t_this.buffer.showHelp(iter);",
722 "xtype" : "GestureClick"
727 "(x, y, keyboard_tooltip, tooltip) => {",
729 "\t//GLib.debug(\"query tooltip\");",
730 "\tGtk.TextIter iter;",
733 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
735 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
737 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
738 "\t//\treturn false;",
741 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
743 "\tvar l = iter.get_line();",
747 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
753 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
754 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
755 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
763 "\t// this crashes?? - not sure why.",
764 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
765 "\tif (marks.is_empty()) {",
766 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
768 "\tif (marks.is_empty()) {",
769 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
772 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
774 "\tmarks.@foreach((m) => { ",
775 "\t\t//GLib.debug(\"got mark %s\", m.name);",
776 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
778 "\t// true if there is a mark..",
779 "\tif (str.length > 0 ) {",
780 "\t\ttooltip.set_text( str );",
782 "\treturn str.length > 0 ? true : false;",
788 "string name" : "editor-view",
789 "uint tab_width" : 4,
794 "// show the help page for the active node..",
795 " //this.get('/Help').show();",
797 " // this.get('/BottomPane').el.set_current_page(0);",
798 " \tGLib.debug(\"load called - Reset undo buffer\");",
800 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
801 " buf.begin_irreversible_action();",
802 " buf.set_text(str, str.length);",
803 " buf.end_irreversible_action();",
805 " var lm = GtkSource.LanguageManager.get_default();",
806 " var lang = \"vala\";",
807 " if (_this.file != null) {",
808 " lang = _this.file.language;",
810 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
811 " var lg = _this.file.content_type.length > 0 ?",
812 " lm.guess_language(_this.file.path, _this.file.content_type) :",
813 " lm.get_language(lang);",
816 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
818 " this.el.insert_spaces_instead_of_tabs = true;",
819 " if (lg != null) {",
820 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
821 "\t\tif (lg.name == \"Vala\") {",
822 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
825 " _this.dirty = false;",
826 " this.el.grab_focus();",
827 " _this.save_button.el.sensitive = false;",
828 " _this.last_error_counter = -1;",
833 "xtype" : "ScrolledWindow"
838 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
839 "bool homogeneous" : false,
840 "bool vexpand" : false,
845 "Gtk.CssProvider css" : "",
846 "bool hexpand" : true,
847 "id" : "search_entry",
853 "(keyval, keycode, state) => {",
855 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
856 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
857 "\t\t_this.forwardSearch(true);",
862 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
863 "\t\t_this.forwardSearch(true);",
869 " // print(event.key.keyval)",
876 "xtype" : "EventControllerKey"
883 "_this.search(_this.search_entry.el.text);",
884 "\t _this.search_results.updateResults();",
886 "\tGLib.Timeout.add_seconds(1,() => {",
887 "\t\t _this.search_results.updateResults();",
888 "\t\t return false;",
894 "string name" : "editor-search-entry",
895 "string placeholder_text" : "Press enter to search",
896 "uint search_delay" : 3,
897 "xtype" : "SearchEntry",
898 "| void forwardSearch" : [
899 "(bool change_focus) {",
902 "\t_this.forwardSearch(change_focus);",
906 "\tswitch(_this.windowstate.state) {",
907 "\t\tcase WindowState.State.CODEONLY:",
908 "\t\t//case WindowState.State.CODE:",
909 "\t\t\t// search the code being edited..",
910 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
913 "\t\tcase WindowState.State.PREVIEW:",
914 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
915 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
917 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
930 "id" : "search_results",
931 "int margin_end" : 4,
932 "int margin_start" : 4,
933 "string label" : "No Results",
935 "| void updateResults" : [
937 "\tthis.el.visible = true;",
939 "\tvar res = _this.searchcontext.get_occurrences_count();",
941 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
945 "\t_this.nextBtn.el.sensitive = false;",
946 "\t_this.backBtn.el.sensitive = false;\t",
949 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
950 "\t\t_this.nextBtn.el.sensitive = true;",
951 "\t\t_this.backBtn.el.sensitive = true;",
954 "\t_this.search_results.el.label = \"No Matches\";",
961 "bool always_show_image" : true,
962 "bool sensitive" : false,
968 "\t_this.forwardSearch(true);",
975 "string icon_name" : "go-down",
980 "bool always_show_image" : true,
981 "bool sensitive" : false,
987 "\t_this.backSearch(true);",
993 "string icon_name" : "go-up",
998 "bool always_show_arrow" : true,
999 "bool always_show_image" : true,
1003 "* prop" : "popover",
1004 "id" : "search_settings",
1009 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1016 "\tthis.el.show();",
1020 "id" : "case_sensitive",
1021 "string label" : "Case Sensitive",
1022 "xtype" : "CheckButton"
1028 "\tthis.el.show();",
1033 "string label" : "Regex",
1034 "xtype" : "CheckButton"
1039 "string label" : "Multi-line (add \\n)",
1040 "xtype" : "CheckButton"
1049 "string icon_name" : "emblem-system",
1050 "xtype" : "MenuButton"
1060 "* prop" : "end_child",
1061 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1062 "bool hexpand" : true,
1063 "bool vexpand" : true,
1068 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1074 "bool hexpand" : true,
1075 "bool vexpand" : true,
1076 "bool visible" : false,
1077 "id" : "navigationwindow",
1080 "# int last_selected_line" : "-1",
1081 "$ Gtk.Widget? selected_row" : "null",
1084 "id" : "navigation",
1088 "bool expand" : true,
1092 "* prop" : "factory",
1097 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1099 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1100 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1103 "\tvar hbox = (Gtk.Box) expand.child;",
1106 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1107 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1109 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1110 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1112 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1113 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1115 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1117 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1119 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1120 " \texpand.set_list_row(lr);",
1121 " \t//this.in_bind = true;",
1122 " \t// default is to expand",
1124 " \t//this.in_bind = false;",
1126 " \tsym.bind_property(\"symbol_icon\",",
1127 " img, \"icon_name\",",
1128 " GLib.BindingFlags.SYNC_CREATE);",
1130 " \thbox.css_classes = { sym.symbol_icon };",
1132 " \tsym.bind_property(\"name\",",
1134 " GLib.BindingFlags.SYNC_CREATE);",
1135 " \t// should be better?- --line no?",
1136 " \tsym.bind_property(\"tooltip\",",
1137 " lbl, \"tooltip_markup\",",
1138 " GLib.BindingFlags.SYNC_CREATE);",
1139 " \t// bind image...",
1147 "\tvar expand = new Gtk.TreeExpander();",
1149 "\texpand.set_indent_for_depth(true);",
1150 "\texpand.set_indent_for_icon(true);",
1151 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1152 "\tvar icon = new Gtk.Image();",
1153 "\tvar lbl = new Gtk.Label(\"\");",
1154 "\tlbl.use_markup = true;",
1155 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1157 "\ticon.margin_end = 4;",
1158 " \tlbl.justify = Gtk.Justification.LEFT;",
1159 " \tlbl.xalign = 0;",
1161 "//\tlistitem.activatable = true; ??",
1163 "\thbox.append(icon);",
1164 "\thbox.append(lbl);",
1165 "\texpand.set_child(hbox);",
1166 "\t((Gtk.ListItem)listitem).set_child(expand);",
1172 "xtype" : "SignalListItemFactory"
1175 "string title" : "Code Navigation",
1176 "xtype" : "ColumnViewColumn"
1181 "id" : "navigationselmodel",
1186 "id" : "navigationsort",
1189 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1192 "\treturn ((Lsp.DocumentSymbol)item).children;",
1198 "bool autoexpand" : true,
1199 "bool passthrough" : false,
1202 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1205 "id" : "navliststore",
1206 "xtype" : "ListStore",
1207 "| Lsp.DocumentSymbol? symbolAtLine" : [
1208 "(uint line, uint chr) {",
1211 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1212 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1213 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1214 "\t\t//\tel.name , (int)el.range.start.line,",
1215 "\t\t//\t(int)el.range.end.line",
1217 "\t\tvar ret = el.containsLine(line,chr);",
1218 "\t\tif (ret != null) {",
1219 "\t\t\treturn ret;",
1231 "(position, removed, added) => {",
1232 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1233 "\t if (added < 1) { ",
1236 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1237 "\tvar row = this.el.get_row(position);",
1239 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1246 "xtype" : "TreeListModel"
1250 "* prop" : "sorter",
1254 "* prop" : "sorter",
1257 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1259 "* prop" : "expression",
1260 "string property_name" : "sort_key",
1261 "xtype" : "PropertyExpression"
1264 "xtype" : "StringSorter"
1267 "xtype" : "TreeListRowSorter"
1270 "xtype" : "SortListModel",
1271 "| Lsp.DocumentSymbol? getSymbolAt" : [
1274 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1276 " var a = tr.get_item();; ",
1277 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1280 " return (Lsp.DocumentSymbol)tr.get_item();",
1284 "| int getRowFromSymbol" : [
1285 "(Lsp.DocumentSymbol sym) {",
1287 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1288 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1290 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1297 "| void collapseOnLoad" : [
1299 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1300 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1301 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1302 "\t\tswitch (sym.kind) {",
1303 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1304 "\t \t\t\ttr.expanded = false;",
1307 "\t\t\t\t//tr.expanded = true;",
1319 "xtype" : "NoSelection"
1325 "(n_press, x, y) => {",
1327 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1329 " if (row == null) {",
1330 "\t GLib.debug(\"no row selected items\");",
1333 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1334 " //Lsp.DocumentSymbol",
1335 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1336 " if (sym == null) {",
1342 " \"line\" : 1410,",
1343 " \"character\" : 8",
1346 " \"line\" : 1410,",
1347 " \"character\" : 39",
1351 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1352 " _this.scroll_to_line((int)sym.range.start.line);",
1353 " Gtk.TextIter iter;",
1354 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1355 " \t(int)sym.range.start.line,",
1356 " \t(int)sym.range.start.character",
1358 " _this.buffer.el.place_cursor(iter);",
1363 "xtype" : "GestureClick"
1366 "string name" : "editor-navigation",
1367 "xtype" : "ColumnView",
1368 "| Gtk.Widget? getRowWidgetAt" : [
1369 "(double x, double y, out string pos) {",
1372 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1373 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1374 "\tif (w == null) {",
1378 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1379 "\tif (row == null) {",
1383 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1387 "\t//GLib.debug(\"row number is %d\", rn);",
1388 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1389 "\t// above or belw",
1390 "\tGraphene.Rect bounds;",
1391 "\trow.compute_bounds(this.el, out bounds);",
1392 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1393 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1394 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1396 "\tvar ypos = y - bounds.get_y();",
1397 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1398 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1399 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1400 "\tpos = \"over\";",
1402 "\tif (rpos > 80) {",
1403 "\t\tpos = \"below\";",
1404 "\t} else if (rpos < 20) {",
1405 "\t\tpos = \"above\";",
1410 "| int getRowAt" : [
1411 "(double x, double y, out string pos) {",
1414 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1415 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1416 "\tif (w == null) {",
1420 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1421 "\tif (row == null) {",
1425 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1430 "\twhile (cr.get_prev_sibling() != null) {",
1432 "\t\tcr = cr.get_prev_sibling();",
1435 "\t//GLib.debug(\"row number is %d\", rn);",
1436 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1437 "\t// above or belw",
1438 "\tGraphene.Rect bounds;",
1439 "\trow.compute_bounds(this.el, out bounds);",
1440 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1441 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1442 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1444 "\tvar ypos = y - bounds.get_y();",
1445 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1446 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1447 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1448 "\tpos = \"over\";",
1450 "\tif (rpos > 80) {",
1451 "\t\tpos = \"below\";",
1452 "\t} else if (rpos < 20) {",
1453 "\t\tpos = \"above\";",
1459 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1460 "\t_this.navigationwindow.el.show();",
1461 "\t//_this.navliststore.el.remove_all();",
1464 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1466 "\tforeach(var sym in syms) {",
1467 "\t\tls.append(sym);",
1469 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1470 "\t//_this.navliststore.el.append(sym);",
1471 "\tthis.last_selected_line = -1;",
1472 "\tGLib.Idle.add(() => {",
1473 "\t\t_this.navigationsort.collapseOnLoad();",
1474 "\t\tGtk.TextIter iter;",
1475 "\t\t_this.buffer.el.get_iter_at_offset (",
1476 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1478 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1479 "\t\t\t\titer.get_line_offset());",
1480 "\t\tthis.updateSelectedLine(",
1481 "\t\t\t\t(uint)iter.get_line(),",
1482 "\t\t\t\t(uint)iter.get_line_offset()",
1484 "\t\treturn false;",
1489 "| void updateSelectedLine" : [
1490 "(uint line, uint chr) {",
1491 "\tif (line == this.last_selected_line) {",
1494 "\tGLib.debug(\"select line %d\", (int)line);",
1495 "\tthis.last_selected_line = (int)line;",
1498 "\tvar new_row = -1;",
1499 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1500 "\tif (sym != null) {",
1501 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1502 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1504 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1507 "\tif (this.selected_row != null) { ",
1508 "\t\tGLib.debug(\" remove selected row\");",
1509 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1511 "\tthis.selected_row = null;",
1512 "\tif (new_row > -1) {",
1513 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1514 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1515 "\t\tif (row != null) {",
1516 "\t\t\tGLib.debug(\" Add selected row\");",
1518 "\t\t\trow.add_css_class(\"selected-row\");",
1519 "\t\t\tthis.selected_row = row;",
1523 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1533 "xtype" : "ScrolledWindow"
1543 "| bool saveContents" : [
1547 " if (_this.file == null) {",
1553 " var str = _this.buffer.toString();",
1555 " _this.buffer.checkSyntax();",
1559 " // LeftPanel.model.changed( str , false);",
1560 " _this.dirty = false;",
1561 " _this.save_button.el.sensitive = false;",
1563 " // find the text for the node..",
1564 " if (_this.file.xtype != \"PlainFile\") {",
1565 " // in theory these properties have to exist!?!",
1566 " \tthis.prop.val = str;",
1567 " //this.window.windowstate.left_props.reload();",
1569 " _this.file.setSource( str );",
1572 " // call the signal..",
1580 "(string in_txt) {",
1582 "\tvar s = new GtkSource.SearchSettings();",
1583 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1584 "\ts.regex_enabled = _this.regex.el.active;\t",
1585 "\ts.wrap_around = false;",
1587 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1588 "\tthis.searchcontext.set_highlight(true);",
1589 "\tvar txt = in_txt;",
1591 "\tif (_this.multiline.el.active) {",
1592 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1595 "\ts.set_search_text(txt);",
1596 "\tGtk.TextIter beg, st,en;",
1598 "\tthis.buffer.el.get_start_iter(out beg);",
1599 "\tbool has_wrapped_around;",
1600 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1601 "\tthis.last_search_end = 0;",
1603 "\treturn this.searchcontext.get_occurrences_count();",
1611 "| string tempFileContents" : [
1615 " if (_this.file == null) {",
1618 "\tvar str= this.buffer.toString();",
1619 "\tif (_this.file.xtype == \"PlainFile\") {",
1627 " GLib.debug(\"calling validate\"); ",
1628 " // clear the buttons.",
1629 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1630 "\t\treturn this.file.toSource(); ;",
1633 "\tvar oldcode = _this.prop.val;",
1634 "\t_this.prop.val = str;",
1635 " var ret = _this.file.toSource();",
1636 " _this.prop.val = oldcode;",
1641 "| void backSearch" : [
1642 "(bool change_focus) {",
1644 "\tif (this.searchcontext == null) {",
1648 "\tGtk.TextIter beg, st,en;",
1649 "\tbool has_wrapped_around;",
1650 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1652 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1653 "\t\tthis.last_search_end = 0;",
1655 "\t\tthis.last_search_end = en.get_offset();",
1656 "\t\tif (change_focus) {",
1657 "\t\t\tthis.view.el.grab_focus();",
1659 "\t\tthis.buffer.el.place_cursor(st);",
1660 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1666 "| void forwardSearch" : [
1667 "(bool change_focus) {",
1669 "\tif (this.searchcontext == null) {",
1673 "\tGtk.TextIter beg, st,en;",
1674 "\t bool has_wrapped_around;",
1675 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1676 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1678 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1680 "\t\tif (has_wrapped_around) {",
1684 "\t\tthis.last_search_end = en.get_offset();",
1685 "\t\tif (change_focus) {",
1686 "\t\t\tthis.view.el.grab_focus();",
1688 "\t\tthis.buffer.el.place_cursor(st);",
1689 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1697 "\t this.file = null; ",
1699 " this.node = null;",
1700 " this.prop = null;",
1701 "\tthis.searchcontext = null;",
1706 "| void scroll_to_line" : [
1709 "\tGLib.Timeout.add(500, () => {",
1711 "\t\tvar buf = this.view.el.get_buffer();",
1713 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1716 "\t\tGtk.TextIter iter; ",
1717 "\t\tsbuf.get_iter_at_line(out iter, line);",
1718 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1719 "\t\treturn false;",
1725 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1728 " if (this.file != null) {",
1729 " \tthis.file.navigation_tree_updated.disconnect(",
1730 " \t\t_this.navigation.show",
1733 " this.file = file; ",
1734 " this.file.navigation_tree_updated.connect(",
1735 "\t\t_this.navigation.show",
1737 " if (file.xtype != \"PlainFile\") {",
1738 " \tthis.prop = prop;",
1739 " this.node = node;",
1741 " // find the text for the node..",
1742 " this.view.load( prop.val );",
1743 " this.updateErrorMarks();",
1747 " this.close_btn.el.show(); ",
1750 " this.view.load( file.toSource() );",
1751 " this.updateErrorMarks();",
1752 " this.close_btn.el.hide();",
1753 " var ls = file.getLanguageServer();",
1754 " ls.queueDocumentSymbols(file);",
1755 " ////ls.documentSymbols.begin(file, (a,o) => {",
1756 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1758 " //documentSymbols",
1764 "| void updateErrorMarks" : [
1769 "\tvar buf = _this.buffer.el;",
1770 "\tGtk.TextIter start;",
1771 "\tGtk.TextIter end; ",
1772 "\tbuf.get_bounds (out start, out end);",
1777 "\t//GLib.debug(\"highlight errors\");\t\t ",
1779 "\t // we should highlight other types of errors..",
1781 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1783 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1785 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1791 "\tif (_this.file == null) {",
1792 "\t\tGLib.debug(\"file is null?\");",
1796 "\tvar ar = this.file.getErrors();",
1797 "\tif (ar.size < 1) {",
1798 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1799 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1800 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1801 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1802 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1803 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1804 "\t\tthis.last_error_counter = file.error_counter ;",
1805 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1810 " // basicaly check if there is no change, then we do not do any update..",
1811 " // we can do this by just using an error counter?",
1812 " // if that's changed then we will do an update, otherwise dont bother.",
1815 "\tvar offset = 0;",
1816 "\tvar hoffset = 0;",
1818 "\tvar tlines = buf.get_line_count () +1;",
1820 "\tif (_this.prop != null) {",
1821 "\t\t// this still seems flaky...",
1823 "\t\ttlines = _this.prop.end_line;",
1824 "\t\toffset = _this.prop.start_line;",
1825 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1829 "\t\t// no update...",
1830 "\t\tif (this.last_error_counter == file.error_counter) {",
1836 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1837 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1838 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1839 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1840 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1841 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1843 "\tforeach(var diag in ar) { ",
1844 "\t Gtk.TextIter iter;",
1845 "// print(\"get inter\\n\");",
1846 "\t var eline = (int)diag.range.start.line - offset;",
1847 "\t var eline_to = (int)diag.range.end.line - offset;",
1848 "\t //var eline = diag.range.end_line - offset;",
1849 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1850 "\t //\terr.line ,eline, offset);",
1853 "\t if (eline > tlines || eline < 0) {",
1857 "\t buf.get_iter_at_line( out iter, eline);",
1858 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1859 "\t buf.create_source_mark( msg, diag.category, iter);",
1861 " \t var spos = (int)diag.range.start.character - hoffset;",
1862 " \t if (spos < 0) { spos =0 ; }",
1863 " \t if (spos > iter.get_chars_in_line()) {",
1864 " \t \tspos = iter.get_chars_in_line();",
1866 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1867 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1868 " \t if (epos < 0) { epos =0 ; }",
1869 " \t if (epos > iter.get_chars_in_line()) {",
1870 " \t \tepos = iter.get_chars_in_line();",
1874 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1876 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1878 "\t buf.apply_tag_by_name(diag.category, start, end);",
1880 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1881 "\t //this.marks.set(eline, msg);",
1883 "\tthis.last_error_counter = file.error_counter ;",