+ if (edit_mode != ED_MODE_DRAWING)
+ return;
+
+ char part[MAX_CB_PART_SIZE + 1] = "";
+ char text[MAX_CB_TEXT_SIZE + 1] = "";
+ int width = (draw_with_brush ? brush_width : lev_fieldx);
+ int height = (draw_with_brush ? brush_height : lev_fieldy);
+ char *format = "%s%03d";
+
+ for (y = 0; y < height; y++)
+ for (x = 0; x < width; x++)
+ if ((draw_with_brush ? brush_buffer[x][y] : Feld[x][y]) > 999)
+ format = "%s%04d";
+
+ for (y = 0; y < height; y++)
+ {
+ for (x = 0; x < width; x++)
+ {
+ int element = (draw_with_brush ? brush_buffer[x][y] : Feld[x][y]);
+ char *prefix = (mode == CB_DUMP_BRUSH ||
+ mode == CB_BRUSH_TO_CLIPBOARD ? "`" : "¸");
+
+ if (element >= NUM_FILE_ELEMENTS)
+ element = EL_UNKNOWN;
+
+ // copy brush to level sketch text buffer for the R'n'D forum:
+ // - large tiles: `xxx or `xxxx (0x60 ASCII)
+ // - small tiles: ¸xxx or ¸xxxx (0xb8 ISO-8859-1, 0xc2b8 UTF-8)
+ snprintf(part, MAX_CB_PART_SIZE + 1, format, prefix, element);
+ strcat(text, part);
+ }
+
+ strcat(text, "\n");
+ }
+
+ if (mode == CB_BRUSH_TO_CLIPBOARD ||
+ mode == CB_BRUSH_TO_CLIPBOARD_SMALL)
+ SDL_SetClipboardText(text);
+ else
+ printf("%s", text);
+
+ return;
+ }
+
+ if (mode == CB_CLIPBOARD_TO_BRUSH)
+ {
+ if (edit_mode != ED_MODE_DRAWING)
+ return;
+
+ if (!SDL_HasClipboardText())