[Plib-cvs] plib/src/puAux Makefile.am,NONE,1.1 puAux.cxx,NONE,1.1 puAux.h,NONE,1.1 puAuxBiSlider.cxx
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-02-28 01:03:10
|
Update of /cvsroot/plib/plib/src/puAux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23821/plib/src/puAux Added Files: Makefile.am puAux.cxx puAux.h puAuxBiSlider.cxx puAuxBiSliderWithEnds.cxx puAuxComboBox.cxx puAuxCompass.cxx puAuxFileSelector.cxx puAuxLargeInput.cxx puAuxScrollBar.cxx puAuxSelectBox.cxx puAuxSliderWithInput.cxx puAuxSpinBox.cxx puAuxTriSlider.cxx puAuxVerticalMenu.cxx Log Message: Added puAux library. --- NEW FILE: Makefile.am --- if BUILD_PUAUX lib_LIBRARIES = libplibpuaux.a include_HEADERS = puAux.h libplibpuaux_a_SOURCES = puAux.cxx \ puAuxBiSlider.cxx \ puAuxBiSliderWithEnds.cxx \ puAuxComboBox.cxx \ puAuxCompass.cxx \ puAuxFileSelector.cxx \ puAuxLargeInput.cxx \ puAuxScrollBar.cxx \ puAuxSelectBox.cxx \ puAuxSliderWithInput.cxx \ puAuxSpinBox.cxx \ puAuxTriSlider.cxx \ puAuxVerticalMenu.cxx INCLUDES = -I$(top_srcdir)/src/sg \ -I$(top_srcdir)/src/pui \ -I$(top_srcdir)/src/fnt \ -I$(top_srcdir)/src/util endif EXTRA_DIST = puAux.dsp --- NEW FILE: puAux.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: puAux.cxx,v 1.1 2004/02/28 00:54:03 sjbaker Exp $ */ #include "puAux.h" void puaInit () { /* Nothing to see here - move along. */ } --- NEW FILE: puAux.h --- /* PUI Auxiliary Widget Library Derived from PLIB, the Portable Game Library by Steve Baker. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...744 lines suppressed...] // Accessors and mutators void getRotation ( sgQuat q ) const { memcpy ( q, rotation, 4 * sizeof(sgFloat) ) ; } void setRotation ( sgQuat q ) { memcpy ( rotation, q, 4 * sizeof(sgFloat) ) ; } void getTranslation ( sgVec3 t ) const { memcpy ( t, translation, 3 * sizeof(sgFloat) ) ; } void setTranslation ( sgVec3 t ) { memcpy ( translation, t, 3 * sizeof(sgFloat) ) ; } float getPointSize () const { return point_size ; } void setPointSize ( float p ) { point_size = p ; } int getTriggerButton () const { return trigger_button ; } void setTriggerButton ( int b ) { trigger_button = b ; } float getTranslationSensitivity () const { return translation_sensitivity ; } void setTranslationSensitivity ( float t ) { translation_sensitivity = t ; } } ; #endif --- NEW FILE: puAuxBiSlider.cxx --- /* PUI Auxiliary Widget Library Derived from PLIB, the Portable Game Library by Steve Baker. Copyright (C) 1998,2002,2004 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [...131 lines suppressed...] break ; case PUSLIDER_DELTA :/* Deprecated! */ if ( fabs ( last_cb_value - next_value ) >= cb_delta ) { last_cb_value = next_value ; puSetActiveWidget ( this, x, y ) ; invokeCallback () ; } break ; case PUSLIDER_ALWAYS : default : last_cb_value = next_value ; puSetActiveWidget ( this, x, y ) ; invokeCallback () ; break ; } } } --- NEW FILE: puAuxBiSliderWithEnds.cxx --- /* PUI Auxiliary Widget Library Derived from PLIB, the Portable Game Library by Steve Baker. Copyright (C) 1998,2002,2004 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [...61 lines suppressed...] void puaBiSliderWithEnds::draw ( int dx, int dy ) { if ( !visible || ( window != puGetWindow () ) ) return ; draw_label ( dx, dy ) ; puGroup::draw ( dx, dy ) ; } int puaBiSliderWithEnds::checkKey ( int key, int updown ) { if ( ! isVisible () || ! isActive () || ( window != puGetWindow () ) ) return FALSE ; return ( max_box->checkKey ( key, updown ) + min_box->checkKey ( key, updown ) ) ; } --- NEW FILE: puAuxComboBox.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...231 lines suppressed...] /* Share 'string' value with input box */ input -> getValue ( &stringval ) ; setValuator ( stringval ) ; arrow_btn = new puArrowButton ( maxx-minx - arrow_width, 0, maxx-minx, maxy-miny, PUARROW_DOWN ) ; arrow_btn -> setStyle ( PUSTYLE_SMALL_SHADED ) ; arrow_btn -> setUserData ( this ) ; arrow_btn -> setCallback ( handle_arrow ) ; popup_menu = new puPopupMenu ( 0, 0 ) ; popup_menu -> close () ; close () ; newList ( entries ) ; } --- NEW FILE: puAuxCompass.cxx --- /* PUI Auxiliary Widget Library Derived from PLIB, the Portable Game Library by Steve Baker. Copyright (C) 1998,2002,2004 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [...615 lines suppressed...] translation[1] += translation_sensitivity * displacement[1] ; translation[2] += translation_sensitivity * displacement[2] ; break ; case PUACOMPASS_TRANSLATE_Z_X : translation[2] += translation_sensitivity * displacement[2] ; translation[0] += translation_sensitivity * displacement[0] ; break ; } mouse_x = xm * size / new_size ; mouse_y = ym * size / new_size ; mouse_z = zm * size / new_size ; // if ( rot[0] < 1.5 ) // { // sgPostMultQuat ( rotation, rot ) ; // prev_angle += angle ; // printf ( "Rotation %f %f %f %f %f\n", prev_angle, rotation[SG_W], rotation[SG_X], rotation[SG_Y], rotation[SG_Z] ) ; // } } } --- NEW FILE: puAuxFileSelector.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...653 lines suppressed...] } else { files[ ifile ] = new char[ name_len + 1 ] ; memcpy ( files [ ifile ], dp->d_name, name_len + 1 ) ; /* Plus one to include the final '\0' */ } ifile++ ; } } files [ ifile ] = NULL ; ulCloseDir ( dirp ) ; puaFileSelectorSort( files, dflag, num_files ) ; list_box -> newList ( files ) ; } --- NEW FILE: puAuxLargeInput.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...1231 lines suppressed...] of string fits in area (space_ptr == NULL). */ { wrapped_text_wp += strlen (wrapped_text_wp) ; if ( space_ptr != NULL ) /* Advance past the NULL since there's more string left */ wrapped_text_wp += 1 ; } else { if ( space_ptr != NULL ) *space_ptr = ' ' ; *old_space_ptr = '\n' ; wrapped_text_wp = old_space_ptr + 1 ; } } } --- NEW FILE: puAuxScrollBar.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...192 lines suppressed...] case PUSLIDER_DELTA : /* Deprecated! */ if ( fabs ( last_cb_value - next_value ) >= cb_delta ) { last_cb_value = next_value ; puSetActiveWidget ( this, x, y ) ; invokeCallback () ; } break ; case PUSLIDER_ALWAYS : default : last_cb_value = next_value ; puSetActiveWidget ( this, x, y ) ; invokeCallback () ; break ; } } } --- NEW FILE: puAuxSelectBox.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...147 lines suppressed...] down_arrow = new puArrowButton ( maxx-minx - arrow_size, 0, maxx-minx, arrow_size, PUARROW_DOWN ) ; down_arrow -> setStyle ( PUSTYLE_SMALL_SHADED ) ; down_arrow -> setUserData ( this ) ; down_arrow -> setCallback ( handle_arrow ) ; up_arrow = new puArrowButton ( maxx-minx - arrow_size, arrow_size, maxx-minx, maxy-miny, PUARROW_UP ) ; up_arrow -> setStyle ( PUSTYLE_SMALL_SHADED ) ; up_arrow -> setUserData ( this ) ; up_arrow -> setCallback ( handle_arrow ) ; newList ( entries ) ; close () ; } --- NEW FILE: puAuxSliderWithInput.cxx --- /* PUI Auxiliary Widget Library Derived from PLIB, the Portable Game Library by Steve Baker. Copyright (C) 1998,2002,2004 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: puAuxSliderWithInput.cxx,v 1.1 2004/02/28 00:54:03 sjbaker Exp $ */ #include "puAux.h" UL_RTTI_DEF1(puaSliderWithInput,puGroup) void puaSliderWithInput::handle_slider ( puObject *obj ) { puaSliderWithInput *sl = (puaSliderWithInput *)obj->getUserData () ; sl->setValue ( obj->getFloatValue () ) ; sl->__setInputBox ( obj->getFloatValue () ) ; sl->invokeCallback () ; } void puaSliderWithInput::handle_input ( puObject *obj ) { puaSliderWithInput *sl = (puaSliderWithInput *)obj->getUserData () ; sl->setValue ( obj->getFloatValue () ) ; sl->invokeCallback () ; } puaSliderWithInput::puaSliderWithInput ( int minx, int miny, int maxx, int maxy, int above ) : puGroup ( minx, miny ) { type |= PUCLASS_SLIDERWITHINPUT ; slider = new puSlider ( (maxx - minx)/2-10, above ? 0 : 20, maxy-miny-20, TRUE ) ; input_box = new puInput ( 0, above ? maxy - miny - 20 : 0, maxx-minx, above ? maxy - miny : 20 ) ; input_box->setValue ( 0 ) ; slider->setUserData ( this ) ; slider->setCallback ( handle_slider ) ; input_box->setUserData ( this ) ; input_box->setCallback ( handle_input ) ; close () ; input_position = above ; } void puaSliderWithInput::setSize ( int w, int h ) { slider->setSize ( 20, h-40 ) ; slider->setPosition ( w/2-10, input_position ? 0 : 20 ) ; input_box->setSize ( w, 20 ) ; input_box->setPosition ( 0, input_position ? h-20 : 0 ) ; } void puaSliderWithInput::draw ( int dx, int dy ) { if ( !visible || ( window != puGetWindow () ) ) return ; draw_label ( dx, dy ) ; puGroup::draw ( dx, dy ) ; } int puaSliderWithInput::checkKey ( int key, int updown ) { if ( ! isVisible () || ! isActive () || ( window != puGetWindow () ) ) return FALSE ; return ( input_box->checkKey ( key, updown ) ) ; } --- NEW FILE: puAuxSpinBox.cxx --- /* PUI Auxiliary Widget Library Derived from PLIB, the Portable Game Library by Steve Baker. Copyright (C) 1998,2002,2004 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: puAuxSpinBox.cxx,v 1.1 2004/02/28 00:54:03 sjbaker Exp $ */ #include "puAux.h" UL_RTTI_DEF2(puaSpinBox,puRange,puGroup) puaSpinBox::puaSpinBox ( int minx, int miny, int maxx, int maxy, int arrow_pos ) : puRange ( 1.0f, 10.0f, 1.0f ), puGroup ( minx, miny ) { extern void puaSpinBox_handle_input ( puObject* ob ) ; extern void puaSpinBox_handle_input_active ( puObject* ob ) ; extern void puaSpinBox_handle_arrow ( puObject* ob ) ; type |= PUCLASS_SPINBOX ; arrow_position = arrow_pos ; int arrow_size = ( maxy - miny ) / 2 ; if ( arrow_pos == 1 ) input_box = new puInput ( 0, 0, maxx - minx - arrow_size, maxy - miny ) ; else input_box = new puInput ( arrow_size, 0, maxx - minx, maxy - miny ) ; input_box->setCallback ( puaSpinBox_handle_input ) ; input_box->setActiveCallback ( puaSpinBox_handle_input_active ) ; input_box->setDownCallback ( puaSpinBox_handle_input ) ; input_box->setUserData ( this ) ; up_arrow = new puArrowButton ( arrow_position?maxx-minx-arrow_size:0, arrow_size, arrow_position?maxx-minx:arrow_size, maxy-miny, PUARROW_UP ) ; up_arrow->setCallback ( puaSpinBox_handle_arrow ) ; up_arrow->setUserData ( this ) ; down_arrow = new puArrowButton ( arrow_position?maxx-minx-arrow_size:0, 0, arrow_position?maxx-minx:arrow_size, arrow_size, PUARROW_DOWN ) ; down_arrow->setCallback ( puaSpinBox_handle_arrow ) ; down_arrow->setUserData ( this ) ; close () ; } void puaSpinBox_handle_arrow ( puObject *ob ) { puaSpinBox *master = (puaSpinBox *)(ob->getUserData ()) ; float val = master->getFloatValue () ; if ( ((puArrowButton *)ob)->getArrowType () == PUARROW_UP ) val += master->getStepSize () ; else val -= master->getStepSize () ; if ( val > master->getMaxValue () ) val = master->getMaxValue () ; if ( val < master->getMinValue () ) val = master->getMinValue () ; master->setValue ( val ) ; master->invokeCallback () ; } void puaSpinBox_handle_input ( puObject *ob ) { puaSpinBox *master = (puaSpinBox *)(ob->getUserData ()) ; float val = ob->getFloatValue () ; if ( val > master->getMaxValue () ) val = master->getMaxValue () ; if ( val < master->getMinValue () ) val = master->getMinValue () ; master->setValue ( val ) ; master->invokeCallback () ; } void puaSpinBox_handle_input_active ( puObject *ob ) { puaSpinBox *master = (puaSpinBox *)(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 () ; } --- NEW FILE: puAuxTriSlider.cxx --- /* PUI Auxiliary Widget Library Derived from PLIB, the Portable Game Library by Steve Baker. Copyright (C) 1998,2002,2004 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [...172 lines suppressed...] break ; case PUSLIDER_DELTA :/* Deprecated! */ if ( fabs ( last_cb_value - next_value ) >= cb_delta ) { last_cb_value = next_value ; puSetActiveWidget ( this, x, y ) ; invokeCallback () ; } break ; case PUSLIDER_ALWAYS : default : last_cb_value = next_value ; puSetActiveWidget ( this, x, y ) ; invokeCallback () ; break ; } } } --- NEW FILE: puAuxVerticalMenu.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...134 lines suppressed...] } recalc_bbox () ; // If in its own window (its window number is not the same as its parent's // window number), then resize the window if (window != parent -> getWindow () ) { int temp_window = puGetWindow () ; puSetWindow ( window ) ; puSetWindowSize ( bbox.max[0] - bbox.min[0], bbox.max[1] - bbox.min[1] ) ; setPosition ( 0, 0 ) ; puSetWindow ( temp_window ) ; } } |