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,
24 "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
25 "bool hexpand" : true,
30 "int margin_start" : 5,
31 "string label" : "Add:",
35 "$ tooltip_text" : "\"Add Property\"",
37 "bool always_show_image" : true,
38 "bool hexpand" : true,
43 " _this.main_window.windowstate.showProps(",
45 " \t\tJsRender.NodePropType.PROP",
51 "string icon_name" : "format-justify-left",
52 "string label" : "Property",
56 "$ tooltip_text" : "\"Add Event Code\"",
58 "bool always_show_image" : true,
59 "bool hexpand" : true,
65 " _this.main_window.windowstate.showProps(",
66 " \t\t_this.view.el, ",
67 " \t\tJsRender.NodePropType.LISTENER",
74 "string icon_name" : "appointment-new",
75 "string label" : "Event",
80 "bool always_show_image" : true,
81 "bool hexpand" : true,
86 "bool autohide" : true,
87 "id" : "AddPropertyPopup",
92 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
97 "label" : "id: _this.{ID} (Vala)",
101 " \t_this.AddPropertyPopup.el.hide();",
102 " \t// is this userdef or special??",
103 " \tvar add = new JsRender.NodeProp.prop(\"id\");",
104 " \tif (_this.node.has_prop_key(add)) {",
108 " \t_this.node.add_prop( add );",
110 " \t_this.view.editProp( add );",
116 "tooltip_markup" : "Using _this.{ID} will map to this element",
121 "label" : "pack: Pack method (Vala)",
127 "\t_this.AddPropertyPopup.el.hide();",
128 " \t// is this userdef or special??",
129 " \tvar add = new JsRender.NodeProp.special(\"pack\", \"add\");",
130 " \tif (_this.node.has_prop_key(add)) {",
134 " \t_this.node.add_prop( add );",
136 " \t_this.view.editProp( add );",
142 "tooltip_markup" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
147 "label" : "ctor: Alterative to default contructor (Vala)",
152 " _this.AddPropertyPopup.el.hide();",
153 " \t// is this userdef or special??",
154 " \tvar add = new JsRender.NodeProp.special(\"ctor\");",
155 " \tif (_this.node.has_prop_key(add)) {",
159 " \t_this.node.add_prop( add );",
161 " \t_this.view.editProp( add );",
169 "new Clutter.Image.from_file(.....)"
175 "label" : "init: initialziation code (vala)",
180 " _this.AddPropertyPopup.el.hide();",
181 " \t// is this userdef or special??",
182 " \tvar add = new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) ;",
183 " \tif (_this.node.has_prop_key(add)) {",
187 " \t_this.node.add_prop( add );",
189 " \t_this.view.editProp( add );",
193 "tooltip_markup" : "This code is called after the ctor",
198 "label" : "cms-id: (Roo JS/Pman library)",
203 " _this.AddPropertyPopup.el.hide();",
204 " \t// is this userdef or special??",
205 " \tvar add = new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) ;",
206 " \tif (_this.node.has_prop_key(add)) {",
210 " \t_this.node.add_prop( add );",
212 " \t_this.view.editProp( add );",
218 "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})",
224 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
226 "xtype" : "Separator"
234 " _this.AddPropertyPopup.el.hide();",
235 "\t_this.view.popover.show(",
236 "\t\t_this.view.el, ",
238 "\t\t new JsRender.NodeProp.prop(\"\", \"string\", \"\") ,",
246 "tooltip_markup" : "Add a user defined string property",
255 " _this.AddPropertyPopup.el.hide();",
257 " _this.view.popover.show(",
258 "\t\t_this.view.el, ",
260 "\t\t new JsRender.NodeProp.prop(\"\", \"int\", \"0\") ,",
268 "tooltip_markup" : "Add a user defined number property",
278 " \t _this.AddPropertyPopup.el.hide();",
279 " _this.view.popover.show(",
280 "\t\t_this.view.el, ",
282 "\t\t new JsRender.NodeProp.prop(\"\", \"bool\", \"true\") ,",
290 "tooltip_markup" : "Add a user defined boolean property",
294 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
296 "xtype" : "Separator"
300 "label" : "Javascript Function",
304 " _this.AddPropertyPopup.el.hide(); ",
305 " _this.view.popover.show(",
306 "\t\t_this.view.el, ",
308 "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
317 "tooltip_markup" : "Add a user function boolean property",
322 "label" : "Vala Method",
326 "_this.AddPropertyPopup.el.hide();",
327 " _this.view.popover.show(",
328 "\t\t_this.view.el, ",
330 "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
337 "tooltip_markup" : "Add a user function boolean property",
342 "label" : "Vala Signal",
346 " _this.AddPropertyPopup.el.hide();",
347 " _this.view.popover.show(",
348 "\t\t_this.view.el, ",
350 "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
357 "tooltip_markup" : "Add a vala signal",
361 "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
363 "xtype" : "Separator"
367 "label" : "Flexy - If",
371 " \t_this.AddPropertyPopup.el.hide();",
372 " \t_this.view.popover.show(",
373 "\t\t_this.view.el, ",
375 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
384 "tooltip_markup" : "Add a flexy if (for HTML templates)",
389 "label" : "Flexy - Include",
393 " \t_this.AddPropertyPopup.el.hide();",
394 " \t_this.view.popover.show(",
395 "\t\t_this.view.el, ",
397 "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
406 "tooltip_markup" : "Add a flexy include (for HTML templates)",
411 "label" : "Flexy - Foreach",
415 " \t_this.AddPropertyPopup.el.hide();",
416 " \t_this.view.popover.show(",
417 "\t\t_this.view.el, ",
419 "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
427 "tooltip_markup" : "Add a flexy include (for HTML templates)",
440 " //_this.before_edit();",
443 " var p = _this.AddPropertyPopup;",
445 " //\tGtk.Allocation rect;",
446 "\t//this.el.get_allocation(out rect);",
448 "\t p.el.set_parent(this.el);",
449 " //p.el.set_pointing_to(rect);",
451 "\tp.el.set_position(Gtk.PositionType.BOTTOM);",
452 "\tp.el.autohide = true;",
459 "string icon_name" : "list-add",
460 "string label" : "Other",
467 "# bool editing" : false,
468 "$ shadow_type" : "Gtk.ShadowType.IN",
473 " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
477 "bool hexpand" : true,
478 "bool vexpand" : true,
482 "$ enable_tree_lines" : true,
483 "$ headers_visible" : true,
488 " \tthis.css = new Gtk.CssProvider();",
490 "\t\tthis.css.load_from_string(\"",
491 "#leftprops-view { font-size: 12px;}",
493 "#leftprops-view dropdown button { ",
494 "\t\t\tmin-height: 16px;\t\t\t ",
495 "\t\t\toutline-offset : 0;",
497 "#leftprops-view cell dropdown label {",
498 " \t\tpadding-top:0px;",
499 "\t\tpadding-bottom:0px;",
501 "#leftprops-view cell { ",
502 " \t\tpadding-top:2px;",
503 "\t\tpadding-bottom:2px;",
505 "#leftprops-view cell label, #leftprops-view cell editablelable {",
506 " \t\tpadding-top:4px;",
507 "\t\tpadding-bottom:4px;",
510 "\t\tGtk.StyleContext.add_provider_for_display(",
511 "\t\tthis.el.get_display(),",
513 "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
520 "* pack" : "set_child",
521 "Gtk.CssProvider css" : "",
522 "Xcls_PopoverProperty popover" : "null",
523 "bool hexpand" : true,
524 "bool show_row_separators" : true,
525 "bool single_click_activate" : false,
526 "bool vexpand" : true,
537 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
547 "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
549 "\t_this.deletemenu.el.hide();",
550 "\t_this.node.remove_prop(n);",
555 "string label" : "Delete",
568 "(n_press, in_x, in_y) => {",
570 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
572 "\tvar col = _this.view.getColAt(in_x, in_y);",
577 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
583 "\tGLib.debug(\"hit row %d\", row);",
584 "\tvar prop = _this.selmodel.getPropAt(row);",
585 "\t_this.selmodel.selectProp(prop);",
587 "\t//var point_at = _this.view.getWidgetAtRow(row);",
589 "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
590 " \t// or popover might be trying to do a central?",
591 "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
592 " \t _this.stop_editor();",
593 " _this.view.popover.show(",
594 " \t\t\t_this.view.el, ",
595 " \t\t\t_this.node, prop, ",
604 "xtype" : "GestureClick"
610 "(n_press, in_x, in_y) => {",
615 "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
622 "\t_this.stop_editor();",
623 "\tGLib.debug(\"hit row %d\", row);",
624 "\tvar prop = _this.selmodel.getPropAt(row);",
625 "\t_this.selmodel.selectProp(prop);",
629 "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
630 "\t//_this.deletemenu.el.set_parent(_this.view.el);",
631 "\t_this.deletemenu.el.set_parent(_this.main_window.el);",
635 "\t_this.deletemenu.el.set_offset(",
636 "\t\t\t(int)in_x - _this.view.el.get_width() ,",
637 "\t\t\t(int)in_y - _this.view.el.get_height()",
639 "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
640 " _this.deletemenu.el.popup();",
647 "xtype" : "GestureClick"
652 "bool can_unselect" : true,
657 "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
660 "xtype" : "ListStore"
663 "xtype" : "SingleSelection",
664 "| JsRender.NodeProp getPropAt" : [
667 "\treturn (JsRender.NodeProp) this.el.get_item(row);",
672 "| void selectProp" : [
673 "(JsRender.NodeProp prop) {",
674 "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
675 "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
676 "\t\tif (r.equals(prop)) {",
677 "\t\t\tthis.el.selected = i;",
684 "| void startEditing" : [
685 "(JsRender.NodeProp prop) {",
686 "\t// should we call select?? - caller does int (from windowstate)",
693 "* pack" : "append_column",
694 "bool expand" : true,
695 "bool resizable" : true,
700 "* prop" : "factory",
704 " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
705 " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
708 "item.bind_property(\"to_display_name_prop\",",
710 " GLib.BindingFlags.SYNC_CREATE);",
711 "item.bind_property(\"to_tooltip_name_prop\",",
712 " lb, \"tooltip_markup\",",
713 " GLib.BindingFlags.SYNC_CREATE);",
714 "// was item (1) in old layout",
722 "\tvar lbl = new Gtk.Label(\"\");",
723 " \t((Gtk.ListItem)listitem).set_child(lbl);",
724 " \tlbl.justify = Gtk.Justification.LEFT;",
725 " \tlbl.xalign = 1;",
726 " \tlbl.use_markup = true;",
727 "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
728 " \t/*lbl.changed.connect(() => {",
729 "\t\t// notify and save the changed value...",
730 "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
732 " //prop.val = lbl.text;",
733 " //_this.updateIter(iter,prop);",
737 "\t((Gtk.ListItem)listitem).activatable = true;",
742 "xtype" : "SignalListItemFactory"
745 "title" : "Property",
746 "xtype" : "ColumnViewColumn"
750 "* pack" : "append_column",
751 "bool expand" : true,
752 "bool resizable" : true,
757 "* prop" : "factory",
758 "bool is_setting" : false,
762 "\t this.is_setting = true;",
765 "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
770 "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
771 "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
772 "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
773 "\t// decide if it's a combo or editable text..",
774 "\tvar model = (Gtk.StringList) cb.model;",
780 "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
781 "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
782 "\t//GLib.debug(\"prop.val = %s\", prop.val);",
783 "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
785 " var use_textarea = prop.useTextArea();",
788 " var pal = _this.file.project.palete;",
791 " var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);",
793 " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
794 " \tuse_textarea = true;",
798 " if (use_textarea) {",
799 " \tprop.bind_property(\"val_short\",",
801 " GLib.BindingFlags.SYNC_CREATE);",
802 " prop.bind_property(\"val_tooltip\",",
803 " lbl, \"tooltip_markup\",",
804 " GLib.BindingFlags.SYNC_CREATE);",
806 "\t\tthis.is_setting = false; ",
815 " // others... - fill in options for true/false?",
816 " // GLib.debug (ktype.up());",
819 "\t\twhile(model.get_n_items() > 0) {",
820 "\t\t\tmodel.remove(0);",
823 " \t\t// can not remove - hopefully always empty.",
825 "\t\tfor(var i = 0; i < opts.length; i ++) {",
826 "\t\t\tmodel.append( opts[i]);",
827 "\t\t\t// not sure this is a great idea... ",
828 "\t\t\tif (opts[i].down() == prop.val.down()) {",
832 "\t\tGLib.debug(\"Set selected item to %d\", sel);",
833 "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
834 "\t\tthis.is_setting = false; ",
838 "\t// see if type is a Enum.",
839 "\t// triggers a changed event",
841 "\telbl.set_text(prop.val);",
844 "\tthis.is_setting = false; \t\t ",
855 "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
856 "\tvar elbl = new Gtk.EditableLabel(\"\");",
857 "\telbl.hexpand = true;",
858 "\thb.append(elbl);",
859 "\tvar lbl = new Gtk.Label(\"\");",
861 "\tlbl.hexpand = true;",
862 "\tlbl.use_markup = true;",
864 "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
865 "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
866 "\tcb.hexpand = true;",
869 "\t((Gtk.ListItem)listitem).set_child(hb);",
871 "\t var ef = new Gtk.EventControllerFocus();",
872 "\t ef.enter.connect(() => {",
873 " \t\t _this.stop_editor();",
874 " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
875 "\t\t _this.selmodel.selectProp(prop);\t\t",
877 "\t elbl.add_controller(ef);",
880 "\t // dropdown??? - stop editing, and highliht node",
881 "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
882 "\t tb.clicked.connect(() => {",
883 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
885 "\t \t _this.stop_editor();",
886 "\t \t _this.selmodel.selectProp(prop);",
889 " \telbl.changed.connect(() => {",
890 "\t\t// notify and save the changed value...",
892 " //_this.updateIter(iter,prop);",
893 " // this should happen automatically",
895 " if (!_this.loading && !this.is_setting) {",
896 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
899 "\t\t prop.val = elbl.text;",
900 " \t GLib.debug(\"calling changed\");",
901 "\t _this.changed();",
908 "\tcb.notify[\"selected\"].connect(() => {",
909 "\t\t// dropdown selection changed.",
913 " //_this.updateIter(iter,prop);",
914 " if (!_this.loading && !this.is_setting) {",
915 "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
916 "\t\t var model = (Gtk.StringList)cb.model;",
917 "\t\t prop.val = model.get_string(cb.selected);",
918 "\t\t GLib.debug(\"property set to %s\", prop.val);",
919 " \tGLib.debug(\"calling changed\");",
920 "\t _this.changed();",
926 "\tvar gc = new Gtk.GestureClick();",
927 "\tlbl.add_controller(gc);",
928 "\tgc.pressed.connect(() => {",
929 "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
930 "\t\t _this.stop_editor();",
931 "\t _this.show_editor(_this.file, prop.parent, prop);",
940 "xtype" : "SignalListItemFactory"
944 "xtype" : "ColumnViewColumn"
949 "id" : "ContextMenu",
954 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
963 "\t_this.deleteSelected();",
977 "string name" : "leftprops-view",
978 "xtype" : "ColumnView",
979 "| Gtk.Widget? getWidgetAtRow" : [
983 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
984 " \tvar colview = gesture.widget;",
985 " \tvar line_no = check_list_widget(colview, x,y);",
986 " if (line_no > -1) {",
987 " \t\tvar item = colview.model.get_item(line_no);",
991 "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
992 " var child = this.el.get_first_child(); ",
993 " \tvar line_no = -1; ",
994 " \tvar reading_header = true;",
996 " \twhile (child != null) {",
997 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
998 " \t if (reading_header) {",
1001 "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1002 "\t\t\t\t\tchild = child.get_next_sibling();",
1003 "\t\t\t\t\tcontinue;",
1005 "\t\t\t\tchild = child.get_first_child(); ",
1006 "\t\t\t\treading_header = false;",
1008 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1009 " \t\t child = child.get_next_sibling();",
1013 "\t\t\tif (line_no == row) {",
1014 "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
1015 "\t\t\t return (Gtk.Widget)child;",
1017 "\t child = child.get_next_sibling(); ",
1019 "\t\tGLib.debug(\"Rturning null\");",
1024 "| int getColAt" : [
1025 "(double x, double y) {",
1028 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1031 "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1032 " var child = this.el.get_first_child(); ",
1036 " \twhile (child != null) {",
1037 "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1039 "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1040 "\t\t\t\tchild = child.get_first_child();",
1041 "\t\t\t\tcontinue;",
1044 "\t\t\t//child.get_allocation(out alloc);",
1045 "\t\t\tif (x < (child.get_width() + offx)) {",
1046 "\t\t\t\treturn col;",
1048 "\t\t\toffx += child.get_width();",
1050 "\t\t\tchild = child.get_next_sibling();",
1058 "| int getRowAt" : [
1059 "(double x, double in_y, out string pos) {",
1066 "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1067 " \tvar colview = gesture.widget;",
1068 " \tvar line_no = check_list_widget(colview, x,y);",
1069 " if (line_no > -1) {",
1070 " \t\tvar item = colview.model.get_item(line_no);",
1076 " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
1077 " \tvar y = in_y + _this.EditProps.el.vadjustment.value; ",
1078 " var child = this.el.get_first_child(); ",
1079 " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1080 " \tvar line_no = -1; ",
1081 " \tvar reading_header = true;",
1082 " \tvar real_y = 0;",
1083 " \tvar header_height = 0;",
1084 " \tpos = \"none\";",
1086 " \twhile (child != null) {",
1087 "\t\t\t//GLib.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 h += child.get_height();",
1093 "\t\t\t\t\tchild = child.get_next_sibling();",
1094 "\t\t\t\t\tcontinue;",
1096 "\t\t\t\t// should be columnlistview",
1097 "\t\t\t\tchild = child.get_first_child(); ",
1098 "\t\t\t GLib.debug(\"header height=%d\", h);",
1099 "\t\t\t\theader_height = h;",
1101 "\t\t\t\treading_header = false;",
1105 "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1106 " \t\t child = child.get_next_sibling();",
1110 "\t\t \tif (y < header_height) {",
1111 "\t\t \treturn -1;",
1115 "\t\t\tvar hh = child.get_height();",
1116 "\t\t\t//child.get_allocation(out alloc);",
1117 "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
1118 "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
1120 "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
1122 "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
1123 "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
1124 "\t\t \t\tpos = \"below\";",
1125 "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
1126 "\t \t\t\tpos = \"over\";",
1128 " \t\t\t\tpos = \"above\";",
1130 "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
1131 "\t\t\t return line_no;",
1135 "\t\t if (real_y + hh > y) {",
1139 "\t child = child.get_next_sibling(); ",
1145 "| void editProp" : [
1146 "(JsRender.NodeProp prop) ",
1148 "\tvar sm = _this.selmodel.el;",
1151 "\t\tGLib.debug(\"finding node\");",
1152 "\t\t_this.selmodel.selectProp(prop);",
1154 "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1155 "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1156 "\t\t\tif (r.equals(prop)) {",
1161 "\t\tif (sr < 0) {",
1162 "\t\t\tGLib.debug(\"finding node - cant find it\");",
1166 "\t\tvar r = this.getWidgetAtRow(sr);",
1167 "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1168 "\t\tvar ca = r.get_first_child();",
1169 "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1170 "\t\tvar cb = ca.get_next_sibling();",
1171 "\t\tvar b = cb.get_first_child();",
1172 "\t\tvar e = (Gtk.Entry) b.get_first_child();",
1173 "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1174 "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1176 "\t\tGLib.debug(\"row key = %s\", ll.label);",
1177 "\t\tif (e.get_visible()) {",
1178 "\t\t\t_this.stop_editor();",
1179 "\t\t\te.grab_focus_without_selecting();",
1182 "\t\tif (d.get_visible()) {",
1183 "\t\t\t_this.stop_editor();",
1184 "\t\t\td.activate();",
1187 "\t\tif (l.get_visible()) {",
1188 "\t\t \t_this.stop_editor();",
1189 "\t \t_this.show_editor(_this.file, prop.parent, prop);",
1195 "\t\t//gtkcolumnviewrowwidget",
1196 "\t\t // cell widet",
1197 "\t\t // cell widget",
1199 "\t\t \t\t// entry / label / dropdown",
1206 "xtype" : "ScrolledWindow"
1210 "| string keyFormat" : [
1211 "(string val, string type) {",
1213 " // Glib.markup_escape_text(val);",
1215 " if (type == \"listener\") {",
1216 " return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1217 " GLib.Markup.escape_text(val) +",
1221 " if (val.length < 1) {",
1222 " return \"<span color=\\\"#FF0000\\\">--empty--</span>\";",
1226 " //$ = property with ",
1227 " //# - object properties",
1229 " // all of these... - display value is last element..",
1230 " var ar = val.strip().split(\" \");",
1233 " var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1238 " switch(val[0]) {",
1239 " case '@': // signal // just bold balck?",
1240 " if (dval[0] == '@') {",
1241 " dval = dval.substring(1);",
1244 " return @\"<span font_weight=\\\"bold\\\">@ $dval</span>\"; ",
1245 " case '#': // object properties?",
1246 " if (dval[0] == '#') {",
1247 " dval = dval.substring(1);",
1249 " return @\"<span font_weight=\\\"bold\\\">$dval</span>\";",
1250 " case '*': // special",
1251 " if (dval[0] == '*') {",
1252 " dval = dval.substring(1);",
1254 " return @\"<span color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\"; ",
1256 " if (dval[0] == '$') {",
1257 " dval = dval.substring(1);",
1259 " return @\"<span style=\\\"italic\\\">$dval</span>\";",
1260 " case '|': // user defined methods",
1261 " if (dval[0] == '|') {",
1262 " dval = dval.substring(1);",
1264 " return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1276 "| string keySortFormat" : [
1278 " // listeners first - with 0",
1280 " if (key[0] == '*') {",
1281 " return \"1 \" + key;",
1285 " var bits = key.split(\" \");",
1287 " if (key[0] == '|') {",
1288 " return \"2 \" + bits[bits.length -1];",
1291 " if (key[0] == '@') {",
1292 " return \"3 \" + bits[bits.length -1];",
1296 " if (key[0] == '#') {",
1297 " return \"4 \" + bits[bits.length -1];",
1300 " return \"5 \" + bits[bits.length -1]; ",
1306 "| void a_addProp" : [
1307 " (JsRender.NodeProp prop) {",
1308 " // info includes key, val, skel, etype..",
1309 " //console.dump(info);",
1310 " //type = info.type.toLowerCase();",
1311 " //var data = this.toJS();",
1314 " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
1315 " if (this.node.listeners.has_key(prop.name)) {",
1318 " this.node.listeners.set(prop.name,prop);",
1320 " assert(this.node != null);",
1321 " assert(this.node.props != null);",
1322 " if (this.node.props.has_key(prop.to_index_key())) {",
1325 " this.node.props.set(prop.to_index_key(),prop);",
1330 " this.load(this.file, this.node);",
1335 " GLib.debug(\"trying to find new iter\");",
1342 "| void deleteSelected" : [
1348 " Gtk.TreeIter iter;",
1349 " Gtk.TreeModel mod;",
1351 " var s = this.view.el.get_selection();",
1352 " s.get_selected(out mod, out iter);",
1355 " GLib.Value gval;",
1356 " mod.get_value(iter, 0 , out gval);",
1357 " var prop = (JsRender.NodeProp)gval;",
1358 " if (prop == null) {",
1359 "\t this.load(this.file, this.node); ",
1362 " \t// stop editor after fetching property - otherwise prop is null.",
1363 " this.stop_editor();",
1366 " switch(prop.ptype) {",
1367 " case JsRender.NodePropType.LISTENER:",
1368 " this.node.listeners.unset(prop.to_index_key());",
1372 " this.node.props.unset(prop.to_index_key());",
1375 " this.load(this.file, this.node);",
1377 " _this.changed();",
1382 "(JsRender.JsRender file, JsRender.Node? node) ",
1384 "\t// not sure when to initialize this - we should do it on setting main window really. ",
1386 "\tthis.loading = true;",
1387 " if (this.view.popover == null) {",
1388 " \t\t this.view.popover = new Xcls_PopoverProperty();",
1389 " \t\t this.view.popover.mainwindow = _this.main_window;",
1393 " if (this.node != null) {",
1394 " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1398 " GLib.debug(\"load leftprops\\n\");",
1400 " this.node = node;",
1401 " this.file = file;",
1404 " this.model.el.remove_all();",
1406 " //this.get('/RightEditor').el.hide();",
1407 " if (node ==null) {",
1410 " node.loadProps(this.model.el); ",
1413 " //GLib.debug(\"clear selection\\n\");",
1415 " \tthis.loading = false;",
1416 " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1417 " // clear selection?",
1418 " //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1420 " // this.view.el.get_selection().unselect_all();",
1422 " // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1423 " // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1430 "name" : "WindowLeftProps"