From: mbs Date: Tue, 14 Mar 2023 10:23:39 +0000 (+0000) Subject: added debug information X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=893f25a2b4df062e174002ac6afa0d66ff40cd64;p=modules%2Fgui.git added debug information --- diff --git a/src/PV3DViewer/MBDebug.h b/src/PV3DViewer/MBDebug.h new file mode 100644 index 000000000..bde273ff5 --- /dev/null +++ b/src/PV3DViewer/MBDebug.h @@ -0,0 +1,244 @@ +#ifndef MBDebug_HeaderFile +#define MBDebug_HeaderFile + +//--------------------------------------------------------------- +// Usage of the logging facilities: +// +// (1) At the beginning of each class file to be debugged, there +// should be a static string variable defined with the name +// of the class. Then, include the "MBDebug.h" header file. +// +// //--------------------------------------------------------- +// #define USE_DEBUG +// //#define MB_IGNORE_QT +// #define MBCLASSNAME "ClassName" +// #include "MBDebug.h" +// //--------------------------------------------------------- +// +// (2) At the beginning of each class method, call the DBG_FUN +// macro. +// +// int ClassName::MyMethod(int x) +// { +// DBG_FUN(); +// ... +// } +// +// NOTE: For static methods, call the DBG_FUNC() macro!! +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// This debugging/logging class is a "header-only" solution and +// does NOT require any additional implementation (.cpp) file! +//--------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef MB_IGNORE_QT +# include +#endif + +//--------------------------------------------------------------- +// Set the debug flags dependent on the preprocessor definitions +//--------------------------------------------------------------- +#ifdef USE_DEBUG +# define MBS_DEBUG_FLAG MBDebug::DF_DEBUG +#else +# define MBS_DEBUG_FLAG 0 +#endif /*DEBUG*/ + +#define MBS_DBG_FLAGS (MBS_DEBUG_FLAG) + + +//--------------------------------------------------------------- +// Define the global debug macros +//--------------------------------------------------------------- +#define DLOG MBDebug::LogPrint() +#define RETURN(var) { RET(var); return (var); } + +#ifdef USE_DEBUG + +# define DBG_FUN() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS, (void*)this) +# define DBG_FUNC() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS) +# define DBG_FUNB(blk) MBDebug _dbg(MBCLASSNAME, blk, MBS_DBG_FLAGS) +# define MSGEL(txt) MBDebug::LogPrint() << txt << std::endl +# define PRINT(txt) MBDebug::LogPrint() << txt +# define SHOW2(var,typ) DumpVar(#var,(typ)(var)) +# define SHOW(var) DumpVar(#var,var) +# define ARG(var) do { PRINT("in:"); DumpVar(#var,var); } while (0) +# define ARG2(var,typ) do { PRINT("in:"); DumpVar(#var,(typ)(var)); } while (0) +# define RET(var) do { PRINT("out:"); DumpVar(#var,var); } while (0) +# define MSG(txt) MBDebug::LogPrint() << txt + +#else /*!USE_DEBUG*/ + +# define DBG_FUN() +# define DBG_FUNC() +# define DBG_FUNB(blk) +# define MSGEL(txt) +# define PRINT(txt) +# define SHOW2(var,typ) +# define SHOW(var) +# define ARG(var) +# define ARG2(var,typ) +# define RET(var) +# define MSG(txt) + +#endif /*USE_DEBUG*/ + + +//--------------------------------------------------------------- +// Declare the debugging and profiling class +//--------------------------------------------------------------- +class MBDebug +{ +public: + enum { + DF_NONE = 0x00, // no debug + DF_DEBUG = 0x01 // debug a function + }; + + MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL) + :mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag) + { + if (mFlags & (DF_DEBUG)) + { + std::cout << "{ENTER: " << mClassName + "::" + mFuncName; + if (mThis) std::cout << "(this=" << mThis << ")"; + std::cout << std::endl; + } + } + virtual ~MBDebug() + { + if (mFlags & (DF_DEBUG)) + std::cout << "}LEAVE: " << mClassName << "::" << mFuncName << std::endl; + } + + // Log file output management + static std::ostream& LogPrint() { return std::cout; } + +private: + std::string mClassName; // Name of class to be debugged + std::string mFuncName; // Name of function to be debugged + void* mThis; // The "this" pointer to the class being debugged + unsigned char mFlags; // Debug mode flags +}; + + + +#define YesNo(b) (b ? "Yes" : "No") + + + +inline std::string w2s(std::wstring ws) +{ + using convert_typeX = std::codecvt_utf8; + std::wstring_convert converterX; + return(converterX.to_bytes(ws)); +} + +// Primitive types +inline void DumpVar(const char *szName, char value) +{ + DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl; +} + +inline void DumpVar(const char *szName, bool value) +{ + DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl; +} + +inline void DumpVar(const char *szName, short value) +{ + DLOG << "[shrt]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, int value) +{ + DLOG << "[int]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, long value) +{ + DLOG << "[long]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, double value) +{ + DLOG << "[dbl]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, unsigned char value) +{ + DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, unsigned short value) +{ + DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, unsigned int value) +{ + DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, unsigned long value) +{ + DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, const char* value) +{ + DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl; +} + +inline void DumpVar(const char *szName, const std::string &value) +{ + DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl; +} + +inline void DumpVar(const char *szName, const std::wstring &value) +{ + DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl; +} + +#ifndef MB_IGNORE_QT +inline void DumpVar(const char *szName, const QString &value) +{ + DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl; +} +#endif + +inline void DumpVar(const char *szName, const void* value) +{ + DLOG << "[ptr]: " << szName << "=" << value << std::endl; +} + + +// Collection of primitive types +inline void DumpVar(const char *szName, const std::set &values) +{ + DLOG << "[intSet]: " << szName << "={" << values.size() << "}["; + bool bFirst = true; + for (auto it=values.cbegin(); it!=values.cend(); ++it) + DLOG << (bFirst ? "" : ",") << *it; + DLOG << "]" << std::endl; +} + +inline void DumpVar(const char *szName, const std::list& values) +{ + DLOG << "[boolList]: " << szName << "={" << values.size() << "}["; + bool bFirst = true; + for (auto it=values.cbegin(); it!=values.cend(); ++it) + DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N"); + DLOG << "]" << std::endl; +} + + +#endif // MBDebug_HeaderFile + diff --git a/src/PVViewer/MBDebug.h b/src/PVViewer/MBDebug.h new file mode 100644 index 000000000..bde273ff5 --- /dev/null +++ b/src/PVViewer/MBDebug.h @@ -0,0 +1,244 @@ +#ifndef MBDebug_HeaderFile +#define MBDebug_HeaderFile + +//--------------------------------------------------------------- +// Usage of the logging facilities: +// +// (1) At the beginning of each class file to be debugged, there +// should be a static string variable defined with the name +// of the class. Then, include the "MBDebug.h" header file. +// +// //--------------------------------------------------------- +// #define USE_DEBUG +// //#define MB_IGNORE_QT +// #define MBCLASSNAME "ClassName" +// #include "MBDebug.h" +// //--------------------------------------------------------- +// +// (2) At the beginning of each class method, call the DBG_FUN +// macro. +// +// int ClassName::MyMethod(int x) +// { +// DBG_FUN(); +// ... +// } +// +// NOTE: For static methods, call the DBG_FUNC() macro!! +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// This debugging/logging class is a "header-only" solution and +// does NOT require any additional implementation (.cpp) file! +//--------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef MB_IGNORE_QT +# include +#endif + +//--------------------------------------------------------------- +// Set the debug flags dependent on the preprocessor definitions +//--------------------------------------------------------------- +#ifdef USE_DEBUG +# define MBS_DEBUG_FLAG MBDebug::DF_DEBUG +#else +# define MBS_DEBUG_FLAG 0 +#endif /*DEBUG*/ + +#define MBS_DBG_FLAGS (MBS_DEBUG_FLAG) + + +//--------------------------------------------------------------- +// Define the global debug macros +//--------------------------------------------------------------- +#define DLOG MBDebug::LogPrint() +#define RETURN(var) { RET(var); return (var); } + +#ifdef USE_DEBUG + +# define DBG_FUN() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS, (void*)this) +# define DBG_FUNC() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS) +# define DBG_FUNB(blk) MBDebug _dbg(MBCLASSNAME, blk, MBS_DBG_FLAGS) +# define MSGEL(txt) MBDebug::LogPrint() << txt << std::endl +# define PRINT(txt) MBDebug::LogPrint() << txt +# define SHOW2(var,typ) DumpVar(#var,(typ)(var)) +# define SHOW(var) DumpVar(#var,var) +# define ARG(var) do { PRINT("in:"); DumpVar(#var,var); } while (0) +# define ARG2(var,typ) do { PRINT("in:"); DumpVar(#var,(typ)(var)); } while (0) +# define RET(var) do { PRINT("out:"); DumpVar(#var,var); } while (0) +# define MSG(txt) MBDebug::LogPrint() << txt + +#else /*!USE_DEBUG*/ + +# define DBG_FUN() +# define DBG_FUNC() +# define DBG_FUNB(blk) +# define MSGEL(txt) +# define PRINT(txt) +# define SHOW2(var,typ) +# define SHOW(var) +# define ARG(var) +# define ARG2(var,typ) +# define RET(var) +# define MSG(txt) + +#endif /*USE_DEBUG*/ + + +//--------------------------------------------------------------- +// Declare the debugging and profiling class +//--------------------------------------------------------------- +class MBDebug +{ +public: + enum { + DF_NONE = 0x00, // no debug + DF_DEBUG = 0x01 // debug a function + }; + + MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL) + :mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag) + { + if (mFlags & (DF_DEBUG)) + { + std::cout << "{ENTER: " << mClassName + "::" + mFuncName; + if (mThis) std::cout << "(this=" << mThis << ")"; + std::cout << std::endl; + } + } + virtual ~MBDebug() + { + if (mFlags & (DF_DEBUG)) + std::cout << "}LEAVE: " << mClassName << "::" << mFuncName << std::endl; + } + + // Log file output management + static std::ostream& LogPrint() { return std::cout; } + +private: + std::string mClassName; // Name of class to be debugged + std::string mFuncName; // Name of function to be debugged + void* mThis; // The "this" pointer to the class being debugged + unsigned char mFlags; // Debug mode flags +}; + + + +#define YesNo(b) (b ? "Yes" : "No") + + + +inline std::string w2s(std::wstring ws) +{ + using convert_typeX = std::codecvt_utf8; + std::wstring_convert converterX; + return(converterX.to_bytes(ws)); +} + +// Primitive types +inline void DumpVar(const char *szName, char value) +{ + DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl; +} + +inline void DumpVar(const char *szName, bool value) +{ + DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl; +} + +inline void DumpVar(const char *szName, short value) +{ + DLOG << "[shrt]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, int value) +{ + DLOG << "[int]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, long value) +{ + DLOG << "[long]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, double value) +{ + DLOG << "[dbl]: " << szName << "=" << value << std::endl; +} + +inline void DumpVar(const char *szName, unsigned char value) +{ + DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, unsigned short value) +{ + DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, unsigned int value) +{ + DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, unsigned long value) +{ + DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl; +} + +inline void DumpVar(const char *szName, const char* value) +{ + DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl; +} + +inline void DumpVar(const char *szName, const std::string &value) +{ + DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl; +} + +inline void DumpVar(const char *szName, const std::wstring &value) +{ + DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl; +} + +#ifndef MB_IGNORE_QT +inline void DumpVar(const char *szName, const QString &value) +{ + DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl; +} +#endif + +inline void DumpVar(const char *szName, const void* value) +{ + DLOG << "[ptr]: " << szName << "=" << value << std::endl; +} + + +// Collection of primitive types +inline void DumpVar(const char *szName, const std::set &values) +{ + DLOG << "[intSet]: " << szName << "={" << values.size() << "}["; + bool bFirst = true; + for (auto it=values.cbegin(); it!=values.cend(); ++it) + DLOG << (bFirst ? "" : ",") << *it; + DLOG << "]" << std::endl; +} + +inline void DumpVar(const char *szName, const std::list& values) +{ + DLOG << "[boolList]: " << szName << "={" << values.size() << "}["; + bool bFirst = true; + for (auto it=values.cbegin(); it!=values.cend(); ++it) + DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N"); + DLOG << "]" << std::endl; +} + + +#endif // MBDebug_HeaderFile + diff --git a/src/PVViewer/PVViewer_Behaviors.cxx b/src/PVViewer/PVViewer_Behaviors.cxx index 66f22e2c6..639d12289 100644 --- a/src/PVViewer/PVViewer_Behaviors.cxx +++ b/src/PVViewer/PVViewer_Behaviors.cxx @@ -49,11 +49,19 @@ #include +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_Behaviors" +#include "MBDebug.h" +//--------------------------------------------------------- + int PVViewer_Behaviors::BehaviorLoadingLevel = 0; PVViewer_Behaviors::PVViewer_Behaviors(QMainWindow * parent) : QObject(parent) { + DBG_FUN(); } /**! Instanciate minimal ParaView behaviors needed when using an instance of PVViewer. @@ -62,6 +70,8 @@ PVViewer_Behaviors::PVViewer_Behaviors(QMainWindow * parent) */ void PVViewer_Behaviors::instanciateMinimalBehaviors(QMainWindow * /*desk*/) { + DBG_FUN(); + SHOW(BehaviorLoadingLevel); if (BehaviorLoadingLevel < 1) { // Register ParaView interfaces. @@ -90,6 +100,8 @@ void PVViewer_Behaviors::instanciateMinimalBehaviors(QMainWindow * /*desk*/) */ void PVViewer_Behaviors::instanciateAllBehaviors(QMainWindow * desk) { + DBG_FUN(); + SHOW(BehaviorLoadingLevel); // "new pqParaViewBehaviors(anApp->desktop(), this);" // -> (which loads all standard ParaView behaviors at once) has to be replaced in order to // exclude using of pqQtMessageHandlerBehaviour diff --git a/src/PVViewer/PVViewer_Core.cxx b/src/PVViewer/PVViewer_Core.cxx index 6b4205eef..352a67caf 100644 --- a/src/PVViewer/PVViewer_Core.cxx +++ b/src/PVViewer/PVViewer_Core.cxx @@ -44,6 +44,13 @@ #include #include +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_Core" +#include "MBDebug.h" +//--------------------------------------------------------- + //---------- Static init ----------------- pqPVApplicationCore* PVViewer_Core::MyCoreApp = 0; @@ -60,8 +67,9 @@ pqPVApplicationCore * PVViewer_Core::GetPVApplication() \param fullSetup whether to instanciate all behaviors or just the minimal ones. \return \c true if ParaView has been initialized successfully, otherwise false */ -bool PVViewer_Core::ParaviewInitApp(QMainWindow * /*aDesktop*/) +bool PVViewer_Core::ParaviewInitApp(QMainWindow * aDesktop) { + DBG_FUNC(); if ( ! MyCoreApp) { // Obtain command-line arguments int argc = 0; @@ -116,15 +124,17 @@ bool PVViewer_Core::ParaviewInitApp(QMainWindow * /*aDesktop*/) free(argv[i]); delete[] argv; } - // Initialization of ParaView GUI widgets will be done when these widgets are - // really needed. - // PVViewer_GUIElements* inst = PVViewer_GUIElements::GetInstance(aDesktop); - // inst->getPropertiesPanel(); - return true; + // Initialization of ParaView GUI widgets will be done when these widgets are + // really needed. + // PVViewer_GUIElements* inst = PVViewer_GUIElements::GetInstance(aDesktop); + // inst->getPropertiesPanel(); + return true; } void PVViewer_Core::ParaviewInitBehaviors(bool fullSetup, QMainWindow* aDesktop) { + DBG_FUNC(); + ARG(fullSetup); if (!ParaviewBehaviors) ParaviewBehaviors = new PVViewer_Behaviors(aDesktop); @@ -136,6 +146,9 @@ void PVViewer_Core::ParaviewInitBehaviors(bool fullSetup, QMainWindow* aDesktop) void PVViewer_Core::ParaviewLoadConfigurations(const QString & configPath, bool force) { + DBG_FUNC(); + ARG(configPath); + ARG(force); if (!ConfigLoaded || force) { if (!configPath.isNull()) { @@ -148,6 +161,7 @@ void PVViewer_Core::ParaviewLoadConfigurations(const QString & configPath, bool void PVViewer_Core::ParaviewCleanup() { + DBG_FUNC(); // Disconnect from server pqServer* server = pqActiveObjects::instance().activeServer(); if (server && server->isRemote()) diff --git a/src/PVViewer/PVViewer_GUIElements.cxx b/src/PVViewer/PVViewer_GUIElements.cxx index 057354cba..5be7bf5e6 100644 --- a/src/PVViewer/PVViewer_GUIElements.cxx +++ b/src/PVViewer/PVViewer_GUIElements.cxx @@ -59,6 +59,13 @@ #include #include +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_GUIElements" +#include "MBDebug.h" +//--------------------------------------------------------- + PVViewer_GUIElements * PVViewer_GUIElements::theInstance = 0; PVViewer_GUIElements::PVViewer_GUIElements(QMainWindow* desktop) : @@ -92,6 +99,7 @@ PVViewer_GUIElements::PVViewer_GUIElements(QMainWindow* desktop) : commonAction(0), dataAction(0) { + DBG_FUN(); } PVViewer_GUIElements * PVViewer_GUIElements::GetInstance(QMainWindow* desk) @@ -108,6 +116,7 @@ PVViewer_GUIElements * PVViewer_GUIElements::GetInstance(QMainWindow* desk) void PVViewer_GUIElements::buildPVWidgets() { if (!myPVWidgetsFlag) { + DBG_FUN(); //Pipeline Browser if ( !pipelineBrowserWidget ) { @@ -258,6 +267,8 @@ void PVViewer_GUIElements::buildPVWidgets() void PVViewer_GUIElements::setToolBarVisible(bool show) { + DBG_FUN(); + ARG(show); QCoreApplication::processEvents(); if (!myPVWidgetsFlag) return; @@ -293,6 +304,8 @@ void PVViewer_GUIElements::setToolBarVisible(bool show) void PVViewer_GUIElements::setVCRTimeToolBarVisible(bool show) { + DBG_FUN(); + ARG(show); vcrAction->setChecked(!show); vcrAction->setVisible(show); vcrAction->trigger(); @@ -313,6 +326,8 @@ QList PVViewer_GUIElements::getToolbars() void PVViewer_GUIElements::setToolBarEnabled(bool enabled) { + DBG_FUN(); + ARG(enabled); if (!myPVWidgetsFlag) return; @@ -374,6 +389,7 @@ QMenu* PVViewer_GUIElements::getCatalystMenu() { } void PVViewer_GUIElements::publishExistingSources() { + DBG_FUN(); vtkSMSessionProxyManager* pxm = pqActiveObjects::instance().proxyManager(); pqServerManagerModel* smmodel = pqApplicationCore::instance()->getServerManagerModel(); if( !pxm || !smmodel ) @@ -381,7 +397,9 @@ void PVViewer_GUIElements::publishExistingSources() { vtkSMProxyIterator* iter = vtkSMProxyIterator::New(); iter->SetModeToOneGroup(); iter->SetSessionProxyManager( pxm ); + MSGEL("....List of all sources:...."); for ( iter->Begin( "sources" ); !iter->IsAtEnd(); iter->Next() ) { + SHOW(iter->GetKey()); if ( pqProxy* item = smmodel->findItem( iter->GetProxy() ) ) { pqPipelineSource* source = qobject_cast( item ); QMetaObject::invokeMethod( smmodel, diff --git a/src/PVViewer/PVViewer_InitSingleton.cxx b/src/PVViewer/PVViewer_InitSingleton.cxx index ea138dbaa..dafc8a523 100644 --- a/src/PVViewer/PVViewer_InitSingleton.cxx +++ b/src/PVViewer/PVViewer_InitSingleton.cxx @@ -22,10 +22,18 @@ #include "PVViewer_Core.h" #include "PVViewer_ViewManager.h" +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_InitSingleton" +#include "MBDebug.h" +//--------------------------------------------------------- + bool PVViewer_InitSingleton::IS_INIT=false; void PVViewer_InitSingleton::Init(QMainWindow* desktop) { + DBG_FUNC(); if(IS_INIT) return ; PVViewer_Core::ParaviewInitApp(desktop); diff --git a/src/PVViewer/PVViewer_OutputWindow.cxx b/src/PVViewer/PVViewer_OutputWindow.cxx index 8d40dc389..bd6b5b567 100644 --- a/src/PVViewer/PVViewer_OutputWindow.cxx +++ b/src/PVViewer/PVViewer_OutputWindow.cxx @@ -21,14 +21,23 @@ #include +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_OutputWindow" +#include "MBDebug.h" +//--------------------------------------------------------- + vtkStandardNewMacro(PVViewer_OutputWindow) PVViewer_OutputWindow::PVViewer_OutputWindow() { + DBG_FUN(); } PVViewer_OutputWindow::~PVViewer_OutputWindow() { + DBG_FUN(); } unsigned int PVViewer_OutputWindow::getTextCount() const @@ -58,6 +67,8 @@ unsigned int PVViewer_OutputWindow::getDebugCount() const void PVViewer_OutputWindow::DisplayText(const char* text) { + DBG_FUN(); + ARG(text); MessageTypes type = GetCurrentMessageType(); myCounter[type] = count(type) + 1; switch (type) diff --git a/src/PVViewer/PVViewer_ViewManager.cxx b/src/PVViewer/PVViewer_ViewManager.cxx index 9a223eb33..8b546d51e 100644 --- a/src/PVViewer/PVViewer_ViewManager.cxx +++ b/src/PVViewer/PVViewer_ViewManager.cxx @@ -38,12 +38,20 @@ #include #include +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_ViewManager" +#include "MBDebug.h" +//--------------------------------------------------------- + /*! Constructor */ PVViewer_ViewManager::PVViewer_ViewManager(SUIT_Study* study, SUIT_Desktop* desktop) : SUIT_ViewManager( study, desktop, new PVViewer_Viewer() ) { + DBG_FUN(); MESSAGE("PVViewer - view manager created ..."); setTitle( tr( "PARAVIEW_VIEW_TITLE" ) ); @@ -61,12 +69,14 @@ PVServer_ServiceWrapper * PVViewer_ViewManager::GetService() QString PVViewer_ViewManager::GetPVConfigPath() { + DBG_FUNC(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); return resMgr->stringValue("resources", "PVViewer", QString()); } bool PVViewer_ViewManager::ConnectToExternalPVServer(QMainWindow* desktop) { + DBG_FUNC(); SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); bool noConnect = aResourceMgr->booleanValue( "PARAVIS", "no_ext_pv_server", false ); if (noConnect) @@ -132,6 +142,7 @@ bool PVViewer_ViewManager::ConnectToExternalPVServer(QMainWindow* desktop) */ void PVViewer_ViewManager::onWindowActivated(SUIT_ViewWindow* view) { + DBG_FUN(); if (view) { PVViewer_ViewWindow* pvWindow = dynamic_cast(view); diff --git a/src/PVViewer/PVViewer_ViewModel.cxx b/src/PVViewer/PVViewer_ViewModel.cxx index 55cc5e447..786d4738e 100644 --- a/src/PVViewer/PVViewer_ViewModel.cxx +++ b/src/PVViewer/PVViewer_ViewModel.cxx @@ -24,10 +24,18 @@ #include #include "SUIT_Desktop.h" +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_Viewer" +#include "MBDebug.h" +//--------------------------------------------------------- + //---------------------------------------- PVViewer_Viewer::PVViewer_Viewer() :SUIT_ViewModel() { + DBG_FUN(); MESSAGE("PVViewer_Viewer: creating view model ..."); } @@ -37,6 +45,7 @@ PVViewer_Viewer::PVViewer_Viewer() */ SUIT_ViewWindow* PVViewer_Viewer::createView(SUIT_Desktop* desktop) { + DBG_FUN(); return new PVViewer_ViewWindow(desktop, this); } diff --git a/src/PVViewer/PVViewer_ViewWindow.cxx b/src/PVViewer/PVViewer_ViewWindow.cxx index 0f860d8e9..6e2516921 100644 --- a/src/PVViewer/PVViewer_ViewWindow.cxx +++ b/src/PVViewer/PVViewer_ViewWindow.cxx @@ -33,6 +33,13 @@ #include #include +//--------------------------------------------------------- +#define USE_DEBUG +//#define MB_IGNORE_QT +#define MBCLASSNAME "PVViewer_ViewWindow" +#include "MBDebug.h" +//--------------------------------------------------------- + /*! \class PVViewer_ViewWindow @@ -47,6 +54,7 @@ PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Viewer* theModel ) : SUIT_ViewWindow( theDesktop ), myPVMgr( 0 ) { + DBG_FUN(); myDesktop = theDesktop; myModel = theModel; setViewManager(myModel->getViewManager()); @@ -74,6 +82,7 @@ PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Vie */ PVViewer_ViewWindow::~PVViewer_ViewWindow() { + DBG_FUN(); if ( myPVMgr ) { // Hide toolbars PVViewer_GUIElements * pvge = PVViewer_GUIElements::GetInstance(myDesktop); @@ -87,6 +96,7 @@ PVViewer_ViewWindow::~PVViewer_ViewWindow() void PVViewer_ViewWindow::removePVMgr() { + DBG_FUNC(); pqTabbedMultiViewWidget* aPVMgr = qobject_cast(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET")); delete aPVMgr; } @@ -106,6 +116,8 @@ QString PVViewer_ViewWindow::getVisualParameters() */ void PVViewer_ViewWindow::setVisualParameters( const QString& parameters ) { + DBG_FUN(); + ARG(parameters); SUIT_ViewWindow::setVisualParameters( parameters ); } diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 07c933c68..048b98087 100644 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -38,6 +38,12 @@ #include #include +//--------------------------------------------------------- +#define USE_DEBUG +#define MBCLASSNAME "SUIT_Application" +#include "MBDebug.h" +//--------------------------------------------------------- + /*! \class StatusLabel @@ -61,6 +67,7 @@ SUIT_Application::SUIT_Application() myStatusLabel( 0 ), myPostRoutines( QList() ) { + DBG_FUN(); if ( SUIT_Session::session() ) SUIT_Session::session()->insertApplication( this ); } @@ -70,6 +77,7 @@ SUIT_Application::SUIT_Application() */ SUIT_Application::~SUIT_Application() { + DBG_FUN(); SUIT_Study* s = myStudy; setActiveStudy( 0 ); delete s; @@ -103,6 +111,8 @@ bool SUIT_Application::isPossibleToClose( bool& ) */ void SUIT_Application::closeApplication() { + DBG_FUN(); + MSGEL("-----> emit applicationClosed <-----"); emit applicationClosed( this ); } @@ -127,6 +137,7 @@ QString SUIT_Application::applicationVersion() const */ void SUIT_Application::start() { + DBG_FUN(); if ( desktop() ) desktop()->show(); @@ -140,6 +151,9 @@ void SUIT_Application::start() */ bool SUIT_Application::useFile( const QString& theFileName ) { + DBG_FUN(); + ARG(theFileName); + createEmptyStudy(); SUIT_Study* study = activeStudy(); @@ -159,6 +173,7 @@ bool SUIT_Application::useFile( const QString& theFileName ) */ void SUIT_Application::createEmptyStudy() { + DBG_FUN(); if ( !activeStudy() ) setActiveStudy( createNewStudy() ); } @@ -201,6 +216,8 @@ SUIT_ShortcutMgr* SUIT_Application::shortcutMgr() const */ void SUIT_Application::putInfo( const QString& msg, const int msec ) { + DBG_FUN(); + ARG(msg); if ( !desktop() ) return; @@ -226,6 +243,7 @@ void SUIT_Application::putInfo( const QString& msg, const int msec ) */ void SUIT_Application::onInfoClear() { + DBG_FUN(); if ( !myStatusLabel ) return; @@ -249,6 +267,7 @@ void SUIT_Application::updateCommandsStatus() */ SUIT_Application* SUIT_Application::startApplication( int argc, char** argv ) const { + DBG_FUN(); return startApplication( objectName(), argc, argv ); } @@ -260,6 +279,8 @@ SUIT_Application* SUIT_Application::startApplication( int argc, char** argv ) co */ SUIT_Application* SUIT_Application::startApplication( const QString& name, int argc, char** argv ) const { + DBG_FUN(); + ARG(name); SUIT_Session* session = SUIT_Session::session(); if ( !session ) return 0; @@ -273,6 +294,7 @@ SUIT_Application* SUIT_Application::startApplication( const QString& name, int a */ void SUIT_Application::setDesktop( SUIT_Desktop* desk ) { + DBG_FUN(); if ( myDesktop == desk ) return; @@ -295,6 +317,7 @@ void SUIT_Application::setDesktop( SUIT_Desktop* desk ) */ SUIT_Study* SUIT_Application::createNewStudy() { + DBG_FUN(); return new SUIT_Study( this ); } @@ -304,6 +327,7 @@ SUIT_Study* SUIT_Application::createNewStudy() */ void SUIT_Application::setActiveStudy( SUIT_Study* study ) { + DBG_FUN(); if ( myStudy == study ) return; @@ -667,6 +691,7 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons QObject* parent, const bool toggle, QObject* reciever, const char* member, const QString& shortcutAction ) { + MSGEL("...SUIT_Application::createAction(menu=\"" << menu.toStdString() << "\", text=\"" << text.toStdString() << "\""); QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction ); a->setStatusTip( tip ); @@ -685,6 +710,7 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons */ int SUIT_Application::registerAction( const int id, QAction* a ) { + MSGEL("...registerAction(" << id << ")"); int ident = actionId( a ); if ( ident != -1 ) return ident; @@ -724,6 +750,8 @@ QAction* SUIT_Application::separator() void SUIT_Application::onDesktopActivated() { + DBG_FUN(); + MSGEL("-----> emit activated <-----"); emit activated( this ); } @@ -745,6 +773,7 @@ void SUIT_Application::onHelpContextModule( const QString& /*theComponentName*/, void SUIT_Application::addPostRoutine( PostRoutine theRoutine ) { + DBG_FUN(); if ( !myPostRoutines.contains( theRoutine ) ) myPostRoutines << theRoutine; } diff --git a/src/SUIT/SUIT_DataBrowser.cxx b/src/SUIT/SUIT_DataBrowser.cxx index d65af2263..a9ee7a47c 100644 --- a/src/SUIT/SUIT_DataBrowser.cxx +++ b/src/SUIT/SUIT_DataBrowser.cxx @@ -174,6 +174,7 @@ void SUIT_DataBrowser::updateTree( SUIT_DataObject* obj, const bool /*autoOpen*/ if (myAutoSizeColumns) adjustColumnsWidth(); } + MSGEL("-----> emit updated <-----"); emit updated(); } diff --git a/src/SUIT/SUIT_SelectionMgr.cxx b/src/SUIT/SUIT_SelectionMgr.cxx index 567ca5488..008bdab38 100644 --- a/src/SUIT/SUIT_SelectionMgr.cxx +++ b/src/SUIT/SUIT_SelectionMgr.cxx @@ -25,6 +25,12 @@ #include "SUIT_Selector.h" #include "SUIT_SelectionFilter.h" +//--------------------------------------------------------- +#define USE_DEBUG +#define MBCLASSNAME "SUIT_SelectionMgr" +#include "MBDebug.h" +//--------------------------------------------------------- + /*!\class SUIT_SelectionMgr * Provide selection manager. Manipulate by selection filters, modes, data owners. */ @@ -36,11 +42,13 @@ myIterations( Feedback ? 1 : 0 ), myAutoDelFilter( false ), myIsSelChangeEnabled( true ) { + DBG_FUN(); } /*!destructor. mySelectors auto delete.*/ SUIT_SelectionMgr::~SUIT_SelectionMgr() { + DBG_FUN(); while( !mySelectors.empty() ) { SelectorList::iterator it = mySelectors.begin(); delete *it; @@ -50,6 +58,7 @@ SUIT_SelectionMgr::~SUIT_SelectionMgr() /*!Add selector \a sel to selectors list,if it's not exists in list.*/ void SUIT_SelectionMgr::installSelector( SUIT_Selector* sel ) { + DBG_FUN(); if ( sel && !mySelectors.contains( sel ) ) mySelectors.append( sel ); } @@ -57,12 +66,14 @@ void SUIT_SelectionMgr::installSelector( SUIT_Selector* sel ) /*!Remove selector \a sel from list.*/ void SUIT_SelectionMgr::removeSelector( SUIT_Selector* sel ) { + DBG_FUN(); mySelectors.removeAll( sel ); } /*!Gets selectors list to \a lst.*/ void SUIT_SelectionMgr::selectors( QList& lst ) const { + DBG_FUN(); lst.clear(); for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it ) lst.append( *it ); @@ -71,6 +82,8 @@ void SUIT_SelectionMgr::selectors( QList& lst ) const /*!Gets selectors list to \a lst with type \a typ.*/ void SUIT_SelectionMgr::selectors( const QString& typ, QList& lst ) const { + DBG_FUN(); + ARG(typ); lst.clear(); for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it ) { @@ -83,6 +96,9 @@ void SUIT_SelectionMgr::selectors( const QString& typ, QList& ls */ void SUIT_SelectionMgr::setEnabled( const bool on, const QString& typ ) { + DBG_FUN(); + ARG(on); + ARG(typ); for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it ) { if ( typ.isEmpty() || (*it)->type() == typ ) @@ -94,6 +110,8 @@ void SUIT_SelectionMgr::setEnabled( const bool on, const QString& typ ) */ void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& type, const bool onlyOne ) const { + DBG_FUN(); + ARG(type); lst.clear(); for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it ) @@ -129,6 +147,7 @@ void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& typ */ void SUIT_SelectionMgr::setSelected( const SUIT_DataOwnerPtrList& lst, const bool append ) { + DBG_FUN(); SUIT_DataOwnerPtrList owners; filterOwners( lst, owners ); @@ -149,6 +168,7 @@ void SUIT_SelectionMgr::setSelected( const SUIT_DataOwnerPtrList& lst, const boo */ void SUIT_SelectionMgr::clearSelected() { + DBG_FUN(); setSelected( SUIT_DataOwnerPtrList() ); } @@ -156,6 +176,7 @@ void SUIT_SelectionMgr::clearSelected() */ void SUIT_SelectionMgr::selectionChanged( SUIT_Selector* sel ) { + DBG_FUN(); if ( !sel || !myIsSelChangeEnabled || !sel->isEnabled() ) return; @@ -208,6 +229,8 @@ void SUIT_SelectionMgr::selectionModes( QList& vals ) const */ void SUIT_SelectionMgr::setSelectionModes( const int mode ) { + DBG_FUN(); + ARG(mode); QList lst; lst.append( mode ); setSelectionModes( lst ); @@ -217,6 +240,7 @@ void SUIT_SelectionMgr::setSelectionModes( const int mode ) */ void SUIT_SelectionMgr::setSelectionModes( const QList& lst ) { + DBG_FUN(); mySelModes = lst; } @@ -224,6 +248,8 @@ void SUIT_SelectionMgr::setSelectionModes( const QList& lst ) */ void SUIT_SelectionMgr::appendSelectionModes( const int mode ) { + DBG_FUN(); + ARG(mode); QList lst; lst.append( mode ); appendSelectionModes( lst ); @@ -233,6 +259,7 @@ void SUIT_SelectionMgr::appendSelectionModes( const int mode ) */ void SUIT_SelectionMgr::appendSelectionModes( const QList& lst ) { + DBG_FUN(); QMap map; for ( QList::const_iterator it = mySelModes.begin(); it != mySelModes.end(); ++it ) map.insert( *it, 0 ); @@ -248,6 +275,8 @@ void SUIT_SelectionMgr::appendSelectionModes( const QList& lst ) */ void SUIT_SelectionMgr::removeSelectionModes( const int mode ) { + DBG_FUN(); + ARG(mode); QList lst; lst.append( mode ); removeSelectionModes( lst ); @@ -257,6 +286,7 @@ void SUIT_SelectionMgr::removeSelectionModes( const int mode ) */ void SUIT_SelectionMgr::removeSelectionModes( const QList& lst ) { + DBG_FUN(); QMap map; for ( QList::const_iterator it = mySelModes.begin(); it != mySelModes.end(); ++it ) map.insert( *it, 0 ); @@ -304,6 +334,7 @@ bool SUIT_SelectionMgr::hasFilter( SUIT_SelectionFilter* f ) const */ void SUIT_SelectionMgr::installFilter( SUIT_SelectionFilter* f, const bool updateSelection ) { + DBG_FUN(); if ( !hasFilter( f ) ) { SUIT_DataOwnerPtrList selOwners; @@ -321,6 +352,7 @@ void SUIT_SelectionMgr::installFilter( SUIT_SelectionFilter* f, const bool updat */ void SUIT_SelectionMgr::removeFilter( SUIT_SelectionFilter* f ) { + DBG_FUN(); if ( !myFilters.contains( f ) ) return; @@ -334,6 +366,7 @@ void SUIT_SelectionMgr::removeFilter( SUIT_SelectionFilter* f ) */ void SUIT_SelectionMgr::clearFilters() { + DBG_FUN(); if ( autoDeleteFilter() ) { for ( SelFilterList::const_iterator it = myFilters.begin(); it != myFilters.end(); ++it ) @@ -354,6 +387,8 @@ bool SUIT_SelectionMgr::autoDeleteFilter() const */ void SUIT_SelectionMgr::setAutoDeleteFilter( const bool on ) { + DBG_FUN(); + ARG(on); myAutoDelFilter = on; } diff --git a/src/SUIT/SUIT_Selector.cxx b/src/SUIT/SUIT_Selector.cxx index a3e49cc58..29376dc2c 100644 --- a/src/SUIT/SUIT_Selector.cxx +++ b/src/SUIT/SUIT_Selector.cxx @@ -26,6 +26,12 @@ #include +//--------------------------------------------------------- +#define USE_DEBUG +#define MBCLASSNAME "SUIT_Selector" +#include "MBDebug.h" +//--------------------------------------------------------- + /*!\class SUIT_Selector::Destroyer Class provide the watching for qobject parent class of the selector. */ @@ -43,14 +49,18 @@ private: SUIT_Selector* mySelector; }; +#undef MBCLASSNAME +#define MBCLASSNAME "SUIT_Selector::Destroyer" SUIT_Selector::Destroyer::Destroyer( SUIT_Selector* s, QObject* p ) : QObject( p ), mySelector( s ) { + DBG_FUN(); } SUIT_Selector::Destroyer::~Destroyer() { + DBG_FUN(); SUIT_Selector* s = mySelector; mySelector = 0; if ( s ) @@ -64,9 +74,12 @@ SUIT_Selector* SUIT_Selector::Destroyer::selector() const void SUIT_Selector::Destroyer::setSelector( SUIT_Selector* s ) { + DBG_FUN(); mySelector = s; } +#undef MBCLASSNAME +#define MBCLASSNAME "SUIT_Selector" /*!\class SUIT_Selector * Class provide selector for data owners. */ @@ -81,6 +94,7 @@ SUIT_Selector::SUIT_Selector( SUIT_SelectionMgr* selMgr, QObject* parent ) myAutoBlock( true ), myDestroyer( 0 ) { + DBG_FUN(); if ( selMgr ) selMgr->installSelector( this ); @@ -93,6 +107,7 @@ SUIT_Selector::SUIT_Selector( SUIT_SelectionMgr* selMgr, QObject* parent ) */ SUIT_Selector::~SUIT_Selector() { + DBG_FUN(); if ( selectionMgr() ) selectionMgr()->removeSelector( this ); @@ -125,6 +140,8 @@ bool SUIT_Selector::isEnabled() const */ void SUIT_Selector::setEnabled( const bool on ) { + DBG_FUN(); + ARG(on); myEnabled = on; } @@ -141,6 +158,8 @@ bool SUIT_Selector::autoBlock() const */ void SUIT_Selector::setAutoBlock( const bool on ) { + DBG_FUN(); + ARG(on); myAutoBlock = on; } @@ -158,6 +177,7 @@ void SUIT_Selector::selected( SUIT_DataOwnerPtrList& lst ) const */ void SUIT_Selector::setSelected( const SUIT_DataOwnerPtrList& lst ) { + DBG_FUN(); if ( !isEnabled() ) return; @@ -174,6 +194,7 @@ void SUIT_Selector::setSelected( const SUIT_DataOwnerPtrList& lst ) */ void SUIT_Selector::selectionChanged() { + DBG_FUN(); if ( selectionMgr() && isEnabled() && ( !autoBlock() || !myBlock ) ) selectionMgr()->selectionChanged( this ); } diff --git a/src/SUIT/SUIT_Session.cxx b/src/SUIT/SUIT_Session.cxx index 3c031a976..3a3b85d96 100644 --- a/src/SUIT/SUIT_Session.cxx +++ b/src/SUIT/SUIT_Session.cxx @@ -36,6 +36,13 @@ #include #endif +//--------------------------------------------------------- +#define USE_DEBUG +#define MBCLASSNAME "SUIT_Session" +#include "MBDebug.h" +#include "MBSUIT.h" +//--------------------------------------------------------- + SUIT_Session* SUIT_Session::mySession = 0; /*! Constructor.*/ @@ -48,6 +55,7 @@ SUIT_Session::SUIT_Session() myExitStatus( NORMAL ), myExitFlags ( 0 ) { + DBG_FUN(); SUIT_ASSERT( !mySession ) mySession = this; @@ -56,6 +64,7 @@ SUIT_Session::SUIT_Session() /*!destructor. Clear applications list and set mySession to zero.*/ SUIT_Session::~SUIT_Session() { + DBG_FUN(); for ( AppList::iterator it = myAppList.begin(); it != myAppList.end(); ++it ) delete *it; @@ -81,6 +90,8 @@ SUIT_Session* SUIT_Session::session() SUIT_Application* SUIT_Session::startApplication( const QString& name, int /*args*/, char** /*argv*/ ) { + DBG_FUN(); + ARG(name); AppLib libHandle = 0; QString appName = applicationName( name ); @@ -166,6 +177,7 @@ QList SUIT_Session::applications() const void SUIT_Session::insertApplication( SUIT_Application* app ) { + DBG_FUN(); if ( !app || myAppList.contains( app ) ) return; @@ -224,6 +236,7 @@ SUIT_ResourceMgr* SUIT_Session::resourceMgr() const */ void SUIT_Session::onApplicationClosed( SUIT_Application* theApp ) { + DBG_FUN(); emit applicationClosed( theApp ); myAppList.removeAll( theApp ); @@ -244,6 +257,8 @@ void SUIT_Session::onApplicationClosed( SUIT_Application* theApp ) */ void SUIT_Session::closeSession( int mode, int flags ) { + DBG_FUN(); + ARG(mode); AppList apps = myAppList; for ( AppList::const_iterator it = apps.begin(); it != apps.end(); ++it ) { @@ -314,6 +329,8 @@ QString SUIT_Session::lastError() const */ SUIT_Session::AppLib SUIT_Session::loadLibrary( const QString& name, QString& libName ) { + DBG_FUN(); + ARG(name); QString libFile = SUIT_Tools::library( name ); libName = libFile; @@ -353,6 +370,8 @@ QString SUIT_Session::applicationName( const QString& str ) const */ SUIT_ResourceMgr* SUIT_Session::createResourceMgr( const QString& appName ) const { + DBG_FUN(); + ARG(appName); return new SUIT_ResourceMgr( applicationName( appName ) ); } @@ -361,5 +380,6 @@ SUIT_ResourceMgr* SUIT_Session::createResourceMgr( const QString& appName ) cons */ void SUIT_Session::onApplicationActivated( SUIT_Application* app ) { + DBG_FUN(); myActiveApp = app; } diff --git a/src/SUIT/SUIT_ViewModel.cxx b/src/SUIT/SUIT_ViewModel.cxx index 715e45d67..928ade89b 100644 --- a/src/SUIT/SUIT_ViewModel.cxx +++ b/src/SUIT/SUIT_ViewModel.cxx @@ -25,6 +25,12 @@ #include "SUIT_ViewModel.h" #include "SUIT_ViewWindow.h" +//--------------------------------------------------------- +#define USE_DEBUG +#define MBCLASSNAME "SUIT_ViewModel" +#include "MBDebug.h" +//--------------------------------------------------------- + SUIT_ViewModel::InteractionStyle2StatesMap SUIT_ViewModel::myStateMap; SUIT_ViewModel::InteractionStyle2ButtonsMap SUIT_ViewModel::myButtonMap; @@ -33,6 +39,7 @@ static bool isInitialized = false; /*!Constructor.*/ SUIT_ViewModel::SUIT_ViewModel() { + DBG_FUN(); if ( !isInitialized ) { isInitialized = true; @@ -69,6 +76,7 @@ SUIT_ViewModel::SUIT_ViewModel() /*!Destructor..*/ SUIT_ViewModel::~SUIT_ViewModel() { + DBG_FUN(); } /*!Create new instance of view window on desktop \a theDesktop. @@ -76,6 +84,7 @@ SUIT_ViewModel::~SUIT_ViewModel() */ SUIT_ViewWindow* SUIT_ViewModel::createView(SUIT_Desktop* theDesktop) { + DBG_FUN(); return new SUIT_ViewWindow(theDesktop); } @@ -84,6 +93,7 @@ SUIT_ViewWindow* SUIT_ViewModel::createView(SUIT_Desktop* theDesktop) */ void SUIT_ViewModel::setViewManager(SUIT_ViewManager* theViewManager) { + DBG_FUN(); myViewManager = theViewManager; } diff --git a/src/SUIT/SUIT_ViewWindow.cxx b/src/SUIT/SUIT_ViewWindow.cxx index 6f8f2243e..a552f78b4 100644 --- a/src/SUIT/SUIT_ViewWindow.cxx +++ b/src/SUIT/SUIT_ViewWindow.cxx @@ -42,6 +42,12 @@ #include #include +//--------------------------------------------------------- +#define USE_DEBUG +#define MBCLASSNAME "SUIT_ViewWindow" +#include "MBDebug.h" +//--------------------------------------------------------- + /*!\class SUIT_ViewWindow * Class provide view window. */ @@ -53,6 +59,7 @@ const int DUMP_EVENT = QEvent::User + 123; SUIT_ViewWindow::SUIT_ViewWindow( SUIT_Desktop* theDesktop ) : QMainWindow( theDesktop ), myManager( 0 ), myIsDropDown( true ), mySyncAction( 0 ) { + DBG_FUN(); myDesktop = theDesktop; setWindowIcon( myDesktop ? myDesktop->windowIcon() : QApplication::windowIcon() ); @@ -67,6 +74,7 @@ SUIT_ViewWindow::SUIT_ViewWindow( SUIT_Desktop* theDesktop ) /*! Destructor.*/ SUIT_ViewWindow::~SUIT_ViewWindow() { + DBG_FUN(); } /*! @@ -75,6 +83,7 @@ SUIT_ViewWindow::~SUIT_ViewWindow() */ void SUIT_ViewWindow::setViewManager( SUIT_ViewManager* theManager ) { + DBG_FUN(); myManager = theManager; } @@ -91,6 +100,7 @@ SUIT_ViewManager* SUIT_ViewWindow::getViewManager() const */ QImage SUIT_ViewWindow::dumpView() { + DBG_FUN(); return QImage(); } @@ -102,6 +112,9 @@ QImage SUIT_ViewWindow::dumpView() */ bool SUIT_ViewWindow::dumpViewToFormat( const QImage& img, const QString& fileName, const QString& format ) { + DBG_FUN(); + ARG(fileName); + ARG(format); if( img.isNull() ) return false; @@ -133,6 +146,7 @@ bool SUIT_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& */ void SUIT_ViewWindow::setDestructiveClose( const bool on ) { + DBG_FUN(); setAttribute( Qt::WA_DeleteOnClose, on ); } @@ -140,6 +154,7 @@ void SUIT_ViewWindow::setDestructiveClose( const bool on ) */ void SUIT_ViewWindow::closeEvent( QCloseEvent* e ) { + DBG_FUN(); e->ignore(); emit tryClosing( this ); if ( closable() ) emit closing( this ); @@ -149,6 +164,7 @@ void SUIT_ViewWindow::closeEvent( QCloseEvent* e ) */ void SUIT_ViewWindow::contextMenuEvent( QContextMenuEvent* e ) { + DBG_FUN(); e->ignore(); QMainWindow::contextMenuEvent( e ); @@ -164,6 +180,7 @@ void SUIT_ViewWindow::contextMenuEvent( QContextMenuEvent* e ) */ void SUIT_ViewWindow::onDumpView() { + DBG_FUN(); // VSV (TRIPOLI dev): next line commented: causes error messages //QApplication::postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ) ) ); QApplication::postEvent( this, new QEvent( (QEvent::Type)DUMP_EVENT ) ); @@ -258,6 +275,7 @@ QString SUIT_ViewWindow::getVisualParameters() */ void SUIT_ViewWindow::setVisualParameters( const QString& /*parameters*/ ) { + DBG_FUN(); } /*! @@ -358,6 +376,7 @@ SUIT_CameraProperties SUIT_ViewWindow::cameraProperties() */ void SUIT_ViewWindow::synchronize( SUIT_ViewWindow* /*otherWindow*/ ) { + DBG_FUN(); // base implementation does nothing } @@ -371,6 +390,7 @@ void SUIT_ViewWindow::synchronize( SUIT_ViewWindow* /*otherWindow*/ ) */ QAction* SUIT_ViewWindow::synchronizeAction() { + DBG_FUN(); if ( !mySyncAction ) { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); mySyncAction = new QtxAction( tr( "MNU_SYNCHRONIZE_VIEW" ), @@ -399,6 +419,7 @@ void SUIT_ViewWindow::emitViewModified() */ void SUIT_ViewWindow::updateSyncViews() { + DBG_FUN(); SUIT_CameraProperties props = cameraProperties(); if ( !props.isValid() ) return; @@ -456,6 +477,7 @@ void SUIT_ViewWindow::updateSyncViews() */ void SUIT_ViewWindow::onSynchronizeView( bool /*checked*/ ) { + DBG_FUN(); QAction* a = qobject_cast( sender() ); if ( a ) { synchronizeView( this, a->data().toInt() ); @@ -468,6 +490,7 @@ void SUIT_ViewWindow::onSynchronizeView( bool /*checked*/ ) */ void SUIT_ViewWindow::synchronizeView( SUIT_ViewWindow* viewWindow, int id ) { + DBG_FUNC(); SUIT_ViewWindow* sourceView = 0; QList otherViews; @@ -552,6 +575,8 @@ void SUIT_ViewWindow::synchronizeView( SUIT_ViewWindow* viewWindow, int id ) void SUIT_ViewWindow::setVisible( bool on ) { + DBG_FUN(); + ARG(on); // This is a workaround to avoid showing view window as a top-level window // before re-parenting it to workstack (issue #23467). // See SUIT_Desktop::childEvent(). diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index bc715233d..f61cb71b3 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -1656,6 +1656,7 @@ void SalomeApp_Application::onDblClick( SUIT_DataObject* theObj ) if ( !aSelectedIndexes.isEmpty() ) ob->treeView()->scrollTo( aSelectedIndexes.first() ); } + MSGEL("-----> emit objectDoubleClicked <-----"); emit objectDoubleClicked( theObj ); } @@ -2191,6 +2192,7 @@ void SalomeApp_Application::afterCloseDoc() #ifndef DISABLE_PYCONSOLE // emit signal to restore study from Python script if ( myNoteBook ) { + MSGEL("-----> emit dumpedStudyClosed <-----"); emit dumpedStudyClosed( myNoteBook->getDumpedStudyScript(), myNoteBook->getDumpedStudyName(), myNoteBook->isDumpedStudySaved() ); diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 349557c0b..7068de0a1 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -428,6 +428,7 @@ void SalomeApp_Study::onNoteBookVarUpdate( QString theVarName) { DBG_FUN(); ARG(theVarName); + MSGEL("-----> emit notebookVarUpdate(\"" << theVarName.toStdString() << "\") <-----"); emit notebookVarUpdated( theVarName ); } #endif @@ -488,6 +489,7 @@ bool SalomeApp_Study::createDocument( const QString& theStr ) myStudyDS->attach(myObserver->_this(),true); #endif + MSGEL("-----> emit created <-----"); emit created( this ); return aRet; @@ -551,6 +553,7 @@ bool SalomeApp_Study::openDocument( const QString& theFileName ) res = CAM_Study::openDocument( theFileName ); + MSGEL("-----> emit opened <-----"); emit opened( this ); myStudyDS->IsSaved(true); @@ -592,6 +595,7 @@ bool SalomeApp_Study::loadDocument( const QString& theStudyName ) //rnv: to fix the "0051779: TC7.2.0: Save operation works incorrectly for study loaded from data server" // mark study as "not saved" after call openDocument( ... ) method. setIsSaved(false); + MSGEL("-----> emit opened <-----"); emit opened( this ); // myRoot is set to Object Browser here // this will build a SUIT_DataObject-s tree under myRoot member field @@ -658,8 +662,10 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName ) res = res && saveStudyData(theFileName, 0); // 0 means persistence file - if ( res ) + if ( res ) { + MSGEL("-----> emit saved <-----"); emit saved( this ); + } return res; } @@ -701,8 +707,10 @@ bool SalomeApp_Study::saveDocument() bool res = studyDS()->Save( isMultiFile, isAscii ) && CAM_Study::saveDocument(); res = res && saveStudyData(studyName(), 0); // 0 means persistence file - if ( res ) + if ( res ) { + MSGEL("-----> emit saved <-----"); emit saved( this ); + } return res; }