From 13a5658e782fd95cbd793e73e1ca41013acf53b9 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 27 May 2015 15:47:34 +0800 Subject: [PATCH] src/Builder4/WindowState.vala --- src/Builder4/WindowState.vala | 45 +++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/Builder4/WindowState.vala b/src/Builder4/WindowState.vala index 2f7f753f0..1b17e5f7b 100644 --- a/src/Builder4/WindowState.vala +++ b/src/Builder4/WindowState.vala @@ -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 -- 2.39.2