--- /dev/null
+/*\r
+ * gtkcfg.c - the GTK-specific parts of the PuTTY configuration\r
+ * box.\r
+ */\r
+\r
+#include <assert.h>\r
+#include <stdlib.h>\r
+\r
+#include "putty.h"\r
+#include "dialog.h"\r
+#include "storage.h"\r
+\r
+static void about_handler(union control *ctrl, void *dlg,\r
+ void *data, int event)\r
+{\r
+ if (event == EVENT_ACTION) {\r
+ about_box(ctrl->generic.context.p);\r
+ }\r
+}\r
+\r
+void gtk_setup_config_box(struct controlbox *b, int midsession, void *win)\r
+{\r
+ struct controlset *s, *s2;\r
+ union control *c;\r
+ int i;\r
+\r
+ if (!midsession) {\r
+ /*\r
+ * Add the About button to the standard panel.\r
+ */\r
+ s = ctrl_getset(b, "", "", "");\r
+ c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),\r
+ about_handler, P(win));\r
+ c->generic.column = 0;\r
+ }\r
+\r
+ /*\r
+ * GTK makes it rather easier to put the scrollbar on the left\r
+ * than Windows does!\r
+ */\r
+ s = ctrl_getset(b, "Window", "scrollback",\r
+ "Control the scrollback in the window");\r
+ ctrl_checkbox(s, "Scrollbar on left", 'l',\r
+ HELPCTX(no_help),\r
+ dlg_stdcheckbox_handler,\r
+ I(offsetof(Config,scrollbar_on_left)));\r
+ /*\r
+ * Really this wants to go just after `Display scrollbar'. See\r
+ * if we can find that control, and do some shuffling.\r
+ */\r
+ for (i = 0; i < s->ncontrols; i++) {\r
+ c = s->ctrls[i];\r
+ if (c->generic.type == CTRL_CHECKBOX &&\r
+ c->generic.context.i == offsetof(Config,scrollbar)) {\r
+ /*\r
+ * Control i is the scrollbar checkbox.\r
+ * Control s->ncontrols-1 is the scrollbar-on-left one.\r
+ */\r
+ if (i < s->ncontrols-2) {\r
+ c = s->ctrls[s->ncontrols-1];\r
+ memmove(s->ctrls+i+2, s->ctrls+i+1,\r
+ (s->ncontrols-i-2)*sizeof(union control *));\r
+ s->ctrls[i+1] = c;\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+ /*\r
+ * X requires three more fonts: bold, wide, and wide-bold; also\r
+ * we need the fiddly shadow-bold-offset control. This would\r
+ * make the Window/Appearance panel rather unwieldy and large,\r
+ * so I think the sensible thing here is to _move_ this\r
+ * controlset into a separate Window/Fonts panel!\r
+ */\r
+ s2 = ctrl_getset(b, "Window/Appearance", "font",\r
+ "Font settings");\r
+ /* Remove this controlset from b. */\r
+ for (i = 0; i < b->nctrlsets; i++) {\r
+ if (b->ctrlsets[i] == s2) {\r
+ memmove(b->ctrlsets+i, b->ctrlsets+i+1,\r
+ (b->nctrlsets-i-1) * sizeof(*b->ctrlsets));\r
+ b->nctrlsets--;\r
+ break;\r
+ }\r
+ }\r
+ ctrl_settitle(b, "Window/Fonts", "Options controlling font usage");\r
+ s = ctrl_getset(b, "Window/Fonts", "font",\r
+ "Fonts for displaying non-bold text");\r
+ ctrl_fontsel(s, "Font used for ordinary text", 'f',\r
+ HELPCTX(no_help),\r
+ dlg_stdfontsel_handler, I(offsetof(Config,font)));\r
+ ctrl_fontsel(s, "Font used for wide (CJK) text", 'w',\r
+ HELPCTX(no_help),\r
+ dlg_stdfontsel_handler, I(offsetof(Config,widefont)));\r
+ s = ctrl_getset(b, "Window/Fonts", "fontbold",\r
+ "Fonts for displaying bolded text");\r
+ ctrl_fontsel(s, "Font used for bolded text", 'b',\r
+ HELPCTX(no_help),\r
+ dlg_stdfontsel_handler, I(offsetof(Config,boldfont)));\r
+ ctrl_fontsel(s, "Font used for bold wide text", 'i',\r
+ HELPCTX(no_help),\r
+ dlg_stdfontsel_handler, I(offsetof(Config,wideboldfont)));\r
+ ctrl_checkbox(s, "Use shadow bold instead of bold fonts", 'u',\r
+ HELPCTX(no_help),\r
+ dlg_stdcheckbox_handler,\r
+ I(offsetof(Config,shadowbold)));\r
+ ctrl_text(s, "(Note that bold fonts or shadow bolding are only"\r
+ " used if you have not requested bolding to be done by"\r
+ " changing the text colour.)",\r
+ HELPCTX(no_help));\r
+ ctrl_editbox(s, "Horizontal offset for shadow bold:", 'z', 20,\r
+ HELPCTX(no_help), dlg_stdeditbox_handler,\r
+ I(offsetof(Config,shadowboldoffset)), I(-1));\r
+\r
+ /*\r
+ * Markus Kuhn feels, not totally unreasonably, that it's good\r
+ * for all applications to shift into UTF-8 mode if they notice\r
+ * that they've been started with a LANG setting dictating it,\r
+ * so that people don't have to keep remembering a separate\r
+ * UTF-8 option for every application they use. Therefore,\r
+ * here's an override option in the Translation panel.\r
+ */\r
+ s = ctrl_getset(b, "Window/Translation", "trans",\r
+ "Character set translation on received data");\r
+ ctrl_checkbox(s, "Override with UTF-8 if locale says so", 'l',\r
+ HELPCTX(translation_utf8_override),\r
+ dlg_stdcheckbox_handler,\r
+ I(offsetof(Config,utf8_override)));\r
+\r
+ if (!midsession) {\r
+ /*\r
+ * Allow the user to specify the window class as part of the saved\r
+ * configuration, so that they can have their window manager treat\r
+ * different kinds of PuTTY and pterm differently if they want to.\r
+ */\r
+ s = ctrl_getset(b, "Window/Behaviour", "x11",\r
+ "X Window System settings");\r
+ ctrl_editbox(s, "Window class name:", 'z', 50,\r
+ HELPCTX(no_help), dlg_stdeditbox_handler,\r
+ I(offsetof(Config,winclass)),\r
+ I(sizeof(((Config *)0)->winclass)));\r
+ }\r
+}\r