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
11 #include <afs/param.h>
15 #include "afs_config.h"
19 * DEFINITIONS ________________________________________________________________
23 #define nBUFSIZE_MIN 3000
24 #define nBUFSIZE_MAX 32000
27 static BOOL fFirstTime = TRUE;
28 static DWORD nTraceBufSize;
29 static BOOL fTrapOnPanic;
30 static BOOL fReportSessionStartups;
34 * PROTOTYPES _________________________________________________________________
38 void Diag_OnInitDialog (HWND hDlg);
39 void Diag_OnOK(HWND hDlg);
40 void Diag_OnCancel(HWND hDlg);
45 * ROUTINES ___________________________________________________________________
49 BOOL CALLBACK Diag_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
54 Diag_OnInitDialog (hDlg);
57 case WM_CTLCOLORSTATIC:
58 if ((HWND)lp == GetDlgItem (hDlg, IDC_CHUNK_SIZE))
60 if (IsWindowEnabled ((HWND)lp))
62 static HBRUSH hbrStatic = CreateSolidBrush (GetSysColor (COLOR_WINDOW));
63 SetTextColor ((HDC)wp, GetSysColor (COLOR_WINDOWTEXT));
64 SetBkColor ((HDC)wp, GetSysColor (COLOR_WINDOW));
65 return (BOOL)hbrStatic;
74 Diag_DlgProc (hDlg, WM_HELP, 0, 0);
88 WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_ADVANCED_DIAG);
95 static void SetUpYesNoCombo(HWND hDlg, UINT nCtrlID, BOOL fInitialSetting)
97 static TCHAR szYes[10] = TEXT("");
98 static TCHAR szNo[10] = TEXT("");
101 GetString (szYes, IDS_YES);
102 GetString (szNo, IDS_NO);
105 HWND hCombo = GetDlgItem(hDlg, nCtrlID);
107 // Always add szNo first so it has index 0 and szYes has index 1
108 CB_AddItem (hCombo, szNo, 0);
109 CB_AddItem (hCombo, szYes, 0);
111 CB_SetSelected (hCombo, fInitialSetting);
114 void Diag_OnInitDialog (HWND hDlg)
117 Config_GetTraceBufferSize(&g.Configuration.nTraceBufSize);
118 Config_GetTrapOnPanic(&g.Configuration.fTrapOnPanic);
119 Config_GetReportSessionStartups(&g.Configuration.fReportSessionStartups);
121 nTraceBufSize = g.Configuration.nTraceBufSize;
122 fTrapOnPanic = g.Configuration.fTrapOnPanic;
123 fReportSessionStartups = g.Configuration.fReportSessionStartups;
128 CreateSpinner (GetDlgItem (hDlg, IDC_TRACE_LOG_BUF_SIZE), 10, FALSE, nBUFSIZE_MIN, nTraceBufSize, nBUFSIZE_MAX);
130 SetUpYesNoCombo(hDlg, IDC_TRAP_ON_PANIC, fTrapOnPanic);
131 SetUpYesNoCombo(hDlg, IDC_REPORT_SESSION_STARTUPS, fReportSessionStartups);
135 void Diag_OnOK (HWND hDlg)
137 nTraceBufSize = SP_GetPos (GetDlgItem (hDlg, IDC_TRACE_LOG_BUF_SIZE));
138 fTrapOnPanic = CB_GetSelected (GetDlgItem (hDlg, IDC_TRAP_ON_PANIC));
139 fReportSessionStartups = CB_GetSelected (GetDlgItem (hDlg, IDC_REPORT_SESSION_STARTUPS));
141 EndDialog(hDlg, IDOK);
150 if (nTraceBufSize != g.Configuration.nTraceBufSize) {
151 if (!Config_SetTraceBufferSize (nTraceBufSize))
153 g.Configuration.nTraceBufSize = nTraceBufSize;
156 if (fTrapOnPanic != g.Configuration.fTrapOnPanic) {
157 if (!Config_SetTrapOnPanic (fTrapOnPanic))
159 g.Configuration.fTrapOnPanic = fTrapOnPanic;
162 if (fReportSessionStartups != g.Configuration.fReportSessionStartups) {
163 if (!Config_SetReportSessionStartups (fReportSessionStartups))
165 g.Configuration.fReportSessionStartups = fReportSessionStartups;
172 void Diag_OnCancel(HWND hDlg)
176 EndDialog(hDlg, IDCANCEL);