[TD]Allow balloons to be attached to non-part views
This commit is contained in:
@@ -62,16 +62,13 @@ DrawPage::DrawPage(void)
|
||||
nowUnsetting = false;
|
||||
forceRedraw(false);
|
||||
|
||||
ADD_PROPERTY_TYPE(KeepUpdated,
|
||||
(Preferences::keepPagesUpToDate()),
|
||||
group,
|
||||
(App::PropertyType)(App::Prop_Output),
|
||||
"Keep page in sync with model");
|
||||
ADD_PROPERTY_TYPE(
|
||||
Template, (nullptr), group, (App::PropertyType)(App::Prop_None), "Attached Template");
|
||||
ADD_PROPERTY_TYPE(KeepUpdated, (Preferences::keepPagesUpToDate()), group,
|
||||
(App::PropertyType)(App::Prop_Output), "Keep page in sync with model");
|
||||
ADD_PROPERTY_TYPE(Template, (nullptr), group, (App::PropertyType)(App::Prop_None),
|
||||
"Attached Template");
|
||||
Template.setScope(App::LinkScope::Global);
|
||||
ADD_PROPERTY_TYPE(
|
||||
Views, (nullptr), group, (App::PropertyType)(App::Prop_None), "Attached Views");
|
||||
ADD_PROPERTY_TYPE(Views, (nullptr), group, (App::PropertyType)(App::Prop_None),
|
||||
"Attached Views");
|
||||
Views.setScope(App::LinkScope::Global);
|
||||
|
||||
// Projection Properties
|
||||
@@ -84,24 +81,16 @@ DrawPage::DrawPage(void)
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("Mod/TechDraw/General");
|
||||
double defScale = hGrp->GetFloat("DefaultScale", 1.0);
|
||||
ADD_PROPERTY_TYPE(Scale,
|
||||
(defScale),
|
||||
group,
|
||||
(App::PropertyType)(App::Prop_None),
|
||||
ADD_PROPERTY_TYPE(Scale, (defScale), group, (App::PropertyType)(App::Prop_None),
|
||||
"Scale factor for this Page");
|
||||
|
||||
ADD_PROPERTY_TYPE(NextBalloonIndex,
|
||||
(1),
|
||||
group,
|
||||
(App::PropertyType)(App::Prop_None),
|
||||
ADD_PROPERTY_TYPE(NextBalloonIndex, (1), group, (App::PropertyType)(App::Prop_None),
|
||||
"Auto-numbering for Balloons");
|
||||
|
||||
Scale.setConstraints(&scaleRange);
|
||||
balloonParent = nullptr;
|
||||
}
|
||||
|
||||
DrawPage::~DrawPage()
|
||||
{}
|
||||
DrawPage::~DrawPage() {}
|
||||
|
||||
void DrawPage::onBeforeChange(const App::Property* prop)
|
||||
{
|
||||
@@ -113,8 +102,8 @@ void DrawPage::onChanged(const App::Property* prop)
|
||||
if ((prop == &KeepUpdated) && KeepUpdated.getValue()) {
|
||||
if (!isRestoring() && !isUnsetting()) {
|
||||
//would be nice if this message was displayed immediately instead of after the recomputeFeature
|
||||
Base::Console().Message(
|
||||
"Rebuilding Views for: %s/%s\n", getNameInDocument(), Label.getValue());
|
||||
Base::Console().Message("Rebuilding Views for: %s/%s\n", getNameInDocument(),
|
||||
Label.getValue());
|
||||
updateAllViews();
|
||||
purgeTouched();
|
||||
}
|
||||
@@ -131,8 +120,7 @@ void DrawPage::onChanged(const App::Property* prop)
|
||||
if (!isRestoring()) {
|
||||
const std::vector<App::DocumentObject*>& vals = Views.getValues();
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = vals.begin();
|
||||
it < vals.end();
|
||||
++it) {
|
||||
it < vals.end(); ++it) {
|
||||
TechDraw::DrawView* view = dynamic_cast<TechDraw::DrawView*>(*it);
|
||||
if (view && view->ScaleType.isValue("Page")) {
|
||||
if (std::abs(view->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
|
||||
@@ -159,10 +147,7 @@ void DrawPage::onChanged(const App::Property* prop)
|
||||
}
|
||||
|
||||
//Page is just a container. It doesn't "do" anything.
|
||||
App::DocumentObjectExecReturn* DrawPage::execute(void)
|
||||
{
|
||||
return App::DocumentObject::execute();
|
||||
}
|
||||
App::DocumentObjectExecReturn* DrawPage::execute(void) { return App::DocumentObject::execute(); }
|
||||
|
||||
// this is now irrelevant, b/c DP::execute doesn't do anything.
|
||||
short DrawPage::mustExecute() const
|
||||
@@ -329,10 +314,7 @@ int DrawPage::removeView(App::DocumentObject* docObj)
|
||||
return Views.getSize();
|
||||
}
|
||||
|
||||
void DrawPage::requestPaint(void)
|
||||
{
|
||||
signalGuiPaint(this);
|
||||
}
|
||||
void DrawPage::requestPaint(void) { signalGuiPaint(this); }
|
||||
|
||||
//this doesn't work right because there is no guaranteed of the restoration order
|
||||
void DrawPage::onDocumentRestored()
|
||||
@@ -417,8 +399,7 @@ void DrawPage::unsetupObject()
|
||||
if (v->isAttachedToDocument()) {
|
||||
std::string viewName = v->getNameInDocument();
|
||||
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
|
||||
docName.c_str(),
|
||||
viewName.c_str());
|
||||
docName.c_str(), viewName.c_str());
|
||||
}
|
||||
}
|
||||
std::vector<App::DocumentObject*> emptyViews;//probably superfluous
|
||||
@@ -432,8 +413,8 @@ void DrawPage::unsetupObject()
|
||||
App::DocumentObject* tmp = Template.getValue();
|
||||
if (tmp) {
|
||||
std::string templateName = Template.getValue()->getNameInDocument();
|
||||
Base::Interpreter().runStringArg(
|
||||
"App.getDocument(\"%s\").removeObject(\"%s\")", docName.c_str(), templateName.c_str());
|
||||
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
|
||||
docName.c_str(), templateName.c_str());
|
||||
}
|
||||
Template.setValue(nullptr);
|
||||
}
|
||||
|
||||
@@ -48,31 +48,29 @@ public:
|
||||
App::PropertyBool KeepUpdated;
|
||||
|
||||
App::PropertyFloatConstraint Scale;
|
||||
App::PropertyEnumeration ProjectionType; // First or Third Angle
|
||||
App::PropertyEnumeration ProjectionType;// First or Third Angle
|
||||
|
||||
App::PropertyInteger NextBalloonIndex;
|
||||
App::PropertyInteger NextBalloonIndex;
|
||||
|
||||
/** @name methods override Feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
App::DocumentObjectExecReturn* execute() override;
|
||||
//@}
|
||||
void handleChangedPropertyType(
|
||||
Base::XMLReader &reader, const char * TypeName, App::Property * prop) override;
|
||||
void handleChangedPropertyType(Base::XMLReader& reader, const char* TypeName,
|
||||
App::Property* prop) override;
|
||||
|
||||
int addView(App::DocumentObject *docObj);
|
||||
int addView(App::DocumentObject* docObj);
|
||||
int removeView(App::DocumentObject* docObj);
|
||||
short mustExecute() const override;
|
||||
boost::signals2::signal<void (const DrawPage*)> signalGuiPaint;
|
||||
boost::signals2::signal<void(const DrawPage*)> signalGuiPaint;
|
||||
|
||||
/// returns the type name of the ViewProvider
|
||||
const char* getViewProviderName() const override {
|
||||
return "TechDrawGui::ViewProviderPage";
|
||||
}
|
||||
const char* getViewProviderName() const override { return "TechDrawGui::ViewProviderPage"; }
|
||||
|
||||
PyObject *getPyObject() override;
|
||||
PyObject* getPyObject() override;
|
||||
|
||||
//App::DocumentObjectExecReturn * recompute(void);
|
||||
//App::DocumentObjectExecReturn * recompute(void);
|
||||
|
||||
/// Check whether we've got a valid template
|
||||
/*!
|
||||
@@ -93,8 +91,7 @@ public:
|
||||
int getOrientation() const;
|
||||
bool isUnsetting() { return nowUnsetting; }
|
||||
void requestPaint();
|
||||
std::vector<App::DocumentObject*> getAllViews() ;
|
||||
DrawViewPart *balloonParent; //could be many balloons on page?
|
||||
std::vector<App::DocumentObject*> getAllViews();
|
||||
|
||||
int getNextBalloonIndex();
|
||||
|
||||
@@ -102,7 +99,7 @@ public:
|
||||
static bool GlobalUpdateDrawings();
|
||||
static bool AllowPageOverride();
|
||||
void forceRedraw(bool b) { m_forceRedraw = b; }
|
||||
bool forceRedraw() { return m_forceRedraw; }
|
||||
bool forceRedraw() { return m_forceRedraw; }
|
||||
void redrawCommand();
|
||||
|
||||
bool canUpdate() const;
|
||||
@@ -121,13 +118,11 @@ private:
|
||||
static const char* ProjectionTypeEnums[];
|
||||
bool nowUnsetting;
|
||||
static App::PropertyFloatConstraint::Constraints scaleRange;
|
||||
|
||||
};
|
||||
|
||||
using DrawPagePython = App::FeaturePythonT<DrawPage>;
|
||||
|
||||
} //namespace TechDraw
|
||||
}//namespace TechDraw
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,27 +23,26 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <cstdlib>
|
||||
# include <cstring>
|
||||
# include <sstream>
|
||||
# include <Precision.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Mod/Measure/App/Measurement.h>
|
||||
|
||||
#include "DrawViewBalloon.h"
|
||||
#include "ArrowPropEnum.h"
|
||||
#include "DrawViewBalloon.h"
|
||||
#include "DrawViewPart.h"
|
||||
#include "Preferences.h"
|
||||
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
App::PropertyFloatConstraint::Constraints DrawViewBalloon::SymbolScaleRange = { Precision::Confusion(),
|
||||
std::numeric_limits<double>::max(),
|
||||
(0.1) };
|
||||
App::PropertyFloatConstraint::Constraints DrawViewBalloon::SymbolScaleRange = {
|
||||
Precision::Confusion(), std::numeric_limits<double>::max(), (0.1)};
|
||||
|
||||
//===========================================================================
|
||||
// DrawViewBalloon
|
||||
@@ -58,116 +57,113 @@ App::PropertyFloatConstraint::Constraints DrawViewBalloon::SymbolScaleRange = {
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewBalloon, TechDraw::DrawView)
|
||||
|
||||
const char* DrawViewBalloon::balloonTypeEnums[]= {"Circular",
|
||||
"None",
|
||||
"Triangle",
|
||||
"Inspection",
|
||||
"Hexagon",
|
||||
"Square",
|
||||
"Rectangle",
|
||||
"Line",
|
||||
nullptr};
|
||||
const char* DrawViewBalloon::balloonTypeEnums[] = {"Circular", "None", "Triangle",
|
||||
"Inspection", "Hexagon", "Square",
|
||||
"Rectangle", "Line", nullptr};
|
||||
|
||||
DrawViewBalloon::DrawViewBalloon()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Text, (""), "", App::Prop_None, "The text to be displayed");
|
||||
ADD_PROPERTY_TYPE(SourceView, (nullptr), "", (App::PropertyType)(App::Prop_None), "Source view for balloon");
|
||||
ADD_PROPERTY_TYPE(SourceView, (nullptr), "", (App::PropertyType)(App::Prop_None),
|
||||
"Source view for balloon");
|
||||
ADD_PROPERTY_TYPE(OriginX, (0), "", (App::PropertyType)(App::Prop_None), "Balloon origin x");
|
||||
ADD_PROPERTY_TYPE(OriginY, (0), "", (App::PropertyType)(App::Prop_None), "Balloon origin y");
|
||||
|
||||
EndType.setEnums(ArrowPropEnum::ArrowTypeEnums);
|
||||
ADD_PROPERTY_TYPE(EndType, (prefEnd()), "", (App::PropertyType)(App::Prop_None), "End symbol for the balloon line");
|
||||
ADD_PROPERTY_TYPE(EndType, (prefEnd()), "", (App::PropertyType)(App::Prop_None),
|
||||
"End symbol for the balloon line");
|
||||
|
||||
ADD_PROPERTY_TYPE(EndTypeScale, (1.0), "", (App::PropertyType)(App::Prop_None), "End symbol scale factor");
|
||||
ADD_PROPERTY_TYPE(EndTypeScale, (1.0), "", (App::PropertyType)(App::Prop_None),
|
||||
"End symbol scale factor");
|
||||
EndTypeScale.setConstraints(&SymbolScaleRange);
|
||||
|
||||
BubbleShape.setEnums(balloonTypeEnums);
|
||||
ADD_PROPERTY_TYPE(BubbleShape, (prefShape()), "", (App::PropertyType)(App::Prop_None), "Shape of the balloon bubble");
|
||||
ADD_PROPERTY_TYPE(BubbleShape, (prefShape()), "", (App::PropertyType)(App::Prop_None),
|
||||
"Shape of the balloon bubble");
|
||||
|
||||
ADD_PROPERTY_TYPE(ShapeScale, (1.0), "", (App::PropertyType)(App::Prop_None), "Balloon shape scale");
|
||||
ADD_PROPERTY_TYPE(ShapeScale, (1.0), "", (App::PropertyType)(App::Prop_None),
|
||||
"Balloon shape scale");
|
||||
ShapeScale.setConstraints(&SymbolScaleRange);
|
||||
|
||||
ADD_PROPERTY_TYPE(TextWrapLen, (-1), "", (App::PropertyType)(App::Prop_None), "Text wrap length; -1 means no wrap");
|
||||
ADD_PROPERTY_TYPE(TextWrapLen, (-1), "", (App::PropertyType)(App::Prop_None),
|
||||
"Text wrap length; -1 means no wrap");
|
||||
|
||||
ADD_PROPERTY_TYPE(KinkLength, (prefKinkLength()), "", (App::PropertyType)(App::Prop_None),
|
||||
"Distance from symbol to leader kink");
|
||||
"Distance from symbol to leader kink");
|
||||
|
||||
SourceView.setScope(App::LinkScope::Global);
|
||||
Rotation.setStatus(App::Property::Hidden, true);
|
||||
Caption.setStatus(App::Property::Hidden, true);
|
||||
}
|
||||
|
||||
DrawViewBalloon::~DrawViewBalloon()
|
||||
{
|
||||
|
||||
}
|
||||
DrawViewBalloon::~DrawViewBalloon() {}
|
||||
|
||||
void DrawViewBalloon::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (!isRestoring()) {
|
||||
if ( (prop == &EndType) ||
|
||||
(prop == &BubbleShape) ||
|
||||
(prop == &ShapeScale) ||
|
||||
(prop == &Text) ||
|
||||
(prop == &KinkLength) ||
|
||||
(prop == &EndTypeScale) ||
|
||||
(prop == &OriginX) ||
|
||||
(prop == &OriginY) ) {
|
||||
if ((prop == &EndType) || (prop == &BubbleShape) || (prop == &ShapeScale) || (prop == &Text)
|
||||
|| (prop == &KinkLength) || (prop == &EndTypeScale) || (prop == &OriginX)
|
||||
|| (prop == &OriginY)) {
|
||||
requestPaint();
|
||||
}
|
||||
}
|
||||
DrawView::onChanged(prop);
|
||||
}
|
||||
|
||||
void DrawViewBalloon::handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName)
|
||||
void DrawViewBalloon::handleChangedPropertyName(Base::XMLReader& reader, const char* TypeName,
|
||||
const char* PropName)
|
||||
{
|
||||
Base::Type type = Base::Type::fromName(TypeName);
|
||||
// was sourceView in the past, now is SourceView
|
||||
if (SourceView.getClassTypeId() == type && strcmp(PropName, "sourceView") == 0) {
|
||||
SourceView.Restore(reader);
|
||||
} else if (BubbleShape.getClassTypeId() == type && strcmp(PropName, "Symbol") == 0) {
|
||||
}
|
||||
else if (BubbleShape.getClassTypeId() == type && strcmp(PropName, "Symbol") == 0) {
|
||||
// was Symbol, then Shape in the past, now is BubbleShape
|
||||
BubbleShape.Restore(reader);
|
||||
} else if (BubbleShape.getClassTypeId() == type && strcmp(PropName, "Shape") == 0) {
|
||||
}
|
||||
else if (BubbleShape.getClassTypeId() == type && strcmp(PropName, "Shape") == 0) {
|
||||
// was Symbol, then Shape in the past, now is BubbleShape
|
||||
BubbleShape.Restore(reader);
|
||||
} else if (ShapeScale.getClassTypeId() == type && strcmp(PropName, "SymbolScale") == 0) {
|
||||
}
|
||||
else if (ShapeScale.getClassTypeId() == type && strcmp(PropName, "SymbolScale") == 0) {
|
||||
// was SymbolScale in the past, now is ShapeScale
|
||||
ShapeScale.Restore(reader);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
DrawView::handleChangedPropertyName(reader, TypeName, PropName);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawViewBalloon::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
void DrawViewBalloon::handleChangedPropertyType(Base::XMLReader& reader, const char* TypeName,
|
||||
App::Property* prop)
|
||||
// transforms properties that had been changed
|
||||
{
|
||||
// also check for changed properties of the base class
|
||||
DrawView::handleChangedPropertyType(reader, TypeName, prop);
|
||||
|
||||
// property OriginX had the App::PropertyFloat and was changed to App::PropertyDistance
|
||||
if ( (prop == &OriginX) &&
|
||||
(strcmp(TypeName, "App::PropertyFloat") == 0) ) {
|
||||
if ((prop == &OriginX) && (strcmp(TypeName, "App::PropertyFloat") == 0)) {
|
||||
App::PropertyFloat OriginXProperty;
|
||||
// restore the PropertyFloat to be able to set its value
|
||||
OriginXProperty.Restore(reader);
|
||||
OriginX.setValue(OriginXProperty.getValue());
|
||||
} else if ( (prop == &OriginX) &&
|
||||
(strcmp(TypeName, "App::PropertyLength") == 0) ) {
|
||||
}
|
||||
else if ((prop == &OriginX) && (strcmp(TypeName, "App::PropertyLength") == 0)) {
|
||||
App::PropertyLength OriginXProperty;
|
||||
// restore the PropertyFloat to be able to set its value
|
||||
OriginXProperty.Restore(reader);
|
||||
OriginX.setValue(OriginXProperty.getValue());
|
||||
|
||||
// property OriginY had the App::PropertyFloat and was changed to App::PropertyDistance
|
||||
} else if ( (prop == &OriginY) &&
|
||||
(strcmp(TypeName, "App::PropertyFloat") == 0) ) {
|
||||
// property OriginY had the App::PropertyFloat and was changed to App::PropertyDistance
|
||||
}
|
||||
else if ((prop == &OriginY) && (strcmp(TypeName, "App::PropertyFloat") == 0)) {
|
||||
App::PropertyFloat OriginYProperty;
|
||||
// restore the PropertyFloat to be able to set its value
|
||||
OriginYProperty.Restore(reader);
|
||||
OriginY.setValue(OriginYProperty.getValue());
|
||||
} else if ( (prop == &OriginY) &&
|
||||
(strcmp(TypeName, "App::PropertyLength") == 0) ) {
|
||||
}
|
||||
else if ((prop == &OriginY) && (strcmp(TypeName, "App::PropertyLength") == 0)) {
|
||||
App::PropertyLength OriginYProperty;
|
||||
// restore the PropertyLength to be able to set its value
|
||||
OriginYProperty.Restore(reader);
|
||||
@@ -182,15 +178,16 @@ short DrawViewBalloon::mustExecute() const
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto dvp = getViewPart();
|
||||
if (dvp && dvp->isTouched()) {
|
||||
auto dv = getParentView();
|
||||
if (dv && dv->isTouched()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return DrawView::mustExecute();
|
||||
}
|
||||
|
||||
void DrawViewBalloon::handleXYLock() {
|
||||
void DrawViewBalloon::handleXYLock()
|
||||
{
|
||||
bool on = isLocked();
|
||||
if (!OriginX.testStatus(App::Property::ReadOnly)) {
|
||||
OriginX.setStatus(App::Property::ReadOnly, on);
|
||||
@@ -204,14 +201,14 @@ void DrawViewBalloon::handleXYLock() {
|
||||
}
|
||||
|
||||
|
||||
DrawViewPart* DrawViewBalloon::getViewPart() const
|
||||
DrawView* DrawViewBalloon::getParentView() const
|
||||
{
|
||||
App::DocumentObject* obj = SourceView.getValue();
|
||||
DrawViewPart* result = dynamic_cast<DrawViewPart*>(obj);
|
||||
DrawView* result = dynamic_cast<DrawView*>(obj);
|
||||
return result;
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DrawViewBalloon::execute()
|
||||
App::DocumentObjectExecReturn* DrawViewBalloon::execute()
|
||||
{
|
||||
requestPaint();
|
||||
return App::DocumentObject::execute();
|
||||
@@ -227,23 +224,25 @@ void DrawViewBalloon::setOrigin(Base::Vector3d newOrigin)
|
||||
|
||||
double DrawViewBalloon::prefKinkLength() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||
.GetUserParameter()
|
||||
.GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("Mod/TechDraw/Dimensions");
|
||||
return hGrp->GetFloat("BalloonKink", 5.0);
|
||||
}
|
||||
|
||||
int DrawViewBalloon::prefShape() const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||
.GetUserParameter()
|
||||
.GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("Mod/TechDraw/Decorations");
|
||||
return hGrp->GetInt("BalloonShape", 0);
|
||||
}
|
||||
|
||||
int DrawViewBalloon::prefEnd() const
|
||||
{
|
||||
return Preferences::balloonArrow();
|
||||
}
|
||||
int DrawViewBalloon::prefEnd() const { return Preferences::balloonArrow(); }
|
||||
|
||||
QPointF DrawViewBalloon::getOrigin()
|
||||
{
|
||||
@@ -268,7 +267,7 @@ Base::Vector3d DrawViewBalloon::getOriginOffset() const
|
||||
double oy = OriginY.getValue();
|
||||
Base::Vector3d org(ox, oy, 0.0);
|
||||
Base::Vector3d offset = pos - org;
|
||||
return offset;
|
||||
return offset;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -32,14 +32,16 @@
|
||||
|
||||
class TopoDS_Shape;
|
||||
|
||||
namespace Measure {
|
||||
namespace Measure
|
||||
{
|
||||
class Measurement;
|
||||
}
|
||||
namespace TechDraw {
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
class DrawViewPart;
|
||||
|
||||
class TechDrawExport DrawViewBalloon : public TechDraw::DrawView
|
||||
class TechDrawExport DrawViewBalloon: public TechDraw::DrawView
|
||||
{
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewBalloon);
|
||||
|
||||
@@ -48,31 +50,29 @@ public:
|
||||
DrawViewBalloon();
|
||||
~DrawViewBalloon() override;
|
||||
|
||||
App::PropertyLink SourceView;
|
||||
App::PropertyString Text;
|
||||
App::PropertyEnumeration EndType;
|
||||
App::PropertyEnumeration BubbleShape;
|
||||
App::PropertyLink SourceView;
|
||||
App::PropertyString Text;
|
||||
App::PropertyEnumeration EndType;
|
||||
App::PropertyEnumeration BubbleShape;
|
||||
App::PropertyFloatConstraint ShapeScale;
|
||||
App::PropertyFloatConstraint EndTypeScale;
|
||||
App::PropertyDistance OriginX;
|
||||
App::PropertyDistance OriginY;
|
||||
App::PropertyFloat TextWrapLen;
|
||||
App::PropertyDistance KinkLength;
|
||||
App::PropertyDistance OriginX;
|
||||
App::PropertyDistance OriginY;
|
||||
App::PropertyFloat TextWrapLen;
|
||||
App::PropertyDistance KinkLength;
|
||||
|
||||
short mustExecute() const override;
|
||||
|
||||
DrawViewPart* getViewPart() const;
|
||||
QPointF origin; //WF never used??
|
||||
DrawView* getParentView() const;
|
||||
QPointF origin;//WF never used??
|
||||
QPointF getOrigin();
|
||||
void setOrigin(QPointF p);
|
||||
|
||||
//virtual PyObject *getPyObject(void);
|
||||
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
App::DocumentObjectExecReturn* execute() override;
|
||||
|
||||
const char* getViewProviderName() const override {
|
||||
return "TechDrawGui::ViewProviderBalloon";
|
||||
}
|
||||
const char* getViewProviderName() const override { return "TechDrawGui::ViewProviderBalloon"; }
|
||||
|
||||
static const char* balloonTypeEnums[];
|
||||
|
||||
@@ -87,17 +87,14 @@ public:
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop) override;
|
||||
void handleChangedPropertyType(Base::XMLReader &reader,
|
||||
const char *TypeName,
|
||||
App::Property * prop) override;
|
||||
void handleChangedPropertyName(Base::XMLReader &reader,
|
||||
const char * TypeName,
|
||||
const char *PropName) override;
|
||||
void handleChangedPropertyType(Base::XMLReader& reader, const char* TypeName,
|
||||
App::Property* prop) override;
|
||||
void handleChangedPropertyName(Base::XMLReader& reader, const char* TypeName,
|
||||
const char* PropName) override;
|
||||
|
||||
private:
|
||||
static App::PropertyFloatConstraint::Constraints SymbolScaleRange;
|
||||
|
||||
};
|
||||
|
||||
} //namespace TechDraw
|
||||
}//namespace TechDraw
|
||||
#endif
|
||||
|
||||
@@ -982,7 +982,7 @@ bool _checkDrawViewPartBalloon(Gui::Command* cmd)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _checkDirectPlacement(const QGIViewPart* viewPart, const std::vector<std::string>& subNames,
|
||||
bool _checkDirectPlacement(const QGIView* view, const std::vector<std::string>& subNames,
|
||||
QPointF& placement)
|
||||
{
|
||||
// Let's see, if we can help speed up the placement of the balloon:
|
||||
@@ -997,6 +997,12 @@ bool _checkDirectPlacement(const QGIViewPart* viewPart, const std::vector<std::s
|
||||
return false;
|
||||
}
|
||||
|
||||
const QGIViewPart* viewPart = dynamic_cast<const QGIViewPart*>(view);
|
||||
if (!viewPart) {
|
||||
//not a view of a part, so no geometry to attach to
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string geoType = TechDraw::DrawUtil::getGeomTypeFromName(subNames[0]);
|
||||
if (geoType == "Vertex") {
|
||||
int index = TechDraw::DrawUtil::getIndexFromName(subNames[0]);
|
||||
@@ -1040,13 +1046,13 @@ void CmdTechDrawBalloon::activated(int iMsg)
|
||||
bool result = _checkSelectionBalloon(this, 1);
|
||||
if (!result)
|
||||
return;
|
||||
result = _checkDrawViewPartBalloon(this);
|
||||
if (!result)
|
||||
return;
|
||||
// result = _checkDrawViewPartBalloon(this);
|
||||
// if (!result)
|
||||
// return;
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
|
||||
auto objFeat(dynamic_cast<TechDraw::DrawViewPart*>(selection[0].getObject()));
|
||||
auto objFeat(dynamic_cast<TechDraw::DrawView*>(selection[0].getObject()));
|
||||
if (!objFeat) {
|
||||
return;
|
||||
}
|
||||
@@ -1054,23 +1060,21 @@ void CmdTechDrawBalloon::activated(int iMsg)
|
||||
TechDraw::DrawPage* page = objFeat->findParentPage();
|
||||
std::string PageName = page->getNameInDocument();
|
||||
|
||||
page->balloonParent = objFeat;
|
||||
|
||||
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(page->getDocument());
|
||||
ViewProviderPage* pageVP = dynamic_cast<ViewProviderPage*>(guiDoc->getViewProvider(page));
|
||||
ViewProviderViewPart* partVP =
|
||||
dynamic_cast<ViewProviderViewPart*>(guiDoc->getViewProvider(objFeat));
|
||||
ViewProviderDrawingView* viewVP =
|
||||
dynamic_cast<ViewProviderDrawingView*>(guiDoc->getViewProvider(objFeat));
|
||||
|
||||
if (pageVP && partVP) {
|
||||
if (pageVP && viewVP) {
|
||||
QGVPage* viewPage = pageVP->getQGVPage();
|
||||
QGSPage* scenePage = pageVP->getQGSPage();
|
||||
if (viewPage) {
|
||||
viewPage->startBalloonPlacing();
|
||||
viewPage->startBalloonPlacing(objFeat);
|
||||
|
||||
QGIViewPart* viewPart = dynamic_cast<QGIViewPart*>(partVP->getQView());
|
||||
QGIView* view = dynamic_cast<QGIView*>(viewVP->getQView());
|
||||
QPointF placement;
|
||||
if (viewPart
|
||||
&& _checkDirectPlacement(viewPart, selection[0].getSubNames(), placement)) {
|
||||
if (view && _checkDirectPlacement(view, selection[0].getSubNames(), placement)) {
|
||||
//this creates the balloon if something is already selected
|
||||
scenePage->createBalloon(placement, objFeat);
|
||||
}
|
||||
}
|
||||
@@ -1080,7 +1084,7 @@ void CmdTechDrawBalloon::activated(int iMsg)
|
||||
bool CmdTechDrawBalloon::isActive()
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,18 +23,18 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <cmath>
|
||||
# include <regex>
|
||||
# include <sstream>
|
||||
# include <string>
|
||||
#include <cmath>
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
# include <QDialog>
|
||||
# include <QDialogButtonBox>
|
||||
# include <QGraphicsScene>
|
||||
# include <QGraphicsItem>
|
||||
# include <QGraphicsTextItem>
|
||||
# include <QString>
|
||||
# include <QVBoxLayout>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QString>
|
||||
#include <QVBoxLayout>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
@@ -45,11 +45,10 @@
|
||||
#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "DlgStringListEditor.h"
|
||||
#include "QGIViewAnnotation.h"
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIViewAnnotation.h"
|
||||
#include "Rez.h"
|
||||
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewAnnotation::QGIViewAnnotation()
|
||||
@@ -66,27 +65,23 @@ QGIViewAnnotation::QGIViewAnnotation()
|
||||
//QObject::connect(QGraphicsTextItem::document(), SIGNAL(contentsChanged()), m_textItem, SLOT(updateText())); //not tested
|
||||
addToGroup(m_textItem);
|
||||
m_textItem->setPos(0., 0.);
|
||||
|
||||
}
|
||||
|
||||
void QGIViewAnnotation::setViewAnnoFeature(TechDraw::DrawViewAnnotation *obj)
|
||||
void QGIViewAnnotation::setViewAnnoFeature(TechDraw::DrawViewAnnotation* obj)
|
||||
{
|
||||
// called from QGVPage. (once)
|
||||
setViewFeature(static_cast<TechDraw::DrawView *>(obj));
|
||||
setViewFeature(static_cast<TechDraw::DrawView*>(obj));
|
||||
}
|
||||
|
||||
void QGIViewAnnotation::updateView(bool update)
|
||||
{
|
||||
auto viewAnno( dynamic_cast<TechDraw::DrawViewAnnotation *>(getViewObject()) );
|
||||
if (!viewAnno)
|
||||
auto viewAnno(dynamic_cast<TechDraw::DrawViewAnnotation*>(getViewObject()));
|
||||
if (!viewAnno) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (update ||
|
||||
viewAnno->isTouched() ||
|
||||
viewAnno->Text.isTouched() ||
|
||||
viewAnno->Font.isTouched() ||
|
||||
viewAnno->TextColor.isTouched() ||
|
||||
viewAnno->TextSize.isTouched() ) {
|
||||
if (update || viewAnno->isTouched() || viewAnno->Text.isTouched() || viewAnno->Font.isTouched()
|
||||
|| viewAnno->TextColor.isTouched() || viewAnno->TextSize.isTouched()) {
|
||||
|
||||
draw();
|
||||
}
|
||||
@@ -96,6 +91,7 @@ void QGIViewAnnotation::updateView(bool update)
|
||||
|
||||
void QGIViewAnnotation::draw()
|
||||
{
|
||||
// Base::Console().Message("QGIVA::draw()\n");
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
@@ -103,14 +99,14 @@ void QGIViewAnnotation::draw()
|
||||
drawAnnotation();
|
||||
QGIView::draw();
|
||||
rotateView();
|
||||
|
||||
}
|
||||
|
||||
//TODO: text is positioned slightly high (and left??) on page save to SVG file
|
||||
|
||||
void QGIViewAnnotation::drawAnnotation()
|
||||
{
|
||||
auto viewAnno( dynamic_cast<TechDraw::DrawViewAnnotation *>(getViewObject()) );
|
||||
// Base::Console().Message("QGIVA::drawAnnotation()\n");
|
||||
auto viewAnno(dynamic_cast<TechDraw::DrawViewAnnotation*>(getViewObject()));
|
||||
if (!viewAnno) {
|
||||
return;
|
||||
}
|
||||
@@ -141,13 +137,14 @@ void QGIViewAnnotation::drawAnnotation()
|
||||
c = TechDraw::Preferences::getAccessibleColor(c);
|
||||
ss << "color:" << c.asHexString() << "; ";
|
||||
ss << "}\n</style>\n</head>\n<body>\n<p>";
|
||||
for(std::vector<std::string>::const_iterator it = annoText.begin(); it != annoText.end(); it++) {
|
||||
for (std::vector<std::string>::const_iterator it = annoText.begin(); it != annoText.end();
|
||||
it++) {
|
||||
if (it != annoText.begin()) {
|
||||
ss << "<br>";
|
||||
}
|
||||
|
||||
//"less than" symbol chops off line. need to use html sub.
|
||||
std::string lt = std::regex_replace((*it), std::regex("<"), "<");
|
||||
std::string lt = std::regex_replace((*it), std::regex("<"), "<");
|
||||
ss << lt;
|
||||
}
|
||||
ss << "</p>\n</body>\n</html> ";
|
||||
@@ -171,12 +168,13 @@ void QGIViewAnnotation::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
TechDraw::DrawViewAnnotation *annotation = dynamic_cast<TechDraw::DrawViewAnnotation *>(getViewObject());
|
||||
TechDraw::DrawViewAnnotation* annotation =
|
||||
dynamic_cast<TechDraw::DrawViewAnnotation*>(getViewObject());
|
||||
if (!annotation) {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::vector<std::string> &values = annotation->Text.getValues();
|
||||
const std::vector<std::string>& values = annotation->Text.getValues();
|
||||
DlgStringListEditor dlg(values, Gui::getMainWindow());
|
||||
dlg.setWindowTitle(QString::fromUtf8("Annotation Text Editor"));
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
|
||||
@@ -176,10 +176,7 @@ void QGIBalloonLabel::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
|
||||
QGraphicsItem::hoverLeaveEvent(event);
|
||||
}
|
||||
|
||||
QRectF QGIBalloonLabel::boundingRect() const
|
||||
{
|
||||
return childrenBoundingRect();
|
||||
}
|
||||
QRectF QGIBalloonLabel::boundingRect() const { return childrenBoundingRect(); }
|
||||
|
||||
void QGIBalloonLabel::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||
QWidget* widget)
|
||||
@@ -206,10 +203,7 @@ void QGIBalloonLabel::setLabelCenter()
|
||||
posY = y() + m_labelText->boundingRect().height() / 2.;
|
||||
}
|
||||
|
||||
void QGIBalloonLabel::setFont(QFont font)
|
||||
{
|
||||
m_labelText->setFont(font);
|
||||
}
|
||||
void QGIBalloonLabel::setFont(QFont font) { m_labelText->setFont(font); }
|
||||
|
||||
void QGIBalloonLabel::setDimString(QString text)
|
||||
{
|
||||
@@ -224,20 +218,11 @@ void QGIBalloonLabel::setDimString(QString text, qreal maxWidth)
|
||||
m_labelText->setTextWidth(maxWidth);
|
||||
}
|
||||
|
||||
void QGIBalloonLabel::setPrettySel()
|
||||
{
|
||||
m_labelText->setPrettySel();
|
||||
}
|
||||
void QGIBalloonLabel::setPrettySel() { m_labelText->setPrettySel(); }
|
||||
|
||||
void QGIBalloonLabel::setPrettyPre()
|
||||
{
|
||||
m_labelText->setPrettyPre();
|
||||
}
|
||||
void QGIBalloonLabel::setPrettyPre() { m_labelText->setPrettyPre(); }
|
||||
|
||||
void QGIBalloonLabel::setPrettyNormal()
|
||||
{
|
||||
m_labelText->setPrettyNormal();
|
||||
}
|
||||
void QGIBalloonLabel::setPrettyNormal() { m_labelText->setPrettyNormal(); }
|
||||
|
||||
void QGIBalloonLabel::setColor(QColor color)
|
||||
{
|
||||
@@ -247,11 +232,7 @@ void QGIBalloonLabel::setColor(QColor color)
|
||||
|
||||
//**************************************************************
|
||||
QGIViewBalloon::QGIViewBalloon()
|
||||
: dvBalloon(nullptr),
|
||||
hasHover(false),
|
||||
m_lineWidth(0.0),
|
||||
m_obtuse(false),
|
||||
parent(nullptr),
|
||||
: dvBalloon(nullptr), hasHover(false), m_lineWidth(0.0), m_obtuse(false), parent(nullptr),
|
||||
m_dragInProgress(false)
|
||||
{
|
||||
m_ctrl = false;
|
||||
@@ -417,7 +398,7 @@ void QGIViewBalloon::updateBalloon(bool obtuse)
|
||||
if (!vp) {
|
||||
return;
|
||||
}
|
||||
const TechDraw::DrawViewPart* refObj = balloon->getViewPart();
|
||||
const TechDraw::DrawView* refObj = balloon->getParentView();
|
||||
if (!refObj) {
|
||||
return;
|
||||
}
|
||||
@@ -496,23 +477,19 @@ void QGIViewBalloon::balloonLabelDragFinished()
|
||||
//set feature position (x, y) from graphic position
|
||||
double x = Rez::appX(balloonLabel->X() / scale), y = Rez::appX(balloonLabel->Y() / scale);
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Drag Balloon"));
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc, "App.ActiveDocument.%s.X = %f", dvb->getNameInDocument(), x);
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc, "App.ActiveDocument.%s.Y = %f", dvb->getNameInDocument(), -y);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.X = %f",
|
||||
dvb->getNameInDocument(), x);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Y = %f",
|
||||
dvb->getNameInDocument(), -y);
|
||||
|
||||
// for the case that origin was also dragged, calc new origin and update feature
|
||||
if (m_originDragged) {
|
||||
Base::Vector3d pos(x, -y, 0.0);
|
||||
Base::Vector3d newOrg = pos - m_saveOffset;
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.OriginX = %f",
|
||||
dvb->getNameInDocument(),
|
||||
newOrg.x);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.OriginY = %f",
|
||||
dvb->getNameInDocument(),
|
||||
newOrg.y);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.OriginX = %f",
|
||||
dvb->getNameInDocument(), newOrg.x);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.OriginY = %f",
|
||||
dvb->getNameInDocument(), newOrg.y);
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
@@ -584,13 +561,14 @@ void QGIViewBalloon::placeBalloon(QPointF pos)
|
||||
|
||||
void QGIViewBalloon::draw()
|
||||
{
|
||||
// Base::Console().Message("QGIVB::draw()\n");
|
||||
// just redirect
|
||||
drawBalloon(false);
|
||||
}
|
||||
|
||||
void QGIViewBalloon::drawBalloon(bool dragged)
|
||||
{
|
||||
// Base::Console().Message("QGIVB::draw()\n");
|
||||
// Base::Console().Message("QGIVB::drawBalloon(%d)\n", dragged);
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
@@ -606,15 +584,15 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
||||
balloonLabel->show();
|
||||
show();
|
||||
|
||||
const TechDraw::DrawViewPart* refObj = balloon->getViewPart();
|
||||
const TechDraw::DrawView* refObj = balloon->getParentView();
|
||||
if (!refObj) {
|
||||
return;
|
||||
}
|
||||
if (!refObj->hasGeometry()) {// nothing to draw yet (restoring)
|
||||
balloonLabel->hide();
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
// if (!refObj->hasGeometry()) {// nothing to draw yet (restoring)
|
||||
// balloonLabel->hide();
|
||||
// hide();
|
||||
// return;
|
||||
// }
|
||||
|
||||
auto vp = static_cast<ViewProviderBalloon*>(getViewProvider(getViewObject()));
|
||||
if (!vp) {
|
||||
@@ -672,10 +650,8 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
||||
double balloonRadius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
|
||||
balloonRadius = balloonRadius * scale;
|
||||
balloonPath.moveTo(lblCenter.x, lblCenter.y);
|
||||
balloonPath.addEllipse(lblCenter.x - balloonRadius,
|
||||
lblCenter.y - balloonRadius,
|
||||
balloonRadius * 2,
|
||||
balloonRadius * 2);
|
||||
balloonPath.addEllipse(lblCenter.x - balloonRadius, lblCenter.y - balloonRadius,
|
||||
balloonRadius * 2, balloonRadius * 2);
|
||||
offsetLR = balloonRadius;
|
||||
}
|
||||
else if (strcmp(balloonType, "None") == 0) {
|
||||
@@ -695,10 +671,8 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
||||
}
|
||||
}
|
||||
textWidth = (textWidth * scale) + Rez::guiX(2.0);
|
||||
balloonPath.addRect(lblCenter.x - (textWidth / 2.0),
|
||||
lblCenter.y - (textHeight / 2.0),
|
||||
textWidth,
|
||||
textHeight);
|
||||
balloonPath.addRect(lblCenter.x - (textWidth / 2.0), lblCenter.y - (textHeight / 2.0),
|
||||
textWidth, textHeight);
|
||||
offsetLR = (textWidth / 2.0);
|
||||
}
|
||||
else if (strcmp(balloonType, "Triangle") == 0) {
|
||||
@@ -725,19 +699,11 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
||||
QPointF textBoxCorner(lblCenter.x - (textWidth / 2.0), lblCenter.y - (textHeight / 2.0));
|
||||
balloonPath.moveTo(textBoxCorner);
|
||||
balloonPath.lineTo(textBoxCorner.x() + textWidth, textBoxCorner.y());
|
||||
balloonPath.arcTo(textBoxCorner.x() + textWidth - (textHeight / 2.0),
|
||||
textBoxCorner.y(),
|
||||
textHeight,
|
||||
textHeight,
|
||||
90,
|
||||
-180);
|
||||
balloonPath.arcTo(textBoxCorner.x() + textWidth - (textHeight / 2.0), textBoxCorner.y(),
|
||||
textHeight, textHeight, 90, -180);
|
||||
balloonPath.lineTo(textBoxCorner.x(), textBoxCorner.y() + textHeight);
|
||||
balloonPath.arcTo(textBoxCorner.x() - (textHeight / 2),
|
||||
textBoxCorner.y(),
|
||||
textHeight,
|
||||
textHeight,
|
||||
-90,
|
||||
-180);
|
||||
balloonPath.arcTo(textBoxCorner.x() - (textHeight / 2), textBoxCorner.y(), textHeight,
|
||||
textHeight, -90, -180);
|
||||
offsetLR = (textWidth / 2.0) + (textHeight / 2.0);
|
||||
}
|
||||
else if (strcmp(balloonType, "Square") == 0) {
|
||||
@@ -970,10 +936,7 @@ QColor QGIViewBalloon::prefNormalColor()
|
||||
return getNormalColor();
|
||||
}
|
||||
|
||||
int QGIViewBalloon::prefDefaultArrow() const
|
||||
{
|
||||
return Preferences::balloonArrow();
|
||||
}
|
||||
int QGIViewBalloon::prefDefaultArrow() const { return Preferences::balloonArrow(); }
|
||||
|
||||
|
||||
//should this be an object property or global preference?
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,11 +31,13 @@
|
||||
class QTemporaryFile;
|
||||
class QLabel;
|
||||
|
||||
namespace App {
|
||||
namespace App
|
||||
{
|
||||
class DocumentObject;
|
||||
}
|
||||
|
||||
namespace TechDraw {
|
||||
namespace TechDraw
|
||||
{
|
||||
class DrawView;
|
||||
class DrawViewPart;
|
||||
class DrawViewSection;
|
||||
@@ -54,7 +56,7 @@ class DrawLeaderLine;
|
||||
class DrawViewBalloon;
|
||||
class DrawRichAnno;
|
||||
class DrawWeldSymbol;
|
||||
}
|
||||
}// namespace TechDraw
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -67,31 +69,31 @@ class QGILeaderLine;
|
||||
class QGIRichAnno;
|
||||
class QGITile;
|
||||
|
||||
class TechDrawGuiExport QGSPage : public QGraphicsScene
|
||||
class TechDrawGuiExport QGSPage: public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QGSPage(ViewProviderPage *vpPage, QWidget *parent = nullptr);
|
||||
explicit QGSPage(ViewProviderPage* vpPage, QWidget* parent = nullptr);
|
||||
~QGSPage() = default;
|
||||
|
||||
bool addView(const App::DocumentObject *obj);
|
||||
bool attachView(App::DocumentObject *obj);
|
||||
QGIView * addViewDimension(TechDraw::DrawViewDimension *dimFeat);
|
||||
QGIView * addViewBalloon(TechDraw::DrawViewBalloon *balloonFeat);
|
||||
QGIView * addProjectionGroup(TechDraw::DrawProjGroup *projGroupFeat);
|
||||
QGIView * addViewPart(TechDraw::DrawViewPart *partFeat);
|
||||
QGIView * addViewSection(TechDraw::DrawViewSection *sectionFeat);
|
||||
QGIView * addDrawView(TechDraw::DrawView *viewFeat);
|
||||
QGIView * addDrawViewCollection(TechDraw::DrawViewCollection *collectionFeat);
|
||||
QGIView * addDrawViewAnnotation(TechDraw::DrawViewAnnotation *annoFeat);
|
||||
QGIView * addDrawViewSymbol(TechDraw::DrawViewSymbol *symbolFeat);
|
||||
QGIView * addDrawViewClip(TechDraw::DrawViewClip *clipFeat);
|
||||
QGIView * addDrawViewSpreadsheet(TechDraw::DrawViewSpreadsheet *sheetFeat);
|
||||
QGIView * addDrawViewImage(TechDraw::DrawViewImage *imageFeat);
|
||||
QGIView * addViewLeader(TechDraw::DrawLeaderLine* leaderFeat);
|
||||
QGIView * addRichAnno(TechDraw::DrawRichAnno* richFeat);
|
||||
QGIView * addWeldSymbol(TechDraw::DrawWeldSymbol* weldFeat);
|
||||
bool addView(const App::DocumentObject* obj);
|
||||
bool attachView(App::DocumentObject* obj);
|
||||
QGIView* addViewDimension(TechDraw::DrawViewDimension* dimFeat);
|
||||
QGIView* addViewBalloon(TechDraw::DrawViewBalloon* balloonFeat);
|
||||
QGIView* addProjectionGroup(TechDraw::DrawProjGroup* projGroupFeat);
|
||||
QGIView* addViewPart(TechDraw::DrawViewPart* partFeat);
|
||||
QGIView* addViewSection(TechDraw::DrawViewSection* sectionFeat);
|
||||
QGIView* addDrawView(TechDraw::DrawView* viewFeat);
|
||||
QGIView* addDrawViewCollection(TechDraw::DrawViewCollection* collectionFeat);
|
||||
QGIView* addDrawViewAnnotation(TechDraw::DrawViewAnnotation* annoFeat);
|
||||
QGIView* addDrawViewSymbol(TechDraw::DrawViewSymbol* symbolFeat);
|
||||
QGIView* addDrawViewClip(TechDraw::DrawViewClip* clipFeat);
|
||||
QGIView* addDrawViewSpreadsheet(TechDraw::DrawViewSpreadsheet* sheetFeat);
|
||||
QGIView* addDrawViewImage(TechDraw::DrawViewImage* imageFeat);
|
||||
QGIView* addViewLeader(TechDraw::DrawLeaderLine* leaderFeat);
|
||||
QGIView* addRichAnno(TechDraw::DrawRichAnno* richFeat);
|
||||
QGIView* addWeldSymbol(TechDraw::DrawWeldSymbol* weldFeat);
|
||||
|
||||
void addChildrenToPage();
|
||||
void fixOrphans(bool force = false);
|
||||
@@ -99,35 +101,36 @@ public:
|
||||
void redrawAllViews();
|
||||
void redraw1View(TechDraw::DrawView* dView);
|
||||
|
||||
QGIView* findQViewForDocObj(App::DocumentObject *obj) const;
|
||||
QGIView* findQViewForDocObj(App::DocumentObject* obj) const;
|
||||
QGIView* getQGIVByName(std::string name);
|
||||
QGIView* findParent(QGIView *) const;
|
||||
void findMissingViews( const std::vector<App::DocumentObject*> &list, std::vector<App::DocumentObject*> &missing);
|
||||
bool hasQView(App::DocumentObject *obj);
|
||||
QGIView* findParent(QGIView*) const;
|
||||
void findMissingViews(const std::vector<App::DocumentObject*>& list,
|
||||
std::vector<App::DocumentObject*>& missing);
|
||||
bool hasQView(App::DocumentObject* obj);
|
||||
|
||||
void addBalloonToParent(QGIViewBalloon* balloon, QGIView* parent);
|
||||
void createBalloon(QPointF origin, TechDraw::DrawViewPart *parent);
|
||||
void createBalloon(QPointF origin, TechDraw::DrawView* parent);
|
||||
|
||||
void addDimToParent(QGIViewDimension* dim, QGIView* parent);
|
||||
void addLeaderToParent(QGILeaderLine* lead, QGIView* parent);
|
||||
void addAnnoToParent(QGIRichAnno* anno, QGIView* parent);
|
||||
|
||||
std::vector<QGIView *> getViews() const;
|
||||
std::vector<QGIView*> getViews() const;
|
||||
|
||||
int addQView(QGIView * view);
|
||||
int removeQView(QGIView *view);
|
||||
int addQView(QGIView* view);
|
||||
int removeQView(QGIView* view);
|
||||
int removeQViewByName(const char* name);
|
||||
void removeQViewFromScene(QGIView *view);
|
||||
void removeQViewFromScene(QGIView* view);
|
||||
|
||||
void setPageTemplate(TechDraw::DrawTemplate *templateFeat);
|
||||
QGITemplate * getTemplate() const;
|
||||
void setPageTemplate(TechDraw::DrawTemplate* templateFeat);
|
||||
QGITemplate* getTemplate() const;
|
||||
void removeTemplate();
|
||||
void matchSceneRectToTemplate();
|
||||
void attachTemplate(TechDraw::DrawTemplate *obj);
|
||||
void attachTemplate(TechDraw::DrawTemplate* obj);
|
||||
void updateTemplate(bool force = false);
|
||||
QPointF getTemplateCenter();
|
||||
|
||||
TechDraw::DrawPage * getDrawPage();
|
||||
TechDraw::DrawPage* getDrawPage();
|
||||
|
||||
void setExporting(bool enable);
|
||||
virtual void refreshViews();
|
||||
@@ -143,13 +146,13 @@ public:
|
||||
|
||||
protected:
|
||||
QColor getBackgroundColor();
|
||||
bool orphanExists(const char *viewName, const std::vector<App::DocumentObject*> &list);
|
||||
bool orphanExists(const char* viewName, const std::vector<App::DocumentObject*>& list);
|
||||
|
||||
private:
|
||||
QGITemplate *pageTemplate;
|
||||
ViewProviderPage *m_vpPage;
|
||||
QGITemplate* pageTemplate;
|
||||
ViewProviderPage* m_vpPage;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
}// namespace TechDrawGui
|
||||
|
||||
#endif // TECHDRAWGUI_QGSCENE_H
|
||||
#endif// TECHDRAWGUI_QGSCENE_H
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QContextMenuEvent>
|
||||
# include <QKeyEvent>
|
||||
# include <QScrollBar>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QScrollBar>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
@@ -32,24 +32,19 @@
|
||||
#include <Base/Parameter.h>
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
|
||||
#include "QGVNavStyle.h"
|
||||
#include "QGSPage.h"
|
||||
#include "QGVNavStyle.h"
|
||||
#include "QGVPage.h"
|
||||
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
namespace TechDrawGui {
|
||||
|
||||
QGVNavStyle::QGVNavStyle(QGVPage *qgvp) :
|
||||
m_viewer(qgvp)
|
||||
namespace TechDrawGui
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
QGVNavStyle::~QGVNavStyle()
|
||||
{
|
||||
}
|
||||
QGVNavStyle::QGVNavStyle(QGVPage* qgvp) : m_viewer(qgvp) { initialize(); }
|
||||
|
||||
QGVNavStyle::~QGVNavStyle() {}
|
||||
|
||||
void QGVNavStyle::initialize()
|
||||
{
|
||||
@@ -59,15 +54,21 @@ void QGVNavStyle::initialize()
|
||||
this->ctrldown = false;
|
||||
this->shiftdown = false;
|
||||
this->altdown = false;
|
||||
this->invertZoom = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View")->GetBool("InvertZoom", true);
|
||||
this->zoomAtCursor = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View")->GetBool("ZoomAtCursor", true);
|
||||
this->zoomStep = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View")->GetFloat("ZoomStep", 0.2f);
|
||||
this->invertZoom = App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetBool("InvertZoom", true);
|
||||
this->zoomAtCursor = App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetBool("ZoomAtCursor", true);
|
||||
this->zoomStep = App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetFloat("ZoomStep", 0.2f);
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||
.GetUserParameter()
|
||||
.GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("Mod/TechDraw/General");
|
||||
m_reversePan = hGrp->GetInt("KbPan", 1);
|
||||
m_reverseScroll = hGrp->GetInt("KbScroll", 1);
|
||||
|
||||
@@ -88,14 +89,15 @@ void QGVNavStyle::setAnchor()
|
||||
if (zoomAtCursor) {
|
||||
m_viewer->setResizeAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
m_viewer->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_viewer->setResizeAnchor(QGraphicsView::AnchorViewCenter);
|
||||
m_viewer->setTransformationAnchor(QGraphicsView::AnchorViewCenter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QGVNavStyle::handleEnterEvent(QEvent *event)
|
||||
void QGVNavStyle::handleEnterEvent(QEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (getViewer()->isBalloonPlacing()) {
|
||||
@@ -103,16 +105,16 @@ void QGVNavStyle::handleEnterEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QGVNavStyle::handleFocusOutEvent(QFocusEvent *event)
|
||||
void QGVNavStyle::handleFocusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
getViewer()->cancelBalloonPlacing();
|
||||
}
|
||||
|
||||
void QGVNavStyle::handleKeyPressEvent(QKeyEvent *event)
|
||||
void QGVNavStyle::handleKeyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if(event->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
switch(event->key()) {
|
||||
if (event->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Plus: {
|
||||
zoom(1.0 + zoomStep);
|
||||
event->accept();
|
||||
@@ -129,8 +131,8 @@ void QGVNavStyle::handleKeyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
if(event->modifiers().testFlag( Qt::NoModifier)) {
|
||||
switch(event->key()) {
|
||||
if (event->modifiers().testFlag(Qt::NoModifier)) {
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Left: {
|
||||
getViewer()->kbPanScroll(1, 0);
|
||||
event->accept();
|
||||
@@ -168,11 +170,11 @@ void QGVNavStyle::handleKeyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QGVNavStyle::handleKeyReleaseEvent(QKeyEvent *event)
|
||||
void QGVNavStyle::handleKeyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
// Q_UNUSED(event);
|
||||
if(event->modifiers().testFlag( Qt::NoModifier)) {
|
||||
switch(event->key()) {
|
||||
// Q_UNUSED(event);
|
||||
if (event->modifiers().testFlag(Qt::NoModifier)) {
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Shift: {
|
||||
this->shiftdown = false;
|
||||
event->accept();
|
||||
@@ -185,14 +187,15 @@ void QGVNavStyle::handleKeyReleaseEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QGVNavStyle::handleLeaveEvent(QEvent *event)
|
||||
void QGVNavStyle::handleLeaveEvent(QEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (getViewer()->isBalloonPlacing()) {
|
||||
int left_x;
|
||||
if (getViewer()->getBalloonCursorPos().x() < 32)
|
||||
left_x = 0;
|
||||
else if (getViewer()->getBalloonCursorPos().x() > (getViewer()->contentsRect().right() - 32))
|
||||
else if (getViewer()->getBalloonCursorPos().x()
|
||||
> (getViewer()->contentsRect().right() - 32))
|
||||
left_x = getViewer()->contentsRect().right() - 32;
|
||||
else
|
||||
left_x = getViewer()->getBalloonCursorPos().x();
|
||||
@@ -200,29 +203,30 @@ void QGVNavStyle::handleLeaveEvent(QEvent *event)
|
||||
int left_y;
|
||||
if (getViewer()->getBalloonCursorPos().y() < 32)
|
||||
left_y = 0;
|
||||
else if (getViewer()->getBalloonCursorPos().y() > (getViewer()->contentsRect().bottom() - 32))
|
||||
else if (getViewer()->getBalloonCursorPos().y()
|
||||
> (getViewer()->contentsRect().bottom() - 32))
|
||||
left_y = getViewer()->contentsRect().bottom() - 32;
|
||||
else
|
||||
left_y = getViewer()->getBalloonCursorPos().y();
|
||||
|
||||
/* When cursor leave the page, display getViewer()->balloonCursor where it left */
|
||||
getViewer()->getBalloonCursor()->setGeometry(left_x ,left_y, 32, 32);
|
||||
getViewer()->getBalloonCursor()->setGeometry(left_x, left_y, 32, 32);
|
||||
getViewer()->getBalloonCursor()->show();
|
||||
}
|
||||
}
|
||||
|
||||
void QGVNavStyle::handleMousePressEvent(QMouseEvent *event)
|
||||
void QGVNavStyle::handleMousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
// Base::Console().Message("QGVNS::handleMousePressEvent()\n");
|
||||
// Base::Console().Message("QGVNS::handleMousePressEvent()\n");
|
||||
if (!panningActive && (event->button() == Qt::MiddleButton)) {
|
||||
startPan(event->pos());
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void QGVNavStyle::handleMouseMoveEvent(QMouseEvent *event)
|
||||
void QGVNavStyle::handleMouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
// Base::Console().Message("QGVNS::handleMouseMoveEvent()\n");
|
||||
// Base::Console().Message("QGVNS::handleMouseMoveEvent()\n");
|
||||
if (getViewer()->isBalloonPlacing()) {
|
||||
getViewer()->setBalloonCursorPos(event->pos());
|
||||
}
|
||||
@@ -235,9 +239,9 @@ void QGVNavStyle::handleMouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
//NOTE: QGraphicsView::contextMenuEvent consumes the mouse release event for the
|
||||
//button that caused the event (typically RMB)
|
||||
void QGVNavStyle::handleMouseReleaseEvent(QMouseEvent *event)
|
||||
void QGVNavStyle::handleMouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
// Base::Console().Message("QGVNS::handleMouseReleaseEvent()\n");
|
||||
// Base::Console().Message("QGVNS::handleMouseReleaseEvent()\n");
|
||||
if (getViewer()->isBalloonPlacing()) {
|
||||
placeBalloon(event->pos());
|
||||
}
|
||||
@@ -248,30 +252,27 @@ void QGVNavStyle::handleMouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
bool QGVNavStyle::allowContextMenu(QContextMenuEvent *event)
|
||||
bool QGVNavStyle::allowContextMenu(QContextMenuEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
// Base::Console().Message("QGVNS::allowContextMenu()\n");
|
||||
// if (event->reason() == QContextMenuEvent::Mouse) {
|
||||
// //must check for a button combination involving context menu button
|
||||
// }
|
||||
// Base::Console().Message("QGVNS::allowContextMenu()\n");
|
||||
// if (event->reason() == QContextMenuEvent::Mouse) {
|
||||
// //must check for a button combination involving context menu button
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
void QGVNavStyle::pseudoContextEvent()
|
||||
{
|
||||
getViewer()->pseudoContextEvent();
|
||||
}
|
||||
void QGVNavStyle::pseudoContextEvent() { getViewer()->pseudoContextEvent(); }
|
||||
|
||||
void QGVNavStyle::handleWheelEvent(QWheelEvent *event)
|
||||
void QGVNavStyle::handleWheelEvent(QWheelEvent* event)
|
||||
{
|
||||
//gets called once for every click of the wheel. the sign of event->angleDelta().y()
|
||||
//gives the direction of wheel rotation. positive indicates rotation forwards away
|
||||
//from the user; negative backwards toward the user. the magnitude of
|
||||
//event->angleDelta().y() is 120 for most mice which represents 120/8 = 15 degrees of
|
||||
//rotation. Some high resolution mice/trackpads report smaller values - ie a click is less than
|
||||
//15 degrees of wheel rotation.
|
||||
//https://doc.qt.io/qt-5/qwheelevent.html#angleDelta
|
||||
//gets called once for every click of the wheel. the sign of event->angleDelta().y()
|
||||
//gives the direction of wheel rotation. positive indicates rotation forwards away
|
||||
//from the user; negative backwards toward the user. the magnitude of
|
||||
//event->angleDelta().y() is 120 for most mice which represents 120/8 = 15 degrees of
|
||||
//rotation. Some high resolution mice/trackpads report smaller values - ie a click is less than
|
||||
//15 degrees of wheel rotation.
|
||||
//https://doc.qt.io/qt-5/qwheelevent.html#angleDelta
|
||||
//to avoid overly sensitive behaviour in high resolution mice/touchpads,
|
||||
//save up wheel clicks until the wheel has rotated at least 15 degrees.
|
||||
constexpr int wheelDeltaThreshold = 120;
|
||||
@@ -281,7 +282,7 @@ void QGVNavStyle::handleWheelEvent(QWheelEvent *event)
|
||||
}
|
||||
m_wheelDeltaCounter = 0;
|
||||
//starting with -ve direction keeps us in sync with the behaviour of the 3d window
|
||||
int rotationDirection = - event->angleDelta().y() / std::abs(event->angleDelta().y());
|
||||
int rotationDirection = -event->angleDelta().y() / std::abs(event->angleDelta().y());
|
||||
if (invertZoom) {
|
||||
rotationDirection = -rotationDirection;
|
||||
}
|
||||
@@ -294,21 +295,19 @@ void QGVNavStyle::zoom(double factor)
|
||||
constexpr double minimumScale(0.01);
|
||||
QTransform transform = getViewer()->transform();
|
||||
double xScale = transform.m11();
|
||||
if (xScale <= minimumScale &&
|
||||
factor < 1.0) {
|
||||
if (xScale <= minimumScale && factor < 1.0) {
|
||||
//don't scale any smaller than this
|
||||
return;
|
||||
}
|
||||
|
||||
setAnchor();
|
||||
getViewer()->scale(factor,
|
||||
factor);
|
||||
getViewer()->scale(factor, factor);
|
||||
m_zoomPending = false;
|
||||
}
|
||||
|
||||
void QGVNavStyle::startZoom(QPoint p)
|
||||
{
|
||||
// Base::Console().Message("QGVNS::startZoom(%s)\n", TechDraw::DrawUtil::formatVector(p).c_str());
|
||||
// Base::Console().Message("QGVNS::startZoom(%s)\n", TechDraw::DrawUtil::formatVector(p).c_str());
|
||||
zoomOrigin = p;
|
||||
zoomingActive = true;
|
||||
m_zoomPending = false;
|
||||
@@ -317,7 +316,7 @@ void QGVNavStyle::startZoom(QPoint p)
|
||||
|
||||
void QGVNavStyle::stopZoom()
|
||||
{
|
||||
// Base::Console().Message("QGVNS::stopZoom()\n");
|
||||
// Base::Console().Message("QGVNS::stopZoom()\n");
|
||||
zoomingActive = false;
|
||||
m_zoomPending = false;
|
||||
getViewer()->resetCursor();
|
||||
@@ -352,19 +351,19 @@ void QGVNavStyle::startPan(QPoint p)
|
||||
|
||||
void QGVNavStyle::pan(QPoint p)
|
||||
{
|
||||
QScrollBar *horizontalScrollbar = getViewer()->horizontalScrollBar();
|
||||
QScrollBar *verticalScrollbar = getViewer()->verticalScrollBar();
|
||||
QScrollBar* horizontalScrollbar = getViewer()->horizontalScrollBar();
|
||||
QScrollBar* verticalScrollbar = getViewer()->verticalScrollBar();
|
||||
QPoint direction = p - panOrigin;
|
||||
|
||||
horizontalScrollbar->setValue(horizontalScrollbar->value() - m_reversePan*direction.x());
|
||||
verticalScrollbar->setValue(verticalScrollbar->value() - m_reverseScroll*direction.y());
|
||||
horizontalScrollbar->setValue(horizontalScrollbar->value() - m_reversePan * direction.x());
|
||||
verticalScrollbar->setValue(verticalScrollbar->value() - m_reverseScroll * direction.y());
|
||||
|
||||
panOrigin = p;
|
||||
}
|
||||
|
||||
void QGVNavStyle::stopPan()
|
||||
{
|
||||
// Base::Console().Message("QGVNS::stopPan()\n");
|
||||
// Base::Console().Message("QGVNS::stopPan()\n");
|
||||
panningActive = false;
|
||||
m_panPending = false;
|
||||
getViewer()->resetCursor();
|
||||
@@ -384,27 +383,25 @@ void QGVNavStyle::stopClick()
|
||||
|
||||
void QGVNavStyle::placeBalloon(QPoint p)
|
||||
{
|
||||
// Base::Console().Message("QGVNS::placeBalloon()\n");
|
||||
getViewer()->getBalloonCursor()->hide();
|
||||
//balloon was created in Command.cpp. Why are we doing it again?
|
||||
getViewer()->getScene()->createBalloon(getViewer()->mapToScene(p),
|
||||
getViewer()->getDrawPage()->balloonParent);
|
||||
getViewer()->getBalloonParent());
|
||||
getViewer()->setBalloonPlacing(false);
|
||||
}
|
||||
|
||||
//****************************************
|
||||
KeyCombination::KeyCombination()
|
||||
{
|
||||
}
|
||||
KeyCombination::KeyCombination() {}
|
||||
|
||||
KeyCombination::~KeyCombination()
|
||||
{
|
||||
}
|
||||
KeyCombination::~KeyCombination() {}
|
||||
|
||||
void KeyCombination::addKey(int inKey)
|
||||
{
|
||||
bool found = false;
|
||||
//check for inKey already in keys
|
||||
if (!keys.empty()) {
|
||||
for (auto& k: keys) {
|
||||
for (auto& k : keys) {
|
||||
if (k == inKey) {
|
||||
found = true;
|
||||
}
|
||||
@@ -418,7 +415,7 @@ void KeyCombination::addKey(int inKey)
|
||||
void KeyCombination::removeKey(int inKey)
|
||||
{
|
||||
std::vector<int> newKeys;
|
||||
for (auto& k: keys) {
|
||||
for (auto& k : keys) {
|
||||
if (k != inKey) {
|
||||
newKeys.push_back(k);
|
||||
}
|
||||
@@ -426,26 +423,20 @@ void KeyCombination::removeKey(int inKey)
|
||||
keys = newKeys;
|
||||
}
|
||||
|
||||
void KeyCombination::clear()
|
||||
{
|
||||
keys.clear();
|
||||
}
|
||||
void KeyCombination::clear() { keys.clear(); }
|
||||
|
||||
bool KeyCombination::empty()
|
||||
{
|
||||
return keys.empty();
|
||||
}
|
||||
bool KeyCombination::empty() { return keys.empty(); }
|
||||
|
||||
//does inCombo match the keys we have in current combination
|
||||
bool KeyCombination::haveCombination(int inCombo)
|
||||
{
|
||||
bool matched = false;
|
||||
int combo = 0; //no key
|
||||
int combo = 0;//no key
|
||||
if (keys.size() < 2) {
|
||||
//not enough keys for a combination
|
||||
return false;
|
||||
}
|
||||
for (auto& k: keys) {
|
||||
for (auto& k : keys) {
|
||||
combo = combo | k;
|
||||
}
|
||||
if (combo == inCombo) {
|
||||
@@ -454,4 +445,4 @@ bool KeyCombination::haveCombination(int inCombo)
|
||||
return matched;
|
||||
}
|
||||
|
||||
} //namespace TechDrawGui
|
||||
}//namespace TechDrawGui
|
||||
|
||||
@@ -22,18 +22,18 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <cmath>
|
||||
#include <cmath>
|
||||
|
||||
# include <QApplication>
|
||||
# include <QBitmap>
|
||||
# include <QContextMenuEvent>
|
||||
# include <QGLWidget>
|
||||
# include <QLabel>
|
||||
# include <QMouseEvent>
|
||||
# include <QPainter>
|
||||
# include <QPaintEvent>
|
||||
# include <QScrollBar>
|
||||
# include <QWheelEvent>
|
||||
#include <QApplication>
|
||||
#include <QBitmap>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QGLWidget>
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
#include <QScrollBar>
|
||||
#include <QWheelEvent>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
@@ -50,7 +50,6 @@
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
|
||||
|
||||
#include "QGVPage.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGSPage.h"
|
||||
@@ -64,6 +63,7 @@
|
||||
#include "QGVNavStyleRevit.h"
|
||||
#include "QGVNavStyleTinkerCAD.h"
|
||||
#include "QGVNavStyleTouchpad.h"
|
||||
#include "QGVPage.h"
|
||||
#include "Rez.h"
|
||||
#include "ViewProviderPage.h"
|
||||
|
||||
@@ -83,20 +83,13 @@
|
||||
#define PAN_HOT_X 7
|
||||
#define PAN_HOT_Y 7
|
||||
|
||||
static unsigned char pan_bitmap[PAN_BYTES] =
|
||||
{
|
||||
0xc0, 0x03, 0x60, 0x02, 0x20, 0x04, 0x10, 0x08,
|
||||
0x68, 0x16, 0x54, 0x2a, 0x73, 0xce, 0x01, 0x80,
|
||||
0x01, 0x80, 0x73, 0xce, 0x54, 0x2a, 0x68, 0x16,
|
||||
0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0xc0, 0x03
|
||||
};
|
||||
static unsigned char pan_bitmap[PAN_BYTES] = {
|
||||
0xc0, 0x03, 0x60, 0x02, 0x20, 0x04, 0x10, 0x08, 0x68, 0x16, 0x54, 0x2a, 0x73, 0xce, 0x01, 0x80,
|
||||
0x01, 0x80, 0x73, 0xce, 0x54, 0x2a, 0x68, 0x16, 0x10, 0x08, 0x20, 0x04, 0x40, 0x02, 0xc0, 0x03};
|
||||
|
||||
static unsigned char pan_mask_bitmap[PAN_BYTES] =
|
||||
{
|
||||
0xc0, 0x03, 0xe0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xe8, 0x17, 0xdc, 0x3b, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0x3b, 0xe8, 0x17, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03,
|
||||
0xc0, 0x03
|
||||
};
|
||||
static unsigned char pan_mask_bitmap[PAN_BYTES] = {
|
||||
0xc0, 0x03, 0xe0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xe8, 0x17, 0xdc, 0x3b, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xdc, 0x3b, 0xe8, 0x17, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0xc0, 0x03};
|
||||
/*** zoom-style cursor ******/
|
||||
|
||||
#define ZOOM_WIDTH 16
|
||||
@@ -105,83 +98,83 @@ static unsigned char pan_mask_bitmap[PAN_BYTES] =
|
||||
#define ZOOM_HOT_X 5
|
||||
#define ZOOM_HOT_Y 7
|
||||
|
||||
static unsigned char zoom_bitmap[ZOOM_BYTES] =
|
||||
{
|
||||
0x00, 0x0f, 0x80, 0x1c, 0x40, 0x38, 0x20, 0x70,
|
||||
0x90, 0xe4, 0xc0, 0xcc, 0xf0, 0xfc, 0x00, 0x0c,
|
||||
0x00, 0x0c, 0xf0, 0xfc, 0xc0, 0xcc, 0x90, 0xe4,
|
||||
0x20, 0x70, 0x40, 0x38, 0x80, 0x1c, 0x00, 0x0f
|
||||
};
|
||||
static unsigned char zoom_bitmap[ZOOM_BYTES] = {
|
||||
0x00, 0x0f, 0x80, 0x1c, 0x40, 0x38, 0x20, 0x70, 0x90, 0xe4, 0xc0, 0xcc, 0xf0, 0xfc, 0x00, 0x0c,
|
||||
0x00, 0x0c, 0xf0, 0xfc, 0xc0, 0xcc, 0x90, 0xe4, 0x20, 0x70, 0x40, 0x38, 0x80, 0x1c, 0x00, 0x0f};
|
||||
|
||||
static unsigned char zoom_mask_bitmap[ZOOM_BYTES] =
|
||||
{
|
||||
0x00, 0x0f, 0x80, 0x1f, 0xc0, 0x3f, 0xe0, 0x7f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0x00,
|
||||
0x0f, 0x00, 0x0f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0xe0, 0x7f, 0xc0, 0x3f, 0x80, 0x1f,
|
||||
0x00, 0x0f
|
||||
};
|
||||
static unsigned char zoom_mask_bitmap[ZOOM_BYTES] = {
|
||||
0x00, 0x0f, 0x80, 0x1f, 0xc0, 0x3f, 0xe0, 0x7f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0x00, 0x0f,
|
||||
0x00, 0x0f, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xff, 0xe0, 0x7f, 0xc0, 0x3f, 0x80, 0x1f, 0x00, 0x0f};
|
||||
using namespace Gui;
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
|
||||
class QGVPage::Private : public ParameterGrp::ObserverType {
|
||||
class QGVPage::Private: public ParameterGrp::ObserverType
|
||||
{
|
||||
public:
|
||||
/// handle to the viewer parameter group
|
||||
ParameterGrp::handle hGrp;
|
||||
QGVPage* page;
|
||||
explicit Private(QGVPage* page) : page(page) {
|
||||
explicit Private(QGVPage* page) : page(page)
|
||||
{
|
||||
// attach parameter Observer
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/View");
|
||||
hGrp->Attach(this);
|
||||
}
|
||||
void init() {
|
||||
void init()
|
||||
{
|
||||
page->m_atCursor = hGrp->GetBool("ZoomAtCursor", 1l);
|
||||
page->m_invertZoom = hGrp->GetBool("InvertZoom", 0l);
|
||||
page->m_zoomIncrement = hGrp->GetFloat("ZoomStep", 0.02);
|
||||
|
||||
auto hTDPref = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
auto hTDPref = App::GetApplication()
|
||||
.GetUserParameter()
|
||||
.GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("Mod/TechDraw/General");
|
||||
page->m_reversePan = hTDPref->GetInt("KbPan", 1);
|
||||
page->m_reverseScroll = hTDPref->GetInt("KbScroll", 1);
|
||||
}
|
||||
/// Observer message from the ParameterGrp
|
||||
void OnChange(ParameterGrp::SubjectType &rCaller, ParameterGrp::MessageType Reason) override {
|
||||
void OnChange(ParameterGrp::SubjectType& rCaller, ParameterGrp::MessageType Reason) override
|
||||
{
|
||||
const ParameterGrp& rGrp = static_cast<ParameterGrp&>(rCaller);
|
||||
if (strcmp(Reason, "NavigationStyle") == 0) {
|
||||
std::string model = rGrp.GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName());
|
||||
std::string model =
|
||||
rGrp.GetASCII("NavigationStyle", CADNavigationStyle::getClassTypeId().getName());
|
||||
page->setNavigationStyle(model);
|
||||
} else if (strcmp(Reason, "InvertZoom") == 0) {
|
||||
}
|
||||
else if (strcmp(Reason, "InvertZoom") == 0) {
|
||||
page->m_invertZoom = rGrp.GetBool("InvertZoom", true);
|
||||
} else if (strcmp(Reason, "ZoomStep") == 0) {
|
||||
}
|
||||
else if (strcmp(Reason, "ZoomStep") == 0) {
|
||||
page->m_zoomIncrement = rGrp.GetFloat("ZoomStep", 0.0f);
|
||||
} else if (strcmp(Reason, "ZoomAtCursor") == 0) {
|
||||
}
|
||||
else if (strcmp(Reason, "ZoomAtCursor") == 0) {
|
||||
page->m_atCursor = rGrp.GetBool("ZoomAtCursor", true);
|
||||
if (page->m_atCursor) {
|
||||
page->setResizeAnchor(QGVPage::AnchorUnderMouse);
|
||||
page->setTransformationAnchor(QGVPage::AnchorUnderMouse);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
page->setResizeAnchor(QGVPage::AnchorViewCenter);
|
||||
page->setTransformationAnchor(QGVPage::AnchorViewCenter);
|
||||
}
|
||||
}
|
||||
}
|
||||
void detach() {
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
void detach()
|
||||
{
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/View");
|
||||
hGrp->Detach(this);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
QGVPage::QGVPage(ViewProviderPage *vpPage, QGSPage* scenePage, QWidget *parent)
|
||||
: QGraphicsView(parent),
|
||||
m_renderer(Native),
|
||||
drawBkg(true),
|
||||
m_vpPage(nullptr),
|
||||
m_scene(scenePage),
|
||||
balloonPlacing(false),
|
||||
panningActive(false),
|
||||
m_showGrid(false),
|
||||
m_navStyle(nullptr),
|
||||
d(new Private(this))
|
||||
QGVPage::QGVPage(ViewProviderPage* vpPage, QGSPage* scenePage, QWidget* parent)
|
||||
: QGraphicsView(parent), m_renderer(Native), drawBkg(true), m_vpPage(nullptr),
|
||||
m_scene(scenePage), balloonPlacing(false), panningActive(false), m_showGrid(false),
|
||||
m_navStyle(nullptr), d(new Private(this))
|
||||
{
|
||||
assert(vpPage);
|
||||
m_vpPage = vpPage;
|
||||
@@ -197,27 +190,29 @@ QGVPage::QGVPage(ViewProviderPage *vpPage, QGSPage* scenePage, QWidget *parent)
|
||||
|
||||
setCacheMode(QGraphicsView::CacheBackground);
|
||||
setRenderer(Native);
|
||||
// setRenderer(OpenGL); //gives rotten quality, don't use this
|
||||
// setRenderer(OpenGL); //gives rotten quality, don't use this
|
||||
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
|
||||
d->init();
|
||||
if (m_atCursor) {
|
||||
setResizeAnchor(AnchorUnderMouse);
|
||||
setTransformationAnchor(AnchorUnderMouse);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
setResizeAnchor(AnchorViewCenter);
|
||||
setTransformationAnchor(AnchorViewCenter);
|
||||
}
|
||||
setAlignment(Qt::AlignCenter);
|
||||
|
||||
// setDragMode(ScrollHandDrag);
|
||||
// setDragMode(ScrollHandDrag);
|
||||
setDragMode(QGraphicsView::NoDrag);
|
||||
resetCursor();
|
||||
|
||||
bkgBrush = new QBrush(getBackgroundColor());
|
||||
|
||||
balloonCursor = new QLabel(this);
|
||||
balloonCursor->setPixmap(prepareCursorPixmap("TechDraw_Balloon.svg", balloonHotspot = QPoint(8, 59)));
|
||||
balloonCursor->setPixmap(
|
||||
prepareCursorPixmap("TechDraw_Balloon.svg", balloonHotspot = QPoint(8, 59)));
|
||||
balloonCursor->hide();
|
||||
|
||||
initNavigationStyle();
|
||||
@@ -232,10 +227,7 @@ QGVPage::~QGVPage()
|
||||
d->detach();
|
||||
}
|
||||
|
||||
void QGVPage::centerOnPage(void)
|
||||
{
|
||||
centerOn(m_vpPage->getQGSPage()->getTemplateCenter());
|
||||
}
|
||||
void QGVPage::centerOnPage(void) { centerOn(m_vpPage->getQGSPage()->getTemplateCenter()); }
|
||||
|
||||
void QGVPage::initNavigationStyle()
|
||||
{
|
||||
@@ -245,7 +237,7 @@ void QGVPage::initNavigationStyle()
|
||||
|
||||
void QGVPage::setNavigationStyle(std::string navParm)
|
||||
{
|
||||
// Base::Console().Message("QGVP::setNavigationStyle(%s)\n", navParm.c_str());
|
||||
// Base::Console().Message("QGVP::setNavigationStyle(%s)\n", navParm.c_str());
|
||||
if (m_navStyle) {
|
||||
delete m_navStyle;
|
||||
}
|
||||
@@ -263,34 +255,47 @@ void QGVPage::setNavigationStyle(std::string navParm)
|
||||
|
||||
if (foundBlender != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleBlender(this));
|
||||
} else if (foundCAD != std::string::npos) {
|
||||
}
|
||||
else if (foundCAD != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleCAD(this));
|
||||
} else if (foundTouchPad != std::string::npos) {
|
||||
}
|
||||
else if (foundTouchPad != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleTouchpad(this));
|
||||
} else if (foundInventor != std::string::npos) {
|
||||
}
|
||||
else if (foundInventor != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleInventor(this));
|
||||
} else if (foundTinker != std::string::npos) {
|
||||
}
|
||||
else if (foundTinker != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleTinkerCAD(this));
|
||||
} else if (foundGesture != std::string::npos) {
|
||||
}
|
||||
else if (foundGesture != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleGesture(this));
|
||||
} else if (foundMaya != std::string::npos) {
|
||||
}
|
||||
else if (foundMaya != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleMaya(this));
|
||||
} else if (foundOCC != std::string::npos) {
|
||||
}
|
||||
else if (foundOCC != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleOCC(this));
|
||||
} else if (foundOpenSCAD != std::string::npos) {
|
||||
}
|
||||
else if (foundOpenSCAD != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleOpenSCAD(this));
|
||||
} else if (foundRevit != std::string::npos) {
|
||||
}
|
||||
else if (foundRevit != std::string::npos) {
|
||||
m_navStyle = static_cast<QGVNavStyle*>(new QGVNavStyleRevit(this));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_navStyle = new QGVNavStyle(this);
|
||||
}
|
||||
}
|
||||
|
||||
void QGVPage::startBalloonPlacing()
|
||||
void QGVPage::startBalloonPlacing(DrawView* parent)
|
||||
{
|
||||
// Base::Console().Message("QGVP::startBalloonPlacing(%s)\n", parent->getNameInDocument());
|
||||
balloonPlacing = true;
|
||||
m_balloonParent = parent;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
activateCursor(QCursor(balloonCursor->pixmap(Qt::ReturnByValue), balloonHotspot.x(), balloonHotspot.y()));
|
||||
activateCursor(
|
||||
QCursor(balloonCursor->pixmap(Qt::ReturnByValue), balloonHotspot.x(), balloonHotspot.y()));
|
||||
#else
|
||||
activateCursor(QCursor(*balloonCursor->pixmap(), balloonHotspot.x(), balloonHotspot.y()));
|
||||
#endif
|
||||
@@ -299,22 +304,23 @@ void QGVPage::startBalloonPlacing()
|
||||
void QGVPage::cancelBalloonPlacing()
|
||||
{
|
||||
balloonPlacing = false;
|
||||
m_balloonParent = nullptr;
|
||||
balloonCursor->hide();
|
||||
resetCursor();
|
||||
}
|
||||
|
||||
void QGVPage::drawBackground(QPainter *painter, const QRectF &)
|
||||
void QGVPage::drawBackground(QPainter* painter, const QRectF&)
|
||||
{
|
||||
//Note: Background is not part of scene()
|
||||
if(!drawBkg)
|
||||
//Note: Background is not part of scene()
|
||||
if (!drawBkg)
|
||||
return;
|
||||
|
||||
if(!m_vpPage) {
|
||||
if (!m_vpPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_vpPage->getDrawPage()) {
|
||||
// Base::Console().Message("QGVP::drawBackground - no Page Feature!\n");
|
||||
// Base::Console().Message("QGVP::drawBackground - no Page Feature!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -322,14 +328,14 @@ void QGVPage::drawBackground(QPainter *painter, const QRectF &)
|
||||
painter->resetTransform();
|
||||
|
||||
painter->setBrush(*bkgBrush);
|
||||
painter->drawRect(viewport()->rect().adjusted(-2, -2, 2,2)); //just bigger than viewport to prevent artifacts
|
||||
painter->drawRect(
|
||||
viewport()->rect().adjusted(-2, -2, 2, 2));//just bigger than viewport to prevent artifacts
|
||||
|
||||
// Default to A3 landscape, though this is currently relevant
|
||||
// only for opening corrupt docs, etc.
|
||||
float pageWidth = 420,
|
||||
pageHeight = 297;
|
||||
float pageWidth = 420, pageHeight = 297;
|
||||
|
||||
if ( m_vpPage->getDrawPage()->hasValidTemplate() ) {
|
||||
if (m_vpPage->getDrawPage()->hasValidTemplate()) {
|
||||
pageWidth = Rez::guiX(m_vpPage->getDrawPage()->getPageWidth());
|
||||
pageHeight = Rez::guiX(m_vpPage->getDrawPage()->getPageHeight());
|
||||
}
|
||||
@@ -352,11 +358,12 @@ void QGVPage::setRenderer(RendererType type)
|
||||
|
||||
if (m_renderer == OpenGL) {
|
||||
#ifndef QT_NO_OPENGL
|
||||
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); //QGLWidget is obsolete
|
||||
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); //QGLWidget is obsolete
|
||||
setViewport(new QOpenGLWidget);
|
||||
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
setViewport(new QWidget);
|
||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
}
|
||||
@@ -371,7 +378,7 @@ void QGVPage::setHighQualityAntialiasing(bool highQualityAntialiasing)
|
||||
#endif
|
||||
}
|
||||
|
||||
void QGVPage::paintEvent(QPaintEvent *event)
|
||||
void QGVPage::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
if (m_renderer == Image) {
|
||||
if (m_image.size() != viewport()->size()) {
|
||||
@@ -384,16 +391,17 @@ void QGVPage::paintEvent(QPaintEvent *event)
|
||||
|
||||
QPainter p(viewport());
|
||||
p.drawImage(0, 0, m_image);
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QGraphicsView::paintEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void QGVPage::contextMenuEvent(QContextMenuEvent *event)
|
||||
void QGVPage::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
if (m_navStyle->allowContextMenu(event)) {
|
||||
QGraphicsView::contextMenuEvent(event); //this eats the event. mouseReleaseEvent will not be called.
|
||||
QGraphicsView::contextMenuEvent(
|
||||
event);//this eats the event. mouseReleaseEvent will not be called.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -402,9 +410,8 @@ void QGVPage::contextMenuEvent(QContextMenuEvent *event)
|
||||
if (m_saveContextEvent) {
|
||||
delete m_saveContextEvent;
|
||||
}
|
||||
m_saveContextEvent = new QContextMenuEvent(QContextMenuEvent::Mouse,
|
||||
event->pos(),
|
||||
event->globalPos());
|
||||
m_saveContextEvent =
|
||||
new QContextMenuEvent(QContextMenuEvent::Mouse, event->pos(), event->globalPos());
|
||||
}
|
||||
|
||||
void QGVPage::pseudoContextEvent()
|
||||
@@ -414,13 +421,13 @@ void QGVPage::pseudoContextEvent()
|
||||
}
|
||||
}
|
||||
|
||||
void QGVPage::wheelEvent(QWheelEvent *event)
|
||||
void QGVPage::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
m_navStyle->handleWheelEvent(event);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void QGVPage::keyPressEvent(QKeyEvent *event)
|
||||
void QGVPage::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
m_navStyle->handleKeyPressEvent(event);
|
||||
if (!event->isAccepted()) {
|
||||
@@ -428,7 +435,7 @@ void QGVPage::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QGVPage::keyReleaseEvent(QKeyEvent *event)
|
||||
void QGVPage::keyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
m_navStyle->handleKeyReleaseEvent(event);
|
||||
if (!event->isAccepted()) {
|
||||
@@ -436,7 +443,8 @@ void QGVPage::keyReleaseEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QGVPage::focusOutEvent(QFocusEvent *event) {
|
||||
void QGVPage::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
m_navStyle->handleFocusOutEvent(event);
|
||||
}
|
||||
@@ -445,8 +453,8 @@ void QGVPage::kbPanScroll(int xMove, int yMove)
|
||||
{
|
||||
if (xMove != 0) {
|
||||
QScrollBar* hsb = horizontalScrollBar();
|
||||
// int hRange = hsb->maximum() - hsb->minimum(); //default here is 100?
|
||||
// int hDelta = xMove/hRange
|
||||
// int hRange = hsb->maximum() - hsb->minimum(); //default here is 100?
|
||||
// int hDelta = xMove/hRange
|
||||
int hStep = hsb->singleStep() * xMove * m_reversePan;
|
||||
int hNow = hsb->value();
|
||||
hsb->setValue(hNow + hStep);
|
||||
@@ -459,70 +467,72 @@ void QGVPage::kbPanScroll(int xMove, int yMove)
|
||||
}
|
||||
}
|
||||
|
||||
void QGVPage::enterEvent(QEvent *event)
|
||||
void QGVPage::enterEvent(QEvent* event)
|
||||
{
|
||||
QGraphicsView::enterEvent(event);
|
||||
m_navStyle->handleEnterEvent(event);
|
||||
QGraphicsView::enterEvent(event);
|
||||
}
|
||||
|
||||
void QGVPage::leaveEvent(QEvent * event)
|
||||
void QGVPage::leaveEvent(QEvent* event)
|
||||
{
|
||||
m_navStyle->handleLeaveEvent(event);
|
||||
QGraphicsView::leaveEvent(event);
|
||||
}
|
||||
|
||||
void QGVPage::mousePressEvent(QMouseEvent *event)
|
||||
void QGVPage::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
m_navStyle->handleMousePressEvent(event);
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QGVPage::mouseMoveEvent(QMouseEvent *event)
|
||||
void QGVPage::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
m_navStyle->handleMouseMoveEvent(event);
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void QGVPage::mouseReleaseEvent(QMouseEvent *event)
|
||||
void QGVPage::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
m_navStyle->handleMouseReleaseEvent(event);
|
||||
QGraphicsView::mouseReleaseEvent(event);
|
||||
resetCursor();
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* QGVPage::getDrawPage()
|
||||
{
|
||||
return m_vpPage->getDrawPage();
|
||||
}
|
||||
TechDraw::DrawPage* QGVPage::getDrawPage() { return m_vpPage->getDrawPage(); }
|
||||
|
||||
QColor QGVPage::getBackgroundColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||
.GetUserParameter()
|
||||
.GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Background", 0x70707000));
|
||||
return fcColor.asValue<QColor>();
|
||||
}
|
||||
|
||||
double QGVPage::getDevicePixelRatio() const {
|
||||
for (Gui::MDIView *view : m_vpPage->getDocument()->getMDIViews()) {
|
||||
double QGVPage::getDevicePixelRatio() const
|
||||
{
|
||||
for (Gui::MDIView* view : m_vpPage->getDocument()->getMDIViews()) {
|
||||
if (view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
|
||||
return static_cast<Gui::View3DInventor *>(view)->getViewer()->devicePixelRatio();
|
||||
return static_cast<Gui::View3DInventor*>(view)->getViewer()->devicePixelRatio();
|
||||
}
|
||||
}
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
QPixmap QGVPage::prepareCursorPixmap(const char *iconName, QPoint &hotspot) {
|
||||
QPixmap QGVPage::prepareCursorPixmap(const char* iconName, QPoint& hotspot)
|
||||
{
|
||||
|
||||
QPointF floatHotspot(hotspot);
|
||||
double pixelRatio = getDevicePixelRatio();
|
||||
|
||||
// Due to impossibility to query cursor size via Qt API, we stick to (32x32)*device_pixel_ratio
|
||||
// as FreeCAD Wiki suggests - see https://wiki.freecadweb.org/HiDPI_support#Custom_cursor_size
|
||||
double cursorSize = 32.0*pixelRatio;
|
||||
double cursorSize = 32.0 * pixelRatio;
|
||||
|
||||
QPixmap pixmap = Gui::BitmapFactory().pixmapFromSvg(iconName, QSizeF(cursorSize, cursorSize));
|
||||
pixmap.setDevicePixelRatio(pixelRatio);
|
||||
@@ -544,27 +554,23 @@ QPixmap QGVPage::prepareCursorPixmap(const char *iconName, QPoint &hotspot) {
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
void QGVPage::activateCursor(QCursor cursor) {
|
||||
void QGVPage::activateCursor(QCursor cursor)
|
||||
{
|
||||
this->setCursor(cursor);
|
||||
viewport()->setCursor(cursor);
|
||||
}
|
||||
|
||||
void QGVPage::resetCursor() {
|
||||
void QGVPage::resetCursor()
|
||||
{
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
viewport()->setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void QGVPage::setPanCursor()
|
||||
{
|
||||
activateCursor(panCursor);
|
||||
}
|
||||
void QGVPage::setPanCursor() { activateCursor(panCursor); }
|
||||
|
||||
void QGVPage::setZoomCursor()
|
||||
{
|
||||
activateCursor(zoomCursor);
|
||||
}
|
||||
void QGVPage::setZoomCursor() { activateCursor(zoomCursor); }
|
||||
|
||||
void QGVPage::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
void QGVPage::drawForeground(QPainter* painter, const QRectF& rect)
|
||||
{
|
||||
Q_UNUSED(rect);
|
||||
if (m_showGrid) {
|
||||
@@ -588,8 +594,8 @@ void QGVPage::makeGrid(int gridWidth, int gridHeight, double gridStep)
|
||||
//draw horizontal lines
|
||||
for (int i = 0; i < rows; i++) {
|
||||
vPos = i * step;
|
||||
QPointF start (horizStart, -vPos);
|
||||
QPointF end (width, -vPos);
|
||||
QPointF start(horizStart, -vPos);
|
||||
QPointF end(width, -vPos);
|
||||
grid.moveTo(start);
|
||||
grid.lineTo(end);
|
||||
}
|
||||
@@ -610,9 +616,10 @@ void QGVPage::makeGrid(int gridWidth, int gridHeight, double gridStep)
|
||||
|
||||
std::string QGVPage::getNavStyleParameter()
|
||||
{
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View");
|
||||
std::string model = hGrp->GetASCII("NavigationStyle", NavigationStyle::getClassTypeId().getName());
|
||||
ParameterGrp::handle hGrp =
|
||||
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
std::string model =
|
||||
hGrp->GetASCII("NavigationStyle", NavigationStyle::getClassTypeId().getName());
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -624,7 +631,7 @@ Base::Type QGVPage::getStyleType(std::string model)
|
||||
|
||||
void QGVPage::createStandardCursors(double dpr)
|
||||
{
|
||||
(void) dpr; //avoid clang warning re unused parameter
|
||||
(void)dpr;//avoid clang warning re unused parameter
|
||||
QBitmap cursor = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_bitmap);
|
||||
QBitmap mask = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_mask_bitmap);
|
||||
#if defined(Q_OS_WIN32)
|
||||
|
||||
@@ -33,11 +33,13 @@
|
||||
|
||||
#include <Base/Type.h>
|
||||
|
||||
namespace App {
|
||||
namespace App
|
||||
{
|
||||
class DocumentObject;
|
||||
}
|
||||
|
||||
namespace TechDraw {
|
||||
namespace TechDraw
|
||||
{
|
||||
class DrawView;
|
||||
class DrawViewPart;
|
||||
class DrawProjGroup;
|
||||
@@ -54,7 +56,7 @@ class DrawLeaderLine;
|
||||
class DrawViewBalloon;
|
||||
class DrawRichAnno;
|
||||
class DrawWeldSymbol;
|
||||
}
|
||||
}// namespace TechDraw
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -70,41 +72,46 @@ class QGIRichAnno;
|
||||
class QGITile;
|
||||
class QGVNavStyle;
|
||||
|
||||
class TechDrawGuiExport QGVPage : public QGraphicsView
|
||||
class TechDrawGuiExport QGVPage: public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum RendererType { Native, OpenGL, Image };
|
||||
enum RendererType
|
||||
{
|
||||
Native,
|
||||
OpenGL,
|
||||
Image
|
||||
};
|
||||
|
||||
QGVPage(ViewProviderPage *vpPage, QGSPage* scenePage, QWidget *parent = nullptr);
|
||||
QGVPage(ViewProviderPage* vpPage, QGSPage* scenePage, QWidget* parent = nullptr);
|
||||
~QGVPage();
|
||||
|
||||
void setRenderer(RendererType type = Native);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect) override;
|
||||
void drawBackground(QPainter* painter, const QRectF& rect) override;
|
||||
|
||||
QGSPage* getScene() {return m_scene; }
|
||||
QGSPage* getScene() { return m_scene; }
|
||||
|
||||
void startBalloonPlacing();
|
||||
void startBalloonPlacing(TechDraw::DrawView* parent);
|
||||
void cancelBalloonPlacing();
|
||||
|
||||
TechDraw::DrawPage * getDrawPage();
|
||||
TechDraw::DrawPage* getDrawPage();
|
||||
|
||||
void setExporting(bool enable);
|
||||
|
||||
void makeGrid(int width, int height, double step);
|
||||
void showGrid(bool state) {m_showGrid = state;}
|
||||
void updateViewport() {viewport()->repaint();}
|
||||
void showGrid(bool state) { m_showGrid = state; }
|
||||
void updateViewport() { viewport()->repaint(); }
|
||||
|
||||
bool isBalloonPlacing() const {return balloonPlacing; }
|
||||
void setBalloonPlacing(bool isPlacing) {balloonPlacing = isPlacing;}
|
||||
bool isBalloonPlacing() const { return balloonPlacing; }
|
||||
void setBalloonPlacing(bool isPlacing) { balloonPlacing = isPlacing; }
|
||||
|
||||
QLabel* getBalloonCursor() const {return balloonCursor;}
|
||||
void setBalloonCursor(QLabel* label) {balloonCursor = label;}
|
||||
QLabel* getBalloonCursor() const { return balloonCursor; }
|
||||
void setBalloonCursor(QLabel* label) { balloonCursor = label; }
|
||||
|
||||
void kbPanScroll(int xMove = 1, int yMove = 1);
|
||||
QPointF getBalloonCursorPos() const {return balloonCursorPos;}
|
||||
void setBalloonCursorPos(QPoint pos) { balloonCursorPos = pos;}
|
||||
QPointF getBalloonCursorPos() const { return balloonCursorPos; }
|
||||
void setBalloonCursorPos(QPoint pos) { balloonCursorPos = pos; }
|
||||
|
||||
void activateCursor(QCursor cursor);
|
||||
void resetCursor();
|
||||
@@ -115,28 +122,30 @@ public:
|
||||
|
||||
void centerOnPage();
|
||||
|
||||
TechDraw::DrawView* getBalloonParent() { return m_balloonParent; }
|
||||
|
||||
public Q_SLOTS:
|
||||
void setHighQualityAntialiasing(bool highQualityAntialiasing);
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void enterEvent(QEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void enterEvent(QEvent* event) override;
|
||||
void leaveEvent(QEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
|
||||
QColor getBackgroundColor();
|
||||
|
||||
double getDevicePixelRatio() const;
|
||||
QPixmap prepareCursorPixmap(const char *iconName, QPoint &hotspot);
|
||||
QPixmap prepareCursorPixmap(const char* iconName, QPoint& hotspot);
|
||||
|
||||
void drawForeground(QPainter *painter, const QRectF &rect) override;
|
||||
void drawForeground(QPainter* painter, const QRectF& rect) override;
|
||||
|
||||
std::string getNavStyleParameter();
|
||||
Base::Type getStyleType(std::string model);
|
||||
@@ -152,7 +161,7 @@ private:
|
||||
bool drawBkg;
|
||||
QBrush* bkgBrush;
|
||||
QImage m_image;
|
||||
ViewProviderPage *m_vpPage;
|
||||
ViewProviderPage* m_vpPage;
|
||||
|
||||
bool m_atCursor;
|
||||
bool m_invertZoom;
|
||||
@@ -162,9 +171,10 @@ private:
|
||||
|
||||
QGSPage* m_scene;
|
||||
bool balloonPlacing;
|
||||
QLabel *balloonCursor;
|
||||
QLabel* balloonCursor;
|
||||
QPoint balloonCursorPos;
|
||||
QPoint balloonHotspot;
|
||||
TechDraw::DrawView* m_balloonParent;//temp field. used during balloon placing.
|
||||
|
||||
QPoint panOrigin;
|
||||
bool panningActive;
|
||||
@@ -184,6 +194,6 @@ private:
|
||||
QContextMenuEvent* m_saveContextEvent;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
}// namespace TechDrawGui
|
||||
|
||||
#endif // TECHDRAWGUI_QGVIEW_H
|
||||
#endif// TECHDRAWGUI_QGVIEW_H
|
||||
|
||||
@@ -25,8 +25,12 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include "ViewProviderAnnotation.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "ViewProviderAnnotation.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
@@ -35,24 +39,16 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderAnnotation, TechDrawGui::ViewProviderDr
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
ViewProviderAnnotation::ViewProviderAnnotation()
|
||||
{
|
||||
sPixmap = "actions/TechDraw_Annotation";
|
||||
}
|
||||
ViewProviderAnnotation::ViewProviderAnnotation() { sPixmap = "actions/TechDraw_Annotation"; }
|
||||
|
||||
ViewProviderAnnotation::~ViewProviderAnnotation()
|
||||
{
|
||||
}
|
||||
ViewProviderAnnotation::~ViewProviderAnnotation() {}
|
||||
|
||||
void ViewProviderAnnotation::updateData(const App::Property* prop)
|
||||
{
|
||||
if (prop == &(getViewObject()->Text) ||
|
||||
prop == &(getViewObject()->Font) ||
|
||||
prop == &(getViewObject()->TextColor) ||
|
||||
prop == &(getViewObject()->TextSize) ||
|
||||
prop == &(getViewObject()->LineSpace) ||
|
||||
prop == &(getViewObject()->TextStyle) ||
|
||||
prop == &(getViewObject()->MaxWidth) ) {
|
||||
if (prop == &(getViewObject()->Text) || prop == &(getViewObject()->Font)
|
||||
|| prop == &(getViewObject()->TextColor) || prop == &(getViewObject()->TextSize)
|
||||
|| prop == &(getViewObject()->LineSpace) || prop == &(getViewObject()->TextStyle)
|
||||
|| prop == &(getViewObject()->MaxWidth)) {
|
||||
// redraw QGIVP
|
||||
QGIView* qgiv = getQView();
|
||||
if (qgiv) {
|
||||
@@ -63,6 +59,31 @@ void ViewProviderAnnotation::updateData(const App::Property* prop)
|
||||
ViewProviderDrawingView::updateData(prop);
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderAnnotation::claimChildren() const
|
||||
{
|
||||
// Collect any child Document Objects and put them in the right place in the Feature tree
|
||||
// valid children of an Annotation are:
|
||||
// - Balloons
|
||||
// - Leaders
|
||||
std::vector<App::DocumentObject*> temp;
|
||||
const std::vector<App::DocumentObject*>& views = getViewObject()->getInList();
|
||||
try {
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = views.begin();
|
||||
it != views.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) {
|
||||
temp.push_back((*it));
|
||||
}
|
||||
else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) {
|
||||
temp.push_back((*it));
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
catch (...) {
|
||||
return std::vector<App::DocumentObject*>();
|
||||
}
|
||||
}
|
||||
|
||||
TechDraw::DrawViewAnnotation* ViewProviderAnnotation::getViewObject() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawViewAnnotation*>(pcObject);
|
||||
|
||||
@@ -31,10 +31,11 @@
|
||||
#include "ViewProviderDrawingView.h"
|
||||
|
||||
|
||||
namespace TechDrawGui {
|
||||
namespace TechDrawGui
|
||||
{
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderAnnotation : public ViewProviderDrawingView
|
||||
class TechDrawGuiExport ViewProviderAnnotation: public ViewProviderDrawingView
|
||||
{
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(TechDrawGui::ViewProviderAnnotation);
|
||||
|
||||
@@ -44,13 +45,15 @@ public:
|
||||
/// destructor
|
||||
~ViewProviderAnnotation() override;
|
||||
|
||||
bool useNewSelectionModel() const override {return false;}
|
||||
bool useNewSelectionModel() const override { return false; }
|
||||
void updateData(const App::Property*) override;
|
||||
|
||||
std::vector<App::DocumentObject*> claimChildren(void) const override;
|
||||
|
||||
TechDraw::DrawViewAnnotation* getViewObject() const override;
|
||||
};
|
||||
|
||||
} // namespace TechDrawGui
|
||||
}// namespace TechDrawGui
|
||||
|
||||
|
||||
#endif // DRAWINGGUI_VIEWPROVIDERANNOTATION_H
|
||||
#endif// DRAWINGGUI_VIEWPROVIDERANNOTATION_H
|
||||
|
||||
Reference in New Issue
Block a user