void GLUI_EditText::set_int_val( int new_val ) { if ( has_limits == GLUI_LIMIT_CLAMP ) { /*** Clamp the new value to the existing limits ***/ CLAMP( new_val, int_low, int_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 ***/ if ( new_val < int_low ) new_val = int_high; if ( new_val > int_high ) new_val = int_low; } int_val = new_val; float_val = (float) new_val; /* We mirror the value as a float, too */ set_numeric_text(); }
void GLUI_EditText::set_float_val( float new_val ) { if ( has_limits == GLUI_LIMIT_CLAMP ) { /*** 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 ***/ if ( new_val < float_low ) new_val = float_high; if ( new_val > float_high ) new_val = float_low; } float_val = new_val; double_val = (double)new_val; int_val = (int) new_val; /* Mirror the value as an int, too */ set_numeric_text(); }