2 * uxcfg.c - the Unix-specific parts of the PuTTY configuration
13 static void about_handler(union control
*ctrl
, void *dlg
,
14 void *data
, int event
)
16 if (event
== EVENT_ACTION
) {
17 about_box(ctrl
->generic
.context
.p
);
21 void unix_setup_config_box(struct controlbox
*b
, int midsession
, void *win
)
23 struct controlset
*s
, *s2
;
29 * Add the About button to the standard panel.
31 s
= ctrl_getset(b
, "", "", "");
32 c
= ctrl_pushbutton(s
, "About", 'a', HELPCTX(no_help
),
33 about_handler
, P(win
));
34 c
->generic
.column
= 0;
38 * The Config structure contains two Unix-specific elements
39 * which are not configured in here: stamp_utmp and
40 * login_shell. This is because pterm does not put up a
41 * configuration box right at the start, which is the only time
42 * when these elements would be useful to configure.
46 * On Unix, we don't have a drop-down list for the printer
49 s
= ctrl_getset(b
, "Terminal", "printing", "Remote-controlled printing");
50 assert(s
->ncontrols
== 1 && s
->ctrls
[0]->generic
.type
== CTRL_EDITBOX
);
51 s
->ctrls
[0]->editbox
.has_list
= 0;
54 * GTK makes it rather easier to put the scrollbar on the left
57 s
= ctrl_getset(b
, "Window", "scrollback",
58 "Control the scrollback in the window");
59 ctrl_checkbox(s
, "Scrollbar on left", 'l',
61 dlg_stdcheckbox_handler
,
62 I(offsetof(Config
,scrollbar_on_left
)));
64 * Really this wants to go just after `Display scrollbar'. See
65 * if we can find that control, and do some shuffling.
67 for (i
= 0; i
< s
->ncontrols
; i
++) {
69 if (c
->generic
.type
== CTRL_CHECKBOX
&&
70 c
->generic
.context
.i
== offsetof(Config
,scrollbar
)) {
72 * Control i is the scrollbar checkbox.
73 * Control s->ncontrols-1 is the scrollbar-on-left one.
75 if (i
< s
->ncontrols
-2) {
76 c
= s
->ctrls
[s
->ncontrols
-1];
77 memmove(s
->ctrls
+i
+2, s
->ctrls
+i
+1,
78 (s
->ncontrols
-i
-2)*sizeof(union control
*));
86 * X requires three more fonts: bold, wide, and wide-bold; also
87 * we need the fiddly shadow-bold-offset control. This would
88 * make the Window/Appearance panel rather unwieldy and large,
89 * so I think the sensible thing here is to _move_ this
90 * controlset into a separate Window/Fonts panel!
92 s2
= ctrl_getset(b
, "Window/Appearance", "font",
94 /* Remove this controlset from b. */
95 for (i
= 0; i
< b
->nctrlsets
; i
++) {
96 if (b
->ctrlsets
[i
] == s2
) {
97 memmove(b
->ctrlsets
+i
, b
->ctrlsets
+i
+1,
98 (b
->nctrlsets
-i
-1) * sizeof(*b
->ctrlsets
));
103 ctrl_settitle(b
, "Window/Fonts", "Options controlling font usage");
104 s
= ctrl_getset(b
, "Window/Fonts", "font",
105 "Fonts for displaying non-bold text");
106 ctrl_fontsel(s
, "Font used for ordinary text", 'f',
108 dlg_stdfontsel_handler
, I(offsetof(Config
,font
)));
109 ctrl_fontsel(s
, "Font used for wide (CJK) text", 'w',
111 dlg_stdfontsel_handler
, I(offsetof(Config
,widefont
)));
112 s
= ctrl_getset(b
, "Window/Fonts", "fontbold",
113 "Fonts for displaying bolded text");
114 ctrl_fontsel(s
, "Font used for bolded text", 'b',
116 dlg_stdfontsel_handler
, I(offsetof(Config
,boldfont
)));
117 ctrl_fontsel(s
, "Font used for bold wide text", 'i',
119 dlg_stdfontsel_handler
, I(offsetof(Config
,wideboldfont
)));
120 ctrl_checkbox(s
, "Use shadow bold instead of bold fonts", 'u',
122 dlg_stdcheckbox_handler
,
123 I(offsetof(Config
,shadowbold
)));
124 ctrl_text(s
, "(Note that bold fonts or shadow bolding are only"
125 " used if you have not requested bolding to be done by"
126 " changing the text colour.)",
128 ctrl_editbox(s
, "Horizontal offset for shadow bold:", 'z', 20,
129 HELPCTX(no_help
), dlg_stdeditbox_handler
,
130 I(offsetof(Config
,shadowboldoffset
)), I(-1));
133 * Markus Kuhn feels, not totally unreasonably, that it's good
134 * for all applications to shift into UTF-8 mode if they notice
135 * that they've been started with a LANG setting dictating it,
136 * so that people don't have to keep remembering a separate
137 * UTF-8 option for every application they use. Therefore,
138 * here's an override option in the Translation panel.
140 s
= ctrl_getset(b
, "Window/Translation", "trans",
141 "Character set translation on received data");
142 ctrl_checkbox(s
, "Override with UTF-8 if locale says so", 'l',
143 HELPCTX(translation_utf8_override
),
144 dlg_stdcheckbox_handler
,
145 I(offsetof(Config
,utf8_override
)));
148 * Unix supports a local-command proxy. This also means we must
149 * adjust the text on the `Telnet command' control.
153 s
= ctrl_getset(b
, "Connection/Proxy", "basics", NULL
);
154 for (i
= 0; i
< s
->ncontrols
; i
++) {
156 if (c
->generic
.type
== CTRL_RADIO
&&
157 c
->generic
.context
.i
== offsetof(Config
, proxy_type
)) {
158 assert(c
->generic
.handler
== dlg_stdradiobutton_handler
);
161 sresize(c
->radio
.buttons
, c
->radio
.nbuttons
, char *);
162 c
->radio
.buttons
[c
->radio
.nbuttons
-1] =
164 c
->radio
.buttondata
=
165 sresize(c
->radio
.buttondata
, c
->radio
.nbuttons
, intorptr
);
166 c
->radio
.buttondata
[c
->radio
.nbuttons
-1] = I(PROXY_CMD
);
171 for (i
= 0; i
< s
->ncontrols
; i
++) {
173 if (c
->generic
.type
== CTRL_EDITBOX
&&
174 c
->generic
.context
.i
==
175 offsetof(Config
, proxy_telnet_command
)) {
176 assert(c
->generic
.handler
== dlg_stdeditbox_handler
);
177 sfree(c
->generic
.label
);
178 c
->generic
.label
= dupstr("Telnet command, or local"