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 " _this.file.getLanguageServer().document_change(_this.file);",
313 " _this.prop.val = oldcode;",
316 " //print(\"done mark line\\n\");",
318 " return true; // at present allow saving - even if it's invalid..",
322 "| bool highlightErrors" : [
323 "( Gee.HashMap<int,string> validate_res) {",
325 "\tthis.error_line = validate_res.size;",
327 "\tif (this.error_line < 1) {",
330 "\tvar tlines = this.el.get_line_count ();",
331 "\tGtk.TextIter iter;",
332 "\tvar valiter = validate_res.map_iterator();",
333 "\twhile (valiter.next()) {",
335 "\t// print(\"get inter\\n\");",
336 "\t\tvar eline = valiter.get_key();",
337 "\t\tif (eline > tlines) {",
340 "\t\tthis.el.get_iter_at_line( out iter, eline);",
341 "\t\t//print(\"mark line\\n\");",
342 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
347 "| bool highlightErrorsJson" : [
348 "(string type, Json.Object obj) {",
349 "\tGtk.TextIter start;",
350 "\tGtk.TextIter end; ",
351 "\tthis.el.get_bounds (out start, out end);",
353 "\tthis.el.remove_source_marks (start, end, type);",
354 "\tGLib.debug(\"highlight errors\");\t\t ",
356 "\t // we should highlight other types of errors..",
358 "\tif (!obj.has_member(type)) {",
359 "\t\tGLib.debug(\"Return has no errors\\n\");",
363 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
365 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
367 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
372 "\t//this.marks = new Gee.HashMap<int,string>();",
373 "\tvar err = obj.get_object_member(type);",
375 "\tif (_this.file == null) {",
376 "\t\tGLib.debug(\"file is null?\");",
380 "\tvar valafn = _this.file.path;",
382 "\tif (_this.file.xtype != \"PlainFile\") {",
384 "\t\tvalafn = \"\";",
386 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
387 "\t\t\t// should not happen",
388 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
389 "\t\t} catch (GLib.RegexError e) {",
390 "\t\t\treturn true;",
396 "\tif (!err.has_member(valafn)) {",
397 "\t\tGLib.debug(\"File path has no errors\");",
401 "\tvar lines = err.get_object_member(valafn);",
404 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
405 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
409 "\tvar tlines = this.el.get_line_count () +1;",
411 "\tif (_this.prop != null) {",
413 "\t\ttlines = _this.prop.end_line + 1;",
414 "\t\toffset = _this.prop.start_line + 1;",
420 "\tlines.foreach_member((obj, line, node) => {",
422 "\t Gtk.TextIter iter;",
423 "// print(\"get inter\\n\");",
424 "\t var eline = int.parse(line) - offset;",
425 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
428 "\t if (eline > tlines || eline < 0) {",
433 "\t this.el.get_iter_at_line( out iter, eline);",
434 "\t //print(\"mark line\\n\");",
435 "\t var msg = \"\";",
436 "\t var ar = lines.get_array_member(line);",
437 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
438 "\t \tif (ar.get_string_element(i) == \"Success\") {",
441 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
442 "\t\t\tmsg += ar.get_string_element(i);",
444 "\t\tif (msg == \"\") {",
447 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
448 "\t this.el.create_source_mark(msg, type, iter);",
449 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
450 "\t // this.marks.set(eline, msg);",
461 "| string toString" : [
466 " this.el.get_start_iter(out s);",
467 " this.el.get_end_iter(out e);",
468 " var ret = this.el.get_text(s,e,true);",
469 " //print(\"TO STRING? \" + ret);",
479 "(keyval, keycode, state) => {",
482 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
483 " GLib.debug(\"SAVE: ctrl-S pressed\");",
484 " _this.saveContents();",
488 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
489 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
490 "\t\t_this.forwardSearch(true);",
493 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
494 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
495 "\t\t_this.search_entry.el.grab_focus();",
496 "\t\t_this.search_entry.el.select_region(0,-1);",
499 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
500 "\t\t_this.view.el.show_completion();",
503 "\tGtk.TextIter iter;",
504 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
505 "\tvar line = iter.get_line();",
506 "\tvar offset = iter.get_line_offset();",
507 "\tGLib.debug(\"line %d off %d\", line ,offset);",
508 "\tif (_this.prop != null) {",
509 "\t\tline += _this.prop.start_line + 1; // i think..",
510 "\t\toffset += 12; // should probably be 8 without namespaced ",
511 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
513 " //_this.view.el.show_completion();",
514 " // print(event.key.keyval)",
526 "xtype" : "EventControllerKey"
531 "(x, y, keyboard_tooltip, tooltip) => {",
533 "\t//GLib.debug(\"query tooltip\");",
534 "\tGtk.TextIter iter;",
537 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
539 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
541 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
542 "\t//\treturn false;",
545 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
547 "\tvar l = iter.get_line();",
551 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
557 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
558 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
559 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
567 "\t// this crashes?? - not sure why.",
568 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
569 "\tif (marks.is_empty()) {",
570 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
572 "\tif (marks.is_empty()) {",
573 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
576 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
578 "\tmarks.@foreach((m) => { ",
579 "\t\t//GLib.debug(\"got mark %s\", m.name);",
580 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
582 "\t// true if there is a mark..",
583 "\tif (str.length > 0 ) {",
584 "\t\ttooltip.set_text( str );",
586 "\treturn str.length > 0 ? true : false;",
592 "string name" : "editor-view",
593 "uint tab_width" : 4,
598 "// show the help page for the active node..",
599 " //this.get('/Help').show();",
601 " // this.get('/BottomPane').el.set_current_page(0);",
602 " \tGLib.debug(\"load called - Reset undo buffer\");",
604 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
605 " buf.begin_irreversible_action();",
606 " buf.set_text(str, str.length);",
607 " buf.end_irreversible_action();",
609 " var lm = GtkSource.LanguageManager.get_default();",
610 " var lang = \"vala\";",
611 " if (_this.file != null) {",
612 " lang = _this.file.language;",
614 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
615 " var lg = _this.file.content_type.length > 0 ?",
616 " lm.guess_language(_this.file.path, _this.file.content_type) :",
617 " lm.get_language(lang);",
620 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
622 " this.el.insert_spaces_instead_of_tabs = true;",
623 " if (lg != null) {",
624 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
625 "\t\tif (lg.name == \"Vala\") {",
626 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
629 " _this.dirty = false;",
630 " this.el.grab_focus();",
631 " _this.save_button.el.sensitive = false;",
636 "xtype" : "ScrolledWindow"
641 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
642 "bool homogeneous" : false,
643 "bool vexpand" : false,
648 "Gtk.CssProvider css" : "",
649 "bool hexpand" : true,
650 "id" : "search_entry",
656 "(keyval, keycode, state) => {",
658 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
659 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
660 "\t\t_this.forwardSearch(true);",
665 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
666 "\t\t_this.forwardSearch(true);",
672 " // print(event.key.keyval)",
679 "xtype" : "EventControllerKey"
686 "_this.search(_this.search_entry.el.text);",
687 "\t _this.search_results.updateResults();",
689 "\tGLib.Timeout.add_seconds(1,() => {",
690 "\t\t _this.search_results.updateResults();",
691 "\t\t return false;",
697 "string name" : "editor-search-entry",
698 "string placeholder_text" : "Press enter to search",
699 "uint search_delay" : 3,
700 "xtype" : "SearchEntry",
701 "| void forwardSearch" : [
702 "(bool change_focus) {",
705 "\t_this.forwardSearch(change_focus);",
709 "\tswitch(_this.windowstate.state) {",
710 "\t\tcase WindowState.State.CODEONLY:",
711 "\t\t//case WindowState.State.CODE:",
712 "\t\t\t// search the code being edited..",
713 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
716 "\t\tcase WindowState.State.PREVIEW:",
717 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
718 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
720 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
733 "id" : "search_results",
734 "int margin_end" : 4,
735 "int margin_start" : 4,
736 "string label" : "No Results",
738 "| void updateResults" : [
740 "\tthis.el.visible = true;",
742 "\tvar res = _this.searchcontext.get_occurrences_count();",
744 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
748 "\t_this.nextBtn.el.sensitive = false;",
749 "\t_this.backBtn.el.sensitive = false;\t",
752 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
753 "\t\t_this.nextBtn.el.sensitive = true;",
754 "\t\t_this.backBtn.el.sensitive = true;",
757 "\t_this.search_results.el.label = \"No Matches\";",
764 "bool always_show_image" : true,
765 "bool sensitive" : false,
771 "\t_this.forwardSearch(true);",
778 "string icon_name" : "go-down",
783 "bool always_show_image" : true,
784 "bool sensitive" : false,
790 "\t_this.backSearch(true);",
796 "string icon_name" : "go-up",
801 "bool always_show_arrow" : true,
802 "bool always_show_image" : true,
806 "* prop" : "popover",
807 "id" : "search_settings",
812 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
823 "id" : "case_sensitive",
824 "string label" : "Case Sensitive",
825 "xtype" : "CheckButton"
836 "string label" : "Regex",
837 "xtype" : "CheckButton"
842 "string label" : "Multi-line (add \\n)",
843 "xtype" : "CheckButton"
852 "string icon_name" : "emblem-system",
853 "xtype" : "MenuButton"
860 "| bool saveContents" : [
864 " if (_this.file == null) {",
870 " var str = _this.buffer.toString();",
872 " _this.buffer.checkSyntax();",
876 " // LeftPanel.model.changed( str , false);",
877 " _this.dirty = false;",
878 " _this.save_button.el.sensitive = false;",
880 " // find the text for the node..",
881 " if (_this.file.xtype != \"PlainFile\") {",
882 " // in theory these properties have to exist!?!",
883 " \tthis.prop.val = str;",
884 " //this.window.windowstate.left_props.reload();",
886 " _this.file.setSource( str );",
889 " // call the signal..",
899 "\tvar s = new GtkSource.SearchSettings();",
900 "\ts.case_sensitive = _this.case_sensitive.el.active;",
901 "\ts.regex_enabled = _this.regex.el.active;\t",
902 "\ts.wrap_around = false;",
904 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
905 "\tthis.searchcontext.set_highlight(true);",
906 "\tvar txt = in_txt;",
908 "\tif (_this.multiline.el.active) {",
909 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
912 "\ts.set_search_text(txt);",
913 "\tGtk.TextIter beg, st,en;",
915 "\tthis.buffer.el.get_start_iter(out beg);",
916 "\tbool has_wrapped_around;",
917 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
918 "\tthis.last_search_end = 0;",
920 "\treturn this.searchcontext.get_occurrences_count();",
928 "| string tempFileContents" : [
932 " if (_this.file == null) {",
935 "\tvar str= this.buffer.toString();",
936 "\tif (_this.file.xtype == \"PlainFile\") {",
944 " GLib.debug(\"calling validate\"); ",
945 " // clear the buttons.",
946 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
947 "\t\treturn this.file.toSource(); ;",
950 "\tvar oldcode = _this.prop.val;",
951 "\t_this.prop.val = str;",
952 " var ret = _this.file.toSource();",
953 " _this.prop.val = oldcode;",
958 "| void backSearch" : [
959 "(bool change_focus) {",
961 "\tif (this.searchcontext == null) {",
965 "\tGtk.TextIter beg, st,en;",
966 "\tbool has_wrapped_around;",
967 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
969 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
970 "\t\tthis.last_search_end = 0;",
972 "\t\tthis.last_search_end = en.get_offset();",
973 "\t\tif (change_focus) {",
974 "\t\t\tthis.view.el.grab_focus();",
976 "\t\tthis.buffer.el.place_cursor(st);",
977 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
983 "| void forwardSearch" : [
984 "(bool change_focus) {",
986 "\tif (this.searchcontext == null) {",
990 "\tGtk.TextIter beg, st,en;",
991 "\t bool has_wrapped_around;",
992 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
993 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
995 "\t\tthis.last_search_end = 0; // not sure if this should happen",
997 "\t\tif (has_wrapped_around) {",
1001 "\t\tthis.last_search_end = en.get_offset();",
1002 "\t\tif (change_focus) {",
1003 "\t\t\tthis.view.el.grab_focus();",
1005 "\t\tthis.buffer.el.place_cursor(st);",
1006 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1014 "\t this.file = null; ",
1016 " this.node = null;",
1017 " this.prop = null;",
1018 "\tthis.searchcontext = null;",
1023 "| void scroll_to_line" : [
1026 "\tGLib.Timeout.add(500, () => {",
1028 "\t\tvar buf = this.view.el.get_buffer();",
1030 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1033 "\t\tGtk.TextIter iter; ",
1034 "\t\tsbuf.get_iter_at_line(out iter, line);",
1035 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1036 "\t\treturn false;",
1042 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1045 " this.file = file; ",
1047 " if (file.xtype != \"PlainFile\") {",
1048 " \tthis.prop = prop;",
1049 " this.node = node;",
1051 " // find the text for the node..",
1052 " this.view.load( prop.val );",
1055 " this.close_btn.el.show(); ",
1058 " this.view.load( file.toSource() );",
1059 " this.close_btn.el.hide();",
1064 "| void updateErrorMarks" : [
1065 "(string category) {",
1069 "\tvar buf = _this.buffer.el;",
1070 "\tGtk.TextIter start;",
1071 "\tGtk.TextIter end; ",
1072 "\tbuf.get_bounds (out start, out end);",
1074 "\tbuf.remove_source_marks (start, end, category);",
1076 "\t//GLib.debug(\"highlight errors\");\t\t ",
1078 "\t // we should highlight other types of errors..",
1080 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1082 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1084 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1090 "\tif (_this.file == null) {",
1091 "\t\tGLib.debug(\"file is null?\");",
1095 "\tvar ar = this.file.getErrors(category);",
1096 "\tif (ar == null || ar.get_n_items() < 1) {",
1097 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1104 "\tvar offset = 0;",
1107 "\tvar tlines = buf.get_line_count () +1;",
1109 "\tif (_this.prop != null) {",
1110 "\t\t// this still seems flaky...",
1112 "\t\ttlines = _this.prop.end_line;",
1113 "\t\toffset = _this.prop.start_line;",
1117 "\tfor (var i = 0; i < ar.get_n_items();i++) {",
1118 "\t\tvar err = (Palete.CompileError) ar.get_item(i);",
1120 "\t Gtk.TextIter iter;",
1121 "// print(\"get inter\\n\");",
1122 "\t var eline = err.line - offset;",
1123 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1124 "\t //\terr.line ,eline, offset);",
1127 "\t if (eline > tlines || eline < 0) {",
1132 "\t buf.get_iter_at_line( out iter, eline);",
1135 "\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, err.category, err.msg);",
1136 "\t buf.create_source_mark( msg, err.category, iter);",
1137 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1138 "\t //this.marks.set(eline, msg);",