From: vsv Date: Thu, 24 Apr 2014 08:41:22 +0000 (+0400) Subject: Adaptation to SALOME environment (Issue #31) X-Git-Tag: V_0.2~122^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8272f8013305da9dd2b1e4fadb5aa7327f63d8e3;p=modules%2Fshaper.git Adaptation to SALOME environment (Issue #31) --- diff --git a/CMakeCommon/FindSalome.cmake b/CMakeCommon/FindSalome.cmake index bf82cdecc..c2403c270 100644 --- a/CMakeCommon/FindSalome.cmake +++ b/CMakeCommon/FindSalome.cmake @@ -1,12 +1,53 @@ +SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL directory") SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI directory") IF(EXISTS ${GUI_ROOT_DIR}) SET(HAVE_SALOME YES) + FIND_LIBRARY(caf caf ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(CAM CAM ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(CASCatch CASCatch ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(DDS DDS ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(Event Event ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(GLViewer GLViewer ${GUI_ROOT_DIR}/lib/salome) FIND_LIBRARY(LightApp LightApp ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(LogWindow LogWindow ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(ObjBrowser ObjBrowser ${GUI_ROOT_DIR}/lib/salome) FIND_LIBRARY(OCCViewer OCCViewer ${GUI_ROOT_DIR}/lib/salome) - + FIND_LIBRARY(OpenGLUtils OpenGLUtils ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(Plot2d Plot2d ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(PyConsole PyConsole ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(PyInterp PyInterp ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(QDS QDS ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(qtx qtx ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(QxScene QxScene ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomeApp SalomeApp ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomeIDLGUI SalomeIDLGUI ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomeObject SalomeObject ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomePrs SalomePrs ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomePyQtGUILight SalomePyQtGUILight ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomePyQtGUI SalomePyQtGUI ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomePyQt SalomePyQt ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomePy SalomePy ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomeSession SalomeSession ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomeStyle SalomeStyle ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SOCC SOCC ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SPlot2d SPlot2d ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(std std ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SUITApp SUITApp ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(suit suit ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SVTK SVTK ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(ToolsGUI ToolsGUI ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(ViewerTools ViewerTools ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(ViewerData ViewerData ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(VTKViewer VTKViewer ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(vtkEDFOverloads vtkEDFOverloads ${GUI_ROOT_DIR}/lib/paraview) + FIND_LIBRARY(vtkTools vtkTools ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomeGuiHelpers SalomeGuiHelpers ${GUI_ROOT_DIR}/lib/salome) + FIND_LIBRARY(SalomeTreeData SalomeTreeData ${GUI_ROOT_DIR}/lib/salome) + SET(SALOME_GUI_INCLUDE ${GUI_ROOT_DIR}/include/salome) + SET(SALOME_KERNEL_INCLUDE ${KERNEL_ROOT_DIR}/include/salome) ADD_DEFINITIONS( -DHAVE_SALOME ) ENDIF(EXISTS ${GUI_ROOT_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f7435c67..f29f9a8ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ ENDIF(UNIX) ADD_SUBDIRECTORY (src/Config) -ADD_SUBDIRECTORY (src/Event) +ADD_SUBDIRECTORY (src/Events) ADD_SUBDIRECTORY (src/Model) ADD_SUBDIRECTORY (src/ModelAPI) ADD_SUBDIRECTORY (src/GeomAPI) @@ -37,6 +37,6 @@ ADD_SUBDIRECTORY (src/PyInterp) ADD_SUBDIRECTORY (src/XGUI) ADD_SUBDIRECTORY (src/GeomApp) -#IF(${HAVE_SALOME}) -# ADD_SUBDIRECTORY (src/SalomeModule) -#ENDIF(${HAVE_SALOME}) +IF(${HAVE_SALOME}) + ADD_SUBDIRECTORY (src/NewGeom) +ENDIF(${HAVE_SALOME}) diff --git a/msvc9_env_Salome.bat b/msvc9_env_Salome.bat index 043e2c951..15317ad20 100644 --- a/msvc9_env_Salome.bat +++ b/msvc9_env_Salome.bat @@ -57,6 +57,7 @@ call "%PDIR%\env_compile.bat" @SET PATH=%PDIR%\ftgl-2.1.3\bin;%PATH% @SET PATH=%PDIR%\freetype-2.4.11\bin;%PATH% @SET PATH=%PDIR%\gl2ps-1.3.8\bin;%PATH% +@SET PATH=%PDIR%\qwt-5.2.1\lib;%PATH% @REM ------------------------- IF "%ARCH%" == "Win64" ( @@ -71,4 +72,6 @@ IF "%ARCH%" == "Win64" ( ) @SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins -@SET PATH=%ROOT_DIR%\install\plugins;%PATH% +@SET PATH=%ROOT_DIR%\install\bin;%ROOT_DIR%\install\plugins;%PATH% + +@SET LightAppConfig=%ROOT_DIR%\install\share\salome\resources\newgeom;%GUI_ROOT_DIR%\share\salome\resources\gui diff --git a/salomeRun.bat b/salomeRun.bat new file mode 100644 index 000000000..3738b2f17 --- /dev/null +++ b/salomeRun.bat @@ -0,0 +1,16 @@ +@ECHO OFF + +REM Find absolute path to ROOT_DIR +@SET PARENT_DIR=%~dp0.. +@SET ROOT_DIR= +pushd %PARENT_DIR% +@SET ROOT_DIR=%CD% +popd + +@SET SRC_DIR=%ROOT_DIR%\sources +@SET OCC_LIB_PREFIX=d + +call %SRC_DIR%\msvc9_env_Salome.bat + + +SuitApp.exe LightApp -style salome --modules=NewGeom --uselicense --noexcepthandling diff --git a/src/Config/CMakeLists.txt b/src/Config/CMakeLists.txt index 92aee7ca6..a501bcfa7 100644 --- a/src/Config/CMakeLists.txt +++ b/src/Config/CMakeLists.txt @@ -1,7 +1,7 @@ INCLUDE(Common) INCLUDE(XMLProcessing) -INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Event) +INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events) SET(PROJECT_HEADERS Config.h @@ -30,7 +30,7 @@ SET(XML_RESOURCES ) SET(PROJECT_LIBRARIES - Event + Events ${LIBXML2_LIBRARIES} ) diff --git a/src/Config/Config_FeatureMessage.cpp b/src/Config/Config_FeatureMessage.cpp index 209bb7aa2..2da657417 100644 --- a/src/Config/Config_FeatureMessage.cpp +++ b/src/Config/Config_FeatureMessage.cpp @@ -3,8 +3,8 @@ */ #include "Config_FeatureMessage.h" -Config_FeatureMessage::Config_FeatureMessage(const Event_ID theId, const void* theParent) - : Event_Message(theId, theParent) +Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, const void* theParent) + : Events_Message(theId, theParent) { myId = ""; myText = ""; diff --git a/src/Config/Config_FeatureMessage.h b/src/Config/Config_FeatureMessage.h index 900d547d3..a7928800a 100644 --- a/src/Config/Config_FeatureMessage.h +++ b/src/Config/Config_FeatureMessage.h @@ -2,7 +2,7 @@ #define CONFIG_MESSAGE_H #include -#include +#include #include @@ -11,7 +11,7 @@ * Example of the feature entry: * */ -class Config_FeatureMessage: public Event_Message +class Config_FeatureMessage: public Events_Message { std::string myId; //Feature unique id std::string myText; //Represents action's text @@ -26,8 +26,8 @@ class Config_FeatureMessage: public Event_Message bool myUseInput; //Action is being checked until user commit the operation public: - //const Event_ID theID, const void* theSender = 0 - CONFIG_EXPORT Config_FeatureMessage(const Event_ID theId, const void* theParent = 0); + //const Events_ID theID, const void* theSender = 0 + CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0); //TODO(sbh): Implement static method to extract event id [SEID] //static const char* eventId() { return ""; } @@ -56,4 +56,4 @@ public: CONFIG_EXPORT void setUseInput(bool isUseInput); }; -#endif // CONFIG_MESSAGE_H +#endif // CONFIG_MESSAGE_H diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index 50d72e992..229c4cec9 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -9,8 +9,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -38,9 +38,9 @@ Config_FeatureReader::~Config_FeatureReader() void Config_FeatureReader::processNode(xmlNodePtr theNode) { - Event_ID aMenuItemEvent = Event_Loop::eventByName(myEventGenerated); + Events_ID aMenuItemEvent = Events_Loop::eventByName(myEventGenerated); if (isNode(theNode, NODE_FEATURE, NULL)) { - Event_Loop* aEvLoop = Event_Loop::loop(); + Events_Loop* aEvLoop = Events_Loop::loop(); Config_FeatureMessage aMessage(aMenuItemEvent, this); fillFeature(theNode, aMessage); //If a feature has xml definition for it's widget: diff --git a/src/Config/Config_PointerMessage.cpp b/src/Config/Config_PointerMessage.cpp index cc4b353d5..91e9d10f3 100644 --- a/src/Config/Config_PointerMessage.cpp +++ b/src/Config/Config_PointerMessage.cpp @@ -7,8 +7,8 @@ #include -Config_PointerMessage::Config_PointerMessage(const Event_ID theId, const void* theParent) - : Event_Message(theId, theParent), myPointer(0) +Config_PointerMessage::Config_PointerMessage(const Events_ID theId, const void* theParent) + : Events_Message(theId, theParent), myPointer(0) { } diff --git a/src/Config/Config_PointerMessage.h b/src/Config/Config_PointerMessage.h index e0ac3e440..f108d3ede 100644 --- a/src/Config/Config_PointerMessage.h +++ b/src/Config/Config_PointerMessage.h @@ -9,15 +9,15 @@ #define PARTSET_MESSAGE_H_ #include -#include +#include /* * A general class to pass pointers over the event loop. */ -class CONFIG_EXPORT Config_PointerMessage: public Event_Message +class CONFIG_EXPORT Config_PointerMessage: public Events_Message { public: - Config_PointerMessage(const Event_ID theId, const void* theParent = 0); + Config_PointerMessage(const Events_ID theId, const void* theParent = 0); virtual ~Config_PointerMessage(); void* pointer() const; diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index 002c9df49..f804cd501 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/Event/CMakeLists.txt b/src/Event/CMakeLists.txt deleted file mode 100644 index 63191667e..000000000 --- a/src/Event/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -INCLUDE(Common) - -SET(PROJECT_HEADERS - Event.h - Event_Message.h - Event_Listener.h - Event_Loop.h -) - -SET(PROJECT_SOURCES - Event_Message.cpp - Event_Listener.cpp - Event_Loop.cpp -) - -ADD_DEFINITIONS(-DEVENT_EXPORTS) -ADD_LIBRARY(Event SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) - -TARGET_LINK_LIBRARIES(Event ${PROJECT_LIBRARIES}) - -INSTALL(TARGETS Event DESTINATION bin) diff --git a/src/Event/Event.h b/src/Event/Event.h deleted file mode 100644 index d99cd0046..000000000 --- a/src/Event/Event.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EVENT_H -#define EVENT_H - -#if defined EVENT_EXPORTS -#if defined WIN32 -#define EVENT_EXPORT __declspec( dllexport ) -#else -#define EVENT_EXPORT -#endif -#else -#if defined WIN32 -#define EVENT_EXPORT __declspec( dllimport ) -#else -#define EVENT_EXPORT -#endif -#endif - -#endif diff --git a/src/Event/Event_Listener.cpp b/src/Event/Event_Listener.cpp deleted file mode 100644 index ffb56c7b6..000000000 --- a/src/Event/Event_Listener.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// File: Event_Listener.cxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#include diff --git a/src/Event/Event_Listener.h b/src/Event/Event_Listener.h deleted file mode 100644 index c47d28dbf..000000000 --- a/src/Event/Event_Listener.h +++ /dev/null @@ -1,25 +0,0 @@ -// File: Event_Listener.hxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#ifndef Event_Listener_HeaderFile -#define Event_Listener_HeaderFile - -#include -class Event_Message; - -/**\class Event_Listener - * \ingroup EventLoop - * \brief Base interface for any event listener. - * - * If some object wants to listen some events it must inherit - * this class and register in the Loop. - */ -class EVENT_EXPORT Event_Listener { - -public: - //! This method is called by loop when the event is started to process. - virtual void processEvent(const Event_Message* theMessage) = 0; -}; - -#endif diff --git a/src/Event/Event_Loop.cpp b/src/Event/Event_Loop.cpp deleted file mode 100644 index c938dbe95..000000000 --- a/src/Event/Event_Loop.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// File: Event_Loop.hxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#include - -#include -#include - -using namespace std; - -Event_Loop* Event_Loop::loop() -{ - // initialized on initialization of the application - static Event_Loop MAIN_LOOP; - return &MAIN_LOOP; -} - -Event_ID Event_Loop::eventByName(const char* theName) -{ - ///! All events created in this session, uniquely identified by the text and char pointer - static map CREATED_EVENTS; - char* aResult; - string aName(theName); - map::iterator aFound = CREATED_EVENTS.find(aName); - if (aFound == CREATED_EVENTS.end()) { //not created yet - aResult = strdup(theName); // copy to make unique internal pointer - CREATED_EVENTS[aName] = aResult; - } else - aResult = aFound->second; - - return Event_ID(aResult); -} - -void Event_Loop::send(Event_Message& theMessage) -{ - // TO DO: make it in thread and wit husage of semaphores - - map > >::iterator aFindID = myListeners.find( - theMessage.eventID().eventText()); - if (aFindID != myListeners.end()) { - map >::iterator aFindSender = aFindID->second.find( - theMessage.sender()); - if (aFindSender != aFindID->second.end()) { - list& aListeners = aFindSender->second; - for(list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) - (*aL)->processEvent(&theMessage); - } - if (theMessage.sender()) { // also call for NULL senders registered - aFindSender = aFindID->second.find(NULL); - if (aFindSender != aFindID->second.end()) { - list& aListeners = aFindSender->second; - for(list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) - (*aL)->processEvent(&theMessage); - } - } - } -} - -void Event_Loop::registerListener(Event_Listener* theListener, const Event_ID theID, - void* theSender) -{ - map > >::iterator aFindID = myListeners.find( - theID.eventText()); - if (aFindID == myListeners.end()) { // create container associated with ID - myListeners[theID.eventText()] = map >(); - aFindID = myListeners.find(theID.eventText()); - } - - map >::iterator aFindSender = aFindID->second.find(theSender); - if (aFindSender == aFindID->second.end()) { // create container associated with sender - aFindID->second[theSender] = list(); - aFindSender = aFindID->second.find(theSender); - } - // check that listener was not registered wit hsuch parameters before - list& aListeners = aFindSender->second; - for(list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) - if (*aL == theListener) - return; // avoid duplicates - - aListeners.push_back(theListener); -} diff --git a/src/Event/Event_Loop.h b/src/Event/Event_Loop.h deleted file mode 100644 index 60ddacd73..000000000 --- a/src/Event/Event_Loop.h +++ /dev/null @@ -1,46 +0,0 @@ -// File: Event_Loop.hxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#ifndef Event_Loop_HeaderFile -#define Event_Loop_HeaderFile - -#include -#include - -#include -#include - -/**\class Event_Lopp - * \ingroup EventLoop - * \brief Base class that manages the receiving and sending of all - * not Qt-events in the application. - * - * One per application, initialized on start. Listeners must register in this loop - * to get events, called by senders. Sending of events is very fast (just adding to container). - * Performing of events is processed in separated thread, so, sender takes - * control back immideately. - */ -class Event_Loop { - std::map > > - myListeners; ///< map from event ID to sender pointer to listeners that must be called for this - - //! The empty constructor, will be called at startup of the application, only once - Event_Loop() {}; -public: - ///! Returns the main object of the loop, one per application. - EVENT_EXPORT static Event_Loop* loop(); - //! Returns the unique event by the given name. Call this method only on initialization of object - //! to speedup the events processing without parsing of the string. - EVENT_EXPORT static Event_ID eventByName(const char* theName); - - //! Allows to send an event - EVENT_EXPORT void send(Event_Message& theMessage); - - //! Registers (or adds if such listener is already registered) a listener - //! that will be called on the event and from the defined sender - EVENT_EXPORT void registerListener(Event_Listener* theListener, const Event_ID theID, - void* theSender = 0); -}; - -#endif diff --git a/src/Event/Event_Message.cpp b/src/Event/Event_Message.cpp deleted file mode 100644 index 764ed826f..000000000 --- a/src/Event/Event_Message.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// File: Event_Message.cxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#include diff --git a/src/Event/Event_Message.h b/src/Event/Event_Message.h deleted file mode 100644 index 0c2702072..000000000 --- a/src/Event/Event_Message.h +++ /dev/null @@ -1,57 +0,0 @@ -// File: Event_Message.hxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#ifndef Event_Message_HeaderFile -#define Event_Message_HeaderFile - -#include - -/**\class Event_ID - * \ingroup EventLoop - * \brief Identifier of the event kind. - * - * Each event ID is created in main Envent_Loop class - * that stores correspondance between the string-name of the - * identifier and the pointer to the static string that is really - * used as an identifier (this is usefull for debugging of the events - * with log files and in debugger). - */ -class EVENT_EXPORT Event_ID { - char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type - - Event_ID(char* theID) {myID = theID;} - - friend class Event_Loop; -public: - /// Returns the text-identifier of the event (for debugging reasons) - char* eventText() const {return myID;} - /// Allows to compare identifiers - bool operator==(const Event_ID& theID) const {return myID == theID.myID;} -}; - -/**\class Event_Message - * \ingroup EventLoop - * \brief Message for communication between sender and listener of event. - * Normally it is inherited by the higher-level - */ -class EVENT_EXPORT Event_Message { - Event_ID myEventId; ///< identifier of the event - void* mySender; ///< the sender object - -public: - - //! Creates the message - Event_Message(const Event_ID theID, const void* theSender = 0) - : myEventId(theID), mySender((void*) theSender) {} - //! do nothing in the destructor yet - virtual ~Event_Message() {} - - //! Returns identifier of the message - const Event_ID& eventID() const {return myEventId;} - - //! Returns sender of the message or NULL if it is anonymous message - void* sender() const {return mySender;} -}; - -#endif diff --git a/src/Events/CMakeLists.txt b/src/Events/CMakeLists.txt new file mode 100644 index 000000000..08c3903c2 --- /dev/null +++ b/src/Events/CMakeLists.txt @@ -0,0 +1,21 @@ +INCLUDE(Common) + +SET(PROJECT_HEADERS + Events.h + Events_Message.h + Events_Listener.h + Events_Loop.h +) + +SET(PROJECT_SOURCES + Events_Message.cpp + Events_Listener.cpp + Events_Loop.cpp +) + +ADD_DEFINITIONS(-DEVENTS_EXPORTS) +ADD_LIBRARY(Events SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) + +TARGET_LINK_LIBRARIES(Events ${PROJECT_LIBRARIES}) + +INSTALL(TARGETS Events DESTINATION bin) diff --git a/src/Events/Events.h b/src/Events/Events.h new file mode 100644 index 000000000..928056c8e --- /dev/null +++ b/src/Events/Events.h @@ -0,0 +1,18 @@ +#ifndef EVENTS_H +#define EVENTS_H + +#if defined EVENTS_EXPORTS +#if defined WIN32 +#define EVENTS_EXPORT __declspec( dllexport ) +#else +#define EVENTS_EXPORT +#endif +#else +#if defined WIN32 +#define EVENTS_EXPORT __declspec( dllimport ) +#else +#define EVENTS_EXPORT +#endif +#endif + +#endif diff --git a/src/Events/Events_Listener.cpp b/src/Events/Events_Listener.cpp new file mode 100644 index 000000000..8a7720c72 --- /dev/null +++ b/src/Events/Events_Listener.cpp @@ -0,0 +1,5 @@ +// File: Events_Listener.cxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#include diff --git a/src/Events/Events_Listener.h b/src/Events/Events_Listener.h new file mode 100644 index 000000000..2fdcb097f --- /dev/null +++ b/src/Events/Events_Listener.h @@ -0,0 +1,25 @@ +// File: Events_Listener.hxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#ifndef Events_Listener_HeaderFile +#define Events_Listener_HeaderFile + +#include +class Events_Message; + +/**\class Events_Listener + * \ingroup EventsLoop + * \brief Base interface for any event listener. + * + * If some object wants to listen some events it must inherit + * this class and register in the Loop. + */ +class EVENTS_EXPORT Events_Listener { + +public: + //! This method is called by loop when the event is started to process. + virtual void processEvent(const Events_Message* theMessage) = 0; +}; + +#endif diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp new file mode 100644 index 000000000..6c8bb4760 --- /dev/null +++ b/src/Events/Events_Loop.cpp @@ -0,0 +1,82 @@ +// File: Events_Loop.hxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#include + +#include +#include + +using namespace std; + +Events_Loop* Events_Loop::loop() +{ + // initialized on initialization of the application + static Events_Loop MAIN_LOOP; + return &MAIN_LOOP; +} + +Events_ID Events_Loop::eventByName(const char* theName) +{ + ///! All events created in this session, uniquely identified by the text and char pointer + static map CREATED_EVENTS; + char* aResult; + string aName(theName); + map::iterator aFound = CREATED_EVENTS.find(aName); + if (aFound == CREATED_EVENTS.end()) { //not created yet + aResult = strdup(theName); // copy to make unique internal pointer + CREATED_EVENTS[aName] = aResult; + } else + aResult = aFound->second; + + return Events_ID(aResult); +} + +void Events_Loop::send(Events_Message& theMessage) +{ + // TO DO: make it in thread and wit husage of semaphores + + map > >::iterator aFindID = myListeners.find( + theMessage.eventID().eventText()); + if (aFindID != myListeners.end()) { + map >::iterator aFindSender = aFindID->second.find( + theMessage.sender()); + if (aFindSender != aFindID->second.end()) { + list& aListeners = aFindSender->second; + for(list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) + (*aL)->processEvent(&theMessage); + } + if (theMessage.sender()) { // also call for NULL senders registered + aFindSender = aFindID->second.find(NULL); + if (aFindSender != aFindID->second.end()) { + list& aListeners = aFindSender->second; + for(list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) + (*aL)->processEvent(&theMessage); + } + } + } +} + +void Events_Loop::registerListener(Events_Listener* theListener, const Events_ID theID, + void* theSender) +{ + map > >::iterator aFindID = myListeners.find( + theID.eventText()); + if (aFindID == myListeners.end()) { // create container associated with ID + myListeners[theID.eventText()] = map >(); + aFindID = myListeners.find(theID.eventText()); + } + + map >::iterator aFindSender = aFindID->second.find(theSender); + if (aFindSender == aFindID->second.end()) { // create container associated with sender + aFindID->second[theSender] = list(); + aFindSender = aFindID->second.find(theSender); + } + // check that listener was not registered wit hsuch parameters before + list& aListeners = aFindSender->second; + for(list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) + if (*aL == theListener) + return; // avoid duplicates + + aListeners.push_back(theListener); +} diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h new file mode 100644 index 000000000..893ecb199 --- /dev/null +++ b/src/Events/Events_Loop.h @@ -0,0 +1,46 @@ +// File: Events_Loop.hxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#ifndef Events_Loop_HeaderFile +#define Events_Loop_HeaderFile + +#include +#include + +#include +#include + +/**\class Events_Lopp + * \ingroup EventsLoop + * \brief Base class that manages the receiving and sending of all + * not Qt-events in the application. + * + * One per application, initialized on start. Listeners must register in this loop + * to get events, called by senders. Sending of events is very fast (just adding to container). + * Performing of events is processed in separated thread, so, sender takes + * control back immideately. + */ +class Events_Loop { + std::map > > + myListeners; ///< map from event ID to sender pointer to listeners that must be called for this + + //! The empty constructor, will be called at startup of the application, only once + Events_Loop() {}; +public: + ///! Returns the main object of the loop, one per application. + EVENTS_EXPORT static Events_Loop* loop(); + //! Returns the unique event by the given name. Call this method only on initialization of object + //! to speedup the events processing without parsing of the string. + EVENTS_EXPORT static Events_ID eventByName(const char* theName); + + //! Allows to send an event + EVENTS_EXPORT void send(Events_Message& theMessage); + + //! Registers (or adds if such listener is already registered) a listener + //! that will be called on the event and from the defined sender + EVENTS_EXPORT void registerListener(Events_Listener* theListener, const Events_ID theID, + void* theSender = 0); +}; + +#endif diff --git a/src/Events/Events_Message.cpp b/src/Events/Events_Message.cpp new file mode 100644 index 000000000..6de383912 --- /dev/null +++ b/src/Events/Events_Message.cpp @@ -0,0 +1,5 @@ +// File: Events_Message.cxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#include diff --git a/src/Events/Events_Message.h b/src/Events/Events_Message.h new file mode 100644 index 000000000..1d5a57d41 --- /dev/null +++ b/src/Events/Events_Message.h @@ -0,0 +1,57 @@ +// File: Events_Message.hxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#ifndef Events_Message_HeaderFile +#define Events_Message_HeaderFile + +#include + +/**\class Events_ID + * \ingroup EventsLoop + * \brief Identifier of the event kind. + * + * Each event ID is created in main Envent_Loop class + * that stores correspondance between the string-name of the + * identifier and the pointer to the static string that is really + * used as an identifier (this is usefull for debugging of the events + * with log files and in debugger). + */ +class EVENTS_EXPORT Events_ID { + char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type + + Events_ID(char* theID) {myID = theID;} + + friend class Events_Loop; +public: + /// Returns the text-identifier of the event (for debugging reasons) + char* eventText() const {return myID;} + /// Allows to compare identifiers + bool operator==(const Events_ID& theID) const {return myID == theID.myID;} +}; + +/**\class Events_Message + * \ingroup EventsLoop + * \brief Message for communication between sender and listener of event. + * Normally it is inherited by the higher-level + */ +class EVENTS_EXPORT Events_Message { + Events_ID myEventsId; ///< identifier of the event + void* mySender; ///< the sender object + +public: + + //! Creates the message + Events_Message(const Events_ID theID, const void* theSender = 0) + : myEventsId(theID), mySender((void*) theSender) {} + //! do nothing in the destructor yet + virtual ~Events_Message() {} + + //! Returns identifier of the message + const Events_ID& eventID() const {return myEventsId;} + + //! Returns sender of the message or NULL if it is anonymous message + void* sender() const {return mySender;} +}; + +#endif diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index 310c9f8a3..24bee85be 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -26,11 +26,11 @@ SET(PROJECT_SOURCES ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS}) ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) -TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Event Config) +TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Events Config) INCLUDE_DIRECTORIES( ../ModelAPI - ../Event + ../Events ../Config ${CAS_INCLUDE_DIRS} ) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index c022362e8..d33caaae8 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include @@ -236,9 +236,9 @@ void Model_Document::addFeature(const boost::shared_ptr theFea myFeatures[aGroup].push_back(theFeature); // event: feature is added - static Event_ID anEvent = Event_Loop::eventByName(EVENT_FEATURE_CREATED); + static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED); ModelAPI_FeatureUpdatedMessage aMsg(aThis, theFeature, anEvent); - Event_Loop::loop()->send(aMsg); + Events_Loop::loop()->send(aMsg); } boost::shared_ptr Model_Document::feature(TDF_Label& theLabel) @@ -371,7 +371,7 @@ void Model_Document::synchronizeFeatures() aGroupNamesIter = myGroupsNames.erase(aGroupNamesIter); // say that features were deleted from group ModelAPI_FeatureDeletedMessage aMsg(aThis, aGroupName); - Event_Loop::loop()->send(aMsg); + Events_Loop::loop()->send(aMsg); } // create new groups basing on the following data model update for(; aGroupsIter.More(); aGroupsIter.Next()) { @@ -408,7 +408,7 @@ void Model_Document::synchronizeFeatures() aFIter = aFeatures.erase(aFIter); // event: model is updated ModelAPI_FeatureDeletedMessage aMsg(aThis, aGroupName); - Event_Loop::loop()->send(aMsg); + Events_Loop::loop()->send(aMsg); } else if (aDSTag < aFeatureTag) { // a new feature is inserted // create a feature boost::shared_ptr aFeature = ModelAPI_PluginManager::get()->createFeature( @@ -422,9 +422,9 @@ void Model_Document::synchronizeFeatures() aFeature->setData(aData); aFeature->initAttributes(); // event: model is updated - static Event_ID anEvent = Event_Loop::eventByName(EVENT_FEATURE_CREATED); + static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED); ModelAPI_FeatureUpdatedMessage aMsg(aThis, aFeature, anEvent); - Event_Loop::loop()->send(aMsg); + Events_Loop::loop()->send(aMsg); if (aFIter == aFeatures.end()) { aFeatures.push_back(aFeature); diff --git a/src/Model/Model_Events.cpp b/src/Model/Model_Events.cpp index a83e9cabd..b71ecff50 100644 --- a/src/Model/Model_Events.cpp +++ b/src/Model/Model_Events.cpp @@ -3,23 +3,23 @@ // Author: Mikhail PONIKAROV #include -#include +#include ModelAPI_FeatureUpdatedMessage::ModelAPI_FeatureUpdatedMessage( const boost::shared_ptr& theDoc, - const boost::shared_ptr& theFeature, const Event_ID& theEvent) - : Event_Message(theEvent, 0), myFeature(theFeature), myDoc(theDoc) + const boost::shared_ptr& theFeature, const Events_ID& theEvent) + : Events_Message(theEvent, 0), myFeature(theFeature), myDoc(theDoc) {} ModelAPI_FeatureDeletedMessage::ModelAPI_FeatureDeletedMessage( const boost::shared_ptr& theDoc, const std::string& theGroup) - : Event_Message(messageId(), 0), myDoc(theDoc), myGroup(theGroup) + : Events_Message(messageId(), 0), myDoc(theDoc), myGroup(theGroup) { } -const Event_ID ModelAPI_FeatureDeletedMessage::messageId() +const Events_ID ModelAPI_FeatureDeletedMessage::messageId() { - static Event_ID MY_ID = Event_Loop::eventByName(EVENT_FEATURE_DELETED); + static Events_ID MY_ID = Events_Loop::eventByName(EVENT_FEATURE_DELETED); return MY_ID; } diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index 81828bf30..feda6ab02 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -6,7 +6,7 @@ #define Model_Events_HeaderFile #include -#include +#include #include #include @@ -21,7 +21,7 @@ static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated"; static const char * EVENT_FEATURE_DELETED = "FeatureDeleted"; /// Message that feature was changed (used for Object Browser update) -class ModelAPI_FeatureUpdatedMessage : public Event_Message { +class ModelAPI_FeatureUpdatedMessage : public Events_Message { boost::shared_ptr myDoc; ///< document owner of the feature boost::shared_ptr myFeature; ///< which feature is changed public: @@ -29,7 +29,7 @@ public: ModelAPI_FeatureUpdatedMessage( const boost::shared_ptr& theDoc, const boost::shared_ptr& theFeature, - const Event_ID& theEvent); + const Events_ID& theEvent); /// Returns the feature that has been updated boost::shared_ptr feature() const {return myFeature;} @@ -38,7 +38,7 @@ public: }; /// Message that feature was deleted (used for Object Browser update) -class ModelAPI_FeatureDeletedMessage : public Event_Message { +class ModelAPI_FeatureDeletedMessage : public Events_Message { boost::shared_ptr myDoc; ///< document owner of the feature std::string myGroup; ///< group identifier that contained the deleted feature public: @@ -47,7 +47,7 @@ public: const std::string& theGroup); /// Returns the ID of this message (EVENT_FEATURE_DELETED) - static const Event_ID messageId(); + static const Events_ID messageId(); /// Returns the feature that has been updated boost::shared_ptr document() const {return myDoc;} diff --git a/src/Model/Model_PluginManager.cpp b/src/Model/Model_PluginManager.cpp index e816fdd4a..2750614e7 100644 --- a/src/Model/Model_PluginManager.cpp +++ b/src/Model/Model_PluginManager.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include @@ -64,15 +64,15 @@ Model_PluginManager::Model_PluginManager() { myPluginsInfoLoaded = false; //TODO(sbh): Implement static method to extract event id [SEID] - static Event_ID aFeatureEvent = Event_Loop::eventByName("FeatureRegisterEvent"); + static Events_ID aFeatureEvent = Events_Loop::eventByName("FeatureRegisterEvent"); ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr(this)); // register the configuration reading listener - Event_Loop* aLoop = Event_Loop::loop(); + Events_Loop* aLoop = Events_Loop::loop(); aLoop->registerListener(this, aFeatureEvent); } -void Model_PluginManager::processEvent(const Event_Message* theMessage) +void Model_PluginManager::processEvent(const Events_Message* theMessage) { const Config_FeatureMessage* aMsg = dynamic_cast(theMessage); diff --git a/src/Model/Model_PluginManager.h b/src/Model/Model_PluginManager.h index 018f705b1..7f405573f 100644 --- a/src/Model/Model_PluginManager.h +++ b/src/Model/Model_PluginManager.h @@ -7,7 +7,7 @@ #include "Model.h" #include -#include +#include #include class Model_Document; @@ -18,7 +18,7 @@ class Model_Document; * plugin contains which feature, loads and stores reference to loaded plugins by * the feature functionality request. */ -class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener +class Model_PluginManager : public ModelAPI_PluginManager, public Events_Listener { bool myPluginsInfoLoaded; ///< it true if plugins information is loaded /// map of feature IDs to plugin name @@ -45,7 +45,7 @@ public: MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin* thePlugin); /// Processes the configuration file reading - MODEL_EXPORT virtual void processEvent(const Event_Message* theMessage); + MODEL_EXPORT virtual void processEvent(const Events_Message* theMessage); /// Is called only once, on startup of the application Model_PluginManager(); diff --git a/src/NewGeom/CMakeLists.txt b/src/NewGeom/CMakeLists.txt new file mode 100644 index 000000000..4d908a259 --- /dev/null +++ b/src/NewGeom/CMakeLists.txt @@ -0,0 +1,54 @@ + +INCLUDE(FindCAS) + +SET(CMAKE_AUTOMOC ON) + +SET(PROJECT_HEADERS + NewGeom.h + NewGeom_Module.h +) + +SET(PROJECT_AUTOMOC + ${CMAKE_CURRENT_BINARY_DIR}/XGUI_automoc.cpp +) + +SET(PROJECT_SOURCES + NewGeom_Module.cpp +) + +SET(PROJECT_RESOURCES + resources/LightApp.xml + resources/newgeom.png +) + +SET(PROJECT_LIBRARIES + Events + Config + XGUI + ${QT_LIBRARIES} + ${LightApp} + ${CAM} + ${OCCViewer} +) + +ADD_DEFINITIONS( -DNewGeom_EXPORTS ${CAS_DEFINITIONS} ) + +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI + ${PROJECT_SOURCE_DIR}/src/Events + ${SALOME_GUI_INCLUDE} + ${SALOME_KERNEL_INCLUDE} + ${CAS_INCLUDE_DIRS} +) + +ADD_LIBRARY(NewGeom SHARED + ${PROJECT_SOURCES} + ${PROJECT_HEADERS} +) + +ADD_DEPENDENCIES(NewGeom XGUI) + +# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore +TARGET_LINK_LIBRARIES(NewGeom ${PROJECT_LIBRARIES}) + +INSTALL(TARGETS NewGeom DESTINATION bin) +INSTALL(FILES ${PROJECT_RESOURCES} DESTINATION share/salome/resources/newgeom ) \ No newline at end of file diff --git a/src/NewGeom/NewGeom.h b/src/NewGeom/NewGeom.h new file mode 100644 index 000000000..78f0f9930 --- /dev/null +++ b/src/NewGeom/NewGeom.h @@ -0,0 +1,21 @@ +#ifndef NewGeom_H +#define NewGeom_H + +#if defined NewGeom_EXPORTS +#if defined WIN32 +#define NewGeom_EXPORT __declspec( dllexport ) +#else +#define NewGeom_EXPORT +#endif +#else +#if defined WIN32 +#define NewGeom_EXPORT __declspec( dllimport ) +#else +#define NewGeom_EXPORT +#endif +#endif + +#endif + + + diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp new file mode 100644 index 000000000..4fe5e15a7 --- /dev/null +++ b/src/NewGeom/NewGeom_Module.cpp @@ -0,0 +1,44 @@ + + +#include "NewGeom_Module.h" + +#include +#include + + + +NewGeom_Module::NewGeom_Module() +: LightApp_Module( "NewGeom" ) +{ +} + + +NewGeom_Module::~NewGeom_Module() +{ +} + +void NewGeom_Module::initialize(CAM_Application* theApp) +{ +} + +void NewGeom_Module::windows(QMap& theWndMap) const +{ + theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); +} + +void NewGeom_Module::viewManagers(QStringList& theList) const +{ + theList.append( OCCViewer_Viewer::Type() ); +} + +bool NewGeom_Module::activateModule(SUIT_Study* theStudy) +{ + return LightApp_Module::activateModule(theStudy); +} + +bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy) +{ + return LightApp_Module::deactivateModule(theStudy); +} + + diff --git a/src/NewGeom/NewGeom_Module.h b/src/NewGeom/NewGeom_Module.h new file mode 100644 index 000000000..bd6886e0f --- /dev/null +++ b/src/NewGeom/NewGeom_Module.h @@ -0,0 +1,28 @@ + + +#ifndef NewGeom_Module_H +#define NewGeom_Module_H + +#include "NewGeom.h" +#include + +class NewGeom_EXPORT NewGeom_Module: public LightApp_Module +{ + Q_OBJECT +public: + NewGeom_Module(); + virtual ~NewGeom_Module(); + + virtual void initialize( CAM_Application* theApp); + virtual void windows( QMap& theWndMap) const; + virtual void viewManagers( QStringList& theList) const; + +public slots: + bool activateModule( SUIT_Study* theStudy); + bool deactivateModule( SUIT_Study* theStudy); + +private: + +}; + +#endif diff --git a/src/NewGeom/resources/LightApp.xml b/src/NewGeom/resources/LightApp.xml new file mode 100644 index 000000000..db530bde7 --- /dev/null +++ b/src/NewGeom/resources/LightApp.xml @@ -0,0 +1,31 @@ + + +
+ + + +
+
+ + +
+
diff --git a/src/NewGeom/resources/newgeom.png b/src/NewGeom/resources/newgeom.png new file mode 100644 index 000000000..d4827e272 Binary files /dev/null and b/src/NewGeom/resources/newgeom.png differ diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index 1554472a2..260da21aa 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -44,7 +44,7 @@ SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI ${CMAKE_SOURCE_DIR}/src/Config - ${CMAKE_SOURCE_DIR}/src/Event + ${CMAKE_SOURCE_DIR}/src/Events ${CMAKE_SOURCE_DIR}/src/ModuleBase ${CMAKE_SOURCE_DIR}/src/ModelAPI ${CMAKE_SOURCE_DIR}/src/SketchPlugin diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index f82eee4b2..a4e64417b 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -12,8 +12,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -84,10 +84,10 @@ void PartSet_Module::onFeatureTriggered() aPartSetOp->setDescription(QString::fromStdString(aDescription)); //TODO(sbh): Implement static method to extract event id [SEID] - static Event_ID aModuleEvent = Event_Loop::eventByName("PartSetModuleEvent"); + static Events_ID aModuleEvent = Events_Loop::eventByName("PartSetModuleEvent"); Config_PointerMessage aMessage(aModuleEvent, this); aMessage.setPointer(aPartSetOp); - Event_Loop::loop()->send(aMessage); + Events_Loop::loop()->send(aMessage); } /** diff --git a/src/SalomeModule/CMakeLists.txt b/src/SalomeModule/CMakeLists.txt deleted file mode 100644 index 2749ccfc9..000000000 --- a/src/SalomeModule/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -SET(CMAKE_AUTOMOC ON) - -SET(PROJECT_HEADERS - SalomeModule.h - SalomeModule_Module.h -) - -SET(PROJECT_AUTOMOC - ${CMAKE_CURRENT_BINARY_DIR}/XGUI_automoc.cpp -) - -SET(PROJECT_SOURCES - SalomeModule_Module.cpp -) - - -SET(PROJECT_LIBRARIES - Event - Config - ${QT_LIBRARIES} - XGUI -) - -ADD_DEFINITIONS( -DSalomeModule_EXPORTS ${CAS_DEFINITIONS} ) - -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI - ${SALOME_GUI_INCLUDE} - ${CAS_INCLUDE_DIRS} -) - -ADD_LIBRARY(SalomeModule SHARED - ${PROJECT_SOURCES} - ${PROJECT_HEADERS} -) - -ADD_DEPENDENCIES(SalomeModule XGUI) - -# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore -TARGET_LINK_LIBRARIES(SalomeModule ${PROJECT_LIBRARIES}) - -INSTALL(TARGETS SalomeModule DESTINATION bin) diff --git a/src/SalomeModule/SalomeModule.h b/src/SalomeModule/SalomeModule.h deleted file mode 100644 index e8977e5a8..000000000 --- a/src/SalomeModule/SalomeModule.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SalomeModule_H -#define SalomeModule_H - -#if defined SalomeModule_EXPORTS -#if defined WIN32 -#define SalomeModule_EXPORT __declspec( dllexport ) -#else -#define SalomeModule_EXPORT -#endif -#else -#if defined WIN32 -#define SalomeModule_EXPORT __declspec( dllimport ) -#else -#define SalomeModule_EXPORT -#endif -#endif - -#endif - - - diff --git a/src/SalomeModule/SalomeModule_Module.cpp b/src/SalomeModule/SalomeModule_Module.cpp deleted file mode 100644 index 1190e77e9..000000000 --- a/src/SalomeModule/SalomeModule_Module.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#include "SalomeModule_Module.h" - -#include -#include - - - -SalomeModule_Module::SalomeModule_Module() -: LightApp_Module( "NewGeom" ) -{ -} - - -SalomeModule_Module::~SalomeModule_Module() -{ -} - -void SalomeModule_Module::initialize(CAM_Application* theApp) -{ -} - -void SalomeModule_Module::windows(QMap& theWndMap) const -{ - theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); -} - -void SalomeModule_Module::viewManagers(QStringList& theList) const -{ - theList.append( OCCViewer_Viewer::Type() ); -} - -bool SalomeModule_Module::activateModule(SUIT_Study* theStudy) -{ - return LightApp_Module::activateModule(theStudy); -} - -bool SalomeModule_Module::deactivateModule(SUIT_Study* theStudy) -{ - return LightApp_Module::deactivateModule(theStudy); -} - - diff --git a/src/SalomeModule/SalomeModule_Module.h b/src/SalomeModule/SalomeModule_Module.h deleted file mode 100644 index d4acd2708..000000000 --- a/src/SalomeModule/SalomeModule_Module.h +++ /dev/null @@ -1,27 +0,0 @@ - - -#ifndef SalomeModule_Module_H -#define SalomeModule_Module_H - -#include - -class SalomeModule_Module: public LightApp_Module -{ - Q_OBJECT -public: - SalomeModule_Module(); - virtual ~SalomeModule_Module(); - - virtual void initialize( CAM_Application* theApp); - virtual void windows( QMap& theWndMap) const; - virtual void viewManagers( QStringList& theList) const; - -public slots: - bool activateModule( SUIT_Study* theStudy); - bool deactivateModule( SUIT_Study* theStudy); - -private: - -}; - -#endif diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index becc47ee3..a246e4060 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -65,7 +65,7 @@ SET(PROJECT_RESOURCES #) SET(PROJECT_LIBRARIES - Event + Events Config ${QT_LIBRARIES} ${CAS_VIEWER} @@ -92,7 +92,7 @@ SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) ADD_DEFINITIONS( -DXGUI_EXPORTS ${CAS_DEFINITIONS} ) -INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Event +INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events ${PROJECT_SOURCE_DIR}/src/Config ${PROJECT_SOURCE_DIR}/src/PyInterp ${PROJECT_SOURCE_DIR}/src/PyConsole diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index 7fae4b2bd..50ea7c707 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include @@ -23,9 +23,9 @@ XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent) myDocument = aMgr->currentDocument(); // Register in event loop - Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_CREATED)); - Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_UPDATED)); - Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_DELETED)); + Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_CREATED)); + Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_UPDATED)); + Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_DELETED)); // Create a top part of data tree model myModel = new XGUI_TopDataModel(myDocument, this); @@ -38,7 +38,7 @@ XGUI_DocumentDataModel::~XGUI_DocumentDataModel() } -void XGUI_DocumentDataModel::processEvent(const Event_Message* theMessage) +void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage) { // Created object event ******************* if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_CREATED) { diff --git a/src/XGUI/XGUI_DocumentDataModel.h b/src/XGUI/XGUI_DocumentDataModel.h index 592308ae8..80d69f3b6 100644 --- a/src/XGUI/XGUI_DocumentDataModel.h +++ b/src/XGUI/XGUI_DocumentDataModel.h @@ -6,7 +6,7 @@ #include "XGUI_Constants.h" #include -#include +#include #include @@ -19,7 +19,7 @@ class XGUI_TopDataModel; * \brief This is a proxy data model for Object Browser (QTreeView). * It contains several sub-models for generation of each sub-part of data tree. */ -class XGUI_EXPORT XGUI_DocumentDataModel : public QAbstractItemModel, public Event_Listener +class XGUI_EXPORT XGUI_DocumentDataModel : public QAbstractItemModel, public Events_Listener { Q_OBJECT public: @@ -29,7 +29,7 @@ public: virtual ~XGUI_DocumentDataModel(); // Event Listener method - virtual void processEvent(const Event_Message* theMessage); + virtual void processEvent(const Events_Message* theMessage); virtual QVariant data(const QModelIndex& theIndex, int theRole) const; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index f606615a7..eb4552d96 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -64,11 +64,11 @@ void XGUI_Workshop::startApplication() { initMenu(); //Initialize event listening - Event_Loop* aLoop = Event_Loop::loop(); + Events_Loop* aLoop = Events_Loop::loop(); //TODO(sbh): Implement static method to extract event id [SEID] - Event_ID aFeatureId = aLoop->eventByName("FeatureEvent"); + Events_ID aFeatureId = aLoop->eventByName("FeatureEvent"); aLoop->registerListener(this, aFeatureId); - Event_ID aPartSetId = aLoop->eventByName("PartSetModuleEvent"); + Events_ID aPartSetId = aLoop->eventByName("PartSetModuleEvent"); aLoop->registerListener(this, aPartSetId); activateModule(); myMainWindow->show(); @@ -141,9 +141,9 @@ XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName) } //****************************************************** -void XGUI_Workshop::processEvent(const Event_Message* theMessage) +void XGUI_Workshop::processEvent(const Events_Message* theMessage) { - static Event_ID aFeatureId = Event_Loop::loop()->eventByName("FeatureEvent"); + static Events_ID aFeatureId = Events_Loop::loop()->eventByName("FeatureEvent"); if (theMessage->eventID() == aFeatureId) { const Config_FeatureMessage* aFeatureMsg = dynamic_cast(theMessage); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index a1c79c0b3..f61f6e1b1 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -2,7 +2,7 @@ #define XGUI_WORKSHOP_H #include "XGUI.h" -#include +#include #include #include @@ -26,7 +26,7 @@ class Config_PointerMessage; * \ingroup GUI * \brief Class which defines a configuration of the application (Workshop) and launches it. */ -class XGUI_EXPORT XGUI_Workshop: public QObject, public Event_Listener +class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener { Q_OBJECT public: @@ -55,8 +55,8 @@ public: //! Creates and adds a new workbench (menu group) with the given name and returns it XGUI_Workbench* addWorkbench(const QString& theName); - //! Redefinition of Event_Listener method - virtual void processEvent(const Event_Message* theMessage); + //! Redefinition of Events_Listener method + virtual void processEvent(const Events_Message* theMessage); public slots: void updateCommandStatus();