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",
31 "* prop" : "start_child",
32 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
36 "$ homogeneous" : false,
38 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
39 "bool hexpand" : true,
40 "bool vexpand" : false,
44 "bool vexpand" : true,
50 " _this.saveContents();",
59 "bool hexpand" : true,
62 "int margin_start" : 4,
64 "| void setHelper" : [
72 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
75 "\t//this.el.set_range(6,30);",
76 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
77 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
79 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
80 " \t\t//\tGLib.debug(\"update range\");",
81 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
82 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
90 "bool draw_value" : false,
91 "bool has_origin" : true,
92 "bool sensitive" : true,
94 "int width_request" : 200,
98 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
101 " \tBuilderApplication.settings.editor_font_size = val;",
115 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
116 "string icon_name" : "window-close",
123 " _this.saveContents();",
124 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
129 "string icon_name" : "window-close",
137 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
138 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
139 "bool overlay_scrolling" : false,
140 "bool vexpand" : true,
141 "id" : "RightEditor",
144 "# Gtk.CssProvider css" : "null",
145 "$ gboolean auto_indent" : true,
146 "$ xns" : "GtkSource",
153 "this.el.completion.add_provider(",
154 "\tnew Palete.CompletionProvider(_this)",
157 "// hover seems pretty useless.. - ??",
158 "//var hover = this.el.get_hover();",
159 "//hover.add_provider(new Palete.HoverProvider(_this));",
161 "//this.el.completion.unblock_interactive();",
162 "this.el.completion.select_on_show = true; // select",
163 "//this.el.completion.remember_info_visibility\t = true;",
166 "var attrs = new GtkSource.MarkAttributes();",
168 "attrs.set_icon_name ( \"process-stop\"); ",
169 "attrs.query_tooltip_text.connect(( mark) => {",
170 " GLib.debug(\"tooltip query? %s\", mark.name);",
171 " return strdup( mark.name);",
173 " attrs.query_tooltip_markup.connect(( mark) => {",
174 " GLib.debug(\"tooltip query? %s\", mark.name);",
175 " return strdup( mark.name);",
177 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
181 "var wattrs = new GtkSource.MarkAttributes();",
182 "wattrs.set_icon_name ( \"process-stop\"); ",
183 "wattrs.query_tooltip_text.connect(( mark) => {",
184 " GLib.debug(\"tooltip query? %s\", mark.name);",
185 " return strdup(mark.name);",
187 "wattrs.query_tooltip_markup.connect(( mark) => {",
188 " GLib.debug(\"tooltip query? %s\", mark.name);",
189 " return strdup(mark.name);",
191 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
195 "var dattrs = new GtkSource.MarkAttributes();",
197 "dattrs.set_icon_name ( \"process-stop\"); ",
199 "dattrs.query_tooltip_text.connect(( mark) => {",
200 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
201 " return strdup(mark.name);",
203 "//dattrs.query_tooltip_markup.connect(( mark) => {",
204 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
205 " // return strdup(mark.name);",
207 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
210 " this.el.get_space_drawer().set_matrix(null);",
211 " this.el.get_space_drawer().set_types_for_locations( ",
212 "\tGtkSource.SpaceLocationFlags.ALL,",
213 "\tGtkSource.SpaceTypeFlags.ALL",
215 "this.el.get_space_drawer().set_enable_matrix(true);",
219 "bool has_tooltip" : true,
220 "bool hexpand" : true,
221 "bool insert_spaces_instead_of_tabs" : true,
222 "bool vexpand" : true,
223 "boolean show_line_marks" : true,
224 "boolean show_line_numbers" : true,
225 "css_classes" : "{ \"code-editor\" }",
226 "gboolean highlight_current_line" : true,
231 "$ Gee.HashMap<int,string>? xmarks" : "null",
232 "$ xns" : "GtkSource",
233 "$ xtype" : "Buffer",
236 "var buf = this.el;",
237 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
238 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
239 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
240 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
241 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
242 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
243 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
244 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
247 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
248 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
249 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
255 "bool check_queued" : false,
256 "bool enable_undo" : true,
257 "bool highlight_matching_brackets" : true,
258 "bool highlight_syntax" : true,
260 "int error_line" : "-1",
264 " // check syntax??",
266 " _this.save_button.el.sensitive = true;",
267 " print(\"EDITOR CHANGED\");",
268 " this.checkSyntax();",
270 " _this.dirty = true;",
272 " // this.get('/LeftPanel.model').changed( str , false);",
280 "\tGtk.TextIter iter;",
281 "\tthis.el.get_iter_at_offset (",
282 "\t\t\tout iter, this.el.cursor_position);",
284 "\t_this.navigation.updateSelectedLine(",
285 "\t\t\t(uint)iter.get_line(),",
286 "\t\t\t(uint)iter.get_line_offset()",
294 "| bool OLDhighlightErrorsJson" : [
295 "(string type, Json.Object obj) {",
296 "\tGtk.TextIter start;",
297 "\tGtk.TextIter end; ",
298 "\tthis.el.get_bounds (out start, out end);",
300 "\tthis.el.remove_source_marks (start, end, type);",
301 "\tGLib.debug(\"highlight errors\");\t\t ",
303 "\t // we should highlight other types of errors..",
305 "\tif (!obj.has_member(type)) {",
306 "\t\tGLib.debug(\"Return has no errors\\n\");",
310 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
312 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
314 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
319 "\t//this.marks = new Gee.HashMap<int,string>();",
320 "\tvar err = obj.get_object_member(type);",
322 "\tif (_this.file == null) {",
323 "\t\tGLib.debug(\"file is null?\");",
327 "\tvar valafn = _this.file.path;",
329 "\tif (_this.file.xtype != \"PlainFile\") {",
331 "\t\tvalafn = \"\";",
333 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
334 "\t\t\t// should not happen",
335 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
336 "\t\t} catch (GLib.RegexError e) {",
337 "\t\t\treturn true;",
343 "\tif (!err.has_member(valafn)) {",
344 "\t\tGLib.debug(\"File path has no errors\");",
348 "\tvar lines = err.get_object_member(valafn);",
351 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
352 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
356 "\tvar tlines = this.el.get_line_count () +1;",
358 "\tif (_this.prop != null) {",
360 "\t\ttlines = _this.prop.end_line + 1;",
361 "\t\toffset = _this.prop.start_line + 1;",
367 "\tlines.foreach_member((obj, line, node) => {",
369 "\t Gtk.TextIter iter;",
370 "// print(\"get inter\\n\");",
371 "\t var eline = int.parse(line) - offset;",
372 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
375 "\t if (eline > tlines || eline < 0) {",
380 "\t this.el.get_iter_at_line( out iter, eline);",
381 "\t //print(\"mark line\\n\");",
382 "\t var msg = \"\";",
383 "\t var ar = lines.get_array_member(line);",
384 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
385 "\t \tif (ar.get_string_element(i) == \"Success\") {",
388 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
389 "\t\t\tmsg += ar.get_string_element(i);",
391 "\t\tif (msg == \"\") {",
394 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
395 "\t this.el.create_source_mark(msg, type, iter);",
396 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
397 "\t // this.marks.set(eline, msg);",
408 "| bool checkSyntax" : [
412 " var str = this.toString();",
415 " if (this.error_line > 0) {",
416 " Gtk.TextIter start;",
417 " Gtk.TextIter end; ",
418 " this.el.get_bounds (out start, out end);",
420 " this.el.remove_source_marks (start, end, null);",
422 " if (str.length < 1) {",
423 " print(\"checkSyntax - empty string?\\n\");",
427 " // bit presumptiona",
428 " if (_this.file.xtype == \"PlainFile\") {",
430 " // assume it's gtk...",
431 " var oldcode =_this.file.toSource();",
432 " _this.file.setSource(str);",
433 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
434 " \t_this.file.getLanguageServer().document_change(_this.file);",
435 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
436 " _this.file.setSource(oldcode);",
442 " if (_this.file == null) {",
450 " GLib.debug(\"calling validate\"); ",
451 " // clear the buttons.",
452 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
455 "\tvar oldcode = _this.prop.val;",
457 "\t_this.prop.val = str;",
458 "\t_this.node.updated_count++;",
459 " _this.file.getLanguageServer().document_change(_this.file);",
460 " _this.node.updated_count++;",
461 " _this.prop.val = oldcode;",
464 " //print(\"done mark line\\n\");",
466 " return true; // at present allow saving - even if it's invalid..",
470 "| bool highlightErrors" : [
471 "( Gee.HashMap<int,string> validate_res) {",
473 "\tthis.error_line = validate_res.size;",
475 "\tif (this.error_line < 1) {",
478 "\tvar tlines = this.el.get_line_count ();",
479 "\tGtk.TextIter iter;",
480 "\tvar valiter = validate_res.map_iterator();",
481 "\twhile (valiter.next()) {",
483 "\t// print(\"get inter\\n\");",
484 "\t\tvar eline = valiter.get_key();",
485 "\t\tif (eline > tlines) {",
488 "\t\tthis.el.get_iter_at_line( out iter, eline);",
489 "\t\t//print(\"mark line\\n\");",
490 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
495 "| string toString" : [
500 " this.el.get_start_iter(out s);",
501 " this.el.get_end_iter(out e);",
502 " var ret = this.el.get_text(s,e,true);",
503 " //print(\"TO STRING? \" + ret);",
510 "# bool is_control" : false,
515 "(keyval, keycode, state) => {",
517 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
518 " \t\tthis.is_control = true;",
525 "(keyval, keycode, state) => {",
527 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
528 " \t\tthis.is_control = false;",
530 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
531 " GLib.debug(\"SAVE: ctrl-S pressed\");",
532 " _this.saveContents();",
536 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
537 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
538 "\t\t_this.forwardSearch(true);",
541 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
542 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
543 "\t\t_this.search_entry.el.grab_focus();",
544 "\t\t_this.search_entry.el.select_region(0,-1);",
547 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
548 "\t\t_this.view.el.show_completion();",
551 "\tGtk.TextIter iter;",
552 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
553 "\tvar line = iter.get_line();",
554 "\tvar offset = iter.get_line_offset();",
555 "\tGLib.debug(\"line %d off %d\", line ,offset);",
556 "\tif (_this.prop != null) {",
557 "\t\tline += _this.prop.start_line + 1; // i think..",
558 "\t\toffset += 12; // should probably be 8 without namespaced ",
559 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
561 " //_this.view.el.show_completion();",
562 " // print(event.key.keyval)",
572 "xtype" : "EventControllerKey"
575 "# double distance" : "0.0f",
577 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
581 "\tif (!_this.keystate.is_control) {",
584 "\t //GLib.debug(\"scroll %f\", dy);",
586 "\tthis.distance += dy;",
588 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
590 "\t if (this.distance < -1) {",
592 "\t\tBuilderApplication.settings.editor_font_size ++;",
593 "\t\tthis.distance = 0;",
595 "\tif (this.distance > 1) {",
596 "\t\tBuilderApplication.settings.editor_font_size --;",
597 "\t\tthis.distance = 0;",
605 "xtype" : "EventControllerScroll"
611 "(n_press, x, y) => {",
612 "\tGtk.TextIter iter;",
613 "\tint buffer_x, buffer_y;",
614 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
616 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
617 "\t\t(int)x - gut.get_width(), (int)y,",
618 " \t\tout buffer_x, out buffer_y);",
619 "\t_this.view.el.get_iter_at_location (out iter, ",
620 "\t\t\tbuffer_x, buffer_y);;",
623 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
624 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
628 "\tvar back = iter.copy();",
629 "\tback.backward_char();",
631 "\tvar forward = iter.copy();",
632 "\tforward.forward_char();",
634 "\t// what's the character at the iter?",
635 "\tvar str = back.get_text(iter);",
636 "\tstr += iter.get_text(forward);",
637 "\tif (str.strip().length < 1) {",
640 "\tvar offset = iter.get_line_offset();",
641 "\tvar line = iter.get_line();",
642 "\tif (_this.prop != null) {",
644 "\t\tline += _this.prop.start_line ; ",
645 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
646 "\t\toffset += _this.node.node_pad.length;",
647 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
648 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
649 "\t\t\toffset += 2;",
653 "\tvar ls = _this.file.getLanguageServer();",
655 "\t\t_this.file, line, offset,",
657 "\t\t\tvar res = ls.hover.end(o );",
658 "\t\t\t_this.helper.setHelp(res);",
662 "\t\t\tthings that can ber returned..",
663 "\t\t\t\"int\" (type only)",
665 "\t\t\tEditor xxxx._thisJ",
666 "\t\t\tJsrennder.jsrender Editor.file ",
667 "\t\t\tPalete.LanguageClient? JsRender.JsRender.getLanguageServer ()",
668 "\t\t\tPalete.LanguageClient? ls = _this.file.getLanguageServer()",
669 "\t\t\tasync Lsp.Hover Palete.LanguageClient.hover (JsRender.JsRender file, int line, int offset) throws GLib.Error",
670 "\t\t\t.string JsRender.Node.node_pad = \\\"\\\" ",
671 "\t\t\tGtk.TextIter iter",
673 "\t\t string Gtk.TextIter.get_text (Gtk.TextIter end)",
678 "\t\t // could never get this to work anywhere..",
679 "\t\t // looks like its probably for calling stuff..",
680 "\t\t // but always returns null..",
682 "\tls.signatureHelp.begin(",
683 "\t\t_this.file, iter.get_line(), iter.get_line_offset(),",
685 "\t\t\tvar res = ls.signatureHelp.end(o );",
694 "xtype" : "GestureClick"
699 "(x, y, keyboard_tooltip, tooltip) => {",
701 "\t//GLib.debug(\"query tooltip\");",
702 "\tGtk.TextIter iter;",
705 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
707 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
709 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
710 "\t//\treturn false;",
713 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
715 "\tvar l = iter.get_line();",
719 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
725 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
726 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
727 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
735 "\t// this crashes?? - not sure why.",
736 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
737 "\tif (marks.is_empty()) {",
738 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
740 "\tif (marks.is_empty()) {",
741 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
744 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
746 "\tmarks.@foreach((m) => { ",
747 "\t\t//GLib.debug(\"got mark %s\", m.name);",
748 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
750 "\t// true if there is a mark..",
751 "\tif (str.length > 0 ) {",
752 "\t\ttooltip.set_text( str );",
754 "\treturn str.length > 0 ? true : false;",
760 "string name" : "editor-view",
761 "uint tab_width" : 4,
766 "// show the help page for the active node..",
767 " //this.get('/Help').show();",
769 " // this.get('/BottomPane').el.set_current_page(0);",
770 " \tGLib.debug(\"load called - Reset undo buffer\");",
772 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
773 " buf.begin_irreversible_action();",
774 " buf.set_text(str, str.length);",
775 " buf.end_irreversible_action();",
777 " var lm = GtkSource.LanguageManager.get_default();",
778 " var lang = \"vala\";",
779 " if (_this.file != null) {",
780 " lang = _this.file.language;",
782 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
783 " var lg = _this.file.content_type.length > 0 ?",
784 " lm.guess_language(_this.file.path, _this.file.content_type) :",
785 " lm.get_language(lang);",
788 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
790 " this.el.insert_spaces_instead_of_tabs = true;",
791 " if (lg != null) {",
792 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
793 "\t\tif (lg.name == \"Vala\") {",
794 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
797 " _this.dirty = false;",
798 " this.el.grab_focus();",
799 " _this.save_button.el.sensitive = false;",
800 " _this.last_error_counter = -1;",
805 "xtype" : "ScrolledWindow"
810 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
811 "bool homogeneous" : false,
812 "bool vexpand" : false,
817 "Gtk.CssProvider css" : "",
818 "bool hexpand" : true,
819 "id" : "search_entry",
825 "(keyval, keycode, state) => {",
827 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
828 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
829 "\t\t_this.forwardSearch(true);",
834 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
835 "\t\t_this.forwardSearch(true);",
841 " // print(event.key.keyval)",
848 "xtype" : "EventControllerKey"
855 "_this.search(_this.search_entry.el.text);",
856 "\t _this.search_results.updateResults();",
858 "\tGLib.Timeout.add_seconds(1,() => {",
859 "\t\t _this.search_results.updateResults();",
860 "\t\t return false;",
866 "string name" : "editor-search-entry",
867 "string placeholder_text" : "Press enter to search",
868 "uint search_delay" : 3,
869 "xtype" : "SearchEntry",
870 "| void forwardSearch" : [
871 "(bool change_focus) {",
874 "\t_this.forwardSearch(change_focus);",
878 "\tswitch(_this.windowstate.state) {",
879 "\t\tcase WindowState.State.CODEONLY:",
880 "\t\t//case WindowState.State.CODE:",
881 "\t\t\t// search the code being edited..",
882 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
885 "\t\tcase WindowState.State.PREVIEW:",
886 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
887 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
889 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
902 "id" : "search_results",
903 "int margin_end" : 4,
904 "int margin_start" : 4,
905 "string label" : "No Results",
907 "| void updateResults" : [
909 "\tthis.el.visible = true;",
911 "\tvar res = _this.searchcontext.get_occurrences_count();",
913 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
917 "\t_this.nextBtn.el.sensitive = false;",
918 "\t_this.backBtn.el.sensitive = false;\t",
921 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
922 "\t\t_this.nextBtn.el.sensitive = true;",
923 "\t\t_this.backBtn.el.sensitive = true;",
926 "\t_this.search_results.el.label = \"No Matches\";",
933 "bool always_show_image" : true,
934 "bool sensitive" : false,
940 "\t_this.forwardSearch(true);",
947 "string icon_name" : "go-down",
952 "bool always_show_image" : true,
953 "bool sensitive" : false,
959 "\t_this.backSearch(true);",
965 "string icon_name" : "go-up",
970 "bool always_show_arrow" : true,
971 "bool always_show_image" : true,
975 "* prop" : "popover",
976 "id" : "search_settings",
981 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
992 "id" : "case_sensitive",
993 "string label" : "Case Sensitive",
994 "xtype" : "CheckButton"
1000 "\tthis.el.show();",
1005 "string label" : "Regex",
1006 "xtype" : "CheckButton"
1011 "string label" : "Multi-line (add \\n)",
1012 "xtype" : "CheckButton"
1021 "string icon_name" : "emblem-system",
1022 "xtype" : "MenuButton"
1032 "* prop" : "end_child",
1033 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1034 "bool hexpand" : true,
1035 "bool vexpand" : true,
1040 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1046 "bool hexpand" : true,
1047 "bool vexpand" : true,
1048 "bool visible" : false,
1049 "id" : "navigationwindow",
1052 "# int last_selected_line" : "-1",
1053 "$ Gtk.Widget? selected_row" : "null",
1056 "id" : "navigation",
1060 "bool expand" : true,
1064 "* prop" : "factory",
1069 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1071 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1072 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1075 "\tvar hbox = (Gtk.Box) expand.child;",
1078 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1079 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1081 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1082 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1084 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1085 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1087 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1089 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1091 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1092 " \texpand.set_list_row(lr);",
1093 " \t//this.in_bind = true;",
1094 " \t// default is to expand",
1096 " \t//this.in_bind = false;",
1098 " \tsym.bind_property(\"symbol_icon\",",
1099 " img, \"icon_name\",",
1100 " GLib.BindingFlags.SYNC_CREATE);",
1102 " \thbox.css_classes = { sym.symbol_icon };",
1104 " \tsym.bind_property(\"name\",",
1106 " GLib.BindingFlags.SYNC_CREATE);",
1107 " \t// should be better?- --line no?",
1108 " \tsym.bind_property(\"tooltip\",",
1109 " lbl, \"tooltip_markup\",",
1110 " GLib.BindingFlags.SYNC_CREATE);",
1111 " \t// bind image...",
1119 "\tvar expand = new Gtk.TreeExpander();",
1121 "\texpand.set_indent_for_depth(true);",
1122 "\texpand.set_indent_for_icon(true);",
1123 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1124 "\tvar icon = new Gtk.Image();",
1125 "\tvar lbl = new Gtk.Label(\"\");",
1126 "\tlbl.use_markup = true;",
1127 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1129 "\ticon.margin_end = 4;",
1130 " \tlbl.justify = Gtk.Justification.LEFT;",
1131 " \tlbl.xalign = 0;",
1133 "//\tlistitem.activatable = true; ??",
1135 "\thbox.append(icon);",
1136 "\thbox.append(lbl);",
1137 "\texpand.set_child(hbox);",
1138 "\t((Gtk.ListItem)listitem).set_child(expand);",
1144 "xtype" : "SignalListItemFactory"
1147 "string title" : "Code Navigation",
1148 "xtype" : "ColumnViewColumn"
1153 "id" : "navigationselmodel",
1158 "id" : "navigationsort",
1161 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1164 "\treturn ((Lsp.DocumentSymbol)item).children;",
1170 "bool autoexpand" : true,
1171 "bool passthrough" : false,
1174 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1177 "id" : "navliststore",
1178 "xtype" : "ListStore",
1179 "| Lsp.DocumentSymbol? symbolAtLine" : [
1180 "(uint line, uint chr) {",
1183 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1184 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1185 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1186 "\t\t//\tel.name , (int)el.range.start.line,",
1187 "\t\t//\t(int)el.range.end.line",
1189 "\t\tvar ret = el.containsLine(line,chr);",
1190 "\t\tif (ret != null) {",
1191 "\t\t\treturn ret;",
1203 "(position, removed, added) => {",
1204 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1205 "\t if (added < 1) { ",
1208 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1209 "\tvar row = this.el.get_row(position);",
1211 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1218 "xtype" : "TreeListModel"
1222 "* prop" : "sorter",
1226 "* prop" : "sorter",
1229 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1231 "* prop" : "expression",
1232 "string property_name" : "sort_key",
1233 "xtype" : "PropertyExpression"
1236 "xtype" : "StringSorter"
1239 "xtype" : "TreeListRowSorter"
1242 "xtype" : "SortListModel",
1243 "| Lsp.DocumentSymbol? getSymbolAt" : [
1246 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1248 " var a = tr.get_item();; ",
1249 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1252 " return (Lsp.DocumentSymbol)tr.get_item();",
1256 "| int getRowFromSymbol" : [
1257 "(Lsp.DocumentSymbol sym) {",
1259 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1260 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1262 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1269 "| void collapseOnLoad" : [
1271 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1272 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1273 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1274 "\t\tswitch (sym.kind) {",
1275 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1276 "\t \t\t\ttr.expanded = false;",
1279 "\t\t\t\t//tr.expanded = true;",
1291 "xtype" : "NoSelection"
1297 "(n_press, x, y) => {",
1299 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1301 " if (row == null) {",
1302 "\t GLib.debug(\"no row selected items\");",
1305 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1306 " //Lsp.DocumentSymbol",
1307 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1308 " if (sym == null) {",
1314 " \"line\" : 1410,",
1315 " \"character\" : 8",
1318 " \"line\" : 1410,",
1319 " \"character\" : 39",
1323 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1324 " _this.scroll_to_line((int)sym.range.start.line);",
1325 " Gtk.TextIter iter;",
1326 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1327 " \t(int)sym.range.start.line,",
1328 " \t(int)sym.range.start.character",
1330 " _this.buffer.el.place_cursor(iter);",
1335 "xtype" : "GestureClick"
1338 "string name" : "editor-navigation",
1339 "xtype" : "ColumnView",
1340 "| Gtk.Widget? getRowWidgetAt" : [
1341 "(double x, double y, out string pos) {",
1344 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1345 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1346 "\tif (w == null) {",
1350 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1351 "\tif (row == null) {",
1355 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1359 "\t//GLib.debug(\"row number is %d\", rn);",
1360 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1361 "\t// above or belw",
1362 "\tGraphene.Rect bounds;",
1363 "\trow.compute_bounds(this.el, out bounds);",
1364 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1365 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1366 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1368 "\tvar ypos = y - bounds.get_y();",
1369 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1370 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1371 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1372 "\tpos = \"over\";",
1374 "\tif (rpos > 80) {",
1375 "\t\tpos = \"below\";",
1376 "\t} else if (rpos < 20) {",
1377 "\t\tpos = \"above\";",
1382 "| int getRowAt" : [
1383 "(double x, double y, out string pos) {",
1386 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1387 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1388 "\tif (w == null) {",
1392 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1393 "\tif (row == null) {",
1397 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1402 "\twhile (cr.get_prev_sibling() != null) {",
1404 "\t\tcr = cr.get_prev_sibling();",
1407 "\t//GLib.debug(\"row number is %d\", rn);",
1408 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1409 "\t// above or belw",
1410 "\tGraphene.Rect bounds;",
1411 "\trow.compute_bounds(this.el, out bounds);",
1412 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1413 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1414 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1416 "\tvar ypos = y - bounds.get_y();",
1417 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1418 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1419 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1420 "\tpos = \"over\";",
1422 "\tif (rpos > 80) {",
1423 "\t\tpos = \"below\";",
1424 "\t} else if (rpos < 20) {",
1425 "\t\tpos = \"above\";",
1431 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1432 "\t_this.navigationwindow.el.show();",
1433 "\t//_this.navliststore.el.remove_all();",
1436 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1438 "\tforeach(var sym in syms) {",
1439 "\t\tls.append(sym);",
1441 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1442 "\t//_this.navliststore.el.append(sym);",
1443 "\tthis.last_selected_line = -1;",
1444 "\tGLib.Idle.add(() => {",
1445 "\t\t_this.navigationsort.collapseOnLoad();",
1446 "\t\tGtk.TextIter iter;",
1447 "\t\t_this.buffer.el.get_iter_at_offset (",
1448 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1450 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1451 "\t\t\t\titer.get_line_offset());",
1452 "\t\tthis.updateSelectedLine(",
1453 "\t\t\t\t(uint)iter.get_line(),",
1454 "\t\t\t\t(uint)iter.get_line_offset()",
1456 "\t\treturn false;",
1461 "| void updateSelectedLine" : [
1462 "(uint line, uint chr) {",
1463 "\tif (line == this.last_selected_line) {",
1466 "\tGLib.debug(\"select line %d\", (int)line);",
1467 "\tthis.last_selected_line = (int)line;",
1470 "\tvar new_row = -1;",
1471 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1472 "\tif (sym != null) {",
1473 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1474 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1476 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1479 "\tif (this.selected_row != null) { ",
1480 "\t\tGLib.debug(\" remove selected row\");",
1481 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1483 "\tthis.selected_row = null;",
1484 "\tif (new_row > -1) {",
1485 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1486 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1487 "\t\tif (row != null) {",
1488 "\t\t\tGLib.debug(\" Add selected row\");",
1490 "\t\t\trow.add_css_class(\"selected-row\");",
1491 "\t\t\tthis.selected_row = row;",
1495 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1505 "xtype" : "ScrolledWindow"
1515 "| bool saveContents" : [
1519 " if (_this.file == null) {",
1525 " var str = _this.buffer.toString();",
1527 " _this.buffer.checkSyntax();",
1531 " // LeftPanel.model.changed( str , false);",
1532 " _this.dirty = false;",
1533 " _this.save_button.el.sensitive = false;",
1535 " // find the text for the node..",
1536 " if (_this.file.xtype != \"PlainFile\") {",
1537 " // in theory these properties have to exist!?!",
1538 " \tthis.prop.val = str;",
1539 " //this.window.windowstate.left_props.reload();",
1541 " _this.file.setSource( str );",
1544 " // call the signal..",
1552 "(string in_txt) {",
1554 "\tvar s = new GtkSource.SearchSettings();",
1555 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1556 "\ts.regex_enabled = _this.regex.el.active;\t",
1557 "\ts.wrap_around = false;",
1559 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1560 "\tthis.searchcontext.set_highlight(true);",
1561 "\tvar txt = in_txt;",
1563 "\tif (_this.multiline.el.active) {",
1564 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1567 "\ts.set_search_text(txt);",
1568 "\tGtk.TextIter beg, st,en;",
1570 "\tthis.buffer.el.get_start_iter(out beg);",
1571 "\tbool has_wrapped_around;",
1572 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1573 "\tthis.last_search_end = 0;",
1575 "\treturn this.searchcontext.get_occurrences_count();",
1583 "| string tempFileContents" : [
1587 " if (_this.file == null) {",
1590 "\tvar str= this.buffer.toString();",
1591 "\tif (_this.file.xtype == \"PlainFile\") {",
1599 " GLib.debug(\"calling validate\"); ",
1600 " // clear the buttons.",
1601 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1602 "\t\treturn this.file.toSource(); ;",
1605 "\tvar oldcode = _this.prop.val;",
1606 "\t_this.prop.val = str;",
1607 " var ret = _this.file.toSource();",
1608 " _this.prop.val = oldcode;",
1613 "| void backSearch" : [
1614 "(bool change_focus) {",
1616 "\tif (this.searchcontext == null) {",
1620 "\tGtk.TextIter beg, st,en;",
1621 "\tbool has_wrapped_around;",
1622 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1624 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1625 "\t\tthis.last_search_end = 0;",
1627 "\t\tthis.last_search_end = en.get_offset();",
1628 "\t\tif (change_focus) {",
1629 "\t\t\tthis.view.el.grab_focus();",
1631 "\t\tthis.buffer.el.place_cursor(st);",
1632 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1638 "| void forwardSearch" : [
1639 "(bool change_focus) {",
1641 "\tif (this.searchcontext == null) {",
1645 "\tGtk.TextIter beg, st,en;",
1646 "\t bool has_wrapped_around;",
1647 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1648 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1650 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1652 "\t\tif (has_wrapped_around) {",
1656 "\t\tthis.last_search_end = en.get_offset();",
1657 "\t\tif (change_focus) {",
1658 "\t\t\tthis.view.el.grab_focus();",
1660 "\t\tthis.buffer.el.place_cursor(st);",
1661 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1669 "\t this.file = null; ",
1671 " this.node = null;",
1672 " this.prop = null;",
1673 "\tthis.searchcontext = null;",
1678 "| void scroll_to_line" : [
1681 "\tGLib.Timeout.add(500, () => {",
1683 "\t\tvar buf = this.view.el.get_buffer();",
1685 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1688 "\t\tGtk.TextIter iter; ",
1689 "\t\tsbuf.get_iter_at_line(out iter, line);",
1690 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1691 "\t\treturn false;",
1697 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1700 " if (this.file != null) {",
1701 " \tthis.file.navigation_tree_updated.disconnect(",
1702 " \t\t_this.navigation.show",
1705 " this.file = file; ",
1706 " this.file.navigation_tree_updated.connect(",
1707 "\t\t_this.navigation.show",
1709 " if (file.xtype != \"PlainFile\") {",
1710 " \tthis.prop = prop;",
1711 " this.node = node;",
1713 " // find the text for the node..",
1714 " this.view.load( prop.val );",
1715 " this.updateErrorMarks();",
1719 " this.close_btn.el.show(); ",
1722 " this.view.load( file.toSource() );",
1723 " this.updateErrorMarks();",
1724 " this.close_btn.el.hide();",
1725 " var ls = file.getLanguageServer();",
1726 " ls.queueDocumentSymbols(file);",
1727 " ////ls.documentSymbols.begin(file, (a,o) => {",
1728 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1730 " //documentSymbols",
1736 "| void updateErrorMarks" : [
1741 "\tvar buf = _this.buffer.el;",
1742 "\tGtk.TextIter start;",
1743 "\tGtk.TextIter end; ",
1744 "\tbuf.get_bounds (out start, out end);",
1749 "\t//GLib.debug(\"highlight errors\");\t\t ",
1751 "\t // we should highlight other types of errors..",
1753 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1755 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1757 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1763 "\tif (_this.file == null) {",
1764 "\t\tGLib.debug(\"file is null?\");",
1768 "\tvar ar = this.file.getErrors();",
1769 "\tif (ar.size < 1) {",
1770 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1771 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1772 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1773 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1774 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1775 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1776 "\t\tthis.last_error_counter = file.error_counter ;",
1777 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1782 " // basicaly check if there is no change, then we do not do any update..",
1783 " // we can do this by just using an error counter?",
1784 " // if that's changed then we will do an update, otherwise dont bother.",
1787 "\tvar offset = 0;",
1788 "\tvar hoffset = 0;",
1790 "\tvar tlines = buf.get_line_count () +1;",
1792 "\tif (_this.prop != null) {",
1793 "\t\t// this still seems flaky...",
1795 "\t\ttlines = _this.prop.end_line;",
1796 "\t\toffset = _this.prop.start_line;",
1797 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1801 "\t\t// no update...",
1802 "\t\tif (this.last_error_counter == file.error_counter) {",
1808 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1809 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1810 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1811 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1812 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1813 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1815 "\tforeach(var diag in ar) { ",
1816 "\t Gtk.TextIter iter;",
1817 "// print(\"get inter\\n\");",
1818 "\t var eline = (int)diag.range.start.line - offset;",
1819 "\t var eline_to = (int)diag.range.end.line - offset;",
1820 "\t //var eline = diag.range.end_line - offset;",
1821 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1822 "\t //\terr.line ,eline, offset);",
1825 "\t if (eline > tlines || eline < 0) {",
1829 "\t buf.get_iter_at_line( out iter, eline);",
1830 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1831 "\t buf.create_source_mark( msg, diag.category, iter);",
1833 " \t var spos = (int)diag.range.start.character - hoffset;",
1834 " \t if (spos < 0) { spos =0 ; }",
1835 " \t if (spos > iter.get_chars_in_line()) {",
1836 " \t \tspos = iter.get_chars_in_line();",
1838 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1839 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1840 " \t if (epos < 0) { epos =0 ; }",
1841 " \t if (epos > iter.get_chars_in_line()) {",
1842 " \t \tepos = iter.get_chars_in_line();",
1846 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1848 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1850 "\t buf.apply_tag_by_name(diag.category, start, end);",
1852 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1853 "\t //this.marks.set(eline, msg);",
1855 "\tthis.last_error_counter = file.error_counter ;",