diff bindings.c @ 2532:f4a471730ba4

Implement clipboard paste for SC-3000
author Michael Pavone <pavone@retrodev.com>
date Tue, 26 Nov 2024 23:47:38 -0800
parents f973651b48d7
children df6dbf229e2f
line wrap: on
line diff
--- a/bindings.c	Mon Nov 25 22:44:03 2024 -0800
+++ b/bindings.c	Tue Nov 26 23:47:38 2024 -0800
@@ -47,7 +47,8 @@
 	UI_CRAM_DEBUG,
 	UI_COMPOSITE_DEBUG,
 	UI_OSCILLOSCOPE_DEBUG,
-	UI_CD_GRAPHICS_DEBUG
+	UI_CD_GRAPHICS_DEBUG,
+	UI_PASTE
 } ui_action;
 
 typedef struct {
@@ -486,6 +487,15 @@
 				}*/
 				break;
 			}
+		case UI_PASTE:
+			if (allow_content_binds) {
+				if (current_system->paste_buffer) {
+					free(current_system->paste_buffer);
+				}
+				current_system->paste_buffer = render_read_clipboard();
+				current_system->paste_cur_char = 0;
+			}
+			break;
 		}
 		break;
 	}
@@ -722,6 +732,8 @@
 			*subtype_a = UI_OSCILLOSCOPE_DEBUG;
 		} else if (!strcmp(target + 3, "cd_graphics_debug")) {
 			*subtype_a = UI_CD_GRAPHICS_DEBUG;
+		} else if (!strcmp(target + 3, "paste")) {
+			*subtype_a = UI_PASTE;
 		} else {
 			warning("Unreconized UI binding type %s\n", target);
 			return 0;