From 08bbc84ed76e76444327cc13cbf39c9710285dfb Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Mon, 5 Dec 2022 06:52:53 +0100 Subject: [PATCH] Add "Copy Image to clipboard" functionality (#294) --- src/document.h | 11 +++++++++++ src/main.cpp | 1 + src/myframe.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/document.h b/src/document.h index 9797f277..947639c3 100755 --- a/src/document.h +++ b/src/document.h @@ -1548,6 +1548,17 @@ struct Document { return nullptr; } + case A_IMAGECPY: { + if(!c->text.image) return _(L"No image in this cell."); + if (selected.Thin()) return NoThin(); + + if (wxTheClipboard->Open()) { + wxTheClipboard->SetData(new wxBitmapDataObject(c->text.image->bm_orig)); + wxTheClipboard->Close(); + } + return _(L"Image copied to clipboard"); + } + case A_IMAGESCP: case A_IMAGESCF: { if (!c->text.image) return _(L"No image in this cell."); diff --git a/src/main.cpp b/src/main.cpp index e1d2ee96..4f9ed72d 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -218,6 +218,7 @@ enum { A_IMAGESCP, A_IMAGESCF, A_IMAGESCN, + A_IMAGECPY, A_HELPI, A_HELP_OP_REF, A_REDO, diff --git a/src/myframe.h b/src/myframe.h index 047b1a25..263df6a3 100755 --- a/src/myframe.h +++ b/src/myframe.h @@ -360,6 +360,7 @@ struct MyFrame : wxFrame { wxMenu *imgmenu = new wxMenu(); MyAppend(imgmenu, A_IMAGE, _(L"&Add Image"), _(L"Adds an image to the selected cell")); + MyAppend(imgmenu, A_IMAGECPY, _(L"Copy Image to clipboard"), _(L"Copy the image in the selected cell to the clipboard")); MyAppend(imgmenu, A_IMAGESCP, _(L"&Scale Image (re-sample pixels)"), _(L"Change the image size if it is too big, by reducing the amount of pixels")); MyAppend(imgmenu, A_IMAGESCF, _(L"&Scale Image (display only)"),