Code Monkey home page Code Monkey logo

glui's People

Contributors

baxissimo avatar energy0124 avatar ingowald avatar josch avatar nigels-com avatar simogasp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glui's Issues

Arrow Key crashes GLUI program

https://sourceforge.net/p/glui/bugs/3/

original report

Click into the graphics window and hit an arrow key,
program crashes.

reply 1

Is the platform Win32 or X11?
(I don't see this on w2k with CVS GLUI)

reply 2

I had the same problem running under WIN XP. Using a debug
version of the GLUI library, I have discovered that the
crash occurs in glui_special_func in glui.cpp

Looks like the value of glut_window->glut_special_CB is not
verified before it is invoked. I have invoked
set_glutSpecialFunc at start up but I passed a null to it.

reply 3

I went ahead and prefixed all the calls to
glut_window->glut_xxx_CB in glui.cpp with checks for null
just to be on the safe side.

text_x_offset (distance between textboxes)

https://sourceforge.net/p/glui/feature-requests/13/

Is it possible to adjust the distance between edit
textboxes. I tried to change the value text_x_offset =
55 in the constructor of the edittext class and recompile
the library. But then the sub windows weren't being
displayed as they should. A function for the edittextbox
class wich would set the distance between two text
boxes would be quit usefull for me.

GLUI_EditText( void ) {
type = GLUI_CONTROL_EDITTEXT;
h = GLUI_EDITTEXT_HEIGHT;
w = GLUI_EDITTEXT_WIDTH;
title_x_offset = 0;
text_x_offset = 55;//<-orginal
//text_x_offset = 10;

insertion_pt          = -1;
last_insertion_pt     = -1;
name[0]               = '\0';
substring_start       = 0;
data_type             = GLUI_EDITTEXT_TEXT;
substring_end         = 2;
num_periods           = 0;
has_limits            = GLUI_LIMIT_NONE;
sel_start             = 0;
sel_end               = 0;
active_type           =

GLUI_CONTROL_ACTIVE_PERMANENT;
can_activate = true;
spacebar_mouse_click = false;
spinner = NULL;
debug = false;
draw_text_only = false;
};
};

Detailed API for for color / font / texture description

https://sourceforge.net/p/glui/feature-requests/3/

original report

I know there is some undocumented features (ex
GLUI::bkgd_color.set(R, G, B) to define the color / font
off a control. I think I would be good to have it
documented (if its already done, where is it ?) and to
profide an "application" scheme to control the
appearance of all sub-windows (switchable global defaut
settings for example).

By the way I would be cool to provide the ability to put
texture on the back of each control.

David

reply 1

Yes, I agree that having more theming flexibility would
certainly be an advantage. Recently I have been dealing a
bit with web CSS (Cascading Style Sheets) which certainly
provides a model for doing this kind of thing. Attributes
can be specified for kinds of elements (lists, paragraphs,
headings) or specifically named elements.

reply 2

Yes, that would be good.

Problem when using on stereoscopic machine

https://sourceforge.net/p/glui/bugs/9/

original report

I have run Example5 on windows on Stereoscopic
machine and it is not displaying all user interface
components properly. when we collepse any rollout then
it displays all the components properly.

reply 1

You'll need to be a bit more specific than that if you want
there to be any chance of this ever getting fixed. Best
would be for you to try to do a little debugging and figure
out what the problem is, because chances of one of the devs
here having a stereoscopic setup is slim.

with GNU build system

https://sourceforge.net/p/glui/patches/5/

original report

It has come to my attention again that some users desire an easier way to install and use GLUI.

A while back I had modified the build system of GLUI v2.2 to use autoconf, automake, and libtool. I neglected to post it to this tracker... sorry. I am posting it now in hopes that build system has not diverged much, and as such it will be useful.

I could probably be coerced into doing this for the current GLUI subversion revision.

... Nevermind, sourceforge has a file size limit. You can obtain the tarball at

https://artemis.sr.unh.edu/~tfogal/glui-2.2.tar.gz

reply 1

This is pretty important enhancement IMO. There are several parts of makefile that require hand-editing and tweaking that oculd be simplified and made more user-friendly and platform-portable. The autotools know which -g and -O flags are good on which platforms. There are easy ways to do flags to (for example) select among the various glut types, and check for their presence and location. As it becomes necessary to use different #include or other things on different platforms or versions of operating system, it's easy to detect and automatically compensate. Libtool would bring shared-library support and the idea of interface compatibility. And there would be an easy way to install the lib, rather than relying on manually copying files (which ones? where?).

Dynamic text

https://sourceforge.net/p/glui/feature-requests/11/

original report

It would be nice to have a dinamic Text Object to act
as a flag to see the value of a determinate variable in
real time (like cursor position)

reply 1

GLUI in CVS is now using std::string.

Is the idea here that a pointer to a std::string
can be passed to the text widget, and the
current content of the std::string will always
be used for display?

Keyboard events lost w/ mouse on glui component

https://sourceforge.net/p/glui/bugs/5/

original report

I am having a problem with losing keyboard response
when I mouse over a GLUI control. Its as if the keyboard
callback has been disabled. I can hold
down a key, move the mouse onto a panel and totally
miss the key up event. As soon as I move the mouse off
of the panel I get the key up event. If I put the cursor
over a control like a spinner I loose keyboard control and
never get it back. This is happening on XPPro and
Win2K. I have tried both analog and optical mice.

In examples 2 and 5 the "q" key is bound to quit. If I
take the actions described above the q key quits
working. It appears that once a glui component has
mouse focus keyboard events are ignored.

I am writing a Breakout game and need keyboard control
for the paddle and GLUI controls for ball speed etc...

Thanks for your time.

reply 1

GLUI maintains an active_control variable that controls
the routing of events to various GUI components.

I suggest experimenting with:
GLUI_Main::disactivate_current_control()

Otherwise you could hack GLUI here:
void glui_keyboard_func(unsigned char key, int x, int y)

GLUI_Control ptr in callbacks

https://sourceforge.net/p/glui/feature-requests/8/

For callbacks, GLUI should pass a pointer to the
control that triggered the callback. Currently the
callbacks just give you an int, but that means if you
want to take action that depends on the data in a
control, then you need to have BOTH a callback function
AND a variable somewhere in your code that's accessible
to the function. If GLUI would pass a pointer to the
GLUI_Control in the callback, I wouldn't have to hold
onto that GLUI_EditText myself.

My code is littered with static variables that are
there for the sole purpose of letting me know what the
current string value is in a text field when I get the
callback. There's no reason for GLUI not to pass just
that pointer to me.

And while we're at it, it would be better if the int id
value passed was a void instead so that you could have
the callback pass you any old user data you want.
Yes i know I could cast pointers to ints, but I don't
think C++ guarantees that sizeof(int)==sizeof(void).

So in summary, I think the glui callback protoptype
should be
typedef void (GLUI_Update_CB) (void data,
GLUI_Controlcontrol);
instead of
typedef void (GLUI_Update_CB) (int id);

SEGV on GLUI_Listbox::mouse_over

https://sourceforge.net/p/glui/bugs/18/

Config:
Linux Fedora Core 4
IBM ThinkCentre
512M
Crappy stock motherboard gfx
Program:

example5 provided with GLUI 2.2
How to make it bomb:

Run example5
Pull down the Text pulldown menu and select "Foo"
Release and let it repaint.
Then move the mouse over the menu again and it
immediately SEGfaults.

delete GLUI does nothing

https://sourceforge.net/p/glui/bugs/12/

GLUI, GLUI_Main, GLUI_Panel, etc all have trivial
destructors.
GLUI::close() calls GLUI_Main::close_internal(), which
calls delete this->main_panel and delete this, but
neither of those two calls actually does much. None of
the controls in the GLUI window get cleaned up.

GLUI_FileBrowser, changing directory

https://sourceforge.net/p/glui/patches/8/

Now GLUI_FileBrowser can't change directory even when you set set_allow_change_dir(true). E.g. example6.cpp

It is because
x selected[0]=='/',
o selected[last]=='/'.

This patch is for glui_filebrowser.cpp. This works fine on UNIX. Maybe selected[last]='\0' is also necessary on _WIN32.

31c31
<
#include <string.h>
81c81,82
< if (selected[0] == '/' || selected[0] == '\') {
> int last=strlen(selected)-1;
> if (selected[last] == '/' || selected[last] == '\\') {

84c85
< chdir(selected+1);
> chdir(selected);

87c88
< SetCurrentDirectory(selected+1);
>  SetCurrentDirectory(selected);

type clashes on Mac OS X

https://sourceforge.net/p/glui/bugs/25/

initial report

It seems that MacTypes.h:646 tries to redefine a type that has already been defined if is included.

i don't know if a precompiler command like #if !defined(MACTYPES) could fix this. So the types won't be redefined again.

The error message:
error: multiple types in one declaration
error: declaration does not declare anything

The line causing the error:

    typedef UInt8 Byte;

reply 1

Sorry for my early post. it seems like
glui.h line 75 and following define the
byte type and is the reason for the clash.

#ifndef Byte
#define Byte unsigned char
#endif

a simple #undef Byte directly after
#include <GLUI glui.h=""> fixed this.

Fix in glui.h

https://sourceforge.net/p/glui/patches/12/

Line 944 in glui.h should read

last_live_text = "";

rather than

last_live_text == "";

The existing line generates a compiler warning for an unused value on some compilers, e.g. Clang 3.1. A patch is attached.

diff --git a/src/include/GL/glui.h b/src/include/GL/glui.h
index 01a5c75..5784e29 100644
--- a/src/include/GL/glui.h
+++ b/src/include/GL/glui.h
@@ -941,7 +941,7 @@ public:
         spacebar_mouse_click = true;    /* Does spacebar simulate a mouse click? */
         live_type      = GLUI_LIVE_NONE;
         text = "";
-        last_live_text == "";
+        last_live_text = "";
         live_inited    = false;
         collapsible    = false;
         is_open        = true;

Build error in GLUI_CommandLine

https://sourceforge.net/p/glui/bugs/35/

When building on Visual Studio 2010, the following lines in the class GLUI_CommandLine give a compilation error:

template class GLUIAPI std::allocator<GLUI_String>;
template class GLUIAPI std::vector<GLUI_String, std::allocator<GLUI_String=""> >;

They must be moved outside of the class in order to build.

Thanks.

Quaternion multiply operator is broken

https://sourceforge.net/p/glui/bugs/29/

The quaternion multiply operator, implemented in quaternion.cpp, is wrongly implemented and will usually return the wrong result. It currently reads:

return quat( a.sb.s - a.vb.v, a.sb.v + b.sa.v + a.v^b.v )

This looks correct but unfortunately the precedence of the '^' operator, overloaded here to mean vector cross product, is lower than the '+' operator. Hence the above is actually parsed as

return quat( a.sb.s - a.vb.v, a.sb.v + (b.sa.v + a.v) ^ b.v )

which is completely different. Since the multiply operator is used to combine rotations, and rotations are the reason for using quaternion, any use of the quaternion class is pretty much doomed at present.

Since the arcball class uses the quaternion class, you might wonder how the arcball class can actually work in the presence of the above bug. The answer is that the arcball class only appears to use quaternions. In fact, the rotation calculations are done directly on rotation matrices, and the use of quaternions is largely spurious.

adding glui debug facility to glui

https://sourceforge.net/p/glui/patches/7/

Hi!
I made a patch for having usefull trace for glui
at this time writing the debug can be activated into Makefile at compile time

I will continue it and create a debug trace system that can be activated by ENV variable

can you integrate it into glui official? thanks
JLM

diff --git a/src/LICENSE.txt b/src/LICENSE.txt
old mode 100644
new mode 100755
diff --git a/src/algebra3.cpp b/src/algebra3.cpp
index 143c43f..f39c939 100755
--- a/src/algebra3.cpp
+++ b/src/algebra3.cpp
@@ -1172,16 +1172,16 @@ void mat3::print(FILE *file, const char *name) const
 {
     int i, j;

-    fprintf( stderr, "%s:\n", name );
+    //debug("%s:\n", name );

     for( i = 0; i < 3; i++ )
     {
-        fprintf( stderr, "   " );
+        //debug( "   " );
         for( j = 0; j < 3; j++ )
         {
-            fprintf( stderr, "%f  ", v[i][j] );
+            //debug( "%f  ", v[i][j] );
         }
-        fprintf( stderr, "\n" );
+        //debug("\n" );
     }
 }

@@ -1352,16 +1352,16 @@ void mat4::print(FILE *file, const char *name) const
 {
     int i, j;

-    fprintf( stderr, "%s:\n", name );
+    //debug("%s:\n", name );

     for( i = 0; i < 4; i++ )
     {
-        fprintf( stderr, "   " );
+        //debug("   " );
         for( j = 0; j < 4; j++ )
         {
-            fprintf( stderr, "%f  ", v[i][j] );
+            //debug( "%f  ", v[i][j] );
         }
-        fprintf( stderr, "\n" );
+        //debug( "\n" );
     }
 }

diff --git a/src/doc/doxygen.cfg b/src/doc/doxygen.cfg
old mode 100644
new mode 100755
diff --git a/src/doc/glui_manual.doc b/src/doc/glui_manual.doc
old mode 100644
new mode 100755
diff --git a/src/doc/glui_manual.pdf b/src/doc/glui_manual.pdf
old mode 100644
new mode 100755
diff --git a/src/example/example1.cpp b/src/example/example1.cpp
old mode 100644
new mode 100755
index 70985d3..1c356e4
--- a/src/example/example1.cpp
+++ b/src/example/example1.cpp
@@ -31,6 +31,7 @@ void myGlutIdle( void )
     glutSetWindow(main_window);  

   glutPostRedisplay();
+  usleep(100);
 }


diff --git a/src/example/example2.cpp b/src/example/example2.cpp
old mode 100644
new mode 100755
diff --git a/src/example/example3.cpp b/src/example/example3.cpp
old mode 100644
new mode 100755
index 459cfad..52652c4
--- a/src/example/example3.cpp
+++ b/src/example/example3.cpp
@@ -215,6 +215,7 @@ void myGlutIdle( void )
   counter++;

   glui->sync_live();
+  usleep(100);

 }

diff --git a/src/example/example4.cpp b/src/example/example4.cpp
old mode 100644
new mode 100755
index 7b58735..5f5af2c
--- a/src/example/example4.cpp
+++ b/src/example/example4.cpp
@@ -288,7 +288,7 @@ int main(int argc, char* argv[])
                               x, and y */

   /*** Add invisible panel to hold rest of controls ***/
-  GLUI_Panel *panel1 = new GLUI_Panel(glui, "", GLUI_PANEL_NONE );
+  GLUI_Panel *panel1 = new GLUI_Panel(glui, "panel1", GLUI_PANEL_NONE );

   obj_panel = new GLUI_Panel( panel1, "Objects" );

@@ -305,7 +305,7 @@ int main(int argc, char* argv[])
   scale_spinner->set_float_limits( .2f, 4.0 );
   scale_spinner->set_alignment( GLUI_ALIGN_RIGHT );

-  GLUI_Panel *panel2 = new GLUI_Panel( obj_panel, "", GLUI_PANEL_NONE );
+  GLUI_Panel *panel2 = new GLUI_Panel( obj_panel, "panel2", GLUI_PANEL_NONE );
   new GLUI_Checkbox( panel2, "Sphere", &show_sphere );
   new GLUI_Column( panel2 );
   new GLUI_Checkbox( panel2, "Torus", &show_torus );
diff --git a/src/example/example5.cpp b/src/example/example5.cpp
old mode 100644
new mode 100755
index 5b52b4e..65e4072
--- a/src/example/example5.cpp
+++ b/src/example/example5.cpp
@@ -172,6 +172,7 @@ void myGlutIdle( void )
                                        application  */

   glutPostRedisplay();
+  usleep(100);
 }

 /***************************************** myGlutMouse() **********/
diff --git a/src/example/example6.cpp b/src/example/example6.cpp
old mode 100644
new mode 100755
index 6111f1f..1233096
--- a/src/example/example6.cpp
+++ b/src/example/example6.cpp
@@ -67,18 +67,18 @@ const char commandline[] =
   "users can recall previous commands.\n";

 const char gstring[] = 
-  "GLUI_String\n"
+  "std::string\n"
   "\n"
   "The GLUI string class used to be wrapper class around \n"
   "a fixed 300 char buffer.\n"
-  "Now GLUI_String is just a typedef for std::string.\n"
+  "Now std::string is just a typedef for std::string.\n"
   "\n"
   "One new function has been introduced, which is a sprintf() equivalent\n"
-  "for std::string/GLUI_String.\n"
+  "for std::string/std::string.\n"
   "\n"
-  "  glui_format_str(GLUI_String& str, const char *format_str, ...);\n"
+  "  glui_format_str(std::string& str, const char *format_str, ...);\n"
   "\n"
-  "Other than the fact that it takes a GLUI_String as the first argument,\n"
+  "Other than the fact that it takes a std::string as the first argument,\n"
   "it works just like sprintf().\n";

 const char list[] =
@@ -157,7 +157,7 @@ const char text_box[] =

 void control_cb(int control) {
   int item;
-  GLUI_String text;
+  std::string text;
   std::string file_name;
   FILE  *file;
   char c;
@@ -278,11 +278,11 @@ int main(int argc, char* argv[])
   main_window = edit->get_glut_window_id();
   GLUI_Panel *ep = new GLUI_Panel(edit,"",true);
   new GLUI_StaticText(ep,"Widget Information:");
-  hah = new GLUI_List(ep,true,1,control_cb);
+  hah = new GLUI_List(ep,"hah", true,1,control_cb);
   hah->add_item(0,"GLUI 2.3");
   hah->add_item(1,"TextBox");
   hah->add_item(2,"Scrollbar");
-  hah->add_item(3,"GLUI_String");
+  hah->add_item(3,"std::string");
   hah->add_item(4,"CommandLine");
   hah->add_item(5,"Tree");
   hah->add_item(6,"List");
@@ -293,7 +293,7 @@ int main(int argc, char* argv[])
   hah->set_h(180);
   new GLUI_Column(ep,false); 

-  moo = new GLUI_TextBox(ep,true,1,textbox_cb);
+  moo = new GLUI_TextBox(ep, "moo", true,1,textbox_cb);
   moo->set_text(general);
   moo->set_h(400);
   moo->set_w(410);
diff --git a/src/glui.cpp b/src/glui.cpp
index 7b9bf47..729ff5d 100755
--- a/src/glui.cpp
+++ b/src/glui.cpp
@@ -220,7 +220,7 @@ void glui_display_func(void)
 {
   GLUI *glui;

-  /*  printf( "display func\n" );          */
+  debug( "display func\n" );

   glui = GLUI_Master.find_glui_by_window_id( glutGetWindow() );

@@ -242,7 +242,7 @@ void glui_reshape_func(int w,int h )
   GLUI_Glut_Window *glut_window;
   int               current_window;

-  /*printf( "glui_reshape_func(): %d  w/h: %d/%d\n", glutGetWindow(), w, h );          */
+  debug( "glui_reshape_func(): %d  w/h: %d/%d\n", glutGetWindow(), w, h );

   current_window = glutGetWindow();

@@ -285,7 +285,7 @@ void glui_keyboard_func(unsigned char key, int x, int y)
   current_window = glutGetWindow();
   glut_window = GLUI_Master.find_glut_window( current_window );

-  /*printf( "key: %d\n", current_window );          */
+  debug( "key: %d\n", current_window );

   if ( glut_window ) { /**  Was event in a GLUT window?  **/
     if ( GLUI_Master.active_control_glui AND GLUI_Master.active_control ) {
@@ -433,7 +433,7 @@ void glui_visibility_func(int state)
 {
   GLUI *glui;

-  /*  printf( "IN GLUI VISIBILITY()\n" );          */
+  debug( "IN GLUI VISIBILITY()\n" );
   /*  fflush( stdout );          */

   glui = GLUI_Master.find_glui_by_window_id( glutGetWindow() );
@@ -486,8 +486,10 @@ void glui_idle_func(void)
 /*********************************** GLUI_Master_Object::GLUI_Master_Object() ******/

 GLUI_Master_Object::GLUI_Master_Object()
-:  glui_id_counter(1),
-    glut_idle_CB(NULL)
+    :   glui_id_counter(1)
+    ,   glut_idle_CB(NULL)
+    ,   gluis("gluis")
+    ,   glut_windows("glut_windows")
 {
 }

@@ -512,7 +514,7 @@ GLUI *GLUI_Master_Object::create_glui_subwindow( int parent_window,
                           long flags )
 {
   GLUI *new_glui = new GLUI;
-  GLUI_String new_name;
+  std::string new_name;
   glui_format_str( new_name, "subwin_%p", this );

   new_glui->init( new_name.c_str(), flags | GLUI_SUBWINDOW, 0,0,
@@ -685,7 +687,7 @@ void    GLUI_Main::reshape( int reshape_w, int reshape_h )

   glViewport( 0, 0, new_w, new_h );

-  /*  printf( "%d: %d\n", glutGetWindow(), this->flags );          */
+  debug( "%d: %d\n", glutGetWindow(), this->flags );

   glutPostRedisplay();
 }
@@ -710,9 +712,9 @@ void    GLUI_Main::keyboard(unsigned char key, int x, int y)
       new_control = find_next_control( active_control );
     }

-    /*    if ( new_control )
-     printf( "new_control: %s\n", new_control->name );
-     */
+    if ( new_control ) {
+        debug( "new_control: %s\n", new_control->NodeName );
+   }

     deactivate_current_control();
     activate_control( new_control, GLUI_ACTIVATE_TAB );
@@ -753,7 +755,7 @@ void    GLUI_Main::mouse(int button, int state, int x, int y)
   int callthrough;
   GLUI_Control *control;

-  /*  printf( "MOUSE: %d %d\n", button, state );          */
+  debug( "MOUSE: %d %d\n", button, state );

   callthrough = true;

@@ -762,10 +764,12 @@ void    GLUI_Main::mouse(int button, int state, int x, int y)
   if ( button == GLUT_LEFT ) {
     control = find_control( x, y );

-    /*if ( control ) printf( "control: %s\n", control->name.c_str() );      */
-    
+    if ( control ) {
+        debug( "control: %s\n", control->NodeName );
+    }
+
     if ( mouse_button_down AND active_control != NULL AND
-        state == GLUT_UP ) 
+         state == GLUT_UP )
     {
       /** We just released the mouse, which was depressed at some control **/

@@ -824,7 +828,7 @@ void    GLUI_Main::motion(int x, int y)
   int           callthrough;
   GLUI_Control *control;

-  /*  printf( "MOTION: %d %d\n", x, y );          */
+  debug( "MOTION: %d %d\n", x, y );

   callthrough = true;

@@ -854,7 +858,7 @@ void    GLUI_Main::passive_motion(int x, int y)

   control = find_control( x, y );

-  /*  printf( "%p %p\n", control, mouse_over_control );          */
+  debug( "%p %p\n", control, mouse_over_control );

   if ( control != mouse_over_control ) {
     if ( mouse_over_control ) {
@@ -899,7 +903,7 @@ void    GLUI_Main::idle(void)
 {
   /*** Pass the idle event onto the active control, if any ***/

-  /*  printf( "IDLE \t" );          */
+  debug( "IDLE \t" );

   if ( active_control != NULL ) {
     /* First we check if the control actually needs the idle right now.
@@ -925,60 +929,60 @@ int  GLUI_Main::needs_idle( void )


 /******************************************* GLUI_Main::find_control() ******/
-
-GLUI_Control  *GLUI_Main::find_control( int x, int y )
+GLUI_Control  *GLUI_Main::find_control( int x, int y, GLUI_Control * parent )
 {
-  GLUI_Control *node, *last_container;
+    GLUI_Control *node, *found, *child;

-  last_container = NULL;
+    found = NULL;

-  node = main_panel;
-  while( node != NULL ) {
-    if ( !dynamic_cast<GLUI_Column*>(node) AND
-         PT_IN_BOX( x, y, 
-                    node->x_abs, node->x_abs + node->w, 
-                    node->y_abs, node->y_abs + node->h ) 
-         ) 
+    if( parent == NULL ) {
+        node = main_panel;
+    }
+    else
     {
-      /*** Point is inside current node ***/
-      
-      if ( node->first_child() == NULL ) {
-        /*** SPECIAL CASE: for edittext boxes, we make sure click is
-             in box, and not on name string.  This should be generalized
-             for all controls later... ***/
-        if ( dynamic_cast<GLUI_EditText*>(node) ) {
-          if ( x < node->x_abs + ((GLUI_EditText*)node)->text_x_offset )
-            return (GLUI_Control*) node->parent();
+        node = parent;
+    }
+    if ( PT_IN_BOX( x, y,
+                    node->x_abs, node->x_abs + node->w,
+                    node->y_abs, node->y_abs + node->h ) )
+    {
+        //debug ( "ctrl fits: '%s'\n", node->NodeName );
+        child = dynamic_cast<GLUI_Control *>(node->first_child());
+        if ( child != NULL )
+        {
+            //debug ( "ctrl '%s' has childs\n", node->NodeName );
+            do
+            {
+                found = find_control ( x, y, child);
+                if (NULL == found) child =  dynamic_cast<GLUI_Control *>(child->next());
+            }
+            while ( found == NULL && child != NULL );
         }
-
-        return node;   /* point is inside this node, and node has no children,
-                          so return this node as the selected node */
-      }
-      else {
-        /*** This is a container class ***/
-        last_container = node;
-        node = (GLUI_Control*) node->first_child();  /* Descend into child */
-      }
-      
+        if ( found == NULL ) found = node;
+
+        // SPECIAL CASE: for edittext boxes, we make sure click is
+        //  in box, and not on name string.  This should be generalized
+        //  for all controls later...
+        if ( dynamic_cast<GLUI_EditText*>(node) )
+        {
+            if ( x < node->x_abs + ((GLUI_EditText*)node)->text_x_offset )
+            {
+                return (GLUI_Control*) node->parent();
+            }
+        }
+        if( parent == NULL ) {
+            debug ( "found ctrl: '%s'\n",
+                    dynamic_cast<GLUI_Node*>(found)->whole_tree() );
+        }
+        return found;
     }
-    else {
-      node = (GLUI_Control*) node->next();
+    else
+    {
+        debug (" not in %s.... skipping the whole tree \n", node->NodeName);
+        return NULL;
     }
-  }
- 
-  /** No leaf-level nodes found to accept the mouse click, so
-      return the last container control found which DOES accept the click **/
-  
-  if ( last_container ) {
-    /*    printf( "ctrl: '%s'\n", last_container->name );          */
-  
-    return last_container;
-  }
-  else {
-    return NULL;
-  }
-}

+}

 /************************************* GLUI_Main::pack_controls() ***********/

@@ -1001,21 +1005,21 @@ void      GLUI_Main::pack_controls( void )

     glutSetWindow( orig_window );

-    /*     printf( "%d %d\n", parent_h, parent_w );          */
+    debug( "%d %d\n", parent_h, parent_w );

     if ( 1 ) {
-      if ( TEST_AND(this->flags,GLUI_SUBWINDOW_TOP )) {
-   main_panel->w = MAX( main_panel->w, parent_w );
-      }
-      else if ( TEST_AND(this->flags,GLUI_SUBWINDOW_LEFT )) {
-   main_panel->h = MAX( main_panel->h, parent_h );
-      }
-      else if ( TEST_AND(this->flags,GLUI_SUBWINDOW_BOTTOM )) {
-   main_panel->w = MAX( main_panel->w, parent_w );
-      }
-      else if ( TEST_AND(this->flags,GLUI_SUBWINDOW_RIGHT )) {
-   main_panel->h = MAX( main_panel->h, parent_h );
-      }
+        if ( TEST_AND(this->flags,GLUI_SUBWINDOW_TOP )) {
+            main_panel->w = MAX( main_panel->w, parent_w );
+        }
+        else if ( TEST_AND(this->flags,GLUI_SUBWINDOW_LEFT )) {
+            main_panel->h = MAX( main_panel->h, parent_h );
+        }
+        else if ( TEST_AND(this->flags,GLUI_SUBWINDOW_BOTTOM )) {
+            main_panel->w = MAX( main_panel->w, parent_w );
+        }
+        else if ( TEST_AND(this->flags,GLUI_SUBWINDOW_RIGHT )) {
+            main_panel->h = MAX( main_panel->h, parent_h );
+        }
     }
   }

@@ -1139,7 +1143,7 @@ GLUI_Main::GLUI_Main( void )
   bkgd_color_f[2] = b / 255.0f;

   /*** Create the main panel ***/
-  main_panel              = new GLUI_Panel;
+  main_panel              = new GLUI_Panel("root panel");
   main_panel->set_int_val( GLUI_PANEL_NONE );
   main_panel->glui        = (GLUI*) this;
   main_panel->name        = "\0";
@@ -1232,7 +1236,7 @@ void         GLUI_Main::activate_control( GLUI_Control *control, int how )
     active_control = NULL;
   }

-  /*  printf( "activate: %d\n", glutGetWindow() );          */
+  debug( "activate: %d\n", glutGetWindow() );
   GLUI_Master.active_control      = active_control;
   GLUI_Master.active_control_glui = (GLUI*) this;
 }
@@ -1263,7 +1267,7 @@ void         GLUI_Main::deactivate_current_control( void )
     active_control = NULL;
   }

-  /*  printf( "deactivate: %d\n", glutGetWindow() );          */
+  debug( "deactivate: %d\n", glutGetWindow() );
   GLUI_Master.active_control      = NULL;
   GLUI_Master.active_control_glui = NULL;
 }
@@ -1696,7 +1700,7 @@ void glui_parent_window_reshape_func( int w, int h )
   GLUI  *glui;
   int   first = true;

-  /*  printf( "glui_parent_window_reshape_func: %d\n", glutGetWindow() );          */
+  debug( "glui_parent_window_reshape_func: %d\n", glutGetWindow() );

   current_window = glutGetWindow();

@@ -1724,7 +1728,7 @@ void glui_parent_window_reshape_func( int w, int h )

 void glui_parent_window_keyboard_func(unsigned char key, int x, int y)
 {
-  /*  printf( "glui_parent_window_keyboard_func: %d\n", glutGetWindow() );          */
+  debug( "glui_parent_window_keyboard_func: %d\n", glutGetWindow() );

   int   current_window;
   GLUI  *glui;
@@ -1759,7 +1763,7 @@ void glui_parent_window_keyboard_func(unsigned char key, int x, int y)

 void glui_parent_window_special_func(int key, int x, int y)
 {
-  /*printf( "glui_parent_window_special_func: %d\n", glutGetWindow() );          */
+  debug( "glui_parent_window_special_func: %d\n", glutGetWindow() );

   int   current_window;
   GLUI  *glui;
@@ -1994,8 +1998,9 @@ void     GLUI_Master_Object::get_viewport_area( int *x, int *y,
     if ( TEST_AND( curr_glui->flags, GLUI_SUBWINDOW) AND 
     curr_glui->parent_window == curr_window ) {

-      /*           printf( "%s -> %d   %d %d\n", curr_glui->window_name.c_str(), curr_glui->flags,
-               curr_glui->w, curr_glui->h );*/
+// this debug line cause obscure segfaulting.... the NodeName seems to be corrupted
+//      debug( "%s -> %d   %d %d\n", curr_glui->NodeName, curr_glui->flags,
+//             curr_glui->w, curr_glui->h );

       if ( TEST_AND( curr_glui->flags,GLUI_SUBWINDOW_LEFT ) ) {
    curr_x += curr_glui->w;
diff --git a/src/glui_add_controls.cpp b/src/glui_add_controls.cpp
index ecf72b9..68474b8 100755
--- a/src/glui_add_controls.cpp
+++ b/src/glui_add_controls.cpp
@@ -78,21 +78,23 @@ GLUI_Panel *GLUI::add_panel_to_panel( GLUI_Panel *parent_panel,
 /***************************** GLUI::add_radiogroup() ***************/

 GLUI_RadioGroup *GLUI::add_radiogroup( int *value_ptr,
-                      int user_id, GLUI_CB callback)
+                      int user_id, GLUI_CB callback,
+                       const char* name )
 {
   return add_radiogroup_to_panel( main_panel, value_ptr,
-                 user_id, callback );
+                 user_id, callback, name );
 }


 /***************************** GLUI::add_radiogroup_to_panel() ***************/

-GLUI_RadioGroup *GLUI::add_radiogroup_to_panel(  
+GLUI_RadioGroup *GLUI::add_radiogroup_to_panel(
   GLUI_Panel *panel, int *value_ptr,
-  int user_id, GLUI_CB callback
+  int user_id, GLUI_CB callback,
+  const char* name
   )
 {
-  return new GLUI_RadioGroup( panel, value_ptr, user_id, callback );
+  return new GLUI_RadioGroup( panel, value_ptr, user_id, callback, name );
 }


@@ -181,7 +183,7 @@ GLUI_EditText  *GLUI::add_edittext_to_panel( GLUI_Panel *panel,
 /********************************** GLUI::add_edittext() ************/

 GLUI_EditText  *GLUI::add_edittext( const char *name, 
-                                    GLUI_String & data,
+                                    std::string & data,
                                     int id, GLUI_CB callback)
 {
   return add_edittext_to_panel( main_panel, name, data, id, callback );
@@ -192,7 +194,7 @@ GLUI_EditText  *GLUI::add_edittext( const char *name,

 GLUI_EditText*
 GLUI::add_edittext_to_panel( GLUI_Panel *panel, const char *name, 
-                             GLUI_String& data,
+                             std::string& data,
                              int id, GLUI_CB callback)
 {
   return new GLUI_EditText( panel, name, GLUI_EDITTEXT_STRING, &data, id, callback );
diff --git a/src/glui_button.cpp b/src/glui_button.cpp
index a414cd8..ef0ca26 100755
--- a/src/glui_button.cpp
+++ b/src/glui_button.cpp
@@ -33,12 +33,14 @@
 /****************************** GLUI_Button::GLUI_Button() **********/

 GLUI_Button::GLUI_Button( GLUI_Node *parent, const char *name,
-                          int id, GLUI_CB cb )
+                          int id, GLUI_CB cb ):
+    GLUI_Control(name)
+
 {
   common_init();
   user_id     = id;
   callback    = cb;
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   currently_inside = false; 

   parent->add_control( this );
diff --git a/src/glui_checkbox.cpp b/src/glui_checkbox.cpp
index 12d619e..6911f4d 100755
--- a/src/glui_checkbox.cpp
+++ b/src/glui_checkbox.cpp
@@ -39,12 +39,12 @@
 GLUI_Checkbox::GLUI_Checkbox( GLUI_Node *parent,
                               const char *name, int *value_ptr,
                               int id, 
-                              GLUI_CB cb )
+                              GLUI_CB cb ): GLUI_Control(name)
 {
   common_init();

   set_ptr_val( value_ptr );
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   user_id    = id;
   callback   = cb;

diff --git a/src/glui_column.cpp b/src/glui_column.cpp
index 8932fed..88a1110 100755
--- a/src/glui_column.cpp
+++ b/src/glui_column.cpp
@@ -35,6 +35,7 @@
 /******************************** GLUI_Column::GLUI_Column() ************/

 GLUI_Column::GLUI_Column( GLUI_Node *parent, int draw_bar )
+    : GLUI_Control ("Column")
 {
   common_init();
   int_val = draw_bar; /* Whether to draw vertical bar or not */
diff --git a/src/glui_commandline.cpp b/src/glui_commandline.cpp
index 1237fcb..5b10570 100755
--- a/src/glui_commandline.cpp
+++ b/src/glui_commandline.cpp
@@ -36,9 +36,10 @@
 /****************************** GLUI_CommandLine::GLUI_CommandLine() **********/
 GLUI_CommandLine::GLUI_CommandLine( GLUI_Node *parent, const char *name, 
                                     void *data, int id, GLUI_CB cb )
+    : GLUI_EditText (name)
 {
   common_init();
-  set_name( name );
+  set_name( const_cast<char*>(name) );

   data_type   = GLUI_EDITTEXT_TEXT;
   ptr_val     = data;
diff --git a/src/glui_control.cpp b/src/glui_control.cpp
index 0542fdb..85030d4 100755
--- a/src/glui_control.cpp
+++ b/src/glui_control.cpp
@@ -194,11 +194,13 @@ void GLUI_Control::draw_recursive( int x, int y )
 {
   GLUI_Control *node;

-  /*  printf( "%s %d\n", this->name.c_str(), this->hidden );*/
+  debug ( "%s %s hidden(%d)\n",__func__,
+          dynamic_cast<GLUI_Node*>(this)->whole_tree(),
+          this->hidden );
   if ( NOT can_draw() )
     return;

-  /*if ( 1 ) {  --  Debugging to check control width  
+  /*if ( 1 ) {  --  Debugging to check control width
     glColor3f( 1.0, 0.0, 0.0 );
     glBegin( GL_LINES );
     glVertex2i( x_abs, y_abs );00
@@ -210,20 +212,20 @@ void GLUI_Control::draw_recursive( int x, int y )
   glMatrixMode( GL_MODELVIEW );
   glPushMatrix();

-  glTranslatef( (float) this->x_abs + .5, 
-       (float) this->y_abs + .5, 
-       0.0 );
+  glTranslatef( (float) this->x_abs + .5,
+          (float) this->y_abs + .5,
+          0.0 );

   if ( NOT _glui_draw_border_only ) {
     if ( NOT strcmp( name.c_str(), "Rollout" ) ) {
     }

     this->draw( this->x_off, this->y_off_top );
-  } 
-  else 
+  }
+  else
   {
     if ( dynamic_cast<GLUI_Column*>(this) ) {
-      /*   printf( "%s w/h:   %d/%d\n", (char*) name, w, h );              */
+      debug ( "%s w/h:   %d/%d\n", name.c_str(), w, h );
       /*w = 2;              */
     }

@@ -235,7 +237,7 @@ void GLUI_Control::draw_recursive( int x, int y )
     glEnd();
   }
   glPopMatrix();
-  
+
   node = (GLUI_Control*) first_child();
   while( node ) {
     node->draw_recursive( node->x_abs, node->y_abs );
@@ -782,7 +784,7 @@ void GLUI_Control::sync_live(int recurse, int draw_it)
       callbacks ***/
     if ( 0 ) { /* THIS CODE BELOW SHOULD NOT BE EXECUTED */
       if ( glui->mouse_button_down ) {
-   /* printf( "Can't sync\n" );              */
+   debug( "Can't sync\n" );
    return;
       }
     }
@@ -1030,8 +1032,9 @@ void  GLUI_Control::get_float_array_val( float *array_ptr )

 /**** GLUI_Control::set_name() ********************/

-void   GLUI_Control::set_name( const char *str )
+void   GLUI_Control::set_name( char *str )
 {
+  name.clear();
   name = str;
   redraw(); 
 }
@@ -1183,13 +1186,13 @@ void         GLUI_Control::unhide_internal( int recurse )

   node = (GLUI_Node *) this;
   while( node != NULL ) {
-    /*    printf( "unhide: %s [%d]\n", ((GLUI_Control*)node)->name.c_str(), 
-       ((GLUI_Control*)node)->hidden );*/
+    debug( "unhide: %s [%d]\n", ((GLUI_Control*)node)->name.c_str(),
+       ((GLUI_Control*)node)->hidden );
     ((GLUI_Control*)node)->hidden = false;

-    if ( recurse AND node->first_child() != NULL )  
+    if ( recurse AND node->first_child() != NULL )
       ((GLUI_Control*) node->first_child())->unhide_internal(true);
-      
+
     node = node->next();
   }

@@ -1197,9 +1200,9 @@ void         GLUI_Control::unhide_internal( int recurse )
   while( node != NULL ) {
     ((GLUI_Control*)node)->hidden = false;

-    if ( recurse AND node->first_child() != NULL )  
+    if ( recurse AND node->first_child() != NULL )
       ((GLUI_Control*) node->first_child())->unhide_internal(true);
-      
+
     node = node->next();
   }
 }
diff --git a/src/glui_edittext.cpp b/src/glui_edittext.cpp
index 3f2865c..a4a0fce 100755
--- a/src/glui_edittext.cpp
+++ b/src/glui_edittext.cpp
@@ -38,7 +38,8 @@

 GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,
                              int data_type, void *live_var,
-                             int id, GLUI_CB callback )
+                             int id, GLUI_CB callback ) :
+    GLUI_Control(name)
 {
   if (data_type == GLUI_EDITTEXT_TEXT) {
     live_type = GLUI_LIVE_TEXT;
@@ -61,7 +62,9 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,
 /****************************** GLUI_EditText::GLUI_EditText() **********/

 GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,
-                              int text_type, int id, GLUI_CB callback )
+                              int text_type, int id, GLUI_CB callback ):
+    GLUI_Control(name)
+
 {
   common_construct( parent, name, text_type, GLUI_LIVE_NONE, 0, id, callback);
 }
@@ -70,7 +73,9 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,

 GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,
                               int *live_var,
-                              int id, GLUI_CB callback )
+                              int id, GLUI_CB callback ):
+    GLUI_Control(name)
+
 {
   common_construct( parent, name, GLUI_EDITTEXT_INT, GLUI_LIVE_INT, live_var, id, callback);
 }
@@ -79,7 +84,9 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,

 GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,
                               float *live_var,
-                              int id, GLUI_CB callback )
+                              int id, GLUI_CB callback ):
+    GLUI_Control(name)
+
 {
   common_construct( parent, name, GLUI_EDITTEXT_FLOAT, GLUI_LIVE_FLOAT, live_var, id, callback);
 }
@@ -88,7 +95,9 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,

 GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name, 
                               char *live_var,
-                              int id, GLUI_CB callback )
+                              int id, GLUI_CB callback ):
+    GLUI_Control(name)
+
 {
   common_construct( parent, name, GLUI_EDITTEXT_TEXT, GLUI_LIVE_TEXT, live_var, id, callback);
 }
@@ -97,7 +106,9 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name,

 GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name, 
                               std::string &live_var,
-                              int id, GLUI_CB callback )
+                              int id, GLUI_CB callback ):
+    GLUI_Control(name)
+
 {
   common_construct( parent, name, GLUI_EDITTEXT_TEXT, GLUI_LIVE_STRING, &live_var, id, callback);
 }
@@ -109,7 +120,7 @@ void GLUI_EditText::common_construct( GLUI_Node *parent, const char *name,
                                       GLUI_CB cb )
 {
   common_init();
-  set_name( name );
+  set_name( const_cast<char*>(name) );

   live_type   = live_t;
   data_type   = data_t;
@@ -308,7 +319,7 @@ int    GLUI_EditText::key_handler( unsigned char key,int modifiers )
     }
     else if ( key == CTRL('k') ) { /* KILL TO END OF LINE */
       sel_start = sel_end = insertion_pt;
-      text.erase(insertion_pt,GLUI_String::npos);
+      text.erase(insertion_pt,std::string::npos);
     }
   }
   else if ( modifiers == GLUT_ACTIVE_ALT ) /* ALT ONLY */
@@ -349,7 +360,7 @@ int    GLUI_EditText::key_handler( unsigned char key,int modifiers )
       }

       if ( key == '.' ) {
-        /*printf( "PERIOD: %d\n", num_periods );              */
+        debug( "PERIOD: %d\n", num_periods );

         if ( num_periods > 0 ) {
           /** We're trying to type a period, but the text already contains
@@ -359,7 +370,7 @@ int    GLUI_EditText::key_handler( unsigned char key,int modifiers )
           int period_found = false; 
           if ( sel_start != sel_end ) {
             for( i=MIN(sel_end,sel_start); i<MAX(sel_start,sel_end); i++ ) {
-              /*  printf( "%c ", text[i] );              */
+              debug( "%c ", text[i] );
               if ( text[i] == '.' ) {
                 period_found = true;
                 break;
@@ -367,7 +378,7 @@ int    GLUI_EditText::key_handler( unsigned char key,int modifiers )
             }
           }

-          /* printf( "found: %d    num: %d\n", period_found, num_periods );              */
+          debug( "found: %d    num: %d\n", period_found, num_periods );

           if ( NOT period_found )
             return true;
@@ -670,10 +681,10 @@ void    GLUI_EditText::draw_text( int x, int y )

   text_x = text_x_offset + 2 + GLUI_EDITTEXT_BOXINNERMARGINX;

-  /*printf( "text_x: %d      substr_width: %d     start/end: %d/%d\n",
+  debug( "text_x: %d      substr_width: %d     start/end: %d/%d\n",
     text_x,     substring_width( substring_start, substring_end ),
     substring_start, substring_end );
-    */
+
   /** Find lower and upper selection bounds **/
   sel_lo = MIN(sel_start, sel_end );
   sel_hi = MAX(sel_start, sel_end );
@@ -767,7 +778,7 @@ int  GLUI_EditText::find_insertion_pt( int x, int y )
     curr_x -= char_width( text[i] );

     if ( x > curr_x ) {
-      /*      printf( "-> %d\n", i );              */
+      debug( "-> %d\n", i );

       return i+1;
     }
@@ -805,7 +816,7 @@ void     GLUI_EditText::draw_insertion_pt( void )
     return;  /* Don't draw insertion point if there is a current selection */
   }

-  /*    printf( "insertion pt: %d\n", insertion_pt );              */
+  debug( "insertion pt: %d\n", insertion_pt );

   curr_x = this->x_abs + text_x_offset 
     + substring_width( substring_start, substring_end )
@@ -860,7 +871,7 @@ void   GLUI_EditText::update_and_draw_text( void )
     return;

   update_substring_bounds();
-  /*  printf( "ss: %d/%d\n", substring_start, substring_end );                  */
+  debug( "ss: %d/%d\n", substring_start, substring_end );

   redraw();
 }
@@ -872,11 +883,10 @@ int    GLUI_EditText::special_handler( int key,int modifiers )
 {
   if ( NOT glui )
     return false;
-  
-  if ( debug )
-    printf( "SPECIAL:%d - mod:%d   subs:%d/%d  ins:%d  sel:%d/%d\n", 
+
+   debug( "SPECIAL:%d - mod:%d   subs:%d/%d  ins:%d  sel:%d/%d\n",
        key, modifiers, substring_start, substring_end,insertion_pt,
-       sel_start, sel_end );    
+       sel_start, sel_end );

   if ( key == GLUT_KEY_LEFT ) {
     if ( (modifiers & GLUT_ACTIVE_CTRL) != 0 ) {
@@ -1192,7 +1202,7 @@ int    GLUI_EditText::mouse_over( int state, int x, int y )
     glutSetCursor( GLUT_CURSOR_TEXT );
   }
   else {
-    /*    printf( "OUT\n" );              */
+    debug ( "OUT\n" );
     glutSetCursor( GLUT_CURSOR_LEFT_ARROW );
   }

diff --git a/src/glui_filebrowser.cpp b/src/glui_filebrowser.cpp
index 20980e3..6cab110 100755
--- a/src/glui_filebrowser.cpp
+++ b/src/glui_filebrowser.cpp
@@ -48,17 +48,18 @@ GLUI_FileBrowser::GLUI_FileBrowser( GLUI_Node *parent,
                                     const char *name,
                                     int type,
                                     int id,
-                                    GLUI_CB cb)
+                                    GLUI_CB cb) :
+    GLUI_Panel(name)
 {
   common_init();

-  set_name( name );
+  set_name( const_cast<char*>(name) );
   user_id    = id;
   int_val    = type;
   callback   = cb;

   parent->add_control( this );
-  list = new GLUI_List(this, true, 1);
+  list = new GLUI_List(this, "FileBrowser list", true, 1);
   list->set_object_callback( GLUI_FileBrowser::dir_list_callback, this );
   list->set_click_type(GLUI_DOUBLE_CLICK);
   this->fbreaddir(this->current_dir.c_str());
@@ -98,7 +99,7 @@ void GLUI_FileBrowser::dir_list_callback(GLUI_Control *glui_object) {


 void GLUI_FileBrowser::fbreaddir(const char *d) {
-  GLUI_String item;
+  std::string item;
   int i = 0;

    if (!d)
@@ -148,7 +149,7 @@ void GLUI_FileBrowser::fbreaddir(const char *d) {
       while ((dirp = readdir(dir)) != NULL)   /* open directory     */
       { 
         if (!lstat(dirp->d_name,&dr) && S_ISDIR(dr.st_mode)) /* dir is directory   */
-          item = dirp->d_name + GLUI_String("/");
+          item = dirp->d_name + std::string("/");
         else
           item = dirp->d_name;

diff --git a/src/glui_internal.h b/src/glui_internal.h
old mode 100644
new mode 100755
diff --git a/src/glui_internal_control.h b/src/glui_internal_control.h
old mode 100644
new mode 100755
diff --git a/src/glui_list.cpp b/src/glui_list.cpp
index 15b5501..29950e9 100755
--- a/src/glui_list.cpp
+++ b/src/glui_list.cpp
@@ -34,10 +34,11 @@

 /****************************** GLUI_List::GLUI_List() **********/

-GLUI_List::GLUI_List( GLUI_Node *parent, bool scroll,
+GLUI_List::GLUI_List( GLUI_Node *parent, const char* name, bool scroll,
                       int id, GLUI_CB callback
                       /*,GLUI_Control *object 
                       GLUI_InterObject_CB obj_cb*/)
+    : GLUI_Control (name)
 {
   common_construct(parent, NULL, scroll, id, callback/*, object, obj_cb*/);
 }
@@ -45,11 +46,13 @@ GLUI_List::GLUI_List( GLUI_Node *parent, bool scroll,
 /****************************** GLUI_List::GLUI_List() **********/

 GLUI_List::GLUI_List( GLUI_Node *parent,
-                      GLUI_String& live_var, bool scroll, 
-                      int id, 
-                      GLUI_CB callback 
+                      const char* name,
+                      std::string& live_var, bool scroll,
+                      int id,
+                      GLUI_CB callback
                       /* ,GLUI_Control *object
                       ,GLUI_InterObject_CB obj_cb*/ )
+    : GLUI_Control (name)
 {
   common_construct(parent, &live_var, scroll, id, callback/*, object, obj_cb*/);
 }
@@ -58,8 +61,8 @@ GLUI_List::GLUI_List( GLUI_Node *parent,

 void GLUI_List::common_construct(
   GLUI_Node *parent,
-  GLUI_String* data, bool scroll, 
-  int id, 
+  std::string* data, bool scroll,
+  int id,
   GLUI_CB callback
   /*,GLUI_Control *object
   , GLUI_InterObject_CB obj_cb*/)
diff --git a/src/glui_listbox.cpp b/src/glui_listbox.cpp
index 36ca881..73c771e 100755
--- a/src/glui_listbox.cpp
+++ b/src/glui_listbox.cpp
@@ -38,11 +38,12 @@ GLUI_Listbox::GLUI_Listbox( GLUI_Node *parent,
                             const char *name, int *value_ptr,
                             int id, 
                             GLUI_CB cb)
+    : GLUI_Control(name)
 {
   common_init();
   set_ptr_val( value_ptr );
   user_id    = id;
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   callback    = cb;

   parent->add_control( this );
@@ -229,7 +230,7 @@ void     GLUI_Listbox::dump( FILE *output )
 {
   GLUI_Listbox_Item *item;

-  /*  printf( "%p\n", (char*) name );              */
+  debug( "%p\n", name.c_str() );

   fprintf( output, "Listbox: %s\n", name.c_str() );

@@ -305,12 +306,12 @@ int     GLUI_Listbox::mouse_over( int state, int x, int y )
 {
   GLUI_Listbox_Item *item;

-  /*  printf( "x/y:   %d/%d\n", x, y );              */
+  debug( "x/y:   %d/%d\n", x, y );

   if ( state AND enabled AND x > x_abs + text_x_offset) {
     /****  Build a GLUT menu for this listbox   ***/

-    /* printf( "%d %d\n", x, y );              */
+    debug( "%d %d\n", x, y );

     glut_menu_id = glutCreateMenu(listbox_callback);

@@ -325,7 +326,7 @@ int     GLUI_Listbox::mouse_over( int state, int x, int y )
     GLUI_Master.set_left_button_glut_menu_control( this );
   }
   else if ( glut_menu_id != -1 ) {
-    /*    printf( "OUT\n" );              */
+    debug( "OUT\n" );
     glutDetachMenu( GLUT_LEFT_BUTTON );
     glutDestroyMenu( glut_menu_id );
     glut_menu_id = -1;
@@ -359,7 +360,7 @@ int    GLUI_Listbox::do_selection( int item_num )
   if ( NOT sel_item )
     return false;

-  /*  printf( "-> %s\n", (char*) sel_item->text );              */
+  debug( "-> %s\n", sel_item->text.c_str() );

   int_val = item_num;
   curr_text = sel_item->text;
diff --git a/src/glui_node.cpp b/src/glui_node.cpp
index a701026..9bac335 100755
--- a/src/glui_node.cpp
+++ b/src/glui_node.cpp
@@ -46,6 +46,16 @@ GLUI_Node::GLUI_Node()
 {
 }

+GLUI_Node::GLUI_Node(const char* name)
+{
+    NodeName = name;
+    parent_node = NULL;
+    child_head = NULL;
+    child_tail = NULL;
+    next_sibling = NULL;
+    prev_sibling = NULL;
+}
+
 /********************************************* GLUI_Node::first() *******/
 /* Returns first sibling in 'this' node's sibling list                  */

@@ -203,12 +213,30 @@ void   GLUI_Node::unlink( void )

 void GLUI_Node::dump( FILE *out, const char *name )
 {
-    fprintf( out, "GLUI_node: %s\n", name );
-    fprintf( out, "   parent: %p     child_head: %p    child_tail: %p\n",
+    debug( "GLUI_node: %s\n", name );
+    debug( "   parent: %p     child_head: %p    child_tail: %p\n",
         (void *) parent_node,
         (void *) child_head,
         (void *) child_tail );
-    fprintf( out, "   next: %p       prev: %p\n",
+    debug( "   next: %p       prev: %p\n",
         (void *) next_sibling,
         (void *) prev_sibling );
 }
+
+const char* GLUI_Node::whole_tree(int start)
+{
+    static std::string tree;
+    if (start) {
+        tree.clear();
+        tree += "\"";
+    }
+    if (parent_node != NULL) {
+        parent_node->whole_tree(0);
+        tree += ".";
+    }
+    tree += NodeName;
+    if (start) {
+        tree += "\"";
+    }
+    return tree.c_str();
+}
diff --git a/src/glui_panel.cpp b/src/glui_panel.cpp
index 5c3b116..e0a0def 100755
--- a/src/glui_panel.cpp
+++ b/src/glui_panel.cpp
@@ -33,10 +33,10 @@

 #include "glui_internal_control.h"

-GLUI_Panel::GLUI_Panel( GLUI_Node *parent, const char *name, int type )
+GLUI_Panel::GLUI_Panel( GLUI_Node *parent, const char *name, int type ): GLUI_Control(name)
 {
   common_init();
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   user_id    = -1;
   int_val    = type;

@@ -142,9 +142,10 @@ void    GLUI_Panel::draw( int x, int y )

 /****************************** GLUI_Panel::set_name() **********/

-void    GLUI_Panel::set_name( const char *new_name )
+void    GLUI_Panel::set_name( char *new_name )
 {
-  name = new_name ? new_name : "";
+  name.clear();
+  name=new_name;

   update_size();

diff --git a/src/glui_radio.cpp b/src/glui_radio.cpp
index 4b81f3f..3a07170 100755
--- a/src/glui_radio.cpp
+++ b/src/glui_radio.cpp
@@ -38,10 +38,13 @@

 GLUI_RadioGroup::GLUI_RadioGroup(GLUI_Node *parent,
                                  int *value_ptr,
-                                 int id, GLUI_CB cb)
+                                 int id, GLUI_CB cb,
+                                 const char* name ):
+    GLUI_Control(name)
+
 {
   common_init();
-  GLUI_String      buf;
+  std::string      buf;

   set_ptr_val( value_ptr );
   if ( value_ptr ) {
@@ -54,7 +57,7 @@ GLUI_RadioGroup::GLUI_RadioGroup(GLUI_Node *parent,

   user_id    = id;
   glui_format_str( buf, "RadioGroup: %p", this );
-  set_name( buf.c_str() );
+  set_name( const_cast<char*>(buf.c_str()) );
   callback   = cb;

   parent->add_control( this );
@@ -109,7 +112,7 @@ void    GLUI_RadioGroup::draw_group( int translate )

 /****************************** GLUI_RadioGroup::set_name() **********/

-void    GLUI_RadioGroup::set_name( const char *text )
+void    GLUI_RadioGroup::set_name( char *text )
 {
   name = text;

@@ -146,7 +149,8 @@ void    GLUI_RadioGroup::set_selected( int int_val )

 /************************ GLUI_RadioButton::GLUI_RadioButton() **********/

-GLUI_RadioButton::GLUI_RadioButton( GLUI_RadioGroup *grp, const char *name )
+GLUI_RadioButton::GLUI_RadioButton( GLUI_RadioGroup *grp, const char *name ) :
+    GLUI_Control(name)
 {
   common_init();

@@ -155,7 +159,7 @@ GLUI_RadioButton::GLUI_RadioButton( GLUI_RadioGroup *grp, const char *name )
   /** A radio button's user id is always its ordinal number (zero-indexed)
       within the group */
   user_id    = grp->num_buttons;
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   group = grp;

   group->num_buttons++;   /* Increments radiogroup's button count */
diff --git a/src/glui_rollout.cpp b/src/glui_rollout.cpp
index 559d2bf..cdf5292 100755
--- a/src/glui_rollout.cpp
+++ b/src/glui_rollout.cpp
@@ -38,10 +38,12 @@ enum {rollout_height_pixels=GLUI_DEFAULT_CONTROL_HEIGHT + 7};
 /****************************** GLUI_Rollout::GLUI_Rollout() **********/

 GLUI_Rollout::GLUI_Rollout( GLUI_Node *parent, const char *name, 
-                            int open, int type )
+                            int open, int type ) :
+    GLUI_Panel(name),
+    button("")
 {
   common_init();
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   user_id    = -1;
   int_val    = type;

diff --git a/src/glui_rotation.cpp b/src/glui_rotation.cpp
index b367ac8..b0ba1e1 100755
--- a/src/glui_rotation.cpp
+++ b/src/glui_rotation.cpp
@@ -47,7 +47,7 @@ int    GLUI_Rotation::iaction_mouse_down_handler( int local_x, int local_y )

   ball->mouse_down( local_x, local_y );

-  /*   printf( "%d %d - %f %f\n", local_x, local_y, ball->center[0], ball->center[1] );              */
+  debug( "%d %d - %f %f\n", local_x, local_y, ball->center[0], ball->center[1] );

   copy_ball_to_float_array();

@@ -82,7 +82,7 @@ int    GLUI_Rotation::iaction_mouse_held_down_handler( int local_x, int local_y,

   local_y = (int) floor(2.0 * ball->center[1] - local_y);

-  /*   printf( "%d %d\n", local_x, local_y );              */
+  debug( "%d %d\n", local_x, local_y );

   ball->mouse_motion( local_x, local_y, 0, 
             (glui->curr_modifiers & GLUT_ACTIVE_ALT) != 0, 
@@ -186,7 +186,8 @@ int    GLUI_Rotation::iaction_special_handler( int key,int modifiers )

 void  GLUI_Rotation::init_ball( void )
 {
-  /*printf( "%f %f %f", float( MIN(w/2,h/2)), (float) w/2, (float) h/2 );              */
+  debug( "GLUI_Rotation::init_ball %f %f %f\n",
+          float( MIN(w/2,h/2)), (float) w/2, (float) h/2 );

   ball->set_params( vec2( (float)(w/2), (float)((h-18)/2)), 
           (float) 2.0*(h-18) );
@@ -420,11 +421,12 @@ GLUI_Rotation::GLUI_Rotation( GLUI_Node *parent,
                               const char *name, float *value_ptr,
                               int id, 
                               GLUI_CB cb )
+    : GLUI_Mouse_Interaction (name)
 {
   common_init();
   set_ptr_val( value_ptr );
   user_id    = id;
-  set_name( name );
+  set_name( const_cast<char*>( name ));
   callback    = cb;
   parent->add_control( this );
   init_live();
diff --git a/src/glui_scrollbar.cpp b/src/glui_scrollbar.cpp
index 1a0e6a2..2a49ad5 100755
--- a/src/glui_scrollbar.cpp
+++ b/src/glui_scrollbar.cpp
@@ -55,6 +55,7 @@ GLUI_Scrollbar::GLUI_Scrollbar( GLUI_Node *parent,
                                 /*,GLUI_Control *object
                                 ,GLUI_InterObject_CB obj_cb*/
                                 )
+    : GLUI_Control (name)
 {
   common_construct(parent, name, horz_vert, data_type, NULL, id, callback/*, object, obj_cb*/);
 }
@@ -68,6 +69,7 @@ GLUI_Scrollbar::GLUI_Scrollbar( GLUI_Node *parent, const char *name,
                                 /*,GLUI_Control *object
                                 ,GLUI_InterObject_CB obj_cb*/
                                 )
+    : GLUI_Control (name)
 {
   common_construct(parent, name, horz_vert, GLUI_SCROLL_INT, live_var, id, callback/*, object, obj_cb*/);
 }
@@ -81,6 +83,7 @@ GLUI_Scrollbar::GLUI_Scrollbar( GLUI_Node *parent, const char *name,
                                 /*,GLUI_Control *object
                                 ,GLUI_InterObject_CB obj_cb*/
                                 )
+    : GLUI_Control (name)
 {
   common_construct(parent, name, horz_vert, GLUI_SCROLL_FLOAT, live_var, id, callback/*, object, obj_cb*/);
 }
@@ -152,7 +155,7 @@ void GLUI_Scrollbar::common_construct(
   }
   this->data_type = data_type;
   this->set_ptr_val( data );
-  this->set_name(name);
+  this->set_name( const_cast<char*>(name));
   this->user_id = id;
   this->callback    = callback;
   //this->associated_object = object;
@@ -177,9 +180,9 @@ int    GLUI_Scrollbar::mouse_down_handler( int local_x, int local_y )
   this->state = find_arrow( local_x, local_y );
   GLUI_Master.glui_setIdleFuncIfNecessary();

-  /*  printf( "spinner: mouse down  : %d/%d   arrow:%d\n", local_x, local_y,
+  debug( "spinner: mouse down  : %d/%d   arrow:%d\n", local_x, local_y,
       find_arrow( local_x, local_y ));
-      */
+

   if ( state != GLUI_SCROLL_STATE_UP AND state != GLUI_SCROLL_STATE_DOWN)
     return true;
@@ -222,7 +225,7 @@ int    GLUI_Scrollbar::mouse_up_handler( int local_x, int local_y, bool inside )
   state = GLUI_SCROLL_STATE_NONE;
   GLUI_Master.glui_setIdleFuncIfNecessary();

-  /*  printf("spinner: mouse up  : %d/%d    inside: %d\n",local_x,local_y,inside);              */
+  debug("spinner: mouse up  : %d/%d    inside: %d\n",local_x,local_y,inside);

   /*glutSetCursor( GLUT_CURSOR_INHERIT );              */
   glutSetCursor( GLUT_CURSOR_LEFT_ARROW );
@@ -246,9 +249,8 @@ int    GLUI_Scrollbar::mouse_held_down_handler( int local_x, int local_y,
   if ( state == GLUI_SCROLL_STATE_NONE )
     return false;

-  /*  printf("spinner: mouse held: %d/%d    inside: %d\n",local_x,local_y,
+  debug("spinner: mouse held: %d/%d    inside: %d\n",local_x,local_y,
       new_inside);
-  */

   if ( state == GLUI_SCROLL_STATE_SCROLL) {   /* dragging? */
     do_drag( local_x-x_abs, local_y-y_abs );
@@ -619,7 +621,7 @@ void    GLUI_Scrollbar::do_click( void )
   new_val += direction * incr;
   if (1 || data_type==GLUI_SCROLL_FLOAT) set_float_val(new_val);
   if (0 && data_type==GLUI_SCROLL_INT) set_int_val((int)new_val);
-  //printf("do_click: incr %f  val=%f  float_val=%f\n",incr,new_val,float_val);
+  debug("do_click: incr %f  val=%f  float_val=%f\n",incr,new_val,float_val);

   /*** Now update live variable and do callback.  We don't want
     to do the callback on each iteration of this function, just on every 
diff --git a/src/glui_separator.cpp b/src/glui_separator.cpp
index 9a1c1ed..c873f42 100755
--- a/src/glui_separator.cpp
+++ b/src/glui_separator.cpp
@@ -36,6 +36,8 @@
 /****************************** GLUI_Separator::GLUI_Separator() **********/

 GLUI_Separator::GLUI_Separator( GLUI_Node *parent )
+     :    GLUI_Control("separator")
+
 {
   common_init();
   parent->add_control( this );
diff --git a/src/glui_spinner.cpp b/src/glui_spinner.cpp
index 2b51917..6320386 100755
--- a/src/glui_spinner.cpp
+++ b/src/glui_spinner.cpp
@@ -47,7 +47,6 @@ FIXME: there's a heck of a lot of duplication between this and glui_scrollbar.cp
 #include <cmath>
 #include <cassert>

-/*static int __debug=0;              */

 #define  GLUI_SPINNER_GROWTH_STEPS         800
 #define  GLUI_SPINNER_MIN_GROWTH_STEPS     100
@@ -56,33 +55,40 @@ FIXME: there's a heck of a lot of duplication between this and glui_scrollbar.cp

 /****************************** GLUI_Spinner::GLUI_Spinner() ****************/

-GLUI_Spinner::GLUI_Spinner( GLUI_Node* parent, const char *name, 
-                            int data_type, int id, GLUI_CB callback )
+GLUI_Spinner::GLUI_Spinner( GLUI_Node* parent, const char *name,
+                            int data_type, int id, GLUI_CB callback ) :
+    GLUI_Control(name)
 {
   common_construct(parent, name, data_type, NULL, id, callback);
 }

 /****************************** GLUI_Spinner::GLUI_Spinner() ****************/

-GLUI_Spinner::GLUI_Spinner( GLUI_Node* parent, const char *name, 
-                            int *live_var, int id, GLUI_CB callback )
+GLUI_Spinner::GLUI_Spinner( GLUI_Node* parent, const char *name,
+                            int *live_var, int id, GLUI_CB callback ) :
+    GLUI_Control(name)
+
 {
   common_construct(parent, name, GLUI_SPINNER_INT, live_var, id, callback);
 }

 /****************************** GLUI_Spinner::GLUI_Spinner() ****************/

-GLUI_Spinner::GLUI_Spinner( GLUI_Node* parent, const char *name, 
-             float *live_var, int id, GLUI_CB callback )
+GLUI_Spinner::GLUI_Spinner( GLUI_Node* parent, const char *name,
+             float *live_var, int id, GLUI_CB callback ) :
+    GLUI_Control(name)
+
 {
   common_construct(parent, name, GLUI_SPINNER_FLOAT, live_var, id, callback);
 }

 /****************************** GLUI_Spinner::GLUI_Spinner() ****************/

-GLUI_Spinner::GLUI_Spinner( GLUI_Node *parent, const char *name, 
+GLUI_Spinner::GLUI_Spinner( GLUI_Node *parent, const char *name,
                             int data_t, void *live_var,
-                            int id, GLUI_CB callback )
+                            int id, GLUI_CB callback ) :
+    GLUI_Control(name)
+
 {
   common_construct(parent, name, data_t, live_var, id, callback);
 }
@@ -112,7 +118,7 @@ void GLUI_Spinner::common_construct( GLUI_Node* parent, const char *name,
   user_id     = id;
   data_type   = data_t;
   callback    = cb;
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   //glui        = parent->get_glui();

   parent->add_control( this );
@@ -134,9 +140,8 @@ int    GLUI_Spinner::mouse_down_handler( int local_x, int local_y )
   this->state = find_arrow( local_x, local_y );
   GLUI_Master.glui_setIdleFuncIfNecessary();

-  /*  printf( "spinner: mouse down  : %d/%d   arrow:%d\n", local_x, local_y,
+  debug( "spinner: mouse down  : %d/%d   arrow:%d\n", local_x, local_y,
       find_arrow( local_x, local_y ));
-      */

   if ( state != GLUI_SPINNER_STATE_UP AND state != GLUI_SPINNER_STATE_DOWN )
     return true;
@@ -168,7 +173,7 @@ int    GLUI_Spinner::mouse_up_handler( int local_x, int local_y, bool inside )
   state = GLUI_SPINNER_STATE_NONE;
   GLUI_Master.glui_setIdleFuncIfNecessary();

-  /*  printf("spinner: mouse up  : %d/%d    inside: %d\n",local_x,local_y,inside);              */
+  debug("spinner: mouse up  : %d/%d    inside: %d\n",local_x,local_y,inside);

   /*glutSetCursor( GLUT_CURSOR_INHERIT );              */
   glutSetCursor( GLUT_CURSOR_LEFT_ARROW );
@@ -192,9 +197,8 @@ int    GLUI_Spinner::mouse_held_down_handler( int local_x, int local_y,
   if ( state == GLUI_SPINNER_STATE_NONE )
     return false;

-  /*  printf("spinner: mouse held: %d/%d    inside: %d\n",local_x,local_y,
+  debug("spinner: mouse held: %d/%d    inside: %d\n",local_x,local_y,
       new_inside);
-      */

   if ( state == GLUI_SPINNER_STATE_BOTH ) {   /* dragging? */
     do_drag( local_x, local_y );
@@ -591,7 +595,7 @@ void    GLUI_Spinner::increase_growth( void )
   if ( growth < (hi-lo) / GLUI_SPINNER_MIN_GROWTH_STEPS )
     growth *= growth_exp;

-  /*  printf( "growth: %f\n", growth );              */
+  debug( "growth: %f\n", growth );
 }


diff --git a/src/glui_statictext.cpp b/src/glui_statictext.cpp
index 8d6bebe..fe71bf2 100755
--- a/src/glui_statictext.cpp
+++ b/src/glui_statictext.cpp
@@ -35,9 +35,11 @@

 /****************************** GLUI_StaticText::GLUI_StaticText() **********/
 GLUI_StaticText::GLUI_StaticText( GLUI_Node *parent, const char *name )
+    :    GLUI_Control("separator")
+
 {
   common_init();
-  set_name( name );
+  set_name( const_cast<char*>(name) );
   parent->add_control( this );
 }

@@ -53,7 +55,7 @@ void    GLUI_StaticText::draw( int x, int y )

 /****************************** GLUI_StaticText::set_text() **********/

-void    GLUI_StaticText::set_text( const char *text )
+void    GLUI_StaticText::set_text( char *text )
 {
   set_name( text );
   redraw();
diff --git a/src/glui_string.cpp b/src/glui_string.cpp
index 4e59007..da3c924 100755
--- a/src/glui_string.cpp
+++ b/src/glui_string.cpp
@@ -35,7 +35,7 @@
 #define vsnprintf _vsnprintf
 #endif

-GLUI_String& glui_format_str(GLUI_String& str, const char* fmt, ...)
+ std::string& glui_format_str( std::string& str, const char* fmt, ...)
 {
   const size_t ISIZE = 128;
   char stackbuf[ISIZE];
diff --git a/src/glui_textbox.cpp b/src/glui_textbox.cpp
index 70f8d9a..7f431d2 100755
--- a/src/glui_textbox.cpp
+++ b/src/glui_textbox.cpp
@@ -39,23 +39,26 @@ static const int LINE_HEIGHT = 15;

 /****************************** GLUI_TextBox::GLUI_TextBox() **********/

-GLUI_TextBox::GLUI_TextBox(GLUI_Node *parent, GLUI_String &live_var,
+GLUI_TextBox::GLUI_TextBox(GLUI_Node *parent, const char* name, std::string &live_var,
                            bool scroll, int id, GLUI_CB callback )
+    : GLUI_Control (name)
+
 {
   common_construct(parent, &live_var, scroll, id, callback);
 }

 /****************************** GLUI_TextBox::GLUI_TextBox() **********/

-GLUI_TextBox::GLUI_TextBox( GLUI_Node *parent, bool scroll, int id,
+GLUI_TextBox::GLUI_TextBox( GLUI_Node *parent, const char* name, bool scroll, int id,
                             GLUI_CB callback )
+    : GLUI_Control (name)
 {
   common_construct(parent, NULL, scroll, id, callback);
 }

 /****************************** GLUI_TextBox::common_construct() **********/
 void GLUI_TextBox::common_construct(
-  GLUI_Node *parent, GLUI_String *data, 
+  GLUI_Node *parent, std::string *data,
   bool scroll, int id, GLUI_CB callback)
 {
   common_init();
@@ -250,7 +253,7 @@ int    GLUI_TextBox::key_handler( unsigned char key,int modifiers )
     }
     else if ( key == CTRL('k') ) { /* KILL TO END OF LINE */
       sel_start = sel_end = insertion_pt;
-      text.erase(insertion_pt,GLUI_String::npos);
+      text.erase(insertion_pt,std::string::npos);
     }
   }
   else if ( modifiers == GLUT_ACTIVE_ALT ) /* ALT ONLY */
@@ -778,7 +781,7 @@ void     GLUI_TextBox::draw_insertion_pt( void )

   if ( debug )    dump( stdout, "-> DRAW_INS_PT" );

-  /*    printf( "insertion pt: %d\n", insertion_pt );              */
+  debug( "insertion pt: %d\n", insertion_pt );

   box_width = get_box_width();

@@ -881,7 +884,7 @@ int  GLUI_TextBox::substring_width( int start, int end, int initial_width )
 void   GLUI_TextBox::update_and_draw_text( void )
 {
   //update_substring_bounds();
-  /*  printf( "ss: %d/%d\n", substring_start, substring_end );                  */
+  debug( "ss: %d/%d\n", substring_start, substring_end );

   redraw();
 }
@@ -895,10 +898,9 @@ int    GLUI_TextBox::special_handler( int key,int modifiers )
   if ( NOT glui )
     return false;

-  if ( debug )
-    printf( "SPECIAL:%d - mod:%d   subs:%d/%d  ins:%d  sel:%d/%d\n", 
+    debug( "SPECIAL:%d - mod:%d   subs:%d/%d  ins:%d  sel:%d/%d\n",
         key, modifiers, substring_start, substring_end,insertion_pt,
-        sel_start, sel_end );    
+        sel_start, sel_end );

   if ( key == GLUT_KEY_DOWN ) {
     if (insert_x == -1 || insert_y == -1)
@@ -912,7 +914,7 @@ int    GLUI_TextBox::special_handler( int key,int modifiers )
       sel_start = sel_end;
     }
     if ( can_draw())
-      update_and_draw_text();    
+      update_and_draw_text();
   } else if ( key == GLUT_KEY_UP ) {
     if (insert_x == -1 || insert_y == -1)
       return false;
@@ -925,7 +927,7 @@ int    GLUI_TextBox::special_handler( int key,int modifiers )
       sel_start = sel_end;
     }
     if ( can_draw())
-      update_and_draw_text();    
+      update_and_draw_text();
   } else if ( key == GLUT_KEY_LEFT ) {
     if ( (modifiers & GLUT_ACTIVE_CTRL) != 0 ) {
       insertion_pt = find_word_break( insertion_pt, -1 );
@@ -956,9 +958,9 @@ int    GLUI_TextBox::special_handler( int key,int modifiers )
   /*** Update selection if shift key is down ***/
   if ( (modifiers & GLUT_ACTIVE_SHIFT ) != 0 )
     sel_end = insertion_pt;
-  else 
+  else
     sel_start = sel_end = insertion_pt;
-  
+

   CLAMP( insertion_pt, 0, text.length()); /* Make sure insertion_pt 
                            is in bounds */
@@ -1069,7 +1071,7 @@ void    GLUI_TextBox::set_text( const char *new_text )

 void   GLUI_TextBox::dump( FILE *out, char *name )
 {
-  fprintf( out, 
+  debug(
        "%s (edittext@%p):   line:%d ins_pt:%d  subs:%d/%d  sel:%d/%d   len:%d\n",
        name, this, curr_line,
        insertion_pt, substring_start, substring_end, sel_start, sel_end,
@@ -1086,7 +1088,7 @@ int    GLUI_TextBox::mouse_over( int state, int x, int y )
     glutSetCursor( GLUT_CURSOR_TEXT );
   }
   else {
-    /*    printf( "OUT\n" );              */
+    debug( "OUT\n" );
     glutSetCursor( GLUT_CURSOR_LEFT_ARROW );
   }

diff --git a/src/glui_translation.cpp b/src/glui_translation.cpp
index f262809..c66bac2 100755
--- a/src/glui_translation.cpp
+++ b/src/glui_translation.cpp
@@ -41,12 +41,13 @@ GLUI_Translation::GLUI_Translation(
   GLUI_Node *parent, const char *name, 
   int trans_t, float *value_ptr,
   int id, GLUI_CB cb )
+    : GLUI_Mouse_Interaction (name)
 {
   common_init();

   set_ptr_val( value_ptr );
   user_id    = id;
-  set_name( name );
+  set_name( const_cast<char*>( name ) );
   callback    = cb;
   parent->add_control( this );
   //init_live();
diff --git a/src/glui_tree.cpp b/src/glui_tree.cpp
index 75735b7..6d16f22 100755
--- a/src/glui_tree.cpp
+++ b/src/glui_tree.cpp
@@ -31,13 +31,16 @@

 /****************************** GLUI_Tree::GLUI_Tree() **********/
 GLUI_Tree::GLUI_Tree(GLUI_Node *parent, const char *name, 
-                     int open, int inset)
+                     int open, int inset):
+    GLUI_Panel(name),
+    button("")
+
 {
   common_init();
   GLUI_StaticText *inset_label;
   GLUI_Column     *col;

-  this->set_name( name );
+  this->set_name( const_cast<char*>( name ));
   this->user_id    = -1;

   if ( NOT open ) {
diff --git a/src/glui_treepanel.cpp b/src/glui_treepanel.cpp
index 4cbf8c1..945c50d 100755
--- a/src/glui_treepanel.cpp
+++ b/src/glui_treepanel.cpp
@@ -23,11 +23,12 @@
 /****************************** GLUI_TreePanel::GLUI_TreePanel() *********/

 GLUI_TreePanel::GLUI_TreePanel(GLUI_Node *parent, const char *name, 
-                               bool open, int inset)
+                               bool open, int inset) :
+    GLUI_Panel(name)
 {
   common_init();

-  set_name( name );
+  set_name( const_cast<char*>(name) );
   user_id    = -1;

   if ( !open ) {
@@ -182,8 +183,8 @@ void GLUI_TreePanel::formatNode(GLUI_Tree *temp)
     return;
   int level = temp->get_level();
   int child_number = temp->get_child_number();
-  GLUI_String level_name="";
-  GLUI_String full_name="";
+  std::string level_name="";
+  std::string full_name="";

   temp->level_name == "";

diff --git a/src/glui_window.cpp b/src/glui_window.cpp
old mode 100644
new mode 100755
diff --git a/src/include/GL/glui.h b/src/include/GL/glui.h
old mode 100644
new mode 100755
index 01a5c75..1f6b8fe
--- a/src/include/GL/glui.h
+++ b/src/include/GL/glui.h
@@ -38,6 +38,12 @@
 // that come from old GLUT headers.
 #include <cstdlib>

+#if defined(DEBUG)
+#define debug(message, ...) fprintf( stderr, __FILE__ ":%d:" message, __LINE__, ## __VA_ARGS__ )
+#else
+#define debug(message, ...)
+#endif
+
 #if defined(GLUI_FREEGLUT)

   // FreeGLUT does not yet work perfectly with GLUI
@@ -249,8 +255,7 @@ enum TranslationCodes

 /************ A string type for us to use **********/

-typedef std::string GLUI_String;
-GLUIAPI GLUI_String& glui_format_str(GLUI_String &str, const char* fmt, ...);
+GLUIAPI std::string& glui_format_str(std::string &str, const char* fmt, ...);

 /********* Pre-declare classes as needed *********/

@@ -336,14 +341,15 @@ class GLUI_Control;
  Everything onscreen is a GLUI_Node--windows, buttons, etc.
  The nodes are traversed for event processing, sizing, redraws, etc.
 */
-class GLUIAPI GLUI_Node 
+class GLUIAPI GLUI_Node
 {
     friend class GLUI_Tree;     /* JVK */
     friend class GLUI_Rollout;
     friend class GLUI_Main;

 public:
-    GLUI_Node();
+    GLUI_Node(const char* name);
+
     virtual ~GLUI_Node() {}

     GLUI_Node *first_sibling();
@@ -365,8 +371,12 @@ public:
     void unlink();

     void dump( FILE *out, const char *name );
+    const char* whole_tree(int start=1);
+    const char* NodeName;
+

 protected:
+    GLUI_Node();
     static void add_child_to_control(GLUI_Node *parent,GLUI_Control *child);
     GLUI_Node *parent_node;
     GLUI_Node *child_head;
@@ -667,7 +677,7 @@ protected:

     /********** Misc functions *************/

-    GLUI_Control  *find_control( int x, int y );
+    GLUI_Control  *find_control( int x, int y, GLUI_Control * parent=NULL  );
     GLUI_Control  *find_next_control( GLUI_Control *control );
     GLUI_Control  *find_next_control_rec( GLUI_Control *control );
     GLUI_Control  *find_next_control_( GLUI_Control *control );
@@ -705,7 +715,7 @@ protected:

 public:
     GLUI_StdBitmaps  std_bitmaps;
-    GLUI_String      window_name;
+    std::string      window_name;
     unsigned char    bkgd_color[3];
     float            bkgd_color_f[3];

@@ -762,13 +772,13 @@ public:
  checkboxes, labels, edit boxes, scrollbars, etc.
  Most of the work of this class is in routing events,
  like keystrokes, mouseclicks, redraws, and sizing events.
- 
+
  Yes, this is a huge and hideous class.  It needs to be 
  split up into simpler subobjects.  None of the data members
  should be directly accessed by users (they should be protected,
  not public); only subclasses.
 */
-class GLUIAPI GLUI_Control : public GLUI_Node 
+class GLUIAPI GLUI_Control : public GLUI_Node
 {
 public:

@@ -777,9 +787,9 @@ public:
     int             x_abs, y_abs;
     int             x_off, y_off_top, y_off_bot; /* INNER margins, by which child
                                                     controls are indented */
-    int             contain_x, contain_y; 
+    int             contain_x, contain_y;
     int             contain_w, contain_h;
-    /* if this is a container control (e.g., 
+    /* if this is a container control (e.g.,
        radiogroup or panel) this indicated dimensions
        of inner area in which controls reside */

@@ -788,7 +798,7 @@ public:
     bool            active;       ///< If true, we've got the focus
     bool            can_activate; ///< If false, remove from tab order.
     bool            spacebar_mouse_click; ///< Spacebar simulates click.
-    
+
 /** Callbacks */
     long            user_id;  ///< Integer to pass to callback function.
     GLUI_CB         callback; ///< User callback function, or NULL.
@@ -798,24 +808,24 @@ public:
     int             int_val;          /**< Our integer value */
     float           float_array_val[GLUI_DEF_MAX_ARRAY];
     int             float_array_size;
-    GLUI_String     text;       /**< The text inside this control */
-    
+    std::string     text;       /**< The text inside this control */
+
 /** "Live variable" updating */
     void           *ptr_val;          /**< A pointer to the user's live variable value */
     int             live_type;
     bool            live_inited;
     /* These variables store the last value that live variable was known to have. */
-    int             last_live_int;  
+    int             last_live_int;
     float           last_live_float;
-    GLUI_String     last_live_text;
+    std::string     last_live_text;
     float           last_live_float_array[GLUI_DEF_MAX_ARRAY];
-    
-/** Properties of our control */    
+
+/** Properties of our control */
     GLUI           *glui;       /**< Our containing event handler (NEVER NULL during event processing!) */
     bool            is_container;  /**< Is this a container class (e.g., panel) */
     int             alignment;
     bool            enabled;    /**< Is this control grayed out? */
-    GLUI_String     name;       /**< The name of this control */
+    std::string     name;       /**< The name of this control */
     void           *font;       /**< Our glutbitmap font */
     bool            collapsible, is_open;
     GLUI_Node       collapsed_node;
@@ -824,7 +834,7 @@ public:

 public:
     /*** Get/Set values ***/
-    virtual void   set_name( const char *string );
+    virtual void   set_name( char *string );
     virtual void   set_int_val( int new_int )         { int_val = new_int; output_live(true); }
     virtual void   set_float_val( float new_float )   { float_val = new_float; output_live(true); }
     virtual void   set_ptr_val( void *new_ptr )       { ptr_val = new_ptr; output_live(true); }
@@ -846,7 +856,7 @@ public:
     virtual void idle( void )            { }
     virtual int  mouse_over( int state, int x, int y ) { return false; }

-    virtual void enable( void ); 
+    virtual void enable( void );
     virtual void disable( void );
     virtual void activate( int how )     { active = true; }
     virtual void deactivate( void )     { active = false; }
@@ -871,30 +881,30 @@ public:

     virtual void align( void );
     void         pack( int x, int y );    /* Recalculate positions and offsets */
-    void         pack_old( int x, int y );    
+    void         pack_old( int x, int y );
     void         draw_recursive( int x, int y );
     int          set_to_glut_window( void );
     void         restore_window( int orig );
     void         translate_and_draw_front( void );
-    void         translate_to_origin( void ) 
+    void         translate_to_origin( void )
     {glTranslatef((float)x_abs+.5,(float)y_abs+.5,0.0);}
     virtual void draw( int x, int y )=0;
     void         set_font( void *new_font );
     void        *get_font( void );
     int          string_width( const char *text );
-    int          string_width( const GLUI_String &str ) 
+    int          string_width( const std::string &str )
     { return string_width(str.c_str()); }
     int          char_width( char c );

     void         draw_name( int x, int y );
-    void         draw_box_inwards_outline( int x_min, int x_max, 
+    void         draw_box_inwards_outline( int x_min, int x_max,
                                            int y_min, int y_max );
     void         draw_box( int x_min, int x_max, int y_min, int y_max,
                            float r, float g, float b );
     void         draw_bkgd_box( int x_min, int x_max, int y_min, int y_max );
     void         draw_emboss_box( int x_min, int x_max,int y_min,int y_max);
     void         draw_string( const char *text );
-    void         draw_string( const GLUI_String &s ) 
+    void         draw_string( const std::string &s )
     { draw_string(s.c_str()); }
     void         draw_char( char c );
     void         draw_active_box( int x_min, int x_max, int y_min, int y_max );
@@ -908,13 +918,15 @@ public:
     void         output_live( int update_main_gfx );        /** Writes live variable **/
     virtual void set_text( const char *t )   {}
     void         execute_callback( void );
-    void         get_this_column_dims( int *col_x, int *col_y, 
-                                       int *col_w, int *col_h, 
+    void         get_this_column_dims( int *col_x, int *col_y,
+                                       int *col_w, int *col_h,
                                        int *col_x_off, int *col_y_off );
     virtual bool needs_idle( void ) const;
     virtual bool wants_tabs() const      { return false; }

-    GLUI_Control(void) 
+    GLUI_Control(const char* name)
+        : GLUI_Node(name)
+        , collapsed_node("collapsed_node")
     {
         x_off          = GLUI_XOFF;
         y_off_top      = GLUI_YOFF;
@@ -926,7 +938,6 @@ public:
         int_val        = 0;
         last_live_int  = 0;
         float_array_size = 0;
-        glui_format_str(name, "Control: %p", this);
         float_val      = 0.0;
         last_live_float = 0.0;
         ptr_val        = NULL;
@@ -948,11 +959,15 @@ public:
         hidden         = false;
         memset(char_widths, -1, sizeof(char_widths)); /* JVK */
         int i;
+        set_name(const_cast<char*>(name));
         for( i=0; i<GLUI_DEF_MAX_ARRAY; i++ )
             float_array_val[i] = last_live_float_array[i] = 0.0;
     }

     virtual ~GLUI_Control();
+
+protected:
+    GLUI_Control();
 };

 /************************************************************/
@@ -991,7 +1006,7 @@ public:
 */
     GLUI_Button( GLUI_Node *parent, const char *name, 
                  int id=-1, GLUI_CB cb=GLUI_CB() );
-    GLUI_Button( void ) { common_init(); };
+    GLUI_Button( const char* name ) : GLUI_Control(name) { common_init(); };

 protected:
     void common_init(void) {
@@ -1046,7 +1061,7 @@ public:
 */
     GLUI_Checkbox(GLUI_Node *parent, const char *name, int *value_ptr=NULL,
                   int id=-1, GLUI_CB callback=GLUI_CB());
-    GLUI_Checkbox( void ) { common_init(); }
+    GLUI_Checkbox( const char* name ) :GLUI_Control(name)  { common_init(); }

 protected:
     void common_init(void) {
@@ -1083,7 +1098,7 @@ public:
   @param draw_bar If true, draw a visible bar between new and old controls.
 */
     GLUI_Column( GLUI_Node *parent, int draw_bar = true );
-    GLUI_Column( void ) { common_init(); }
+    GLUI_Column( const char* name  ): GLUI_Control(name) { common_init(); }

 protected:
     void common_init() {
@@ -1119,10 +1134,10 @@ public:
 */
     GLUI_Panel( GLUI_Node *parent, const char *name, 
                 int type=GLUI_PANEL_EMBOSSED );
-    GLUI_Panel() { common_init(); }
+    GLUI_Panel(const char *name): GLUI_Control(name) { set_name( const_cast<char*>(name) ); common_init(); }

     void draw( int x, int y );
-    void set_name( const char *text );
+    void set_name( char *text );
     void set_type( int new_type );

     void update_size( void );
@@ -1169,7 +1184,7 @@ public:
                       GLUI_CB callback = GLUI_CB());

     GLUI_List *list;
-    GLUI_String current_dir;
+    std::string current_dir;

     void fbreaddir(const char *);
     static void dir_list_callback(GLUI_Control*);
@@ -1198,7 +1213,7 @@ protected:

 private:
     int last_item;
-    GLUI_String file;
+    std::string file;
     int allow_change_dir;

 };
@@ -1230,7 +1245,7 @@ public:
 */
     GLUI_Rollout( GLUI_Node *parent, const char *name, int open=true, 
                   int type=GLUI_PANEL_EMBOSSED );
-    GLUI_Rollout( void ) { common_init(); }
+    GLUI_Rollout( const char* name  ): GLUI_Panel(name), button(name) { common_init(); }


     bool        currently_inside, initially_inside;
@@ -1294,7 +1309,7 @@ private:
 public:
     bool        currently_inside, initially_inside;
     GLUI_Button  button;
-    GLUI_String  level_name; // level name, eg: 1.1.2, III, or 3
+    std::string  level_name; // level name, eg: 1.1.2, III, or 3
     GLUI_TreePanel *panel; 

     void draw( int x, int y );
@@ -1306,7 +1321,7 @@ public:
     void  open( void ); 
     void  close( void );

-    /*   void set_name( const char *text )   { panel.set_name( text ); }; */
+    /*   void set_name( char *text )   { panel.set_name( text ); }; */
     void update_size( void );
     void set_id(int i) { id = i; }
     void set_level(int l) { level = l; }
@@ -1420,7 +1435,7 @@ protected:
     int uniqueID( void ) { next_id++; return next_id - 1; }
     void common_init() 
     {
-        GLUI_Panel();
+        GLUI_Panel("");
         next_id = 0;
         curr_root = this;
         curr_branch = NULL;
@@ -1458,12 +1473,14 @@ public:

     GLUI_RadioGroup 
     *add_radiogroup( int *live_var=NULL,
-                     int user_id=-1,GLUI_CB callback=GLUI_CB());
+                     int user_id=-1,GLUI_CB callback=GLUI_CB(),
+                     const char *name="Radio" );

     GLUI_RadioGroup 
     *add_radiogroup_to_panel(  GLUI_Panel *panel,
                                int *live_var=NULL,
-                               int user_id=-1, GLUI_CB callback=GLUI_CB() );
+                               int user_id=-1, GLUI_CB callback=GLUI_CB(),
+                               const char *name="Radio" );
     GLUI_RadioButton
     *add_radiobutton_to_group(  GLUI_RadioGroup *group,
                                 const char *name );
@@ -1488,41 +1505,41 @@ public:
         int trans_type, float *live_var=NULL,
         int id=-1, GLUI_CB callback=GLUI_CB());

-    GLUI_Checkbox  *add_checkbox( const char *name, 
+    GLUI_Checkbox  *add_checkbox( const char *name,
                                   int *live_var=NULL,
                                   int id=-1, GLUI_CB callback=GLUI_CB());
-    GLUI_Checkbox  *add_checkbox_to_panel( GLUI_Panel *panel, const char *name, 
-                                           int *live_var=NULL, int id=-1, 
+    GLUI_Checkbox  *add_checkbox_to_panel( GLUI_Panel *panel, const char *name,
+                                           int *live_var=NULL, int id=-1,
                                            GLUI_CB callback=GLUI_CB());

-    GLUI_Button  *add_button( const char *name, int id=-1, 
+    GLUI_Button  *add_button( const char *name, int id=-1,
                               GLUI_CB callback=GLUI_CB());
-    GLUI_Button  *add_button_to_panel( GLUI_Panel *panel, const char *name, 
+    GLUI_Button  *add_button_to_panel( GLUI_Panel *panel, const char *name,
                                        int id=-1, GLUI_CB callback=GLUI_CB() );

     GLUI_StaticText  *add_statictext( const char *name );
     GLUI_StaticText  *add_statictext_to_panel( GLUI_Panel *panel, const char *name );

-    GLUI_EditText  *add_edittext( const char *name, 
+    GLUI_EditText  *add_edittext( const char *name,
                                   int data_type=GLUI_EDITTEXT_TEXT,
                                   void*live_var=NULL,
                                   int id=-1, GLUI_CB callback=GLUI_CB()    );
-    GLUI_EditText  *add_edittext_to_panel( GLUI_Panel *panel, 
+    GLUI_EditText  *add_edittext_to_panel( GLUI_Panel *panel,
                                            const char *name,
                                            int data_type=GLUI_EDITTEXT_TEXT,
-                                           void *live_var=NULL, int id=-1, 
+                                           void *live_var=NULL, int id=-1,
                                            GLUI_CB callback=GLUI_CB() );
-    GLUI_EditText  *add_edittext( const char *name, GLUI_String& live_var, 
+    GLUI_EditText  *add_edittext( const char *name, std::string& live_var,
                                   int id=-1, GLUI_CB callback=GLUI_CB()    );
-    GLUI_EditText  *add_edittext_to_panel( GLUI_Panel *panel, const char *name, 
-                                           GLUI_String& live_var, int id=-1,
+    GLUI_EditText  *add_edittext_to_panel( GLUI_Panel *panel, const char *name,
+                                           std::string& live_var, int id=-1,
                                            GLUI_CB callback=GLUI_CB() );

-    GLUI_Spinner  *add_spinner( const char *name, 
+    GLUI_Spinner  *add_spinner( const char *name,
                                 int data_type=GLUI_SPINNER_INT,
                                 void *live_var=NULL,
                                 int id=-1, GLUI_CB callback=GLUI_CB() );
-    GLUI_Spinner  *add_spinner_to_panel( GLUI_Panel *panel, 
+    GLUI_Spinner  *add_spinner_to_panel( GLUI_Panel *panel,
                                          const char *name,
                                          int data_type=GLUI_SPINNER_INT,
                                          void *live_var=NULL,
@@ -1530,13 +1547,13 @@ public:
                                          GLUI_CB callback=GLUI_CB() );

     GLUI_Panel     *add_panel( const char *name, int type=GLUI_PANEL_EMBOSSED );
-    GLUI_Panel     *add_panel_to_panel( GLUI_Panel *panel, const char *name, 
+    GLUI_Panel     *add_panel_to_panel( GLUI_Panel *panel, const char *name,
                                         int type=GLUI_PANEL_EMBOSSED );


     GLUI_Rollout   *add_rollout( const char *name, int open=true,
                                  int type=GLUI_PANEL_EMBOSSED);
-    GLUI_Rollout   *add_rollout_to_panel( GLUI_Panel *panel, const char *name, 
+    GLUI_Rollout   *add_rollout_to_panel( GLUI_Panel *panel, const char *name,
                                           int open=true,
                                           int type=GLUI_PANEL_EMBOSSED);

@@ -1593,7 +1610,7 @@ class GLUIAPI GLUI_EditText : public GLUI_Control
 public:
     int                 has_limits;
     int                 data_type;
-    GLUI_String         orig_text;
+    std::string         orig_text;
     int                 insertion_pt;
     int                 title_x_offset;
     int                 text_x_offset;
@@ -1639,7 +1656,7 @@ public:
     void set_float_val( float new_val );
     void set_int_val( int new_val );
     void set_text( const char *text );
-    void set_text( const GLUI_String &s) { set_text(s.c_str()); }
+    void set_text( const std::string &s) { set_text(s.c_str()); }
     const char *get_text()               { return text.c_str(); }

     void dump( FILE *out, const char *text );
@@ -1670,7 +1687,7 @@ public:
                    int text_type, void *live_var,
                    int id, GLUI_CB callback );
     // Deprecated constructor, only called internally
-    GLUI_EditText( void ) { common_init(); }
+    GLUI_EditText( const char* name ) : GLUI_Control(name) { common_init(); }

 protected:
     void common_init( void ) {
@@ -1715,11 +1732,11 @@ public:

     #ifdef _MSC_VER
     // Explicit template instantiation needed for dll
-    template class GLUIAPI std::allocator<GLUI_String>;
-    template class GLUIAPI std::vector<GLUI_String, std::allocator<GLUI_String> >;
+    template class GLUIAPI std::allocator<std::string>;
+    template class GLUIAPI std::vector<std::string, std::allocator<std::string> >;
     #endif

-    std::vector<GLUI_String> hist_list;
+    std::vector<std::string> hist_list;
     int  curr_hist;
     int  oldest_hist;
     int  newest_hist;
@@ -1732,9 +1749,9 @@ public:

     virtual const char *get_history( int command_number ) const
     { return hist_list[command_number - oldest_hist].c_str(); }
-    virtual GLUI_String& get_history_str( int command_number )
+    virtual std::string& get_history_str( int command_number )
     { return hist_list[command_number - oldest_hist]; }
-    virtual const GLUI_String& get_history_str( int command_number ) const
+    virtual const std::string& get_history_str( int command_number ) const
     { return hist_list[command_number - oldest_hist]; }
     virtual void recall_history( int history_number );
     virtual void scroll_history( int direction );
@@ -1746,7 +1763,7 @@ public:

     GLUI_CommandLine( GLUI_Node *parent, const char *name, void *live_var=NULL,
                       int id=-1, GLUI_CB callback=GLUI_CB() );
-    GLUI_CommandLine( void ) { common_init(); }
+    GLUI_CommandLine( const char* name ) : GLUI_EditText (name) { common_init(); }
 protected:
     void common_init() {
         hist_list.resize(HIST_SIZE);
@@ -1770,15 +1787,16 @@ public:
     int  num_buttons;

     void draw( int x, int y );
-    void set_name( const char *text );
+    void set_name( char *text );
     void set_int_val( int int_val ); 
     void set_selected( int int_val );

     void draw_group( int translate );

     GLUI_RadioGroup( GLUI_Node *parent, int *live_var=NULL,
-                     int user_id=-1,GLUI_CB callback=GLUI_CB() );
-    GLUI_RadioGroup( void ) { common_init(); }
+                     int user_id=-1,GLUI_CB callback=GLUI_CB(),
+                     const char* name="radioG"  );
+    GLUI_RadioGroup( const char* name  ): GLUI_Control(name) { common_init(); }

 protected:
     void common_init( void ) {
@@ -1848,7 +1866,7 @@ public:
     void draw( int x, int y );

     GLUI_Separator( GLUI_Node *parent );
-    GLUI_Separator( void ) { common_init(); }
+    GLUI_Separator( const char* name  ): GLUI_Control(name) { common_init(); }

 protected:
     void common_init() {
@@ -1893,7 +1911,7 @@ public:
                   void *live_var,
                   int id=-1, GLUI_CB callback=GLUI_CB() );
     // Deprecated constructor
-    GLUI_Spinner( void ) { common_init(); }
+    GLUI_Spinner( const char* name  ): GLUI_Control(name) { common_init(); }

     bool          currently_inside;
     int           state;
@@ -1971,14 +1989,14 @@ protected:
 class GLUIAPI GLUI_StaticText : public GLUI_Control
 {
 public:
-    void set_text( const char *text );
+    void set_text( char *text );
     void draw( int x, int y );
     void draw_text( void );
     void update_size( void );
     void erase_text( void );

     GLUI_StaticText(GLUI_Node *parent, const char *name);
-    GLUI_StaticText( void ) { common_init(); }
+    GLUI_StaticText( const char* name  ): GLUI_Control(name) { common_init(); }

 protected:
     void common_init() {
@@ -1998,13 +2016,14 @@ class GLUIAPI GLUI_TextBox : public GLUI_Control
 {
 public:
     /* GLUI Textbox - JVK */
-    GLUI_TextBox(GLUI_Node *parent, GLUI_String &live_var,
+    GLUI_TextBox( GLUI_Node *parent, const char* name, std::string &live_var,
                  bool scroll = false, int id=-1, GLUI_CB callback=GLUI_CB() );
     GLUI_TextBox( GLUI_Node *parent,
+                  const char* name,
                   bool scroll = false, int id=-1,
                   GLUI_CB callback=GLUI_CB() );

-    GLUI_String         orig_text;
+    std::string         orig_text;
     int                 insertion_pt;
     int                 substring_start; /*substring that gets displayed in box*/
     int                 substring_end;  
@@ -2061,6 +2080,7 @@ public:
     bool wants_tabs( void ) const { return true; }

 protected:
+
     void common_init()
     {
         h                     = GLUI_TEXTBOX_HEIGHT;
@@ -2087,8 +2107,8 @@ protected:
         draw_text_only        = false;
     }
     void common_construct(
-        GLUI_Node *parent, GLUI_String *live_var, 
-        bool scroll, int id, GLUI_CB callback); 
+        GLUI_Node *parent, std::string *live_var,
+        bool scroll, int id, GLUI_CB callback);
 };

 /************************************************************/
@@ -2097,10 +2117,10 @@ protected:
 /*                                                          */
 /************************************************************/

-class GLUIAPI GLUI_List_Item : public GLUI_Node 
+class GLUIAPI GLUI_List_Item : public GLUI_Node
 {
 public:
-    GLUI_String text;
+    std::string text;
     int         id;
 };

@@ -2114,20 +2134,21 @@ class GLUIAPI GLUI_List : public GLUI_Control
 {
 public:
     /* GLUI List - JVK */
-    GLUI_List( GLUI_Node *parent, bool scroll = false,
+    GLUI_List( GLUI_Node *parent, const char* name, bool scroll = false,
                int id=-1, GLUI_CB callback=GLUI_CB() );
-               /*, GLUI_Control *object = NULL 
+               /*, GLUI_Control *object = NULL
                ,GLUI_InterObject_CB obj_cb = NULL);*/

     GLUI_List( GLUI_Node *parent,
-               GLUI_String& live_var, bool scroll = false, 
-               int id=-1, 
+               const char* name,
+               std::string& live_var, bool scroll = false,
+               int id=-1,
                GLUI_CB callback=GLUI_CB()
                /*,GLUI_Control *object = NULL */
                /*,GLUI_InterObject_CB obj_cb = NULL*/);


-    GLUI_String         orig_text;
+    std::string         orig_text;
     int                 debug;
     int                 draw_text_only;
     int                 start_line;
@@ -2204,7 +2225,7 @@ protected:
     };
     void common_construct(
         GLUI_Node *parent,
-        GLUI_String* live_var, bool scroll,
+        std::string* live_var, bool scroll,
         int id,
         GLUI_CB callback
         /*,GLUI_Control *object*/
@@ -2333,14 +2354,14 @@ protected:
 class GLUIAPI GLUI_Listbox_Item : public GLUI_Node 
 {
 public:
-    GLUI_String text;
+    std::string text;
     int         id;
 };

 class GLUIAPI GLUI_Listbox : public GLUI_Control
 {
 public:
-    GLUI_String       curr_text;
+    std::string       curr_text;
     GLUI_Listbox_Item items_list;
     int               depressed;

@@ -2376,7 +2397,7 @@ public:
     GLUI_Listbox( GLUI_Node *parent,
                   const char *name, int *live_var=NULL,
                   int id=-1, GLUI_CB callback=GLUI_CB() );
-    GLUI_Listbox( void ) { common_init(); }
+    GLUI_Listbox( const char* name  ):GLUI_Control(name) { common_init(); }

 protected:
     /** Change w and return true if we need to be widened to fit the current item. */
@@ -2432,8 +2453,7 @@ public:
     virtual void iaction_dump( FILE *output )=0;
     virtual void iaction_init( void ) = 0;

-    GLUI_Mouse_Interaction( void ) {
-        glui_format_str( name, "Mouse_Interaction: %p", this );
+    GLUI_Mouse_Interaction( const char* name ) : GLUI_Control(name) {
         w              = GLUI_MOUSE_INTERACTION_WIDTH;
         h              = GLUI_MOUSE_INTERACTION_HEIGHT;
         can_activate   = true;
@@ -2492,7 +2512,7 @@ public:

     GLUI_Rotation( GLUI_Node *parent, const char *name, float *live_var=NULL,
                    int id=-1, GLUI_CB callback=GLUI_CB() );
-    GLUI_Rotation(void) { common_init(); }
+    GLUI_Rotation(const char* name): GLUI_Mouse_Interaction(name) { common_init(); }

 protected:
     void common_init();
@@ -2558,7 +2578,7 @@ public:
     GLUI_Translation( GLUI_Node *parent, const char *name,
                       int trans_type, float *live_var=NULL,
                       int id=-1, GLUI_CB callback=GLUI_CB()    );
-    GLUI_Translation( void ) { common_init(); }
+    GLUI_Translation( const char* name ) : GLUI_Mouse_Interaction(name) { common_init(); }

 protected:
     void common_init() {
diff --git a/src/makefile b/src/makefile
index eb22251..69ec239 100755
--- a/src/makefile
+++ b/src/makefile
@@ -5,9 +5,10 @@
 #CC=gcc

 # Compiler options
-OPTS=-g
-OPTS=-O0
-#OPTS=-O2
+OPTS+=-g
+OPTS+=-O0
+#OPTS+=-O2
+OPTS+=-DDEBUG

 UNAME = $(shell uname)

@@ -18,7 +19,7 @@ endif

 #######################################

-CPPFLAGS += -I./ -I./include
+CPPFLAGS += -I./ -I./include $(OPTS)

 LIBGLUI = -L./lib -lglui
 LIBGL   = -lGLU -lGL
diff --git a/src/msvc/README.txt b/src/msvc/README.txt
old mode 100644
new mode 100755
diff --git a/src/msvc/gluidll.vcproj b/src/msvc/gluidll.vcproj
old mode 100644
new mode 100755
diff --git a/src/tools/ppm.cpp b/src/tools/ppm.cpp
old mode 100644
new mode 100755
diff --git a/src/tools/ppm.h b/src/tools/ppm.h
old mode 100644
new mode 100755
diff --git a/src/tools/ppm2array.cpp b/src/tools/ppm2array.cpp
old mode 100644
new mode 100755
diff --git a/src/viewmodel.cpp b/src/viewmodel.cpp
old mode 100644
new mode 100755
diff --git a/www/image1.png b/www/image1.png
old mode 100644
new mode 100755
diff --git a/www/index.html b/www/index.html
old mode 100644
new mode 100755
diff --git a/www/screen2.png b/www/screen2.png
old mode 100644
new mode 100755
diff --git a/www/screen3.png b/www/screen3.png
old mode 100644
new mode 100755
diff --git a/www/screen4.png b/www/screen4.png
old mode 100644
new mode 100755
diff --git a/www/title.jpg b/www/title.jpg
old mode 100644
new mode 100755
diff --git a/www/valid-html401.png b/www/valid-html401.png
old mode 100644
new mode 100755

Fix in glui.h for inclusion of correct lib in VS projects

https://sourceforge.net/p/glui/patches/10/

Glui.h contains a pragma to include glui32.lib (release version) automatically. However, it does so regardless of the project being compiled being in debug or release configuration. This leads to crashes in settings where the Release lib is used in a Debug configuration. This patch adds an #ifdef block to make sure the correct lib is included (glui32.lib or glui32d.lib)

98c98,102
< #      pragma comment(lib, "glui32.lib")  

---
> #      if defined _DEBUG  // include debug lib if in debug mode
> #        pragma comment(lib, "glui32d.lib")  
> #      else
> #        pragma comment(lib, "glui32.lib")  
> #      endif

gcc 4.x / linux compile fix

https://sourceforge.net/p/glui/patches/6/

The current CVS dump of glui doesn't compile under gcc 4.x under linux (mandriva free 2007); basically it chokes on the 'template class ...' in glui.h.

Here's the cvs-diff patch:

===================================================================
RCS file: /cvsroot/glui/glui/src/include/GL/glui.h,v
retrieving revision 1.6
diff -r1.6 glui.h
1715,1716c1715,1721
< template class GLUIAPI std::allocator<GLUI_String>;
< template class GLUIAPI std::vector<GLUI_String, std::allocator<GLUI_String=""> >;

    //
    // (iw, 070225) commented out the 'template'; gcc 4+ won't accept it under linux.
    // (if anybody else needs it under windows or so, feel free to put the reqd ifdefs
    // around it ...
    //
    /* template */ class GLUIAPI std::allocator<GLUI_String>;
    /* template */ class GLUIAPI std::vector<GLUI_String, std::allocator<GLUI_String> >;

del key not recognized in edittext

https://sourceforge.net/p/glui/bugs/14/

When I run example 2, I can select text using the
mouse and then delete it using the delete key, but if I
place the cursor at beginning of text and hit delete key,
the character following the cursor should also be
deleted, right? I am not sure if this means the example
needs some extra handling added or of it means the
library should automatically handle the keys. I am
running GLUI under Windows XP using MSVC++ V6
compiler.

Empty GLUI_TextBox crashes on window 7

https://sourceforge.net/p/glui/bugs/34/

original report

I was using glui on Ubuntu without any problems, but when I tried the same code on my Windows 7 it crashed.
I reduced the code to a few lines and I found out that it crashed when I created an empty TextBox.
When I add a text in the TextBox (with set_text) then the program will run, but it will still crash when the text is erased afterwards.

The crash occurs in glutMainLoop and I get a the error "Debug Assertion Failed!".
The file is ...\xstring on line 1575 with the expression "string subscript out of range".

reply 1

The issue seems to be that the windows implementation of std::string does slightly different range checking when getting a char at an index. On Linux, if you get the first char of an empty string it will return '\0'. On windows it just screams and dies. Running a release build doesn't crash but it does have a lot of unexpected behavior.

reply 2

I too was running into this and have found the specific cause.

In VS2010, the default debug project settings define the preprocessor directive
_ITERATOR_DEBUG_LEVEL=2

This causes code inside xstring to perform range checking on calls to string::operator[], like so:

#if _ITERATOR_DEBUG_LEVEL == 2
    if (this->_Mysize <= _Off)
        _DEBUG_ERROR("string subscript out of range");
#elif _ITERATOR_DEBUG_LEVEL == 1
    _SCL_SECURE_VALIDATE_RANGE(_Off < this->_Mysize);
#endif / _ITERATOR_DEBUG_LEVEL == 2 /

The variable _Mysize apparently represents string length minus null characters - i.e. the value returned by calling string::length. Therefore the range check fails and
throws an out of range exception.

Solutions:
In debug build configuration, in project properties -> C/C++ -> Preprocessor, add the following directive:

_ITERATOR_DEBUG_LEVEL=0

*note: this is probably not a good idea as the you will lose a number of iterator-related asserts across the entire project, but it is the quick and dirty way to get around the issue.

The other way is to modify a few lines of glui_edittext.cpp to check for an empty string before attempting to access the 0-indexed character object of a string.

For example, following lines starting at line 849 :

for( i=start; i<=end; i++ )
width += char_width( text[i] );

should be modified to something like:

if(!text.empty())
    for( i=start; i<=end; i++ )
width += char_width( text[i] );

There are a few more places in the source that should be modified in a similar way. I can post the source with all of my changes if someone wants it.

Hope this helps someone :) Cheers!

reply 3

Would you mind posting your glui fixes nobody :)? What other files need modified? I guess I can just keep updating the code till I find all the situations where the error arises.

reply 4

I am not a dev of the project, but wouldn't mind to help since I find that some things could be factored back in so I don't revisit them. Apologies for the bad formatting, I have no idea how to do it right. Attached file is nicer.

/******************************** GLUI_EditText::substring_width() *********/

int  GLUI_EditText::substring_width( int start, int end )
{
  int i, width;

  width = 0;

  // JOHN: empty text
 if (text.size() == 0)
    return 0;

/************************** GLUI_EditText::update_substring_bounds() *********/

int    GLUI_EditText::update_substring_bounds( void )
{
  int box_width;
  int text_len = (int)text.length();
  int old_start, old_end;

  old_start = substring_start;
  old_end = substring_end;

  /*** Calculate the width of the usable area of the edit box ***/
  box_width = MAX( this->w - this->text_x_offset 
           - 4     /*  2 * the two-line box border */ 
           - 2 * GLUI_EDITTEXT_BOXINNERMARGINX, 0 );

  CLAMP( substring_end, 0, MAX(text_len-1,0) );
  CLAMP( substring_start, 0, MAX(text_len-1,0) );

  // JOHN: avoid checks for empty text
  if (text_len == 0) {
          return false;  /*** bounds did not change ***/
  }

/********************************* GLUI_EditText::draw_text() ****************/

void    GLUI_EditText::draw_text( int x, int y )
{
  GLUI_DRAWINGSENTINAL_IDIOM
  int text_x, i, sel_lo, sel_hi;


  if ( debug )    dump( stdout, "-> DRAW_TEXT" );

  if ( NOT draw_text_only ) {
    if ( enabled )
      glColor3f( 1., 1., 1. );
    else
      set_to_bkgd_color();
    glDisable( GL_CULL_FACE );
    glBegin( GL_QUADS );
    glVertex2i( text_x_offset+2, 2 );     glVertex2i( w-2, 2 );
    glVertex2i( w-2, h-2 );               glVertex2i( text_x_offset+2, h-2 );
    glEnd();
  }

  // JOHN: empty text
  if (text.size() == 0)
      return;




/******************************** GLUI_EditText::draw_insertion_pt() *********/

void     GLUI_EditText::draw_insertion_pt( void )
{
  int curr_x, i;

  if ( NOT can_draw() )
    return;

  /*** Don't draw insertion pt if control is disabled ***/
  if ( NOT enabled )
    return;

  if ( debug )    dump( stdout, "-> DRAW_INS_PT" );

  if ( sel_start != sel_end OR insertion_pt < 0 ) {
    return;  /* Don't draw insertion point if there is a current selection */
  }

  /*    printf( "insertion pt: %d\n", insertion_pt );              */

  curr_x = this->x_abs + text_x_offset 
    + substring_width( substring_start, substring_end )
    + 2                             /* The edittext box has a 2-pixel margin */
    + GLUI_EDITTEXT_BOXINNERMARGINX;   /** plus this many pixels blank space
                     between the text and the box       **/

  // JOHN: avoid repeat on zero char
  if (text.size() > 0)
  for( i=substring_end; i>=insertion_pt; i-- ) {
    curr_x -= char_width( text[i] ); 
  }  

GLUI 2.36

https://sourceforge.net/p/glui/bugs/32/

Hi,

I send you a patch for the examples of glui.
I hope that you will apply it.
thanks.

Index: src/example/example1.cpp
===================================================================
--- src/example/example1.cpp
+++ src/example/example1.cpp    2010-03-21 18:03:22.000000000 +0100
@@ -136,7 +136,7 @@

   glutMainLoop();

-  return EXIT_SUCCESS;
+  return 0;
 }


Index: src/example/example2.cpp
===================================================================
--- src/example/example2.cpp
+++ src/example/example2.cpp    2010-03-21 18:05:05.000000000 +0100
@@ -253,5 +253,5 @@

   glutMainLoop();

-  return EXIT_SUCCESS;
+  return 0;
 }
Index: src/example/example3.cpp
===================================================================
--- src/example/example3.cpp
+++ src/example/example3.cpp    2010-03-21 18:07:04.000000000 +0100
@@ -437,6 +437,6 @@
   /**** Regular GLUT main loop ****/  
   glutMainLoop();

-  return EXIT_SUCCESS;
+  return 0;
 }

Index: src/example/example4.cpp
===================================================================
--- src/example/example4.cpp
+++ src/example/example4.cpp    2010-03-21 18:08:13.000000000 +0100
@@ -351,6 +351,6 @@

   glutMainLoop();

-  return EXIT_SUCCESS;
+  return 0;
 }

Index: src/example/example5.cpp
===================================================================
--- src/example/example5.cpp
+++ src/example/example5.cpp    2010-03-21 18:09:45.000000000 +0100
@@ -496,6 +496,6 @@

   glutMainLoop();

-  return EXIT_SUCCESS;
+  return 0;
 }

GLUI_List can't find last item

https://sourceforge.net/p/glui/bugs/21/

initial report

  1. make a GLUI_List called lbSeries, put 2 items in it
  2. make a button that tries to perform an operation based the selected item's text
  3. control_cb callback for the button click:
    int id= lbSeries->get_current_item();
    GLUI_List_Item* item = lbSeries->get_item_ptr(id);
    engine->DoSomething(std::string(item->text.c_str()));

Works fine for the 1st item in the list. For item #2, lbSeries->get_item_ptr(1) always returns NULL, even though the current item selected is id==1

reply 1

This is because get_item_ptr works off id's (which are intrinsic to list items) while get_current_item returns an ordinal index.

The list API needs work.

Slider

https://sourceforge.net/p/glui/feature-requests/14/

initial report

I would like to have a slider (like in java swing :)) for adjusting values (f.e. colors) on a fast but not to detailed way.
Until now I take either a spinner (which is somehow to detailed) or a transformator (which is somehow strange and not its purpose).

The slider should have a horizontal or vertical form, should perhaps have a minimum and maximum value, and should have an adjustable tick space.
Perhaps minimum and maximum values should be labeled.

reply 1

Scrolling has been recently added to cvs,
a slider variation would also be good.

glui->close() revisited

https://sourceforge.net/p/glui/bugs/20/

original report

I searched the forum and found one other instance of
this problem, but no solution. The bug occurs during a
call to glui->close() and occurs on the windows
platform exclusively. This bug was uncovered as part of
work on a project in which a handful of UI pop-up
windows are necessary to support some detailed
functionality. Each popup window is in its own class,
of which an instance is created when the user wishes to
view the pop-up window. When the user has completed
work with the window and clicks the โ€œOKโ€ button the
window is closed using glui->close() and the parent
class is notified so it can delete the instance of the
class. This setup has been working fine just so far on
the mac, but on windows, the infinite loop lockup occurs.

As for more details on this infinite loop lockup; Iโ€™ve
spent a few days now trying fruitlessly to obtain a
solution to this one. I traced the crash down through
glui and glut all the way down to a OpenGL call. The
lock occurs in glutReportErrors (line 46 of
glut_util.c), where the following code is called:

GLenum error;
while ((error = glGetError()) != GL_NO_ERROR)
__glutWarning("GL error: %s", gluErrorString(error));

The problem that is occurring at this point is that
glGetError, or at least the nVidia build, will always
return GL_INVALID_OPERATION and will never return
GL_NO_ERROR. I have tested this in a project with
nothing but the gl.h, glu.h, and a while loop to
glGetError, and it does in fact lock.

There are two strange things about this. First,
glutReportErrors is called from the work loop only when
the __glutDebug flag is set. And from as far as I can
tell, this only occurs through using the โ€“gldebug
command line flag. Second, it only calls
glutReprotErrors after closing the window.

If I go into the glui library and comment out
glutDestroyWindow(glutGetWindow()); in
GLUI_Main::close_internal( void ) (line 1363 of
glui.cpp) then the lock never occurs. GLUI cleans up
everything properly and Iโ€™m left with a shell of a
window like Iโ€™d expect.

Just to check glutDestroyWindow for bugs, I built a
test program that involved creating and destroying
multiple windows using glut only and no glui, this did
work successfully.

As a last ditch effort to stem this problem, I built
glut with the modified line:

#ifndef _WIN32
GLenum error;
while ((error = glGetError()) != GL_NO_ERROR)
    __glutWarning("GL error: %s", gluErrorString(error));
#endif

While this did stop the infinite loop, it did cause me
to get a null pointer exception upon closing a window.
The null pointer, is suspect, is the root of this bug,
but I have not had the time or patience to try to track
that down further.

Attached is a modified version of example2 which opens
and closes the side window in a similar method to the
one in our project. If you run this on a windows
system, you should see the console become spammed with
a GLUT Warning message when you hit the close button on
the side panel. (I apologies for the sloppiness of the
code, I was just trying to get something quick and
dirty working for testing).

If you need any additional information, you can contact
me at [email protected].

class SideBar {

public:

    /** These are the live variables passed into GLUI ***/
    static int  wireframe;
    static int  obj;
    static int  segments;
    static char text[200];

    SideBar();
    static void control_cb( int control );

private:
    static GLUI *glui;

    static GLUI_Checkbox    *checkbox;
    static GLUI_Spinner *spinner;
    static GLUI_RadioGroup  *radio;
    static GLUI_EditText    *edittext;
};

/****************************************************************************

  example2.cpp

  A simple GLUT program using the GLUI User Interface Library

  -----------------------------------------------------------------------

  9/9/98 Paul Rademacher ([email protected])

****************************************************************************/

#include <string.h>
#include <GL/glut.h>
#include "glui.h"
#include "My Example.h"

float xy_aspect;
int   last_x, last_y;
float rotationX = 0.0, rotationY = 0.0;
int   main_window;
bool iClosed = false;

SideBar *myBar;

/**************************************** myGlutKeyboard() **********/

void myGlutKeyboard(unsigned char Key, int x, int y)
{
  switch(Key)
  {
  case 27: 
  case 'q':
    exit(0);
    break;
  };

  glutPostRedisplay();
}


/***************************************** myGlutMenu() ***********/

void myGlutMenu( int value )
{
  myGlutKeyboard( value, 0, 0 );
}


/***************************************** myGlutIdle() ***********/

void myGlutIdle( void )
{

    if (iClosed) {
        //delete myBar;
        iClosed = false;
        printf("Deleted!\n");
    }

    /* According to the GLUT specification, the current window is 
     undefined during an idle callback.  So we need to explicitly change
     it if necessary */
  if ( glutGetWindow() != main_window) 
    glutSetWindow(main_window);  

  glutPostRedisplay();
}

/***************************************** myGlutMouse() **********/

void myGlutMouse(int button, int button_state, int x, int y )
{
  if ( button == GLUT_LEFT_BUTTON && button_state == GLUT_DOWN ) {
    last_x = x;
    last_y = y;
  }
}


/***************************************** myGlutMotion() **********/

void myGlutMotion(int x, int y )
{
  rotationX += (float) (y - last_y);
  rotationY += (float) (x - last_x);

  last_x = x;
  last_y = y;

  glutPostRedisplay(); 
}

/**************************************** myGlutReshape() *************/

void myGlutReshape( int x, int y )
{
  xy_aspect = (float)x / (float)y;
  glViewport( 0, 0, x, y );

  glutPostRedisplay();
}

/***************************************** myGlutDisplay() *****************/

void myGlutDisplay( void )
{
  glutSetWindow(main_window);
    glClearColor( .9f, .9f, .9f, 1.0f );
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  glFrustum( -xy_aspect*.08, xy_aspect*.08, -.08, .08, .1, 15.0 );

  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  glTranslatef( 0.0f, 0.0f, -1.6f );
  glRotatef( rotationY, 0.0, 1.0, 0.0 );
  glRotatef( rotationX, 1.0, 0.0, 0.0 );

  /*** Now we render object, using the variables 'obj', 'segments', and
    'wireframe'.  These are _live_ variables, which are transparently 
    updated by GLUI ***/

  if ( myBar->obj == 0 ) {
    if ( myBar->wireframe )      
      glutWireSphere( .6, myBar->segments, myBar->segments );
    else                  
      glutSolidSphere( .6, myBar->segments, myBar->segments );
  }
  else if ( myBar->obj == 1 ) {
    if ( myBar->wireframe )
      glutWireTorus( .2,.5,16,myBar->segments );
    else
      glutSolidTorus( .2,.5,16,myBar->segments );
  }

  glDisable( GL_LIGHTING );  /* Disable lighting while we render text */
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  gluOrtho2D( 0.0, 100.0, 0.0, 100.0  );
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  glColor3ub( 0, 0, 0 );
  glRasterPos2i( 10, 10 );

  //  printf( "text: %s\n", text );

  /*** Render the live character array 'text' ***/
  int i;
  for( i=0; i<(int)strlen( myBar->text ); i++ )
    glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, myBar->text[i] );

  glEnable( GL_LIGHTING );

  glutSwapBuffers(); 
}


/**************************************** main() ********************/

void main(int argc, char* argv[])
{

  /****************************************/
  /*   Initialize GLUT and create window  */
  /****************************************/
  glutInit(&argc, argv);

  glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
  glutInitWindowPosition( 50, 50 );
  glutInitWindowSize( 300, 300 );

  main_window = glutCreateWindow( "GLUI Example 2" );
  glutDisplayFunc( myGlutDisplay );
  glutReshapeFunc( myGlutReshape );  
  glutKeyboardFunc( myGlutKeyboard );
  glutMotionFunc( myGlutMotion );
  glutMouseFunc( myGlutMouse );

  /****************************************/
  /*       Set up OpenGL lights           */
  /****************************************/

  GLfloat light0_ambient[] =  {0.1f, 0.1f, 0.3f, 1.0f};
  GLfloat light0_diffuse[] =  {.6f, .6f, 1.0f, 1.0f};
  GLfloat light0_position[] = {1.0f, 1.0f, 1.0f, 0.0f};

  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);

  /****************************************/
  /*          Enable z-buferring          */
  /****************************************/

  glEnable(GL_DEPTH_TEST);

  myBar = new SideBar;

  /* We register the idle callback with GLUI, *not* with GLUT */
  GLUI_Master.set_glutIdleFunc( myGlutIdle );

  glutMainLoop();
}

/** These are the live variables passed into GLUI ***/
int              SideBar::wireframe = 0;
int              SideBar::obj = 0;
int              SideBar::segments = 8;
char             SideBar::text[200] = {"Hello World!"};
GLUI            *SideBar::glui;
GLUI_Checkbox   *SideBar::checkbox;
GLUI_Spinner    *SideBar::spinner;
GLUI_RadioGroup *SideBar::radio;
GLUI_EditText   *SideBar::edittext;

SideBar::SideBar() {
    /****************************************/
    /*         Here's the GLUI code         */
    /****************************************/

    glui = GLUI_Master.create_glui( "GLUI", 0, 400, 50 ); /* name, flags, x, and y */


    glui->add_statictext( "GLUI Example 2" );
    glui->add_separator();
    checkbox = glui->add_checkbox( "Wireframe", &wireframe, 1, control_cb );
    spinner  = glui->add_spinner( "Segments:",GLUI_SPINNER_INT, &segments,
                2, control_cb );
    spinner->set_int_limits( 3, 60 );
    edittext = glui->add_edittext( "Text:", GLUI_EDITTEXT_TEXT, text, 
                    3, control_cb );
    GLUI_Panel *obj_panel = glui->add_panel( "Object Type" );
    radio = glui->add_radiogroup_to_panel(obj_panel,&obj,4,control_cb);
    glui->add_radiobutton_to_group( radio, "Sphere" );
    glui->add_radiobutton_to_group( radio, "Torus" );
    glui->add_button( "Close Me!", 5, SideBar::control_cb );

    glui->set_main_gfx_window( main_window );
}

void SideBar::control_cb( int control ) {
    /********************************************************************
    Here we'll print the user id of the control that generated the
    callback, and we'll also explicitly get the values of each control.
    Note that we really didn't have to explicitly get the values, since
    they are already all contained within the live variables:
    'wireframe',  'segments',  'obj',  and 'text'  
    ********************************************************************/

    printf( "callback: %d\n", control );
    printf( "             checkbox: %d\n", checkbox->get_int_val() );
    printf( "              spinner: %d\n", spinner->get_int_val() );
    printf( "          radio group: %d\n", radio->get_int_val() );
    printf( "                 text: %s\n", edittext->get_text() );

    if (control == 5) {
        glui->close();
        iClosed = true;
    }
}

reply 1

Ok I have been playing with this all night. The only solution that actually seems to work is to unlink the window with glui::unlink() and then to destroy the window with GLUT.

GLUI window does not know size of subwindow

https://sourceforge.net/p/glui/bugs/13/

I created a subwindow with controls on it, but since the
main GLUI window (the subwindows' parent) doesn't
know how much space to leave for the subwindow, it
truncates those controls. Please see attached code. It
this code I made the window big enough by adding
many separators and columns to the main window to
fool it into thinking the window is bigger; that way the
sub window shows. But shouldn't GLUI know the size of
its subwindow to that is not needed?

//  A simple GLUT program using the GLUI User Interface Library
// This program uses only a dialog box without any openGL drawing 

// the next line suppresses the console window
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) 
#include <string.h>
#include <GL/glut.h>
#include "glui.h"
int   main_window;
char  text[sizeof(GLUI_String)] = {"Hello World! GLUI as a dialog app!"};
GLUI_EditText   *edittext;
void myGlutIdle( void )
{
  glutSetWindow(main_window);  
  glutPostRedisplay();
}
void myGlutDisplay( void )
{
  glClearColor( .9f, .9f, .9f, 1.0f );
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  gluOrtho2D( 0.0, 100.0, 0.0, 100.0  );
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
  glColor3ub( 0, 0, 0 );
  glRasterPos2i( 10, 10 );
  int i;
  for( i=0; i<(int)strlen( text ); i++ )
    glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, text[i] );
  glutSwapBuffers(); 
}
void myGlutKeyboard(unsigned char Key, int x, int y)
{
  glutSetWindow(main_window);  
  glutPostRedisplay();
}
void control_cb( int control )
{
  myGlutDisplay();
}
void main(int argc, char* argv[])
{
  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  glutInitWindowPosition(100,100);
  glutInitWindowSize(300,300);
  GLUI *glui = GLUI_Master.create_glui( "GLUI", 0, 400, 50 ); 
                                    /* name, flags, x, and y */
  main_window = glui->get_glut_window_id();

  // The purpose of these separators is to make space for the embedded window
  // of controls. Without them, GLUI does not make the window large enough
  for( int i = 0; i < 15; i++ )
  {
    glui->add_separator();
  }
  for( i = 0; i < 20; i++ )
  {
    glui->add_column( true );
  }
  GLUI *glui_subwin = GLUI_Master.create_glui_subwindow ( main_window, GLUI_SUBWINDOW_TOP );
  glui_subwin->set_main_gfx_window( main_window );
  glutKeyboardFunc( myGlutKeyboard );
  glui_subwin->add_statictext( "GLUI dialog application" );
  glui_subwin->add_separator();
  // For some reason, the arrow keys, and backspace are not being recognized
  // in the editbox, however, I can select text with mouse and type over it that way
  edittext = 
  glui_subwin->add_edittext( "Text:", GLUI_EDITTEXT_TEXT, text, 1, control_cb );
  edittext->set_w( sizeof( text ) );
  glui_subwin->add_button( "Quit", 0,(GLUI_Update_CB)exit );
  glui_subwin->set_main_gfx_window( main_window );
  // Although the manual suggest registering the idle function with GLUI
  // for some reason this results in continuous updates to the window
  //GLUI_Master.set_glutIdleFunc( myGlutIdle );
  GLUI_Master.set_glutIdleFunc( NULL );
  GLUI_Master.set_glutDisplayFunc(myGlutDisplay);
  // Although the manual suggests registering this with GLUI, the program
  // crashes when I do it.
  //GLUI_Master.set_glutKeyboardFunc(myGlutKeyboard);
  glutMainLoop();
}

msvc project configuration

https://sourceforge.net/p/glui/bugs/19/

Hello,

msvc project build example 1 2 3 and 4 which don't
work. a glut error " called without
first calling 'glutInit'".
The problem can be solved changed in the properties the
linker/input/additional dependencies and instead
"glut32.lib glu32.lib opengl32.lib odbc32.lib
odbccp32.lib", only putting "odbc32.lib odbccp32.lib"
like in example 5 and 6

Damien

translation doesn't sync live variables

https://sourceforge.net/p/glui/bugs/24/

When using a translation control, the application cannot successfully modify the control values. Calls to sync_live() do not update the values returned from the control. Calls to set_x only seem to affect the control between invokations.

/*
  Compile, and run.  

  Move the translation control until the values are being clamped
  substantially.  Note that as the control is moved further out of bounds, the
  values are clamped but the control does not update.  See comment in callback().

  The real user interface issue with this is that once the control is dragged
  outside the clamped zone, it must be dragged back in as if the values were
  never clamped.

 */

#include <stdio.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#include <GLUI/glui.h>
#else
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glui.h>
#endif

GLUI *glui;
GLUI_Translation *xlate;
float position[2];
int do_set = 0;


void display()
{
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glutSwapBuffers();
}

#define POSITION_ID 1
#define RADIO_ID 2

void callback(int ctrl)
{
    int i;
    int clamped = 0;

    switch (ctrl) {
    case POSITION_ID: {
    fprintf(stderr, "%g %g", position[0], position[1]);
    for (i=0 ; i < 2 ; i++) {
        if (position[i] > 10.0) {
        clamped = 1;
        position[i] = 10.0;
        }
        if (position[i] < 0.0) {
        clamped = 1;
        position[i] = 0.0;
        }
    }
    if (clamped) {
        /* This should update GLUI so that it
         * knows what the new position is.
         * This doesn't work
         */

        fprintf(stderr, "  clamped to %g %g ", position[0], position[1]);

        if (do_set) {
        xlate->set_x(position[0]); // These only work *between* invokations of the control
        xlate->set_y(position[1]);
        fprintf(stderr, "set\n");
        } else {
        glui->sync_live(); // This doesn't seem to have change anything!!!!
        fprintf(stderr, "synced\n");
        }
    } else
        fprintf(stderr, "\n");
    break;
    }
    case RADIO_ID:
    fprintf(stderr, "do_set %d\n", do_set);
    break;
    }
    glutPostRedisplay();
}

int main(int ac, char *av[])
{
    int main_window;

    glutInit(&ac, av);
    glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
    glutInitWindowSize(256,256);

    main_window = glutCreateWindow("mainWindow");

    glutDisplayFunc(display);

    glui = GLUI_Master.create_glui_subwindow(main_window, GLUI_SUBWINDOW_RIGHT);
    xlate = glui->add_translation("xy", GLUI_TRANSLATION_XY, position, POSITION_ID, callback);
    GLUI_RadioGroup *rg = glui->add_radiogroup(&do_set, RADIO_ID, callback);
    glui->add_radiobutton_to_group(rg, "sync");
    glui->add_radiobutton_to_group(rg, "set");
    glui->set_main_gfx_window(main_window);
    glutMainLoop();
}

GLUI controls sometimes invisible

https://sourceforge.net/p/glui/bugs/10/

The Glui controls (buttons, checkboxes) are sometimes
invisible on my machine, for instance in example1,
whereas the other examples work well. The same problems
occurs in other Glui applications, It seems that this
bug was known in earlier versions and should have been
fixed in 2.1, but I am using 2.2 (compiled from source
under Linux) and still have this problem.

My system:
Slackware Linux 10.1 on Intel Pentium4, Kernel 2.4.29,
x11-6.8.1 from x.org with OpenGL-1.2, glu-1.3,
glut-3.7, nVidia accelerated driver set 1.0-6111.
Glui_2_2 downloaded from sourceforge, compiled with
gcc-3.3.4

sincerely
Wolfgang Pichl
[email protected]

Spinner callback not always invoked

https://sourceforge.net/p/glui/bugs/17/

When I use a spinner with limits, the spinner's
callback function is not always executed in response
to a spinning event.

I have made a small sample (file 'Bug.cpp'):

  1. Two integer spinners, each limited in the
    range 0-100.
  2. Whenever you increase one spinner, the other
    one decrease.
  3. The total sum of both spinners should always
    remain 100.

In order to invoke the bug, do the following:

  1. Spin spinner #2 down to 0 (spinner #1's value
    is now 100).
  2. Edit spinner #2's textbox and set it to 2
    (spinner #1's value is now 98).
  3. Spin spinner #2 again to 0 (spinner #1's
    value remains 98).

This is my analysis:

  1. After you edit the textbox and set it to
    2, 'last_int_val' remains 0.
  2. When you spin again, 'int_val' is set to 0,
    and turns equal to 'last_int_val'.
  3. As a result, the function 'do_callbacks'
    returns without executing the callback.

See file 'glui_spinner.cpp', function 'do_callbacks',
lines 454-456.
One possible solution is to disable the above lines.
The right solution would probably be to
update 'last_int_val' when the spinner's text is
changed through the textbox (assuming my analysis is
correct).
Note that if you set the value to more than 2, then
the bug does not occur. I believe that 'int_val'
doesn't reach 0 in this case, but I have not
investigated that to full extent.

#include <GL/glut.h>
#include <GL/glui.h>


int main_window;


void myGlutIdle()
{
  if (glutGetWindow()!=main_window)
      glutSetWindow(main_window);
  glutPostRedisplay();
}


void myGlutReshape( int x, int y )
{
  glViewport(0,0,x,y);

  glutPostRedisplay();
}


void myGlutDisplay()
{
  glutSwapBuffers(); 
}


GLUI_Spinner* spinner1;
GLUI_Spinner* spinner2;


void func1(int i)
{
    spinner2->set_int_val(100-spinner1->get_int_val());
}


void func2(int i)
{
    spinner1->set_int_val(100-spinner2->get_int_val());
}


void main(int argc, char* argv[])
{
  glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
  glutInitWindowPosition( 50, 50 );
  glutInitWindowSize( 300, 300 );

  main_window = glutCreateWindow( "GLUI Bug" );
  glutDisplayFunc( myGlutDisplay );
  glutReshapeFunc( myGlutReshape );  

  GLUI *glui = GLUI_Master.create_glui( "GLUI" );
  spinner1 = glui->add_spinner("1",GLUI_SPINNER_INT,NULL,0,func1);
  spinner2 = glui->add_spinner("2",GLUI_SPINNER_INT,NULL,0,func2);
  spinner1->set_int_limits(0,100);
  spinner2->set_int_limits(0,100);
  spinner1->set_int_val(98);
  spinner2->set_int_val(2);

  glui->set_main_gfx_window( main_window );

  GLUI_Master.set_glutIdleFunc( myGlutIdle ); 

  glutMainLoop();
}

Incorrect FindClose() file handle

https://sourceforge.net/p/glui/bugs/28/

(Sorry for creating a duplicate report. Please ignore the first report, I wasn't logged in properly).

In version 2.35 for Windows, GLUI_FileBrowser() contains a bug when calling the windows function FindClose(). The call to FindClose() incorrectly passes in the FN variable address instead of the file handle "hFind". An exception gets thrown as a result.

It should be "FindClose(hFind);" instead of "FindClose(&FN);".

Please contact me at my email address on file because I'd like to know the outcome of this report.

BTW, I've enjoyed using GLUI and think it's a great product. Thanks for contributing GLUI to the community.

Thanks,
Dan

Need gettimeofday (no ftime available on some platforms)

https://sourceforge.net/p/glui/bugs/22/

Trying to compile glui-2.35 on OS X 10.3:

g++ -I./ -I./include -I/usr/X11R6/include -c glui_list.cpp
glui_list.cpp: In member function virtual int GLUI_List::mouse_down_handler(int, int)': glui_list.cpp:92: error:ftime' undeclared (first use this function)
glui_list.cpp:92: error: (Each undeclared identifier is reported only once for
each function it appears in.)
make: *** [glui_list.o] Error 1

and sys/timeb.h has a note:

/ The ftime(2) system call structure -- deprecated. /

so not sure how (or even if) I can access that function or struct. The alternative way to get time is the gettimeofday() function, which appears to be the same pieces of data as ftime() but in different structs.

--- glui-2.35.orig/src/glui_list.cpp    2007-07-22 17:55:58.000000000 -0400
+++ glui-2.35/src/glui_list.cpp 2007-07-22 17:35:47.000000000 -0400
@@ -18,7 +18,7 @@

 #include "glui_internal_control.h"
 #include <cmath>
-#include <sys/timeb.h>
+#include <sys/time.h>

 /****************************** GLUI_List::GLUI_List() **********/

@@ -88,9 +88,8 @@
 {
   int tmp_line;
   unsigned long int ms;
-  timeb time;
-  ftime(&time);
-  ms = time.millitm + (time.time)*1000;
+  struct timeval tv;
+  ms = tv.tv_usec + (tv.tv_sec)*1000;

   tmp_line = find_line( local_x-x_abs, local_y-y_abs-5 );  
   if ( tmp_line == -1 ) {

File support

https://sourceforge.net/p/glui/feature-requests/7/

initial report

The number one thing I want to do with my quick n dirty
GLUI UIs that is hard right now is opening files. Some
sort of built in file chooser widget would be really
handy. Of course it's kind of tricky when you're
penned in by GLUT's limitations, but still I've got
something hacked up in my own code to show files in
GLUT menus. Something could be done.

reply 1

Yes, i agree, using the system-specific file browser
would be a nice addition to GLUI.

Nigel

user sub-window / better sub-window managment

https://sourceforge.net/p/glui/feature-requests/4/

When you want to make an interface such as example 5,
you see that you have to create 2 glui subwindow (right
and bottom) this leeds to create 2 glut sub windows
which mean 2 separate openGL context.

I think it will be nicer to have only one glui subwindow
for the UI and another glut subwindow on which the user
can draw.

I'm not sure I remember well how glut work (and if this
possible... ) but I think it will be better this way

David

Modified GLUI

https://sourceforge.net/p/glui/patches/4/

The version attached is a modified version of GLUI. The
modifications were done as part of the Doris project
(http://doris.sf.net). The modifications were done by
the user "bacontastesgood" (at sf.net). He is no longer
maintaining the code and so I am passing it over to you
to see if it is any use. It appears to be in the public
domain. You may find it of no use.

The code was modified some time ago so I forget all the
details of what was changed and why. I think the idea
was to add skinning and improve the rendering
performance. I've found however that I get some kind of
glitch which slows/stutters the framerate. Looking at
the history (which of course you can read on the Doris
SF project page), changes include:

massive cleanup still, rearranged glui.h to avoid
forward declarations, lots of variable renaming and
general cleanup

split glui.cpp apart, more general cleanup

removed stdinc.h, added glui_private.h, removed
global dependencies on string.h and stdlib.h
    removed GLUI_String entirely
renamed GLUI_Control::set_text to set_control_text
retrofitted some more const correctness
more general variable cleanup, renaming, scope control
added buffer safety stuff (snprintf)

moved some more constructors into C++ files
    massive start of clean up, including switchin back
    to double buffered rendering, removing unused code,
    removing/replacing unnecessary types (RGBc, Byte, etc.).

added hilite color

migrated chunks of defines into enums

started renaming and privatizing variables

I'm reverting back to GLUI 2.2 from this fork because
it breaks my script binding code (i.e. the API has
changed), and I don't want to have to support this fork
(e.g. the current stuttering bug for starters...).

Nick

glutInit missing

https://sourceforge.net/p/glui/bugs/15/

initial report

The example program crashes with the message

freeglut ERROR: Function called
without first calling 'glutInit'.

This can be avoided by adding the line

glutInit( &argc, argv );

in the beginning of the main method of every example.

Should be fixed in CVS.

reply 1

Throws whole slew of ugly "CGSNewWindow: Invalid connection"
errors when linking against Apple's GLUT framework. This
needs flagging up/correcting, as these errors shed no light
on the problem - I only got GLUI working on OSX by comparing
example code to known good code.

Scrollable content!

https://sourceforge.net/p/glui/feature-requests/5/

My GLUI UI always ends up being a huge column that gets
too long to fit on the screen at once. I use rollouts
extensively, but it's a pain to open and close them all
the time.

If you look at 3DSMax (where Paul copied the rollout
widget from), the rollout panel is scrollable and can
actually be scrolled just by clicking and dragging on
any non-active part of the window. That would be nice
to have.

Native menu

https://sourceforge.net/p/glui/feature-requests/2/

original report

I think It would be a godd idea to provide a kind
a "native" pseudo-menu that does not rely on glut menu
which does not have the same font color etc ...

I think this can be done creating a "pop up"
subwindow ...

David

reply 1

David,

Have you had a look at the way popup menus are done
in freeglut, using OpenGL. I think they could use some
refinement, but certainly demonstrate the principle.

Nigel

reply 2

Hmmm... Can it be done in a portable way?

There is no intention of introducing X11 or Win32
specific code into GLUI.

reply 3

I've not looked at freglut

I was thinking of allowing a king of "subwindow" that would
not be dockable link the other but can be placed anywhere
we want : in that case next a button ...

C++ Object Callbacks

https://sourceforge.net/p/glui/feature-requests/9/

initial report

I'm trying to create an object which is a
conglomeration of GLUI controls, including a couple
buttons.

In an initialize or constructor function i create and
setup all the controls, being given a pointer to a GLUI
object. The problem is the buttons on the widget. If
the user clicks one button, i want to get and store the
current selection in a listbox for later polling by the
user of my object; if they click the 'cancel' button, i
want the object to just clean all the GLUI objects and
itself that it created.

It doesn't seem possible to have a function pointer to
a C++ member function, unless the function is declared
static... in which case it won't have access to the
slots or member functions that I need it to. It seems
to me the only alternative is to have a loop of sorts
that does a continuous get_int_val or similar on the
buttons.
This is undesirable as its slow and kludgy, and it may
require the user to know more about my object (theyd
have to create the object, and create a loop in THEIR
to continuously poll on it) than they should.

Are there any recommendations on a way to do this? Is
there a planned API change to make this type of thing
more 'friendly' ?

By the way, this is a file-selection widget so it ties
in nicely to RFE
"[ 889921 ] File support". I will of course release it
for other GLUI users to use and hope to get feedback /
ideas for enhancement / etc.

Thanks.

reply 1

Or, as a more genreal purpose solution, the ability to provide
an additional void* associated with each callback function, so
we can typcast it and invoke the class member-function in
our own static handler.

maybe just have something like this:

class MyHandler
{
protected:
GLUI* _glui;
public:

 virtual void checkbox_changed(int id)
 { .... }

 static void control_cb(int id)
 {
      MyHandler* obj = (MyHandler*)glui->get_user_data() ;
      obj->checkbox_changed(id);
 }

  ...

};

....

MyHandler data;
glui->add_checkbox( "Wireframe", &wireframe, 1,
MyClass::control_cb, (void*)&handler);

Filebrowser descends/ascends two levels

https://sourceforge.net/p/glui/bugs/26/

The function void GLUI_FileBrowser::dir_list_callback(GLUI_Control *glui_object)
in glui_filebrowser.cpp does 2 directory changes when gnuc compiler used in windows. Easily seen if you double click on the .. in the browser and it takes you up not to the parent directory but rather the "grand"parent directory.

The problem lines are

#ifdef GNUC
    chdir(selected+1);
#endif
#ifdef _WIN32
    SetCurrentDirectory(selected+1);
#endif

because both GNUC and WIN32 are true when using my gnuc compiler in windows ie dev-cpp.

The logical fix seems to be to change to an #elif as follows

#ifdef GNUC
    chdir(selected+1);
#elif _WIN32
    SetCurrentDirectory(selected+1);
#endif

main should return int

https://sourceforge.net/p/glui/bugs/16/

In all example.cpp files, main is defined as void main.
Many compilers (I use gcc 4.0.2) fail to compile the
code since main should have return type int.

Replacing "void main()" with "int main()" in all the
cpp files solves the problem. So please do so.

More OO friendly API

https://sourceforge.net/p/glui/feature-requests/6/

The GLUI code is all written in C++ and all the widgets
are classes etc, which makes a lot of sense.

BUT! The way to create and add widgets is through a
billion different methods of the GLUI class. And a
different one for add_to_panel vs add to main window??
This is a really odd way to do OO UI code. The GLUI
class should have just one add API that takes a
GLUI_control, and all the code in glui_add_controls.cpp
should instead go into the constructors of the
individual widgets.

In fact the way these things are typically done with
other toolkits is that you just pass in the parent in
the constructor. So instead of

GLUI_Checkbox *cb = myglui->add_checkbox_to_panel(
mypanel, "Check me out!", &value, MY_CB_ID, updateCB);

You would do
GLUI_Checkbox *cb = new GLUI_Checkbox(mypanel, "Check
me out!", &value, MY_CB_ID, updateCB);

It doesn't make for any more typing (actually, a little
less typing in this case) and it means that GLUI
doesn't explicitly have to know about every
GLUI_Control subclass in existence. That means GLUI
becomes more extensible because people can write their
own reusable widget subclasses without having to modify
glui.h to add
GLUI::add_my_ultracool_widget(...) and
GLUI::add_my_ultracool_widget_to_panel(...)
methods.

Plus this will make a lot more sense to people who are
used to other C++ GUI APIs (wxWindows, Qt, FOX, to name
a few).

GLUI_Rollout closed set_w

https://sourceforge.net/p/glui/bugs/1/

original report

In glui example5.cpp ln 407

/ Add another rollout /
GLUI_Rollout *options = glui->add_rollout( "Options",
false );
glui->add_checkbox_to_panel( options, "Draw sphere",
&show_sphere );
glui->add_checkbox_to_panel( options, "Draw torus",
&show_torus );
glui->add_checkbox_to_panel( options, "Draw axes",
&show_axes );
glui->add_checkbox_to_panel( options, "Draw text",
&show_text );

If you want to set a width using the following command
on a closed rollout:
options->set_w(180);

This will cause the rollout to malfunction. It seems to
not refresh the frame containing the glui elements.

Cheers
Stefan

Problem observed in following case:

/ Add another rollout /
GLUI_Rollout *options = glui->add_rollout( "Options",
true );
glui->add_checkbox_to_panel( options, "Draw sphere",
&show_sphere );
glui->add_checkbox_to_panel( options, "Draw torus",
&show_torus );
glui->add_checkbox_to_panel( options, "Draw axes",
&show_axes );
glui->add_checkbox_to_panel( options, "Draw text",
&show_text );

options->close();
options->set_w(180);

reply 1

Yes, this is a serious problem putting the GLUI
application in an unusable state. At a quick
glance, it seems to be related to the call to
glui->pack_controls() in GLUI_Control::set_w.

reply 2

This bug seems top depend on the OpenGL library:

With libGL of libxfree86-4.3-23mdk
(LD_PRELOAD=/usr/X11R6/lib/libGL.so.1.2 bin/example5)
and libGL of libMesaGL1-5.0.1-5mdk
( LD_PRELOAD=/usr/X11R6/libGL.so.1.4.501 bin/example5)
this bug is not present.

But with the OpenGL library provided by the NVIDIA driver
version 4496
(LD_PRELOAD=/usr/lib/libGL.so.1.0.4496 bin/example5)
I have exactly the same bug.

(I am under Mandrake Linux 9.2)

makefile patch to support OSX

https://sourceforge.net/p/glui/patches/9/

Context diff of changes to makefile to support building on either linux or Mac OS X.

*** makefile    Mon Aug 20 23:59:54 2007
--- makefile.new    Tue Jun  3 22:14:16 2008
***************
*** 11,28 ****

  UNAME = $(shell uname)

  ifeq ($(UNAME), Linux)
  CXX       = g++
  CPPFLAGS += $(OPTS) -Wall -pedantic
  endif

  #######################################

- CPPFLAGS += -I./ -I./include

  LIBGLUI = -L./lib -lglui
- LIBGL   = -lGLU -lGL
- LIBS    = -lXmu -lXext -lX11 -lXi -lm

  # One of the following options only...

--- 11,38 ----

  UNAME = $(shell uname)

+ CPPFLAGS += -I./ -I./include
+ 
  ifeq ($(UNAME), Linux)
  CXX       = g++
  CPPFLAGS += $(OPTS) -Wall -pedantic
+ LIBGL   = -lGLU -lGL
+ LIBS    = -lXmu -lXext -lX11 -lXi -lm
+ LIBGLUT   = -L/usr/X11R6/lib -lglut
+ CPPFLAGS += -I/usr/X11R6/include
+ endif
+ 
+ ifeq ($(UNAME), Darwin)
+ CXX = g++
+ CPPFLAGS += $(OPTS) -Wall -pedantic
+ LIBGL = -framework OpenGL
+ LIBGLUT = -framework GLUT
  endif

  #######################################


  LIBGLUI = -L./lib -lglui

  # One of the following options only...

***************
*** 35,42 ****
  # CPPFLAGS += -I/usr/X11R6/include -DGLUI_FREEGLUT

  # (3) GLUT
! LIBGLUT   = -L/usr/X11R6/lib -lglut
! CPPFLAGS += -I/usr/X11R6/include

  #######################################

--- 45,51 ----
  # CPPFLAGS += -I/usr/X11R6/include -DGLUI_FREEGLUT

  # (3) GLUT
! 

  #######################################

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.