diff --git a/include/osg/ApplicationUsage b/include/osg/ApplicationUsage index 034efdcd0..fb6866ed8 100644 --- a/include/osg/ApplicationUsage +++ b/include/osg/ApplicationUsage @@ -77,6 +77,8 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced const UsageMap& getEnvironmentalVariablesDefaults() const { return _environmentalVariablesDefaults; } + void addKeyboardMouseBinding(const std::string& prefix, int key, const std::string& explanation); + void addKeyboardMouseBinding(int key, const std::string& explanation); void addKeyboardMouseBinding(const std::string& option,const std::string& explanation); void setKeyboardMouseBindings(const UsageMap& usageMap) { _keyboardMouse=usageMap; } diff --git a/src/osg/ApplicationUsage.cpp b/src/osg/ApplicationUsage.cpp index b32bb9022..51f177772 100644 --- a/src/osg/ApplicationUsage.cpp +++ b/src/osg/ApplicationUsage.cpp @@ -18,6 +18,8 @@ #include #include +#include + using namespace osg; ApplicationUsage::ApplicationUsage(const std::string& commandLineUsage): @@ -42,7 +44,7 @@ void ApplicationUsage::addUsageExplanation(Type type,const std::string& option,c addEnvironmentalVariable(option,explanation); break; case(KEYBOARD_MOUSE_BINDING): - addKeyboardMouseBinding(option,explanation); + //addKeyboardMouseBinding(option,explanation); break; default: break; @@ -61,6 +63,32 @@ void ApplicationUsage::addEnvironmentalVariable(const std::string& option,const _environmentalVariablesDefaults[option]=defaultValue; } +void ApplicationUsage::addKeyboardMouseBinding(const std::string& prefix, int key, const std::string& explanation) +{ + if (key!=0) + { + std::ostringstream ostr; + ostr< - #include #include @@ -851,17 +849,8 @@ void ScreenCaptureHandler::stopCapture() /** Get the keyboard and mouse usage of this manipulator.*/ void ScreenCaptureHandler::getUsage(osg::ApplicationUsage& usage) const { - { - std::ostringstream ostr; - ostr<(&_keyEventToggleFullscreen), "Toggle full screen."); - usage.addKeyboardMouseBinding(reinterpret_cast(&_keyEventWindowedResolutionUp), "Increase the screen resolution (in windowed mode)."); - usage.addKeyboardMouseBinding(reinterpret_cast(&_keyEventWindowedResolutionDown), "Decrease the screen resolution (in windowed mode)."); + usage.addKeyboardMouseBinding(_keyEventToggleFullscreen, "Toggle full screen."); + usage.addKeyboardMouseBinding(_keyEventWindowedResolutionUp, "Increase the screen resolution (in windowed mode)."); + usage.addKeyboardMouseBinding(_keyEventWindowedResolutionDown, "Decrease the screen resolution (in windowed mode)."); } bool WindowSizeHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) @@ -308,8 +308,8 @@ ThreadingHandler::ThreadingHandler() : void ThreadingHandler::getUsage(osg::ApplicationUsage &usage) const { - usage.addKeyboardMouseBinding(reinterpret_cast(&_keyEventChangeThreadingModel), "Toggle threading model."); - usage.addKeyboardMouseBinding(reinterpret_cast(&_keyEventChangeEndBarrierPosition), "Toggle the placement of the end of frame barrier."); + usage.addKeyboardMouseBinding(_keyEventChangeThreadingModel, "Toggle threading model."); + usage.addKeyboardMouseBinding(_keyEventChangeEndBarrierPosition, "Toggle the placement of the end of frame barrier."); } bool ThreadingHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) @@ -420,8 +420,8 @@ RecordCameraPathHandler::RecordCameraPathHandler(const std::string& filename, fl void RecordCameraPathHandler::getUsage(osg::ApplicationUsage &usage) const { - usage.addKeyboardMouseBinding(reinterpret_cast(&_keyEventToggleRecord), "Toggle camera path recording."); - usage.addKeyboardMouseBinding(reinterpret_cast(&_keyEventTogglePlayback), "Toggle camera path playback."); + usage.addKeyboardMouseBinding(_keyEventToggleRecord, "Toggle camera path recording."); + usage.addKeyboardMouseBinding(_keyEventTogglePlayback, "Toggle camera path playback."); } bool RecordCameraPathHandler::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) @@ -631,17 +631,8 @@ bool LODScaleHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionA void LODScaleHandler::getUsage(osg::ApplicationUsage& usage) const { - { - std::ostringstream ostr; - ostr<