]> git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/feedback.h
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / radiant / feedback.h
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \r
7 GtkRadiant is free software; you can redistribute it and/or modify\r
8 it under the terms of the GNU General Public License as published by\r
9 the Free Software Foundation; either version 2 of the License, or\r
10 (at your option) any later version.\r
11 \r
12 GtkRadiant is distributed in the hope that it will be useful,\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 GNU General Public License for more details.\r
16 \r
17 You should have received a copy of the GNU General Public License\r
18 along with GtkRadiant; if not, write to the Free Software\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
20 */\r
21 \r
22 //-----------------------------------------------------------------------------\r
23 //\r
24 // DESCRIPTION:\r
25 // classes used for describing geometry information from q3map feedback\r
26 //\r
27 \r
28 #ifndef __Q3MAP_FEEDBACK__\r
29 #define __Q3MAP_FEEDBACK__\r
30 \r
31 #include "libxml/parser.h"\r
32 \r
33 // a select message with a brush/entity select information\r
34 class CSelectMsg : public ISAXHandler\r
35 {\r
36   enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState;\r
37   GString *message;\r
38   int entitynum, brushnum;\r
39 public:\r
40   CSelectMsg() { ESelectState = SELECT_MESSAGE; }\r
41   // SAX interface\r
42   void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);\r
43   void saxEndElement (message_info_t *ctx, const xmlChar *name);\r
44   void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len);\r
45   // for use in the dialog window\r
46   char *getName() { return message->str; }\r
47   void Highlight();\r
48   void DropHighlight() { }\r
49 };\r
50 \r
51 class CPointMsg : public ISAXHandler, public IGL2DWindow\r
52 {\r
53   enum { POINT_MESSAGE, POINT_POINT } EPointState;\r
54   GString *message;\r
55   vec3_t pt;\r
56   int refCount;\r
57 public:\r
58   CPointMsg() { EPointState = POINT_MESSAGE; refCount = 0; }\r
59   // SAX interface\r
60   void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);\r
61   void saxEndElement (message_info_t *ctx, const xmlChar *name);\r
62   void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len);\r
63   // for use in the dialog window\r
64   char *getName() { return message->str; }\r
65   void Highlight();\r
66   void DropHighlight();\r
67 \r
68   // IGL2DWindow interface --------------------------------\r
69         // Increment the number of references to this object\r
70   void IncRef () { refCount++; }\r
71         // Decrement the reference count\r
72   void DecRef () { refCount--; if (refCount <= 0) delete this; }\r
73         void Draw2D( VIEWTYPE vt );\r
74 };\r
75 \r
76 class CWindingMsg : public ISAXHandler, public IGL2DWindow\r
77 {\r
78   enum { WINDING_MESSAGE, WINDING_WINDING } EPointState;\r
79   GString *message;\r
80   vec3_t wt[256];\r
81   int numpoints;\r
82   int refCount;\r
83 public:\r
84   CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; }\r
85   // SAX interface\r
86   void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs);\r
87   void saxEndElement (message_info_t *ctx, const xmlChar *name);\r
88   void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len);\r
89   // for use in the dialog window\r
90   char *getName() { return message->str; }\r
91   void Highlight();\r
92   void DropHighlight();\r
93 \r
94   // IGL2DWindow interface --------------------------------\r
95         // Increment the number of references to this object\r
96   void IncRef () { refCount++; }\r
97         // Decrement the reference count\r
98   void DecRef () { refCount--; if (refCount <= 0) delete this; }\r
99         void Draw2D( VIEWTYPE vt );\r
100 };\r
101 \r
102 class CDbgDlg : public Dialog\r
103 {\r
104   GPtrArray *m_pFeedbackElements;\r
105   // the list widget we use in the dialog\r
106   GtkListStore* m_clist;\r
107   ISAXHandler *m_pHighlight;\r
108 public:\r
109   CDbgDlg() { m_pFeedbackElements = g_ptr_array_new (); m_pHighlight = NULL; }\r
110   virtual ~CDbgDlg() { }\r
111   // refresh items\r
112   void Push (ISAXHandler *);\r
113   // clean the debug window, release all ISAXHanlders we have\r
114   void Init();\r
115   ISAXHandler *GetElement(gint row);\r
116   void SetHighlight(gint row);\r
117   void DropHighlight();\r
118 //  void HideDlg();\r
119 protected:\r
120   void BuildDialog ();\r
121 };\r
122 \r
123 extern CDbgDlg g_DbgDlg;\r
124 \r
125 #endif\r