Пример #1
0
        public ClipboardItem CreateKeyImageItem(IPresentationImage image, bool ownReference = false)
        {
            Rectangle clientRectangle = image.ClientRectangle;

            if (clientRectangle.IsEmpty)
            {
                clientRectangle = new Rectangle(new Point(), image.SceneSize);
            }

            // Must build description from the source image because the ParentDisplaySet info is lost in the cloned image.
            var name        = BuildClipboardItemName(image);
            var description = BuildClipboardItemDescription(image);

            image = !ownReference?ImageExporter.ClonePresentationImage(image) : image;

            var iconGetter = new Func <ClipboardItem, Image>(item =>
            {
                _creatingItemHasChanges = item.HasChanges();
                try
                {
                    return(CreateIcon((IPresentationImage)item.Item, clientRectangle));
                }
                finally
                {
                    _creatingItemHasChanges = false;
                }
            });

            return(new ClipboardItem(image, name, description, clientRectangle, iconGetter));
        }
Пример #2
0
        /// <summary>
        /// 所有要打印的图像都保存在这个<see cref="DisplaySet"/>中
        /// </summary>

        public static void AddPresentationImage(IPresentationImage presentationImage)
        {
            if (presentationImage == null)
            {
                return;
            }
            var clonPi = ImageExporter.ClonePresentationImage(presentationImage);

            if (clonPi != null)
            {
                PresentationImage image = clonPi as PresentationImage;
                if (_imageViewerComponent != null)
                {
                    _imageViewerComponent.DisplaySet.PresentationImages.Add(image);
                    image.Selected = false;
                }
            }
        }
        public void PrintPreviewPaste()
        {
            var imageBox = this.ImageViewer.SelectedImageBox;

            if (imageBox == null || imageBox.DisplaySet == null || imageBox.SelectedTile == null || selectPresentationImages == null)
            {
                return;
            }

            var memorableCommand = new MemorableUndoableCommand(imageBox)
            {
                BeginState = CreateMemento()
            };

            if (this.Context.Viewer.SelectedPresentationImage == null)
            {
                foreach (var selectPresentationImage in selectPresentationImages)
                {
                    imageBox.DisplaySet.PresentationImages.Add(ImageExporter.ClonePresentationImage(selectPresentationImage));
                }
            }
            else
            {
                int index = imageBox.DisplaySet.PresentationImages.IndexOf(this.Context.Viewer.SelectedPresentationImage);

                for (int i = selectPresentationImages.Count - 1; i >= 0; i--)
                {
                    imageBox.DisplaySet.PresentationImages.Insert(index, ImageExporter.ClonePresentationImage(selectPresentationImages[i]));
                }
            }
            imageBox.TopLeftPresentationImageIndex = imageBox.TopLeftPresentationImageIndex;
            imageBox.Draw();
            imageBox.SelectDefaultTile();
            memorableCommand.EndState = CreateMemento();
            var historyCommand = new DrawableUndoableCommand(imageBox)
            {
                Name = SR.CommandPrintPreviewPaste
            };

            historyCommand.Enqueue(memorableCommand);
            this.Context.Viewer.CommandHistory.AddCommand(historyCommand);
            PropertyChanged();
        }
Пример #4
0
        /// <summary>
        /// Called to create a clipboard item representing a presentation image.
        /// </summary>
        /// <param name="image"></param>
        /// <param name="ownReference"></param>
        /// <returns></returns>
        public virtual ClipboardItem CreatePresentationImageItem(IPresentationImage image, bool ownReference = false)
        {
            Rectangle clientRectangle = image.ClientRectangle;

            if (clientRectangle.IsEmpty)
            {
                clientRectangle = new Rectangle(new Point(), image.SceneSize);
            }

            // Must build description from the source image because the ParentDisplaySet info is lost in the cloned image.
            var name        = BuildClipboardItemName(image);
            var description = BuildClipboardItemDescription(image);

            image = !ownReference?ImageExporter.ClonePresentationImage(image) : image;

            var bmp = CreateIcon(image, clientRectangle);

            return(new ClipboardItem(image, bmp, name, description, clientRectangle));
        }
        public void PrintPreviewCopy()
        {
            if (this.ImageViewer.SelectedImageBox == null || this.ImageViewer.SelectedImageBox.DisplaySet == null || this.Context.Viewer.SelectedPresentationImage == null)
            {
                return;
            }
            var imageBox = this.ImageViewer.SelectedImageBox;
            PrintImageViewerComponent component = this.Context.Viewer as PrintImageViewerComponent;

            if (component == null)
            {
                return;
            }

            if (selectPresentationImages == null)
            {
                selectPresentationImages = new List <IPresentationImage>();
            }
            else
            {
                selectPresentationImages.Clear();
            }

            foreach (var selectPresentationImage in component.SelectPresentationImages)
            {
                PresentationImage image = ImageExporter.ClonePresentationImage(selectPresentationImage) as PresentationImage;
                if (image == null)
                {
                    continue;
                }
                image.Selected = false;
                selectPresentationImages.Add(image);
            }

            foreach (PrintViewTile tile in imageBox.Tiles)
            {
                if (tile.PresentationImage == null)
                {
                    tile.Deselect();
                }
            }
        }
Пример #6
0
 private static IPresentationImage ClonePresentationImage(IPresentationImage presentationImage)
 {
     return(ImageExporter.ClonePresentationImage(presentationImage));
 }