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);
132 public void forwardSearch (bool change_focus) {
134 if (this.searchcontext == null) {
137 this.notebook.el.page = 1;
138 Gtk.TextIter beg, st,en, stl;
140 var buf = this.sourceview.el.get_buffer();
141 buf.get_iter_at_offset(out beg, this.last_search_end);
142 if (!this.searchcontext.forward(beg, out st, out en)) {
143 this.last_search_end = 0;
145 this.last_search_end = en.get_offset();
147 this.sourceview.el.grab_focus();
149 buf.place_cursor(st);
150 var ln = st.get_line();
151 buf.get_iter_at_line(out stl,ln);
153 this.sourceview.el.scroll_to_iter(stl, 0.0f, true, 0.0f, 0.5f);
157 public class Xcls_notebook : Object
159 public Gtk.Notebook el;
160 private Xcls_WindowRooView _this;
166 public Xcls_notebook(Xcls_WindowRooView _owner )
169 _this.notebook = this;
170 this.el = new Gtk.Notebook();
174 // set gobject values
175 var child_0 = new Xcls_label_preview( _this );
177 var child_1 = new Xcls_label_code( _this );
179 var child_2 = new Xcls_paned( _this );
181 this.el.add ( child_2.el );
182 var child_3 = new Xcls_ScrolledWindow14( _this );
184 this.el.append_page ( child_3.el , _this.label_code.el );
187 // user defined functions
189 public class Xcls_label_preview : Object
192 private Xcls_WindowRooView _this;
198 public Xcls_label_preview(Xcls_WindowRooView _owner )
201 _this.label_preview = this;
202 this.el = new Gtk.Label( "Preview" );
206 // set gobject values
209 // user defined functions
212 public class Xcls_label_code : Object
215 private Xcls_WindowRooView _this;
221 public Xcls_label_code(Xcls_WindowRooView _owner )
224 _this.label_code = this;
225 this.el = new Gtk.Label( "Preview Generated Code" );
229 // set gobject values
232 // user defined functions
235 public class Xcls_paned : Object
238 private Xcls_WindowRooView _this;
244 public Xcls_paned(Xcls_WindowRooView _owner )
248 this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL );
252 // set gobject values
253 var child_0 = new Xcls_viewbox( _this );
255 this.el.pack1 ( child_0.el , true,true );
256 var child_1 = new Xcls_inspectorcontainer( _this );
258 this.el.pack2 ( child_1.el , true,true );
261 // user defined functions
263 public class Xcls_viewbox : Object
266 private Xcls_WindowRooView _this;
272 public Xcls_viewbox(Xcls_WindowRooView _owner )
275 _this.viewbox = this;
276 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
280 // set gobject values
281 this.el.homogeneous = false;
282 var child_0 = new Xcls_Box7( _this );
284 this.el.pack_start ( child_0.el , false,true,0 );
285 var child_1 = new Xcls_viewcontainer( _this );
287 this.el.pack_end ( child_1.el , true,true,0 );
290 // user defined functions
292 public class Xcls_Box7 : Object
295 private Xcls_WindowRooView _this;
301 public Xcls_Box7(Xcls_WindowRooView _owner )
304 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
308 // set gobject values
309 this.el.homogeneous = true;
310 this.el.height_request = 20;
311 this.el.vexpand = false;
312 var child_0 = new Xcls_Button8( _this );
314 this.el.pack_start ( child_0.el , false,false,0 );
315 var child_1 = new Xcls_AutoRedraw( _this );
317 this.el.pack_start ( child_1.el , false,false,0 );
318 var child_2 = new Xcls_Button10( _this );
320 this.el.pack_start ( child_2.el , false,false,0 );
323 // user defined functions
325 public class Xcls_Button8 : Object
327 public Gtk.Button el;
328 private Xcls_WindowRooView _this;
334 public Xcls_Button8(Xcls_WindowRooView _owner )
337 this.el = new Gtk.Button();
341 // set gobject values
342 this.el.label = "Redraw";
345 this.el.clicked.connect( ( ) => {
346 _this.view.renderJS( true);
350 // user defined functions
353 public class Xcls_AutoRedraw : Object
355 public Gtk.CheckButton el;
356 private Xcls_WindowRooView _this;
362 public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
365 _this.AutoRedraw = this;
366 this.el = new Gtk.CheckButton();
370 // set gobject values
371 this.el.active = true;
372 this.el.label = "Auto Redraw On";
375 this.el.toggled.connect( (state) => {
376 this.el.set_label(this.el.active ? "Auto Redraw On" : "Auto Redraw Off");
380 // user defined functions
383 public class Xcls_Button10 : Object
385 public Gtk.Button el;
386 private Xcls_WindowRooView _this;
392 public Xcls_Button10(Xcls_WindowRooView _owner )
395 this.el = new Gtk.Button();
399 // set gobject values
400 this.el.label = "Full Redraw";
403 this.el.clicked.connect( () => {
404 _this.view.redraws = 99;
405 _this.view.el.web_context.clear_cache();
406 //_this.view.renderJS(true);
407 FakeServerCache.clear();
413 // user defined functions
417 public class Xcls_viewcontainer : Object
419 public Gtk.ScrolledWindow el;
420 private Xcls_WindowRooView _this;
426 public Xcls_viewcontainer(Xcls_WindowRooView _owner )
429 _this.viewcontainer = this;
430 this.el = new Gtk.ScrolledWindow( null, null );
434 // set gobject values
435 this.el.shadow_type = Gtk.ShadowType.IN;
436 var child_0 = new Xcls_view( _this );
438 this.el.add ( child_0.el );
442 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
445 // user defined functions
447 public class Xcls_view : Object
449 public WebKit.WebView el;
450 private Xcls_WindowRooView _this;
454 public string renderedData;
455 public bool refreshRequired;
456 public WebKit.WebInspector inspector;
459 public GLib.DateTime lastRedraw;
460 public string runhtml;
461 public bool pendingRedraw;
464 public Xcls_view(Xcls_WindowRooView _owner )
468 this.el = new WebKit.WebView();
471 this.renderedData = "";
472 this.refreshRequired = false;
475 this.lastRedraw = null;
477 this.pendingRedraw = false;
479 // set gobject values
484 // this may not work!?
485 var settings = this.el.get_settings();
486 settings.enable_developer_extras = true;
489 var fs= new FakeServer(this.el);
491 // this was an attempt to change the url perms.. did not work..
492 // settings.enable_file_access_from_file_uris = true;
493 // settings.enable_offline_web_application_cache - true;
494 // settings.enable_universal_access_from_file_uris = true;
501 // FIXME - base url of script..
502 // we need it so some of the database features work.
503 this.el.load_html( "Render not ready" ,
504 //fixme - should be a config option!
505 // or should we catch stuff and fix it up..
506 "http://localhost/app.Builder/"
510 //this.el.open('file:///' + __script_path__ + '/../builder.html');
515 Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
516 null, // list of targets
517 Gdk.DragAction.COPY // what to do with data after dropped
520 // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
521 Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
523 GLib.Timeout.add_seconds(1, () =>{
524 //print("run refresh?");
525 if (this.el == null) {
536 this.el.script_dialog.connect( (dialog) => {
537 if (this.el == null) {
541 var msg = dialog.get_message();
542 if (msg.length < 4) {
545 if (msg.substring(0,4) != "IPC:") {
548 var ar = msg.split(":", 3);
554 _this.file.saveHTML(ar[2]);
561 this.el.show.connect( ( ) => {
562 this.initInspector();;
564 this.el.drag_drop.connect( ( ctx, x, y,time, ud) => {
567 print("TARGET: drag-drop");
568 var is_valid_drop_site = true;
573 w, // will receive 'drag-data-received' signal
574 ctx, /* represents the current state of the DnD
575 this.get('/Window').atoms["STRING"], /* the target type we want
580 /* No target offered by source => error
583 return is_valid_drop_site;
586 this.el.load_changed.connect( (le) => {
587 if (le != WebKit.LoadEvent.FINISHED) {
590 if (this.runjs.length < 1) {
593 // this.el.run_javascript(this.runjs, null);
594 FakeServerCache.remove( this.runjs);
599 // user defined functions
600 public void reInit () {
602 // if this happens destroy the webkit..
604 this.el.stop_loading();
606 if (_this.viewbox.el.get_parent() == null) {
611 _this.viewbox.el.remove(_this.viewcontainer.el);
612 _this.paned.el.remove(_this.inspectorcontainer.el);
614 // destory seems to cause problems.
616 //_this.viewcontainer.el.destroy();
617 //_this.inspectorcontainer.el.destroy();
618 var inv =new Xcls_inspectorcontainer(_this);
620 _this.paned.el.pack2(inv.el,true,true);
624 var nv =new Xcls_viewcontainer(_this);
626 _this.viewbox.el.pack_end(nv.el,true,true,0);
631 //while(Gtk.events_pending ()) Gtk.main_iteration ();
632 //_this.view.renderJS(true);
633 _this.view.refreshRequired = true;
635 public void runRefresh ()
637 // this is run every 2 seconds from the init..
641 if (!this.refreshRequired) {
642 // print("no refresh required");
646 if (this.lastRedraw != null) {
647 // do not redraw if last redraw was less that 5 seconds ago.
648 if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {
653 if (_this.file == null) {
658 this.refreshRequired = false;
659 // print("HTML RENDERING");
662 //this.get('/BottomPane').el.show();
663 //this.get('/BottomPane').el.set_current_page(2);// webkit inspector
664 _this.file.webkit_page_id = this.el.get_page_id();
666 var js = _this.file.toSourcePreview();
675 var project = _this.file.project;
677 //print (project.fn);
678 // set it to non-empty.
680 // runhtml = runhtml.length ? runhtml : '<script type="text/javascript"></script>';
683 // this.runhtml = this.runhtml || '';
686 // then we need to reload the browser using
687 // load_html_string..
689 // then trigger a redraw once it's loaded..
690 this.pendingRedraw = true;
692 var runhtml = "<script type=\"text/javascript\">\n" ;
696 GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + "/resources/roo.builder.js", out builderhtml);
701 runhtml += builderhtml + "\n";
702 runhtml += "</script>\n" ;
704 // fix to make sure they are the same..
705 this.runhtml = project.runhtml;
706 // need to modify paths
709 var base_template = _this.file.project.base_template;
711 if (base_template.length > 0 && !FileUtils.test(
712 BuilderApplication.configDirectory() + "/resources/" + base_template, FileTest.EXISTS)
714 print("invalid base_template name - using default: %s\n", base_template);
719 GLib.FileUtils.get_contents(
720 BuilderApplication.configDirectory() + "/resources/" +
721 (base_template.length > 0 ? base_template : "roo.builder.html")
727 this.renderedData = js;
730 string js_src = js + "\n" +
731 "Roo.onReady(function() {\n" +
732 "if (" + _this.file.name +".show) " + _this.file.name +".show({});\n" +
733 "Roo.XComponent.build();\n" +
736 // print("render js: " + js);
738 // console.log('not loaded yet');
740 this.lastRedraw = new DateTime.now_local();
743 //this.runjs = js_src;
744 var fc = FakeServerCache.factory_with_data(js_src);
745 this.runjs = fc.fname;
747 var html = inhtml.replace("</head>", runhtml + this.runhtml +
748 "<script type=\"text/javascript\" src=\"xhttp://localhost" + fc.fname + "\"></script>" +
749 // "<script type=\"text/javascript\">\n" +
754 //print("LOAD HTML " + html);
756 var rootURL = _this.file.project.rootURL;
760 this.el.load_html( html ,
761 //fixme - should be a config option!
762 (rootURL.length > 0 ? rootURL : "xhttp://localhost/app.Builder.js/")
765 // force the inspector...
766 // this.initInspector();
768 // - no need for this, the builder javascript will call it when build is complete
769 //GLib.Timeout.add_seconds(1, () => {
770 // this.el.run_javascript("Builder.saveHTML()",null);
773 // print( "before render" + this.lastRedraw);
774 // print( "after render" + (new Date()));
777 public void initInspector () {
779 /* if (this.inspector == this.el.get_inspector()) {
780 this.inspector.show();
781 this.inspector.open_window();
782 print("init inspecter called, and inspector is the same as existing\n");
785 print("new inspector?\n");
787 this.inspector = this.el.get_inspector();
788 this.inspector.ref();
790 // got a new inspector...
792 this.inspector.open_window.connect(() => {
793 this.inspector = this.el.get_inspector();
794 print("inspector attach\n");
795 var wv = this.inspector.get_web_view();
797 print("got inspector web view\n");
799 var cn = _this.inspectorcontainer.el.get_child();
801 _this.inspectorcontainer.el.remove(cn);
804 _this.inspectorcontainer.el.add(wv);
807 //this.inspector.close();
809 //this.inspector = null;
817 this.inspector.closed.connect(() => {
818 print("inspector closed?!?");
819 // if this happens destroy the webkit..
821 this.el.stop_loading();
823 if (_this.viewbox.el.get_parent() == null) {
828 _this.viewbox.el.remove(_this.viewcontainer.el);
829 _this.el.remove(_this.inspectorcontainer.el);
831 // destory seems to cause problems.
833 //_this.viewcontainer.el.destroy();
834 //_this.inspectorcontainer.el.destroy();
837 var nv =new Xcls_viewcontainer(_this);
839 _this.viewbox.el.pack_end(nv.el,true,true,0);
841 var inv =new Xcls_inspectorcontainer(_this);
843 _this.el.pack2(inv.el,true,true);
847 //while(Gtk.events_pending ()) Gtk.main_iteration ();
848 //_this.view.renderJS(true);
849 _this.view.refreshRequired = true;
854 this.inspector.show();
856 public void renderJS (bool force) {
858 // this is the public redraw call..
859 // we refresh in a loop privately..
860 var autodraw = _this.AutoRedraw.el.active;
861 if (!autodraw && !force) {
862 print("Skipping redraw - no force, and autodraw off");
866 this.refreshRequired = true;
872 public class Xcls_inspectorcontainer : Object
874 public Gtk.ScrolledWindow el;
875 private Xcls_WindowRooView _this;
881 public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
884 _this.inspectorcontainer = this;
885 this.el = new Gtk.ScrolledWindow( null, null );
889 // set gobject values
890 this.el.shadow_type = Gtk.ShadowType.IN;
894 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
897 // user defined functions
901 public class Xcls_ScrolledWindow14 : Object
903 public Gtk.ScrolledWindow el;
904 private Xcls_WindowRooView _this;
910 public Xcls_ScrolledWindow14(Xcls_WindowRooView _owner )
913 this.el = new Gtk.ScrolledWindow( null, null );
917 // set gobject values
918 var child_0 = new Xcls_sourceview( _this );
920 this.el.add ( child_0.el );
923 // user defined functions
925 public class Xcls_sourceview : Object
927 public Gtk.SourceView el;
928 private Xcls_WindowRooView _this;
933 public bool allow_node_scroll;
936 public Xcls_sourceview(Xcls_WindowRooView _owner )
939 _this.sourceview = this;
940 this.el = new Gtk.SourceView();
944 this.allow_node_scroll = true;
946 // set gobject values
947 this.el.editable = false;
948 this.el.show_line_marks = true;
949 this.el.show_line_numbers = true;
955 var description = Pango.FontDescription.from_string("monospace");
956 description.set_size(8000);
957 this.el.override_font(description);
960 var buf = this.el.get_buffer();
961 buf.notify.connect((ps) => {
965 if (ps.name != "cursor-position") {
968 print("cursor changed : %d\n", buf.cursor_position);
970 buf.get_iter_at_offset(out cpos, buf.cursor_position);
972 var ln = cpos.get_line();
974 var node = _this.file.lineToNode(ln);
977 print("can not find node\n");
980 var ltree = _this.main_window.windowstate.left_tree;
981 var tp = ltree.model.treePathFromNode(node);
982 print("got tree path %s\n", tp);
984 this.allow_node_scroll = false;
985 print("changing cursor on tree..\n");
986 ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
987 // scrolling is disabled... as node selection calls scroll 10ms after it changes.
988 GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
989 this.allow_node_scroll = true;
994 // highlight the node..
1000 var attrs = new Gtk.SourceMarkAttributes();
1001 var pink = Gdk.RGBA();
1002 pink.parse ( "pink");
1003 attrs.set_background ( pink);
1004 attrs.set_icon_name ( "process-stop");
1005 attrs.query_tooltip_text.connect(( mark) => {
1006 //print("tooltip query? %s\n", mark.name);
1010 this.el.set_mark_attributes ("ERR", attrs, 1);
1012 var wattrs = new Gtk.SourceMarkAttributes();
1013 var blue = Gdk.RGBA();
1014 blue.parse ( "#ABF4EB");
1015 wattrs.set_background ( blue);
1016 wattrs.set_icon_name ( "process-stop");
1017 wattrs.query_tooltip_text.connect(( mark) => {
1018 //print("tooltip query? %s\n", mark.name);
1022 this.el.set_mark_attributes ("WARN", wattrs, 1);
1026 var dattrs = new Gtk.SourceMarkAttributes();
1027 var purple = Gdk.RGBA();
1028 purple.parse ( "#EEA9FF");
1029 dattrs.set_background ( purple);
1030 dattrs.set_icon_name ( "process-stop");
1031 dattrs.query_tooltip_text.connect(( mark) => {
1032 //print("tooltip query? %s\n", mark.name);
1036 this.el.set_mark_attributes ("DEPR", dattrs, 1);
1039 var gattrs = new Gtk.SourceMarkAttributes();
1040 var grey = Gdk.RGBA();
1041 grey.parse ( "#ccc");
1042 gattrs.set_background ( grey);
1045 this.el.set_mark_attributes ("grey", gattrs, 1);
1055 // user defined functions
1056 public void nodeSelected (JsRender.Node? sel) {
1060 // this is connected in widnowstate
1061 print("node selected\n");
1062 var buf = this.el.get_buffer();
1064 var sbuf = (Gtk.SourceBuffer) buf;
1067 while(Gtk.events_pending()) {
1068 Gtk.main_iteration();
1072 // clear all the marks..
1076 sbuf.get_bounds (out start, out end);
1077 sbuf.remove_source_marks (start, end, "grey");
1081 print("no selected node\n");
1082 // no highlighting..
1086 print("highlight region %d to %d\n", sel.line_start,sel.line_end);
1088 sbuf.get_iter_at_line(out iter, sel.line_start);
1091 Gtk.TextIter cur_iter;
1092 sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
1094 //var cur_line = cur_iter.get_line();
1095 //if (cur_line > sel.line_start && cur_line < sel.line_end) {
1098 if (this.allow_node_scroll) {
1100 this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
1105 for (var i = 0; i < buf.get_line_count();i++) {
1106 if (i < sel.line_start || i > sel.line_end) {
1108 sbuf.get_iter_at_line(out iter, i);
1109 sbuf.create_source_mark(null, "grey", iter);
1117 public string toString () {
1120 this.el.get_buffer().get_start_iter(out s);
1121 this.el.get_buffer().get_end_iter(out e);
1122 var ret = this.el.get_buffer().get_text(s,e,true);
1123 //print("TO STRING? " + ret);
1126 public void loadFile ( ) {
1127 this.loading = true;
1128 var buf = this.el.get_buffer();
1130 var sbuf = (Gtk.SourceBuffer) buf;
1134 if (_this.file == null || _this.file.xtype != "Roo") {
1135 print("xtype != Gtk");
1136 this.loading = false;
1142 var regex = new Regex("\\.bjs$");
1145 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".js");
1146 } catch (GLib.RegexError e) {
1147 this.loading = false;
1152 if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
1153 print("File path has no errors\n");
1154 this.loading = false;
1161 GLib.FileUtils.get_contents (valafn, out str);
1163 this.loading = false;
1167 // print("setting str %d\n", str.length);
1168 buf.set_text(str, str.length);
1169 var lm = Gtk.SourceLanguageManager.get_default();
1171 //?? is javascript going to work as js?
1173 ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));
1179 sbuf.get_bounds (out start, out end);
1180 sbuf.remove_source_marks (start, end, null); // remove all marks..
1185 this.loading = false;
1187 public void highlightErrorsJson (string type, Json.Object obj) {
1191 var buf = this.el.get_buffer();
1192 var sbuf = (Gtk.SourceBuffer)buf;
1193 buf.get_bounds (out start, out end);
1195 sbuf.remove_source_marks (start, end, type);
1198 // we should highlight other types of errors..
1200 if (!obj.has_member(type)) {
1201 print("Return has no errors\n");
1204 var err = obj.get_object_member(type);
1206 if (_this.file == null) {
1207 return; // just in case the file has not loaded yet?
1213 var regex = new Regex("\\.bjs$");
1216 valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
1217 } catch (GLib.RegexError e) {
1221 if (!err.has_member(valafn)) {
1222 print("File path has no errors\n");
1225 var lines = err.get_object_member(valafn);
1229 var tlines = buf.get_line_count () +1;
1231 lines.foreach_member((obj, line, node) => {
1234 // print("get inter\n");
1235 var eline = int.parse(line) -1 ;
1236 print("GOT ERROR on line %s -- converted to %d\n", line,eline);
1239 if (eline > tlines || eline < 0) {
1242 sbuf.get_iter_at_line( out iter, eline);
1243 //print("mark line\n");
1244 var msg = type + " on line: %d - %s".printf(eline+1, valafn);
1245 var ar = lines.get_array_member(line);
1246 for (var i = 0 ; i < ar.get_length(); i++) {
1247 msg += (msg.length > 0) ? "\n" : "";
1248 msg += ar.get_string_element(i);
1252 sbuf.create_source_mark(msg, type, iter);