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 * Unix supports a local-command proxy. This also means we must
134 * adjust the text on the `Telnet command' control.
138 s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
139 for (i = 0; i < s->ncontrols; i++) {
141 if (c->generic.type == CTRL_RADIO &&
142 c->generic.context.i == offsetof(Config, proxy_type)) {
143 assert(c->generic.handler == dlg_stdradiobutton_handler);
146 sresize(c->radio.buttons, c->radio.nbuttons, char *);
147 c->radio.buttons[c->radio.nbuttons-1] =
149 c->radio.buttondata =
150 sresize(c->radio.buttondata, c->radio.nbuttons, intorptr);
151 c->radio.buttondata[c->radio.nbuttons-1] = I(PROXY_CMD);
156 for (i = 0; i < s->ncontrols; i++) {
158 if (c->generic.type == CTRL_EDITBOX &&
159 c->generic.context.i ==
160 offsetof(Config, proxy_telnet_command)) {
161 assert(c->generic.handler == dlg_stdeditbox_handler);
162 sfree(c->generic.label);
163 c->generic.label = dupstr("Telnet command, or local"