1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-27 02:02:26 +00:00

Modifications to the new Close On Exit option:

- wording change (required a patch to winctrls.c:radioline())
 - `only on clean exit' is used when an old-style config says `yes',
   on the grounds that it's more generally useful than `always' and
   also we want to map the old default to the new default.

[originally from svn r928]
This commit is contained in:
Simon Tatham 2001-02-05 13:42:33 +00:00
parent 4d830f7587
commit 9b7dbb92cc
3 changed files with 28 additions and 15 deletions

View File

@ -135,8 +135,8 @@ enum {
* Close On Exit behaviours. (cfg.close_on_exit) * Close On Exit behaviours. (cfg.close_on_exit)
*/ */
COE_NEVER, /* Never close the window */ COE_NEVER, /* Never close the window */
COE_ALWAYS, /* Always close the window */ COE_NORMAL, /* Close window on "normal" (non-error) exits only */
COE_NORMAL /* Close window on "normal" (non-error) exits only */ COE_ALWAYS /* Always close the window */
}; };
typedef struct { typedef struct {

View File

@ -145,6 +145,13 @@ void multiedit(struct ctlpos *cp, ...) {
* (you might want this not to equal the number of buttons if you * (you might want this not to equal the number of buttons if you
* needed to line up some 2s and some 3s to look good in the same * needed to line up some 2s and some 3s to look good in the same
* panel). * panel).
*
* There's a bit of a hack in here to ensure that if nacross
* exceeds the actual number of buttons, the rightmost button
* really does get all the space right to the edge of the line, so
* you can do things like
*
* (*) Button1 (*) Button2 (*) ButtonWithReallyLongTitle
*/ */
void radioline(struct ctlpos *cp, void radioline(struct ctlpos *cp,
char *text, int id, int nacross, ...) { char *text, int id, int nacross, ...) {
@ -152,6 +159,7 @@ void radioline(struct ctlpos *cp,
va_list ap; va_list ap;
int group; int group;
int i; int i;
char *btext;
r.left = GAPBETWEEN; r.top = cp->ypos; r.left = GAPBETWEEN; r.top = cp->ypos;
r.right = cp->width; r.bottom = STATICHEIGHT; r.right = cp->width; r.bottom = STATICHEIGHT;
@ -160,15 +168,19 @@ void radioline(struct ctlpos *cp,
va_start(ap, nacross); va_start(ap, nacross);
group = WS_GROUP; group = WS_GROUP;
i = 0; i = 0;
while (1) {
char *btext;
int bid;
btext = va_arg(ap, char *); btext = va_arg(ap, char *);
while (1) {
char *nextbtext;
int bid;
if (!btext) if (!btext)
break; break;
bid = va_arg(ap, int); bid = va_arg(ap, int);
nextbtext = va_arg(ap, char *);
r.left = GAPBETWEEN + i * (cp->width+GAPBETWEEN)/nacross; r.left = GAPBETWEEN + i * (cp->width+GAPBETWEEN)/nacross;
if (nextbtext)
r.right = (i+1) * (cp->width+GAPBETWEEN)/nacross - r.left; r.right = (i+1) * (cp->width+GAPBETWEEN)/nacross - r.left;
else
r.right = cp->width - r.left;
r.top = cp->ypos; r.bottom = RADIOHEIGHT; r.top = cp->ypos; r.bottom = RADIOHEIGHT;
doctl(cp, r, "BUTTON", doctl(cp, r, "BUTTON",
BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP | group, BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP | group,
@ -176,6 +188,7 @@ void radioline(struct ctlpos *cp,
btext, bid); btext, bid);
group = 0; group = 0;
i++; i++;
btext = nextbtext;
} }
va_end(ap); va_end(ap);
cp->ypos += r.bottom + GAPBETWEEN; cp->ypos += r.bottom + GAPBETWEEN;

View File

@ -205,8 +205,8 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_SESSDEL, IDC_SESSDEL,
IDC_CLOSEEXIT, IDC_CLOSEEXIT,
IDC_COEALWAYS, IDC_COEALWAYS,
IDC_COENORMAL,
IDC_COENEVER, IDC_COENEVER,
IDC_COENORMAL,
sessionpanelend, sessionpanelend,
loggingpanelstart, loggingpanelstart,
@ -540,9 +540,9 @@ static void init_dlg_ctrls(HWND hwnd) {
CheckDlgButton (hwnd, IDC_BLINKCUR, cfg.blink_cur); CheckDlgButton (hwnd, IDC_BLINKCUR, cfg.blink_cur);
CheckDlgButton (hwnd, IDC_SCROLLBAR, cfg.scrollbar); CheckDlgButton (hwnd, IDC_SCROLLBAR, cfg.scrollbar);
CheckDlgButton (hwnd, IDC_LOCKSIZE, cfg.locksize); CheckDlgButton (hwnd, IDC_LOCKSIZE, cfg.locksize);
CheckRadioButton (hwnd, IDC_COEALWAYS, IDC_COENEVER, CheckRadioButton (hwnd, IDC_COEALWAYS, IDC_COENORMAL,
cfg.close_on_exit==COE_NEVER ? IDC_COENEVER : cfg.close_on_exit==COE_NORMAL ? IDC_COENORMAL :
cfg.close_on_exit==COE_NORMAL ? IDC_COENORMAL : IDC_COEALWAYS); cfg.close_on_exit==COE_NEVER ? IDC_COENEVER : IDC_COEALWAYS);
CheckDlgButton (hwnd, IDC_CLOSEWARN, cfg.warn_on_close); CheckDlgButton (hwnd, IDC_CLOSEWARN, cfg.warn_on_close);
SetDlgItemText (hwnd, IDC_TTEDIT, cfg.termtype); SetDlgItemText (hwnd, IDC_TTEDIT, cfg.termtype);
@ -704,10 +704,10 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
endbox(&cp); endbox(&cp);
} }
beginbox(&cp, NULL, IDC_BOX_SESSION3); beginbox(&cp, NULL, IDC_BOX_SESSION3);
radioline(&cp, "At session end, close &window:", IDC_CLOSEEXIT, 3, radioline(&cp, "Close &window on exit:", IDC_CLOSEEXIT, 4,
"Always", IDC_COEALWAYS, "Always", IDC_COEALWAYS,
"On clean exit", IDC_COENORMAL, "Never", IDC_COENEVER,
"Never", IDC_COENEVER, NULL); "Only on clean exit", IDC_COENORMAL, NULL);
endbox(&cp); endbox(&cp);
} }
@ -1605,13 +1605,13 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
sizeof(cfg.wintitle)-1); sizeof(cfg.wintitle)-1);
break; break;
case IDC_COEALWAYS: case IDC_COEALWAYS:
case IDC_COENORMAL:
case IDC_COENEVER: case IDC_COENEVER:
case IDC_COENORMAL:
if (HIWORD(wParam) == BN_CLICKED || if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED) { HIWORD(wParam) == BN_DOUBLECLICKED) {
cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC_COEALWAYS) ? COE_ALWAYS : cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC_COEALWAYS) ? COE_ALWAYS :
IsDlgButtonChecked (hwnd, IDC_COENORMAL) ? COE_NORMAL : IsDlgButtonChecked (hwnd, IDC_COENEVER) ? COE_NEVER :
COE_NEVER; COE_NORMAL;
} }
break; break;
case IDC_CLOSEWARN: case IDC_CLOSEWARN: