From 70133c0ebf73ea69b2b27a303efdb29cb47d5f6d Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 6 Dec 2001 13:28:02 +0000 Subject: [PATCH] Integrate PuTTY and its help file. Now that's what I call a good lunchtime's work :-) git-svn-id: svn://svn.tartarus.org/sgt/putty@1458 cda61777-01e9-0310-a592-d414129be87e --- doc/config.but | 150 ++++++++++++++++++++++- putty.h | 3 + win_res.h | 4 +- win_res.rc | 1 + windlg.c | 370 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- window.c | 41 ++++++- 6 files changed, 559 insertions(+), 10 deletions(-) diff --git a/doc/config.but b/doc/config.but index 86035893..a4ed288c 100644 --- a/doc/config.but +++ b/doc/config.but @@ -1,4 +1,4 @@ -\versionid $Id: config.but,v 1.16 2001/11/29 22:32:37 simon Exp $ +\versionid $Id: config.but,v 1.17 2001/12/06 13:28:02 simon Exp $ \C{config} Configuring PuTTY @@ -16,6 +16,8 @@ save your settings to be reloaded later. \S{config-hostname} The host name section +\cfg{winhelp-topic}{session.hostname} + The top box on the Session panel, labelled \q{Specify your connection by host name}, contains the details that need to be filled in before PuTTY can open a session at all. @@ -36,6 +38,8 @@ will almost certainly need to fill in the \q{Port} box. \S{config-saving} Loading and storing saved sessions +\cfg{winhelp-topic}{session.saved} + The next part of the Session configuration panel allows you to save your preferred PuTTY options so they will appear automatically the next time you start PuTTY. It also allows you to create \e{saved @@ -86,6 +90,8 @@ Settings, you must also update every saved session separately. \S{config-closeonexit} \q{Close Window on Exit} +\cfg{winhelp-topic}{session.coe} + Finally in the Session panel, there is an option labelled \q{Close Window on Exit}. This controls whether the PuTTY session window disappears as soon as the session inside it terminates. If you are @@ -102,6 +108,8 @@ the server will leave the window up. \H{config-logging} The Logging panel +\cfg{winhelp-topic}{logging.main} + The Logging configuration panel allows you to save log files of your PuTTY sessions, for debugging, analysis or future reference. @@ -129,6 +137,8 @@ what went wrong. \S{config-logfilename} \q{Log file name} +\cfg{winhelp-topic}{logging.filename} + In this edit box you enter the name of the file you want to log the session to. The \q{Browse} button will let you look around your file system to find the right place to put the file; or if you already @@ -161,6 +171,8 @@ like \S{config-logfileexists} \q{What to do if the log file already exists} +\cfg{winhelp-topic}{logging.exists} + This control allows you to specify what PuTTY should do if it tries to start writing to a log file and it finds the file already exists. You might want to automatically destroy the existing log file and @@ -177,6 +189,8 @@ of PuTTY's terminal emulation. \S{config-autowrap} \q{Auto wrap mode initially on} +\cfg{winhelp-topic}{terminal.autowrap} + Auto wrap mode controls what happens when text printed in a PuTTY window reaches the right-hand edge of the window. @@ -198,6 +212,8 @@ the change takes effect. \S{config-decom} \q{DEC Origin Mode initially on} +\cfg{winhelp-topic}{terminal.decom} + DEC Origin Mode is a minor option which controls how PuTTY interprets cursor-position control sequences sent by the server. @@ -225,6 +241,8 @@ the change takes effect. \S{config-crlf} \q{Implicit CR in every LF} +\cfg{winhelp-topic}{terminal.lfhascr} + Most servers send two control characters, CR and LF, to start a new line of the screen. The CR character makes the cursor return to the left-hand side of the screen. The LF character makes the cursor move @@ -248,6 +266,8 @@ option, and things might go back to normal: \S{config-erase} \q{Use background colour to erase screen} +\cfg{winhelp-topic}{terminal.bce} + Not all terminals agree on what colour to turn the screen when the server sends a \q{clear screen} sequence. Some terminals believe the screen should always be cleared to the \e{default} background @@ -263,18 +283,24 @@ the \e{current} background colour. \S{config-blink} \q{Enable blinking text} +\cfg{winhelp-topic}{terminal.blink} + The server can ask PuTTY to display text that blinks on and off. This is very distracting, so PuTTY allows you to turn blinking text off completely. \S{config-answerback} \q{Answerback to ^E} +\cfg{winhelp-topic}{terminal.answerback} + This option controls what PuTTY will send back to the server if the server sends it the ^E enquiry character. Normally it just sends the string \q{PuTTY}. \S{config-localecho} \q{Local echo} +\cfg{winhelp-topic}{terminal.localecho} + With local echo disabled, characters you type into the PuTTY window are not echoed in the window \e{by PuTTY}. They are simply sent to the server. (The \e{server} might choose to echo them back to you; @@ -290,6 +316,8 @@ relying on the automatic detection. \S{config-localedit} \q{Local line editing} +\cfg{winhelp-topic}{terminal.localedit} + Normally, every character you type into the PuTTY window is sent immediately to the server the moment you type it. @@ -321,6 +349,8 @@ of the keyboard in PuTTY. \S{config-backspace} Changing the action of the Backspace key +\cfg{winhelp-topic}{keyboard.backspace} + Some terminals believe that the Backspace key should send the same thing to the server as Control-H (ASCII code 8). Other terminals believe that the Backspace key should send ASCII code 127 (usually @@ -341,6 +371,8 @@ help. \S{config-homeend} Changing the action of the Home and End keys +\cfg{winhelp-topic}{keyboard.homeend} + The Unix terminal emulator \c{rxvt} disagrees with the rest of the world about what character sequences should be sent to the server by the Home and End keys. @@ -354,6 +386,8 @@ working, you could try switching this option to see if it helps. \S{config-funkeys} Changing the action of the function keys and keypad +\cfg{winhelp-topic}{keyboard.funkeys} + This option affects the function keys (F1 to F12) and the top row of the numeric keypad. @@ -388,6 +422,8 @@ fiddle with it. \S{config-appcursor} Controlling Application Cursor Keys mode +\cfg{winhelp-topic}{keyboard.appcursor} + Application Cursor Keys mode is a way for the server to change the control sequences sent by the arrow keys. In normal mode, the arrow keys send \c{ESC [A} through to \c{ESC [D}. In application mode, @@ -400,6 +436,8 @@ completely. \S{config-appkeypad} Controlling Application Keypad mode +\cfg{winhelp-topic}{keyboard.appkeypad} + Application Keypad mode is a way for the server to change the behaviour of the numeric keypad. @@ -423,6 +461,8 @@ completely. \S{config-nethack} Using NetHack keypad mode +\cfg{winhelp-topic}{keyboard.nethack} + PuTTY has a special mode for playing NetHack. You can enable it by selecting \q{NetHack} in the \q{Initial state of numeric keypad} control. @@ -441,6 +481,8 @@ on. We don't know why. \S{config-compose} Enabling a DEC-like Compose key +\cfg{winhelp-topic}{keyboard.compose} + DEC terminals have a Compose key, which provides an easy-to-remember way of typing accented characters. You press Compose and then type two more characters. The two characters are \q{combined} to produce @@ -454,6 +496,8 @@ this behaviour. \S{config-ctrlalt} \q{Control-Alt is different from AltGr} +\cfg{winhelp-topic}{keyboard.ctrlalt} + Some old keyboards do not have an AltGr key, which can make it difficult to type some characters. PuTTY can be configured to treat the key combination Ctrl + Left Alt the same way as the AltGr key. @@ -482,6 +526,8 @@ actions. \S{config-bellstyle} \q{Set the style of bell} +\cfg{winhelp-topic}{bell.style} + This control allows you to select various different actions to occur on a terminal bell: @@ -507,6 +553,8 @@ will flash white for a fraction of a second. \S{config-belltaskbar} \q{Taskbar/caption indication on bell} +\cfg{winhelp-topic}{bell.taskbar} + This feature controls what happens to the PuTTY window's entry in the Windows Taskbar if a bell occurs while the window does not have the input focus. @@ -526,6 +574,8 @@ continuously flash on and off until you select the window. \S{config-bellovl} \q{Control the bell overload behaviour} +\cfg{winhelp-topic}{bell.overload} + A common user error in a terminal session is to accidentally run the Unix command \c{cat} (or equivalent) on an inappropriate file type, such as an executable, image file, or ZIP file. This produces a huge @@ -560,12 +610,16 @@ PuTTY window. \S{config-winsize} Setting the size of the PuTTY window +\cfg{winhelp-topic}{window.size} + The \q{Rows} and \q{Columns} boxes let you set the PuTTY window to a precise size. Of course you can also drag the window to a new size while a session is running. \S{config-winsizelock} What to do when the window is resized +\cfg{winhelp-topic}{window.resize} + These options allow you to control what happens when the user tries to resize the PuTTY window. @@ -592,6 +646,8 @@ terminal size will change when you resize the window. \S{config-scrollback} Controlling scrollback +\cfg{winhelp-topic}{window.scrollback} + These options let you configure the way PuTTY keeps text after it scrolls off the top of the screen (see \k{using-scrollback}). @@ -615,6 +671,8 @@ the appearance of PuTTY's window. \S{config-cursor} Controlling the appearance of the cursor +\cfg{winhelp-topic}{appearance.cursor} + The \q{Cursor appearance} option lets you configure the cursor to be a block, an underline, or a vertical line. A block cursor becomes an empty box when the window loses focus; an underline or a vertical @@ -625,6 +683,8 @@ works in any of the cursor modes. \S{config-font} Controlling the font used in the terminal window +\cfg{winhelp-topic}{appearance.font} + This option allows you to choose what font, in what size, the PuTTY terminal window uses to display the text in the session. You will be offered a choice from all the fixed-width fonts installed on the @@ -633,6 +693,8 @@ width fonts.) \S{config-title} Controlling the window title +\cfg{winhelp-topic}{appearance.title} + The \q{Window title} edit box allows you to set the title of the PuTTY window. By default the window title will contain the host name followed by \q{PuTTY}, for example \c{server1.example.com - PuTTY}. @@ -655,6 +717,8 @@ titles the server sends it. \S{config-mouseptr} \q{Hide mouse pointer when typing in window} +\cfg{winhelp-topic}{appearance.hidemouse} + If you enable this option, the mouse pointer will disappear if the PuTTY window is selected and you press a key. This way, it will not obscure any of the text in the window while you work in your @@ -665,6 +729,8 @@ visible at all times. \S{config-winborder} Controlling the window border +\cfg{winhelp-topic}{appearance.border} + PuTTY allows you to configure the appearance of the window border to some extent. @@ -686,6 +752,8 @@ the behaviour of PuTTY's window. \S{config-warnonclose} \q{Warn before closing window} +\cfg{winhelp-topic}{behaviour.closewarn} + If you press the Close button in a PuTTY window that contains a running session, PuTTY will put up a warning window asking if you really meant to close the window. A window whose session has already @@ -696,6 +764,8 @@ the \q{Warn before closing window} option. \S{config-altf4} \q{Window closes on ALT-F4} +\cfg{winhelp-topic}{behaviour.altf4} + By default, pressing ALT-F4 causes the window to close (or a warning box to appear; see \k{config-warnonclose}). If you disable the \q{Window closes on ALT-F4} option, then pressing ALT-F4 will simply @@ -703,6 +773,8 @@ send a key sequence to the server. \S{config-altspace} \q{System menu appears on ALT-Space} +\cfg{winhelp-topic}{behaviour.altspace} + If this option is enabled, then pressing ALT-Space will bring up the PuTTY window's menu, like clicking on the top left corner. If it is disabled, then pressing ALT-Space will just send \c{ESC SPACE} to @@ -716,6 +788,8 @@ the window. \S{config-altonly} \q{System menu appears on Alt alone} +\cfg{winhelp-topic}{behaviour.altonly} + If this option is enabled, then pressing and releasing ALT will bring up the PuTTY window's menu, like clicking on the top left corner. If it is disabled, then pressing and releasing ALT will have @@ -723,11 +797,15 @@ no effect. \S{config-alwaysontop} \q{Ensure window is always on top} +\cfg{winhelp-topic}{behaviour.alwaysontop} + If this option is enabled, the PuTTY window will stay on top of all other windows. \S{config-fullscreen} \q{Full screen on Alt-Enter} +\cfg{winhelp-topic}{behaviour.altenter} + If this option is enabled, then pressing Alt-Enter will cause the PuTTY window to become full-screen. (See \k{using-fullscreen}). Pressing Alt-Enter again will restore the previous window size. @@ -740,6 +818,8 @@ the character set understood by PuTTY. \S{config-charset} Controlling character set translation +\cfg{winhelp-topic}{translation.codepage} + During an interactive session, PuTTY receives a stream of 8-bit bytes from the server, and in order to display them on the screen it needs to know what character set to interpret them in. @@ -771,6 +851,8 @@ Not all server-side applications will support it. \S{config-cyr} \q{Caps Lock acts as Cyrillic switch} +\cfg{winhelp-topic}{translation.cyrillic} + This feature allows you to switch between a US/UK keyboard layout and a Cyrillic keyboard layout by using the Caps Lock key, if you need to type (for example) Russian and English side by side in the @@ -781,6 +863,8 @@ native keyboard layout is not US or UK. \S{config-linedraw} Controlling display of line drawing characters +\cfg{winhelp-topic}{translation.linedraw} + VT100-series terminals allow the server to send control sequences that shift temporarily into a separate character set for drawing lines and boxes. PuTTY has a variety of ways to support this @@ -819,6 +903,8 @@ work in the PuTTY window. \S{config-linedrawpaste} Controlling the pasting of line drawing characters +\cfg{winhelp-topic}{selection.linedraw} + By default, when you copy and paste a piece of the PuTTY screen that contains VT100 line and box drawing characters, PuTTY will translate them into the \q{poor man's} line-drawing characters \c{+}, \c{-} @@ -832,6 +918,8 @@ example. \S{config-rtfpaste} Pasting in Rich Text Format +\cfg{winhelp-topic}{selection.rtf} + If you enable \q{Paste to clipboard in RTF as well as plain text}, PuTTY will write formatting information to the clipboard as well as the actual text you copy. Currently the only effect of this will be @@ -845,6 +933,8 @@ disabled. \S{config-mouse} Changing the actions of the mouse buttons +\cfg{winhelp-topic}{selection.buttons} + PuTTY's copy and paste mechanism is modelled on the Unix \c{xterm} application. The X Window System uses a three-button mouse, and the convention is that the left button selects, the right button extends @@ -860,6 +950,8 @@ mouse buttons} control. \S{config-mouseshift} \q{Shift overrides application's use of mouse} +\cfg{winhelp-topic}{selection.shiftdrag} + PuTTY allows the server to send control codes that let it take over the mouse and use it for purposes other than copy and paste. Applications which use this feature include the text-mode web @@ -880,6 +972,8 @@ checkbox will cause Shift + mouse clicks to go to the server as well \S{config-rectselect} Default selection mode +\cfg{winhelp-topic}{selection.rect} + As described in \k{using-selection}, PuTTY has two modes of selecting text to be copied to the clipboard. In the default mode (\q{Normal}), dragging the mouse from point A to point B selects to @@ -895,6 +989,8 @@ you have to hold down Alt to get the \e{normal} behaviour. \S{config-charclasses} Configuring word-by-word selection +\cfg{winhelp-topic}{selection.charclasses} + PuTTY will select a word at a time in the terminal window if you double-click to begin the drag. This panel allows you to control precisely what is considered to be a word. @@ -932,6 +1028,8 @@ The Colours panel allows you to control PuTTY's use of colour. \S{config-boldcolour} \q{Bolded text is a different colour} +\cfg{winhelp-topic}{colours.bold} + When the server sends a control sequence indicating that some text should be displayed in bold, PuTTY can handle this two ways. It can either change the font for a bold version, or use the same font in a @@ -945,6 +1043,8 @@ change to indicate the difference. \S{config-logpalette} \q{Attempt to use logical palettes} +\cfg{winhelp-topic}{colours.logpal} + Logical palettes are a mechanism by which a Windows application running on an 8-bit colour display can select precisely the colours it wants instead of going with the Windows standard defaults. @@ -955,6 +1055,8 @@ worked very well. \S{config-colourcfg} Adjusting the colours in the terminal window +\cfg{winhelp-topic}{colours.config} + The main colour control allows you to specify exactly what colours things should be displayed in. To modify one of the PuTTY colours, use the list box to select which colour you want to modify. The RGB @@ -977,6 +1079,8 @@ more than one type of connection. \S{config-termtype} \q{Terminal-type string} +\cfg{winhelp-topic}{connection.termtype} + Most servers you might connect to with PuTTY are designed to be connected to from lots of different types of terminal. In order to send the right control sequences to each one, the server will need @@ -996,6 +1100,8 @@ application or your server. \S{config-username} \q{Auto-login username} +\cfg{winhelp-topic}{connection.username} + All three of the SSH, Telnet and Rlogin protocols allow you to specify what user name you want to log in as, without having to type it explicitly every time. (Some Telnet servers don't support this.) @@ -1004,6 +1110,8 @@ In this box you can type that user name. \S{config-keepalive} Using keepalives to prevent disconnection +\cfg{winhelp-topic}{connection.keepalive} + If you find your sessions are closing unexpectedly (\q{Connection reset by peer}) after they have been idle for a while, you might want to try using this option. @@ -1048,6 +1156,8 @@ protocols offer no way of implementing them. \S{config-nodelay} \q{Disable Nagle's algorithm} +\cfg{winhelp-topic}{connection.nodelay} + Nagle's algorithm is a detail of TCP/IP implementations that tries to minimise the number of small data packets sent down a network connection. With Nagle's algorithm enabled, PuTTY's bandwidth usage @@ -1064,6 +1174,8 @@ Telnet sessions. \S{config-termspeed} \q{Terminal-speed string} +\cfg{winhelp-topic}{telnet.termspeed} + Telnet allows the client to send a text string that describes the terminal speed. PuTTY lets you configure this, in case you find the server is reacting badly to the default value. (I'm not aware of any @@ -1071,6 +1183,8 @@ servers that do have a problem with it.) \S{config-environ} Setting environment variables on the server +\cfg{winhelp-topic}{telnet.environ} + The Telnet protocol also provides a means for the client to pass environment variables to the server. Many Telnet servers have stopped supporting this feature due to security flaws, but PuTTY @@ -1086,6 +1200,8 @@ To remove one from the list, select it in the list box and press \S{config-oldenviron} \q{Handling of OLD_ENVIRON ambiguity} +\cfg{winhelp-topic}{telnet.oldenviron} + The original Telnet mechanism for passing environment variables was badly specified. At the time the standard (RFC 1408) was written, BSD telnet implementations were already supporting the feature, and @@ -1108,6 +1224,8 @@ passing environment variables to quite an old server. \S{config-ptelnet} Passive and active Telnet negotiation modes +\cfg{winhelp-topic}{telnet.passive} + In a Telnet connection, there are two types of data passed between the client and the server: actual text, and \e{negotiations} about which Telnet extra features to use. @@ -1131,6 +1249,8 @@ passive mode to see if it helps. \S{config-telnetkey} \q{Keyboard sends telnet Backspace and Interrupt} +\cfg{winhelp-topic}{telnet.specialkeys} + If this box is checked, the Backspace key on the keyboard will send the Telnet special backspace code, and Control-C will send the Telnet special interrupt code. You probably shouldn't enable this @@ -1143,6 +1263,8 @@ Rlogin sessions. \S{config-rlogin-termspeed} \q{Terminal-speed string} +\cfg{winhelp-topic}{rlogin.termspeed} + Like Telnet, Rlogin allows the client to send a text string that describes the terminal speed. PuTTY lets you configure this, in case you find the server is reacting badly to the default value. (I'm not @@ -1150,6 +1272,8 @@ aware of any servers that do have a problem with it.) \S{config-rlogin-localuser} \q{Local username} +\cfg{winhelp-topic}{rlogin.localuser} + Rlogin allows an automated (password-free) form of login by means of a file called \c{.rhosts} on the server. You put a line in your \c{.rhosts} file saying something like \c{jbloggs@pc1.example.com}, @@ -1186,6 +1310,8 @@ SSH sessions. \S{config-command} Executing a specific command on the server +\cfg{winhelp-topic}{ssh.command} + In SSH, you don't have to run a general shell session on the server. Instead, you can choose to run a single specific command (such as a mail user agent, for example). If you want to do this, enter the @@ -1193,6 +1319,8 @@ command in the \q{Remote command} box. \S{config-ssh-pty} \q{Don't allocate a pseudo-terminal} +\cfg{winhelp-topic}{ssh.nopty} + When connecting to a Unix system, most interactive shell sessions are run in a \e{pseudo-terminal}, which allows the Unix system to pretend it's talking to a real physical terminal device but allows @@ -1206,6 +1334,8 @@ the usual way of working. \S{config-ssh-comp} \q{Enable compression} +\cfg{winhelp-topic}{ssh.compress} + This enables data compression in the SSH connection: data sent by the server is compressed before sending, and decompressed at the client end. Likewise, data sent by PuTTY to the server is compressed @@ -1214,6 +1344,8 @@ make the most of a low-bandwidth connection. \S{config-ssh-prot} \q{Preferred SSH protocol version} +\cfg{winhelp-topic}{ssh.protocol} + This allows you to select whether you would like to use SSH protocol version 1 or version 2. \#{FIXME: say something about this elsewhere?} @@ -1222,6 +1354,8 @@ does not offer protocol 2, and vice versa. \S{config-ssh-macbug} \q{Imitate SSH 2 MAC bug} +\cfg{winhelp-topic}{ssh.buggymac} + This option \e{should} now be unnecessary. It existed in order to work around a bug in early versions (2.3.0 and below) of the SSH server software from \cw{ssh.com}. The symptom of this problem would @@ -1234,6 +1368,8 @@ to use this option any more. \S{config-ssh-encryption} Encryption algorithm selection +\cfg{winhelp-topic}{ssh.ciphers} + PuTTY supports a variety of different encryption algorithms, and allows you to choose which one you prefer to use. You can do this by dragging the algorithms up and down in the list box (or moving them @@ -1271,6 +1407,8 @@ SSH sessions. \S{config-ssh-tis} \q{Attempt TIS or CryptoCard authentication} +\cfg{winhelp-topic}{ssh.auth.tis} + TIS and CryptoCard authentication are simple challenge/response forms of authentication available in SSH protocol version 1 only. You might use them if you were using S/Key one-time passwords, for @@ -1287,6 +1425,8 @@ responses take. \S{config-ssh-tis} \q{Attempt keyboard-interactive authentication} +\cfg{winhelp-topic}{ssh.auth.ki} + The SSH 2 equivalent of TIS authentication is called \q{keyboard-interactive}. It is a flexible authentication method using an arbitrary sequence of requests and responses; so it is not @@ -1299,6 +1439,8 @@ to turn it off in case you should have trouble with it. \S{config-ssh-agentfwd} \q{Allow agent forwarding} +\cfg{winhelp-topic}{ssh.auth.agentfwd} + This option allows the SSH server to open forwarded connections back to your local copy of Pageant. If you are not running Pageant, this option will do nothing. @@ -1310,6 +1452,8 @@ there is a security risk involved with enabling this option; see \S{config-ssh-privkey} \q{Private key file for authentication} +\cfg{winhelp-topic}{ssh.auth.privkey} + This box is where you enter the name of your private key file if you are using public key authentication. See \k{pubkey} for information about public key authentication in SSH. @@ -1321,6 +1465,8 @@ connection types through an SSH connection. \S{config-ssh-x11} X11 forwarding +\cfg{winhelp-topic}{ssh.tunnels.x11} + If your server lets you run X Window System applications, X11 forwarding allows you to securely give those applications access to a local X display on your PC. @@ -1338,6 +1484,8 @@ display location} box. \S{config-ssh-portfwd} Port forwarding +\cfg{winhelp-topic}{ssh.tunnels.portfwd} + Port forwarding allows you to tunnel other types of network connection down an SSH connection. diff --git a/putty.h b/putty.h index 25ea69e2..e8cf368d 100644 --- a/putty.h +++ b/putty.h @@ -109,6 +109,9 @@ GLOBAL int session_closed; GLOBAL int big_cursor; +GLOBAL char *help_path; +GLOBAL int help_has_contents; + GLOBAL int utf; GLOBAL int dbcs_screenfont; GLOBAL int font_codepage; diff --git a/win_res.h b/win_res.h index 0b6148fc..d5f6b809 100644 --- a/win_res.h +++ b/win_res.h @@ -24,7 +24,7 @@ #define IDC_TABSTATIC1 1002 #define IDC_TABSTATIC2 1003 #define IDC_TABLIST 1004 -#define IDC_ABOUT 1005 -#define IDC_SUBDLG 1006 +#define IDC_HELPBTN 1005 +#define IDC_ABOUT 1006 #endif diff --git a/win_res.rc b/win_res.rc index 05a7eb28..07dd93b4 100644 --- a/win_res.rc +++ b/win_res.rc @@ -42,6 +42,7 @@ BEGIN DEFPUSHBUTTON "&Open", IDOK, 184, 235, 44, 14 PUSHBUTTON "&Cancel", IDCANCEL, 231, 235, 44, 14 PUSHBUTTON "&About", IDC_ABOUT, 3, 235, 44, 14, NOT WS_TABSTOP + PUSHBUTTON "&Help", IDC_HELPBTN, 50, 235, 44, 14, NOT WS_TABSTOP END /* Accelerators used: ac */ diff --git a/windlg.c b/windlg.c index cb7500cf..c0da9c28 100644 --- a/windlg.c +++ b/windlg.c @@ -17,6 +17,7 @@ static int nevents = 0, negsize = 0; static int readytogo; static int sesslist_has_focus; +static int requested_help; static struct prefslist cipherlist; @@ -295,7 +296,6 @@ enum { IDCX_ABOUT = IDC_CURAPPLIC, IDC_COMPOSEKEY, IDC_CTRLALTKEYS, - IDC_TELNETKEY, keyboardpanelend, terminalpanelstart, @@ -435,6 +435,7 @@ enum { IDCX_ABOUT = IDC_ACTSTATIC, IDC_TPASSIVE, IDC_TACTIVE, + IDC_TELNETKEY, telnetpanelend, rloginpanelstart, @@ -590,6 +591,325 @@ static void fmtfont(char *buf) (cfg.fontheight < 0 ? -cfg.fontheight : cfg.fontheight)); } +char *help_context_cmd(int id) +{ + switch (id) { + case IDC_HOSTSTATIC: + case IDC_HOST: + case IDC_PORTSTATIC: + case IDC_PORT: + case IDC_PROTSTATIC: + case IDC_PROTRAW: + case IDC_PROTTELNET: + case IDC_PROTRLOGIN: + case IDC_PROTSSH: + return "JI(`',`session.hostname')"; + case IDC_SESSSTATIC: + case IDC_SESSEDIT: + case IDC_SESSLIST: + case IDC_SESSLOAD: + case IDC_SESSSAVE: + case IDC_SESSDEL: + return "JI(`',`session.saved')"; + case IDC_CLOSEEXIT: + case IDC_COEALWAYS: + case IDC_COENEVER: + case IDC_COENORMAL: + return "JI(`',`session.coe')"; + case IDC_LSTATSTATIC: + case IDC_LSTATOFF: + case IDC_LSTATASCII: + case IDC_LSTATRAW: + return "JI(`',`logging.main')"; + case IDC_LGFSTATIC: + case IDC_LGFEDIT: + case IDC_LGFBUTTON: + case IDC_LGFEXPLAIN: + return "JI(`',`logging.filename')"; + case IDC_LSTATXIST: + case IDC_LSTATXOVR: + case IDC_LSTATXAPN: + case IDC_LSTATXASK: + return "JI(`',`logging.exists')"; + + case IDC_DELSTATIC: + case IDC_DEL008: + case IDC_DEL127: + return "JI(`',`keyboard.backspace')"; + case IDC_HOMESTATIC: + case IDC_HOMETILDE: + case IDC_HOMERXVT: + return "JI(`',`keyboard.homeend')"; + case IDC_FUNCSTATIC: + case IDC_FUNCTILDE: + case IDC_FUNCLINUX: + case IDC_FUNCXTERM: + case IDC_FUNCVT400: + case IDC_FUNCVT100P: + case IDC_FUNCSCO: + return "JI(`',`keyboard.funkeys')"; + case IDC_KPSTATIC: + case IDC_KPNORMAL: + case IDC_KPAPPLIC: + case IDC_NOAPPLICK: + return "JI(`',`keyboard.appkeypad')"; + case IDC_NOAPPLICC: + case IDC_CURSTATIC: + case IDC_CURNORMAL: + case IDC_CURAPPLIC: + return "JI(`',`keyboard.appcursor')"; + case IDC_KPNH: + return "JI(`',`keyboard.nethack')"; + case IDC_COMPOSEKEY: + return "JI(`',`keyboard.compose')"; + case IDC_CTRLALTKEYS: + return "JI(`',`keyboard.ctrlalt')"; + + case IDC_WRAPMODE: + return "JI(`',`terminal.autowrap')"; + case IDC_DECOM: + return "JI(`',`terminal.decom')"; + case IDC_LFHASCR: + return "JI(`',`terminal.lfhascr')"; + case IDC_BCE: + return "JI(`',`terminal.bce')"; + case IDC_BLINKTEXT: + return "JI(`',`terminal.blink')"; + case IDC_ANSWERBACK: + case IDC_ANSWEREDIT: + return "JI(`',`terminal.answerback')"; + case IDC_ECHOSTATIC: + case IDC_ECHOBACKEND: + case IDC_ECHOYES: + case IDC_ECHONO: + return "JI(`',`terminal.localecho')"; + case IDC_EDITSTATIC: + case IDC_EDITBACKEND: + case IDC_EDITYES: + case IDC_EDITNO: + return "JI(`',`terminal.localedit')"; + + case IDC_BELLSTATIC: + case IDC_BELL_DISABLED: + case IDC_BELL_DEFAULT: + case IDC_BELL_WAVEFILE: + case IDC_BELL_VISUAL: + case IDC_BELL_WAVESTATIC: + case IDC_BELL_WAVEEDIT: + case IDC_BELL_WAVEBROWSE: + return "JI(`',`bell.style')"; + case IDC_B_IND_STATIC: + case IDC_B_IND_DISABLED: + case IDC_B_IND_FLASH: + case IDC_B_IND_STEADY: + return "JI(`',`bell.taskbar')"; + case IDC_BELLOVL: + case IDC_BELLOVLNSTATIC: + case IDC_BELLOVLN: + case IDC_BELLOVLTSTATIC: + case IDC_BELLOVLT: + case IDC_BELLOVLEXPLAIN: + case IDC_BELLOVLSSTATIC: + case IDC_BELLOVLS: + return "JI(`',`bell.overload')"; + + case IDC_ROWSSTATIC: + case IDC_ROWSEDIT: + case IDC_COLSSTATIC: + case IDC_COLSEDIT: + return "JI(`',`window.size')"; + case IDC_RESIZESTATIC: + case IDC_RESIZETERM: + case IDC_RESIZEFONT: + case IDC_RESIZENONE: + case IDC_RESIZEEITHER: + return "JI(`',`window.resize')"; + case IDC_SCROLLBAR: + case IDC_SCROLLBARFULLSCREEN: + case IDC_SAVESTATIC: + case IDC_SAVEEDIT: + case IDC_SCROLLKEY: + case IDC_SCROLLDISP: + return "JI(`',`window.scrollback')"; + + case IDC_CLOSEWARN: + return "JI(`',`behaviour.closewarn')"; + case IDC_ALTF4: + return "JI(`',`behaviour.altf4')"; + case IDC_ALTSPACE: + return "JI(`',`behaviour.altspace')"; + case IDC_ALTONLY: + return "JI(`',`behaviour.altonly')"; + case IDC_ALWAYSONTOP: + return "JI(`',`behaviour.alwaysontop')"; + case IDC_FULLSCREENONALTENTER: + return "JI(`',`behaviour.altenter')"; + + case IDC_CURSORSTATIC: + case IDC_CURBLOCK: + case IDC_CURUNDER: + case IDC_CURVERT: + case IDC_BLINKCUR: + return "JI(`',`appearance.cursor')"; + case IDC_FONTSTATIC: + case IDC_CHOOSEFONT: + return "JI(`',`appearance.font')"; + case IDC_WINTITLE: + case IDC_WINEDIT: + case IDC_WINNAME: + return "JI(`',`appearance.title')"; + case IDC_HIDEMOUSE: + return "JI(`',`appearance.hidemouse')"; + case IDC_SUNKENEDGE: + case IDC_WINBSTATIC: + case IDC_WINBEDIT: + return "JI(`',`appearance.border')"; + + case IDC_TTSTATIC: + case IDC_TTEDIT: + return "JI(`',`connection.termtype')"; + case IDC_LOGSTATIC: + case IDC_LOGEDIT: + return "JI(`',`connection.username')"; + case IDC_PINGSTATIC: + case IDC_PINGEDIT: + return "JI(`',`connection.keepalive')"; + case IDC_NODELAY: + return "JI(`',`connection.nodelay')"; + + case IDC_TSSTATIC: + case IDC_TSEDIT: + return "JI(`',`telnet.termspeed')"; + case IDC_ENVSTATIC: + case IDC_VARSTATIC: + case IDC_VAREDIT: + case IDC_VALSTATIC: + case IDC_VALEDIT: + case IDC_ENVLIST: + case IDC_ENVADD: + case IDC_ENVREMOVE: + return "JI(`',`telnet.environ')"; + case IDC_EMSTATIC: + case IDC_EMBSD: + case IDC_EMRFC: + return "JI(`',`telnet.oldenviron')"; + case IDC_ACTSTATIC: + case IDC_TPASSIVE: + case IDC_TACTIVE: + return "JI(`',`telnet.passive')"; + case IDC_TELNETKEY: + return "JI(`',`telnet.specialkeys')"; + + case IDC_R_TSSTATIC: + case IDC_R_TSEDIT: + return "JI(`',`rlogin.termspeed')"; + case IDC_RLLUSERSTATIC: + case IDC_RLLUSEREDIT: + return "JI(`',`rlogin.localuser')"; + + case IDC_NOPTY: + return "JI(`',`ssh.nopty')"; + case IDC_CIPHERSTATIC2: + case IDC_CIPHERLIST: + case IDC_CIPHERUP: + case IDC_CIPHERDN: + case IDC_SSH2DES: + return "JI(`',`ssh.ciphers')"; + case IDC_BUGGYMAC: + return "JI(`',`ssh.buggymac')"; + case IDC_SSHPROTSTATIC: + case IDC_SSHPROT1: + case IDC_SSHPROT2: + return "JI(`',`ssh.protocol')"; + case IDC_CMDSTATIC: + case IDC_CMDEDIT: + return "JI(`',`ssh.command')"; + case IDC_COMPRESS: + return "JI(`',`ssh.compress')"; + + case IDC_PKSTATIC: + case IDC_PKEDIT: + case IDC_PKBUTTON: + return "JI(`',`ssh.auth.privkey')"; + case IDC_AGENTFWD: + return "JI(`',`ssh.auth.agentfwd')"; + case IDC_AUTHTIS: + return "JI(`',`ssh.auth.tis')"; + case IDC_AUTHKI: + return "JI(`',`ssh.auth.ki')"; + + case IDC_MBSTATIC: + case IDC_MBWINDOWS: + case IDC_MBXTERM: + return "JI(`',`selection.buttons')"; + case IDC_MOUSEOVERRIDE: + return "JI(`',`selection.shiftdrag')"; + case IDC_SELTYPESTATIC: + case IDC_SELTYPELEX: + case IDC_SELTYPERECT: + return "JI(`',`selection.rect')"; + case IDC_CCSTATIC: + case IDC_CCLIST: + case IDC_CCSET: + case IDC_CCSTATIC2: + case IDC_CCEDIT: + return "JI(`',`selection.charclasses')"; + case IDC_RAWCNP: + return "JI(`',`selection.linedraw')"; + case IDC_RTFPASTE: + return "JI(`',`selection.rtf')"; + + case IDC_BOLDCOLOUR: + return "JI(`',`colours.bold')"; + case IDC_PALETTE: + return "JI(`',`colours.logpal')"; + case IDC_COLOURSTATIC: + case IDC_COLOURLIST: + case IDC_RSTATIC: + case IDC_GSTATIC: + case IDC_BSTATIC: + case IDC_RVALUE: + case IDC_GVALUE: + case IDC_BVALUE: + case IDC_CHANGE: + return "JI(`',`colours.config')"; + + case IDC_CODEPAGESTATIC: + case IDC_CODEPAGE: + return "JI(`',`translation.codepage')"; + case IDC_CAPSLOCKCYR: + return "JI(`',`translation.cyrillic')"; + case IDC_VTSTATIC: + case IDC_VTXWINDOWS: + case IDC_VTOEMANSI: + case IDC_VTOEMONLY: + case IDC_VTPOORMAN: + case IDC_VTUNICODE: + return "JI(`',`translation.linedraw')"; + + case IDC_X11_FORWARD: + case IDC_X11_DISPSTATIC: + case IDC_X11_DISPLAY: + return "JI(`',`ssh.tunnels.x11')"; + case IDC_LPORT_ALL: + case IDC_PFWDSTATIC: + case IDC_PFWDSTATIC2: + case IDC_PFWDREMOVE: + case IDC_PFWDLIST: + case IDC_PFWDADD: + case IDC_SPORTSTATIC: + case IDC_SPORTEDIT: + case IDC_DPORTSTATIC: + case IDC_DPORTEDIT: + case IDC_PFWDLOCAL: + case IDC_PFWDREMOTE: + return "JI(`',`ssh.tunnels.portfwd')"; + + default: + return NULL; + } +} + /* 2nd arg: NZ => don't redraw session list (use when loading * a new session) */ static void init_dlg_ctrls(HWND hwnd, int keepsess) @@ -1440,6 +1760,15 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, case WM_INITDIALOG: readytogo = 0; SetWindowLong(hwnd, GWL_USERDATA, 0); + if (help_path) + SetWindowLong(hwnd, GWL_EXSTYLE, + GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_CONTEXTHELP); + else { + HWND item = GetDlgItem(hwnd, IDC_HELPBTN); + if (item) + DestroyWindow(item); + } + requested_help = FALSE; SendMessage(hwnd, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) LoadIcon(hinst, MAKEINTRESOURCE(IDI_CFGICON))); /* @@ -1636,12 +1965,31 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, } } /* If at this point we have a valid session, go! */ - if (*cfg.host) + if (*cfg.host) { + if (requested_help) { + WinHelp(hwnd, help_path, HELP_QUIT, 0); + requested_help = FALSE; + } EndDialog(hwnd, 1); - else + } else MessageBeep(0); return 0; + case IDC_HELPBTN: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) { + if (help_path) { + WinHelp(hwnd, help_path, + help_has_contents ? HELP_FINDER : HELP_CONTENTS, + 0); + requested_help = TRUE; + } + } + break; case IDCANCEL: + if (requested_help) { + WinHelp(hwnd, help_path, HELP_QUIT, 0); + requested_help = FALSE; + } EndDialog(hwnd, 0); return 0; case IDC_PROTTELNET: @@ -2738,7 +3086,23 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, break; } return 0; + case WM_HELP: + if (help_path) { + int id = ((LPHELPINFO)lParam)->iCtrlId; + char *cmd = help_context_cmd(id); + if (cmd) { + WinHelp(hwnd, help_path, HELP_COMMAND, (DWORD)cmd); + requested_help = TRUE; + } else { + MessageBeep(0); + } + } + break; case WM_CLOSE: + if (requested_help) { + WinHelp(hwnd, help_path, HELP_QUIT, 0); + requested_help = FALSE; + } EndDialog(hwnd, 0); return 0; diff --git a/window.c b/window.c index 8b404ab1..d9939fd8 100644 --- a/window.c +++ b/window.c @@ -42,10 +42,11 @@ #define IDM_TEL_SUSP 0x0110 #define IDM_TEL_EOR 0x0120 #define IDM_TEL_EOF 0x0130 -#define IDM_ABOUT 0x0140 -#define IDM_SAVEDSESS 0x0150 -#define IDM_COPYALL 0x0160 -#define IDM_FULLSCREEN 0x0170 +#define IDM_HELP 0x0140 +#define IDM_ABOUT 0x0150 +#define IDM_SAVEDSESS 0x0160 +#define IDM_COPYALL 0x0170 +#define IDM_FULLSCREEN 0x0180 #define IDM_SESSLGP 0x0250 /* log type printable */ #define IDM_SESSLGA 0x0260 /* log type all chars */ @@ -191,6 +192,32 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } /* + * See if we can find our Help file. + */ + { + char b[2048], *p, *q, *r; + FILE *fp; + GetModuleFileName(NULL, b, sizeof(b) - 1); + r = b; + p = strrchr(b, '\\'); + if (p && p >= r) r = p+1; + q = strrchr(b, ':'); + if (q && q >= r) r = q+1; + strcpy(r, "putty.hlp"); + if ( (fp = fopen(b, "r")) != NULL) { + help_path = dupstr(b); + fclose(fp); + } else + help_path = NULL; + strcpy(r, "putty.cnt"); + if ( (fp = fopen(b, "r")) != NULL) { + help_has_contents = TRUE; + fclose(fp); + } else + help_has_contents = FALSE; + } + + /* * Process the command line. */ { @@ -586,6 +613,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) AppendMenu(m, (cfg.resize_action == RESIZE_DISABLED) ? MF_GRAYED : MF_ENABLED, IDM_FULLSCREEN, "&Full Screen"); AppendMenu(m, MF_SEPARATOR, 0, 0); + if (help_path) + AppendMenu(m, MF_ENABLED, IDM_HELP, "&Help"); AppendMenu(m, MF_ENABLED, IDM_ABOUT, "&About PuTTY"); } @@ -1755,6 +1784,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, case IDM_ABOUT: showabout(hwnd); break; + case IDM_HELP: + WinHelp(hwnd, help_path, + help_has_contents ? HELP_FINDER : HELP_CONTENTS, 0); + break; case SC_MOUSEMENU: /* * We get this if the System menu has been activated -- 2.11.0