Gui: clean-up Selection API

Replace the int of the 'resolve' argument of several functions with a proper enum class.
* This avoids the inconsistencies in client code where often true/false is passed when an int is expected
* This avoids the use of magic numbers like 0, 1, 2 or the undocumented 3
This commit is contained in:
wmayer
2022-04-09 17:03:43 +02:00
parent 2d266a75cd
commit 0b2c73cf32
24 changed files with 365 additions and 274 deletions

View File

@@ -320,8 +320,8 @@ void CmdTechDrawView::activated(int iMsg)
std::vector<App::DocumentObject*> xShapes;
App::DocumentObject* partObj = nullptr;
std::string faceName;
int resolve = 1; //mystery
bool single = false; //mystery
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement; //mystery
bool single = false; //mystery
auto selection = getSelection().getSelectionEx(nullptr,
App::DocumentObject::getClassTypeId(),
resolve,
@@ -599,8 +599,8 @@ void CmdTechDrawProjectionGroup::activated(int iMsg)
std::vector<App::DocumentObject*> xShapes;
App::DocumentObject* partObj = nullptr;
std::string faceName;
int resolve = 1; //mystery
bool single = false; //mystery
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement; //mystery
bool single = false; //mystery
auto selection = getSelection().getSelectionEx(nullptr,
App::DocumentObject::getClassTypeId(),
resolve,

View File

@@ -995,14 +995,13 @@ void CmdTechDrawLinkDimension::activated(int iMsg)
if (!page) {
return;
}
std::string PageName = page->getNameInDocument();
bool result = _checkSelection(this,2);
if (!result)
return;
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx(nullptr,
App::DocumentObject::getClassTypeId(),0);
App::DocumentObject::getClassTypeId(), Gui::ResolveMode::NoResolve);
App::DocumentObject* obj3D = nullptr;
std::vector<App::DocumentObject*> parts;