move palete to a property of project - as vapis may differ
authorAlan Knowles <alan@roojs.com>
Wed, 24 Aug 2016 04:33:21 +0000 (12:33 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 24 Aug 2016 04:33:21 +0000 (12:33 +0800)
26 files changed:
src/Builder4/Editor.bjs
src/Builder4/Editor.vala
src/Builder4/GtkView.bjs
src/Builder4/GtkView.vala
src/Builder4/ValaProjectSettingsPopover.bjs
src/Builder4/ValaProjectSettingsPopover.vala
src/Builder4/WindowLeftProps.bjs
src/Builder4/WindowLeftProps.vala
src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala
src/Builder4/WindowState.vala
src/Builder4/config1.builder
src/JsRender/JsRender.vala
src/JsRender/NodeToGlade.vala
src/JsRender/NodeToGtk.vala
src/Makefile.am
src/Palete/Gir.vala
src/Palete/GirObject.vala
src/Palete/Gtk.vala
src/Palete/Palete.vala
src/Palete/Roo.vala
src/Project/Gtk.vala
src/Project/Project.vala
src/Project/Roo.vala
src/Resources.vala
src/roobuilder

index 547bff8..3512de8 100644 (file)
@@ -2,15 +2,15 @@
  "name" : "Editor",
  "parent" : "",
  "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/Editor.bjs",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/Editor.bjs",
  "permname" : "",
  "modOrder" : "",
  "build_module" : "builder",
  "items" : [
   {
    "# Xcls_MainWindow window" : "null",
-   "|   bool saveContents" : "  ()  {\n    \n    \n    if (_this.file == null) {\n        return true;\n    }\n    \n    \n   \n   \n     \n     var str = _this.buffer.toString();\n     \n     _this.buffer.checkSyntax();\n     \n     \n     \n     // LeftPanel.model.changed(  str , false);\n     _this.dirty = false;\n     _this.save_button.el.sensitive = false;\n     \n    // find the text for the node..\n    if (_this.file.xtype != \"PlainFile\") {\n        if (ptype == \"listener\") {\n            this.node.listeners.set(key,str);\n        \n        } else {\n             this.node.props.set(key,str);\n        }\n    } else {\n        _this.file.setSource(  str );\n     }\n    \n    // call the signal..\n    this.save();\n    \n    return true;\n\n} ",
    "# string activeEditor" : "\"\"",
+   "|   bool saveContents" : "  ()  {\n    \n    \n    if (_this.file == null) {\n        return true;\n    }\n    \n    \n   \n   \n     \n     var str = _this.buffer.toString();\n     \n     _this.buffer.checkSyntax();\n     \n     \n     \n     // LeftPanel.model.changed(  str , false);\n     _this.dirty = false;\n     _this.save_button.el.sensitive = false;\n     \n    // find the text for the node..\n    if (_this.file.xtype != \"PlainFile\") {\n        if (ptype == \"listener\") {\n            this.node.listeners.set(key,str);\n        \n        } else {\n             this.node.props.set(key,str);\n        }\n    } else {\n        _this.file.setSource(  str );\n     }\n    \n    // call the signal..\n    this.save();\n    \n    return true;\n\n} ",
    "| void scroll_to_line" : "(int line) {\n\n\tGLib.Timeout.add(500, () => {\n   \n\t\tvar buf = this.view.el.get_buffer();\n\n\t\tvar sbuf = (Gtk.SourceBuffer) buf;\n\n\n\t\tGtk.TextIter iter;   \n\t\tsbuf.get_iter_at_line(out iter,  line);\n\t\tthis.view.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);\n\t\treturn false;\n\t});   \n}\n",
    "# int pos_root_x" : "",
    "# int pos_root_y" : "",
@@ -53,8 +53,8 @@
       },
       {
        "id" : "key_edit",
-       "* pack" : "pack_end,true,true",
        "xtype" : "Entry",
+       "* pack" : "pack_end,true,true",
        "$ xns" : "Gtk"
       }
      ]
           "changed" : " () => {\n    // check syntax??\n    // ??needed..??\n    _this.save_button.el.sensitive = true;\n    print(\"EDITOR CHANGED\");\n    this.checkSyntax();\n   \n    _this.dirty = true;\n\n    // this.get('/LeftPanel.model').changed(  str , false);\n    return ;\n}\n\n \n"
          },
          "bool check_queued" : false,
-         "int error_line" : "-1",
          "id" : "buffer",
+         "int error_line" : "-1",
          "| bool highlightErrors" : "( Gee.HashMap<int,string> validate_res) {\n         \n        this.error_line = validate_res.size;\n\n        if (this.error_line < 1) {\n              return true;\n        }\n        var tlines = this.el.get_line_count ();\n        Gtk.TextIter iter;\n        var valiter = validate_res.map_iterator();\n        while (valiter.next()) {\n        \n    //        print(\"get inter\\n\");\n            var eline = valiter.get_key();\n            if (eline > tlines) {\n                continue;\n            }\n            this.el.get_iter_at_line( out iter, eline);\n            //print(\"mark line\\n\");\n            this.el.create_source_mark(valiter.get_value(), \"ERR\", iter);\n        }   \n        return false;\n    }",
          "|   string toString" : "  () {\n    \n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    this.el.get_start_iter(out s);\n    this.el.get_end_iter(out e);\n    var ret = this.el.get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n ",
-         "|   bool checkSyntax" : " () {\n \n    if (this.check_running) {\n        print(\"Check is running\\n\");\n        if (this.check_queued) { \n            print(\"Check is already queued\");\n            return true;\n        }\n        this.check_queued = true;\n        print(\"Adding queued Check \");\n        GLib.Timeout.add_seconds(1, () => {\n            this.check_queued = false;\n            \n            this.checkSyntax();\n            return false;\n        });\n    \n\n        return true;\n    }\n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return true;\n    }\n    \n    if (_this.file.xtype == \"PlainFile\") {\n    \n        // assume it's gtk...\n           this.check_running = true;\n \n         if (!_this.window.windowstate.valasource.checkPlainFileSpawn(\n\t   _this.file,\n\t    str\n\t )) {\n            this.check_running = false;\n        }\n\t\n        return true;\n    \n    }\n   if (_this.file == null) {\n       return true;\n   }\n    var p = Palete.factory(_this.file.xtype);   \n    \n\n     \n    this.check_running = true;\n    \n    \n    if (_this.file.language == \"js\") {\n        this.check_running = false;\n        print(\"calling validate javascript\\n\"); \n        Gee.HashMap<int,string> errors;\n        p.javascriptHasErrors(\n    \t\t_this.window.windowstate,\n            str, \n             _this.key, \n            _this.ptype,\n            _this.file,\n \n            out errors\n        );\n        return this.highlightErrors(errors);    \n        \n    }\n        \n        \n    print(\"calling validate vala\\n\");    \n    // clear the buttons.\n \n    \n   if (! _this.window.windowstate.valasource.checkFileWithNodePropChange(\n        _this.file,\n        _this.node,\n         _this.key,        \n         _this.ptype,\n            str\n        )) {\n        this.check_running = false;\n    } \n     \n    \n    \n    //print(\"done mark line\\n\");\n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
+         "|   bool checkSyntax" : " () {\n \n    if (this.check_running) {\n        print(\"Check is running\\n\");\n        if (this.check_queued) { \n            print(\"Check is already queued\");\n            return true;\n        }\n        this.check_queued = true;\n        print(\"Adding queued Check \");\n        GLib.Timeout.add_seconds(1, () => {\n            this.check_queued = false;\n            \n            this.checkSyntax();\n            return false;\n        });\n    \n\n        return true;\n    }\n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return true;\n    }\n    \n    if (_this.file.xtype == \"PlainFile\") {\n    \n        // assume it's gtk...\n           this.check_running = true;\n \n         if (!_this.window.windowstate.valasource.checkPlainFileSpawn(\n\t   _this.file,\n\t    str\n\t )) {\n            this.check_running = false;\n        }\n\t\n        return true;\n    \n    }\n   if (_this.file == null) {\n       return true;\n   }\n    var p = _this.file.project.palete;\n    \n\n     \n    this.check_running = true;\n    \n    \n    if (_this.file.language == \"js\") {\n        this.check_running = false;\n        print(\"calling validate javascript\\n\"); \n        Gee.HashMap<int,string> errors;\n        p.javascriptHasErrors(\n    \t\t_this.window.windowstate,\n            str, \n             _this.key, \n            _this.ptype,\n            _this.file,\n \n            out errors\n        );\n        return this.highlightErrors(errors);    \n        \n    }\n        \n        \n    print(\"calling validate vala\\n\");    \n    // clear the buttons.\n \n    \n   if (! _this.window.windowstate.valasource.checkFileWithNodePropChange(\n        _this.file,\n        _this.node,\n         _this.key,        \n         _this.ptype,\n            str\n        )) {\n        this.check_running = false;\n    } \n     \n    \n    \n    //print(\"done mark line\\n\");\n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
          "* pack" : "set_buffer",
          "xtype" : "SourceBuffer",
          "bool check_running" : false,
index 3b4d09b..028e7a2 100644 (file)
@@ -564,7 +564,7 @@ public class Editor : Object
            if (_this.file == null) {
                return true;
            }
-            var p = Palete.factory(_this.file.xtype);   
+            var p = _this.file.project.palete;
             
         
              
index 88f215d..5436a60 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "GtkView",
  "parent" : "",
  "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/GtkView.bjs",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/GtkView.bjs",
  "permname" : "",
  "modOrder" : "",
  "build_module" : "builder",
@@ -15,7 +15,7 @@
    "id" : "GtkView",
    "# Gtk.Widget lastObj" : "null",
    "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    // only screenshot the gtk preview..\n    if (this.notebook.el.page > 0 ) {\n        return;\n    }\n    \n    \n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n    try {\n         Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n         screenshot.save(filename,\"png\");\n    } catch (Error e) {\n        \n    }\n\n   \n    return;\n    \n    \n     \n     \n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
-   "| void loadFile" : "(JsRender.JsRender file) \n{\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.notebook.el.page = 0;// gtk preview \n   \n  \n        \n       this.file = file;     \n        this.sourceview.loadFile();\n        this.searchcontext = null;\n        \n\n        if (this.lastObj != null) {\n            this.container.el.remove(this.lastObj);\n        }\n        \n        // hide the compile view at present..\n          \n        \n        var w = this.width;\n        var h = this.height;\n        \n        print(\"ALLOC SET SIZES %d, %d\\n\", w,h); \n        \n        // set the container size min to 500/500 or 20 px less than max..\n        w = int.max (w-20, 500);\n        h = int.max (h-20, 500); \n        \n        print(\"SET SIZES %d, %d\\n\", w,h);       \n        _this.container.el.set_size_request(w,h);\n        \n        _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.\n        var rgba = Gdk.RGBA ();\n        rgba.parse (\"#ccc\");\n        _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);\n        \n        \n\tvar x = new JsRender.NodeToGtk(file.tree);\n        var obj = x.munge() as Gtk.Widget;\n        this.lastObj = null;\n\tif (obj == null) {\n        \treturn;\n\t}\n\tthis.lastObj = obj;\n        \n        this.container.el.add(obj);\n        obj.show_all();\n        \n         \n        \n}\n ",
+   "| void loadFile" : "(JsRender.JsRender file) \n{\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.notebook.el.page = 0;// gtk preview \n   \n  \n        \n       this.file = file;     \n        this.sourceview.loadFile();\n        this.searchcontext = null;\n        \n\n        if (this.lastObj != null) {\n            this.container.el.remove(this.lastObj);\n        }\n        \n        // hide the compile view at present..\n          \n        \n        var w = this.width;\n        var h = this.height;\n        \n        print(\"ALLOC SET SIZES %d, %d\\n\", w,h); \n        \n        // set the container size min to 500/500 or 20 px less than max..\n        w = int.max (w-20, 500);\n        h = int.max (h-20, 500); \n        \n        print(\"SET SIZES %d, %d\\n\", w,h);       \n        _this.container.el.set_size_request(w,h);\n        \n        _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.\n        var rgba = Gdk.RGBA ();\n        rgba.parse (\"#ccc\");\n        _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);\n        \n        \n\tvar x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);\n        var obj = x.munge() as Gtk.Widget;\n        this.lastObj = null;\n\tif (obj == null) {\n        \treturn;\n\t}\n\tthis.lastObj = obj;\n        \n        this.container.el.add(obj);\n        obj.show_all();\n        \n         \n        \n}\n ",
    "int width" : 0,
    "bool hexpand" : true,
    "| int search" : "(string txt) {\n\tthis.notebook.el.page = 1;\n \tvar s = new Gtk.SourceSearchSettings();\n\tvar buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();\n\tthis.searchcontext = new Gtk.SourceSearchContext(buf,s);\n\tthis.searchcontext.set_highlight(true);\n\ts.set_search_text(txt);\n\t\n\tGtk.TextIter beg, st,en;\n\t \n\tbuf.get_start_iter(out beg);\n\tthis.searchcontext.forward(beg, out st, out en);\n\tthis.last_search_end  = 0;\n\treturn this.searchcontext.get_occurrences_count();\n\n   \n}\n",
    "items" : [
     {
      "id" : "notebook",
-     "* pack" : "pack_start,true,true,0",
      "xtype" : "Notebook",
+     "* pack" : "pack_start,true,true,0",
      "$ xns" : "Gtk",
      "items" : [
       {
        "id" : "label_preview",
-       "* pack" : false,
        "xtype" : "Label",
+       "* pack" : false,
        "$ xns" : "Gtk",
        "utf8 label" : "Preview"
       },
       {
        "id" : "label_code",
-       "xtype" : "Label",
        "* pack" : false,
+       "xtype" : "Label",
        "$ xns" : "Gtk",
        "utf8 label" : "Preview Generated Code"
       },
        "items" : [
         {
          "id" : "view_layout",
-         "xtype" : "Layout",
          "* pack" : "add",
+         "xtype" : "Layout",
          "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "container",
-           "* pack" : "put,10,10",
            "xtype" : "Box",
+           "* pack" : "put,10,10",
            "$ xns" : "Gtk",
            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL"
           }
index 9851abb..0e7960a 100644 (file)
@@ -160,7 +160,7 @@ public class Xcls_GtkView : Object
             _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);
             
             
-       var x = new JsRender.NodeToGtk(file.tree);
+       var x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);
             var obj = x.munge() as Gtk.Widget;
             this.lastObj = null;
        if (obj == null) {
index 64f4050..4fb2918 100644 (file)
@@ -12,8 +12,8 @@
     "hide" : "() => {\n\t_this.project.writeConfig();\n\n}"
    },
    "id" : "ValaProjectSettingsPopover",
-   "Xcls_MainWindow window" : "null",
    "| void show" : "(Gtk.Widget btn, Project.Gtk project) {\n     \n    //print(\"ValaProjectSettings show\\n\");\n    \n    this.project=  project;\n\n    this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;\n    \n    this.default_directory_tree_store.load();    \n    this.default_packages_tree_store.load();            \n    this.targets_tree_store.load();\n    this.files_tree_store.load();\n\n\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n\n\tthis.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t// print(\"SHOWALL - POPIP\\n\");\n\tthis.el.set_size_request(800,500);\n\tthis.el.show_all();\n\t//this.view.el.grab_focus();\n\n}\n",
+   "Xcls_MainWindow window" : "null",
    "Project.Gtk project" : "null",
    "xtype" : "Popover",
    "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
@@ -24,8 +24,8 @@
    "items" : [
     {
      "bool hexpand" : true,
-     "* pack" : "add",
      "xtype" : "Box",
+     "* pack" : "add",
      "$ xns" : "Gtk",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
      "items" : [
        "items" : [
         {
          "id" : "label_global",
-         "xtype" : "Label",
          "* pack" : false,
+         "xtype" : "Label",
          "$ xns" : "Gtk",
          "utf8 label" : "Global"
         },
         {
          "id" : "label_targets",
-         "* pack" : false,
          "xtype" : "Label",
+         "* pack" : false,
          "$ xns" : "Gtk",
          "utf8 label" : "Targets"
         },
@@ -66,8 +66,8 @@
             "changed" : "() => {\n    \n   _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;\n   _this.project.writeConfig();\n//    _this.project.save();\n\n}"
            },
            "id" : "compile_flags",
-           "xtype" : "Entry",
            "* pack" : "pack_start,false,false,0",
+           "xtype" : "Entry",
            "$ xns" : "Gtk",
            "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR "
           },
            "items" : [
             {
              "bool hexpand" : true,
-             "xtype" : "ScrolledWindow",
              "* pack" : "add",
+             "xtype" : "ScrolledWindow",
              "$ xns" : "Gtk",
              "items" : [
               {
                "gboolean headers_visible" : true,
-               "* pack" : "add",
                "xtype" : "TreeView",
+               "* pack" : "add",
                "string id" : "default_packages_tree",
                "$ xns" : "Gtk",
                "items" : [
                 {
                  "id" : "default_packages_tree_store",
-                 "* pack" : "set_model",
                  "xtype" : "ListStore",
+                 "* pack" : "set_model",
                  "$ n_columns" : 2,
-                 "| void load" : "() {\n \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    \n    this.el.clear();\n    var pal = (Palete.Gtk) Palete.factory(\"Gtk\");\n    var pkgs = pal.packages(_this.project);\n    print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < pkgs.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   pkgs.get(i) ); // title \n        this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
+                 "| void load" : "() {\n \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    \n    this.el.clear();\n    var pal = (Palete.Gtk) _this.project.palete;\n    var pkgs = pal.packages(_this.project);\n    print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < pkgs.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   pkgs.get(i) ); // title \n        this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
                  "$ columns" : "    typeof(string),  // 0 key type\n      typeof(bool)",
                  "$ xns" : "Gtk"
                 },
                  "items" : [
                   {
                    "id" : "packages_render",
-                   "* pack" : "pack_start,false",
                    "xtype" : "CellRendererText",
+                   "* pack" : "pack_start,false",
                    "$ xns" : "Gtk"
                   }
                  ]
                     "toggled" : "(  path_string) =>  { \n    var m = _this.default_packages_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 1, out val);\n   m.set_value(iter, 1,  ((bool) val) ? false :true); \n     GLib.Value fval;  \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    if ((bool)val) {\n        // renive\n        items.remove(fn);\n    } else {\n        items.add(fn);\n    }\n    \n}"
                    },
                    "id" : "packages_render_use",
-                   "xtype" : "CellRendererToggle",
                    "* pack" : "pack_start,false",
+                   "xtype" : "CellRendererToggle",
                    "$ xns" : "Gtk",
                    "gboolean activatable" : true
                   }
             },
             {
              "bool hexpand" : true,
-             "xtype" : "ScrolledWindow",
              "* pack" : "add2",
+             "xtype" : "ScrolledWindow",
              "$ xns" : "Gtk",
              "items" : [
               {
                "items" : [
                 {
                  "id" : "default_directory_tree_store",
-                 "* pack" : "set_model",
                  "xtype" : "ListStore",
+                 "* pack" : "set_model",
                  "$ n_columns" : 1,
                  "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
                  "$ columns" : "    typeof(string)\n     ",
                  "items" : [
                   {
                    "id" : "directory_render",
-                   "* pack" : "pack_start,false",
                    "xtype" : "CellRendererText",
+                   "* pack" : "pack_start,false",
                    "$ xns" : "Gtk"
                   }
                  ]
         },
         {
          "gint position" : 300,
-         "xtype" : "Paned",
          "* pack" : "append_page,_this.label_targets.el",
+         "xtype" : "Paned",
          "$ xns" : "Gtk",
          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
          "items" : [
           {
            "* init" : "{  \nthis.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n\n}\n",
-           "xtype" : "ScrolledWindow",
            "* pack" : "add1",
+           "xtype" : "ScrolledWindow",
            "$ xns" : "Gtk",
            "items" : [
             {
              "id" : "targets_tree_menu",
-             "* pack" : "add",
              "xtype" : "Menu",
+             "* pack" : "add",
              "$ xns" : "Gtk",
              "items" : [
               {
              "items" : [
               {
                "id" : "targets_tree_store",
-               "xtype" : "ListStore",
                "* pack" : "set_model",
+               "xtype" : "ListStore",
                "$ n_columns" : 2,
                "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var cg = _this.project.compilegroups;\n     \n   _this.targets_tree.cursor = \"\";\n    Gtk.TreeIter citer;\n    var iter = cg.map_iterator();\n   while(iter.next()) {\n        var key = iter.get_key();\n        if (key == \"_default_\") {\n            continue;\n        }\n    \n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   key ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    };\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    _this.set_vbox.el.hide();\n}\n",
                "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
                   "edited" : "  (path, newtext) => {\n     \n     Gtk.TreeIter  iter;\n        _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n       GLib.Value gval;\n        _this.targets_tree_store.el.get_value(iter,0, out gval);\n        var oldval = (string)gval;\n       if (oldval == newtext) {\n          return;\n        }\n         var cg = _this.project.compilegroups.get(oldval);\n        cg.name = newtext;\n        _this.project.compilegroups.unset(oldval);\n        _this.project.compilegroups.set(newtext, cg);\n       _this.targets_tree_store.load();\n  }"
                  },
                  "id" : "targets_render",
-                 "xtype" : "CellRendererText",
                  "* pack" : "pack_start,false",
+                 "xtype" : "CellRendererText",
                  "$ xns" : "Gtk",
                  "gboolean editable" : true
                 }
           },
           {
            "id" : "set_vbox",
-           "xtype" : "Box",
            "* pack" : "add2",
+           "xtype" : "Box",
            "gboolean homogeneous" : false,
            "$ xns" : "Gtk",
            "# Project.GtkValaSettings cgroup" : "null",
               "changed" : "()  => {\n        if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;\n}"
              },
              "id" : "build_pack_target",
-             "xtype" : "Entry",
              "* pack" : "pack_start,false,false,0",
+             "xtype" : "Entry",
              "$ xns" : "Gtk"
             },
             {
               "changed" : "() => {\n    if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;\n}"
              },
              "id" : "build_compile_flags",
-             "xtype" : "Entry",
              "* pack" : "pack_start,false,false,0",
+             "xtype" : "Entry",
              "$ xns" : "Gtk"
             },
             {
                "items" : [
                 {
                  "id" : "files_tree_store",
-                 "xtype" : "ListStore",
                  "* pack" : "set_model",
+                 "xtype" : "ListStore",
                  "| void updateDir" : "(string dname, bool bval) {\n  \n  Gtk.TreeIter citer;\n\n    var cg =   _this.set_vbox.cgroup;\n  for(var i =0 ; i < this.el.iter_n_children(null); i++) {\n        this.el.iter_nth_child(out citer,null,i);\n\n        GLib.Value val;\n        this.el.get_value(citer,0, out val);\n        var fn = (string) val;\n        \n        if ( Path.get_dirname (fn) == dname) {\n        \n            this.el.set_value(citer, 3,   bval ); // checked \n           \n     \n     \n            if (!bval) {\n                // renive\n                if (cg.sources.contains(fn)) {\n                    cg.sources.remove(fn);\n                }\n            } else {\n                if (!cg.sources.contains(fn)) {\n                    cg.sources.add(fn);\n                }\n            }\n            \n            \n        }\n    }\n\n}\n",
                  "$ n_columns" : 4,
                  "| void load" : "() {\n \n      this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n     \n     \n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n    \n         var files = _this.project.filesForCompile(items.get(i), false);\n         if (files.size < 1) {\n            continue;\n         }\n    \n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        this.el.set_value(citer, 1,   \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + \n                    GLib.Markup.escape_text(items.get(i)) + \"</span>\"\n            ); // title \n        print(\"ADD item %s\", items.get(i));\n        this.el.set_value(citer, 2,   \"dir\"); // type         \n        this.el.set_value(citer, 3,   false ); // checked \n\n       \n        \n         for(var j =0 ; j < files.size; j++) {\n            this.el.append(out citer);   \n             print(\"ADD item %s\", files.get(j));\n            this.el.set_value(citer, 0,   files.get(j) ); // title \n            this.el.set_value(citer, 1,   GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title             \n            this.el.set_value(citer, 2,   \"file\"); // type         \n            this.el.set_value(citer, 3,   false ); // checked \n\n        }\n        \n        \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n ",
                  "items" : [
                   {
                    "id" : "files_render",
-                   "* pack" : "pack_start,false",
                    "xtype" : "CellRendererText",
+                   "* pack" : "pack_start,false",
                    "$ xns" : "Gtk"
                   }
                  ]
                     "toggled" : "(  path_string) =>  { \n\n\n\n    var m = _this.files_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 3, out val);\n   m.set_value(iter, 3,  ((bool) val) ? false :true); \n   \n   // type.\n   GLib.Value ftval;  \n   m.get_value(iter, 2, out ftval);\n   var ftype = (string)ftval;   \n   \n   // full name...  \n   GLib.Value fval;     \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    \n    var cg =   _this.set_vbox.cgroup;\n    // what's the sleected target?\n    // update the list..\n    // if ftype is a dir == then toggle all the bellow.\n    \n    if (ftype == \"dir\") {\n        _this.files_tree_store.updateDir(fn,  ((bool) val) ? false :true);\n    }\n    \n    // if ftype is a file .. see if all the files in that directory are check and check the dir.\n\n     \n    if ((bool)val) {\n        // renive\n        cg.sources.remove(fn);\n    } else {\n        cg.sources.add(fn);\n    }\n    \n}"
                    },
                    "id" : "files_render_use",
-                   "xtype" : "CellRendererToggle",
                    "* pack" : "pack_start,false",
+                   "xtype" : "CellRendererToggle",
                    "$ xns" : "Gtk",
                    "gboolean activatable" : true
                   }
index 6ed9192..46f029c 100644 (file)
@@ -393,7 +393,7 @@ public class Xcls_ValaProjectSettingsPopover : Object
             var items  = def.packages;
             
             this.el.clear();
-            var pal = (Palete.Gtk) Palete.factory("Gtk");
+            var pal = (Palete.Gtk) _this.project.palete;
             var pkgs = pal.packages(_this.project);
             print("ValaProjectSettings:packages load %d\n", pkgs.size);
         
index cbe08fc..3e2ea7a 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "WindowLeftProps",
  "parent" : "",
  "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/WindowLeftProps.bjs",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowLeftProps.bjs",
  "permname" : "",
  "modOrder" : "",
  "build_module" : "builder",
@@ -14,7 +14,7 @@
    "|              void before_edit" : "()\n{\n\n    print(\"before edit - stop editing\\n\");\n    \n  // these do not appear to trigger save...\n    _this.keyrender.el.stop_editing(false);\n    _this.keyrender.el.editable  =false;\n\n    _this.valrender.el.stop_editing(false);\n    _this.valrender.el.editable  =false;    \n    \n    \n// technicall stop the popup editor..\n\n}\n",
    "|              string keySortFormat" : "(string key) {\n    // listeners first - with 0\n    // specials\n    if (key[0] == '*') {\n        return \"1 \" + key;\n    }\n    // functions\n    \n    var bits = key.split(\" \");\n    \n    if (key[0] == '|') {\n        return \"2 \" + bits[bits.length -1];\n    }\n    // signals\n    if (key[0] == '@') {\n        return \"3 \" + bits[bits.length -1];\n    }\n        \n    // props\n    if (key[0] == '#') {\n        return \"4 \" + bits[bits.length -1];\n    }\n    // the rest..\n    return \"5 \" + bits[bits.length -1];    \n\n\n\n}",
    "|              void finish_editing" : "() {\n     // \n    this.before_edit();\n}",
-   "|              bool startEditingValue" : "( Gtk.TreePath path) {\n\n     // ONLY return true if editing is allowed - eg. combo..\n\n    print(\"start editing?\\n\");\n    if (!this.stop_editor()) {\n        print(\"stop editor failed\\n\");\n        return false;\n    }\n    \n    Gtk.TreeIter iter;\n\n    var mod = this.model.el;\n    mod.get_iter (out iter, path);\n     \n    /*\n        m.set(iter, \n                0, \"listener\",\n                1, miter.get_key(),\n                2, \"<b>\" + miter.get_key() + \"</b>\",\n                3, miter.get_value()\n            ); \n     \n    */\n    GLib.Value gval;\n    mod.get_value(iter, 3 , out gval);\n    var val = (string)gval;\n\n    mod.get_value(iter, 1 , out gval);\n    var key = (string)gval;\n    \n    \n    string kname, kflag, ktype;\n    this.node.normalize_key(key, out kname, out kflag, out ktype);\n     \n    \n    mod.get_value(iter, 0 , out gval);\n    var type = (string)gval; // listerner or prop..\n    \n   \n    \n    var use_textarea = false;\n\n    //------------ things that require the text editor...\n    \n    if (type == \"listener\") {\n        use_textarea = true;\n    }\n    if (key.length > 0 && key[0] == '|') { // user defined method\n        use_textarea = true;\n    }\n    if (key.length > 0 && key[0] == '$') { // raw string\n        use_textarea = true;\n    }\n    if (key.length > 0 && key == \"* init\") {\n        use_textarea = true;\n    }\n    if (val.length > 40) { // long value...\n        use_textarea = true;\n    }\n    \n    \n    \n    if (use_textarea) {\n        print(\"Call show editor\\n\");\n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.view.el.get_selection().select_path(path);\n            \n            this.show_editor(file, node, type, key);\n            \n            return false;\n        });\n       \n        \n        return false;\n    }\n    \n     var pal = Palete.factory(this.file.project.xtype);\n    \n    string[] opts;\n    var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);\n    \n    \n    \n    // others... - fill in options for true/false?\n    print(\"turn on editing %s \\n\" , mod.get_path(iter).to_string());\n   \n       print (ktype.up());\n    if (has_opts) {\n            print(\"start editing try/false)???\");\n            this.valrender.el.has_entry = false;\n          \n            this.valrender.setOptions(opts);\n            \n            this.valrender.el.has_entry = false;\n            this.valrender.el.editable = true;\n             this.allow_edit  = true;\n             GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {\n                 this.view.el.set_cursor_on_cell(\n                    path,\n                    this.valcol.el,\n                    this.valrender.el,\n                    true\n                );\n                return false;\n            });\n            return true;\n    }\n                              \n       // see if type is a Enum.\n       \n       \n   \n        \n   \n     opts =  {  };\n    this.valrender.setOptions(opts);\n   \n   GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n        \n        // at this point - work out the type...\n        // if its' a combo... then show the options..\n        this.valrender.el.has_entry = true;\n        \n        this.valrender.el.editable = true;            \n    \n        \n        this.allow_edit  = true;\n        \n        \n        \n        \n\n        this.view.el.set_cursor_on_cell(\n            path,\n            this.valcol.el,\n            this.valrender.el,\n            true\n        );\n        return false;\n    });\n    return false;\n}\n",
+   "| bool startEditingValue" : "( Gtk.TreePath path) {\n\n     // ONLY return true if editing is allowed - eg. combo..\n\n    print(\"start editing?\\n\");\n    if (!this.stop_editor()) {\n        print(\"stop editor failed\\n\");\n        return false;\n    }\n    \n    Gtk.TreeIter iter;\n\n    var mod = this.model.el;\n    mod.get_iter (out iter, path);\n     \n    /*\n        m.set(iter, \n                0, \"listener\",\n                1, miter.get_key(),\n                2, \"<b>\" + miter.get_key() + \"</b>\",\n                3, miter.get_value()\n            ); \n     \n    */\n    GLib.Value gval;\n    mod.get_value(iter, 3 , out gval);\n    var val = (string)gval;\n\n    mod.get_value(iter, 1 , out gval);\n    var key = (string)gval;\n    \n    \n    string kname, kflag, ktype;\n    this.node.normalize_key(key, out kname, out kflag, out ktype);\n     \n    \n    mod.get_value(iter, 0 , out gval);\n    var type = (string)gval; // listerner or prop..\n    \n   \n    \n    var use_textarea = false;\n\n    //------------ things that require the text editor...\n    \n    if (type == \"listener\") {\n        use_textarea = true;\n    }\n    if (key.length > 0 && key[0] == '|') { // user defined method\n        use_textarea = true;\n    }\n    if (key.length > 0 && key[0] == '$') { // raw string\n        use_textarea = true;\n    }\n    if (key.length > 0 && key == \"* init\") {\n        use_textarea = true;\n    }\n    if (val.length > 40) { // long value...\n        use_textarea = true;\n    }\n    \n    \n    \n    if (use_textarea) {\n        print(\"Call show editor\\n\");\n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.view.el.get_selection().select_path(path);\n            \n            this.show_editor(file, node, type, key);\n            \n            return false;\n        });\n       \n        \n        return false;\n    }\n    \n     var pal = this.file.project.palete;\n    \n    string[] opts;\n    var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);\n    \n    \n    \n    // others... - fill in options for true/false?\n    print(\"turn on editing %s \\n\" , mod.get_path(iter).to_string());\n   \n       print (ktype.up());\n    if (has_opts) {\n            print(\"start editing try/false)???\");\n            this.valrender.el.has_entry = false;\n          \n            this.valrender.setOptions(opts);\n            \n            this.valrender.el.has_entry = false;\n            this.valrender.el.editable = true;\n             this.allow_edit  = true;\n             GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {\n                 this.view.el.set_cursor_on_cell(\n                    path,\n                    this.valcol.el,\n                    this.valrender.el,\n                    true\n                );\n                return false;\n            });\n            return true;\n    }\n                              \n       // see if type is a Enum.\n       \n       \n   \n        \n   \n     opts =  {  };\n    this.valrender.setOptions(opts);\n   \n   GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n        \n        // at this point - work out the type...\n        // if its' a combo... then show the options..\n        this.valrender.el.has_entry = true;\n        \n        this.valrender.el.editable = true;            \n    \n        \n        this.allow_edit  = true;\n        \n        \n        \n        \n\n        this.view.el.set_cursor_on_cell(\n            path,\n            this.valcol.el,\n            this.valrender.el,\n            true\n        );\n        return false;\n    });\n    return false;\n}\n",
    "|              void load" : "(JsRender.JsRender file, JsRender.Node? node) \n{\n    print(\"load leftprops\\n\");\n    this.before_edit();\n    this.node = node;\n    this.file = file;\n    \n \n    this.model.el.clear();\n              \n    //this.get('/RightEditor').el.hide();\n    if (node ==null) {\n        return ;\n    }\n     \n    \n\n    //var provider = this.get('/LeftTree').getPaleteProvider();\n    Gtk.TreeIter iter;\n    \n    //typeof(string),  // 0 key type\n     //typeof(string),  // 1 key\n     //typeof(string),  // 2 key (display)\n     //typeof(string),  // 3 value\n     //typeof(string),  // 4 value (display)\n     //typeof(string),  // 5 both (tooltip)\n    \n    \n    \n    \n    // really need a way to sort the hashmap...\n    var m = this.model.el;\n    \n    var miter = node.listeners.map_iterator();\n    var i = 0;\n    \n    while(miter.next()) {\n        i++;\n        m.append(out iter,null);\n        \n        this.updateIter(iter,  \"listener\", miter.get_key(), miter.get_value());\n        \n         \n     }\n     \n      \n    miter = node.props.map_iterator();\n    \n    \n   while(miter.next()) {\n           i++;\n        m.append(out iter,null);\n         this.updateIter(iter,  \"prop\", miter.get_key(), miter.get_value());\n         \n   }\n   print(\"clear selection\\n\");\n   // clear selection?\n   this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..\n   \n   this.view.el.get_selection().unselect_all();\n   \n   var pane = _this.main_window.editpane.el;\n    var try_size = (i * 25) + 60; // est. 20px per line + 40px header\n    \n    // max 80%...\n    pane.set_position( \n         ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? \n        (int) (pane.max_position * 0.2f) :\n        pane.max_position-try_size);\n    \n   \n}\n",
    "xtype" : "Box",
    "|              string keyFormat" : "(string val, string type) {\n    \n    // Glib.markup_escape_text(val);\n\n    if (type == \"listener\") {\n        return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + \n            GLib.Markup.escape_text(val) +\n             \"</span>\";\n    }\n    // property..\n    if (val.length < 1) {\n        return \"<span  color=\\\"#FF0000\\\">--empty--</span>\";\n    }\n    \n    //@ = signal\n    //$ = property with \n    //# - object properties\n    //* = special\n    // all of these... - display value is last element..\n    var ar = val.strip().split(\" \");\n    \n    \n    var dval = GLib.Markup.escape_text(ar[ar.length-1]);\n    \n    \n    \n    \n    switch(val[0]) {\n        case '@': // signal // just bold balck?\n            if (dval[0] == '@') {\n                dval = dval.substring(1);\n            }\n        \n            return @\"<span  font_weight=\\\"bold\\\">@ $dval</span>\";        \n        case '#': // object properties?\n            if (dval[0] == '#') {\n                dval = dval.substring(1);\n            }\n            return @\"<span  font_weight=\\\"bold\\\">$dval</span>\";\n        case '*': // special\n            if (dval[0] == '*') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\";            \n        case '$':\n            if (dval[0] == '$') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   style=\\\"italic\\\">$dval</span>\";\n       case '|': // user defined methods\n            if (dval[0] == '|') {\n                dval = dval.substring(1);\n            }\n            return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";\n            \n              \n            \n        default:\n            return dval;\n    }\n      \n    \n\n}",
@@ -44,8 +44,8 @@
         "button_press_event" : "  (self, ev) => {\n    _this.before_edit();\n    \n        \n    var p = _this.AddPropertyPopup;\n    p.el.set_screen(Gdk.Screen.get_default());\n    p.el.show_all();\n     p.el.popup(null, null, null, ev.button, ev.time);\n     return true;\n}"
        },
        "bool hexpand" : true,
-       "xtype" : "Button",
        "* pack" : "add",
+       "xtype" : "Button",
        "$ xns" : "Gtk",
        "items" : [
         {
          "items" : [
           {
            "$ Gtk.Stock stock" : "Gtk.Stock.ADD",
-           "* pack" : "add",
            "xtype" : "Image",
+           "* pack" : "add",
            "$ xns" : "Gtk",
            "$ icon_size" : "Gtk.IconSize.MENU"
           },
           {
            "label" : "Other",
-           "xtype" : "Label",
            "* pack" : "add",
+           "xtype" : "Label",
            "$ xns" : "Gtk"
           }
          ]
         },
         {
          "id" : "AddPropertyPopup",
-         "xtype" : "Menu",
          "* pack" : false,
+         "xtype" : "Menu",
          "$ xns" : "Gtk",
          "items" : [
           {
@@ -80,8 +80,8 @@
             "activate" : " ()  => {\n    _this.addProp( \"prop\", \"id\", \"\", \"\");\n}"
            },
            "label" : "id: _this.{ID} (Vala)",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "Using _this.{ID} will map to this element",
            "$ xns" : "Gtk"
           },
@@ -90,8 +90,8 @@
             "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\", \"pack\",\"add\", \"*\");\n}"
            },
            "label" : "pack: Pack method (Vala)",
-           "* pack" : "append",
            "xtype" : "MenuItem",
+           "* pack" : "append",
            "tooltip_markup" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\", \"ctor\",\"\", \"*\");\n}"
            },
            "label" : "ctor: Alterative to default contructor (Vala)",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "eg. \n\nnew Clutter.Image.from_file(.....)",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\",  \"init\", \"{\\n\\n}\\n\", \"*\" );\n}"
            },
            "label" : "init: initialziation code (vala)",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "This code is called after the ctor",
            "$ xns" : "Gtk"
           },
             "activate" : " ()  => {\n    _this.addProp( \"prop\", \"cms-id\", \"\", \"string\");\n}"
            },
            "label" : "cms-id: (Roo JS/Pman library)",
-           "* pack" : "append",
            "xtype" : "MenuItem",
+           "* pack" : "append",
            "tooltip_markup" : "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})\n",
            "$ xns" : "Gtk"
           },
             "activate" : "  (self) => {\n\n    _this.addProp( \"prop\", \"XXXX\", \"\",\"string\");\n\n}"
            },
            "label" : "String",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "Add a user defined string property",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"XXX\", \"0\", \"int\");\n}"
            },
            "label" : "Number",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "Add a user defined number property",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp( \"prop\", \"XXX\", \"true\", \"bool\");\n}"
            },
            "label" : "Boolean",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "Add a user defined boolean property",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"XXXX\", \"function() { }\", \"| function\");\n}"
            },
            "label" : "Javascript Function",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "Add a user function boolean property",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp( \"prop\", \"XXXX\", \"() {\\n\\n}\\n\", \"| return_type\");\n}"
            },
            "label" : "Vala Method",
-           "* pack" : "append",
            "xtype" : "MenuItem",
+           "* pack" : "append",
            "tooltip_markup" : "Add a user function boolean property",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp( \"prop\", \"XXXX\", \"()\", \"@ void\");\n}"
            },
            "label" : "Vala Signal",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "Add a vala signal",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"flexy:if\", \"value_or_condition\", \"string\");\n}"
            },
            "label" : "Flexy - If",
-           "xtype" : "MenuItem",
            "* pack" : "append",
+           "xtype" : "MenuItem",
            "tooltip_markup" : "Add a flexy if (for HTML templates)",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"flexy:include\", \"name_of_file.html\", \"string\");\n}"
            },
            "label" : "Flexy - Include",
-           "* pack" : "append",
            "xtype" : "MenuItem",
+           "* pack" : "append",
            "tooltip_markup" : "Add a flexy include (for HTML templates)",
            "$ xns" : "Gtk"
           },
             "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"flexy:foreach\", \"array,key,value\", \"string\");\n}"
            },
            "label" : "Flexy - Foreach",
-           "* pack" : "append",
            "xtype" : "MenuItem",
+           "* pack" : "append",
            "tooltip_markup" : "Add a flexy foreach (for HTML templates)",
            "$ xns" : "Gtk"
           }
             "edited" : "  (path, newtext) => {\n        print(\"Keyrender  - signal:edited\\n\");\n    \n    this.el.editable = false;\n  \n \n\n        Gtk.TreeIter  iter;\n        _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n        GLib.Value gval;\n        \n         _this.model.el.get_value(iter,1, out gval);\n        var oldval = (string)gval;\n        \n         _this.model.el.get_value(iter,0, out gval);\n        var ktype = (string)gval;\n       \n        _this.model.el.set_value(iter, 1, newtext);\n        \n        if (oldval == newtext) {\n            return;\n        }\n        \n        \n        print(\"ktype: %s\\n\",ktype);\n        switch(ktype) {\n            case \"listener\":\n                var ov = _this.node.listeners.get(oldval);\n                _this.node.listeners.set(newtext, ov);\n                _this.node.listeners.unset(oldval);\n                \n                _this.updateIter(iter,  ktype, newtext, ov);\n                \n                break;\n            case \"props\":\n                var ov = _this.node.props.get(oldval);\n                _this.node.props.set(newtext, ov);\n                _this.node.props.unset(oldval);\n                _this.updateIter(iter,  ktype, newtext, ov);\n                break;\n         }\n         _this.changed();\n          \n}"
            },
            "id" : "keyrender",
-           "* pack" : "pack_start,false",
            "xtype" : "CellRendererText",
+           "* pack" : "pack_start,false",
            "$ xns" : "Gtk"
           }
          ]
             "edited" : "  (path, newtext) => {\n    print(\"Valrender  - signal:edited\\n\");\n  \n        this.el.editable = false;\n/*  \n m.set(iter, \n                0, \"listener\",\n                1, miter.get_key(),\n                2, \"<b>\" + miter.get_key() + \"</b>\",\n                3, miter.get_value(),\n                4, display_value(short);\n            ); \n\n  */      \n\n        Gtk.TreeIter  iter;\n        _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n        GLib.Value gval;\n        \n         _this.model.el.get_value(iter,0, out gval);\n        var ktype = (string)gval;\n        \n        \n         _this.model.el.get_value(iter,3, out gval);\n        var oldval = (string)gval;\n        \n         _this.model.el.get_value(iter,1, out gval);\n        var key = (string)gval;\n        \n         \n        \n        switch(ktype) {\n            case \"listener\":\n                _this.node.listeners.set(key, newtext);\n                _this.updateIter(iter,ktype,key,newtext);\n                break;\n            case \"props\":\n                _this.node.props.set(key,newtext);\n                _this.updateIter(iter,ktype, key,newtext);                \n                break;\n         }\n//         _this.load(_this.file,_this.node);\n         _this.changed();\n          \n}"
            },
            "id" : "valrender",
-           "xtype" : "CellRendererCombo",
            "* pack" : "pack_start,true",
+           "xtype" : "CellRendererCombo",
            "$ editable" : false,
            "$ has_entry" : true,
            "$ xns" : "Gtk",
            "items" : [
             {
              "id" : "valrendermodel",
-             "xtype" : "ListStore",
              "* pack" : false,
+             "xtype" : "ListStore",
              "$ columns" : "typeof(string)",
              "n_columns" : 1,
              "$ xns" : "Gtk",
         },
         {
          "id" : "ContextMenu",
-         "* pack" : false,
          "xtype" : "Menu",
+         "* pack" : false,
          "$ xns" : "Gtk",
          "items" : [
           {
             "activate" : "  ( )  =>{\n  \n    var s = _this.view.el.get_selection();\n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n    s.get_selected (out  mod, out  iter);\n    \n      if (_this.view.popover == null) {\n     \t\t   _this.view.popover = new Xcls_PopoverProperty();\n     \t\t   _this.view.popover.mainwindow = _this.main_window;\n \t\t}\n \t\t\n \n      _this.before_edit();\n      _this.stop_editor();\n\t  \n     _this.keyrender.el.stop_editing(false);\n     _this.keyrender.el.editable  =false;\n\n     _this.valrender.el.stop_editing(false);\n     _this.valrender.el.editable  =false;\n     \n      \n\tGLib.Value gvaltype, gval;\n\tmod.get_value(iter, 1 , out gval); // one is key..\n\t\n     mod.get_value(iter,0, out gvaltype);\n\n\t_this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);\n       \n    \n    \n   // _this.startEditingKey(model.get_path(iter));\n}"
            },
            "label" : "Edit (double click)",
-           "* pack" : "append",
            "xtype" : "MenuItem",
+           "* pack" : "append",
            "$ xns" : "Gtk"
           },
           {
             "activate" : "  ( )  =>{\n\t_this.deleteSelected();\n}"
            },
            "label" : "Delete",
-           "* pack" : "append",
            "xtype" : "MenuItem",
+           "* pack" : "append",
            "$ xns" : "Gtk"
           }
          ]
index 6e585e4..b04c462 100644 (file)
@@ -134,7 +134,7 @@ public class Xcls_LeftProps : Object
          // 
         this.before_edit();
     }
-    public              bool startEditingValue ( Gtk.TreePath path) {
+    public bool startEditingValue ( Gtk.TreePath path) {
     
          // ONLY return true if editing is allowed - eg. combo..
     
@@ -211,7 +211,7 @@ public class Xcls_LeftProps : Object
             return false;
         }
         
-         var pal = Palete.factory(this.file.project.xtype);
+         var pal = this.file.project.palete;
         
         string[] opts;
         var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
index 62b1d92..92699b3 100644 (file)
    "items" : [
     {
      "id" : "notebook",
-     "xtype" : "Notebook",
      "* pack" : "pack_start,true,true,0",
+     "xtype" : "Notebook",
      "$ xns" : "Gtk",
      "items" : [
       {
        "id" : "label_preview",
-       "xtype" : "Label",
        "* pack" : false,
+       "xtype" : "Label",
        "$ xns" : "Gtk",
        "utf8 label" : "Preview"
       },
       {
        "id" : "label_code",
-       "* pack" : false,
        "xtype" : "Label",
+       "* pack" : false,
        "$ xns" : "Gtk",
        "utf8 label" : "Preview Generated Code"
       },
       {
        "id" : "paned",
-       "xtype" : "Paned",
        "* pack" : "append_page,_this.label_preview.el",
+       "xtype" : "Paned",
        "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
        "items" : [
         {
          "id" : "viewbox",
-         "xtype" : "Box",
          "* pack" : "pack1,true,true",
+         "xtype" : "Box",
          "$ xns" : "Gtk",
          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
          "$ homogeneous" : false,
          "items" : [
           {
            "$ vexpand" : false,
-           "* pack" : "pack_start,false,true,0",
            "$ height_request" : 20,
+           "* pack" : "pack_start,false,true,0",
            "xtype" : "Box",
            "$ xns" : "Gtk",
            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
@@ -76,8 +76,8 @@
               "clicked" : "( ) => {\n    _this.view.renderJS(  true);\n}"
              },
              "label" : "Redraw",
-             "* pack" : "pack_start,false,false,0",
              "xtype" : "Button",
+             "* pack" : "pack_start,false,false,0",
              "$ xns" : "Gtk"
             },
             {
               "clicked" : " () => {\n  _this.view.redraws = 99;\n    _this.view.el.web_context.clear_cache();  \n  //_this.view.renderJS(true);\n  FakeServerCache.clear();\n  _this.view.reInit();\n\n}"
              },
              "label" : "Full Redraw",
-             "* pack" : "pack_start,false,false,0",
              "xtype" : "Button",
+             "* pack" : "pack_start,false,false,0",
              "$ xns" : "Gtk"
             }
            ]
           },
           {
            "id" : "viewcontainer",
-           "$ shadow_type" : "Gtk.ShadowType.IN",
            "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
+           "$ shadow_type" : "Gtk.ShadowType.IN",
            "* pack" : "pack_end,true,true,0",
            "xtype" : "ScrolledWindow",
            "$ xns" : "Gtk",
         },
         {
          "id" : "inspectorcontainer",
-         "$ shadow_type" : "Gtk.ShadowType.IN",
          "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
+         "$ shadow_type" : "Gtk.ShadowType.IN",
          "xtype" : "ScrolledWindow",
          "* pack" : "pack2,true,true",
          "$ xns" : "Gtk"
           "key_release_event" : "() => { \n\tthis.key_is_pressed = false;\n\treturn false;\n}\n"
          },
          "gboolean show_line_marks" : true,
-         "| void onCursorChanged" : "(/*ParamSpec ps*/) {\n\n\t\tif (!this.key_is_pressed && !this.button_is_pressed) {\n\t\t\treturn;\n\t\t}\n\n\t   if (this.loading) {\n            return;\n        }\n       // if (ps.name != \"cursor-position\") {\n       //     return;\n       // }\n\n        var buf = this.el.get_buffer();\n        //print(\"cursor changed : %d\\n\", buf.cursor_position);\n        Gtk.TextIter cpos;\n        buf.get_iter_at_offset(out cpos, buf.cursor_position);\n        \n        var ln = cpos.get_line();\n        \n        \n        // --- select node at line....\n        \n        var node = _this.file.lineToNode(ln+1);\n \n        if (node == null) {\n            print(\"can not find node\\n\");\n            return;\n        }\n        var prop = node.lineToProp(ln+1);\n        print(\"prop : %s\", prop == null ? \"???\" : prop);\n        \n        \n        // ---------- this selects the tree's node...\n        \n        var ltree = _this.main_window.windowstate.left_tree;\n        var tp = ltree.model.treePathFromNode(node);\n        print(\"got tree path %s\\n\", tp);\n        if (tp != \"\") {\n\t         \n\t       \n\t        //print(\"changing cursor on tree..\\n\");\n\t       \n \n            \n            // let's try allowing editing on the methods.\n            // a little klunky at present..\n            this.prop_selected = \"\";\n            if (prop != null) {\n        \t\t//see if we can find it..\n        \t\tvar kv = prop.split(\":\");\n        \t\tif (kv[0] == \"p\") {\n        \t\t\n\t        \t\t//var k = prop.get_key(kv[1]);\n\t        \t\t// fixme -- need to determine if it's an editable property...\n\t        \t\tthis.prop_selected = prop;\n\t        \t\t\n        \t\t} else if (kv[0] == \"l\") {\n        \t\t\t this.prop_selected = prop;\n        \t\t\t\n        \t\t}\n            }\n            ltree.view.setCursor(tp, \"editor\");\n           // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); \n           this.nodeSelected(node,false);\n            \n            // scrolling is disabled... as node selection calls scroll 10ms after it changes.\n             \n        }\n        \n        // highlight the node..\n}\n ",
          "id" : "sourceview",
+         "| void onCursorChanged" : "(/*ParamSpec ps*/) {\n\n\t\tif (!this.key_is_pressed && !this.button_is_pressed) {\n\t\t\treturn;\n\t\t}\n\n\t   if (this.loading) {\n            return;\n        }\n       // if (ps.name != \"cursor-position\") {\n       //     return;\n       // }\n\n        var buf = this.el.get_buffer();\n        //print(\"cursor changed : %d\\n\", buf.cursor_position);\n        Gtk.TextIter cpos;\n        buf.get_iter_at_offset(out cpos, buf.cursor_position);\n        \n        var ln = cpos.get_line();\n        \n        \n        // --- select node at line....\n        \n        var node = _this.file.lineToNode(ln+1);\n \n        if (node == null) {\n            print(\"can not find node\\n\");\n            return;\n        }\n        var prop = node.lineToProp(ln+1);\n        print(\"prop : %s\", prop == null ? \"???\" : prop);\n        \n        \n        // ---------- this selects the tree's node...\n        \n        var ltree = _this.main_window.windowstate.left_tree;\n        var tp = ltree.model.treePathFromNode(node);\n        print(\"got tree path %s\\n\", tp);\n        if (tp != \"\") {\n\t         \n\t       \n\t        //print(\"changing cursor on tree..\\n\");\n\t       \n \n            \n            // let's try allowing editing on the methods.\n            // a little klunky at present..\n            this.prop_selected = \"\";\n            if (prop != null) {\n        \t\t//see if we can find it..\n        \t\tvar kv = prop.split(\":\");\n        \t\tif (kv[0] == \"p\") {\n        \t\t\n\t        \t\t//var k = prop.get_key(kv[1]);\n\t        \t\t// fixme -- need to determine if it's an editable property...\n\t        \t\tthis.prop_selected = prop;\n\t        \t\t\n        \t\t} else if (kv[0] == \"l\") {\n        \t\t\t this.prop_selected = prop;\n        \t\t\t\n        \t\t}\n            }\n            ltree.view.setCursor(tp, \"editor\");\n           // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); \n           this.nodeSelected(node,false);\n            \n            // scrolling is disabled... as node selection calls scroll 10ms after it changes.\n             \n        }\n        \n        // highlight the node..\n}\n ",
          "| void clearGreySelection" : "() {\n // clear all the marks..\n    var sbuf = (Gtk.SourceBuffer)this.el.buffer;\n    \n    Gtk.TextIter start;\n    Gtk.TextIter end;     \n        \n    sbuf.get_bounds (out start, out end);\n    sbuf.remove_source_marks (start, end, \"grey\");\n    \n    \n}\n",
          "* init" : "{\n   \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(8000);\n    this.el.override_font(description);\n\n    this.loading = true;\n    //var buf = this.el.get_buffer();\n    //buf.notify.connect(this.onCursorChanged);\n  \n  \n  \n    var attrs = new Gtk.SourceMarkAttributes();\n    var  pink =   Gdk.RGBA();\n    pink.parse ( \"pink\");\n    attrs.set_background ( pink);\n    attrs.set_icon_name ( \"process-stop\");    \n    attrs.query_tooltip_text.connect(( mark) => {\n        //print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"ERR\", attrs, 1);\n    \n     var wattrs = new Gtk.SourceMarkAttributes();\n    var  blue =   Gdk.RGBA();\n    blue.parse ( \"#ABF4EB\");\n    wattrs.set_background ( blue);\n    wattrs.set_icon_name ( \"process-stop\");    \n    wattrs.query_tooltip_text.connect(( mark) => {\n        //print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"WARN\", wattrs, 1);\n    \n \n    \n     var dattrs = new Gtk.SourceMarkAttributes();\n    var  purple =   Gdk.RGBA();\n    purple.parse ( \"#EEA9FF\");\n    dattrs.set_background ( purple);\n    dattrs.set_icon_name ( \"process-stop\");    \n    dattrs.query_tooltip_text.connect(( mark) => {\n        //print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"DEPR\", dattrs, 1);\n    \n    \n    var gattrs = new Gtk.SourceMarkAttributes();\n    var  grey =   Gdk.RGBA();\n    grey.parse ( \"#ccc\");\n    gattrs.set_background ( grey);\n \n    \n    this.el.set_mark_attributes (\"grey\", gattrs, 1);\n    \n    \n    \n    \n    \n    \n}\n ",
          "| void nodeSelected" : "(JsRender.Node? sel, bool scroll ) {\n  \n    \n\t\n    // this is connected in widnowstate\n\n\n\t// not sure why....   \n    while(Gtk.events_pending()) {\n        Gtk.main_iteration();\n    }\n    \n    this.node_selected = sel;\n    \n    this.updateGreySelection(scroll);\n    \n    \n    \n}\n\n   \n",
             "changed" : " () => {\n \n\n    // check syntax??\n    // ??needed..??\n   // _this.save_button.el.sensitive = true;\n    ///?? has changed occured during loading?\n    \n    // only trigger this if \n    \n    \n    \n    \n    if (_this.sourceview.loading) {\n\t\treturn;\n\t}\n\t\n\n\t\n    print(\"- PREVIEW EDITOR CHANGED--\");\n\n    this.dirty = true;  \n    this.checkSyntax(); // this calls backs and highlights errors.. in theory...  \n\n\n\n\tif (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {\n\t\tprint(\"button or key not pressed to generate change?!\\n\");\n\t\treturn;\n\t}\n\t\t\n    \n\t// what are we editing??\n\tif (null == _this.sourceview.node_selected || _this.sourceview.prop_selected.length  < 1) {\n\t\treturn;\n\t}\n\t\n\t// find the colon on the first line...\n\t\n\tif (_this.sourceview.editable_start_pos > -1) {\n\t\t\n\t\tvar buf = (Gtk.SourceBuffer)_this.sourceview.el.get_buffer();\n\t\t\n        //print(\"cursor changed : %d\\n\", buf.cursor_position);\n        Gtk.TextIter spos,epos;\n        buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);\n        buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos); // initialize epos..\n        \n        var gotit= false;\n        var line = spos.get_line();\n        var endline = buf.get_line_count();\n        while (line < endline) {\n    \t\tline++;\n\t        buf.get_iter_at_line(out epos, line);\n\t        if (buf.get_source_marks_at_line(line, \"grey\").length() > 0) {\n\t\t        buf.get_iter_at_line(out epos, line);\t    \t\t\n\t    \t\tgotit=true;\n\t    \t\tbreak;\n    \t\t}\n\t\t}\n        \n \t\tif (gotit) {\n\t \t\tprint(\"End Offset = %d/%d\\n\", epos.get_line(), epos.get_offset());\n\t\t\t// get the pos...\n\t\t\t// in theory the last char will be '}' or '},' .. or ','\n\t\t\t// we should chop the ',' of the end...\n\t\t\tvar str = buf.get_text(spos, epos, false);\n\t\t\tprint(\"got string\\n%s\\n\", str);\n\t\t\n\t\t}\n\t}\n    return ;\n}\n\n \n"
            },
            "bool dirty" : false,
-           "int error_line" : "-1",
            "id" : "buffer",
+           "int error_line" : "-1",
            "| bool highlightErrors" : "( Gee.HashMap<int,string> validate_res) {\n         \n    this.error_line = validate_res.size;\n\t\n    if (this.error_line < 1) {\n          return true;\n    }\n    var tlines = this.el.get_line_count ();\n    Gtk.TextIter iter;\n    var valiter = validate_res.map_iterator();\n    while (valiter.next()) {\n    \n//        print(\"get inter\\n\");\n        var eline = valiter.get_key();\n        if (eline > tlines) {\n            continue;\n        }\n        this.el.get_iter_at_line( out iter, eline);\n        //print(\"mark line\\n\");\n        this.el.create_source_mark(valiter.get_value(), \"ERR\", iter);\n    }   \n    return false;\n}",
            "|   string toString" : "  () {\n    \n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    this.el.get_start_iter(out s);\n    this.el.get_end_iter(out e);\n    var ret = this.el.get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n ",
-           "|   bool checkSyntax" : " () {\n \n   \n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, \"WARN\");\n        this.el.remove_source_marks (start, end, \"ERR\");        \n\n    }\n    \n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return false;\n    }\n    \n   if (_this.file == null) {\n       return false;\n   }\n    var p = Palete.factory(_this.file.xtype);  // returns Roo | Gtk  | PlainFile \n    \n \n    if (_this.file.language != \"js\") {\n\t\treturn false; // fake syntax error.\n\t}\n\t\n    //Gee.HashMap<int,string> ret_x;\n\n\treturn p.javascriptHasErrors(\n\t\t_this.main_window.windowstate,\n        str, \n         \"\", // _this.key, \n        \"file\", //_this.ptype,\n        _this.file, \n        null\n    );    \n     \n}\n",
+           "|   bool checkSyntax" : " () {\n \n   \n    var str = this.toString();\n    \n    // needed???\n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, \"WARN\");\n        this.el.remove_source_marks (start, end, \"ERR\");        \n\n    }\n    \n    if (str.length < 1) {\n        print(\"checkSyntax - empty string?\\n\");\n        return false;\n    }\n    \n   if (_this.file == null) {\n       return false;\n   }\n    var p = _this.file.project.palete;\n    \n \n    if (_this.file.language != \"js\") {\n\t\treturn false; // fake syntax error.\n\t}\n\t\n    //Gee.HashMap<int,string> ret_x;\n\n\treturn p.javascriptHasErrors(\n\t\t_this.main_window.windowstate,\n        str, \n         \"\", // _this.key, \n        \"file\", //_this.ptype,\n        _this.file, \n        null\n    );    \n     \n}\n",
            "* pack" : "set_buffer",
            "xtype" : "SourceBuffer",
            "$ xns" : "Gtk"
index 7fe51d5..6e1ee60 100644 (file)
@@ -1639,7 +1639,7 @@ public class Xcls_WindowRooView : Object
            if (_this.file == null) {
                return false;
            }
-            var p = Palete.factory(_this.file.xtype);  // returns Roo | Gtk  | PlainFile 
+            var p = _this.file.project.palete;
             
          
             if (_this.file.language != "js") {
index 6d1cee4..264da5b 100644 (file)
@@ -744,12 +744,12 @@ public class WindowState : Object
                                }
                                this.add_props.el.show_all();
                                this.add_props.show(
-                                       Palete.factory(this.win.project.xtype), 
+                                       this.win.project.palete, //Palete.factory(this.win.project.xtype), 
                                        this.state == State.LISTENER ? "signals" : "props",
                                        ae.fqn()
                                );
  
-                                       
+                                        
  
                                
                                // -- FIXME? this needs to be State aware?
index 30620ea..94d9f80 100644 (file)
@@ -30,7 +30,6 @@
             "../JsRender/Gtk.vala",
             "../JsRender/JsRender.vala",
             "../JsRender/Lang.vala",
-            "../JsRender/NodeToGlade.vala",
             "../JsRender/NodeToGtk.vala",
             "../JsRender/NodeToJs.vala",
             "../JsRender/NodeToVala.vala",
index db19fe2..16b11eb 100644 (file)
@@ -304,7 +304,7 @@ namespace JsRender {
                public Palete.Palete palete()
                {
                        // error on plainfile?
-                       return Palete.factory(this.project.xtype);
+                       return this.project.palete;
 
                }
                
index 78db4ed..0a96797 100644 (file)
@@ -49,7 +49,7 @@ public class JsRender.NodeToGlade : Object {
        Gee.HashMap<string,string> ar_props;
        public static int vcnt = 0; 
 
-       public NodeToGlade( Node node,   string pad) 
+       public NodeToGlade( Project.Gtk, Node node,   string pad) 
        {
                this.node = node;
                this.pad = pad;
@@ -152,7 +152,7 @@ public class JsRender.NodeToGlade : Object {
                var id = this.node.uid();
                var ret = @"$pad<object class=\"$cls\" id=\"$id\">\n";
                // properties..
-               var props = Palete.Gir.factoryFqn(this.node.fqn()).props;
+               var props = Palete.Gir.factoryFqn(this.project, this.node.fqn()).props;
                //var props =  Palete.factory("Gtk").getPropertiesFor(this.node.fqn(), "props");
               
                var pviter = props.map_iterator();
@@ -238,7 +238,7 @@ public class JsRender.NodeToGlade : Object {
 
  
                var ns = p_parts[0];
-               var gir =  Palete.Gir.factory(ns);
+               var gir =  Palete.Gir.factory(this.project, ns);
                var cls = gir.classes.get(p_parts[1]);
                var mdef = cls.methods.get(pk[0]);
                if (mdef == null) {
index 613b363..a465c75 100644 (file)
@@ -35,10 +35,14 @@ public class JsRender.NodeToGtk : Object {
         //Gee.ArrayList<string> skip;
        Gee.HashMap<string,string> ar_props;
        public static int vcnt = 0; 
+       
+       Project.Gtk project;
 
-       public NodeToGtk( Node node , NodeToGtk? parent_obj = null) 
+       public NodeToGtk(  Project.Gtk project,  Node node , NodeToGtk? parent_obj = null) 
        {
                this.node = node;
+               this.project = project;
+               
                this.els = new Gee.ArrayList<string>(); 
                this.children = new Gee.ArrayList<NodeToGtk>(); 
                //this.skip = new Gee.ArrayList<string>();
@@ -73,9 +77,9 @@ public class JsRender.NodeToGtk : Object {
                
        }
        
-       public Object? munge ( )
+       public Object? munge (  )
        {
-               var ret = this.mungeNode();
+               var ret = this.mungeNode( );
                if (ret == null) {
                        return null;
                }
@@ -83,9 +87,9 @@ public class JsRender.NodeToGtk : Object {
                return ret.wrapped_object;
                      
        }
-       public NodeToGtk? mungeChild(  Node cnode)
+       public NodeToGtk? mungeChild (   Node cnode)
        {
-               var x = new  NodeToGtk(cnode, this);
+               var x = new  NodeToGtk(  this.project, cnode, this);
                
                return x.mungeNode();
                
@@ -152,7 +156,7 @@ public class JsRender.NodeToGtk : Object {
                        this.packContainerParams();
                }
                
-               var cls_gir =Palete.Gir.factoryFqn(this.node.fqn()); 
+               var cls_gir =Palete.Gir.factoryFqn(this.project, this.node.fqn()); 
                if (cls_gir == null) {
                        return null;
                }
@@ -173,7 +177,7 @@ public class JsRender.NodeToGtk : Object {
                        }
                        // find out the type of the property...
                        var type = pviter.get_value().type;
-                       type = Palete.Gir.fqtypeLookup(type, ns);
+                       type = Palete.Gir.fqtypeLookup(this.project, type, ns);
 
                        var  ocl = (ObjectClass) cls_gtype.class_ref ();
                        var ps = ocl.find_property(k);
@@ -433,7 +437,7 @@ public class JsRender.NodeToGtk : Object {
                        return;
                }
                
-               var parent_gir = Palete.Gir.factoryFqn(this.parentObj.node.fqn());
+               var parent_gir = Palete.Gir.factoryFqn(this.project, this.parentObj.node.fqn());
 
                var parent = this.parentObj.wrapped_object;
                
@@ -472,7 +476,7 @@ public class JsRender.NodeToGtk : Object {
                                Value cur_val;
                                 
                                var type = mparams.get(i).type;
-                               type = Palete.Gir.fqtypeLookup(type, ns);
+                               type = Palete.Gir.fqtypeLookup(this.project, type, ns);
 
                                var val = this.toValue(pack[i].strip(), type);
                                if (val == null) {
index 178e6ab..2757d36 100644 (file)
@@ -90,13 +90,14 @@ BUIDERJSRENDER = \
                JsRender/PlainFile.vala \
                JsRender/JsRender.vala \
                JsRender/Lang.vala \
-               JsRender/NodeToGlade.vala \
                JsRender/NodeToGtk.vala \
                JsRender/NodeToJs.vala \
                JsRender/NodeToVala.vala \
                JsRender/Node.vala \
                JsRender/Roo.vala 
 
+
+
 BUIDERPALETE = \
                Palete/Gir.vala \
                Palete/GirObject.vala \
index d5fc506..829d57c 100644 (file)
@@ -135,15 +135,15 @@ namespace Palete {
 
                public static  Gee.HashMap<string,Gir> global_cache = null;
                
-               public static Gir?  factory(Project.Gtk? project, string ns) 
+               public static Gir?  factory(Project.Project  project, string ns) 
                {
                        if (global_cache == null) {
                                global_cache = new Gee.HashMap<string,Gir>();
                                 
                        }
                        var cache = global_cache;
-                       if (project != null) {
-                               cache = project.gir_cache;
+                       if (project != null && project is Project.Gtk) {
+                               cache = ((Project.Gtk)project).gir_cache;
                        }
                        
                        var ret = cache.get(ns);
@@ -151,7 +151,7 @@ namespace Palete {
                        
                        if (ret == null && project != null) {
 
-                               var a = new VapiParser(project );
+                               var a = new VapiParser( (Project.Gtk)project );
                                a.create_valac_tree();
                                ret = cache.get(ns);
                        }
@@ -160,7 +160,7 @@ namespace Palete {
                                ret.is_overlaid = true;
                                var iter = ret.classes.map_iterator();
                                while(iter.next()) {
-                                       iter.get_value().overlayParent();
+                                       iter.get_value().overlayParent(project);
                                }
                                // loop again and add the ctor properties.
                                iter = ret.classes.map_iterator();
@@ -178,7 +178,7 @@ namespace Palete {
                
                
                
-               public static GirObject?  factoryFqn(Project.Gtk project, string fqn)  
+               public static GirObject?  factoryFqn(Project.Project project, string fqn)  
                {       
                        var bits = fqn.split(".");
                        if (bits.length < 1) {
@@ -199,7 +199,7 @@ namespace Palete {
                /**
                 * guess the fqn of a type == eg. gboolean or Widget etc...
                 */
-               public static string fqtypeLookup(Project.Gtk project, string type, string ns) {
+               public static string fqtypeLookup(Project.Project project, string type, string ns) {
                        var g = factory(project, ns);
                        if (g.classes.has_key(type)) {
                                return ns + "." + type;
index f10b29e..955da36 100644 (file)
@@ -105,7 +105,7 @@ namespace Palete {
                }
 
                
-               public void  overlayParent()
+               public void  overlayParent(Project.Project project)
                {
                        
                        if (this.parent.length < 1 || this.is_overlaid) {
@@ -115,18 +115,18 @@ namespace Palete {
                         
                        //print("Overlaying " +this.name + " with " + this.parent + "\n");
 
-                       var pcls = this.clsToObject( this.parent);
+                       var pcls = this.clsToObject( project, this.parent);
                        if (pcls == null) {
                                return;
                                //throw new GirError.INVALID_VALUE("Could not find class : " + 
                                //      this.parent + " of " + this.name  + " in " + this.ns);
                        }
                        
-                       pcls.overlayParent( );
+                       pcls.overlayParent( project );
                        this.copyFrom(pcls,false);
                        for(var i=0; i < this.implements.size; i++) {
                                var clsname = this.implements.get(i);
-                               var picls = this.clsToObject(clsname);
+                               var picls = this.clsToObject(project, clsname);
                                this.copyFrom(picls,true);
                        }
                        this.is_overlaid = true;
@@ -399,23 +399,15 @@ namespace Palete {
                 *  code relating to the structure loader ....
                 * 
                 */
-                
-               public GirObject clsToObject(string in_pn)
+
+               public GirObject clsToObject(Project.Project project , string in_pn)
                {
                        var pn = in_pn;
-                       /*
-                       
-                       
-                       var gir = Gir.factory (this.ns);
-                       if (in_pn.contains(".")) {
-                               gir =  Gir.factory(in_pn.split(".")[0]);
-                               pn = in_pn.split(".")[1];
-                       }
-                       */
+                 
                        
-                       var gir = Gir.factory (this.ns);
+                       var gir = Gir.factory (project, this.ns);
                        if (in_pn.contains(".")) {
-                               gir =  Gir.factory(in_pn.split(".")[0]);
+                               gir =  Gir.factory(project, in_pn.split(".")[0]);
                                pn = in_pn.split(".")[1];
                        }
                        
@@ -424,6 +416,7 @@ namespace Palete {
 
                        
                }
+               /*
                //public string fqtype() {
                //      return Gir.fqtypeLookup(this.type, this.ns);
                        
index eb2c9f6..52346bf 100644 (file)
@@ -53,7 +53,7 @@ namespace Palete {
                
                public string doc(string what) {
                        var ns = what.split(".")[0];
-                       var gir =  Gir.factory(this,ns);
+                       var gir =  Gir.factory(this.project,ns);
                        return   gir.doc(what);
                        
                    //return typeof(this.comments[ns][what]) == 'undefined' ?  '' : this.comments[ns][what];
@@ -101,7 +101,7 @@ namespace Palete {
                        //cls.parseMethods(); // ?? needed for ??..
                        //cls.parseConstructors(); // ?? needed for ??..
 
-                       cls.overlayParent();
+                       cls.overlayParent(this.project);
 
                        switch  (type) {
                                case "props":
@@ -129,7 +129,7 @@ namespace Palete {
                {
                        string[] ret = {};
                         
-                       var cls = Gir.factoryFqn(this,ename);
+                       var cls = Gir.factoryFqn(this.project,ename);
                         
                        if (cls == null || cls.nodetype != "Class") {
                                print("getInheritsFor:could not find cls: %s\n", ename);
@@ -166,7 +166,7 @@ namespace Palete {
                                }
                                var fp = meth.paramset.params.get(0);
                                
-                               var type = Gir.fqtypeLookup(fp.type, meth.ns);
+                               var type = Gir.fqtypeLookup(this.project, fp.type, meth.ns);
                                print ("fillPack:first param type is %s\n", type);
 
                                
@@ -177,7 +177,7 @@ namespace Palete {
                                
                                var pack = meth.name;
                                for(var i =1; i < meth.paramset.params.size; i++) {
-                                       var ty = Gir.fqtypeLookup(meth.paramset.params.get(i).type, meth.ns);
+                                       var ty = Gir.fqtypeLookup(this.project,meth.paramset.params.get(i).type, meth.ns);
                                        pack += "," + Gir.guessDefaultValueForType(ty);
                                }
 
@@ -271,7 +271,7 @@ namespace Palete {
                                opts = { "true", "false" };
                                return true;
                        }
-                       var gir= Gir.factoryFqn(this,type) ;
+                       var gir= Gir.factoryFqn(this.project,type) ;
                        if (gir == null) {
                                print("could not find Gir data for %s\n", key);
                                return false;
@@ -309,7 +309,7 @@ namespace Palete {
                        // completion rules??
                        
                        // make sure data is loaded
-                       Gir.factory(this,"Gtk");
+                       Gir.factory(this.project,"Gtk");
                        
                        // Roo......
                        
@@ -330,7 +330,7 @@ namespace Palete {
                                                ret.append(new SourceCompletionItem (ss, ss, null, "vala : " + ss));
                                        }
                                }
-                               var miter = Gir.cache.map_iterator();
+                               var miter = ((Project.Gtk)this.project).gir_cache.map_iterator();
                                while (miter.next()) {
                                        var ss = miter.get_key();
                                        
@@ -362,7 +362,7 @@ namespace Palete {
                                curtype = "*" +  node.fqn();
                                cur_instance = true;
                        } else {
-                                if (Gir.cache.get(parts[0]) == null) {
+                                if (((Project.Gtk)this.project).gir_cache.get(parts[0]) == null) {
                                        return ret;
                                }
                                curtype = parts[0];
@@ -383,7 +383,7 @@ namespace Palete {
                                
                                 
                                // look up all the properties of the type...
-                               var cls = Gir.factoryFqn(curtype);
+                               var cls = Gir.factoryFqn(this.project,curtype);
                                if (cls == null && curtype[0] != '*') {
                                        print("could not get class of curtype %s\n", curtype);
                                        return ret;
@@ -419,7 +419,7 @@ namespace Palete {
                                                return ret;      //no idea...
                                        }
                                        var look = prevbits + parts[i];
-                                       var scls = Gir.factoryFqn(look);
+                                       var scls = Gir.factoryFqn(this.project,look);
                                        if (scls == null) {
                                                return ret;
                                        }
index 8a744e3..576072a 100644 (file)
@@ -44,7 +44,7 @@ namespace Palete
 
        
 
-    static Gee.HashMap<string,Palete>? cache = null;
+   //static Gee.HashMap<string,Palete>? cache = null;
     
     /*
     public static Palete factory(project)
index 4ed1abc..2d82876 100644 (file)
@@ -23,12 +23,12 @@ namespace Palete {
     public class Roo : Palete {
                
                
-        public Roo()
+        public Roo(Project.Project project)
         {
 
 
             
-            base();
+            base(project);
             this.name = "Roo";
                          
         }
index df7ab7c..5d6c475 100644 (file)
@@ -19,7 +19,8 @@
  */
  
 
-namespace Project {
+namespace Project 
+{
        static int gtk_id = 1;
  
 
@@ -30,11 +31,15 @@ namespace Project {
                *
                */
                public Gee.HashMap<string,Palete.Gir> gir_cache = null;
+               
          
                public Gtk(string path) {
                  
                  
                        base(path);
+                       this.palete = new Palete.Gtk(this);
+                       
                        this.gir_cache = new Gee.HashMap<string,Palete.Gir>();
                        this.xtype = "Gtk";
                        var gid = "project-gtk-%d".printf(gtk_id++);
index d5b0f5b..cd46f65 100644 (file)
@@ -23,6 +23,7 @@ namespace Project {
        public Gee.HashMap<string,Project>  projects;
        
        
+       
        public bool  projects_loaded = false;
 
        
@@ -43,6 +44,7 @@ namespace Project {
                
                public Json.Object json_project_data;
                public Palete.RooDatabase roo_database;
+               public Palete.Palete palete;
                 
                bool is_scanned; 
           
index 0ddbd59..6f7dd98 100644 (file)
@@ -10,6 +10,7 @@ public class Project.Roo : Project {
 
                
         base(path);
+               this.palete = new Palete.Roo(this);
         this.xtype = "Roo";
         // various loader methods..
         this.id = "project-roo-%d".printf(rid++);
index c698bb4..a51a30f 100644 (file)
@@ -282,12 +282,22 @@ public class Resources : Object
                                        break;
                                        
                                case "GtkUsage.txt":
-                                       Palete.factory("Gtk").load();
+                               foreach(var p in Project.Project.allProjectsByName()) { 
+                                               if (p is Project.Gtk) {
+                                                       p.palete = new Palete.Gtk(p);
+                                                       p.palete.load();
+                                               }
+                                       }
+
                                        break;
                                        
                                case "roodata.json":
-                                       Palete.factory("Roo").classes  = null;
-                                       Palete.factory("Roo").load();
+                                       foreach(var p in Project.Project.allProjectsByName()) { 
+                                               if (p is Project.Roo) {
+                                                       p.palete = new Palete.Roo(p);
+                                                       p.palete.load();
+                                               }
+                                       }
                                        break;
                                        
                                default:
index 21cc7d5..43ee8c8 100755 (executable)
Binary files a/src/roobuilder and b/src/roobuilder differ