From 538ac3b6d40707b9e5565f849e96e5fcabb1bd91 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 27 May 2015 16:10:15 +0800 Subject: [PATCH] src/Builder4/Editor.bjs src/Builder4/Editor.vala --- src/Builder4/Editor.bjs | 2 +- src/Builder4/Editor.vala | 35 ++++++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index beb00e912..d82498b2f 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -19,7 +19,7 @@ "# string key" : "\"\"", "* pack" : "add", "xtype" : "Box", - "| void show" : "(JsRender.JsRender file, JsRender.Node node, string ptype, string key)\n{\n this.ptype = ptype;\n this.key = key;\n this.node = node;\n this.file = file;\n \n string val = \"\";\n // find the text for the node..\n if (ptype == \"listener\") {\n val = node.listeners.get(key);\n \n } else {\n val = node.props.get(key);\n }\n this.view.load(val);\n this.key_edit.el.text = key; \n\n}", + "| void show" : "(JsRender.JsRender file, JsRender.Node node, string ptype, string key)\n{\n this.file = file; \n this.ptype = \"\";\n this.key = \"\";\n this.node = null;\n\n \n if (file.xtype != \"PlainFile\") {\n \n this.ptype = ptype;\n this.key = key;\n this.node = node;\n string val = \"\";\n // find the text for the node..\n if (ptype == \"listener\") {\n val = node.listeners.get(key);\n \n } else {\n val = node.props.get(key);\n }\n this.view.load(val);\n this.key_edit.el.text = key; \n \n } else {\n this.view.load( file.toSource() );\n }\n\n \n \n\n}", "# JsRender.JsRender file" : "null", "# bool pos" : false, "string id" : "Editor", diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index 1752c0ce1..8ddf9097d 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -126,21 +126,34 @@ public class Editor : Object } public void show (JsRender.JsRender file, JsRender.Node node, string ptype, string key) { - this.ptype = ptype; - this.key = key; - this.node = node; - this.file = file; + this.file = file; + this.ptype = ""; + this.key = ""; + this.node = null; + - string val = ""; - // find the text for the node.. - if (ptype == "listener") { - val = node.listeners.get(key); + if (file.xtype != "PlainFile") { + + this.ptype = ptype; + this.key = key; + this.node = node; + string val = ""; + // find the text for the node.. + if (ptype == "listener") { + val = node.listeners.get(key); + + } else { + val = node.props.get(key); + } + this.view.load(val); + this.key_edit.el.text = key; } else { - val = node.props.get(key); + this.view.load( file.toSource() ); } - this.view.load(val); - this.key_edit.el.text = key; + + + } public class Xcls_Box2 : Object -- 2.39.2