Fix a couple of minor issues and a possible crash when closing a document with several MDI views
This commit is contained in:
parent
27eb32238a
commit
09922ab7a5
|
@ -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();
|
||||
|
|
|
@ -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<View3DInventor *>(*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<View3DInventor *>(*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<ViewProviderDocumentObject*>(viewProvider)));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user