sync
[app.Builder.js] / src / Builder4 / WindowState.vala
index 8321950..0060daa 100644 (file)
@@ -8,7 +8,7 @@
 public class WindowState : Object 
 {
        public Xcls_MainWindow win;
-
        public enum State {
                NONE,
                PREVIEW,
@@ -30,8 +30,7 @@ public class WindowState : Object
         
        public Project.Project project;
        public JsRender.JsRender file;
-       
-       
+        
        
        public Xcls_WindowLeftTree  left_tree;
        public Xcls_WindowAddProp   add_props;
@@ -94,13 +93,7 @@ public class WindowState : Object
                this.template_select = new DialogTemplateSelect();
                this.children_loaded = true;
                
-               this.left_tree.node_selected.connect((sel) => {
-                       if (this.file.xtype == "Roo") { 
-                               this.window_rooview.sourceview.nodeSelected(sel);                       
-                       } else {
-                               this.window_gladeview.sourceview.nodeSelected(sel);
-                       }
-               });
+               
                this.valasource = new Palete.ValaSource();
                this.valasource.compiled.connect(this.valaCompiled);
                
@@ -130,7 +123,18 @@ public class WindowState : Object
                        return this.leftTreeBeforeChange();
 
                });
-
+               
+               this.left_tree.node_selected.connect((sel, source) => {
+                       if (source == "editor") {
+                               return;
+                       }
+                       if (this.file.xtype == "Roo") { 
+                               this.window_rooview.sourceview.nodeSelected(sel,true); // foce scroll.
+                       } else {
+                               this.window_gladeview.sourceview.nodeSelected(sel);
+                       }
+               });
+               
                this.left_tree.node_selected.connect((sel) => {
                        this.leftTreeNodeSelected(sel);
                });
@@ -504,8 +508,25 @@ public class WindowState : Object
                         
 
        }
-        
+       // our project properties is different for Roo and Gtk
+       // it would be better to change the above code to use this, 
+       public void attachProjectSettings() {
+       
+               var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
+               
+               if (this.win.project.xtype == "Roo" ) { 
+                       ctr_p.foreach( (w) => { ctr_p.remove(w); });
+                       ctr_p.add(this.projectsettings.el);
+                       this.projectsettings.el.show_all();            
+
+               } else {
+                       ctr_p.foreach( (w) => { ctr_p.remove(w); });            
+                       ctr_p.add(this.vala_projectsettings.el);
+                       this.vala_projectsettings.el.show_all();
+               }
+       
        
+       }
        // ---------  webkit view
        public void webkitViewInit()
        {
@@ -790,7 +811,7 @@ public class WindowState : Object
                        case State.PROJECTCODEONLY:
                            // going to project edit (when in code only)
 
-               
+                               
                            
                                if (this.win.project.xtype == "Roo") {
                                        this.projectsettings.el.show_all();
@@ -822,6 +843,12 @@ public class WindowState : Object
                                
                        case State.FILEPROJECT:
                                var pr = this.left_projects.getSelectedProject();
+
+                               this.win.project = pr;
+                               
+                               this.attachProjectSettings();
+                               print("FIlE PROJECT -  show %s\n", pr.xtype);
+                               
                                if (pr.xtype == "Roo") {
                                        this.projectsettings.el.show_all();
                                        this.projectsettings.show(this.win.project);
@@ -1135,12 +1162,12 @@ public class WindowState : Object
                        
                        this.win.statusbar_compilestatus_label.el.hide();
                        this.win.statusbar_run.el.hide();
-                       
-                       if (this.file.xtype == "Gtk") {
+                       if (!has_errors) { 
                                this.win.statusbar_compilestatus_label.el.show();
-                               if (!has_errors) { 
-                                       this.win.statusbar_run.el.show();
-                               }
+                               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_gladeview.sourceview;
                                gbuf.highlightErrorsJson("ERR", obj);
                                gbuf.highlightErrorsJson("WARN", obj);