const int DIM = maxDim;
for ( int dim = Dim0D; dim <= Dim3D; ++dim ) {
bool enable = ( dim <= DIM );
- if ( !enable )
+ if ( !enable ) {
myTabs[ dim ]->reset();
- myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ dim ] ), enable );
+ disableTab( dim );
+ }
+ else {
+ enableTab( dim );
+ }
}
// deselect desabled tab
if ( !myTabWg->isTabEnabled( myTabWg->currentIndex() ) )
for ( int i = 0, n = theSets.count(); i < n; i++ ) {
aHypoSetPopup->addAction( theSets[ i ] );
}
- myHypoSetButton->setEnabled( !aHypoSetPopup->isEmpty() );
+ myHypoSetButton->setEnabled( !aHypoSetPopup->isEmpty() && isTabEnabled( Dim3D ) );
}
//================================================================================
//================================================================================
void SMESHGUI_MeshDlg::disableTab(const int theTabId) {
myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), false );
+ if ( theTabId == Dim3D ) myHypoSetButton->setEnabled( false );
}
//================================================================================
//================================================================================
void SMESHGUI_MeshDlg::enableTab(const int theTabId) {
myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), true );
+ if ( theTabId == Dim3D ) {
+ QMenu* aHypoSetPopup = myHypoSetButton->menu();
+ myHypoSetButton->setEnabled( aHypoSetPopup && !aHypoSetPopup->actions().isEmpty() );
+ }
}
//================================================================================
{
// Enable tabs according to shape dimension
- int shapeDim = 3;
+ int shapeDim = -1;
QStringList aGEOMs;
myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
}
if (aSeq->length() > 0) {
- shapeDim = 0;
+ //shapeDim = 0;
for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
GEOM::GEOM_Object_var aGeomVar = aSeq[iss];
switch ( aGeomVar->GetShapeType() ) {
case GEOM::SHELL:
{
//shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab
- shapeDim = (shapeDim < 2) ? 2 : shapeDim;
TopoDS_Shape aShape;
- if (GEOMBase::GetShape(aGeomVar, aShape)) {
- if (/*aShape.Closed()*/BRep_Tool::IsClosed(aShape))
- shapeDim = 3;
- }
+ bool isClosed = GEOMBase::GetShape(aGeomVar, aShape) && /*aShape.Closed()*/BRep_Tool::IsClosed(aShape);
+ shapeDim = qMax(isClosed ? 3 : 2, shapeDim);
}
break;
- case GEOM::FACE: shapeDim = (shapeDim < 2) ? 2 : shapeDim; break;
+ case GEOM::FACE: shapeDim = qMax(2, shapeDim); break;
case GEOM::WIRE:
- case GEOM::EDGE: shapeDim = (shapeDim < 1) ? 1 : shapeDim; break;
- case GEOM::VERTEX: break;
+ case GEOM::EDGE: shapeDim = qMax(1, shapeDim); break;
+ case GEOM::VERTEX: shapeDim = qMax(0, shapeDim); break;
default:
{
TopoDS_Shape aShape;
TopExp_Explorer exp (aShape, TopAbs_SHELL);
if (exp.More()) {
//shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab
- shapeDim = (shapeDim < 2) ? 2 : shapeDim;
+ shapeDim = qMax(2, shapeDim);
for (; exp.More() && shapeDim == 2; exp.Next()) {
if (/*exp.Current().Closed()*/BRep_Tool::IsClosed(exp.Current()))
shapeDim = 3;
}
}
else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
- shapeDim = (shapeDim < 2) ? 2 : shapeDim;
+ shapeDim = qMax(2, shapeDim);
else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
- shapeDim = (shapeDim < 1) ? 1 : shapeDim;
- else
- ;//shapeDim = 0;
+ shapeDim = qMax(1, shapeDim);
+ else if ( exp.Init( aShape, TopAbs_VERTEX ), exp.More() )
+ shapeDim = qMax(0, shapeDim);
}
}
}