]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/feedback.cpp
Wrap more GTK
[xonotic/netradiant.git] / radiant / feedback.cpp
index 26e283da86c7eb21f782ac9d0b946958acfda997..a465ed6cff72918a5936b65abb216aa923ba6b19 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-//-----------------------------------------------------------------------------\r
-//\r
-// DESCRIPTION:\r
-// classes used for describing geometry information from q3map feedback\r
-//\r
-\r
-#include "stdafx.h"\r
-\r
-#include "feedback.h"\r
-#include "glib.h"\r
-#include <assert.h>\r
-\r
-CDbgDlg g_DbgDlg;\r
-\r
-void CSelectMsg::saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs)\r
-{\r
-  if (strcmp ((char *)name, "select")==0)\r
-  {\r
-    // read the message\r
-    ESelectState = SELECT_MESSAGE;\r
-  }\r
-  else\r
-  {\r
-    // read the brush\r
-    assert (strcmp ((char *)name, "brush")==0);\r
-    assert (ESelectState == SELECT_MESSAGE);\r
-    ESelectState = SELECT_BRUSH;\r
-  }\r
-}\r
-\r
-void CSelectMsg::saxEndElement (message_info_t *ctx, const xmlChar *name)\r
-{\r
-  if (strcmp ((char *)name, "select")==0)\r
-  {\r
-    ctx->bGeometry = false;\r
-  }\r
-}\r
-\r
-void CSelectMsg::saxCharacters (message_info_t *ctx, const xmlChar *ch, int len)\r
-{\r
-  if (ESelectState == SELECT_MESSAGE)\r
-  {\r
-    message = g_string_sized_new (len+1);\r
-    memcpy (message->str, ch, len);\r
-    message->str[len]='\0';\r
-    Sys_Printf ("%s\n", message->str);\r
-  }\r
-  else\r
-  {\r
-    assert (ESelectState == SELECT_BRUSH);\r
-    sscanf ((char *)ch, "%i %i", &entitynum, &brushnum);\r
-  }\r
-}\r
-\r
-void CSelectMsg::Highlight ()\r
-{\r
-  Select_Deselect ();\r
-  SelectBrush (entitynum, brushnum);\r
-}\r
-\r
-void CPointMsg::saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs)\r
-{\r
-  if (strcmp ((char *)name, "pointmsg")==0)\r
-  {\r
-    // read the message\r
-    EPointState = POINT_MESSAGE;\r
-  }\r
-  else\r
-  {\r
-    // read the brush\r
-    assert (strcmp ((char *)name, "point")==0);\r
-    assert (EPointState == POINT_MESSAGE);\r
-    EPointState = POINT_POINT;\r
-  }\r
-}\r
-\r
-void CPointMsg::saxEndElement (message_info_t *ctx, const xmlChar *name)\r
-{\r
-  if (strcmp ((char *)name, "pointmsg")==0)\r
-  {\r
-    ctx->bGeometry = false;\r
-  }\r
-}\r
-\r
-void CPointMsg::saxCharacters (message_info_t *ctx, const xmlChar *ch, int len)\r
-{\r
-  if (EPointState == POINT_MESSAGE)\r
-  {\r
-    message = g_string_sized_new (len+1);\r
-    memcpy (message->str, ch, len);\r
-    message->str[len]='\0';\r
-    Sys_Printf ("%s\n", message->str);\r
-  }\r
-  else\r
-  {\r
-    assert (EPointState == POINT_POINT);\r
-    sscanf ((char *)ch, "%g %g %g", &(pt[0]), &(pt[1]), &(pt[2]));\r
-  }\r
-}\r
-\r
-void CPointMsg::Highlight ()\r
-{\r
-  // use the entity API to push a point\r
-  // the API requires a ref count, we do it manually for the current instance\r
-  if (refCount == 0)\r
-  {\r
-    refCount++;\r
-    QERApp_HookGL2DWindow (this);\r
-  }\r
-}\r
-\r
-void CPointMsg::DropHighlight ()\r
-{\r
-  assert (refCount > 0);\r
-  QERApp_UnHookGL2DWindow (this);\r
-  // do a refCount-- locally (see Highlight)\r
-  refCount--;\r
-}\r
-\r
-void CPointMsg::Draw2D( VIEWTYPE vt )\r
-{\r
-  int nDim1 = (vt == YZ) ? 1 : 0;\r
-  int nDim2 = (vt == XY) ? 1 : 2;\r
-  qglPointSize(4);\r
-  qglColor3f(1.0f,0.0f,0.0f);\r
-  qglBegin (GL_POINTS);\r
-  qglVertex2f (pt[nDim1], pt[nDim2]);\r
-  qglEnd();\r
-  qglBegin (GL_LINE_LOOP);\r
-  qglVertex2f (pt[nDim1]-8, pt[nDim2]-8);\r
-  qglVertex2f (pt[nDim1]+8, pt[nDim2]-8);\r
-  qglVertex2f (pt[nDim1]+8, pt[nDim2]+8);\r
-  qglVertex2f (pt[nDim1]-8, pt[nDim2]+8);\r
-  qglEnd();\r
-}\r
-\r
-void CWindingMsg::saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs)\r
-{\r
-  if (strcmp ((char *)name, "windingmsg")==0)\r
-  {\r
-    // read the message\r
-    EPointState = WINDING_MESSAGE;\r
-  }\r
-  else\r
-  {\r
-    // read the brush\r
-    assert (strcmp ((char *)name, "winding")==0);\r
-    assert (EPointState == WINDING_MESSAGE);\r
-    EPointState = WINDING_WINDING;\r
-  }\r
-}\r
-\r
-void CWindingMsg::saxEndElement (message_info_t *ctx, const xmlChar *name)\r
-{\r
-  if (strcmp ((char *)name, "windingmsg")==0)\r
-  {\r
-    ctx->bGeometry = false;\r
-  }\r
-}\r
-\r
-void CWindingMsg::saxCharacters (message_info_t *ctx, const xmlChar *ch, int len)\r
-{\r
-  if (EPointState == WINDING_MESSAGE)\r
-  {\r
-    message = g_string_sized_new (len+1);\r
-    memcpy (message->str, ch, len);\r
-    message->str[len]='\0';\r
-    Sys_Printf ("%s\n", message->str);\r
-  }\r
-  else\r
-  {\r
-    char* c;\r
-    int i;\r
-\r
-    assert (EPointState == WINDING_WINDING);\r
-\r
-\r
-    c = (char*)ch;\r
-    sscanf (c, "%i ", &numpoints);\r
-\r
-    for(i = 0; i < numpoints; i++)\r
-    {\r
-      c = strchr(++c, '(');\r
-      if (c) // even if we are given the number of points when the cycle begins .. don't trust it too much\r
-        sscanf(c, "(%g %g %g)", &wt[i][0], &wt[i][1], &wt[i][2]);\r
-      else\r
-        break;\r
-    }\r
-    numpoints = i;\r
-  }\r
-}\r
-\r
-void CWindingMsg::Highlight ()\r
-{\r
-  // use the entity API to push a point\r
-  // the API requires a ref count, we do it manually for the current instance\r
-  if (refCount == 0)\r
-  {\r
-    refCount++;\r
-    QERApp_HookGL2DWindow (this);\r
-  }\r
-}\r
-\r
-void CWindingMsg::DropHighlight ()\r
-{\r
-  assert (refCount > 0);\r
-  QERApp_UnHookGL2DWindow (this);\r
-  // do a refCount-- locally (see Highlight)\r
-  refCount--;\r
-}\r
-\r
-void CWindingMsg::Draw2D( VIEWTYPE vt )\r
-{\r
-  int i;\r
-\r
-  int nDim1 = (vt == YZ) ? 1 : 0;\r
-  int nDim2 = (vt == XY) ? 1 : 2;\r
-  qglColor3f(1.0f,0.f,0.0f);\r
-\r
-  qglPointSize(4);\r
-  qglBegin (GL_POINTS);\r
-  for(i = 0; i < numpoints; i++)\r
-       qglVertex2f (wt[i][nDim1], wt[i][nDim2]);\r
-  qglEnd();\r
-  qglPointSize(1);\r
-\r
-  qglEnable (GL_BLEND);\r
-  qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);\r
-  qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\r
-  qglColor4f(0.133f,0.4f,1.0f,0.5f);\r
-  qglBegin (GL_POLYGON);\r
-       for(i = 0; i < numpoints; i++)\r
-               qglVertex2f (wt[i][nDim1], wt[i][nDim2]);\r
-  qglEnd();\r
-  qglDisable (GL_BLEND);\r
-}\r
-\r
-// triggered when the user selects an entry in the feedback box\r
-static void feedback_selection_changed(GtkTreeSelection* selection, gpointer data)\r
-{\r
-  g_DbgDlg.DropHighlight();\r
-\r
-  GtkTreeModel* model;\r
-  GtkTreeIter selected;\r
-  if(gtk_tree_selection_get_selected(selection, &model, &selected))\r
-  {\r
-    GtkTreePath* path = gtk_tree_model_get_path(model, &selected);\r
-      g_DbgDlg.SetHighlight(gtk_tree_path_get_indices(path)[0]);\r
-    gtk_tree_path_free(path);\r
-  }\r
-}\r
-\r
-void CDbgDlg::DropHighlight()\r
-{\r
-  if (m_pHighlight)\r
-  {\r
-    m_pHighlight->DropHighlight();\r
-    m_pHighlight = NULL;\r
-  }\r
-}\r
-\r
-void CDbgDlg::SetHighlight(gint row)\r
-{\r
-  ISAXHandler *h = GetElement(row);\r
-  if (h != NULL)\r
-  {\r
-    h->Highlight();\r
-    m_pHighlight = h;\r
-  }\r
-}\r
-\r
-ISAXHandler *CDbgDlg::GetElement (gint row)\r
-{\r
-  return static_cast<ISAXHandler *>(g_ptr_array_index(m_pFeedbackElements, row));\r
-}\r
-\r
-void CDbgDlg::Init ()\r
-{\r
-  DropHighlight();\r
-\r
-  // free all the ISAXHandler*, clean it\r
-  while (m_pFeedbackElements->len)\r
-  {\r
-    delete static_cast<ISAXHandler *>(g_ptr_array_index (m_pFeedbackElements, 0));\r
-    g_ptr_array_remove_index (m_pFeedbackElements, 0);\r
-  }\r
-\r
-  if (m_clist != NULL)\r
-    gtk_list_store_clear (m_clist);\r
-}\r
-\r
-void CDbgDlg::Push (ISAXHandler *pHandler)\r
-{\r
-  // push in the list\r
-  g_ptr_array_add (m_pFeedbackElements, (void *)pHandler);\r
-\r
-  if (m_pWidget == NULL)\r
-    Create();\r
-  // put stuff in the list\r
-  gtk_list_store_clear (m_clist);\r
-  for(unsigned int i = 0; i < m_pFeedbackElements->len; ++i)\r
-  {\r
-    GtkTreeIter iter;\r
-    gtk_list_store_append(m_clist, &iter);\r
-    gtk_list_store_set(m_clist, &iter, 0, GetElement(i)->getName(), -1);\r
-  }\r
-\r
-  ShowDlg();\r
-}\r
-\r
-void CDbgDlg::BuildDialog ()\r
-{\r
-  gtk_window_set_title (GTK_WINDOW (m_pWidget), "Q3Map debug window");\r
-\r
-  GtkWidget* scr = gtk_scrolled_window_new (NULL, NULL);\r
-  gtk_widget_show (scr);\r
-  gtk_container_add (GTK_CONTAINER (m_pWidget), GTK_WIDGET (scr));\r
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);\r
-  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scr), GTK_SHADOW_IN);\r
-\r
-  {\r
-    GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING);\r
-\r
-    GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));\r
-    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);\r
-\r
-    {\r
-      GtkCellRenderer* renderer = gtk_cell_renderer_text_new();\r
-      GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);\r
-      gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);\r
-    }\r
-\r
-    {\r
-      GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));\r
-      gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);\r
-      g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(feedback_selection_changed), NULL);\r
-    }\r
-\r
-    gtk_widget_show(view);\r
-\r
-    gtk_container_add(GTK_CONTAINER (scr), view);\r
-\r
-    g_object_unref(G_OBJECT(store));\r
-\r
-    m_clist = store;\r
-  }\r
-}\r
+/*
+   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.
+
+   GtkRadiant is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   GtkRadiant is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GtkRadiant; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+//-----------------------------------------------------------------------------
+//
+// DESCRIPTION:
+// classes used for describing geometry information from q3map feedback
+//
+
+#include "feedback.h"
+
+#include <gtk/gtk.h>
+
+#include "debugging/debugging.h"
+
+#include "igl.h"
+#include "iselection.h"
+
+#include "map.h"
+#include "dialog.h"
+#include "mainframe.h"
+
+
+CDbgDlg g_DbgDlg;
+
+void Feedback_draw2D( VIEWTYPE viewType ){
+       g_DbgDlg.draw2D( viewType );
+}
+
+void CSelectMsg::saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs ){
+       if ( string_equal( reinterpret_cast<const char*>( name ), "select" ) ) {
+               // read the message
+               ESelectState = SELECT_MESSAGE;
+       }
+       else
+       {
+               // read the brush
+               ASSERT_MESSAGE( string_equal( reinterpret_cast<const char*>( name ), "brush" ), "FEEDBACK PARSE ERROR" );
+               ASSERT_MESSAGE( ESelectState == SELECT_MESSAGE, "FEEDBACK PARSE ERROR" );
+               ESelectState = SELECT_BRUSH;
+               globalOutputStream() << message.c_str() << '\n';
+       }
+}
+
+void CSelectMsg::saxEndElement( message_info_t *ctx, const xmlChar *name ){
+       if ( string_equal( reinterpret_cast<const char*>( name ), "select" ) ) {
+       }
+}
+
+void CSelectMsg::saxCharacters( message_info_t *ctx, const xmlChar *ch, int len ){
+       if ( ESelectState == SELECT_MESSAGE ) {
+               message.write( reinterpret_cast<const char*>( ch ), len );
+       }
+       else
+       {
+               brush.write( reinterpret_cast<const char*>( ch ), len );
+       }
+}
+
+IGL2DWindow* CSelectMsg::Highlight(){
+       GlobalSelectionSystem().setSelectedAll( false );
+       int entitynum, brushnum;
+       if ( sscanf( reinterpret_cast<const char*>( brush.c_str() ), "%i %i", &entitynum, &brushnum ) == 2 ) {
+               SelectBrush( entitynum, brushnum );
+       }
+       return 0;
+}
+
+void CPointMsg::saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs ){
+       if ( string_equal( reinterpret_cast<const char*>( name ), "pointmsg" ) ) {
+               // read the message
+               EPointState = POINT_MESSAGE;
+       }
+       else
+       {
+               // read the brush
+               ASSERT_MESSAGE( string_equal( reinterpret_cast<const char*>( name ), "point" ), "FEEDBACK PARSE ERROR" );
+               ASSERT_MESSAGE( EPointState == POINT_MESSAGE, "FEEDBACK PARSE ERROR" );
+               EPointState = POINT_POINT;
+               globalOutputStream() << message.c_str() << '\n';
+       }
+}
+
+void CPointMsg::saxEndElement( message_info_t *ctx, const xmlChar *name ){
+       if ( string_equal( reinterpret_cast<const char*>( name ), "pointmsg" ) ) {
+       }
+       else if ( string_equal( reinterpret_cast<const char*>( name ), "point" ) ) {
+               sscanf( point.c_str(), "%g %g %g", &( pt[0] ), &( pt[1] ), &( pt[2] ) );
+               point.clear();
+       }
+}
+
+void CPointMsg::saxCharacters( message_info_t *ctx, const xmlChar *ch, int len ){
+       if ( EPointState == POINT_MESSAGE ) {
+               message.write( reinterpret_cast<const char*>( ch ), len );
+       }
+       else
+       {
+               ASSERT_MESSAGE( EPointState == POINT_POINT, "FEEDBACK PARSE ERROR" );
+               point.write( reinterpret_cast<const char*>( ch ), len );
+       }
+}
+
+IGL2DWindow* CPointMsg::Highlight(){
+       return this;
+}
+
+void CPointMsg::DropHighlight(){
+}
+
+void CPointMsg::Draw2D( VIEWTYPE vt ){
+       int nDim1 = ( vt == YZ ) ? 1 : 0;
+       int nDim2 = ( vt == XY ) ? 1 : 2;
+       glPointSize( 4 );
+       glColor3f( 1.0f,0.0f,0.0f );
+       glBegin( GL_POINTS );
+       glVertex2f( pt[nDim1], pt[nDim2] );
+       glEnd();
+       glBegin( GL_LINE_LOOP );
+       glVertex2f( pt[nDim1] - 8, pt[nDim2] - 8 );
+       glVertex2f( pt[nDim1] + 8, pt[nDim2] - 8 );
+       glVertex2f( pt[nDim1] + 8, pt[nDim2] + 8 );
+       glVertex2f( pt[nDim1] - 8, pt[nDim2] + 8 );
+       glEnd();
+}
+
+void CWindingMsg::saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs ){
+       if ( string_equal( reinterpret_cast<const char*>( name ), "windingmsg" ) ) {
+               // read the message
+               EPointState = WINDING_MESSAGE;
+       }
+       else
+       {
+               // read the brush
+               ASSERT_MESSAGE( string_equal( reinterpret_cast<const char*>( name ), "winding" ), "FEEDBACK PARSE ERROR" );
+               ASSERT_MESSAGE( EPointState == WINDING_MESSAGE, "FEEDBACK PARSE ERROR" );
+               EPointState = WINDING_WINDING;
+               globalOutputStream() << message.c_str() << '\n';
+       }
+}
+
+void CWindingMsg::saxEndElement( message_info_t *ctx, const xmlChar *name ){
+       if ( string_equal( reinterpret_cast<const char*>( name ), "windingmsg" ) ) {
+       }
+       else if ( string_equal( reinterpret_cast<const char*>( name ), "winding" ) ) {
+               const char* c = winding.c_str();
+               sscanf( c, "%i ", &numpoints );
+
+               int i = 0;
+               for (; i < numpoints; i++ )
+               {
+                       c = strchr( c + 1, '(' );
+                       if ( c ) { // even if we are given the number of points when the cycle begins .. don't trust it too much
+                               sscanf( c, "(%g %g %g)", &wt[i][0], &wt[i][1], &wt[i][2] );
+                       }
+                       else{
+                               break;
+                       }
+               }
+               numpoints = i;
+       }
+}
+
+void CWindingMsg::saxCharacters( message_info_t *ctx, const xmlChar *ch, int len ){
+       if ( EPointState == WINDING_MESSAGE ) {
+               message.write( reinterpret_cast<const char*>( ch ), len );
+       }
+       else
+       {
+               ASSERT_MESSAGE( EPointState == WINDING_WINDING, "FEEDBACK PARSE ERROR" );
+               winding.write( reinterpret_cast<const char*>( ch ), len );
+       }
+}
+
+IGL2DWindow* CWindingMsg::Highlight(){
+       return this;
+}
+
+void CWindingMsg::DropHighlight(){
+}
+
+void CWindingMsg::Draw2D( VIEWTYPE vt ){
+       int i;
+
+       int nDim1 = ( vt == YZ ) ? 1 : 0;
+       int nDim2 = ( vt == XY ) ? 1 : 2;
+       glColor3f( 1.0f,0.f,0.0f );
+
+       glPointSize( 4 );
+       glBegin( GL_POINTS );
+       for ( i = 0; i < numpoints; i++ )
+               glVertex2f( wt[i][nDim1], wt[i][nDim2] );
+       glEnd();
+       glPointSize( 1 );
+
+       glEnable( GL_BLEND );
+       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+       glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+       glColor4f( 0.133f,0.4f,1.0f,0.5f );
+       glBegin( GL_POLYGON );
+       for ( i = 0; i < numpoints; i++ )
+               glVertex2f( wt[i][nDim1], wt[i][nDim2] );
+       glEnd();
+       glDisable( GL_BLEND );
+}
+
+// triggered when the user selects an entry in the feedback box
+static void feedback_selection_changed( GtkTreeSelection* selection, gpointer data ){
+       g_DbgDlg.DropHighlight();
+
+       GtkTreeModel* model;
+       GtkTreeIter selected;
+       if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
+               GtkTreePath* path = gtk_tree_model_get_path( model, &selected );
+               g_DbgDlg.SetHighlight( gtk_tree_path_get_indices( path )[0] );
+               gtk_tree_path_free( path );
+       }
+}
+
+void CDbgDlg::DropHighlight(){
+       if ( m_pHighlight != 0 ) {
+               m_pHighlight->DropHighlight();
+               m_pHighlight = 0;
+               m_pDraw2D = 0;
+       }
+}
+
+void CDbgDlg::SetHighlight( gint row ){
+       ISAXHandler *h = GetElement( row );
+       if ( h != NULL ) {
+               m_pDraw2D = h->Highlight();
+               m_pHighlight = h;
+       }
+}
+
+ISAXHandler *CDbgDlg::GetElement( std::size_t row ){
+       return static_cast<ISAXHandler *>( g_ptr_array_index( m_pFeedbackElements, gint( row ) ) );
+}
+
+void CDbgDlg::Init(){
+       DropHighlight();
+
+       // free all the ISAXHandler*, clean it
+       while ( m_pFeedbackElements->len )
+       {
+               static_cast<ISAXHandler *>( g_ptr_array_index( m_pFeedbackElements, 0 ) )->Release();
+               g_ptr_array_remove_index( m_pFeedbackElements, 0 );
+       }
+
+       if ( m_clist ) {
+               m_clist.clear();
+       }
+}
+
+void CDbgDlg::Push( ISAXHandler *pHandler ){
+       // push in the list
+       g_ptr_array_add( m_pFeedbackElements, (void *)pHandler );
+
+       if ( !GetWidget() ) {
+               Create();
+       }
+
+       // put stuff in the list
+       m_clist.clear();
+       for ( std::size_t i = 0; i < static_cast<std::size_t>( m_pFeedbackElements->len ); ++i )
+       {
+               m_clist.append(0, GetElement(i)->getName());
+       }
+
+       ShowDlg();
+}
+
+ui::Window CDbgDlg::BuildDialog(){
+       auto window = MainFrame_getWindow().create_floating_window("Q3Map debug window" );
+
+       auto scr = ui::ScrolledWindow(ui::New);
+       scr.show();
+       window.add(scr);
+       gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
+       gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
+
+       {
+               ui::ListStore store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
+
+               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+               gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
+
+               {
+                       auto renderer = ui::CellRendererText(ui::New);
+                       GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
+                       gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
+               }
+
+               {
+                       auto selection = ui::TreeSelection(gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ));
+                       gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE );
+                       selection.connect( "changed", G_CALLBACK( feedback_selection_changed ), NULL );
+               }
+
+               view.show();
+
+               scr.add(view);
+
+               store.unref();
+
+               m_clist = store;
+       }
+
+       return window;
+}