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 var filename = this.file.getIconFileName(false);
85 var win = this.el.get_parent_window();
86 var width = win.get_width();
87 // var height = win.get_height();
89 Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.el.position);
90 screenshot.save(filename,"png");
100 public void loadFile (JsRender.JsRender file)
103 this.view.renderJS(true);
104 this.notebook.el.page = 0;// gtk preview
105 this.sourceview.loadFile();
108 public int search (string txt) {
109 this.notebook.el.page = 1;
110 var s = new Gtk.SourceSearchSettings();
111 var buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();
112 this.searchcontext = new Gtk.SourceSearchContext(buf,s);
113 this.searchcontext.set_highlight(true);
114 s.set_search_text(txt);
116 Gtk.TextIter beg, st,en;
118 buf.get_start_iter(out beg);
119 this.searchcontext.forward(beg, out st, out en);
120 this.last_search_end = 0;
121 return this.searchcontext.get_occurrences_count();
125 public void requestRedraw () {
126 this.view.renderJS(false);
128 public void forwardSearch () {
130 if (this.searchcontext == null) {
133 this.notebook.el.page = 1;
134 Gtk.TextIter beg, st,en, stl;
136 var buf = this.sourceview.el.get_buffer();
137 buf.get_iter_at_offset(out beg, this.last_search_end);
138 if (!this.searchcontext.forward(beg, out st, out en)) {
139 this.last_search_end = 0;
141 this.last_search_end = en.get_offset();
143 this.sourceview.el.grab_focus();
145 buf.place_cursor(st);
146 var ln = st.get_line();
147 buf.get_iter_at_line(out stl,ln);
149 this.sourceview.el.scroll_to_iter(stl, 0.0f, true, 0.0f, 0.5f);
153 public class Xcls_notebook : Object
155 public Gtk.Notebook el;
156 private Xcls_WindowRooView _this;
162 public Xcls_notebook(Xcls_WindowRooView _owner )
165 _this.notebook = this;
166 this.el = new Gtk.Notebook();
170 // set gobject values
171 var child_0 = new Xcls_label_preview( _this );
173 var child_1 = new Xcls_label_code( _this );
175 var child_2 = new Xcls_paned( _this );
177 this.el.add ( child_2.el );
178 var child_3 = new Xcls_ScrolledWindow14( _this );
180 this.el.append_page ( child_3.el , _this.label_code.el );
183 // user defined functions
185 public class Xcls_label_preview : Object
188 private Xcls_WindowRooView _this;
194 public Xcls_label_preview(Xcls_WindowRooView _owner )
197 _this.label_preview = this;
198 this.el = new Gtk.Label( "Preview" );
202 // set gobject values
205 // user defined functions
208 public class Xcls_label_code : Object
211 private Xcls_WindowRooView _this;
217 public Xcls_label_code(Xcls_WindowRooView _owner )
220 _this.label_code = this;
221 this.el = new Gtk.Label( "Preview Generated Code" );
225 // set gobject values
228 // user defined functions
231 public class Xcls_paned : Object
234 private Xcls_WindowRooView _this;
240 public Xcls_paned(Xcls_WindowRooView _owner )
244 this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL );
248 // set gobject values
249 var child_0 = new Xcls_viewbox( _this );
251 this.el.pack1 ( child_0.el , true,true );
252 var child_1 = new Xcls_inspectorcontainer( _this );
254 this.el.pack2 ( child_1.el , true,true );
257 // user defined functions
259 public class Xcls_viewbox : Object
262 private Xcls_WindowRooView _this;
268 public Xcls_viewbox(Xcls_WindowRooView _owner )
271 _this.viewbox = this;
272 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
276 // set gobject values
277 this.el.homogeneous = false;
278 var child_0 = new Xcls_Box7( _this );
280 this.el.pack_start ( child_0.el , false,true,0 );
281 var child_1 = new Xcls_viewcontainer( _this );
283 this.el.pack_end ( child_1.el , true,true,0 );
286 // user defined functions
288 public class Xcls_Box7 : Object
291 private Xcls_WindowRooView _this;
297 public Xcls_Box7(Xcls_WindowRooView _owner )
300 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
304 // set gobject values
305 this.el.homogeneous = true;
306 this.el.height_request = 20;
307 this.el.vexpand = false;
308 var child_0 = new Xcls_Button8( _this );
310 this.el.pack_start ( child_0.el , false,false,0 );
311 var child_1 = new Xcls_AutoRedraw( _this );
313 this.el.pack_start ( child_1.el , false,false,0 );
314 var child_2 = new Xcls_Button10( _this );
316 this.el.pack_start ( child_2.el , false,false,0 );
319 // user defined functions
321 public class Xcls_Button8 : Object
323 public Gtk.Button el;
324 private Xcls_WindowRooView _this;
330 public Xcls_Button8(Xcls_WindowRooView _owner )
333 this.el = new Gtk.Button();
337 // set gobject values
338 this.el.label = "Redraw";
341 this.el.clicked.connect( ( ) => {
342 _this.view.renderJS( true);
346 // user defined functions
349 public class Xcls_AutoRedraw : Object
351 public Gtk.CheckButton el;
352 private Xcls_WindowRooView _this;
358 public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
361 _this.AutoRedraw = this;
362 this.el = new Gtk.CheckButton();
366 // set gobject values
367 this.el.active = true;
368 this.el.label = "Auto Redraw On";
371 this.el.toggled.connect( (state) => {
372 this.el.set_label(this.el.active ? "Auto Redraw On" : "Auto Redraw Off");
376 // user defined functions
379 public class Xcls_Button10 : Object
381 public Gtk.Button el;
382 private Xcls_WindowRooView _this;
388 public Xcls_Button10(Xcls_WindowRooView _owner )
391 this.el = new Gtk.Button();
395 // set gobject values
396 this.el.label = "Full Redraw";
399 this.el.clicked.connect( () => {
400 _this.view.redraws = 99;
401 _this.view.el.web_context.clear_cache();
402 //_this.view.renderJS(true);
403 FakeServerCache.clear();
409 // user defined functions
413 public class Xcls_viewcontainer : Object
415 public Gtk.ScrolledWindow el;
416 private Xcls_WindowRooView _this;
422 public Xcls_viewcontainer(Xcls_WindowRooView _owner )
425 _this.viewcontainer = this;
426 this.el = new Gtk.ScrolledWindow( null, null );
430 // set gobject values
431 this.el.shadow_type = Gtk.ShadowType.IN;
432 var child_0 = new Xcls_view( _this );
434 this.el.add ( child_0.el );
438 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
441 // user defined functions
443 public class Xcls_view : Object
445 public WebKit.WebView el;
446 private Xcls_WindowRooView _this;
450 public string renderedData;
451 public bool refreshRequired;
452 public WebKit.WebInspector inspector;
455 public GLib.DateTime lastRedraw;
456 public string runhtml;
457 public bool pendingRedraw;
460 public Xcls_view(Xcls_WindowRooView _owner )
464 this.el = new WebKit.WebView();
467 this.renderedData = "";
468 this.refreshRequired = false;
471 this.lastRedraw = null;
473 this.pendingRedraw = false;
475 // set gobject values
480 // this may not work!?
481 var settings = this.el.get_settings();
482 settings.enable_developer_extras = true;
485 var fs= new FakeServer(this.el);
487 // this was an attempt to change the url perms.. did not work..
488 // settings.enable_file_access_from_file_uris = true;
489 // settings.enable_offline_web_application_cache - true;
490 // settings.enable_universal_access_from_file_uris = true;
497 // FIXME - base url of script..
498 // we need it so some of the database features work.
499 this.el.load_html( "Render not ready" ,
500 //fixme - should be a config option!
501 // or should we catch stuff and fix it up..
502 "http://localhost/app.Builder/"
506 //this.el.open('file:///' + __script_path__ + '/../builder.html');
511 Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
512 null, // list of targets
513 Gdk.DragAction.COPY // what to do with data after dropped
516 // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
517 Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
519 GLib.Timeout.add_seconds(1, () =>{
520 //print("run refresh?");
521 if (this.el == null) {
532 this.el.script_dialog.connect( (dialog) => {
533 if (this.el == null) {
537 var msg = dialog.get_message();
538 if (msg.length < 4) {
541 if (msg.substring(0,4) != "IPC:") {
544 var ar = msg.split(":", 3);
550 _this.file.saveHTML(ar[2]);
557 this.el.show.connect( ( ) => {
558 this.initInspector();;
560 this.el.drag_drop.connect( ( ctx, x, y,time, ud) => {
563 print("TARGET: drag-drop");
564 var is_valid_drop_site = true;
569 w, // will receive 'drag-data-received' signal
570 ctx, /* represents the current state of the DnD
571 this.get('/Window').atoms["STRING"], /* the target type we want
576 /* No target offered by source => error
579 return is_valid_drop_site;
582 this.el.load_changed.connect( (le) => {
583 if (le != WebKit.LoadEvent.FINISHED) {
586 if (this.runjs.length < 1) {
589 // this.el.run_javascript(this.runjs, null);
590 FakeServerCache.remove( this.runjs);
595 // user defined functions
596 public void reInit () {
598 // if this happens destroy the webkit..
600 this.el.stop_loading();
602 if (_this.viewbox.el.get_parent() == null) {
607 _this.viewbox.el.remove(_this.viewcontainer.el);
608 _this.el.remove(_this.inspectorcontainer.el);
610 // destory seems to cause problems.
612 //_this.viewcontainer.el.destroy();
613 //_this.inspectorcontainer.el.destroy();
614 var inv =new Xcls_inspectorcontainer(_this);
616 _this.el.pack2(inv.el,true,true);
620 var nv =new Xcls_viewcontainer(_this);
622 _this.viewbox.el.pack_end(nv.el,true,true,0);
627 //while(Gtk.events_pending ()) Gtk.main_iteration ();
628 //_this.view.renderJS(true);
629 _this.view.refreshRequired = true;
631 public void runRefresh ()
633 // this is run every 2 seconds from the init..
637 if (!this.refreshRequired) {
638 // print("no refresh required");
642 if (this.lastRedraw != null) {
643 // do not redraw if last redraw was less that 5 seconds ago.
644 if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {
649 if (_this.file == null) {
654 this.refreshRequired = false;
655 // print("HTML RENDERING");
658 //this.get('/BottomPane').el.show();
659 //this.get('/BottomPane').el.set_current_page(2);// webkit inspector
660 _this.file.webkit_page_id = this.el.get_page_id();
662 var js = _this.file.toSourcePreview();
671 var project = _this.file.project;
673 //print (project.fn);
674 // set it to non-empty.
676 // runhtml = runhtml.length ? runhtml : '<script type="text/javascript"></script>';
679 // this.runhtml = this.runhtml || '';
682 // then we need to reload the browser using
683 // load_html_string..
685 // then trigger a redraw once it's loaded..
686 this.pendingRedraw = true;
688 var runhtml = "<script type=\"text/javascript\">\n" ;
692 GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + "/resources/roo.builder.js", out builderhtml);
697 runhtml += builderhtml + "\n";
698 runhtml += "</script>\n" ;
700 // fix to make sure they are the same..
701 this.runhtml = project.runhtml;
702 // need to modify paths
705 var base_template = _this.file.project.base_template;
707 if (base_template.length > 0 && !FileUtils.test(
708 BuilderApplication.configDirectory() + "/resources/" + base_template, FileTest.EXISTS)
710 print("invalid base_template name - using default: %s\n", base_template);
715 GLib.FileUtils.get_contents(
716 BuilderApplication.configDirectory() + "/resources/" +
717 (base_template.length > 0 ? base_template : "roo.builder.html")
723 this.renderedData = js;
726 string js_src = js + "\n" +
727 "Roo.onReady(function() {\n" +
728 "if (" + _this.file.name +".show) " + _this.file.name +".show({});\n" +
729 "Roo.XComponent.build();\n" +
732 // print("render js: " + js);
734 // console.log('not loaded yet');
736 this.lastRedraw = new DateTime.now_local();
739 //this.runjs = js_src;
740 var fc = FakeServerCache.factory_with_data(js_src);
741 this.runjs = fc.fname;
743 var html = inhtml.replace("</head>", runhtml + this.runhtml +
744 "<script type=\"text/javascript\" src=\"xhttp://localhost" + fc.fname + "\"></script>" +
745 // "<script type=\"text/javascript\">\n" +
750 //print("LOAD HTML " + html);
752 var rootURL = _this.file.project.rootURL;
756 this.el.load_html( html ,
757 //fixme - should be a config option!
758 (rootURL.length > 0 ? rootURL : "xhttp://localhost/app.Builder.js/")
761 // force the inspector...
762 // this.initInspector();
764 // - no need for this, the builder javascript will call it when build is complete
765 //GLib.Timeout.add_seconds(1, () => {
766 // this.el.run_javascript("Builder.saveHTML()",null);
769 // print( "before render" + this.lastRedraw);
770 // print( "after render" + (new Date()));
773 public void initInspector () {
775 /* if (this.inspector == this.el.get_inspector()) {
776 this.inspector.show();
777 this.inspector.open_window();
778 print("init inspecter called, and inspector is the same as existing\n");
781 print("new inspector?\n");
783 this.inspector = this.el.get_inspector();
784 this.inspector.ref();
786 // got a new inspector...
788 this.inspector.open_window.connect(() => {
789 this.inspector = this.el.get_inspector();
790 print("inspector attach\n");
791 var wv = this.inspector.get_web_view();
793 print("got inspector web view\n");
795 var cn = _this.inspectorcontainer.el.get_child();
797 _this.inspectorcontainer.el.remove(cn);
800 _this.inspectorcontainer.el.add(wv);
803 //this.inspector.close();
805 //this.inspector = null;
813 this.inspector.closed.connect(() => {
814 print("inspector closed?!?");
815 // if this happens destroy the webkit..
817 this.el.stop_loading();
819 if (_this.viewbox.el.get_parent() == null) {
824 _this.viewbox.el.remove(_this.viewcontainer.el);
825 _this.el.remove(_this.inspectorcontainer.el);
827 // destory seems to cause problems.
829 //_this.viewcontainer.el.destroy();
830 //_this.inspectorcontainer.el.destroy();
833 var nv =new Xcls_viewcontainer(_this);
835 _this.viewbox.el.pack_end(nv.el,true,true,0);
837 var inv =new Xcls_inspectorcontainer(_this);
839 _this.el.pack2(inv.el,true,true);
843 //while(Gtk.events_pending ()) Gtk.main_iteration ();
844 //_this.view.renderJS(true);
845 _this.view.refreshRequired = true;
850 this.inspector.show();
852 public void renderJS (bool force) {
854 // this is the public redraw call..
855 // we refresh in a loop privately..
856 var autodraw = _this.AutoRedraw.el.active;
857 if (!autodraw && !force) {
858 print("Skipping redraw - no force, and autodraw off");
862 this.refreshRequired = true;
868 public class Xcls_inspectorcontainer : Object
870 public Gtk.ScrolledWindow el;
871 private Xcls_WindowRooView _this;
877 public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
880 _this.inspectorcontainer = this;
881 this.el = new Gtk.ScrolledWindow( null, null );
885 // set gobject values
886 this.el.shadow_type = Gtk.ShadowType.IN;
890 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
893 // user defined functions
897 public class Xcls_ScrolledWindow14 : Object
899 public Gtk.ScrolledWindow el;
900 private Xcls_WindowRooView _this;
906 public Xcls_ScrolledWindow14(Xcls_WindowRooView _owner )
909 this.el = new Gtk.ScrolledWindow( null, null );
913 // set gobject values
914 var child_0 = new Xcls_sourceview( _this );
916 this.el.add ( child_0.el );
919 // user defined functions
921 public class Xcls_sourceview : Object
923 public Gtk.SourceView el;
924 private Xcls_WindowRooView _this;
929 public bool allow_node_scroll;
932 public Xcls_sourceview(Xcls_WindowRooView _owner )
935 _this.sourceview = this;
936 this.el = new Gtk.SourceView();
940 this.allow_node_scroll = true;
942 // set gobject values
943 this.el.editable = false;
944 this.el.show_line_marks = true;
945 this.el.show_line_numbers = true;
951 var description = Pango.FontDescription.from_string("monospace");
952 description.set_size(8000);
953 this.el.override_font(description);
956 var buf = this.el.get_buffer();
957 buf.notify.connect((ps) => {
961 if (ps.name != "cursor-position") {
964 print("cursor changed : %d\n", buf.cursor_position);
966 buf.get_iter_at_offset(out cpos, buf.cursor_position);
968 var ln = cpos.get_line();
970 var node = _this.file.lineToNode(ln);
973 print("can not find node\n");
976 var ltree = _this.main_window.windowstate.left_tree;
977 var tp = ltree.model.treePathFromNode(node);
978 print("got tree path %s\n", tp);
980 this.allow_node_scroll = false;
981 print("changing cursor on tree..\n");
982 ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
983 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
984 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
985 this.allow_node_scroll = true;
990 // highlight the node..
996 var attrs = new Gtk.SourceMarkAttributes();
997 var pink = Gdk.RGBA();
998 pink.parse ( "pink");
999 attrs.set_background ( pink);
1000 attrs.set_icon_name ( "process-stop");
1001 attrs.query_tooltip_text.connect(( mark) => {
1002 //print("tooltip query? %s\n", mark.name);
1006 this.el.set_mark_attributes ("ERR", attrs, 1);
1008 var wattrs = new Gtk.SourceMarkAttributes();
1009 var blue = Gdk.RGBA();
1010 blue.parse ( "#ABF4EB");
1011 wattrs.set_background ( blue);
1012 wattrs.set_icon_name ( "process-stop");
1013 wattrs.query_tooltip_text.connect(( mark) => {
1014 //print("tooltip query? %s\n", mark.name);
1018 this.el.set_mark_attributes ("WARN", wattrs, 1);
1022 var dattrs = new Gtk.SourceMarkAttributes();
1023 var purple = Gdk.RGBA();
1024 purple.parse ( "#EEA9FF");
1025 dattrs.set_background ( purple);
1026 dattrs.set_icon_name ( "process-stop");
1027 dattrs.query_tooltip_text.connect(( mark) => {
1028 //print("tooltip query? %s\n", mark.name);
1032 this.el.set_mark_attributes ("DEPR", dattrs, 1);
1035 var gattrs = new Gtk.SourceMarkAttributes();
1036 var grey = Gdk.RGBA();
1037 grey.parse ( "#ccc");
1038 gattrs.set_background ( grey);
1041 this.el.set_mark_attributes ("grey", gattrs, 1);
1051 // user defined functions
1052 public void nodeSelected (JsRender.Node? sel) {
1056 // this is connected in widnowstate
1057 print("node selected\n");
1058 var buf = this.el.get_buffer();
1060 var sbuf = (Gtk.SourceBuffer) buf;
1063 while(Gtk.events_pending()) {
1064 Gtk.main_iteration();
1068 // clear all the marks..
1072 sbuf.get_bounds (out start, out end);
1073 sbuf.remove_source_marks (start, end, "grey");
1077 // no highlighting..
1081 sbuf.get_iter_at_line(out iter, sel.line_start);
1084 Gtk.TextIter cur_iter;
1085 sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
1087 //var cur_line = cur_iter.get_line();
1088 //if (cur_line > sel.line_start && cur_line < sel.line_end) {
1091 if (this.allow_node_scroll) {
1093 this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
1098 for (var i = 0; i < buf.get_line_count();i++) {
1099 if (i < sel.line_start || i > sel.line_end) {
1101 sbuf.get_iter_at_line(out iter, i);
1102 sbuf.create_source_mark(null, "grey", iter);
1110 public string toString () {
1113 this.el.get_buffer().get_start_iter(out s);
1114 this.el.get_buffer().get_end_iter(out e);
1115 var ret = this.el.get_buffer().get_text(s,e,true);
1116 //print("TO STRING? " + ret);
1119 public void loadFile ( ) {
1120 this.loading = true;
1121 var buf = this.el.get_buffer();
1123 var sbuf = (Gtk.SourceBuffer) buf;
1127 if (_this.file == null || _this.file.xtype != "Gtk") {
1128 print("xtype != Gtk");
1129 this.loading = false;
1135 var regex = new Regex("\\.bjs$");
1138 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
1139 } catch (GLib.RegexError e) {
1140 this.loading = false;
1145 if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
1146 print("File path has no errors\n");
1147 this.loading = false;
1154 GLib.FileUtils.get_contents (valafn, out str);
1156 this.loading = false;
1160 // print("setting str %d\n", str.length);
1161 buf.set_text(str, str.length);
1162 var lm = Gtk.SourceLanguageManager.get_default();
1164 //?? is javascript going to work as js?
1166 ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));
1172 sbuf.get_bounds (out start, out end);
1173 sbuf.remove_source_marks (start, end, null); // remove all marks..
1176 if (_this.main_window.windowstate.last_compile_result != null) {
1177 var obj = _this.main_window.windowstate.last_compile_result;
1178 this.highlightErrorsJson("ERR", obj);
1179 this.highlightErrorsJson("WARN", obj);
1180 this.highlightErrorsJson("DEPR", obj);
1182 //while (Gtk.events_pending()) {
1183 // Gtk.main_iteration();
1186 this.loading = false;
1188 public void highlightErrorsJson (string type, Json.Object obj) {
1192 var buf = this.el.get_buffer();
1193 var sbuf = (Gtk.SourceBuffer)buf;
1194 buf.get_bounds (out start, out end);
1196 sbuf.remove_source_marks (start, end, type);
1199 // we should highlight other types of errors..
1201 if (!obj.has_member(type)) {
1202 print("Return has no errors\n");
1205 var err = obj.get_object_member(type);
1207 if (_this.file == null) {
1208 return; // just in case the file has not loaded yet?
1214 var regex = new Regex("\\.bjs$");
1217 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
1218 } catch (GLib.RegexError e) {
1222 if (!err.has_member(valafn)) {
1223 print("File path has no errors\n");
1226 var lines = err.get_object_member(valafn);
1230 var tlines = buf.get_line_count () +1;
1232 lines.foreach_member((obj, line, node) => {
1235 // print("get inter\n");
1236 var eline = int.parse(line) -1 ;
1237 print("GOT ERROR on line %s -- converted to %d\n", line,eline);
1240 if (eline > tlines || eline < 0) {
1243 sbuf.get_iter_at_line( out iter, eline);
1244 //print("mark line\n");
1245 var msg = type + " on line: %d - %s".printf(eline+1, valafn);
1246 var ar = lines.get_array_member(line);
1247 for (var i = 0 ; i < ar.get_length(); i++) {
1248 msg += (msg.length > 0) ? "\n" : "";
1249 msg += ar.get_string_element(i);
1253 sbuf.create_source_mark(msg, type, iter);