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 resize_end_child" : false,
29 "bool resize_start_child" : false,
30 "bool shrink_end_child" : false,
31 "bool shrink_start_child" : false,
36 "* prop" : "start_child",
37 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
38 "bool hexpand" : true,
42 "$ homogeneous" : false,
44 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
45 "bool hexpand" : false,
46 "bool vexpand" : false,
50 "bool vexpand" : true,
56 " _this.saveContents();",
65 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
66 "bool hexpand" : true,
70 "int margin_start" : 4,
73 "(x, y, keyboard_tooltip, tooltip) => {",
82 "(Lsp.Hover? help) {",
83 "\tif (help == null || help.contents == null",
84 "\t\t|| help.contents.size < 1) {",
85 "\t\tthis.el.set_text(\"\");",
88 "\tvar sig = help.contents.get(0).value.split(\" \");",
89 "\tstring[] str = {};",
90 "\tfor(var i =0; i < sig.length; i++) {",
92 "\t\tswitch(sig[i]) {",
93 "\t\t\tcase \"public\":",
94 "\t\t\tcase \"private\":",
95 "\t\t\tcase \"protected\":",
96 "\t\t\tcase \"async\":",
97 "\t\t\tcase \"class\":",
103 "\t\t\t\tstr += sig[i];",
109 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
110 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
111 "\t\t\t\t\t+\"</span>\");",
115 "\tif (help.contents.size > 1) {",
116 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value);",
119 "\tthis.el.set_markup(string.joinv(\" \",str));",
126 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
129 "\t//this.el.set_range(6,30);",
130 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
131 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
133 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
134 " \t\t//\tGLib.debug(\"update range\");",
135 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
136 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
144 "Gtk.Align halign" : "Gtk.Align.END",
145 "bool draw_value" : false,
146 "bool has_origin" : true,
147 "bool sensitive" : true,
149 "int width_request" : 150,
153 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
156 " \tBuilderApplication.settings.editor_font_size = val;",
165 "Gtk.Align halign" : "Gtk.Align.END",
171 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
172 "string icon_name" : "window-close",
179 " _this.saveContents();",
180 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
185 "string icon_name" : "window-close",
193 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
194 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
195 "bool overlay_scrolling" : false,
196 "bool vexpand" : true,
197 "id" : "RightEditor",
200 "# Gtk.CssProvider css" : "null",
201 "$ gboolean auto_indent" : true,
202 "$ xns" : "GtkSource",
209 "this.el.completion.add_provider(",
210 "\tnew Palete.CompletionProvider(_this)",
213 "// hover seems pretty useless.. - ??",
214 "//var hover = this.el.get_hover();",
215 "//hover.add_provider(new Palete.HoverProvider(_this));",
217 "//this.el.completion.unblock_interactive();",
218 "this.el.completion.select_on_show = true; // select",
219 "//this.el.completion.remember_info_visibility\t = true;",
222 "var attrs = new GtkSource.MarkAttributes();",
224 "attrs.set_icon_name ( \"process-stop\"); ",
225 "attrs.query_tooltip_text.connect(( mark) => {",
226 " GLib.debug(\"tooltip query? %s\", mark.name);",
227 " return strdup( mark.name);",
229 " attrs.query_tooltip_markup.connect(( mark) => {",
230 " GLib.debug(\"tooltip query? %s\", mark.name);",
231 " return strdup( mark.name);",
233 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
237 "var wattrs = new GtkSource.MarkAttributes();",
238 "wattrs.set_icon_name ( \"process-stop\"); ",
239 "wattrs.query_tooltip_text.connect(( mark) => {",
240 " GLib.debug(\"tooltip query? %s\", mark.name);",
241 " return strdup(mark.name);",
243 "wattrs.query_tooltip_markup.connect(( mark) => {",
244 " GLib.debug(\"tooltip query? %s\", mark.name);",
245 " return strdup(mark.name);",
247 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
251 "var dattrs = new GtkSource.MarkAttributes();",
253 "dattrs.set_icon_name ( \"process-stop\"); ",
255 "dattrs.query_tooltip_text.connect(( mark) => {",
256 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
257 " return strdup(mark.name);",
259 "//dattrs.query_tooltip_markup.connect(( mark) => {",
260 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
261 " // return strdup(mark.name);",
263 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
266 " this.el.get_space_drawer().set_matrix(null);",
267 " this.el.get_space_drawer().set_types_for_locations( ",
268 "\tGtkSource.SpaceLocationFlags.ALL,",
269 "\tGtkSource.SpaceTypeFlags.ALL",
271 "this.el.get_space_drawer().set_enable_matrix(true);",
275 "bool has_tooltip" : true,
276 "bool hexpand" : true,
277 "bool insert_spaces_instead_of_tabs" : true,
278 "bool vexpand" : true,
279 "boolean show_line_marks" : true,
280 "boolean show_line_numbers" : true,
281 "css_classes" : "{ \"code-editor\" }",
282 "gboolean highlight_current_line" : true,
287 "$ Gee.HashMap<int,string>? xmarks" : "null",
288 "$ xns" : "GtkSource",
289 "$ xtype" : "Buffer",
292 "var buf = this.el;",
293 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
294 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
295 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
296 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
297 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
298 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
299 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
300 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
303 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
304 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
305 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
311 "bool check_queued" : false,
312 "bool enable_undo" : true,
313 "bool highlight_matching_brackets" : true,
314 "bool highlight_syntax" : true,
316 "int error_line" : "-1",
320 " // check syntax??",
322 " _this.save_button.el.sensitive = true;",
323 " print(\"EDITOR CHANGED\");",
324 " this.checkSyntax();",
326 " _this.dirty = true;",
328 " // this.get('/LeftPanel.model').changed( str , false);",
336 "\tGtk.TextIter iter;",
337 "\tthis.el.get_iter_at_offset (",
338 "\t\t\tout iter, this.el.cursor_position);",
340 "\t_this.navigation.updateSelectedLine(",
341 "\t\t\t(uint)iter.get_line(),",
342 "\t\t\t(uint)iter.get_line_offset()",
344 "\tthis.showHelp(iter);",
350 "| bool OLDhighlightErrorsJson" : [
351 "(string type, Json.Object obj) {",
352 "\tGtk.TextIter start;",
353 "\tGtk.TextIter end; ",
354 "\tthis.el.get_bounds (out start, out end);",
356 "\tthis.el.remove_source_marks (start, end, type);",
357 "\tGLib.debug(\"highlight errors\");\t\t ",
359 "\t // we should highlight other types of errors..",
361 "\tif (!obj.has_member(type)) {",
362 "\t\tGLib.debug(\"Return has no errors\\n\");",
366 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
368 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
370 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
375 "\t//this.marks = new Gee.HashMap<int,string>();",
376 "\tvar err = obj.get_object_member(type);",
378 "\tif (_this.file == null) {",
379 "\t\tGLib.debug(\"file is null?\");",
383 "\tvar valafn = _this.file.path;",
385 "\tif (_this.file.xtype != \"PlainFile\") {",
387 "\t\tvalafn = \"\";",
389 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
390 "\t\t\t// should not happen",
391 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
392 "\t\t} catch (GLib.RegexError e) {",
393 "\t\t\treturn true;",
399 "\tif (!err.has_member(valafn)) {",
400 "\t\tGLib.debug(\"File path has no errors\");",
404 "\tvar lines = err.get_object_member(valafn);",
407 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
408 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
412 "\tvar tlines = this.el.get_line_count () +1;",
414 "\tif (_this.prop != null) {",
416 "\t\ttlines = _this.prop.end_line + 1;",
417 "\t\toffset = _this.prop.start_line + 1;",
423 "\tlines.foreach_member((obj, line, node) => {",
425 "\t Gtk.TextIter iter;",
426 "// print(\"get inter\\n\");",
427 "\t var eline = int.parse(line) - offset;",
428 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
431 "\t if (eline > tlines || eline < 0) {",
436 "\t this.el.get_iter_at_line( out iter, eline);",
437 "\t //print(\"mark line\\n\");",
438 "\t var msg = \"\";",
439 "\t var ar = lines.get_array_member(line);",
440 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
441 "\t \tif (ar.get_string_element(i) == \"Success\") {",
444 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
445 "\t\t\tmsg += ar.get_string_element(i);",
447 "\t\tif (msg == \"\") {",
450 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
451 "\t this.el.create_source_mark(msg, type, iter);",
452 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
453 "\t // this.marks.set(eline, msg);",
464 "| bool checkSyntax" : [
468 " var str = this.toString();",
471 " if (this.error_line > 0) {",
472 " Gtk.TextIter start;",
473 " Gtk.TextIter end; ",
474 " this.el.get_bounds (out start, out end);",
476 " this.el.remove_source_marks (start, end, null);",
478 " if (str.length < 1) {",
479 " print(\"checkSyntax - empty string?\\n\");",
483 " // bit presumptiona",
484 " if (_this.file.xtype == \"PlainFile\") {",
486 " // assume it's gtk...",
487 " var oldcode =_this.file.toSource();",
488 " _this.file.setSource(str);",
489 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
490 " \t_this.file.getLanguageServer().document_change(_this.file);",
491 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
492 " _this.file.setSource(oldcode);",
498 " if (_this.file == null) {",
506 " GLib.debug(\"calling validate\"); ",
507 " // clear the buttons.",
508 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
511 "\tvar oldcode = _this.prop.val;",
513 "\t_this.prop.val = str;",
514 "\t_this.node.updated_count++;",
515 " _this.file.getLanguageServer().document_change(_this.file);",
516 " _this.node.updated_count++;",
517 " _this.prop.val = oldcode;",
520 " //print(\"done mark line\\n\");",
522 " return true; // at present allow saving - even if it's invalid..",
526 "| bool highlightErrors" : [
527 "( Gee.HashMap<int,string> validate_res) {",
529 "\tthis.error_line = validate_res.size;",
531 "\tif (this.error_line < 1) {",
534 "\tvar tlines = this.el.get_line_count ();",
535 "\tGtk.TextIter iter;",
536 "\tvar valiter = validate_res.map_iterator();",
537 "\twhile (valiter.next()) {",
539 "\t// print(\"get inter\\n\");",
540 "\t\tvar eline = valiter.get_key();",
541 "\t\tif (eline > tlines) {",
544 "\t\tthis.el.get_iter_at_line( out iter, eline);",
545 "\t\t//print(\"mark line\\n\");",
546 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
551 "| string toString" : [
556 " this.el.get_start_iter(out s);",
557 " this.el.get_end_iter(out e);",
558 " var ret = this.el.get_text(s,e,true);",
559 " //print(\"TO STRING? \" + ret);",
564 "| void showHelp" : [
565 "(Gtk.TextIter iter) {",
566 "\tvar back = iter.copy();",
567 "\tback.backward_char();",
569 "\tvar forward = iter.copy();",
570 "\tforward.forward_char();",
572 "\t// what's the character at the iter?",
573 "\tvar str = back.get_text(iter);",
574 "\tstr += iter.get_text(forward);",
575 "\tif (str.strip().length < 1) {",
578 "\tvar offset = iter.get_line_offset();",
579 "\tvar line = iter.get_line();",
580 "\tif (_this.prop != null) {",
582 "\t\tline += _this.prop.start_line ; ",
583 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
584 "\t\toffset += _this.node.node_pad.length;",
585 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
586 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
587 "\t\t\toffset += 2;",
591 "\tvar ls = _this.file.getLanguageServer();",
593 "\t\t_this.file, line, offset,",
596 "\t\t\t\tvar res = ls.hover.end(o );",
598 "\t\t\t\t_this.helper.setHelp(res);",
599 "\t\t\t} catch (GLib.Error e) {",
609 "# bool is_control" : false,
614 "(keyval, keycode, state) => {",
616 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
617 " \t\tthis.is_control = true;",
624 "(keyval, keycode, state) => {",
626 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
627 " \t\tthis.is_control = false;",
629 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
630 " GLib.debug(\"SAVE: ctrl-S pressed\");",
631 " _this.saveContents();",
635 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
636 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
637 "\t\t_this.forwardSearch(true);",
640 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
641 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
642 "\t\t_this.search_entry.el.grab_focus();",
643 "\t\t_this.search_entry.el.select_region(0,-1);",
646 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
647 "\t\t_this.view.el.show_completion();",
650 "\tGtk.TextIter iter;",
651 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
652 "\tvar line = iter.get_line();",
653 "\tvar offset = iter.get_line_offset();",
654 "\tGLib.debug(\"line %d off %d\", line ,offset);",
655 "\tif (_this.prop != null) {",
656 "\t\tline += _this.prop.start_line + 1; // i think..",
657 "\t\toffset += 12; // should probably be 8 without namespaced ",
658 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
660 " //_this.view.el.show_completion();",
661 " // print(event.key.keyval)",
671 "xtype" : "EventControllerKey"
674 "# double distance" : "0.0f",
676 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
680 "\tif (!_this.keystate.is_control) {",
683 "\t //GLib.debug(\"scroll %f\", dy);",
685 "\tthis.distance += dy;",
687 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
689 "\t if (this.distance < -1) {",
691 "\t\tBuilderApplication.settings.editor_font_size ++;",
692 "\t\tthis.distance = 0;",
694 "\tif (this.distance > 1) {",
695 "\t\tBuilderApplication.settings.editor_font_size --;",
696 "\t\tthis.distance = 0;",
704 "xtype" : "EventControllerScroll"
710 "(n_press, x, y) => {",
711 "\tGtk.TextIter iter;",
712 "\tint buffer_x, buffer_y;",
713 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
715 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
716 "\t\t(int)x - gut.get_width(), (int)y,",
717 " \t\tout buffer_x, out buffer_y);",
718 "\t_this.view.el.get_iter_at_location (out iter, ",
719 "\t\t\tbuffer_x, buffer_y);;",
722 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
723 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
727 "\t_this.buffer.showHelp(iter);",
735 "xtype" : "GestureClick"
740 "(x, y, keyboard_tooltip, tooltip) => {",
742 "\t//GLib.debug(\"query tooltip\");",
743 "\tGtk.TextIter iter;",
746 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
748 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
750 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
751 "\t//\treturn false;",
754 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
756 "\tvar l = iter.get_line();",
760 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
766 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
767 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
768 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
776 "\t// this crashes?? - not sure why.",
777 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
778 "\tif (marks.is_empty()) {",
779 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
781 "\tif (marks.is_empty()) {",
782 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
785 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
787 "\tmarks.@foreach((m) => { ",
788 "\t\t//GLib.debug(\"got mark %s\", m.name);",
789 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
791 "\t// true if there is a mark..",
792 "\tif (str.length > 0 ) {",
793 "\t\ttooltip.set_text( str );",
795 "\treturn str.length > 0 ? true : false;",
801 "string name" : "editor-view",
802 "uint tab_width" : 4,
807 "// show the help page for the active node..",
808 " //this.get('/Help').show();",
810 " // this.get('/BottomPane').el.set_current_page(0);",
811 " \tGLib.debug(\"load called - Reset undo buffer\");",
813 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
814 " buf.begin_irreversible_action();",
815 " buf.set_text(str, str.length);",
816 " buf.end_irreversible_action();",
818 " var lm = GtkSource.LanguageManager.get_default();",
819 " var lang = \"vala\";",
820 " if (_this.file != null) {",
821 " lang = _this.file.language;",
823 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
824 " var lg = _this.file.content_type.length > 0 ?",
825 " lm.guess_language(_this.file.path, _this.file.content_type) :",
826 " lm.get_language(lang);",
829 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
831 " this.el.insert_spaces_instead_of_tabs = true;",
832 " if (lg != null) {",
833 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
834 "\t\tif (lg.name == \"Vala\") {",
835 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
838 " _this.dirty = false;",
839 " this.el.grab_focus();",
840 " _this.save_button.el.sensitive = false;",
841 " _this.last_error_counter = -1;",
846 "xtype" : "ScrolledWindow"
851 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
852 "bool homogeneous" : false,
853 "bool vexpand" : false,
858 "Gtk.CssProvider css" : "",
859 "bool hexpand" : true,
860 "id" : "search_entry",
866 "(keyval, keycode, state) => {",
868 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
869 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
870 "\t\t_this.forwardSearch(true);",
875 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
876 "\t\t_this.forwardSearch(true);",
882 " // print(event.key.keyval)",
889 "xtype" : "EventControllerKey"
896 "_this.search(_this.search_entry.el.text);",
897 "\t _this.search_results.updateResults();",
899 "\tGLib.Timeout.add_seconds(1,() => {",
900 "\t\t _this.search_results.updateResults();",
901 "\t\t return false;",
907 "string name" : "editor-search-entry",
908 "string placeholder_text" : "Press enter to search",
909 "uint search_delay" : 3,
910 "xtype" : "SearchEntry",
911 "| void forwardSearch" : [
912 "(bool change_focus) {",
915 "\t_this.forwardSearch(change_focus);",
919 "\tswitch(_this.windowstate.state) {",
920 "\t\tcase WindowState.State.CODEONLY:",
921 "\t\t//case WindowState.State.CODE:",
922 "\t\t\t// search the code being edited..",
923 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
926 "\t\tcase WindowState.State.PREVIEW:",
927 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
928 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
930 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
943 "id" : "search_results",
944 "int margin_end" : 4,
945 "int margin_start" : 4,
946 "string label" : "No Results",
948 "| void updateResults" : [
950 "\tthis.el.visible = true;",
952 "\tvar res = _this.searchcontext.get_occurrences_count();",
954 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
958 "\t_this.nextBtn.el.sensitive = false;",
959 "\t_this.backBtn.el.sensitive = false;\t",
962 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
963 "\t\t_this.nextBtn.el.sensitive = true;",
964 "\t\t_this.backBtn.el.sensitive = true;",
967 "\t_this.search_results.el.label = \"No Matches\";",
974 "bool always_show_image" : true,
975 "bool sensitive" : false,
981 "\t_this.forwardSearch(true);",
988 "string icon_name" : "go-down",
993 "bool always_show_image" : true,
994 "bool sensitive" : false,
1000 "\t_this.backSearch(true);",
1006 "string icon_name" : "go-up",
1011 "bool always_show_arrow" : true,
1012 "bool always_show_image" : true,
1016 "* prop" : "popover",
1017 "id" : "search_settings",
1022 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1029 "\tthis.el.show();",
1033 "id" : "case_sensitive",
1034 "string label" : "Case Sensitive",
1035 "xtype" : "CheckButton"
1041 "\tthis.el.show();",
1046 "string label" : "Regex",
1047 "xtype" : "CheckButton"
1052 "string label" : "Multi-line (add \\n)",
1053 "xtype" : "CheckButton"
1062 "string icon_name" : "emblem-system",
1063 "xtype" : "MenuButton"
1073 "* prop" : "end_child",
1074 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1075 "bool hexpand" : true,
1076 "bool vexpand" : true,
1077 "bool visible" : false,
1078 "id" : "navigation_holder",
1080 "int width_request" : 120,
1084 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1090 "bool hexpand" : true,
1091 "bool vexpand" : true,
1092 "bool visible" : true,
1093 "id" : "navigationwindow",
1096 "# int last_selected_line" : "-1",
1097 "$ Gtk.Widget? selected_row" : "null",
1100 "id" : "navigation",
1104 "bool expand" : true,
1108 "* prop" : "factory",
1113 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1115 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1116 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1119 "\tvar hbox = (Gtk.Box) expand.child;",
1122 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1123 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1125 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1126 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1128 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1129 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1131 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1133 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1135 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1136 " \texpand.set_list_row(lr);",
1137 " \t//this.in_bind = true;",
1138 " \t// default is to expand",
1140 " \t//this.in_bind = false;",
1142 " \tsym.bind_property(\"symbol_icon\",",
1143 " img, \"icon_name\",",
1144 " GLib.BindingFlags.SYNC_CREATE);",
1146 " \thbox.css_classes = { sym.symbol_icon };",
1148 " \tsym.bind_property(\"name\",",
1150 " GLib.BindingFlags.SYNC_CREATE);",
1151 " \t// should be better?- --line no?",
1152 " \tsym.bind_property(\"tooltip\",",
1153 " lbl, \"tooltip_markup\",",
1154 " GLib.BindingFlags.SYNC_CREATE);",
1155 " \t// bind image...",
1163 "\tvar expand = new Gtk.TreeExpander();",
1165 "\texpand.set_indent_for_depth(true);",
1166 "\texpand.set_indent_for_icon(true);",
1167 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1168 "\tvar icon = new Gtk.Image();",
1169 "\tvar lbl = new Gtk.Label(\"\");",
1170 "\tlbl.use_markup = true;",
1171 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1173 "\ticon.margin_end = 4;",
1174 " \tlbl.justify = Gtk.Justification.LEFT;",
1175 " \tlbl.xalign = 0;",
1177 "//\tlistitem.activatable = true; ??",
1179 "\thbox.append(icon);",
1180 "\thbox.append(lbl);",
1181 "\texpand.set_child(hbox);",
1182 "\t((Gtk.ListItem)listitem).set_child(expand);",
1188 "xtype" : "SignalListItemFactory"
1191 "string title" : "Code Navigation",
1192 "xtype" : "ColumnViewColumn"
1197 "id" : "navigationselmodel",
1202 "id" : "navigationsort",
1205 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1208 "\treturn ((Lsp.DocumentSymbol)item).children;",
1214 "bool autoexpand" : true,
1215 "bool passthrough" : false,
1218 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1221 "id" : "navliststore",
1222 "xtype" : "ListStore",
1223 "| Lsp.DocumentSymbol? symbolAtLine" : [
1224 "(uint line, uint chr) {",
1227 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1228 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1229 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1230 "\t\t//\tel.name , (int)el.range.start.line,",
1231 "\t\t//\t(int)el.range.end.line",
1233 "\t\tvar ret = el.containsLine(line,chr);",
1234 "\t\tif (ret != null) {",
1235 "\t\t\treturn ret;",
1247 "(position, removed, added) => {",
1248 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1249 "\t if (added < 1) { ",
1252 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1253 "\tvar row = this.el.get_row(position);",
1255 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1262 "xtype" : "TreeListModel"
1266 "* prop" : "sorter",
1270 "* prop" : "sorter",
1273 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1275 "* prop" : "expression",
1276 "string property_name" : "sort_key",
1277 "xtype" : "PropertyExpression"
1280 "xtype" : "StringSorter"
1283 "xtype" : "TreeListRowSorter"
1286 "xtype" : "SortListModel",
1287 "| Lsp.DocumentSymbol? getSymbolAt" : [
1290 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1292 " var a = tr.get_item();; ",
1293 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1296 " return (Lsp.DocumentSymbol)tr.get_item();",
1300 "| int getRowFromSymbol" : [
1301 "(Lsp.DocumentSymbol sym) {",
1303 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1304 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1306 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1313 "| void collapseOnLoad" : [
1315 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1316 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1317 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1318 "\t\tswitch (sym.kind) {",
1319 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1320 "\t \t\t\ttr.expanded = false;",
1323 "\t\t\t\t//tr.expanded = true;",
1335 "xtype" : "NoSelection"
1341 "(n_press, x, y) => {",
1343 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1345 " if (row == null) {",
1346 "\t GLib.debug(\"no row selected items\");",
1349 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1350 " //Lsp.DocumentSymbol",
1351 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1352 " if (sym == null) {",
1358 " \"line\" : 1410,",
1359 " \"character\" : 8",
1362 " \"line\" : 1410,",
1363 " \"character\" : 39",
1367 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1368 " _this.scroll_to_line((int)sym.range.start.line);",
1369 " Gtk.TextIter iter;",
1370 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1371 " \t(int)sym.range.start.line,",
1372 " \t(int)sym.range.start.character",
1374 " _this.buffer.el.place_cursor(iter);",
1379 "xtype" : "GestureClick"
1382 "string name" : "editor-navigation",
1383 "xtype" : "ColumnView",
1384 "| Gtk.Widget? getRowWidgetAt" : [
1385 "(double x, double y, out string pos) {",
1388 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1389 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1390 "\tif (w == null) {",
1394 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1395 "\tif (row == null) {",
1399 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1403 "\t//GLib.debug(\"row number is %d\", rn);",
1404 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1405 "\t// above or belw",
1406 "\tGraphene.Rect bounds;",
1407 "\trow.compute_bounds(this.el, out bounds);",
1408 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1409 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1410 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1412 "\tvar ypos = y - bounds.get_y();",
1413 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1414 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1415 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1416 "\tpos = \"over\";",
1418 "\tif (rpos > 80) {",
1419 "\t\tpos = \"below\";",
1420 "\t} else if (rpos < 20) {",
1421 "\t\tpos = \"above\";",
1426 "| int getRowAt" : [
1427 "(double x, double y, out string pos) {",
1430 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1431 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1432 "\tif (w == null) {",
1436 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1437 "\tif (row == null) {",
1441 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1446 "\twhile (cr.get_prev_sibling() != null) {",
1448 "\t\tcr = cr.get_prev_sibling();",
1451 "\t//GLib.debug(\"row number is %d\", rn);",
1452 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1453 "\t// above or belw",
1454 "\tGraphene.Rect bounds;",
1455 "\trow.compute_bounds(this.el, out bounds);",
1456 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1457 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1458 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1460 "\tvar ypos = y - bounds.get_y();",
1461 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1462 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1463 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1464 "\tpos = \"over\";",
1466 "\tif (rpos > 80) {",
1467 "\t\tpos = \"below\";",
1468 "\t} else if (rpos < 20) {",
1469 "\t\tpos = \"above\";",
1475 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1477 "\tif (!_this.navigation_holder.el.visible) {",
1478 "\t\t_this.navigation_holder.el.show();",
1479 "\t\t_this.paned.el.position = ",
1480 "\t\t\t_this.paned.el.get_width() - 200;",
1482 "\t//_this.navliststore.el.remove_all();",
1485 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1487 "\tforeach(var sym in syms) {",
1488 "\t\tls.append(sym);",
1490 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1491 "\t//_this.navliststore.el.append(sym);",
1492 "\tthis.last_selected_line = -1;",
1493 "\tGLib.Idle.add(() => {",
1494 "\t\t_this.navigationsort.collapseOnLoad();",
1495 "\t\tGtk.TextIter iter;",
1496 "\t\t_this.buffer.el.get_iter_at_offset (",
1497 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1499 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1500 "\t\t\t\titer.get_line_offset());",
1501 "\t\tthis.updateSelectedLine(",
1502 "\t\t\t\t(uint)iter.get_line(),",
1503 "\t\t\t\t(uint)iter.get_line_offset()",
1505 "\t\treturn false;",
1510 "| void updateSelectedLine" : [
1511 "(uint line, uint chr) {",
1512 "\tif (line == this.last_selected_line) {",
1515 "\tGLib.debug(\"select line %d\", (int)line);",
1516 "\tthis.last_selected_line = (int)line;",
1519 "\tvar new_row = -1;",
1520 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1521 "\tif (sym != null) {",
1522 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1523 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1525 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1528 "\tif (this.selected_row != null) { ",
1529 "\t\tGLib.debug(\" remove selected row\");",
1530 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1532 "\tthis.selected_row = null;",
1533 "\tif (new_row > -1) {",
1534 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1535 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1536 "\t\tif (row != null) {",
1537 "\t\t\tGLib.debug(\" Add selected row\");",
1539 "\t\t\trow.add_css_class(\"selected-row\");",
1540 "\t\t\tthis.selected_row = row;",
1544 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1554 "xtype" : "ScrolledWindow"
1564 "| bool saveContents" : [
1568 " if (_this.file == null) {",
1574 " var str = _this.buffer.toString();",
1576 " _this.buffer.checkSyntax();",
1580 " // LeftPanel.model.changed( str , false);",
1581 " _this.dirty = false;",
1582 " _this.save_button.el.sensitive = false;",
1584 " // find the text for the node..",
1585 " if (_this.file.xtype != \"PlainFile\") {",
1586 " // in theory these properties have to exist!?!",
1587 " \tthis.prop.val = str;",
1588 " //this.window.windowstate.left_props.reload();",
1590 " _this.file.setSource( str );",
1593 " // call the signal..",
1601 "(string in_txt) {",
1603 "\tvar s = new GtkSource.SearchSettings();",
1604 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1605 "\ts.regex_enabled = _this.regex.el.active;\t",
1606 "\ts.wrap_around = false;",
1608 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1609 "\tthis.searchcontext.set_highlight(true);",
1610 "\tvar txt = in_txt;",
1612 "\tif (_this.multiline.el.active) {",
1613 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1616 "\ts.set_search_text(txt);",
1617 "\tGtk.TextIter beg, st,en;",
1619 "\tthis.buffer.el.get_start_iter(out beg);",
1620 "\tbool has_wrapped_around;",
1621 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1622 "\tthis.last_search_end = 0;",
1624 "\treturn this.searchcontext.get_occurrences_count();",
1632 "| string tempFileContents" : [
1636 " if (_this.file == null) {",
1639 "\tvar str= this.buffer.toString();",
1640 "\tif (_this.file.xtype == \"PlainFile\") {",
1648 " GLib.debug(\"calling validate\"); ",
1649 " // clear the buttons.",
1650 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1651 "\t\treturn this.file.toSource(); ;",
1654 "\tvar oldcode = _this.prop.val;",
1655 "\t_this.prop.val = str;",
1656 " var ret = _this.file.toSource();",
1657 " _this.prop.val = oldcode;",
1662 "| void backSearch" : [
1663 "(bool change_focus) {",
1665 "\tif (this.searchcontext == null) {",
1669 "\tGtk.TextIter beg, st,en;",
1670 "\tbool has_wrapped_around;",
1671 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1673 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1674 "\t\tthis.last_search_end = 0;",
1676 "\t\tthis.last_search_end = en.get_offset();",
1677 "\t\tif (change_focus) {",
1678 "\t\t\tthis.view.el.grab_focus();",
1680 "\t\tthis.buffer.el.place_cursor(st);",
1681 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1687 "| void forwardSearch" : [
1688 "(bool change_focus) {",
1690 "\tif (this.searchcontext == null) {",
1694 "\tGtk.TextIter beg, st,en;",
1695 "\t bool has_wrapped_around;",
1696 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1697 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1699 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1701 "\t\tif (has_wrapped_around) {",
1705 "\t\tthis.last_search_end = en.get_offset();",
1706 "\t\tif (change_focus) {",
1707 "\t\t\tthis.view.el.grab_focus();",
1709 "\t\tthis.buffer.el.place_cursor(st);",
1710 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1718 "\t this.file = null; ",
1720 " this.node = null;",
1721 " this.prop = null;",
1722 "\tthis.searchcontext = null;",
1727 "| void scroll_to_line" : [
1730 "\tGLib.Timeout.add(500, () => {",
1732 "\t\tvar buf = this.view.el.get_buffer();",
1734 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1737 "\t\tGtk.TextIter iter; ",
1738 "\t\tsbuf.get_iter_at_line(out iter, line);",
1739 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1740 "\t\treturn false;",
1746 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1749 " if (this.file != null) {",
1750 " \tthis.file.navigation_tree_updated.disconnect(",
1751 " \t\t_this.navigation.show",
1754 " this.file = file; ",
1755 " this.file.navigation_tree_updated.connect(",
1756 "\t\t_this.navigation.show",
1758 " if (file.xtype != \"PlainFile\") {",
1759 " \tthis.prop = prop;",
1760 " this.node = node;",
1762 " // find the text for the node..",
1763 " this.view.load( prop.val );",
1764 " this.updateErrorMarks();",
1768 " this.close_btn.el.show(); ",
1771 " this.view.load( file.toSource() );",
1772 " this.updateErrorMarks();",
1773 " this.close_btn.el.hide();",
1774 " var ls = file.getLanguageServer();",
1775 " ls.queueDocumentSymbols(file);",
1776 " ////ls.documentSymbols.begin(file, (a,o) => {",
1777 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1779 " //documentSymbols",
1785 "| void updateErrorMarks" : [
1790 "\tvar buf = _this.buffer.el;",
1791 "\tGtk.TextIter start;",
1792 "\tGtk.TextIter end; ",
1793 "\tbuf.get_bounds (out start, out end);",
1798 "\t//GLib.debug(\"highlight errors\");\t\t ",
1800 "\t // we should highlight other types of errors..",
1802 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1804 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1806 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1812 "\tif (_this.file == null) {",
1813 "\t\tGLib.debug(\"file is null?\");",
1817 "\tvar ar = this.file.getErrors();",
1818 "\tif (ar.size < 1) {",
1819 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1820 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1821 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1822 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1823 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1824 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1825 "\t\tthis.last_error_counter = file.error_counter ;",
1826 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1831 " // basicaly check if there is no change, then we do not do any update..",
1832 " // we can do this by just using an error counter?",
1833 " // if that's changed then we will do an update, otherwise dont bother.",
1836 "\tvar offset = 0;",
1837 "\tvar hoffset = 0;",
1839 "\tvar tlines = buf.get_line_count () +1;",
1841 "\tif (_this.prop != null) {",
1842 "\t\t// this still seems flaky...",
1844 "\t\ttlines = _this.prop.end_line;",
1845 "\t\toffset = _this.prop.start_line;",
1846 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1850 "\t\t// no update...",
1851 "\t\tif (this.last_error_counter == file.error_counter) {",
1857 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1858 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1859 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1860 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1861 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1862 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1864 "\tforeach(var diag in ar) { ",
1865 "\t Gtk.TextIter iter;",
1866 "// print(\"get inter\\n\");",
1867 "\t var eline = (int)diag.range.start.line - offset;",
1868 "\t var eline_to = (int)diag.range.end.line - offset;",
1869 "\t //var eline = diag.range.end_line - offset;",
1870 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1871 "\t //\terr.line ,eline, offset);",
1874 "\t if (eline > tlines || eline < 0) {",
1878 "\t buf.get_iter_at_line( out iter, eline);",
1879 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1880 "\t buf.create_source_mark( msg, diag.category, iter);",
1882 " \t var spos = (int)diag.range.start.character - hoffset;",
1883 " \t if (spos < 0) { spos =0 ; }",
1884 " \t if (spos > iter.get_chars_in_line()) {",
1885 " \t \tspos = iter.get_chars_in_line();",
1887 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1888 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1889 " \t if (epos < 0) { epos =0 ; }",
1890 " \t if (epos > iter.get_chars_in_line()) {",
1891 " \t \tepos = iter.get_chars_in_line();",
1895 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1897 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1899 "\t buf.apply_tag_by_name(diag.category, start, end);",
1901 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1902 "\t //this.marks.set(eline, msg);",
1904 "\tthis.last_error_counter = file.error_counter ;",