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,
80 "(x, y, keyboard_tooltip, tooltip) => {",
81 "\tGLib.debug(\"using quiery tooltip?\");",
82 "\tvar lbl = new Gtk.Label(this.el.tooltip_markup);",
83 "\tlbl.width_request = 500;",
84 "\ttooltip.set_custom(lbl);",
93 "(Lsp.Hover? help) {",
94 "\tif (help == null || help.contents == null",
95 "\t\t|| help.contents.size < 1) {",
96 "\t\tthis.el.set_text(\"\");",
99 "\tvar sig = help.contents.get(0).value.split(\" \");",
100 "\tstring[] str = {};",
101 "\tfor(var i =0; i < sig.length; i++) {",
103 "\t\tswitch(sig[i]) {",
104 "\t\t\tcase \"public\":",
105 "\t\t\tcase \"private\":",
106 "\t\t\tcase \"protected\":",
107 "\t\t\tcase \"async\":",
108 "\t\t\tcase \"class\":",
114 "\t\t\t\tstr += sig[i];",
120 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
121 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
122 "\t\t\t\t\t+\"</span>\");",
126 "\tif (help.contents.size > 1) {",
127 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value);",
129 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(0).value);",
131 "\tthis.el.set_markup(string.joinv(\" \",str));",
138 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
141 "\t//this.el.set_range(6,30);",
142 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
143 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
145 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
146 " \t\t//\tGLib.debug(\"update range\");",
147 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
148 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
156 "Gtk.Align halign" : "Gtk.Align.END",
157 "bool draw_value" : false,
158 "bool has_origin" : true,
159 "bool sensitive" : true,
161 "int width_request" : 150,
165 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
168 " \tBuilderApplication.settings.editor_font_size = val;",
177 "Gtk.Align halign" : "Gtk.Align.END",
183 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
184 "string icon_name" : "window-close",
191 " _this.saveContents();",
192 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
197 "string icon_name" : "window-close",
205 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
206 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
207 "bool overlay_scrolling" : false,
208 "bool vexpand" : true,
209 "id" : "RightEditor",
212 "# Gtk.CssProvider css" : "null",
213 "$ gboolean auto_indent" : true,
214 "$ xns" : "GtkSource",
221 "this.el.completion.add_provider(",
222 "\tnew Palete.CompletionProvider(_this)",
225 "// hover seems pretty useless.. - ??",
226 "//var hover = this.el.get_hover();",
227 "//hover.add_provider(new Palete.HoverProvider(_this));",
229 "//this.el.completion.unblock_interactive();",
230 "this.el.completion.select_on_show = true; // select",
231 "//this.el.completion.remember_info_visibility\t = true;",
234 "var attrs = new GtkSource.MarkAttributes();",
236 "attrs.set_icon_name ( \"process-stop\"); ",
237 "attrs.query_tooltip_text.connect(( mark) => {",
238 " GLib.debug(\"tooltip query? %s\", mark.name);",
239 " return strdup( mark.name);",
241 " attrs.query_tooltip_markup.connect(( mark) => {",
242 " GLib.debug(\"tooltip query? %s\", mark.name);",
243 " return strdup( mark.name);",
245 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
249 "var wattrs = new GtkSource.MarkAttributes();",
250 "wattrs.set_icon_name ( \"process-stop\"); ",
251 "wattrs.query_tooltip_text.connect(( mark) => {",
252 " GLib.debug(\"tooltip query? %s\", mark.name);",
253 " return strdup(mark.name);",
255 "wattrs.query_tooltip_markup.connect(( mark) => {",
256 " GLib.debug(\"tooltip query? %s\", mark.name);",
257 " return strdup(mark.name);",
259 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
263 "var dattrs = new GtkSource.MarkAttributes();",
265 "dattrs.set_icon_name ( \"process-stop\"); ",
267 "dattrs.query_tooltip_text.connect(( mark) => {",
268 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
269 " return strdup(mark.name);",
271 "//dattrs.query_tooltip_markup.connect(( mark) => {",
272 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
273 " // return strdup(mark.name);",
275 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
278 " this.el.get_space_drawer().set_matrix(null);",
279 " this.el.get_space_drawer().set_types_for_locations( ",
280 "\tGtkSource.SpaceLocationFlags.ALL,",
281 "\tGtkSource.SpaceTypeFlags.ALL",
283 "this.el.get_space_drawer().set_enable_matrix(true);",
287 "bool has_tooltip" : true,
288 "bool hexpand" : true,
289 "bool insert_spaces_instead_of_tabs" : true,
290 "bool vexpand" : true,
291 "boolean show_line_marks" : true,
292 "boolean show_line_numbers" : true,
293 "css_classes" : "{ \"code-editor\" }",
294 "gboolean highlight_current_line" : true,
299 "$ Gee.HashMap<int,string>? xmarks" : "null",
300 "$ xns" : "GtkSource",
301 "$ xtype" : "Buffer",
304 "var buf = this.el;",
305 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
306 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
307 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
308 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
309 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
310 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
311 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
312 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
315 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
316 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
317 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
323 "bool check_queued" : false,
324 "bool enable_undo" : true,
325 "bool highlight_matching_brackets" : true,
326 "bool highlight_syntax" : true,
328 "int error_line" : "-1",
332 " // check syntax??",
334 " _this.save_button.el.sensitive = true;",
335 " print(\"EDITOR CHANGED\");",
336 " this.checkSyntax();",
338 " _this.dirty = true;",
340 " // this.get('/LeftPanel.model').changed( str , false);",
348 "\tGtk.TextIter iter;",
349 "\tthis.el.get_iter_at_offset (",
350 "\t\t\tout iter, this.el.cursor_position);",
352 "\t_this.navigation.updateSelectedLine(",
353 "\t\t\t(uint)iter.get_line(),",
354 "\t\t\t(uint)iter.get_line_offset()",
356 "\tthis.showHelp(iter);",
362 "| bool OLDhighlightErrorsJson" : [
363 "(string type, Json.Object obj) {",
364 "\tGtk.TextIter start;",
365 "\tGtk.TextIter end; ",
366 "\tthis.el.get_bounds (out start, out end);",
368 "\tthis.el.remove_source_marks (start, end, type);",
369 "\tGLib.debug(\"highlight errors\");\t\t ",
371 "\t // we should highlight other types of errors..",
373 "\tif (!obj.has_member(type)) {",
374 "\t\tGLib.debug(\"Return has no errors\\n\");",
378 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
380 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
382 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
387 "\t//this.marks = new Gee.HashMap<int,string>();",
388 "\tvar err = obj.get_object_member(type);",
390 "\tif (_this.file == null) {",
391 "\t\tGLib.debug(\"file is null?\");",
395 "\tvar valafn = _this.file.path;",
397 "\tif (_this.file.xtype != \"PlainFile\") {",
399 "\t\tvalafn = \"\";",
401 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
402 "\t\t\t// should not happen",
403 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
404 "\t\t} catch (GLib.RegexError e) {",
405 "\t\t\treturn true;",
411 "\tif (!err.has_member(valafn)) {",
412 "\t\tGLib.debug(\"File path has no errors\");",
416 "\tvar lines = err.get_object_member(valafn);",
419 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
420 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
424 "\tvar tlines = this.el.get_line_count () +1;",
426 "\tif (_this.prop != null) {",
428 "\t\ttlines = _this.prop.end_line + 1;",
429 "\t\toffset = _this.prop.start_line + 1;",
435 "\tlines.foreach_member((obj, line, node) => {",
437 "\t Gtk.TextIter iter;",
438 "// print(\"get inter\\n\");",
439 "\t var eline = int.parse(line) - offset;",
440 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
443 "\t if (eline > tlines || eline < 0) {",
448 "\t this.el.get_iter_at_line( out iter, eline);",
449 "\t //print(\"mark line\\n\");",
450 "\t var msg = \"\";",
451 "\t var ar = lines.get_array_member(line);",
452 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
453 "\t \tif (ar.get_string_element(i) == \"Success\") {",
456 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
457 "\t\t\tmsg += ar.get_string_element(i);",
459 "\t\tif (msg == \"\") {",
462 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
463 "\t this.el.create_source_mark(msg, type, iter);",
464 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
465 "\t // this.marks.set(eline, msg);",
476 "| bool checkSyntax" : [
480 " var str = this.toString();",
483 " if (this.error_line > 0) {",
484 " Gtk.TextIter start;",
485 " Gtk.TextIter end; ",
486 " this.el.get_bounds (out start, out end);",
488 " this.el.remove_source_marks (start, end, null);",
490 " if (str.length < 1) {",
491 " print(\"checkSyntax - empty string?\\n\");",
495 " // bit presumptiona",
496 " if (_this.file.xtype == \"PlainFile\") {",
498 " // assume it's gtk...",
499 " var oldcode =_this.file.toSource();",
500 " _this.file.setSource(str);",
501 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
502 " \t_this.file.getLanguageServer().document_change(_this.file);",
503 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
504 " _this.file.setSource(oldcode);",
510 " if (_this.file == null) {",
518 " GLib.debug(\"calling validate\"); ",
519 " // clear the buttons.",
520 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
523 "\tvar oldcode = _this.prop.val;",
525 "\t_this.prop.val = str;",
526 "\t_this.node.updated_count++;",
527 " _this.file.getLanguageServer().document_change(_this.file);",
528 " _this.node.updated_count++;",
529 " _this.prop.val = oldcode;",
532 " //print(\"done mark line\\n\");",
534 " return true; // at present allow saving - even if it's invalid..",
538 "| bool highlightErrors" : [
539 "( Gee.HashMap<int,string> validate_res) {",
541 "\tthis.error_line = validate_res.size;",
543 "\tif (this.error_line < 1) {",
546 "\tvar tlines = this.el.get_line_count ();",
547 "\tGtk.TextIter iter;",
548 "\tvar valiter = validate_res.map_iterator();",
549 "\twhile (valiter.next()) {",
551 "\t// print(\"get inter\\n\");",
552 "\t\tvar eline = valiter.get_key();",
553 "\t\tif (eline > tlines) {",
556 "\t\tthis.el.get_iter_at_line( out iter, eline);",
557 "\t\t//print(\"mark line\\n\");",
558 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
563 "| string toString" : [
568 " this.el.get_start_iter(out s);",
569 " this.el.get_end_iter(out e);",
570 " var ret = this.el.get_text(s,e,true);",
571 " //print(\"TO STRING? \" + ret);",
576 "| void showHelp" : [
577 "(Gtk.TextIter iter) {",
578 "\tvar back = iter.copy();",
579 "\tback.backward_char();",
581 "\tvar forward = iter.copy();",
582 "\tforward.forward_char();",
584 "\t// what's the character at the iter?",
585 "\tvar str = back.get_text(iter);",
586 "\tstr += iter.get_text(forward);",
587 "\tif (str.strip().length < 1) {",
590 "\tvar offset = iter.get_line_offset();",
591 "\tvar line = iter.get_line();",
592 "\tif (_this.prop != null) {",
594 "\t\tline += _this.prop.start_line ; ",
595 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
596 "\t\toffset += _this.node.node_pad.length;",
597 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
598 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
599 "\t\t\toffset += 2;",
603 "\tvar ls = _this.file.getLanguageServer();",
605 "\t\t_this.file, line, offset,",
608 "\t\t\t\tvar res = ls.hover.end(o );",
610 "\t\t\t\t_this.helper.setHelp(res);",
611 "\t\t\t} catch (GLib.Error e) {",
621 "# bool is_control" : false,
626 "(keyval, keycode, state) => {",
628 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
629 " \t\tthis.is_control = true;",
636 "(keyval, keycode, state) => {",
638 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
639 " \t\tthis.is_control = false;",
641 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
642 " GLib.debug(\"SAVE: ctrl-S pressed\");",
643 " _this.saveContents();",
647 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
648 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
649 "\t\t_this.forwardSearch(true);",
652 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
653 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
654 "\t\t_this.search_entry.el.grab_focus();",
655 "\t\t_this.search_entry.el.select_region(0,-1);",
658 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
659 "\t\t_this.view.el.show_completion();",
662 "\tGtk.TextIter iter;",
663 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
664 "\tvar line = iter.get_line();",
665 "\tvar offset = iter.get_line_offset();",
666 "\tGLib.debug(\"line %d off %d\", line ,offset);",
667 "\tif (_this.prop != null) {",
668 "\t\tline += _this.prop.start_line + 1; // i think..",
669 "\t\toffset += 12; // should probably be 8 without namespaced ",
670 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
672 " //_this.view.el.show_completion();",
673 " // print(event.key.keyval)",
683 "xtype" : "EventControllerKey"
686 "# double distance" : "0.0f",
688 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
692 "\tif (!_this.keystate.is_control) {",
695 "\t //GLib.debug(\"scroll %f\", dy);",
697 "\tthis.distance += dy;",
699 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
701 "\t if (this.distance < -1) {",
703 "\t\tBuilderApplication.settings.editor_font_size ++;",
704 "\t\tthis.distance = 0;",
706 "\tif (this.distance > 1) {",
707 "\t\tBuilderApplication.settings.editor_font_size --;",
708 "\t\tthis.distance = 0;",
716 "xtype" : "EventControllerScroll"
722 "(n_press, x, y) => {",
723 "\tGtk.TextIter iter;",
724 "\tint buffer_x, buffer_y;",
725 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
727 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
728 "\t\t(int)x - gut.get_width(), (int)y,",
729 " \t\tout buffer_x, out buffer_y);",
730 "\t_this.view.el.get_iter_at_location (out iter, ",
731 "\t\t\tbuffer_x, buffer_y);;",
734 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
735 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
739 "\t_this.buffer.showHelp(iter);",
747 "xtype" : "GestureClick"
752 "(x, y, keyboard_tooltip, tooltip) => {",
754 "\t//GLib.debug(\"query tooltip\");",
755 "\tGtk.TextIter iter;",
758 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
760 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
762 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
763 "\t//\treturn false;",
766 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
768 "\tvar l = iter.get_line();",
772 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
778 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
779 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
780 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
788 "\t// this crashes?? - not sure why.",
789 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
790 "\tif (marks.is_empty()) {",
791 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
793 "\tif (marks.is_empty()) {",
794 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
797 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
799 "\tmarks.@foreach((m) => { ",
800 "\t\t//GLib.debug(\"got mark %s\", m.name);",
801 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
803 "\t// true if there is a mark..",
804 "\tif (str.length > 0 ) {",
805 "\t\ttooltip.set_text( str );",
807 "\treturn str.length > 0 ? true : false;",
813 "string name" : "editor-view",
814 "uint tab_width" : 4,
819 "// show the help page for the active node..",
820 " //this.get('/Help').show();",
822 " // this.get('/BottomPane').el.set_current_page(0);",
823 " \tGLib.debug(\"load called - Reset undo buffer\");",
825 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
826 " buf.begin_irreversible_action();",
827 " buf.set_text(str, str.length);",
828 " buf.end_irreversible_action();",
830 " var lm = GtkSource.LanguageManager.get_default();",
831 " var lang = \"vala\";",
832 " if (_this.file != null) {",
833 " lang = _this.file.language;",
835 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
836 " var lg = _this.file.content_type.length > 0 ?",
837 " lm.guess_language(_this.file.path, _this.file.content_type) :",
838 " lm.get_language(lang);",
841 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
843 " this.el.insert_spaces_instead_of_tabs = true;",
844 " if (lg != null) {",
845 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
846 "\t\tif (lg.name == \"Vala\") {",
847 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
850 " _this.dirty = false;",
851 " this.el.grab_focus();",
852 " _this.save_button.el.sensitive = false;",
853 " _this.last_error_counter = -1;",
858 "xtype" : "ScrolledWindow"
863 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
864 "bool homogeneous" : false,
865 "bool vexpand" : false,
870 "Gtk.CssProvider css" : "",
871 "bool hexpand" : true,
872 "id" : "search_entry",
878 "(keyval, keycode, state) => {",
880 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
881 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
882 "\t\t_this.forwardSearch(true);",
887 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
888 "\t\t_this.forwardSearch(true);",
894 " // print(event.key.keyval)",
901 "xtype" : "EventControllerKey"
908 "_this.search(_this.search_entry.el.text);",
909 "\t _this.search_results.updateResults();",
911 "\tGLib.Timeout.add_seconds(1,() => {",
912 "\t\t _this.search_results.updateResults();",
913 "\t\t return false;",
919 "string name" : "editor-search-entry",
920 "string placeholder_text" : "Press enter to search",
921 "uint search_delay" : 3,
922 "xtype" : "SearchEntry",
923 "| void forwardSearch" : [
924 "(bool change_focus) {",
927 "\t_this.forwardSearch(change_focus);",
931 "\tswitch(_this.windowstate.state) {",
932 "\t\tcase WindowState.State.CODEONLY:",
933 "\t\t//case WindowState.State.CODE:",
934 "\t\t\t// search the code being edited..",
935 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
938 "\t\tcase WindowState.State.PREVIEW:",
939 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
940 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
942 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
955 "id" : "search_results",
956 "int margin_end" : 4,
957 "int margin_start" : 4,
958 "string label" : "No Results",
960 "| void updateResults" : [
962 "\tthis.el.visible = true;",
964 "\tvar res = _this.searchcontext.get_occurrences_count();",
966 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
970 "\t_this.nextBtn.el.sensitive = false;",
971 "\t_this.backBtn.el.sensitive = false;\t",
974 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
975 "\t\t_this.nextBtn.el.sensitive = true;",
976 "\t\t_this.backBtn.el.sensitive = true;",
979 "\t_this.search_results.el.label = \"No Matches\";",
986 "bool always_show_image" : true,
987 "bool sensitive" : false,
993 "\t_this.forwardSearch(true);",
1000 "string icon_name" : "go-down",
1005 "bool always_show_image" : true,
1006 "bool sensitive" : false,
1012 "\t_this.backSearch(true);",
1018 "string icon_name" : "go-up",
1023 "bool always_show_arrow" : true,
1024 "bool always_show_image" : true,
1028 "* prop" : "popover",
1029 "id" : "search_settings",
1034 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1041 "\tthis.el.show();",
1045 "id" : "case_sensitive",
1046 "string label" : "Case Sensitive",
1047 "xtype" : "CheckButton"
1053 "\tthis.el.show();",
1058 "string label" : "Regex",
1059 "xtype" : "CheckButton"
1064 "string label" : "Multi-line (add \\n)",
1065 "xtype" : "CheckButton"
1074 "string icon_name" : "emblem-system",
1075 "xtype" : "MenuButton"
1085 "* prop" : "end_child",
1086 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1087 "bool hexpand" : true,
1088 "bool vexpand" : true,
1089 "bool visible" : false,
1090 "id" : "navigation_holder",
1092 "int width_request" : 120,
1096 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1102 "bool hexpand" : true,
1103 "bool vexpand" : true,
1104 "bool visible" : true,
1105 "id" : "navigationwindow",
1108 "# int last_selected_line" : "-1",
1109 "$ Gtk.Widget? selected_row" : "null",
1112 "id" : "navigation",
1116 "bool expand" : true,
1120 "* prop" : "factory",
1125 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1127 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1128 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1131 "\tvar hbox = (Gtk.Box) expand.child;",
1134 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1135 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1137 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1138 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1140 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1141 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1143 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1145 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1147 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1148 " \texpand.set_list_row(lr);",
1149 " \t//this.in_bind = true;",
1150 " \t// default is to expand",
1152 " \t//this.in_bind = false;",
1154 " \tsym.bind_property(\"symbol_icon\",",
1155 " img, \"icon_name\",",
1156 " GLib.BindingFlags.SYNC_CREATE);",
1158 " \thbox.css_classes = { sym.symbol_icon };",
1160 " \tsym.bind_property(\"name\",",
1162 " GLib.BindingFlags.SYNC_CREATE);",
1163 " \t// should be better?- --line no?",
1164 " \tsym.bind_property(\"tooltip\",",
1165 " lbl, \"tooltip_markup\",",
1166 " GLib.BindingFlags.SYNC_CREATE);",
1167 " \t// bind image...",
1175 "\tvar expand = new Gtk.TreeExpander();",
1177 "\texpand.set_indent_for_depth(true);",
1178 "\texpand.set_indent_for_icon(true);",
1179 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1180 "\tvar icon = new Gtk.Image();",
1181 "\tvar lbl = new Gtk.Label(\"\");",
1182 "\tlbl.use_markup = true;",
1183 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1185 "\ticon.margin_end = 4;",
1186 " \tlbl.justify = Gtk.Justification.LEFT;",
1187 " \tlbl.xalign = 0;",
1189 "//\tlistitem.activatable = true; ??",
1191 "\thbox.append(icon);",
1192 "\thbox.append(lbl);",
1193 "\texpand.set_child(hbox);",
1194 "\t((Gtk.ListItem)listitem).set_child(expand);",
1200 "xtype" : "SignalListItemFactory"
1203 "string title" : "Code Navigation",
1204 "xtype" : "ColumnViewColumn"
1209 "id" : "navigationselmodel",
1214 "id" : "navigationsort",
1217 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1220 "\treturn ((Lsp.DocumentSymbol)item).children;",
1226 "bool autoexpand" : true,
1227 "bool passthrough" : false,
1230 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1233 "id" : "navliststore",
1234 "xtype" : "ListStore",
1235 "| Lsp.DocumentSymbol? symbolAtLine" : [
1236 "(uint line, uint chr) {",
1239 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1240 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1241 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1242 "\t\t//\tel.name , (int)el.range.start.line,",
1243 "\t\t//\t(int)el.range.end.line",
1245 "\t\tvar ret = el.containsLine(line,chr);",
1246 "\t\tif (ret != null) {",
1247 "\t\t\treturn ret;",
1259 "(position, removed, added) => {",
1260 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1261 "\t if (added < 1) { ",
1264 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1265 "\tvar row = this.el.get_row(position);",
1267 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1274 "xtype" : "TreeListModel"
1278 "* prop" : "sorter",
1282 "* prop" : "sorter",
1285 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1287 "* prop" : "expression",
1288 "string property_name" : "sort_key",
1289 "xtype" : "PropertyExpression"
1292 "xtype" : "StringSorter"
1295 "xtype" : "TreeListRowSorter"
1298 "xtype" : "SortListModel",
1299 "| Lsp.DocumentSymbol? getSymbolAt" : [
1302 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1304 " var a = tr.get_item();; ",
1305 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1308 " return (Lsp.DocumentSymbol)tr.get_item();",
1312 "| int getRowFromSymbol" : [
1313 "(Lsp.DocumentSymbol sym) {",
1315 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1316 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1318 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1325 "| void collapseOnLoad" : [
1327 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1328 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1329 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1330 "\t\tswitch (sym.kind) {",
1331 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1332 "\t \t\t\ttr.expanded = false;",
1335 "\t\t\t\t//tr.expanded = true;",
1347 "xtype" : "NoSelection"
1353 "(n_press, x, y) => {",
1355 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1357 " if (row == null) {",
1358 "\t GLib.debug(\"no row selected items\");",
1361 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1362 " //Lsp.DocumentSymbol",
1363 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1364 " if (sym == null) {",
1370 " \"line\" : 1410,",
1371 " \"character\" : 8",
1374 " \"line\" : 1410,",
1375 " \"character\" : 39",
1379 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1380 " _this.scroll_to_line((int)sym.range.start.line);",
1381 " Gtk.TextIter iter;",
1382 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1383 " \t(int)sym.range.start.line,",
1384 " \t(int)sym.range.start.character",
1386 " _this.buffer.el.place_cursor(iter);",
1391 "xtype" : "GestureClick"
1394 "string name" : "editor-navigation",
1395 "xtype" : "ColumnView",
1396 "| Gtk.Widget? getRowWidgetAt" : [
1397 "(double x, double y, out string pos) {",
1400 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1401 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1402 "\tif (w == null) {",
1406 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1407 "\tif (row == null) {",
1411 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1415 "\t//GLib.debug(\"row number is %d\", rn);",
1416 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1417 "\t// above or belw",
1418 "\tGraphene.Rect bounds;",
1419 "\trow.compute_bounds(this.el, out bounds);",
1420 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1421 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1422 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1424 "\tvar ypos = y - bounds.get_y();",
1425 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1426 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1427 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1428 "\tpos = \"over\";",
1430 "\tif (rpos > 80) {",
1431 "\t\tpos = \"below\";",
1432 "\t} else if (rpos < 20) {",
1433 "\t\tpos = \"above\";",
1438 "| int getRowAt" : [
1439 "(double x, double y, out string pos) {",
1442 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1443 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1444 "\tif (w == null) {",
1448 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1449 "\tif (row == null) {",
1453 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1458 "\twhile (cr.get_prev_sibling() != null) {",
1460 "\t\tcr = cr.get_prev_sibling();",
1463 "\t//GLib.debug(\"row number is %d\", rn);",
1464 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1465 "\t// above or belw",
1466 "\tGraphene.Rect bounds;",
1467 "\trow.compute_bounds(this.el, out bounds);",
1468 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1469 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1470 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1472 "\tvar ypos = y - bounds.get_y();",
1473 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1474 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1475 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1476 "\tpos = \"over\";",
1478 "\tif (rpos > 80) {",
1479 "\t\tpos = \"below\";",
1480 "\t} else if (rpos < 20) {",
1481 "\t\tpos = \"above\";",
1487 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1489 "\tif (!_this.navigation_holder.el.visible) {",
1490 "\t\t_this.navigation_holder.el.show();",
1491 "\t\t_this.paned.el.position = ",
1492 "\t\t\t_this.paned.el.get_width() - 200;",
1494 "\t//_this.navliststore.el.remove_all();",
1497 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1499 "\tforeach(var sym in syms) {",
1500 "\t\tls.append(sym);",
1502 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1503 "\t//_this.navliststore.el.append(sym);",
1504 "\tthis.last_selected_line = -1;",
1505 "\tGLib.Idle.add(() => {",
1506 "\t\t_this.navigationsort.collapseOnLoad();",
1507 "\t\tGtk.TextIter iter;",
1508 "\t\t_this.buffer.el.get_iter_at_offset (",
1509 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1511 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1512 "\t\t\t\titer.get_line_offset());",
1513 "\t\tthis.updateSelectedLine(",
1514 "\t\t\t\t(uint)iter.get_line(),",
1515 "\t\t\t\t(uint)iter.get_line_offset()",
1517 "\t\treturn false;",
1522 "| void updateSelectedLine" : [
1523 "(uint line, uint chr) {",
1524 "\tif (line == this.last_selected_line) {",
1527 "\tGLib.debug(\"select line %d\", (int)line);",
1528 "\tthis.last_selected_line = (int)line;",
1531 "\tvar new_row = -1;",
1532 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1533 "\tif (sym != null) {",
1534 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1535 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1537 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1540 "\tif (this.selected_row != null) { ",
1541 "\t\tGLib.debug(\" remove selected row\");",
1542 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1544 "\tthis.selected_row = null;",
1545 "\tif (new_row > -1) {",
1546 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1547 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1548 "\t\tif (row != null) {",
1549 "\t\t\tGLib.debug(\" Add selected row\");",
1551 "\t\t\trow.add_css_class(\"selected-row\");",
1552 "\t\t\tthis.selected_row = row;",
1556 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1566 "xtype" : "ScrolledWindow"
1576 "| bool saveContents" : [
1580 " if (_this.file == null) {",
1586 " var str = _this.buffer.toString();",
1588 " _this.buffer.checkSyntax();",
1592 " // LeftPanel.model.changed( str , false);",
1593 " _this.dirty = false;",
1594 " _this.save_button.el.sensitive = false;",
1596 " // find the text for the node..",
1597 " if (_this.file.xtype != \"PlainFile\") {",
1598 " // in theory these properties have to exist!?!",
1599 " \tthis.prop.val = str;",
1600 " //this.window.windowstate.left_props.reload();",
1602 " _this.file.setSource( str );",
1605 " // call the signal..",
1613 "(string in_txt) {",
1615 "\tvar s = new GtkSource.SearchSettings();",
1616 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1617 "\ts.regex_enabled = _this.regex.el.active;\t",
1618 "\ts.wrap_around = false;",
1620 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1621 "\tthis.searchcontext.set_highlight(true);",
1622 "\tvar txt = in_txt;",
1624 "\tif (_this.multiline.el.active) {",
1625 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1628 "\ts.set_search_text(txt);",
1629 "\tGtk.TextIter beg, st,en;",
1631 "\tthis.buffer.el.get_start_iter(out beg);",
1632 "\tbool has_wrapped_around;",
1633 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1634 "\tthis.last_search_end = 0;",
1636 "\treturn this.searchcontext.get_occurrences_count();",
1644 "| string tempFileContents" : [
1648 " if (_this.file == null) {",
1651 "\tvar str= this.buffer.toString();",
1652 "\tif (_this.file.xtype == \"PlainFile\") {",
1660 " GLib.debug(\"calling validate\"); ",
1661 " // clear the buttons.",
1662 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1663 "\t\treturn this.file.toSource(); ;",
1666 "\tvar oldcode = _this.prop.val;",
1667 "\t_this.prop.val = str;",
1668 " var ret = _this.file.toSource();",
1669 " _this.prop.val = oldcode;",
1674 "| void backSearch" : [
1675 "(bool change_focus) {",
1677 "\tif (this.searchcontext == null) {",
1681 "\tGtk.TextIter beg, st,en;",
1682 "\tbool has_wrapped_around;",
1683 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1685 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1686 "\t\tthis.last_search_end = 0;",
1688 "\t\tthis.last_search_end = en.get_offset();",
1689 "\t\tif (change_focus) {",
1690 "\t\t\tthis.view.el.grab_focus();",
1692 "\t\tthis.buffer.el.place_cursor(st);",
1693 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1699 "| void forwardSearch" : [
1700 "(bool change_focus) {",
1702 "\tif (this.searchcontext == null) {",
1706 "\tGtk.TextIter beg, st,en;",
1707 "\t bool has_wrapped_around;",
1708 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1709 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1711 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1713 "\t\tif (has_wrapped_around) {",
1717 "\t\tthis.last_search_end = en.get_offset();",
1718 "\t\tif (change_focus) {",
1719 "\t\t\tthis.view.el.grab_focus();",
1721 "\t\tthis.buffer.el.place_cursor(st);",
1722 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1730 "\t this.file = null; ",
1732 " this.node = null;",
1733 " this.prop = null;",
1734 "\tthis.searchcontext = null;",
1739 "| void scroll_to_line" : [
1742 "\tGLib.Timeout.add(500, () => {",
1744 "\t\tvar buf = this.view.el.get_buffer();",
1746 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1749 "\t\tGtk.TextIter iter; ",
1750 "\t\tsbuf.get_iter_at_line(out iter, line);",
1751 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1752 "\t\treturn false;",
1758 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1761 " if (this.file != null) {",
1762 " \tthis.file.navigation_tree_updated.disconnect(",
1763 " \t\t_this.navigation.show",
1766 " this.file = file; ",
1767 " this.file.navigation_tree_updated.connect(",
1768 "\t\t_this.navigation.show",
1770 " if (file.xtype != \"PlainFile\") {",
1771 " \tthis.prop = prop;",
1772 " this.node = node;",
1774 " // find the text for the node..",
1775 " this.view.load( prop.val );",
1776 " this.updateErrorMarks();",
1780 " this.close_btn.el.show(); ",
1783 " this.view.load( file.toSource() );",
1784 " this.updateErrorMarks();",
1785 " this.close_btn.el.hide();",
1786 " var ls = file.getLanguageServer();",
1787 " ls.queueDocumentSymbols(file);",
1788 " ////ls.documentSymbols.begin(file, (a,o) => {",
1789 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1791 " //documentSymbols",
1797 "| void updateErrorMarks" : [
1802 "\tvar buf = _this.buffer.el;",
1803 "\tGtk.TextIter start;",
1804 "\tGtk.TextIter end; ",
1805 "\tbuf.get_bounds (out start, out end);",
1810 "\t//GLib.debug(\"highlight errors\");\t\t ",
1812 "\t // we should highlight other types of errors..",
1814 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1816 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1818 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1824 "\tif (_this.file == null) {",
1825 "\t\tGLib.debug(\"file is null?\");",
1829 "\tvar ar = this.file.getErrors();",
1830 "\tif (ar.size < 1) {",
1831 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1832 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1833 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1834 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1835 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1836 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1837 "\t\tthis.last_error_counter = file.error_counter ;",
1838 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1843 " // basicaly check if there is no change, then we do not do any update..",
1844 " // we can do this by just using an error counter?",
1845 " // if that's changed then we will do an update, otherwise dont bother.",
1848 "\tvar offset = 0;",
1849 "\tvar hoffset = 0;",
1851 "\tvar tlines = buf.get_line_count () +1;",
1853 "\tif (_this.prop != null) {",
1854 "\t\t// this still seems flaky...",
1856 "\t\ttlines = _this.prop.end_line;",
1857 "\t\toffset = _this.prop.start_line;",
1858 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1862 "\t\t// no update...",
1863 "\t\tif (this.last_error_counter == file.error_counter) {",
1869 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1870 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1871 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1872 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1873 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1874 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1876 "\tforeach(var diag in ar) { ",
1877 "\t Gtk.TextIter iter;",
1878 "// print(\"get inter\\n\");",
1879 "\t var eline = (int)diag.range.start.line - offset;",
1880 "\t var eline_to = (int)diag.range.end.line - offset;",
1881 "\t //var eline = diag.range.end_line - offset;",
1882 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1883 "\t //\terr.line ,eline, offset);",
1886 "\t if (eline > tlines || eline < 0) {",
1890 "\t buf.get_iter_at_line( out iter, eline);",
1891 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1892 "\t buf.create_source_mark( msg, diag.category, iter);",
1894 " \t var spos = (int)diag.range.start.character - hoffset;",
1895 " \t if (spos < 0) { spos =0 ; }",
1896 " \t if (spos > iter.get_chars_in_line()) {",
1897 " \t \tspos = iter.get_chars_in_line();",
1899 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1900 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1901 " \t if (epos < 0) { epos =0 ; }",
1902 " \t if (epos > iter.get_chars_in_line()) {",
1903 " \t \tepos = iter.get_chars_in_line();",
1907 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1909 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1911 "\t buf.apply_tag_by_name(diag.category, start, end);",
1913 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1914 "\t //this.marks.set(eline, msg);",
1916 "\tthis.last_error_counter = file.error_counter ;",