1d0d4a3b |
1 | /* |
2 | * uxcfg.c - the Unix-specific parts of the PuTTY configuration |
3 | * box. |
4 | */ |
5 | |
6 | #include <assert.h> |
7 | #include <stdlib.h> |
8 | |
9 | #include "putty.h" |
10 | #include "dialog.h" |
11 | #include "storage.h" |
12 | |
47e4e735 |
13 | static void about_handler(union control *ctrl, void *dlg, |
14 | void *data, int event) |
15 | { |
16 | if (event == EVENT_ACTION) { |
7718480a |
17 | about_box(ctrl->generic.context.p); |
47e4e735 |
18 | } |
19 | } |
20 | |
7718480a |
21 | void unix_setup_config_box(struct controlbox *b, int midsession, void *win) |
1d0d4a3b |
22 | { |
23 | struct controlset *s, *s2; |
24 | union control *c; |
25 | int i; |
26 | |
1d0d4a3b |
27 | if (!midsession) { |
28 | /* |
29 | * Add the About button to the standard panel. |
30 | */ |
31 | s = ctrl_getset(b, "", "", ""); |
32 | c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help), |
7718480a |
33 | about_handler, P(win)); |
1d0d4a3b |
34 | c->generic.column = 0; |
35 | } |
1d0d4a3b |
36 | |
37 | /* |
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. |
43 | */ |
44 | |
45 | /* |
0f915619 |
46 | * On Unix, we don't have a drop-down list for the printer |
47 | * control. |
48 | */ |
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; |
52 | |
53 | /* |
1d0d4a3b |
54 | * GTK makes it rather easier to put the scrollbar on the left |
55 | * than Windows does! |
56 | */ |
57 | s = ctrl_getset(b, "Window", "scrollback", |
58 | "Control the scrollback in the window"); |
59 | ctrl_checkbox(s, "Scrollbar on left", 'l', |
60 | HELPCTX(no_help), |
61 | dlg_stdcheckbox_handler, |
62 | I(offsetof(Config,scrollbar_on_left))); |
63 | /* |
64 | * Really this wants to go just after `Display scrollbar'. See |
65 | * if we can find that control, and do some shuffling. |
66 | */ |
67 | for (i = 0; i < s->ncontrols; i++) { |
68 | c = s->ctrls[i]; |
69 | if (c->generic.type == CTRL_CHECKBOX && |
70 | c->generic.context.i == offsetof(Config,scrollbar)) { |
71 | /* |
72 | * Control i is the scrollbar checkbox. |
73 | * Control s->ncontrols-1 is the scrollbar-on-left one. |
74 | */ |
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 *)); |
79 | s->ctrls[i+1] = c; |
80 | } |
81 | break; |
82 | } |
83 | } |
84 | |
85 | /* |
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! |
91 | */ |
92 | s2 = ctrl_getset(b, "Window/Appearance", "font", |
93 | "Font settings"); |
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)); |
99 | b->nctrlsets--; |
100 | break; |
101 | } |
102 | } |
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"); |
406bf384 |
106 | ctrl_fontsel(s, "Font used for ordinary text", 'f', |
1d0d4a3b |
107 | HELPCTX(no_help), |
108 | dlg_stdfontsel_handler, I(offsetof(Config,font))); |
109 | ctrl_fontsel(s, "Font used for wide (CJK) text", 'w', |
110 | HELPCTX(no_help), |
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', |
115 | HELPCTX(no_help), |
116 | dlg_stdfontsel_handler, I(offsetof(Config,boldfont))); |
117 | ctrl_fontsel(s, "Font used for bold wide text", 'i', |
118 | HELPCTX(no_help), |
119 | dlg_stdfontsel_handler, I(offsetof(Config,wideboldfont))); |
120 | ctrl_text(s, "If you leave the bold font selectors blank, bold text" |
121 | " will be displayed by overprinting (\"shadow bold\"). Note" |
122 | " that this only applies if you have not requested bolding" |
123 | " to be done by changing the text colour.", |
124 | HELPCTX(no_help)); |
125 | ctrl_editbox(s, "Horizontal offset for shadow bold:", 'z', 20, |
126 | HELPCTX(no_help), dlg_stdeditbox_handler, |
127 | I(offsetof(Config,shadowboldoffset)), I(-1)); |
128 | } |