src/Builder4/WindowState.vala
authorAlan Knowles <alan@roojs.com>
Wed, 27 May 2015 07:47:34 +0000 (15:47 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 27 May 2015 07:47:34 +0000 (15:47 +0800)
src/Builder4/WindowState.vala

index 2f7f753..1b17e5f 100644 (file)
@@ -428,42 +428,61 @@ public class WindowState : Object
        public void fileViewOpen(JsRender.JsRender file)
        {
                this.win.project = file.project;
-               this.switchState (State.PREVIEW); 
+               
+               if (file.xtype == "PlainFile") {
+                       this.switchState (State.CODEONLY); 
+               } else {
+               
+                       this.switchState (State.PREVIEW); 
+                       this.left_tree.model.loadFile(file);
+
+               }
        
-               this.left_tree.model.loadFile(file);
        
                var ctr= ((Gtk.Container)(this.win.rooview.el.get_widget()));
                var ctr_p= ((Gtk.Container)(this.win.projecteditview.el.get_widget()));
        
-               if (file.xtype == "Roo" ) { 
+               if (file.project.xtype == "Roo" ) { 
                        ctr.foreach( (w) => { ctr.remove(w); });
                        ctr_p.foreach( (w) => { ctr_p.remove(w); });
                        ctr.add(this.window_rooview.el);
-                       ctr_p.add(this.projectsettings.el);            
-                       this.window_rooview.loadFile(file);
-                       this.window_rooview.el.show_all();
+                       ctr_p.add(this.projectsettings.el);
+                       if (file.xtype != "PlainFile") {       
+                               this.window_rooview.loadFile(file);
+                               this.window_rooview.el.show_all();
+                       }
                        this.projectsettings.el.show_all();            
+                       
 
                } else {
                        ctr.foreach( (w) => { ctr.remove(w); });
                        ctr_p.foreach( (w) => { ctr_p.remove(w); });            
                        ctr.add(this.window_gladeview.el);
                        ctr_p.add(this.vala_projectsettings.el);
-                       this.window_gladeview.loadFile(file);
-                       this.window_gladeview.el.show_all();
+                       if (file.xtype != "PlainFile") {    
+                               this.window_gladeview.loadFile(file);
+                               this.window_gladeview.el.show_all();
+                       }
                        this.vala_projectsettings.el.show_all();
                }
                print("OPEN : " + file.name);
-               this.win.editpane.el.set_position(this.win.editpane.el.max_position);
-               this.win.setTitle(file.project.name + " : " +file.name);
+               if (file.xtype != "PlainFile") {    
+                       this.win.editpane.el.set_position(this.win.editpane.el.max_position);
+               }
+               this.win.setTitle(file.project.name + " : " + file.name);
                         
 
        }
-       public void fileViewOpenPlain(string file)
+       public void fileViewOpenPlain(Project proj, string file)
        {
-               
+               this.win.project = proj;
                this.switchState (State.CODEONLY); 
-               
+               if (project.xtype == "Roo" ) {
+                       this.projectsettings.el.show_all();   
+               } else {
+                       this.vala_projectsettings.el.show_all();
+       
+                       
        }
        
        // ---------  webkit view