Exemplo n.º 1
0
 protected void DrawAnchor(IDrawingToolkit tk, Area area)
 {
     if (ShowLinks && SupportsLinks)
     {
         anchor.Draw(tk, area);
     }
 }
Exemplo n.º 2
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            IContext ctx = tk.Context;

            if (!UpdateDrawArea(tk, area, Area))
            {
                return;
            }
            if (UseBackBufferSurface && backBufferSurface == null)
            {
                CreateBackBufferSurface();
            }
            tk.Context = ctx;
            tk.Begin();

            if (UseBackBufferSurface)
            {
                tk.DrawSurface(backBufferSurface, Position);
            }
            else
            {
                DrawBackbuffer(tk);
            }

            DrawSelectedTags(tk);
            DrawRecordTime(tk);
            DrawApplyButton(tk);
            DrawSelectionArea(tk);
            DrawAnchors(tk);
            tk.End();
        }
Exemplo n.º 3
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (!UpdateDrawArea(tk, area, Area))
            {
                return;
            }

            tk.Begin();

            tk.StrokeColor = App.Current.Style.ThemeBase;
            if (Selected)
            {
                tk.FillColor = App.Current.Style.ThemeContrastDisabled;
            }
            else
            {
                tk.FillColor = LineColor;
            }
            tk.LineWidth = 1;

            tk.DrawRoundedRectangle(new Point(StartX, OffsetY), StopX - StartX, Height, 5);

            if (ShowName)
            {
                tk.FontSize    = 16;
                tk.FontWeight  = FontWeight.Bold;
                tk.FillColor   = App.Current.Style.TextBaseDisabled;
                tk.StrokeColor = App.Current.Style.TextBaseDisabled;
                tk.DrawText(new Point(StartX, OffsetY), StopX - StartX,
                            Height - Sizes.TimelineLineSize,
                            TimeNode.Name);
            }
            tk.End();
        }
Exemplo n.º 4
0
        void DrawApplyButton(IDrawingToolkit tk)
        {
            Point  pos;
            double width, height;

            if (!ShowApplyButton || SelectedTags.Count == 0)
            {
                rects [applyRect] = null;
                return;
            }

            pos = new Point(Position.X + Width - Sizes.ButtonRecWidth,
                            Position.Y);
            width        = Sizes.ButtonRecWidth;
            height       = HeaderHeight;
            tk.FillColor = App.Current.Style.ThemeBase;
            tk.LineWidth = 0;
            tk.DrawRectangle(pos, width, height);
            tk.StrokeColor = App.Current.Style.ColorAccentSuccess;
            tk.FillColor   = App.Current.Style.ColorAccentSuccess;
            tk.FontSize    = 12;
            applyRect.Update(pos, width, height);
            buttonsRects [applyRect] = applyButton;
            pos = new Point(pos.X, pos.Y + 5);
            tk.DrawImage(pos, width, height - 10, applyImage, ScaleMode.AspectFit, true);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Draws the button.
 /// </summary>
 /// <param name="tk">Tk.</param>
 protected override void DrawButton(IDrawingToolkit tk)
 {
     if (!ShowTags)
     {
         base.DrawButton(tk);
     }
     else
     {
         tk.FillColor   = BackgroundColor;
         tk.StrokeColor = TextColor;
         tk.LineWidth   = 0;
         tk.DrawRectangle(Position, Width, Height);
         if (Active)
         {
             tk.FillColor = TextColor;
             tk.DrawRectangle(Position, Width, HeaderHeight);
         }
         if (Icon != null)
         {
             if (Active)
             {
                 tk.FillColor = BackgroundColor;
             }
             else
             {
                 tk.FillColor = TextColor;
             }
             tk.DrawImage(new Point(Position.X + 5, Position.Y + 5),
                          Sizes.ButtonHeaderWidth, Sizes.ButtonHeaderHeight, Icon, ScaleMode.AspectFit, true);
         }
     }
 }
Exemplo n.º 6
0
 protected void RenderBackground(IDrawingToolkit tk, Area backgroundArea, Color backgroundColor)
 {
     /* Background */
     tk.LineWidth = 0;
     tk.FillColor = backgroundColor;
     tk.DrawRectangle(backgroundArea.Start, backgroundArea.Width, backgroundArea.Height);
 }
Exemplo n.º 7
0
        void DrawEditButton(IDrawingToolkit tk)
        {
            Point  pos;
            Color  c;
            double width, height;

            if ((ButtonVM.Mode != DashboardMode.Edit || ShowLinks || !ViewModel.ShowSubcategories) && !Button.ShowSettingIcon)
            {
                return;
            }

            c      = App.Current.Style.ThemeBase;
            width  = Sizes.ButtonRecWidth;
            height = HeaderHeight;
            pos    = new Point(Position.X + Width - Sizes.ButtonRecWidth,
                               Position.Y + Height - height);
            tk.LineWidth   = 0;
            tk.FillColor   = new Color(c.R, c.G, c.B, 200);
            tk.StrokeColor = BackgroundColor;
            tk.DrawRectangle(pos, width, height);
            tk.StrokeColor = App.Current.Style.ColorAccentSuccess;
            tk.FillColor   = App.Current.Style.ColorAccentSuccess;
            tk.FontSize    = Sizes.ButtonButtonsFontSize;
            editRect.Update(pos, width, height);
            buttonsRects [editRect] = editbutton;
            pos = new Point(pos.X, pos.Y + 5);
            tk.DrawImage(pos, width, height - 10, editImage, ScaleMode.AspectFit, true);
        }
Exemplo n.º 8
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (!UpdateDrawArea (tk, area, Area)) {
                return;
            }

            tk.Begin ();

            tk.StrokeColor = Config.Style.PaletteBackgroundDark;
            if (Selected) {
                tk.FillColor = Config.Style.PaletteActive;
            } else {
                tk.FillColor = LineColor;
            }
            tk.LineWidth = 1;

            tk.DrawRoundedRectangle (new Point (StartX, OffsetY), StopX - StartX, Height, 5);

            if (ShowName) {
                tk.FontSize = 16;
                tk.FontWeight = FontWeight.Bold;
                tk.FillColor = Config.Style.PaletteActive;
                tk.StrokeColor = Config.Style.PaletteActive;
                tk.DrawText (new Point (StartX, OffsetY), StopX - StartX,
                    Height - StyleConf.TimelineLineSize,
                    TimeNode.Name);
            }
            tk.End ();
        }
Exemplo n.º 9
0
        protected void RenderSelection(IDrawingToolkit tk, IContext context,
                                       Area backgroundArea, Area cellArea, CellState state, bool isChildElement)
        {
            int   selectionLineWidth = 1;
            Point pos = new Point(backgroundArea.Left, backgroundArea.Start.Y + selectionLineWidth);

            if (isChildElement)
            {
                pos.X += LEFT_OFFSET + COLOR_RECTANGLE_WIDTH;
            }
            double width  = backgroundArea.Width - pos.X;
            double height = backgroundArea.Height - selectionLineWidth;

            tk.Context = context;
            tk.Begin();
            tk.FillColor   = Color.Transparent;
            tk.StrokeColor = Color.Transparent;
            if (state.HasFlag(CellState.Selected))
            {
                tk.StrokeColor = App.Current.Style.ColorPrimary;
            }
            tk.LineWidth = selectionLineWidth;
            tk.DrawRectangle(pos, width, height);
            tk.StrokeColor = App.Current.Style.TextBase;
        }
Exemplo n.º 10
0
        static void RenderTeam(IDrawingToolkit tk, Team team, Point imagePoint)
        {
            var shield = team.Shield ?? App.Current.ResourcesLocator.LoadIcon(Icons.DefaultShield);

            tk.DrawImage(imagePoint, Sizes.ListImageWidth, Sizes.ListImageWidth, shield,
                         ScaleMode.AspectFit);
        }
Exemplo n.º 11
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            tk.Begin();
            var center = new Point(Position.X + Width / 2, Position.Y + Height / 2);
            var radius = Math.Min(Width, Height) / 2;

            tk.FillColor   = BackgroundColor;
            tk.StrokeColor = BackgroundColor;
            tk.LineWidth   = 0;

            if (Image != null)
            {
                tk.DrawCircleImage(center, radius, Image);
            }
            else
            {
                tk.DrawCircle(center, radius);
                if (!String.IsNullOrEmpty(BackupText))
                {
                    tk.FontSize      = (int)(radius * 1.3);
                    tk.FontWeight    = FontWeight.Bold;
                    tk.FontAlignment = FontAlignment.Center;
                    tk.StrokeColor   = TextColor;
                    tk.DrawText(Position, Width, Height, BackupText [0].ToString());
                }
            }
            tk.End();
        }
Exemplo n.º 12
0
 public override void Draw(IDrawingToolkit tk, Area area)
 {
     foreach (ICanvasObject co in children)
     {
         co.Draw(tk, area);
     }
 }
Exemplo n.º 13
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Color lineColor;
            int   lineWidth = 4;

            if (!UpdateDrawArea(tk, area, Area))
            {
                return;
            }

            if (Selected)
            {
                lineColor = StyleConf.ActionLinkSelected;
            }
            else if (Highlighted)
            {
                lineColor = StyleConf.ActionLinkPrelight;
            }
            else
            {
                lineColor = StyleConf.ActionLinkNormal;
            }

            tk.Begin();
            tk.FillColor   = lineColor;
            tk.StrokeColor = lineColor;
            tk.LineWidth   = lineWidth;
            tk.LineStyle   = LineStyle.Normal;
            tk.DrawLine(line.Start, line.Stop);
            tk.FillColor = tk.StrokeColor = Config.Style.PaletteActive;
            tk.DrawCircle(line.Stop, 2);
            tk.End();
        }
Exemplo n.º 14
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double hs, vs;

            hs = Sizes.TimelineLabelHSpacing;
            vs = Sizes.TimelineLabelVSpacing;

            tk.Begin();
            tk.FillColor   = BackgroundColor;
            tk.StrokeColor = BackgroundColor;
            tk.LineWidth   = 0;
            tk.DrawRectangle(new Point(0, scrolledY), Width, Height);

            /* Draw a rectangle with the category color */
            tk.FillColor   = Color;
            tk.StrokeColor = Color;
            tk.DrawRectangle(new Point(hs, scrolledY + vs), RectSize, RectSize);

            /* Draw category name */
            tk.FontSlant     = FontSlant.Normal;
            tk.FontWeight    = DEFAULT_FONT_WEIGHT;
            tk.FontSize      = DEFAULT_FONT_SIZE;
            tk.FillColor     = App.Current.Style.TextBase;
            tk.FontAlignment = FontAlignment.Left;
            tk.StrokeColor   = App.Current.Style.TextBase;
            tk.DrawText(new Point(TextOffset, scrolledY), Width - TextOffset, Height, Name);
            //Draw playButton
            playButton.Draw(tk, area);
            tk.End();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Draw the specified tk and area.
        /// </summary>
        /// <param name="tk">Tk.</param>
        /// <param name="area">Area.</param>
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Color lineColor;
            int   lineWidth = 4;

            if (!UpdateDrawArea(tk, area, Area))
            {
                return;
            }

            if (Selected)
            {
                lineColor = App.Current.Style.ColorPrimary;
            }
            else if (Highlighted)
            {
                lineColor = App.Current.Style.ThemeDisabled;
            }
            else
            {
                lineColor = App.Current.Style.ThemeSecondary;
            }

            tk.Begin();
            tk.FillColor   = lineColor;
            tk.StrokeColor = lineColor;
            tk.LineWidth   = lineWidth;
            tk.LineStyle   = LineStyle.Normal;
            tk.DrawLine(line.Start, line.Stop);
            tk.FillColor = tk.StrokeColor = App.Current.Style.ThemeContrastDisabled;
            tk.DrawCircle(line.Stop, 2);
            tk.End();
        }
Exemplo n.º 16
0
        protected static Image RenderFrameDrawing(IDrawingToolkit tk, Area area, FrameDrawing fd, Image image)
        {
            Image    img;
            ISurface surface;

            Log.Debug("Rendering frame drawing with ROI: " + area);
            surface = tk.CreateSurface((int)area.Width, (int)area.Height);
            using (IContext c = surface.Context) {
                tk.Context = c;
                tk.TranslateAndScale(new Point(-area.Start.X, -area.Start.Y), new Point(1, 1));
                tk.DrawImage(image);
                foreach (Drawable d in fd.Drawables)
                {
                    ICanvasSelectableObject obj = CanvasFromDrawableObject(d);
                    obj.Draw(tk, null);
                    obj.Dispose();
                }
                if (fd.Freehand != null)
                {
                    tk.DrawImage(fd.Freehand);
                }
            }
            img = surface.Copy();
            surface.Dispose();
            return(img);
        }
Exemplo n.º 17
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (!UpdateDrawArea(tk, area, Area))
            {
                return;
            }

            tk.Begin();

            tk.StrokeColor = Config.Style.PaletteBackgroundDark;
            if (Selected)
            {
                tk.FillColor = Config.Style.PaletteActive;
            }
            else
            {
                tk.FillColor = LineColor;
            }
            tk.LineWidth = 1;

            tk.DrawRoundedRectangle(new Point(StartX, OffsetY), StopX - StartX, Height, 5);

            if (ShowName)
            {
                tk.FontSize    = 16;
                tk.FontWeight  = FontWeight.Bold;
                tk.FillColor   = Config.Style.PaletteActive;
                tk.StrokeColor = Config.Style.PaletteActive;
                tk.DrawText(new Point(StartX, OffsetY), StopX - StartX,
                            Height - StyleConf.TimelineLineSize,
                            TimeNode.Name);
            }
            tk.End();
        }
Exemplo n.º 18
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            ISurface leftGrabber  = trimGrabberLeftInactive;
            ISurface rightGrabber = trimGrabberRightInactive;

            if (!UpdateDrawArea(tk, area, Area))
            {
                return;
            }

            tk.Begin();

            if (ViewModel.SelectedGrabber == SelectionPosition.Left)
            {
                leftGrabber = trimGrabberLeftActive;
            }
            else if (ViewModel.SelectedGrabber == SelectionPosition.Right)
            {
                rightGrabber = trimGrabberRightActive;
            }

            // We need to add 2 pixels so that the Grabbers match perfectly
            tk.DrawSurface(new Point(StartX - 2, 0), GrabberSize, GrabberSize, leftGrabber, ScaleMode.AspectFit);
            tk.DrawSurface(new Point(StopX - Height + 2, 0), GrabberSize, GrabberSize, rightGrabber, ScaleMode.AspectFit);

            tk.End();
        }
Exemplo n.º 19
0
        public static void RenderSubstitution(Color color, Time evt, LMPlayer playerIn, LMPlayer playerOut, bool selected,
                                              bool isExpanded, IDrawingToolkit tk, IContext context, Area backgroundArea,
                                              Area cellArea, CellState state)
        {
            Point  selectPoint, textPoint, imagePoint, circlePoint;
            Point  inPoint, imgPoint, outPoint, timePoint;
            double textWidth;

            if (subsImage == null)
            {
                subsImage = App.Current.ResourcesLocator.LoadImage(StyleConf.SubsIcon);
            }
            tk.Context = context;
            tk.Begin();

            RenderTimelineEventBase(color, null, selected, null, tk, context, backgroundArea, cellArea, state,
                                    out selectPoint, out textPoint, out imagePoint, out circlePoint, out textWidth);
            inPoint  = textPoint;
            imgPoint = new Point(textPoint.X + StyleConf.ListImageWidth + StyleConf.ListRowSeparator, textPoint.Y);
            outPoint = new Point(imgPoint.X + 20 + StyleConf.ListRowSeparator, imgPoint.Y);
            RenderPlayer(tk, playerIn, inPoint);
            tk.DrawImage(imgPoint, 20, cellArea.Height, subsImage, ScaleMode.AspectFit);
            RenderPlayer(tk, playerOut, outPoint);

            timePoint        = new Point(outPoint.X + StyleConf.ListImageWidth + StyleConf.ListRowSeparator, textPoint.Y);
            tk.FontSize      = 10;
            tk.FontWeight    = FontWeight.Normal;
            tk.StrokeColor   = App.Current.Style.PaletteSelected;
            tk.FontAlignment = FontAlignment.Left;
            tk.DrawText(timePoint, 100, cellArea.Height, evt.ToSecondsString());
            RenderSeparationLine(tk, context, backgroundArea);
            tk.End();
        }
Exemplo n.º 20
0
        protected void DrawBackground(IDrawingToolkit tk)
        {
            tk.FillColor = BackgroundColor;
            tk.DrawRectangle(Position, Width, Height);

            if (Active && BackgroundImageActive != null)
            {
                tk.DrawImage(Position, Width, Height, BackgroundImageActive,
                             ScaleMode.AspectFit);
            }
            else if (Insensitive && BackgroundImageInsensitive != null)
            {
                tk.DrawImage(Position, Width, Height, BackgroundImageInsensitive,
                             ScaleMode.AspectFit);
            }
            else if (Highlighted && BackgroundImageHighlighted != null)
            {
                tk.DrawImage(Position, Width, Height, BackgroundImageHighlighted,
                             ScaleMode.AspectFit);
            }
            else if (BackgroundImage != null)
            {
                tk.DrawImage(Position, Width, Height, BackgroundImage,
                             ScaleMode.AspectFit);
            }
        }
Exemplo n.º 21
0
        void DrawEditButton(IDrawingToolkit tk)
        {
            Point  pos;
            Color  c;
            double width, height;

            if (Mode != DashboardMode.Edit || ShowLinks || !Button.ShowSubcategories)
            {
                return;
            }

            c      = Config.Style.PaletteBackgroundDark;
            width  = StyleConf.ButtonRecWidth;
            height = HeaderHeight;
            pos    = new Point(Position.X + Width - StyleConf.ButtonRecWidth,
                               Position.Y + Height - height);
            tk.LineWidth   = 0;
            tk.FillColor   = new Color(c.R, c.G, c.B, 200);
            tk.StrokeColor = BackgroundColor;
            tk.DrawRectangle(pos, width, height);
            tk.StrokeColor = Color.Green1;
            tk.FillColor   = Color.Green1;
            tk.FontSize    = StyleConf.ButtonButtonsFontSize;
            editRect.Update(pos, width, height);
            buttonsRects [editRect] = editbutton;
            pos = new Point(pos.X, pos.Y + 5);
            tk.DrawImage(pos, width, height - 10, editImage, true, true);
        }
Exemplo n.º 22
0
        protected void DrawButton(IDrawingToolkit tk)
        {
            Color front, back;

            if (Active)
            {
                tk.LineWidth = StyleConf.ButtonLineWidth;
                front        = BackgroundColor;
                back         = TextColor;
            }
            else
            {
                tk.LineWidth = 0;
                front        = TextColor;
                back         = BackgroundColor;
            }
            tk.FillColor   = back;
            tk.StrokeColor = front;
            tk.DrawRectangle(Position, Width, Height);
            if (Icon != null)
            {
                tk.FillColor = front;
                tk.DrawImage(new Point(Position.X + 5, Position.Y + 5),
                             Icon.Width, Icon.Height, Icon, false, true);
            }
        }
Exemplo n.º 23
0
 public static Image RenderFrameDrawingToImage(IDrawingToolkit tk, Image image, FrameDrawing fd)
 {
     Area area = fd.RegionOfInterest;
     if (area == null || area.Empty)
         area = new Area (0, 0, image.Width, image.Height);
     return RenderFrameDrawing (tk, area, fd, image);
 }
Exemplo n.º 24
0
        void DrawApplyButton(IDrawingToolkit tk)
        {
            Point  pos;
            double width, height;

            if (!ShowApplyButton || SelectedTags.Count == 0)
            {
                rects [applyRect] = null;
                return;
            }

            pos = new Point(Position.X + Width - StyleConf.ButtonRecWidth,
                            Position.Y);
            width        = StyleConf.ButtonRecWidth;
            height       = HeaderHeight;
            tk.FillColor = Config.Style.PaletteBackgroundDark;
            tk.LineWidth = 0;
            tk.DrawRectangle(pos, width, height);
            tk.StrokeColor = Color.Green1;
            tk.FillColor   = Color.Green1;
            tk.FontSize    = 12;
            applyRect.Update(pos, width, height);
            buttonsRects [applyRect] = applyButton;
            pos = new Point(pos.X, pos.Y + 5);
            tk.DrawImage(pos, width, height - 10, applyImage, true, true);
        }
Exemplo n.º 25
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (BenchPlayers == null || Position == null)
            {
                return;
            }
            tk.Begin();
            tk.TranslateAndScale(Position, new Point(1, 1));
            tk.LineStyle   = LineStyle.Dashed;
            tk.LineWidth   = Config.Style.BenchLineWidth;
            tk.StrokeColor = Config.Style.PaletteActive;
            tk.FillColor   = null;
            tk.DrawRectangle(new Point(0, 0), Width, Height);
            tk.LineStyle = LineStyle.Normal;

            foreach (PlayerObject po in BenchPlayers)
            {
                po.Playing          = false;
                po.SubstitutionMode = SubstitutionMode;
                po.Size             = PlayersSize;
                po.Draw(tk, area);
            }

            tk.End();
        }
Exemplo n.º 26
0
 new void DrawButton(IDrawingToolkit tk)
 {
     if (!ShowTags)
     {
         base.DrawButton(tk);
     }
     else
     {
         tk.FillColor   = BackgroundColor;
         tk.StrokeColor = TextColor;
         tk.LineWidth   = 0;
         tk.DrawRectangle(Position, Width, Height);
         if (Active)
         {
             tk.FillColor = TextColor;
             tk.DrawRectangle(Position, Width, HeaderHeight);
         }
         if (Icon != null)
         {
             if (Active)
             {
                 tk.FillColor = BackgroundColor;
             }
             else
             {
                 tk.FillColor = TextColor;
             }
             tk.DrawImage(new Point(Position.X + 5, Position.Y + 5),
                          Icon.Width, Icon.Height, Icon, false, true);
         }
     }
 }
Exemplo n.º 27
0
 public override void Draw(IDrawingToolkit tk, Area area)
 {
     tk.Begin();
     tk.TranslateAndScale(Position, new Point(1, 1));
     if (background != null)
     {
         tk.DrawImage(background);
     }
     if (HomePlayingPlayers != null)
     {
         foreach (PlayerObject po in HomePlayingPlayers)
         {
             po.Playing          = true;
             po.SubstitutionMode = SubstitutionMode;
             po.Size             = playerSize;
             po.Draw(tk, area);
         }
     }
     if (AwayPlayingPlayers != null)
     {
         foreach (PlayerObject po in AwayPlayingPlayers)
         {
             po.Playing          = true;
             po.SubstitutionMode = SubstitutionMode;
             po.Size             = playerSize;
             po.Draw(tk, area);
         }
     }
     tk.End();
 }
Exemplo n.º 28
0
 protected void DrawCenterSelection(IDrawingToolkit tk, Point p)
 {
     tk.StrokeColor = tk.FillColor = Constants.SELECTION_INDICATOR_COLOR;
     tk.LineWidth   = 0;
     tk.LineStyle   = LineStyle.Normal;
     tk.DrawCircle(p, selectionSize);
 }
Exemplo n.º 29
0
        static void RenderBackgroundAndText(bool isExpanded, IDrawingToolkit tk, Area backgroundArea, Point textP, double textW, string text)
        {
            Color textColor, backgroundColor;

            /* Background */
            tk.LineWidth = 0;
            if (isExpanded)
            {
                backgroundColor = App.Current.Style.PaletteBackgroundLight;
                textColor       = App.Current.Style.PaletteSelected;
            }
            else
            {
                backgroundColor = App.Current.Style.PaletteBackground;
                textColor       = App.Current.Style.PaletteWidgets;
            }
            tk.FillColor = backgroundColor;
            tk.DrawRectangle(backgroundArea.Start, backgroundArea.Width, backgroundArea.Height);

            /* Text */
            tk.StrokeColor   = textColor;
            tk.FontSize      = StyleConf.ListTextFontSize;
            tk.FontWeight    = FontWeight.Bold;
            tk.FontAlignment = FontAlignment.Left;
            tk.DrawText(textP, textW, backgroundArea.Height, text);
        }
Exemplo n.º 30
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double start, stop;
            int    lineWidth = StyleConf.TimelineLineSize;

            if (!UpdateDrawArea(tk, area, Area))
            {
                return;
            }
            ;

            tk.Begin();

            start = StartX;
            stop  = StopX;

            if (stop - start <= lineWidth)
            {
                DrawBorders(tk, start, stop, lineWidth);
                DrawLine(tk, start, stop, lineWidth);
            }
            else
            {
                DrawLine(tk, start, stop, lineWidth);
                DrawBorders(tk, start, stop, lineWidth);
            }
            if (Selected)
            {
                tk.DrawSurface(SelectionLeft, new Point(start - SelectionLeft.Width / 2, OffsetY));
                tk.DrawSurface(SelectionRight, new Point(stop - SelectionRight.Width / 2, OffsetY));
            }
            tk.End();
        }
Exemplo n.º 31
0
        void DrawBorders(IDrawingToolkit tk, double start, double stop, int lineWidth)
        {
            TeamType team;
            Color    color;
            double   y1, y2;

            tk.LineWidth = lineWidth;
            team         = Project.EventTaggedTeam(Event);
            if (team == TeamType.LOCAL)
            {
                color = Project.LocalTeamTemplate.Color;
            }
            else if (team == TeamType.VISITOR)
            {
                color = Project.VisitorTeamTemplate.Color;
            }
            else
            {
                color = Config.Style.PaletteWidgets;
            }
            tk.FillColor   = color;
            tk.StrokeColor = color;
            y1             = OffsetY + 6;
            y2             = OffsetY + Height - 6;
            tk.DrawLine(new Point(start, y1), new Point(start, y2));
            tk.DrawLine(new Point(stop, y1), new Point(stop, y2));
        }
Exemplo n.º 32
0
        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle backgroundArea,
                                       Gdk.Rectangle cellArea, Gdk.Rectangle exposeArea, CellRendererState flags)
        {
            IDrawingToolkit tk = App.Current.DrawingToolkit;

            using (IContext context = new CairoContext(window)) {
                cellWidth  = cellArea.Width;
                cellHeight = cellArea.Height;

                Point pos = new Point(cellArea.X + backgroundArea.Width / 2 - BUTTON_WIDTH / 2,
                                      cellArea.Y + Sizes.FilterTreeViewOnlyTopOffset);

                Point imagePos = new Point(pos.X + SPACING, pos.Y + Sizes.FilterTreeViewOnlyTopOffset);

                //Get the offset to properly calculate if needs tooltip or redraw
                offsetX = pos.X - backgroundArea.X;
                offsetY = pos.Y - backgroundArea.Y;

                tk.Context = context;
                tk.Begin();
                tk.StrokeColor = App.Current.Style.ThemeBase;
                tk.FillColor   = Color.Transparent;
                if (flags.HasFlag(CellRendererState.Prelit) && cursor.IsInsideArea(pos, BUTTON_WIDTH, BUTTON_HEIGHT))
                {
                    tk.StrokeColor = App.Current.Style.ColorPrimary;
                    tk.LineWidth   = LINE_WIDTH;
                }

                tk.DrawRectangle(pos, BUTTON_WIDTH, BUTTON_HEIGHT);
                tk.DrawImage(imagePos, BUTTON_WIDTH - (SPACING * 2), BUTTON_HEIGHT - (Sizes.FilterTreeViewOnlyTopOffset * 2), Icon, ScaleMode.AspectFit);
                tk.End();
                tk.Context = null;
            }
        }
Exemplo n.º 33
0
        public static void Render(object item, int count, bool isExpanded, IDrawingToolkit tk,
		                           IContext context, Area backgroundArea, Area cellArea, CellState state)
        {
            if (item is EventType) {
                RenderAnalysisCategory (item as EventType, count, isExpanded, tk,
                    context, backgroundArea, cellArea);
            } else if (item is SubstitutionEvent) {
                SubstitutionEvent s = item as SubstitutionEvent;
                RenderSubstitution (s.Color, s.EventTime, s.In, s.Out, s.Selected, isExpanded, tk, context,
                    backgroundArea, cellArea, state);
            } else if (item is TimelineEvent) {
                TimelineEvent p = item as TimelineEvent;
                RenderPlay (p.Color, p.Miniature, p.Players, p.Selected, p.Description, count, isExpanded, tk,
                    context, backgroundArea, cellArea, state);
            } else if (item is Player) {
                RenderPlayer (item as Player, count, isExpanded, tk, context, backgroundArea, cellArea);
            } else if (item is Playlist) {
                RenderPlaylist (item as Playlist, count, isExpanded, tk, context, backgroundArea, cellArea);
            } else if (item is PlaylistPlayElement) {
                PlaylistPlayElement p = item as PlaylistPlayElement;
                RenderPlay (p.Play.EventType.Color, p.Miniature, null, p.Selected, p.Description, count, isExpanded, tk,
                    context, backgroundArea, cellArea, state);
            } else if (item is IPlaylistElement) {
                IPlaylistElement p = item as IPlaylistElement;
                RenderPlay (Config.Style.PaletteActive, p.Miniature, null, p.Selected, p.Description,
                    count, isExpanded, tk, context, backgroundArea, cellArea, state);
            } else {
                Log.Error ("No renderer for type " + item.GetType ());
            }
        }
Exemplo n.º 34
0
        public static void RenderAnalysisCategory(EventType cat, int count, bool isExpanded, IDrawingToolkit tk,
		                                           IContext context, Area backgroundArea, Area cellArea)
        {
            Point textP = new Point (StyleConf.ListTextOffset, cellArea.Start.Y);
            tk.Context = context;
            tk.Begin ();
            RenderBackgroundAndText (isExpanded, tk, backgroundArea, textP, cellArea.Width - textP.X, cat.Name);
            RenderCount (isExpanded, cat.Color, count, tk, backgroundArea, cellArea);
            RenderSeparationLine (tk, context, backgroundArea);
            tk.End ();
        }
Exemplo n.º 35
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Color front, back;
            int width;

            if (!UpdateDrawArea (tk, area, Area)) {
                return;
            }
            tk.Begin ();

            if (Active) {
                tk.LineWidth = StyleConf.ButtonLineWidth;
                tk.StrokeColor = BackgroundColor;
                tk.FillColor = TextColor;
            } else {
                tk.LineWidth = 0;
                tk.StrokeColor = TextColor;
                tk.FillColor = BackgroundColor;
            }

            /* Draw Shape */
            switch (Button.PenaltyCard.Shape) {
            case CardShape.Rectangle:
                tk.DrawRoundedRectangle (Button.Position, Button.Width, Button.Height, 3);
                break;
            case CardShape.Circle:
                tk.DrawCircle (new Point (Button.Position.X + Button.Width / 2,
                    Button.Position.Y + Button.Height / 2),
                    Math.Min (Button.Width, Button.Height) / 2);
                break;
            case CardShape.Triangle:
                tk.DrawTriangle (new Point (Button.Position.X + Button.Width / 2, Button.Position.Y),
                    Button.Width, Button.Height, SelectionPosition.Top);
                break;
            }

            /* Draw header */
            tk.LineWidth = 2;
            tk.FontSize = StyleConf.ButtonNameFontSize;
            tk.FontWeight = FontWeight.Light;
            tk.FontAlignment = FontAlignment.Center;
            if (Recording) {
                tk.DrawText (Position, Button.Width, Button.Height, (CurrentTime - Start).ToSecondsString ());
            } else {
                tk.DrawText (Position, Button.Width, Button.Height, Button.PenaltyCard.Name);
            }
            DrawSelectionArea (tk);
            if (ShowLinks) {
                GetAnchor (null).Draw (tk, area);
            }
            tk.End ();
        }
Exemplo n.º 36
0
        protected override void DrawBorders(IDrawingToolkit tk, double start, double stop, int lineWidth)
        {
            Color color;
            double y1, y2;

            tk.LineWidth = lineWidth;
            List<SportsTeam> teams = (Event as TimelineEventLongoMatch).TaggedTeams;
            if (teams.Count == 1) {
                color = teams [0].Color;
            } else {
                color = App.Current.Style.PaletteWidgets;
            }

            tk.FillColor = color;
            tk.StrokeColor = color;
            y1 = OffsetY + 6;
            y2 = OffsetY + Height - 6;
            tk.DrawLine (new Point (start, y1), new Point (start, y2));
            tk.DrawLine (new Point (stop, y1), new Point (stop, y2));
        }
Exemplo n.º 37
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            tk.Begin ();
            var center = new Point (Position.X + Width / 2, Position.Y + Height / 2);
            var radius = Math.Min (Width, Height) / 2;

            tk.FillColor = BackgroundColor;
            tk.StrokeColor = BackgroundColor;
            tk.LineWidth = 0;

            if (Image != null) {
                tk.DrawCircleImage (center, radius, Image);
            } else {
                tk.DrawCircle (center, radius);
                if (!String.IsNullOrEmpty (BackupText)) {
                    tk.FontSize = (int)(radius * 1.3);
                    tk.FontWeight = FontWeight.Bold;
                    tk.FontAlignment = FontAlignment.Center;
                    tk.StrokeColor = TextColor;
                    tk.DrawText (Position, Width, Height, BackupText [0].ToString ());
                }
            }
            tk.End ();
        }
Exemplo n.º 38
0
        static void RenderCount(bool isExpanded, Color color, int count, IDrawingToolkit tk, Area backgroundArea, Area cellArea)
        {
            double countX1, countX2, countY, countYC;
            Point arrowY;
            ISurface arrow;

            countX1 = cellArea.Start.X + StyleConf.ListRowSeparator + StyleConf.ListCountRadio;
            countX2 = countX1 + StyleConf.ListCountWidth;
            countYC = backgroundArea.Start.Y + backgroundArea.Height / 2;
            countY = countYC - StyleConf.ListCountRadio;
            if (count > 0) {
                if (!isExpanded) {
                    if (ArrowRight == null) {
                        ArrowRight = Config.DrawingToolkit.CreateSurface (Path.Combine (Config.IconsDir,
                            StyleConf.ListArrowRightPath));
                    }
                    arrow = ArrowRight;
                    arrowY = new Point (cellArea.Start.X + 1,
                        cellArea.Start.Y + cellArea.Height / 2 - arrow.Height / 2);
                } else {
                    if (ArrowDown == null) {
                        ArrowDown = Config.DrawingToolkit.CreateSurface (Path.Combine (Config.IconsDir,
                            StyleConf.ListArrowDownPath));
                    }
                    arrow = ArrowDown;
                    arrowY = new Point (cellArea.Start.X + 1, cellArea.Start.Y + cellArea.Height / 2);
                }
                tk.DrawSurface (arrow, arrowY);
            }

            tk.LineWidth = 0;
            tk.FillColor = color;
            tk.DrawCircle (new Point (countX1, countYC), StyleConf.ListCountRadio);
            tk.DrawCircle (new Point (countX2, countYC), StyleConf.ListCountRadio);
            tk.DrawRectangle (new Point (countX1, countY), StyleConf.ListCountWidth, 2 * StyleConf.ListCountRadio);
            tk.StrokeColor = Config.Style.PaletteBackgroundDark;
            tk.FontAlignment = FontAlignment.Center;
            tk.FontWeight = FontWeight.Bold;
            tk.FontSize = 14;
            tk.DrawText (new Point (countX1, countY), StyleConf.ListCountWidth,
                2 * StyleConf.ListCountRadio, count.ToString ());
        }
Exemplo n.º 39
0
        static void RenderBackgroundAndText(bool isExpanded, IDrawingToolkit tk, Area backgroundArea, Point textP, double textW, string text)
        {
            Color textColor, backgroundColor;

            /* Background */
            tk.LineWidth = 0;
            if (isExpanded) {
                backgroundColor = Config.Style.PaletteBackgroundLight;
                textColor = Config.Style.PaletteSelected;
            } else {
                backgroundColor = Config.Style.PaletteBackground;
                textColor = Config.Style.PaletteWidgets;
            }
            tk.FillColor = backgroundColor;
            tk.DrawRectangle (backgroundArea.Start, backgroundArea.Width, backgroundArea.Height);

            /* Text */
            tk.StrokeColor = textColor;
            tk.FontSize = 14;
            tk.FontWeight = FontWeight.Bold;
            tk.FontAlignment = FontAlignment.Left;
            tk.DrawText (textP, textW, backgroundArea.Height, text);
        }
Exemplo n.º 40
0
        public static void RenderSubstitution(Color color, Time evt, Player playerIn, Player playerOut, bool selected,
		                                       bool isExpanded, IDrawingToolkit tk, IContext context, Area backgroundArea,
		                                       Area cellArea, CellState state)
        {
            Point selectPoint, textPoint, imagePoint, circlePoint;
            Point inPoint, imgPoint, outPoint, timePoint;
            double textWidth;

            if (subsImage == null) {
                subsImage = new Image (Path.Combine (Config.IconsDir, StyleConf.SubsIcon));
            }
            tk.Context = context;
            tk.Begin ();

            RenderTimelineEventBase (color, null, selected, null, tk, context, backgroundArea, cellArea, state,
                out selectPoint, out textPoint, out imagePoint, out circlePoint, out textWidth);
            inPoint = textPoint;
            imgPoint = new Point (textPoint.X + StyleConf.ListImageWidth + StyleConf.ListRowSeparator, textPoint.Y);
            outPoint = new Point (imgPoint.X + 20 + StyleConf.ListRowSeparator, imgPoint.Y);
            RenderPlayer (tk, playerIn, inPoint);
            tk.DrawImage (imgPoint, 20, cellArea.Height, subsImage, true);
            RenderPlayer (tk, playerOut, outPoint);

            timePoint = new Point (outPoint.X + StyleConf.ListImageWidth + StyleConf.ListRowSeparator, textPoint.Y);
            tk.FontSize = 10;
            tk.FontWeight = FontWeight.Normal;
            tk.StrokeColor = Config.Style.PaletteSelected;
            tk.FontAlignment = FontAlignment.Left;
            tk.DrawText (timePoint, 100, cellArea.Height, evt.ToSecondsString ());
            RenderSeparationLine (tk, context, backgroundArea);
            tk.End ();
        }
Exemplo n.º 41
0
        protected override void DrawBackground(IDrawingToolkit tk, Area area)
        {
            base.DrawBackground (tk, area);

            if (ShowLine) {
                // We want the background line and overlay to use the same starting point although they have different sizes.
                double linepos = OffsetY + Height / 2 + StyleConf.TimelineLineSize / 2;
                tk.FillColor = Config.Style.PaletteBackgroundDark;
                tk.StrokeColor = Config.Style.PaletteBackgroundDark;
                tk.LineWidth = StyleConf.TimelineBackgroundLineSize;
                tk.DrawLine (new Point (0, linepos),
                    new Point (Width, linepos));
            }
        }
Exemplo n.º 42
0
        void DrawBorders(IDrawingToolkit tk, double start, double stop, int lineWidth)
        {
            TeamType team;
            Color color;
            double y1, y2;

            tk.LineWidth = lineWidth;
            team = Project.EventTaggedTeam (Event);
            if (team == TeamType.LOCAL) {
                color = Project.LocalTeamTemplate.Color;
            } else if (team == TeamType.VISITOR) {
                color = Project.VisitorTeamTemplate.Color;
            } else {
                color = Config.Style.PaletteWidgets;
            }
            tk.FillColor = color;
            tk.StrokeColor = color;
            y1 = OffsetY + 6;
            y2 = OffsetY + Height - 6;
            tk.DrawLine (new Point (start, y1), new Point (start, y2));
            tk.DrawLine (new Point (stop, y1), new Point (stop, y2));
        }
Exemplo n.º 43
0
        public static void RenderPlay(Color color, Image ss, List<Player> players, bool selected, string desc,
		                               int count, bool isExpanded, IDrawingToolkit tk,
		                               IContext context, Area backgroundArea, Area cellArea, CellState state)
        {
            Point selectPoint, textPoint, imagePoint, circlePoint;
            double textWidth;

            tk.Context = context;
            tk.Begin ();

            RenderTimelineEventBase (color, ss, selected, desc, tk, context, backgroundArea, cellArea, state,
                out selectPoint, out textPoint, out imagePoint, out circlePoint, out textWidth);

            imagePoint.X += StyleConf.ListImageWidth + StyleConf.ListRowSeparator;
            if (players != null && players.Count > 0) {
                foreach (Player p in players) {
                    RenderPlayer (tk, p, imagePoint);
                    imagePoint.X += StyleConf.ListImageWidth + StyleConf.ListRowSeparator;
                }
            }
            RenderSeparationLine (tk, context, backgroundArea);
            tk.End ();
        }
Exemplo n.º 44
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Point zero, start, p;
            double size, scale;
            ISurface arrowin, arrowout;

            if (Player == null)
                return;

            zero = new Point (0, 0);
            size = StyleConf.PlayerSize;
            scale = (double)Width / size;

            if (Team == TeamType.LOCAL) {
                arrowin = ArrowIn;
                arrowout = ArrowOut;
            } else {
                arrowin = ArrowOut;
                arrowout = ArrowIn;
            }

            tk.Begin ();
            start = new Point (Size / 2, Size / 2);
            tk.TranslateAndScale (Center - start, new Point (scale, scale));

            if (!UpdateDrawArea (tk, area, new Area (zero, size, size))) {
                tk.End ();
                return;
            }

            /* Background */
            tk.FillColor = App.Current.Style.PaletteBackgroundDark;
            tk.LineWidth = 0;
            tk.DrawRectangle (zero, StyleConf.PlayerSize, StyleConf.PlayerSize);

            /* Image */
            if (Player.Photo != null) {
                tk.DrawImage (zero, size, size, Player.Photo, ScaleMode.AspectFit);
            } else {
                tk.DrawSurface (zero, StyleConf.PlayerSize, StyleConf.PlayerSize, PlayerObject.DefaultPhoto, ScaleMode.AspectFit);
            }

            /* Bottom line */
            p = new Point (0, size - StyleConf.PlayerLineWidth);
            tk.FillColor = Color;
            tk.DrawRectangle (p, size, 3);

            /* Draw Arrow */
            if (SubstitutionMode && (Highlighted || Active)) {
                ISurface arrow;
                Point ap;

                if (Playing) {
                    arrow = arrowout;
                } else {
                    arrow = arrowin;
                }
                ap = new Point (StyleConf.PlayerArrowX, StyleConf.PlayerArrowY);
                tk.DrawRectangle (ap, StyleConf.PlayerArrowSize, StyleConf.PlayerArrowSize);
                tk.DrawSurface (arrow, ap);
            }

            /* Draw number */
            p = new Point (StyleConf.PlayerNumberX, StyleConf.PlayerNumberY);
            tk.FillColor = Color;
            tk.DrawRectangle (p, StyleConf.PlayerNumberSize, StyleConf.PlayerNumberSize);

            tk.FillColor = Color.White;
            tk.StrokeColor = Color.White;
            tk.FontAlignment = FontAlignment.Center;
            tk.FontWeight = FontWeight.Normal;
            if (Player.Number >= 100) {
                tk.FontSize = 12;
            } else {
                tk.FontSize = 16;
            }
            tk.DrawText (p, StyleConf.PlayerNumberSize, StyleConf.PlayerNumberSize,
                Player.Number.ToString ());

            if (Active) {
                Color c = Color.Copy ();
                c.A = (byte)(c.A * 60 / 100);
                tk.FillColor = c;
                tk.DrawRectangle (zero, size, size);
            }

            tk.End ();
        }
Exemplo n.º 45
0
 public override void Draw(IDrawingToolkit tk, Area area)
 {
     tk.Begin ();
     tk.TranslateAndScale (Position, new Point (1, 1));
     if (background != null) {
         tk.DrawImage (background);
     }
     if (HomePlayingPlayers != null) {
         foreach (PlayerObject po in HomePlayingPlayers) {
             po.Playing = true;
             po.SubstitutionMode = SubstitutionMode;
             po.Size = playerSize;
             po.Draw (tk, area);
         }
     }
     if (AwayPlayingPlayers != null) {
         foreach (PlayerObject po in AwayPlayingPlayers) {
             po.Playing = true;
             po.SubstitutionMode = SubstitutionMode;
             po.Size = playerSize;
             po.Draw (tk, area);
         }
     }
     tk.End ();
 }
Exemplo n.º 46
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            ISurface linkIn, linkOut;

            if (Highlighted) {
                linkIn = InPrelightIcon;
                linkOut = OutPrelightIcon;
            } else {
                linkIn = InIcon;
                linkOut = OutIcon;
            }

            tk.Begin ();
            tk.DrawSurface (linkIn, new Point (In.X - iconWidth / 2,
                In.Y - iconHeight / 2));
            tk.DrawSurface (linkOut, new Point (Out.X - iconWidth / 2,
                In.Y - iconHeight / 2));
            tk.End ();
        }
Exemplo n.º 47
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (!UpdateDrawArea (tk, area, Area)) {
                return;
            }

            base.Draw (tk, area);

            tk.Begin ();

            cancelRect = new Rectangle (
                new Point ((Position.X + Width) - StyleConf.ButtonRecWidth, Position.Y),
                StyleConf.ButtonRecWidth, HeaderHeight);

            if (Active && Mode != DashboardMode.Edit) {
                tk.LineWidth = StyleConf.ButtonLineWidth;
                tk.StrokeColor = Button.BackgroundColor;
                tk.FillColor = Button.BackgroundColor;
                tk.FontWeight = FontWeight.Normal;
                tk.FontSize = StyleConf.ButtonHeaderFontSize;
                tk.FontAlignment = FontAlignment.Left;
                tk.DrawText (new Point (Position.X + TextHeaderX, Position.Y),
                    Button.Width - TextHeaderX, iconImage.Height, Button.Timer.Name);
                tk.FontWeight = FontWeight.Bold;
                tk.FontSize = StyleConf.ButtonTimerFontSize;
                tk.FontAlignment = FontAlignment.Center;
                tk.DrawText (new Point (Position.X, Position.Y + iconImage.Height),
                    Button.Width, Button.Height - iconImage.Height,
                    PartialTime.ToSecondsString (), false, true);

                tk.FillColor = tk.StrokeColor = BackgroundColor;
                tk.DrawRectangle (cancelRect.TopLeft, cancelRect.Width, cancelRect.Height);
                tk.StrokeColor = TextColor;
                tk.FillColor = TextColor;
                tk.DrawImage (new Point (cancelRect.TopLeft.X, cancelRect.TopLeft.Y + 5),
                    cancelRect.Width, cancelRect.Height - 10, cancelImage, true, true);
            } else {
                Text = Button.Name;
                DrawText (tk);
                Text = null;
            }

            if (TeamImage != null) {
                tk.DrawImage (new Point (Position.X + Width - 40, Position.Y + 5), 40,
                    iconImage.Height, TeamImage, true);
            }
            tk.End ();
        }
Exemplo n.º 48
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (BenchPlayers == null || Position == null) {
                return;
            }
            tk.Begin ();
            tk.TranslateAndScale (Position, new Point (1, 1));
            tk.LineStyle = LineStyle.Dashed;
            tk.LineWidth = App.Current.Style.BenchLineWidth;
            tk.StrokeColor = App.Current.Style.PaletteActive;
            tk.FillColor = null;
            tk.DrawRectangle (new Point (0, 0), Width, Height);
            tk.LineStyle = LineStyle.Normal;

            foreach (SportsPlayerObject po in BenchPlayers) {
                po.Playing = false;
                po.SubstitutionMode = SubstitutionMode;
                po.Size = PlayersSize;
                po.Draw (tk, area);
            }

            tk.End ();
        }
Exemplo n.º 49
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double position;
            List<TimeNodeObject> selected;

            selected = new List<TimeNodeObject> ();

            if (!UpdateDrawArea (tk, area, new Area (new Point (0, OffsetY), Width, Height))) {
                return;
            }
            ;

            tk.Begin ();
            DrawBackground (tk, area);
            foreach (TimeNodeObject p in nodes) {
                if (!TimeNodeObjectIsVisible (p))
                    continue;
                if (p.Selected) {
                    selected.Add (p);
                    continue;
                }
                p.OffsetY = OffsetY;
                p.Draw (tk, area);
            }
            foreach (TimeNodeObject p in selected) {
                p.OffsetY = OffsetY;
                p.Draw (tk, area);
            }

            tk.FillColor = Config.Style.PaletteTool;
            tk.StrokeColor = Config.Style.PaletteTool;
            tk.LineWidth = Constants.TIMELINE_LINE_WIDTH;
            position = Utils.TimeToPos (CurrentTime, secondsPerPixel);
            tk.DrawLine (new Point (position, OffsetY),
                new Point (position, OffsetY + Height));

            tk.End ();
        }
Exemplo n.º 50
0
        protected virtual void DrawBackground(IDrawingToolkit tk, Area area)
        {
            tk.FillColor = BackgroundColor;
            tk.StrokeColor = BackgroundColor;
            tk.LineWidth = 0;

            tk.DrawRectangle (new Point (area.Start.X, OffsetY), area.Width, Height);
        }
Exemplo n.º 51
0
 static void RenderPlayer(IDrawingToolkit tk, Player p, Point imagePoint)
 {
     PlayerObject po = new PlayerObject (p);
     po.Position = new Point (imagePoint.X + StyleConf.ListImageWidth / 2, imagePoint.Y + StyleConf.ListImageWidth / 2);
     po.Size = StyleConf.ListImageWidth - 2;
     tk.End ();
     po.Draw (tk, null);
     tk.Begin ();
     po.Dispose ();
 }
Exemplo n.º 52
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double width, height;

            /* Compute how we should scale and translate to fit the widget
             * in the designated area */
            width = homeBench.Width * NTeams + field.Width +
            2 * NTeams * App.Current.Style.TeamTaggerBenchBorder;
            height = field.Height;
            Image.ScaleFactor ((int)width, (int)height, (int)Width,
                (int)Height - BUTTONS_HEIGHT, ScaleMode.AspectFit,
                out scaleX, out scaleY, out offset);
            offset.Y += BUTTONS_HEIGHT;
            tk.Begin ();
            tk.Clear (BackgroundColor);

            /* Draw substitution buttons */
            if (subPlayers.Visible) {
                subPlayers.Position = new Point (Width / 2 - BUTTONS_WIDTH / 2,
                    offset.Y - BUTTONS_HEIGHT);
                subPlayers.Width = BUTTONS_WIDTH;
                subPlayers.Height = BUTTONS_HEIGHT;
                subPlayers.Draw (tk, area);
            }
            if (homeButton.Visible) {
                /* Draw local team button */
                double x = Position.X + App.Current.Style.TeamTaggerBenchBorder * scaleX + offset.X;
                homeButton.Position = new Point (x, offset.Y - homeButton.Height);
                homeButton.Draw (tk, area);
            }
            if (awayButton.Visible) {
                double x = (Position.X + Width - offset.X - App.Current.Style.TeamTaggerBenchBorder * scaleX) - awayButton.Width;
                awayButton.Position = new Point (x, offset.Y - awayButton.Height);
                awayButton.Draw (tk, area);
            }

            tk.TranslateAndScale (Position + offset, new Point (scaleX, scaleY));
            homeBench.Draw (tk, area);
            awayBench.Draw (tk, area);
            field.Draw (tk, area);
            tk.End ();
        }
Exemplo n.º 53
0
        static void RenderTimelineEventBase(Color color, Image ss, bool selected, string desc, IDrawingToolkit tk,
		                                     IContext context, Area backgroundArea, Area cellArea, CellState state,
		                                     out Point selectPoint, out Point textPoint, out Point imagePoint,
		                                     out Point circlePoint, out double textWidth)
        {
            selectPoint = new Point (backgroundArea.Start.X, backgroundArea.Start.Y);
            textPoint = new Point (selectPoint.X + StyleConf.ListSelectedWidth + StyleConf.ListRowSeparator, selectPoint.Y);
            imagePoint = new Point (textPoint.X + StyleConf.ListTextWidth + StyleConf.ListRowSeparator, selectPoint.Y);
            textWidth = StyleConf.ListTextWidth;
            circlePoint = new Point (selectPoint.X + StyleConf.ListSelectedWidth / 2, selectPoint.Y + backgroundArea.Height / 2);

            tk.LineWidth = 0;
            if (state.HasFlag (CellState.Prelit)) {
                tk.FillColor = Config.Style.PaletteBackgroundDarkBright;
            } else {
                tk.FillColor = Config.Style.PaletteBackgroundDark;
            }
            tk.DrawRectangle (backgroundArea.Start, backgroundArea.Width, backgroundArea.Height);
            /* Selection rectangle */
            tk.LineWidth = 0;
            tk.FillColor = color;
            tk.DrawRectangle (selectPoint, StyleConf.ListSelectedWidth, backgroundArea.Height);
            tk.FillColor = Config.Style.PaletteBackgroundDark;
            tk.DrawCircle (circlePoint, (StyleConf.ListSelectedWidth / 2) - 1);
            if (state.HasFlag (CellState.Selected)) {
                tk.FillColor = Config.Style.PaletteBackground;
                tk.FillColor = Config.Style.PaletteActive;
                tk.DrawCircle (circlePoint, (StyleConf.ListSelectedWidth / 2) - 2);
            }

            if (desc != null) {
                tk.FontSize = 10;
                tk.FontWeight = FontWeight.Normal;
                tk.StrokeColor = Config.Style.PaletteSelected;
                tk.FontAlignment = FontAlignment.Left;
                tk.DrawText (textPoint, textWidth, cellArea.Height, desc);
            }
            if (selected) {
                if (EyeSurface == null) {
                    EyeSurface = Config.DrawingToolkit.CreateSurface (Path.Combine (Config.IconsDir, StyleConf.ListEyeIconPath));
                }
                tk.DrawSurface (EyeSurface, new Point (imagePoint.X - EyeSurface.Width - StyleConf.ListEyeIconOffset, imagePoint.Y + backgroundArea.Height / 2 - EyeSurface.Height / 2));
            }
            if (ss != null) {
                tk.DrawImage (imagePoint, StyleConf.ListImageWidth, cellArea.Height, ss, true);
            }
        }
Exemplo n.º 54
0
        public static void RenderPlayer(Player player, int count, bool isExpanded, IDrawingToolkit tk,
		                                 IContext context, Area backgroundArea, Area cellArea)
        {
            Point image, text;
            double textWidth;

            image = new Point (StyleConf.ListTextOffset, cellArea.Start.Y);
            text = new Point (image.X + StyleConf.ListRowSeparator + StyleConf.ListImageWidth,
                cellArea.Start.Y);
            textWidth = cellArea.Start.X + cellArea.Width - text.X;

            tk.Context = context;
            tk.Begin ();
            RenderBackgroundAndText (isExpanded, tk, backgroundArea, text, textWidth, player.ToString ());
            /* Photo */
            RenderPlayer (tk, player, image);
            RenderCount (isExpanded, player.Color, count, tk, backgroundArea, cellArea);
            RenderSeparationLine (tk, context, backgroundArea);
            tk.End ();
        }
Exemplo n.º 55
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double start, stop;
            int lineWidth = StyleConf.TimelineLineSize;

            if (!UpdateDrawArea (tk, area, Area)) {
                return;
            }
            ;

            tk.Begin ();

            start = StartX;
            stop = StopX;

            if (stop - start <= lineWidth) {
                DrawBorders (tk, start, stop, lineWidth);
                DrawLine (tk, start, stop, lineWidth);
            } else {
                DrawLine (tk, start, stop, lineWidth);
                DrawBorders (tk, start, stop, lineWidth);
            }
            if (Selected) {
                tk.DrawSurface (SelectionLeft, new Point (start - SelectionLeft.Width / 2, OffsetY));
                tk.DrawSurface (SelectionRight, new Point (stop - SelectionRight.Width / 2, OffsetY));
            }
            tk.End ();
        }
Exemplo n.º 56
0
        public static void RenderPlaylist(Playlist playlist, int count, bool isExpanded, IDrawingToolkit tk,
		                                   IContext context, Area backgroundArea, Area cellArea)
        {
            Point textP = new Point (StyleConf.ListTextOffset, cellArea.Start.Y);
            tk.Context = context;
            tk.Begin ();
            RenderBackgroundAndText (isExpanded, tk, backgroundArea, textP, cellArea.Width - textP.X, playlist.Name);
            RenderCount (isExpanded, Config.Style.PaletteActive, count, tk, backgroundArea, cellArea);
            RenderSeparationLine (tk, context, backgroundArea);
            tk.End ();
        }
Exemplo n.º 57
0
        void DrawLine(IDrawingToolkit tk, double start, double stop, int lineWidth)
        {
            double y;

            y = OffsetY + Height / 2;
            tk.LineWidth = lineWidth;
            tk.FillColor = Event.Color;
            tk.StrokeColor = Event.Color;
            if (stop - start <= lineWidth) {
                tk.LineWidth = 0;
                tk.DrawCircle (new Point (start + (stop - start) / 2, y), 3);
            } else {
                tk.DrawLine (new Point (start + lineWidth / 2, y),
                    new Point (stop - lineWidth / 2, y));
            }
        }
Exemplo n.º 58
0
        public static void RenderSeparationLine(IDrawingToolkit tk, IContext context, Area backgroundArea)
        {
            double x1, x2, y;

            x1 = backgroundArea.Start.X;
            x2 = x1 + backgroundArea.Width;
            y = backgroundArea.Start.Y + backgroundArea.Height;
            tk.LineWidth = 1;
            tk.StrokeColor = Config.Style.PaletteBackgroundLight;
            tk.DrawLine (new Point (x1, y), new Point (x2, y));
        }
Exemplo n.º 59
0
 public Canvas(IWidget widget)
 {
     this.widget = widget;
     tk = Config.DrawingToolkit;
     Objects = new List<ICanvasObject> ();
     widget.DrawEvent += Draw;
     widget.SizeChangedEvent += HandleSizeChangedEvent;
     ScaleX = 1;
     ScaleY = 1;
     Translation = new Point (0, 0);
 }
Exemplo n.º 60
0
 protected override void DrawBackground(IDrawingToolkit tk, Area area)
 {
     // We want to have a slight border in our background.
     tk.FillColor = BackgroundColor;
     tk.StrokeColor = Config.Style.PaletteBackgroundDark;
     tk.LineWidth = 1;
     tk.DrawRectangle (new Point (area.Start.X, OffsetY), area.Width, Height);
 }