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" : true,
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 "bool draw_value" : false,
132 "bool has_origin" : true,
133 "bool sensitive" : true,
135 "int width_request" : 200,
139 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
142 " \tBuilderApplication.settings.editor_font_size = val;",
156 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
157 "string icon_name" : "window-close",
164 " _this.saveContents();",
165 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
170 "string icon_name" : "window-close",
178 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
179 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
180 "bool overlay_scrolling" : false,
181 "bool vexpand" : true,
182 "id" : "RightEditor",
185 "# Gtk.CssProvider css" : "null",
186 "$ gboolean auto_indent" : true,
187 "$ xns" : "GtkSource",
194 "this.el.completion.add_provider(",
195 "\tnew Palete.CompletionProvider(_this)",
198 "// hover seems pretty useless.. - ??",
199 "//var hover = this.el.get_hover();",
200 "//hover.add_provider(new Palete.HoverProvider(_this));",
202 "//this.el.completion.unblock_interactive();",
203 "this.el.completion.select_on_show = true; // select",
204 "//this.el.completion.remember_info_visibility\t = true;",
207 "var attrs = new GtkSource.MarkAttributes();",
209 "attrs.set_icon_name ( \"process-stop\"); ",
210 "attrs.query_tooltip_text.connect(( mark) => {",
211 " GLib.debug(\"tooltip query? %s\", mark.name);",
212 " return strdup( mark.name);",
214 " attrs.query_tooltip_markup.connect(( mark) => {",
215 " GLib.debug(\"tooltip query? %s\", mark.name);",
216 " return strdup( mark.name);",
218 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
222 "var wattrs = new GtkSource.MarkAttributes();",
223 "wattrs.set_icon_name ( \"process-stop\"); ",
224 "wattrs.query_tooltip_text.connect(( mark) => {",
225 " GLib.debug(\"tooltip query? %s\", mark.name);",
226 " return strdup(mark.name);",
228 "wattrs.query_tooltip_markup.connect(( mark) => {",
229 " GLib.debug(\"tooltip query? %s\", mark.name);",
230 " return strdup(mark.name);",
232 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
236 "var dattrs = new GtkSource.MarkAttributes();",
238 "dattrs.set_icon_name ( \"process-stop\"); ",
240 "dattrs.query_tooltip_text.connect(( mark) => {",
241 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
242 " return strdup(mark.name);",
244 "//dattrs.query_tooltip_markup.connect(( mark) => {",
245 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
246 " // return strdup(mark.name);",
248 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
251 " this.el.get_space_drawer().set_matrix(null);",
252 " this.el.get_space_drawer().set_types_for_locations( ",
253 "\tGtkSource.SpaceLocationFlags.ALL,",
254 "\tGtkSource.SpaceTypeFlags.ALL",
256 "this.el.get_space_drawer().set_enable_matrix(true);",
260 "bool has_tooltip" : true,
261 "bool hexpand" : true,
262 "bool insert_spaces_instead_of_tabs" : true,
263 "bool vexpand" : true,
264 "boolean show_line_marks" : true,
265 "boolean show_line_numbers" : true,
266 "css_classes" : "{ \"code-editor\" }",
267 "gboolean highlight_current_line" : true,
272 "$ Gee.HashMap<int,string>? xmarks" : "null",
273 "$ xns" : "GtkSource",
274 "$ xtype" : "Buffer",
277 "var buf = this.el;",
278 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
279 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
280 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
281 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
282 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
283 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
284 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
285 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
288 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
289 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
290 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
296 "bool check_queued" : false,
297 "bool enable_undo" : true,
298 "bool highlight_matching_brackets" : true,
299 "bool highlight_syntax" : true,
301 "int error_line" : "-1",
305 " // check syntax??",
307 " _this.save_button.el.sensitive = true;",
308 " print(\"EDITOR CHANGED\");",
309 " this.checkSyntax();",
311 " _this.dirty = true;",
313 " // this.get('/LeftPanel.model').changed( str , false);",
321 "\tGtk.TextIter iter;",
322 "\tthis.el.get_iter_at_offset (",
323 "\t\t\tout iter, this.el.cursor_position);",
325 "\t_this.navigation.updateSelectedLine(",
326 "\t\t\t(uint)iter.get_line(),",
327 "\t\t\t(uint)iter.get_line_offset()",
329 "\tthis.showHelp(iter);",
335 "| bool OLDhighlightErrorsJson" : [
336 "(string type, Json.Object obj) {",
337 "\tGtk.TextIter start;",
338 "\tGtk.TextIter end; ",
339 "\tthis.el.get_bounds (out start, out end);",
341 "\tthis.el.remove_source_marks (start, end, type);",
342 "\tGLib.debug(\"highlight errors\");\t\t ",
344 "\t // we should highlight other types of errors..",
346 "\tif (!obj.has_member(type)) {",
347 "\t\tGLib.debug(\"Return has no errors\\n\");",
351 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
353 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
355 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
360 "\t//this.marks = new Gee.HashMap<int,string>();",
361 "\tvar err = obj.get_object_member(type);",
363 "\tif (_this.file == null) {",
364 "\t\tGLib.debug(\"file is null?\");",
368 "\tvar valafn = _this.file.path;",
370 "\tif (_this.file.xtype != \"PlainFile\") {",
372 "\t\tvalafn = \"\";",
374 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
375 "\t\t\t// should not happen",
376 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
377 "\t\t} catch (GLib.RegexError e) {",
378 "\t\t\treturn true;",
384 "\tif (!err.has_member(valafn)) {",
385 "\t\tGLib.debug(\"File path has no errors\");",
389 "\tvar lines = err.get_object_member(valafn);",
392 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
393 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
397 "\tvar tlines = this.el.get_line_count () +1;",
399 "\tif (_this.prop != null) {",
401 "\t\ttlines = _this.prop.end_line + 1;",
402 "\t\toffset = _this.prop.start_line + 1;",
408 "\tlines.foreach_member((obj, line, node) => {",
410 "\t Gtk.TextIter iter;",
411 "// print(\"get inter\\n\");",
412 "\t var eline = int.parse(line) - offset;",
413 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
416 "\t if (eline > tlines || eline < 0) {",
421 "\t this.el.get_iter_at_line( out iter, eline);",
422 "\t //print(\"mark line\\n\");",
423 "\t var msg = \"\";",
424 "\t var ar = lines.get_array_member(line);",
425 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
426 "\t \tif (ar.get_string_element(i) == \"Success\") {",
429 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
430 "\t\t\tmsg += ar.get_string_element(i);",
432 "\t\tif (msg == \"\") {",
435 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
436 "\t this.el.create_source_mark(msg, type, iter);",
437 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
438 "\t // this.marks.set(eline, msg);",
449 "| bool checkSyntax" : [
453 " var str = this.toString();",
456 " if (this.error_line > 0) {",
457 " Gtk.TextIter start;",
458 " Gtk.TextIter end; ",
459 " this.el.get_bounds (out start, out end);",
461 " this.el.remove_source_marks (start, end, null);",
463 " if (str.length < 1) {",
464 " print(\"checkSyntax - empty string?\\n\");",
468 " // bit presumptiona",
469 " if (_this.file.xtype == \"PlainFile\") {",
471 " // assume it's gtk...",
472 " var oldcode =_this.file.toSource();",
473 " _this.file.setSource(str);",
474 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
475 " \t_this.file.getLanguageServer().document_change(_this.file);",
476 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
477 " _this.file.setSource(oldcode);",
483 " if (_this.file == null) {",
491 " GLib.debug(\"calling validate\"); ",
492 " // clear the buttons.",
493 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
496 "\tvar oldcode = _this.prop.val;",
498 "\t_this.prop.val = str;",
499 "\t_this.node.updated_count++;",
500 " _this.file.getLanguageServer().document_change(_this.file);",
501 " _this.node.updated_count++;",
502 " _this.prop.val = oldcode;",
505 " //print(\"done mark line\\n\");",
507 " return true; // at present allow saving - even if it's invalid..",
511 "| bool highlightErrors" : [
512 "( Gee.HashMap<int,string> validate_res) {",
514 "\tthis.error_line = validate_res.size;",
516 "\tif (this.error_line < 1) {",
519 "\tvar tlines = this.el.get_line_count ();",
520 "\tGtk.TextIter iter;",
521 "\tvar valiter = validate_res.map_iterator();",
522 "\twhile (valiter.next()) {",
524 "\t// print(\"get inter\\n\");",
525 "\t\tvar eline = valiter.get_key();",
526 "\t\tif (eline > tlines) {",
529 "\t\tthis.el.get_iter_at_line( out iter, eline);",
530 "\t\t//print(\"mark line\\n\");",
531 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
536 "| string toString" : [
541 " this.el.get_start_iter(out s);",
542 " this.el.get_end_iter(out e);",
543 " var ret = this.el.get_text(s,e,true);",
544 " //print(\"TO STRING? \" + ret);",
549 "| void showHelp" : [
550 "(Gtk.TextIter iter) {",
551 "\tvar back = iter.copy();",
552 "\tback.backward_char();",
554 "\tvar forward = iter.copy();",
555 "\tforward.forward_char();",
557 "\t// what's the character at the iter?",
558 "\tvar str = back.get_text(iter);",
559 "\tstr += iter.get_text(forward);",
560 "\tif (str.strip().length < 1) {",
563 "\tvar offset = iter.get_line_offset();",
564 "\tvar line = iter.get_line();",
565 "\tif (_this.prop != null) {",
567 "\t\tline += _this.prop.start_line ; ",
568 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
569 "\t\toffset += _this.node.node_pad.length;",
570 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
571 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
572 "\t\t\toffset += 2;",
576 "\tvar ls = _this.file.getLanguageServer();",
578 "\t\t_this.file, line, offset,",
581 "\t\t\t\tvar res = ls.hover.end(o );",
583 "\t\t\t\t_this.helper.setHelp(res);",
584 "\t\t\t} catch (GLib.Error e) {",
594 "# bool is_control" : false,
599 "(keyval, keycode, state) => {",
601 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
602 " \t\tthis.is_control = true;",
609 "(keyval, keycode, state) => {",
611 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
612 " \t\tthis.is_control = false;",
614 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
615 " GLib.debug(\"SAVE: ctrl-S pressed\");",
616 " _this.saveContents();",
620 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
621 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
622 "\t\t_this.forwardSearch(true);",
625 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
626 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
627 "\t\t_this.search_entry.el.grab_focus();",
628 "\t\t_this.search_entry.el.select_region(0,-1);",
631 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
632 "\t\t_this.view.el.show_completion();",
635 "\tGtk.TextIter iter;",
636 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
637 "\tvar line = iter.get_line();",
638 "\tvar offset = iter.get_line_offset();",
639 "\tGLib.debug(\"line %d off %d\", line ,offset);",
640 "\tif (_this.prop != null) {",
641 "\t\tline += _this.prop.start_line + 1; // i think..",
642 "\t\toffset += 12; // should probably be 8 without namespaced ",
643 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
645 " //_this.view.el.show_completion();",
646 " // print(event.key.keyval)",
656 "xtype" : "EventControllerKey"
659 "# double distance" : "0.0f",
661 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
665 "\tif (!_this.keystate.is_control) {",
668 "\t //GLib.debug(\"scroll %f\", dy);",
670 "\tthis.distance += dy;",
672 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
674 "\t if (this.distance < -1) {",
676 "\t\tBuilderApplication.settings.editor_font_size ++;",
677 "\t\tthis.distance = 0;",
679 "\tif (this.distance > 1) {",
680 "\t\tBuilderApplication.settings.editor_font_size --;",
681 "\t\tthis.distance = 0;",
689 "xtype" : "EventControllerScroll"
695 "(n_press, x, y) => {",
696 "\tGtk.TextIter iter;",
697 "\tint buffer_x, buffer_y;",
698 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
700 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
701 "\t\t(int)x - gut.get_width(), (int)y,",
702 " \t\tout buffer_x, out buffer_y);",
703 "\t_this.view.el.get_iter_at_location (out iter, ",
704 "\t\t\tbuffer_x, buffer_y);;",
707 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
708 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
712 "\t_this.buffer.showHelp(iter);",
720 "xtype" : "GestureClick"
725 "(x, y, keyboard_tooltip, tooltip) => {",
727 "\t//GLib.debug(\"query tooltip\");",
728 "\tGtk.TextIter iter;",
731 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
733 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
735 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
736 "\t//\treturn false;",
739 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
741 "\tvar l = iter.get_line();",
745 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
751 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
752 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
753 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
761 "\t// this crashes?? - not sure why.",
762 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
763 "\tif (marks.is_empty()) {",
764 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
766 "\tif (marks.is_empty()) {",
767 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
770 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
772 "\tmarks.@foreach((m) => { ",
773 "\t\t//GLib.debug(\"got mark %s\", m.name);",
774 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
776 "\t// true if there is a mark..",
777 "\tif (str.length > 0 ) {",
778 "\t\ttooltip.set_text( str );",
780 "\treturn str.length > 0 ? true : false;",
786 "string name" : "editor-view",
787 "uint tab_width" : 4,
792 "// show the help page for the active node..",
793 " //this.get('/Help').show();",
795 " // this.get('/BottomPane').el.set_current_page(0);",
796 " \tGLib.debug(\"load called - Reset undo buffer\");",
798 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
799 " buf.begin_irreversible_action();",
800 " buf.set_text(str, str.length);",
801 " buf.end_irreversible_action();",
803 " var lm = GtkSource.LanguageManager.get_default();",
804 " var lang = \"vala\";",
805 " if (_this.file != null) {",
806 " lang = _this.file.language;",
808 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
809 " var lg = _this.file.content_type.length > 0 ?",
810 " lm.guess_language(_this.file.path, _this.file.content_type) :",
811 " lm.get_language(lang);",
814 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
816 " this.el.insert_spaces_instead_of_tabs = true;",
817 " if (lg != null) {",
818 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
819 "\t\tif (lg.name == \"Vala\") {",
820 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
823 " _this.dirty = false;",
824 " this.el.grab_focus();",
825 " _this.save_button.el.sensitive = false;",
826 " _this.last_error_counter = -1;",
831 "xtype" : "ScrolledWindow"
836 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
837 "bool homogeneous" : false,
838 "bool vexpand" : false,
843 "Gtk.CssProvider css" : "",
844 "bool hexpand" : true,
845 "id" : "search_entry",
851 "(keyval, keycode, state) => {",
853 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
854 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
855 "\t\t_this.forwardSearch(true);",
860 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
861 "\t\t_this.forwardSearch(true);",
867 " // print(event.key.keyval)",
874 "xtype" : "EventControllerKey"
881 "_this.search(_this.search_entry.el.text);",
882 "\t _this.search_results.updateResults();",
884 "\tGLib.Timeout.add_seconds(1,() => {",
885 "\t\t _this.search_results.updateResults();",
886 "\t\t return false;",
892 "string name" : "editor-search-entry",
893 "string placeholder_text" : "Press enter to search",
894 "uint search_delay" : 3,
895 "xtype" : "SearchEntry",
896 "| void forwardSearch" : [
897 "(bool change_focus) {",
900 "\t_this.forwardSearch(change_focus);",
904 "\tswitch(_this.windowstate.state) {",
905 "\t\tcase WindowState.State.CODEONLY:",
906 "\t\t//case WindowState.State.CODE:",
907 "\t\t\t// search the code being edited..",
908 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
911 "\t\tcase WindowState.State.PREVIEW:",
912 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
913 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
915 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
928 "id" : "search_results",
929 "int margin_end" : 4,
930 "int margin_start" : 4,
931 "string label" : "No Results",
933 "| void updateResults" : [
935 "\tthis.el.visible = true;",
937 "\tvar res = _this.searchcontext.get_occurrences_count();",
939 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
943 "\t_this.nextBtn.el.sensitive = false;",
944 "\t_this.backBtn.el.sensitive = false;\t",
947 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
948 "\t\t_this.nextBtn.el.sensitive = true;",
949 "\t\t_this.backBtn.el.sensitive = true;",
952 "\t_this.search_results.el.label = \"No Matches\";",
959 "bool always_show_image" : true,
960 "bool sensitive" : false,
966 "\t_this.forwardSearch(true);",
973 "string icon_name" : "go-down",
978 "bool always_show_image" : true,
979 "bool sensitive" : false,
985 "\t_this.backSearch(true);",
991 "string icon_name" : "go-up",
996 "bool always_show_arrow" : true,
997 "bool always_show_image" : true,
1001 "* prop" : "popover",
1002 "id" : "search_settings",
1007 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1014 "\tthis.el.show();",
1018 "id" : "case_sensitive",
1019 "string label" : "Case Sensitive",
1020 "xtype" : "CheckButton"
1026 "\tthis.el.show();",
1031 "string label" : "Regex",
1032 "xtype" : "CheckButton"
1037 "string label" : "Multi-line (add \\n)",
1038 "xtype" : "CheckButton"
1047 "string icon_name" : "emblem-system",
1048 "xtype" : "MenuButton"
1058 "* prop" : "end_child",
1059 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1060 "bool hexpand" : true,
1061 "bool vexpand" : true,
1066 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1072 "bool hexpand" : true,
1073 "bool vexpand" : true,
1074 "bool visible" : false,
1075 "id" : "navigationwindow",
1078 "# int last_selected_line" : "-1",
1079 "$ Gtk.Widget? selected_row" : "null",
1082 "id" : "navigation",
1086 "bool expand" : true,
1090 "* prop" : "factory",
1095 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1097 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1098 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1101 "\tvar hbox = (Gtk.Box) expand.child;",
1104 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1105 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1107 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1108 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1110 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1111 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1113 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1115 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1117 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1118 " \texpand.set_list_row(lr);",
1119 " \t//this.in_bind = true;",
1120 " \t// default is to expand",
1122 " \t//this.in_bind = false;",
1124 " \tsym.bind_property(\"symbol_icon\",",
1125 " img, \"icon_name\",",
1126 " GLib.BindingFlags.SYNC_CREATE);",
1128 " \thbox.css_classes = { sym.symbol_icon };",
1130 " \tsym.bind_property(\"name\",",
1132 " GLib.BindingFlags.SYNC_CREATE);",
1133 " \t// should be better?- --line no?",
1134 " \tsym.bind_property(\"tooltip\",",
1135 " lbl, \"tooltip_markup\",",
1136 " GLib.BindingFlags.SYNC_CREATE);",
1137 " \t// bind image...",
1145 "\tvar expand = new Gtk.TreeExpander();",
1147 "\texpand.set_indent_for_depth(true);",
1148 "\texpand.set_indent_for_icon(true);",
1149 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1150 "\tvar icon = new Gtk.Image();",
1151 "\tvar lbl = new Gtk.Label(\"\");",
1152 "\tlbl.use_markup = true;",
1153 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1155 "\ticon.margin_end = 4;",
1156 " \tlbl.justify = Gtk.Justification.LEFT;",
1157 " \tlbl.xalign = 0;",
1159 "//\tlistitem.activatable = true; ??",
1161 "\thbox.append(icon);",
1162 "\thbox.append(lbl);",
1163 "\texpand.set_child(hbox);",
1164 "\t((Gtk.ListItem)listitem).set_child(expand);",
1170 "xtype" : "SignalListItemFactory"
1173 "string title" : "Code Navigation",
1174 "xtype" : "ColumnViewColumn"
1179 "id" : "navigationselmodel",
1184 "id" : "navigationsort",
1187 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1190 "\treturn ((Lsp.DocumentSymbol)item).children;",
1196 "bool autoexpand" : true,
1197 "bool passthrough" : false,
1200 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1203 "id" : "navliststore",
1204 "xtype" : "ListStore",
1205 "| Lsp.DocumentSymbol? symbolAtLine" : [
1206 "(uint line, uint chr) {",
1209 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1210 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1211 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1212 "\t\t//\tel.name , (int)el.range.start.line,",
1213 "\t\t//\t(int)el.range.end.line",
1215 "\t\tvar ret = el.containsLine(line,chr);",
1216 "\t\tif (ret != null) {",
1217 "\t\t\treturn ret;",
1229 "(position, removed, added) => {",
1230 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1231 "\t if (added < 1) { ",
1234 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1235 "\tvar row = this.el.get_row(position);",
1237 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1244 "xtype" : "TreeListModel"
1248 "* prop" : "sorter",
1252 "* prop" : "sorter",
1255 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1257 "* prop" : "expression",
1258 "string property_name" : "sort_key",
1259 "xtype" : "PropertyExpression"
1262 "xtype" : "StringSorter"
1265 "xtype" : "TreeListRowSorter"
1268 "xtype" : "SortListModel",
1269 "| Lsp.DocumentSymbol? getSymbolAt" : [
1272 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1274 " var a = tr.get_item();; ",
1275 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1278 " return (Lsp.DocumentSymbol)tr.get_item();",
1282 "| int getRowFromSymbol" : [
1283 "(Lsp.DocumentSymbol sym) {",
1285 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1286 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1288 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1295 "| void collapseOnLoad" : [
1297 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1298 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1299 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1300 "\t\tswitch (sym.kind) {",
1301 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1302 "\t \t\t\ttr.expanded = false;",
1305 "\t\t\t\t//tr.expanded = true;",
1317 "xtype" : "NoSelection"
1323 "(n_press, x, y) => {",
1325 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1327 " if (row == null) {",
1328 "\t GLib.debug(\"no row selected items\");",
1331 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1332 " //Lsp.DocumentSymbol",
1333 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1334 " if (sym == null) {",
1340 " \"line\" : 1410,",
1341 " \"character\" : 8",
1344 " \"line\" : 1410,",
1345 " \"character\" : 39",
1349 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1350 " _this.scroll_to_line((int)sym.range.start.line);",
1351 " Gtk.TextIter iter;",
1352 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1353 " \t(int)sym.range.start.line,",
1354 " \t(int)sym.range.start.character",
1356 " _this.buffer.el.place_cursor(iter);",
1361 "xtype" : "GestureClick"
1364 "string name" : "editor-navigation",
1365 "xtype" : "ColumnView",
1366 "| Gtk.Widget? getRowWidgetAt" : [
1367 "(double x, double y, out string pos) {",
1370 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1371 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1372 "\tif (w == null) {",
1376 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1377 "\tif (row == null) {",
1381 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1385 "\t//GLib.debug(\"row number is %d\", rn);",
1386 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1387 "\t// above or belw",
1388 "\tGraphene.Rect bounds;",
1389 "\trow.compute_bounds(this.el, out bounds);",
1390 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1391 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1392 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1394 "\tvar ypos = y - bounds.get_y();",
1395 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1396 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1397 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1398 "\tpos = \"over\";",
1400 "\tif (rpos > 80) {",
1401 "\t\tpos = \"below\";",
1402 "\t} else if (rpos < 20) {",
1403 "\t\tpos = \"above\";",
1408 "| int getRowAt" : [
1409 "(double x, double y, out string pos) {",
1412 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1413 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1414 "\tif (w == null) {",
1418 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1419 "\tif (row == null) {",
1423 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1428 "\twhile (cr.get_prev_sibling() != null) {",
1430 "\t\tcr = cr.get_prev_sibling();",
1433 "\t//GLib.debug(\"row number is %d\", rn);",
1434 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1435 "\t// above or belw",
1436 "\tGraphene.Rect bounds;",
1437 "\trow.compute_bounds(this.el, out bounds);",
1438 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1439 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1440 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1442 "\tvar ypos = y - bounds.get_y();",
1443 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1444 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1445 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1446 "\tpos = \"over\";",
1448 "\tif (rpos > 80) {",
1449 "\t\tpos = \"below\";",
1450 "\t} else if (rpos < 20) {",
1451 "\t\tpos = \"above\";",
1457 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1458 "\t_this.navigationwindow.el.show();",
1459 "\t//_this.navliststore.el.remove_all();",
1462 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1464 "\tforeach(var sym in syms) {",
1465 "\t\tls.append(sym);",
1467 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1468 "\t//_this.navliststore.el.append(sym);",
1469 "\tthis.last_selected_line = -1;",
1470 "\tGLib.Idle.add(() => {",
1471 "\t\t_this.navigationsort.collapseOnLoad();",
1472 "\t\tGtk.TextIter iter;",
1473 "\t\t_this.buffer.el.get_iter_at_offset (",
1474 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1476 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1477 "\t\t\t\titer.get_line_offset());",
1478 "\t\tthis.updateSelectedLine(",
1479 "\t\t\t\t(uint)iter.get_line(),",
1480 "\t\t\t\t(uint)iter.get_line_offset()",
1482 "\t\treturn false;",
1487 "| void updateSelectedLine" : [
1488 "(uint line, uint chr) {",
1489 "\tif (line == this.last_selected_line) {",
1492 "\tGLib.debug(\"select line %d\", (int)line);",
1493 "\tthis.last_selected_line = (int)line;",
1496 "\tvar new_row = -1;",
1497 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1498 "\tif (sym != null) {",
1499 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1500 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1502 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1505 "\tif (this.selected_row != null) { ",
1506 "\t\tGLib.debug(\" remove selected row\");",
1507 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1509 "\tthis.selected_row = null;",
1510 "\tif (new_row > -1) {",
1511 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1512 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1513 "\t\tif (row != null) {",
1514 "\t\t\tGLib.debug(\" Add selected row\");",
1516 "\t\t\trow.add_css_class(\"selected-row\");",
1517 "\t\t\tthis.selected_row = row;",
1521 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1531 "xtype" : "ScrolledWindow"
1541 "| bool saveContents" : [
1545 " if (_this.file == null) {",
1551 " var str = _this.buffer.toString();",
1553 " _this.buffer.checkSyntax();",
1557 " // LeftPanel.model.changed( str , false);",
1558 " _this.dirty = false;",
1559 " _this.save_button.el.sensitive = false;",
1561 " // find the text for the node..",
1562 " if (_this.file.xtype != \"PlainFile\") {",
1563 " // in theory these properties have to exist!?!",
1564 " \tthis.prop.val = str;",
1565 " //this.window.windowstate.left_props.reload();",
1567 " _this.file.setSource( str );",
1570 " // call the signal..",
1578 "(string in_txt) {",
1580 "\tvar s = new GtkSource.SearchSettings();",
1581 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1582 "\ts.regex_enabled = _this.regex.el.active;\t",
1583 "\ts.wrap_around = false;",
1585 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1586 "\tthis.searchcontext.set_highlight(true);",
1587 "\tvar txt = in_txt;",
1589 "\tif (_this.multiline.el.active) {",
1590 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1593 "\ts.set_search_text(txt);",
1594 "\tGtk.TextIter beg, st,en;",
1596 "\tthis.buffer.el.get_start_iter(out beg);",
1597 "\tbool has_wrapped_around;",
1598 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1599 "\tthis.last_search_end = 0;",
1601 "\treturn this.searchcontext.get_occurrences_count();",
1609 "| string tempFileContents" : [
1613 " if (_this.file == null) {",
1616 "\tvar str= this.buffer.toString();",
1617 "\tif (_this.file.xtype == \"PlainFile\") {",
1625 " GLib.debug(\"calling validate\"); ",
1626 " // clear the buttons.",
1627 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1628 "\t\treturn this.file.toSource(); ;",
1631 "\tvar oldcode = _this.prop.val;",
1632 "\t_this.prop.val = str;",
1633 " var ret = _this.file.toSource();",
1634 " _this.prop.val = oldcode;",
1639 "| void backSearch" : [
1640 "(bool change_focus) {",
1642 "\tif (this.searchcontext == null) {",
1646 "\tGtk.TextIter beg, st,en;",
1647 "\tbool has_wrapped_around;",
1648 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1650 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1651 "\t\tthis.last_search_end = 0;",
1653 "\t\tthis.last_search_end = en.get_offset();",
1654 "\t\tif (change_focus) {",
1655 "\t\t\tthis.view.el.grab_focus();",
1657 "\t\tthis.buffer.el.place_cursor(st);",
1658 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1664 "| void forwardSearch" : [
1665 "(bool change_focus) {",
1667 "\tif (this.searchcontext == null) {",
1671 "\tGtk.TextIter beg, st,en;",
1672 "\t bool has_wrapped_around;",
1673 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1674 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1676 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1678 "\t\tif (has_wrapped_around) {",
1682 "\t\tthis.last_search_end = en.get_offset();",
1683 "\t\tif (change_focus) {",
1684 "\t\t\tthis.view.el.grab_focus();",
1686 "\t\tthis.buffer.el.place_cursor(st);",
1687 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1695 "\t this.file = null; ",
1697 " this.node = null;",
1698 " this.prop = null;",
1699 "\tthis.searchcontext = null;",
1704 "| void scroll_to_line" : [
1707 "\tGLib.Timeout.add(500, () => {",
1709 "\t\tvar buf = this.view.el.get_buffer();",
1711 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1714 "\t\tGtk.TextIter iter; ",
1715 "\t\tsbuf.get_iter_at_line(out iter, line);",
1716 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1717 "\t\treturn false;",
1723 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1726 " if (this.file != null) {",
1727 " \tthis.file.navigation_tree_updated.disconnect(",
1728 " \t\t_this.navigation.show",
1731 " this.file = file; ",
1732 " this.file.navigation_tree_updated.connect(",
1733 "\t\t_this.navigation.show",
1735 " if (file.xtype != \"PlainFile\") {",
1736 " \tthis.prop = prop;",
1737 " this.node = node;",
1739 " // find the text for the node..",
1740 " this.view.load( prop.val );",
1741 " this.updateErrorMarks();",
1745 " this.close_btn.el.show(); ",
1748 " this.view.load( file.toSource() );",
1749 " this.updateErrorMarks();",
1750 " this.close_btn.el.hide();",
1751 " var ls = file.getLanguageServer();",
1752 " ls.queueDocumentSymbols(file);",
1753 " ////ls.documentSymbols.begin(file, (a,o) => {",
1754 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1756 " //documentSymbols",
1762 "| void updateErrorMarks" : [
1767 "\tvar buf = _this.buffer.el;",
1768 "\tGtk.TextIter start;",
1769 "\tGtk.TextIter end; ",
1770 "\tbuf.get_bounds (out start, out end);",
1775 "\t//GLib.debug(\"highlight errors\");\t\t ",
1777 "\t // we should highlight other types of errors..",
1779 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1781 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1783 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1789 "\tif (_this.file == null) {",
1790 "\t\tGLib.debug(\"file is null?\");",
1794 "\tvar ar = this.file.getErrors();",
1795 "\tif (ar.size < 1) {",
1796 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1797 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1798 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1799 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1800 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1801 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1802 "\t\tthis.last_error_counter = file.error_counter ;",
1803 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1808 " // basicaly check if there is no change, then we do not do any update..",
1809 " // we can do this by just using an error counter?",
1810 " // if that's changed then we will do an update, otherwise dont bother.",
1813 "\tvar offset = 0;",
1814 "\tvar hoffset = 0;",
1816 "\tvar tlines = buf.get_line_count () +1;",
1818 "\tif (_this.prop != null) {",
1819 "\t\t// this still seems flaky...",
1821 "\t\ttlines = _this.prop.end_line;",
1822 "\t\toffset = _this.prop.start_line;",
1823 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1827 "\t\t// no update...",
1828 "\t\tif (this.last_error_counter == file.error_counter) {",
1834 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1835 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1836 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1837 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1838 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1839 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1841 "\tforeach(var diag in ar) { ",
1842 "\t Gtk.TextIter iter;",
1843 "// print(\"get inter\\n\");",
1844 "\t var eline = (int)diag.range.start.line - offset;",
1845 "\t var eline_to = (int)diag.range.end.line - offset;",
1846 "\t //var eline = diag.range.end_line - offset;",
1847 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1848 "\t //\terr.line ,eline, offset);",
1851 "\t if (eline > tlines || eline < 0) {",
1855 "\t buf.get_iter_at_line( out iter, eline);",
1856 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1857 "\t buf.create_source_mark( msg, diag.category, iter);",
1859 " \t var spos = (int)diag.range.start.character - hoffset;",
1860 " \t if (spos < 0) { spos =0 ; }",
1861 " \t if (spos > iter.get_chars_in_line()) {",
1862 " \t \tspos = iter.get_chars_in_line();",
1864 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1865 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1866 " \t if (epos < 0) { epos =0 ; }",
1867 " \t if (epos > iter.get_chars_in_line()) {",
1868 " \t \tepos = iter.get_chars_in_line();",
1872 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1874 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1876 "\t buf.apply_tag_by_name(diag.category, start, end);",
1878 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1879 "\t //this.marks.set(eline, msg);",
1881 "\tthis.last_error_counter = file.error_counter ;",