[Plib-cvs] plib/src/pui pu.h,1.138,1.139 puGroup.cxx,1.24,1.25 puMenuBar.cxx,1.19,1.20 puSpinBox.cxx
Brought to you by:
sjbaker
From: Norman V. <nh...@us...> - 2003-02-07 17:01:12
|
Update of /cvsroot/plib/plib/src/pui In directory sc8-pr-cvs1:/tmp/cvs-serv28867 Modified Files: pu.h puGroup.cxx puMenuBar.cxx puSpinBox.cxx puValue.cxx Log Message: from John Fay - this batch of changes fixes a bug in the spin box arrow button sizing and label printing and declares the 'floating' variable deprecated. It also adds an active callback capability to the spin box. Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.138 retrieving revision 1.139 diff -u -d -r1.138 -r1.139 --- pu.h 7 Feb 2003 16:04:23 -0000 1.138 +++ pu.h 7 Feb 2003 17:01:02 -0000 1.139 @@ -842,7 +842,7 @@ void doHit ( int button, int updown, int x, int y ) ; - int floating; // Flag telling whether the interface floats in the window or stays put + int floating; // DEPRECATED! -- Flag telling whether the interface floats in the window or stays put public: @@ -854,7 +854,7 @@ mouse_x = 0 ; mouse_y = 0 ; [...79 lines suppressed...] + input_box->setPosition ( ibox.min[0], ibox.min[1] ) ; + abox.min[0] += xpos ; + xpos = 0 ; + } + + if ( height > 0.5f ) /* Adjust the input box to be up from the bottom */ + { + input_box->setPosition ( ibox.min[0], ibox.min[1] + size - ymid ) ; + abox.min[1] += ymid - size ; + ymid = size ; + } + else /* Input box is at the bottom of the group area */ + { + input_box->setPosition ( ibox.min[0], 0 ) ; + abox.min[1] += ibox.min[1] ; + } + up_arrow->setPosition ( xpos, ymid ) ; down_arrow->setPosition ( xpos, ymid - size ) ; recalc_bbox() ; Index: puGroup.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puGroup.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- puGroup.cxx 7 Feb 2003 15:02:50 -0000 1.24 +++ puGroup.cxx 7 Feb 2003 17:01:03 -0000 1.25 @@ -220,7 +220,7 @@ */ if ( mouse_active || ( isHit ( x+abox.min[0], y+abox.min[1]) && - floating && ( button == PU_RIGHT_BUTTON ) ) ) + floating && ( button == PU_RIGHT_BUTTON ) ) ) // DEPRECATED! -- we need to replace this code. { puMoveToLast ( this ); @@ -313,6 +313,8 @@ bo -> draw ( xdraw, ydraw ) ; } + + if ( getWindow () == puGetWindow () ) draw_label ( dx, dy ) ; } Index: puMenuBar.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puMenuBar.cxx,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- puMenuBar.cxx 2 Sep 2002 06:05:46 -0000 1.19 +++ puMenuBar.cxx 7 Feb 2003 17:01:03 -0000 1.20 @@ -49,7 +49,7 @@ #ifndef PU_NOT_USING_GLUT puGroup *parent = p -> getParent () ; - if ( ( parent != parent -> getParent () ) && parent -> getFloating () ) + if ( ( parent != parent -> getParent () ) && parent -> getFloating () ) // DEPRECATED! -- we need to replace this code. { int temp_window = puGetWindow () ; glutSetWindow ( parent -> getWindow () ) ; Index: puSpinBox.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puSpinBox.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- puSpinBox.cxx 21 Sep 2002 15:59:56 -0000 1.6 +++ puSpinBox.cxx 7 Feb 2003 17:01:03 -0000 1.7 @@ -31,6 +31,7 @@ puRange ( 1.0f, 10.0f, 1.0f ), puGroup ( minx, miny ) { extern void puSpinBox_handle_input ( puObject* ob ) ; + extern void puSpinBox_handle_input_active ( puObject* ob ) ; extern void puSpinBox_handle_arrow ( puObject* ob ) ; type |= PUCLASS_SPINBOX ; arrow_position = arrow_pos ; @@ -41,6 +42,7 @@ input_box = new puInput ( arrow_size, 0, maxx - minx, maxy - miny ) ; input_box->setCallback ( puSpinBox_handle_input ) ; + input_box->setActiveCallback ( puSpinBox_handle_input_active ) ; input_box->setDownCallback ( puSpinBox_handle_input ) ; input_box->setUserData ( this ) ; @@ -80,5 +82,15 @@ if ( val < master->getMinValue () ) val = master->getMinValue () ; master->setValue ( val ) ; master->invokeCallback () ; +} + +void puSpinBox_handle_input_active ( puObject *ob ) +{ + puSpinBox *master = (puSpinBox *)(ob->getUserData ()) ; + float val = ob->getFloatValue () ; + if ( val > master->getMaxValue () ) val = master->getMaxValue () ; + if ( val < master->getMinValue () ) val = master->getMinValue () ; + master->setValue ( val ) ; + master->invokeActiveCallback () ; } Index: puValue.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puValue.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- puValue.cxx 15 Sep 2002 00:56:38 -0000 1.23 +++ puValue.cxx 7 Feb 2003 17:01:04 -0000 1.24 @@ -162,6 +162,8 @@ { int i = getType () ; + if ( i & PUCLASS_SCROLLBAR ) return "puScrollBar" ; + if ( i & PUCLASS_SPINBOX ) return "puSpinBox" ; if ( i & PUCLASS_SELECTBOX ) return "puSelectBox" ; if ( i & PUCLASS_COMBOBOX ) return "puComboBox" ; if ( i & PUCLASS_LARGEINPUT ) return "puLargeInput" ; |