2 "build_module" : "builder",
5 "# Gdk.Pixbuf missing_thumb_pixbuf" : "null",
6 "# Gee.ArrayList<Object> fileitems" : "new Gee.ArrayList<Object>()",
8 "@ void open" : "(JsRender.JsRender file)",
9 "Clutter.ScrollMode scroll_mode" : "Clutter.ScrollMode.VERTICALLY",
10 "Project.Project project" : "",
11 "bool reactive" : true,
12 "id" : "ClutterFiles",
19 "this.el.add_constraint(",
20 " new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)",
22 "this.el.set_position(0,0);",
25 "* pack" : "add_child",
26 "id" : "project_title",
29 "$ orientation" : "Clutter.FlowOrientation.HORIZONTAL",
31 "* prop" : "layout_manager",
32 "boolean homogeneous" : false,
33 "column_spacing" : 20,
34 "id" : "project_title_manager",
36 "xtype" : "FlowLayout"
40 "* prop" : "layout_manager",
41 "xtype" : "FixedLayout"
45 "* ctor" : "new Clutter.Text.full(\"Sans 20px\", \"\", Clutter.Color.from_string(\"#eee\"))",
46 "* pack" : "add_child",
47 "boolean x_expand" : false,
50 "id" : "project_title_name",
55 "* ctor" : "new Clutter.Text.full(\"Sans 10px\", \"\", Clutter.Color.from_string(\"#ccc\"))",
56 "* pack" : "add_child",
59 "id" : "project_title_path",
66 "# Gdk.Pixbuf missing_thumb_pixbuf" : "null",
67 "# Gee.ArrayList<Xcls_fileitem> fileitems" : "new Gee.ArrayList<Xcls_fileitem>()",
69 "* pack" : "add_child",
70 "Clutter.ScrollMode scroll_mode" : "Clutter.ScrollMode.VERTICALLY",
71 "bool reactive" : true,
79 "this.el.add_constraint(",
80 " new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)",
85 "* pack" : "add_child",
89 "$ orientation" : "Clutter.FlowOrientation.HORIZONTAL",
91 "* prop" : "layout_manager",
92 "bool homogeneous" : false,
93 "column_spacing" : 20,
94 "float max_column_width" : "100.0f",
95 "id" : "filelayout_manager",
97 "xtype" : "FlowLayout"
100 "# JsRender.JsRender file" : "",
103 "* args" : "JsRender.JsRender file",
106 "this.el.set_size(100,100);"
113 "* prop" : "layout_manager",
114 "orientation" : "Clutter.Orientation.VERTICAL",
116 "xtype" : "BoxLayout"
120 "$ margin_right" : 5,
122 "$ x_align" : "Clutter.ActorAlign.START",
124 "$ y_align" : "Clutter.ActorAlign.START",
125 "* args" : "JsRender.JsRender file",
128 " Gdk.Pixbuf pixbuf= null;",
130 " var fname = file.getIconFileName(false);",
133 " if (FileUtils.test(fname, FileTest.EXISTS)) {",
134 " pixbuf = new Gdk.Pixbuf.from_file(fname);",
136 " } catch (Error e) {",
140 " if (pixbuf == null) {",
143 " if (_this.missing_thumb_pixbuf == null) {",
144 " var icon_theme = Gtk.IconTheme.get_default ();",
145 " _this.missing_thumb_pixbuf = icon_theme.load_icon (\"package-x-generic\", 92, 0);",
146 " _this.missing_thumb_pixbuf.ref();",
148 " pixbuf = _this.missing_thumb_pixbuf;",
150 " } catch (Error e) {",
155 " var img = new Clutter.Image();",
156 " img.set_data(pixbuf.get_pixels(), ",
157 " pixbuf.has_alpha ",
158 " ? Cogl.PixelFormat.RGBA_8888",
159 " : Cogl.PixelFormat.RGB_888,",
160 " pixbuf.get_width (),",
161 " pixbuf.get_height (),",
162 " pixbuf.get_rowstride ()",
164 " this.el.set_content(img);",
165 " } catch (Error e) {",
168 " // should probably do smarter scaling...",
171 " this.el.set_size(90, 70);",
175 "* pack" : "add_child",
176 "bool x_expand" : false,
177 "bool y_expand" : false,
182 "$ x_align" : "Clutter.ActorAlign.START",
184 "$ y_align" : "Clutter.ActorAlign.START",
185 "* args" : "JsRender.JsRender file",
186 "* ctor" : "new Clutter.Text.full(\"Sans 10px\", file.nickType(), Clutter.Color.from_string(\"#fff\"))",
187 "* pack" : "add_child",
188 "bool x_expand" : false,
189 "bool y_expand" : false,
194 "$ x_align" : "Clutter.ActorAlign.START",
196 "$ y_align" : "Clutter.ActorAlign.START",
197 "* args" : "JsRender.JsRender file",
198 "* ctor" : "new Clutter.Text.full(\"Sans 10px\", file.nickNameSplit(), Clutter.Color.from_string(\"#fff\"))",
199 "* pack" : "add_child",
200 "bool x_expand" : false,
201 "bool y_expand" : false,
207 "button_press_event" : [
209 " _this.open(this.file);",
215 " this.el.background_color = Clutter.Color.from_string(\"#333\");",
216 " this.title.el.background_color = Clutter.Color.from_string(\"#fff\");",
217 " this.typetitle.el.background_color = Clutter.Color.from_string(\"#fff\");",
218 " this.title.el.color = Clutter.Color.from_string(\"#000\");",
219 " this.typetitle.el.color = Clutter.Color.from_string(\"#000\");",
226 " this.el.background_color = Clutter.Color.from_string(\"#000\");",
227 " this.title.el.background_color = Clutter.Color.from_string(\"#000\");",
228 " this.typetitle.el.background_color = Clutter.Color.from_string(\"#000\");",
229 " this.title.el.color = Clutter.Color.from_string(\"#fff\");",
230 " this.typetitle.el.color = Clutter.Color.from_string(\"#fff\");",
242 "* args" : "string folderpath",
245 "//this.el.set_size(100,100);"
248 "id" : "*folderitem",
252 "* prop" : "layout_manager",
253 "orientation" : "Clutter.Orientation.VERTICAL",
255 "xtype" : "BoxLayout"
258 "$ x_align" : "Clutter.ActorAlign.START",
261 "$ y_align" : "Clutter.ActorAlign.START",
262 "* args" : "string folderpath",
263 "* ctor" : "new Clutter.Text.full(\"Sans bold 14px\", GLib.Path.get_basename(folderpath), Clutter.Color.from_string(\"#fff\"))",
264 "* pack" : "add_child",
265 "bool y_expand" : false,
266 "id" : "+foldertitle",
271 "* args" : "string filepath",
272 "* ctor" : "new Clutter.Text.full(\"Sans 10px\", GLib.Path.get_basename(filepath), Clutter.Color.from_string(\"#fff\"))",
275 "\tthis.filepath = filepath;",
279 "Clutter.ActorAlign x_align" : "Clutter.ActorAlign.START",
280 "Clutter.ActorAlign y_align" : "Clutter.ActorAlign.START",
281 "bool reactive" : true,
282 "bool x_expand" : true,
283 "bool y_expand" : true,
284 "id" : "*folderfile",
286 "button_press_event" : [
289 " var f = JsRender.JsRender.factory(\"PlainFile\", _this.project, this.filepath);",
296 " this.el.background_color = Clutter.Color.from_string(\"#fff\");",
297 " this.el.color = Clutter.Color.from_string(\"#000\");",
303 " this.el.background_color = Clutter.Color.from_string(\"#000\");",
304 " this.el.color = Clutter.Color.from_string(\"#fff\");",
309 "string filepath" : "",
322 " print(\"scroll event\\n\");",
323 " var y = _this.filelayout.el.y;",
324 " var dir = event.direction;",
326 " var last_child_bottom = _this.filelayout.el.last_child.y + _this.filelayout.el.last_child.height;",
327 " var bottompos = -1 * ( last_child_bottom - (0.5f * this.el.height));",
330 " case Clutter.ScrollDirection.UP:",
331 " print(\"Scroll up by %f\\n\", event.y);",
333 " y = float.min(0, y); // ",
336 " case Clutter.ScrollDirection.DOWN:",
337 " print(\"Scroll down by %f\\n\", event.y);",
338 " y -= event.y /2 ;",
339 " y = float.max(bottompos, y);",
343 " \t case Clutter.ScrollDirection.SMOOTH:",
344 " \t double delta_x, delta_y;",
345 " \t event.get_scroll_delta(out delta_x, out delta_y);",
346 " //print(\"Scroll SMOOTH? by %f\\n\", delta_y * event.y);",
347 " y += ((float)delta_y * event.y * -1.0f) /2 ;",
348 " y = float.max(bottompos, y);",
349 " y = float.min(0, y); // ",
353 "\t print(\"scroll event = bad direction %s\\n\", dir.to_string());",
356 " // range of scroll -- can go up -- eg.. -ve value.",
360 " print(\"Set scroll to %f (lcb=%f / height = %f)\\n\", y, last_child_bottom, this.el.height);",
362 " _this.filelayout.el.y = y;",
368 "xtype" : "ScrollActor"
372 "| void clearFiles" : [
375 " this.filelayout.el.remove_all_children();",
376 " // we need to unref all the chidren that we loaded though...",
381 "| void loadProject" : [
382 "(Project.Project pr) {",
383 " // list all the files, and create new Xcls_fileitem for each one.",
385 " this.project = pr;",
388 " // LEAK --- we should unref all the chilren...",
389 " this.filelayout.el.y = 0;",
390 " this.clearFiles();",
392 " print(\"clutter files - load project: \" + pr.name +\"\\n\");",
393 " // should unref.. them hopefully.",
395 " this.project_title_name.el.text = pr.name;",
396 " this.project_title_path.el.text = pr.firstPath();",
398 " // file items contains a reference until we reload ...",
399 " this.fileitems = new Gee.ArrayList<Object>();",
403 " var fiter = pr.sortedFiles().list_iterator();",
404 " while (fiter.next()) {",
405 " var a = new Xcls_fileitem(this,fiter.get());",
406 " this.fileitems.add(a);",
409 " print(\"add to clutter file view: \" + fiter.get().name + \"\\n\");",
410 " this.filelayout.el.add_child(a.el);",
415 " if (!(pr is Project.Gtk)) {",
416 " print (\"not gtk... skipping files\");",
419 " var gpr = (Project.Gtk)pr;",
420 " var def = gpr.compilegroups.get(\"_default_\");",
421 " // not sure why the above is returng null!??",
422 " if (def == null) {",
423 " \t\tdef = new Project.GtkValaSettings(\"_default_\"); ",
424 " \t\tgpr.compilegroups.set(\"_default_\", def);",
426 "\t var items = def.sources;",
430 "\tfor(var i =0 ; i < items.size; i++) {",
431 "\t print (\"cheking folder %s\\n\", items.get(i));",
432 "\t var files = gpr.filesForOpen(items.get(i));",
433 "\t if (files.size < 1) {",
437 "\t // add the directory... items.get(i);",
438 "\t var x = new Xcls_folderitem(this,items.get(i));",
439 "\t this.fileitems.add(x);",
440 "\t this.filelayout.el.add_child(x.el);",
442 "\t for(var j =0 ; j < files.size; j++) {",
443 "\t print (\"adding file %s\\n\", files.get(j));",
445 "\t var y = new Xcls_folderfile(this, files.get(j));",
446 "\t this.fileitems.add(y);",
447 "\t x.el.add_child(y.el);",
449 "\t // add file to files.get(j);",
454 "\t //this.el.set_value(citer, 1, items.get(i) );",
463 "| void set_size" : [
464 "(float w, float h) ",
467 " // called by window resize... with is alreaddy -50 (for the buttons?)",
472 " if (this.el == null) {",
473 " print(\"object not ready yet?\");",
477 " print(\"recv width %f, filelayoutw = %f\", w, w-200);",
479 " w = GLib.Math.floorf ( w/120.0f) * 120.0f;",
484 " //_this.filelayout_manager.el.max_column_width = w - 200;",
485 " _this.filelayout.el.width = w ;",
487 " this.el.set_size(",
488 " // this.el.get_stage().width-150,",
490 " h // this.el.get_stage().height",
493 " // 100 right for buttons ..",
494 " this.el.set_position(75,0);",
497 " this.scroller.el.set_size(",
498 " // this.el.get_stage().width-150,",
500 " h // this.el.get_stage().height",
503 " // 100 right for buttons ..",
504 " this.scroller.el.set_position(0,50);",
506 " _this.filelayout.el.y = 0.0f;",
514 "name" : "ClutterFiles",
516 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ClutterFiles.bjs",