GEApp.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. #ifndef GEAPP_H_
  21. #define GEAPP_H_
  22. #include "../../sys/win32/win_local.h"
  23. #include "../../ui/Rectangle.h"
  24. #include "../../ui/Window.h"
  25. #include "../../ui/UserInterfaceLocal.h"
  26. #ifndef GEOPTIONS_H_
  27. #include "GEOptions.h"
  28. #endif // GEOPTIONS_H_
  29. #ifndef GEWINDOWWRAPPER_H_
  30. #include "GEWindowWrapper.h"
  31. #endif // GEWINDOWWRAPPER_H_
  32. #ifndef GEWORKSPACE_H_
  33. #include "GEWorkspace.h"
  34. #endif // GEWORKSPACE_H_
  35. #ifndef GENAVIGATOR_H_
  36. #include "GENavigator.h"
  37. #endif // GENAVIGATOR_H_
  38. #ifndef GEPROPERTIES_H_
  39. #include "GEProperties.h"
  40. #endif // GEPROPERTIES_H_
  41. #ifndef GETRANSFORMER_H_
  42. #include "GETransformer.h"
  43. #endif // GETRANSFORMER_H_
  44. #ifndef GESTATUSBAR_H_
  45. #include "GEStatusBar.h"
  46. #endif // GESTATUSBAR_H_
  47. // Utility functions
  48. const char *StringFromVec4 ( idVec4& vec );
  49. bool IsExpression ( const char* s );
  50. class rvGEViewer;
  51. class rvGEApp
  52. {
  53. public:
  54. rvGEApp ( );
  55. ~rvGEApp ( );
  56. bool Initialize ( void );
  57. void RunFrame ( void );
  58. // bool Uninitialize ( void );
  59. bool TranslateAccelerator ( LPMSG msg );
  60. rvGEWorkspace* GetActiveWorkspace ( HWND* retwnd = NULL );
  61. rvGENavigator& GetNavigator ( void );
  62. rvGEProperties& GetProperties ( void );
  63. rvGETransformer& GetTransformer ( void );
  64. rvGEOptions& GetOptions ( void );
  65. HINSTANCE GetInstance ( void );
  66. HWND GetMDIFrame ( void );
  67. HWND GetMDIClient ( void );
  68. rvGEStatusBar& GetStatusBar ( void );
  69. bool OpenFile ( const char* filename );
  70. bool SaveFile ( const char* filename );
  71. bool NewFile ( void );
  72. bool IsActive ( void );
  73. void CloseViewer ( void );
  74. int ToolWindowActivate ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
  75. int MessageBox ( const char* text, int flags );
  76. protected:
  77. int HandleCommand ( WPARAM wParam, LPARAM lParam );
  78. int HandleInitMenu ( WPARAM wParam, LPARAM lParam );
  79. void HandleCommandSave ( rvGEWorkspace* workspace, const char* filename );
  80. bool InitRecentFiles ( void );
  81. void UpdateRecentFiles ( void );
  82. HWND mMDIFrame;
  83. HWND mMDIClient;
  84. HINSTANCE mInstance;
  85. rvGEOptions mOptions;
  86. HACCEL mAccelerators;
  87. rvGENavigator mNavigator;
  88. rvGETransformer mTransformer;
  89. rvGEStatusBar mStatusBar;
  90. rvGEProperties mProperties;
  91. HMENU mRecentFileMenu;
  92. int mRecentFileInsertPos;
  93. rvGEViewer* mViewer;
  94. idList<rvGEWorkspace*> mWorkspaces;
  95. idList<HWND> mToolWindows;
  96. private:
  97. static LRESULT CALLBACK FrameWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  98. static LRESULT CALLBACK MDIChildProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  99. };
  100. ID_INLINE bool rvGEApp::IsActive ( void )
  101. {
  102. return mMDIFrame ? true : false;
  103. }
  104. ID_INLINE rvGENavigator& rvGEApp::GetNavigator ( void )
  105. {
  106. return mNavigator;
  107. }
  108. ID_INLINE rvGEProperties& rvGEApp::GetProperties ( void )
  109. {
  110. return mProperties;
  111. }
  112. ID_INLINE rvGETransformer& rvGEApp::GetTransformer ( void )
  113. {
  114. return mTransformer;
  115. }
  116. ID_INLINE rvGEOptions& rvGEApp::GetOptions ( void )
  117. {
  118. return mOptions;
  119. }
  120. ID_INLINE HINSTANCE rvGEApp::GetInstance ( void )
  121. {
  122. return mInstance;
  123. }
  124. ID_INLINE rvGEStatusBar& rvGEApp::GetStatusBar ( void )
  125. {
  126. return mStatusBar;
  127. }
  128. ID_INLINE HWND rvGEApp::GetMDIFrame ( void )
  129. {
  130. return mMDIFrame;
  131. }
  132. ID_INLINE HWND rvGEApp::GetMDIClient ( void )
  133. {
  134. return mMDIClient;
  135. }
  136. extern rvGEApp gApp;
  137. #endif // GEAPP_H_