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 "$ enable_tree_lines" : true,
584 "$ headers_visible" : true,
589 " \tthis.css = new Gtk.CssProvider();",
591 "\t\tthis.css.load_from_string(\"",
592 "#leftprops-view { font-size: 12px;}",
594 "#leftprops-view dropdown button { ",
595 "\t\t\tmin-height: 16px;\t\t\t ",
596 "\t\t\toutline-offset : 0;",
598 "#leftprops-view cell dropdown label {",
599 " \t\tpadding-top:0px;",
600 "\t\tpadding-bottom:0px;",
602 "#leftprops-view cell { ",
603 " \t\tpadding-top:2px;",
604 "\t\tpadding-bottom:2px;",
606 "#leftprops-view cell label, #leftprops-view cell editablelable {",
607 " \t\tpadding-top:4px;",
608 "\t\tpadding-bottom:4px;",
611 "\t\tGtk.StyleContext.add_provider_for_display(",
612 "\t\tthis.el.get_display(),",
614 "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
621 "* pack" : "set_child",
622 "Gtk.CssProvider css" : "",
623 "Xcls_PopoverProperty popover" : "null",
624 "bool hexpand" : true,
625 "bool show_row_separators" : true,
626 "bool single_click_activate" : false,
627 "bool vexpand" : true,
638 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
643 "bool has_frame" : false,
648 "Gtk.Align halign" : "Gtk.Align.START",
649 "string label" : "Delete Property / Method",
658 "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
660 "\t_this.deletemenu.el.hide();",
661 "\t_this.node.remove_prop(n);",
666 "string label" : "Delete",
679 "(n_press, in_x, in_y) => {",
681 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
683 "\tvar col = _this.view.getColAt(in_x, in_y);",
688 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
694 "\tGLib.debug(\"hit row %d\", row);",
695 "\tvar prop = _this.selmodel.getPropAt(row);",
696 "\t_this.selmodel.selectProp(prop);",
698 "\t//var point_at = _this.view.getWidgetAtRow(row);",
700 "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
701 " \t// or popover might be trying to do a central?",
702 "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
703 " \t _this.stop_editor();",
704 " _this.view.popover.show(",
705 " \t\t\t_this.view.el, ",
706 " \t\t\t_this.node, prop, ",
715 "xtype" : "GestureClick"
721 "(n_press, in_x, in_y) => {",
726 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
733 "\t_this.stop_editor();",
734 "\tGLib.debug(\"hit row %d\", row);",
735 "\tvar prop = _this.selmodel.getPropAt(row);",
736 "\t_this.selmodel.selectProp(prop);",
740 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
741 "\t//_this.deletemenu.el.set_parent(_this.view.el);",
742 "\tif (_this.deletemenu.el.parent == null) {",
743 "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
748 "\t_this.deletemenu.el.set_offset(",
749 "\t\t\t(int)in_x - _this.view.el.get_width() ,",
750 "\t\t\t(int)in_y - _this.view.el.get_height()",
752 "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
753 " _this.deletemenu.el.popup();",
760 "xtype" : "GestureClick"
765 "bool can_unselect" : true,
770 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
773 "xtype" : "ListStore"
776 "xtype" : "SingleSelection",
777 "| JsRender.NodeProp getPropAt" : [
780 "\treturn (JsRender.NodeProp) this.el.get_item(row);",
785 "| int propToRow" : [
786 "(JsRender.NodeProp prop) {",
787 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
788 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
789 "\t\tif (r.equals(prop)) {",
798 "| void selectProp" : [
799 "(JsRender.NodeProp prop) {",
800 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
801 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
802 "\t\tif (r.equals(prop)) {",
803 "\t\t\tthis.el.selected = i;",
810 "| void startEditing" : [
811 "(JsRender.NodeProp prop) {",
812 "\t// should we call select?? - caller does int (from windowstate)",
819 "* pack" : "append_column",
820 "bool expand" : true,
821 "bool resizable" : true,
826 "* prop" : "factory",
830 " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
831 " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
834 "item.bind_property(\"to_display_name_prop\",",
836 " GLib.BindingFlags.SYNC_CREATE);",
837 "item.bind_property(\"to_tooltip_name_prop\",",
838 " lb, \"tooltip_markup\",",
839 " GLib.BindingFlags.SYNC_CREATE);",
840 "// was item (1) in old layout",
848 "\tvar lbl = new Gtk.Label(\"\");",
849 " \t((Gtk.ListItem)listitem).set_child(lbl);",
850 " \tlbl.justify = Gtk.Justification.LEFT;",
851 " \tlbl.xalign = 1;",
852 " \tlbl.use_markup = true;",
853 "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
854 " \t/*lbl.changed.connect(() => {",
855 "\t\t// notify and save the changed value...",
856 "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
858 " //prop.val = lbl.text;",
859 " //_this.updateIter(iter,prop);",
863 "\t((Gtk.ListItem)listitem).activatable = true;",
868 "xtype" : "SignalListItemFactory"
871 "title" : "Property",
872 "xtype" : "ColumnViewColumn"
876 "* pack" : "append_column",
877 "bool expand" : true,
878 "bool resizable" : true,
883 "* prop" : "factory",
884 "bool is_setting" : false,
888 "\t this.is_setting = true;",
891 "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
896 "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
897 "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
898 "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
899 "\t// decide if it's a combo or editable text..",
900 "\tvar model = (Gtk.StringList) cb.model;",
906 "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
907 "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
908 "\t//GLib.debug(\"prop.val = %s\", prop.val);",
909 "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
911 " var use_textarea = prop.useTextArea();",
914 " var pal = _this.file.project.palete;",
917 " var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);",
919 " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
920 " \tuse_textarea = true;",
924 " if (use_textarea) {",
925 " \tprop.bind_property(\"val_short\",",
927 " GLib.BindingFlags.SYNC_CREATE);",
928 " prop.bind_property(\"val_tooltip\",",
929 " lbl, \"tooltip_markup\",",
930 " GLib.BindingFlags.SYNC_CREATE);",
932 "\t\tthis.is_setting = false; ",
941 " // others... - fill in options for true/false?",
942 " // GLib.debug (ktype.up());",
945 "\t\twhile(model.get_n_items() > 0) {",
946 "\t\t\tmodel.remove(0);",
949 " \t\t// can not remove - hopefully always empty.",
951 "\t\tfor(var i = 0; i < opts.length; i ++) {",
952 "\t\t\tmodel.append( opts[i]);",
953 "\t\t\t// not sure this is a great idea... ",
954 "\t\t\tif (opts[i].down() == prop.val.down()) {",
958 "\t\tGLib.debug(\"Set selected item to %d\", sel);",
959 "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
960 "\t\tthis.is_setting = false; ",
964 "\t// see if type is a Enum.",
965 "\t// triggers a changed event",
967 "\telbl.set_text(prop.val);",
970 "\tthis.is_setting = false; \t\t ",
981 "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
982 "\tvar elbl = new Gtk.EditableLabel(\"\");",
983 "\telbl.hexpand = true;",
984 "\thb.append(elbl);",
985 "\tvar lbl = new Gtk.Label(\"\");",
987 "\tlbl.hexpand = true;",
988 "\tlbl.use_markup = true;",
990 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
991 "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
992 "\tcb.hexpand = true;",
995 "\t((Gtk.ListItem)listitem).set_child(hb);",
997 "\t var ef = new Gtk.EventControllerFocus();",
998 "\t ef.enter.connect(() => {",
999 " \t\t _this.stop_editor();",
1000 " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1001 "\t\t _this.selmodel.selectProp(prop);\t\t",
1003 "\t elbl.add_controller(ef);",
1006 "\t // dropdown??? - stop editing, and highliht node",
1007 "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
1008 "\t tb.clicked.connect(() => {",
1009 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1011 "\t \t _this.stop_editor();",
1012 "\t \t _this.selmodel.selectProp(prop);",
1015 " \telbl.changed.connect(() => {",
1016 "\t\t// notify and save the changed value...",
1018 " //_this.updateIter(iter,prop);",
1019 " // this should happen automatically",
1021 " if (!_this.loading && !this.is_setting) {",
1022 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1025 "\t\t prop.val = elbl.text;",
1026 " \t GLib.debug(\"calling changed\");",
1027 "\t _this.changed();",
1034 "\tcb.notify[\"selected\"].connect(() => {",
1035 "\t\t// dropdown selection changed.",
1039 " //_this.updateIter(iter,prop);",
1040 " if (!_this.loading && !this.is_setting) {",
1041 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1042 "\t\t var model = (Gtk.StringList)cb.model;",
1043 "\t\t prop.val = model.get_string(cb.selected);",
1044 "\t\t GLib.debug(\"property set to %s\", prop.val);",
1045 " \tGLib.debug(\"calling changed\");",
1046 "\t _this.changed();",
1052 "\tvar gc = new Gtk.GestureClick();",
1053 "\tlbl.add_controller(gc);",
1054 "\tgc.pressed.connect(() => {",
1055 "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1056 "\t\t _this.stop_editor();",
1057 "\t _this.show_editor(_this.file, prop.parent, prop);",
1066 "xtype" : "SignalListItemFactory"
1070 "xtype" : "ColumnViewColumn"
1075 "id" : "ContextMenu",
1080 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1089 "\t_this.deleteSelected();",
1103 "string name" : "leftprops-view",
1104 "xtype" : "ColumnView",
1105 "| Gtk.Widget? getWidgetAtRow" : [
1109 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1110 " \tvar colview = gesture.widget;",
1111 " \tvar line_no = check_list_widget(colview, x,y);",
1112 " if (line_no > -1) {",
1113 " \t\tvar item = colview.model.get_item(line_no);",
1117 "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
1118 " var child = this.el.get_first_child(); ",
1119 " \tvar line_no = -1; ",
1120 " \tvar reading_header = true;",
1122 " \twhile (child != null) {",
1123 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1124 " \t if (reading_header) {",
1127 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1128 "\t\t\t\t\tchild = child.get_next_sibling();",
1129 "\t\t\t\t\tcontinue;",
1131 "\t\t\t\tchild = child.get_first_child(); ",
1132 "\t\t\t\treading_header = false;",
1133 "\t\t\t\tcontinue;",
1135 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1136 " \t\t child = child.get_next_sibling();",
1140 "\t\t\tif (line_no == row) {",
1141 "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
1142 "\t\t\t return (Gtk.Widget)child;",
1144 "\t child = child.get_next_sibling(); ",
1146 "\t\tGLib.debug(\"Rturning null\");",
1151 "| int getColAt" : [
1152 "(double x, double y) {",
1155 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1158 "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1159 " var child = this.el.get_first_child(); ",
1163 " \twhile (child != null) {",
1164 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1166 "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1167 "\t\t\t\tchild = child.get_first_child();",
1168 "\t\t\t\tcontinue;",
1171 "\t\t\t//child.get_allocation(out alloc);",
1172 "\t\t\tif (x < (child.get_width() + offx)) {",
1173 "\t\t\t\treturn col;",
1175 "\t\t\toffx += child.get_width();",
1177 "\t\t\tchild = child.get_next_sibling();",
1185 "| int getRowAt" : [
1186 "(double x, double y, out string pos) {",
1188 "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1189 "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1190 "\tif (w == null) {",
1194 "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1195 "\tif (row == null) {",
1199 "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1204 "\twhile (cr.get_prev_sibling() != null) {",
1206 "\t\tcr = cr.get_prev_sibling();",
1209 "\t//GLib.debug(\"row number is %d\", rn);",
1210 "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1211 "\t// above or belw",
1212 "\tGraphene.Rect bounds;",
1213 "\trow.compute_bounds(this.el, out bounds);",
1214 "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1215 "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1216 "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1218 "\tvar ypos = y - bounds.get_y();",
1219 "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1220 "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1221 "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1222 "\tpos = \"over\";",
1224 "\tif (rpos > 80) {",
1225 "\t\tpos = \"below\";",
1226 "\t} else if (rpos < 20) {",
1227 "\t\tpos = \"above\";",
1232 "| void editProp" : [
1233 "(JsRender.NodeProp prop) ",
1235 "\tvar sm = _this.selmodel.el;",
1238 "\t\tGLib.debug(\"finding node\");",
1239 "\t\t_this.selmodel.selectProp(prop);",
1241 "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1242 "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1243 "\t\t\tif (r.equals(prop)) {",
1248 "\t\tif (sr < 0) {",
1249 "\t\t\tGLib.debug(\"finding node - cant find it\");",
1253 "\t\tvar r = this.getWidgetAtRow(sr);",
1254 "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1255 "\t\tvar ca = r.get_first_child();",
1256 "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1257 "\t\tvar cb = ca.get_next_sibling();",
1258 "\t\tvar b = cb.get_first_child();",
1259 "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
1260 "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1261 "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1263 "\t\tGLib.debug(\"row key = %s\", ll.label);",
1264 "\t\tif (e.get_visible()) {",
1265 "\t\t\t_this.stop_editor();",
1266 "\t\t\te.start_editing();",
1267 "\t\t\t//GLib.Timeout.add_once(500, () => {",
1268 "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
1269 "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
1270 "\t\t\t//\ted.grab_focus_without_selecting();",
1274 "\t\tif (d.get_visible()) {",
1275 "\t\t\t_this.stop_editor();",
1276 "\t\t\td.activate();",
1279 "\t\tif (l.get_visible()) {",
1280 "\t\t \t_this.stop_editor();",
1281 "\t \t_this.show_editor(_this.file, prop.parent, prop);",
1287 "\t\t//gtkcolumnviewrowwidget",
1288 "\t\t // cell widet",
1289 "\t\t // cell widget",
1291 "\t\t \t\t// entry / label / dropdown",
1298 "xtype" : "ScrolledWindow"
1302 "| string keyFormat" : [
1303 "(string val, string type) {",
1305 " // Glib.markup_escape_text(val);",
1307 " if (type == \"listener\") {",
1308 " return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1309 " GLib.Markup.escape_text(val) +",
1313 " if (val.length < 1) {",
1314 " return \"<span color=\\\"#FF0000\\\">--empty--</span>\";",
1318 " //$ = property with ",
1319 " //# - object properties",
1321 " // all of these... - display value is last element..",
1322 " var ar = val.strip().split(\" \");",
1325 " var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1330 " switch(val[0]) {",
1331 " case '@': // signal // just bold balck?",
1332 " if (dval[0] == '@') {",
1333 " dval = dval.substring(1);",
1336 " return @\"<span font_weight=\\\"bold\\\">@ $dval</span>\"; ",
1337 " case '#': // object properties?",
1338 " if (dval[0] == '#') {",
1339 " dval = dval.substring(1);",
1341 " return @\"<span font_weight=\\\"bold\\\">$dval</span>\";",
1342 " case '*': // special",
1343 " if (dval[0] == '*') {",
1344 " dval = dval.substring(1);",
1346 " return @\"<span color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\"; ",
1348 " if (dval[0] == '$') {",
1349 " dval = dval.substring(1);",
1351 " return @\"<span style=\\\"italic\\\">$dval</span>\";",
1352 " case '|': // user defined methods",
1353 " if (dval[0] == '|') {",
1354 " dval = dval.substring(1);",
1356 " return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1368 "| string keySortFormat" : [
1370 " // listeners first - with 0",
1372 " if (key[0] == '*') {",
1373 " return \"1 \" + key;",
1377 " var bits = key.split(\" \");",
1379 " if (key[0] == '|') {",
1380 " return \"2 \" + bits[bits.length -1];",
1383 " if (key[0] == '@') {",
1384 " return \"3 \" + bits[bits.length -1];",
1388 " if (key[0] == '#') {",
1389 " return \"4 \" + bits[bits.length -1];",
1392 " return \"5 \" + bits[bits.length -1]; ",
1398 "| void deleteSelected" : [
1404 " Gtk.TreeIter iter;",
1405 " Gtk.TreeModel mod;",
1407 " var s = this.view.el.get_selection();",
1408 " s.get_selected(out mod, out iter);",
1411 " GLib.Value gval;",
1412 " mod.get_value(iter, 0 , out gval);",
1413 " var prop = (JsRender.NodeProp)gval;",
1414 " if (prop == null) {",
1415 "\t this.load(this.file, this.node); ",
1418 " \t// stop editor after fetching property - otherwise prop is null.",
1419 " this.stop_editor();",
1422 " switch(prop.ptype) {",
1423 " case JsRender.NodePropType.LISTENER:",
1424 " this.node.listeners.unset(prop.to_index_key());",
1428 " this.node.props.unset(prop.to_index_key());",
1431 " this.load(this.file, this.node);",
1433 " _this.changed();",
1438 "(JsRender.JsRender file, JsRender.Node? node) ",
1440 "\t// not sure when to initialize this - we should do it on setting main window really. ",
1442 "\tthis.loading = true;",
1443 " if (this.view.popover == null) {",
1444 " \t\t this.view.popover = new Xcls_PopoverProperty();",
1445 " \t\t this.view.popover.mainwindow = _this.main_window;",
1449 " if (this.node != null) {",
1450 " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1454 " GLib.debug(\"load leftprops\\n\");",
1456 " this.node = node;",
1457 " this.file = file;",
1460 " this.model.el.remove_all();",
1462 " //this.get('/RightEditor').el.hide();",
1463 " if (node ==null) {",
1467 " node.loadProps(this.model.el, _this.main_window.windowstate.project); ",
1470 " //GLib.debug(\"clear selection\\n\");",
1472 " \tthis.loading = false;",
1473 " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1474 " this.updateErrors();",
1475 " // clear selection?",
1476 " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1478 " // this.view.el.get_selection().unselect_all();",
1480 " // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1481 " // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1486 "| void removeErrors" : [
1488 "\tvar child = this.view.el.get_first_child(); ",
1490 "\tvar reading_header = true;",
1492 "\twhile (child != null) {",
1493 "\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1495 "\t if (reading_header) {",
1498 "\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1500 "\t\t\t\tchild = child.get_next_sibling();",
1501 "\t\t\t\tcontinue;",
1503 "\t\t\t// should be columnlistview",
1504 "\t\t\tchild = child.get_first_child(); ",
1508 "\t\t\treading_header = false;",
1512 "\t \tif (child.has_css_class(\"node-err\")) {",
1513 "\t\t\tchild.remove_css_class(\"node-err\");",
1515 "\t\tif (child.has_css_class(\"node-warn\")) {",
1516 "\t\t\tchild.remove_css_class(\"node-warn\");",
1519 "\t\tif (child.has_css_class(\"node-depr\")) {",
1520 "\t\t\tchild.remove_css_class(\"node-depr\");",
1523 " child = child.get_next_sibling(); ",
1525 "\t//GLib.debug(\"Rturning null\");",
1529 "| void updateErrors" : [
1531 "\tvar file = this.file;",
1532 "\tif (file == null) {",
1535 "\tvar ar = file.getErrors();",
1536 "\tif (ar == null || ar.size < 1) {",
1537 "\t\tif (this.last_error_counter != file.error_counter) {",
1538 "\t\t\tthis.removeErrors();",
1541 "\t\tthis.last_error_counter = file.error_counter ;",
1545 " \tif (this.last_error_counter == file.error_counter) {",
1548 "\tthis.removeErrors();",
1550 "\tforeach(var diag in ar) { ",
1553 "// print(\"get inter\\n\");",
1554 "\t var node= file.lineToNode( (int)diag.range.start.line) ;",
1555 "\t if (node == null || node.oid != this.node.oid) {",
1558 " \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
1560 " \tvar row = _this.selmodel.propToRow(prop);",
1561 " \tif (row < 0) {",
1564 " \tvar w = this.view.getWidgetAtRow(row);",
1565 " \tif (w == null) {",
1568 "\t \t\tvar ed = diag.category.down();",
1569 "\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
1572 "\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
1573 "\t\t\tw.remove_css_class(\"node-warn\");",
1575 "\t\tif (ed == \"err\" && w.has_css_class(\"node-depr\")) {",
1576 "\t\t\tw.remove_css_class(\"node-depr\");",
1578 "\t\tif (!w.has_css_class(\"node-\"+ ed)) {",
1579 "\t\t\tw.add_css_class(\"node-\" + ed);",
1588 "name" : "WindowLeftProps"