예제 #1
0
		void IView.EnsureActivityVisible (int activityIndex)
		{
			int y = Metrics.GetActivityY(viewMetrics, activityIndex);
			if (y > 0 && (y + viewMetrics.LineHeight) < viewMetrics.ActivitiesViewHeight)
				return;
			var scrollerPos = viewMetrics.RulersPanelHeight - viewMetrics.ActivitiesViewHeight / 2 
				+ activityIndex * viewMetrics.LineHeight;
			scrollerPos = Math.Max(0, scrollerPos);
			vertScroller.DoubleValue = (double)scrollerPos / VertScrollerValueRange;
			UpdateViewMetrics ();
			InvalidateInternal (ViewAreaFlag.ActivitiesCaptionsView | ViewAreaFlag.ActivitiesBarsView);
		}
예제 #2
0
        void IView.EnsureActivityVisible(int activityIndex)
        {
            var vm = GetUpToDateViewMetrics();
            int y  = Metrics.GetActivityY(vm, activityIndex);

            if (y > 0 && (y + vm.LineHeight) < activitiesViewPanel.Height)
            {
                return;
            }
            var scrollerPos = vm.RulersPanelHeight - activitiesViewPanel.Height / 2 + activityIndex * vm.LineHeight;

            scrollerPos = Math.Max(0, scrollerPos);
            activitiesScrollBar.Value = scrollerPos;
        }
예제 #3
0
        public static void DrawCaptionsView(
            LJD.Graphics g,
            ViewMetrics viewMetrics,
            IViewEvents eventsHandler,
            int sequenceDiagramAreaWidth,
            Action <string, Rectangle, int, int, bool> drawCaptionWithHighlightedRegion
            )
        {
            PushGraphicsStateForDrawingActivites(g, viewMetrics, HitTestResult.AreaCode.CaptionsPanel);

            int availableHeight = viewMetrics.ActivitiesViewHeight;

            foreach (var a in eventsHandler.OnDrawActivities())
            {
                int y = Metrics.GetActivityY(viewMetrics, a.Index);
                if (y < 0)
                {
                    continue;
                }
                if (y > availableHeight)
                {
                    break;
                }

                var h = viewMetrics.LineHeight - 1;
                var sequenceDiagramTextRect = new Rectangle(0, y, sequenceDiagramAreaWidth, h);
                var textRect = new Rectangle(
                    sequenceDiagramTextRect.Right + 3 /* text padding */, y, viewMetrics.ActivitesCaptionsViewWidth - sequenceDiagramTextRect.Right, h);
                var lineRect = new Rectangle(0, y, viewMetrics.ActivitesCaptionsViewWidth, h);
                if (a.IsSelected)
                {
                    g.FillRectangle(viewMetrics.SelectedLineBrush, lineRect);
                }
                else if (a.Color.HasValue)
                {
                    using (var bgBrush = MakeBrush(a.Color.Value))
                        g.FillRectangle(bgBrush, lineRect);
                }
                if (!string.IsNullOrEmpty(a.SequenceDiagramText))
                {
                    g.DrawString(a.SequenceDiagramText, viewMetrics.ActivitesCaptionsFont, viewMetrics.ActivitesCaptionsBrush, sequenceDiagramTextRect);
                }
                drawCaptionWithHighlightedRegion(a.Caption, textRect, a.CaptionSelectionBegin, a.CaptionSelectionLength, a.IsError);
            }

            g.PopState();
        }