Example #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);
        }
Example #2
0
        private void DeleteGlobalGuide(IGuide guide)
        {
            if (_document != null)
            {
                List <IGuide> guides = new List <IGuide>();
                guides.Add(guide);
                DeleteGlobalGuideCommand cmd = new DeleteGlobalGuideCommand(_document, guides);
                CurrentUndoManager.Push(cmd);

                //Remove from View
                GuideItems.Remove(GuideItems.FirstOrDefault(x => x.Guide == guide));
                //Remove from doc
                _document.DeleteGlobalGuide(guide.Guid);
            }
        }
Example #3
0
        private void LoadGlobalGuide()
        {
            GuideItems.Clear();

            if (_document != null)
            {
                foreach (IGuide item in _document.GlobalGuides)
                {
                    switch (item.Orientation)
                    {
                    case Orientation.Horizontal:
                        GuideItems.Add(new HorizontalGuideLine(item as IGuide, GuideType.Global, scale));
                        break;

                    case Orientation.Vertical:
                        GuideItems.Add(new VerticalGuideLine(item as IGuide, GuideType.Global, scale));
                        break;
                    }
                }
            }
        }
Example #4
0
        private void LoadPageGuide()
        {
            GuideItems.Clear();

            if (_page != null && _pageView != null)
            {
                foreach (IGuide item in _pageView.Guides)
                {
                    switch (item.Orientation)
                    {
                    case Orientation.Horizontal:
                        GuideItems.Add(new HorizontalGuideLine(item as IGuide, GuideType.Local, scale));
                        break;

                    case Orientation.Vertical:
                        GuideItems.Add(new VerticalGuideLine(item as IGuide, GuideType.Local, scale));
                        break;
                    }
                }
            }
        }