2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# Gee.ArrayList<Gtk.Widget>? error_widgets" : "null",
7 "# JsRender.JsRender file" : "",
8 "# JsRender.Node node" : "",
9 "# Xcls_MainWindow main_window" : "null",
10 "# bool allow_edit" : false,
11 "$ homogeneous" : "false ",
13 "@ bool stop_editor" : "()",
14 "@ void changed" : "()",
15 "@ void show_add_props" : "(string type)",
16 "@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop)",
17 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
18 "bool hexpand" : true,
19 "bool loading" : false,
20 "bool vexpand" : true,
22 "int last_error_counter" : "-1",
26 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
27 "bool hexpand" : true,
32 "int margin_start" : 5,
33 "string label" : "Add:",
37 "$ tooltip_text" : "\"Add Property\"",
39 "bool always_show_image" : true,
40 "bool hexpand" : true,
45 " _this.main_window.windowstate.showProps(",
47 " \t\tJsRender.NodePropType.PROP",
53 "string icon_name" : "format-justify-left",
54 "string label" : "Property",
58 "$ tooltip_text" : "\"Add Event Code\"",
60 "bool always_show_image" : true,
61 "bool hexpand" : true,
67 " _this.main_window.windowstate.showProps(",
68 " \t\t_this.view.el, ",
69 " \t\tJsRender.NodePropType.LISTENER",
76 "string icon_name" : "appointment-new",
77 "string label" : "Event",
91 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
96 "bool has_frame" : false,
101 "Gtk.Align halign" : "Gtk.Align.START",
102 "string label" : "id: _this.{ID} (Vala)",
103 "string tooltip_text" : "Using _this.{ID} will map to this element",
110 " \t_this.addpop.el.hide();",
111 " \t// is this userdef or special??",
112 " \tvar add = new JsRender.NodeProp.prop(\"id\");",
113 " \tif (_this.node.has_prop_key(add)) {",
117 " \t_this.node.add_prop( add );",
119 " \t_this.view.editProp( add );",
128 "bool has_frame" : false,
133 "Gtk.Align halign" : "Gtk.Align.START",
134 "string label" : "pack: Pack method (Vala)",
135 "string tooltip_text" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
144 " \t_this.addpop.el.hide();",
145 " \t// is this userdef or special??",
146 " \tvar add = new JsRender.NodeProp.special(\"pack\", \"add\");",
147 " \tif (_this.node.has_prop_key(add)) {",
151 " \t_this.node.add_prop( add );",
153 " \t_this.view.editProp( add );",
163 "bool has_frame" : false,
168 "Gtk.Align halign" : "Gtk.Align.START",
169 "string label" : "ctor: Alterative to default contructor (Vala)",
170 "string tooltip_text" : [
173 "new Clutter.Image.from_file(.....)"
182 " \t_this.addpop.el.hide();",
183 " \t// is this userdef or special??",
184 " \tvar add = new JsRender.NodeProp.special(\"ctor\");",
185 " \tif (_this.node.has_prop_key(add)) {",
189 " \t_this.node.add_prop( add );",
191 " \t_this.view.editProp( add );",
200 "bool has_frame" : false,
205 "Gtk.Align halign" : "Gtk.Align.START",
206 "string label" : "init: initialziation code (vala)",
207 "string tooltip_text" : "This code is called after the ctor",
215 " \t_this.addpop.el.hide();",
216 " \t// is this userdef or special??",
217 " \tvar add = new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) ;",
218 " \tif (_this.node.has_prop_key(add)) {",
222 " \t_this.node.add_prop( add );",
224 " \t_this.view.editProp( add );",
232 "bool has_frame" : false,
237 "Gtk.Align halign" : "Gtk.Align.START",
238 "string label" : "cms-id: (Roo JS/Pman library)",
239 "string tooltip_text" : [
240 "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})",
249 " \t_this.addpop.el.hide();",
251 " \t// is this userdef or special??",
252 " \tvar add = new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) ;",
253 " \tif (_this.node.has_prop_key(add)) {",
257 " \t_this.node.add_prop( add );",
259 " \t_this.view.editProp( add );",
267 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
269 "xtype" : "Separator"
273 "bool has_frame" : false,
278 "Gtk.Align halign" : "Gtk.Align.START",
279 "string label" : "String",
280 "string tooltip_text" : "Add a user defined string property",
287 " \t_this.addpop.el.hide();",
288 "\t_this.view.popover.show(",
289 "\t\t_this.view.el, ",
291 "\t\t new JsRender.NodeProp.user(\"\", \"string\", \"\") ,",
303 "bool has_frame" : false,
308 "Gtk.Align halign" : "Gtk.Align.START",
309 "string label" : "Number",
310 "string tooltip_text" : "Add a user defined number property",
318 " \t_this.addpop.el.hide();",
319 " _this.view.popover.show(",
320 "\t\t_this.view.el, ",
322 "\t\t new JsRender.NodeProp.user(\"\", \"int\", \"0\") ,",
334 "bool has_frame" : false,
339 "Gtk.Align halign" : "Gtk.Align.START",
340 "string label" : "Boolean",
341 "string tooltip_text" : "Add a user defined boolean property",
349 " \t_this.addpop.el.hide();",
350 " _this.view.popover.show(",
351 "\t\t_this.view.el, ",
353 "\t\t new JsRender.NodeProp.user(\"\", \"bool\", \"true\") ,",
364 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
366 "xtype" : "Separator"
370 "bool has_frame" : false,
375 "Gtk.Align halign" : "Gtk.Align.START",
376 "string label" : "Javascript Function",
377 "string tooltip_text" : "Add a javascript function",
384 " \t_this.addpop.el.hide();",
385 " _this.view.popover.show(",
386 "\t\t_this.view.el, ",
388 "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
401 "bool has_frame" : false,
406 "Gtk.Align halign" : "Gtk.Align.START",
407 "string label" : "Vala Method",
408 "string tooltip_text" : "Add a user defined method to a object",
415 " \t_this.addpop.el.hide();",
416 " _this.view.popover.show(",
417 "\t\t_this.view.el, ",
419 "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
430 "bool has_frame" : false,
435 "Gtk.Align halign" : "Gtk.Align.START",
436 "string label" : "Vala Signal",
437 "string tooltip_text" : "Add a user defined signal to a object",
444 " \t_this.addpop.el.hide(); ",
445 " _this.view.popover.show(",
446 "\t\t_this.view.el, ",
448 "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
458 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
460 "xtype" : "Separator"
464 "bool has_frame" : false,
469 "Gtk.Align halign" : "Gtk.Align.START",
470 "string label" : "Flexy - If",
471 "string tooltip_text" : "Add a flexy if (for HTML templates)",
478 " \t_this.addpop.el.hide();",
479 " \t_this.view.popover.show(",
480 "\t\t_this.view.el, ",
482 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
495 "bool has_frame" : false,
500 "Gtk.Align halign" : "Gtk.Align.START",
501 "string label" : "Flexy - Include",
502 "string tooltip_text" : "Add a flexy include (for HTML templates)",
509 " \t_this.addpop.el.hide();",
510 " \t_this.view.popover.show(",
511 "\t\t_this.view.el, ",
513 "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
526 "bool has_frame" : false,
531 "Gtk.Align halign" : "Gtk.Align.START",
532 "string label" : "Flexy - Foreach",
533 "string tooltip_text" : "Add a flexy foreach (for HTML templates)",
540 " \t_this.addpop.el.hide();",
541 " \t_this.view.popover.show(",
542 "\t\t_this.view.el, ",
544 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
552 "tooltip_markup" : "Add a flexy include (for HTML templates)",
562 "string label" : "Other",
563 "xtype" : "MenuButton"
569 "# bool editing" : false,
570 "$ shadow_type" : "Gtk.ShadowType.IN",
575 " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
579 "bool hexpand" : true,
580 "bool vexpand" : true,
584 "# Xcls_PopoverProperty popover" : "null",
585 "$ enable_tree_lines" : true,
586 "$ headers_visible" : true,
588 "* pack" : "set_child",
589 "bool hexpand" : true,
590 "bool show_row_separators" : true,
591 "bool single_click_activate" : false,
592 "bool vexpand" : true,
603 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
608 "bool has_frame" : false,
613 "Gtk.Align halign" : "Gtk.Align.START",
614 "string label" : "Delete Property / Method",
623 "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
625 "\t_this.deletemenu.el.hide();",
626 "\t_this.node.remove_prop(n);",
631 "string label" : "Delete",
644 "(n_press, in_x, in_y) => {",
646 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
648 "\tvar col = _this.view.getColAt(in_x, in_y);",
653 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
659 "\tGLib.debug(\"hit row %d\", row);",
660 "\tvar prop = _this.selmodel.getPropAt(row);",
661 "\t_this.selmodel.selectProp(prop);",
663 "\t//var point_at = _this.view.getWidgetAtRow(row);",
665 "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
666 " \t// or popover might be trying to do a central?",
667 "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
668 " \t _this.stop_editor();",
669 " _this.view.popover.show(",
670 " \t\t\t_this.view.el, ",
671 " \t\t\t_this.node, prop, ",
680 "xtype" : "GestureClick"
686 "(n_press, in_x, in_y) => {",
691 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
698 "\t_this.stop_editor();",
699 "\tGLib.debug(\"hit row %d\", row);",
700 "\tvar prop = _this.selmodel.getPropAt(row);",
701 "\t_this.selmodel.selectProp(prop);",
705 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
706 "\t//_this.deletemenu.el.set_parent(_this.view.el);",
707 "\tif (_this.deletemenu.el.parent == null) {",
708 "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
713 "\t_this.deletemenu.el.set_offset(",
714 "\t\t\t(int)in_x - _this.view.el.get_width() ,",
715 "\t\t\t(int)in_y - _this.view.el.get_height()",
717 "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
718 " _this.deletemenu.el.popup();",
725 "xtype" : "GestureClick"
730 "bool can_unselect" : true,
735 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
738 "xtype" : "ListStore"
741 "xtype" : "SingleSelection",
742 "| JsRender.NodeProp getPropAt" : [
745 "\treturn (JsRender.NodeProp) this.el.get_item(row);",
750 "| int propToRow" : [
751 "(JsRender.NodeProp prop) {",
752 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
753 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
754 "\t\tif (r.equals(prop)) {",
763 "| void selectProp" : [
764 "(JsRender.NodeProp prop) {",
765 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
766 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
767 "\t\tif (r.equals(prop)) {",
768 "\t\t\tthis.el.selected = i;",
775 "| void startEditing" : [
776 "(JsRender.NodeProp prop) {",
777 "\t// should we call select?? - caller does int (from windowstate)",
784 "* pack" : "append_column",
785 "bool expand" : true,
786 "bool resizable" : true,
791 "* prop" : "factory",
795 " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
796 " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
798 " if (item == null) {",
801 "item.bind_property(\"to_display_name_prop\",",
803 " GLib.BindingFlags.SYNC_CREATE);",
804 "item.bind_property(\"to_tooltip_name_prop\",",
805 " lb, \"tooltip_markup\",",
806 " GLib.BindingFlags.SYNC_CREATE);",
807 "// was item (1) in old layout",
815 "\tvar lbl = new Gtk.Label(\"\");",
816 " \t((Gtk.ListItem)listitem).set_child(lbl);",
817 " \tlbl.justify = Gtk.Justification.LEFT;",
818 " \tlbl.xalign = 1;",
819 " \tlbl.use_markup = true;",
820 "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
821 " \t/*lbl.changed.connect(() => {",
822 "\t\t// notify and save the changed value...",
823 "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
825 " //prop.val = lbl.text;",
826 " //_this.updateIter(iter,prop);",
830 "\t((Gtk.ListItem)listitem).activatable = true;",
835 "xtype" : "SignalListItemFactory"
838 "title" : "Property",
839 "xtype" : "ColumnViewColumn"
843 "* pack" : "append_column",
844 "bool expand" : true,
845 "bool resizable" : true,
849 "# bool is_setting" : false,
851 "* prop" : "factory",
855 "\t this.is_setting = true;",
858 "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
861 "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
862 "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
863 "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
864 "\t// decide if it's a combo or editable text..",
865 "\tvar model = (Gtk.StringList) cb.model;",
871 "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
872 " \tif (prop == null || _this.node == null ) {",
873 " \t\tGLib.error(\"something is wrong\");",
876 "\tif ( _this.node.fqn() == \"\") {",
877 " \t\tGLib.debug(\"node is missing fqn\");",
881 "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
882 "\t//GLib.debug(\"prop.val = %s\", prop.val);",
883 "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
885 " var use_textarea = prop.useTextArea();",
888 " var pal = _this.file.project.palete;",
890 " string[] opts = {};",
892 " var has_opts = prop.ptype.can_have_opt_list() ? ",
893 " \tpal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts)",
896 " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
897 " \tuse_textarea = true;",
901 " if (use_textarea) {",
902 " \tprop.bind_property(\"val_short\",",
904 " GLib.BindingFlags.SYNC_CREATE);",
905 " prop.bind_property(\"val_tooltip\",",
906 " lbl, \"tooltip_markup\",",
907 " GLib.BindingFlags.SYNC_CREATE);",
909 "\t\tthis.is_setting = false; ",
918 " // others... - fill in options for true/false?",
919 " // GLib.debug (ktype.up());",
922 "\t\twhile(model.get_n_items() > 0) {",
923 "\t\t\tmodel.remove(0);",
926 " \t\t// can not remove - hopefully always empty.",
928 "\t\tfor(var i = 0; i < opts.length; i ++) {",
929 "\t\t\tmodel.append( opts[i]);",
930 "\t\t\t// not sure this is a great idea... ",
931 "\t\t\tif (opts[i].down() == prop.val.down()) {",
935 "\t\tGLib.debug(\"Set selected item to %d\", sel);",
936 "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
937 "\t\tthis.is_setting = false; ",
941 "\t// see if type is a Enum.",
942 "\t// triggers a changed event",
944 "\telbl.set_text(prop.val);",
947 "\tthis.is_setting = false; \t\t ",
958 "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
959 "\tvar elbl = new Gtk.EditableLabel(\"\");",
960 "\telbl.hexpand = true;",
961 "\thb.append(elbl);",
962 "\tvar lbl = new Gtk.Label(\"\");",
964 "\tlbl.hexpand = true;",
965 "\tlbl.use_markup = true;",
967 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
968 "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
969 "\tcb.hexpand = true;",
972 "\t((Gtk.ListItem)listitem).set_child(hb);",
974 "\t var ef = new Gtk.EventControllerFocus();",
975 "\t ef.enter.connect(() => {",
976 " \t\t _this.stop_editor();",
977 " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
978 "\t\t _this.selmodel.selectProp(prop);\t\t",
980 "\t elbl.add_controller(ef);",
983 "\t // dropdown??? - stop editing, and highliht node",
984 "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
985 "\t tb.clicked.connect(() => {",
986 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
988 "\t \t _this.stop_editor();",
989 "\t \t _this.selmodel.selectProp(prop);",
992 " \telbl.changed.connect(() => {",
993 "\t\t// notify and save the changed value...",
995 " //_this.updateIter(iter,prop);",
996 " // this should happen automatically",
998 " if (!_this.loading && !this.is_setting) {",
999 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1002 "\t\t prop.val = elbl.text;",
1003 " \t GLib.debug(\"calling changed\");",
1004 "\t _this.changed();",
1011 "\tcb.notify[\"selected\"].connect(() => {",
1012 "\t\t// dropdown selection changed.",
1016 " //_this.updateIter(iter,prop);",
1017 " if (!_this.loading && !this.is_setting) {",
1018 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1019 "\t\t var model = (Gtk.StringList)cb.model;",
1020 "\t\t prop.val = model.get_string(cb.selected);",
1021 "\t\t GLib.debug(\"property set to %s\", prop.val);",
1022 " \tGLib.debug(\"calling changed\");",
1023 "\t _this.changed();",
1029 "\tvar gc = new Gtk.GestureClick();",
1030 "\tlbl.add_controller(gc);",
1031 "\tgc.pressed.connect(() => {",
1032 "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1033 "\t\t _this.stop_editor();",
1034 "\t _this.show_editor(_this.file, prop.parent, prop);",
1043 "xtype" : "SignalListItemFactory"
1047 "xtype" : "ColumnViewColumn"
1052 "id" : "ContextMenu",
1057 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1066 "\t_this.deleteSelected();",
1080 "string name" : "leftprops-view",
1081 "xtype" : "ColumnView",
1082 "| Gtk.Widget? getWidgetAtRow" : [
1086 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1087 " \tvar colview = gesture.widget;",
1088 " \tvar line_no = check_list_widget(colview, x,y);",
1089 " if (line_no > -1) {",
1090 " \t\tvar item = colview.model.get_item(line_no);",
1094 "\t\t//GLib.debug(\"Get Widget At Row %d\", (int)row);",
1095 " var child = this.el.get_first_child(); ",
1096 " \tvar line_no = -1; ",
1097 " \tvar reading_header = true;",
1099 " \twhile (child != null) {",
1100 "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1101 " \t if (reading_header) {",
1104 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1105 "\t\t\t\t\tchild = child.get_next_sibling();",
1106 "\t\t\t\t\tcontinue;",
1108 "\t\t\t\tchild = child.get_first_child(); ",
1109 "\t\t\t\treading_header = false;",
1110 "\t\t\t\tcontinue;",
1112 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1113 " \t\t child = child.get_next_sibling();",
1117 "\t\t\tif (line_no == row) {",
1118 "\t\t\t\t//GLib.debug(\"Returning widget %s\", child.get_type().name());",
1119 "\t\t\t return (Gtk.Widget)child;",
1121 "\t child = child.get_next_sibling(); ",
1123 "\t\t//GLib.debug(\"Rturning null\");",
1128 "| int getColAt" : [
1129 "(double x, double y) {",
1132 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1135 "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1136 " var child = this.el.get_first_child(); ",
1140 " \twhile (child != null) {",
1141 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1143 "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1144 "\t\t\t\tchild = child.get_first_child();",
1145 "\t\t\t\tcontinue;",
1148 "\t\t\t//child.get_allocation(out alloc);",
1149 "\t\t\tif (x < (child.get_width() + offx)) {",
1150 "\t\t\t\treturn col;",
1152 "\t\t\toffx += child.get_width();",
1154 "\t\t\tchild = child.get_next_sibling();",
1162 "| int getRowAt" : [
1163 "(double x, double y, out string pos) {",
1166 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1167 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1168 "\tif (w == null) {",
1172 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1173 "\tif (row == null) {",
1177 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1182 "\twhile (cr.get_prev_sibling() != null) {",
1184 "\t\tcr = cr.get_prev_sibling();",
1187 "\t//GLib.debug(\"row number is %d\", rn);",
1188 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1189 "\t// above or belw",
1190 "\tGraphene.Rect bounds;",
1191 "\trow.compute_bounds(this.el, out bounds);",
1192 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1193 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1194 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1196 "\tvar ypos = y - bounds.get_y();",
1197 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1198 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1199 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1200 "\tpos = \"over\";",
1202 "\tif (rpos > 80) {",
1203 "\t\tpos = \"below\";",
1204 "\t} else if (rpos < 20) {",
1205 "\t\tpos = \"above\";",
1210 "| void editProp" : [
1211 "(JsRender.NodeProp prop) ",
1213 "\tvar sm = _this.selmodel.el;",
1216 "\t\tGLib.debug(\"finding node\");",
1217 "\t\t_this.selmodel.selectProp(prop);",
1219 "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1220 "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1221 "\t\t\tif (r.equals(prop)) {",
1226 "\t\tif (sr < 0) {",
1227 "\t\t\tGLib.debug(\"finding node - cant find it\");",
1231 "\t\tvar r = this.getWidgetAtRow(sr);",
1232 "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1233 "\t\tvar ca = r.get_first_child();",
1234 "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1235 "\t\tvar cb = ca.get_next_sibling();",
1236 "\t\tvar b = cb.get_first_child();",
1237 "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
1238 "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1239 "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1241 "\t\tGLib.debug(\"row key = %s\", ll.label);",
1242 "\t\tif (e.get_visible()) {",
1243 "\t\t\t_this.stop_editor();",
1244 "\t\t\te.start_editing();",
1245 "\t\t\t//GLib.Timeout.add_once(500, () => {",
1246 "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
1247 "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
1248 "\t\t\t//\ted.grab_focus_without_selecting();",
1252 "\t\tif (d.get_visible()) {",
1253 "\t\t\t_this.stop_editor();",
1254 "\t\t\td.activate();",
1257 "\t\tif (l.get_visible()) {",
1258 "\t\t \t_this.stop_editor();",
1259 "\t\t \tif (prop.parent == null) {",
1262 "\t \t_this.show_editor(_this.file, prop.parent, prop);",
1268 "\t\t//gtkcolumnviewrowwidget",
1269 "\t\t // cell widet",
1270 "\t\t // cell widget",
1272 "\t\t \t\t// entry / label / dropdown",
1279 "xtype" : "ScrolledWindow"
1283 "| string keyFormat" : [
1284 "(string val, string type) {",
1286 " // Glib.markup_escape_text(val);",
1288 " if (type == \"listener\") {",
1289 " return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1290 " GLib.Markup.escape_text(val) +",
1294 " if (val.length < 1) {",
1295 " return \"<span color=\\\"#FF0000\\\">--empty--</span>\";",
1299 " //$ = property with ",
1300 " //# - object properties",
1302 " // all of these... - display value is last element..",
1303 " var ar = val.strip().split(\" \");",
1306 " var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1311 " switch(val[0]) {",
1312 " case '@': // signal // just bold balck?",
1313 " if (dval[0] == '@') {",
1314 " dval = dval.substring(1);",
1317 " return @\"<span font_weight=\\\"bold\\\">@ $dval</span>\"; ",
1318 " case '#': // object properties?",
1319 " if (dval[0] == '#') {",
1320 " dval = dval.substring(1);",
1322 " return @\"<span font_weight=\\\"bold\\\">$dval</span>\";",
1323 " case '*': // special",
1324 " if (dval[0] == '*') {",
1325 " dval = dval.substring(1);",
1327 " return @\"<span color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\"; ",
1329 " if (dval[0] == '$') {",
1330 " dval = dval.substring(1);",
1332 " return @\"<span style=\\\"italic\\\">$dval</span>\";",
1333 " case '|': // user defined methods",
1334 " if (dval[0] == '|') {",
1335 " dval = dval.substring(1);",
1337 " return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1349 "| string keySortFormat" : [
1351 " // listeners first - with 0",
1353 " if (key[0] == '*') {",
1354 " return \"1 \" + key;",
1358 " var bits = key.split(\" \");",
1360 " if (key[0] == '|') {",
1361 " return \"2 \" + bits[bits.length -1];",
1364 " if (key[0] == '@') {",
1365 " return \"3 \" + bits[bits.length -1];",
1369 " if (key[0] == '#') {",
1370 " return \"4 \" + bits[bits.length -1];",
1373 " return \"5 \" + bits[bits.length -1]; ",
1379 "| void deleteSelected" : [
1385 " Gtk.TreeIter iter;",
1386 " Gtk.TreeModel mod;",
1388 " var s = this.view.el.get_selection();",
1389 " s.get_selected(out mod, out iter);",
1392 " GLib.Value gval;",
1393 " mod.get_value(iter, 0 , out gval);",
1394 " var prop = (JsRender.NodeProp)gval;",
1395 " if (prop == null) {",
1396 "\t this.load(this.file, this.node); ",
1399 " \t// stop editor after fetching property - otherwise prop is null.",
1400 " this.stop_editor();",
1403 " switch(prop.ptype) {",
1404 " case JsRender.NodePropType.LISTENER:",
1405 " this.node.listeners.unset(prop.to_index_key());",
1409 " this.node.props.unset(prop.to_index_key());",
1412 " this.load(this.file, this.node);",
1414 " _this.changed();",
1419 "(JsRender.JsRender file, JsRender.Node? node) ",
1421 "\t// not sure when to initialize this - we should do it on setting main window really. ",
1423 "\tthis.loading = true;",
1424 " if (this.view.popover == null) {",
1425 " \t\t this.view.popover = new Xcls_PopoverProperty();",
1426 " \t\t this.view.popover.mainwindow = _this.main_window;",
1430 " if (this.node != null) {",
1431 " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1435 " GLib.debug(\"load leftprops\");",
1437 " this.node = node;",
1438 " this.file = file;",
1441 " this.model.el.remove_all();",
1443 " //this.get('/RightEditor').el.hide();",
1444 " if (node ==null) {",
1445 " GLib.debug(\"node is null return\");",
1449 " node.loadProps(this.model.el, _this.main_window.windowstate.project); ",
1452 " //GLib.debug(\"clear selection\\n\");",
1454 " \tthis.loading = false;",
1455 " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1456 " this.updateErrors();",
1457 " // clear selection?",
1458 " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1460 " // this.view.el.get_selection().unselect_all();",
1462 " // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1463 " // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1468 "| void removeErrors" : [
1470 "\t\tif (this.error_widgets == null || this.error_widgets.size < 1) {",
1473 "\tforeach(var child in this.error_widgets) {",
1475 "\t\tif (child.has_css_class(\"node-err\")) {",
1476 "\t\t\tchild.remove_css_class(\"node-err\");",
1478 "\t\tif (child.has_css_class(\"node-warn\")) {",
1479 "\t\t\tchild.remove_css_class(\"node-warn\");",
1482 "\t\tif (child.has_css_class(\"node-depr\")) {",
1483 "\t\t\tchild.remove_css_class(\"node-depr\");",
1486 "\tthis.error_widgets = null;",
1488 "\t//GLib.debug(\"Rturning null\");",
1492 "| void updateErrors" : [
1494 "\tvar file = this.file;",
1495 "\tif (file == null) {",
1498 "\tvar ar = file.getErrors();",
1499 "\tif (ar == null || ar.size < 1) {",
1500 "\t\tif (this.last_error_counter != file.error_counter) {",
1501 "\t\t\tthis.removeErrors();",
1504 "\t\tthis.last_error_counter = file.error_counter ;",
1508 " \tif (this.last_error_counter == file.error_counter) {",
1511 "\tthis.removeErrors();",
1512 "\tthis.error_widgets = new Gee.ArrayList<Gtk.Widget>();",
1513 "\tforeach(var diag in ar) { ",
1516 "// print(\"get inter\\n\");",
1517 "\t var node = file.lineToNode( (int)diag.range.start.line) ;",
1518 "\t if (node == null || this.node == null || node.oid != this.node.oid) {",
1521 " \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
1522 " \tif (prop == null) {",
1525 " \tvar row = _this.selmodel.propToRow(prop);",
1526 " \tif (row < 0) {",
1529 " \tvar w = this.view.getWidgetAtRow(row);",
1530 " \tif (w == null) {",
1535 " \t\tvar ed = diag.category.down();",
1536 "\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
1539 "\t\tthis.error_widgets.add(w);\t\t",
1540 "\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
1541 "\t\t\tw.remove_css_class(\"node-warn\");",
1543 "\t\tif (ed == \"err\" && w.has_css_class(\"node-depr\")) {",
1544 "\t\t\tw.remove_css_class(\"node-depr\");",
1546 "\t\tif (!w.has_css_class(\"node-\"+ ed)) {",
1547 "\t\t\tw.add_css_class(\"node-\" + ed);",
1556 "name" : "WindowLeftProps"