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,
74 "\tGLib.debug(\"got uri %s\", uri);",
75 "\tvar ls = _this.file.getLanguageServer();",
76 "\tls.symbol.begin(uri, (a,b) => {",
77 "\t\tls.symbol.end(b);",
85 "(x, y, keyboard_tooltip, tooltip) => {",
86 "\tGLib.debug(\"using quiery tooltip?\");",
87 "\tvar lbl = new Gtk.Label(this.el.tooltip_markup);",
88 "\tlbl.width_request = 500;",
89 "\ttooltip.set_custom(lbl);",
98 "(Lsp.Hover? help) {",
99 "\tif (help == null || help.contents == null",
100 "\t\t|| help.contents.size < 1) {",
101 "\t\tthis.el.set_text(\"\");",
104 "\tvar sig = help.contents.get(0).value.split(\" \");",
105 "\tstring[] str = {};",
106 "\tfor(var i =0; i < sig.length; i++) {",
108 "\t\tswitch(sig[i]) {",
109 "\t\t\tcase \"public\":",
110 "\t\t\tcase \"private\":",
111 "\t\t\tcase \"protected\":",
112 "\t\t\tcase \"async\":",
113 "\t\t\tcase \"class\":",
119 "\t\t\t\tstr += sig[i];",
125 "\t\t\t\tstr += (\"<a href=\\\"\" + GLib.Markup.escape_text(sig[i]) + \"\\\">\" + ",
126 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
127 "\t\t\t\t\t+\"</a>\");",
131 "\tif (help.contents.size > 1) {",
132 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value);",
134 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(0).value);",
136 "\tthis.el.set_markup(string.joinv(\" \",str));",
143 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
146 "\t//this.el.set_range(6,30);",
147 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
148 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
150 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
151 " \t\t//\tGLib.debug(\"update range\");",
152 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
153 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
161 "Gtk.Align halign" : "Gtk.Align.END",
162 "bool draw_value" : false,
163 "bool has_origin" : true,
164 "bool sensitive" : true,
166 "int width_request" : 150,
170 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
173 " \tBuilderApplication.settings.editor_font_size = val;",
182 "Gtk.Align halign" : "Gtk.Align.END",
188 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
189 "string icon_name" : "window-close",
196 " _this.saveContents();",
197 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
202 "string icon_name" : "window-close",
210 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
211 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
212 "bool overlay_scrolling" : false,
213 "bool vexpand" : true,
214 "id" : "RightEditor",
217 "# Gtk.CssProvider css" : "null",
218 "$ gboolean auto_indent" : true,
219 "$ xns" : "GtkSource",
226 "this.el.completion.add_provider(",
227 "\tnew Palete.CompletionProvider(_this)",
230 "// hover seems pretty useless.. - ??",
231 "//var hover = this.el.get_hover();",
232 "//hover.add_provider(new Palete.HoverProvider(_this));",
234 "//this.el.completion.unblock_interactive();",
235 "this.el.completion.select_on_show = true; // select",
236 "//this.el.completion.remember_info_visibility\t = true;",
239 "var attrs = new GtkSource.MarkAttributes();",
241 "attrs.set_icon_name ( \"process-stop\"); ",
242 "attrs.query_tooltip_text.connect(( mark) => {",
243 " GLib.debug(\"tooltip query? %s\", mark.name);",
244 " return strdup( mark.name);",
246 " attrs.query_tooltip_markup.connect(( mark) => {",
247 " GLib.debug(\"tooltip query? %s\", mark.name);",
248 " return strdup( mark.name);",
250 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
254 "var wattrs = new GtkSource.MarkAttributes();",
255 "wattrs.set_icon_name ( \"process-stop\"); ",
256 "wattrs.query_tooltip_text.connect(( mark) => {",
257 " GLib.debug(\"tooltip query? %s\", mark.name);",
258 " return strdup(mark.name);",
260 "wattrs.query_tooltip_markup.connect(( mark) => {",
261 " GLib.debug(\"tooltip query? %s\", mark.name);",
262 " return strdup(mark.name);",
264 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
268 "var dattrs = new GtkSource.MarkAttributes();",
270 "dattrs.set_icon_name ( \"process-stop\"); ",
272 "dattrs.query_tooltip_text.connect(( mark) => {",
273 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
274 " return strdup(mark.name);",
276 "//dattrs.query_tooltip_markup.connect(( mark) => {",
277 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
278 " // return strdup(mark.name);",
280 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
283 " this.el.get_space_drawer().set_matrix(null);",
284 " this.el.get_space_drawer().set_types_for_locations( ",
285 "\tGtkSource.SpaceLocationFlags.ALL,",
286 "\tGtkSource.SpaceTypeFlags.ALL",
288 "this.el.get_space_drawer().set_enable_matrix(true);",
292 "bool has_tooltip" : true,
293 "bool hexpand" : true,
294 "bool insert_spaces_instead_of_tabs" : true,
295 "bool vexpand" : true,
296 "boolean show_line_marks" : true,
297 "boolean show_line_numbers" : true,
298 "css_classes" : "{ \"code-editor\" }",
299 "gboolean highlight_current_line" : true,
304 "$ Gee.HashMap<int,string>? xmarks" : "null",
305 "$ xns" : "GtkSource",
306 "$ xtype" : "Buffer",
309 "var buf = this.el;",
310 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
311 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
312 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
313 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
314 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
315 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
316 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
317 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
320 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
321 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
322 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
328 "bool check_queued" : false,
329 "bool enable_undo" : true,
330 "bool highlight_matching_brackets" : true,
331 "bool highlight_syntax" : true,
333 "int error_line" : "-1",
337 " // check syntax??",
339 " _this.save_button.el.sensitive = true;",
340 " print(\"EDITOR CHANGED\");",
341 " this.checkSyntax();",
343 " _this.dirty = true;",
345 " // this.get('/LeftPanel.model').changed( str , false);",
353 "\tGtk.TextIter iter;",
354 "\tthis.el.get_iter_at_offset (",
355 "\t\t\tout iter, this.el.cursor_position);",
357 "\t_this.navigation.updateSelectedLine(",
358 "\t\t\t(uint)iter.get_line(),",
359 "\t\t\t(uint)iter.get_line_offset()",
361 "\tthis.showHelp(iter);",
367 "| bool OLDhighlightErrorsJson" : [
368 "(string type, Json.Object obj) {",
369 "\tGtk.TextIter start;",
370 "\tGtk.TextIter end; ",
371 "\tthis.el.get_bounds (out start, out end);",
373 "\tthis.el.remove_source_marks (start, end, type);",
374 "\tGLib.debug(\"highlight errors\");\t\t ",
376 "\t // we should highlight other types of errors..",
378 "\tif (!obj.has_member(type)) {",
379 "\t\tGLib.debug(\"Return has no errors\\n\");",
383 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
385 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
387 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
392 "\t//this.marks = new Gee.HashMap<int,string>();",
393 "\tvar err = obj.get_object_member(type);",
395 "\tif (_this.file == null) {",
396 "\t\tGLib.debug(\"file is null?\");",
400 "\tvar valafn = _this.file.path;",
402 "\tif (_this.file.xtype != \"PlainFile\") {",
404 "\t\tvalafn = \"\";",
406 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
407 "\t\t\t// should not happen",
408 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
409 "\t\t} catch (GLib.RegexError e) {",
410 "\t\t\treturn true;",
416 "\tif (!err.has_member(valafn)) {",
417 "\t\tGLib.debug(\"File path has no errors\");",
421 "\tvar lines = err.get_object_member(valafn);",
424 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
425 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
429 "\tvar tlines = this.el.get_line_count () +1;",
431 "\tif (_this.prop != null) {",
433 "\t\ttlines = _this.prop.end_line + 1;",
434 "\t\toffset = _this.prop.start_line + 1;",
440 "\tlines.foreach_member((obj, line, node) => {",
442 "\t Gtk.TextIter iter;",
443 "// print(\"get inter\\n\");",
444 "\t var eline = int.parse(line) - offset;",
445 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
448 "\t if (eline > tlines || eline < 0) {",
453 "\t this.el.get_iter_at_line( out iter, eline);",
454 "\t //print(\"mark line\\n\");",
455 "\t var msg = \"\";",
456 "\t var ar = lines.get_array_member(line);",
457 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
458 "\t \tif (ar.get_string_element(i) == \"Success\") {",
461 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
462 "\t\t\tmsg += ar.get_string_element(i);",
464 "\t\tif (msg == \"\") {",
467 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
468 "\t this.el.create_source_mark(msg, type, iter);",
469 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
470 "\t // this.marks.set(eline, msg);",
481 "| bool checkSyntax" : [
485 " var str = this.toString();",
488 " if (this.error_line > 0) {",
489 " Gtk.TextIter start;",
490 " Gtk.TextIter end; ",
491 " this.el.get_bounds (out start, out end);",
493 " this.el.remove_source_marks (start, end, null);",
495 " if (str.length < 1) {",
496 " print(\"checkSyntax - empty string?\\n\");",
500 " // bit presumptiona",
501 " if (_this.file.xtype == \"PlainFile\") {",
503 " // assume it's gtk...",
504 " var oldcode =_this.file.toSource();",
505 " _this.file.setSource(str);",
506 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
507 " \t_this.file.getLanguageServer().document_change(_this.file);",
508 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
509 " _this.file.setSource(oldcode);",
515 " if (_this.file == null) {",
523 " GLib.debug(\"calling validate\"); ",
524 " // clear the buttons.",
525 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
528 "\tvar oldcode = _this.prop.val;",
530 "\t_this.prop.val = str;",
531 "\t_this.node.updated_count++;",
532 " _this.file.getLanguageServer().document_change(_this.file);",
533 " _this.node.updated_count++;",
534 " _this.prop.val = oldcode;",
537 " //print(\"done mark line\\n\");",
539 " return true; // at present allow saving - even if it's invalid..",
543 "| bool highlightErrors" : [
544 "( Gee.HashMap<int,string> validate_res) {",
546 "\tthis.error_line = validate_res.size;",
548 "\tif (this.error_line < 1) {",
551 "\tvar tlines = this.el.get_line_count ();",
552 "\tGtk.TextIter iter;",
553 "\tvar valiter = validate_res.map_iterator();",
554 "\twhile (valiter.next()) {",
556 "\t// print(\"get inter\\n\");",
557 "\t\tvar eline = valiter.get_key();",
558 "\t\tif (eline > tlines) {",
561 "\t\tthis.el.get_iter_at_line( out iter, eline);",
562 "\t\t//print(\"mark line\\n\");",
563 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
568 "| string toString" : [
573 " this.el.get_start_iter(out s);",
574 " this.el.get_end_iter(out e);",
575 " var ret = this.el.get_text(s,e,true);",
576 " //print(\"TO STRING? \" + ret);",
581 "| void showHelp" : [
582 "(Gtk.TextIter iter) {",
583 "\tvar back = iter.copy();",
584 "\tback.backward_char();",
586 "\tvar forward = iter.copy();",
587 "\tforward.forward_char();",
589 "\t// what's the character at the iter?",
590 "\tvar str = back.get_text(iter);",
591 "\tstr += iter.get_text(forward);",
592 "\tif (str.strip().length < 1) {",
595 "\tvar offset = iter.get_line_offset();",
596 "\tvar line = iter.get_line();",
597 "\tif (_this.prop != null) {",
599 "\t\tline += _this.prop.start_line ; ",
600 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
601 "\t\toffset += _this.node.node_pad.length;",
602 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
603 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
604 "\t\t\toffset += 2;",
608 "\tvar ls = _this.file.getLanguageServer();",
610 "\t\t_this.file, line, offset,",
613 "\t\t\t\tvar res = ls.hover.end(o );",
615 "\t\t\t\t_this.helper.setHelp(res);",
616 "\t\t\t} catch (GLib.Error e) {",
626 "# bool is_control" : false,
631 "(keyval, keycode, state) => {",
633 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
634 " \t\tthis.is_control = true;",
641 "(keyval, keycode, state) => {",
643 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
644 " \t\tthis.is_control = false;",
646 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
647 " GLib.debug(\"SAVE: ctrl-S pressed\");",
648 " _this.saveContents();",
652 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
653 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
654 "\t\t_this.forwardSearch(true);",
657 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
658 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
659 "\t\t_this.search_entry.el.grab_focus();",
660 "\t\t_this.search_entry.el.select_region(0,-1);",
663 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
664 "\t\t_this.view.el.show_completion();",
667 "\tGtk.TextIter iter;",
668 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
669 "\tvar line = iter.get_line();",
670 "\tvar offset = iter.get_line_offset();",
671 "\tGLib.debug(\"line %d off %d\", line ,offset);",
672 "\tif (_this.prop != null) {",
673 "\t\tline += _this.prop.start_line + 1; // i think..",
674 "\t\toffset += 12; // should probably be 8 without namespaced ",
675 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
677 " //_this.view.el.show_completion();",
678 " // print(event.key.keyval)",
688 "xtype" : "EventControllerKey"
691 "# double distance" : "0.0f",
693 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
697 "\tif (!_this.keystate.is_control) {",
700 "\t //GLib.debug(\"scroll %f\", dy);",
702 "\tthis.distance += dy;",
704 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
706 "\t if (this.distance < -1) {",
708 "\t\tBuilderApplication.settings.editor_font_size ++;",
709 "\t\tthis.distance = 0;",
711 "\tif (this.distance > 1) {",
712 "\t\tBuilderApplication.settings.editor_font_size --;",
713 "\t\tthis.distance = 0;",
721 "xtype" : "EventControllerScroll"
727 "(n_press, x, y) => {",
728 "\tGtk.TextIter iter;",
729 "\tint buffer_x, buffer_y;",
730 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
732 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
733 "\t\t(int)x - gut.get_width(), (int)y,",
734 " \t\tout buffer_x, out buffer_y);",
735 "\t_this.view.el.get_iter_at_location (out iter, ",
736 "\t\t\tbuffer_x, buffer_y);;",
739 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
740 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
744 "\t_this.buffer.showHelp(iter);",
752 "xtype" : "GestureClick"
757 "(x, y, keyboard_tooltip, tooltip) => {",
759 "\t//GLib.debug(\"query tooltip\");",
760 "\tGtk.TextIter iter;",
763 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
765 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
767 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
768 "\t//\treturn false;",
771 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
773 "\tvar l = iter.get_line();",
777 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
783 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
784 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
785 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
793 "\t// this crashes?? - not sure why.",
794 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
795 "\tif (marks.is_empty()) {",
796 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
798 "\tif (marks.is_empty()) {",
799 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
802 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
804 "\tmarks.@foreach((m) => { ",
805 "\t\t//GLib.debug(\"got mark %s\", m.name);",
806 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
808 "\t// true if there is a mark..",
809 "\tif (str.length > 0 ) {",
810 "\t\ttooltip.set_text( str );",
812 "\treturn str.length > 0 ? true : false;",
818 "string name" : "editor-view",
819 "uint tab_width" : 4,
824 "// show the help page for the active node..",
825 " //this.get('/Help').show();",
827 " // this.get('/BottomPane').el.set_current_page(0);",
828 " \tGLib.debug(\"load called - Reset undo buffer\");",
830 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
831 " buf.begin_irreversible_action();",
832 " buf.set_text(str, str.length);",
833 " buf.end_irreversible_action();",
835 " var lm = GtkSource.LanguageManager.get_default();",
836 " var lang = \"vala\";",
837 " if (_this.file != null) {",
838 " lang = _this.file.language;",
840 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
841 " var lg = _this.file.content_type.length > 0 ?",
842 " lm.guess_language(_this.file.path, _this.file.content_type) :",
843 " lm.get_language(lang);",
846 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
848 " this.el.insert_spaces_instead_of_tabs = true;",
849 " if (lg != null) {",
850 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
851 "\t\tif (lg.name == \"Vala\") {",
852 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
855 " _this.dirty = false;",
856 " this.el.grab_focus();",
857 " _this.save_button.el.sensitive = false;",
858 " _this.last_error_counter = -1;",
863 "xtype" : "ScrolledWindow"
868 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
869 "bool homogeneous" : false,
870 "bool vexpand" : false,
875 "Gtk.CssProvider css" : "",
876 "bool hexpand" : true,
877 "id" : "search_entry",
883 "(keyval, keycode, state) => {",
885 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
886 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
887 "\t\t_this.forwardSearch(true);",
892 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
893 "\t\t_this.forwardSearch(true);",
899 " // print(event.key.keyval)",
906 "xtype" : "EventControllerKey"
913 "_this.search(_this.search_entry.el.text);",
914 "\t _this.search_results.updateResults();",
916 "\tGLib.Timeout.add_seconds(1,() => {",
917 "\t\t _this.search_results.updateResults();",
918 "\t\t return false;",
924 "string name" : "editor-search-entry",
925 "string placeholder_text" : "Press enter to search",
926 "uint search_delay" : 3,
927 "xtype" : "SearchEntry",
928 "| void forwardSearch" : [
929 "(bool change_focus) {",
932 "\t_this.forwardSearch(change_focus);",
936 "\tswitch(_this.windowstate.state) {",
937 "\t\tcase WindowState.State.CODEONLY:",
938 "\t\t//case WindowState.State.CODE:",
939 "\t\t\t// search the code being edited..",
940 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
943 "\t\tcase WindowState.State.PREVIEW:",
944 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
945 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
947 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
960 "id" : "search_results",
961 "int margin_end" : 4,
962 "int margin_start" : 4,
963 "string label" : "No Results",
965 "| void updateResults" : [
967 "\tthis.el.visible = true;",
969 "\tvar res = _this.searchcontext.get_occurrences_count();",
971 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
975 "\t_this.nextBtn.el.sensitive = false;",
976 "\t_this.backBtn.el.sensitive = false;\t",
979 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
980 "\t\t_this.nextBtn.el.sensitive = true;",
981 "\t\t_this.backBtn.el.sensitive = true;",
984 "\t_this.search_results.el.label = \"No Matches\";",
991 "bool always_show_image" : true,
992 "bool sensitive" : false,
998 "\t_this.forwardSearch(true);",
1005 "string icon_name" : "go-down",
1010 "bool always_show_image" : true,
1011 "bool sensitive" : false,
1017 "\t_this.backSearch(true);",
1023 "string icon_name" : "go-up",
1028 "bool always_show_arrow" : true,
1029 "bool always_show_image" : true,
1033 "* prop" : "popover",
1034 "id" : "search_settings",
1039 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1046 "\tthis.el.show();",
1050 "id" : "case_sensitive",
1051 "string label" : "Case Sensitive",
1052 "xtype" : "CheckButton"
1058 "\tthis.el.show();",
1063 "string label" : "Regex",
1064 "xtype" : "CheckButton"
1069 "string label" : "Multi-line (add \\n)",
1070 "xtype" : "CheckButton"
1079 "string icon_name" : "emblem-system",
1080 "xtype" : "MenuButton"
1090 "* prop" : "end_child",
1091 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1092 "bool hexpand" : true,
1093 "bool vexpand" : true,
1094 "bool visible" : false,
1095 "id" : "navigation_holder",
1097 "int width_request" : 120,
1101 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1107 "bool hexpand" : true,
1108 "bool vexpand" : true,
1109 "bool visible" : true,
1110 "id" : "navigationwindow",
1113 "# int last_selected_line" : "-1",
1114 "$ Gtk.Widget? selected_row" : "null",
1117 "id" : "navigation",
1121 "bool expand" : true,
1125 "* prop" : "factory",
1130 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1132 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1133 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1136 "\tvar hbox = (Gtk.Box) expand.child;",
1139 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1140 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1142 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1143 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1145 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1146 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1148 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1150 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1152 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1153 " \texpand.set_list_row(lr);",
1154 " \t//this.in_bind = true;",
1155 " \t// default is to expand",
1157 " \t//this.in_bind = false;",
1159 " \tsym.bind_property(\"symbol_icon\",",
1160 " img, \"icon_name\",",
1161 " GLib.BindingFlags.SYNC_CREATE);",
1163 " \thbox.css_classes = { sym.symbol_icon };",
1165 " \tsym.bind_property(\"name\",",
1167 " GLib.BindingFlags.SYNC_CREATE);",
1168 " \t// should be better?- --line no?",
1169 " \tsym.bind_property(\"tooltip\",",
1170 " lbl, \"tooltip_markup\",",
1171 " GLib.BindingFlags.SYNC_CREATE);",
1172 " \t// bind image...",
1180 "\tvar expand = new Gtk.TreeExpander();",
1182 "\texpand.set_indent_for_depth(true);",
1183 "\texpand.set_indent_for_icon(true);",
1184 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1185 "\tvar icon = new Gtk.Image();",
1186 "\tvar lbl = new Gtk.Label(\"\");",
1187 "\tlbl.use_markup = true;",
1188 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1190 "\ticon.margin_end = 4;",
1191 " \tlbl.justify = Gtk.Justification.LEFT;",
1192 " \tlbl.xalign = 0;",
1194 "//\tlistitem.activatable = true; ??",
1196 "\thbox.append(icon);",
1197 "\thbox.append(lbl);",
1198 "\texpand.set_child(hbox);",
1199 "\t((Gtk.ListItem)listitem).set_child(expand);",
1205 "xtype" : "SignalListItemFactory"
1208 "string title" : "Code Navigation",
1209 "xtype" : "ColumnViewColumn"
1214 "id" : "navigationselmodel",
1219 "id" : "navigationsort",
1222 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1225 "\treturn ((Lsp.DocumentSymbol)item).children;",
1231 "bool autoexpand" : true,
1232 "bool passthrough" : false,
1235 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1238 "id" : "navliststore",
1239 "xtype" : "ListStore",
1240 "| Lsp.DocumentSymbol? symbolAtLine" : [
1241 "(uint line, uint chr) {",
1244 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1245 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1246 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1247 "\t\t//\tel.name , (int)el.range.start.line,",
1248 "\t\t//\t(int)el.range.end.line",
1250 "\t\tvar ret = el.containsLine(line,chr);",
1251 "\t\tif (ret != null) {",
1252 "\t\t\treturn ret;",
1264 "(position, removed, added) => {",
1265 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1266 "\t if (added < 1) { ",
1269 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1270 "\tvar row = this.el.get_row(position);",
1272 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1279 "xtype" : "TreeListModel"
1283 "* prop" : "sorter",
1287 "* prop" : "sorter",
1290 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1292 "* prop" : "expression",
1293 "string property_name" : "sort_key",
1294 "xtype" : "PropertyExpression"
1297 "xtype" : "StringSorter"
1300 "xtype" : "TreeListRowSorter"
1303 "xtype" : "SortListModel",
1304 "| Lsp.DocumentSymbol? getSymbolAt" : [
1307 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1309 " var a = tr.get_item();; ",
1310 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1313 " return (Lsp.DocumentSymbol)tr.get_item();",
1317 "| int getRowFromSymbol" : [
1318 "(Lsp.DocumentSymbol sym) {",
1320 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1321 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1323 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1330 "| void collapseOnLoad" : [
1332 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1333 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1334 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1335 "\t\tswitch (sym.kind) {",
1336 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1337 "\t \t\t\ttr.expanded = false;",
1340 "\t\t\t\t//tr.expanded = true;",
1352 "xtype" : "NoSelection"
1358 "(n_press, x, y) => {",
1360 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1362 " if (row == null) {",
1363 "\t GLib.debug(\"no row selected items\");",
1366 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1367 " //Lsp.DocumentSymbol",
1368 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1369 " if (sym == null) {",
1375 " \"line\" : 1410,",
1376 " \"character\" : 8",
1379 " \"line\" : 1410,",
1380 " \"character\" : 39",
1384 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1385 " _this.scroll_to_line((int)sym.range.start.line);",
1386 " Gtk.TextIter iter;",
1387 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1388 " \t(int)sym.range.start.line,",
1389 " \t(int)sym.range.start.character",
1391 " _this.buffer.el.place_cursor(iter);",
1396 "xtype" : "GestureClick"
1399 "string name" : "editor-navigation",
1400 "xtype" : "ColumnView",
1401 "| Gtk.Widget? getRowWidgetAt" : [
1402 "(double x, double y, out string pos) {",
1405 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1406 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1407 "\tif (w == null) {",
1411 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1412 "\tif (row == null) {",
1416 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1420 "\t//GLib.debug(\"row number is %d\", rn);",
1421 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1422 "\t// above or belw",
1423 "\tGraphene.Rect bounds;",
1424 "\trow.compute_bounds(this.el, out bounds);",
1425 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1426 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1427 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1429 "\tvar ypos = y - bounds.get_y();",
1430 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1431 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1432 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1433 "\tpos = \"over\";",
1435 "\tif (rpos > 80) {",
1436 "\t\tpos = \"below\";",
1437 "\t} else if (rpos < 20) {",
1438 "\t\tpos = \"above\";",
1443 "| int getRowAt" : [
1444 "(double x, double y, out string pos) {",
1447 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1448 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1449 "\tif (w == null) {",
1453 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1454 "\tif (row == null) {",
1458 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1463 "\twhile (cr.get_prev_sibling() != null) {",
1465 "\t\tcr = cr.get_prev_sibling();",
1468 "\t//GLib.debug(\"row number is %d\", rn);",
1469 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1470 "\t// above or belw",
1471 "\tGraphene.Rect bounds;",
1472 "\trow.compute_bounds(this.el, out bounds);",
1473 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1474 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1475 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1477 "\tvar ypos = y - bounds.get_y();",
1478 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1479 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1480 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1481 "\tpos = \"over\";",
1483 "\tif (rpos > 80) {",
1484 "\t\tpos = \"below\";",
1485 "\t} else if (rpos < 20) {",
1486 "\t\tpos = \"above\";",
1492 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1494 "\tif (!_this.navigation_holder.el.visible) {",
1495 "\t\t_this.navigation_holder.el.show();",
1496 "\t\t_this.paned.el.position = ",
1497 "\t\t\t_this.paned.el.get_width() - 200;",
1499 "\t//_this.navliststore.el.remove_all();",
1502 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1504 "\tforeach(var sym in syms) {",
1505 "\t\tls.append(sym);",
1507 "\t// if syms updated is empty, but we already have one..",
1508 "\tif (_this.navliststore.el.get_n_items() > 0 && ls.get_n_items() < 1) {",
1511 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1512 "\t//_this.navliststore.el.append(sym);",
1513 "\tthis.last_selected_line = -1;",
1514 "\tGLib.Idle.add(() => {",
1515 "\t\t_this.navigationsort.collapseOnLoad();",
1516 "\t\tGtk.TextIter iter;",
1517 "\t\t_this.buffer.el.get_iter_at_offset (",
1518 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1520 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1521 "\t\t\t\titer.get_line_offset());",
1522 "\t\tthis.updateSelectedLine(",
1523 "\t\t\t\t(uint)iter.get_line(),",
1524 "\t\t\t\t(uint)iter.get_line_offset()",
1526 "\t\treturn false;",
1531 "| void updateSelectedLine" : [
1532 "(uint line, uint chr) {",
1533 "\tif (line == this.last_selected_line) {",
1536 "\tGLib.debug(\"select line %d\", (int)line);",
1537 "\tthis.last_selected_line = (int)line;",
1540 "\tvar new_row = -1;",
1541 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1542 "\tif (sym != null) {",
1543 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1544 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1546 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1549 "\tif (this.selected_row != null) { ",
1550 "\t\tGLib.debug(\" remove selected row\");",
1551 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1553 "\tthis.selected_row = null;",
1554 "\tif (new_row > -1) {",
1555 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1556 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1557 "\t\tif (row != null) {",
1558 "\t\t\tGLib.debug(\" Add selected row\");",
1560 "\t\t\trow.add_css_class(\"selected-row\");",
1561 "\t\t\tthis.selected_row = row;",
1565 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1575 "xtype" : "ScrolledWindow"
1585 "| bool saveContents" : [
1589 " if (_this.file == null) {",
1595 " var str = _this.buffer.toString();",
1597 " _this.buffer.checkSyntax();",
1601 " // LeftPanel.model.changed( str , false);",
1602 " _this.dirty = false;",
1603 " _this.save_button.el.sensitive = false;",
1605 " // find the text for the node..",
1606 " if (_this.file.xtype != \"PlainFile\") {",
1607 " // in theory these properties have to exist!?!",
1608 " \tthis.prop.val = str;",
1609 " //this.window.windowstate.left_props.reload();",
1611 " _this.file.setSource( str );",
1614 " // call the signal..",
1622 "(string in_txt) {",
1624 "\tvar s = new GtkSource.SearchSettings();",
1625 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1626 "\ts.regex_enabled = _this.regex.el.active;\t",
1627 "\ts.wrap_around = false;",
1629 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1630 "\tthis.searchcontext.set_highlight(true);",
1631 "\tvar txt = in_txt;",
1633 "\tif (_this.multiline.el.active) {",
1634 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1637 "\ts.set_search_text(txt);",
1638 "\tGtk.TextIter beg, st,en;",
1640 "\tthis.buffer.el.get_start_iter(out beg);",
1641 "\tbool has_wrapped_around;",
1642 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1643 "\tthis.last_search_end = 0;",
1645 "\treturn this.searchcontext.get_occurrences_count();",
1653 "| string tempFileContents" : [
1657 " if (_this.file == null) {",
1660 "\tvar str= this.buffer.toString();",
1661 "\tif (_this.file.xtype == \"PlainFile\") {",
1669 " GLib.debug(\"calling validate\"); ",
1670 " // clear the buttons.",
1671 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1672 "\t\treturn this.file.toSource(); ;",
1675 "\tvar oldcode = _this.prop.val;",
1676 "\t_this.prop.val = str;",
1677 " var ret = _this.file.toSource();",
1678 " _this.prop.val = oldcode;",
1683 "| void backSearch" : [
1684 "(bool change_focus) {",
1686 "\tif (this.searchcontext == null) {",
1690 "\tGtk.TextIter beg, st,en;",
1691 "\tbool has_wrapped_around;",
1692 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1694 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1695 "\t\tthis.last_search_end = 0;",
1697 "\t\tthis.last_search_end = en.get_offset();",
1698 "\t\tif (change_focus) {",
1699 "\t\t\tthis.view.el.grab_focus();",
1701 "\t\tthis.buffer.el.place_cursor(st);",
1702 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1708 "| void forwardSearch" : [
1709 "(bool change_focus) {",
1711 "\tif (this.searchcontext == null) {",
1715 "\tGtk.TextIter beg, st,en;",
1716 "\t bool has_wrapped_around;",
1717 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1718 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1720 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1722 "\t\tif (has_wrapped_around) {",
1726 "\t\tthis.last_search_end = en.get_offset();",
1727 "\t\tif (change_focus) {",
1728 "\t\t\tthis.view.el.grab_focus();",
1730 "\t\tthis.buffer.el.place_cursor(st);",
1731 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1739 "\t this.file = null; ",
1741 " this.node = null;",
1742 " this.prop = null;",
1743 "\tthis.searchcontext = null;",
1748 "| void scroll_to_line" : [
1751 "\tGLib.Timeout.add(500, () => {",
1753 "\t\tvar buf = this.view.el.get_buffer();",
1755 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1758 "\t\tGtk.TextIter iter; ",
1759 "\t\tsbuf.get_iter_at_line(out iter, line);",
1760 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1761 "\t\treturn false;",
1767 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1770 " if (this.file != null) {",
1771 " \tthis.file.navigation_tree_updated.disconnect(",
1772 " \t\t_this.navigation.show",
1775 " this.file = file; ",
1776 " this.file.navigation_tree_updated.connect(",
1777 "\t\t_this.navigation.show",
1779 " if (file.xtype != \"PlainFile\") {",
1780 " \tthis.prop = prop;",
1781 " this.node = node;",
1783 " // find the text for the node..",
1784 " this.view.load( prop.val );",
1785 " this.updateErrorMarks();",
1789 " this.close_btn.el.show(); ",
1792 " this.view.load( file.toSource() );",
1793 " this.updateErrorMarks();",
1794 " this.close_btn.el.hide();",
1795 " var ls = file.getLanguageServer();",
1796 " ls.queueDocumentSymbols(file);",
1797 " ////ls.documentSymbols.begin(file, (a,o) => {",
1798 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1800 " //documentSymbols",
1806 "| void updateErrorMarks" : [
1811 "\tvar buf = _this.buffer.el;",
1812 "\tGtk.TextIter start;",
1813 "\tGtk.TextIter end; ",
1814 "\tbuf.get_bounds (out start, out end);",
1819 "\t//GLib.debug(\"highlight errors\");\t\t ",
1821 "\t // we should highlight other types of errors..",
1823 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1825 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1827 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1833 "\tif (_this.file == null) {",
1834 "\t\tGLib.debug(\"file is null?\");",
1838 "\tvar ar = this.file.getErrors();",
1839 "\tif (ar.size < 1) {",
1840 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1841 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1842 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1843 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1844 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1845 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1846 "\t\tthis.last_error_counter = file.error_counter ;",
1847 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1852 " // basicaly check if there is no change, then we do not do any update..",
1853 " // we can do this by just using an error counter?",
1854 " // if that's changed then we will do an update, otherwise dont bother.",
1857 "\tvar offset = 0;",
1858 "\tvar hoffset = 0;",
1860 "\tvar tlines = buf.get_line_count () +1;",
1862 "\tif (_this.prop != null) {",
1863 "\t\t// this still seems flaky...",
1865 "\t\ttlines = _this.prop.end_line;",
1866 "\t\toffset = _this.prop.start_line;",
1867 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1871 "\t\t// no update...",
1872 "\t\tif (this.last_error_counter == file.error_counter) {",
1878 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1879 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1880 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1881 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1882 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1883 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1885 "\tforeach(var diag in ar) { ",
1886 "\t Gtk.TextIter iter;",
1887 "// print(\"get inter\\n\");",
1888 "\t var eline = (int)diag.range.start.line - offset;",
1889 "\t var eline_to = (int)diag.range.end.line - offset;",
1890 "\t //var eline = diag.range.end_line - offset;",
1891 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1892 "\t //\terr.line ,eline, offset);",
1895 "\t if (eline > tlines || eline < 0) {",
1899 "\t buf.get_iter_at_line( out iter, eline);",
1900 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1901 "\t buf.create_source_mark( msg, diag.category, iter);",
1903 " \t var spos = (int)diag.range.start.character - hoffset;",
1904 " \t if (spos < 0) { spos =0 ; }",
1905 " \t if (spos > iter.get_chars_in_line()) {",
1906 " \t \tspos = iter.get_chars_in_line();",
1908 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1909 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1910 " \t if (epos < 0) { epos =0 ; }",
1911 " \t if (epos > iter.get_chars_in_line()) {",
1912 " \t \tepos = iter.get_chars_in_line();",
1916 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1918 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1920 "\t buf.apply_tag_by_name(diag.category, start, end);",
1922 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1923 "\t //this.marks.set(eline, msg);",
1925 "\tthis.last_error_counter = file.error_counter ;",