[TD] Use PropertyLength for LineWidths
- contributed by @uwe - also assure that the LineStyle is restricted to the range 0-5 fix another conversion routine mistake
This commit is contained in:
@@ -57,6 +57,9 @@
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
// there are only 5 frame line styles
|
||||
App::PropertyIntegerConstraint::Constraints ViewProviderRichAnno::LineStyleRange = {0, 5, 1};
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderRichAnno, TechDrawGui::ViewProviderDrawingView)
|
||||
|
||||
//**************************************************************************
|
||||
@@ -68,9 +71,11 @@ ViewProviderRichAnno::ViewProviderRichAnno()
|
||||
|
||||
static const char *group = "Frame Format";
|
||||
|
||||
ADD_PROPERTY_TYPE(LineWidth,(getDefLineWeight()), group,(App::PropertyType)(App::Prop_None),"Frame line weight");
|
||||
ADD_PROPERTY_TYPE(LineStyle,(1), group,(App::PropertyType)(App::Prop_None),"Frame line style");
|
||||
ADD_PROPERTY_TYPE(LineWidth,(getDefLineWeight()), group,(App::PropertyType)(App::Prop_None),"Frame line width");
|
||||
ADD_PROPERTY_TYPE(LineStyle,(1),group,(App::PropertyType)(App::Prop_None),"Frame line style");
|
||||
ADD_PROPERTY_TYPE(LineColor,(getDefLineColor()),group,App::Prop_None,"The color of the frame");
|
||||
|
||||
LineStyle.setConstraints(&LineStyleRange);
|
||||
}
|
||||
|
||||
ViewProviderRichAnno::~ViewProviderRichAnno()
|
||||
@@ -175,4 +180,23 @@ double ViewProviderRichAnno::getDefLineWeight(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
void ViewProviderRichAnno::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
// transforms properties that had been changed
|
||||
{
|
||||
// property LineWidth had the App::PropertyFloat and was changed to App::PropertyLength
|
||||
if (prop == &LineWidth && strcmp(TypeName, "App::PropertyFloat") == 0) {
|
||||
App::PropertyFloat LineWidthProperty;
|
||||
// restore the PropertyFloat to be able to set its value
|
||||
LineWidthProperty.Restore(reader);
|
||||
LineWidth.setValue(LineWidthProperty.getValue());
|
||||
}
|
||||
|
||||
// property LineStyle had the App::PropertyInteger and was changed to App::PropertyIntegerConstraint
|
||||
if (prop == &LineStyle && strcmp(TypeName, "App::PropertyInteger") == 0) {
|
||||
App::PropertyInteger LineStyleProperty;
|
||||
// restore the PropertyInteger to be able to set its value
|
||||
LineStyleProperty.Restore(reader);
|
||||
LineStyle.setValue(LineStyleProperty.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user