X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/fe8abbf463f798f37ee4f43b3b85583a80fbddf4..e35fb54b2ce23c668414c0f5cd072c709374fc6d:/wincfg.c diff --git a/wincfg.c b/wincfg.c index 5b5bf9a4..070e6f53 100644 --- a/wincfg.c +++ b/wincfg.c @@ -3,8 +3,6 @@ * box. */ -#include - #include #include @@ -37,6 +35,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, { struct controlset *s; union control *c; + char *str; if (!midsession) { /* @@ -54,6 +53,41 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, } /* + * Full-screen mode is a Windows peculiarity; hence + * scrollbar_in_fullscreen is as well. + */ + s = ctrl_getset(b, "Window", "scrollback", + "Control the scrollback in the window"); + ctrl_checkbox(s, "Display scrollbar in full screen mode", 'i', + HELPCTX(window_scrollback), + dlg_stdcheckbox_handler, + I(offsetof(Config,scrollbar_in_fullscreen))); + /* + * Really this wants to go just after `Display scrollbar'. See + * if we can find that control, and do some shuffling. + */ + { + int i; + for (i = 0; i < s->ncontrols; i++) { + c = s->ctrls[i]; + if (c->generic.type == CTRL_CHECKBOX && + c->generic.context.i == offsetof(Config,scrollbar)) { + /* + * Control i is the scrollbar checkbox. + * Control s->ncontrols-1 is the scrollbar-in-FS one. + */ + if (i < s->ncontrols-2) { + c = s->ctrls[s->ncontrols-1]; + memmove(s->ctrls+i+2, s->ctrls+i+1, + (s->ncontrols-i-2)*sizeof(union control *)); + s->ctrls[i+1] = c; + } + break; + } + } + } + + /* * Windows has the AltGr key, which has various Windows- * specific options. */ @@ -67,10 +101,10 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, dlg_stdcheckbox_handler, I(offsetof(Config,ctrlaltkeys))); /* - * Windows allows an arbitrary .WAV to be played as a bell. For - * this we must search the existing controlset for the - * radio-button set controlling the `beep' option, and add an - * extra button to it. + * Windows allows an arbitrary .WAV to be played as a bell, and + * also the use of the PC speaker. For this we must search the + * existing controlset for the radio-button set controlling the + * `beep' option, and add extra buttons to it. * * Note that although this _looks_ like a hideous hack, it's * actually all above board. The well-defined interface to the @@ -91,22 +125,22 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, if (c->generic.type == CTRL_RADIO && c->generic.context.i == offsetof(Config, beep)) { assert(c->generic.handler == dlg_stdradiobutton_handler); - c->radio.nbuttons++; + c->radio.nbuttons += 2; c->radio.buttons = - srealloc(c->radio.buttons, - c->radio.nbuttons * sizeof(*c->radio.buttons)); + sresize(c->radio.buttons, c->radio.nbuttons, char *); c->radio.buttons[c->radio.nbuttons-1] = dupstr("Play a custom sound file"); + c->radio.buttons[c->radio.nbuttons-2] = + dupstr("Beep using the PC speaker"); c->radio.buttondata = - srealloc(c->radio.buttondata, - c->radio.nbuttons * sizeof(*c->radio.buttondata)); + sresize(c->radio.buttondata, c->radio.nbuttons, intorptr); c->radio.buttondata[c->radio.nbuttons-1] = I(BELL_WAVEFILE); + c->radio.buttondata[c->radio.nbuttons-2] = I(BELL_PCSPEAKER); if (c->radio.shortcuts) { c->radio.shortcuts = - srealloc(c->radio.shortcuts, - (c->radio.nbuttons * - sizeof(*c->radio.shortcuts))); + sresize(c->radio.shortcuts, c->radio.nbuttons, char); c->radio.shortcuts[c->radio.nbuttons-1] = NO_SHORTCUT; + c->radio.shortcuts[c->radio.nbuttons-2] = NO_SHORTCUT; } break; } @@ -155,8 +189,9 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, * additional options when working with line-drawing * characters. */ - s = ctrl_getset(b, "Window/Translation", "linedraw", - "Adjust how PuTTY displays line drawing characters"); + str = dupprintf("Adjust how %s displays line drawing characters", appname); + s = ctrl_getset(b, "Window/Translation", "linedraw", str); + sfree(str); { int i; for (i = 0; i < s->ncontrols; i++) { @@ -164,32 +199,30 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, if (c->generic.type == CTRL_RADIO && c->generic.context.i == offsetof(Config, vtmode)) { assert(c->generic.handler == dlg_stdradiobutton_handler); - c->radio.nbuttons += 2; + c->radio.nbuttons += 3; c->radio.buttons = - srealloc(c->radio.buttons, - c->radio.nbuttons * sizeof(*c->radio.buttons)); + sresize(c->radio.buttons, c->radio.nbuttons, char *); + c->radio.buttons[c->radio.nbuttons-3] = + dupstr("Font has XWindows encoding"); c->radio.buttons[c->radio.nbuttons-2] = dupstr("Use font in both ANSI and OEM modes"); c->radio.buttons[c->radio.nbuttons-1] = dupstr("Use font in OEM mode only"); c->radio.buttondata = - srealloc(c->radio.buttondata, - c->radio.nbuttons * sizeof(*c->radio.buttondata)); + sresize(c->radio.buttondata, c->radio.nbuttons, intorptr); + c->radio.buttondata[c->radio.nbuttons-3] = I(VT_XWINDOWS); c->radio.buttondata[c->radio.nbuttons-2] = I(VT_OEMANSI); c->radio.buttondata[c->radio.nbuttons-1] = I(VT_OEMONLY); if (!c->radio.shortcuts) { int j; - c->radio.shortcuts = - smalloc((c->radio.nbuttons * - sizeof(*c->radio.shortcuts))); + c->radio.shortcuts = snewn(c->radio.nbuttons, char); for (j = 0; j < c->radio.nbuttons; j++) c->radio.shortcuts[j] = NO_SHORTCUT; } else { - c->radio.shortcuts = - srealloc(c->radio.shortcuts, - (c->radio.nbuttons * - sizeof(*c->radio.shortcuts))); + c->radio.shortcuts = sresize(c->radio.shortcuts, + c->radio.nbuttons, char); } + c->radio.shortcuts[c->radio.nbuttons-3] = 'x'; c->radio.shortcuts[c->radio.nbuttons-2] = 'b'; c->radio.shortcuts[c->radio.nbuttons-1] = 'e'; break; @@ -200,8 +233,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, /* * RTF paste is Windows-specific. */ - s = ctrl_getset(b, "Window/Selection", "trans", - "Translation of pasted characters"); + s = ctrl_getset(b, "Window/Selection", "format", + "Formatting of pasted characters"); ctrl_checkbox(s, "Paste to clipboard in RTF as well as plain text", 'f', HELPCTX(selection_rtf), dlg_stdcheckbox_handler, I(offsetof(Config,rtf_paste))); @@ -213,12 +246,13 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, */ s = ctrl_getset(b, "Window/Selection", "mouse", "Control use of mouse"); - ctrl_radiobuttons(s, "Action of mouse buttons:", NO_SHORTCUT, 1, + ctrl_radiobuttons(s, "Action of mouse buttons:", 'm', 1, HELPCTX(selection_buttons), dlg_stdradiobutton_handler, I(offsetof(Config, mouse_is_xterm)), - "Windows (Right pastes, Middle extends)", 'w', I(0), - "xterm (Right extends, Middle pastes)", 'x', I(1), NULL); + "Windows (Middle extends, Right brings up menu)", I(2), + "Compromise (Middle extends, Right pastes)", I(0), + "xterm (Right extends, Middle pastes)", I(1), NULL); /* * This really ought to go at the _top_ of its box, not the * bottom, so we'll just do some shuffling now we've set it @@ -236,6 +270,10 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, ctrl_checkbox(s, "Attempt to use logical palettes", 'l', HELPCTX(colours_logpal), dlg_stdcheckbox_handler, I(offsetof(Config,try_palette))); + ctrl_checkbox(s, "Use system colours", 's', + HELPCTX(colours_system), + dlg_stdcheckbox_handler, I(offsetof(Config,system_colour))); + /* * Resize-by-changing-font is a Windows insanity.