Planeshift
pawseditorapp.h
Go to the documentation of this file.
1 /*
2 * pawseditorapp.h
3 *
4 * Copyright (C) 2005 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5 *
6 * Credits :
7 * Michael Cummings [Borrillis] <cummings.michael@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation (version 2
12 * of the License).
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Creation Date: 1/20/2005
22 * Description : main class for pawseditor
23 *
24 */
25 
26 #ifndef PAWSEDIT_APP_HEADER
27 #define PAWSEDIT_APP_HEADER
28 
29 #include <csutil/sysfunc.h>
30 #include <csutil/csstring.h>
31 #include <csutil/ref.h>
32 #include <csutil/bitarray.h>
33 #include <csgeom/vector2.h>
34 #include <csgeom/vector3.h>
35 
36 #include "pewidgettree.h"
37 #include "peskinselector.h"
38 #include "util/genericevent.h"
39 
40 struct iEngine;
41 struct iLoader;
42 struct iVFS;
43 struct iEvent;
44 struct iEventQueue;
45 struct iConfigManager;
46 struct iTextureManager;
47 struct iGraphics3D;
48 struct iGraphics2D;
49 struct iView;
50 struct iVirtualClock;
51 struct iMeshWrapper;
52 
53 class PawsManager;
54 class pawsMainWidget;
55 class pawsWidget;
56 class pawsEditor;
57 
58 class psMaterialUtil;
59 
60 class eControlManager;
61 
65 {
66  CAM_NONE = 0,
67 
74 
76 };
77 
78 
80 {
81 public:
82 
83  static const char * CONFIG_FILENAME;
84  static const char * APP_NAME;
85  static const char * WINDOW_CAPTION;
86  static const char * KEY_DEFS_FILENAME;
87 
89 
92  PawsEditorApp(iObjectRegistry *obj_reg);
93 
97 
101  void SevereError(const char* msg);
102 
106  bool Init();
107 
113  bool LoadWidget(const char * file);
114 
118  bool LoadWidgets();
119 
125  bool HandleEvent (iEvent &ev);
126 
131  void SetCamFlag(int flag, bool val);
132 
137  bool GetCamFlag(int flag);
138 
142  csVector2 GetMousePointer();
143 
147  iConfigManager* GetConfigManager();
148 
152  iVFS* GetVFS();
153 
156  void Exit();
157 
158  csPtr<iDocumentNode> ParseWidgetFile( const char* widgetFile );
159  csPtr<iDocumentNode> ParseWidgetFile_mod( const char* widgetFile );
160  void OpenWidget(const csString & text);
161  void ReloadWidget();
162  void OpenImageList(const csString & text);
163  // Load a new skin
164  void LoadSkin( const char* name );
165  void ShowSkinSelector() { skinSelector->Show(); };
166 
167 
168 
169 private:
170 
171  // Used to load a resource from the new skin
172  bool LoadResources( const char* mountPath );
173 
176  void RegisterFactories();
177 
180  void Update();
181 
185  void TakeScreenshot(const csString & fileName);
186 
190  void LoadLogSettings();
191 
193  DeclareGenericEventHandler(EventHandler,PawsEditorApp,"planeshift.pawseditor");
194  csRef<EventHandler> event_handler;
195 
196  iObjectRegistry* object_reg;
197  csRef<iEngine> engine;
198  csRef<iVFS> vfs;
199  csRef<iEventQueue> queue;
200  csRef<iConfigManager> cfgmgr;
201  csRef<iTextureManager> txtmgr;
202  csRef<iGraphics3D> g3d;
203  csRef<iGraphics2D> g2d;
204  csRef<iLoader> loader;
205 
206  // PAWS
207  PawsManager * paws;
208  pawsMainWidget * mainWidget;
209  peWidgetTree * widgetTree;
210  peSkinSelector * skinSelector;
211  //peMenu * menuWindow;
213  bool drawScreen;
214 
215  // camera flags
216  csBitArray camFlags;
217  float camYaw;
218  float camPitch;
219 
220  csString fileName;
221  csString mountedPath;
222  csString mountedVPath;
223  csString currentSkin;
224 
225  csVector2 mousePointer;
226 };
227 
228 #endif
static const char * WINDOW_CAPTION
Definition: pawseditorapp.h:85
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
bool LoadWidget(const char *file)
Loads a single paws widget.
Main PlaneShift Window manager.
Definition: pawsmanager.h:82
void SevereError(const char *msg)
Reports a severe error in the application.
static const char * KEY_DEFS_FILENAME
Definition: pawseditorapp.h:86
void OpenImageList(const csString &text)
csPtr< iDocumentNode > ParseWidgetFile_mod(const char *widgetFile)
bool LoadWidgets()
Loads all the paws widgets (windows)
static const char * APP_NAME
Definition: pawseditorapp.h:84
bool Init()
Initializes some CS specific stuff, fills most of this classes global variables, and inits eedit spec...
pawsWidget * currentWidget
Definition: pawseditorapp.h:88
PawsEditorApp(iObjectRegistry *obj_reg)
Constructor.
csVector2 GetMousePointer()
Gets the location of the mouse pointer.
The main or desktop widget.
iConfigManager * GetConfigManager()
Gets the Configuration Manager.
void Exit()
Exits the application.
bool HandleEvent(iEvent &ev)
Handles an event from the event handler.
void LoadSkin(const char *name)
~PawsEditorApp()
Destructor.
void ShowSkinSelector()
csPtr< iDocumentNode > ParseWidgetFile(const char *widgetFile)
void OpenWidget(const csString &text)
virtual void Show()
Makes widget visible and brings it to the front.
void ReloadWidget()
void SetCamFlag(int flag, bool val)
Sets the given camera flag.
CAM_FLAG
The camera flags.
Definition: eeditapp.h:66
iVFS * GetVFS()
Gets the VFS Manager.
bool GetCamFlag(int flag)
Gets the value of the given camera flag.
static const char * CONFIG_FILENAME
Definition: pawseditorapp.h:83