From a928854e354c7fe55be0a50688ffc6ed5c1d6a79 Mon Sep 17 00:00:00 2001 From: smh Date: Mon, 26 Jan 2004 14:03:23 +0000 Subject: [PATCH] MPV: Merge V1.2c --- src/SALOMEGUI/QAD_Application.cxx | 11 +- src/SALOMEGUI/QAD_Desktop.cxx | 301 +++++++++++++++++++--- src/SALOMEGUI/QAD_Desktop.h | 25 +- src/SALOMEGUI/QAD_FileDlg.cxx | 32 ++- src/SALOMEGUI/QAD_HelpWindow.cxx | 42 +-- src/SALOMEGUI/QAD_ObjectBrowser.cxx | 134 ++++++++-- src/SALOMEGUI/QAD_ObjectBrowser.h | 13 + src/SALOMEGUI/QAD_Study.cxx | 16 +- src/SALOMEGUI/QAD_Study.h | 1 + src/SALOMEGUI/QAD_StudyFrame.cxx | 1 - src/SALOMEGUI/QAD_StudyFrame.h | 1 - src/SALOMEGUI/QAD_Tools.cxx | 2 +- src/SALOMEGUI/QAD_ViewFrame.h | 4 +- src/SALOMEGUI/QAD_icons.po | 9 + src/SALOMEGUI/QAD_msg_en.po | 24 ++ src/SALOMEGUI/SALOMEGUI_Application.cxx | 2 +- src/SALOMEGUI/SALOMEGUI_SetValueDlg.cxx | 41 +++ src/SALOMEGUI/SALOMEGUI_SetValueDlg.h | 9 + src/SALOMEGUI/SALOMEGUI_msg_en.po | 2 +- src/SALOMEGUI/SALOMEGUI_msg_fr.po | 6 +- src/SALOME_PYQT/SalomePyQt.cxx | 4 + src/SALOME_PYQT/SalomePyQt.hxx | 1 + src/SALOME_PYQT/SalomePyQt.sip | 1 + src/SALOME_SWIG/salome_test.py | 7 + src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx | 4 +- src/SUPERVGraph/SUPERVGraph_ViewFrame.h | 2 +- src/Session/SALOME_Session_i.cxx | 2 + src/Utils/Utils_SINGLETON.hxx | 4 +- 28 files changed, 579 insertions(+), 122 deletions(-) diff --git a/src/SALOMEGUI/QAD_Application.cxx b/src/SALOMEGUI/QAD_Application.cxx index a0b08aa45..439362886 100644 --- a/src/SALOMEGUI/QAD_Application.cxx +++ b/src/SALOMEGUI/QAD_Application.cxx @@ -396,7 +396,7 @@ const QString& QAD_Application::getStudyExtension() const */ bool QAD_Application::isStudyOpened( const QString& studyName ) { - QString Name = QAD_Tools::getFileNameFromPath( studyName, false ); + QString Name = QAD_Tools::getFileNameFromPath( studyName, true ); return (( getStudyByName( studyName ) != NULL ) || (getStudyByName( Name ) != NULL )); } @@ -464,7 +464,7 @@ void QAD_Application::helpAbout() void QAD_Application::helpSearch() { /* just calls QAD_Desktop::helpSearch() but can have own implementation */ - // getDesktop()->helpSearch(); +// getDesktop()->helpSearch(); } /*! @@ -473,7 +473,7 @@ void QAD_Application::helpSearch() void QAD_Application::helpContents() { /* just calls QAD_Desktop::helpContents() but can have own implementation */ - // getDesktop()->helpContents(); +// getDesktop()->helpContents(); } /*! @@ -801,7 +801,7 @@ QAD_Study* QAD_Application::newStudy() while ( exist ) { exist = false; for (unsigned int ind = 0; ind < List->length();ind++) { - QString NameS = QAD_Tools::getFileNameFromPath( QString( List[ind] ), false ); + QString NameS = QAD_Tools::getFileNameFromPath( QString( List[ind] ), true ); if ( NameS.compare( StudyName ) == 0 ) { StudyName = getDesktop()->getNewStudyName(); exist = true; @@ -914,8 +914,9 @@ QAD_Study* QAD_Application::openStudy( const QString& fileName ) /* open StudyDS */ SALOMEDS::Study_var aStudy = myStudyMgr->Open((char*) name.latin1()); + //MPV: name of the study is set in the study manager now //NRI DEBUG : 11/02/2002 - aStudy->Name( QAD_Tools::getFileNameFromPath(name,false) ); + //aStudy->Name( QAD_Tools::getFileNameFromPath(name,true) ); /* create QAD study */ openStudy = new QAD_Study( this, aStudy, fileName ); diff --git a/src/SALOMEGUI/QAD_Desktop.cxx b/src/SALOMEGUI/QAD_Desktop.cxx index 89a1bf2b8..2c9111917 100644 --- a/src/SALOMEGUI/QAD_Desktop.cxx +++ b/src/SALOMEGUI/QAD_Desktop.cxx @@ -53,7 +53,7 @@ using namespace std; #include "QAD_ObjectBrowser.h" #include "QAD_Resource.h" #include "QAD_FileDlg.h" -//NRI#include "QAD_HelpWindow.h" +//NRI #include "QAD_HelpWindow.h" #include "QAD_DirListDlg.h" #include "QAD_WaitCursor.h" #include "SALOMEGUI_OpenWith.h" @@ -66,6 +66,7 @@ using namespace std; #include "SALOME_ListIteratorOfListIO.hxx" #include "SALOMEGUI_AboutDlg.h" #include "SALOMEGUI_ViewChoiceDlg.h" +#include "SALOMEGUI_SetValueDlg.h" #include "utilities.h" #include "SALOMEGUI_CloseDlg.h" @@ -113,6 +114,18 @@ extern "C" QAD_ResourceMgr* QAD_Desktop::resourceMgr = 0; QPalette* QAD_Desktop::palette = 0; +static QString createString( int theItemId, int thePosId ) +{ + QString aRetString = QString("item-id="); + QString aString; + QString aItemId = aString.setNum(theItemId); + QString aPosId = aString.setNum(thePosId); + aRetString = aRetString + '"'; aRetString = aRetString + aItemId; aRetString = aRetString + '"'; + aRetString = aRetString + " pos-id="; aRetString = aRetString + '"'; + aRetString = aRetString + aPosId; + aRetString = aRetString + '"'; aRetString = aRetString + ">"; + return aRetString; +} /*! Creates the resource manager [ static ] @@ -457,7 +470,7 @@ void QAD_Desktop::createActions() myMainMenu->insertItem ( tr("MEN_DESK_VIEW"), &myViewPopup, 2 ); /* add popup VIEW */ myMainMenu->insertItem ( tr("MEN_DESK_TOOLS"), &myToolsPopup, 5 ); /* add popup TOOLS */ myMainMenu->insertItem ( tr("MEN_DESK_PREF"), &myPrefPopup, 4 ); /* add popup PREF */ - myMainMenu->insertItem ( tr("MEN_DESK_WINDOW"), &myWindowPopup, 6 );/* add popup WINDOW */ + myMainMenu->insertItem ( tr("MEN_DESK_WINDOW"), &myWindowPopup, 6 ); /* add popup WINDOW */ myMainMenu->insertItem ( tr("MEN_DESK_HELP"), &myHelpPopup, 7 ); /* add popup HELP */ /* Applications will insert their items after 'File' 'Edit' and 'View' @@ -728,6 +741,8 @@ void QAD_Desktop::createActions() QAD_ASSERT(connect( myQAG, SIGNAL(selected(QActionP * )), this, SLOT(onDefaultViewer(QActionP *) ))); //VRV: T2.5 - add default viewer + myPrefPopup.insertSeparator(); + QActionP* viewerTrihedronAction = new QActionP( "", tr("MEN_DESK_PREF_VIEWER_TRIHEDRON"), 0, this ); QAD_ASSERT(connect( viewerTrihedronAction, SIGNAL(activated()), this, SLOT(onViewerTrihedron() ))); viewerTrihedronAction->addTo( &myPrefPopup ); @@ -756,6 +771,12 @@ void QAD_Desktop::createActions() ASCIISaveAction->addTo( &myPrefPopup ); myStdActions.insert( PrefASCIISave, ASCIISaveAction ); + /* Undo level */ + QActionP* UndoLevelAction = new QActionP( "", tr("MEN_DESK_PREF_UNDO_LEVEL"), 0, this ); + QAD_ASSERT(connect( UndoLevelAction, SIGNAL(activated()), this, SLOT(onUndoLevel() ))); + UndoLevelAction->addTo( &myPrefPopup ); + myStdActions.insert( PrefUndoLevelId, UndoLevelAction ); + myPrefPopup.insertSeparator(); /* External Browser */ @@ -811,7 +832,7 @@ void QAD_Desktop::createActions() QActionP* objectBrowserCHRONO_SORTAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT"), 0, this, 0, true ); QAD_ASSERT(connect( objectBrowserCHRONO_SORTAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() ))); objectBrowserCHRONO_SORTAction->setToggleAction(true); - QString showSORT = QAD_CONFIG->getSetting("ObjectBrowser:CHRONO_SORT"); + QString showSORT = QAD_CONFIG->getSetting("ObjectBrowser:ChronologicalSort"); if ( showSORT.compare( aTrueQString ) == 0 ) objectBrowserCHRONO_SORTAction->setOn(true) ; @@ -821,6 +842,34 @@ void QAD_Desktop::createActions() objectBrowserCHRONO_SORTAction->addTo( &myObjBrowserPopup ); myStdActions.insert( PrefObjectBrowserCHRONO_SORTId, objectBrowserCHRONO_SORTAction ) ; + /* Show or don't Show UseCase browser */ + QActionP* objectBrowserShowUseCaseAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_SHOW_USECASE"), 0, this, 0, true ); + QAD_ASSERT(connect( objectBrowserShowUseCaseAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() ))); + objectBrowserShowUseCaseAction->setToggleAction(true); + QString showUseCase = QAD_CONFIG->getSetting("ObjectBrowser:ShowUseCaseBrowser"); + + if ( showUseCase.compare( aTrueQString ) == 0 ) + objectBrowserShowUseCaseAction->setOn(true) ; + else + objectBrowserShowUseCaseAction->setOn(false) ; + + objectBrowserShowUseCaseAction->addTo( &myObjBrowserPopup ); + myStdActions.insert( PrefObjectBrowserShowUseCaseId, objectBrowserShowUseCaseAction ) ; + + /* Resize or don't resize columns automatically */ + QActionP* objectBrowserNoAutoSizeAction = new QActionP( "", tr("MEN_DESK_PREF_OBJECTBROWSER_NO_AUTOSIZE"), 0, this, 0, true ); + QAD_ASSERT(connect( objectBrowserNoAutoSizeAction, SIGNAL(activated()), this, SLOT(onObjectBrowser() ))); + objectBrowserNoAutoSizeAction->setToggleAction(true); + QString noAutoSize = QAD_CONFIG->getSetting("ObjectBrowser:NoAutoSizeColumns"); + + if ( noAutoSize.compare( aTrueQString ) == 0 ) + objectBrowserNoAutoSizeAction->setOn(true) ; + else + objectBrowserNoAutoSizeAction->setOn(false) ; + + objectBrowserNoAutoSizeAction->addTo( &myObjBrowserPopup ); + myStdActions.insert( PrefObjectBrowserNoAutoSizeColumnsId, objectBrowserNoAutoSizeAction ) ; + myPrefPopup.insertSeparator(); QActionP* dirAction = new QActionP( "", tr("MEN_DESK_PREF_DIRICTORIES"), ALT+Key_D, this ); @@ -1169,6 +1218,18 @@ QAD_Study* QAD_Desktop::findStudy( SALOMEDS::Study_ptr theStudy ) return 0; } +/*! + Gets value of max undo level for SALOMEDS::Study's from preferences +*/ +int QAD_Desktop::getUndoLevel() +{ + static int MAX_UNDO = 10; + int anUndoLevel = MAX_UNDO; + QString aLevel = QAD_CONFIG->getSetting("Desktop:UndoLevel"); + if(!aLevel.isEmpty()) anUndoLevel = aLevel.toInt(); + return anUndoLevel; +} + /*! Returns current active application */ @@ -1436,8 +1497,8 @@ void QAD_Desktop::onLoadStudy() //don't ask user to remove study permanently if (app->getStudyByName ( name ) != NULL) onCloseStudy ( app->getStudyByName ( name ), false ); - else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )) != NULL) - onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )), false ); + else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )) != NULL) + onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )), false ); } appFound = true; @@ -1525,8 +1586,7 @@ void QAD_Desktop::onOpenStudy() SALOMEDS::ListOfOpenStudies_var List = myStudyMgr->GetOpenStudies(); for (unsigned int ind = 0; ind < List->length();ind++) { QString NameExistingStudy(List[ind]); - QString NameOpeningStudy = QAD_Tools::getFileNameFromPath( name, false ); - + QString NameOpeningStudy = QAD_Tools::getFileNameFromPath( name, true ); if ( NameExistingStudy.compare( NameOpeningStudy ) == 0 ) { if ( QAD_MessageBox::warn2 ( this, tr("WRN_WARNING"), tr("QUE_DOC_ALREADYEXIST").arg( name ), @@ -1571,8 +1631,8 @@ void QAD_Desktop::onOpenStudy() //don't ask user to remove study permanently if (app->getStudyByName ( name ) != NULL) onCloseStudy ( app->getStudyByName ( name ), false ); - else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )) != NULL) - onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, false )), false ); + else if (app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )) != NULL) + onCloseStudy ( app->getStudyByName ( QAD_Tools::getFileNameFromPath( name, true )), false ); } appFound = true; @@ -1634,10 +1694,10 @@ bool QAD_Desktop::loadComponentData( const QString& compName ) if (!CORBA::is_nil(driver)) { SALOMEDS::StudyBuilder_var B = aStudy->NewBuilder(); if (!CORBA::is_nil(B)) { - QAD_Operation* op = new QAD_Operation( myActiveStudy ); - op->start(); +// QAD_Operation* op = new QAD_Operation( myActiveStudy ); +// op->start(); B->LoadWith(SCO,driver); - op->finish(); +// op->finish(); } else { return false; } @@ -2029,8 +2089,8 @@ void QAD_Desktop::onNewWindow3d() class RunBrowser: public QThread { public: - RunBrowser(QString theApp, QString theParams, QString theHelpFile): - myApp(theApp), myParams(theParams), myHelpFile(theHelpFile), myStatus(0) {}; + RunBrowser(QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL): + myApp(theApp), myParams(theParams), myHelpFile("file:" + theHelpFile + theContext), myStatus(0) {}; virtual void run() { @@ -2088,9 +2148,8 @@ void QAD_Desktop::onHelpContents() return; } } - - QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); - + + QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application"); QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters"); @@ -2103,7 +2162,6 @@ void QAD_Desktop::onHelpContents() */ void QAD_Desktop::onHelpContentsGUI() { - // QCString dir; // QString root; // QString homeDir; @@ -2123,9 +2181,7 @@ void QAD_Desktop::onHelpContentsGUI() // } // if ( root.isEmpty() ) // root = "./doc/"; - // QString helpFile = QFileInfo( homeDir + "salomedoc.html" ).absFilePath(); - // QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application"); // QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters"); @@ -2155,7 +2211,7 @@ void QAD_Desktop::onHelpContentsTUI() return; } } - + QString helpFile = QFileInfo( homeDir + "index.html" ).absFilePath(); QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application"); @@ -2536,6 +2592,14 @@ bool QAD_Desktop::loadComponent(QString Component) QXmlSimpleReader reader; reader.setContentHandler( myXmlHandler ); reader.setErrorHandler( myXmlHandler ); + + bool IsMaxActStudy = myActiveStudy->getActiveStudyFrame()->isMaximized(); + if (IsMaxActStudy) { + QString aSourceData = source.data(); + aSourceData = changeXmlInputSourceData( aSourceData, Component ); + source.setData(aSourceData); + } + bool ok = reader.parse( source ); file.close(); if ( !ok ) { @@ -2705,6 +2769,119 @@ bool QAD_Desktop::loadComponent(QString Component) return true; } +QString QAD_Desktop::changeXmlInputSourceData(QString theData, QString theComponent) +{ + if ( theComponent=="Supervision" ) { + //Supervision main menu item + int aItemId = 300; + int aPosId = 3; + QString aStrOld = createString( aItemId, aPosId ); + QString aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + } + + if ( theComponent == "Visu" ) { + //Visualization main menu item + int aItemId = 401; + int aPosId = 3; + QString aStrOld = createString( aItemId, aPosId ); + QString aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Selection main menu item + aItemId = 41; + aPosId = 4; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Representation main menu item + aItemId = 42; + aPosId = 5; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + } + + if ( theComponent == "SMESH" ) { + //Hypotheses main menu item + int aItemId = 50; + int aPosId = 3; + QString aStrOld = createString( aItemId, aPosId ); + QString aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Mesh main menu item + aItemId = 70; + aPosId = 4; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Controls main menu item + aItemId = 60; + aPosId = 5; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Modification main menu item + aItemId = 40; + aPosId = 6; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Numbering main menu item + aItemId = 80; + aPosId = 7; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + } + + if ( theComponent == "Geometry" ) { + //New Entity main menu item + int aItemId = 70; + int aPosId = 3; + QString aStrOld = createString( aItemId, aPosId ); + QString aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Operations main menu item + aItemId = 40; + aPosId = 4; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Repair main menu item + aItemId = 50; + aPosId = 5; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + + //Measures main menu item + aItemId = 60; + aPosId = 6; + aStrOld = createString( aItemId, aPosId ); + aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + } + + if ( theComponent == "Med" ) { + //MED main menu item + int aItemId = 90; + int aPosId = 3; + QString aStrOld = createString( aItemId, aPosId ); + QString aStrNew = createString( aItemId, aPosId+1 ); + theData = theData.replace( QRegExp(aStrOld), aStrNew ); + } + + return theData; +} + typedef bool OneDim(int, QAD_Desktop*); typedef void (*PTR_FACTORY_FUNCTION)( CORBA::ORB_var &orb, QWidget *parent, const char *name ) ; @@ -2931,6 +3108,7 @@ void QAD_Desktop::onComboActiveComponent( const QString & component, bool isLoad /*! */ void QAD_Desktop::activateComponent(const QString& theName, bool isLoadData){ + int nbItem = myCombo->count(); int Index = 0; @@ -3223,10 +3401,30 @@ void QAD_Desktop::onObjectBrowser() bool showCHRONO_SORT ; if ( myStdActions.at( PrefObjectBrowserCHRONO_SORTId )->isOn() ) { showCHRONO_SORT = true; - QAD_CONFIG->addSetting( "ObjectBrowser:CHRONO_SORT", "true"); + QAD_CONFIG->addSetting( "ObjectBrowser:ChronologicalSort", "true"); } else { showCHRONO_SORT = false; - QAD_CONFIG->addSetting( "ObjectBrowser:CHRONO_SORT", "false"); + QAD_CONFIG->addSetting( "ObjectBrowser:ChronologicalSort", "false"); + } + + /* To show or not to show UseCase browser */ + bool showUseCase; + if ( myStdActions.at( PrefObjectBrowserShowUseCaseId )->isOn() ) { + showUseCase = true; + QAD_CONFIG->addSetting( "ObjectBrowser:ShowUseCaseBrowser", "true"); + } else { + showUseCase = false; + QAD_CONFIG->addSetting( "ObjectBrowser:ShowUseCaseBrowser", "false"); + } + + /* Resize or don't resize columns automatically */ + bool autoSize; + if ( myStdActions.at( PrefObjectBrowserNoAutoSizeColumnsId )->isOn() ) { + autoSize = false; + QAD_CONFIG->addSetting( "ObjectBrowser:NoAutoSizeColumns", "true"); + } else { + autoSize = true; + QAD_CONFIG->addSetting( "ObjectBrowser:NoAutoSizeColumns", "false"); } if ( myActiveApp ) { @@ -3239,6 +3437,8 @@ void QAD_Desktop::onObjectBrowser() sf->getLeftFrame()->getObjectBrowser()->setShowValueColumn( showValue ); sf->getLeftFrame()->getObjectBrowser()->setEnableChronoSort( showCHRONO_SORT ); // sf->getLeftFrame()->getObjectBrowser()->setShowIAPP( showIAPP ); // this is done by below updateObjBrowser() call + sf->getLeftFrame()->getObjectBrowser()->showUseCaseBrowser( showUseCase ); + sf->getLeftFrame()->getObjectBrowser()->autoSizeColumns( autoSize ); } study->updateObjBrowser(true); } @@ -3265,7 +3465,7 @@ void QAD_Desktop::onViewerTrihedron() for ( QAD_Study* study = studies.first(); study; study = studies.next() ) { int nbSf = study->getStudyFramesCount(); for ( int i = 0; i < nbSf; i++ ) { - study->getStudyFrame(i)->getRightFrame()->getViewFrame()->SetTrihedronSize((int)dim); + study->getStudyFrame(i)->getRightFrame()->getViewFrame()->onAdjustTrihedron(); } } } @@ -3553,13 +3753,19 @@ void QAD_Desktop::helpAbout() // } /* Help Context */ -// void QAD_Desktop::helpContext(const QString& source, const QString& context) -// { -// // getHelpWindow()->context(source, context); -// // getHelpWindow()->show(); -// // getHelpWindow()->raise(); -// // getHelpWindow()->setActiveWindow(); -// } +//void QAD_Desktop::helpContext(const QString& source, const QString& context) +//{ +// //getHelpWindow()->context(source, context); //implemented in QAD_HelpWindow::context( const QString& _source, const QString& _context) +// //getHelpWindow()->show(); //from QMainWindow class +// //getHelpWindow()->raise(); //from QMainWindow class +// //getHelpWindow()->setActiveWindow(); //from QMainWindow class + +// QString anApp = QAD_CONFIG->getSetting("ExternalBrowser:Application"); +// QString aParams = QAD_CONFIG->getSetting("ExternalBrowser:Parameters"); + +// RunBrowser* rs = new RunBrowser(anApp, aParams, source, context); +// rs->start(); +//} /* Preferences/MultiFile Save */ void QAD_Desktop::onMultiFileSave() @@ -3579,6 +3785,39 @@ void QAD_Desktop::onASCIISave() QAD_CONFIG->addSetting( "Desktop:ASCIISave", "false"); } +/* Preferences / Undo Level */ +void QAD_Desktop::onUndoLevel() +{ + static int MAX_UNDO_LEVEL = 1000; + bool isAccepted = false; + static QString aLabel = QString("Level value (%1 ... %2) : "). + arg(1).arg(MAX_UNDO_LEVEL); + int anUndoLevel = + SALOMEGUI_SetValueDlg::getInteger("Undo Level",aLabel, + 1,MAX_UNDO_LEVEL,getUndoLevel(), + &isAccepted); + if(!isAccepted) return; + QAD_CONFIG->addSetting("Desktop:UndoLevel", anUndoLevel); + if(!myActiveApp) return; + QList& studies = myActiveApp->getStudies(); + int aWasWarning = 0; + for(QAD_Study* study = studies.first(); study; study = studies.next()){ + SALOMEDS::Study_var aStudyDoc = study->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDoc->NewBuilder(); + if (!aStudyDoc->GetProperties()->IsLocked()) { + aStudyBuilder->UndoLimit(anUndoLevel); + } else { + if (!aWasWarning) { + QAD_MessageBox::warn1 ((QWidget*)QAD_Application::getDesktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK")); + aWasWarning = 1; + } + } + } +} + /********************************************************************* ** Class: AppSelectionDlg ** Descr: Dialog for the selection of the application when several diff --git a/src/SALOMEGUI/QAD_Desktop.h b/src/SALOMEGUI/QAD_Desktop.h index c8743a3c2..56f8a7907 100644 --- a/src/SALOMEGUI/QAD_Desktop.h +++ b/src/SALOMEGUI/QAD_Desktop.h @@ -34,7 +34,7 @@ #include "QAD_Application.h" #include "QAD_OperatorMenus.h" #include "QAD_Menus.h" -//NRI #include "QAD_HelpWindow.h" +//NRI#include "QAD_HelpWindow.h" #include "QAD_Action.h" #include "SALOME_NamingService.hxx" @@ -79,8 +79,9 @@ protected: DefaultViewerOCCId, DefaultViewerVTKId, DefaultGraphSupervisorId, DefaultPlot2dId, //VRV: T2.5 - add default viewer PrefViewerTrihedronId, PrefConsoleFontId, PrefObjectBrowserEntryId, - PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId, - PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefExternalBrowserId, PrefSaveId, + PrefObjectBrowserIAPPId, PrefObjectBrowserValueId, PrefObjectBrowserCHRONO_SORTId,PrefObjectBrowserShowUseCaseId, + PrefObjectBrowserNoAutoSizeColumnsId, + PrefDirsId, PrefMultiFileSave, PrefASCIISave, PrefUndoLevelId, PrefExternalBrowserId, PrefSaveId, //NRI : SAL2214 WindowNew3dId, ViewOCCId, ViewVTKId, ViewPlot2dId, //NRI : SAL2214 @@ -144,14 +145,15 @@ public: QWorkspaceP* getMainFrame() const; QString getNewStudyName(); QAD_Study* findStudy( SALOMEDS::Study_ptr theStudy ); - + static int getUndoLevel(); /* help actions */ virtual void helpAbout(); -/* virtual void helpSearch(); */ -/* virtual void helpContents(); */ -/* virtual void helpContext(const QString& path, const QString& dir = QString::null); */ - +/* virtual void helpSearch(); + virtual void helpContents(); + virtual void helpContext(const QString& path, const QString& dir = QString::null); +*/ bool loadComponent(QString); + QString changeXmlInputSourceData(QString theData, QString theComponent); void activateComponent(const QString& theName, bool isLoadData = true); void createStudy(); @@ -236,6 +238,7 @@ protected slots: void onObjectBrowser(); void onMultiFileSave(); void onASCIISave(); + void onUndoLevel(); void onExternalBrowser(); void onActivateApp(QAD_Application* app); @@ -244,7 +247,7 @@ protected slots: void onHelpContents(); void onHelpContentsGUI(); void onHelpContentsTUI(); -/* void onHelpSearch(); */ +/* void onHelpSearch(); */ void onHelpAbout(); void onNewWindow3d(); @@ -260,7 +263,7 @@ protected slots: void onComboActiveComponent( const QString & , bool isLoadData); void onCascade(); - //NRI void onHelpWindowClosed(); +/* NRI void onHelpWindowClosed(); */ protected: QMenuBar* myMainMenu; /* the main menu bar */ @@ -308,7 +311,7 @@ protected: QList myMenusList; QAD_Menus* myActiveMenus; - //NRI QAD_HelpWindow* myHelpWindow; + //NRI QAD_HelpWindow* myHelpWindow; QList myComponentButton; diff --git a/src/SALOMEGUI/QAD_FileDlg.cxx b/src/SALOMEGUI/QAD_FileDlg.cxx index 2d626eb96..df22e1e21 100644 --- a/src/SALOMEGUI/QAD_FileDlg.cxx +++ b/src/SALOMEGUI/QAD_FileDlg.cxx @@ -227,10 +227,11 @@ void QAD_FileDlg::addExtension() // if ( mySelectedFile.isEmpty() )//VSR- 06/12/02 if ( mySelectedFile.stripWhiteSpace().isEmpty() )//VSR+ 06/12/02 return; - + // if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() ) //VSR- 06/12/02 - if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() && !mySelectedFile.contains(".") ) //VSR+ 06/12/02 - { +//ota : 16/12/03 if ( QAD_Tools::getFileExtensionFromPath( mySelectedFile ).isEmpty() ) //VSR+ 06/12/02 +// { + #if QT_VERSION < 0x030000 QRegExp r( QString::fromLatin1("([a-zA-Z0-9.*? +;#]*)$") ); int len, index = r.match( selectedFilter(), 0, &len ); @@ -247,11 +248,28 @@ void QAD_FileDlg::addExtension() // QString wildcard = selectedFilter().mid( index + 1, r.matchedLength()-2 ); //VSR- 06/12/02 QString wildcard = selectedFilter().mid( index + 1, r.matchedLength()-2 ).stripWhiteSpace(); //VSR+ 06/12/02 #endif - index = wildcard.findRev( '.' ); - if ( index >= 0 ) - mySelectedFile += wildcard.mid( index ); + if ( mySelectedFile[mySelectedFile.length() - 1] == '.') + //if the file name ends with the point remove it + mySelectedFile.truncate(mySelectedFile.length() - 1); + QString anExt = "." + QAD_Tools::getFileExtensionFromPath( mySelectedFile ).stripWhiteSpace(); + // From the filters list make a pattern to validate a file extension + // Due to transformations from the filter list (*.txt *.*xx *.c++ QAD*.* ) we + // will have the pattern (\.txt|\..*xx|\.c\+\+|\..*) (as we validate extension only we remove + // stay extension mask only in the pattern + QString aPattern(wildcard); + QRegExp anExtRExp("("+aPattern.replace(QRegExp("(^| )[0-9a-zA-Z*_?]*\\."), " \\."). + stripWhiteSpace().replace(QRegExp("\\s+"), "|"). + replace(QRegExp("[*]"),".*").replace(QRegExp("[+]"),"\\+") + ")"); + + if ( anExtRExp.match(anExt) == -1 ) //if a selected file extension does not match to filter's list + { //remove a point if it is at the word end + if (anExt[ anExt.length() - 1 ] == '.') anExt.truncate( anExt.length() - 1 ); + index = wildcard.findRev( '.' ); + if ( index >= 0 ) + mySelectedFile += wildcard.mid( index ); //add the extension + } } - } + // } } /*! diff --git a/src/SALOMEGUI/QAD_HelpWindow.cxx b/src/SALOMEGUI/QAD_HelpWindow.cxx index 8cb020a7e..d715bf5df 100644 --- a/src/SALOMEGUI/QAD_HelpWindow.cxx +++ b/src/SALOMEGUI/QAD_HelpWindow.cxx @@ -119,31 +119,31 @@ QAD_HelpWindow::QAD_HelpWindow() QCString dir; QString root; if ( (dir = getenv("KERNEL_ROOT_DIR")) ) { - root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - homeDir = root; - } - else { - root = QAD_Tools::addSlash( root + "html" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - homeDir = root; - } - else { - root = QAD_Tools::addSlash( root + "html" ); - if ( QFileInfo( root + "index.html" ).exists() ) { - homeDir = root; - } - } - } + root = QAD_Tools::addSlash( QAD_Tools::addSlash(dir) + QAD_Tools::addSlash("share") + QAD_Tools::addSlash("salome") + "doc" ); + if ( QFileInfo( root + "index.html" ).exists() ) { + homeDir = root; + } + else { + root = QAD_Tools::addSlash( root + "html" ); + if ( QFileInfo( root + "index.html" ).exists() ) { + homeDir = root; + } + else { + root = QAD_Tools::addSlash( root + "html" ); + if ( QFileInfo( root + "index.html" ).exists() ) { + homeDir = root; + } + } + } } if ( root.isEmpty() ) { - if ( QFileInfo( "/usr/local/doc/html/index.html" ).exists() ) { - homeDir = "/usr/local/doc/html/"; - } + if ( QFileInfo( "/usr/local/doc/html/index.html" ).exists() ) { + homeDir = "/usr/local/doc/html/"; + } } if ( root.isEmpty() ) - root = "./doc/"; - + root = "./doc/"; + browser->setSource( QFileInfo( homeDir + "index.html" ).absFilePath() ); */ browser->setFocus(); diff --git a/src/SALOMEGUI/QAD_ObjectBrowser.cxx b/src/SALOMEGUI/QAD_ObjectBrowser.cxx index 7bea424c0..d72f4c9d3 100644 --- a/src/SALOMEGUI/QAD_ObjectBrowser.cxx +++ b/src/SALOMEGUI/QAD_ObjectBrowser.cxx @@ -36,6 +36,7 @@ using namespace std; #include "QAD_Settings.h" #include "QAD_Tools.h" #include "QAD_RightFrame.h" +#include "QAD_LeftFrame.h" #include "SALOME_Selection.h" #include "SALOME_InteractiveObject.hxx" #include "SALOME_ListIteratorOfListIO.hxx" @@ -72,6 +73,19 @@ using namespace std; #define UC_CLEAR_ID 1000014 #define UC_SET_CURRENT_ID 1000016 +/*! + Small button which updates Object Browser's contents +*/ +Btn::Btn ( QWidget * parent, const char * name ) : QToolButton( parent, name ) +{ + connect( this, SIGNAL(clicked()), this, SLOT(onClicked()) ); +} +void Btn::onClicked() +{ + QAD_ObjectBrowser* OB = QAD_Application::getDesktop()->getActiveApp()->getActiveStudy()->getActiveStudyFrame()->getLeftFrame()->getObjectBrowser(); + OB->Update(); +} + /*! Gets selected top-level items (i.e. not including sub-items) [ static ] */ @@ -157,12 +171,14 @@ void QAD_ObjectBrowser::setupListView() QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager(); this->setTabPosition( QTabWidget::Bottom ); - + /* Reading setting : Columns for Value, OCAF Doc entry, object IOR, OCAF Doc ref entry and Chrono sorting */ QString AddColumn = QAD_CONFIG->getSetting( "ObjectBrowser:AddColumn" ); QString ValueColumn = QAD_CONFIG->getSetting( "ObjectBrowser:ValueColumn" ); - QString ShowCHRONO_SORT = QAD_CONFIG->getSetting( "ObjectBrowser:CHRONO_SORT" ); - + QString ShowCHRONO_SORT = QAD_CONFIG->getSetting( "ObjectBrowser:ChronologicalSort" ); + QString showUseCase = QAD_CONFIG->getSetting("ObjectBrowser:ShowUseCaseBrowser"); + QString noAutoSizeColumns = QAD_CONFIG->getSetting( "ObjectBrowser:NoAutoSizeColumns" ); + /* create and setup Object Browser ================================= */ myListView = new QListView( this, "Object Browser"); myListView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); @@ -176,7 +192,7 @@ void QAD_ObjectBrowser::setupListView() myListView->addColumn( tr( "OBJECT_BROWSER_IOR" ) ); /* Adding Object IOR column */ myListView->addColumn( tr( "OBJECT_BROWSER_REFENTRY" ) ); /* Adding OCAF Doc ref entry column */ myListView->header()->setMovingEnabled( false ); - + /* Properties */ myListView->header()->setClickEnabled( TRUE ); /* Enable clicking on the header */ myListView->setShowSortIndicator( TRUE ) ; /* Add user arrows to indicate the sort order : LPN */ @@ -185,6 +201,7 @@ void QAD_ObjectBrowser::setupListView() myListView->setVScrollBarMode( QScrollView::AlwaysOn ); /* Set scrollbars always visible */ myListView->setHScrollBarMode( QScrollView::AlwaysOn ); /* ... */ + myListView->setCornerWidget( new Btn( this ) ); /* Connect section */ //VRV: porting on Qt 3.0.5 #if QT_VERSION < 0x030005 @@ -202,12 +219,12 @@ void QAD_ObjectBrowser::setupListView() this, SLOT( onExpanded( QListViewItem* ) ) ); connect( myListView, SIGNAL( collapsed( QListViewItem* ) ), this, SLOT( onCollapsed( QListViewItem* ) ) ); - + /* create and setup UseCase Browser ================================ */ - QWidget* vBox = new QWidget( this ); - QVBoxLayout* vBoxLayout = new QVBoxLayout( vBox ); + myVBox = new QWidget( this ); + QVBoxLayout* vBoxLayout = new QVBoxLayout( myVBox ); - myUseCaseView = new QListView( vBox, "UseCase Browser"); + myUseCaseView = new QListView( myVBox, "UseCase Browser"); myUseCaseView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); myUseCaseView->setMinimumSize( 1, 1 ); myUseCaseView->setPalette( QAD_Application::getPalette( true ) ); @@ -228,23 +245,25 @@ void QAD_ObjectBrowser::setupListView() myUseCaseView->setSorting( -1 ) ; vBoxLayout->addWidget( myUseCaseView ); - myNewBtn = new QToolButton( vBox ); + myUseCaseView->setCornerWidget( new Btn( this ) ); + + myNewBtn = new QToolButton( myVBox ); myNewBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_NEW") ) ); myNewBtn->setAutoRaise( true ); QToolTip::add( myNewBtn, tr( "UC_NEW_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_NEW_TIP" ) ); - myAddBtn = new QToolButton( vBox ); + myAddBtn = new QToolButton( myVBox ); myAddBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_ADD") ) ); myAddBtn->setAutoRaise( true ); QToolTip::add( myAddBtn, tr( "UC_APPEND_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_APPEND_TIP" ) ); - myDelBtn = new QToolButton( vBox ); + myDelBtn = new QToolButton( myVBox ); myDelBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_REMOVE") ) ); myDelBtn->setAutoRaise( true ); QToolTip::add( myDelBtn, tr( "UC_REMOVE_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_REMOVE_TIP" ) ); - myClearBtn = new QToolButton( vBox ); + myClearBtn = new QToolButton( myVBox ); myClearBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_CLEAR") ) ); myClearBtn->setAutoRaise( true ); QToolTip::add( myClearBtn, tr( "UC_CLEAR_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_CLEAR_TIP" ) ); - myCurrentBtn = new QToolButton( vBox ); + myCurrentBtn = new QToolButton( myVBox ); myCurrentBtn->setIconSet( resMgr->loadPixmap( "QAD", tr("ICON_UC_SET_CURRENT") ) ); myCurrentBtn->setAutoRaise( true ); QToolTip::add( myCurrentBtn, tr( "UC_SET_CURRENT_ID" ), QAD_Application::getDesktop()->toolTipGroup(), tr( "UC_SET_CURRENT_TIP" ) ); @@ -289,12 +308,21 @@ void QAD_ObjectBrowser::setupListView() /* add Object Browser and UseCase Browser as pages ================= */ this->addTab( myListView, tr( "TLT_OBJECT_BROWSER" ) ); - this->addTab( vBox, tr( "TLT_USECASE_BROWSER" ) ); - + this->addTab( myVBox, tr( "TLT_USECASE_BROWSER" ) ); + + if ( showUseCase != "true") + this->removePage(myVBox); + setShowInfoColumns( AddColumn == "true" ); setShowValueColumn( ValueColumn == "true" ); setEnableChronoSort( ShowCHRONO_SORT == "true" ); + if ( noAutoSizeColumns == "true" ) + { + for (int i = 0; i < myListView->header()->count(); i++ ) + myListView->setColumnWidthMode(i, QListView::Manual); + } + resize( QSize( 100, 400 ) ); } @@ -306,11 +334,12 @@ bool QAD_ObjectBrowser::eventFilter( QObject* o, QEvent* e ) { QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop(); QAD_Study* myActiveStudy = Desktop->getActiveStudy(); + if ( myStudy->_is_nil() ) return QTabWidget::eventFilter( o, e ); SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder(); - if ( o == myUseCaseView->viewport() ) { + if (o == myUseCaseView->viewport()) { if ( e->type() == QEvent::MouseButtonPress ) { // Test if clicked on selection and start drag if necessary QMouseEvent* me = ( QMouseEvent* )e; @@ -688,8 +717,8 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO, QString msg; QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager(); if ( resMgr ) { - if(resMgr->loadResources( QAD_Application::getDesktop()->getComponentName(QString(aFatherName->Value())), msg )) { - QPixmap icon ( resMgr->loadPixmap( QAD_Application::getDesktop()->getComponentName(QString(aFatherName->Value())), + if(resMgr->loadResources( QString(aFatherName->Value()) + "GUI", msg )) { + QPixmap icon ( resMgr->loadPixmap( QString(aFatherName->Value()) + "GUI", tr(aPixmap->GetPixMap()) /*tr( "ICON_OBJBROWSER_" + theComponent )*/ )); Item->setPixmap( 0, icon ); } @@ -712,9 +741,10 @@ void QAD_ObjectBrowser::Update( SALOMEDS::SObject_ptr SO, */ void QAD_ObjectBrowser::Update() { - int x = myListView->contentsX(); - int y = myListView->contentsY(); - + int xc = myListView->contentsX(); + int yc = myListView->contentsY(); + myListView->viewport()->setUpdatesEnabled( false ); + myListView->clear(); myListViewMap.clear(); @@ -845,11 +875,14 @@ void QAD_ObjectBrowser::Update() Update (SC, Item); } } - /* Updating UseCase Browser ============================================= */ - UpdateUseCaseBrowser(); + myListView->setContentsPos(xc,yc); - myListView->setContentsPos(x,y); -} + myListView->viewport()->setUpdatesEnabled( true ); + myListView->viewport()->repaint( false ); + /* Updating UseCase Browser ============================================= */ + if ( this->count() > 1 ) + UpdateUseCaseBrowser(); +} /*! Removes item with all childs from the map - used to optimize UseCase browser update @@ -876,7 +909,7 @@ void removeFromMap( ItemMap& theMap, QAD_ObjectBrowserItem* item ) */ void QAD_ObjectBrowser::UpdateUseCaseBrowser() { // myUseCaseView->clear(); myUseCaseMap.clear(); - if ( myStudy->_is_nil() ) { + if ( myStudy->_is_nil() || this->count()<2 ) { return; } myUseCaseView->blockSignals( true ); @@ -936,7 +969,7 @@ void QAD_ObjectBrowser::UpdateUseCaseBrowser() { */ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_ObjectBrowserItem* UCItem ) { - if ( myStudy->_is_nil() || !UCItem ) + if ( myStudy->_is_nil() || !UCItem ) return; /* Creating SObjects item */ @@ -1103,7 +1136,7 @@ void QAD_ObjectBrowser::UpdateUCItem( SALOMEDS::SObject_var UCObject, QAD_Object void QAD_ObjectBrowser::unHighlightAll() { myListView->clearSelection(); - myUseCaseView->clearSelection(); + myUseCaseView->clearSelection(); } /*! @@ -1283,6 +1316,9 @@ void QAD_ObjectBrowser::showUseCasePopupMenu(QListViewItem* theItem) */ void QAD_ObjectBrowser::onSelectedItem() { + if (currentPage()==myListView) + myUseCaseView->clearSelection(); + QListView* whoIs; if ( sender()->inherits("QListView") ) whoIs = (QListView*)sender(); @@ -1489,6 +1525,7 @@ void QAD_ObjectBrowser::setShowIAPP( bool show ) void QAD_ObjectBrowser::setShowInfoColumns( bool show ) { bool shown = myListView->header()->isResizeEnabled( 2 ); + if ( show != shown ) { if ( show ) { myListView->header()->setResizeEnabled( true, 2 ); @@ -1524,6 +1561,7 @@ void QAD_ObjectBrowser::setShowInfoColumns( bool show ) void QAD_ObjectBrowser::setShowValueColumn( bool show ) { bool shown = myListView->header()->isResizeEnabled( 1 ); + if ( show != shown ) { if ( show ) { myListView->header()->setResizeEnabled( true, 1 ); @@ -1809,3 +1847,43 @@ void QAD_ObjectBrowser::onUseCaseBtn() if ( sender() == myCurrentBtn ) onUseCasePopupMenu( UC_SET_CURRENT_ID ); } + +/* + Show/remove UseCase Browser +*/ + +void QAD_ObjectBrowser::showUseCaseBrowser ( bool show ) +{ + bool shown = (this->count() > 1); + + if (show != shown) + { + if (show) + { + this->addTab( myVBox, tr( "TLT_USECASE_BROWSER" ) ); + UpdateUseCaseBrowser(); + unHighlightAll(); + } + else + this->removePage(myVBox); + } +} + +/*! + Switch between auto resizing of columns and manual mode +*/ +void QAD_ObjectBrowser::autoSizeColumns( bool autosize ) +{ + if (autosize) + { + for (int i = 0; i < myListView->header()->count(); i++ ) + if (myListView->header()->isResizeEnabled(i)) + myListView->setColumnWidthMode(i, QListView::Maximum); + + } + else + { + for (int i = 0; i < myListView->header()->count(); i++ ) + myListView->setColumnWidthMode(i, QListView::Manual); + } +} diff --git a/src/SALOMEGUI/QAD_ObjectBrowser.h b/src/SALOMEGUI/QAD_ObjectBrowser.h index a03afac0a..ef5f94099 100644 --- a/src/SALOMEGUI/QAD_ObjectBrowser.h +++ b/src/SALOMEGUI/QAD_ObjectBrowser.h @@ -89,6 +89,8 @@ public: void setShowInfoColumns( bool show ); void setShowValueColumn( bool show ); void setEnableChronoSort( bool enable ); + void showUseCaseBrowser ( bool show ); + void autoSizeColumns ( bool autosize ); protected: void Update( SALOMEDS::SObject_ptr SO, @@ -132,6 +134,7 @@ private: ItemMap myListViewMap; ItemMap myUseCaseMap; QListView* myListView; + QWidget* myVBox; QListView* myUseCaseView; QPopupMenu* myPopupMenu; SALOMEDS::Study_ptr myStudy; @@ -143,4 +146,14 @@ private: QToolButton* myClearBtn; }; + +class Btn : public QToolButton +{ + Q_OBJECT +public: + Btn ( QWidget * parent, const char * name = 0 ); +public slots: + void onClicked(); +}; + #endif diff --git a/src/SALOMEGUI/QAD_Study.cxx b/src/SALOMEGUI/QAD_Study.cxx index 0e1796ab3..1be9aef0e 100644 --- a/src/SALOMEGUI/QAD_Study.cxx +++ b/src/SALOMEGUI/QAD_Study.cxx @@ -60,7 +60,6 @@ using namespace std; // QT Include #include -#define MAX_UNDO 10 /*! Constructor */ @@ -75,7 +74,7 @@ myPath( path ) { myStudy = aStudy; - myTitle = QAD_Tools::getFileNameFromPath( path, false ); + myTitle = QAD_Tools::getFileNameFromPath( path, true ); myIsActive = false; myIsSaved = false; @@ -104,7 +103,12 @@ myPath( path ) /* set default Undo/Redo limit */ QAD_ASSERT_DEBUG_ONLY( !myStudy->_is_nil() ); SALOMEDS::StudyBuilder_var SB = myStudy->NewBuilder(); - SB->UndoLimit( MAX_UNDO ); + + int aLocked = myStudy->GetProperties()->IsLocked(); + if (aLocked) myStudy->GetProperties()->SetLocked(false); + SB->UndoLimit(QAD_Desktop::getUndoLevel()); + if (aLocked) myStudy->GetProperties()->SetLocked(true); + } /*! @@ -169,7 +173,10 @@ void QAD_Study::removeStudyFrame( QAD_StudyFrame* sf ) SALOMEDS::SObject_var fatherSF = myStudy->FindObjectID(sf->entry()); if (!fatherSF->_is_nil()) { SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + int aLocked = myStudy->GetProperties()->IsLocked(); + if (aLocked) myStudy->GetProperties()->SetLocked(false); aStudyBuilder->RemoveObject(fatherSF); + if (aLocked) myStudy->GetProperties()->SetLocked(true); } updateObjBrowser( true ); @@ -274,7 +281,7 @@ void QAD_Study::setTitle( const QString& path ) { myPath = path; - QString title = QAD_Tools::getFileNameFromPath( path, false ); + QString title = QAD_Tools::getFileNameFromPath( path, true ); QAD_ASSERT_DEBUG_ONLY ( !title.isNull() ); for ( QAD_StudyFrame* sf = myStudyFrames.first(); sf ; sf = myStudyFrames.next() ) @@ -380,6 +387,7 @@ void QAD_Study::onStudyDeactivated() */ void QAD_Study::close() { + emit closed(); if ( !myStudy->_is_nil() ) abortAllOperations(); /* clear each study frame */ diff --git a/src/SALOMEGUI/QAD_Study.h b/src/SALOMEGUI/QAD_Study.h index 2d650058d..94fe80305 100644 --- a/src/SALOMEGUI/QAD_Study.h +++ b/src/SALOMEGUI/QAD_Study.h @@ -154,6 +154,7 @@ public: signals: void docClosing( QAD_Study* ); void docOperationTerminated( bool ); + void closed(); public slots: void onStudyFrameActivated( QAD_StudyFrame* ); diff --git a/src/SALOMEGUI/QAD_StudyFrame.cxx b/src/SALOMEGUI/QAD_StudyFrame.cxx index 194aaa516..29bde65b1 100644 --- a/src/SALOMEGUI/QAD_StudyFrame.cxx +++ b/src/SALOMEGUI/QAD_StudyFrame.cxx @@ -124,7 +124,6 @@ void QAD_StudyFrame::setVisible( bool visible ) */ void QAD_StudyFrame::closeEvent(QCloseEvent* e) { - emit sfBeforeStudyFrameClosing(this); emit sfStudyFrameClosing(this); } diff --git a/src/SALOMEGUI/QAD_StudyFrame.h b/src/SALOMEGUI/QAD_StudyFrame.h index b16822dac..e8b393b44 100644 --- a/src/SALOMEGUI/QAD_StudyFrame.h +++ b/src/SALOMEGUI/QAD_StudyFrame.h @@ -87,7 +87,6 @@ class QAD_EXPORT QAD_StudyFrame: public QMainWindow signals: void sfStudyFrameActivated( QAD_StudyFrame* ); void sfStudyFrameClosing( QAD_StudyFrame*); - void sfBeforeStudyFrameClosing( QAD_StudyFrame*); public slots: void onStudyFrameActivated ( QWidget* ); diff --git a/src/SALOMEGUI/QAD_Tools.cxx b/src/SALOMEGUI/QAD_Tools.cxx index 0b9ab52d3..e2e85bf53 100644 --- a/src/SALOMEGUI/QAD_Tools.cxx +++ b/src/SALOMEGUI/QAD_Tools.cxx @@ -276,7 +276,7 @@ TCollection_AsciiString QAD_Tools::toAsciiString( const QString& qString) QFont QAD_Tools::stringToFont( const QString& fontDescription ) { QFont font; - if ( !font.fromString( fontDescription ) ) + if ( fontDescription.stripWhiteSpace().isEmpty() || !font.fromString( fontDescription ) ) font = QFont( "Courier", 11 ); return font; } diff --git a/src/SALOMEGUI/QAD_ViewFrame.h b/src/SALOMEGUI/QAD_ViewFrame.h index 04a78ddcd..b894bb703 100644 --- a/src/SALOMEGUI/QAD_ViewFrame.h +++ b/src/SALOMEGUI/QAD_ViewFrame.h @@ -58,8 +58,8 @@ public: virtual QColor backgroundColor() const = 0; virtual void SetSelectionMode( int mode ) = 0; - - virtual void SetTrihedronSize( int dim ) = 0; + + virtual void onAdjustTrihedron() = 0; /* popup management */ virtual void setPopupServer( QAD_Application* ) = 0; diff --git a/src/SALOMEGUI/QAD_icons.po b/src/SALOMEGUI/QAD_icons.po index f30ce6918..5b1e636f7 100644 --- a/src/SALOMEGUI/QAD_icons.po +++ b/src/SALOMEGUI/QAD_icons.po @@ -68,6 +68,15 @@ msgstr "close.png" msgid "ICON_HELP" msgstr "help.png" +msgid "QAD_HelpWindow::ICON_APP_HELP_BACK" +msgstr "back.xpm" + +msgid "QAD_HelpWindow::ICON_APP_HELP_FORWARD" +msgstr "forward.xpm" + +msgid "QAD_HelpWindow::ICON_APP_HELP_HOME" +msgstr "home.xpm" + #-------------- # VIEW #-------------- diff --git a/src/SALOMEGUI/QAD_msg_en.po b/src/SALOMEGUI/QAD_msg_en.po index 39dededad..e845d78e4 100644 --- a/src/SALOMEGUI/QAD_msg_en.po +++ b/src/SALOMEGUI/QAD_msg_en.po @@ -259,6 +259,12 @@ msgstr "Interface Applicative" msgid "MEN_DESK_PREF_OBJECTBROWSER_CHRONO_SORT" msgstr "Chronological sort of objects" +msgid "MEN_DESK_PREF_OBJECTBROWSER_SHOW_USECASE" +msgstr "Show UseCase Browser" + +msgid "MEN_DESK_PREF_OBJECTBROWSER_NO_AUTOSIZE" +msgstr "No autosize columns" + msgid "QAD_Desktop::MEN_DESK_SELECTION_MODE" msgstr "Selection Mode" @@ -435,6 +441,21 @@ msgstr "Sketch a rectangular area to fit the view" # TOOL TIP #--------------- +#: QAD_HelpWindow.cxx:57 +msgid "QAD_HelpWindow::TOT_HELPWINDOW_BACKWARD" +msgstr "Backward" + +#: QAD_HelpWindow.cxx:60 +msgid "QAD_HelpWindow::TOT_HELPWINDOW_FORWARD" +msgstr "Forward" + +#: QAD_HelpWindow.cxx:63 +msgid "QAD_HelpWindow::TOT_HELPWINDOW_HOME" +msgstr "Home" + +msgid "QAD_HelpWindow::QAD_HELP_CONTENTS" +msgstr "Contents" + #: QAD_Application.cxx:173 msgid "QAD_Application::TOT_APP_EDIT_REDO" msgstr "Redo last operation" @@ -752,6 +773,9 @@ msgstr "ASCII Save" msgid "TOT_APP_EDIT_COPY" msgstr "Copy" +msgid "MEN_DESK_PREF_UNDO_LEVEL" +msgstr "Undo Level" + msgid "MEN_APP_EDIT_COPY" msgstr "&Copy" diff --git a/src/SALOMEGUI/SALOMEGUI_Application.cxx b/src/SALOMEGUI/SALOMEGUI_Application.cxx index d9b5ad9b1..fa67befd6 100644 --- a/src/SALOMEGUI/SALOMEGUI_Application.cxx +++ b/src/SALOMEGUI/SALOMEGUI_Application.cxx @@ -615,7 +615,7 @@ void SALOMEGUI_Application::onDisplay(int id) viewFrame->Repaint(); if (isForeignGUIUsed) - foreignGUI.DlClose(); + ;//foreignGUI.DlClose(); // VSR: Fix crash on Display objects from non-parent components myActiveStudy->updateObjBrowser(true); } diff --git a/src/SALOMEGUI/SALOMEGUI_SetValueDlg.cxx b/src/SALOMEGUI/SALOMEGUI_SetValueDlg.cxx index 2573f3ff9..3a8eb70f2 100644 --- a/src/SALOMEGUI/SALOMEGUI_SetValueDlg.cxx +++ b/src/SALOMEGUI/SALOMEGUI_SetValueDlg.cxx @@ -119,6 +119,21 @@ void SALOMEGUI_SetValueDlg::setLabel( const QString& label ) myLabel->setText( label ); } +void SALOMEGUI_SetValueDlg::accept() +{ + const QValidator* v = myLineEdit->validator(); + if ( v ) { + if ( v->inherits( "QIntValidator" ) ) { + bool b; + int val = myLineEdit->text().toInt( &b ); + const QIntValidator* iv = dynamic_cast(v); + if ( !b || val < iv->bottom() || val > iv->top()) + return; + } + } + QDialog::accept(); +} + /*! Gets string value */ @@ -167,6 +182,32 @@ int SALOMEGUI_SetValueDlg::getInteger( const QString& caption, return v; } +/*! + Gets integer value +*/ +int SALOMEGUI_SetValueDlg::getInteger( const QString& caption, + const QString& label, + int bottom, + int top, + const int oldValue, + bool* ok, + QWidget* parent ) +{ + int v = 0; + SALOMEGUI_SetValueDlg* dlg = new SALOMEGUI_SetValueDlg( parent ); + dlg->setCaption( caption ); + dlg->setLabel( label ); + dlg->setValidator( new QIntValidator( bottom, top, dlg ) ); + dlg->setValue( QString::number( oldValue ) ); + int result = dlg->exec(); + if ( result == QDialog::Accepted ) + v = dlg->value().toInt(); + if ( ok ) + *ok = result == QDialog::Accepted; + delete dlg; + return v; +} + /*! Gets double value */ diff --git a/src/SALOMEGUI/SALOMEGUI_SetValueDlg.h b/src/SALOMEGUI/SALOMEGUI_SetValueDlg.h index bcd845838..3b5bd02b9 100644 --- a/src/SALOMEGUI/SALOMEGUI_SetValueDlg.h +++ b/src/SALOMEGUI/SALOMEGUI_SetValueDlg.h @@ -36,11 +36,20 @@ public: const int oldValue = 0, bool* ok = 0, QWidget* parent = 0 ); + static int getInteger( const QString& caption, + const QString& label, + int bottom, + int top, + const int oldValue = 0, + bool* ok = 0, + QWidget* parent = 0 ); static double getDouble ( const QString& caption, const QString& label, const double oldValue = 0.0, bool* ok = 0, QWidget* parent = 0 ); +public slots: + void accept(); private: SALOMEGUI_SetValueDlg( QWidget* parent = 0 ); diff --git a/src/SALOMEGUI/SALOMEGUI_msg_en.po b/src/SALOMEGUI/SALOMEGUI_msg_en.po index af0785398..311b6075f 100644 --- a/src/SALOMEGUI/SALOMEGUI_msg_en.po +++ b/src/SALOMEGUI/SALOMEGUI_msg_en.po @@ -67,7 +67,7 @@ msgstr "Appropriate view must be created to display selected object(s)" #: SALOMEGUI_TrihedronSizeDlg.cxx:77 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON_SIZE" -msgstr "Size :" +msgstr "Size (% of bounding box) :" #: SALOMEGUI_TrihedronSizeDlg.cxx:36 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON" diff --git a/src/SALOMEGUI/SALOMEGUI_msg_fr.po b/src/SALOMEGUI/SALOMEGUI_msg_fr.po index b595f87c2..6ffd95262 100644 --- a/src/SALOMEGUI/SALOMEGUI_msg_fr.po +++ b/src/SALOMEGUI/SALOMEGUI_msg_fr.po @@ -66,7 +66,7 @@ msgstr "La vue appropri #--------------- msgid "INF_VERSION" -msgstr "Version 1.1a" +msgstr "" msgid "INF_COPYRIGHT" msgstr "" @@ -81,7 +81,7 @@ msgstr "" #: SALOMEGUI_TrihedronSizeDlg.cxx:77 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON_SIZE" -msgstr "Size :" +msgstr "Size (% of bounding box) :" #: SALOMEGUI_TrihedronSizeDlg.cxx:36 msgid "SALOMEGUI_TrihedronSizeDlg::MEN_TRIHEDRON" @@ -316,7 +316,7 @@ msgstr "VTK Viewer" #: SALOMEGUI_AboutDlg.cxx:42 msgid "ABOUT_SALOME_TLT" -msgstr "About SALOME " +msgstr "About SALOME Professional" msgid "SALOMEGUI_OpenWith::OPEN_WITH_TLT" msgstr "Open With" diff --git a/src/SALOME_PYQT/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt.cxx index 9f7c1afa2..11d2fe9ce 100644 --- a/src/SALOME_PYQT/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt.cxx @@ -107,3 +107,7 @@ QString SalomePyQt::getExistingDirectory(QWidget* parent, { return QAD_FileDlg::getExistingDirectory(parent, initial, caption); } + +void SalomePyQt::helpContext(const QString& source, const QString& context) { + //QAD_Application::getDesktop()->helpContext(source, context); +} diff --git a/src/SALOME_PYQT/SalomePyQt.hxx b/src/SALOME_PYQT/SalomePyQt.hxx index c79a1d97e..b3f5101a6 100644 --- a/src/SALOME_PYQT/SalomePyQt.hxx +++ b/src/SALOME_PYQT/SalomePyQt.hxx @@ -44,6 +44,7 @@ public: static QString getExistingDirectory(QWidget* parent, const QString& initial, const QString& caption); + static void helpContext(const QString& source, const QString& context); }; #endif diff --git a/src/SALOME_PYQT/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt.sip index 51ab6d772..3f593d0af 100644 --- a/src/SALOME_PYQT/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt.sip @@ -45,4 +45,5 @@ public: static QString getFileName(QWidget*, const QString&, const QStringList&, const QString&, bool); static QString getExistingDirectory(QWidget*, const QString&, const QString&); + static void helpContext(const QString&, const QString&); }; diff --git a/src/SALOME_SWIG/salome_test.py b/src/SALOME_SWIG/salome_test.py index 0ebc15156..31b7f308f 100644 --- a/src/SALOME_SWIG/salome_test.py +++ b/src/SALOME_SWIG/salome_test.py @@ -471,6 +471,13 @@ myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU") try: if os.access(medFile, os.R_OK) : + if not os.access(medFile, os.W_OK) : + import random + medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medfile + print " -- Copy " + medFile + " to " + medFileNew + os.system("cp "+ medFile + " " + medFileNew) + medFile = medFileNew + if os.access(medFile, os.W_OK) : med_comp.readStructFileWithFieldType(medFile,studyCurrent) med_obj = visu_gui.visu.getMedObjectFromStudy() diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx index 2fa21f447..01fa60ce2 100644 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx +++ b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx @@ -254,9 +254,9 @@ void SUPERVGraph_ViewFrame::SetSelectionMode( int mode ) MESSAGE ( "SUPERVGraph_ViewFrame::SetSelectionMode" ) } -void SUPERVGraph_ViewFrame::SetTrihedronSize( int dim ) +void SUPERVGraph_ViewFrame::onAdjustTrihedron( ) { - MESSAGE ( "SUPERVGraph_ViewFrame::SetTrihedronSize" ) + MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" ) } void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h b/src/SUPERVGraph/SUPERVGraph_ViewFrame.h index 49c297a7a..8c62cc436 100644 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h +++ b/src/SUPERVGraph/SUPERVGraph_ViewFrame.h @@ -64,7 +64,7 @@ class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame { void SetSelectionMode( int mode ); - void SetTrihedronSize( int dim ); + void onAdjustTrihedron( ); /* popup management */ void setPopupServer( QAD_Application* ); diff --git a/src/Session/SALOME_Session_i.cxx b/src/Session/SALOME_Session_i.cxx index 026584560..fb2d92a94 100644 --- a/src/Session/SALOME_Session_i.cxx +++ b/src/Session/SALOME_Session_i.cxx @@ -172,6 +172,7 @@ void SALOME_Session_i::StopSession() SALOME::StatSession SALOME_Session_i::GetStatSession() { // update Session state + //qApp->lock(); // rollback bug _GUIMutex.lock(); _isGUI = _IAPPThread->running(); _runningStudies = 0; @@ -182,6 +183,7 @@ SALOME::StatSession SALOME_Session_i::GetStatSession() qApp->unlock(); } _GUIMutex.unlock(); + //qApp->unlock(); // getting stat info SALOME::StatSession_var myStats = new SALOME::StatSession ; if (_runningStudies) diff --git a/src/Utils/Utils_SINGLETON.hxx b/src/Utils/Utils_SINGLETON.hxx index 3d2e58cd3..4e06560a0 100644 --- a/src/Utils/Utils_SINGLETON.hxx +++ b/src/Utils/Utils_SINGLETON.hxx @@ -107,7 +107,7 @@ template TYPE *SINGLETON_::Instance( void ) { if ( ! PtrSingleton ) { - MESSAGE("SINGLETON_::Instance( void )") ; + //MESSAGE("SINGLETON_::Instance( void )") ; PtrSingleton = new SINGLETON_ ; new DESTRUCTEUR_DE_( PtrSingleton->_Instance ) ; } @@ -125,7 +125,7 @@ template bool SINGLETON_::IsAlreadyExisting( void ) template SINGLETON_::SINGLETON_( void ) { - MESSAGE("CREATION d'un SINGLETON_") ; + //MESSAGE("CREATION d'un SINGLETON_") ; } -- 2.39.2