From 43038cf5895f661133b3a21176d80a97d67c357e Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 11 Dec 2014 10:32:21 +0300 Subject: [PATCH] Issue #273: A package AppElements is added to store sources which are not used in Salome mode --- CMakeLists.txt | 1 + src/ModuleBase/CMakeLists.txt | 6 + .../ModuleBase_IPrefMgr.h} | 8 +- .../ModuleBase_Preferences.cpp} | 74 +- .../ModuleBase_Preferences.h} | 42 +- src/NewGeom/NewGeom_Module.cpp | 16 +- src/XGUI/CMakeLists.txt | 74 +- src/XGUI/XGUI_ActionsMgr.cpp | 7 +- src/XGUI/XGUI_ActionsMgr.h | 1 - src/XGUI/XGUI_Command.cpp | 85 -- src/XGUI/XGUI_Command.h | 44 - src/XGUI/XGUI_Constants.h | 85 -- src/XGUI/XGUI_ContextMenuMgr.cpp | 5 +- src/XGUI/XGUI_DataTreeModel.h | 1 - src/XGUI/XGUI_Displayer.cpp | 3 +- src/XGUI/XGUI_Displayer.h | 1 - src/XGUI/XGUI_MainMenu.cpp | 148 -- src/XGUI/XGUI_MainMenu.h | 81 -- src/XGUI/XGUI_MainWindow.cpp | 296 ---- src/XGUI/XGUI_MainWindow.h | 105 -- src/XGUI/XGUI_MenuGroupPanel.cpp | 105 -- src/XGUI/XGUI_MenuGroupPanel.h | 63 - src/XGUI/XGUI_PropertyPanel.cpp | 14 +- src/XGUI/XGUI_PropertyPanel.h | 6 + src/XGUI/XGUI_RubberBand.cpp | 242 ---- src/XGUI/XGUI_RubberBand.h | 83 -- src/XGUI/XGUI_SelectionMgr.cpp | 3 +- src/XGUI/XGUI_Tools.cpp | 12 - src/XGUI/XGUI_Tools.h | 16 - src/XGUI/XGUI_ViewBackground.cpp | 209 --- src/XGUI/XGUI_ViewBackground.h | 109 -- src/XGUI/XGUI_ViewPort.cpp | 557 -------- src/XGUI/XGUI_ViewPort.h | 103 -- src/XGUI/XGUI_ViewWindow.cpp | 1222 ----------------- src/XGUI/XGUI_ViewWindow.h | 367 ----- src/XGUI/XGUI_Viewer.cpp | 652 --------- src/XGUI/XGUI_Viewer.h | 225 --- src/XGUI/XGUI_ViewerProxy.cpp | 75 +- src/XGUI/XGUI_ViewerProxy.h | 26 +- src/XGUI/XGUI_Workbench.cpp | 196 --- src/XGUI/XGUI_Workbench.h | 53 - src/XGUI/XGUI_Workshop.cpp | 66 +- src/XGUI/XGUI_Workshop.h | 15 +- src/XGUI/XGUI_pictures.qrc | 27 - src/XGUI/pictures/cascade_views.png | Bin 535 -> 0 bytes src/XGUI/pictures/new_view.png | Bin 940 -> 0 bytes src/XGUI/pictures/occ_view_back.png | Bin 432 -> 0 bytes src/XGUI/pictures/occ_view_bottom.png | Bin 428 -> 0 bytes src/XGUI/pictures/occ_view_camera_dump.png | Bin 682 -> 0 bytes src/XGUI/pictures/occ_view_clone.png | Bin 441 -> 0 bytes src/XGUI/pictures/occ_view_fitall.png | Bin 816 -> 0 bytes src/XGUI/pictures/occ_view_fitarea.png | Bin 912 -> 0 bytes src/XGUI/pictures/occ_view_front.png | Bin 410 -> 0 bytes src/XGUI/pictures/occ_view_glpan.png | Bin 1086 -> 0 bytes src/XGUI/pictures/occ_view_left.png | Bin 427 -> 0 bytes src/XGUI/pictures/occ_view_pan.png | Bin 982 -> 0 bytes src/XGUI/pictures/occ_view_reset.png | Bin 918 -> 0 bytes src/XGUI/pictures/occ_view_right.png | Bin 418 -> 0 bytes src/XGUI/pictures/occ_view_rotate.png | Bin 886 -> 0 bytes src/XGUI/pictures/occ_view_top.png | Bin 419 -> 0 bytes src/XGUI/pictures/occ_view_zoom.png | Bin 797 -> 0 bytes src/XGUI/pictures/tile_views.png | Bin 422 -> 0 bytes src/XGUI/pictures/wnd_close.png | Bin 779 -> 0 bytes src/XGUI/pictures/wnd_grip.png | Bin 220 -> 0 bytes src/XGUI/pictures/wnd_maximize.png | Bin 688 -> 0 bytes src/XGUI/pictures/wnd_minimize.png | Bin 782 -> 0 bytes src/XGUI/pictures/wnd_restore.png | Bin 481 -> 0 bytes 67 files changed, 221 insertions(+), 5308 deletions(-) rename src/{XGUI/XGUI_IPrefMgr.h => ModuleBase/ModuleBase_IPrefMgr.h} (90%) rename src/{XGUI/XGUI_Preferences.cpp => ModuleBase/ModuleBase_Preferences.cpp} (80%) rename src/{XGUI/XGUI_Preferences.h => ModuleBase/ModuleBase_Preferences.h} (67%) delete mode 100644 src/XGUI/XGUI_Command.cpp delete mode 100644 src/XGUI/XGUI_Command.h delete mode 100644 src/XGUI/XGUI_Constants.h delete mode 100644 src/XGUI/XGUI_MainMenu.cpp delete mode 100644 src/XGUI/XGUI_MainMenu.h delete mode 100644 src/XGUI/XGUI_MainWindow.cpp delete mode 100644 src/XGUI/XGUI_MainWindow.h delete mode 100644 src/XGUI/XGUI_MenuGroupPanel.cpp delete mode 100644 src/XGUI/XGUI_MenuGroupPanel.h delete mode 100644 src/XGUI/XGUI_RubberBand.cpp delete mode 100644 src/XGUI/XGUI_RubberBand.h delete mode 100644 src/XGUI/XGUI_ViewBackground.cpp delete mode 100644 src/XGUI/XGUI_ViewBackground.h delete mode 100644 src/XGUI/XGUI_ViewPort.cpp delete mode 100644 src/XGUI/XGUI_ViewPort.h delete mode 100644 src/XGUI/XGUI_ViewWindow.cpp delete mode 100644 src/XGUI/XGUI_ViewWindow.h delete mode 100644 src/XGUI/XGUI_Viewer.cpp delete mode 100644 src/XGUI/XGUI_Viewer.h delete mode 100644 src/XGUI/XGUI_Workbench.cpp delete mode 100644 src/XGUI/XGUI_Workbench.h delete mode 100644 src/XGUI/pictures/cascade_views.png delete mode 100644 src/XGUI/pictures/new_view.png delete mode 100644 src/XGUI/pictures/occ_view_back.png delete mode 100644 src/XGUI/pictures/occ_view_bottom.png delete mode 100644 src/XGUI/pictures/occ_view_camera_dump.png delete mode 100644 src/XGUI/pictures/occ_view_clone.png delete mode 100644 src/XGUI/pictures/occ_view_fitall.png delete mode 100644 src/XGUI/pictures/occ_view_fitarea.png delete mode 100644 src/XGUI/pictures/occ_view_front.png delete mode 100644 src/XGUI/pictures/occ_view_glpan.png delete mode 100644 src/XGUI/pictures/occ_view_left.png delete mode 100644 src/XGUI/pictures/occ_view_pan.png delete mode 100644 src/XGUI/pictures/occ_view_reset.png delete mode 100644 src/XGUI/pictures/occ_view_right.png delete mode 100644 src/XGUI/pictures/occ_view_rotate.png delete mode 100644 src/XGUI/pictures/occ_view_top.png delete mode 100644 src/XGUI/pictures/occ_view_zoom.png delete mode 100644 src/XGUI/pictures/tile_views.png delete mode 100644 src/XGUI/pictures/wnd_close.png delete mode 100644 src/XGUI/pictures/wnd_grip.png delete mode 100644 src/XGUI/pictures/wnd_maximize.png delete mode 100644 src/XGUI/pictures/wnd_minimize.png delete mode 100644 src/XGUI/pictures/wnd_restore.png diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f94b0fab..1d1120f84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ ADD_SUBDIRECTORY (src/SketchPlugin) ADD_SUBDIRECTORY (src/SketchSolver) ADD_SUBDIRECTORY (src/ModuleBase) ADD_SUBDIRECTORY (src/PartSet) +ADD_SUBDIRECTORY (src/AppElements) ADD_SUBDIRECTORY (src/XGUI) ADD_SUBDIRECTORY (src/GeomApp) ADD_SUBDIRECTORY (src/ExchangePlugin) diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index e80812b3c..06f6c4ef6 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -30,6 +30,8 @@ SET(PROJECT_HEADERS ModuleBase_ResultPrs.h ModuleBase_IViewWindow.h ModuleBase_WidgetLabel.h + ModuleBase_IPrefMgr.h + ModuleBase_Preferences.h ) SET(PROJECT_SOURCES @@ -52,6 +54,7 @@ SET(PROJECT_SOURCES ModuleBase_ViewerFilters.cpp ModuleBase_ResultPrs.cpp ModuleBase_WidgetLabel.cpp + ModuleBase_Preferences.cpp ) SET(PROJECT_LIBRARIES @@ -63,6 +66,8 @@ SET(PROJECT_LIBRARIES ${CAS_VIEWER} ${CAS_KERNEL} ${CAS_SHAPE} + ${suit} + ${qtx} ) SET(PROJECT_AUTOMOC @@ -84,6 +89,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/GeomDataAPI ${CMAKE_SOURCE_DIR}/src/GeomAPI ${CMAKE_SOURCE_DIR}/src/GeomAlgoAPI + ${SUIT_INCLUDE} ) ADD_DEFINITIONS(-DMODULEBASE_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/XGUI/XGUI_IPrefMgr.h b/src/ModuleBase/ModuleBase_IPrefMgr.h similarity index 90% rename from src/XGUI/XGUI_IPrefMgr.h rename to src/ModuleBase/ModuleBase_IPrefMgr.h index 9530a6cab..db473211c 100644 --- a/src/XGUI/XGUI_IPrefMgr.h +++ b/src/ModuleBase/ModuleBase_IPrefMgr.h @@ -1,10 +1,10 @@ -// File: XGUI_IPrefMgr.h +// File: ModuleBase_IPrefMgr.h // Created: 10 Sept 2014 // Author: Vitaly SMETANNIKOV -#ifndef XGUI_IPrefMgr_H -#define XGUI_IPrefMgr_H +#ifndef ModuleBase_IPrefMgr_H +#define ModuleBase_IPrefMgr_H #include #include @@ -14,7 +14,7 @@ * It is used in order to make common interface to Preference manager in Salome * and this application */ -class XGUI_IPrefMgr +class ModuleBase_IPrefMgr { public: diff --git a/src/XGUI/XGUI_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp similarity index 80% rename from src/XGUI/XGUI_Preferences.cpp rename to src/ModuleBase/ModuleBase_Preferences.cpp index 0dc2e5f8e..22c4cbff5 100644 --- a/src/XGUI/XGUI_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -1,9 +1,9 @@ -// File: XGUI_Preferences.cpp +// File: ModuleBase_Preferences.cpp // Created: 07 Aug 2014 // Author: Vitaly SMETANNIKOV -#include "XGUI_Preferences.h" -#include "XGUI_Constants.h" +#include "ModuleBase_Preferences.h" +//#include "ModuleBase_Constants.h" #include @@ -16,12 +16,12 @@ #include #include -const QString XGUI_Preferences::VIEWER_SECTION = "Viewer"; -const QString XGUI_Preferences::MENU_SECTION = "Menu"; +const QString ModuleBase_Preferences::VIEWER_SECTION = "Viewer"; +const QString ModuleBase_Preferences::MENU_SECTION = "Menu"; -SUIT_ResourceMgr* XGUI_Preferences::myResourceMgr = 0; +SUIT_ResourceMgr* ModuleBase_Preferences::myResourceMgr = 0; -SUIT_ResourceMgr* XGUI_Preferences::resourceMgr() +SUIT_ResourceMgr* ModuleBase_Preferences::resourceMgr() { if (!myResourceMgr) { myResourceMgr = new SUIT_ResourceMgr("NewGeom"); @@ -30,9 +30,9 @@ SUIT_ResourceMgr* XGUI_Preferences::resourceMgr() return myResourceMgr; } -bool XGUI_Preferences::editPreferences(XGUI_Prefs& theModified) +bool ModuleBase_Preferences::editPreferences(ModuleBase_Prefs& theModified) { - XGUI_PreferencesDlg aDlg(resourceMgr(), QApplication::activeWindow()); + ModuleBase_PreferencesDlg aDlg(resourceMgr(), QApplication::activeWindow()); aDlg.exec(); if (aDlg.isChanged()) { aDlg.modified(theModified); @@ -42,7 +42,7 @@ bool XGUI_Preferences::editPreferences(XGUI_Prefs& theModified) return false; } -void XGUI_Preferences::updateConfigByResources() +void ModuleBase_Preferences::updateConfigByResources() { Config_Properties aProps = Config_PropManager::getProperties(); Config_Properties::iterator aIt; @@ -56,7 +56,7 @@ void XGUI_Preferences::updateConfigByResources() } } -void XGUI_Preferences::updateResourcesByConfig() +void ModuleBase_Preferences::updateResourcesByConfig() { Config_Properties aProps = Config_PropManager::getProperties(); Config_Properties::iterator aIt; @@ -67,7 +67,7 @@ void XGUI_Preferences::updateResourcesByConfig() } } -void XGUI_Preferences::resetConfig() +void ModuleBase_Preferences::resetConfig() { Config_Properties aProps = Config_PropManager::getProperties(); Config_Properties::iterator aIt; @@ -77,7 +77,7 @@ void XGUI_Preferences::resetConfig() } } -void XGUI_Preferences::loadCustomProps() +void ModuleBase_Preferences::loadCustomProps() { if(!myResourceMgr) return; @@ -95,16 +95,16 @@ void XGUI_Preferences::loadCustomProps() } -void XGUI_Preferences::createEditContent(XGUI_IPrefMgr* thePref, int thePage) +void ModuleBase_Preferences::createEditContent(ModuleBase_IPrefMgr* thePref, int thePage) { thePref->prefMgr()->setItemIcon(thePage, QIcon(":pictures/module.png")); createCustomPage(thePref, thePage); } -void XGUI_Preferences::createCustomPage(XGUI_IPrefMgr* thePref, int thePageId) +void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId) { - SUIT_ResourceMgr* aResMgr = XGUI_Preferences::resourceMgr(); + SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); bool isResModified = false; // Make a Tab from each section @@ -147,10 +147,10 @@ void XGUI_Preferences::createCustomPage(XGUI_IPrefMgr* thePref, int thePageId) //********************************************************** //********************************************************** //********************************************************** -class XGUI_PrefMgr: public XGUI_IPrefMgr +class ModuleBase_PrefMgr: public ModuleBase_IPrefMgr { public: - XGUI_PrefMgr(XGUI_PreferencesMgr* theMgr):myMgr(theMgr) {} + ModuleBase_PrefMgr(ModuleBase_PreferencesMgr* theMgr):myMgr(theMgr) {} virtual int addPreference(const QString& theLbl, int pId, SUIT_PreferenceMgr::PrefItemType theType, @@ -167,13 +167,13 @@ public: virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; } private: - XGUI_PreferencesMgr* myMgr; + ModuleBase_PreferencesMgr* myMgr; }; //********************************************************** //********************************************************** //********************************************************** -XGUI_PreferencesDlg::XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent) +ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent) : QDialog(theParent), myIsChanged(false) { @@ -183,7 +183,7 @@ XGUI_PreferencesDlg::XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* main->setMargin(5); main->setSpacing(5); - myPreferences = new XGUI_PreferencesMgr(theResurces, this); + myPreferences = new ModuleBase_PreferencesMgr(theResurces, this); main->addWidget(myPreferences); setFocusProxy(myPreferences); @@ -205,11 +205,11 @@ XGUI_PreferencesDlg::XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* setMinimumSize(800, 200); } -XGUI_PreferencesDlg::~XGUI_PreferencesDlg() +ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() { } -void XGUI_PreferencesDlg::createEditors() +void ModuleBase_PreferencesDlg::createEditors() { int aPage = myPreferences->addItem(tr("Desktop")); myPreferences->setItemIcon(aPage, QIcon(":pictures/view_prefs.png")); @@ -220,11 +220,11 @@ void XGUI_PreferencesDlg::createEditors() aPage = myPreferences->addItem(tr("Module")); myPreferences->setItemIcon(aPage, QIcon(":pictures/module.png")); - XGUI_PrefMgr aMgr(myPreferences); - XGUI_Preferences::createEditContent(&aMgr, aPage); + ModuleBase_PrefMgr aMgr(myPreferences); + ModuleBase_Preferences::createEditContent(&aMgr, aPage); } -void XGUI_PreferencesDlg::createViewerPage(int thePageId) +void ModuleBase_PreferencesDlg::createViewerPage(int thePageId) { int viewTab = myPreferences->addItem(tr("Viewer"), thePageId); @@ -243,7 +243,7 @@ void XGUI_PreferencesDlg::createViewerPage(int thePageId) QString aImgFiles("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)"); int bgId = myPreferences->addItem(tr("Viewer 3d"), bgGroup, SUIT_PreferenceMgr::Background, - XGUI_Preferences::VIEWER_SECTION, "background"); + ModuleBase_Preferences::VIEWER_SECTION, "background"); myPreferences->setItemProperty("gradient_names", gradList, bgId); myPreferences->setItemProperty("gradient_ids", idList, bgId); myPreferences->setItemProperty("texture_enabled", true, bgId); @@ -254,7 +254,7 @@ void XGUI_PreferencesDlg::createViewerPage(int thePageId) myPreferences->setItemProperty("image_formats", aImgFiles, bgId); } -void XGUI_PreferencesDlg::createMenuPage(int thePageId) +void ModuleBase_PreferencesDlg::createMenuPage(int thePageId) { int aMenuTab = myPreferences->addItem(tr("Main menu"), thePageId); @@ -262,28 +262,28 @@ void XGUI_PreferencesDlg::createMenuPage(int thePageId) myPreferences->setItemProperty("columns", 1, aSizeGroup); int aRowsNb = myPreferences->addItem(tr("Number of rows"), aSizeGroup, - SUIT_PreferenceMgr::IntSpin, XGUI_Preferences::MENU_SECTION, + SUIT_PreferenceMgr::IntSpin, ModuleBase_Preferences::MENU_SECTION, "rows_number"); myPreferences->setItemProperty("min", 1, aRowsNb); myPreferences->setItemProperty("max", 6, aRowsNb); } -void XGUI_PreferencesDlg::accept() +void ModuleBase_PreferencesDlg::accept() { myPreferences->store(); myIsChanged = true; // Save custom properties - XGUI_Preferences::updateConfigByResources(); + ModuleBase_Preferences::updateConfigByResources(); QDialog::accept(); } -void XGUI_PreferencesDlg::modified(XGUI_Prefs& theModified) const +void ModuleBase_PreferencesDlg::modified(ModuleBase_Prefs& theModified) const { theModified = myPreferences->modified(); } -void XGUI_PreferencesDlg::onDefault() +void ModuleBase_PreferencesDlg::onDefault() { // reset main resources #ifdef SALOME_750 // until SALOME 7.5.0 is released @@ -293,8 +293,8 @@ void XGUI_PreferencesDlg::onDefault() myPreferences->resourceMgr()->setWorkingMode(aPrev); #endif // reset plugin's resources - XGUI_Preferences::resetConfig(); - XGUI_Preferences::updateResourcesByConfig(); + ModuleBase_Preferences::resetConfig(); + ModuleBase_Preferences::updateResourcesByConfig(); myPreferences->retrieve(); } @@ -302,13 +302,13 @@ void XGUI_PreferencesDlg::onDefault() //********************************************************** //********************************************************** //********************************************************** -void XGUI_PreferencesMgr::changedResources(const ResourceMap& theMap) +void ModuleBase_PreferencesMgr::changedResources(const ResourceMap& theMap) { myModified.clear(); ResourceMap::ConstIterator it; QString sec, param; for (it = theMap.begin(); it != theMap.end(); ++it) { - XGUI_Pref aPref; + ModuleBase_Pref aPref; it.key()->resource(aPref.first, aPref.second); myModified.append(aPref); } diff --git a/src/XGUI/XGUI_Preferences.h b/src/ModuleBase/ModuleBase_Preferences.h similarity index 67% rename from src/XGUI/XGUI_Preferences.h rename to src/ModuleBase/ModuleBase_Preferences.h index 3241d4142..b307a5e24 100644 --- a/src/XGUI/XGUI_Preferences.h +++ b/src/ModuleBase/ModuleBase_Preferences.h @@ -1,12 +1,12 @@ -// File: XGUI_Preferences.h +// File: ModuleBase_Preferences.h // Created: 07 Aug 2014 // Author: Vitaly SMETANNIKOV -#ifndef XGUI_Preferences_H -#define XGUI_Preferences_H +#ifndef ModuleBase_Preferences_H +#define ModuleBase_Preferences_H -#include "XGUI.h" -#include "XGUI_IPrefMgr.h" +#include "ModuleBase.h" +#include "ModuleBase_IPrefMgr.h" #include #include @@ -15,18 +15,18 @@ class SUIT_ResourceMgr; class QWidget; // Pair of values: section name, value name -typedef QPair XGUI_Pref; -typedef QList XGUI_Prefs; +typedef QPair ModuleBase_Pref; +typedef QList ModuleBase_Prefs; //*********************************************************************** /// Class for manipulation with preferences in the application -class XGUI_EXPORT XGUI_Preferences +class MODULEBASE_EXPORT ModuleBase_Preferences { public: static const QString VIEWER_SECTION; static const QString MENU_SECTION; - static bool editPreferences(XGUI_Prefs& theModified); + static bool editPreferences(ModuleBase_Prefs& theModified); /// Returns currently installed resource manager static SUIT_ResourceMgr* resourceMgr(); @@ -49,31 +49,31 @@ class XGUI_EXPORT XGUI_Preferences static void loadCustomProps(); /// - static void createEditContent(XGUI_IPrefMgr* thePref, int thePage); + static void createEditContent(ModuleBase_IPrefMgr* thePref, int thePage); private: /// Creates content of preferences editing widget - static void createCustomPage(XGUI_IPrefMgr* thePref, int thePageId); + static void createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId); static SUIT_ResourceMgr* myResourceMgr; }; //*********************************************************************** /// Manager of preferences -class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr +class MODULEBASE_EXPORT ModuleBase_PreferencesMgr : public SUIT_PreferenceMgr { Q_OBJECT public: - XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent) + ModuleBase_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent) : SUIT_PreferenceMgr(theResource, theParent) { } - virtual ~XGUI_PreferencesMgr() + virtual ~ModuleBase_PreferencesMgr() { } - XGUI_Prefs modified() const + ModuleBase_Prefs modified() const { return myModified; } @@ -82,24 +82,24 @@ Q_OBJECT virtual void changedResources(const ResourceMap& theMap); private: - XGUI_Prefs myModified; + ModuleBase_Prefs myModified; }; //*********************************************************************** /// Dialog box for preferences editing -class XGUI_EXPORT XGUI_PreferencesDlg : public QDialog +class MODULEBASE_EXPORT ModuleBase_PreferencesDlg : public QDialog { Q_OBJECT public: - XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0); - virtual ~XGUI_PreferencesDlg(); + ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0); + virtual ~ModuleBase_PreferencesDlg(); bool isChanged() const { return myIsChanged; } - void modified(XGUI_Prefs& theModified) const; + void modified(ModuleBase_Prefs& theModified) const; public slots: virtual void accept(); @@ -117,7 +117,7 @@ protected slots: /// Create menu properties page in the dialog box void createMenuPage(int thePageId); - XGUI_PreferencesMgr* myPreferences; + ModuleBase_PreferencesMgr* myPreferences; bool myIsChanged; }; diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index baeee345d..1b034d1a3 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -6,11 +6,11 @@ #include #include #include -#include #include #include #include +#include #include #include @@ -45,7 +45,7 @@ NewGeom_EXPORT char* getModuleVersion() } } -class NewGeom_PrefMgr: public XGUI_IPrefMgr +class NewGeom_PrefMgr: public ModuleBase_IPrefMgr { public: NewGeom_PrefMgr(LightApp_Preferences* theMgr, const QString& theModName):myMgr(theMgr), myModName(theModName) {} @@ -83,8 +83,8 @@ NewGeom_Module::NewGeom_Module() myWorkshop = new XGUI_Workshop(this); myProxyViewer = new NewGeom_SalomeViewer(this); - XGUI_Preferences::setResourceMgr(application()->resourceMgr()); - XGUI_Preferences::loadCustomProps(); + ModuleBase_Preferences::setResourceMgr(application()->resourceMgr()); + ModuleBase_Preferences::loadCustomProps(); } //****************************************************** @@ -225,8 +225,8 @@ QtxPopupMgr* NewGeom_Module::popupMgr() //****************************************************** void NewGeom_Module::onDefaultPreferences() { - XGUI_Preferences::resetConfig(); - XGUI_Preferences::updateResourcesByConfig(); + ModuleBase_Preferences::resetConfig(); + ModuleBase_Preferences::updateResourcesByConfig(); LightApp_Preferences* pref = preferences(); if (pref) @@ -399,7 +399,7 @@ void NewGeom_Module::createPreferences() LightApp_Preferences* pref = preferences(); if (!pref) return; - XGUI_Preferences::updateConfigByResources(); + ModuleBase_Preferences::updateConfigByResources(); QString aModName = moduleName(); QtxPreferenceItem* item = pref->findItem(aModName, true ); @@ -412,7 +412,7 @@ void NewGeom_Module::createPreferences() if ( catId == -1 ) return; NewGeom_PrefMgr aMgr(pref, aModName); - XGUI_Preferences::createEditContent(&aMgr, catId); + ModuleBase_Preferences::createEditContent(&aMgr, catId); pref->retrieve(); } diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index 5ceda7960..0e4a7e363 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -3,36 +3,24 @@ SET(CMAKE_AUTOMOC ON) SET(PROJECT_HEADERS XGUI.h - XGUI_Command.h + XGUI_ActionsMgr.h + XGUI_ContextMenuMgr.h + XGUI_DataTreeModel.h XGUI_Displayer.h - XGUI_MainMenu.h - XGUI_MainWindow.h - XGUI_MenuGroupPanel.h - XGUI_Tools.h - XGUI_Workbench.h - XGUI_Workshop.h - XGUI_ViewWindow.h - XGUI_ViewPort.h - XGUI_Viewer.h - XGUI_RubberBand.h - XGUI_Constants.h XGUI_DocumentDataModel.h - XGUI_PartDataModel.h + XGUI_ErrorDialog.h + XGUI_ModuleConnector.h XGUI_ObjectsBrowser.h XGUI_OperationMgr.h - XGUI_DataTreeModel.h - XGUI_SelectionMgr.h - XGUI_SalomeConnector.h - XGUI_ActionsMgr.h - XGUI_ErrorDialog.h - XGUI_ViewerProxy.h - XGUI_PropertyPanel.h - XGUI_ContextMenuMgr.h - XGUI_ModuleConnector.h - XGUI_Selection.h - XGUI_Preferences.h - XGUI_IPrefMgr.h + XGUI_PartDataModel.h + XGUI_PropertyPanel.h XGUI_QtEvents.h + XGUI_SalomeConnector.h + XGUI_Selection.h + XGUI_SelectionMgr.h + XGUI_Tools.h + XGUI_ViewerProxy.h + XGUI_Workshop.h ) SET(PROJECT_AUTOMOC @@ -40,32 +28,22 @@ SET(PROJECT_AUTOMOC ) SET(PROJECT_SOURCES - XGUI_Command.cpp + XGUI_ActionsMgr.cpp + XGUI_ContextMenuMgr.cpp XGUI_Displayer.cpp - XGUI_MainMenu.cpp - XGUI_MainWindow.cpp - XGUI_MenuGroupPanel.cpp - XGUI_Tools.cpp - XGUI_Workbench.cpp - XGUI_Workshop.cpp - XGUI_ViewWindow.cpp - XGUI_ViewPort.cpp - XGUI_Viewer.cpp - XGUI_RubberBand.cpp XGUI_DocumentDataModel.cpp - XGUI_PartDataModel.cpp + XGUI_ErrorDialog.cpp + XGUI_ModuleConnector.cpp XGUI_ObjectsBrowser.cpp XGUI_OperationMgr.cpp - XGUI_SelectionMgr.cpp - XGUI_ActionsMgr.cpp - XGUI_ErrorDialog.cpp - XGUI_ViewerProxy.cpp - XGUI_PropertyPanel.cpp - XGUI_ContextMenuMgr.cpp - XGUI_ModuleConnector.cpp - XGUI_Selection.cpp - XGUI_Preferences.cpp + XGUI_PartDataModel.cpp + XGUI_PropertyPanel.cpp XGUI_QtEvents.cpp + XGUI_Selection.cpp + XGUI_SelectionMgr.cpp + XGUI_Tools.cpp + XGUI_ViewerProxy.cpp + XGUI_Workshop.cpp ) SET(PROJECT_RESOURCES @@ -85,6 +63,7 @@ SET(PROJECT_LIBRARIES Config ModelAPI ModuleBase + AppElements ${QT_LIBRARIES} ${CAS_VIEWER} ${CAS_KERNEL} @@ -123,8 +102,9 @@ INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events ${PROJECT_SOURCE_DIR}/src/ModelAPI ${PROJECT_SOURCE_DIR}/src/GeomAPI ${PROJECT_SOURCE_DIR}/src/ModuleBase - ${PROJECT_SOURCE_DIR}/src/PartSetPlugin +# ${PROJECT_SOURCE_DIR}/src/PartSetPlugin ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI + ${PROJECT_SOURCE_DIR}/src/AppElements ${CAS_INCLUDE_DIRS} ${SUIT_INCLUDE}) diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index 0468a39f7..ab05c8928 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -3,11 +3,12 @@ */ #include "XGUI_ActionsMgr.h" -#include "XGUI_Command.h" #include "XGUI_Workshop.h" #include "XGUI_OperationMgr.h" #include "XGUI_SalomeConnector.h" +#include + #include #include @@ -44,7 +45,7 @@ void XGUI_ActionsMgr::addCommand(QAction* theCmd) return; } myActions.insert(aId, theCmd); - XGUI_Command* aXCmd = dynamic_cast(theCmd); + AppElements_Command* aXCmd = dynamic_cast(theCmd); if (aXCmd) { myNestedActions[aId] = aXCmd->nestedCommands(); } else { @@ -133,7 +134,7 @@ void XGUI_ActionsMgr::updateByDocumentKind() QString aDocKind = QString::fromStdString(aStdDocKind); XGUI_Workshop* aWorkshop = static_cast(parent()); foreach(QAction* eachAction, myActions.values()) { - XGUI_Command* aCmd = dynamic_cast(eachAction); + AppElements_Command* aCmd = dynamic_cast(eachAction); QString aCmdDocKind; if(aCmd) { aCmdDocKind = aCmd->documentKind(); diff --git a/src/XGUI/XGUI_ActionsMgr.h b/src/XGUI/XGUI_ActionsMgr.h index 8df73304d..5d4fbcfd1 100644 --- a/src/XGUI/XGUI_ActionsMgr.h +++ b/src/XGUI/XGUI_ActionsMgr.h @@ -13,7 +13,6 @@ #include #include -class XGUI_Command; class XGUI_Workshop; class XGUI_OperationMgr; class ModuleBase_Operation; diff --git a/src/XGUI/XGUI_Command.cpp b/src/XGUI/XGUI_Command.cpp deleted file mode 100644 index 1194dc454..000000000 --- a/src/XGUI/XGUI_Command.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "XGUI_Command.h" -#include -#include -#include -#include - -XGUI_Command::XGUI_Command(const QString& theId, - const QString& theDocumentKind, - QObject * parent, - bool isCheckable) - : QWidgetAction(parent), - myCheckable(isCheckable), - myDocumentKind(theDocumentKind) -{ - setData(theId); -} - -XGUI_Command::XGUI_Command(const QString& theId, - const QString& theDocumentKind, - const QIcon& icon, - const QString& text, - QObject* parent, - bool isCheckable) - : QWidgetAction(parent), - myCheckable(isCheckable), - myDocumentKind(theDocumentKind) -{ - setIcon(icon); - setText(text); - setData(theId); -} - -XGUI_Command::~XGUI_Command() -{ -} - -const QString& XGUI_Command::documentKind() const -{ - return myDocumentKind; -} - -QWidget* XGUI_Command::createWidget(QWidget* theParent) -{ - if (theParent->inherits("XGUI_MenuGroupPanel")) { - QToolButton* aButton = new QToolButton(theParent); - aButton->setIcon(icon()); - aButton->setText(text()); - QKeySequence aKeys = shortcut(); - QString aToolTip = toolTip(); - if (!aKeys.isEmpty()) { - aToolTip = QString("%1 (%2)").arg(aToolTip).arg(aKeys.toString()); - aButton->setShortcut(aKeys); - } - if (!aToolTip.isEmpty()) { - aButton->setToolTip(aToolTip); - } - aButton->setCheckable(myCheckable); - aButton->setAutoRaise(true); - aButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - aButton->setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT); - aButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - - connect(aButton, SIGNAL(clicked()), this, SLOT(trigger())); - connect(this, SIGNAL(toggled(bool)), aButton, SLOT(setChecked(bool))); - this->setCheckable(myCheckable); - - return aButton; - } - return QWidgetAction::createWidget(theParent); -} - -void XGUI_Command::connectTo(const QObject* theResiver, const char* theSlot) -{ - connect(this, SIGNAL(triggered(bool)), theResiver, theSlot); -} - -const QStringList& XGUI_Command::nestedCommands() const -{ - return myNestedCommands; -} - -void XGUI_Command::setNestedCommands(const QStringList& myUnblockableCommands) -{ - this->myNestedCommands = myUnblockableCommands; -} diff --git a/src/XGUI/XGUI_Command.h b/src/XGUI/XGUI_Command.h deleted file mode 100644 index 0f5aa6271..000000000 --- a/src/XGUI/XGUI_Command.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef XGUI_Command_H -#define XGUI_Command_H - -#include "XGUI.h" -#include - -#define MIN_BUTTON_HEIGHT 25 -#define MIN_BUTTON_WIDTH 60 - -/**\class XGUI_Command - * \ingroup GUI - * \brief Represents a command item in the application menu (Workbench) - */ -class XGUI_EXPORT XGUI_Command : public QWidgetAction -{ -Q_OBJECT - public: - XGUI_Command(const QString& theId, const QString& theDocumentKind, - QObject * parent, bool isCheckable = false); - XGUI_Command(const QString& theId, const QString& theDocumentKind, - const QIcon& icon, const QString& text, QObject* parent, - bool isCheckable = false); - ~XGUI_Command(); - - const QString& documentKind() const; - const QStringList& nestedCommands() const; - void setNestedCommands(const QStringList& myUnblockableCommands); - - //! Connect the command to a slot - virtual void connectTo(const QObject* theResiver, const char* theSlot); - - protected: - //! Creates a command representation widget dependently on parent widget type - virtual QWidget* createWidget(QWidget* theParent); - - private: - bool myCheckable; - - QString myDocumentKind; - //! List of Ids of commands which WILL NOT be blocked when the command is on. - QStringList myNestedCommands; -}; - -#endif diff --git a/src/XGUI/XGUI_Constants.h b/src/XGUI/XGUI_Constants.h deleted file mode 100644 index 5abd457b9..000000000 --- a/src/XGUI/XGUI_Constants.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef XGUI_Constants_H -#define XGUI_Constants_H - -namespace XGUI { - -//! Types of gradient type used in background of Viewer 3d -enum GradientType -{ - NoGradient = -1, - HorizontalGradient, - VerticalGradient, - Diagonal1Gradient, - Diagonal2Gradient, - Corner1Gradient, - Corner2Gradient, - Corner3Gradient, - Corner4Gradient, - LastGradient = Corner4Gradient -}; - -//! Type of rotation point in viewer 3d -enum RotationPointType -{ - GRAVITY, - SELECTED -}; - -//! Type of ribbon rect in Viewer 3d -enum SketchingType -{ - NoSketching, - Rect, - Polygon -}; - -//! View window operations accessible by hot keys -enum HotOperation -{ - PAN, - ZOOM, - ROTATE, - FIT_AREA -}; - -//! Types of view window interactions -enum InteractionStyle -{ - STANDARD, - KEY_FREE -}; - -//! Types of 2d mode in viewer 3d -enum Mode2dType -{ - No2dMode, - XYPlane, - XZPlane, - YZPlane -}; - -//! Types of background in view window -//enum BackgroundMode -//{ -// NoBackground, // no (invalid) background data -// ColorBackground, // single color -// SimpleGradientBackground, // simple two-color gradient -// CustomGradientBackground // custom (complex) gradient -//}; - -//! Texture mode -enum TextureMode -{ - CenterTexture, // center texture - TileTexture, // tile texture - StretchTexture, // stretch texture -}; - -const static char* PROP_PANEL = "property_panel_dock"; -const static char* PROP_PANEL_OK = "property_panel_ok"; -const static char* PROP_PANEL_CANCEL = "property_panel_cancel"; - -} -; - -#endif diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 27e596a48..c4900a688 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -3,11 +3,12 @@ #include "XGUI_ObjectsBrowser.h" #include "XGUI_SelectionMgr.h" #include "XGUI_Displayer.h" -#include "XGUI_MainWindow.h" #include "XGUI_ViewerProxy.h" #include "XGUI_Selection.h" -#include "PartSetPlugin_Part.h" +#include + +//#include "PartSetPlugin_Part.h" #include #include diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h index 075c1e162..a28e104ec 100644 --- a/src/XGUI/XGUI_DataTreeModel.h +++ b/src/XGUI/XGUI_DataTreeModel.h @@ -2,7 +2,6 @@ #define XGUI_DataTreeModel_H #include "XGUI.h" -#include "XGUI_Constants.h" #include #include diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 427d83fbb..7f82b12ae 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -3,10 +3,11 @@ // Author: Natalia ERMOLAEVA #include "XGUI_Displayer.h" -#include "XGUI_Viewer.h" #include "XGUI_Workshop.h" #include "XGUI_ViewerProxy.h" +#include + #include #include #include diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index f0227a67b..250caa87a 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -23,7 +23,6 @@ #include #include -class XGUI_Viewer; class ModelAPI_Feature; class XGUI_Workshop; diff --git a/src/XGUI/XGUI_MainMenu.cpp b/src/XGUI/XGUI_MainMenu.cpp deleted file mode 100644 index d874cc974..000000000 --- a/src/XGUI/XGUI_MainMenu.cpp +++ /dev/null @@ -1,148 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -XGUI_MainMenu::XGUI_MainMenu(XGUI_MainWindow *parent) - : QWidget(parent), - myDesktop(parent) -{ - myGeneralPage = new XGUI_MenuGroupPanel(this); - myGeneralPage->setObjectName("Default"); - myGeneralPage->parentWidget()->setMaximumWidth(200); - myGeneralPage->installEventFilter(this); - myGeneralPage->setFrameStyle(QFrame::StyledPanel); - - myMenuTabs = new QTabWidget(this); - myMenuTabs->setStyleSheet("QTabBar::tab {height: 24px;} QTabWidget:pane {border: 0px;}"); - QHBoxLayout* aMainLayout = new QHBoxLayout(this); - aMainLayout->addWidget(myGeneralPage); - aMainLayout->addWidget(myMenuTabs); - aMainLayout->setContentsMargins(0, 2, 2, 0); - aMainLayout->setSpacing(2); - setLayout(aMainLayout); - updateFromResources(); -} - -XGUI_MainMenu::~XGUI_MainMenu(void) -{ -} - -XGUI_Workbench* XGUI_MainMenu::addWorkbench(const QString& theId, const QString& theTitle) -{ - QString aTitle = theTitle; - if (aTitle.isEmpty()) { - aTitle = tr(theId.toLatin1().constData()); - } - XGUI_Workbench* aPage = new XGUI_Workbench(myMenuTabs); - aPage->setObjectName(theId); - myMenuTabs->addTab(aPage, aTitle); - myWorkbenches.append(aPage); - return aPage; -} - -/* - * Searches for already created workbench with given name. - */ -XGUI_Workbench* XGUI_MainMenu::findWorkbench(const QString& theObjName) const -{ - return myDesktop->findChild(theObjName); -} - -bool XGUI_MainMenu::eventFilter(QObject *theWatched, QEvent *theEvent) -{ - if (theWatched == myGeneralPage) { - if (theEvent->type() == QEvent::Show) { - myGeneralPage->parentWidget()->setMaximumWidth(16777215); - myGeneralPage->removeEventFilter(this); - } - } - return QObject::eventFilter(theWatched, theEvent); -} - -void XGUI_MainMenu::insertConsole(QWidget* theConsole) -{ - int aConsoleTabId = myMenuTabs->addTab(theConsole, "Console"); - - QTabBar* aTabBar = myMenuTabs->findChild(); - QPushButton* aCloseTabButton = new QPushButton(); - aCloseTabButton->setFixedSize(16, 16); - aCloseTabButton->setIcon(QIcon(":pictures/wnd_close.png")); - aCloseTabButton->setFlat(true); - aTabBar->setTabButton(aConsoleTabId, QTabBar::RightSide, aCloseTabButton); - - connect(aCloseTabButton, SIGNAL(clicked()), myDesktop, SLOT(dockPythonConsole())); -} - -void XGUI_MainMenu::removeConsole() -{ - const int kLastTab = myMenuTabs->count() - 1; - myMenuTabs->removeTab(kLastTab); -} - -XGUI_Command* XGUI_MainMenu::feature(const QString& theId) const -{ - XGUI_Command* result; - result = myGeneralPage->feature(theId); - if (!result) { - XGUI_Workbench* aWbn; - foreach (aWbn, myWorkbenches) - { - result = aWbn->feature(theId); - if (result) - break; - } - } - return result; -} - -QList XGUI_MainMenu::features() const -{ - QList aList = myGeneralPage->features(); - XGUI_Workbench* aWbn; - foreach (aWbn, myWorkbenches) - { - aList.append(aWbn->features()); - } - return aList; -} - -int XGUI_MainMenu::menuItemSize() const -{ - const int kDefaultItemSize = 25; - return kDefaultItemSize; -} - -int XGUI_MainMenu::menuHeight() const -{ - // Default group has no tabs above --> one extra row - int rows = menuItemRowsCount() + 1; - const int kMarginsSpacings = 5; - return rows * menuItemSize() + kMarginsSpacings; -} - -int XGUI_MainMenu::menuItemRowsCount() const -{ - static const int kDefaultRowsCount = 3; - int aRowsCount = XGUI_Preferences::resourceMgr()->integerValue(XGUI_Preferences::MENU_SECTION, - "rows_number", kDefaultRowsCount); - return aRowsCount; -} - -void XGUI_MainMenu::updateFromResources() -{ - setFixedHeight(menuHeight()); - repaint(); -} diff --git a/src/XGUI/XGUI_MainMenu.h b/src/XGUI/XGUI_MainMenu.h deleted file mode 100644 index 50c19c8a9..000000000 --- a/src/XGUI/XGUI_MainMenu.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef XGUI_MainMenu_H -#define XGUI_MainMenu_H - -#include "XGUI.h" -#include -#include -#include -#include - -class XGUI_Command; -class XGUI_MainWindow; -class XGUI_Workbench; -class XGUI_MenuGroupPanel; - -class QTabWidget; -class QLabel; -class QAction; -class QDockWidget; -class QEvent; - -/**\class XGUI_MainMenu - * \ingroup GUI - * \brief Class for creation of main menu (set of workbenches) - */ -class XGUI_EXPORT XGUI_MainMenu : public QWidget -{ -Q_OBJECT - - public: - XGUI_MainMenu(XGUI_MainWindow *parent); - virtual ~XGUI_MainMenu(); - - //! Creates and adds a new workbench (menu group) with the given name and returns it. - XGUI_Workbench* addWorkbench(const QString& theId, const QString& theText = ""); - - //! Returns workbench (menu group) by the given name. - XGUI_Workbench* findWorkbench(const QString& theId) const; - - //! Returns General page (predefined workbench) - XGUI_MenuGroupPanel* generalPage() const - { - return myGeneralPage; - } - - //! Rerturns last created workbench in dock widget container - //QDockWidget* getLastDockWindow() const; - - //! Returns already created command by its ID - XGUI_Command* feature(const QString& theId) const; - - //! Returns list of created commands - QList features() const; - - virtual bool eventFilter(QObject *theWatched, QEvent *theEvent); - - //! Displays given console as a tab in the workbench - void insertConsole(QWidget*); - //! Removes already created tab with python console - void removeConsole(); - - //! Defines size of menu item. - //! In the future this value should be extracted from the preferences. - int menuItemSize() const; - //! Defines number of menu item rows. - //! In the future this value should be extracted from the preferences. - int menuItemRowsCount() const; - //! Defines height of the main menu. (Number of rows * row height) - int menuHeight() const; - - void updateFromResources(); - - private: - XGUI_MainWindow* myDesktop; - QTabWidget* myMenuTabs; - XGUI_MenuGroupPanel* myGeneralPage; - QList myWorkbenches; - - QMap myCommandState; -}; - -#endif diff --git a/src/XGUI/XGUI_MainWindow.cpp b/src/XGUI/XGUI_MainWindow.cpp deleted file mode 100644 index 7fc26f0bf..000000000 --- a/src/XGUI/XGUI_MainWindow.cpp +++ /dev/null @@ -1,296 +0,0 @@ -#include "XGUI_MainWindow.h" -#include "XGUI_Constants.h" -#include "XGUI_MainMenu.h" -#include "XGUI_ViewWindow.h" -#include "XGUI_Viewer.h" -#include "XGUI_ObjectsBrowser.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) - : QMainWindow(parent), - myPythonConsole(0), myIsModified(false) -{ - myTitle = tr("New Geom"); - updateTitle(); - createMainMenu(); - QMdiArea* aMdiArea = new QMdiArea(this); - aMdiArea->setContextMenuPolicy(Qt::ActionsContextMenu); - setCentralWidget(aMdiArea); - connect(aMdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, - SLOT(onViewActivated(QMdiSubWindow*))); - - // Create actions of MDI area - QAction* aAction = new QAction(QIcon(":pictures/new_view.png"), tr("Create Window"), aMdiArea); - aMdiArea->addAction(aAction); - connect(aAction, SIGNAL(triggered(bool)), this, SLOT(createSubWindow())); - - aAction = new QAction(QIcon(":pictures/tile_views.png"), tr("Tile"), aMdiArea); - aMdiArea->addAction(aAction); - connect(aAction, SIGNAL(triggered(bool)), aMdiArea, SLOT(tileSubWindows())); - - aAction = new QAction(QIcon(":pictures/cascade_views.png"), tr("Cascade"), aMdiArea); - aMdiArea->addAction(aAction); - connect(aAction, SIGNAL(triggered(bool)), this, SLOT(cascadeWindows())); - - aAction = new QAction(aMdiArea); - aAction->setSeparator(true); - aMdiArea->addAction(aAction); - - myViewer = new XGUI_Viewer(this); - connect(myViewer, SIGNAL(viewCreated(XGUI_ViewWindow*)), this, - SLOT(onViewCreated(XGUI_ViewWindow*))); - connect(myViewer, SIGNAL(deleteView(XGUI_ViewWindow*)), this, - SLOT(onDeleteView(XGUI_ViewWindow*))); -} - -XGUI_MainWindow::~XGUI_MainWindow(void) -{ -} - -//****************************************************** -QMdiArea* XGUI_MainWindow::mdiArea() const -{ - return static_cast(centralWidget()); -} - -//****************************************************** -void XGUI_MainWindow::showPythonConsole() -{ - // TODO: Check why PyConsole can not be created - if (!myPythonConsole) { - myPythonConsole = new PyConsole_EnhConsole(this, new PyConsole_EnhInterp()); - myPythonConsole->setObjectName("PythonConsole"); - undockPythonConsole(); - } - myPythonConsole->parentWidget()->show(); -} - -//****************************************************** -void XGUI_MainWindow::hidePythonConsole() -{ - if (myPythonConsole) - myPythonConsole->parentWidget()->hide(); -} - -//****************************************************** -void XGUI_MainWindow::dockPythonConsole() -{ - if (!myPythonConsole) - return; - myMenuBar->removeConsole(); - QDockWidget* aDock = new QDockWidget(this); - aDock->setFeatures(QDockWidget::AllDockWidgetFeatures | QDockWidget::DockWidgetVerticalTitleBar); - aDock->setAllowedAreas( - Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea); - aDock->setMinimumHeight(0); - aDock->setWindowTitle("Console"); - aDock->setWidget(myPythonConsole); - addDockWidget(Qt::BottomDockWidgetArea, aDock); - // Undock python console if widget is closed... - CloseEventWatcher* aWatcher = new CloseEventWatcher(aDock); - connect(aWatcher, SIGNAL(widgetClosed()), this, SLOT(undockPythonConsole())); - aDock->installEventFilter(aWatcher); -} - -void XGUI_MainWindow::undockPythonConsole() -{ - if (!myPythonConsole) - return; - QDockWidget* aDock = qobject_cast(myPythonConsole->parentWidget()); - //When the application starts console will be displayed as - //a wokbench tab, so there is no dock yet - if (aDock) { - aDock->hide(); - aDock->setWidget(NULL); - aDock->deleteLater(); - } - myMenuBar->insertConsole(myPythonConsole); -} - -//****************************************************** -void XGUI_MainWindow::createSubWindow() -{ - viewer()->createView(); -} - -//****************************************************** -void XGUI_MainWindow::cascadeWindows() -{ - QMdiArea* aMdiArea = static_cast(centralWidget()); - QList aWindows = aMdiArea->subWindowList(); - - QSize aSize = aMdiArea->size(); - QRect aRect = aMdiArea->geometry(); - const int aOffset = 30; - int i = 0, j = 0; - int x, y; - int w = aSize.width() / 2; - int h = aSize.height() / 2; - QMdiSubWindow* aLastWnd; - foreach(QMdiSubWindow* aWnd, aWindows) - { - aWnd->showNormal(); - aWnd->raise(); - x = aOffset * i; - if ((x + w) > aSize.width()) { - x = 0; - i = 0; - } - y = aOffset * j; - if ((y + h) > aSize.height()) { - y = 0; - j = 0; - } - aWnd->setGeometry(QStyle::visualRect(aWnd->layoutDirection(), aRect, QRect(x, y, w, h))); - i++; - j++; - viewer()->onWindowActivated(aWnd); - aLastWnd = aWnd; - QApplication::processEvents(); - } - aLastWnd->setFocus(); -} - -void XGUI_MainWindow::onViewCreated(XGUI_ViewWindow* theWindow) -{ - QWidget* aSubWindow = theWindow->parentWidget(); - QWidget* aMDIWidget = centralWidget(); - - QAction* aAction = new QAction(aSubWindow->windowTitle(), aMDIWidget); - aAction->setCheckable(true); - connect(aAction, SIGNAL(triggered(bool)), this, SLOT(activateView())); - aMDIWidget->addAction(aAction); - - QList aActions = aMDIWidget->actions(); - foreach(QAction* aAct, aActions) - { - if (aAct->isCheckable()) - aAct->setChecked(false); - } - aAction->setChecked(true); -} - -void XGUI_MainWindow::onDeleteView(XGUI_ViewWindow* theWindow) -{ - QWidget* aSubWindow = theWindow->parentWidget(); - QString aTitle = aSubWindow->windowTitle(); - QWidget* aMDIWidget = centralWidget(); - QList aActions = aMDIWidget->actions(); - - QAction* aDelAct = 0; - foreach(QAction* aAct, aActions) - { - if (aAct->text() == aTitle) { - aDelAct = aAct; - break; - } - } - aMDIWidget->removeAction(aDelAct); -} - -void XGUI_MainWindow::activateView() -{ - QAction* aAction = static_cast(sender()); - QString aWndTitle = aAction->text(); - QMdiArea* aMdiArea = static_cast(centralWidget()); - - QList aWndList = aMdiArea->subWindowList(); - QMdiSubWindow* aTargetView = 0; - foreach(QMdiSubWindow* aWnd, aWndList) - { - if (aWnd->windowTitle() == aWndTitle) { - aWnd->raise(); - aWnd->activateWindow(); - aTargetView = aWnd; - break; - } - } - QApplication::processEvents(); - if (aTargetView) - QTimer::singleShot(20, aTargetView, SLOT(setFocus())); -} - -void XGUI_MainWindow::onViewActivated(QMdiSubWindow* theSubWnd) -{ - if (!theSubWnd) - return; - QMdiArea* aMdiArea = static_cast(centralWidget()); - QString aWndTitle = theSubWnd->windowTitle(); - QList aActionList = aMdiArea->actions(); - foreach(QAction* aAct, aActionList) - { - if (aAct->isCheckable()) - aAct->setChecked(aAct->text() == aWndTitle); - } -} - -void XGUI_MainWindow::closeEvent(QCloseEvent * event) -{ - emit exitKeySequence(); - event->ignore(); -} - -void XGUI_MainWindow::createMainMenu() -{ - myMenuBar = new XGUI_MainMenu(this); - QDockWidget* aMenuDock = new QDockWidget(this); - aMenuDock->setWidget(myMenuBar); - aMenuDock->setAllowedAreas(Qt::TopDockWidgetArea); - aMenuDock->setFeatures(QDockWidget::DockWidgetVerticalTitleBar); - aMenuDock->setWindowTitle(tr("General")); - addDockWidget(Qt::TopDockWidgetArea, aMenuDock); -} - - -void XGUI_MainWindow::updateTitle() -{ - QString aTitle = myTitle; - if (!myCurrentDir.isNull()) - aTitle += " - " + myCurrentDir; - if (myIsModified) - aTitle += "*"; - setWindowTitle(aTitle); -} - -void XGUI_MainWindow::setCurrentDir(const QString& theDir, bool toUpdate) -{ - myCurrentDir = theDir; - if (toUpdate) - updateTitle(); -} - -void XGUI_MainWindow::setModifiedState(bool isModified, bool toUpdate) -{ - myIsModified = isModified; - if (toUpdate) - updateTitle(); -} - -CloseEventWatcher::CloseEventWatcher(QObject* theParent) - : QObject(theParent) -{ -} - -bool CloseEventWatcher::eventFilter(QObject *obj, QEvent *event) -{ - if (event->type() == QEvent::Close) { - emit widgetClosed(); - event->ignore(); - return true; - } else { - // standard event processing - return QObject::eventFilter(obj, event); - } -} - diff --git a/src/XGUI/XGUI_MainWindow.h b/src/XGUI/XGUI_MainWindow.h deleted file mode 100644 index 3294f58ac..000000000 --- a/src/XGUI/XGUI_MainWindow.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef XGUI_MAINWINDOW_H -#define XGUI_MAINWINDOW_H - -#include "XGUI.h" -#include - -class XGUI_MainMenu; -class XGUI_Viewer; -class XGUI_ActionsMgr; -class XGUI_ViewWindow; -class QMdiArea; -class QMdiSubWindow; -class PyConsole_EnhConsole; -class QCloseEvent; - -/**\class XGUI_MainWindow - * \ingroup GUI - * \brief Main window of the application (Desktop). - * It contains: Object Browser, 3d Viewer, Python console, property panel, main menu - */ -class XGUI_EXPORT XGUI_MainWindow : public QMainWindow -{ -Q_OBJECT - - public: - XGUI_MainWindow(QWidget* parent = 0); - virtual ~XGUI_MainWindow(); - - //! Returns main menu object - XGUI_MainMenu* menuObject() const - { - return myMenuBar; - } - - //! Returns MDI area - QMdiArea* mdiArea() const; - - //! Returns 3d viewer - XGUI_Viewer* viewer() const - { - return myViewer; - } - - public slots: - void showPythonConsole(); - void hidePythonConsole(); - //! Python console can be a dock widget - void dockPythonConsole(); - //! or can be a tab in the main menu. - void undockPythonConsole(); - - void createSubWindow(); - - /// Add name of current directory into title of desktop window - void setCurrentDir(const QString& theDir, bool toUpdate = true); - - /// Add asterisk to a title of the window - void setModifiedState(bool isModified, bool toUpdate = true); - - /// Returns current state of modification - bool isModifiedState() const { return myIsModified; } - - void updateTitle(); - - private slots: - void cascadeWindows(); - void onViewCreated(XGUI_ViewWindow* theWindow); - void onDeleteView(XGUI_ViewWindow* theWindow); - void activateView(); - void onViewActivated(QMdiSubWindow* theSubWnd); - -signals: - void exitKeySequence(); - - protected: - void closeEvent(QCloseEvent* event); - void createMainMenu(); - - private: - XGUI_MainMenu* myMenuBar; - XGUI_Viewer* myViewer; - - QString myTitle; - QString myCurrentDir; - bool myIsModified; - - PyConsole_EnhConsole* myPythonConsole; -}; - -class XGUI_EXPORT CloseEventWatcher : public QObject -{ -Q_OBJECT - - public: - CloseEventWatcher(QObject* theParent); - -signals: - void widgetClosed(); - - protected: - bool eventFilter(QObject *obj, QEvent *); - -}; - -#endif diff --git a/src/XGUI/XGUI_MenuGroupPanel.cpp b/src/XGUI/XGUI_MenuGroupPanel.cpp deleted file mode 100644 index a1883f26b..000000000 --- a/src/XGUI/XGUI_MenuGroupPanel.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "XGUI_MenuGroupPanel.h" -#include "XGUI_Command.h" - -#include -#include -#include -#include - -#include -#include - -XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent) - : QFrame(parent), - myNewRow(0), - myNewCol(0), - myMaxRow(1) -{ - myLayout = new QGridLayout(this); - myLayout->setSpacing(0); - myLayout->setMargin(0); - myLayout->setContentsMargins(0, 0, 0, 0); - setFrameShape(QFrame::NoFrame); -} - -void XGUI_MenuGroupPanel::addCommand(XGUI_Command* theAction) -{ - myActions.append(theAction); - QWidget* aWdg = theAction->requestWidget(this); - myActionWidget.append(aWdg); - addWidget(aWdg); -} - -void XGUI_MenuGroupPanel::placeWidget(QWidget* theWgt) -{ - if (myMaxRow == myNewRow) { - myNewRow = 0; - myNewCol++; - } - myLayout->addWidget(theWgt, myNewRow, myNewCol); - myLayout->setRowStretch(myNewRow, 0); - myNewRow++; -} - -void XGUI_MenuGroupPanel::addWidget(QWidget* theWgt) -{ - placeWidget(theWgt); -} - -void XGUI_MenuGroupPanel::resizeEvent(QResizeEvent* theEvent) -{ - QWidget::resizeEvent(theEvent); - if (myActions.size() == 0) - return; - - int aH = theEvent->size().height(); - int aMaxRow = (int) floor(double(aH / MIN_BUTTON_HEIGHT)); - if (aMaxRow == myMaxRow) - return; - - myMaxRow = aMaxRow; - myNewRow = 0; - myNewCol = 0; - foreach(QWidget* eachWidget, myActionWidget) - { - placeWidget(eachWidget); - } - myLayout->setRowStretch(myMaxRow + 1, 1); -} - -XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, - const QString& theTip, - const QString& theTitle, - const QIcon& theIcon, - const QKeySequence& theKeys) -{ - return addFeature(theId, theTip, theTitle, theIcon, QString(), theKeys, false); -} - -XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, - const QString& theTitle, - const QString& theTip, - const QIcon& theIcon, - const QString& theDocumentKind, - const QKeySequence& theKeys, - bool isCheckable) -{ - XGUI_Command* aCommand = new XGUI_Command(theId, theDocumentKind, theIcon, - theTitle, this, isCheckable); - aCommand->setToolTip(theTip); - if (!theKeys.isEmpty()) { - aCommand->setShortcut(theKeys); - } - addCommand(aCommand); - return aCommand; -} - -XGUI_Command* XGUI_MenuGroupPanel::feature(const QString& theId) const -{ - foreach (XGUI_Command* aCmd, myActions) - { - if (aCmd->data().toString() == theId) - return aCmd; - } - return 0; -} diff --git a/src/XGUI/XGUI_MenuGroupPanel.h b/src/XGUI/XGUI_MenuGroupPanel.h deleted file mode 100644 index 76de10371..000000000 --- a/src/XGUI/XGUI_MenuGroupPanel.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef XGUI_MenuGroupPanel_H -#define XGUI_MenuGroupPanel_H - -#include "XGUI.h" -#include -#include - -class XGUI_Command; -class QGridLayout; - -/**\class XGUI_MenuGroupPanel - * \ingroup GUI - * \brief Represents a one group in a page of main menu (workbench) - */ -class XGUI_EXPORT XGUI_MenuGroupPanel : public QFrame -{ -Q_OBJECT - - public: - explicit XGUI_MenuGroupPanel(QWidget *parent = 0); - - //! Adding a new feature (Command) in the group - XGUI_Command* addFeature(const QString& theId, - const QString& theTip, - const QString& theTitle, - const QIcon& theIcon, - const QKeySequence& theKeys = QKeySequence()); - - XGUI_Command* addFeature(const QString& theId, - const QString& theTip, - const QString& theTitle, - const QIcon& theIcon, - const QString& theDocumentKind = QString(), - const QKeySequence& theKeys = QKeySequence(), - bool isCheckable = false); - - //! Returns already created command by its ID - XGUI_Command* feature(const QString& theId) const; - - //! Returns list of created commands - QList features() const - { - return myActions; - } - - protected: - virtual void resizeEvent(QResizeEvent *theEvent); - - private: - void addWidget(QWidget* theWgt); - void placeWidget(QWidget* theWgt); - void addCommand(XGUI_Command* theAction); - - QList myActions; - QWidgetList myActionWidget; - - QGridLayout* myLayout; - int myNewRow; - int myNewCol; - int myMaxRow; -}; - -#endif diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 001224625..b94bb1903 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -6,7 +6,7 @@ */ #include -#include +//#include #include #include @@ -29,7 +29,7 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent) { this->setWindowTitle(tr("Property Panel")); QAction* aViewAct = this->toggleViewAction(); - this->setObjectName(XGUI::PROP_PANEL); + this->setObjectName(PROP_PANEL); setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); QWidget* aContent = new QWidget(this); @@ -49,14 +49,14 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent) aBtnLay->addWidget(aBtn); aBtnLay->addStretch(1); aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm); - aBtn->setObjectName(XGUI::PROP_PANEL_OK); + aBtn->setObjectName(PROP_PANEL_OK); aBtn->setToolTip(tr("Ok")); aBtn->setFlat(true); aBtnLay->addWidget(aBtn); aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm); aBtn->setToolTip(tr("Cancel")); - aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL); + aBtn->setObjectName(PROP_PANEL_CANCEL); aBtn->setFlat(true); aBtn->setShortcut(QKeySequence(Qt::Key_Escape)); aBtnLay->addWidget(aBtn); @@ -115,8 +115,8 @@ void XGUI_PropertyPanel::setModelWidgets(const QList& t if (!aControls.empty()) { QWidget* aLastControl = aControls.last(); - QPushButton* anOkBtn = findChild(XGUI::PROP_PANEL_OK); - QPushButton* aCancelBtn = findChild(XGUI::PROP_PANEL_CANCEL); + QPushButton* anOkBtn = findChild(PROP_PANEL_OK); + QPushButton* aCancelBtn = findChild(PROP_PANEL_CANCEL); setTabOrder(aLastControl, anOkBtn); setTabOrder(anOkBtn, aCancelBtn); @@ -195,7 +195,7 @@ void XGUI_PropertyPanel::activateNextWidget() void XGUI_PropertyPanel::setAcceptEnabled(bool isEnabled) { - QPushButton* anOkBtn = findChild(XGUI::PROP_PANEL_OK); + QPushButton* anOkBtn = findChild(PROP_PANEL_OK); anOkBtn->setEnabled(isEnabled); } diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index 28c624618..6e3b72ef4 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -18,10 +18,16 @@ class QKeyEvent; class QVBoxLayout; +const static char* PROP_PANEL = "property_panel_dock"; +const static char* PROP_PANEL_OK = "property_panel_ok"; +const static char* PROP_PANEL_CANCEL = "property_panel_cancel"; + class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel { Q_OBJECT public: + + XGUI_PropertyPanel(QWidget* theParent); virtual ~XGUI_PropertyPanel(); diff --git a/src/XGUI/XGUI_RubberBand.cpp b/src/XGUI/XGUI_RubberBand.cpp deleted file mode 100644 index 390368256..000000000 --- a/src/XGUI/XGUI_RubberBand.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include "XGUI_RubberBand.h" - -#include -#include -#include -#include -#include -#include -#include - -/*! - \class QtxAbstractRubberBand - \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection. - - Currently this class does not support Style functionality in full. - */ - -/*! - \brief Constructor - \param theParent parent widget - */ - -XGUI_AbstractRubberBand::XGUI_AbstractRubberBand(QWidget* theParent) - : QWidget(theParent), - myPoints(), - myIsClosed(false) -{ - setAttribute(Qt::WA_TransparentForMouseEvents); -#ifndef WIN32 - setAttribute(Qt::WA_NoSystemBackground); -#endif //WIN32 - setAttribute(Qt::WA_WState_ExplicitShowHide); - setVisible(false); - theParent->installEventFilter(this); - setGeometry(QRect(QPoint(0, 0), theParent->size())); -} - -/*! - \brief Destructor - */ -XGUI_AbstractRubberBand::~XGUI_AbstractRubberBand() -{ -} - -void XGUI_AbstractRubberBand::clearGeometry() -{ - myPoints.clear(); -} - -bool XGUI_AbstractRubberBand::isClosed() -{ - return myIsClosed; -} - -void XGUI_AbstractRubberBand::paintEvent(QPaintEvent* theEvent) -{ - if (!myPoints.empty()) { - QPixmap tiledPixmap(16, 16); - - QPainter pixmapPainter(&tiledPixmap); - pixmapPainter.setPen(Qt::NoPen); - pixmapPainter.setBrush(QBrush(Qt::black, Qt::Dense4Pattern)); - pixmapPainter.setBackground(QBrush(Qt::white)); - pixmapPainter.setBackgroundMode(Qt::OpaqueMode); - pixmapPainter.drawRect(0, 0, tiledPixmap.width(), tiledPixmap.height()); - pixmapPainter.end(); - // ### workaround for borked XRENDER - tiledPixmap = QPixmap::fromImage(tiledPixmap.toImage()); - - QPainter aPainter(this); - aPainter.setRenderHint(QPainter::Antialiasing); - QRect r = myPoints.boundingRect(); - aPainter.setClipRegion(r.normalized().adjusted(-1, -1, 2, 2)); - aPainter.drawTiledPixmap(0, 0, width(), height(), tiledPixmap); - - aPainter.end(); - } -} - -void XGUI_AbstractRubberBand::showEvent(QShowEvent* theEvent) -{ - raise(); - theEvent->ignore(); -} - -void XGUI_AbstractRubberBand::moveEvent(QMoveEvent*) -{ -} - -void XGUI_AbstractRubberBand::resizeEvent(QResizeEvent*) -{ -} - -bool XGUI_AbstractRubberBand::eventFilter(QObject* obj, QEvent* e) -{ - if (obj && obj == parent() && e->type() == QEvent::Resize) { - QWidget* p = (QWidget*) parent(); - setGeometry(QRect(QPoint(0, 0), p->size())); - } - return QWidget::eventFilter(obj, e); -} - -QRegion createRegion(const QPointF& p1, const QPointF& p2) -{ - if (p1 == p2) - return QRegion(); - - QLineF n = QLineF(p1, p2).normalVector(); //.unitVector(); - n.setLength(1); - n.translate(p1 * -1); - QPointF nPoint = n.p2(); - - QPolygonF p; - p << p1 + nPoint << p2 + nPoint << p2 - nPoint << p1 - nPoint << p1 + nPoint; - - return QRegion(p.toPolygon()); -} - -void XGUI_AbstractRubberBand::updateMask() -{ - QRegion r; - - QVectorIterator it(myPoints); - while (it.hasNext()) { - QPoint p = it.next(); - if (!it.hasNext()) - break; - - QPoint np = it.peekNext(); - - if (p == np) - continue; - - r += createRegion(p, np); - } - - if (isClosed()) - r += createRegion(myPoints.last(), myPoints.first()); - - if (!r.isEmpty()) - setMask(r); -} - -//********************************************************** -XGUI_RectRubberBand::XGUI_RectRubberBand(QWidget* parent) - : XGUI_AbstractRubberBand(parent) -{ - myPoints.resize(4); - myIsClosed = true; -} - -XGUI_RectRubberBand::~XGUI_RectRubberBand() -{ -} - -void XGUI_RectRubberBand::initGeometry(const QRect& theRect) -{ - myPoints.clear(); - myPoints << theRect.topLeft() << theRect.topRight() << theRect.bottomRight() - << theRect.bottomLeft(); - //setMask( QRegion( myPoints ) ); - updateMask(); -} - -void XGUI_RectRubberBand::setStartPoint(const QPoint& thePoint) -{ - myPoints[0] = thePoint; - myPoints[1].setY(thePoint.y()); - myPoints[3].setX(thePoint.x()); - updateMask(); -} - -void XGUI_RectRubberBand::setEndPoint(const QPoint& thePoint) -{ - myPoints[2] = thePoint; - myPoints[1].setX(thePoint.x()); - myPoints[3].setY(thePoint.y()); - updateMask(); -} - -void XGUI_RectRubberBand::clearGeometry() -{ - QMutableVectorIterator i(myPoints); - while (i.hasNext()) { - i.next(); - i.setValue(QPoint(-1, -1)); - } -} - -//********************************************************** -XGUI_PolyRubberBand::XGUI_PolyRubberBand(QWidget* parent) - : XGUI_AbstractRubberBand(parent) -{ -} - -XGUI_PolyRubberBand::~XGUI_PolyRubberBand() -{ -} - -void XGUI_PolyRubberBand::initGeometry(const QPolygon& thePoints) -{ - myPoints = thePoints; - updateMask(); -} - -void XGUI_PolyRubberBand::initGeometry(const QPoint& thePoint) -{ - myPoints.clear(); - myPoints << thePoint; - updateMask(); -} - -void XGUI_PolyRubberBand::addNode(const QPoint& thePoint) -{ - myPoints << thePoint; - updateMask(); -} - -void XGUI_PolyRubberBand::replaceLastNode(const QPoint& thePoint) -{ - if (!myPoints.empty()) { - myPoints.pop_back(); - myPoints << thePoint; - updateMask(); - } -} - -void XGUI_PolyRubberBand::removeLastNode() -{ - if (!myPoints.empty()) { - myPoints.pop_back(); - updateMask(); - } -} - -void XGUI_PolyRubberBand::setClosed(bool theFlag) -{ - if (myIsClosed != theFlag) { - myIsClosed = theFlag; - updateMask(); - } -} diff --git a/src/XGUI/XGUI_RubberBand.h b/src/XGUI/XGUI_RubberBand.h deleted file mode 100644 index e31eafdee..000000000 --- a/src/XGUI/XGUI_RubberBand.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef XGUI_RubberBand_H -#define XGUI_RubberBand_H - -#include "XGUI.h" -#include - -/*! - \class XGUI_AbstractRubberBand - \ingroup GUI - \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection. - - Currently this class does not support Style functionality in full. - */ -class XGUI_EXPORT XGUI_AbstractRubberBand : public QWidget -{ -Q_OBJECT - protected: - XGUI_AbstractRubberBand(QWidget*); - - public: - virtual ~XGUI_AbstractRubberBand(); - - virtual void clearGeometry(); - - bool isClosed(); - - protected: - virtual void paintEvent(QPaintEvent*); - virtual void showEvent(QShowEvent*); - virtual void moveEvent(QMoveEvent*); - virtual void resizeEvent(QResizeEvent*); - - virtual bool eventFilter(QObject*, QEvent*); - - virtual void updateMask(); - - protected: - QPolygon myPoints; - - bool myIsClosed; -}; - -/*! - \class XGUI_RectRubberBand - \ingroup GUI - \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection. - - Redefinition for rectangular rubber band - */ -class XGUI_RectRubberBand : public XGUI_AbstractRubberBand -{ -Q_OBJECT - - public: - XGUI_RectRubberBand(QWidget*); - virtual ~XGUI_RectRubberBand(); - - void initGeometry(const QRect&); - void setStartPoint(const QPoint&); - void setEndPoint(const QPoint&); - - virtual void clearGeometry(); -}; - -class XGUI_PolyRubberBand : public XGUI_AbstractRubberBand -{ -Q_OBJECT - - public: - XGUI_PolyRubberBand(QWidget*); - virtual ~XGUI_PolyRubberBand(); - - void initGeometry(const QPolygon&); - void initGeometry(const QPoint&); - - void addNode(const QPoint&); - void replaceLastNode(const QPoint&); - void removeLastNode(); - - void setClosed(bool); -}; - -#endif diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 25bfd7030..e7818bd91 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -1,13 +1,14 @@ #include "XGUI_SelectionMgr.h" #include "XGUI_Workshop.h" -#include "XGUI_MainWindow.h" #include "XGUI_ObjectsBrowser.h" #include "XGUI_SalomeConnector.h" #include "XGUI_ViewerProxy.h" #include "XGUI_Displayer.h" #include "XGUI_Selection.h" +#include + #include #include #include diff --git a/src/XGUI/XGUI_Tools.cpp b/src/XGUI/XGUI_Tools.cpp index 84e43abf3..8b59da137 100644 --- a/src/XGUI/XGUI_Tools.cpp +++ b/src/XGUI/XGUI_Tools.cpp @@ -33,12 +33,6 @@ QString file(const QString& path, bool withExt) return QFileInfo(fPath).completeBaseName(); } -//****************************************************************** -QString extension(const QString& path, bool full) -{ - return full ? QFileInfo(path).completeSuffix() : QFileInfo(path).suffix(); -} - //****************************************************************** QString addSlash(const QString& path) { @@ -49,12 +43,6 @@ QString addSlash(const QString& path) return res; } -//****************************************************************** -QRect makeRect(const int x1, const int y1, const int x2, const int y2) -{ - return QRect(qMin(x1, x2), qMin(y1, y2), qAbs(x2 - x1), qAbs(y2 - y1)); -} - //****************************************************************** bool isModelObject(FeaturePtr theFeature) { diff --git a/src/XGUI/XGUI_Tools.h b/src/XGUI/XGUI_Tools.h index cc80b28be..bea9b8eb6 100644 --- a/src/XGUI/XGUI_Tools.h +++ b/src/XGUI/XGUI_Tools.h @@ -33,16 +33,6 @@ QString XGUI_EXPORT dir(const QString& path, bool isAbs = true); */ QString XGUI_EXPORT file(const QString& path, bool withExt = true); -/*! - \brief Return extension part of the file path. - - \param path file path - \param full if true complete extension (all extensions, dot separated) - is returned, otherwise (default) only last extension is returned - \return extension part of the file path - */ -QString XGUI_EXPORT extension(const QString& path, bool full = false); - /*! \brief Add a slash (platform-specific) to the end of \a path if it is not already there. @@ -51,12 +41,6 @@ QString XGUI_EXPORT extension(const QString& path, bool full = false); */ QString XGUI_EXPORT addSlash(const QString& path); -/*! - Creates a rect with TopLeft = ( min(x1,x2), min(y1,y2) ) - and BottomRight = ( TopLeft + (x2-x1)(y2-y1) ) - */ -QRect XGUI_EXPORT makeRect(const int x1, const int y1, const int x2, const int y2); - /// The model concerning tools /*! diff --git a/src/XGUI/XGUI_ViewBackground.cpp b/src/XGUI/XGUI_ViewBackground.cpp deleted file mode 100644 index c7ac791cc..000000000 --- a/src/XGUI/XGUI_ViewBackground.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include "XGUI_ViewBackground.h" - -/*! - \brief Default constructor. - Creates invalid background data. - */ -XGUI_ViewBackground::XGUI_ViewBackground() - : myTextureMode(XGUI::CenterTexture), - myGradientType(XGUI::NoGradient), - myTextureShown(false) -{ - setMode(XGUI::NoBackground); -} - -/*! - \brief Constructor. - Creates background data initialized with the specified color - \param c color - */ -XGUI_ViewBackground::XGUI_ViewBackground(const QColor& theColor) - : myTextureMode(XGUI::CenterTexture), - myGradientType(XGUI::NoGradient), - myTextureShown(false) -{ - setColor(theColor); -} - -/*! - \brief Constructor. - Creates background data initialized with the specified two-color gradient - \param type gradient type identifier - \param c1 first gradient color - \param c2 second gradient color - \note the interpretation of the gradient identifier should be done in the calling code - */ -XGUI_ViewBackground::XGUI_ViewBackground(XGUI::GradientType type, const QColor& c1, - const QColor& c2) - : myTextureMode(XGUI::CenterTexture), - myGradientType(XGUI::NoGradient), - myTextureShown(false) -{ - setGradient(type, c1, c2); -} - -/*! - \brief Constructor. - Creates background data initialized with the arbirtary gradient data - \param grad gradient data - */ -XGUI_ViewBackground::XGUI_ViewBackground(const QGradient& grad) - : myTextureMode(XGUI::CenterTexture), - myGradientType(XGUI::NoGradient), - myTextureShown(false) -{ - setGradient(grad); -} - -/*! - \brief Destructor. - */ -XGUI_ViewBackground::~XGUI_ViewBackground() -{ -} - -/*! - \brief Compares two background data objects - */ -bool XGUI_ViewBackground::operator==(const XGUI_ViewBackground& other) const -{ - return (myMode == other.myMode) && (myTextureMode == other.myTextureMode) - && (myFileName == other.myFileName) && (myColors == other.myColors) - && (myGradientType == other.myGradientType) && (myGradient == other.myGradient) - && (myTextureShown == other.myTextureShown); -} - -/*! - \brief Returns \c false if background data is not set (invalid) - \return \c true if background data is valid or \c false otherwise - \sa mode() - */ -bool XGUI_ViewBackground::isValid() const -{ - return myMode != XGUI::NoBackground; -} - -/*! - \brief Get file name used as a texture image - \return path to the texture image file - \sa setTexture(), setTextureShown() - */ -XGUI::TextureMode XGUI_ViewBackground::texture(QString& fileName) const -{ - fileName = myFileName; - return myTextureMode; -} - -/*! - \brief Set file name to be used as a texture image. - - \note To show texture image on the background it is necessary to call additionally - setTextureShown() method. - - \param fileName path to the texture image file name - \param m texture mode (CenterTexture by default) - \sa texture(), setTextureShown() - */ -void XGUI_ViewBackground::setTexture(const QString& fileName, const XGUI::TextureMode m) -{ - myFileName = fileName; - myTextureMode = m; -} - -/*! - \brief Check if "show texture" flag is switched on - \return \c true if "show texture" flag is set or \c false otherwise - \sa setTextureShown(), texture() - */ -bool XGUI_ViewBackground::isTextureShown() const -{ - return myTextureShown; -} - -/*! - \brief Specify if texture should be shown on the background or no. - \param on \c true if texture should be shown or \c false otherwise - \sa isTextureShown(), texture() - */ -void XGUI_ViewBackground::setTextureShown(bool on) -{ - myTextureShown = on; -} - -/*! - \brief Get background color. Returns null QColor if color is not set - \return solid background color - \sa setColor(), mode() - */ -QColor XGUI_ViewBackground::color() const -{ - return myColors.count() > 0 ? myColors[0] : QColor(); -} - -/*! - \brief Set background color and switch to the ColorBackground mode - \param c color - \sa color(), mode() - */ -void XGUI_ViewBackground::setColor(const QColor& c) -{ - myColors.clear(); - myColors << c; - setMode(XGUI::ColorBackground); -} - -/*! - \brief Get simple gradient data. - Returns -1 and null QColor for \a c1 and \a c2 if gradient data is not set - \param c1 first gradient color is returned via this parameter - \param c2 second gradient color is returned via this parameter - \return current two-colored gradient mode type identifier - \note the interpretation of the gradient identifier should be done in the calling code - \sa setGradient(int, const QColor&, const QColor&), mode() - */ -int XGUI_ViewBackground::gradient(QColor& c1, QColor& c2) const -{ - c1 = myColors.count() > 0 ? myColors[0] : QColor(); - c2 = myColors.count() > 1 ? myColors[1] : (myColors.count() > 0 ? myColors[0] : QColor()); - return myGradientType; -} - -/*! - \brief Set simple background gradient data and switch to the SimpleGradientBackground mode - \param type two-colored gradient mode type identifier - \param c1 first gradient color is returned via this parameter - \param c2 second gradient color is returned via this parameter - \note the interpretation of the gradient identifier should be done in the calling code - \sa gradient(QColor&, QColor&), mode() - */ -void XGUI_ViewBackground::setGradient(XGUI::GradientType type, const QColor& c1, const QColor& c2) -{ - myColors.clear(); - myColors << c1 << c2; - myGradientType = type; - setMode(XGUI::SimpleGradientBackground); -} - -/*! - \brief Get complex gradient data. - Returns QGradient of QGradient::NoGradient if gradient data is not set - \note This function does not transform simple gradient data set with - setGradient( const QString&, const QColor&, const QColor& ) to QGradient class - \return gradient data - \sa setGradient(const QGradient&), mode() - */ -const QGradient* XGUI_ViewBackground::gradient() const -{ - return &myGradient; -} - -/*! - \brief Set complex background gradient data and switch to the CustomGradientBackground mode - \param grad gradient data (QLinearGradient, QRadialGradient or QConicalGradient) - \sa gradient(), mode() - */ -void XGUI_ViewBackground::setGradient(const QGradient& grad) -{ - myGradient = grad; - setMode(XGUI::CustomGradientBackground); -} diff --git a/src/XGUI/XGUI_ViewBackground.h b/src/XGUI/XGUI_ViewBackground.h deleted file mode 100644 index 74528490a..000000000 --- a/src/XGUI/XGUI_ViewBackground.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef XGUI_ViewBackground_H -#define XGUI_ViewBackground_H - -#include "XGUI.h" -#include "XGUI_Constants.h" - -#include -#include -#include -#include - -typedef QList QColorList; //!< list of colors - -/*! - \class XGUI_ViewBackground - \brief Stores background data - - This class is used to store background data. Depending on the mode, - the background can be specified by: - - image (by assigning the file name to be used as background texture), see setTexture(), setTextureShown() - - single color (by assigning any color), see setColor() - - simple two-color gradient (with the gradient type id and two colors), see setGradient( int, const QColor&, const QColor& ) - - complex gradient (by assigning arbitrary gradient data), see setGradient( const QGradient& ) - - The class stores all the data passed to it, so switching between different modes can be done - just by calling setMode() function. - - \note Texture is used with combination of the background mode. - - \note Two-color gradient is specified by two colors and integer identifier. The interpretation of - this identifier should be done in the calling code. - - \code - XGUI_ViewBackground bg; - bg.setColor( QColor(100, 100, 100) ); // bg is switched to ColorBackground mode - bg.setGradient( Qt::Horizontal, Qt::gray, Qt::white ); // bg is switched to ColorBackground mode - QLinearGradient grad( 0,0,1,1 ); - grad.setColorAt( 0.0, Qt::gray ); - grad.setColorAt( 0.5, Qt::white ); - grad.setColorAt( 1.0, Qt::green ); - grad.setSpread( QGradient::PadSpread ); - bg.setGradient( grad ); // bg is switched to CustomGradientBackground mode - bg.setMode( ColorBackground ); // bg is switched back to ColorBackground mode - bg.setTexture( "/data/images/background.png" ); // specify texture (in the centered mode by default) - bg.setTextureShown( true ); // draw texture on the solid color background - \endcode - */ -class XGUI_EXPORT XGUI_ViewBackground -{ - public: - XGUI_ViewBackground(); - XGUI_ViewBackground(const QColor& theColor); - XGUI_ViewBackground(XGUI::GradientType type, const QColor& theColor1, const QColor& theColor2); - XGUI_ViewBackground(const QGradient&); - virtual ~XGUI_ViewBackground(); - - bool operator==(const XGUI_ViewBackground&) const; - inline bool operator!=(const XGUI_ViewBackground& other) const - { - return !operator==(other); - } - - bool isValid() const; - - /*! - \brief Get background mode - \return current background mode - \sa setMode() - */ - XGUI::BackgroundMode mode() const - { - return myMode; - } - - /*! - \brief Set background mode - \param m background mode being set - \sa mode() - */ - void setMode(const XGUI::BackgroundMode m) - { - myMode = m; - } - - XGUI::TextureMode texture(QString&) const; - void setTexture(const QString&, XGUI::TextureMode = XGUI::CenterTexture); - bool isTextureShown() const; - void setTextureShown(bool); - - QColor color() const; - void setColor(const QColor&); - - int gradient(QColor&, QColor&) const; - void setGradient(XGUI::GradientType, const QColor&, const QColor&); - - const QGradient* gradient() const; - void setGradient(const QGradient&); - - private: - XGUI::BackgroundMode myMode; - XGUI::TextureMode myTextureMode; - QString myFileName; - QColorList myColors; - XGUI::GradientType myGradientType; - QGradient myGradient; - bool myTextureShown; -}; - -#endif diff --git a/src/XGUI/XGUI_ViewPort.cpp b/src/XGUI/XGUI_ViewPort.cpp deleted file mode 100644 index 02ed79251..000000000 --- a/src/XGUI/XGUI_ViewPort.cpp +++ /dev/null @@ -1,557 +0,0 @@ -#include "XGUI_ViewPort.h" -#include "XGUI_ViewWindow.h" -#include "XGUI_Viewer.h" -#include "XGUI_Constants.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#endif - -#include - -static double rx = 0.; -static double ry = 0.; -static int sx = 0; -static int sy = 0; -static Standard_Boolean zRotation = Standard_False; - -/*! - Create native view window for CasCade view [ static ] - */ -Handle(Aspect_Window) CreateCasWindow(const Handle(V3d_View)& view, WId winId) -{ - Aspect_Handle aWindowHandle = (Aspect_Handle) winId; -#ifdef WIN32 - Handle(WNT_Window) viewWindow = new WNT_Window(aWindowHandle); -#else - Handle(Aspect_DisplayConnection) aDispConnection = view->Viewer()->Driver()->GetDisplayConnection(); - Handle(Xw_Window) viewWindow = new Xw_Window( aDispConnection, aWindowHandle ); -#endif - return viewWindow; -} - -//************************************************************************ -//************************************************************************ -//************************************************************************ -XGUI_ViewPort::XGUI_ViewPort(XGUI_ViewWindow* theParent, const Handle(V3d_Viewer)& theViewer, - V3d_TypeOfView theType) - : QWidget(theParent), - myPaintersRedrawing(false), - myScale(1.0), - myIsAdvancedZoomingEnabled(false), - myBgImgHeight(0), - myBgImgWidth(0) -{ - setMouseTracking(true); - setBackgroundRole(QPalette::NoRole); - - // set focus policy to threat QContextMenuEvent from keyboard - setFocusPolicy(Qt::StrongFocus); - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_NoSystemBackground); - setAutoFillBackground(false); - - if (theType == V3d_ORTHOGRAPHIC) { - myOrthoView = new V3d_OrthographicView(theViewer); - myActiveView = myOrthoView; - myPerspView = 0; - } else { - myPerspView = new V3d_PerspectiveView(theViewer); - myActiveView = myPerspView; - } - myActiveView->SetSurfaceDetail(V3d_TEX_ALL); -} - -//*********************************************** -XGUI_ViewPort::~XGUI_ViewPort() -{ -} - -//*********************************************** -bool XGUI_ViewPort::mapView(const Handle(V3d_View)& theView) -{ - if (!setWindow(theView)) - return false; - - if (!mapped(theView)) { - theView->SetWindow(myWindow); - //if (theView != activeView()) - //theView->View()->Deactivate(); - } - - /* create static trihedron (16551: EDF PAL 501) */ - //OCCViewer_ViewWindow* aVW = dynamic_cast( parentWidget()->parentWidget()->parentWidget() ); - //if ( aVW ) { - // OCCViewer_Viewer* aViewModel = dynamic_cast( aVW->getViewManager()->getViewModel() ); - // if ( aViewModel && aViewModel->isStaticTrihedronDisplayed() ){ - //theView->ZBufferTriedronSetup(); - theView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.05, V3d_ZBUFFER); - // } - //} - - emit(vpMapped()); - - return true; -} - -//*********************************************** -bool XGUI_ViewPort::setWindow(const Handle(V3d_View)& theView) -{ - if (!myWindow.IsNull()) - return true; - - if (theView.IsNull()) - return false; - - attachWindow(theView, CreateCasWindow(theView, winId())); - - myWindow = theView->Window(); - return !myWindow.IsNull(); -} - -//*********************************************** -bool XGUI_ViewPort::mapped(const Handle(V3d_View)& theView) const -{ - return (!theView.IsNull() && theView->View()->IsDefined()); -} - -//*********************************************** -void XGUI_ViewPort::updateBackground() -{ - if (activeView().IsNull()) - return; - if (!myBackground.isValid()) - return; - - // VSR: Important note on below code. - // In OCCT (in version 6.5.2), things about the background drawing - // are not straightforward and not clearly understandable: - // - Horizontal gradient is drawn vertically (!), well ok, from top side to bottom one. - // - Vertical gradient is drawn horizontally (!), from right side to left one (!!!). - // - First and second diagonal gradients are confused. - // - Image texture, once set, can not be removed (!). - // - Texture image fill mode Aspect_FM_NONE is not taken into account (and means the same - // as Aspect_FM_CENTERED). - // - The only way to cancel gradient background (and get back to single colored) is to - // set gradient background style to Aspect_GFM_NONE while passing two colors is also needed - // (see V3d_View::SetBgGradientColors() function). - // - Also, it is impossible to draw texture image above the gradiented background (only above - // single-colored). - // In OCCT 6.5.3 all above mentioned problems are fixed; so, above comment should be removed as soon - // as SALOME is migrated to OCCT 6.5.3. The same concerns #ifdef statements in the below code - switch (myBackground.mode()) { - case Qtx::ColorBackground: { - QColor c = myBackground.color(); - if (c.isValid()) { - // Unset texture should be done here - // ... - Quantity_Color qCol(c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB); - activeView()->SetBgGradientStyle(Aspect_GFM_NONE); // cancel gradient background - activeView()->SetBgImageStyle(Aspect_FM_NONE); // cancel texture background - // then change background color - activeView()->SetBackgroundColor(qCol); - // update viewer - activeView()->Update(); - } - break; - } - case Qtx::SimpleGradientBackground: { - QColor c1, c2; - int type = myBackground.gradient(c1, c2); - if (c1.isValid() && type >= XGUI::HorizontalGradient && type <= XGUI::LastGradient) { - // Unset texture should be done here - // ... - // Get colors and set-up gradiented background - if (!c2.isValid()) - c2 = c1; - Quantity_Color qCol1(c1.red() / 255., c1.green() / 255., c1.blue() / 255., - Quantity_TOC_RGB); - Quantity_Color qCol2(c2.red() / 255., c2.green() / 255., c2.blue() / 255., - Quantity_TOC_RGB); - activeView()->SetBgImageStyle(Aspect_FM_NONE); // cancel texture background - switch (type) { - case XGUI::HorizontalGradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_HOR, - Standard_True); - break; - case XGUI::VerticalGradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_VER, - Standard_True); - break; - case XGUI::Diagonal1Gradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_DIAG1, - Standard_True); - break; - case XGUI::Diagonal2Gradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_DIAG2, - Standard_True); - break; - case XGUI::Corner1Gradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER1, - Standard_True); - break; - case XGUI::Corner2Gradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER2, - Standard_True); - break; - case XGUI::Corner3Gradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER3, - Standard_True); - break; - case XGUI::Corner4Gradient: - activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER4, - Standard_True); - break; - default: - break; - } - } - break; - } - case Qtx::CustomGradientBackground: - // NOT IMPLEMENTED YET - break; - default: - break; - } - // VSR: In OCCT before v6.5.3 below code can't be used because of very ugly bug - it has been impossible to - // clear the background texture image as soon as it was once set to the viewer. - if (myBackground.isTextureShown()) { - QString fileName; - int textureMode = myBackground.texture(fileName); - QFileInfo fi(fileName); - if (!fileName.isEmpty() && fi.exists()) { - // set texture image: file name and fill mode - switch (textureMode) { - case XGUI::CenterTexture: - activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(), - Aspect_FM_CENTERED); - break; - case XGUI::TileTexture: - activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(), - Aspect_FM_TILED); - break; - case XGUI::StretchTexture: - activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(), - Aspect_FM_STRETCH); - break; - default: - break; - } - activeView()->Update(); - } - } -} - -//*********************************************** -void XGUI_ViewPort::attachWindow(const Handle(V3d_View)& theView, - const Handle(Aspect_Window)& theWnd) -{ - if (!theView.IsNull()) { - theView->SetWindow(theWnd); - updateBackground(); - } -} - -//*********************************************** -void XGUI_ViewPort::paintEvent(QPaintEvent* theEvent) -{ -#ifndef WIN32 - /* X11 : map before show doesn't work */ - if ( !mapped( activeView() ) ) - mapView( activeView() ); -#endif - if (!myWindow.IsNull()) { - QApplication::syncX(); - QRect rc = theEvent->rect(); - //if ( !myPaintersRedrawing ) { - //activeView()->Redraw(); - activeView()->Redraw(rc.x(), rc.y(), rc.width(), rc.height()); - emit vpUpdated(); - //} - } - //if ( myPaintersRedrawing ) { - // QPainter p( this ); - // //emit vpDrawExternal( &p ); - // myPaintersRedrawing = false; - //} -} - -//*********************************************** -void XGUI_ViewPort::resizeEvent(QResizeEvent* theEvent) -{ -#ifdef WIN32 - /* Win32 : map before first show to avoid flicker */ - if (!mapped(activeView())) - mapView(activeView()); -#endif - QApplication::syncX(); - if (!activeView().IsNull()) { - activeView()->MustBeResized(); - } - emit resized(); -} - -//*********************************************** -QImage XGUI_ViewPort::dumpView(unsigned char*& theData, QRect theRect, bool toUpdate) -{ - Handle(V3d_View) view = getView(); - if (view.IsNull()) - return QImage(); - - int aWidth; - int aHeight; - if (theRect.isNull()) { - aWidth = width(); - aHeight = height(); - } else { - aWidth = theRect.width(); - aHeight = theRect.height(); - } - QApplication::syncX(); - - theData = new unsigned char[aWidth * aHeight * 4]; - - QPoint p; - if (theRect.isNull()) { - if (toUpdate) - view->Redraw(); - p = mapFromParent(geometry().topLeft()); - } else { - if (toUpdate) - view->Redraw(theRect.x(), theRect.y(), theRect.width(), theRect.height()); - p = theRect.topLeft(); - } - glReadPixels(p.x(), p.y(), aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE, theData); - - QImage anImage(theData, aWidth, aHeight, QImage::Format_ARGB32); - anImage = anImage.mirrored(); - anImage = anImage.rgbSwapped(); - return anImage; -} - -/*! - Inits 'rotation' transformation. - */ -void XGUI_ViewPort::startRotation(int x, int y, int theRotationPointType, - const gp_Pnt& theSelectedPoint) -{ - if (!activeView().IsNull()) { - switch (theRotationPointType) { - case XGUI::GRAVITY: - activeView()->StartRotation(x, y, 0.45); - break; - case XGUI::SELECTED: - sx = x; - sy = y; - - double X, Y; - activeView()->Size(X, Y); - rx = Standard_Real(activeView()->Convert(X)); - ry = Standard_Real(activeView()->Convert(Y)); - - activeView()->Rotate(0., 0., 0., theSelectedPoint.X(), theSelectedPoint.Y(), - theSelectedPoint.Z(), - Standard_True); - - Quantity_Ratio zRotationThreshold; - zRotation = Standard_False; - zRotationThreshold = 0.45; - if (zRotationThreshold > 0.) { - Standard_Real dx = Abs(sx - rx / 2.); - Standard_Real dy = Abs(sy - ry / 2.); - Standard_Real dd = zRotationThreshold * (rx + ry) / 2.; - if (dx > dd || dy > dd) - zRotation = Standard_True; - } - break; - default: - break; - } - activeView()->DepthFitAll(); - } -} - -/*! - Rotates the viewport. - */ -void XGUI_ViewPort::rotate(int x, int y, int theRotationPointType, const gp_Pnt& theSelectedPoint) -{ - if (!activeView().IsNull()) { - switch (theRotationPointType) { - case XGUI::GRAVITY: - activeView()->Rotation(x, y); - break; - case XGUI::SELECTED: - double dx, dy, dz; - if (zRotation) { - dz = atan2(Standard_Real(x) - rx / 2., ry / 2. - Standard_Real(y)) - - atan2(sx - rx / 2., ry / 2. - sy); - dx = dy = 0.; - } else { - dx = (Standard_Real(x) - sx) * M_PI / rx; - dy = (sy - Standard_Real(y)) * M_PI / ry; - dz = 0.; - } - - activeView()->Rotate(dx, dy, dz, theSelectedPoint.X(), theSelectedPoint.Y(), - theSelectedPoint.Z(), - Standard_False); - break; - default: - break; - } - emit vpTransformed(); - } - // setZSize( getZSize() ); -} - -/*! - Resets the viewport after 'rotation'. - */ -void XGUI_ViewPort::endRotation() -{ - if (!activeView().IsNull()) { - activeView()->ZFitAll(1.); - activeView()->SetZSize(0.); - activeView()->Update(); - emit vpTransformed(); - } -} - -/*! - Inits 'zoom' transformation. - */ -void XGUI_ViewPort::startZoomAtPoint(int x, int y) -{ - if (!activeView().IsNull()/* && isAdvancedZoomingEnabled() */) - activeView()->StartZoomAtPoint(x, y); -} - -/*! - Centers the viewport. - */ -void XGUI_ViewPort::setCenter(int x, int y) -{ - if (!activeView().IsNull()) { - activeView()->Place(x, y, myScale); - emit vpTransformed(); - } -} - -/*! - Called at 'pan' transformation. - */ -void XGUI_ViewPort::pan(int dx, int dy) -{ - if (!activeView().IsNull()) { - activeView()->Pan(dx, dy, 1.0); - emit vpTransformed(); - } -} - -/*! - Called at 'window fit' transformation. - */ -void XGUI_ViewPort::fitRect(const QRect& rect) -{ - if (!activeView().IsNull()) { - activeView()->WindowFit(rect.left(), rect.top(), rect.right(), rect.bottom()); - emit vpTransformed(); - } -} - -/*! - Called at 'zoom' transformation. - */ -void XGUI_ViewPort::zoom(int x0, int y0, int x, int y) -{ - if (!activeView().IsNull()) { - if (isAdvancedZoomingEnabled()) - activeView()->ZoomAtPoint(x0, y0, x, y); - else - activeView()->Zoom(x0 + y0, 0, x + y, 0); - emit vpTransformed(); - } -} - -/*! - Sets the background data - */ -void XGUI_ViewPort::setBackground(const Qtx::BackgroundData& bgData) -{ - if (bgData.isValid()) { - myBackground = bgData; - updateBackground(); - emit vpChangeBackground(myBackground); - } -} - -void XGUI_ViewPort::fitAll(bool theKeepScale, bool theWithZ, bool theUpd) -{ - if (activeView().IsNull()) - return; - - if (theKeepScale) - myScale = activeView()->Scale(); - - Standard_Real aMargin = 0.01; - activeView()->FitAll(aMargin, theWithZ, theUpd); - activeView()->SetZSize(0.); - emit vpTransformed(); -} - -void XGUI_ViewPort::syncronizeWith(const XGUI_ViewPort* ref) -{ - Handle(V3d_View) refView = ref->getView(); - Handle(V3d_View) tgtView = getView(); - - /* The following params are copied: - - view type( ortho/persp ) - - position of view point - - orientation of high point - - position of the eye - - projection vector - - view center ( 2D ) - - view twist - - view scale - */ - - /* we'll update after setting all params */ - tgtView->SetImmediateUpdate( Standard_False); - - /* perspective */ - if (refView->Type() == V3d_PERSPECTIVE) - tgtView->SetFocale(refView->Focale()); - - /* copy params */ - Standard_Real x, y, z; - refView->At(x, y, z); - tgtView->SetAt(x, y, z); - refView->Up(x, y, z); - tgtView->SetUp(x, y, z); - refView->Eye(x, y, z); - tgtView->SetEye(x, y, z); - refView->Proj(x, y, z); - tgtView->SetProj(x, y, z); - refView->Center(x, y); - tgtView->SetCenter(x, y); - tgtView->SetScale(refView->Scale()); - tgtView->SetTwist(refView->Twist()); - - /* update */ - tgtView->Update(); - tgtView->SetImmediateUpdate( Standard_True); -} diff --git a/src/XGUI/XGUI_ViewPort.h b/src/XGUI/XGUI_ViewPort.h deleted file mode 100644 index f22cc9d92..000000000 --- a/src/XGUI/XGUI_ViewPort.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef XGUI_ViewPort_H -#define XGUI_ViewPort_H - -#include "XGUI.h" - -#include - -#include -#include -#include -#include - -class XGUI_ViewWindow; - -class XGUI_EXPORT XGUI_ViewPort : public QWidget -{ -Q_OBJECT - public: - XGUI_ViewPort(XGUI_ViewWindow* theParent, const Handle(V3d_Viewer)& theViewer, - V3d_TypeOfView theType = V3d_ORTHOGRAPHIC); - virtual ~XGUI_ViewPort(); - - virtual QPaintEngine* paintEngine() const - { - return 0; - } - - QImage dumpView(unsigned char*& theData, QRect theRect = QRect(), bool toUpdate = true); - - Handle(V3d_View) getView() const - { - return activeView(); - } - - void startRotation(int x, int y, int theRotationPointType, const gp_Pnt& theSelectedPoint); - void rotate(int, int, int, const gp_Pnt&); - void endRotation(); - - // TRANSFORMATIONS - void pan(int dx, int dy); - void setCenter(int x, int y); - void fitRect(const QRect& rect); - void startZoomAtPoint(int x, int y); - void zoom(int x0, int y0, int x, int y); - void fitAll(bool theKeepScale = false, bool theWithZ = true, bool theUpd = true); - - void setAdvancedZoomingEnabled(const bool theState) - { - myIsAdvancedZoomingEnabled = theState; - } - bool isAdvancedZoomingEnabled() const - { - return myIsAdvancedZoomingEnabled; - } - - Qtx::BackgroundData background() const - { - return myBackground; - } - - void setBackground(const Qtx::BackgroundData& bgData); - - void syncronizeWith(const XGUI_ViewPort* ref); - -signals: - void vpChangeBackground(const Qtx::BackgroundData&); - void vpClosed(); - void vpMapped(); - void vpTransformed(); - void vpUpdated(); - void resized(); - - protected: - virtual void paintEvent(QPaintEvent*); - virtual void resizeEvent(QResizeEvent*); - - private: - Handle(V3d_View) activeView() const - { - return myActiveView; - } - - bool mapView(const Handle(V3d_View)& theView); - bool setWindow(const Handle(V3d_View)& theView); - bool mapped(const Handle(V3d_View)& theView) const; - void updateBackground(); - void attachWindow(const Handle(V3d_View)& theView, const Handle(Aspect_Window)& theWnd); - - Handle(V3d_View) myOrthoView;Handle(V3d_View) myPerspView;Handle(V3d_View) myActiveView; - - Handle(Aspect_Window) myWindow; - - bool myPaintersRedrawing; - bool myIsAdvancedZoomingEnabled; - - double myScale; - - Qtx::BackgroundData myBackground; - int myBgImgHeight; - int myBgImgWidth; -}; - -#endif diff --git a/src/XGUI/XGUI_ViewWindow.cpp b/src/XGUI/XGUI_ViewWindow.cpp deleted file mode 100644 index e36aff2c5..000000000 --- a/src/XGUI/XGUI_ViewWindow.cpp +++ /dev/null @@ -1,1222 +0,0 @@ -#include "XGUI_ViewWindow.h" -#include "XGUI_ViewPort.h" -#include "XGUI_Viewer.h" -#include "XGUI_Tools.h" -#include "XGUI_RubberBand.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#define BORDER_SIZE 2 - -const char* imageZoomCursor[] = { "32 32 3 1", ". c None", "a c #000000", "# c #ffffff", - "................................", "................................", - ".#######........................", "..aaaaaaa.......................", - "................................", ".............#####..............", - "...........##.aaaa##............", "..........#.aa.....a#...........", - ".........#.a.........#..........", ".........#a..........#a.........", - "........#.a...........#.........", "........#a............#a........", - "........#a............#a........", "........#a............#a........", - "........#a............#a........", ".........#...........#.a........", - ".........#a..........#a.........", ".........##.........#.a.........", - "........#####.....##.a..........", ".......###aaa#####.aa...........", - "......###aa...aaaaa.......#.....", ".....###aa................#a....", - "....###aa.................#a....", "...###aa...............#######..", - "....#aa.................aa#aaaa.", ".....a....................#a....", - "..........................#a....", "...........................a....", - "................................", "................................", - "................................", "................................" }; - -const char* imageRotateCursor[] = { "32 32 3 1", ". c None", "a c #000000", "# c #ffffff", - "................................", "................................", - "................................", "................................", - "........#.......................", ".......#.a......................", - "......#######...................", ".......#aaaaa#####..............", - "........#..##.a#aa##........##..", ".........a#.aa..#..a#.....##.aa.", - ".........#.a.....#...#..##.aa...", ".........#a.......#..###.aa.....", - "........#.a.......#a..#aa.......", "........#a.........#..#a........", - "........#a.........#a.#a........", "........#a.........#a.#a........", - "........#a.........#a.#a........", ".........#.........#a#.a........", - "........##a........#a#a.........", "......##.a#.......#.#.a.........", - "....##.aa..##.....##.a..........", "..##.aa.....a#####.aa...........", - "...aa.........aaa#a.............", "................#.a.............", - "...............#.a..............", "..............#.a...............", - "...............a................", "................................", - "................................", "................................", - "................................", "................................" }; - -const char* imageCrossCursor[] = { "32 32 3 1", ". c None", "a c #000000", "# c #ffffff", - "................................", "................................", - "................................", "................................", - "................................", "................................", - "................................", "...............#................", - "...............#a...............", "...............#a...............", - "...............#a...............", "...............#a...............", - "...............#a...............", "...............#a...............", - "...............#a...............", ".......#################........", - "........aaaaaaa#aaaaaaaaa.......", "...............#a...............", - "...............#a...............", "...............#a...............", - "...............#a...............", "...............#a...............", - "...............#a...............", "...............#a...............", - "................a...............", "................................", - "................................", "................................", - "................................", "................................", - "................................", "................................" }; - -ViewerToolbar::ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort) - : QToolBar(theParent), - myVPort(thePort), - myResize(false) -{ - connect(myVPort, SIGNAL(resized()), this, SLOT(onViewPortResized())); -} - -void ViewerToolbar::paintEvent(QPaintEvent* theEvent) -{ - //QToolBar::paintEvent(theEvent); - // Paint background - QPainter aPainter(this); - QRect aRect = rect(); - QRect aVPRect = myVPort->rect(); - QPoint aGlobPnt = mapToGlobal(aRect.topLeft()); - QPoint aPnt = myVPort->mapFromGlobal(aGlobPnt); - - QRect aImgRect( - QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(), aRect.width(), aRect.height())); - unsigned char* aData = 0; - QImage aImg = myVPort->dumpView(aData, aImgRect, myResize); - if (!aImg.isNull()) - aPainter.drawImage(aRect, aImg); - myResize = false; - - // Paint foreground - QStyle *style = this->style(); - QStyleOptionToolBar aOpt; - initStyleOption(&aOpt); - - aOpt.rect = style->subElementRect(QStyle::SE_ToolBarHandle, &aOpt, this); - if (aOpt.rect.isValid()) - style->drawPrimitive(QStyle::PE_IndicatorToolBarHandle, &aOpt, &aPainter, this); - if (aData) - delete aData; -} - -//************************************************************************** -ViewerLabel::ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort) - : QLabel(theParent), - myVPort(thePort), - myResize(false) -{ - connect(myVPort, SIGNAL(resized()), this, SLOT(onViewPortResized())); -} - -void ViewerLabel::paintEvent(QPaintEvent* theEvent) -{ - QRect aRect = rect(); - QRect aVPRect = myVPort->rect(); - QPoint aGlobPnt = mapToGlobal(aRect.topLeft()); - QPoint aPnt = myVPort->mapFromGlobal(aGlobPnt); - - QRect aImgRect( - QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(), aRect.width(), aRect.height())); - unsigned char* aData = 0; - QImage aImg = myVPort->dumpView(aData, aImgRect, myResize); - if (!aImg.isNull()) - QPainter(this).drawImage(aRect, aImg); - myResize = false; - QLabel::paintEvent(theEvent); - if (aData) - delete aData; -} - -//************************************************************************** -//************************************************************************** -//************************************************************************** -XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType) - : QFrame(), - myViewer(theViewer), - myMoving(false), - MinimizeIco(":pictures/wnd_minimize.png"), - MaximizeIco(":pictures/wnd_maximize.png"), - CloseIco(":pictures/wnd_close.png"), - RestoreIco(":pictures/wnd_restore.png"), - myInteractionStyle(XGUI::STANDARD), - myRectBand(0), - myIsKeyFree(false), - my2dMode(XGUI::No2dMode), - myCurrPointType(XGUI::GRAVITY), - myPrevPointType(XGUI::GRAVITY), - myRotationPointSelection(false), - myClosable(true), - myStartX(0), - myStartY(0), - myCurrX(0), - myCurrY(0), - myCurScale(0.0), - myCurSketch(0), - myDrawRect(false), - myEnableDrawMode(false), - myCursorIsHand(false), - myEventStarted(false), - myIsActive(false), - myLastState(WindowNormalState), - myOperation(NOTHING), - myGripWgt(0), - myPicture(0) -{ - mySelectedPoint = gp_Pnt(0., 0., 0.); - setFrameStyle(QFrame::Raised); - setFrameShape(QFrame::Panel); - setLineWidth(BORDER_SIZE); - setMouseTracking(true); - - QVBoxLayout* aLay = new QVBoxLayout(this); - aLay->setContentsMargins(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE); - myViewPort = new XGUI_ViewPort(this, myViewer->v3dViewer(), theType); - myViewPort->installEventFilter(this); - myViewPort->setCursor(Qt::ArrowCursor); - aLay->addWidget(myViewPort); - - myPicture = new QLabel(this); - myPicture->setFrameStyle(QFrame::Sunken); - myPicture->setFrameShape(QFrame::Panel); - myPicture->setMouseTracking(true); - myPicture->installEventFilter(this); - aLay->addWidget(myPicture); - myPicture->hide(); - - QVBoxLayout* aVPLay = new QVBoxLayout(myViewPort); - aVPLay->setMargin(0); - aVPLay->setSpacing(0); - aVPLay->setContentsMargins(0, 0, 0, 0); - - QHBoxLayout* aToolLay = new QHBoxLayout(); - aToolLay->setMargin(0); - aToolLay->setSpacing(0); - aToolLay->setContentsMargins(0, 0, 0, 0); - aVPLay->addLayout(aToolLay); - aVPLay->addStretch(); - - myGripWgt = new ViewerLabel(this, myViewPort); - myGripWgt->setPixmap(QPixmap(":pictures/wnd_grip.png")); - myGripWgt->setMouseTracking(true); - myGripWgt->installEventFilter(this); - myGripWgt->setCursor(Qt::OpenHandCursor); - aToolLay->addWidget(myGripWgt); - - // Create Viewer management buttons - myViewBar = new ViewerToolbar(this, myViewPort); - myViewBar->setCursor(Qt::PointingHandCursor); - aToolLay->addWidget(myViewBar); - aToolLay->addStretch(); - - QAction* aBtn; - - // Dump view - aBtn = new QAction(QIcon(":pictures/occ_view_camera_dump.png"), tr("Dump view"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(dumpView())); - myViewBar->addAction(aBtn); - // Fit all - aBtn = new QAction(QIcon(":pictures/occ_view_fitall.png"), tr("Fit all"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(fitAll())); - myViewBar->addAction(aBtn); - // Fit area - aBtn = new QAction(QIcon(":pictures/occ_view_fitarea.png"), tr("Fit area"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(activateWindowFit())); - myViewBar->addAction(aBtn); - // Zoom - aBtn = new QAction(QIcon(":pictures/occ_view_zoom.png"), tr("Zoom"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(activateZoom())); - myViewBar->addAction(aBtn); - // Pan - aBtn = new QAction(QIcon(":pictures/occ_view_pan.png"), tr("Panning"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(activatePanning())); - myViewBar->addAction(aBtn); - // Global Panning - aBtn = new QAction(QIcon(":pictures/occ_view_glpan.png"), tr("Global panning"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(activateGlobalPanning())); - myViewBar->addAction(aBtn); - // Rotation - aBtn = new QAction(QIcon(":pictures/occ_view_rotate.png"), tr("Rotate"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(activateRotation())); - myViewBar->addAction(aBtn); - // Reset - aBtn = new QAction(QIcon(":pictures/occ_view_reset.png"), tr("Reset"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(reset())); - myViewBar->addAction(aBtn); - // Front view - aBtn = new QAction(QIcon(":pictures/occ_view_front.png"), tr("Front"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(frontView())); - myViewBar->addAction(aBtn); - // Back view - aBtn = new QAction(QIcon(":pictures/occ_view_back.png"), tr("Back"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(backView())); - myViewBar->addAction(aBtn); - // Top view - aBtn = new QAction(QIcon(":pictures/occ_view_top.png"), tr("Top"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(topView())); - myViewBar->addAction(aBtn); - // Bottom view - aBtn = new QAction(QIcon(":pictures/occ_view_bottom.png"), tr("Bottom"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(bottomView())); - myViewBar->addAction(aBtn); - // Left view - aBtn = new QAction(QIcon(":pictures/occ_view_left.png"), tr("Left"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(leftView())); - myViewBar->addAction(aBtn); - // Right view - aBtn = new QAction(QIcon(":pictures/occ_view_right.png"), tr("Right"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(rightView())); - myViewBar->addAction(aBtn); - // Clone view - aBtn = new QAction(QIcon(":pictures/occ_view_clone.png"), tr("Clone"), myViewBar); - connect(aBtn, SIGNAL(triggered()), SLOT(cloneView())); - myViewBar->addAction(aBtn); - - // Create Window management buttons - myWindowBar = new ViewerToolbar(this, myViewPort); - myWindowBar->setCursor(Qt::PointingHandCursor); - aToolLay->addWidget(myWindowBar); - - myMinimizeBtn = new QAction(myWindowBar); - myMinimizeBtn->setIcon(MinimizeIco); - myWindowBar->addAction(myMinimizeBtn); - connect(myMinimizeBtn, SIGNAL(triggered()), SLOT(onMinimize())); - - myMaximizeBtn = new QAction(myWindowBar); - myMaximizeBtn->setIcon(MaximizeIco); - myWindowBar->addAction(myMaximizeBtn); - connect(myMaximizeBtn, SIGNAL(triggered()), SLOT(onMaximize())); - - aBtn = new QAction(myWindowBar); - aBtn->setIcon(CloseIco); - myWindowBar->addAction(aBtn); - connect(aBtn, SIGNAL(triggered()), SLOT(onClose())); - - //Support copy of background on updating of viewer - connect(myViewPort, SIGNAL(vpTransformed()), this, SLOT(updateToolBar())); - connect(myViewPort, SIGNAL(vpUpdated()), this, SLOT(updateToolBar())); - connect(this, SIGNAL(vpTransformationFinished(XGUI_ViewWindow::OperationType)), this, - SLOT(updateToolBar())); -} - -//**************************************************************** -XGUI_ViewWindow::~XGUI_ViewWindow() -{ -} - -//**************************************************************** -void XGUI_ViewWindow::showEvent(QShowEvent* theEvent) -{ - QFrame::showEvent(theEvent); - myWindowBar->setFixedSize(myWindowBar->sizeHint()); -} - -//**************************************************************** -void XGUI_ViewWindow::changeEvent(QEvent* theEvent) -{ - - if (theEvent->type() == QEvent::WindowStateChange) { - if (isMinimized()) { - if (myPicture->isHidden()) { - myViewBar->hide(); - myGripWgt->hide(); - myWindowBar->hide(); - myViewPort->hide(); - myPicture->show(); - } - } else { - if (myPicture->isVisible()) { - myPicture->hide(); - myViewPort->show(); - } - if (isMaximized()) { - myMinimizeBtn->setIcon(MinimizeIco); - myMaximizeBtn->setIcon(RestoreIco); - } - myViewBar->setVisible(myIsActive); - myWindowBar->setVisible(myIsActive); - myGripWgt->setVisible(myIsActive && (!isMaximized())); - } - } else - QWidget::changeEvent(theEvent); -} - -//**************************************************************** -void XGUI_ViewWindow::windowActivated() -{ - if (!(isMinimized() || parentWidget()->isMinimized())) { - myIsActive = true; - if (isMaximized() || parentWidget()->isMaximized()) { - myMaximizeBtn->setIcon(RestoreIco); - } else { - myMaximizeBtn->setIcon(MaximizeIco); - } - myViewBar->show(); - myWindowBar->show(); - myGripWgt->setVisible( - !(isMaximized() || isMinimized() || parentWidget()->isMaximized() - || parentWidget()->isMinimized())); - } else - myIsActive = false; -} - -//**************************************************************** -void XGUI_ViewWindow::windowDeactivated() -{ - myIsActive = false; - if (!(isMinimized() || parentWidget()->isMinimized())) { - if (isMaximized() || parentWidget()->isMaximized()) { - myMaximizeBtn->setIcon(RestoreIco); - } else { - myMaximizeBtn->setIcon(MaximizeIco); - } - myViewBar->hide(); - myWindowBar->hide(); - myGripWgt->hide(); - } -} - -//**************************************************************** -void XGUI_ViewWindow::onClose() -{ - if (parentWidget()) { - emit tryClosing(this); - if (closable()) { - emit closed(static_cast(parentWidget())); - parentWidget()->close(); - } - } -} - -//**************************************************************** -void XGUI_ViewWindow::onMinimize() -{ - unsigned char* aData = 0; - QPixmap aPMap = QPixmap::fromImage(myViewPort->dumpView(aData)); - int aW = width(); - int aH = height(); - double aR = aW / 100.; - int aNewH = int(aH / aR); - myPicture->setPixmap(aPMap.scaled(100, aNewH)); - - myLastState = - (isMaximized() || parentWidget()->isMaximized()) ? MaximizedState : WindowNormalState; - showMinimized(); - parentWidget()->showMinimized(); - parentWidget()->setGeometry(parentWidget()->x(), parentWidget()->y(), 100, aNewH); - parentWidget()->lower(); - windowDeactivated(); - myViewer->onWindowMinimized((QMdiSubWindow*) parentWidget()); - delete aData; -} - -//**************************************************************** -void XGUI_ViewWindow::onMaximize() -{ - if (isMaximized() || parentWidget()->isMaximized()) { - myMaximizeBtn->setIcon(MaximizeIco); - myGripWgt->show(); - showNormal(); - parentWidget()->showNormal(); - } else { - myMaximizeBtn->setIcon(RestoreIco); - myGripWgt->hide(); - showMaximized(); - parentWidget()->showMaximized(); - } - parentWidget()->activateWindow(); - myMinimizeBtn->setIcon(MinimizeIco); - - // In order to avoid frosen background in toolbars when it shown as a second view - QTimer::singleShot(50, parentWidget(), SLOT(setFocus())); -} - -//**************************************************************** -bool XGUI_ViewWindow::processWindowControls(QObject *theObj, QEvent *theEvent) -{ - switch (theEvent->type()) { - case QEvent::MouseButtonPress: { - QMouseEvent* aEvent = static_cast(theEvent); - if ((aEvent->button() == Qt::LeftButton) && (!myMoving)) { - myMoving = true; - myMousePnt = aEvent->globalPos(); - return true; - } - } - break; - case QEvent::MouseButtonRelease: { - QMouseEvent* aEvent = static_cast(theEvent); - if ((aEvent->button() == Qt::LeftButton) && myMoving) { - myMoving = false; - return true; - } - } - break; - case QEvent::MouseMove: { - QMouseEvent* aEvent = static_cast(theEvent); - if (myMoving) { - QMdiSubWindow* aParent = static_cast(parentWidget()); - QMdiArea* aMDIArea = aParent->mdiArea(); - - QPoint aPnt = aEvent->globalPos(); - QPoint aMDIPnt = aMDIArea->mapFromGlobal(aPnt); - if (aMDIArea->rect().contains(aMDIPnt)) { - int aX = aParent->x() + (aPnt.x() - myMousePnt.x()); - int aY = aParent->y() + (aPnt.y() - myMousePnt.y()); - aParent->move(aX, aY); - myMousePnt = aPnt; - } - return true; - } - } - break; - case QEvent::MouseButtonDblClick: - if (theObj == myPicture) { - myMoving = false; - if (myLastState == MaximizedState) { - showMaximized(); - } else { - showNormal(); - } - myViewer->onWindowActivated((QMdiSubWindow*) parentWidget()); - - // In order to avoid frosen background in toolbars when it shown as a second view - QTimer::singleShot(20, parentWidget(), SLOT(setFocus())); - - return true; - } - } - return false; -} - -//**************************************************************** -bool XGUI_ViewWindow::processViewPort(QEvent *theEvent) -{ - switch (theEvent->type()) { - case QEvent::MouseButtonPress: - vpMousePressEvent((QMouseEvent*) theEvent); - return true; - - case QEvent::MouseButtonRelease: - vpMouseReleaseEvent((QMouseEvent*) theEvent); - return true; - - case QEvent::MouseMove: - vpMouseMoveEvent((QMouseEvent*) theEvent); - return true; - - case QEvent::MouseButtonDblClick: - emit mouseDoubleClicked(this, (QMouseEvent*) theEvent); - return true; - case QEvent::Wheel: { - QWheelEvent* aEvent = (QWheelEvent*) theEvent; - myViewPort->startZoomAtPoint(aEvent->x(), aEvent->y()); - double aDelta = (double) (aEvent->delta()) / (15 * 8); - int x = aEvent->x(); - int y = aEvent->y(); - int x1 = (int) (aEvent->x() + width() * aDelta / 100); - int y1 = (int) (aEvent->y() + height() * aDelta / 100); - myViewPort->zoom(x, y, x1, y1); - } - return true; - } - return false; -} - -//**************************************************************** -bool XGUI_ViewWindow::eventFilter(QObject *theObj, QEvent *theEvent) -{ - if ((theObj == myGripWgt) || (theObj == myPicture)) { - if (processWindowControls(theObj, theEvent)) - return true; - } else if (theObj == myViewPort) { - if (processViewPort(theEvent)) { - return true; - } - if (theEvent->type() == QEvent::KeyRelease) { - emit keyReleased(this, (QKeyEvent*) theEvent); - return true; - } - } - return QFrame::eventFilter(theObj, theEvent); -} - -//**************************************************************** -XGUI_ViewWindow::OperationType XGUI_ViewWindow::getButtonState( - QMouseEvent* theEvent, XGUI::InteractionStyle theInteractionStyle) -{ - OperationType aOp = NOTHING; - XGUI::InteractionStyle aStyle = (XGUI::InteractionStyle) theInteractionStyle; - if ((theEvent->modifiers() == XGUI_Viewer::myStateMap[aStyle][XGUI::ZOOM]) - && (theEvent->buttons() == XGUI_Viewer::myButtonMap[aStyle][XGUI::ZOOM])) - aOp = ZOOMVIEW; - else if ((theEvent->modifiers() == XGUI_Viewer::myStateMap[aStyle][XGUI::PAN]) - && (theEvent->buttons() == XGUI_Viewer::myButtonMap[aStyle][XGUI::PAN])) - aOp = PANVIEW; - else if ((theEvent->modifiers() == XGUI_Viewer::myStateMap[aStyle][XGUI::ROTATE]) - && (theEvent->buttons() == XGUI_Viewer::myButtonMap[aStyle][XGUI::ROTATE]) - && (my2dMode == XGUI::No2dMode)) - aOp = ROTATE; - - return aOp; -} - -//**************************************************************** -void XGUI_ViewWindow::vpMousePressEvent(QMouseEvent* theEvent) -{ - myStartX = theEvent->x(); - myStartY = theEvent->y(); - XGUI::InteractionStyle anInteractionStyle = interactionStyle(); - - // in "key free" interaction style zoom operation is activated by two buttons (simultaneously pressed), - // which are assigned for pan and rotate - these operations are activated immediately after pressing - // of the first button, so it is necessary to switch to zoom when the second button is pressed - bool aSwitchToZoom = false; - if ((anInteractionStyle == XGUI::KEY_FREE) && (myOperation == PANVIEW || myOperation == ROTATE)) { - aSwitchToZoom = getButtonState(theEvent, anInteractionStyle) == ZOOMVIEW; - } - - switch (myOperation) { - case WINDOWFIT: - if (theEvent->button() == Qt::LeftButton) - emit vpTransformationStarted(WINDOWFIT); - break; - - case PANGLOBAL: - if (theEvent->button() == Qt::LeftButton) - emit vpTransformationStarted(PANGLOBAL); - break; - - case ZOOMVIEW: - if (theEvent->button() == Qt::LeftButton) { - myViewPort->startZoomAtPoint(myStartX, myStartY); - emit vpTransformationStarted(ZOOMVIEW); - } - break; - - case PANVIEW: - if (aSwitchToZoom) { - myViewPort->startZoomAtPoint(myStartX, myStartY); - activateZoom(); - } else if (theEvent->button() == Qt::LeftButton) - emit vpTransformationStarted(PANVIEW); - break; - - case ROTATE: - if (aSwitchToZoom) { - myViewPort->startZoomAtPoint(myStartX, myStartY); - activateZoom(); - } else if (theEvent->button() == Qt::LeftButton) { - myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint); - emit vpTransformationStarted(ROTATE); - } - break; - - default: - /* Try to activate a transformation */ - OperationType aState; - if (interactionStyle() == XGUI::STANDARD) - aState = getButtonState(theEvent, anInteractionStyle); - else { - aState = XGUI_ViewWindow::NOTHING; - myIsKeyFree = true; - } - switch (aState) { - case ZOOMVIEW: - myViewPort->startZoomAtPoint(myStartX, myStartY); - activateZoom(); - break; - case PANVIEW: - activatePanning(); - break; - case ROTATE: - activateRotation(); - myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint); - break; - default: - if (myRotationPointSelection) { - if (theEvent->button() == Qt::LeftButton) { - Handle(AIS_InteractiveContext) ic = myViewer->AISContext(); - ic->Select(); - for (ic->InitSelected(); ic->MoreSelected(); ic->NextSelected()) { - TopoDS_Shape aShape = ic->SelectedShape(); - if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX) { - gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(ic->SelectedShape())); - /*if ( mySetRotationPointDlg ) { - myRotationPointSelection = false; - mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z()); - }*/ - } else { - myCurrPointType = myPrevPointType; - break; - } - } - if (ic->NbSelected() == 0) - myCurrPointType = myPrevPointType; - //if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange(); - //ic->CloseAllContexts(); - myOperation = NOTHING; - myViewPort->setCursor(myCursor); - myCursorIsHand = false; - myRotationPointSelection = false; - } - } else - emit mousePressed(this, theEvent); - break; - } - /* notify that we start a transformation */ - if (transformRequested()) - emit vpTransformationStarted(myOperation); - } - if (transformRequested()) - setTransformInProcess(true); - - /* we may need it for sketching... */ - /* if ( l_mbPressEvent ) - delete l_mbPressEvent; - l_mbPressEvent = new QMouseEvent( *theEvent );*/ -} - -//**************************************************************** -void XGUI_ViewWindow::contextMenuEvent(QContextMenuEvent* theEvent) -{ - if (theEvent->modifiers() == Qt::NoModifier) { - // Temporary: has to be removed when viewer popup will be defined - //QFrame::contextMenuEvent(theEvent); - emit contextMenuRequested(theEvent); - } -} - -//**************************************************************** -void XGUI_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) -{ - switch (myOperation) { - case NOTHING: { - int prevState = myCurSketch; - /* if(theEvent->button() == Qt::RightButton) { - QList::Iterator it; - for ( it = mySketchers.begin(); it != mySketchers.end() && myCurSketch != -1; ++it ) { - OCCViewer_ViewSketcher* sk = (*it); - if( ( sk->sketchButton() & theEvent->button() ) && sk->sketchButton() == myCurSketch ) - myCurSketch = -1; - } - } - */ - emit mouseReleased(this, theEvent); - } - break; - case ROTATE: - myViewPort->endRotation(); - resetState(); - break; - - case PANVIEW: - case ZOOMVIEW: - resetState(); - break; - - case PANGLOBAL: - if (theEvent->button() == Qt::LeftButton) { - myViewPort->setCenter(theEvent->x(), theEvent->y()); - myViewPort->getView()->SetScale(myCurScale); - resetState(); - } - break; - - case WINDOWFIT: - if (theEvent->button() == Qt::LeftButton) { - myCurrX = theEvent->x(); - myCurrY = theEvent->y(); - drawRect(); - QRect rect = XGUI_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); - if (!rect.isEmpty()) - myViewPort->fitRect(rect); - endDrawRect(); - resetState(); - } - break; - } - - // NOTE: viewer 3D detects a rectangle of selection using this event - // so we must emit it BEFORE resetting the selection rectangle - if (theEvent->button() == Qt::LeftButton && myDrawRect) { - drawRect(); - endDrawRect(); - resetState(); - myViewPort->update(); - } - /* if ( l_mbPressEvent ) { - delete l_mbPressEvent; - l_mbPressEvent = 0; - }*/ -} - -//**************************************************************** -void XGUI_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) -{ - if (myIsKeyFree && interactionStyle() == XGUI::KEY_FREE) { - myIsKeyFree = false; - switch (getButtonState(theEvent, interactionStyle())) { - case ZOOMVIEW: - myViewPort->startZoomAtPoint(myStartX, myStartY); - activateZoom(); - break; - case PANVIEW: - activatePanning(); - break; - case ROTATE: - activateRotation(); - myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint); - break; - default: - break; - } - } - - myCurrX = theEvent->x(); - myCurrY = theEvent->y(); - switch (myOperation) { - case ROTATE: - myViewPort->rotate(myCurrX, myCurrY, myCurrPointType, mySelectedPoint); - break; - - case ZOOMVIEW: - myViewPort->zoom(myStartX, myStartY, myCurrX, myCurrY); - myStartX = myCurrX; - myStartY = myCurrY; - break; - - case PANVIEW: - myViewPort->pan(myCurrX - myStartX, myStartY - myCurrY); - myStartX = myCurrX; - myStartY = myCurrY; - break; - - case PANGLOBAL: - break; - - default: - if (myRotationPointSelection /*|| isSketcherStyle()*/) { - emit mouseMoving(this, theEvent); - } else { - int aState = theEvent->modifiers(); - int aButton = theEvent->buttons(); - int anInteractionStyle = interactionStyle(); - if (((anInteractionStyle == XGUI::STANDARD) && (aButton == Qt::LeftButton) - && (aState == Qt::NoModifier || Qt::ShiftModifier)) - || ((anInteractionStyle == XGUI::KEY_FREE) && (aButton == Qt::LeftButton) - && (aState == Qt::ControlModifier - || aState == (Qt::ControlModifier | Qt::ShiftModifier)))) { - myDrawRect = myEnableDrawMode; - if (myDrawRect) { - drawRect(); - if (!myCursorIsHand) { // we are going to sketch a rectangle - QCursor handCursor(Qt::PointingHandCursor); - myCursorIsHand = true; - myCursor = cursor(); - myViewPort->setCursor(handCursor); - } - } - emit mouseMoving(this, theEvent); - } /* else if ( ( (anInteractionStyle == XGUI::STANDARD) && - (aButton == Qt::RightButton) && - ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) || - ( (anInteractionStyle == XGUI::KEY_FREE) && - (aButton == Qt::RightButton) && - ( aState == Qt::ControlModifier || aState == ( Qt::ControlModifier|Qt::ShiftModifier ) ) ) ) { - OCCViewer_ViewSketcher* sketcher = 0; - QList::Iterator it; - for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it ) { - OCCViewer_ViewSketcher* sk = (*it); - if( sk->isDefault() && sk->sketchButton() == aButton ) - sketcher = sk; - } - if ( sketcher && myCurSketch == -1 ) { - activateSketching( sketcher->type() ); - if ( mypSketcher ) { - myCurSketch = mypSketcher->sketchButton(); - - if ( l_mbPressEvent ) { - QApplication::sendEvent( getViewPort(), l_mbPressEvent ); - delete l_mbPressEvent; - l_mbPressEvent = 0; - } - QApplication::sendEvent( getViewPort(), theEvent ); - } - } - } */else - emit mouseMoving(this, theEvent); - } - } -} - -/*! - \brief Draw rubber band rectangle. - */ -void XGUI_ViewWindow::drawRect() -{ - if (!myRectBand) { - myRectBand = new XGUI_RectRubberBand(myViewPort); - } - - myRectBand->setUpdatesEnabled(false); - QRect aRect = XGUI_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); - myRectBand->initGeometry(aRect); - - if (!myRectBand->isVisible()) - myRectBand->show(); - - myRectBand->setUpdatesEnabled(true); -} - -/*! - \brief Clear rubber band rectangle on the end on the dragging operation. - */ -void XGUI_ViewWindow::endDrawRect() -{ - if (myRectBand) { - myRectBand->clearGeometry(); - myRectBand->hide(); - } -} - -void XGUI_ViewWindow::activateZoom() -{ - if (!transformRequested() && !myCursorIsHand) - myCursor = cursor(); /* save old cursor */ - - if (myOperation != ZOOMVIEW) { - QPixmap zoomPixmap(imageZoomCursor); - QCursor zoomCursor(zoomPixmap); - if (setTransformRequested(ZOOMVIEW)) - myViewPort->setCursor(zoomCursor); - } -} - -bool XGUI_ViewWindow::transformRequested() const -{ - return (myOperation != NOTHING); -} - -/*! - \brief Start delayed viewer operation. - */ -bool XGUI_ViewWindow::setTransformRequested(OperationType op) -{ - bool ok = transformEnabled(op); - myOperation = ok ? op : NOTHING; - myViewPort->setMouseTracking(myOperation == NOTHING); - return ok; -} - -/*! - Set enabled state of transformation (rotate, zoom, etc) - */ -void XGUI_ViewWindow::setTransformEnabled(const OperationType id, const bool on) -{ - if (id != NOTHING) - myStatus.insert(id, on); -} - -/*! - \return enabled state of transformation (rotate, zoom, etc) - */ -bool XGUI_ViewWindow::transformEnabled(const OperationType id) const -{ - return myStatus.contains(id) ? myStatus[id] : true; -} - -/*! - \brief Start panning operation. - - Sets the corresponding cursor for the widget. - */ -void XGUI_ViewWindow::activatePanning() -{ - if (!transformRequested() && !myCursorIsHand) - myCursor = cursor(); // save old cursor - - if (myOperation != PANVIEW) { - QCursor panCursor(Qt::SizeAllCursor); - if (setTransformRequested(PANVIEW)) - myViewPort->setCursor(panCursor); - } -} - -/*! - \brief Start global panning operation - - Sets the corresponding cursor for the widget. - */ -void XGUI_ViewWindow::activateGlobalPanning() -{ - Handle(V3d_View) aView3d = myViewPort->getView(); - if (!aView3d.IsNull()) { - QPixmap globalPanPixmap(imageCrossCursor); - QCursor glPanCursor(globalPanPixmap); - myCurScale = aView3d->Scale(); - aView3d->FitAll(0.01, false); - myCursor = cursor(); // save old cursor - myViewPort->fitAll(); // fits view before selecting a new scene center - if (setTransformRequested(PANGLOBAL)) - myViewPort->setCursor(glPanCursor); - } -} - -/*! - \brief Start rotation operation - - Sets the corresponding cursor for the widget. - */ -void XGUI_ViewWindow::activateRotation() -{ - if (!transformRequested() && !myCursorIsHand) - myCursor = cursor(); // save old cursor - - if (myOperation != ROTATE) { - QPixmap rotatePixmap(imageRotateCursor); - QCursor rotCursor(rotatePixmap); - if (setTransformRequested(ROTATE)) - myViewPort->setCursor(rotCursor); - } -} - -/*! - \brief Reset the viewport to its initial state - ( no transformations in process etc. ) - */ -void XGUI_ViewWindow::resetState() -{ - myDrawRect = false; - - if (myRotationPointSelection) { - QCursor handCursor(Qt::PointingHandCursor); - myViewPort->setCursor(handCursor); - } else { - if (transformRequested() || myCursorIsHand) - myViewPort->setCursor(myCursor); - myCursorIsHand = false; - } - - if (transformRequested()) - emit vpTransformationFinished(myOperation); - - setTransformInProcess(false); - setTransformRequested(NOTHING); -} - -Qtx::BackgroundData XGUI_ViewWindow::background() const -{ - return myViewPort ? myViewPort->background() : Qtx::BackgroundData(); -} - -void XGUI_ViewWindow::setBackground(const Qtx::BackgroundData& theBackground) -{ - if (myViewPort) - myViewPort->setBackground(theBackground); -} - -/*! - \brief Create one more window with same content. - */ -void XGUI_ViewWindow::cloneView() -{ - QMdiSubWindow* vw = myViewer->createView(); - XGUI_ViewWindow* aNewWnd = static_cast(vw->widget()); - aNewWnd->viewPort()->syncronizeWith(myViewPort); - - emit viewCloned(vw); - - // In order to avoid frosen background in toolbars when it shown as a second view - QTimer::singleShot(20, vw, SLOT(setFocus())); -} - -void XGUI_ViewWindow::dumpView() -{ - QString aFilter(tr("Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps)")); - QString aSelectedFilter; - QString aFileName = QFileDialog::getSaveFileName(this, "Save picture", QString(), aFilter, - &aSelectedFilter); - if (!aFileName.isNull()) { - QApplication::setOverrideCursor(Qt::WaitCursor); - unsigned char* aData = 0; - QImage aPicture = myViewPort->dumpView(aData); - - QString aFmt = XGUI_Tools::extension(aFileName).toUpper(); - if (aFmt.isEmpty()) - aFmt = QString("BMP"); // default format - else if (aFmt == "JPG") - aFmt = "JPEG"; - - Handle(Visual3d_View) a3dView = myViewPort->getView()->View(); - if (aFmt == "PS") -#ifdef WIN32 - a3dView->Export(_strdup(qPrintable(aFileName)), Graphic3d_EF_PostScript); -#else - a3dView->Export(strdup(qPrintable(aFileName)), Graphic3d_EF_PostScript); -#endif - else if (aFmt == "EPS") -#ifdef WIN32 - a3dView->Export(_strdup(qPrintable(aFileName)), Graphic3d_EF_EnhPostScript); -#else - a3dView->Export(strdup(qPrintable(aFileName)), Graphic3d_EF_EnhPostScript); -#endif - else - aPicture.save(aFileName, aFmt.toLatin1()); - delete aData; - QApplication::restoreOverrideCursor(); - } -} - -void XGUI_ViewWindow::fitAll() -{ - emit vpTransformationStarted(FITALLVIEW); - myViewPort->fitAll(); - emit vpTransformationFinished(FITALLVIEW); -} - -/*! - \brief Starts fit operation. - - Sets the corresponding cursor for the widget. - */ -void XGUI_ViewWindow::activateWindowFit() -{ - if (!transformRequested() && !myCursorIsHand) - myCursor = cursor(); /* save old cursor */ - - if (myOperation != WINDOWFIT) { - QCursor handCursor(Qt::PointingHandCursor); - if (setTransformRequested(WINDOWFIT)) { - myViewPort->setCursor(handCursor); - myCursorIsHand = true; - } - } -} - -/*! - \brief Perform "front view" transformation. - */ -void XGUI_ViewWindow::frontView() -{ - emit vpTransformationStarted(FRONTVIEW); - Handle(V3d_View) aView3d = myViewPort->getView(); - if (!aView3d.IsNull()) - aView3d->SetProj(V3d_Xpos); - myViewPort->fitAll(); - emit vpTransformationFinished(FRONTVIEW); -} - -/*! - \brief Perform "back view" transformation. - */ -void XGUI_ViewWindow::backView() -{ - emit vpTransformationStarted(BACKVIEW); - Handle(V3d_View) aView3d = myViewPort->getView(); - if (!aView3d.IsNull()) - aView3d->SetProj(V3d_Xneg); - myViewPort->fitAll(); - emit vpTransformationFinished(BACKVIEW); -} - -/*! - \brief Perform "top view" transformation. - */ -void XGUI_ViewWindow::topView() -{ - emit vpTransformationStarted(TOPVIEW); - Handle(V3d_View) aView3d = myViewPort->getView(); - if (!aView3d.IsNull()) - aView3d->SetProj(V3d_Zpos); - myViewPort->fitAll(); - emit vpTransformationFinished(TOPVIEW); -} - -/*! - \brief Perform "bottom view" transformation. - */ -void XGUI_ViewWindow::bottomView() -{ - emit vpTransformationStarted(BOTTOMVIEW); - Handle(V3d_View) aView3d = myViewPort->getView(); - if (!aView3d.IsNull()) - aView3d->SetProj(V3d_Zneg); - myViewPort->fitAll(); - emit vpTransformationFinished(BOTTOMVIEW); -} - -/*! - \brief Perform "left view" transformation. - */ -void XGUI_ViewWindow::leftView() -{ - emit vpTransformationStarted(LEFTVIEW); - Handle(V3d_View) aView3d = myViewPort->getView(); - if (!aView3d.IsNull()) - aView3d->SetProj(V3d_Yneg); - myViewPort->fitAll(); - emit vpTransformationFinished(LEFTVIEW); -} - -/*! - \brief Perform "right view" transformation. - */ -void XGUI_ViewWindow::rightView() -{ - emit vpTransformationStarted(RIGHTVIEW); - Handle(V3d_View) aView3d = myViewPort->getView(); - if (!aView3d.IsNull()) - aView3d->SetProj(V3d_Ypos); - myViewPort->fitAll(); - emit vpTransformationFinished(RIGHTVIEW); -} - -void XGUI_ViewWindow::reset() -{ - emit vpTransformationStarted(RESETVIEW); - bool upd = myViewPort->getView()->SetImmediateUpdate(false); - myViewPort->getView()->Reset(false); - myViewPort->fitAll(false, true, false); - myViewPort->getView()->SetImmediateUpdate(upd); - myViewPort->getView()->Update(); - emit vpTransformationFinished(RESETVIEW); -} - -void XGUI_ViewWindow::updateToolBar() -{ - myGripWgt->update(); - myViewBar->update(); - myWindowBar->update(); -} - -/*! - \brief Update state of enable draw mode state. - */ -void XGUI_ViewWindow::updateEnabledDrawMode() -{ - myEnableDrawMode = myViewer->isSelectionEnabled() && myViewer->isMultiSelectionEnabled(); -} - -Handle(V3d_View) XGUI_ViewWindow::v3dView() const -{ - return myViewPort->getView(); -} \ No newline at end of file diff --git a/src/XGUI/XGUI_ViewWindow.h b/src/XGUI/XGUI_ViewWindow.h deleted file mode 100644 index f3216a580..000000000 --- a/src/XGUI/XGUI_ViewWindow.h +++ /dev/null @@ -1,367 +0,0 @@ -#ifndef XGUI_ViewWindow_H -#define XGUI_ViewWindow_H - -#include "XGUI.h" -#include "XGUI_Constants.h" - -#include - -#include - -#include -#include -#include -#include -#include - -//#include -//#include - -class XGUI_ViewPort; -class XGUI_Viewer; -class ViewerToolbar; -class ViewerLabel; -class XGUI_RectRubberBand; -class QMdiSubWindow; - -/*! - \class XGUI_ViewWindow - \ingroup GUI - \brief Implements a one view window of 3d viewer object. - It contains a view port object (drawing area) and toolbars for view camera and window management. - Also it managements events in view port - */ -class XGUI_EXPORT XGUI_ViewWindow : public QFrame, public ModuleBase_IViewWindow -{ -Q_OBJECT - public: - //! Types of viewer operations - enum OperationType - { - NOTHING, - PANVIEW, - ZOOMVIEW, - ROTATE, - PANGLOBAL, - WINDOWFIT, - FITALLVIEW, - RESETVIEW, - FRONTVIEW, - BACKVIEW, - TOPVIEW, - BOTTOMVIEW, - LEFTVIEW, - RIGHTVIEW, - CLOCKWISEVIEW, - ANTICLOCKWISEVIEW - }; - - XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType); - - virtual ~XGUI_ViewWindow(); - - //! Returns view port object - XGUI_ViewPort* viewPort() const - { - return myViewPort; - } - - //! Retrurns current interaction style - XGUI::InteractionStyle interactionStyle() const - { - return myInteractionStyle; - } - - //! Disable or enable given operation type - void setTransformEnabled(const OperationType, const bool); - - //! Returns true if the given operation type is enabled - bool transformEnabled(const OperationType) const; - - //! Returns View background object - Qtx::BackgroundData background() const; - - //! Sets View background object - void setBackground(const Qtx::BackgroundData& theBackground); - - //! Returns true if the current view window can be closed - bool closable() const - { - return myClosable; - } - - //! Sets the current view window closable or not - void setClosable(const bool isClosable) - { - myClosable = isClosable; - } - - //! Enable/Disable drawing of ribbon line - void enableDrawMode(bool toEnable) - { - myEnableDrawMode = toEnable; - } - - //! Returns true if ribbon line drawing enabled - bool isDrawModeEnabled() const - { - return myEnableDrawMode; - } - - //! Updates drawing mode in the view window - void updateEnabledDrawMode(); - - /// Returns OCCT object which contains 3d view object - virtual Handle(V3d_View) v3dView() const; - -signals: - //! Emited whien view transformation operation is started - void vpTransformationStarted(XGUI_ViewWindow::OperationType type); - - //! Emited whien view transformation operation is finished - void vpTransformationFinished(XGUI_ViewWindow::OperationType type); - - //void Show(QShowEvent *); - //void Hide(QHideEvent *); - //void maximized(XGUI_ViewWindow*, bool); - //void returnedTo3d(); - - //! Emited before the window closing - void tryClosing(XGUI_ViewWindow*); - - //! Emited when window is closing - void closed(QMdiSubWindow*); - - //! Emited on mouse press in view port - void mousePressed(XGUI_ViewWindow*, QMouseEvent*); - - //! Emited on mouse release in view port - void mouseReleased(XGUI_ViewWindow*, QMouseEvent*); - - //! Emited on mouse double click in view port - void mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*); - - //! Emited on mouse moving in view port - void mouseMoving(XGUI_ViewWindow*, QMouseEvent*); - - //! Emited on key press in view port - void keyPressed(XGUI_ViewWindow*, QKeyEvent*); - - //! Emited on key release in view port - void keyReleased(XGUI_ViewWindow*, QKeyEvent*); - - //! Emited on context menu request in view port - void contextMenuRequested(QContextMenuEvent *e); - - //void viewModified(XGUI_ViewWindow*); - void viewCloned(QMdiSubWindow* theView); - - public slots: - //! Start zooming operation - void activateZoom(); - - //! Start rotation operation - void activateRotation(); - - //! Start panning operation - void activatePanning(); - - //! Start window fit operation - void activateWindowFit(); - - //! Start global panning operation - void activateGlobalPanning(); - - //! Clone the view window preserving a view point of the current view - void cloneView(); - - //! Dump the view window into external file (*.bmp *.png *.jpg *.jpeg *.eps *.ps) - void dumpView(); - - //! Fit all command - void fitAll(); - - //! Set front view - void frontView(); - - //! Set back view - void backView(); - - //! Set top view - void topView(); - - //! Set bottom view - void bottomView(); - - //! Set left view - void leftView(); - - //! Set right view - void rightView(); - - //! Reset point of view - void reset(); - - void windowActivated(); - - void windowDeactivated(); - - protected: - virtual void changeEvent(QEvent* theEvent); - - virtual bool eventFilter(QObject *theObj, QEvent *theEvent); - - virtual void showEvent(QShowEvent* theEvent); - - virtual void contextMenuEvent(QContextMenuEvent* theEvent); - - private slots: - void onClose(); - void onMinimize(); - void onMaximize(); - - void updateToolBar(); -// void repaintToolBar(); - - private: - enum WindowState - { - MinimizedState, - MaximizedState, - WindowNormalState - }; - - bool processWindowControls(QObject *theObj, QEvent *theEvent); - bool processViewPort(QEvent *theEvent); - - void vpMousePressEvent(QMouseEvent* theEvent); - void vpMouseReleaseEvent(QMouseEvent* theEvent); - void vpMouseMoveEvent(QMouseEvent* theEvent); - - OperationType getButtonState(QMouseEvent* theEvent, XGUI::InteractionStyle theInteractionStyle); - - void resetState(); - void drawRect(); - void endDrawRect(); - - bool transformRequested() const; - bool setTransformRequested(OperationType); - - // Transformation is selected and already started - bool transformInProcess() const - { - return myEventStarted; - } - void setTransformInProcess(bool bOn) - { - myEventStarted = bOn; - } - - private: - XGUI_Viewer* myViewer; - - QLabel* myPicture; - ViewerLabel* myGripWgt; - XGUI_ViewPort* myViewPort; - ViewerToolbar* myViewBar; - ViewerToolbar* myWindowBar; - QAction* myMinimizeBtn; - QAction* myMaximizeBtn; - - QIcon MinimizeIco; - QIcon MaximizeIco; - QIcon CloseIco; - QIcon RestoreIco; - - bool myMoving; - QPoint myMousePnt; - - WindowState myLastState; - - int myStartX; - int myStartY; - int myCurrX; - int myCurrY; - - XGUI::InteractionStyle myInteractionStyle; - OperationType myOperation; - XGUI::Mode2dType my2dMode; - - int myCurSketch; - bool myDrawRect; // set when a rect is used for selection or magnify - bool myEnableDrawMode; - bool myRotationPointSelection; - bool myCursorIsHand; - bool myIsKeyFree; - bool myEventStarted; // set when transformation is in process - bool myClosable; - bool myIsActive; - - QCursor myCursor; - - XGUI::RotationPointType myCurrPointType; - XGUI::RotationPointType myPrevPointType; - - gp_Pnt mySelectedPoint; - - XGUI_RectRubberBand* myRectBand; //!< selection rectangle rubber band - - typedef QMap MapOfTransformStatus; - MapOfTransformStatus myStatus; - - double myCurScale; -}; - -//****************************************************** -/*! - \class ViewerToolbar - \ingroup GUI - \brief Provides a toolbar widget with treansparent background over OCCT View window - */ -class ViewerToolbar : public QToolBar -{ -Q_OBJECT - public: - ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort); - - protected slots: - void onViewPortResized() - { - myResize = true; - } - - protected: - virtual void paintEvent(QPaintEvent* theEvent); - - private: - XGUI_ViewPort* myVPort; - bool myResize; -}; - -//****************************************************** -/*! - \class ViewerToolbar - \ingroup GUI - \brief Provides a Label widget with treansparent background over OCCT View window - */ -class ViewerLabel : public QLabel -{ -Q_OBJECT - public: - ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort); - - protected slots: - void onViewPortResized() - { - myResize = true; - } - - protected: - virtual void paintEvent(QPaintEvent* theEvent); - - private: - XGUI_ViewPort* myVPort; - bool myResize; -}; - -#endif diff --git a/src/XGUI/XGUI_Viewer.cpp b/src/XGUI/XGUI_Viewer.cpp deleted file mode 100644 index 47100f7c4..000000000 --- a/src/XGUI/XGUI_Viewer.cpp +++ /dev/null @@ -1,652 +0,0 @@ -#include "XGUI_Viewer.h" -#include "XGUI_MainWindow.h" -#include "XGUI_ViewWindow.h" -#include "XGUI_ViewPort.h" -#include "XGUI_Preferences.h" - -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#endif - -XGUI_Viewer::InteractionStyle2StatesMap XGUI_Viewer::myStateMap; -XGUI_Viewer::InteractionStyle2ButtonsMap XGUI_Viewer::myButtonMap; -static bool isInitialized = false; - -/*! - Creates viewer 3d [ static ] - */ -Handle(V3d_Viewer) CreateViewer(const Standard_ExtString name, const Standard_CString displayName, - const Standard_CString domain, const Standard_Real viewSize, - const V3d_TypeOfOrientation viewProjection, - const Standard_Boolean computedMode, - const Standard_Boolean defaultComputedMode) -{ - static Handle(Graphic3d_GraphicDriver) aGraphicDriver; - if (aGraphicDriver.IsNull()) { - Handle(Aspect_DisplayConnection) aDisplayConnection; -#ifndef WIN32 - aDisplayConnection = new Aspect_DisplayConnection( displayName ); -#else - aDisplayConnection = new Aspect_DisplayConnection(); -#endif - aGraphicDriver = Graphic3d::InitGraphicDriver(aDisplayConnection); - } - - return new V3d_Viewer(aGraphicDriver, name, domain, viewSize, viewProjection, Quantity_NOC_GRAY30, - V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, computedMode, defaultComputedMode, - V3d_TEX_NONE); -} - -// VSR: Uncomment below line to allow texture background support in OCC viewer -#define OCC_ENABLE_TEXTURED_BACKGROUND - -/*! - Get data for supported background modes: gradient types, identifiers and supported image formats - */ -QString XGUI_Viewer::backgroundData(QStringList& gradList, QIntList& idList, QIntList& txtList) -{ - gradList << tr("Horizontal gradient") << tr("Vertical gradient") << tr("First diagonal gradient") - << tr("Second diagonal gradient") << tr("First corner gradient") - << tr("Second corner gradient") << tr("Third corner gradient") - << tr("Fourth corner gradient"); - idList << XGUI::HorizontalGradient << XGUI::VerticalGradient << XGUI::Diagonal1Gradient - << XGUI::Diagonal2Gradient << XGUI::Corner1Gradient << XGUI::Corner2Gradient - << XGUI::Corner3Gradient << XGUI::Corner4Gradient; -#ifdef OCC_ENABLE_TEXTURED_BACKGROUND - txtList << XGUI::CenterTexture << XGUI::TileTexture << XGUI::StretchTexture; -#endif - return tr("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)"); -} - -XGUI_Viewer::XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron) - : QObject(theParent), - myMainWindow(theParent), - myPreselectionEnabled(true), - mySelectionEnabled(true), - myMultiSelectionEnabled(true), - myIsRelative(true), - myInteractionStyle(XGUI::STANDARD), - myTrihedronSize(100), - myActiveView(0), - myWndIdCount(0) -{ - if (!isInitialized) { - isInitialized = true; - - // standard interaction style - XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::ZOOM] = Qt::ControlModifier; - XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::ZOOM] = Qt::LeftButton; - - XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::PAN] = Qt::ControlModifier; - XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::PAN] = Qt::MidButton; - - XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::ROTATE] = Qt::ControlModifier; - XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::ROTATE] = Qt::RightButton; - - XGUI_Viewer::myStateMap[XGUI::STANDARD][XGUI::FIT_AREA] = Qt::ControlModifier; - XGUI_Viewer::myButtonMap[XGUI::STANDARD][XGUI::FIT_AREA] = Qt::RightButton; - - // "key free" interaction style - XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::ZOOM] = Qt::NoModifier; - XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::ZOOM] = Qt::RightButton; - - XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::PAN] = Qt::NoModifier; - XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::PAN] = Qt::MidButton; - - XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::ROTATE] = Qt::NoModifier; - XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::ROTATE] = Qt::LeftButton; - - XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoModifier; // unused - XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoButton; // unused - } - - // init CasCade viewers - myV3dViewer = CreateViewer(TCollection_ExtendedString("Viewer3d").ToExtString(), "", "", 1000.0, - V3d_XposYnegZpos, Standard_True, Standard_True); - myV3dViewer->SetDefaultLights(); - - // init selector - myAISContext = new AIS_InteractiveContext(myV3dViewer); - myAISContext->SelectionColor(Quantity_NOC_WHITE); - - // display isoline on planar faces (box for ex.) - myAISContext->IsoOnPlane(true); - - if (DisplayTrihedron) { - Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(gp::XOY()); - myTrihedron = new AIS_Trihedron(anAxis); - myTrihedron->SetInfiniteState( Standard_True); - - Quantity_Color Col(193 / 255., 205 / 255., 193 / 255., Quantity_TOC_RGB); - myTrihedron->SetArrowColor(Col.Name()); - myTrihedron->SetSize(myTrihedronSize); - Handle(AIS_Drawer) drawer = myTrihedron->Attributes(); - if (drawer->HasDatumAspect()) { - Handle(Prs3d_DatumAspect) daspect = drawer->DatumAspect(); - daspect->FirstAxisAspect()->SetColor(Quantity_Color(1.0, 0.0, 0.0, Quantity_TOC_RGB)); - daspect->SecondAxisAspect()->SetColor(Quantity_Color(0.0, 1.0, 0.0, Quantity_TOC_RGB)); - daspect->ThirdAxisAspect()->SetColor(Quantity_Color(0.0, 0.0, 1.0, Quantity_TOC_RGB)); - } - } - // set zooming style to standard - //myZoomingStyle = 0; - - QMdiArea* aMDI = myMainWindow->mdiArea(); - connect(aMDI, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, - SLOT(onWindowActivated(QMdiSubWindow*))); - -} - -XGUI_Viewer::~XGUI_Viewer(void) -{ - myAISContext.Nullify(); - myV3dViewer.Nullify(); -} - -QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType) -{ - // create view frame - XGUI_ViewWindow* view = new XGUI_ViewWindow(this, theType); - // get main view window (created by view frame) - //OCCViewer_ViewWindow* vw = view->getView(OCCViewer_ViewFrame::MAIN_VIEW); - // initialize main view window - //initView( vw ); - // set default background for view window - //vw->setBackground( background(0) ); // 0 means MAIN_VIEW (other views are not yet created here) - // connect signal from viewport - //connect(view->viewPort(), SIGNAL(vpClosed()), this, SLOT(onViewClosed())); - //connect(view->viewPort(), SIGNAL(vpMapped()), this, SLOT(onViewMapped())); - if (myViews.size() == 0) - setTrihedronShown(true); - - Qtx::BackgroundData aBk = XGUI_Preferences::resourceMgr()->backgroundValue("Viewer", - "background"); - view->setBackground(aBk); - view->updateEnabledDrawMode(); - - QMdiArea* aMDI = myMainWindow->mdiArea(); - QMdiSubWindow* aWnd = aMDI->addSubWindow(view, Qt::FramelessWindowHint); - addView(aWnd); - aWnd->setGeometry(0, 0, aMDI->width() / 2, aMDI->height() / 2); - aWnd->show(); - aWnd->setWindowTitle(QString("Viewer #%1").arg(++myWndIdCount)); - emit viewCreated(view); - return aWnd; -} - -void XGUI_Viewer::updateFromResources() -{ - Qtx::BackgroundData aBk = XGUI_Preferences::resourceMgr()->backgroundValue("Viewer", - "background"); - foreach (QMdiSubWindow* aWnd, myViews) - { - XGUI_ViewWindow* aView = dynamic_cast(aWnd->widget()); - if (aView) - aView->setBackground(aBk); - } -} - -XGUI_ViewWindow* XGUI_Viewer::activeViewWindow() const -{ - if (myActiveView) - return dynamic_cast(myActiveView->widget()); - return 0; -} - -void XGUI_Viewer::getSelectedObjects(AIS_ListOfInteractive& theList) -{ - theList.Clear(); - for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected()) - theList.Append(myAISContext->SelectedInteractive()); -} - -void XGUI_Viewer::getSelectedShapes(NCollection_List& theList) -{ - Handle(AIS_InteractiveContext) ic = AISContext(); - - for (ic->InitSelected(); ic->MoreSelected(); ic->NextSelected()) { - TopoDS_Shape aShape = ic->SelectedShape(); - if (!aShape.IsNull()) - theList.Append(aShape); - } -} - -void XGUI_Viewer::setObjectsSelected(const AIS_ListOfInteractive& theList) -{ - AIS_ListIteratorOfListOfInteractive aIt; - for (aIt.Initialize(theList); aIt.More(); aIt.Next()) - myAISContext->AddOrRemoveSelected(aIt.Value(), false); - myAISContext->UpdateCurrentViewer(); -} - -/*! Sets hot button - *\param theOper - hot operation - *\param theState - adding state to state map operations. - *\param theButton - adding state to button map operations. - */ -void XGUI_Viewer::setHotButton(XGUI::InteractionStyle theInteractionStyle, - XGUI::HotOperation theOper, Qt::KeyboardModifiers theState, - Qt::MouseButtons theButton) -{ - myStateMap[theInteractionStyle][theOper] = theState; - myButtonMap[theInteractionStyle][theOper] = theButton; -} - -/*! Gets hot button for operation \a theOper. - *\param theOper - input hot operation - *\param theState - output state from state map operations. - *\param theButton - output state from button map operations. - */ -void XGUI_Viewer::getHotButton(XGUI::InteractionStyle theInteractionStyle, - XGUI::HotOperation theOper, Qt::KeyboardModifiers& theState, - Qt::MouseButtons& theButton) -{ - theState = myStateMap[theInteractionStyle][theOper]; - theButton = myButtonMap[theInteractionStyle][theOper]; -} - -/*! - Changes visibility of trihedron to opposite - */ -void XGUI_Viewer::toggleTrihedron() -{ - setTrihedronShown(!isTrihedronVisible()); -} - -/*! - \return true if trihedron is visible - */ -bool XGUI_Viewer::isTrihedronVisible() const -{ - return !myTrihedron.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed(myTrihedron); -} - -/*! - Sets visibility state of trihedron - \param on - new state - */ - -void XGUI_Viewer::setTrihedronShown(bool on) -{ - if (myTrihedron.IsNull()) - return; - - if (on) { - myAISContext->Display(myTrihedron); - myAISContext->Deactivate(myTrihedron); - } else { - myAISContext->Erase(myTrihedron); - } -} - -/*! - \return trihedron size - */ -double XGUI_Viewer::trihedronSize() const -{ - double sz = 0; - if (!myTrihedron.IsNull()) - sz = myTrihedron->Size(); - return sz; -} - -/*! - Changes trihedron size - \param sz - new size - */ -void XGUI_Viewer::setTrihedronSize(const double sz, bool isRelative) -{ - if (myTrihedronSize != sz || isRelative != myIsRelative) { - myTrihedronSize = sz; - myIsRelative = isRelative; - updateTrihedron(); - } -} - -/*! - * Update the size of the trihedron - */ -void XGUI_Viewer::updateTrihedron() -{ - if (myTrihedron.IsNull()) - return; - - if (myIsRelative) { - double newSz, oldSz; - - if (computeTrihedronSize(newSz, oldSz)) - myTrihedron->SetSize(newSz); - - } else if (myTrihedron->Size() != myTrihedronSize) { - myTrihedron->SetSize(myTrihedronSize); - } -} - -/*! - Get new and current trihedron size corresponding to the current model size - */ -bool XGUI_Viewer::computeTrihedronSize(double& theNewSize, double& theSize) -{ - theNewSize = 100; - theSize = 100; - - //SRN: BUG IPAL8996, a usage of method ActiveView without an initialization - Handle(V3d_Viewer) viewer = v3dViewer(); - viewer->InitActiveViews(); - if (!viewer->MoreActiveViews()) - return false; - - Handle(V3d_View) view3d = viewer->ActiveView(); - //SRN: END of fix - - if (view3d.IsNull()) - return false; - - double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0; - double aMaxSide; - - view3d->View()->MinMaxValues(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); - - if (Xmin == RealFirst() || Ymin == RealFirst() || Zmin == RealFirst() || Xmax == RealLast() - || Ymax == RealLast() || Zmax == RealLast()) - return false; - - aMaxSide = Xmax - Xmin; - if (aMaxSide < Ymax - Ymin) - aMaxSide = Ymax - Ymin; - if (aMaxSide < Zmax - Zmin) - aMaxSide = Zmax - Zmin; - - // IPAL21687 - // The boundary box of the view may be initialized but nullified - // (case of infinite objects) - if (aMaxSide < Precision::Confusion()) - return false; - - static float EPS = (float) 5.0E-3; - theSize = trihedron()->Size(); - //theNewSize = aMaxSide*aSizeInPercents / 100.0; - - return fabs(theNewSize - theSize) > theSize * EPS || fabs(theNewSize - theSize) > theNewSize * EPS; -} - -void XGUI_Viewer::onViewClosed(QMdiSubWindow* theView) -{ - if (!theView) - return; - - emit deleteView(static_cast(theView->widget())); - removeView(theView); - - // if this is last view - if (myViews.size() == 0) { - Standard_Integer aViewsNb = 0; - for (myV3dViewer->InitActiveViews(); myV3dViewer->MoreActiveViews(); - myV3dViewer->NextActiveViews()) - ++aViewsNb; - if (aViewsNb < 2) { - //clean up presentations before last view is closed - myAISContext->RemoveAll(Standard_False); - } - } -} - -/*!Remove view window \a theView from view manager. - *And close the last view, if it has \a theView. - */ -void XGUI_Viewer::removeView(QMdiSubWindow* theView) -{ - XGUI_ViewWindow* aWindow = static_cast(theView->widget()); - - aWindow->disconnect(this); - myViews.removeAt(myViews.indexOf(theView)); - if (myActiveView == theView) - myActiveView = 0; - if (myViews.size() == 0) - emit lastViewClosed(); -} - -/*void XGUI_Viewer::onViewMapped() - { - setTrihedronShown(true); - }*/ - -void XGUI_Viewer::addView(QMdiSubWindow* theView) -{ - XGUI_ViewWindow* aWindow = dynamic_cast(theView->widget()); - - connect(aWindow, SIGNAL(closed(QMdiSubWindow*)), this, SLOT(onViewClosed(QMdiSubWindow*))); - - connect(aWindow, SIGNAL(tryClosing(XGUI_ViewWindow*)), this, - SIGNAL(tryCloseView(XGUI_ViewWindow*))); - - connect(aWindow, SIGNAL(mousePressed(XGUI_ViewWindow*, QMouseEvent*)), this, - SLOT(onMousePressed(XGUI_ViewWindow*, QMouseEvent*))); - - connect(aWindow, SIGNAL(mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*)), this, - SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*))); - - connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)), this, - SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*))); - - connect(aWindow, SIGNAL(keyPressed(XGUI_ViewWindow*, QKeyEvent*)), this, - SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*))); - - connect(aWindow, SIGNAL(keyReleased(XGUI_ViewWindow*, QKeyEvent*)), this, - SLOT(onKeyRelease(XGUI_ViewWindow*, QKeyEvent*))); - - //connect(aWindow, SIGNAL(contextMenuRequested( QContextMenuEvent* )), - // this, SLOT (onContextMenuRequested( QContextMenuEvent* ))); - connect(aWindow, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, - SIGNAL(contextMenuRequested(QContextMenuEvent*))); - - connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*))); - - connect(aWindow, SIGNAL(mouseReleased(XGUI_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseReleased(XGUI_ViewWindow*, QMouseEvent*))); - - myViews.append(theView); -} - -/*! - Emit activated for view \a view. - */ -void XGUI_Viewer::onWindowActivated(QMdiSubWindow* view) -{ - if (view && (view != myActiveView) && (!view->isMinimized())) { - myActiveView = view; - ((XGUI_ViewWindow*) myActiveView->widget())->windowActivated(); - QList::iterator aIt; - for (aIt = myViews.begin(); aIt != myViews.end(); ++aIt) { - if ((*aIt) != myActiveView) { - ((XGUI_ViewWindow*) (*aIt)->widget())->windowDeactivated(); - } - } - } -} - -void XGUI_Viewer::onWindowMinimized(QMdiSubWindow* theWnd) -{ - if (myActiveView == theWnd) { - myActiveView = 0; - QList::iterator aIt; - for (aIt = myViews.begin(); aIt != myViews.end(); ++aIt) { - if (!(*aIt)->widget()->isMinimized()) { - (*aIt)->raise(); - onWindowActivated(*aIt); - break; - } - } - } -} - -/*! - SLOT: called on mouse button press, stores current mouse position as start point for transformations - */ -void XGUI_Viewer::onMousePressed(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent) -{ - myStartPnt.setX(theEvent->x()); - myStartPnt.setY(theEvent->y()); - emit mousePress(theWindow, theEvent); -} - -/*! - SLOT: called on mouse move, processes hilighting - */ -void XGUI_Viewer::onMouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent) -{ - myCurPnt.setX(theEvent->x()); - myCurPnt.setY(theEvent->y()); - if (!mySelectionEnabled) - return; - - Handle(V3d_View) aView3d = theWindow->viewPort()->getView(); - if (!aView3d.IsNull()) { - myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d); - if (myAISContext->HasDetected()) - theWindow->viewPort()->setFocus(Qt::MouseFocusReason); - } -} - -/*! - SLOT: called on mouse button release, finishes selection - */ -void XGUI_Viewer::onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent) -{ - if (!mySelectionEnabled || theEvent->button() != Qt::LeftButton) { - emit mouseRelease(theWindow, theEvent); - return; - } - - myEndPnt.setX(theEvent->x()); - myEndPnt.setY(theEvent->y()); - bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); - - //if (!aHasShift) - // emit deselection(); - - if (myStartPnt == myEndPnt) { - // the MoveTo is necessary for the second click in the same point. Otherwise the selection is lost. - //Handle(V3d_View) aView3d = theWindow->viewPort()->getView(); - //if (!aView3d.IsNull()) { - // myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d); - //} - if (aHasShift && myMultiSelectionEnabled) - myAISContext->ShiftSelect(); - else - myAISContext->Select(); - } else { - if (aHasShift && myMultiSelectionEnabled) - myAISContext->ShiftSelect(myStartPnt.x(), myStartPnt.y(), myEndPnt.x(), myEndPnt.y(), - theWindow->viewPort()->getView(), false); - else - myAISContext->Select(myStartPnt.x(), myStartPnt.y(), myEndPnt.x(), myEndPnt.y(), - theWindow->viewPort()->getView(), false); - - int Nb = myAISContext->NbSelected(); - if (Nb > 1 && !myMultiSelectionEnabled) { - myAISContext->InitSelected(); - Handle( SelectMgr_EntityOwner ) anOwner = myAISContext->SelectedOwner(); - if (!anOwner.IsNull()) { - myAISContext->ClearSelected( Standard_False); - myAISContext->AddOrRemoveSelected(anOwner, Standard_False); - } - } - - myAISContext->UpdateCurrentViewer(); - } - emit mouseRelease(theWindow, theEvent); - emit selectionChanged(); -} - -//****************************************************** -void XGUI_Viewer::setMultiSelectionEnabled(bool toEnable) -{ - myMultiSelectionEnabled = toEnable; - updateViewsDrawMode(); -} - -//****************************************************** -void XGUI_Viewer::setSelectionEnabled(bool toEnable) -{ - mySelectionEnabled = toEnable; - updateViewsDrawMode(); -} - -//****************************************************** -void XGUI_Viewer::updateViewsDrawMode() const -{ - foreach(QMdiSubWindow* aWnd, myViews) - { - XGUI_ViewWindow* aView = static_cast(aWnd->widget()); - aView->updateEnabledDrawMode(); - } -} - -//****************************************************** -void XGUI_Viewer::onKeyRelease(XGUI_ViewWindow* theView, QKeyEvent* theKey) -{ - Handle(V3d_View) aView = theView->viewPort()->getView(); - bool noModifiers = (theKey->modifiers() == Qt::NoModifier); - if ((theKey->key() == Qt::Key_N) && noModifiers) { - myAISContext->HilightNextDetected(aView); - } else if ((theKey->key() == Qt::Key_P) && noModifiers) { - myAISContext->HilightPreviousDetected(aView); - } else { - emit keyRelease(theView, theKey); - } -} - -//****************************************************** -//void XGUI_Viewer::onContextMenuRequested(QContextMenuEvent* theEvent) -//{ -// XGUI_ViewWindow* aWnd = dynamic_cast(sender()); -// if (!aWnd) return; -// -// QMenu aMenu; -// -// // Include Viewer actions -// if (myActions.size() > 0) { -// aMenu.addActions(myActions); -// aMenu.addSeparator(); -// } -// if (aWnd->actions().size() > 0) { -// aMenu.addActions(aWnd->actions()); -// aMenu.addSeparator(); -// } -// -// QMdiArea* aMDI = myMainWindow->mdiArea(); -// if (aMenu.actions().size() > 0) { -// QMenu* aSubMenu = aMenu.addMenu(tr("Windows")); -// aSubMenu->addActions(aMDI->actions()); -// } else { -// aMenu.addActions(aMDI->actions()); -// } -// aMenu.exec(theEvent->globalPos()); -//} diff --git a/src/XGUI/XGUI_Viewer.h b/src/XGUI/XGUI_Viewer.h deleted file mode 100644 index 2cc4c02c0..000000000 --- a/src/XGUI/XGUI_Viewer.h +++ /dev/null @@ -1,225 +0,0 @@ -#ifndef XGUI_Viewer_H -#define XGUI_Viewer_H - -#include "XGUI.h" -#include "XGUI_Constants.h" -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -class XGUI_MainWindow; -class QMdiSubWindow; -class XGUI_ViewWindow; -class QMouseEvent; -class QKeyEvent; - -class AIS_ListOfInteractive; - -/**\class XGUI_Viewer - * \ingroup GUI - * \brief Represents a 3d viewer. The viewer manages 3d scene and a set of view windows - * when each of view window is a one point of view on this scene. - */ -class XGUI_EXPORT XGUI_Viewer : public QObject -{ -Q_OBJECT - public: - static QString backgroundData(QStringList&, QIntList&, QIntList&); - - XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true); - ~XGUI_Viewer(); - - //! Creates a new view window - QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC); - - //! Return pointer on a main window - parent of the Viewer - XGUI_MainWindow* mainWindow() const - { - return myMainWindow; - } - - //! Returns OCCT object which manages 3d scene - Handle(V3d_Viewer) v3dViewer() const - { - return myV3dViewer; - } - - //! Returns OCCT object which manages displaying and selection in 3d scene - Handle(AIS_InteractiveContext) AISContext() const - { - return myAISContext; - } - - //! Returns an active view window or NULL - XGUI_ViewWindow* activeViewWindow() const; - - /// Return objects selected in 3D viewer - /// \param theList - list to be filled with selected objects - void getSelectedObjects(AIS_ListOfInteractive& theList); - - /// Return shapes selected in 3D viewer - /// \param theList - list to be filled with selected shapes - void getSelectedShapes(NCollection_List& theList); - - /// Selects objects in 3D viewer. Other selected objects are left as selected - /// \param theList - list objects to be selected - void setObjectsSelected(const AIS_ListOfInteractive& theList); - - /// Returns true if selection in the viewer is enabled - bool isSelectionEnabled() const - { - return mySelectionEnabled; - } - - /// Enable or disable selectioon in the viewer - // \param toEnable - true or false (enable or disable selection) - void setSelectionEnabled(bool toEnable); - - /// Returns true if multi-selection in the viewer is enabled - bool isMultiSelectionEnabled() const - { - return myMultiSelectionEnabled; - } - - /// Enable or disable selectioon in the viewer - // \param toEnable - true or false (enable or disable selection) - void setMultiSelectionEnabled(bool toEnable); - - /// Select the object in 3D viewer. - /// \param theIO - list objects to be selected - void setSelected(const Handle(AIS_InteractiveObject)& theIO) - { - myAISContext->SetSelected(theIO); - } - - //! Trihedron 3d object shown in the viewer - Handle(AIS_Trihedron) trihedron() const - { - return myTrihedron; - } - - //! On/Off visibility of the trihedron object - void toggleTrihedron(); - - //! Returns true if trihedron is visible - bool isTrihedronVisible() const; - - //! Returns true if trihedron is visible - void setTrihedronShown(bool on); - - //! Returns trihedron size - double trihedronSize() const; - - //! Sets trihedron size - void setTrihedronSize(const double sz, bool isRelative); - - bool trihedronRelative() const - { - return myIsRelative; - } - //! Update trihedron - void updateTrihedron(); - - //! Compute trihedron size dependent on 3d scene size - bool computeTrihedronSize(double& theNewSize, double& theSize); - - //! Add action to the viewer - void addAction(QAction* theAction) - { - myActions.append(theAction); - } - - void updateFromResources(); - - static void setHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper, - Qt::KeyboardModifiers theState, Qt::MouseButtons theButton); - static void getHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper, - Qt::KeyboardModifiers& theState, Qt::MouseButtons& theButton); - - typedef QMap StatesMap; - typedef QMap ButtonsMap; - - typedef QMap InteractionStyle2StatesMap; - typedef QMap InteractionStyle2ButtonsMap; - - static InteractionStyle2StatesMap myStateMap; - static InteractionStyle2ButtonsMap myButtonMap; - -signals: - void lastViewClosed(); - void tryCloseView(XGUI_ViewWindow* theWindow); - void deleteView(XGUI_ViewWindow* theWindow); - void viewCreated(XGUI_ViewWindow* theWindow); - void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent); - void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent); - void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent); - void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent); - void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent); - void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent); - void activated(XGUI_ViewWindow* theWindow); - void selectionChanged(); - - void contextMenuRequested(QContextMenuEvent*); - - public slots: - void onWindowMinimized(QMdiSubWindow*); - void onWindowActivated(QMdiSubWindow*); - - private slots: - void onViewClosed(QMdiSubWindow*); - void onMouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent); - void onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent); - void onMousePressed(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent); - //void onContextMenuRequested(QContextMenuEvent* theEvent); - - void onKeyRelease(XGUI_ViewWindow* theView, QKeyEvent* theKey); - - private: - void addView(QMdiSubWindow* theView); - - /*! Removes the View from internal Views list.*/ - void removeView(QMdiSubWindow* theView); - - void updateViewsDrawMode() const; - - private: - XGUI_MainWindow* myMainWindow; - - Handle(V3d_Viewer) myV3dViewer; - Handle(AIS_Trihedron) myTrihedron; - Handle(AIS_InteractiveContext) myAISContext; - - XGUI::InteractionStyle myInteractionStyle; - - bool myPreselectionEnabled; - bool mySelectionEnabled; - bool myMultiSelectionEnabled; - bool myIsRelative; - - double myTrihedronSize; - - QList myViews; - - QMdiSubWindow* myActiveView; - - /// Points used for selection management - QPoint myStartPnt, myEndPnt, myCurPnt; - - /// A counter of created windows - int myWndIdCount; - - /// List of Viewer actions - QList myActions; -}; - -#endif diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index ffd09a2a5..74fab1c2b 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -1,12 +1,13 @@ #include "XGUI_ViewerProxy.h" #include "XGUI_Workshop.h" -#include "XGUI_MainWindow.h" -#include "XGUI_ViewPort.h" -#include "XGUI_ViewWindow.h" -#include "XGUI_Viewer.h" #include "XGUI_SalomeConnector.h" #include "XGUI_Displayer.h" +#include +#include +#include +#include + XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent) : ModuleBase_IViewer(theParent), myWorkshop(theParent) @@ -36,7 +37,7 @@ Handle(V3d_View) XGUI_ViewerProxy::activeView() const if (myWorkshop->isSalomeMode()) { return myWorkshop->salomeConnector()->viewer()->activeView(); } else { - XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); + AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); return (aViewer->activeViewWindow()) ? aViewer->activeViewWindow()->viewPort()->getView() : Handle(V3d_View)(); } @@ -57,7 +58,7 @@ void XGUI_ViewerProxy::fitAll() if (myWorkshop->isSalomeMode()) { myWorkshop->salomeConnector()->viewer()->fitAll(); } else { - XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); + AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); if (aViewer->activeViewWindow()) aViewer->activeViewWindow()->viewPort()->fitAll(); } @@ -104,39 +105,39 @@ void XGUI_ViewerProxy::connectToViewer() SIGNAL(contextMenuRequested(QContextMenuEvent*))); } else { - XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); + AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed())); - connect(aViewer, SIGNAL(tryCloseView(XGUI_ViewWindow*)), - this, SLOT(onTryCloseView(XGUI_ViewWindow*))); + connect(aViewer, SIGNAL(tryCloseView(AppElements_ViewWindow*)), + this, SLOT(onTryCloseView(AppElements_ViewWindow*))); - connect(aViewer, SIGNAL(deleteView(XGUI_ViewWindow*)), - this, SLOT(onDeleteView(XGUI_ViewWindow*))); + connect(aViewer, SIGNAL(deleteView(AppElements_ViewWindow*)), + this, SLOT(onDeleteView(AppElements_ViewWindow*))); - connect(aViewer, SIGNAL(viewCreated(XGUI_ViewWindow*)), - this, SLOT(onViewCreated(XGUI_ViewWindow*))); + connect(aViewer, SIGNAL(viewCreated(AppElements_ViewWindow*)), + this, SLOT(onViewCreated(AppElements_ViewWindow*))); - connect(aViewer, SIGNAL(activated(XGUI_ViewWindow*)), - this, SLOT(onActivated(XGUI_ViewWindow*))); + connect(aViewer, SIGNAL(activated(AppElements_ViewWindow*)), + this, SLOT(onActivated(AppElements_ViewWindow*))); - connect(aViewer, SIGNAL(mousePress(XGUI_ViewWindow*, QMouseEvent*)), this, - SLOT(onMousePress(XGUI_ViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mousePress(AppElements_ViewWindow*, QMouseEvent*)), this, + SLOT(onMousePress(AppElements_ViewWindow*, QMouseEvent*))); - connect(aViewer, SIGNAL(mouseRelease(XGUI_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseRelease(XGUI_ViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mouseRelease(AppElements_ViewWindow*, QMouseEvent*)), this, + SLOT(onMouseRelease(AppElements_ViewWindow*, QMouseEvent*))); - connect(aViewer, SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*)), this, + SLOT(onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*))); - connect(aViewer, SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)), this, - SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*))); + connect(aViewer, SIGNAL(mouseMove(AppElements_ViewWindow*, QMouseEvent*)), this, + SLOT(onMouseMove(AppElements_ViewWindow*, QMouseEvent*))); - connect(aViewer, SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*)), this, - SLOT(onKeyPress(XGUI_ViewWindow*, QKeyEvent*))); + connect(aViewer, SIGNAL(keyPress(AppElements_ViewWindow*, QKeyEvent*)), this, + SLOT(onKeyPress(AppElements_ViewWindow*, QKeyEvent*))); - connect(aViewer, SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)), this, - SLOT(onKeyRelease(XGUI_ViewWindow*, QKeyEvent*))); + connect(aViewer, SIGNAL(keyRelease(AppElements_ViewWindow*, QKeyEvent*)), this, + SLOT(onKeyRelease(AppElements_ViewWindow*, QKeyEvent*))); connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, @@ -145,52 +146,52 @@ void XGUI_ViewerProxy::connectToViewer() } -void XGUI_ViewerProxy::onTryCloseView(XGUI_ViewWindow* theWnd) +void XGUI_ViewerProxy::onTryCloseView(AppElements_ViewWindow* theWnd) { emit tryCloseView(theWnd); } -void XGUI_ViewerProxy::onDeleteView(XGUI_ViewWindow* theWnd) +void XGUI_ViewerProxy::onDeleteView(AppElements_ViewWindow* theWnd) { emit deleteView(theWnd); } -void XGUI_ViewerProxy::onViewCreated(XGUI_ViewWindow* theWnd) +void XGUI_ViewerProxy::onViewCreated(AppElements_ViewWindow* theWnd) { emit viewCreated(theWnd); } -void XGUI_ViewerProxy::onActivated(XGUI_ViewWindow* theWnd) +void XGUI_ViewerProxy::onActivated(AppElements_ViewWindow* theWnd) { emit activated(theWnd); } -void XGUI_ViewerProxy::onMousePress(XGUI_ViewWindow* theWnd, QMouseEvent* theEvent) +void XGUI_ViewerProxy::onMousePress(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) { emit mousePress(theWnd, theEvent); } -void XGUI_ViewerProxy::onMouseRelease(XGUI_ViewWindow* theWnd, QMouseEvent* theEvent) +void XGUI_ViewerProxy::onMouseRelease(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) { emit mouseRelease(theWnd, theEvent); } -void XGUI_ViewerProxy::onMouseDoubleClick(XGUI_ViewWindow* theWnd, QMouseEvent* theEvent) +void XGUI_ViewerProxy::onMouseDoubleClick(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) { emit mouseDoubleClick(theWnd, theEvent); } -void XGUI_ViewerProxy::onMouseMove(XGUI_ViewWindow* theWnd, QMouseEvent* theEvent) +void XGUI_ViewerProxy::onMouseMove(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent) { emit mouseMove(theWnd, theEvent); } -void XGUI_ViewerProxy::onKeyPress(XGUI_ViewWindow* theWnd, QKeyEvent* theEvent) +void XGUI_ViewerProxy::onKeyPress(AppElements_ViewWindow* theWnd, QKeyEvent* theEvent) { emit keyPress(theWnd, theEvent); } -void XGUI_ViewerProxy::onKeyRelease(XGUI_ViewWindow* theWnd, QKeyEvent* theEvent) +void XGUI_ViewerProxy::onKeyRelease(AppElements_ViewWindow* theWnd, QKeyEvent* theEvent) { emit keyRelease(theWnd, theEvent); } diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index f3872f86c..c5ae4ef90 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -5,7 +5,7 @@ #include class XGUI_Workshop; -class XGUI_ViewWindow; +class AppElements_ViewWindow; /** * Proxy class which repersents or XGUI_Viewer or Salome Viewer @@ -62,18 +62,18 @@ Q_OBJECT virtual void clearSelectionFilters(); private slots: - void onTryCloseView(XGUI_ViewWindow*); - void onDeleteView(XGUI_ViewWindow*); - void onViewCreated(XGUI_ViewWindow*); - void onActivated(XGUI_ViewWindow*); - - void onMousePress(XGUI_ViewWindow*, QMouseEvent*); - void onMouseRelease(XGUI_ViewWindow*, QMouseEvent*); - void onMouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*); - void onMouseMove(XGUI_ViewWindow*, QMouseEvent*); - - void onKeyPress(XGUI_ViewWindow*, QKeyEvent*); - void onKeyRelease(XGUI_ViewWindow*, QKeyEvent*); + void onTryCloseView(AppElements_ViewWindow*); + void onDeleteView(AppElements_ViewWindow*); + void onViewCreated(AppElements_ViewWindow*); + void onActivated(AppElements_ViewWindow*); + + void onMousePress(AppElements_ViewWindow*, QMouseEvent*); + void onMouseRelease(AppElements_ViewWindow*, QMouseEvent*); + void onMouseDoubleClick(AppElements_ViewWindow*, QMouseEvent*); + void onMouseMove(AppElements_ViewWindow*, QMouseEvent*); + + void onKeyPress(AppElements_ViewWindow*, QKeyEvent*); + void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*); private: XGUI_Workshop* myWorkshop; diff --git a/src/XGUI/XGUI_Workbench.cpp b/src/XGUI/XGUI_Workbench.cpp deleted file mode 100644 index 8826b335f..000000000 --- a/src/XGUI/XGUI_Workbench.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include "XGUI_Workbench.h" -#include "XGUI_MenuGroupPanel.h" - -#include -#include -#include - -#define SCROLL_STEP 20 - -//************************************************** -class CommandsArea : public QScrollArea -{ - public: - CommandsArea(QWidget* theParent) - : QScrollArea(theParent) - { - } - - protected: - virtual void resizeEvent(QResizeEvent * theEvent); -}; - -void CommandsArea::resizeEvent(QResizeEvent* theEvent) -{ - int x = widget()->x(); - QScrollArea::resizeEvent(theEvent); - QRect aRect = widget()->childrenRect(); - QSize aNewSize = theEvent->size(); - if (aRect.width() > aNewSize.width()) - aNewSize.setWidth(aRect.width() * 2); - widget()->resize(aNewSize); - widget()->move(x, 0); -} - -//************************************************** -XGUI_Workbench::XGUI_Workbench(QWidget *theParent) - : QWidget(theParent) -{ - setMinimumHeight(30); - QHBoxLayout* aMainLayout = new QHBoxLayout(this); - aMainLayout->setSpacing(0); - aMainLayout->setMargin(0); - aMainLayout->setContentsMargins(0, 0, 0, 0); - - myLeftButton = new QPushButton("<", this); - myLeftButton->setMaximumWidth(14); - myLeftButton->setVisible(false); - connect(myLeftButton, SIGNAL(clicked()), this, SLOT(onLeftScroll())); - aMainLayout->addWidget(myLeftButton); - - myCommandsArea = new CommandsArea(this); - aMainLayout->addWidget(myCommandsArea); - myCommandsArea->viewport()->installEventFilter(this); - - myChildWidget = new QWidget(myCommandsArea); - myCommandsArea->setWidget(myChildWidget); - myCommandsArea->setAlignment(Qt::AlignLeft | Qt::AlignTop); - myCommandsArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - myCommandsArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - myLayout = new QHBoxLayout(myChildWidget); - myLayout->setSpacing(0); - myLayout->setMargin(0); - myLayout->setContentsMargins(0, 0, 0, 0); - - myRightButton = new QPushButton(">", this); - myRightButton->setMaximumWidth(14); - myRightButton->setVisible(false); - connect(myRightButton, SIGNAL(clicked()), this, SLOT(onRightScroll())); - aMainLayout->addWidget(myRightButton); - -} - -/* - * Creates a new group in the workbench with given object name. - */ -XGUI_MenuGroupPanel* XGUI_Workbench::addGroup(const QString& theId) -{ - if (!myLayout->isEmpty()) { - int aNb = myLayout->count(); - QLayoutItem* aItem = myLayout->itemAt(aNb - 1); - myLayout->removeItem(aItem); - } - XGUI_MenuGroupPanel* aGroup = new XGUI_MenuGroupPanel(myChildWidget); - aGroup->setObjectName(theId); - myLayout->addWidget(aGroup); - if (theId != "Default") { - addSeparator(); - } - myLayout->addStretch(); - myGroups.append(aGroup); - return aGroup; -} - -/* - * Searches for already created group with given name. - */ -XGUI_MenuGroupPanel* XGUI_Workbench::findGroup(const QString& theId) -{ - XGUI_MenuGroupPanel* aPanel; - foreach(aPanel, myGroups) - { - if (aPanel->objectName() == theId) { - return aPanel; - } - } - return NULL; -} - -void XGUI_Workbench::addSeparator() -{ - QFrame* aLine = new QFrame(myChildWidget); - aLine->setFrameShape(QFrame::VLine); - aLine->setFrameShadow(QFrame::Sunken); - myLayout->addWidget(aLine); -} - -void XGUI_Workbench::resizeEvent(QResizeEvent* theEvent) -{ - QWidget::resizeEvent(theEvent); - QSize aSize = theEvent->size(); - myLeftButton->setMinimumHeight(aSize.height() - 2); - myRightButton->setMinimumHeight(aSize.height() - 2); - - QSize aS = myChildWidget->sizeHint(); - int aW = myChildWidget->width(); - if (aW < aS.width()) - myChildWidget->resize(aS.width(), myChildWidget->height()); - - myLeftButton->setVisible(isExceedsLeft()); - myRightButton->setVisible(isExceedsRight()); -} - -void XGUI_Workbench::onLeftScroll() -{ - if (!isExceedsLeft()) - return; - myChildWidget->move(myChildWidget->pos().x() + SCROLL_STEP, 0); - myLeftButton->setVisible(isExceedsLeft()); - myRightButton->setVisible(isExceedsRight()); -} - -void XGUI_Workbench::onRightScroll() -{ - if (!isExceedsRight()) - return; - myChildWidget->move(myChildWidget->pos().x() - SCROLL_STEP, 0); - myLeftButton->setVisible(isExceedsLeft()); - myRightButton->setVisible(isExceedsRight()); -} - -bool XGUI_Workbench::isExceedsLeft() -{ - QPoint aPos = myChildWidget->pos(); - return (aPos.x() < 0); -} - -bool XGUI_Workbench::isExceedsRight() -{ - QPoint aPos = myChildWidget->pos(); - int aVPWidth = myCommandsArea->viewport()->rect().width(); - int aWgtWidth = myChildWidget->childrenRect().width(); - return ((aVPWidth - aPos.x()) < aWgtWidth); -} - -bool XGUI_Workbench::eventFilter(QObject *theObj, QEvent *theEvent) -{ - if (theObj == myCommandsArea->viewport()) { - if (theEvent->type() == QEvent::Resize) { - myLeftButton->setVisible(isExceedsLeft()); - myRightButton->setVisible(isExceedsRight()); - } - } - return QWidget::eventFilter(theObj, theEvent); -} - -XGUI_Command* XGUI_Workbench::feature(const QString& theId) const -{ - QList::const_iterator aIt; - for (aIt = myGroups.constBegin(); aIt != myGroups.constEnd(); ++aIt) { - XGUI_Command* aCmd = (*aIt)->feature(theId); - if (aCmd) - return aCmd; - } - return 0; -} - -QList XGUI_Workbench::features() const -{ - QList aList; - foreach (XGUI_MenuGroupPanel* aGroup, myGroups) - { - aList.append(aGroup->features()); - } - return aList; -} diff --git a/src/XGUI/XGUI_Workbench.h b/src/XGUI/XGUI_Workbench.h deleted file mode 100644 index 7ede0b98f..000000000 --- a/src/XGUI/XGUI_Workbench.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef XGUI_Workbench_H -#define XGUI_Workbench_H - -#include "XGUI.h" -#include -#include -#include - -class XGUI_Command; -class XGUI_MenuGroupPanel; -class CommandsArea; - -class QHBoxLayout; -class QPushButton; - -class XGUI_EXPORT XGUI_Workbench : public QWidget -{ -Q_OBJECT - public: - XGUI_Workbench(QWidget* theParent); - - XGUI_MenuGroupPanel* addGroup(const QString& theId); - XGUI_MenuGroupPanel* findGroup(const QString& theName); - - //! Returns already created command by its ID - XGUI_Command* feature(const QString& theId) const; - - //! Returns list of created commands - QList features() const; - - private slots: - void onLeftScroll(); - void onRightScroll(); - - protected: - virtual void resizeEvent(QResizeEvent * theEvent); - virtual bool eventFilter(QObject *theObj, QEvent *theEvent); - - private: - void addSeparator(); - bool isExceedsLeft(); - bool isExceedsRight(); - - QWidget* myChildWidget; - QHBoxLayout* myLayout; - QList myGroups; - - CommandsArea* myCommandsArea; - QPushButton* myRightButton; - QPushButton* myLeftButton; -}; - -#endif diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 301839bf2..81389750e 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1,13 +1,6 @@ -#include "ModuleBase_IModule.h" -#include "XGUI_Constants.h" -#include "XGUI_Command.h" -#include "XGUI_MainMenu.h" -#include "XGUI_MainWindow.h" -#include "XGUI_MenuGroupPanel.h" +//#include "XGUI_Constants.h" #include "XGUI_Tools.h" -#include "XGUI_Workbench.h" #include "XGUI_Workshop.h" -#include "XGUI_Viewer.h" #include "XGUI_SelectionMgr.h" #include "XGUI_Selection.h" #include "XGUI_ObjectsBrowser.h" @@ -20,9 +13,18 @@ #include "XGUI_PropertyPanel.h" #include "XGUI_ContextMenuMgr.h" #include "XGUI_ModuleConnector.h" -#include "XGUI_Preferences.h" #include +#include +#include +#include +#include +#include +#include + +#include +#include + #include #include #include @@ -33,7 +35,7 @@ #include #include -#include +//#include #include #include @@ -122,7 +124,7 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) myUpdatePrefs(false), myPartActivating(false) { - myMainWindow = mySalomeConnector ? 0 : new XGUI_MainWindow(); + myMainWindow = mySalomeConnector ? 0 : new AppElements_MainWindow(); myDisplayer = new XGUI_Displayer(this); @@ -187,7 +189,7 @@ void XGUI_Workshop::startApplication() registerValidators(); // Calling of loadCustomProps before activating module is required // by Config_PropManger to restore user-defined path to plugins - XGUI_Preferences::loadCustomProps(); + ModuleBase_Preferences::loadCustomProps(); activateModule(); if (myMainWindow) { myMainWindow->show(); @@ -234,9 +236,9 @@ void XGUI_Workshop::initMenu() return; } // File commands group - XGUI_MenuGroupPanel* aGroup = myMainWindow->menuObject()->generalPage(); + AppElements_MenuGroupPanel* aGroup = myMainWindow->menuObject()->generalPage(); - XGUI_Command* aCommand; + AppElements_Command* aCommand; aCommand = aGroup->addFeature("SAVE_CMD", tr("Save..."), tr("Save the document"), QIcon(":pictures/save.png"), QKeySequence::Save); @@ -284,9 +286,9 @@ void XGUI_Workshop::initMenu() } //****************************************************** -XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName) +AppElements_Workbench* XGUI_Workshop::addWorkbench(const QString& theName) { - XGUI_MainMenu* aMenuBar = myMainWindow->menuObject(); + AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); return aMenuBar->addWorkbench(theName); } @@ -650,14 +652,14 @@ void XGUI_Workshop::addFeature(const std::shared_ptr& the myModule->actionCreated(aAction); } else { - XGUI_MainMenu* aMenuBar = myMainWindow->menuObject(); - XGUI_Workbench* aPage = aMenuBar->findWorkbench(aWchName); + AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); + AppElements_Workbench* aPage = aMenuBar->findWorkbench(aWchName); if (!aPage) { aPage = addWorkbench(aWchName); } //Find or create Group QString aGroupName = QString::fromStdString(theMessage->groupId()); - XGUI_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName); + AppElements_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName); if (!aGroup) { aGroup = aPage->addGroup(aGroupName); } @@ -666,7 +668,7 @@ void XGUI_Workshop::addFeature(const std::shared_ptr& the QKeySequence aHotKey = myActionsMgr->registerShortcut( QString::fromStdString(theMessage->keysequence())); // Create feature... - XGUI_Command* aCommand = aGroup->addFeature(aFeatureId, + AppElements_Command* aCommand = aGroup->addFeature(aFeatureId, QString::fromStdString(theMessage->text()), QString::fromStdString(theMessage->tooltip()), QIcon(theMessage->icon().c_str()), @@ -690,7 +692,7 @@ void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation) if (isSalomeMode()) { aCommand = salomeConnector()->command(theOperation->getDescription()->operationId()); } else { - XGUI_MainMenu* aMenu = myMainWindow->menuObject(); + AppElements_MainMenu* aMenu = myMainWindow->menuObject(); FeaturePtr aFeature = theOperation->feature(); if(aFeature) aCommand = aMenu->feature(QString::fromStdString(aFeature->getKind())); @@ -890,17 +892,17 @@ void XGUI_Workshop::onRebuild() //****************************************************** void XGUI_Workshop::onPreferences() { - XGUI_Prefs aModif; - XGUI_Preferences::editPreferences(aModif); + ModuleBase_Prefs aModif; + ModuleBase_Preferences::editPreferences(aModif); if (aModif.size() > 0) { QString aSection; - foreach (XGUI_Pref aPref, aModif) + foreach (ModuleBase_Pref aPref, aModif) { aSection = aPref.first; - if (aSection == XGUI_Preferences::VIEWER_SECTION) { + if (aSection == ModuleBase_Preferences::VIEWER_SECTION) { if (!isSalomeMode()) myMainWindow->viewer()->updateFromResources(); - } else if (aSection == XGUI_Preferences::MENU_SECTION) { + } else if (aSection == ModuleBase_Preferences::MENU_SECTION) { if (!isSalomeMode()) myMainWindow->menuObject()->updateFromResources(); } @@ -987,8 +989,8 @@ void XGUI_Workshop::updateCommandStatus() if (isSalomeMode()) { // update commands in SALOME mode aCommands = salomeConnector()->commandList(); } else { - XGUI_MainMenu* aMenuBar = myMainWindow->menuObject(); - foreach (XGUI_Command* aCmd, aMenuBar->features()) + AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); + foreach (AppElements_Command* aCmd, aMenuBar->features()) aCommands.append(aCmd); } SessionPtr aMgr = ModelAPI_Session::get(); @@ -1027,8 +1029,8 @@ QList XGUI_Workshop::getModuleCommands() const if (isSalomeMode()) { // update commands in SALOME mode aCommands = salomeConnector()->commandList(); } else { - XGUI_MainMenu* aMenuBar = myMainWindow->menuObject(); - foreach(XGUI_Command* aCmd, aMenuBar->features()) + AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); + foreach(AppElements_Command* aCmd, aMenuBar->features()) { aCommands.append(aCmd); } @@ -1074,9 +1076,9 @@ void XGUI_Workshop::createDockWidgets() aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel); myPropertyPanel->installEventFilter(myOperationMgr); - QPushButton* aOkBtn = myPropertyPanel->findChild(XGUI::PROP_PANEL_OK); + QPushButton* aOkBtn = myPropertyPanel->findChild(PROP_PANEL_OK); connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation())); - QPushButton* aCancelBtn = myPropertyPanel->findChild(XGUI::PROP_PANEL_CANCEL); + QPushButton* aCancelBtn = myPropertyPanel->findChild(PROP_PANEL_CANCEL); connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation())); connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr, SLOT(onKeyReleased(QKeyEvent*))); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 2805b712a..fd02a8bba 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 "XGUI_Constants.h" +//#include "XGUI_Constants.h" #include #include #include @@ -13,9 +13,10 @@ #include #include -class XGUI_MainWindow; -class XGUI_Command; -class XGUI_Workbench; +class AppElements_MainWindow; +class AppElements_Command; +class AppElements_Workbench; + class XGUI_SelectionMgr; class XGUI_Displayer; class XGUI_OperationMgr; @@ -60,7 +61,7 @@ Q_OBJECT void startApplication(); //! Returns main window (Desktop) of the application - XGUI_MainWindow* mainWindow() const + AppElements_MainWindow* mainWindow() const { return myMainWindow; } @@ -103,7 +104,7 @@ Q_OBJECT } //! Creates and adds a new workbench (menu group) with the given name and returns it - XGUI_Workbench* addWorkbench(const QString& theName); + AppElements_Workbench* addWorkbench(const QString& theName); //! Redefinition of Events_Listener method virtual void processEvent(const std::shared_ptr& theMessage); @@ -266,7 +267,7 @@ signals: // Creates Dock widgets: Object browser and Property panel void createDockWidgets(); - XGUI_MainWindow* myMainWindow; + AppElements_MainWindow* myMainWindow; ModuleBase_IModule* myModule; XGUI_ObjectsBrowser* myObjectBrowser; XGUI_PropertyPanel* myPropertyPanel; diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index 1e001dc7c..b7c79dd9b 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -8,28 +8,6 @@ pictures/undo.png pictures/rebuild.png pictures/preferences.png - - pictures/occ_view_back.png - pictures/occ_view_bottom.png - pictures/occ_view_camera_dump.png - pictures/occ_view_clone.png - pictures/occ_view_fitall.png - pictures/occ_view_fitarea.png - pictures/occ_view_front.png - pictures/occ_view_left.png - pictures/occ_view_pan.png - pictures/occ_view_glpan.png - pictures/occ_view_reset.png - pictures/occ_view_right.png - pictures/occ_view_rotate.png - pictures/occ_view_top.png - pictures/occ_view_zoom.png - - pictures/wnd_close.png - pictures/wnd_minimize.png - pictures/wnd_maximize.png - pictures/wnd_restore.png - pictures/wnd_grip.png pictures/params_folder.png pictures/constr_folder.png @@ -51,14 +29,9 @@ pictures/button_help.png pictures/button_ok.png - pictures/cascade_views.png - pictures/tile_views.png - pictures/new_view.png pictures/edit.png - pictures/exec_state_failed.png pictures/exec_state_invalid_parameters.png - pictures/assembly.png pictures/activate.png pictures/delete.png diff --git a/src/XGUI/pictures/cascade_views.png b/src/XGUI/pictures/cascade_views.png deleted file mode 100644 index db4511144eb0c2b27a29dc9384d53844494cef52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 535 zcmV+y0_gpTP)2T?Dsw(ZNx0Q=CPR>LM;8{u?eT7DUiRClSF>2RG-UwzMH6z4Kk#w3R06 zgK){+z3+bSeHWH2UR}ln&nqbW7MwBEU0F)U%tH6P(8&jdSxCyKJ)yy9L2!nhi-){a z$`@-3G?c_}ybo)qPjH=TxPT_$943j-IjWmPG$b&R=!b1raI&({K9Pl%K?w%`K_WbQ znHv*u8w!@-*gSuR=hh;7Vdx|hp^}yD$&!$=xj^~&v>iB34adv#G^4;GWf%++*}Z(s zi}oBTY|M^g>r5gOGqHX9PK`s4i1x~(LywlmX_V*)sHTmQgs4H7$_x^2uQPg^rcDo+ zB%mOAtfQ_jPQ>WR;;(RtL}+VT-RUq=yuQ3ZMO+L<7}GN|&`t=iR=FSAzs~iUM#ppt zE18UJBkQ`gqI$HtPGc&yclFdXoBP9HA`TfLzykpqME3CJO@Drr%RY(GB1u`6->fhj zf@*bzBA^aPtYVAA5HS8|qDgmw5y20SiR6yOlR1~%kSglWY$mIEq zd1wa9lmjj$O1n-dMW!h0xyZ1#>WJL^Dc`~ED0nAj>e5HqPqVc4^HD-C^K(U#nyw_JVM?A(oBgHn44{KIC_?)>&DI5^z-r|2fdZM zDk^zwmv{0@EK2pZ-|(fnukO5H`vrd0K$Xs9M+wep?>_x}GwI>d^`=HHPuJVCF63}v z`E!59-m>1tQwa z?ULr9Y@;RZ{MagRTIDQ}?T6BCLW_IzCA00=3$kqHe{Fb}#@X2?=agoL9 zOHVD&oFsix8|%6MtQOtr_ZQ4u^Wo~JO1*WzcP|R_wDQfa_Abbd=Dzn%?be}d zk1j8<|I_pDtJ2e_f{CAWH=bL#U%)$fd1h3ItiY+g<^m4<8DZxqte>}VV}jk?12yJp zUrzky*>-Pn?0<%fuYU>!r<*Ttsqafre>)>h)HBT3&r8koq{-Shy@kow)P#51S;f}Y zJxq&S9elNESJcm{^fy2EwzfWPkFVjqeeuew6{ojkq?Kl_in(}BWLwya$ii=or5`?( zTF(hnW4+#Z-O>Cv`&^y%-$Huo(txR5wZt`|BqgyV)hf9t6-Y4{85kPq8W`ys8iW`a zS{a#G834IvK=PZ%yCxJ3x%nxXX_Y_?2FALEhPp=PA%><_riNCgCJ+tD?gdYP8W=oX L{an^LB{Ts5v|FYf diff --git a/src/XGUI/pictures/occ_view_back.png b/src/XGUI/pictures/occ_view_back.png deleted file mode 100644 index 51beb0c73e5fa109819e0d38cacb60c467e540b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!Y85oZ=>2VsZ z*|B4WqSelM8i#wf{7CTOSGdP0;NbJ3?dMNl#apQghtI|SW_jEcbAlNt8e+u5$H3Gf zD54n^6{T{VXH(*w9)HIxEDCW90uCPxT*~IIdR4n8u|p(Jf$t^q z>bS!nR-h>-40+fb+8DXnCM1eC{NOkd(7=$iXi}o}f-m6>3`*9o6ODOP_yimhm>Zui zG}`hbQ1Rdy@qqk8yv&RZ3{8?JcvHL^y5xm;{xF$-(cYxsz+f1(n~QY85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^Kks#{Byti(=V~&Kyry>ftU@4rc>h5?ccECN?~SvV9{NplD|gqRB`G_1%| z0J`JBB!;6Vb_>@1<5+D007H_2!PC{x JWt~$(699I+gjE0l diff --git a/src/XGUI/pictures/occ_view_camera_dump.png b/src/XGUI/pictures/occ_view_camera_dump.png deleted file mode 100644 index b02616f2975e7a3865a236ee75380bdae5ce59f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 682 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!GAr-fh{`~)M&uq%*z+h+?Aj!ZYz}<83#0idNZ{NHLm{arOf}-0Di4NZr z4h;-Rj?WrQvR=Mwyy^F?%;4dFDJdx)KR>?&vt5iYrhzo>YRaCjpLk={x^?G1e0dpc zAf2Wt^rJsV!+{}D;>9cZGar846mH{Q?tkd0S>BzF%TD3t{4*BXIQ-IfVA%M8i#s*c zlr1kVj?FMpku6S6PGNSxV@Sx9M(Gn`0zzpIgandKboIMkOJX=8&cMX6ys@Kkl!Hi5Cs~Z*GuUfUrsH3ynxPybcSy{#2e*VG@J6ax= z#n~Osp1^ImwK3)gt3rdprHAi&vk!iGdwaWNpPVI=nU9lGQ{we?u{?kG+WrXQ(cn=9 z+IG10^fX=PhwiSfjl8q1O0@zxr4<@xOt_qoo~}Mam+y-f$9#+0wuLz-jo8f1&D+fL z?z+m40n#|u4mYG61ddHVaiyUq`r4~d9q8ZdYn zozP=;ncaEPUC6S9SjZ)j11xdTOVx|PwNDx OD+W(jKbLh*2~7Z6;rO)x diff --git a/src/XGUI/pictures/occ_view_clone.png b/src/XGUI/pictures/occ_view_clone.png deleted file mode 100644 index 441482d205ef6e04cff83702e3dffa48cad36280..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 441 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!-v3#%^mv{$y}th4;LG>j22D2@7>_Us*Zlq_=-C#s zYEDYRj;g7RiPv=64t;PfC~RP8lGf1Cai7$<`5yCC?^YuN6BCBHJJ|L31RM&OfB!Z; z`E67C@e~Vbg@%X?o|A;imJ`U!$JxT8>BqEDi*Z^1rtpt-1)%5 zD(=8wD7g5->O#efZA>fzj?8nl(kG;7I4}sB6vS7v9qyOEFS+gNap6=2pu&m5VLxKH z1srsaNHKl3VrN&s6OglxjYB~!DW-Xy;PgZV2B6%HP5c}Z>emc9v{xiu?a;SjWa?m@ z^iIK*pQEA6NPySq&C}-FD((6X3=h8;ZQR(!$H3Il*?5Wp=x7d6_a#gX3`s1Zj8|9~ b7}*#co=2>4HtstE3}yyTS3j3^P6z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;rb$FWRCwBA{Qv(y12q9a0I`6G?+lD6rgAd;XCy{5 zHhlmA#Dc^@mIHB63}s|w3&>x^7VEp$V z!_S{T8NPo0%wTSB4^{^=10aA{2t*_sGYc!&H9+&gF8uxbH^cX@Ux5bxVEFUvH&_hp zNhkmaASMC^p1OMBJi~90i+=rL`10u!!-sco89u&$$ME^%M~1IozA)UpbP22urU4*; z81W@+U>Ndq^YVU}wt5|dps+B*k8j@@e*E~(@bkwHhQELQGJN^`k)bg^7i72+(46}q zJpciO*M(YIT7fc>k_-*mnGENS9|s!*!oPv8y?^^ALw|iO$gn1uVITkyKn&QD3J3!Y zt1#5l`yc4!^j}9?`#%#C(;-P2+5cJwhW{mHWkKFL1H{Sb`Tzn5YousvYge$bu(Yd+ zi!(g^@BtL?iGTn8T>uOM_2*9>%K?=<1!}&AO)o$IVT2*juu`C5U1~tXo&y8^?Uyf= zSFc{}AhvJ-2p}dj!}3{~naMT`1ONgE>_SkfVWO=i2{i0E$eXW$2^NUUfQEGwYY@l` zP;LPTAh-*gnwp;TadI-eff!amiebp56hHvMT?i_^fL=}k3i1H)bfAI1NHGa!20#G8 u4Wv>5%K#8S$g%vNP}zvfo5&o100RIgKz|e1YHVKs0000aa diff --git a/src/XGUI/pictures/occ_view_fitarea.png b/src/XGUI/pictures/occ_view_fitarea.png deleted file mode 100644 index 450dc56c6ce722c040b4e5b77459207e8256cd58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 912 zcmV;B18@9^P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<21!IgRCwBA`2YVu0|yT@j4)mLY4&S1Wi z-OcbHM57sG48)m^9-he_0f7usvT_X1pFT0(yLC(8&W#(k0Oh^{@n4u?fB<44!Y5g^ z-MvYH5s?faC;S8YMon9X!N%2{!P42~V^d*1!@s|O;pPAY5EB8zLY%$4ll;RYzy^Ww zzyAz>|Nmq7`|lrvqn8hZdq5CKT`^1pKmZXkFx1h@8)yK~5THSSfQEqa-+v50fBt0n z`uQ`1xxGC|T`bJU00BhE%bd(CtYFsw%>%pe_wU~f-@kqZ8u)|Z&#&KLF(43ts^eU0F)F)_Iu>vs%)X>*Rt^|Sq00D$yAS*L-7tFAGPoM68`t<2NpzvEDJ`2PkgPEZQ zf?W3=>e4ST{Qv>Pgyb@bC5sj@fV}w<7@K#WJlO{{>@HC171XfPKztRHl%RYNeIJNF z01K4gATvM(3qSzDi!W_$?G#}ip4rTdj11l(AtV=F=_OOZ1q?s{!3|_&WMorRR4o7X z>z4u0Wlx|ky9mWEfcQ5q!$2+r83v*O0tneaP`Ky0YCsD8wiRZ mF(6igmT$M9kwFpw2rvMsC6+#;$I7?>0000Y85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^Kks#{Byti(=V~&Kyry>ftU@fIOolmwP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZc>jKeOv$OzL15I`)*h9FA-UC3*1Z~uwm?OTSQ4<0bQ ze(?e}13&j7BtjOg8oBY{u_wj195)S?b{&f6+rwNh(Uq* zK0ZGF9!TB4fBzVey$%pSph#d!NlE$3!NI}s_3KxL7r?*=#V#=XRDg2aKr9Qy%0Mg# zwcu`6R@RnZzkY$$K7Ra|;oiM_44*%L1}7(g00Oy$^}~k`3@Z!_7=WS-7i47_^npo& z_1d*NKskL-Yy$BYAm#zl;o;#2riOWv!1Q5tTw%b52J!EBN z_zMj9Ye2(a0MpVAL405VabQDXA%mWt-g{_beh*a#GW3?PurN#?D4ah51P}|7@?T7UooaWF76FUtY(e=N8Ih<%~* zEa-Xx0ti>}^$+SLM<6zX=4AnBQUWFN&ro@cDgYqB0GrW?VpB4t`v3p{07*qoM6N<$ Eg6tg6&Hw-a diff --git a/src/XGUI/pictures/occ_view_left.png b/src/XGUI/pictures/occ_view_left.png deleted file mode 100644 index 1b787b0433413a7117083cefce238d0219b55484..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 427 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!cxAr-fh{`~)M&uq%*z_77_!_Cc2#L?H+cT&#Iy1!N(L5z>Y85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^KmC#?I{d9c7Xy4CLo`8t9#9wE>E{s2+a6pwJL8 z;qV!cZhoyh-WMEl+8P-g7!Dp5xLNA`-0Tsr^OAzYKsOvY;*iQ9;1FUipwO@)Pr-p9 z@UBAx!=hb{AX~kiLciL@^}c%5zoCnnMWC&*WfBk1fh!J^FNg)$u|3iU+0>VK;-z4O zK?Bcjh9m9{ZA>fz!c%!}GcMf^WGSz(xpL`}($0V*X%ZeX3JnL?m`*#VW_(=i)HG9n z!Mzq~HYNr}7UK!hC#Ero+N((XV9k0Fp5oZRkhG*sltCbY;YM8g@#-Jb&H@9L!PC{x JWt~$(69BoFkt+ZI diff --git a/src/XGUI/pictures/occ_view_pan.png b/src/XGUI/pictures/occ_view_pan.png deleted file mode 100644 index ec56cacc779342a978f183ecf747860c8b6dafb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 982 zcmV;{11bE8P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZb!otG-18H_3W&!c>DFz52f`;Yh z=KlYG@Zf(vJw1@2;y}!e&rpB>!e<*(Vq)UoNnv3OZ?0TnIIE=v5_imOsnQ(>_Q@}D9Q|HpzmfY=u#@9*!A5&HlE#0WDiKR^HPSD@Ek zzkbaCa@oa;7a4y4{_O{p(+6UCAm#(&Px|`$DQaqJ3~X#{4Da5(V|e)RA;Yz6*FdiR z0t!=r00NsF6BF}yLQoI`!>?Zq4Bx&nFns>Zz!(z)vWNqS-$A_va>-9lVB{=URRycP zpsdWG&(6-kdhOZ^SVRE?5Q~nE&fmqMp$spM9AUWs@+E@^Q1mI#KqwFe;@8la1=_~I z2J*$jJ9ilVe*DOA?ZXF#7k~dU%-7RnNW63j9QyzP#B$}z6$wUv{}&HSOBrrFdBPyW z&(HAr=TDe{d{D#gLnA=o6)=Lf|NhPJ2I#_XKyN<>8oU@7aj@722p~`x$^o%15O2W} zQ4K(R5QwirT?%sXD=g|(05K?CodF0SP#A)o^9gFhL?B)Zjj^{zMn(Vgg6j zxpU_jK79D#4wN$jVr3vsfvN|&{yoSXfB<5F#?CWnLd}P!GmwE_`1tr3R)vHxJUVoU z;RMiI;U7Ty82F(McnHLu(3}E_l-nS400M{wntfhCo&E)yX#avZ-#{@A45MF<9x;Hz z4lSY{BV~fOP)EH02p|@y4KPE$Kyv_tjEu~^`}glN965WI;l_&>3~!m4VFpeGVn3)0 zVaeeeEFA&_5G?D#4E+fW52hzio+tt7dm^Ah;l~e#JMZ4X4D5u`pP`QU2lWw%{s$01 zxUwNTH0uR`vRkc+3M|{L0pd2OxFS>?3IGToW*i2Bk`pV``xg$qd*=yF8X#vr0J$9M zy07T20tg^xJOwPwRUpGpK{Y>y#^wX4;lH73-~b@N0A_|Q{Wj4Xb^rhX07*qoM6N<$ Ef)-GsSpWb4 diff --git a/src/XGUI/pictures/occ_view_reset.png b/src/XGUI/pictures/occ_view_reset.png deleted file mode 100644 index 66f81e60471b7b587c37166a4e206b45f74e7fc2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 918 zcmV;H18Mw;P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<3`s;mRCwBA`2YVu0}KO!sHi9>h~bSaP6`GHAOZXQ009Iu ztVK?a_y6WCKL3CH$@>5IfA;^Iw`2aBnTdlW&7exTp@zi+u{AD30Ro7Lk&#hUNQk5Q z?D;STpjR1~nHj+nii&(-KGfwPzyqZXfLH~Ij{*P!hzW=@vvYJAfQEtvwrzdL@b~Y3 zhTx#>3=Q?CrT~SeL)CtP(l4O+3pN7*0*D2Ojg5^(!JOKflMHLu++jF%N|j;rru$QX z!I2B}0Zi>zGy}h4GY}wvKrZ|XauEp3n0^K5WhREsj&mSx69e%89{T_R1ajfcn>Rmz zIq%;60AXz)^A6B;zi?=K-}sfC-?tzTH62r z+1dZM`}+RpVPyp=a)o&VAb=Q=3jlDg;ox}n@#jy5zyJSR0p*SZ#Xz=e0L9NFXlO8m zC@V8qN=Sg!-~8}_;lk_J40EqvXW0Gtu^UimH$VWPmo_{g8)rH={0C|R3ET$aE+9^W z#_sAO0|T(@KsZfX8>D6hvI_wMh!MSr0=mcm=$i9OU0oSe`1u*u-@C_f=i^5PHYO$p zdueHgKqVyxW?=4l`t>V=_OfLRAAkK40Gja;rXL`H7_pRjAVWa`o#`Ya<56K`#Na9` ziz0vj(Y85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^Kks#{Byti(=V~-rU*hZ=iRg)dnc)qI&oNgF=IZ z+e1T-)tEt-^Qz2HlD1A~(F>qKK76+Qun1m?!43yrq?2vj_HMm!+@5HB-h z14EPK3EmX%hAw#_o&BefBz>vE(*)?7Fuoo~q89ZJ6T-G@yGywqE CrHFz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;>`6pHRCwBA{Qv(y12R~;bm{-kpFcBXWMnWhkO2S! zh!NSqB}nm z_#K0zqZ|V(D=WjUUAu@f7$ATcKn6xcL;xu(AT|MFC6Lhn$B!BQ-@VK5ALvjZpYgx7 zwe^1|C#U~lNjw-JfZz;ORn`9w9x(jhw~yifBP`+xG}xButP{r|6^ zpz#0SKaeu^{~*hO@{?f(!3+aofB<4dk7WS?0kC9s^&AE_w@?O<^q)V#kOc;9VxlU; z?b~;NzENS&)YJs4-?V8HO4tGf5EFWs{`m1Dg_)Td7#X2pgMR&j81~}_14CcmZ3Z

_Vnz58}j`-1H-p(2n+(i@MQS?`!|ES zx;=;+j;t9VfLO2?s3j(*3Dyh@GoVI@D?x^T`SOK;2)s#xwr&D>UEJd0|XE@ z1Al$^@Qag!gA?p!NcjC^`1I*D!^e*=zzTrof(`uo^&N=&7g;kv0AVxm!p)nP>@QyI zX7KP>0Cd@Bpld$>4SWSQ@aolD3??S}49d!`4A-yk1*t!dtQjDHFbs5aa|0V@W77-F zdJn*cefjbZY~bh5AVYyp`ui6w_wwaUkd`&b`T+t6ZlIr^-+x##0LI+pFJF3c^!0s# zhP?qA1j4U@?6*KeAl|)m=P)pg|7HPG#V=$70RjjmmBTPF(TW1`G$keD|2{qy|2;iR z|J&Lo{r~WR;lH7w;eQ?;eo(@0$CmW~0tj!u1Z6QGzQNBg3e1Mm|F2(X_^+$03o^_G zmmYusVjz^+p$5wVu`v)3EF1s=2qWuJ3IGC#iGj)hAb_ZDAV7ct0CqnRZB|4ZssI20 M07*qoM6N<$f-H}K!2kdN diff --git a/src/XGUI/pictures/occ_view_top.png b/src/XGUI/pictures/occ_view_top.png deleted file mode 100644 index cef95040afe84ada0bd453b6e4057004c3d75c5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 419 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!Y85oZ=>2Vsp zxwF;ZMLKQCQTF62hL3y=3`vWw7|74>G|)TIY6Dc`qI&oNgF-{Zgu^^1f3h%|9d-cn z9wfeaZqBN=VpY}rhu?Bt=d|VCn$jH1r_eA%Vg(NaQ^zYdCKiFKyeu3FtE4#u974O2ZYzRgvtQ98zfuwPaa_K;WgpRWqg{f@Q+Er!RLuY+Z?$@R^}5MxE*R( zQZyVG3mdKI;Vst0Grx_ AY5)KL diff --git a/src/XGUI/pictures/occ_view_zoom.png b/src/XGUI/pictures/occ_view_zoom.png deleted file mode 100644 index 386c966d156f0a6f53e780aed211b78aa473a11b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 797 zcmV+&1LFLNP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;lSxEDRCwBA{Qv(y12q9a05LI882|(j3yAp6z=+{Y zPKN)C$b3dd#y}ty1;mO#{0NBG0DZR%T^~RIu^?$iH}pTm97baxo$2V|nd}h|$RH&v z$MF2=6XU&Gw*&&^{D5-Pfd(IhX#xl!22dE{!$2^nw!8QLxyR4`p9SL6kDmTN`QXX_ zWA`8bZ*#;G5q}bli};<&kW}F_F#1|4FCbe zLcl;aW)@bkYk=l~UHJR=Z-(z*zXA>X!SLtTZ?G6R8lV6mfC#zp)YS{;8GeIY^y?SH zmrtJL&@bUdShR+{AGJO5=h2iF{4FCbeh%aFS!;qhwm-oZ8)$14pg@qY@ zeEZJuHQCMa{8~Mt^J>giRqA}jO>3c z1H=E4va%p=odM!xbbSB;gf&vMwY4kQSXkOs#l;z(e)s?i_{6_||1JOqf%@|&kL7?$ zo&q&r!=@J?fH1-kXjm!Gur4*AVb6g9|Mtt5%Bxqec3{&C%ChKL6d-_@&RKiH#D= b009O7QZ{F9XF19?00000NkvXXu0mjfwM|pG diff --git a/src/XGUI/pictures/tile_views.png b/src/XGUI/pictures/tile_views.png deleted file mode 100644 index fd9fece1221534dea9d3fc6709f0398611f044b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 422 zcmV;X0a^ZuP)htDI%U@pu01-?@m5{AQFX z*|*NYHy^?`A)o|M@RVyY$?UVRC13R#Y&i#?|pA>6LkhUH~2Y8M=*S#ttS1Q(J-YnK#j1dP$J z!KV!B%P^|niP&eDl!#85X0@I+)ZDBTQBIQ0EwIn7!ie$368sgnjOll?Z zS1iLwe7xUx^2y|aIrT(z QOaK4?07*qoM6N<$g3@}odH?_b diff --git a/src/XGUI/pictures/wnd_close.png b/src/XGUI/pictures/wnd_close.png deleted file mode 100644 index 74b9af91927d834d01fd0d7d54ce2c9a3a42d76b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 779 zcmV+m1N8ifP)91j^EtPTT1|U8QuVY?eYHqKSSK zP3o7x#7F%IgmygBVw*mDl7H^Z{OA78x#wJf^N>g+(A}*)`QG z5RTB`_EMce+Rq7v1K^?@u()CXf6xoz7!8!yDW$`H4viiQVXJBa++G(roc6hNHhJa` zc)tgNK1C=T#LYg4#zR25R*jil>eLtT{GdaAuGwmA2T&d-c>V5!!d9NyEp9Qmxe|`j ziex$g4vI7tOS{$FMw-cFlc$u|)oH@xv;lB4TdF3p9zS6L`{g|*5)D-xF1xRMSgLOC z7MSARP8Hv+kyxnx2--m{*z6VvMS>8Zy#!`G*)JEFkDm^i! z57&EQSe~y>rx{P4Jq8WqI_>n@dK|C^u()ifPp27dDGN*U z^*)3m0U({Lwv9rzno6%R=}dwtY~>hiY=vzs3$T+mn9{vzjZvdfBXyxZ39Q1lxt*_O za!Cf)+FBy^2Uli$r+^So1&^UvC9Uv!asn@3M*|?0O5yp7r!a4LH=D=I>FhdY&DZp^ zI_lx02LqV>=f-B1VTE_&n|?;e8M}28xLj@nAnp)D|3JTRN;i4Tjw+i=)$ZND8$(OU zO0JNPx!jIl*?fw5pNO9Is(T6ipVtD2MW9ltL~^<8_V~oBFC(MFPBbrJi4vhmDCP_J z3YkoHXME!2*U=lJE*_6}vFCCRm&4&S04zz3eYkpUkW2Ite1g#M`uYfvc1r7BSCpMy$Yx?I diff --git a/src/XGUI/pictures/wnd_grip.png b/src/XGUI/pictures/wnd_grip.png deleted file mode 100644 index 032a29fda52649026e5b2ebcc97692132a30b247..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=Dh+L6~vJ#O${~L8%hgh?3y^w370~qEv=}#LT=BJwMkFg)(D3Q$0gN_s>q|KvfZ* zE{-7<{>crDdU|?nfq{YwVy($xVPPFI=Hks95qyo2k&y?Ac>e$YpI%T!l$S0V1`6PMe}e@A6qO#<4%;OXk; Jvd$@?2>^?gL1+K~ diff --git a/src/XGUI/pictures/wnd_maximize.png b/src/XGUI/pictures/wnd_maximize.png deleted file mode 100644 index 3874a255508eaab3d07b2dafcbb3c4ee3bba28de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 688 zcmV;h0#E&kP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qRNAp5A0006XNkliLZMKkw6yWZALzxiCdGO0!D94eoMiIe?#z7V zJ3EVoX_|&yZk0S2dn%PuFL#voNHSJP>#BPCfqt zm?x3c;%GcTqghAO{s5m6_ukYno{Z4#g*1wD5s2J~{|yjbDS-*V$@CbO-N4@KT};m= z7>@cFA0G+8kGYB^VC~jgtiZA?Cc2(X$N2Q+44=QAV{-Ztrv%(5C5~eeK#anf*iLMV z*&B8p4Xci@&GdYN+Ws!M=MbQ!6cAuu3MoZV31FF&{0hB(2SLaM82v#P@6ER` z>+jI!&V|VHe22wrEEMuFpjxZoaCm^I>&uh7EqM-)`tpBJ-QAh%+Dy}~D1ff(F`(Ov zNWRDVg9DVFK4uReJz&(G^$t7Y1F{9+-u=5sBoYb`hF%O1F80lN^P3-XTAB2pe$bu; z9TgY3v`Sew2Z&h}KomQ!{XG(QDi#pWQ*-;iI$c+uOMs9PMfI#{nm3C#imX^HB%;Vk z>sNIdTUp7%^I9+r0~UQ`8YPjPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qRNAp5A0007gNklZI&d%WVQfdGXw(V@&|g+vsJ`?FOU>xyQ-^arl)`X zz3zug^ZWf6A0Hzh@4MIQ?d1Y~jEUU9z20jgCv0NkHkMbyNF-y3#@5Iqh{YoaEzDzP zb_PqUUl3155Q$SRu}05Pgg(#r8({XqedLQ0w2Fd_f&^J9LDkC0Nf|7!g;A0V&}s^# zLN=giC8ki0L%6CwV55*jCYyrOuuv)&P?n1Xk*Ty=B3A)Y zK8r$W1I@i{9JcmEu~t=JIdx>DG+OOLZ0$I3sewezqI8@q0A9?c)=gaijyp%FR8?eh zDRfTT*gtHdb#x%!D>e1%5vHc6kW9s)R%Dcw0;8_%xYNS7AE)^K^9=2iuQ(xKmXuU= zO*9IxE{g5+?ZvC-NTvx=l?8~;f_LR=I%jR9X+8$2<1<)Z4U6scjZ0ZtSrl_nD`on5 z9XrhiY{!7()@d$V{lRiTDxJi~xetRiPEJk`bxCZ3tJvM&rioi38uglp`v*;e;q&USVi!s%|X(83&h^!On> z9#0S8I3{`h+;NRAN$%Pd4MY27ImS61gZp30-t5{9%GpMjp8wdiUS4+rFyK<*WwBnb z{^swzm_tlcCwRSUS-ogGn>-ExT#Do9?C!m37Q7Q=!QiCFb#-6hWUZD?o+!`Fx5^Z72^3&xnpame61`LM5_`%eS@0c#WrwlEB`o&W#< M07*qoM6N<$f~_oG`2YX_ diff --git a/src/XGUI/pictures/wnd_restore.png b/src/XGUI/pictures/wnd_restore.png deleted file mode 100644 index 65a123e03570d9a714aff7414d30d9dbc1c46112..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 481 zcmV<70UrK|P)N2bPDNB8 zb~7$DE-^7j^FlWO00CV|L_t(IPorW>DtIy0qZ3Ke3!$;nK6&wM>MQ-o!jCi3|lS3Z)i>p?GLA}4z*>H41R z!T0@`L=_6hxPQ1qvsFi}Ug4^u-l(EwUAny{A>i`rLXH~;cuY1sy=Sza9xMmft%MD0$S|` zL|kt?lxuK^kF*5XwgmE@?;sg4o_cUc12UUWpvKM|X3*p5_()nddjw6>k^w>v-!s30Xo0CAYw*0(42N^I3D{p*0gDpsjf3hDhc48vGT2O&iE#H_3LTxlcf{j-1{ Xgk9r4yy^2<00000NkvXXu0mjf&?Cv| -- 2.39.2