New keywords, cleanup, other changes
This commit is contained in:
@@ -1594,8 +1594,9 @@ int setonkey(gkey keycode, VfvCP func, gkey pass) {
|
||||
|
||||
gkey key_tolower(gkey __keycode) {
|
||||
|
||||
if(isupper(KCodAsc(__keycode)))
|
||||
return (gkey)(__keycode + 'a' - 'A');
|
||||
byte &ascii = KCodAsc(__keycode);
|
||||
if(isupper(ascii))
|
||||
ascii = tolower(ascii);
|
||||
return __keycode;
|
||||
}
|
||||
|
||||
|
@@ -35,13 +35,6 @@
|
||||
#include <gdefs.h>
|
||||
#if defined(__USE_NCURSES__)
|
||||
#include <gcurses.h>
|
||||
#else
|
||||
#define ACS_BOARD '<27>'
|
||||
#ifndef __linux__
|
||||
#define ACS_BLOCK '<27>'
|
||||
#else
|
||||
#define ACS_BLOCK ' '
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__WIN32__)
|
||||
#include <windows.h>
|
||||
@@ -196,7 +189,7 @@ struct __int10_ah1b_statebuf {
|
||||
#endif
|
||||
#define INTENSE 8
|
||||
|
||||
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
|
||||
#if defined(__UNIX__) && !defined(__USE_NCURSES__)
|
||||
#define ACSET BLINK
|
||||
#else
|
||||
#define ACSET 0
|
||||
@@ -345,15 +338,11 @@ public:
|
||||
|
||||
extern GVid *gvid;
|
||||
|
||||
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
|
||||
extern bool gvid_xterm;
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Box characters table
|
||||
|
||||
#if not defined(__USE_NCURSES__)
|
||||
#if !defined(__USE_NCURSES__)
|
||||
|
||||
extern char* __box_table[];
|
||||
#define _box_table(i,j) (__box_table[i][j])
|
||||
|
@@ -177,7 +177,6 @@ inline gdma gdmaptr(int col, int row) {
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
extern int gvid_stdout;
|
||||
extern bool gvid_xterm;
|
||||
extern const char* gvid_acs_enable;
|
||||
extern const char* gvid_acs_disable;
|
||||
int gvid_last_attr = 0;
|
||||
|
@@ -92,7 +92,6 @@ GVid *gvid;
|
||||
#elif defined(__UNIX__)
|
||||
|
||||
int gvid_stdout = -1;
|
||||
bool gvid_xterm = false;
|
||||
const char* gvid_acs_enable;
|
||||
const char* gvid_acs_disable;
|
||||
|
||||
@@ -401,26 +400,31 @@ int GVid::detectadapter() {
|
||||
|
||||
adapter = V_VGA;
|
||||
|
||||
#elif defined(__UNIX__)
|
||||
#elif defined(__linux__)
|
||||
|
||||
for(int n=0; n<8; n++)
|
||||
__box_table[n] = __box_table[8];
|
||||
|
||||
gvid_acs_enable = "\016";
|
||||
gvid_acs_disable = "\017";
|
||||
|
||||
gvid_stdout = fileno(stdout);
|
||||
|
||||
adapter = V_VGA;
|
||||
|
||||
#elif defined(__UNIX__) // code below should not be normally used...
|
||||
|
||||
bool gvid_xterm = false;
|
||||
const char* term = getenv("TERM");
|
||||
#ifndef __linux__
|
||||
|
||||
if(term and strneql(term, "xterm", 5)) {
|
||||
#endif
|
||||
gvid_xterm = true;
|
||||
for(int n=0; n<8; n++)
|
||||
__box_table[n] = __box_table[8];
|
||||
#ifndef __linux__
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __linux__
|
||||
|
||||
gvid_acs_enable = gvid_xterm ? "\033)0\033(B\016" : "\033[11m";
|
||||
gvid_acs_disable = gvid_xterm ? "\033(B\033)B\017" : "\033[10m";
|
||||
#else
|
||||
gvid_acs_enable = gvid_xterm ? "\016" : "";
|
||||
gvid_acs_disable = gvid_xterm ? "\017" : "";
|
||||
#endif
|
||||
|
||||
gvid_stdout = fileno(stdout);
|
||||
|
||||
|
@@ -380,10 +380,11 @@ int wprintvs (int wrow, int wcol, int attr, const vchar* str);
|
||||
int wprintns (int wrow, int wcol, int attr, const char* str, uint len, vchar fill=' ', int fill_attr=-1);
|
||||
int wprintsf (int wrow, int wcol, int attr, const char* format, const char* str);
|
||||
int wprintws (int wrow, int wcol, vatch* buf, uint len);
|
||||
void wpropbar (int mode, int xx, int yy, long len, long barlen, int attr, long pos, long size);
|
||||
void wpropbar (int xx, int yy, long len, int attr, long pos, long size);
|
||||
int wputc (vchar ch);
|
||||
int wputs (const char* str);
|
||||
int wputx (int wrow, int wcol, int attr, vchar chr, uint len);
|
||||
int wputy (int wrow, int wcol, int attr, vchar chr, uint len);
|
||||
int wreadcur (int* wrow, int* wcol);
|
||||
int wscroll (int count, int direc);
|
||||
void wscrollbar (int orientation, uint total, uint maxpos, uint pos, int sadd=0);
|
||||
|
@@ -309,14 +309,14 @@ int wshadow(int attr) {
|
||||
// read current screen characters/attributes and save in shadow's buffer
|
||||
vatch tmp[2];
|
||||
*q = vgetw(crow, ccol);
|
||||
#ifndef __linux__
|
||||
#if defined(__USE_NCURSES__) || !defined(__UNIX__)
|
||||
tmp[0] = vsattr(*q, attr);
|
||||
#else
|
||||
tmp[0] = vsattr(' ', attr);
|
||||
#endif
|
||||
q++;
|
||||
*q = vgetw(crow, ccol + 1);
|
||||
#ifndef __linux__
|
||||
#if defined(__USE_NCURSES__) || !defined(__UNIX__)
|
||||
tmp[1] = vsattr(*q, attr);
|
||||
#else
|
||||
tmp[1] = vsattr(' ', attr);
|
||||
@@ -339,7 +339,7 @@ int wshadow(int attr) {
|
||||
|
||||
// read attribs/chars and store in buffers
|
||||
*q = vgetw(crow, ccol++);
|
||||
#ifndef __linux__
|
||||
#if defined(__USE_NCURSES__) || !defined(__UNIX__)
|
||||
*wptr++ = vsattr(*q, attr);
|
||||
#else
|
||||
*wptr++ = vsattr(' ', attr);
|
||||
@@ -918,6 +918,16 @@ int wputx(int wrow, int wcol, int attr, vchar chr, uint len) {
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
int wputy(int wrow, int wcol, int attr, vchar chr, uint len) {
|
||||
|
||||
const int &border = gwin.active->border;
|
||||
vputy(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,chr,len);
|
||||
return gwin.werrno=W_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Displays a string inside active window
|
||||
|
||||
@@ -1882,83 +1892,32 @@ int wmessage(const char* str, int border, int leftofs, int attr) {
|
||||
// ------------------------------------------------------------------
|
||||
// Proportion bar
|
||||
|
||||
void wpropbar(int mode, int xx, int yy, long len, long barlen, int attr, long pos, long size) {
|
||||
void wpropbar(int xx, int yy, long len, int attr, long pos, long size) {
|
||||
|
||||
// mode = PROP_PAGE or PROP_BARGRAPH.
|
||||
// xx, yy = start position in window.
|
||||
// len = length (in chars) of progress field.
|
||||
// attr = color to use for progress field.
|
||||
// pos = present position.
|
||||
// size = total size of field.
|
||||
|
||||
#ifndef __linux__
|
||||
const vchar _fld = ACS_BOARD;
|
||||
const vchar _bar = ACS_BLOCK;
|
||||
const vchar barchar = _box_table(gwin.active->btype, 13);
|
||||
#ifdef __UNIX__ // prefferable under xterm
|
||||
const vchar thumbchar = ' ';
|
||||
int thumbattr = revsattr(attr);
|
||||
#else
|
||||
const vchar _fld = ' ';
|
||||
const vchar _bar = _box_table(gwin.active->btype, 13);
|
||||
const vchar thumbchar = '\xDB';
|
||||
int thumbattr = attr;
|
||||
#endif
|
||||
const vchar _up = '\x18';
|
||||
const vchar _dwn = '\x19';
|
||||
|
||||
int dir=0, x, y;
|
||||
long first, width, length;
|
||||
long thumblen = (pos*len)/size;
|
||||
|
||||
if(len > 0)
|
||||
dir = 1; // Vertical
|
||||
else
|
||||
len = -len; // Horizontal
|
||||
|
||||
if(not barlen)
|
||||
length = size-len;
|
||||
else
|
||||
length = size;
|
||||
|
||||
if((size > len) or (mode!=PROP_PAGE)) {
|
||||
if(not barlen)
|
||||
barlen = (len*len)/size;
|
||||
if(not barlen)
|
||||
barlen = 1;
|
||||
width = len-barlen;
|
||||
first = (pos*width)/length;
|
||||
}
|
||||
else {
|
||||
first = 0;
|
||||
barlen = len;
|
||||
}
|
||||
|
||||
if(dir) {
|
||||
if(mode==PROP_PAGE) {
|
||||
if(pos > 0)
|
||||
wprintc(yy,xx,revsattr(attr),_up);
|
||||
else
|
||||
wprintc(yy,xx,revsattr(attr),' ');
|
||||
if(pos+len < size)
|
||||
wprintc(yy+(int)len-1,xx,revsattr(attr),_dwn);
|
||||
else
|
||||
wprintc(yy+(int)len-1,xx,revsattr(attr),' ');
|
||||
}
|
||||
for(y=yy+(mode==PROP_PAGE); y<(yy+first); y++) {
|
||||
wprintc(y,xx,attr|ACSET,mode==PROP_BARGRAPH?_bar:_fld);
|
||||
}
|
||||
for(; y<(yy+first+barlen); y++) {
|
||||
wprintc(y,xx,attr|ACSET,_bar);
|
||||
}
|
||||
for(; y<(yy+len-(mode==PROP_PAGE)); y++) {
|
||||
wprintc(y,xx,attr|ACSET,_fld);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(x=xx; x<(xx+first); x++) {
|
||||
wprintc(yy,x,attr|ACSET,mode==PROP_BARGRAPH?_bar:_fld);
|
||||
}
|
||||
for(; x<(xx+first+barlen); x++) {
|
||||
wprintc(yy,x,attr|ACSET,_bar);
|
||||
}
|
||||
for(; x<(xx+len); x++) {
|
||||
wprintc(yy,x,attr|ACSET,_fld);
|
||||
}
|
||||
int x = xx;
|
||||
if(thumblen != 0) {
|
||||
wputx(yy, x, thumbattr|ACSET, thumbchar, thumblen);
|
||||
x += thumblen;
|
||||
}
|
||||
if(thumblen != len)
|
||||
wputx(yy, x, attr|ACSET, barchar, len-thumblen);
|
||||
}
|
||||
|
||||
|
||||
@@ -2044,85 +2003,78 @@ int wtitle(const char* str, int tpos, int tattr) {
|
||||
|
||||
void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) {
|
||||
|
||||
int attr = (gwin.active->sbattr == -1) ? gwin.active->battr : gwin.active->sbattr;
|
||||
int invattr = revsattr(attr);
|
||||
|
||||
const vchar barchar = _box_table(gwin.active->btype, 13);
|
||||
const vchar thumbchar = ACS_BLOCK;
|
||||
const vchar arrowupchar = '\x18';
|
||||
const vchar arrowdownchar = '\x19';
|
||||
const vchar arrowleftchar = '\x1B';
|
||||
const vchar arrowrightchar = '\x1A';
|
||||
|
||||
int attr = (gwin.active->sbattr == -1) ? gwin.active->battr : gwin.active->sbattr;
|
||||
#ifdef __linux__
|
||||
int thumbattr = revsattr(attr);
|
||||
#ifdef __UNIX__ // prefferable under xterm
|
||||
const vchar thumbchar = ' ';
|
||||
int thumbattr = revsattr(attr);
|
||||
#else
|
||||
const vchar thumbchar = '\xDB';
|
||||
int thumbattr = attr;
|
||||
#endif
|
||||
|
||||
int srow, scol;
|
||||
uint visiblelen, barlen;
|
||||
uint maxthumbpos, thumbpos, thumblen;
|
||||
|
||||
if(maxpos == 0)
|
||||
maxpos = 1;
|
||||
|
||||
if(orientation == W_VERT) {
|
||||
srow = gwin.active->srow + gwin.active->border + sadd;
|
||||
scol = gwin.active->ecol;
|
||||
uint visiblelen;
|
||||
if(orientation == W_VERT)
|
||||
visiblelen = (gwin.active->erow - (gwin.active->srow+sadd)) + 1 - (gwin.active->border?2:0);
|
||||
}
|
||||
else {
|
||||
srow = gwin.active->erow;
|
||||
scol = gwin.active->scol + gwin.active->border + sadd;
|
||||
else
|
||||
visiblelen = (gwin.active->ecol - (gwin.active->scol+sadd)) + 1 - (gwin.active->border?2:0) - 2;
|
||||
}
|
||||
|
||||
barlen = visiblelen - 2;
|
||||
thumblen = (visiblelen*barlen) / total;
|
||||
uint barlen = visiblelen - 2;
|
||||
uint thumblen = (visiblelen*barlen) / total;
|
||||
if(thumblen == 0)
|
||||
thumblen = 1;
|
||||
else if(thumblen > barlen)
|
||||
thumblen = barlen;
|
||||
maxthumbpos = barlen - thumblen;
|
||||
thumbpos = (pos*maxthumbpos) / maxpos;
|
||||
uint maxthumbpos = barlen - thumblen;
|
||||
uint thumbpos = (pos*maxthumbpos) / maxpos;
|
||||
uint thumbdiv = (pos*maxthumbpos) % maxpos;
|
||||
if((thumbdiv >= (maxpos/2)) and (maxpos > 1))
|
||||
thumbpos++;
|
||||
if(thumbpos > maxthumbpos)
|
||||
thumbpos = maxthumbpos;
|
||||
barlen -= thumbpos + thumblen;
|
||||
|
||||
if(orientation == W_VERT) {
|
||||
register int row = srow;
|
||||
register int erow1 = srow + thumbpos + 1;
|
||||
register int erow2 = erow1 + thumblen;
|
||||
register int erow3 = srow + barlen + 1;
|
||||
vputc(row++, scol, revsattr(attr), arrowupchar);
|
||||
while(row < erow1)
|
||||
vputc(row++, scol, attr|ACSET, barchar);
|
||||
while(row < erow2)
|
||||
#ifdef __linux__
|
||||
vputc(row++, scol, thumbattr|ACSET, thumbchar);
|
||||
#else
|
||||
vputc(row++, scol, attr|ACSET, thumbchar);
|
||||
#endif
|
||||
while(row < erow3)
|
||||
vputc(row++, scol, attr|ACSET, barchar);
|
||||
vputc(row, scol, revsattr(attr), arrowdownchar);
|
||||
uint scol = gwin.active->ecol - gwin.active->scol - gwin.active->border;
|
||||
vputc((sadd++)+gwin.active->srow+gwin.active->border, gwin.active->ecol, invattr|ACSET, arrowupchar);
|
||||
if(thumbpos != 0) {
|
||||
wputy(sadd, scol, attr|ACSET, barchar, thumbpos);
|
||||
sadd += thumbpos;
|
||||
}
|
||||
if(thumblen != 0) {
|
||||
wputy(sadd, scol, thumbattr|ACSET, thumbchar, thumblen);
|
||||
sadd += thumblen;
|
||||
}
|
||||
if(barlen != 0) {
|
||||
wputy(sadd, scol, attr|ACSET, barchar, barlen);
|
||||
sadd += barlen;
|
||||
}
|
||||
vputc(sadd+gwin.active->srow+gwin.active->border, gwin.active->ecol, invattr|ACSET, arrowdownchar);
|
||||
}
|
||||
else {
|
||||
register int col = scol;
|
||||
register int ecol1 = scol + thumbpos + 1;
|
||||
register int ecol2 = ecol1 + thumblen;
|
||||
register int ecol3 = scol + barlen + 1;
|
||||
vputc(srow, col++, revsattr(attr), arrowleftchar);
|
||||
while(col < ecol1)
|
||||
vputc(srow, col++, attr|ACSET, barchar);
|
||||
while(col < ecol2)
|
||||
#ifdef __linux__
|
||||
vputc(srow, col++, thumbattr|ACSET, thumbchar);
|
||||
#else
|
||||
vputc(srow, col++, attr|ACSET, thumbchar);
|
||||
#endif
|
||||
while(col < ecol3)
|
||||
vputc(srow, col++, attr|ACSET, barchar);
|
||||
vputc(srow, col, revsattr(attr), arrowrightchar);
|
||||
uint srow = gwin.active->erow - gwin.active->srow - gwin.active->border;
|
||||
vputc(gwin.active->erow, (sadd++)+gwin.active->scol+gwin.active->border, invattr|ACSET, arrowleftchar);
|
||||
if(thumbpos != 0) {
|
||||
wputx(srow, sadd, attr|ACSET, barchar, thumbpos);
|
||||
sadd += thumbpos;
|
||||
}
|
||||
if(thumblen != 0) {
|
||||
wputx(srow, sadd, thumbattr|ACSET, thumbchar, thumblen);
|
||||
sadd += thumblen;
|
||||
}
|
||||
if(barlen != 0) {
|
||||
wputx(srow, sadd, attr|ACSET, barchar, barlen);
|
||||
sadd += barlen;
|
||||
}
|
||||
vputc(gwin.active->erow, sadd+gwin.active->scol+gwin.active->border, invattr|ACSET, arrowrightchar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,233 +34,6 @@
|
||||
#include <gwinpick.h>
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
int Picker(PInf* p, Pick* pick) {
|
||||
|
||||
int keyok;
|
||||
gkey keycode, newkey;
|
||||
|
||||
#ifdef GOLD_MOUSE
|
||||
gmou.HideCursor();
|
||||
#endif
|
||||
|
||||
// Open and initialize
|
||||
|
||||
if(pick->open)
|
||||
pick->open(p);
|
||||
if(p->helpcat)
|
||||
whelppcat(p->helpcat);
|
||||
|
||||
do {
|
||||
|
||||
// Display selection bar
|
||||
|
||||
wgotoxy(p->pos, 0);
|
||||
p->type = PICK_BAR;
|
||||
pick->disp(p);
|
||||
p->type = PICK_DISP;
|
||||
|
||||
// Handle keyboard and delay function
|
||||
|
||||
if(pick->dodelayed)
|
||||
pick->dodelayed(p);
|
||||
|
||||
#ifdef GOLD_MOUSE
|
||||
gmou.ShowCursor();
|
||||
#endif
|
||||
|
||||
keyok = YES;
|
||||
|
||||
do {
|
||||
newkey = keycode = getxchtick();
|
||||
if(newkey == Key_Tick)
|
||||
pick->dokey(p, &keycode);
|
||||
} while(newkey == Key_Tick);
|
||||
|
||||
do {
|
||||
#ifdef GOLD_MOUSE
|
||||
gmou.HideCursor();
|
||||
#endif
|
||||
newkey = 0;
|
||||
switch(keycode) {
|
||||
case Key_Up:
|
||||
case Key_Dwn:
|
||||
case Key_PgUp:
|
||||
case Key_PgDn:
|
||||
case Key_Home:
|
||||
case Key_End:
|
||||
if(pick->precursor)
|
||||
pick->precursor(p);
|
||||
break;
|
||||
}
|
||||
switch(keycode) {
|
||||
case Key_Up:
|
||||
p->direction = -1;
|
||||
if(p->pos) {
|
||||
pick->disp(p);
|
||||
p->pos--;
|
||||
p->idx--;
|
||||
}
|
||||
else if(p->idx > p->minidx) {
|
||||
pick->disp(p);
|
||||
p->idx--;
|
||||
pick->scroll(p, SDOWN);
|
||||
}
|
||||
else if(p->listwrap)
|
||||
newkey = Key_End;
|
||||
break;
|
||||
|
||||
case Key_Dwn:
|
||||
p->direction = 1;
|
||||
if(p->pos < p->maxpos) {
|
||||
if(p->idx < p->maxidx) {
|
||||
pick->disp(p);
|
||||
p->pos++;
|
||||
p->idx++;
|
||||
}
|
||||
else if(p->listwrap)
|
||||
newkey = Key_Home;
|
||||
}
|
||||
else if(p->idx < p->maxidx) {
|
||||
pick->disp(p);
|
||||
p->idx++;
|
||||
pick->scroll(p, SUP);
|
||||
}
|
||||
else if(p->listwrap)
|
||||
newkey = Key_Home;
|
||||
break;
|
||||
|
||||
case Key_PgUp:
|
||||
p->direction = -1;
|
||||
if(p->pos) {
|
||||
pick->disp(p);
|
||||
p->idx -= p->pos;
|
||||
p->pos = 0;
|
||||
}
|
||||
else if(p->idx > p->minidx) {
|
||||
p->idx -= (p->idx >= p->maxpos) ? p->maxpos : p->idx;
|
||||
pick->page(p);
|
||||
}
|
||||
break;
|
||||
|
||||
case Key_PgDn:
|
||||
p->direction = 1;
|
||||
if(p->pos < p->maxpos) {
|
||||
if(p->idx == p->maxidx) {
|
||||
if(p->maxpos < p->maxidx) {
|
||||
p->pos = p->maxpos;
|
||||
p->idx = p->maxidx;
|
||||
pick->page(p);
|
||||
}
|
||||
}
|
||||
else if(p->idx + (p->maxpos-p->pos) >= p->maxidx) {
|
||||
pick->disp(p);
|
||||
p->pos += p->maxidx-p->idx;
|
||||
p->idx = p->maxidx;
|
||||
}
|
||||
else if(p->pos != p->maxpos) {
|
||||
pick->disp(p);
|
||||
p->idx += p->maxpos-p->pos;
|
||||
p->pos = p->maxpos;
|
||||
}
|
||||
}
|
||||
else if(p->idx < p->maxidx) {
|
||||
if(p->idx+p->maxpos > p->maxidx) {
|
||||
p->pos = p->maxidx-p->idx;
|
||||
p->idx = p->maxidx;
|
||||
pick->page(p);
|
||||
}
|
||||
else {
|
||||
p->idx += p->maxpos;
|
||||
p->pos = p->maxpos;
|
||||
pick->page(p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Key_Home:
|
||||
p->direction = -1;
|
||||
if(p->idx > p->minidx) {
|
||||
if((p->idx - p->pos) <= p->minidx) {
|
||||
pick->disp(p);
|
||||
p->idx = p->minidx;
|
||||
p->pos = 0;
|
||||
}
|
||||
else {
|
||||
p->pos = 0;
|
||||
p->idx = p->minidx;
|
||||
pick->page(p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Key_End:
|
||||
p->direction = 1;
|
||||
if(p->idx < p->maxidx) {
|
||||
if(p->idx + (p->maxpos-p->pos) >= p->maxidx) {
|
||||
pick->disp(p);
|
||||
p->pos += p->maxidx-p->idx;
|
||||
p->idx = p->maxidx;
|
||||
}
|
||||
else {
|
||||
p->pos = (p->maxidx-p->idx) < p->maxpos ? p->maxidx-p->idx : p->maxpos;
|
||||
p->idx = p->maxidx;
|
||||
pick->page(p);
|
||||
}
|
||||
}
|
||||
else if(p->pos < p->maxpos) {
|
||||
if(p->maxpos < p->maxidx) {
|
||||
p->pos = p->maxpos;
|
||||
p->idx = p->maxidx;
|
||||
pick->page(p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Key_C_Up:
|
||||
p->direction = -1;
|
||||
if(p->idx - p->pos) {
|
||||
p->idx--;
|
||||
pick->page(p);
|
||||
}
|
||||
break;
|
||||
|
||||
case Key_C_Dwn:
|
||||
p->direction = 1;
|
||||
if(p->idx < p->maxidx) {
|
||||
p->idx++;
|
||||
pick->page(p);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
keyok = pick->dokey(p, &keycode);
|
||||
newkey = keycode;
|
||||
}
|
||||
if(newkey)
|
||||
keycode = newkey;
|
||||
} while(newkey);
|
||||
} while(keyok);
|
||||
|
||||
#ifdef GOLD_MOUSE
|
||||
gmou.HideCursor();
|
||||
#endif
|
||||
|
||||
// Close and clean
|
||||
if(p->helpcat)
|
||||
whelpop();
|
||||
if(pick->close)
|
||||
pick->close(p);
|
||||
|
||||
#ifdef GOLD_MOUSE
|
||||
gmou.ShowCursor();
|
||||
#endif
|
||||
|
||||
return p->retval;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
gwinpick::gwinpick() {
|
||||
|
@@ -46,66 +46,6 @@ const int LIST_NEARTOP = 1;
|
||||
const int LIST_TOP = 2;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Picker info
|
||||
|
||||
struct PInf {
|
||||
|
||||
PInf() : ypos(row), xpos(column), ylen(height), xlen(width) {}
|
||||
|
||||
uint& ypos;
|
||||
uint& xpos;
|
||||
uint& ylen;
|
||||
uint& xlen;
|
||||
uint row; //ypos; // Window Starting Row
|
||||
uint column; //xpos; // Window Starting Column
|
||||
uint height; //ylen; // Window Height
|
||||
uint width; //xlen; // Window Width
|
||||
int btype; // Window Border Type
|
||||
int battr; // Window Border Color
|
||||
int wattr; // Window Color
|
||||
int tattr; // Window Title Color
|
||||
int sattr; // Window Selection Bar Color
|
||||
int hattr; // Window Highlight Color
|
||||
int loattr; // Window LoAttr Color
|
||||
int sbattr; // Window Scrollbar Color
|
||||
char* title; // Window Title
|
||||
int helpcat; // Window Help Category
|
||||
uint maxidx; // List Entries - 1
|
||||
uint minidx; // Minimum index in the list
|
||||
uint maxpos; // Display Pos
|
||||
uint idx; // List Index
|
||||
uint pos; // Display Pos
|
||||
long delay; // Ticks until delay
|
||||
int type; // Bar or Disp
|
||||
int retval; // Return value
|
||||
bool aborted; // True if aborted
|
||||
bool listwrap; // True if wrap-around is supported
|
||||
int direction; // 1 if next, -1 if previous
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Picker definable functions
|
||||
|
||||
struct Pick {
|
||||
void (*open) (PInf*); // Called after window is opened
|
||||
void (*close) (PInf*); // Called after window is closed
|
||||
void (*precursor)(PInf*); // Called before any cursor movement
|
||||
void (*dodelayed)(PInf*); // Called after a delay
|
||||
void (*disp) (PInf*); // Display line
|
||||
void (*page) (PInf*); // Display page
|
||||
void (*scroll) (PInf*, int); // Scroll list (direction)
|
||||
int (*dokey) (PInf*, gkey*); // Called with key (&keycode)
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Prototypes
|
||||
|
||||
int Picker(PInf* p, Pick* pick);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
class gwinpick {
|
||||
|
@@ -188,8 +188,6 @@ public:
|
||||
void restore_field();
|
||||
void delete_left_word();
|
||||
void delete_right_word();
|
||||
void clear_to_end_field();
|
||||
void clear_to_end_form();
|
||||
void go_left_word();
|
||||
void go_right_word();
|
||||
void enter_char(char ch);
|
||||
|
@@ -516,20 +516,6 @@ void gwinput::delete_right_word() {
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void gwinput::clear_to_end_field() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void gwinput::clear_to_end_form() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void gwinput::go_left_word() {
|
||||
@@ -619,8 +605,6 @@ bool gwinput::handle_key(gkey key) {
|
||||
case Key_C_R: restore_field(); break;
|
||||
case Key_C_BS: delete_left_word(); break;
|
||||
case Key_C_T: delete_right_word(); break;
|
||||
case Key_C_U: clear_to_end_field(); break;
|
||||
case Key_C_Y: clear_to_end_form(); break;
|
||||
case Key_C_Lft: go_left_word(); break;
|
||||
case Key_C_Rgt: go_right_word(); break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user