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\tel.append(out iter);",
116 "\t\tel.set(iter, 0, JsRender.NodePropType.METHOD, 1, \"User defined method\", -1);",
118 "\t\tel.append(out iter);",
119 "\t\tel.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, \"(*) Special property (eg. prop )\", -1);",
123 "\t// set selected, based on arg",
124 "\tel.foreach((tm, tp, titer) => {",
125 "\t\tGLib.Value val;",
126 "\t\tel.get_value(titer, 0, out val);",
128 "\t\t//print(\"check %s against %s\\n\", (string)val, _this.prop.ptype);",
129 "\t\tif (((JsRender.NodePropType)val) == prop.ptype) {",
130 "\t\t\t_this.kflag.el.set_active_iter(titer);",
131 "\t\t\treturn true;",
149 "Gtk.Align halign" : "Gtk.Align.START",
150 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
151 "int margin_top" : 12,
152 "label" : "Type or Return Type",
167 "Gtk.Align halign" : "Gtk.Align.START",
168 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
169 "int margin_top" : 12,
171 "tooltip_text" : "center, north, south, east, west",
181 "focus_out_event" : [
183 "\t_this.error.setError(\"\");",
184 "\tvar val = this.el.get_text().strip(); ",
185 "\tif (val.length < 1) {",
186 "\t\t_this.error.setError(\"Name can not be empty\");",
193 "key_release_event" : [
195 "\t_this.error.setError(\"\");",
196 "\tvar val = this.el.get_text().strip(); ",
197 "\tif (val.length < 1) {",
198 "\t\t_this.error.setError(\"Name can not be empty\");",
212 "Gtk.Align halign" : "Gtk.Align.START",
213 "Gtk.Justification justify" : "Gtk.Justification.LEFT",
214 "bool use_markup" : true,
216 "int margin_top" : 0,
217 "label" : "<span color=\"red\">Error Message</span>",
218 "tooltip_text" : "center, north, south, east, west",
221 "| void setError" : [
223 "\tif (err == \"\") {",
224 "\t\tthis.el.hide();",
226 "\t\tthis.el.show();",
228 "\t\tthis.el.label = \"<span color=\\\"red\\\">\" + err + \"</span>\";",
237 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
239 "int margin_top" : 20,
244 "bool always_show_image" : true,
245 "bool hexpand" : true,
249 "* pack" : "composite_name",
251 "string icon_name" : "window-close",
259 "\t_this.prop = null;",
260 "\t_this.is_new = false;",
261 "\t_this.kname.el.set_text(\"Cancel\");",
262 "\t_this.el.hide();",
267 "string label" : "Cancel",
273 "bool always_show_image" : true,
274 "bool hexpand" : true,
279 "string icon_name" : "list-add",
286 "\t// check if text is not empty..",
287 "\tif ( _this.kname.el.get_text().strip().length < 1) {",
288 "\t\t// error should already be showing?",
291 "\t_this.updateProp();",
293 "\t// since we can't add listeners?!?!?",
294 "\t// only check props.",
295 "\t// check if property already exists in node.\t",
296 "\tvar prop = _this.prop;",
297 "\tif (_this.node.props.has_key(prop.to_index_key())) {",
298 "\t\t_this.error.setError(\"Property already exists\");",
304 "\t_this.is_new = false;\t",
307 "\t_this.prop = null; // skip checks..",
308 "\t_this.el.hide();",
311 "\t// trigger editing of property.",
312 "\t// allow hide to work?",
313 "\twhile (Gtk.events_pending()) {",
314 "\t\tGtk.main_iteration();",
317 "\t_this.mainwindow.windowstate.left_props.addProp(prop);\t\t",
323 "string label" : "Add Property",
337 " \tGLib.debug(\"popover closed\");",
338 "\tif (_this.is_new) {",
339 "\t\t// dont allow hiding if we are creating a new one.",
340 "\t\t// on.hide will reshow it.",
343 "\tif (_this.prop == null) {",
344 "\t\t// hide and dont update.",
347 "\tif (this.kname.el.get_text().strip().length < 1) {",
351 "\tvar oldkey = this.prop.to_index_key();\t",
354 " \tthis.updateProp();",
356 " \tvar newkey = this.prop.to_index_key();\t",
357 " \tif (oldkey != newkey) {",
359 " \t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
360 " \t\t\tthis.node.listeners.unset(oldkey);",
361 " \t\t\tthis.node.listeners.set(newkey, _this.prop);",
363 " \t\t\tthis.node.props.unset(oldkey);",
364 " \t\t\tthis.node.props.set(newkey, _this.prop);",
368 "\t_this.mainwindow.windowstate.left_props.reload();",
376 " \tGLib.debug(\"popover hidden\");",
377 "\tif (_this.is_new || this.kname.el.get_text().strip().length < 1) {",
378 "\t\t// dont allow hiding if we are creating a new one.",
379 "\t\tGLib.debug(\"prevent hiding as its new or text is empty\"); ",
380 "\t\tthis.el.show_all();",
388 "string key_type" : "",
389 "string old_keyname" : "",
390 "uint border_width" : 0,
394 "\tGtk.Widget btn, ",
395 "\tJsRender.Node node, ",
396 "\tJsRender.NodeProp prop, ",
398 "\tbool is_new = false",
403 "\tthis.is_new = is_new; ",
404 "\tvar pref = is_new ? \"Add \" : \"Modify \";",
405 "\tif (prop.ptype == JsRender.NodePropType.LISTENER) {",
406 "\t\tthis.header.el.title = pref + \"Event Listener\"; // cant really happen yet?",
408 "\t\tthis.header.el.title = pref + \"Property\";",
410 "\tthis.prop = prop;",
411 "\tthis.node = node;",
413 "\t_this.kname.el.set_text(prop.name);",
414 "\t_this.ktype.el.set_text(prop.rtype);",
416 "\t_this.dbmodel.loadData(prop );",
417 "\t// does node have this property...",
420 "\t_this.node = node;",
421 "\t//console.log('show all');",
422 "\tthis.el.set_modal(true);",
423 "\tthis.el.set_relative_to(btn);",
427 "\t\tvar r = Gdk.Rectangle() {",
428 "\t\t\tx = btn.get_allocated_width(), // align left...",
433 "\t\tthis.el.set_pointing_to( r);",
438 "\t//this.el.set_position(Gtk.PositionType.TOP);",
440 "\t// window + header?",
441 "\t print(\"SHOWALL - POPIP\\n\");",
442 "\tthis.el.show_all();",
443 "\tthis.kname.el.grab_focus();",
444 "\tthis.buttonbar.el.hide();",
445 "\tif (this.is_new) {",
446 "\t\tthis.buttonbar.el.show();",
448 "\t this.error.setError(\"\");",
450 "\t//this.success = c.success;",
454 "| void updateProp" : [
457 "\tGtk.TreeIter citer;",
458 "\tGLib.Value gval;",
459 "\tthis.kflag.el.get_active_iter(out citer);",
460 "\tthis.dbmodel.el.get_value(citer, 0, out gval);",
463 "\t_this.prop.name = this.kname.el.get_text().strip(); ",
464 "\t_this.prop.rtype = this.ktype.el.get_text().strip(); ",
465 "\t_this.prop.ptype = (JsRender.NodePropType) gval;",
473 "name" : "PopoverProperty",
475 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverProperty.bjs",