OSDN Git Service

Modify features and documents for 1.98b the urgent security release.
[ffftp/ffftp.git] / contrib / putty / WINDOWS / WINCFG.C
diff --git a/contrib/putty/WINDOWS/WINCFG.C b/contrib/putty/WINDOWS/WINCFG.C
deleted file mode 100644 (file)
index 60694fc..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-/*\r
- * wincfg.c - the Windows-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
-    HWND *hwndp = (HWND *)ctrl->generic.context.p;\r
-\r
-    if (event == EVENT_ACTION) {\r
-       modal_about_box(*hwndp);\r
-    }\r
-}\r
-\r
-static void help_handler(union control *ctrl, void *dlg,\r
-                        void *data, int event)\r
-{\r
-    HWND *hwndp = (HWND *)ctrl->generic.context.p;\r
-\r
-    if (event == EVENT_ACTION) {\r
-       show_help(*hwndp);\r
-    }\r
-}\r
-\r
-static void variable_pitch_handler(union control *ctrl, void *dlg,\r
-                                   void *data, int event)\r
-{\r
-    if (event == EVENT_REFRESH) {\r
-       dlg_checkbox_set(ctrl, dlg, !dlg_get_fixed_pitch_flag(dlg));\r
-    } else if (event == EVENT_VALCHANGE) {\r
-       dlg_set_fixed_pitch_flag(dlg, !dlg_checkbox_get(ctrl, dlg));\r
-    }\r
-}\r
-\r
-void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,\r
-                         int midsession, int protocol)\r
-{\r
-    struct controlset *s;\r
-    union control *c;\r
-    char *str;\r
-\r
-    if (!midsession) {\r
-       /*\r
-        * Add the About and Help buttons to the standard panel.\r
-        */\r
-       s = ctrl_getset(b, "", "", "");\r
-       c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),\r
-                           about_handler, P(hwndp));\r
-       c->generic.column = 0;\r
-       if (has_help) {\r
-           c = ctrl_pushbutton(s, "Help", 'h', HELPCTX(no_help),\r
-                               help_handler, P(hwndp));\r
-           c->generic.column = 1;\r
-       }\r
-    }\r
-\r
-    /*\r
-     * Full-screen mode is a Windows peculiarity; hence\r
-     * scrollbar_in_fullscreen is as well.\r
-     */\r
-    s = ctrl_getset(b, "Window", "scrollback",\r
-                   "Control the scrollback in the window");\r
-    ctrl_checkbox(s, "Display scrollbar in full screen mode", 'i',\r
-                 HELPCTX(window_scrollback),\r
-                 dlg_stdcheckbox_handler,\r
-                 I(offsetof(Config,scrollbar_in_fullscreen)));\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
-    {\r
-        int i;\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-in-FS 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
-    /*\r
-     * Windows has the AltGr key, which has various Windows-\r
-     * specific options.\r
-     */\r
-    s = ctrl_getset(b, "Terminal/Keyboard", "features",\r
-                   "Enable extra keyboard features:");\r
-    ctrl_checkbox(s, "AltGr acts as Compose key", 't',\r
-                 HELPCTX(keyboard_compose),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,compose_key)));\r
-    ctrl_checkbox(s, "Control-Alt is different from AltGr", 'd',\r
-                 HELPCTX(keyboard_ctrlalt),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,ctrlaltkeys)));\r
-\r
-    /*\r
-     * Windows allows an arbitrary .WAV to be played as a bell, and\r
-     * also the use of the PC speaker. For this we must search the\r
-     * existing controlset for the radio-button set controlling the\r
-     * `beep' option, and add extra buttons to it.\r
-     * \r
-     * Note that although this _looks_ like a hideous hack, it's\r
-     * actually all above board. The well-defined interface to the\r
-     * per-platform dialog box code is the _data structures_ `union\r
-     * control', `struct controlset' and so on; so code like this\r
-     * that reaches into those data structures and changes bits of\r
-     * them is perfectly legitimate and crosses no boundaries. All\r
-     * the ctrl_* routines that create most of the controls are\r
-     * convenient shortcuts provided on the cross-platform side of\r
-     * the interface, and template creation code is under no actual\r
-     * obligation to use them.\r
-     */\r
-    s = ctrl_getset(b, "Terminal/Bell", "style", "Set the style of bell");\r
-    {\r
-       int i;\r
-       for (i = 0; i < s->ncontrols; i++) {\r
-           c = s->ctrls[i];\r
-           if (c->generic.type == CTRL_RADIO &&\r
-               c->generic.context.i == offsetof(Config, beep)) {\r
-               assert(c->generic.handler == dlg_stdradiobutton_handler);\r
-               c->radio.nbuttons += 2;\r
-               c->radio.buttons =\r
-                   sresize(c->radio.buttons, c->radio.nbuttons, char *);\r
-               c->radio.buttons[c->radio.nbuttons-1] =\r
-                   dupstr("Play a custom sound file");\r
-               c->radio.buttons[c->radio.nbuttons-2] =\r
-                   dupstr("Beep using the PC speaker");\r
-               c->radio.buttondata =\r
-                   sresize(c->radio.buttondata, c->radio.nbuttons, intorptr);\r
-               c->radio.buttondata[c->radio.nbuttons-1] = I(BELL_WAVEFILE);\r
-               c->radio.buttondata[c->radio.nbuttons-2] = I(BELL_PCSPEAKER);\r
-               if (c->radio.shortcuts) {\r
-                   c->radio.shortcuts =\r
-                       sresize(c->radio.shortcuts, c->radio.nbuttons, char);\r
-                   c->radio.shortcuts[c->radio.nbuttons-1] = NO_SHORTCUT;\r
-                   c->radio.shortcuts[c->radio.nbuttons-2] = NO_SHORTCUT;\r
-               }\r
-               break;\r
-           }\r
-       }\r
-    }\r
-    ctrl_filesel(s, "Custom sound file to play as a bell:", NO_SHORTCUT,\r
-                FILTER_WAVE_FILES, FALSE, "Select bell sound file",\r
-                HELPCTX(bell_style),\r
-                dlg_stdfilesel_handler, I(offsetof(Config, bell_wavefile)));\r
-\r
-    /*\r
-     * While we've got this box open, taskbar flashing on a bell is\r
-     * also Windows-specific.\r
-     */\r
-    ctrl_radiobuttons(s, "Taskbar/caption indication on bell:", 'i', 3,\r
-                     HELPCTX(bell_taskbar),\r
-                     dlg_stdradiobutton_handler,\r
-                     I(offsetof(Config, beep_ind)),\r
-                     "Disabled", I(B_IND_DISABLED),\r
-                     "Flashing", I(B_IND_FLASH),\r
-                     "Steady", I(B_IND_STEADY), NULL);\r
-\r
-    /*\r
-     * The sunken-edge border is a Windows GUI feature.\r
-     */\r
-    s = ctrl_getset(b, "Window/Appearance", "border",\r
-                   "Adjust the window border");\r
-    ctrl_checkbox(s, "Sunken-edge border (slightly thicker)", 's',\r
-                 HELPCTX(appearance_border),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,sunken_edge)));\r
-\r
-    /*\r
-     * Configurable font quality settings for Windows.\r
-     */\r
-    s = ctrl_getset(b, "Window/Appearance", "font",\r
-                   "Font settings");\r
-    ctrl_checkbox(s, "Allow selection of variable-pitch fonts", NO_SHORTCUT,\r
-                  HELPCTX(appearance_font), variable_pitch_handler, I(0));\r
-    ctrl_radiobuttons(s, "Font quality:", 'q', 2,\r
-                     HELPCTX(appearance_font),\r
-                     dlg_stdradiobutton_handler,\r
-                     I(offsetof(Config, font_quality)),\r
-                     "Antialiased", I(FQ_ANTIALIASED),\r
-                     "Non-Antialiased", I(FQ_NONANTIALIASED),\r
-                     "ClearType", I(FQ_CLEARTYPE),\r
-                     "Default", I(FQ_DEFAULT), NULL);\r
-\r
-    /*\r
-     * Cyrillic Lock is a horrid misfeature even on Windows, and\r
-     * the least we can do is ensure it never makes it to any other\r
-     * platform (at least unless someone fixes it!).\r
-     */\r
-    s = ctrl_getset(b, "Window/Translation", "tweaks", NULL);\r
-    ctrl_checkbox(s, "Caps Lock acts as Cyrillic switch", 's',\r
-                 HELPCTX(translation_cyrillic),\r
-                 dlg_stdcheckbox_handler,\r
-                 I(offsetof(Config,xlat_capslockcyr)));\r
-\r
-    /*\r
-     * On Windows we can use but not enumerate translation tables\r
-     * from the operating system. Briefly document this.\r
-     */\r
-    s = ctrl_getset(b, "Window/Translation", "trans",\r
-                   "Character set translation on received data");\r
-    ctrl_text(s, "(Codepages supported by Windows but not listed here, "\r
-             "such as CP866 on many systems, can be entered manually)",\r
-             HELPCTX(translation_codepage));\r
-\r
-    /*\r
-     * Windows has the weird OEM font mode, which gives us some\r
-     * additional options when working with line-drawing\r
-     * characters.\r
-     */\r
-    str = dupprintf("Adjust how %s displays line drawing characters", appname);\r
-    s = ctrl_getset(b, "Window/Translation", "linedraw", str);\r
-    sfree(str);\r
-    {\r
-       int i;\r
-       for (i = 0; i < s->ncontrols; i++) {\r
-           c = s->ctrls[i];\r
-           if (c->generic.type == CTRL_RADIO &&\r
-               c->generic.context.i == offsetof(Config, vtmode)) {\r
-               assert(c->generic.handler == dlg_stdradiobutton_handler);\r
-               c->radio.nbuttons += 3;\r
-               c->radio.buttons =\r
-                   sresize(c->radio.buttons, c->radio.nbuttons, char *);\r
-               c->radio.buttons[c->radio.nbuttons-3] =\r
-                   dupstr("Font has XWindows encoding");\r
-               c->radio.buttons[c->radio.nbuttons-2] =\r
-                   dupstr("Use font in both ANSI and OEM modes");\r
-               c->radio.buttons[c->radio.nbuttons-1] =\r
-                   dupstr("Use font in OEM mode only");\r
-               c->radio.buttondata =\r
-                   sresize(c->radio.buttondata, c->radio.nbuttons, intorptr);\r
-               c->radio.buttondata[c->radio.nbuttons-3] = I(VT_XWINDOWS);\r
-               c->radio.buttondata[c->radio.nbuttons-2] = I(VT_OEMANSI);\r
-               c->radio.buttondata[c->radio.nbuttons-1] = I(VT_OEMONLY);\r
-               if (!c->radio.shortcuts) {\r
-                   int j;\r
-                   c->radio.shortcuts = snewn(c->radio.nbuttons, char);\r
-                   for (j = 0; j < c->radio.nbuttons; j++)\r
-                       c->radio.shortcuts[j] = NO_SHORTCUT;\r
-               } else {\r
-                   c->radio.shortcuts = sresize(c->radio.shortcuts,\r
-                                                c->radio.nbuttons, char);\r
-               }\r
-               c->radio.shortcuts[c->radio.nbuttons-3] = 'x';\r
-               c->radio.shortcuts[c->radio.nbuttons-2] = 'b';\r
-               c->radio.shortcuts[c->radio.nbuttons-1] = 'e';\r
-               break;\r
-           }\r
-       }\r
-    }\r
-\r
-    /*\r
-     * RTF paste is Windows-specific.\r
-     */\r
-    s = ctrl_getset(b, "Window/Selection", "format",\r
-                   "Formatting of pasted characters");\r
-    ctrl_checkbox(s, "Paste to clipboard in RTF as well as plain text", 'f',\r
-                 HELPCTX(selection_rtf),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,rtf_paste)));\r
-\r
-    /*\r
-     * Windows often has no middle button, so we supply a selection\r
-     * mode in which the more critical Paste action is available on\r
-     * the right button instead.\r
-     */\r
-    s = ctrl_getset(b, "Window/Selection", "mouse",\r
-                   "Control use of mouse");\r
-    ctrl_radiobuttons(s, "Action of mouse buttons:", 'm', 1,\r
-                     HELPCTX(selection_buttons),\r
-                     dlg_stdradiobutton_handler,\r
-                     I(offsetof(Config, mouse_is_xterm)),\r
-                     "Windows (Middle extends, Right brings up menu)", I(2),\r
-                     "Compromise (Middle extends, Right pastes)", I(0),\r
-                     "xterm (Right extends, Middle pastes)", I(1), NULL);\r
-    /*\r
-     * This really ought to go at the _top_ of its box, not the\r
-     * bottom, so we'll just do some shuffling now we've set it\r
-     * up...\r
-     */\r
-    c = s->ctrls[s->ncontrols-1];      /* this should be the new control */\r
-    memmove(s->ctrls+1, s->ctrls, (s->ncontrols-1)*sizeof(union control *));\r
-    s->ctrls[0] = c;\r
-\r
-    /*\r
-     * Logical palettes don't even make sense anywhere except Windows.\r
-     */\r
-    s = ctrl_getset(b, "Window/Colours", "general",\r
-                   "General options for colour usage");\r
-    ctrl_checkbox(s, "Attempt to use logical palettes", 'l',\r
-                 HELPCTX(colours_logpal),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,try_palette)));\r
-    ctrl_checkbox(s, "Use system colours", 's',\r
-                  HELPCTX(colours_system),\r
-                  dlg_stdcheckbox_handler, I(offsetof(Config,system_colour)));\r
-\r
-\r
-    /*\r
-     * Resize-by-changing-font is a Windows insanity.\r
-     */\r
-    s = ctrl_getset(b, "Window", "size", "Set the size of the window");\r
-    ctrl_radiobuttons(s, "When window is resized:", 'z', 1,\r
-                     HELPCTX(window_resize),\r
-                     dlg_stdradiobutton_handler,\r
-                     I(offsetof(Config, resize_action)),\r
-                     "Change the number of rows and columns", I(RESIZE_TERM),\r
-                     "Change the size of the font", I(RESIZE_FONT),\r
-                     "Change font size only when maximised", I(RESIZE_EITHER),\r
-                     "Forbid resizing completely", I(RESIZE_DISABLED), NULL);\r
-\r
-    /*\r
-     * Most of the Window/Behaviour stuff is there to mimic Windows\r
-     * conventions which PuTTY can optionally disregard. Hence,\r
-     * most of these options are Windows-specific.\r
-     */\r
-    s = ctrl_getset(b, "Window/Behaviour", "main", NULL);\r
-    ctrl_checkbox(s, "Window closes on ALT-F4", '4',\r
-                 HELPCTX(behaviour_altf4),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,alt_f4)));\r
-    ctrl_checkbox(s, "System menu appears on ALT-Space", 'y',\r
-                 HELPCTX(behaviour_altspace),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,alt_space)));\r
-    ctrl_checkbox(s, "System menu appears on ALT alone", 'l',\r
-                 HELPCTX(behaviour_altonly),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,alt_only)));\r
-    ctrl_checkbox(s, "Ensure window is always on top", 'e',\r
-                 HELPCTX(behaviour_alwaysontop),\r
-                 dlg_stdcheckbox_handler, I(offsetof(Config,alwaysontop)));\r
-    ctrl_checkbox(s, "Full screen on Alt-Enter", 'f',\r
-                 HELPCTX(behaviour_altenter),\r
-                 dlg_stdcheckbox_handler,\r
-                 I(offsetof(Config,fullscreenonaltenter)));\r
-\r
-    /*\r
-     * Windows supports a local-command proxy. This also means we\r
-     * must adjust the text on the `Telnet command' control.\r
-     */\r
-    if (!midsession) {\r
-       int i;\r
-        s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);\r
-       for (i = 0; i < s->ncontrols; i++) {\r
-           c = s->ctrls[i];\r
-           if (c->generic.type == CTRL_RADIO &&\r
-               c->generic.context.i == offsetof(Config, proxy_type)) {\r
-               assert(c->generic.handler == dlg_stdradiobutton_handler);\r
-               c->radio.nbuttons++;\r
-               c->radio.buttons =\r
-                   sresize(c->radio.buttons, c->radio.nbuttons, char *);\r
-               c->radio.buttons[c->radio.nbuttons-1] =\r
-                   dupstr("Local");\r
-               c->radio.buttondata =\r
-                   sresize(c->radio.buttondata, c->radio.nbuttons, intorptr);\r
-               c->radio.buttondata[c->radio.nbuttons-1] = I(PROXY_CMD);\r
-               break;\r
-           }\r
-       }\r
-\r
-       for (i = 0; i < s->ncontrols; i++) {\r
-           c = s->ctrls[i];\r
-           if (c->generic.type == CTRL_EDITBOX &&\r
-               c->generic.context.i ==\r
-               offsetof(Config, proxy_telnet_command)) {\r
-               assert(c->generic.handler == dlg_stdeditbox_handler);\r
-               sfree(c->generic.label);\r
-               c->generic.label = dupstr("Telnet command, or local"\r
-                                         " proxy command");\r
-               break;\r
-           }\r
-       }\r
-    }\r
-\r
-    /*\r
-     * Serial back end is available on Windows.\r
-     */\r
-    if (!midsession || (protocol == PROT_SERIAL))\r
-        ser_setup_config_box(b, midsession, 0x1F, 0x0F);\r
-\r
-    /*\r
-     * $XAUTHORITY is not reliable on Windows, so we provide a\r
-     * means to override it.\r
-     */\r
-    if (!midsession && backend_from_proto(PROT_SSH)) {\r
-       s = ctrl_getset(b, "Connection/SSH/X11", "x11", "X11 forwarding");\r
-       ctrl_filesel(s, "X authority file for local display", 't',\r
-                    NULL, FALSE, "Select X authority file",\r
-                    HELPCTX(ssh_tunnels_xauthority),\r
-                    dlg_stdfilesel_handler, I(offsetof(Config, xauthfile)));\r
-    }\r
-}\r