Fix #7370 - project properties
authorAlan <alan@roojs.com>
Wed, 31 Aug 2022 09:18:33 +0000 (17:18 +0800)
committerAlan <alan@roojs.com>
Wed, 31 Aug 2022 09:18:33 +0000 (17:18 +0800)
src/Builder4/About.bjs
src/Builder4/About.vala
src/Builder4/PopoverFileDetails.bjs
src/Builder4/PopoverFileDetails.vala

index 4387ba5..b5094c8 100644 (file)
@@ -15,7 +15,7 @@
    "program_name" : "roobuilder",
    "string copyright" : "LGPL",
    "string license" : "LGPL",
-   "string version" : "4.4.0",
+   "string version" : "4.4.1",
    "website" : "https://github.com/roojs/roobuilder",
    "xtype" : "AboutDialog",
    "| void show" : [
index 14289eb..17c398f 100644 (file)
@@ -27,7 +27,7 @@ public class About : Object
         this.el.program_name = "roobuilder";
         this.el.license = "LGPL";
         this.el.authors = { "Alan Knowles" };
-        this.el.version = "4.4.0";
+        this.el.version = "4.4.1";
         this.el.website = "https://github.com/roojs/roobuilder";
         this.el.modal = true;
         this.el.copyright = "LGPL";
index 3755ed2..a69864b 100644 (file)
@@ -18,6 +18,7 @@
      "$ xns" : "Gtk",
      "* pack" : "add",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+     "bool hexpand" : true,
      "bool homogeneous" : false,
      "items" : [
       {
@@ -27,9 +28,9 @@
        "xtype" : "HeaderBar"
       },
       {
-       "$ homogeneous" : true,
        "$ xns" : "Gtk",
        "* pack" : "pack_start,false,false,4",
+       "bool hexpand" : true,
        "id" : "grid",
        "int margin_left" : 4,
        "int margin_right" : 4,
@@ -48,6 +49,7 @@
          "$ xns" : "Gtk",
          "* init" : "this.el.add_attribute(_this.ftdbcellrenderer.el , \"markup\", 1 );",
          "* pack" : "attach,1,0,1,1",
+         "bool hexpand" : true,
          "id" : "filetype",
          "items" : [
           {
           "(bool is_bjs) {",
           "",
           "",
-          "\tif (_this.project.xtype != \"Roo\") {",
-          "\t \tis_bjs = false;",
-          " \t}",
+          "\t ",
+          "\t_this.grid.showAllRows();",
           "",
-          "\tfor (var i = 2; i < 9;i++) {",
-          "\t\tvar el = _this.grid.el.get_child_at(0,i);",
-          "\t\t",
-          "\t\tvar showhide= is_bjs;",
-          "\t\tif (i> 7) {",
-          "\t\t\tshowhide = !showhide;",
-          "\t\t}",
-          "\t\t",
-          "\t\tif (showhide) {",
-          "\t\t   el.show();",
-          "\t\t} else {",
-          "\t\t\tel.hide();",
-          "\t\t}",
-          "\t\t el = _this.grid.el.get_child_at(1,i);",
-          "\t\tif (showhide) {",
-          "\t\t   el.show();",
-          "\t\t} else {",
-          "\t\t\tel.hide();",
-          "\t\t}     ",
-          "    }",
+          "\tswitch(_this.project.xtype) {",
+          "\t\tcase \"Roo\":",
+          "\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\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\tbreak;",
+          "\t}",
+          " ",
           "    // load up the directories",
           "    //??? why can we not create bjs files in other directories??",
           "\t//if (!is_bjs && _this.file.path.length < 1) {",
          "$ visible" : true,
          "$ xns" : "Gtk",
          "* pack" : "attach,1,1,1,1",
+         "bool hexpand" : true,
          "id" : "name",
          "xtype" : "Entry"
         },
          "$ visible" : true,
          "$ xns" : "Gtk",
          "* pack" : "attach,1,2,1,1",
+         "bool hexpand" : true,
          "id" : "title",
          "xtype" : "Entry"
         },
          "$ visible" : true,
          "$ xns" : "Gtk",
          "* pack" : "attach,1,3,1,1",
+         "bool hexpand" : true,
          "id" : "region",
          "xtype" : "Entry"
         },
          "$ visible" : true,
          "$ xns" : "Gtk",
          "* pack" : "attach,0,7,1,1",
-         "label" : "Module to build (Vala only)",
+         "label" : "Module to build",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
          "xtype" : "Label"
          "$ xns" : "Gtk",
          "* pack" : "attach,1,9,1,1",
          "bool editable" : false,
+         "bool hexpand" : true,
          "id" : "path",
          "int colspan" : 1,
          "xtype" : "Entry"
        "n_columns" : 2,
        "n_rows" : 8,
        "uint row_spacing" : 2,
-       "xtype" : "Grid"
+       "xtype" : "Grid",
+       "| void hideRow" : [
+        "(int row) ",
+        "{",
+        "\tvar el = _this.grid.el.get_child_at(0,row);",
+        "",
+        "\tel.hide();",
+        "\tel = _this.grid.el.get_child_at(1,row);",
+        "\tel.hide();",
+        "",
+        "}"
+       ],
+       "| void showAllRows" : [
+        "() {",
+        "\tfor (var i = 2; i < 10;i++) {",
+        "\t\tvar el = _this.grid.el.get_child_at(0,i);",
+        "\t\tel.show();",
+        "\t\tel = _this.grid.el.get_child_at(1,i);",
+        "\t\tel.show();",
+        "    }",
+        "}"
+       ]
       },
       {
        "$ xns" : "Gtk",
         {
          "$ xns" : "Gtk",
          "* pack" : "add",
+         "bool always_show_image" : true,
+         "items" : [
+          {
+           "$ xns" : "Gtk",
+           "* pack" : "set_image",
+           "utf8 icon_name" : "window-close",
+           "xtype" : "Image"
+          }
+         ],
          "listeners" : {
           "clicked" : [
            "() => { ",
         {
          "$ 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" : [
            "( ) =>  { ",
     "",
     "     int w,h;",
     "    this.mainwindow.el.get_size(out w, out h);",
-    "    this.el.set_size_request( 550, h);",
+    "    this.el.set_size_request( 550, 100); // should expand height, but give  a min width.",
     "",
     "   ",
     "    ",
index 7b808dc..d5b0d13 100644 (file)
@@ -130,7 +130,7 @@ public class Xcls_PopoverFileDetails : Object
     
          int w,h;
         this.mainwindow.el.get_size(out w, out h);
-        this.el.set_size_request( 550, h);
+        this.el.set_size_request( 550, 100); // should expand height, but give  a min width.
     
        
         
@@ -203,6 +203,7 @@ public class Xcls_PopoverFileDetails : Object
 
             // set gobject values
             this.el.homogeneous = false;
+            this.el.hexpand = true;
             var child_0 = new Xcls_HeaderBar3( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , false,true,0 );
@@ -259,6 +260,7 @@ public class Xcls_PopoverFileDetails : Object
             // set gobject values
             this.el.margin_right = 4;
             this.el.margin_left = 4;
+            this.el.hexpand = true;
             this.el.row_spacing = 2;
             var child_0 = new Xcls_filetypelbl( _this );
             child_0.ref();
@@ -323,6 +325,23 @@ public class Xcls_PopoverFileDetails : Object
         }
 
         // user defined functions
+        public void showAllRows () {
+               for (var i = 2; i < 10;i++) {
+                       var el = _this.grid.el.get_child_at(0,i);
+                       el.show();
+                       el = _this.grid.el.get_child_at(1,i);
+                       el.show();
+            }
+        }
+        public void hideRow (int row) 
+        {
+               var el = _this.grid.el.get_child_at(0,row);
+        
+               el.hide();
+               el = _this.grid.el.get_child_at(1,row);
+               el.hide();
+        
+        }
     }
     public class Xcls_filetypelbl : Object
     {
@@ -367,6 +386,7 @@ public class Xcls_PopoverFileDetails : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.hexpand = true;
             var child_0 = new Xcls_ftdbcellrenderer( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , true );
@@ -400,30 +420,33 @@ public class Xcls_PopoverFileDetails : Object
         public void showhide (bool is_bjs) {
         
         
-               if (_this.project.xtype != "Roo") {
-                       is_bjs = false;
-               }
+                
+               _this.grid.showAllRows();
         
-               for (var i = 2; i < 9;i++) {
-                       var el = _this.grid.el.get_child_at(0,i);
-                       
-                       var showhide= is_bjs;
-                       if (i> 7) {
-                               showhide = !showhide;
-                       }
-                       
-                       if (showhide) {
-                          el.show();
-                       } else {
-                               el.hide();
-                       }
-                        el = _this.grid.el.get_child_at(1,i);
-                       if (showhide) {
-                          el.show();
-                       } else {
-                               el.hide();
-                       }     
-            }
+               switch(_this.project.xtype) {
+                       case "Roo":
+                               
+                               _this.grid.hideRow(7);
+                               _this.grid.hideRow(8);                  
+                               // hide: vala: module
+                               // row 7
+                               // row 8 (directory)
+                               
+                               break;
+                       default: // vala..
+                               _this.grid.hideRow(2);
+                               _this.grid.hideRow(3);  
+                               _this.grid.hideRow(4);
+                               _this.grid.hideRow(5);  
+                               _this.grid.hideRow(6);  
+                           // hide 2,3,4,5,6,
+                           if (_this.file.name.length > 0) {
+                               _this.grid.hideRow(8); // directory - cant change it here..
+                       }
+                           
+                               break;
+               }
+         
             // load up the directories
             //??? why can we not create bjs files in other directories??
                //if (!is_bjs && _this.file.path.length < 1) {
@@ -572,6 +595,7 @@ public class Xcls_PopoverFileDetails : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.hexpand = true;
             this.el.visible = true;
         }
 
@@ -621,6 +645,7 @@ public class Xcls_PopoverFileDetails : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.hexpand = true;
             this.el.visible = true;
         }
 
@@ -671,6 +696,7 @@ public class Xcls_PopoverFileDetails : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.hexpand = true;
             this.el.visible = true;
         }
 
@@ -836,7 +862,7 @@ public class Xcls_PopoverFileDetails : Object
         public Xcls_Label21(Xcls_PopoverFileDetails _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Label( "Module to build (Vala only)" );
+            this.el = new Gtk.Label( "Module to build" );
 
             // my vars (dec)
 
@@ -1157,6 +1183,7 @@ public class Xcls_PopoverFileDetails : Object
 
             // set gobject values
             this.el.editable = false;
+            this.el.hexpand = true;
             this.el.visible = true;
         }
 
@@ -1212,7 +1239,11 @@ public class Xcls_PopoverFileDetails : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.always_show_image = true;
             this.el.label = "Cancel";
+            var child_0 = new Xcls_Image33( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
 
             //listeners
             this.el.clicked.connect( () => { 
@@ -1224,6 +1255,29 @@ public class Xcls_PopoverFileDetails : Object
 
         // user defined functions
     }
+    public class Xcls_Image33 : Object
+    {
+        public Gtk.Image el;
+        private Xcls_PopoverFileDetails  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Image33(Xcls_PopoverFileDetails _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "window-close";
+        }
+
+        // user defined functions
+    }
+
 
     public class Xcls_save_btn : Object
     {
@@ -1243,7 +1297,12 @@ public class Xcls_PopoverFileDetails : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.has_default = true;
+            this.el.always_show_image = true;
             this.el.label = "Save";
+            var child_0 = new Xcls_Image35( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
 
             //listeners
             this.el.clicked.connect( ( ) =>  { 
@@ -1381,6 +1440,29 @@ public class Xcls_PopoverFileDetails : Object
 
         // user defined functions
     }
+    public class Xcls_Image35 : Object
+    {
+        public Gtk.Image el;
+        private Xcls_PopoverFileDetails  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Image35(Xcls_PopoverFileDetails _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "document-save";
+        }
+
+        // user defined functions
+    }
+