#include <QKeyEvent>
const int DEFAULT_SHRINK = 80;
+const int UNDEF_SHRINK = -1;
//=================================================================================
// class : VisuGUI_ShrinkFactorDlg()
for ( ; anIter.More(); anIter.Next() ) {
Handle(SALOME_InteractiveObject) anIO = anIter.Value();
VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, anIO->getEntry() );
- if ( anActor && anActor->IsShrunkable() )
- anActor->SetShrinkFactor( shrink );
+ if ( anActor ) {
+ if ( anActor->IsShrunkable() )
+ anActor->SetShrinkFactor( shrink );
+ }
+ else {
+ VISU_ActorBase* anActor = VISU::FindActorBase(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry());
+ if ( anActor ) {
+ if ( anActor->IsShrunkable() )
+ anActor->SetShrinkFactor( shrink );
+ }
+ }
}
- myViewWindow->Repaint();
+ myViewWindow->Repaint();
}
}
{
bool shrinkable = false;
if ( myViewWindow ) {
- int shrink = DEFAULT_SHRINK;
+ int shrinkFactor = UNDEF_SHRINK;
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
- if ( aList.Extent() == 1 ) {
- Handle(SALOME_InteractiveObject) FirstIOS = aList.First();
- if ( !FirstIOS.IsNull() ) {
- VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, FirstIOS->getEntry() );
- if ( anActor ) {
- shrinkable = anActor->IsShrunkable();
- if ( shrinkable )
- shrink = int( anActor->GetShrinkFactor() * 100. + 0.5 );
- }
- }
- }
- else if ( aList.Extent() > 1 ) {
- SALOME_ListIteratorOfListIO It( aList );
- int setShr = -1;
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject) IO = It.Value();
- if (!IO.IsNull()) {
- VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, IO->getEntry() );
- if ( anActor ) {
- bool lshrinkable = anActor->IsShrunkable();
- shrinkable = shrinkable || lshrinkable;
- if ( lshrinkable ) {
- int shr = int( anActor->GetShrinkFactor() * 100. + 0.5 );
- if ( setShr < 0 )
- setShr = shr;
- else if ( setShr != shr ) {
- setShr = DEFAULT_SHRINK;
- break;
- }
- }
- }
- }
+ SALOME_ListIteratorOfListIO It( aList );
+ for ( ; It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) IO = It.Value();
+ if (!IO.IsNull()) {
+ bool ashrinkable = false;
+ int shr = UNDEF_SHRINK;
+ VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, IO->getEntry() );
+ if ( anActor ) {
+ ashrinkable = anActor->IsShrunkable();
+ if ( ashrinkable ) shr = int( anActor->GetShrinkFactor() * 100. + 0.5 );
+ }
+ else {
+ VISU_ActorBase* anActor = VISU::FindActorBase(VISU::GetAppStudy(myModule), myViewWindow, IO->getEntry());
+ if ( anActor ) {
+ ashrinkable = anActor->IsShrunkable();
+ if ( ashrinkable ) shr = int( anActor->GetShrinkFactor() * 100. + 0.5 );
+ }
+ }
+ shrinkable = shrinkable || ashrinkable;
+ if ( shr != UNDEF_SHRINK ) {
+ if ( shrinkFactor == UNDEF_SHRINK )
+ shrinkFactor = shr;
+ else if ( shrinkFactor != shr ) {
+ shrinkFactor = DEFAULT_SHRINK;
+ break;
+ }
+ }
}
- if ( setShr >= 0 )
- shrink = setShr;
}
ValueSpin->blockSignals( true );
- ValueSpin->setValue( shrink );
+ ValueSpin->setValue( shrinkFactor == UNDEF_SHRINK ? DEFAULT_SHRINK : shrinkFactor );
ValueSpin->blockSignals( false );
}
GroupC1->setEnabled( shrinkable );