Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -105,13 +105,13 @@ SbBool TinkerCADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
const auto event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
SbBool canOpenPopupMenu = false;
|
||||
@@ -186,7 +186,7 @@ SbBool TinkerCADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto event = (const SoLocation2Event *) ev;
|
||||
if (curmode == NavigationStyle::PANNING) {
|
||||
float ratio = vp.getViewportAspectRatio();
|
||||
panCamera(viewer->getSoRenderManager()->getCamera(), ratio, this->panningplane, posn, prevnormalized);
|
||||
@@ -202,7 +202,7 @@ SbBool TinkerCADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
Reference in New Issue
Block a user