App: replace three boolean of CellAddress::toString() with a bitmask of enums

This commit is contained in:
wmayer
2022-01-08 19:37:24 +01:00
committed by wwmayer
parent 2cbe72aea5
commit 26f9e7869f
5 changed files with 33 additions and 19 deletions

View File

@@ -435,7 +435,7 @@ PyObject *Sheet::getPyObject(void)
Property * Sheet::getProperty(CellAddress key) const
{
return props.getDynamicPropertyByName(key.toString(true).c_str());
return props.getDynamicPropertyByName(key.toString(CellAddress::Cell::ShowRowColumn).c_str());
}
/**
@@ -515,7 +515,7 @@ void Sheet::onSettingDocument()
Property * Sheet::setFloatProperty(CellAddress key, double value)
{
std::string name = key.toString(true);
std::string name = key.toString(CellAddress::Cell::ShowRowColumn);
Property * prop = props.getDynamicPropertyByName(name.c_str());
PropertyFloat * floatProp;
@@ -537,7 +537,7 @@ Property * Sheet::setFloatProperty(CellAddress key, double value)
Property * Sheet::setIntegerProperty(CellAddress key, long value)
{
std::string name = key.toString(true);
std::string name = key.toString(CellAddress::Cell::ShowRowColumn);
Property * prop = props.getDynamicPropertyByName(name.c_str());
PropertyInteger * intProp;
@@ -572,7 +572,7 @@ Property * Sheet::setIntegerProperty(CellAddress key, long value)
Property * Sheet::setQuantityProperty(CellAddress key, double value, const Base::Unit & unit)
{
std::string name = key.toString(true);
std::string name = key.toString(CellAddress::Cell::ShowRowColumn);
Property * prop = props.getDynamicPropertyByName(name.c_str());
PropertySpreadsheetQuantity * quantityProp;
@@ -607,7 +607,7 @@ Property * Sheet::setQuantityProperty(CellAddress key, double value, const Base:
Property * Sheet::setStringProperty(CellAddress key, const std::string & value)
{
std::string name = key.toString(true);
std::string name = key.toString(CellAddress::Cell::ShowRowColumn);
Property * prop = props.getDynamicPropertyByName(name.c_str());
PropertyString * stringProp = freecad_dynamic_cast<PropertyString>(prop);
@@ -627,7 +627,7 @@ Property * Sheet::setStringProperty(CellAddress key, const std::string & value)
Property * Sheet::setObjectProperty(CellAddress key, Py::Object object)
{
std::string name = key.toString(true);
std::string name = key.toString(CellAddress::Cell::ShowRowColumn);
Property * prop = props.getDynamicPropertyByName(name.c_str());
PropertyPythonObject * pyProp = freecad_dynamic_cast<PropertyPythonObject>(prop);

View File

@@ -223,7 +223,7 @@ void DlgSheetConf::accept()
// cell separately using a simpler expression can make it easy for us
// to extract the name of the PropertyEnumeration for editing or unsetup.
Gui::cmdAppObjectArgs(sheet, "set('%s', '=hiddenref(%s.String)')",
from.toString(true), prop->getFullName());
from.toString(CellAddress::Cell::ShowRowColumn), prop->getFullName());
// Adjust the range to skip the first cell
range = Range(from.row(),from.col()+1,to.row(),to.col());
@@ -232,9 +232,10 @@ void DlgSheetConf::accept()
// PropertyEnumeration
Gui::cmdAppObjectArgs(sheet, "setExpression('.cells.Bind.%s.%s', "
"'tuple(.cells, <<%s>> + str(hiddenref(%s)+%d), <<%s>> + str(hiddenref(%s)+%d))')",
range.from().toString(true), range.to().toString(true),
range.from().toString(true,false,true), prop->getFullName(), from.row()+2,
range.to().toString(true,false,true), prop->getFullName(), from.row()+2);
range.from().toString(CellAddress::Cell::ShowRowColumn),
range.to().toString(CellAddress::Cell::ShowRowColumn),
range.from().toString(CellAddress::Cell::ShowColumn), prop->getFullName(), from.row()+2,
range.to().toString(CellAddress::Cell::ShowColumn), prop->getFullName(), from.row()+2);
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
Gui::Command::commitCommand();
@@ -272,7 +273,7 @@ void DlgSheetConf::onDiscard() {
r.from().toString(), r.to().toString());
}
Gui::cmdAppObjectArgs(sheet, "clear('%s')", from.toString(true));
Gui::cmdAppObjectArgs(sheet, "clear('%s')", from.toString(CellAddress::Cell::ShowRowColumn));
if(prop && prop->getName()) {
auto obj = path.getDocumentObject();