fix inconsistencies between default action of context menu and double-click

This commit is contained in:
wmayer
2018-09-10 17:32:39 +02:00
parent 4e3b929fc8
commit 0388fa4bf9
6 changed files with 68 additions and 31 deletions

View File

@@ -23,7 +23,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
#ifndef _PreComp_
# include <Inventor/SoDB.h>
# include <Inventor/SoInput.h>
# include <Inventor/SbVec3f.h>
@@ -42,18 +42,20 @@
# include <Inventor/nodes/SoMarkerSet.h>
# include <Inventor/nodes/SoShapeHints.h>
# include <QFile>
# include <QAction>
# include <QMenu>
#endif
#include "ViewProviderTrajectory.h"
#include <Mod/Robot/App/TrajectoryObject.h>
#include <Mod/Robot/App/Trajectory.h>
#include <App/Document.h>
#include <App/Document.h>
#include <Base/FileInfo.h>
#include <Base/Stream.h>
#include <Base/Console.h>
#include <App/Application.h>
#include <Gui/Inventor/MarkerBitmaps.h>
#include <App/Application.h>
#include <Gui/Inventor/MarkerBitmaps.h>
#include <sstream>
using namespace Gui;
using namespace RobotGui;
@@ -62,9 +64,9 @@ using namespace Robot;
PROPERTY_SOURCE(RobotGui::ViewProviderTrajectory, Gui::ViewProviderGeometryObject)
ViewProviderTrajectory::ViewProviderTrajectory()
{
pcTrajectoryRoot = new Gui::SoFCSelection();
{
pcTrajectoryRoot = new Gui::SoFCSelection();
pcTrajectoryRoot->highlightMode = Gui::SoFCSelection::OFF;
pcTrajectoryRoot->selectionMode = Gui::SoFCSelection::SEL_OFF;
//pcRobotRoot->style = Gui::SoFCSelection::BOX;
@@ -84,7 +86,7 @@ ViewProviderTrajectory::ViewProviderTrajectory()
}
ViewProviderTrajectory::~ViewProviderTrajectory()
{
{
pcTrajectoryRoot->unref();
pcCoords->unref();
pcDrawStyle->unref();
@@ -108,32 +110,32 @@ void ViewProviderTrajectory::attach(App::DocumentObject *pcObj)
SoBaseColor * markcol = new SoBaseColor;
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 5));
marker->markerIndex=Gui::Inventor::MarkerBitmaps::getMarkerIndex("CROSS", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 5));
linesep->addChild(markcol);
linesep->addChild(marker);
pcTrajectoryRoot->addChild(linesep);
addDisplayMaskMode(pcTrajectoryRoot, "Waypoints");
addDisplayMaskMode(pcTrajectoryRoot, "Waypoints");
pcTrajectoryRoot->objectName = pcObj->getNameInDocument();
pcTrajectoryRoot->documentName = pcObj->getDocument()->getName();
pcTrajectoryRoot->subElementName = "Main";
}
void ViewProviderTrajectory::setDisplayMode(const char* ModeName)
{
if ( strcmp("Waypoints",ModeName)==0 )
setDisplayMaskMode("Waypoints");
ViewProviderGeometryObject::setDisplayMode( ModeName );
}
std::vector<std::string> ViewProviderTrajectory::getDisplayModes(void) const
{
std::vector<std::string> StrList;
StrList.push_back("Waypoints");
return StrList;
}
void ViewProviderTrajectory::setDisplayMode(const char* ModeName)
{
if ( strcmp("Waypoints",ModeName)==0 )
setDisplayMaskMode("Waypoints");
ViewProviderGeometryObject::setDisplayMode( ModeName );
}
std::vector<std::string> ViewProviderTrajectory::getDisplayModes(void) const
{
std::vector<std::string> StrList;
StrList.push_back("Waypoints");
return StrList;
}
void ViewProviderTrajectory::updateData(const App::Property* prop)
{
@@ -150,9 +152,16 @@ void ViewProviderTrajectory::updateData(const App::Property* prop)
}
pcLines->numVertices.set1Value(0, trak.getSize());
}else if (prop == &pcTracObj->Base) {
}
else if (prop == &pcTracObj->Base) {
Base::Placement loc = *(&pcTracObj->Base.getValue());
}
}
void ViewProviderTrajectory::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
{
QAction* act = menu->addAction(QObject::tr("Modify"), receiver, member);
act->setData(QVariant((int)ViewProvider::Default));
}

View File

@@ -51,10 +51,11 @@ public:
void attach(App::DocumentObject *pcObject);
void setDisplayMode(const char* ModeName);
std::vector<std::string> getDisplayModes() const;
void updateData(const App::Property*);
protected:
void updateData(const App::Property*);
void setupContextMenu(QMenu* menu, QObject* receiver, const char* member);
protected:
Gui::SoFCSelection * pcTrajectoryRoot;
SoCoordinate3 * pcCoords;
SoDrawStyle * pcDrawStyle;