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,
1065 "int width_request" : 120,
1069 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1075 "bool hexpand" : true,
1076 "bool vexpand" : true,
1077 "bool visible" : false,
1078 "id" : "navigationwindow",
1081 "# int last_selected_line" : "-1",
1082 "$ Gtk.Widget? selected_row" : "null",
1085 "id" : "navigation",
1086 "int width_request" : 200,
1090 "bool expand" : true,
1094 "* prop" : "factory",
1099 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1101 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1102 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1105 "\tvar hbox = (Gtk.Box) expand.child;",
1108 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1109 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1111 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1112 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1114 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1115 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1117 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1119 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1121 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1122 " \texpand.set_list_row(lr);",
1123 " \t//this.in_bind = true;",
1124 " \t// default is to expand",
1126 " \t//this.in_bind = false;",
1128 " \tsym.bind_property(\"symbol_icon\",",
1129 " img, \"icon_name\",",
1130 " GLib.BindingFlags.SYNC_CREATE);",
1132 " \thbox.css_classes = { sym.symbol_icon };",
1134 " \tsym.bind_property(\"name\",",
1136 " GLib.BindingFlags.SYNC_CREATE);",
1137 " \t// should be better?- --line no?",
1138 " \tsym.bind_property(\"tooltip\",",
1139 " lbl, \"tooltip_markup\",",
1140 " GLib.BindingFlags.SYNC_CREATE);",
1141 " \t// bind image...",
1149 "\tvar expand = new Gtk.TreeExpander();",
1151 "\texpand.set_indent_for_depth(true);",
1152 "\texpand.set_indent_for_icon(true);",
1153 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1154 "\tvar icon = new Gtk.Image();",
1155 "\tvar lbl = new Gtk.Label(\"\");",
1156 "\tlbl.use_markup = true;",
1157 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1159 "\ticon.margin_end = 4;",
1160 " \tlbl.justify = Gtk.Justification.LEFT;",
1161 " \tlbl.xalign = 0;",
1163 "//\tlistitem.activatable = true; ??",
1165 "\thbox.append(icon);",
1166 "\thbox.append(lbl);",
1167 "\texpand.set_child(hbox);",
1168 "\t((Gtk.ListItem)listitem).set_child(expand);",
1174 "xtype" : "SignalListItemFactory"
1177 "string title" : "Code Navigation",
1178 "xtype" : "ColumnViewColumn"
1183 "id" : "navigationselmodel",
1188 "id" : "navigationsort",
1191 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1194 "\treturn ((Lsp.DocumentSymbol)item).children;",
1200 "bool autoexpand" : true,
1201 "bool passthrough" : false,
1204 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1207 "id" : "navliststore",
1208 "xtype" : "ListStore",
1209 "| Lsp.DocumentSymbol? symbolAtLine" : [
1210 "(uint line, uint chr) {",
1213 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1214 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1215 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1216 "\t\t//\tel.name , (int)el.range.start.line,",
1217 "\t\t//\t(int)el.range.end.line",
1219 "\t\tvar ret = el.containsLine(line,chr);",
1220 "\t\tif (ret != null) {",
1221 "\t\t\treturn ret;",
1233 "(position, removed, added) => {",
1234 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1235 "\t if (added < 1) { ",
1238 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1239 "\tvar row = this.el.get_row(position);",
1241 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1248 "xtype" : "TreeListModel"
1252 "* prop" : "sorter",
1256 "* prop" : "sorter",
1259 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1261 "* prop" : "expression",
1262 "string property_name" : "sort_key",
1263 "xtype" : "PropertyExpression"
1266 "xtype" : "StringSorter"
1269 "xtype" : "TreeListRowSorter"
1272 "xtype" : "SortListModel",
1273 "| Lsp.DocumentSymbol? getSymbolAt" : [
1276 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1278 " var a = tr.get_item();; ",
1279 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1282 " return (Lsp.DocumentSymbol)tr.get_item();",
1286 "| int getRowFromSymbol" : [
1287 "(Lsp.DocumentSymbol sym) {",
1289 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1290 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1292 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1299 "| void collapseOnLoad" : [
1301 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1302 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1303 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1304 "\t\tswitch (sym.kind) {",
1305 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1306 "\t \t\t\ttr.expanded = false;",
1309 "\t\t\t\t//tr.expanded = true;",
1321 "xtype" : "NoSelection"
1327 "(n_press, x, y) => {",
1329 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1331 " if (row == null) {",
1332 "\t GLib.debug(\"no row selected items\");",
1335 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1336 " //Lsp.DocumentSymbol",
1337 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1338 " if (sym == null) {",
1344 " \"line\" : 1410,",
1345 " \"character\" : 8",
1348 " \"line\" : 1410,",
1349 " \"character\" : 39",
1353 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1354 " _this.scroll_to_line((int)sym.range.start.line);",
1355 " Gtk.TextIter iter;",
1356 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1357 " \t(int)sym.range.start.line,",
1358 " \t(int)sym.range.start.character",
1360 " _this.buffer.el.place_cursor(iter);",
1365 "xtype" : "GestureClick"
1368 "string name" : "editor-navigation",
1369 "xtype" : "ColumnView",
1370 "| Gtk.Widget? getRowWidgetAt" : [
1371 "(double x, double y, out string pos) {",
1374 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1375 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1376 "\tif (w == null) {",
1380 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1381 "\tif (row == null) {",
1385 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1389 "\t//GLib.debug(\"row number is %d\", rn);",
1390 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1391 "\t// above or belw",
1392 "\tGraphene.Rect bounds;",
1393 "\trow.compute_bounds(this.el, out bounds);",
1394 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1395 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1396 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1398 "\tvar ypos = y - bounds.get_y();",
1399 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1400 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1401 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1402 "\tpos = \"over\";",
1404 "\tif (rpos > 80) {",
1405 "\t\tpos = \"below\";",
1406 "\t} else if (rpos < 20) {",
1407 "\t\tpos = \"above\";",
1412 "| int getRowAt" : [
1413 "(double x, double y, out string pos) {",
1416 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1417 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1418 "\tif (w == null) {",
1422 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1423 "\tif (row == null) {",
1427 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1432 "\twhile (cr.get_prev_sibling() != null) {",
1434 "\t\tcr = cr.get_prev_sibling();",
1437 "\t//GLib.debug(\"row number is %d\", rn);",
1438 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1439 "\t// above or belw",
1440 "\tGraphene.Rect bounds;",
1441 "\trow.compute_bounds(this.el, out bounds);",
1442 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1443 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1444 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1446 "\tvar ypos = y - bounds.get_y();",
1447 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1448 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1449 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1450 "\tpos = \"over\";",
1452 "\tif (rpos > 80) {",
1453 "\t\tpos = \"below\";",
1454 "\t} else if (rpos < 20) {",
1455 "\t\tpos = \"above\";",
1461 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1462 "\t_this.navigationwindow.el.show();",
1464 "\t//_this.navliststore.el.remove_all();",
1467 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1469 "\tforeach(var sym in syms) {",
1470 "\t\tls.append(sym);",
1472 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1473 "\t//_this.navliststore.el.append(sym);",
1474 "\tthis.last_selected_line = -1;",
1475 "\tGLib.Idle.add(() => {",
1476 "\t\t_this.navigationsort.collapseOnLoad();",
1477 "\t\tGtk.TextIter iter;",
1478 "\t\t_this.buffer.el.get_iter_at_offset (",
1479 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1481 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1482 "\t\t\t\titer.get_line_offset());",
1483 "\t\tthis.updateSelectedLine(",
1484 "\t\t\t\t(uint)iter.get_line(),",
1485 "\t\t\t\t(uint)iter.get_line_offset()",
1487 "\t\treturn false;",
1492 "| void updateSelectedLine" : [
1493 "(uint line, uint chr) {",
1494 "\tif (line == this.last_selected_line) {",
1497 "\tGLib.debug(\"select line %d\", (int)line);",
1498 "\tthis.last_selected_line = (int)line;",
1501 "\tvar new_row = -1;",
1502 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1503 "\tif (sym != null) {",
1504 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1505 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1507 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1510 "\tif (this.selected_row != null) { ",
1511 "\t\tGLib.debug(\" remove selected row\");",
1512 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1514 "\tthis.selected_row = null;",
1515 "\tif (new_row > -1) {",
1516 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1517 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1518 "\t\tif (row != null) {",
1519 "\t\t\tGLib.debug(\" Add selected row\");",
1521 "\t\t\trow.add_css_class(\"selected-row\");",
1522 "\t\t\tthis.selected_row = row;",
1526 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1536 "xtype" : "ScrolledWindow"
1546 "| bool saveContents" : [
1550 " if (_this.file == null) {",
1556 " var str = _this.buffer.toString();",
1558 " _this.buffer.checkSyntax();",
1562 " // LeftPanel.model.changed( str , false);",
1563 " _this.dirty = false;",
1564 " _this.save_button.el.sensitive = false;",
1566 " // find the text for the node..",
1567 " if (_this.file.xtype != \"PlainFile\") {",
1568 " // in theory these properties have to exist!?!",
1569 " \tthis.prop.val = str;",
1570 " //this.window.windowstate.left_props.reload();",
1572 " _this.file.setSource( str );",
1575 " // call the signal..",
1583 "(string in_txt) {",
1585 "\tvar s = new GtkSource.SearchSettings();",
1586 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1587 "\ts.regex_enabled = _this.regex.el.active;\t",
1588 "\ts.wrap_around = false;",
1590 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1591 "\tthis.searchcontext.set_highlight(true);",
1592 "\tvar txt = in_txt;",
1594 "\tif (_this.multiline.el.active) {",
1595 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1598 "\ts.set_search_text(txt);",
1599 "\tGtk.TextIter beg, st,en;",
1601 "\tthis.buffer.el.get_start_iter(out beg);",
1602 "\tbool has_wrapped_around;",
1603 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1604 "\tthis.last_search_end = 0;",
1606 "\treturn this.searchcontext.get_occurrences_count();",
1614 "| string tempFileContents" : [
1618 " if (_this.file == null) {",
1621 "\tvar str= this.buffer.toString();",
1622 "\tif (_this.file.xtype == \"PlainFile\") {",
1630 " GLib.debug(\"calling validate\"); ",
1631 " // clear the buttons.",
1632 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1633 "\t\treturn this.file.toSource(); ;",
1636 "\tvar oldcode = _this.prop.val;",
1637 "\t_this.prop.val = str;",
1638 " var ret = _this.file.toSource();",
1639 " _this.prop.val = oldcode;",
1644 "| void backSearch" : [
1645 "(bool change_focus) {",
1647 "\tif (this.searchcontext == null) {",
1651 "\tGtk.TextIter beg, st,en;",
1652 "\tbool has_wrapped_around;",
1653 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1655 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1656 "\t\tthis.last_search_end = 0;",
1658 "\t\tthis.last_search_end = en.get_offset();",
1659 "\t\tif (change_focus) {",
1660 "\t\t\tthis.view.el.grab_focus();",
1662 "\t\tthis.buffer.el.place_cursor(st);",
1663 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1669 "| void forwardSearch" : [
1670 "(bool change_focus) {",
1672 "\tif (this.searchcontext == null) {",
1676 "\tGtk.TextIter beg, st,en;",
1677 "\t bool has_wrapped_around;",
1678 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1679 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1681 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1683 "\t\tif (has_wrapped_around) {",
1687 "\t\tthis.last_search_end = en.get_offset();",
1688 "\t\tif (change_focus) {",
1689 "\t\t\tthis.view.el.grab_focus();",
1691 "\t\tthis.buffer.el.place_cursor(st);",
1692 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1700 "\t this.file = null; ",
1702 " this.node = null;",
1703 " this.prop = null;",
1704 "\tthis.searchcontext = null;",
1709 "| void scroll_to_line" : [
1712 "\tGLib.Timeout.add(500, () => {",
1714 "\t\tvar buf = this.view.el.get_buffer();",
1716 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1719 "\t\tGtk.TextIter iter; ",
1720 "\t\tsbuf.get_iter_at_line(out iter, line);",
1721 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1722 "\t\treturn false;",
1728 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1731 " if (this.file != null) {",
1732 " \tthis.file.navigation_tree_updated.disconnect(",
1733 " \t\t_this.navigation.show",
1736 " this.file = file; ",
1737 " this.file.navigation_tree_updated.connect(",
1738 "\t\t_this.navigation.show",
1740 " if (file.xtype != \"PlainFile\") {",
1741 " \tthis.prop = prop;",
1742 " this.node = node;",
1744 " // find the text for the node..",
1745 " this.view.load( prop.val );",
1746 " this.updateErrorMarks();",
1750 " this.close_btn.el.show(); ",
1753 " this.view.load( file.toSource() );",
1754 " this.updateErrorMarks();",
1755 " this.close_btn.el.hide();",
1756 " var ls = file.getLanguageServer();",
1757 " ls.queueDocumentSymbols(file);",
1758 " ////ls.documentSymbols.begin(file, (a,o) => {",
1759 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1761 " //documentSymbols",
1767 "| void updateErrorMarks" : [
1772 "\tvar buf = _this.buffer.el;",
1773 "\tGtk.TextIter start;",
1774 "\tGtk.TextIter end; ",
1775 "\tbuf.get_bounds (out start, out end);",
1780 "\t//GLib.debug(\"highlight errors\");\t\t ",
1782 "\t // we should highlight other types of errors..",
1784 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1786 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1788 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1794 "\tif (_this.file == null) {",
1795 "\t\tGLib.debug(\"file is null?\");",
1799 "\tvar ar = this.file.getErrors();",
1800 "\tif (ar.size < 1) {",
1801 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1802 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1803 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1804 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1805 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1806 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1807 "\t\tthis.last_error_counter = file.error_counter ;",
1808 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1813 " // basicaly check if there is no change, then we do not do any update..",
1814 " // we can do this by just using an error counter?",
1815 " // if that's changed then we will do an update, otherwise dont bother.",
1818 "\tvar offset = 0;",
1819 "\tvar hoffset = 0;",
1821 "\tvar tlines = buf.get_line_count () +1;",
1823 "\tif (_this.prop != null) {",
1824 "\t\t// this still seems flaky...",
1826 "\t\ttlines = _this.prop.end_line;",
1827 "\t\toffset = _this.prop.start_line;",
1828 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1832 "\t\t// no update...",
1833 "\t\tif (this.last_error_counter == file.error_counter) {",
1839 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1840 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1841 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1842 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1843 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1844 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1846 "\tforeach(var diag in ar) { ",
1847 "\t Gtk.TextIter iter;",
1848 "// print(\"get inter\\n\");",
1849 "\t var eline = (int)diag.range.start.line - offset;",
1850 "\t var eline_to = (int)diag.range.end.line - offset;",
1851 "\t //var eline = diag.range.end_line - offset;",
1852 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1853 "\t //\terr.line ,eline, offset);",
1856 "\t if (eline > tlines || eline < 0) {",
1860 "\t buf.get_iter_at_line( out iter, eline);",
1861 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1862 "\t buf.create_source_mark( msg, diag.category, iter);",
1864 " \t var spos = (int)diag.range.start.character - hoffset;",
1865 " \t if (spos < 0) { spos =0 ; }",
1866 " \t if (spos > iter.get_chars_in_line()) {",
1867 " \t \tspos = iter.get_chars_in_line();",
1869 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1870 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1871 " \t if (epos < 0) { epos =0 ; }",
1872 " \t if (epos > iter.get_chars_in_line()) {",
1873 " \t \tepos = iter.get_chars_in_line();",
1877 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1879 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1881 "\t buf.apply_tag_by_name(diag.category, start, end);",
1883 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1884 "\t //this.marks.set(eline, msg);",
1886 "\tthis.last_error_counter = file.error_counter ;",