Skip to content

Commit

Permalink
Add "Copy Image to clipboard" functionality (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiolo authored Dec 5, 2022
1 parent b95e8e0 commit 08bbc84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ enum {
A_IMAGESCP,
A_IMAGESCF,
A_IMAGESCN,
A_IMAGECPY,
A_HELPI,
A_HELP_OP_REF,
A_REDO,
Expand Down
1 change: 1 addition & 0 deletions src/myframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)"),
Expand Down

0 comments on commit 08bbc84

Please sign in to comment.