#include <SUIT_Tools.h>
#include <SUIT_Session.h>
+#include <SUIT_Accel.h>
#include <QtxToolBar.h>
#include <QtxMRUAction.h>
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
+#include "ToolsGUI_CatalogGeneratorDlg.h"
+#include "ToolsGUI_RegWidget.h"
+
#define OBJECT_BROWSER_WIDTH 300
/*!Image for empty icon.*/
mySelMgr = new SalomeApp_SelectionMgr( this );
+ myAccel = new SUIT_Accel( desktop() );
+ myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, OCCViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, VTKViewer_Viewer::Type() );
+ myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, VTKViewer_Viewer::Type() );
+
connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
if ( actName == modName )
return true;
+ putInfo( tr( "ACTIVATING_MODULE" ).arg( modName ) );
+
saveWindowsGeometry();
bool status = CAM_Application::activateModule( modName );
updateModuleActions();
+ putInfo( "" );
+
if ( !status )
return false;
tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
CTRL+Key_P, desk, false, this, SLOT( onPreferences() ) );
+ //! Catalog Generator
+ createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIconSet(),
+ tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
+ 0, desk, false, this, SLOT( onCatalogGen() ) );
+
+ //! Registry Display
+ createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ), QIconSet(),
+ tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ),
+ 0, desk, false, this, SLOT( onRegDisplay() ) );
+
//! MRU
QtxMRUAction* mru = new QtxMRUAction( tr( "TOT_DESK_MRU" ), tr( "MEN_DESK_MRU" ), desk );
connect( mru, SIGNAL( activated( QString ) ), this, SLOT( onMRUActivated( QString ) ) );
createMenu( PreferencesId, fileMenu, 15, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
+ int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 50 );
+ createMenu( CatalogGenId, toolsMenu, 10, -1 );
+ createMenu( RegDisplayId, toolsMenu, 10, -1 );
+ createMenu( separator(), toolsMenu, -1, 15, -1 );
+
/*
createMenu( separator(), fileMenu, -1, 100, -1 );
createMenu( MRUId, fileMenu, 100, -1 );
updateObjectBrowser( true );
}
+/*!Delete references.*/
+void SalomeApp_Application::onDeleteReferences()
+{
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
+ mgr->selectedObjects(aList);
+
+ if (aList.Extent() < 1) return;
+
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ _PTR(Study) aStudyDS = aStudy->studyDS();
+ _PTR(StudyBuilder) aStudyBuilder = aStudyDS->NewBuilder();
+ _PTR(SObject) anObj;
+
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
+ {
+ if ( it.Value()->hasEntry() )
+ {
+ _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() );
+ if ( aSObject->ReferencedObject(anObj) )
+ aStudyBuilder->RemoveReference(aSObject);
+ }
+ }
+
+ updateObjectBrowser();
+}
+
/*!Private SLOT. */
void SalomeApp_Application::onOpenWith()
{
int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab );
int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), viewTab );
+
+ int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), viewTab );
+
pref->setItemProperty( occGroup, "columns", 1 );
pref->setItemProperty( vtkGroup, "columns", 1 );
+ pref->setItemProperty( plot2dGroup, "columns", 1 );
int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup,
SalomeApp_Preferences::IntSpin, "OCCViewer", "trihedron_size" );
pref->setItemProperty( vtkTS, "min", 1 );
pref->setItemProperty( vtkTS, "max", 150 );
-
+
+ pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
+ SalomeApp_Preferences::Bool, "Plot2d", "ShowLegend" );
+
+ int legendPosition = pref->addPreference( tr( "PREF_LEGEND_POSITION" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "LegendPos" );
+ QStringList aLegendPosList;
+ aLegendPosList.append( tr("PREF_LEFT") );
+ aLegendPosList.append( tr("PREF_RIGHT") );
+ aLegendPosList.append( tr("PREF_TOP") );
+ aLegendPosList.append( tr("PREF_BOTTOM") );
+
+ QValueList<QVariant> anIndexesList;
+ anIndexesList.append(0);
+ anIndexesList.append(1);
+ anIndexesList.append(2);
+ anIndexesList.append(3);
+
+ pref->setItemProperty( legendPosition, "strings", aLegendPosList );
+ pref->setItemProperty( legendPosition, "indexes", anIndexesList );
+
+ int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "CurveType" );
+ QStringList aCurveTypesList;
+ aCurveTypesList.append( tr("PREF_POINTS") );
+ aCurveTypesList.append( tr("PREF_LINES") );
+ aCurveTypesList.append( tr("PREF_SPLINE") );
+
+ anIndexesList.clear();
+ anIndexesList.append(0);
+ anIndexesList.append(1);
+ anIndexesList.append(2);
+
+ pref->setItemProperty( curveType, "strings", aCurveTypesList );
+ pref->setItemProperty( curveType, "indexes", anIndexesList );
+
+ int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup,
+ SalomeApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
+
+ pref->setItemProperty( markerSize, "min", 0 );
+ pref->setItemProperty( markerSize, "max", 100 );
+
+ QStringList aScaleModesList;
+ aScaleModesList.append( tr("PREF_LINEAR") );
+ aScaleModesList.append( tr("PREF_LOGARITHMIC") );
+
+ anIndexesList.clear();
+ anIndexesList.append(0);
+ anIndexesList.append(1);
+
+ int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
+
+ pref->setItemProperty( horScale, "strings", aScaleModesList );
+ pref->setItemProperty( horScale, "indexes", anIndexesList );
+
+ int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup,
+ SalomeApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
+
+ pref->setItemProperty( verScale, "strings", aScaleModesList );
+ pref->setItemProperty( verScale, "indexes", anIndexesList );
+
+ pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup,
+ SalomeApp_Preferences::Color, "Plot2d", "Background" );
+
int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat );
int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab );
pref->setItemProperty( dirGroup, "columns", 1 );
thePopup->insertSeparator();
thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
- // "Activate module" item should appear only if it's necessary
+ // Get selected objects
SALOME_ListIO aList;
SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
+
+ // "Delete reference" item should appear only for invalid references
+
+ // Check if selected objects is invalid references
+ bool isInvalidRefs = true;
+
+ if ( aList.Extent() < 1 )
+ isInvalidRefs = false;
+
+ if ( isInvalidRefs )
+ {
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ _PTR(Study) aStudyDS = aStudy->studyDS();
+ _PTR(SObject) anObj;
+
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More() && isInvalidRefs; it.Next() )
+ {
+ if ( it.Value()->hasEntry() )
+ {
+ _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() );
+ if ( aSObject->ReferencedObject(anObj) == false || !QString(anObj->GetName().c_str()).isEmpty() )
+ isInvalidRefs = false;
+ }
+ }
+ }
+
+ // Add "Delete refrence" item to popup
+ if ( isInvalidRefs )
+ {
+ thePopup->insertSeparator();
+ thePopup->insertItem( tr( "MEN_DELETE_REFERENCE" ), this, SLOT( onDeleteReferences() ) );
+ return;
+ }
+
+ // "Activate module" item should appear only if it's necessary
if (aList.Extent() != 1)
return;
Handle(SALOME_InteractiveObject) aIObj = aList.First();
if (currentModule && currentModule->moduleName() == aModuleTitle)
return;
thePopup->insertItem( tr( "MEN_OPENWITH" ), this, SLOT( onOpenWith() ) );
+
}
/*!Update obect browser*/
objectBrowser()->updateTree();
return res;
}
+
+/*!Display Catalog Genenerator dialog */
+void SalomeApp_Application::onCatalogGen()
+{
+ ToolsGUI_CatalogGeneratorDlg aDlg( desktop() );
+ aDlg.exec();
+}
+
+/*!Display Registry Display dialog */
+void SalomeApp_Application::onRegDisplay()
+{
+ CORBA::ORB_var anOrb = orb();
+ ToolsGUI_RegWidget* regWnd = ToolsGUI_RegWidget::GetRegWidget( anOrb, desktop(), "Registry" );
+ regWnd->show();
+ regWnd->raise();
+ regWnd->setActiveWindow();
+}
+
+/*!return keyborad accelerators manager object */
+SUIT_Accel* SalomeApp_Application::accel() const
+{
+ return myAccel;
+}