2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 //-----------------------------------------------------------------------------
25 // classes used for describing geometry information from q3map feedback
28 #ifndef __Q3MAP_FEEDBACK__
29 #define __Q3MAP_FEEDBACK__
31 #include "math/vector.h"
32 #include "stream/stringstream.h"
33 #include <glib/gstring.h>
38 // we use these classes to let plugins draw inside the Radiant windows
39 // 2D window like YZ XZ XY
43 // Increment the number of references to this object
44 virtual void IncRef() = 0;
45 // Decrement the reference count
46 virtual void DecRef() = 0;
47 virtual void Draw2D( VIEWTYPE vt ) = 0;
54 // Increment the number of references to this object
55 virtual void IncRef() = 0;
56 // Decrement the reference count
57 virtual void DecRef() = 0;
58 virtual void Draw3D() = 0;
61 // a select message with a brush/entity select information
62 class CSelectMsg : public ISAXHandler
64 enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState;
65 StringOutputStream message;
66 StringOutputStream brush;
68 CSelectMsg() { ESelectState = SELECT_MESSAGE; }
70 void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
71 void saxEndElement (message_info_t *ctx, const xmlChar *name);
72 void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len);
73 // for use in the dialog window
74 const char* getName() { return message.c_str(); }
75 IGL2DWindow* Highlight();
76 void DropHighlight() { }
79 class CPointMsg : public ISAXHandler, public IGL2DWindow
81 enum { POINT_MESSAGE, POINT_POINT } EPointState;
82 StringOutputStream message;
83 StringOutputStream point;
87 CPointMsg() { EPointState = POINT_MESSAGE; refCount = 0; }
93 void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
94 void saxEndElement (message_info_t *ctx, const xmlChar *name);
95 void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len);
96 // for use in the dialog window
97 const char* getName() { return message.c_str(); }
98 IGL2DWindow* Highlight();
101 // IGL2DWindow interface --------------------------------
102 // Increment the number of references to this object
103 void IncRef() { refCount++; }
104 // Decrement the reference count
105 void DecRef() { refCount--; if (refCount <= 0) delete this; }
106 void Draw2D( VIEWTYPE vt );
109 class CWindingMsg : public ISAXHandler, public IGL2DWindow
111 enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;
112 StringOutputStream message;
113 StringOutputStream winding;
118 CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; }
124 void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
125 void saxEndElement (message_info_t *ctx, const xmlChar *name);
126 void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len);
127 // for use in the dialog window
128 const char* getName() { return message.c_str(); }
129 IGL2DWindow* Highlight();
130 void DropHighlight();
132 // IGL2DWindow interface --------------------------------
133 // Increment the number of references to this object
134 void IncRef() { refCount++; }
135 // Decrement the reference count
136 void DecRef() { refCount--; if (refCount <= 0) delete this; }
137 void Draw2D( VIEWTYPE vt );
140 typedef struct _GtkListStore GtkListStore;
142 class CDbgDlg : public Dialog
144 GPtrArray *m_pFeedbackElements;
145 // the list widget we use in the dialog
146 GtkListStore* m_clist;
147 ISAXHandler *m_pHighlight;
148 IGL2DWindow* m_pDraw2D;
152 m_pFeedbackElements = g_ptr_array_new();
157 void Push (ISAXHandler *);
158 // clean the debug window, release all ISAXHanlders we have
160 ISAXHandler *GetElement(std::size_t row);
161 void SetHighlight(gint row);
162 void DropHighlight();
163 void draw2D(VIEWTYPE viewType)
167 m_pDraw2D->Draw2D(viewType);
179 GtkWindow* BuildDialog();
182 extern CDbgDlg g_DbgDlg;
184 void Feedback_draw2D(VIEWTYPE viewType);