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,
21 "int last_error_counter" : "-1",
25 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
26 "bool hexpand" : true,
31 "int margin_start" : 5,
32 "string label" : "Add:",
36 "$ tooltip_text" : "\"Add Property\"",
38 "bool always_show_image" : true,
39 "bool hexpand" : true,
44 " _this.main_window.windowstate.showProps(",
46 " \t\tJsRender.NodePropType.PROP",
52 "string icon_name" : "format-justify-left",
53 "string label" : "Property",
57 "$ tooltip_text" : "\"Add Event Code\"",
59 "bool always_show_image" : true,
60 "bool hexpand" : true,
66 " _this.main_window.windowstate.showProps(",
67 " \t\t_this.view.el, ",
68 " \t\tJsRender.NodePropType.LISTENER",
75 "string icon_name" : "appointment-new",
76 "string label" : "Event",
90 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
95 "bool has_frame" : false,
100 "Gtk.Align halign" : "Gtk.Align.START",
101 "string label" : "id: _this.{ID} (Vala)",
102 "string tooltip_text" : "Using _this.{ID} will map to this element",
109 " \t_this.addpop.el.hide();",
110 " \t// is this userdef or special??",
111 " \tvar add = new JsRender.NodeProp.prop(\"id\");",
112 " \tif (_this.node.has_prop_key(add)) {",
116 " \t_this.node.add_prop( add );",
118 " \t_this.view.editProp( add );",
127 "bool has_frame" : false,
132 "Gtk.Align halign" : "Gtk.Align.START",
133 "string label" : "pack: Pack method (Vala)",
134 "string tooltip_text" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
143 " \t_this.addpop.el.hide();",
144 " \t// is this userdef or special??",
145 " \tvar add = new JsRender.NodeProp.special(\"pack\", \"add\");",
146 " \tif (_this.node.has_prop_key(add)) {",
150 " \t_this.node.add_prop( add );",
152 " \t_this.view.editProp( add );",
162 "bool has_frame" : false,
167 "Gtk.Align halign" : "Gtk.Align.START",
168 "string label" : "ctor: Alterative to default contructor (Vala)",
169 "string tooltip_text" : [
172 "new Clutter.Image.from_file(.....)"
181 " \t_this.addpop.el.hide();",
182 " \t// is this userdef or special??",
183 " \tvar add = new JsRender.NodeProp.special(\"ctor\");",
184 " \tif (_this.node.has_prop_key(add)) {",
188 " \t_this.node.add_prop( add );",
190 " \t_this.view.editProp( add );",
199 "bool has_frame" : false,
204 "Gtk.Align halign" : "Gtk.Align.START",
205 "string label" : "init: initialziation code (vala)",
206 "string tooltip_text" : "This code is called after the ctor",
214 " \t_this.addpop.el.hide();",
215 " \t// is this userdef or special??",
216 " \tvar add = new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) ;",
217 " \tif (_this.node.has_prop_key(add)) {",
221 " \t_this.node.add_prop( add );",
223 " \t_this.view.editProp( add );",
231 "bool has_frame" : false,
236 "Gtk.Align halign" : "Gtk.Align.START",
237 "string label" : "cms-id: (Roo JS/Pman library)",
238 "string tooltip_text" : [
239 "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})",
248 " \t_this.addpop.el.hide();",
250 " \t// is this userdef or special??",
251 " \tvar add = new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) ;",
252 " \tif (_this.node.has_prop_key(add)) {",
256 " \t_this.node.add_prop( add );",
258 " \t_this.view.editProp( add );",
266 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
268 "xtype" : "Separator"
272 "bool has_frame" : false,
277 "Gtk.Align halign" : "Gtk.Align.START",
278 "string label" : "String",
279 "string tooltip_text" : "Add a user defined string property",
286 " \t_this.addpop.el.hide();",
287 "\t_this.view.popover.show(",
288 "\t\t_this.view.el, ",
290 "\t\t new JsRender.NodeProp.user(\"\", \"string\", \"\") ,",
302 "bool has_frame" : false,
307 "Gtk.Align halign" : "Gtk.Align.START",
308 "string label" : "Number",
309 "string tooltip_text" : "Add a user defined number property",
317 " \t_this.addpop.el.hide();",
318 " _this.view.popover.show(",
319 "\t\t_this.view.el, ",
321 "\t\t new JsRender.NodeProp.user(\"\", \"int\", \"0\") ,",
333 "bool has_frame" : false,
338 "Gtk.Align halign" : "Gtk.Align.START",
339 "string label" : "Boolean",
340 "string tooltip_text" : "Add a user defined boolean property",
348 " \t_this.addpop.el.hide();",
349 " _this.view.popover.show(",
350 "\t\t_this.view.el, ",
352 "\t\t new JsRender.NodeProp.user(\"\", \"bool\", \"true\") ,",
363 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
365 "xtype" : "Separator"
369 "bool has_frame" : false,
374 "Gtk.Align halign" : "Gtk.Align.START",
375 "string label" : "Javascript Function",
376 "string tooltip_text" : "Add a javascript function",
383 " \t_this.addpop.el.hide();",
384 " _this.view.popover.show(",
385 "\t\t_this.view.el, ",
387 "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
400 "bool has_frame" : false,
405 "Gtk.Align halign" : "Gtk.Align.START",
406 "string label" : "Vala Method",
407 "string tooltip_text" : "Add a user defined method to a object",
414 " \t_this.addpop.el.hide();",
415 " _this.view.popover.show(",
416 "\t\t_this.view.el, ",
418 "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
429 "bool has_frame" : false,
434 "Gtk.Align halign" : "Gtk.Align.START",
435 "string label" : "Vala Signal",
436 "string tooltip_text" : "Add a user defined signal to a object",
443 " \t_this.addpop.el.hide(); ",
444 " _this.view.popover.show(",
445 "\t\t_this.view.el, ",
447 "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
457 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
459 "xtype" : "Separator"
463 "bool has_frame" : false,
468 "Gtk.Align halign" : "Gtk.Align.START",
469 "string label" : "Flexy - If",
470 "string tooltip_text" : "Add a flexy if (for HTML templates)",
477 " \t_this.addpop.el.hide();",
478 " \t_this.view.popover.show(",
479 "\t\t_this.view.el, ",
481 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
494 "bool has_frame" : false,
499 "Gtk.Align halign" : "Gtk.Align.START",
500 "string label" : "Flexy - Include",
501 "string tooltip_text" : "Add a flexy include (for HTML templates)",
508 " \t_this.addpop.el.hide();",
509 " \t_this.view.popover.show(",
510 "\t\t_this.view.el, ",
512 "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
525 "bool has_frame" : false,
530 "Gtk.Align halign" : "Gtk.Align.START",
531 "string label" : "Flexy - Foreach",
532 "string tooltip_text" : "Add a flexy foreach (for HTML templates)",
539 " \t_this.addpop.el.hide();",
540 " \t_this.view.popover.show(",
541 "\t\t_this.view.el, ",
543 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
551 "tooltip_markup" : "Add a flexy include (for HTML templates)",
561 "string label" : "Other",
562 "xtype" : "MenuButton"
568 "# bool editing" : false,
569 "$ shadow_type" : "Gtk.ShadowType.IN",
574 " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
578 "bool hexpand" : true,
579 "bool vexpand" : true,
583 "# Xcls_PopoverProperty popover" : "null",
584 "$ enable_tree_lines" : true,
585 "$ headers_visible" : true,
587 "* pack" : "set_child",
588 "bool hexpand" : true,
589 "bool show_row_separators" : true,
590 "bool single_click_activate" : false,
591 "bool vexpand" : true,
602 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
607 "bool has_frame" : false,
612 "Gtk.Align halign" : "Gtk.Align.START",
613 "string label" : "Delete Property / Method",
622 "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
624 "\t_this.deletemenu.el.hide();",
625 "\t_this.node.remove_prop(n);",
630 "string label" : "Delete",
643 "(n_press, in_x, in_y) => {",
645 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
647 "\tvar col = _this.view.getColAt(in_x, in_y);",
652 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
658 "\tGLib.debug(\"hit row %d\", row);",
659 "\tvar prop = _this.selmodel.getPropAt(row);",
660 "\t_this.selmodel.selectProp(prop);",
662 "\t//var point_at = _this.view.getWidgetAtRow(row);",
664 "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
665 " \t// or popover might be trying to do a central?",
666 "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
667 " \t _this.stop_editor();",
668 " _this.view.popover.show(",
669 " \t\t\t_this.view.el, ",
670 " \t\t\t_this.node, prop, ",
679 "xtype" : "GestureClick"
685 "(n_press, in_x, in_y) => {",
690 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
697 "\t_this.stop_editor();",
698 "\tGLib.debug(\"hit row %d\", row);",
699 "\tvar prop = _this.selmodel.getPropAt(row);",
700 "\t_this.selmodel.selectProp(prop);",
704 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
705 "\t//_this.deletemenu.el.set_parent(_this.view.el);",
706 "\tif (_this.deletemenu.el.parent == null) {",
707 "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
712 "\t_this.deletemenu.el.set_offset(",
713 "\t\t\t(int)in_x - _this.view.el.get_width() ,",
714 "\t\t\t(int)in_y - _this.view.el.get_height()",
716 "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
717 " _this.deletemenu.el.popup();",
724 "xtype" : "GestureClick"
729 "bool can_unselect" : true,
734 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
737 "xtype" : "ListStore"
740 "xtype" : "SingleSelection",
741 "| JsRender.NodeProp getPropAt" : [
744 "\treturn (JsRender.NodeProp) this.el.get_item(row);",
749 "| int propToRow" : [
750 "(JsRender.NodeProp prop) {",
751 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
752 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
753 "\t\tif (r.equals(prop)) {",
762 "| void selectProp" : [
763 "(JsRender.NodeProp prop) {",
764 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
765 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
766 "\t\tif (r.equals(prop)) {",
767 "\t\t\tthis.el.selected = i;",
774 "| void startEditing" : [
775 "(JsRender.NodeProp prop) {",
776 "\t// should we call select?? - caller does int (from windowstate)",
783 "* pack" : "append_column",
784 "bool expand" : true,
785 "bool resizable" : true,
790 "* prop" : "factory",
794 " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
795 " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
798 "item.bind_property(\"to_display_name_prop\",",
800 " GLib.BindingFlags.SYNC_CREATE);",
801 "item.bind_property(\"to_tooltip_name_prop\",",
802 " lb, \"tooltip_markup\",",
803 " GLib.BindingFlags.SYNC_CREATE);",
804 "// was item (1) in old layout",
812 "\tvar lbl = new Gtk.Label(\"\");",
813 " \t((Gtk.ListItem)listitem).set_child(lbl);",
814 " \tlbl.justify = Gtk.Justification.LEFT;",
815 " \tlbl.xalign = 1;",
816 " \tlbl.use_markup = true;",
817 "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
818 " \t/*lbl.changed.connect(() => {",
819 "\t\t// notify and save the changed value...",
820 "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
822 " //prop.val = lbl.text;",
823 " //_this.updateIter(iter,prop);",
827 "\t((Gtk.ListItem)listitem).activatable = true;",
832 "xtype" : "SignalListItemFactory"
835 "title" : "Property",
836 "xtype" : "ColumnViewColumn"
840 "* pack" : "append_column",
841 "bool expand" : true,
842 "bool resizable" : true,
847 "* prop" : "factory",
848 "bool is_setting" : false,
852 "\t this.is_setting = true;",
855 "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
860 "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
861 "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
862 "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
863 "\t// decide if it's a combo or editable text..",
864 "\tvar model = (Gtk.StringList) cb.model;",
870 "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
871 "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
872 "\t//GLib.debug(\"prop.val = %s\", prop.val);",
873 "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
875 " var use_textarea = prop.useTextArea();",
878 " var pal = _this.file.project.palete;",
881 " var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);",
883 " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
884 " \tuse_textarea = true;",
888 " if (use_textarea) {",
889 " \tprop.bind_property(\"val_short\",",
891 " GLib.BindingFlags.SYNC_CREATE);",
892 " prop.bind_property(\"val_tooltip\",",
893 " lbl, \"tooltip_markup\",",
894 " GLib.BindingFlags.SYNC_CREATE);",
896 "\t\tthis.is_setting = false; ",
905 " // others... - fill in options for true/false?",
906 " // GLib.debug (ktype.up());",
909 "\t\twhile(model.get_n_items() > 0) {",
910 "\t\t\tmodel.remove(0);",
913 " \t\t// can not remove - hopefully always empty.",
915 "\t\tfor(var i = 0; i < opts.length; i ++) {",
916 "\t\t\tmodel.append( opts[i]);",
917 "\t\t\t// not sure this is a great idea... ",
918 "\t\t\tif (opts[i].down() == prop.val.down()) {",
922 "\t\tGLib.debug(\"Set selected item to %d\", sel);",
923 "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
924 "\t\tthis.is_setting = false; ",
928 "\t// see if type is a Enum.",
929 "\t// triggers a changed event",
931 "\telbl.set_text(prop.val);",
934 "\tthis.is_setting = false; \t\t ",
945 "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
946 "\tvar elbl = new Gtk.EditableLabel(\"\");",
947 "\telbl.hexpand = true;",
948 "\thb.append(elbl);",
949 "\tvar lbl = new Gtk.Label(\"\");",
951 "\tlbl.hexpand = true;",
952 "\tlbl.use_markup = true;",
954 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
955 "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
956 "\tcb.hexpand = true;",
959 "\t((Gtk.ListItem)listitem).set_child(hb);",
961 "\t var ef = new Gtk.EventControllerFocus();",
962 "\t ef.enter.connect(() => {",
963 " \t\t _this.stop_editor();",
964 " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
965 "\t\t _this.selmodel.selectProp(prop);\t\t",
967 "\t elbl.add_controller(ef);",
970 "\t // dropdown??? - stop editing, and highliht node",
971 "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
972 "\t tb.clicked.connect(() => {",
973 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
975 "\t \t _this.stop_editor();",
976 "\t \t _this.selmodel.selectProp(prop);",
979 " \telbl.changed.connect(() => {",
980 "\t\t// notify and save the changed value...",
982 " //_this.updateIter(iter,prop);",
983 " // this should happen automatically",
985 " if (!_this.loading && !this.is_setting) {",
986 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
989 "\t\t prop.val = elbl.text;",
990 " \t GLib.debug(\"calling changed\");",
991 "\t _this.changed();",
998 "\tcb.notify[\"selected\"].connect(() => {",
999 "\t\t// dropdown selection changed.",
1003 " //_this.updateIter(iter,prop);",
1004 " if (!_this.loading && !this.is_setting) {",
1005 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1006 "\t\t var model = (Gtk.StringList)cb.model;",
1007 "\t\t prop.val = model.get_string(cb.selected);",
1008 "\t\t GLib.debug(\"property set to %s\", prop.val);",
1009 " \tGLib.debug(\"calling changed\");",
1010 "\t _this.changed();",
1016 "\tvar gc = new Gtk.GestureClick();",
1017 "\tlbl.add_controller(gc);",
1018 "\tgc.pressed.connect(() => {",
1019 "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1020 "\t\t _this.stop_editor();",
1021 "\t _this.show_editor(_this.file, prop.parent, prop);",
1030 "xtype" : "SignalListItemFactory"
1034 "xtype" : "ColumnViewColumn"
1039 "id" : "ContextMenu",
1044 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1053 "\t_this.deleteSelected();",
1067 "string name" : "leftprops-view",
1068 "xtype" : "ColumnView",
1069 "| Gtk.Widget? getWidgetAtRow" : [
1073 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1074 " \tvar colview = gesture.widget;",
1075 " \tvar line_no = check_list_widget(colview, x,y);",
1076 " if (line_no > -1) {",
1077 " \t\tvar item = colview.model.get_item(line_no);",
1081 "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
1082 " var child = this.el.get_first_child(); ",
1083 " \tvar line_no = -1; ",
1084 " \tvar reading_header = true;",
1086 " \twhile (child != null) {",
1087 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1088 " \t if (reading_header) {",
1091 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1092 "\t\t\t\t\tchild = child.get_next_sibling();",
1093 "\t\t\t\t\tcontinue;",
1095 "\t\t\t\tchild = child.get_first_child(); ",
1096 "\t\t\t\treading_header = false;",
1097 "\t\t\t\tcontinue;",
1099 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1100 " \t\t child = child.get_next_sibling();",
1104 "\t\t\tif (line_no == row) {",
1105 "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
1106 "\t\t\t return (Gtk.Widget)child;",
1108 "\t child = child.get_next_sibling(); ",
1110 "\t\tGLib.debug(\"Rturning null\");",
1115 "| int getColAt" : [
1116 "(double x, double y) {",
1119 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1122 "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1123 " var child = this.el.get_first_child(); ",
1127 " \twhile (child != null) {",
1128 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1130 "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1131 "\t\t\t\tchild = child.get_first_child();",
1132 "\t\t\t\tcontinue;",
1135 "\t\t\t//child.get_allocation(out alloc);",
1136 "\t\t\tif (x < (child.get_width() + offx)) {",
1137 "\t\t\t\treturn col;",
1139 "\t\t\toffx += child.get_width();",
1141 "\t\t\tchild = child.get_next_sibling();",
1149 "| int getRowAt" : [
1150 "(double x, double y, out string pos) {",
1153 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1154 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1155 "\tif (w == null) {",
1159 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1160 "\tif (row == null) {",
1164 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1169 "\twhile (cr.get_prev_sibling() != null) {",
1171 "\t\tcr = cr.get_prev_sibling();",
1174 "\t//GLib.debug(\"row number is %d\", rn);",
1175 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1176 "\t// above or belw",
1177 "\tGraphene.Rect bounds;",
1178 "\trow.compute_bounds(this.el, out bounds);",
1179 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1180 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1181 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1183 "\tvar ypos = y - bounds.get_y();",
1184 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1185 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1186 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1187 "\tpos = \"over\";",
1189 "\tif (rpos > 80) {",
1190 "\t\tpos = \"below\";",
1191 "\t} else if (rpos < 20) {",
1192 "\t\tpos = \"above\";",
1197 "| void editProp" : [
1198 "(JsRender.NodeProp prop) ",
1200 "\tvar sm = _this.selmodel.el;",
1203 "\t\tGLib.debug(\"finding node\");",
1204 "\t\t_this.selmodel.selectProp(prop);",
1206 "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1207 "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1208 "\t\t\tif (r.equals(prop)) {",
1213 "\t\tif (sr < 0) {",
1214 "\t\t\tGLib.debug(\"finding node - cant find it\");",
1218 "\t\tvar r = this.getWidgetAtRow(sr);",
1219 "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1220 "\t\tvar ca = r.get_first_child();",
1221 "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1222 "\t\tvar cb = ca.get_next_sibling();",
1223 "\t\tvar b = cb.get_first_child();",
1224 "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
1225 "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1226 "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1228 "\t\tGLib.debug(\"row key = %s\", ll.label);",
1229 "\t\tif (e.get_visible()) {",
1230 "\t\t\t_this.stop_editor();",
1231 "\t\t\te.start_editing();",
1232 "\t\t\t//GLib.Timeout.add_once(500, () => {",
1233 "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
1234 "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
1235 "\t\t\t//\ted.grab_focus_without_selecting();",
1239 "\t\tif (d.get_visible()) {",
1240 "\t\t\t_this.stop_editor();",
1241 "\t\t\td.activate();",
1244 "\t\tif (l.get_visible()) {",
1245 "\t\t \t_this.stop_editor();",
1246 "\t \t_this.show_editor(_this.file, prop.parent, prop);",
1252 "\t\t//gtkcolumnviewrowwidget",
1253 "\t\t // cell widet",
1254 "\t\t // cell widget",
1256 "\t\t \t\t// entry / label / dropdown",
1263 "xtype" : "ScrolledWindow"
1267 "| string keyFormat" : [
1268 "(string val, string type) {",
1270 " // Glib.markup_escape_text(val);",
1272 " if (type == \"listener\") {",
1273 " return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1274 " GLib.Markup.escape_text(val) +",
1278 " if (val.length < 1) {",
1279 " return \"<span color=\\\"#FF0000\\\">--empty--</span>\";",
1283 " //$ = property with ",
1284 " //# - object properties",
1286 " // all of these... - display value is last element..",
1287 " var ar = val.strip().split(\" \");",
1290 " var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1295 " switch(val[0]) {",
1296 " case '@': // signal // just bold balck?",
1297 " if (dval[0] == '@') {",
1298 " dval = dval.substring(1);",
1301 " return @\"<span font_weight=\\\"bold\\\">@ $dval</span>\"; ",
1302 " case '#': // object properties?",
1303 " if (dval[0] == '#') {",
1304 " dval = dval.substring(1);",
1306 " return @\"<span font_weight=\\\"bold\\\">$dval</span>\";",
1307 " case '*': // special",
1308 " if (dval[0] == '*') {",
1309 " dval = dval.substring(1);",
1311 " return @\"<span color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\"; ",
1313 " if (dval[0] == '$') {",
1314 " dval = dval.substring(1);",
1316 " return @\"<span style=\\\"italic\\\">$dval</span>\";",
1317 " case '|': // user defined methods",
1318 " if (dval[0] == '|') {",
1319 " dval = dval.substring(1);",
1321 " return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1333 "| string keySortFormat" : [
1335 " // listeners first - with 0",
1337 " if (key[0] == '*') {",
1338 " return \"1 \" + key;",
1342 " var bits = key.split(\" \");",
1344 " if (key[0] == '|') {",
1345 " return \"2 \" + bits[bits.length -1];",
1348 " if (key[0] == '@') {",
1349 " return \"3 \" + bits[bits.length -1];",
1353 " if (key[0] == '#') {",
1354 " return \"4 \" + bits[bits.length -1];",
1357 " return \"5 \" + bits[bits.length -1]; ",
1363 "| void deleteSelected" : [
1369 " Gtk.TreeIter iter;",
1370 " Gtk.TreeModel mod;",
1372 " var s = this.view.el.get_selection();",
1373 " s.get_selected(out mod, out iter);",
1376 " GLib.Value gval;",
1377 " mod.get_value(iter, 0 , out gval);",
1378 " var prop = (JsRender.NodeProp)gval;",
1379 " if (prop == null) {",
1380 "\t this.load(this.file, this.node); ",
1383 " \t// stop editor after fetching property - otherwise prop is null.",
1384 " this.stop_editor();",
1387 " switch(prop.ptype) {",
1388 " case JsRender.NodePropType.LISTENER:",
1389 " this.node.listeners.unset(prop.to_index_key());",
1393 " this.node.props.unset(prop.to_index_key());",
1396 " this.load(this.file, this.node);",
1398 " _this.changed();",
1403 "(JsRender.JsRender file, JsRender.Node? node) ",
1405 "\t// not sure when to initialize this - we should do it on setting main window really. ",
1407 "\tthis.loading = true;",
1408 " if (this.view.popover == null) {",
1409 " \t\t this.view.popover = new Xcls_PopoverProperty();",
1410 " \t\t this.view.popover.mainwindow = _this.main_window;",
1414 " if (this.node != null) {",
1415 " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1419 " GLib.debug(\"load leftprops\\n\");",
1421 " this.node = node;",
1422 " this.file = file;",
1425 " this.model.el.remove_all();",
1427 " //this.get('/RightEditor').el.hide();",
1428 " if (node ==null) {",
1432 " node.loadProps(this.model.el, _this.main_window.windowstate.project); ",
1435 " //GLib.debug(\"clear selection\\n\");",
1437 " \tthis.loading = false;",
1438 " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1439 " this.updateErrors();",
1440 " // clear selection?",
1441 " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1443 " // this.view.el.get_selection().unselect_all();",
1445 " // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1446 " // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1451 "| void removeErrors" : [
1453 "\tvar child = this.view.el.get_first_child(); ",
1455 "\tvar reading_header = true;",
1457 "\twhile (child != null) {",
1458 "\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1460 "\t if (reading_header) {",
1463 "\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1465 "\t\t\t\tchild = child.get_next_sibling();",
1466 "\t\t\t\tcontinue;",
1468 "\t\t\t// should be columnlistview",
1469 "\t\t\tchild = child.get_first_child(); ",
1473 "\t\t\treading_header = false;",
1477 "\t \tif (child.has_css_class(\"node-err\")) {",
1478 "\t\t\tchild.remove_css_class(\"node-err\");",
1480 "\t\tif (child.has_css_class(\"node-warn\")) {",
1481 "\t\t\tchild.remove_css_class(\"node-warn\");",
1484 "\t\tif (child.has_css_class(\"node-depr\")) {",
1485 "\t\t\tchild.remove_css_class(\"node-depr\");",
1488 " child = child.get_next_sibling(); ",
1490 "\t//GLib.debug(\"Rturning null\");",
1494 "| void updateErrors" : [
1496 "\tvar file = this.file;",
1497 "\tif (file == null) {",
1500 "\tvar ar = file.getErrors();",
1501 "\tif (ar == null || ar.size < 1) {",
1502 "\t\tif (this.last_error_counter != file.error_counter) {",
1503 "\t\t\tthis.removeErrors();",
1506 "\t\tthis.last_error_counter = file.error_counter ;",
1510 " \tif (this.last_error_counter == file.error_counter) {",
1513 "\tthis.removeErrors();",
1515 "\tforeach(var diag in ar) { ",
1518 "// print(\"get inter\\n\");",
1519 "\t var node= file.lineToNode( (int)diag.range.start.line) ;",
1520 "\t if (node == null || node.oid != this.node.oid) {",
1523 " \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
1525 " \tvar row = _this.selmodel.propToRow(prop);",
1526 " \tif (row < 0) {",
1529 " \tvar w = this.view.getWidgetAtRow(row);",
1530 " \tif (w == null) {",
1533 "\t \t\tvar ed = diag.category.down();",
1534 "\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
1537 "\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
1538 "\t\t\tw.remove_css_class(\"node-warn\");",
1540 "\t\tif (ed == \"err\" && w.has_css_class(\"node-depr\")) {",
1541 "\t\t\tw.remove_css_class(\"node-depr\");",
1543 "\t\tif (!w.has_css_class(\"node-\"+ ed)) {",
1544 "\t\t\tw.add_css_class(\"node-\" + ed);",
1553 "name" : "WindowLeftProps"