[Plib-cvs] plib/src/pui pu.h,1.148,1.149 puBiSlider.cxx,1.22,1.23 puButton.cxx,1.21,1.22 puDial.cxx,
Brought to you by:
sjbaker
From: John F. F. <fa...@us...> - 2005-05-06 18:31:46
|
Update of /cvsroot/plib/plib/src/pui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25128 Modified Files: pu.h puBiSlider.cxx puButton.cxx puDial.cxx puInput.cxx puLargeInput.cxx puListBox.cxx puMenuBar.cxx puObject.cxx puPopupMenu.cxx puScrollBar.cxx puSlider.cxx puTriSlider.cxx puVerticalMenu.cxx Log Message: Implementing code to allow the user to activate a widget with an application-specified mouse button. Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.148 retrieving revision 1.149 diff -u -d -r1.148 -r1.149 --- pu.h 5 Aug 2004 01:05:48 -0000 1.148 +++ pu.h 6 May 2005 18:31:08 -0000 1.149 @@ -580,6 +580,7 @@ puGroup *parent ; int active_mouse_edge ; /* is it PU_UP or PU_DOWN (or both) that activates this? */ + int active_mouse_button ; /* which mouse button or buttons activate this */ int style ; int visible ; int active ; @@ -718,6 +719,9 @@ void setActiveDirn ( int e ) { active_mouse_edge = e ; } int getActiveDirn ( void ) const { return active_mouse_edge ; } + void setActiveButton ( int b ) { active_mouse_button = b ; } + int getActiveButton ( void ) const { return active_mouse_button ; } + void setLegend ( const char *l ) { legend = l ; recalc_bbox() ; puPostRefresh () ; } const char *getLegend ( void ) const { return legend ; } Index: puBiSlider.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puBiSlider.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- puBiSlider.cxx 2 Sep 2002 06:05:45 -0000 1.22 +++ puBiSlider.cxx 6 May 2005 18:31:11 -0000 1.23 @@ -86,14 +86,14 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON && updown == PU_UP ) + if ( ( button == active_mouse_button ) && ( updown == PU_UP ) ) { setActiveButton ( 0 ) ; puDeactivateWidget () ; return ; } - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { int sd = isVertical() ; int sz = abox.max [sd] - abox.min [sd] ; Index: puButton.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puButton.cxx,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- puButton.cxx 7 Feb 2003 17:41:07 -0000 1.21 +++ puButton.cxx 6 May 2005 18:31:11 -0000 1.22 @@ -210,9 +210,9 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { - if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN ) + if ( ( updown == active_mouse_edge ) || ( active_mouse_edge == PU_UP_AND_DOWN ) ) { lowlight () ; setValue ( (int) ! getIntegerValue () ) ; Index: puDial.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puDial.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- puDial.cxx 21 Sep 2002 17:47:09 -0000 1.26 +++ puDial.cxx 6 May 2005 18:31:11 -0000 1.27 @@ -118,13 +118,13 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON && updown == PU_UP ) + if ( ( button == active_mouse_button ) && ( updown == PU_UP ) ) { puDeactivateWidget () ; return ; } - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { int x_cen = ( abox.max [0] + abox.min [0] ) / 2 ; int y_cen = ( abox.max [1] + abox.min [1] ) / 2 ; Index: puInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puInput.cxx,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- puInput.cxx 5 Aug 2004 01:05:48 -0000 1.35 +++ puInput.cxx 6 May 2005 18:31:11 -0000 1.36 @@ -191,7 +191,7 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { /* Most GUI's activate a button on button-UP not button-DOWN. */ Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- puLargeInput.cxx 23 Feb 2004 04:16:52 -0000 1.48 +++ puLargeInput.cxx 6 May 2005 18:31:12 -0000 1.49 @@ -731,7 +731,7 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { // Most GUI's activate a button on button-UP not button-DOWN. Index: puListBox.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puListBox.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- puListBox.cxx 2 Sep 2002 06:05:46 -0000 1.23 +++ puListBox.cxx 6 May 2005 18:31:25 -0000 1.24 @@ -166,9 +166,9 @@ puDeactivateWidget () ; } - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { - if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN ) + if ( ( updown == active_mouse_edge ) || ( active_mouse_edge == PU_UP_AND_DOWN ) ) { lowlight () ; Index: puMenuBar.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puMenuBar.cxx,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- puMenuBar.cxx 16 Feb 2004 13:49:03 -0000 1.21 +++ puMenuBar.cxx 6 May 2005 18:31:25 -0000 1.22 @@ -124,6 +124,7 @@ b -> setActiveDirn ( PU_UP_AND_DOWN ) ; puPopupMenu *p = new puPopupMenu ( w+10, 0 ) ; + p->setActiveButton ( active_mouse_button ) ; b -> setUserData ( p ) ; Index: puObject.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puObject.cxx,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- puObject.cxx 5 Aug 2004 01:05:48 -0000 1.50 +++ puObject.cxx 6 May 2005 18:31:25 -0000 1.51 @@ -148,6 +148,7 @@ bbox.max[1] = abox.max[1] = maxy ; active_mouse_edge = PU_UP ; + active_mouse_button = PU_LEFT_BUTTON ; style = defaultStyle ; visible = active = TRUE ; highlighted = FALSE ; @@ -464,10 +465,10 @@ puDeactivateWidget () ; } - checkHit ( PU_LEFT_BUTTON, PU_DOWN, (abox.min[0]+abox.max[0])/2, - (abox.min[1]+abox.max[1])/2 ) ; - checkHit ( PU_LEFT_BUTTON, PU_UP , (abox.min[0]+abox.max[0])/2, - (abox.min[1]+abox.max[1])/2 ) ; + checkHit ( active_mouse_button, PU_DOWN, (abox.min[0]+abox.max[0])/2, + (abox.min[1]+abox.max[1])/2 ) ; + checkHit ( active_mouse_button, PU_UP , (abox.min[0]+abox.max[0])/2, + (abox.min[1]+abox.max[1])/2 ) ; return TRUE ; } @@ -486,9 +487,9 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { - if ( updown == active_mouse_edge || active_mouse_edge == PU_UP_AND_DOWN ) + if ( ( updown == active_mouse_edge ) || ( active_mouse_edge == PU_UP_AND_DOWN ) ) { lowlight () ; puSetActiveWidget ( this, x, y ) ; Index: puPopupMenu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puPopupMenu.cxx,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- puPopupMenu.cxx 26 Jun 2003 11:31:07 -0000 1.18 +++ puPopupMenu.cxx 6 May 2005 18:31:26 -0000 1.19 @@ -41,6 +41,8 @@ b->setCallback ( _cb ) ; b->setLegendPlace ( PUPLACE_LOWER_LEFT ) ; b->setUserData ( _user_data ) ; + b->setActiveButton ( active_mouse_button ) ; + b->setWindow ( getWindow () ) ; recalc_bbox () ; return b ; } Index: puScrollBar.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puScrollBar.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- puScrollBar.cxx 21 Sep 2002 17:47:09 -0000 1.4 +++ puScrollBar.cxx 6 May 2005 18:31:26 -0000 1.5 @@ -139,13 +139,13 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON && updown == PU_UP ) + if ( ( button == active_mouse_button ) && ( updown == PU_UP ) ) { puDeactivateWidget () ; return ; } - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { int width = isVertical () ? abox.max[0] - abox.min[0] : abox.max[1] - abox.min[1] ; Index: puSlider.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puSlider.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- puSlider.cxx 21 Sep 2002 15:59:56 -0000 1.26 +++ puSlider.cxx 6 May 2005 18:31:27 -0000 1.27 @@ -113,13 +113,13 @@ if ( updown != PU_DRAG ) puMoveToLast ( this ); - if ( button == PU_LEFT_BUTTON && updown == PU_UP ) + if ( ( button == active_mouse_button ) && ( updown == PU_UP ) ) { puDeactivateWidget () ; return ; } - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { int sd = isVertical() ; int sz = abox.max [sd] - abox.min [sd] ; Index: puTriSlider.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puTriSlider.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- puTriSlider.cxx 2 Sep 2002 06:05:46 -0000 1.24 +++ puTriSlider.cxx 6 May 2005 18:31:27 -0000 1.25 @@ -105,14 +105,14 @@ setActiveButton ( 0 ) ; } - if ( button == PU_LEFT_BUTTON && updown == PU_UP ) + if ( ( button == active_mouse_button ) && ( updown == PU_UP ) ) { setActiveButton ( 0 ) ; puDeactivateWidget () ; return ; } - if ( button == PU_LEFT_BUTTON ) + if ( button == active_mouse_button ) { int sd = isVertical() ; int sz = abox.max [sd] - abox.min [sd] ; Index: puVerticalMenu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puVerticalMenu.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- puVerticalMenu.cxx 2 Sep 2002 06:05:46 -0000 1.10 +++ puVerticalMenu.cxx 6 May 2005 18:31:27 -0000 1.11 @@ -53,7 +53,8 @@ b -> setCallback ( puMenuBar_drop_down_the_menu ) ; b -> setActiveDirn ( PU_UP_AND_DOWN ) ; - puPopupMenu *p = new puPopupMenu ( w+10, 0 ) ; + puPopupMenu *p = new puPopupMenu ( w+10, 0 ) ; + p->setActiveButton ( active_mouse_button ) ; b -> setUserData ( p ) ; |