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 pos_root_x" : "",
14 "# int pos_root_y" : "",
15 "# string activeEditor" : "\"\"",
16 "$ homogeneous" : false,
19 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
20 "bool hexpand" : true,
21 "bool vexpand" : true,
22 "int last_search_end" : 0,
25 "$ homogeneous" : false,
27 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
28 "bool hexpand" : true,
37 " _this.saveContents();",
46 "bool hexpand" : true,
51 "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
54 "\tthis.el.set_range(6,30);",
55 "\tthis.el.set_value(8);",
59 "bool draw_value" : false,
60 "bool has_origin" : true,
61 "bool sensitive" : true,
63 "int width_request" : 200,
69 "\t _this.view.css.load_from_string(",
70 "\t \t\t\"#editor-view { font: %dpx monospace; }\".printf((int)val)",
86 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
87 "string icon_name" : "window-close",
94 " _this.saveContents();",
95 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
100 "string icon_name" : "window-close",
108 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
109 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
110 "bool overlay_scrolling" : false,
111 "bool vexpand" : true,
112 "id" : "RightEditor",
115 "# Gtk.CssProvider css" : "null",
116 "$ gboolean auto_indent" : true,
117 "$ xns" : "GtkSource",
121 "this.css = new Gtk.CssProvider();",
123 "this.css.load_from_string(",
124 "\t\"#editor-view { font: 12px monospace;}\"",
127 "Gtk.StyleContext.add_provider_for_display(",
128 "\tthis.el.get_display(),",
130 "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
136 "this is pretty flakey - triggers Gtk with < 0 d",
137 " var cp = new GtkSource.CompletionWords(\"test\"); ",
138 " cp.minimum_word_size = 3;",
139 " //cp.priority = 100; //?? does this do anything",
140 " cp.proposals_batch_size = 10;",
141 " cp.scan_batch_size = 1000;",
143 "cp.register(_this.buffer.el);",
144 "this.el.completion.add_provider(cp);",
146 "this.el.completion.add_provider(new Palete.CompletionProvider(_this));",
148 "//this.el.completion.unblock_interactive();",
149 "this.el.completion.select_on_show = true; // select",
150 "//this.el.completion.remember_info_visibility\t = true;",
153 "var attrs = new GtkSource.MarkAttributes();",
154 "var pink = Gdk.RGBA();",
155 "pink.parse ( \"pink\");",
156 "attrs.set_background ( pink);",
157 "attrs.set_icon_name ( \"process-stop\"); ",
158 "attrs.query_tooltip_text.connect(( mark) => {",
159 " GLib.debug(\"tooltip query? %s\", mark.name);",
160 " return strdup( mark.name);",
162 " attrs.query_tooltip_markup.connect(( mark) => {",
163 " GLib.debug(\"tooltip query? %s\", mark.name);",
164 " return strdup( mark.name);",
166 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
168 " var wattrs = new GtkSource.MarkAttributes();",
169 "var blue = Gdk.RGBA();",
170 "blue.parse ( \"#ABF4EB\");",
171 "wattrs.set_background ( blue);",
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();",
186 "var purple = Gdk.RGBA();",
187 "purple.parse ( \"#EEA9FF\");",
188 "dattrs.set_background ( purple);",
189 "dattrs.set_icon_name ( \"process-stop\"); ",
190 "dattrs.query_tooltip_text.connect(( mark) => {",
191 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
192 " return strdup(mark.name);",
194 "dattrs.query_tooltip_markup.connect(( mark) => {",
195 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
196 " return strdup(mark.name);",
198 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
201 " this.el.get_space_drawer().set_matrix(null);",
202 " this.el.get_space_drawer().set_types_for_locations( ",
203 "\tGtkSource.SpaceLocationFlags.ALL,",
204 "\tGtkSource.SpaceTypeFlags.ALL",
206 "this.el.get_space_drawer().set_enable_matrix(true);",
210 "bool has_tooltip" : true,
211 "bool hexpand" : true,
212 "bool insert_spaces_instead_of_tabs" : true,
213 "bool vexpand" : true,
214 "boolean show_line_marks" : true,
215 "boolean show_line_numbers" : true,
216 "gboolean highlight_current_line" : true,
221 "$ Gee.HashMap<int,string>? xmarks" : "null",
222 "$ xns" : "GtkSource",
223 "$ xtype" : "Buffer",
226 "\tvar buf = this.el;",
227 "\tbuf.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\");",
240 "bool check_queued" : false,
241 "bool enable_undo" : true,
242 "bool highlight_matching_brackets" : true,
243 "bool highlight_syntax" : true,
245 "int error_line" : "-1",
249 " // check syntax??",
251 " _this.save_button.el.sensitive = true;",
252 " print(\"EDITOR CHANGED\");",
253 " this.checkSyntax();",
255 " _this.dirty = true;",
257 " // this.get('/LeftPanel.model').changed( str , false);",
263 "| bool checkSyntax" : [
267 " var str = this.toString();",
270 " if (this.error_line > 0) {",
271 " Gtk.TextIter start;",
272 " Gtk.TextIter end; ",
273 " this.el.get_bounds (out start, out end);",
275 " this.el.remove_source_marks (start, end, null);",
277 " if (str.length < 1) {",
278 " print(\"checkSyntax - empty string?\\n\");",
282 " // bit presumptiona",
283 " if (_this.file.xtype == \"PlainFile\") {",
285 " // assume it's gtk...",
286 " var oldcode =_this.file.toSource();",
287 " _this.file.setSource(str);",
288 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
289 " \t_this.file.getLanguageServer().document_change(_this.file);",
291 " _this.file.setSource(oldcode);",
297 " if (_this.file == null) {",
305 " GLib.debug(\"calling validate\"); ",
306 " // clear the buttons.",
307 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
310 "\tvar oldcode = _this.prop.val;",
312 "\t_this.prop.val = str;",
313 "\t_this.node.updated_count++;",
314 " _this.file.getLanguageServer().document_change(_this.file);",
315 " _this.node.updated_count++;",
316 " _this.prop.val = oldcode;",
319 " //print(\"done mark line\\n\");",
321 " return true; // at present allow saving - even if it's invalid..",
325 "| bool highlightErrors" : [
326 "( Gee.HashMap<int,string> validate_res) {",
328 "\tthis.error_line = validate_res.size;",
330 "\tif (this.error_line < 1) {",
333 "\tvar tlines = this.el.get_line_count ();",
334 "\tGtk.TextIter iter;",
335 "\tvar valiter = validate_res.map_iterator();",
336 "\twhile (valiter.next()) {",
338 "\t// print(\"get inter\\n\");",
339 "\t\tvar eline = valiter.get_key();",
340 "\t\tif (eline > tlines) {",
343 "\t\tthis.el.get_iter_at_line( out iter, eline);",
344 "\t\t//print(\"mark line\\n\");",
345 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
350 "| bool highlightErrorsJson" : [
351 "(string type, Json.Object obj) {",
352 "\tGtk.TextIter start;",
353 "\tGtk.TextIter end; ",
354 "\tthis.el.get_bounds (out start, out end);",
356 "\tthis.el.remove_source_marks (start, end, type);",
357 "\tGLib.debug(\"highlight errors\");\t\t ",
359 "\t // we should highlight other types of errors..",
361 "\tif (!obj.has_member(type)) {",
362 "\t\tGLib.debug(\"Return has no errors\\n\");",
366 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
368 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
370 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
375 "\t//this.marks = new Gee.HashMap<int,string>();",
376 "\tvar err = obj.get_object_member(type);",
378 "\tif (_this.file == null) {",
379 "\t\tGLib.debug(\"file is null?\");",
383 "\tvar valafn = _this.file.path;",
385 "\tif (_this.file.xtype != \"PlainFile\") {",
387 "\t\tvalafn = \"\";",
389 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
390 "\t\t\t// should not happen",
391 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
392 "\t\t} catch (GLib.RegexError e) {",
393 "\t\t\treturn true;",
399 "\tif (!err.has_member(valafn)) {",
400 "\t\tGLib.debug(\"File path has no errors\");",
404 "\tvar lines = err.get_object_member(valafn);",
407 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
408 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
412 "\tvar tlines = this.el.get_line_count () +1;",
414 "\tif (_this.prop != null) {",
416 "\t\ttlines = _this.prop.end_line + 1;",
417 "\t\toffset = _this.prop.start_line + 1;",
423 "\tlines.foreach_member((obj, line, node) => {",
425 "\t Gtk.TextIter iter;",
426 "// print(\"get inter\\n\");",
427 "\t var eline = int.parse(line) - offset;",
428 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
431 "\t if (eline > tlines || eline < 0) {",
436 "\t this.el.get_iter_at_line( out iter, eline);",
437 "\t //print(\"mark line\\n\");",
438 "\t var msg = \"\";",
439 "\t var ar = lines.get_array_member(line);",
440 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
441 "\t \tif (ar.get_string_element(i) == \"Success\") {",
444 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
445 "\t\t\tmsg += ar.get_string_element(i);",
447 "\t\tif (msg == \"\") {",
450 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
451 "\t this.el.create_source_mark(msg, type, iter);",
452 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
453 "\t // this.marks.set(eline, msg);",
464 "| string toString" : [
469 " this.el.get_start_iter(out s);",
470 " this.el.get_end_iter(out e);",
471 " var ret = this.el.get_text(s,e,true);",
472 " //print(\"TO STRING? \" + ret);",
482 "(keyval, keycode, state) => {",
485 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
486 " GLib.debug(\"SAVE: ctrl-S pressed\");",
487 " _this.saveContents();",
491 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
492 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
493 "\t\t_this.forwardSearch(true);",
496 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
497 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
498 "\t\t_this.search_entry.el.grab_focus();",
499 "\t\t_this.search_entry.el.select_region(0,-1);",
502 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
503 "\t\t_this.view.el.show_completion();",
506 "\tGtk.TextIter iter;",
507 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
508 "\tvar line = iter.get_line();",
509 "\tvar offset = iter.get_line_offset();",
510 "\tGLib.debug(\"line %d off %d\", line ,offset);",
511 "\tif (_this.prop != null) {",
512 "\t\tline += _this.prop.start_line + 1; // i think..",
513 "\t\toffset += 12; // should probably be 8 without namespaced ",
514 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
516 " //_this.view.el.show_completion();",
517 " // print(event.key.keyval)",
529 "xtype" : "EventControllerKey"
534 "(x, y, keyboard_tooltip, tooltip) => {",
536 "\t//GLib.debug(\"query tooltip\");",
537 "\tGtk.TextIter iter;",
540 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
542 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
544 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
545 "\t//\treturn false;",
548 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
550 "\tvar l = iter.get_line();",
554 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
560 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
561 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
562 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
570 "\t// this crashes?? - not sure why.",
571 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
572 "\tif (marks.is_empty()) {",
573 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
575 "\tif (marks.is_empty()) {",
576 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
579 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
581 "\tmarks.@foreach((m) => { ",
582 "\t\t//GLib.debug(\"got mark %s\", m.name);",
583 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
585 "\t// true if there is a mark..",
586 "\tif (str.length > 0 ) {",
587 "\t\ttooltip.set_text( str );",
589 "\treturn str.length > 0 ? true : false;",
595 "string name" : "editor-view",
596 "uint tab_width" : 4,
601 "// show the help page for the active node..",
602 " //this.get('/Help').show();",
604 " // this.get('/BottomPane').el.set_current_page(0);",
605 " \tGLib.debug(\"load called - Reset undo buffer\");",
607 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
608 " buf.begin_irreversible_action();",
609 " buf.set_text(str, str.length);",
610 " buf.end_irreversible_action();",
612 " var lm = GtkSource.LanguageManager.get_default();",
613 " var lang = \"vala\";",
614 " if (_this.file != null) {",
615 " lang = _this.file.language;",
617 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
618 " var lg = _this.file.content_type.length > 0 ?",
619 " lm.guess_language(_this.file.path, _this.file.content_type) :",
620 " lm.get_language(lang);",
623 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
625 " this.el.insert_spaces_instead_of_tabs = true;",
626 " if (lg != null) {",
627 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
628 "\t\tif (lg.name == \"Vala\") {",
629 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
632 " _this.dirty = false;",
633 " this.el.grab_focus();",
634 " _this.save_button.el.sensitive = false;",
639 "xtype" : "ScrolledWindow"
644 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
645 "bool homogeneous" : false,
646 "bool vexpand" : false,
651 "Gtk.CssProvider css" : "",
652 "bool hexpand" : true,
653 "id" : "search_entry",
659 "(keyval, keycode, state) => {",
661 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
662 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
663 "\t\t_this.forwardSearch(true);",
668 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
669 "\t\t_this.forwardSearch(true);",
675 " // print(event.key.keyval)",
682 "xtype" : "EventControllerKey"
689 "_this.search(_this.search_entry.el.text);",
690 "\t _this.search_results.updateResults();",
692 "\tGLib.Timeout.add_seconds(1,() => {",
693 "\t\t _this.search_results.updateResults();",
694 "\t\t return false;",
700 "string name" : "editor-search-entry",
701 "string placeholder_text" : "Press enter to search",
702 "uint search_delay" : 3,
703 "xtype" : "SearchEntry",
704 "| void forwardSearch" : [
705 "(bool change_focus) {",
708 "\t_this.forwardSearch(change_focus);",
712 "\tswitch(_this.windowstate.state) {",
713 "\t\tcase WindowState.State.CODEONLY:",
714 "\t\t//case WindowState.State.CODE:",
715 "\t\t\t// search the code being edited..",
716 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
719 "\t\tcase WindowState.State.PREVIEW:",
720 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
721 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
723 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
736 "id" : "search_results",
737 "int margin_end" : 4,
738 "int margin_start" : 4,
739 "string label" : "No Results",
741 "| void updateResults" : [
743 "\tthis.el.visible = true;",
745 "\tvar res = _this.searchcontext.get_occurrences_count();",
747 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
751 "\t_this.nextBtn.el.sensitive = false;",
752 "\t_this.backBtn.el.sensitive = false;\t",
755 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
756 "\t\t_this.nextBtn.el.sensitive = true;",
757 "\t\t_this.backBtn.el.sensitive = true;",
760 "\t_this.search_results.el.label = \"No Matches\";",
767 "bool always_show_image" : true,
768 "bool sensitive" : false,
774 "\t_this.forwardSearch(true);",
781 "string icon_name" : "go-down",
786 "bool always_show_image" : true,
787 "bool sensitive" : false,
793 "\t_this.backSearch(true);",
799 "string icon_name" : "go-up",
804 "bool always_show_arrow" : true,
805 "bool always_show_image" : true,
809 "* prop" : "popover",
810 "id" : "search_settings",
815 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
826 "id" : "case_sensitive",
827 "string label" : "Case Sensitive",
828 "xtype" : "CheckButton"
839 "string label" : "Regex",
840 "xtype" : "CheckButton"
845 "string label" : "Multi-line (add \\n)",
846 "xtype" : "CheckButton"
855 "string icon_name" : "emblem-system",
856 "xtype" : "MenuButton"
863 "| bool saveContents" : [
867 " if (_this.file == null) {",
873 " var str = _this.buffer.toString();",
875 " _this.buffer.checkSyntax();",
879 " // LeftPanel.model.changed( str , false);",
880 " _this.dirty = false;",
881 " _this.save_button.el.sensitive = false;",
883 " // find the text for the node..",
884 " if (_this.file.xtype != \"PlainFile\") {",
885 " // in theory these properties have to exist!?!",
886 " \tthis.prop.val = str;",
887 " //this.window.windowstate.left_props.reload();",
889 " _this.file.setSource( str );",
892 " // call the signal..",
902 "\tvar s = new GtkSource.SearchSettings();",
903 "\ts.case_sensitive = _this.case_sensitive.el.active;",
904 "\ts.regex_enabled = _this.regex.el.active;\t",
905 "\ts.wrap_around = false;",
907 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
908 "\tthis.searchcontext.set_highlight(true);",
909 "\tvar txt = in_txt;",
911 "\tif (_this.multiline.el.active) {",
912 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
915 "\ts.set_search_text(txt);",
916 "\tGtk.TextIter beg, st,en;",
918 "\tthis.buffer.el.get_start_iter(out beg);",
919 "\tbool has_wrapped_around;",
920 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
921 "\tthis.last_search_end = 0;",
923 "\treturn this.searchcontext.get_occurrences_count();",
931 "| string tempFileContents" : [
935 " if (_this.file == null) {",
938 "\tvar str= this.buffer.toString();",
939 "\tif (_this.file.xtype == \"PlainFile\") {",
947 " GLib.debug(\"calling validate\"); ",
948 " // clear the buttons.",
949 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
950 "\t\treturn this.file.toSource(); ;",
953 "\tvar oldcode = _this.prop.val;",
954 "\t_this.prop.val = str;",
955 " var ret = _this.file.toSource();",
956 " _this.prop.val = oldcode;",
961 "| void backSearch" : [
962 "(bool change_focus) {",
964 "\tif (this.searchcontext == null) {",
968 "\tGtk.TextIter beg, st,en;",
969 "\tbool has_wrapped_around;",
970 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
972 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
973 "\t\tthis.last_search_end = 0;",
975 "\t\tthis.last_search_end = en.get_offset();",
976 "\t\tif (change_focus) {",
977 "\t\t\tthis.view.el.grab_focus();",
979 "\t\tthis.buffer.el.place_cursor(st);",
980 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
986 "| void forwardSearch" : [
987 "(bool change_focus) {",
989 "\tif (this.searchcontext == null) {",
993 "\tGtk.TextIter beg, st,en;",
994 "\t bool has_wrapped_around;",
995 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
996 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
998 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1000 "\t\tif (has_wrapped_around) {",
1004 "\t\tthis.last_search_end = en.get_offset();",
1005 "\t\tif (change_focus) {",
1006 "\t\t\tthis.view.el.grab_focus();",
1008 "\t\tthis.buffer.el.place_cursor(st);",
1009 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1017 "\t this.file = null; ",
1019 " this.node = null;",
1020 " this.prop = null;",
1021 "\tthis.searchcontext = null;",
1026 "| void scroll_to_line" : [
1029 "\tGLib.Timeout.add(500, () => {",
1031 "\t\tvar buf = this.view.el.get_buffer();",
1033 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1036 "\t\tGtk.TextIter iter; ",
1037 "\t\tsbuf.get_iter_at_line(out iter, line);",
1038 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1039 "\t\treturn false;",
1045 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1048 " this.file = file; ",
1050 " if (file.xtype != \"PlainFile\") {",
1051 " \tthis.prop = prop;",
1052 " this.node = node;",
1054 " // find the text for the node..",
1055 " this.view.load( prop.val );",
1058 " this.close_btn.el.show(); ",
1061 " this.view.load( file.toSource() );",
1062 " this.close_btn.el.hide();",
1067 "| void updateErrorMarks" : [
1068 "(string category) {",
1072 "\tvar buf = _this.buffer.el;",
1073 "\tGtk.TextIter start;",
1074 "\tGtk.TextIter end; ",
1075 "\tbuf.get_bounds (out start, out end);",
1077 "\tbuf.remove_source_marks (start, end, category);",
1079 "\t//GLib.debug(\"highlight errors\");\t\t ",
1081 "\t // we should highlight other types of errors..",
1083 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1085 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1087 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1093 "\tif (_this.file == null) {",
1094 "\t\tGLib.debug(\"file is null?\");",
1098 "\tvar ar = this.file.getErrors(category);",
1099 "\tif (ar == null || ar.get_n_items() < 1) {",
1100 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1107 "\tvar offset = 0;",
1110 "\tvar tlines = buf.get_line_count () +1;",
1112 "\tif (_this.prop != null) {",
1113 "\t\t// this still seems flaky...",
1115 "\t\ttlines = _this.prop.end_line;",
1116 "\t\toffset = _this.prop.start_line;",
1120 "\tfor (var i = 0; i < ar.get_n_items();i++) {",
1121 "\t\tvar err = (Palete.CompileError) ar.get_item(i);",
1123 "\t Gtk.TextIter iter;",
1124 "// print(\"get inter\\n\");",
1125 "\t var eline = err.line - offset;",
1126 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1127 "\t //\terr.line ,eline, offset);",
1130 "\t if (eline > tlines || eline < 0) {",
1135 "\t buf.get_iter_at_line( out iter, eline);",
1138 "\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, err.category, err.msg);",
1139 "\t buf.create_source_mark( msg, err.category, iter);",
1140 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1141 "\t //this.marks.set(eline, msg);",