]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - unix/uxcfg.c
Continuing work on the GTK config box. Created uxcfg.c for the
[PuTTY.git] / unix / uxcfg.c
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
13 void unix_setup_config_box(struct controlbox *b, int midsession)
14 {
15     struct controlset *s, *s2;
16     union control *c;
17     int i;
18
19 #ifdef FIXME
20     if (!midsession) {
21         /*
22          * Add the About button to the standard panel.
23          */
24         s = ctrl_getset(b, "", "", "");
25         c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),
26                             about_handler, P(hwndp));
27         c->generic.column = 0;
28     }
29 #endif
30
31     /*
32      * The Config structure contains two Unix-specific elements
33      * which are not configured in here: stamp_utmp and
34      * login_shell. This is because pterm does not put up a
35      * configuration box right at the start, which is the only time
36      * when these elements would be useful to configure.
37      */
38
39     /*
40      * GTK makes it rather easier to put the scrollbar on the left
41      * than Windows does!
42      */
43     s = ctrl_getset(b, "Window", "scrollback",
44                     "Control the scrollback in the window");
45     ctrl_checkbox(s, "Scrollbar on left", 'l',
46                   HELPCTX(no_help),
47                   dlg_stdcheckbox_handler,
48                   I(offsetof(Config,scrollbar_on_left)));
49     /*
50      * Really this wants to go just after `Display scrollbar'. See
51      * if we can find that control, and do some shuffling.
52      */
53     for (i = 0; i < s->ncontrols; i++) {
54         c = s->ctrls[i];
55         if (c->generic.type == CTRL_CHECKBOX &&
56             c->generic.context.i == offsetof(Config,scrollbar)) {
57             /*
58              * Control i is the scrollbar checkbox.
59              * Control s->ncontrols-1 is the scrollbar-on-left one.
60              */
61             if (i < s->ncontrols-2) {
62                 c = s->ctrls[s->ncontrols-1];
63                 memmove(s->ctrls+i+2, s->ctrls+i+1,
64                         (s->ncontrols-i-2)*sizeof(union control *));
65                 s->ctrls[i+1] = c;
66             }
67             break;
68         }
69     }
70
71     /*
72      * X requires three more fonts: bold, wide, and wide-bold; also
73      * we need the fiddly shadow-bold-offset control. This would
74      * make the Window/Appearance panel rather unwieldy and large,
75      * so I think the sensible thing here is to _move_ this
76      * controlset into a separate Window/Fonts panel!
77      */
78     s2 = ctrl_getset(b, "Window/Appearance", "font",
79                      "Font settings");
80     /* Remove this controlset from b. */
81     for (i = 0; i < b->nctrlsets; i++) {
82         if (b->ctrlsets[i] == s2) {
83             memmove(b->ctrlsets+i, b->ctrlsets+i+1,
84                     (b->nctrlsets-i-1) * sizeof(*b->ctrlsets));
85             b->nctrlsets--;
86             break;
87         }
88     }
89     ctrl_settitle(b, "Window/Fonts", "Options controlling font usage");
90     s = ctrl_getset(b, "Window/Fonts", "font",
91                     "Fonts for displaying non-bold text");
92     ctrl_fontsel(s, "Font used for ordinary text", 'w',
93                  HELPCTX(no_help),
94                  dlg_stdfontsel_handler, I(offsetof(Config,font)));
95     ctrl_fontsel(s, "Font used for wide (CJK) text", 'w',
96                  HELPCTX(no_help),
97                  dlg_stdfontsel_handler, I(offsetof(Config,widefont)));
98     s = ctrl_getset(b, "Window/Fonts", "fontbold",
99                     "Fonts for displaying bolded text");
100     ctrl_fontsel(s, "Font used for bolded text", 'b',
101                  HELPCTX(no_help),
102                  dlg_stdfontsel_handler, I(offsetof(Config,boldfont)));
103     ctrl_fontsel(s, "Font used for bold wide text", 'i',
104                  HELPCTX(no_help),
105                  dlg_stdfontsel_handler, I(offsetof(Config,wideboldfont)));
106     ctrl_text(s, "If you leave the bold font selectors blank, bold text"
107               " will be displayed by overprinting (\"shadow bold\"). Note"
108               " that this only applies if you have not requested bolding"
109               " to be done by changing the text colour.",
110               HELPCTX(no_help));
111     ctrl_editbox(s, "Horizontal offset for shadow bold:", 'z', 20,
112                  HELPCTX(no_help), dlg_stdeditbox_handler,
113                  I(offsetof(Config,shadowboldoffset)), I(-1));
114 }