fix #7440 - GTK4 version is now master
[roobuilder] / src / Builder4 / PopoverFileDetails.bjs
index 842a016..158deed 100644 (file)
@@ -1,5 +1,6 @@
 {
  "build_module" : "builder",
+ "gen_extended" : false,
  "items" : [
   {
    "# JsRender.JsRender file" : "null",
@@ -7,7 +8,6 @@
    "# bool new_window" : true,
    "$ xns" : "Gtk",
    "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
-   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "Xcls_MainWindow mainwindow" : "null",
    "bool done" : false,
    "bool modal" : true,
     {
      "$ pack" : "add",
      "$ xns" : "Gtk",
-     "* pack" : "add",
+     "* pack" : "set_child",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
      "bool hexpand" : true,
      "bool homogeneous" : false,
+     "int margin_bottom" : 4,
+     "int margin_end" : 4,
+     "int margin_start" : 4,
+     "int margin_top" : 4,
      "items" : [
       {
        "$ xns" : "Gtk",
-       "* pack" : "pack_start,false,true,0",
-       "string title" : "Add / Edit File",
-       "xtype" : "HeaderBar"
-      },
-      {
-       "$ xns" : "Gtk",
-       "* pack" : "pack_start,false,false,4",
+       "* columns" : 2,
+       "* pack" : "append",
        "bool hexpand" : true,
        "id" : "grid",
+       "int column_spacing" : 4,
        "int margin_end" : 4,
        "int margin_start" : 4,
        "items" : [
         {
          "$ justify" : "Gtk.Justification.RIGHT",
+         "$ visible" : true,
+         "$ xns" : "Gtk",
+         "id" : "dir_dropdown_lbl",
+         "label" : "Create File in this Directory",
+         "x_options" : 4,
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
+        },
+        {
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,0,1,1",
-         "id" : "filetypelbl",
+         "id" : "dir_dropdown",
+         "int colspan" : 1,
+         "items" : [
+          {
+           "$ xns" : "Gtk",
+           "* prop" : "model",
+           "id" : "dir_model",
+           "strings" : "{}",
+           "xtype" : "StringList"
+          }
+         ],
+         "xtype" : "DropDown",
+         "| string getValue" : [
+          "() {",
+          "\treturn _this.dir_model.el.get_string(this.el.selected);",
+          "}"
+         ]
+        },
+        {
+         "$ justify" : "Gtk.Justification.RIGHT",
+         "$ xns" : "Gtk",
+         "id" : "filetype_lbl",
          "label" : "File type",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
         },
         {
          "$ xns" : "Gtk",
-         "* init" : "this.el.add_attribute(_this.ftdbcellrenderer.el , \"markup\", 1 );",
-         "* pack" : "attach,1,0,1,1",
          "bool hexpand" : true,
          "id" : "filetype",
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "pack_start,true",
-           "id" : "ftdbcellrenderer",
-           "xtype" : "CellRendererText"
-          },
-          {
-           "$ columns" : "typeof(string),typeof(string)",
-           "$ xns" : "Gtk",
-           "* pack" : "set_model",
-           "id" : "ftdbmodel",
-           "n_columns" : 2,
-           "xtype" : "ListStore",
-           "| void loadData" : [
-            "  (string cur) {",
-            "    this.el.clear();                                    ",
-            "    Gtk.TreeIter iter;",
+           "* prop" : "model",
+           "id" : "filetype_model",
+           "strings" : "{}",
+           "xtype" : "StringList",
+           "| void load" : [
+            "() {",
             "    var el = this.el;",
             "    ",
-            "   /// el.append(out iter);",
-            "    ",
-            "     ",
-            "   // el.set_value(iter, 0, \"\");",
-            "   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");",
-            "",
-            "    el.append(out iter);",
-            "",
-            "    ",
-            "    el.set_value(iter, 0, \"bjs\");",
-            "    el.set_value(iter, 1, \"User Interface File (bjs)\");",
-            "    _this.filetype.el.set_active_iter(iter);",
-            "",
-            "    el.append(out iter);",
-            "    ",
-            "    el.set_value(iter, 0, \"vala\");",
-            "    el.set_value(iter, 1, \"Vala\");",
-            "\tif (cur == \"vala\") {",
-            "\t    _this.filetype.el.set_active_iter(iter);",
-            "    }",
-            "",
-            "",
-            "",
-            "    el.append(out iter);",
+            "    while (el.get_n_items() > 0) {",
+            "    \tel.remove(0);",
+            "\t}",
+            " \tel.append(\"bjs - User Interface File\");",
+            " ",
             "    ",
-            "    el.set_value(iter, 0, \"js\");",
-            "    el.set_value(iter, 1, \"Javascript\");",
-            "",
-            "\tif (cur == \"js\") {",
-            "\t    _this.filetype.el.set_active_iter(iter);",
-            "    }",
+            " switch(_this.project.xtype) {",
+            " \tcase \"Roo\":",
+            " \t \tel.append(\"js - Javascript File\");",
+            " \t \tel.append(\"css - CSS File\");",
+            " \t \tel.append(\"php - Javascript File\");",
+            " \t \t",
+            "\t\tbreak;",
             "",
-            "    el.append(out iter);",
-            "    ",
-            "    el.set_value(iter, 0, \"css\");",
-            "    el.set_value(iter, 1, \"CSS\");",
+            "\tcase \"Gtk\":\t\t",
+            "\t\t\t",
+            " \t \tel.append(\"vala - Vala File\");",
+            " \t \tel.append(\"css - CSS File\");",
+            " \t \tel.append(\"other - Other Type\");",
+            " \t \tbreak;",
+            " \t default : ",
+            " \t \tbreak;",
+            "\t}",
             "",
-            "\tif (cur == \"css\") {",
-            "\t    _this.filetype.el.set_active_iter(iter);",
-            "    }",
-            "                                     ",
-            "}",
-            ""
+            "\t",
+            "\t",
+            "\t",
+            "}"
            ]
           }
          ],
          "listeners" : {
-          "changed" : [
+          "notify[\"selected\"]" : [
            "() => {",
-           "\tGtk.TreeIter iter;",
-           "\tbool is_bjs = true;",
-           "\tif (this.el.get_active_iter(out iter)) {",
-           "\t\tValue vfname;",
-           "\t\t_this.ftdbmodel.el.get_value (iter, 0, out vfname);",
-           "\t\t is_bjs = ((string)vfname) == \"bjs\";",
-           "\t}",
-           "    ",
+           "",
+           " ",
            "  ",
            "    // directory is only available for non-bjs ",
-           "    this.showhide(is_bjs);",
-           "",
+           "    this.showhide( );",
            "",
-           "}",
-           ""
+           " }"
           ]
          },
-         "xtype" : "ComboBox",
+         "xtype" : "DropDown",
+         "| string getValue" : [
+          "() {",
+          "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+          "\t\treturn \"\";",
+          "\t}",
+          "\t",
+          "\treturn _this.filetype_model.el.get_string(this.el.selected).split(\" \")[0];",
+          "}"
+         ],
+         "| void setValue" : [
+          "(string cur) {",
+          "\tvar el  = _this.filetype_model.el;",
+          "\tfor(var i= 0; i < el.get_n_items();i++)  {",
+          "\t\tif (el.get_string(i).has_prefix(cur)) {",
+          "\t\t\tthis.el.selected = i;",
+          "\t\t\tbreak;",
+          "\t\t}",
+          "\t}",
+          "}"
+         ],
          "| void showhide" : [
-          "(bool is_bjs) {",
+          "()   {",
           "",
           "",
-          "\t ",
-          "\t_this.grid.showAllRows();",
-          "",
+          "\t",
+          "\t",
+          "\t_this.title_lbl.el.hide();",
+          "\t_this.title.el.hide();",
+          "\t",
+          "\t_this.region_lbl.el.hide();",
+          "\t_this.region.el.hide();",
+          "\t",
+          "\t_this.parent_lbl.el.hide();",
+          "\t_this.parent.el.hide();",
+          "\t",
+          "\t_this.permname_lbl.el.hide();",
+          "\t_this.permname.el.hide();",
+          "\t",
+          "\t_this.modOrder_lbl.el.hide();",
+          "\t_this.modOrder.el.hide();",
+          "\t",
+          "\t_this.build_module_lbl.el.hide();",
+          "\t_this.build_module.el.hide();",
+          "\t",
+          "\t_this.gen_lbl.el.hide();",
+          "\t_this.gen.el.hide();",
+          " ",
+          "\tvar sel = this.getValue();",
+          "\t",
           "\tswitch(_this.project.xtype) {",
           "\t\tcase \"Roo\":",
+          "\t\t \t",
+          "\t\t\tif (sel == \"bjs\") {",
+          "\t\t\t\t_this.title_lbl.el.show();",
+          "\t\t\t\t_this.title.el.show();",
+          "\t\t\t\t",
+          "\t\t\t\t_this.region_lbl.el.show();",
+          "\t\t\t\t_this.region.el.show();",
+          "\t\t\t\t",
+          "\t\t\t\t_this.parent_lbl.el.show();",
+          "\t\t\t\t_this.parent.el.show();",
+          "\t\t\t\t",
+          "\t\t\t\t_this.permname_lbl.el.show();",
+          "\t\t\t\t_this.permname.el.show();",
+          "\t\t\t\t",
+          "\t\t\t\t_this.modOrder_lbl.el.show();",
+          "\t\t\t\t_this.modOrder.el.show();",
           "\t\t\t",
-          "\t\t\t_this.grid.hideRow(7);",
-          "\t\t\t_this.grid.hideRow(8);\t\t\t",
-          "\t\t\t// hide: vala: module",
-          "\t\t\t// row 7",
-          "\t\t\t// row 8 (directory)",
+          "\t\t\t}",
+          "\t\t\t_this.build_module_model.load(null);",
+          "\t\t ",
           "\t\t\t",
           "\t\t\tbreak;",
           "\t\tdefault: // vala..",
-          "\t\t\t_this.grid.hideRow(2);",
-          "\t\t\t_this.grid.hideRow(3);\t",
-          "\t\t\t_this.grid.hideRow(4);",
-          "\t\t\t_this.grid.hideRow(5);\t",
-          "\t\t\t_this.grid.hideRow(6);\t",
-          "\t\t    // hide 2,3,4,5,6,",
-          "\t\t    if (_this.file.name.length > 0) {",
-          "\t\t    \t_this.grid.hideRow(8); // directory - cant change it here..",
-          "\t    \t}",
+          "\t\t",
+          "\t \t\t_this.build_module_lbl.el.show();",
+          "\t\t\t_this.build_module.el.show();",
+          "\t",
+          "\t\t\t_this.gen_lbl.el.show();",
+          "\t\t\t_this.gen.el.show();",
           "\t\t    ",
           "\t\t\tbreak;",
           "\t}",
           "    //??? why can we not create bjs files in other directories??",
           "\t//if (!is_bjs && _this.file.path.length < 1) {",
           "\t",
-          "\t\t_this.dirmodel.loadData();",
+          " ",
           "\t\t",
           "\t\t",
           "\t//}",
         {
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,1,1,1",
-         "label" : "Component Name",
+         "label" : "Component Name (File name without extension)",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
          "xtype" : "Label"
         {
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,1,1,1,1",
          "bool hexpand" : true,
          "id" : "name",
          "xtype" : "Entry"
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,2,1,1",
+         "id" : "title_lbl",
          "label" : "Title",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,3,1,1",
+         "id" : "region_lbl",
          "label" : "Region",
          "tooltip_text" : "center, north, south, east, west",
          "x_options" : 4,
         {
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,1,3,1,1",
          "bool hexpand" : true,
          "id" : "region",
          "xtype" : "Entry"
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,4,1,1",
+         "id" : "parent_lbl",
          "label" : "Parent Name",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
         {
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,1,4,1,1",
          "id" : "parent",
          "xtype" : "Entry"
         },
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,5,1,1",
+         "id" : "permname_lbl",
          "label" : "Permission Name",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
         {
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,1,5,1,1",
          "id" : "permname",
          "xtype" : "Entry"
         },
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,6,1,1",
+         "id" : "modOrder_lbl",
          "label" : "Order (for tabs)",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
         {
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,1,6,1,1",
          "id" : "modOrder",
          "xtype" : "Entry"
         },
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,7,1,1",
+         "id" : "build_module_lbl",
          "label" : "Module to build",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
         },
         {
          "$ xns" : "Gtk",
-         "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
-         "* pack" : "attach,1,7,1,1",
          "id" : "build_module",
          "items" : [
           {
            "$ xns" : "Gtk",
-           "* pack" : "pack_start,true",
-           "id" : "dbcellrenderer",
-           "xtype" : "CellRendererText"
-          },
-          {
-           "$ columns" : "typeof(string),typeof(string)",
-           "$ xns" : "Gtk",
-           "* pack" : "set_model",
-           "id" : "dbmodel",
-           "n_columns" : 2,
-           "xtype" : "ListStore",
-           "| void loadData" : [
-            "  (Gee.ArrayList<string> data, string cur) {",
-            "    this.el.clear();                                    ",
-            "    Gtk.TreeIter iter;",
-            "    var el = this.el;",
-            "    ",
-            "   /// el.append(out iter);",
-            "    ",
-            "     ",
-            "   // el.set_value(iter, 0, \"\");",
-            "   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");",
-            "",
-            "    el.append(out iter);",
-            "",
-            "    ",
-            "    el.set_value(iter, 0, \"\");",
-            "    el.set_value(iter, 1, \"-- select a module --\");",
-            "    _this.build_module.el.set_active_iter(iter);",
-            "    ",
-            "    for (var i = 0; i < data.size;i++) {",
-            "    ",
-            "",
-            "        el.append(out iter);",
-            "        ",
-            "        el.set_value(iter, 0, data.get(i));",
-            "        el.set_value(iter, 1, data.get(i));",
-            "        ",
-            "        if (data.get(i) == cur) {",
-            "            _this.build_module.el.set_active_iter(iter);",
-            "        }",
-            "        ",
-            "    }",
-            "     this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          ",
-            "                                     ",
-            "}",
-            ""
-           ]
-          }
-         ],
-         "xtype" : "ComboBox"
-        },
-        {
-         "$ justify" : "Gtk.Justification.RIGHT",
-         "$ visible" : true,
-         "$ xns" : "Gtk",
-         "* pack" : "attach,0,8,1,1",
-         "label" : "Directory",
-         "x_options" : 4,
-         "xalign" : 0.90000000000000002,
-         "xtype" : "Label"
-        },
-        {
-         "$ xns" : "Gtk",
-         "* init" : "this.el.add_attribute(_this.dircellrenderer.el , \"markup\", 1 );",
-         "* pack" : "attach,1,8,1,1",
-         "id" : "dir",
-         "items" : [
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "pack_start,true",
-           "id" : "dircellrenderer",
-           "xtype" : "CellRendererText"
-          },
-          {
-           "$ columns" : "typeof(string),typeof(string)",
-           "$ xns" : "Gtk",
-           "* pack" : "set_model",
-           "id" : "dirmodel",
-           "n_columns" : 2,
-           "xtype" : "ListStore",
-           "| void loadData" : [
-            "  () {",
+           "* prop" : "model",
+           "id" : "build_module_model",
+           "strings" : "{}",
+           "xtype" : "StringList",
+           "| void load" : [
+            "(Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)",
+            "{",
             "\t",
+            "\t_this.build_module.el.hide();",
+            "\t\t_this.build_module_lbl.el.hide();",
+            "\tvar el = _this.build_module_model.el;",
+            "\t while (el.get_n_items() > 0) {",
+            "\t\t\tel.remove(0);",
+            "\t}",
             "\t",
-            "  ",
-            "    this.el.clear();                                    ",
-            "    ",
-            "    if (!(_this.project is Project.Gtk)) {",
+            "\tif (compilegroups == null) {",
             "\t\treturn;",
             "\t}",
-            "    var sd = ((Project.Gtk)_this.project).sourcedirs();",
-            "    ",
-            "    Gtk.TreeIter iter;",
-            "    var el = this.el;",
-            "    ",
-            "   /// el.append(out iter);",
-            "    ",
-            "     ",
-            "   // el.set_value(iter, 0, \"\");",
-            "   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");",
-            "",
-            "//    el.append(out iter);",
-            "",
-            "    ",
-            "//    el.set_value(iter, 0, \"\");",
-            "  //  el.set_value(iter, 1, \"-- select a directoyr --\");",
-            "    //_this.build_module.el.set_active_iter(iter);",
-            "    ",
-            "    for (var i = 0; i < sd.length;i++) {",
-            "    ",
-            "",
-            "        el.append(out iter);",
-            "        ",
-            "        el.set_value(iter, 0, sd[i]);",
-            "        el.set_value(iter, 1, sd[i]);",
-            "        ",
-            "        //if (data.get(i) == cur) {",
-            "        //    _this.build_module.el.set_active_iter(iter);",
-            "       // }",
-            "        ",
-            "    }",
-            "  //  this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          ",
-            "                                     ",
-            "}",
-            ""
+            "\tforeach(var k in compilegroups.keys) {",
+            "\t\tthis.el.append(k);",
+            "\t}",
+            "\tif (compilegroups.keys.size > 0) {",
+            "\t\t_this.build_module.el.selected = 0;",
+            "\t\t_this.build_module.el.show();",
+            "\t\t_this.build_module_lbl.el.show();",
+            "\t} else {",
+            "\t\t",
+            "\t}",
+            "\t",
+            "}"
            ]
           }
          ],
-         "xtype" : "ComboBox"
+         "xtype" : "DropDown",
+         "| string getValue" : [
+          " ",
+          "() {",
+          "\tif (this.el.selected < 0) {",
+          "\t\treturn \"\";",
+          "\t}",
+          "\t",
+          "\treturn _this.build_module_model.el.get_string(this.el.selected);",
+          "}",
+          " "
+         ],
+         "| void setValue" : [
+          "(string str) {",
+          "\tvar m = _this.build_module_model.el;",
+          "\tfor(var i = 0; i < m.get_n_items(); i++) {",
+          "\t\tif (m.get_string(i) == str) {",
+          "\t\t\tthis.el.selected = i;",
+          "\t\t\treturn;",
+          "\t\t}",
+          "\t}",
+          "\t\t",
+          "}"
+         ]
         },
         {
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,0,9,1,1",
+         "id" : "path_lbl",
          "int colspan" : 1,
          "label" : "Full path",
          "x_options" : 4,
         {
          "$ visible" : true,
          "$ xns" : "Gtk",
-         "* pack" : "attach,1,9,1,1",
          "bool editable" : false,
          "bool hexpand" : true,
          "id" : "path",
          "int colspan" : 1,
          "xtype" : "Entry"
+        },
+        {
+         "$ justify" : "Gtk.Justification.RIGHT",
+         "$ visible" : true,
+         "$ xns" : "Gtk",
+         "id" : "gen_lbl",
+         "int colspan" : 1,
+         "label" : "Generate as Extended (experimental)",
+         "x_options" : 4,
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
+        },
+        {
+         "$ xns" : "Gtk",
+         "id" : "gen",
+         "listeners" : {
+          "toggled" : [
+           "( ) => {",
+           "\t  ",
+           "\tthis.el.label = this.el.active ? \"Extended\" : \"Wrapped\";",
+           "",
+           "}",
+           ""
+          ]
+         },
+         "string label" : "Wrapped",
+         "xtype" : "CheckButton"
         }
        ],
-       "n_columns" : 2,
-       "n_rows" : 8,
        "uint row_spacing" : 2,
        "xtype" : "Grid",
        "| void hideRow" : [
         "    }",
         "}"
        ]
+      }
+     ],
+     "xtype" : "Box"
+    },
+    {
+     "$ xns" : "Gtk",
+     "* prop" : "titlebar",
+     "bool show_title_buttons" : false,
+     "items" : [
+      {
+       "$ xns" : "Gtk",
+       "* pack" : "pack_start",
+       "listeners" : {
+        "clicked" : [
+         "() => { ",
+         "  \t_this.done = true;",
+         "    _this.el.hide(); ",
+         "}"
+        ]
+       },
+       "string label" : "Cancel",
+       "xtype" : "Button"
       },
       {
+       "$ css_classes" : "{ \"suggested-action\" }",
        "$ xns" : "Gtk",
-       "* pack" : "add",
-       "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
-       "int margin_bottom" : 4,
-       "int margin_end" : 4,
-       "int margin_start" : 4,
-       "int margin_top" : 4,
-       "items" : [
-        {
-         "$ xns" : "Gtk",
-         "* pack" : "add",
-         "bool always_show_image" : true,
-         "items" : [
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "set_image",
-           "utf8 icon_name" : "window-close",
-           "xtype" : "Image"
-          }
-         ],
-         "listeners" : {
-          "clicked" : [
-           "() => { ",
-           "",
-           "  _this.done = true;",
-           "    _this.el.hide(); ",
-           "}"
-          ]
-         },
-         "string label" : "Cancel",
-         "xtype" : "Button"
-        },
-        {
-         "$ xns" : "Gtk",
-         "* pack" : "add",
-         "bool always_show_image" : true,
-         "bool has_default" : true,
-         "id" : "save_btn",
-         "items" : [
-          {
-           "$ xns" : "Gtk",
-           "* pack" : "set_image",
-           "utf8 icon_name" : "document-save",
-           "xtype" : "Image"
-          }
-         ],
-         "listeners" : {
-          "clicked" : [
-           "( ) =>  { ",
-           "",
-           " ",
-           "",
-           "",
-           "\tif (_this.name.el.get_text().length  < 1) {",
-           "\t    Xcls_StandardErrorDialog.singleton().show(",
-           "\t        _this.mainwindow.el,",
-           "\t        \"You have to set Component name \"",
-           "\t    );",
-           "\t     ",
-           "\t    return;",
-           "\t}",
-           "\t// what does this do?",
-           "\t",
-           "\tvar isNew = _this.file.name.length  > 0 ? false : true;",
-           "\t/*",
-           "\tif (!isNew && this.file.name != _this.name.el.get_text()) {",
-           "\t    Xcls_StandardErrorDialog.singleton().show(",
-           "\t        this.el,",
-           "\t        \"Sorry changing names does not work yet. \"",
-           "\t    );",
-           "\t     ",
-           "\t    return;",
-           "\t}",
-           "\t*/",
-           "\t ",
-           "\t",
-           "  ",
-           "\t// FIXME - this may be more complicated...",
-           "\t//for (var i in this.def) {",
-           "\t//    this.file[i] =  this.get(i).el.get_text();",
-           "\t//}",
-           "",
-           "\tif (!isNew) {",
-           "\t  //  try {",
-           "\t         _this.updateFileFromEntry();",
-           "\t   //  } catch( JsRender.Error.RENAME_FILE_EXISTS er) {",
-           "\t     //     Xcls_StandardErrorDialog.singleton().show(",
-           "\t      //      _this.mainwindow.el,",
-           "\t       //     \"The name you used already exists \"",
-           "\t       // );",
-           "\t      //  return;",
-           "\t         ",
-           "\t     //}",
-           "",
-           "\t      _this.done = true;",
-           "\t    _this.file.save();",
-           "\t    _this.el.hide();",
-           "\t    return;",
-           "\t}",
-           "\t",
-           "\t// ---------------- NEW FILES...",
-           "\tGtk.TreeIter iter;",
-           "",
-           "\tif (!_this.filetype.el.get_active_iter(out iter)) {",
-           "\t\t// should not happen...",
-           "\t\t// so we are jut going to return without ",
-           "\t\tXcls_StandardErrorDialog.singleton().show(",
-           "\t        _this.mainwindow.el,",
-           "\t        \"You must select a file type. \"",
-           "\t    );",
-           "\t    return;",
-           "\t\t ",
-           "\t}",
-           "\t",
-           "\t",
-           "\tvar fn = _this.name.el.get_text();",
-           "\t",
-           "\tValue ftypename;",
-           "\t_this.ftdbmodel.el.get_value (iter, 0, out ftypename);",
-           "\tvar ext = ((string)ftypename);",
-           "\tvar dir = _this.project.firstPath(); ",
-           "\tif (ext != \"bjs\") {",
-           "\t ",
-           "\t\tif (!_this.dir.el.get_active_iter(out iter)) {",
-           "\t\t\t// should not happen...",
-           "\t\t\t// so we are jut going to return without ",
-           "\t\t\tXcls_StandardErrorDialog.singleton().show(",
-           "\t\t\t    _this.mainwindow.el,",
-           "\t\t\t    \"You must select a directory \"",
-           "\t\t\t);",
-           "\t\t\treturn;",
-           "\t\t}",
-           "\t\tValue vdir;",
-           "\t\t_this.dirmodel.el.get_value (iter, 0, out vdir);",
-           "\t\tdir = (string)vdir;",
-           "\t}",
-           "\t",
-           "\tvar targetfile = dir + \"/\" + fn;",
-           "\t",
-           "\t// strip the file type off the end..",
-           "\t",
-           "\ttry {",
-           "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
-           "\t\ttargetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
-           "\t  } catch (RegexError e) {} // ignore.",
-           "\t  ",
-           "\tif (GLib.FileUtils.test(targetfile + \".\" + ext, GLib.FileTest.EXISTS)) {",
-           "\t    Xcls_StandardErrorDialog.singleton().show(",
-           "\t        _this.mainwindow.el,",
-           "\t        \"That file already exists\"",
-           "\t    ); ",
-           "\t    return;",
-           "\t}",
-           "\tJsRender.JsRender f;",
-           "   try {",
-           "\t   f =  JsRender.JsRender.factory(",
-           "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  ",
-           "\t\t\t_this.file.project, ",
-           "\t\t\ttargetfile + \".\" + ext);",
-           "\t} catch (JsRender.Error e) {",
-           "\t\treturn;",
-           "\t}",
-           "\t_this.file = f;",
-           "\t",
-           "\t",
-           "",
-           "\t",
-           "\t_this.updateFileFromEntry();",
-           "\t_this.file.loaded = true;",
-           "\t_this.file.save();",
-           "\tif (ext == \"bjs\") {",
-           "\t\t",
-           "\t\t\t_this.file.project.addFile(_this.file);",
-           "\t\t ",
-           "\t}",
-           "\t",
-           " ",
-           "\t// what about .js ?",
-           "   _this.done = true;",
-           "\t_this.el.hide();",
-           "",
-           "// hopefull this will work with bjs files..",
-           "\t",
-           "\t_this.success(_this.project, _this.file);",
-           "   ",
-           "}"
-          ]
-         },
-         "string label" : "Save",
-         "xtype" : "Button"
-        }
-       ],
-       "xtype" : "ButtonBox"
+       "* pack" : "pack_end",
+       "bool always_show_image" : true,
+       "bool hexpand" : false,
+       "id" : "save_btn",
+       "listeners" : {
+        "clicked" : [
+         "( ) =>  { ",
+         "",
+         " ",
+         "",
+         "",
+         "\tif (_this.name.el.get_text().length  < 1) {",
+         "\t    Xcls_StandardErrorDialog.singleton().show(",
+         "\t        _this.mainwindow.el,",
+         "\t        \"You have to set a Component name \"",
+         "\t    );",
+         "\t     ",
+         "\t    return;",
+         "\t}",
+         "\t// what does this do?",
+         "\t",
+         "\tvar isNew = _this.file.name.length  > 0 ? false : true;",
+         "\t/*",
+         "\tif (!isNew && this.file.name != _this.name.el.get_text()) {",
+         "\t    Xcls_StandardErrorDialog.singleton().show(",
+         "\t        this.el,",
+         "\t        \"Sorry changing names does not work yet. \"",
+         "\t    );",
+         "\t     ",
+         "\t    return;",
+         "\t}",
+         "\t*/",
+         "\t  ",
+         "  ",
+         "\t// FIXME - this may be more complicated...",
+         "\t//for (var i in this.def) {",
+         "\t//    this.file[i] =  this.get(i).el.get_text();",
+         "\t//}",
+         "",
+         "\tif (!isNew) {",
+         "\t  //  try {",
+         "\t  ",
+         "\t  \tvar old_target = _this.file.build_module;",
+         "         _this.updateFileFromEntry();",
+         "\t    if (_this.project.xtype == \"Gtk\" && old_target != _this.file.build_module) {",
+         "\t    \tvar gp = (JsRender.Gtk)_this.file;",
+         "\t    \tgp.updateCompileGroup(old_target,  _this.file.build_module);",
+         "    \t}",
+         "",
+         "\t      _this.done = true;",
+         "\t    _this.file.save();",
+         "\t    _this.el.hide();",
+         "\t    return;",
+         "\t}",
+         "\t",
+         "\t// ---------------- NEW FILES...",
+         "\tvar ftype = _this.filetype.getValue();",
+         "",
+         "\tif (ftype == \"\") {",
+         "\t\t// should not happen...",
+         "\t\t// so we are jut going to return without ",
+         "\t\tXcls_StandardErrorDialog.singleton().show(",
+         "\t        _this.mainwindow.el,",
+         "\t        \"You must select a file type. \"",
+         "\t    );",
+         "\t    return;",
+         "\t\t ",
+         "\t}",
+         "\t",
+         "\t",
+         "\tvar fn = _this.name.el.get_text();",
+         "\t",
+         "\t ",
+         "\tvar ext = ftype;",
+         "\t//var dir = _this.project.path; ",
+         "\t ",
+         "\t var dir = _this.dir_dropdown.getValue();",
+         "\t",
+         "\t ",
+         "\t",
+         "\t ",
+         "\tvar targetfile  = _this.project.path;",
+         "\tif (dir != \"\") {",
+         "\t\ttargetfile += dir;",
+         "\t}",
+         "\ttargetfile += \"/\" + fn;",
+         "\t",
+         "\t// strip the file type off the end..",
+         "\t",
+         "\ttry {",
+         "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
+         "\t\tfn = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
+         "\t  } catch (RegexError e) {} // ignore.",
+         "\t  ",
+         "\t  targetfile += \".\" + ext;",
+         "\t  ",
+         "\t  ",
+         "\tif (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
+         "\t    Xcls_StandardErrorDialog.singleton().show(",
+         "\t        _this.mainwindow.el,",
+         "\t        \"That file already exists\"",
+         "\t    ); ",
+         "\t    return;",
+         "\t}",
+         "\tJsRender.JsRender f;",
+         "   try {",
+         "\t   f =  JsRender.JsRender.factory(",
+         "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  ",
+         "\t\t\t_this.file.project, ",
+         "\t\t\ttargetfile);",
+         "\t} catch (JsRender.Error e) {",
+         "\t\tXcls_StandardErrorDialog.singleton().show(",
+         "\t        _this.mainwindow.el,",
+         "\t        \"Error creating file\"",
+         "\t    ); ",
+         "\t\treturn;",
+         "\t}",
+         "\t_this.file = f;",
+         "\t",
+         "\t",
+         "",
+         "\t",
+         "\t_this.updateFileFromEntry();",
+         "\t_this.file.loaded = true;",
+         "\t_this.file.save();",
+         "     _this.file.project.addFile(_this.file);",
+         "\t\t ",
+         "\t ",
+         " ",
+         "\t// what about .js ?",
+         "   _this.done = true;",
+         "\t_this.el.hide();",
+         "",
+         "// hopefull this will work with bjs files..",
+         "\t",
+         "\t_this.success(_this.project, _this.file);",
+         "   ",
+         "}"
+        ]
+       },
+       "string icon_name" : "document-save",
+       "string label" : "Save",
+       "xtype" : "Button"
       }
      ],
-     "xtype" : "Box"
+     "title" : "Add / Edit File",
+     "xtype" : "HeaderBar"
     }
    ],
    "listeners" : {
-    "closed" : [
-     "() => {",
-     "  if (!this.done) {",
-     "    _this.el.show();",
-     "  ",
-     "  }",
-     "} "
-    ],
-    "hide" : [
+    "close_request" : [
      "( ) => {",
-     "",
-     " if (!this.done) {",
-     "    _this.el.show();",
-     "  ",
-     "  }",
+     "\t_this.el.hide();",
+     "\treturn true;",
      "}",
      ""
     ]
    },
+   "string title" : "Add / Edit File",
    "uint border_width" : 0,
-   "xtype" : "Popover",
+   "xtype" : "Window",
    "| void show" : [
-    "(JsRender.JsRender c, Gtk.Widget btn, bool new_window) ",
+    "(JsRender.JsRender c, Gtk.Window pwin, bool new_window) ",
     "{",
+    "    ",
     "    this.project = c.project;",
     "    this.done = false;",
     "    this.new_window = new_window;",
     "    ",
     "    //if (!this.el) {",
     "        //this.init();",
-    "     //}",
-    "    _this.path.el.set_text(c.path);",
+    "     //} ",
+    "     ",
+    "     ",
+    "",
     "    _this.name.el.set_text(c.name);",
     "    _this.title.el.set_text(c.title);",
     "    _this.parent.el.set_text(c.parent);    ",
     "    _this.region.el.set_text(c.region);",
     "    _this.modOrder.el.set_text(c.modOrder);",
     "    _this.permname.el.set_text(c.permname);",
+    " ",
+    "   _this.gen.el.active = c.gen_extended;",
+    "   ",
+    "\t_this.path_lbl.el.show();",
+    "    _this.path.el.show();",
+    "    _this.dir_dropdown_lbl.el.hide();",
+    "    _this.dir_dropdown.el.hide();",
+    "    if (c.name == \"\") {",
+    "    \t_this.path_lbl.el.hide();",
+    "\t    _this.path.el.hide();",
+    "\t    this.filetype_model.load();",
+    "        _this.dir_dropdown_lbl.el.show();",
+    "\t    _this.dir_dropdown.el.show();",
+    "\t    ",
+    "    }   else {",
+    "        _this.path.el.set_text(c.relpath);",
+    "    }",
     "    ",
     "    ",
-    "    ",
-    "    ",
-    "    ",
-    "    ",
-    "    ",
-    "    ",
-    "     var ar = new Gee.ArrayList<string>();",
-    "     _this.dbmodel.loadData(ar,\"\");",
-    "    // load the modules... if relivant..",
     "    if (this.project.xtype == \"Gtk\") {",
-    "        var p = (Project.Gtk)c.project;",
-    "          var cg = p.compilegroups;",
-    "",
-    "        var iter = cg.map_iterator();",
-    "       while(iter.next()) {",
-    "            var key = iter.get_key();",
-    "            if (key == \"_default_\") {",
-    "                continue;",
-    "            }",
-    "            ar.add(key);",
-    "        };",
-    "        _this.dbmodel.loadData(ar, c.build_module);",
-    "",
+    "    \tvar p = (Project.Gtk) this.project;",
+    "\t    this.build_module_model.load(p.compilegroups);",
+    "\t    // it will select first if available...",
+    "\t    // only for new files.",
+    "\t    if (c.name != \"\") {",
+    "\t\t    this.build_module.setValue(c.build_module);",
+    "\t    }",
     "    }",
-    "    ",
+    "\t     ",
     "     ",
     "    _this.file = c;",
-    "    //console.log('show all');",
-    "   this.el.set_modal(true);",
-    "    this.el.set_relative_to(btn);",
-    "",
-    "    this.el.set_position(Gtk.PositionType.TOP);",
-    "",
-    "     int w,h;",
-    "    this.mainwindow.el.get_size(out w, out h);",
-    "    this.el.set_size_request( 550, 100); // should expand height, but give  a min width.",
-    "",
     "   ",
+    "   // this.el.set_size_request( 550, 100); // should expand height, but give  a min width.",
+    "",
+    "    this.el.set_transient_for(pwin);",
     "    ",
     "    // window + header?",
     "     print(\"SHOWALL - POPIP\\n\");",
-    "    this.el.show_all();",
+    "    this.el.show();",
     "    this.name.el.grab_focus();",
     "    ",
-    "    ",
+    "    _this.project.loadDirsToStringList(this.dir_model.el);",
     "    ",
     "    if (c.path.length > 0) {",
     "\t    this.save_btn.el.set_label(\"Save\");",
+    "\t\t_this.filetype_lbl.el.hide();",
     "\t\t_this.filetype.el.hide();",
-    "\t\t_this.filetypelbl.el.hide();",
-    "\t\t_this.filetype.showhide(true); // as we only work on bjs files currently",
+    "\t\t_this.filetype.showhide(); // as we only work on bjs files currently",
     "    } else {",
     "        this.save_btn.el.set_label(\"Create\");",
-    "        _this.ftdbmodel.loadData(\"bjs\"); // fixme - need to determine type..",
     "\t    _this.filetype.el.show();",
-    "\t    _this.filetypelbl.el.show();",
+    "\t    _this.filetype_lbl.el.show();",
+    "\t    _this.filetype.showhide();",
     "    }",
     "    ",
     "    ",
     "        _this.file.parent = _this.parent.el.get_text();                        ",
     "        _this.file.permname = _this.permname.el.get_text();                                    ",
     "        _this.file.modOrder = _this.modOrder.el.get_text();",
-    "        ",
-    "        if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {",
+    "        _this.file.gen_extended = _this.gen.el.active;",
+    "        var new_name =  _this.name.el.get_text();",
+    "        if (_this.file.name.length  > 0 && _this.file.name != new_name) {",
     "            try {",
-    "            \t_this.file.renameTo(_this.name.el.get_text());",
+    "            \t_this.file.renameTo( new_name );",
     "        \t} catch (JsRender.Error e) { } // do nothing?",
     "        }",
-    "        // store the module...",
-    "        _this.file.build_module = \"\";        ",
-    "         Gtk.TreeIter iter; ",
-    "        if (_this.build_module.el.get_active_iter (out iter)) {",
-    "             Value vfname;",
-    "             this.dbmodel.el.get_value (iter, 0, out vfname);",
-    "             if (((string)vfname).length > 0) {",
-    "                 _this.file.build_module = (string)vfname;",
-    "             }",
-    "    ",
-    "        }",
+    "        ",
+    "        _this.file.build_module = _this.build_module.getValue();",
+    "        ",
     "        ",
     "        ",
     "",
    ]
   }
  ],
- "modOrder" : "",
- "name" : "PopoverFileDetails",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverFileDetails.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "PopoverFileDetails"
 }
\ No newline at end of file