2 "build_module" : "builder",
5 "# JsRender.NodeProp? prop" : "",
7 "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
8 "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
9 "JsRender.Node node" : "",
10 "Xcls_MainWindow mainwindow" : "null",
12 "bool is_new" : false,
14 "id" : "PopoverProperty",
19 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
20 "bool homogeneous" : false,
24 "* pack" : "pack_start,false,true,0",
26 "string title" : "Modify / Create Property",
32 "Gtk.Align halign" : "Gtk.Align.START",
33 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
34 "int margin_top" : 12,
35 "label" : "Special Flags",
41 "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
47 "* pack" : "pack_start,true",
48 "id" : "dbcellrenderer",
49 "xtype" : "CellRendererText"
52 "$ columns" : "typeof(JsRender.NodePropType),typeof(string)",
54 "* pack" : "set_model",
57 "xtype" : "ListStore",
59 " (JsRender.NodeProp prop) {",
61 " Gtk.TreeIter iter;",
65 " // vala signal.. '@'",
67 " // user defined property '#'",
68 " // user defined method '|'",
69 " // special property '*' => prop |args|ctor|init",
73 " /// el.append(out iter);",
76 " // el.set_value(iter, 0, \"\");",
77 " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
80 "\tif (prop.ptype == JsRender.NodePropType.LISTENER) { ",
81 "\t\tel.append(out iter);",
82 "\t\tel.set(iter, 0, JsRender.NodePropType.LISTENER, 1, \"Event Handler / Listener\", -1);",
84 "\telse if (_this.mainwindow.windowstate.file.xtype == \"Gtk\") {",
85 "\t\t el.append(out iter);",
86 "\t el.set(iter, 0, JsRender.NodePropType.PROP, 1, \"Normal Property\", -1);",
89 "\t\tel.append(out iter);",
90 "\t\tel.set(iter, 0, JsRender.NodePropType.RAW, 1, \"Raw Property (not escaped)\", -1);",
93 "\t\tel.append(out iter);",
94 "\t\tel.set(iter, 0, JsRender.NodePropType.USER, 1, \"User defined property\", -1);",
96 "\t\tel.append(out iter);",
97 "\t\tel.set(iter, 0, JsRender.NodePropType.METHOD, 1, \"User defined method\", -1);",
99 "\t\tel.append(out iter);",
100 "\t\tel.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, \"Special property (eg. prop | args | ctor | init )\", -1);",
103 "\t\tel.append(out iter);",
104 "\t el.set(iter, 0, JsRender.NodePropType.SIGNAL, 1, \"Vala Signal\", -1);",
109 "\t el.append(out iter);",
110 "\t el.set(iter, 0, JsRender.NodePropType.PROP, 1, \"Normal Property\", -1);",
112 "\t\tel.append(out iter);",
113 "\t\tel.set(iter, 0, JsRender.NodePropType.RAW, 1, \"Raw Property (not escaped)\", -1);",
115 "\t\t// we appear to still use this?!? (builderCfg?)",
116 "\t\tel.append(out iter);",
117 "\t\tel.set(iter, 0, JsRender.NodePropType.USER, 1, \"User defined property\", -1);",
120 "\t\tel.append(out iter);",
121 "\t\tel.set(iter, 0, JsRender.NodePropType.METHOD, 1, \"User defined method\", -1);",
123 "\t\tel.append(out iter);",
124 "\t\tel.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, \"(*) Special property (eg. prop )\", -1);",
128 "\t// set selected, based on arg",
129 "\tel.foreach((tm, tp, titer) => {",
130 "\t\tGLib.Value val;",
131 "\t\tel.get_value(titer, 0, out val);",
133 "\t\t//print(\"check %s against %s\\n\", (string)val, _this.prop.ptype);",
134 "\t\tif (((JsRender.NodePropType)val) == prop.ptype) {",
135 "\t\t\t_this.kflag.el.set_active_iter(titer);",
136 "\t\t\treturn true;",
154 "Gtk.Align halign" : "Gtk.Align.START",
155 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
156 "int margin_top" : 12,
157 "label" : "Type or Return Type",
172 "Gtk.Align halign" : "Gtk.Align.START",
173 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
174 "int margin_top" : 12,
176 "tooltip_text" : "center, north, south, east, west",
186 "focus_out_event" : [
188 "\t_this.error.setError(\"\");",
189 "\tvar val = this.el.get_text().strip(); ",
190 "\tif (val.length < 1) {",
191 "\t\t_this.error.setError(\"Name can not be empty\");",
198 "key_release_event" : [
200 "\t_this.error.setError(\"\");",
201 "\tvar val = this.el.get_text().strip(); ",
202 "\tif (val.length < 1) {",
203 "\t\t_this.error.setError(\"Name can not be empty\");",
217 "Gtk.Align halign" : "Gtk.Align.START",
218 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
219 "bool use_markup" : true,
221 "int margin_top" : 0,
222 "label" : "<span color=\"red\">Error Message</span>",
223 "tooltip_text" : "center, north, south, east, west",
226 "| void setError" : [
228 "\tif (err == \"\") {",
229 "\t\tthis.el.hide();",
231 "\t\tthis.el.show();",
233 "\t\tthis.el.label = \"<span color=\\\"red\\\">\" + err + \"</span>\";",
242 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
244 "int margin_top" : 20,
249 "bool always_show_image" : true,
250 "bool hexpand" : true,
254 "* pack" : "composite_name",
256 "string icon_name" : "window-close",
264 "\t_this.prop = null;",
265 "\t_this.is_new = false;",
266 "\t_this.kname.el.set_text(\"Cancel\");",
267 "\t_this.el.hide();",
272 "string label" : "Cancel",
278 "bool always_show_image" : true,
279 "bool hexpand" : true,
284 "string icon_name" : "list-add",
291 "\t// check if text is not empty..",
292 "\tif ( _this.kname.el.get_text().strip().length < 1) {",
293 "\t\t// error should already be showing?",
296 "\t_this.updateProp();",
298 "\t// since we can't add listeners?!?!?",
299 "\t// only check props.",
300 "\t// check if property already exists in node.\t",
301 "\tvar prop = _this.prop;",
302 "\tif (_this.node.props.has_key(prop.to_index_key())) {",
303 "\t\t_this.error.setError(\"Property already exists\");",
309 "\t_this.is_new = false;\t",
312 "\t_this.prop = null; // skip checks..",
313 "\t_this.el.hide();",
316 "\t// trigger editing of property.",
317 "\t// allow hide to work?",
318 "\twhile (Gtk.events_pending()) {",
319 "\t\tGtk.main_iteration();",
322 "\t_this.mainwindow.windowstate.left_props.addProp(prop);\t\t",
328 "string label" : "Add Property",
342 " \tGLib.debug(\"popover closed\");",
343 "\tif (_this.is_new) {",
344 "\t\t// dont allow hiding if we are creating a new one.",
345 "\t\t// on.hide will reshow it.",
348 "\tif (_this.prop == null) {",
349 "\t\t// hide and dont update.",
352 "\tif (this.kname.el.get_text().strip().length < 1) {",
356 "\tvar oldkey = this.prop.to_index_key();\t",
359 " \tthis.updateProp();",
361 " \tvar newkey = this.prop.to_index_key();\t",
362 " \tif (oldkey != newkey) {",
364 " \t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
365 " \t\t\tthis.node.listeners.unset(oldkey);",
366 " \t\t\tthis.node.listeners.set(newkey, _this.prop);",
368 " \t\t\tthis.node.props.unset(oldkey);",
369 " \t\t\tthis.node.props.set(newkey, _this.prop);",
373 "\t_this.mainwindow.windowstate.left_props.reload();",
381 " \tGLib.debug(\"popover hidden\");",
382 "\tif (_this.is_new || this.kname.el.get_text().strip().length < 1) {",
383 "\t\t// dont allow hiding if we are creating a new one.",
384 "\t\tGLib.debug(\"prevent hiding as its new or text is empty\"); ",
385 "\t\tthis.el.show_all();",
393 "string key_type" : "",
394 "string old_keyname" : "",
395 "uint border_width" : 0,
399 "\tGtk.Widget btn, ",
400 "\tJsRender.Node node, ",
401 "\tJsRender.NodeProp prop, ",
403 "\tbool is_new = false",
408 "\tthis.is_new = is_new; ",
409 "\tvar pref = is_new ? \"Add \" : \"Modify \";",
410 "\tif (prop.ptype == JsRender.NodePropType.LISTENER) {",
411 "\t\tthis.header.el.title = pref + \"Event Listener\"; // cant really happen yet?",
413 "\t\tthis.header.el.title = pref + \"Property\";",
415 "\tthis.prop = prop;",
416 "\tthis.node = node;",
418 "\t_this.kname.el.set_text(prop.name);",
419 "\t_this.ktype.el.set_text(prop.rtype);",
421 "\t_this.dbmodel.loadData(prop );",
422 "\t// does node have this property...",
425 "\t_this.node = node;",
426 "\t//console.log('show all');",
427 "\tthis.el.set_modal(true);",
428 "\tthis.el.set_relative_to(btn);",
432 "\t\tvar r = Gdk.Rectangle() {",
433 "\t\t\tx = btn.get_allocated_width(), // align left...",
438 "\t\tthis.el.set_pointing_to( r);",
443 "\t//this.el.set_position(Gtk.PositionType.TOP);",
445 "\t// window + header?",
446 "\t print(\"SHOWALL - POPIP\\n\");",
447 "\tthis.el.show_all();",
448 "\tthis.kname.el.grab_focus();",
449 "\tthis.buttonbar.el.hide();",
450 "\tif (this.is_new) {",
451 "\t\tthis.buttonbar.el.show();",
453 "\t this.error.setError(\"\");",
455 "\t//this.success = c.success;",
459 "| void updateProp" : [
462 "\tGtk.TreeIter citer;",
463 "\tGLib.Value gval;",
464 "\tthis.kflag.el.get_active_iter(out citer);",
465 "\tthis.dbmodel.el.get_value(citer, 0, out gval);",
468 "\t_this.prop.name = this.kname.el.get_text().strip(); ",
469 "\t_this.prop.rtype = this.ktype.el.get_text().strip(); ",
470 "\t_this.prop.ptype = (JsRender.NodePropType) gval;",
478 "name" : "PopoverProperty",
480 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverProperty.bjs",