From c1d084c70d3fa63eb787b57c5c6c3f511c95a357 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 16 Jan 2004 02:28:10 +0000 Subject: Added options to toggle individual breakpoints --- src/gui.c | 220 +++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 145 insertions(+), 75 deletions(-) (limited to 'src/gui.c') diff --git a/src/gui.c b/src/gui.c index c922aba..05ebc49 100644 --- a/src/gui.c +++ b/src/gui.c @@ -98,6 +98,133 @@ static void Box(const char *title, int x, int y, int width, int height) } +static int DoList(const char *title, int no, char * const list[], int *option) +{ + static const int max=GFX_HEIGHT/8-8; + SDL_Event *e; + int top; + int cur; + int done; + int f; + + if (no==0) + return -1; + + top=0; + cur=0; + + done=FALSE; + + while(!done) + { + Box(title,7,7,GFX_WIDTH-14,GFX_HEIGHT-14); + + if (option) + { + Centre("Cursors to move, RETURN to accept", + GFX_HEIGHT-44,WHITE); + Centre("SPACE toggles, I inverts all", + GFX_HEIGHT-36,WHITE); + Centre("S select all, C clear all", + GFX_HEIGHT-28,WHITE); + } + else + Centre("Cursors and RETURN to select",GFX_HEIGHT-28,WHITE); + + Centre("ESCAPE to cancel",GFX_HEIGHT-20,WHITE); + + for(f=0;fkey.keysym.sym) + { + case SDLK_RETURN: + done=TRUE; + break; + + case SDLK_SPACE: + if (option) + option[cur]=!option[cur]; + break; + + case SDLK_i: + if (option) + for(f=0;f0) + { + cur--; + + if (curtop+max-2) + top=cur-max+2; + } + break; + + default: + break; + } + } + + return cur; +} + + /* ---------------------------------------- EXPORTED INTERFACES */ int GUIMessage(GUIBoxType type, const char *title, const char *format,...) @@ -265,90 +392,33 @@ const char *GUIInputString(const char *prompt, const char *orig) int GUIListSelect(const char *title, int no, char * const list[]) { - static const int max=GFX_HEIGHT/8-8; - SDL_Event *e; - int top; - int cur; - int done; - int f; - - if (no==0) - return -1; - - top=0; - cur=0; - - done=FALSE; - - while(!done) - { - Box(title,7,7,GFX_WIDTH-14,GFX_HEIGHT-14); - - Centre("Cursors and RETURN to select",GFX_HEIGHT-40,WHITE); - Centre("ESCAPE to cancel",GFX_HEIGHT-32,WHITE); - - for(f=0;fkey.keysym.sym) - { - case SDLK_RETURN: - done=TRUE; - break; + if (no==0) + return FALSE; - case SDLK_ESCAPE: - cur=-1; - done=TRUE; - break; + o=Malloc(no * sizeof *o); - case SDLK_UP: - if (cur>0) - { - cur--; + for(f=0;ftop+max-2) - top=cur-max+2; - } - break; - - default: - break; - } - } + free(o); - return cur; + return sel!=-1; } -- cgit v1.2.3