From 0db0e55b71cdb92db4697c5325cb1472a8bc9f00 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 7 Aug 2014 12:37:56 +0400 Subject: [PATCH] Resources XML file created --- msvc10_env.bat | 2 ++ src/PartSet/CMakeLists.txt | 1 + src/XGUI/CMakeLists.txt | 12 +++++++++--- src/XGUI/NewGeom.xml | 8 ++++++++ src/XGUI/XGUI_ViewPort.cpp | 2 +- src/XGUI/XGUI_ViewPort.h | 11 ++++++----- src/XGUI/XGUI_ViewWindow.cpp | 6 +++--- src/XGUI/XGUI_ViewWindow.h | 7 ++++--- src/XGUI/XGUI_Viewer.cpp | 7 +++++-- src/XGUI/XGUI_Workshop.cpp | 7 +++++++ src/XGUI/XGUI_Workshop.h | 6 ++++++ 11 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 src/XGUI/NewGeom.xml diff --git a/msvc10_env.bat b/msvc10_env.bat index 064ec4e30..41f21666c 100644 --- a/msvc10_env.bat +++ b/msvc10_env.bat @@ -149,6 +149,8 @@ if "%GUI_ROOT_DIR%" == "" ( @REM ------------------------- +@SET NewGeomResources=%ROOT_DIR%\install\resources + rem -------- Visual Studio -------------------- rem Detect Visual Studio (either commercial or Express edition) if "%VS100COMNTOOLS%" == "" ( diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index 4d4de17e1..2786db20b 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -77,6 +77,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI ${CMAKE_SOURCE_DIR}/src/SketchPlugin ${CMAKE_SOURCE_DIR}/src/GeomAPI ${CAS_INCLUDE_DIRS} + ${SUIT_INCLUDE} ) ADD_DEFINITIONS(-DPARTSET_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index 307dbff6b..a5a313301 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -16,7 +16,6 @@ SET(PROJECT_HEADERS XGUI_Viewer.h XGUI_RubberBand.h XGUI_Constants.h - XGUI_ViewBackground.h XGUI_DocumentDataModel.h XGUI_PartDataModel.h XGUI_ObjectsBrowser.h @@ -51,7 +50,6 @@ SET(PROJECT_SOURCES XGUI_ViewPort.cpp XGUI_Viewer.cpp XGUI_RubberBand.cpp - XGUI_ViewBackground.cpp XGUI_DocumentDataModel.cpp XGUI_PartDataModel.cpp XGUI_ObjectsBrowser.cpp @@ -70,6 +68,10 @@ SET(PROJECT_RESOURCES XGUI_pictures.qrc ) +SET(PREFERENCES_XML + NewGeom.xml +) + SET(TEXT_RESOURCES XGUI_msg_fr.ts ) @@ -82,6 +84,8 @@ SET(PROJECT_LIBRARIES ${CAS_KERNEL} ${PyConsole} ${PyInterp} + ${suit} + ${qtx} ModelAPI ModuleBase ) @@ -104,7 +108,7 @@ QT4_CREATE_TRANSLATION(QM_RESOURCES SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) #SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES}) -SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) +SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES} ${PREFERENCES_XML}) ADD_DEFINITIONS( -DXGUI_EXPORTS ${CAS_DEFINITIONS} ) @@ -125,6 +129,7 @@ ADD_LIBRARY(XGUI SHARED ${PROJECT_COMPILED_RESOURCES} ${TEXT_RESOURCES} ${QM_RESOURCES} + ${PREFERENCES_XML} ) ADD_DEPENDENCIES(XGUI ModelAPI) @@ -134,3 +139,4 @@ TARGET_LINK_LIBRARIES(XGUI ${PROJECT_LIBRARIES}) INSTALL(TARGETS XGUI DESTINATION bin) INSTALL(FILES ${QM_RESOURCES} DESTINATION bin) +INSTALL(FILES ${PREFERENCES_XML} DESTINATION resources) diff --git a/src/XGUI/NewGeom.xml b/src/XGUI/NewGeom.xml new file mode 100644 index 000000000..0f76d8321 --- /dev/null +++ b/src/XGUI/NewGeom.xml @@ -0,0 +1,8 @@ + + +
+ + +
+
diff --git a/src/XGUI/XGUI_ViewPort.cpp b/src/XGUI/XGUI_ViewPort.cpp index 6ec2c0c65..609db462f 100644 --- a/src/XGUI/XGUI_ViewPort.cpp +++ b/src/XGUI/XGUI_ViewPort.cpp @@ -492,7 +492,7 @@ void XGUI_ViewPort::zoom(int x0, int y0, int x, int y) /*! Sets the background data */ -void XGUI_ViewPort::setBackground(const XGUI_ViewBackground& bgData) +void XGUI_ViewPort::setBackground(const Qtx::BackgroundData& bgData) { if (bgData.isValid()) { myBackground = bgData; diff --git a/src/XGUI/XGUI_ViewPort.h b/src/XGUI/XGUI_ViewPort.h index a0f9be0db..2988e8fed 100644 --- a/src/XGUI/XGUI_ViewPort.h +++ b/src/XGUI/XGUI_ViewPort.h @@ -2,7 +2,8 @@ #define XGUI_ViewPort_H #include "XGUI.h" -#include "XGUI_ViewBackground.h" + +#include #include #include @@ -52,17 +53,17 @@ public: return myIsAdvancedZoomingEnabled; } - XGUI_ViewBackground background() const + Qtx::BackgroundData background() const { return myBackground; } - void setBackground(const XGUI_ViewBackground& bgData); + void setBackground(const Qtx::BackgroundData& bgData); void syncronizeWith( const XGUI_ViewPort* ref ); signals: - void vpChangeBackground(const XGUI_ViewBackground&); + void vpChangeBackground(const Qtx::BackgroundData&); void vpClosed(); void vpMapped(); void vpTransformed(); @@ -94,7 +95,7 @@ private: double myScale; - XGUI_ViewBackground myBackground; + Qtx::BackgroundData myBackground; int myBgImgHeight; int myBgImgWidth; }; diff --git a/src/XGUI/XGUI_ViewWindow.cpp b/src/XGUI/XGUI_ViewWindow.cpp index 7c0bc5d9a..c62a26652 100644 --- a/src/XGUI/XGUI_ViewWindow.cpp +++ b/src/XGUI/XGUI_ViewWindow.cpp @@ -1004,12 +1004,12 @@ void XGUI_ViewWindow::resetState() setTransformRequested(NOTHING); } -XGUI_ViewBackground XGUI_ViewWindow::background() const +Qtx::BackgroundData XGUI_ViewWindow::background() const { - return myViewPort ? myViewPort->background() : XGUI_ViewBackground(); + return myViewPort ? myViewPort->background() : Qtx::BackgroundData(); } -void XGUI_ViewWindow::setBackground(const XGUI_ViewBackground& theBackground) +void XGUI_ViewWindow::setBackground(const Qtx::BackgroundData& theBackground) { if (myViewPort) myViewPort->setBackground( theBackground ); diff --git a/src/XGUI/XGUI_ViewWindow.h b/src/XGUI/XGUI_ViewWindow.h index 65c2ae273..016c261d9 100644 --- a/src/XGUI/XGUI_ViewWindow.h +++ b/src/XGUI/XGUI_ViewWindow.h @@ -3,7 +3,8 @@ #include "XGUI.h" #include "XGUI_Constants.h" -#include "XGUI_ViewBackground.h" + +#include #include #include @@ -76,10 +77,10 @@ public: bool transformEnabled(const OperationType) const; //! Returns View background object - XGUI_ViewBackground background() const; + Qtx::BackgroundData background() const; //! Sets View background object - void setBackground(const XGUI_ViewBackground& theBackground); + void setBackground(const Qtx::BackgroundData& theBackground); //! Returns true if the current view window can be closed bool closable() const { return myClosable; } diff --git a/src/XGUI/XGUI_Viewer.cpp b/src/XGUI/XGUI_Viewer.cpp index 549b3e449..c0048f2fa 100644 --- a/src/XGUI/XGUI_Viewer.cpp +++ b/src/XGUI/XGUI_Viewer.cpp @@ -2,6 +2,9 @@ #include "XGUI_MainWindow.h" #include "XGUI_ViewWindow.h" #include "XGUI_ViewPort.h" +#include "XGUI_Workshop.h" + +#include #include #include @@ -181,8 +184,8 @@ QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType) if (myViews.size() == 0) setTrihedronShown(true); - view->setBackground(XGUI_ViewBackground(XGUI::VerticalGradient, Qt::white, QColor(Qt::blue).lighter())); - //view->setBackground(XGUI_ViewBackground(Qt::black)); + Qtx::BackgroundData aBk = XGUI_Workshop::resourceMgr()->backgroundValue("Viewer", "background"); + view->setBackground(aBk); view->updateEnabledDrawMode(); QMdiArea* aMDI = myMainWindow->mdiArea(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index adc15c340..a18688e22 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -50,6 +50,8 @@ #include #include +#include + #include #include #include @@ -69,6 +71,7 @@ #include #endif +SUIT_ResourceMgr* XGUI_Workshop::myResourceMgr = 0; QMap XGUI_Workshop::myIcons; @@ -89,6 +92,10 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) myObjectBrowser(0), myDisplayer(0) { + if (!myResourceMgr) { + myResourceMgr = new SUIT_ResourceMgr("NewGeom"); + myResourceMgr->setCurrentFormat("xml"); + } myMainWindow = mySalomeConnector? 0 : new XGUI_MainWindow(); myDisplayer = new XGUI_Displayer(this); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index b857becb3..c83583cc0 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -43,6 +43,8 @@ class ModelAPI_ObjectUpdatedMessage; class ModelAPI_ObjectDeletedMessage; class QAction; +class SUIT_ResourceMgr; + /**\class XGUI_Workshop * \ingroup GUI * \brief Class which defines a configuration of the application (Workshop) and launches it. @@ -111,6 +113,8 @@ public: //! Returns icon name according to feature Id static QString featureIcon(const std::string& theId); + static SUIT_ResourceMgr* resourceMgr() { return myResourceMgr; } + //! Activates or deactivates a part //! If PartPtr is Null pointer then PartSet will be activated void activatePart(ResultPartPtr theFeature); @@ -213,6 +217,8 @@ private: QString myCurrentDir; static QMap myIcons; + static SUIT_ResourceMgr* myResourceMgr; + }; #endif -- 2.39.2