Пример #1
0
 protected override void PaintWidget(Context ctx, int w, int h)
 {
     ctx.Rectangle (0.0d, 0.0d, w, h);
     ctx.SetFill (BlueprintStyle.BluePrint);
     double wb = w - Offset - xb - 4.0d;
     double xbt = wb * (current - min) / (max - min) - 4.0d;
     ctx.Fill ();
     switch (this.mode) {
     case MediaMode.Play:
         ctx.Rectangle (Offset + 2, 1.0d, 8.0d, 32.0d);
         ctx.Rectangle (Offset + 18, 1.0d, 8.0d, 32.0d);
         ctx.ClosePath ();
         break;
     default:
         ctx.MoveTo (Offset, 1.0d);
         ctx.RelLineTo (32.0d, 16.0d);
         ctx.RelLineTo (-32.0d, 16.0d);
         ctx.ClosePath ();
         break;
     }
     double xf = xb + xbt;
     double xt = xf + 8.0d;
     ctx.Rectangle (xf, 1.0d, 8.0d, 32.0d);
     this.xtickS = xf;
     this.xtickE = xt;
     ctx.SetFill (BlueprintStyle.FillPattern);
     ctx.FillPreserve ();
     ctx.SetFill (BlueprintStyle.HardWhite);
     if (xbt > 0.0d) {
         ctx.MoveTo (xb, 16.0d);
         ctx.LineTo (xf, 16.0d);
     }
     if (xf < w - Offset - 4.0d) {
         ctx.MoveTo (xt, 16.0d);
         ctx.LineTo (w - Offset - 4.0d, 16.0d);
     }
     foreach (double t in this.Chapters) {
         double x = this.TtoX (t);
         if (x < xf || x >= xt) {
             ctx.MoveTo (x, 0.0d);
             ctx.LineTo (x, 33.0d);
         }
     }
     ctx.Stroke ();
 }
Пример #2
0
        protected override void PaintWidget(Cairo.Context ctx, int w, int h)
        {
            ctx.SetFill(0.0d, 0.0d, 0.0d);
            ctx.Rectangle(0.0d, Offset, w, h - Offset);
            ctx.Fill();
            ctx.SetFill(BlueprintStyle.BluePrint);
            ctx.Rectangle(0.0d, 0.0d, w, Offset);
            ctx.Fill();
            double wr = w - 2.0d * Offset;
            double ew = wr / (max - min + 1 + shaft * (max - min));

            this.flapWidth = ew;
            double xc = Offset;

            for (int i = min; i <= max; i++)
            {
                if (i != current)
                {
                    ctx.Rectangle(xc, Offset, ew, h - 2.0d * Offset);
                }
                xc += (1.0d + shaft) * ew;
            }
            ctx.FillPreserve();
            LinearGradient p    = new LinearGradient(0.0d, Offset, 0.0d, Offset + 10.0d);
            double         fctr = 0.5d;

            for (double y = 0.0d; y <= 1.0d; y += 0.1d)
            {
                p.AddColorStopRgb(y, new Color(fctr * BlueprintStyle.BluePrintShadow.R, fctr * BlueprintStyle.BluePrintShadow.G, fctr * BlueprintStyle.BluePrintShadow.B));
                fctr += 0.05d;
            }
            ctx.SetFill(p);
            ctx.Fill();
            ctx.Rectangle(Offset + (1.0d + shaft) * ew * (current - min), Offset, ew, h - 2.0d * Offset);
            ctx.SetFill(BlueprintStyle.BluePrint);
            ctx.Fill();
            xc = Offset;
            ctx.SetFill(BlueprintStyle.HardWhite);
            ctx.MoveTo(0.0d, Offset);
            ctx.LineTo(Offset, Offset);
            for (int i = min; i <= max; i++)
            {
                ctx.LineTo(xc, h - Offset);
                ctx.LineTo(xc + ew, h - Offset);
                ctx.LineTo(xc + ew, Offset);
                xc += (1.0d + shaft) * ew;
                if (i < max)
                {
                    ctx.LineTo(xc, Offset);
                }
            }
            ctx.LineTo(w - Offset, Offset);
            ctx.LineTo(w, Offset);
            ctx.MoveTo(Offset, Offset);
            ctx.LineTo(Offset + (1.0d + shaft) * ew * (current - min), Offset);
            ctx.MoveTo(w - Offset, Offset);
            ctx.LineTo(w - Offset + (1.0d + shaft) * ew * (current - max), Offset);
            ctx.Stroke();
            xc = Offset + 0.5d * ew;
            IEnumerable <string> namei = this.names.Skip(this.min);
            IEnumerator <string> enume = namei.GetEnumerator();

            for (int i = min; i <= max && enume.MoveNext(); i++)
            {
                string name = enume.Current;
                if (name != null)
                {
                                        #if PANGO
                    Pango.Layout pglay = Pango.CairoHelper.CreateLayout(ctx);
                    pglay.SetText(name);
                    Pango.Rectangle ra, rb;
                    pglay.GetExtents(out ra, out rb);
                    double tew = rb.Width / 1024.0d;
                    double teh = rb.Height / 1024.0d;
                                        #else
                    TextExtents te  = ctx.TextExtents(name);
                    double      tew = te.Width;
                    double      teh = te.Height;
                                        #endif
                    ctx.MoveTo(xc - 0.5d * tew, 0.5d * (h + teh));
                    ctx.ShowText(name);
                    xc += (1.0d + shaft) * ew;
                }
            }
        }