mainframe.h

Go to the documentation of this file.
00001 /*
00002  Copyright (C) 1999-2006 Id Software, Inc. and contributors.
00003  For a list of contributors, see the accompanying CONTRIBUTORS file.
00004 
00005  This file is part of GtkRadiant.
00006 
00007  GtkRadiant is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation; either version 2 of the License, or
00010  (at your option) any later version.
00011 
00012  GtkRadiant is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with GtkRadiant; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 #if !defined(INCLUDED_MAINFRAME_H)
00023 #define INCLUDED_MAINFRAME_H
00024 
00025 #include "gtkutil/window.h"
00026 #include "gtkutil/idledraw.h"
00027 #include "gtkutil/widget.h"
00028 #include "gtkutil/menu.h"
00029 #include "gtkutil/button.h"
00030 #include "string/string.h"
00031 #include "iundo.h"
00032 
00033 #include "iradiant.h"
00034 
00035 class IPlugin;
00036 class IToolbarButton;
00037 
00038 class XYWnd;
00039 class CamWnd;
00040 
00041 typedef struct _GtkWidget GtkWidget;
00042 typedef struct _GtkWindow GtkWindow;
00043 
00044 const int c_command_status = 0;
00045 const int c_position_status = 1;
00046 const int c_brushcount_status = 2;
00047 const int c_texture_status = 3;
00048 const int c_count_status = 4;
00049 
00050 class UndoSaveStateTracker: public UndoTracker
00051 {
00052         unsigned int m_undoSteps;
00053         unsigned int m_redoSteps;
00054         int m_savedStep;
00055 
00056         void UpdateSensitiveStates (void);
00057         void increaseUndo();
00058         void increaseRedo();
00059         void checkUndoLevel();
00060     public:
00061         UndoSaveStateTracker () :
00062             m_undoSteps(0), m_redoSteps(0), m_savedStep(0)
00063         {
00064         }
00065         void clear ();
00066         void clearRedo ();
00067         void begin ();
00068         void undo ();
00069         void redo ();
00070         void storeState (void);
00071 };
00072 
00073 class MainFrame
00074 {
00075     public:
00077         enum EViewStyle
00078         {
00079             eRegular = 0, 
00080             eSplit = 1
00082         };
00083 
00084         MainFrame ();
00085         ~MainFrame ();
00086 
00087         GtkWindow* m_window;
00088 
00089         std::string m_command_status;
00090         std::string m_position_status;
00091         std::string m_brushcount_status;
00092         std::string m_texture_status;
00093     private:
00094 
00095         void Create ();
00096         void SaveWindowInfo ();
00097         void Shutdown ();
00098 
00099         GtkWidget* m_vSplit;
00100         GtkWidget* m_hSplit;
00101         GtkWidget* m_vSplit2;
00102 
00103         XYWnd* m_pXYWnd;
00104         XYWnd* m_pYZWnd;
00105         XYWnd* m_pXZWnd;
00106         CamWnd* m_pCamWnd;
00107         XYWnd* m_pActiveXY;
00108 
00109         GtkWidget *m_pStatusLabel[c_count_status];
00110 
00111         EViewStyle m_nCurrentStyle;
00112         WindowPositionTracker m_position_tracker;
00113 
00114         IdleDraw m_idleRedrawStatusText;
00115 
00116         GtkButton *m_toolBtnSave;
00117         GtkButton *m_toolBtnUndo;
00118         GtkButton *m_toolBtnRedo;
00119 
00120         GtkMenuItem *m_menuSave;
00121         GtkMenuItem *m_menuUndo;
00122         GtkMenuItem *m_menuRedo;
00123 
00124         UndoSaveStateTracker m_saveStateTracker;
00125 
00126     public:
00127         void SetStatusText (std::string& status_text, const std::string& pText);
00128         void UpdateStatusText ();
00129         void RedrawStatusText ();
00130         typedef MemberCaller<MainFrame, &MainFrame::RedrawStatusText> RedrawStatusTextCaller;
00131 
00132         void SetActiveXY (XYWnd* p);
00133         XYWnd* ActiveXY ()
00134         {
00135             return m_pActiveXY;
00136         }
00137         ;
00138         XYWnd* GetXYWnd ()
00139         {
00140             return m_pXYWnd;
00141         }
00142         XYWnd* GetXZWnd ()
00143         {
00144             return m_pXZWnd;
00145         }
00146         XYWnd* GetYZWnd ()
00147         {
00148             return m_pYZWnd;
00149         }
00150         CamWnd* GetCamWnd ()
00151         {
00152             ASSERT_NOTNULL(m_pCamWnd);
00153             return m_pCamWnd;
00154         }
00155 
00156         EViewStyle CurrentStyle ()
00157         {
00158             return m_nCurrentStyle;
00159         }
00160 
00161         void SetSaveButton (GtkButton *saveBtn)
00162         {
00163             m_toolBtnSave = saveBtn;
00164         }
00165         GtkButton* GetSaveButton ()
00166         {
00167             return m_toolBtnSave;
00168         }
00169 
00170         void SetUndoButton (GtkButton *undoBtn)
00171         {
00172             m_toolBtnUndo = undoBtn;
00173         }
00174         GtkButton* GetUndoButton ()
00175         {
00176             return m_toolBtnUndo;
00177         }
00178 
00179         void SetRedoButton (GtkButton *redoBtn)
00180         {
00181             m_toolBtnRedo = redoBtn;
00182         }
00183         GtkButton* GetRedoButton ()
00184         {
00185             return m_toolBtnRedo;
00186         }
00187 
00188         void SetSaveMenuItem (GtkMenuItem *saveMenuItem)
00189         {
00190             m_menuSave = saveMenuItem;
00191         }
00192         GtkMenuItem* GetSaveMenuItem ()
00193         {
00194             return m_menuSave;
00195         }
00196 
00197         void SetUndoMenuItem (GtkMenuItem *undoMenuItem)
00198         {
00199             m_menuUndo = undoMenuItem;
00200         }
00201         GtkMenuItem* GetUndoMenuItem ()
00202         {
00203             return m_menuUndo;
00204         }
00205 
00206         void SetRedoMenuItem (GtkMenuItem *redoMenuItem)
00207         {
00208             m_menuRedo = redoMenuItem;
00209         }
00210         GtkMenuItem* GetRedoMenuItem ()
00211         {
00212             return m_menuRedo;
00213         }
00214 
00215         void SaveComplete (void);
00216 };
00217 
00218 extern MainFrame* g_pParentWnd;
00219 
00220 GtkWindow* MainFrame_getWindow ();
00221 
00222 enum EMouseButtonMode
00223 {
00224     ETwoButton = 0, EThreeButton = 1,
00225 };
00226 
00227 struct GLWindowGlobals
00228 {
00229         int m_nMouseType;
00230 
00231         GLWindowGlobals () :
00232             m_nMouseType(EThreeButton)
00233         {
00234         }
00235 };
00236 
00237 void GLWindow_Construct ();
00238 void GLWindow_Destroy ();
00239 
00240 extern GLWindowGlobals g_glwindow_globals;
00241 template<typename Value>
00242 class LatchedValue;
00243 typedef LatchedValue<bool> LatchedBool;
00244 extern LatchedBool g_Layout_enableDetachableMenus;
00245 
00246 void deleteSelection ();
00247 
00248 void Sys_Status (const std::string& status);
00249 
00250 void ScreenUpdates_Disable (const std::string& message, const std::string& title);
00251 void ScreenUpdates_Enable ();
00252 bool ScreenUpdates_Enabled ();
00253 void ScreenUpdates_process ();
00254 
00255 class ScopeDisableScreenUpdates
00256 {
00257     public:
00258         ScopeDisableScreenUpdates (const std::string& message, const std::string& title)
00259         {
00260             ScreenUpdates_Disable(message, title);
00261         }
00262         ~ScopeDisableScreenUpdates ()
00263         {
00264             ScreenUpdates_Enable();
00265         }
00266 };
00267 
00268 void EnginePath_Realise ();
00269 void EnginePath_Unrealise ();
00270 
00271 class ModuleObserver;
00272 
00273 void Radiant_attachEnginePathObserver (ModuleObserver& observer);
00274 void Radiant_detachEnginePathObserver (ModuleObserver& observer);
00275 
00276 void Radiant_attachGameToolsPathObserver (ModuleObserver& observer);
00277 void Radiant_detachGameToolsPathObserver (ModuleObserver& observer);
00278 
00279 void EnginePath_verify ();
00280 const std::string& EnginePath_get ();
00281 const std::string& QERApp_GetGamePath ();
00282 
00283 extern std::string g_strCompilerBinaryWithPath;
00284 const std::string& CompilerBinaryWithPath_get ();
00285 
00286 extern std::string g_strAppPath;
00287 const std::string& AppPath_get ();
00288 
00289 const std::string& SettingsPath_get ();
00290 
00291 void Radiant_Initialise ();
00292 void Radiant_Shutdown ();
00293 
00294 void SaveMapAs ();
00295 
00296 void XY_UpdateAllWindows ();
00297 void UpdateAllWindows ();
00298 
00299 void ClipperChangeNotify ();
00300 
00301 void DefaultMode ();
00302 
00303 const std::string& basegame_get ();
00304 const std::string& gamename_get ();
00305 const std::string gamepath_get ();
00306 void gamename_set (const std::string& gamename);
00307 void Radiant_attachGameNameObserver (ModuleObserver& observer);
00308 void Radiant_detachGameNameObserver (ModuleObserver& observer);
00309 void Radiant_attachGameModeObserver (ModuleObserver& observer);
00310 void Radiant_detachGameModeObserver (ModuleObserver& observer);
00311 
00312 void VFS_Construct ();
00313 void VFS_Destroy ();
00314 
00315 void HomePaths_Construct ();
00316 void HomePaths_Destroy ();
00317 void Radiant_attachHomePathsObserver (ModuleObserver& observer);
00318 void Radiant_detachHomePathsObserver (ModuleObserver& observer);
00319 
00320 void MainFrame_Construct ();
00321 void MainFrame_Destroy ();
00322 
00323 SignalHandlerId XYWindowDestroyed_connect (const SignalHandler& handler);
00324 void XYWindowDestroyed_disconnect (SignalHandlerId id);
00325 MouseEventHandlerId XYWindowMouseDown_connect (const MouseEventHandler& handler);
00326 void XYWindowMouseDown_disconnect (MouseEventHandlerId id);
00327 
00328 #endif

Generated by  doxygen 1.6.2