Wez Furlong's patch to add xterm mouse reporting and proper mouse
[u/mdw/putty] / windlg.c
index 95b4840..6f3c35c 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -43,6 +43,20 @@ static void MyGetDlgItemInt (HWND hwnd, int id, int *result) {
        *result = n;
 }
 
+static void MyGetDlgItemFlt (HWND hwnd, int id, int *result, int scale) {
+    char text[80];
+    BOOL ok;
+    ok = GetDlgItemText (hwnd, id, text, sizeof(text)-1);
+    if (ok && text[0])
+       *result = (int) (scale * atof(text));
+}
+
+static void MySetDlgItemFlt (HWND hwnd, int id, double value) {
+    char text[80];
+    sprintf(text, "%g", value);
+    SetDlgItemText (hwnd, id, text);
+}
+
 static int CALLBACK LogProc (HWND hwnd, UINT msg,
                             WPARAM wParam, LPARAM lParam) {
     int i;
@@ -340,6 +354,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
     IDC_BOX_APPEARANCE2,
     IDC_BOX_APPEARANCE3,
     IDC_BOX_APPEARANCE4,
+    IDC_BOX_APPEARANCE5,
     IDC_CURSORSTATIC,
     IDC_CURBLOCK,
     IDC_CURUNDER,
@@ -351,6 +366,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
     IDC_WINEDIT,
     IDC_WINNAME,
     IDC_HIDEMOUSE,
+    IDC_SUNKENEDGE,
     appearancepanelend,
 
     connectionpanelstart,
@@ -585,8 +601,8 @@ static void init_dlg_ctrls(HWND hwnd) {
     SetDlgItemText (hwnd, IDC_BELL_WAVEEDIT, cfg.bell_wavefile);
     CheckDlgButton (hwnd, IDC_BELLOVL, cfg.bellovl);
     SetDlgItemInt (hwnd, IDC_BELLOVLN, cfg.bellovl_n, FALSE);
-    SetDlgItemInt (hwnd, IDC_BELLOVLT, cfg.bellovl_t, FALSE);
-    SetDlgItemInt (hwnd, IDC_BELLOVLS, cfg.bellovl_s, FALSE);
+    MySetDlgItemFlt (hwnd, IDC_BELLOVLT, cfg.bellovl_t / 1000.0);
+    MySetDlgItemFlt (hwnd, IDC_BELLOVLS, cfg.bellovl_s / 1000.0);
 
     CheckDlgButton (hwnd, IDC_BCE, cfg.bce);
     CheckDlgButton (hwnd, IDC_BLINKTEXT, cfg.blinktext);
@@ -594,6 +610,7 @@ static void init_dlg_ctrls(HWND hwnd) {
     SetDlgItemText (hwnd, IDC_WINEDIT, cfg.wintitle);
     CheckDlgButton (hwnd, IDC_WINNAME, cfg.win_name_always);
     CheckDlgButton (hwnd, IDC_HIDEMOUSE, cfg.hide_mouseptr);
+    CheckDlgButton (hwnd, IDC_SUNKENEDGE, cfg.sunken_edge);
     CheckRadioButton (hwnd, IDC_CURBLOCK, IDC_CURVERT,
                      cfg.cursor_type==0 ? IDC_CURBLOCK :
                      cfg.cursor_type==1 ? IDC_CURUNDER : IDC_CURVERT);
@@ -778,7 +795,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == loggingpanelstart) {
-        /* The Logging panel. Accelerators used: [acgo] tplfwes */
+        /* The Logging panel. Accelerators used: [acgo] tplfwe */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling session logging",
@@ -946,7 +963,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == appearancepanelstart) {
-        /* The Appearance panel. Accelerators used: [acgo] luvb h ti p */
+        /* The Appearance panel. Accelerators used: [acgo] luvb h ti p */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling PuTTY's appearance",
@@ -976,6 +993,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
         checkbox(&cp, "Hide mouse &pointer when typing in window",
                  IDC_HIDEMOUSE);
         endbox(&cp);
+        beginbox(&cp, "Adjust the window border",
+                 IDC_BOX_APPEARANCE5);
+        checkbox(&cp, "&Sunken-edge border (slightly thicker)",
+                 IDC_SUNKENEDGE);
+        endbox(&cp);
     }
 
     if (panel == translationpanelstart) {
@@ -1727,11 +1749,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
             break;
           case IDC_BELLOVLT:
             if (HIWORD(wParam) == EN_CHANGE)
-                MyGetDlgItemInt (hwnd, IDC_BELLOVLT, &cfg.bellovl_t);
+                MyGetDlgItemFlt (hwnd, IDC_BELLOVLT, &cfg.bellovl_t, 1000);
             break;
           case IDC_BELLOVLS:
             if (HIWORD(wParam) == EN_CHANGE)
-                MyGetDlgItemInt (hwnd, IDC_BELLOVLS, &cfg.bellovl_s);
+                MyGetDlgItemFlt (hwnd, IDC_BELLOVLS, &cfg.bellovl_s, 1000);
             break;
          case IDC_BLINKTEXT:
            if (HIWORD(wParam) == BN_CLICKED ||
@@ -1753,6 +1775,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
                HIWORD(wParam) == BN_DOUBLECLICKED)
                cfg.hide_mouseptr = IsDlgButtonChecked (hwnd, IDC_HIDEMOUSE);
            break;
+         case IDC_SUNKENEDGE:
+           if (HIWORD(wParam) == BN_CLICKED ||
+               HIWORD(wParam) == BN_DOUBLECLICKED)
+               cfg.sunken_edge = IsDlgButtonChecked (hwnd, IDC_SUNKENEDGE);
+           break;
          case IDC_CURBLOCK:
            if (HIWORD(wParam) == BN_CLICKED ||
                HIWORD(wParam) == BN_DOUBLECLICKED)