Mercurial
comparison infinite_canvas/canvas.c @ 282:6bd4a3990696 default tip
Add cross-platform canvas orchestration and typed composer
Enable native ARM dependencies, macOS Copilot orchestration, portable service supervision, CPU dictation, and a shared N-key speak-or-type composer.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: f68442b1-fa8f-46a0-9689-81710613bbd4
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Thu, 20 Aug 2026 20:45:25 -0700 |
| parents | c57149ad216e |
| children |
comparison
equal
deleted
inserted
replaced
| 281:c57149ad216e | 282:6bd4a3990696 |
|---|---|
| 2109 lines, | 2109 lines, |
| 2110 CANVAS_ENTITY_TEXT_CAPACITY); | 2110 CANVAS_ENTITY_TEXT_CAPACITY); |
| 2111 p_entity->text_scroll_y = fmaxf( | 2111 p_entity->text_scroll_y = fmaxf( |
| 2112 0.0f, | 2112 0.0f, |
| 2113 (float)line_count * CANVAS_TEXT_AREA_LINE_HEIGHT - content.height); | 2113 (float)line_count * CANVAS_TEXT_AREA_LINE_HEIGHT - content.height); |
| 2114 } | |
| 2115 | |
| 2116 void Canvas_Text_Area_Focus_End( | |
| 2117 Canvas_Entity *p_entity, | |
| 2118 Font font) | |
| 2119 { | |
| 2120 if (!p_entity || p_entity->type != CANVAS_ENTITY_TEXT_AREA) return; | |
| 2121 p_entity->active = TRUE; | |
| 2122 p_entity->text_muted = FALSE; | |
| 2123 p_entity->text_cursor = (int32)strlen(p_entity->text); | |
| 2124 p_entity->text_selection_anchor = p_entity->text_cursor; | |
| 2125 Canvas_Text_Ensure_Cursor_Visible(p_entity, font); | |
| 2114 } | 2126 } |
| 2115 | 2127 |
| 2116 static void Canvas_Text_Update_Keyboard(Canvas_Entity *p_entity, Font font) | 2128 static void Canvas_Text_Update_Keyboard(Canvas_Entity *p_entity, Font font) |
| 2117 { | 2129 { |
| 2118 boolean shortcut = Canvas_Control_Is_Down(); | 2130 boolean shortcut = Canvas_Control_Is_Down(); |
| 3135 Rectangle content = Canvas_Text_Area_Content_Bounds(p_entity); | 3147 Rectangle content = Canvas_Text_Area_Content_Bounds(p_entity); |
| 3136 if (!p_entity->text[0]) { | 3148 if (!p_entity->text[0]) { |
| 3137 boolean dictation = strcmp(p_entity->label, "Dictation") == 0; | 3149 boolean dictation = strcmp(p_entity->label, "Dictation") == 0; |
| 3138 DrawTextEx( | 3150 DrawTextEx( |
| 3139 font, | 3151 font, |
| 3140 dictation ? "Speak now..." : "Type a thought for Copilot...", | 3152 dictation |
| 3153 ? "Speak with M or type with N..." | |
| 3154 : "Type a thought for Copilot...", | |
| 3141 (Vector2){content.x, content.y}, | 3155 (Vector2){content.x, content.y}, |
| 3142 CANVAS_TEXT_AREA_FONT_SIZE, | 3156 CANVAS_TEXT_AREA_FONT_SIZE, |
| 3143 CANVAS_TEXT_AREA_SPACING, | 3157 CANVAS_TEXT_AREA_SPACING, |
| 3144 p_theme->text_muted); | 3158 p_theme->text_muted); |
| 3145 DrawTextEx( | 3159 DrawTextEx( |
| 3146 font, | 3160 font, |
| 3147 dictation | 3161 dictation |
| 3148 ? "Enter to send | Backspace to clear" | 3162 ? "Enter to send | Shift+Enter for a new line" |
| 3149 : "Ctrl/Cmd+Enter to send", | 3163 : "Ctrl/Cmd+Enter to send", |
| 3150 (Vector2){content.x, content.y + 22.0f}, | 3164 (Vector2){content.x, content.y + 22.0f}, |
| 3151 12.0f, | 3165 12.0f, |
| 3152 0.0f, | 3166 0.0f, |
| 3153 Canvas_Color_Fade(p_theme->text_muted, 0.72f)); | 3167 Canvas_Color_Fade(p_theme->text_muted, 0.72f)); |