Fix #8011 - add resources
[roobuilder] / src / Builder4 / PopoverAddObject.bjs
index 77770ad..20d4cd8 100644 (file)
@@ -1,11 +1,11 @@
 {
  "build_module" : "",
+ "gen_extended" : false,
  "items" : [
   {
    "$ xns" : "Gtk",
    "@ void after_node_change" : "(JsRender.Node? node)",
    "@ void before_node_change" : "(JsRender.Node? node)",
-   "@ void drag_end" : "()",
    "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "Xcls_MainWindow mainwindow" : "",
    "bool active" : false,
       " ",
       ""
      ],
-     "* pack" : "add",
+     "* pack" : "set_child",
+     "id" : "viewwin",
      "items" : [
       {
-       "# string dragData" : "",
-       "$ enable_tree_lines" : true,
-       "$ headers_visible" : true,
        "$ xns" : "Gtk",
-       "* init" : [
-        " {",
-        "    this.el.set_size_request(150,-1);",
-        "                          //  set_reorderable: [1]",
-        "                                  ",
-        "    var description = new Pango.FontDescription();",
-        "    description.set_size(10000);",
-        "    this.el.override_font(description);",
-        "    ",
-        "    var selection = this.el.get_selection();",
-        "    selection.set_mode( Gtk.SelectionMode.SINGLE);",
-        "   // this.selection.signal['changed'].connect(function() {",
-        "    //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);",
-        "    //});",
-        "    // see: http://live.gnome.org/GnomeLove/DragNDropTutorial",
-        "     ",
-        "    Gtk.drag_source_set (",
-        "            this.el,            /* widget will be drag-able */",
-        "            Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */",
-        "            BuilderApplication.targetList,            /* lists of target to support */",
-        "            Gdk.DragAction.COPY         /* what to do with data after dropped */",
-        "    );",
-        "    //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);",
-        "   ",
-        "   // Gtk.drag_source_set_target_list(this.el, Application.targetList);",
-        "   // Gtk.drag_source_add_text_targets(this.el); ",
-        " ",
-        "}",
-        ""
-       ],
-       "* pack" : "add",
+       "* pack" : "set_child",
+       "bool hexpand" : true,
+       "bool vexpand" : true,
+       "id" : "view",
        "items" : [
         {
-         "$ columns" : "typeof(string),typeof(string),typeof(Gdk.Pixbuf)",
+         "$ Gdk.DragAction[] actions" : "Gdk.DragAction.COPY   | Gdk.DragAction.MOVE   ",
+         "$ xns" : "Gtk",
+         "listeners" : {
+          "drag_begin" : [
+           "( drag )  => {",
+           "\tGLib.debug(\"SOURCE: drag-begin\");",
+           "\t ",
+           "    // find what is selected in our tree...",
+           "   var data = _this.selmodel.getSelectedNode();",
+           "\tif (data == null) {",
+           "\t\treturn  ;",
+           "\t}",
+           "\t ",
+           "    var xname = data.fqn();",
+           "    GLib.debug (\"XNAME  IS %s\", xname);",
+           "",
+           " \tvar widget = _this.view.getWidgetAtRow(_this.selmodel.el.selected);",
+           " \t",
+           " \t",
+           "    var paintable = new Gtk.WidgetPaintable(widget);",
+           "    this.el.set_icon(paintable, 0,0);",
+           "            ",
+           " ",
+           "}"
+          ],
+          "drag_end" : [
+           "(drag, delete_data) => {",
+           "\t_this.hide();",
+           "",
+           "}",
+           ""
+          ],
+          "prepare" : [
+           "(x, y) => {",
+           "",
+           "\t",
+           "\t",
+           "///\t( drag_context, data, info, time) => {",
+           "            ",
+           "",
+           "\t//print(\"drag-data-get\");",
+           " \tvar ndata = _this.selmodel.getSelectedNode();",
+           "\tif (ndata == null) {",
+           "\t \tGLib.debug(\"return empty string - no selection..\");",
+           "\t\treturn null;",
+           "\t ",
+           "\t}",
+           "",
+           "  ",
+           "\t//data.set_text(tp,tp.length);   ",
+           "",
+           "\tvar \tstr = ndata.toJsonString();",
+           "\tGLib.debug(\"prepare  store: %s\", str);",
+           "\tGLib.Value ov = GLib.Value(typeof(string));",
+           "\tov.set_string(str);",
+           " \tvar cont = new Gdk.ContentProvider.for_value(ov);",
+           "    ",
+           "\t//GLib.Value v = GLib.Value(typeof(string));",
+           "\t//var str = drop.read_text( [ \"text/plain\" ] 0);",
+           "\t ",
+           "\t//cont.get_value(ref v);",
+           "\t//GLib.debug(\"set %s\", v.get_string());",
+           "        ",
+           " \treturn cont;",
+           "\t  ",
+           "}",
+           ""
+          ]
+         },
+         "xtype" : "DragSource"
+        },
+        {
          "$ xns" : "Gtk",
-         "* pack" : "set_model",
-         "id" : "model",
-         "n_columns" : 3,
-         "xtype" : "ListStore",
-         "| string getValue" : [
-          " (Gtk.TreeIter iter, int col)  {",
-          "\tGLib.Value gval;",
-          "\tthis.el.get_value(iter, col , out gval);",
-          "\treturn  (string)gval;",
-          "     ",
+         "* prop" : "model",
+         "id" : "selmodel",
+         "items" : [
+          {
+           "$ xns" : "Gtk",
+           "* ctor" : [
+            "new Gtk.TreeListModel(",
+            "    new GLib.ListStore(typeof(JsRender.Node)), //..... << that's our store..",
+            "    false, // passthru",
+            "    true, // autexpand",
+            "    (item) => {",
+            "    \treturn ((JsRender.Node)item).childstore;",
+            "    ",
+            "    }",
+            "    ",
+            "    ",
+            ")"
+           ],
+           "* prop" : "model",
+           "id" : "model",
+           "xtype" : "TreeListModel"
+          }
+         ],
+         "xtype" : "SingleSelection",
+         "| JsRender.Node getNodeAt" : [
+          "(uint row) {",
+          "",
+          "   var tr = (Gtk.TreeListRow)this.el.get_item(row);",
+          "   ",
+          "   var a = tr.get_item();;   ",
+          "   GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
+          "    ",
+          "   return (JsRender.Node)tr.get_item();",
+          "\t ",
+          "}"
+         ],
+         "| JsRender.Node? getSelectedNode" : [
+          "() {",
+          "  if (this.el.selected_item == null) {",
+          "\t\treturn null;",
+          "  }\t\t\t        ",
+          "   var tr = (Gtk.TreeListRow)this.el.selected_item;",
+          "   return (JsRender.Node)tr.get_item();",
+          "\t ",
           "}"
          ]
         },
         {
          "$ xns" : "Gtk",
-         "* init" : [
-          "this.el.add_attribute(_this.txtrender.el , \"markup\",  1 );",
-          "this.el.add_attribute(_this.iconrender.el , \"pixbuf\",  2 );",
-          ""
-         ],
          "* pack" : "append_column",
+         "bool expand" : true,
+         "id" : "maincol",
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "pack_start,true",
-           "id" : "iconrender",
-           "xtype" : "CellRendererPixbuf"
-          },
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "pack_start,true",
-           "id" : "txtrender",
-           "xtype" : "CellRendererText"
+           "* prop" : "factory",
+           "listeners" : {
+            "bind" : [
+             "(listitem) => {",
+             "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
+             "\t",
+             "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
+             " ",
+             "\t ",
+             " \tvar hbox = (Gtk.Box)  ((Gtk.ListItem)listitem).get_child();",
+             " ",
+             " ",
+             "\t",
+             "\tvar img = (Gtk.Image) hbox.get_first_child();",
+             "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
+             "\t",
+             "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+             "\t",
+             "\t",
+             "\t",
+             "\tvar node = (JsRender.Node) lr.get_item();",
+             "\t",
+             "   GLib.debug(\"node is %s\", node.get_type().name());",
+             "   GLib.debug(\"lbl is %s\", lbl.get_type().name());",
+             "   GLib.debug(\"node fqn %s\", node.fqn());",
+             "// was item (1) in old layout",
+             "",
+             "\t ",
+             " \timg.resource = node.iconResourceName;",
+             " \tlbl.label =  node.fqn();",
+             "// \tlbl.tooltip_markup = node.nodeTip();",
+             " ",
+             "  ",
+             " \t// bind image...",
+             " \t",
+             "}",
+             ""
+            ],
+            "setup" : [
+             "(listitem) => {",
+             "\t",
+             " ",
+             "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
+             "\tvar icon = new Gtk.Image();",
+             "\tvar lbl = new Gtk.Label(\"\");",
+             "\tlbl.use_markup = true;",
+             "\t",
+             "\t",
+             " \tlbl.justify = Gtk.Justification.LEFT;",
+             " \tlbl.xalign = 0;",
+             "\tlbl.margin_start = 4;",
+             "//\tlistitem.activatable = true; ??",
+             "\t",
+             "\thbox.append(icon);",
+             "\thbox.append(lbl);",
+             "\t ",
+             "\t((Gtk.ListItem)listitem).set_child(hbox);",
+             "\t ",
+             "}",
+             ""
+            ]
+           },
+           "xtype" : "SignalListItemFactory"
           }
          ],
-         "utf8 title" : "Drag to add Object",
-         "xtype" : "TreeViewColumn"
+         "title" : "Drag to add Object",
+         "xtype" : "ColumnViewColumn"
+        },
+        {
+         "$ xns" : "Gtk",
+         "listeners" : {
+          "pressed" : [
+           "(n_press, x, y) => {",
+           "\tif (n_press < 2) { /// doubleclick?",
+           "\t\treturn;",
+           "\t}",
+           "\t//var pos = \"\";",
+           "\t// find left tree selected node",
+           "\tvar addto = _this.mainwindow.windowstate.left_tree.selmodel.getSelectedNode();",
+           "\t//var row = _this.view.getRowAt(x,y, out pos);",
+           "\t",
+           " \t var add = _this.selmodel.getSelectedNode().deepClone();",
+           "\taddto.appendChild(add);",
+           "\t_this.mainwindow.windowstate.left_props.changed();",
+           "\t_this.mainwindow.windowstate.left_tree.model.selectNode(add);",
+           "}",
+           ""
+          ]
+         },
+         "xtype" : "GestureClick"
         }
        ],
-       "listeners" : {
-        "button_press_event" : [
-         " ( event) => {",
-         "",
-         " //\tif (!this.get('/Editor').save()) {",
-         " //\t    // popup!! - click handled.. ",
-         "// \t    return true;",
-         "//        }",
-         "    return false;",
-         "}"
-        ],
-        "drag_begin" : [
-         "  ( ctx) => {",
-         "    // we could fill this in now...",
-         "//        Seed.print('SOURCE: drag-begin');",
-         "        ",
-         "        ",
-         "        ",
-         "        Gtk.TreeIter iter;",
-         "        var s = this.el.get_selection();",
-         "        ",
-         "        Gtk.TreeModel mod;",
-         "        s.get_selected(out mod, out iter);",
-         "        var path = mod.get_path(iter);",
-         "        ",
-         "        /// pix is a surface..",
-         "        var pix = this.el.create_row_drag_icon ( path);",
-         "            ",
-         "                ",
-         "        Gtk.drag_set_icon_surface (ctx, pix);",
-         "        GLib.Value value;",
-         "        ",
-         "",
-         "        _this.model.el.get_value(iter, 0, out value);",
-         "        ",
-         "        this.dragData = (string) value;",
-         "         ",
-         "        ",
-         "        return;",
-         "}"
-        ],
-        "drag_data_get" : [
-         "(drag_context, selection_data, info, time) => {",
-         " \t//Seed.print('Palete: drag-data-get: ' + target_type);",
-         "    if (this.dragData.length < 1 ) {",
-         "        return; ",
-         "    }",
-         "    ",
-         "    GLib.debug(\"setting drag data to %s\\n\", this.dragData);",
-         "   // selection_data.set_text(this.dragData ,this.dragData.length);",
-         "   selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());",
-         "",
-         "        //this.el.dragData = \"TEST from source widget\";",
-         "        ",
-         "        ",
-         "}"
-        ],
-        "drag_end" : [
-         "( drag_context)  => {",
-         " \t GLib.debug(\"SOURCE: drag-end (call listener on this)\\n\");",
-         "\t",
-         "\tthis.dragData = \"\";",
-         "\t//this.dropList = null;",
-         "\t_this.drag_end(); // call signal..",
-         "\t//this.get('/LeftTree.view').highlight(false);",
-         "\t ",
-         "}"
-        ]
-       },
-       "xtype" : "TreeView"
+       "xtype" : "ColumnView",
+       "| Gtk.Widget? getWidgetAt" : [
+        "(double x,  double in_y) {",
+        "/*",
+        "    \t",
+        "from    \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+        "    \tvar colview = gesture.widget;",
+        "    \tvar line_no = check_list_widget(colview, x,y);",
+        "         if (line_no > -1) {",
+        "    \t\tvar item = colview.model.get_item(line_no);",
+        "    \t\t ",
+        "    \t}",
+        "    \t*/",
+        "    \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
+        "        var  child = this.el.get_first_child(); ",
+        "    \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+        "    \tvar line_no = -1; ",
+        "    \tvar reading_header = true;",
+        "    \tvar curr_y = 0;",
+        "    \tvar header_height  = 0;",
+        "    \tvar h = 0;",
+        "    \twhile (child != null) {",
+        "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+        "\t        if (reading_header) {",
+        "\t\t\t\t",
+        "",
+        "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+        "\t\t\t        h += child.get_height();",
+        "\t\t\t\t\tchild = child.get_next_sibling();",
+        "\t\t\t\t\tcontinue;",
+        "\t\t\t\t}",
+        "\t\t\t\t// should be columnlistview",
+        "\t\t\t\tchild = child.get_first_child(); ",
+        "\t\t\t    GLib.debug(\"header height=%d\", h);",
+        "\t\t\t\theader_height =  h;",
+        "\t\t\t\t",
+        "\t\t\t\treading_header = false;",
+        "\t\t\t\t",
+        "\t        }",
+        "\t\t    line_no++;",
+        "",
+        "\t\t\tif (y < header_height) {",
+        "\t\t    \treturn null;",
+        "\t    \t}",
+        "",
+        "\t\t\tvar hh = child.get_height();",
+        "\t\t\t//GLib.debug(\"got cell xy = %d,%d  w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+        "",
+        "\t\t    if (y > curr_y && y <= header_height + hh + curr_y ) {",
+        "\t\t\t    return (Gtk.Widget)child;",
+        "\t\t    }",
+        "\t\t    curr_y +=  hh ;",
+        "",
+        "\t\t    if (curr_y > y) {",
+        "\t\t        return null;",
+        "\t        }",
+        "\t        child = child.get_next_sibling(); ",
+        "    \t}",
+        "        return null;",
+        "",
+        " }"
+       ],
+       "| Gtk.Widget? getWidgetAtRow" : [
+        "(uint row) {",
+        "/*",
+        "// ?? could be done with model?",
+        "    \t",
+        "from    \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+        "    \tvar colview = gesture.widget;",
+        "    \tvar line_no = check_list_widget(colview, x,y);",
+        "         if (line_no > -1) {",
+        "    \t\tvar item = colview.model.get_item(line_no);",
+        "    \t\t ",
+        "    \t}",
+        "    \t*/",
+        "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
+        "        var  child = this.el.get_first_child(); ",
+        "    \tvar line_no = -1; ",
+        "    \tvar reading_header = true;",
+        "",
+        "    \twhile (child != null) {",
+        "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+        "    \t    if (reading_header) {",
+        "\t\t\t ",
+        "\t\t\t   ",
+        "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+        "\t\t\t\t\tchild = child.get_next_sibling();",
+        "\t\t\t\t\tcontinue;",
+        "\t\t\t\t}",
+        "\t\t\t\tchild = child.get_first_child(); ",
+        "\t\t\t\treading_header = false;",
+        "\t        }",
+        "\t\t    if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+        "    \t\t    child = child.get_next_sibling();",
+        "    \t\t    continue;",
+        "\t\t    }",
+        "\t\t    line_no++;",
+        "\t\t\tif (line_no == row) {",
+        "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
+        "\t\t\t    return (Gtk.Widget)child;",
+        "\t\t    }",
+        "\t        child = child.get_next_sibling(); ",
+        "    \t}",
+        "\t\tGLib.debug(\"Rturning null\");",
+        "        return null;",
+        "",
+        " }"
+       ],
+       "| int getRowAt" : [
+        "(double x,  double in_y, out string pos) {",
+        "",
+        "",
+        "\t ",
+        "",
+        "/*",
+        "    \t",
+        "from    \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+        "    \tvar colview = gesture.widget;",
+        "    \tvar line_no = check_list_widget(colview, x,y);",
+        "         if (line_no > -1) {",
+        "    \t\tvar item = colview.model.get_item(line_no);",
+        "    \t\t ",
+        "    \t}",
+        "    \t*/",
+        " \t\t ",
+        " \t\t",
+        " \t\t//GLib.debug(\"offset = %d  y = %d\", (int) voff, (int) in_y);",
+        "    \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
+        "        var  child = this.el.get_first_child(); ",
+        "    \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+        "    \tvar line_no = -1; ",
+        "    \tvar reading_header = true;",
+        "    \tvar real_y = 0;",
+        "    \tvar header_height  = 0;",
+        "    \tpos = \"none\";",
+        "    \tvar h = 0;",
+        "    \twhile (child != null) {",
+        "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+        "    \t    if (reading_header) {",
+        "\t\t\t\t",
+        "",
+        "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+        "\t\t\t        h += child.get_height();",
+        "\t\t\t\t\tchild = child.get_next_sibling();",
+        "\t\t\t\t\tcontinue;",
+        "\t\t\t\t}",
+        "\t\t\t\t// should be columnlistview",
+        "\t\t\t\tchild = child.get_first_child(); ",
+        "\t\t\t    GLib.debug(\"header height=%d\", h);",
+        "\t\t\t\theader_height =  h;",
+        "\t\t\t\t",
+        "\t\t\t\treading_header = false;",
+        "\t\t\t\t",
+        "\t        }",
+        "\t        ",
+        "\t\t    if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+        "    \t\t    child = child.get_next_sibling();",
+        "    \t\t    continue;",
+        "\t\t    }",
+        "\t\t    ",
+        "\t\t \tif (y < header_height) {",
+        "\t\t    \treturn -1;",
+        "\t    \t}",
+        "\t\t    ",
+        "\t\t    line_no++;",
+        "\t\t\tvar hh = child.get_height();",
+        "\t\t\t//child.get_allocation(out alloc);",
+        "\t\t\t//GLib.debug(\"got cell xy = %d,%d  w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+        "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
+        "\t\t\t",
+        "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
+        "",
+        "\t\t    if (y >  (header_height + real_y) && y <= (header_height +  real_y + hh) ) {",
+        "\t\t    \tif (y > ( header_height + real_y + (hh * 0.8))) {",
+        "\t\t    \t\tpos = \"below\";",
+        "\t    \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
+        "\t    \t\t\tpos = \"over\";",
+        "    \t\t\t} else {",
+        "    \t\t\t\tpos = \"above\";",
+        "\t\t\t\t}",
+        "\t\t    \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
+        "\t\t\t    return line_no;",
+        "\t\t    }",
+        " ",
+        "",
+        "\t\t    if (real_y + hh > y) {",
+        "\t\t        return -1;",
+        "\t        }",
+        "\t        real_y += hh;",
+        "\t        child = child.get_next_sibling(); ",
+        "    \t}",
+        "        return -1;",
+        "",
+        " }"
+       ]
       }
      ],
      "xtype" : "ScrolledWindow"
     }
    ],
    "xtype" : "Popover",
-   "| void clear" : [
+   "| void a_clear" : [
     "() {",
-    " this.model.el.clear();",
+    "    var m = (GLib.ListStore) _this.model.el.model;",
+    "\tm.remove_all();",
+    "",
+    "\t",
+    "",
     "}",
     ""
    ],
    "| void show" : [
     "(Palete.Palete pal, string cls,  Gtk.Widget onbtn) {",
     "",
-    "    ",
-    "   ",
-    " ",
+    "     ",
     "",
-    "    var tr = pal.getChildList(cls);",
-    "    this.model.el.clear();",
+    "    var tr = pal.getChildList(cls, false);",
+    "    var m = (GLib.ListStore) _this.model.el.model;",
+    "\tm.remove_all();",
     "",
+    "\t",
+    "\t// new version will not support properties here..",
+    "\t// they will be part of the properties, clicking will add a node..",
+    "\t// will change the return list above eventually?",
+    "\t",
+    " ",
+    "\tforeach (var dname in tr) {",
+    "\t\t ",
     "",
-    "    Gtk.TreeIter citer;",
-    "    var ic = Gtk.IconTheme.get_default();",
-    "\tvar pixdef = ic.load_icon(\"emblem-new\", 16,0);",
+    "\t\tGLib.debug(\"add to model: %s\", dname);\t\t",
+    "\t\tm.append(pal.fqnToNode(dname));",
+    "\t}",
+    "\t m.sort( (a, b) => {",
     "",
-    "    for(var i =0 ; i < tr.length; i++) {",
-    "         this.model.el.append(out citer);   ",
-    "         var dname = tr[i];",
-    "         var clsname = dname;",
-    "         if (dname.contains(\":\")) {",
-    "\t\t\tvar ar = dname.split(\":\");",
-    "\t\t\tdname = \"<b>\" + ar[1] +\"</b> - <i>\"+ar[0]+\"</i>\";",
-    "\t\t\tclsname = ar[0]; /// possibly?",
-    "\t\t}",
-    "         ",
-    "        this.model.el.set_value(citer, 0,   tr[i] ); // used data. ",
-    "        this.model.el.set_value(citer, 1,   dname ); // displayed value.",
-    "        ",
-    "        var clsb = clsname.split(\".\");",
-    "        var sub = clsb.length > 1 ? clsb[1].down()  : \"\";",
-    "        ",
-    "        var pix = pixdef;",
-    "        var fn = \"/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-\" + sub + \".png\";",
-    "        if (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
-    "\t        pix = new Gdk.Pixbuf.from_file (fn);",
-    "        }",
-    "        ",
-    "        ",
-    "        this.model.el.set_value(citer, 2,   pix );",
-    "        ",
-    "        ",
-    "    }",
-    "    this.model.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);",
-    "    ",
-    "    ",
-    "    ",
+    "\t\t\treturn Posix.strcmp( ((JsRender.Node)a).fqn(),  ((JsRender.Node)b).fqn());",
+    "\t\t\t",
+    "\t\t});",
+    "\t ",
     "    ",
-    "    ",
-    "    // set size up...",
-    "    ",
-    "    this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
-    "    int w,h;",
-    "    this.mainwindow.el.get_size(out w, out h);",
+    "    var win = this.mainwindow.el;",
+    "    //var  w = win.get_width();",
+    "    var h = win.get_height();",
+    "",
     "    ",
     "    // left tree = 250, editor area = 500?",
     "    ",
     "\t// max hieght ...",
     "    this.el.set_size_request( 350, h); // full height?",
     "",
-    "    ",
+    "      this.el.set_parent(onbtn);",
     "",
-    "    if (this.el.relative_to == null) {",
-    "        this.el.set_relative_to(onbtn);",
-    "    }",
-    "    this.el.show_all();",
+    "    //if (this.el.relative_to == null) {",
+    "    \t//Gtk.Allocation rect;",
+    "    \t//onbtn.get_allocation(out rect);",
+    "      //  this.el.set_pointing_to(rect);",
+    "    //}",
+    "    this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
+    "    this.el.show();",
     "   ",
-    "    while(Gtk.events_pending()) { ",
-    "            Gtk.main_iteration();",
-    "    }       ",
-    " //   this.hpane.el.set_position( 0);",
     "}",
     ""
    ]
   }
  ],
- "modOrder" : "",
- "name" : "PopoverAddObject",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverAddObject.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "PopoverAddObject"
 }
\ No newline at end of file