]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/feedback.h
Merge pull request #19 from merlin1991/scons-update
[xonotic/netradiant.git] / radiant / feedback.h
1 /*
2    Copyright (C) 1999-2007 id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
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.
11
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.
16
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
20  */
21
22 //-----------------------------------------------------------------------------
23 //
24 // DESCRIPTION:
25 // classes used for describing geometry information from q3map feedback
26 //
27
28 #ifndef __Q3MAP_FEEDBACK__
29 #define __Q3MAP_FEEDBACK__
30
31 #include "libxml/parser.h"
32
33 // a select message with a brush/entity select information
34 class CSelectMsg : public ISAXHandler
35 {
36 enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState;
37 GString *message;
38 int entitynum, brushnum;
39 public:
40 CSelectMsg() { ESelectState = SELECT_MESSAGE; }
41 // SAX interface
42 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
43 void saxEndElement( message_info_t *ctx, const xmlChar *name );
44 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
45 // for use in the dialog window
46 char *getName() { return message->str; }
47 void Highlight();
48 void DropHighlight() { }
49 };
50
51 class CPointMsg : public ISAXHandler, public IGL2DWindow
52 {
53 enum { POINT_MESSAGE, POINT_POINT } EPointState;
54 GString *message;
55 vec3_t pt;
56 int refCount;
57 public:
58 CPointMsg() { EPointState = POINT_MESSAGE; refCount = 0; }
59 // SAX interface
60 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
61 void saxEndElement( message_info_t *ctx, const xmlChar *name );
62 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
63 // for use in the dialog window
64 char *getName() { return message->str; }
65 void Highlight();
66 void DropHighlight();
67
68 // IGL2DWindow interface --------------------------------
69 // Increment the number of references to this object
70 void IncRef() { refCount++; }
71 // Decrement the reference count
72 void DecRef() {
73         refCount--; if ( refCount <= 0 ) {
74                 delete this;
75         }
76 }
77 void Draw2D( VIEWTYPE vt );
78 };
79
80 class CWindingMsg : public ISAXHandler, public IGL2DWindow
81 {
82 enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;
83 GString *message;
84 vec3_t wt[256];
85 int numpoints;
86 int refCount;
87 public:
88 CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; }
89 // SAX interface
90 void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
91 void saxEndElement( message_info_t *ctx, const xmlChar *name );
92 void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
93 // for use in the dialog window
94 char *getName() { return message->str; }
95 void Highlight();
96 void DropHighlight();
97
98 // IGL2DWindow interface --------------------------------
99 // Increment the number of references to this object
100 void IncRef() { refCount++; }
101 // Decrement the reference count
102 void DecRef() {
103         refCount--; if ( refCount <= 0 ) {
104                 delete this;
105         }
106 }
107 void Draw2D( VIEWTYPE vt );
108 };
109
110 class CDbgDlg : public Dialog
111 {
112 GPtrArray *m_pFeedbackElements;
113 // the list widget we use in the dialog
114 GtkListStore* m_clist;
115 ISAXHandler *m_pHighlight;
116 public:
117 CDbgDlg() { m_pFeedbackElements = g_ptr_array_new(); m_pHighlight = NULL; }
118 virtual ~CDbgDlg() { ClearFeedbackArray(); }
119 // refresh items
120 void          Push( ISAXHandler * );
121 // clean the debug window, release all ISAXHanlders we have
122 void          Init();
123 ISAXHandler   *GetElement( gint row );
124 void          SetHighlight( gint row );
125 void          DropHighlight();
126 protected:
127 void          BuildDialog();
128 void          ClearFeedbackArray();
129 };
130
131 extern CDbgDlg g_DbgDlg;
132
133 #endif