Big sprawling dialog-box commit covering all sorts of things.
[u/mdw/putty] / config.c
index 961dc7f..784268c 100644 (file)
--- a/config.c
+++ b/config.c
@@ -328,7 +328,7 @@ static void sessionsaver_handler(union control *ctrl, void *dlg,
             * there was a session selected in that which had a
             * valid host name in it, then load it and go.
             */
-           if (dlg_last_focused(dlg) == ssd->listbox && !*cfg->host) {
+           if (dlg_last_focused(ctrl, dlg) == ssd->listbox && !*cfg->host) {
                Config cfg2;
                if (!load_selected_session(ssd, savedsession, dlg, &cfg2)) {
                    dlg_beep(dlg);
@@ -700,6 +700,7 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     ssd->okbutton->generic.column = 3;
     ssd->cancelbutton = ctrl_pushbutton(s, "Cancel", 'c', HELPCTX(no_help),
                                        sessionsaver_handler, P(ssd));
+    ssd->cancelbutton->button.iscancel = TRUE;
     ssd->cancelbutton->generic.column = 4;
     /* We carefully don't close the 5-column part, so that platform-
      * specific add-ons can put extra buttons alongside Open and Cancel. */
@@ -723,7 +724,7 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
                         I(offsetof(Config,port)), I(-1));
        c->generic.column = 1;
        ctrl_columns(s, 1, 100);
-       if (backends[3].backend == NULL) {
+       if (backends[3].name == NULL) {
            ctrl_radiobuttons(s, "Protocol:", NO_SHORTCUT, 3,
                              HELPCTX(session_hostname),
                              protocolbuttons_handler, P(c),
@@ -754,6 +755,11 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
         * than alongside that edit box. */
        ctrl_columns(s, 1, 100);
        ctrl_columns(s, 2, 75, 25);
+       ssd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
+                                   HELPCTX(session_saved),
+                                   sessionsaver_handler, P(ssd));
+       ssd->listbox->generic.column = 0;
+       ssd->listbox->listbox.height = 7;
        ssd->loadbutton = ctrl_pushbutton(s, "Load", 'l',
                                          HELPCTX(session_saved),
                                          sessionsaver_handler, P(ssd));
@@ -766,11 +772,6 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
                                         HELPCTX(session_saved),
                                         sessionsaver_handler, P(ssd));
        ssd->delbutton->generic.column = 1;
-       ssd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
-                                   HELPCTX(session_saved),
-                                   sessionsaver_handler, P(ssd));
-       ssd->listbox->generic.column = 0;
-       ssd->listbox->listbox.height = 7;
        ctrl_columns(s, 1, 100);
     }
 
@@ -919,13 +920,13 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     ctrl_editbox(s, "... in this many seconds", 't', 20,
                 HELPCTX(bell_overload),
                 dlg_stdeditbox_handler, I(offsetof(Config,bellovl_t)),
-                I(-1000));
+                I(-TICKSPERSEC));
     ctrl_text(s, "The bell is re-enabled after a few seconds of silence.",
              HELPCTX(bell_overload));
     ctrl_editbox(s, "Seconds of silence required", 's', 20,
                 HELPCTX(bell_overload),
                 dlg_stdeditbox_handler, I(offsetof(Config,bellovl_s)),
-                I(-1000));
+                I(-TICKSPERSEC));
 
     /*
      * The Terminal/Features panel.
@@ -986,10 +987,6 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     ctrl_checkbox(s, "Display scrollbar", 'd',
                  HELPCTX(window_scrollback),
                  dlg_stdcheckbox_handler, I(offsetof(Config,scrollbar)));
-    ctrl_checkbox(s, "Display scrollbar in full screen mode", 'i',
-                 HELPCTX(window_scrollback),
-                 dlg_stdcheckbox_handler,
-                 I(offsetof(Config,scrollbar_in_fullscreen)));
     ctrl_checkbox(s, "Reset scrollback on keypress", 'k',
                  HELPCTX(window_scrollback),
                  dlg_stdcheckbox_handler, I(offsetof(Config,scroll_on_key)));
@@ -1312,6 +1309,10 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
                                       HELPCTX(telnet_environ),
                                       environ_handler, P(ed));
            ed->listbox->listbox.height = 3;
+           ed->listbox->listbox.ncols = 2;
+           ed->listbox->listbox.percentages = smalloc(2*sizeof(int));
+           ed->listbox->listbox.percentages[0] = 30;
+           ed->listbox->listbox.percentages[1] = 70;
        }
 
        s = ctrl_getset(b, "Connection/Telnet", "protocol",
@@ -1366,7 +1367,7 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
      * All the SSH stuff is omitted in PuTTYtel.
      */
 
-    if (!midsession && backends[3].backend != NULL) {
+    if (!midsession && backends[3].name != NULL) {
 
        /*
         * The Connection/SSH panel.
@@ -1488,6 +1489,10 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
                                    HELPCTX(ssh_tunnels_portfwd),
                                    portfwd_handler, P(pfd));
        pfd->listbox->listbox.height = 3;
+       pfd->listbox->listbox.ncols = 2;
+       pfd->listbox->listbox.percentages = smalloc(2*sizeof(int));
+       pfd->listbox->listbox.percentages[0] = 20;
+       pfd->listbox->listbox.percentages[1] = 80;
        ctrl_tabdelay(s, pfd->rembutton);
        ctrl_text(s, "Add new forwarded port:", HELPCTX(ssh_tunnels_portfwd));
        /* You want to enter source, destination and type, _then_ hit Add.