2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# GtkSource.SearchContext searchcontext" : "null",
7 "# JsRender.JsRender? file" : "null",
8 "# JsRender.Node node" : "null",
9 "# JsRender.NodeProp? prop" : "null",
10 "# Xcls_MainWindow window" : "null",
11 "# bool dirty" : false,
13 "# int last_error_counter" : 0,
14 "# int pos_root_x" : "",
15 "# int pos_root_y" : "",
16 "# string activeEditor" : "\"\"",
17 "$ homogeneous" : false,
20 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
21 "bool hexpand" : true,
22 "bool vexpand" : true,
23 "int last_search_end" : 0,
27 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
28 "bool shrink_end_child" : false,
29 "int width_request" : 200,
33 "* prop" : "start_child",
34 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
38 "$ homogeneous" : false,
40 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
41 "bool hexpand" : true,
42 "bool vexpand" : false,
46 "bool vexpand" : true,
52 " _this.saveContents();",
61 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
62 "bool hexpand" : true,
65 "int margin_start" : 4,
68 "(Lsp.Hover? help) {",
69 "\tif (help == null || help.contents == null",
70 "\t\t|| help.contents.size < 1) {",
71 "\t\tthis.el.set_text(\"\");",
74 "\tvar sig = help.contents.get(0).value.split(\" \");",
75 "\tstring[] str = {};",
76 "\tfor(var i =0; i < sig.length; i++) {",
78 "\t\tswitch(sig[i]) {",
79 "\t\t\tcase \"public\":",
80 "\t\t\tcase \"private\":",
81 "\t\t\tcase \"protected\":",
82 "\t\t\tcase \"async\":",
83 "\t\t\tcase \"class\":",
89 "\t\t\t\tstr += sig[i];",
95 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
96 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
97 "\t\t\t\t\t+\"</span>\");",
101 "\tif (help.contents.size > 1) {",
102 "\t\tsig += (\"\\n\\n\" + help.contents[1].value);",
105 "\tthis.el.set_markup(string.joinv(\" \",str));",
112 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
115 "\t//this.el.set_range(6,30);",
116 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
117 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
119 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
120 " \t\t//\tGLib.debug(\"update range\");",
121 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
122 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
130 "bool draw_value" : false,
131 "bool has_origin" : true,
132 "bool sensitive" : true,
134 "int width_request" : 200,
138 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
141 " \tBuilderApplication.settings.editor_font_size = val;",
155 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
156 "string icon_name" : "window-close",
163 " _this.saveContents();",
164 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
169 "string icon_name" : "window-close",
177 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
178 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
179 "bool overlay_scrolling" : false,
180 "bool vexpand" : true,
181 "id" : "RightEditor",
184 "# Gtk.CssProvider css" : "null",
185 "$ gboolean auto_indent" : true,
186 "$ xns" : "GtkSource",
193 "this.el.completion.add_provider(",
194 "\tnew Palete.CompletionProvider(_this)",
197 "// hover seems pretty useless.. - ??",
198 "//var hover = this.el.get_hover();",
199 "//hover.add_provider(new Palete.HoverProvider(_this));",
201 "//this.el.completion.unblock_interactive();",
202 "this.el.completion.select_on_show = true; // select",
203 "//this.el.completion.remember_info_visibility\t = true;",
206 "var attrs = new GtkSource.MarkAttributes();",
208 "attrs.set_icon_name ( \"process-stop\"); ",
209 "attrs.query_tooltip_text.connect(( mark) => {",
210 " GLib.debug(\"tooltip query? %s\", mark.name);",
211 " return strdup( mark.name);",
213 " attrs.query_tooltip_markup.connect(( mark) => {",
214 " GLib.debug(\"tooltip query? %s\", mark.name);",
215 " return strdup( mark.name);",
217 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
221 "var wattrs = new GtkSource.MarkAttributes();",
222 "wattrs.set_icon_name ( \"process-stop\"); ",
223 "wattrs.query_tooltip_text.connect(( mark) => {",
224 " GLib.debug(\"tooltip query? %s\", mark.name);",
225 " return strdup(mark.name);",
227 "wattrs.query_tooltip_markup.connect(( mark) => {",
228 " GLib.debug(\"tooltip query? %s\", mark.name);",
229 " return strdup(mark.name);",
231 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
235 "var dattrs = new GtkSource.MarkAttributes();",
237 "dattrs.set_icon_name ( \"process-stop\"); ",
239 "dattrs.query_tooltip_text.connect(( mark) => {",
240 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
241 " return strdup(mark.name);",
243 "//dattrs.query_tooltip_markup.connect(( mark) => {",
244 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
245 " // return strdup(mark.name);",
247 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
250 " this.el.get_space_drawer().set_matrix(null);",
251 " this.el.get_space_drawer().set_types_for_locations( ",
252 "\tGtkSource.SpaceLocationFlags.ALL,",
253 "\tGtkSource.SpaceTypeFlags.ALL",
255 "this.el.get_space_drawer().set_enable_matrix(true);",
259 "bool has_tooltip" : true,
260 "bool hexpand" : true,
261 "bool insert_spaces_instead_of_tabs" : true,
262 "bool vexpand" : true,
263 "boolean show_line_marks" : true,
264 "boolean show_line_numbers" : true,
265 "css_classes" : "{ \"code-editor\" }",
266 "gboolean highlight_current_line" : true,
271 "$ Gee.HashMap<int,string>? xmarks" : "null",
272 "$ xns" : "GtkSource",
273 "$ xtype" : "Buffer",
276 "var buf = this.el;",
277 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
278 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
279 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
280 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
281 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
282 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
283 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
284 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
287 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
288 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
289 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
295 "bool check_queued" : false,
296 "bool enable_undo" : true,
297 "bool highlight_matching_brackets" : true,
298 "bool highlight_syntax" : true,
300 "int error_line" : "-1",
304 " // check syntax??",
306 " _this.save_button.el.sensitive = true;",
307 " print(\"EDITOR CHANGED\");",
308 " this.checkSyntax();",
310 " _this.dirty = true;",
312 " // this.get('/LeftPanel.model').changed( str , false);",
320 "\tGtk.TextIter iter;",
321 "\tthis.el.get_iter_at_offset (",
322 "\t\t\tout iter, this.el.cursor_position);",
324 "\t_this.navigation.updateSelectedLine(",
325 "\t\t\t(uint)iter.get_line(),",
326 "\t\t\t(uint)iter.get_line_offset()",
334 "| bool OLDhighlightErrorsJson" : [
335 "(string type, Json.Object obj) {",
336 "\tGtk.TextIter start;",
337 "\tGtk.TextIter end; ",
338 "\tthis.el.get_bounds (out start, out end);",
340 "\tthis.el.remove_source_marks (start, end, type);",
341 "\tGLib.debug(\"highlight errors\");\t\t ",
343 "\t // we should highlight other types of errors..",
345 "\tif (!obj.has_member(type)) {",
346 "\t\tGLib.debug(\"Return has no errors\\n\");",
350 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
352 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
354 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
359 "\t//this.marks = new Gee.HashMap<int,string>();",
360 "\tvar err = obj.get_object_member(type);",
362 "\tif (_this.file == null) {",
363 "\t\tGLib.debug(\"file is null?\");",
367 "\tvar valafn = _this.file.path;",
369 "\tif (_this.file.xtype != \"PlainFile\") {",
371 "\t\tvalafn = \"\";",
373 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
374 "\t\t\t// should not happen",
375 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
376 "\t\t} catch (GLib.RegexError e) {",
377 "\t\t\treturn true;",
383 "\tif (!err.has_member(valafn)) {",
384 "\t\tGLib.debug(\"File path has no errors\");",
388 "\tvar lines = err.get_object_member(valafn);",
391 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
392 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
396 "\tvar tlines = this.el.get_line_count () +1;",
398 "\tif (_this.prop != null) {",
400 "\t\ttlines = _this.prop.end_line + 1;",
401 "\t\toffset = _this.prop.start_line + 1;",
407 "\tlines.foreach_member((obj, line, node) => {",
409 "\t Gtk.TextIter iter;",
410 "// print(\"get inter\\n\");",
411 "\t var eline = int.parse(line) - offset;",
412 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
415 "\t if (eline > tlines || eline < 0) {",
420 "\t this.el.get_iter_at_line( out iter, eline);",
421 "\t //print(\"mark line\\n\");",
422 "\t var msg = \"\";",
423 "\t var ar = lines.get_array_member(line);",
424 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
425 "\t \tif (ar.get_string_element(i) == \"Success\") {",
428 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
429 "\t\t\tmsg += ar.get_string_element(i);",
431 "\t\tif (msg == \"\") {",
434 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
435 "\t this.el.create_source_mark(msg, type, iter);",
436 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
437 "\t // this.marks.set(eline, msg);",
448 "| bool checkSyntax" : [
452 " var str = this.toString();",
455 " if (this.error_line > 0) {",
456 " Gtk.TextIter start;",
457 " Gtk.TextIter end; ",
458 " this.el.get_bounds (out start, out end);",
460 " this.el.remove_source_marks (start, end, null);",
462 " if (str.length < 1) {",
463 " print(\"checkSyntax - empty string?\\n\");",
467 " // bit presumptiona",
468 " if (_this.file.xtype == \"PlainFile\") {",
470 " // assume it's gtk...",
471 " var oldcode =_this.file.toSource();",
472 " _this.file.setSource(str);",
473 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
474 " \t_this.file.getLanguageServer().document_change(_this.file);",
475 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
476 " _this.file.setSource(oldcode);",
482 " if (_this.file == null) {",
490 " GLib.debug(\"calling validate\"); ",
491 " // clear the buttons.",
492 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
495 "\tvar oldcode = _this.prop.val;",
497 "\t_this.prop.val = str;",
498 "\t_this.node.updated_count++;",
499 " _this.file.getLanguageServer().document_change(_this.file);",
500 " _this.node.updated_count++;",
501 " _this.prop.val = oldcode;",
504 " //print(\"done mark line\\n\");",
506 " return true; // at present allow saving - even if it's invalid..",
510 "| bool highlightErrors" : [
511 "( Gee.HashMap<int,string> validate_res) {",
513 "\tthis.error_line = validate_res.size;",
515 "\tif (this.error_line < 1) {",
518 "\tvar tlines = this.el.get_line_count ();",
519 "\tGtk.TextIter iter;",
520 "\tvar valiter = validate_res.map_iterator();",
521 "\twhile (valiter.next()) {",
523 "\t// print(\"get inter\\n\");",
524 "\t\tvar eline = valiter.get_key();",
525 "\t\tif (eline > tlines) {",
528 "\t\tthis.el.get_iter_at_line( out iter, eline);",
529 "\t\t//print(\"mark line\\n\");",
530 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
535 "| string toString" : [
540 " this.el.get_start_iter(out s);",
541 " this.el.get_end_iter(out e);",
542 " var ret = this.el.get_text(s,e,true);",
543 " //print(\"TO STRING? \" + ret);",
548 "| void showHelp" : [
549 "(Gtk.TextIter iter) {",
550 "\tvar back = iter.copy();",
551 "\tback.backward_char();",
553 "\tvar forward = iter.copy();",
554 "\tforward.forward_char();",
556 "\t// what's the character at the iter?",
557 "\tvar str = back.get_text(iter);",
558 "\tstr += iter.get_text(forward);",
559 "\tif (str.strip().length < 1) {",
562 "\tvar offset = iter.get_line_offset();",
563 "\tvar line = iter.get_line();",
564 "\tif (_this.prop != null) {",
566 "\t\tline += _this.prop.start_line ; ",
567 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
568 "\t\toffset += _this.node.node_pad.length;",
569 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
570 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
571 "\t\t\toffset += 2;",
575 "\tvar ls = _this.file.getLanguageServer();",
577 "\t\t_this.file, line, offset,",
580 "\t\t\t\tvar res = ls.hover.end(o );",
582 "\t\t\t\t_this.helper.setHelp(res);",
583 "\t\t\t} catch (GLib.Error e) {",
594 "# bool is_control" : false,
599 "(keyval, keycode, state) => {",
601 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
602 " \t\tthis.is_control = true;",
609 "(keyval, keycode, state) => {",
611 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
612 " \t\tthis.is_control = false;",
614 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
615 " GLib.debug(\"SAVE: ctrl-S pressed\");",
616 " _this.saveContents();",
620 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
621 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
622 "\t\t_this.forwardSearch(true);",
625 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
626 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
627 "\t\t_this.search_entry.el.grab_focus();",
628 "\t\t_this.search_entry.el.select_region(0,-1);",
631 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
632 "\t\t_this.view.el.show_completion();",
635 "\tGtk.TextIter iter;",
636 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
637 "\tvar line = iter.get_line();",
638 "\tvar offset = iter.get_line_offset();",
639 "\tGLib.debug(\"line %d off %d\", line ,offset);",
640 "\tif (_this.prop != null) {",
641 "\t\tline += _this.prop.start_line + 1; // i think..",
642 "\t\toffset += 12; // should probably be 8 without namespaced ",
643 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
645 " //_this.view.el.show_completion();",
646 " // print(event.key.keyval)",
656 "xtype" : "EventControllerKey"
659 "# double distance" : "0.0f",
661 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
665 "\tif (!_this.keystate.is_control) {",
668 "\t //GLib.debug(\"scroll %f\", dy);",
670 "\tthis.distance += dy;",
672 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
674 "\t if (this.distance < -1) {",
676 "\t\tBuilderApplication.settings.editor_font_size ++;",
677 "\t\tthis.distance = 0;",
679 "\tif (this.distance > 1) {",
680 "\t\tBuilderApplication.settings.editor_font_size --;",
681 "\t\tthis.distance = 0;",
689 "xtype" : "EventControllerScroll"
695 "(n_press, x, y) => {",
696 "\tGtk.TextIter iter;",
697 "\tint buffer_x, buffer_y;",
698 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
700 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
701 "\t\t(int)x - gut.get_width(), (int)y,",
702 " \t\tout buffer_x, out buffer_y);",
703 "\t_this.view.el.get_iter_at_location (out iter, ",
704 "\t\t\tbuffer_x, buffer_y);;",
707 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
708 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
715 "\tvar back = iter.copy();",
716 "\tback.backward_char();",
718 "\tvar forward = iter.copy();",
719 "\tforward.forward_char();",
721 "\t// what's the character at the iter?",
722 "\tvar str = back.get_text(iter);",
723 "\tstr += iter.get_text(forward);",
724 "\tif (str.strip().length < 1) {",
727 "\tvar offset = iter.get_line_offset();",
728 "\tvar line = iter.get_line();",
729 "\tif (_this.prop != null) {",
731 "\t\tline += _this.prop.start_line ; ",
732 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
733 "\t\toffset += _this.node.node_pad.length;",
734 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
735 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
736 "\t\t\toffset += 2;",
740 "\tvar ls = _this.file.getLanguageServer();",
742 "\t\t_this.file, line, offset,",
744 "\t\t\tvar res = ls.hover.end(o );",
745 "\t\t\t_this.helper.setHelp(res);",
754 "xtype" : "GestureClick"
759 "(x, y, keyboard_tooltip, tooltip) => {",
761 "\t//GLib.debug(\"query tooltip\");",
762 "\tGtk.TextIter iter;",
765 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
767 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
769 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
770 "\t//\treturn false;",
773 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
775 "\tvar l = iter.get_line();",
779 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
785 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
786 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
787 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
795 "\t// this crashes?? - not sure why.",
796 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
797 "\tif (marks.is_empty()) {",
798 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
800 "\tif (marks.is_empty()) {",
801 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
804 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
806 "\tmarks.@foreach((m) => { ",
807 "\t\t//GLib.debug(\"got mark %s\", m.name);",
808 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
810 "\t// true if there is a mark..",
811 "\tif (str.length > 0 ) {",
812 "\t\ttooltip.set_text( str );",
814 "\treturn str.length > 0 ? true : false;",
820 "string name" : "editor-view",
821 "uint tab_width" : 4,
826 "// show the help page for the active node..",
827 " //this.get('/Help').show();",
829 " // this.get('/BottomPane').el.set_current_page(0);",
830 " \tGLib.debug(\"load called - Reset undo buffer\");",
832 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
833 " buf.begin_irreversible_action();",
834 " buf.set_text(str, str.length);",
835 " buf.end_irreversible_action();",
837 " var lm = GtkSource.LanguageManager.get_default();",
838 " var lang = \"vala\";",
839 " if (_this.file != null) {",
840 " lang = _this.file.language;",
842 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
843 " var lg = _this.file.content_type.length > 0 ?",
844 " lm.guess_language(_this.file.path, _this.file.content_type) :",
845 " lm.get_language(lang);",
848 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
850 " this.el.insert_spaces_instead_of_tabs = true;",
851 " if (lg != null) {",
852 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
853 "\t\tif (lg.name == \"Vala\") {",
854 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
857 " _this.dirty = false;",
858 " this.el.grab_focus();",
859 " _this.save_button.el.sensitive = false;",
860 " _this.last_error_counter = -1;",
865 "xtype" : "ScrolledWindow"
870 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
871 "bool homogeneous" : false,
872 "bool vexpand" : false,
877 "Gtk.CssProvider css" : "",
878 "bool hexpand" : true,
879 "id" : "search_entry",
885 "(keyval, keycode, state) => {",
887 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
888 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
889 "\t\t_this.forwardSearch(true);",
894 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
895 "\t\t_this.forwardSearch(true);",
901 " // print(event.key.keyval)",
908 "xtype" : "EventControllerKey"
915 "_this.search(_this.search_entry.el.text);",
916 "\t _this.search_results.updateResults();",
918 "\tGLib.Timeout.add_seconds(1,() => {",
919 "\t\t _this.search_results.updateResults();",
920 "\t\t return false;",
926 "string name" : "editor-search-entry",
927 "string placeholder_text" : "Press enter to search",
928 "uint search_delay" : 3,
929 "xtype" : "SearchEntry",
930 "| void forwardSearch" : [
931 "(bool change_focus) {",
934 "\t_this.forwardSearch(change_focus);",
938 "\tswitch(_this.windowstate.state) {",
939 "\t\tcase WindowState.State.CODEONLY:",
940 "\t\t//case WindowState.State.CODE:",
941 "\t\t\t// search the code being edited..",
942 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
945 "\t\tcase WindowState.State.PREVIEW:",
946 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
947 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
949 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
962 "id" : "search_results",
963 "int margin_end" : 4,
964 "int margin_start" : 4,
965 "string label" : "No Results",
967 "| void updateResults" : [
969 "\tthis.el.visible = true;",
971 "\tvar res = _this.searchcontext.get_occurrences_count();",
973 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
977 "\t_this.nextBtn.el.sensitive = false;",
978 "\t_this.backBtn.el.sensitive = false;\t",
981 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
982 "\t\t_this.nextBtn.el.sensitive = true;",
983 "\t\t_this.backBtn.el.sensitive = true;",
986 "\t_this.search_results.el.label = \"No Matches\";",
993 "bool always_show_image" : true,
994 "bool sensitive" : false,
1000 "\t_this.forwardSearch(true);",
1007 "string icon_name" : "go-down",
1012 "bool always_show_image" : true,
1013 "bool sensitive" : false,
1019 "\t_this.backSearch(true);",
1025 "string icon_name" : "go-up",
1030 "bool always_show_arrow" : true,
1031 "bool always_show_image" : true,
1035 "* prop" : "popover",
1036 "id" : "search_settings",
1041 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1048 "\tthis.el.show();",
1052 "id" : "case_sensitive",
1053 "string label" : "Case Sensitive",
1054 "xtype" : "CheckButton"
1060 "\tthis.el.show();",
1065 "string label" : "Regex",
1066 "xtype" : "CheckButton"
1071 "string label" : "Multi-line (add \\n)",
1072 "xtype" : "CheckButton"
1081 "string icon_name" : "emblem-system",
1082 "xtype" : "MenuButton"
1092 "* prop" : "end_child",
1093 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1094 "bool hexpand" : true,
1095 "bool vexpand" : true,
1100 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1106 "bool hexpand" : true,
1107 "bool vexpand" : true,
1108 "bool visible" : false,
1109 "id" : "navigationwindow",
1112 "# int last_selected_line" : "-1",
1113 "$ Gtk.Widget? selected_row" : "null",
1116 "id" : "navigation",
1120 "bool expand" : true,
1124 "* prop" : "factory",
1129 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1131 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1132 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1135 "\tvar hbox = (Gtk.Box) expand.child;",
1138 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1139 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1141 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1142 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1144 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1145 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1147 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1149 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1151 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1152 " \texpand.set_list_row(lr);",
1153 " \t//this.in_bind = true;",
1154 " \t// default is to expand",
1156 " \t//this.in_bind = false;",
1158 " \tsym.bind_property(\"symbol_icon\",",
1159 " img, \"icon_name\",",
1160 " GLib.BindingFlags.SYNC_CREATE);",
1162 " \thbox.css_classes = { sym.symbol_icon };",
1164 " \tsym.bind_property(\"name\",",
1166 " GLib.BindingFlags.SYNC_CREATE);",
1167 " \t// should be better?- --line no?",
1168 " \tsym.bind_property(\"tooltip\",",
1169 " lbl, \"tooltip_markup\",",
1170 " GLib.BindingFlags.SYNC_CREATE);",
1171 " \t// bind image...",
1179 "\tvar expand = new Gtk.TreeExpander();",
1181 "\texpand.set_indent_for_depth(true);",
1182 "\texpand.set_indent_for_icon(true);",
1183 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1184 "\tvar icon = new Gtk.Image();",
1185 "\tvar lbl = new Gtk.Label(\"\");",
1186 "\tlbl.use_markup = true;",
1187 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1189 "\ticon.margin_end = 4;",
1190 " \tlbl.justify = Gtk.Justification.LEFT;",
1191 " \tlbl.xalign = 0;",
1193 "//\tlistitem.activatable = true; ??",
1195 "\thbox.append(icon);",
1196 "\thbox.append(lbl);",
1197 "\texpand.set_child(hbox);",
1198 "\t((Gtk.ListItem)listitem).set_child(expand);",
1204 "xtype" : "SignalListItemFactory"
1207 "string title" : "Code Navigation",
1208 "xtype" : "ColumnViewColumn"
1213 "id" : "navigationselmodel",
1218 "id" : "navigationsort",
1221 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1224 "\treturn ((Lsp.DocumentSymbol)item).children;",
1230 "bool autoexpand" : true,
1231 "bool passthrough" : false,
1234 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1237 "id" : "navliststore",
1238 "xtype" : "ListStore",
1239 "| Lsp.DocumentSymbol? symbolAtLine" : [
1240 "(uint line, uint chr) {",
1243 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1244 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1245 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1246 "\t\t//\tel.name , (int)el.range.start.line,",
1247 "\t\t//\t(int)el.range.end.line",
1249 "\t\tvar ret = el.containsLine(line,chr);",
1250 "\t\tif (ret != null) {",
1251 "\t\t\treturn ret;",
1263 "(position, removed, added) => {",
1264 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1265 "\t if (added < 1) { ",
1268 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1269 "\tvar row = this.el.get_row(position);",
1271 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1278 "xtype" : "TreeListModel"
1282 "* prop" : "sorter",
1286 "* prop" : "sorter",
1289 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1291 "* prop" : "expression",
1292 "string property_name" : "sort_key",
1293 "xtype" : "PropertyExpression"
1296 "xtype" : "StringSorter"
1299 "xtype" : "TreeListRowSorter"
1302 "xtype" : "SortListModel",
1303 "| Lsp.DocumentSymbol? getSymbolAt" : [
1306 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1308 " var a = tr.get_item();; ",
1309 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1312 " return (Lsp.DocumentSymbol)tr.get_item();",
1316 "| int getRowFromSymbol" : [
1317 "(Lsp.DocumentSymbol sym) {",
1319 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1320 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1322 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1329 "| void collapseOnLoad" : [
1331 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1332 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1333 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1334 "\t\tswitch (sym.kind) {",
1335 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1336 "\t \t\t\ttr.expanded = false;",
1339 "\t\t\t\t//tr.expanded = true;",
1351 "xtype" : "NoSelection"
1357 "(n_press, x, y) => {",
1359 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1361 " if (row == null) {",
1362 "\t GLib.debug(\"no row selected items\");",
1365 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1366 " //Lsp.DocumentSymbol",
1367 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1368 " if (sym == null) {",
1374 " \"line\" : 1410,",
1375 " \"character\" : 8",
1378 " \"line\" : 1410,",
1379 " \"character\" : 39",
1383 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1384 " _this.scroll_to_line((int)sym.range.start.line);",
1385 " Gtk.TextIter iter;",
1386 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1387 " \t(int)sym.range.start.line,",
1388 " \t(int)sym.range.start.character",
1390 " _this.buffer.el.place_cursor(iter);",
1395 "xtype" : "GestureClick"
1398 "string name" : "editor-navigation",
1399 "xtype" : "ColumnView",
1400 "| Gtk.Widget? getRowWidgetAt" : [
1401 "(double x, double y, out string pos) {",
1404 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1405 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1406 "\tif (w == null) {",
1410 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1411 "\tif (row == null) {",
1415 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1419 "\t//GLib.debug(\"row number is %d\", rn);",
1420 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1421 "\t// above or belw",
1422 "\tGraphene.Rect bounds;",
1423 "\trow.compute_bounds(this.el, out bounds);",
1424 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1425 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1426 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1428 "\tvar ypos = y - bounds.get_y();",
1429 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1430 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1431 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1432 "\tpos = \"over\";",
1434 "\tif (rpos > 80) {",
1435 "\t\tpos = \"below\";",
1436 "\t} else if (rpos < 20) {",
1437 "\t\tpos = \"above\";",
1442 "| int getRowAt" : [
1443 "(double x, double y, out string pos) {",
1446 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1447 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1448 "\tif (w == null) {",
1452 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1453 "\tif (row == null) {",
1457 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1462 "\twhile (cr.get_prev_sibling() != null) {",
1464 "\t\tcr = cr.get_prev_sibling();",
1467 "\t//GLib.debug(\"row number is %d\", rn);",
1468 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1469 "\t// above or belw",
1470 "\tGraphene.Rect bounds;",
1471 "\trow.compute_bounds(this.el, out bounds);",
1472 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1473 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1474 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1476 "\tvar ypos = y - bounds.get_y();",
1477 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1478 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1479 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1480 "\tpos = \"over\";",
1482 "\tif (rpos > 80) {",
1483 "\t\tpos = \"below\";",
1484 "\t} else if (rpos < 20) {",
1485 "\t\tpos = \"above\";",
1491 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1492 "\t_this.navigationwindow.el.show();",
1493 "\t//_this.navliststore.el.remove_all();",
1496 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1498 "\tforeach(var sym in syms) {",
1499 "\t\tls.append(sym);",
1501 "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
1502 "\t//_this.navliststore.el.append(sym);",
1503 "\tthis.last_selected_line = -1;",
1504 "\tGLib.Idle.add(() => {",
1505 "\t\t_this.navigationsort.collapseOnLoad();",
1506 "\t\tGtk.TextIter iter;",
1507 "\t\t_this.buffer.el.get_iter_at_offset (",
1508 "\t\t\t\tout iter, _this.buffer.el.cursor_position);",
1510 "\t\tGLib.debug(\"idle update scroll %d, %d\", iter.get_line(),",
1511 "\t\t\t\titer.get_line_offset());",
1512 "\t\tthis.updateSelectedLine(",
1513 "\t\t\t\t(uint)iter.get_line(),",
1514 "\t\t\t\t(uint)iter.get_line_offset()",
1516 "\t\treturn false;",
1521 "| void updateSelectedLine" : [
1522 "(uint line, uint chr) {",
1523 "\tif (line == this.last_selected_line) {",
1526 "\tGLib.debug(\"select line %d\", (int)line);",
1527 "\tthis.last_selected_line = (int)line;",
1530 "\tvar new_row = -1;",
1531 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1532 "\tif (sym != null) {",
1533 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1534 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1536 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1539 "\tif (this.selected_row != null) { ",
1540 "\t\tGLib.debug(\" remove selected row\");",
1541 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1543 "\tthis.selected_row = null;",
1544 "\tif (new_row > -1) {",
1545 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1546 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1547 "\t\tif (row != null) {",
1548 "\t\t\tGLib.debug(\" Add selected row\");",
1550 "\t\t\trow.add_css_class(\"selected-row\");",
1551 "\t\t\tthis.selected_row = row;",
1555 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1565 "xtype" : "ScrolledWindow"
1575 "| bool saveContents" : [
1579 " if (_this.file == null) {",
1585 " var str = _this.buffer.toString();",
1587 " _this.buffer.checkSyntax();",
1591 " // LeftPanel.model.changed( str , false);",
1592 " _this.dirty = false;",
1593 " _this.save_button.el.sensitive = false;",
1595 " // find the text for the node..",
1596 " if (_this.file.xtype != \"PlainFile\") {",
1597 " // in theory these properties have to exist!?!",
1598 " \tthis.prop.val = str;",
1599 " //this.window.windowstate.left_props.reload();",
1601 " _this.file.setSource( str );",
1604 " // call the signal..",
1612 "(string in_txt) {",
1614 "\tvar s = new GtkSource.SearchSettings();",
1615 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1616 "\ts.regex_enabled = _this.regex.el.active;\t",
1617 "\ts.wrap_around = false;",
1619 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1620 "\tthis.searchcontext.set_highlight(true);",
1621 "\tvar txt = in_txt;",
1623 "\tif (_this.multiline.el.active) {",
1624 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1627 "\ts.set_search_text(txt);",
1628 "\tGtk.TextIter beg, st,en;",
1630 "\tthis.buffer.el.get_start_iter(out beg);",
1631 "\tbool has_wrapped_around;",
1632 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1633 "\tthis.last_search_end = 0;",
1635 "\treturn this.searchcontext.get_occurrences_count();",
1643 "| string tempFileContents" : [
1647 " if (_this.file == null) {",
1650 "\tvar str= this.buffer.toString();",
1651 "\tif (_this.file.xtype == \"PlainFile\") {",
1659 " GLib.debug(\"calling validate\"); ",
1660 " // clear the buttons.",
1661 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1662 "\t\treturn this.file.toSource(); ;",
1665 "\tvar oldcode = _this.prop.val;",
1666 "\t_this.prop.val = str;",
1667 " var ret = _this.file.toSource();",
1668 " _this.prop.val = oldcode;",
1673 "| void backSearch" : [
1674 "(bool change_focus) {",
1676 "\tif (this.searchcontext == null) {",
1680 "\tGtk.TextIter beg, st,en;",
1681 "\tbool has_wrapped_around;",
1682 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1684 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1685 "\t\tthis.last_search_end = 0;",
1687 "\t\tthis.last_search_end = en.get_offset();",
1688 "\t\tif (change_focus) {",
1689 "\t\t\tthis.view.el.grab_focus();",
1691 "\t\tthis.buffer.el.place_cursor(st);",
1692 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1698 "| void forwardSearch" : [
1699 "(bool change_focus) {",
1701 "\tif (this.searchcontext == null) {",
1705 "\tGtk.TextIter beg, st,en;",
1706 "\t bool has_wrapped_around;",
1707 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1708 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1710 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1712 "\t\tif (has_wrapped_around) {",
1716 "\t\tthis.last_search_end = en.get_offset();",
1717 "\t\tif (change_focus) {",
1718 "\t\t\tthis.view.el.grab_focus();",
1720 "\t\tthis.buffer.el.place_cursor(st);",
1721 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1729 "\t this.file = null; ",
1731 " this.node = null;",
1732 " this.prop = null;",
1733 "\tthis.searchcontext = null;",
1738 "| void scroll_to_line" : [
1741 "\tGLib.Timeout.add(500, () => {",
1743 "\t\tvar buf = this.view.el.get_buffer();",
1745 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1748 "\t\tGtk.TextIter iter; ",
1749 "\t\tsbuf.get_iter_at_line(out iter, line);",
1750 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1751 "\t\treturn false;",
1757 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1760 " if (this.file != null) {",
1761 " \tthis.file.navigation_tree_updated.disconnect(",
1762 " \t\t_this.navigation.show",
1765 " this.file = file; ",
1766 " this.file.navigation_tree_updated.connect(",
1767 "\t\t_this.navigation.show",
1769 " if (file.xtype != \"PlainFile\") {",
1770 " \tthis.prop = prop;",
1771 " this.node = node;",
1773 " // find the text for the node..",
1774 " this.view.load( prop.val );",
1775 " this.updateErrorMarks();",
1779 " this.close_btn.el.show(); ",
1782 " this.view.load( file.toSource() );",
1783 " this.updateErrorMarks();",
1784 " this.close_btn.el.hide();",
1785 " var ls = file.getLanguageServer();",
1786 " ls.queueDocumentSymbols(file);",
1787 " ////ls.documentSymbols.begin(file, (a,o) => {",
1788 " //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
1790 " //documentSymbols",
1796 "| void updateErrorMarks" : [
1801 "\tvar buf = _this.buffer.el;",
1802 "\tGtk.TextIter start;",
1803 "\tGtk.TextIter end; ",
1804 "\tbuf.get_bounds (out start, out end);",
1809 "\t//GLib.debug(\"highlight errors\");\t\t ",
1811 "\t // we should highlight other types of errors..",
1813 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1815 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1817 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1823 "\tif (_this.file == null) {",
1824 "\t\tGLib.debug(\"file is null?\");",
1828 "\tvar ar = this.file.getErrors();",
1829 "\tif (ar.size < 1) {",
1830 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1831 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1832 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1833 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1834 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1835 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1836 "\t\tthis.last_error_counter = file.error_counter ;",
1837 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1842 " // basicaly check if there is no change, then we do not do any update..",
1843 " // we can do this by just using an error counter?",
1844 " // if that's changed then we will do an update, otherwise dont bother.",
1847 "\tvar offset = 0;",
1848 "\tvar hoffset = 0;",
1850 "\tvar tlines = buf.get_line_count () +1;",
1852 "\tif (_this.prop != null) {",
1853 "\t\t// this still seems flaky...",
1855 "\t\ttlines = _this.prop.end_line;",
1856 "\t\toffset = _this.prop.start_line;",
1857 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1861 "\t\t// no update...",
1862 "\t\tif (this.last_error_counter == file.error_counter) {",
1868 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1869 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1870 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1871 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1872 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1873 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1875 "\tforeach(var diag in ar) { ",
1876 "\t Gtk.TextIter iter;",
1877 "// print(\"get inter\\n\");",
1878 "\t var eline = (int)diag.range.start.line - offset;",
1879 "\t var eline_to = (int)diag.range.end.line - offset;",
1880 "\t //var eline = diag.range.end_line - offset;",
1881 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1882 "\t //\terr.line ,eline, offset);",
1885 "\t if (eline > tlines || eline < 0) {",
1889 "\t buf.get_iter_at_line( out iter, eline);",
1890 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1891 "\t buf.create_source_mark( msg, diag.category, iter);",
1893 " \t var spos = (int)diag.range.start.character - hoffset;",
1894 " \t if (spos < 0) { spos =0 ; }",
1895 " \t if (spos > iter.get_chars_in_line()) {",
1896 " \t \tspos = iter.get_chars_in_line();",
1898 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1899 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1900 " \t if (epos < 0) { epos =0 ; }",
1901 " \t if (epos > iter.get_chars_in_line()) {",
1902 " \t \tepos = iter.get_chars_in_line();",
1906 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1908 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1910 "\t buf.apply_tag_by_name(diag.category, start, end);",
1912 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1913 "\t //this.marks.set(eline, msg);",
1915 "\tthis.last_error_counter = file.error_counter ;",