Implement writing RTF to the clipboard (off by default), so that if
[u/mdw/putty] / windlg.c
index 7726438..21ed7a7 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -354,8 +354,12 @@ enum { IDCX_ABOUT =
     IDC_ROWSEDIT,
     IDC_COLSSTATIC,
     IDC_COLSEDIT,
-    IDC_LOCKSIZE,
+    IDC_RESIZESTATIC,
+    IDC_RESIZETERM,
+    IDC_RESIZEFONT,
+    IDC_RESIZENONE,
     IDC_SCROLLBAR,
+    IDC_SCROLLBARFULLSCREEN,
     IDC_CLOSEWARN,
     IDC_SAVESTATIC,
     IDC_SAVEEDIT,
@@ -365,6 +369,7 @@ enum { IDCX_ABOUT =
     IDC_SCROLLKEY,
     IDC_SCROLLDISP,
     IDC_ALWAYSONTOP,
+    IDC_FULLSCREENONALTENTER,
     windowpanelend,
 
     appearancepanelstart,
@@ -386,6 +391,8 @@ enum { IDCX_ABOUT =
     IDC_WINNAME,
     IDC_HIDEMOUSE,
     IDC_SUNKENEDGE,
+    IDC_WINBSTATIC,
+    IDC_WINBEDIT,
     appearancepanelend,
 
     connectionpanelstart,
@@ -472,12 +479,16 @@ enum { IDCX_ABOUT =
     IDC_MBWINDOWS,
     IDC_MBXTERM,
     IDC_MOUSEOVERRIDE,
+    IDC_SELTYPESTATIC,
+    IDC_SELTYPELEX,
+    IDC_SELTYPERECT,
     IDC_CCSTATIC,
     IDC_CCLIST,
     IDC_CCSET,
     IDC_CCSTATIC2,
     IDC_CCEDIT,
     IDC_RAWCNP,
+    IDC_RTFPASTE,
     selectionpanelend,
 
     colourspanelstart,
@@ -501,8 +512,10 @@ enum { IDCX_ABOUT =
     IDC_TITLE_TRANSLATION,
     IDC_BOX_TRANSLATION1,
     IDC_BOX_TRANSLATION2,
+    IDC_BOX_TRANSLATION3,
     IDC_CODEPAGESTATIC,
     IDC_CODEPAGE,
+    IDC_CAPSLOCKCYR,
     IDC_VTSTATIC,
     IDC_VTXWINDOWS,
     IDC_VTOEMANSI,
@@ -625,6 +638,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
                     cfg.localedit == LD_YES ? IDC_EDITYES : IDC_EDITNO);
     SetDlgItemText(hwnd, IDC_ANSWEREDIT, cfg.answerback);
     CheckDlgButton(hwnd, IDC_ALWAYSONTOP, cfg.alwaysontop);
+    CheckDlgButton(hwnd, IDC_FULLSCREENONALTENTER, cfg.fullscreenonaltenter);
     CheckDlgButton(hwnd, IDC_SCROLLKEY, cfg.scroll_on_key);
     CheckDlgButton(hwnd, IDC_SCROLLDISP, cfg.scroll_on_disp);
 
@@ -660,12 +674,17 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     CheckDlgButton(hwnd, IDC_WINNAME, cfg.win_name_always);
     CheckDlgButton(hwnd, IDC_HIDEMOUSE, cfg.hide_mouseptr);
     CheckDlgButton(hwnd, IDC_SUNKENEDGE, cfg.sunken_edge);
+    SetDlgItemInt(hwnd, IDC_WINBEDIT, cfg.window_border, FALSE);
     CheckRadioButton(hwnd, IDC_CURBLOCK, IDC_CURVERT,
                     cfg.cursor_type == 0 ? IDC_CURBLOCK :
                     cfg.cursor_type == 1 ? IDC_CURUNDER : IDC_CURVERT);
     CheckDlgButton(hwnd, IDC_BLINKCUR, cfg.blink_cur);
     CheckDlgButton(hwnd, IDC_SCROLLBAR, cfg.scrollbar);
-    CheckDlgButton(hwnd, IDC_LOCKSIZE, cfg.locksize);
+    CheckDlgButton(hwnd, IDC_SCROLLBARFULLSCREEN, cfg.scrollbar_in_fullscreen);
+    CheckRadioButton(hwnd, IDC_RESIZETERM, IDC_RESIZENONE,
+                    cfg.resize_action == RESIZE_TERM ? IDC_RESIZETERM :
+                    cfg.resize_action == RESIZE_FONT ? IDC_RESIZEFONT :
+                    IDC_RESIZENONE);
     CheckRadioButton(hwnd, IDC_COEALWAYS, IDC_COENORMAL,
                     cfg.close_on_exit == COE_NORMAL ? IDC_COENORMAL :
                     cfg.close_on_exit ==
@@ -748,11 +767,13 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
 
     }
 
-
     CheckRadioButton(hwnd, IDC_MBWINDOWS, IDC_MBXTERM,
                     cfg.mouse_is_xterm ? IDC_MBXTERM : IDC_MBWINDOWS);
+    CheckRadioButton(hwnd, IDC_SELTYPELEX, IDC_SELTYPERECT,
+                    cfg.rect_select == 0 ? IDC_SELTYPELEX : IDC_SELTYPERECT);
     CheckDlgButton(hwnd, IDC_MOUSEOVERRIDE, cfg.mouse_override);
     CheckDlgButton(hwnd, IDC_RAWCNP, cfg.rawcnp);
+    CheckDlgButton(hwnd, IDC_RTFPASTE, cfg.rtf_paste);
     {
        static int tabs[4] = { 25, 61, 96, 128 };
        SendDlgItemMessage(hwnd, IDC_CCLIST, LB_SETTABSTOPS, 4,
@@ -789,6 +810,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
        char *cp;
        strcpy(cfg.line_codepage, cp_name(decode_codepage(cfg.line_codepage)));
        SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_RESETCONTENT, 0, 0);
+       CheckDlgButton (hwnd, IDC_CAPSLOCKCYR, cfg.xlat_capslockcyr);
        for (i = 0; (cp = cp_enumerate(i)) != NULL; i++) {
            SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_ADDSTRING,
                               0, (LPARAM) cp);
@@ -1026,7 +1048,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == windowpanelstart) {
-       /* The Window panel. Accelerators used: [acgo] rmz sdkp w4ylt */
+       /* The Window panel. Accelerators used: [acgo] rmznb sdikp w4ylt f */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        bartitle(&cp, "Options controlling PuTTY's window",
@@ -1035,13 +1057,17 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        multiedit(&cp,
                  "&Rows", IDC_ROWSSTATIC, IDC_ROWSEDIT, 50,
                  "Colu&mns", IDC_COLSSTATIC, IDC_COLSEDIT, 50, NULL);
-       checkbox(&cp, "Lock window size against resi&zing", IDC_LOCKSIZE);
+       radioline(&cp, "Action when the window is resized:", IDC_RESIZESTATIC,
+                 3, "Resi&ze terminal", IDC_RESIZETERM,
+                 "Change fo&nt", IDC_RESIZEFONT,
+                 "For&bid resizing", IDC_RESIZENONE, NULL);
        endbox(&cp);
        beginbox(&cp, "Control the scrollback in the window",
                 IDC_BOX_WINDOW2);
        staticedit(&cp, "Lines of &scrollback",
                   IDC_SAVESTATIC, IDC_SAVEEDIT, 50);
        checkbox(&cp, "&Display scrollbar", IDC_SCROLLBAR);
+       checkbox(&cp, "D&isplay scrollbar in full screen mode", IDC_SCROLLBARFULLSCREEN);
        checkbox(&cp, "Reset scrollback on &keypress", IDC_SCROLLKEY);
        checkbox(&cp, "Reset scrollback on dis&play activity",
                 IDC_SCROLLDISP);
@@ -1052,6 +1078,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        checkbox(&cp, "S&ystem menu appears on ALT-Space", IDC_ALTSPACE);
        checkbox(&cp, "System menu appears on A&LT alone", IDC_ALTONLY);
        checkbox(&cp, "Ensure window is always on &top", IDC_ALWAYSONTOP);
+       checkbox(&cp, "&Full screen on Alt-Enter", IDC_FULLSCREENONALTENTER);
        endbox(&cp);
     }
 
@@ -1059,8 +1086,8 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        /* The Appearance panel. Accelerators used: [acgo] luvb h ti p s */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
-       bartitle(&cp, "Options controlling PuTTY's appearance",
-                IDC_TITLE_APPEARANCE);
+       /* bartitle(&cp, "Options controlling PuTTY's appearance",
+                IDC_TITLE_APPEARANCE); */
        beginbox(&cp, "Adjust the use of the cursor", IDC_BOX_APPEARANCE1);
        radioline(&cp, "Cursor appearance:", IDC_CURSORSTATIC, 3,
                  "B&lock", IDC_CURBLOCK,
@@ -1086,22 +1113,29 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        beginbox(&cp, "Adjust the window border", IDC_BOX_APPEARANCE5);
        checkbox(&cp, "&Sunken-edge border (slightly thicker)",
                 IDC_SUNKENEDGE);
+       staticedit(&cp, "Gap between text and window edge",
+                  IDC_WINBSTATIC, IDC_WINBEDIT, 20);
        endbox(&cp);
     }
 
     if (panel == translationpanelstart) {
-       /* The Translation panel. Accelerators used: [acgo] xbep t s */
+       /* The Translation panel. Accelerators used: [acgo] rxbepus */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        bartitle(&cp, "Options controlling character set translation",
                 IDC_TITLE_TRANSLATION);
        beginbox(&cp, "Character set translation on received data",
-                IDC_BOX_TRANSLATION2);
-       combobox(&cp, "Received data assumed to be in which character set:",
+                IDC_BOX_TRANSLATION1);
+       combobox(&cp, "&Received data assumed to be in which character set:",
                 IDC_CODEPAGESTATIC, IDC_CODEPAGE);
        endbox(&cp);
+        beginbox(&cp, "Enable character set translation on input data",
+                 IDC_BOX_TRANSLATION2);
+        checkbox(&cp, "Cap&s Lock acts as Cyrillic switch",
+                 IDC_CAPSLOCKCYR);
+        endbox(&cp);
        beginbox(&cp, "Adjust how PuTTY displays line drawing characters",
-                IDC_BOX_TRANSLATION1);
+                IDC_BOX_TRANSLATION3);
        radiobig(&cp,
                 "Handling of line drawing characters:", IDC_VTSTATIC,
                 "Font has &XWindows encoding", IDC_VTXWINDOWS,
@@ -1113,7 +1147,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == selectionpanelstart) {
-       /* The Selection panel. Accelerators used: [acgo] d wxp hst */
+       /* The Selection panel. Accelerators used: [acgo] df wxp hst nr */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        bartitle(&cp, "Options controlling copy and paste",
@@ -1123,6 +1157,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        checkbox(&cp,
                 "&Don't translate line drawing chars into +, - and |",
                 IDC_RAWCNP);
+       checkbox(&cp,
+                "Paste to clipboard in RT&F as well as plain text",
+                IDC_RTFPASTE);
        endbox(&cp);
        beginbox(&cp, "Control which mouse button does which thing",
                 IDC_BOX_SELECTION2);
@@ -1133,6 +1170,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
        checkbox(&cp,
                 "Shift overrides a&pplication's use of mouse",
                 IDC_MOUSEOVERRIDE);
+        radioline(&cp,
+                  "Default selection mode (Alt+drag does the other one):",
+                  IDC_SELTYPESTATIC, 2,
+                 "&Normal", IDC_SELTYPELEX,
+                 "&Rectangular block", IDC_SELTYPERECT, NULL);
        endbox(&cp);
        beginbox(&cp, "Control the select-one-word-at-a-time mode",
                 IDC_BOX_SELECTION3);
@@ -1237,7 +1279,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == sshpanelstart) {
-       /* The SSH panel. Accelerators used: [acgo] r pe12i sud */
+       /* The SSH panel. Accelerators used: [acgo] r pe12i s */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        if (dlgtype == 0) {
@@ -1407,7 +1449,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
            r.left = 3;
            r.right = r.left + 75;
            r.top = 13;
-           r.bottom = r.top + 206;
+           r.bottom = r.top + 219;
            MapDialogRect(hwnd, &r);
            treeview = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "",
                                      WS_CHILD | WS_VISIBLE |
@@ -1846,6 +1888,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                        cfg.alwaysontop =
                        IsDlgButtonChecked(hwnd, IDC_ALWAYSONTOP);
                break;
+             case IDC_FULLSCREENONALTENTER:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED)
+                       cfg.fullscreenonaltenter =
+                       IsDlgButtonChecked(hwnd, IDC_FULLSCREENONALTENTER);
+               break;
              case IDC_SCROLLKEY:
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED)
@@ -2049,6 +2097,13 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                        cfg.sunken_edge =
                        IsDlgButtonChecked(hwnd, IDC_SUNKENEDGE);
                break;
+             case IDC_WINBEDIT:
+               if (HIWORD(wParam) == EN_CHANGE)
+                   MyGetDlgItemInt(hwnd, IDC_WINBEDIT,
+                                   &cfg.window_border);
+               if (cfg.window_border > 32)
+                   cfg.window_border = 32;
+               break;
              case IDC_CURBLOCK:
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED)
@@ -2076,11 +2131,24 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                        cfg.scrollbar =
                        IsDlgButtonChecked(hwnd, IDC_SCROLLBAR);
                break;
-             case IDC_LOCKSIZE:
+             case IDC_SCROLLBARFULLSCREEN:
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED)
-                       cfg.locksize =
-                       IsDlgButtonChecked(hwnd, IDC_LOCKSIZE);
+                   cfg.scrollbar_in_fullscreen =
+                   IsDlgButtonChecked(hwnd, IDC_SCROLLBARFULLSCREEN);
+               break;
+             case IDC_RESIZETERM:
+             case IDC_RESIZEFONT:
+             case IDC_RESIZENONE:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED) {
+                   cfg.resize_action =
+                       IsDlgButtonChecked(hwnd,
+                                          IDC_RESIZETERM) ? RESIZE_TERM :
+                       IsDlgButtonChecked(hwnd,
+                                          IDC_RESIZEFONT) ? RESIZE_FONT :
+                       RESIZE_DISABLED;
+               }
                break;
              case IDC_WINEDIT:
                if (HIWORD(wParam) == EN_CHANGE)
@@ -2339,7 +2407,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                of.nMaxFile = sizeof(filename);
                of.lpstrFileTitle = NULL;
                of.lpstrInitialDir = NULL;
-               of.lpstrTitle = "Select Public Key File";
+               of.lpstrTitle = "Select Private Key File";
                of.Flags = 0;
                if (GetOpenFileName(&of)) {
                    strcpy(cfg.keyfile, filename);
@@ -2349,10 +2417,17 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
              case IDC_RAWCNP:
                cfg.rawcnp = IsDlgButtonChecked(hwnd, IDC_RAWCNP);
                break;
+             case IDC_RTFPASTE:
+               cfg.rtf_paste = IsDlgButtonChecked(hwnd, IDC_RTFPASTE);
+               break;
              case IDC_MBWINDOWS:
              case IDC_MBXTERM:
                cfg.mouse_is_xterm = IsDlgButtonChecked(hwnd, IDC_MBXTERM);
                break;
+             case IDC_SELTYPELEX:
+             case IDC_SELTYPERECT:
+               cfg.rect_select = IsDlgButtonChecked(hwnd, IDC_SELTYPERECT);
+               break;
              case IDC_MOUSEOVERRIDE:
                cfg.mouse_override = IsDlgButtonChecked(hwnd, IDC_MOUSEOVERRIDE);
                break;
@@ -2482,6 +2557,13 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                    SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage);
                }
                break;
+             case IDC_CAPSLOCKCYR:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED) {
+                   cfg.xlat_capslockcyr =
+                       IsDlgButtonChecked (hwnd, IDC_CAPSLOCKCYR);
+               }
+               break;
              case IDC_VTXWINDOWS:
              case IDC_VTOEMANSI:
              case IDC_VTOEMONLY: