2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
14 #include <afs/param.h>
18 #include "afs_config.h"
22 * DEFINITIONS ________________________________________________________________
26 #define nBUFSIZE_MIN 3000
27 #define nBUFSIZE_MAX 32000
30 static BOOL fFirstTime = TRUE;
31 static DWORD nTraceBufSize;
32 static BOOL fTrapOnPanic;
33 static BOOL fReportSessionStartups;
37 * PROTOTYPES _________________________________________________________________
41 void Diag_OnInitDialog (HWND hDlg);
42 void Diag_OnOK(HWND hDlg);
43 void Diag_OnCancel(HWND hDlg);
48 * ROUTINES ___________________________________________________________________
52 BOOL CALLBACK Diag_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
57 Diag_OnInitDialog (hDlg);
60 case WM_CTLCOLORSTATIC:
61 if ((HWND)lp == GetDlgItem (hDlg, IDC_CHUNK_SIZE))
63 if (IsWindowEnabled ((HWND)lp))
65 static HBRUSH hbrStatic = CreateSolidBrush (GetSysColor (COLOR_WINDOW));
66 SetTextColor ((HDC)wp, GetSysColor (COLOR_WINDOWTEXT));
67 SetBkColor ((HDC)wp, GetSysColor (COLOR_WINDOW));
68 return (BOOL)hbrStatic;
77 Diag_DlgProc (hDlg, WM_HELP, 0, 0);
91 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_ADVANCED_DIAG);
98 static void SetUpYesNoCombo(HWND hDlg, UINT nCtrlID, BOOL fInitialSetting)
100 static TCHAR szYes[10] = TEXT("");
101 static TCHAR szNo[10] = TEXT("");
104 GetString (szYes, IDS_YES);
105 GetString (szNo, IDS_NO);
108 HWND hCombo = GetDlgItem(hDlg, nCtrlID);
110 // Always add szNo first so it has index 0 and szYes has index 1
111 CB_AddItem (hCombo, szNo, 0);
112 CB_AddItem (hCombo, szYes, 0);
114 CB_SetSelected (hCombo, fInitialSetting);
117 void Diag_OnInitDialog (HWND hDlg)
120 Config_GetTraceBufferSize(&g.Configuration.nTraceBufSize);
121 Config_GetTrapOnPanic(&g.Configuration.fTrapOnPanic);
122 Config_GetReportSessionStartups(&g.Configuration.fReportSessionStartups);
124 nTraceBufSize = g.Configuration.nTraceBufSize;
125 fTrapOnPanic = g.Configuration.fTrapOnPanic;
126 fReportSessionStartups = g.Configuration.fReportSessionStartups;
131 CreateSpinner (GetDlgItem (hDlg, IDC_TRACE_LOG_BUF_SIZE), 10, FALSE, nBUFSIZE_MIN, nTraceBufSize, nBUFSIZE_MAX);
133 SetUpYesNoCombo(hDlg, IDC_TRAP_ON_PANIC, fTrapOnPanic);
134 SetUpYesNoCombo(hDlg, IDC_REPORT_SESSION_STARTUPS, fReportSessionStartups);
138 void Diag_OnOK (HWND hDlg)
140 nTraceBufSize = SP_GetPos (GetDlgItem (hDlg, IDC_TRACE_LOG_BUF_SIZE));
141 fTrapOnPanic = CB_GetSelected (GetDlgItem (hDlg, IDC_TRAP_ON_PANIC));
142 fReportSessionStartups = CB_GetSelected (GetDlgItem (hDlg, IDC_REPORT_SESSION_STARTUPS));
144 EndDialog(hDlg, IDOK);
153 if (nTraceBufSize != g.Configuration.nTraceBufSize) {
154 if (!Config_SetTraceBufferSize (nTraceBufSize))
156 g.Configuration.nTraceBufSize = nTraceBufSize;
159 if (fTrapOnPanic != g.Configuration.fTrapOnPanic) {
160 if (!Config_SetTrapOnPanic (fTrapOnPanic))
162 g.Configuration.fTrapOnPanic = fTrapOnPanic;
165 if (fReportSessionStartups != g.Configuration.fReportSessionStartups) {
166 if (!Config_SetReportSessionStartups (fReportSessionStartups))
168 g.Configuration.fReportSessionStartups = fReportSessionStartups;
175 void Diag_OnCancel(HWND hDlg)
179 EndDialog(hDlg, IDCANCEL);