public void ClearSelection()
        {
            _actionButtonsTimer.Stop();
            SelectionActions.Hide();

            FirstSelectionText          = LastSelectionText = null;
            SelectionPolygon.Visibility = Visibility.Collapsed;

            RightSelectionItem.Visibility = LeftSelectionItem.Visibility = Visibility.Collapsed;
        }
        public void SetSelection(TextRenderData wa, TextRenderData wb)
        {
            SelectionActions.Hide();

            Rect    rect = wa.Rect;
            Rect    lastSelectionRect = wb.Rect;
            Polygon currentPolygon    = SelectionPolygon;

            if (currentPolygon == null)
            {
                return;
            }
            if (rect.Top > lastSelectionRect.Top || Math.Abs(rect.Top - lastSelectionRect.Top) < 0.0001 && rect.Left > lastSelectionRect.Left)
            {
                TextRenderData textContext = wa;
                wa = wb;
                wb = textContext;
            }
            if (FirstSelectionText == wa && LastSelectionText == wb)
            {
                return;
            }
            FirstSelectionText = wa;
            LastSelectionText  = wb;
            Rect firstSelectionRect = wa.Rect;

            lastSelectionRect = wb.Rect;
            PointCollection selectionPolygon = GetSelectionPolygon(firstSelectionRect, lastSelectionRect, GetCurrentPagePanel().ActualWidth);

            currentPolygon.Points     = selectionPolygon;
            currentPolygon.Fill       = AppSettings.Default.ColorScheme.SelectionBrush;
            currentPolygon.Visibility = Visibility.Visible;



            BuildSelectionItem(LeftSelectionItem, firstSelectionRect.Left - 11, firstSelectionRect.Top, firstSelectionRect.Height);
            BuildSelectionItem(RightSelectionItem, lastSelectionRect.Right - 11, lastSelectionRect.Top, lastSelectionRect.Height);

            var tmp = (firstSelectionRect.Left + SelectionActions.Width + OffsetX) - GetCurrentPagePanel().ActualWidth;

            tmp = tmp < 0 ? 0 : tmp;
            var leftMargin = firstSelectionRect.Left - tmp;

            var topMargin = firstSelectionRect.Top - SelectionActions.Height - 12;

            topMargin = topMargin < 0 ? 0 : topMargin;

            SelectionActions.Margin = new Thickness(leftMargin, topMargin, 0, 0);
        }
        public void Clear()
        {
            foreach (Panel p in RootGrid.Children)
            {
                p.Children.Clear();
            }

            if (Manipulator != null)
            {
                Manipulator.Dispose();
            }

            SelectionActions.Hide();
            SelectionPolygon.Visibility   = Visibility.Collapsed;
            LeftSelectionItem.Visibility  = Visibility.Collapsed;
            RightSelectionItem.Visibility = Visibility.Collapsed;
        }
 public void ShowActionButtons()
 {
     SelectionActions.Hide();
     _actionButtonsTimer.Stop();
     _actionButtonsTimer.Start();
 }