Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
6.4 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. /*******************************************************************************
  3. *
  4. * anasidlg.cpp
  5. *
  6. * implementation of CAdvancedNASIDlg dialog class
  7. *
  8. * copyright notice: Copyright 1995, Citrix Systems Inc.
  9. *
  10. * $Author: butchd $ Butch Davis
  11. *
  12. * $Log: N:\NT\PRIVATE\UTILS\CITRIX\WINUTILS\WINCFG\VCS\ANASIDLG.CPP $
  13. *
  14. * Rev 1.2 29 Nov 1995 13:59:40 butchd
  15. * update
  16. *
  17. * Rev 1.1 16 Nov 1995 17:11:30 butchd
  18. * update
  19. *
  20. * Rev 1.0 09 Jul 1995 15:11:08 butchd
  21. * Initial revision.
  22. *
  23. *******************************************************************************/
  24. /*
  25. * include files
  26. */
  27. #include "stdafx.h"
  28. #include "wincfg.h"
  29. #include "anasidlg.h"
  30. #ifdef _DEBUG
  31. #undef THIS_FILE
  32. static char BASED_CODE THIS_FILE[] = __FILE__;
  33. #endif
  34. ////////////////////////////////////////////////////////////////////////////////
  35. // CAdvancedNASIDlg class construction / destruction, implementation
  36. /*******************************************************************************
  37. *
  38. * CAdvancedNASIDlg - CAdvancedNASIDlg constructor
  39. *
  40. * ENTRY:
  41. * EXIT:
  42. * (Refer to MFC CDialog::CDialog documentation)
  43. *
  44. ******************************************************************************/
  45. CAdvancedNASIDlg::CAdvancedNASIDlg()
  46. : CBaseDialog(CAdvancedNASIDlg::IDD)
  47. {
  48. //{{AFX_DATA_INIT(CAdvancedNASIDlg)
  49. // NOTE: the ClassWizard will add member initialization here
  50. //}}AFX_DATA_INIT
  51. } // end CAdvancedNASIDlg::CAdvancedNASIDlg
  52. ////////////////////////////////////////////////////////////////////////////////
  53. // CAdvancedNASIDlg operations
  54. /*******************************************************************************
  55. *
  56. * SetFields - CAdvancedNASIDlg member function: private operation
  57. *
  58. * Set the dialog fields.
  59. *
  60. * ENTRY:
  61. * EXIT:
  62. *
  63. ******************************************************************************/
  64. void
  65. CAdvancedNASIDlg::SetFields()
  66. {
  67. /*
  68. * Set the session type radio button.
  69. */
  70. CheckRadioButton( IDC_NASI_ADVANCED_PRIVATESESSION,
  71. IDC_NASI_ADVANCED_GLOBALSESSION,
  72. IDC_NASI_ADVANCED_PRIVATESESSION +
  73. (m_NASIConfig.GlobalSession ? 1 : 0) );
  74. /*
  75. * Set the File Server and Session Name fields.
  76. */
  77. SetDlgItemText( IDC_NASI_ADVANCED_FILESERVER,
  78. m_NASIConfig.FileServer );
  79. SetDlgItemText( IDC_NASI_ADVANCED_SESSIONNAME,
  80. m_NASIConfig.SessionName );
  81. } // end CAdvancedNASIDlg::SetFields
  82. /*******************************************************************************
  83. *
  84. * GetFields - CAdvancedNASIDlg member function: private operation
  85. *
  86. * Fetch and validate the dialog fields.
  87. *
  88. * ENTRY:
  89. * EXIT:
  90. * (BOOL)
  91. * Returns TRUE if all fields were valid; FALSE otherwise. If FALSE,
  92. * will have output an error message and set the focus back to the
  93. * field in error for the user to correct.
  94. *
  95. ******************************************************************************/
  96. BOOL
  97. CAdvancedNASIDlg::GetFields()
  98. {
  99. m_NASIConfig.GlobalSession =
  100. (BOOLEAN)( IDC_NASI_ADVANCED_PRIVATESESSION -
  101. GetCheckedRadioButton( IDC_NASI_ADVANCED_PRIVATESESSION,
  102. IDC_NASI_ADVANCED_GLOBALSESSION ) );
  103. GetDlgItemText( IDC_NASI_ADVANCED_FILESERVER,
  104. m_NASIConfig.FileServer, lengthof(m_NASIConfig.FileServer) );
  105. GetDlgItemText( IDC_NASI_ADVANCED_SESSIONNAME,
  106. m_NASIConfig.SessionName, lengthof(m_NASIConfig.SessionName) );
  107. /*
  108. * If no Session Name has been entered, output error message and
  109. * reset focus to field for correction.
  110. */
  111. if ( !*m_NASIConfig.SessionName ) {
  112. ERROR_MESSAGE((IDP_INVALID_NASI_SESSIONNAME_EMPTY))
  113. GotoDlgCtrl(GetDlgItem(IDC_NASI_ADVANCED_SESSIONNAME));
  114. return(FALSE);
  115. }
  116. return(TRUE);
  117. } // end CAdvancedNASIDlg::GetFields
  118. ////////////////////////////////////////////////////////////////////////////////
  119. // CAdvancedNASIDlg message map
  120. BEGIN_MESSAGE_MAP(CAdvancedNASIDlg, CBaseDialog)
  121. //{{AFX_MSG_MAP(CAdvancedNASIDlg)
  122. //}}AFX_MSG_MAP
  123. END_MESSAGE_MAP()
  124. ////////////////////////////////////////////////////////////////////////////////
  125. // CAdvancedNASIDlg commands
  126. /*******************************************************************************
  127. *
  128. * OnInitDialog - CAdvancedNASIDlg member function: command (override)
  129. *
  130. * Performs the dialog intialization.
  131. *
  132. * ENTRY:
  133. * EXIT:
  134. * (Refer to CDialog::OnInitDialog documentation)
  135. *
  136. ******************************************************************************/
  137. BOOL
  138. CAdvancedNASIDlg::OnInitDialog()
  139. {
  140. int i;
  141. /*
  142. * Call the parent classes' OnInitDialog to perform default dialog
  143. * initialization.
  144. */
  145. CBaseDialog::OnInitDialog();
  146. /*
  147. * Initalize all dialog fields.
  148. */
  149. SetFields();
  150. if ( m_bReadOnly ) {
  151. /*
  152. * Document is 'read-only': disable all dialog controls and labels
  153. * except for CANCEL & HELP buttons.
  154. */
  155. for ( i=IDL_NASI_ADVANCED_SESSIONTYPE;
  156. i <=IDC_NASI_ADVANCED_SESSIONNAME; i++ )
  157. GetDlgItem(i)->EnableWindow(FALSE);
  158. GetDlgItem(IDOK)->EnableWindow(FALSE);
  159. }
  160. /*
  161. * Limit edit text.
  162. */
  163. ((CEdit *)GetDlgItem(IDC_NASI_ADVANCED_FILESERVER))->
  164. LimitText(NASIFILESERVER_LENGTH);
  165. ((CEdit *)GetDlgItem(IDC_NASI_ADVANCED_SESSIONNAME))->
  166. LimitText(NASISESSIONNAME_LENGTH);
  167. return(TRUE);
  168. } // end CAdvancedNASIDlg::OnInitDialog
  169. /*******************************************************************************
  170. *
  171. * OnOK - CAdvancedNASIDlg member function: command (override)
  172. *
  173. * Read all control contents back into the Async config structure
  174. * before closing the dialog.
  175. *
  176. * ENTRY:
  177. * EXIT:
  178. * (Refer to CDialog::OnOk documentation)
  179. *
  180. ******************************************************************************/
  181. void
  182. CAdvancedNASIDlg::OnOK()
  183. {
  184. /*
  185. * Fetch the field contents. Return (don't close dialog) if a problem
  186. * was found.
  187. */
  188. if ( !GetFields() )
  189. return;
  190. /*
  191. * Call the parent classes' OnOk to complete dialog closing
  192. * and destruction.
  193. */
  194. CBaseDialog::OnOK();
  195. } // end CAdvancedNASIDlg::OnOK
  196. ////////////////////////////////////////////////////////////////////////////////