-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "LightApp_Application.h"
#include "LightApp_Module.h"
#include "LightApp_DataModel.h"
+#include "LightApp_DataOwner.h"
#include "LightApp_Study.h"
#include "LightApp_Preferences.h"
#include "LightApp_PreferencesDlg.h"
// ... "Trihedron" group <<end>>
// .. "3D viewer" group <<end>>
+ QString formats;
+ int bgId;
+#ifndef DISABLE_OCCVIEWER
// .. "OCC viewer" group <<start>>
int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), salomeCat );
aValuesList.clear();
anIndicesList.clear();
txtList.clear();
- QString formats = OCCViewer_Viewer::backgroundData( aValuesList, idList, txtList );
+ formats = OCCViewer_Viewer::backgroundData( aValuesList, idList, txtList );
foreach( int gid, idList ) anIndicesList << gid;
// .... -> 3D viewer background
- int bgId = pref->addPreference( tr( "PREF_3DVIEWER_BACKGROUND" ), bgGroup,
+ bgId = pref->addPreference( tr( "PREF_3DVIEWER_BACKGROUND" ), bgGroup,
LightApp_Preferences::Background, "OCCViewer", "background" );
pref->setItemProperty( "gradient_names", aValuesList, bgId );
pref->setItemProperty( "gradient_ids", anIndicesList, bgId );
pref->setItemProperty( "columns", 2, occGen );
// ... -> empty frame (for layout) <<end>>
// .. "OCC viewer" group <<end>>
+#endif
+#ifndef DISABLE_VTKVIEWER
// .. "VTK viewer" group <<start>>
int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), salomeCat ); //viewTab
aValuesList.clear();
anIndicesList.clear();
txtList.clear();
+#ifndef DISABLE_SALOMEOBJECT
formats = SVTK_Viewer::backgroundData( aValuesList, idList, txtList );
+#endif
foreach( int gid, idList ) anIndicesList << gid;
bgId = pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGen,
LightApp_Preferences::Background, "VTKViewer", "background" );
pref->setItemProperty( "texture_tile_enabled", (bool)txtList.contains( Qtx::TileTexture ), bgId );
pref->setItemProperty( "texture_stretch_enabled", (bool)txtList.contains( Qtx::StretchTexture ), bgId );
pref->setItemProperty( "custom_enabled", false, bgId );
+#ifndef DISABLE_SALOMEOBJECT
pref->setItemProperty( "image_formats", formats, bgId );
+#endif
// .... -> speed increment
int vtkSpeed = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED" ), vtkGen,
LightApp_Preferences::IntSpin, "VTKViewer", "speed_value" );
pref->setItemProperty( "step", 0.1, transPref );
// ... -> group names sub-group <<end>>
// .. "VTK viewer" group <<end>>
+#endif
// .. "Plot2d viewer" group <<start>>
int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), salomeCat ); //viewTab
if ( aResMgr->hasValue("windows_geometry" ,modName ) ) {
QByteArray arr;
aResMgr->value("windows_geometry", modName , arr );
- QByteArray aTargetArray = processState(arr, storeWin, storeTb, aDefaultState);
+ QByteArray aTargetArray = processState(arr, storeWin, storeTb, true, aDefaultState);
desktop()->restoreState( aTargetArray );
}
modName = activeModule()->name();
QByteArray arr = desktop()->saveState();
- resourceMgr()->setValue( "windows_geometry", modName, processState(arr, storeWin, storeTb) );
+ resourceMgr()->setValue( "windows_geometry", modName, processState(arr, storeWin, storeTb, false) );
QByteArray visArr;
if ( myWinVis.contains( modName ) )
a->setShortcut( ob->shortcutKey(SUIT_DataBrowser::UpdateShortcut) );
}
+#ifndef DISABLE_SALOMEOBJECT
if ( selMgr && ob ) {
SALOME_ListIO selected;
selMgr->selectedObjects( selected );
}
}
}
+#endif
selMgr->setSelectionCacheEnabled( cacheIsOn );
}
/*!
Internal method to parse toolbars and dockable windows state.
*/
-QByteArray LightApp_Application::processState(QByteArray& input, const bool processWin,const bool processTb, QByteArray defaultState) {
+QByteArray LightApp_Application::processState(QByteArray& input,
+ const bool processWin,
+ const bool processTb,
+ const bool isRestoring,
+ QByteArray defaultState) {
QByteArray aRes;
bool hasDefaultState = !defaultState.isEmpty();
bool isDockWinWriten = false;
- if(processWin && processTb) {
+ int nbDocWin = -1;
+ //Write date from users settings
+ if(isRestoring){
+ QDataStream tmpInputData(&input, QIODevice::ReadOnly);
+ int marker, version;
+ uchar dockmarker;
+ tmpInputData >> marker;
+ tmpInputData >> version;
+ tmpInputData >> dockmarker;
+ tmpInputData >> nbDocWin;
+ }
+ if(processWin && processTb && !isRestoring) {
aRes = input;
} else if(!processWin && !processTb ) {
if(hasDefaultState)
QDataStream* aTargetData = 0;
int aTargetIndex = -1;
- if(processWin) {
- //Write date from users settings
+ QByteArray currentArr = desktop()->saveState();
+ QDataStream anInputDataCur(¤tArr, QIODevice::ReadOnly);
+ bool useInputData = !isRestoring || (isRestoring && nbDocWin > 0);
+ if(processWin && useInputData) {
aTargetData = &anInputData;
aTargetIndex = toolBarMarkerIndex;
} else {
//Write date from default settings
if(hasDefaultState) {
aTargetData = &anInputDataDef;
- aTargetIndex = toolBarMarkerIndexDef;
+ aTargetIndex = toolBarMarkerIndexDef;
+ } else {
+ //If no default state, write current snapshot of the dockable windows
+ if(isRestoring) {
+ aTargetData = &anInputDataCur;
+ int toolBarMarkerIndexCur = getToolbarMarkerIndex(currentArr, aNames);
+ aTargetIndex = toolBarMarkerIndexCur;
+ }
}
}