Skip to content

Commit

Permalink
[TD]DrawViewBalloon OriginX/Y to PropertyDistance
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Dec 7, 2019
1 parent efed66d commit ceeb776
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
47 changes: 31 additions & 16 deletions src/Mod/TechDraw/App/DrawViewBalloon.cpp
Expand Up @@ -131,22 +131,37 @@ void DrawViewBalloon::onDocumentRestored()
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::PropertyLength
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());
}
// property OriginY had the App::PropertyFloat and was changed to App::PropertyLength
else if (prop == &OriginY && strcmp(TypeName, "App::PropertyFloat") == 0) {
App::PropertyFloat OriginYProperty;
OriginYProperty.Restore(reader);
OriginY.setValue(OriginYProperty.getValue());
}
// 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) ) {
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) ) {
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) ) {
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) ) {
App::PropertyLength OriginYProperty;
// restore the PropertyLength to be able to set its value
OriginYProperty.Restore(reader);
OriginY.setValue(OriginYProperty.getValue());
}
}


Expand Down
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/App/DrawViewBalloon.h
Expand Up @@ -54,8 +54,8 @@ class TechDrawExport DrawViewBalloon : public TechDraw::DrawView
App::PropertyEnumeration EndType;
App::PropertyEnumeration Symbol;
App::PropertyFloat SymbolScale;
App::PropertyLength OriginX;
App::PropertyLength OriginY;
App::PropertyDistance OriginX;
App::PropertyDistance OriginY;
App::PropertyBool OriginIsSet;
App::PropertyFloat TextWrapLen;

Expand Down

0 comments on commit ceeb776

Please sign in to comment.