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",
81 "bool always_show_image" : true,
82 "bool hexpand" : true,
87 "bool autohide" : true,
88 "id" : "AddPropertyPopup",
93 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
98 "label" : "id: _this.{ID} (Vala)",
102 " \t_this.AddPropertyPopup.el.hide();",
103 " \t// is this userdef or special??",
104 " \tvar add = new JsRender.NodeProp.prop(\"id\");",
105 " \tif (_this.node.has_prop_key(add)) {",
109 " \t_this.node.add_prop( add );",
111 " \t_this.view.editProp( add );",
117 "tooltip_markup" : "Using _this.{ID} will map to this element",
122 "label" : "pack: Pack method (Vala)",
128 "\t_this.AddPropertyPopup.el.hide();",
129 " \t// is this userdef or special??",
130 " \tvar add = new JsRender.NodeProp.special(\"pack\", \"add\");",
131 " \tif (_this.node.has_prop_key(add)) {",
135 " \t_this.node.add_prop( add );",
137 " \t_this.view.editProp( add );",
143 "tooltip_markup" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
148 "label" : "ctor: Alterative to default contructor (Vala)",
153 " _this.AddPropertyPopup.el.hide();",
154 " \t// is this userdef or special??",
155 " \tvar add = new JsRender.NodeProp.special(\"ctor\");",
156 " \tif (_this.node.has_prop_key(add)) {",
160 " \t_this.node.add_prop( add );",
162 " \t_this.view.editProp( add );",
170 "new Clutter.Image.from_file(.....)"
176 "label" : "init: initialziation code (vala)",
181 " _this.AddPropertyPopup.el.hide();",
182 " \t// is this userdef or special??",
183 " \tvar add = new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) ;",
184 " \tif (_this.node.has_prop_key(add)) {",
188 " \t_this.node.add_prop( add );",
190 " \t_this.view.editProp( add );",
194 "tooltip_markup" : "This code is called after the ctor",
199 "label" : "cms-id: (Roo JS/Pman library)",
204 " _this.AddPropertyPopup.el.hide();",
205 " \t// is this userdef or special??",
206 " \tvar add = new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) ;",
207 " \tif (_this.node.has_prop_key(add)) {",
211 " \t_this.node.add_prop( add );",
213 " \t_this.view.editProp( add );",
219 "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})",
225 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
227 "xtype" : "Separator"
235 " _this.AddPropertyPopup.el.hide();",
236 "\t_this.view.popover.show(",
237 "\t\t_this.view.el, ",
239 "\t\t new JsRender.NodeProp.prop(\"\", \"string\", \"\") ,",
247 "tooltip_markup" : "Add a user defined string property",
256 " _this.AddPropertyPopup.el.hide();",
258 " _this.view.popover.show(",
259 "\t\t_this.view.el, ",
261 "\t\t new JsRender.NodeProp.prop(\"\", \"int\", \"0\") ,",
269 "tooltip_markup" : "Add a user defined number property",
279 " \t _this.AddPropertyPopup.el.hide();",
280 " _this.view.popover.show(",
281 "\t\t_this.view.el, ",
283 "\t\t new JsRender.NodeProp.prop(\"\", \"bool\", \"true\") ,",
291 "tooltip_markup" : "Add a user defined boolean property",
295 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
297 "xtype" : "Separator"
301 "label" : "Javascript Function",
305 " _this.AddPropertyPopup.el.hide(); ",
306 " _this.view.popover.show(",
307 "\t\t_this.view.el, ",
309 "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
318 "tooltip_markup" : "Add a user function boolean property",
323 "label" : "Vala Method",
327 "_this.AddPropertyPopup.el.hide();",
328 " _this.view.popover.show(",
329 "\t\t_this.view.el, ",
331 "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
338 "tooltip_markup" : "Add a user function boolean property",
343 "label" : "Vala Signal",
347 " _this.AddPropertyPopup.el.hide();",
348 " _this.view.popover.show(",
349 "\t\t_this.view.el, ",
351 "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
358 "tooltip_markup" : "Add a vala signal",
362 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
364 "xtype" : "Separator"
368 "label" : "Flexy - If",
372 " \t_this.AddPropertyPopup.el.hide();",
373 " \t_this.view.popover.show(",
374 "\t\t_this.view.el, ",
376 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
385 "tooltip_markup" : "Add a flexy if (for HTML templates)",
390 "label" : "Flexy - Include",
394 " \t_this.AddPropertyPopup.el.hide();",
395 " \t_this.view.popover.show(",
396 "\t\t_this.view.el, ",
398 "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
407 "tooltip_markup" : "Add a flexy include (for HTML templates)",
412 "label" : "Flexy - Foreach",
416 " \t_this.AddPropertyPopup.el.hide();",
417 " \t_this.view.popover.show(",
418 "\t\t_this.view.el, ",
420 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
428 "tooltip_markup" : "Add a flexy include (for HTML templates)",
441 " //_this.before_edit();",
444 " var p = _this.AddPropertyPopup;",
446 " //\tGtk.Allocation rect;",
447 "\t//this.el.get_allocation(out rect);",
448 "\tif (p.el.parent == null) {",
449 "\t\t p.el.set_parent(this.el);",
451 " //p.el.set_pointing_to(rect);",
453 "\tp.el.set_position(Gtk.PositionType.BOTTOM);",
454 "\tp.el.autohide = true;",
461 "string icon_name" : "list-add",
462 "string label" : "Other",
469 "# bool editing" : false,
470 "$ shadow_type" : "Gtk.ShadowType.IN",
475 " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
479 "bool hexpand" : true,
480 "bool vexpand" : true,
484 "$ enable_tree_lines" : true,
485 "$ headers_visible" : true,
490 " \tthis.css = new Gtk.CssProvider();",
492 "\t\tthis.css.load_from_string(\"",
493 "#leftprops-view { font-size: 12px;}",
495 "#leftprops-view dropdown button { ",
496 "\t\t\tmin-height: 16px;\t\t\t ",
497 "\t\t\toutline-offset : 0;",
499 "#leftprops-view cell dropdown label {",
500 " \t\tpadding-top:0px;",
501 "\t\tpadding-bottom:0px;",
503 "#leftprops-view cell { ",
504 " \t\tpadding-top:2px;",
505 "\t\tpadding-bottom:2px;",
507 "#leftprops-view cell label, #leftprops-view cell editablelable {",
508 " \t\tpadding-top:4px;",
509 "\t\tpadding-bottom:4px;",
512 "\t\tGtk.StyleContext.add_provider_for_display(",
513 "\t\tthis.el.get_display(),",
515 "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
522 "* pack" : "set_child",
523 "Gtk.CssProvider css" : "",
524 "Xcls_PopoverProperty popover" : "null",
525 "bool hexpand" : true,
526 "bool show_row_separators" : true,
527 "bool single_click_activate" : false,
528 "bool vexpand" : true,
539 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
549 "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
551 "\t_this.deletemenu.el.hide();",
552 "\t_this.node.remove_prop(n);",
557 "string label" : "Delete",
570 "(n_press, in_x, in_y) => {",
572 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
574 "\tvar col = _this.view.getColAt(in_x, in_y);",
579 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
585 "\tGLib.debug(\"hit row %d\", row);",
586 "\tvar prop = _this.selmodel.getPropAt(row);",
587 "\t_this.selmodel.selectProp(prop);",
589 "\t//var point_at = _this.view.getWidgetAtRow(row);",
591 "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
592 " \t// or popover might be trying to do a central?",
593 "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
594 " \t _this.stop_editor();",
595 " _this.view.popover.show(",
596 " \t\t\t_this.view.el, ",
597 " \t\t\t_this.node, prop, ",
606 "xtype" : "GestureClick"
612 "(n_press, in_x, in_y) => {",
617 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
624 "\t_this.stop_editor();",
625 "\tGLib.debug(\"hit row %d\", row);",
626 "\tvar prop = _this.selmodel.getPropAt(row);",
627 "\t_this.selmodel.selectProp(prop);",
631 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
632 "\t//_this.deletemenu.el.set_parent(_this.view.el);",
633 "\tif (_this.deletemenu.el.parent == null) {",
634 "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
639 "\t_this.deletemenu.el.set_offset(",
640 "\t\t\t(int)in_x - _this.view.el.get_width() ,",
641 "\t\t\t(int)in_y - _this.view.el.get_height()",
643 "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
644 " _this.deletemenu.el.popup();",
651 "xtype" : "GestureClick"
656 "bool can_unselect" : true,
661 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
664 "xtype" : "ListStore"
667 "xtype" : "SingleSelection",
668 "| JsRender.NodeProp getPropAt" : [
671 "\treturn (JsRender.NodeProp) this.el.get_item(row);",
676 "| int propToRow" : [
677 "(JsRender.NodeProp prop) {",
678 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
679 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
680 "\t\tif (r.equals(prop)) {",
689 "| void selectProp" : [
690 "(JsRender.NodeProp prop) {",
691 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
692 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
693 "\t\tif (r.equals(prop)) {",
694 "\t\t\tthis.el.selected = i;",
701 "| void startEditing" : [
702 "(JsRender.NodeProp prop) {",
703 "\t// should we call select?? - caller does int (from windowstate)",
710 "* pack" : "append_column",
711 "bool expand" : true,
712 "bool resizable" : true,
717 "* prop" : "factory",
721 " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
722 " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
725 "item.bind_property(\"to_display_name_prop\",",
727 " GLib.BindingFlags.SYNC_CREATE);",
728 "item.bind_property(\"to_tooltip_name_prop\",",
729 " lb, \"tooltip_markup\",",
730 " GLib.BindingFlags.SYNC_CREATE);",
731 "// was item (1) in old layout",
739 "\tvar lbl = new Gtk.Label(\"\");",
740 " \t((Gtk.ListItem)listitem).set_child(lbl);",
741 " \tlbl.justify = Gtk.Justification.LEFT;",
742 " \tlbl.xalign = 1;",
743 " \tlbl.use_markup = true;",
744 "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
745 " \t/*lbl.changed.connect(() => {",
746 "\t\t// notify and save the changed value...",
747 "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
749 " //prop.val = lbl.text;",
750 " //_this.updateIter(iter,prop);",
754 "\t((Gtk.ListItem)listitem).activatable = true;",
759 "xtype" : "SignalListItemFactory"
762 "title" : "Property",
763 "xtype" : "ColumnViewColumn"
767 "* pack" : "append_column",
768 "bool expand" : true,
769 "bool resizable" : true,
774 "* prop" : "factory",
775 "bool is_setting" : false,
779 "\t this.is_setting = true;",
782 "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
787 "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
788 "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
789 "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
790 "\t// decide if it's a combo or editable text..",
791 "\tvar model = (Gtk.StringList) cb.model;",
797 "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
798 "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
799 "\t//GLib.debug(\"prop.val = %s\", prop.val);",
800 "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
802 " var use_textarea = prop.useTextArea();",
805 " var pal = _this.file.project.palete;",
808 " var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);",
810 " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
811 " \tuse_textarea = true;",
815 " if (use_textarea) {",
816 " \tprop.bind_property(\"val_short\",",
818 " GLib.BindingFlags.SYNC_CREATE);",
819 " prop.bind_property(\"val_tooltip\",",
820 " lbl, \"tooltip_markup\",",
821 " GLib.BindingFlags.SYNC_CREATE);",
823 "\t\tthis.is_setting = false; ",
832 " // others... - fill in options for true/false?",
833 " // GLib.debug (ktype.up());",
836 "\t\twhile(model.get_n_items() > 0) {",
837 "\t\t\tmodel.remove(0);",
840 " \t\t// can not remove - hopefully always empty.",
842 "\t\tfor(var i = 0; i < opts.length; i ++) {",
843 "\t\t\tmodel.append( opts[i]);",
844 "\t\t\t// not sure this is a great idea... ",
845 "\t\t\tif (opts[i].down() == prop.val.down()) {",
849 "\t\tGLib.debug(\"Set selected item to %d\", sel);",
850 "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
851 "\t\tthis.is_setting = false; ",
855 "\t// see if type is a Enum.",
856 "\t// triggers a changed event",
858 "\telbl.set_text(prop.val);",
861 "\tthis.is_setting = false; \t\t ",
872 "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
873 "\tvar elbl = new Gtk.EditableLabel(\"\");",
874 "\telbl.hexpand = true;",
875 "\thb.append(elbl);",
876 "\tvar lbl = new Gtk.Label(\"\");",
878 "\tlbl.hexpand = true;",
879 "\tlbl.use_markup = true;",
881 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
882 "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
883 "\tcb.hexpand = true;",
886 "\t((Gtk.ListItem)listitem).set_child(hb);",
888 "\t var ef = new Gtk.EventControllerFocus();",
889 "\t ef.enter.connect(() => {",
890 " \t\t _this.stop_editor();",
891 " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
892 "\t\t _this.selmodel.selectProp(prop);\t\t",
894 "\t elbl.add_controller(ef);",
897 "\t // dropdown??? - stop editing, and highliht node",
898 "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
899 "\t tb.clicked.connect(() => {",
900 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
902 "\t \t _this.stop_editor();",
903 "\t \t _this.selmodel.selectProp(prop);",
906 " \telbl.changed.connect(() => {",
907 "\t\t// notify and save the changed value...",
909 " //_this.updateIter(iter,prop);",
910 " // this should happen automatically",
912 " if (!_this.loading && !this.is_setting) {",
913 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
916 "\t\t prop.val = elbl.text;",
917 " \t GLib.debug(\"calling changed\");",
918 "\t _this.changed();",
925 "\tcb.notify[\"selected\"].connect(() => {",
926 "\t\t// dropdown selection changed.",
930 " //_this.updateIter(iter,prop);",
931 " if (!_this.loading && !this.is_setting) {",
932 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
933 "\t\t var model = (Gtk.StringList)cb.model;",
934 "\t\t prop.val = model.get_string(cb.selected);",
935 "\t\t GLib.debug(\"property set to %s\", prop.val);",
936 " \tGLib.debug(\"calling changed\");",
937 "\t _this.changed();",
943 "\tvar gc = new Gtk.GestureClick();",
944 "\tlbl.add_controller(gc);",
945 "\tgc.pressed.connect(() => {",
946 "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
947 "\t\t _this.stop_editor();",
948 "\t _this.show_editor(_this.file, prop.parent, prop);",
957 "xtype" : "SignalListItemFactory"
961 "xtype" : "ColumnViewColumn"
966 "id" : "ContextMenu",
971 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
980 "\t_this.deleteSelected();",
994 "string name" : "leftprops-view",
995 "xtype" : "ColumnView",
996 "| Gtk.Widget? getWidgetAtRow" : [
1000 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1001 " \tvar colview = gesture.widget;",
1002 " \tvar line_no = check_list_widget(colview, x,y);",
1003 " if (line_no > -1) {",
1004 " \t\tvar item = colview.model.get_item(line_no);",
1008 "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
1009 " var child = this.el.get_first_child(); ",
1010 " \tvar line_no = -1; ",
1011 " \tvar reading_header = true;",
1013 " \twhile (child != null) {",
1014 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1015 " \t if (reading_header) {",
1018 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1019 "\t\t\t\t\tchild = child.get_next_sibling();",
1020 "\t\t\t\t\tcontinue;",
1022 "\t\t\t\tchild = child.get_first_child(); ",
1023 "\t\t\t\treading_header = false;",
1024 "\t\t\t\tcontinue;",
1026 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1027 " \t\t child = child.get_next_sibling();",
1031 "\t\t\tif (line_no == row) {",
1032 "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
1033 "\t\t\t return (Gtk.Widget)child;",
1035 "\t child = child.get_next_sibling(); ",
1037 "\t\tGLib.debug(\"Rturning null\");",
1042 "| int getColAt" : [
1043 "(double x, double y) {",
1046 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1049 "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1050 " var child = this.el.get_first_child(); ",
1054 " \twhile (child != null) {",
1055 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1057 "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1058 "\t\t\t\tchild = child.get_first_child();",
1059 "\t\t\t\tcontinue;",
1062 "\t\t\t//child.get_allocation(out alloc);",
1063 "\t\t\tif (x < (child.get_width() + offx)) {",
1064 "\t\t\t\treturn col;",
1066 "\t\t\toffx += child.get_width();",
1068 "\t\t\tchild = child.get_next_sibling();",
1076 "| int getRowAt" : [
1077 "(double x, double in_y, out string pos) {",
1084 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1085 " \tvar colview = gesture.widget;",
1086 " \tvar line_no = check_list_widget(colview, x,y);",
1087 " if (line_no > -1) {",
1088 " \t\tvar item = colview.model.get_item(line_no);",
1094 " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
1095 " \tvar y = in_y + _this.EditProps.el.vadjustment.value; ",
1096 " var child = this.el.get_first_child(); ",
1097 " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1098 " \tvar line_no = -1; ",
1099 " \tvar reading_header = true;",
1100 " \tvar real_y = 0;",
1101 " \tvar header_height = 0;",
1102 " \tpos = \"none\";",
1104 " \twhile (child != null) {",
1105 "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1106 " \t if (reading_header) {",
1109 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1110 "\t\t\t h += child.get_height();",
1111 "\t\t\t\t\tchild = child.get_next_sibling();",
1112 "\t\t\t\t\tcontinue;",
1114 "\t\t\t\t// should be columnlistview",
1115 "\t\t\t\tchild = child.get_first_child(); ",
1116 "\t\t\t GLib.debug(\"header height=%d\", h);",
1117 "\t\t\t\theader_height = h;",
1119 "\t\t\t\treading_header = false;",
1123 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1124 " \t\t child = child.get_next_sibling();",
1128 "\t\t \tif (y < header_height) {",
1129 "\t\t \treturn -1;",
1133 "\t\t\tvar hh = child.get_height();",
1134 "\t\t\t//child.get_allocation(out alloc);",
1135 "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
1136 "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
1138 "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
1140 "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
1141 "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
1142 "\t\t \t\tpos = \"below\";",
1143 "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
1144 "\t \t\t\tpos = \"over\";",
1146 " \t\t\t\tpos = \"above\";",
1148 "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
1149 "\t\t\t return line_no;",
1153 "\t\t if (real_y + hh > y) {",
1157 "\t child = child.get_next_sibling(); ",
1163 "| void editProp" : [
1164 "(JsRender.NodeProp prop) ",
1166 "\tvar sm = _this.selmodel.el;",
1169 "\t\tGLib.debug(\"finding node\");",
1170 "\t\t_this.selmodel.selectProp(prop);",
1172 "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1173 "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1174 "\t\t\tif (r.equals(prop)) {",
1179 "\t\tif (sr < 0) {",
1180 "\t\t\tGLib.debug(\"finding node - cant find it\");",
1184 "\t\tvar r = this.getWidgetAtRow(sr);",
1185 "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1186 "\t\tvar ca = r.get_first_child();",
1187 "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1188 "\t\tvar cb = ca.get_next_sibling();",
1189 "\t\tvar b = cb.get_first_child();",
1190 "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
1191 "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1192 "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1194 "\t\tGLib.debug(\"row key = %s\", ll.label);",
1195 "\t\tif (e.get_visible()) {",
1196 "\t\t\t_this.stop_editor();",
1197 "\t\t\te.start_editing();",
1198 "\t\t\t//GLib.Timeout.add_once(500, () => {",
1199 "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
1200 "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
1201 "\t\t\t//\ted.grab_focus_without_selecting();",
1205 "\t\tif (d.get_visible()) {",
1206 "\t\t\t_this.stop_editor();",
1207 "\t\t\td.activate();",
1210 "\t\tif (l.get_visible()) {",
1211 "\t\t \t_this.stop_editor();",
1212 "\t \t_this.show_editor(_this.file, prop.parent, prop);",
1218 "\t\t//gtkcolumnviewrowwidget",
1219 "\t\t // cell widet",
1220 "\t\t // cell widget",
1222 "\t\t \t\t// entry / label / dropdown",
1229 "xtype" : "ScrolledWindow"
1233 "| string keyFormat" : [
1234 "(string val, string type) {",
1236 " // Glib.markup_escape_text(val);",
1238 " if (type == \"listener\") {",
1239 " return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1240 " GLib.Markup.escape_text(val) +",
1244 " if (val.length < 1) {",
1245 " return \"<span color=\\\"#FF0000\\\">--empty--</span>\";",
1249 " //$ = property with ",
1250 " //# - object properties",
1252 " // all of these... - display value is last element..",
1253 " var ar = val.strip().split(\" \");",
1256 " var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1261 " switch(val[0]) {",
1262 " case '@': // signal // just bold balck?",
1263 " if (dval[0] == '@') {",
1264 " dval = dval.substring(1);",
1267 " return @\"<span font_weight=\\\"bold\\\">@ $dval</span>\"; ",
1268 " case '#': // object properties?",
1269 " if (dval[0] == '#') {",
1270 " dval = dval.substring(1);",
1272 " return @\"<span font_weight=\\\"bold\\\">$dval</span>\";",
1273 " case '*': // special",
1274 " if (dval[0] == '*') {",
1275 " dval = dval.substring(1);",
1277 " return @\"<span color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\"; ",
1279 " if (dval[0] == '$') {",
1280 " dval = dval.substring(1);",
1282 " return @\"<span style=\\\"italic\\\">$dval</span>\";",
1283 " case '|': // user defined methods",
1284 " if (dval[0] == '|') {",
1285 " dval = dval.substring(1);",
1287 " return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1299 "| string keySortFormat" : [
1301 " // listeners first - with 0",
1303 " if (key[0] == '*') {",
1304 " return \"1 \" + key;",
1308 " var bits = key.split(\" \");",
1310 " if (key[0] == '|') {",
1311 " return \"2 \" + bits[bits.length -1];",
1314 " if (key[0] == '@') {",
1315 " return \"3 \" + bits[bits.length -1];",
1319 " if (key[0] == '#') {",
1320 " return \"4 \" + bits[bits.length -1];",
1323 " return \"5 \" + bits[bits.length -1]; ",
1329 "| void a_addProp" : [
1330 " (JsRender.NodeProp prop) {",
1331 " // info includes key, val, skel, etype..",
1332 " //console.dump(info);",
1333 " //type = info.type.toLowerCase();",
1334 " //var data = this.toJS();",
1337 " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
1338 " if (this.node.listeners.has_key(prop.name)) {",
1341 " this.node.listeners.set(prop.name,prop);",
1343 " assert(this.node != null);",
1344 " assert(this.node.props != null);",
1345 " if (this.node.props.has_key(prop.to_index_key())) {",
1348 " this.node.props.set(prop.to_index_key(),prop);",
1353 " this.load(this.file, this.node);",
1358 " GLib.debug(\"trying to find new iter\");",
1365 "| void deleteSelected" : [
1371 " Gtk.TreeIter iter;",
1372 " Gtk.TreeModel mod;",
1374 " var s = this.view.el.get_selection();",
1375 " s.get_selected(out mod, out iter);",
1378 " GLib.Value gval;",
1379 " mod.get_value(iter, 0 , out gval);",
1380 " var prop = (JsRender.NodeProp)gval;",
1381 " if (prop == null) {",
1382 "\t this.load(this.file, this.node); ",
1385 " \t// stop editor after fetching property - otherwise prop is null.",
1386 " this.stop_editor();",
1389 " switch(prop.ptype) {",
1390 " case JsRender.NodePropType.LISTENER:",
1391 " this.node.listeners.unset(prop.to_index_key());",
1395 " this.node.props.unset(prop.to_index_key());",
1398 " this.load(this.file, this.node);",
1400 " _this.changed();",
1405 "(JsRender.JsRender file, JsRender.Node? node) ",
1407 "\t// not sure when to initialize this - we should do it on setting main window really. ",
1409 "\tthis.loading = true;",
1410 " if (this.view.popover == null) {",
1411 " \t\t this.view.popover = new Xcls_PopoverProperty();",
1412 " \t\t this.view.popover.mainwindow = _this.main_window;",
1416 " if (this.node != null) {",
1417 " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1421 " GLib.debug(\"load leftprops\\n\");",
1423 " this.node = node;",
1424 " this.file = file;",
1427 " this.model.el.remove_all();",
1429 " //this.get('/RightEditor').el.hide();",
1430 " if (node ==null) {",
1433 " node.loadProps(this.model.el); ",
1436 " //GLib.debug(\"clear selection\\n\");",
1438 " \tthis.loading = false;",
1439 " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1440 " this.updateErrors();",
1441 " // clear selection?",
1442 " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1444 " // this.view.el.get_selection().unselect_all();",
1446 " // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1447 " // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1452 "| void removeErrors" : [
1454 "\tvar child = this.view.el.get_first_child(); ",
1456 "\tvar reading_header = true;",
1458 "\twhile (child != null) {",
1459 "\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1461 "\t if (reading_header) {",
1464 "\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1466 "\t\t\t\tchild = child.get_next_sibling();",
1467 "\t\t\t\tcontinue;",
1469 "\t\t\t// should be columnlistview",
1470 "\t\t\tchild = child.get_first_child(); ",
1474 "\t\t\treading_header = false;",
1478 "\t \tif (child.has_css_class(\"node-err\")) {",
1479 "\t\t\tchild.remove_css_class(\"node-err\");",
1481 "\t\tif (child.has_css_class(\"node-warn\")) {",
1482 "\t\t\tchild.remove_css_class(\"node-warn\");",
1485 "\t\tif (child.has_css_class(\"node-depr\")) {",
1486 "\t\t\tchild.remove_css_class(\"node-depr\");",
1489 " child = child.get_next_sibling(); ",
1491 "\t//GLib.debug(\"Rturning null\");",
1495 "| void updateErrors" : [
1497 "\tvar file = this.file;",
1498 "\tvar ar = file.getErrors();",
1499 "\tif (ar.size < 1) {",
1500 "\t\tthis.removeErrors();",
1501 "\t\tthis.last_error_counter = file.error_counter ;",
1505 " \tif (this.last_error_counter == file.error_counter) {",
1508 "\tthis.removeErrors();",
1510 "\tforeach(var diag in ar) { ",
1513 "// print(\"get inter\\n\");",
1514 "\t var node= file.lineToNode( (int)diag.range.start.line) ;",
1515 "\t if (node == null || node.oid != this.node.oid) {",
1518 " \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
1520 " \tvar row = _this.selmodel.propToRow(prop);",
1521 " \tif (row < 0) {",
1524 " \tvar w = this.view.getWidgetAtRow(row);",
1525 " \tif (w == null) {",
1528 "\t \t\tvar ed = diag.category.down();",
1529 "\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
1532 "\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
1533 "\t\t\tw.remove_css_class(\"node-warn\");",
1535 "\t\tif (ed == \"err\" && w.has_css_class(\"node-depr\")) {",
1536 "\t\t\tw.remove_css_class(\"node-depr\");",
1538 "\t\tif (!w.has_css_class(\"node-\"+ ed)) {",
1539 "\t\t\tw.add_css_class(\"node-\" + ed);",
1548 "name" : "WindowLeftProps"