resources/RooUsage.txt
[app.Builder.js] / src / Builder4 / WindowState.vala
index c4d7df6..b9b7ee6 100644 (file)
@@ -15,7 +15,7 @@ public class WindowState : Object
                OBJECT,
                PROP,
                LISTENER,
-               CODE,
+               CODE,    // code editor.
                CODEONLY,
                FILES,
                PROJECT, // project settings..
@@ -95,7 +95,7 @@ public class WindowState : Object
                
                
                this.valasource = new Palete.ValaSource();
-               this.valasource.compiled.connect(this.valaCompiled);
+               this.valasource.compiled.connect(this.showCompileResult);
                
                this.compile_results = new  Xcls_ValaCompileResults();
                this.compile_results.window = this.win;
@@ -122,7 +122,7 @@ public class WindowState : Object
                this.left_tree.before_node_change.connect(() => {
                        // if the node change is caused by the editor (code preview)
                        if (this.left_tree.view.lastEventSource == "editor") {
-                               return false;
+                               return true;
                        }
                        return this.leftTreeBeforeChange();
 
@@ -139,12 +139,12 @@ public class WindowState : Object
                        }
                });
                
-               this.left_tree.node_selected.connect((sel) => {
-                       this.leftTreeNodeSelected(sel);
+               this.left_tree.node_selected.connect((sel, source) => {
+                       this.leftTreeNodeSelected(sel, source);
                });
         
                this.left_tree.changed.connect(() => {
-                       
+                       print("LEFT TREE: Changed fired\n");
                        this.file.save();
                        if (this.left_tree.getActiveFile().xtype == "Roo" ) {
                                   this.window_rooview.requestRedraw();
@@ -168,7 +168,7 @@ public class WindowState : Object
                return false;
        }
        
-       public void leftTreeNodeSelected(JsRender.Node? sel)
+       public void leftTreeNodeSelected(JsRender.Node? sel, string source)
        {
 
                print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
@@ -1135,10 +1135,16 @@ public class WindowState : Object
        }
        
        
-       public void valaCompiled(Json.Object obj)
+       public void showCompileResult(Json.Object obj)
                {
                        // vala has finished compiling...
                        print("vala compiled");
+                       var generator = new Json.Generator ();
+                       var n  = new Json.Node(Json.NodeType.OBJECT);
+                       n.init_object(obj);
+                       generator.set_root (n);
+                       print("result :%s", generator.to_data (null));
+                       
                        
                        var buf = this.code_editor.buffer;
                        buf.check_running = false;
@@ -1167,10 +1173,11 @@ public class WindowState : Object
                        } else {
                                this.win.statusbar_depricated.setNotices( new Json.Object(),0);
                        }
-                       
-                       buf.highlightErrorsJson("ERR", obj);
-                       buf.highlightErrorsJson("WARN", obj);
-                       buf.highlightErrorsJson("DEPR", obj);
+                       if (this.state == State.CODE || this.state == State.PROJECTCODEONLY) {
+                               buf.highlightErrorsJson("ERR", obj); 
+                               buf.highlightErrorsJson("WARN", obj);
+                               buf.highlightErrorsJson("DEPR", obj);
+                       }
                        
                        this.win.statusbar_compilestatus_label.el.hide();
                        this.win.statusbar_run.el.hide();
@@ -1184,8 +1191,22 @@ public class WindowState : Object
                                gbuf.highlightErrorsJson("ERR", obj);
                                gbuf.highlightErrorsJson("WARN", obj);
                                gbuf.highlightErrorsJson("DEPR", obj);                  
+                               
+                               if (!has_errors) {
+                                       this.win.statusbar_run.el.show();
+                               }
                        
                   }
+                  
+                  if (this.file.xtype == "Gtk") {
+                               // not sure how this is working ok? - as highlighting is happening on the vala files at present..
+                               var gbuf =   this.window_rooview.sourceview;
+                               gbuf.highlightErrorsJson("ERR", obj);
+                               gbuf.highlightErrorsJson("WARN", obj);
+                               gbuf.highlightErrorsJson("DEPR", obj);                  
+                       
+                  }
+                  
                        this.last_compile_result = obj;