SalomeApp_Filter.h \
SalomeApp_TypeFilter.h \
SalomeApp_StudyPropertiesDlg.h \
- SalomeApp_CheckFileDlg.h
+ SalomeApp_CheckFileDlg.h \
+ SalomeApp_VisualState.h
# .po files to transform in .qm
PO_FILES = SalomeApp_images.po \
SalomeApp_TypeFilter.cxx \
SalomeApp_StudyPropertiesDlg.cxx \
SalomeApp_ListView.cxx \
- SalomeApp_CheckFileDlg.cxx
+ SalomeApp_CheckFileDlg.cxx \
+ SalomeApp_VisualState.cxx
LIB_MOC = SalomeApp_Application.h \
SalomeApp_DataModel.h \
#include "SalomeApp_DataModel.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_EventFilter.h"
+#include "SalomeApp_VisualState.h"
#include "SalomeApp_StudyPropertiesDlg.h"
int savePoint;
if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method
SALOMEDS_IParameters::setDumpPython(appStudy->studyDS());
- savePoint = appStudy->storeState(); //SRN: create a temporary save point
+ savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
//prefix = SALOMEDS_IParameters::getStudyScript(appStudy->studyDS(), appStudy->getVisualComponentName(), savePoint);
}
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Engine_i.hxx"
+#include "SalomeApp_VisualState.h"
#include "LightApp_RootObject.h"
#include <OB_Browser.h>
-#include <QtxWorkstack.h>
-
-#include <STD_TabDesktop.h>
-
#include <SUIT_ResourceMgr.h>
#include <qptrlist.h>
emit opened( this );
study->IsSaved(true);
- vector<int> savePoints = getSavePoints();
- if(savePoints.size() > 0) restoreState(savePoints[savePoints.size()-1]);//############### VISUAL PARAMETERS
+ std::vector<int> savePoints = getSavePoints();
+ if ( savePoints.size() > 0 ) //############### VISUAL PARAMETERS
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).restoreState( savePoints[savePoints.size()-1] );
+
return res;
}
//=======================================================================
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
{
- storeState();//############### VISUAL PARAMETERS
-
+ //############### VISUAL PARAMETERS
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
+
ModelList list; dataModels( list );
SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
//=======================================================================
bool SalomeApp_Study::saveDocument()
{
- storeState(); //############### VISUAL PARAMETERS
+ //############### VISUAL PARAMETERS
+ SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
ModelList list; dataModels( list );
/*! Purpose : returns a list of saved points' IDs
*/
//================================================================
-vector<int> SalomeApp_Study::getSavePoints()
+std::vector<int> SalomeApp_Study::getSavePoints()
{
- vector<int> v;
+ std::vector<int> v;
_PTR(SObject) so = studyDS()->FindComponent("Interface Applicative");
if(!so) return v;
* parameters are stored
*/
//================================================================
-string SalomeApp_Study::getVisualComponentName()
+std::string SalomeApp_Study::getVisualComponentName()
{
return "Interface Applicative";
}
-//================================================================
-// Function : nameViewWindows
-/*! Purpose : set names of all view windows in given list. This is used
-// in order to apply the same naming algorithm when saving and restoring
-// view windows. Names of view windows must be the same before saving
-// workstack (splitters) information, and before its restoring!
-// Naming rule: ViewerType_IndexOfViewerOfThisType_IndexOfViewInThisViewer
-// VTKViewer_0_0
-// OCCViewer_0_0 OCCViewer_0_1 OCCViewer_0_2
-// VTKViewer_1_0
-*/
-//================================================================
-void nameViewWindows( const ViewManagerList& lst )
-{
- QDict<int> viewersCounter; // map viewerType - to - index_of_this_viewer_type
- viewersCounter.setAutoDelete( true );
- for ( QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it) {
- int view_count = it.current()->getViewsCount();
- QString vType = it.current()->getType();
- if ( !view_count )
- continue; //No views is opened in the viewer
-
- int* viewerID = viewersCounter[ vType ];
- if ( !viewerID ) {
- viewerID = new int( 0 );
- viewersCounter.insert( vType, viewerID );
- }
- else
- ++(*viewerID);
-
- QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
- for ( int i = 0; i < view_count; i++ ) {
- QString vName = QString( "%1_%2_%3" ).arg( vType ).arg( *viewerID ).arg( i );
- views[i]->setName( vName );
- }
- }
-}
-
-//================================================================
-// Function : storeState
-/*! Purpose : store the visual parameters of the viewers
-*/
-//================================================================
-int SalomeApp_Study::storeState()
-{
- int savePoint = 1;
- vector<int> savePoints = getSavePoints();
- //Calculate a new savePoint number = the last save point number + 1
- if(savePoints.size() > 0) savePoint = savePoints[savePoints.size()-1] + 1;
-
- _PTR(AttributeParameter) ap = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
- SALOMEDS_IParameters ip(ap);
-
- int viewerID = 0;
- SUIT_ViewManager* vm = 0;
- ViewManagerList lst;
- ((SalomeApp_Application*)application())->viewManagers(lst);
-
- // setting unique names for view windows in order to save this view inside
- // workstack's structure (see below). On restore the views with the same names will
- // be placed to the same place inside the workstack's splitters.
- nameViewWindows( lst );
-
- // store active window's name
- if ( application()->desktop()->activeWindow() )
- ip.setProperty("AP_ACTIVE_VIEW", application()->desktop()->activeWindow()->name() );
-
- for(QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it) {
- vm = it.current();
- int view_count = vm->getViewsCount();
- if ( !view_count )
- continue; //No views is opened in the viewer
-
- std::string viewerEntry = QString( "%1_%2" ).arg( vm->getType() ).arg( ++viewerID ).latin1();
- ip.append("AP_VIEWERS_LIST", viewerEntry);
-
- QPtrVector<SUIT_ViewWindow> views = vm->getViews();
- for(int i = 0; i<view_count; i++) {
- ip.append( viewerEntry, views[i]->caption() );
- ip.append( viewerEntry, views[i]->getVisualParameters().latin1() );
- }
- }
-
- //Save information about split areas
- if ( application()->desktop()->inherits( "STD_TabDesktop" ) ) {
- QtxWorkstack* workstack = ((STD_TabDesktop*)application()->desktop())->workstack();
- QString workstackInfo;
- (*workstack) >> workstackInfo;
- ip.setProperty( "AP_WORKSTACK_INFO", workstackInfo.latin1() );
- }
-
- //Save a name of the active module
- CAM_Module* activeModule = ((SalomeApp_Application*)application())->activeModule();
- QString moduleName = "";
- if(activeModule) {
- moduleName = activeModule->moduleName();
- ip.setProperty("AP_ACTIVE_MODULE", moduleName.latin1());
- }
-
- //Store visual parameters of the modules
- QPtrList<CAM_Module> list;
- ((SalomeApp_Application*)application())->modules( list );
- for(SalomeApp_Module* module = (SalomeApp_Module*)list.first(); module; module = (SalomeApp_Module*)list.next()) {
- ip.append("AP_MODULES_LIST", module->moduleName().latin1());
- module->storeVisualParameters(savePoint);
- }
-
- return savePoint;
-}
-
-//================================================================
-// Function : restoreState
-/*! Purpose : restore the visual parameters of the viewers
-*/
-//================================================================
-void SalomeApp_Study::restoreState(int savePoint)
-{
- _PTR(AttributeParameter) ap = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
- SALOMEDS_IParameters ip(ap);
-
- //Remove all already existent veiwers and their views
- ViewManagerList lst;
- ((SalomeApp_Application*)application())->viewManagers(lst);
- for (QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it) {
- SUIT_ViewManager* vm = it.current();
- if (vm)
- ((SalomeApp_Application*)application())->removeViewManager(vm);
- }
-
- //Restore the viewers and view windows
- int nbViewers = ip.nbValues("AP_VIEWERS_LIST");
- SUIT_ViewWindow *viewWin = 0;
-
- for (int i = 0; i < nbViewers; i++) {
- string viewerEntry = ip.getValue("AP_VIEWERS_LIST", i);
- vector<string> veiewerParams = ip.parseValue(viewerEntry,'_');
- string type = veiewerParams[0];
- string viewerID = veiewerParams[1];
- SUIT_ViewManager* vm = ((SalomeApp_Application*)application())->newViewManager(type.c_str());
- if (!vm)
- continue; //Unknown viewer
-
- int nbViews = (ip.nbValues(viewerEntry))/2;
-
- //Create nbViews-1 view (-1 because 1 view is created by createViewManager)
- for ( int i = 1; i< nbViews; i++ ) {
- SUIT_ViewWindow* aView = vm->createViewWindow();
- aView->show();
- }
-
- int viewCount = vm->getViewsCount();
- if (viewCount != nbViews) {
- cout << "Unknow error, Can't create a view!" << endl;
- continue;
- }
-
- //Resize the views, set their captions and apply visual parameters.
- QPtrVector<SUIT_ViewWindow> views = vm->getViews();
- for (int i = 0, j = 0; i<viewCount; i++, j++) {
- viewWin = views[i];
- if ( !viewWin )
- continue;
-
- // wait untill the window is really shown. This step fixes MANY bugs..
- while ( !viewWin->isVisible() )
- qApp->processEvents();
-
- viewWin->setCaption(ip.getValue(viewerEntry, j).c_str());
- viewWin->setVisualParameters(ip.getValue(viewerEntry, j+1).c_str());
- }
- }
-
- // restore modules' visual parameters
- vector<string> v = ip.getValues("AP_MODULES_LIST");
- for (int i = 0; i<v.size(); i++) {
- ((SalomeApp_Application*)application())->activateModule(v[i].c_str());
- SalomeApp_Module* module = (SalomeApp_Module*)(((SalomeApp_Application*)application())->activeModule());
- module->restoreVisualParameters(savePoint);
- }
-
- // activate module that was active on save
- QString activeModuleName(ip.getProperty("AP_ACTIVE_MODULE").c_str());
- if (activeModuleName != "")
- ((SalomeApp_Application*)application())->activateModule(activeModuleName);
-
- // setting unique names for view windows in order to restore positions of view windows inside
- // workstack's structure (see below). During save the same naming algorithm was used,
- // so the same views will get the same names.
- lst.clear();
- ((SalomeApp_Application*)application())->viewManagers(lst);
- nameViewWindows( lst );
-
- // work-around to bug of setting visual parameters of views: all view windows now have
- // correct visual parameters, bug after restoring the workstack the visual parameters
- // are messted, and must be re-set again. So here we store them in a map and set them
- // later back again. why we don't store these parameters in a map on views creation?
- // because 1) names of view windows are not set at that time 2) some view windows
- // are created by modules' restoreVisualParameters (like Gauss Viewers), which is NOT here..
- QMap<QString, QString> viewersParameters;
- QPtrListIterator<SUIT_ViewManager> it( lst );
- for ( ; it.current(); ++it ) {
- int view_count = it.current()->getViewsCount();
- QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
- for ( int i = 0; i < view_count; i++ )
- viewersParameters[ views[i]->name() ] = views[i]->getVisualParameters();
- }
-
- // restore workstack parameters. should be done after module's restoreVisualParameters(), because
- // some modules can create their own viewers (like VISU creates GaussViewers)
- if ( application()->desktop()->inherits( "STD_TabDesktop" ) ) {
- QtxWorkstack* workstack = ((STD_TabDesktop*)application()->desktop())->workstack();
- (*workstack) << ip.getProperty( "AP_WORKSTACK_INFO" ).c_str();
- }
-
- // restore visual parameters of view windows. it must be done AFTER restoring workstack.
- for ( it.toFirst(); it.current(); ++it ) {
- int view_count = it.current()->getViewsCount();
- QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
- for ( int i = 0; i < view_count; i++ )
- views[i]->setVisualParameters( viewersParameters[ views[i]->name() ] );
- }
-
- // set focus to previously saved active view window
- /*
- string activeViewName = ip.getProperty("AP_ACTIVE_VIEW");
- for ( it.toFirst(); it.current(); ++it ) {
- int view_count = it.current()->getViewsCount();
- QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
- for ( int i = 0; i < view_count; i++ ) {
- if ( activeViewName == views[i]->name() )
- views[i]->setFocus();
- }
- }
- */
-}
void removeSavePoint(int savePoint);
QString getNameOfSavePoint(int savePoint);
void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
- virtual int storeState();
- virtual void restoreState(int savePoint);
virtual std::string getVisualComponentName();
protected:
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
+#include "SalomeApp_VisualState.h"
+
+#include "SalomeApp_Module.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+
+#include <QtxWorkstack.h>
+
+#include <STD_TabDesktop.h>
+
+#include <qptrlist.h>
+#include <qapplication.h>
+#include <qdict.h>
+
+#include <SALOMEDS_IParameters.hxx>
+
+#include <vector>
+#include <string>
+
+/*!
+ Constructor.
+*/
+SalomeApp_VisualState::SalomeApp_VisualState( SalomeApp_Application* app )
+ : myApp( app )
+{
+}
+
+/*!
+ Destructor.
+*/
+SalomeApp_VisualState::~SalomeApp_VisualState()
+{
+}
+
+//================================================================
+// Function : nameViewWindows
+/*! Purpose : set names of all view windows in given list. This is used
+// in order to apply the same naming algorithm when saving and restoring
+// view windows. Names of view windows must be the same before saving
+// workstack (splitters) information, and before its restoring!
+// Naming rule: ViewerType_IndexOfViewerOfThisType_IndexOfViewInThisViewer
+// VTKViewer_0_0
+// OCCViewer_0_0 OCCViewer_0_1 OCCViewer_0_2
+// VTKViewer_1_0
+*/
+//================================================================
+void nameViewWindows( const ViewManagerList& lst )
+{
+ QDict<int> viewersCounter; // map viewerType - to - index_of_this_viewer_type
+ viewersCounter.setAutoDelete( true );
+ for ( QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it) {
+ int view_count = it.current()->getViewsCount();
+ QString vType = it.current()->getType();
+ if ( !view_count )
+ continue; //No views is opened in the viewer
+
+ int* viewerID = viewersCounter[ vType ];
+ if ( !viewerID ) {
+ viewerID = new int( 0 );
+ viewersCounter.insert( vType, viewerID );
+ }
+ else
+ ++(*viewerID);
+
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ ) {
+ QString vName = QString( "%1_%2_%3" ).arg( vType ).arg( *viewerID ).arg( i );
+ views[i]->setName( vName );
+ }
+ }
+}
+
+//================================================================
+// Function : storeState
+/*! Purpose : store the visual parameters of the viewers
+*/
+//================================================================
+int SalomeApp_VisualState::storeState()
+{
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+ if ( !study )
+ return -1;
+
+ int savePoint = 1;
+ std::vector<int> savePoints = study->getSavePoints();
+ //Calculate a new savePoint number = the last save point number + 1
+ if ( savePoints.size() > 0)
+ savePoint = savePoints[savePoints.size()-1] + 1;
+
+ _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint );
+ SALOMEDS_IParameters ip( ap );
+
+ ViewManagerList lst;
+ myApp->viewManagers( lst );
+
+ // setting unique names for view windows in order to save this view inside
+ // workstack's structure (see below). On restore the views with the same names will
+ // be placed to the same place inside the workstack's splitters.
+ nameViewWindows( lst );
+
+ // store active window's name
+ SUIT_ViewWindow* win = myApp->desktop()->activeWindow();
+ if ( win )
+ ip.setProperty("AP_ACTIVE_VIEW", win->name() );
+
+ int viewerID = 0;
+ SUIT_ViewManager* vm = 0;
+ for (QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it ) {
+ vm = it.current();
+ int view_count = vm->getViewsCount();
+ if ( !view_count )
+ continue; //No views is opened in the viewer
+
+ std::string viewerEntry = QString( "%1_%2" ).arg( vm->getType() ).arg( ++viewerID ).latin1();
+ ip.append("AP_VIEWERS_LIST", viewerEntry);
+
+ QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+ for(int i = 0; i<view_count; i++) {
+ ip.append( viewerEntry, views[i]->caption() );
+ ip.append( viewerEntry, views[i]->getVisualParameters().latin1() );
+ }
+ }
+
+ //Save information about split areas
+ if ( myApp->desktop()->inherits( "STD_TabDesktop" ) ) {
+ QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack();
+ QString workstackInfo;
+ (*workstack) >> workstackInfo;
+ ip.setProperty( "AP_WORKSTACK_INFO", workstackInfo.latin1() );
+ }
+
+ //Save a name of the active module
+ if ( CAM_Module* activeModule = myApp->activeModule() )
+ ip.setProperty( "AP_ACTIVE_MODULE", activeModule->moduleName().latin1() );
+
+ //Store visual parameters of the modules
+ QPtrList<CAM_Module> mlist;
+ myApp->modules( mlist );
+ CAM_Module* module = 0;
+ for ( module = mlist.first(); module; module = mlist.next() ) {
+ if ( SalomeApp_Module* sModule = dynamic_cast<SalomeApp_Module*>( module ) ) {
+ ip.append( "AP_MODULES_LIST", sModule->moduleName().latin1() );
+ sModule->storeVisualParameters( savePoint );
+ }
+ }
+
+ return savePoint;
+}
+
+//================================================================
+// Function : restoreState
+/*! Purpose : restore the visual parameters of the viewers
+*/
+//================================================================
+void SalomeApp_VisualState::restoreState(int savePoint)
+{
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+ if ( !study )
+ return;
+
+ _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint );
+ SALOMEDS_IParameters ip(ap);
+
+ //Remove all already existent veiwers and their views
+ ViewManagerList lst;
+ myApp->viewManagers( lst );
+ for ( QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it )
+ myApp->removeViewManager( it.current() );
+
+ //Restore the viewers and view windows
+ int nbViewers = ip.nbValues( "AP_VIEWERS_LIST" );
+ SUIT_ViewWindow* viewWin = 0;
+
+ for ( int i = 0; i < nbViewers; i++ ) {
+ std::string viewerEntry = ip.getValue( "AP_VIEWERS_LIST", i );
+ std::vector<std::string> veiewerParams = ip.parseValue(viewerEntry,'_');
+ std::string type = veiewerParams[0];
+ std::string viewerID = veiewerParams[1];
+ SUIT_ViewManager* vm = myApp->newViewManager( type.c_str() );
+ if ( !vm )
+ continue; //Unknown viewer
+
+ int nbViews = (ip.nbValues(viewerEntry))/2;
+
+ //Create nbViews-1 view (-1 because 1 view is created by createViewManager)
+ for ( int i = 1; i< nbViews; i++ ) {
+ SUIT_ViewWindow* aView = vm->createViewWindow();
+ aView->show();
+ }
+
+ int viewCount = vm->getViewsCount();
+ if (viewCount != nbViews) {
+ printf( "\nRestore visual state: Unknow error, Can't create a view!\n" );
+ continue;
+ }
+
+ //Resize the views, set their captions and apply visual parameters.
+ QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+ for (int i = 0, j = 0; i<viewCount; i++, j++) {
+ viewWin = views[i];
+ if ( !viewWin )
+ continue;
+
+ // wait untill the window is really shown. This step fixes MANY bugs..
+ while ( !viewWin->isVisible() )
+ qApp->processEvents();
+
+ viewWin->setCaption(ip.getValue(viewerEntry, j).c_str());
+ viewWin->setVisualParameters(ip.getValue(viewerEntry, j+1).c_str());
+ }
+ }
+
+ // restore modules' visual parameters
+ std::vector<std::string> v = ip.getValues("AP_MODULES_LIST");
+ for ( int i = 0; i < v.size(); i++ ) {
+ myApp->activateModule( v[i].c_str() );
+ if ( SalomeApp_Module* module = dynamic_cast<SalomeApp_Module*>( myApp->activeModule() ) )
+ module->restoreVisualParameters( savePoint );
+ }
+
+ // activate module that was active on save
+ QString activeModuleName( ip.getProperty("AP_ACTIVE_MODULE" ).c_str() );
+ if ( !activeModuleName.isEmpty() )
+ myApp->activateModule( activeModuleName );
+
+ // setting unique names for view windows in order to restore positions of view windows inside
+ // workstack's structure (see below). During save the same naming algorithm was used,
+ // so the same views will get the same names.
+ lst.clear();
+ myApp->viewManagers(lst);
+ nameViewWindows( lst );
+
+ // work-around to bug of setting visual parameters of views: all view windows now have
+ // correct visual parameters, bug after restoring the workstack the visual parameters
+ // are messted, and must be re-set again. So here we store them in a map and set them
+ // later back again. why we don't store these parameters in a map on views creation?
+ // because 1) names of view windows are not set at that time 2) some view windows
+ // are created by modules' restoreVisualParameters (like Gauss Viewers), which is NOT here..
+ QMap<QString, QString> viewersParameters;
+ QPtrListIterator<SUIT_ViewManager> it( lst );
+ for ( ; it.current(); ++it ) {
+ int view_count = it.current()->getViewsCount();
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ )
+ viewersParameters[ views[i]->name() ] = views[i]->getVisualParameters();
+ }
+
+ // restore workstack parameters. should be done after module's restoreVisualParameters(), because
+ // some modules can create their own viewers (like VISU creates GaussViewers)
+ if ( myApp->desktop()->inherits( "STD_TabDesktop" ) ) {
+ QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack();
+ (*workstack) << ip.getProperty( "AP_WORKSTACK_INFO" ).c_str();
+ }
+
+ // restore visual parameters of view windows. it must be done AFTER restoring workstack.
+ for ( it.toFirst(); it.current(); ++it ) {
+ int view_count = it.current()->getViewsCount();
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ )
+ views[i]->setVisualParameters( viewersParameters[ views[i]->name() ] );
+ }
+
+ // set focus to previously saved active view window
+ std::string activeViewName = ip.getProperty("AP_ACTIVE_VIEW");
+ for ( it.toFirst(); it.current(); ++it ) {
+ int view_count = it.current()->getViewsCount();
+ QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ for ( int i = 0; i < view_count; i++ ) {
+ if ( activeViewName == views[i]->name() )
+ views[i]->setFocus();
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
+#ifndef SALOMEAPP_VISUALSTATE_H
+#define SALOMEAPP_VISUALSTATE_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "SalomeApp.h"
+
+class SalomeApp_Application;
+
+class SALOMEAPP_EXPORT SalomeApp_VisualState
+{
+public:
+ SalomeApp_VisualState( SalomeApp_Application* );
+ virtual ~SalomeApp_VisualState();
+
+ virtual int storeState();
+ virtual void restoreState( int savePoint );
+
+protected:
+ SalomeApp_Application* myApp;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif