src/Builder4/Editor.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 27 May 2015 08:10:34 +0000 (16:10 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 27 May 2015 08:10:34 +0000 (16:10 +0800)
src/Builder4/Editor.vala

src/Builder4/Editor.bjs
src/Builder4/Editor.vala

index d82498b..8ee53d5 100644 (file)
    "# int pos_root_y" : "",
    "# string ptype" : "\"\"",
    "# string fname" : "\"\"",
-   "| void showPlainFile" : "(string fname)\n{\n    this.ptype = \"\";\n    this.key  = \"\";\n    this.node = null;\n    this.file = null;\n    this.fname = fname;\n    string str;\n    try {\n        GLib.FileUtils.get_contents(fname, out str);\n    } catch (Error e) {\n        str = \"\"; // a tad dangerios... - perhaps we should block editing...\n    }\n    \n    this.view.load(str);\n    this.key_edit.el.text = \"\";    \n\n}",
    "# string key" : "\"\"",
    "* pack" : "add",
    "xtype" : "Box",
-   "|   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}",
+   "|   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\n    \n    } else {\n        this.view.load(        file.toSource() );\n\n    }\n    this.key_edit.el.text = key;  \n    \n    \n\n}",
    "# JsRender.JsRender file" : "null",
    "# bool pos" : false,
    "string id" : "Editor",
index 8ddf909..63980fc 100644 (file)
@@ -105,24 +105,6 @@ public class Editor : Object
         
         return true;
     
-    }
-    public void showPlainFile (string fname)
-    {
-        this.ptype = "";
-        this.key  = "";
-        this.node = null;
-        this.file = null;
-        this.fname = fname;
-        string str;
-        try {
-            GLib.FileUtils.get_contents(fname, out str);
-        } catch (Error e) {
-            str = ""; // a tad dangerios... - perhaps we should block editing...
-        }
-        
-        this.view.load(str);
-        this.key_edit.el.text = "";    
-    
     }
     public   void show (JsRender.JsRender file, JsRender.Node node, string ptype, string key)
     {
@@ -146,12 +128,13 @@ public class Editor : Object
                 val = node.props.get(key);
             }
             this.view.load(val);
-            this.key_edit.el.text = key;  
+    
         
         } else {
             this.view.load(        file.toSource() );
-        }
     
+        }
+        this.key_edit.el.text = key;