Fix #8062 - fix new file node selection issue
[roobuilder] / src / Builder4 / WindowLeftProps.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# Gee.ArrayList<Gtk.Widget>? error_widgets" : "null",
7    "# JsRender.JsRender file" : "",
8    "# JsRender.Node node" : "",
9    "# Xcls_MainWindow main_window" : "null",
10    "# bool allow_edit" : false,
11    "$ homogeneous" : "false   ",
12    "$ xns" : "Gtk",
13    "@ bool stop_editor" : "()",
14    "@ void changed" : "()",
15    "@ void show_add_props" : "(string type)",
16    "@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop)",
17    "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
18    "bool hexpand" : true,
19    "bool loading" : false,
20    "bool vexpand" : true,
21    "id" : "LeftProps",
22    "int last_error_counter" : "-1",
23    "items" : [
24     {
25      "$ xns" : "Gtk",
26      "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
27      "bool hexpand" : true,
28      "items" : [
29       {
30        "$ xns" : "Gtk",
31        "int margin_end" : 5,
32        "int margin_start" : 5,
33        "string label" : "Add:",
34        "xtype" : "Label"
35       },
36       {
37        "$ tooltip_text" : "\"Add Property\"",
38        "$ xns" : "Gtk",
39        "bool always_show_image" : true,
40        "bool hexpand" : true,
41        "listeners" : {
42         "clicked" : [
43          "  ( ) => {",
44          "    ",
45          "     _this.main_window.windowstate.showProps(",
46          "     \t_this.view.el, ",
47          " \t\tJsRender.NodePropType.PROP",
48          "\t);",
49          "  ",
50          "}"
51         ]
52        },
53        "string icon_name" : "format-justify-left",
54        "string label" : "Property",
55        "xtype" : "Button"
56       },
57       {
58        "$ tooltip_text" : "\"Add Event Code\"",
59        "$ xns" : "Gtk",
60        "bool always_show_image" : true,
61        "bool hexpand" : true,
62        "listeners" : {
63         "clicked" : [
64          "  ( ) => {",
65          "    ",
66          " ",
67          "   _this.main_window.windowstate.showProps(",
68          "   \t\t_this.view.el, ",
69          "   \t\tJsRender.NodePropType.LISTENER",
70          "\t);",
71          "",
72          " ",
73          "}"
74         ]
75        },
76        "string icon_name" : "appointment-new",
77        "string label" : "Event",
78        "xtype" : "Button"
79       },
80       {
81        "$ xns" : "Gtk",
82        "items" : [
83         {
84          "$ xns" : "Gtk",
85          "* prop" : "popover",
86          "id" : "addpop",
87          "items" : [
88           {
89            "$ xns" : "Gtk",
90            "* prop" : "child",
91            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
92            "int spacing" : 0,
93            "items" : [
94             {
95              "$ xns" : "Gtk",
96              "bool has_frame" : false,
97              "items" : [
98               {
99                "$ xns" : "Gtk",
100                "* prop" : "child",
101                "Gtk.Align halign" : "Gtk.Align.START",
102                "string label" : "id: _this.{ID} (Vala)",
103                "string tooltip_text" : "Using _this.{ID} will map to this element",
104                "xtype" : "Label"
105               }
106              ],
107              "listeners" : {
108               "clicked" : [
109                " ()  => {",
110                " \t_this.addpop.el.hide();",
111                " \t// is this userdef or special??",
112                " \tvar add = new JsRender.NodeProp.prop(\"id\");",
113                " \tif (_this.node.has_prop_key(add)) {",
114                "\t \treturn;",
115                " \t}",
116                " \t",
117                " \t_this.node.add_prop( add );",
118                " \t",
119                " \t_this.view.editProp( add );",
120                " \t",
121                "}"
122               ]
123              },
124              "xtype" : "Button"
125             },
126             {
127              "$ xns" : "Gtk",
128              "bool has_frame" : false,
129              "items" : [
130               {
131                "$ xns" : "Gtk",
132                "* prop" : "child",
133                "Gtk.Align halign" : "Gtk.Align.START",
134                "string label" : "pack: Pack method (Vala)",
135                "string tooltip_text" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
136                "xtype" : "Label"
137               }
138              ],
139              "listeners" : {
140               "clicked" : [
141                "  ( ) => {",
142                " ",
143                "",
144                "  \t_this.addpop.el.hide();",
145                " \t// is this userdef or special??",
146                " \tvar add = new JsRender.NodeProp.special(\"pack\", \"add\");",
147                " \tif (_this.node.has_prop_key(add)) {",
148                "\t \treturn;",
149                " \t}",
150                " \t",
151                " \t_this.node.add_prop( add );",
152                " \t",
153                " \t_this.view.editProp( add );",
154                " \t",
155                "",
156                "}"
157               ]
158              },
159              "xtype" : "Button"
160             },
161             {
162              "$ xns" : "Gtk",
163              "bool has_frame" : false,
164              "items" : [
165               {
166                "$ xns" : "Gtk",
167                "* prop" : "child",
168                "Gtk.Align halign" : "Gtk.Align.START",
169                "string label" : "ctor: Alterative to default contructor (Vala)",
170                "string tooltip_text" : [
171                 "eg. ",
172                 "",
173                 "new Clutter.Image.from_file(.....)"
174                ],
175                "xtype" : "Label"
176               }
177              ],
178              "listeners" : {
179               "clicked" : [
180                "  ( ) => {",
181                "   ",
182                "  \t_this.addpop.el.hide();",
183                " \t// is this userdef or special??",
184                " \tvar add = new JsRender.NodeProp.special(\"ctor\");",
185                " \tif (_this.node.has_prop_key(add)) {",
186                "\t \treturn;",
187                " \t}",
188                " \t",
189                " \t_this.node.add_prop( add );",
190                " \t",
191                " \t_this.view.editProp( add );",
192                " \t",
193                "}"
194               ]
195              },
196              "xtype" : "Button"
197             },
198             {
199              "$ xns" : "Gtk",
200              "bool has_frame" : false,
201              "items" : [
202               {
203                "$ xns" : "Gtk",
204                "* prop" : "child",
205                "Gtk.Align halign" : "Gtk.Align.START",
206                "string label" : "init: initialziation code (vala)",
207                "string tooltip_text" : "This code is called after the ctor",
208                "xtype" : "Label"
209               }
210              ],
211              "listeners" : {
212               "clicked" : [
213                "  ( ) => {",
214                "    ",
215                "  \t_this.addpop.el.hide();",
216                " \t// is this userdef or special??",
217                " \tvar add =  new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) ;",
218                " \tif (_this.node.has_prop_key(add)) {",
219                "\t \treturn;",
220                " \t}",
221                " \t",
222                " \t_this.node.add_prop( add );",
223                " \t",
224                " \t_this.view.editProp( add );",
225                "}"
226               ]
227              },
228              "xtype" : "Button"
229             },
230             {
231              "$ xns" : "Gtk",
232              "bool has_frame" : false,
233              "items" : [
234               {
235                "$ xns" : "Gtk",
236                "* prop" : "child",
237                "Gtk.Align halign" : "Gtk.Align.START",
238                "string label" : "cms-id: (Roo JS/Pman library)",
239                "string tooltip_text" : [
240                 "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})",
241                 ""
242                ],
243                "xtype" : "Label"
244               }
245              ],
246              "listeners" : {
247               "clicked" : [
248                " ()  => {",
249                "    \t_this.addpop.el.hide();",
250                " ",
251                " \t// is this userdef or special??",
252                " \tvar add =   new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) ;",
253                " \tif (_this.node.has_prop_key(add)) {",
254                "\t \treturn;",
255                " \t}",
256                " \t",
257                " \t_this.node.add_prop( add );",
258                " \t",
259                " \t_this.view.editProp( add );",
260                "    ",
261                "}"
262               ]
263              },
264              "xtype" : "Button"
265             },
266             {
267              "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
268              "$ xns" : "Gtk",
269              "xtype" : "Separator"
270             },
271             {
272              "$ xns" : "Gtk",
273              "bool has_frame" : false,
274              "items" : [
275               {
276                "$ xns" : "Gtk",
277                "* prop" : "child",
278                "Gtk.Align halign" : "Gtk.Align.START",
279                "string label" : "String",
280                "string tooltip_text" : "Add a user defined string property",
281                "xtype" : "Label"
282               }
283              ],
284              "listeners" : {
285               "clicked" : [
286                "(self) => {",
287                "  \t_this.addpop.el.hide();",
288                "\t_this.view.popover.show(",
289                "\t\t_this.view.el, ",
290                "\t\t_this.node, ",
291                "\t\t new JsRender.NodeProp.user(\"\", \"string\", \"\") ,",
292                "\t\t-1,  ",
293                "\t\ttrue",
294                "\t);",
295                " ",
296                "}"
297               ]
298              },
299              "xtype" : "Button"
300             },
301             {
302              "$ xns" : "Gtk",
303              "bool has_frame" : false,
304              "items" : [
305               {
306                "$ xns" : "Gtk",
307                "* prop" : "child",
308                "Gtk.Align halign" : "Gtk.Align.START",
309                "string label" : "Number",
310                "string tooltip_text" : "Add a user defined number property",
311                "xtype" : "Label"
312               }
313              ],
314              "listeners" : {
315               "clicked" : [
316                "  ( ) =>{",
317                " ",
318                "       \t_this.addpop.el.hide();",
319                "       _this.view.popover.show(",
320                "\t\t_this.view.el, ",
321                "\t\t_this.node, ",
322                "\t\t new JsRender.NodeProp.user(\"\", \"int\", \"0\") ,",
323                "\t\t-1,  ",
324                "\t\ttrue",
325                "\t);",
326                " ",
327                "}"
328               ]
329              },
330              "xtype" : "Button"
331             },
332             {
333              "$ xns" : "Gtk",
334              "bool has_frame" : false,
335              "items" : [
336               {
337                "$ xns" : "Gtk",
338                "* prop" : "child",
339                "Gtk.Align halign" : "Gtk.Align.START",
340                "string label" : "Boolean",
341                "string tooltip_text" : "Add a user defined boolean property",
342                "xtype" : "Label"
343               }
344              ],
345              "listeners" : {
346               "clicked" : [
347                "  ( ) =>{",
348                "  ",
349                "  \t_this.addpop.el.hide();",
350                "   _this.view.popover.show(",
351                "\t\t_this.view.el, ",
352                "\t\t_this.node, ",
353                "\t\t new JsRender.NodeProp.user(\"\", \"bool\", \"true\") ,",
354                "\t\t-1,  ",
355                "\t\ttrue",
356                "\t); ",
357                " ",
358                "}"
359               ]
360              },
361              "xtype" : "Button"
362             },
363             {
364              "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
365              "$ xns" : "Gtk",
366              "xtype" : "Separator"
367             },
368             {
369              "$ xns" : "Gtk",
370              "bool has_frame" : false,
371              "items" : [
372               {
373                "$ xns" : "Gtk",
374                "* prop" : "child",
375                "Gtk.Align halign" : "Gtk.Align.START",
376                "string label" : "Javascript Function",
377                "string tooltip_text" : "Add a javascript  function",
378                "xtype" : "Label"
379               }
380              ],
381              "listeners" : {
382               "clicked" : [
383                "  ( ) =>{",
384                "  \t_this.addpop.el.hide();",
385                "   _this.view.popover.show(",
386                "\t\t_this.view.el, ",
387                "\t\t_this.node, ",
388                "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
389                "\t\t-1,  ",
390                "\t\ttrue",
391                "\t);",
392                "",
393                " ",
394                "}"
395               ]
396              },
397              "xtype" : "Button"
398             },
399             {
400              "$ xns" : "Gtk",
401              "bool has_frame" : false,
402              "items" : [
403               {
404                "$ xns" : "Gtk",
405                "* prop" : "child",
406                "Gtk.Align halign" : "Gtk.Align.START",
407                "string label" : "Vala Method",
408                "string tooltip_text" : "Add a user defined method to a object",
409                "xtype" : "Label"
410               }
411              ],
412              "listeners" : {
413               "clicked" : [
414                "  ( ) =>{",
415                "  \t_this.addpop.el.hide();",
416                "    _this.view.popover.show(",
417                "\t\t_this.view.el, ",
418                "\t\t_this.node, ",
419                "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
420                "\t\t-1,  ",
421                "\t\ttrue",
422                "\t); ",
423                "}"
424               ]
425              },
426              "xtype" : "Button"
427             },
428             {
429              "$ xns" : "Gtk",
430              "bool has_frame" : false,
431              "items" : [
432               {
433                "$ xns" : "Gtk",
434                "* prop" : "child",
435                "Gtk.Align halign" : "Gtk.Align.START",
436                "string label" : "Vala Signal",
437                "string tooltip_text" : "Add a user defined signal to a object",
438                "xtype" : "Label"
439               }
440              ],
441              "listeners" : {
442               "clicked" : [
443                "  ( ) =>{",
444                " \t_this.addpop.el.hide(); ",
445                "  _this.view.popover.show(",
446                "\t\t_this.view.el, ",
447                "\t\t_this.node, ",
448                "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
449                "\t\t-1,  ",
450                "\t\ttrue",
451                "\t);    ",
452                "}"
453               ]
454              },
455              "xtype" : "Button"
456             },
457             {
458              "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
459              "$ xns" : "Gtk",
460              "xtype" : "Separator"
461             },
462             {
463              "$ xns" : "Gtk",
464              "bool has_frame" : false,
465              "items" : [
466               {
467                "$ xns" : "Gtk",
468                "* prop" : "child",
469                "Gtk.Align halign" : "Gtk.Align.START",
470                "string label" : "Flexy - If",
471                "string tooltip_text" : "Add a flexy if (for HTML templates)",
472                "xtype" : "Label"
473               }
474              ],
475              "listeners" : {
476               "clicked" : [
477                "  ( ) =>{",
478                "  \t_this.addpop.el.hide();",
479                " \t_this.view.popover.show(",
480                "\t\t_this.view.el, ",
481                "\t\t_this.node, ",
482                "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
483                "\t\t-1,  ",
484                "\t\ttrue",
485                "\t);",
486                "",
487                "",
488                "}"
489               ]
490              },
491              "xtype" : "Button"
492             },
493             {
494              "$ xns" : "Gtk",
495              "bool has_frame" : false,
496              "items" : [
497               {
498                "$ xns" : "Gtk",
499                "* prop" : "child",
500                "Gtk.Align halign" : "Gtk.Align.START",
501                "string label" : "Flexy - Include",
502                "string tooltip_text" : "Add a flexy include (for HTML templates)",
503                "xtype" : "Label"
504               }
505              ],
506              "listeners" : {
507               "clicked" : [
508                "  ( ) =>{",
509                "  \t_this.addpop.el.hide();",
510                " \t_this.view.popover.show(",
511                "\t\t_this.view.el, ",
512                "\t\t_this.node, ",
513                "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
514                "\t\t-1,  ",
515                "\t\ttrue",
516                "\t);",
517                "",
518                "  ",
519                "}"
520               ]
521              },
522              "xtype" : "Button"
523             },
524             {
525              "$ xns" : "Gtk",
526              "bool has_frame" : false,
527              "items" : [
528               {
529                "$ xns" : "Gtk",
530                "* prop" : "child",
531                "Gtk.Align halign" : "Gtk.Align.START",
532                "string label" : "Flexy - Foreach",
533                "string tooltip_text" : "Add a flexy foreach (for HTML templates)",
534                "xtype" : "Label"
535               }
536              ],
537              "listeners" : {
538               "clicked" : [
539                "  ( ) =>{",
540                "  \t_this.addpop.el.hide();",
541                " \t_this.view.popover.show(",
542                "\t\t_this.view.el, ",
543                "\t\t_this.node, ",
544                "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
545                "\t\t-1,  ",
546                "\t\ttrue",
547                "\t);",
548                "  ",
549                "}"
550               ]
551              },
552              "tooltip_markup" : "Add a flexy include (for HTML templates)",
553              "xtype" : "Button"
554             }
555            ],
556            "xtype" : "Box"
557           }
558          ],
559          "xtype" : "Popover"
560         }
561        ],
562        "string label" : "Other",
563        "xtype" : "MenuButton"
564       }
565      ],
566      "xtype" : "Box"
567     },
568     {
569      "# bool editing" : false,
570      "$ shadow_type" : "Gtk.ShadowType.IN",
571      "$ xns" : "Gtk",
572      "* init" : [
573       "  {",
574       "  ",
575       "   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
576       "}",
577       ""
578      ],
579      "bool hexpand" : true,
580      "bool vexpand" : true,
581      "id" : "EditProps",
582      "items" : [
583       {
584        "# Xcls_PopoverProperty popover" : "null",
585        "$ enable_tree_lines" : true,
586        "$ headers_visible" : true,
587        "$ xns" : "Gtk",
588        "* pack" : "set_child",
589        "bool hexpand" : true,
590        "bool show_row_separators" : true,
591        "bool single_click_activate" : false,
592        "bool vexpand" : true,
593        "id" : "view",
594        "items" : [
595         {
596          "$ xns" : "Gtk",
597          "* pack" : false,
598          "id" : "deletemenu",
599          "items" : [
600           {
601            "$ xns" : "Gtk",
602            "* prop" : "child",
603            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
604            "int spacing" : 0,
605            "items" : [
606             {
607              "$ xns" : "Gtk",
608              "bool has_frame" : false,
609              "items" : [
610               {
611                "$ xns" : "Gtk",
612                "* prop" : "child",
613                "Gtk.Align halign" : "Gtk.Align.START",
614                "string label" : "Delete Property / Method",
615                "xtype" : "Label"
616               }
617              ],
618              "listeners" : {
619               "clicked" : [
620                "( ) => {",
621                "\t",
622                "",
623                "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
624                "",
625                "\t_this.deletemenu.el.hide();",
626                "\t_this.node.remove_prop(n);",
627                "}",
628                ""
629               ]
630              },
631              "string label" : "Delete",
632              "xtype" : "Button"
633             }
634            ],
635            "xtype" : "Box"
636           }
637          ],
638          "xtype" : "Popover"
639         },
640         {
641          "$ xns" : "Gtk",
642          "listeners" : {
643           "pressed" : [
644            "(n_press, in_x, in_y) => {",
645            "",
646            "\tGLib.debug(\"Prssed %d\", (int)  this.el.get_current_button());",
647            "\t",
648            "\tvar col = _this.view.getColAt(in_x, in_y);",
649            "\tif (col != 0) {",
650            "\t\treturn;",
651            "\t}",
652            "\tstring pos;",
653            "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
654            "\t",
655            "\tif (row < 0) {",
656            "\t\treturn;",
657            "",
658            "\t}",
659            "\tGLib.debug(\"hit row %d\", row);",
660            "\tvar prop = _this.selmodel.getPropAt(row);",
661            "\t_this.selmodel.selectProp(prop);",
662            "",
663            "\t//var point_at = _this.view.getWidgetAtRow(row);",
664            "\t",
665            "\t    \t// need to shift down, as ev.y does not inclucde header apparently..",
666            "     \t// or popover might be trying to do a central?",
667            "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
668            "  \t _this.stop_editor();",
669            "     _this.view.popover.show(",
670            " \t\t\t_this.view.el, ",
671            " \t\t\t_this.node, prop,  ",
672            "\t\t (int)in_y);",
673            "    ",
674            "    ",
675            "      ",
676            "}",
677            ""
678           ]
679          },
680          "xtype" : "GestureClick"
681         },
682         {
683          "$ xns" : "Gtk",
684          "listeners" : {
685           "pressed" : [
686            "(n_press, in_x, in_y) => {",
687            "",
688            "\t",
689            "\t ",
690            "\tstring pos;",
691            "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
692            "\t",
693            "\tif (row < 0) {",
694            "\t\treturn;",
695            "",
696            "\t}",
697            "\t",
698            "\t_this.stop_editor();",
699            "\tGLib.debug(\"hit row %d\", row);",
700            "\tvar prop = _this.selmodel.getPropAt(row);",
701            "\t_this.selmodel.selectProp(prop);",
702            "\t",
703            "\t",
704            "\t",
705            "\tGLib.debug(\"Prssed %d\", (int)  this.el.get_current_button());",
706            "\t//_this.deletemenu.el.set_parent(_this.view.el);",
707            "\tif (_this.deletemenu.el.parent == null) {",
708            "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
709            "\t}",
710            "\t",
711            "\t",
712            "\t ",
713            "\t_this.deletemenu.el.set_offset(",
714            "\t\t\t(int)in_x  - _this.view.el.get_width() ,",
715            "\t\t\t(int)in_y - _this.view.el.get_height()",
716            "\t\t);",
717            "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
718            "    _this.deletemenu.el.popup();",
719            "      ",
720            "}",
721            ""
722           ]
723          },
724          "uint button" : 3,
725          "xtype" : "GestureClick"
726         },
727         {
728          "$ xns" : "Gtk",
729          "* prop" : "model",
730          "bool can_unselect" : true,
731          "id" : "selmodel",
732          "items" : [
733           {
734            "$ xns" : "GLib",
735            "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
736            "* prop" : "model",
737            "id" : "model",
738            "xtype" : "ListStore"
739           }
740          ],
741          "xtype" : "SingleSelection",
742          "| JsRender.NodeProp getPropAt" : [
743           "(uint row) {",
744           "",
745           "\treturn   (JsRender.NodeProp) this.el.get_item(row);",
746           "",
747           "\t ",
748           "}"
749          ],
750          "| int propToRow" : [
751           "(JsRender.NodeProp prop) {",
752           "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
753           "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
754           "\t\tif (r.equals(prop)) {",
755           "\t\t\treturn i;",
756           "\t\t\t",
757           "\t\t}",
758           "\t}",
759           "\treturn -1;",
760           "\t ",
761           "}"
762          ],
763          "| void selectProp" : [
764           "(JsRender.NodeProp prop) {",
765           "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
766           "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
767           "\t\tif (r.equals(prop)) {",
768           "\t\t\tthis.el.selected = i;",
769           "\t\t\treturn;",
770           "\t\t}",
771           "\t}",
772           "\t ",
773           "}"
774          ],
775          "| void startEditing" : [
776           "(JsRender.NodeProp prop) {",
777           "\t// should we call select?? - caller does int (from windowstate)",
778           "\t",
779           "}"
780          ]
781         },
782         {
783          "$ xns" : "Gtk",
784          "* pack" : "append_column",
785          "bool expand" : true,
786          "bool resizable" : true,
787          "id" : "keycol",
788          "items" : [
789           {
790            "$ xns" : "Gtk",
791            "* prop" : "factory",
792            "listeners" : {
793             "bind" : [
794              "(listitem) => {",
795              " var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
796              " var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
797              "",
798              " if (item == null) {",
799              " \treturn;",
800              "}",
801              "item.bind_property(\"to_display_name_prop\",",
802              "                    lb, \"label\",",
803              "                   GLib.BindingFlags.SYNC_CREATE);",
804              "item.bind_property(\"to_tooltip_name_prop\",",
805              "                    lb, \"tooltip_markup\",",
806              "                   GLib.BindingFlags.SYNC_CREATE);",
807              "// was item (1) in old layout",
808              " ",
809              "",
810              "}",
811              ""
812             ],
813             "setup" : [
814              "(listitem) => {",
815              "\tvar lbl = new Gtk.Label(\"\");",
816              " \t((Gtk.ListItem)listitem).set_child(lbl);",
817              " \tlbl.justify = Gtk.Justification.LEFT;",
818              " \tlbl.xalign = 1;",
819              " \tlbl.use_markup = true;",
820              "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
821              " \t/*lbl.changed.connect(() => {",
822              "\t\t// notify and save the changed value...",
823              "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
824              "         ",
825              "        //prop.val = lbl.text;",
826              "        //_this.updateIter(iter,prop);",
827              "        _this.changed();",
828              "\t});",
829              "\t*/",
830              "\t((Gtk.ListItem)listitem).activatable = true;",
831              "}",
832              ""
833             ]
834            },
835            "xtype" : "SignalListItemFactory"
836           }
837          ],
838          "title" : "Property",
839          "xtype" : "ColumnViewColumn"
840         },
841         {
842          "$ xns" : "Gtk",
843          "* pack" : "append_column",
844          "bool expand" : true,
845          "bool resizable" : true,
846          "id" : "valcol",
847          "items" : [
848           {
849            "$ xns" : "Gtk",
850            "* prop" : "factory",
851            "bool is_setting" : false,
852            "listeners" : {
853             "bind" : [
854              "(listitem) => {",
855              "\t this.is_setting = true;",
856              "",
857              "",
858              "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
859              " ",
860              "\t",
861              "\t",
862              "\t",
863              "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
864              "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
865              "\tvar cb  = (Gtk.DropDown) lbl.get_next_sibling();",
866              "\t// decide if it's a combo or editable text..",
867              "\tvar model = (Gtk.StringList) cb.model;",
868              " ",
869              "\telbl.hide();",
870              "\tlbl.hide();",
871              "\tcb.hide();",
872              "\t",
873              "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
874              " \tif (prop == null || _this.node == null ) {",
875              " \t\tGLib.error(\"something is wrong\");",
876              "\t \t ",
877              "\t}",
878              "\tif ( _this.node.fqn() == \"\") {",
879              " \t\tGLib.debug(\"node is missing fqn\");",
880              "\t \treturn;",
881              "\t}",
882              "\t",
883              "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
884              "\t//GLib.debug(\"prop.val = %s\", prop.val);",
885              "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
886              "\t ",
887              "    var use_textarea =  prop.useTextArea();",
888              "    ",
889              "    ",
890              "    var pal = _this.file.project.palete;",
891              "        ",
892              "    string[] opts = {};",
893              "  ",
894              "    var has_opts = prop.ptype.can_have_opt_list() ? ",
895              "    \tpal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts)",
896              "    \t: false;",
897              "    ",
898              "    if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
899              "      \tuse_textarea = true;",
900              "    }",
901              "    ",
902              "    ",
903              "    if (use_textarea) {",
904              "    \tprop.bind_property(\"val_short\",",
905              "                    lbl, \"label\",",
906              "                   GLib.BindingFlags.SYNC_CREATE);",
907              "        prop.bind_property(\"val_tooltip\",",
908              "                    lbl, \"tooltip_markup\",",
909              "                   GLib.BindingFlags.SYNC_CREATE);",
910              "        lbl.show();",
911              "\t\tthis.is_setting = false;        ",
912              "        return;",
913              "    \t",
914              "    }",
915              "     ",
916              "        ",
917              "        ",
918              "        ",
919              "        ",
920              "        // others... - fill in options for true/false?",
921              "           // GLib.debug (ktype.up());",
922              "    if (has_opts) {",
923              "\t",
924              "\t\twhile(model.get_n_items() > 0) {",
925              "\t\t\tmodel.remove(0);",
926              "\t\t}",
927              "\t\tcb.show();",
928              " \t\t// can not remove - hopefully always empty.",
929              "\t\tvar sel = -1;",
930              "\t\tfor(var i = 0; i < opts.length; i ++) {",
931              "\t\t\tmodel.append( opts[i]);",
932              "\t\t\t// not sure this is a great idea... ",
933              "\t\t\tif (opts[i].down() == prop.val.down()) {",
934              "\t\t\t\tsel = i;",
935              "\t\t\t}",
936              "\t\t}",
937              "\t\tGLib.debug(\"Set selected item to %d\", sel);",
938              "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
939              "\t\tthis.is_setting = false;        ",
940              "\t\treturn ;",
941              "    }",
942              "                                  ",
943              "\t// see if type is a Enum.",
944              "\t// triggers a changed event",
945              " ",
946              "\telbl.set_text(prop.val);",
947              " ",
948              "\telbl.show();",
949              "\tthis.is_setting = false;        \t\t ",
950              "\t",
951              "\t",
952              "\t",
953              " ",
954              "",
955              "}",
956              ""
957             ],
958             "setup" : [
959              "(listitem) => {",
960              "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
961              "\tvar elbl  = new Gtk.EditableLabel(\"\");",
962              "\telbl.hexpand = true;",
963              "\thb.append(elbl);",
964              "\tvar lbl  = new Gtk.Label(\"\");",
965              "\thb.append(lbl);",
966              "\tlbl.hexpand = true;",
967              "\tlbl.use_markup = true;",
968              "\tlbl.xalign =0;",
969              "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
970              "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
971              "\tcb.hexpand = true;",
972              " ",
973              "\thb.append(cb);",
974              "\t((Gtk.ListItem)listitem).set_child(hb);",
975              "\t ",
976              "\t var ef = new Gtk.EventControllerFocus();",
977              "\t ef.enter.connect(() => {",
978              " \t\t _this.stop_editor();",
979              " \t\t  var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
980              "\t\t _this.selmodel.selectProp(prop);\t\t",
981              "\t });",
982              "\t elbl.add_controller(ef);",
983              "\t ",
984              "\t ",
985              "\t  // dropdown??? - stop editing, and highliht node",
986              "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
987              "\t tb.clicked.connect(() => {",
988              "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
989              "\t\t\t",
990              "\t \t _this.stop_editor();",
991              "\t \t _this.selmodel.selectProp(prop);",
992              "\t \t ",
993              "\t });",
994              " \telbl.changed.connect(() => {",
995              "\t\t// notify and save the changed value...",
996              "\t \t",
997              "        //_this.updateIter(iter,prop);",
998              "        // this should happen automatically",
999              "        ",
1000              "        if (!_this.loading && !this.is_setting) {",
1001              "\t\t    var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1002              "\t\t\t ",
1003              "\t\t ",
1004              "\t\t    prop.val = elbl.text;",
1005              "        \t GLib.debug(\"calling changed\");",
1006              "\t        _this.changed();",
1007              "\t       ",
1008              "        }",
1009              "        ",
1010              "\t});",
1011              "\t",
1012              "\t",
1013              "\tcb.notify[\"selected\"].connect(() => {",
1014              "\t\t// dropdown selection changed.",
1015              "\t\t",
1016              "\t\t",
1017              "\t\t",
1018              "        //_this.updateIter(iter,prop);",
1019              "        if (!_this.loading && !this.is_setting) {",
1020              "\t\t    var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1021              "\t\t    var model = (Gtk.StringList)cb.model;",
1022              "\t\t    prop.val =   model.get_string(cb.selected);",
1023              "\t\t    GLib.debug(\"property set to %s\", prop.val);",
1024              "        \tGLib.debug(\"calling changed\");",
1025              "\t        _this.changed();",
1026              "\t         ",
1027              "        }",
1028              "        ",
1029              "\t\t",
1030              "\t});",
1031              "\tvar gc = new Gtk.GestureClick();",
1032              "\tlbl.add_controller(gc);",
1033              "\tgc.pressed.connect(() => {",
1034              "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
1035              "\t\t _this.stop_editor();",
1036              "\t    _this.show_editor(_this.file, prop.parent, prop);",
1037              "\t});",
1038              "\t  ",
1039              "\t",
1040              "\t",
1041              "}",
1042              ""
1043             ]
1044            },
1045            "xtype" : "SignalListItemFactory"
1046           }
1047          ],
1048          "title" : "Value",
1049          "xtype" : "ColumnViewColumn"
1050         },
1051         {
1052          "$ xns" : "Gtk",
1053          "* pack" : false,
1054          "id" : "ContextMenu",
1055          "items" : [
1056           {
1057            "$ xns" : "Gtk",
1058            "* prop" : "child",
1059            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
1060            "int spacing" : 0,
1061            "items" : [
1062             {
1063              "$ xns" : "Gtk",
1064              "label" : "Delete",
1065              "listeners" : {
1066               "activate" : [
1067                "  ( )  =>{",
1068                "\t_this.deleteSelected();",
1069                "\t",
1070                "}"
1071               ]
1072              },
1073              "xtype" : "Button"
1074             }
1075            ],
1076            "xtype" : "Box"
1077           }
1078          ],
1079          "xtype" : "Popover"
1080         }
1081        ],
1082        "string name" : "leftprops-view",
1083        "xtype" : "ColumnView",
1084        "| Gtk.Widget? getWidgetAtRow" : [
1085         "(uint row) {",
1086         "/*",
1087         "    \t",
1088         "from    \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1089         "    \tvar colview = gesture.widget;",
1090         "    \tvar line_no = check_list_widget(colview, x,y);",
1091         "         if (line_no > -1) {",
1092         "    \t\tvar item = colview.model.get_item(line_no);",
1093         "    \t\t ",
1094         "    \t}",
1095         "    \t*/",
1096         "\t\t//GLib.debug(\"Get Widget At Row %d\", (int)row);",
1097         "        var  child = this.el.get_first_child(); ",
1098         "    \tvar line_no = -1; ",
1099         "    \tvar reading_header = true;",
1100         "",
1101         "    \twhile (child != null) {",
1102         "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
1103         "    \t    if (reading_header) {",
1104         "\t\t\t ",
1105         "\t\t\t   ",
1106         "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
1107         "\t\t\t\t\tchild = child.get_next_sibling();",
1108         "\t\t\t\t\tcontinue;",
1109         "\t\t\t\t}",
1110         "\t\t\t\tchild = child.get_first_child(); ",
1111         "\t\t\t\treading_header = false;",
1112         "\t\t\t\tcontinue;",
1113         "\t        }",
1114         "\t\t    if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
1115         "    \t\t    child = child.get_next_sibling();",
1116         "    \t\t    continue;",
1117         "\t\t    }",
1118         "\t\t    line_no++;",
1119         "\t\t\tif (line_no == row) {",
1120         "\t\t\t\t//GLib.debug(\"Returning widget %s\", child.get_type().name());",
1121         "\t\t\t    return (Gtk.Widget)child;",
1122         "\t\t    }",
1123         "\t        child = child.get_next_sibling(); ",
1124         "    \t}",
1125         "\t\t//GLib.debug(\"Rturning null\");",
1126         "        return null;",
1127         "",
1128         " }"
1129        ],
1130        "| int getColAt" : [
1131         "(double x,  double y) {",
1132         "/*",
1133         "    \t",
1134         "from    \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
1135         "    \t  ",
1136         "    \t*/",
1137         "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
1138         "        var  child = this.el.get_first_child(); ",
1139         "    \t ",
1140         "    \tvar col = 0;",
1141         "    \tvar offx = 0;",
1142         "    \twhile (child != null) {",
1143         "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
1144         "\t\t\t",
1145         "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
1146         "\t\t\t\tchild = child.get_first_child();",
1147         "\t\t\t\tcontinue;",
1148         "\t\t\t}",
1149         "\t\t\t",
1150         "\t\t\t//child.get_allocation(out alloc);",
1151         "\t\t\tif (x <  (child.get_width() + offx)) {",
1152         "\t\t\t\treturn col;",
1153         "\t\t\t}",
1154         "\t\t\toffx += child.get_width();",
1155         "\t\t\tcol++;",
1156         "\t\t\tchild = child.get_next_sibling();",
1157         "\t\t}",
1158         "    \t     ",
1159         "\t\t\t  ",
1160         "        return -1;",
1161         "",
1162         " }"
1163        ],
1164        "| int getRowAt" : [
1165         "(double x,  double  y, out string pos) {",
1166         "",
1167         "\tpos = \"\";",
1168         "\tvar w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);",
1169         "\t//GLib.debug(\"got widget %s\", w == null ? \"nothing\" : w.get_type().name());",
1170         "\tif (w == null) {",
1171         "\t\treturn -1;",
1172         "\t}",
1173         "\t",
1174         "\tvar row= w.get_ancestor(GLib.Type.from_name(\"GtkColumnViewRowWidget\"));",
1175         "\tif (row == null) {",
1176         "\t\treturn -1;",
1177         "\t}",
1178         "\t",
1179         "\t//GLib.debug(\"got colview %s\", row == null ? \"nothing\" : row.get_type().name());",
1180         "\t ",
1181         "\tvar rn = 0;",
1182         "\tvar cr = row;",
1183         "\t ",
1184         "\twhile (cr.get_prev_sibling() != null) {",
1185         "\t\trn++;",
1186         "\t\tcr = cr.get_prev_sibling();",
1187         "\t}",
1188         "\t",
1189         "\t//GLib.debug(\"row number is %d\", rn);",
1190         "\t//GLib.debug(\"click %d, %d\", (int)x, (int)y);",
1191         "\t// above or belw",
1192         "\tGraphene.Rect  bounds;",
1193         "\trow.compute_bounds(this.el, out bounds);",
1194         "\t//GLib.debug(\"click x=%d, y=%d, w=%d, h=%d\", ",
1195         "\t//\t(int)bounds.get_x(), (int)bounds.get_y(),",
1196         "\t//\t(int)bounds.get_width(), (int)bounds.get_height()",
1197         "\t//\t);",
1198         "\tvar ypos = y - bounds.get_y();",
1199         "\t//GLib.debug(\"rel ypos = %d\", (int)ypos);\t",
1200         "\tvar rpos = 100.0 * (ypos / bounds.get_height());",
1201         "\t//GLib.debug(\"rel pos = %d %%\", (int)rpos);",
1202         "\tpos = \"over\";",
1203         "\t",
1204         "\tif (rpos > 80) {",
1205         "\t\tpos = \"below\";",
1206         "\t} else if (rpos < 20) {",
1207         "\t\tpos = \"above\";",
1208         "\t} ",
1209         "\treturn rn;",
1210         " }"
1211        ],
1212        "| void editProp" : [
1213         "(JsRender.NodeProp prop) ",
1214         "{",
1215         "\tvar sm = _this.selmodel.el;",
1216         " ",
1217         "\t\tvar sr = -1;",
1218         "\t\tGLib.debug(\"finding node\");",
1219         "\t\t_this.selmodel.selectProp(prop);",
1220         "\t\t",
1221         "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
1222         "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
1223         "\t\t\tif (r.equals(prop)) {",
1224         "\t\t\t\tsr = i;",
1225         "\t\t\t\tbreak;",
1226         "\t\t\t}",
1227         "\t\t}",
1228         "\t\tif (sr < 0) {",
1229         "\t\t\tGLib.debug(\"finding node - cant find it\");",
1230         "\t\t\t \t\t",
1231         "\t\t\treturn;",
1232         "\t\t}",
1233         "\t\tvar r = this.getWidgetAtRow(sr);",
1234         "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
1235         "\t\tvar ca = r.get_first_child();",
1236         "\t\tvar ll = (Gtk.Label)ca.get_first_child();",
1237         "\t\tvar cb = ca.get_next_sibling();",
1238         "\t\tvar b = cb.get_first_child();",
1239         "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
1240         "\t\tvar l = (Gtk.Label) e.get_next_sibling();",
1241         "\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
1242         "\t\t",
1243         "\t\tGLib.debug(\"row key = %s\", ll.label);",
1244         "\t\tif (e.get_visible()) {",
1245         "\t\t\t_this.stop_editor();",
1246         "\t\t\te.start_editing();",
1247         "\t\t\t//GLib.Timeout.add_once(500, () => {",
1248         "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
1249         "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
1250         "\t\t\t//\ted.grab_focus_without_selecting();",
1251         "\t\t\t//});",
1252         "\t\t\treturn;",
1253         "\t\t}",
1254         "\t\tif (d.get_visible()) {",
1255         "\t\t\t_this.stop_editor();",
1256         "\t\t\td.activate();",
1257         "\t\t\treturn;",
1258         "\t\t}",
1259         "\t\tif (l.get_visible()) {",
1260         "\t\t \t_this.stop_editor();",
1261         "\t\t \tif (prop.parent == null) {",
1262         "\t\t \t\treturn;",
1263         "\t \t\t}",
1264         "\t    \t_this.show_editor(_this.file, prop.parent, prop);",
1265         "\t\t",
1266         "\t\t}",
1267         "\t\t",
1268         "\t\t",
1269         "\t\t",
1270         "\t\t//gtkcolumnviewrowwidget",
1271         "\t\t  // cell widet",
1272         "\t\t  // cell widget",
1273         "\t\t  \t// box",
1274         "\t\t  \t\t// entry / label / dropdown",
1275         "\t\t \t\t",
1276         "\t\t ",
1277         "}"
1278        ]
1279       }
1280      ],
1281      "xtype" : "ScrolledWindow"
1282     }
1283    ],
1284    "xtype" : "Box",
1285    "| string keyFormat" : [
1286     "(string val, string type) {",
1287     "    ",
1288     "    // Glib.markup_escape_text(val);",
1289     "",
1290     "    if (type == \"listener\") {",
1291     "        return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + ",
1292     "            GLib.Markup.escape_text(val) +",
1293     "             \"</span>\";",
1294     "    }",
1295     "    // property..",
1296     "    if (val.length < 1) {",
1297     "        return \"<span  color=\\\"#FF0000\\\">--empty--</span>\";",
1298     "    }",
1299     "    ",
1300     "    //@ = signal",
1301     "    //$ = property with ",
1302     "    //# - object properties",
1303     "    //* = special",
1304     "    // all of these... - display value is last element..",
1305     "    var ar = val.strip().split(\" \");",
1306     "    ",
1307     "    ",
1308     "    var dval = GLib.Markup.escape_text(ar[ar.length-1]);",
1309     "    ",
1310     "    ",
1311     "    ",
1312     "    ",
1313     "    switch(val[0]) {",
1314     "        case '@': // signal // just bold balck?",
1315     "            if (dval[0] == '@') {",
1316     "                dval = dval.substring(1);",
1317     "            }",
1318     "        ",
1319     "            return @\"<span  font_weight=\\\"bold\\\">@ $dval</span>\";        ",
1320     "        case '#': // object properties?",
1321     "            if (dval[0] == '#') {",
1322     "                dval = dval.substring(1);",
1323     "            }",
1324     "            return @\"<span  font_weight=\\\"bold\\\">$dval</span>\";",
1325     "        case '*': // special",
1326     "            if (dval[0] == '*') {",
1327     "                dval = dval.substring(1);",
1328     "            }",
1329     "            return @\"<span   color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\";            ",
1330     "        case '$':",
1331     "            if (dval[0] == '$') {",
1332     "                dval = dval.substring(1);",
1333     "            }",
1334     "            return @\"<span   style=\\\"italic\\\">$dval</span>\";",
1335     "       case '|': // user defined methods",
1336     "            if (dval[0] == '|') {",
1337     "                dval = dval.substring(1);",
1338     "            }",
1339     "            return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";",
1340     "            ",
1341     "              ",
1342     "            ",
1343     "        default:",
1344     "            return dval;",
1345     "    }",
1346     "      ",
1347     "    ",
1348     "",
1349     "}"
1350    ],
1351    "| string keySortFormat" : [
1352     "(string key) {",
1353     "    // listeners first - with 0",
1354     "    // specials",
1355     "    if (key[0] == '*') {",
1356     "        return \"1 \" + key;",
1357     "    }",
1358     "    // functions",
1359     "    ",
1360     "    var bits = key.split(\" \");",
1361     "    ",
1362     "    if (key[0] == '|') {",
1363     "        return \"2 \" + bits[bits.length -1];",
1364     "    }",
1365     "    // signals",
1366     "    if (key[0] == '@') {",
1367     "        return \"3 \" + bits[bits.length -1];",
1368     "    }",
1369     "        ",
1370     "    // props",
1371     "    if (key[0] == '#') {",
1372     "        return \"4 \" + bits[bits.length -1];",
1373     "    }",
1374     "    // the rest..",
1375     "    return \"5 \" + bits[bits.length -1];    ",
1376     "",
1377     "",
1378     "",
1379     "}"
1380    ],
1381    "| void deleteSelected" : [
1382     " () {",
1383     "    ",
1384     "\t\treturn;",
1385     "\t\t/*",
1386     "        ",
1387     "        Gtk.TreeIter iter;",
1388     "        Gtk.TreeModel mod;",
1389     "        ",
1390     "        var s = this.view.el.get_selection();",
1391     "        s.get_selected(out mod, out iter);",
1392     "             ",
1393     "              ",
1394     "        GLib.Value gval;",
1395     "        mod.get_value(iter, 0 , out gval);",
1396     "        var prop = (JsRender.NodeProp)gval;",
1397     "        if (prop == null) {",
1398     "\t        this.load(this.file, this.node);    ",
1399     "        \treturn;",
1400     "    \t}",
1401     "    \t// stop editor after fetching property - otherwise prop is null.",
1402     "        this.stop_editor();",
1403     "        ",
1404     "            \t",
1405     "        switch(prop.ptype) {",
1406     "            case JsRender.NodePropType.LISTENER:",
1407     "                this.node.listeners.unset(prop.to_index_key());",
1408     "                break;",
1409     "                ",
1410     "            default:",
1411     "                this.node.props.unset(prop.to_index_key());",
1412     "                break;",
1413     "        }",
1414     "        this.load(this.file, this.node);",
1415     "        ",
1416     "        _this.changed();",
1417     "        */",
1418     "}"
1419    ],
1420    "| void load" : [
1421     "(JsRender.JsRender file, JsRender.Node? node) ",
1422     "{",
1423     "\t// not sure when to initialize this - we should do it on setting main window really.    ",
1424     "\t",
1425     "\tthis.loading = true;",
1426     "    if (this.view.popover == null) {",
1427     " \t\t   this.view.popover = new Xcls_PopoverProperty();",
1428     " \t\t   this.view.popover.mainwindow = _this.main_window;",
1429     "\t}",
1430     "    ",
1431     "    ",
1432     "    if (this.node != null) {",
1433     "    \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
1434     "    \t",
1435     "    }",
1436     "    ",
1437     "    GLib.debug(\"load leftprops\");",
1438     "",
1439     "    this.node = node;",
1440     "    this.file = file;",
1441     "    ",
1442     " ",
1443     "    this.model.el.remove_all();",
1444     "              ",
1445     "    //this.get('/RightEditor').el.hide();",
1446     "    if (node ==null) {",
1447     "        GLib.debug(\"node is null return\");",
1448     "        return ;",
1449     "    }",
1450     "",
1451     "    node.loadProps(this.model.el, _this.main_window.windowstate.project); ",
1452     "    ",
1453     "    ",
1454     "   //GLib.debug(\"clear selection\\n\");",
1455     "   ",
1456     "   \tthis.loading = false;",
1457     "    this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
1458     "    this.updateErrors();",
1459     "   // clear selection?",
1460     "  //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
1461     "   ",
1462     "   // this.view.el.get_selection().unselect_all();",
1463     "   ",
1464     "  // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1465     "  // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);",
1466     "   ",
1467     "}",
1468     ""
1469    ],
1470    "| void removeErrors" : [
1471     "() {",
1472     "\t\tif (this.error_widgets == null || this.error_widgets.size < 1) {",
1473     " \t\treturn;",
1474     "\t}",
1475     "\tforeach(var child in this.error_widgets) {",
1476     "\t",
1477     "\t\tif (child.has_css_class(\"node-err\")) {",
1478     "\t\t\tchild.remove_css_class(\"node-err\");",
1479     "\t\t}",
1480     "\t\tif (child.has_css_class(\"node-warn\")) {",
1481     "\t\t\tchild.remove_css_class(\"node-warn\");",
1482     "\t\t}",
1483     "\t\t",
1484     "\t\tif (child.has_css_class(\"node-depr\")) {",
1485     "\t\t\tchild.remove_css_class(\"node-depr\");",
1486     "\t\t}",
1487     "\t}",
1488     "\tthis.error_widgets  = null;",
1489     "\treturn;",
1490     "\t//GLib.debug(\"Rturning null\");",
1491     "     ",
1492     "}"
1493    ],
1494    "| void updateErrors" : [
1495     "() {",
1496     "\tvar file = this.file;",
1497     "\tif (file == null) {",
1498     "\t\treturn;",
1499     "\t}",
1500     "\tvar ar = file.getErrors();",
1501     "\tif (ar == null || ar.size < 1) {",
1502     "\t\tif (this.last_error_counter != file.error_counter) {",
1503     "\t\t\tthis.removeErrors();",
1504     "\t\t}",
1505     "",
1506     "\t\tthis.last_error_counter = file.error_counter ;",
1507     "",
1508     "\t\treturn;",
1509     "\t}",
1510     " \tif (this.last_error_counter == file.error_counter) {",
1511     "\t\treturn;",
1512     "\t}",
1513     "\tthis.removeErrors();",
1514     "\tthis.error_widgets = new Gee.ArrayList<Gtk.Widget>();",
1515     "\tforeach(var diag in ar) { ",
1516     "\t",
1517     "\t\t ",
1518     "//        print(\"get inter\\n\");",
1519     "\t    var node = file.lineToNode( (int)diag.range.start.line) ;",
1520     "\t    if (node == null || this.node == null || node.oid != this.node.oid) {",
1521     "\t    \tcontinue;",
1522     "    \t}",
1523     "    \tvar prop = node.lineToProp( (int)diag.range.start.line) ;",
1524     "    \tif (prop == null) {",
1525     "    \t\tcontinue;",
1526     "\t\t}",
1527     "    \tvar row = _this.selmodel.propToRow(prop);",
1528     "    \tif (row < 0) {",
1529     "    \t\tcontinue;",
1530     "\t\t}",
1531     "    \tvar w = this.view.getWidgetAtRow(row);",
1532     "    \tif (w == null) {",
1533     "    \t\treturn;",
1534     "\t\t}",
1535     "",
1536     "\t\t",
1537     "  \t\tvar ed = diag.category.down();",
1538     "\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
1539     "\t\t\tcontinue;",
1540     "\t\t}",
1541     "\t\tthis.error_widgets.add(w);\t\t",
1542     "\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
1543     "\t\t\tw.remove_css_class(\"node-warn\");",
1544     "\t\t}",
1545     "\t\tif (ed == \"err\" && w.has_css_class(\"node-depr\")) {",
1546     "\t\t\tw.remove_css_class(\"node-depr\");",
1547     "\t\t}",
1548     "\t\tif (!w.has_css_class(\"node-\"+ ed)) {",
1549     "\t\t\tw.add_css_class(\"node-\" + ed);",
1550     "\t\t}",
1551     "\t\t",
1552     "\t}",
1553     "\t",
1554     "}"
1555    ]
1556   }
1557  ],
1558  "name" : "WindowLeftProps"
1559 }