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.prop(\"\", \"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.prop(\"\", \"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.prop(\"\", \"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",
648 "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
650 "\t_this.deletemenu.el.hide();",
651 "\t_this.node.remove_prop(n);",
656 "string label" : "Delete",
669 "(n_press, in_x, in_y) => {",
671 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
673 "\tvar col = _this.view.getColAt(in_x, in_y);",
678 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
684 "\tGLib.debug(\"hit row %d\", row);",
685 "\tvar prop = _this.selmodel.getPropAt(row);",
686 "\t_this.selmodel.selectProp(prop);",
688 "\t//var point_at = _this.view.getWidgetAtRow(row);",
690 "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
691 " \t// or popover might be trying to do a central?",
692 "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
693 " \t _this.stop_editor();",
694 " _this.view.popover.show(",
695 " \t\t\t_this.view.el, ",
696 " \t\t\t_this.node, prop, ",
705 "xtype" : "GestureClick"
711 "(n_press, in_x, in_y) => {",
716 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
723 "\t_this.stop_editor();",
724 "\tGLib.debug(\"hit row %d\", row);",
725 "\tvar prop = _this.selmodel.getPropAt(row);",
726 "\t_this.selmodel.selectProp(prop);",
730 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
731 "\t//_this.deletemenu.el.set_parent(_this.view.el);",
732 "\tif (_this.deletemenu.el.parent == null) {",
733 "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
738 "\t_this.deletemenu.el.set_offset(",
739 "\t\t\t(int)in_x - _this.view.el.get_width() ,",
740 "\t\t\t(int)in_y - _this.view.el.get_height()",
742 "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
743 " _this.deletemenu.el.popup();",
750 "xtype" : "GestureClick"
755 "bool can_unselect" : true,
760 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
763 "xtype" : "ListStore"
766 "xtype" : "SingleSelection",
767 "| JsRender.NodeProp getPropAt" : [
770 "\treturn (JsRender.NodeProp) this.el.get_item(row);",
775 "| int propToRow" : [
776 "(JsRender.NodeProp prop) {",
777 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
778 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
779 "\t\tif (r.equals(prop)) {",
788 "| void selectProp" : [
789 "(JsRender.NodeProp prop) {",
790 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
791 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
792 "\t\tif (r.equals(prop)) {",
793 "\t\t\tthis.el.selected = i;",
800 "| void startEditing" : [
801 "(JsRender.NodeProp prop) {",
802 "\t// should we call select?? - caller does int (from windowstate)",
809 "* pack" : "append_column",
810 "bool expand" : true,
811 "bool resizable" : true,
816 "* prop" : "factory",
820 " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
821 " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
824 "item.bind_property(\"to_display_name_prop\",",
826 " GLib.BindingFlags.SYNC_CREATE);",
827 "item.bind_property(\"to_tooltip_name_prop\",",
828 " lb, \"tooltip_markup\",",
829 " GLib.BindingFlags.SYNC_CREATE);",
830 "// was item (1) in old layout",
838 "\tvar lbl = new Gtk.Label(\"\");",
839 " \t((Gtk.ListItem)listitem).set_child(lbl);",
840 " \tlbl.justify = Gtk.Justification.LEFT;",
841 " \tlbl.xalign = 1;",
842 " \tlbl.use_markup = true;",
843 "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
844 " \t/*lbl.changed.connect(() => {",
845 "\t\t// notify and save the changed value...",
846 "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
848 " //prop.val = lbl.text;",
849 " //_this.updateIter(iter,prop);",
853 "\t((Gtk.ListItem)listitem).activatable = true;",
858 "xtype" : "SignalListItemFactory"
861 "title" : "Property",
862 "xtype" : "ColumnViewColumn"
866 "* pack" : "append_column",
867 "bool expand" : true,
868 "bool resizable" : true,
873 "* prop" : "factory",
874 "bool is_setting" : false,
878 "\t this.is_setting = true;",
881 "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
886 "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
887 "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
888 "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
889 "\t// decide if it's a combo or editable text..",
890 "\tvar model = (Gtk.StringList) cb.model;",
896 "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
897 "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
898 "\t//GLib.debug(\"prop.val = %s\", prop.val);",
899 "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
901 " var use_textarea = prop.useTextArea();",
904 " var pal = _this.file.project.palete;",
907 " var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);",
909 " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
910 " \tuse_textarea = true;",
914 " if (use_textarea) {",
915 " \tprop.bind_property(\"val_short\",",
917 " GLib.BindingFlags.SYNC_CREATE);",
918 " prop.bind_property(\"val_tooltip\",",
919 " lbl, \"tooltip_markup\",",
920 " GLib.BindingFlags.SYNC_CREATE);",
922 "\t\tthis.is_setting = false; ",
931 " // others... - fill in options for true/false?",
932 " // GLib.debug (ktype.up());",
935 "\t\twhile(model.get_n_items() > 0) {",
936 "\t\t\tmodel.remove(0);",
939 " \t\t// can not remove - hopefully always empty.",
941 "\t\tfor(var i = 0; i < opts.length; i ++) {",
942 "\t\t\tmodel.append( opts[i]);",
943 "\t\t\t// not sure this is a great idea... ",
944 "\t\t\tif (opts[i].down() == prop.val.down()) {",
948 "\t\tGLib.debug(\"Set selected item to %d\", sel);",
949 "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
950 "\t\tthis.is_setting = false; ",
954 "\t// see if type is a Enum.",
955 "\t// triggers a changed event",
957 "\telbl.set_text(prop.val);",
960 "\tthis.is_setting = false; \t\t ",
971 "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
972 "\tvar elbl = new Gtk.EditableLabel(\"\");",
973 "\telbl.hexpand = true;",
974 "\thb.append(elbl);",
975 "\tvar lbl = new Gtk.Label(\"\");",
977 "\tlbl.hexpand = true;",
978 "\tlbl.use_markup = true;",
980 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
981 "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
982 "\tcb.hexpand = true;",
985 "\t((Gtk.ListItem)listitem).set_child(hb);",
987 "\t var ef = new Gtk.EventControllerFocus();",
988 "\t ef.enter.connect(() => {",
989 " \t\t _this.stop_editor();",
990 " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
991 "\t\t _this.selmodel.selectProp(prop);\t\t",
993 "\t elbl.add_controller(ef);",
996 "\t // dropdown??? - stop editing, and highliht node",
997 "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
998 "\t tb.clicked.connect(() => {",
999 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1001 "\t \t _this.stop_editor();",
1002 "\t \t _this.selmodel.selectProp(prop);",
1005 " \telbl.changed.connect(() => {",
1006 "\t\t// notify and save the changed value...",
1008 " //_this.updateIter(iter,prop);",
1009 " // this should happen automatically",
1011 " if (!_this.loading && !this.is_setting) {",
1012 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1015 "\t\t prop.val = elbl.text;",
1016 " \t GLib.debug(\"calling changed\");",
1017 "\t _this.changed();",
1024 "\tcb.notify[\"selected\"].connect(() => {",
1025 "\t\t// dropdown selection changed.",
1029 " //_this.updateIter(iter,prop);",
1030 " if (!_this.loading && !this.is_setting) {",
1031 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1032 "\t\t var model = (Gtk.StringList)cb.model;",
1033 "\t\t prop.val = model.get_string(cb.selected);",
1034 "\t\t GLib.debug(\"property set to %s\", prop.val);",
1035 " \tGLib.debug(\"calling changed\");",
1036 "\t _this.changed();",
1042 "\tvar gc = new Gtk.GestureClick();",
1043 "\tlbl.add_controller(gc);",
1044 "\tgc.pressed.connect(() => {",
1045 "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1046 "\t\t _this.stop_editor();",
1047 "\t _this.show_editor(_this.file, prop.parent, prop);",
1056 "xtype" : "SignalListItemFactory"
1060 "xtype" : "ColumnViewColumn"
1065 "id" : "ContextMenu",
1070 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1079 "\t_this.deleteSelected();",
1093 "string name" : "leftprops-view",
1094 "xtype" : "ColumnView",
1095 "| Gtk.Widget? getWidgetAtRow" : [
1099 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1100 " \tvar colview = gesture.widget;",
1101 " \tvar line_no = check_list_widget(colview, x,y);",
1102 " if (line_no > -1) {",
1103 " \t\tvar item = colview.model.get_item(line_no);",
1107 "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
1108 " var child = this.el.get_first_child(); ",
1109 " \tvar line_no = -1; ",
1110 " \tvar reading_header = true;",
1112 " \twhile (child != null) {",
1113 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1114 " \t if (reading_header) {",
1117 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1118 "\t\t\t\t\tchild = child.get_next_sibling();",
1119 "\t\t\t\t\tcontinue;",
1121 "\t\t\t\tchild = child.get_first_child(); ",
1122 "\t\t\t\treading_header = false;",
1123 "\t\t\t\tcontinue;",
1125 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1126 " \t\t child = child.get_next_sibling();",
1130 "\t\t\tif (line_no == row) {",
1131 "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
1132 "\t\t\t return (Gtk.Widget)child;",
1134 "\t child = child.get_next_sibling(); ",
1136 "\t\tGLib.debug(\"Rturning null\");",
1141 "| int getColAt" : [
1142 "(double x, double y) {",
1145 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1148 "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1149 " var child = this.el.get_first_child(); ",
1153 " \twhile (child != null) {",
1154 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1156 "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1157 "\t\t\t\tchild = child.get_first_child();",
1158 "\t\t\t\tcontinue;",
1161 "\t\t\t//child.get_allocation(out alloc);",
1162 "\t\t\tif (x < (child.get_width() + offx)) {",
1163 "\t\t\t\treturn col;",
1165 "\t\t\toffx += child.get_width();",
1167 "\t\t\tchild = child.get_next_sibling();",
1175 "| int getRowAt" : [
1176 "(double x, double in_y, out string pos) {",
1183 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1184 " \tvar colview = gesture.widget;",
1185 " \tvar line_no = check_list_widget(colview, x,y);",
1186 " if (line_no > -1) {",
1187 " \t\tvar item = colview.model.get_item(line_no);",
1193 " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
1194 " \tvar y = in_y + _this.EditProps.el.vadjustment.value; ",
1195 " var child = this.el.get_first_child(); ",
1196 " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1197 " \tvar line_no = -1; ",
1198 " \tvar reading_header = true;",
1199 " \tvar real_y = 0;",
1200 " \tvar header_height = 0;",
1201 " \tpos = \"none\";",
1203 " \twhile (child != null) {",
1204 "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1205 " \t if (reading_header) {",
1208 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1209 "\t\t\t h += child.get_height();",
1210 "\t\t\t\t\tchild = child.get_next_sibling();",
1211 "\t\t\t\t\tcontinue;",
1213 "\t\t\t\t// should be columnlistview",
1214 "\t\t\t\tchild = child.get_first_child(); ",
1215 "\t\t\t //GLib.debug(\"header height=%d\", h);",
1216 "\t\t\t\theader_height = h;",
1218 "\t\t\t\treading_header = false;",
1219 "\t\t\t\tcontinue;",
1222 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1223 " \t\t child = child.get_next_sibling();",
1227 "\t\t \tif (y < header_height) {",
1228 "\t\t \treturn -1;",
1232 "\t\t\tvar hh = child.get_height();",
1233 "\t\t\tif (child.has_css_class(\"node-err\") || ",
1234 "\t\t\t\tchild.has_css_class(\"node-warn\") || ",
1235 "\t\t\t\tchild.has_css_class(\"node-depr\")) {",
1236 "\t\t\t\thh += 10;",
1240 "\t\t\t//child.get_allocation(out alloc);",
1241 "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
1242 "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
1244 "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
1246 "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
1247 "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
1248 "\t\t \t\tpos = \"below\";",
1249 "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
1250 "\t \t\t\tpos = \"over\";",
1252 " \t\t\t\tpos = \"above\";",
1254 "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
1255 "\t\t\t return line_no;",
1259 "\t\t if (real_y + hh > y) {",
1263 "\t child = child.get_next_sibling(); ",
1269 "| void editProp" : [
1270 "(JsRender.NodeProp prop) ",
1272 "\tvar sm = _this.selmodel.el;",
1275 "\t\tGLib.debug(\"finding node\");",
1276 "\t\t_this.selmodel.selectProp(prop);",
1278 "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1279 "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1280 "\t\t\tif (r.equals(prop)) {",
1285 "\t\tif (sr < 0) {",
1286 "\t\t\tGLib.debug(\"finding node - cant find it\");",
1290 "\t\tvar r = this.getWidgetAtRow(sr);",
1291 "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1292 "\t\tvar ca = r.get_first_child();",
1293 "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1294 "\t\tvar cb = ca.get_next_sibling();",
1295 "\t\tvar b = cb.get_first_child();",
1296 "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
1297 "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1298 "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1300 "\t\tGLib.debug(\"row key = %s\", ll.label);",
1301 "\t\tif (e.get_visible()) {",
1302 "\t\t\t_this.stop_editor();",
1303 "\t\t\te.start_editing();",
1304 "\t\t\t//GLib.Timeout.add_once(500, () => {",
1305 "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
1306 "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
1307 "\t\t\t//\ted.grab_focus_without_selecting();",
1311 "\t\tif (d.get_visible()) {",
1312 "\t\t\t_this.stop_editor();",
1313 "\t\t\td.activate();",
1316 "\t\tif (l.get_visible()) {",
1317 "\t\t \t_this.stop_editor();",
1318 "\t \t_this.show_editor(_this.file, prop.parent, prop);",
1324 "\t\t//gtkcolumnviewrowwidget",
1325 "\t\t // cell widet",
1326 "\t\t // cell widget",
1328 "\t\t \t\t// entry / label / dropdown",
1335 "xtype" : "ScrolledWindow"
1339 "| string keyFormat" : [
1340 "(string val, string type) {",
1342 " // Glib.markup_escape_text(val);",
1344 " if (type == \"listener\") {",
1345 " return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1346 " GLib.Markup.escape_text(val) +",
1350 " if (val.length < 1) {",
1351 " return \"<span color=\\\"#FF0000\\\">--empty--</span>\";",
1355 " //$ = property with ",
1356 " //# - object properties",
1358 " // all of these... - display value is last element..",
1359 " var ar = val.strip().split(\" \");",
1362 " var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1367 " switch(val[0]) {",
1368 " case '@': // signal // just bold balck?",
1369 " if (dval[0] == '@') {",
1370 " dval = dval.substring(1);",
1373 " return @\"<span font_weight=\\\"bold\\\">@ $dval</span>\"; ",
1374 " case '#': // object properties?",
1375 " if (dval[0] == '#') {",
1376 " dval = dval.substring(1);",
1378 " return @\"<span font_weight=\\\"bold\\\">$dval</span>\";",
1379 " case '*': // special",
1380 " if (dval[0] == '*') {",
1381 " dval = dval.substring(1);",
1383 " return @\"<span color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\"; ",
1385 " if (dval[0] == '$') {",
1386 " dval = dval.substring(1);",
1388 " return @\"<span style=\\\"italic\\\">$dval</span>\";",
1389 " case '|': // user defined methods",
1390 " if (dval[0] == '|') {",
1391 " dval = dval.substring(1);",
1393 " return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1405 "| string keySortFormat" : [
1407 " // listeners first - with 0",
1409 " if (key[0] == '*') {",
1410 " return \"1 \" + key;",
1414 " var bits = key.split(\" \");",
1416 " if (key[0] == '|') {",
1417 " return \"2 \" + bits[bits.length -1];",
1420 " if (key[0] == '@') {",
1421 " return \"3 \" + bits[bits.length -1];",
1425 " if (key[0] == '#') {",
1426 " return \"4 \" + bits[bits.length -1];",
1429 " return \"5 \" + bits[bits.length -1]; ",
1435 "| void deleteSelected" : [
1441 " Gtk.TreeIter iter;",
1442 " Gtk.TreeModel mod;",
1444 " var s = this.view.el.get_selection();",
1445 " s.get_selected(out mod, out iter);",
1448 " GLib.Value gval;",
1449 " mod.get_value(iter, 0 , out gval);",
1450 " var prop = (JsRender.NodeProp)gval;",
1451 " if (prop == null) {",
1452 "\t this.load(this.file, this.node); ",
1455 " \t// stop editor after fetching property - otherwise prop is null.",
1456 " this.stop_editor();",
1459 " switch(prop.ptype) {",
1460 " case JsRender.NodePropType.LISTENER:",
1461 " this.node.listeners.unset(prop.to_index_key());",
1465 " this.node.props.unset(prop.to_index_key());",
1468 " this.load(this.file, this.node);",
1470 " _this.changed();",
1475 "(JsRender.JsRender file, JsRender.Node? node) ",
1477 "\t// not sure when to initialize this - we should do it on setting main window really. ",
1479 "\tthis.loading = true;",
1480 " if (this.view.popover == null) {",
1481 " \t\t this.view.popover = new Xcls_PopoverProperty();",
1482 " \t\t this.view.popover.mainwindow = _this.main_window;",
1486 " if (this.node != null) {",
1487 " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1491 " GLib.debug(\"load leftprops\\n\");",
1493 " this.node = node;",
1494 " this.file = file;",
1497 " this.model.el.remove_all();",
1499 " //this.get('/RightEditor').el.hide();",
1500 " if (node ==null) {",
1503 " node.loadProps(this.model.el); ",
1506 " //GLib.debug(\"clear selection\\n\");",
1508 " \tthis.loading = false;",
1509 " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1510 " this.updateErrors();",
1511 " // clear selection?",
1512 " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1514 " // this.view.el.get_selection().unselect_all();",
1516 " // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1517 " // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1522 "| void removeErrors" : [
1524 "\tvar child = this.view.el.get_first_child(); ",
1526 "\tvar reading_header = true;",
1528 "\twhile (child != null) {",
1529 "\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1531 "\t if (reading_header) {",
1534 "\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1536 "\t\t\t\tchild = child.get_next_sibling();",
1537 "\t\t\t\tcontinue;",
1539 "\t\t\t// should be columnlistview",
1540 "\t\t\tchild = child.get_first_child(); ",
1544 "\t\t\treading_header = false;",
1548 "\t \tif (child.has_css_class(\"node-err\")) {",
1549 "\t\t\tchild.remove_css_class(\"node-err\");",
1551 "\t\tif (child.has_css_class(\"node-warn\")) {",
1552 "\t\t\tchild.remove_css_class(\"node-warn\");",
1555 "\t\tif (child.has_css_class(\"node-depr\")) {",
1556 "\t\t\tchild.remove_css_class(\"node-depr\");",
1559 " child = child.get_next_sibling(); ",
1561 "\t//GLib.debug(\"Rturning null\");",
1565 "| void updateErrors" : [
1567 "\tvar file = this.file;",
1568 "\tif (file == null) {",
1571 "\tvar ar = file.getErrors();",
1572 "\tif (ar == null || ar.size < 1) {",
1573 "\t\tif (this.last_error_counter != file.error_counter) {",
1574 "\t\t\tthis.removeErrors();",
1577 "\t\tthis.last_error_counter = file.error_counter ;",
1581 " \tif (this.last_error_counter == file.error_counter) {",
1584 "\tthis.removeErrors();",
1586 "\tforeach(var diag in ar) { ",
1589 "// print(\"get inter\\n\");",
1590 "\t var node= file.lineToNode( (int)diag.range.start.line) ;",
1591 "\t if (node == null || node.oid != this.node.oid) {",
1594 " \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
1596 " \tvar row = _this.selmodel.propToRow(prop);",
1597 " \tif (row < 0) {",
1600 " \tvar w = this.view.getWidgetAtRow(row);",
1601 " \tif (w == null) {",
1604 "\t \t\tvar ed = diag.category.down();",
1605 "\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
1608 "\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
1609 "\t\t\tw.remove_css_class(\"node-warn\");",
1611 "\t\tif (ed == \"err\" && w.has_css_class(\"node-depr\")) {",
1612 "\t\t\tw.remove_css_class(\"node-depr\");",
1614 "\t\tif (!w.has_css_class(\"node-\"+ ed)) {",
1615 "\t\t\tw.add_css_class(\"node-\" + ed);",
1624 "name" : "WindowLeftProps"