From f83d726836c29ef7333bcd3f5dd4c69bf79df9bc Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Tue, 20 Dec 2022 06:37:01 +0100 Subject: [PATCH] Apply image scale operations to multiple cells (#316) --- src/document.h | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/document.h b/src/document.h index 09ac10d7..9dbfd7ac 100755 --- a/src/document.h +++ b/src/document.h @@ -1500,6 +1500,32 @@ struct Document { selected.HomeEnd(this, dc, k == A_HOME || k == A_CHOME); return nullptr; + + case A_IMAGESCP: + case A_IMAGESCF: { + long v = 0; + loopallcellssel(c, true) { + if(c->text.image) { + if(!v) { + v = wxGetNumberFromUser( + _(L"Please enter the percentage you want the image scaled by:"), L"%", + _(L"Image Resize"), 50, 5, 400, sys->frame); + if (v < 0) return nullptr; + } + auto sc = v / 100.0; + if (k == A_IMAGESCP) { + c->text.image->BitmapScale(sc); + } else { + c->text.image->DisplayScale(sc); + } + c->ResetLayout(); + } + } + Refresh(); + return nullptr; + } + + case A_IMAGESCN: { loopallcellssel(c, true) if (c->text.image) { @@ -1579,24 +1605,6 @@ struct Document { return CopyImageToClipboard(c); } - case A_IMAGESCP: - case A_IMAGESCF: { - if (!c->text.image) return _(L"No image in this cell."); - long v = wxGetNumberFromUser( - _(L"Please enter the percentage you want the image scaled by:"), L"%", - _(L"Image Resize"), 50, 5, 400, sys->frame); - if (v < 0) return nullptr; - auto sc = v / 100.0; - if (k == A_IMAGESCP) { - c->text.image->BitmapScale(sc); - } else { - c->text.image->DisplayScale(sc); - } - c->ResetLayout(); - Refresh(); - return nullptr; - } - case A_ENTERGRID: if (!c->grid) Action(dc, A_NEWGRID); selected = Selection(c->grid, 0, 0, 1, 1);