3bf4b5583091a2f31bd06f351a65087a55516054
[roobuilder] / src / Builder4 / ValaCompileErrors.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# GLib.ListStore notices" : "",
7    "# Xcls_MainWindow window" : "",
8    "$ xns" : "Gtk",
9    "* ctor" : "new Gtk.Popover()",
10    "Gtk.PositionType position" : "Gtk.PositionType.TOP",
11    "bool autohide" : true,
12    "id" : "ValaCompileErrors",
13    "int height_request" : 800,
14    "int width_request" : 900,
15    "items" : [
16     {
17      "$ xns" : "Gtk",
18      "* pack" : "set_child",
19      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
20      "bool hexpand" : false,
21      "gboolean homogeneous" : false,
22      "id" : "compile_view",
23      "items" : [
24       {
25        "$ xns" : "Gtk",
26        "* init" : [
27         "{",
28         " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
29         " ",
30         "",
31         "}",
32         ""
33        ],
34        "items" : [
35         {
36          "$ xns" : "Gtk",
37          "* pack" : "set_child",
38          "bool hexpand" : true,
39          "bool vexpand" : true,
40          "id" : "tree",
41          "items" : [
42           {
43            "$ xns" : "Gtk",
44            "* prop" : "model",
45            "id" : "selmodel",
46            "items" : [
47             {
48              "$ xns" : "Gtk",
49              "* prop" : "model",
50              "id" : "sortmodel",
51              "items" : [
52               {
53                "$ xns" : "Gtk",
54                "* ctor" : [
55                 "new Gtk.TreeListModel(",
56                 "    new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..",
57                 "    false, // passthru",
58                 "    false, // autexpand",
59                 "    (item) => {",
60                 "    ",
61                 "    \t ",
62                 "    \t return ((Palete.CompileError)item).lines;",
63                 "    ",
64                 "    }",
65                 "    ",
66                 "    ",
67                 ")"
68                ],
69                "* prop" : "model",
70                "id" : "model",
71                "xtype" : "TreeListModel"
72               }
73              ],
74              "xtype" : "SortListModel",
75              "| Json.Object getNodeAt" : [
76               "(uint row) {",
77               "",
78               "   var tr = (Gtk.TreeListRow)this.el.get_item(row);",
79               "   ",
80               "  ",
81               "  // GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
82               "  \t",
83               "   ",
84               "   return (Json.Object)tr.get_item();",
85               "\t ",
86               "}"
87              ]
88             }
89            ],
90            "xtype" : "SingleSelection",
91            "| Json.Object getNodeAt" : [
92             "(uint row) {",
93             "",
94             "   var tr = (Gtk.TreeListRow)this.el.get_item(row);",
95             "   ",
96             "   var a = tr.get_item();;   ",
97             "   GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
98             "    ",
99             "   return (Json.Object)tr.get_item();",
100             "\t ",
101             "}"
102            ]
103           },
104           {
105            "$ xns" : "Gtk",
106            "* pack" : "append_column",
107            "bool expand" : true,
108            "bool resizable" : true,
109            "items" : [
110             {
111              "$ xns" : "Gtk",
112              "* prop" : "factory",
113              "listeners" : {
114               "bind" : [
115                "(listitem) => {",
116                "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
117                "\t",
118                "\t",
119                "\t",
120                "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
121                "\tvar expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();",
122                "\t  ",
123                " ",
124                "\tvar lbl = (Gtk.Label) expand.child;",
125                "\t",
126                "\t if (lbl.label != \"\") { // do not update",
127                "\t \treturn;",
128                " \t}",
129                "\t",
130                "",
131                "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
132                "\tvar np = (Palete.CompileError) lr.get_item();",
133                "\t",
134                "\t",
135                "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
136                "\tlbl.label = np.line_msg;",
137                "\t//lbl.tooltip_markup = np.to_property_option_tooltip();",
138                "\t ",
139                "    expand.set_hide_expander(  np.lines.n_items < 1);",
140                "\texpand.set_list_row(lr);",
141                " ",
142                " \t// expand current file.",
143                " \tif (_this.window.windowstate.file.path == np.file.path) {",
144                " \t\tlr.expanded = true;",
145                "\t}",
146                " \t ",
147                " \t// bind image...",
148                " \t",
149                "}",
150                ""
151               ],
152               "setup" : [
153                "(listitem) => {",
154                "\t",
155                "\tvar expand = new Gtk.TreeExpander();",
156                "\t ",
157                "\texpand.set_indent_for_depth(true);",
158                "\texpand.set_indent_for_icon(true);",
159                "\t ",
160                "\tvar lbl = new Gtk.Label(\"\");",
161                "\tlbl.use_markup = true;",
162                "\t",
163                "\t",
164                " \tlbl.justify = Gtk.Justification.LEFT;",
165                " \tlbl.xalign = 0;",
166                "",
167                " ",
168                "\texpand.set_child(lbl);",
169                "\t((Gtk.ListItem)listitem).set_child(expand);",
170                "\t((Gtk.ListItem)listitem).activatable = false;",
171                "}",
172                ""
173               ]
174              },
175              "xtype" : "SignalListItemFactory"
176             }
177            ],
178            "string title" : "Compile Result",
179            "xtype" : "ColumnViewColumn"
180           },
181           {
182            "$ xns" : "Gtk",
183            "listeners" : {
184             "pressed" : [
185              "(n_press, x, y) => {",
186              "\t",
187              "\tif (n_press < 2) { /// doubleclick?",
188              "\t\treturn;",
189              "\t}",
190              " ",
191              "\t",
192              "\t",
193              "\t// use selection?!",
194              "\tvar tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;",
195              "\t//GLib.debug(\"SELECTED = %s\", tr.item.get_type().name());",
196              "\tvar ce = (Palete.CompileError) tr.item;",
197              "",
198              "\tif (ce.line < 0) {",
199              "\t\t// did not click on a line.",
200              "\t\treturn;",
201              "\t}",
202              "\t ",
203              "\t ",
204              "    var fname  = ce.parent.file;",
205              "  \tvar line = ce.line;  ",
206              "    GLib.debug(\"open %s @ %d\\n\", ce.parent.file.path, ce.line);",
207              "    ",
208              "    ",
209              "   var  bjsf = \"\";",
210              "    try {             ",
211              "       var  regex = new Regex(\"\\\\.vala$\");",
212              "    ",
213              "     ",
214              "        bjsf = regex.replace(fname.path,fname.path.length , 0 , \".bjs\");",
215              "     } catch (GLib.RegexError e) {",
216              "        return;",
217              "    }   ",
218              "    var p = _this.window.project;",
219              "        ",
220              "        ",
221              "        ",
222              "    var jsr = p.getByPath(bjsf);",
223              "    if (jsr != null) {",
224              "        _this.window.windowstate.fileViewOpen(jsr, true, line);",
225              "        ",
226              "        if (jsr.path == _this.window.windowstate.file.path) {",
227              "        \t_this.el.hide();",
228              "    \t}",
229              "        ",
230              "        ",
231              "        return;",
232              "    ",
233              "    }",
234              "    try {",
235              "\t\tvar pf = JsRender.JsRender.factory(\"PlainFile\", p, fname.path);",
236              "\t\t_this.window.windowstate.fileViewOpen(pf, true, line);",
237              "    } catch (JsRender.Error e) {}",
238              "    // try hiding the left nav..",
239              " ",
240              "    return;",
241              "",
242              "}",
243              ""
244             ]
245            },
246            "uint button" : 0,
247            "xtype" : "GestureClick"
248           }
249          ],
250          "xtype" : "ColumnView"
251         }
252        ],
253        "xtype" : "ScrolledWindow"
254       }
255      ],
256      "xtype" : "Box"
257     }
258    ],
259    "xtype" : "Popover",
260    "| void show" : [
261     "( GLib.ListStore ls , Gtk.Widget onbtn) {",
262     "",
263     "    ",
264     " \t//this.el.present();",
265     "    //this.el.popup();",
266     "    this.notices = ls;",
267     "   ",
268     "     //print(\"looking for %s\\n\", id);",
269     "    // loop through parent childnre",
270     "      ",
271     "    ",
272     "      this.tree.el.hide(); //<< very important!!!",
273     "      ",
274     "   // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
275     " ",
276     "    var win = this.window.el;",
277     "    var  w = win.get_width();",
278     "    var h = win.get_height();",
279     "",
280     "  ",
281     "     ",
282     "    // left tree = 250, editor area = 500?",
283     "    ",
284     "    // min 450?",
285     "    var new_w = int.min(650, w-100);",
286     "    if (new_w > (w-100)) {",
287     "        new_w = w-100;",
288     "    }",
289     "    this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));",
290     " ",
291     "",
292     "   // this.el.set_relative_to(onbtn);",
293     "\t//Gtk.Allocation rect;",
294     "\t//onbtn.get_allocation(out rect);",
295     "    //this.el.set_pointing_to(rect);",
296     "\tthis.el.present();",
297     "    this.el.popup();",
298     "   ",
299     " ",
300     "\tvar tm = new Gtk.TreeListModel(",
301     "\t\tls, //..... << that's our store..",
302     "\t\tfalse, // passthru",
303     "\t\tfalse, // autexpand",
304     "\t\t(item) => {",
305     "\t\t",
306     "\t\t\t return ((Palete.CompileError)item).lines;",
307     "\t\t",
308     "\t\t}",
309     "\t);",
310     " ",
311     "    _this.model.el = tm;",
312     "    _this.sortmodel.el.set_model(tm);",
313     " ",
314     "         this.tree.el.show();   ",
315     "   ",
316     "   \t//if (expand != null) {",
317     "    //\t_this.compile_tree.el.expand_row(   store.get_path(expand) , true);",
318     "//\t}",
319     "    ",
320     " //   this.hpane.el.set_position( 0);",
321     "}",
322     ""
323    ]
324   }
325  ],
326  "name" : "ValaCompileErrors"
327 }