#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
+#include <HYDROData_Image.h>
+
#include <GraphicsView_ViewFrame.h>
#include <GraphicsView_ViewManager.h>
#include <GraphicsView_ViewPort.h>
{
HYDROGUI_DataModel* aModel = getDataModel();
+ size_t aViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( this );
+
bool anIsSelection = false;
bool anIsVisibleInSelection = false;
bool anIsHiddenInSelection = false;
bool anIsImage = false;
+ bool anIsCompositeImage = false;
bool anIsPolyline = false;
+ bool anIsVisualState = false;
HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
anIsSelection = true;
- bool aVisibility = anObject->GetVisibility();
+ bool aVisibility = anObject->IsVisible( aViewId );
anIsVisibleInSelection |= aVisibility;
anIsHiddenInSelection |= !aVisibility;
if( anObject->GetKind() == KIND_IMAGE )
+ {
anIsImage = true;
-
- if( anObject->GetKind() == KIND_POLYLINE )
+ Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( anObject );
+ if( !anImage.IsNull() )
+ anIsCompositeImage = anImage->NbReferences() > 0;
+ }
+ else if( anObject->GetKind() == KIND_POLYLINE )
anIsPolyline = true;
+ else if( anObject->GetKind() == KIND_VISUAL_STATE )
+ anIsVisualState = true;
}
}
- if( aSeq.Length() == 1 )
+ if( aSeq.IsEmpty() )
+ {
+ theMenu->addAction( action( SaveVisualStateId ) );
+ theMenu->addSeparator();
+ }
+ else if( anIsSelection && aSeq.Length() == 1 )
{
if( anIsImage )
{
- theMenu->addAction( action( EditImageId ) );
+ theMenu->addAction( action( anIsCompositeImage ? EditCompositeImageId : EditImportedImageId ) );
theMenu->addAction( action( ObserveImageId ) );
theMenu->addAction( action( ExportImageId ) );
theMenu->addSeparator();
theMenu->addAction( action( EditPolylineId ) );
theMenu->addSeparator();
}
+ else if( anIsVisualState )
+ {
+ theMenu->addAction( action( SaveVisualStateId ) );
+ theMenu->addAction( action( LoadVisualStateId ) );
+ theMenu->addSeparator();
+ }
}
if( anIsSelection )
theMenu->addSeparator();
}
- if( anIsSelection )
+ if( anIsSelection && ( anIsImage || anIsPolyline ) )
{
if( anIsHiddenInSelection )
theMenu->addAction( action( ShowId ) );
theMenu->addAction( action( HideId ) );
theMenu->addSeparator();
}
+
theMenu->addAction( action( ShowAllId ) );
theMenu->addAction( action( HideAllId ) );
theMenu->addSeparator();