Core: Selection : Add possibility to set the style of selection between normal and greedy
This commit is contained in:
@@ -1599,6 +1599,15 @@ void SelectionSingleton::slotDeletedObject(const App::DocumentObject& Obj)
|
||||
}
|
||||
}
|
||||
|
||||
void SelectionSingleton::setSelectionStyle(SelectionStyle selStyle)
|
||||
{
|
||||
selectionStyle = selStyle;
|
||||
}
|
||||
|
||||
SelectionSingleton::SelectionStyle SelectionSingleton::getSelectionStyle()
|
||||
{
|
||||
return selectionStyle;
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
@@ -1607,8 +1616,9 @@ void SelectionSingleton::slotDeletedObject(const App::DocumentObject& Obj)
|
||||
* A constructor.
|
||||
* A more elaborate description of the constructor.
|
||||
*/
|
||||
SelectionSingleton::SelectionSingleton()
|
||||
:CurrentPreselection(SelectionChanges::ClrSelection)
|
||||
SelectionSingleton::SelectionSingleton() :
|
||||
CurrentPreselection(SelectionChanges::ClrSelection),
|
||||
selectionStyle(SelectionStyle::NormalSelection)
|
||||
{
|
||||
hx = 0;
|
||||
hy = 0;
|
||||
@@ -1778,6 +1788,12 @@ PyMethodDef SelectionSingleton::Methods[] = {
|
||||
"objName : str\n Name of the `App.DocumentObject` to select.\n"
|
||||
"subName : str\n Subelement name.\n"
|
||||
"point : tuple\n Coordinates of the point to pick."},
|
||||
{"setSelectionStyle", (PyCFunction) SelectionSingleton::sSetSelectionStyle, METH_VARARGS,
|
||||
"setSelectionStyle(selectionStyle) -> None\n"
|
||||
"\n"
|
||||
"Change the selection style. 0 for normal selection, 1 for greedy selection\n"
|
||||
"\n"
|
||||
"selectionStyle : int"},
|
||||
{"addObserver", (PyCFunction) SelectionSingleton::sAddSelObserver, METH_VARARGS,
|
||||
"addObserver(object, resolve=ResolveMode.OldStyleElement) -> None\n"
|
||||
"\n"
|
||||
@@ -2259,6 +2275,19 @@ PyObject *SelectionSingleton::sGetSelectionObject(PyObject * /*self*/, PyObject
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sSetSelectionStyle(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
int selStyle = 0;
|
||||
if (!PyArg_ParseTuple(args, "i", &selStyle))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
Selection().setSelectionStyle(selStyle == 0 ? SelectionStyle::NormalSelection : SelectionStyle::GreedySelection);
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sAddSelObserver(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject* o;
|
||||
|
||||
Reference in New Issue
Block a user