Пример #1
0
bool Document::setEdit(Gui::ViewProvider* p, int ModNum)
{
    if (d->_pcInEdit)
        resetEdit();
    // is it really a ViewProvider of this document?
    if (d->_ViewProviderMap.find(dynamic_cast<ViewProviderDocumentObject*>(p)->getObject()) == d->_ViewProviderMap.end())
        return false;

    View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
    // if the currently active view is not te 3d view search for it and activate it
    if (!activeView) {
        activeView = dynamic_cast<View3DInventor *>(getViewOfViewProvider(p));
        if (activeView)
            getMainWindow()->setActiveWindow(activeView);
    }

    if (activeView && activeView->getViewer()->setEditingViewProvider(p,ModNum)) {
        d->_pcInEdit = p;
        Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
        if (dlg)
            dlg->setDocumentName(this->getDocument()->getName());
        if (d->_pcInEdit->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) 
            signalInEdit(*(static_cast<ViewProviderDocumentObject*>(d->_pcInEdit)));
    }
    else {
        return false;
    }

    return true;
}
Пример #2
0
bool Document::setEdit(Gui::ViewProvider* p, int ModNum)
{
    if (d->_pcInEdit)
        resetEdit();
    View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
    if (activeView && activeView->getViewer()->setEditingViewProvider(p,ModNum)) {
        d->_pcInEdit = p;
        Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
        if (dlg)
            dlg->setDocumentName(this->getDocument()->getName());
        if (d->_pcInEdit->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) 
            signalInEdit(*(static_cast<ViewProviderDocumentObject*>(d->_pcInEdit)));
    }
    else
        return false;
    return true;
}