nt-makefile-clean-targets-20010917
[openafs.git] / src / WINNT / afssvrcfg / file_server_page.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 /*
11  * INCLUDES _________________________________________________________________
12  *
13  */
14 extern "C" {
15 #include <afs/param.h>
16 #include <afs/stds.h>
17 }
18
19 #include "afscfg.h"
20 #include "resource.h"
21
22
23 /*
24  * DEFINITIONS _________________________________________________________________
25  *
26  */
27 static HWND hDlg = 0;
28
29
30 /*
31  * PROTOTYPES _________________________________________________________________
32  *
33  */
34 static void OnInitDialog(HWND hwndDlg);
35 static void ConfigMsg(UINT nMsgID);
36
37
38 /*
39  * EXPORTED FUNCTIONS _________________________________________________________________
40  *
41  */
42
43 /*
44  * Dialog Proc _________________________________________________________________
45  *
46  */
47 BOOL CALLBACK FileServerPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
48 {
49         if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
50                 return FALSE;
51
52         switch (msg) {
53                 case WM_INITDIALOG:
54                  OnInitDialog(hwndDlg);
55                      break;
56
57                 case WM_COMMAND:
58                         switch (LOWORD(wp)) {
59                                 case IDNEXT:
60                                         g_pWiz->SetState(sidSTEP_SIX);
61                                         break;
62
63                                 case IDBACK:
64                                    g_pWiz->SetState(sidSTEP_FOUR);
65                                    break;
66
67                                 case IDC_DONT_CONFIG_FILE_SERVER:
68                                         g_CfgData.configFS = CS_DONT_CONFIGURE;
69                                         break;
70
71                                 case IDC_SHOULD_CONFIG_FILE_SERVER:
72                                         g_CfgData.configFS = CS_CONFIGURE;
73                                         break;
74                         }
75                 break;
76
77         }
78
79         return FALSE;
80 }
81
82
83 /*
84  * STATIC FUNCTIONS _________________________________________________________________
85  *
86  */
87
88 /*
89  * Event Handler Functions _________________________________________________________________
90  *
91  */
92 static void OnInitDialog(HWND hwndDlg)
93 {
94         hDlg = hwndDlg;
95
96         g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
97         g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
98         g_pWiz->SetDefaultControl(IDNEXT);
99
100         if (g_CfgData.bFirstServer) {
101                 ConfigMsg(IDS_MUST_CONFIG_FS);
102                 g_CfgData.configFS = CS_CONFIGURE;
103                 return;
104         }
105
106         switch (g_CfgData.configFS) {
107                 case CS_ALREADY_CONFIGURED:
108                         ConfigMsg(IDS_ALREADY_A_FS_SERVER);
109                         break;
110
111                 case CS_DONT_CONFIGURE:
112                         SetCheck(hDlg, IDC_DONT_CONFIG_FILE_SERVER);
113                         break;
114
115                 case CS_CONFIGURE:
116                 default:
117                         SetCheck(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER);
118                         break;
119         }
120 }
121
122
123 /*
124  * Utility Functions _________________________________________________________________
125  *
126  */
127 static void ConfigMsg(UINT nMsgID)
128 {
129         TCHAR szMsg[cchRESOURCE];
130
131         GetString(szMsg, nMsgID);
132
133         // Hide the controls that are at the same position as the message
134         ShowWnd(hDlg, IDC_CREATE_FS_QUESTION, FALSE);
135         ShowWnd(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER, FALSE);
136         ShowWnd(hDlg, IDC_DONT_CONFIG_FILE_SERVER, FALSE);
137         
138         SetWndText(hDlg, IDC_MSG, szMsg);
139         ShowWnd(hDlg, IDC_MSG);
140 }
141