Exemplo n.º 1
0
        public Resources(string fontFamily, float fontSize, float dpiSensitivePensScale = 1f)
        {
            this.UserActionBrush              = new LJD.Brush(Color.LightSalmon);
            this.StateChangeBrush             = new LJD.Brush(Color.FromArgb(0xff, Color.FromArgb(0xC8F6C8)));
            this.UserActionFramePen           = new LJD.Pen(Color.Gray, 1);
            this.BookmarkArrowBackgroundBrush = new LJD.Brush(Color.FromArgb(0xff, Color.FromArgb(0xE3EDFF)));
            this.BookmarkArrowPen             = new LJD.Pen(Color.Gray, 1);
            this.SelectedLineColor            = Color.FromArgb(187, 196, 221);
            this.SelectedLineBrush            = new LJD.Brush(SelectedLineColor);
            this.ControlBackgroundBrush       = new LJD.Brush(Color.White);
            this.Font              = new LJD.Font(fontFamily, fontSize);
            this.UnderlinedFont    = new LJD.Font(fontFamily, fontSize, FontStyle.Underline);
            this.RolePen           = new LJD.Pen(Color.Black, 2 * dpiSensitivePensScale);
            this.RoleCaptionFormat = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Center, LineBreakMode.WrapChars);
            float normalLineWidth = 1 * dpiSensitivePensScale;

            this.RequestPen  = new LJD.Pen(Color.Black, normalLineWidth);
            this.ResponsePen = new LJD.Pen(Color.Black, normalLineWidth, dashPattern: new float[] { 5, 2 });
            float highlightedLineWidth = (float)Math.Ceiling(2f * dpiSensitivePensScale);

            this.HighlightedRequestPen                       = new LJD.Pen(Color.Black, highlightedLineWidth);
            this.HighlightedResponsePen                      = new LJD.Pen(Color.Black, highlightedLineWidth, dashPattern: new float[] { 5 * normalLineWidth / highlightedLineWidth, 2 * normalLineWidth / highlightedLineWidth });
            this.CaptionRectPen                              = new LJD.Pen(Color.Black, 1);
            this.LinkCaptionBrush                            = new LJD.Brush(Color.Blue);
            this.NoLinkCaptionBrush                          = new LJD.Brush(Color.Black);
            this.ExecutionOccurrencePen                      = new LJD.Pen(Color.Black, 1);
            this.HighlightedExecutionOccurrencePen           = new LJD.Pen(Color.Black, highlightedLineWidth);
            this.NormalExecutionOccurrenceBrush              = new LJD.Brush(Color.LightGray);
            this.NormalHighlightedExecutionOccurrenceBrush   = new LJD.Brush(Color.DarkGray);
            this.ActivityExecutionOccurrenceBrush            = new LJD.Brush(Color.LightBlue);
            this.ActivityHighlightedExecutionOccurrenceBrush = this.ActivityExecutionOccurrenceBrush;            //new LJD.Brush(Color.FromArgb(0xff, Color.FromArgb(0x8DB8C6)));
            this.NormalArrowTextBrush                        = new LJD.Brush(Color.Black);
            this.ErrorArrowTextBrush                         = new LJD.Brush(Color.Red);
            this.ArrowTextFormat                             = new LJD.StringFormat(StringAlignment.Near, StringAlignment.Far, LineBreakMode.SingleLineEndEllipsis);
            this.UserActionTextFormat                        = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Far, LineBreakMode.SingleLineEndEllipsis);
            this.TimeDeltaFormat                             = new LJD.StringFormat(StringAlignment.Far, StringAlignment.Center);
            this.ArrowEndShapePoints                         = new [] {
                new PointF(-5, -4),
                new PointF(-5, +4),
                new PointF(0, 0)
            };
            this.DpiScale = dpiSensitivePensScale;
        }
Exemplo n.º 2
0
            public Resources(string fontName, float fontBaseSize, LJD.Image bookmarkIcon)
            {
                AxesFont = new LJD.Font(fontName, fontBaseSize);
                AxesPen  = LJD.Pens.DarkGray;
                XAxisPointLabelFormat = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Far);
                YAxisPointLabelFormat = new LJD.StringFormat(StringAlignment.Far, StringAlignment.Center);
                YAxisLabelFormat      = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Far);
                DataPointLabelBrush   = LJD.Brushes.Text;
                var bmkColor = Color.FromArgb(0x5b, 0x87, 0xe0);

                BookmarkPen            = new LJD.Pen(bmkColor, 1);
                BookmarkBrush          = new LJD.Brush(bmkColor);
                BookmarkIcon           = bookmarkIcon;
                EventTextFont          = new LJD.Font(fontName, fontBaseSize * 0.8f);
                EventTextFormat        = new LJD.StringFormat(StringAlignment.Far, StringAlignment.Far);
                ParsedEventPen         = new LJD.Pen(Color.Red, 1);
                ParsedEventBrush       = new LJD.Brush(Color.Red);
                GroupCaptionFont       = EventTextFont;
                ParsedEventsGroupBrush = new LJD.Brush(Color.FromArgb(100, Color.Red));
                BookmarksGroupGrush    = new LJD.Brush(Color.FromArgb(100, Color.Blue));
            }
Exemplo n.º 3
0
        public Resources(
            IViewModel viewModel,
            string fontFamily,
            float fontSize,
            float dpiSensitivePensScale = 1f)
        {
            bool isDark() => viewModel.ColorTheme == Presenters.ColorThemeMode.Dark;

            this.UserActionBrush              = new LJD.Brush(Color.LightSalmon);
            this.StateChangeBrush             = new LJD.Brush(Color.FromArgb(0xff, Color.FromArgb(0xC8F6C8)));
            this.UserActionFramePen           = new LJD.Pen(Color.Gray, 1);
            this.bookmarkArrowBackgroundBrush = Selectors.Create(
                isDark,
                dark => new LJD.Brush(dark ? Color.FromArgb(0, 31, 39) : Color.FromArgb(0xff, Color.FromArgb(0xE3EDFF)))
                );
            this.bookmarkArrowPen = Selectors.Create(
                isDark,
                dark => new LJD.Pen(dark ? Color.LightGray : Color.Gray, 1)
                );
            this.selectedLineBrushSelector = Selectors.Create(
                isDark,
                dark => dark ? new Brush(Color.FromArgb(40, 80, 120)) : new Brush(Color.FromArgb(167, 176, 201))
                );
            this.ControlBackgroundBrush = Brushes.TextBackground;
            this.Font              = new LJD.Font(fontFamily, fontSize);
            this.UnderlinedFont    = new LJD.Font(fontFamily, fontSize, FontStyle.Underline);
            this.RolePen           = new LJD.Pen(SystemColors.Text, 2 * dpiSensitivePensScale);
            this.RoleCaptionFormat = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Center, LineBreakMode.WrapChars);
            float normalLineWidth = 1 * dpiSensitivePensScale;

            this.RequestPen  = new LJD.Pen(SystemColors.Text, normalLineWidth);
            this.ResponsePen = new LJD.Pen(SystemColors.Text, normalLineWidth, dashPattern: new float[] { 5, 2 });
            float highlightedLineWidth = (float)Math.Ceiling(2f * dpiSensitivePensScale);

            this.HighlightedRequestPen             = new LJD.Pen(SystemColors.Text, highlightedLineWidth);
            this.HighlightedResponsePen            = new LJD.Pen(SystemColors.Text, highlightedLineWidth, dashPattern: new float[] { 5 * normalLineWidth / highlightedLineWidth, 2 * normalLineWidth / highlightedLineWidth });
            this.CaptionRectPen                    = new LJD.Pen(SystemColors.Text, 1);
            this.LinkCaptionBrush                  = new LJD.Brush(SystemColors.Link);
            this.NoLinkCaptionBrush                = new LJD.Brush(SystemColors.Text);
            this.ExecutionOccurrencePen            = new LJD.Pen(SystemColors.Text, 1);
            this.HighlightedExecutionOccurrencePen = new LJD.Pen(SystemColors.Text, highlightedLineWidth);
            this.normalExecutionOccurrenceBrush    = Selectors.Create(
                isDark,
                dark => new LJD.Brush(dark ? Color.FromArgb(100, 100, 100) : Color.LightGray)
                );
            this.normalHighlightedExecutionOccurrenceBrush = Selectors.Create(
                isDark,
                dark => new LJD.Brush(dark ? Color.FromArgb(150, 150, 150) : Color.DarkGray)
                );
            this.ActivityExecutionOccurrenceBrush            = new LJD.Brush(Color.LightBlue);
            this.ActivityHighlightedExecutionOccurrenceBrush = this.ActivityExecutionOccurrenceBrush;
            this.NormalArrowTextBrush = Brushes.Text;
            this.ErrorArrowTextBrush  = new LJD.Brush(Color.Red);
            this.ArrowTextFormat      = new LJD.StringFormat(StringAlignment.Near, StringAlignment.Far, LineBreakMode.SingleLineEndEllipsis);
            this.UserActionTextFormat = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Far, LineBreakMode.SingleLineEndEllipsis);
            this.TimeDeltaFormat      = new LJD.StringFormat(StringAlignment.Far, StringAlignment.Center);
            this.ArrowEndShapePoints  = new [] {
                new PointF(-5, -4),
                new PointF(-5, +4),
                new PointF(0, 0)
            };
            this.DpiScale = dpiSensitivePensScale;
        }
Exemplo n.º 4
0
        void UpdateViewMetrics()
        {
            viewMetrics.RulersPanelHeight           = (int)searchTextBoxPlaceholder.Frame.Bottom;
            viewMetrics.ActivitiesViewWidth         = (int)activitiesView.Bounds.Width;
            viewMetrics.ActivitiesViewHeight        = (int)activitiesView.Bounds.Height;
            viewMetrics.ActivitesCaptionsViewWidth  = (int)captionsView.Bounds.Width;
            viewMetrics.ActivitesCaptionsViewHeight = (int)captionsView.Bounds.Height;
            viewMetrics.NavigationPanelWidth        = (int)navigatorView.Bounds.Width;
            viewMetrics.NavigationPanelHeight       = (int)navigatorView.Bounds.Height;

            if (viewMetrics.LineHeight == 0)              // very first update
            {
                var sysFont    = NSFont.SystemFontOfSize(NSFont.SystemFontSize);
                var normalFont = new LJD.Font(sysFont.FamilyName, (float)NSFont.SystemFontSize);
                var smallFont  = new LJD.Font(sysFont.FamilyName, (float)NSFont.SmallSystemFontSize);

                using (var g = new LJD.Graphics())
                    viewMetrics.LineHeight = (int)g.MeasureString("ABC012", normalFont).Height;

                viewMetrics.ActivitesCaptionsFont  = normalFont;
                viewMetrics.ActivitesCaptionsBrush = new LJD.Brush(Color.Black);

                var selectedLineColor = Color.FromArgb(187, 196, 221);
                viewMetrics.SelectedLineBrush = new LJD.Brush(selectedLineColor);
                viewMetrics.ErrorLineBrush    = new LJD.Brush(Color.FromArgb(255, 255, 170, 170));

                viewMetrics.RulerLinePen   = new LJD.Pen(Color.LightGray, 1);
                viewMetrics.RulerMarkFont  = smallFont;
                viewMetrics.RulerMarkBrush = new LJD.Brush(Color.Black);

                viewMetrics.ActivitiesTopBoundPen = new LJD.Pen(Color.Gray, 1);

                viewMetrics.ProcedureBrush         = new LJD.Brush(Color.LightBlue);
                viewMetrics.LifetimeBrush          = new LJD.Brush(Color.LightGreen);
                viewMetrics.NetworkMessageBrush    = new LJD.Brush(Color.LightSalmon);
                viewMetrics.UnknownActivityBrush   = new LJD.Brush(Color.LightGray);
                viewMetrics.MilestonePen           = new LJD.Pen(Color.FromArgb(180, Color.SteelBlue), 3);
                viewMetrics.ActivityBarBoundsPen   = new LJD.Pen(Color.Gray, 0.5f);
                viewMetrics.ActivitiesConnectorPen = new LJD.Pen(Color.DarkGray, 1, new [] { 1f, 1f });
                viewMetrics.PhaseBrushes           = new LJD.Brush[]
                {
                    new LJD.Brush(Color.FromArgb(255, 170, 170, 170)),
                    new LJD.Brush(Color.FromArgb(255, 0, 150, 136)),
                    new LJD.Brush(Color.FromArgb(255, 63, 72, 204)),
                    new LJD.Brush(Color.FromArgb(255, 34, 175, 76)),
                };


                viewMetrics.UserEventPen             = new LJD.Pen(Color.Salmon, 2);
                viewMetrics.EventRectBrush           = new LJD.Brush(Color.Salmon);
                viewMetrics.EventRectPen             = new LJD.Pen(Color.Gray, 1);
                viewMetrics.EventCaptionBrush        = new LJD.Brush(Color.Black);
                viewMetrics.EventCaptionFont         = smallFont;
                viewMetrics.ActionLebelHeight        = 17;
                viewMetrics.EventCaptionStringFormat = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Far);
                viewMetrics.ActionCaptionFont        = smallFont;

                viewMetrics.BookmarkPen  = new LJD.Pen(Color.FromArgb(0x5b, 0x87, 0xe0), 1);
                viewMetrics.BookmarkIcon = new LJD.Image(NSImage.ImageNamed("TimelineBookmark.png"));
                viewMetrics.UserIcon     = new LJD.Image(NSImage.ImageNamed("UserAction.png"));
                viewMetrics.APIIcon      = new LJD.Image(NSImage.ImageNamed("APICall.png"));

                viewMetrics.FocusedMessageLineTop = new LJD.Image(NSImage.ImageNamed("FocusedMsgSlaveVert.png"));
                viewMetrics.FocusedMessagePen     = new LJD.Pen(Color.Blue, 1);

                viewMetrics.MeasurerTop          = 25;
                viewMetrics.MeasurerPen          = new LJD.Pen(Color.DarkGreen, 1f, new[] { 4f, 2f });
                viewMetrics.MeasurerTextFont     = smallFont;
                viewMetrics.MeasurerTextBrush    = new LJD.Brush(Color.Black);
                viewMetrics.MeasurerTextBoxBrush = new LJD.Brush(Color.White);
                viewMetrics.MeasurerTextBoxPen   = new LJD.Pen(Color.DarkGreen, 1f);
                viewMetrics.MeasurerTextFormat   = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Center);

                viewMetrics.NavigationPanel_InvisibleBackground = new LJD.Brush(Color.FromArgb(235, 235, 235));
                viewMetrics.NavigationPanel_VisibleBackground   = new LJD.Brush(Color.White);
                viewMetrics.VisibleRangePen    = new LJD.Pen(Color.Gray, 1f);
                viewMetrics.SystemControlBrush = viewMetrics.NavigationPanel_InvisibleBackground;

                viewMetrics.ActivityBarRectPaddingY    = 5;
                viewMetrics.TriggerLinkWidth           = 8;
                viewMetrics.DistnanceBetweenRulerMarks = 40;
                viewMetrics.VisibleRangeResizerWidth   = 8;
            }

            viewMetrics.VScrollBarValue = (int)(vertScroller.DoubleValue * VertScrollerValueRange);
        }
Exemplo n.º 5
0
        public GraphicsResources(
            IViewModel viewModel,
            string fontName,
            float activitesCaptionsFontSize,
            float actionCaptionsFontSize,
            float rulerMarkFontSize,
            LJD.Image userIcon,
            LJD.Image apiIcon,
            LJD.Image bookmarkIcon,
            LJD.Image focusedMessageLineTop,
            float pensScale,
            LJD.Brush systemControlBrush
            )
        {
            bool isDark() => viewModel.ColorTheme == Presenters.ColorThemeMode.Dark;

            ActivitesCaptionsFont  = new LJD.Font(fontName, activitesCaptionsFontSize);
            ActivitesCaptionsBrush = LJD.Brushes.Text;

            ActionCaptionFont = new LJD.Font(fontName, actionCaptionsFontSize);
            RulerMarkFont     = new LJD.Font(fontName, rulerMarkFontSize);

            UserIcon     = userIcon;
            APIIcon      = apiIcon;
            BookmarkIcon = bookmarkIcon;

            selectedActivityBackgroundBrush = Selectors.Create(isDark,
                                                               dark => new LJD.Brush(dark ? Color.FromArgb(40, 80, 120) : Color.FromArgb(187, 196, 221)));

            RulerMarkBrush = LJD.Brushes.Text;
            rulerLinePen   = Selectors.Create(isDark, dark =>
                                              new LJD.Pen(dark ? Color.DarkGray : Color.LightGray, 1));

            Color adjust(Color cl, bool dark) => dark?cl.MakeDarker(60) : cl;

            procedureBrush        = Selectors.Create(isDark, dark => new LJD.Brush(adjust(Color.LightBlue, dark)));
            lifetimeBrush         = Selectors.Create(isDark, dark => new LJD.Brush(adjust(Color.LightGreen, dark)));
            networkMessageBrush   = Selectors.Create(isDark, dark => new LJD.Brush(adjust(Color.LightSalmon, dark)));
            unknownActivityBrush  = Selectors.Create(isDark, dark => new LJD.Brush(adjust(Color.LightGray, dark)));
            ActivitiesTopBoundPen = new LJD.Pen(Color.Gray, 1);

            milestonePen = Selectors.Create(isDark,
                                            dark => new LJD.Pen(dark ? Color.FromArgb(0, 67, 175) : Color.FromArgb(180, Color.SteelBlue), pensScale * 3f));
            activityBarBoundsPen = Selectors.Create(isDark,
                                                    dark => new LJD.Pen(dark ? Color.White : Color.Gray, 1f));
            ActivitiesConnectorPen = new LJD.Pen(Color.DarkGray, pensScale * 1f, new[] { 1f, 1f });

            PhaseBrushes = new LJD.Brush[]
            {
                new LJD.Brush(Color.FromArgb(255, 170, 170, 170)),
                new LJD.Brush(Color.FromArgb(255, 0, 150, 136)),
                new LJD.Brush(Color.FromArgb(255, 63, 72, 204)),
                new LJD.Brush(Color.FromArgb(255, 34, 175, 76)),
            };

            UserEventPen             = new LJD.Pen(Color.Salmon, pensScale * 2f);
            EventRectBrush           = new LJD.Brush(Color.Salmon);
            EventRectPen             = new LJD.Pen(Color.Gray, 1);
            EventCaptionBrush        = new LJD.Brush(Color.Black);
            EventCaptionFont         = ActionCaptionFont;
            EventCaptionStringFormat = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Far);

            BookmarkPen = new LJD.Pen(Color.FromArgb(0x5b, 0x87, 0xe0), pensScale * 1f);

            FocusedMessagePen     = new LJD.Pen(Color.Blue, pensScale * 1f);
            FocusedMessageLineTop = focusedMessageLineTop;

            MeasurerPen          = new LJD.Pen(Color.DarkGreen, pensScale * 1f, new[] { 4f, 2f });
            MeasurerTextFont     = new LJD.Font(fontName, rulerMarkFontSize);
            MeasurerTextBrush    = new LJD.Brush(Color.Black);
            MeasurerTextBoxBrush = new LJD.Brush(Color.White);
            MeasurerTextBoxPen   = new LJD.Pen(Color.DarkGreen, 1f);
            MeasurerTextFormat   = new LJD.StringFormat(StringAlignment.Center, StringAlignment.Center);

            navigationPanel_InvisibleBackground = Selectors.Create(isDark,
                                                                   dark => dark ? LJD.Brushes.TextBackground : new LJD.Brush(Color.FromArgb(235, 235, 235)));
            navigationPanel_VisibleBackground = Selectors.Create(isDark,
                                                                 dark => new LJD.Brush(dark ? Color.FromArgb(60, 60, 60) : Color.White));
            SystemControlBrush = systemControlBrush;
            VisibleRangePen    = new LJD.Pen(Color.Gray, 1f);

            foldingSignPen = Selectors.Create(isDark,
                                              dark => dark? LJD.Pens.White : LJD.Pens.Black);
        }