From 47e68b48a085efbc0a71b7814659dba159314475 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 15 Jun 2026 00:52:40 +0100 Subject: Added type lookup to file selector. Removed old CVS tags. Added SDL keysym to char lookup. --- src/gui.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 23 deletions(-) (limited to 'src/gui.c') diff --git a/src/gui.c b/src/gui.c index 6904d33..b5c3b98 100644 --- a/src/gui.c +++ b/src/gui.c @@ -37,6 +37,7 @@ #include "gui.h" #include "gfx.h" #include "exit.h" +#include "symtochar.h" #include "util.h" @@ -57,6 +58,8 @@ #define LOGREY GFXRGB(100,100,100) #define GREEN GFXRGB(100,255,100) +#define MAX_MATCH 20 + /* ---------------------------------------- TYPES */ @@ -118,6 +121,7 @@ static int DoList(const char *title, int no, char * const list[], int *option) int cur; int done; int f; + char match[MAX_MATCH + 1] = {0}; if (no==0) return -1; @@ -180,29 +184,6 @@ static int DoList(const char *title, int no, char * const list[], int *option) done=TRUE; break; - case SDLK_SPACE: - if (option) - option[cur]=!option[cur]; - break; - - case SDLK_i: - if (option) - for(f=0;fkey.keysym.sym) + { + case SDLK_SPACE: + option[cur]=!option[cur]; + break; + + case SDLK_i: + for(f=0;fkey.keysym.sym); + size_t l = strlen(match); + + if (c && l < MAX_MATCH) + { + int found = FALSE; + + match[l++] = c; + match[l] = 0; + + for(f = 0; f < no && !found; f++) + { + if (StartsWith(list[f], match, l)) + { + found = TRUE; + + cur = f; + + if (cur < top) + { + top = cur; + } + + if (cur > top + max - 2) + { + top = cur - max + 2; + } + } + } + } + } } return cur; -- cgit v1.3