예제 #1
0
        void SetNavigationCursor(Point pt)
        {
            var m = Metrics.GetNavigationPanelMetrics(viewMetrics, eventsHandler);

            string toolTip = null;

            if (m.Resizer1.Contains(pt))
            {
                NSCursor.ResizeLeftCursor.Set();
                toolTip = "Drag to resize visible area";
            }
            else if (m.Resizer2.Contains(pt))
            {
                NSCursor.ResizeRightCursor.Set();
                toolTip = "Drag to resize visible area";
            }
            else if (m.VisibleRangeBox.Contains(pt))
            {
                NSCursor.OpenHandCursor.Set();
                toolTip = "Drag to move visible area";
            }

            if (toolTip != null)
            {
                navigatorView.ToolTip = toolTip;
            }
            else
            {
                navigatorView.RemoveAllToolTips();
            }
        }
예제 #2
0
		void HandleNavigatorViewMouseDown(NSEvent e)
		{
			var pt = navigatorView.ConvertPointFromView(e.LocationInWindow, null).ToPoint();

			var m = Metrics.GetNavigationPanelMetrics(viewMetrics, eventsHandler);
			if (m.Resizer1.Contains(pt))
			{
				currentNavigationOp = new CurrentNavigationOp()
				{
					beginDeltaX = m.VisibleRangeBox.X - pt.X
				};
			}
			else if (m.Resizer2.Contains(pt))
			{
				currentNavigationOp = new CurrentNavigationOp()
				{
					endDeltaX = m.VisibleRangeBox.Right - pt.X
				};
			}
			else if (m.VisibleRangeBox.Contains(pt))
			{
				currentNavigationOp = new CurrentNavigationOp()
				{
					beginDeltaX = m.VisibleRangeBox.X - pt.X,
					endDeltaX = m.VisibleRangeBox.Right - pt.X
				};
			}
			else
			{
				if (viewMetrics.NavigationPanelWidth != 0)
					eventsHandler.OnNavigation((double)pt.X / (double)viewMetrics.NavigationPanelWidth);
			}
		}
예제 #3
0
        public static void DrawNavigationPanel(
            LJD.Graphics g,
            ViewMetrics viewMetrics,
            IViewEvents eventsHandler)
        {
            var panelClientRect = new Rectangle(0, 0, viewMetrics.NavigationPanelWidth, viewMetrics.NavigationPanelHeight);

            g.FillRectangle(viewMetrics.NavigationPanel_InvisibleBackground, panelClientRect);

            var m = Metrics.GetNavigationPanelMetrics(viewMetrics, eventsHandler);

            g.FillRectangle(viewMetrics.NavigationPanel_VisibleBackground, m.VisibleRangeBox);

            DrawRulerLines(g, viewMetrics, eventsHandler, DrawScope.AvailableRange, panelClientRect.Size);

            double width = (double)viewMetrics.NavigationPanelWidth;

            foreach (var evt in eventsHandler.OnDrawEvents(DrawScope.AvailableRange))
            {
                int x = (int)(evt.X * width);
                g.DrawLine(viewMetrics.UserEventPen, x, 0, x, viewMetrics.NavigationPanelHeight);
            }

            foreach (var evt in eventsHandler.OnDrawBookmarks(DrawScope.AvailableRange))
            {
                int x = (int)(evt.X * width);
                g.DrawLine(viewMetrics.BookmarkPen, x, 0, x, viewMetrics.NavigationPanelHeight);
            }

            var focusedMessagePos = eventsHandler.OnDrawFocusedMessage(DrawScope.AvailableRange);

            if (focusedMessagePos.HasValue && focusedMessagePos.Value >= 0 && focusedMessagePos.Value <= 1)
            {
                int x = (int)(focusedMessagePos.Value * width);
                g.DrawLine(viewMetrics.FocusedMessagePen, x, 0, x, viewMetrics.NavigationPanelHeight);
            }

            ResizerDrawing.DrawResizer(g, m.Resizer1, viewMetrics.SystemControlBrush);
            ResizerDrawing.DrawResizer(g, m.Resizer2, viewMetrics.SystemControlBrush);

            Rectangle visibleRangeBox = m.VisibleRangeBox;

            visibleRangeBox.Width = Math.Max(visibleRangeBox.Width, 1);
            g.DrawRectangle(viewMetrics.VisibleRangePen, visibleRangeBox);
        }
예제 #4
0
        private void navigationPanel_SetCursor(object sender, HandledMouseEventArgs e)
        {
            if (eventsHandler == null)
            {
                return;
            }

            var vm = GetUpToDateViewMetrics();
            var m  = Metrics.GetNavigationPanelMetrics(vm, eventsHandler);

            if (m.Resizer1.Contains(e.Location) || m.Resizer2.Contains(e.Location))
            {
                Cursor.Current = Cursors.SizeWE;
                e.Handled      = true;
            }
            else if (m.VisibleRangeBox.Contains(e.Location))
            {
                Cursor.Current = Cursors.SizeAll;
                e.Handled      = true;
            }
        }
예제 #5
0
        private void navigationPanel_MouseDown(object sender, MouseEventArgs e)
        {
            if (eventsHandler == null)
            {
                return;
            }
            var vm = GetUpToDateViewMetrics();
            var m  = Metrics.GetNavigationPanelMetrics(vm, eventsHandler);

            if (m.Resizer1.Contains(e.Location))
            {
                currentNavigationOp = new CurrentNavigationOp()
                {
                    beginDeltaX = m.VisibleRangeBox.X - e.X
                };
            }
            else if (m.Resizer2.Contains(e.Location))
            {
                currentNavigationOp = new CurrentNavigationOp()
                {
                    endDeltaX = m.VisibleRangeBox.Right - e.X
                };
            }
            else if (m.VisibleRangeBox.Contains(e.Location))
            {
                currentNavigationOp = new CurrentNavigationOp()
                {
                    beginDeltaX = m.VisibleRangeBox.X - e.X,
                    endDeltaX   = m.VisibleRangeBox.Right - e.X
                };
            }
            else
            {
                if (navigationPanel.Width != 0)
                {
                    eventsHandler.OnNavigation((double)e.X / (double)navigationPanel.Width);
                }
            }
        }