Qt4's qglobal.h defined TRUE and FALSE. Qt5 does not do it anymore. Replace it with true and false.
158f39ec78
This change is Qt4/Qt5 neutral.
This commit is contained in:
committed by
wmayer
parent
db345cb624
commit
7d0e892d36
@@ -53,7 +53,7 @@ using namespace Gui;
|
||||
|
||||
TYPESYSTEM_SOURCE(Gui::CADNavigationStyle, Gui::UserNavigationStyle);
|
||||
|
||||
CADNavigationStyle::CADNavigationStyle() : lockButton1(FALSE)
|
||||
CADNavigationStyle::CADNavigationStyle() : lockButton1(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -102,11 +102,11 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
this->lastmouseposition = posn;
|
||||
|
||||
// Set to TRUE if any event processing happened. Note that it is not
|
||||
// Set to true if any event processing happened. Note that it is not
|
||||
// necessary to restrict ourselves to only do one "action" for an
|
||||
// event, we only need this flag to see if any processing happened
|
||||
// at all.
|
||||
SbBool processed = FALSE;
|
||||
SbBool processed = false;
|
||||
|
||||
const ViewerMode curmode = this->currentmode;
|
||||
ViewerMode newmode = curmode;
|
||||
@@ -127,13 +127,13 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
if (!processed && !viewer->isEditing()) {
|
||||
processed = handleEventInForeground(ev);
|
||||
if (processed)
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = (const SoKeyboardEvent *) ev;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
switch (event->getKey()) {
|
||||
case SoKeyboardEvent::LEFT_CONTROL:
|
||||
case SoKeyboardEvent::RIGHT_CONTROL:
|
||||
@@ -148,7 +148,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
this->altdown = press;
|
||||
break;
|
||||
case SoKeyboardEvent::H:
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
viewer->saveHomePosition();
|
||||
break;
|
||||
case SoKeyboardEvent::S:
|
||||
@@ -169,12 +169,12 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
// SoDebugError::postInfo("processSoEvent", "button = %d", button);
|
||||
switch (button) {
|
||||
case SoMouseButtonEvent::BUTTON1:
|
||||
this->lockrecenter = TRUE;
|
||||
this->lockrecenter = true;
|
||||
this->button1down = press;
|
||||
#if 0 // disable to avoid interferences where this key combination is used, too
|
||||
if (press && ev->wasShiftDown() &&
|
||||
@@ -183,7 +183,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
float ratio = vp.getViewportAspectRatio();
|
||||
SbViewVolume vv = viewer->getCamera()->getViewVolume(ratio);
|
||||
this->panningplane = vv.getPlane(viewer->getCamera()->focalDistance.getValue());
|
||||
this->lockrecenter = FALSE;
|
||||
this->lockrecenter = false;
|
||||
}
|
||||
else if (!press && ev->wasShiftDown() &&
|
||||
(this->currentmode != NavigationStyle::SELECTION)) {
|
||||
@@ -195,7 +195,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
panToCenter(panningplane, posn);
|
||||
this->interactiveCountDec();
|
||||
}
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -203,18 +203,18 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
if (press && (this->currentmode == NavigationStyle::SEEK_WAIT_MODE)) {
|
||||
newmode = NavigationStyle::SEEK_MODE;
|
||||
this->seekToPoint(pos); // implicitly calls interactiveCountInc()
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
//else if (press && (this->currentmode == NavigationStyle::IDLE)) {
|
||||
// this->setViewing(true);
|
||||
// processed = TRUE;
|
||||
// processed = true;
|
||||
//}
|
||||
else if (press && (this->currentmode == NavigationStyle::PANNING ||
|
||||
this->currentmode == NavigationStyle::ZOOMING)) {
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
this->centerTime = ev->getTime();
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
@@ -222,16 +222,16 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
if (tmp.getValue() < dci) {
|
||||
newmode = NavigationStyle::ZOOMING;
|
||||
}
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
else if (viewer->isEditing() && (this->currentmode == NavigationStyle::SPINNING)) {
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
break;
|
||||
case SoMouseButtonEvent::BUTTON2:
|
||||
// If we are in edit mode then simply ignore the RMB events
|
||||
// to pass the event to the base class.
|
||||
this->lockrecenter = TRUE;
|
||||
this->lockrecenter = true;
|
||||
if (!viewer->isEditing()) {
|
||||
// If we are in zoom or pan mode ignore RMB events otherwise
|
||||
// the canvas doesn't get any release events
|
||||
@@ -251,7 +251,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
this->centerTime = ev->getTime();
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
else if (!press && (this->currentmode == NavigationStyle::DRAGGING)) {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
@@ -259,7 +259,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
if (tmp.getValue() < dci) {
|
||||
newmode = NavigationStyle::ZOOMING;
|
||||
}
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
this->button2down = press;
|
||||
break;
|
||||
@@ -269,7 +269,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
float ratio = vp.getViewportAspectRatio();
|
||||
SbViewVolume vv = viewer->getSoRenderManager()->getCamera()->getViewVolume(ratio);
|
||||
this->panningplane = vv.getPlane(viewer->getSoRenderManager()->getCamera()->focalDistance.getValue());
|
||||
this->lockrecenter = FALSE;
|
||||
this->lockrecenter = false;
|
||||
}
|
||||
else {
|
||||
SbTime tmp = (ev->getTime() - this->centerTime);
|
||||
@@ -280,18 +280,18 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
panToCenter(panningplane, posn);
|
||||
this->interactiveCountDec();
|
||||
}
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
this->button3down = press;
|
||||
break;
|
||||
case SoMouseButtonEvent::BUTTON4:
|
||||
doZoom(viewer->getSoRenderManager()->getCamera(), TRUE, posn);
|
||||
processed = TRUE;
|
||||
doZoom(viewer->getSoRenderManager()->getCamera(), true, posn);
|
||||
processed = true;
|
||||
break;
|
||||
case SoMouseButtonEvent::BUTTON5:
|
||||
doZoom(viewer->getSoRenderManager()->getCamera(), FALSE, posn);
|
||||
processed = TRUE;
|
||||
doZoom(viewer->getSoRenderManager()->getCamera(), false, posn);
|
||||
processed = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -300,22 +300,22 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = TRUE;
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
if (this->currentmode == NavigationStyle::ZOOMING) {
|
||||
this->zoomByCursor(posn, prevnormalized);
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
else if (this->currentmode == NavigationStyle::PANNING) {
|
||||
float ratio = vp.getViewportAspectRatio();
|
||||
panCamera(viewer->getSoRenderManager()->getCamera(), ratio, this->panningplane, posn, prevnormalized);
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
else if (this->currentmode == NavigationStyle::DRAGGING) {
|
||||
this->addToLog(event->getPosition(), event->getTime());
|
||||
this->spin(posn);
|
||||
moveCursorPosition();
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event * const>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = TRUE;
|
||||
processed = true;
|
||||
}
|
||||
|
||||
enum {
|
||||
@@ -348,8 +348,8 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// The left mouse button has been released right now but
|
||||
// we want to avoid that the event is procesed elsewhere
|
||||
if (this->lockButton1) {
|
||||
this->lockButton1 = FALSE;
|
||||
processed = TRUE;
|
||||
this->lockButton1 = false;
|
||||
processed = true;
|
||||
}
|
||||
|
||||
//if (curmode == NavigationStyle::DRAGGING) {
|
||||
@@ -424,14 +424,14 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// but then button 3 is relaesed we shouldn't switch
|
||||
// into selection mode.
|
||||
if (this->button1down && this->button3down)
|
||||
this->lockButton1 = TRUE;
|
||||
this->lockButton1 = true;
|
||||
|
||||
// If not handled in this class, pass on upwards in the inheritance
|
||||
// hierarchy.
|
||||
if (/*(curmode == NavigationStyle::SELECTION || viewer->isEditing()) && */!processed)
|
||||
processed = inherited::processSoEvent(ev);
|
||||
else
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user