Planeshift
|
00001 /* 00002 * pawseditorapp.h 00003 * 00004 * Copyright (C) 2005 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * Credits : 00007 * Michael Cummings [Borrillis] <[email protected]> 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * as published by the Free Software Foundation (version 2 00012 * of the License). 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 * 00021 * Creation Date: 1/20/2005 00022 * Description : main class for pawseditor 00023 * 00024 */ 00025 00026 #ifndef PAWSEDIT_APP_HEADER 00027 #define PAWSEDIT_APP_HEADER 00028 00029 #include <csutil/sysfunc.h> 00030 #include <csutil/csstring.h> 00031 #include <csutil/ref.h> 00032 #include <csutil/bitarray.h> 00033 #include <csgeom/vector2.h> 00034 #include <csgeom/vector3.h> 00035 00036 #include "pewidgettree.h" 00037 #include "peskinselector.h" 00038 #include "util/genericevent.h" 00039 00040 struct iEngine; 00041 struct iLoader; 00042 struct iVFS; 00043 struct iEvent; 00044 struct iEventQueue; 00045 struct iConfigManager; 00046 struct iTextureManager; 00047 struct iGraphics3D; 00048 struct iGraphics2D; 00049 struct iView; 00050 struct iVirtualClock; 00051 struct iMeshWrapper; 00052 00053 class PawsManager; 00054 class pawsMainWidget; 00055 class pawsWidget; 00056 class pawsEditor; 00057 00058 class psMaterialUtil; 00059 00060 class eControlManager; 00061 00064 enum CAM_FLAG 00065 { 00066 CAM_NONE = 0, 00067 00068 CAM_UP, 00069 CAM_RIGHT, 00070 CAM_DOWN, 00071 CAM_LEFT, 00072 CAM_FORWARD, 00073 CAM_BACK, 00074 00075 CAM_COUNT 00076 }; 00077 00078 00079 class PawsEditorApp 00080 { 00081 public: 00082 00083 static const char * CONFIG_FILENAME; 00084 static const char * APP_NAME; 00085 static const char * WINDOW_CAPTION; 00086 static const char * KEY_DEFS_FILENAME; 00087 00088 pawsWidget *currentWidget; 00089 00092 PawsEditorApp(iObjectRegistry *obj_reg); 00093 00096 ~PawsEditorApp(); 00097 00101 void SevereError(const char* msg); 00102 00106 bool Init(); 00107 00113 bool LoadWidget(const char * file); 00114 00118 bool LoadWidgets(); 00119 00125 bool HandleEvent (iEvent &ev); 00126 00131 void SetCamFlag(int flag, bool val); 00132 00137 bool GetCamFlag(int flag); 00138 00142 csVector2 GetMousePointer(); 00143 00147 iConfigManager* GetConfigManager(); 00148 00152 iVFS* GetVFS(); 00153 00156 void Exit(); 00157 00158 csPtr<iDocumentNode> ParseWidgetFile( const char* widgetFile ); 00159 csPtr<iDocumentNode> ParseWidgetFile_mod( const char* widgetFile ); 00160 void OpenWidget(const csString & text); 00161 void ReloadWidget(); 00162 void OpenImageList(const csString & text); 00163 // Load a new skin 00164 void LoadSkin( const char* name ); 00165 void ShowSkinSelector() { skinSelector->Show(); }; 00166 00167 00168 00169 private: 00170 00171 // Used to load a resource from the new skin 00172 bool LoadResources( const char* mountPath ); 00173 00176 void RegisterFactories(); 00177 00180 void Update(); 00181 00185 void TakeScreenshot(const csString & fileName); 00186 00190 void LoadLogSettings(); 00191 00193 DeclareGenericEventHandler(EventHandler,PawsEditorApp,"planeshift.pawseditor"); 00194 csRef<EventHandler> event_handler; 00195 00196 iObjectRegistry* object_reg; 00197 csRef<iEngine> engine; 00198 csRef<iVFS> vfs; 00199 csRef<iEventQueue> queue; 00200 csRef<iConfigManager> cfgmgr; 00201 csRef<iTextureManager> txtmgr; 00202 csRef<iGraphics3D> g3d; 00203 csRef<iGraphics2D> g2d; 00204 csRef<iLoader> loader; 00205 00206 // PAWS 00207 PawsManager * paws; 00208 pawsMainWidget * mainWidget; 00209 peWidgetTree * widgetTree; 00210 peSkinSelector * skinSelector; 00211 //peMenu * menuWindow; 00213 bool drawScreen; 00214 00215 // camera flags 00216 csBitArray camFlags; 00217 float camYaw; 00218 float camPitch; 00219 00220 csString fileName; 00221 csString mountedPath; 00222 csString mountedVPath; 00223 csString currentSkin; 00224 00225 csVector2 mousePointer; 00226 }; 00227 00228 #endif