1 static Xcls_WindowRooView _WindowRooView;
3 public class Xcls_WindowRooView : Object
6 private Xcls_WindowRooView _this;
8 public static Xcls_WindowRooView singleton()
10 if (_WindowRooView == null) {
11 _WindowRooView= new Xcls_WindowRooView();
13 return _WindowRooView;
15 public Xcls_notebook notebook;
16 public Xcls_label_preview label_preview;
17 public Xcls_label_code label_code;
18 public Xcls_paned paned;
19 public Xcls_viewbox viewbox;
20 public Xcls_AutoRedraw AutoRedraw;
21 public Xcls_viewcontainer viewcontainer;
22 public Xcls_view view;
23 public Xcls_inspectorcontainer inspectorcontainer;
24 public Xcls_sourceview sourceview;
27 public Gtk.Widget lastObj;
29 public int last_search_end;
30 public Gtk.SourceSearchContext searchcontext;
31 public JsRender.JsRender file;
33 public Xcls_MainWindow main_window;
36 public Xcls_WindowRooView()
39 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
44 this.last_search_end = 0;
49 this.el.hexpand = true;
50 var child_0 = new Xcls_notebook( _this );
52 this.el.pack_start ( child_0.el , true,true,0 );
55 // user defined functions
56 public void scroll_to_line (int line) {
57 this.notebook.el.page = 1;// code preview...
59 GLib.Timeout.add(500, () => {
64 var buf = this.sourceview.el.get_buffer();
66 var sbuf = (Gtk.SourceBuffer) buf;
70 sbuf.get_iter_at_line(out iter, line);
71 this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
77 public void createThumb () {
80 if (this.file == null) {
83 if (this.notebook.el.page > 0 ) {
87 var filename = this.file.getIconFileName(false);
89 var win = this.el.get_parent_window();
90 var width = win.get_width();
91 // var height = win.get_height();
93 Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.paned.el.position);
94 screenshot.save(filename,"png");
104 public void loadFile (JsRender.JsRender file)
107 this.view.renderJS(true);
108 this.notebook.el.page = 0;// gtk preview
109 this.sourceview.loadFile();
112 public int search (string txt) {
113 this.notebook.el.page = 1;
114 var s = new Gtk.SourceSearchSettings();
115 var buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();
116 this.searchcontext = new Gtk.SourceSearchContext(buf,s);
117 this.searchcontext.set_highlight(true);
118 s.set_search_text(txt);
120 Gtk.TextIter beg, st,en;
122 buf.get_start_iter(out beg);
123 this.searchcontext.forward(beg, out st, out en);
124 this.last_search_end = 0;
125 return this.searchcontext.get_occurrences_count();
129 public void requestRedraw () {
130 this.view.renderJS(false);
131 this.sourceview.loadFile();
133 public void forwardSearch (bool change_focus) {
135 if (this.searchcontext == null) {
138 this.notebook.el.page = 1;
139 Gtk.TextIter beg, st,en, stl;
141 var buf = this.sourceview.el.get_buffer();
142 buf.get_iter_at_offset(out beg, this.last_search_end);
143 if (!this.searchcontext.forward(beg, out st, out en)) {
144 this.last_search_end = 0;
146 this.last_search_end = en.get_offset();
148 this.sourceview.el.grab_focus();
150 buf.place_cursor(st);
151 var ln = st.get_line();
152 buf.get_iter_at_line(out stl,ln);
154 this.sourceview.el.scroll_to_iter(stl, 0.0f, true, 0.0f, 0.5f);
158 public class Xcls_notebook : Object
160 public Gtk.Notebook el;
161 private Xcls_WindowRooView _this;
167 public Xcls_notebook(Xcls_WindowRooView _owner )
170 _this.notebook = this;
171 this.el = new Gtk.Notebook();
175 // set gobject values
176 var child_0 = new Xcls_label_preview( _this );
178 var child_1 = new Xcls_label_code( _this );
180 var child_2 = new Xcls_paned( _this );
182 this.el.add ( child_2.el );
183 var child_3 = new Xcls_ScrolledWindow14( _this );
185 this.el.append_page ( child_3.el , _this.label_code.el );
188 // user defined functions
190 public class Xcls_label_preview : Object
193 private Xcls_WindowRooView _this;
199 public Xcls_label_preview(Xcls_WindowRooView _owner )
202 _this.label_preview = this;
203 this.el = new Gtk.Label( "Preview" );
207 // set gobject values
210 // user defined functions
213 public class Xcls_label_code : Object
216 private Xcls_WindowRooView _this;
222 public Xcls_label_code(Xcls_WindowRooView _owner )
225 _this.label_code = this;
226 this.el = new Gtk.Label( "Preview Generated Code" );
230 // set gobject values
233 // user defined functions
236 public class Xcls_paned : Object
239 private Xcls_WindowRooView _this;
245 public Xcls_paned(Xcls_WindowRooView _owner )
249 this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL );
253 // set gobject values
254 var child_0 = new Xcls_viewbox( _this );
256 this.el.pack1 ( child_0.el , true,true );
257 var child_1 = new Xcls_inspectorcontainer( _this );
259 this.el.pack2 ( child_1.el , true,true );
262 // user defined functions
264 public class Xcls_viewbox : Object
267 private Xcls_WindowRooView _this;
273 public Xcls_viewbox(Xcls_WindowRooView _owner )
276 _this.viewbox = this;
277 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
281 // set gobject values
282 this.el.homogeneous = false;
283 var child_0 = new Xcls_Box7( _this );
285 this.el.pack_start ( child_0.el , false,true,0 );
286 var child_1 = new Xcls_viewcontainer( _this );
288 this.el.pack_end ( child_1.el , true,true,0 );
291 // user defined functions
293 public class Xcls_Box7 : Object
296 private Xcls_WindowRooView _this;
302 public Xcls_Box7(Xcls_WindowRooView _owner )
305 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
309 // set gobject values
310 this.el.homogeneous = true;
311 this.el.height_request = 20;
312 this.el.vexpand = false;
313 var child_0 = new Xcls_Button8( _this );
315 this.el.pack_start ( child_0.el , false,false,0 );
316 var child_1 = new Xcls_AutoRedraw( _this );
318 this.el.pack_start ( child_1.el , false,false,0 );
319 var child_2 = new Xcls_Button10( _this );
321 this.el.pack_start ( child_2.el , false,false,0 );
324 // user defined functions
326 public class Xcls_Button8 : Object
328 public Gtk.Button el;
329 private Xcls_WindowRooView _this;
335 public Xcls_Button8(Xcls_WindowRooView _owner )
338 this.el = new Gtk.Button();
342 // set gobject values
343 this.el.label = "Redraw";
346 this.el.clicked.connect( ( ) => {
347 _this.view.renderJS( true);
351 // user defined functions
354 public class Xcls_AutoRedraw : Object
356 public Gtk.CheckButton el;
357 private Xcls_WindowRooView _this;
363 public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
366 _this.AutoRedraw = this;
367 this.el = new Gtk.CheckButton();
371 // set gobject values
372 this.el.active = true;
373 this.el.label = "Auto Redraw On";
376 this.el.toggled.connect( (state) => {
377 this.el.set_label(this.el.active ? "Auto Redraw On" : "Auto Redraw Off");
381 // user defined functions
384 public class Xcls_Button10 : Object
386 public Gtk.Button el;
387 private Xcls_WindowRooView _this;
393 public Xcls_Button10(Xcls_WindowRooView _owner )
396 this.el = new Gtk.Button();
400 // set gobject values
401 this.el.label = "Full Redraw";
404 this.el.clicked.connect( () => {
405 _this.view.redraws = 99;
406 _this.view.el.web_context.clear_cache();
407 //_this.view.renderJS(true);
408 FakeServerCache.clear();
414 // user defined functions
418 public class Xcls_viewcontainer : Object
420 public Gtk.ScrolledWindow el;
421 private Xcls_WindowRooView _this;
427 public Xcls_viewcontainer(Xcls_WindowRooView _owner )
430 _this.viewcontainer = this;
431 this.el = new Gtk.ScrolledWindow( null, null );
435 // set gobject values
436 this.el.shadow_type = Gtk.ShadowType.IN;
437 var child_0 = new Xcls_view( _this );
439 this.el.add ( child_0.el );
443 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
446 // user defined functions
448 public class Xcls_view : Object
450 public WebKit.WebView el;
451 private Xcls_WindowRooView _this;
455 public string renderedData;
456 public bool refreshRequired;
457 public WebKit.WebInspector inspector;
460 public GLib.DateTime lastRedraw;
461 public string runhtml;
462 public bool pendingRedraw;
465 public Xcls_view(Xcls_WindowRooView _owner )
469 this.el = new WebKit.WebView();
472 this.renderedData = "";
473 this.refreshRequired = false;
476 this.lastRedraw = null;
478 this.pendingRedraw = false;
480 // set gobject values
485 // this may not work!?
486 var settings = this.el.get_settings();
487 settings.enable_developer_extras = true;
490 var fs= new FakeServer(this.el);
492 // this was an attempt to change the url perms.. did not work..
493 // settings.enable_file_access_from_file_uris = true;
494 // settings.enable_offline_web_application_cache - true;
495 // settings.enable_universal_access_from_file_uris = true;
502 // FIXME - base url of script..
503 // we need it so some of the database features work.
504 this.el.load_html( "Render not ready" ,
505 //fixme - should be a config option!
506 // or should we catch stuff and fix it up..
507 "http://localhost/app.Builder/"
511 //this.el.open('file:///' + __script_path__ + '/../builder.html');
516 Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
517 null, // list of targets
518 Gdk.DragAction.COPY // what to do with data after dropped
521 // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
522 Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
524 GLib.Timeout.add_seconds(1, () =>{
525 //print("run refresh?");
526 if (this.el == null) {
537 this.el.script_dialog.connect( (dialog) => {
538 if (this.el == null) {
542 var msg = dialog.get_message();
543 if (msg.length < 4) {
546 if (msg.substring(0,4) != "IPC:") {
549 var ar = msg.split(":", 3);
555 _this.file.saveHTML(ar[2]);
562 this.el.show.connect( ( ) => {
563 this.initInspector();;
565 this.el.drag_drop.connect( ( ctx, x, y,time, ud) => {
568 print("TARGET: drag-drop");
569 var is_valid_drop_site = true;
574 w, // will receive 'drag-data-received' signal
575 ctx, /* represents the current state of the DnD
576 this.get('/Window').atoms["STRING"], /* the target type we want
581 /* No target offered by source => error
584 return is_valid_drop_site;
587 this.el.load_changed.connect( (le) => {
588 if (le != WebKit.LoadEvent.FINISHED) {
591 if (this.runjs.length < 1) {
594 // this.el.run_javascript(this.runjs, null);
595 FakeServerCache.remove( this.runjs);
600 // user defined functions
601 public void reInit () {
603 // if this happens destroy the webkit..
605 this.el.stop_loading();
607 if (_this.viewbox.el.get_parent() == null) {
612 _this.viewbox.el.remove(_this.viewcontainer.el);
613 _this.paned.el.remove(_this.inspectorcontainer.el);
615 // destory seems to cause problems.
617 //_this.viewcontainer.el.destroy();
618 //_this.inspectorcontainer.el.destroy();
619 var inv =new Xcls_inspectorcontainer(_this);
621 _this.paned.el.pack2(inv.el,true,true);
625 var nv =new Xcls_viewcontainer(_this);
627 _this.viewbox.el.pack_end(nv.el,true,true,0);
632 //while(Gtk.events_pending ()) Gtk.main_iteration ();
633 //_this.view.renderJS(true);
634 _this.view.refreshRequired = true;
636 public void runRefresh ()
638 // this is run every 2 seconds from the init..
642 if (!this.refreshRequired) {
643 // print("no refresh required");
647 if (this.lastRedraw != null) {
648 // do not redraw if last redraw was less that 5 seconds ago.
649 if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {
654 if (_this.file == null) {
659 this.refreshRequired = false;
660 // print("HTML RENDERING");
663 //this.get('/BottomPane').el.show();
664 //this.get('/BottomPane').el.set_current_page(2);// webkit inspector
665 _this.file.webkit_page_id = this.el.get_page_id();
667 var js = _this.file.toSourcePreview();
676 var project = _this.file.project;
678 //print (project.fn);
679 // set it to non-empty.
681 // runhtml = runhtml.length ? runhtml : '<script type="text/javascript"></script>';
684 // this.runhtml = this.runhtml || '';
687 // then we need to reload the browser using
688 // load_html_string..
690 // then trigger a redraw once it's loaded..
691 this.pendingRedraw = true;
693 var runhtml = "<script type=\"text/javascript\">\n" ;
697 GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + "/resources/roo.builder.js", out builderhtml);
702 runhtml += builderhtml + "\n";
703 runhtml += "</script>\n" ;
705 // fix to make sure they are the same..
706 this.runhtml = project.runhtml;
707 // need to modify paths
710 var base_template = _this.file.project.base_template;
712 if (base_template.length > 0 && !FileUtils.test(
713 BuilderApplication.configDirectory() + "/resources/" + base_template, FileTest.EXISTS)
715 print("invalid base_template name - using default: %s\n", base_template);
720 GLib.FileUtils.get_contents(
721 BuilderApplication.configDirectory() + "/resources/" +
722 (base_template.length > 0 ? base_template : "roo.builder.html")
728 this.renderedData = js;
731 string js_src = js + "\n" +
732 "Roo.onReady(function() {\n" +
733 "if (" + _this.file.name +".show) " + _this.file.name +".show({});\n" +
734 "Roo.XComponent.build();\n" +
737 // print("render js: " + js);
739 // console.log('not loaded yet');
741 this.lastRedraw = new DateTime.now_local();
744 //this.runjs = js_src;
745 var fc = FakeServerCache.factory_with_data(js_src);
746 this.runjs = fc.fname;
748 var html = inhtml.replace("</head>", runhtml + this.runhtml +
749 "<script type=\"text/javascript\" src=\"xhttp://localhost" + fc.fname + "\"></script>" +
750 // "<script type=\"text/javascript\">\n" +
755 //print("LOAD HTML " + html);
757 var rootURL = _this.file.project.rootURL;
761 this.el.load_html( html ,
762 //fixme - should be a config option!
763 (rootURL.length > 0 ? rootURL : "xhttp://localhost/app.Builder.js/")
766 // force the inspector...
767 // this.initInspector();
769 // - no need for this, the builder javascript will call it when build is complete
770 //GLib.Timeout.add_seconds(1, () => {
771 // this.el.run_javascript("Builder.saveHTML()",null);
774 // print( "before render" + this.lastRedraw);
775 // print( "after render" + (new Date()));
778 public void initInspector () {
780 /* if (this.inspector == this.el.get_inspector()) {
781 this.inspector.show();
782 this.inspector.open_window();
783 print("init inspecter called, and inspector is the same as existing\n");
786 print("new inspector?\n");
788 this.inspector = this.el.get_inspector();
789 this.inspector.ref();
791 // got a new inspector...
793 this.inspector.open_window.connect(() => {
794 this.inspector = this.el.get_inspector();
795 print("inspector attach\n");
796 var wv = this.inspector.get_web_view();
798 print("got inspector web view\n");
800 var cn = _this.inspectorcontainer.el.get_child();
802 _this.inspectorcontainer.el.remove(cn);
805 _this.inspectorcontainer.el.add(wv);
808 //this.inspector.close();
810 //this.inspector = null;
818 this.inspector.closed.connect(() => {
819 print("inspector closed?!?");
820 // if this happens destroy the webkit..
822 this.el.stop_loading();
824 if (_this.viewbox.el.get_parent() == null) {
829 _this.viewbox.el.remove(_this.viewcontainer.el);
830 _this.el.remove(_this.inspectorcontainer.el);
832 // destory seems to cause problems.
834 //_this.viewcontainer.el.destroy();
835 //_this.inspectorcontainer.el.destroy();
838 var nv =new Xcls_viewcontainer(_this);
840 _this.viewbox.el.pack_end(nv.el,true,true,0);
842 var inv =new Xcls_inspectorcontainer(_this);
844 _this.el.pack2(inv.el,true,true);
848 //while(Gtk.events_pending ()) Gtk.main_iteration ();
849 //_this.view.renderJS(true);
850 _this.view.refreshRequired = true;
855 this.inspector.show();
857 public void renderJS (bool force) {
859 // this is the public redraw call..
860 // we refresh in a loop privately..
861 var autodraw = _this.AutoRedraw.el.active;
862 if (!autodraw && !force) {
863 print("Skipping redraw - no force, and autodraw off");
867 this.refreshRequired = true;
873 public class Xcls_inspectorcontainer : Object
875 public Gtk.ScrolledWindow el;
876 private Xcls_WindowRooView _this;
882 public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
885 _this.inspectorcontainer = this;
886 this.el = new Gtk.ScrolledWindow( null, null );
890 // set gobject values
891 this.el.shadow_type = Gtk.ShadowType.IN;
895 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
898 // user defined functions
902 public class Xcls_ScrolledWindow14 : Object
904 public Gtk.ScrolledWindow el;
905 private Xcls_WindowRooView _this;
911 public Xcls_ScrolledWindow14(Xcls_WindowRooView _owner )
914 this.el = new Gtk.ScrolledWindow( null, null );
918 // set gobject values
919 var child_0 = new Xcls_sourceview( _this );
921 this.el.add ( child_0.el );
924 // user defined functions
926 public class Xcls_sourceview : Object
928 public Gtk.SourceView el;
929 private Xcls_WindowRooView _this;
934 public bool allow_node_scroll;
937 public Xcls_sourceview(Xcls_WindowRooView _owner )
940 _this.sourceview = this;
941 this.el = new Gtk.SourceView();
945 this.allow_node_scroll = true;
947 // set gobject values
948 this.el.editable = false;
949 this.el.show_line_marks = true;
950 this.el.show_line_numbers = true;
956 var description = Pango.FontDescription.from_string("monospace");
957 description.set_size(8000);
958 this.el.override_font(description);
961 var buf = this.el.get_buffer();
962 buf.notify.connect(this.onCursorChanged);
966 var attrs = new Gtk.SourceMarkAttributes();
967 var pink = Gdk.RGBA();
968 pink.parse ( "pink");
969 attrs.set_background ( pink);
970 attrs.set_icon_name ( "process-stop");
971 attrs.query_tooltip_text.connect(( mark) => {
972 //print("tooltip query? %s\n", mark.name);
976 this.el.set_mark_attributes ("ERR", attrs, 1);
978 var wattrs = new Gtk.SourceMarkAttributes();
979 var blue = Gdk.RGBA();
980 blue.parse ( "#ABF4EB");
981 wattrs.set_background ( blue);
982 wattrs.set_icon_name ( "process-stop");
983 wattrs.query_tooltip_text.connect(( mark) => {
984 //print("tooltip query? %s\n", mark.name);
988 this.el.set_mark_attributes ("WARN", wattrs, 1);
992 var dattrs = new Gtk.SourceMarkAttributes();
993 var purple = Gdk.RGBA();
994 purple.parse ( "#EEA9FF");
995 dattrs.set_background ( purple);
996 dattrs.set_icon_name ( "process-stop");
997 dattrs.query_tooltip_text.connect(( mark) => {
998 //print("tooltip query? %s\n", mark.name);
1002 this.el.set_mark_attributes ("DEPR", dattrs, 1);
1005 var gattrs = new Gtk.SourceMarkAttributes();
1006 var grey = Gdk.RGBA();
1007 grey.parse ( "#ccc");
1008 gattrs.set_background ( grey);
1011 this.el.set_mark_attributes ("grey", gattrs, 1);
1021 // user defined functions
1022 public void onCursorChanged (ParamSpec ps) {
1026 if (ps.name != "cursor-position") {
1029 var buf = this.el.get_buffer();
1030 print("cursor changed : %d\n", buf.cursor_position);
1032 buf.get_iter_at_offset(out cpos, buf.cursor_position);
1034 var ln = cpos.get_line();
1035 print("cursor changed line : %d\n", ln);
1036 var node = _this.file.lineToNode(ln+1);
1039 print("can not find node\n");
1042 var prop = node.lineToProp(ln+1);
1043 print("prop : %s", prop == null : "???" : prop);
1046 var ltree = _this.main_window.windowstate.left_tree;
1047 var tp = ltree.model.treePathFromNode(node);
1048 print("got tree path %s\n", tp);
1050 this.allow_node_scroll = false; /// block node scrolling..
1053 print("changing cursor on tree..\n");
1055 ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
1056 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
1057 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
1058 this.allow_node_scroll = true;
1063 // highlight the node..
1065 public void nodeSelected (JsRender.Node? sel) {
1069 // this is connected in widnowstate
1070 print("node selected\n");
1071 var buf = this.el.get_buffer();
1073 var sbuf = (Gtk.SourceBuffer) buf;
1076 while(Gtk.events_pending()) {
1077 Gtk.main_iteration();
1081 // clear all the marks..
1085 sbuf.get_bounds (out start, out end);
1086 sbuf.remove_source_marks (start, end, "grey");
1090 print("no selected node\n");
1091 // no highlighting..
1095 print("highlight region %d to %d\n", sel.line_start,sel.line_end);
1097 sbuf.get_iter_at_line(out iter, sel.line_start);
1100 Gtk.TextIter cur_iter;
1101 sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
1103 //var cur_line = cur_iter.get_line();
1104 //if (cur_line > sel.line_start && cur_line < sel.line_end) {
1107 if (this.allow_node_scroll) {
1109 this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
1114 for (var i = 0; i < buf.get_line_count();i++) {
1115 if (i < (sel.line_start -1) || i > (sel.line_end -1)) {
1117 sbuf.get_iter_at_line(out iter, i);
1118 sbuf.create_source_mark(null, "grey", iter);
1126 public string toString () {
1129 this.el.get_buffer().get_start_iter(out s);
1130 this.el.get_buffer().get_end_iter(out e);
1131 var ret = this.el.get_buffer().get_text(s,e,true);
1132 //print("TO STRING? " + ret);
1135 public void loadFile ( ) {
1136 this.loading = true;
1137 var buf = this.el.get_buffer();
1139 var sbuf = (Gtk.SourceBuffer) buf;
1143 if (_this.file == null || _this.file.xtype != "Roo") {
1144 print("xtype != Roo");
1145 this.loading = false;
1149 // get the string from the rendered tree...
1151 var str = _this.file.toSource();
1153 // print("setting str %d\n", str.length);
1154 buf.set_text(str, str.length);
1155 var lm = Gtk.SourceLanguageManager.get_default();
1157 //?? is javascript going to work as js?
1159 ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));
1165 sbuf.get_bounds (out start, out end);
1166 sbuf.remove_source_marks (start, end, null); // remove all marks..
1171 this.loading = false;
1173 public void highlightErrorsJson (string type, Json.Object obj) {
1177 var buf = this.el.get_buffer();
1178 var sbuf = (Gtk.SourceBuffer)buf;
1179 buf.get_bounds (out start, out end);
1181 sbuf.remove_source_marks (start, end, type);
1184 // we should highlight other types of errors..
1186 if (!obj.has_member(type)) {
1187 print("Return has no errors\n");
1190 var err = obj.get_object_member(type);
1192 if (_this.file == null) {
1193 return; // just in case the file has not loaded yet?
1199 var regex = new Regex("\\.bjs$");
1202 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
1203 } catch (GLib.RegexError e) {
1207 if (!err.has_member(valafn)) {
1208 print("File path has no errors\n");
1211 var lines = err.get_object_member(valafn);
1215 var tlines = buf.get_line_count () +1;
1217 lines.foreach_member((obj, line, node) => {
1220 // print("get inter\n");
1221 var eline = int.parse(line) -1 ;
1222 print("GOT ERROR on line %s -- converted to %d\n", line,eline);
1225 if (eline > tlines || eline < 0) {
1228 sbuf.get_iter_at_line( out iter, eline);
1229 //print("mark line\n");
1230 var msg = type + " on line: %d - %s".printf(eline+1, valafn);
1231 var ar = lines.get_array_member(line);
1232 for (var i = 0 ; i < ar.get_length(); i++) {
1233 msg += (msg.length > 0) ? "\n" : "";
1234 msg += ar.get_string_element(i);
1238 sbuf.create_source_mark(msg, type, iter);