Gui: [skip ci] rename handleKeyboardEvent to processKeyboardEvent

This commit is contained in:
wmayer
2021-11-05 12:58:36 +01:00
parent ef100d55e9
commit 5b023b0af5
10 changed files with 64 additions and 58 deletions

View File

@@ -1387,55 +1387,6 @@ void NavigationStyle::syncModifierKeys(const SoEvent * const ev)
}
}
SbBool NavigationStyle::handleKeyboardEvent(const SoKeyboardEvent * const event, const SbVec2f & posn)
{
SbBool processed = false;
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
switch (event->getKey()) {
case SoKeyboardEvent::LEFT_CONTROL:
case SoKeyboardEvent::RIGHT_CONTROL:
this->ctrldown = press;
break;
case SoKeyboardEvent::LEFT_SHIFT:
case SoKeyboardEvent::RIGHT_SHIFT:
this->shiftdown = press;
break;
case SoKeyboardEvent::LEFT_ALT:
case SoKeyboardEvent::RIGHT_ALT:
this->altdown = press;
break;
case SoKeyboardEvent::H:
processed = true;
viewer->saveHomePosition();
break;
case SoKeyboardEvent::R:
processed = true;
viewer->resetToHomePosition();
break;
case SoKeyboardEvent::S:
case SoKeyboardEvent::HOME:
case SoKeyboardEvent::LEFT_ARROW:
case SoKeyboardEvent::UP_ARROW:
case SoKeyboardEvent::RIGHT_ARROW:
case SoKeyboardEvent::DOWN_ARROW:
if (!this->isViewing())
this->setViewing(true);
break;
case SoKeyboardEvent::PAGE_UP:
processed = true;
doZoom(viewer->getSoRenderManager()->getCamera(), getDelta(), posn);
break;
case SoKeyboardEvent::PAGE_DOWN:
processed = true;
doZoom(viewer->getSoRenderManager()->getCamera(), -getDelta(), posn);
break;
default:
break;
}
return processed;
}
// The viewer is a state machine, and all changes to the current state
// are made through this call.
void NavigationStyle::setViewingMode(const ViewerMode newmode)
@@ -1664,6 +1615,61 @@ SbBool NavigationStyle::processMotionEvent(const SoMotion3Event * const ev)
return true;
}
SbBool NavigationStyle::processKeyboardEvent(const SoKeyboardEvent * const event)
{
SbBool processed = false;
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
switch (event->getKey()) {
case SoKeyboardEvent::LEFT_CONTROL:
case SoKeyboardEvent::RIGHT_CONTROL:
this->ctrldown = press;
break;
case SoKeyboardEvent::LEFT_SHIFT:
case SoKeyboardEvent::RIGHT_SHIFT:
this->shiftdown = press;
break;
case SoKeyboardEvent::LEFT_ALT:
case SoKeyboardEvent::RIGHT_ALT:
this->altdown = press;
break;
case SoKeyboardEvent::H:
processed = true;
viewer->saveHomePosition();
break;
case SoKeyboardEvent::R:
processed = true;
viewer->resetToHomePosition();
break;
case SoKeyboardEvent::S:
case SoKeyboardEvent::HOME:
case SoKeyboardEvent::LEFT_ARROW:
case SoKeyboardEvent::UP_ARROW:
case SoKeyboardEvent::RIGHT_ARROW:
case SoKeyboardEvent::DOWN_ARROW:
if (!this->isViewing())
this->setViewing(true);
break;
case SoKeyboardEvent::PAGE_UP:
{
processed = true;
const SbVec2f posn = normalizePixelPos(event->getPosition());
doZoom(viewer->getSoRenderManager()->getCamera(), getDelta(), posn);
break;
}
case SoKeyboardEvent::PAGE_DOWN:
{
processed = true;
const SbVec2f posn = normalizePixelPos(event->getPosition());
doZoom(viewer->getSoRenderManager()->getCamera(), -getDelta(), posn);
break;
}
default:
break;
}
return processed;
}
void NavigationStyle::setPopupMenuEnabled(const SbBool on)
{
this->menuenabled = on;