Commit 143a1c40 authored by rswindell's avatar rswindell
Browse files

Added support for F2 - Edit (WIN_EDIT) returns option or'd with MSK_EDIT.

parent aba4f649
......@@ -134,6 +134,7 @@
#define MSK_DEL 0x20000000
#define MSK_GET 0x30000000
#define MSK_PUT 0x40000000
#define MSK_EDIT 0x50000000
/* Dont forget, negative return values are used for extended keys (if WIN_EXTKEYS used)! */
#else
#define MAX_OPTS 500 /* Maximum number of options per menu call */
......@@ -143,6 +144,7 @@
#define MSK_DEL 0x2000
#define MSK_GET 0x3000
#define MSK_PUT 0x4000
#define MSK_EDIT 0x5000
#endif
#define MAX_OPLN 75 /* Maximum length of each option per menu call */
#define MAX_BUFS 7 /* Maximum number of screen buffers to save */
......@@ -193,6 +195,8 @@
#define WIN_FIXEDHEIGHT (1<<25) /* Use list_height from uifc struct */
#define WIN_UNGETMOUSE (1<<26) /* If the mouse is clicked outside the window, */
/* Put the mouse event back into the event queue */
#define WIN_EDIT (1<<27) /* Allow F2 to edit a menu item */
#define WIN_EDITACT (1<<28) /* Remain active after edit key */
#define WIN_MID WIN_L2R|WIN_T2B /* Place window in middle of screen */
......@@ -399,7 +403,7 @@ typedef struct {
/* option is an array of char arrays, first element of last char array */
/* must be NULL. */
/* Returns the 0-based selected option number, -1 for ESC, or the selected */
/* option number OR'd with MSK_INS, MSK_DEL, MSK_GET, or MSK_PUT. */
/* option number OR'd with MSK_INS, MSK_DEL, MSK_GET, MSK_PUT, or MSK_EDIT. */
/****************************************************************************/
int (*list) (int mode, int left, int top, int width, int* dflt
,int* bar, char *title, char** option);
......
......@@ -57,6 +57,7 @@
#define BL_DEL (1<<1) /* DEL key */
#define BL_GET (1<<2) /* Get key */
#define BL_PUT (1<<3) /* Put key */
#define BL_EDIT (1<<4) /* Edit key */
#define BLINK 128
......@@ -531,6 +532,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if(mode&WIN_DEL) bline|=BL_DEL;
if(mode&WIN_GET) bline|=BL_GET;
if(mode&WIN_PUT) bline|=BL_PUT;
if(mode&WIN_EDIT) bline|=BL_EDIT;
bottomline(bline);
while(opts<MAX_OPTS)
if(option[opts]==NULL || option[opts][0]==0)
......@@ -1286,14 +1288,32 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
,line);
}
break;
case CIO_KEY_F(1): /* F1 */
case CIO_KEY_F(1): /* F1 - Help */
api->showhelp();
break;
case CIO_KEY_F(5): /* F5 */
case CIO_KEY_F(2): /* F2 - Edit */
if(mode&WIN_XTR && (*cur)==opts-1) /* can't edit */
break; /* extra line */
if(mode&WIN_EDIT) {
if(mode&WIN_EDITACT) {
gettext(s_left+left,s_top+top,s_left
+left+width-1,s_top+top+height-1,tmp_buffer);
for(i=1;i<(width*height*2);i+=2)
tmp_buffer[i]=api->lclr|(api->cclr<<4);
j=(((y-top)*width)*2)+7+((width-hbrdrsize-2)*2);
for(i=(((y-top)*width)*2)+7;i<j;i+=2)
tmp_buffer[i]=api->hclr|(api->cclr<<4);
puttext(s_left+left,s_top+top,s_left
+left+width-1,s_top+top+height-1,tmp_buffer);
}
return((*cur)|MSK_EDIT);
}
break;
case CIO_KEY_F(5): /* F5 - Copy */
if(mode&WIN_GET && !(mode&WIN_XTR && (*cur)==opts-1))
return((*cur)|MSK_GET);
break;
case CIO_KEY_F(6): /* F6 */
case CIO_KEY_F(6): /* F6 - Paste */
if(mode&WIN_PUT && !(mode&WIN_XTR && (*cur)==opts-1))
return((*cur)|MSK_PUT);
break;
......@@ -2059,6 +2079,12 @@ void bottomline(int line)
i+=3;
uprintf(i,api->scrn_len+1,BLACK|(api->cclr<<4),"Help ");
i+=6;
if(line&BL_EDIT) {
uprintf(i,api->scrn_len+1,api->bclr|(api->cclr<<4),"F2 ");
i+=3;
uprintf(i,api->scrn_len+1,BLACK|(api->cclr<<4),"Edit Item ");
i+=11;
}
if(line&BL_GET) {
uprintf(i,api->scrn_len+1,api->bclr|(api->cclr<<4),"F5 ");
i+=3;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment