2 * gtkcfg.c - the GTK-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 gtk_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 * GTK makes it rather easier to put the scrollbar on the left
41 s = ctrl_getset(b, "Window", "scrollback",
42 "Control the scrollback in the window");
43 ctrl_checkbox(s, "Scrollbar on left", 'l',
45 conf_checkbox_handler,
46 I(CONF_scrollbar_on_left));
48 * Really this wants to go just after `Display scrollbar'. See
49 * if we can find that control, and do some shuffling.
51 for (i = 0; i < s->ncontrols; i++) {
53 if (c->generic.type == CTRL_CHECKBOX &&
54 c->generic.context.i == CONF_scrollbar) {
56 * Control i is the scrollbar checkbox.
57 * Control s->ncontrols-1 is the scrollbar-on-left one.
59 if (i < s->ncontrols-2) {
60 c = s->ctrls[s->ncontrols-1];
61 memmove(s->ctrls+i+2, s->ctrls+i+1,
62 (s->ncontrols-i-2)*sizeof(union control *));
70 * X requires three more fonts: bold, wide, and wide-bold; also
71 * we need the fiddly shadow-bold-offset control. This would
72 * make the Window/Appearance panel rather unwieldy and large,
73 * so I think the sensible thing here is to _move_ this
74 * controlset into a separate Window/Fonts panel!
76 s2 = ctrl_getset(b, "Window/Appearance", "font",
78 /* Remove this controlset from b. */
79 for (i = 0; i < b->nctrlsets; i++) {
80 if (b->ctrlsets[i] == s2) {
81 memmove(b->ctrlsets+i, b->ctrlsets+i+1,
82 (b->nctrlsets-i-1) * sizeof(*b->ctrlsets));
88 ctrl_settitle(b, "Window/Fonts", "Options controlling font usage");
89 s = ctrl_getset(b, "Window/Fonts", "font",
90 "Fonts for displaying non-bold text");
91 ctrl_fontsel(s, "Font used for ordinary text", 'f',
93 conf_fontsel_handler, I(CONF_font));
94 ctrl_fontsel(s, "Font used for wide (CJK) text", 'w',
96 conf_fontsel_handler, I(CONF_widefont));
97 s = ctrl_getset(b, "Window/Fonts", "fontbold",
98 "Fonts for displaying bolded text");
99 ctrl_fontsel(s, "Font used for bolded text", 'b',
101 conf_fontsel_handler, I(CONF_boldfont));
102 ctrl_fontsel(s, "Font used for bold wide text", 'i',
104 conf_fontsel_handler, I(CONF_wideboldfont));
105 ctrl_checkbox(s, "Use shadow bold instead of bold fonts", 'u',
107 conf_checkbox_handler,
109 ctrl_text(s, "(Note that bold fonts or shadow bolding are only"
110 " used if you have not requested bolding to be done by"
111 " changing the text colour.)",
113 ctrl_editbox(s, "Horizontal offset for shadow bold:", 'z', 20,
114 HELPCTX(no_help), conf_editbox_handler,
115 I(CONF_shadowboldoffset), I(-1));
118 * Markus Kuhn feels, not totally unreasonably, that it's good
119 * for all applications to shift into UTF-8 mode if they notice
120 * that they've been started with a LANG setting dictating it,
121 * so that people don't have to keep remembering a separate
122 * UTF-8 option for every application they use. Therefore,
123 * here's an override option in the Translation panel.
125 s = ctrl_getset(b, "Window/Translation", "trans",
126 "Character set translation on received data");
127 ctrl_checkbox(s, "Override with UTF-8 if locale says so", 'l',
128 HELPCTX(translation_utf8_override),
129 conf_checkbox_handler,
130 I(CONF_utf8_override));
132 #ifdef OSX_META_KEY_CONFIG
134 * On OS X, there are multiple reasonable opinions about whether
135 * Option or Command (or both, or neither) should act as a Meta
136 * key, or whether they should have their normal OS functions.
138 s = ctrl_getset(b, "Terminal/Keyboard", "meta",
139 "Choose the Meta key:");
140 ctrl_checkbox(s, "Option key acts as Meta", 'p',
142 conf_checkbox_handler, I(CONF_osx_option_meta));
143 ctrl_checkbox(s, "Command key acts as Meta", 'm',
145 conf_checkbox_handler, I(CONF_osx_command_meta));
150 * Allow the user to specify the window class as part of the saved
151 * configuration, so that they can have their window manager treat
152 * different kinds of PuTTY and pterm differently if they want to.
154 s = ctrl_getset(b, "Window/Behaviour", "x11",
155 "X Window System settings");
156 ctrl_editbox(s, "Window class name:", 'z', 50,
157 HELPCTX(no_help), conf_editbox_handler,
158 I(CONF_winclass), I(1));