map.h

Go to the documentation of this file.
00001 
00005 /*
00006  Copyright (C) 1999-2006 Id Software, Inc. and contributors.
00007  For a list of contributors, see the accompanying CONTRIBUTORS file.
00008 
00009  This file is part of GtkRadiant.
00010 
00011  GtkRadiant is free software; you can redistribute it and/or modify
00012  it under the terms of the GNU General Public License as published by
00013  the Free Software Foundation; either version 2 of the License, or
00014  (at your option) any later version.
00015 
00016  GtkRadiant is distributed in the hope that it will be useful,
00017  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  GNU General Public License for more details.
00020 
00021  You should have received a copy of the GNU General Public License
00022  along with GtkRadiant; if not, write to the Free Software
00023  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00024  */
00025 
00026 #if !defined(INCLUDED_MAP_H)
00027 #define INCLUDED_MAP_H
00028 
00029 #include "iscenegraph.h"
00030 #include "generic/callback.h"
00031 #include "signal/signalfwd.h"
00032 #include <string>
00033 
00034 class Map;
00035 extern Map g_map;
00036 
00037 class MapFormat;
00038 
00039 void Map_addValidCallback (Map& map, const SignalHandler& handler);
00040 bool Map_Valid (const Map& map);
00041 
00042 class DeferredDraw
00043 {
00044         Callback m_draw;
00045         bool m_defer;
00046         bool m_deferred;
00047     public:
00048         DeferredDraw (const Callback& draw) :
00049             m_draw(draw), m_defer(false), m_deferred(false)
00050         {
00051         }
00052         void defer ()
00053         {
00054             m_defer = true;
00055         }
00056         void draw ()
00057         {
00058             if (m_defer) {
00059                 m_deferred = true;
00060             } else {
00061                 m_draw();
00062             }
00063         }
00064         void flush ()
00065         {
00066             if (m_defer && m_deferred) {
00067                 m_draw();
00068             }
00069             m_deferred = false;
00070             m_defer = false;
00071         }
00072 };
00073 
00074 inline void DeferredDraw_onMapValidChanged (DeferredDraw& self)
00075 {
00076     if (Map_Valid(g_map)) {
00077         self.flush();
00078     } else {
00079         self.defer();
00080     }
00081 }
00082 typedef ReferenceCaller<DeferredDraw, DeferredDraw_onMapValidChanged> DeferredDrawOnMapValidChangedCaller;
00083 
00084 const std::string& Map_Name (const Map& map);
00085 const MapFormat& Map_getFormat (const Map& map);
00086 bool Map_Unnamed (const Map& map);
00087 
00088 namespace scene
00089 {
00090     class Node;
00091     class Graph;
00092 }
00093 
00094 scene::Node* Map_GetWorldspawn (const Map& map);
00095 scene::Node* Map_FindWorldspawn (Map& map);
00096 scene::Node& Map_FindOrInsertWorldspawn (Map& map);
00097 
00098 template<typename Element> class BasicVector3;
00099 typedef BasicVector3<float> Vector3;
00100 
00101 extern Vector3 region_mins, region_maxs;
00102 
00103 // used to be #defines, multiple engine support suggests we should go towards dynamic
00104 extern float g_MaxWorldCoord;
00105 extern float g_MinWorldCoord;
00106 
00107 void Map_Reload (void);
00108 bool Map_LoadFile (const std::string& filename);
00109 bool Map_SaveFile (const std::string& filename);
00110 
00111 bool Map_ChangeMap (const std::string &dialogTitle, const std::string& newFilename = "");
00112 
00113 void Map_New ();
00114 void Map_Free ();
00115 
00116 void Map_RegionOff ();
00117 
00118 bool Map_SaveRegion (const char* filename);
00119 
00120 class TextInputStream;
00121 class TextOutputStream;
00122 
00123 void Map_ImportSelected (TextInputStream& in, const MapFormat& format);
00124 void Map_ExportSelected (TextOutputStream& out, const MapFormat& format);
00125 
00126 bool Map_Modified (const Map& map);
00127 void Map_SetModified (Map& map, bool modified);
00128 
00129 bool Map_Save ();
00130 bool Map_SaveAs ();
00131 
00132 scene::Node& Node_Clone (scene::Node& node);
00133 
00134 void Scene_parentSelectedBrushesToEntity (scene::Graph& graph, scene::Node& parent);
00135 std::size_t Scene_countSelectedBrushes (scene::Graph& graph);
00136 
00137 void Scene_parentSelected ();
00138 
00139 void OnUndoSizeChanged ();
00140 
00141 void NewMap ();
00142 void OpenMap ();
00143 void ImportMap ();
00144 void SaveMapAs ();
00145 void SaveMap ();
00146 void ExportMap ();
00147 void SaveRegion ();
00148 bool Map_ImportFile (const std::string& filename);
00149 
00150 void Map_Traverse (scene::Node& root, const scene::Traversable::Walker& walker);
00151 
00152 void SelectBrush (int entitynum, int brushnum, int select);
00153 
00154 extern std::string g_strLastMap;
00155 extern bool g_bLoadLastMap;
00156 
00157 void Map_Construct ();
00158 void Map_Destroy ();
00159 
00160 void Map_gatherNamespaced (scene::Node& root);
00161 void Map_mergeClonedNames ();
00162 
00163 const std::string& getMapsPath ();
00164 
00165 namespace map
00166 {
00174     void selectedBrushesSubtractOrigin (const Vector3& origin);
00175 
00181     int countSelectedBrushes();
00182 
00186     bool isUnnamed ();
00187 }
00188 
00189 #endif

Generated by  doxygen 1.6.2