diff --git a/src/libconfigFile/configFile.cpp b/src/libconfigFile/configFile.cpp index 7bfe41f776ab20d9b6bb86effaf1b6a6c7dd5123..4200400e0929c0597064bd0d896c5c4965491b50 100644 --- a/src/libconfigFile/configFile.cpp +++ b/src/libconfigFile/configFile.cpp @@ -128,7 +128,7 @@ ConfigFile::~ConfigFile() } // finds a particular option name among all specified options -int ConfigFile::seekOption(char * optionName) +int ConfigFile::seekOption(const char * optionName) { int slen = (int)(strlen(optionName)); char * upperOptionName = (char*) malloc (sizeof(char) * (slen + 1)); @@ -176,14 +176,14 @@ void ConfigFile::printOptions() default: printf("Error: invalid type requested (1)\n"); } - + } } // a generic routine to add a new option entry to the list of all options template<class T> -int ConfigFile::addOptionHelper(char * optionName, T * destLocation) +int ConfigFile::addOptionHelper(const char * optionName, T * destLocation) { if (seekOption(optionName) != -1) { @@ -207,7 +207,7 @@ int ConfigFile::addOptionHelper(char * optionName, T * destLocation) return 0; } -int ConfigFile::addOption(char * optionName, int * destLocation) +int ConfigFile::addOption(const char * optionName, int * destLocation) { int code; if ((code = addOptionHelper(optionName, destLocation)) != 0) @@ -218,7 +218,7 @@ int ConfigFile::addOption(char * optionName, int * destLocation) return 0; } -int ConfigFile::addOption(char * optionName, bool * destLocation) +int ConfigFile::addOption(const char * optionName, bool * destLocation) { int code; if ((code = addOptionHelper(optionName,destLocation)) != 0) @@ -229,7 +229,7 @@ int ConfigFile::addOption(char * optionName, bool * destLocation) return 0; } -int ConfigFile::addOption(char * optionName, double * destLocation) +int ConfigFile::addOption(const char * optionName, double * destLocation) { int code; if ((code = addOptionHelper(optionName,destLocation)) != 0) @@ -240,7 +240,7 @@ int ConfigFile::addOption(char * optionName, double * destLocation) return 0; } -int ConfigFile::addOption(char * optionName, float * destLocation) +int ConfigFile::addOption(const char * optionName, float * destLocation) { int code; if ((code = addOptionHelper(optionName,destLocation)) != 0) @@ -251,7 +251,7 @@ int ConfigFile::addOption(char * optionName, float * destLocation) return 0; } -int ConfigFile::addOption(char * optionName, char * destLocation) +int ConfigFile::addOption(const char * optionName, char * destLocation) { int code; if ((code = addOptionHelper(optionName,destLocation)) != 0) @@ -263,7 +263,7 @@ int ConfigFile::addOption(char * optionName, char * destLocation) } template<class T> -int ConfigFile::addOptionOptional(char * optionName, T * destLocation, T defaultValue) +int ConfigFile::addOptionOptional(const char * optionName, T * destLocation, T defaultValue) { int code = addOption(optionName,destLocation); *destLocation = defaultValue; @@ -271,7 +271,7 @@ int ConfigFile::addOptionOptional(char * optionName, T * destLocation, T default return code; } -int ConfigFile::addOptionOptional(char * optionName, char * destLocation, char * defaultValue) +int ConfigFile::addOptionOptional(const char * optionName, char * destLocation, const char * defaultValue) { int code = addOption(optionName,destLocation); // must use memmove because strings may overlap @@ -280,7 +280,7 @@ int ConfigFile::addOptionOptional(char * optionName, char * destLocation, char * return code; } -int ConfigFile::parseOptions(char * filename) +int ConfigFile::parseOptions(const char * filename) { FILE * fin = fopen(filename,"r"); if (!fin) @@ -306,7 +306,7 @@ int ConfigFile::parseOptions(char * filename) { printf("Error: invalid line %d: %s\n",count,line); fclose(fin); - return 1; + return 1; } int index = seekOption(&line[1]); @@ -414,7 +414,7 @@ int ConfigFile::parseOptions(char * filename) return 0; } -template int ConfigFile::addOptionOptional<bool>(char * optionName, bool * destLocation, bool defaultValue); -template int ConfigFile::addOptionOptional<int>(char * optionName, int * destLocation, int defaultValue); -template int ConfigFile::addOptionOptional<float>(char * optionName, float * destLocation, float defaultValue); -template int ConfigFile::addOptionOptional<double>(char * optionName, double * destLocation, double defaultValue); +template int ConfigFile::addOptionOptional<bool>(const char * optionName, bool * destLocation, bool defaultValue); +template int ConfigFile::addOptionOptional<int>(const char * optionName, int * destLocation, int defaultValue); +template int ConfigFile::addOptionOptional<float>(const char * optionName, float * destLocation, float defaultValue); +template int ConfigFile::addOptionOptional<double>(const char * optionName, double * destLocation, double defaultValue); diff --git a/src/libconfigFile/configFile.h b/src/libconfigFile/configFile.h index 0d8be23c4e5f110d4d8a511960bd5084cb2e517a..4599ebae4c81a890b4b2183da19b629d920cdf4d 100644 --- a/src/libconfigFile/configFile.h +++ b/src/libconfigFile/configFile.h @@ -32,8 +32,8 @@ CMU, 2005-2007 Version 1.0 - A class to parse text configuration files. - See configFile-example.cpp and configFile-example.config for examples. + A class to parse text configuration files. + See configFile-example.cpp and configFile-example.config for examples. It is by far easier to look at the example first, than to proceed straight to reading the class interface. @@ -52,7 +52,7 @@ *temperature 36.6 - Blank lines are ignored. + Blank lines are ignored. A line is a comment if it begins with a "#". The options can appear in arbirary order. They need not follow the order in which they were created via addOption/addOptionOptional . @@ -65,7 +65,7 @@ class ConfigFile { public: - + ConfigFile(); ~ConfigFile(); @@ -76,21 +76,21 @@ public: // routines to specify mandatory option entries // if "parseOptions" does not find a mandatory option in a particular configuration file, it will exit with a non-zero code - int addOption(char * optionName, int * destLocation); - int addOption(char * optionName, bool * destLocation); - int addOption(char * optionName, float * destLocation); - int addOption(char * optionName, double * destLocation); - int addOption(char * optionName, char * destLocation); // for strings, you must pass a pointer to a pre-allocated string buffer (and not a pointer to a (char*) pointer) + int addOption(const char * optionName, int * destLocation); + int addOption(const char * optionName, bool * destLocation); + int addOption(const char * optionName, float * destLocation); + int addOption(const char * optionName, double * destLocation); + int addOption(const char * optionName, char * destLocation); // for strings, you must pass a pointer to a pre-allocated string buffer (and not a pointer to a (char*) pointer) // routines to specify option entries that are optional // if not specified in a particular config file, the value will default to the given default value template<class T> - int addOptionOptional(char * optionName, T * destLocation, T defaultValue); - int addOptionOptional(char * optionName, char * destLocation, char * defaultValue); + int addOptionOptional(const char * optionName, T * destLocation, T defaultValue); + int addOptionOptional(const char * optionName, char * destLocation, const char * defaultValue); // === after you have specified your option entries with addOption and/or addOptionOptional, call "parseOptions" to open a particular configuration file and load the option values to their destination locations. - int parseOptions(char * filename); // returns 0 on success, and a non-zero value on failure + int parseOptions(const char * filename); // returns 0 on success, and a non-zero value on failure // after calling "parseOptions", you can print out the values of all options, to see the values that were read from the configuration file void printOptions(); @@ -104,11 +104,11 @@ protected: std::vector<void*> destLocations; std::vector<bool> optionSet; - - int seekOption(char * optionName); // returns -1 if not found + + int seekOption(const char * optionName); // returns -1 if not found template<class T> - int addOptionHelper(char * optionName, T * destLocation); + int addOptionHelper(const char * optionName, T * destLocation); int getTypeSize(int type); void getTypeFormatSpecifier(int type, char * fsp); diff --git a/src/libvega-getopts/getopts.h b/src/libvega-getopts/getopts.h index 0888cfde1f13fc55a754a3ed0b3809d22514ad9e..5f702dab60ef23b116f54001ee7eab828f63d75c 100644 --- a/src/libvega-getopts/getopts.h +++ b/src/libvega-getopts/getopts.h @@ -1,6 +1,6 @@ /* getopts.h */ - -#if !defined(__GETOPTS__) +#ifndef GETOPTS_H +#define GETOPTS_H #define GETOPTS #define OPTINT 1 diff --git a/thirdparty/glui/2.36/src/glui_edittext.cpp b/thirdparty/glui/2.36/src/glui_edittext.cpp index 3f2865cc6b9abdeb93168a3c79ac026eee506804..feddd8e5e2ca6d45fc6c70fe84461a164227f032 100644 --- a/thirdparty/glui/2.36/src/glui_edittext.cpp +++ b/thirdparty/glui/2.36/src/glui_edittext.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - + GLUI User Interface Toolkit --------------------------- @@ -13,21 +13,21 @@ WWW: http://sourceforge.net/projects/glui/ Forums: http://sourceforge.net/forum/?group_id=92496 - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. *****************************************************************************/ @@ -86,7 +86,7 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name, /****************************** GLUI_EditText::GLUI_EditText() **********/ -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 ) { @@ -95,7 +95,7 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name, /****************************** GLUI_EditText::GLUI_EditText() **********/ -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 ) { @@ -104,19 +104,19 @@ GLUI_EditText::GLUI_EditText( GLUI_Node *parent, const char *name, /****************************** GLUI_EditText::common_construct() **********/ -void GLUI_EditText::common_construct( GLUI_Node *parent, const char *name, - int data_t, int live_t, void *data, int id, +void GLUI_EditText::common_construct( GLUI_Node *parent, const char *name, + int data_t, int live_t, void *data, int id, GLUI_CB cb ) { common_init(); set_name( name ); - + live_type = live_t; data_type = data_t; ptr_val = data; user_id = id; callback = cb; - + if ( live_type == GLUI_LIVE_INT) { if ( data == NULL ) @@ -141,7 +141,7 @@ int GLUI_EditText::mouse_down_handler( int local_x, int local_y ) if ( debug ) dump( stdout, "-> MOUSE DOWN" ); - tmp_insertion_pt = find_insertion_pt( local_x, local_y ); + tmp_insertion_pt = find_insertion_pt( local_x, local_y ); if ( tmp_insertion_pt == -1 ) { if ( glui ) glui->deactivate_current_control( ); @@ -176,23 +176,23 @@ int GLUI_EditText::mouse_held_down_handler( int local_x, int local_y, { int tmp_pt; - if ( NOT new_inside ) + if ( NOT new_inside ) return false; if ( debug ) dump( stdout, "-> HELD DOWN" ); - + tmp_pt = find_insertion_pt( local_x, local_y ); - + if ( tmp_pt == -1 AND sel_end != 0 ) { /* moved mouse past left edge */ special_handler( GLUT_KEY_LEFT, GLUT_ACTIVE_SHIFT ); } - else if ( tmp_pt == substring_end+1 AND sel_end != (int) text.length()) { + else if ( tmp_pt == substring_end+1 AND sel_end != (int) text.length()) { /* moved mouse past right edge */ - special_handler( GLUT_KEY_RIGHT, GLUT_ACTIVE_SHIFT ); + special_handler( GLUT_KEY_RIGHT, GLUT_ACTIVE_SHIFT ); } else if ( tmp_pt != -1 AND tmp_pt != sel_end ) { sel_end = insertion_pt = tmp_pt; - + update_and_draw_text(); } @@ -232,7 +232,7 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) return true; } else if ( (key == 127 AND !ctrl_down) OR /* FORWARD DELETE */ - ( key == CTRL('d') AND modifiers == GLUT_ACTIVE_CTRL) ) + ( key == CTRL('d') AND modifiers == GLUT_ACTIVE_CTRL) ) { if ( sel_start == sel_end ) { /* no selection */ if ( insertion_pt < (int)text.length() ) { @@ -280,7 +280,7 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) sel_start = sel_end = insertion_pt; } } - else if ( modifiers == GLUT_ACTIVE_CTRL ) /* CTRL ONLY */ + else if ( modifiers == GLUT_ACTIVE_CTRL ) /* CTRL ONLY */ { /* Ctrl-key bindings */ if ( key == CTRL('a') ) { @@ -302,7 +302,7 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) return special_handler( GLUT_KEY_DOWN, 0 ); } else if ( key == CTRL('u') ) { /* ERASE LINE */ - insertion_pt = 0; + insertion_pt = 0; text.erase(0,text.length()); sel_start = sel_end = 0; } @@ -321,12 +321,12 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) } } else if ( (modifiers & GLUT_ACTIVE_CTRL) OR - (modifiers & GLUT_ACTIVE_ALT) ) + (modifiers & GLUT_ACTIVE_ALT) ) { /** ignore other keys with modifiers */ return true; } - else { /* Regular key */ + else { /* Regular key */ regular_key = true; /** Check if we only accept numbers **/ @@ -356,7 +356,7 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) a period. Check whether the period is contained within is current selection (thus it will be safely replaced) **/ - int period_found = false; + 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] ); */ @@ -373,8 +373,8 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) return true; } } - } - else if (data_type == GLUI_EDITTEXT_INT) + } + else if (data_type == GLUI_EDITTEXT_INT) { if ( (key < '0' OR key > '9') AND key != '-' ) return true; @@ -394,7 +394,7 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) } } - /** This is just to get rid of warnings - the flag regular_key is + /** This is just to get rid of warnings - the flag regular_key is set if the key was not a backspace, return, whatever. But I believe if we're here, we know it was a regular key anyway */ if ( regular_key ) { @@ -419,10 +419,10 @@ int GLUI_EditText::key_handler( unsigned char key,int modifiers ) } /******** Now redraw text ***********/ - /* Hack to prevent text box from being cleared first **/ + /* Hack to prevent text box from being cleared first **/ /** int substring_change = update_substring_bounds(); - draw_text_only = - (NOT substring_change AND NOT has_selection AND regular_key ); + draw_text_only = + (NOT substring_change AND NOT has_selection AND regular_key ); */ draw_text_only = false; /** Well, hack is not yet working **/ @@ -481,7 +481,7 @@ void GLUI_EditText::deactivate( void ) if ( debug ) dump( stdout, "-> DISACTIVATE" ); - sel_start = sel_end = insertion_pt = -1; + sel_start = sel_end = insertion_pt = -1; /***** Retrieve the current value from the text *****/ /***** The live variable will be updated by set_text() ****/ @@ -501,7 +501,7 @@ void GLUI_EditText::deactivate( void ) set_int_val( new_int_val ); } - else + else if ( data_type == GLUI_EDITTEXT_TEXT ) { set_text(text); /* This will force callbacks and gfx refresh */ } @@ -514,17 +514,17 @@ void GLUI_EditText::deactivate( void ) /***** Now do callbacks if value changed ******/ if ( orig_text != text ) { this->execute_callback(); - + if ( 0 ) { /* THE CODE BELOW IS FROM WHEN SPINNER ALSO MAINTAINED CALLBACKS */ - if ( spinner == NULL ) { /** Are we independent of a spinner? **/ + if ( spinner == NULL ) { /** Are we independent of a spinner? **/ if ( callback ) { - callback( this ); - } - } - else { /* We're attached to a spinner */ - spinner->do_callbacks(); /* Let the spinner do the callback stuff */ - } + callback( this ); + } + } + else { /* We're attached to a spinner */ + spinner->do_callbacks(); /* Let the spinner do the callback stuff */ + } } } @@ -545,7 +545,7 @@ void GLUI_EditText::draw( int x, int y ) glBegin( GL_LINES ); glColor3f( .5, .5, .5 ); glVertex2i( text_x_offset, 0 ); glVertex2i( w, 0 ); - glVertex2i( text_x_offset, 0 ); glVertex2i( text_x_offset, h ); + glVertex2i( text_x_offset, 0 ); glVertex2i( text_x_offset, h ); glColor3f( 1., 1., 1. ); glVertex2i( text_x_offset, h ); glVertex2i( w, h ); @@ -566,7 +566,7 @@ void GLUI_EditText::draw( int x, int y ) /** Find where to draw the text **/ update_substring_bounds(); draw_text(0,0); - + draw_insertion_pt(); } @@ -584,8 +584,8 @@ int GLUI_EditText::update_substring_bounds( void ) 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 */ + 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) ); @@ -593,7 +593,7 @@ int GLUI_EditText::update_substring_bounds( void ) if ( debug ) dump( stdout, "-> UPDATE SS" ); - if ( insertion_pt >= 0 AND + if ( insertion_pt >= 0 AND insertion_pt < substring_start ) { /* cursor moved left */ substring_start = insertion_pt; @@ -613,7 +613,7 @@ int GLUI_EditText::update_substring_bounds( void ) while ( substring_width( substring_start, substring_end ) > box_width ) substring_end--; - while(substring_end < text_len-1 + while(substring_end < text_len-1 AND substring_width( substring_start, substring_end ) <= box_width) substring_end++; } @@ -633,7 +633,7 @@ int GLUI_EditText::update_substring_bounds( void ) if ( substring_start == old_start AND substring_end == old_end ) return false; /*** bounds did not change ***/ - else + else return true; /*** bounds did change ***/ } @@ -643,7 +643,7 @@ int GLUI_EditText::update_substring_bounds( void ) void GLUI_EditText::update_x_offsets( void ) { } - + /********************************* GLUI_EditText::draw_text() ****************/ @@ -702,14 +702,14 @@ void GLUI_EditText::draw_text( int x, int y ) glVertex2i( sel_x_end, h-2 ); glVertex2i( sel_x_start, h-2 ); glEnd(); } - + if ( sel_start == sel_end ) { /* No current selection */ if ( enabled ) glColor3b( 0, 0, 0 ); else glColor3b( 32, 32, 32 ); - + glRasterPos2i( text_x, 13); for( i=substring_start; i<=substring_end; i++ ) { glutBitmapCharacter( get_font(), this->text[i] ); @@ -728,12 +728,12 @@ void GLUI_EditText::draw_text( int x, int y ) glRasterPos2i( x, 13); glutBitmapCharacter( get_font(), this->text[i] ); } - + x += char_width( text[i] ); } } - if ( debug ) dump( stdout, "<- DRAW_TEXT" ); + if ( debug ) dump( stdout, "<- DRAW_TEXT" ); } @@ -752,14 +752,14 @@ int GLUI_EditText::find_insertion_pt( int x, int y ) /* We move from right to left, looking to see if the mouse was clicked to the right of the ith character */ - curr_x = this->x_abs + text_x_offset + 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 **/ /*** See if we clicked in an empty box ***/ - if ( (int) text.length() == 0 ) + if ( (int) text.length() == 0 ) return 0; /** find mouse click in text **/ @@ -768,7 +768,7 @@ int GLUI_EditText::find_insertion_pt( int x, int y ) if ( x > curr_x ) { /* printf( "-> %d\n", i ); */ - + return i+1; } } @@ -780,7 +780,7 @@ int GLUI_EditText::find_insertion_pt( int x, int y ) if ( 0 ) { if ( x > (x_abs + text_x_offset + 2 ) ) return substring_start; - + return -1; /* Nothing found */ } } @@ -807,15 +807,15 @@ void GLUI_EditText::draw_insertion_pt( void ) /* printf( "insertion pt: %d\n", insertion_pt ); */ - curr_x = this->x_abs + text_x_offset + 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 **/ for( i=substring_end; i>=insertion_pt; i-- ) { - curr_x -= char_width( text[i] ); - } + curr_x -= char_width( text[i] ); + } glColor3f( 0.0, 0.0, 0.0 ); glBegin( GL_LINE_LOOP ); @@ -846,11 +846,11 @@ int GLUI_EditText::substring_width( int start, int end ) width = 0; for( i=start; i<=end; i++ ) - width += char_width( text[i] ); + width += char_width( text[i] ); return width; } - + /***************************** GLUI_EditText::update_and_draw_text() ********/ @@ -872,11 +872,11 @@ 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", + printf( "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 ) { @@ -904,17 +904,17 @@ int GLUI_EditText::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, (int) text.length()); /* Make sure insertion_pt + + CLAMP( insertion_pt, 0, (int) text.length()); /* Make sure insertion_pt is in bounds */ - CLAMP( sel_start, 0, (int) text.length()); /* Make sure insertion_pt + CLAMP( sel_start, 0, (int) text.length()); /* Make sure insertion_pt is in bounds */ - CLAMP( sel_end, 0, (int) text.length()); /* Make sure insertion_pt + CLAMP( sel_end, 0, (int) text.length()); /* Make sure insertion_pt is in bounds */ - + /******** Now redraw text ***********/ if ( can_draw()) update_and_draw_text(); @@ -933,12 +933,12 @@ int GLUI_EditText::special_handler( int key,int modifiers ) int GLUI_EditText::find_word_break( int start, int direction ) { int i, j; - char *breaks = " :-.,"; + const char *breaks = " :-.,"; int num_break_chars = (int)strlen(breaks), text_len = (int)text.length(); int new_pt; /** If we're moving left, we have to start two back, in case we're either - already at the beginning of a word, or on a separating token. + already at the beginning of a word, or on a separating token. Otherwise, this function would just return the word we're already at **/ if ( direction == -1 ) { start -= 2; @@ -1010,7 +1010,7 @@ void GLUI_EditText::update_size( void ) text_x_offset += delta; /* w += delta; */ - if ( data_type == GLUI_EDITTEXT_TEXT OR + if ( data_type == GLUI_EDITTEXT_TEXT OR data_type == GLUI_EDITTEXT_FLOAT) { if ( w < text_x_offset + GLUI_EDITTEXT_MIN_TEXT_WIDTH ) w = text_x_offset + GLUI_EDITTEXT_MIN_TEXT_WIDTH; @@ -1055,7 +1055,7 @@ void GLUI_EditText::set_float_val( float new_val ) /*** Clamp the new value to the existing limits ***/ CLAMP( new_val, float_low, float_high ); - } + } else if ( has_limits == GLUI_LIMIT_WRAP ) { /*** Clamp the value cyclically to the limits - that is, if the value exceeds the max, set it the the minimum, and conversely ***/ @@ -1068,7 +1068,7 @@ void GLUI_EditText::set_float_val( float new_val ) float_val = new_val; int_val = (int) new_val; /* Mirror the value as an int, too */ - + set_numeric_text(); } @@ -1106,7 +1106,7 @@ void GLUI_EditText::set_float_limits( float low, float high, int limit_type ) has_limits = limit_type; float_low = low; float_high = high; - + if ( NOT IN_BOUNDS( float_val, float_low, float_high )) set_float_val( float_low ); @@ -1153,7 +1153,7 @@ void GLUI_EditText::set_numeric_text( void ) for ( i=text_len-1; i>0; i-- ) { if ( buf_num[i] == '0' AND buf_num[i-1] != '.' ) buf_num[i] = '\0'; - else + else break; } } @@ -1163,7 +1163,7 @@ void GLUI_EditText::set_numeric_text( void ) sprintf( buf_num, "%d", int_val ); set_text( buf_num ); } - + } @@ -1171,9 +1171,9 @@ void GLUI_EditText::set_numeric_text( void ) void GLUI_EditText::dump( FILE *out, const char *name ) { - fprintf( out, + fprintf( out, "%s (edittext@%p): ins_pt:%d subs:%d/%d sel:%d/%d len:%d\n", - name, this, + name, this, insertion_pt, substring_start, substring_end, diff --git a/thirdparty/glui/2.36/src/include/GL/glui.h b/thirdparty/glui/2.36/src/include/GL/glui.h index 0424e720a90f5a698d31d9ae4d4409f2df0436ea..9b879d7f90edc4f2edd094f91509e77f9a7cb1bf 100644 --- a/thirdparty/glui/2.36/src/include/GL/glui.h +++ b/thirdparty/glui/2.36/src/include/GL/glui.h @@ -3,7 +3,7 @@ GLUI User Interface Toolkit --------------------------- - glui.h - Main (and only) external header for + glui.h - Main (and only) external header for GLUI User Interface Toolkit -------------------------------------------------- @@ -13,21 +13,21 @@ WWW: http://sourceforge.net/projects/glui/ Forums: http://sourceforge.net/forum/?group_id=92496 - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. *****************************************************************************/ @@ -45,17 +45,17 @@ // FreeGLUT does not yet work perfectly with GLUI // - use at your own risk. - + #include <GL/freeglut.h> #elif defined(GLUI_OPENGLUT) // OpenGLUT does not yet work properly with GLUI // - use at your own risk. - + #include <GL/openglut.h> -#else +#else #ifdef __APPLE__ #include <GLUT/glut.h> @@ -98,7 +98,7 @@ # if defined GLUIDLL // define this when using glui dynamic library # pragma comment(lib, "glui32dll.lib") # else -# pragma comment(lib, "glui32.lib") +# pragma comment(lib, "glui32.lib") # endif # endif #endif @@ -106,17 +106,17 @@ /********** List of GLUT callbacks ********/ -enum GLUI_Glut_CB_Types -{ +enum GLUI_Glut_CB_Types +{ GLUI_GLUT_RESHAPE, GLUI_GLUT_KEYBOARD, GLUI_GLUT_DISPLAY, GLUI_GLUT_MOUSE, GLUI_GLUT_MOTION, GLUI_GLUT_SPECIAL, - GLUI_GLUT_PASSIVE_MOTION, + GLUI_GLUT_PASSIVE_MOTION, GLUI_GLUT_ENTRY, - GLUI_GLUT_VISIBILITY + GLUI_GLUT_VISIBILITY }; /********* Constants for window placement **********/ @@ -130,7 +130,7 @@ enum GLUI_Glut_CB_Types #define GLUI_STATICTEXT_SIZE 13 #define GLUI_SEPARATOR_HEIGHT 8 #define GLUI_DEFAULT_CONTROL_WIDTH 100 -#define GLUI_DEFAULT_CONTROL_HEIGHT 13 +#define GLUI_DEFAULT_CONTROL_HEIGHT 13 #define GLUI_EDITTEXT_BOXINNERMARGINX 3 #define GLUI_EDITTEXT_HEIGHT 20 #define GLUI_EDITTEXT_WIDTH 130 @@ -213,7 +213,7 @@ enum GLUI_Glut_CB_Types #define GLUI_TREEPANEL_DISPLAY_HIERARCHY 32 // display some sort of hierachy in the tree node title #define GLUI_TREEPANEL_HIERARCHY_NUMERICDOT 64 // display hierarchy in 1.3.2 (etc... ) format #define GLUI_TREEPANEL_HIERARCHY_LEVEL_ONLY 128 // display hierarchy as only the level depth - + /******************* GLUI Scrollbar Defaults - JVK ***************************/ #define GLUI_SCROLL_ARROW_WIDTH 16 #define GLUI_SCROLL_ARROW_HEIGHT 16 @@ -229,7 +229,7 @@ enum GLUI_Glut_CB_Types #define GLUI_SCROLL_HORIZONTAL 1 -/** Size of the character width hash table for faster lookups. +/** Size of the character width hash table for faster lookups. Make sure to keep this a power of two to avoid the slow divide. This is also a speed/memory tradeoff; 128 is enough for low ASCII. */ @@ -237,7 +237,7 @@ enum GLUI_Glut_CB_Types /********** Translation codes **********/ -enum TranslationCodes +enum TranslationCodes { GLUI_TRANSLATION_MOUSE_NONE = 0, GLUI_TRANSLATION_MOUSE_UP, @@ -301,7 +301,7 @@ typedef void (*Int4_CB) (int, int, int, int); /************************************************************/ /** - Callback Adapter Class + Callback Adapter Class Allows us to support different types of callbacks; like a GLUI_Update_CB function pointer--which takes an int; and a GLUI_Control_CB function pointer--which takes a GUI_Control object. @@ -335,11 +335,11 @@ class GLUI_Control; GLUI_Node is a node in a sort of tree of GLUI controls. Each GLUI_Node has a list of siblings (in a circular list) and a linked list of children. - + 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; @@ -385,7 +385,7 @@ protected: /* */ /************************************************************/ -enum GLUI_StdBitmaps_Codes +enum GLUI_StdBitmaps_Codes { GLUI_STDBITMAP_CHECKBOX_OFF = 0, GLUI_STDBITMAP_CHECKBOX_ON, @@ -422,7 +422,7 @@ enum GLUI_StdBitmaps_Codes to represent small textures like checkboxes, arrows, etc. via the GLUI_StdBitmaps class. */ -class GLUIAPI GLUI_Bitmap +class GLUIAPI GLUI_Bitmap { friend class GLUI_StdBitmaps; @@ -432,7 +432,7 @@ public: /** Create bitmap from greyscale byte image */ void init_grey(unsigned char *array); - + /** Create bitmap from color int image */ void init(int *array); @@ -450,13 +450,13 @@ private: /************************************************************/ /** - Keeps an array of GLUI_Bitmap objects to represent all the + Keeps an array of GLUI_Bitmap objects to represent all the images used in the UI: checkboxes, arrows, etc. */ class GLUIAPI GLUI_StdBitmaps { public: - GLUI_StdBitmaps(); + GLUI_StdBitmaps(); ~GLUI_StdBitmaps(); /** Return the width (in pixels) of the n'th standard bitmap. */ @@ -465,7 +465,7 @@ public: int height(int n) const; /** Draw the n'th standard bitmap (one of the enums - listed in GLUI_StdBitmaps_Codes) at pixel corner (x,y). + listed in GLUI_StdBitmaps_Codes) at pixel corner (x,y). */ void draw(int n, int x, int y) const; @@ -483,11 +483,11 @@ private: The master manages our interaction with GLUT. There's only one GLUI_Master_Object. */ -class GLUIAPI GLUI_Master_Object +class GLUIAPI GLUI_Master_Object { friend void glui_idle_func(); - + public: GLUI_Master_Object(); @@ -538,10 +538,10 @@ public: void set_glutMenuStatusFunc(Int3_CB f) {glutMenuStatusFunc(f);} void set_glutMenuStateFunc(Int1_CB f) {glutMenuStateFunc(f);} void set_glutButtonBoxFunc(Int2_CB f) {glutButtonBoxFunc(f);} - void set_glutDialsFunc(Int2_CB f) {glutDialsFunc(f);} - + void set_glutDialsFunc(Int2_CB f) {glutDialsFunc(f);} + - GLUI *create_glui( const char *name, long flags=0, int x=-1, int y=-1 ); + GLUI *create_glui( const char *name, long flags=0, int x=-1, int y=-1 ); GLUI *create_glui_subwindow( int parent_window, long flags=0 ); GLUI *find_glui_by_window_id( int window_id ); void get_viewport_area( int *x, int *y, int *w, int *h ); @@ -577,11 +577,11 @@ extern GLUIAPI GLUI_Master_Object GLUI_Master; A top-level window. The GLUI_Master GLUT callback can route events to the callbacks in this class, for arbitrary use by external users. (see GLUI_Master_Object::set_glutKeyboardFunc). - + This entire approach seems to be superceded by the "subwindow" flavor of GLUI. */ -class GLUIAPI GLUI_Glut_Window : public GLUI_Node +class GLUIAPI GLUI_Glut_Window : public GLUI_Node { public: GLUI_Glut_Window(); @@ -607,10 +607,10 @@ public: /************************************************************/ /** - A GLUI_Main handles GLUT events for one window, routing them to the - appropriate controls. The central user-visible "GLUI" class + A GLUI_Main handles GLUT events for one window, routing them to the + appropriate controls. The central user-visible "GLUI" class inherits from this class; users should not allocate GLUT_Main objects. - + There's a separate GLUI_Main object for: - Each top-level window with GUI stuff in it. - Each "subwindow" of another top-level window. @@ -619,7 +619,7 @@ public: A better name for this class might be "GLUI_Environment"; this class provides the window-level context for every control. */ -class GLUIAPI GLUI_Main : public GLUI_Node +class GLUIAPI GLUI_Main : public GLUI_Node { /********** Friend classes *************/ @@ -663,7 +663,7 @@ protected: buffer_mode_t buffer_mode; ///< Current drawing mode int curr_cursor; int w, h; - long flags; + long flags; bool closing; int parent_window; int glui_id; @@ -719,34 +719,34 @@ public: void activate_control( GLUI_Control *control, int how ); void align_controls( GLUI_Control *control ); void deactivate_current_control( void ); - + /** Draw a 3D-look pushed-out box around this rectangle */ void draw_raised_box( int x, int y, int w, int h ); /** Draw a 3D-look pushed-in box around this rectangle */ void draw_lowered_box( int x, int y, int w, int h ); - + /** Return true if this control should redraw itself immediately (front buffer); Or queue up a redraw and return false if it shouldn't (back buffer). */ bool should_redraw_now(GLUI_Control *ctl); - - /** Switch to the appropriate draw buffer now. Returns the old draw buffer. + + /** Switch to the appropriate draw buffer now. Returns the old draw buffer. This routine should probably only be called from inside the GLUI_DrawingSentinal, in glui_internal_control.h */ int set_current_draw_buffer(); /** Go back to using this draw buffer. Undoes set_current_draw_buffer. */ void restore_draw_buffer( int buffer_state ); - + /** Pack, resize the window, and redraw all the controls. */ void refresh(); - + /** Redraw the main graphics window */ void post_update_main_gfx(); - + /** Recompute the sizes and positions of all controls */ void pack_controls(); - + void close_internal(); void check_subwindow_position(); void set_ortho_projection(); @@ -765,13 +765,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 + + 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: @@ -780,9 +780,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 */ @@ -791,7 +791,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. @@ -802,18 +802,18 @@ public: float float_array_val[GLUI_DEF_MAX_ARRAY]; int float_array_size; GLUI_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; 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; @@ -849,7 +849,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; } @@ -862,42 +862,42 @@ public: int can_draw( void ) { return (glui != NULL && hidden == false); } /** Redraw this control. - In single-buffering mode (drawing to GL_FRONT), this is just + In single-buffering mode (drawing to GL_FRONT), this is just a call to translate_and_draw_front (after a can_draw() check). - In double-buffering mode (drawing to GL_BACK), this queues up + In double-buffering mode (drawing to GL_BACK), this queues up a redraw and returns false, since you shouldn't draw yet. */ void redraw(void); - + /** Redraw everybody in our window. */ void redraw_window(void); 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 GLUI_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 GLUI_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 ); @@ -911,13 +911,13 @@ 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(void) { x_off = GLUI_XOFF; y_off_top = GLUI_YOFF; @@ -944,7 +944,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; @@ -964,7 +964,7 @@ public: /* */ /************************************************************/ /** - An onscreen, clickable button--an outlined label that + An onscreen, clickable button--an outlined label that can be clicked. When clicked, a button calls its GLUI_CB callback with its ID. */ @@ -986,13 +986,13 @@ public: /** Create a new button. - + @param parent The panel our object is inside; or the main GLUI object. @param name The text inside the button. @param id Optional ID number, to pass to the optional callback function. @param callback Optional callback function, taking either the int ID or control. */ - GLUI_Button( GLUI_Node *parent, const char *name, + GLUI_Button( GLUI_Node *parent, const char *name, int id=-1, GLUI_CB cb=GLUI_CB() ); GLUI_Button( void ) { common_init(); }; @@ -1039,10 +1039,10 @@ public: /** Create a new checkbox object. - + @param parent The panel our object is inside; or the main GLUI object. @param name Label next to our checkbox. - @param value_ptr Optional integer value to attach to this checkbox. When the + @param value_ptr Optional integer value to attach to this checkbox. When the checkbox is checked or unchecked, *value_ptr will also be changed. ("Live Vars"). @param id Optional ID number, to pass to the optional callback function. @param callback Optional callback function, taking either the int ID or control. @@ -1081,7 +1081,7 @@ public: /** Create a new column, which separates the previous controls from subsequent controls. - + @param parent The panel our object is inside; or the main GLUI object. @param draw_bar If true, draw a visible bar between new and old controls. */ @@ -1113,14 +1113,14 @@ public: /** Create a new panel. A panel groups together a set of related controls. - + @param parent The outer panel our panel is inside; or the main GLUI object. @param name The string name at the top of our panel. @param type Optional style to display the panel with--GLUI_PANEL_EMBOSSED by default. GLUI_PANEL_RAISED causes the panel to appear higher than the surroundings. GLUI_PANEL_NONE causes the panel's outline to be invisible. */ - GLUI_Panel( GLUI_Node *parent, const char *name, + GLUI_Panel( GLUI_Node *parent, const char *name, int type=GLUI_PANEL_EMBOSSED ); GLUI_Panel() { common_init(); } @@ -1136,7 +1136,7 @@ protected: h = GLUI_DEFAULT_CONTROL_HEIGHT + 7; int_val = GLUI_PANEL_EMBOSSED; alignment = GLUI_ALIGN_CENTER; - is_container = true; + is_container = true; can_activate = false; name=""; }; @@ -1156,7 +1156,7 @@ class GLUIAPI GLUI_FileBrowser : public GLUI_Panel public: /** Create a new list of files the user can select from. - + @param parent The panel our object is inside; or the main GLUI object. @param name Prompt to give to the user at the top of the file browser. @param frame_type Optional style to display the panel with--GLUI_PANEL_EMBOSSED by default. @@ -1165,7 +1165,7 @@ public: @param id Optional ID number, to pass to the optional callback function. @param callback Optional callback function, taking either the int ID or control. */ - GLUI_FileBrowser( GLUI_Node *parent, + GLUI_FileBrowser( GLUI_Node *parent, const char *name, int frame_type = GLUI_PANEL_EMBOSSED, int user_id = -1, @@ -1183,13 +1183,13 @@ public: void set_allow_change_dir(int c) { allow_change_dir = c; } protected: - void common_init() + void common_init() { w = GLUI_DEFAULT_CONTROL_WIDTH; h = GLUI_DEFAULT_CONTROL_HEIGHT; int_val = GLUI_PANEL_EMBOSSED; alignment = GLUI_ALIGN_CENTER; - is_container = true; + is_container = true; can_activate = false; allow_change_dir = true; last_item = -1; @@ -1222,7 +1222,7 @@ public: /** Create a new rollout. A rollout contains a set of controls, like a panel, but can be collapsed to just the name. - + @param parent The panel our object is inside; or the main GLUI object. @param name String to show at the top of the rollout. @param open Optional boolean. If true (the default), the rollout's controls are displayed. @@ -1231,11 +1231,11 @@ public: GLUI_PANEL_RAISED causes the panel to appear higher than the surroundings. GLUI_PANEL_NONE causes the panel's outline to be invisible. */ - GLUI_Rollout( GLUI_Node *parent, const char *name, int open=true, + GLUI_Rollout( GLUI_Node *parent, const char *name, int open=true, int type=GLUI_PANEL_EMBOSSED ); GLUI_Rollout( void ) { common_init(); } - - + + bool currently_inside, initially_inside; GLUI_Button button; @@ -1244,8 +1244,8 @@ public: int mouse_down_handler( int local_x, int local_y ); int mouse_up_handler( int local_x, int local_y, bool inside ); int mouse_held_down_handler( int local_x, int local_y, bool inside ); - - void open( void ); + + void open( void ); void close( void ); void update_size( void ); @@ -1276,7 +1276,7 @@ protected: class GLUIAPI GLUI_Tree : public GLUI_Panel { public: - GLUI_Tree(GLUI_Node *parent, const char *name, + GLUI_Tree(GLUI_Node *parent, const char *name, int open=false, int inset=0); private: @@ -1298,7 +1298,7 @@ public: bool currently_inside, initially_inside; GLUI_Button button; GLUI_String level_name; // level name, eg: 1.1.2, III, or 3 - GLUI_TreePanel *panel; + GLUI_TreePanel *panel; void draw( int x, int y ); void draw_pressed( void ); @@ -1306,7 +1306,7 @@ public: int mouse_up_handler( int local_x, int local_y, bool inside ); int mouse_held_down_handler( int local_x, int local_y, bool inside ); void set_column(GLUI_Column *c) { column = c; } - void open( void ); + void open( void ); void close( void ); /* void set_name( const char *text ) { panel.set_name( text ); }; */ @@ -1319,14 +1319,14 @@ public: int get_level() { return level; } int get_child_number() { return child_number; } void enable_bar() { if (column) { column->int_val = 1; set_color(red, green, blue); } } - void disable_bar() { if (column) { column->int_val = 0; } } - void set_child_number(int c) { child_number = c; } - void set_level_color(float r, float g, float b) { + void disable_bar() { if (column) { column->int_val = 0; } } + void set_child_number(int c) { child_number = c; } + void set_level_color(float r, float g, float b) { lred = r; lgreen = g; lblue = b; } - void set_color(float r, float g, float b) { + void set_color(float r, float g, float b) { red = r; green = g; blue = b; @@ -1356,7 +1356,7 @@ protected: name = ""; level_name = ""; level = 0; - + }; }; @@ -1370,10 +1370,10 @@ protected: /** Manages, maintains, and formats a tree of GLUI_Tree objects. These are shown in a heirarchical, collapsible display. - + FIXME: There's an infinite loop in the traversal code (OSL 2006/06) */ -class GLUIAPI GLUI_TreePanel : public GLUI_Panel +class GLUIAPI GLUI_TreePanel : public GLUI_Panel { public: GLUI_TreePanel(GLUI_Node *parent, const char *name, @@ -1390,14 +1390,14 @@ public: float lblue; int root_children; /* These variables allow the tree panel to traverse the tree - using only two function calls. (Well, four, if you count + using only two function calls. (Well, four, if you count going in reverse */ GLUI_Tree *curr_branch; /* Current Branch */ GLUI_Panel *curr_root; /* Current Root */ public: - void set_color(float r, float g, float b); + void set_color(float r, float g, float b); void set_level_color(float r, float g, float b); void set_format(int f) { format = f; } @@ -1421,7 +1421,7 @@ public: protected: int uniqueID( void ) { next_id++; return next_id - 1; } - void common_init() + void common_init() { GLUI_Panel(); next_id = 0; @@ -1445,9 +1445,9 @@ class GLUI_Translation; /** The main user-visible interface object to GLUI. - + */ -class GLUIAPI GLUI : public GLUI_Main +class GLUIAPI GLUI : public GLUI_Main { public: /** DEPRECATED interface for creating new GLUI objects */ @@ -1459,11 +1459,11 @@ public: void add_separator( void ); void add_separator_to_panel( GLUI_Panel *panel ); - GLUI_RadioGroup + GLUI_RadioGroup *add_radiogroup( int *live_var=NULL, int user_id=-1,GLUI_CB callback=GLUI_CB()); - GLUI_RadioGroup + GLUI_RadioGroup *add_radiogroup_to_panel( GLUI_Panel *panel, int *live_var=NULL, int user_id=-1, GLUI_CB callback=GLUI_CB() ); @@ -1482,50 +1482,50 @@ public: GLUI_Rotation *add_rotation_to_panel( GLUI_Panel *panel, const char *name, float *live_var=NULL, int id=-1, GLUI_CB callback=GLUI_CB()); - + GLUI_Translation *add_translation( const char *name, int trans_type, float *live_var=NULL, int id=-1, GLUI_CB callback=GLUI_CB() ); - GLUI_Translation *add_translation_to_panel( - GLUI_Panel *panel, const char *name, + GLUI_Translation *add_translation_to_panel( + GLUI_Panel *panel, const char *name, 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, GLUI_String& live_var, int id=-1, GLUI_CB callback=GLUI_CB() ); - GLUI_EditText *add_edittext_to_panel( GLUI_Panel *panel, const char *name, + GLUI_EditText *add_edittext_to_panel( GLUI_Panel *panel, const char *name, GLUI_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, @@ -1533,13 +1533,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); @@ -1601,7 +1601,7 @@ public: int title_x_offset; int text_x_offset; int substring_start; /*substring that gets displayed in box*/ - int substring_end; + int substring_end; int sel_start, sel_end; /* current selection */ int num_periods; int last_insertion_pt; @@ -1660,11 +1660,11 @@ public: float *live_var, int id=-1, GLUI_CB callback=GLUI_CB() ); // Constructor, char* live variable - GLUI_EditText( GLUI_Node *parent, const char *name, + GLUI_EditText( GLUI_Node *parent, const char *name, char *live_var, int id=-1, GLUI_CB callback=GLUI_CB() ); // Constructor, std::string live variable - GLUI_EditText( GLUI_Node *parent, const char *name, + GLUI_EditText( GLUI_Node *parent, const char *name, std::string &live_var, int id=-1, GLUI_CB callback=GLUI_CB() ); @@ -1698,7 +1698,7 @@ protected: debug = false; draw_text_only = false; } - void common_construct( GLUI_Node *parent, const char *name, + void common_construct( GLUI_Node *parent, const char *name, int data_type, int live_type, void *live_var, int id, GLUI_CB callback ); }; @@ -1774,7 +1774,7 @@ public: void draw( int x, int y ); void set_name( const char *text ); - void set_int_val( int int_val ); + void set_int_val( int int_val ); void set_selected( int int_val ); void draw_group( int translate ); @@ -1877,21 +1877,21 @@ protected: /* Spinner class (container) */ /* */ /************************************************************/ - + class GLUIAPI GLUI_Spinner : public GLUI_Control { public: // Constructor, no live var - GLUI_Spinner( GLUI_Node* parent, const char *name, + GLUI_Spinner( GLUI_Node* parent, const char *name, int data_type=GLUI_SPINNER_INT, int id=-1, GLUI_CB callback=GLUI_CB() ); // Constructor, int live var - GLUI_Spinner( GLUI_Node* parent, const char *name, + GLUI_Spinner( GLUI_Node* parent, const char *name, int *live_var, int id=-1, GLUI_CB callback=GLUI_CB() ); // Constructor, float live var - GLUI_Spinner( GLUI_Node* parent, const char *name, + GLUI_Spinner( GLUI_Node* parent, const char *name, float *live_var, int id=-1, GLUI_CB callback=GLUI_CB() ); // Deprecated constructor - GLUI_Spinner( GLUI_Node* parent, const char *name, + GLUI_Spinner( GLUI_Node* parent, const char *name, int data_type, void *live_var, int id=-1, GLUI_CB callback=GLUI_CB() ); @@ -1960,7 +1960,7 @@ protected: first_callback = true; user_speed = 1.0; } - void common_construct( GLUI_Node* parent, const char *name, + void common_construct( GLUI_Node* parent, const char *name, int data_type, void *live_var, int id, GLUI_CB callback ); }; @@ -2010,7 +2010,7 @@ public: GLUI_String orig_text; int insertion_pt; int substring_start; /*substring that gets displayed in box*/ - int substring_end; + int substring_end; int sel_start, sel_end; /* current selection */ int last_insertion_pt; int debug; @@ -2030,7 +2030,7 @@ public: int mouse_held_down_handler( int local_x, int local_y, bool inside ); int key_handler( unsigned char key,int modifiers ); int special_handler( int key,int modifiers ); - + void activate( int how ); void deactivate( void ); @@ -2090,8 +2090,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, GLUI_String *live_var, + bool scroll, int id, GLUI_CB callback); }; /************************************************************/ @@ -2100,7 +2100,7 @@ protected: /* */ /************************************************************/ -class GLUIAPI GLUI_List_Item : public GLUI_Node +class GLUIAPI GLUI_List_Item : public GLUI_Node { public: GLUI_String text; @@ -2119,12 +2119,12 @@ public: /* GLUI List - JVK */ GLUI_List( GLUI_Node *parent, 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, + GLUI_String& live_var, bool scroll = false, + int id=-1, GLUI_CB callback=GLUI_CB() /*,GLUI_Control *object = NULL */ /*,GLUI_InterObject_CB obj_cb = NULL*/); @@ -2150,7 +2150,7 @@ public: int mouse_held_down_handler( int local_x, int local_y, bool inside ); int key_handler( unsigned char key,int modifiers ); int special_handler( int key,int modifiers ); - + void activate( int how ); void deactivate( void ); @@ -2219,16 +2219,16 @@ protected: /* Scrollbar class - JVK */ /* */ /************************************************************/ - + class GLUIAPI GLUI_Scrollbar : public GLUI_Control { public: // Constructor, no live var GLUI_Scrollbar( GLUI_Node *parent, - const char *name, + const char *name, int horz_vert=GLUI_SCROLL_HORIZONTAL, int data_type=GLUI_SCROLL_INT, - int id=-1, GLUI_CB callback=GLUI_CB() + int id=-1, GLUI_CB callback=GLUI_CB() /*,GLUI_Control *object = NULL*/ /*,GLUI_InterObject_CB obj_cb = NULL*/ ); @@ -2236,7 +2236,7 @@ public: // Constructor, int live var GLUI_Scrollbar( GLUI_Node *parent, const char *name, int horz_vert, int *live_var, - int id=-1, GLUI_CB callback=GLUI_CB() + int id=-1, GLUI_CB callback=GLUI_CB() /*,GLUI_Control *object = NULL*/ /*,GLUI_InterObject_CB obj_cb = NULL*/ ); @@ -2270,7 +2270,7 @@ public: int track_length; - /* Rather than directly access an Editbox or Textbox for + /* Rather than directly access an Editbox or Textbox for changing variables, a pointer to some object is defined along with a static callback in the form func(void *, int) - the int is the new value, the void * must be cast to that @@ -2284,7 +2284,7 @@ public: int mouse_held_down_handler( int local_x, int local_y, bool inside ); int key_handler( unsigned char key,int modifiers ); int special_handler( int key,int modifiers ); - + void draw( int x, int y ); void draw_pressed( void ); void draw_unpressed( void ); @@ -2315,7 +2315,7 @@ protected: void common_init ( void ); void common_construct( GLUI_Node *parent, - const char *name, + const char *name, int horz_vert, int data_type, void* live_var, int id, GLUI_CB callback @@ -2333,7 +2333,7 @@ protected: /* */ /************************************************************/ -class GLUIAPI GLUI_Listbox_Item : public GLUI_Node +class GLUIAPI GLUI_Listbox_Item : public GLUI_Node { public: GLUI_String text; @@ -2374,7 +2374,7 @@ public: GLUI_Listbox_Item *get_item_ptr( const char *text ); GLUI_Listbox_Item *get_item_ptr( int id ); - + GLUI_Listbox( GLUI_Node *parent, const char *name, int *live_var=NULL, @@ -2434,7 +2434,7 @@ public: virtual void iaction_draw_active_area_ortho( void )=0; 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 ); w = GLUI_MOUSE_INTERACTION_WIDTH; @@ -2463,7 +2463,7 @@ public: GLUquadricObj *quadObj; bool can_spin, spinning; float damping; - + int iaction_mouse_down_handler( int local_x, int local_y ); int iaction_mouse_up_handler( int local_x, int local_y, bool inside ); int iaction_mouse_held_down_handler( int local_x, int local_y, bool inside ); @@ -2535,7 +2535,7 @@ public: void setup_texture( void ); void setup_lights( void ); - void draw_2d_arrow( int radius, int filled, int orientation ); + void draw_2d_arrow( int radius, int filled, int orientation ); void draw_2d_x_arrows( int radius ); void draw_2d_y_arrows( int radius ); void draw_2d_z_arrows( int radius ); @@ -2587,7 +2587,7 @@ void _glutBitmapString( void *font, const char *s ); /********** Our own callbacks for glut *********/ /* These are the callbacks that we pass to glut. They take some action if necessary, then (possibly) call the user-level - glut callbacks. + glut callbacks. */ void glui_display_func( void );