+// 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 "CAM_Application.h"
#include "CAM_Study.h"
#include <qtextstream.h>
#include <qlabel.h>
#include <qfont.h>
+#include <qapplication.h>
#ifdef WIN32
#include <windows.h>
if ( myModule ){
// Connect the module to the active study
- CAM_Study* camStudy = dynamic_cast<CAM_Study*>( activeStudy() );
- if ( camStudy ){
- CAM_DataModel* prev = 0;
- for ( ModuleListIterator it( myModules ); it.current(); ++it ) {
- CAM_DataModel* dm = it.current()->dataModel();
- if ( it.current() == myModule && !camStudy->containsDataModel( dm ) ){
- if ( prev )
- camStudy->insertDataModel( it.current()->dataModel(), prev );
- else
- camStudy->insertDataModel( it.current()->dataModel(), 0 );
- }
- prev = dm;
- }
- }
+ myModule->connectToStudy( dynamic_cast<CAM_Study*>( activeStudy() ) );
if ( !myModule->activateModule( activeStudy() ) )
{
myModule->setMenuShown( false );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QString modStr = resMgr->stringValue( "launch", "modules", QString::null );
- QStringList modList = QStringList::split( ",", modStr );
+ QStringList modList;
+
+ // parse command line arguments
+ int nbArgs = qApp->argc();
+ char** CmdLine = qApp->argv();
+ QString CmdStr;
+ for ( int i = 0; i < nbArgs; i++ )
+ {
+ CmdStr.append(CmdLine[i]);
+ CmdStr.append(" ");
+ }
+ int startId = CmdStr.find("--modules (");
+ if ( startId != -1 ) { // application launch with --modules option
+ startId = CmdStr.find("(", startId);
+ int stopId = CmdStr.find(" )", startId);
+ QString ModStr = CmdStr.mid( startId+1, stopId - (startId+1) ).stripWhiteSpace();
+ int i = 0;
+ while ( i < ModStr.length() )
+ {
+ int nextId = ModStr.find( ":", i );
+ modList.append( ModStr.mid( i, nextId - i ).stripWhiteSpace() );
+ i = nextId + 1;
+ }
+ }
+ else {
+ QString modStr = resMgr->stringValue( "launch", "modules", QString::null );
+ modList = QStringList::split( ",", modStr );
+ }
for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it )
{
SUIT_Study* study = activeStudy();
STD_Application::createEmptyStudy();
-
- SUIT_Study* newStudy = activeStudy();
- if ( study != newStudy )
- {
- CAM_Study* camStudy = dynamic_cast<CAM_Study*>( newStudy );
- for ( ModuleListIterator it( myModules ); it.current(); ++it )
- camStudy->insertDataModel( it.current()->dataModel() );
- }
}