Gui: Rename SoFCHighlightAction to preselect terminology.

This commit is contained in:
tritao
2025-01-15 13:39:43 +00:00
parent e79b5ff9e8
commit 1d789a7972
5 changed files with 46 additions and 46 deletions

View File

@@ -69,7 +69,7 @@
using namespace Gui;
SO_ACTION_SOURCE(SoFCHighlightAction)
SO_ACTION_SOURCE(SoFCPreselectionAction)
/**
* The order of the defined SO_ACTION_ADD_METHOD statements is very important. First the base
@@ -79,28 +79,28 @@ SO_ACTION_SOURCE(SoFCHighlightAction)
* This means that \c SoSwitch must be listed after \c SoGroup and \c SoFCSelection after
* \c SoSeparator because both classes inherits the others.
*/
void SoFCHighlightAction::initClass()
void SoFCPreselectionAction::initClass()
{
SO_ACTION_INIT_CLASS(SoFCHighlightAction,SoAction);
SO_ACTION_INIT_CLASS(SoFCPreselectionAction,SoAction);
SO_ENABLE(SoFCHighlightAction, SoSwitchElement);
SO_ENABLE(SoFCPreselectionAction, SoSwitchElement);
SO_ACTION_ADD_METHOD(SoNode,nullAction);
SO_ENABLE(SoFCHighlightAction, SoModelMatrixElement);
SO_ENABLE(SoFCHighlightAction, SoShapeStyleElement);
SO_ENABLE(SoFCHighlightAction, SoComplexityElement);
SO_ENABLE(SoFCHighlightAction, SoComplexityTypeElement);
SO_ENABLE(SoFCHighlightAction, SoCoordinateElement);
SO_ENABLE(SoFCHighlightAction, SoFontNameElement);
SO_ENABLE(SoFCHighlightAction, SoFontSizeElement);
SO_ENABLE(SoFCHighlightAction, SoProfileCoordinateElement);
SO_ENABLE(SoFCHighlightAction, SoProfileElement);
SO_ENABLE(SoFCHighlightAction, SoSwitchElement);
SO_ENABLE(SoFCHighlightAction, SoUnitsElement);
SO_ENABLE(SoFCHighlightAction, SoViewVolumeElement);
SO_ENABLE(SoFCHighlightAction, SoViewingMatrixElement);
SO_ENABLE(SoFCHighlightAction, SoViewportRegionElement);
SO_ENABLE(SoFCPreselectionAction, SoModelMatrixElement);
SO_ENABLE(SoFCPreselectionAction, SoShapeStyleElement);
SO_ENABLE(SoFCPreselectionAction, SoComplexityElement);
SO_ENABLE(SoFCPreselectionAction, SoComplexityTypeElement);
SO_ENABLE(SoFCPreselectionAction, SoCoordinateElement);
SO_ENABLE(SoFCPreselectionAction, SoFontNameElement);
SO_ENABLE(SoFCPreselectionAction, SoFontSizeElement);
SO_ENABLE(SoFCPreselectionAction, SoProfileCoordinateElement);
SO_ENABLE(SoFCPreselectionAction, SoProfileElement);
SO_ENABLE(SoFCPreselectionAction, SoSwitchElement);
SO_ENABLE(SoFCPreselectionAction, SoUnitsElement);
SO_ENABLE(SoFCPreselectionAction, SoViewVolumeElement);
SO_ENABLE(SoFCPreselectionAction, SoViewingMatrixElement);
SO_ENABLE(SoFCPreselectionAction, SoViewportRegionElement);
@@ -125,28 +125,28 @@ void SoFCHighlightAction::initClass()
SO_ACTION_ADD_METHOD(SoPointSet,callDoAction);
}
void SoFCHighlightAction::finish()
void SoFCPreselectionAction::finish()
{
atexit_cleanup();
}
SoFCHighlightAction::SoFCHighlightAction (const SelectionChanges &SelCh)
SoFCPreselectionAction::SoFCPreselectionAction (const SelectionChanges &SelCh)
:SelChange(SelCh)
{
SO_ACTION_CONSTRUCTOR(SoFCHighlightAction);
SO_ACTION_CONSTRUCTOR(SoFCPreselectionAction);
}
SoFCHighlightAction::~SoFCHighlightAction() = default;
SoFCPreselectionAction::~SoFCPreselectionAction() = default;
void SoFCHighlightAction::beginTraversal(SoNode *node)
void SoFCPreselectionAction::beginTraversal(SoNode *node)
{
traverse(node);
}
void SoFCHighlightAction::callDoAction(SoAction *action,SoNode *node)
void SoFCPreselectionAction::callDoAction(SoAction *action,SoNode *node)
{
node->doAction(action);
}

View File

@@ -38,17 +38,17 @@ namespace Gui {
class SelectionChanges;
/**
* The SoFCHighlightAction class is used to inform an SoFCSelection node
* whether an object gets highlighted.
* The SoFCPreselectionAction class is used to inform an SoFCSelection node
* whether an object gets preselected.
* @author Jürgen Riegel
*/
class GuiExport SoFCHighlightAction : public SoAction
class GuiExport SoFCPreselectionAction : public SoAction
{
SO_ACTION_HEADER(SoFCHighlightAction);
SO_ACTION_HEADER(SoFCPreselectionAction);
public:
SoFCHighlightAction (const SelectionChanges &SelCh);
~SoFCHighlightAction() override;
SoFCPreselectionAction (const SelectionChanges &SelCh);
~SoFCPreselectionAction() override;
static void initClass();
static void finish();

View File

@@ -342,10 +342,10 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
this->colorHighlight = highlightColorAction->highlightColor;
}
if (action->getTypeId() == SoFCHighlightAction::getClassTypeId()) {
auto highlightAction = static_cast<SoFCHighlightAction*>(action);
// Do not clear currently highlighted object when setting new pre-selection
if (!setPreSelection && highlightAction->SelChange.Type == SelectionChanges::RmvPreselect) {
if (action->getTypeId() == SoFCPreselectionAction::getClassTypeId()) {
auto preselectAction = static_cast<SoFCPreselectionAction*>(action);
// Do not clear currently preselected object when setting new pre-selection
if (!setPreSelection && preselectAction->SelChange.Type == SelectionChanges::RmvPreselect) {
if (currentHighlightPath) {
SoHighlightElementAction highlightAction;
highlightAction.apply(currentHighlightPath);
@@ -354,7 +354,7 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
}
}
else if (preselectionMode.getValue() != OFF
&& highlightAction->SelChange.Type == SelectionChanges::SetPreselect) {
&& preselectAction->SelChange.Type == SelectionChanges::SetPreselect) {
if (currentHighlightPath) {
SoHighlightElementAction highlightAction;
highlightAction.apply(currentHighlightPath);
@@ -362,10 +362,10 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
currentHighlightPath = nullptr;
}
App::Document* doc = App::GetApplication().getDocument(highlightAction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(highlightAction->SelChange.pObjectName);
App::Document* doc = App::GetApplication().getDocument(preselectAction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(preselectAction->SelChange.pObjectName);
ViewProvider*vp = Application::Instance->getViewProvider(obj);
SoDetail* detail = vp->getDetail(highlightAction->SelChange.pSubName);
SoDetail* detail = vp->getDetail(preselectAction->SelChange.pSubName);
SoHighlightElementAction highlightAction;
highlightAction.setHighlighted(true);

View File

@@ -107,13 +107,13 @@ void Gui::SoFCDB::init()
SoFCBoundingBox ::initClass();
SoFCSelection ::initClass();
SoFCUnifiedSelection ::initClass();
SoFCHighlightAction ::initClass();
SoFCPreselectionAction ::initClass();
SoFCSelectionAction ::initClass();
SoFCDocumentAction ::initClass();
SoGLWidgetNode ::initClass();
SoGLVBOActivatedElement ::initClass();
SoFCEnableSelectionAction ::initClass();
SoFCEnableHighlightAction ::initClass();
SoFCEnablePreselectionAction ::initClass();
SoFCSelectionColorAction ::initClass();
SoFCHighlightColorAction ::initClass();
SoFCDocumentObjectAction ::initClass();
@@ -226,12 +226,12 @@ void Gui::SoFCDB::finish()
SoFCBackgroundGradient ::finish();
SoFCBoundingBox ::finish();
SoFCSelection ::finish();
SoFCHighlightAction ::finish();
SoFCPreselectionAction ::finish();
SoFCSelectionAction ::finish();
SoFCDocumentAction ::finish();
SoFCDocumentObjectAction ::finish();
SoFCEnableSelectionAction ::finish();
SoFCEnableHighlightAction ::finish();
SoFCEnablePreselectionAction ::finish();
SoFCSelectionColorAction ::finish();
SoUpdateVBOAction ::finish();
SoFCHighlightColorAction ::finish();

View File

@@ -794,11 +794,11 @@ void View3DInventorViewer::onSelectionChanged(const SelectionChanges & reason)
{
//Hint: do not create a tmp. instance of SelectionChanges
SelectionChanges selChanges(SelectionChanges::RmvPreselect);
SoFCHighlightAction cAct(selChanges);
cAct.apply(pcViewProviderRoot);
SoFCPreselectionAction preselectionAction(selChanges);
preselectionAction.apply(pcViewProviderRoot);
} else {
SoFCSelectionAction cAct(Reason);
cAct.apply(pcViewProviderRoot);
SoFCSelectionAction selectionAction(Reason);
selectionAction.apply(pcViewProviderRoot);
}
}
/// @endcond