]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/feedback.h
* added basic code for ufoai plugin (this still needs the pending filter api patch...
[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 () { refCount--; if (refCount <= 0) delete this; }
73         void Draw2D( VIEWTYPE vt );
74 };
75
76 class CWindingMsg : public ISAXHandler, public IGL2DWindow
77 {
78   enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;
79   GString *message;
80   vec3_t wt[256];
81   int numpoints;
82   int refCount;
83 public:
84   CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; }
85   // SAX interface
86   void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);
87   void saxEndElement (message_info_t *ctx, const xmlChar *name);
88   void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len);
89   // for use in the dialog window
90   char *getName() { return message->str; }
91   void Highlight();
92   void DropHighlight();
93
94   // IGL2DWindow interface --------------------------------
95         // Increment the number of references to this object
96   void IncRef () { refCount++; }
97         // Decrement the reference count
98   void DecRef () { refCount--; if (refCount <= 0) delete this; }
99         void Draw2D( VIEWTYPE vt );
100 };
101
102 class CDbgDlg : public Dialog
103 {
104   GPtrArray *m_pFeedbackElements;
105   // the list widget we use in the dialog
106   GtkListStore* m_clist;
107   ISAXHandler *m_pHighlight;
108 public:
109   CDbgDlg() { m_pFeedbackElements = g_ptr_array_new(); m_pHighlight = NULL; }
110   virtual               ~CDbgDlg() { ClearFeedbackArray(); }
111   // refresh items
112   void                  Push( ISAXHandler * );
113   // clean the debug window, release all ISAXHanlders we have
114   void                  Init();
115   ISAXHandler   *GetElement(gint row);
116   void                  SetHighlight(gint row);
117   void                  DropHighlight();
118 protected:
119   void                  BuildDialog();
120   void                  ClearFeedbackArray();
121 };
122
123 extern CDbgDlg g_DbgDlg;
124
125 #endif