コード例 #1
0
        private void Activated(object sender, EventArgs e)
        {
            var cb = Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));

            if (cb.WaitIsImageAvailable())
            {
                using (var image = cb.WaitForImage()) {
                    if (image != null)
                    {
                        PintaCore.Workspace.NewDocumentFromImage(image);
                        return;
                    }
                }
            }

            PasteAction.ShowClipboardEmptyDialog();
        }
コード例 #2
0
        private void Activated(object sender, EventArgs e)
        {
            // If no documents are open, activate the
            // PasteIntoNewImage action and abort this Paste action.
            if (!PintaCore.Workspace.HasOpenDocuments)
            {
                PintaCore.Actions.Edit.PasteIntoNewImage.Activate();
                return;
            }

            var doc = PintaCore.Workspace.ActiveDocument;

            // Get the scroll position in canvas co-ordinates
            var view = (Viewport)doc.Workspace.Canvas.Parent;

            var canvasPos = doc.Workspace.WindowPointToCanvas(
                view.Hadjustment.Value,
                view.Vadjustment.Value);

            // Paste into the active document.
            // The 'true' argument indicates that paste should be
            // performed into a new layer.
            PasteAction.Paste(doc, true, (int)canvasPos.X, (int)canvasPos.Y);
        }