+/*
+ * windlg.c - dialogs for PuTTY(tel), including the configuration dialog.
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
wc.lpfnWndProc = DefDlgProc;
wc.cbClsExtra = 0;
-#ifdef LONG_PTR
wc.cbWndExtra = DLGWINDOWEXTRA + 2*sizeof(LONG_PTR);
-#else
- wc.cbWndExtra = DLGWINDOWEXTRA + 8;
-#endif
wc.hInstance = hinst;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
newitem = TreeView_InsertItem(faff->treeview, &ins);
if (level > 0)
TreeView_Expand(faff->treeview, faff->lastat[level - 1],
- TVE_EXPAND);
+ (level > 1 ? TVE_COLLAPSE : TVE_EXPAND));
faff->lastat[level] = newitem;
for (i = level + 1; i < 4; i++)
faff->lastat[i] = NULL;
create_controls(hwnd, ""); /* Open and Cancel buttons etc */
SetWindowText(hwnd, dp.wintitle);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- if (help_path)
+ if (has_help())
SetWindowLongPtr(hwnd, GWL_EXSTYLE,
GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
WS_EX_CONTEXTHELP);
if (item)
DestroyWindow(item);
}
- requested_help = FALSE;
SendMessage(hwnd, WM_SETICON, (WPARAM) ICON_BIG,
(LPARAM) LoadIcon(hinst, MAKEINTRESOURCE(IDI_CFGICON)));
/*
ret = 0;
return ret;
case WM_HELP:
- if (help_path) {
- if (winctrl_context_help(&dp, hwnd,
- ((LPHELPINFO)lParam)->iCtrlId))
- requested_help = TRUE;
- else
- MessageBeep(0);
- }
+ if (!winctrl_context_help(&dp, hwnd,
+ ((LPHELPINFO)lParam)->iCtrlId))
+ MessageBeep(0);
break;
case WM_CLOSE:
- if (requested_help) {
- WinHelp(hwnd, help_path, HELP_QUIT, 0);
- requested_help = FALSE;
- }
+ quit_help(hwnd);
SaneEndDialog(hwnd, 0);
return 0;
void show_help(HWND hwnd)
{
- if (help_path) {
- WinHelp(hwnd, help_path,
- help_has_contents ? HELP_FINDER : HELP_CONTENTS,
- 0);
- requested_help = TRUE;
- }
+ launch_help(hwnd, NULL);
}
void defuse_showwindow(void)
ctrlbox = ctrl_new_box();
setup_config_box(ctrlbox, FALSE, 0, 0);
- win_setup_config_box(ctrlbox, &dp.hwnd, (help_path != NULL), FALSE);
+ win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), FALSE, 0);
dp_init(&dp);
winctrl_init(&ctrls_base);
winctrl_init(&ctrls_panel);
ctrlbox = ctrl_new_box();
setup_config_box(ctrlbox, TRUE, cfg.protocol, protcfginfo);
- win_setup_config_box(ctrlbox, &dp.hwnd, (help_path != NULL), TRUE);
+ win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), TRUE,
+ cfg.protocol);
dp_init(&dp);
winctrl_init(&ctrls_base);
winctrl_init(&ctrls_panel);
title = dupprintf(mbtitle, appname);
mbret = MessageBox(NULL, message, title,
MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
+ socket_reselect_all();
sfree(message);
sfree(title);
if (mbret == IDYES)
mbret = MessageBox(NULL, message, mbtitle,
MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON3);
+ socket_reselect_all();
+
sfree(message);
sfree(mbtitle);
MessageBox(NULL, msg, title, MB_OK);
+ socket_reselect_all();
+
sfree(msg);
sfree(title);
}