[TD]fix Balloon placement issues
- contributed by @lidiriel
This commit is contained in:
@@ -57,13 +57,17 @@
|
||||
#include "LineGroup.h"
|
||||
|
||||
|
||||
//#include <Mod/TechDraw/App/DrawViewBalloonPy.h> // generated from DrawViewDimensionPy.xml
|
||||
//#include <Mod/TechDraw/App/DrawViewBalloonPy.h> // generated from DrawViewBalloonPy.xml
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
//===========================================================================
|
||||
// DrawViewDimension
|
||||
// DrawViewBalloon
|
||||
//===========================================================================
|
||||
//
|
||||
// X,Y is the center of the balloon bubble
|
||||
// OriginX, OriginY is the tip of the arrow
|
||||
// these are in ???? coordinates
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewBalloon, TechDraw::DrawView)
|
||||
|
||||
@@ -83,7 +87,8 @@ const char* DrawViewBalloon::balloonTypeEnums[]= {"Circular",
|
||||
DrawViewBalloon::DrawViewBalloon(void)
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Text , (""),"",App::Prop_None,"The text to be displayed");
|
||||
ADD_PROPERTY_TYPE(sourceView,(0),"",(App::PropertyType)(App::Prop_None),"Source view for balloon");
|
||||
// ADD_PROPERTY_TYPE(SourceView,(0),"",(App::PropertyType)(App::Prop_None),"Source view for balloon");
|
||||
ADD_PROPERTY_TYPE(SourceView,(0),"",(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");
|
||||
ADD_PROPERTY_TYPE(OriginIsSet, (false), "",(App::PropertyType)(App::Prop_None),"Balloon origin is set");
|
||||
@@ -103,8 +108,8 @@ DrawViewBalloon::DrawViewBalloon(void)
|
||||
OriginIsSet.setStatus(App::Property::Hidden,false);
|
||||
OriginIsSet.setStatus(App::Property::ReadOnly,true);
|
||||
|
||||
sourceView.setScope(App::LinkScope::Global);
|
||||
// sourceView.setStatus(App::Property::Hidden,true);
|
||||
SourceView.setScope(App::LinkScope::Global);
|
||||
// SourceView.setStatus(App::Property::Hidden,true);
|
||||
Rotation.setStatus(App::Property::Hidden,true);
|
||||
// ScaleType.setStatus(App::Property::Hidden,true);
|
||||
// Scale.setStatus(App::Property::Hidden,true);
|
||||
@@ -123,9 +128,16 @@ void DrawViewBalloon::onChanged(const App::Property* prop)
|
||||
DrawView::onChanged(prop);
|
||||
}
|
||||
|
||||
void DrawViewBalloon::onDocumentRestored()
|
||||
void DrawViewBalloon::handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName)
|
||||
{
|
||||
|
||||
// was sourceView in the past, now is SourceView
|
||||
Base::Type type = Base::Type::fromName(TypeName);
|
||||
if (SourceView.getClassTypeId() == type && strcmp(PropName, "sourceView") == 0) {
|
||||
SourceView.Restore(reader);
|
||||
}
|
||||
else {
|
||||
DrawView::handleChangedPropertyName(reader, TypeName, PropName);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawViewBalloon::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
@@ -187,9 +199,33 @@ short DrawViewBalloon::mustExecute() const
|
||||
return DrawView::mustExecute();
|
||||
}
|
||||
|
||||
void DrawViewBalloon::handleXYLock(void) {
|
||||
if (isLocked()) {
|
||||
if (!OriginX.testStatus(App::Property::ReadOnly)) {
|
||||
OriginX.setStatus(App::Property::ReadOnly, true);
|
||||
OriginX.purgeTouched();
|
||||
}
|
||||
if (!OriginY.testStatus(App::Property::ReadOnly)) {
|
||||
OriginY.setStatus(App::Property::ReadOnly, true);
|
||||
OriginY.purgeTouched();
|
||||
}
|
||||
} else {
|
||||
if (OriginX.testStatus(App::Property::ReadOnly)) {
|
||||
OriginX.setStatus(App::Property::ReadOnly, false);
|
||||
OriginX.purgeTouched();
|
||||
}
|
||||
if (OriginY.testStatus(App::Property::ReadOnly)) {
|
||||
OriginY.setStatus(App::Property::ReadOnly, false);
|
||||
OriginY.purgeTouched();
|
||||
}
|
||||
}
|
||||
DrawView::handleXYLock();
|
||||
}
|
||||
|
||||
|
||||
DrawViewPart* DrawViewBalloon::getViewPart() const
|
||||
{
|
||||
App::DocumentObject* obj = sourceView.getValue();
|
||||
App::DocumentObject* obj = SourceView.getValue();
|
||||
DrawViewPart* result = dynamic_cast<DrawViewPart*>(obj);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user