Gui/SoFCSelection: added a methode for applying defaults from settings

This commit is contained in:
Alexander Golubev
2015-09-03 08:12:41 +03:00
committed by Stefan Tröger
parent 2a5d800940
commit e8e4f31b14
2 changed files with 43 additions and 8 deletions

View File

@@ -802,10 +802,10 @@ SoFCSelection::redrawHighlighted(SoAction * action , SbBool doHighlight )
//void* window;
//void* context;
//void *display;
QGLWidget* window;
QGLWidget* window;
SoGLRenderAction *glAction;
//SoWindowElement::get(state, window, context, display, glAction);
SoGLWidgetElement::get(state, window);
SoGLWidgetElement::get(state, window);
SoGLRenderActionElement::get(state, glAction);
// If we don't have a current window, then simply return...
@@ -917,4 +917,36 @@ SoFCSelection::isHighlighted(SoAction *action)
*currenthighlight == *actionPath);
}
void SoFCSelection::applySettings ()
{
// TODO Some view providers got copy of this code: make them use this (2015-09-03, Fat-Zer)
// Note: SoFCUnifiedSelection got the same code, keep in sync or think about a way to share it
float transparency;
ParameterGrp::handle hGrp = Gui::WindowParameter::getDefaultParameter()->GetGroup("View");
bool enablePre = hGrp->GetBool("EnablePreselection", true);
bool enableSel = hGrp->GetBool("EnableSelection", true);
if (!enablePre) {
this->highlightMode = Gui::SoFCSelection::OFF;
}
else {
// Search for a user defined value with the current color as default
SbColor highlightColor = this->colorHighlight.getValue();
unsigned long highlight = (unsigned long)(highlightColor.getPackedValue());
highlight = hGrp->GetUnsigned("HighlightColor", highlight);
highlightColor.setPackedValue((uint32_t)highlight, transparency);
this->colorHighlight.setValue(highlightColor);
}
if (!enableSel) {
this->selectionMode = Gui::SoFCSelection::SEL_OFF;
}
else {
// Do the same with the selection color
SbColor selectionColor = this->colorSelection.getValue();
unsigned long selection = (unsigned long)(selectionColor.getPackedValue());
selection = hGrp->GetUnsigned("SelectionColor", selection);
selectionColor.setPackedValue((uint32_t)selection, transparency);
this->colorSelection.setValue(selectionColor);
}
}
//#undef THIS