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);",
268 "| bool OLDhighlightErrorsJson" : [
269 "(string type, Json.Object obj) {",
270 "\tGtk.TextIter start;",
271 "\tGtk.TextIter end; ",
272 "\tthis.el.get_bounds (out start, out end);",
274 "\tthis.el.remove_source_marks (start, end, type);",
275 "\tGLib.debug(\"highlight errors\");\t\t ",
277 "\t // we should highlight other types of errors..",
279 "\tif (!obj.has_member(type)) {",
280 "\t\tGLib.debug(\"Return has no errors\\n\");",
284 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
286 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
288 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
293 "\t//this.marks = new Gee.HashMap<int,string>();",
294 "\tvar err = obj.get_object_member(type);",
296 "\tif (_this.file == null) {",
297 "\t\tGLib.debug(\"file is null?\");",
301 "\tvar valafn = _this.file.path;",
303 "\tif (_this.file.xtype != \"PlainFile\") {",
305 "\t\tvalafn = \"\";",
307 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
308 "\t\t\t// should not happen",
309 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
310 "\t\t} catch (GLib.RegexError e) {",
311 "\t\t\treturn true;",
317 "\tif (!err.has_member(valafn)) {",
318 "\t\tGLib.debug(\"File path has no errors\");",
322 "\tvar lines = err.get_object_member(valafn);",
325 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
326 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
330 "\tvar tlines = this.el.get_line_count () +1;",
332 "\tif (_this.prop != null) {",
334 "\t\ttlines = _this.prop.end_line + 1;",
335 "\t\toffset = _this.prop.start_line + 1;",
341 "\tlines.foreach_member((obj, line, node) => {",
343 "\t Gtk.TextIter iter;",
344 "// print(\"get inter\\n\");",
345 "\t var eline = int.parse(line) - offset;",
346 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
349 "\t if (eline > tlines || eline < 0) {",
354 "\t this.el.get_iter_at_line( out iter, eline);",
355 "\t //print(\"mark line\\n\");",
356 "\t var msg = \"\";",
357 "\t var ar = lines.get_array_member(line);",
358 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
359 "\t \tif (ar.get_string_element(i) == \"Success\") {",
362 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
363 "\t\t\tmsg += ar.get_string_element(i);",
365 "\t\tif (msg == \"\") {",
368 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
369 "\t this.el.create_source_mark(msg, type, iter);",
370 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
371 "\t // this.marks.set(eline, msg);",
382 "| bool checkSyntax" : [
386 " var str = this.toString();",
389 " if (this.error_line > 0) {",
390 " Gtk.TextIter start;",
391 " Gtk.TextIter end; ",
392 " this.el.get_bounds (out start, out end);",
394 " this.el.remove_source_marks (start, end, null);",
396 " if (str.length < 1) {",
397 " print(\"checkSyntax - empty string?\\n\");",
401 " // bit presumptiona",
402 " if (_this.file.xtype == \"PlainFile\") {",
404 " // assume it's gtk...",
405 " var oldcode =_this.file.toSource();",
406 " _this.file.setSource(str);",
407 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
408 " \t_this.file.getLanguageServer().document_change(_this.file);",
410 " _this.file.setSource(oldcode);",
416 " if (_this.file == null) {",
424 " GLib.debug(\"calling validate\"); ",
425 " // clear the buttons.",
426 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
429 "\tvar oldcode = _this.prop.val;",
431 "\t_this.prop.val = str;",
432 "\t_this.node.updated_count++;",
433 " _this.file.getLanguageServer().document_change(_this.file);",
434 " _this.node.updated_count++;",
435 " _this.prop.val = oldcode;",
438 " //print(\"done mark line\\n\");",
440 " return true; // at present allow saving - even if it's invalid..",
444 "| bool highlightErrors" : [
445 "( Gee.HashMap<int,string> validate_res) {",
447 "\tthis.error_line = validate_res.size;",
449 "\tif (this.error_line < 1) {",
452 "\tvar tlines = this.el.get_line_count ();",
453 "\tGtk.TextIter iter;",
454 "\tvar valiter = validate_res.map_iterator();",
455 "\twhile (valiter.next()) {",
457 "\t// print(\"get inter\\n\");",
458 "\t\tvar eline = valiter.get_key();",
459 "\t\tif (eline > tlines) {",
462 "\t\tthis.el.get_iter_at_line( out iter, eline);",
463 "\t\t//print(\"mark line\\n\");",
464 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
469 "| string toString" : [
474 " this.el.get_start_iter(out s);",
475 " this.el.get_end_iter(out e);",
476 " var ret = this.el.get_text(s,e,true);",
477 " //print(\"TO STRING? \" + ret);",
484 "# bool is_control" : false,
489 "(keyval, keycode, state) => {",
491 " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
492 " \t\tthis.is_control = true;",
499 "(keyval, keycode, state) => {",
501 " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
502 " \t\tthis.is_control = false;",
504 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
505 " GLib.debug(\"SAVE: ctrl-S pressed\");",
506 " _this.saveContents();",
510 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
511 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
512 "\t\t_this.forwardSearch(true);",
515 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
516 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
517 "\t\t_this.search_entry.el.grab_focus();",
518 "\t\t_this.search_entry.el.select_region(0,-1);",
521 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
522 "\t\t_this.view.el.show_completion();",
525 "\tGtk.TextIter iter;",
526 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
527 "\tvar line = iter.get_line();",
528 "\tvar offset = iter.get_line_offset();",
529 "\tGLib.debug(\"line %d off %d\", line ,offset);",
530 "\tif (_this.prop != null) {",
531 "\t\tline += _this.prop.start_line + 1; // i think..",
532 "\t\toffset += 12; // should probably be 8 without namespaced ",
533 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
535 " //_this.view.el.show_completion();",
536 " // print(event.key.keyval)",
548 "xtype" : "EventControllerKey"
551 "# double distance" : "0.0f",
553 "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
557 "\tif (!_this.keystate.is_control) {",
560 "\t //GLib.debug(\"scroll %f\", dy);",
562 "\tthis.distance += dy;",
564 "\t//GLib.debug(\"scroll %f / %f\", dy, this.distance);",
566 "\t if (this.distance < -1) {",
568 "\t\tBuilderApplication.settings.editor_font_size ++;",
569 "\t\tthis.distance = 0;",
571 "\tif (this.distance > 1) {",
572 "\t\tBuilderApplication.settings.editor_font_size --;",
573 "\t\tthis.distance = 0;",
581 "xtype" : "EventControllerScroll"
585 "xtype" : "GestureClick"
590 "(x, y, keyboard_tooltip, tooltip) => {",
592 "\t//GLib.debug(\"query tooltip\");",
593 "\tGtk.TextIter iter;",
596 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
598 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
600 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
601 "\t//\treturn false;",
604 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
606 "\tvar l = iter.get_line();",
610 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
616 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
617 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
618 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
626 "\t// this crashes?? - not sure why.",
627 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
628 "\tif (marks.is_empty()) {",
629 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
631 "\tif (marks.is_empty()) {",
632 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
635 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
637 "\tmarks.@foreach((m) => { ",
638 "\t\t//GLib.debug(\"got mark %s\", m.name);",
639 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
641 "\t// true if there is a mark..",
642 "\tif (str.length > 0 ) {",
643 "\t\ttooltip.set_text( str );",
645 "\treturn str.length > 0 ? true : false;",
651 "string name" : "editor-view",
652 "uint tab_width" : 4,
657 "// show the help page for the active node..",
658 " //this.get('/Help').show();",
660 " // this.get('/BottomPane').el.set_current_page(0);",
661 " \tGLib.debug(\"load called - Reset undo buffer\");",
663 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
664 " buf.begin_irreversible_action();",
665 " buf.set_text(str, str.length);",
666 " buf.end_irreversible_action();",
668 " var lm = GtkSource.LanguageManager.get_default();",
669 " var lang = \"vala\";",
670 " if (_this.file != null) {",
671 " lang = _this.file.language;",
673 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
674 " var lg = _this.file.content_type.length > 0 ?",
675 " lm.guess_language(_this.file.path, _this.file.content_type) :",
676 " lm.get_language(lang);",
679 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
681 " this.el.insert_spaces_instead_of_tabs = true;",
682 " if (lg != null) {",
683 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
684 "\t\tif (lg.name == \"Vala\") {",
685 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
688 " _this.dirty = false;",
689 " this.el.grab_focus();",
690 " _this.save_button.el.sensitive = false;",
691 " _this.last_error_counter = -1;",
696 "xtype" : "ScrolledWindow"
701 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
702 "bool homogeneous" : false,
703 "bool vexpand" : false,
708 "Gtk.CssProvider css" : "",
709 "bool hexpand" : true,
710 "id" : "search_entry",
716 "(keyval, keycode, state) => {",
718 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
719 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
720 "\t\t_this.forwardSearch(true);",
725 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
726 "\t\t_this.forwardSearch(true);",
732 " // print(event.key.keyval)",
739 "xtype" : "EventControllerKey"
746 "_this.search(_this.search_entry.el.text);",
747 "\t _this.search_results.updateResults();",
749 "\tGLib.Timeout.add_seconds(1,() => {",
750 "\t\t _this.search_results.updateResults();",
751 "\t\t return false;",
757 "string name" : "editor-search-entry",
758 "string placeholder_text" : "Press enter to search",
759 "uint search_delay" : 3,
760 "xtype" : "SearchEntry",
761 "| void forwardSearch" : [
762 "(bool change_focus) {",
765 "\t_this.forwardSearch(change_focus);",
769 "\tswitch(_this.windowstate.state) {",
770 "\t\tcase WindowState.State.CODEONLY:",
771 "\t\t//case WindowState.State.CODE:",
772 "\t\t\t// search the code being edited..",
773 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
776 "\t\tcase WindowState.State.PREVIEW:",
777 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
778 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
780 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
793 "id" : "search_results",
794 "int margin_end" : 4,
795 "int margin_start" : 4,
796 "string label" : "No Results",
798 "| void updateResults" : [
800 "\tthis.el.visible = true;",
802 "\tvar res = _this.searchcontext.get_occurrences_count();",
804 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
808 "\t_this.nextBtn.el.sensitive = false;",
809 "\t_this.backBtn.el.sensitive = false;\t",
812 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
813 "\t\t_this.nextBtn.el.sensitive = true;",
814 "\t\t_this.backBtn.el.sensitive = true;",
817 "\t_this.search_results.el.label = \"No Matches\";",
824 "bool always_show_image" : true,
825 "bool sensitive" : false,
831 "\t_this.forwardSearch(true);",
838 "string icon_name" : "go-down",
843 "bool always_show_image" : true,
844 "bool sensitive" : false,
850 "\t_this.backSearch(true);",
856 "string icon_name" : "go-up",
861 "bool always_show_arrow" : true,
862 "bool always_show_image" : true,
866 "* prop" : "popover",
867 "id" : "search_settings",
872 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
883 "id" : "case_sensitive",
884 "string label" : "Case Sensitive",
885 "xtype" : "CheckButton"
896 "string label" : "Regex",
897 "xtype" : "CheckButton"
902 "string label" : "Multi-line (add \\n)",
903 "xtype" : "CheckButton"
912 "string icon_name" : "emblem-system",
913 "xtype" : "MenuButton"
923 "* prop" : "end_child",
924 "bool visible" : false,
925 "id" : "navigationwindow",
934 "bool expand" : true,
938 "* prop" : "factory",
942 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
944 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
945 "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
948 "\tvar hbox = (Gtk.Box) expand.child;",
951 "\tvar img = (Gtk.Image) hbox.get_first_child();",
952 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
954 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
955 "\tvar sym = (Lsp.DocumentSymbol) lr.get_item();",
957 "\tGLib.debug(\"got %d children for %s\" , (int)sym.children.get_n_items(), sym.name);",
959 " expand.set_hide_expander( sym.children.get_n_items() < 1);",
960 " \texpand.set_list_row(lr);",
962 " \tsym.bind_property(\"symbol_icon\",",
963 " img, \"icon_name\",",
964 " GLib.BindingFlags.SYNC_CREATE);",
966 " \thbox.add_css_class(sym.symbol_icon);",
968 " \tsym.bind_property(\"name\",",
970 " GLib.BindingFlags.SYNC_CREATE);",
971 " \t// should be better?- --line no?",
972 " \tsym.bind_property(\"tooltip\",",
973 " lbl, \"tooltip_markup\",",
974 " GLib.BindingFlags.SYNC_CREATE);",
975 " \t// bind image...",
983 "\tvar expand = new Gtk.TreeExpander();",
985 "\texpand.set_indent_for_depth(true);",
986 "\texpand.set_indent_for_icon(true);",
987 "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
988 "\tvar icon = new Gtk.Image();",
989 "\tvar lbl = new Gtk.Label(\"\");",
990 "\tlbl.use_markup = true;",
991 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
993 "\ticon.margin_end = 4;",
994 " \tlbl.justify = Gtk.Justification.LEFT;",
995 " \tlbl.xalign = 0;",
997 "//\tlistitem.activatable = true; ??",
999 "\thbox.append(icon);",
1000 "\thbox.append(lbl);",
1001 "\texpand.set_child(hbox);",
1002 "\t((Gtk.ListItem)listitem).set_child(expand);",
1008 "xtype" : "SignalListItemFactory"
1011 "string title" : "Code Navigation",
1012 "xtype" : "ColumnViewColumn"
1017 "id" : "navigationselmodel",
1024 "$ Gtk.TreeListModelCreateModelFunc create_func" : [
1027 "\treturn ((Lsp.DocumentSymbol)item).children;",
1033 "bool autoexpand" : true,
1034 "bool passthrough" : false,
1037 "$ GLib.Type item_type" : "typeof(Lsp.DocumentSymbol)",
1040 "id" : "navliststore",
1041 "xtype" : "ListStore",
1042 "| Lsp.DocumentSymbol? symbolAtLine" : [
1046 "\tfor(var i = 0; i < this.el.get_n_items();i++) {",
1047 "\t\tvar el = (Lsp.DocumentSymbol)this.el.get_item(i);",
1048 "\t\tvar ret = el.containsLine(i);",
1049 "\t\tif (ret != null) {",
1050 "\t\t\treturn ret;",
1060 "xtype" : "TreeListModel"
1064 "* prop" : "sorter",
1068 "* prop" : "sorter",
1071 "$ GLib.Type this_type" : "typeof(Lsp.DocumentSymbol)",
1073 "* prop" : "expression",
1074 "string property_name" : "sort_key",
1075 "xtype" : "PropertyExpression"
1078 "xtype" : "StringSorter"
1081 "xtype" : "TreeListRowSorter"
1084 "xtype" : "SortListModel"
1087 "xtype" : "NoSelection",
1088 "| Lsp.DocumentSymbol? getSymbollAt" : [
1091 " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
1093 " var a = tr.get_item();; ",
1094 " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
1097 " return (Lsp.DocumentSymbol)tr.get_item();",
1101 "| int getRowFromSymbol" : [
1102 "(Lsp.DocumentSymbol sym) {",
1104 "\tfor (var i=0;i < this.el.get_n_items(); i++) {",
1107 "\t var tr = (Gtk.TreeListRow)this.el.get_item(i);",
1109 "\t if (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {",
1121 "(n_press, x, y) => {",
1123 " \tvar row = _this.navigation.getRowAt(x,y, out pos );",
1125 "\t GLib.debug(\"no row selected items\");",
1128 " //Lsp.DocumentSymbol",
1129 " var sym = _this.navigationselmodel.getSymbollAt(row);",
1130 " if (sym == null) {",
1136 " \"line\" : 1410,",
1137 " \"character\" : 8",
1140 " \"line\" : 1410,",
1141 " \"character\" : 39",
1145 " GLib.debug(\"goto line %d\", (int)sym.range.start.line); ",
1146 " _this.scroll_to_line((int)sym.range.start.line);",
1151 "xtype" : "GestureClick"
1154 "string name" : "editor-navigation",
1155 "xtype" : "ColumnView",
1156 "| int getRowAt" : [
1157 "(double x, double y, out string pos) {",
1160 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1161 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1162 "\tif (w == null) {",
1166 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1167 "\tif (row == null) {",
1171 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1176 "\twhile (cr.get_prev_sibling() != null) {",
1178 "\t\tcr = cr.get_prev_sibling();",
1181 "\t//GLib.debug(\"row number is %d\", rn);",
1182 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1183 "\t// above or belw",
1184 "\tGraphene.Rect bounds;",
1185 "\trow.compute_bounds(this.el, out bounds);",
1186 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1187 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1188 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1190 "\tvar ypos = y - bounds.get_y();",
1191 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1192 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1193 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1194 "\tpos = \"over\";",
1196 "\tif (rpos > 80) {",
1197 "\t\tpos = \"below\";",
1198 "\t} else if (rpos < 20) {",
1199 "\t\tpos = \"above\";",
1205 "(Gee.ArrayList<Lsp.DocumentSymbol> syms) {",
1206 "\t_this.navigationwindow.el.show();",
1207 "\t_this.navliststore.el.remove_all();",
1208 "\tforeach(var sym in syms) {",
1209 "\t\t_this.navliststore.el.append(sym);",
1217 "xtype" : "ScrolledWindow"
1224 "| bool saveContents" : [
1228 " if (_this.file == null) {",
1234 " var str = _this.buffer.toString();",
1236 " _this.buffer.checkSyntax();",
1240 " // LeftPanel.model.changed( str , false);",
1241 " _this.dirty = false;",
1242 " _this.save_button.el.sensitive = false;",
1244 " // find the text for the node..",
1245 " if (_this.file.xtype != \"PlainFile\") {",
1246 " // in theory these properties have to exist!?!",
1247 " \tthis.prop.val = str;",
1248 " //this.window.windowstate.left_props.reload();",
1250 " _this.file.setSource( str );",
1253 " // call the signal..",
1261 "(string in_txt) {",
1263 "\tvar s = new GtkSource.SearchSettings();",
1264 "\ts.case_sensitive = _this.case_sensitive.el.active;",
1265 "\ts.regex_enabled = _this.regex.el.active;\t",
1266 "\ts.wrap_around = false;",
1268 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
1269 "\tthis.searchcontext.set_highlight(true);",
1270 "\tvar txt = in_txt;",
1272 "\tif (_this.multiline.el.active) {",
1273 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
1276 "\ts.set_search_text(txt);",
1277 "\tGtk.TextIter beg, st,en;",
1279 "\tthis.buffer.el.get_start_iter(out beg);",
1280 "\tbool has_wrapped_around;",
1281 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
1282 "\tthis.last_search_end = 0;",
1284 "\treturn this.searchcontext.get_occurrences_count();",
1292 "| string tempFileContents" : [
1296 " if (_this.file == null) {",
1299 "\tvar str= this.buffer.toString();",
1300 "\tif (_this.file.xtype == \"PlainFile\") {",
1308 " GLib.debug(\"calling validate\"); ",
1309 " // clear the buttons.",
1310 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
1311 "\t\treturn this.file.toSource(); ;",
1314 "\tvar oldcode = _this.prop.val;",
1315 "\t_this.prop.val = str;",
1316 " var ret = _this.file.toSource();",
1317 " _this.prop.val = oldcode;",
1322 "| void backSearch" : [
1323 "(bool change_focus) {",
1325 "\tif (this.searchcontext == null) {",
1329 "\tGtk.TextIter beg, st,en;",
1330 "\tbool has_wrapped_around;",
1331 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
1333 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
1334 "\t\tthis.last_search_end = 0;",
1336 "\t\tthis.last_search_end = en.get_offset();",
1337 "\t\tif (change_focus) {",
1338 "\t\t\tthis.view.el.grab_focus();",
1340 "\t\tthis.buffer.el.place_cursor(st);",
1341 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1347 "| void forwardSearch" : [
1348 "(bool change_focus) {",
1350 "\tif (this.searchcontext == null) {",
1354 "\tGtk.TextIter beg, st,en;",
1355 "\t bool has_wrapped_around;",
1356 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1357 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1359 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1361 "\t\tif (has_wrapped_around) {",
1365 "\t\tthis.last_search_end = en.get_offset();",
1366 "\t\tif (change_focus) {",
1367 "\t\t\tthis.view.el.grab_focus();",
1369 "\t\tthis.buffer.el.place_cursor(st);",
1370 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1378 "\t this.file = null; ",
1380 " this.node = null;",
1381 " this.prop = null;",
1382 "\tthis.searchcontext = null;",
1387 "| void scroll_to_line" : [
1390 "\tGLib.Timeout.add(500, () => {",
1392 "\t\tvar buf = this.view.el.get_buffer();",
1394 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1397 "\t\tGtk.TextIter iter; ",
1398 "\t\tsbuf.get_iter_at_line(out iter, line);",
1399 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1400 "\t\treturn false;",
1406 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1409 " this.file = file; ",
1411 " if (file.xtype != \"PlainFile\") {",
1412 " \tthis.prop = prop;",
1413 " this.node = node;",
1415 " // find the text for the node..",
1416 " this.view.load( prop.val );",
1417 " this.updateErrorMarks();",
1421 " this.close_btn.el.show(); ",
1424 " this.view.load( file.toSource() );",
1425 " this.updateErrorMarks();",
1426 " this.close_btn.el.hide();",
1427 " var ls = file.getLanguageServer();",
1428 " ls.documentSymbols.begin(file, (a,o) => {",
1429 " \t_this.navigation.show(ls.documentSymbols.end(o)); ",
1431 " //documentSymbols",
1437 "| void updateErrorMarks" : [
1442 "\tvar buf = _this.buffer.el;",
1443 "\tGtk.TextIter start;",
1444 "\tGtk.TextIter end; ",
1445 "\tbuf.get_bounds (out start, out end);",
1450 "\t//GLib.debug(\"highlight errors\");\t\t ",
1452 "\t // we should highlight other types of errors..",
1454 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1456 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1458 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1464 "\tif (_this.file == null) {",
1465 "\t\tGLib.debug(\"file is null?\");",
1469 "\tvar ar = this.file.getErrors();",
1470 "\tif (ar.size < 1) {",
1471 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1472 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1473 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1474 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1475 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1476 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1477 "\t\tthis.last_error_counter = file.error_counter ;",
1478 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1483 " // basicaly check if there is no change, then we do not do any update..",
1484 " // we can do this by just using an error counter?",
1485 " // if that's changed then we will do an update, otherwise dont bother.",
1488 "\tvar offset = 0;",
1489 "\tvar hoffset = 0;",
1491 "\tvar tlines = buf.get_line_count () +1;",
1493 "\tif (_this.prop != null) {",
1494 "\t\t// this still seems flaky...",
1496 "\t\ttlines = _this.prop.end_line;",
1497 "\t\toffset = _this.prop.start_line;",
1498 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1502 "\t\t// no update...",
1503 "\t\tif (this.last_error_counter == file.error_counter) {",
1509 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1510 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1511 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1512 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1513 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1514 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1516 "\tforeach(var diag in ar) { ",
1517 "\t Gtk.TextIter iter;",
1518 "// print(\"get inter\\n\");",
1519 "\t var eline = (int)diag.range.start.line - offset;",
1520 "\t var eline_to = (int)diag.range.end.line - offset;",
1521 "\t //var eline = diag.range.end_line - offset;",
1522 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1523 "\t //\terr.line ,eline, offset);",
1526 "\t if (eline > tlines || eline < 0) {",
1530 "\t buf.get_iter_at_line( out iter, eline);",
1531 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1532 "\t buf.create_source_mark( msg, diag.category, iter);",
1534 " \t var spos = (int)diag.range.start.character - hoffset;",
1535 " \t if (spos < 0) { spos =0 ; }",
1536 " \t if (spos > iter.get_chars_in_line()) {",
1537 " \t \tspos = iter.get_chars_in_line();",
1539 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1540 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1541 " \t if (epos < 0) { epos =0 ; }",
1542 " \t if (epos > iter.get_chars_in_line()) {",
1543 " \t \tepos = iter.get_chars_in_line();",
1547 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1549 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1551 "\t buf.apply_tag_by_name(diag.category, start, end);",
1553 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1554 "\t //this.marks.set(eline, msg);",
1556 "\tthis.last_error_counter = file.error_counter ;",