Implemented a global setting for marker size and support of it for snapping in "Draft" workbench. In future this setting can be used for other markers too, to be able to set them all to comfortable size by just one global setting.
Before that (e.g. on MacBook Pro) it was very hard to see the microscopic selection-circle hidden behind much bigger cursor arrow when trying to snap e.g. a line to some vertex. Now this setting can be used for such displays to increase the marker size and make it clearly visible behind the cursor. The already existing "sketcher marker size" property is intended to be used for sketcher only, so it's not suitable for global setup of all the markers' sizes uniformly...
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Console.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
#include <Inventor/MarkerBitmaps.h>
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
@@ -182,6 +183,9 @@ PyMethodDef Application::Methods[] = {
|
||||
"createViewer([int]) -> View3DInventor/SplitView3DInventor\n\n"
|
||||
"shows and returns a viewer. If the integer argument is given and > 1: -> splitViewer"},
|
||||
|
||||
{"getMarkerIndex", (PyCFunction) Application::sGetMarkerIndex, 1,
|
||||
"Get marker index according to marker size setting"},
|
||||
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
@@ -1224,3 +1228,27 @@ PyObject* Application::sCreateViewer(PyObject * /*self*/, PyObject *args,PyObjec
|
||||
}
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyObject* Application::sGetMarkerIndex(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
|
||||
{
|
||||
char *pstr=0;
|
||||
if (!PyArg_ParseTuple(args, "s", &pstr))
|
||||
return NULL;
|
||||
|
||||
PY_TRY {
|
||||
ParameterGrp::handle const hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
|
||||
if (strcmp(pstr, "square") == 0)
|
||||
return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("DIAMOND_FILLED", hGrp->GetInt("MarkerSize", 9)));
|
||||
else if (strcmp(pstr, "cross") == 0)
|
||||
return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", hGrp->GetInt("MarkerSize", 9)));
|
||||
else if (strcmp(pstr, "empty") == 0)
|
||||
return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("SQUARE_LINE", hGrp->GetInt("MarkerSize", 9)));
|
||||
else if (strcmp(pstr, "quad") == 0)
|
||||
return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("SQUARE_FILLED", hGrp->GetInt("MarkerSize", 9)));
|
||||
else if (strcmp(pstr, "circle") == 0)
|
||||
return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_LINE", hGrp->GetInt("MarkerSize", 9)));
|
||||
else
|
||||
return Py_BuildValue("i", Gui::Inventor::MarkerBitmaps::getMarkerIndex("CIRCLE_FILLED", hGrp->GetInt("MarkerSize", 9)));
|
||||
}PY_CATCH;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user