From 81d8155bd8935d47214a5f34bcc867736d5e8808 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Mon, 20 Nov 2017 13:00:43 +0300 Subject: [PATCH] Pressing CTRL+V on the palette color editing screen should set the color to the one contained in the clipboard #401 --- src/sprite.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sprite.c b/src/sprite.c index 8494a3c..2b8de18 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -637,6 +637,12 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value) } } +static void pasteColor(Sprite* sprite) +{ + fromClipboard(sprite->tic->cart.palette.data, sizeof(tic_palette), false); + fromClipboard(&sprite->tic->cart.palette.colors[sprite->color], sizeof(tic_rgb), false); +} + static void drawRGBTools(Sprite* sprite, s32 x, s32 y) { { @@ -713,8 +719,7 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y) if(checkMouseClick(&rect, SDL_BUTTON_LEFT)) { - fromClipboard(sprite->tic->cart.palette.data, sizeof(tic_palette), false); - sprite->tic->api.reset(sprite->tic); + pasteColor(sprite); } } @@ -1194,6 +1199,9 @@ static void cutToClipboard(Sprite* sprite) static void copyFromClipboard(Sprite* sprite) { + if(sprite->editPalette) + pasteColor(sprite); + s32 size = sprite->size * sprite->size * TIC_PALETTE_BPP / BITS_IN_BYTE; u8* buffer = SDL_malloc(size);