From: Alan Knowles Date: Wed, 11 Jun 2014 05:25:23 +0000 (+0800) Subject: Test.GtkWriter.vala.c X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=commitdiff_plain;h=2357117f2dbfda5d1282c5cc730534781e244d7e Test.GtkWriter.vala.c JsRender/Gtk.vala.c JsRender/JsRender.vala.c JsRender/Lang.vala.c JsRender/Node.vala.c JsRender/Roo.vala.c Project/Gtk.vala.c Project/Project.vala.c Project/Roo.vala.c Palete/Gir.vala.c Palete/Gtk.vala.c Palete/Palete.vala.c Builder4/About.vala.c Builder4/DialogConfirm.vala.c Builder4/DialogNewComponent.vala.c Builder4/StandardErrorDialog.vala.c Builder4/DialogSaveTemplate.vala.c Builder4/DialogTemplateSelect.vala.c Builder4/EditProject.vala.c Builder4/Editor.vala.c Builder4/RooProjectProperties.vala.c --- 2357117f2dbfda5d1282c5cc730534781e244d7e diff --cc Builder4/DialogNewComponent.bjs index 60983148c,f9cdc9a57..6750ee51d --- a/Builder4/DialogNewComponent.bjs +++ b/Builder4/DialogNewComponent.bjs @@@ -7,13 -7,10 +7,13 @@@ "items": [ { "listeners": { - "delete_event": "(self, event) => {\n this.el.hide();\n return true; \n}\n\n\n", - "response": " (self, response_id) => {\n \n\tif (response_id < 1) { // cancel!\n this.el.hide();\n return;\n }\n\n if (_this.name.el.get_text().length < 1) {\n StandardErrorDialog.show(\n \"You have to set Project name \"\n );\n \n return;\n }\n // what does this do?\n \n var isNew = _this.file.name.length > 0 ? false : true;\n \n if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {\n StandardErrorDialog.show(\n \"Sorry changing names does not work yet. \"\n );\n \n return;\n }\n\n // FIXME - this may be more complicated...\n //for (var i in this.def) {\n // this.file[i] = this.get(i).el.get_text();\n //}\n\n if (!isNew) {\n _this.file.save();\n this.el.hide();\n return;\n }\n\n \n\tvar dir = _this.project.firstPath();\n\t//FIXME...\n //for (var i in this.project.paths) {\n \t//\tdir = i;\n\t//\tbreak;\n\t//}\n\n \n \n // what about .js ?\n if (GLib.FileUtil.test(_this.file.name + \".bjs\", GLib.FileTest.EXISTS)) {\n StandardErrorDialog.show(\n \"That file already exists\"\n ); \n return;\n }\n this.el.hide();\n \n \n //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n \n var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");\n //for (var i in this.file) {\n // nf[i] = this.file[i];\n //}\n _this.success(_this.project, nf);\n /*\n\n -- fixme -- needs to be a signal..\n if (DialogNewComponent.success != null) {\n DialogNewComponent.success(_this.project, nf);\n }\n */\n}", - "delete_event": "function (self, event) {\n this.el.hide();\n return true;\n}\n\n", - "response": "function (self, response_id) {\n\tif (response_id < 1) { // cancel!\n this.el.hide();\n return;\n }\n\n if (DialogNewComponent.name.el.get_text().length < 1) {\n StandardErrorDialog.show(\n \"You haDe to set Project name \"\n );\n \n return;\n }\n var isNew = this.file.name.length > 0 ? false : true;\n \n if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {\n StandardErrorDialog.show(\n \"Sorry changing names does not work yet. \"\n );\n \n return;\n }\n // FIXME - this may be more complicated...\n //for (var i in this.def) {\n // this.file[i] = this.get(i).el.get_text();\n //}\n \n if (!isNew) {\n this.file.save();\n this.el.hide();\n return;\n }\n \n \n\tvar dir ='';\n\t//FIXME...\n //for (var i in this.project.paths) {\n \t//\tdir = i;\n\t//\tbreak;\n\t//}\n\n \n \n // what about .js ?\n if (GLib.file_test (GLib.dir + \"/\" + this.file.name + \".bjs\", GLib.FileTest.EXISTS)) {\n StandardErrorDialog.show(\n \"That file already exists\"\n ); \n return;\n }\n this.el.hide();\n \n \n //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n \n var nf = _this.project.create(dir + \"/\" + this.file.name + \".bjs\");\n //for (var i in this.file) {\n // nf[i] = this.file[i];\n //}\n \n if (DialogNewComponent.success != null) {\n DialogNewComponent.success(_this.project, nf);\n }\n}", - "show": "function (self) {\n this.el.show_all();\n}" ++ "delete_event": "(self, event) => {\n this.el.hide();\n return true; \n}\n ", ++ "response": " (self, response_id) => { \n \n\tif (response_id < 1) { // cancel!\n this.el.hide();\n return;\n }\n\n if (_this.name.el.get_text().length < 1) {\n StandardErrorDialog.show(\n \"You have to set Project name \"\n );\n \n return;\n }\n // what does this do?\n \n var isNew = _this.file.name.length > 0 ? false : true;\n \n if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {\n StandardErrorDialog.show(\n \"Sorry changing names does not work yet. \"\n );\n \n return;\n }\n\n // FIXME - this may be more complicated...\n //for (var i in this.def) {\n // this.file[i] = this.get(i).el.get_text();\n //}\n\n if (!isNew) {\n _this.file.save();\n this.el.hide();\n return;\n }\n\n \n\tvar dir = _this.project.firstPath();\n\t//FIXME...\n //for (var i in this.project.paths) {\n \t//\tdir = i;\n\t//\tbreak;\n\t//}\n\n \n \n // what about .js ?\n if (GLib.FileUtils.test(_this.file.name + \".bjs\", GLib.FileTest.EXISTS)) {\n StandardErrorDialog.show(\n \"That file already exists\"\n ); \n return;\n }\n this.el.hide();\n \n \n //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n \n var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");\n //for (var i in this.file) {\n // nf[i] = this.file[i];\n //}\n _this.success(_this.project, nf);\n /*\n\n -- fixme -- needs to be a signal..\n if (DialogNewComponent.success != null) {\n DialogNewComponent.success(_this.project, nf);\n }\n */\n}", + "show": "(self) => {\n this.el.show_all();\n \n}" }, + ".JsRender.JsRender:file": "", + ".Project.Project:project": "", + ".signal:void:success": "(Project.Project pr, JsRender.JsRender file)", "default_height": 200, "default_width": 500, "id": "DialogNewComponent", @@@ -21,7 -18,7 +21,7 @@@ "xtype": "Dialog", "|deletable": "false", "|modal": "true", - "|void:show": "(JsRender.JsRender c) \n{\n this.project = c.project;\n \n if (!this.el) {\n //this.init();\n }\n \n this.def = { \n name : '' , \n title : '' ,\n region : '' ,\n parent: '',\n // disable: '',\n modOrder : '0',\n permname : ''\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 if (c.path.length > 0) {\n this.el.set_title(\"Edit File Details - \" + c.name);\n } else {\n this.el.set_title(\"Create New File\");\n }\n \n _this.file = c;\n //console.log('show all');\n this.el.show_all();\n \n //this.success = c.success;\n \n \n}", - "|show": "function (c) \n{\n this.project = c.project;\n if (!this.el) {\n this.init();\n }\n this.def = { \n name : '' , \n title : '' ,\n region : '' ,\n parent: '',\n // disable: '',\n modOrder : '0',\n permname : ''\n };\n for (var i in this.def) {\n c[i] = c[i] || this.def[i];\n this.get(i).el.set_text(c[i]);\n }\n if (c.name) {\n this.el.set_title(\"Edit File Details - \" + c.name);\n } else {\n this.el.set_title(\"Create New File\");\n }\n \n this.file = c;\n console.log('show all');\n this.el.show_all();\n this.success = c.success;\n \n \n}", ++ "|void:show": "(JsRender.JsRender c) \n{\n this.project = c.project;\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 if (c.path.length > 0) {\n this.el.set_title(\"Edit File Details - \" + c.name);\n } else {\n this.el.set_title(\"Create New File\");\n }\n \n _this.file = c;\n //console.log('show all');\n this.el.show_all();\n \n //this.success = c.success;\n \n \n}", "|xns": "Gtk", "items": [ { diff --cc Builder4/DialogNewComponent.js index 6414aba91,990394996..c6a99dbf8 --- a/Builder4/DialogNewComponent.js +++ b/Builder4/DialogNewComponent.js @@@ -12,12 -12,11 +12,12 @@@ XObject = imports.XObject.XObject DialogNewComponent=new XObject({ xtype: Gtk.Dialog, listeners : { - delete_event : function (self, event) { + delete_event : (self, event) => { this.el.hide(); - return true; + return true; }, - response : (self, response_id) => { - response : function (self, response_id) { ++ response : (self, response_id) => { + if (response_id < 1) { // cancel! this.el.hide(); return; @@@ -64,7 -60,7 +64,7 @@@ // what about .js ? - if (GLib.FileUtil.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) { - if (GLib.file_test (GLib.dir + "/" + this.file.name + ".bjs", GLib.FileTest.EXISTS)) { ++ if (GLib.FileUtils.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) { StandardErrorDialog.show( "That file already exists" ); @@@ -99,31 -90,26 +99,22 @@@ title : "New Component", deletable : false, modal : true, - show : function (c) + 'void:show' : (JsRender.JsRender c) { this.project = c.project; - if (!this.el) { - this.init(); - } - this.def = { - name : '' , - title : '' , - region : '' , - parent: '', - // disable: '', - modOrder : '0', - permname : '' - }; - for (var i in this.def) { - c[i] = c[i] || this.def[i]; - this.get(i).el.set_text(c[i]); - } - if (c.name) { + - if (!this.el) { ++ //if (!this.el) { + //this.init(); - } ++ //} + - this.def = { - name : '' , - title : '' , - region : '' , - parent: '', - // disable: '', - modOrder : '0', - permname : '' - }; + _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); + + if (c.path.length > 0) { this.el.set_title("Edit File Details - " + c.name); } else { this.el.set_title("Create New File"); diff --cc Builder4/DialogNewComponent.vala index 0c5ea8819,44a40656a..2b30a1007 --- a/Builder4/DialogNewComponent.vala +++ b/Builder4/DialogNewComponent.vala @@@ -57,15 -54,11 +57,13 @@@ public class Xcls_DialogNewComponen this.el.add_action_widget ( child_2.el , 1 ); // listeners - this.el.delete_event.connect( (self, event) => { + this.el.delete_event.connect( (self, event) => { this.el.hide(); - return true; - } ); - this.el.response.connect( (self, response_id) => { + return true; + } - - - ); - this.el.response.connect( (self, response_id) => { ++ ); ++ this.el.response.connect( (self, response_id) => { + if (response_id < 1) { // cancel! this.el.hide(); return; @@@ -112,7 -102,7 +110,7 @@@ // what about .js ? - if (GLib.FileUtil.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) { - if (GLib.file_test (GLib.dir + "/" + this.file.name + ".bjs", GLib.FileTest.EXISTS)) { ++ if (GLib.FileUtils.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) { StandardErrorDialog.show( "That file already exists" ); @@@ -165,46 -144,10 +163,37 @@@ // skip |deletable - already used // skip |modal - already used + public void show(JsRender.JsRender c) + { + this.project = c.project; + - if (!this.el) { ++ //if (!this.el) { + //this.init(); - } ++ //} + - this.def = { - name : '' , - title : '' , - region : '' , - parent: '', - // disable: '', - modOrder : '0', - permname : '' - }; + _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); + + if (c.path.length > 0) { + this.el.set_title("Edit File Details - " + c.name); + } else { + this.el.set_title("Create New File"); + } + + _this.file = c; + //console.log('show all'); + this.el.show_all(); + + //this.success = c.success; + + + } - // skip |show - could not find seperator - - // skip |xns - could not find seperator + // skip |xns - no return type // skip items - not pipe @@@ -256,14 -199,14 +245,11 @@@ // ctor public Xcls_Table3() { -- this.el = new Gtk.Table(); ++ this.el = new Gtk.Table( 3, 2, false ); // my vars // set gobject values -- this.el.homogeneous = false; -- this.el.n_columns = 2; -- this.el.n_rows = 3; var child_0 = new Xcls_Label4(); this.el.add ( child_0.el ); var child_1 = new Xcls_name(); @@@ -321,14 -264,14 +307,13 @@@ // ctor public Xcls_Label4() { -- this.el = new Gtk.Label(); ++ this.el = new Gtk.Label( "Component Name" ); // my vars // set gobject values this.el.justify = Gtk.Justification.RIGHT; -- this.el.label = "Component Name"; -- this.el.xalign = 0.9; ++ this.el.xalign = 0.9f; } // userdefined functions @@@ -398,15 -341,15 +383,14 @@@ // ctor public Xcls_Label6() { -- this.el = new Gtk.Label(); ++ this.el = new Gtk.Label( "Title" ); // my vars // set gobject values this.el.justify = Gtk.Justification.RIGHT; -- this.el.label = "Title"; this.el.visible = true; -- this.el.xalign = 0.9; ++ this.el.xalign = 0.9f; } // userdefined functions @@@ -478,16 -421,16 +462,15 @@@ // ctor public Xcls_Label8() { -- this.el = new Gtk.Label(); ++ this.el = new Gtk.Label( "Region" ); // my vars // set gobject values this.el.justify = Gtk.Justification.RIGHT; -- this.el.label = "Region"; this.el.tooltip_text = "center, north, south, east, west"; this.el.visible = true; -- this.el.xalign = 0.9; ++ this.el.xalign = 0.9f; } // userdefined functions @@@ -561,15 -504,15 +544,14 @@@ // ctor public Xcls_Label10() { -- this.el = new Gtk.Label(); ++ this.el = new Gtk.Label( "Parent Name" ); // my vars // set gobject values this.el.justify = Gtk.Justification.RIGHT; -- this.el.label = "Parent Name"; this.el.visible = true; -- this.el.xalign = 0.9; ++ this.el.xalign = 0.9f; } // userdefined functions @@@ -641,15 -584,15 +623,14 @@@ // ctor public Xcls_Label12() { -- this.el = new Gtk.Label(); ++ this.el = new Gtk.Label( "Permission Name" ); // my vars // set gobject values this.el.justify = Gtk.Justification.RIGHT; -- this.el.label = "Permission Name"; this.el.visible = true; -- this.el.xalign = 0.9; ++ this.el.xalign = 0.9f; } // userdefined functions @@@ -721,15 -664,15 +702,14 @@@ // ctor public Xcls_Label14() { -- this.el = new Gtk.Label(); ++ this.el = new Gtk.Label( "Order (for tabs)" ); // my vars // set gobject values this.el.justify = Gtk.Justification.RIGHT; -- this.el.label = "Order (for tabs)"; this.el.visible = true; -- this.el.xalign = 0.9; ++ this.el.xalign = 0.9f; } // userdefined functions diff --cc Builder4/DialogSaveTemplate.bjs index d4a4882cf,d4a4882cf..3e73f5fff --- a/Builder4/DialogSaveTemplate.bjs +++ b/Builder4/DialogSaveTemplate.bjs @@@ -1,1 -1,1 +1,59 @@@ --{"id":"file-gtk-8","name":"DialogSaveTemplate","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogSaveTemplate.bjs","items":[{"listeners":{"delete_event":"function (self, event) {\n this.el.hide();\n return true;\n}","response":"function (self, response_id) {\n\n if (!response_id) {\n this.el.hide();\n return;\n }\n var name = this.get('name').el.get_text();\n if (!name.length) {\n this.get('/StandardErrorDialog').show(\n \"You must give the template a name. \"\n );\n return;\n }\n \n if (!name.match(/^[A-Z ]+$/i) || !name.match(/[A-Z]/i)) {\n this.get('/StandardErrorDialog').show(\n \"Template Nane must contain only letters and spaces. \"\n );\n return;\n }\n this.get('/Window.LeftTree').getPaleteProvider().saveTemplate(name, this.data);\n // now we save it..\n this.el.hide();\n \n}"},"default_height":200,"default_width":400,"xtype":"Dialog","|modal":true,"|show":"function(data) {\n this.data = data;\n this.get('name').el.set_text('');\n this.el.show_all();\n}\n","|xns":"Gtk","items":[{"xtype":"HBox","|pack":"function(p,e) {\n p.el.get_content_area().add(e.el)\n }\n","|xns":"Gtk","items":[{"label":"Name","pack":"add","xtype":"Label","|xns":"Gtk","listeners":{}},{"id":"name","pack":"add","xtype":"Entry","|xns":"Gtk"}]},{"label":"Cancel","pack":"add_action_widget,0","xtype":"Button","|xns":"Gtk"},{"label":"OK","pack":"add_action_widget,1","xtype":"Button","|xns":"Gtk"}]}],"project":"{\"name\":\"Sample\",\"xtype\":\"Gtk\",\"paths\":{\"/home/alan/gitlive/app.Builder.js/Sample\":\"dir\"},\"id\":\"project-gtk-1\",\"fn\":\"329624934046af6e88a65a3f36971958\",\"file\":false,\"runhtml\":\"\"}"} ++{ ++ "id": "file-gtk-4", ++ "name": "DialogSaveTemplate", ++ "parent": "", ++ "title": false, ++ "path": "/home/alan/gitlive/app.Builder.js/Builder4/DialogSaveTemplate.bjs", ++ "items": [ ++ { ++ "listeners": { ++ "delete_event": " (self, event) => {\n this.el.hide();\n return true;\n}", ++ "response": "(self, response_id) => {\n\n if (response_id < 1) {\n this.el.hide();\n return;\n }\n var name = _this.name.el.get_text();\n if (name.length < 1) {\n StandardErrorDialog.show(\n \"You must give the template a name. \"\n );\n return;\n }\n if (!Regex.match_simple (\"^[A-Za-z]+$\", name) || \n !Regex.match_simple (\"^[A-Za-z ]+$\", name) )\n {\n StandardErrorDialog.show(\n \"Template Nane must contain only letters and spaces. \"\n );\n return;\n }\n _this.palete.saveTemplate(name, _this.data);\n // now we save it..\n this.el.hide();\n \n}" ++ }, ++ ".JsRender.Node:data": "", ++ ".Palete.Palete:palete": "", ++ "default_height": 200, ++ "default_width": 400, ++ "xtype": "Dialog", ++ "|modal": "true", ++ "|void:show": " (Palete.Palete palete, JsRender.Node data) {\n _this.data = data;\n _this.palete = palete;\n _this.name.el.set_text(\"\");\n this.el.show_all();\n}\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "xtype": "HBox", ++ "|pack": "function(p,e) {\n p.el.get_content_area().add(e.el)\n }\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "label": "Name", ++ "pack": "add", ++ "xtype": "Label", ++ "|xns": "Gtk", ++ "listeners": {} ++ }, ++ { ++ "id": "name", ++ "pack": "add", ++ "xtype": "Entry", ++ "|xns": "Gtk" ++ } ++ ] ++ }, ++ { ++ "label": "Cancel", ++ "pack": "add_action_widget,0", ++ "xtype": "Button", ++ "|xns": "Gtk" ++ }, ++ { ++ "label": "OK", ++ "pack": "add_action_widget,1", ++ "xtype": "Button", ++ "|xns": "Gtk" ++ } ++ ] ++ } ++ ], ++ "permname": "", ++ "modOrder": "" ++} diff --cc Builder4/DialogSaveTemplate.js index c82c49d3c,c82c49d3c..44b176209 --- a/Builder4/DialogSaveTemplate.js +++ b/Builder4/DialogSaveTemplate.js @@@ -12,42 -12,42 +12,44 @@@ XObject = imports.XObject.XObject DialogSaveTemplate=new XObject({ xtype: Gtk.Dialog, listeners : { -- delete_event : function (self, event) { ++ delete_event : (self, event) => { this.el.hide(); return true; }, -- response : function (self, response_id) { ++ response : (self, response_id) => { -- if (!response_id) { ++ if (response_id < 1) { this.el.hide(); return; } -- var name = this.get('name').el.get_text(); -- if (!name.length) { -- this.get('/StandardErrorDialog').show( ++ var name = _this.name.el.get_text(); ++ if (name.length < 1) { ++ StandardErrorDialog.show( "You must give the template a name. " ); return; } -- -- if (!name.match(/^[A-Z ]+$/i) || !name.match(/[A-Z]/i)) { -- this.get('/StandardErrorDialog').show( ++ if (!Regex.match_simple ("^[A-Za-z]+$", name) || ++ !Regex.match_simple ("^[A-Za-z ]+$", name) ) ++ { ++ StandardErrorDialog.show( "Template Nane must contain only letters and spaces. " ); return; } -- this.get('/Window.LeftTree').getPaleteProvider().saveTemplate(name, this.data); ++ _this.palete.saveTemplate(name, _this.data); // now we save it.. -- this.el.hide(); ++ this.el.hide(); } }, default_height : 200, default_width : 400, modal : true, -- show : function(data) { -- this.data = data; -- this.get('name').el.set_text(''); ++ 'void:show' : (Palete.Palete palete, JsRender.Node data) { ++ _this.data = data; ++ _this.palete = palete; ++ _this.name.el.set_text(""); this.el.show_all(); }, items : [ diff --cc Builder4/DialogSaveTemplate.vala index 000000000,000000000..4e09282aa new file mode 100644 --- /dev/null +++ b/Builder4/DialogSaveTemplate.vala @@@ -1,0 -1,0 +1,288 @@@ ++/* -- to compile ++valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \ ++ /tmp/DialogSaveTemplate.vala -o /tmp/DialogSaveTemplate ++*/ ++ ++ ++/* -- to test class ++static int main (string[] args) { ++ Gtk.init (ref args); ++ new Xcls_DialogSaveTemplate(); ++ DialogSaveTemplate.show_all(); ++ Gtk.main (); ++ return 0; ++} ++*/ ++ ++ ++public static Xcls_DialogSaveTemplate DialogSaveTemplate; ++ ++public class Xcls_DialogSaveTemplate ++{ ++ public Gtk.Dialog el; ++ private static Xcls_DialogSaveTemplate _this; ++ ++ public Xcls_name name; ++ ++ // my vars ++ public JsRender.Node data; ++ public Palete.Palete palete; ++ ++ // ctor ++ public Xcls_DialogSaveTemplate() ++ { ++ this.el = new Gtk.Dialog(); ++ _this = this; ++ DialogSaveTemplate = this; ++ ++ // my vars ++ ++ // set gobject values ++ this.el.default_height = 200; ++ this.el.default_width = 400; ++ this.el.modal = true; ++ var child_0 = new Xcls_HBox2(); ++ this.el.add ( child_0.el ); ++ var child_1 = new Xcls_Button5(); ++ this.el.add_action_widget ( child_1.el , 0 ); ++ var child_2 = new Xcls_Button6(); ++ this.el.add_action_widget ( child_2.el , 1 ); ++ ++ // listeners ++ this.el.delete_event.connect( (self, event) => { ++ this.el.hide(); ++ return true; ++ } ); ++ this.el.response.connect( (self, response_id) => { ++ ++ if (response_id < 1) { ++ this.el.hide(); ++ return; ++ } ++ var name = _this.name.el.get_text(); ++ if (name.length < 1) { ++ StandardErrorDialog.show( ++ "You must give the template a name. " ++ ); ++ return; ++ } ++ if (!Regex.match_simple ("^[A-Za-z]+$", name) || ++ !Regex.match_simple ("^[A-Za-z ]+$", name) ) ++ { ++ StandardErrorDialog.show( ++ "Template Nane must contain only letters and spaces. " ++ ); ++ return; ++ } ++ _this.palete.saveTemplate(name, _this.data); ++ // now we save it.. ++ this.el.hide(); ++ ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip .JsRender.Node:data - already used ++ ++ // skip .Palete.Palete:palete - already used ++ ++ // skip default_height - already used ++ ++ // skip default_width - already used ++ ++ // skip xtype - not pipe ++ ++ // skip |modal - already used ++ public void show (Palete.Palete palete, JsRender.Node data) { ++ _this.data = data; ++ _this.palete = palete; ++ _this.name.el.set_text(""); ++ this.el.show_all(); ++ } ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip id - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ public class Xcls_HBox2 ++ { ++ public Gtk.HBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_HBox2() ++ { ++ this.el = new Gtk.HBox( true, 0 ); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_Label3(); ++ this.el.add ( child_0.el ); ++ var child_1 = new Xcls_name(); ++ this.el.add ( child_1.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip xtype - not pipe ++ ++ // skip |pack - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Label3 ++ { ++ public Gtk.Label el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Label3() ++ { ++ this.el = new Gtk.Label( "Name" ); ++ ++ // my vars ++ ++ // set gobject values ++ ++ // listeners ++ } ++ ++ // userdefined functions ++ ++ // skip label - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip listeners - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_name ++ { ++ public Gtk.Entry el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_name() ++ { ++ this.el = new Gtk.Entry(); ++ _this.name = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip id - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button5 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button5() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.label = "Cancel"; ++ } ++ ++ // userdefined functions ++ ++ // skip label - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button6 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button6() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.label = "OK"; ++ } ++ ++ // userdefined functions ++ ++ // skip label - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++} diff --cc Builder4/DialogTemplateSelect.bjs index bd33682df,bd33682df..0af6d62d2 --- a/Builder4/DialogTemplateSelect.bjs +++ b/Builder4/DialogTemplateSelect.bjs @@@ -1,1 -1,1 +1,75 @@@ --{"id":"file-gtk-9","name":"DialogTemplateSelect","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogTemplateSelect.bjs","items":[{"listeners":{"delete_event":"function (self, event) {\n this.el.hide();\n return true;\n}"},"default_height":200,"default_width":400,"xtype":"Dialog","|modal":true,"|show":"function(node) {\n \n var pal = this.get('/Window.LeftTree').getPaleteProvider();\n var opts = pal.listTemplates(node);\n if (!opts.length) {\n return node;\n }\n \n opts.unshift({ path: '' , name :'Just add Element' });\n this.get('combo.model').loadData(opts);\n this.get('combo').el.set_active(0);\n \n this.el.show_all();\n this.el.run();\n this.el.hide();\n var ix = this.get('combo').el.get_active();\n if (ix < 1 ) {\n return node;\n }\n \n\n return pal.loadTemplate(opts[ix].path)\n\n}\n","|xns":"Gtk","items":[{"xtype":"VBox","|pack":"function(p,e) {\n p.el.get_content_area().add(e.el)\n }\n","|xns":"Gtk","items":[{"pack":"pack_start,false,false,0","xtype":"HBox","|xns":"Gtk","listeners":{},"items":[{"label":"Select Template : ","pack":"pack_start,false,false","xtype":"Label","|xns":"Gtk"},{"id":"combo","pack":"add","xtype":"ComboBox","|init":"function() {\n XObject.prototype.init.call(this);\n this.el.add_attribute(this.items[0].el , 'markup', 1 );\n}\n","|xns":"Gtk","items":[{"pack":"pack_start","xtype":"CellRendererText","|xns":"Gtk"},{"id":"model","pack":"set_model","xtype":"ListStore","|init":"function() {\n XObject.prototype.init.call(this);\n this.el.set_column_types ( 2, [\n GObject.TYPE_STRING, // real key\n GObject.TYPE_STRING // real type\n \n \n ] );\n}\n","|loadData":"function (data) {\n this.el.clear(); \n var iter = new Gtk.TreeIter();\n var el = this.el;\n data.forEach(function(p) {\n\n el.append(iter);\n \n \n el.set_value(iter, 0, ''+ p.path);\n el.set_value(iter, 1, ''+ p.name);\n \n });\n \n \n}\n","|xns":"Gtk"}]}]}]},{"label":"OK","pack":"add_action_widget,0","xtype":"Button","|xns":"Gtk"}]}],"project":"{\"name\":\"Sample\",\"xtype\":\"Gtk\",\"paths\":{\"/home/alan/gitlive/app.Builder.js/Sample\":\"dir\"},\"id\":\"project-gtk-1\",\"fn\":\"329624934046af6e88a65a3f36971958\",\"file\":false,\"runhtml\":\"\"}"} ++{ ++ "id": "file-gtk-5", ++ "name": "DialogTemplateSelect", ++ "parent": "", ++ "title": false, ++ "path": "/home/alan/gitlive/app.Builder.js/Builder4/DialogTemplateSelect.bjs", ++ "items": [ ++ { ++ "listeners": { ++ "delete_event": " (self, event) =>{\n this.el.hide();\n return true;\n}" ++ }, ++ "default_height": 200, ++ "default_width": 400, ++ "xtype": "Dialog", ++ "|JsRender.Node?:show": " (Palete.Palete pal, JsRender.Node node) {\n \n\n var opts = pal.listTemplates(node);\n if (opts.length() < 1) {\n return node;\n }\n \n //opts.unshift({ path: '' , name :'Just add Element' });\n _this.model.loadData(opts);\n _this.combo.el.set_active(0);\n \n this.el.show_all();\n this.el.run();\n this.el.hide();\n var ix = _this.combo.el.get_active();\n if (ix < 1 ) {\n return null;\n }\n \n\n return pal.loadTemplate(opts.nth_data(ix));\n\n}\n", ++ "|modal": "true", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "xtype": "VBox", ++ "|pack": "get_content_area().add ", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "pack": "pack_start,false,false,0", ++ "xtype": "HBox", ++ "|xns": "Gtk", ++ "listeners": {}, ++ "items": [ ++ { ++ "label": "Select Template : ", ++ "pack": "pack_start,false,false", ++ "xtype": "Label", ++ "|xns": "Gtk" ++ }, ++ { ++ "id": "combo", ++ "pack": "add", ++ "xtype": "ComboBox", ++ "|init": "this.el.add_attribute(_this.cellrenderer , \"markup\", 1 );", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "id": "cellrenderer", ++ "pack": "pack_start,true", ++ "xtype": "CellRendererText", ++ "|xns": "Gtk" ++ }, ++ { ++ "id": "model", ++ "n_columns": 2, ++ "pack": "set_model", ++ "xtype": "ListStore", ++ "|columns": "typeof(string),typeof(string)", ++ "|void:loadData": " (GLib.List data) {\n this.el.clear(); \n Gtk.TreeIter iter;\n var el = this.el;\n \n el.append(out iter);\n \n \n el.set_value(iter, 0, \"\");\n el.set_value(iter, 1, \"Just add Element\");\n \n for (var i = 0; i < data.length();i++) {\n \n\n el.append(out iter);\n var str = data.nth_data(i);\n var fn = Path.get_basename (str);\n fn.replace(\".json\", \"\");\n \n el.set_value(iter, 0, fn);\n el.set_value(iter, 1, str);\n \n }\n \n \n}\n", ++ "|xns": "Gtk" ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "label": "OK", ++ "pack": "add_action_widget,0", ++ "xtype": "Button", ++ "|xns": "Gtk" ++ } ++ ] ++ } ++ ], ++ "permname": "", ++ "modOrder": "" ++} diff --cc Builder4/DialogTemplateSelect.js index c561c451a,c561c451a..c0fbe30d7 --- a/Builder4/DialogTemplateSelect.js +++ b/Builder4/DialogTemplateSelect.js @@@ -12,68 -12,68 +12,42 @@@ XObject = imports.XObject.XObject DialogTemplateSelect=new XObject({ xtype: Gtk.Dialog, listeners : { -- delete_event : function (self, event) { ++ delete_event : (self, event) =>{ this.el.hide(); return true; } }, default_height : 200, default_width : 400, -- modal : true, -- show : function(node) { ++ 'JsRender.Node?:show' : (Palete.Palete pal, JsRender.Node node) { -- var pal = this.get('/Window.LeftTree').getPaleteProvider(); ++ var opts = pal.listTemplates(node); -- if (!opts.length) { ++ if (opts.length() < 1) { return node; } -- -- -- var dopts = []; -- -- -- dopts.push({ path: '' , name :'Just add Element' }); -- -- -- -- -- var project = this.get('/Window.LeftTree').getActiveFile().project; -- var m = project.dbcon ? project.dbcon + '_' : false; -- -- -- //print (project.fn); -- -- opts.forEach(function(p) { -- // if we have a dbname - ignore _ named. -- if (m && p.name.match(/_/) && -- p.name.substring(0, m.length) != m) { -- return; -- -- } -- dopts.push(p); -- }); -- -- this.get('combo.model').loadData(dopts); -- this.get('combo').el.set_active(0); ++ //opts.unshift({ path: '' , name :'Just add Element' }); ++ _this.model.loadData(opts); ++ _this.combo.el.set_active(0); this.el.show_all(); this.el.run(); this.el.hide(); -- var ix = this.get('combo').el.get_active(); ++ var ix = _this.combo.el.get_active(); if (ix < 1 ) { -- return node; ++ return null; } -- -- return pal.loadTemplate(dopts[ix].path) ++ ++ ++ return pal.loadTemplate(opts.nth_data(ix)); }, ++ modal : true, items : [ { xtype: Gtk.VBox, -- pack : function(p,e) { -- p.el.get_content_area().add(e.el) -- }, ++ pack : get_content_area().add, items : [ { xtype: Gtk.HBox, @@@ -88,53 -88,53 +62,42 @@@ xtype: Gtk.ComboBox, id : "combo", pack : "add", -- init : function() { -- XObject.prototype.init.call(this); -- this.el.add_attribute(this.items[0].el , 'markup', 1 ); -- }, ++ init : this.el.add_attribute(_this.cellrenderer , "markup", 1 );, items : [ { xtype: Gtk.CellRendererText, -- pack : "pack_start" ++ id : "cellrenderer", ++ pack : "pack_start,true" }, { xtype: Gtk.ListStore, id : "model", ++ n_columns : 2, pack : "set_model", -- init : function() { -- XObject.prototype.init.call(this); -- this.el.set_column_types ( 2, [ -- GObject.TYPE_STRING, // real key -- GObject.TYPE_STRING // real type -- -- -- ] ); -- }, -- loadData : function (data) { ++ columns : typeof(string),typeof(string), ++ 'void:loadData' : (GLib.List data) { this.el.clear(); ++ Gtk.TreeIter iter; ++ var el = this.el; ++ ++ el.append(out iter); ++ -- var project = this.get('/Window.LeftTree').getActiveFile().project; -- var m = project.dbcon ? project.dbcon + '_' : false; ++ el.set_value(iter, 0, ""); ++ el.set_value(iter, 1, "Just add Element"); -- -- //print (project.fn); -- var el = this.el; -- data.forEach(function(p) { -- // if we have a dbname - ignore _ named. -- if (m && p.name.match(/_/) && -- p.name.substring(0, m.length) != m) { -- return; -- -- } -- -- var iret = {}; -- el.append(iret); ++ for (var i = 0; i < data.length();i++) { ++ ++ ++ el.append(out iter); ++ var str = data.nth_data(i); ++ var fn = Path.get_basename (str); ++ fn.replace(".json", ""); -- -- el.set_value(iret.iter, 0, ''+ p.path); -- el.set_value(iret.iter, 1, ''+ p.name); ++ el.set_value(iter, 0, fn); ++ el.set_value(iter, 1, str); -- }); ++ } } @@@ -142,7 -142,7 +105,7 @@@ ] } ] -- } ++ } ] }, { diff --cc Builder4/DialogTemplateSelect.vala index 000000000,000000000..81c258c47 new file mode 100644 --- /dev/null +++ b/Builder4/DialogTemplateSelect.vala @@@ -1,0 -1,0 +1,379 @@@ ++/* -- to compile ++valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \ ++ /tmp/DialogTemplateSelect.vala -o /tmp/DialogTemplateSelect ++*/ ++ ++ ++/* -- to test class ++static int main (string[] args) { ++ Gtk.init (ref args); ++ new Xcls_DialogTemplateSelect(); ++ DialogTemplateSelect.show_all(); ++ Gtk.main (); ++ return 0; ++} ++*/ ++ ++ ++public static Xcls_DialogTemplateSelect DialogTemplateSelect; ++ ++public class Xcls_DialogTemplateSelect ++{ ++ public Gtk.Dialog el; ++ private static Xcls_DialogTemplateSelect _this; ++ ++ public Xcls_combo combo; ++ public Xcls_cellrenderer cellrenderer; ++ public Xcls_model model; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_DialogTemplateSelect() ++ { ++ this.el = new Gtk.Dialog(); ++ _this = this; ++ DialogTemplateSelect = this; ++ ++ // my vars ++ ++ // set gobject values ++ this.el.default_height = 200; ++ this.el.default_width = 400; ++ this.el.modal = true; ++ var child_0 = new Xcls_VBox2(); ++ this.el.get_content_area().add ( child_0.el ); ++ var child_1 = new Xcls_Button8(); ++ this.el.add_action_widget ( child_1.el , 0 ); ++ ++ // listeners ++ this.el.delete_event.connect( (self, event) =>{ ++ this.el.hide(); ++ return true; ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip default_height - already used ++ ++ // skip default_width - already used ++ ++ // skip xtype - not pipe ++ public JsRender.Node? show (Palete.Palete pal, JsRender.Node node) { ++ ++ ++ var opts = pal.listTemplates(node); ++ if (opts.length() < 1) { ++ return node; ++ } ++ ++ //opts.unshift({ path: '' , name :'Just add Element' }); ++ _this.model.loadData(opts); ++ _this.combo.el.set_active(0); ++ ++ this.el.show_all(); ++ this.el.run(); ++ this.el.hide(); ++ var ix = _this.combo.el.get_active(); ++ if (ix < 1 ) { ++ return null; ++ } ++ ++ ++ return pal.loadTemplate(opts.nth_data(ix)); ++ ++ } ++ ++ // skip |modal - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip id - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ public class Xcls_VBox2 ++ { ++ public Gtk.VBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_VBox2() ++ { ++ this.el = new Gtk.VBox( true, 0 ); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_HBox3(); ++ this.el.pack_start ( child_0.el , false,false,0 ); ++ } ++ ++ // userdefined functions ++ ++ // skip xtype - not pipe ++ ++ // skip |pack - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_HBox3 ++ { ++ public Gtk.HBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_HBox3() ++ { ++ this.el = new Gtk.HBox( true, 0 ); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_Label4(); ++ this.el.pack_start ( child_0.el , false,false ); ++ var child_1 = new Xcls_combo(); ++ this.el.add ( child_1.el ); ++ ++ // listeners ++ } ++ ++ // userdefined functions ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip listeners - not pipe ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Label4 ++ { ++ public Gtk.Label el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Label4() ++ { ++ this.el = new Gtk.Label( "Select Template : " ); ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip label - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_combo ++ { ++ public Gtk.ComboBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_combo() ++ { ++ this.el = new Gtk.ComboBox(); ++ _this.combo = this; ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_cellrenderer(); ++ this.el.pack_start ( child_0.el , true ); ++ var child_1 = new Xcls_model(); ++ this.el.set_model ( child_1.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip id - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |init - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_cellrenderer ++ { ++ public Gtk.CellRendererText el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_cellrenderer() ++ { ++ this.el = new Gtk.CellRendererText(); ++ _this.cellrenderer = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip id - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_model ++ { ++ public Gtk.ListStore el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_model() ++ { ++ this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); ++ _this.model = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip id - not pipe ++ ++ // skip n_columns - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |columns - already used ++ public void loadData (GLib.List data) { ++ this.el.clear(); ++ Gtk.TreeIter iter; ++ var el = this.el; ++ ++ el.append(out iter); ++ ++ ++ el.set_value(iter, 0, ""); ++ el.set_value(iter, 1, "Just add Element"); ++ ++ for (var i = 0; i < data.length();i++) { ++ ++ ++ el.append(out iter); ++ var str = data.nth_data(i); ++ var fn = Path.get_basename (str); ++ fn.replace(".json", ""); ++ ++ el.set_value(iter, 0, fn); ++ el.set_value(iter, 1, str); ++ ++ } ++ ++ ++ } ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button8 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button8() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.label = "OK"; ++ } ++ ++ // userdefined functions ++ ++ // skip label - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++} diff --cc Builder4/EditProject.bjs index fca92efe6,fca92efe6..9c3d84c0e --- a/Builder4/EditProject.bjs +++ b/Builder4/EditProject.bjs @@@ -1,1 -1,1 +1,95 @@@ --{"id":"file-gtk-12","name":"EditProject","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/EditProject.bjs","items":[{"|xns":"Gtk","xtype":"Dialog","default_height":500,"default_width":600,"|deletable":true,"|modal":true,"border_width":3,"title":"Project Properties","|show":"function(c) {\n c = c || { name : '' , xtype : '' };\n this.project = c;\n if (!this.el) {\n this.init();\n }\n var _this = this;\n [ 'xtype' ].forEach(function(k) {\n _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n });\n\t// shouild set path..\n \n this.el.show_all();\n this.success = c.success;\n}\n","listeners":{"destroy_event":"function (self, event) {\n this.el.hide();\n return false;\n}","response":"function (self, id) {\n if (id < 1) {\n this.el.hide();\n return;\n }\n if (!this.get('xtype').getValue().length) {\n this.get('/StandardErrorDialog').show(\"You have to set Project type\"); \n return;\n }\n if (!this.get('dir').el.get_filename().length) {\n this.get('/StandardErrorDialog').show(\"You have to select a folder\"); \n return;\n }\n\n this.el.hide();\n \n \n var fn = this.get('dir').el.get_filename();\n \n this.project.name = GLib.basename(fn);\n this.project.xtype = this.get('xtype').getValue();\n this.project.paths = {};\n this.project.paths[fn] = 'dir' ;\n \n var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);\n \n this.success(pr);\n Seed.print(id);\n}"},"items":[{"|xns":"Gtk","xtype":"VBox","|pack":" function(p,e) {\n p.el.get_content_area().add(e.el)\n }\n","items":[{"|xns":"Gtk","xtype":"HBox","pack":"pack_start,false,true,3","items":[{"|xns":"Gtk","xtype":"Label","pack":"pack_start,false,true,3","label":"Project type :"},{"|xns":"Gtk","xtype":"ComboBox","pack":"pack_end,true,true,3","id":"xtype","|setValue":"function(v)\n {\n var el = this.el;\n el.set_active(-1);\n this.get('model').data.forEach(function(n, ix) {\n if (v == n.xtype) {\n el.set_active(ix);\n return false;\n }\n });\n }","|getValue":"function() {\n var ix = this.el.get_active();\n if (ix < 0 ) {\n return '';\n }\n return this.get('model').data[ix].xtype;\n}\n","|init":"function() {\n XObject.prototype.init.call(this);\n this.el.add_attribute(this.items[0].el , 'markup', 1 ); \n}\n","items":[{"|xns":"Gtk","xtype":"CellRendererText","pack":"pack_start"},{"|xns":"Gtk","xtype":"ListStore","pack":"set_model","|init":"function() {\n XObject.prototype.init.call(this);\n\n this.el.set_column_types ( 2, [\n GObject.TYPE_STRING, // real key\n GObject.TYPE_STRING // real type\n \n \n ] );\n \n this.data = [\n { xtype: 'Roo', desc : \"Roo Project\" },\n { xtype: 'Gtk', desc : \"Gtk Project\" }, \n //{ xtype: 'JS', desc : \"Javascript Class\" }\n ]\n \n this.loadData(this.data);\n \n}\n","|loadData":"function (data) {\n \n var iter = new Gtk.TreeIter();\n var el = this.el;\n data.forEach(function(p) {\n \n el.append(iter);\n \n \n el.set_value(iter, 0, p.xtype);\n el.set_value(iter, 1, p.desc);\n \n });\n \n \n}\n","id":"model"}]}]},{"|xns":"Gtk","xtype":"FileChooserWidget","pack":"pack_end,true,true,5","|action":"Gtk.FileChooserAction.SELECT_FOLDER","id":"dir","|select_multiple":false}]},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,1","label":"OK"},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,0","label":"Cancel"}]}]} ++{ ++ "id": "file-gtk-6", ++ "name": "EditProject", ++ "parent": "", ++ "title": false, ++ "path": "/home/alan/gitlive/app.Builder.js/Builder4/EditProject.bjs", ++ "items": [ ++ { ++ "listeners": { ++ "destroy_event": " (self, event) => {\n this.el.hide();\n return false;\n}", ++ "response": " (self, id) => {\n if (id < 1) {\n this.el.hide();\n return;\n }\n if (_this.xtype.getValue().length < 1) {\n StandardErrorDialog.show(\"You have to set Project type\"); \n return;\n }\n if (_this.dir.el.get_filename().length < 1) {\n StandardErrorDialog.show(\"You have to select a folder\"); \n return;\n }\n\n this.el.hide();\n \n \n var fn = _this.dir.el.get_filename();\n \n var project = Project.Project.factory(_this.xtype.getValue(), fn);\n \n \n //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);\n \n this.success(project);\n\n}" ++ }, ++ ".signal:void:success(Project.Project project)": "", ++ "border_width": 3, ++ "default_height": 500, ++ "default_width": 600, ++ "title": "Project Properties", ++ "xtype": "Dialog", ++ "|deletable": "true", ++ "|modal": "true", ++ "|void:show": "() {\n \n\n //[ 'xtype' ].forEach(function(k) {\n // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n //});\n\t// shouild set path..\n _this.model.loadData();\n this.el.show_all();\n //this.success = c.success;\n}\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "xtype": "VBox", ++ "|pack": " get_content_area().add \n \n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "HBox", ++ "pack": "pack_start,false,true,3", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "Label", ++ "pack": "pack_start,false,true,3", ++ "label": "Project type :" ++ }, ++ { ++ "id": "xtype", ++ "pack": "pack_end,true,true,3", ++ "xtype": "ComboBox", ++ "|init": " this.el.add_attribute(cellrender , \"markup\", 1 ); \n \n", ++ "|setValue": " (v) {\n var el = this.el;\n el.set_active(-1);\n \n for (var i =0;i < this.data.length; i++ ) {\n if (v == this.data.nth_datA(i)) {\n el.set_active(ix);\n return false;\n }\n }\n }", ++ "|string:getValue": " () {\n var ix = this.el.get_active();\n if (ix < 0 ) {\n return \"\";\n }\n switch(ix) {\n case 0:\n return \"Roo\";\n case 1:\n return \"Gtk\";\n }\n return \"\";\n}\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "id": "cellrender", ++ "pack": "pack_start,true", ++ "xtype": "CellRendererText", ++ "|xns": "Gtk" ++ }, ++ { ++ "columns": "typeof(string),typeof(string)", ++ "id": "model", ++ "n_columns": 3, ++ "pack": "set_model", ++ "xtype": "ListStore", ++ "|void:loadData": " ( ) {\n this.el.clear();\n \n Gtk.TreeIter iter;\n \n el.append(out iter);\n \n el.set_value(iter, 0, \"Roo\");\n el.set_value(iter, 1, \"Roo Project\");\n el.append(out iter);\n \n el.set_value(iter, 0, \"Gtk\");\n el.set_value(iter, 1, \"Gtk Project\");\n \n \n \n}\n", ++ "|xns": "Gtk" ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "|xns": "Gtk", ++ "xtype": "FileChooserWidget", ++ "pack": "pack_end,true,true,5", ++ "|action": "Gtk.FileChooserAction.SELECT_FOLDER", ++ "id": "dir", ++ "|select_multiple": false ++ } ++ ] ++ }, ++ { ++ "|xns": "Gtk", ++ "xtype": "Button", ++ "pack": "add_action_widget,1", ++ "label": "OK" ++ }, ++ { ++ "|xns": "Gtk", ++ "xtype": "Button", ++ "pack": "add_action_widget,0", ++ "label": "Cancel" ++ } ++ ] ++ } ++ ], ++ "permname": "", ++ "modOrder": "" ++} diff --cc Builder4/EditProject.js index 28a8da02b,28a8da02b..9754d41cc --- a/Builder4/EditProject.js +++ b/Builder4/EditProject.js @@@ -11,68 -11,68 +11,60 @@@ console = imports.console XObject = imports.XObject.XObject; EditProject=new XObject({ xtype: Gtk.Dialog, -- default_height : 500, -- default_width : 600, -- deletable : true, -- modal : true, -- border_width : 3, -- title : "Project Properties", -- show : function(c) { -- c = c || { name : '' , xtype : '' }; -- this.project = c; -- if (!this.el) { -- this.init(); -- } -- var _this = this; -- [ 'xtype' ].forEach(function(k) { -- _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]); -- }); -- // shouild set path.. -- -- this.el.show_all(); -- this.success = c.success; -- }, listeners : { -- destroy_event : function (self, event) { ++ destroy_event : (self, event) => { this.el.hide(); return false; }, -- response : function (self, id) { -- if (id < 1) { ++ response : (self, id) => { ++ if (id < 1) { this.el.hide(); return; -- } -- if (!this.get('xtype').getValue().length) { -- this.get('/StandardErrorDialog').show("You have to set Project type"); -- return; -- } -- if (!this.get('dir').el.get_filename().length) { -- this.get('/StandardErrorDialog').show("You have to select a folder"); -- return; -- } ++ } ++ if (_this.xtype.getValue().length < 1) { ++ StandardErrorDialog.show("You have to set Project type"); ++ return; ++ } ++ if (_this.dir.el.get_filename().length < 1) { ++ StandardErrorDialog.show("You have to select a folder"); ++ return; ++ } ++ ++ this.el.hide(); ++ ++ ++ var fn = _this.dir.el.get_filename(); ++ ++ var project = Project.Project.factory(_this.xtype.getValue(), fn); ++ ++ ++ //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project); ++ ++ this.success(project); -- this.el.hide(); -- -- -- var fn = this.get('dir').el.get_filename(); -- -- this.project.name = GLib.basename(fn); -- this.project.xtype = this.get('xtype').getValue(); -- this.project.paths = {}; -- this.project.paths[fn] = 'dir' ; -- -- var pr = imports.ProjectManager.ProjectManager.update(this.project); -- -- this.success(pr); -- Seed.print(id); } }, ++ border_width : 3, ++ default_height : 500, ++ default_width : 600, ++ title : "Project Properties", ++ deletable : true, ++ modal : true, ++ 'void:show' : () { ++ ++ ++ //[ 'xtype' ].forEach(function(k) { ++ // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]); ++ //}); ++ // shouild set path.. ++ _this.model.loadData(); ++ this.el.show_all(); ++ //this.success = c.success; ++ }, items : [ { xtype: Gtk.VBox, -- pack : function(p,e) { -- p.el.get_content_area().pack_start(e.el,true,true,3); -- }, ++ pack : get_content_area().add, items : [ { xtype: Gtk.HBox, @@@ -85,80 -85,80 +77,67 @@@ }, { xtype: Gtk.ComboBox, -- pack : "pack_end,true,true,3", id : "xtype", -- setValue : function(v) -- { -- var el = this.el; -- el.set_active(-1); -- this.get('model').data.forEach(function(n, ix) { -- if (v == n.xtype) { -- el.set_active(ix); -- return false; -- } -- return true; -- }); -- }, -- getValue : function() { -- var ix = this.el.get_active(); -- if (ix < 0 ) { -- return ''; ++ pack : "pack_end,true,true,3", ++ init : this.el.add_attribute(cellrender , "markup", 1 );, ++ setValue : (v) { ++ var el = this.el; ++ el.set_active(-1); ++ ++ for (var i =0;i < this.data.length; i++ ) { ++ if (v == this.data.nth_datA(i)) { ++ el.set_active(ix); ++ return false; } -- return this.get('model').data[ix].xtype; -- }, -- init : function() { -- XObject.prototype.init.call(this); -- this.el.add_attribute(this.items[0].el , 'markup', 1 ); ++ } ++ }, ++ 'string:getValue' : () { ++ var ix = this.el.get_active(); ++ if (ix < 0 ) { ++ return ""; ++ } ++ switch(ix) { ++ case 0: ++ return "Roo"; ++ case 1: ++ return "Gtk"; ++ } ++ return ""; }, items : [ { xtype: Gtk.CellRendererText, -- pack : "pack_start" ++ id : "cellrender", ++ pack : "pack_start,true" }, { xtype: Gtk.ListStore, ++ columns : "typeof(string),typeof(string)", ++ id : "model", ++ n_columns : 3, pack : "set_model", -- init : function() { -- XObject.prototype.init.call(this); -- -- this.el.set_column_types ( 2, [ -- GObject.TYPE_STRING, // real key -- GObject.TYPE_STRING // real type -- -- -- ] ); -- -- this.data = [ -- { xtype: 'Roo', desc : "Roo Project" }, -- { xtype: 'Gtk', desc : "Gtk Project" }, -- //{ xtype: 'JS', desc : "Javascript Class" } -- ] -- -- this.loadData(this.data); -- -- }, -- loadData : function (data) { -- -- var el = this.el; -- data.forEach(function(p) { -- var ret = {}; -- el.append(ret); -- -- -- el.set_value(ret.iter, 0, p.xtype); -- el.set_value(ret.iter, 1, p.desc); ++ 'void:loadData' : ( ) { ++ this.el.clear(); ++ ++ Gtk.TreeIter iter; -- }); ++ el.append(out iter); ++ ++ el.set_value(iter, 0, "Roo"); ++ el.set_value(iter, 1, "Roo Project"); ++ el.append(out iter); ++ ++ el.set_value(iter, 0, "Gtk"); ++ el.set_value(iter, 1, "Gtk Project"); ++ -- }, -- id : "model" ++ } } ] } ] }, -- { xtype: Gtk.FileChooserWidget, pack : "pack_end,true,true,5", diff --cc Builder4/EditProject.vala index 000000000,000000000..5836b6877 new file mode 100644 --- /dev/null +++ b/Builder4/EditProject.vala @@@ -1,0 -1,0 +1,485 @@@ ++/* -- to compile ++valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \ ++ /tmp/EditProject.vala -o /tmp/EditProject ++*/ ++ ++ ++/* -- to test class ++static int main (string[] args) { ++ Gtk.init (ref args); ++ new Xcls_EditProject(); ++ EditProject.show_all(); ++ Gtk.main (); ++ return 0; ++} ++*/ ++ ++ ++public static Xcls_EditProject EditProject; ++ ++public class Xcls_EditProject ++{ ++ public Gtk.Dialog el; ++ private static Xcls_EditProject _this; ++ ++ public Xcls_xtype xtype; ++ public Xcls_cellrender cellrender; ++ public Xcls_model model; ++ public Xcls_dir dir; ++ ++ // my vars ++ public signal void success(Project.Project project); ++ ++ // ctor ++ public Xcls_EditProject() ++ { ++ this.el = new Gtk.Dialog(); ++ _this = this; ++ EditProject = this; ++ ++ // my vars ++ ++ // set gobject values ++ this.el.border_width = 3; ++ this.el.default_height = 500; ++ this.el.default_width = 600; ++ this.el.deletable = true; ++ this.el.modal = true; ++ this.el.title = "Project Properties"; ++ var child_0 = new Xcls_VBox2(); ++ this.el. get_content_area().add ++ ++ ( child_0.el ); ++ var child_1 = new Xcls_Button9(); ++ this.el.add_action_widget ( child_1.el , 1 ); ++ var child_2 = new Xcls_Button10(); ++ this.el.add_action_widget ( child_2.el , 0 ); ++ ++ // listeners ++ this.el.destroy_event.connect( (self, event) => { ++ this.el.hide(); ++ return false; ++ } ); ++ this.el.response.connect( (self, id) => { ++ if (id < 1) { ++ this.el.hide(); ++ return; ++ } ++ if (_this.xtype.getValue().length < 1) { ++ StandardErrorDialog.show("You have to set Project type"); ++ return; ++ } ++ if (_this.dir.el.get_filename().length < 1) { ++ StandardErrorDialog.show("You have to select a folder"); ++ return; ++ } ++ ++ this.el.hide(); ++ ++ ++ var fn = _this.dir.el.get_filename(); ++ ++ var project = Project.Project.factory(_this.xtype.getValue(), fn); ++ ++ ++ //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project); ++ ++ this.success(project); ++ ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip .signal:void:success(Project.Project project) - already used ++ ++ // skip border_width - already used ++ ++ // skip default_height - already used ++ ++ // skip default_width - already used ++ ++ // skip title - already used ++ ++ // skip xtype - not pipe ++ ++ // skip |deletable - already used ++ ++ // skip |modal - already used ++ public void show() { ++ ++ ++ //[ 'xtype' ].forEach(function(k) { ++ // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]); ++ //}); ++ // shouild set path.. ++ _this.model.loadData(); ++ this.el.show_all(); ++ //this.success = c.success; ++ } ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip id - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ public class Xcls_VBox2 ++ { ++ public Gtk.VBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_VBox2() ++ { ++ this.el = new Gtk.VBox( true, 0 ); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_HBox3(); ++ this.el.pack_start ( child_0.el , false,true,3 ); ++ var child_1 = new Xcls_dir(); ++ this.el.pack_end ( child_1.el , true,true,5 ); ++ } ++ ++ // userdefined functions ++ ++ // skip xtype - not pipe ++ ++ // skip |pack - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_HBox3 ++ { ++ public Gtk.HBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_HBox3() ++ { ++ this.el = new Gtk.HBox( true, 0 ); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_Label4(); ++ this.el.pack_start ( child_0.el , false,true,3 ); ++ var child_1 = new Xcls_xtype(); ++ this.el.pack_end ( child_1.el , true,true,3 ); ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Label4 ++ { ++ public Gtk.Label el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Label4() ++ { ++ this.el = new Gtk.Label( "Project type :" ); ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip label - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_xtype ++ { ++ public Gtk.ComboBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_xtype() ++ { ++ this.el = new Gtk.ComboBox(); ++ _this.xtype = this; ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_cellrender(); ++ this.el.pack_start ( child_0.el , true ); ++ var child_1 = new Xcls_model(); ++ this.el.set_model ( child_1.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip id - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |init - already used ++ ++ // skip |setValue - no return type ++ public string getValue () { ++ var ix = this.el.get_active(); ++ if (ix < 0 ) { ++ return ""; ++ } ++ switch(ix) { ++ case 0: ++ return "Roo"; ++ case 1: ++ return "Gtk"; ++ } ++ return ""; ++ } ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_cellrender ++ { ++ public Gtk.CellRendererText el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_cellrender() ++ { ++ this.el = new Gtk.CellRendererText(); ++ _this.cellrender = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip id - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_model ++ { ++ public Gtk.ListStore el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_model() ++ { ++ this.el = new Gtk.ListStore( 3, "typeof(string),typeof(string)" ); ++ _this.model = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip columns - already used ++ ++ // skip id - not pipe ++ ++ // skip n_columns - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ public void loadData ( ) { ++ this.el.clear(); ++ ++ Gtk.TreeIter iter; ++ ++ el.append(out iter); ++ ++ el.set_value(iter, 0, "Roo"); ++ el.set_value(iter, 1, "Roo Project"); ++ el.append(out iter); ++ ++ el.set_value(iter, 0, "Gtk"); ++ el.set_value(iter, 1, "Gtk Project"); ++ ++ ++ ++ } ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_dir ++ { ++ public Gtk.FileChooserWidget el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_dir() ++ { ++ this.el = new Gtk.FileChooserWidget( Gtk.FileChooserAction.SELECT_FOLDER ); ++ _this.dir = this; ++ ++ // my vars ++ ++ // set gobject values ++ this.el.select_multiple = false; ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip |action - already used ++ ++ // skip id - not pipe ++ ++ // skip |select_multiple - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button9 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button9() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.label = "OK"; ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip label - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button10 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button10() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.label = "Cancel"; ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip label - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++} diff --cc Builder4/Editor.bjs index 60562ab7c,60562ab7c..bdc72422b --- a/Builder4/Editor.bjs +++ b/Builder4/Editor.bjs @@@ -3,28 -3,28 +3,28 @@@ "name": "Editor", "parent": "", "title": false, -- "path": "/home/alan/gitlive/app.Builder/Builder4/Editor.bjs", ++ "path": "/home/alan/gitlive/app.Builder.js/Builder4/Editor.bjs", "items": [ { "listeners": { -- "delete_event": "function (self, event) {\n if (!this.get('/Editor.RightEditor').save()) {\n // no hiding with errors.\n return true;\n }\n this.el.hide();\n this.get('/Editor').activePath = false;\n return true;\n}\n/*--\n\n(event) => {\n if (!Editor.RightEditor.save()) {\n // no hiding with errors.\n return true;\n }\n _this.el.hide();\n _this.active_path = \"\";\n return true;\n}\n\n*/", -- "configure_event": "function (self, object) {\n this.pos = this.el.get_position();\n\n return false;\n}\n/*--\n (object) => {\n _this.pos = true;\n this.el.get_position(out _this.pos_root_x, out _this.pos_root_y);\n\n\n return false;\n}\n*/\n", -- "show": "function (self) {\n if (this.pos) {\n this.el.set_uposition(this.pos.root_x,this.pos.root_y);\n }\n}\n/*--\n () => {\n if (this.pos) {\n _this.el.move(this.pos_root_x,this.pos_root_y);\n }\n}\n\n*/" ++ "configure_event": " (object) => {\n _this.pos = true;\n this.el.get_position(out _this.pos_root_x, out _this.pos_root_y);\n\n\n return false;\n}\n \n", ++ "show": " () => {\n if (this.pos) {\n _this.el.move(this.pos_root_x,this.pos_root_y);\n }\n}\n " }, -- ".activeEditor": "string:\"\"", -- ".active_path": "string:\"\"", -- ".dirty": "bool:false", -- ".pos": "bool:false", -- ".pos_root_x": "int", -- ".pos_root_y": "int", ++ ".bool:dirty": "false", ++ ".bool:pos": "false", ++ ".int:pos_root_x": "", ++ ".int:pos_root_y": "", ++ ".string:activeEditor": "\"\"", ++ ".string:active_path": "\"\"", "height_request": 300, "id": "Editor", "title": "Application Builder - Code Editor", "width_request": 500, "xtype": "Window", ++ "|bool:save": " () {\n\n if (!Editor.RightEditor.save()) {\n // no hiding with errors.\n return true;\n }\n _this.active_path = \"\";\n _this.el.hide();\n return true;\n\n} ", "|init": "function() {\n XObject.prototype.init.call(this);\n // this.show_all();\n}\n", -- "|save": "function (self, event) {\n if (!this.get('/Editor.RightEditor').save()) {\n // no hiding with errors.\n return true;\n }\n this.get('/Editor').activePath = false;\n this.el.hide();\n return true;\n}\n/*--\n\nbool () {\n\n if (!Editor.RightEditor.save()) {\n // no hiding with errors.\n return true;\n }\n _this.active_path = \"\";\n _this.el.hide();\n return true;\n\n}\n*/", -- "|show_all": "function() {\n \n}\n/*--\nvoid () {\n this.el.show_all();\n\n}\n*/", ++ "|show_all": " (event) => {\n if (!Editor.RightEditor.save()) {\n // no hiding with errors.\n return true;\n }\n _this.el.hide();\n _this.active_path = \"\";\n return true;\n}\n ", ++ "|void:show_all": " () {\n this.el.show_all();\n\n}\n ", "|xns": "Gtk", "items": [ { @@@ -40,7 -40,7 +40,7 @@@ "items": [ { "listeners": { -- "clicked": "function (self) {\n\n this.get('/Editor.RightEditor').save();\n}\n/*--\n() => { \n Editor.RightEditor.save();\n}\n\n*/\n" ++ "clicked": " () => { \n Editor.RightEditor.save();\n}\n \n" }, "id": "save_button", "label": "Save", @@@ -53,34 -53,34 +53,34 @@@ "id": "RightEditor", "pack": "add", "xtype": "ScrolledWindow", -- "|save": "function() {\n // make sure we have an active path..\n if (!this.get('/Editor').activePath) {\n return true;\n }\n \n var str = this.get('/Editor.buffer').toString();\n if (!this.get('/Editor.buffer').checkSyntax()) {\n this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n return false;\n }\n \n this.get('/LeftPanel.model').changed( str , false);\n this.get('/Editor').dirty = false;\n this.get('/Editor.save_button').el.sensitive = false;\n return true;\n}\n/*--\nbool () {\n print(\"editor.rightbutton.save\");\n if (_this.active_path.length < 1 ) {\n print(\"skip - no active path\");\n return true;\n }\n \n var str = Editor.buffer.toString();\n \n if (!Editor.buffer.checkSyntax()) {\n print(\"check syntax failed\");\n //this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n return false;\n }\n \n // LeftPanel.model.changed( str , false);\n _this.dirty = false;\n _this.save_button.el.sensitive = false;\n print(\"set save button grey\");\n return true;\n}\n\n*/", ++ "|bool:save": " () {\n print(\"editor.rightbutton.save\");\n if (_this.active_path.length < 1 ) {\n print(\"skip - no active path\");\n return true;\n }\n \n var str = Editor.buffer.toString();\n \n if (!Editor.buffer.checkSyntax()) {\n print(\"check syntax failed\");\n //this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n return false;\n }\n \n // LeftPanel.model.changed( str , false);\n _this.dirty = false;\n _this.save_button.el.sensitive = false;\n print(\"set save button grey\");\n return true;\n}\n ", "|xns": "Gtk", "items": [ { "listeners": { -- "key_release_event": "function (self, event) {\n \n if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) ) {\n print(\"SAVE: ctrl-S pressed\");\n this.save();\n return false;\n }\n // print(event.key.keyval)\n \n return false;\n}\n/*--\n(event) => {\n \n if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {\n print(\"SAVE: ctrl-S pressed\");\n this.save();\n return false;\n }\n // print(event.key.keyval)\n \n return false;\n\n}\n*/\n\n" ++ "key_release_event": " (event) => {\n \n if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {\n print(\"SAVE: ctrl-S pressed\");\n this.save();\n return false;\n }\n // print(event.key.keyval)\n \n return false;\n\n} \n\n" }, "id": "view", "indent_width": 4, "pack": "add", "xtype": "View", "|auto_indent": "true", -- "|init": "function() {\n XObject.prototype.init.call(this);\n var description = Pango.Font.description_from_string(\"monospace\")\n description.set_size(8000);\n this.el.modify_font(description);\n\n}\n/*--\n\n var description = Pango.FontDescription.from_string(\"monospace\");\n description.set_size(8000);\n this.el.override_font(description);\n\n\n*/\n", ++ "|init": " \n var description = Pango.FontDescription.from_string(\"monospace\");\n description.set_size(8000);\n this.el.override_font(description);\n\n ", "|insert_spaces_instead_of_tabs": "true", -- "|load": "function(str) {\n\n// show the help page for the active node..\n //this.get('/Help').show();\n\n\n // this.get('/BottomPane').el.set_current_page(0);\n this.el.get_buffer().set_text(str, str.length);\n var lm = GtkSource.LanguageManager.get_default();\n \n this.el.get_buffer().set_language(lm.get_language('js'));\n var buf = this.el.get_buffer();\n var cursor = buf.get_mark(\"insert\");\n var iter= new Gtk.TextIter;\n buf.get_iter_at_mark(iter, cursor);\n iter.set_line(1);\n iter.set_line_offset(4);\n buf.move_mark(cursor, iter);\n \n \n cursor = buf.get_mark(\"selection_bound\");\n iter= new Gtk.TextIter;\n buf.get_iter_at_mark(iter, cursor);\n iter.set_line(1);\n iter.set_line_offset(4);\n buf.move_mark(cursor, iter);\n this.get('/Editor').dirty = false;\n this.el.grab_focus();\n this.get('/Editor.save_button').el.sensitive = false;\n}", -- "|save": "function() {\n \n return this.get('/Editor.RightEditor').save();\n\n}\n/*--\nvoid () {\n\n Editor.RightEditor.save();\n}\n*/", "|show_line_numbers": "true", ++ "|void:load": " (string str) {\n\n// show the help page for the active node..\n //this.get('/Help').show();\n\n\n // this.get('/BottomPane').el.set_current_page(0);\n this.el.get_buffer().set_text(str, str.length);\n var lm = Gtk.SourceLanguageManager.get_default();\n \n ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lm.get_language(\"js\"));\n var buf = this.el.get_buffer();\n var cursor = buf.get_mark(\"insert\");\n Gtk.TextIter iter;\n buf.get_iter_at_mark(out iter, cursor);\n iter.set_line(1);\n iter.set_line_offset(4);\n buf.move_mark(cursor, iter);\n \n \n cursor = buf.get_mark(\"selection_bound\");\n //iter= new Gtk.TextIter;\n buf.get_iter_at_mark(out iter, cursor);\n iter.set_line(1);\n iter.set_line_offset(4);\n buf.move_mark(cursor, iter);\n Editor.dirty = false;\n this.el.grab_focus();\n _this.save_button.el.sensitive = false;\n}", ++ "|void:save": " () {\n\n Editor.RightEditor.save();\n}\n ", "|xns": "GtkSource", "items": [ { "listeners": { -- "changed": "function (self) {\n\n if(this.checkSyntax()) {\n this.get('/Editor.save_button').el.sensitive = true;\n }\n // print(\"EDITOR CHANGED\");\n this.get('/Editor').dirty = true;\n\n // this.get('/LeftPanel.model').changed( str , false);\n return false;\n}\n\n/*--\n\n() => {\n // check syntax??\n if(this.checkSyntax()) {\n Editor.save_button.el.sensitive = true;\n }\n // print(\"EDITOR CHANGED\");\n Editor.dirty = true;\n\n // this.get('/LeftPanel.model').changed( str , false);\n return ;\n}\n\n\n*/\n\n\n" ++ "changed": " () => {\n // check syntax??\n if(this.checkSyntax()) {\n Editor.save_button.el.sensitive = true;\n }\n // print(\"EDITOR CHANGED\");\n Editor.dirty = true;\n\n // this.get('/LeftPanel.model').changed( str , false);\n return ;\n}\n\n \n" }, "id": "buffer", "pack": "set_buffer", "xtype": "Buffer", -- "|checkSyntax": "function() {\n var str = this.toString();\n var res = '';\n try {\n // print('var res = ' + str);\n Seed.check_syntax('var res = ' + str);\n \n \n } catch (e) {\n \n this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC\n }));\n print(\"SYNTAX ERROR IN EDITOR\"); \n print(e);\n // print(str);\n //console.dump(e);\n return false;\n }\n this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF\n }));\n \n return true;\n}\n/*--\nbool () { \n // we could try running valac... ?? but it's a bit confusing..\n return true;\n\n}\n\n\n*/", -- "|toString": "function() {\n \n var s = new Gtk.TextIter();\n var e = new Gtk.TextIter();\n this.el.get_start_iter(s);\n this.el.get_end_iter(e);\n var ret = this.el.get_text(s,e,true);\n //print(\"TO STRING? \" + ret);\n return ret;\n}\n/*--\nstring () {\n \n Gtk.TextIter s;\n Gtk.TextIter e;\n this.el.get_start_iter(out s);\n this.el.get_end_iter(out e);\n var ret = this.el.get_text(s,e,true);\n //print(\"TO STRING? \" + ret);\n return ret;\n}\n\n*/", ++ "|bool:checkSyntax": " () {\n /*\n var str = this.toString();\n var res = \"\";\n /*\n try {\n // print('var res = ' + str);\n Seed.check_syntax('var res = ' + str);\n \n \n } catch (e) {\n \n this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC\n }));\n print(\"SYNTAX ERROR IN EDITOR\"); \n print(e);\n // print(str);\n //console.dump(e);\n return false;\n }\n this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF\n }));\n */\n return true;\n}\n", ++ "|string:toString": " () {\n \n Gtk.TextIter s;\n Gtk.TextIter e;\n this.el.get_start_iter(out s);\n this.el.get_end_iter(out e);\n var ret = this.el.get_text(s,e,true);\n //print(\"TO STRING? \" + ret);\n return ret;\n}\n ", "|xns": "GtkSource" } ] diff --cc Builder4/Editor.js index 4822afa62,4822afa62..7e5d039d0 --- a/Builder4/Editor.js +++ b/Builder4/Editor.js @@@ -12,96 -12,96 +12,51 @@@ XObject = imports.XObject.XObject Editor=new XObject({ xtype: Gtk.Window, listeners : { -- delete_event : function (self, event) { -- if (!this.get('/Editor.RightEditor').save()) { -- // no hiding with errors. -- return true; -- } -- this.el.hide(); -- this.get('/Editor').activePath = false; -- return true; -- } -- /*-- -- -- (event) => { -- if (!Editor.RightEditor.save()) { -- // no hiding with errors. -- return true; -- } -- _this.el.hide(); -- _this.active_path = ""; -- return true; -- } -- -- */, -- configure_event : function (self, object) { -- this.pos = this.el.get_position(); -- -- return false; -- } -- /*-- -- (object) => { ++ configure_event : (object) => { _this.pos = true; this.el.get_position(out _this.pos_root_x, out _this.pos_root_y); return false; -- } -- */, -- show : function (self) { -- if (this.pos) { -- this.el.set_uposition(this.pos.root_x,this.pos.root_y); -- } -- } -- /*-- -- () => { ++ }, ++ show : () => { if (this.pos) { _this.el.move(this.pos_root_x,this.pos_root_y); } } -- -- */ }, height_request : 300, id : "Editor", title : "Application Builder - Code Editor", width_request : 500, -- init : function() { -- XObject.prototype.init.call(this); -- // this.show_all(); -- }, -- save : function (self, event) { -- if (!this.get('/Editor.RightEditor').save()) { ++ 'bool:save' : () { ++ ++ if (!Editor.RightEditor.save()) { // no hiding with errors. return true; } -- this.get('/Editor').activePath = false; -- this.el.hide(); ++ _this.active_path = ""; ++ _this.el.hide(); return true; -- } -- /*-- -- -- bool () { ++ }, ++ init : function() { ++ XObject.prototype.init.call(this); ++ // this.show_all(); ++ }, ++ show_all : (event) => { if (!Editor.RightEditor.save()) { // no hiding with errors. return true; } -- _this.active_path = ""; _this.el.hide(); ++ _this.active_path = ""; return true; -- -- } -- */, -- show_all : function() { -- -- } -- /*-- -- void () { ++ }, ++ 'void:show_all' : () { this.el.show_all(); -- } -- */, ++ }, items : [ { xtype: Gtk.VBox, @@@ -115,16 -115,16 +70,9 @@@ { xtype: Gtk.ToolButton, listeners : { -- clicked : function (self) { -- -- this.get('/Editor.RightEditor').save(); -- } -- /*-- -- () => { ++ clicked : () => { Editor.RightEditor.save(); } -- -- */ }, id : "save_button", label : "Save" @@@ -135,25 -135,25 +83,7 @@@ xtype: Gtk.ScrolledWindow, id : "RightEditor", pack : "add", -- save : function() { -- // make sure we have an active path.. -- if (!this.get('/Editor').activePath) { -- return true; -- } -- -- var str = this.get('/Editor.buffer').toString(); -- if (!this.get('/Editor.buffer').checkSyntax()) { -- this.get('/StandardErrorDialog').show("Fix errors in code and save.."); -- return false; -- } -- -- this.get('/LeftPanel.model').changed( str , false); -- this.get('/Editor').dirty = false; -- this.get('/Editor.save_button').el.sensitive = false; -- return true; -- } -- /*-- -- bool () { ++ 'bool:save' : () { print("editor.rightbutton.save"); if (_this.active_path.length < 1 ) { print("skip - no active path"); @@@ -173,26 -173,26 +103,12 @@@ _this.save_button.el.sensitive = false; print("set save button grey"); return true; -- } -- -- */, ++ }, items : [ { xtype: GtkSource.View, listeners : { -- key_release_event : function (self, event) { -- -- if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) ) { -- print("SAVE: ctrl-S pressed"); -- this.save(); -- return false; -- } -- // print(event.key.keyval) -- -- return false; -- } -- /*-- -- (event) => { ++ key_release_event : (event) => { if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) { print("SAVE: ctrl-S pressed"); @@@ -204,29 -204,29 +120,17 @@@ return false; } -- */ }, id : "view", indent_width : 4, pack : "add", auto_indent : true, -- init : function() { -- XObject.prototype.init.call(this); -- var description = Pango.Font.description_from_string("monospace") -- description.set_size(8000); -- this.el.modify_font(description); -- -- } -- /*-- -- -- var description = Pango.FontDescription.from_string("monospace"); ++ init : var description = Pango.FontDescription.from_string("monospace"); description.set_size(8000); -- this.el.override_font(description); -- -- -- */, ++ this.el.override_font(description);, insert_spaces_instead_of_tabs : true, -- load : function(str) { ++ show_line_numbers : true, ++ 'void:load' : (string str) { // show the help page for the active node.. //this.get('/Help').show(); @@@ -234,59 -234,59 +138,37 @@@ // this.get('/BottomPane').el.set_current_page(0); this.el.get_buffer().set_text(str, str.length); -- var lm = GtkSource.LanguageManager.get_default(); ++ var lm = Gtk.SourceLanguageManager.get_default(); -- this.el.get_buffer().set_language(lm.get_language('js')); ++ ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lm.get_language("js")); var buf = this.el.get_buffer(); var cursor = buf.get_mark("insert"); -- var iter= new Gtk.TextIter; -- buf.get_iter_at_mark(iter, cursor); ++ Gtk.TextIter iter; ++ buf.get_iter_at_mark(out iter, cursor); iter.set_line(1); iter.set_line_offset(4); buf.move_mark(cursor, iter); cursor = buf.get_mark("selection_bound"); -- iter= new Gtk.TextIter; -- buf.get_iter_at_mark(iter, cursor); ++ //iter= new Gtk.TextIter; ++ buf.get_iter_at_mark(out iter, cursor); iter.set_line(1); iter.set_line_offset(4); buf.move_mark(cursor, iter); -- this.get('/Editor').dirty = false; ++ Editor.dirty = false; this.el.grab_focus(); -- this.get('/Editor.save_button').el.sensitive = false; ++ _this.save_button.el.sensitive = false; }, -- save : function() { -- -- return this.get('/Editor.RightEditor').save(); -- -- } -- /*-- -- void () { ++ 'void:save' : () { Editor.RightEditor.save(); -- } -- */, -- show_line_numbers : true, ++ }, items : [ { xtype: GtkSource.Buffer, listeners : { -- changed : function (self) { -- -- if(this.checkSyntax()) { -- this.get('/Editor.save_button').el.sensitive = true; -- } -- // print("EDITOR CHANGED"); -- this.get('/Editor').dirty = true; -- -- // this.get('/LeftPanel.model').changed( str , false); -- return false; -- } -- -- /*-- -- -- () => { ++ changed : () => { // check syntax?? if(this.checkSyntax()) { Editor.save_button.el.sensitive = true; @@@ -297,15 -297,15 +179,14 @@@ // this.get('/LeftPanel.model').changed( str , false); return ; } -- -- -- */ }, id : "buffer", pack : "set_buffer", -- checkSyntax : function() { ++ 'bool:checkSyntax' : () { ++ /* var str = this.toString(); -- var res = ''; ++ var res = ""; ++ /* try { // print('var res = ' + str); Seed.check_syntax('var res = ' + str); @@@ -325,30 -325,30 +206,10 @@@ this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({ red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF })); -- -- return true; -- } -- /*-- -- bool () { -- // we could try running valac... ?? but it's a bit confusing.. ++ */ return true; -- -- } -- -- -- */, -- toString : function() { -- -- var s = new Gtk.TextIter(); -- var e = new Gtk.TextIter(); -- this.el.get_start_iter(s); -- this.el.get_end_iter(e); -- var ret = this.el.get_text(s,e,true); -- //print("TO STRING? " + ret); -- return ret; -- } -- /*-- -- string () { ++ }, ++ 'string:toString' : () { Gtk.TextIter s; Gtk.TextIter e; @@@ -358,8 -358,8 +219,6 @@@ //print("TO STRING? " + ret); return ret; } -- -- */ } ] } diff --cc Builder4/Editor.vala index 5e3c419cf,5e3c419cf..57f2f6d08 --- a/Builder4/Editor.vala +++ b/Builder4/Editor.vala @@@ -17,23 -17,23 +17,23 @@@ static int main (string[] args) public static Xcls_Editor Editor; --private static Xcls_Editor _this; -- public class Xcls_Editor { public Gtk.Window el; ++ private static Xcls_Editor _this; ++ public Xcls_save_button save_button; public Xcls_RightEditor RightEditor; public Xcls_view view; public Xcls_buffer buffer; // my vars -- public string activeEditor; -- public string active_path; public bool dirty; public bool pos; public int pos_root_x; public int pos_root_y; ++ public string activeEditor; ++ public string active_path; // ctor public Xcls_Editor() @@@ -43,10 -43,10 +43,10 @@@ Editor = this; // my vars -- this.activeEditor = ""; -- this.active_path = ""; this.dirty = false; this.pos = false; ++ this.activeEditor = ""; ++ this.active_path = ""; // set gobject values this.el.height_request = 300; @@@ -56,44 -56,44 +56,38 @@@ this.el.add ( child_0.el ); // listeners -- this.el.delete_event.connect( (event) => { -- if (!Editor.RightEditor.save()) { -- // no hiding with errors. -- return true; -- } -- _this.el.hide(); -- _this.active_path = ""; -- return true; -- } ); this.el.configure_event.connect( (object) => { _this.pos = true; this.el.get_position(out _this.pos_root_x, out _this.pos_root_y); return false; -- } ); -- this.el.show.connect( () => { ++ } ++ ++ ); ++ this.el.show.connect( () => { if (this.pos) { _this.el.move(this.pos_root_x,this.pos_root_y); } -- } ); ++ } ++ ); } // userdefined functions // skip listeners - not pipe -- // skip .activeEditor - already used ++ // skip .bool:dirty - already used -- // skip .active_path - already used ++ // skip .bool:pos - already used -- // skip .dirty - already used ++ // skip .int:pos_root_x - already used -- // skip .pos - already used ++ // skip .int:pos_root_y - already used -- // skip .pos_root_x - already used ++ // skip .string:activeEditor - already used -- // skip .pos_root_y - already used ++ // skip .string:active_path - already used // skip height_request - already used @@@ -104,9 -104,9 +98,7 @@@ // skip width_request - already used // skip xtype - not pipe -- -- // skip |init - already used -- public bool save() { ++ public bool save () { if (!Editor.RightEditor.save()) { // no hiding with errors. @@@ -116,13 -116,13 +108,18 @@@ _this.el.hide(); return true; -- } -- public void show_all() { ++ } ++ ++ // skip |init - already used ++ ++ // skip |show_all - no return type ++ public void show_all () { this.el.show_all(); } ++ -- // skip |xns - could not find seperator ++ // skip |xns - no return type // skip items - not pipe @@@ -159,7 -159,7 +156,7 @@@ // skip xtype - not pipe -- // skip |xns - could not find seperator ++ // skip |xns - no return type // skip items - not pipe @@@ -193,7 -193,7 +190,7 @@@ // skip xtype - not pipe -- // skip |xns - could not find seperator ++ // skip |xns - no return type // skip items - not pipe @@@ -220,9 -220,9 +217,11 @@@ // set gobject values // listeners -- this.el.clicked.connect( () => { ++ this.el.clicked.connect( () => { Editor.RightEditor.save(); -- } ); ++ } ++ ++ ); } // userdefined functions @@@ -235,7 -235,7 +234,7 @@@ // skip xtype - not pipe -- // skip |xns - could not find seperator ++ // skip |xns - no return type // skip xvala_cls - not pipe @@@ -269,7 -269,7 +268,7 @@@ // skip pack - not pipe // skip xtype - not pipe -- public bool save() { ++ public bool save () { print("editor.rightbutton.save"); if (_this.active_path.length < 1 ) { print("skip - no active path"); @@@ -290,8 -290,8 +289,9 @@@ print("set save button grey"); return true; } ++ -- // skip |xns - could not find seperator ++ // skip |xns - no return type // skip items - not pipe @@@ -323,13 -323,13 +323,8 @@@ var child_0 = new Xcls_buffer(); this.el.set_buffer ( child_0.el ); -- // init method -- var description = Pango.FontDescription.from_string("monospace"); -- description.set_size(8000); -- this.el.override_font(description); -- // listeners -- this.el.key_release_event.connect( (event) => { ++ this.el.key_release_event.connect( (event) => { if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) { print("SAVE: ctrl-S pressed"); @@@ -340,7 -340,7 +335,9 @@@ return false; -- } ); ++ } ++ ++ ); } // userdefined functions @@@ -361,15 -361,15 +358,44 @@@ // skip |insert_spaces_instead_of_tabs - already used -- // skip |load - could not find seperator -- public void save() { ++ // skip |show_line_numbers - already used ++ public void load (string str) { ++ ++ // show the help page for the active node.. ++ //this.get('/Help').show(); ++ ++ ++ // this.get('/BottomPane').el.set_current_page(0); ++ this.el.get_buffer().set_text(str, str.length); ++ var lm = Gtk.SourceLanguageManager.get_default(); ++ ++ ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lm.get_language("js")); ++ var buf = this.el.get_buffer(); ++ var cursor = buf.get_mark("insert"); ++ Gtk.TextIter iter; ++ buf.get_iter_at_mark(out iter, cursor); ++ iter.set_line(1); ++ iter.set_line_offset(4); ++ buf.move_mark(cursor, iter); ++ ++ ++ cursor = buf.get_mark("selection_bound"); ++ //iter= new Gtk.TextIter; ++ buf.get_iter_at_mark(out iter, cursor); ++ iter.set_line(1); ++ iter.set_line_offset(4); ++ buf.move_mark(cursor, iter); ++ Editor.dirty = false; ++ this.el.grab_focus(); ++ _this.save_button.el.sensitive = false; ++ } ++ public void save () { Editor.RightEditor.save(); } ++ -- // skip |show_line_numbers - already used -- -- // skip |xns - could not find seperator ++ // skip |xns - no return type // skip items - not pipe @@@ -396,7 -396,7 +422,7 @@@ // set gobject values // listeners -- this.el.changed.connect( () => { ++ this.el.changed.connect( () => { // check syntax?? if(this.checkSyntax()) { Editor.save_button.el.sensitive = true; @@@ -406,7 -406,7 +432,10 @@@ // this.get('/LeftPanel.model').changed( str , false); return ; -- } ); ++ } ++ ++ ++ ); } // userdefined functions @@@ -418,12 -418,12 +447,34 @@@ // skip pack - not pipe // skip xtype - not pipe -- public bool checkSyntax() { -- // we could try running valac... ?? but it's a bit confusing.. ++ public bool checkSyntax () { ++ /* ++ var str = this.toString(); ++ var res = ""; ++ /* ++ try { ++ // print('var res = ' + str); ++ Seed.check_syntax('var res = ' + str); ++ ++ ++ } catch (e) { ++ ++ this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({ ++ red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC ++ })); ++ print("SYNTAX ERROR IN EDITOR"); ++ print(e); ++ // print(str); ++ //console.dump(e); ++ return false; ++ } ++ this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({ ++ red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF ++ })); ++ */ return true; -- } -- public string toString() { ++ public string toString () { Gtk.TextIter s; Gtk.TextIter e; @@@ -433,8 -433,8 +484,9 @@@ //print("TO STRING? " + ret); return ret; } ++ -- // skip |xns - could not find seperator ++ // skip |xns - no return type // skip xvala_cls - not pipe diff --cc Builder4/RooProjectProperties.bjs index 4c4d01389,4c4d01389..0f8914150 --- a/Builder4/RooProjectProperties.bjs +++ b/Builder4/RooProjectProperties.bjs @@@ -1,1 -1,1 +1,64 @@@ --{"id":"file-gtk-9","name":"RooProjectProperties","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/RooProjectProperties.bjs","items":[{"|xns":"Gtk","xtype":"Dialog","|modal":true,"|show":"function() {\n // get the active project.\n var file = this.get('/Window.LeftTree').getActiveFile();\n if (!file) {\n this.get('/StandardErrorDialog').show(\"No file is currently active\");\n return;\n }\n var project = this.get('/Window.LeftTree').getActiveFile().project;\n //print (project.fn);\n project.runhtml = project.runhtml || '';\n this.get('view').el.get_buffer().set_text(project.runhtml, project.runhtml.length);\n \n this.el.show_all();\n}\n","default_width":500,"listeners":{"delete_event":"function (self, event) {\n this.el.hide()\n return true;\n}","response":"function (self, response_id) {\n print(response_id);\n if (!response_id) {\n this.el.hide();\n \n return;\n }\n var buf = this.get('view').el.get_buffer()\n var s = new Gtk.TextIter();\n var e = new Gtk.TextIter();\n buf.get_start_iter(s);\n buf.get_end_iter(e);\n var str = buf.get_text(s,e,true);\n // ideally we should syntax check it.. but it's html!?\n \n var project = this.get('/Window.LeftTree').getActiveFile().project;\n \n \n project.runhtml = str;\n \n imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();\n// print (str);\n // this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);\n // ok pressed..\n this.el.hide();\n}"},"items":[{"|xns":"Gtk","xtype":"VBox","|pack":" function(p,e) {\n p.el.get_content_area().add(e.el);\n e.border_width =5;\n }\n","items":[{"|xns":"Gtk","xtype":"Label","pack":"pack_start,false,false,0","label":"HTML To insert at end of "},{"|xns":"Gtk","xtype":"ScrolledWindow","pack":"pack_end,true,true,0","items":[{"|xns":"GtkSource","xtype":"View","pack":"add","id":"view"}]}]},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,1","label":"OK"},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,0","label":"Cancel"}]}]} ++{ ++ "id": "file-gtk-8", ++ "name": "RooProjectProperties", ++ "parent": "", ++ "title": false, ++ "path": "/home/alan/gitlive/app.Builder.js/Builder4/RooProjectProperties.bjs", ++ "items": [ ++ { ++ "listeners": { ++ "delete_event": " (self, event) => {\n this.el.hide();\n return true;\n}", ++ "response": " (self, response_id) => {\n //print(response_id);\n if (response_id< 1 ) {\n this.el.hide();\n \n return;\n }\n \n var buf = view.el.get_buffer();\n Gtk.TextIter s;\n Gtk.TextIter e;\n buf.get_start_iter(out s);\n buf.get_end_iter(out e);\n var str = buf.get_text(s,e,true);\n // ideally we should syntax check it.. but it's html!?\n \n //var project = this.get('/Window.LeftTree').getActiveFile().project;\n \n \n _this.project.runhtml = str;\n _this.project.save();\n \n // imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();\n// print (str);\n // this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);\n // ok pressed..\n this.el.hide();\n}" ++ }, ++ ".Project.Project:project": "", ++ "default_width": 500, ++ "xtype": "Dialog", ++ "|modal": "true", ++ "|void:show": " (Project.Project project) {\n _this.project = project;\n // get the active project.\n \n //print (project.fn);\n //project.runhtml = project.runhtml || '';\n _this.view.el.get_buffer().set_text(project.runhtml);\n \n this.el.show_all();\n}\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "border_width": 5, ++ "xtype": "VBox", ++ "|pack": " get_content_area().add\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "Label", ++ "pack": "pack_start,false,false,0", ++ "label": "HTML To insert at end of " ++ }, ++ { ++ "|xns": "Gtk", ++ "xtype": "ScrolledWindow", ++ "pack": "pack_end,true,true,0", ++ "items": [ ++ { ++ "|xns": "GtkSource", ++ "xtype": "View", ++ "pack": "add", ++ "id": "view" ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "|xns": "Gtk", ++ "xtype": "Button", ++ "pack": "add_action_widget,1", ++ "label": "OK" ++ }, ++ { ++ "|xns": "Gtk", ++ "xtype": "Button", ++ "pack": "add_action_widget,0", ++ "label": "Cancel" ++ } ++ ] ++ } ++ ], ++ "permname": "", ++ "modOrder": "" ++} diff --cc Builder4/RooProjectProperties.js index 3f907689c,3f907689c..c70e8954d --- a/Builder4/RooProjectProperties.js +++ b/Builder4/RooProjectProperties.js @@@ -11,116 -11,116 +11,76 @@@ console = imports.console XObject = imports.XObject.XObject; RooProjectProperties=new XObject({ xtype: Gtk.Dialog, -- modal : true, -- show : function() { -- // get the active project. -- var file = this.get('/Window.LeftTree').getActiveFile(); -- if (!file) { -- this.get('/StandardErrorDialog').show("No file is currently active"); -- return; -- } -- var project = this.get('/Window.LeftTree').getActiveFile().project; -- //print (project.fn); -- project.runhtml = project.runhtml || ''; -- this.get('view').el.get_buffer().set_text(project.runhtml, project.runhtml.length); -- this.get('dbcon').el.set_text(project.dbcon || ''); -- print("project db: " + project.dbcon); -- this.el.show_all(); -- }, -- default_width : 500, listeners : { -- delete_event : function (self, event) { -- this.el.hide() -- return true; ++ delete_event : (self, event) => { ++ this.el.hide(); ++ return true; }, -- response : function (self, response_id) { -- print(response_id); -- if (!response_id) { ++ response : (self, response_id) => { ++ //print(response_id); ++ if (response_id< 1 ) { this.el.hide(); return; } -- var buf = this.get('view').el.get_buffer() -- var e = {}; -- var s = {}; -- buf.get_start_iter(s); -- buf.get_end_iter(e); -- -- var str = buf.get_text(s.iter,e.iter,false); -- //print(str); ++ var buf = view.el.get_buffer(); ++ Gtk.TextIter s; ++ Gtk.TextIter e; ++ buf.get_start_iter(out s); ++ buf.get_end_iter(out e); ++ var str = buf.get_text(s,e,true); // ideally we should syntax check it.. but it's html!? -- var project = this.get('/Window.LeftTree').getActiveFile().project; -- -- -- project.runhtml = str; ++ //var project = this.get('/Window.LeftTree').getActiveFile().project; -- project.dbcon = this.get('dbcon').el.get_text(); ++ _this.project.runhtml = str; ++ _this.project.save(); -- imports.ProjectManager.ProjectManager.saveConfig(); ++ // imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig(); // print (str); // this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length); // ok pressed.. this.el.hide(); } }, ++ default_width : 500, ++ modal : true, ++ 'void:show' : (Project.Project project) { ++ _this.project = project; ++ // get the active project. ++ ++ //print (project.fn); ++ //project.runhtml = project.runhtml || ''; ++ _this.view.el.get_buffer().set_text(project.runhtml); ++ ++ this.el.show_all(); ++ }, items : [ { xtype: Gtk.VBox, -- pack : function(p,e) { -- p.el.get_content_area().add(e.el); -- e.border_width =5; -- }, ++ border_width : 5, ++ pack : get_content_area().add, items : [ { -- xtype: Gtk.HBox, -- pack : "pack_start,false,true,3", ++ xtype: Gtk.Label, ++ pack : "pack_start,false,false,0", ++ label : "HTML To insert at end of " ++ }, ++ { ++ xtype: Gtk.ScrolledWindow, ++ pack : "pack_end,true,true,0", items : [ -- -- -- { -- xtype: Gtk.Label, -- pack : "pack_start,false,false,0", -- label : "Database Name" -- }, -- { -- xtype: Gtk.Entry, -- id : "dbcon", ++ { ++ xtype: GtkSource.View, pack : "add", -- visible : true -- }, ++ id : "view" ++ } ] -- }, -- -- { -- xtype: Gtk.Label, -- pack : "pack_start,false,false,0", -- label : "HTML To insert at end of " -- }, -- { -- xtype: Gtk.ScrolledWindow, -- pack : "pack_end,true,true,0", -- items : [ -- { -- xtype: GtkSource.View, -- pack : "add", -- id : "view" -- } -- ] -- } -- -- -- -- -- ++ } ] }, -- -- -- -- { xtype: Gtk.Button, pack : "add_action_widget,1", diff --cc Builder4/RooProjectProperties.vala index 000000000,000000000..11f0155ec new file mode 100644 --- /dev/null +++ b/Builder4/RooProjectProperties.vala @@@ -1,0 -1,0 +1,322 @@@ ++/* -- to compile ++valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \ ++ /tmp/RooProjectProperties.vala -o /tmp/RooProjectProperties ++*/ ++ ++ ++/* -- to test class ++static int main (string[] args) { ++ Gtk.init (ref args); ++ new Xcls_RooProjectProperties(); ++ RooProjectProperties.show_all(); ++ Gtk.main (); ++ return 0; ++} ++*/ ++ ++ ++public static Xcls_RooProjectProperties RooProjectProperties; ++ ++public class Xcls_RooProjectProperties ++{ ++ public Gtk.Dialog el; ++ private static Xcls_RooProjectProperties _this; ++ ++ public Xcls_view view; ++ ++ // my vars ++ public Project.Project project; ++ ++ // ctor ++ public Xcls_RooProjectProperties() ++ { ++ this.el = new Gtk.Dialog(); ++ _this = this; ++ RooProjectProperties = this; ++ ++ // my vars ++ ++ // set gobject values ++ this.el.default_width = 500; ++ this.el.modal = true; ++ var child_0 = new Xcls_VBox2(); ++ this.el. get_content_area().add ++ ( child_0.el ); ++ var child_1 = new Xcls_Button6(); ++ this.el.add_action_widget ( child_1.el , 1 ); ++ var child_2 = new Xcls_Button7(); ++ this.el.add_action_widget ( child_2.el , 0 ); ++ ++ // listeners ++ this.el.delete_event.connect( (self, event) => { ++ this.el.hide(); ++ return true; ++ } ); ++ this.el.response.connect( (self, response_id) => { ++ //print(response_id); ++ if (response_id< 1 ) { ++ this.el.hide(); ++ ++ return; ++ } ++ ++ var buf = view.el.get_buffer(); ++ Gtk.TextIter s; ++ Gtk.TextIter e; ++ buf.get_start_iter(out s); ++ buf.get_end_iter(out e); ++ var str = buf.get_text(s,e,true); ++ // ideally we should syntax check it.. but it's html!? ++ ++ //var project = this.get('/Window.LeftTree').getActiveFile().project; ++ ++ ++ _this.project.runhtml = str; ++ _this.project.save(); ++ ++ // imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig(); ++ // print (str); ++ // this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length); ++ // ok pressed.. ++ this.el.hide(); ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip .Project.Project:project - already used ++ ++ // skip default_width - already used ++ ++ // skip xtype - not pipe ++ ++ // skip |modal - already used ++ public void show (Project.Project project) { ++ _this.project = project; ++ // get the active project. ++ ++ //print (project.fn); ++ //project.runhtml = project.runhtml || ''; ++ _this.view.el.get_buffer().set_text(project.runhtml); ++ ++ this.el.show_all(); ++ } ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip id - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ public class Xcls_VBox2 ++ { ++ public Gtk.VBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_VBox2() ++ { ++ this.el = new Gtk.VBox( true, 0 ); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.border_width = 5; ++ var child_0 = new Xcls_Label3(); ++ this.el.pack_start ( child_0.el , false,false,0 ); ++ var child_1 = new Xcls_ScrolledWindow4(); ++ this.el.pack_end ( child_1.el , true,true,0 ); ++ } ++ ++ // userdefined functions ++ ++ // skip border_width - already used ++ ++ // skip xtype - not pipe ++ ++ // skip |pack - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Label3 ++ { ++ public Gtk.Label el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Label3() ++ { ++ this.el = new Gtk.Label( "HTML To insert at end of " ); ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip label - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_ScrolledWindow4 ++ { ++ public Gtk.ScrolledWindow el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_ScrolledWindow4() ++ { ++ this.el = new Gtk.ScrolledWindow( null, null ); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_view(); ++ this.el.add ( child_0.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_view ++ { ++ public Gtk.SourceView el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_view() ++ { ++ this.el = new Gtk.SourceView(); ++ _this.view = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip id - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button6 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button6() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.label = "OK"; ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip label - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button7 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button7() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.label = "Cancel"; ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip label - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++} diff --cc Builder4/StandardErrorDialog.bjs index 201e51800,201e51800..0f57f89fb --- a/Builder4/StandardErrorDialog.bjs +++ b/Builder4/StandardErrorDialog.bjs @@@ -1,1 -1,1 +1,26 @@@ --{"id":"file-gtk-17","name":"StandardErrorDialog","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/StandardErrorDialog.bjs","items":[{"|xns":"Gtk","xtype":"MessageDialog","|buttons":"Gtk.ButtonsType.OK","|modal":true,"|message_type":"Gtk.MessageType.ERROR","text":"fixme","|use_markup":true,"|show":"function(msg) {\n if (!this.el) {\n this.init();\n }\n this.el.text = msg;\n this.el.show_all();\n}\n","listeners":{"delete_event":"function (self, event) {\n this.el.hide();\n return true;\n}","response":"function (self, response_id) {\n this.el.hide();\n}"}}]} ++{ ++ "id": "file-gtk-9", ++ "name": "StandardErrorDialog", ++ "parent": "", ++ "title": false, ++ "path": "/home/alan/gitlive/app.Builder.js/Builder4/StandardErrorDialog.bjs", ++ "items": [ ++ { ++ "listeners": { ++ "delete_event": " (self, event) => {\n this.el.hide();\n return true;\n} \n", ++ "response": " (self, response_id) => {\n this.el.hide();\n}" ++ }, ++ "text": "fixme", ++ "xtype": "MessageDialog", ++ "|buttons": "Gtk.ButtonsType.OK", ++ "|message_type": "Gtk.MessageType.ERROR", ++ "|modal": "true", ++ "|use_markup": "true", ++ "|void:show": " (string msg) {\n\n this.el.text = msg;\n this.el.show_all();\n}\n", ++ "|void:show_all": " () {\n this.show(\"TEST\");\n}\n", ++ "|xns": "Gtk" ++ } ++ ], ++ "permname": "", ++ "modOrder": "" ++} diff --cc Builder4/StandardErrorDialog.js index a12c6d5be,a12c6d5be..c2d92a688 --- a/Builder4/StandardErrorDialog.js +++ b/Builder4/StandardErrorDialog.js @@@ -11,26 -11,26 +11,27 @@@ console = imports.console XObject = imports.XObject.XObject; StandardErrorDialog=new XObject({ xtype: Gtk.MessageDialog, -- buttons : Gtk.ButtonsType.OK, -- modal : true, -- message_type : Gtk.MessageType.ERROR, -- text : "fixme", -- use_markup : true, -- show : function(msg) { -- if (!this.el) { -- this.init(); -- } -- this.el.text = msg; -- this.el.show_all(); -- }, listeners : { -- delete_event : function (self, event) { ++ delete_event : (self, event) => { this.el.hide(); return true; }, -- response : function (self, response_id) { ++ response : (self, response_id) => { this.el.hide(); } ++ }, ++ text : "fixme", ++ buttons : Gtk.ButtonsType.OK, ++ message_type : Gtk.MessageType.ERROR, ++ modal : true, ++ use_markup : true, ++ 'void:show' : (string msg) { ++ ++ this.el.text = msg; ++ this.el.show_all(); ++ }, ++ 'void:show_all' : () { ++ this.show("TEST"); } }); StandardErrorDialog.init(); diff --cc Builder4/StandardErrorDialog.vala index 000000000,000000000..c86edb8a2 new file mode 100644 --- /dev/null +++ b/Builder4/StandardErrorDialog.vala @@@ -1,0 -1,0 +1,85 @@@ ++/* -- to compile ++valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \ ++ /tmp/StandardErrorDialog.vala -o /tmp/StandardErrorDialog ++*/ ++ ++ ++/* -- to test class ++static int main (string[] args) { ++ Gtk.init (ref args); ++ new Xcls_StandardErrorDialog(); ++ StandardErrorDialog.show_all(); ++ Gtk.main (); ++ return 0; ++} ++*/ ++ ++ ++public static Xcls_StandardErrorDialog StandardErrorDialog; ++ ++public class Xcls_StandardErrorDialog ++{ ++ public Gtk.MessageDialog el; ++ private static Xcls_StandardErrorDialog _this; ++ ++ ++ // my vars ++ ++ // ctor ++ public Xcls_StandardErrorDialog() ++ { ++ this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, "fixme" ); ++ _this = this; ++ StandardErrorDialog = this; ++ ++ // my vars ++ ++ // set gobject values ++ this.el.modal = true; ++ this.el.use_markup = true; ++ ++ // listeners ++ this.el.delete_event.connect( (self, event) => { ++ this.el.hide(); ++ return true; ++ } ++ ); ++ this.el.response.connect( (self, response_id) => { ++ this.el.hide(); ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip text - already used ++ ++ // skip xtype - not pipe ++ ++ // skip |buttons - already used ++ ++ // skip |message_type - already used ++ ++ // skip |modal - already used ++ ++ // skip |use_markup - already used ++ public void show (string msg) { ++ ++ this.el.text = msg; ++ this.el.show_all(); ++ } ++ public void show_all () { ++ this.show("TEST"); ++ } ++ ++ // skip |xns - no return type ++ ++ // skip id - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++} diff --cc Builder4/WindowRightPalete.bjs index 000000000,000000000..ca927b9a0 new file mode 100644 --- /dev/null +++ b/Builder4/WindowRightPalete.bjs @@@ -1,0 -1,0 +1,148 @@@ ++{ ++ "id": "file-gtk-11", ++ "name": "WindowRightPalete", ++ "parent": "", ++ "title": false, ++ "path": "/home/alan/gitlive/app.Builder.js/Builder4/WindowRightPalete.bjs", ++ "items": [ ++ { ++ ".signal:void:drag_end()": "", ++ ".Project.Project:provider": "", ++ "id": "RightPalete", ++ "pack": "pack_start,false,false", ++ "xtype": "VBox", ++ "|void:hide": " () {\n \n _this.buttonbar.el.show();\n _this.viewbox.el.hide();\n // print(\"TRIED TO HIDE\");\n}\n", ++ "|void:show": "function() {\n _this.buttonbar.el.hide();\n _this.viewbox.el.show();\n // this.get('model').expanded();\n \n}\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "VBox", ++ "pack": "add", ++ "id": "buttonbar", ++ "items": [ ++ { ++ "listeners": { ++ "clicked": " (self) => {\n\t_this..show();\n}" ++ }, ++ "pack": "pack_start,false,true", ++ "xtype": "Button", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "Image", ++ "pack": "add", ++ "|stock": "Gtk.STOCK_GOTO_FIRST", ++ "|icon_size": "Gtk.IconSize.MENU" ++ } ++ ] ++ }, ++ { ++ "listeners": { ++ "enter_notify_event": " (self, event) => {\n RightPalete.show();\n return false;\n}" ++ }, ++ "angle": 270, ++ "label": "Palete", ++ "pack": "add", ++ "xtype": "Label", ++ "|init": " this.el.add_events ( Gdk.EventMask.BUTTON_MOTION_MASK );\n \n", ++ "|xns": "Gtk" ++ } ++ ] ++ }, ++ { ++ "|xns": "Gtk", ++ "xtype": "VBox", ++ "pack": "add", ++ "id": "viewbox", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "HBox", ++ "pack": "pack_start,false,true", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "Label", ++ "pack": "add", ++ "label": "Palete" ++ }, ++ { ++ "listeners": { ++ "clicked": "function (self) {\n\t_this.RightPalete.hide();\n}" ++ }, ++ "pack": "pack_start,false,true", ++ "xtype": "Button", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "|xns": "Gtk", ++ "xtype": "Image", ++ "pack": "add", ++ "|stock": "Gtk.STOCK_GOTO_LAST", ++ "|icon_size": "Gtk.IconSize.MENU" ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "pack": "add", ++ "xtype": "ScrolledWindow", ++ "|init": " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n this.el.set_size_request(-1,200);\n \n", ++ "|shadow_type": "Gtk.ShadowType.IN", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "listeners": { ++ "drag_begin": " ( ctx) => {\n // we could fill this in now...\n// Seed.print('SOURCE: drag-begin');\n \n \n \n Gtk.TreeIter iter;\n var s = _this.selection;\n \n s.get_selected(_this.model.el, out iter);\n var path = _this.model.el.get_path(iter);\n \n /// pix is a surface..\n var pix = this.el.create_row_drag_icon ( path);\n \n \n Gtk.drag_set_icon_surface (ctx, pix);\n Glib.Value val;\n \n\n _this.model.el.get_value(iter, 0, out value);\n if (_this.provider == null) {\n return false;\n }\n //if (!this.get('/RightPalete').provider) {\n // return false;\n //}\n this.dropList = _this.provider.getDropList((string)value);\n this.dragData = (string) value;\n \n \n return true;\n}", ++ "drag_data_get": " (drag_context, selection_data, info, time) => {\n \t//Seed.print('Palete: drag-data-get: ' + target_type);\n if (this.el.dragData.length > 0 ) {\n selection_data.set_text(this.dragData ,this.dragData.length);\n }\n \n \n //this.el.dragData = \"TEST from source widget\";\n \n \n}", ++ "drag_end": "( drag_context) => {\n \t//Seed.print('SOURCE: drag-end');\n\t\n\tthis.dragData = \"\";\n\tthis.dropList = null;\n\t_this.drag_end(); // call signal..\n\t//this.get('/LeftTree.view').highlight(false);\n\treturn true;\n}", ++ "button_press_event": " ( event) => {\n\n //\tif (!this.get('/Editor').save()) {\n //\t // popup!! - click handled.. \n// \t return true;\n// }\n return false;\n}" ++ }, ++ ".GLib.List:dropList": "", ++ ".string:dragData": "", ++ "pack": "add", ++ "xtype": "TreeView", ++ "|enable_tree_lines": "true", ++ "|headers_visible": "false", ++ "|init": " {\n this.el.set_size_request(150,-1);\n // set_reorderable: [1]\n \n var description = new Pango.FontDescription();\n description.set_size(8000);\n this.el.modify_font(description);\n \n var selection = this.el.get_selection();\n selection.set_mode( Gtk.SelectionMode.SINGLE);\n // this.selection.signal['changed'].connect(function() {\n // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);\n //});\n // see: http://live.gnome.org/GnomeLove/DragNDropTutorial\n \n Gtk.drag_source_set (\n this.el, /* widget will be drag-able */\n Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */\n null, /* lists of target to support */\n 0, /* size of list */\n Gdk.DragAction.COPY /* what to do with data after dropped */\n );\n //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);\n \n Gtk.drag_source_set_target_list(this.el, Application.targetList);\n Gtk.drag_source_add_text_targets(this.el); \n \n}\n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "columns": "typeof(string),typeof(string)", ++ "id": "model", ++ "n_columns": 2, ++ "pack": "set_model", ++ "xtype": "ListStore", ++ "|void:load": " (GLib.List tr, Gtk.TreeIter? iter)\n{\n if (iter == null) {\n this.el.clear();\n }\n //console.log('Project tree load: ' + tr.length);\n\n Gtk.TreeIter citer;\n //this.insert(citer,iter,0);\n for(var i =0 ; i < tr.length(); i++) {\n if (iter == null) {\n \n this.el.append(out citer); \n } else {\n this.el.insert(out citer,iter,-1);\n }\n \n var r = tr.nth_data(i);\n //Seed.print(r);\n this.el.set_value(citer, 0, r ); // title \n \n //this.el.set_value(citer, 1, new GObject.Value( r)); //id\n //if (r.cn && r.cn.length) {\n // this.load(r.cn, citer);\n //}\n }\n \n \n}", ++ "|string:getValue": " (Gtk.TreeIter iter, int col) {\n GLib.Value gval;\n this.el.get_value(iter, col , out gval);\n return (string)gval;\n \n \n}", ++ "|xns": "Gtk" ++ }, ++ { ++ "pack": "append_column", ++ "xtype": "TreeViewColumn", ++ "|init": " this.el.add_attribute(_this.txtrender , \"markup\", 0 );\n \n", ++ "|xns": "Gtk", ++ "items": [ ++ { ++ "id": "txtrender", ++ "pack": "pack_start", ++ "xtype": "CellRendererText", ++ "|xns": "Gtk" ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ } ++ ], ++ "permname": "", ++ "modOrder": "" ++} diff --cc Builder4/WindowRightPalete.js index 000000000,000000000..76f2e7ab6 new file mode 100644 --- /dev/null +++ b/Builder4/WindowRightPalete.js @@@ -1,0 -1,0 +1,267 @@@ ++Gtk = imports.gi.Gtk; ++Gdk = imports.gi.Gdk; ++Pango = imports.gi.Pango; ++GLib = imports.gi.GLib; ++Gio = imports.gi.Gio; ++GObject = imports.gi.GObject; ++GtkSource = imports.gi.GtkSource; ++WebKit = imports.gi.WebKit; ++Vte = imports.gi.Vte; ++console = imports.console; ++XObject = imports.XObject.XObject; ++WindowRightPalete=new XObject({ ++ xtype: Gtk.VBox, ++ id : "RightPalete", ++ pack : "pack_start,false,false", ++ 'void:hide' : () { ++ ++ _this.buttonbar.el.show(); ++ _this.viewbox.el.hide(); ++ // print("TRIED TO HIDE"); ++ }, ++ 'void:show' : function() { ++ _this.buttonbar.el.hide(); ++ _this.viewbox.el.show(); ++ // this.get('model').expanded(); ++ ++ }, ++ items : [ ++ { ++ xtype: Gtk.VBox, ++ pack : "add", ++ id : "buttonbar", ++ items : [ ++ { ++ xtype: Gtk.Button, ++ listeners : { ++ clicked : (self) => { ++ _this..show(); ++ } ++ }, ++ pack : "pack_start,false,true", ++ items : [ ++ { ++ xtype: Gtk.Image, ++ pack : "add", ++ stock : Gtk.STOCK_GOTO_FIRST, ++ icon_size : Gtk.IconSize.MENU ++ } ++ ] ++ }, ++ { ++ xtype: Gtk.Label, ++ listeners : { ++ enter_notify_event : (self, event) => { ++ RightPalete.show(); ++ return false; ++ } ++ }, ++ angle : 270, ++ label : "Palete", ++ pack : "add", ++ init : this.el.add_events ( Gdk.EventMask.BUTTON_MOTION_MASK ); ++ } ++ ] ++ }, ++ { ++ xtype: Gtk.VBox, ++ pack : "add", ++ id : "viewbox", ++ items : [ ++ { ++ xtype: Gtk.HBox, ++ pack : "pack_start,false,true", ++ items : [ ++ { ++ xtype: Gtk.Label, ++ pack : "add", ++ label : "Palete" ++ }, ++ { ++ xtype: Gtk.Button, ++ listeners : { ++ clicked : function (self) { ++ _this.RightPalete.hide(); ++ } ++ }, ++ pack : "pack_start,false,true", ++ items : [ ++ { ++ xtype: Gtk.Image, ++ pack : "add", ++ stock : Gtk.STOCK_GOTO_LAST, ++ icon_size : Gtk.IconSize.MENU ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ xtype: Gtk.ScrolledWindow, ++ pack : "add", ++ init : this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); ++ this.el.set_size_request(-1,200);, ++ shadow_type : Gtk.ShadowType.IN, ++ items : [ ++ { ++ xtype: Gtk.TreeView, ++ listeners : { ++ drag_begin : ( ctx) => { ++ // we could fill this in now... ++ // Seed.print('SOURCE: drag-begin'); ++ ++ ++ ++ Gtk.TreeIter iter; ++ var s = _this.selection; ++ ++ s.get_selected(_this.model.el, out iter); ++ var path = _this.model.el.get_path(iter); ++ ++ /// pix is a surface.. ++ var pix = this.el.create_row_drag_icon ( path); ++ ++ ++ Gtk.drag_set_icon_surface (ctx, pix); ++ Glib.Value val; ++ ++ ++ _this.model.el.get_value(iter, 0, out value); ++ if (_this.provider == null) { ++ return false; ++ } ++ //if (!this.get('/RightPalete').provider) { ++ // return false; ++ //} ++ this.dropList = _this.provider.getDropList((string)value); ++ this.dragData = (string) value; ++ ++ ++ return true; ++ }, ++ drag_data_get : (drag_context, selection_data, info, time) => { ++ //Seed.print('Palete: drag-data-get: ' + target_type); ++ if (this.el.dragData.length > 0 ) { ++ selection_data.set_text(this.dragData ,this.dragData.length); ++ } ++ ++ ++ //this.el.dragData = "TEST from source widget"; ++ ++ ++ }, ++ drag_end : ( drag_context) => { ++ //Seed.print('SOURCE: drag-end'); ++ ++ this.dragData = ""; ++ this.dropList = null; ++ _this.drag_end(); // call signal.. ++ //this.get('/LeftTree.view').highlight(false); ++ return true; ++ }, ++ button_press_event : ( event) => { ++ ++ // if (!this.get('/Editor').save()) { ++ // // popup!! - click handled.. ++ // return true; ++ // } ++ return false; ++ } ++ }, ++ pack : "add", ++ enable_tree_lines : true, ++ headers_visible : false, ++ init : { ++ this.el.set_size_request(150,-1); ++ // set_reorderable: [1] ++ ++ var description = new Pango.FontDescription(); ++ description.set_size(8000); ++ this.el.modify_font(description); ++ ++ var selection = this.el.get_selection(); ++ selection.set_mode( Gtk.SelectionMode.SINGLE); ++ // this.selection.signal['changed'].connect(function() { ++ // _view.listeners['cursor-changed'].apply(_view, [ _view, '']); ++ //}); ++ // see: http://live.gnome.org/GnomeLove/DragNDropTutorial ++ ++ Gtk.drag_source_set ( ++ this.el, /* widget will be drag-able */ ++ Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */ ++ null, /* lists of target to support */ ++ 0, /* size of list */ ++ Gdk.DragAction.COPY /* what to do with data after dropped */ ++ ); ++ //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList); ++ ++ Gtk.drag_source_set_target_list(this.el, Application.targetList); ++ Gtk.drag_source_add_text_targets(this.el); ++ ++ }, ++ items : [ ++ { ++ xtype: Gtk.ListStore, ++ columns : "typeof(string),typeof(string)", ++ id : "model", ++ n_columns : 2, ++ pack : "set_model", ++ 'void:load' : (GLib.List tr, Gtk.TreeIter? iter) ++ { ++ if (iter == null) { ++ this.el.clear(); ++ } ++ //console.log('Project tree load: ' + tr.length); ++ ++ Gtk.TreeIter citer; ++ //this.insert(citer,iter,0); ++ for(var i =0 ; i < tr.length(); i++) { ++ if (iter == null) { ++ ++ this.el.append(out citer); ++ } else { ++ this.el.insert(out citer,iter,-1); ++ } ++ ++ var r = tr.nth_data(i); ++ //Seed.print(r); ++ this.el.set_value(citer, 0, r ); // title ++ ++ //this.el.set_value(citer, 1, new GObject.Value( r)); //id ++ //if (r.cn && r.cn.length) { ++ // this.load(r.cn, citer); ++ //} ++ } ++ ++ ++ }, ++ 'string:getValue' : (Gtk.TreeIter iter, int col) { ++ GLib.Value gval; ++ this.el.get_value(iter, col , out gval); ++ return (string)gval; ++ ++ ++ } ++ }, ++ { ++ xtype: Gtk.TreeViewColumn, ++ pack : "append_column", ++ init : this.el.add_attribute(_this.txtrender , "markup", 0 );, ++ items : [ ++ { ++ xtype: Gtk.CellRendererText, ++ id : "txtrender", ++ pack : "pack_start" ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ } ++ ] ++}); ++WindowRightPalete.init(); ++XObject.cache['/WindowRightPalete'] = WindowRightPalete; diff --cc Builder4/WindowRightPalete.vala index 000000000,000000000..7eb695d2a new file mode 100644 --- /dev/null +++ b/Builder4/WindowRightPalete.vala @@@ -1,0 -1,0 +1,724 @@@ ++/* -- to compile ++valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \ ++ /tmp/WindowRightPalete.vala -o /tmp/WindowRightPalete ++*/ ++ ++ ++/* -- to test class ++static int main (string[] args) { ++ Gtk.init (ref args); ++ new Xcls_RightPalete(); ++ WindowRightPalete.show_all(); ++ Gtk.main (); ++ return 0; ++} ++*/ ++ ++ ++public static Xcls_RightPalete WindowRightPalete; ++ ++public class Xcls_RightPalete ++{ ++ public Gtk.VBox el; ++ private static Xcls_RightPalete _this; ++ ++ public Xcls_buttonbar buttonbar; ++ public Xcls_viewbox viewbox; ++ public Xcls_model model; ++ public Xcls_txtrender txtrender; ++ ++ // my vars ++ public signal void drag_end(); ++ public Project.Project provider; ++ ++ // ctor ++ public Xcls_RightPalete() ++ { ++ this.el = new Gtk.VBox( true, 0 ); ++ _this = this; ++ WindowRightPalete = this; ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_buttonbar(); ++ this.el.add ( child_0.el ); ++ var child_1 = new Xcls_viewbox(); ++ this.el.add ( child_1.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip .signal:void:drag_end() - already used ++ ++ // skip .Project.Project:provider - already used ++ ++ // skip id - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ public void hide () { ++ ++ _this.buttonbar.el.show(); ++ _this.viewbox.el.hide(); ++ // print("TRIED TO HIDE"); ++ } ++ public void showfunction() { ++ _this.buttonbar.el.hide(); ++ _this.viewbox.el.show(); ++ // this.get('model').expanded(); ++ ++ } ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ public class Xcls_buttonbar ++ { ++ public Gtk.VBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_buttonbar() ++ { ++ this.el = new Gtk.VBox( true, 0 ); ++ _this.buttonbar = this; ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_Button3(); ++ this.el.pack_start ( child_0.el , false,true ); ++ var child_1 = new Xcls_Label5(); ++ this.el.add ( child_1.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip id - not pipe ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button3 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button3() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_Image4(); ++ this.el.add ( child_0.el ); ++ ++ // listeners ++ this.el.clicked.connect( (self) => { ++ _this..show(); ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Image4 ++ { ++ public Gtk.Image el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Image4() ++ { ++ this.el = new Gtk.Image(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.icon_size = Gtk.IconSize.MENU; ++ this.el.stock = Gtk.STOCK_GOTO_FIRST; ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip |stock - already used ++ ++ // skip |icon_size - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Label5 ++ { ++ public Gtk.Label el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Label5() ++ { ++ this.el = new Gtk.Label( "Palete" ); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.angle = 270; ++ ++ // listeners ++ this.el.enter_notify_event.connect( (self, event) => { ++ RightPalete.show(); ++ return false; ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip angle - already used ++ ++ // skip label - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |init - already used ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_viewbox ++ { ++ public Gtk.VBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_viewbox() ++ { ++ this.el = new Gtk.VBox( true, 0 ); ++ _this.viewbox = this; ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_HBox7(); ++ this.el.pack_start ( child_0.el , false,true ); ++ var child_1 = new Xcls_ScrolledWindow11(); ++ this.el.add ( child_1.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip id - not pipe ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_HBox7 ++ { ++ public Gtk.HBox el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_HBox7() ++ { ++ this.el = new Gtk.HBox( true, 0 ); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_Label8(); ++ this.el.add ( child_0.el ); ++ var child_1 = new Xcls_Button9(); ++ this.el.pack_start ( child_1.el , false,true ); ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Label8 ++ { ++ public Gtk.Label el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Label8() ++ { ++ this.el = new Gtk.Label( "Palete" ); ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip label - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Button9 ++ { ++ public Gtk.Button el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Button9() ++ { ++ this.el = new Gtk.Button(); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_Image10(); ++ this.el.add ( child_0.el ); ++ ++ // listeners ++ this.el.clicked.connect( function (self) { ++ _this.RightPalete.hide(); ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_Image10 ++ { ++ public Gtk.Image el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_Image10() ++ { ++ this.el = new Gtk.Image(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.icon_size = Gtk.IconSize.MENU; ++ this.el.stock = Gtk.STOCK_GOTO_LAST; ++ } ++ ++ // userdefined functions ++ ++ // skip |xns - no return type ++ ++ // skip xtype - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip |stock - already used ++ ++ // skip |icon_size - already used ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_ScrolledWindow11 ++ { ++ public Gtk.ScrolledWindow el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_ScrolledWindow11() ++ { ++ this.el = new Gtk.ScrolledWindow( null, null ); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.shadow_type = Gtk.ShadowType.IN; ++ var child_0 = new Xcls_TreeView12(); ++ this.el.add ( child_0.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |init - already used ++ ++ // skip |shadow_type - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_TreeView12 ++ { ++ public Gtk.TreeView el; ++ ++ // my vars ++ public GLib.List dropList; ++ public string dragData; ++ ++ // ctor ++ public Xcls_TreeView12() ++ { ++ this.el = new Gtk.TreeView(); ++ ++ // my vars ++ ++ // set gobject values ++ this.el.enable_tree_lines = true; ++ this.el.headers_visible = false; ++ var child_0 = new Xcls_model(); ++ this.el.set_model ( child_0.el ); ++ var child_1 = new Xcls_TreeViewColumn14(); ++ this.el.append_column ( child_1.el ); ++ ++ // listeners ++ this.el.drag_begin.connect( ( ctx) => { ++ // we could fill this in now... ++ // Seed.print('SOURCE: drag-begin'); ++ ++ ++ ++ Gtk.TreeIter iter; ++ var s = _this.selection; ++ ++ s.get_selected(_this.model.el, out iter); ++ var path = _this.model.el.get_path(iter); ++ ++ /// pix is a surface.. ++ var pix = this.el.create_row_drag_icon ( path); ++ ++ ++ Gtk.drag_set_icon_surface (ctx, pix); ++ Glib.Value val; ++ ++ ++ _this.model.el.get_value(iter, 0, out value); ++ if (_this.provider == null) { ++ return false; ++ } ++ //if (!this.get('/RightPalete').provider) { ++ // return false; ++ //} ++ this.dropList = _this.provider.getDropList((string)value); ++ this.dragData = (string) value; ++ ++ ++ return true; ++ } ); ++ this.el.drag_data_get.connect( (drag_context, selection_data, info, time) => { ++ //Seed.print('Palete: drag-data-get: ' + target_type); ++ if (this.el.dragData.length > 0 ) { ++ selection_data.set_text(this.dragData ,this.dragData.length); ++ } ++ ++ ++ //this.el.dragData = "TEST from source widget"; ++ ++ ++ } ); ++ this.el.drag_end.connect( ( drag_context) => { ++ //Seed.print('SOURCE: drag-end'); ++ ++ this.dragData = ""; ++ this.dropList = null; ++ _this.drag_end(); // call signal.. ++ //this.get('/LeftTree.view').highlight(false); ++ return true; ++ } ); ++ this.el.button_press_event.connect( ( event) => { ++ ++ // if (!this.get('/Editor').save()) { ++ // // popup!! - click handled.. ++ // return true; ++ // } ++ return false; ++ } ); ++ } ++ ++ // userdefined functions ++ ++ // skip listeners - not pipe ++ ++ // skip .GLib.List:dropList - already used ++ ++ // skip .string:dragData - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |enable_tree_lines - already used ++ ++ // skip |headers_visible - already used ++ ++ // skip |init - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_model ++ { ++ public Gtk.ListStore el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_model() ++ { ++ this.el = new Gtk.ListStore( 2, "typeof(string),typeof(string)" ); ++ _this.model = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip columns - already used ++ ++ // skip id - not pipe ++ ++ // skip n_columns - already used ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ public void load (GLib.List tr, Gtk.TreeIter? iter) ++ { ++ if (iter == null) { ++ this.el.clear(); ++ } ++ //console.log('Project tree load: ' + tr.length); ++ ++ Gtk.TreeIter citer; ++ //this.insert(citer,iter,0); ++ for(var i =0 ; i < tr.length(); i++) { ++ if (iter == null) { ++ ++ this.el.append(out citer); ++ } else { ++ this.el.insert(out citer,iter,-1); ++ } ++ ++ var r = tr.nth_data(i); ++ //Seed.print(r); ++ this.el.set_value(citer, 0, r ); // title ++ ++ //this.el.set_value(citer, 1, new GObject.Value( r)); //id ++ //if (r.cn && r.cn.length) { ++ // this.load(r.cn, citer); ++ //} ++ } ++ ++ ++ } ++ public string getValue (Gtk.TreeIter iter, int col) { ++ GLib.Value gval; ++ this.el.get_value(iter, col , out gval); ++ return (string)gval; ++ ++ ++ } ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_TreeViewColumn14 ++ { ++ public Gtk.TreeViewColumn el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_TreeViewColumn14() ++ { ++ this.el = new Gtk.TreeViewColumn(); ++ ++ // my vars ++ ++ // set gobject values ++ var child_0 = new Xcls_txtrender(); ++ this.el.pack_start ( child_0.el ); ++ } ++ ++ // userdefined functions ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |init - already used ++ ++ // skip |xns - no return type ++ ++ // skip items - not pipe ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++ public class Xcls_txtrender ++ { ++ public Gtk.CellRendererText el; ++ ++ // my vars ++ ++ // ctor ++ public Xcls_txtrender() ++ { ++ this.el = new Gtk.CellRendererText(); ++ _this.txtrender = this; ++ ++ // my vars ++ ++ // set gobject values ++ } ++ ++ // userdefined functions ++ ++ // skip id - not pipe ++ ++ // skip pack - not pipe ++ ++ // skip xtype - not pipe ++ ++ // skip |xns - no return type ++ ++ // skip xvala_cls - not pipe ++ ++ // skip xvala_xcls - not pipe ++ ++ // skip xvala_id - not pipe ++ } ++} diff --cc JsRender/Gtk.js index df9726123,09452b615..b03b4eba5 --- a/JsRender/Gtk.js +++ b/JsRender/Gtk.js @@@ -11,15 -11,15 +11,21 @@@ Base = imports.JsRender.Base.Base var gid = 1; ++// ctors needed for Constructing vala?? - ++ var ctors = { ++ "Gtk.Label": [ "label" ], ++ "Gtk.Box": [ "orientation", "spacing:0" ], "Gtk.MessageDialog" : [ "parent:null", "flags:Gtk.DialogFlags.MODAL", "message_type", "buttons", "text" ], -- "Gtk.ToolButton": [ "icon_widget:null", "label:null" ], -- "Gtk.ScrolledWindow": [ "hadjustment:null", "vadjustment:null" ], "Gtk.SourceBuffer": [ "table:null" ], ++ "Gtk.Table": [ "n_rows", "n_columns" , "homogeneous" ], ++ "Gtk.ToolButton": [ "icon_widget:null", "label:null" ], ++ "Gtk.HBox": [ "homogeneous:true", "spacing:0" ], "Gtk.VBox": [ "homogeneous:true", "spacing:0" ], -- -- ++ "Gtk.ListStore": [ "n_columns", "columns" ], ++ "Gtk.FileChooserWidget" : [ "action"], ++ //"Gtk.Entry": [ ], }; @@@ -247,6 -247,6 +253,10 @@@ Gtk = XObject.define //print(JSON.stringify(this.items[0],null,4));Seed.quit(); var item= XObject.xclone(this.items[0]); ++ if (!item.id) { ++ item.id = this.name; ++ ++ } print(JSON.stringify(item,null,4)); @@@ -277,6 -277,6 +287,8 @@@ ret += "*/\n"; } ret += "\n\n"; ++ ++ // print(JSON.stringify(item,null,4)); this.toValaItem(item,0, function(s) { ret+= s; @@@ -291,14 -291,14 +303,14 @@@ var ns = item['|xns'] ; if (ns == 'GtkSource') { return 'Gtk.Source' -- ns = 'Gtk.Source'; ++ } return ns + '.'; }, toValaName : function(item) { this.vcnt++; -- var cls = this.toValaNS(item) + item.xtype; ++ var cls = this.toValaNS(item) + item.xtype; // eg. Gtk.Window var id = item.id ? item.id : (item.xtype + this.vcnt); var props = this.palete.getPropertiesFor(cls, 'props'); @@@ -399,14 -393,6 +411,15 @@@ // wrapped ctor.. // this may need to look up properties to fill in the arguments.. // introspection does not workk..... - as things like gtkmessagedialog ++ /* + if (cls == 'Gtk.Table') { + + var methods = this.palete.getPropertiesFor(cls, 'methods'); + + print(JSON.stringify(this.palete.proplist[cls], null,4)); + Seed.quit(); + } - ++ */ if (typeof(ctors[cls]) !== 'undefined') { @@@ -460,11 -446,11 +473,11 @@@ } var kk = k.substring(1); var v = item[k]; - var vv = v.split(':'); - if (vv.length < 2) { + var vv = kk.split(':'); + if (v.length < 1 || vv[0] == "signal") { continue; } - strbuilder(ipad + "this" + vv[1] + " = " + v +";\n"); - strbuilder(ipad + "this" + k + " = " + vv[1] +";\n"); ++ strbuilder(ipad + "this." + vv[1] + " = " + v +";\n"); } @@@ -484,8 -470,8 +497,11 @@@ if (typeof(item[p.name]) != 'undefined' && typeof(item[p.name]) != 'object' ) { citems[p.name] = true; -- -- strbuilder(ipad + "this.el." + p.name + " = " + JSON.stringify(item[p.name]) + ";\n"); ++ var val = JSON.stringify(item[p.name]); ++ if (['xalign','yalign'].indexOf(p.name) > -1) { ++ val +='f'; ++ } ++ strbuilder(ipad + "this.el." + p.name + " = " + val + ";\n"); return; } if (typeof(item['|' + p.name]) != 'undefined' && typeof(item['|' + p.name]) != 'object' ) { @@@ -506,7 -492,7 +522,11 @@@ if (typeof(item.items) != 'undefined') { for(var i =0;i map) + { + var r = new Json.Array(); + for(var i =0;i< map.length();i++) { + - r.add_object_element(map.nth_data().toJSON()); ++ r.add_object_element(map.nth_data(i).toJSON()); + } + return r; } } diff --cc Palete/Gtk.js index 80adfeab9,60a879520..98faa2ed5 --- a/Palete/Gtk.js +++ b/Palete/Gtk.js @@@ -415,14 -411,7 +415,15 @@@ Gtk = XObject.define }, typeToName : function (type_info, allow_iface) // find type for properties or arguments. { - var ty = GIRepository.type_tag_to_string( GIRepository.type_info_get_tag(type_info)); + print(type_info); + if (type_info == 17) { + return 'integer'; + } ++ + var x = GIRepository.type_info_get_tag(type_info); + print(x); + var ty = GIRepository.type_tag_to_string( GIRepository.type_info_get_tag(type_info)); + print(ty); if ((ty == 'void') && GIRepository.type_info_is_pointer(type_info)) { return false; diff --cc Palete/Palete.vala index 4b7677111,4b7677111..eae571269 --- a/Palete/Palete.vala +++ b/Palete/Palete.vala @@@ -163,55 -163,55 +163,76 @@@ namespace Palet getDefaultPack: function(pname, cname) { return 'add'; }, -- saveTemplate: function(name, data) ++ */ ++ public void saveTemplate (string name, JsRender.Node data) { -- var gn = this.guessName(JSON.parse(data)); ++ ++ var gn = data.fqn(); // store it in user's directory.. -- var appdir = GLib.get_home_dir() + '/.Builder'; -- -- if (!File.isDirectory(appdir+ '/' + gn)) { -- File.mkdir(appdir+ '/' + gn); ++ var appdir = GLib.Environment.get_home_dir() + "/.Builder"; ++ ++ ++ if (!GLib.FileUtils.test(appdir+ "/" + gn, GLib.FileTest.IS_DIR)) { ++ GLib.File.new_for_path (appdir+ "/" + gn).make_directory (); ++ } -- File.write(appdir+ '/' + gn + '/' + name + '.json', data); ++ GLib.FileUtils.set_contents(appdir+ "/" + gn + "/" + name + ".json", data.toJsonString()); -- }, ++ } ++ /** * list templates - in home directory (and app dir in future...) * @param {String} name - eg. Gtk.Window.. * @return {Array} list of templates available.. -- * / -- listTemplates : function(name) ++ */ ++ ++ public GLib.List listTemplates (JsRender.Node node) { -- var gn = name; -- if (typeof(gn) != 'string') { -- gn = this.guessName(gn); -- } -- ++ var gn = node.fqn(); -- var dir= GLib.get_home_dir() + '/.Builder/' + gn; -- if (!File.isDirectory(dir)) { -- return []; ++ var ret = new GLib.List(); ++ var dir= GLib.Environment.get_home_dir() + "/.Builder/" + gn; ++ if (!GLib.FileUtils.test(dir, GLib.FileTest.IS_DIR)) { ++ return ret; ++ } ++ ++ ++ ++ ++ var f = File.new_for_path(dir); ++ ++ var file_enum = f.enumerate_children(GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null); ++ ++ FileInfo next_file; ++ while ((next_file = file_enum.next_file(null)) != null) { ++ var n = next_file.get_display_name(); ++ if (!Regex.match_simple ("\\.json$", n)) { ++ continue; ++ } ++ ret.append( dir + "/" + n); } -- var ret = []; -- File.list(dir).forEach(function(n) { -- if (!n.match(/\.json$/)) { -- return; -- } -- -- ret.push({ -- path : dir + '/' + n, -- name: n.replace(/\.json$/,'') -- }); -- }); return ret; -- }, -- loadTemplate : function(path) ++ } ++ ++ public JsRender.Node? loadTemplate(string path) { -- return JSON.parse(File.read(path)); ++ ++ var pa = new Json.Parser(); ++ pa.load_from_file(path); ++ var node = pa.get_root(); ++ ++ if (node.get_node_type () != Json.NodeType.OBJECT) { ++ return null; ++ } ++ var obj = node.get_object (); ++ ++ var ret = new JsRender.Node(); ++ ret.loadFromJson(obj); ++ return ret; } -- */ ++ } diff --cc Project/Project.vala index 3e1f758f9,0cd0c6aa0..ce441f88b --- a/Project/Project.vala +++ b/Project/Project.vala @@@ -10,347 -10,337 +10,373 @@@ * * */ ++namespace Project { ++ public errordomain Error { ++ INVALID_TYPE, ++ NEED_IMPLEMENTING, ++ MISSING_FILE, ++ INVALID_VALUE ++ } -- --public class Project.Project : Object { -- -- public signal void on_changed (); ++ public class Project : Object { ++ ++ public signal void on_changed (); -- public string id; -- public string fn = ""; -- public string name = ""; -- public Gee.HashMap paths; -- public Gee.HashMap files ; -- //tree : false, -- public string xtype; -- -- -- -- public Project (string path) { -- -- //this.name = name; -- -- -- this.paths = new Gee.HashMap(); -- this.files = new Gee.HashMap(); -- //XObject.extend(this, cfg); -- //this.files = { }; -- this.paths.set(path, "dir"); -- -- -- } -- -- /* -- public load -- -- -- load : function (o) // is this used?? -- { -- if (!this.fetchTree) { -- console.log("Project.getTree tree called on base object?!?!"); -- return false; -- } -- -- if (this.files) { -- return o.success.apply(o.scope || this, [this]); -- } -- return this.fetchTree(o); -- -- }, -- */ -- // public Palete getPalete () -- //{ -- //print("Project.Base: GET PROVIDER FOR " + this.xtype); -- // return ProjectManager.getPalete(this.xtype); -- // } -- -- public string toJSON(bool show_all) -- { -- -- var builder = new Json.Builder (); -- -- builder.begin_object (); -- -- builder.set_member_name ("name"); -- builder.add_string_value (this.name); ++ public string id; ++ public string fn = ""; ++ public string name = ""; ++ public string runhtml = ""; ++ public Gee.HashMap paths; ++ public Gee.HashMap files ; ++ //tree : false, ++ public string xtype; ++ ++ ++ ++ ++ public Project (string path) { ++ ++ //this.name = name; ++ ++ ++ this.paths = new Gee.HashMap(); ++ this.files = new Gee.HashMap(); ++ //XObject.extend(this, cfg); ++ //this.files = { }; ++ this.paths.set(path, "dir"); ++ ++ ++ } -- -- builder.set_member_name ("fn"); -- builder.add_string_value (this.fn); ++ public static Project factory(string xtype, string path) ++ { ++ switch(xtype) { ++ case "Gtk": ++ return new Gtk(path); ++ case "Roo": ++ return new Roo(path); ++ } ++ throw new Error.INVALID_TYPE("invalid project type"); ++ ++ } ++ ++ /* ++ public load ++ ++ ++ load : function (o) // is this used?? ++ { ++ if (!this.fetchTree) { ++ console.log("Project.getTree tree called on base object?!?!"); ++ return false; ++ } ++ ++ if (this.files) { ++ return o.success.apply(o.scope || this, [this]); ++ } ++ return this.fetchTree(o); ++ ++ }, ++ */ ++ // public Palete getPalete () ++ //{ ++ //print("Project.Base: GET PROVIDER FOR " + this.xtype); ++ // return ProjectManager.getPalete(this.xtype); ++ // } -- builder.set_member_name ("xtype"); -- builder.add_string_value (this.xtype); -- -- // file ??? try/false? -- builder.set_member_name ("paths"); -- -- -- builder.begin_array (); -- -- -- var iter = this.paths.map_iterator(); -- while (iter.next()) { -- builder.add_string_value (iter.get_key()); -- } -- builder.end_array (); -- if (show_all) { -- builder.set_member_name ("files"); -- builder.begin_array (); -- var fiter = this.files.map_iterator(); -- while (fiter.next()) { -- builder.add_string_value (fiter.get_key()); -- } ++ public void save() ++ { ++ // fixme.. ++ } ++ ++ ++ public string toJSON(bool show_all) ++ { ++ var builder = new Json.Builder (); ++ builder.begin_object (); ++ ++ builder.set_member_name ("name"); ++ builder.add_string_value (this.name); ++ ++ ++ builder.set_member_name ("fn"); ++ builder.add_string_value (this.fn); ++ ++ builder.set_member_name ("xtype"); ++ builder.add_string_value (this.xtype); ++ ++ // file ??? try/false? ++ builder.set_member_name ("paths"); ++ ++ ++ builder.begin_array (); ++ ++ ++ var iter = this.paths.map_iterator(); ++ while (iter.next()) { ++ builder.add_string_value (iter.get_key()); ++ } builder.end_array (); -- } ++ if (show_all) { ++ builder.set_member_name ("files"); ++ builder.begin_array (); ++ var fiter = this.files.map_iterator(); ++ while (fiter.next()) { ++ builder.add_string_value (fiter.get_key()); ++ } ++ ++ ++ builder.end_array (); ++ } -- builder.end_object (); ++ builder.end_object (); -- var generator = new Json.Generator (); -- var root = builder.get_root (); -- generator.set_root (root); -- if (show_all) { -- generator.pretty = true; -- generator.indent = 4; -- } ++ var generator = new Json.Generator (); ++ var root = builder.get_root (); ++ generator.set_root (root); ++ if (show_all) { ++ generator.pretty = true; ++ generator.indent = 4; ++ } -- return generator.to_data (null); -- -- - } - public string firstPath() - { - var iter = this.paths.map_iterator(); - while (iter.next()) { - return iter.get_key(); - } - - return ""; -- } - -- // returns the first path -- public string getName() -- { -- var iter = this.paths.map_iterator(); -- while (iter.next()) { -- return GLib.Path.get_basename(iter.get_key()); -- } -- -- return ""; -- } -- /** -- * -- * to tree - > should -- */ -- -- public GLib.List toTree () -- { -- -- -- -- var files = new Gee.HashMap(); ++ return generator.to_data (null); ++ ++ ++ } ++ public string firstPath() ++ { ++ var iter = this.paths.map_iterator(); ++ while (iter.next()) { ++ return iter.get_key(); ++ } ++ ++ return ""; ++ } ++ ++ // returns the first path ++ public string getName() ++ { ++ var iter = this.paths.map_iterator(); ++ while (iter.next()) { ++ return GLib.Path.get_basename(iter.get_key()); ++ } ++ ++ return ""; ++ } ++ /** ++ * ++ * to tree - > should ++ */ ++ ++ public GLib.List toTree () ++ { ++ ++ ++ ++ var files = new Gee.HashMap(); -- var fiter = files.map_iterator(); -- while(fiter.next()) { -- var fo = fiter.get_value(); -- -- fo.hasParent = false; -- fo.cn = new GLib.List(); -- -- if (fo.fullname.length > 0) { -- files.set(fo.fullname, fo); -- } -- } -- -- var iter = files.map_iterator(); -- while (iter.next()) { -- var f = iter.get_value(); -- -- var par = f.parent; -- if (par.length < 1) { -- continue; -- } -- if (!files.has_key(par)) { -- continue; -- } -- files.get(par).cn.append(f); -- f.hasParent = true; -- -- }; -- -- var ret = new GLib.List(); -- iter = files.map_iterator(); -- while (iter.next()) { -- var f = iter.get_value(); -- -- // f.sortCn(); -- if (f.hasParent) { -- continue; -- } -- if (files.has_key(f.fullname)) { -- -- ret.append(f); -- } -- } -- ret.sort( (a,b) => { -- return a.path > b.path ? 1 : -1; -- }); -- -- -- //print(JSON.stringify(ret,null,4)); -- -- return ret; -- -- -- } -- -- -- -- public JsRender.JsRender? getById(string id) -- { -- -- var fiter = files.map_iterator(); -- while(fiter.next()) { -- -- var f = fiter.get_value(); -- -- -- //console.log(f.id + '?=' + id); -- if (f.id == id) { -- return f; -- } -- }; -- return null; -- } -- -- public JsRender.JsRender loadFileOnly (string path) -- { -- var xt = this.xtype; -- return JsRender.JsRender.factory(xt, this, path); -- -- } -- -- public JsRender.JsRender create(string filename) -- { -- var ret = this.loadFileOnly(filename); -- ret.save(); -- this.addFile(ret); -- return ret; -- -- } -- -- -- public void addFile(JsRender.JsRender pfile) { // add a single file, and trigger changed. ++ var fiter = this.files.map_iterator(); ++ while(fiter.next()) { ++ var fo = fiter.get_value(); ++ ++ fo.hasParent = false; ++ fo.cn = new GLib.List(); ++ ++ if (fo.fullname.length > 0) { ++ files.set(fo.fullname, fo); ++ } ++ } ++ ++ var iter = files.map_iterator(); ++ while (iter.next()) { ++ var f = iter.get_value(); ++ ++ var par = f.parent; ++ if (par.length < 1) { ++ continue; ++ } ++ if (!files.has_key(par)) { ++ continue; ++ } ++ files.get(par).cn.append(f); ++ f.hasParent = true; ++ ++ }; ++ ++ var ret = new GLib.List(); ++ iter = files.map_iterator(); ++ while (iter.next()) { ++ var f = iter.get_value(); ++ ++ // f.sortCn(); ++ if (f.hasParent) { ++ continue; ++ } ++ if (files.has_key(f.fullname)) { ++ ++ ret.append(f); ++ } ++ } ++ ret.sort( (a,b) => { ++ return a.path > b.path ? 1 : -1; ++ }); ++ ++ ++ //print(JSON.stringify(ret,null,4)); ++ ++ return ret; ++ ++ ++ } ++ ++ ++ ++ public JsRender.JsRender? getById(string id) ++ { ++ ++ var fiter = files.map_iterator(); ++ while(fiter.next()) { ++ ++ var f = fiter.get_value(); ++ ++ ++ //console.log(f.id + '?=' + id); ++ if (f.id == id) { ++ return f; ++ } ++ }; ++ return null; ++ } ++ ++ public JsRender.JsRender loadFileOnly (string path) ++ { ++ var xt = this.xtype; ++ return JsRender.JsRender.factory(xt, this, path); ++ ++ } ++ ++ public JsRender.JsRender create(string filename) ++ { ++ var ret = this.loadFileOnly(filename); ++ ret.save(); ++ this.addFile(ret); ++ return ret; ++ ++ } ++ ++ ++ public void addFile(JsRender.JsRender pfile) { // add a single file, and trigger changed. -- this.files.set(pfile.path, pfile); // duplicate check? -- this.on_changed(); -- } -- -- public void add(string path, string type) -- { -- this.paths.set(path,type); -- //Seed.print(" type is '" + type + "'"); -- if (type == "dir") { -- this.scanDir(path); -- // console.dump(this.files); -- } -- if (type == "file" ) { ++ this.files.set(pfile.path, pfile); // duplicate check? ++ this.on_changed(); ++ } ++ ++ public void add(string path, string type) ++ { ++ this.paths.set(path,type); ++ //Seed.print(" type is '" + type + "'"); ++ if (type == "dir") { ++ this.scanDir(path); ++ // console.dump(this.files); ++ } ++ if (type == "file" ) { -- this.files.set(path,this.loadFileOnly( path )); -- } -- this.on_changed(); -- -- } -- public void scanDirs() -- { -- var iter = this.paths.map_iterator(); -- while (iter.next()) { -- //print("path: " + iter.get_key() + " : " + iter.get_value() +"\n"); -- if (iter.get_value() != "dir") { -- continue; -- } -- this.scanDir(iter.get_key()); -- } -- //console.dump(this.files); -- -- } -- // list files. -- public void scanDir(string dir, int dp =0 ) -- { -- //dp = dp || 0; -- //print("Project.Base: Running scandir on " + dir +"\n"); -- if (dp > 5) { // no more than 5 deep? -- return; -- } -- // this should be done async -- but since we are getting the proto up ... -- -- var subs = new GLib.List();; -- var f = File.new_for_path(dir); -- try { -- var file_enum = f.enumerate_children(GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null); -- -- -- FileInfo next_file; -- while ((next_file = file_enum.next_file(null)) != null) { -- var fn = next_file.get_display_name(); -- -- -- //print("trying" + dir + "/" + fn +"\n"); -- -- if (fn[0] == '.') { // skip hidden -- continue; -- } -- -- if (FileUtils.test(dir + "/" + fn, GLib.FileTest.IS_DIR)) { -- subs.append(dir + "/" + fn); -- continue; -- } -- -- if (!Regex.match_simple("\\.bjs$", fn)) { -- //print("no a bjs\n"); -- continue; -- } -- /* -- var parent = ""; -- //if (dp > 0 ) { -- -- var sp = dir.split("/"); -- var parent = ""; -- for (var i = 0; i < sp.length; i++) { -- -- } -- -- /* -- sp = sp.splice(sp.length - (dp +1), (dp +1)); -- parent = sp.join('.'); -- -- -- if (typeof(_this.files[dir + '/' + fn]) != 'undefined') { -- // we already have it.. -- _this.files[dir + '/' + fn].parent = parent; -- return; -- } -- */ -- var xt = this.xtype; -- var el = JsRender.JsRender.factory(xt,this, dir + "/" + fn); -- this.files.set( dir + "/" + fn, el); -- // parent ?? -- -- -- } -- } catch (Error e) { -- print("Project::scanDirs failed : " + e.message + "\n"); -- } -- for (var i = 0; i < subs.length(); i++) { -- -- this.scanDir(subs.nth_data(i), dp+1); -- } -- -- } -- ++ this.files.set(path,this.loadFileOnly( path )); ++ } ++ this.on_changed(); ++ ++ } ++ public void scanDirs() ++ { ++ var iter = this.paths.map_iterator(); ++ while (iter.next()) { ++ //print("path: " + iter.get_key() + " : " + iter.get_value() +"\n"); ++ if (iter.get_value() != "dir") { ++ continue; ++ } ++ this.scanDir(iter.get_key()); ++ } ++ //console.dump(this.files); ++ ++ } ++ // list files. ++ public void scanDir(string dir, int dp =0 ) ++ { ++ //dp = dp || 0; ++ //print("Project.Base: Running scandir on " + dir +"\n"); ++ if (dp > 5) { // no more than 5 deep? ++ return; ++ } ++ // this should be done async -- but since we are getting the proto up ... ++ ++ var subs = new GLib.List();; ++ var f = File.new_for_path(dir); ++ try { ++ var file_enum = f.enumerate_children(GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null); ++ ++ ++ FileInfo next_file; ++ while ((next_file = file_enum.next_file(null)) != null) { ++ var fn = next_file.get_display_name(); ++ ++ ++ //print("trying" + dir + "/" + fn +"\n"); ++ ++ if (fn[0] == '.') { // skip hidden ++ continue; ++ } ++ ++ if (FileUtils.test(dir + "/" + fn, GLib.FileTest.IS_DIR)) { ++ subs.append(dir + "/" + fn); ++ continue; ++ } ++ ++ if (!Regex.match_simple("\\.bjs$", fn)) { ++ //print("no a bjs\n"); ++ continue; ++ } ++ /* ++ var parent = ""; ++ //if (dp > 0 ) { ++ ++ var sp = dir.split("/"); ++ var parent = ""; ++ for (var i = 0; i < sp.length; i++) { ++ ++ } ++ ++ /* ++ sp = sp.splice(sp.length - (dp +1), (dp +1)); ++ parent = sp.join('.'); ++ ++ ++ if (typeof(_this.files[dir + '/' + fn]) != 'undefined') { ++ // we already have it.. ++ _this.files[dir + '/' + fn].parent = parent; ++ return; ++ } ++ */ ++ var xt = this.xtype; ++ var el = JsRender.JsRender.factory(xt,this, dir + "/" + fn); ++ this.files.set( dir + "/" + fn, el); ++ // parent ?? ++ ++ ++ } ++ } catch (Error e) { ++ print("Project::scanDirs failed : " + e.message + "\n"); ++ } ++ for (var i = 0; i < subs.length(); i++) { ++ ++ this.scanDir(subs.nth_data(i), dp+1); ++ } ++ ++ } ++ ++ } } -- diff --cc Project/Roo.vala index d5194691a,d5194691a..0ddbd5989 --- a/Project/Roo.vala +++ b/Project/Roo.vala @@@ -2,11 -2,11 +2,11 @@@ static int rid = 1; --class Project.Roo : Project { ++public class Project.Roo : Project { -- Roo(string path) { ++ public Roo(string path) { base(path); diff --cc TODO.vala.version index 000000000,000000000..6466ff8e5 new file mode 100644 --- /dev/null +++ b/TODO.vala.version @@@ -1,0 -1,0 +1,15 @@@ ++ ++ ++Ctor / init handling? ++ ++new Gtk.ListStore (2, typeof (string), typeof (int)); ++syntax is no_cols, ..... -- list of colum types.. ++?? this might need a Helper? ++ ++Better handling of Packing ++.. ++normal pack is done by ++pack: add,a,b,c -> results in parent.el.pack(child,a,b,c) ++?? might need a Helper to offer standards on this? ++pack.type = add ++pack.{arg} = ... diff --cc Test.GtkWriter.vala index f3df69f35,933debeef..a5a9254fa --- a/Test.GtkWriter.vala +++ b/Test.GtkWriter.vala @@@ -53,9 -53,9 +53,10 @@@ public static int main () new JsRender.Lang_Class(); GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); - // testBuilderFile("Editor", "JSON"); - testBuilderFile("Editor", "JS"); - //testBuilderFile("Editor", "VALA"); ++ + //testBuilderFile("Editor", "JSON"); + //testBuilderFile("Editor", "JS"); + testBuilderFile("Editor", "VALA");