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
42 // Increment the number of references to this object
43 virtual void IncRef() = 0;
44 // Decrement the reference count
45 virtual void DecRef() = 0;
46 virtual void Draw2D( VIEWTYPE vt ) = 0;
53 // Increment the number of references to this object
54 virtual void IncRef() = 0;
55 // Decrement the reference count
56 virtual void DecRef() = 0;
57 virtual void Draw3D() = 0;
60 // a select message with a brush/entity select information
61 class CSelectMsg : public ISAXHandler
63 enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState;
64 StringOutputStream message;
65 StringOutputStream brush;
67 CSelectMsg() { ESelectState = SELECT_MESSAGE; }
69 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
70 void saxEndElement( message_info_t *ctx, const xmlChar *name );
71 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
72 // for use in the dialog window
73 const char* getName() { return message.c_str(); }
74 IGL2DWindow* Highlight();
75 void DropHighlight() { }
78 class CPointMsg : public ISAXHandler, public IGL2DWindow
80 enum { POINT_MESSAGE, POINT_POINT } EPointState;
81 StringOutputStream message;
82 StringOutputStream point;
86 CPointMsg() { EPointState = POINT_MESSAGE; refCount = 0; }
91 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
92 void saxEndElement( message_info_t *ctx, const xmlChar *name );
93 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
94 // for use in the dialog window
95 const char* getName() { return message.c_str(); }
96 IGL2DWindow* Highlight();
99 // IGL2DWindow interface --------------------------------
100 // Increment the number of references to this object
101 void IncRef() { refCount++; }
102 // Decrement the reference count
104 refCount--; if ( refCount <= 0 ) {
108 void Draw2D( VIEWTYPE vt );
111 class CWindingMsg : public ISAXHandler, public IGL2DWindow
113 enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;
114 StringOutputStream message;
115 StringOutputStream winding;
120 CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; }
125 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
126 void saxEndElement( message_info_t *ctx, const xmlChar *name );
127 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
128 // for use in the dialog window
129 const char* getName() { return message.c_str(); }
130 IGL2DWindow* Highlight();
131 void DropHighlight();
133 // IGL2DWindow interface --------------------------------
134 // Increment the number of references to this object
135 void IncRef() { refCount++; }
136 // Decrement the reference count
138 refCount--; if ( refCount <= 0 ) {
142 void Draw2D( VIEWTYPE vt );
146 class CDbgDlg : public Dialog
148 GPtrArray *m_pFeedbackElements;
149 // the list widget we use in the dialog
150 ui::ListStore m_clist{ui::null};
151 ISAXHandler *m_pHighlight;
152 IGL2DWindow* m_pDraw2D;
155 m_pFeedbackElements = g_ptr_array_new();
160 void Push( ISAXHandler * );
161 // clean the debug window, release all ISAXHanlders we have
163 ISAXHandler *GetElement( std::size_t row );
164 void SetHighlight( gint row );
165 void DropHighlight();
166 void draw2D( VIEWTYPE viewType ){
167 if ( m_pDraw2D != 0 ) {
168 m_pDraw2D->Draw2D( viewType );
171 void destroyWindow(){
178 ui::Window BuildDialog();
181 extern CDbgDlg g_DbgDlg;
183 void Feedback_draw2D( VIEWTYPE viewType );