Force word characters for compile targets
[roobuilder] / src / Builder4 / ValaProjectSettingsPopover.bjs
index d6e4632..8cd541d 100644 (file)
                      "    expand.set_hide_expander(  jr.childfiles.n_items < 1);",
                      " \texpand.set_list_row(lr);",
                      " ",
-                     "   expand.set_hide_expander(  jr.xtype != \"Dir\" );",
+                     "  \texpand.set_hide_expander(  jr.xtype != \"Dir\" );",
                      " \t expand.set_list_row(lr);",
                      " ",
                      " \t// bind image...",
                      "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
                      "",
                      "\t//btn.active = jr.compile_group_selected;",
-                     "\t ",
-                     " \tjr.bind_property(\"compile_group_selected\",",
-                     "                    btn, \"active\",",
-                     "                   GLib.BindingFlags.BIDIRECTIONAL); ",
+                     "\tbtn.active = _this.selected_target.has_file(jr);",
+                     "\t",
+                     " \t//jr.bind_property(\"compile_group_selected\",",
+                     "    //                btn, \"active\",",
+                     "    //               GLib.BindingFlags.BIDIRECTIONAL); ",
                      " \t// bind image...",
                      " \t",
                      "}"
                     ],
                     "setup" : [
-                     "",
                      "(listitem) => {",
                      "",
                      "\tvar btn = new Gtk.CheckButton();",
                "xtype" : "Label"
               },
               {
+               "# bool in_insert" : false,
                "$ xns" : "Gtk",
+               "* init" : [
+                "",
+                "var ed = (this.el.get_delegate() as Gtk.Editable);",
+                "if (ed != null) {",
+                "\ted.insert_text.connect((text, length, ref position) => {",
+                "\t\tif (this.in_insert) {",
+                "\t\t\treturn;",
+                "\t\t}",
+                "\t\tGLib.debug(\"got insert text %s\", text);",
+                "\t\t",
+                "\t\tvar nt = \"\";",
+                "\t\tfor(var i = 0;i < text.length; i++){ ",
+                "\t\t\tif (Posix.isupper(text[i]) ||Posix.islower(text[i])  ) {",
+                "\t\t\t\tnt +=  text[i].to_string();",
+                "\t\t\t}\t",
+                "\t\t}",
+                "\t\tif (nt.length < 1) {",
+                "\t\t\tGLib.Signal.stop_emission_by_name(ed, \"insert_text\");",
+                "\t\t\treturn;",
+                "\t\t}",
+                "",
+                "\t\tthis.in_insert = true;",
+                "\t ",
+                "\t\tthis.el.insert_text(nt,nt.length, ref position);",
+                "\t\tthis.in_insert = false;",
+                "\t\tGLib.Signal.stop_emission_by_name(ed, \"insert_text\");",
+                "\t});",
+                "",
+                "}"
+               ],
                "id" : "build_name",
                "listeners" : {
                 "changed" : [
                  "",
                  "\t_this.selected_target.name = this.el.buffer.text;",
                  "}"
+                ],
+                "insert_text" : [
+                 "(text, length, ref position) => {",
+                 "\tif (this.in_insert) {",
+                 "\t\treturn;",
+                 "\t}",
+                 "\tGLib.debug(\"got insert text %s\", text);",
+                 "\t",
+                 "\tvar nt = \"\";",
+                 "\tfor(var i = 0;i < text.length; i++){ ",
+                 "\t\tif (Posix.isalpha(text[i])) {",
+                 "\t\t\tnt +=  text[i].to_string();",
+                 "\t\t}\t",
+                 "\t}",
+                 "\tif (nt.length < 1) {",
+                 "\t\treturn;",
+                 "\t}",
+                 "",
+                 "\tthis.in_insert = true;",
+                 " ",
+                 "\tthis.el.insert_text(text,length, ref position);",
+                 "\tthis.in_insert = false;",
+                 "}",
+                 ""
                 ]
                },
                "xtype" : "Entry"
      "\t\treturn true;",
      "\t}",
      "\treturn false;",
+     "\t",
      "}",
      ""
     ],
      "() => {",
      "\t  if (!this.done) {",
      "    _this.el.show();",
-     "  ",
      "  }",
      "}"
     ]