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.

758 lines
27 KiB

  1. #include "precomp.h"
  2. #include "resource.h"
  3. #include <algorithm>
  4. #include "global.h"
  5. #include "PropPg.h"
  6. #include "SetSht.h"
  7. #include "WndProcs.h"
  8. #include "nmakwiz.h"
  9. #include "nmakreg.h"
  10. #include <common.h>
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////
  12. // Static member vars
  13. CSettingsSheet* CSettingsSheet::ms_pSettingsSheet = NULL;
  14. // This is a map to keep track of the PropertyDataWindows
  15. /* static */ map<UINT, HWND> CSettingsSheet::ms_FocusList;
  16. /* static */ map< UINT, CPropertyDataWindow2* > CSettingsSheet::ms_PropertyWindows;
  17. /* static */ list< UINT > CSettingsSheet::ms_CategoryIDList;
  18. ////////////////////////////////////////////////////////////////////////////////////////////////////
  19. // Static member fns
  20. /* static */ BOOL APIENTRY CSettingsSheet::DlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) {
  21. BOOL bRetval;
  22. NMHDR FAR* pnmhdr;
  23. switch( message ) {
  24. case WM_INITDIALOG:
  25. ms_pSettingsSheet->m_hWndDlg = hDlg;
  26. ms_pSettingsSheet->_InitWindows();
  27. ms_pSettingsSheet->PrepSettings();
  28. ms_pSettingsSheet->_SetButtons();
  29. return TRUE;
  30. case WM_CHAR:
  31. case WM_KEYDOWN:
  32. return FALSE;
  33. case WM_NOTIFY:
  34. pnmhdr = reinterpret_cast< NMHDR FAR* >( lParam );
  35. switch( pnmhdr -> code ) {
  36. case PSN_QUERYCANCEL:
  37. SetWindowLong( hDlg, DWL_MSGRESULT, !VerifyExitMessageBox());
  38. return TRUE;
  39. break;
  40. case PSN_SETACTIVE:
  41. g_hwndActive = hDlg;
  42. ms_pSettingsSheet->_SetButtons();
  43. return TRUE;
  44. break;
  45. case PSN_WIZNEXT:
  46. if( !ms_pSettingsSheet -> _IsDataValid() )
  47. {
  48. SetWindowLong( hDlg, DWL_MSGRESULT, -1);
  49. }
  50. return TRUE;
  51. break;
  52. case PSN_WIZBACK:
  53. {
  54. int iRet = NmrkMessageBox(MAKEINTRESOURCE(IDS_ERASE_ALL_SETTINGS),
  55. NULL, MB_YESNO | MB_ICONQUESTION );
  56. if( IDNO == iRet )
  57. {
  58. SetWindowLong( hDlg, DWL_MSGRESULT, -1 );
  59. }
  60. return TRUE;
  61. break;
  62. }
  63. }
  64. break;
  65. default:
  66. break;
  67. }
  68. return FALSE;
  69. }
  70. /* static */ bool CSettingsSheet::IsGateKeeperModeSelected(void)
  71. {
  72. bool bRet = false;
  73. if( ms_pSettingsSheet )
  74. {
  75. if( ms_pSettingsSheet->GetCategoryCheck( IDC_SET_CALLING_OPTIONS ) )
  76. {
  77. if( ms_pSettingsSheet->GetCheckData( IDC_SET_CALLING_OPTIONS, IDC_RADIO_CALLMODE_GATEKEEPER ) )
  78. {
  79. bRet = TRUE;
  80. }
  81. }
  82. }
  83. return bRet;
  84. }
  85. ////////////////////////////////////////////////////////////////////////////////////////////////////
  86. // Member fns
  87. CSettingsSheet::CSettingsSheet( void )
  88. : m_PropertySheetPage( MAKEINTRESOURCE( IDD_PROPPAGE_DEFAULT ),
  89. ( DLGPROC ) CSettingsSheet::DlgProc ),
  90. m_uPropWndShowing( 0 )
  91. {
  92. if( NULL == ms_pSettingsSheet ) { ms_pSettingsSheet = this; }
  93. }
  94. CSettingsSheet::~CSettingsSheet( void )
  95. {
  96. _KillPropertyDataWindows();
  97. }
  98. void CSettingsSheet::SetFocus( UINT catID )
  99. {
  100. map< UINT, HWND >::iterator I = ms_FocusList.find( catID );
  101. if( I != ms_FocusList.end() )
  102. {
  103. ::SetFocus( (*I).second );
  104. }
  105. }
  106. // Allocates the memory needed!!!
  107. // User must dealloc
  108. LPTSTR CSettingsSheet::GetStringData( UINT idCategory, UINT idEdit, LPTSTR *sz )
  109. {
  110. *sz = NULL;
  111. map< UINT, CPropertyDataWindow2* >::iterator I = ms_PropertyWindows . find( idCategory );
  112. if( ms_PropertyWindows . end() != I )
  113. {
  114. ULONG uLen = ( *I ) . second -> GetEditDataLen( idEdit );
  115. if( !uLen )
  116. {
  117. return NULL;
  118. }
  119. *sz = new TCHAR[ uLen + 1];
  120. ( *I ) . second -> GetEditData( idEdit, *sz, uLen + 1 );
  121. return *sz;
  122. }
  123. return NULL;
  124. }
  125. BOOL CSettingsSheet::SetCheckData( UINT idCategory, UINT idCheck, BOOL bSet )
  126. {
  127. map< UINT, CPropertyDataWindow2* >::iterator I = ms_PropertyWindows . find( idCategory );
  128. if( ms_PropertyWindows . end() != I ) {
  129. ( *I ) . second -> SetCheck( idCheck, bSet );
  130. return TRUE;
  131. }
  132. return FALSE;
  133. }
  134. BOOL CSettingsSheet::GetCheckData( UINT idCategory, UINT idCheck )
  135. {
  136. if( FALSE == m_pCategoryList -> GetCheck( idCategory ) ) {
  137. return FALSE;
  138. }
  139. map< UINT, CPropertyDataWindow2* >::iterator I = ms_PropertyWindows . find( idCategory );
  140. if( ms_PropertyWindows . end() != I ) {
  141. return ( *I ) . second -> GetCheck( idCheck );
  142. }
  143. return FALSE;
  144. }
  145. void CSettingsSheet::EnableWindow( UINT idCategory, BOOL bShow )
  146. {
  147. map< UINT, CPropertyDataWindow2* >::iterator I = ms_PropertyWindows . find( idCategory );
  148. if( ms_PropertyWindows . end() != I ) {
  149. ( *I ) . second -> EnableWindow( bShow );
  150. }
  151. else
  152. {
  153. OutputDebugString( TEXT("Error in CSettingsSheet::EnableWindow") );
  154. }
  155. }
  156. BOOL CSettingsSheet::IsShowing( UINT idCategory )
  157. {
  158. return( idCategory == m_uPropWndShowing );
  159. }
  160. void CSettingsSheet::ShowWindow( UINT idCategory, BOOL bShow )
  161. {
  162. map< UINT, CPropertyDataWindow2* >::iterator I = ms_PropertyWindows . find( idCategory );
  163. if( ms_PropertyWindows . end() != I ) {
  164. if( 0 != m_uPropWndShowing )
  165. {
  166. map< UINT, CPropertyDataWindow2* >::iterator it = ms_PropertyWindows . find( m_uPropWndShowing );
  167. (*it).second-> ShowWindow( FALSE );
  168. SetWindowLong( GetDlgItem( m_pCategoryList->GetHwnd(), m_uPropWndShowing), GWL_USERDATA, 0 );
  169. }
  170. ( *I ) . second -> ShowWindow( bShow );
  171. m_uPropWndShowing = idCategory;
  172. }
  173. }
  174. void CSettingsSheet::ShowWindow( HWND hWnd, BOOL bShow )
  175. {
  176. ShowWindow( GetWindowLong( hWnd, GWL_ID ), bShow );
  177. }
  178. void CSettingsSheet::_KillPropertyDataWindows( void )
  179. {
  180. map< UINT, CPropertyDataWindow2* >::iterator I = ms_PropertyWindows . begin();
  181. while( I != ms_PropertyWindows . end() ) {
  182. delete ( *I ) . second;
  183. I++;
  184. }
  185. ms_PropertyWindows . erase( ms_PropertyWindows . begin(), ms_PropertyWindows . end() );
  186. // TODO - This is being deleted else where... I should find where
  187. // delete m_pCategoryList;
  188. }
  189. BOOL CSettingsSheet::_InitWindows(void)
  190. {
  191. int iTotal = 9;
  192. int iFractionTop = 4;
  193. RECT rect;
  194. GetClientRect( m_hWndDlg, &rect );
  195. int iWidth = rect.right - CPropertyDataWindow2::mcs_iLeft -
  196. CPropertyDataWindow2::mcs_iBorder;
  197. int iHeight = MulDiv( (rect.bottom - CPropertyDataWindow2::mcs_iBorder ), iFractionTop, iTotal );
  198. m_pCategoryList = new CPropertyDataWindow2( m_hWndDlg,
  199. IDD_CATEGORY_LIST,
  200. TEXT("IDD_CATEGORY_LIST"),
  201. CatListWndProc,
  202. 0,
  203. CPropertyDataWindow2::mcs_iLeft,
  204. CPropertyDataWindow2::mcs_iTop,
  205. iWidth,
  206. iHeight
  207. );
  208. m_pCategoryList -> ShowWindow( TRUE );
  209. if( !_AddPropertyDataWindows( CPropertyDataWindow2::mcs_iLeft,
  210. CPropertyDataWindow2::mcs_iTop + iHeight + CPropertyDataWindow2::mcs_iBorder,
  211. iWidth,
  212. MulDiv( (rect.bottom - CPropertyDataWindow2::mcs_iBorder ), iTotal - iFractionTop, iTotal ) ) )
  213. {
  214. return FALSE;
  215. }
  216. return TRUE;
  217. }
  218. void CSettingsSheet::PrepSettings()
  219. {
  220. if (g_pWiz->m_IntroSheet.GetFilePane()->OptionEnabled())
  221. {
  222. _ReadSettings();
  223. }
  224. else
  225. {
  226. m_pCategoryList->Reset();
  227. for( map< UINT, CPropertyDataWindow2* >::const_iterator it = ms_PropertyWindows.begin();
  228. it != ms_PropertyWindows.end();
  229. it++ )
  230. {
  231. (*it).second->Reset();
  232. }
  233. }
  234. }
  235. void CSettingsSheet::_ReadSettings()
  236. {
  237. for( map< UINT, CPropertyDataWindow2* >::const_iterator it = ms_PropertyWindows.begin();
  238. it != ms_PropertyWindows.end();
  239. it++ )
  240. {
  241. (*it).second->ReadSettings();
  242. }
  243. m_pCategoryList->ReadSettings();
  244. for( list< UINT >::const_iterator i = ms_CategoryIDList.begin();
  245. i != ms_CategoryIDList.end();
  246. i++ )
  247. {
  248. if( GetCategoryCheck( *i ) )
  249. {
  250. ms_PropertyWindows[ *i ]->EnableWindow( TRUE );
  251. }
  252. }
  253. }
  254. void CSettingsSheet::WriteSettings()
  255. {
  256. for( map< UINT, CPropertyDataWindow2* >::const_iterator it = ms_PropertyWindows.begin();
  257. it != ms_PropertyWindows.end();
  258. it++ )
  259. {
  260. (*it).second->WriteSettings();
  261. }
  262. m_pCategoryList->WriteSettings();
  263. }
  264. void CSettingsSheet::WriteToINF( HANDLE hFile )
  265. {
  266. CPropertyDataWindow2::MapControlsToRegKeys();
  267. _INFComment( hFile, TEXT("Categories") );
  268. m_pCategoryList->WriteToINF( hFile, TRUE );
  269. for( map< UINT, CPropertyDataWindow2* >::const_iterator it = ms_PropertyWindows.begin();
  270. it != ms_PropertyWindows.end();
  271. it++ )
  272. {
  273. {
  274. HWND hwnd = GetDlgItem( m_pCategoryList->GetHwnd(), (*it).first );
  275. int iLen = Button_GetTextLength( hwnd ) + 1;
  276. LPTSTR szButtonText = new TCHAR[ iLen ];
  277. Button_GetText( hwnd, szButtonText, iLen );
  278. _INFComment( hFile, szButtonText );
  279. delete [] szButtonText;
  280. }
  281. (*it).second->WriteToINF( hFile, GetCategoryCheck( (*it).first ) );
  282. }
  283. }
  284. BOOL CSettingsSheet::_INFComment( HANDLE hFile, LPCTSTR sz )
  285. {
  286. #if _NMAKUSEINFCOMMENTS
  287. DWORD dwWritten;
  288. WriteFile( hFile, (void *)TEXT(";;"), lstrlen( TEXT(";;") ), &dwWritten, NULL );
  289. WriteFile( hFile, (void *)sz, lstrlen( sz ), &dwWritten, NULL );
  290. return WriteFile( hFile, (void *)TEXT("\r\n"), lstrlen( TEXT("\r\n") ), &dwWritten, NULL );
  291. #else
  292. return 0;
  293. #endif
  294. }
  295. BOOL CSettingsSheet::_AddPropertyDataWindows( int iX, int iY, int iWidth, int iHeight )
  296. {
  297. UINT ItemID;
  298. CPropertyDataWindow2* pPropDataWnd;
  299. _KillPropertyDataWindows();
  300. //
  301. // CALLING
  302. //
  303. ////////
  304. ItemID = IDC_SET_CALLING_OPTIONS;
  305. m_pCategoryList->SetEnableListID( 1, ItemID );
  306. ms_CategoryIDList.push_front( ItemID );
  307. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  308. IDD_SET_CALLING_OPTIONS, TEXT("IDD_SET_CALLING_OPTIONS"),
  309. 0, iX, iY, iWidth, iHeight );
  310. {
  311. // Calling method radio buttons
  312. HWND hwnd;
  313. // DIRECT radio item is default CALLING_MODE
  314. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_CALLMODE_DIRECT );
  315. SetWindowLong( hwnd, GWL_USERDATA, CALLING_MODE_DIRECT );
  316. Button_SetCheck(hwnd, BST_CHECKED);
  317. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_CALLMODE_GATEKEEPER );
  318. SetWindowLong( hwnd, GWL_USERDATA, CALLING_MODE_GATEKEEPER );
  319. // Netspeed radio buttons
  320. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_NETSPEED_144 );
  321. SetWindowLong( hwnd, GWL_USERDATA, BW_144KBS );
  322. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_NETSPEED_288 );
  323. SetWindowLong( hwnd, GWL_USERDATA, BW_288KBS );
  324. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_NETSPEED_ISDN );
  325. SetWindowLong( hwnd, GWL_USERDATA, BW_ISDN );
  326. // LAN radio item is default NETSPEED
  327. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_NETSPEED_LAN );
  328. SetWindowLong( hwnd, GWL_USERDATA, BW_MOREKBS );
  329. Button_SetCheck(hwnd, BST_CHECKED);
  330. pPropDataWnd->SetEnableListID( 9,
  331. IDC_RADIO_CALLMODE_DIRECT,
  332. IDC_RADIO_CALLMODE_GATEKEEPER,
  333. IDC_CHECK_NOCHANGECALLMODE,
  334. IDC_DISABLE_AUTOACCEPT,
  335. IDC_PERSIST_AUTOACCEPT,
  336. IDC_RADIO_NETSPEED_144,
  337. IDC_RADIO_NETSPEED_288,
  338. IDC_RADIO_NETSPEED_ISDN,
  339. IDC_RADIO_NETSPEED_LAN);
  340. }
  341. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  342. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_CALLMODE_DIRECT );
  343. pPropDataWnd -> EnableWindow( FALSE );
  344. ////////
  345. ItemID = IDC_SET_SECURITY_OPTIONS;
  346. m_pCategoryList->SetEnableListID( 1, ItemID );
  347. ms_CategoryIDList.push_front( ItemID );
  348. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  349. IDD_SECURITY, TEXT("IDD_SECURITY"),
  350. 0, iX, iY, iWidth, iHeight );
  351. {
  352. HWND hwnd;
  353. // DEFAULT radio item is default SECURITY
  354. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_SECURITY_DEFAULT );
  355. SetWindowLong( hwnd, GWL_USERDATA, DEFAULT_POL_SECURITY);
  356. Button_SetCheck(hwnd, BST_CHECKED);
  357. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_SECURITY_REQUIRED );
  358. SetWindowLong( hwnd, GWL_USERDATA, REQUIRED_POL_SECURITY);
  359. hwnd = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_SECURITY_DISABLED );
  360. SetWindowLong( hwnd, GWL_USERDATA, DISABLED_POL_SECURITY);
  361. pPropDataWnd -> SetEnableListID( 5,
  362. IDC_RADIO_SECURITY_DEFAULT,
  363. IDC_RADIO_SECURITY_REQUIRED,
  364. IDC_RADIO_SECURITY_DISABLED,
  365. IDC_REQUIRE_COMPLETE_AUTHENTICATION,
  366. IDC_SET_RDN_FOR_REQUIRED_CA
  367. );
  368. //
  369. // Link Set URL checkbox with edit field
  370. //
  371. {
  372. HWND hwndCond = GetDlgItem(pPropDataWnd->GetHwnd(), IDC_SET_RDN_FOR_REQUIRED_CA);
  373. pPropDataWnd->ConnectControlsToCheck( IDC_SET_RDN_FOR_REQUIRED_CA,
  374. 1,
  375. new CControlID(hwndCond, IDC_SET_RDN_FOR_REQUIRED_CA,
  376. IDC_EDIT_SET_RDN_FOR_REQUIRED_CA,
  377. CControlID::EDIT ) );
  378. }
  379. }
  380. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  381. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_RADIO_SECURITY_DEFAULT );
  382. pPropDataWnd -> EnableWindow( FALSE );
  383. //
  384. // A/V OPTIONS
  385. //
  386. //////////
  387. ItemID = IDC_RESTRICT_THE_USE_OF_AUDIO;
  388. m_pCategoryList->SetEnableListID( 1, ItemID );
  389. ms_CategoryIDList.push_front( ItemID );
  390. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  391. IDD_AUDIO, TEXT("IDD_AUDIO"),
  392. 0, iX, iY, iWidth, iHeight );
  393. pPropDataWnd -> SetEnableListID( 7,
  394. IDC_PREVENT_THE_USER_FROM_USING_AUDIO,
  395. IDC_ENABLE_DIRECT_SOUND,
  396. IDC_NOCHANGE_DIRECT_SOUND,
  397. IDC_DISABLE_FULL_DUPLEX_AUDIO,
  398. IDC_CREATE_AN_AUDIO_LOG_FILE,
  399. IDC_CHECK_MUTE_SPEAKER_BY_DEFAULT,
  400. IDC_CHECK_MUTE_MICROPHONE_BY_DEFAULT
  401. );
  402. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  403. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(),
  404. IDC_PREVENT_THE_USER_FROM_USING_AUDIO );
  405. pPropDataWnd -> EnableWindow( FALSE );
  406. //////////
  407. ItemID = IDC_RESTRICT_THE_USE_OF_VIDEO;
  408. m_pCategoryList->SetEnableListID( 1, ItemID );
  409. ms_CategoryIDList.push_front( ItemID );
  410. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  411. IDD_VIDEO, TEXT("IDD_VIDEO"),
  412. 0, iX, iY, iWidth, iHeight );
  413. pPropDataWnd -> SetEnableListID( 2,
  414. IDC_DISABLE_SENDING_VIDEO,
  415. IDC_DISABLE_RECIEVING_VIDEO );
  416. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  417. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(),
  418. IDC_DISABLE_SENDING_VIDEO );
  419. pPropDataWnd -> EnableWindow( FALSE );
  420. ////////
  421. ItemID = IDC_LIMIT_AV_THROUGHPUT;
  422. m_pCategoryList->SetEnableListID( 1, ItemID );
  423. ms_CategoryIDList.push_front( ItemID );
  424. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  425. IDD_LIMIT_AV_THROUGHPUT, TEXT("IDD_LIMIT_AV_THROUGHPUT"),
  426. RestrictAvThroughputWndProc,
  427. 0, iX, iY, iWidth, iHeight );
  428. {
  429. CControlID *pControl = new CControlID( IDC_SLIDE_AV_THROUGHPUT,
  430. CControlID::SLIDER );
  431. pControl->SetStaticID( IDC_STATIC_MAX_AV_THROUGHPUT );
  432. pPropDataWnd->AddControl( pControl );
  433. }
  434. HWND hwndTrack = GetDlgItem( pPropDataWnd -> GetHwnd(), IDC_SLIDE_AV_THROUGHPUT );
  435. TrackBar_ClearTics(hwndTrack, FALSE);
  436. TrackBar_SetRange(hwndTrack, FALSE, BW_ISDN_BITS / 1000, BW_SLOWLAN_BITS / 1000);
  437. TrackBar_SetTicFreq(hwndTrack, 10, 0);
  438. TrackBar_SetPageSize( hwndTrack, 5);
  439. TrackBar_SetThumbLength( hwndTrack, 5);
  440. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  441. ms_FocusList[ ItemID ] = hwndTrack;
  442. pPropDataWnd -> EnableWindow( FALSE );
  443. //
  444. // TOOLS
  445. //
  446. /////////
  447. ItemID = IDC_DISABLE_CHAT;
  448. m_pCategoryList->SetEnableListID( 1, ItemID );
  449. ms_CategoryIDList.push_front( ItemID );
  450. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  451. IDD_CHAT, TEXT("IDD_CHAT"),
  452. 0, iX, iY, iWidth, iHeight );
  453. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  454. pPropDataWnd -> EnableWindow( FALSE );
  455. //////////
  456. ItemID = IDC_RESTRICT_THE_USE_OF_FILE_TRANSFER;
  457. m_pCategoryList->SetEnableListID( 1, ItemID );
  458. ms_CategoryIDList.push_front( ItemID );
  459. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  460. IDD_FILETRANSFER, TEXT("IDD_FILETRANSFER"),
  461. 0, iX, iY, iWidth, iHeight );
  462. pPropDataWnd -> SetEnableListID( 2,
  463. IDC_PREVENT_THE_USER_FROM_SENDING_FILES,
  464. IDC_PREVENT_THE_USER_FROM_RECEIVING_FILES
  465. );
  466. //
  467. // Link max send size check box to inverse of prevent sending checkbox
  468. //
  469. {
  470. HWND hwndCond = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_MAXIMUM_SIZE_OF_SENT_FILES );
  471. pPropDataWnd -> ConnectControlsToCheck( IDC_MAXIMUM_SIZE_OF_SENT_FILES, 1,
  472. new CControlID( hwndCond,
  473. IDC_MAXIMUM_SIZE_OF_SENT_FILES,
  474. IDC_EDIT_MAXIMUM_SIZE_OF_SENT_FILES,
  475. CControlID::EDIT_NUM ) );
  476. }
  477. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  478. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(),
  479. IDC_PREVENT_THE_USER_FROM_SENDING_FILES );
  480. pPropDataWnd -> EnableWindow( FALSE );
  481. //////////
  482. ItemID = IDC_RESTRICT_THE_USE_OF_SHARING;
  483. m_pCategoryList->SetEnableListID( 1, ItemID );
  484. ms_CategoryIDList.push_front( ItemID );
  485. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  486. IDD_SHARING, TEXT("IDD_SHARING"),
  487. 0, iX, iY, iWidth, iHeight );
  488. pPropDataWnd -> SetEnableListID( 7,
  489. IDC_DISABLE_ALL_SHARING_FEATURES,
  490. IDC_PREVENT_SHARING,
  491. IDC_PREVENT_SHARING_DESKTOP,
  492. IDC_PREVENT_SHARING_TRUECOLOR,
  493. IDC_PREVENT_SHARING_EXPLORER,
  494. IDC_PREVENT_SHARING_DOS,
  495. IDC_PREVENT_SHARING_CONTROL);
  496. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  497. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_DISABLE_ALL_SHARING_FEATURES );
  498. pPropDataWnd -> EnableWindow( FALSE );
  499. ////////
  500. ItemID = IDC_RESTRICT_THE_USE_OF_WHITEBOARD;
  501. m_pCategoryList->SetEnableListID( 1, ItemID );
  502. ms_CategoryIDList.push_front( ItemID );
  503. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  504. IDD_WHITEBOARD, TEXT("IDD_WHITEBOARD"),
  505. 0, iX, iY, iWidth, iHeight );
  506. pPropDataWnd -> SetEnableListID( 2,
  507. IDC_DISABLE_2XWHITEBOARD,
  508. IDC_DISABLE_WHITEBOARD);
  509. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  510. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_DISABLE_2XWHITEBOARD );
  511. pPropDataWnd -> EnableWindow( FALSE );
  512. //////////
  513. ItemID = IDC_RESTRICT_THE_USE_OF_RDS;
  514. m_pCategoryList->SetEnableListID(1, ItemID);
  515. ms_CategoryIDList.push_front( ItemID );
  516. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  517. IDD_RDS, TEXT("IDD_RDS"),
  518. 0, iX, iY, iWidth, iHeight );
  519. pPropDataWnd->SetEnableListID(2,
  520. IDC_DISABLE_RDS_ON_ALL,
  521. IDC_DISABLE_RDS_ON_WIN9X);
  522. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  523. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_DISABLE_RDS_ON_ALL );
  524. pPropDataWnd->EnableWindow(FALSE);
  525. //
  526. // MISCELLANEOUS
  527. //
  528. ////////
  529. ItemID = IDC_RESTRICT_USE_OF_THE_OPTIONS_DIALOG;
  530. m_pCategoryList->SetEnableListID( 1, ItemID );
  531. ms_CategoryIDList.push_front( ItemID );
  532. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  533. IDD_OPTIONS_DIALOG, TEXT("IDD_OPTIONS_DIALOG"),
  534. 0, iX, iY, iWidth, iHeight );
  535. pPropDataWnd -> SetEnableListID( 5,
  536. IDC_DISABLE_THE_GENERAL_OPTIONS_PAGE,
  537. IDC_DISABLE_THE_ADVANCED_CALLING_BUTTON,
  538. IDC_DISABLE_THE_SECURITY_OPTIONS_PAGE,
  539. IDC_DISABLE_THE_AUDIO_OPTIONS_PAGE,
  540. IDC_DISABLE_THE_VIDEO_OPTIONS_PAGE
  541. );
  542. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  543. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(),
  544. IDC_DISABLE_THE_GENERAL_OPTIONS_PAGE );
  545. pPropDataWnd -> EnableWindow( FALSE );
  546. ////////
  547. ItemID = IDC_ONLINE_SUPPORT;
  548. m_pCategoryList->SetEnableListID( 1, ItemID );
  549. ms_CategoryIDList.push_front( ItemID );
  550. pPropDataWnd = new CPropertyDataWindow2( m_hWndDlg,
  551. IDD_ONLINE_SUPPORT, TEXT("IDD_ONLINE_SUPPORT"),
  552. 0, iX, iY, iWidth, iHeight );
  553. {
  554. HWND hwndCond = GetDlgItem( pPropDataWnd->GetHwnd(), IDC_SET_URL_FOR_INTERNAL_SUPPORT_PAGE );
  555. pPropDataWnd -> ConnectControlsToCheck(IDC_SET_URL_FOR_INTERNAL_SUPPORT_PAGE,
  556. 2,
  557. new CControlID(
  558. hwndCond,
  559. IDC_SET_URL_FOR_INTERNAL_SUPPORT_PAGE,
  560. IDC_EDIT_SET_URL_FOR_INTERNAL_SUPPORT_PAGE,
  561. CControlID::EDIT ),
  562. new CControlID(
  563. hwndCond,
  564. IDC_SET_URL_FOR_INTERNAL_SUPPORT_PAGE,
  565. IDC_SHOW_THE_ONLINE_SUPPORT_PAGE_THE_FIRST_TIME_NETMEETING_STARTS,
  566. CControlID::CHECK )
  567. );
  568. }
  569. ms_PropertyWindows[ ItemID ] = pPropDataWnd;
  570. ms_FocusList[ ItemID ] = GetDlgItem( pPropDataWnd->GetHwnd(),
  571. IDC_SET_URL_FOR_INTERNAL_SUPPORT_PAGE );
  572. pPropDataWnd -> EnableWindow( FALSE );
  573. return TRUE;
  574. }
  575. BOOL CSettingsSheet::_IsDataValid( void )
  576. {
  577. // Validate FT Throughput
  578. if( GetCategoryCheck( IDC_RESTRICT_THE_USE_OF_FILE_TRANSFER ) &&
  579. GetCheckData( IDC_RESTRICT_THE_USE_OF_FILE_TRANSFER, IDC_MAXIMUM_SIZE_OF_SENT_FILES ) )
  580. {
  581. if( 0 >= GetDlgItemInt( ms_PropertyWindows[ IDC_RESTRICT_THE_USE_OF_FILE_TRANSFER ]->GetHwnd(),
  582. IDC_EDIT_MAXIMUM_SIZE_OF_SENT_FILES,
  583. NULL,
  584. FALSE ) )
  585. {
  586. NmrkMessageBox(MAKEINTRESOURCE(IDS_FT_THROUGHPUT_VALUE_IS_INVALID),
  587. MAKEINTRESOURCE(IDS_INVALID_DATA_ERROR),
  588. MB_OK | MB_ICONEXCLAMATION);
  589. ShowWindow( IDC_RESTRICT_THE_USE_OF_FILE_TRANSFER, TRUE );
  590. ms_PropertyWindows[ IDC_RESTRICT_THE_USE_OF_FILE_TRANSFER ]->SetFocus( IDC_EDIT_MAXIMUM_SIZE_OF_SENT_FILES );
  591. return FALSE;
  592. }
  593. }
  594. // Validate online support URL
  595. if( GetCategoryCheck( IDC_ONLINE_SUPPORT ) &&
  596. GetCheckData( IDC_ONLINE_SUPPORT, IDC_SET_URL_FOR_INTERNAL_SUPPORT_PAGE ) )
  597. {
  598. LPTSTR sz;
  599. GetStringData( IDC_ONLINE_SUPPORT,
  600. IDC_EDIT_SET_URL_FOR_INTERNAL_SUPPORT_PAGE,
  601. &sz );
  602. if( NULL == sz )
  603. {
  604. delete [] sz;
  605. NmrkMessageBox(MAKEINTRESOURCE(IDS_NETMEETING_HOMEPAGE_IS_INVALID),
  606. MAKEINTRESOURCE(IDS_INVALID_DATA_ERROR), MB_OK | MB_ICONEXCLAMATION);
  607. ShowWindow( IDC_ONLINE_SUPPORT, TRUE );
  608. ms_PropertyWindows[ IDC_ONLINE_SUPPORT ]->SetFocus( IDC_SET_URL_FOR_INTERNAL_SUPPORT_PAGE );
  609. ms_PropertyWindows[ IDC_ONLINE_SUPPORT ]->SetFocus( IDC_EDIT_SET_URL_FOR_INTERNAL_SUPPORT_PAGE );
  610. return FALSE;
  611. }
  612. delete [] sz;
  613. }
  614. return TRUE;
  615. }
  616. int CSettingsSheet::SpewToListBox( HWND hwndList, int iStartLine )
  617. {
  618. HWND hwndCat = m_pCategoryList->GetHwnd();
  619. map< UINT, CPropertyDataWindow2 * >::const_iterator it;
  620. for( it = ms_PropertyWindows.begin(); it != ms_PropertyWindows.end(); it++ )
  621. {
  622. if( GetCategoryCheck( (*it).first ) )
  623. {
  624. HWND hwndButton = GetDlgItem( hwndCat, (*it).first );
  625. int iButtonTextLen = Button_GetTextLength( hwndButton ) + 2;
  626. LPTSTR szButtonText = new TCHAR[ iButtonTextLen ];
  627. Button_GetText( hwndButton, szButtonText, iButtonTextLen -1 );
  628. lstrcat( szButtonText, TEXT(":") );
  629. ListBox_InsertString( hwndList, iStartLine, szButtonText );
  630. iStartLine++;
  631. iStartLine = (*it).second->Spew( hwndList, iStartLine );
  632. }
  633. }
  634. return iStartLine;
  635. }
  636. void CSettingsSheet::_SetButtons( void )
  637. {
  638. DWORD dwFlags = PSWIZB_BACK;
  639. dwFlags |= PSWIZB_NEXT;
  640. PropSheet_SetWizButtons( GetParent( m_hWndDlg ), dwFlags );
  641. }