X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=src%2FBuilder4%2FPopoverFileDetails.bjs;h=a9bcb765fb36e0554c89f1468d40da28dc8bdf49;hb=3ebe55bb39f2089ca4b72871c485718daa7234c4;hp=85a67074159bec14dfd236118ff215540337cb68;hpb=03bf0f74c2232e59d8149c55a05e0a369ed32171;p=roobuilder diff --git a/src/Builder4/PopoverFileDetails.bjs b/src/Builder4/PopoverFileDetails.bjs index 85a670741..a9bcb765f 100644 --- a/src/Builder4/PopoverFileDetails.bjs +++ b/src/Builder4/PopoverFileDetails.bjs @@ -12,8 +12,8 @@ "closed" : "() => {\n if (!this.done) {\n _this.el.show();\n \n }\n} " }, "| void updateFileFromEntry" : "() {\n\n _this.file.title = _this.title.el.get_text();\n _this.file.region = _this.region.el.get_text(); \n _this.file.parent = _this.parent.el.get_text(); \n _this.file.permname = _this.permname.el.get_text(); \n _this.file.modOrder = _this.modOrder.el.get_text();\n \n if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {\n _this.file.renameTo(_this.name.el.get_text());\n }\n // store the module...\n _this.file.build_module = \"\"; \n Gtk.TreeIter iter; \n if (_this.build_module.el.get_active_iter (out iter)) {\n Value vfname;\n this.dbmodel.el.get_value (iter, 0, out vfname);\n if (((string)vfname).length > 0) {\n _this.file.build_module = (string)vfname;\n }\n \n }\n \n \n\n \n} ", - "@ void success" : "(Project.Project pr, JsRender.JsRender file)", "id" : "PopoverFileDetails", + "@ void success" : "(Project.Project pr, JsRender.JsRender file)", "| void show" : "(JsRender.JsRender c, Gtk.Widget btn) \n{\n this.project = c.project;\n this.done = false;\n \n \n //if (!this.el) {\n //this.init();\n //}\n \n _this.name.el.set_text(c.name);\n _this.title.el.set_text(c.title);\n _this.parent.el.set_text(c.parent); \n _this.region.el.set_text(c.region);\n _this.modOrder.el.set_text(c.modOrder);\n _this.permname.el.set_text(c.permname);\n \n \n \n \n \n \n \n \n var ar = new Gee.ArrayList();\n _this.dbmodel.loadData(ar,\"\");\n // load the modules... if relivant..\n if (this.project.xtype == \"Gtk\") {\n var p = (Project.Gtk)c.project;\n var cg = p.compilegroups;\n\n var iter = cg.map_iterator();\n while(iter.next()) {\n var key = iter.get_key();\n if (key == \"_default_\") {\n continue;\n }\n ar.add(key);\n };\n _this.dbmodel.loadData(ar, c.build_module);\n\n }\n \n \n _this.file = c;\n //console.log('show all');\n this.el.set_modal(true);\n this.el.set_relative_to(btn);\n\n this.el.set_position(Gtk.PositionType.RIGHT);\n \n // window + header?\n print(\"SHOWALL - POPIP\\n\");\n this.el.show_all();\n this.name.el.grab_focus();\n \n \n \n if (c.path.length > 0) {\n\t this.save_btn.el.set_label(\"Save\");\n\t\t_this.filetype.el.hide();\n\t\t_this.filetypelbl.el.hide();\n\t\t_this.filetype.showhide(true); // as we only work on bjs files currently\n } else {\n this.save_btn.el.set_label(\"Create\");\n _this.ftdbmodel.loadData(\"bjs\"); // fixme - need to determine type..\n\t _this.filetype.el.show();\n\t _this.filetypelbl.el.show();\n }\n \n \n //this.success = c.success;\n \n \n}", "bool done" : false, "# Project.Project project" : "", @@ -27,8 +27,8 @@ "items" : [ { "bool homogeneous" : false, - "xtype" : "Box", "$ pack" : "add", + "xtype" : "Box", "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "items" : [ @@ -68,19 +68,19 @@ "* init" : "this.el.add_attribute(_this.ftdbcellrenderer.el , \"markup\", 1 );", "* pack" : "attach,1,0,1,1", "xtype" : "ComboBox", - "| void showhide" : "(bool is_bjs) {\n\tfor (var i = 2; i < 9;i++) {\n\t\tvar el = _this.grid.el.get_child_at(0,i);\n\t\t\n\t\tvar showhide= is_bjs;\n\t\tif (i> 7) {\n\t\t\tshowhide = !showhide;\n\t\t}\n\t\t\n\t\tif (showhide) {\n\t\t el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t}\n\t\t el = _this.grid.el.get_child_at(1,i);\n\t\tif (showhide) {\n\t\t el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t} \n }\n // load up the directories\n //??? why can we not create bjs files in other directories??\n\tif (!is_bjs && _this.file.path.length < 1) {\n\t\t_this.dirmodel.loadData();\n\t\t\n\t\t\n\t}\n \n \n}\n", + "| void showhide" : "(bool is_bjs) {\n\n\n\tif (_this.project.xtype != \"Roo\") {\n\t \tis_bjs = false;\n \t}\n\n\tfor (var i = 2; i < 9;i++) {\n\t\tvar el = _this.grid.el.get_child_at(0,i);\n\t\t\n\t\tvar showhide= is_bjs;\n\t\tif (i> 7) {\n\t\t\tshowhide = !showhide;\n\t\t}\n\t\t\n\t\tif (showhide) {\n\t\t el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t}\n\t\t el = _this.grid.el.get_child_at(1,i);\n\t\tif (showhide) {\n\t\t el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t} \n }\n // load up the directories\n //??? why can we not create bjs files in other directories??\n\t//if (!is_bjs && _this.file.path.length < 1) {\n\t\n\t\t_this.dirmodel.loadData();\n\t\t\n\t\t\n\t//}\n \n \n}\n", "$ xns" : "Gtk", "items" : [ { "id" : "ftdbcellrenderer", - "* pack" : "pack_start,true", "xtype" : "CellRendererText", + "* pack" : "pack_start,true", "$ xns" : "Gtk" }, { "id" : "ftdbmodel", - "* pack" : "set_model", "xtype" : "ListStore", + "* pack" : "set_model", "$ columns" : "typeof(string),typeof(string)", "n_columns" : 2, "$ xns" : "Gtk", @@ -123,8 +123,8 @@ }, { "label" : "Region", - "$ visible" : true, "tooltip_text" : "center, north, south, east, west", + "$ visible" : true, "xalign" : 0.90000000000000002, "* pack" : "attach,0,3,1,1", "xtype" : "Label", @@ -209,14 +209,14 @@ "items" : [ { "id" : "dbcellrenderer", - "xtype" : "CellRendererText", "* pack" : "pack_start,true", + "xtype" : "CellRendererText", "$ xns" : "Gtk" }, { "id" : "dbmodel", - "xtype" : "ListStore", "* pack" : "set_model", + "xtype" : "ListStore", "$ columns" : "typeof(string),typeof(string)", "n_columns" : 2, "$ xns" : "Gtk", @@ -243,14 +243,14 @@ "items" : [ { "id" : "dircellrenderer", - "* pack" : "pack_start,true", "xtype" : "CellRendererText", + "* pack" : "pack_start,true", "$ xns" : "Gtk" }, { "id" : "dirmodel", - "* pack" : "set_model", "xtype" : "ListStore", + "* pack" : "set_model", "$ columns" : "typeof(string),typeof(string)", "n_columns" : 2, "$ xns" : "Gtk", @@ -272,9 +272,9 @@ "listeners" : { "clicked" : "() => { \n\n _this.done = true;\n _this.el.hide(); \n}" }, + "string label" : "Cancel", "* pack" : "add", "xtype" : "Button", - "string label" : "Cancel", "$ xns" : "Gtk" }, { @@ -282,8 +282,8 @@ "clicked" : "( ) => { \n\n \n\n\n\tif (_this.name.el.get_text().length < 1) {\n\t StandardErrorDialog.show(\n\t _this.mainwindow.el,\n\t \"You have to set Component name \"\n\t );\n\t \n\t return;\n\t}\n\t// what does this do?\n\t\n\tvar isNew = _this.file.name.length > 0 ? false : true;\n\t/*\n\tif (!isNew && this.file.name != _this.name.el.get_text()) {\n\t Xcls_StandardErrorDialog.singleton().show(\n\t this.el,\n\t \"Sorry changing names does not work yet. \"\n\t );\n\t \n\t return;\n\t}\n\t*/\n\t \n\t\n \n\t// FIXME - this may be more complicated...\n\t//for (var i in this.def) {\n\t// this.file[i] = this.get(i).el.get_text();\n\t//}\n\n\tif (!isNew) {\n\t try {\n\t _this.updateFileFromEntry();\n\t } catch( JsRender.Error.RENAME_FILE_EXISTS er) {\n\t Xcls_StandardErrorDialog.singleton().show(\n\t _this.mainwindow.el,\n\t \"The name you used already exists \"\n\t );\n\t return;\n\t \n\t }\n\n\t _this.done = true;\n\t _this.file.save();\n\t _this.el.hide();\n\t return;\n\t}\n\t\n\t// ---------------- NEW FILES...\n\tGtk.TreeIter iter;\n\n\tif (!_this.filetype.el.get_active_iter(out iter)) {\n\t\t// should not happen...\n\t\t// so we are jut going to return without \n\t\tStandardErrorDialog.show(\n\t _this.mainwindow.el,\n\t \"You must select a file type. \"\n\t );\n\t return;\n\t\t \n\t}\n\t\n\t\n\tvar fn = _this.name.el.get_text();\n\t\n\tValue ftypename;\n\t_this.ftdbmodel.el.get_value (iter, 0, out ftypename);\n\tvar ext = ((string)ftypename);\n\tvar dir = _this.project.firstPath(); \n\tif (ext != \"bjs\") {\n\t \n\t\tif (!_this.dir.el.get_active_iter(out iter)) {\n\t\t\t// should not happen...\n\t\t\t// so we are jut going to return without \n\t\t\tStandardErrorDialog.show(\n\t\t\t _this.mainwindow.el,\n\t\t\t \"You must select a directory \"\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tValue vdir;\n\t\t_this.dirmodel.el.get_value (iter, 0, out vdir);\n\t\tdir = (string)vdir;\n\t}\n\t\n\tvar targetfile = dir + \"/\" + fn;\n\t\n\t// strip the file type off the end..\n\t\n\t\n var rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);\n targetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); \n \n\tif (GLib.FileUtils.test(targetfile + \".\" + ext, GLib.FileTest.EXISTS)) {\n\t Xcls_StandardErrorDialog.singleton().show(\n\t _this.mainwindow.el,\n\t \"That file already exists\"\n\t ); \n\t return;\n\t}\n \n var f = JsRender.JsRender.factory(\n\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\", \n\t\t_this.file.project, \n\t\ttargetfile + \".\" + ext);\n\n\t_this.file = f;\n\t\n\n\t\n\t_this.updateFileFromEntry();\n\t_this.file.loaded = true;\n\t_this.file.save();\n\tif (ext == \"bjs\") {\n\t\t_this.file.project.addFile(_this.file);\n\t}\n\t\n \n\t// what about .js ?\n _this.done = true;\n\t_this.el.hide();\n\n// hopefull this will work with bjs files..\n\t\n\t_this.success(_this.project, _this.file);\n \n}" }, "id" : "save_btn", - "xtype" : "Button", "* pack" : "add", + "xtype" : "Button", "string label" : "Save", "$ xns" : "Gtk" }