MEOptions.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code 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. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #pragma once
  21. #include "../common/registryoptions.h"
  22. /**
  23. * Wrapper class that is responsible for reading and writing Material Editor
  24. * settings to the registry. Settings are written to
  25. * Software\\id Software\\DOOM3\\Tools\\MaterialEditor
  26. */
  27. class MEOptions {
  28. public:
  29. MEOptions();
  30. ~MEOptions();
  31. bool Save (void);
  32. bool Load (void);
  33. /**
  34. * Sets the flag that determines if the settings need to be saved because
  35. * they where modified.
  36. */
  37. void SetModified(bool mod = true) { modified = mod; };
  38. /**
  39. * Get the flag that determines if the settings need to be saved because
  40. * they where modified.
  41. */
  42. bool GetModified() { return modified; };
  43. void SetWindowPlacement ( const char* name, HWND hwnd );
  44. bool GetWindowPlacement ( const char* name, HWND hwnd );
  45. void SetMaterialTreeWidth(int width);
  46. int GetMaterialTreeWidth();
  47. void SetStageWidth(int width);
  48. int GetStageWidth();
  49. void SetPreviewPropertiesWidth(int width);
  50. int GetPreviewPropertiesWidth();
  51. void SetMaterialEditHeight(int height);
  52. int GetMaterialEditHeight();
  53. void SetMaterialPropHeadingWidth(int width);
  54. int GetMaterialPropHeadingWidth();
  55. void SetPreviewPropHeadingWidth(int width);
  56. int GetPreviewPropHeadingWidth();
  57. protected:
  58. rvRegistryOptions registry;
  59. bool modified;
  60. int materialTreeWidth;
  61. int stageWidth;
  62. int previewPropertiesWidth;
  63. int materialEditHeight;
  64. int materialPropHeadingWidth;
  65. int previewPropHeadingWidth;
  66. };
  67. ID_INLINE void MEOptions::SetWindowPlacement ( const char* name, HWND hwnd ) {
  68. registry.SetWindowPlacement ( name, hwnd );
  69. }
  70. ID_INLINE bool MEOptions::GetWindowPlacement ( const char* name, HWND hwnd ) {
  71. return registry.GetWindowPlacement ( name, hwnd );
  72. }
  73. ID_INLINE void MEOptions::SetMaterialTreeWidth(int width) {
  74. materialTreeWidth = width;
  75. SetModified(true);
  76. }
  77. ID_INLINE int MEOptions::GetMaterialTreeWidth() {
  78. return materialTreeWidth;
  79. }
  80. ID_INLINE void MEOptions::SetStageWidth(int width) {
  81. stageWidth = width;
  82. SetModified(true);
  83. }
  84. ID_INLINE int MEOptions::GetStageWidth() {
  85. return stageWidth;
  86. }
  87. ID_INLINE void MEOptions::SetPreviewPropertiesWidth(int width) {
  88. previewPropertiesWidth = width;
  89. SetModified(true);
  90. }
  91. ID_INLINE int MEOptions::GetPreviewPropertiesWidth() {
  92. return previewPropertiesWidth;
  93. }
  94. ID_INLINE void MEOptions::SetMaterialEditHeight(int height) {
  95. materialEditHeight = height;
  96. SetModified(true);
  97. }
  98. ID_INLINE int MEOptions::GetMaterialEditHeight() {
  99. return materialEditHeight;
  100. }
  101. ID_INLINE void MEOptions::SetMaterialPropHeadingWidth(int width) {
  102. materialPropHeadingWidth = width;
  103. SetModified(true);
  104. }
  105. ID_INLINE int MEOptions::GetMaterialPropHeadingWidth() {
  106. return materialPropHeadingWidth;
  107. }
  108. ID_INLINE void MEOptions::SetPreviewPropHeadingWidth(int width) {
  109. previewPropHeadingWidth = width;
  110. SetModified(true);
  111. }
  112. ID_INLINE int MEOptions::GetPreviewPropHeadingWidth() {
  113. return previewPropHeadingWidth;
  114. }