Exemple #1
0
        public void AddVertGuideLineHandler(object obj)
        {
            if (GuideType == GuideType.Global || _page == null || _pageView == null)
            {
                return;
            }

            var values = (object[])obj;

            Ruler ruler = values[0] as Ruler;
            PageEditorViewModel editor = values[1] as PageEditorViewModel;

            System.Windows.Point point = Mouse.GetPosition(ruler);
            IGuide            guide    = _pageView.CreateGuide(Orientation.Vertical, (point.X + ruler.CountShift) / Scale, 0);
            VerticalGuideLine vLine    = new VerticalGuideLine(guide, GuideType.Local, editor.EditorScale);

            editor.EditorCanvas.Focus();
            GuideItems.Add(vLine);
            _document.IsDirty = true;

            List <IGuide> guides = new List <IGuide>();

            guides.Add(guide);
            CreatePageGuideCommand cmd = new CreatePageGuideCommand(_pageView, guides);

            CurrentUndoManager.Push(cmd);

            ShowGuide(editor);
        }
Exemple #2
0
        private void MoveThumb_DragCompleted(object sender, DragCompletedEventArgs e)
        {
            this.guideItem.IsSelected = false;
            if (this.adorner != null)
            {
                AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
                if (adornerLayer != null)
                {
                    adornerLayer.Remove(this.adorner);
                }
                this.adorner = null;
            }

            // redo/undo
            if (pageUndoManager == null)
            {
                return;
            }
            if (this.guideItem is HorizontalGuideLine)
            {
                HorizontalGuideLine        hGuide = this.guideItem as HorizontalGuideLine;
                GuidePropertyChangeCommand cmd    = new GuidePropertyChangeCommand(hGuide.Guide, "Y", oldPos, guideItem.Guide.Y);
                pageUndoManager.Push(cmd);
            }
            else
            {
                VerticalGuideLine          hGuide = this.guideItem as VerticalGuideLine;
                GuidePropertyChangeCommand cmd    = new GuidePropertyChangeCommand(hGuide.Guide, "X", oldPos, guideItem.Guide.X);
                pageUndoManager.Push(cmd);
            }
        }
Exemple #3
0
 private void ChangeScale(double scale)
 {
     foreach (var item in GuideItems)
     {
         VerticalGuideLine vline = item as VerticalGuideLine;
         if (vline != null)
         {
             vline.Scale = scale;
         }
         else
         {
             (item as HorizontalGuideLine).Scale = scale;
         }
     }
 }