Beispiel #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);
        }
Beispiel #2
0
        private void CreateGuides()
        {
            _guideList = new List <IGuide>();

            if (ColumnsCount > 0)
            {
                CreateVerticalGuides();
            }

            if (RowsCount > 0)
            {
                CreateHorizontalGuides();
            }

            if (_isGlobalChecked)
            {
                CreateGlobalGuideCommand cmd = new CreateGlobalGuideCommand(_document, _guideList);
                CurrentUndoManager.Push(cmd);
            }
            else
            {
                IPageView pageView = _page.PageViews.GetPageView(SelectionService.GetCurrentPage().CurAdaptiveViewGID);
                if (pageView == null)
                {
                    pageView = _page.PageViews.GetPageView(_document.AdaptiveViewSet.Base.Guid);
                }
                if (pageView == null)
                {
                    return;
                }
                CreatePageGuideCommand cmd = new CreatePageGuideCommand(pageView, _guideList);
                CurrentUndoManager.Push(cmd);
            }
        }