{ "list-files", 0, 0, OptionArg.NONE, ref opt_list_files, "List Files (in a project", null},
{ "bjs", 0, 0, OptionArg.STRING, ref opt_bjs_compile, "convert bjs file", null },
{ "bjs-glade", 0, 0, OptionArg.NONE, ref opt_bjs_compile_glade, "output glade", null },
+ { "bjs-test-all", 0, 0, OptionArg.NONE, ref opt_bjs_test, "Test all the BJS files to see if the new parser/writer would change anything", null },
{ "bjs-target", 0, 0, OptionArg.STRING, ref opt_bjs_compile_target, "convert bjs file to tareet : vala / js", null },
{ "test", 0, 0, OptionArg.STRING, ref opt_test, "run a test use 'help' to list the available tests", null },
public static string opt_compile_add;
public static string opt_compile_output;
public static string opt_bjs_compile;
+
public static string opt_bjs_compile_target;
public static string opt_test;
public static bool opt_debug = false;
public static bool opt_list_files = false;
public static bool opt_pull_resources = false;
public static bool opt_bjs_compile_glade = false;
-
+ public static bool opt_bjs_test = false;
public static string _self;
public enum Target {
this.listProjects();
var cur_project = this.compileProject();
this.listFiles(cur_project);
+ this.testBjs(cur_project);
this.compileBjs(cur_project);
this.compileVala();
GLib.Process.exit(Posix.EXIT_SUCCESS);
}
+
+ /**
+ Test to see if the internal BJS reader/writer still outputs the same files.
+ -- probably need this for the generator as well.
+ */
+
+ void testBjs(Project.Project? cur_project)
+ {
+ if (!BuilderApplication.opt_bjs_test) {
+ return;
+ }
+ if (cur_project == null) {
+ GLib.error("missing project, use --project to select which project");
+ }
+ print("Checking files\n");
+ var ar = cur_project.sortedFiles();
+ foreach(var file in ar) {
+ string oldstr;
+
+ file.loadItems();
+ GLib.FileUtils.get_contents(file.path, out oldstr);
+ var outstr = file.toJsonString();
+ if (outstr != oldstr) {
+
+ GLib.FileUtils.set_contents("/tmp/" + file.name , outstr);
+ print("diff -u %s /tmp/%s\n", file.path, file.name);
+ //GLib.Process.exit(Posix.EXIT_SUCCESS);
+ }
+ print("# Files match %s\n", file.name);
+
+ }
+
+ print("All files pass");
+ GLib.Process.exit(Posix.EXIT_SUCCESS);
+ }
+
void compileBjs(Project.Project? cur_project)
{
if (BuilderApplication.opt_bjs_compile == null) {
"response" : [
"(rid) => {",
" this.el.hide();",
- " ",
"}"
]
},
"string version" : "4.2.0",
"website" : "https://github.com/roojs/roobuilder",
"xtype" : "AboutDialog",
- "| void show" : [
+ "| void show" : [
"(Gtk.Window parent) {",
" this.el.set_transient_for(parent);",
" this.el.modal = true;",
//listeners
this.el.response.connect( (rid) => {
this.el.hide();
-
});
}
// user defined functions
- public void show (Gtk.Window parent) {
+ public void show (Gtk.Window parent) {
this.el.set_transient_for(parent);
this.el.modal = true;
this.el.show();
],
"listeners" : {
"button_press_event" : [
- " ( event) => {",
+ " ( event ) => {",
" _this.open(this.file);",
" return false;",
"} "
}
],
"xtype" : "Actor",
- "| void clearFiles" : [
+ "| void clearFiles" : [
"() {",
" ",
" this.filelayout.el.remove_all_children();",
"}",
" "
],
- "| void loadProject" : [
+ "| void loadProject" : [
"(Project.Project pr) {",
" // list all the files, and create new Xcls_fileitem for each one.",
" ",
"}",
""
],
- "| void set_size" : [
+ "| void set_size" : [
"(float w, float h) ",
"{",
" ",
public Xcls_filelayout_manager filelayout_manager;
// my vars (def)
- public Clutter.ScrollMode scroll_mode;
- public Gdk.Pixbuf missing_thumb_pixbuf;
- public signal void open (JsRender.JsRender file);
- public Project.Project project;
- public Gee.ArrayList<Object> fileitems;
// ctor
public Xcls_ClutterFiles()
this.el = new Clutter.Actor();
// my vars (dec)
- this.scroll_mode = Clutter.ScrollMode.VERTICALLY;
- this.missing_thumb_pixbuf = null;
- this.fileitems = new Gee.ArrayList<Object>();
-
- // set gobject values
- this.el.reactive = true;
var child_0 = new Xcls_project_title( _this );
child_0.ref();
this.el.add_child ( child_0.el );
}
// user defined functions
- public void clearFiles () {
+ public void clearFiles () {
this.filelayout.el.remove_all_children();
// we need to unref all the chidren that we loaded though...
}
- public void loadProject (Project.Project pr) {
+ public void loadProject (Project.Project pr) {
// list all the files, and create new Xcls_fileitem for each one.
this.project = pr;
this.el.show();
}
- public void set_size (float w, float h)
+ public void set_size (float w, float h)
{
// called by window resize... with is alreaddy -50 (for the buttons?)
this.el = new Clutter.Actor();
// my vars (dec)
-
- // set gobject values
- this.el.reactive = true;
var child_0 = new Xcls_project_title_manager( _this );
child_0.ref();
this.el.layout_manager = child_0.el;
var child_3 = new Xcls_project_title_path( _this );
child_3.ref();
this.el.add_child ( child_3.el );
-
- // init method
-
- this.el.add_constraint(
- new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
- );
- this.el.set_position(0,0);
}
// user defined functions
{
_this = _owner;
_this.project_title_manager = this;
- this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
+ this.el = new Clutter.FlowLayout();
// my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.row_spacing = 5f;
- this.el.column_spacing = 20f;
}
// user defined functions
this.el = new Clutter.FixedLayout();
// my vars (dec)
-
- // set gobject values
}
// user defined functions
this.el = new Clutter.Text.full("Sans 20px", "", Clutter.Color.from_string("#eee"));
// my vars (dec)
-
- // set gobject values
- this.el.x = 0.0f;
- this.el.y = 10.0f;
- this.el.x_expand = false;
}
// user defined functions
this.el = new Clutter.Text.full("Sans 10px", "", Clutter.Color.from_string("#ccc"));
// my vars (dec)
-
- // set gobject values
- this.el.x = 0.0f;
- this.el.y = 35.0f;
}
// user defined functions
// my vars (def)
- public Gee.ArrayList<Xcls_fileitem> fileitems;
- public Gdk.Pixbuf missing_thumb_pixbuf;
// ctor
public Xcls_scroller(Xcls_ClutterFiles _owner )
this.el = new Clutter.ScrollActor();
// my vars (dec)
- this.fileitems = new Gee.ArrayList<Xcls_fileitem>();
- this.missing_thumb_pixbuf = null;
-
- // set gobject values
- this.el.scroll_mode = Clutter.ScrollMode.VERTICALLY;
- this.el.reactive = true;
var child_0 = new Xcls_filelayout( _this );
child_0.ref();
this.el.add_child ( child_0.el );
this.el = new Clutter.Actor();
// my vars (dec)
-
- // set gobject values
- this.el.reactive = true;
var child_0 = new Xcls_filelayout_manager( _this );
child_0.ref();
this.el.layout_manager = child_0.el;
-
- // init method
-
- this.el.add_constraint(
- new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
- );
}
// user defined functions
{
_this = _owner;
_this.filelayout_manager = this;
- this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
+ this.el = new Clutter.FlowLayout();
// my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.max_column_width = 100.0f;
- this.el.row_spacing = 20f;
- this.el.column_spacing = 20f;
}
// user defined functions
// my vars (def)
- public JsRender.JsRender file;
public Xcls_image image;
public Xcls_typetitle typetitle;
public Xcls_title title;
this.el = new Clutter.Actor();
// my vars (dec)
-
- // set gobject values
- this.el.reactive = true;
var child_0 = new Xcls_BoxLayout11( _this );
child_0.ref();
this.el.layout_manager = child_0.el;
this.el.add_child ( child_3.el );
this.title = child_3;
- // init method
-
- this.file = file;
- this.el.set_size(100,100);
-
//listeners
- this.el.button_press_event.connect( ( event) => {
+ this.el.button_press_event.connect( ( event ) => {
_this.open(this.file);
return false;
});
this.el = new Clutter.BoxLayout();
// my vars (dec)
-
- // set gobject values
- this.el.spacing = 4;
- this.el.orientation = Clutter.Orientation.VERTICAL;
}
// user defined functions
this.el = new Clutter.Actor();
// my vars (dec)
-
- // set gobject values
- this.el.margin_right = 5f;
- this.el.margin_left = 5f;
- this.el.x_align = Clutter.ActorAlign.START;
- this.el.x_expand = false;
- this.el.y_align = Clutter.ActorAlign.START;
- this.el.margin_top = 5f;
- this.el.y_expand = false;
-
- // init method
-
- {
- Gdk.Pixbuf pixbuf= null;
-
- var fname = file.getIconFileName(false);
-
- try {
- if (FileUtils.test(fname, FileTest.EXISTS)) {
- pixbuf = new Gdk.Pixbuf.from_file(fname);
- }
- } catch (Error e) {
- // noop
-
- }
- if (pixbuf == null) {
-
- try {
- if (_this.missing_thumb_pixbuf == null) {
- var icon_theme = Gtk.IconTheme.get_default ();
- _this.missing_thumb_pixbuf = icon_theme.load_icon ("package-x-generic", 92, 0);
- _this.missing_thumb_pixbuf.ref();
- }
- pixbuf = _this.missing_thumb_pixbuf;
-
- } catch (Error e) {
- // noop?
- }
- }
- try {
- var img = new Clutter.Image();
- img.set_data(pixbuf.get_pixels(),
- pixbuf.has_alpha
- ? Cogl.PixelFormat.RGBA_8888
- : Cogl.PixelFormat.RGB_888,
- pixbuf.get_width (),
- pixbuf.get_height (),
- pixbuf.get_rowstride ()
- );
- this.el.set_content(img);
- } catch (Error e) {
- // noop?
- }
- // should probably do smarter scaling...
-
-
- this.el.set_size(90, 70);
- }
}
// user defined functions
this.el = new Clutter.Text.full("Sans 10px", file.nickType(), Clutter.Color.from_string("#fff"));
// my vars (dec)
-
- // set gobject values
- this.el.x_align = Clutter.ActorAlign.START;
- this.el.x_expand = false;
- this.el.y_align = Clutter.ActorAlign.START;
- this.el.y_expand = false;
}
// user defined functions
this.el = new Clutter.Text.full("Sans 10px", file.nickNameSplit(), Clutter.Color.from_string("#fff"));
// my vars (dec)
-
- // set gobject values
- this.el.x_align = Clutter.ActorAlign.START;
- this.el.x_expand = false;
- this.el.y_align = Clutter.ActorAlign.START;
- this.el.y_expand = false;
}
// user defined functions
this.el = new Clutter.Actor();
// my vars (dec)
-
- // set gobject values
- this.el.reactive = true;
var child_0 = new Xcls_BoxLayout16( _this );
child_0.ref();
this.el.layout_manager = child_0.el;
child_1.ref();
this.el.add_child ( child_1.el );
this.foldertitle = child_1;
-
- // init method
-
- //this.el.set_size(100,100);
}
// user defined functions
this.el = new Clutter.BoxLayout();
// my vars (dec)
-
- // set gobject values
- this.el.spacing = 2;
- this.el.orientation = Clutter.Orientation.VERTICAL;
}
// user defined functions
this.el = new Clutter.Text.full("Sans bold 14px", GLib.Path.get_basename(folderpath), Clutter.Color.from_string("#fff"));
// my vars (dec)
-
- // set gobject values
- this.el.x_align = Clutter.ActorAlign.START;
- this.el.x_expand = true;
- this.el.y_align = Clutter.ActorAlign.START;
- this.el.y_expand = false;
}
// user defined functions
// my vars (def)
- public string filepath;
// ctor
public Xcls_folderfile(Xcls_ClutterFiles _owner , string filepath)
// my vars (dec)
- // set gobject values
- this.el.x_align = Clutter.ActorAlign.START;
- this.el.x_expand = true;
- this.el.y_align = Clutter.ActorAlign.START;
- this.el.reactive = true;
- this.el.y_expand = true;
-
- // init method
-
- {
- this.filepath = filepath;
- }
-
//listeners
this.el.button_press_event.connect( ( event) => {
{
- "name" : "DialogConfirm",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogConfirm.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
+ "$ buttons" : "Gtk.ButtonsType.YES_NO",
+ "$ message_type" : "Gtk.MessageType.QUESTION",
+ "$ modal" : true,
+ "$ use_markup" : true,
+ "$ xns" : "Gtk",
+ "flags" : "Gtk.DialogFlags.MODAL",
"listeners" : {
- "delete_event" : " (event) => {\n this.el.response(Gtk.ResponseType.CANCEL);\n this.el.hide();\n return true;\n \n}\n \n\n\n"
+ "delete_event" : [
+ " (event) => {",
+ " this.el.response(Gtk.ResponseType.CANCEL);",
+ " this.el.hide();",
+ " return true;",
+ " ",
+ "}",
+ ""
+ ]
},
- "$ message_type" : "Gtk.MessageType.QUESTION",
+ "name" : "DialogConfirm",
"text" : "Test",
"title" : "Please Confirm ",
"xtype" : "MessageDialog",
- "$ modal" : true,
- "| int show" : " (string title, string msg) {\n //if (!this.el) { this.init(); } \n //this.success = success;\n this.el.title = title;\n this.el.text = msg;\n this.el.show_all();\n var ret = this.el.run();\n //print(\"ret got %d\", ret);\n this.el.hide();\n return ret;\n \n}\n ",
- "$ buttons" : "Gtk.ButtonsType.YES_NO",
- "$ xns" : "Gtk",
- "flags" : "Gtk.DialogFlags.MODAL",
- "$ use_markup" : true,
- "name" : "DialogConfirm"
+ "| int show" : [
+ " (string title, string msg) {",
+ " //if (!this.el) { this.init(); } ",
+ " //this.success = success;",
+ " this.el.title = title;",
+ " this.el.text = msg;",
+ " this.el.show_all();",
+ " var ret = this.el.run();",
+ " //print(\"ret got %d\", ret);",
+ " this.el.hide();",
+ " return ret;",
+ " ",
+ "}",
+ " "
+ ]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "DialogConfirm",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogConfirm.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
" this.el.hide();",
" return true; ",
" //test ",
- "}",
- " "
+ "} "
],
"response" : [
" (self, response_id) => { ",
"",
"",
" if (_this.name.el.get_text().length < 1) {",
- " StandardErrorDialog.show(",
+ " Xcls_StandardErrorDialog.singleton().show(",
" this.el,",
" \"You have to set Component name \"",
" );",
if (_this.name.el.get_text().length < 1) {
- StandardErrorDialog.show(
+ Xcls_StandardErrorDialog.singleton().show(
this.el,
"You have to set Component name "
);
{
- "name" : "DialogPluginWebkit",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/DialogPluginWebkit.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
- "listeners" : {
- "delete_event" : "(self, event) => {\n this.el.hide();\n return true; \n //test \n} \n "
- },
- "string tmpjs" : "",
- "id" : "DialogPluginWebkit",
- "utf8 title" : "Add / Edit Component",
- "gint default_height" : 500,
- "gboolean deletable" : true,
- "xtype" : "Dialog",
- "| string show" : " (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {\n \n if (parent != null) {\n this.el.set_transient_for(parent);\n this.el.modal = true;\n }\n this.result_json = \"\";\n var db = project.roo_database;\n \n \n this.el.show_all();\n var ret = \"\";\n while (true) {\n \n var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;\n string builderhtml;\n \n try {\n GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);\n } catch (Error e) {\n builderhtml = \"\";\n }\n \n\n runhtml += builderhtml + \"\\n\";\n \n \n runhtml += \"\\n\" +\n \"Builder.saveHTML = function() {};\\n\" + \n\t \"Roo.onReady(function() {\\n\" +\n\n\t \"Roo.XComponent.build();\\n\" +\n\t \"});\\n\";\n\t\n\t\n \n\n var ar = db.readForeignKeys(tbl);\n var generator = new Json.Generator ();\n var root = new Json.Node(Json.NodeType.OBJECT);\n root.init_object(ar);\n generator.set_root (root);\n \n generator.pretty = true;\n generator.indent = 4;\n \n runhtml += \"\\n\" +\n \" Roo.XComponent.on('buildcomplete', function() {\\n\" +\n \" Editor.\" + cls + \".panel.loadData(\" + generator.to_data (null) + \"); \" +\n \"});\\n\";\n\n \n\t\n\t\n\n runhtml += \"</script>\\n\" ;\n\n print(runhtml);\n // fix to make sure they are the same..\n \n // need to modify paths\n\n string inhtml;\n try {\n GLib.FileUtils.get_contents(\n BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"\n , out inhtml);\n \n } catch (Error e) {\n inhtml = \"\";\n }\n // fetch the json from the database...\n \n //print(runhtml);\n \n var html = inhtml.replace(\"</head>\", runhtml + // + this.runhtml + \n \"<script type=\\\"text/javascript\\\" src=\\\"resources://localhost/Editors/Editor.\" + cls + \".js\\\"></script>\" + \n \n \n \"</head>\");\n //print(\"LOAD HTML \" + html);\n \n //var rootURL = _this.file.project.rootURL;\n \n \n \n this.webview.el.load_html( html , \n //fixme - should be a config option!\n \"xhttp://localhost/roobuilder/\"\n );\n \n \n \n \n var response_id = this.el.run();\n \n if (response_id == 1) { // OK...\n var loop = new MainLoop();\n // run toBJS to get the data... (calls back into alert handler)\n _this.result_json = \"\";\n this.webview.el.run_javascript.begin(\"Editor.\" + cls + \".panel.toBJS();\", null, (obj, res) => {\n try {\n this.webview.el.run_javascript.end(res);\n } catch(Error e) {\n \n }\n loop.quit();\n });\n loop.run();\n ret = _this.result_json;\n \n \n // print(\"LOOP END?\");\n // try and get the resopse...\n break;\n }\n if (response_id < 1) {\n this.el.hide();\n return \"\";\n }\n // keep showing...?\n continue;\n }\n \n // now we save it..\n this.el.hide();\n \n return ret;\n \n \n \n}\n",
- "| bool has_plugin" : "(string cls) {\n\n return GLib.FileUtils.test(\n BuilderApplication.configDirectory() + \"/resources/Editors/Editor.\" + cls + \".js\",\n GLib.FileTest.IS_REGULAR\n );\n \n\n\n}\n",
"$ xns" : "Gtk",
- "gint default_width" : 750,
+ "gboolean deletable" : true,
"gboolean modal" : true,
- "string result_json" : "",
+ "gint default_height" : 500,
+ "gint default_width" : 750,
+ "id" : "DialogPluginWebkit",
"items" : [
{
- "xtype" : "Box",
"$ pack" : "get_content_area().add",
- "gboolean homogeneous" : false,
"$ xns" : "Gtk",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "gboolean homogeneous" : false,
"items" : [
{
- "* init" : " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
+ "$ xns" : "Gtk",
+ "* init" : [
+ " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ " ",
+ ""
+ ],
"* pack" : "pack_start,false,true,3",
- "xtype" : "ScrolledWindow",
"gboolean expand" : true,
- "$ xns" : "Gtk",
"items" : [
{
+ "$ xns" : "WebKit",
+ "* init" : [
+ " {",
+ " // this may not work!?",
+ " var settings = this.el.get_settings();",
+ " settings.enable_write_console_messages_to_stdout = true;",
+ " ",
+ " var fs= new FakeServer(this.el);",
+ " fs.ref();",
+ " // this was an attempt to change the url perms.. did not work..",
+ " // settings.enable_file_access_from_file_uris = true;",
+ " // settings.enable_offline_web_application_cache - true;",
+ " // settings.enable_universal_access_from_file_uris = true;",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ "",
+ " // FIXME - base url of script..",
+ " // we need it so some of the database features work.",
+ " this.el.load_html( \"Render not ready\" , ",
+ " //fixme - should be a config option!",
+ " // or should we catch stuff and fix it up..",
+ " \"xhttp://localhost/roobuilder/\"",
+ " );",
+ " ",
+ " ",
+ " ",
+ " ",
+ "}",
+ ""
+ ],
+ "* pack" : "add",
+ "id" : "webview",
"listeners" : {
- "script_dialog" : " (dialog) => {\n if (this.el == null) {\n return true;\n }\n \n var msg = dialog.get_message();\n if (msg.length < 4) {\n return false;\n }\n if (msg.substring(0,4) != \"IPC:\") {\n return false;\n }\n var ar = msg.split(\":\", 3);\n if (ar.length < 3) {\n return false;\n }\n print(\"CMD: %s\\n\",ar[1]);\n print(\"ARGS: %s\\n\",ar[2]);\n switch(ar[1]) {\n \n case \"SAVEHTML\":\n // print(\"%sw\",ar[2]);\n // _this.file.saveHTML(ar[2]);\n return true;\n \n case \"OUT\":\n _this.result_json = ar[2];\n return true;\n \n default:\n return true;\n }\n \n}"
+ "script_dialog" : [
+ " (dialog) => {",
+ " if (this.el == null) {",
+ " return true;",
+ " }",
+ " ",
+ " var msg = dialog.get_message();",
+ " if (msg.length < 4) {",
+ " return false;",
+ " }",
+ " if (msg.substring(0,4) != \"IPC:\") {",
+ " return false;",
+ " }",
+ " var ar = msg.split(\":\", 3);",
+ " if (ar.length < 3) {",
+ " return false;",
+ " }",
+ " print(\"CMD: %s\\n\",ar[1]);",
+ " print(\"ARGS: %s\\n\",ar[2]);",
+ " switch(ar[1]) {",
+ " ",
+ " case \"SAVEHTML\":",
+ " // print(\"%sw\",ar[2]);",
+ " // _this.file.saveHTML(ar[2]);",
+ " return true;",
+ " ",
+ " case \"OUT\":",
+ " _this.result_json = ar[2];",
+ " return true;",
+ " ",
+ " default:",
+ " return true;",
+ " }",
+ " ",
+ "}"
+ ]
},
- "id" : "webview",
- "* init" : " {\n // this may not work!?\n var settings = this.el.get_settings();\n settings.enable_write_console_messages_to_stdout = true;\n \n var fs= new FakeServer(this.el);\n fs.ref();\n // this was an attempt to change the url perms.. did not work..\n // settings.enable_file_access_from_file_uris = true;\n // settings.enable_offline_web_application_cache - true;\n // settings.enable_universal_access_from_file_uris = true;\n \n \n \n \n \n\n // FIXME - base url of script..\n // we need it so some of the database features work.\n this.el.load_html( \"Render not ready\" , \n //fixme - should be a config option!\n // or should we catch stuff and fix it up..\n \"xhttp://localhost/roobuilder/\"\n );\n \n \n \n \n}\n",
- "xtype" : "WebView",
- "* pack" : "add",
- "$ xns" : "WebKit"
+ "xtype" : "WebView"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "label" : "Reload",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,3",
- "$ xns" : "Gtk"
+ "label" : "Reload",
+ "xtype" : "Button"
},
{
- "label" : "Cancel",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,0",
- "xtype" : "Button",
- "$ xns" : "Gtk"
+ "label" : "Cancel",
+ "xtype" : "Button"
},
{
- "label" : "OK",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,1",
- "$ xns" : "Gtk"
+ "label" : "OK",
+ "xtype" : "Button"
}
+ ],
+ "listeners" : {
+ "delete_event" : [
+ "(self, event) => {",
+ " this.el.hide();",
+ " return true; ",
+ " //test ",
+ "} "
+ ]
+ },
+ "string result_json" : "",
+ "string tmpjs" : "",
+ "utf8 title" : "Add / Edit Component",
+ "xtype" : "Dialog",
+ "| bool has_plugin" : [
+ "(string cls) {",
+ "",
+ " return GLib.FileUtils.test(",
+ " BuilderApplication.configDirectory() + \"/resources/Editors/Editor.\" + cls + \".js\",",
+ " GLib.FileTest.IS_REGULAR",
+ " );",
+ " ",
+ "",
+ "",
+ "}",
+ ""
+ ],
+ "| string show" : [
+ " (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {",
+ " ",
+ " if (parent != null) {",
+ " this.el.set_transient_for(parent);",
+ " this.el.modal = true;",
+ " }",
+ " this.result_json = \"\";",
+ " var db = project.roo_database;",
+ " ",
+ " ",
+ " this.el.show_all();",
+ " var ret = \"\";",
+ " while (true) {",
+ " ",
+ " var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;",
+ " string builderhtml;",
+ " ",
+ " try {",
+ " GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);",
+ " } catch (Error e) {",
+ " builderhtml = \"\";",
+ " }",
+ " ",
+ "",
+ " runhtml += builderhtml + \"\\n\";",
+ " ",
+ " ",
+ " runhtml += \"\\n\" +",
+ " \"Builder.saveHTML = function() {};\\n\" + ",
+ "\t \"Roo.onReady(function() {\\n\" +",
+ "",
+ "\t \"Roo.XComponent.build();\\n\" +",
+ "\t \"});\\n\";",
+ "\t",
+ "\t",
+ " ",
+ "",
+ " var ar = db.readForeignKeys(tbl);",
+ " var generator = new Json.Generator ();",
+ " var root = new Json.Node(Json.NodeType.OBJECT);",
+ " root.init_object(ar);",
+ " generator.set_root (root);",
+ " ",
+ " generator.pretty = true;",
+ " generator.indent = 4;",
+ " ",
+ " runhtml += \"\\n\" +",
+ " \" Roo.XComponent.on('buildcomplete', function() {\\n\" +",
+ " \" Editor.\" + cls + \".panel.loadData(\" + generator.to_data (null) + \"); \" +",
+ " \"});\\n\";",
+ "",
+ " ",
+ "\t",
+ "\t",
+ "",
+ " runhtml += \"</script>\\n\" ;",
+ "",
+ " print(runhtml);",
+ " // fix to make sure they are the same..",
+ " ",
+ " // need to modify paths",
+ "",
+ " string inhtml;",
+ " try {",
+ " GLib.FileUtils.get_contents(",
+ " BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"",
+ " , out inhtml);",
+ " ",
+ " } catch (Error e) {",
+ " inhtml = \"\";",
+ " }",
+ " // fetch the json from the database...",
+ " ",
+ " //print(runhtml);",
+ " ",
+ " var html = inhtml.replace(\"</head>\", runhtml + // + this.runhtml + ",
+ " \"<script type=\\\"text/javascript\\\" src=\\\"resources://localhost/Editors/Editor.\" + cls + \".js\\\"></script>\" + ",
+ " ",
+ " ",
+ " \"</head>\");",
+ " //print(\"LOAD HTML \" + html);",
+ " ",
+ " //var rootURL = _this.file.project.rootURL;",
+ " ",
+ " ",
+ " ",
+ " this.webview.el.load_html( html , ",
+ " //fixme - should be a config option!",
+ " \"xhttp://localhost/roobuilder/\"",
+ " );",
+ " ",
+ " ",
+ " ",
+ " ",
+ " var response_id = this.el.run();",
+ " ",
+ " if (response_id == 1) { // OK...",
+ " var loop = new MainLoop();",
+ " // run toBJS to get the data... (calls back into alert handler)",
+ " _this.result_json = \"\";",
+ " this.webview.el.run_javascript.begin(\"Editor.\" + cls + \".panel.toBJS();\", null, (obj, res) => {",
+ " try {",
+ " this.webview.el.run_javascript.end(res);",
+ " } catch(Error e) {",
+ " ",
+ " }",
+ " loop.quit();",
+ " });",
+ " loop.run();",
+ " ret = _this.result_json;",
+ " ",
+ " ",
+ " // print(\"LOOP END?\");",
+ " // try and get the resopse...",
+ " break;",
+ " }",
+ " if (response_id < 1) {",
+ " this.el.hide();",
+ " return \"\";",
+ " }",
+ " // keep showing...?",
+ " continue;",
+ " }",
+ " ",
+ " // now we save it..",
+ " this.el.hide();",
+ " ",
+ " return ret;",
+ " ",
+ " ",
+ " ",
+ "}",
+ ""
]
}
- ]
-}
+ ],
+ "modOrder" : "",
+ "name" : "DialogPluginWebkit",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogPluginWebkit.bjs",
+ "permname" : "",
+ "title" : ""
+}
\ No newline at end of file
{
- "name" : "DialogSaveModule",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/DialogSaveModule.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
- "listeners" : {
- "delete_event" : " (self, event) => {\n this.el.response(Gtk.ResponseType.CANCEL);\n return true;\n} "
- },
- "default_width" : 400,
+ "# JsRender.Node data" : "",
"# Project.Project project" : "",
- "xtype" : "Dialog",
- "default_height" : 200,
"$ modal" : true,
- "# JsRender.Node data" : "",
- "| string show" : " (Gtk.Window parent, Project.Project project, JsRender.Node data) {\n \n \n this.el.set_transient_for(parent);\n this.el.modal = true;\n \n this.data = data;\n this.project = project;\n this.name.el.set_text(\"\");\n this.el.show_all();\n var name = \"\";\n while (true) {\n var response_id = this.el.run();\n if (response_id < 1) {\n this.el.hide();\n return \"\";\n }\n \n name = _this.name.el.get_text();\n if (name.length < 1) {\n StandardErrorDialog.singleton().show(\n _this.el,\n \"You must give the template a name. \"\n );\n continue;\n }\n if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9.]+$\", name) )\n {\n StandardErrorDialog.singleton().show(\n _this.el,\n \"Template Name must contain only letters dots\"\n );\n continue;\n }\n break;\n }\n var f = project.newFile(name);\n f.tree = _this.data.deepClone();\n f.save();\n \n // now we save it..\n this.el.hide();\n \n return name;\n \n \n \n}\n",
"$ xns" : "Gtk",
+ "default_height" : 200,
+ "default_width" : 400,
"items" : [
{
- "xtype" : "Box",
- "$ pack" : " get_content_area().add\n\n",
+ "$ pack" : [
+ " get_content_area().add",
+ "",
+ ""
+ ],
"$ xns" : "Gtk",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
- "label" : "Name",
- "xtype" : "Label",
+ "$ xns" : "Gtk",
"* pack" : "add",
- "$ xns" : "Gtk"
+ "label" : "Name",
+ "xtype" : "Label"
},
{
- "id" : "name",
- "xtype" : "Entry",
+ "$ xns" : "Gtk",
"* pack" : "add",
- "$ xns" : "Gtk"
+ "id" : "name",
+ "xtype" : "Entry"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "label" : "Cancel",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,0",
- "$ xns" : "Gtk"
+ "label" : "Cancel",
+ "xtype" : "Button"
},
{
- "label" : "OK",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,1",
- "$ xns" : "Gtk"
+ "label" : "OK",
+ "xtype" : "Button"
}
+ ],
+ "listeners" : {
+ "delete_event" : [
+ " (self, event) => {",
+ " this.el.response(Gtk.ResponseType.CANCEL);",
+ " return true;",
+ "} "
+ ]
+ },
+ "xtype" : "Dialog",
+ "| string show" : [
+ " (Gtk.Window parent, Project.Project project, JsRender.Node data) {",
+ " ",
+ " ",
+ " this.el.set_transient_for(parent);",
+ " this.el.modal = true;",
+ " ",
+ " this.data = data;",
+ " this.project = project;",
+ " this.name.el.set_text(\"\");",
+ " this.el.show_all();",
+ " var name = \"\";",
+ " while (true) {",
+ " var response_id = this.el.run();",
+ " if (response_id < 1) {",
+ " this.el.hide();",
+ " return \"\";",
+ " }",
+ " ",
+ " name = _this.name.el.get_text();",
+ " if (name.length < 1) {",
+ " Xcls_StandardErrorDialog.singleton().show(",
+ " _this.el,",
+ " \"You must give the template a name. \"",
+ " );",
+ " continue;",
+ " }",
+ " if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9.]+$\", name) )",
+ " {",
+ " Xcls_StandardErrorDialog.singleton().show(",
+ " _this.el,",
+ " \"Template Name must contain only letters dots\"",
+ " );",
+ " continue;",
+ " }",
+ " break;",
+ " }",
+ " var f = project.newFile(name);",
+ " f.tree = _this.data.deepClone();",
+ " f.save();",
+ " ",
+ " // now we save it..",
+ " this.el.hide();",
+ " ",
+ " return name;",
+ " ",
+ " ",
+ " ",
+ "}",
+ ""
]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "DialogSaveModule",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogSaveModule.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
name = _this.name.el.get_text();
if (name.length < 1) {
- StandardErrorDialog.singleton().show(
+ Xcls_StandardErrorDialog.singleton().show(
_this.el,
"You must give the template a name. "
);
}
if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9.]+$", name) )
{
- StandardErrorDialog.singleton().show(
+ Xcls_StandardErrorDialog.singleton().show(
_this.el,
"Template Name must contain only letters dots"
);
{
- "name" : "DialogSaveTemplate",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/DialogSaveTemplate.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
- "listeners" : {
- "delete_event" : " (self, event) => {\n this.el.response(Gtk.ResponseType.CANCEL);\n return true;\n \n}"
- },
- "default_width" : 400,
- "| void show" : " (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {\n \n \n this.el.set_transient_for(parent);\n this.el.modal = true;\n \n this.name.el.set_text(\"\");\n this.el.show_all();\n var name = \"\";\n while (true) {\n var response_id = this.el.run();\n if (response_id < 1) {\n this.el.hide();\n return;\n }\n \n name = _this.name.el.get_text();\n if (name.length < 1) {\n StandardErrorDialog.singleton().show(\n _this.el,\n \"You must give the template a name. \"\n );\n continue;\n }\n if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9. ]+$\", name) )\n {\n StandardErrorDialog.singleton().show(\n _this.el,\n \"Template Name must contain only letters dots\"\n );\n continue;\n }\n break;\n }\n palete.saveTemplate(name, data);\n \n // now we save it..\n this.el.hide();\n \n \n \n \n}\n",
- "xtype" : "Dialog",
- "default_height" : 200,
+ "# JsRender.Node data" : "",
"# Palete.Palete palete" : "",
"$ modal" : true,
- "# JsRender.Node data" : "",
"$ xns" : "Gtk",
+ "default_height" : 200,
+ "default_width" : 400,
"items" : [
{
- "xtype" : "Box",
- "$ pack" : " get_content_area().add\n\n",
+ "$ pack" : [
+ " get_content_area().add",
+ "",
+ ""
+ ],
"$ xns" : "Gtk",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
- "label" : "Name",
- "xtype" : "Label",
+ "$ xns" : "Gtk",
"* pack" : "add",
- "$ xns" : "Gtk"
+ "label" : "Name",
+ "xtype" : "Label"
},
{
- "id" : "name",
- "xtype" : "Entry",
+ "$ xns" : "Gtk",
"* pack" : "add",
- "$ xns" : "Gtk"
+ "id" : "name",
+ "xtype" : "Entry"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "label" : "Cancel",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,0",
- "$ xns" : "Gtk"
+ "label" : "Cancel",
+ "xtype" : "Button"
},
{
- "label" : "OK",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,1",
- "$ xns" : "Gtk"
+ "label" : "OK",
+ "xtype" : "Button"
}
+ ],
+ "listeners" : {
+ "delete_event" : [
+ " (self, event) => {",
+ " this.el.response(Gtk.ResponseType.CANCEL);",
+ " return true;",
+ " ",
+ "}"
+ ]
+ },
+ "xtype" : "Dialog",
+ "| void show" : [
+ " (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {",
+ " ",
+ " ",
+ " this.el.set_transient_for(parent);",
+ " this.el.modal = true;",
+ " ",
+ " this.name.el.set_text(\"\");",
+ " this.el.show_all();",
+ " var name = \"\";",
+ " while (true) {",
+ " var response_id = this.el.run();",
+ " if (response_id < 1) {",
+ " this.el.hide();",
+ " return;",
+ " }",
+ " ",
+ " name = _this.name.el.get_text();",
+ " if (name.length < 1) {",
+ " Xcls_StandardErrorDialog.singleton().show(",
+ " _this.el,",
+ " \"You must give the template a name. \"",
+ " );",
+ " continue;",
+ " }",
+ " if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9. ]+$\", name) )",
+ " {",
+ " Xcls_StandardErrorDialog.singleton().show(",
+ " _this.el,",
+ " \"Template Name must contain only letters dots\"",
+ " );",
+ " continue;",
+ " }",
+ " break;",
+ " }",
+ " palete.saveTemplate(name, data);",
+ " ",
+ " // now we save it..",
+ " this.el.hide();",
+ " ",
+ " ",
+ " ",
+ " ",
+ "}",
+ ""
]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "DialogSaveTemplate",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogSaveTemplate.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
this.el.delete_event.connect( (self, event) => {
this.el.response(Gtk.ResponseType.CANCEL);
return true;
-
+
});
}
name = _this.name.el.get_text();
if (name.length < 1) {
- StandardErrorDialog.singleton().show(
+ Xcls_StandardErrorDialog.singleton().show(
_this.el,
"You must give the template a name. "
);
}
if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9. ]+$", name) )
{
- StandardErrorDialog.singleton().show(
+ Xcls_StandardErrorDialog.singleton().show(
_this.el,
"Template Name must contain only letters dots"
);
{
- "name" : "DialogTemplateSelect",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/DialogTemplateSelect.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
- "listeners" : {
- "delete_event" : " (self, event) =>{\n this.el.hide();\n return true;\n} "
- },
- "default_width" : 400,
- "title" : "Add an Object",
- "xtype" : "Dialog",
- "default_height" : 200,
"$ modal" : true,
"$ xns" : "Gtk",
- "| JsRender.Node? show" : " (Xcls_MainWindow mwindow, Palete.Palete pal, JsRender.Node node, Project.Project project) {\n \n this.el.show_all();\n var opts = pal.listTemplates(node);\n if (opts.length() < 1) {\n this.el.hide();\n return node;\n }\n this.el.set_attached_to( mwindow.el);\n this.el.set_transient_for( mwindow.el);\n \n //opts.unshift({ path: '' , name :'Just add Element' });\n _this.model.loadData(opts);\n _this.combo.el.set_active(-1);\n \n \n var db = new Palete.RooDatabase.from_project(project);\n _this.dbmodel.loadData(db.readTablesGee());\n \n var plug = mwindow.windowstate.webkit_plugin;\n \n _this.dbcombo.el.set_active(-1);\n \n \n \n var res = this.el.run();\n this.el.hide(); \n //var ix = _this.combo.el.get_active();\n if (res < 1 ) {\n return null; // 0 = cancel.\n }\n if (res < 2 ) {\n return node; // 1 = just add it..\n }\n \n // have they selected a table??\n \n Gtk.TreeIter iter; \n Value vfname; \n if (_this.dbcombo.el.get_active_iter (out iter)) { \n this.dbmodel.el.get_value (iter, 0, out vfname);\n if (((string)vfname).length > 0 && plug.has_plugin(node.fqn())) {\n var json_str = plug.show(mwindow.el, project, node.fqn(), (string)vfname);\n print(\"json_str = %s\\n\", json_str);\n if (json_str.length < 1) {\n\n return node;\n }\n var pa = new Json.Parser();\n try {\n\n\t pa.load_from_data(json_str);\n\t } catch(Error e) {\n\t return node;\n\t }\n\t var new_node = pa.get_root();\n \n\t if (new_node.get_node_type () != Json.NodeType.OBJECT) {\n\t\t return node;\n\t }\n\t var obj = new_node.get_object ();\n\n\t var ret = new JsRender.Node();\n\n\t ret.loadFromJson(obj, 1);\n\t return ret;\n }\n \n }\n\n if (!_this.combo.el.get_active_iter (out iter)) {\n\n return node; // nothing selected...\n }\n \n this.model.el.get_value (iter, 0, out vfname);\n \n \n return pal.loadTemplate((string)vfname);\n\n}\n",
+ "default_height" : 200,
+ "default_width" : 400,
"items" : [
{
- "xtype" : "Box",
"$ pack" : "get_content_area().add ",
"$ xns" : "Gtk",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"items" : [
{
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Box",
- "gint margin" : 3,
"$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "gint margin" : 3,
"items" : [
{
- "label" : "Select Template : ",
- "xtype" : "Label",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false",
- "$ xns" : "Gtk"
+ "label" : "Select Template : ",
+ "xtype" : "Label"
},
{
- "id" : "combo",
+ "$ xns" : "Gtk",
"* init" : "this.el.add_attribute(_this.cellrenderer.el , \"markup\", 1 );",
- "xtype" : "ComboBox",
"* pack" : "add",
- "$ xns" : "Gtk",
+ "id" : "combo",
"items" : [
{
- "id" : "cellrenderer",
- "xtype" : "CellRendererText",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,true",
- "$ xns" : "Gtk"
+ "id" : "cellrenderer",
+ "xtype" : "CellRendererText"
},
{
- "id" : "model",
- "* pack" : "set_model",
- "xtype" : "ListStore",
"$ columns" : "typeof(string),typeof(string)",
- "n_columns" : 2,
"$ xns" : "Gtk",
- "| void loadData" : " (GLib.List<string> 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, \"aaa - Just add Element - aaa\");\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, str);\n el.set_value(iter, 1, fn);\n \n }\n this.el.set_sort_column_id(1, Gtk.SortType.ASCENDING); \n \n}\n"
+ "* pack" : "set_model",
+ "id" : "model",
+ "n_columns" : 2,
+ "xtype" : "ListStore",
+ "| void loadData" : [
+ " (GLib.List<string> 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, \"aaa - Just add Element - aaa\");",
+ " ",
+ " 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, str);",
+ " el.set_value(iter, 1, fn);",
+ " ",
+ " }",
+ " this.el.set_sort_column_id(1, Gtk.SortType.ASCENDING); ",
+ " ",
+ "}",
+ ""
+ ]
}
- ]
+ ],
+ "xtype" : "ComboBox"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Box",
- "gint margin" : 3,
"$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "gint margin" : 3,
"items" : [
{
- "label" : "Select Database Table : ",
- "xtype" : "Label",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false",
- "$ xns" : "Gtk"
+ "label" : "Select Database Table : ",
+ "xtype" : "Label"
},
{
- "id" : "dbcombo",
+ "$ xns" : "Gtk",
"* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
- "xtype" : "ComboBox",
"* pack" : "add",
- "$ xns" : "Gtk",
+ "id" : "dbcombo",
"items" : [
{
- "id" : "dbcellrenderer",
- "xtype" : "CellRendererText",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,true",
- "$ xns" : "Gtk"
+ "id" : "dbcellrenderer",
+ "xtype" : "CellRendererText"
},
{
- "id" : "dbmodel",
- "* pack" : "set_model",
- "xtype" : "ListStore",
"$ columns" : "typeof(string),typeof(string)",
- "n_columns" : 2,
"$ xns" : "Gtk",
- "| void loadData" : " (Gee.ArrayList<string> 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, \"aaa - Just add Element - aaa\");\n\n el.append(out iter);\n\n \n el.set_value(iter, 0, \"\");\n el.set_value(iter, 1, \"-- select a table --\");\n \n \n for (var i = 0; i < data.size;i++) {\n \n\n el.append(out iter);\n \n el.set_value(iter, 0, data.get(i));\n el.set_value(iter, 1, data.get(i));\n \n }\n this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); \n \n}\n"
+ "* pack" : "set_model",
+ "id" : "dbmodel",
+ "n_columns" : 2,
+ "xtype" : "ListStore",
+ "| void loadData" : [
+ " (Gee.ArrayList<string> 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, \"aaa - Just add Element - aaa\");",
+ "",
+ " el.append(out iter);",
+ "",
+ " ",
+ " el.set_value(iter, 0, \"\");",
+ " el.set_value(iter, 1, \"-- select a table --\");",
+ " ",
+ " ",
+ " for (var i = 0; i < data.size;i++) {",
+ " ",
+ "",
+ " el.append(out iter);",
+ " ",
+ " el.set_value(iter, 0, data.get(i));",
+ " el.set_value(iter, 1, data.get(i));",
+ " ",
+ " }",
+ " this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); ",
+ " ",
+ "}",
+ ""
+ ]
}
- ]
+ ],
+ "xtype" : "ComboBox"
}
- ]
+ ],
+ "xtype" : "Box"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "label" : "Cancel",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,0",
- "$ xns" : "Gtk"
+ "label" : "Cancel",
+ "xtype" : "Button"
},
{
- "label" : "Just add it",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,1",
- "xtype" : "Button",
- "$ xns" : "Gtk"
+ "label" : "Just add it",
+ "xtype" : "Button"
},
{
- "label" : "OK",
- "xtype" : "Button",
+ "$ xns" : "Gtk",
"* pack" : "add_action_widget,2",
- "$ xns" : "Gtk"
+ "label" : "OK",
+ "xtype" : "Button"
}
+ ],
+ "listeners" : {
+ "delete_event" : [
+ " (self, event) =>{",
+ " this.el.hide();",
+ " return true;",
+ "}"
+ ]
+ },
+ "title" : "Add an Object",
+ "xtype" : "Dialog",
+ "| JsRender.Node? show" : [
+ " (Xcls_MainWindow mwindow, Palete.Palete pal, JsRender.Node node, Project.Project project) {",
+ " ",
+ " this.el.show_all();",
+ " var opts = pal.listTemplates(node);",
+ " if (opts.length() < 1) {",
+ " this.el.hide();",
+ " return node;",
+ " }",
+ " this.el.set_attached_to( mwindow.el);",
+ " this.el.set_transient_for( mwindow.el);",
+ " ",
+ " //opts.unshift({ path: '' , name :'Just add Element' });",
+ " _this.model.loadData(opts);",
+ " _this.combo.el.set_active(-1);",
+ " ",
+ " ",
+ " var db = new Palete.RooDatabase.from_project(project);",
+ " _this.dbmodel.loadData(db.readTablesGee());",
+ " ",
+ " var plug = mwindow.windowstate.webkit_plugin;",
+ " ",
+ " _this.dbcombo.el.set_active(-1);",
+ " ",
+ " ",
+ " ",
+ " var res = this.el.run();",
+ " this.el.hide(); ",
+ " //var ix = _this.combo.el.get_active();",
+ " if (res < 1 ) {",
+ " return null; // 0 = cancel.",
+ " }",
+ " if (res < 2 ) {",
+ " return node; // 1 = just add it..",
+ " }",
+ " ",
+ " // have they selected a table??",
+ " ",
+ " Gtk.TreeIter iter; ",
+ " Value vfname; ",
+ " if (_this.dbcombo.el.get_active_iter (out iter)) { ",
+ " this.dbmodel.el.get_value (iter, 0, out vfname);",
+ " if (((string)vfname).length > 0 && plug.has_plugin(node.fqn())) {",
+ " var json_str = plug.show(mwindow.el, project, node.fqn(), (string)vfname);",
+ " print(\"json_str = %s\\n\", json_str);",
+ " if (json_str.length < 1) {",
+ "",
+ " return node;",
+ " }",
+ " var pa = new Json.Parser();",
+ " try {",
+ "",
+ "\t pa.load_from_data(json_str);",
+ "\t } catch(Error e) {",
+ "\t return node;",
+ "\t }",
+ "\t var new_node = pa.get_root();",
+ " ",
+ "\t if (new_node.get_node_type () != Json.NodeType.OBJECT) {",
+ "\t\t return node;",
+ "\t }",
+ "\t var obj = new_node.get_object ();",
+ "",
+ "\t var ret = new JsRender.Node();",
+ "",
+ "\t ret.loadFromJson(obj, 1);",
+ "\t return ret;",
+ " }",
+ " ",
+ " }",
+ "",
+ " if (!_this.combo.el.get_active_iter (out iter)) {",
+ "",
+ " return node; // nothing selected...",
+ " }",
+ " ",
+ " this.model.el.get_value (iter, 0, out vfname);",
+ " ",
+ " ",
+ " return pal.loadTemplate((string)vfname);",
+ "",
+ "}",
+ ""
]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "DialogTemplateSelect",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogTemplateSelect.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
" _this.model.loadData();",
" this.el.show_all();",
" ",
- " var err_dialog = StandardErrorDialog.singleton();",
+ " var err_dialog = Xcls_StandardErrorDialog.singleton();",
"",
" var id = -1;",
" while (id < 0) {",
_this.model.loadData();
this.el.show_all();
- var err_dialog = StandardErrorDialog.singleton();
+ var err_dialog = Xcls_StandardErrorDialog.singleton();
var id = -1;
while (id < 0) {
{
"# JsRender.JsRender? file" : "null",
"# JsRender.Node node" : "null",
+ "# JsRender.NodeProp? prop" : "null",
"# Xcls_MainWindow window" : "null",
"# bool dirty" : false,
"# bool pos" : false,
"# int pos_root_x" : "",
"# int pos_root_y" : "",
"# string activeEditor" : "\"\"",
- "# string key" : "\"\"",
- "# string ptype" : "\"\"",
"$ homogeneous" : false,
"$ xns" : "Gtk",
"* pack" : "add",
" p.javascriptHasErrors(",
" \t\t_this.window.windowstate,",
" str, ",
- " _this.key, ",
- " _this.ptype,",
- " _this.file,",
- " ",
+ " _this.prop,",
+ " _this.file, // no reference not node?",
" out errors",
" );",
" return this.highlightErrors(errors); ",
" if (! _this.window.windowstate.valasource.checkFileWithNodePropChange(",
" _this.file,",
" _this.node,",
- " _this.key, ",
- " _this.ptype,",
+ " _this.prop, ",
" str",
" )) {",
" this.check_running = false;",
],
"string id" : "Editor",
"xtype" : "Box",
- "| bool saveContents" : [
+ "| void show" : [
+ "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
+ "{",
+ " this.reset();",
+ " this.file = file; ",
+ " ",
+ " if (file.xtype != \"PlainFile\") {",
+ " \tthis.prop = prop;",
+ " this.node = node;",
+ "",
+ " // find the text for the node..",
+ " this.view.load( prop.val );",
+ " this.key_edit.el.show();",
+ " this.key_edit.el.text = prop.rtype + \" \" + prop.name; ",
+ " ",
+ " } else {",
+ " this.view.load( file.toSource() );",
+ " this.key_edit.el.hide();",
+ " }",
+ " ",
+ "}"
+ ],
+ "| bool saveContents" : [
" () {",
" ",
" ",
" return true;",
" }",
" ",
- " ",
- " ",
- " ",
+ " ",
" ",
" var str = _this.buffer.toString();",
" ",
" ",
" // find the text for the node..",
" if (_this.file.xtype != \"PlainFile\") {",
- " if (ptype == \"listener\") {",
- " this.node.listeners.set(key,str);",
- " ",
- " } else {",
- " this.node.props.set(key,str);",
- " }",
+ " // in theory these properties have to exist!?!",
+ " \tthis.prop.val = str;",
+ " this.window.windowstate.left_props.reload();",
" } else {",
" _this.file.setSource( str );",
" }",
"",
"} "
],
- "| void show" : [
- "(JsRender.JsRender file, JsRender.Node? node, string ptype, string key)",
- "{",
- " this.reset();",
- " this.file = file; ",
- " ",
- " if (file.xtype != \"PlainFile\") {",
- " ",
- " this.ptype = ptype;",
- " this.key = key;",
- " this.node = node;",
- " string val = \"\";",
- " // find the text for the node..",
- " if (ptype == \"listener\") {",
- " val = node.listeners.get(key);",
- " ",
- " } else {",
- " val = node.props.get(key);",
- " }",
- " this.view.load(val);",
- " this.key_edit.el.show();",
- " this.key_edit.el.text = key; ",
- " ",
- " } else {",
- " this.view.load( file.toSource() );",
- " this.key_edit.el.hide();",
- " }",
- " ",
- "}"
- ],
"| int search" : [
"(string txt) {",
"",
"| void reset" : [
"() {",
"\t this.file = null; ",
- " this.ptype = \"\";",
- " this.key = \"\";",
+ " ",
" this.node = null;",
+ " this.prop = null;",
"\tthis.searchcontext = null;",
" ",
"}",
// my vars (def)
public Xcls_MainWindow window;
public string activeEditor;
+ public JsRender.NodeProp? prop;
public int pos_root_x;
public JsRender.JsRender? file;
public int pos_root_y;
- public string ptype;
public int last_search_end;
- public string key;
public Gtk.SourceSearchContext searchcontext;
public bool pos;
public bool dirty;
// my vars (dec)
this.window = null;
this.activeEditor = "";
+ this.prop = null;
this.file = null;
- this.ptype = "";
this.last_search_end = 0;
- this.key = "";
this.searchcontext = null;
this.pos = false;
this.dirty = false;
}
// user defined functions
- public bool saveContents () {
-
-
- if (_this.file == null) {
- return true;
- }
-
-
-
-
-
- var str = _this.buffer.toString();
-
- _this.buffer.checkSyntax();
-
-
-
- // LeftPanel.model.changed( str , false);
- _this.dirty = false;
- _this.save_button.el.sensitive = false;
-
- // find the text for the node..
- if (_this.file.xtype != "PlainFile") {
- if (ptype == "listener") {
- this.node.listeners.set(key,str);
-
- } else {
- this.node.props.set(key,str);
- }
- } else {
- _this.file.setSource( str );
- }
-
- // call the signal..
- this.save();
-
- return true;
-
- }
public void scroll_to_line (int line) {
GLib.Timeout.add(500, () => {
}
- public void show (JsRender.JsRender file, JsRender.Node? node, string ptype, string key)
+ public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
{
this.reset();
this.file = file;
if (file.xtype != "PlainFile") {
-
- this.ptype = ptype;
- this.key = key;
+ this.prop = prop;
this.node = node;
- string val = "";
+
// find the text for the node..
- if (ptype == "listener") {
- val = node.listeners.get(key);
-
- } else {
- val = node.props.get(key);
- }
- this.view.load(val);
+ this.view.load( prop.val );
this.key_edit.el.show();
- this.key_edit.el.text = key;
+ this.key_edit.el.text = prop.rtype + " " + prop.name;
} else {
this.view.load( file.toSource() );
this.key_edit.el.hide();
}
+ }
+ public bool saveContents () {
+
+
+ if (_this.file == null) {
+ return true;
+ }
+
+
+
+ var str = _this.buffer.toString();
+
+ _this.buffer.checkSyntax();
+
+
+
+ // LeftPanel.model.changed( str , false);
+ _this.dirty = false;
+ _this.save_button.el.sensitive = false;
+
+ // find the text for the node..
+ if (_this.file.xtype != "PlainFile") {
+ // in theory these properties have to exist!?!
+ this.prop.val = str;
+ this.window.windowstate.left_props.reload();
+ } else {
+ _this.file.setSource( str );
+ }
+
+ // call the signal..
+ this.save();
+
+ return true;
+
}
public void forwardSearch (bool change_focus) {
}
public void reset () {
this.file = null;
- this.ptype = "";
- this.key = "";
+
this.node = null;
+ this.prop = null;
this.searchcontext = null;
}
p.javascriptHasErrors(
_this.window.windowstate,
str,
- _this.key,
- _this.ptype,
- _this.file,
-
+ _this.prop,
+ _this.file, // no reference not node?
out errors
);
return this.highlightErrors(errors);
if (! _this.window.windowstate.valasource.checkFileWithNodePropChange(
_this.file,
_this.node,
- _this.key,
- _this.ptype,
+ _this.prop,
str
)) {
this.check_running = false;
"build_module" : "",
"items" : [
{
+ "# JsRender.NodePropType ptype" : "",
"$ xns" : "Gtk",
- "@ void select" : "(string key, string type, string skel, string prop_or_listener)",
+ "@ void select" : "(JsRender.NodeProp prop)",
"Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
"Xcls_MainWindow mainwindow" : "",
"bool active" : false,
"items" : [
{
"$ columns" : [
+ "",
+ "typeof(JsRender.NodeProp), // 0 real key",
+ "typeof(string), // text display",
+ "typeof(string), // tooltip",
+ "typeof(string) // sortable string",
+ "",
+ "// add later? source?",
+ "/* was:",
"typeof(string), // 0 real key",
"typeof(string), // 1 real type",
"typeof(string), // 2 docs ?",
"typeof(string), // 3 visable desc",
"typeof(string), // 4 function desc",
"typeof(string) // 5 element type (event|prop)",
- " "
+ "*/"
],
"$ xns" : "Gtk",
"* pack" : "set_model",
"id" : "model",
- "n_columns" : 6,
+ "n_columns" : 4,
"xtype" : "ListStore",
- "| string getValue" : [
+ "| JsRender.NodeProp getValue" : [
"(Gtk.TreeIter iter, int col)",
"{",
"",
" GLib.Value value;",
" this.el.get_value(iter, col, out value);",
" ",
- " return (string)value;",
+ " return (JsRender.NodeProp)value;",
" ",
"}"
]
{
"$ xns" : "Gtk",
"* init" : [
- " this.el.add_attribute(_this.namerender.el , \"markup\", 4 );",
+ " this.el.add_attribute(_this.namerender.el , \"markup\", 1 );",
" ",
""
],
"",
"\tm.el.get_iter(out iter,path);",
"",
- "",
- "\t// var val = \"\";",
- "",
- "",
- "\tvar key = m.getValue(iter, 0);",
- "",
- "\tvar type = m.getValue(iter, 1);",
- "\tvar skel = m.getValue(iter, 3);",
- "\tvar etype = m.getValue(iter, 5);",
+ " ",
+ "\tvar prop = m.getValue(iter, 0);",
+ " ",
"",
"\t// hide the popover",
"\t_this.el.hide();",
- "\t_this.prop_or_listener = \"\";",
- "\t",
+ "\t ",
"\t",
- "\t_this.select(key,etype == \"signals\" ? \"\" : type,skel, etype);",
+ "\t_this.select(prop);",
" ",
"}",
" "
"xtype" : "ScrolledWindow"
}
],
- "string prop_or_listener" : "\"\"",
"xtype" : "Popover",
"| void clear" : [
"() {",
],
"| void hide" : [
"() {",
- "\tthis.prop_or_listener = \"\";",
+ "\tthis.ptype = JsRender.NodePropType.NONE;",
"\tthis.el.hide();",
"}",
""
],
"| void show" : [
- "(Palete.Palete pal, string prop_or_listener, string xtype, Gtk.Widget onbtn) {",
+ "(Palete.Palete pal, JsRender.NodePropType ptype, string xtype, Gtk.Widget onbtn) {",
"",
- " ",
- " if (this.prop_or_listener != \"\" && this.prop_or_listener == prop_or_listener) {",
- " \tthis.prop_or_listener = \"\";",
- " \tthis.el.hide();",
- " \treturn;",
- "\t}",
- " this.prop_or_listener = prop_or_listener;",
+ " /// what does this do?",
+ " //if (this.prop_or_listener != \"\" && this.prop_or_listener == prop_or_listener) {",
+ " //\tthis.prop_or_listener = \"\";",
+ " //\tthis.el.hide();",
+ " //\treturn;",
+ "\t//}",
+ "\t",
+ "\t",
+ "\t",
+ " this.ptype = ptype;",
" ",
" this.model.el.clear();",
"",
" Gtk.TreeIter iter;",
- " var elementList = pal.getPropertiesFor( xtype,prop_or_listener);",
+ " var elementList = pal.getPropertiesFor( xtype, ptype);",
" ",
" //print (\"GOT \" + elementList.length + \" items for \" + fullpath + \"|\" + type);",
" // console.dump(elementList);",
" var p = miter.get_value();",
" ",
" this.model.el.append(out iter);",
- "",
- "\t\tvar dname = p.name;",
- "\t\tvar dtype = p.type;",
- "\t\t ",
+ "\t\t",
+ "\t\tvar prop = p.toNodeProp();",
+ "\t\t",
+ "\t \t ",
"",
" this.model.el.set(iter,",
- " 0, p.name, ",
- " 1, p.type,",
- " 2, \"<b>\" + p.name +\"</b> <i>\"+p.type+\"</i>\\n\" + ",
- " GLib.Markup.escape_text(p.doctxt),",
- " 3, p.sig,",
- " 4, \"<b>\" + dname +\"</b> <span size=\\\"small\\\"><i>\"+dtype+\"</i></span>\",",
- " 5, prop_or_listener,",
+ " 0, prop, ",
+ " 1, prop.to_property_option_markup(),",
+ " 2, prop.to_property_option_tooltip(), ",
+ " 3, prop.name, ",
" -1",
" );",
" }",
- " this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING); ",
+ " this.model.el.set_sort_column_id(3,Gtk.SortType.ASCENDING); ",
" ",
" // set size up...",
" ",
public Xcls_namerender namerender;
// my vars (def)
+ public JsRender.NodePropType ptype;
public bool active;
- public signal void select (string key, string type, string skel, string prop_or_listener);
+ public signal void select (JsRender.NodeProp prop);
public Xcls_MainWindow mainwindow;
- public string prop_or_listener;
// ctor
public Xcls_PopoverAddProp()
// my vars (dec)
this.active = false;
- this.prop_or_listener = "";
// set gobject values
this.el.width_request = 900;
}
// user defined functions
- public void show (Palete.Palete pal, string prop_or_listener, string xtype, Gtk.Widget onbtn) {
+ public void show (Palete.Palete pal, JsRender.NodePropType ptype, string xtype, Gtk.Widget onbtn) {
-
- if (this.prop_or_listener != "" && this.prop_or_listener == prop_or_listener) {
- this.prop_or_listener = "";
- this.el.hide();
- return;
- }
- this.prop_or_listener = prop_or_listener;
+ /// what does this do?
+ //if (this.prop_or_listener != "" && this.prop_or_listener == prop_or_listener) {
+ // this.prop_or_listener = "";
+ // this.el.hide();
+ // return;
+ //}
+
+
+
+ this.ptype = ptype;
this.model.el.clear();
Gtk.TreeIter iter;
- var elementList = pal.getPropertiesFor( xtype,prop_or_listener);
+ var elementList = pal.getPropertiesFor( xtype, ptype);
//print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
// console.dump(elementList);
var p = miter.get_value();
this.model.el.append(out iter);
-
- var dname = p.name;
- var dtype = p.type;
-
+
+ var prop = p.toNodeProp();
+
+
this.model.el.set(iter,
- 0, p.name,
- 1, p.type,
- 2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" +
- GLib.Markup.escape_text(p.doctxt),
- 3, p.sig,
- 4, "<b>" + dname +"</b> <span size=\"small\"><i>"+dtype+"</i></span>",
- 5, prop_or_listener,
+ 0, prop,
+ 1, prop.to_property_option_markup(),
+ 2, prop.to_property_option_tooltip(),
+ 3, prop.name,
-1
);
}
- this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+ this.model.el.set_sort_column_id(3,Gtk.SortType.ASCENDING);
// set size up...
// this.hpane.el.set_position( 0);
}
public void hide () {
- this.prop_or_listener = "";
+ this.ptype = JsRender.NodePropType.NONE;
this.el.hide();
}
public void clear () {
m.el.get_iter(out iter,path);
-
- // var val = "";
-
-
- var key = m.getValue(iter, 0);
-
- var type = m.getValue(iter, 1);
- var skel = m.getValue(iter, 3);
- var etype = m.getValue(iter, 5);
+
+ var prop = m.getValue(iter, 0);
+
// hide the popover
_this.el.hide();
- _this.prop_or_listener = "";
-
+
- _this.select(key,etype == "signals" ? "" : type,skel, etype);
+ _this.select(prop);
});
}
{
_this = _owner;
_this.model = this;
- this.el = new Gtk.ListStore( 6, typeof(string), // 0 real key
+ this.el = new Gtk.ListStore( 4,
+typeof(JsRender.NodeProp), // 0 real key
+typeof(string), // text display
+typeof(string), // tooltip
+typeof(string) // sortable string
+
+// add later? source?
+/* was:
+typeof(string), // 0 real key
typeof(string), // 1 real type
typeof(string), // 2 docs ?
typeof(string), // 3 visable desc
typeof(string), // 4 function desc
typeof(string) // 5 element type (event|prop)
- );
+*/ );
// my vars (dec)
}
// user defined functions
- public string getValue (Gtk.TreeIter iter, int col)
+ public JsRender.NodeProp getValue (Gtk.TreeIter iter, int col)
{
GLib.Value value;
this.el.get_value(iter, col, out value);
- return (string)value;
+ return (JsRender.NodeProp)value;
}
}
// init method
- this.el.add_attribute(_this.namerender.el , "markup", 4 );
+ this.el.add_attribute(_this.namerender.el , "markup", 1 );
}
// user defined functions
"",
"",
"\tif (_this.name.el.get_text().length < 1) {",
- "\t StandardErrorDialog.show(",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
"\t _this.mainwindow.el,",
"\t \"You have to set Component name \"",
"\t );",
"\tif (!_this.filetype.el.get_active_iter(out iter)) {",
"\t\t// should not happen...",
"\t\t// so we are jut going to return without ",
- "\t\tStandardErrorDialog.show(",
+ "\t\tXcls_StandardErrorDialog.singleton().show(",
"\t _this.mainwindow.el,",
"\t \"You must select a file type. \"",
"\t );",
"\t\tif (!_this.dir.el.get_active_iter(out iter)) {",
"\t\t\t// should not happen...",
"\t\t\t// so we are jut going to return without ",
- "\t\t\tStandardErrorDialog.show(",
+ "\t\t\tXcls_StandardErrorDialog.singleton().show(",
"\t\t\t _this.mainwindow.el,",
"\t\t\t \"You must select a directory \"",
"\t\t\t);",
if (_this.name.el.get_text().length < 1) {
- StandardErrorDialog.show(
+ Xcls_StandardErrorDialog.singleton().show(
_this.mainwindow.el,
"You have to set Component name "
);
if (!_this.filetype.el.get_active_iter(out iter)) {
// should not happen...
// so we are jut going to return without
- StandardErrorDialog.show(
+ Xcls_StandardErrorDialog.singleton().show(
_this.mainwindow.el,
"You must select a file type. "
);
if (!_this.dir.el.get_active_iter(out iter)) {
// should not happen...
// so we are jut going to return without
- StandardErrorDialog.show(
+ Xcls_StandardErrorDialog.singleton().show(
_this.mainwindow.el,
"You must select a directory "
);
"build_module" : "builder",
"items" : [
{
+ "# JsRender.NodeProp? prop" : "",
"$ xns" : "Gtk",
"@ void success" : "(Project.Project pr, JsRender.JsRender file)",
- "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
+ "Gtk.PositionType position" : "Gtk.PositionType.LEFT",
"JsRender.Node node" : "",
"Xcls_MainWindow mainwindow" : "null",
"bool done" : false,
+ "bool is_new" : false,
"bool modal" : true,
"id" : "PopoverProperty",
"items" : [
"xtype" : "HeaderBar"
},
{
- "$ homogeneous" : true,
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,4",
- "int margin_left" : 4,
- "int margin_right" : 4,
+ "* pack" : "add",
+ "Gtk.Align halign" : "Gtk.Align.START",
+ "Gtk.Justification justify" : "Gtk.Justification.LEFT",
+ "int margin_top" : 12,
+ "label" : "Special Flags",
+ "x_options" : 4,
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
+ "* pack" : "add",
+ "id" : "kflag",
"items" : [
{
- "$ justify" : "Gtk.Justification.RIGHT",
"$ xns" : "Gtk",
- "* pack" : "attach_defaults,0,1,0,1",
- "label" : "Special Flags",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
+ "* pack" : "pack_start,true",
+ "id" : "dbcellrenderer",
+ "xtype" : "CellRendererText"
},
{
+ "$ columns" : "typeof(JsRender.NodePropType),typeof(string)",
"$ xns" : "Gtk",
- "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach_defaults,1,2,0,1",
- "id" : "kflag",
+ "* pack" : "set_model",
+ "id" : "dbmodel",
+ "n_columns" : 2,
+ "xtype" : "ListStore",
+ "| void loadData" : [
+ " (JsRender.NodeProp prop) {",
+ " this.el.clear(); ",
+ " Gtk.TreeIter iter;",
+ " var el = this.el;",
+ " ",
+ " ",
+ " // vala signal.. '@'",
+ " // raw value '$'",
+ " // user defined property '#'",
+ " // user defined method '|'",
+ " // special property '*' => prop |args|ctor|init",
+ " ",
+ " ",
+ " ",
+ " /// el.append(out iter);",
+ " ",
+ " ",
+ " // el.set_value(iter, 0, \"\");",
+ " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
+ "",
+ " ",
+ "\tif (prop.ptype == JsRender.NodePropType.LISTENER) { ",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.LISTENER, 1, \"Event Handler / Listener\", -1);",
+ "\t}\t ",
+ "\telse if (_this.mainwindow.windowstate.file.xtype == \"Gtk\") {",
+ "\t\t el.append(out iter);",
+ "\t el.set(iter, 0, JsRender.NodePropType.PROP, 1, \"Normal Property\", -1);",
+ "\t",
+ "\t\t",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.RAW, 1, \"Raw Property (not escaped)\", -1);",
+ "\t\t ",
+ "\t\t",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.USER, 1, \"User defined property\", -1);",
+ "\t\t ",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.METHOD, 1, \"User defined method\", -1);",
+ "\t\t ",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, \"Special property (eg. prop | args | ctor | init )\", -1);",
+ "\t\t ",
+ "\t\t",
+ "\t\tel.append(out iter);",
+ "\t el.set(iter, 0, JsRender.NodePropType.SIGNAL, 1, \"Vala Signal\", -1);",
+ "\t\t ",
+ "\t\t",
+ "\t} else { ",
+ "\t\t// javascript",
+ "\t el.append(out iter);",
+ "\t el.set(iter, 0, JsRender.NodePropType.PROP, 1, \"Normal Property\", -1);",
+ "\t",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.RAW, 1, \"Raw Property (not escaped)\", -1);",
+ "\t\t ",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.METHOD, 1, \"User defined method\", -1);",
+ "\t ",
+ "\t\tel.append(out iter);",
+ "\t\tel.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, \"(*) Special property (eg. prop )\", -1);",
+ "\t\t ",
+ "\t",
+ "\t}",
+ "\t// set selected, based on arg",
+ "\tel.foreach((tm, tp, titer) => {",
+ "\t\tGLib.Value val;",
+ "\t\tel.get_value(titer, 0, out val);",
+ "\t\t ",
+ "\t\t//print(\"check %s against %s\\n\", (string)val, _this.prop.ptype);",
+ "\t\tif (((JsRender.NodePropType)val) == prop.ptype) {",
+ "\t\t\t_this.kflag.el.set_active_iter(titer);",
+ "\t\t\treturn true;",
+ "\t\t}",
+ "\t\treturn false;",
+ "\t});",
+ "\t",
+ "",
+ " ",
+ "}",
+ ""
+ ]
+ }
+ ],
+ "xtype" : "ComboBox"
+ },
+ {
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "Gtk.Align halign" : "Gtk.Align.START",
+ "Gtk.Justification justify" : "Gtk.Justification.LEFT",
+ "int margin_top" : 12,
+ "label" : "Type or Return Type",
+ "x_options" : 4,
+ "xtype" : "Label"
+ },
+ {
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "id" : "ktype",
+ "xtype" : "Entry"
+ },
+ {
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "Gtk.Align halign" : "Gtk.Align.START",
+ "Gtk.Justification justify" : "Gtk.Justification.LEFT",
+ "int margin_top" : 12,
+ "label" : "Name",
+ "tooltip_text" : "center, north, south, east, west",
+ "x_options" : 4,
+ "xtype" : "Label"
+ },
+ {
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "id" : "kname",
+ "listeners" : {
+ "focus_out_event" : [
+ "()=>{",
+ "\t_this.error.setError(\"\");",
+ "\tvar val = this.el.get_text().strip(); ",
+ "\tif (val.length < 1) {",
+ "\t\t_this.error.setError(\"Name can not be empty\");",
+ "\t}",
+ "\treturn true;",
+ "}",
+ "",
+ ""
+ ],
+ "key_release_event" : [
+ "()=>{",
+ "\t_this.error.setError(\"\");",
+ "\tvar val = this.el.get_text().strip(); ",
+ "\tif (val.length < 1) {",
+ "\t\t_this.error.setError(\"Name can not be empty\");",
+ "\t}",
+ "\treturn true;",
+ "}",
+ "",
+ ""
+ ]
+ },
+ "xtype" : "Entry"
+ },
+ {
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "Gtk.Align halign" : "Gtk.Align.START",
+ "Gtk.Justification justify" : "Gtk.Justification.LEFT",
+ "bool use_markup" : true,
+ "id" : "error",
+ "int margin_top" : 0,
+ "label" : "<span color=\"red\">Error Message</span>",
+ "tooltip_text" : "center, north, south, east, west",
+ "x_options" : 4,
+ "xtype" : "Label",
+ "| void setError" : [
+ "(string err) {",
+ "\tif (err == \"\") {",
+ "\t\tthis.el.hide();",
+ "\t} else {",
+ "\t\tthis.el.show();",
+ "\t\t",
+ "\t\tthis.el.label = \"<span color=\\\"red\\\">\" + err + \"</span>\";",
+ "\t}",
+ "}",
+ ""
+ ]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "id" : "buttonbar",
+ "int margin_top" : 20,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "bool always_show_image" : true,
+ "bool hexpand" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "dbcellrenderer",
- "xtype" : "CellRendererText"
- },
- {
- "$ columns" : "typeof(string),typeof(string)",
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "dbmodel",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| void loadData" : [
- " (string kflag) {",
- " this.el.clear(); ",
- " Gtk.TreeIter iter;",
- " var el = this.el;",
- " ",
- " ",
- " // vala signal.. '@'",
- " // raw value '$'",
- " // user defined property '#'",
- " // user defined method '|'",
- " // special property '*' => prop |args|ctor|init",
- " ",
- " ",
- " ",
- " /// el.append(out iter);",
- " ",
- " ",
- " // el.set_value(iter, 0, \"\");",
- " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
- "",
- " el.append(out iter);",
- " el.set(iter, 0, \"\", 1, \"Normal Property\", -1);",
- "\t ",
- "\tif (_this.mainwindow.windowstate.file.xtype == \"Gtk\") {",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, \"$\", 1, \"($) Raw Property (not escaped)\", -1);",
- "\t\t ",
- "\t\t",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, \"#\", 1, \"(#) User defined property\", -1);",
- "\t\t ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, \"|\", 1, \"(|) User defined method\", -1);",
- "\t\t ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, \"*\", 1, \"(*) Special property (eg. prop | args | ctor | init )\", -1);",
- "\t\t ",
- "\t\t",
- "\t\tel.append(out iter);",
- "\t el.set(iter, 0, \"@\", 1, \"(@) Vala Signal\", -1);",
- "\t\t ",
- "\t\t",
- "\t} else { ",
- "\t\t// javascript",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, \"$\", 1, \"($) Raw Property (not escaped)\", -1);",
- "\t\t ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, \"|\", 1, \"(|) User defined method\", -1);",
- "\t ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, \"*\", 1, \"(*) Special property (eg. prop )\", -1);",
- "\t\t ",
- "\t",
- "\t}",
- "\tel.foreach((tm, tp, titer) => {",
- "\t\tGLib.Value val;",
- "\t\tel.get_value(titer, 0, out val);",
- "\t\t ",
- "\t\tprint(\"check %s against %s\\n\", (string)val, kflag);",
- "\t\tif (((string)val) == kflag) {",
- "\t\t\t_this.kflag.el.set_active_iter(titer);",
- "\t\t\treturn true;",
- "\t\t}",
- "\t\treturn false;",
- "\t});",
- "\t",
- "",
- " ",
- "}",
- ""
- ]
+ "* pack" : "composite_name",
+ "* prop" : "image",
+ "string icon_name" : "window-close",
+ "xtype" : "Image"
}
],
- "xtype" : "ComboBox"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach_defaults,0,1,1,2",
- "label" : "Type or Return Type",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
+ "listeners" : {
+ "pressed" : [
+ "() => { ",
+ "",
+ "\t_this.prop = null;",
+ "\t_this.is_new = false;",
+ "\t_this.kname.el.set_text(\"Cancel\");",
+ "\t_this.el.hide();",
+ "",
+ "}"
+ ]
+ },
+ "string label" : "Cancel",
+ "xtype" : "Button"
},
{
- "$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach_defaults,1,2,1,2",
- "id" : "ktype",
- "xtype" : "Entry"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach_defaults,0,1,2,3",
- "label" : "Name",
- "tooltip_text" : "center, north, south, east, west",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach_defaults,1,2,2,3",
- "id" : "kname",
- "xtype" : "Entry"
+ "* pack" : "add",
+ "bool always_show_image" : true,
+ "bool hexpand" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "image",
+ "string icon_name" : "list-add",
+ "xtype" : "Image"
+ }
+ ],
+ "listeners" : {
+ "pressed" : [
+ "() => {",
+ "\t// check if text is not empty..",
+ "\tif ( _this.kname.el.get_text().strip().length < 1) {",
+ "\t\t// error should already be showing?",
+ "\t\treturn;",
+ "\t}",
+ "\t_this.updateProp();",
+ "\t",
+ "\t// since we can't add listeners?!?!?",
+ "\t// only check props.",
+ "\t// check if property already exists in node.\t",
+ "\tvar prop = _this.prop;",
+ "\tif (_this.node.props.has_key(prop.to_index_key())) {",
+ "\t\t_this.error.setError(\"Property already exists\");",
+ "\t\treturn;\t",
+ "\t}",
+ "\t",
+ "\t",
+ "\t ",
+ "\t_this.is_new = false;\t",
+ "\t ",
+ "\t// hide self",
+ "\t_this.prop = null; // skip checks..",
+ "\t_this.el.hide();",
+ "",
+ "// add it, ",
+ "\t// trigger editing of property.",
+ "\t// allow hide to work?",
+ "\twhile (Gtk.events_pending()) {",
+ "\t\tGtk.main_iteration();",
+ "\t}",
+ "\t",
+ "\t_this.mainwindow.windowstate.left_props.addProp(prop);\t\t",
+ "\t",
+ "",
+ "}"
+ ]
+ },
+ "string label" : "Add Property",
+ "xtype" : "Button"
}
],
- "n_columns" : 2,
- "n_rows" : 3,
- "uint row_spacing" : 2,
- "xtype" : "Table"
+ "xtype" : "Box"
}
],
"xtype" : "Box"
"listeners" : {
"closed" : [
"() => {",
- " ",
- " ",
- " var newtext = \"\";",
- " Gtk.TreeIter citer;",
- " GLib.Value gval;",
- " this.kflag.el.get_active_iter(out citer);",
- " this.dbmodel.el.get_value(citer, 0, out gval);",
- " ",
- " var ktype = this.ktype.el.get_text().strip(); ",
- " var kname = this.kname.el.get_text().strip(); ",
- " newtext += ((string)gval).strip(); ",
- " newtext += ktype.length > 0 && newtext.length > 0 ? \" \" :\"\";",
- " newtext += ktype;",
- " newtext += kname.length > 0 && newtext.length > 0 ? \" \" :\"\";",
- " newtext += kname;",
- " ",
- " ",
- " var lp = _this.mainwindow.windowstate.left_props;",
- " ",
- " switch(this.key_type) {",
- " case \"listener\":",
- " var ov = _this.node.listeners.get(this.old_keyname);",
- " _this.node.listeners.set(newtext, ov);",
- " if (this.old_keyname != newtext) { ",
- "\t _this.node.listeners.unset(this.old_keyname);",
- " }",
- " ",
- " ",
- " lp.updateKey(this.old_keyname, this.key_type, newtext);",
- " ",
- " break;",
- " case \"props\":",
- " var ov = _this.node.props.get(this.old_keyname);",
- " _this.node.props.set(newtext, ov);",
- "\t\t\tif (this.old_keyname != newtext) { ",
- "\t _this.node.props.unset(this.old_keyname);",
- " }",
- " lp.updateKey(this.old_keyname, this.key_type, newtext);",
- " break;",
- " }",
- " ",
- " ",
+ " \tGLib.debug(\"popover closed\");",
+ "\tif (_this.is_new) {",
+ "\t\t// dont allow hiding if we are creating a new one.",
+ "\t\t// on.hide will reshow it.",
+ "\t\treturn;",
+ "",
+ "\t}",
+ "\tif (_this.prop == null) {",
+ "\t\t// hide and dont update.",
+ "\t\treturn;",
+ "\t}",
+ "\tif (this.kname.el.get_text().strip().length < 1) {",
+ "\t\treturn;",
+ "\t}",
+ "",
+ "\tthis.updateProp();",
+ "",
+ "\t_this.mainwindow.windowstate.left_props.reload();",
+ "",
+ "",
" ",
"} "
+ ],
+ "hide" : [
+ "() => {",
+ " \tGLib.debug(\"popover hidden\");",
+ "\tif (_this.is_new || this.kname.el.get_text().strip().length < 1) {",
+ "\t\t// dont allow hiding if we are creating a new one.",
+ "\t\tGLib.debug(\"prevent hiding as its new or text is empty\"); ",
+ "\t\tthis.el.show_all();",
+ "\t\treturn;",
+ "",
+ "\t}",
+ "\t",
+ "}"
]
},
"string key_type" : "",
"string old_keyname" : "",
"uint border_width" : 0,
"xtype" : "Popover",
- "| void updateNodeFromValues" : [
- "() {",
- "",
- " /* _this.file.title = _this.title.el.get_text();",
- " _this.file.region = _this.region.el.get_text(); ",
- " _this.file.parent = _this.parent.el.get_text(); ",
- " _this.file.permname = _this.permname.el.get_text(); ",
- " _this.file.modOrder = _this.modOrder.el.get_text();",
- " ",
- " if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {",
- " _this.file.renameTo(_this.name.el.get_text());",
- " }",
- " // store the module...",
- " _this.file.build_module = \"\"; ",
- " Gtk.TreeIter iter; ",
- " if (_this.build_module.el.get_active_iter (out iter)) {",
- " Value vfname;",
- " this.dbmodel.el.get_value (iter, 0, out vfname);",
- " if (((string)vfname).length > 0) {",
- " _this.file.build_module = (string)vfname;",
- " }",
- " ",
- " }",
- " */",
- " ",
- " ",
- "",
- " ",
- "} "
- ],
"| void show" : [
- "(Gtk.Widget btn, JsRender.Node node, string key_type, string key) ",
- "\t{",
+ "(",
+ "\tGtk.Widget btn, ",
+ "\tJsRender.Node node, ",
+ "\tJsRender.NodeProp prop, ",
+ "\tint y,",
+ "\tbool is_new = false",
+ "\t ) ",
+ "{",
"\t",
- "\tstring kname = \"\", kflag = \"\", ktype = \"\";",
- "\tif (key.length > 0) {",
- "\t\tnode.normalize_key( key, out kname, out kflag, out ktype);",
- "\t}",
- "",
- "\tif (key_type == \"listener\") {",
- "\t\tthis.header.el.title = \"Modify Event Listener\";",
+ " ",
+ "\tthis.is_new = is_new; ",
+ "\tvar pref = is_new ? \"Add \" : \"Modify \";",
+ "\tif (prop.ptype == JsRender.NodePropType.LISTENER) {",
+ "\t\tthis.header.el.title = pref + \"Event Listener\"; // cant really happen yet?",
"\t} else {",
- "\t\tthis.header.el.title = \"Modify Property\";",
+ "\t\tthis.header.el.title = pref + \"Property\";",
"\t}",
- "\t",
- "\tthis.key_type = key_type;",
- "\tthis.old_keyname = key;",
+ "\tthis.prop = prop;",
"\tthis.node = node;",
"\t",
- "\t_this.kname.el.set_text(kname);",
- "\t_this.ktype.el.set_text(ktype);",
+ "\t_this.kname.el.set_text(prop.name);",
+ "\t_this.ktype.el.set_text(prop.rtype);",
"\t",
- "\t_this.dbmodel.loadData(kflag);",
+ "\t_this.dbmodel.loadData(prop );",
"\t// does node have this property...",
"",
"",
- "\t ",
- "",
"\t_this.node = node;",
"\t//console.log('show all');",
"\tthis.el.set_modal(true);",
"\tthis.el.set_relative_to(btn);",
+ "\tif (y > -1) {",
+ "\t\tvar r = Gdk.Rectangle() {",
+ "\t\t\tx = 0, // align left...",
+ "\t\t\ty = y,",
+ "\t\t\twidth = 1,",
+ "\t\t\theight = 1",
+ "\t\t};",
+ "\t\tthis.el.set_pointing_to( r);",
+ "\t}",
+ "\t",
+ "\t",
"",
- "\tthis.el.set_position(Gtk.PositionType.TOP);",
+ "\t//this.el.set_position(Gtk.PositionType.TOP);",
"",
"\t// window + header?",
"\t print(\"SHOWALL - POPIP\\n\");",
"\tthis.el.show_all();",
"\tthis.kname.el.grab_focus();",
+ "\tthis.buttonbar.el.hide();",
+ "\tif (this.is_new) {",
+ "\t\tthis.buttonbar.el.show();",
+ "\t}",
+ "\t this.error.setError(\"\");",
"",
"\t//this.success = c.success;",
" ",
"}"
+ ],
+ "| void updateProp" : [
+ "() {",
+ "\tvar newtext = \"\";",
+ "\tGtk.TreeIter citer;",
+ "\tGLib.Value gval;",
+ "\tthis.kflag.el.get_active_iter(out citer);",
+ "\tthis.dbmodel.el.get_value(citer, 0, out gval);",
+ "",
+ "",
+ "\t_this.prop.name = this.kname.el.get_text().strip(); ",
+ "\t_this.prop.rtype = this.ktype.el.get_text().strip(); ",
+ "\t_this.prop.ptype = (JsRender.NodePropType) gval;",
+ "",
+ "}",
+ ""
]
}
],
public Xcls_dbmodel dbmodel;
public Xcls_ktype ktype;
public Xcls_kname kname;
+ public Xcls_error error;
+ public Xcls_buttonbar buttonbar;
// my vars (def)
public string old_keyname;
+ public bool is_new;
public signal void success (Project.Project pr, JsRender.JsRender file);
public bool done;
+ public JsRender.NodeProp? prop;
public Xcls_MainWindow mainwindow;
public string key_type;
public JsRender.Node node;
this.el = new Gtk.Popover( null );
// my vars (dec)
+ this.is_new = false;
this.done = false;
this.mainwindow = null;
// set gobject values
this.el.border_width = 0;
this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
+ this.el.position = Gtk.PositionType.LEFT;
var child_0 = new Xcls_Box2( _this );
child_0.ref();
this.el.add ( child_0.el );
//listeners
this.el.closed.connect( () => {
-
-
- var newtext = "";
- Gtk.TreeIter citer;
- GLib.Value gval;
- this.kflag.el.get_active_iter(out citer);
- this.dbmodel.el.get_value(citer, 0, out gval);
-
- var ktype = this.ktype.el.get_text().strip();
- var kname = this.kname.el.get_text().strip();
- newtext += ((string)gval).strip();
- newtext += ktype.length > 0 && newtext.length > 0 ? " " :"";
- newtext += ktype;
- newtext += kname.length > 0 && newtext.length > 0 ? " " :"";
- newtext += kname;
-
-
- var lp = _this.mainwindow.windowstate.left_props;
-
- switch(this.key_type) {
- case "listener":
- var ov = _this.node.listeners.get(this.old_keyname);
- _this.node.listeners.set(newtext, ov);
- if (this.old_keyname != newtext) {
- _this.node.listeners.unset(this.old_keyname);
- }
-
-
- lp.updateKey(this.old_keyname, this.key_type, newtext);
-
- break;
- case "props":
- var ov = _this.node.props.get(this.old_keyname);
- _this.node.props.set(newtext, ov);
- if (this.old_keyname != newtext) {
- _this.node.props.unset(this.old_keyname);
- }
- lp.updateKey(this.old_keyname, this.key_type, newtext);
- break;
- }
-
-
+ GLib.debug("popover closed");
+ if (_this.is_new) {
+ // dont allow hiding if we are creating a new one.
+ // on.hide will reshow it.
+ return;
+
+ }
+ if (_this.prop == null) {
+ // hide and dont update.
+ return;
+ }
+ if (this.kname.el.get_text().strip().length < 1) {
+ return;
+ }
+
+ this.updateProp();
+
+ _this.mainwindow.windowstate.left_props.reload();
+
+
+ });
+ this.el.hide.connect( () => {
+ GLib.debug("popover hidden");
+ if (_this.is_new || this.kname.el.get_text().strip().length < 1) {
+ // dont allow hiding if we are creating a new one.
+ GLib.debug("prevent hiding as its new or text is empty");
+ this.el.show_all();
+ return;
+
+ }
+
});
}
// user defined functions
- public void show (Gtk.Widget btn, JsRender.Node node, string key_type, string key)
- {
+ public void show (
+ Gtk.Widget btn,
+ JsRender.Node node,
+ JsRender.NodeProp prop,
+ int y,
+ bool is_new = false
+ )
+ {
- string kname = "", kflag = "", ktype = "";
- if (key.length > 0) {
- node.normalize_key( key, out kname, out kflag, out ktype);
- }
-
- if (key_type == "listener") {
- this.header.el.title = "Modify Event Listener";
+
+ this.is_new = is_new;
+ var pref = is_new ? "Add " : "Modify ";
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
+ this.header.el.title = pref + "Event Listener"; // cant really happen yet?
} else {
- this.header.el.title = "Modify Property";
+ this.header.el.title = pref + "Property";
}
-
- this.key_type = key_type;
- this.old_keyname = key;
+ this.prop = prop;
this.node = node;
- _this.kname.el.set_text(kname);
- _this.ktype.el.set_text(ktype);
+ _this.kname.el.set_text(prop.name);
+ _this.ktype.el.set_text(prop.rtype);
- _this.dbmodel.loadData(kflag);
+ _this.dbmodel.loadData(prop );
// does node have this property...
-
-
_this.node = node;
//console.log('show all');
this.el.set_modal(true);
this.el.set_relative_to(btn);
+ if (y > -1) {
+ var r = Gdk.Rectangle() {
+ x = 0, // align left...
+ y = y,
+ width = 1,
+ height = 1
+ };
+ this.el.set_pointing_to( r);
+ }
+
+
- this.el.set_position(Gtk.PositionType.TOP);
+ //this.el.set_position(Gtk.PositionType.TOP);
// window + header?
print("SHOWALL - POPIP\n");
this.el.show_all();
this.kname.el.grab_focus();
+ this.buttonbar.el.hide();
+ if (this.is_new) {
+ this.buttonbar.el.show();
+ }
+ this.error.setError("");
//this.success = c.success;
}
- public void updateNodeFromValues () {
+ public void updateProp () {
+ var newtext = "";
+ Gtk.TreeIter citer;
+ GLib.Value gval;
+ this.kflag.el.get_active_iter(out citer);
+ this.dbmodel.el.get_value(citer, 0, out gval);
- /* _this.file.title = _this.title.el.get_text();
- _this.file.region = _this.region.el.get_text();
- _this.file.parent = _this.parent.el.get_text();
- _this.file.permname = _this.permname.el.get_text();
- _this.file.modOrder = _this.modOrder.el.get_text();
-
- if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {
- _this.file.renameTo(_this.name.el.get_text());
- }
- // store the module...
- _this.file.build_module = "";
- Gtk.TreeIter iter;
- if (_this.build_module.el.get_active_iter (out iter)) {
- Value vfname;
- this.dbmodel.el.get_value (iter, 0, out vfname);
- if (((string)vfname).length > 0) {
- _this.file.build_module = (string)vfname;
- }
-
- }
- */
-
-
-
+ _this.prop.name = this.kname.el.get_text().strip();
+ _this.prop.rtype = this.ktype.el.get_text().strip();
+ _this.prop.ptype = (JsRender.NodePropType) gval;
+
}
public class Xcls_Box2 : Object
{
var child_0 = new Xcls_header( _this );
child_0.ref();
this.el.pack_start ( child_0.el , false,true,0 );
- var child_1 = new Xcls_Table4( _this );
+ var child_1 = new Xcls_Label4( _this );
child_1.ref();
- this.el.pack_start ( child_1.el , false,false,4 );
+ this.el.add ( child_1.el );
+ var child_2 = new Xcls_kflag( _this );
+ child_2.ref();
+ this.el.add ( child_2.el );
+ var child_3 = new Xcls_Label8( _this );
+ child_3.ref();
+ this.el.add ( child_3.el );
+ var child_4 = new Xcls_ktype( _this );
+ child_4.ref();
+ this.el.add ( child_4.el );
+ var child_5 = new Xcls_Label10( _this );
+ child_5.ref();
+ this.el.add ( child_5.el );
+ var child_6 = new Xcls_kname( _this );
+ child_6.ref();
+ this.el.add ( child_6.el );
+ var child_7 = new Xcls_error( _this );
+ child_7.ref();
+ this.el.add ( child_7.el );
+ var child_8 = new Xcls_buttonbar( _this );
+ child_8.ref();
+ this.el.add ( child_8.el );
}
// user defined functions
// user defined functions
}
- public class Xcls_Table4 : Object
- {
- public Gtk.Table el;
- private Xcls_PopoverProperty _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Table4(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Table( 3, 2, true );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_right = 4;
- this.el.margin_left = 4;
- this.el.row_spacing = 2;
- var child_0 = new Xcls_Label5( _this );
- child_0.ref();
- this.el.attach_defaults ( child_0.el , 0,1,0,1 );
- var child_1 = new Xcls_kflag( _this );
- child_1.ref();
- this.el.attach_defaults ( child_1.el , 1,2,0,1 );
- var child_2 = new Xcls_Label9( _this );
- child_2.ref();
- this.el.attach_defaults ( child_2.el , 0,1,1,2 );
- var child_3 = new Xcls_ktype( _this );
- child_3.ref();
- this.el.attach_defaults ( child_3.el , 1,2,1,2 );
- var child_4 = new Xcls_Label11( _this );
- child_4.ref();
- this.el.attach_defaults ( child_4.el , 0,1,2,3 );
- var child_5 = new Xcls_kname( _this );
- child_5.ref();
- this.el.attach_defaults ( child_5.el , 1,2,2,3 );
- }
-
- // user defined functions
- }
- public class Xcls_Label5 : Object
+ public class Xcls_Label4 : Object
{
public Gtk.Label el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_Label5(Xcls_PopoverProperty _owner )
+ public Xcls_Label4(Xcls_PopoverProperty _owner )
{
_this = _owner;
this.el = new Gtk.Label( "Special Flags" );
// my vars (dec)
// set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
+ this.el.halign = Gtk.Align.START;
+ this.el.justify = Gtk.Justification.LEFT;
+ this.el.margin_top = 12;
}
// user defined functions
{
_this = _owner;
_this.dbmodel = this;
- this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+ this.el = new Gtk.ListStore( 2, typeof(JsRender.NodePropType),typeof(string) );
// my vars (dec)
}
// user defined functions
- public void loadData (string kflag) {
+ public void loadData (JsRender.NodeProp prop) {
this.el.clear();
Gtk.TreeIter iter;
var el = this.el;
// el.set_value(iter, 0, "");
// el.set_value(iter, 1, "aaa - Just add Element - aaa");
- el.append(out iter);
- el.set(iter, 0, "", 1, "Normal Property", -1);
-
- if (_this.mainwindow.windowstate.file.xtype == "Gtk") {
+
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
+ el.append(out iter);
+ el.set(iter, 0, JsRender.NodePropType.LISTENER, 1, "Event Handler / Listener", -1);
+ }
+ else if (_this.mainwindow.windowstate.file.xtype == "Gtk") {
+ el.append(out iter);
+ el.set(iter, 0, JsRender.NodePropType.PROP, 1, "Normal Property", -1);
+
+
el.append(out iter);
- el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
+ el.set(iter, 0, JsRender.NodePropType.RAW, 1, "Raw Property (not escaped)", -1);
el.append(out iter);
- el.set(iter, 0, "#", 1, "(#) User defined property", -1);
+ el.set(iter, 0, JsRender.NodePropType.USER, 1, "User defined property", -1);
el.append(out iter);
- el.set(iter, 0, "|", 1, "(|) User defined method", -1);
+ el.set(iter, 0, JsRender.NodePropType.METHOD, 1, "User defined method", -1);
el.append(out iter);
- el.set(iter, 0, "*", 1, "(*) Special property (eg. prop | args | ctor | init )", -1);
+ el.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, "Special property (eg. prop | args | ctor | init )", -1);
el.append(out iter);
- el.set(iter, 0, "@", 1, "(@) Vala Signal", -1);
+ el.set(iter, 0, JsRender.NodePropType.SIGNAL, 1, "Vala Signal", -1);
} else {
// javascript
+ el.append(out iter);
+ el.set(iter, 0, JsRender.NodePropType.PROP, 1, "Normal Property", -1);
+
el.append(out iter);
- el.set(iter, 0, "$", 1, "($) Raw Property (not escaped)", -1);
+ el.set(iter, 0, JsRender.NodePropType.RAW, 1, "Raw Property (not escaped)", -1);
el.append(out iter);
- el.set(iter, 0, "|", 1, "(|) User defined method", -1);
+ el.set(iter, 0, JsRender.NodePropType.METHOD, 1, "User defined method", -1);
el.append(out iter);
- el.set(iter, 0, "*", 1, "(*) Special property (eg. prop )", -1);
+ el.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, "(*) Special property (eg. prop )", -1);
}
+ // set selected, based on arg
el.foreach((tm, tp, titer) => {
GLib.Value val;
el.get_value(titer, 0, out val);
- print("check %s against %s\n", (string)val, kflag);
- if (((string)val) == kflag) {
+ //print("check %s against %s\n", (string)val, _this.prop.ptype);
+ if (((JsRender.NodePropType)val) == prop.ptype) {
_this.kflag.el.set_active_iter(titer);
return true;
}
}
- public class Xcls_Label9 : Object
+ public class Xcls_Label8 : Object
{
public Gtk.Label el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_Label9(Xcls_PopoverProperty _owner )
+ public Xcls_Label8(Xcls_PopoverProperty _owner )
{
_this = _owner;
this.el = new Gtk.Label( "Type or Return Type" );
// my vars (dec)
// set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
+ this.el.halign = Gtk.Align.START;
+ this.el.justify = Gtk.Justification.LEFT;
+ this.el.margin_top = 12;
this.el.visible = true;
}
// user defined functions
}
- public class Xcls_Label11 : Object
+ public class Xcls_Label10 : Object
{
public Gtk.Label el;
private Xcls_PopoverProperty _this;
// my vars (def)
// ctor
- public Xcls_Label11(Xcls_PopoverProperty _owner )
+ public Xcls_Label10(Xcls_PopoverProperty _owner )
{
_this = _owner;
this.el = new Gtk.Label( "Name" );
// my vars (dec)
// set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
+ this.el.halign = Gtk.Align.START;
+ this.el.justify = Gtk.Justification.LEFT;
this.el.tooltip_text = "center, north, south, east, west";
+ this.el.margin_top = 12;
this.el.visible = true;
}
// set gobject values
this.el.visible = true;
+
+ //listeners
+ this.el.focus_out_event.connect( ()=>{
+ _this.error.setError("");
+ var val = this.el.get_text().strip();
+ if (val.length < 1) {
+ _this.error.setError("Name can not be empty");
+ }
+ return true;
+ });
+ this.el.key_release_event.connect( ()=>{
+ _this.error.setError("");
+ var val = this.el.get_text().strip();
+ if (val.length < 1) {
+ _this.error.setError("Name can not be empty");
+ }
+ return true;
+ });
}
// user defined functions
}
+ public class Xcls_error : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_error(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.error = this;
+ this.el = new Gtk.Label( "<span color=\"red\">Error Message</span>" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.justify = Gtk.Justification.LEFT;
+ this.el.tooltip_text = "center, north, south, east, west";
+ this.el.margin_top = 0;
+ this.el.visible = true;
+ this.el.use_markup = true;
+ }
+
+ // user defined functions
+ public void setError (string err) {
+ if (err == "") {
+ this.el.hide();
+ } else {
+ this.el.show();
+
+ this.el.label = "<span color=\"red\">" + err + "</span>";
+ }
+ }
+ }
+
+ public class Xcls_buttonbar : Object
+ {
+ public Gtk.Box el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_buttonbar(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.buttonbar = this;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_top = 20;
+ var child_0 = new Xcls_Button14( _this );
+ child_0.ref();
+ this.el.add ( child_0.el );
+ var child_1 = new Xcls_Button16( _this );
+ child_1.ref();
+ this.el.add ( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button14 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button14(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.always_show_image = true;
+ this.el.label = "Cancel";
+ var child_0 = new Xcls_Image15( _this );
+ child_0.ref();
+ this.el.image = child_0.el;
+
+ //listeners
+ this.el.pressed.connect( () => {
+
+ _this.prop = null;
+ _this.is_new = false;
+ _this.kname.el.set_text("Cancel");
+ _this.el.hide();
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image15 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image15(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "window-close";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button16 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button16(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.always_show_image = true;
+ this.el.label = "Add Property";
+ var child_0 = new Xcls_Image17( _this );
+ child_0.ref();
+ this.el.image = child_0.el;
+
+ //listeners
+ this.el.pressed.connect( () => {
+ // check if text is not empty..
+ if ( _this.kname.el.get_text().strip().length < 1) {
+ // error should already be showing?
+ return;
+ }
+ _this.updateProp();
+
+ // since we can't add listeners?!?!?
+ // only check props.
+ // check if property already exists in node.
+ var prop = _this.prop;
+ if (_this.node.props.has_key(prop.to_index_key())) {
+ _this.error.setError("Property already exists");
+ return;
+ }
+
+
+
+ _this.is_new = false;
+
+ // hide self
+ _this.prop = null; // skip checks..
+ _this.el.hide();
+
+ // add it,
+ // trigger editing of property.
+ // allow hide to work?
+ while (Gtk.events_pending()) {
+ Gtk.main_iteration();
+ }
+
+ _this.mainwindow.windowstate.left_props.addProp(prop);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image17 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image17(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "list-add";
+ }
+
+ // user defined functions
+ }
+
+
}
{
- "name" : "ProjectSettings",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ProjectSettings.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
- "@ void buttonPressed" : "(string btn)",
- "id" : "RooProjectSettings",
- "| void show" : " (Project.Project project) {\n _this.project = project;\n _this.path.el.label = project.firstPath();\n // get the active project.\n var lm = Gtk.SourceLanguageManager.get_default();\n \n ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(\n \n lm.get_language(\"html\"));\n \n //print (project.fn);\n //project.runhtml = project.runhtml || '';\n _this.view.el.get_buffer().set_text(project.runhtml);\n \n \n _this.rootURL.el.set_text( _this.project.rootURL );\n _this.base_template.el.set_text(_this.project.base_template); \n var js = _this.project;\n _this.database_DBTYPE.el.set_text( js.get_string_member(\"DBTYPE\") );\n _this.database_DBNAME.el.set_text( js.get_string_member(\"DBNAME\") );\n _this.database_DBUSERNAME.el.set_text( js.get_string_member(\"DBUSERNAME\") );\n _this.database_DBPASSWORD.el.set_text( js.get_string_member(\"DBPASSWORD\") );\n //this.el.show_all();\n}\n",
"# Project.Project project" : "",
- "xtype" : "Box",
- "| void save" : "()\n{\n var buf = _this.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 _this.project.runhtml = buf.get_text(s,e,true);\n \n _this.project.rootURL = _this.rootURL.el.get_text();\n _this.project.base_template = _this.base_template.el.get_text(); \n \n var js = _this.project.json_project_data;\n js.set_string_member(\"DBTYPE\", _this.database_DBTYPE.el.get_text());\n js.set_string_member(\"DBNAME\", _this.database_DBNAME.el.get_text());\n js.set_string_member(\"DBUSERNAME\", _this.database_DBUSERNAME.el.get_text());\n js.set_string_member(\"DBPASSWORD\", _this.database_DBPASSWORD.el.get_text());\n// _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text()); \n \n // need to re-init the database \n \n _this.project.initRooDatabase();\n \n \n}",
+ "$ homogeneous" : false,
"$ xns" : "Gtk",
+ "@ void buttonPressed" : "(string btn)",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"border_width" : 5,
- "$ homogeneous" : false,
+ "id" : "RooProjectSettings",
"items" : [
{
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Box",
- "gboolean expand" : false,
+ "$ homogeneous" : true,
"$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "$ homogeneous" : true,
+ "gboolean expand" : false,
"gboolean vexpand" : false,
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "label" : "Apply",
"listeners" : {
- "button_press_event" : "() => {\n _this.save();\n \n _this.buttonPressed(\"apply\");\n return false;\n}"
+ "button_press_event" : [
+ "() => {",
+ " _this.save();",
+ " ",
+ " _this.buttonPressed(\"apply\");",
+ " return false;",
+ "}"
+ ]
},
- "label" : "Apply",
- "xtype" : "Button",
- "* pack" : "add",
- "$ xns" : "Gtk"
+ "xtype" : "Button"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "label" : "Save",
"listeners" : {
- "button_press_event" : "() => {\n _this.save();\n \n _this.buttonPressed(\"save\");\n return false;\n}"
+ "button_press_event" : [
+ "() => {",
+ " _this.save();",
+ " ",
+ " _this.buttonPressed(\"save\");",
+ " return false;",
+ "}"
+ ]
},
- "label" : "Save",
- "xtype" : "Button",
- "* pack" : "add",
- "$ xns" : "Gtk"
+ "xtype" : "Button"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "* pack" : "pack_end,true,true,0",
- "xtype" : "Notebook",
"$ xns" : "Gtk",
+ "* pack" : "pack_end,true,true,0",
"items" : [
{
- "id" : "label_global",
- "* pack" : false,
- "xtype" : "Label",
"$ xns" : "Gtk",
- "utf8 label" : "Global"
+ "* pack" : false,
+ "id" : "label_global",
+ "utf8 label" : "Global",
+ "xtype" : "Label"
},
{
- "id" : "label_database",
- "xtype" : "Label",
- "* pack" : false,
"$ xns" : "Gtk",
- "utf8 label" : "Database"
+ "* pack" : false,
+ "id" : "label_database",
+ "utf8 label" : "Database",
+ "xtype" : "Label"
},
{
- "* pack" : "append_page,_this.label_global.el",
- "xtype" : "Box",
- "gboolean homogeneous" : false,
"$ xns" : "Gtk",
+ "* pack" : "append_page,_this.label_global.el",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "gboolean homogeneous" : false,
"items" : [
{
- "label" : "filename",
- "id" : "path",
- "xalign" : 0,
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
"gint margin" : 3,
- "$ xns" : "Gtk"
+ "id" : "path",
+ "label" : "filename",
+ "xalign" : 0,
+ "xtype" : "Label"
},
{
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Box",
- "gboolean expand" : false,
+ "$ homogeneous" : false,
"$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "$ homogeneous" : false,
+ "gboolean expand" : false,
"items" : [
{
- "label" : "HTML template file",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
"gint margin" : 3,
- "$ xns" : "Gtk"
+ "label" : "HTML template file",
+ "xtype" : "Label"
},
{
- "id" : "base_template",
+ "$ xns" : "Gtk",
"* pack" : "add",
- "xtype" : "Entry",
- "$ xns" : "Gtk"
+ "id" : "base_template",
+ "xtype" : "Entry"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Box",
- "gboolean expand" : false,
+ "$ homogeneous" : false,
"$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "$ homogeneous" : false,
+ "gboolean expand" : false,
"items" : [
{
- "label" : "root URL",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
"gint margin" : 3,
- "$ xns" : "Gtk"
+ "label" : "root URL",
+ "xtype" : "Label"
},
{
- "id" : "rootURL",
+ "$ xns" : "Gtk",
"* pack" : "add",
- "xtype" : "Entry",
- "$ xns" : "Gtk"
+ "id" : "rootURL",
+ "xtype" : "Entry"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "label" : "HTML To insert at end of <HEAD>",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
- "$ xns" : "Gtk"
+ "label" : "HTML To insert at end of <HEAD>",
+ "xtype" : "Label"
},
{
- "* pack" : "pack_start,true,true,0",
- "xtype" : "ScrolledWindow",
"$ xns" : "Gtk",
+ "* pack" : "pack_start,true,true,0",
"items" : [
{
+ "$ xns" : "GtkSource",
+ "* init" : [
+ " ",
+ " var description = Pango.FontDescription.from_string(\"monospace\");",
+ " description.set_size(9000);",
+ " this.el.override_font(description);"
+ ],
+ "* pack" : "add",
+ "id" : "view",
"listeners" : {
- "key_release_event" : " ( event) =>{\n if (event.keyval != 115) {\n return false;\n \n }\n if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {\n return false;\n }\n var buf = this.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 _this.project.runhtml = buf.get_text(s,e,true);\n \n \n _this.buttonPressed(\"save\");\n \n return false;\n \n}"
+ "key_release_event" : [
+ " ( event) =>{",
+ " if (event.keyval != 115) {",
+ " return false;",
+ " ",
+ " }",
+ " if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {",
+ " return false;",
+ " }",
+ " var buf = this.el.get_buffer();",
+ " Gtk.TextIter s;",
+ " Gtk.TextIter e;",
+ " buf.get_start_iter(out s);",
+ " buf.get_end_iter(out e);",
+ " _this.project.runhtml = buf.get_text(s,e,true);",
+ " ",
+ " ",
+ " _this.buttonPressed(\"save\");",
+ " ",
+ " return false;",
+ " ",
+ "}"
+ ]
},
- "id" : "view",
- "* init" : " \n var description = Pango.FontDescription.from_string(\"monospace\");\n description.set_size(9000);\n this.el.override_font(description);",
- "xtype" : "View",
- "* pack" : "add",
- "$ xns" : "GtkSource"
+ "xtype" : "View"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "* pack" : "append_page,_this.label_database.el",
- "xtype" : "Box",
- "gboolean homogeneous" : false,
"$ xns" : "Gtk",
+ "* pack" : "append_page,_this.label_database.el",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "gboolean homogeneous" : false,
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"label" : "Type (eg. MySQL or PostgreSQL)",
"xalign" : 0,
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
- "$ xns" : "Gtk"
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
+ "id" : "database_DBTYPE",
"listeners" : {
- "key_press_event" : "(ev) => {\n\n if (ev.keyval == Gdk.Key.Tab) {\n _this.database_DBNAME.el.grab_focus();\n return true;\n }\n\n\n return false;\n}\n"
+ "key_press_event" : [
+ "(ev) => {",
+ "",
+ " if (ev.keyval == Gdk.Key.Tab) {",
+ " _this.database_DBNAME.el.grab_focus();",
+ " return true;",
+ " }",
+ "",
+ "",
+ " return false;",
+ "}",
+ ""
+ ]
},
- "id" : "database_DBTYPE",
- "xtype" : "Entry",
- "* pack" : "pack_start,false,false,0",
- "$ xns" : "Gtk"
+ "xtype" : "Entry"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"label" : "Name",
"xalign" : 0,
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
- "$ xns" : "Gtk"
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
+ "id" : "database_DBNAME",
"listeners" : {
- "key_press_event" : "(ev) => {\n\n if (ev.keyval == Gdk.Key.Tab) {\n _this.database_DBUSERNAME.el.grab_focus();\n return true;\n }\n\n\n return false;\n}\n"
+ "key_press_event" : [
+ "(ev) => {",
+ "",
+ " if (ev.keyval == Gdk.Key.Tab) {",
+ " _this.database_DBUSERNAME.el.grab_focus();",
+ " return true;",
+ " }",
+ "",
+ "",
+ " return false;",
+ "}",
+ ""
+ ]
},
- "id" : "database_DBNAME",
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Entry",
- "$ xns" : "Gtk"
+ "xtype" : "Entry"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"label" : "Username",
"xalign" : 0,
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
- "$ xns" : "Gtk"
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
+ "id" : "database_DBUSERNAME",
"listeners" : {
- "key_press_event" : "(ev) => {\n\n if (ev.keyval == Gdk.Key.Tab) {\n _this.database_DBPASSWORD.el.grab_focus();\n return true;\n }\n\n\n return false;\n}\n"
+ "key_press_event" : [
+ "(ev) => {",
+ "",
+ " if (ev.keyval == Gdk.Key.Tab) {",
+ " _this.database_DBPASSWORD.el.grab_focus();",
+ " return true;",
+ " }",
+ "",
+ "",
+ " return false;",
+ "}",
+ ""
+ ]
},
- "id" : "database_DBUSERNAME",
- "xtype" : "Entry",
- "* pack" : "pack_start,false,false,0",
- "$ xns" : "Gtk"
+ "xtype" : "Entry"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"label" : "Password",
"xalign" : 0,
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
- "$ xns" : "Gtk"
+ "xtype" : "Label"
},
{
- "id" : "database_DBPASSWORD",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false,0",
- "xtype" : "Entry",
- "$ xns" : "Gtk"
+ "id" : "database_DBPASSWORD",
+ "xtype" : "Entry"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"listeners" : {
- "clicked" : "() => {\n\n\n _this.database_ERROR.el.label = \"\";\n Gda.Connection cnc;\n try {\n // assumes localhost...\n cnc = Gda.Connection.open_from_string (\n\t\t\t_this.database_DBTYPE.el.get_text(),\n\t\t\t\"DB_NAME=\" + _this.database_DBNAME.el.get_text(), \n\t\t\t\"USERNAME=\" + _this.database_DBUSERNAME.el.get_text() + \n\t\t\t\";PASSWORD=\" + _this.database_DBPASSWORD.el.get_text(),\n\t\t\tGda.ConnectionOptions.NONE\n\t\t);\n //} catch (Gda.ConnectionError ce) { \n // _this.database_ERROR.el.label = ce.message; \n } catch(Gda.ConnectionError ue) {\n _this.database_ERROR.el.label = ue.message;\n return;\n } catch(Gda.ConfigError ue) {\n _this.database_ERROR.el.label = ue.message;\n return;\n }\n _this.database_ERROR.el.label = \"Connection Succeeded\";\n cnc.close();\n}"
+ "clicked" : [
+ "() => {",
+ "",
+ "",
+ " _this.database_ERROR.el.label = \"\";",
+ " Gda.Connection cnc;",
+ " try {",
+ " // assumes localhost...",
+ " cnc = Gda.Connection.open_from_string (",
+ "\t\t\t_this.database_DBTYPE.el.get_text(),",
+ "\t\t\t\"DB_NAME=\" + _this.database_DBNAME.el.get_text(), ",
+ "\t\t\t\"USERNAME=\" + _this.database_DBUSERNAME.el.get_text() + ",
+ "\t\t\t\";PASSWORD=\" + _this.database_DBPASSWORD.el.get_text(),",
+ "\t\t\tGda.ConnectionOptions.NONE",
+ "\t\t);",
+ " //} catch (Gda.ConnectionError ce) { ",
+ " // _this.database_ERROR.el.label = ce.message; ",
+ " } catch(Gda.ConnectionError ue) {",
+ " _this.database_ERROR.el.label = ue.message;",
+ " return;",
+ " } catch(Gda.ConfigError ue) {",
+ " _this.database_ERROR.el.label = ue.message;",
+ " return;",
+ " }",
+ " _this.database_ERROR.el.label = \"Connection Succeeded\";",
+ " cnc.close();",
+ "}"
+ ]
},
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Button",
- "$ xns" : "Gtk",
- "utf8 label" : "Check Connection"
+ "utf8 label" : "Check Connection",
+ "xtype" : "Button"
},
{
- "label" : " ",
- "id" : "database_ERROR",
- "xalign" : 0,
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false,false,0",
- "xtype" : "Label",
"gint margin" : 3,
- "$ xns" : "Gtk"
+ "id" : "database_ERROR",
+ "label" : " ",
+ "xalign" : 0,
+ "xtype" : "Label"
}
- ]
+ ],
+ "xtype" : "Box"
}
- ]
+ ],
+ "xtype" : "Notebook"
}
+ ],
+ "xtype" : "Box",
+ "| void save" : [
+ "()",
+ "{",
+ " var buf = _this.view.el.get_buffer();",
+ " Gtk.TextIter s;",
+ " Gtk.TextIter e;",
+ " buf.get_start_iter(out s);",
+ " buf.get_end_iter(out e);",
+ " _this.project.runhtml = buf.get_text(s,e,true);",
+ " ",
+ " _this.project.rootURL = _this.rootURL.el.get_text();",
+ " _this.project.base_template = _this.base_template.el.get_text(); ",
+ " ",
+ " var js = _this.project.json_project_data;",
+ " js.set_string_member(\"DBTYPE\", _this.database_DBTYPE.el.get_text());",
+ " js.set_string_member(\"DBNAME\", _this.database_DBNAME.el.get_text());",
+ " js.set_string_member(\"DBUSERNAME\", _this.database_DBUSERNAME.el.get_text());",
+ " js.set_string_member(\"DBPASSWORD\", _this.database_DBPASSWORD.el.get_text());",
+ "// _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text()); ",
+ " ",
+ " // need to re-init the database ",
+ " ",
+ " _this.project.initRooDatabase();",
+ " ",
+ "}"
+ ],
+ "| void show" : [
+ " (Project.Project project) {",
+ " _this.project = project;",
+ " _this.path.el.label = project.firstPath();",
+ " // get the active project.",
+ " var lm = Gtk.SourceLanguageManager.get_default();",
+ " ",
+ " ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(",
+ " ",
+ " lm.get_language(\"html\"));",
+ " ",
+ " //print (project.fn);",
+ " //project.runhtml = project.runhtml || '';",
+ " _this.view.el.get_buffer().set_text(project.runhtml);",
+ " ",
+ " ",
+ " _this.rootURL.el.set_text( _this.project.rootURL );",
+ " _this.base_template.el.set_text(_this.project.base_template); ",
+ " var js = _this.project;",
+ " _this.database_DBTYPE.el.set_text( js.get_string_member(\"DBTYPE\") );",
+ " _this.database_DBNAME.el.set_text( js.get_string_member(\"DBNAME\") );",
+ " _this.database_DBUSERNAME.el.set_text( js.get_string_member(\"DBUSERNAME\") );",
+ " _this.database_DBPASSWORD.el.set_text( js.get_string_member(\"DBPASSWORD\") );",
+ " //this.el.show_all();",
+ "}",
+ ""
]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "ProjectSettings",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ProjectSettings.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
// need to re-init the database
_this.project.initRooDatabase();
-
-
+
}
public class Xcls_Box2 : Object
{
{
- "id": "file-gtk-14",
- "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} \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": " (Gtk.Window win, string msg) {\n\n this.el.set_transient_for(win);\n this.el.modal = true;\n this.el.text = msg;\n this.el.show_all();\n}\n",
- "|xns": "Gtk"
- }
+ "build_module" : "",
+ "items" : [
+ {
+ "$ buttons" : "Gtk.ButtonsType.OK",
+ "$ message_type" : "Gtk.MessageType.ERROR",
+ "$ modal" : true,
+ "$ use_markup" : true,
+ "$ xns" : "Gtk",
+ "Gtk.DialogFlags flags" : "Gtk.DialogFlags.MODAL",
+ "id" : "StandardErrorDialog",
+ "listeners" : {
+ "delete_event" : [
+ " (self, event) => {",
+ " this.el.hide();",
+ " return true;",
+ " ",
+ "} ",
+ ""
],
- "permname": "",
- "modOrder": ""
+ "response" : [
+ " (self, response_id) => {",
+ " this.el.hide();",
+ "}"
+ ]
+ },
+ "text" : "fixme",
+ "xtype" : "MessageDialog",
+ "| void show" : [
+ " (Gtk.Window win, string msg) {",
+ "",
+ " this.el.set_transient_for(win);",
+ " this.el.modal = true;",
+ " this.el.text = msg;",
+ " this.el.show_all();",
+ "}",
+ ""
+ ]
+ }
+ ],
+ "modOrder" : "",
+ "name" : "StandardErrorDialog",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/StandardErrorDialog.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
-/* -- 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
-*/
+static Xcls_StandardErrorDialog _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 : Object
+public class Xcls_StandardErrorDialog : Object
{
public Gtk.MessageDialog el;
private Xcls_StandardErrorDialog _this;
public static Xcls_StandardErrorDialog singleton()
{
- if (StandardErrorDialog == null) {
- StandardErrorDialog= new Xcls_StandardErrorDialog();
+ if (_StandardErrorDialog == null) {
+ _StandardErrorDialog= new Xcls_StandardErrorDialog();
}
- return StandardErrorDialog;
+ return _StandardErrorDialog;
}
- // my vars
+ // my vars (def)
- // ctor
+ // ctor
public Xcls_StandardErrorDialog()
{
_this = this;
this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, "fixme" );
- // my vars
+ // my vars (dec)
// set gobject values
this.el.modal = true;
this.el.use_markup = true;
- // listeners
- this.el.delete_event.connect( (self, event) => {
+ //listeners
+ this.el.delete_event.connect( (self, event) => {
this.el.hide();
return true;
-
- }
- );
- this.el.response.connect( (self, response_id) => {
+
+ });
+ this.el.response.connect( (self, response_id) => {
this.el.hide();
- } );
+ });
}
- // userdefined functions
+ // user defined functions
public void show (Gtk.Window win, string msg) {
-
- this.el.set_transient_for(win);
- this.el.modal = true;
- this.el.text = msg;
- this.el.show_all();
- }
-
- // skip |xns - no return type
+
+ this.el.set_transient_for(win);
+ this.el.modal = true;
+ this.el.text = msg;
+ this.el.show_all();
+ }
}
{
- "name" : "ValaCompileErrors",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaCompileErrors.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
- "int height_request" : 800,
- "id" : "ValaCompileErrors",
- "Xcls_MainWindow window" : "",
- "| void show" : "(Json.Object tree, Gtk.Widget onbtn) {\n\n \n this.file = null;\n this.notices = tree;\n \n //print(\"looking for %s\\n\", id);\n // loop through parent childnre\n \n \n var store = this.compile_result_store.el; \n \n store.clear();\n \n \n tree.foreach_member((obj, file, node) => {\n // id line \"display text\", file\n \n var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + \"/\" + GLib.Path.get_basename( file) ;\n Gtk.TreeIter iter;\n print(\"Add file %s\", title);\n store.append(out iter, null);\n var lines = tree.get_object_member(file);\n title += \" (\" + lines.get_size().to_string() + \")\";\n store.set(iter, 0, file, 1, -1, 2, title, 3, file,-1);\n \n lines.foreach_member((obja, line, nodea) => {\n var msg = \"\";\n var ar = lines.get_array_member(line);\n for (var i = 0 ; i < ar.get_length(); i++) {\n \t\t msg += (msg.length > 0) ? \"\\n\" : \"\";\n \t\t msg += ar.get_string_element(i);\n\t }\n Gtk.TreeIter citer; \n print(\"Add line %s\", line);\n store.append(out citer, iter);\n store.set(citer, \n 0, file + \":\" + line, \n 1, int.parse(line), \n 2, GLib.Markup.escape_text(line + \": \" + msg), \n 3, file,-1);\n \n });\n \n \n \n });\n \n int w,h;\n this.window.el.get_size(out w, out h);\n \n // left tree = 250, editor area = 500?\n \n // min 450?\n var new_w = int.min(450, w-100);\n if (new_w > (w-100)) {\n new_w = w-100;\n }\n this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));\n\n \n\n if (this.el.relative_to == null) {\n this.el.set_relative_to(onbtn);\n }\n this.el.show_all();\n \n while(Gtk.events_pending()) { \n Gtk.main_iteration();\n } \n // this.hpane.el.set_position( 0);\n}\n",
- "bool hexpand" : false,
- "xtype" : "Popover",
- "Gtk.PositionType position" : "Gtk.PositionType.TOP",
- "bool active" : false,
- "int width_request" : 900,
"$ xns" : "Gtk",
+ "Gtk.PositionType position" : "Gtk.PositionType.TOP",
"JsRender.JsRender? file" : "",
"Json.Object notices" : "",
+ "Xcls_MainWindow window" : "",
+ "bool active" : false,
+ "bool hexpand" : false,
"bool modal" : true,
+ "id" : "ValaCompileErrors",
+ "int height_request" : 800,
+ "int width_request" : 900,
"items" : [
{
- "id" : "compile_view",
- "bool hexpand" : false,
- "xtype" : "Box",
- "* pack" : "add",
- "gboolean homogeneous" : false,
"$ xns" : "Gtk",
+ "* pack" : "add",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : false,
+ "gboolean homogeneous" : false,
+ "id" : "compile_view",
"items" : [
{
- "xtype" : "Box",
- "* pack" : "pack_start,false,false,0",
"$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
- "* pack" : "pack_start,true,true,0",
- "xtype" : "Button",
"$ xns" : "Gtk",
- "utf8 label" : "Compile and Run "
+ "* pack" : "pack_start,true,true,0",
+ "utf8 label" : "Compile and Run ",
+ "xtype" : "Button"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "* init" : "{\n this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n\n}\n",
- "* pack" : "pack_end,true,true,0",
- "xtype" : "ScrolledWindow",
"$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ " ",
+ "",
+ "}",
+ ""
+ ],
+ "* pack" : "pack_end,true,true,0",
"items" : [
{
- "listeners" : {
- "button_press_event" : " ( ev) => {\n \n Gtk.TreeViewColumn col;\n int cell_x;\n int cell_y;\n Gtk.TreePath path;\n if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {\n print(\"nothing selected on click\");\n \n return false; //not on a element.\n }\n \n \n // right click.\n if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) { \n // show popup!. \n \n \n return false;\n }\n Gtk.TreeIter iter;\n var mod = _this.compile_result_store.el;\n mod.get_iter (out iter, path);\n \n \n \n // var val = \"\";\n GLib.Value value;\n _this.compile_result_store.el.get_value(iter, 3, out value);\n var fname = (string)value;\n GLib.Value lvalue;\n _this.compile_result_store.el.get_value(iter, 1, out lvalue);\n var line = (int) lvalue;\n \n print(\"open %s @ %d\\n\", fname, line);\n \n \n var bjsf = \"\";\n try { \n var regex = new Regex(\"\\\\.vala$\");\n \n \n bjsf = regex.replace(fname,fname.length , 0 , \".bjs\");\n } catch (GLib.RegexError e) {\n return false;\n } \n var p = _this.window.project;\n \n \n \n var jsr = p.getByPath(bjsf);\n if (jsr != null) {\n _this.window.windowstate.fileViewOpen(jsr, line);\n \n return false;\n \n }\n \n var pf = JsRender.JsRender.factory(\"PlainFile\", p, fname);\n _this.window.windowstate.fileViewOpen(pf,line);\n \n // try hiding the left nav..\n \n return false;\n \n }\n "
- },
- "id" : "compile_tree",
- "* init" : "{\n var description = new Pango.FontDescription();\n description.set_size(8000);\n this.el.override_font(description);\n\n}\n",
- "* pack" : "add",
- "xtype" : "TreeView",
"$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " var description = new Pango.FontDescription();",
+ " description.set_size(8000);",
+ " this.el.override_font(description);",
+ "",
+ "}",
+ ""
+ ],
+ "* pack" : "add",
+ "id" : "compile_tree",
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "set_model",
+ "columns" : " typeof(string), typeof(int), typeof(string), typeof(string) ",
"gint n_columns" : 4,
"id" : "compile_result_store",
- "columns" : " typeof(string), typeof(int), typeof(string), typeof(string) ",
- "* pack" : "set_model",
- "xtype" : "TreeStore",
- "$ xns" : "Gtk"
+ "xtype" : "TreeStore"
},
{
- "utf8 title" : "Compile output",
- "* init" : "{\n this.el.add_attribute(_this.renderer.el , \"markup\", 2 );\n \n}\n",
- "xtype" : "TreeViewColumn",
- "* pack" : "append_column",
- "string id" : "column",
"$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " this.el.add_attribute(_this.renderer.el , \"markup\", 2 );",
+ " ",
+ "}",
+ ""
+ ],
+ "* pack" : "append_column",
"items" : [
{
- "id" : "renderer",
- "xtype" : "CellRendererText",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,true",
- "$ xns" : "Gtk"
+ "id" : "renderer",
+ "xtype" : "CellRendererText"
}
- ]
+ ],
+ "string id" : "column",
+ "utf8 title" : "Compile output",
+ "xtype" : "TreeViewColumn"
}
- ]
+ ],
+ "listeners" : {
+ "button_press_event" : [
+ " ( ev) => {",
+ " ",
+ " Gtk.TreeViewColumn col;",
+ " int cell_x;",
+ " int cell_y;",
+ " Gtk.TreePath path;",
+ " if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {",
+ " print(\"nothing selected on click\");",
+ " ",
+ " return false; //not on a element.",
+ " }",
+ " ",
+ " ",
+ " // right click.",
+ " if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) { ",
+ " // show popup!. ",
+ " ",
+ " ",
+ " return false;",
+ " }",
+ " Gtk.TreeIter iter;",
+ " var mod = _this.compile_result_store.el;",
+ " mod.get_iter (out iter, path);",
+ " ",
+ " ",
+ " ",
+ " // var val = \"\";",
+ " GLib.Value value;",
+ " _this.compile_result_store.el.get_value(iter, 3, out value);",
+ " var fname = (string)value;",
+ " GLib.Value lvalue;",
+ " _this.compile_result_store.el.get_value(iter, 1, out lvalue);",
+ " var line = (int) lvalue;",
+ " ",
+ " print(\"open %s @ %d\\n\", fname, line);",
+ " ",
+ " ",
+ " var bjsf = \"\";",
+ " try { ",
+ " var regex = new Regex(\"\\\\.vala$\");",
+ " ",
+ " ",
+ " bjsf = regex.replace(fname,fname.length , 0 , \".bjs\");",
+ " } catch (GLib.RegexError e) {",
+ " return false;",
+ " } ",
+ " var p = _this.window.project;",
+ " ",
+ " ",
+ " ",
+ " var jsr = p.getByPath(bjsf);",
+ " if (jsr != null) {",
+ " _this.window.windowstate.fileViewOpen(jsr, line);",
+ " ",
+ " return false;",
+ " ",
+ " }",
+ " ",
+ " var pf = JsRender.JsRender.factory(\"PlainFile\", p, fname);",
+ " _this.window.windowstate.fileViewOpen(pf,line);",
+ " ",
+ " // try hiding the left nav..",
+ " ",
+ " return false;",
+ " ",
+ " }",
+ " "
+ ]
+ },
+ "xtype" : "TreeView"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
}
- ]
+ ],
+ "xtype" : "Box"
}
+ ],
+ "xtype" : "Popover",
+ "| void show" : [
+ "(Json.Object tree, Gtk.Widget onbtn) {",
+ "",
+ " ",
+ " this.file = null;",
+ " this.notices = tree;",
+ " ",
+ " //print(\"looking for %s\\n\", id);",
+ " // loop through parent childnre",
+ " ",
+ " ",
+ " var store = this.compile_result_store.el; ",
+ " ",
+ " store.clear();",
+ " ",
+ " ",
+ " tree.foreach_member((obj, file, node) => {",
+ " // id line \"display text\", file",
+ " ",
+ " var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + \"/\" + GLib.Path.get_basename( file) ;",
+ " Gtk.TreeIter iter;",
+ " print(\"Add file %s\", title);",
+ " store.append(out iter, null);",
+ " var lines = tree.get_object_member(file);",
+ " title += \" (\" + lines.get_size().to_string() + \")\";",
+ " store.set(iter, 0, file, 1, -1, 2, title, 3, file,-1);",
+ " ",
+ " lines.foreach_member((obja, line, nodea) => {",
+ " var msg = \"\";",
+ " var ar = lines.get_array_member(line);",
+ " for (var i = 0 ; i < ar.get_length(); i++) {",
+ "\t\t msg += (msg.length > 0) ? \"\\n\" : \"\";",
+ "\t\t msg += ar.get_string_element(i);",
+ " }",
+ " Gtk.TreeIter citer; ",
+ " print(\"Add line %s\", line);",
+ " store.append(out citer, iter);",
+ " store.set(citer, ",
+ " 0, file + \":\" + line, ",
+ " 1, int.parse(line), ",
+ " 2, GLib.Markup.escape_text(line + \": \" + msg), ",
+ " 3, file,-1);",
+ " ",
+ " });",
+ " ",
+ " ",
+ " ",
+ " });",
+ " ",
+ " int w,h;",
+ " this.window.el.get_size(out w, out h);",
+ " ",
+ " // left tree = 250, editor area = 500?",
+ " ",
+ " // min 450?",
+ " var new_w = int.min(450, w-100);",
+ " if (new_w > (w-100)) {",
+ " new_w = w-100;",
+ " }",
+ " this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));",
+ "",
+ " ",
+ "",
+ " if (this.el.relative_to == null) {",
+ " this.el.set_relative_to(onbtn);",
+ " }",
+ " this.el.show_all();",
+ " ",
+ " while(Gtk.events_pending()) { ",
+ " Gtk.main_iteration();",
+ " } ",
+ " // this.hpane.el.set_position( 0);",
+ "}",
+ ""
]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "ValaCompileErrors",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaCompileErrors.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
// user defined functions
public void show (Json.Object tree, Gtk.Widget onbtn) {
+
+ this.file = null;
+ this.notices = tree;
+
+ //print("looking for %s\n", id);
+ // loop through parent childnre
+
+
+ var store = this.compile_result_store.el;
+
+ store.clear();
+
+
+ tree.foreach_member((obj, file, node) => {
+ // id line "display text", file
- this.file = null;
- this.notices = tree;
-
- //print("looking for %s\n", id);
- // loop through parent childnre
-
+ var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + "/" + GLib.Path.get_basename( file) ;
+ Gtk.TreeIter iter;
+ print("Add file %s", title);
+ store.append(out iter, null);
+ var lines = tree.get_object_member(file);
+ title += " (" + lines.get_size().to_string() + ")";
+ store.set(iter, 0, file, 1, -1, 2, title, 3, file,-1);
- var store = this.compile_result_store.el;
+ lines.foreach_member((obja, line, nodea) => {
+ var msg = "";
+ var ar = lines.get_array_member(line);
+ for (var i = 0 ; i < ar.get_length(); i++) {
+ msg += (msg.length > 0) ? "\n" : "";
+ msg += ar.get_string_element(i);
+ }
+ Gtk.TreeIter citer;
+ print("Add line %s", line);
+ store.append(out citer, iter);
+ store.set(citer,
+ 0, file + ":" + line,
+ 1, int.parse(line),
+ 2, GLib.Markup.escape_text(line + ": " + msg),
+ 3, file,-1);
- store.clear();
-
+ });
- tree.foreach_member((obj, file, node) => {
- // id line "display text", file
-
- var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + "/" + GLib.Path.get_basename( file) ;
- Gtk.TreeIter iter;
- print("Add file %s", title);
- store.append(out iter, null);
- var lines = tree.get_object_member(file);
- title += " (" + lines.get_size().to_string() + ")";
- store.set(iter, 0, file, 1, -1, 2, title, 3, file,-1);
-
- lines.foreach_member((obja, line, nodea) => {
- var msg = "";
- var ar = lines.get_array_member(line);
- for (var i = 0 ; i < ar.get_length(); i++) {
- msg += (msg.length > 0) ? "\n" : "";
- msg += ar.get_string_element(i);
- }
- Gtk.TreeIter citer;
- print("Add line %s", line);
- store.append(out citer, iter);
- store.set(citer,
- 0, file + ":" + line,
- 1, int.parse(line),
- 2, GLib.Markup.escape_text(line + ": " + msg),
- 3, file,-1);
-
- });
-
-
- });
+
+ });
int w,h;
this.window.el.get_size(out w, out h);
{
- "name" : "ValaCompileResults",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/ValaCompileResults.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
- "int height_request" : 400,
- "id" : "ValaCompileResults",
- "| void show" : "( Gtk.Widget onbtn, bool reset) {\n\tint w, h;\n \n\tthis.window.el.get_size(out w, out h);\n \n // left tree = 250, editor area = 500?\n \n var new_w = int.min(750, w-100);\n if (new_w > (w-100)) {\n new_w = w-100;\n }\n this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));\n \n\n if (this.el.relative_to == null) {\n this.el.set_relative_to(onbtn);\n }\n this.el.show_all();\n // not sure why..\n \n if (reset) {\n\t\tvar buf = (Gtk.SourceBuffer)this.sourceview.el.get_buffer();\n\t\tbuf.set_text(\"\",0);\n\t}\n \n while(Gtk.events_pending()) { \n Gtk.main_iteration();\n }\n \n \n \n}\n",
- "Xcls_MainWindow window" : "",
- "xtype" : "Popover",
+ "$ xns" : "Gtk",
"Gtk.PositionType position" : "Gtk.PositionType.TOP",
+ "Xcls_MainWindow window" : "",
"bool active" : true,
- "int width_request" : 600,
- "$ xns" : "Gtk",
- "| void addLine" : "(string str) {\n\tvar buf = (Gtk.SourceBuffer)this.sourceview.el.get_buffer();\n\tGtk.TextIter iter;\n\tbuf.get_end_iter (out iter);\n\tbuf.insert(ref iter, str, str.length);\n\t/// scroll..\n\tbuf.get_end_iter (out iter);\n\tthis.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);\n\t\n\n}\n",
"bool modal" : true,
+ "id" : "ValaCompileResults",
+ "int height_request" : 400,
+ "int width_request" : 600,
"items" : [
{
- "id" : "compile_view",
- "* pack" : "add",
- "xtype" : "Box",
- "gboolean homogeneous" : false,
"$ xns" : "Gtk",
+ "* pack" : "add",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "gboolean homogeneous" : false,
+ "id" : "compile_view",
"items" : [
{
- "* init" : "{\n this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n\n}\n",
- "bool hexpand" : true,
- "* pack" : "pack_end,true,true,0",
- "xtype" : "ScrolledWindow",
"$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ " ",
+ "",
+ "}",
+ ""
+ ],
+ "* pack" : "pack_end,true,true,0",
+ "bool hexpand" : true,
"items" : [
{
- "id" : "sourceview",
- "* init" : "{\n\n var description = Pango.FontDescription.from_string(\"monospace\");\n description.set_size(8000);\n this.el.override_font(description);\n\n\n}\n",
- "xtype" : "SourceView",
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "",
+ " var description = Pango.FontDescription.from_string(\"monospace\");",
+ " description.set_size(8000);",
+ " this.el.override_font(description);",
+ "",
+ "",
+ "}",
+ ""
+ ],
"* pack" : "add",
"bool editable" : false,
- "$ xns" : "Gtk",
- "bool show_line_numbers" : false
+ "bool show_line_numbers" : false,
+ "id" : "sourceview",
+ "xtype" : "SourceView"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
}
- ]
+ ],
+ "xtype" : "Box"
}
+ ],
+ "xtype" : "Popover",
+ "| void addLine" : [
+ "(string str) {",
+ "\tvar buf = (Gtk.SourceBuffer)this.sourceview.el.get_buffer();",
+ "\tGtk.TextIter iter;",
+ "\tbuf.get_end_iter (out iter);",
+ "\tbuf.insert(ref iter, str, str.length);",
+ "\t/// scroll..",
+ "\tbuf.get_end_iter (out iter);",
+ "\tthis.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);",
+ " ",
+ "}",
+ ""
+ ],
+ "| void show" : [
+ "( Gtk.Widget onbtn, bool reset) {",
+ "\tint w, h;",
+ " ",
+ "\tthis.window.el.get_size(out w, out h);",
+ " ",
+ " // left tree = 250, editor area = 500?",
+ " ",
+ " var new_w = int.min(750, w-100);",
+ " if (new_w > (w-100)) {",
+ " new_w = w-100;",
+ " }",
+ " this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));",
+ " ",
+ "",
+ " if (this.el.relative_to == null) {",
+ " this.el.set_relative_to(onbtn);",
+ " }",
+ " this.el.show_all();",
+ " // not sure why..",
+ " ",
+ " if (reset) {",
+ "\t\tvar buf = (Gtk.SourceBuffer)this.sourceview.el.get_buffer();",
+ "\t\tbuf.set_text(\"\",0);",
+ "\t}",
+ " ",
+ " while(Gtk.events_pending()) { ",
+ " Gtk.main_iteration();",
+ " }",
+ " ",
+ " ",
+ " ",
+ "}",
+ ""
]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "ValaCompileResults",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaCompileResults.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
/// scroll..
buf.get_end_iter (out iter);
this.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);
-
-
+
}
public class Xcls_compile_view : Object
{
{
- "name" : "ValaProjectSettings",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/ValaProjectSettings.bjs",
- "permname" : "",
- "modOrder" : "",
"build_module" : "builder",
"items" : [
{
"# Project.Gtk project" : "null",
"# Xcls_MainWindow window" : "null",
- "| void show" : "(Project.Gtk project) {\n \n \n print(\"ValaProjectSettings show\\n\");\n \n this.project= project;\n\n this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;\n \n this.default_directory_tree_store.load(); \n this.default_packages_tree_store.load(); \n this.targets_tree_store.load();\n this.files_tree_store.load();\n\n}\n",
- "bool hexpand" : true,
- "xtype" : "Box",
- "string id" : "ValaProjectSettings",
- "| void save" : "() {\n this.project.writeConfig();\n}",
"$ xns" : "Gtk",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
"items" : [
{
- "* pack" : "pack_start,true,true,0",
- "xtype" : "Notebook",
"$ xns" : "Gtk",
+ "* pack" : "pack_start,true,true,0",
"items" : [
{
- "id" : "label_global",
- "* pack" : false,
- "xtype" : "Label",
"$ xns" : "Gtk",
- "utf8 label" : "Global"
+ "* pack" : false,
+ "id" : "label_global",
+ "utf8 label" : "Global",
+ "xtype" : "Label"
},
{
- "id" : "label_targets",
- "xtype" : "Label",
- "* pack" : false,
"$ xns" : "Gtk",
- "utf8 label" : "Targets"
+ "* pack" : false,
+ "id" : "label_targets",
+ "utf8 label" : "Targets",
+ "xtype" : "Label"
},
{
- "xtype" : "Box",
- "* pack" : "append_page,_this.label_global.el",
- "gboolean homogeneous" : false,
"$ xns" : "Gtk",
+ "* pack" : "append_page,_this.label_global.el",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "gboolean homogeneous" : false,
"items" : [
{
- "xtype" : "Label",
- "* pack" : "pack_start,false,false,0",
"$ xns" : "Gtk",
- "utf8 label" : "compile flags"
+ "* pack" : "pack_start,false,false,0",
+ "utf8 label" : "compile flags",
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
+ "id" : "compile_flags",
"listeners" : {
- "changed" : "() => {\n \n _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;\n _this.project.writeConfig();\n// _this.project.save();\n\n}"
+ "changed" : [
+ "() => {",
+ " ",
+ " _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;",
+ " _this.project.writeConfig();",
+ "// _this.project.save();",
+ "",
+ "}"
+ ]
},
- "id" : "compile_flags",
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Entry",
- "$ xns" : "Gtk",
- "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR "
+ "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR ",
+ "xtype" : "Entry"
},
{
- "* pack" : "pack_start,true,true,0",
- "xtype" : "Paned",
"$ xns" : "Gtk",
- "int position" : 300,
+ "* pack" : "pack_start,true,true,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "int position" : 300,
"items" : [
{
- "bool hexpand" : true,
- "* pack" : "add",
- "xtype" : "ScrolledWindow",
"$ xns" : "Gtk",
+ "* pack" : "add",
+ "bool hexpand" : true,
"items" : [
{
- "gboolean headers_visible" : true,
- "xtype" : "TreeView",
- "* pack" : "add",
- "string id" : "default_packages_tree",
"$ xns" : "Gtk",
+ "* pack" : "add",
+ "gboolean headers_visible" : true,
"items" : [
{
+ "$ columns" : [
+ " typeof(string), // 0 key type",
+ " typeof(bool)"
+ ],
+ "$ n_columns" : 2,
+ "$ xns" : "Gtk",
+ "* pack" : "set_model",
"id" : "default_packages_tree_store",
"xtype" : "ListStore",
- "* pack" : "set_model",
- "$ n_columns" : 2,
- "| void load" : "() {\n \n var def = _this.project.compilegroups.get(\"_default_\");\n var items = def.packages;\n \n this.el.clear();\n var pal = (Palete.Gtk) Palete.factory(\"Gtk\");\n var pkgs = pal.packages(_this.project);\n print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);\n\n Gtk.TreeIter citer;\n\n for(var i =0 ; i < pkgs.size; i++) {\n this.el.append(out citer); \n \n this.el.set_value(citer, 0, pkgs.get(i) ); // title \n this.el.set_value(citer, 1, items.contains(pkgs.get(i)) );\n }\n this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n \n}\n",
- "$ columns" : " typeof(string), // 0 key type\n typeof(bool)",
- "$ xns" : "Gtk"
+ "| void load" : [
+ "() {",
+ " ",
+ " var def = _this.project.compilegroups.get(\"_default_\");",
+ " var items = def.packages;",
+ " ",
+ " this.el.clear();",
+ " var pal = (Palete.Gtk) Palete.factory(\"Gtk\");",
+ " var pkgs = pal.packages(_this.project);",
+ " print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);",
+ "",
+ " Gtk.TreeIter citer;",
+ "",
+ " for(var i =0 ; i < pkgs.size; i++) {",
+ " this.el.append(out citer); ",
+ " ",
+ " this.el.set_value(citer, 0, pkgs.get(i) ); // title ",
+ " this.el.set_value(citer, 1, items.contains(pkgs.get(i)) );",
+ " }",
+ " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " ",
+ "}",
+ ""
+ ]
},
{
- "utf8 title" : "package name",
- "* init" : " \n this.el.add_attribute(_this.packages_render.el , \"text\", 0 );\n ",
+ "$ xns" : "Gtk",
+ "* init" : [
+ " ",
+ " this.el.add_attribute(_this.packages_render.el , \"text\", 0 );",
+ " "
+ ],
"* pack" : "append_column",
- "xtype" : "TreeViewColumn",
- "gboolean resizable" : true,
"gboolean expand" : true,
- "$ xns" : "Gtk",
+ "gboolean resizable" : true,
"items" : [
{
- "id" : "packages_render",
- "xtype" : "CellRendererText",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false",
- "$ xns" : "Gtk"
+ "id" : "packages_render",
+ "xtype" : "CellRendererText"
}
- ]
+ ],
+ "utf8 title" : "package name",
+ "xtype" : "TreeViewColumn"
},
{
- "utf8 title" : "use",
- "* init" : "{\n this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );\n }",
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );",
+ " }"
+ ],
"* pack" : "append_column",
- "xtype" : "TreeViewColumn",
"gboolean resizable" : false,
- "$ xns" : "Gtk",
"gint fixed_width" : 50,
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false",
+ "gboolean activatable" : true,
+ "id" : "packages_render_use",
"listeners" : {
- "toggled" : "( path_string) => { \n var m = _this.default_packages_tree_store.el;\n Gtk.TreeIter iter;\n Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n m.get_iter (out iter, path);\n GLib.Value val;\n m.get_value(iter, 1, out val);\n m.set_value(iter, 1, ((bool) val) ? false :true); \n GLib.Value fval; \n m.get_value(iter, 0, out fval);\n var fn = (string)fval;\n \n var def = _this.project.compilegroups.get(\"_default_\");\n var items = def.packages;\n if ((bool)val) {\n // renive\n items.remove(fn);\n } else {\n items.add(fn);\n }\n \n}"
+ "toggled" : [
+ "( path_string) => { ",
+ " var m = _this.default_packages_tree_store.el;",
+ " Gtk.TreeIter iter;",
+ " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
+ " m.get_iter (out iter, path);",
+ " GLib.Value val;",
+ " m.get_value(iter, 1, out val);",
+ " m.set_value(iter, 1, ((bool) val) ? false :true); ",
+ " GLib.Value fval; ",
+ " m.get_value(iter, 0, out fval);",
+ " var fn = (string)fval;",
+ " ",
+ " var def = _this.project.compilegroups.get(\"_default_\");",
+ " var items = def.packages;",
+ " if ((bool)val) {",
+ " // renive",
+ " items.remove(fn);",
+ " } else {",
+ " items.add(fn);",
+ " }",
+ " ",
+ "}"
+ ]
},
- "id" : "packages_render_use",
- "* pack" : "pack_start,false",
- "xtype" : "CellRendererToggle",
- "$ xns" : "Gtk",
- "gboolean activatable" : true
+ "xtype" : "CellRendererToggle"
}
- ]
+ ],
+ "utf8 title" : "use",
+ "xtype" : "TreeViewColumn"
}
- ]
+ ],
+ "string id" : "default_packages_tree",
+ "xtype" : "TreeView"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
},
{
- "bool hexpand" : true,
- "* pack" : "add2",
- "xtype" : "ScrolledWindow",
"$ xns" : "Gtk",
+ "* pack" : "add2",
+ "bool hexpand" : true,
"items" : [
{
- "listeners" : {
- "button_press_event" : " ( ev) => {\n //console.log(\"button press?\");\n \n \n if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {\n //print(\"click\" + ev.type);\n return false;\n }\n //Gtk.TreePath res;\n //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n // return true;\n //}\n \n // this.el.get_selection().select_path(res);\n \n //if (!this.get('/LeftTreeMenu').el) { \n // this.get('/LeftTreeMenu').init(); \n // }\n \n _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());\n _this.default_directory_menu.el.show_all();\n _this.default_directory_menu.el.popup(null, null, null, 3, ev.time);\n // print(\"click:\" + res.path.to_string());\n return true;\n}"
- },
+ "$ xns" : "Gtk",
+ "* pack" : "add",
"gboolean headers_visible" : true,
"id" : "default_directory_tree",
- "* pack" : "add",
- "xtype" : "TreeView",
- "$ xns" : "Gtk",
"items" : [
{
+ "$ columns" : [
+ " typeof(string)",
+ " "
+ ],
+ "$ n_columns" : 1,
+ "$ xns" : "Gtk",
+ "* pack" : "set_model",
"id" : "default_directory_tree_store",
"xtype" : "ListStore",
- "* pack" : "set_model",
- "$ n_columns" : 1,
- "| void load" : "() {\n \n this.el.clear();\n \n \n var def = _this.project.compilegroups.get(\"_default_\");\n var items = def.sources;\n \n \n Gtk.TreeIter citer;\n\n for(var i =0 ; i < items.size; i++) {\n this.el.append(out citer); \n \n this.el.set_value(citer, 0, items.get(i) ); // title \n //this.el.set_value(citer, 1, items.get(i) );\n }\n this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n \n}\n",
- "$ columns" : " typeof(string)\n ",
- "$ xns" : "Gtk"
+ "| void load" : [
+ "() {",
+ " ",
+ " this.el.clear();",
+ " ",
+ " ",
+ " var def = _this.project.compilegroups.get(\"_default_\");",
+ " var items = def.sources;",
+ " ",
+ " ",
+ " Gtk.TreeIter citer;",
+ "",
+ " for(var i =0 ; i < items.size; i++) {",
+ " this.el.append(out citer); ",
+ " ",
+ " this.el.set_value(citer, 0, items.get(i) ); // title ",
+ " //this.el.set_value(citer, 1, items.get(i) );",
+ " }",
+ " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " ",
+ "}",
+ ""
+ ]
},
{
- "utf8 title" : "Available Directories (right click to add)",
- "* init" : "\n this.el.add_attribute(_this.directory_render.el , \"text\", 0 );\n ",
+ "$ xns" : "Gtk",
+ "* init" : [
+ "",
+ " this.el.add_attribute(_this.directory_render.el , \"text\", 0 );",
+ " "
+ ],
"* pack" : "append_column",
- "xtype" : "TreeViewColumn",
"gboolean resizable" : true,
- "$ xns" : "Gtk",
"items" : [
{
- "id" : "directory_render",
- "xtype" : "CellRendererText",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false",
- "$ xns" : "Gtk"
+ "id" : "directory_render",
+ "xtype" : "CellRendererText"
}
- ]
+ ],
+ "utf8 title" : "Available Directories (right click to add)",
+ "xtype" : "TreeViewColumn"
}
- ]
+ ],
+ "listeners" : {
+ "button_press_event" : [
+ " ( ev) => {",
+ " //console.log(\"button press?\");",
+ " ",
+ " ",
+ " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
+ " //print(\"click\" + ev.type);",
+ " return false;",
+ " }",
+ " //Gtk.TreePath res;",
+ " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
+ " // return true;",
+ " //}",
+ " ",
+ " // this.el.get_selection().select_path(res);",
+ " ",
+ " //if (!this.get('/LeftTreeMenu').el) { ",
+ " // this.get('/LeftTreeMenu').init(); ",
+ " // }",
+ " ",
+ " _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());",
+ " _this.default_directory_menu.el.show_all();",
+ " _this.default_directory_menu.el.popup(null, null, null, 3, ev.time);",
+ " // print(\"click:\" + res.path.to_string());",
+ " return true;",
+ "}"
+ ]
+ },
+ "xtype" : "TreeView"
},
{
- "id" : "default_directory_menu",
- "xtype" : "Menu",
"$ xns" : "Gtk",
+ "id" : "default_directory_menu",
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "add",
"listeners" : {
- "activate" : "() => {\n \n var chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n chooser.close ();\n return;\n }\n chooser.close ();\n // add the directory..\n var fn = _this.project.relPath(chooser.get_filename());\n _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n _this.default_directory_tree_store.load();\n}"
+ "activate" : [
+ "() => {",
+ " ",
+ " var chooser = new Gtk.FileChooserDialog (",
+ "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,",
+ "\t\"_Cancel\",",
+ "\tGtk.ResponseType.CANCEL,",
+ "\t\"_Add\",",
+ "\tGtk.ResponseType.ACCEPT);",
+ " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
+ " chooser.close ();",
+ " return;",
+ " }",
+ " chooser.close ();",
+ " // add the directory..",
+ " var fn = _this.project.relPath(chooser.get_filename());",
+ " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
+ " _this.default_directory_tree_store.load();",
+ "}"
+ ]
},
- "* pack" : "add",
- "xtype" : "MenuItem",
- "$ xns" : "Gtk",
- "utf8 label" : "Add Directory"
+ "utf8 label" : "Add Directory",
+ "xtype" : "MenuItem"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "add",
"listeners" : {
- "activate" : "() => {\n \n var chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n chooser.close ();\n return;\n }\n chooser.close ();\n // add the directory..\n var fn = _this.project.relPath(chooser.get_filename());\n _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n _this.default_directory_tree_store.load();\n}"
+ "activate" : [
+ "() => {",
+ " ",
+ " var chooser = new Gtk.FileChooserDialog (",
+ "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,",
+ "\t\"_Cancel\",",
+ "\tGtk.ResponseType.CANCEL,",
+ "\t\"_Add\",",
+ "\tGtk.ResponseType.ACCEPT);",
+ " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
+ " chooser.close ();",
+ " return;",
+ " }",
+ " chooser.close ();",
+ " // add the directory..",
+ " var fn = _this.project.relPath(chooser.get_filename());",
+ " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
+ " _this.default_directory_tree_store.load();",
+ "}"
+ ]
},
- "* pack" : "add",
- "xtype" : "MenuItem",
- "$ xns" : "Gtk",
- "utf8 label" : "Add File"
+ "utf8 label" : "Add File",
+ "xtype" : "MenuItem"
},
{
+ "$ xns" : "Gtk",
"* pack" : "add",
- "xtype" : "SeparatorMenuItem",
- "$ xns" : "Gtk"
+ "xtype" : "SeparatorMenuItem"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "add",
"listeners" : {
- "activate" : "() => {\n \n //\n Gtk.TreeModel mod;\n Gtk.TreeIter iter;\n if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {\n print(\"nothing selected\\n\");\n return;\n }\n\n \n // add the directory..\n \n \n GLib.Value val;\n mod.get_value(iter,0, out val);\n var fn = (string) val;\n \n print(\"remove: %s\\n\", fn);\n if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {\n print(\"remove failed\");\n }\n _this.default_directory_tree_store.load();\n}"
+ "activate" : [
+ "() => {",
+ " ",
+ " //",
+ " Gtk.TreeModel mod;",
+ " Gtk.TreeIter iter;",
+ " if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {",
+ " print(\"nothing selected\\n\");",
+ " return;",
+ " }",
+ "",
+ " ",
+ " // add the directory..",
+ " ",
+ " ",
+ " GLib.Value val;",
+ " mod.get_value(iter,0, out val);",
+ " var fn = (string) val;",
+ " ",
+ " print(\"remove: %s\\n\", fn);",
+ " if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {",
+ " print(\"remove failed\");",
+ " }",
+ " _this.default_directory_tree_store.load();",
+ "}"
+ ]
},
- "* pack" : "add",
- "xtype" : "MenuItem",
- "$ xns" : "Gtk",
- "utf8 label" : "Remove File/Directory"
+ "utf8 label" : "Remove File/Directory",
+ "xtype" : "MenuItem"
}
- ]
+ ],
+ "xtype" : "Menu"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
}
- ]
+ ],
+ "xtype" : "Paned"
}
- ]
+ ],
+ "xtype" : "Box"
},
{
- "gint position" : 300,
- "* pack" : "append_page,_this.label_targets.el",
- "xtype" : "Paned",
"$ xns" : "Gtk",
+ "* pack" : "append_page,_this.label_targets.el",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "gint position" : 300,
"items" : [
{
- "* init" : "{ \nthis.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n\n}\n",
- "* pack" : "add1",
- "xtype" : "ScrolledWindow",
"$ xns" : "Gtk",
+ "* init" : [
+ "{ ",
+ "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ "",
+ "}",
+ ""
+ ],
+ "* pack" : "add1",
"items" : [
{
- "id" : "targets_tree_menu",
- "xtype" : "Menu",
- "* pack" : "add",
"$ xns" : "Gtk",
+ "* pack" : "add",
+ "id" : "targets_tree_menu",
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "add",
"listeners" : {
- "activate" : "() => {\n \n if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {\n return;\n }\n \n // add the directory..\n \n _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));\n _this.targets_tree_store.load();\n}"
+ "activate" : [
+ "() => {",
+ " ",
+ " if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {",
+ " return;",
+ " }",
+ " ",
+ " // add the directory..",
+ " ",
+ " _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));",
+ " _this.targets_tree_store.load();",
+ "}"
+ ]
},
- "* pack" : "add",
- "xtype" : "MenuItem",
- "$ xns" : "Gtk",
- "utf8 label" : "Add Compile Target"
+ "utf8 label" : "Add Compile Target",
+ "xtype" : "MenuItem"
},
{
+ "$ xns" : "Gtk",
"* pack" : "add",
- "xtype" : "SeparatorMenuItem",
- "$ xns" : "Gtk"
+ "xtype" : "SeparatorMenuItem"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "add",
"listeners" : {
- "activate" : "() => {\n \n //\n Gtk.TreeModel mod;\n Gtk.TreeIter iter;\n if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {\n print(\"nothing selected\\n\");\n return;\n }\n\n \n // add the directory..\n \n \n GLib.Value val;\n mod.get_value(iter,0, out val);\n var fn = (string) val;\n \n print(\"remove: %s\\n\", fn);\n if (!_this.project.compilegroups.unset(fn)) {\n print(\"remove failed\");\n }\n _this.targets_tree_store.load();\n}"
+ "activate" : [
+ "() => {",
+ " ",
+ " //",
+ " Gtk.TreeModel mod;",
+ " Gtk.TreeIter iter;",
+ " if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {",
+ " print(\"nothing selected\\n\");",
+ " return;",
+ " }",
+ "",
+ " ",
+ " // add the directory..",
+ " ",
+ " ",
+ " GLib.Value val;",
+ " mod.get_value(iter,0, out val);",
+ " var fn = (string) val;",
+ " ",
+ " print(\"remove: %s\\n\", fn);",
+ " if (!_this.project.compilegroups.unset(fn)) {",
+ " print(\"remove failed\");",
+ " }",
+ " _this.targets_tree_store.load();",
+ "}"
+ ]
},
- "* pack" : "add",
- "xtype" : "MenuItem",
- "$ xns" : "Gtk",
- "utf8 label" : "Remove Target"
+ "utf8 label" : "Remove Target",
+ "xtype" : "MenuItem"
}
- ]
+ ],
+ "xtype" : "Menu"
},
{
- "listeners" : {
- "button_press_event" : " ( ev) => {\n //console.log(\"button press?\");\n \n \n if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {\n //print(\"click\" + ev.type);\n return false;\n }\n //Gtk.TreePath res;\n //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n // return true;\n //}\n \n // this.el.get_selection().select_path(res);\n \n //if (!this.get('/LeftTreeMenu').el) { \n // this.get('/LeftTreeMenu').init(); \n // }\n \n _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());\n _this.targets_tree_menu.el.show_all();\n _this.targets_tree_menu.el.popup(null, null, null, 3, ev.time);\n // print(\"click:\" + res.path.to_string());\n return true;\n}",
- "cursor_changed" : " ( ) => {\n\n if (this.cursor != \"\") {\n // save the values..\n }\n \n // load the new values.\n \n\n Gtk.TreeModel mod;\n Gtk.TreeIter iter;\n if (!this.el.get_selection().get_selected(out mod, out iter)) {\n print(\"nothing selected\\n\");\n // should disable the right hand side..\n _this.set_vbox.el.hide();\n return;\n }\n _this.set_vbox.el.show();\n \n // add the directory..\n \n \n GLib.Value val;\n mod.get_value(iter,0, out val);\n var fn = (string) val;\n \n this.cursor = fn;\n var cg = _this.project.compilegroups.get(fn);\n \n _this.build_pack_target.el.set_text(cg.target_bin);\n _this.build_compile_flags.el.set_text(cg.compile_flags);\n\t\t_this.build_execute_args.el.set_text(cg.execute_args);\n \n _this.set_vbox.cgroup = cg;\n _this.files_tree_store.update();\n \n // load the srouces\n \n\n }"
- },
- "id" : "targets_tree",
"# string cursor" : "",
- "* pack" : "add",
- "xtype" : "TreeView",
"$ xns" : "Gtk",
+ "* pack" : "add",
+ "id" : "targets_tree",
"items" : [
{
- "id" : "targets_tree_store",
+ "$ columns" : [
+ " typeof(string), // 0 key type",
+ " typeof(string) // ??",
+ " "
+ ],
+ "$ n_columns" : 2,
+ "$ xns" : "Gtk",
"* pack" : "set_model",
+ "id" : "targets_tree_store",
"xtype" : "ListStore",
- "$ n_columns" : 2,
- "| void load" : "() {\n \n this.el.clear();\n \n \n var cg = _this.project.compilegroups;\n \n _this.targets_tree.cursor = \"\";\n Gtk.TreeIter citer;\n var iter = cg.map_iterator();\n while(iter.next()) {\n var key = iter.get_key();\n if (key == \"_default_\") {\n continue;\n }\n \n this.el.append(out citer); \n \n this.el.set_value(citer, 0, key ); // title \n //this.el.set_value(citer, 1, items.get(i) );\n };\n this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n _this.set_vbox.el.hide();\n}\n",
- "$ columns" : " typeof(string), // 0 key type\n typeof(string) // ??\n ",
- "$ xns" : "Gtk"
+ "| void load" : [
+ "() {",
+ " ",
+ " this.el.clear();",
+ " ",
+ " ",
+ " var cg = _this.project.compilegroups;",
+ " ",
+ " _this.targets_tree.cursor = \"\";",
+ " Gtk.TreeIter citer;",
+ " var iter = cg.map_iterator();",
+ " while(iter.next()) {",
+ " var key = iter.get_key();",
+ " if (key == \"_default_\") {",
+ " continue;",
+ " }",
+ " ",
+ " this.el.append(out citer); ",
+ " ",
+ " this.el.set_value(citer, 0, key ); // title ",
+ " //this.el.set_value(citer, 1, items.get(i) );",
+ " };",
+ " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " _this.set_vbox.el.hide();",
+ "}",
+ ""
+ ]
},
{
- "utf8 title" : "name",
- "* init" : " {\n this.el.add_attribute(_this.targets_render.el , \"text\", 0 );\n }",
+ "$ xns" : "Gtk",
+ "* init" : [
+ " {",
+ " this.el.add_attribute(_this.targets_render.el , \"text\", 0 );",
+ " }"
+ ],
"* pack" : "append_column",
- "xtype" : "TreeViewColumn",
"gboolean resizable" : true,
- "$ xns" : "Gtk",
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false",
+ "gboolean editable" : true,
+ "id" : "targets_render",
"listeners" : {
- "edited" : " (path, newtext) => {\n \n Gtk.TreeIter iter;\n _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n GLib.Value gval;\n _this.targets_tree_store.el.get_value(iter,0, out gval);\n var oldval = (string)gval;\n if (oldval == newtext) {\n return;\n }\n var cg = _this.project.compilegroups.get(oldval);\n cg.name = newtext;\n _this.project.compilegroups.unset(oldval);\n _this.project.compilegroups.set(newtext, cg);\n _this.targets_tree_store.load();\n }"
+ "edited" : [
+ " (path, newtext) => {",
+ " ",
+ " Gtk.TreeIter iter;",
+ " _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
+ " GLib.Value gval;",
+ " _this.targets_tree_store.el.get_value(iter,0, out gval);",
+ " var oldval = (string)gval;",
+ " if (oldval == newtext) {",
+ " return;",
+ " }",
+ " var cg = _this.project.compilegroups.get(oldval);",
+ " cg.name = newtext;",
+ " _this.project.compilegroups.unset(oldval);",
+ " _this.project.compilegroups.set(newtext, cg);",
+ " _this.targets_tree_store.load();",
+ " }"
+ ]
},
- "id" : "targets_render",
- "* pack" : "pack_start,false",
- "xtype" : "CellRendererText",
- "$ xns" : "Gtk",
- "gboolean editable" : true
+ "xtype" : "CellRendererText"
}
- ]
+ ],
+ "utf8 title" : "name",
+ "xtype" : "TreeViewColumn"
}
- ]
+ ],
+ "listeners" : {
+ "button_press_event" : [
+ " ( ev) => {",
+ " //console.log(\"button press?\");",
+ " ",
+ " ",
+ " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
+ " //print(\"click\" + ev.type);",
+ " return false;",
+ " }",
+ " //Gtk.TreePath res;",
+ " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
+ " // return true;",
+ " //}",
+ " ",
+ " // this.el.get_selection().select_path(res);",
+ " ",
+ " //if (!this.get('/LeftTreeMenu').el) { ",
+ " // this.get('/LeftTreeMenu').init(); ",
+ " // }",
+ " ",
+ " _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());",
+ " _this.targets_tree_menu.el.show_all();",
+ " _this.targets_tree_menu.el.popup(null, null, null, 3, ev.time);",
+ " // print(\"click:\" + res.path.to_string());",
+ " return true;",
+ "}"
+ ],
+ "cursor_changed" : [
+ " ( ) => {",
+ "",
+ " if (this.cursor != \"\") {",
+ " // save the values..",
+ " }",
+ " ",
+ " // load the new values.",
+ " ",
+ "",
+ " Gtk.TreeModel mod;",
+ " Gtk.TreeIter iter;",
+ " if (!this.el.get_selection().get_selected(out mod, out iter)) {",
+ " print(\"nothing selected\\n\");",
+ " // should disable the right hand side..",
+ " _this.set_vbox.el.hide();",
+ " return;",
+ " }",
+ " _this.set_vbox.el.show();",
+ " ",
+ " // add the directory..",
+ " ",
+ " ",
+ " GLib.Value val;",
+ " mod.get_value(iter,0, out val);",
+ " var fn = (string) val;",
+ " ",
+ " this.cursor = fn;",
+ " var cg = _this.project.compilegroups.get(fn);",
+ " ",
+ " _this.build_pack_target.el.set_text(cg.target_bin);",
+ " _this.build_compile_flags.el.set_text(cg.compile_flags);",
+ "\t\t_this.build_execute_args.el.set_text(cg.execute_args);",
+ " ",
+ " _this.set_vbox.cgroup = cg;",
+ " _this.files_tree_store.update();",
+ " ",
+ " // load the srouces",
+ " ",
+ "",
+ " }"
+ ]
+ },
+ "xtype" : "TreeView"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
},
{
- "id" : "set_vbox",
- "* pack" : "add2",
- "xtype" : "Box",
- "gboolean homogeneous" : false,
- "$ xns" : "Gtk",
"# Project.GtkValaSettings cgroup" : "null",
+ "$ xns" : "Gtk",
+ "* pack" : "add2",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "gboolean homogeneous" : false,
+ "id" : "set_vbox",
"items" : [
{
- "xtype" : "Label",
- "* pack" : "pack_start,false,false,0",
"$ xns" : "Gtk",
- "utf8 label" : "target filename"
+ "* pack" : "pack_start,false,false,0",
+ "utf8 label" : "target filename",
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
+ "id" : "build_pack_target",
"listeners" : {
- "changed" : "() => {\n if (_this.targets_tree.cursor.length < 1) {\n return;\n }\n _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;\n}"
+ "changed" : [
+ "() => {",
+ " if (_this.targets_tree.cursor.length < 1) {",
+ " return;",
+ " }",
+ " _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;",
+ "}"
+ ]
},
- "id" : "build_pack_target",
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Entry",
- "$ xns" : "Gtk"
+ "xtype" : "Entry"
},
{
- "xtype" : "Label",
- "* pack" : "pack_start,false,false,0",
"$ xns" : "Gtk",
- "utf8 label" : "compile flags"
+ "* pack" : "pack_start,false,false,0",
+ "utf8 label" : "compile flags",
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
+ "id" : "build_compile_flags",
"listeners" : {
- "changed" : "() => {\n if (_this.targets_tree.cursor.length < 1) {\n return;\n }\n _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;\n}"
+ "changed" : [
+ "() => {",
+ " if (_this.targets_tree.cursor.length < 1) {",
+ " return;",
+ " }",
+ " _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;",
+ "}"
+ ]
},
- "id" : "build_compile_flags",
- "* pack" : "pack_start,false,false,0",
- "xtype" : "Entry",
- "$ xns" : "Gtk"
+ "xtype" : "Entry"
},
{
- "xtype" : "Label",
- "* pack" : "pack_start,false,false,0",
"$ xns" : "Gtk",
- "utf8 label" : "test argments - when run after a build"
+ "* pack" : "pack_start,false,false,0",
+ "utf8 label" : "test argments - when run after a build",
+ "xtype" : "Label"
},
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false,false,0",
+ "id" : "build_execute_args",
"listeners" : {
- "changed" : "() => {\n if (_this.targets_tree.cursor.length < 1) {\n return;\n }\n _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;\n}"
+ "changed" : [
+ "() => {",
+ " if (_this.targets_tree.cursor.length < 1) {",
+ " return;",
+ " }",
+ " _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;",
+ "}"
+ ]
},
- "id" : "build_execute_args",
"string placeholder_text" : "eg. -f somefile -g ",
- "xtype" : "Entry",
- "* pack" : "pack_start,false,false,0",
- "$ xns" : "Gtk"
+ "xtype" : "Entry"
},
{
- "xtype" : "Label",
- "* pack" : "pack_start,false,false,0",
"$ xns" : "Gtk",
- "utf8 label" : "Files to compile"
+ "* pack" : "pack_start,false,false,0",
+ "utf8 label" : "Files to compile",
+ "xtype" : "Label"
},
{
- "* pack" : "pack_start,true,true,0",
- "xtype" : "ScrolledWindow",
"$ xns" : "Gtk",
+ "* pack" : "pack_start,true,true,0",
"items" : [
{
- "xtype" : "TreeView",
- "* pack" : "add",
- "string id" : "files_tree",
"$ xns" : "Gtk",
+ "* pack" : "add",
"items" : [
{
- "id" : "files_tree_store",
- "* pack" : "set_model",
- "xtype" : "ListStore",
- "| void updateDir" : "(string dname, bool bval) {\n \n Gtk.TreeIter citer;\n\n var cg = _this.set_vbox.cgroup;\n for(var i =0 ; i < this.el.iter_n_children(null); i++) {\n this.el.iter_nth_child(out citer,null,i);\n\n GLib.Value val;\n this.el.get_value(citer,0, out val);\n var fn = (string) val;\n \n if ( Path.get_dirname (fn) == dname) {\n \n this.el.set_value(citer, 3, bval ); // checked \n \n \n \n if (!bval) {\n // renive\n if (cg.sources.contains(fn)) {\n cg.sources.remove(fn);\n }\n } else {\n if (!cg.sources.contains(fn)) {\n cg.sources.add(fn);\n }\n }\n \n \n }\n }\n\n}\n",
+ "$ columns" : [
+ " typeof(string), // 0 file name",
+ " typeof(string), // 0 basename",
+ " typeof(string), // type (dir orfile)",
+ " typeof(bool) // is checked.",
+ " "
+ ],
"$ n_columns" : 4,
- "| void load" : "() {\n \n this.el.clear();\n \n \n var def = _this.project.compilegroups.get(\"_default_\");\n var items = def.sources;\n \n \n \n \n \n Gtk.TreeIter citer;\n\n for(var i =0 ; i < items.size; i++) {\n \n var files = _this.project.filesForCompile(items.get(i), false);\n if (files.size < 1) {\n continue;\n }\n \n this.el.append(out citer); \n \n this.el.set_value(citer, 0, items.get(i) ); // title \n this.el.set_value(citer, 1, \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + \n GLib.Markup.escape_text(items.get(i)) + \"</span>\"\n ); // title \n print(\"ADD item %s\", items.get(i));\n this.el.set_value(citer, 2, \"dir\"); // type \n this.el.set_value(citer, 3, false ); // checked \n\n \n \n for(var j =0 ; j < files.size; j++) {\n this.el.append(out citer); \n print(\"ADD item %s\", files.get(j));\n this.el.set_value(citer, 0, files.get(j) ); // title \n this.el.set_value(citer, 1, GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title \n this.el.set_value(citer, 2, \"file\"); // type \n this.el.set_value(citer, 3, false ); // checked \n\n }\n \n \n //this.el.set_value(citer, 1, items.get(i) );\n }\n this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n \n}\n ",
- "$ columns" : " typeof(string), // 0 file name\n typeof(string), // 0 basename\n typeof(string), // type (dir orfile)\n typeof(bool) // is checked.\n ",
"$ xns" : "Gtk",
- "| void update" : "() {\n\n\n Gtk.TreeIter citer;\n\n for(var i =0 ; i < this.el.iter_n_children(null); i++) {\n this.el.iter_nth_child(out citer,null,i);\n\n GLib.Value val;\n this.el.get_value(citer,0, out val);\n var fn = (string) val;\n \n var active = false;\n if (_this.set_vbox.cgroup.sources.contains(fn)) {\n active = true;\n }\n \n this.el.set_value(citer, 3, active ); // checked \n }\n\n\n}\n"
+ "* pack" : "set_model",
+ "id" : "files_tree_store",
+ "xtype" : "ListStore",
+ "| void load" : [
+ "() {",
+ " ",
+ " this.el.clear();",
+ " ",
+ " ",
+ " var def = _this.project.compilegroups.get(\"_default_\");",
+ " var items = def.sources;",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " Gtk.TreeIter citer;",
+ "",
+ " for(var i =0 ; i < items.size; i++) {",
+ " ",
+ " var files = _this.project.filesForCompile(items.get(i), false);",
+ " if (files.size < 1) {",
+ " continue;",
+ " }",
+ " ",
+ " this.el.append(out citer); ",
+ " ",
+ " this.el.set_value(citer, 0, items.get(i) ); // title ",
+ " this.el.set_value(citer, 1, \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + ",
+ " GLib.Markup.escape_text(items.get(i)) + \"</span>\"",
+ " ); // title ",
+ " print(\"ADD item %s\", items.get(i));",
+ " this.el.set_value(citer, 2, \"dir\"); // type ",
+ " this.el.set_value(citer, 3, false ); // checked ",
+ "",
+ " ",
+ " ",
+ " for(var j =0 ; j < files.size; j++) {",
+ " this.el.append(out citer); ",
+ " print(\"ADD item %s\", files.get(j));",
+ " this.el.set_value(citer, 0, files.get(j) ); // title ",
+ " this.el.set_value(citer, 1, GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title ",
+ " this.el.set_value(citer, 2, \"file\"); // type ",
+ " this.el.set_value(citer, 3, false ); // checked ",
+ "",
+ " }",
+ " ",
+ " ",
+ " //this.el.set_value(citer, 1, items.get(i) );",
+ " }",
+ " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " ",
+ "}",
+ " "
+ ],
+ "| void update" : [
+ "() {",
+ "",
+ "",
+ " Gtk.TreeIter citer;",
+ "",
+ " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
+ " this.el.iter_nth_child(out citer,null,i);",
+ "",
+ " GLib.Value val;",
+ " this.el.get_value(citer,0, out val);",
+ " var fn = (string) val;",
+ " ",
+ " var active = false;",
+ " if (_this.set_vbox.cgroup.sources.contains(fn)) {",
+ " active = true;",
+ " }",
+ " ",
+ " this.el.set_value(citer, 3, active ); // checked ",
+ " }",
+ "",
+ "",
+ "}",
+ ""
+ ],
+ "| void updateDir" : [
+ "(string dname, bool bval) {",
+ " ",
+ " Gtk.TreeIter citer;",
+ "",
+ " var cg = _this.set_vbox.cgroup;",
+ " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
+ " this.el.iter_nth_child(out citer,null,i);",
+ "",
+ " GLib.Value val;",
+ " this.el.get_value(citer,0, out val);",
+ " var fn = (string) val;",
+ " ",
+ " if ( Path.get_dirname (fn) == dname) {",
+ " ",
+ " this.el.set_value(citer, 3, bval ); // checked ",
+ " ",
+ " ",
+ " ",
+ " if (!bval) {",
+ " // renive",
+ " if (cg.sources.contains(fn)) {",
+ " cg.sources.remove(fn);",
+ " }",
+ " } else {",
+ " if (!cg.sources.contains(fn)) {",
+ " cg.sources.add(fn);",
+ " }",
+ " }",
+ " ",
+ " ",
+ " }",
+ " }",
+ "",
+ "}",
+ ""
+ ]
},
{
- "utf8 title" : "name",
- "* init" : "\n this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae\n \n/* this.el.add_attribute(_this.files_render.el , \"markup\", 2 );\n*/",
+ "$ xns" : "Gtk",
+ "* init" : [
+ "",
+ " this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae",
+ " ",
+ "/* this.el.add_attribute(_this.files_render.el , \"markup\", 2 );",
+ "*/"
+ ],
"* pack" : "append_column",
- "xtype" : "TreeViewColumn",
"gboolean resizable" : true,
- "$ xns" : "Gtk",
"items" : [
{
- "id" : "files_render",
- "xtype" : "CellRendererText",
+ "$ xns" : "Gtk",
"* pack" : "pack_start,false",
- "$ xns" : "Gtk"
+ "id" : "files_render",
+ "xtype" : "CellRendererText"
}
- ]
+ ],
+ "utf8 title" : "name",
+ "xtype" : "TreeViewColumn"
},
{
- "utf8 title" : "use",
- "* init" : "{\n this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );\n }",
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );",
+ " }"
+ ],
"* pack" : "append_column",
- "xtype" : "TreeViewColumn",
"gboolean resizable" : false,
- "$ xns" : "Gtk",
"gint fixed_width" : 50,
"items" : [
{
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,false",
+ "gboolean activatable" : true,
+ "id" : "files_render_use",
"listeners" : {
- "toggled" : "( path_string) => { \n\n\n\n var m = _this.files_tree_store.el;\n Gtk.TreeIter iter;\n Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n m.get_iter (out iter, path);\n GLib.Value val;\n m.get_value(iter, 3, out val);\n m.set_value(iter, 3, ((bool) val) ? false :true); \n \n // type.\n GLib.Value ftval; \n m.get_value(iter, 2, out ftval);\n var ftype = (string)ftval; \n \n // full name... \n GLib.Value fval; \n m.get_value(iter, 0, out fval);\n var fn = (string)fval;\n \n \n var cg = _this.set_vbox.cgroup;\n // what's the sleected target?\n // update the list..\n // if ftype is a dir == then toggle all the bellow.\n \n if (ftype == \"dir\") {\n _this.files_tree_store.updateDir(fn, ((bool) val) ? false :true);\n }\n \n // if ftype is a file .. see if all the files in that directory are check and check the dir.\n\n \n if ((bool)val) {\n // renive\n cg.sources.remove(fn);\n } else {\n cg.sources.add(fn);\n }\n \n}"
+ "toggled" : [
+ "( path_string) => { ",
+ "",
+ "",
+ "",
+ " var m = _this.files_tree_store.el;",
+ " Gtk.TreeIter iter;",
+ " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
+ " m.get_iter (out iter, path);",
+ " GLib.Value val;",
+ " m.get_value(iter, 3, out val);",
+ " m.set_value(iter, 3, ((bool) val) ? false :true); ",
+ " ",
+ " // type.",
+ " GLib.Value ftval; ",
+ " m.get_value(iter, 2, out ftval);",
+ " var ftype = (string)ftval; ",
+ " ",
+ " // full name... ",
+ " GLib.Value fval; ",
+ " m.get_value(iter, 0, out fval);",
+ " var fn = (string)fval;",
+ " ",
+ " ",
+ " var cg = _this.set_vbox.cgroup;",
+ " // what's the sleected target?",
+ " // update the list..",
+ " // if ftype is a dir == then toggle all the bellow.",
+ " ",
+ " if (ftype == \"dir\") {",
+ " _this.files_tree_store.updateDir(fn, ((bool) val) ? false :true);",
+ " }",
+ " ",
+ " // if ftype is a file .. see if all the files in that directory are check and check the dir.",
+ "",
+ " ",
+ " if ((bool)val) {",
+ " // renive",
+ " cg.sources.remove(fn);",
+ " } else {",
+ " cg.sources.add(fn);",
+ " }",
+ " ",
+ "}"
+ ]
},
- "id" : "files_render_use",
- "* pack" : "pack_start,false",
- "xtype" : "CellRendererToggle",
- "$ xns" : "Gtk",
- "gboolean activatable" : true
+ "xtype" : "CellRendererToggle"
}
- ]
+ ],
+ "utf8 title" : "use",
+ "xtype" : "TreeViewColumn"
}
- ]
+ ],
+ "string id" : "files_tree",
+ "xtype" : "TreeView"
}
- ]
+ ],
+ "xtype" : "ScrolledWindow"
}
- ]
+ ],
+ "xtype" : "Box"
}
- ]
+ ],
+ "xtype" : "Paned"
}
- ]
+ ],
+ "xtype" : "Notebook"
}
+ ],
+ "string id" : "ValaProjectSettings",
+ "xtype" : "Box",
+ "| void save" : [
+ "() {",
+ " this.project.writeConfig(); ",
+ "}"
+ ],
+ "| void show" : [
+ "(Project.Gtk project) {",
+ " ",
+ " ",
+ " print(\"ValaProjectSettings show\\n\");",
+ " ",
+ " this.project= project;",
+ "",
+ " this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;",
+ " ",
+ " this.default_directory_tree_store.load(); ",
+ " this.default_packages_tree_store.load(); ",
+ " this.targets_tree_store.load();",
+ " this.files_tree_store.load();",
+ "",
+ "}",
+ ""
]
}
- ]
+ ],
+ "modOrder" : "",
+ "name" : "ValaProjectSettings",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaProjectSettings.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
}
public void save () {
- this.project.writeConfig();
+ this.project.writeConfig();
}
public class Xcls_Notebook2 : Object
{
"@ bool stop_editor" : "()",
"@ void changed" : "()",
"@ void show_add_props" : "(string type)",
- "@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, string type, string key)",
+ "@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop)",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"id" : "LeftProps",
"items" : [
{
"$ xns" : "Gtk",
"* pack" : "add",
- "int margin_left" : 5,
- "int margin_right" : 5,
+ "int margin_end" : 5,
+ "int margin_start" : 5,
"string label" : "Add:",
"xtype" : "Label"
},
+ {
+ "$ tooltip_text" : "\"Add Property\"",
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "bool always_show_image" : true,
+ "bool hexpand" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "set_image",
+ "utf8 icon_name" : "format-justify-left",
+ "xtype" : "Image"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " _this.main_window.windowstate.showProps(",
+ " \t_this.view.el, ",
+ " \t\tJsRender.NodePropType.PROP",
+ "\t);",
+ " ",
+ "}"
+ ]
+ },
+ "string label" : "Property",
+ "xtype" : "Button"
+ },
+ {
+ "$ tooltip_text" : "\"Add Event Code\"",
+ "$ xns" : "Gtk",
+ "* pack" : "add",
+ "bool always_show_image" : true,
+ "bool hexpand" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "set_image",
+ "utf8 icon_name" : "appointment-new",
+ "xtype" : "Image"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " ",
+ " _this.main_window.windowstate.showProps(",
+ " \t\t_this.view.el, ",
+ " \t\tJsRender.NodePropType.LISTENER",
+ "\t);",
+ "",
+ " ",
+ "}"
+ ]
+ },
+ "string label" : "Event",
+ "xtype" : "Button"
+ },
{
"$ xns" : "Gtk",
"* pack" : "add",
+ "bool always_show_image" : true,
"bool hexpand" : true,
"items" : [
{
"listeners" : {
"activate" : [
" () => {",
- " _this.addProp( \"prop\", \"id\", \"\", \"\");",
+ " \t// is this userdef or special??",
+ " _this.addProp( new JsRender.NodeProp.prop(\"id\") );",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) => {",
- "",
- " _this.addProp( \"prop\", \"pack\",\"add\", \"*\");",
+ "// is this userdef?",
+ " _this.addProp( new JsRender.NodeProp.special(\"pack\", \"add\") );",
"}"
]
},
"activate" : [
" ( ) => {",
"",
- " _this.addProp( \"prop\", \"ctor\",\"\", \"*\");",
+ " _this.addProp( new JsRender.NodeProp.special(\"ctor\") );",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) => {",
+ " _this.addProp( new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) );",
"",
- " _this.addProp( \"prop\", \"init\", \"{\\n\\n}\\n\", \"*\" );",
"}"
]
},
"listeners" : {
"activate" : [
" () => {",
- " _this.addProp( \"prop\", \"cms-id\", \"\", \"string\");",
+ " ",
+ " _this.addProp( new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) );",
+ "",
+ " ",
+ " ",
"}"
]
},
"label" : "String",
"listeners" : {
"activate" : [
- " (self) => {",
+ "(self) => {",
"",
- " _this.addProp( \"prop\", \"XXXX\", \"\",\"# string\");",
+ "\t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"\", \"string\", \"\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
"",
"}"
]
"listeners" : {
"activate" : [
" ( ) =>{",
- "",
- " _this.addProp(\"prop\", \"XXX\", \"0\", \"int\");",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"\", \"int\", \"0\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ " ",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) =>{",
- "",
- " _this.addProp( \"prop\", \"XXX\", \"true\", \"bool\");",
+ " ",
+ " \t",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"\", \"bool\", \"true\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t); ",
+ " ",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) =>{",
- "",
- " _this.addProp(\"prop\", \"XXXX\", \"function() { }\", \"| function\");",
+ " ",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ " ",
+ " ",
"}"
]
},
"activate" : [
" ( ) =>{",
"",
- " _this.addProp( \"prop\", \"XXXX\", \"() {\\n\\n}\\n\", \"| void\");",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t); ",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) =>{",
- "",
- " _this.addProp( \"prop\", \"XXXX\", \"()\", \"@ void\");",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t); ",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) =>{",
+ " \t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ "",
"",
- " _this.addProp(\"prop\", \"flexy:if\", \"value_or_condition\", \"string\");",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) =>{",
+ " \t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
"",
- " _this.addProp(\"prop\", \"flexy:include\", \"name_of_file.html\", \"string\");",
+ " ",
"}"
]
},
"listeners" : {
"activate" : [
" ( ) =>{",
+ " ",
+ " \t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"flexy:foreach\", \"string\", \"array,key,value\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
"",
- " _this.addProp(\"prop\", \"flexy:foreach\", \"array,key,value\", \"string\");",
+ " ",
"}"
]
},
},
"string label" : "Other",
"xtype" : "Button"
- },
- {
- "$ tooltip_text" : "\"Add Property\"",
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
- "bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "format-justify-left",
- "xtype" : "Image"
- }
- ],
- "listeners" : {
- "clicked" : [
- " ( ) => {",
- " ",
- " _this.main_window.windowstate.showProps(this.el, \"props\");",
- " ",
- "",
- "}"
- ]
- },
- "string label" : "Property",
- "xtype" : "Button"
- },
- {
- "$ tooltip_text" : "\"Add Event Code\"",
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
- "bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "appointment-new",
- "xtype" : "Image"
- }
- ],
- "listeners" : {
- "clicked" : [
- " ( ) => {",
- " ",
- " ",
- " _this.main_window.windowstate.showProps(this.el, \"signals\");",
- "",
- " ",
- "}"
- ]
- },
- "string label" : "Event",
- "xtype" : "Button"
}
],
"xtype" : "Box"
" var description = new Pango.FontDescription();",
" description.set_size(10000);",
" this.el.override_font(description);",
+ " ",
"}",
""
],
" return;",
" }",
" var iter = new Gtk.TreeIter();",
+ " ",
+ " _this.setTreeIter(prop);",
" this.el.get_iter(iter, new Gtk.TreePath.from_string(this.activePath));",
" ",
" this.el.set_value(iter, 1, '' +str);",
""
],
"$ columns" : [
- " typeof(string), // 0 key type",
- " typeof(string), // 1 key",
- " typeof(string), // 2 key (display)",
- " typeof(string), // 3 value",
- " typeof(string), // 4 value (display)",
- " typeof(string), // 5 both (tooltip) ",
- " typeof(string) // 6 key (for sorting)",
- ""
- ],
- "$ toShort" : [
- "function(str) {",
- " var a = typeof(str) == 'string' ? str.split(\"\\n\") : [];",
- " return a.length > 1 ? a[0] + '....' : '' + str;",
- "}",
- ""
+ " typeof(JsRender.NodeProp), // 0 key type",
+ " typeof(string), // 1 display_key",
+ " typeof(string), // 2 display_value",
+ " typeof(string), // 3 display_tooltip",
+ " \t\ttypeof(string) // 4 sortable value",
+ "/*",
+ " \t0, prop,",
+ " \t1, prop.to_display_name(),",
+ " \t2, dis_val.",
+ " 3, \"<tt>\" + GLib.Markup.escape_text(key + \" \" +kvalue) + \"</tt>\",",
+ " 4, \"0 \" + prop.name",
+ " ",
+ " ); ",
+ " */"
],
"$ xns" : "Gtk",
"* pack" : "set_model",
"id" : "model",
- "n_columns" : 7,
+ "n_columns" : 5,
"xtype" : "TreeStore"
},
{
"$ resizable" : true,
"$ xns" : "Gtk",
"* init" : [
- " this.el.add_attribute(_this.keyrender.el , \"markup\", 2 );",
- " this.el.add_attribute(_this.keyrender.el , \"text\", 1 );",
+ " this.el.add_attribute(_this.keyrender.el , \"markup\", 1 ); // 1 is the key.",
+ " //this.el.add_attribute(_this.keyrender.el , \"text\", 1 );",
" "
],
"* pack" : "append_column",
"$ xns" : "Gtk",
"* pack" : "pack_start,false",
"id" : "keyrender",
- "listeners" : {
- "edited" : [
- " (path, newtext) => {",
- " GLib.debug(\"Keyrender - signal:edited\\n\");",
- " ",
- " this.el.editable = false;",
- " ",
- " ",
- "",
- " Gtk.TreeIter iter;",
- " _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
- " GLib.Value gval;",
- " ",
- " _this.model.el.get_value(iter,1, out gval);",
- " var oldval = (string)gval;",
- " ",
- " _this.model.el.get_value(iter,0, out gval);",
- " var ktype = (string)gval;",
- " ",
- " _this.model.el.set_value(iter, 1, newtext);",
- " ",
- " if (oldval == newtext) {",
- " return;",
- " }",
- " ",
- " ",
- " GLib.debug(\"ktype: %s\\n\",ktype);",
- " switch(ktype) {",
- " case \"listener\":",
- " var ov = _this.node.listeners.get(oldval);",
- " _this.node.listeners.set(newtext, ov);",
- " _this.node.listeners.unset(oldval);",
- " ",
- " _this.updateIter(iter, ktype, newtext, ov);",
- " ",
- " break;",
- " case \"props\":",
- " var ov = _this.node.props.get(oldval);",
- " _this.node.props.set(newtext, ov);",
- " _this.node.props.unset(oldval);",
- " _this.updateIter(iter, ktype, newtext, ov);",
- " break;",
- " }",
- " _this.changed();",
- " ",
- "}"
- ],
- "editing_started" : [
- "( editable, path) => {",
- "",
- " Gtk.TreeIter iter;",
- " _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
- " GLib.Value gval;",
- " ",
- "",
- "",
- " // this.get('/LeftPanel.model').activePath = path;",
- " _this.model.el.get_value(iter,1, out gval);",
- " var val = (string)gval;",
- " ",
- " ((Gtk.Entry)editable).set_text(val); ",
- "}"
- ]
- },
"xtype" : "CellRendererText"
}
],
- "title" : "Name",
+ "title" : "Property",
"xtype" : "TreeViewColumn"
},
{
"* init" : [
"{",
"\t",
- "\t// typeof(string), // 0 key type",
- " // typeof(string), // 1 key",
- " // typeof(string), // 2 key (display)",
- " // typeof(string), // 3 value",
- " // typeof(string) // 4 value (display)",
+ " ",
"",
"\t",
- "\tthis.el.add_attribute(_this.valrender.el , \"text\", 4 );",
- "\t//this.el.add_attribute(_this.valrender.el , \"sensitive\", 4 );",
- "\t//this.el.add_attribute(this.items[0].el , 'editable', 3 );",
- " // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);",
- "",
- " //\tthis.get('/LeftPanel').editableColumn= this;",
+ "\tthis.el.add_attribute(_this.valrender.el , \"text\", 2 );",
+ " ",
"}",
""
],
" GLib.debug(\"Valrender - signal:edited\\n\");",
" ",
" this.el.editable = false;",
- "/* ",
- " m.set(iter, ",
- " 0, \"listener\",",
- " 1, miter.get_key(),",
- " 2, \"<b>\" + miter.get_key() + \"</b>\",",
- " 3, miter.get_value(),",
- " 4, display_value(short);",
- " ); ",
- "",
- " */ ",
+ " ",
"",
" Gtk.TreeIter iter;",
" _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
" GLib.Value gval;",
" ",
" _this.model.el.get_value(iter,0, out gval);",
- " var ktype = (string)gval;",
- " ",
- " ",
- " _this.model.el.get_value(iter,3, out gval);",
- " var oldval = (string)gval;",
- " ",
- " _this.model.el.get_value(iter,1, out gval);",
- " var key = (string)gval;",
- " ",
- " ",
- " ",
- " switch(ktype) {",
- " case \"listener\":",
- " _this.node.listeners.set(key, newtext);",
- " _this.updateIter(iter,ktype,key,newtext);",
- " break;",
- " case \"props\":",
- " _this.node.props.set(key,newtext);",
- " _this.updateIter(iter,ktype, key,newtext); ",
- " break;",
- " }",
- "// _this.load(_this.file,_this.node);",
- " _this.changed();",
+ " var prop = (JsRender.NodeProp)gval;",
+ " prop.val = newtext;",
+ " _this.updateIter(iter,prop);",
+ " _this.changed();",
" ",
"}"
],
"",
" ",
" // this.get('/LeftPanel.model').activePath = path;",
- " _this.model.el.get_value(iter,3, out gval);",
+ " _this.model.el.get_value(iter,0, out gval);",
" ",
"",
- " var val = (string)gval;",
+ " var prop = (JsRender.NodeProp)gval;",
" var combo = (Gtk.ComboBox)editable;",
"",
" var entry = (Gtk.Entry) combo.get_child(); ",
- " entry.set_text(val);",
+ " entry.set_text(prop.val);",
" }",
" ",
"}"
"xtype" : "CellRendererCombo",
"| void setOptions" : [
"(string[] ar) {",
- " var m = _this.valrendermodel.el;",
- " m.clear();",
- " Gtk.TreeIter iret;",
+ "\tvar m = _this.valrendermodel.el;",
+ "\tm.clear();",
+ "\tGtk.TreeIter iret;",
" for (var i =0; i < ar.length; i++) {",
- " m.append(out iret);",
- " m.set_value(iret, 0, ar[i]);",
+ " m.append(out iret);",
+ " m.set_value(iret, 0, ar[i]);",
" }",
"",
"}"
"* pack" : false,
"id" : "ContextMenu",
"items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Edit (double click)",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " ",
- " var s = _this.view.el.get_selection();",
- " Gtk.TreeIter iter;",
- " Gtk.TreeModel mod;",
- " s.get_selected (out mod, out iter);",
- " ",
- " if (_this.view.popover == null) {",
- " \t\t _this.view.popover = new Xcls_PopoverProperty();",
- " \t\t _this.view.popover.mainwindow = _this.main_window;",
- " \t\t}",
- " \t\t",
- " ",
- " _this.before_edit();",
- " _this.stop_editor();",
- "\t ",
- " _this.keyrender.el.stop_editing(false);",
- " _this.keyrender.el.editable =false;",
- "",
- " _this.valrender.el.stop_editing(false);",
- " _this.valrender.el.editable =false;",
- " ",
- " ",
- "\tGLib.Value gvaltype, gval;",
- "\tmod.get_value(iter, 1 , out gval); // one is key..",
- "\t",
- " mod.get_value(iter,0, out gvaltype);",
- "",
- "\t_this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);",
- " ",
- " ",
- " ",
- " // _this.startEditingKey(model.get_path(iter));",
- "}"
- ]
- },
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "xtype" : "SeparatorMenuItem"
- },
{
"$ xns" : "Gtk",
"* pack" : "append",
" int cell_x;",
" int cell_y;",
" Gtk.TreePath path;",
+ " ",
+ " // event x /y are relative to the widget..",
" if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {",
" GLib.debug(\"nothing selected on click\");",
" GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
" }",
" ",
" ",
- " // double click on name..",
- " if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == \"Name\") { ",
- " // show popup!. ",
- " ",
- " if (this.popover == null) {",
- " \t\t this.popover = new Xcls_PopoverProperty();",
- " \t\t this.popover.mainwindow = _this.main_window;",
- " \t\t}",
- " \t\t",
- " ",
- " _this.before_edit();",
- " _this.stop_editor();",
- "\t\t ",
- " _this.keyrender.el.stop_editing(false);",
- " _this.keyrender.el.editable =false;",
- " ",
- " _this.valrender.el.stop_editing(false);",
- " _this.valrender.el.editable =false;",
- " Gtk.TreeIter iter;",
- " var mod = this.el.get_model();",
- "\t\t mod.get_iter (out iter, path);",
- "\t\t ",
- " ",
- "\t\tGLib.Value gvaltype, gval;",
- "\t\tmod.get_value(iter, 1 , out gval); // one is key..",
- "\t\t",
- "\t mod.get_value(iter,0, out gvaltype);",
- "",
- " this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);",
- " ",
- " // _this.startEditingKey(path); ",
+ " // single click on name..",
+ " //if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == \"Name\") { ",
+ " if (ev.button == 1 && col.title == \"Property\") { ",
+ " \t// need to shift down, as ev.y does not inclucde header apparently..",
+ " \t// or popover might be trying to do a central?",
+ " this.editPropertyDetails(path, (int) ev.y + 12); ",
" ",
" return false;",
" }",
"}"
]
},
- "tooltip_column" : 5,
- "xtype" : "TreeView"
+ "tooltip_column" : 3,
+ "xtype" : "TreeView",
+ "| void editPropertyDetails" : [
+ "(Gtk.TreePath path, int y) {",
+ "",
+ " ",
+ "\t",
+ "",
+ " _this.before_edit();",
+ " _this.stop_editor();",
+ "\t ",
+ " _this.keyrender.el.stop_editing(false);",
+ " _this.keyrender.el.editable =false;",
+ "",
+ " _this.valrender.el.stop_editing(false);",
+ " _this.valrender.el.editable =false;",
+ " Gtk.TreeIter iter;",
+ " var mod = this.el.get_model();",
+ "\t mod.get_iter (out iter, path);",
+ "\t ",
+ " ",
+ "\tGLib.Value gval;",
+ "",
+ " mod.get_value(iter,0, out gval);",
+ "",
+ " this.popover.show(_this.view.el, _this.node, (JsRender.NodeProp)gval, y);",
+ " ",
+ " ",
+ "}",
+ ""
+ ]
}
],
"xtype" : "ScrolledWindow"
"}"
],
"| void addProp" : [
- " (string in_type, string key, string value, string value_type) {",
+ " (JsRender.NodeProp prop) {",
" // info includes key, val, skel, etype..",
" //console.dump(info);",
" //type = info.type.toLowerCase();",
" //var data = this.toJS();",
" ",
- " var type = in_type == \"signals\" ? \"listener\" : in_type;",
- " ",
- " var fkey = (value_type.length > 0 ? value_type + \" \" : \"\") + key;",
+ " ",
+ " ",
" ",
- " if (type == \"listener\") {",
- " if (this.node.listeners.has_key(key)) {",
+ " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
+ " if (this.node.listeners.has_key(prop.name)) {",
" return;",
" }",
- " this.node.listeners.set(key,value);",
+ " this.node.listeners.set(prop.name,prop);",
" } else {",
" assert(this.node != null);",
" assert(this.node.props != null);",
- " if (this.node.props.has_key(fkey)) {",
+ " if (this.node.props.has_key(prop.to_index_key())) {",
" return;",
" }",
- " this.node.props.set(fkey,value);",
+ " this.node.props.set(prop.to_index_key(),prop);",
" }",
" ",
" ",
" ",
" this.model.el.foreach((model, path, iter) => {",
" GLib.Value gval;",
- " ",
" this.model.el.get_value(iter, 0 , out gval);",
- " if ((string)gval != type) {",
- " GLib.debug(\"not type: %s = %s\\n\", (string)gval , type);",
- " return false;",
- " }",
- " this.model.el.get_value(iter, 1 , out gval);",
- " if ((string)gval != fkey) {",
- " GLib.debug(\"not key: %s = %s\\n\", (string)gval , fkey);",
- " return false;",
+ " ",
+ " var iprop = (JsRender.NodeProp)gval;",
+ " if (iprop.to_index_key() != prop.to_index_key()) {",
+ " \treturn false; // continue?",
" }",
+ " ",
" // delay this?",
" GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {",
- " ",
+ " \t/*",
+ " \t\tif (prop.name == \"\") { // empty string for key name.",
+ " \t\t_this.view.editPropertyDetails(this.model.el.get_path(iter));",
+ " \t\treturn false;",
+ " \t}",
+ " \t*/",
+ " \t",
" this.startEditingValue(this.model.el.get_path(iter));",
" return false;",
" });",
"}",
""
],
- "| void before_edit" : [
- "()",
- "{",
- "",
- " GLib.debug(\"before edit - stop editing\\n\");",
- " ",
- " // these do not appear to trigger save...",
- " _this.keyrender.el.stop_editing(false);",
- " _this.keyrender.el.editable =false;",
- "",
- " _this.valrender.el.stop_editing(false);",
- " _this.valrender.el.editable =false; ",
- " ",
- " ",
- "// technicall stop the popup editor..",
- "",
- "}",
- ""
- ],
"| void deleteSelected" : [
" () {",
" ",
+ " this.stop_editor();",
+ " ",
" Gtk.TreeIter iter;",
" Gtk.TreeModel mod;",
" ",
" ",
" GLib.Value gval;",
" mod.get_value(iter, 0 , out gval);",
- " var type = (string)gval;",
- " ",
- " mod.get_value(iter, 1 , out gval);",
- " var key = (string)gval;",
+ " var prop = (JsRender.NodeProp)gval;",
" ",
- " switch(type) {",
- " case \"listener\":",
- " this.node.listeners.unset(key);",
+ " switch(prop.ptype) {",
+ " case JsRender.NodePropType.LISTENER:",
+ " this.node.listeners.unset(prop.to_index_key());",
" break;",
" ",
- " case \"props\":",
- " this.node.props.unset(key);",
+ " default:",
+ " this.node.props.unset(prop.to_index_key());",
" break;",
" }",
" this.load(this.file, this.node);",
"| void load" : [
"(JsRender.JsRender file, JsRender.Node? node) ",
"{",
+ "\t// not sure when to initialize this - we should do it on setting main window really. ",
+ " if (this.view.popover == null) {",
+ " \t\t this.view.popover = new Xcls_PopoverProperty();",
+ " \t\t this.view.popover.mainwindow = _this.main_window;",
+ "\t}",
+ " ",
+ " ",
+ " ",
+ " ",
" GLib.debug(\"load leftprops\\n\");",
" this.before_edit();",
" this.node = node;",
" //var provider = this.get('/LeftTree').getPaleteProvider();",
" Gtk.TreeIter iter;",
" ",
- " //typeof(string), // 0 key type",
- " //typeof(string), // 1 key",
- " //typeof(string), // 2 key (display)",
- " //typeof(string), // 3 value",
- " //typeof(string), // 4 value (display)",
- " //typeof(string), // 5 both (tooltip)",
+ " ",
" ",
" ",
" ",
" i++;",
" m.append(out iter,null);",
" ",
- " this.updateIter(iter, \"listener\", miter.get_key(), miter.get_value());",
+ " this.updateIter(iter, miter.get_value());",
" ",
" ",
" }",
" while(miter.next()) {",
" i++;",
" m.append(out iter,null);",
- " this.updateIter(iter, \"prop\", miter.get_key(), miter.get_value());",
+ " this.updateIter(iter, miter.get_value());",
" ",
" }",
" GLib.debug(\"clear selection\\n\");",
" // clear selection?",
- " this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..",
+ " this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
" ",
" this.view.el.get_selection().unselect_all();",
" ",
" ",
- " /**",
- " ",
- " make outerpane = {current width of left pane} + width of props",
- " make innerpane = {current width of left pane}",
- " ",
- " ",
- " ",
- " ",
- " ",
- " var outerpane = _this.main_window.leftpane.el;",
- " var pane = _this.main_window.editpane.el;",
- " ",
- " ",
" ",
- " var try_size = (i * 25) + 60; // est. 20px per line + 40px header",
- " GLib.Timeout.add_seconds(1, () => { ",
- "\t\t// max 80%...",
- "\t\tpane.set_position( ",
- "\t\t ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ? ",
- "\t\t (int) (pane.max_position * 0.2f) :",
- "\t\t pane.max_position-try_size);",
- "\t return GLib.Source.REMOVE;",
- "\t});",
- "\t*/",
" ",
"}",
""
""
],
"| void updateIter" : [
- "(Gtk.TreeIter iter, string type, string key, string kvalue) {",
+ "(Gtk.TreeIter iter, JsRender.NodeProp prop) {",
"",
" //print(\"update Iter %s, %s\\n\", key,kvalue);",
- " //typeof(string), // 0 key type",
- " //typeof(string), // 1 key",
- " //typeof(string), // 2 key (display)",
- " //typeof(string), // 3 value",
- " //typeof(string), // 4 value (display)",
- " //typeof(string), // 5 both (tooltip)",
- " //typeof(string), // 6 key (sort)",
" ",
- " var dl = kvalue.strip().split(\"\\n\");",
+ " var dl = prop.val.strip().split(\"\\n\");",
"",
" var dis_val = dl.length > 1 ? (dl[0].strip()+ \"...\") : dl[0];",
" ",
- " if (type == \"listener\") {",
+ " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
" ",
" ",
" ",
" this.model.el.set(iter, ",
- " 0, type,",
- " 1, key,",
- " 2, this.keyFormat(key ,type),",
- " 3, kvalue,",
- " 4, dis_val,",
- " 5, \"<tt>\" + GLib.Markup.escape_text(key + \" \" +kvalue) + \"</tt>\",",
- " 6, \"0 \" + key",
+ " \t0, prop,",
+ " \t1, prop.to_display_name(),",
+ " \t2, dis_val,",
+ " 3, \"<tt>\" + GLib.Markup.escape_text(prop.to_tooltip()) + \"</tt>\",",
+ " 4, prop.to_sort_key(),",
+ " -1",
" ); ",
" return;",
" }",
"",
"",
" this.model.el.set(iter, ",
- " 0, \"props\",",
- " 1, key,",
- " 2, this.keyFormat(key , \"prop\"),",
- " 3, kvalue,",
- " 4, dis_val,",
- " 5, \"<tt>\" + GLib.Markup.escape_text(key + \" \" + kvalue) + \"</tt>\",",
- " 6, this.keySortFormat(key)",
+ " 0, prop,",
+ " \t1, prop.to_display_name(),",
+ " \t2, dis_val,",
+ " 3, \"<tt>\" + GLib.Markup.escape_text(prop.to_tooltip()) + \"</tt>\",",
+ " 4, prop.to_sort_key(),",
+ " -1",
+ " ",
" ); ",
"}"
],
"",
" var mod = this.model.el;",
" mod.get_iter (out iter, path);",
- " ",
- " /*",
- " m.set(iter, ",
- " 0, \"listener\",",
- " 1, miter.get_key(),",
- " 2, \"<b>\" + miter.get_key() + \"</b>\",",
- " 3, miter.get_value()",
- " ); ",
- " ",
- " */",
- " GLib.Value gval;",
- " mod.get_value(iter, 3 , out gval);",
- " var val = (string)gval;",
- "",
- " mod.get_value(iter, 1 , out gval);",
- " var key = (string)gval;",
- " ",
- " ",
- " string kname, kflag, ktype;",
- " this.node.normalize_key(key, out kname, out kflag, out ktype);",
- " ",
" ",
+ " GLib.Value gval;",
" mod.get_value(iter, 0 , out gval);",
- " var type = (string)gval; // listerner or prop..",
- " ",
- " ",
+ " var prop = (JsRender.NodeProp)gval;",
+ "",
+ "",
" ",
" var use_textarea = false;",
"",
" //------------ things that require the text editor...",
" ",
- " if (type == \"listener\") {",
+ " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
" use_textarea = true;",
" }",
- " if (key.length > 0 && key[0] == '|') { // user defined method",
+ " if (prop.ptype == JsRender.NodePropType.METHOD) { ",
" use_textarea = true;",
" }",
- " if (key.length > 0 && key[0] == '$') { // raw string",
+ " if (prop.ptype == JsRender.NodePropType.RAW) { // raw string",
" use_textarea = true;",
" }",
- " if (key.length > 0 && key == \"* init\") {",
+ " if ( prop.name == \"init\" && prop.ptype == JsRender.NodePropType.SPECIAL) {",
" use_textarea = true;",
" }",
- " if (val.length > 40) { // long value...",
+ " if (prop.val.length > 40) { // long value...",
" use_textarea = true;",
" }",
" ",
" GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
" this.view.el.get_selection().select_path(path);",
" ",
- " this.show_editor(file, node, type, key);",
+ " this.show_editor(file, node, prop);",
" ",
" return false;",
" });",
" var pal = this.file.project.palete;",
" ",
" string[] opts;",
- " var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);",
+ " var has_opts = pal.typeOptions(this.node.fqn(), prop.name, prop.rtype, out opts);",
" ",
" ",
" ",
" // others... - fill in options for true/false?",
" GLib.debug(\"turn on editing %s \\n\" , mod.get_path(iter).to_string());",
" ",
- " GLib.debug (ktype.up());",
+ " // GLib.debug (ktype.up());",
" if (has_opts) {",
" GLib.debug(\"start editing try/false)???\");",
" this.valrender.el.has_entry = false;",
" this.allow_edit = true;",
" GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {",
" this.view.el.set_cursor_on_cell(",
- " path,",
- " this.valcol.el,",
- " this.valrender.el,",
- " true",
+ "\t path,",
+ "\t this.valcol.el,",
+ "\t this.valrender.el,",
+ "\t true",
" );",
" return false;",
" });",
"}",
""
],
- "| void updateKey" : [
- "(string oldkey, string type, string key ) {",
- "",
- " ",
- "\t",
- "\t_this.model.el.foreach((mod, path, iter) => {",
- "\t\t ",
- " ",
- " \t ",
- " ",
- "\t\t GLib.Value gvaltype, gval,kvalue;",
- "\t\t mod.get_value(iter, 1 , out gval); // one is key..",
- "\t\t",
- "\t mod.get_value(iter,0, out gvaltype);",
- "\t ",
- " \t mod.get_value(iter,3, out kvalue);",
- "\t ",
- "\t if (oldkey == ((string)gval) && type == ((string)gvaltype)) {",
- "\t ",
- "\t\t \t //print(\"update iter type=%s, key=%s value=%s\\n\", type, key,(string) kvalue);",
- "\t ",
- " \t \t this.updateIter(iter, type, key, (string)kvalue);",
- " \t \t return true;",
- "\t \t }",
- "\t ",
+ "| void before_edit" : [
+ "()",
+ "{",
"",
- "\t\treturn false;",
- "\t});",
- "\t",
- "\tthis.changed();",
+ " GLib.debug(\"before edit - stop editing\\n\");",
+ " ",
+ " // these do not appear to trigger save...",
+ " _this.keyrender.el.stop_editing(false);",
+ " _this.keyrender.el.editable =false;",
"",
+ " _this.valrender.el.stop_editing(false);",
+ " _this.valrender.el.editable =false; ",
+ " ",
+ " ",
+ "// technicall stop the popup editor..",
"",
"}",
""
+ ],
+ "| void reload" : [
+ "() {",
+ "\tthis.load(this.file, this.node);",
+ "}",
+ ""
]
}
],
public bool allow_edit;
public JsRender.JsRender file;
public signal bool stop_editor ();
- public signal void show_editor (JsRender.JsRender file, JsRender.Node node, string type, string key);
+ public signal void show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
public signal void changed ();
public signal void show_add_props (string type);
public Xcls_MainWindow main_window;
}
// user defined functions
- public void updateKey (string oldkey, string type, string key ) {
-
-
-
- _this.model.el.foreach((mod, path, iter) => {
-
-
-
-
- GLib.Value gvaltype, gval,kvalue;
- mod.get_value(iter, 1 , out gval); // one is key..
-
- mod.get_value(iter,0, out gvaltype);
-
- mod.get_value(iter,3, out kvalue);
-
- if (oldkey == ((string)gval) && type == ((string)gvaltype)) {
-
- //print("update iter type=%s, key=%s value=%s\n", type, key,(string) kvalue);
-
- this.updateIter(iter, type, key, (string)kvalue);
- return true;
- }
-
-
- return false;
- });
-
- this.changed();
-
-
- }
- public void before_edit ()
- {
-
- GLib.debug("before edit - stop editing\n");
-
- // these do not appear to trigger save...
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
-
-
- // technicall stop the popup editor..
-
- }
public string keySortFormat (string key) {
// listeners first - with 0
// specials
var mod = this.model.el;
mod.get_iter (out iter, path);
-
- /*
- m.set(iter,
- 0, "listener",
- 1, miter.get_key(),
- 2, "<b>" + miter.get_key() + "</b>",
- 3, miter.get_value()
- );
-
- */
- GLib.Value gval;
- mod.get_value(iter, 3 , out gval);
- var val = (string)gval;
-
- mod.get_value(iter, 1 , out gval);
- var key = (string)gval;
-
-
- string kname, kflag, ktype;
- this.node.normalize_key(key, out kname, out kflag, out ktype);
-
+ GLib.Value gval;
mod.get_value(iter, 0 , out gval);
- var type = (string)gval; // listerner or prop..
-
-
+ var prop = (JsRender.NodeProp)gval;
+
+
var use_textarea = false;
//------------ things that require the text editor...
- if (type == "listener") {
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
use_textarea = true;
}
- if (key.length > 0 && key[0] == '|') { // user defined method
+ if (prop.ptype == JsRender.NodePropType.METHOD) {
use_textarea = true;
}
- if (key.length > 0 && key[0] == '$') { // raw string
+ if (prop.ptype == JsRender.NodePropType.RAW) { // raw string
use_textarea = true;
}
- if (key.length > 0 && key == "* init") {
+ if ( prop.name == "init" && prop.ptype == JsRender.NodePropType.SPECIAL) {
use_textarea = true;
}
- if (val.length > 40) { // long value...
+ if (prop.val.length > 40) { // long value...
use_textarea = true;
}
GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
this.view.el.get_selection().select_path(path);
- this.show_editor(file, node, type, key);
+ this.show_editor(file, node, prop);
return false;
});
var pal = this.file.project.palete;
string[] opts;
- var has_opts = pal.typeOptions(this.node.fqn(), kname, ktype, out opts);
+ var has_opts = pal.typeOptions(this.node.fqn(), prop.name, prop.rtype, out opts);
// others... - fill in options for true/false?
GLib.debug("turn on editing %s \n" , mod.get_path(iter).to_string());
- GLib.debug (ktype.up());
+ // GLib.debug (ktype.up());
if (has_opts) {
GLib.debug("start editing try/false)???");
this.valrender.el.has_entry = false;
this.allow_edit = true;
GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
this.view.el.set_cursor_on_cell(
- path,
- this.valcol.el,
- this.valrender.el,
- true
+ path,
+ this.valcol.el,
+ this.valrender.el,
+ true
);
return false;
});
}
public void load (JsRender.JsRender file, JsRender.Node? node)
{
+ // not sure when to initialize this - we should do it on setting main window really.
+ if (this.view.popover == null) {
+ this.view.popover = new Xcls_PopoverProperty();
+ this.view.popover.mainwindow = _this.main_window;
+ }
+
+
+
+
GLib.debug("load leftprops\n");
this.before_edit();
this.node = node;
//var provider = this.get('/LeftTree').getPaleteProvider();
Gtk.TreeIter iter;
- //typeof(string), // 0 key type
- //typeof(string), // 1 key
- //typeof(string), // 2 key (display)
- //typeof(string), // 3 value
- //typeof(string), // 4 value (display)
- //typeof(string), // 5 both (tooltip)
+
i++;
m.append(out iter,null);
- this.updateIter(iter, "listener", miter.get_key(), miter.get_value());
+ this.updateIter(iter, miter.get_value());
}
while(miter.next()) {
i++;
m.append(out iter,null);
- this.updateIter(iter, "prop", miter.get_key(), miter.get_value());
+ this.updateIter(iter, miter.get_value());
}
GLib.debug("clear selection\n");
// clear selection?
- this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
+ this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
this.view.el.get_selection().unselect_all();
- /**
-
- make outerpane = {current width of left pane} + width of props
- make innerpane = {current width of left pane}
-
-
-
-
- var outerpane = _this.main_window.leftpane.el;
- var pane = _this.main_window.editpane.el;
-
-
-
- var try_size = (i * 25) + 60; // est. 20px per line + 40px header
- GLib.Timeout.add_seconds(1, () => {
- // max 80%...
- pane.set_position(
- ((try_size * 1.0f) / (pane.max_position * 1.0f)) > 0.8f ?
- (int) (pane.max_position * 0.2f) :
- pane.max_position-try_size);
- return GLib.Source.REMOVE;
- });
- */
}
public string keyFormat (string val, string type) {
}
public void deleteSelected () {
+ this.stop_editor();
+
Gtk.TreeIter iter;
Gtk.TreeModel mod;
GLib.Value gval;
mod.get_value(iter, 0 , out gval);
- var type = (string)gval;
+ var prop = (JsRender.NodeProp)gval;
- mod.get_value(iter, 1 , out gval);
- var key = (string)gval;
-
- switch(type) {
- case "listener":
- this.node.listeners.unset(key);
+ switch(prop.ptype) {
+ case JsRender.NodePropType.LISTENER:
+ this.node.listeners.unset(prop.to_index_key());
break;
- case "props":
- this.node.props.unset(key);
+ default:
+ this.node.props.unset(prop.to_index_key());
break;
}
this.load(this.file, this.node);
}
- public void addProp (string in_type, string key, string value, string value_type) {
+ public void before_edit ()
+ {
+
+ GLib.debug("before edit - stop editing\n");
+
+ // these do not appear to trigger save...
+ _this.keyrender.el.stop_editing(false);
+ _this.keyrender.el.editable =false;
+
+ _this.valrender.el.stop_editing(false);
+ _this.valrender.el.editable =false;
+
+
+ // technicall stop the popup editor..
+
+ }
+ public void reload () {
+ this.load(this.file, this.node);
+ }
+ public void addProp (JsRender.NodeProp prop) {
// info includes key, val, skel, etype..
//console.dump(info);
//type = info.type.toLowerCase();
//var data = this.toJS();
- var type = in_type == "signals" ? "listener" : in_type;
-
- var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
+
+
- if (type == "listener") {
- if (this.node.listeners.has_key(key)) {
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
+ if (this.node.listeners.has_key(prop.name)) {
return;
}
- this.node.listeners.set(key,value);
+ this.node.listeners.set(prop.name,prop);
} else {
assert(this.node != null);
assert(this.node.props != null);
- if (this.node.props.has_key(fkey)) {
+ if (this.node.props.has_key(prop.to_index_key())) {
return;
}
- this.node.props.set(fkey,value);
+ this.node.props.set(prop.to_index_key(),prop);
}
this.model.el.foreach((model, path, iter) => {
GLib.Value gval;
-
this.model.el.get_value(iter, 0 , out gval);
- if ((string)gval != type) {
- GLib.debug("not type: %s = %s\n", (string)gval , type);
- return false;
- }
- this.model.el.get_value(iter, 1 , out gval);
- if ((string)gval != fkey) {
- GLib.debug("not key: %s = %s\n", (string)gval , fkey);
- return false;
+
+ var iprop = (JsRender.NodeProp)gval;
+ if (iprop.to_index_key() != prop.to_index_key()) {
+ return false; // continue?
}
+
// delay this?
GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
-
+ /*
+ if (prop.name == "") { // empty string for key name.
+ _this.view.editPropertyDetails(this.model.el.get_path(iter));
+ return false;
+ }
+ */
+
this.startEditingValue(this.model.el.get_path(iter));
return false;
});
}
- public void updateIter (Gtk.TreeIter iter, string type, string key, string kvalue) {
+ public void updateIter (Gtk.TreeIter iter, JsRender.NodeProp prop) {
//print("update Iter %s, %s\n", key,kvalue);
- //typeof(string), // 0 key type
- //typeof(string), // 1 key
- //typeof(string), // 2 key (display)
- //typeof(string), // 3 value
- //typeof(string), // 4 value (display)
- //typeof(string), // 5 both (tooltip)
- //typeof(string), // 6 key (sort)
- var dl = kvalue.strip().split("\n");
+ var dl = prop.val.strip().split("\n");
var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
- if (type == "listener") {
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
this.model.el.set(iter,
- 0, type,
- 1, key,
- 2, this.keyFormat(key ,type),
- 3, kvalue,
- 4, dis_val,
- 5, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
- 6, "0 " + key
+ 0, prop,
+ 1, prop.to_display_name(),
+ 2, dis_val,
+ 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
+ 4, prop.to_sort_key(),
+ -1
);
return;
}
this.model.el.set(iter,
- 0, "props",
- 1, key,
- 2, this.keyFormat(key , "prop"),
- 3, kvalue,
- 4, dis_val,
- 5, "<tt>" + GLib.Markup.escape_text(key + " " + kvalue) + "</tt>",
- 6, this.keySortFormat(key)
+ 0, prop,
+ 1, prop.to_display_name(),
+ 2, dis_val,
+ 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
+ 4, prop.to_sort_key(),
+ -1
+
);
}
public class Xcls_Box2 : Object
var child_1 = new Xcls_Button4( _this );
child_1.ref();
this.el.add ( child_1.el );
- var child_2 = new Xcls_Button24( _this );
+ var child_2 = new Xcls_Button6( _this );
child_2.ref();
this.el.add ( child_2.el );
- var child_3 = new Xcls_Button26( _this );
+ var child_3 = new Xcls_Button8( _this );
child_3.ref();
this.el.add ( child_3.el );
}
// my vars (dec)
// set gobject values
- this.el.margin_right = 5;
- this.el.margin_left = 5;
+ this.el.margin_end = 5;
+ this.el.margin_start = 5;
}
// user defined functions
// set gobject values
this.el.hexpand = true;
+ this.el.always_show_image = true;
+ this.el.tooltip_text = "Add Property";
+ this.el.label = "Property";
+ var child_0 = new Xcls_Image5( _this );
+ child_0.ref();
+ this.el.set_image ( child_0.el );
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.PROP
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image5 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image5(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "format-justify-left";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button6 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button6(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.always_show_image = true;
+ this.el.tooltip_text = "Add Event Code";
+ this.el.label = "Event";
+ var child_0 = new Xcls_Image7( _this );
+ child_0.ref();
+ this.el.set_image ( child_0.el );
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.LISTENER
+ );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image7 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image7(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "appointment-new";
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Button8 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button8(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.always_show_image = true;
this.el.label = "Other";
var child_0 = new Xcls_AddPropertyPopup( _this );
child_0.ref();
- var child_1 = new Xcls_Image23( _this );
+ var child_1 = new Xcls_Image27( _this );
child_1.ref();
this.el.set_image ( child_1.el );
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_MenuItem6( _this );
+ var child_0 = new Xcls_MenuItem10( _this );
child_0.ref();
this.el.append ( child_0.el );
- var child_1 = new Xcls_MenuItem7( _this );
+ var child_1 = new Xcls_MenuItem11( _this );
child_1.ref();
this.el.append ( child_1.el );
- var child_2 = new Xcls_MenuItem8( _this );
+ var child_2 = new Xcls_MenuItem12( _this );
child_2.ref();
this.el.append ( child_2.el );
- var child_3 = new Xcls_MenuItem9( _this );
+ var child_3 = new Xcls_MenuItem13( _this );
child_3.ref();
this.el.append ( child_3.el );
- var child_4 = new Xcls_MenuItem10( _this );
+ var child_4 = new Xcls_MenuItem14( _this );
child_4.ref();
this.el.append ( child_4.el );
- var child_5 = new Xcls_SeparatorMenuItem11( _this );
+ var child_5 = new Xcls_SeparatorMenuItem15( _this );
child_5.ref();
this.el.add ( child_5.el );
- var child_6 = new Xcls_MenuItem12( _this );
+ var child_6 = new Xcls_MenuItem16( _this );
child_6.ref();
this.el.append ( child_6.el );
- var child_7 = new Xcls_MenuItem13( _this );
+ var child_7 = new Xcls_MenuItem17( _this );
child_7.ref();
this.el.append ( child_7.el );
- var child_8 = new Xcls_MenuItem14( _this );
+ var child_8 = new Xcls_MenuItem18( _this );
child_8.ref();
this.el.append ( child_8.el );
- var child_9 = new Xcls_SeparatorMenuItem15( _this );
+ var child_9 = new Xcls_SeparatorMenuItem19( _this );
child_9.ref();
this.el.add ( child_9.el );
- var child_10 = new Xcls_MenuItem16( _this );
+ var child_10 = new Xcls_MenuItem20( _this );
child_10.ref();
this.el.append ( child_10.el );
- var child_11 = new Xcls_MenuItem17( _this );
+ var child_11 = new Xcls_MenuItem21( _this );
child_11.ref();
this.el.append ( child_11.el );
- var child_12 = new Xcls_MenuItem18( _this );
+ var child_12 = new Xcls_MenuItem22( _this );
child_12.ref();
this.el.append ( child_12.el );
- var child_13 = new Xcls_SeparatorMenuItem19( _this );
+ var child_13 = new Xcls_SeparatorMenuItem23( _this );
child_13.ref();
this.el.add ( child_13.el );
- var child_14 = new Xcls_MenuItem20( _this );
+ var child_14 = new Xcls_MenuItem24( _this );
child_14.ref();
this.el.append ( child_14.el );
- var child_15 = new Xcls_MenuItem21( _this );
+ var child_15 = new Xcls_MenuItem25( _this );
child_15.ref();
this.el.append ( child_15.el );
- var child_16 = new Xcls_MenuItem22( _this );
+ var child_16 = new Xcls_MenuItem26( _this );
child_16.ref();
this.el.append ( child_16.el );
}
// user defined functions
}
- public class Xcls_MenuItem6 : Object
+ public class Xcls_MenuItem10 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem6(Xcls_LeftProps _owner )
+ public Xcls_MenuItem10(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( () => {
- _this.addProp( "prop", "id", "", "");
+ // is this userdef or special??
+ _this.addProp( new JsRender.NodeProp.prop("id") );
});
}
// user defined functions
}
- public class Xcls_MenuItem7 : Object
+ public class Xcls_MenuItem11 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem7(Xcls_LeftProps _owner )
+ public Xcls_MenuItem11(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) => {
-
- _this.addProp( "prop", "pack","add", "*");
+ // is this userdef?
+ _this.addProp( new JsRender.NodeProp.special("pack", "add") );
});
}
// user defined functions
}
- public class Xcls_MenuItem8 : Object
+ public class Xcls_MenuItem12 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem8(Xcls_LeftProps _owner )
+ public Xcls_MenuItem12(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) => {
- _this.addProp( "prop", "ctor","", "*");
+ _this.addProp( new JsRender.NodeProp.special("ctor") );
});
}
// user defined functions
}
- public class Xcls_MenuItem9 : Object
+ public class Xcls_MenuItem13 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem9(Xcls_LeftProps _owner )
+ public Xcls_MenuItem13(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) => {
+ _this.addProp( new JsRender.NodeProp.special("init","{\n\n}\n" ) );
- _this.addProp( "prop", "init", "{\n\n}\n", "*" );
});
}
// user defined functions
}
- public class Xcls_MenuItem10 : Object
+ public class Xcls_MenuItem14 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem10(Xcls_LeftProps _owner )
+ public Xcls_MenuItem14(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( () => {
- _this.addProp( "prop", "cms-id", "", "string");
+
+ _this.addProp( new JsRender.NodeProp.prop("cms-id","string", "" ) );
+
+
+
});
}
// user defined functions
}
- public class Xcls_SeparatorMenuItem11 : Object
+ public class Xcls_SeparatorMenuItem15 : Object
{
public Gtk.SeparatorMenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_SeparatorMenuItem11(Xcls_LeftProps _owner )
+ public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.SeparatorMenuItem();
// user defined functions
}
- public class Xcls_MenuItem12 : Object
+ public class Xcls_MenuItem16 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem12(Xcls_LeftProps _owner )
+ public Xcls_MenuItem16(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( (self) => {
- _this.addProp( "prop", "XXXX", "","# string");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "string", "") ,
+ -1,
+ true
+ );
});
}
// user defined functions
}
- public class Xcls_MenuItem13 : Object
+ public class Xcls_MenuItem17 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem13(Xcls_LeftProps _owner )
+ public Xcls_MenuItem17(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "XXX", "0", "int");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "int", "0") ,
+ -1,
+ true
+ );
+
});
}
// user defined functions
}
- public class Xcls_MenuItem14 : Object
+ public class Xcls_MenuItem18 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem14(Xcls_LeftProps _owner )
+ public Xcls_MenuItem18(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp( "prop", "XXX", "true", "bool");
+
+
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "bool", "true") ,
+ -1,
+ true
+ );
+
});
}
// user defined functions
}
- public class Xcls_SeparatorMenuItem15 : Object
+ public class Xcls_SeparatorMenuItem19 : Object
{
public Gtk.SeparatorMenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
+ public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.SeparatorMenuItem();
// user defined functions
}
- public class Xcls_MenuItem16 : Object
+ public class Xcls_MenuItem20 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem16(Xcls_LeftProps _owner )
+ public Xcls_MenuItem20(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp("prop", "XXXX", "function() { }", "| function");
+
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.jsmethod("") ,
+ -1,
+ true
+ );
+
+
});
}
// user defined functions
}
- public class Xcls_MenuItem17 : Object
+ public class Xcls_MenuItem21 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem17(Xcls_LeftProps _owner )
+ public Xcls_MenuItem21(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
- _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| void");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.valamethod("") ,
+ -1,
+ true
+ );
});
}
// user defined functions
}
- public class Xcls_MenuItem18 : Object
+ public class Xcls_MenuItem22 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem18(Xcls_LeftProps _owner )
+ public Xcls_MenuItem22(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
-
- _this.addProp( "prop", "XXXX", "()", "@ void");
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.sig("" ) ,
+ -1,
+ true
+ );
});
}
// user defined functions
}
- public class Xcls_SeparatorMenuItem19 : Object
+ public class Xcls_SeparatorMenuItem23 : Object
{
public Gtk.SeparatorMenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
+ public Xcls_SeparatorMenuItem23(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.SeparatorMenuItem();
// user defined functions
}
- public class Xcls_MenuItem20 : Object
+ public class Xcls_MenuItem24 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem20(Xcls_LeftProps _owner )
+ public Xcls_MenuItem24(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
+ -1,
+ true
+ );
+
- _this.addProp("prop", "flexy:if", "value_or_condition", "string");
});
}
// user defined functions
}
- public class Xcls_MenuItem21 : Object
+ public class Xcls_MenuItem25 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem21(Xcls_LeftProps _owner )
+ public Xcls_MenuItem25(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
+ -1,
+ true
+ );
- _this.addProp("prop", "flexy:include", "name_of_file.html", "string");
+
});
}
// user defined functions
}
- public class Xcls_MenuItem22 : Object
+ public class Xcls_MenuItem26 : Object
{
public Gtk.MenuItem el;
private Xcls_LeftProps _this;
// my vars (def)
// ctor
- public Xcls_MenuItem22(Xcls_LeftProps _owner )
+ public Xcls_MenuItem26(Xcls_LeftProps _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
//listeners
this.el.activate.connect( ( ) =>{
+
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:foreach", "string", "array,key,value") ,
+ -1,
+ true
+ );
- _this.addProp("prop", "flexy:foreach", "array,key,value", "string");
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Image23 : Object
- {
- public Gtk.Image el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image23(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.stock = Gtk.Stock.ADD;
- this.el.icon_size = Gtk.IconSize.MENU;
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Button24 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button24(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.tooltip_text = "Add Property";
- this.el.label = "Property";
- var child_0 = new Xcls_Image25( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.main_window.windowstate.showProps(this.el, "props");
-
-
});
}
// user defined functions
}
- public class Xcls_Image25 : Object
- {
- public Gtk.Image el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image25(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "format-justify-left";
- }
-
- // user defined functions
- }
-
- public class Xcls_Button26 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button26(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.tooltip_text = "Add Event Code";
- this.el.label = "Event";
- var child_0 = new Xcls_Image27( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.main_window.windowstate.showProps(this.el, "signals");
-
-
- });
- }
- // user defined functions
- }
public class Xcls_Image27 : Object
{
public Gtk.Image el;
// my vars (dec)
// set gobject values
- this.el.icon_name = "appointment-new";
+ this.el.stock = Gtk.Stock.ADD;
+ this.el.icon_size = Gtk.IconSize.MENU;
}
// user defined functions
this.popover = null;
// set gobject values
- this.el.tooltip_column = 5;
+ this.el.tooltip_column = 3;
this.el.enable_tree_lines = true;
this.el.headers_visible = true;
var child_0 = new Xcls_model( _this );
var description = new Pango.FontDescription();
description.set_size(10000);
this.el.override_font(description);
+
}
//listeners
int cell_x;
int cell_y;
Gtk.TreePath path;
+
+ // event x /y are relative to the widget..
if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
GLib.debug("nothing selected on click");
GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
}
- // double click on name..
- if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
- // show popup!.
-
- if (this.popover == null) {
- this.popover = new Xcls_PopoverProperty();
- this.popover.mainwindow = _this.main_window;
- }
-
-
- _this.before_edit();
- _this.stop_editor();
-
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
- Gtk.TreeIter iter;
- var mod = this.el.get_model();
- mod.get_iter (out iter, path);
-
-
- GLib.Value gvaltype, gval;
- mod.get_value(iter, 1 , out gval); // one is key..
-
- mod.get_value(iter,0, out gvaltype);
-
- this.popover.show(this.el, _this.node, (string)gvaltype, (string)gval);
-
- // _this.startEditingKey(path);
+ // single click on name..
+ //if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
+ if (ev.button == 1 && col.title == "Property") {
+ // need to shift down, as ev.y does not inclucde header apparently..
+ // or popover might be trying to do a central?
+ this.editPropertyDetails(path, (int) ev.y + 12);
return false;
}
}
// user defined functions
+ public void editPropertyDetails (Gtk.TreePath path, int y) {
+
+
+
+
+ _this.before_edit();
+ _this.stop_editor();
+
+ _this.keyrender.el.stop_editing(false);
+ _this.keyrender.el.editable =false;
+
+ _this.valrender.el.stop_editing(false);
+ _this.valrender.el.editable =false;
+ Gtk.TreeIter iter;
+ var mod = this.el.get_model();
+ mod.get_iter (out iter, path);
+
+
+ GLib.Value gval;
+
+ mod.get_value(iter,0, out gval);
+
+ this.popover.show(_this.view.el, _this.node, (JsRender.NodeProp)gval, y);
+
+
+ }
}
public class Xcls_model : Object
{
{
_this = _owner;
_this.model = this;
- this.el = new Gtk.TreeStore( 7, typeof(string), // 0 key type
- typeof(string), // 1 key
- typeof(string), // 2 key (display)
- typeof(string), // 3 value
- typeof(string), // 4 value (display)
- typeof(string), // 5 both (tooltip)
- typeof(string) // 6 key (for sorting)
- );
+ this.el = new Gtk.TreeStore( 5, typeof(JsRender.NodeProp), // 0 key type
+ typeof(string), // 1 display_key
+ typeof(string), // 2 display_value
+ typeof(string), // 3 display_tooltip
+ typeof(string) // 4 sortable value
+/*
+ 0, prop,
+ 1, prop.to_display_name(),
+ 2, dis_val.
+ 3, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
+ 4, "0 " + prop.name
+
+ );
+ */ );
// my vars (dec)
// my vars (dec)
// set gobject values
- this.el.title = "Name";
+ this.el.title = "Property";
this.el.resizable = true;
var child_0 = new Xcls_keyrender( _this );
child_0.ref();
// init method
- this.el.add_attribute(_this.keyrender.el , "markup", 2 );
- this.el.add_attribute(_this.keyrender.el , "text", 1 );
+ this.el.add_attribute(_this.keyrender.el , "markup", 1 ); // 1 is the key.
+ //this.el.add_attribute(_this.keyrender.el , "text", 1 );
}
// user defined functions
// my vars (dec)
// set gobject values
-
- //listeners
- this.el.editing_started.connect( ( editable, path) => {
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
-
-
-
- // this.get('/LeftPanel.model').activePath = path;
- _this.model.el.get_value(iter,1, out gval);
- var val = (string)gval;
-
- ((Gtk.Entry)editable).set_text(val);
- });
- this.el.edited.connect( (path, newtext) => {
- GLib.debug("Keyrender - signal:edited\n");
-
- this.el.editable = false;
-
-
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
-
- _this.model.el.get_value(iter,1, out gval);
- var oldval = (string)gval;
-
- _this.model.el.get_value(iter,0, out gval);
- var ktype = (string)gval;
-
- _this.model.el.set_value(iter, 1, newtext);
-
- if (oldval == newtext) {
- return;
- }
-
-
- GLib.debug("ktype: %s\n",ktype);
- switch(ktype) {
- case "listener":
- var ov = _this.node.listeners.get(oldval);
- _this.node.listeners.set(newtext, ov);
- _this.node.listeners.unset(oldval);
-
- _this.updateIter(iter, ktype, newtext, ov);
-
- break;
- case "props":
- var ov = _this.node.props.get(oldval);
- _this.node.props.set(newtext, ov);
- _this.node.props.unset(oldval);
- _this.updateIter(iter, ktype, newtext, ov);
- break;
- }
- _this.changed();
-
- });
}
// user defined functions
{
- // typeof(string), // 0 key type
- // typeof(string), // 1 key
- // typeof(string), // 2 key (display)
- // typeof(string), // 3 value
- // typeof(string) // 4 value (display)
+
- this.el.add_attribute(_this.valrender.el , "text", 4 );
- //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
- //this.el.add_attribute(this.items[0].el , 'editable', 3 );
- // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
-
- // this.get('/LeftPanel').editableColumn= this;
+ this.el.add_attribute(_this.valrender.el , "text", 2 );
+
}
}
// this.get('/LeftPanel.model').activePath = path;
- _this.model.el.get_value(iter,3, out gval);
+ _this.model.el.get_value(iter,0, out gval);
- var val = (string)gval;
+ var prop = (JsRender.NodeProp)gval;
var combo = (Gtk.ComboBox)editable;
var entry = (Gtk.Entry) combo.get_child();
- entry.set_text(val);
+ entry.set_text(prop.val);
}
});
GLib.debug("Valrender - signal:edited\n");
this.el.editable = false;
- /*
- m.set(iter,
- 0, "listener",
- 1, miter.get_key(),
- 2, "<b>" + miter.get_key() + "</b>",
- 3, miter.get_value(),
- 4, display_value(short);
- );
-
- */
+
Gtk.TreeIter iter;
_this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
GLib.Value gval;
_this.model.el.get_value(iter,0, out gval);
- var ktype = (string)gval;
-
-
- _this.model.el.get_value(iter,3, out gval);
- var oldval = (string)gval;
-
- _this.model.el.get_value(iter,1, out gval);
- var key = (string)gval;
-
-
-
- switch(ktype) {
- case "listener":
- _this.node.listeners.set(key, newtext);
- _this.updateIter(iter,ktype,key,newtext);
- break;
- case "props":
- _this.node.props.set(key,newtext);
- _this.updateIter(iter,ktype, key,newtext);
- break;
- }
- // _this.load(_this.file,_this.node);
- _this.changed();
+ var prop = (JsRender.NodeProp)gval;
+ prop.val = newtext;
+ _this.updateIter(iter,prop);
+ _this.changed();
});
}
// user defined functions
public void setOptions (string[] ar) {
- var m = _this.valrendermodel.el;
- m.clear();
- Gtk.TreeIter iret;
+ var m = _this.valrendermodel.el;
+ m.clear();
+ Gtk.TreeIter iret;
for (var i =0; i < ar.length; i++) {
- m.append(out iret);
- m.set_value(iret, 0, ar[i]);
+ m.append(out iret);
+ m.set_value(iret, 0, ar[i]);
}
}
var child_0 = new Xcls_MenuItem37( _this );
child_0.ref();
this.el.append ( child_0.el );
- var child_1 = new Xcls_SeparatorMenuItem38( _this );
- child_1.ref();
- this.el.append ( child_1.el );
- var child_2 = new Xcls_MenuItem39( _this );
- child_2.ref();
- this.el.append ( child_2.el );
}
// user defined functions
// my vars (dec)
- // set gobject values
- this.el.label = "Edit (double click)";
-
- //listeners
- this.el.activate.connect( ( ) =>{
-
- var s = _this.view.el.get_selection();
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
- s.get_selected (out mod, out iter);
-
- if (_this.view.popover == null) {
- _this.view.popover = new Xcls_PopoverProperty();
- _this.view.popover.mainwindow = _this.main_window;
- }
-
-
- _this.before_edit();
- _this.stop_editor();
-
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
-
-
- GLib.Value gvaltype, gval;
- mod.get_value(iter, 1 , out gval); // one is key..
-
- mod.get_value(iter,0, out gvaltype);
-
- _this.view.popover.show(_this.view.el, _this.node, (string)gvaltype, (string)gval);
-
-
-
- // _this.startEditingKey(model.get_path(iter));
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_SeparatorMenuItem38 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SeparatorMenuItem38(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem39 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem39(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
// set gobject values
this.el.label = "Delete";
" ",
" ",
" if (target_data.length == 3 && target_data[2].length > 0) {",
- " node.props.set(\"* prop\", target_data[2]);",
+ "\t node.set_prop(new JsRender.NodeProp.special(\"prop\", target_data[2]));",
+ "",
" }",
"",
" Gtk.TreePath expand_parent = null;",
" \tif (selection_text.contains(\":\")) {",
"\t \tvar bits = selection_text.split(\":\");",
"\t dropNode.setFqn(bits[0]);",
- "\t dropNode.props.set(\"* prop\", bits[1]);",
+ "\t dropNode.set_prop(new JsRender.NodeProp.special(\"prop\", bits[1]));",
" \t} else {",
"",
"\t dropNode.setFqn(selection_text);",
" return;",
" ",
" }",
- " node.props.set(\"* xinclude\", name);",
+ " node.set_prop( new JsRender.NodeProp.special(\"xinclude\", name));",
" node.items.clear();",
"",
"",
if (selection_text.contains(":")) {
var bits = selection_text.split(":");
dropNode.setFqn(bits[0]);
- dropNode.props.set("* prop", bits[1]);
+ dropNode.set_prop(new JsRender.NodeProp.special("prop", bits[1]));
} else {
dropNode.setFqn(selection_text);
if (target_data.length == 3 && target_data[2].length > 0) {
- node.props.set("* prop", target_data[2]);
+ node.set_prop(new JsRender.NodeProp.special("prop", target_data[2]));
+
}
Gtk.TreePath expand_parent = null;
return;
}
- node.props.set("* xinclude", name);
+ node.set_prop( new JsRender.NodeProp.special("xinclude", name));
node.items.clear();
"\treturn p.javascriptHasErrors(",
"\t\t_this.main_window.windowstate,",
" str, ",
- " \"\", // _this.key, ",
- " \"file\", //_this.ptype,",
+ " null, // prop - not relivant.",
" _this.file, ",
" null",
" ); ",
return p.javascriptHasErrors(
_this.main_window.windowstate,
str,
- "", // _this.key,
- "file", //_this.ptype,
+ null, // prop - not relivant.
_this.file,
null
);
this.win.props.el.pack_start(this.left_props.el,true, true,0);
this.left_props.el.show_all();
- this.left_props.show_editor.connect( (file, node, type, key) => {
+ this.left_props.show_editor.connect( (file, node, prop) => {
this.switchState(State.CODE);
this.code_editor_tab.show(
file,
node,
- type,
- key
+ prop
);
this.valasource.checkFileSpawn(this.file);
}
});
-
-
+
}
//stage.set_background_color( Clutter.Color.from_string("#000"));
- this.add_props.select.connect( (key,type,skel, etype) => {
+ this.add_props.select.connect( (prop) => {
- this.left_props.addProp(etype, key, skel, type);
+ this.left_props.addProp(prop);
});
}
this.win.codeeditviewbox.el.show();
this.switchState (State.CODEONLY);
file.loadItems();
- this.code_editor_tab.show(file, null, "", "");
+ this.code_editor_tab.show(file, null, null);
if (line> -1) {
this.code_editor_tab.scroll_to_line(line);
}
- public void showProps(Gtk.Widget btn, string sig_or_listen)
+ public void showProps(Gtk.Widget btn, JsRender.NodePropType sig_or_listen)
{
var ae = this.left_tree.getActiveElement();
if (ae == null) {
"../Builder4/PopoverAddObject.vala",
"../Builder4/Editor.vala",
"../Builder4/PopoverFiles.vala",
- "../JsRender/NodeToGlade.vala"
+ "../JsRender/NodeToGlade.vala",
+ "../JsRender/NodeProp.vala"
],
"packages" : []
},
//return null;
}
- public string toJsonString()
- {
- if (this.xtype == "PlainFile") {
- return "";
- }
- var node = new Json.Node(Json.NodeType.OBJECT);
- node.set_object(this.toJsonObject());
- var generator = new JsonGen(node);
- generator.indent = 4;
- generator.pretty = true;
-
-
- return generator.to_data();
- }
+
public string nickType()
{
}
-
+ public string toJsonString()
+ {
+ if (this.xtype == "PlainFile") {
+ return "";
+ }
+ var node = new Json.Node(Json.NodeType.OBJECT);
+ node.set_object(this.toJsonObject());
+ var generator = new JsonGen(node);
+ generator.indent = 1;
+ generator.pretty = true;
+
+
+ return generator.to_data();
+ }
+
public void saveBJS()
{
if (!this.loaded) {
return;
}
;
- var node = new Json.Node(Json.NodeType.OBJECT);
- node.set_object(this.toJsonObject());
- var generator = new JsonGen(node);
- generator.indent = 1;
- generator.pretty = true;
+
print("WRITE :%s\n " , this.path);// + "\n" + JSON.stringify(write));
try {
- this.writeFile(this.path, generator.to_data());
- //generator.to_file(this.path);
+ this.writeFile(this.path, this.toJsonString());
+
} catch(Error e) {
print("Save failed");
}
return "";
}
- return ar.get("* xns") + "." + ar.get("* xtype");
+ return ar.get("xns") + "." + ar.get("xtype");
}
public Node parent;
public Gee.ArrayList<Node> items; // child items..
- public Gee.HashMap<string,string> props; // the properties..
- public Gee.HashMap<string,string> listeners; // the listeners..
+ public Gee.HashMap<string,NodeProp> props; // the properties..
+ public Gee.HashMap<string,NodeProp> listeners; // the listeners..
public string xvala_cls;
public string xvala_xcls; // 'Xcls_' + id;
public string xvala_id; // item id or ""
public int line_start;
public int line_end;
public Gee.ArrayList<int> lines;
- public Gee.HashMap<int,string> line_map; // store of l:xxx or p:....
- public Gee.ArrayList<int> node_lines;
+ public Gee.HashMap<int,string> line_map; // store of l:xxx or p:.... // fixme - not needed as we can store line numbers in props now.
+ public Gee.ArrayList<int> node_lines;
public Gee.HashMap<int,Node> node_lines_map; // store of l:xxx or p:....
public Node()
{
this.items = new Gee.ArrayList<Node>();
- this.props = new Gee.HashMap<string,string>();
- this.listeners = new Gee.HashMap<string,string>();
+ this.props = new Gee.HashMap<string,NodeProp>();
+ this.listeners = new Gee.HashMap<string,NodeProp>(); // Nodeprop can include line numbers..
this.xvala_cls = "";
this.xvala_xcls = "";
this.xvala_id = "";
return null;
}
+
+
public string lineToProp(int line)
{
// assume lineToNode called first...
//print("RETURNING NODE ON LINE %d", l);
return this.line_map.get(l);
}
- return null;
+ return "";
}
if (l > -1) {
//print("RETURNING NODE ON LINE %d", l);
return this.line_map.get(l);
}
- return null;
+ return "";
}
uid_count++;
return "uid-%d".printf(uid_count);
}
- return this.props.get("id");
+ return this.props.get("id").val;
}
}
public bool hasXnsType()
{
- if (this.props.get("$ xns") != null && this.props.get("xtype") != null) {
+ if (this.props.get("xns") != null && this.props.get("xtype") != null) {
return true;
}
if (!this.hasXnsType ()) {
return "";
}
- return this.props.get("$ xns") + "." + this.props.get("xtype");
+ return this.props.get("xns").val + "." + this.props.get("xtype").val;
}
public void setFqn(string name)
{
var ar = name.split(".");
- this.props.set("xtype", ar[ar.length-1]);
+ this.props.set("xtype",new NodeProp.prop("xtype", "", ar[ar.length-1]));
var l = name.length - (ar[ar.length-1].length +1);
- this.props.set("$ xns", name.substring(0, l));
+ this.props.set("xns", new NodeProp.raw("xns", "", name.substring(0, l)));
//print("setFQN %s to %s\n", name , this.fqn());
}
// wrapper around get props that returns empty string if not found.
- public string get(string key)
+ //overrides Glib.object.get (hence new)
+ public new string get(string key)
{
+
+ var v = this.props.get(key);
+ return v == null ? "" : v.val;
+ }
+ /*
var k = this.props.get(key);
if (k != null) {
return k;
if (kk[kk.length-1] == key) {
return iter.get_value();
}
- }
return "";
-
- }
+ }
+ */
+
+ /*
+ SAMNE AS ABOVE
public string get_key(string key)
{
var k = this.props.get(key);
return "";
}
+ */
+ public NodeProp? get_prop(string key)
+ {
+
+ return this.props.get(key);
+
+ }
+
+ public void set_prop(NodeProp prop)
+ {
+
+ this.props.set(prop.to_index_key(), prop);
+
+ }
+
+ /*
public void normalize_key(string key, out string kname, out string kflag, out string ktype)
{
// key formats : XXXX
string[] kk = {};
for (var i = 0; i < kkv.length; i++) {
if (kkv[i].length > 0 ) {
- kk+= kkv[i];
+ kk += kkv[i];
}
}
//print("normalize %s => %s\n", key,string.joinv("=:=",kk));
}
// everything blank otherwise...
}
- public void set(string key, string value) {
- this.props.set(key,value);
+ */
+
+
+ public new void set(string key, NodeProp val) {
+ this.props.set(key,val);
}
- public bool has(string key)
+
+ public bool has(string key)
{
+ return this.props.has_key(key);
+ /*
var k = this.props.get(key);
if (k != null) {
return true;
}
return false;
-
+ */
}
public void remove()
public Node? findProp(string n) {
for(var i=0;i< this.items.size;i++) {
var p = this.items.get(i).get("* prop");
- if (this.items.get(i).get("* prop").length < 1) {
+ if (p == null) {
continue;
}
if (p == n) {
if (key == "listeners") {
var li = value.get_object();
li.foreach_member((lio , li_key, li_value) => {
- this.listeners.set(li_key, this.jsonNodeAsString(li_value));
+ this.listeners.set(li_key, new NodeProp.listener(li_key, this.jsonNodeAsString(li_value)));
});
return;
}
if (version == 1) {
rkey = this.upgradeKey(key, sval);
}
-
+ var n = new NodeProp.from_json(rkey, sval);
- this.props.set(rkey, sval);
+ this.props.set(n.to_index_key(), n );
});
}
+
+ // converts the array into a string with line breaks.
public string jsonNodeAsString(Json.Node node)
{
}
-
+ // really old files...
public string upgradeKey(string key, string val)
{
Node.gen.set_root (n);
return Node.gen.to_data (null);
}
+
public void jsonObjectAddStringValue(Json.Object obj, string key, string v)
{
if (v.index_of_char('\n',0) < 0) {
ret.set_object_member("listeners", li);
var liter = this.listeners.map_iterator();
while (liter.next()) {
- this.jsonObjectAddStringValue(li, liter.get_key(), liter.get_value());
+ this.jsonObjectAddStringValue(li, liter.get_value().to_json_key(), liter.get_value().val);
}
}
//props
if (this.props.size > 0 ) {
var iter = this.props.map_iterator();
while (iter.next()) {
- this.jsonObjectsetMember(ret, iter.get_key(), iter.get_value());
+ this.jsonObjectsetMember(ret, iter.get_value().to_json_key(), iter.get_value().val);
}
}
if (this.items.size > 0) {
//o.set_string_member(key,val);
}
+ // fixme this needs to better handle 'user defined types etc..
public string nodeTip()
{
var ret = this.nodeTitle(true);
var iter = this.props.map_iterator();
while (iter.next()) {
var i = iter.get_key().strip();
- var val = iter.get_value().strip();
+ var val = iter.get_value().val.strip();
if (val == null || val.length < 1) {
continue;
}
iter = this.listeners.map_iterator();
while (iter.next()) {
var i = iter.get_key().strip();
- var val = iter.get_value().strip();
+ var val = iter.get_value().val.strip();
if (val == null || val.length < 1) {
continue;
}
return ret;
}
- public string nodeTitle(bool for_tip = false) {
+ public string nodeTitle(bool for_tip = false)
+ {
string[] txt = {};
//var sr = (typeof(c['+buildershow']) != 'undefined') && !c['+buildershow'] ? true : false;
--- /dev/null
+/**
+
+This is a replacement for our key/value
+events and properties
+
+
+*/
+public enum JsRender.NodePropType
+{
+
+ NONE, // fake value - used in popoveraddprop.
+ CTOR, // not used exetp getProperties for?
+
+
+ // these are all stored as properties, and should not overlap.
+ PROP,
+
+ RAW,
+ METHOD,
+ SIGNAL,
+
+ // in theory we could have user defined properties that overlap - but probably not a good idea.
+ USER,
+
+
+
+ // specials - these should be in a seperate list?
+ SPECIAL,
+
+
+
+ // listerens can definatly overlap as they are stored in a seperate list. << no need to use this for listeners?
+ LISTENER;
+
+
+
+ public static string to_abbr(NodePropType intype)
+ {
+ switch(intype) {
+ case PROP: return "";
+ case RAW: return "$";
+ case METHOD : return "|";
+ case SIGNAL : return "@"; // vala signal
+ case USER : return "#"; // user defined.
+ case SPECIAL : return "*"; // * prop| args | ctor | init
+ case LISTENER : return ""; // always raw...
+ // not used
+ case NONE:
+ case CTOR:
+ return "";
+
+ }
+ return "??";
+ }
+
+ // only usefull for reall values.
+ public static NodePropType from_string(string str)
+ {
+ switch(str) {
+ //case "" : return PROP;
+ case "$": return RAW;
+ case "|": return METHOD;
+ case "@": return SIGNAL;
+ case "#": return USER;
+ case "*": return SPECIAL;
+ //case "": return case LISTENER : return "" // always raw...
+ }
+ return PROP;
+
+ }
+
+}
+
+
+
+public class JsRender.NodeProp : Object {
+
+
+
+ public string name = "";
+ public NodePropType ptype;
+ public string rtype = ""; // return or type
+ public string val = "";
+ public int start_line = 0;
+ public int end_line = 0;
+
+
+
+ public NodeProp(string name, NodePropType ptype, string rtype, string val) {
+ this.name = name;
+ this.ptype = ptype;
+ this.rtype = rtype;
+ this.val = val;
+ }
+
+ public NodeProp.from_json(string key, string inval)
+ {
+ this.val = inval;
+ var kkv = key.strip().split(" ");
+ string[] kk = {};
+ for (var i = 0; i < kkv.length; i++) {
+ if (kkv[i].length > 0 ) {
+ kk += kkv[i];
+ }
+ }
+
+ switch(kk.length) {
+ case 1:
+ this.name = kk[0];
+ this.ptype = NodePropType.PROP;
+ this.rtype = "";
+ return;
+ case 2:
+ this.name = kk[1];
+ if (kk[0].length > 1) {
+ // void fred (no type)
+ this.rtype = kk[0];
+ this.ptype = NodePropType.PROP;
+ } else {
+ // has a ptype.
+
+ this.rtype = ""; // no return type, only a ptype indicator.
+ this.ptype = NodePropType.from_string(kk[0]);
+ }
+ return;
+ default: // 3 or more... (ignores spaces..)
+ case 3:
+ this.name = kk[2];
+ this.ptype = NodePropType.from_string(kk[0]);
+ this.rtype = kk[1];
+ return;
+
+ }
+
+ }
+ public string to_json_key()
+ {
+
+ var ortype = this.rtype + (this.rtype.length > 0 ? " " : "");
+ var oabbr = NodePropType.to_abbr(this.ptype);
+ if (oabbr.length > 0) {
+ oabbr += " ";
+ }
+ switch(this.ptype) {
+
+
+ case NodePropType.LISTENER :
+ return this.name;
+
+ case NodePropType.PROP:
+ return ortype + this.name;
+
+ case NodePropType.RAW:
+ case NodePropType.METHOD:
+ case NodePropType.SIGNAL:
+ case NodePropType.USER :
+ return oabbr + ortype + this.name;
+
+
+
+ case NodePropType.SPECIAL:
+ return oabbr + this.name;
+ case NodePropType.NONE: // not used
+ case NodePropType.CTOR:
+ return "";
+
+
+ }
+ return this.name;
+ }
+
+
+ public string to_index_key()
+ {
+ switch(this.ptype) {
+ case NodePropType.PROP:
+ case NodePropType.RAW:
+ case NodePropType.METHOD :
+ case NodePropType.SIGNAL :
+ case NodePropType.USER :
+ return this.name;
+
+ case NodePropType.SPECIAL :
+ return "* " + this.name;
+
+ // in seperate list..
+ case NodePropType.LISTENER :
+ return this.name;
+
+ case NodePropType.NONE: // not used
+ case NodePropType.CTOR:
+ return "";
+
+
+ }
+ return this.name;
+
+ }
+ // how it appears on the property list. --
+ public string to_display_name()
+ {
+
+ //return (this.rtype.length > 0 ? this.rtype + " " : "") + this.name;
+ // before we showed "@" for signals
+ switch(this.ptype) {
+ case NodePropType.PROP:
+ return this.name;
+
+ case NodePropType.RAW:
+ return "<span style=\"italic\">" + GLib.Markup.escape_text(this.name) + "</span>";
+
+ case NodePropType.METHOD :
+ return "<i>" + GLib.Markup.escape_text(this.rtype) + "</i> <span color=\"#008000\" font_weight=\"bold\">" + GLib.Markup.escape_text( this.name) + "</span>";
+
+ case NodePropType.SIGNAL : // purpley
+ return "<span color=\"#ea00d6\" font_weight=\"bold\">" + GLib.Markup.escape_text(this.name)+ "</span>";
+
+ case NodePropType.USER :
+ return "<i>" + GLib.Markup.escape_text(this.rtype) + "</i> <span font_weight=\"bold\">" + GLib.Markup.escape_text(this.name) + "</span>";
+
+ case NodePropType.SPECIAL :
+ return "<span color=\"#0000CC\" font_weight=\"bold\">" + GLib.Markup.escape_text(this.name) + "</span>";
+
+ // in seperate list..
+ case NodePropType.LISTENER :
+ return "<b>" + this.name + "</b>";
+
+ case NodePropType.NONE: // not used
+ case NodePropType.CTOR:
+ return "";
+
+
+ }
+ return this.name;
+ }
+
+ // used ot sort the dispaly list of properties.
+ public string to_sort_key()
+ {
+ var n = this.name;
+
+ //return (this.rtype.length > 0 ? this.rtype + " " : "") + this.name;
+ // before we showed "@" for signals
+ switch(this.ptype) {
+ case NodePropType.PROP:
+ return "5" + n;
+
+ case NodePropType.RAW:
+ return "5" + n;
+
+ case NodePropType.METHOD :
+ return "2" + n;
+
+ case NodePropType.SIGNAL :
+ return "3" + n;
+
+ case NodePropType.USER :
+ return "4" + n;
+
+ case NodePropType.SPECIAL :
+ return "1" + n;
+
+ // in seperate list..
+ case NodePropType.LISTENER :
+ return "0" + this.name;
+
+ case NodePropType.NONE: // not used
+ case NodePropType.CTOR:
+ return "";
+
+ }
+ return this.name;
+ }
+
+
+
+
+
+ public string to_tooltip()
+ {
+
+ switch(this.ptype) {
+ case NodePropType.PROP:
+ return this.rtype + " " + this.name + " = \"" + this.val + "\"";
+ case NodePropType.LISTENER :
+ // thsi might look a bit odd on javascript?
+ return "on " + this.name + " " + this.val;
+
+ case NodePropType.RAW:
+ return this.rtype + " " + this.name + " = " + this.val;
+ case NodePropType.METHOD :
+ // functions - js FRED function () { } <<< could probably be cleaner..
+ // functions - vala FRED () { }
+ return this.rtype + " " + this.name + " " + this.val;
+ case NodePropType.SIGNAL :
+ return "signal: " + this.rtype + " " + this.name + " " + this.val;
+ case NodePropType.USER :
+ return "user defined: " + this.rtype + " " + this.name + " = " + this.val;
+
+ case NodePropType.SPECIAL:
+ return "special property: " + this.rtype + " " + this.name + " = " + this.val;
+
+ case NodePropType.NONE: // not used
+ case NodePropType.CTOR:
+ return "";
+ }
+ return this.name;
+
+
+ }
+
+ public string to_property_option_markup()
+ {
+ return "<b>" + this.name + "</b> <i>" + this.rtype + "</i>";
+ }
+
+ public string to_property_option_tooltip()
+ {
+ return this.to_property_option_markup(); // fixme will probaly want help info (possibly by havinga reference to the GirObject that its created from
+ }
+
+
+ public bool is(NodeProp comp) {
+ if (comp.ptype == NodePropType.LISTENER || this.ptype == NodePropType.LISTENER ) {
+ return comp.ptype == this.ptype && comp.name == this.name;
+ }
+ return comp.to_index_key() == this.to_index_key();
+
+ }
+
+
+ /*
+ public NodeProp.listenerfromjson(string str, string inval)
+ {
+ this.val = inval;
+ this.name = str;
+ this.ptype = NodePropType.LISTENER;
+ this.rtype = "";
+
+ }
+ */
+ // regular addition - should work for properties
+ public NodeProp.prop(string name, string rtype = "", string val = "")
+ {
+ this(name, NodePropType.PROP, rtype, val);
+ }
+ public NodeProp.raw(string name, string rtype = "", string val = "")
+ {
+ this(name, NodePropType.RAW, rtype, val);
+ }
+
+ public NodeProp.valamethod(string name, string rtype = "void", string val = "() {\n\n}")
+ {
+ this(name, NodePropType.METHOD, rtype, val);
+ }
+ public NodeProp.jsmethod(string name, string val = "function() {\n\n}")
+ {
+ this(name, NodePropType.METHOD, "", val);
+ }
+
+ // vala (and js) specials.. props etc.. - they only have name/value (not type) - type is in xns/xtype
+ public NodeProp.special(string name, string val = "")
+ {
+ this(name, NodePropType.SPECIAL, "", val);
+ }
+
+ public NodeProp.listener(string name, string val = "")
+ {
+ this(name, NodePropType.LISTENER, "", val);
+ }
+
+ public NodeProp.user(string name, string rtype = "", string val = "")
+ {
+ this(name, NodePropType.USER, rtype, val);
+ }
+ public NodeProp.sig(string name, string rtype = "void", string val = "()")
+ {
+ this(name, NodePropType.SIGNAL, rtype, val);
+ }
+
+}
+
\ No newline at end of file
}
if (!this.node.props.has_key("* pack") ||
- this.node.props.get("* pack").length < 1) {
+ this.node.props.get("* pack").val.length < 1) {
return;
}
var ns = this.parentObj.node.fqn().split(".")[0];
- var pack = this.node.props.get("* pack").split(",");
+ var pack = this.node.props.get("* pack").val.split(",");
// this tries to use the parameter names from the '*pack' function as properties in child_set_property.
// for a grid it's trying to do left/top/width/height.
var spad = this.pad.substring(0, this.pad.length-indent);
if (this.node.props.has_key("* xinclude")) {
- this.addLine("Roo.apply(" + this.node.props.get("* xinclude") + "._tree(), {",0 );
+ this.addLine("Roo.apply(" + this.node.props.get("* xinclude").val + "._tree(), {",0 );
} else {
this.addLine("{", 0);
var keys = new Gee.ArrayList<string>();
var piter = this.node.props.map_iterator();
while (piter.next() ) {
- string k;
- string ktype;
- string kflag;
- this.node.normalize_key(piter.get_key(), out k, out kflag, out ktype);
-
- keys.add(k);
+
+
+ keys.add( piter.get_key()); // since are keys are nice and clean now..
}
keys.sort(( a, b) => {
var has_cms = this.node.has("cms-id");
for (var i = 0; i< keys.size; i++) {
- var key = this.node.get_key(keys.get(i));
+ var prop = this.node.get_prop(keys.get(i));
//("ADD KEY %s\n", key);
- string k;
- string ktype;
- string kflag;
-
- this.node.normalize_key(key, out k, out kflag, out ktype);
-
-
- var v = this.node.get(key);
+ var k = prop.name;
+ var ktype = prop.rtype;
+ var kflag = prop.ptype;
+ var v = prop.val;
//if (this.skip.contains(k) ) {
//}
if ( Regex.match_simple("\\[\\]$", k)) {
// array .. not supported... here?
-
-
+
}
string leftv = k;
// skip builder stuff. prefixed with '.' .. just like unix fs..
- if (kflag == ".") { // |. or . -- do not output..
- continue;
- }
- if (kflag == "*") {
+ //if (kflag == ".") { // |. or . -- do not output..
+ // continue;
+ //}
+ if (kflag == NodePropType.SPECIAL) {
// ignore '* prop'; ???
continue;
}
}
// html must not be a dynamic property...
// note - we do not translate this either...
- if (has_cms && k == "html" && kflag != "$") {
+ if (has_cms && k == "html" && kflag != NodePropType.RAW) {
this.out_props.set("html", "Pman.Cms.content(" +
// next.. is it a function.. or a raw string..
if (
- kflag == "|"
+ kflag == NodePropType.METHOD
||
- kflag == "$"
+ kflag == NodePropType.RAW
||
- ktype == "function"
+ ktype == "function" // ??? why woudl return type be function? << messed up..
// ??? any others that are raw output..
) {
// doubleStringProps is a list of keys like 'name' 'title' etc.. that we know can be translated..
if ((this.doubleStringProps.index_of(k) > -1) ||
- (ktype.down() == "string" && k[0] == '_')
+ (ktype.down() == "string" && k[0] == '_') // strings starting with '_'
) {
// then use the translated version...
for (var i = 0; i< keys.size; i++) {
var key = keys.get(i);
- var val = this.node.listeners.get(key);
+ var val = this.node.listeners.get(key).val;
//
// Key = TYPE:name
var iter = this.node.props.map_iterator();
while (iter.next()) {
- var k = iter.get_key();
- if (this.shouldIgnore(k)) {
+
+ var prop = iter.get_value();
+
+ if (this.shouldIgnore(prop.name)) {
continue;
}
- var vv = k.strip().split(" ");
+
// user defined method
- if (vv[0] == "|") {
+ if (prop.ptype == NodePropType.METHOD) {
continue;
}
- if (vv[0] == "*") {
+ if (prop.ptype == NodePropType.SPECIAL) {
continue;
}
- if (vv[0] == "@") {
- this.node.setLine(this.cur_line, "p", k);
- this.addLine(this.pad + "public signal" + k.substring(1) + " " + iter.get_value() + ";");
+ if (prop.ptype == NodePropType.SIGNAL) {
+ this.node.setLine(this.cur_line, "p", prop.name);
+ this.addLine(this.pad + "public signal " + prop.name + " " + prop.val + ";");
- this.ignore(k);
- continue;
- }
- GLib.debug("Got myvars: %s", k.strip());
- var min = (vv[0] == "$" || vv[0] == "#") ? 3 : 2;
- if (vv.length < min) {
- // skip 'old js style properties without a type'
+ this.ignore(prop.name);
continue;
}
- var kname = vv[vv.length-1];
-
- if (this.shouldIgnore(kname)) {
+ GLib.debug("Got myvars: %s", prop.name.strip());
+
+ if (prop.rtype.strip().length < 1) {
continue;
}
// is it a class property...
- if (cls.props.has_key(kname) && vv[0] != "#") {
+ if (cls.props.has_key(prop.name) && prop.ptype != NodePropType.USER) {
continue;
}
- this.myvars.add(k);
- this.node.setLine(this.cur_line, "p", k);
+ this.myvars.add(prop.name);
+ prop.start_line = this.cur_line;
- this.addLine(this.pad + "public " +
- (k[0] == '$' || k[0] == '#' ? k.substring(2) : k ) + ";");
-
- this.ignore(k);
+ this.node.setLine(this.cur_line, "p", prop.name);
+
+ this.addLine(this.pad + "public " + prop.name + ";"); // definer - does not include value.
+
+
+ prop.end_line = this.cur_line;
+ this.ignore(prop.name);
}
var ar = k.strip().split(" ");
var kname = ar[ar.length-1];
- var v = this.node.props.get(k);
- // ignore signals..
+ var prop = this.node.props.get(k);
+
+ var v = prop.val.strip();
+
if (v.length < 1) {
continue;
}
+ // at this point start using
+
if (v == "FALSE" || v == "TRUE") {
- v = v.down();
+ v= v.down();
}
//FIXME -- check for raw string.. "string XXXX"
// if it's a string...
-
- this.addLine(this.ipad + "this." + kname + " = " + v +";");
+ prop.start_line = this.cur_line;
+ this.addLine(this.ipad + "this." + prop.name + " = " + v +";");
+ prop.end_line = this.cur_line;
}
}
{
var cls = Palete.Gir.factoryFqn((Project.Gtk) this.file.project, this.node.fqn());
if (cls == null) {
+ GLib.debug("Skipping wrapped properties - could not find class %s" , this.node.fqn());
return;
}
// what are the properties of this class???
continue;
}
- this.ignore(p);
- var v = this.node.get(p);
+ this.ignore(p);
- var nodekey = this.node.get_key(p);
+ var prop = this.node.get_prop(p);
+ var v = prop.val;
+
// user defined properties.
- if (nodekey[0] == '#') {
+ if (prop.ptype == NodePropType.USER) {
continue;
}
- var is_raw = nodekey[0] == '$';
+ var is_raw = prop.ptype == NodePropType.RAW;
// what's the type.. - if it's a string.. then we quote it..
if (iter.get_value().type == "string" && !is_raw) {
v += "f";
}
-
+ prop.start_line = this.cur_line;
this.addLine("%sthis.el.%s = %s;".printf(ipad,p,v)); // // %s, iter.get_value().type);
-
+ prop.end_line = this.cur_line;
// got a property..
var xargs = "";
if (ci.has("* args")) {
- var ar = ci.get("* args").split(",");
+ var ar = ci.get_prop("* args").val.split(",");
for (var ari = 0 ; ari < ar.length; ari++ ) {
var arg = ar[ari].split(" ");
xargs += "," + arg[arg.length -1];
this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
if (ci.has("* prop")) {
- this.addLine(ipad + "this.el." + ci.get("* prop") + " = child_" + "%d".printf(i) + ".el;");
+ this.addLine(ipad + "this.el." + ci.get_prop("* prop").val + " = child_" + "%d".printf(i) + ".el;");
continue;
}
// not sure why we have 'true' in pack?!?
- if (!ci.has("pack") || ci.get("pack").down() == "false" || ci.get("pack").down() == "true") {
+ if (!ci.has("* pack") || ci.get("* pack").down() == "false" || ci.get("* pack").down() == "true") {
continue;
}
string[] packing = { "add" };
- if (ci.has("pack")) {
- packing = ci.get("pack").split(",");
+ if (ci.has("* pack")) {
+ packing = ci.get("* pack").split(",");
}
var pack = packing[0];
var iter = this.node.listeners.map_iterator();
while (iter.next()) {
var k = iter.get_key();
- var v = iter.get_value();
+ var prop = iter.get_value();
+ var v = prop.val;
+ prop.start_line = this.cur_line;
this.node.setLine(this.cur_line, "l", k);
this.addMultiLine(this.ipad + "this.el." + k + ".connect( " +
this.padMultiline(this.ipad,v) +");");
-
+ prop.end_line = this.cur_line;
}
}
void addEndCtor()
// user defined functions...
var iter = this.node.props.map_iterator();
while(iter.next()) {
- var k = iter.get_key();
- if (this.shouldIgnore(k)) {
+ var prop = iter.get_value();
+ if (this.shouldIgnore(prop.name)) {
continue;
}
// HOW TO DETERIME if its a method?
- if (k[0] != '|') {
+ if (prop.ptype != NodePropType.METHOD) {
//strbuilder("\n" + pad + "// skip " + k + " - not pipe \n");
continue;
}
// function in the format of {type} (args) { .... }
- var kk = k.substring(2);
- var vv = iter.get_value();
- this.node.setLine(this.cur_line, "p", k);
- this.addMultiLine(this.pad + "public " + kk + " " + this.padMultiline(this.pad, vv));;
-
+
+
+
+ prop.start_line = this.cur_line;
+ this.node.setLine(this.cur_line, "p", prop.name);
+ this.addMultiLine(this.pad + "public " + prop.rtype + " " + prop.name + " " + this.padMultiline(this.pad, prop.val));;
+ prop.end_line = this.cur_line;
}
}
{
if (node.props.has_key("* xinclude")) {
- ret.add(node.props.get("* xinclude"));
+ ret.add(node.props.get("* xinclude").val);
}
for (var i =0; i < node.items.size; i++) {
this.findxincludes(node.items.get(i), ret);
// string XXX - with type
// $ XXX - with flag (no type)
// $ string XXX - with flag
- string kname;
- string ktype;
- string kflag;
- node.normalize_key(iter.get_key(), out kname, out kflag, out ktype);
- if (kflag == "$") {
+
+
+ var prop = iter.get_value();
+ var kname = prop.name;
+ var ktype = prop.rtype;
+
+
+ if (prop.ptype == NodePropType.RAW) {
continue;
}
// skip cms-id nodes...
if (kname == "html" && node.has("cms-id")) {
continue;
}
- var str = iter.get_value();
+ var str = prop.val;
if (kname == "name") {
name_prefix = str;
}
var chksum = GLib.Checksum.compute_for_string (ChecksumType.MD5, str.strip());
if (this.doubleStringProps.index_of(kname) > -1) {
- GLib.debug("flag=%s type=%s name=%s : %s\n", kflag,ktype,kname,str);
+ GLib.debug("flag=%s type=%s name=%s : %s\n", prop.ptype.to_string(),ktype,kname,str);
this.transStrings.set(str, chksum);
named.set("_" + kname, chksum);
continue;
}
if (ktype.down() == "string" && kname[0] == '_') {
- GLib.debug("flag=%s type=%s name=%s : %s\n", kflag,ktype,kname,str);
+ GLib.debug("flag=%s type=%s name=%s : %s\n", prop.ptype.to_string(),ktype,kname,str);
this.transStrings.set(str, chksum);
named.set(kname, chksum);
continue;
JsRender/JsonGen.vala \
JsRender/JsRender.vala \
JsRender/Lang.vala \
+ JsRender/NodeProp.vala \
JsRender/NodeToGtk.vala \
JsRender/NodeToJs.vala \
JsRender/NodeToVala.vala \
if (search.length < 2) {
return null;
}
-
+
// now do our magic..
var filtered_proposals = this.windowstate.file.palete().suggestComplete(
this.windowstate.file,
this.editor.node,
- this.editor.ptype,
- this.editor.key,
+ this.editor.prop,
search
);
public string ns;
public string propertyof;
public string type;
- public string nodetype;
+ public string nodetype; // eg. Signal / prop etc.
public string package;
public string direction; // used for vala in/out/ref...
public string value;
// to be filled in...
- public string sig;
+ public string sig; // signture (used to create event handlers)
public bool is_overlaid;
}
+
+
+ public JsRender.NodeProp toNodeProp()
+ {
+
+ if (this.nodetype.down() == "signal") { // gtk is Signal, roo is signal??
+ // when we add properties, they are actually listeners attached to signals
+ return new JsRender.NodeProp.listener(this.name, this.sig);
+ }
+ var def = "";
+ if (this.type == "bool") {
+ def = "true";
+ }
+ // if it's an enum?? can we fill in a default value?
+ // if it's an object type? use raw?
+
+ return new JsRender.NodeProp.prop(this.name, this.type); // signature?
+
+ }
+
/*
//public string fqtype() {
// return Gir.fqtypeLookup(this.type, this.ns);
}
- public override Gee.HashMap<string,GirObject> getPropertiesFor( string ename, string type)
+ public override Gee.HashMap<string,GirObject> getPropertiesFor( string ename, JsRender.NodePropType ptype)
{
//print("Loading for " + ename);
cls.overlayParent(this.project);
- switch (type) {
- case "props":
+ switch (ptype) {
+ case JsRender.NodePropType.PROP:
return cls.props;
- case "signals":
+ case JsRender.NodePropType.LISTENER:
return cls.signals;
- case "methods":
+ case JsRender.NodePropType.METHOD:
return cls.methods;
- case "ctors":
+ case JsRender.NodePropType.CTOR:
return cls.ctors;
default:
- throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + type);
+ throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + ptype.to_string());
//var ret = new Gee.HashMap<string,GirObject>();
//return ret;
inherits += node.fqn() + " ";
//print ("fillPack:Inherits : %s\n", inherits);
// parent.fqn() method ( node.fqn()
- var methods = this.getPropertiesFor (parent.fqn(), "methods");
+ var methods = this.getPropertiesFor (parent.fqn(), JsRender.NodePropType.METHOD);
var res = new Gee.HashMap<string,string>();
var map = methods.map_iterator();
return ;
}
if (res.has_key("pack_start")) {
- node.props.set("* pack", res.get("pack_start"));
+ node.set_prop(new JsRender.NodeProp.special("pack", res.get("pack_start")));
return;
}
if (res.has_key("add")) {
- node.props.set("* pack", res.get("add"));
- return;
+ node.set_prop(new JsRender.NodeProp.special("pack", res.get("add")));
+ return;
}
var riter = res.map_iterator();
while(riter.next()) {
- node.props.set("* pack", riter.get_value());
+ node.set_prop(new JsRender.NodeProp.special("pack", riter.get_value()));
return;
}
public override List<SourceCompletionItem> suggestComplete(
JsRender.JsRender file,
JsRender.Node? node,
- string proptype,
- string key,
+ JsRender.NodeProp? xxxprop, // is this even used?
string complete_string
) {
return ret;
}
if (cls.props.has_key(parts[i])) {
- var prop = cls.props.get(parts[i]);
- if (prop.type.index_of(".",0) > -1) {
+ var clsprop = cls.props.get(parts[i]);
+ if (clsprop.type.index_of(".",0) > -1) {
// type is another roo object..
- curtype = prop.type;
+ curtype = clsprop.type;
prevbits += parts[i] + ".";
continue;
}
var citer = cls.methods.map_iterator();
while (citer.next()) {
- var prop = citer.get_value();
+ var cprop = citer.get_value();
// does the name start with ...
- if (parts[i].length > 0 && prop.name.index_of(parts[i],0) != 0) {
+ if (parts[i].length > 0 && cprop.name.index_of(parts[i],0) != 0) {
continue;
}
// got a matching property...
// return type?
ret.append(new SourceCompletionItem (
- prop.name + prop.sig + " : ("+ prop.propertyof + ")",
- prevbits + prop.name + "(",
+ cprop.name + cprop.sig + " : ("+ cprop.propertyof + ")",
+ prevbits + cprop.name + "(",
null,
- prop.doctxt));
+ cprop.doctxt));
}
// get the properties / methods and subclasses.. of cls..
// we have cls.. - see if the string matches any of the properties..
citer = cls.props.map_iterator();
while (citer.next()) {
- var prop = citer.get_value();
+ var cprop = citer.get_value();
// does the name start with ...
- if (parts[i].length > 0 && prop.name.index_of(parts[i],0) != 0) {
+ if (parts[i].length > 0 && cprop.name.index_of(parts[i],0) != 0) {
continue;
}
// got a matching property...
ret.append(new SourceCompletionItem (
- prop.name + " : " + prop.type + " ("+ prop.propertyof + ")",
- prevbits + prop.name,
+ cprop.name + " : " + cprop.type + " ("+ cprop.propertyof + ")",
+ prevbits + cprop.name,
null,
- prop.doctxt));
+ cprop.doctxt));
}
public void validateVala(
WindowState state,
string code,
- string property,
- string ptype,
+ JsRender.NodeProp prop,
JsRender.JsRender file,
JsRender.Node node
)
state.valasource.checkFileWithNodePropChange(
file,
node,
- property,
- ptype,
+ prop,
code
);
public bool javascriptHasErrors(
WindowState state,
string code,
- string property,
- string ptype,
+ JsRender.NodeProp? prop, // null if you are testing a whole file.
JsRender.JsRender file,
out Gee.HashMap<int,string> errors
)
{
- print("validate code (%s) ptype=%s property=%s\n", file.language, ptype, property);
+ // print("validate code (%s) ptype=%s property=%s\n", file.language, ptype, property);
errors = new Gee.HashMap<int,string>();
if (file.language != "js") {
return false;
}
- if (ptype != "listener" && property.length > 0 && property[0] == '|') {
+ // only check listeners and methods?
+ if (prop != null && prop.ptype != JsRender.NodePropType.LISTENER && prop.ptype != JsRender.NodePropType.METHOD ) {
return false;
}
//var cd = new JSCore.ClassDefinitionEmpty();
//print("TESTING CODE %s\n", code);
string errmsg;
- var testcode = ptype == "file" ? code : "var __aaa___ = " + code;
+ var testcode = prop == null ? code : "var __aaa___ = " + code;
var line = Javascript.singleton().validate(
testcode, out errmsg);
if (line > -1) {
- if (ptype == "file") {
+ if (prop == null) {
var err = new Json.Object();
err.set_int_member("ERR-TOTAL", 1);
var files_obj = new Json.Object();
- if (ptype == "file") {
+ if (prop == null) {
return this.javascriptHasCompressionErrors(file, state, code);
}
print("no errors\n");
public abstract void fillPack(JsRender.Node node,JsRender.Node parent);
public abstract void load();
- public abstract Gee.HashMap<string,GirObject> getPropertiesFor(string ename, string type);
+ public abstract Gee.HashMap<string,GirObject> getPropertiesFor(string ename, JsRender.NodePropType ptype);
public abstract GirObject? getClass(string ename);
public abstract bool typeOptions(string fqn, string key, string type, out string[] opts);
public abstract List<SourceCompletionItem> suggestComplete(
JsRender.JsRender file,
JsRender.Node? node,
- string proptype,
- string key,
+ JsRender.NodeProp? prop,
string complete_string
);
public abstract string[] getChildList(string in_rval);
if (prop.propertyof.length < 1) {
prop.propertyof = cls.name;
}
+
+ // this is the function default.
prop.sig = o.has_member("sig") ? o.get_string_member("sig") : "";
if (o.has_member("optvals") ) {
}
- public override Gee.HashMap<string,GirObject> getPropertiesFor(string ename, string type)
+ public override Gee.HashMap<string,GirObject> getPropertiesFor(string ename, JsRender.NodePropType ptype)
{
//print("Loading for " + ename);
//cls.overlayParent();
- switch (type) {
+ switch (ptype) {
- case "props":
+ case JsRender.NodePropType.PROP:
return cls.props;
- case "signals":
+ case JsRender.NodePropType.LISTENER:
return cls.signals;
- case "methods":
+ case JsRender.NodePropType.METHOD:
return ret;
- case "ctors":
+ case JsRender.NodePropType.CTOR:
return ret;
default:
- throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + type);
+ throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + ptype.to_string());
//var ret = new Gee.HashMap<string,GirObject>();
//return ret;
return true;
}
- var props = this.getPropertiesFor(fqn, "props");
+ var props = this.getPropertiesFor(fqn, JsRender.NodePropType.PROP);
if (!props.has_key(key)) {
print("prop %s does not have key %s\n", fqn, key);
return false;
public override List<SourceCompletionItem> suggestComplete(
JsRender.JsRender file,
JsRender.Node? node,
- string proptype,
- string key,
+ JsRender.NodeProp? xxprop,
string complete_string
) {
JsRender.JsRender file,
JsRender.Node node,
- string prop,
- string ptype,
+ JsRender.NodeProp prop,
string val
)
{
}
- var hash = ptype == "listener" ? node.listeners : node.props;
+ var hash = prop.ptype == JsRender.NodePropType.LISTENER ? node.listeners : node.props;
// untill we get a smarter renderer..
// we have some scenarios where changing the value does not work
- if (prop == "* xns" || prop == "xtype") {
+ if (prop.name == "xns" || prop.name == "xtype") {
return false;
}
+
+ var old = prop.val;
- var old = hash.get(prop);
- var newval = "/*--VALACHECK-START--*/ " + val ;
+
+ prop.val = "/*--VALACHECK-START--*/ " + prop.val ;
- hash.set(prop, newval);
+
var tmpstring = JsRender.NodeToVala.mungeFile(file);
- hash.set(prop, old);
+ prop.val = old;
+
//print("%s\n", tmpstring);
var bits = tmpstring.split("/*--VALACHECK-START--*/");
var offset =0;
#endif
+ var retval = "";
+
if (dt != null) {
//print("creating return type on signal %s\n", sig.name);
var cc = new GirObject("Return", "return-value");
cc.ns = c.ns;
cc.type = dt.get_full_name();
c.return_value = cc;
+
+ retval = "\treturn " + cc.type +";";
}
parent.signals.set(sig.name,c);
var params = sig.get_parameters() ;
if (params.size < 1) {
+
+ c.sig = "( ) => {\n\n"+ retval + "\n}\n";
+
return;
}
var cc = new GirObject("Paramset",sig.name); // what's the name on this?
cc.ns = c.ns;
c.paramset = cc;
-
+ var args = "";
foreach(var p in params) {
this.add_param(cc, p);
+ args += args.length > 0 ? ", " : "";
+ args += p.name;
}
+ // add c.sig -> this is the empty
+ c.sig = "(" + args + ") => {\n\n"+ retval + "\n}\n";
+
+
}