X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=blobdiff_plain;f=src%2FBuilder4%2FClutterFiles.vala;h=f10613dd0c7698b64cf49ebbd4cc478c5207693c;hp=8d8b5545ae9a6a1f149c404aebde19bc20a4d81d;hb=HEAD;hpb=754d0bd7183e96995c517fcd70e1c731678bcc01 diff --git a/src/Builder4/ClutterFiles.vala b/src/Builder4/ClutterFiles.vala index 8d8b5545a..f10613dd0 100644 --- a/src/Builder4/ClutterFiles.vala +++ b/src/Builder4/ClutterFiles.vala @@ -24,6 +24,7 @@ public class Xcls_ClutterFiles : Object public Clutter.ScrollMode scroll_mode; public Gdk.Pixbuf missing_thumb_pixbuf; public signal void open (JsRender.JsRender file); + public Project.Project project; public Gee.ArrayList fileitems; // ctor @@ -57,6 +58,9 @@ public class Xcls_ClutterFiles : Object public void loadProject (Project.Project pr) { // list all the files, and create new Xcls_fileitem for each one. + this.project = pr; + + // LEAK --- we should unref all the chilren... this.filelayout.el.y = 0; this.clearFiles(); @@ -96,7 +100,7 @@ public class Xcls_ClutterFiles : Object for(var i =0 ; i < items.size; i++) { print ("cheking folder %s\n", items.get(i)); - var files = gpr.files(items.get(i)); + var files = gpr.filesForOpen(items.get(i)); if (files.size < 1) { continue; } @@ -140,8 +144,13 @@ public class Xcls_ClutterFiles : Object print("recv width %f, filelayoutw = %f", w, w-200); + w = GLib.Math.floorf ( w/120.0f) * 120.0f; + + + + //_this.filelayout_manager.el.max_column_width = w - 200; - _this.filelayout.el.width = w - 200; + _this.filelayout.el.width = w ; this.el.set_size( // this.el.get_stage().width-150, @@ -150,17 +159,17 @@ public class Xcls_ClutterFiles : Object ); // 100 right for buttons .. - this.el.set_position(0,0); + this.el.set_position(75,0); this.scroller.el.set_size( // this.el.get_stage().width-150, - w-50, + w, h // this.el.get_stage().height ); // 100 right for buttons .. - this.scroller.el.set_position(75,50); + this.scroller.el.set_position(0,50); // scroll... _this.filelayout.el.y = 0.0f; @@ -202,7 +211,7 @@ public class Xcls_ClutterFiles : Object this.el.add_constraint( new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f) ); - this.el.set_position(75,0); + this.el.set_position(0,0); } // user defined functions @@ -337,7 +346,7 @@ public class Xcls_ClutterFiles : Object //listeners this.el.scroll_event.connect( ( event) => { - //Sprint("scroll event"); + print("scroll event\n"); var y = _this.filelayout.el.y; var dir = event.direction; @@ -357,38 +366,24 @@ public class Xcls_ClutterFiles : Object y = float.max(bottompos, y); + break; + case Clutter.ScrollDirection.SMOOTH: + double delta_x, delta_y; + event.get_scroll_delta(out delta_x, out delta_y); + //print("Scroll SMOOTH? by %f\n", delta_y * event.y); + y += ((float)delta_y * event.y * -1.0f) /2 ; + y = float.max(bottompos, y); + y = float.min(0, y); // + break; default: + print("scroll event = bad direction %s\n", dir.to_string()); return false; } // range of scroll -- can go up -- eg.. -ve value. - // to work out the max -ve number - // height of filelayout - // height of scrollactor.. - - /* - if ( (-1 * (y+200)) > ( last_child_bottom - this.el.height)) { - var nv = _this.filelayout.el.y ; - if (nv != -1 * ( last_child_bottom - this.el.height)) { - - _this.filelayout.el.y = -1 * ( last_child_bottom - this.el.height); - return true; - } - - return false; - } - - */ - - - // print("\nlast child - this height = %f ==== new y %f\n ".printf( - // last_child_bottom - this.el.height, - // y)); - // y = float.min(0, y); //?? - // print("scroll event of %f - new y = %f ".printf(event.y, y)); print("Set scroll to %f (lcb=%f / height = %f)\n", y, last_child_bottom, this.el.height); _this.filelayout.el.y = y; @@ -508,10 +503,21 @@ public class Xcls_ClutterFiles : Object }); this.el.enter_event.connect( ( event) => { this.el.background_color = Clutter.Color.from_string("#333"); + this.title.el.background_color = Clutter.Color.from_string("#fff"); + this.typetitle.el.background_color = Clutter.Color.from_string("#fff"); + this.title.el.color = Clutter.Color.from_string("#000"); + this.typetitle.el.color = Clutter.Color.from_string("#000"); + return false; }); this.el.leave_event.connect( ( event) => { this.el.background_color = Clutter.Color.from_string("#000"); + this.title.el.background_color = Clutter.Color.from_string("#000"); + this.typetitle.el.background_color = Clutter.Color.from_string("#000"); + this.title.el.color = Clutter.Color.from_string("#fff"); + this.typetitle.el.color = Clutter.Color.from_string("#fff"); + + return false; }); } @@ -779,25 +785,29 @@ public class Xcls_ClutterFiles : Object this.el.x_expand = true; this.el.y_align = Clutter.ActorAlign.START; this.el.reactive = true; - this.el.y_expand = false; + this.el.y_expand = true; // init method { - this.filepath = filepath; + this.filepath = filepath; } //listeners this.el.button_press_event.connect( ( event) => { - // _this.open(this.filepath); + + var f = JsRender.JsRender.factory("PlainFile", _this.project, this.filepath); + _this.open(f); return false; }); this.el.enter_event.connect( ( event) => { - this.el.background_color = Clutter.Color.from_string("#333"); + this.el.background_color = Clutter.Color.from_string("#fff"); + this.el.color = Clutter.Color.from_string("#000"); return false; }); this.el.leave_event.connect( ( event) => { this.el.background_color = Clutter.Color.from_string("#000"); + this.el.color = Clutter.Color.from_string("#fff"); return false; }); }