TechDraw: Enable drag and drop to and from clip groups.
Remove TechDraw_ClipGroupAdd and TechDraw_ClipGroupRemove from the UI.
This commit is contained in:
committed by
WandererFan
parent
fae245be0e
commit
dfb4afb3af
@@ -31,6 +31,9 @@
|
||||
#endif
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
|
||||
#include "ViewProviderViewClip.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -104,3 +107,40 @@ TechDraw::DrawViewClip* ViewProviderViewClip::getObject() const
|
||||
{
|
||||
return getViewObject();
|
||||
}
|
||||
|
||||
|
||||
void ViewProviderViewClip::dragObject(App::DocumentObject* docObj)
|
||||
{
|
||||
if (!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dv = static_cast<TechDraw::DrawView*>(docObj);
|
||||
|
||||
getObject()->removeView(dv);
|
||||
}
|
||||
|
||||
void ViewProviderViewClip::dropObject(App::DocumentObject* docObj)
|
||||
{
|
||||
if (docObj->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
|
||||
//DPGI can not be dropped onto the Page as it belongs to DPG, not Page
|
||||
return;
|
||||
}
|
||||
if (!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dv = static_cast<TechDraw::DrawView*>(docObj);
|
||||
TechDraw::DrawPage* pageClip = getObject()->findParentPage();
|
||||
TechDraw::DrawPage* pageView = dv->findParentPage();
|
||||
if (!pageClip || !pageView) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pageClip != pageView) {
|
||||
pageView->removeView(dv);
|
||||
pageClip->addView(dv);
|
||||
}
|
||||
|
||||
getObject()->addView(dv);
|
||||
}
|
||||
Reference in New Issue
Block a user