-// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <Standard_Version.hxx>
-//---------------------------------------------------------
-#define USE_DEBUG
-//#define MB_IGNORE_QT
-//#define MB_FULL_DUMP
-#define MBCLASSNAME "LightApp_Application"
-#include "MBDebug.h"
-// <-- insert includes for addtional debug headers here!
-//---------------------------------------------------------
-
#define ToolBarMarker 0
#define DockWidgetMarker 1
myPrefs( 0 ),
myScreenHelper(new LightApp_FullScreenHelper())
{
- DBG_FUN();
Q_INIT_RESOURCE( LightApp );
STD_TabDesktop* desk = new STD_TabDesktop();
*/
LightApp_Application::~LightApp_Application()
{
- DBG_FUN();
savePreferences();
delete mySelMgr;
delete myScreenHelper;
/*!Start application.*/
void LightApp_Application::start()
{
- DBG_FUN();
CAM_Application::start();
updateWindows();
/*!Closeapplication.*/
void LightApp_Application::closeApplication()
{
- DBG_FUN();
#ifndef DISABLE_QTXWEBBROWSER
QProcess::startDetached( "HelpBrowser",
QStringList() << QString( "--remove=%1" ).arg( QApplication::instance()->applicationPid() ) );
*/
void LightApp_Application::onStudyOpened( SUIT_Study* theStudy )
{
- DBG_FUN();
SUIT_DataObject* aRoot = 0;
if ( theStudy && theStudy->root() )
{
/*!Protected SLOT. On study saved.*/
void LightApp_Application::onStudySaved( SUIT_Study* s )
{
- DBG_FUN();
QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
if ( mru && s ) {
- MSGEL("...adding [" << s->studyName().toStdString() << "] to MRU");
mru->insert( s->studyName() );
}
/*!Protected SLOT. On study closed.*/
void LightApp_Application::onStudyClosed( SUIT_Study* /*s*/ )
{
- DBG_FUN();
/*
disconnect( this, SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
void LightApp_Application::studyOpened( SUIT_Study* s )
{
- DBG_FUN();
CAM_Application::studyOpened( s );
updateWindows();
void LightApp_Application::studySaved( SUIT_Study* s )
{
- DBG_FUN();
CAM_Application::studyOpened( s );
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
if ( aResMgr && activeStudy() ) {
void LightApp_Application::onMRUActivated( const QString& name )
{
- DBG_FUN();
- ARG(name);
SUIT_Session* s = SUIT_Session::session();
if ( s && s->activeApplication() == this )
onOpenDoc( name );
-// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SUIT_DataBrowser.h>
#include <SUIT_DataObject.h>
-//---------------------------------------------------------
-#define USE_DEBUG
-//#define MB_IGNORE_QT
-//#define MB_FULL_DUMP
-#define MBCLASSNAME "LightApp_DataModel"
-#include "MBDebug.h"
-// <-- insert includes for addtional debug headers here!
-//---------------------------------------------------------
/*!
Constructor
LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule )
: CAM_DataModel( theModule )
{
- DBG_FUN();
myGroupId = 0;
if( module() )
myGroupId = qHash( module()->name() );
*/
LightApp_DataModel::~LightApp_DataModel()
{
- DBG_FUN();
}
/*!
*/
bool LightApp_DataModel::open( const QString&, CAM_Study*, QStringList )
{
- DBG_FUN();
emit opened(); //TODO: is it really needed? to be removed maybe...
return true;
}
*/
bool LightApp_DataModel::save( QStringList& )
{
- DBG_FUN();
emit saved();
return true;
}
*/
bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList&, bool isBackup/*=false*/ )
{
- DBG_FUN();
- ARG(isBackup);
if (!isBackup)
emit saved();
return true;
*/
bool LightApp_DataModel::close()
{
- DBG_FUN();
emit closed();
return true;
}
*/
void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* )
{
- DBG_FUN();
// san: Previously modelRoot was casted to LightApp_ModuleObject*,
// BUT this is incorrect: in full SALOME the model root has different type.
// Hopefully LightApp_DataObject* is sufficient here.
-// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <set>
-//---------------------------------------------------------
-#define USE_DEBUG
-//#define MB_IGNORE_QT
-//#define MB_FULL_DUMP
-#define MBCLASSNAME "LightApp_Study"
-#include "MBDebug.h"
-// <-- insert includes for addtional debug headers here!
-//---------------------------------------------------------
/*!
Constructor.
LightApp_Study::LightApp_Study( SUIT_Application* app )
: CAM_Study( app )
{
- DBG_FUN();
// HDF persistence
myDriver = new LightApp_HDFDriver();
//myDriver = new LightApp_Driver();
*/
LightApp_Study::~LightApp_Study()
{
- DBG_FUN();
delete myDriver; myDriver = 0;
}
*/
bool LightApp_Study::createDocument( const QString& theStr )
{
- DBG_FUN();
- ARG(theStr);
// create myRoot
setRoot( new LightApp_RootObject( this ) );
*/
bool LightApp_Study::openDocument( const QString& theFileName )
{
- DBG_FUN();
- ARG(theFileName);
myDriver->ClearDriverContents();
// create files for models from theFileName
if( !openStudyData(theFileName, 0)) // 0 means persistence file
*/
bool LightApp_Study::loadDocument( const QString& theStudyName )
{
- DBG_FUN();
- ARG(theStudyName);
myDriver->ClearDriverContents();
if( !openStudyData(theStudyName, 0)) // 0 means persistence file
return false;
*/
bool LightApp_Study::saveDocumentAs( const QString& theFileName, bool isBackup/*=false*/ )
{
- DBG_FUN();
- ARG(theFileName);
- ARG(isBackup);
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if( !resMgr )
return false;
*/
bool LightApp_Study::saveDocument()
{
- DBG_FUN();
ModelList list; dataModels( list );
myDriver->ClearDriverContents();
*/
void LightApp_Study::closeDocument(bool permanently)
{
- DBG_FUN();
- ARG(permanently);
// Inform everybody that this study is going to close when it's most safe to,
// i.e. in the very beginning
emit closed( this );
*/
void LightApp_Study::saveModuleData(QString theModuleName, int type, QStringList theListOfFiles)
{
- DBG_FUN();
- ARG(theModuleName);
- ARG(type);
- ARG(theListOfFiles);
int aNb = theListOfFiles.count();
if ( aNb == 0 )
return;
*/
bool LightApp_Study::saveStudyData( const QString& theFileName, int /*type*/ )
{
- DBG_FUN();
- ARG(theFileName);
ModelList list; dataModels( list );
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if( !resMgr )
+++ /dev/null
-#ifndef MBDebug_HeaderFile\r
-#define MBDebug_HeaderFile\r
-\r
-//---------------------------------------------------------------\r
-// Usage of the logging facilities:\r
-//\r
-// (1) At the beginning of each class file to be debugged, there\r
-// should be a static string variable defined with the name\r
-// of the class. Then, include the "MBDebug.h" header file.\r
-//\r
-// //---------------------------------------------------------\r
-// #define USE_DEBUG\r
-// //#define MB_IGNORE_QT\r
-// //#define MB_FULL_DUMP\r
-// #define MBCLASSNAME "ClassName"\r
-// #include "MBDebug.h"\r
-// // <-- insert includes for addtional debug headers here!\r
-// //---------------------------------------------------------\r
-//\r
-// (2) At the beginning of each class method, call the DBG_FUN\r
-// macro.\r
-//\r
-// int ClassName::MyMethod(int x)\r
-// {\r
-// DBG_FUN();\r
-// ...\r
-// }\r
-//\r
-// NOTE: For static methods, call the DBG_FUNC() macro!!\r
-//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
-// This debugging/logging class is a "header-only" solution and\r
-// does NOT require any additional implementation (.cpp) file!\r
-//---------------------------------------------------------------\r
-\r
-#include <iostream>\r
-#include <string>\r
-#include <locale>\r
-#include <codecvt>\r
-#include <list>\r
-#include <map>\r
-#include <set>\r
-#include <vector>\r
-#include <mutex>\r
-#include <thread>\r
-#ifndef MB_IGNORE_QT\r
-# include <QString>\r
-# include <QStringList>\r
-#endif\r
-\r
-static std::mutex mtx;\r
-\r
-//---------------------------------------------------------------\r
-// Set the debug flags dependent on the preprocessor definitions\r
-//---------------------------------------------------------------\r
-#ifdef USE_DEBUG\r
-# define MBS_DEBUG_FLAG MBDebug::DF_DEBUG\r
-#else\r
-# define MBS_DEBUG_FLAG 0\r
-#endif /*DEBUG*/ \r
-\r
-#define MBS_DBG_FLAGS (MBS_DEBUG_FLAG)\r
-\r
-\r
-//---------------------------------------------------------------\r
-// Define the global debug macros\r
-//---------------------------------------------------------------\r
-#define DLOG MBDebug::LogPrint()\r
-#define RETURN(var) { RET(var); return (var); }\r
-\r
-#ifdef USE_DEBUG\r
-\r
-# define DBG_FUN() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS, (void*)this)\r
-# define DBG_FUNC() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS)\r
-# define DBG_FUNB(blk) MBDebug _dbg(MBCLASSNAME, blk, MBS_DBG_FLAGS)\r
-# define MSGEL(txt) MBDebug::LogPrint() << ":" << txt << std::endl\r
-# define PRINT(txt) MBDebug::LogPrint() << txt\r
-# define SHOW2(var,typ) do { PRINT(std::this_thread::get_id()); DumpVar(#var,(typ)(var)); } while (0)\r
-# define SHOW(var) do { PRINT(std::this_thread::get_id()); DumpVar(#var,var); } while (0)\r
-# define ARG(var) do { PRINT(std::this_thread::get_id() << ":in:"); DumpVar(#var,var); } while (0)\r
-# define ARG2(var,typ) do { PRINT(std::this_thread::get_id() << ":in:"); DumpVar(#var,(typ)(var)); } while (0)\r
-# define RET(var) do { PRINT(std::this_thread::get_id() << ":out:"); DumpVar(#var,var); } while (0)\r
-# define MSG(txt) MBDebug::LogPrint() << std::this_thread::get_id() << ":" << txt\r
-\r
-#else /*!USE_DEBUG*/ \r
-\r
-# define DBG_FUN()\r
-# define DBG_FUNC()\r
-# define DBG_FUNB(blk)\r
-# define MSGEL(txt)\r
-# define PRINT(txt)\r
-# define SHOW2(var,typ)\r
-# define SHOW(var)\r
-# define ARG(var)\r
-# define ARG2(var,typ)\r
-# define RET(var)\r
-# define MSG(txt)\r
-\r
-#endif /*USE_DEBUG*/ \r
-\r
-\r
-//---------------------------------------------------------------\r
-// Declare the debugging and profiling class\r
-//---------------------------------------------------------------\r
-class MBDebug\r
-{\r
-public:\r
- enum {\r
- DF_NONE = 0x00, // no debug\r
- DF_DEBUG = 0x01 // debug a function\r
- };\r
-\r
- MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL)\r
- :mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag)\r
- {\r
- if (mFlags & (DF_DEBUG))\r
- {\r
- std::lock_guard<std::mutex> lck(mtx);\r
- std::cout << std::this_thread::get_id() << ":{ENTER: " << mClassName + "::" + mFuncName;\r
- if (mThis) std::cout << "(this=" << mThis << ")";\r
- std::cout << std::endl;\r
- }\r
- }\r
- virtual ~MBDebug()\r
- {\r
- if (mFlags & (DF_DEBUG))\r
- {\r
- std::lock_guard<std::mutex> lck(mtx);\r
- std::cout << std::this_thread::get_id() << ":}LEAVE: " << mClassName << "::" << mFuncName << std::endl;\r
- }\r
- }\r
-\r
- // Log file output management\r
- static std::ostream& LogPrint() { return std::cout; }\r
-\r
-private:\r
- std::string mClassName; // Name of class to be debugged\r
- std::string mFuncName; // Name of function to be debugged\r
- void* mThis; // The "this" pointer to the class being debugged\r
- unsigned char mFlags; // Debug mode flags\r
-};\r
-\r
-\r
-\r
-#define YesNo(b) (b ? "Yes" : "No")\r
-\r
-\r
-\r
-inline std::string w2s(std::wstring ws)\r
-{\r
- using convert_typeX = std::codecvt_utf8<wchar_t>;\r
- std::wstring_convert<convert_typeX, wchar_t> converterX;\r
- return(converterX.to_bytes(ws));\r
-}\r
-\r
-// Primitive types\r
-inline void DumpVar(const char *szName, char value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, bool value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, short value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[shrt]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, int value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[int]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, long value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[long]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, double value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[dbl]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned char value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned short value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned int value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned long value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const char* value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::string &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::wstring &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl;\r
-}\r
-\r
-#ifndef MB_IGNORE_QT\r
-inline void DumpVar(const char *szName, const QString &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const QStringList &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[QStrLst]: " << szName << "=[len=" << value.length() << "] {";\r
- bool first = true;\r
- QStringList::const_iterator it = value.constBegin();\r
- for ( ; it != value.constEnd(); ++it)\r
- {\r
- DLOG << (first ? "" : ",") << "\"" << (*it).toStdString() << "\"";\r
- first = false;\r
- }\r
- DLOG << "}" << std::endl;\r
-}\r
-#endif\r
-\r
-inline void DumpVar(const char *szName, const void* value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[ptr]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-\r
-// Collection of primitive types\r
-inline void DumpVar(const char *szName, const std::set<int> &values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[intSet]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "" : ",") << *it;\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::vector<int> &values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[intVect]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "" : ",") << *it;\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::list<bool>& values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[boolList]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N");\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::list<std::string> &values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[strLst]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "\"" : ", \"") << *it << "\"";\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-#endif // MBDebug_HeaderFile\r
-\r
+++ /dev/null
-#ifndef MBDebug_HeaderFile\r
-#define MBDebug_HeaderFile\r
-\r
-//---------------------------------------------------------------\r
-// Usage of the logging facilities:\r
-//\r
-// (1) At the beginning of each class file to be debugged, there\r
-// should be a static string variable defined with the name\r
-// of the class. Then, include the "MBDebug.h" header file.\r
-//\r
-// //---------------------------------------------------------\r
-// #define USE_DEBUG\r
-// //#define MB_IGNORE_QT\r
-// //#define MB_FULL_DUMP\r
-// #define MBCLASSNAME "ClassName"\r
-// #include "MBDebug.h"\r
-// // <-- insert includes for addtional debug headers here!\r
-// //---------------------------------------------------------\r
-//\r
-// (2) At the beginning of each class method, call the DBG_FUN\r
-// macro.\r
-//\r
-// int ClassName::MyMethod(int x)\r
-// {\r
-// DBG_FUN();\r
-// ...\r
-// }\r
-//\r
-// NOTE: For static methods, call the DBG_FUNC() macro!!\r
-//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
-// This debugging/logging class is a "header-only" solution and\r
-// does NOT require any additional implementation (.cpp) file!\r
-//---------------------------------------------------------------\r
-\r
-#include <iostream>\r
-#include <string>\r
-#include <locale>\r
-#include <codecvt>\r
-#include <list>\r
-#include <map>\r
-#include <set>\r
-#include <vector>\r
-#include <mutex>\r
-#include <thread>\r
-#ifndef MB_IGNORE_QT\r
-# include <QString>\r
-# include <QStringList>\r
-#endif\r
-\r
-static std::mutex mtx;\r
-\r
-//---------------------------------------------------------------\r
-// Set the debug flags dependent on the preprocessor definitions\r
-//---------------------------------------------------------------\r
-#ifdef USE_DEBUG\r
-# define MBS_DEBUG_FLAG MBDebug::DF_DEBUG\r
-#else\r
-# define MBS_DEBUG_FLAG 0\r
-#endif /*DEBUG*/ \r
-\r
-#define MBS_DBG_FLAGS (MBS_DEBUG_FLAG)\r
-\r
-\r
-//---------------------------------------------------------------\r
-// Define the global debug macros\r
-//---------------------------------------------------------------\r
-#define DLOG MBDebug::LogPrint()\r
-#define RETURN(var) { RET(var); return (var); }\r
-\r
-#ifdef USE_DEBUG\r
-\r
-# define DBG_FUN() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS, (void*)this)\r
-# define DBG_FUNC() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS)\r
-# define DBG_FUNB(blk) MBDebug _dbg(MBCLASSNAME, blk, MBS_DBG_FLAGS)\r
-# define MSGEL(txt) MBDebug::LogPrint() << ":" << txt << std::endl\r
-# define PRINT(txt) MBDebug::LogPrint() << txt\r
-# define SHOW2(var,typ) do { PRINT(std::this_thread::get_id()); DumpVar(#var,(typ)(var)); } while (0)\r
-# define SHOW(var) do { PRINT(std::this_thread::get_id()); DumpVar(#var,var); } while (0)\r
-# define ARG(var) do { PRINT(std::this_thread::get_id() << ":in:"); DumpVar(#var,var); } while (0)\r
-# define ARG2(var,typ) do { PRINT(std::this_thread::get_id() << ":in:"); DumpVar(#var,(typ)(var)); } while (0)\r
-# define RET(var) do { PRINT(std::this_thread::get_id() << ":out:"); DumpVar(#var,var); } while (0)\r
-# define MSG(txt) MBDebug::LogPrint() << std::this_thread::get_id() << ":" << txt\r
-\r
-#else /*!USE_DEBUG*/ \r
-\r
-# define DBG_FUN()\r
-# define DBG_FUNC()\r
-# define DBG_FUNB(blk)\r
-# define MSGEL(txt)\r
-# define PRINT(txt)\r
-# define SHOW2(var,typ)\r
-# define SHOW(var)\r
-# define ARG(var)\r
-# define ARG2(var,typ)\r
-# define RET(var)\r
-# define MSG(txt)\r
-\r
-#endif /*USE_DEBUG*/ \r
-\r
-\r
-//---------------------------------------------------------------\r
-// Declare the debugging and profiling class\r
-//---------------------------------------------------------------\r
-class MBDebug\r
-{\r
-public:\r
- enum {\r
- DF_NONE = 0x00, // no debug\r
- DF_DEBUG = 0x01 // debug a function\r
- };\r
-\r
- MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL)\r
- :mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag)\r
- {\r
- if (mFlags & (DF_DEBUG))\r
- {\r
- std::lock_guard<std::mutex> lck(mtx);\r
- std::cout << std::this_thread::get_id() << ":{ENTER: " << mClassName + "::" + mFuncName;\r
- if (mThis) std::cout << "(this=" << mThis << ")";\r
- std::cout << std::endl;\r
- }\r
- }\r
- virtual ~MBDebug()\r
- {\r
- if (mFlags & (DF_DEBUG))\r
- {\r
- std::lock_guard<std::mutex> lck(mtx);\r
- std::cout << std::this_thread::get_id() << ":}LEAVE: " << mClassName << "::" << mFuncName << std::endl;\r
- }\r
- }\r
-\r
- // Log file output management\r
- static std::ostream& LogPrint() { return std::cout; }\r
-\r
-private:\r
- std::string mClassName; // Name of class to be debugged\r
- std::string mFuncName; // Name of function to be debugged\r
- void* mThis; // The "this" pointer to the class being debugged\r
- unsigned char mFlags; // Debug mode flags\r
-};\r
-\r
-\r
-\r
-#define YesNo(b) (b ? "Yes" : "No")\r
-\r
-\r
-\r
-inline std::string w2s(std::wstring ws)\r
-{\r
- using convert_typeX = std::codecvt_utf8<wchar_t>;\r
- std::wstring_convert<convert_typeX, wchar_t> converterX;\r
- return(converterX.to_bytes(ws));\r
-}\r
-\r
-// Primitive types\r
-inline void DumpVar(const char *szName, char value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, bool value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, short value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[shrt]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, int value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[int]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, long value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[long]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, double value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[dbl]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned char value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned short value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned int value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned long value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const char* value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::string &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::wstring &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl;\r
-}\r
-\r
-#ifndef MB_IGNORE_QT\r
-inline void DumpVar(const char *szName, const QString &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const QStringList &value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[QStrLst]: " << szName << "=[len=" << value.length() << "] {";\r
- bool first = true;\r
- QStringList::const_iterator it = value.constBegin();\r
- for ( ; it != value.constEnd(); ++it)\r
- {\r
- DLOG << (first ? "" : ",") << "\"" << (*it).toStdString() << "\"";\r
- first = false;\r
- }\r
- DLOG << "}" << std::endl;\r
-}\r
-#endif\r
-\r
-inline void DumpVar(const char *szName, const void* value)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[ptr]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-\r
-// Collection of primitive types\r
-inline void DumpVar(const char *szName, const std::set<int> &values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[intSet]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "" : ",") << *it;\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::vector<int> &values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[intVect]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "" : ",") << *it;\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::list<bool>& values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[boolList]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N");\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::list<std::string> &values)\r
-{\r
- std::lock_guard<std::mutex> lck(mtx);\r
- DLOG << "[strLst]: " << szName << "={" << values.size() << "}[";\r
- bool bFirst = true;\r
- for (auto it=values.cbegin(); it!=values.cend(); ++it) {\r
- DLOG << (bFirst ? "\"" : ", \"") << *it << "\"";\r
- bFirst = false;\r
- }\r
- DLOG << "]" << std::endl;\r
-}\r
-\r
-#endif // MBDebug_HeaderFile\r
-\r
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
-//---------------------------------------------------------
-#define USE_DEBUG
-//#define MB_IGNORE_QT
-//#define MB_FULL_DUMP
-#define MBCLASSNAME "SalomeApp_Study"
-#include "MBDebug.h"
-// <-- insert includes for addtional debug headers here!
-//---------------------------------------------------------
//#define NOTIFY_BY_EVENT
SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
: LightApp_Study( app ), myObserver( 0 )
{
- DBG_FUN();
myStudyDS = SalomeApp_Application::getStudy();
}
*/
SalomeApp_Study::~SalomeApp_Study()
{
- DBG_FUN();
if ( myObserver ) {
PortableServer::ObjectId_var oid = myObserver->_default_POA()->servant_to_id( myObserver );
myObserver->_default_POA()->deactivate_object( oid.in() );
*/
bool SalomeApp_Study::createDocument( const QString& theStr )
{
- DBG_FUN();
- ARG(theStr);
MESSAGE( "createDocument" );
setStudyName( QString::fromUtf8(myStudyDS->URL().c_str()) );
*/
bool SalomeApp_Study::openDocument( const QString& theFileName )
{
- DBG_FUN();
- ARG(theFileName);
MESSAGE( "openDocument" );
// read HDF file
*/
bool SalomeApp_Study::loadDocument( const QString& theStudyName )
{
- DBG_FUN();
- ARG(theStudyName);
MESSAGE( "loadDocument" );
setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
*/
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName, bool isBackup/*=false*/ )
{
- DBG_FUN();
- ARG(theFileName);
- ARG(isBackup);
-
bool wasSaved = isSaved();
bool wasModified = isModified();
std::string oldName = (studyDS() ? studyDS()->Name() : "");
// If the document hasn't been saved before, reset here its name and URL
if (studyDS())
{
- MSGEL("Restore URL to: " << oldURL);
- MSGEL("Restore Name to: " << oldName);
studyDS()->URL(oldURL);
studyDS()->Name(oldName);
}
*/
bool SalomeApp_Study::saveDocument()
{
- DBG_FUN();
bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
if ( store )
SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
*/
void SalomeApp_Study::closeDocument(bool permanently)
{
- DBG_FUN();
LightApp_Study::closeDocument(permanently);
// close SALOMEDS document
bool isMultiFile,
bool toSaveGUI )
{
- DBG_FUN();
- ARG(theFileName);
- ARG(toPublish);
- ARG(isMultiFile);
- ARG(toSaveGUI);
int savePoint = 0;
_PTR(AttributeParameter) ap;
_PTR(IParameters) ip = ClientFactory::getIParameters(ap);