Counter Strike : Global Offensive Source Code
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.

108 lines
3.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include <stdafx.h>
  8. #include <tier2/tier2.h>
  9. #include "FadeDlg.h"
  10. #include "Options.h"
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include <tier0/memdbgon.h>
  13. //=============================================================================
  14. //
  15. // Fade Dialog Functions
  16. //
  17. BEGIN_MESSAGE_MAP( CFadeDlg, CDialog)
  18. //{{AFX_MSG_MAP(CFadeDlg)
  19. ON_BN_CLICKED( IDC_BUTTON_FADE_LOW, OnButtonFadeLow )
  20. ON_BN_CLICKED( IDC_BUTTON_FADE_MED, OnButtonFadeMed )
  21. ON_BN_CLICKED( IDC_BUTTON_FADE_HIGH, OnButtonFadeHigh )
  22. ON_BN_CLICKED( IDC_BUTTON_FADE_360, OnButtonFade360 )
  23. ON_BN_CLICKED( IDC_BUTTON_FADE_LEVEL, OnButtonFadeLevel )
  24. //}}AFX_MSG_MAP
  25. END_MESSAGE_MAP()
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Constructor
  28. //-----------------------------------------------------------------------------
  29. CFadeDlg::CFadeDlg( CWnd *pParent ) : CDialog( CFadeDlg::IDD, pParent )
  30. {
  31. Options.view3d.nFadeMode = FADE_MODE_NONE;
  32. }
  33. //-----------------------------------------------------------------------------
  34. // Purpose:
  35. //-----------------------------------------------------------------------------
  36. BOOL CFadeDlg::OnInitDialog()
  37. {
  38. if ( m_pParentWnd )
  39. {
  40. CRect dialogRect;
  41. GetWindowRect( &dialogRect );
  42. CRect toolbarRect;
  43. CToolBar *pToolBar = static_cast<CToolBar*>( m_pParentWnd );
  44. pToolBar->GetWindowRect( &toolbarRect );
  45. CRect buttonRect;
  46. pToolBar->GetToolBarCtrl().GetRect( ID_VIEW_PREVIEW_MODEL_FADE, &buttonRect );
  47. int nLeft = toolbarRect.left + buttonRect.left + ( buttonRect.Width() / 2 );
  48. int nTop = toolbarRect.top + buttonRect.top + ( buttonRect.Height() / 2 ) ;
  49. ::SetWindowPos( m_hWnd, HWND_TOP, nLeft, nTop, dialogRect.Width(), dialogRect.Height(), SWP_NOCOPYBITS );
  50. }
  51. return TRUE;
  52. }
  53. //-----------------------------------------------------------------------------
  54. // Purpose:
  55. //-----------------------------------------------------------------------------
  56. void CFadeDlg::OnButtonFadeLow( void )
  57. {
  58. Options.view3d.nFadeMode = FADE_MODE_LOW;
  59. OnOK();
  60. }
  61. //-----------------------------------------------------------------------------
  62. // Purpose:
  63. //-----------------------------------------------------------------------------
  64. void CFadeDlg::OnButtonFadeMed( void )
  65. {
  66. Options.view3d.nFadeMode = FADE_MODE_MED;
  67. OnOK();
  68. }
  69. //-----------------------------------------------------------------------------
  70. // Purpose:
  71. //-----------------------------------------------------------------------------
  72. void CFadeDlg::OnButtonFadeHigh( void )
  73. {
  74. Options.view3d.nFadeMode = FADE_MODE_HIGH;
  75. OnOK();
  76. }
  77. //-----------------------------------------------------------------------------
  78. // Purpose:
  79. //-----------------------------------------------------------------------------
  80. void CFadeDlg::OnButtonFade360( void )
  81. {
  82. Options.view3d.nFadeMode = FADE_MODE_360;
  83. OnOK();
  84. }
  85. //-----------------------------------------------------------------------------
  86. // Purpose:
  87. //-----------------------------------------------------------------------------
  88. void CFadeDlg::OnButtonFadeLevel( void )
  89. {
  90. Options.view3d.nFadeMode = FADE_MODE_LEVEL;
  91. OnOK();
  92. }