Orca UI support

This commit is contained in:
Ilia Demianenko 2023-07-13 21:36:31 -07:00
parent 9e8a0f5f69
commit 8bfbabd877
3 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,6 @@
#include"util/typedefs.h"
#include"platform_clock.h"
void ORCA_IMPORT(mp_clock_init)();
f64 ORCA_IMPORT(mp_get_time)(mp_clock_kind clock);

View File

@ -10,6 +10,7 @@
#define __PLATFORM_CLOCK_H_ #define __PLATFORM_CLOCK_H_
#include"util/typedefs.h" #include"util/typedefs.h"
#include"platform.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -2249,6 +2249,7 @@ str32 ui_edit_delete_selection(ui_context* ui, str32 codepoints)
void ui_edit_copy_selection_to_clipboard(ui_context* ui, str32 codepoints) void ui_edit_copy_selection_to_clipboard(ui_context* ui, str32 codepoints)
{ {
#if !PLATFORM_ORCA
if(ui->editCursor == ui->editMark) if(ui->editCursor == ui->editMark)
{ {
return; return;
@ -2260,13 +2261,18 @@ void ui_edit_copy_selection_to_clipboard(ui_context* ui, str32 codepoints)
mp_clipboard_clear(); mp_clipboard_clear();
mp_clipboard_set_string(string); mp_clipboard_set_string(string);
#endif
} }
str32 ui_edit_replace_selection_with_clipboard(ui_context* ui, str32 codepoints) str32 ui_edit_replace_selection_with_clipboard(ui_context* ui, str32 codepoints)
{ {
#if PLATFORM_ORCA
str32 result = {0};
#else
str8 string = mp_clipboard_get_string(&ui->frameArena); str8 string = mp_clipboard_get_string(&ui->frameArena);
str32 input = utf8_push_to_codepoints(&ui->frameArena, string); str32 input = utf8_push_to_codepoints(&ui->frameArena, string);
str32 result = ui_edit_replace_selection_with_codepoints(ui, codepoints, input); str32 result = ui_edit_replace_selection_with_codepoints(ui, codepoints, input);
#endif
return(result); return(result);
} }
@ -2297,7 +2303,7 @@ typedef struct ui_edit_command
} ui_edit_command; } ui_edit_command;
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_ORCA
#define OS_COPY_PASTE_MOD MP_KEYMOD_CTRL #define OS_COPY_PASTE_MOD MP_KEYMOD_CTRL
#elif PLATFORM_MACOS #elif PLATFORM_MACOS
#define OS_COPY_PASTE_MOD MP_KEYMOD_CMD #define OS_COPY_PASTE_MOD MP_KEYMOD_CMD