GlobalLightOptions.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #if !defined(AFX_GLOBALLIGHTOPTIONS_H__6B56E20C_582E_4030_A251_879097C8853C__INCLUDED_)
  19. #define AFX_GLOBALLIGHTOPTIONS_H__6B56E20C_582E_4030_A251_879097C8853C__INCLUDED_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif // _MSC_VER > 1000
  23. // GLOBALLIGHTOPTIONS.h : header file
  24. //
  25. #include "WBPopupSlider.h"
  26. #include "resource.h"
  27. #include "CButtonShowColor.h"
  28. /////////////////////////////////////////////////////////////////////////////
  29. /// GlobalLightOptions modeless (floating) dialog - allows entry and display of brush width and feather.
  30. #define GLOBALLIGHT_OPTIONS_PANEL_SECTION "LightOptionsWindow"
  31. class GlobalLightOptions : public CDialog , public PopupSliderOwner
  32. {
  33. // Construction
  34. public:
  35. enum {K_TERRAIN=1, K_OBJECTS=2, K_BOTH=3};
  36. enum {K_SUN=0, K_ACCENT1=1, K_ACCENT2=2};
  37. int kUIRedIDs[3];// = {IDC_RD_EDIT, IDC_RD_EDIT1, IDC_RD_EDIT2};
  38. int kUIGreenIDs[3];// = {IDC_GD_EDIT, IDC_GD_EDIT1, IDC_GD_EDIT2};
  39. int kUIBlueIDs[3];// = {IDC_BD_EDIT, IDC_BD_EDIT1, IDC_BD_EDIT2};
  40. CButtonShowColor m_colorButton;
  41. GlobalLightOptions(CWnd* pParent = NULL); // standard constructor
  42. // Dialog Data
  43. //{{AFX_DATA(GlobalLightOptions)
  44. enum { IDD = IDD_GLOBAL_LIGHT_OPTIONS };
  45. // NOTE: the ClassWizard will add data members here
  46. //}}AFX_DATA
  47. // Overrides
  48. // ClassWizard generated virtual function overrides
  49. //{{AFX_VIRTUAL(GlobalLightOptions)
  50. protected:
  51. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  52. //}}AFX_VIRTUAL
  53. // Implementation
  54. protected:
  55. // Generated message map functions
  56. //{{AFX_MSG(GlobalLightOptions)
  57. virtual BOOL OnInitDialog();
  58. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  59. afx_msg void OnMove(int x, int y);
  60. afx_msg void OnChangeFrontBackEdit();
  61. afx_msg void OnChangeLeftRightEdit();
  62. afx_msg void OnChangeColorEdit();
  63. afx_msg void OnRadioEverything();
  64. afx_msg void OnRadioObjects();
  65. afx_msg void OnRadioTerrain();
  66. afx_msg void OnColorPress();
  67. afx_msg void OnResetLights();
  68. afx_msg void OnClose();
  69. virtual void OnOK(){return;}; //!< Modeless dialogs don't OK, so eat this for modeless.
  70. virtual void OnCancel(){return;}; //!< Modeless dialogs don't close on ESC, so eat this for modeless.
  71. //}}AFX_MSG
  72. DECLARE_MESSAGE_MAP()
  73. private:
  74. Real ComponentToPercent(Int component)
  75. {
  76. Real percent;
  77. if (component >= 255) {
  78. return 1.0;
  79. }
  80. if (component <= 0) {
  81. return 0.0;
  82. }
  83. percent = (Real)component/255.0;
  84. return percent;
  85. }
  86. Int PercentToComponent(Real percent)
  87. {
  88. Int component;
  89. if (percent >= 1.0) {
  90. return 255;
  91. }
  92. if (percent <= 0.0) {
  93. return 0;
  94. }
  95. component = (percent * 255.0);
  96. return component;
  97. };
  98. BOOL GetInt(Int ctrlID, Int *rVal);
  99. void PutInt(Int ctrlID, Int val);
  100. protected:
  101. Bool m_updating; ///<true if the ui is updating itself.
  102. WBPopupSliderButton m_frontBackPopup;
  103. WBPopupSliderButton m_leftRightPopup;
  104. WBPopupSliderButton m_frontBackPopupAccent1;
  105. WBPopupSliderButton m_leftRightPopupAccent1;
  106. WBPopupSliderButton m_frontBackPopupAccent2;
  107. WBPopupSliderButton m_leftRightPopupAccent2;
  108. Int m_angleAzimuth[3];
  109. Int m_angleElevation[3];
  110. Int m_lighting;
  111. protected:
  112. void applyAngle(Int lightIndex=0);
  113. void showLightFeedback(Int lightIndex=0);
  114. void applyColor(Int lightIndex=0);
  115. void updateEditFields(void);
  116. void stuffValuesIntoFields(Int lightIndex = 0);
  117. public:
  118. virtual void GetPopSliderInfo(const long sliderID, long *pMin, long *pMax, long *pLineSize, long *pInitial);
  119. virtual void PopSliderChanged(const long sliderID, long theVal);
  120. virtual void PopSliderFinished(const long sliderID, long theVal);
  121. };
  122. //{{AFX_INSERT_LOCATION}}
  123. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  124. #endif // !defined(AFX_GLOBALLIGHTOPTIONS_H__6B56E20C_582E_4030_A251_879097C8853C__INCLUDED_)