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"
39 // we use these classes to let plugins draw inside the Radiant windows
40 // 2D window like YZ XZ XY
43 virtual ~IGL2DWindow() = default;
45 // Increment the number of references to this object
46 virtual void IncRef() = 0;
48 // Decrement the reference count
49 virtual void DecRef() = 0;
51 virtual void Draw2D(OpenGLBinding &GL, VIEWTYPE vt) = 0;
57 // Increment the number of references to this object
58 virtual void IncRef() = 0;
60 // Decrement the reference count
61 virtual void DecRef() = 0;
63 virtual void Draw3D() = 0;
66 // a select message with a brush/entity select information
67 class CSelectMsg : public ISAXHandler {
68 enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState;
69 StringOutputStream message;
70 StringOutputStream brush;
73 { ESelectState = SELECT_MESSAGE; }
76 void saxStartElement(message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
78 void saxEndElement(message_info_t *ctx, const xmlChar *name);
80 void saxCharacters(message_info_t *ctx, const xmlChar *ch, int len);
82 // for use in the dialog window
84 { return message.c_str(); }
86 IGL2DWindow *Highlight();
92 class CPointMsg : public ISAXHandler, public IGL2DWindow {
93 enum { POINT_MESSAGE, POINT_POINT } EPointState;
94 StringOutputStream message;
95 StringOutputStream point;
101 EPointState = POINT_MESSAGE;
111 void saxStartElement(message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
113 void saxEndElement(message_info_t *ctx, const xmlChar *name);
115 void saxCharacters(message_info_t *ctx, const xmlChar *ch, int len);
117 // for use in the dialog window
118 const char *getName()
119 { return message.c_str(); }
121 IGL2DWindow *Highlight();
123 void DropHighlight();
125 // IGL2DWindow interface --------------------------------
126 // Increment the number of references to this object
130 // Decrement the reference count
139 void Draw2D(OpenGLBinding &GL, VIEWTYPE vt);
142 class CWindingMsg : public ISAXHandler, public IGL2DWindow {
143 enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;
144 StringOutputStream message;
145 StringOutputStream winding;
152 EPointState = WINDING_MESSAGE;
163 void saxStartElement(message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
165 void saxEndElement(message_info_t *ctx, const xmlChar *name);
167 void saxCharacters(message_info_t *ctx, const xmlChar *ch, int len);
169 // for use in the dialog window
170 const char *getName()
171 { return message.c_str(); }
173 IGL2DWindow *Highlight();
175 void DropHighlight();
177 // IGL2DWindow interface --------------------------------
178 // Increment the number of references to this object
182 // Decrement the reference count
191 void Draw2D(OpenGLBinding &GL, VIEWTYPE vt);
195 class CDbgDlg : public Dialog {
196 GPtrArray *m_pFeedbackElements;
197 // the list widget we use in the dialog
198 ui::ListStore m_clist{ui::null};
199 ISAXHandler *m_pHighlight;
200 IGL2DWindow *m_pDraw2D;
204 m_pFeedbackElements = g_ptr_array_new();
210 void Push(ISAXHandler *);
212 // clean the debug window, release all ISAXHanlders we have
215 ISAXHandler *GetElement(std::size_t row);
217 void SetHighlight(gint row);
219 void DropHighlight();
221 void draw2D(OpenGLBinding &GL, VIEWTYPE viewType)
223 if (m_pDraw2D != 0) {
224 m_pDraw2D->Draw2D(GL, viewType);
236 ui::Window BuildDialog();
239 extern CDbgDlg g_DbgDlg;
241 void Feedback_draw2D(OpenGLBinding &GL, VIEWTYPE viewType);