X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/8def70c3ec6f81f95673c0de67a75b5a6b2e9e1c..edb548cd8283b5e3f680a0a8b641f9afb12d4ba4:/windows/wincfg.c diff --git a/windows/wincfg.c b/windows/wincfg.c index 516f0a3d..9d3673a6 100644 --- a/windows/wincfg.c +++ b/windows/wincfg.c @@ -30,6 +30,16 @@ static void help_handler(union control *ctrl, void *dlg, } } +static void variable_pitch_handler(union control *ctrl, void *dlg, + void *data, int event) +{ + if (event == EVENT_REFRESH) { + dlg_checkbox_set(ctrl, dlg, !dlg_get_fixed_pitch_flag(dlg)); + } else if (event == EVENT_VALCHANGE) { + dlg_set_fixed_pitch_flag(dlg, !dlg_checkbox_get(ctrl, dlg)); + } +} + void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, int midsession, int protocol) { @@ -60,8 +70,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, "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))); + conf_checkbox_handler, + I(CONF_scrollbar_in_fullscreen)); /* * Really this wants to go just after `Display scrollbar'. See * if we can find that control, and do some shuffling. @@ -71,7 +81,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, for (i = 0; i < s->ncontrols; i++) { c = s->ctrls[i]; if (c->generic.type == CTRL_CHECKBOX && - c->generic.context.i == offsetof(Config,scrollbar)) { + c->generic.context.i == CONF_scrollbar) { /* * Control i is the scrollbar checkbox. * Control s->ncontrols-1 is the scrollbar-in-FS one. @@ -95,10 +105,10 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, "Enable extra keyboard features:"); ctrl_checkbox(s, "AltGr acts as Compose key", 't', HELPCTX(keyboard_compose), - dlg_stdcheckbox_handler, I(offsetof(Config,compose_key))); + conf_checkbox_handler, I(CONF_compose_key)); ctrl_checkbox(s, "Control-Alt is different from AltGr", 'd', HELPCTX(keyboard_ctrlalt), - dlg_stdcheckbox_handler, I(offsetof(Config,ctrlaltkeys))); + conf_checkbox_handler, I(CONF_ctrlaltkeys)); /* * Windows allows an arbitrary .WAV to be played as a bell, and @@ -123,8 +133,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, for (i = 0; i < s->ncontrols; i++) { c = s->ctrls[i]; if (c->generic.type == CTRL_RADIO && - c->generic.context.i == offsetof(Config, beep)) { - assert(c->generic.handler == dlg_stdradiobutton_handler); + c->generic.context.i == CONF_beep) { + assert(c->generic.handler == conf_radiobutton_handler); c->radio.nbuttons += 2; c->radio.buttons = sresize(c->radio.buttons, c->radio.nbuttons, char *); @@ -149,7 +159,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, ctrl_filesel(s, "Custom sound file to play as a bell:", NO_SHORTCUT, FILTER_WAVE_FILES, FALSE, "Select bell sound file", HELPCTX(bell_style), - dlg_stdfilesel_handler, I(offsetof(Config, bell_wavefile))); + conf_filesel_handler, I(CONF_bell_wavefile)); /* * While we've got this box open, taskbar flashing on a bell is @@ -157,8 +167,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, */ ctrl_radiobuttons(s, "Taskbar/caption indication on bell:", 'i', 3, HELPCTX(bell_taskbar), - dlg_stdradiobutton_handler, - I(offsetof(Config, beep_ind)), + conf_radiobutton_handler, + I(CONF_beep_ind), "Disabled", I(B_IND_DISABLED), "Flashing", I(B_IND_FLASH), "Steady", I(B_IND_STEADY), NULL); @@ -170,17 +180,19 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, "Adjust the window border"); ctrl_checkbox(s, "Sunken-edge border (slightly thicker)", 's', HELPCTX(appearance_border), - dlg_stdcheckbox_handler, I(offsetof(Config,sunken_edge))); + conf_checkbox_handler, I(CONF_sunken_edge)); /* * Configurable font quality settings for Windows. */ s = ctrl_getset(b, "Window/Appearance", "font", "Font settings"); + ctrl_checkbox(s, "Allow selection of variable-pitch fonts", NO_SHORTCUT, + HELPCTX(appearance_font), variable_pitch_handler, I(0)); ctrl_radiobuttons(s, "Font quality:", 'q', 2, HELPCTX(appearance_font), - dlg_stdradiobutton_handler, - I(offsetof(Config, font_quality)), + conf_radiobutton_handler, + I(CONF_font_quality), "Antialiased", I(FQ_ANTIALIASED), "Non-Antialiased", I(FQ_NONANTIALIASED), "ClearType", I(FQ_CLEARTYPE), @@ -194,8 +206,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, s = ctrl_getset(b, "Window/Translation", "tweaks", NULL); ctrl_checkbox(s, "Caps Lock acts as Cyrillic switch", 's', HELPCTX(translation_cyrillic), - dlg_stdcheckbox_handler, - I(offsetof(Config,xlat_capslockcyr))); + conf_checkbox_handler, + I(CONF_xlat_capslockcyr)); /* * On Windows we can use but not enumerate translation tables @@ -220,8 +232,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, for (i = 0; i < s->ncontrols; i++) { c = s->ctrls[i]; if (c->generic.type == CTRL_RADIO && - c->generic.context.i == offsetof(Config, vtmode)) { - assert(c->generic.handler == dlg_stdradiobutton_handler); + c->generic.context.i == CONF_vtmode) { + assert(c->generic.handler == conf_radiobutton_handler); c->radio.nbuttons += 3; c->radio.buttons = sresize(c->radio.buttons, c->radio.nbuttons, char *); @@ -260,7 +272,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, "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))); + conf_checkbox_handler, I(CONF_rtf_paste)); /* * Windows often has no middle button, so we supply a selection @@ -271,8 +283,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, "Control use of mouse"); ctrl_radiobuttons(s, "Action of mouse buttons:", 'm', 1, HELPCTX(selection_buttons), - dlg_stdradiobutton_handler, - I(offsetof(Config, mouse_is_xterm)), + conf_radiobutton_handler, + I(CONF_mouse_is_xterm), "Windows (Middle extends, Right brings up menu)", I(2), "Compromise (Middle extends, Right pastes)", I(0), "xterm (Right extends, Middle pastes)", I(1), NULL); @@ -292,10 +304,10 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, "General options for colour usage"); ctrl_checkbox(s, "Attempt to use logical palettes", 'l', HELPCTX(colours_logpal), - dlg_stdcheckbox_handler, I(offsetof(Config,try_palette))); + conf_checkbox_handler, I(CONF_try_palette)); ctrl_checkbox(s, "Use system colours", 's', HELPCTX(colours_system), - dlg_stdcheckbox_handler, I(offsetof(Config,system_colour))); + conf_checkbox_handler, I(CONF_system_colour)); /* @@ -304,8 +316,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, s = ctrl_getset(b, "Window", "size", "Set the size of the window"); ctrl_radiobuttons(s, "When window is resized:", 'z', 1, HELPCTX(window_resize), - dlg_stdradiobutton_handler, - I(offsetof(Config, resize_action)), + conf_radiobutton_handler, + I(CONF_resize_action), "Change the number of rows and columns", I(RESIZE_TERM), "Change the size of the font", I(RESIZE_FONT), "Change font size only when maximised", I(RESIZE_EITHER), @@ -319,20 +331,20 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, s = ctrl_getset(b, "Window/Behaviour", "main", NULL); ctrl_checkbox(s, "Window closes on ALT-F4", '4', HELPCTX(behaviour_altf4), - dlg_stdcheckbox_handler, I(offsetof(Config,alt_f4))); + conf_checkbox_handler, I(CONF_alt_f4)); ctrl_checkbox(s, "System menu appears on ALT-Space", 'y', HELPCTX(behaviour_altspace), - dlg_stdcheckbox_handler, I(offsetof(Config,alt_space))); + conf_checkbox_handler, I(CONF_alt_space)); ctrl_checkbox(s, "System menu appears on ALT alone", 'l', HELPCTX(behaviour_altonly), - dlg_stdcheckbox_handler, I(offsetof(Config,alt_only))); + conf_checkbox_handler, I(CONF_alt_only)); ctrl_checkbox(s, "Ensure window is always on top", 'e', HELPCTX(behaviour_alwaysontop), - dlg_stdcheckbox_handler, I(offsetof(Config,alwaysontop))); + conf_checkbox_handler, I(CONF_alwaysontop)); ctrl_checkbox(s, "Full screen on Alt-Enter", 'f', HELPCTX(behaviour_altenter), - dlg_stdcheckbox_handler, - I(offsetof(Config,fullscreenonaltenter))); + conf_checkbox_handler, + I(CONF_fullscreenonaltenter)); /* * Windows supports a local-command proxy. This also means we @@ -344,8 +356,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, for (i = 0; i < s->ncontrols; i++) { c = s->ctrls[i]; if (c->generic.type == CTRL_RADIO && - c->generic.context.i == offsetof(Config, proxy_type)) { - assert(c->generic.handler == dlg_stdradiobutton_handler); + c->generic.context.i == CONF_proxy_type) { + assert(c->generic.handler == conf_radiobutton_handler); c->radio.nbuttons++; c->radio.buttons = sresize(c->radio.buttons, c->radio.nbuttons, char *); @@ -361,9 +373,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, for (i = 0; i < s->ncontrols; i++) { c = s->ctrls[i]; if (c->generic.type == CTRL_EDITBOX && - c->generic.context.i == - offsetof(Config, proxy_telnet_command)) { - assert(c->generic.handler == dlg_stdeditbox_handler); + c->generic.context.i == CONF_proxy_telnet_command) { + assert(c->generic.handler == conf_editbox_handler); sfree(c->generic.label); c->generic.label = dupstr("Telnet command, or local" " proxy command"); @@ -382,9 +393,11 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, * $XAUTHORITY is not reliable on Windows, so we provide a * means to override it. */ - s = ctrl_getset(b, "Connection/SSH/X11", "x11", "X11 forwarding"); - ctrl_filesel(s, "X authority file for local display", 't', - NULL, FALSE, "Select X authority file", - HELPCTX(ssh_tunnels_xauthority), - dlg_stdfilesel_handler, I(offsetof(Config, xauthfile))); + if (!midsession && backend_from_proto(PROT_SSH)) { + s = ctrl_getset(b, "Connection/SSH/X11", "x11", "X11 forwarding"); + ctrl_filesel(s, "X authority file for local display", 't', + NULL, FALSE, "Select X authority file", + HELPCTX(ssh_tunnels_xauthority), + conf_filesel_handler, I(CONF_xauthfile)); + } }