Fix #6429 - support bootstrap4 in editor
authorAlan Knowles <alan@roojs.com>
Wed, 16 Sep 2020 09:05:23 +0000 (17:05 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 16 Sep 2020 09:05:23 +0000 (17:05 +0800)
src/Builder4/RooProjectSettings.bjs
src/Builder4/RooProjectSettings.vala
src/Resources.vala

index 5a3b6ab..a2d6459 100644 (file)
        "items" : [
         {
          "id" : "label_global",
-         "* pack" : false,
          "xtype" : "Label",
+         "* pack" : false,
          "$ xns" : "Gtk",
          "utf8 label" : "Global"
         },
         {
          "id" : "label_database",
-         "xtype" : "Label",
          "* pack" : false,
+         "xtype" : "Label",
          "$ xns" : "Gtk",
          "utf8 label" : "Database"
         },
@@ -84,8 +84,8 @@
             },
             {
              "label" : "HTML template file",
-             "xtype" : "Label",
              "* pack" : "attach,0,1,1,1",
+             "xtype" : "Label",
              "gint margin" : 3,
              "$ xns" : "Gtk"
             },
               "changed" : "() => {\n\tGtk.TreeIter iter;\n \n\t// this get's called when we are filling in the data... ???\n\tif (this.loading) {\n\t\treturn;\n\t}\n\t\n \n\tif (this.el.get_active_iter(out iter)) {\n\t\tValue vfname;\n\t\t_this.base_template_model.el.get_value (iter, 0, out vfname);\n\t\t_this.project.base_template = ((string)vfname) ;\n\t\t\n\t\t print(\"\\nSET base template to %s\\n\", _this.project.base_template );\n\t\t// is_bjs = ((string)vfname) == \"bjs\";\n\t}\n    \n  \n    // directory is only available for non-bjs \n \n\n\n}\n"
              },
              "id" : "base_template",
-             "* init" : "this.el.add_attribute(_this.base_template_cellrenderer.el , \"markup\", 0 );",
              "bool loading" : false,
+             "* init" : "this.el.add_attribute(_this.base_template_cellrenderer.el , \"markup\", 0 );",
              "* pack" : "attach,1,1,1,1",
              "xtype" : "ComboBox",
              "$ xns" : "Gtk",
              "items" : [
               {
                "id" : "base_template_cellrenderer",
-               "* pack" : "pack_start,true",
                "xtype" : "CellRendererText",
+               "* pack" : "pack_start,true",
                "$ xns" : "Gtk"
               },
               {
                "id" : "base_template_model",
-               "* pack" : "set_model",
                "xtype" : "ListStore",
+               "* pack" : "set_model",
                "$ columns" : "typeof(string)",
                "n_columns" : 1,
                "$ xns" : "Gtk",
-               "| void loadData" : "  () {\n\t_this.base_template.loading = true;\n  \n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n   /// el.append(out iter);\n    \n   \n    el.append(out iter);\n    el.set_value(iter, 0, \"roo.builder.html\");\n    _this.base_template.el.set_active_iter(iter);\n\tif (_this.project.base_template == \"roo.builder.html\") {\n\t   _this.base_template.el.set_active_iter(iter);\n    }\n\n    el.append(out iter);\n    el.set_value(iter, 0, \"bootstrap.builder.html\");\n \n\tprint(\"\\ncur template = %s\\n\", _this.project.base_template);\n \n    if (_this.project.base_template == \"bootstrap.builder.html\") {\n\t   _this.base_template.el.set_active_iter(iter);\n    }\n\n\tel.append(out iter);\n    el.set_value(iter, 0, \"mailer.builder.html\");\n\n\tif (_this.project.base_template == \"mailer.builder.html\") {\n\t    _this.base_template.el.set_active_iter(iter);\n    }\n\t_this.base_template.loading = false;\n                                     \n}\n"
+               "| void loadData" : "  () {\n\t_this.base_template.loading = true;\n  \n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n   /// el.append(out iter);\n    \n   \n    el.append(out iter);\n    el.set_value(iter, 0, \"roo.builder.html\");\n    _this.base_template.el.set_active_iter(iter);\n\tif (_this.project.base_template == \"roo.builder.html\") {\n\t   _this.base_template.el.set_active_iter(iter);\n    }\n\n    el.append(out iter);\n    el.set_value(iter, 0, \"bootstrap.builder.html\");\n  \n\tprint(\"\\ncur template = %s\\n\", _this.project.base_template);\n \n    if (_this.project.base_template == \"bootstrap.builder.html\") {\n\t   _this.base_template.el.set_active_iter(iter);\n    }\n\t  el.append(out iter);\n    el.set_value(iter, 0, \"bootstrap4.builder.html\");\n     if (_this.project.base_template == \"bootstrap4.builder.html\") {\n\t   _this.base_template.el.set_active_iter(iter);\n    }\n    \n\n\tel.append(out iter);\n    el.set_value(iter, 0, \"mailer.builder.html\");\n\n\tif (_this.project.base_template == \"mailer.builder.html\") {\n\t    _this.base_template.el.set_active_iter(iter);\n    }\n\t_this.base_template.loading = false;\n                                     \n}\n"
               }
              ]
             },
             {
              "label" : "root URL",
-             "xtype" : "Label",
              "* pack" : "attach,0,2,1,1",
+             "xtype" : "Label",
              "gint margin" : 3,
              "$ xns" : "Gtk"
             },
             {
              "id" : "rootURL",
-             "xtype" : "Entry",
              "* pack" : "attach,1,2,1,1",
+             "xtype" : "Entry",
              "$ xns" : "Gtk"
             },
             {
              "label" : "Generate HTML in",
-             "* pack" : "attach,0,3,1,1",
              "xtype" : "Label",
+             "* pack" : "attach,0,3,1,1",
              "gint margin" : 3,
              "$ xns" : "Gtk"
             },
              "items" : [
               {
                "id" : "html_gen_cellrenderer",
-               "xtype" : "CellRendererText",
                "* pack" : "pack_start,true",
+               "xtype" : "CellRendererText",
                "$ xns" : "Gtk"
               },
               {
                "id" : "html_gen_model",
-               "xtype" : "ListStore",
                "* pack" : "set_model",
+               "xtype" : "ListStore",
                "$ columns" : "typeof(string),typeof(string)",
                "n_columns" : 2,
                "$ xns" : "Gtk",
           },
           {
            "label" : "HTML To insert at end of <HEAD>",
-           "xtype" : "Label",
            "* pack" : "pack_start,false,false,0",
+           "xtype" : "Label",
            "$ xns" : "Gtk"
           },
           {
             "key_press_event" : "(ev) => {\n\n    if (ev.keyval == Gdk.Key.Tab) {\n        _this.database_DBNAME.el.grab_focus();\n        return true;\n    }\n\n\n    return false;\n}\n"
            },
            "id" : "database_DBTYPE",
-           "xtype" : "Entry",
            "* pack" : "pack_start,false,false,0",
+           "xtype" : "Entry",
            "$ xns" : "Gtk"
           },
           {
             "key_press_event" : "(ev) => {\n\n    if (ev.keyval == Gdk.Key.Tab) {\n        _this.database_DBUSERNAME.el.grab_focus();\n        return true;\n    }\n\n\n    return false;\n}\n"
            },
            "id" : "database_DBNAME",
-           "* pack" : "pack_start,false,false,0",
            "xtype" : "Entry",
+           "* pack" : "pack_start,false,false,0",
            "$ xns" : "Gtk"
           },
           {
             "key_press_event" : "(ev) => {\n\n    if (ev.keyval == Gdk.Key.Tab) {\n        _this.database_DBPASSWORD.el.grab_focus();\n        return true;\n    }\n\n\n    return false;\n}\n"
            },
            "id" : "database_DBUSERNAME",
-           "xtype" : "Entry",
            "* pack" : "pack_start,false,false,0",
+           "xtype" : "Entry",
            "$ xns" : "Gtk"
           },
           {
           },
           {
            "id" : "database_DBPASSWORD",
-           "* pack" : "pack_start,false,false,0",
            "xtype" : "Entry",
+           "* pack" : "pack_start,false,false,0",
            "$ xns" : "Gtk"
           },
           {
           "button_press_event" : "() => {\n    _this.save();\n          \n    _this.buttonPressed(\"apply\");\n        return false;\n}"
          },
          "label" : "Apply",
-         "xtype" : "Button",
          "* pack" : "add",
+         "xtype" : "Button",
          "$ xns" : "Gtk"
         },
         {
           "button_press_event" : "() => {\n       _this.save();\n          \n    _this.buttonPressed(\"save\");\n        return false;\n}"
          },
          "label" : "Save",
-         "xtype" : "Button",
          "* pack" : "add",
+         "xtype" : "Button",
          "$ xns" : "Gtk"
         }
        ]
index a569b36..e3faf8b 100644 (file)
@@ -510,12 +510,18 @@ public class Xcls_RooProjectSettings : Object
         
             el.append(out iter);
             el.set_value(iter, 0, "bootstrap.builder.html");
-         
+          
                print("\ncur template = %s\n", _this.project.base_template);
          
             if (_this.project.base_template == "bootstrap.builder.html") {
                   _this.base_template.el.set_active_iter(iter);
             }
+                 el.append(out iter);
+            el.set_value(iter, 0, "bootstrap4.builder.html");
+             if (_this.project.base_template == "bootstrap4.builder.html") {
+                  _this.base_template.el.set_active_iter(iter);
+            }
+            
         
                el.append(out iter);
             el.set_value(iter, 0, "mailer.builder.html");
index 0f5644d..1d8ea32 100644 (file)
@@ -161,6 +161,7 @@ public class Resources : Object
                // this has to check the required files, not the list...
                string[] required =  {
                        "bootstrap.builder.html",
+                       "bootstrap4.builder.html",
                        "Gir.overides",
                        "GtkUsage.txt",
                        "mailer.builder.html",