diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 5ccdc2d797..c148bd64fa 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -916,7 +916,7 @@ void StdCmdToggleObjects::activated(int iMsg) (App::DocumentObject::getClassTypeId()); for (std::vector::const_iterator it=obj.begin();it!=obj.end();++it) { - if (doc->isShow((*it)->getNameInDocument())) + if (doc && doc->isShow((*it)->getNameInDocument())) doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False" , app->getName(), (*it)->getNameInDocument()); else diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 060fc4268f..b97c79cf48 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -885,7 +885,7 @@ void ManualAlignment::finish() } /** - * Cancels the process and clöses the windows without performing an alignment. + * Cancels the process and closes the windows without performing an alignment. */ void ManualAlignment::cancel() { diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index adcd752f58..313f42b211 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -1170,7 +1170,12 @@ void NavigationStyle::startSelection(AbstractMouseSelection* mouse) { if (!mouse) return; - + + if (mouseSelection) { + SoDebugError::postWarning("NavigationStyle::startSelection", + "Set new mouse selection while an old is still active."); + } + mouseSelection = mouse; mouseSelection->grabMouseModel(viewer); } diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp index 5526c879d1..01b00c7a6f 100644 --- a/src/Gui/SplitView3DInventor.cpp +++ b/src/Gui/SplitView3DInventor.cpp @@ -244,7 +244,7 @@ void AbstractSplitView::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp r3 = ((col3 >> 24) & 0xff) / 255.0; g3 = ((col3 >> 16) & 0xff) / 255.0; b3 = ((col3 >> 8) & 0xff) / 255.0; r4 = ((col4 >> 24) & 0xff) / 255.0; g4 = ((col4 >> 16) & 0xff) / 255.0; b4 = ((col4 >> 8) & 0xff) / 255.0; for (std::vector::iterator it = _viewer.begin(); it != _viewer.end(); ++it) { - (*it)->setBackgroundColor(QColor::fromRgbF(r1, g1, b1)); + (*it)->setBackgroundColor(QColor::fromRgbF(r1, g1, b1)); if (rGrp.GetBool("UseBackgroundColorMid",false) == false) (*it)->setGradientBackgroundColor(SbColor(r2, g2, b2), SbColor(r3, g3, b3)); else diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 7bad112ab3..ff9915d474 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1419,7 +1419,7 @@ void View3DInventorViewer::renderScene(void) // Render normal scenegraph. inherited::actualRedraw(); } - catch(const Base::MemoryException&) { + catch (const Base::MemoryException&) { // FIXME: If this exception appears then the background and camera position get broken somehow. (Werner 2006-02-01) for (std::set::iterator it = _ViewProviderSet.begin(); it != _ViewProviderSet.end(); ++it) (*it)->hide(); @@ -1569,13 +1569,12 @@ void View3DInventorViewer::selectAll() Gui::Selection().setSelection(objs.front()->getDocument()->getName(), objs); } - bool View3DInventorViewer::processSoEvent(const SoEvent* ev) { if (isRedirectedToSceneGraph()) { SbBool processed = inherited::processSoEvent(ev); - if(!processed) + if (!processed) processed = navigation->processEvent(ev); return processed; @@ -1585,7 +1584,7 @@ bool View3DInventorViewer::processSoEvent(const SoEvent* ev) // filter out 'Q' and 'ESC' keys const SoKeyboardEvent* const ke = static_cast(ev); - switch(ke->getKey()) { + switch (ke->getKey()) { case SoKeyboardEvent::ESCAPE: case SoKeyboardEvent::Q: // ignore 'Q' keys (to prevent app from being closed) return inherited::processSoEvent(ev); @@ -2034,7 +2033,7 @@ void View3DInventorViewer::viewAll(float factor) sa.apply(this->getSoRenderManager()->getSceneGraph()); const SoPathList& pathlist = sa.getPaths(); - for(int i = 0; i < pathlist.getLength(); i++) { + for (int i = 0; i < pathlist.getLength(); i++) { SoPath* path = pathlist[i]; SoSkipBoundingGroup* group = static_cast(path->getTail()); group->mode = SoSkipBoundingGroup::EXCLUDE_BBOX; @@ -2313,7 +2312,7 @@ void View3DInventorViewer::drawAxisCross(void) const float NEARVAL = 0.1f; const float FARVAL = 10.0f; - const float dim = NEARVAL * float(tan(M_PI / 8.0)); // FOV is 45? (45/360 = 1/8) + const float dim = NEARVAL * float(tan(M_PI / 8.0)); // FOV is 45 deg (45/360 = 1/8) glFrustum(-dim, dim, -dim, dim, NEARVAL, FARVAL); @@ -2382,11 +2381,11 @@ void View3DInventorViewer::drawAxisCross(void) assert((val[0] >= val[1]) && (val[1] >= val[2])); // Just checking.. - for(int i=0; i < 3; i++) { + for (int i=0; i < 3; i++) { glPushMatrix(); if (idx[i] == XAXIS) { // X axis. - if(stereoMode() != Quarter::SoQTQuarterAdaptor::MONO) + if (stereoMode() != Quarter::SoQTQuarterAdaptor::MONO) glColor3f(0.500f, 0.5f, 0.5f); else glColor3f(0.500f, 0.125f, 0.125f); @@ -2399,7 +2398,7 @@ void View3DInventorViewer::drawAxisCross(void) else glColor3f(0.125f, 0.500f, 0.125f); } - else { // Z axis. + else { // Z axis. glRotatef(-90, 0, 1, 0); if (stereoMode() != Quarter::SoQTQuarterAdaptor::MONO) @@ -2536,10 +2535,10 @@ void View3DInventorViewer::setCursorRepresentation(int modearg) if (w && w->rect().contains(QCursor::pos())) w->setAttribute(Qt::WA_UnderMouse); - switch(modearg) { + switch (modearg) { case NavigationStyle::IDLE: case NavigationStyle::INTERACT: - if(isEditing()) + if (isEditing()) this->getWidget()->setCursor(this->editCursor); else this->getWidget()->setCursor(QCursor(Qt::ArrowCursor)); @@ -2552,28 +2551,22 @@ void View3DInventorViewer::setCursorRepresentation(int modearg) break; case NavigationStyle::ZOOMING: - { this->getWidget()->setCursor(zoomCursor); - } - break; + break; case NavigationStyle::SEEK_MODE: case NavigationStyle::SEEK_WAIT_MODE: case NavigationStyle::BOXZOOM: - { this->getWidget()->setCursor(Qt::CrossCursor); - } - break; + break; case NavigationStyle::PANNING: this->getWidget()->setCursor(panCursor); break; case NavigationStyle::SELECTION: - { this->getWidget()->setCursor(Qt::PointingHandCursor); - } - break; + break; default: assert(0); @@ -2588,18 +2581,17 @@ void View3DInventorViewer::setEditing(SbBool edit) this->editCursor = QCursor(); } +void View3DInventorViewer::setComponentCursor(const QCursor& cursor) +{ + this->getWidget()->setCursor(cursor); +} + void View3DInventorViewer::setEditingCursor(const QCursor& cursor) { this->getWidget()->setCursor(cursor); this->editCursor = this->getWidget()->cursor(); } -void View3DInventorViewer::setComponentCursor(QCursor cursor) -{ - this->getWidget()->setCursor(cursor); -} - - void View3DInventorViewer::selectCB(void* viewer, SoPath* path) { ViewProvider* vp = static_cast(viewer)->getViewProviderByPath(path); diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 48d815c80c..1c37d88bc6 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -224,13 +224,12 @@ public: void setEditing(SbBool edit); SbBool isEditing() const { return this->editing; } void setEditingCursor (const QCursor& cursor); + void setComponentCursor(const QCursor& cursor); void setRedirectToSceneGraph(SbBool redirect) { this->redirected = redirect; } SbBool isRedirectedToSceneGraph() const { return this->redirected; } void setRedirectToSceneGraphEnabled(SbBool enable) { this->allowredir = enable; } SbBool isRedirectToSceneGraphEnabled(void) const { return this->allowredir; } //@} - - void setComponentCursor(QCursor cursor); /** @name Pick actions */ //@{