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"
37 // we use these classes to let plugins draw inside the Radiant windows
38 // 2D window like YZ XZ XY
41 virtual ~IGL2DWindow() = default;
43 // Increment the number of references to this object
44 virtual void IncRef() = 0;
46 // Decrement the reference count
47 virtual void DecRef() = 0;
49 virtual void Draw2D(VIEWTYPE vt) = 0;
55 // Increment the number of references to this object
56 virtual void IncRef() = 0;
58 // Decrement the reference count
59 virtual void DecRef() = 0;
61 virtual void Draw3D() = 0;
64 // a select message with a brush/entity select information
65 class CSelectMsg : public ISAXHandler {
66 enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState;
67 StringOutputStream message;
68 StringOutputStream brush;
71 { ESelectState = SELECT_MESSAGE; }
74 void saxStartElement(message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
76 void saxEndElement(message_info_t *ctx, const xmlChar *name);
78 void saxCharacters(message_info_t *ctx, const xmlChar *ch, int len);
80 // for use in the dialog window
82 { return message.c_str(); }
84 IGL2DWindow *Highlight();
90 class CPointMsg : public ISAXHandler, public IGL2DWindow {
91 enum { POINT_MESSAGE, POINT_POINT } EPointState;
92 StringOutputStream message;
93 StringOutputStream point;
99 EPointState = POINT_MESSAGE;
109 void saxStartElement(message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
111 void saxEndElement(message_info_t *ctx, const xmlChar *name);
113 void saxCharacters(message_info_t *ctx, const xmlChar *ch, int len);
115 // for use in the dialog window
116 const char *getName()
117 { return message.c_str(); }
119 IGL2DWindow *Highlight();
121 void DropHighlight();
123 // IGL2DWindow interface --------------------------------
124 // Increment the number of references to this object
128 // Decrement the reference count
137 void Draw2D(VIEWTYPE vt);
140 class CWindingMsg : public ISAXHandler, public IGL2DWindow {
141 enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;
142 StringOutputStream message;
143 StringOutputStream winding;
150 EPointState = WINDING_MESSAGE;
161 void saxStartElement(message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
163 void saxEndElement(message_info_t *ctx, const xmlChar *name);
165 void saxCharacters(message_info_t *ctx, const xmlChar *ch, int len);
167 // for use in the dialog window
168 const char *getName()
169 { return message.c_str(); }
171 IGL2DWindow *Highlight();
173 void DropHighlight();
175 // IGL2DWindow interface --------------------------------
176 // Increment the number of references to this object
180 // Decrement the reference count
189 void Draw2D(VIEWTYPE vt);
193 class CDbgDlg : public Dialog {
194 GPtrArray *m_pFeedbackElements;
195 // the list widget we use in the dialog
196 ui::ListStore m_clist{ui::null};
197 ISAXHandler *m_pHighlight;
198 IGL2DWindow *m_pDraw2D;
202 m_pFeedbackElements = g_ptr_array_new();
208 void Push(ISAXHandler *);
210 // clean the debug window, release all ISAXHanlders we have
213 ISAXHandler *GetElement(std::size_t row);
215 void SetHighlight(gint row);
217 void DropHighlight();
219 void draw2D(VIEWTYPE viewType)
221 if (m_pDraw2D != 0) {
222 m_pDraw2D->Draw2D(viewType);
234 ui::Window BuildDialog();
237 extern CDbgDlg g_DbgDlg;
239 void Feedback_draw2D(VIEWTYPE viewType);