fix tile properties

- make TileColumn read-only
- restrict TileRow to what is possible
- improve tooltips
- add button to flip the sides (the symbol is not mirrored, just flipped)
This commit is contained in:
donovaly
2020-03-30 03:34:44 +02:00
committed by WandererFan
parent cb27fc0715
commit 42aa4560c5
6 changed files with 136 additions and 26 deletions

View File

@@ -49,8 +49,17 @@ DrawTile::DrawTile(void)
ADD_PROPERTY_TYPE(TileParent,(0),group,(App::PropertyType)(App::Prop_None),
"Object to which this tile is attached");
ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent");
ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent");
ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent object\n 0 for arrow side, -1 for other side");
ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent object");
// there is currently only one column, this don't allow to edit
TileColumn.setStatus(App::Property::ReadOnly, true);
// the row can only have the value 0 or -1
// allow its editing because this way the tiles can be flipped
TileRowConstraints.LowerBound = -1;
TileRowConstraints.UpperBound = 0;
TileRowConstraints.StepSize = 1;
TileRow.setConstraints(&TileRowConstraints);
}
DrawTile::~DrawTile()
@@ -77,6 +86,18 @@ App::DocumentObjectExecReturn *DrawTile::execute(void)
return DocumentObject::execute();
}
void DrawTile::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
// transforms properties that had been changed
{
// property TileRow had App::PropertyInteger and was changed to App::PropertyIntegerConstraint
if (prop == &TileRow && strcmp(TypeName, "App::PropertyInteger") == 0) {
App::PropertyInteger TileRowProperty;
// restore the PropertyInteger to be able to set its value
TileRowProperty.Restore(reader);
TileRow.setValue(TileRowProperty.getValue());
}
}
DrawView* DrawTile::getParent(void) const
{
// Base::Console().Message("DT::getParent() - %s\n", getNameInDocument());