diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 8c3ff25c6..7b59be2d7 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -80,6 +80,7 @@ #include "DlgOnlineHelpImp.h" #include "SpaceballEvent.h" +#include "SplitView3DInventor.h" #include "View3DInventor.h" #include "ViewProvider.h" #include "ViewProviderExtern.h" @@ -708,6 +709,14 @@ void Application::setActiveDocument(Gui::Document* pcDocument) { if (d->activeDocument == pcDocument) return; // nothing needs to be done + if (pcDocument) { + // This happens if a document with more than one view is about being + // closed and a second view is activated. The document is still not + // removed from the map. + App::Document* doc = pcDocument->getDocument(); + if (d->documents.find(doc) == d->documents.end()) + return; + } d->activeDocument = pcDocument; std::string name; @@ -1391,6 +1400,7 @@ void Application::initTypes(void) Gui::BaseView ::init(); Gui::MDIView ::init(); Gui::View3DInventor ::init(); + Gui::SplitView3DInventor ::init(); // View Provider Gui::ViewProvider ::init(); Gui::ViewProviderExtern ::init(); diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 18447b2e1..aaeab815e 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -55,7 +55,6 @@ #include "BitmapFactory.h" #include "ViewProviderDocumentObject.h" #include "Selection.h" -#include "SoFCSelection.h" #include "WaitCursor.h" #include "Thumbnail.h" @@ -406,17 +405,18 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj) // cycling to all views of the document ViewProvider* viewProvider = getViewProvider(&Obj); - for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) { - View3DInventor *activeView = dynamic_cast(*vIt); - if (activeView && viewProvider) { - if (d->_pcInEdit == viewProvider) - resetEdit(); - activeView->getViewer()->removeViewProvider(viewProvider); + if (viewProvider && viewProvider->getTypeId().isDerivedFrom + (ViewProviderDocumentObject::getClassTypeId())) { + // go through the views + for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) { + View3DInventor *activeView = dynamic_cast(*vIt); + if (activeView) { + if (d->_pcInEdit == viewProvider) + resetEdit(); + activeView->getViewer()->removeViewProvider(viewProvider); + } } - } - if (viewProvider && viewProvider->getTypeId().isDerivedFrom( - ViewProviderDocumentObject::getClassTypeId())) { // removing from tree signalDeletedObject(*(static_cast(viewProvider))); diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp index be874b05c..f80532af8 100644 --- a/src/Gui/SplitView3DInventor.cpp +++ b/src/Gui/SplitView3DInventor.cpp @@ -41,8 +41,10 @@ using namespace Gui; -SplitView3DInventor::SplitView3DInventor( int views, Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags ) - : MDIView( pcDocument,parent, wflags) +TYPESYSTEM_SOURCE_ABSTRACT(Gui::SplitView3DInventor,Gui::MDIView); + +SplitView3DInventor::SplitView3DInventor(int views, Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags) + : MDIView(pcDocument,parent, wflags) { // important for highlighting setMouseTracking(true); diff --git a/src/Gui/SplitView3DInventor.h b/src/Gui/SplitView3DInventor.h index c10da630d..c4596e9a9 100644 --- a/src/Gui/SplitView3DInventor.h +++ b/src/Gui/SplitView3DInventor.h @@ -38,6 +38,8 @@ class View3DInventorViewer; */ class GuiExport SplitView3DInventor : public MDIView,public ParameterGrp::ObserverType { + TYPESYSTEM_HEADER(); + public: SplitView3DInventor(int views, Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0); ~SplitView3DInventor(); diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 262916d1e..2645b6196 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -93,7 +93,7 @@ void GLOverlayWidget::paintEvent(QPaintEvent* ev) /* TRANSLATOR Gui::View3DInventor */ -TYPESYSTEM_SOURCE_ABSTRACT(Gui::View3DInventor,Gui::BaseView); +TYPESYSTEM_SOURCE_ABSTRACT(Gui::View3DInventor,Gui::MDIView); View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags) : MDIView(pcDocument, parent, wflags), _viewerPy(0) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 1b5ab3af0..ab3dd8e10 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1636,6 +1636,16 @@ void View3DInventorViewer::stopAnimating(void) navigation->stopAnimating(); } +void View3DInventorViewer::setPopupMenuEnabled(const SbBool on) +{ + navigation->setPopupMenuEnabled(on); +} + +SbBool View3DInventorViewer::isPopupMenuEnabled(void) const +{ + return navigation->isPopupMenuEnabled(); +} + /*! Set the flag deciding whether or not to show the axis cross. */ diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 96c6fdce7..71e5a2bf3 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -106,6 +106,9 @@ public: void setAnimationEnabled(const SbBool enable); SbBool isAnimationEnabled(void) const; + void setPopupMenuEnabled(const SbBool on); + SbBool isPopupMenuEnabled(void) const; + void startAnimating(const SbVec3f& axis, float velocity); void stopAnimating(void); SbBool isAnimating(void) const; diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index 6017172a2..687cf9fc3 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -786,7 +786,7 @@ bool MeshInput::LoadAsciiSTL (std::istream &rstrIn) if (line.find("ENDFACET") != std::string::npos) ulFacetCt++; // prevent from reading EOF (as I don't know how to reread the file then) - else if (rstrIn.tellg() > ulSize) + if (rstrIn.tellg() > ulSize) break; else if (line.find("ENDSOLID") != std::string::npos) break;