2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# JsRender.JsRender file" : "",
7 "# JsRender.Node node" : "",
8 "# Xcls_MainWindow main_window" : "null",
9 "# bool allow_edit" : false,
10 "$ homogeneous" : "false ",
12 "@ bool stop_editor" : "()",
13 "@ void changed" : "()",
14 "@ void show_add_props" : "(string type)",
15 "@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop)",
16 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
17 "bool hexpand" : true,
18 "bool loading" : false,
19 "bool vexpand" : true,
24 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
25 "bool hexpand" : true,
30 "int margin_start" : 5,
31 "string label" : "Add:",
35 "$ tooltip_text" : "\"Add Property\"",
37 "bool always_show_image" : true,
38 "bool hexpand" : true,
43 " _this.main_window.windowstate.showProps(",
45 " \t\tJsRender.NodePropType.PROP",
51 "string icon_name" : "format-justify-left",
52 "string label" : "Property",
56 "$ tooltip_text" : "\"Add Event Code\"",
58 "bool always_show_image" : true,
59 "bool hexpand" : true,
65 " _this.main_window.windowstate.showProps(",
66 " \t\t_this.view.el, ",
67 " \t\tJsRender.NodePropType.LISTENER",
74 "string icon_name" : "appointment-new",
75 "string label" : "Event",
80 "bool always_show_image" : true,
81 "bool hexpand" : true,
86 "bool autohide" : true,
87 "id" : "AddPropertyPopup",
92 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
97 "label" : "id: _this.{ID} (Vala)",
101 " \t_this.AddPropertyPopup.el.hide();",
102 " \t// is this userdef or special??",
103 " \tvar add = new JsRender.NodeProp.prop(\"id\");",
104 " \tif (_this.node.has_prop_key(add)) {",
108 " \t_this.node.add_prop( add );",
110 " \t_this.view.editProp( add );",
116 "tooltip_markup" : "Using _this.{ID} will map to this element",
121 "label" : "pack: Pack method (Vala)",
127 "\t_this.AddPropertyPopup.el.hide();",
128 " \t// is this userdef or special??",
129 " \tvar add = new JsRender.NodeProp.special(\"pack\", \"add\");",
130 " \tif (_this.node.has_prop_key(add)) {",
134 " \t_this.node.add_prop( add );",
136 " \t_this.view.editProp( add );",
142 "tooltip_markup" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
147 "label" : "ctor: Alterative to default contructor (Vala)",
152 " _this.AddPropertyPopup.el.hide();",
153 " \t// is this userdef or special??",
154 " \tvar add = new JsRender.NodeProp.special(\"ctor\");",
155 " \tif (_this.node.has_prop_key(add)) {",
159 " \t_this.node.add_prop( add );",
161 " \t_this.view.editProp( add );",
169 "new Clutter.Image.from_file(.....)"
175 "label" : "init: initialziation code (vala)",
180 " _this.AddPropertyPopup.el.hide();",
181 " \t// is this userdef or special??",
182 " \tvar add = new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) ;",
183 " \tif (_this.node.has_prop_key(add)) {",
187 " \t_this.node.add_prop( add );",
189 " \t_this.view.editProp( add );",
193 "tooltip_markup" : "This code is called after the ctor",
198 "label" : "cms-id: (Roo JS/Pman library)",
203 " _this.AddPropertyPopup.el.hide();",
204 " \t// is this userdef or special??",
205 " \tvar add = new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) ;",
206 " \tif (_this.node.has_prop_key(add)) {",
210 " \t_this.node.add_prop( add );",
212 " \t_this.view.editProp( add );",
218 "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})",
224 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
226 "xtype" : "Separator"
234 " _this.AddPropertyPopup.el.hide();",
235 "\t_this.view.popover.show(",
236 "\t\t_this.view.el, ",
238 "\t\t new JsRender.NodeProp.prop(\"\", \"string\", \"\") ,",
246 "tooltip_markup" : "Add a user defined string property",
255 " _this.AddPropertyPopup.el.hide();",
257 " _this.view.popover.show(",
258 "\t\t_this.view.el, ",
260 "\t\t new JsRender.NodeProp.prop(\"\", \"int\", \"0\") ,",
268 "tooltip_markup" : "Add a user defined number property",
278 " \t _this.AddPropertyPopup.el.hide();",
279 " _this.view.popover.show(",
280 "\t\t_this.view.el, ",
282 "\t\t new JsRender.NodeProp.prop(\"\", \"bool\", \"true\") ,",
290 "tooltip_markup" : "Add a user defined boolean property",
294 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
296 "xtype" : "Separator"
300 "label" : "Javascript Function",
304 " _this.AddPropertyPopup.el.hide(); ",
305 " _this.view.popover.show(",
306 "\t\t_this.view.el, ",
308 "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
317 "tooltip_markup" : "Add a user function boolean property",
322 "label" : "Vala Method",
326 "_this.AddPropertyPopup.el.hide();",
327 " _this.view.popover.show(",
328 "\t\t_this.view.el, ",
330 "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
337 "tooltip_markup" : "Add a user function boolean property",
342 "label" : "Vala Signal",
346 " _this.AddPropertyPopup.el.hide();",
347 " _this.view.popover.show(",
348 "\t\t_this.view.el, ",
350 "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
357 "tooltip_markup" : "Add a vala signal",
361 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
363 "xtype" : "Separator"
367 "label" : "Flexy - If",
371 " \t_this.AddPropertyPopup.el.hide();",
372 " \t_this.view.popover.show(",
373 "\t\t_this.view.el, ",
375 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
384 "tooltip_markup" : "Add a flexy if (for HTML templates)",
389 "label" : "Flexy - Include",
393 " \t_this.AddPropertyPopup.el.hide();",
394 " \t_this.view.popover.show(",
395 "\t\t_this.view.el, ",
397 "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
406 "tooltip_markup" : "Add a flexy include (for HTML templates)",
411 "label" : "Flexy - Foreach",
415 " \t_this.AddPropertyPopup.el.hide();",
416 " \t_this.view.popover.show(",
417 "\t\t_this.view.el, ",
419 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
427 "tooltip_markup" : "Add a flexy include (for HTML templates)",
440 " //_this.before_edit();",
443 " var p = _this.AddPropertyPopup;",
445 " //\tGtk.Allocation rect;",
446 "\t//this.el.get_allocation(out rect);",
447 "\tif (p.el.parent == null) {",
448 "\t\t p.el.set_parent(this.el);",
450 " //p.el.set_pointing_to(rect);",
452 "\tp.el.set_position(Gtk.PositionType.BOTTOM);",
453 "\tp.el.autohide = true;",
460 "string icon_name" : "list-add",
461 "string label" : "Other",
468 "# bool editing" : false,
469 "$ shadow_type" : "Gtk.ShadowType.IN",
474 " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
478 "bool hexpand" : true,
479 "bool vexpand" : true,
483 "$ enable_tree_lines" : true,
484 "$ headers_visible" : true,
489 " \tthis.css = new Gtk.CssProvider();",
491 "\t\tthis.css.load_from_string(\"",
492 "#leftprops-view { font-size: 12px;}",
494 "#leftprops-view dropdown button { ",
495 "\t\t\tmin-height: 16px;\t\t\t ",
496 "\t\t\toutline-offset : 0;",
498 "#leftprops-view cell dropdown label {",
499 " \t\tpadding-top:0px;",
500 "\t\tpadding-bottom:0px;",
502 "#leftprops-view cell { ",
503 " \t\tpadding-top:2px;",
504 "\t\tpadding-bottom:2px;",
506 "#leftprops-view cell label, #leftprops-view cell editablelable {",
507 " \t\tpadding-top:4px;",
508 "\t\tpadding-bottom:4px;",
511 "\t\tGtk.StyleContext.add_provider_for_display(",
512 "\t\tthis.el.get_display(),",
514 "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
521 "* pack" : "set_child",
522 "Gtk.CssProvider css" : "",
523 "Xcls_PopoverProperty popover" : "null",
524 "bool hexpand" : true,
525 "bool show_row_separators" : true,
526 "bool single_click_activate" : false,
527 "bool vexpand" : true,
538 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
548 "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
550 "\t_this.deletemenu.el.hide();",
551 "\t_this.node.remove_prop(n);",
556 "string label" : "Delete",
569 "(n_press, in_x, in_y) => {",
571 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
573 "\tvar col = _this.view.getColAt(in_x, in_y);",
578 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
584 "\tGLib.debug(\"hit row %d\", row);",
585 "\tvar prop = _this.selmodel.getPropAt(row);",
586 "\t_this.selmodel.selectProp(prop);",
588 "\t//var point_at = _this.view.getWidgetAtRow(row);",
590 "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
591 " \t// or popover might be trying to do a central?",
592 "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
593 " \t _this.stop_editor();",
594 " _this.view.popover.show(",
595 " \t\t\t_this.view.el, ",
596 " \t\t\t_this.node, prop, ",
605 "xtype" : "GestureClick"
611 "(n_press, in_x, in_y) => {",
616 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
623 "\t_this.stop_editor();",
624 "\tGLib.debug(\"hit row %d\", row);",
625 "\tvar prop = _this.selmodel.getPropAt(row);",
626 "\t_this.selmodel.selectProp(prop);",
630 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
631 "\t//_this.deletemenu.el.set_parent(_this.view.el);",
632 "\tif (_this.deletemenu.el.parent == null) {",
633 "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
638 "\t_this.deletemenu.el.set_offset(",
639 "\t\t\t(int)in_x - _this.view.el.get_width() ,",
640 "\t\t\t(int)in_y - _this.view.el.get_height()",
642 "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
643 " _this.deletemenu.el.popup();",
650 "xtype" : "GestureClick"
655 "bool can_unselect" : true,
660 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
663 "xtype" : "ListStore"
666 "xtype" : "SingleSelection",
667 "| JsRender.NodeProp getPropAt" : [
670 "\treturn (JsRender.NodeProp) this.el.get_item(row);",
675 "| void selectProp" : [
676 "(JsRender.NodeProp prop) {",
677 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
678 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
679 "\t\tif (r.equals(prop)) {",
680 "\t\t\tthis.el.selected = i;",
687 "| void startEditing" : [
688 "(JsRender.NodeProp prop) {",
689 "\t// should we call select?? - caller does int (from windowstate)",
696 "* pack" : "append_column",
697 "bool expand" : true,
698 "bool resizable" : true,
703 "* prop" : "factory",
707 " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
708 " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
711 "item.bind_property(\"to_display_name_prop\",",
713 " GLib.BindingFlags.SYNC_CREATE);",
714 "item.bind_property(\"to_tooltip_name_prop\",",
715 " lb, \"tooltip_markup\",",
716 " GLib.BindingFlags.SYNC_CREATE);",
717 "// was item (1) in old layout",
725 "\tvar lbl = new Gtk.Label(\"\");",
726 " \t((Gtk.ListItem)listitem).set_child(lbl);",
727 " \tlbl.justify = Gtk.Justification.LEFT;",
728 " \tlbl.xalign = 1;",
729 " \tlbl.use_markup = true;",
730 "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
731 " \t/*lbl.changed.connect(() => {",
732 "\t\t// notify and save the changed value...",
733 "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
735 " //prop.val = lbl.text;",
736 " //_this.updateIter(iter,prop);",
740 "\t((Gtk.ListItem)listitem).activatable = true;",
745 "xtype" : "SignalListItemFactory"
748 "title" : "Property",
749 "xtype" : "ColumnViewColumn"
753 "* pack" : "append_column",
754 "bool expand" : true,
755 "bool resizable" : true,
760 "* prop" : "factory",
761 "bool is_setting" : false,
765 "\t this.is_setting = true;",
768 "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
773 "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
774 "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
775 "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
776 "\t// decide if it's a combo or editable text..",
777 "\tvar model = (Gtk.StringList) cb.model;",
783 "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
784 "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
785 "\t//GLib.debug(\"prop.val = %s\", prop.val);",
786 "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
788 " var use_textarea = prop.useTextArea();",
791 " var pal = _this.file.project.palete;",
794 " var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);",
796 " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
797 " \tuse_textarea = true;",
801 " if (use_textarea) {",
802 " \tprop.bind_property(\"val_short\",",
804 " GLib.BindingFlags.SYNC_CREATE);",
805 " prop.bind_property(\"val_tooltip\",",
806 " lbl, \"tooltip_markup\",",
807 " GLib.BindingFlags.SYNC_CREATE);",
809 "\t\tthis.is_setting = false; ",
818 " // others... - fill in options for true/false?",
819 " // GLib.debug (ktype.up());",
822 "\t\twhile(model.get_n_items() > 0) {",
823 "\t\t\tmodel.remove(0);",
826 " \t\t// can not remove - hopefully always empty.",
828 "\t\tfor(var i = 0; i < opts.length; i ++) {",
829 "\t\t\tmodel.append( opts[i]);",
830 "\t\t\t// not sure this is a great idea... ",
831 "\t\t\tif (opts[i].down() == prop.val.down()) {",
835 "\t\tGLib.debug(\"Set selected item to %d\", sel);",
836 "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
837 "\t\tthis.is_setting = false; ",
841 "\t// see if type is a Enum.",
842 "\t// triggers a changed event",
844 "\telbl.set_text(prop.val);",
847 "\tthis.is_setting = false; \t\t ",
858 "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
859 "\tvar elbl = new Gtk.EditableLabel(\"\");",
860 "\telbl.hexpand = true;",
861 "\thb.append(elbl);",
862 "\tvar lbl = new Gtk.Label(\"\");",
864 "\tlbl.hexpand = true;",
865 "\tlbl.use_markup = true;",
867 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
868 "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
869 "\tcb.hexpand = true;",
872 "\t((Gtk.ListItem)listitem).set_child(hb);",
874 "\t var ef = new Gtk.EventControllerFocus();",
875 "\t ef.enter.connect(() => {",
876 " \t\t _this.stop_editor();",
877 " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
878 "\t\t _this.selmodel.selectProp(prop);\t\t",
880 "\t elbl.add_controller(ef);",
883 "\t // dropdown??? - stop editing, and highliht node",
884 "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
885 "\t tb.clicked.connect(() => {",
886 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
888 "\t \t _this.stop_editor();",
889 "\t \t _this.selmodel.selectProp(prop);",
892 " \telbl.changed.connect(() => {",
893 "\t\t// notify and save the changed value...",
895 " //_this.updateIter(iter,prop);",
896 " // this should happen automatically",
898 " if (!_this.loading && !this.is_setting) {",
899 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
902 "\t\t prop.val = elbl.text;",
903 " \t GLib.debug(\"calling changed\");",
904 "\t _this.changed();",
911 "\tcb.notify[\"selected\"].connect(() => {",
912 "\t\t// dropdown selection changed.",
916 " //_this.updateIter(iter,prop);",
917 " if (!_this.loading && !this.is_setting) {",
918 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
919 "\t\t var model = (Gtk.StringList)cb.model;",
920 "\t\t prop.val = model.get_string(cb.selected);",
921 "\t\t GLib.debug(\"property set to %s\", prop.val);",
922 " \tGLib.debug(\"calling changed\");",
923 "\t _this.changed();",
929 "\tvar gc = new Gtk.GestureClick();",
930 "\tlbl.add_controller(gc);",
931 "\tgc.pressed.connect(() => {",
932 "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
933 "\t\t _this.stop_editor();",
934 "\t _this.show_editor(_this.file, prop.parent, prop);",
943 "xtype" : "SignalListItemFactory"
947 "xtype" : "ColumnViewColumn"
952 "id" : "ContextMenu",
957 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
966 "\t_this.deleteSelected();",
980 "string name" : "leftprops-view",
981 "xtype" : "ColumnView",
982 "| Gtk.Widget? getWidgetAtRow" : [
986 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
987 " \tvar colview = gesture.widget;",
988 " \tvar line_no = check_list_widget(colview, x,y);",
989 " if (line_no > -1) {",
990 " \t\tvar item = colview.model.get_item(line_no);",
994 "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
995 " var child = this.el.get_first_child(); ",
996 " \tvar line_no = -1; ",
997 " \tvar reading_header = true;",
999 " \twhile (child != null) {",
1000 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1001 " \t if (reading_header) {",
1004 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1005 "\t\t\t\t\tchild = child.get_next_sibling();",
1006 "\t\t\t\t\tcontinue;",
1008 "\t\t\t\tchild = child.get_first_child(); ",
1009 "\t\t\t\treading_header = false;",
1011 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1012 " \t\t child = child.get_next_sibling();",
1016 "\t\t\tif (line_no == row) {",
1017 "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
1018 "\t\t\t return (Gtk.Widget)child;",
1020 "\t child = child.get_next_sibling(); ",
1022 "\t\tGLib.debug(\"Rturning null\");",
1027 "| int getColAt" : [
1028 "(double x, double y) {",
1031 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1034 "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1035 " var child = this.el.get_first_child(); ",
1039 " \twhile (child != null) {",
1040 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1042 "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1043 "\t\t\t\tchild = child.get_first_child();",
1044 "\t\t\t\tcontinue;",
1047 "\t\t\t//child.get_allocation(out alloc);",
1048 "\t\t\tif (x < (child.get_width() + offx)) {",
1049 "\t\t\t\treturn col;",
1051 "\t\t\toffx += child.get_width();",
1053 "\t\t\tchild = child.get_next_sibling();",
1061 "| int getRowAt" : [
1062 "(double x, double in_y, out string pos) {",
1069 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1070 " \tvar colview = gesture.widget;",
1071 " \tvar line_no = check_list_widget(colview, x,y);",
1072 " if (line_no > -1) {",
1073 " \t\tvar item = colview.model.get_item(line_no);",
1079 " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
1080 " \tvar y = in_y + _this.EditProps.el.vadjustment.value; ",
1081 " var child = this.el.get_first_child(); ",
1082 " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1083 " \tvar line_no = -1; ",
1084 " \tvar reading_header = true;",
1085 " \tvar real_y = 0;",
1086 " \tvar header_height = 0;",
1087 " \tpos = \"none\";",
1089 " \twhile (child != null) {",
1090 "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1091 " \t if (reading_header) {",
1094 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1095 "\t\t\t h += child.get_height();",
1096 "\t\t\t\t\tchild = child.get_next_sibling();",
1097 "\t\t\t\t\tcontinue;",
1099 "\t\t\t\t// should be columnlistview",
1100 "\t\t\t\tchild = child.get_first_child(); ",
1101 "\t\t\t GLib.debug(\"header height=%d\", h);",
1102 "\t\t\t\theader_height = h;",
1104 "\t\t\t\treading_header = false;",
1108 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1109 " \t\t child = child.get_next_sibling();",
1113 "\t\t \tif (y < header_height) {",
1114 "\t\t \treturn -1;",
1118 "\t\t\tvar hh = child.get_height();",
1119 "\t\t\t//child.get_allocation(out alloc);",
1120 "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
1121 "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
1123 "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
1125 "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
1126 "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
1127 "\t\t \t\tpos = \"below\";",
1128 "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
1129 "\t \t\t\tpos = \"over\";",
1131 " \t\t\t\tpos = \"above\";",
1133 "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
1134 "\t\t\t return line_no;",
1138 "\t\t if (real_y + hh > y) {",
1142 "\t child = child.get_next_sibling(); ",
1148 "| void editProp" : [
1149 "(JsRender.NodeProp prop) ",
1151 "\tvar sm = _this.selmodel.el;",
1154 "\t\tGLib.debug(\"finding node\");",
1155 "\t\t_this.selmodel.selectProp(prop);",
1157 "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1158 "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1159 "\t\t\tif (r.equals(prop)) {",
1164 "\t\tif (sr < 0) {",
1165 "\t\t\tGLib.debug(\"finding node - cant find it\");",
1169 "\t\tvar r = this.getWidgetAtRow(sr);",
1170 "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1171 "\t\tvar ca = r.get_first_child();",
1172 "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1173 "\t\tvar cb = ca.get_next_sibling();",
1174 "\t\tvar b = cb.get_first_child();",
1175 "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
1176 "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1177 "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1179 "\t\tGLib.debug(\"row key = %s\", ll.label);",
1180 "\t\tif (e.get_visible()) {",
1181 "\t\t\t_this.stop_editor();",
1182 "\t\t\te.start_editing();",
1183 "\t\t\t//GLib.Timeout.add_once(500, () => {",
1184 "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
1185 "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
1186 "\t\t\t//\ted.grab_focus_without_selecting();",
1190 "\t\tif (d.get_visible()) {",
1191 "\t\t\t_this.stop_editor();",
1192 "\t\t\td.activate();",
1195 "\t\tif (l.get_visible()) {",
1196 "\t\t \t_this.stop_editor();",
1197 "\t \t_this.show_editor(_this.file, prop.parent, prop);",
1203 "\t\t//gtkcolumnviewrowwidget",
1204 "\t\t // cell widet",
1205 "\t\t // cell widget",
1207 "\t\t \t\t// entry / label / dropdown",
1214 "xtype" : "ScrolledWindow"
1218 "| string keyFormat" : [
1219 "(string val, string type) {",
1221 " // Glib.markup_escape_text(val);",
1223 " if (type == \"listener\") {",
1224 " return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1225 " GLib.Markup.escape_text(val) +",
1229 " if (val.length < 1) {",
1230 " return \"<span color=\\\"#FF0000\\\">--empty--</span>\";",
1234 " //$ = property with ",
1235 " //# - object properties",
1237 " // all of these... - display value is last element..",
1238 " var ar = val.strip().split(\" \");",
1241 " var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1246 " switch(val[0]) {",
1247 " case '@': // signal // just bold balck?",
1248 " if (dval[0] == '@') {",
1249 " dval = dval.substring(1);",
1252 " return @\"<span font_weight=\\\"bold\\\">@ $dval</span>\"; ",
1253 " case '#': // object properties?",
1254 " if (dval[0] == '#') {",
1255 " dval = dval.substring(1);",
1257 " return @\"<span font_weight=\\\"bold\\\">$dval</span>\";",
1258 " case '*': // special",
1259 " if (dval[0] == '*') {",
1260 " dval = dval.substring(1);",
1262 " return @\"<span color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\"; ",
1264 " if (dval[0] == '$') {",
1265 " dval = dval.substring(1);",
1267 " return @\"<span style=\\\"italic\\\">$dval</span>\";",
1268 " case '|': // user defined methods",
1269 " if (dval[0] == '|') {",
1270 " dval = dval.substring(1);",
1272 " return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1284 "| string keySortFormat" : [
1286 " // listeners first - with 0",
1288 " if (key[0] == '*') {",
1289 " return \"1 \" + key;",
1293 " var bits = key.split(\" \");",
1295 " if (key[0] == '|') {",
1296 " return \"2 \" + bits[bits.length -1];",
1299 " if (key[0] == '@') {",
1300 " return \"3 \" + bits[bits.length -1];",
1304 " if (key[0] == '#') {",
1305 " return \"4 \" + bits[bits.length -1];",
1308 " return \"5 \" + bits[bits.length -1]; ",
1314 "| void a_addProp" : [
1315 " (JsRender.NodeProp prop) {",
1316 " // info includes key, val, skel, etype..",
1317 " //console.dump(info);",
1318 " //type = info.type.toLowerCase();",
1319 " //var data = this.toJS();",
1322 " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
1323 " if (this.node.listeners.has_key(prop.name)) {",
1326 " this.node.listeners.set(prop.name,prop);",
1328 " assert(this.node != null);",
1329 " assert(this.node.props != null);",
1330 " if (this.node.props.has_key(prop.to_index_key())) {",
1333 " this.node.props.set(prop.to_index_key(),prop);",
1338 " this.load(this.file, this.node);",
1343 " GLib.debug(\"trying to find new iter\");",
1350 "| void deleteSelected" : [
1356 " Gtk.TreeIter iter;",
1357 " Gtk.TreeModel mod;",
1359 " var s = this.view.el.get_selection();",
1360 " s.get_selected(out mod, out iter);",
1363 " GLib.Value gval;",
1364 " mod.get_value(iter, 0 , out gval);",
1365 " var prop = (JsRender.NodeProp)gval;",
1366 " if (prop == null) {",
1367 "\t this.load(this.file, this.node); ",
1370 " \t// stop editor after fetching property - otherwise prop is null.",
1371 " this.stop_editor();",
1374 " switch(prop.ptype) {",
1375 " case JsRender.NodePropType.LISTENER:",
1376 " this.node.listeners.unset(prop.to_index_key());",
1380 " this.node.props.unset(prop.to_index_key());",
1383 " this.load(this.file, this.node);",
1385 " _this.changed();",
1390 "(JsRender.JsRender file, JsRender.Node? node) ",
1392 "\t// not sure when to initialize this - we should do it on setting main window really. ",
1394 "\tthis.loading = true;",
1395 " if (this.view.popover == null) {",
1396 " \t\t this.view.popover = new Xcls_PopoverProperty();",
1397 " \t\t this.view.popover.mainwindow = _this.main_window;",
1401 " if (this.node != null) {",
1402 " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1406 " GLib.debug(\"load leftprops\\n\");",
1408 " this.node = node;",
1409 " this.file = file;",
1412 " this.model.el.remove_all();",
1414 " //this.get('/RightEditor').el.hide();",
1415 " if (node ==null) {",
1418 " node.loadProps(this.model.el); ",
1421 " //GLib.debug(\"clear selection\\n\");",
1423 " \tthis.loading = false;",
1424 " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1425 " // clear selection?",
1426 " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1428 " // this.view.el.get_selection().unselect_all();",
1430 " // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1431 " // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1438 "name" : "WindowLeftProps"