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,
76 "(n_press, x, y) => {",
78 "\t_this.helper.el.get_layout().xy_to_index(x,y, out ix, out tr);",
79 "\tGLib.debug(\"label click %d\", ix);",
84 "xtype" : "GestureClick"
89 "(x, y, keyboard_tooltip, tooltip) => {",
90 "\tGLib.debug(\"using quiery tooltip?\");",
91 "\tvar lbl = new Gtk.Label(this.el.tooltip_markup);",
92 "\tlbl.width_request = 500;",
93 "\ttooltip.set_custom(lbl);",
102 "(Lsp.Hover? help) {",
103 "\tif (help == null || help.contents == null",
104 "\t\t|| help.contents.size < 1) {",
105 "\t\tthis.el.set_text(\"\");",
108 "\tvar sig = help.contents.get(0).value.split(\" \");",
109 "\tstring[] str = {};",
110 "\tfor(var i =0; i < sig.length; i++) {",
112 "\t\tswitch(sig[i]) {",
113 "\t\t\tcase \"public\":",
114 "\t\t\tcase \"private\":",
115 "\t\t\tcase \"protected\":",
116 "\t\t\tcase \"async\":",
117 "\t\t\tcase \"class\":",
123 "\t\t\t\tstr += sig[i];",
129 "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
130 "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
131 "\t\t\t\t\t+\"</span>\");",
135 "\tif (help.contents.size > 1) {",
136 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value);",
138 "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(0).value);",
140 "\tthis.el.set_markup(string.joinv(\" \",str));",
147 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
150 "\t//this.el.set_range(6,30);",
151 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
152 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
154 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
155 " \t\t//\tGLib.debug(\"update range\");",
156 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
157 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
165 "Gtk.Align halign" : "Gtk.Align.END",
166 "bool draw_value" : false,
167 "bool has_origin" : true,
168 "bool sensitive" : true,
170 "int width_request" : 150,
174 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
177 " \tBuilderApplication.settings.editor_font_size = val;",
186 "Gtk.Align halign" : "Gtk.Align.END",
192 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
193 "string icon_name" : "window-close",
200 " _this.saveContents();",
201 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
206 "string icon_name" : "window-close",
214 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
215 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
216 "bool overlay_scrolling" : false,
217 "bool vexpand" : true,
218 "id" : "RightEditor",
221 "# Gtk.CssProvider css" : "null",
222 "$ gboolean auto_indent" : true,
223 "$ xns" : "GtkSource",
230 "this.el.completion.add_provider(",
231 "\tnew Palete.CompletionProvider(_this)",
234 "// hover seems pretty useless.. - ??",
235 "//var hover = this.el.get_hover();",
236 "//hover.add_provider(new Palete.HoverProvider(_this));",
238 "//this.el.completion.unblock_interactive();",
239 "this.el.completion.select_on_show = true; // select",
240 "//this.el.completion.remember_info_visibility\t = true;",
243 "var attrs = new GtkSource.MarkAttributes();",
245 "attrs.set_icon_name ( \"process-stop\"); ",
246 "attrs.query_tooltip_text.connect(( mark) => {",
247 " GLib.debug(\"tooltip query? %s\", mark.name);",
248 " return strdup( mark.name);",
250 " attrs.query_tooltip_markup.connect(( mark) => {",
251 " GLib.debug(\"tooltip query? %s\", mark.name);",
252 " return strdup( mark.name);",
254 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
258 "var wattrs = new GtkSource.MarkAttributes();",
259 "wattrs.set_icon_name ( \"process-stop\"); ",
260 "wattrs.query_tooltip_text.connect(( mark) => {",
261 " GLib.debug(\"tooltip query? %s\", mark.name);",
262 " return strdup(mark.name);",
264 "wattrs.query_tooltip_markup.connect(( mark) => {",
265 " GLib.debug(\"tooltip query? %s\", mark.name);",
266 " return strdup(mark.name);",
268 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
272 "var dattrs = new GtkSource.MarkAttributes();",
274 "dattrs.set_icon_name ( \"process-stop\"); ",
276 "dattrs.query_tooltip_text.connect(( mark) => {",
277 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
278 " return strdup(mark.name);",
280 "//dattrs.query_tooltip_markup.connect(( mark) => {",
281 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
282 " // return strdup(mark.name);",
284 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
287 " this.el.get_space_drawer().set_matrix(null);",
288 " this.el.get_space_drawer().set_types_for_locations( ",
289 "\tGtkSource.SpaceLocationFlags.ALL,",
290 "\tGtkSource.SpaceTypeFlags.ALL",
292 "this.el.get_space_drawer().set_enable_matrix(true);",
296 "bool has_tooltip" : true,
297 "bool hexpand" : true,
298 "bool insert_spaces_instead_of_tabs" : true,
299 "bool vexpand" : true,
300 "boolean show_line_marks" : true,
301 "boolean show_line_numbers" : true,
302 "css_classes" : "{ \"code-editor\" }",
303 "gboolean highlight_current_line" : true,
308 "$ Gee.HashMap<int,string>? xmarks" : "null",
309 "$ xns" : "GtkSource",
310 "$ xtype" : "Buffer",
313 "var buf = this.el;",
314 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
315 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
316 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
317 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
318 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
319 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
320 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
321 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
324 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
325 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
326 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
332 "bool check_queued" : false,
333 "bool enable_undo" : true,
334 "bool highlight_matching_brackets" : true,
335 "bool highlight_syntax" : true,
337 "int error_line" : "-1",
341 " // check syntax??",
343 " _this.save_button.el.sensitive = true;",
344 " print(\"EDITOR CHANGED\");",
345 " this.checkSyntax();",
347 " _this.dirty = true;",
349 " // this.get('/LeftPanel.model').changed( str , false);",
357 "\tGtk.TextIter iter;",
358 "\tthis.el.get_iter_at_offset (",
359 "\t\t\tout iter, this.el.cursor_position);",
361 "\t_this.navigation.updateSelectedLine(",
362 "\t\t\t(uint)iter.get_line(),",
363 "\t\t\t(uint)iter.get_line_offset()",
365 "\tthis.showHelp(iter);",
371 "| bool OLDhighlightErrorsJson" : [
372 "(string type, Json.Object obj) {",
373 "\tGtk.TextIter start;",
374 "\tGtk.TextIter end; ",
375 "\tthis.el.get_bounds (out start, out end);",
377 "\tthis.el.remove_source_marks (start, end, type);",
378 "\tGLib.debug(\"highlight errors\");\t\t ",
380 "\t // we should highlight other types of errors..",
382 "\tif (!obj.has_member(type)) {",
383 "\t\tGLib.debug(\"Return has no errors\\n\");",
387 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
389 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
391 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
396 "\t//this.marks = new Gee.HashMap<int,string>();",
397 "\tvar err = obj.get_object_member(type);",
399 "\tif (_this.file == null) {",
400 "\t\tGLib.debug(\"file is null?\");",
404 "\tvar valafn = _this.file.path;",
406 "\tif (_this.file.xtype != \"PlainFile\") {",
408 "\t\tvalafn = \"\";",
410 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
411 "\t\t\t// should not happen",
412 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
413 "\t\t} catch (GLib.RegexError e) {",
414 "\t\t\treturn true;",
420 "\tif (!err.has_member(valafn)) {",
421 "\t\tGLib.debug(\"File path has no errors\");",
425 "\tvar lines = err.get_object_member(valafn);",
428 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
429 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
433 "\tvar tlines = this.el.get_line_count () +1;",
435 "\tif (_this.prop != null) {",
437 "\t\ttlines = _this.prop.end_line + 1;",
438 "\t\toffset = _this.prop.start_line + 1;",
444 "\tlines.foreach_member((obj, line, node) => {",
446 "\t Gtk.TextIter iter;",
447 "// print(\"get inter\\n\");",
448 "\t var eline = int.parse(line) - offset;",
449 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
452 "\t if (eline > tlines || eline < 0) {",
457 "\t this.el.get_iter_at_line( out iter, eline);",
458 "\t //print(\"mark line\\n\");",
459 "\t var msg = \"\";",
460 "\t var ar = lines.get_array_member(line);",
461 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
462 "\t \tif (ar.get_string_element(i) == \"Success\") {",
465 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
466 "\t\t\tmsg += ar.get_string_element(i);",
468 "\t\tif (msg == \"\") {",
471 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
472 "\t this.el.create_source_mark(msg, type, iter);",
473 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
474 "\t // this.marks.set(eline, msg);",
485 "| bool checkSyntax" : [
489 " var str = this.toString();",
492 " if (this.error_line > 0) {",
493 " Gtk.TextIter start;",
494 " Gtk.TextIter end; ",
495 " this.el.get_bounds (out start, out end);",
497 " this.el.remove_source_marks (start, end, null);",
499 " if (str.length < 1) {",
500 " print(\"checkSyntax - empty string?\\n\");",
504 " // bit presumptiona",
505 " if (_this.file.xtype == \"PlainFile\") {",
507 " // assume it's gtk...",
508 " var oldcode =_this.file.toSource();",
509 " _this.file.setSource(str);",
510 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
511 " \t_this.file.getLanguageServer().document_change(_this.file);",
512 "\t\t_this.file.getLanguageServer().queueDocumentSymbols(_this.file);",
513 " _this.file.setSource(oldcode);",
519 " if (_this.file == null) {",
527 " GLib.debug(\"calling validate\"); ",
528 " // clear the buttons.",
529 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
532 "\tvar oldcode = _this.prop.val;",
534 "\t_this.prop.val = str;",
535 "\t_this.node.updated_count++;",
536 " _this.file.getLanguageServer().document_change(_this.file);",
537 " _this.node.updated_count++;",
538 " _this.prop.val = oldcode;",
541 " //print(\"done mark line\\n\");",
543 " return true; // at present allow saving - even if it's invalid..",
547 "| bool highlightErrors" : [
548 "( Gee.HashMap<int,string> validate_res) {",
550 "\tthis.error_line = validate_res.size;",
552 "\tif (this.error_line < 1) {",
555 "\tvar tlines = this.el.get_line_count ();",
556 "\tGtk.TextIter iter;",
557 "\tvar valiter = validate_res.map_iterator();",
558 "\twhile (valiter.next()) {",
560 "\t// print(\"get inter\\n\");",
561 "\t\tvar eline = valiter.get_key();",
562 "\t\tif (eline > tlines) {",
565 "\t\tthis.el.get_iter_at_line( out iter, eline);",
566 "\t\t//print(\"mark line\\n\");",
567 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
572 "| string toString" : [
577 " this.el.get_start_iter(out s);",
578 " this.el.get_end_iter(out e);",
579 " var ret = this.el.get_text(s,e,true);",
580 " //print(\"TO STRING? \" + ret);",
585 "| void showHelp" : [
586 "(Gtk.TextIter iter) {",
587 "\tvar back = iter.copy();",
588 "\tback.backward_char();",
590 "\tvar forward = iter.copy();",
591 "\tforward.forward_char();",
593 "\t// what's the character at the iter?",
594 "\tvar str = back.get_text(iter);",
595 "\tstr += iter.get_text(forward);",
596 "\tif (str.strip().length < 1) {",
599 "\tvar offset = iter.get_line_offset();",
600 "\tvar line = iter.get_line();",
601 "\tif (_this.prop != null) {",
603 "\t\tline += _this.prop.start_line ; ",
604 "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);",
605 "\t\toffset += _this.node.node_pad.length;",
606 "\t\t\t\t\t// javascript listeners are indented 2 more spaces.",
607 "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
608 "\t\t\toffset += 2;",
612 "\tvar ls = _this.file.getLanguageServer();",
614 "\t\t_this.file, line, offset,",
617 "\t\t\t\tvar res = ls.hover.end(o );",
619 "\t\t\t\t_this.helper.setHelp(res);",
620 "\t\t\t} catch (GLib.Error e) {",
630 "# bool is_control" : false,
635 "(keyval, keycode, state) => {",
637 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
638 " \t\tthis.is_control = true;",
645 "(keyval, keycode, state) => {",
647 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
648 " \t\tthis.is_control = false;",
650 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
651 " GLib.debug(\"SAVE: ctrl-S pressed\");",
652 " _this.saveContents();",
656 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
657 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
658 "\t\t_this.forwardSearch(true);",
661 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
662 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
663 "\t\t_this.search_entry.el.grab_focus();",
664 "\t\t_this.search_entry.el.select_region(0,-1);",
667 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
668 "\t\t_this.view.el.show_completion();",
671 "\tGtk.TextIter iter;",
672 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
673 "\tvar line = iter.get_line();",
674 "\tvar offset = iter.get_line_offset();",
675 "\tGLib.debug(\"line %d off %d\", line ,offset);",
676 "\tif (_this.prop != null) {",
677 "\t\tline += _this.prop.start_line + 1; // i think..",
678 "\t\toffset += 12; // should probably be 8 without namespaced ",
679 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
681 " //_this.view.el.show_completion();",
682 " // print(event.key.keyval)",
692 "xtype" : "EventControllerKey"
695 "# double distance" : "0.0f",
697 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
701 "\tif (!_this.keystate.is_control) {",
704 "\t //GLib.debug(\"scroll %f\", dy);",
706 "\tthis.distance += dy;",
708 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
710 "\t if (this.distance < -1) {",
712 "\t\tBuilderApplication.settings.editor_font_size ++;",
713 "\t\tthis.distance = 0;",
715 "\tif (this.distance > 1) {",
716 "\t\tBuilderApplication.settings.editor_font_size --;",
717 "\t\tthis.distance = 0;",
725 "xtype" : "EventControllerScroll"
731 "(n_press, x, y) => {",
732 "\tGtk.TextIter iter;",
733 "\tint buffer_x, buffer_y;",
734 "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
736 "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
737 "\t\t(int)x - gut.get_width(), (int)y,",
738 " \t\tout buffer_x, out buffer_y);",
739 "\t_this.view.el.get_iter_at_location (out iter, ",
740 "\t\t\tbuffer_x, buffer_y);;",
743 "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
744 "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
748 "\t_this.buffer.showHelp(iter);",
756 "xtype" : "GestureClick"
761 "(x, y, keyboard_tooltip, tooltip) => {",
763 "\t//GLib.debug(\"query tooltip\");",
764 "\tGtk.TextIter iter;",
767 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
769 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
771 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
772 "\t//\treturn false;",
775 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
777 "\tvar l = iter.get_line();",
781 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
787 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
788 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
789 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
797 "\t// this crashes?? - not sure why.",
798 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
799 "\tif (marks.is_empty()) {",
800 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
802 "\tif (marks.is_empty()) {",
803 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
806 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
808 "\tmarks.@foreach((m) => { ",
809 "\t\t//GLib.debug(\"got mark %s\", m.name);",
810 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
812 "\t// true if there is a mark..",
813 "\tif (str.length > 0 ) {",
814 "\t\ttooltip.set_text( str );",
816 "\treturn str.length > 0 ? true : false;",
822 "string name" : "editor-view",
823 "uint tab_width" : 4,
828 "// show the help page for the active node..",
829 " //this.get('/Help').show();",
831 " // this.get('/BottomPane').el.set_current_page(0);",
832 " \tGLib.debug(\"load called - Reset undo buffer\");",
834 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
835 " buf.begin_irreversible_action();",
836 " buf.set_text(str, str.length);",
837 " buf.end_irreversible_action();",
839 " var lm = GtkSource.LanguageManager.get_default();",
840 " var lang = \"vala\";",
841 " if (_this.file != null) {",
842 " lang = _this.file.language;",
844 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
845 " var lg = _this.file.content_type.length > 0 ?",
846 " lm.guess_language(_this.file.path, _this.file.content_type) :",
847 " lm.get_language(lang);",
850 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
852 " this.el.insert_spaces_instead_of_tabs = true;",
853 " if (lg != null) {",
854 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
855 "\t\tif (lg.name == \"Vala\") {",
856 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
859 " _this.dirty = false;",
860 " this.el.grab_focus();",
861 " _this.save_button.el.sensitive = false;",
862 " _this.last_error_counter = -1;",
867 "xtype" : "ScrolledWindow"
872 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
873 "bool homogeneous" : false,
874 "bool vexpand" : false,
879 "Gtk.CssProvider css" : "",
880 "bool hexpand" : true,
881 "id" : "search_entry",
887 "(keyval, keycode, state) => {",
889 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
890 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
891 "\t\t_this.forwardSearch(true);",
896 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
897 "\t\t_this.forwardSearch(true);",
903 " // print(event.key.keyval)",
910 "xtype" : "EventControllerKey"
917 "_this.search(_this.search_entry.el.text);",
918 "\t _this.search_results.updateResults();",
920 "\tGLib.Timeout.add_seconds(1,() => {",
921 "\t\t _this.search_results.updateResults();",
922 "\t\t return false;",
928 "string name" : "editor-search-entry",
929 "string placeholder_text" : "Press enter to search",
930 "uint search_delay" : 3,
931 "xtype" : "SearchEntry",
932 "| void forwardSearch" : [
933 "(bool change_focus) {",
936 "\t_this.forwardSearch(change_focus);",
940 "\tswitch(_this.windowstate.state) {",
941 "\t\tcase WindowState.State.CODEONLY:",
942 "\t\t//case WindowState.State.CODE:",
943 "\t\t\t// search the code being edited..",
944 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
947 "\t\tcase WindowState.State.PREVIEW:",
948 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
949 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
951 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
964 "id" : "search_results",
965 "int margin_end" : 4,
966 "int margin_start" : 4,
967 "string label" : "No Results",
969 "| void updateResults" : [
971 "\tthis.el.visible = true;",
973 "\tvar res = _this.searchcontext.get_occurrences_count();",
975 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
979 "\t_this.nextBtn.el.sensitive = false;",
980 "\t_this.backBtn.el.sensitive = false;\t",
983 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
984 "\t\t_this.nextBtn.el.sensitive = true;",
985 "\t\t_this.backBtn.el.sensitive = true;",
988 "\t_this.search_results.el.label = \"No Matches\";",
995 "bool always_show_image" : true,
996 "bool sensitive" : false,
1002 "\t_this.forwardSearch(true);",
1009 "string icon_name" : "go-down",
1014 "bool always_show_image" : true,
1015 "bool sensitive" : false,
1021 "\t_this.backSearch(true);",
1027 "string icon_name" : "go-up",
1032 "bool always_show_arrow" : true,
1033 "bool always_show_image" : true,
1037 "* prop" : "popover",
1038 "id" : "search_settings",
1043 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1050 "\tthis.el.show();",
1054 "id" : "case_sensitive",
1055 "string label" : "Case Sensitive",
1056 "xtype" : "CheckButton"
1062 "\tthis.el.show();",
1067 "string label" : "Regex",
1068 "xtype" : "CheckButton"
1073 "string label" : "Multi-line (add \\n)",
1074 "xtype" : "CheckButton"
1083 "string icon_name" : "emblem-system",
1084 "xtype" : "MenuButton"
1094 "* prop" : "end_child",
1095 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1096 "bool hexpand" : true,
1097 "bool vexpand" : true,
1098 "bool visible" : false,
1099 "id" : "navigation_holder",
1101 "int width_request" : 120,
1105 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
1111 "bool hexpand" : true,
1112 "bool vexpand" : true,
1113 "bool visible" : true,
1114 "id" : "navigationwindow",
1117 "# int last_selected_line" : "-1",
1118 "$ Gtk.Widget? selected_row" : "null",
1121 "id" : "navigation",
1125 "bool expand" : true,
1129 "* prop" : "factory",
1134 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
1136 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1137 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
1140 "\tvar hbox = (Gtk.Box) expand.child;",
1143 "\tvar img = (Gtk.Image) hbox.get_first_child();",
1144 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
1146 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
1147 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
1149 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
1150 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
1152 "\t//GLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
1154 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
1156 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
1157 " \texpand.set_list_row(lr);",
1158 " \t//this.in_bind = true;",
1159 " \t// default is to expand",
1161 " \t//this.in_bind = false;",
1163 " \tsym.bind_property(\"symbol_icon\",",
1164 " img, \"icon_name\",",
1165 " GLib.BindingFlags.SYNC_CREATE);",
1167 " \thbox.css_classes = { sym.symbol_icon };",
1169 " \tsym.bind_property(\"name\",",
1171 " GLib.BindingFlags.SYNC_CREATE);",
1172 " \t// should be better?- --line no?",
1173 " \tsym.bind_property(\"tooltip\",",
1174 " lbl, \"tooltip_markup\",",
1175 " GLib.BindingFlags.SYNC_CREATE);",
1176 " \t// bind image...",
1184 "\tvar expand = new Gtk.TreeExpander();",
1186 "\texpand.set_indent_for_depth(true);",
1187 "\texpand.set_indent_for_icon(true);",
1188 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1189 "\tvar icon = new Gtk.Image();",
1190 "\tvar lbl = new Gtk.Label(\"\");",
1191 "\tlbl.use_markup = true;",
1192 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1194 "\ticon.margin_end = 4;",
1195 " \tlbl.justify = Gtk.Justification.LEFT;",
1196 " \tlbl.xalign = 0;",
1198 "//\tlistitem.activatable = true; ??",
1200 "\thbox.append(icon);",
1201 "\thbox.append(lbl);",
1202 "\texpand.set_child(hbox);",
1203 "\t((Gtk.ListItem)listitem).set_child(expand);",
1209 "xtype" : "SignalListItemFactory"
1212 "string title" : "Code Navigation",
1213 "xtype" : "ColumnViewColumn"
1218 "id" : "navigationselmodel",
1223 "id" : "navigationsort",
1226 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1229 "\treturn ((Lsp.DocumentSymbol)item).children;",
1235 "bool autoexpand" : true,
1236 "bool passthrough" : false,
1239 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1242 "id" : "navliststore",
1243 "xtype" : "ListStore",
1244 "| Lsp.DocumentSymbol? symbolAtLine" : [
1245 "(uint line, uint chr) {",
1248 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1249 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1250 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1251 "\t\t//\tel.name , (int)el.range.start.line,",
1252 "\t\t//\t(int)el.range.end.line",
1254 "\t\tvar ret = el.containsLine(line,chr);",
1255 "\t\tif (ret != null) {",
1256 "\t\t\treturn ret;",
1268 "(position, removed, added) => {",
1269 "\tGLib.debug(\"tree item changed %d , %d , %d\",(int) position, (int)removed, (int) added);",
1270 "\t if (added < 1) { ",
1273 "\t//var sym = (Lsp.DocumentSymbol) this.el.get_item(position);",
1274 "\tvar row = this.el.get_row(position);",
1276 "\tGLib.debug(\"got %s\", row.get_item().get_type().name());",
1283 "xtype" : "TreeListModel"
1287 "* prop" : "sorter",
1291 "* prop" : "sorter",
1294 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1296 "* prop" : "expression",
1297 "string property_name" : "sort_key",
1298 "xtype" : "PropertyExpression"
1301 "xtype" : "StringSorter"
1304 "xtype" : "TreeListRowSorter"
1307 "xtype" : "SortListModel",
1308 "| Lsp.DocumentSymbol? getSymbolAt" : [
1311 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1313 " var a = tr.get_item();; ",
1314 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1317 " return (Lsp.DocumentSymbol)tr.get_item();",
1321 "| int getRowFromSymbol" : [
1322 "(Lsp.DocumentSymbol sym) {",
1324 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1325 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1327 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1334 "| void collapseOnLoad" : [
1336 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1337 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1338 "\t\tvar sym = (Lsp.DocumentSymbol)tr.get_item();",
1339 "\t\tswitch (sym.kind) {",
1340 "\t \t\tcase Lsp.SymbolKind.Enum: ",
1341 "\t \t\t\ttr.expanded = false;",
1344 "\t\t\t\t//tr.expanded = true;",
1356 "xtype" : "NoSelection"
1362 "(n_press, x, y) => {",
1364 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1366 " if (row == null) {",
1367 "\t GLib.debug(\"no row selected items\");",
1370 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1371 " //Lsp.DocumentSymbol",
1372 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1373 " if (sym == null) {",
1379 " \"line\" : 1410,",
1380 " \"character\" : 8",
1383 " \"line\" : 1410,",
1384 " \"character\" : 39",
1388 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1389 " _this.scroll_to_line((int)sym.range.start.line);",
1390 " Gtk.TextIter iter;",
1391 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1392 " \t(int)sym.range.start.line,",
1393 " \t(int)sym.range.start.character",
1395 " _this.buffer.el.place_cursor(iter);",
1400 "xtype" : "GestureClick"
1403 "string name" : "editor-navigation",
1404 "xtype" : "ColumnView",
1405 "| Gtk.Widget? getRowWidgetAt" : [
1406 "(double x, double y, out string pos) {",
1409 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1410 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1411 "\tif (w == null) {",
1415 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1416 "\tif (row == null) {",
1420 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1424 "\t//GLib.debug(\"row number is %d\", rn);",
1425 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1426 "\t// above or belw",
1427 "\tGraphene.Rect bounds;",
1428 "\trow.compute_bounds(this.el, out bounds);",
1429 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1430 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1431 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1433 "\tvar ypos = y - bounds.get_y();",
1434 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1435 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1436 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1437 "\tpos = \"over\";",
1439 "\tif (rpos > 80) {",
1440 "\t\tpos = \"below\";",
1441 "\t} else if (rpos < 20) {",
1442 "\t\tpos = \"above\";",
1447 "| int getRowAt" : [
1448 "(double x, double y, out string pos) {",
1451 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1452 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1453 "\tif (w == null) {",
1457 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1458 "\tif (row == null) {",
1462 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1467 "\twhile (cr.get_prev_sibling() != null) {",
1469 "\t\tcr = cr.get_prev_sibling();",
1472 "\t//GLib.debug(\"row number is %d\", rn);",
1473 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1474 "\t// above or belw",
1475 "\tGraphene.Rect bounds;",
1476 "\trow.compute_bounds(this.el, out bounds);",
1477 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1478 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1479 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1481 "\tvar ypos = y - bounds.get_y();",
1482 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1483 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1484 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1485 "\tpos = \"over\";",
1487 "\tif (rpos > 80) {",
1488 "\t\tpos = \"below\";",
1489 "\t} else if (rpos < 20) {",
1490 "\t\tpos = \"above\";",
1496 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1498 "\tif (!_this.navigation_holder.el.visible) {",
1499 "\t\t_this.navigation_holder.el.show();",
1500 "\t\t_this.paned.el.position = ",
1501 "\t\t\t_this.paned.el.get_width() - 200;",
1503 "\t//_this.navliststore.el.remove_all();",
1506 "\tvar ls = new GLib.ListStore(typeof(Lsp.DocumentSymbol));",
1508 "\tforeach(var sym in syms) {",
1509 "\t\tls.append(sym);",
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 ;",