Prévia do scratchblocks antes de exportar, copiar para o fórum e colar

- "Exportar scratchblocks" abre uma prévia do texto (rolável) com Copiar
  (já com [scratchblocks]...[/scratchblocks]), Salvar... e Fechar.
- "Colar scratchblocks": um script copiado do fórum vira uma aba nova.
- graphics: área de transferência no contrato (tb_graphics_set_clipboard /
  tb_graphics_get_clipboard); o SDL2 usa a do sistema e o backend nulo,
  uma memória interna (testável no harness).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mguinhosandClaude Opus 5.5 committed 2026-10-22 18:06:46 -03:00
1 parent d842890b0b
commit d9449a568e
6 files changed
+251 -11

No files matched your search

+14
View File
@@ -684,6 +684,18 @@ static void be_window_input(void* handle, TinyBlocks_GfxInput* out) {
*out = ((SdlWin*)handle)->in;
}
static bool be_clipboard_set(const char* text) {
return be_init() && SDL_SetClipboardText(text ? text : "") == 0;
}
static char* be_clipboard_get(void) {
if (!be_init() || !SDL_HasClipboardText()) return NULL;
char* t = SDL_GetClipboardText();
char* r = t ? strdup(t) : NULL;
if (t) SDL_free(t);
return r;
}
static void be_window_present(void* handle, const TinyBlocks_RenderableBlock* rb) {
SdlWin* w = (SdlWin*)handle;
SDL_SetRenderDrawColor(w->ren, 0, 0, 0, 255);
@@ -713,6 +725,8 @@ static const TinyBlocks_GraphicsBackend s_sdl2_backend = {
.window_present = be_window_present,
.measure_text = be_measure_text,
.frame_wait = be_frame_wait,
.clipboard_set = be_clipboard_set,
.clipboard_get = be_clipboard_get,
};
const TinyBlocks_GraphicsBackend* tb_sdl2_graphics_backend(void) {