Пример #1
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));
        }
Пример #2
0
        protected virtual void DrawBorders(IDrawingToolkit tk, double start, double stop, int lineWidth)
        {
            double y1, y2;

            tk.LineWidth = lineWidth;
            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));
        }
Пример #3
0
        /// <summary>
        /// Draws the borders of a region following the passed viewmodel
        /// </summary>
        /// <param name="tk">Drawing Toolkit.</param>
        /// <param name="area">Area.</param>
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            tk.Begin();
            tk.LineWidth   = ViewModel.LineWidth;
            tk.StrokeColor = App.Current.Style.ThemeSecondary;

            int    extraLeft = (ViewModel.ShowLeft) ? ViewModel.PaddingLeft : 0;
            double xOrigin   = Position.X + extraLeft;
            double yOrigin   = Position.Y + 1;

            double width = Width;

            width -= (ViewModel.ShowLeft) ? ViewModel.PaddingLeft : 0;
            width -= (ViewModel.ShowRight) ? ViewModel.PaddingRigth : 0;
            double height = Height - (ViewModel.LineWidth * 2) - 5;

            Point start = new Point(xOrigin, yOrigin);
            Point stop  = new Point(xOrigin + width, yOrigin);

            if (ViewModel.ShowTop)
            {
                tk.DrawLine(start, stop);
            }

            if (ViewModel.ShowBottom)
            {
                start = new Point(xOrigin, yOrigin + height);
                stop  = new Point(xOrigin + width, yOrigin + height);
                tk.DrawLine(start, stop);
            }

            if (ViewModel.ShowLeft)
            {
                start = new Point(xOrigin, yOrigin);
                stop  = new Point(xOrigin, yOrigin + height);
                tk.DrawLine(start, stop);
            }

            if (ViewModel.ShowRight)
            {
                start = new Point(xOrigin + width - ViewModel.LineWidth + 1, yOrigin);
                stop  = new Point(xOrigin + width - ViewModel.LineWidth + 1, yOrigin + height);
                tk.DrawLine(start, stop);
            }

            tk.FillColor = ViewModel.Background;
            tk.LineWidth = 0;
            extraLeft    = ViewModel.ShowLeft ? ViewModel.LineWidth : 0;
            int extraRight = ViewModel.ShowRight ? ViewModel.LineWidth + 1 : 0;

            start = new Point(xOrigin + extraLeft, yOrigin + ViewModel.LineWidth);
            tk.DrawRectangle(start, width - extraRight, height - ViewModel.LineWidth * 2);

            tk.End();
        }
Пример #4
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();
        }
Пример #5
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();
        }
Пример #6
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (!UpdateDrawArea(tk, area, Drawable.Area))
            {
                return;
            }

            tk.Begin();
            tk.FillColor   = Drawable.FillColor;
            tk.StrokeColor = Drawable.StrokeColor;
            tk.LineWidth   = Drawable.LineWidth;
            tk.LineStyle   = Drawable.Style;
            tk.DrawLine(Drawable.Start, Drawable.Stop);
            tk.DrawLine(Drawable.StartI, Drawable.StopI);
            DrawSelectionArea(tk);
            tk.End();
        }
Пример #7
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Color  fillColor, strokeColor;
            double relSize;

            relSize = Math.Max(1, (double)Width / 200);

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

            tk.Begin();
            if (Play != null)
            {
                fillColor   = Play.Color;
                strokeColor = fillColor;
                if (Project != null)
                {
                    TeamType team = Project.EventTaggedTeam(Play);
                    if (team == TeamType.LOCAL)
                    {
                        strokeColor = Project.LocalTeamTemplate.Color;
                    }
                    else if (team == TeamType.VISITOR)
                    {
                        strokeColor = Project.VisitorTeamTemplate.Color;
                    }
                }
            }
            else
            {
                fillColor = strokeColor = Constants.TAGGER_POINT_COLOR;
            }

            if (Selected)
            {
                fillColor = Constants.TAGGER_SELECTION_COLOR;
            }
            else if (Highlighted)
            {
                fillColor = Config.Style.PaletteActive;
            }

            tk.FillColor   = fillColor;
            tk.StrokeColor = strokeColor;
            tk.LineWidth   = (int)relSize;
            tk.DrawCircle(Start, relSize * 1.5);
            if (Points.Count == 2)
            {
                tk.StrokeColor = fillColor;
                tk.LineWidth   = (int)relSize;
                tk.DrawLine(Start, Stop);
                tk.DrawArrow(Start, Stop, 10, 0.3, true);
            }
            tk.End();
        }
Пример #8
0
        /// <summary>
        /// Draw the specified area with the specified Drawing toolkit tk.
        /// </summary>
        /// <param name="tk">IDrawingToolkit.</param>
        /// <param name="area">Area.</param>
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double linepos;

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

            tk.Begin();
            if (needle == null)
            {
                needle = tk.CreateSurfaceFromIcon(Icons.TimelineNeedleUP);
            }

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

            linepos = OffsetY + Height / 2 + Sizes.TimelineLineSize / 2;

            if (StopX - StartX <= needle.Width / 2)
            {
                double c = movingPos == SelectionPosition.Left ? StopX : StartX;
                tk.DrawSurface(new Point(c - needle.Width / 2, linepos - 9), Sizes.TimelineNeedleUpWidth,
                               Sizes.TimelineNeedleUpHeight, needle, ScaleMode.AspectFit);
            }
            else
            {
                tk.DrawLine(new Point(StartX, linepos),
                            new Point(StopX, linepos));
                tk.DrawSurface(new Point(StartX - needle.Width / 2, linepos - 9), Sizes.TimelineNeedleUpWidth,
                               Sizes.TimelineNeedleUpHeight, needle, ScaleMode.AspectFit);
                tk.DrawSurface(new Point(StopX - needle.Width / 2, linepos - 9), Sizes.TimelineNeedleUpWidth,
                               Sizes.TimelineNeedleUpHeight, needle, ScaleMode.AspectFit);
            }

            if (ShowName)
            {
                tk.FontSize    = Sizes.TimelineFontSize;
                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 / 2, TimeNode.Name);
            }
            tk.End();
        }
Пример #9
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double linepos;

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

            tk.Begin();
            if (needle == null)
            {
                string path = Path.Combine(Config.IconsDir, StyleConf.TimelineNeedleUP);
                Image  img  = Image.LoadFromFile(path);
                needle = tk.CreateSurface(img.Width, img.Height, img);
            }

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

            linepos = OffsetY + Height / 2 + StyleConf.TimelineLineSize / 2;

            if (StopX - StartX <= needle.Width / 2)
            {
                double c = movingPos == SelectionPosition.Left ? StopX : StartX;
                tk.DrawSurface(needle, new Point(c - needle.Width / 2, linepos - 9));
            }
            else
            {
                tk.DrawLine(new Point(StartX, linepos),
                            new Point(StopX, linepos));
                tk.DrawSurface(needle, new Point(StartX - needle.Width / 2, linepos - 9));
                tk.DrawSurface(needle, new Point(StopX - needle.Width / 2, linepos - 9));
            }


            if (ShowName)
            {
                tk.FontSize    = StyleConf.TimelineFontSize;
                tk.FontWeight  = FontWeight.Bold;
                tk.FillColor   = Config.Style.PaletteActive;
                tk.StrokeColor = Config.Style.PaletteActive;
                tk.DrawText(new Point(StartX, OffsetY), StopX - StartX, Height / 2, TimeNode.Name);
            }
            tk.End();
        }
Пример #10
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));
        }
Пример #11
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 = App.Current.Style.PaletteBackgroundLight;
            tk.DrawLine(new Point(x1, y), new Point(x2, y));
        }
Пример #12
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   = App.Current.Style.PaletteBackgroundDark;
                tk.StrokeColor = App.Current.Style.PaletteBackgroundDark;
                tk.LineWidth   = StyleConf.TimelineBackgroundLineSize;
                tk.DrawLine(new Point(0, linepos),
                            new Point(Width, linepos));
            }
        }
        protected override void DrawBorders(IDrawingToolkit tk, double start, double stop, int lineWidth)
        {
            Color  color;
            double y1, y2;

            tk.LineWidth = lineWidth;
            List <LMTeam> teams = ViewModel.TypedModel.TaggedTeams;

            if (teams.Count == 1)
            {
                color = teams [0].Color;
            }
            else
            {
                color = App.Current.Style.TextBase;
            }

            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));
        }
Пример #14
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();
        }
Пример #15
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));
            }
        }
Пример #16
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            if (!UpdateDrawArea(tk, area, Drawable.Area))
            {
                return;
            }

            tk.Begin();
            tk.FillColor   = Drawable.FillColor;
            tk.StrokeColor = Drawable.StrokeColor;
            tk.LineWidth   = Drawable.LineWidth;
            tk.LineStyle   = Drawable.Style;
            tk.DrawLine(Drawable.Start, Drawable.Stop);
            tk.LineStyle = LineStyle.Normal;
            if (Drawable.Type == LineType.Arrow ||
                Drawable.Type == LineType.DoubleArrow)
            {
                tk.DrawArrow(Drawable.Start, Drawable.Stop, 5 * Drawable.LineWidth / 2, 0.3, true);
            }
            if (Drawable.Type == LineType.DoubleArrow)
            {
                tk.DrawArrow(Drawable.Stop, Drawable.Start, 5 * Drawable.LineWidth / 2, 0.3, true);
            }
            if (Drawable.Type == LineType.Dot ||
                Drawable.Type == LineType.DoubleDot)
            {
                tk.DrawPoint(Drawable.Stop);
            }
            if (Drawable.Type == LineType.DoubleDot)
            {
                tk.DrawPoint(Drawable.Start);
            }

            if (Selected)
            {
                DrawCornerSelection(tk, Drawable.Start);
                DrawCornerSelection(tk, Drawable.Stop);
            }
            tk.End();
        }
Пример #17
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Color fillColor, strokeColor;

            if (Points == null)
            {
                return;
            }

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

            tk.Begin();
            fillColor   = Color;
            strokeColor = OutlineColor;

            if (Selected)
            {
                fillColor = VASDrawing.Constants.TAGGER_SELECTION_COLOR;
            }
            else if (Highlighted)
            {
                fillColor = App.Current.Style.ThemeContrastDisabled;
            }

            tk.FillColor   = fillColor;
            tk.StrokeColor = strokeColor;
            tk.LineWidth   = (int)PointRelativeSize;
            tk.DrawCircle(Start, PointRelativeSize * 1.5);
            if (Points.Count == 2)
            {
                tk.StrokeColor = fillColor;
                tk.LineWidth   = (int)PointRelativeSize;
                tk.DrawLine(Start, Stop);
                tk.DrawArrow(Start, Stop, 10, 0.3, true);
            }
            tk.End();
        }
Пример #18
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Color fillColor, strokeColor;
            double relSize;

            relSize = Math.Max (1, (double)Width / 200);

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

            tk.Begin ();
            if (Play != null) {
                fillColor = Play.Color;
                strokeColor = fillColor;
                if (Play.Teams.Count == 1) {
                    strokeColor = Play.Teams.First ().Color;
                }
            } else {
                fillColor = strokeColor = VASDrawing.Constants.TAGGER_POINT_COLOR;
            }

            if (Selected) {
                fillColor = VASDrawing.Constants.TAGGER_SELECTION_COLOR;
            } else if (Highlighted) {
                fillColor = App.Current.Style.PaletteActive;
            }

            tk.FillColor = fillColor;
            tk.StrokeColor = strokeColor;
            tk.LineWidth = (int)relSize;
            tk.DrawCircle (Start, relSize * 1.5);
            if (Points.Count == 2) {
                tk.StrokeColor = fillColor;
                tk.LineWidth = (int)relSize;
                tk.DrawLine (Start, Stop);
                tk.DrawArrow (Start, Stop, 10, 0.3, true);
            }
            tk.End ();
        }
Пример #19
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 ();
        }
Пример #20
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            Color fillColor, strokeColor;
            double relSize;

            relSize = Math.Max (1, (double)Width / 200);

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

            tk.Begin ();
            if (Play != null) {
                fillColor = Play.Color;
                strokeColor = fillColor;
                if (Project != null) {
                    TeamType team = Project.EventTaggedTeam (Play);
                    if (team == TeamType.LOCAL) {
                        strokeColor = Project.LocalTeamTemplate.Color;
                    } else if (team == TeamType.VISITOR) {
                        strokeColor = Project.VisitorTeamTemplate.Color;
                    }
                }
            } else {
                fillColor = strokeColor = Constants.TAGGER_POINT_COLOR;
            }

            if (Selected) {
                fillColor = Constants.TAGGER_SELECTION_COLOR;
            } else if (Highlighted) {
                fillColor = Config.Style.PaletteActive;
            }

             			tk.FillColor = fillColor;
            tk.StrokeColor = strokeColor;
            tk.LineWidth = (int)relSize;
            tk.DrawCircle (Start, relSize * 1.5);
            if (Points.Count == 2) {
                tk.StrokeColor = fillColor;
                tk.LineWidth = (int)relSize;
                tk.DrawLine (Start, Stop);
                tk.DrawArrow (Start, Stop, 10, 0.3, true);
            }
            tk.End ();
        }
Пример #21
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));
            }
        }
Пример #22
0
        void DrawTagsGroup(IDrawingToolkit tk, List <Tag> tags, ref double yptr)
        {
            double rowwidth;
            Point  start;
            int    tagsPerRow, row = 0;

            tagsPerRow = Math.Max(1, Button.TagsPerRow);
            rowwidth   = catWidth / tagsPerRow;

            start         = new Point(Position.X, Position.Y + HeaderHeight);
            tk.FontSize   = 12;
            tk.FontWeight = FontWeight.Light;

            /* Draw tags */
            for (int i = 0; i < tags.Count; i++)
            {
                Point pos;
                int   col;
                Tag   tag;

                row = i / tagsPerRow;
                col = i % tagsPerRow;
                pos = new Point(start.X + col * rowwidth,
                                start.Y + yptr + row * heightPerRow);
                tag = tags [i];

                AddSubcatAnchor(tag, new Point(pos.X - Position.X, pos.Y - Position.Y),
                                rowwidth, heightPerRow);
                if (!Button.ShowSubcategories)
                {
                    continue;
                }

                tk.StrokeColor = Button.DarkColor;
                tk.LineWidth   = 1;
                /* Draw last vertical line when the last row is not fully filled*/
                if (col == 0)
                {
                    if (i + tagsPerRow > tags.Count)
                    {
                        tk.LineStyle = LineStyle.Dashed;
                        var st = new Point(pos.X + rowwidth * ((i + 1) % tagsPerRow), pos.Y);
                        tk.DrawLine(st, new Point(st.X, st.Y + heightPerRow));
                        tk.LineStyle = LineStyle.Normal;
                    }
                }

                if (col == 0)
                {
                    if (row != 0)
                    {
                        tk.LineStyle = LineStyle.Dashed;
                    }
                    /* Horizontal line */
                    tk.DrawLine(pos, new Point(pos.X + catWidth, pos.Y));
                    tk.LineStyle = LineStyle.Normal;
                }
                else
                {
                    /* Vertical line */
                    tk.LineStyle = LineStyle.Dashed;
                    tk.DrawLine(pos, new Point(pos.X, pos.Y + heightPerRow));
                    tk.LineStyle = LineStyle.Normal;
                }
                tk.StrokeColor = Button.TextColor;
                tk.DrawText(pos, rowwidth, heightPerRow, tag.Value);
                rects.Add(new Rectangle(pos, rowwidth, heightPerRow), tag);
            }
            yptr += heightPerRow * (row + 1);
        }
Пример #23
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));
            }
        }
Пример #24
0
        void DrawTagsGroup(IDrawingToolkit tk, List<Tag> tags, ref double yptr)
        {
            double rowwidth;
            Point start;
            int tagsPerRow, row = 0;

            tagsPerRow = Math.Max (1, Button.TagsPerRow);
            rowwidth = catWidth / tagsPerRow;

            start = new Point (Position.X, Position.Y + HeaderHeight);
            tk.FontSize = 12;
            tk.FontWeight = FontWeight.Light;

            /* Draw tags */
            for (int i = 0; i < tags.Count; i++) {
                Point pos;
                int col;
                Tag tag;

                row = i / tagsPerRow;
                col = i % tagsPerRow;
                pos = new Point (start.X + col * rowwidth,
                    start.Y + yptr + row * heightPerRow);
                tag = tags [i];

                AddSubcatAnchor (tag, new Point (pos.X - Position.X, pos.Y - Position.Y),
                    rowwidth, heightPerRow);
                if (!Button.ShowSubcategories) {
                    continue;
                }

                tk.StrokeColor = Button.DarkColor;
                tk.LineWidth = 1;
                /* Draw last vertical line when the last row is not fully filled*/
                if (col == 0) {
                    if (i + tagsPerRow > tags.Count) {
                        tk.LineStyle = LineStyle.Dashed;
                        var st = new Point (pos.X + rowwidth * ((i + 1) % tagsPerRow), pos.Y);
                        tk.DrawLine (st, new Point (st.X, st.Y + heightPerRow));
                        tk.LineStyle = LineStyle.Normal;
                    }
                }

                if (col == 0) {
                    if (row != 0) {
                        tk.LineStyle = LineStyle.Dashed;
                    }
                    /* Horizontal line */
                    tk.DrawLine (pos, new Point (pos.X + catWidth, pos.Y));
                    tk.LineStyle = LineStyle.Normal;
                } else {
                    /* Vertical line */
                    tk.LineStyle = LineStyle.Dashed;
                    tk.DrawLine (pos, new Point (pos.X, pos.Y + heightPerRow));
                    tk.LineStyle = LineStyle.Normal;
                }
                tk.StrokeColor = Button.TextColor;
                tk.DrawText (pos, rowwidth, heightPerRow, tag.Value);
                rects.Add (new Rectangle (pos, rowwidth, heightPerRow), tag);
            }
            yptr += heightPerRow * (row + 1);
        }
Пример #25
0
        public override void Draw(IDrawingToolkit tk, Area area)
        {
            double linepos;

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

            tk.Begin ();
            if (needle == null) {
                string path = Path.Combine (Config.IconsDir, StyleConf.TimelineNeedleUP);
                Image img = Image.LoadFromFile (path);
                needle = tk.CreateSurface (img.Width, img.Height, img);
            }

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

            linepos = OffsetY + Height / 2 + StyleConf.TimelineLineSize / 2;

            if (StopX - StartX <= needle.Width / 2) {
                double c = movingPos == SelectionPosition.Left ? StopX : StartX;
                tk.DrawSurface (needle, new Point (c - needle.Width / 2, linepos - 9));
            } else {
                tk.DrawLine (new Point (StartX, linepos),
                    new Point (StopX, linepos));
                tk.DrawSurface (needle, new Point (StartX - needle.Width / 2, linepos - 9));
                tk.DrawSurface (needle, new Point (StopX - needle.Width / 2, linepos - 9));
            }

            if (ShowName) {
                tk.FontSize = StyleConf.TimelineFontSize;
                tk.FontWeight = FontWeight.Bold;
                tk.FillColor = Config.Style.PaletteActive;
                tk.StrokeColor = Config.Style.PaletteActive;
                tk.DrawText (new Point (StartX, OffsetY), StopX - StartX, Height / 2, TimeNode.Name);
            }
            tk.End ();
        }
Пример #26
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));
        }
Пример #27
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 ();
        }
Пример #28
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));
        }