Fix a couple of whoopers which somehow went undetected until now.

This commit is contained in:
jkh 1996-07-11 11:15:28 +00:00
parent 8c250dd62e
commit f4760a24ff
3 changed files with 66 additions and 56 deletions

View File

@ -202,17 +202,19 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
/* Shortcut to OK? */
if (toupper(key) == okButton) {
if (ditems && result && ditems[OK_BUTTON].fire) {
int st;
WINDOW *save;
if (ditems) {
if (result && ditems[OK_BUTTON].fire) {
int st;
WINDOW *save;
save = dupwin(newscr);
st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]);
if (st & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
save = dupwin(newscr);
st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]);
if (st & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
}
delwin(save);
}
delwin(save);
}
else if (result) {
*result = '\0';
@ -457,8 +459,8 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
/* Select either the OK or Cancel button */
case '\n':
case '\r':
if (ditems && result) {
if (ditems && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) {
if (ditems) {
if (result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) {
int st;
WINDOW *save = dupwin(newscr);

View File

@ -191,17 +191,19 @@ dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width,
/* Shortcut to OK? */
if (toupper(key) == okButton) {
if (ditems && result && ditems[OK_BUTTON].fire) {
int status;
WINDOW *save;
if (ditems) {
if (result && ditems[OK_BUTTON].fire) {
int status;
WINDOW *save;
save = dupwin(newscr);
status = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]);
if (status & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
save = dupwin(newscr);
status = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]);
if (status & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
}
delwin(save);
}
delwin(save);
}
else if (result)
strcpy(result, items[(scroll + choice) * 2]);
@ -379,24 +381,26 @@ dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width,
if (!button) {
/* A fire routine can do just about anything to the screen, so be prepared
to accept some hints as to what to do in the aftermath. */
if (ditems && ditems[scroll + choice].fire) {
int status;
WINDOW *save;
if (ditems) {
if (ditems[scroll + choice].fire) {
int status;
WINDOW *save;
save = dupwin(newscr);
status = ditems[scroll + choice].fire(&ditems[scroll + choice]);
if (status & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
}
delwin(save);
if (status & DITEM_CONTINUE)
continue;
else if (status & DITEM_RECREATE && !(status & DITEM_LEAVE_MENU)) {
delwin(menu);
delwin(dialog);
dialog_clear();
goto draw;
save = dupwin(newscr);
status = ditems[scroll + choice].fire(&ditems[scroll + choice]);
if (status & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
}
delwin(save);
if (status & DITEM_CONTINUE)
continue;
else if (status & DITEM_RECREATE && !(status & DITEM_LEAVE_MENU)) {
delwin(menu);
delwin(dialog);
dialog_clear();
goto draw;
}
}
}
else if (result)

View File

@ -210,17 +210,19 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
/* See if its the short-cut to "OK" */
if (toupper(key) == okButton) {
if (ditems && result && ditems[OK_BUTTON].fire) {
int st;
WINDOW *save;
if (ditems) {
if (result && ditems[OK_BUTTON].fire) {
int st;
WINDOW *save;
save = dupwin(newscr);
st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]);
if (st & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
save = dupwin(newscr);
st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]);
if (st & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
}
delwin(save);
}
delwin(save);
}
else if (result) {
*result = '\0';
@ -453,19 +455,21 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
case '\r':
case '\n':
if (ditems && result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) {
int st;
WINDOW *save;
if (ditems) {
if (result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) {
int st;
WINDOW *save;
save = dupwin(newscr);
st = ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]);
if (st & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
save = dupwin(newscr);
st = ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]);
if (st & DITEM_RESTORE) {
touchwin(save);
wrefresh(save);
}
delwin(save);
}
delwin(save);
}
else if (!ditems && result) {
else if (result) {
*result = '\0';
for (i = 0; i < item_no; i++) {
if (status[i]) {