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 "\tthis.el.set_range(6,30);",
56 "\tthis.el.set_value(8);",
60 "bool draw_value" : false,
61 "bool has_origin" : true,
62 "bool sensitive" : true,
64 "int width_request" : 200,
70 "\t _this.view.css.load_from_string(",
71 "\t \t\t\"#editor-view { font: %dpx monospace; }\".printf((int)val)",
87 "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
88 "string icon_name" : "window-close",
95 " _this.saveContents();",
96 " _this.window.windowstate.switchState(WindowState.State.PREVIEW);",
101 "string icon_name" : "window-close",
109 "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
110 "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
111 "bool overlay_scrolling" : false,
112 "bool vexpand" : true,
113 "id" : "RightEditor",
116 "# Gtk.CssProvider css" : "null",
117 "$ gboolean auto_indent" : true,
118 "$ xns" : "GtkSource",
122 "this.css = new Gtk.CssProvider();",
124 "this.css.load_from_string(",
125 "\t\"#editor-view { font: 12px monospace;}\"",
128 "Gtk.StyleContext.add_provider_for_display(",
129 "\tthis.el.get_display(),",
131 "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
137 "this is pretty flakey - triggers Gtk with < 0 d",
138 " var cp = new GtkSource.CompletionWords(\"test\"); ",
139 " cp.minimum_word_size = 3;",
140 " //cp.priority = 100; //?? does this do anything",
141 " cp.proposals_batch_size = 10;",
142 " cp.scan_batch_size = 1000;",
144 "cp.register(_this.buffer.el);",
145 "this.el.completion.add_provider(cp);",
147 "this.el.completion.add_provider(new Palete.CompletionProvider(_this));",
149 "//this.el.completion.unblock_interactive();",
150 "this.el.completion.select_on_show = true; // select",
151 "//this.el.completion.remember_info_visibility\t = true;",
154 "var attrs = new GtkSource.MarkAttributes();",
155 "var pink = Gdk.RGBA();",
156 "pink.parse ( \"pink\");",
157 "attrs.set_background ( pink);",
158 "attrs.set_icon_name ( \"process-stop\"); ",
159 "attrs.query_tooltip_text.connect(( mark) => {",
160 " GLib.debug(\"tooltip query? %s\", mark.name);",
161 " return strdup( mark.name);",
163 " attrs.query_tooltip_markup.connect(( mark) => {",
164 " GLib.debug(\"tooltip query? %s\", mark.name);",
165 " return strdup( mark.name);",
167 "this.el.set_mark_attributes (\"ERR\", attrs, 1);",
169 " var wattrs = new GtkSource.MarkAttributes();",
170 "var blue = Gdk.RGBA();",
171 "blue.parse ( \"#ABF4EB\");",
172 "wattrs.set_background ( blue);",
173 "wattrs.set_icon_name ( \"process-stop\"); ",
174 "wattrs.query_tooltip_text.connect(( mark) => {",
175 " GLib.debug(\"tooltip query? %s\", mark.name);",
176 " return strdup(mark.name);",
178 "wattrs.query_tooltip_markup.connect(( mark) => {",
179 " GLib.debug(\"tooltip query? %s\", mark.name);",
180 " return strdup(mark.name);",
182 "this.el.set_mark_attributes (\"WARN\", wattrs, 1);",
186 " var dattrs = new GtkSource.MarkAttributes();",
187 "var purple = Gdk.RGBA();",
188 "purple.parse ( \"#EEA9FF\");",
189 "dattrs.set_background ( purple);",
190 "dattrs.set_icon_name ( \"process-stop\"); ",
191 "dattrs.query_tooltip_text.connect(( mark) => {",
192 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
193 " return strdup(mark.name);",
195 "dattrs.query_tooltip_markup.connect(( mark) => {",
196 "\tGLib.debug(\"tooltip query? %s\", mark.name);",
197 " return strdup(mark.name);",
199 "this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
202 " this.el.get_space_drawer().set_matrix(null);",
203 " this.el.get_space_drawer().set_types_for_locations( ",
204 "\tGtkSource.SpaceLocationFlags.ALL,",
205 "\tGtkSource.SpaceTypeFlags.ALL",
207 "this.el.get_space_drawer().set_enable_matrix(true);",
211 "bool has_tooltip" : true,
212 "bool hexpand" : true,
213 "bool insert_spaces_instead_of_tabs" : true,
214 "bool vexpand" : true,
215 "boolean show_line_marks" : true,
216 "boolean show_line_numbers" : true,
217 "gboolean highlight_current_line" : true,
222 "$ Gee.HashMap<int,string>? xmarks" : "null",
223 "$ xns" : "GtkSource",
224 "$ xtype" : "Buffer",
227 "\tvar buf = this.el;",
228 "\tbuf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
229 " buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
230 " buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
231 " buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
232 " buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
233 " buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
234 " buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
235 " buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
241 "bool check_queued" : false,
242 "bool enable_undo" : true,
243 "bool highlight_matching_brackets" : true,
244 "bool highlight_syntax" : true,
246 "int error_line" : "-1",
250 " // check syntax??",
252 " _this.save_button.el.sensitive = true;",
253 " print(\"EDITOR CHANGED\");",
254 " this.checkSyntax();",
256 " _this.dirty = true;",
258 " // this.get('/LeftPanel.model').changed( str , false);",
264 "| bool checkSyntax" : [
268 " var str = this.toString();",
271 " if (this.error_line > 0) {",
272 " Gtk.TextIter start;",
273 " Gtk.TextIter end; ",
274 " this.el.get_bounds (out start, out end);",
276 " this.el.remove_source_marks (start, end, null);",
278 " if (str.length < 1) {",
279 " print(\"checkSyntax - empty string?\\n\");",
283 " // bit presumptiona",
284 " if (_this.file.xtype == \"PlainFile\") {",
286 " // assume it's gtk...",
287 " var oldcode =_this.file.toSource();",
288 " _this.file.setSource(str);",
289 "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
290 " \t_this.file.getLanguageServer().document_change(_this.file);",
292 " _this.file.setSource(oldcode);",
298 " if (_this.file == null) {",
306 " GLib.debug(\"calling validate\"); ",
307 " // clear the buttons.",
308 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
311 "\tvar oldcode = _this.prop.val;",
313 "\t_this.prop.val = str;",
314 "\t_this.node.updated_count++;",
315 " _this.file.getLanguageServer().document_change(_this.file);",
316 " _this.node.updated_count++;",
317 " _this.prop.val = oldcode;",
320 " //print(\"done mark line\\n\");",
322 " return true; // at present allow saving - even if it's invalid..",
326 "| bool highlightErrors" : [
327 "( Gee.HashMap<int,string> validate_res) {",
329 "\tthis.error_line = validate_res.size;",
331 "\tif (this.error_line < 1) {",
334 "\tvar tlines = this.el.get_line_count ();",
335 "\tGtk.TextIter iter;",
336 "\tvar valiter = validate_res.map_iterator();",
337 "\twhile (valiter.next()) {",
339 "\t// print(\"get inter\\n\");",
340 "\t\tvar eline = valiter.get_key();",
341 "\t\tif (eline > tlines) {",
344 "\t\tthis.el.get_iter_at_line( out iter, eline);",
345 "\t\t//print(\"mark line\\n\");",
346 "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
351 "| bool highlightErrorsJson" : [
352 "(string type, Json.Object obj) {",
353 "\tGtk.TextIter start;",
354 "\tGtk.TextIter end; ",
355 "\tthis.el.get_bounds (out start, out end);",
357 "\tthis.el.remove_source_marks (start, end, type);",
358 "\tGLib.debug(\"highlight errors\");\t\t ",
360 "\t // we should highlight other types of errors..",
362 "\tif (!obj.has_member(type)) {",
363 "\t\tGLib.debug(\"Return has no errors\\n\");",
367 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
369 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
371 "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
376 "\t//this.marks = new Gee.HashMap<int,string>();",
377 "\tvar err = obj.get_object_member(type);",
379 "\tif (_this.file == null) {",
380 "\t\tGLib.debug(\"file is null?\");",
384 "\tvar valafn = _this.file.path;",
386 "\tif (_this.file.xtype != \"PlainFile\") {",
388 "\t\tvalafn = \"\";",
390 "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
391 "\t\t\t// should not happen",
392 "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
393 "\t\t} catch (GLib.RegexError e) {",
394 "\t\t\treturn true;",
400 "\tif (!err.has_member(valafn)) {",
401 "\t\tGLib.debug(\"File path has no errors\");",
405 "\tvar lines = err.get_object_member(valafn);",
408 "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
409 "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
413 "\tvar tlines = this.el.get_line_count () +1;",
415 "\tif (_this.prop != null) {",
417 "\t\ttlines = _this.prop.end_line + 1;",
418 "\t\toffset = _this.prop.start_line + 1;",
424 "\tlines.foreach_member((obj, line, node) => {",
426 "\t Gtk.TextIter iter;",
427 "// print(\"get inter\\n\");",
428 "\t var eline = int.parse(line) - offset;",
429 "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
432 "\t if (eline > tlines || eline < 0) {",
437 "\t this.el.get_iter_at_line( out iter, eline);",
438 "\t //print(\"mark line\\n\");",
439 "\t var msg = \"\";",
440 "\t var ar = lines.get_array_member(line);",
441 "\t for (var i = 0 ; i < ar.get_length(); i++) {",
442 "\t \tif (ar.get_string_element(i) == \"Success\") {",
445 "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
446 "\t\t\tmsg += ar.get_string_element(i);",
448 "\t\tif (msg == \"\") {",
451 "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
452 "\t this.el.create_source_mark(msg, type, iter);",
453 "\t GLib.debug(\"set line %d to %m\", eline, msg);",
454 "\t // this.marks.set(eline, msg);",
465 "| string toString" : [
470 " this.el.get_start_iter(out s);",
471 " this.el.get_end_iter(out e);",
472 " var ret = this.el.get_text(s,e,true);",
473 " //print(\"TO STRING? \" + ret);",
483 "(keyval, keycode, state) => {",
486 " if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
487 " GLib.debug(\"SAVE: ctrl-S pressed\");",
488 " _this.saveContents();",
492 " if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
493 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
494 "\t\t_this.forwardSearch(true);",
497 "\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
498 "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
499 "\t\t_this.search_entry.el.grab_focus();",
500 "\t\t_this.search_entry.el.select_region(0,-1);",
503 "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
504 "\t\t_this.view.el.show_completion();",
507 "\tGtk.TextIter iter;",
508 "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
509 "\tvar line = iter.get_line();",
510 "\tvar offset = iter.get_line_offset();",
511 "\tGLib.debug(\"line %d off %d\", line ,offset);",
512 "\tif (_this.prop != null) {",
513 "\t\tline += _this.prop.start_line + 1; // i think..",
514 "\t\toffset += 12; // should probably be 8 without namespaced ",
515 "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
517 " //_this.view.el.show_completion();",
518 " // print(event.key.keyval)",
530 "xtype" : "EventControllerKey"
535 "(x, y, keyboard_tooltip, tooltip) => {",
537 "\t//GLib.debug(\"query tooltip\");",
538 "\tGtk.TextIter iter;",
541 "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
543 "\t// I think this is problematic - if it's compliing / updating at same time as query.",
545 "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
546 "\t//\treturn false;",
549 "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
551 "\tvar l = iter.get_line();",
555 "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
561 "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
562 "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
563 "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
571 "\t// this crashes?? - not sure why.",
572 "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
573 "\tif (marks.is_empty()) {",
574 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
576 "\tif (marks.is_empty()) {",
577 "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
580 "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
582 "\tmarks.@foreach((m) => { ",
583 "\t\t//GLib.debug(\"got mark %s\", m.name);",
584 "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
586 "\t// true if there is a mark..",
587 "\tif (str.length > 0 ) {",
588 "\t\ttooltip.set_text( str );",
590 "\treturn str.length > 0 ? true : false;",
596 "string name" : "editor-view",
597 "uint tab_width" : 4,
602 "// show the help page for the active node..",
603 " //this.get('/Help').show();",
605 " // this.get('/BottomPane').el.set_current_page(0);",
606 " \tGLib.debug(\"load called - Reset undo buffer\");",
608 " var buf = (GtkSource.Buffer)this.el.get_buffer();",
609 " buf.begin_irreversible_action();",
610 " buf.set_text(str, str.length);",
611 " buf.end_irreversible_action();",
613 " var lm = GtkSource.LanguageManager.get_default();",
614 " var lang = \"vala\";",
615 " if (_this.file != null) {",
616 " lang = _this.file.language;",
618 " print(\"lang=%s, content_type = %s\\n\", lang, _this.file.content_type);",
619 " var lg = _this.file.content_type.length > 0 ?",
620 " lm.guess_language(_this.file.path, _this.file.content_type) :",
621 " lm.get_language(lang);",
624 " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
626 " this.el.insert_spaces_instead_of_tabs = true;",
627 " if (lg != null) {",
628 "\t\tprint(\"sourcelanguage = %s\\n\", lg.name);",
629 "\t\tif (lg.name == \"Vala\") {",
630 "\t\t this.el.insert_spaces_instead_of_tabs = false;",
633 " _this.dirty = false;",
634 " this.el.grab_focus();",
635 " _this.save_button.el.sensitive = false;",
636 " _this.last_error_counter = -1;",
637 "\t_this.updateErrorMarks();",
643 "xtype" : "ScrolledWindow"
648 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
649 "bool homogeneous" : false,
650 "bool vexpand" : false,
655 "Gtk.CssProvider css" : "",
656 "bool hexpand" : true,
657 "id" : "search_entry",
663 "(keyval, keycode, state) => {",
665 "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
666 "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
667 "\t\t_this.forwardSearch(true);",
672 " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
673 "\t\t_this.forwardSearch(true);",
679 " // print(event.key.keyval)",
686 "xtype" : "EventControllerKey"
693 "_this.search(_this.search_entry.el.text);",
694 "\t _this.search_results.updateResults();",
696 "\tGLib.Timeout.add_seconds(1,() => {",
697 "\t\t _this.search_results.updateResults();",
698 "\t\t return false;",
704 "string name" : "editor-search-entry",
705 "string placeholder_text" : "Press enter to search",
706 "uint search_delay" : 3,
707 "xtype" : "SearchEntry",
708 "| void forwardSearch" : [
709 "(bool change_focus) {",
712 "\t_this.forwardSearch(change_focus);",
716 "\tswitch(_this.windowstate.state) {",
717 "\t\tcase WindowState.State.CODEONLY:",
718 "\t\t//case WindowState.State.CODE:",
719 "\t\t\t// search the code being edited..",
720 "\t\t\t_this.windowstate.code_editor_tab.forwardSearch(change_focus);",
723 "\t\tcase WindowState.State.PREVIEW:",
724 "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
725 "\t\t\t\t_this.windowstate.window_gladeview.forwardSearch(change_focus);",
727 "\t\t\t\t _this.windowstate.window_rooview.forwardSearch(change_focus);",
740 "id" : "search_results",
741 "int margin_end" : 4,
742 "int margin_start" : 4,
743 "string label" : "No Results",
745 "| void updateResults" : [
747 "\tthis.el.visible = true;",
749 "\tvar res = _this.searchcontext.get_occurrences_count();",
751 "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
755 "\t_this.nextBtn.el.sensitive = false;",
756 "\t_this.backBtn.el.sensitive = false;\t",
759 "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
760 "\t\t_this.nextBtn.el.sensitive = true;",
761 "\t\t_this.backBtn.el.sensitive = true;",
764 "\t_this.search_results.el.label = \"No Matches\";",
771 "bool always_show_image" : true,
772 "bool sensitive" : false,
778 "\t_this.forwardSearch(true);",
785 "string icon_name" : "go-down",
790 "bool always_show_image" : true,
791 "bool sensitive" : false,
797 "\t_this.backSearch(true);",
803 "string icon_name" : "go-up",
808 "bool always_show_arrow" : true,
809 "bool always_show_image" : true,
813 "* prop" : "popover",
814 "id" : "search_settings",
819 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
830 "id" : "case_sensitive",
831 "string label" : "Case Sensitive",
832 "xtype" : "CheckButton"
843 "string label" : "Regex",
844 "xtype" : "CheckButton"
849 "string label" : "Multi-line (add \\n)",
850 "xtype" : "CheckButton"
859 "string icon_name" : "emblem-system",
860 "xtype" : "MenuButton"
867 "| bool saveContents" : [
871 " if (_this.file == null) {",
877 " var str = _this.buffer.toString();",
879 " _this.buffer.checkSyntax();",
883 " // LeftPanel.model.changed( str , false);",
884 " _this.dirty = false;",
885 " _this.save_button.el.sensitive = false;",
887 " // find the text for the node..",
888 " if (_this.file.xtype != \"PlainFile\") {",
889 " // in theory these properties have to exist!?!",
890 " \tthis.prop.val = str;",
891 " //this.window.windowstate.left_props.reload();",
893 " _this.file.setSource( str );",
896 " // call the signal..",
906 "\tvar s = new GtkSource.SearchSettings();",
907 "\ts.case_sensitive = _this.case_sensitive.el.active;",
908 "\ts.regex_enabled = _this.regex.el.active;\t",
909 "\ts.wrap_around = false;",
911 "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
912 "\tthis.searchcontext.set_highlight(true);",
913 "\tvar txt = in_txt;",
915 "\tif (_this.multiline.el.active) {",
916 "\t\ttxt = in_txt.replace(\"\\\\n\", \"\\n\");",
919 "\ts.set_search_text(txt);",
920 "\tGtk.TextIter beg, st,en;",
922 "\tthis.buffer.el.get_start_iter(out beg);",
923 "\tbool has_wrapped_around;",
924 "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
925 "\tthis.last_search_end = 0;",
927 "\treturn this.searchcontext.get_occurrences_count();",
935 "| string tempFileContents" : [
939 " if (_this.file == null) {",
942 "\tvar str= this.buffer.toString();",
943 "\tif (_this.file.xtype == \"PlainFile\") {",
951 " GLib.debug(\"calling validate\"); ",
952 " // clear the buttons.",
953 " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
954 "\t\treturn this.file.toSource(); ;",
957 "\tvar oldcode = _this.prop.val;",
958 "\t_this.prop.val = str;",
959 " var ret = _this.file.toSource();",
960 " _this.prop.val = oldcode;",
965 "| void backSearch" : [
966 "(bool change_focus) {",
968 "\tif (this.searchcontext == null) {",
972 "\tGtk.TextIter beg, st,en;",
973 "\tbool has_wrapped_around;",
974 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
976 "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
977 "\t\tthis.last_search_end = 0;",
979 "\t\tthis.last_search_end = en.get_offset();",
980 "\t\tif (change_focus) {",
981 "\t\t\tthis.view.el.grab_focus();",
983 "\t\tthis.buffer.el.place_cursor(st);",
984 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
990 "| void forwardSearch" : [
991 "(bool change_focus) {",
993 "\tif (this.searchcontext == null) {",
997 "\tGtk.TextIter beg, st,en;",
998 "\t bool has_wrapped_around;",
999 "\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
1000 "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
1002 "\t\tthis.last_search_end = 0; // not sure if this should happen",
1004 "\t\tif (has_wrapped_around) {",
1008 "\t\tthis.last_search_end = en.get_offset();",
1009 "\t\tif (change_focus) {",
1010 "\t\t\tthis.view.el.grab_focus();",
1012 "\t\tthis.buffer.el.place_cursor(st);",
1013 "\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
1021 "\t this.file = null; ",
1023 " this.node = null;",
1024 " this.prop = null;",
1025 "\tthis.searchcontext = null;",
1030 "| void scroll_to_line" : [
1033 "\tGLib.Timeout.add(500, () => {",
1035 "\t\tvar buf = this.view.el.get_buffer();",
1037 "\t\tvar sbuf = (GtkSource.Buffer) buf;",
1040 "\t\tGtk.TextIter iter; ",
1041 "\t\tsbuf.get_iter_at_line(out iter, line);",
1042 "\t\tthis.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
1043 "\t\treturn false;",
1049 "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
1052 " this.file = file; ",
1054 " if (file.xtype != \"PlainFile\") {",
1055 " \tthis.prop = prop;",
1056 " this.node = node;",
1058 " // find the text for the node..",
1059 " this.view.load( prop.val );",
1061 " this.close_btn.el.show(); ",
1064 " this.view.load( file.toSource() );",
1065 " this.close_btn.el.hide();",
1070 "| void updateErrorMarks" : [
1075 "\tvar buf = _this.buffer.el;",
1076 "\tGtk.TextIter start;",
1077 "\tGtk.TextIter end; ",
1078 "\tbuf.get_bounds (out start, out end);",
1083 "\t//GLib.debug(\"highlight errors\");\t\t ",
1085 "\t // we should highlight other types of errors..",
1087 "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
1089 "\t\t_this.window.windowstate.state != WindowState.State.CODE",
1091 "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
1097 "\tif (_this.file == null) {",
1098 "\t\tGLib.debug(\"file is null?\");",
1102 "\tvar ar = this.file.getErrors();",
1103 "\tif (ar.size < 1) {",
1104 "\t\tbuf.remove_source_marks (start, end, null);",
1105 "\t\tthis.last_error_counter = file.error_counter ;",
1106 "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
1111 " // basicaly check if there is no change, then we do not do any update..",
1112 " // we can do this by just using an error counter?",
1113 " // if that's changed then we will do an update, otherwise dont bother.",
1116 "\tvar offset = 0;",
1117 "\tvar hoffset = 0;",
1119 "\tvar tlines = buf.get_line_count () +1;",
1121 "\tif (_this.prop != null) {",
1122 "\t\t// this still seems flaky...",
1124 "\t\ttlines = _this.prop.end_line;",
1125 "\t\toffset = _this.prop.start_line;",
1126 "\t\thoffset = _this.node.node_pad.length;",
1130 "\t\t// no update...",
1131 "\t\tif (this.last_error_counter == file.error_counter) {",
1137 "\tbuf.remove_source_marks (start, end, null);",
1138 "\tforeach(var diag in ar) { ",
1139 "\t Gtk.TextIter iter;",
1140 "// print(\"get inter\\n\");",
1141 "\t var eline = (int)diag.range.start.line - offset;",
1142 "\t //var eline = diag.range.end_line - offset;",
1143 "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
1144 "\t //\terr.line ,eline, offset);",
1147 "\t if (eline > tlines || eline < 0) {",
1153 "\t buf.get_iter_at_line_offset( out iter, eline, (int)diag.range.start.character - hoffset);",
1156 "\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, diag.category, diag.message);",
1157 "\t buf.create_source_mark( msg, diag.category, iter);",
1158 "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
1159 "\t //this.marks.set(eline, msg);",
1161 "\tthis.last_error_counter = file.error_counter ;",