| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifndef __Q3MAP_FEEDBACK__ |
| 29 |
#define __Q3MAP_FEEDBACK__ |
| 30 |
|
| 31 |
#include "math/vector.h" |
| 32 |
#include "stream/stringstream.h" |
| 33 |
#include "xmlstuff.h" |
| 34 |
#include "dialog.h" |
| 35 |
#include "xywindow.h" |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
class IGL2DWindow |
| 40 |
{ |
| 41 |
public: |
| 42 |
virtual ~IGL2DWindow() = default; |
| 43 |
|
| 44 |
virtual void IncRef() = 0; |
| 45 |
|
| 46 |
virtual void DecRef() = 0; |
| 47 |
virtual void Draw2D( VIEWTYPE vt ) = 0; |
| 48 |
}; |
| 49 |
|
| 50 |
|
| 51 |
class IGL3DWindow |
| 52 |
{ |
| 53 |
public: |
| 54 |
|
| 55 |
virtual void IncRef() = 0; |
| 56 |
|
| 57 |
virtual void DecRef() = 0; |
| 58 |
virtual void Draw3D() = 0; |
| 59 |
}; |
| 60 |
|
| 61 |
|
| 62 |
class CSelectMsg : public ISAXHandler |
| 63 |
{ |
| 64 |
enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState; |
| 65 |
StringOutputStream message; |
| 66 |
StringOutputStream brush; |
| 67 |
public: |
| 68 |
CSelectMsg() { ESelectState = SELECT_MESSAGE; } |
| 69 |
|
| 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 |
|
| 74 |
const char* getName() { return message.c_str(); } |
| 75 |
IGL2DWindow* Highlight(); |
| 76 |
void DropHighlight() { } |
| 77 |
}; |
| 78 |
|
| 79 |
class CPointMsg : public ISAXHandler, public IGL2DWindow |
| 80 |
{ |
| 81 |
enum { POINT_MESSAGE, POINT_POINT } EPointState; |
| 82 |
StringOutputStream message; |
| 83 |
StringOutputStream point; |
| 84 |
Vector3 pt; |
| 85 |
int refCount; |
| 86 |
public: |
| 87 |
CPointMsg() { EPointState = POINT_MESSAGE; refCount = 0; } |
| 88 |
|
| 89 |
void Release(){ |
| 90 |
delete this; |
| 91 |
} |
| 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 |
|
| 96 |
const char* getName() { return message.c_str(); } |
| 97 |
IGL2DWindow* Highlight(); |
| 98 |
void DropHighlight(); |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
void IncRef() { refCount++; } |
| 103 |
|
| 104 |
void DecRef() { |
| 105 |
refCount--; if ( refCount <= 0 ) { |
| 106 |
delete this; |
| 107 |
} |
| 108 |
} |
| 109 |
void Draw2D( VIEWTYPE vt ); |
| 110 |
}; |
| 111 |
|
| 112 |
class CWindingMsg : public ISAXHandler, public IGL2DWindow |
| 113 |
{ |
| 114 |
enum { WINDING_MESSAGE, WINDING_WINDING } EPointState; |
| 115 |
StringOutputStream message; |
| 116 |
StringOutputStream winding; |
| 117 |
Vector3 wt[256]; |
| 118 |
int numpoints; |
| 119 |
int refCount; |
| 120 |
public: |
| 121 |
CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; } |
| 122 |
|
| 123 |
void Release(){ |
| 124 |
delete this; |
| 125 |
} |
| 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 |
|
| 130 |
const char* getName() { return message.c_str(); } |
| 131 |
IGL2DWindow* Highlight(); |
| 132 |
void DropHighlight(); |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
void IncRef() { refCount++; } |
| 137 |
|
| 138 |
void DecRef() { |
| 139 |
refCount--; if ( refCount <= 0 ) { |
| 140 |
delete this; |
| 141 |
} |
| 142 |
} |
| 143 |
void Draw2D( VIEWTYPE vt ); |
| 144 |
}; |
| 145 |
|
| 146 |
|
| 147 |
class CDbgDlg : public Dialog |
| 148 |
{ |
| 149 |
GPtrArray *m_pFeedbackElements; |
| 150 |
|
| 151 |
ui::ListStore m_clist{ui::null}; |
| 152 |
ISAXHandler *m_pHighlight; |
| 153 |
IGL2DWindow* m_pDraw2D; |
| 154 |
public: |
| 155 |
CDbgDlg(){ |
| 156 |
m_pFeedbackElements = g_ptr_array_new(); |
| 157 |
m_pHighlight = NULL; |
| 158 |
m_pDraw2D = NULL; |
| 159 |
} |
| 160 |
|
| 161 |
void Push( ISAXHandler * ); |
| 162 |
|
| 163 |
void Init(); |
| 164 |
ISAXHandler *GetElement( std::size_t row ); |
| 165 |
void SetHighlight( gint row ); |
| 166 |
void DropHighlight(); |
| 167 |
void draw2D( VIEWTYPE viewType ){ |
| 168 |
if ( m_pDraw2D != 0 ) { |
| 169 |
m_pDraw2D->Draw2D( viewType ); |
| 170 |
} |
| 171 |
} |
| 172 |
void destroyWindow(){ |
| 173 |
if ( GetWidget() ) { |
| 174 |
Destroy(); |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
protected: |
| 179 |
ui::Window BuildDialog(); |
| 180 |
}; |
| 181 |
|
| 182 |
extern CDbgDlg g_DbgDlg; |
| 183 |
|
| 184 |
void Feedback_draw2D( VIEWTYPE viewType ); |
| 185 |
|
| 186 |
#endif |