X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=radiant%2Ffeedback.h;h=b683a316d76ea07abe1cc48b43c238b36614b68e;hb=ee4b663ef7227a42b5eb051698265bed514ab3c0;hp=8db96b226d23879b94c446a77968cff6c3d2f636;hpb=830125fad042fad35dc029b6eb57c8156ad7e176;p=xonotic%2Fnetradiant.git diff --git a/radiant/feedback.h b/radiant/feedback.h index 8db96b22..b683a316 100644 --- a/radiant/feedback.h +++ b/radiant/feedback.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2007 id Software, Inc. and contributors. + Copyright (C) 1999-2006 Id Software, Inc. and contributors. For a list of contributors, see the accompanying CONTRIBUTORS file. This file is part of GtkRadiant. @@ -28,14 +28,42 @@ #ifndef __Q3MAP_FEEDBACK__ #define __Q3MAP_FEEDBACK__ -#include "libxml/parser.h" +#include "math/vector.h" +#include "stream/stringstream.h" +#include "xmlstuff.h" +#include "dialog.h" +#include "xywindow.h" + +// we use these classes to let plugins draw inside the Radiant windows +// 2D window like YZ XZ XY +class IGL2DWindow +{ +public: +virtual ~IGL2DWindow() = default; +// Increment the number of references to this object +virtual void IncRef() = 0; +// Decrement the reference count +virtual void DecRef() = 0; +virtual void Draw2D( VIEWTYPE vt ) = 0; +}; + +// 3D window +class IGL3DWindow +{ +public: +// Increment the number of references to this object +virtual void IncRef() = 0; +// Decrement the reference count +virtual void DecRef() = 0; +virtual void Draw3D() = 0; +}; // a select message with a brush/entity select information class CSelectMsg : public ISAXHandler { enum { SELECT_MESSAGE, SELECT_BRUSH } ESelectState; -GString *message; -int entitynum, brushnum; +StringOutputStream message; +StringOutputStream brush; public: CSelectMsg() { ESelectState = SELECT_MESSAGE; } // SAX interface @@ -43,26 +71,30 @@ void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar ** void saxEndElement( message_info_t *ctx, const xmlChar *name ); void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len ); // for use in the dialog window -char *getName() { return message->str; } -void Highlight(); +const char* getName() { return message.c_str(); } +IGL2DWindow* Highlight(); void DropHighlight() { } }; class CPointMsg : public ISAXHandler, public IGL2DWindow { enum { POINT_MESSAGE, POINT_POINT } EPointState; -GString *message; -vec3_t pt; +StringOutputStream message; +StringOutputStream point; +Vector3 pt; int refCount; public: CPointMsg() { EPointState = POINT_MESSAGE; refCount = 0; } // SAX interface +void Release(){ + delete this; +} void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs ); void saxEndElement( message_info_t *ctx, const xmlChar *name ); void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len ); // for use in the dialog window -char *getName() { return message->str; } -void Highlight(); +const char* getName() { return message.c_str(); } +IGL2DWindow* Highlight(); void DropHighlight(); // IGL2DWindow interface -------------------------------- @@ -80,19 +112,23 @@ void Draw2D( VIEWTYPE vt ); class CWindingMsg : public ISAXHandler, public IGL2DWindow { enum { WINDING_MESSAGE, WINDING_WINDING } EPointState; -GString *message; -vec3_t wt[256]; +StringOutputStream message; +StringOutputStream winding; +Vector3 wt[256]; int numpoints; int refCount; public: CWindingMsg() { EPointState = WINDING_MESSAGE; refCount = 0; numpoints = 0; } // SAX interface +void Release(){ + delete this; +} void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs ); void saxEndElement( message_info_t *ctx, const xmlChar *name ); void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len ); // for use in the dialog window -char *getName() { return message->str; } -void Highlight(); +const char* getName() { return message.c_str(); } +IGL2DWindow* Highlight(); void DropHighlight(); // IGL2DWindow interface -------------------------------- @@ -107,27 +143,44 @@ void DecRef() { void Draw2D( VIEWTYPE vt ); }; + class CDbgDlg : public Dialog { GPtrArray *m_pFeedbackElements; // the list widget we use in the dialog -GtkListStore* m_clist; +ui::ListStore m_clist{ui::null}; ISAXHandler *m_pHighlight; +IGL2DWindow* m_pDraw2D; public: -CDbgDlg() { m_pFeedbackElements = g_ptr_array_new(); m_pHighlight = NULL; } -virtual ~CDbgDlg() { ClearFeedbackArray(); } +CDbgDlg(){ + m_pFeedbackElements = g_ptr_array_new(); + m_pHighlight = NULL; + m_pDraw2D = NULL; +} // refresh items -void Push( ISAXHandler * ); +void Push( ISAXHandler * ); // clean the debug window, release all ISAXHanlders we have -void Init(); -ISAXHandler *GetElement( gint row ); -void SetHighlight( gint row ); -void DropHighlight(); +void Init(); +ISAXHandler *GetElement( std::size_t row ); +void SetHighlight( gint row ); +void DropHighlight(); +void draw2D( VIEWTYPE viewType ){ + if ( m_pDraw2D != 0 ) { + m_pDraw2D->Draw2D( viewType ); + } +} +void destroyWindow(){ + if ( GetWidget() ) { + Destroy(); + } +} +// void HideDlg(); protected: -void BuildDialog(); -void ClearFeedbackArray(); +ui::Window BuildDialog(); }; extern CDbgDlg g_DbgDlg; +void Feedback_draw2D( VIEWTYPE viewType ); + #endif