2003-03-05 22:07:40 +00:00
|
|
|
/*
|
2022-01-22 15:38:53 +00:00
|
|
|
* config.c - the Windows-specific parts of the PuTTY configuration
|
2003-03-05 22:07:40 +00:00
|
|
|
* box.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "putty.h"
|
|
|
|
#include "dialog.h"
|
|
|
|
#include "storage.h"
|
|
|
|
|
2022-05-01 08:48:38 +00:00
|
|
|
static void about_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
2019-09-08 19:29:00 +00:00
|
|
|
void *data, int event)
|
2003-03-05 22:07:40 +00:00
|
|
|
{
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
HWND *hwndp = (HWND *)ctrl->context.p;
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
if (event == EVENT_ACTION) {
|
2019-09-08 19:29:00 +00:00
|
|
|
modal_about_box(*hwndp);
|
2003-03-05 22:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 08:48:38 +00:00
|
|
|
static void help_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
2019-09-08 19:29:00 +00:00
|
|
|
void *data, int event)
|
2003-03-05 22:07:40 +00:00
|
|
|
{
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
HWND *hwndp = (HWND *)ctrl->context.p;
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
if (event == EVENT_ACTION) {
|
2019-09-08 19:29:00 +00:00
|
|
|
show_help(*hwndp);
|
2003-03-05 22:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 08:48:38 +00:00
|
|
|
static void variable_pitch_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
2010-12-29 14:11:25 +00:00
|
|
|
void *data, int event)
|
|
|
|
{
|
|
|
|
if (event == EVENT_REFRESH) {
|
2019-09-08 19:29:00 +00:00
|
|
|
dlg_checkbox_set(ctrl, dlg, !dlg_get_fixed_pitch_flag(dlg));
|
2010-12-29 14:11:25 +00:00
|
|
|
} else if (event == EVENT_VALCHANGE) {
|
2019-09-08 19:29:00 +00:00
|
|
|
dlg_set_fixed_pitch_flag(dlg, !dlg_checkbox_get(ctrl, dlg));
|
2010-12-29 14:11:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Convert a lot of 'int' variables to 'bool'.
My normal habit these days, in new code, is to treat int and bool as
_almost_ completely separate types. I'm still willing to use C's
implicit test for zero on an integer (e.g. 'if (!blob.len)' is fine,
no need to spell it out as blob.len != 0), but generally, if a
variable is going to be conceptually a boolean, I like to declare it
bool and assign to it using 'true' or 'false' rather than 0 or 1.
PuTTY is an exception, because it predates the C99 bool, and I've
stuck to its existing coding style even when adding new code to it.
But it's been annoying me more and more, so now that I've decided C99
bool is an acceptable thing to require from our toolchain in the first
place, here's a quite thorough trawl through the source doing
'boolification'. Many variables and function parameters are now typed
as bool rather than int; many assignments of 0 or 1 to those variables
are now spelled 'true' or 'false'.
I managed this thorough conversion with the help of a custom clang
plugin that I wrote to trawl the AST and apply heuristics to point out
where things might want changing. So I've even managed to do a decent
job on parts of the code I haven't looked at in years!
To make the plugin's work easier, I pushed platform front ends
generally in the direction of using standard 'bool' in preference to
platform-specific boolean types like Windows BOOL or GTK's gboolean;
I've left the platform booleans in places they _have_ to be for the
platform APIs to work right, but variables only used by my own code
have been converted wherever I found them.
In a few places there are int values that look very like booleans in
_most_ of the places they're used, but have a rarely-used third value,
or a distinction between different nonzero values that most users
don't care about. In these cases, I've _removed_ uses of 'true' and
'false' for the return values, to emphasise that there's something
more subtle going on than a simple boolean answer:
- the 'multisel' field in dialog.h's list box structure, for which
the GTK front end in particular recognises a difference between 1
and 2 but nearly everything else treats as boolean
- the 'urgent' parameter to plug_receive, where 1 vs 2 tells you
something about the specific location of the urgent pointer, but
most clients only care about 0 vs 'something nonzero'
- the return value of wc_match, where -1 indicates a syntax error in
the wildcard.
- the return values from SSH-1 RSA-key loading functions, which use
-1 for 'wrong passphrase' and 0 for all other failures (so any
caller which already knows it's not loading an _encrypted private_
key can treat them as boolean)
- term->esc_query, and the 'query' parameter in toggle_mode in
terminal.c, which _usually_ hold 0 for ESC[123h or 1 for ESC[?123h,
but can also hold -1 for some other intervening character that we
don't support.
In a few places there's an integer that I haven't turned into a bool
even though it really _can_ only take values 0 or 1 (and, as above,
tried to make the call sites consistent in not calling those values
true and false), on the grounds that I thought it would make it more
confusing to imply that the 0 value was in some sense 'negative' or
bad and the 1 positive or good:
- the return value of plug_accepting uses the POSIXish convention of
0=success and nonzero=error; I think if I made it bool then I'd
also want to reverse its sense, and that's a job for a separate
piece of work.
- the 'screen' parameter to lineptr() in terminal.c, where 0 and 1
represent the default and alternate screens. There's no obvious
reason why one of those should be considered 'true' or 'positive'
or 'success' - they're just indices - so I've left it as int.
ssh_scp_recv had particularly confusing semantics for its previous int
return value: its call sites used '<= 0' to check for error, but it
never actually returned a negative number, just 0 or 1. Now the
function and its call sites agree that it's a bool.
In a couple of places I've renamed variables called 'ret', because I
don't like that name any more - it's unclear whether it means the
return value (in preparation) for the _containing_ function or the
return value received from a subroutine call, and occasionally I've
accidentally used the same variable for both and introduced a bug. So
where one of those got in my way, I've renamed it to 'toret' or 'retd'
(the latter short for 'returned') in line with my usual modern
practice, but I haven't done a thorough job of finding all of them.
Finally, one amusing side effect of doing this is that I've had to
separate quite a few chained assignments. It used to be perfectly fine
to write 'a = b = c = TRUE' when a,b,c were int and TRUE was just a
the 'true' defined by stdbool.h, that idiom provokes a warning from
gcc: 'suggest parentheses around assignment used as truth value'!
2018-11-02 19:23:19 +00:00
|
|
|
void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
2019-09-08 19:29:00 +00:00
|
|
|
bool midsession, int protocol)
|
2003-03-05 22:07:40 +00:00
|
|
|
{
|
2020-02-14 12:49:56 +00:00
|
|
|
const struct BackendVtable *backvt;
|
|
|
|
bool resize_forbidden = false;
|
2003-03-05 22:07:40 +00:00
|
|
|
struct controlset *s;
|
2022-05-01 08:48:38 +00:00
|
|
|
dlgcontrol *c;
|
2003-04-06 14:11:33 +00:00
|
|
|
char *str;
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
if (!midsession) {
|
2019-09-08 19:29:00 +00:00
|
|
|
/*
|
|
|
|
* Add the About and Help buttons to the standard panel.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "", "", "");
|
|
|
|
c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),
|
|
|
|
about_handler, P(hwndp));
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
c->column = 0;
|
2019-09-08 19:29:00 +00:00
|
|
|
if (has_help) {
|
|
|
|
c = ctrl_pushbutton(s, "Help", 'h', HELPCTX(no_help),
|
|
|
|
help_handler, P(hwndp));
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
c->column = 1;
|
2019-09-08 19:29:00 +00:00
|
|
|
}
|
2003-03-05 22:07:40 +00:00
|
|
|
}
|
|
|
|
|
2003-03-14 18:35:01 +00:00
|
|
|
/*
|
|
|
|
* Full-screen mode is a Windows peculiarity; hence
|
|
|
|
* scrollbar_in_fullscreen is as well.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Window", "scrollback",
|
2019-09-08 19:29:00 +00:00
|
|
|
"Control the scrollback in the window");
|
2003-03-14 18:35:01 +00:00
|
|
|
ctrl_checkbox(s, "Display scrollbar in full screen mode", 'i',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(window_scrollback),
|
|
|
|
conf_checkbox_handler,
|
|
|
|
I(CONF_scrollbar_in_fullscreen));
|
2003-03-14 18:35:01 +00:00
|
|
|
/*
|
|
|
|
* 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];
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
if (c->type == CTRL_CHECKBOX &&
|
|
|
|
c->context.i == CONF_scrollbar) {
|
2003-03-14 18:35:01 +00:00
|
|
|
/*
|
|
|
|
* 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,
|
2022-05-01 08:48:38 +00:00
|
|
|
(s->ncontrols-i-2)*sizeof(dlgcontrol *));
|
2003-03-14 18:35:01 +00:00
|
|
|
s->ctrls[i+1] = c;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-05 22:07:40 +00:00
|
|
|
/*
|
|
|
|
* Windows has the AltGr key, which has various Windows-
|
|
|
|
* specific options.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Terminal/Keyboard", "features",
|
2019-09-08 19:29:00 +00:00
|
|
|
"Enable extra keyboard features:");
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "AltGr acts as Compose key", 't',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(keyboard_compose),
|
|
|
|
conf_checkbox_handler, I(CONF_compose_key));
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "Control-Alt is different from AltGr", 'd',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(keyboard_ctrlalt),
|
|
|
|
conf_checkbox_handler, I(CONF_ctrlaltkeys));
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
/*
|
2003-05-24 12:31:32 +00:00
|
|
|
* 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.
|
2019-09-08 19:29:00 +00:00
|
|
|
*
|
2003-03-05 22:07:40 +00:00
|
|
|
* Note that although this _looks_ like a hideous hack, it's
|
|
|
|
* actually all above board. The well-defined interface to the
|
|
|
|
* per-platform dialog box code is the _data structures_ `union
|
|
|
|
* control', `struct controlset' and so on; so code like this
|
|
|
|
* that reaches into those data structures and changes bits of
|
|
|
|
* them is perfectly legitimate and crosses no boundaries. All
|
|
|
|
* the ctrl_* routines that create most of the controls are
|
|
|
|
* convenient shortcuts provided on the cross-platform side of
|
|
|
|
* the interface, and template creation code is under no actual
|
|
|
|
* obligation to use them.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Terminal/Bell", "style", "Set the style of bell");
|
|
|
|
{
|
2019-09-08 19:29:00 +00:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < s->ncontrols; i++) {
|
|
|
|
c = s->ctrls[i];
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
if (c->type == CTRL_RADIO &&
|
|
|
|
c->context.i == CONF_beep) {
|
|
|
|
assert(c->handler == conf_radiobutton_handler);
|
2019-09-08 19:29:00 +00:00
|
|
|
c->radio.nbuttons += 2;
|
|
|
|
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 =
|
|
|
|
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 =
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2003-03-05 22:07:40 +00:00
|
|
|
}
|
|
|
|
ctrl_filesel(s, "Custom sound file to play as a bell:", NO_SHORTCUT,
|
2024-12-13 19:23:30 +00:00
|
|
|
FILTER_SOUND_FILES, false, "Select bell sound file",
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(bell_style),
|
|
|
|
conf_filesel_handler, I(CONF_bell_wavefile));
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* While we've got this box open, taskbar flashing on a bell is
|
|
|
|
* also Windows-specific.
|
|
|
|
*/
|
|
|
|
ctrl_radiobuttons(s, "Taskbar/caption indication on bell:", 'i', 3,
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(bell_taskbar),
|
|
|
|
conf_radiobutton_handler,
|
|
|
|
I(CONF_beep_ind),
|
|
|
|
"Disabled", I(B_IND_DISABLED),
|
|
|
|
"Flashing", I(B_IND_FLASH),
|
2022-06-01 10:14:21 +00:00
|
|
|
"Steady", I(B_IND_STEADY));
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The sunken-edge border is a Windows GUI feature.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Window/Appearance", "border",
|
2019-09-08 19:29:00 +00:00
|
|
|
"Adjust the window border");
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "Sunken-edge border (slightly thicker)", 's',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(appearance_border),
|
|
|
|
conf_checkbox_handler, I(CONF_sunken_edge));
|
2003-03-05 22:07:40 +00:00
|
|
|
|
2006-01-11 23:42:02 +00:00
|
|
|
/*
|
|
|
|
* Configurable font quality settings for Windows.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Window/Appearance", "font",
|
2019-09-08 19:29:00 +00:00
|
|
|
"Font settings");
|
2010-12-29 14:11:25 +00:00
|
|
|
ctrl_checkbox(s, "Allow selection of variable-pitch fonts", NO_SHORTCUT,
|
|
|
|
HELPCTX(appearance_font), variable_pitch_handler, I(0));
|
2006-01-11 23:42:02 +00:00
|
|
|
ctrl_radiobuttons(s, "Font quality:", 'q', 2,
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(appearance_font),
|
|
|
|
conf_radiobutton_handler,
|
|
|
|
I(CONF_font_quality),
|
|
|
|
"Antialiased", I(FQ_ANTIALIASED),
|
|
|
|
"Non-Antialiased", I(FQ_NONANTIALIASED),
|
|
|
|
"ClearType", I(FQ_CLEARTYPE),
|
2022-06-01 10:14:21 +00:00
|
|
|
"Default", I(FQ_DEFAULT));
|
2006-01-11 23:42:02 +00:00
|
|
|
|
2003-03-05 22:07:40 +00:00
|
|
|
/*
|
|
|
|
* Cyrillic Lock is a horrid misfeature even on Windows, and
|
|
|
|
* the least we can do is ensure it never makes it to any other
|
|
|
|
* platform (at least unless someone fixes it!).
|
|
|
|
*/
|
2005-03-22 23:20:23 +00:00
|
|
|
s = ctrl_getset(b, "Window/Translation", "tweaks", NULL);
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "Caps Lock acts as Cyrillic switch", 's',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(translation_cyrillic),
|
|
|
|
conf_checkbox_handler,
|
|
|
|
I(CONF_xlat_capslockcyr));
|
2003-03-05 22:07:40 +00:00
|
|
|
|
2004-11-29 09:23:11 +00:00
|
|
|
/*
|
|
|
|
* On Windows we can use but not enumerate translation tables
|
|
|
|
* from the operating system. Briefly document this.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Window/Translation", "trans",
|
2019-09-08 19:29:00 +00:00
|
|
|
"Character set translation on received data");
|
2004-11-29 09:23:11 +00:00
|
|
|
ctrl_text(s, "(Codepages supported by Windows but not listed here, "
|
2019-09-08 19:29:00 +00:00
|
|
|
"such as CP866 on many systems, can be entered manually)",
|
|
|
|
HELPCTX(translation_codepage));
|
2004-11-29 09:23:11 +00:00
|
|
|
|
2003-03-05 22:07:40 +00:00
|
|
|
/*
|
|
|
|
* Windows has the weird OEM font mode, which gives us some
|
|
|
|
* additional options when working with line-drawing
|
|
|
|
* characters.
|
|
|
|
*/
|
2003-04-06 14:11:33 +00:00
|
|
|
str = dupprintf("Adjust how %s displays line drawing characters", appname);
|
|
|
|
s = ctrl_getset(b, "Window/Translation", "linedraw", str);
|
|
|
|
sfree(str);
|
2003-03-05 22:07:40 +00:00
|
|
|
{
|
2019-09-08 19:29:00 +00:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < s->ncontrols; i++) {
|
|
|
|
c = s->ctrls[i];
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
if (c->type == CTRL_RADIO &&
|
|
|
|
c->context.i == CONF_vtmode) {
|
|
|
|
assert(c->handler == conf_radiobutton_handler);
|
2019-09-08 19:29:00 +00:00
|
|
|
c->radio.nbuttons += 3;
|
|
|
|
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 =
|
|
|
|
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 = snewn(c->radio.nbuttons, char);
|
|
|
|
for (j = 0; j < c->radio.nbuttons; j++)
|
|
|
|
c->radio.shortcuts[j] = NO_SHORTCUT;
|
|
|
|
} else {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2003-03-05 22:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* RTF paste is Windows-specific.
|
|
|
|
*/
|
2018-03-11 18:57:13 +00:00
|
|
|
s = ctrl_getset(b, "Window/Selection/Copy", "format",
|
2019-09-08 19:29:00 +00:00
|
|
|
"Formatting of copied characters");
|
2018-03-11 18:57:13 +00:00
|
|
|
ctrl_checkbox(s, "Copy to clipboard in RTF as well as plain text", 'f',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(copy_rtf),
|
|
|
|
conf_checkbox_handler, I(CONF_rtf_paste));
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Windows often has no middle button, so we supply a selection
|
|
|
|
* mode in which the more critical Paste action is available on
|
|
|
|
* the right button instead.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Window/Selection", "mouse",
|
2019-09-08 19:29:00 +00:00
|
|
|
"Control use of mouse");
|
2003-11-20 18:41:12 +00:00
|
|
|
ctrl_radiobuttons(s, "Action of mouse buttons:", 'm', 1,
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(selection_buttons),
|
|
|
|
conf_radiobutton_handler,
|
|
|
|
I(CONF_mouse_is_xterm),
|
|
|
|
"Windows (Middle extends, Right brings up menu)", I(2),
|
|
|
|
"Compromise (Middle extends, Right pastes)", I(0),
|
2022-06-01 10:14:21 +00:00
|
|
|
"xterm (Right extends, Middle pastes)", I(1));
|
2003-03-05 22:07:40 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* up...
|
|
|
|
*/
|
|
|
|
c = s->ctrls[s->ncontrols-1]; /* this should be the new control */
|
2022-05-01 08:48:38 +00:00
|
|
|
memmove(s->ctrls+1, s->ctrls, (s->ncontrols-1)*sizeof(dlgcontrol *));
|
2003-03-05 22:07:40 +00:00
|
|
|
s->ctrls[0] = c;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Logical palettes don't even make sense anywhere except Windows.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Window/Colours", "general",
|
2019-09-08 19:29:00 +00:00
|
|
|
"General options for colour usage");
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "Attempt to use logical palettes", 'l',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(colours_logpal),
|
|
|
|
conf_checkbox_handler, I(CONF_try_palette));
|
2003-09-03 20:14:38 +00:00
|
|
|
ctrl_checkbox(s, "Use system colours", 's',
|
|
|
|
HELPCTX(colours_system),
|
Post-release destabilisation! Completely remove the struct type
'Config' in putty.h, which stores all PuTTY's settings and includes an
arbitrary length limit on every single one of those settings which is
stored in string form. In place of it is 'Conf', an opaque data type
everywhere outside the new file conf.c, which stores a list of (key,
value) pairs in which every key contains an integer identifying a
configuration setting, and for some of those integers the key also
contains extra parts (so that, for instance, CONF_environmt is a
string-to-string mapping). Everywhere that a Config was previously
used, a Conf is now; everywhere there was a Config structure copy,
conf_copy() is called; every lookup, adjustment, load and save
operation on a Config has been rewritten; and there's a mechanism for
serialising a Conf into a binary blob and back for use with Duplicate
Session.
User-visible effects of this change _should_ be minimal, though I
don't doubt I've introduced one or two bugs here and there which will
eventually be found. The _intended_ visible effects of this change are
that all arbitrary limits on configuration strings and lists (e.g.
limit on number of port forwardings) should now disappear; that list
boxes in the configuration will now be displayed in a sorted order
rather than the arbitrary order in which they were added to the list
(since the underlying data structure is now a sorted tree234 rather
than an ad-hoc comma-separated string); and one more specific change,
which is that local and dynamic port forwardings on the same port
number are now mutually exclusive in the configuration (putting 'D' in
the key rather than the value was a mistake in the first place).
One other reorganisation as a result of this is that I've moved all
the dialog.c standard handlers (dlg_stdeditbox_handler and friends)
out into config.c, because I can't really justify calling them generic
any more. When they took a pointer to an arbitrary structure type and
the offset of a field within that structure, they were independent of
whether that structure was a Config or something completely different,
but now they really do expect to talk to a Conf, which can _only_ be
used for PuTTY configuration, so I've renamed them all things like
conf_editbox_handler and moved them out of the nominally independent
dialog-box management module into the PuTTY-specific config.c.
[originally from svn r9214]
2011-07-14 18:52:21 +00:00
|
|
|
conf_checkbox_handler, I(CONF_system_colour));
|
2003-09-03 20:14:38 +00:00
|
|
|
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Resize-by-changing-font is a Windows insanity.
|
|
|
|
*/
|
2020-02-14 12:49:56 +00:00
|
|
|
|
|
|
|
backvt = backend_vt_from_proto(protocol);
|
|
|
|
if (backvt)
|
|
|
|
resize_forbidden = (backvt->flags & BACKEND_RESIZE_FORBIDDEN);
|
|
|
|
if (!midsession || !resize_forbidden) {
|
|
|
|
s = ctrl_getset(b, "Window", "size", "Set the size of the window");
|
|
|
|
ctrl_radiobuttons(s, "When window is resized:", 'z', 1,
|
|
|
|
HELPCTX(window_resize),
|
|
|
|
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),
|
2022-06-01 10:14:21 +00:00
|
|
|
"Forbid resizing completely", I(RESIZE_DISABLED));
|
2020-02-14 12:49:56 +00:00
|
|
|
}
|
2003-03-05 22:07:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Most of the Window/Behaviour stuff is there to mimic Windows
|
|
|
|
* conventions which PuTTY can optionally disregard. Hence,
|
|
|
|
* most of these options are Windows-specific.
|
|
|
|
*/
|
|
|
|
s = ctrl_getset(b, "Window/Behaviour", "main", NULL);
|
|
|
|
ctrl_checkbox(s, "Window closes on ALT-F4", '4',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(behaviour_altf4),
|
|
|
|
conf_checkbox_handler, I(CONF_alt_f4));
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "System menu appears on ALT-Space", 'y',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(behaviour_altspace),
|
|
|
|
conf_checkbox_handler, I(CONF_alt_space));
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "System menu appears on ALT alone", 'l',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(behaviour_altonly),
|
|
|
|
conf_checkbox_handler, I(CONF_alt_only));
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "Ensure window is always on top", 'e',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(behaviour_alwaysontop),
|
|
|
|
conf_checkbox_handler, I(CONF_alwaysontop));
|
2003-03-05 22:07:40 +00:00
|
|
|
ctrl_checkbox(s, "Full screen on Alt-Enter", 'f',
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(behaviour_altenter),
|
|
|
|
conf_checkbox_handler,
|
|
|
|
I(CONF_fullscreenonaltenter));
|
2006-08-26 10:20:16 +00:00
|
|
|
|
|
|
|
/*
|
2022-04-22 13:55:44 +00:00
|
|
|
* Windows supports a local-command proxy.
|
2006-08-26 10:20:16 +00:00
|
|
|
*/
|
|
|
|
if (!midsession) {
|
2019-09-08 19:29:00 +00:00
|
|
|
int i;
|
2006-08-26 10:20:16 +00:00
|
|
|
s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
|
2019-09-08 19:29:00 +00:00
|
|
|
for (i = 0; i < s->ncontrols; i++) {
|
|
|
|
c = s->ctrls[i];
|
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every
branch of the old 'union control' had to repeat all the generic
fields, and then call sites had to make an arbitrary decision about
which branch to access them through.
That was the best we could do before accepting C99 features in this
code base. But now we have anonymous unions, so we don't need to put
up with that nonsense any more!
'dlgcontrol' is now a struct rather than a union, and the generic
fields common to all control types are ordinary members of the struct,
so you don't have to refer to them as ctrl->generic.foo at all, just
ctrl->foo, which saves verbiage at the point of use.
The extra per-control fields are still held in structures named after
the control type, so you'll still say ctrl->listbox.height or
whatever. But now those structures are themselves members of an
anonymous union field following the generic fields, so those
sub-structures don't have to reiterate all the standard stuff too.
While I'm here, I've promoted 'context2' from an editbox-specific
field to a generic one (it just seems silly _not_ to allow any control
to have two context fields if it needs it). Also, I had to rename the
boolean field 'tabdelay' to avoid it clashing with the subsidiary
structure field 'tabdelay', now that the former isn't generic.tabdelay
any more.
2022-05-01 08:55:52 +00:00
|
|
|
if (c->type == CTRL_LISTBOX &&
|
|
|
|
c->handler == proxy_type_handler) {
|
|
|
|
c->context.i |= PROXY_UI_FLAG_LOCAL;
|
2019-09-08 19:29:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-08-26 10:20:16 +00:00
|
|
|
}
|
2006-08-28 10:35:12 +00:00
|
|
|
|
2008-11-17 18:38:09 +00:00
|
|
|
/*
|
|
|
|
* $XAUTHORITY is not reliable on Windows, so we provide a
|
|
|
|
* means to override it.
|
|
|
|
*/
|
2018-09-11 15:23:38 +00:00
|
|
|
if (!midsession && backend_vt_from_proto(PROT_SSH)) {
|
2019-09-08 19:29:00 +00:00
|
|
|
s = ctrl_getset(b, "Connection/SSH/X11", "x11", "X11 forwarding");
|
|
|
|
ctrl_filesel(s, "X authority file for local display", 't',
|
2024-12-13 19:23:30 +00:00
|
|
|
FILTER_ALL_FILES, false, "Select X authority file",
|
2019-09-08 19:29:00 +00:00
|
|
|
HELPCTX(ssh_tunnels_xauthority),
|
|
|
|
conf_filesel_handler, I(CONF_xauthfile));
|
2008-11-25 18:43:52 +00:00
|
|
|
}
|
2003-03-05 22:07:40 +00:00
|
|
|
}
|