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"
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; }
92 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
93 void saxEndElement( message_info_t *ctx, const xmlChar *name );
94 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
95 // for use in the dialog window
96 const char* getName() { return message.c_str(); }
97 IGL2DWindow* Highlight();
100 // IGL2DWindow interface --------------------------------
101 // Increment the number of references to this object
102 void IncRef() { refCount++; }
103 // Decrement the reference count
105 refCount--; if ( refCount <= 0 ) {
109 void Draw2D( VIEWTYPE vt );
112 class CWindingMsg : public ISAXHandler, public IGL2DWindow
114 enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;
115 StringOutputStream message;
116 StringOutputStream winding;
121 CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; }
126 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
127 void saxEndElement( message_info_t *ctx, const xmlChar *name );
128 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
129 // for use in the dialog window
130 const char* getName() { return message.c_str(); }
131 IGL2DWindow* Highlight();
132 void DropHighlight();
134 // IGL2DWindow interface --------------------------------
135 // Increment the number of references to this object
136 void IncRef() { refCount++; }
137 // Decrement the reference count
139 refCount--; if ( refCount <= 0 ) {
143 void Draw2D( VIEWTYPE vt );
146 typedef struct _GtkListStore GtkListStore;
148 class CDbgDlg : public Dialog
150 GPtrArray *m_pFeedbackElements;
151 // the list widget we use in the dialog
152 GtkListStore* m_clist;
153 ISAXHandler *m_pHighlight;
154 IGL2DWindow* m_pDraw2D;
157 m_pFeedbackElements = g_ptr_array_new();
162 void Push( ISAXHandler * );
163 // clean the debug window, release all ISAXHanlders we have
165 ISAXHandler *GetElement( std::size_t row );
166 void SetHighlight( gint row );
167 void DropHighlight();
168 void draw2D( VIEWTYPE viewType ){
169 if ( m_pDraw2D != 0 ) {
170 m_pDraw2D->Draw2D( viewType );
173 void destroyWindow(){
174 if ( GetWidget() != 0 ) {
180 GtkWindow* BuildDialog();
183 extern CDbgDlg g_DbgDlg;
185 void Feedback_draw2D( VIEWTYPE viewType );