[TD]fix StackTop and StackBottom
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "QGIViewBalloon.h"
|
||||
#include "TaskBalloon.h"
|
||||
#include "ViewProviderBalloon.h"
|
||||
@@ -65,8 +66,7 @@ ViewProviderBalloon::ViewProviderBalloon()
|
||||
ADD_PROPERTY_TYPE(LineVisible, (true), group, (App::PropertyType)(App::Prop_None), "Balloon line visible or hidden");
|
||||
ADD_PROPERTY_TYPE(Color, (PreferencesGui::dimColor()), group, App::Prop_None, "Color of the balloon");
|
||||
|
||||
//Dimensions take their stacking order from the parent View
|
||||
StackOrder.setStatus(App::Property::Hidden,true);
|
||||
StackOrder.setValue(ZVALUE::DIMENSION);
|
||||
}
|
||||
|
||||
ViewProviderBalloon::~ViewProviderBalloon()
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <Mod/TechDraw/App/LandmarkDimension.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "TaskDimension.h"
|
||||
#include "QGIViewDimension.h"
|
||||
#include "ViewProviderDimension.h"
|
||||
@@ -86,8 +87,7 @@ ViewProviderDimension::ViewProviderDimension()
|
||||
ADD_PROPERTY_TYPE(GapFactorASME, (Preferences::GapASME()), group, App::Prop_None,
|
||||
"Adjusts the gap between dimension point and extension line");
|
||||
|
||||
//Dimensions take their stacking order from the parent View
|
||||
StackOrder.setStatus(App::Property::Hidden,true);
|
||||
StackOrder.setValue(ZVALUE::DIMENSION);
|
||||
}
|
||||
|
||||
ViewProviderDimension::~ViewProviderDimension()
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <boost/signals2/connection.hpp>
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
@@ -347,40 +349,73 @@ void ViewProviderDrawingView::stackDown()
|
||||
|
||||
void ViewProviderDrawingView::stackTop()
|
||||
{
|
||||
Gui::Document* gDoc = getDocument();
|
||||
std::vector<ViewProvider*> vps = gDoc->getViewProvidersOfType(TechDrawGui::ViewProviderDrawingView::getClassTypeId());
|
||||
int maxZ = 0;
|
||||
for (auto& vp: vps) {
|
||||
ViewProviderDrawingView* vpdv = static_cast<ViewProviderDrawingView*>(vp);
|
||||
int z = vpdv->StackOrder.getValue();
|
||||
if (z > maxZ) {
|
||||
maxZ = z;
|
||||
QGIView* qView = getQView();
|
||||
if (!qView || !getViewProviderPage()) {
|
||||
//no view, nothing to stack
|
||||
return;
|
||||
}
|
||||
int maxZ = INT_MIN;
|
||||
auto parent = qView->parentItem();
|
||||
if (parent) {
|
||||
//if we have a parentItem, we have to stack within the parentItem, not within the page
|
||||
auto siblings = parent->childItems();
|
||||
for (auto& child : siblings) {
|
||||
if (child->zValue() > maxZ) {
|
||||
maxZ = child->zValue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//if we have no parentItem, we are a top level QGIView and we need to stack
|
||||
//with respect to the other top level views on this page
|
||||
std::vector<App::DocumentObject*> peerObjects = getViewProviderPage()->claimChildren();
|
||||
Gui::Document* gDoc = getDocument();
|
||||
for (auto& peer: peerObjects) {
|
||||
auto vpPeer = gDoc->getViewProvider(peer);
|
||||
ViewProviderDrawingView* vpdv = static_cast<ViewProviderDrawingView*>(vpPeer);
|
||||
int z = vpdv->StackOrder.getValue();
|
||||
if (z > maxZ) {
|
||||
maxZ = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
StackOrder.setValue(maxZ + 1);
|
||||
QGIView* v = getQView();
|
||||
if (v) {
|
||||
v->setStack(maxZ + 1);
|
||||
}
|
||||
qView->setStack(maxZ + 1);
|
||||
}
|
||||
|
||||
void ViewProviderDrawingView::stackBottom()
|
||||
{
|
||||
Gui::Document* gDoc = getDocument();
|
||||
std::vector<ViewProvider*> vps = gDoc->getViewProvidersOfType(TechDrawGui::ViewProviderDrawingView::getClassTypeId());
|
||||
int minZ = 0;
|
||||
for (auto& vp: vps) {
|
||||
ViewProviderDrawingView* vpdv = static_cast<ViewProviderDrawingView*>(vp);
|
||||
int z = vpdv->StackOrder.getValue();
|
||||
if (z < minZ) {
|
||||
minZ = z;
|
||||
QGIView* qView = getQView();
|
||||
if (!qView || !getViewProviderPage()) {
|
||||
//no view, nothing to stack
|
||||
return;
|
||||
}
|
||||
int minZ = INT_MAX;
|
||||
auto parent = qView->parentItem();
|
||||
if (parent) {
|
||||
//if we have a parentItem, we have to stack within the parentItem, not within the page
|
||||
auto siblings = parent->childItems();
|
||||
for (auto& child : siblings) {
|
||||
if (child->zValue() < minZ) {
|
||||
minZ = child->zValue();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//TODO: need to special case DPGI or any other member of a collection
|
||||
//if we have no parentItem, we are a top level QGIView and we need to stack
|
||||
//with respect to the other top level views on this page
|
||||
std::vector<App::DocumentObject*> peerObjects = getViewProviderPage()->claimChildren();
|
||||
Gui::Document* gDoc = getDocument();
|
||||
for (auto& peer: peerObjects) {
|
||||
auto vpPeer = gDoc->getViewProvider(peer);
|
||||
ViewProviderDrawingView* vpdv = static_cast<ViewProviderDrawingView*>(vpPeer);
|
||||
int z = vpdv->StackOrder.getValue();
|
||||
if (z < minZ) {
|
||||
minZ = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
StackOrder.setValue(minZ - 1);
|
||||
QGIView* v = getQView();
|
||||
if (v) {
|
||||
v->setStack(minZ - 1);
|
||||
}
|
||||
qView->setStack(minZ - 1);
|
||||
}
|
||||
|
||||
TechDraw::DrawView* ViewProviderDrawingView::getViewObject() const
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "QGIView.h"
|
||||
#include "TaskLeaderLine.h"
|
||||
#include "ViewProviderLeader.h"
|
||||
@@ -71,6 +72,8 @@ ViewProviderLeader::ViewProviderLeader()
|
||||
LineStyle.setEnums(LineStyleEnums);
|
||||
ADD_PROPERTY_TYPE(LineStyle, (1), group, (App::PropertyType)(App::Prop_None), "Line style");
|
||||
ADD_PROPERTY_TYPE(Color, (getDefLineColor()), group, App::Prop_None, "Color of the Markup");
|
||||
|
||||
StackOrder.setValue(ZVALUE::DIMENSION);
|
||||
}
|
||||
|
||||
ViewProviderLeader::~ViewProviderLeader()
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
|
||||
#include "PreferencesGui.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "QGIView.h"
|
||||
#include "TaskRichAnno.h"
|
||||
#include "QGSPage.h"
|
||||
@@ -64,6 +65,7 @@ ViewProviderRichAnno::ViewProviderRichAnno()
|
||||
ADD_PROPERTY_TYPE(LineStyle, (1), group, (App::PropertyType)(App::Prop_None), "Frame line style");
|
||||
ADD_PROPERTY_TYPE(LineColor, (getDefLineColor()), group, App::Prop_None, "The color of the frame");
|
||||
|
||||
StackOrder.setValue(ZVALUE::DIMENSION);
|
||||
}
|
||||
|
||||
ViewProviderRichAnno::~ViewProviderRichAnno()
|
||||
|
||||
Reference in New Issue
Block a user