2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# GtkSource.SearchContext searchcontext" : "null",
7 "# JsRender.JsRender? file" : "null",
8 "# JsRender.Node node" : "null",
9 "# JsRender.NodeProp? prop" : "null",
10 "# Xcls_MainWindow window" : "null",
11 "# bool dirty" : false,
13 "# int last_error_counter" : 0,
14 "# int pos_root_x" : "",
15 "# int pos_root_y" : "",
16 "# string activeEditor" : "\"\"",
17 "$ homogeneous" : false,
20 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
21 "bool hexpand" : true,
22 "bool vexpand" : true,
23 "int last_search_end" : 0,
27 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
31 "* prop" : "start_child",
32 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
36 "$ homogeneous" : false,
38 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
39 "bool hexpand" : true,
48 " _this.saveContents();",
57 "bool hexpand" : true,
62 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
65 "\t//this.el.set_range(6,30);",
66 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
67 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
69 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
70 " \t\t//\tGLib.debug(\"update range\");",
71 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
72 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
80 "bool draw_value" : false,
81 "bool has_origin" : true,
82 "bool sensitive" : true,
84 "int width_request" : 200,
88 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
91 " \tBuilderApplication.settings.editor_font_size = val;",
105 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
106 "string icon_name" : "window-close",
113 " _this.saveContents();",
114 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
119 "string icon_name" : "window-close",
127 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
128 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
129 "bool overlay_scrolling" : false,
130 "bool vexpand" : true,
131 "id" : "RightEditor",
134 "# Gtk.CssProvider css" : "null",
135 "$ gboolean auto_indent" : true,
136 "$ xns" : "GtkSource",
143 "this.el.completion.add_provider(",
144 "\tnew Palete.CompletionProvider(_this)",
147 "// hover seems pretty useless.. - ??",
148 "//var hover = this.el.get_hover();",
149 "//hover.add_provider(new Palete.HoverProvider(_this));",
151 "//this.el.completion.unblock_interactive();",
152 "this.el.completion.select_on_show = true; // select",
153 "//this.el.completion.remember_info_visibility\t = true;",
156 "var attrs = new GtkSource.MarkAttributes();",
158 "attrs.set_icon_name ( \"process-stop\"); ",
159 "attrs.query_tooltip_text.connect(( mark) => {",
160 " GLib.debug(\"tooltip query? %s\", mark.name);",
161 " return strdup( mark.name);",
163 " attrs.query_tooltip_markup.connect(( mark) => {",
164 " GLib.debug(\"tooltip query? %s\", mark.name);",
165 " return strdup( mark.name);",
167 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
171 "var wattrs = new GtkSource.MarkAttributes();",
172 "wattrs.set_icon_name ( \"process-stop\"); ",
173 "wattrs.query_tooltip_text.connect(( mark) => {",
174 " GLib.debug(\"tooltip query? %s\", mark.name);",
175 " return strdup(mark.name);",
177 "wattrs.query_tooltip_markup.connect(( mark) => {",
178 " GLib.debug(\"tooltip query? %s\", mark.name);",
179 " return strdup(mark.name);",
181 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
185 "var dattrs = new GtkSource.MarkAttributes();",
187 "dattrs.set_icon_name ( \"process-stop\"); ",
189 "dattrs.query_tooltip_text.connect(( mark) => {",
190 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
191 " return strdup(mark.name);",
193 "//dattrs.query_tooltip_markup.connect(( mark) => {",
194 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
195 " // return strdup(mark.name);",
197 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
200 " this.el.get_space_drawer().set_matrix(null);",
201 " this.el.get_space_drawer().set_types_for_locations( ",
202 "\tGtkSource.SpaceLocationFlags.ALL,",
203 "\tGtkSource.SpaceTypeFlags.ALL",
205 "this.el.get_space_drawer().set_enable_matrix(true);",
209 "bool has_tooltip" : true,
210 "bool hexpand" : true,
211 "bool insert_spaces_instead_of_tabs" : true,
212 "bool vexpand" : true,
213 "boolean show_line_marks" : true,
214 "boolean show_line_numbers" : true,
215 "css_classes" : "{ \"code-editor\" }",
216 "gboolean highlight_current_line" : true,
221 "$ Gee.HashMap<int,string>? xmarks" : "null",
222 "$ xns" : "GtkSource",
223 "$ xtype" : "Buffer",
226 "var buf = this.el;",
227 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
228 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
229 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
230 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
231 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
232 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
233 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
234 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
237 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
238 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
239 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
245 "bool check_queued" : false,
246 "bool enable_undo" : true,
247 "bool highlight_matching_brackets" : true,
248 "bool highlight_syntax" : true,
250 "int error_line" : "-1",
254 " // check syntax??",
256 " _this.save_button.el.sensitive = true;",
257 " print(\"EDITOR CHANGED\");",
258 " this.checkSyntax();",
260 " _this.dirty = true;",
262 " // this.get('/LeftPanel.model').changed( str , false);",
270 "\tGtk.TextIter iter;",
271 "\tthis.el.get_iter_at_offset (",
272 "\t\t\tout iter, this.el.cursor_position);",
273 "\tvar line = iter.get_line();",
274 "\t_this.navigation.updateSelectedLine(",
275 "\t\t\t(uint)iter.get_line(),",
276 "\t\t\t(uint)iter.get_line_offset()",
284 "| bool OLDhighlightErrorsJson" : [
285 "(string type, Json.Object obj) {",
286 "\tGtk.TextIter start;",
287 "\tGtk.TextIter end; ",
288 "\tthis.el.get_bounds (out start, out end);",
290 "\tthis.el.remove_source_marks (start, end, type);",
291 "\tGLib.debug(\"highlight errors\");\t\t ",
293 "\t // we should highlight other types of errors..",
295 "\tif (!obj.has_member(type)) {",
296 "\t\tGLib.debug(\"Return has no errors\\n\");",
300 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
302 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
304 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
309 "\t//this.marks = new Gee.HashMap<int,string>();",
310 "\tvar err = obj.get_object_member(type);",
312 "\tif (_this.file == null) {",
313 "\t\tGLib.debug(\"file is null?\");",
317 "\tvar valafn = _this.file.path;",
319 "\tif (_this.file.xtype != \"PlainFile\") {",
321 "\t\tvalafn = \"\";",
323 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
324 "\t\t\t// should not happen",
325 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
326 "\t\t} catch (GLib.RegexError e) {",
327 "\t\t\treturn true;",
333 "\tif (!err.has_member(valafn)) {",
334 "\t\tGLib.debug(\"File path has no errors\");",
338 "\tvar lines = err.get_object_member(valafn);",
341 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
342 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
346 "\tvar tlines = this.el.get_line_count () +1;",
348 "\tif (_this.prop != null) {",
350 "\t\ttlines = _this.prop.end_line + 1;",
351 "\t\toffset = _this.prop.start_line + 1;",
357 "\tlines.foreach_member((obj, line, node) => {",
359 "\t Gtk.TextIter iter;",
360 "// print(\"get inter\\n\");",
361 "\t var eline = int.parse(line) - offset;",
362 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
365 "\t if (eline > tlines || eline < 0) {",
370 "\t this.el.get_iter_at_line( out iter, eline);",
371 "\t //print(\"mark line\\n\");",
372 "\t var msg = \"\";",
373 "\t var ar = lines.get_array_member(line);",
374 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
375 "\t \tif (ar.get_string_element(i) == \"Success\") {",
378 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
379 "\t\t\tmsg += ar.get_string_element(i);",
381 "\t\tif (msg == \"\") {",
384 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
385 "\t this.el.create_source_mark(msg, type, iter);",
386 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
387 "\t // this.marks.set(eline, msg);",
398 "| bool checkSyntax" : [
402 " var str = this.toString();",
405 " if (this.error_line > 0) {",
406 " Gtk.TextIter start;",
407 " Gtk.TextIter end; ",
408 " this.el.get_bounds (out start, out end);",
410 " this.el.remove_source_marks (start, end, null);",
412 " if (str.length < 1) {",
413 " print(\"checkSyntax - empty string?\\n\");",
417 " // bit presumptiona",
418 " if (_this.file.xtype == \"PlainFile\") {",
420 " // assume it's gtk...",
421 " var oldcode =_this.file.toSource();",
422 " _this.file.setSource(str);",
423 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
424 " \t_this.file.getLanguageServer().document_change(_this.file);",
426 " _this.file.setSource(oldcode);",
432 " if (_this.file == null) {",
440 " GLib.debug(\"calling validate\"); ",
441 " // clear the buttons.",
442 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
445 "\tvar oldcode = _this.prop.val;",
447 "\t_this.prop.val = str;",
448 "\t_this.node.updated_count++;",
449 " _this.file.getLanguageServer().document_change(_this.file);",
450 " _this.node.updated_count++;",
451 " _this.prop.val = oldcode;",
454 " //print(\"done mark line\\n\");",
456 " return true; // at present allow saving - even if it's invalid..",
460 "| bool highlightErrors" : [
461 "( Gee.HashMap<int,string> validate_res) {",
463 "\tthis.error_line = validate_res.size;",
465 "\tif (this.error_line < 1) {",
468 "\tvar tlines = this.el.get_line_count ();",
469 "\tGtk.TextIter iter;",
470 "\tvar valiter = validate_res.map_iterator();",
471 "\twhile (valiter.next()) {",
473 "\t// print(\"get inter\\n\");",
474 "\t\tvar eline = valiter.get_key();",
475 "\t\tif (eline > tlines) {",
478 "\t\tthis.el.get_iter_at_line( out iter, eline);",
479 "\t\t//print(\"mark line\\n\");",
480 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
485 "| string toString" : [
490 " this.el.get_start_iter(out s);",
491 " this.el.get_end_iter(out e);",
492 " var ret = this.el.get_text(s,e,true);",
493 " //print(\"TO STRING? \" + ret);",
500 "# bool is_control" : false,
505 "(keyval, keycode, state) => {",
507 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
508 " \t\tthis.is_control = true;",
515 "(keyval, keycode, state) => {",
517 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
518 " \t\tthis.is_control = false;",
520 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
521 " GLib.debug(\"SAVE: ctrl-S pressed\");",
522 " _this.saveContents();",
526 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
527 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
528 "\t\t_this.forwardSearch(true);",
531 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
532 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
533 "\t\t_this.search_entry.el.grab_focus();",
534 "\t\t_this.search_entry.el.select_region(0,-1);",
537 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
538 "\t\t_this.view.el.show_completion();",
541 "\tGtk.TextIter iter;",
542 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
543 "\tvar line = iter.get_line();",
544 "\tvar offset = iter.get_line_offset();",
545 "\tGLib.debug(\"line %d off %d\", line ,offset);",
546 "\tif (_this.prop != null) {",
547 "\t\tline += _this.prop.start_line + 1; // i think..",
548 "\t\toffset += 12; // should probably be 8 without namespaced ",
549 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
551 " //_this.view.el.show_completion();",
552 " // print(event.key.keyval)",
564 "xtype" : "EventControllerKey"
567 "# double distance" : "0.0f",
569 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
573 "\tif (!_this.keystate.is_control) {",
576 "\t //GLib.debug(\"scroll %f\", dy);",
578 "\tthis.distance += dy;",
580 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
582 "\t if (this.distance < -1) {",
584 "\t\tBuilderApplication.settings.editor_font_size ++;",
585 "\t\tthis.distance = 0;",
587 "\tif (this.distance > 1) {",
588 "\t\tBuilderApplication.settings.editor_font_size --;",
589 "\t\tthis.distance = 0;",
597 "xtype" : "EventControllerScroll"
601 "xtype" : "GestureClick"
606 "(x, y, keyboard_tooltip, tooltip) => {",
608 "\t//GLib.debug(\"query tooltip\");",
609 "\tGtk.TextIter iter;",
612 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
614 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
616 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
617 "\t//\treturn false;",
620 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
622 "\tvar l = iter.get_line();",
626 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
632 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
633 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
634 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
642 "\t// this crashes?? - not sure why.",
643 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
644 "\tif (marks.is_empty()) {",
645 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
647 "\tif (marks.is_empty()) {",
648 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
651 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
653 "\tmarks.@foreach((m) => { ",
654 "\t\t//GLib.debug(\"got mark %s\", m.name);",
655 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
657 "\t// true if there is a mark..",
658 "\tif (str.length > 0 ) {",
659 "\t\ttooltip.set_text( str );",
661 "\treturn str.length > 0 ? true : false;",
667 "string name" : "editor-view",
668 "uint tab_width" : 4,
673 "// show the help page for the active node..",
674 " //this.get('/Help').show();",
676 " // this.get('/BottomPane').el.set_current_page(0);",
677 " \tGLib.debug(\"load called - Reset undo buffer\");",
679 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
680 " buf.begin_irreversible_action();",
681 " buf.set_text(str, str.length);",
682 " buf.end_irreversible_action();",
684 " var lm = GtkSource.LanguageManager.get_default();",
685 " var lang = \"vala\";",
686 " if (_this.file != null) {",
687 " lang = _this.file.language;",
689 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
690 " var lg = _this.file.content_type.length > 0 ?",
691 " lm.guess_language(_this.file.path, _this.file.content_type) :",
692 " lm.get_language(lang);",
695 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
697 " this.el.insert_spaces_instead_of_tabs = true;",
698 " if (lg != null) {",
699 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
700 "\t\tif (lg.name == \"Vala\") {",
701 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
704 " _this.dirty = false;",
705 " this.el.grab_focus();",
706 " _this.save_button.el.sensitive = false;",
707 " _this.last_error_counter = -1;",
712 "xtype" : "ScrolledWindow"
717 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
718 "bool homogeneous" : false,
719 "bool vexpand" : false,
724 "Gtk.CssProvider css" : "",
725 "bool hexpand" : true,
726 "id" : "search_entry",
732 "(keyval, keycode, state) => {",
734 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
735 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
736 "\t\t_this.forwardSearch(true);",
741 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
742 "\t\t_this.forwardSearch(true);",
748 " // print(event.key.keyval)",
755 "xtype" : "EventControllerKey"
762 "_this.search(_this.search_entry.el.text);",
763 "\t _this.search_results.updateResults();",
765 "\tGLib.Timeout.add_seconds(1,() => {",
766 "\t\t _this.search_results.updateResults();",
767 "\t\t return false;",
773 "string name" : "editor-search-entry",
774 "string placeholder_text" : "Press enter to search",
775 "uint search_delay" : 3,
776 "xtype" : "SearchEntry",
777 "| void forwardSearch" : [
778 "(bool change_focus) {",
781 "\t_this.forwardSearch(change_focus);",
785 "\tswitch(_this.windowstate.state) {",
786 "\t\tcase WindowState.State.CODEONLY:",
787 "\t\t//case WindowState.State.CODE:",
788 "\t\t\t// search the code being edited..",
789 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
792 "\t\tcase WindowState.State.PREVIEW:",
793 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
794 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
796 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
809 "id" : "search_results",
810 "int margin_end" : 4,
811 "int margin_start" : 4,
812 "string label" : "No Results",
814 "| void updateResults" : [
816 "\tthis.el.visible = true;",
818 "\tvar res = _this.searchcontext.get_occurrences_count();",
820 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
824 "\t_this.nextBtn.el.sensitive = false;",
825 "\t_this.backBtn.el.sensitive = false;\t",
828 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
829 "\t\t_this.nextBtn.el.sensitive = true;",
830 "\t\t_this.backBtn.el.sensitive = true;",
833 "\t_this.search_results.el.label = \"No Matches\";",
840 "bool always_show_image" : true,
841 "bool sensitive" : false,
847 "\t_this.forwardSearch(true);",
854 "string icon_name" : "go-down",
859 "bool always_show_image" : true,
860 "bool sensitive" : false,
866 "\t_this.backSearch(true);",
872 "string icon_name" : "go-up",
877 "bool always_show_arrow" : true,
878 "bool always_show_image" : true,
882 "* prop" : "popover",
883 "id" : "search_settings",
888 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
899 "id" : "case_sensitive",
900 "string label" : "Case Sensitive",
901 "xtype" : "CheckButton"
912 "string label" : "Regex",
913 "xtype" : "CheckButton"
918 "string label" : "Multi-line (add \\n)",
919 "xtype" : "CheckButton"
928 "string icon_name" : "emblem-system",
929 "xtype" : "MenuButton"
939 "* prop" : "end_child",
940 "bool visible" : false,
941 "id" : "navigationwindow",
944 "# int last_selected_line" : "-1",
945 "$ Gtk.Widget? selected_row" : "null",
952 "bool expand" : true,
956 "* prop" : "factory",
960 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
962 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
963 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
966 "\tvar hbox = (Gtk.Box) expand.child;",
969 "\tvar img = (Gtk.Image) hbox.get_first_child();",
970 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
972 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
973 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
975 "\tsym.set_data<Gtk.Widget>(\"widget\", expand.get_parent());",
976 "\texpand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>(\"symbol\", sym);",
978 "\tGLib.debug(\"save sym on %s\", expand.get_parent().get_parent().get_type().name());",
980 "\t//GLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
982 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
983 " \texpand.set_list_row(lr);",
985 " \tsym.bind_property(\"symbol_icon\",",
986 " img, \"icon_name\",",
987 " GLib.BindingFlags.SYNC_CREATE);",
989 " \thbox.add_css_class(sym.symbol_icon);",
991 " \tsym.bind_property(\"name\",",
993 " GLib.BindingFlags.SYNC_CREATE);",
994 " \t// should be better?- --line no?",
995 " \tsym.bind_property(\"tooltip\",",
996 " lbl, \"tooltip_markup\",",
997 " GLib.BindingFlags.SYNC_CREATE);",
998 " \t// bind image...",
1006 "\tvar expand = new Gtk.TreeExpander();",
1008 "\texpand.set_indent_for_depth(true);",
1009 "\texpand.set_indent_for_icon(true);",
1010 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
1011 "\tvar icon = new Gtk.Image();",
1012 "\tvar lbl = new Gtk.Label(\"\");",
1013 "\tlbl.use_markup = true;",
1014 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
1016 "\ticon.margin_end = 4;",
1017 " \tlbl.justify = Gtk.Justification.LEFT;",
1018 " \tlbl.xalign = 0;",
1020 "//\tlistitem.activatable = true; ??",
1022 "\thbox.append(icon);",
1023 "\thbox.append(lbl);",
1024 "\texpand.set_child(hbox);",
1025 "\t((Gtk.ListItem)listitem).set_child(expand);",
1031 "xtype" : "SignalListItemFactory"
1034 "string title" : "Code Navigation",
1035 "xtype" : "ColumnViewColumn"
1040 "id" : "navigationselmodel",
1045 "id" : "navigationsort",
1048 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1051 "\treturn ((Lsp.DocumentSymbol)item).children;",
1057 "bool autoexpand" : true,
1058 "bool passthrough" : false,
1061 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1064 "id" : "navliststore",
1065 "xtype" : "ListStore",
1066 "| Lsp.DocumentSymbol? symbolAtLine" : [
1067 "(uint line, uint chr) {",
1070 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1071 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1072 "\t\t//GLib.debug(\"Check sym %s : %d-%d\",",
1073 "\t\t//\tel.name , (int)el.range.start.line,",
1074 "\t\t//\t(int)el.range.end.line",
1076 "\t\tvar ret = el.containsLine(line,chr);",
1077 "\t\tif (ret != null) {",
1078 "\t\t\treturn ret;",
1088 "xtype" : "TreeListModel"
1092 "* prop" : "sorter",
1096 "* prop" : "sorter",
1099 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1101 "* prop" : "expression",
1102 "string property_name" : "sort_key",
1103 "xtype" : "PropertyExpression"
1106 "xtype" : "StringSorter"
1109 "xtype" : "TreeListRowSorter"
1112 "xtype" : "SortListModel",
1113 "| Lsp.DocumentSymbol? getSymbolAt" : [
1116 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1118 " var a = tr.get_item();; ",
1119 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1122 " return (Lsp.DocumentSymbol)tr.get_item();",
1126 "| int getRowFromSymbol" : [
1127 "(Lsp.DocumentSymbol sym) {",
1129 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1130 "\t\tvar tr = (Gtk.TreeListRow)this.el.get_item(i);",
1132 "\t\tif (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1141 "xtype" : "NoSelection"
1147 "(n_press, x, y) => {",
1149 " \tvar row = _this.navigation.getRowWidgetAt(x,y, out pos );",
1151 " if (row == null) {",
1152 "\t GLib.debug(\"no row selected items\");",
1155 "\tGLib.debug(\"got click on %s\", row.get_type().name()); ",
1156 " //Lsp.DocumentSymbol",
1157 " var sym = row.get_data<Lsp.DocumentSymbol>(\"symbol\");",
1158 " if (sym == null) {",
1164 " \"line\" : 1410,",
1165 " \"character\" : 8",
1168 " \"line\" : 1410,",
1169 " \"character\" : 39",
1173 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1174 " _this.scroll_to_line((int)sym.range.start.line);",
1175 " Gtk.TextIter iter;",
1176 " _this.buffer.el.get_iter_at_line_offset(out iter, ",
1177 " \t(int)sym.range.start.line,",
1178 " \t(int)sym.range.start.character",
1180 " _this.buffer.el.place_cursor(iter);",
1185 "xtype" : "GestureClick"
1188 "string name" : "editor-navigation",
1189 "xtype" : "ColumnView",
1190 "| Gtk.Widget? getRowWidgetAt" : [
1191 "(double x, double y, out string pos) {",
1194 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1195 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1196 "\tif (w == null) {",
1200 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1201 "\tif (row == null) {",
1205 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1209 "\t//GLib.debug(\"row number is %d\", rn);",
1210 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1211 "\t// above or belw",
1212 "\tGraphene.Rect bounds;",
1213 "\trow.compute_bounds(this.el, out bounds);",
1214 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1215 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1216 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1218 "\tvar ypos = y - bounds.get_y();",
1219 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1220 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1221 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1222 "\tpos = \"over\";",
1224 "\tif (rpos > 80) {",
1225 "\t\tpos = \"below\";",
1226 "\t} else if (rpos < 20) {",
1227 "\t\tpos = \"above\";",
1232 "| int getRowAt" : [
1233 "(double x, double y, out string pos) {",
1236 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1237 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1238 "\tif (w == null) {",
1242 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1243 "\tif (row == null) {",
1247 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1252 "\twhile (cr.get_prev_sibling() != null) {",
1254 "\t\tcr = cr.get_prev_sibling();",
1257 "\t//GLib.debug(\"row number is %d\", rn);",
1258 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1259 "\t// above or belw",
1260 "\tGraphene.Rect bounds;",
1261 "\trow.compute_bounds(this.el, out bounds);",
1262 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1263 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1264 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1266 "\tvar ypos = y - bounds.get_y();",
1267 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1268 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1269 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1270 "\tpos = \"over\";",
1272 "\tif (rpos > 80) {",
1273 "\t\tpos = \"below\";",
1274 "\t} else if (rpos < 20) {",
1275 "\t\tpos = \"above\";",
1281 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1282 "\t_this.navigationwindow.el.show();",
1283 "\t_this.navliststore.el.remove_all();",
1284 "\tforeach(var sym in syms) {",
1285 "\t\t_this.navliststore.el.append(sym);",
1291 "| void updateSelectedLine" : [
1292 "(uint line, uint chr) {",
1293 "\tif (line == this.last_selected_line) {",
1296 "\tGLib.debug(\"select line %d\", (int)line);",
1297 "\tthis.last_selected_line = (int)line;",
1300 "\tvar new_row = -1;",
1301 "\tvar sym = _this.navliststore.symbolAtLine(line, chr);",
1302 "\tif (sym != null) {",
1303 "\t \tnew_row = _this.navigationsort.getRowFromSymbol(sym);",
1304 " \t\tGLib.debug(\"select line %d - row found %d\", (int)line, new_row);",
1306 " \t\tGLib.debug(\" no symbol found at line %d\", (int)line);",
1309 "\tif (this.selected_row != null) { ",
1310 "\t\tGLib.debug(\" remove selected row\");",
1311 "\t\tthis.selected_row.remove_css_class(\"selected-row\");",
1313 "\tthis.selected_row = null;",
1314 "\tif (new_row > -1) {",
1315 "\t\tthis.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);",
1316 "\t\tvar row = sym.get_data<Gtk.Widget>(\"widget\");",
1317 "\t\tif (row != null) {",
1318 "\t\t\tGLib.debug(\" Add selected row\");",
1320 "\t\t\trow.add_css_class(\"selected-row\");",
1321 "\t\t\tthis.selected_row = row;",
1325 "\t\t\tGLib.debug(\"could not find widget on row %d\", new_row);",
1335 "xtype" : "ScrolledWindow"
1342 "| bool saveContents" : [
1346 " if (_this.file == null) {",
1352 " var str = _this.buffer.toString();",
1354 " _this.buffer.checkSyntax();",
1358 " // LeftPanel.model.changed( str , false);",
1359 " _this.dirty = false;",
1360 " _this.save_button.el.sensitive = false;",
1362 " // find the text for the node..",
1363 " if (_this.file.xtype != \"PlainFile\") {",
1364 " // in theory these properties have to exist!?!",
1365 " \tthis.prop.val = str;",
1366 " //this.window.windowstate.left_props.reload();",
1368 " _this.file.setSource( str );",
1371 " // call the signal..",
1379 "(string in_txt) {",
1381 "\tvar s = new GtkSource.SearchSettings();",
1382 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1383 "\ts.regex_enabled = _this.regex.el.active;\t",
1384 "\ts.wrap_around = false;",
1386 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1387 "\tthis.searchcontext.set_highlight(true);",
1388 "\tvar txt = in_txt;",
1390 "\tif (_this.multiline.el.active) {",
1391 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1394 "\ts.set_search_text(txt);",
1395 "\tGtk.TextIter beg, st,en;",
1397 "\tthis.buffer.el.get_start_iter(out beg);",
1398 "\tbool has_wrapped_around;",
1399 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1400 "\tthis.last_search_end = 0;",
1402 "\treturn this.searchcontext.get_occurrences_count();",
1410 "| string tempFileContents" : [
1414 " if (_this.file == null) {",
1417 "\tvar str= this.buffer.toString();",
1418 "\tif (_this.file.xtype == \"PlainFile\") {",
1426 " GLib.debug(\"calling validate\"); ",
1427 " // clear the buttons.",
1428 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1429 "\t\treturn this.file.toSource(); ;",
1432 "\tvar oldcode = _this.prop.val;",
1433 "\t_this.prop.val = str;",
1434 " var ret = _this.file.toSource();",
1435 " _this.prop.val = oldcode;",
1440 "| void backSearch" : [
1441 "(bool change_focus) {",
1443 "\tif (this.searchcontext == null) {",
1447 "\tGtk.TextIter beg, st,en;",
1448 "\tbool has_wrapped_around;",
1449 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1451 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1452 "\t\tthis.last_search_end = 0;",
1454 "\t\tthis.last_search_end = en.get_offset();",
1455 "\t\tif (change_focus) {",
1456 "\t\t\tthis.view.el.grab_focus();",
1458 "\t\tthis.buffer.el.place_cursor(st);",
1459 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1465 "| void forwardSearch" : [
1466 "(bool change_focus) {",
1468 "\tif (this.searchcontext == null) {",
1472 "\tGtk.TextIter beg, st,en;",
1473 "\t bool has_wrapped_around;",
1474 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1475 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1477 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1479 "\t\tif (has_wrapped_around) {",
1483 "\t\tthis.last_search_end = en.get_offset();",
1484 "\t\tif (change_focus) {",
1485 "\t\t\tthis.view.el.grab_focus();",
1487 "\t\tthis.buffer.el.place_cursor(st);",
1488 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1496 "\t this.file = null; ",
1498 " this.node = null;",
1499 " this.prop = null;",
1500 "\tthis.searchcontext = null;",
1505 "| void scroll_to_line" : [
1508 "\tGLib.Timeout.add(500, () => {",
1510 "\t\tvar buf = this.view.el.get_buffer();",
1512 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1515 "\t\tGtk.TextIter iter; ",
1516 "\t\tsbuf.get_iter_at_line(out iter, line);",
1517 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1518 "\t\treturn false;",
1524 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1527 " this.file = file; ",
1529 " if (file.xtype != \"PlainFile\") {",
1530 " \tthis.prop = prop;",
1531 " this.node = node;",
1533 " // find the text for the node..",
1534 " this.view.load( prop.val );",
1535 " this.updateErrorMarks();",
1539 " this.close_btn.el.show(); ",
1542 " this.view.load( file.toSource() );",
1543 " this.updateErrorMarks();",
1544 " this.close_btn.el.hide();",
1545 " var ls = file.getLanguageServer();",
1546 " ls.documentSymbols.begin(file, (a,o) => {",
1547 " \t_this.navigation.show(ls.documentSymbols.end(o)); ",
1549 " //documentSymbols",
1555 "| void updateErrorMarks" : [
1560 "\tvar buf = _this.buffer.el;",
1561 "\tGtk.TextIter start;",
1562 "\tGtk.TextIter end; ",
1563 "\tbuf.get_bounds (out start, out end);",
1568 "\t//GLib.debug(\"highlight errors\");\t\t ",
1570 "\t // we should highlight other types of errors..",
1572 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1574 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1576 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1582 "\tif (_this.file == null) {",
1583 "\t\tGLib.debug(\"file is null?\");",
1587 "\tvar ar = this.file.getErrors();",
1588 "\tif (ar.size < 1) {",
1589 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1590 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1591 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1592 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1593 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1594 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1595 "\t\tthis.last_error_counter = file.error_counter ;",
1596 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1601 " // basicaly check if there is no change, then we do not do any update..",
1602 " // we can do this by just using an error counter?",
1603 " // if that's changed then we will do an update, otherwise dont bother.",
1606 "\tvar offset = 0;",
1607 "\tvar hoffset = 0;",
1609 "\tvar tlines = buf.get_line_count () +1;",
1611 "\tif (_this.prop != null) {",
1612 "\t\t// this still seems flaky...",
1614 "\t\ttlines = _this.prop.end_line;",
1615 "\t\toffset = _this.prop.start_line;",
1616 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1620 "\t\t// no update...",
1621 "\t\tif (this.last_error_counter == file.error_counter) {",
1627 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1628 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1629 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1630 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1631 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1632 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1634 "\tforeach(var diag in ar) { ",
1635 "\t Gtk.TextIter iter;",
1636 "// print(\"get inter\\n\");",
1637 "\t var eline = (int)diag.range.start.line - offset;",
1638 "\t var eline_to = (int)diag.range.end.line - offset;",
1639 "\t //var eline = diag.range.end_line - offset;",
1640 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1641 "\t //\terr.line ,eline, offset);",
1644 "\t if (eline > tlines || eline < 0) {",
1648 "\t buf.get_iter_at_line( out iter, eline);",
1649 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1650 "\t buf.create_source_mark( msg, diag.category, iter);",
1652 " \t var spos = (int)diag.range.start.character - hoffset;",
1653 " \t if (spos < 0) { spos =0 ; }",
1654 " \t if (spos > iter.get_chars_in_line()) {",
1655 " \t \tspos = iter.get_chars_in_line();",
1657 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1658 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1659 " \t if (epos < 0) { epos =0 ; }",
1660 " \t if (epos > iter.get_chars_in_line()) {",
1661 " \t \tepos = iter.get_chars_in_line();",
1665 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1667 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1669 "\t buf.apply_tag_by_name(diag.category, start, end);",
1671 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1672 "\t //this.marks.set(eline, msg);",
1674 "\tthis.last_error_counter = file.error_counter ;",