Hello everybody,

My name is Stefano Candori and I'm the maintainer of the GNOME Activity
Journal. In these days i'm trying to revamp it but I'm stuck with a problem.
Let me explain: I'm trying to implement a sort of scrollable timeline using
a ClutterCairoTexture to paint a long line (similar to the Facebook one) in
the center of the stage.
The strange thing is that the line is painted only if its height (the
height of the clutter actor) is less than about 8000. When in
"get_preferred_height" I set a natural_height and a minimum height of
9000-10000, the line is not painted.
What I'm doing wrong? Is there a limit for the height of an
ClutterCairoTexture? I don't think so, but I can't find the error.
Here's the code:

private class Journal.VTimeline : Clutter.CairoTexture {

    private Gee.ArrayList<int> point_circle;
    private const int len_arrow = 20; // hardcoded
    private const int arrow_origin = 30;
    private const int timeline_width = 2;
    private const int radius = 6;

    public VTimeline () {
        this.point_circle = new Gee.ArrayList<int> ();
        this.auto_resize = true;
    }

    public void add_circle (int y) {
        this.point_circle.add (y + arrow_origin - len_arrow / 2 + radius *
2 - 2);
    }

    public override bool draw (Cairo.Context ctx) {
        var bg =  Utils.get_timeline_bg_color ();
        Clutter.Color backgroundColor = Utils.gdk_rgba_to_clutter_color
(bg);
        var color = Utils.get_timeline_circle_color ();
        Clutter.Color circleColor = Utils.gdk_rgba_to_clutter_color (color);

        var cr = ctx;
        this.clear ();
        uint height, width;
        get_surface_size (out width, out height);
        //Draw the timeline
        Clutter.cairo_set_source_color(cr, backgroundColor);
        ctx.rectangle (radius, 0, timeline_width , height);
        ctx.fill ();

        //Draw circles
        foreach (int y in point_circle) {
            // Paint the border cirle to start with.
            Clutter.cairo_set_source_color(cr, backgroundColor);
            ctx.arc (radius + timeline_width / 2 , y, radius, 0, 2*Math.PI);
            ctx.stroke ();
            // Paint the colored cirle to start with.
            Clutter.cairo_set_source_color(cr, circleColor);
            ctx.arc (radius + timeline_width / 2, y, radius - 1, 0,
2*Math.PI);
            ctx.fill ();
        }

        return true;
        }


   public override void get_preferred_width (float for_height,out float
min_width, out float nat_width) {
       nat_width = min_width = 2 * radius + timeline_width;
   }

   public override void get_preferred_height (float for_width,out float
min_height, out float nat_height) {
       nat_height = min_height = 8000;
   }


Thanks in advance.
Cheers,

Stefano

P.S. Obviously my goal is not to hardcode the height value in the
"get_preferred_height" method, but to constraint it to its parent actor
that dynamically grows in height, using a BindCostraint. I've already tried
it but the problem is the same: when the parent actor become too much
"tall" the line disappears.
_______________________________________________
clutter-app-devel-list mailing list
clutter-app-devel-list@clutter-project.org
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to