This branch adds a mouse cursor to the 'Measure Distance' tool.
This commit is contained in:
parent
a0454af685
commit
22278b7826
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
|
||||
* Copyright (c) 2002 J<EFBFBD>rgen Riegel <juergen.riegel@web.de> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
@ -2221,6 +2221,45 @@ StdCmdMeasureDistance::StdCmdMeasureDistance()
|
|||
eType = Alter3DView;
|
||||
}
|
||||
|
||||
// Yay for cheezy drawings!
|
||||
/* XPM */
|
||||
static const char * cursor_ruler[] = {
|
||||
"32 32 3 1",
|
||||
" c None",
|
||||
". c #FFFFFF",
|
||||
"+ c #FF0000",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" ",
|
||||
"..... ..... ",
|
||||
" ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ++ ",
|
||||
" . + + ",
|
||||
" . + ++ ",
|
||||
" + + + ",
|
||||
" + + + ",
|
||||
" + + ++ ",
|
||||
" + + + ",
|
||||
" + + ",
|
||||
" + + + ",
|
||||
" + + + ",
|
||||
" + + ",
|
||||
" + + + ",
|
||||
" + + + ",
|
||||
" + + ",
|
||||
" + + + ",
|
||||
" + + ++",
|
||||
" + + + ",
|
||||
" + + ",
|
||||
" + + ",
|
||||
" + + ",
|
||||
" + + ",
|
||||
" + "};
|
||||
void StdCmdMeasureDistance::activated(int iMsg)
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
|
@ -2228,6 +2267,10 @@ void StdCmdMeasureDistance::activated(int iMsg)
|
|||
if (view) {
|
||||
Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->setEditing(true);
|
||||
viewer->setEditingCursor(QCursor(QPixmap(cursor_ruler), 7, 7));
|
||||
|
||||
// Derives from QObject and we have a parent object, so we don't
|
||||
// require a delete.
|
||||
PointMarker* marker = new PointMarker(viewer);
|
||||
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
|
||||
ViewProviderMeasureDistance::measureDistanceCallback, marker);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> *
|
||||
* Copyright (c) 2004 J<EFBFBD>rgen Riegel <juergen.riegel@web.de> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
@ -171,7 +171,7 @@ View3DInventor::~View3DInventor()
|
|||
hGrp->Detach(this);
|
||||
|
||||
//If we destroy this viewer by calling 'delete' directly the focus proxy widget which is defined
|
||||
//by a widget in SoQtViewer isn't resetted. This widget becomes to a dangling pointer and makes
|
||||
//by a widget in SoQtViewer isn't reset. This widget becomes a dangling pointer and makes
|
||||
//the application crash. (Probably it's better to destroy this viewer by calling close().)
|
||||
//See also Gui::Document::~Document().
|
||||
QWidget* foc = qApp->focusWidget();
|
||||
|
|
|
@ -320,14 +320,10 @@ void ViewProviderMeasureDistance::measureDistanceCallback(void * ud, SoEventCall
|
|||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
if (mbe->getButton() == SoMouseButtonEvent::BUTTON2 && mbe->getState() == SoButtonEvent::UP) {
|
||||
n->setHandled();
|
||||
view->setEditing(false);
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), measureDistanceCallback, ud);
|
||||
pm->deleteLater();
|
||||
}
|
||||
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
|
||||
|
||||
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
|
||||
const SoPickedPoint * point = n->getPickedPoint();
|
||||
// I think this is where we need to snap. IR 20140630
|
||||
if (point == NULL) {
|
||||
Base::Console().Message("No point picked.\n");
|
||||
return;
|
||||
|
@ -343,5 +339,10 @@ void ViewProviderMeasureDistance::measureDistanceCallback(void * ud, SoEventCall
|
|||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), measureDistanceCallback, ud);
|
||||
pm->deleteLater();
|
||||
}
|
||||
} else if (mbe->getButton() != SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) {
|
||||
n->setHandled();
|
||||
view->setEditing(false);
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), measureDistanceCallback, ud);
|
||||
pm->deleteLater();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user