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,
26 "$ homogeneous" : false,
28 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
29 "bool hexpand" : true,
38 " _this.saveContents();",
47 "bool hexpand" : true,
52 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
55 "\t//this.el.set_range(6,30);",
56 " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
57 " \tBuilderApplication.settings.editor_font_size_updated.connect(",
59 " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
60 " \t\t\tGLib.debug(\"update range\");",
61 " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
62 " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
70 "bool draw_value" : false,
71 "bool has_origin" : true,
72 "bool sensitive" : true,
74 "int width_request" : 200,
78 "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
81 " \tBuilderApplication.settings.editor_font_size = val;",
95 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
96 "string icon_name" : "window-close",
103 " _this.saveContents();",
104 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
109 "string icon_name" : "window-close",
117 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
118 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
119 "bool overlay_scrolling" : false,
120 "bool vexpand" : true,
121 "id" : "RightEditor",
124 "# Gtk.CssProvider css" : "null",
125 "$ gboolean auto_indent" : true,
126 "$ xns" : "GtkSource",
133 "this.el.completion.add_provider(",
134 "\tnew Palete.CompletionProvider(_this)",
137 "//this.el.completion.unblock_interactive();",
138 "this.el.completion.select_on_show = true; // select",
139 "//this.el.completion.remember_info_visibility\t = true;",
142 "var attrs = new GtkSource.MarkAttributes();",
144 "attrs.set_icon_name ( \"process-stop\"); ",
145 "attrs.query_tooltip_text.connect(( mark) => {",
146 " GLib.debug(\"tooltip query? %s\", mark.name);",
147 " return strdup( mark.name);",
149 " attrs.query_tooltip_markup.connect(( mark) => {",
150 " GLib.debug(\"tooltip query? %s\", mark.name);",
151 " return strdup( mark.name);",
153 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
157 "var wattrs = new GtkSource.MarkAttributes();",
158 "wattrs.set_icon_name ( \"process-stop\"); ",
159 "wattrs.query_tooltip_text.connect(( mark) => {",
160 " GLib.debug(\"tooltip query? %s\", mark.name);",
161 " return strdup(mark.name);",
163 "wattrs.query_tooltip_markup.connect(( mark) => {",
164 " GLib.debug(\"tooltip query? %s\", mark.name);",
165 " return strdup(mark.name);",
167 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
171 "var dattrs = new GtkSource.MarkAttributes();",
173 "dattrs.set_icon_name ( \"process-stop\"); ",
175 "dattrs.query_tooltip_text.connect(( mark) => {",
176 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
177 " return strdup(mark.name);",
179 "//dattrs.query_tooltip_markup.connect(( mark) => {",
180 "//\tGLib.debug(\"tooltip query? %s\", mark.name);",
181 " // return strdup(mark.name);",
183 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
186 " this.el.get_space_drawer().set_matrix(null);",
187 " this.el.get_space_drawer().set_types_for_locations( ",
188 "\tGtkSource.SpaceLocationFlags.ALL,",
189 "\tGtkSource.SpaceTypeFlags.ALL",
191 "this.el.get_space_drawer().set_enable_matrix(true);",
195 "bool has_tooltip" : true,
196 "bool hexpand" : true,
197 "bool insert_spaces_instead_of_tabs" : true,
198 "bool vexpand" : true,
199 "boolean show_line_marks" : true,
200 "boolean show_line_numbers" : true,
201 "css_classes" : "{ \"code-editor\" }",
202 "gboolean highlight_current_line" : true,
207 "$ Gee.HashMap<int,string>? xmarks" : "null",
208 "$ xns" : "GtkSource",
209 "$ xtype" : "Buffer",
212 "var buf = this.el;",
213 "buf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
214 "buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
215 "buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
216 "buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
217 "buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
218 "buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
219 "buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
220 "buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
223 "buf.create_tag (\"ERR\", \"weight\", Pango.Weight.BOLD, \"background\", \"pink\");",
224 "buf.create_tag (\"WARN\", \"weight\", Pango.Weight.BOLD, \"background\", \"#ABF4EB\");",
225 "buf.create_tag (\"DEPR\", \"weight\", Pango.Weight.BOLD, \"background\", \"#EEA9FF\");",
231 "bool check_queued" : false,
232 "bool enable_undo" : true,
233 "bool highlight_matching_brackets" : true,
234 "bool highlight_syntax" : true,
236 "int error_line" : "-1",
240 " // check syntax??",
242 " _this.save_button.el.sensitive = true;",
243 " print(\"EDITOR CHANGED\");",
244 " this.checkSyntax();",
246 " _this.dirty = true;",
248 " // this.get('/LeftPanel.model').changed( str , false);",
254 "| bool OLDhighlightErrorsJson" : [
255 "(string type, Json.Object obj) {",
256 "\tGtk.TextIter start;",
257 "\tGtk.TextIter end; ",
258 "\tthis.el.get_bounds (out start, out end);",
260 "\tthis.el.remove_source_marks (start, end, type);",
261 "\tGLib.debug(\"highlight errors\");\t\t ",
263 "\t // we should highlight other types of errors..",
265 "\tif (!obj.has_member(type)) {",
266 "\t\tGLib.debug(\"Return has no errors\\n\");",
270 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
272 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
274 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
279 "\t//this.marks = new Gee.HashMap<int,string>();",
280 "\tvar err = obj.get_object_member(type);",
282 "\tif (_this.file == null) {",
283 "\t\tGLib.debug(\"file is null?\");",
287 "\tvar valafn = _this.file.path;",
289 "\tif (_this.file.xtype != \"PlainFile\") {",
291 "\t\tvalafn = \"\";",
293 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
294 "\t\t\t// should not happen",
295 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
296 "\t\t} catch (GLib.RegexError e) {",
297 "\t\t\treturn true;",
303 "\tif (!err.has_member(valafn)) {",
304 "\t\tGLib.debug(\"File path has no errors\");",
308 "\tvar lines = err.get_object_member(valafn);",
311 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
312 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
316 "\tvar tlines = this.el.get_line_count () +1;",
318 "\tif (_this.prop != null) {",
320 "\t\ttlines = _this.prop.end_line + 1;",
321 "\t\toffset = _this.prop.start_line + 1;",
327 "\tlines.foreach_member((obj, line, node) => {",
329 "\t Gtk.TextIter iter;",
330 "// print(\"get inter\\n\");",
331 "\t var eline = int.parse(line) - offset;",
332 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
335 "\t if (eline > tlines || eline < 0) {",
340 "\t this.el.get_iter_at_line( out iter, eline);",
341 "\t //print(\"mark line\\n\");",
342 "\t var msg = \"\";",
343 "\t var ar = lines.get_array_member(line);",
344 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
345 "\t \tif (ar.get_string_element(i) == \"Success\") {",
348 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
349 "\t\t\tmsg += ar.get_string_element(i);",
351 "\t\tif (msg == \"\") {",
354 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
355 "\t this.el.create_source_mark(msg, type, iter);",
356 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
357 "\t // this.marks.set(eline, msg);",
368 "| bool checkSyntax" : [
372 " var str = this.toString();",
375 " if (this.error_line > 0) {",
376 " Gtk.TextIter start;",
377 " Gtk.TextIter end; ",
378 " this.el.get_bounds (out start, out end);",
380 " this.el.remove_source_marks (start, end, null);",
382 " if (str.length < 1) {",
383 " print(\"checkSyntax - empty string?\\n\");",
387 " // bit presumptiona",
388 " if (_this.file.xtype == \"PlainFile\") {",
390 " // assume it's gtk...",
391 " var oldcode =_this.file.toSource();",
392 " _this.file.setSource(str);",
393 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
394 " \t_this.file.getLanguageServer().document_change(_this.file);",
396 " _this.file.setSource(oldcode);",
402 " if (_this.file == null) {",
410 " GLib.debug(\"calling validate\"); ",
411 " // clear the buttons.",
412 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
415 "\tvar oldcode = _this.prop.val;",
417 "\t_this.prop.val = str;",
418 "\t_this.node.updated_count++;",
419 " _this.file.getLanguageServer().document_change(_this.file);",
420 " _this.node.updated_count++;",
421 " _this.prop.val = oldcode;",
424 " //print(\"done mark line\\n\");",
426 " return true; // at present allow saving - even if it's invalid..",
430 "| bool highlightErrors" : [
431 "( Gee.HashMap<int,string> validate_res) {",
433 "\tthis.error_line = validate_res.size;",
435 "\tif (this.error_line < 1) {",
438 "\tvar tlines = this.el.get_line_count ();",
439 "\tGtk.TextIter iter;",
440 "\tvar valiter = validate_res.map_iterator();",
441 "\twhile (valiter.next()) {",
443 "\t// print(\"get inter\\n\");",
444 "\t\tvar eline = valiter.get_key();",
445 "\t\tif (eline > tlines) {",
448 "\t\tthis.el.get_iter_at_line( out iter, eline);",
449 "\t\t//print(\"mark line\\n\");",
450 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
455 "| string toString" : [
460 " this.el.get_start_iter(out s);",
461 " this.el.get_end_iter(out e);",
462 " var ret = this.el.get_text(s,e,true);",
463 " //print(\"TO STRING? \" + ret);",
473 "(keyval, keycode, state) => {",
476 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
477 " GLib.debug(\"SAVE: ctrl-S pressed\");",
478 " _this.saveContents();",
482 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
483 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
484 "\t\t_this.forwardSearch(true);",
487 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
488 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
489 "\t\t_this.search_entry.el.grab_focus();",
490 "\t\t_this.search_entry.el.select_region(0,-1);",
493 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
494 "\t\t_this.view.el.show_completion();",
497 "\tGtk.TextIter iter;",
498 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
499 "\tvar line = iter.get_line();",
500 "\tvar offset = iter.get_line_offset();",
501 "\tGLib.debug(\"line %d off %d\", line ,offset);",
502 "\tif (_this.prop != null) {",
503 "\t\tline += _this.prop.start_line + 1; // i think..",
504 "\t\toffset += 12; // should probably be 8 without namespaced ",
505 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
507 " //_this.view.el.show_completion();",
508 " // print(event.key.keyval)",
520 "xtype" : "EventControllerKey"
525 "(x, y, keyboard_tooltip, tooltip) => {",
527 "\t//GLib.debug(\"query tooltip\");",
528 "\tGtk.TextIter iter;",
531 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
533 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
535 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
536 "\t//\treturn false;",
539 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
541 "\tvar l = iter.get_line();",
545 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
551 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
552 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
553 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
561 "\t// this crashes?? - not sure why.",
562 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
563 "\tif (marks.is_empty()) {",
564 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
566 "\tif (marks.is_empty()) {",
567 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
570 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
572 "\tmarks.@foreach((m) => { ",
573 "\t\t//GLib.debug(\"got mark %s\", m.name);",
574 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
576 "\t// true if there is a mark..",
577 "\tif (str.length > 0 ) {",
578 "\t\ttooltip.set_text( str );",
580 "\treturn str.length > 0 ? true : false;",
586 "string name" : "editor-view",
587 "uint tab_width" : 4,
592 "// show the help page for the active node..",
593 " //this.get('/Help').show();",
595 " // this.get('/BottomPane').el.set_current_page(0);",
596 " \tGLib.debug(\"load called - Reset undo buffer\");",
598 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
599 " buf.begin_irreversible_action();",
600 " buf.set_text(str, str.length);",
601 " buf.end_irreversible_action();",
603 " var lm = GtkSource.LanguageManager.get_default();",
604 " var lang = \"vala\";",
605 " if (_this.file != null) {",
606 " lang = _this.file.language;",
608 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
609 " var lg = _this.file.content_type.length > 0 ?",
610 " lm.guess_language(_this.file.path, _this.file.content_type) :",
611 " lm.get_language(lang);",
614 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
616 " this.el.insert_spaces_instead_of_tabs = true;",
617 " if (lg != null) {",
618 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
619 "\t\tif (lg.name == \"Vala\") {",
620 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
623 " _this.dirty = false;",
624 " this.el.grab_focus();",
625 " _this.save_button.el.sensitive = false;",
626 " _this.last_error_counter = -1;",
631 "xtype" : "ScrolledWindow"
636 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
637 "bool homogeneous" : false,
638 "bool vexpand" : false,
643 "Gtk.CssProvider css" : "",
644 "bool hexpand" : true,
645 "id" : "search_entry",
651 "(keyval, keycode, state) => {",
653 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
654 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
655 "\t\t_this.forwardSearch(true);",
660 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
661 "\t\t_this.forwardSearch(true);",
667 " // print(event.key.keyval)",
674 "xtype" : "EventControllerKey"
681 "_this.search(_this.search_entry.el.text);",
682 "\t _this.search_results.updateResults();",
684 "\tGLib.Timeout.add_seconds(1,() => {",
685 "\t\t _this.search_results.updateResults();",
686 "\t\t return false;",
692 "string name" : "editor-search-entry",
693 "string placeholder_text" : "Press enter to search",
694 "uint search_delay" : 3,
695 "xtype" : "SearchEntry",
696 "| void forwardSearch" : [
697 "(bool change_focus) {",
700 "\t_this.forwardSearch(change_focus);",
704 "\tswitch(_this.windowstate.state) {",
705 "\t\tcase WindowState.State.CODEONLY:",
706 "\t\t//case WindowState.State.CODE:",
707 "\t\t\t// search the code being edited..",
708 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
711 "\t\tcase WindowState.State.PREVIEW:",
712 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
713 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
715 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
728 "id" : "search_results",
729 "int margin_end" : 4,
730 "int margin_start" : 4,
731 "string label" : "No Results",
733 "| void updateResults" : [
735 "\tthis.el.visible = true;",
737 "\tvar res = _this.searchcontext.get_occurrences_count();",
739 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
743 "\t_this.nextBtn.el.sensitive = false;",
744 "\t_this.backBtn.el.sensitive = false;\t",
747 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
748 "\t\t_this.nextBtn.el.sensitive = true;",
749 "\t\t_this.backBtn.el.sensitive = true;",
752 "\t_this.search_results.el.label = \"No Matches\";",
759 "bool always_show_image" : true,
760 "bool sensitive" : false,
766 "\t_this.forwardSearch(true);",
773 "string icon_name" : "go-down",
778 "bool always_show_image" : true,
779 "bool sensitive" : false,
785 "\t_this.backSearch(true);",
791 "string icon_name" : "go-up",
796 "bool always_show_arrow" : true,
797 "bool always_show_image" : true,
801 "* prop" : "popover",
802 "id" : "search_settings",
807 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
818 "id" : "case_sensitive",
819 "string label" : "Case Sensitive",
820 "xtype" : "CheckButton"
831 "string label" : "Regex",
832 "xtype" : "CheckButton"
837 "string label" : "Multi-line (add \\n)",
838 "xtype" : "CheckButton"
847 "string icon_name" : "emblem-system",
848 "xtype" : "MenuButton"
855 "| bool saveContents" : [
859 " if (_this.file == null) {",
865 " var str = _this.buffer.toString();",
867 " _this.buffer.checkSyntax();",
871 " // LeftPanel.model.changed( str , false);",
872 " _this.dirty = false;",
873 " _this.save_button.el.sensitive = false;",
875 " // find the text for the node..",
876 " if (_this.file.xtype != \"PlainFile\") {",
877 " // in theory these properties have to exist!?!",
878 " \tthis.prop.val = str;",
879 " //this.window.windowstate.left_props.reload();",
881 " _this.file.setSource( str );",
884 " // call the signal..",
894 "\tvar s = new GtkSource.SearchSettings();",
895 "\ts.case_sensitive = _this.case_sensitive.el.active;",
896 "\ts.regex_enabled = _this.regex.el.active;\t",
897 "\ts.wrap_around = false;",
899 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
900 "\tthis.searchcontext.set_highlight(true);",
901 "\tvar txt = in_txt;",
903 "\tif (_this.multiline.el.active) {",
904 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
907 "\ts.set_search_text(txt);",
908 "\tGtk.TextIter beg, st,en;",
910 "\tthis.buffer.el.get_start_iter(out beg);",
911 "\tbool has_wrapped_around;",
912 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
913 "\tthis.last_search_end = 0;",
915 "\treturn this.searchcontext.get_occurrences_count();",
923 "| string tempFileContents" : [
927 " if (_this.file == null) {",
930 "\tvar str= this.buffer.toString();",
931 "\tif (_this.file.xtype == \"PlainFile\") {",
939 " GLib.debug(\"calling validate\"); ",
940 " // clear the buttons.",
941 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
942 "\t\treturn this.file.toSource(); ;",
945 "\tvar oldcode = _this.prop.val;",
946 "\t_this.prop.val = str;",
947 " var ret = _this.file.toSource();",
948 " _this.prop.val = oldcode;",
953 "| void backSearch" : [
954 "(bool change_focus) {",
956 "\tif (this.searchcontext == null) {",
960 "\tGtk.TextIter beg, st,en;",
961 "\tbool has_wrapped_around;",
962 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
964 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
965 "\t\tthis.last_search_end = 0;",
967 "\t\tthis.last_search_end = en.get_offset();",
968 "\t\tif (change_focus) {",
969 "\t\t\tthis.view.el.grab_focus();",
971 "\t\tthis.buffer.el.place_cursor(st);",
972 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
978 "| void forwardSearch" : [
979 "(bool change_focus) {",
981 "\tif (this.searchcontext == null) {",
985 "\tGtk.TextIter beg, st,en;",
986 "\t bool has_wrapped_around;",
987 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
988 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
990 "\t\tthis.last_search_end = 0; // not sure if this should happen",
992 "\t\tif (has_wrapped_around) {",
996 "\t\tthis.last_search_end = en.get_offset();",
997 "\t\tif (change_focus) {",
998 "\t\t\tthis.view.el.grab_focus();",
1000 "\t\tthis.buffer.el.place_cursor(st);",
1001 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1009 "\t this.file = null; ",
1011 " this.node = null;",
1012 " this.prop = null;",
1013 "\tthis.searchcontext = null;",
1018 "| void scroll_to_line" : [
1021 "\tGLib.Timeout.add(500, () => {",
1023 "\t\tvar buf = this.view.el.get_buffer();",
1025 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1028 "\t\tGtk.TextIter iter; ",
1029 "\t\tsbuf.get_iter_at_line(out iter, line);",
1030 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1031 "\t\treturn false;",
1037 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1040 " this.file = file; ",
1042 " if (file.xtype != \"PlainFile\") {",
1043 " \tthis.prop = prop;",
1044 " this.node = node;",
1046 " // find the text for the node..",
1047 " this.view.load( prop.val );",
1048 " this.updateErrorMarks();",
1050 " this.close_btn.el.show(); ",
1053 " this.view.load( file.toSource() );",
1054 " this.updateErrorMarks();",
1055 " this.close_btn.el.hide();",
1061 "| void updateErrorMarks" : [
1066 "\tvar buf = _this.buffer.el;",
1067 "\tGtk.TextIter start;",
1068 "\tGtk.TextIter end; ",
1069 "\tbuf.get_bounds (out start, out end);",
1074 "\t//GLib.debug(\"highlight errors\");\t\t ",
1076 "\t // we should highlight other types of errors..",
1078 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1080 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1082 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1088 "\tif (_this.file == null) {",
1089 "\t\tGLib.debug(\"file is null?\");",
1093 "\tvar ar = this.file.getErrors();",
1094 "\tif (ar.size < 1) {",
1095 "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
1096 "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
1097 "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
1098 "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1099 "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1100 "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1101 "\t\tthis.last_error_counter = file.error_counter ;",
1102 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1107 " // basicaly check if there is no change, then we do not do any update..",
1108 " // we can do this by just using an error counter?",
1109 " // if that's changed then we will do an update, otherwise dont bother.",
1112 "\tvar offset = 0;",
1113 "\tvar hoffset = 0;",
1115 "\tvar tlines = buf.get_line_count () +1;",
1117 "\tif (_this.prop != null) {",
1118 "\t\t// this still seems flaky...",
1120 "\t\ttlines = _this.prop.end_line;",
1121 "\t\toffset = _this.prop.start_line;",
1122 "\t\thoffset = _this.node.node_pad.length + 2; //shift it left by 2 ? ..",
1126 "\t\t// no update...",
1127 "\t\tif (this.last_error_counter == file.error_counter) {",
1133 "\tbuf.remove_source_marks (start, end, \"ERR\");",
1134 "\tbuf.remove_source_marks (start, end, \"WARN\");",
1135 "\tbuf.remove_source_marks (start, end, \"DEPR\");",
1136 "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
1137 "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
1138 "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
1140 "\tforeach(var diag in ar) { ",
1141 "\t Gtk.TextIter iter;",
1142 "// print(\"get inter\\n\");",
1143 "\t var eline = (int)diag.range.start.line - offset;",
1144 "\t var eline_to = (int)diag.range.end.line - offset;",
1145 "\t //var eline = diag.range.end_line - offset;",
1146 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1147 "\t //\terr.line ,eline, offset);",
1150 "\t if (eline > tlines || eline < 0) {",
1154 "\t buf.get_iter_at_line( out iter, eline);",
1155 "\t \tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1156 "\t buf.create_source_mark( msg, diag.category, iter);",
1158 " \t var spos = (int)diag.range.start.character - hoffset;",
1159 " \t if (spos < 0) { spos =0 ; }",
1160 " \t if (spos > iter.get_chars_in_line()) {",
1161 " \t \tspos = iter.get_chars_in_line();",
1163 "\t\tbuf.get_iter_at_line( out iter, eline_to);",
1164 "\t\tvar epos = (int)diag.range.end.character - hoffset;",
1165 " \t if (epos < 0) { epos =0 ; }",
1166 " \t if (epos > iter.get_chars_in_line()) {",
1167 " \t \tepos = iter.get_chars_in_line();",
1171 " \t buf.get_iter_at_line_offset( out start, eline, spos); ",
1173 " \t buf.get_iter_at_line_offset( out end, eline_to,epos); ",
1175 "\t buf.apply_tag_by_name(diag.category, start, end);",
1177 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1178 "\t //this.marks.set(eline, msg);",
1180 "\tthis.last_error_counter = file.error_counter ;",