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 " _this.file.getLanguageServer().document_change(_this.file);",
289 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
290 " _this.file.setSource(oldcode);",
296 " if (_this.file == null) {",
304 " GLib.debug(\"calling validate\"); ",
305 " // clear the buttons.",
306 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
309 "\tvar oldcode = _this.prop.val;",
311 "\t_this.prop.val = str;",
312 "\t_this.node.updated_count++;",
313 " _this.file.getLanguageServer().document_change(_this.file);",
314 " _this.node.updated_count++;",
315 " _this.prop.val = oldcode;",
318 " //print(\"done mark line\\n\");",
320 " return true; // at present allow saving - even if it's invalid..",
324 "| bool highlightErrors" : [
325 "( Gee.HashMap<int,string> validate_res) {",
327 "\tthis.error_line = validate_res.size;",
329 "\tif (this.error_line < 1) {",
332 "\tvar tlines = this.el.get_line_count ();",
333 "\tGtk.TextIter iter;",
334 "\tvar valiter = validate_res.map_iterator();",
335 "\twhile (valiter.next()) {",
337 "\t// print(\"get inter\\n\");",
338 "\t\tvar eline = valiter.get_key();",
339 "\t\tif (eline > tlines) {",
342 "\t\tthis.el.get_iter_at_line( out iter, eline);",
343 "\t\t//print(\"mark line\\n\");",
344 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
349 "| bool highlightErrorsJson" : [
350 "(string type, Json.Object obj) {",
351 "\tGtk.TextIter start;",
352 "\tGtk.TextIter end; ",
353 "\tthis.el.get_bounds (out start, out end);",
355 "\tthis.el.remove_source_marks (start, end, type);",
356 "\tGLib.debug(\"highlight errors\");\t\t ",
358 "\t // we should highlight other types of errors..",
360 "\tif (!obj.has_member(type)) {",
361 "\t\tGLib.debug(\"Return has no errors\\n\");",
365 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
367 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
369 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
374 "\t//this.marks = new Gee.HashMap<int,string>();",
375 "\tvar err = obj.get_object_member(type);",
377 "\tif (_this.file == null) {",
378 "\t\tGLib.debug(\"file is null?\");",
382 "\tvar valafn = _this.file.path;",
384 "\tif (_this.file.xtype != \"PlainFile\") {",
386 "\t\tvalafn = \"\";",
388 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
389 "\t\t\t// should not happen",
390 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
391 "\t\t} catch (GLib.RegexError e) {",
392 "\t\t\treturn true;",
398 "\tif (!err.has_member(valafn)) {",
399 "\t\tGLib.debug(\"File path has no errors\");",
403 "\tvar lines = err.get_object_member(valafn);",
406 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
407 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
411 "\tvar tlines = this.el.get_line_count () +1;",
413 "\tif (_this.prop != null) {",
415 "\t\ttlines = _this.prop.end_line + 1;",
416 "\t\toffset = _this.prop.start_line + 1;",
422 "\tlines.foreach_member((obj, line, node) => {",
424 "\t Gtk.TextIter iter;",
425 "// print(\"get inter\\n\");",
426 "\t var eline = int.parse(line) - offset;",
427 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
430 "\t if (eline > tlines || eline < 0) {",
435 "\t this.el.get_iter_at_line( out iter, eline);",
436 "\t //print(\"mark line\\n\");",
437 "\t var msg = \"\";",
438 "\t var ar = lines.get_array_member(line);",
439 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
440 "\t \tif (ar.get_string_element(i) == \"Success\") {",
443 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
444 "\t\t\tmsg += ar.get_string_element(i);",
446 "\t\tif (msg == \"\") {",
449 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
450 "\t this.el.create_source_mark(msg, type, iter);",
451 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
452 "\t // this.marks.set(eline, msg);",
463 "| string toString" : [
468 " this.el.get_start_iter(out s);",
469 " this.el.get_end_iter(out e);",
470 " var ret = this.el.get_text(s,e,true);",
471 " //print(\"TO STRING? \" + ret);",
481 "(keyval, keycode, state) => {",
484 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
485 " GLib.debug(\"SAVE: ctrl-S pressed\");",
486 " _this.saveContents();",
490 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
491 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
492 "\t\t_this.forwardSearch(true);",
495 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
496 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
497 "\t\t_this.search_entry.el.grab_focus();",
498 "\t\t_this.search_entry.el.select_region(0,-1);",
501 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
502 "\t\t_this.view.el.show_completion();",
505 "\tGtk.TextIter iter;",
506 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
507 "\tvar line = iter.get_line();",
508 "\tvar offset = iter.get_line_offset();",
509 "\tGLib.debug(\"line %d off %d\", line ,offset);",
510 "\tif (_this.prop != null) {",
511 "\t\tline += _this.prop.start_line + 1; // i think..",
512 "\t\toffset += 12; // should probably be 8 without namespaced ",
513 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
515 " //_this.view.el.show_completion();",
516 " // print(event.key.keyval)",
528 "xtype" : "EventControllerKey"
533 "(x, y, keyboard_tooltip, tooltip) => {",
535 "\t//GLib.debug(\"query tooltip\");",
536 "\tGtk.TextIter iter;",
539 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
541 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
543 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
544 "\t//\treturn false;",
547 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
549 "\tvar l = iter.get_line();",
553 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
559 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
560 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
561 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
569 "\t// this crashes?? - not sure why.",
570 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
571 "\tif (marks.is_empty()) {",
572 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
574 "\tif (marks.is_empty()) {",
575 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
578 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
580 "\tmarks.@foreach((m) => { ",
581 "\t\t//GLib.debug(\"got mark %s\", m.name);",
582 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
584 "\t// true if there is a mark..",
585 "\tif (str.length > 0 ) {",
586 "\t\ttooltip.set_text( str );",
588 "\treturn str.length > 0 ? true : false;",
594 "string name" : "editor-view",
595 "uint tab_width" : 4,
600 "// show the help page for the active node..",
601 " //this.get('/Help').show();",
603 " // this.get('/BottomPane').el.set_current_page(0);",
604 " \tGLib.debug(\"load called - Reset undo buffer\");",
606 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
607 " buf.begin_irreversible_action();",
608 " buf.set_text(str, str.length);",
609 " buf.end_irreversible_action();",
611 " var lm = GtkSource.LanguageManager.get_default();",
612 " var lang = \"vala\";",
613 " if (_this.file != null) {",
614 " lang = _this.file.language;",
616 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
617 " var lg = _this.file.content_type.length > 0 ?",
618 " lm.guess_language(_this.file.path, _this.file.content_type) :",
619 " lm.get_language(lang);",
622 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
624 " this.el.insert_spaces_instead_of_tabs = true;",
625 " if (lg != null) {",
626 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
627 "\t\tif (lg.name == \"Vala\") {",
628 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
631 " _this.dirty = false;",
632 " this.el.grab_focus();",
633 " _this.save_button.el.sensitive = false;",
638 "xtype" : "ScrolledWindow"
643 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
644 "bool homogeneous" : false,
645 "bool vexpand" : false,
650 "Gtk.CssProvider css" : "",
651 "bool hexpand" : true,
652 "id" : "search_entry",
658 "(keyval, keycode, state) => {",
660 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
661 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
662 "\t\t_this.forwardSearch(true);",
667 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
668 "\t\t_this.forwardSearch(true);",
674 " // print(event.key.keyval)",
681 "xtype" : "EventControllerKey"
688 "_this.search(_this.search_entry.el.text);",
689 "\t _this.search_results.updateResults();",
691 "\tGLib.Timeout.add_seconds(1,() => {",
692 "\t\t _this.search_results.updateResults();",
693 "\t\t return false;",
699 "string name" : "editor-search-entry",
700 "string placeholder_text" : "Press enter to search",
701 "uint search_delay" : 3,
702 "xtype" : "SearchEntry",
703 "| void forwardSearch" : [
704 "(bool change_focus) {",
707 "\t_this.forwardSearch(change_focus);",
711 "\tswitch(_this.windowstate.state) {",
712 "\t\tcase WindowState.State.CODEONLY:",
713 "\t\t//case WindowState.State.CODE:",
714 "\t\t\t// search the code being edited..",
715 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
718 "\t\tcase WindowState.State.PREVIEW:",
719 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
720 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
722 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
735 "id" : "search_results",
736 "int margin_end" : 4,
737 "int margin_start" : 4,
738 "string label" : "No Results",
740 "| void updateResults" : [
742 "\tthis.el.visible = true;",
744 "\tvar res = _this.searchcontext.get_occurrences_count();",
746 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
750 "\t_this.nextBtn.el.sensitive = false;",
751 "\t_this.backBtn.el.sensitive = false;\t",
754 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
755 "\t\t_this.nextBtn.el.sensitive = true;",
756 "\t\t_this.backBtn.el.sensitive = true;",
759 "\t_this.search_results.el.label = \"No Matches\";",
766 "bool always_show_image" : true,
767 "bool sensitive" : false,
773 "\t_this.forwardSearch(true);",
780 "string icon_name" : "go-down",
785 "bool always_show_image" : true,
786 "bool sensitive" : false,
792 "\t_this.backSearch(true);",
798 "string icon_name" : "go-up",
803 "bool always_show_arrow" : true,
804 "bool always_show_image" : true,
808 "* prop" : "popover",
809 "id" : "search_settings",
814 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
825 "id" : "case_sensitive",
826 "string label" : "Case Sensitive",
827 "xtype" : "CheckButton"
838 "string label" : "Regex",
839 "xtype" : "CheckButton"
844 "string label" : "Multi-line (add \\n)",
845 "xtype" : "CheckButton"
854 "string icon_name" : "emblem-system",
855 "xtype" : "MenuButton"
862 "| bool saveContents" : [
866 " if (_this.file == null) {",
872 " var str = _this.buffer.toString();",
874 " _this.buffer.checkSyntax();",
878 " // LeftPanel.model.changed( str , false);",
879 " _this.dirty = false;",
880 " _this.save_button.el.sensitive = false;",
882 " // find the text for the node..",
883 " if (_this.file.xtype != \"PlainFile\") {",
884 " // in theory these properties have to exist!?!",
885 " \tthis.prop.val = str;",
886 " //this.window.windowstate.left_props.reload();",
888 " _this.file.setSource( str );",
891 " // call the signal..",
901 "\tvar s = new GtkSource.SearchSettings();",
902 "\ts.case_sensitive = _this.case_sensitive.el.active;",
903 "\ts.regex_enabled = _this.regex.el.active;\t",
904 "\ts.wrap_around = false;",
906 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
907 "\tthis.searchcontext.set_highlight(true);",
908 "\tvar txt = in_txt;",
910 "\tif (_this.multiline.el.active) {",
911 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
914 "\ts.set_search_text(txt);",
915 "\tGtk.TextIter beg, st,en;",
917 "\tthis.buffer.el.get_start_iter(out beg);",
918 "\tbool has_wrapped_around;",
919 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
920 "\tthis.last_search_end = 0;",
922 "\treturn this.searchcontext.get_occurrences_count();",
930 "| string tempFileContents" : [
934 " if (_this.file == null) {",
937 "\tvar str= this.buffer.toString();",
938 "\tif (_this.file.xtype == \"PlainFile\") {",
946 " GLib.debug(\"calling validate\"); ",
947 " // clear the buttons.",
948 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
949 "\t\treturn this.file.toSource(); ;",
952 "\tvar oldcode = _this.prop.val;",
953 "\t_this.prop.val = str;",
954 " var ret = _this.file.toSource();",
955 " _this.prop.val = oldcode;",
960 "| void backSearch" : [
961 "(bool change_focus) {",
963 "\tif (this.searchcontext == null) {",
967 "\tGtk.TextIter beg, st,en;",
968 "\tbool has_wrapped_around;",
969 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
971 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
972 "\t\tthis.last_search_end = 0;",
974 "\t\tthis.last_search_end = en.get_offset();",
975 "\t\tif (change_focus) {",
976 "\t\t\tthis.view.el.grab_focus();",
978 "\t\tthis.buffer.el.place_cursor(st);",
979 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
985 "| void forwardSearch" : [
986 "(bool change_focus) {",
988 "\tif (this.searchcontext == null) {",
992 "\tGtk.TextIter beg, st,en;",
993 "\t bool has_wrapped_around;",
994 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
995 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
997 "\t\tthis.last_search_end = 0; // not sure if this should happen",
999 "\t\tif (has_wrapped_around) {",
1003 "\t\tthis.last_search_end = en.get_offset();",
1004 "\t\tif (change_focus) {",
1005 "\t\t\tthis.view.el.grab_focus();",
1007 "\t\tthis.buffer.el.place_cursor(st);",
1008 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1016 "\t this.file = null; ",
1018 " this.node = null;",
1019 " this.prop = null;",
1020 "\tthis.searchcontext = null;",
1025 "| void scroll_to_line" : [
1028 "\tGLib.Timeout.add(500, () => {",
1030 "\t\tvar buf = this.view.el.get_buffer();",
1032 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1035 "\t\tGtk.TextIter iter; ",
1036 "\t\tsbuf.get_iter_at_line(out iter, line);",
1037 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1038 "\t\treturn false;",
1044 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1047 " this.file = file; ",
1049 " if (file.xtype != \"PlainFile\") {",
1050 " \tthis.prop = prop;",
1051 " this.node = node;",
1053 " // find the text for the node..",
1054 " this.view.load( prop.val );",
1057 " this.close_btn.el.show(); ",
1060 " this.view.load( file.toSource() );",
1061 " this.close_btn.el.hide();",
1066 "| void updateErrorMarks" : [
1067 "(string category) {",
1071 "\tvar buf = _this.buffer.el;",
1072 "\tGtk.TextIter start;",
1073 "\tGtk.TextIter end; ",
1074 "\tbuf.get_bounds (out start, out end);",
1076 "\tbuf.remove_source_marks (start, end, category);",
1078 "\t//GLib.debug(\"highlight errors\");\t\t ",
1080 "\t // we should highlight other types of errors..",
1082 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1084 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1086 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1092 "\tif (_this.file == null) {",
1093 "\t\tGLib.debug(\"file is null?\");",
1097 "\tvar ar = this.file.getErrors(category);",
1098 "\tif (ar == null || ar.get_n_items() < 1) {",
1099 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1106 "\tvar offset = 0;",
1109 "\tvar tlines = buf.get_line_count () +1;",
1111 "\tif (_this.prop != null) {",
1112 "\t\t// this still seems flaky...",
1114 "\t\ttlines = _this.prop.end_line;",
1115 "\t\toffset = _this.prop.start_line;",
1119 "\tfor (var i = 0; i < ar.get_n_items();i++) {",
1120 "\t\tvar err = (Palete.CompileError) ar.get_item(i);",
1122 "\t Gtk.TextIter iter;",
1123 "// print(\"get inter\\n\");",
1124 "\t var eline = err.line - offset;",
1125 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1126 "\t //\terr.line ,eline, offset);",
1129 "\t if (eline > tlines || eline < 0) {",
1134 "\t buf.get_iter_at_line( out iter, eline);",
1137 "\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, err.category, err.msg);",
1138 "\t buf.create_source_mark( msg, err.category, iter);",
1139 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1140 "\t //this.marks.set(eline, msg);",