--- /dev/null
+@ECHO OFF
+
+REM Find absolute path to ROOT_DIR
+@SET PARENT_DIR=%~dp0..
+@SET ROOT_DIR=
+pushd %PARENT_DIR%
+@SET ROOT_DIR=%CD%
+popd
+
+@SET SRC_DIR=%ROOT_DIR%\sources
+@SET OCC_LIB_PREFIX=d
+
+call %SRC_DIR%\env_Salome.bat d
+mkdir %ROOT_DIR%\build
+cd %ROOT_DIR%\build
+
+cmake %SRC_DIR% -G "Visual Studio 10" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
+
+start "" %MSVC_EXE% NewGEOM.sln
--- /dev/null
+@ECHO OFF
+
+REM Find absolute path to ROOT_DIR
+@SET PARENT_DIR=%~dp0..
+@SET ROOT_DIR=
+pushd %PARENT_DIR%
+@SET ROOT_DIR=%CD%
+popd
+
+@SET SRC_DIR=%ROOT_DIR%\sources
+
+call %SRC_DIR%\env_Salome.bat
+mkdir %ROOT_DIR%\build
+cd %ROOT_DIR%\build
+
+cmake %SRC_DIR% -G "Visual Studio 10" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
+
+start "" %MSVC_EXE% NewGEOM.sln
--- /dev/null
+@echo off
+
+IF NOT EXIST "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" GOTO ERROR1
+
+@REM Load local settings from file localenv.bat that should be located in the root directory
+if "%ROOT_DIR%" == "" (
+ set ROOT_DIR=%~dp0..
+)
+
+if exist "%ROOT_DIR%\localenv.bat" (
+ echo Setting local environment from %ROOT_DIR%\localenv.bat
+ call "%ROOT_DIR%\localenv.bat"
+) else (
+ echo Warning: file %ROOT_DIR%\localenv.bat does not exist; using default environment
+)
+
+if "%SALOME_ROOT_DIR%" == "" (
+ set SALOME_ROOT_DIR=%ROOT_DIR%\SALOME
+)
+
+if "%SOLVESPACE_ROOT_DIR%" == "" (
+ SET SOLVESPACE_ROOT_DIR=%ROOT_DIR%\products\solvespace-2.0
+ SET PATH=%SOLVESPACE_ROOT_DIR%\lib;"%PATH%"
+)
+
+cd %SALOME_ROOT_DIR%\WORK
+call set_env.bat %1
+call "%PDIR%\env_compile.bat"
+cd %ROOT_DIR%
+
+@REM -------------------------
+@REM Python
+@SET PYTHON_LIB_DIR=%PYTHON_ROOT_DIR%\libs
+@SET PYTHON_INC_DIR=%PYTHON_ROOT_DIR%\include
+@REM -------------------------
+
+@REM -------------------------
+@REM CASCADE
+@SET PATH=%CASROOT%;%CASROOT%\win32\bin%OCC_LIB_PREFIX%;%PATH%
+@SET LIB=%CASROOT%\win32\lib%OCC_LIB_PREFIX%;%LIB%
+@set CSF_MDTVFontDirectory=%CASROOT%\src\FontMFT
+@set CSF_LANGUAGE=us
+@set MMGT_CLEAR=1
+@set CSF_EXCEPTION_PROMPT=1
+@set CSF_SHMessage=%CASROOT%\src\SHMessage
+@set CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures
+@set CSF_XSMessage=%CASROOT%\src\XSMessage
+@set CSF_StandardDefaults=%CASROOT%\src\StdResource
+@set CSF_PluginDefaults=%CASROOT%\src\StdResource
+@set CSF_XCAFDefaults=%CASROOT%\src\StdResource
+@set CSF_StandardLiteDefaults=%CASROOT%\src\StdResource
+@set CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat
+@set CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat
+@set CSF_IGESDefaults=%CASROOT%\src\XSTEPResource
+@set CSF_STEPDefaults=%CASROOT%\src\XSTEPResource
+@set CSF_XmlOcafResource=%CASROOT%\src\XmlOcafResource
+@REM -------------------------
+
+@REM -------------------------
+@REM Create launch path
+rem @SET PATH=%LIBXML2_ROOT_DIR%\bin;%PATH%
+rem @SET PATH=%PDIR%\tbb\bin;%PATH%
+rem @SET PATH=%PDIR%\freeimage-3.15.4\bin;%PATH%
+rem @SET PATH=%PDIR%\ftgl-2.1.3\bin;%PATH%
+rem @SET PATH=%PDIR%\freetype-2.4.11\bin;%PATH%
+rem @SET PATH=%PDIR%\gl2ps-1.3.8\bin;%PATH%
+rem @SET PATH=%PDIR%\qwt-5.2.1\lib;%PATH%
+rem @SET PATH=%SOLVESPACE_ROOT_DIR%\lib;%PATH%
+@REM -------------------------
+
+@REM -------------------------
+@SET PYTHONHOME=%PYTHON_ROOT_DIR%
+@SET PYTHON_INCLUDE=%PYTHONHOME%\include
+@REM -------------------------
+
+
+IF "%ARCH%" == "Win64" (
+ call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" x64
+) ELSE (
+ IF "%ARCH%" == "Win32" (
+ call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" x86
+ ) ELSE (
+ echo Wrong architecture is used. Win32 or Win64 architecture is allowed only.
+ echo Refer to the set_env.bat script.
+ )
+)
+
+@SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins
+@SET PATH=%ROOT_DIR%\install\plugins;%ROOT_DIR%\install\bin;%PATH%
+@SET PYTHONPATH=%ROOT_DIR%\install\swig;%PYTHONPATH%
+
+@SET LightAppConfig=%ROOT_DIR%\install\share\salome\resources\newgeom;%GUI_ROOT_DIR%\share\salome\resources\gui
+@SET NewGeomResources=%ROOT_DIR%\install\resources
@ECHO OFF
-REM Find absolute path to ROOT_DIR
-@SET PARENT_DIR=%~dp0..
-@SET ROOT_DIR=
-pushd %PARENT_DIR%
-@SET ROOT_DIR=%CD%
-popd
+call env_Salome.bat
-@SET SRC_DIR=%ROOT_DIR%\sources
-@SET OCC_LIB_PREFIX=d
-
-@SET SALOME_ROOT_DIR=%ROOT_DIR%\SALOME-7.3.0-WIN32
-@SET SOLVESPACE_ROOT_DIR=%ROOT_DIR%\products\solvespace-2.0
-@SET NEWGEOM_ROOT_DIR=%ROOT_DIR%\install
-@SET PATH=%SALOME_ROOT_DIR%;%PATH%
-
-
-call %SALOME_ROOT_DIR%\env_launch.bat
-rem Unfortunately in "env_launch.bat" only KERNEL is added as a module, so add GUI manually
-call %SALOME_ROOT_DIR%\set_one_module_env.bat GUI
-
-@SET PATH=%SOLVESPACE_ROOT_DIR%\lib;%PATH%
-@SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins
-@SET PATH=%PATH%;%NEWGEOM_ROOT_DIR%\bin;%NEWGEOM_ROOT_DIR%\plugins
-
-@SET LightAppConfig=%ROOT_DIR%\install\share\salome\resources\newgeom;%SALOME_ROOT_DIR%\MODULES\GUI\share\salome\resources\gui
-
-
-SuitApp.exe LightApp -style salome --modules=NewGeom --uselicense --noexcepthandling
+SuitApp.exe LightApp --modules=NewGeom
${PROJECT_SOURCE_DIR}/src/Events
${PROJECT_SOURCE_DIR}/src/ModuleBase
${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/Config
${SALOME_GUI_INCLUDE}
${SALOME_KERNEL_INCLUDE}
${CAS_INCLUDE_DIRS}
#include <XGUI_Workshop.h>
#include <XGUI_PropertyPanel.h>
#include <XGUI_ContextMenuMgr.h>
+#include <XGUI_Preferences.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Selector.h>
#include <SUIT_Desktop.h>
#include <SUIT_ViewManager.h>
+#include <SUIT_ResourceMgr.h>
#include <QtxPopupMgr.h>
#include <QtxActionMenuMgr.h>
+#include <QtxResourceMgr.h>
+
+#include <Config_PropManager.h>
#include <QDockWidget>
#include <QAction>
}
}
+class NewGeom_PrefMgr: public XGUI_IPrefMgr
+{
+public:
+ NewGeom_PrefMgr(LightApp_Preferences* theMgr, const QString& theModName):myMgr(theMgr), myModName(theModName) {}
+
+ virtual int addPreference(const QString& theLbl, int pId,
+ SUIT_PreferenceMgr::PrefItemType theType,
+ const QString& theSection, const QString& theName )
+ {
+ return myMgr->addPreference(myModName, theLbl, pId, theType, theSection, theName);
+ }
+
+ virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; }
+
+private:
+ LightApp_Preferences* myMgr;
+ QString myModName;
+};
+
+
+
+
//******************************************************
NewGeom_Module::NewGeom_Module()
: LightApp_Module("NewGeom"),
{
myWorkshop = new XGUI_Workshop(this);
myProxyViewer = new NewGeom_SalomeViewer(this);
+
+ XGUI_Preferences::setResourceMgr(application()->resourceMgr());
+ XGUI_Preferences::loadCustomProps();
}
//******************************************************
myActionsList.append(theId);
SUIT_Desktop* aDesk = application()->desktop();
int aKeys = 0;
- for (int i = 0; i < theKeys.count(); i++)
+ for (unsigned int i = 0; i < theKeys.count(); i++)
aKeys += theKeys[i];
QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
isCheckable);
myActionsList.append(theId);
SUIT_Desktop* aDesk = application()->desktop();
int aKeys = 0;
- for (int i = 0; i < theKeys.count(); i++)
+ for (unsigned int i = 0; i < theKeys.count(); i++)
aKeys += theKeys[i];
QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
isCheckable);
myWorkshop->contextMenuMgr()->addViewerItems(theMenu);
LightApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
}
+
+
+//******************************************************
+void NewGeom_Module::createPreferences()
+{
+ XGUI_Preferences::updateCustomProps();
+ LightApp_Preferences* pref = preferences();
+ int catId = pref->addPreference( moduleName(), -1 );
+ if ( catId == -1 )
+ return;
+ NewGeom_PrefMgr aMgr(pref, moduleName());
+ XGUI_Preferences::createEditContent(&aMgr, catId);
+ pref->retrieve();
+}
+
+//******************************************************
+void NewGeom_Module::preferencesChanged(const QString& theSection, const QString& theParam)
+{
+ SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
+ QString aVal = aResMgr->stringValue(theSection, theParam);
+ if (!aVal.isNull()) {
+ Config_Prop* aProp = Config_PropManager::findProp(theSection.toStdString(), theParam.toStdString());
+ aProp->setValue(aVal.toStdString());
+ }
+}
virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
+ virtual void createPreferences();
+ virtual void preferencesChanged(const QString& theSection, const QString& theParam);
+
public slots:
virtual bool activateModule(SUIT_Study* theStudy);
virtual bool deactivateModule(SUIT_Study* theStudy);
{
boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
- double aSize = Config_PropManager::integer("Sketch definition", "Size of planes", PLANE_SIZE);
+ double aSize = Config_PropManager::integer("Sketch planes", "Size of planes", PLANE_SIZE);
boost::shared_ptr<GeomAPI_Shape> aFace = GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal,
aSize);
theShapes.push_back(aFace);
aAIS = AISObjectPtr(new GeomAPI_AISObject());
aAIS->createShape(aCompound);
- std::vector<int> aRGB = Config_PropManager::color("Sketch definition", "planes_color",
+ std::vector<int> aRGB = Config_PropManager::color("Sketch planes", "planes_color",
SKETCH_PLANE_COLOR);
aAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
- aAIS->setWidth(Config_PropManager::integer("Sketch definition", "planes_thikness",
+ aAIS->setWidth(Config_PropManager::integer("Sketch planes", "planes_thikness",
SKETCH_WIDTH));
}
return aAIS;
XGUI_ModuleConnector.h
XGUI_Selection.h
XGUI_Preferences.h
+ XGUI_IPrefMgr.h
)
SET(PROJECT_AUTOMOC
--- /dev/null
+// File: XGUI_IPrefMgr.h
+// Created: 10 Sept 2014
+// Author: Vitaly SMETANNIKOV
+
+
+#ifndef XGUI_IPrefMgr_H
+#define XGUI_IPrefMgr_H
+
+#include <QString>
+#include <SUIT_PreferenceMgr.h>
+
+class XGUI_IPrefMgr
+{
+public:
+ virtual int addPreference(const QString& theLbl, int pId,
+ SUIT_PreferenceMgr::PrefItemType theType,
+ const QString& theSection, const QString& theName ) = 0;
+
+ virtual SUIT_PreferenceMgr* prefMgr() const = 0;
+};
+
+#endif
\ No newline at end of file
#include "XGUI_Preferences.h"
#include "XGUI_Constants.h"
+#include <Config_PropManager.h>
+
#include <SUIT_ResourceMgr.h>
#include <SUIT_PreferenceMgr.h>
QString aVal = myResourceMgr->stringValue(QString(aProp->section().c_str()),
QString(aProp->name().c_str()));
if (!aVal.isNull())
- aProp->setValue(qPrintable(aVal));
+ aProp->setValue(aVal.toStdString());
}
}
QStringList aParams = myResourceMgr->parameters(aSection);
foreach (QString aParam, aParams)
{
- Config_PropManager::registerProp(qPrintable(aSection), qPrintable(aParam), "",
+ Config_PropManager::registerProp(aSection.toStdString(), aParam.toStdString(), "",
Config_Prop::Disabled,
- qPrintable(myResourceMgr->stringValue(aSection, aParam)));
+ myResourceMgr->stringValue(aSection, aParam).toStdString());
+ }
+ }
+}
+
+
+void XGUI_Preferences::createEditContent(XGUI_IPrefMgr* thePref, int thePage)
+{
+ thePref->prefMgr()->setItemIcon(thePage, QIcon(":pictures/module.png"));
+ createCustomPage(thePref, thePage);
+}
+
+
+void XGUI_Preferences::createCustomPage(XGUI_IPrefMgr* thePref, int thePageId)
+{
+ SUIT_ResourceMgr* aResMgr = XGUI_Preferences::resourceMgr();
+ bool isResModified = false;
+
+ // Make a Tab from each section
+ std::list<std::string> aSections = Config_PropManager::getSections();
+ std::list<std::string>::const_iterator it;
+ for (it = aSections.cbegin(); it != aSections.cend(); ++it) {
+ Config_Properties aProps = Config_PropManager::getProperties(*it);
+ int aTab = thePref->prefMgr()->addItem(QString((*it).c_str()), thePageId);
+ thePref->prefMgr()->setItemProperty("columns", 2, aTab);
+
+ Config_Properties::const_iterator aIt;
+ for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) {
+ Config_Prop* aProp = (*aIt);
+ // check that the property is defined
+ QString aSection(aProp->section().c_str());
+ QString aName(aProp->name().c_str());
+ if (!aResMgr->hasValue(aSection, aName)) {
+ aResMgr->setValue(aSection, aName, QString(aProp->value().c_str()));
+ isResModified = true;
+ }
+ // Add item
+ if (aProp->type() != Config_Prop::Disabled)
+ thePref->addPreference(QObject::tr(aProp->title().c_str()), aTab,
+ (SUIT_PreferenceMgr::PrefItemType) aProp->type(),
+ QString(aProp->section().c_str()), QString(aProp->name().c_str()));
}
}
}
+//**********************************************************
+//**********************************************************
+//**********************************************************
+class XGUI_PrefMgr: public XGUI_IPrefMgr
+{
+public:
+ XGUI_PrefMgr(XGUI_PreferencesMgr* theMgr):myMgr(theMgr) {}
+
+ virtual int addPreference(const QString& theLbl, int pId,
+ SUIT_PreferenceMgr::PrefItemType theType,
+ const QString& theSection, const QString& theName )
+ {
+ return myMgr->addItem(theLbl, pId, theType, theSection, theName);
+ }
+
+ virtual SUIT_PreferenceMgr* prefMgr() const { return myMgr; }
+
+private:
+ XGUI_PreferencesMgr* myMgr;
+};
+
//**********************************************************
//**********************************************************
//**********************************************************
aPage = myPreferences->addItem(tr("Module"));
myPreferences->setItemIcon(aPage, QIcon(":pictures/module.png"));
- createCustomPage(aPage);
+
+ XGUI_PrefMgr aMgr(myPreferences);
+ XGUI_Preferences::createEditContent(&aMgr, aPage);
}
void XGUI_PreferencesDlg::createViewerPage(int thePageId)
myPreferences->setItemProperty("max", 6, aRowsNb);
}
-void XGUI_PreferencesDlg::createCustomPage(int thePageId)
-{
- SUIT_ResourceMgr* aResMgr = XGUI_Preferences::resourceMgr();
- bool isResModified = false;
-
- // Make a Tab from each section
- std::list<std::string> aSections = Config_PropManager::getSections();
- std::list<std::string>::const_iterator it;
- for (it = aSections.cbegin(); it != aSections.cend(); ++it) {
- Config_Properties aProps = Config_PropManager::getProperties(*it);
- int aTab = myPreferences->addItem(QString((*it).c_str()), thePageId);
- myPreferences->setItemProperty("columns", 2, aTab);
-
- Config_Properties::const_iterator aIt;
- for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) {
- Config_Prop* aProp = (*aIt);
- // check that the property is defined
- QString aSection(aProp->section().c_str());
- QString aName(aProp->name().c_str());
- if (!aResMgr->hasValue(aSection, aName)) {
- aResMgr->setValue(aSection, aName, QString(aProp->value().c_str()));
- isResModified = true;
- }
- // Add item
- if (aProp->type() != Config_Prop::Disabled)
- myPreferences->addItem(tr(aProp->title().c_str()), aTab,
- (SUIT_PreferenceMgr::PrefItemType) aProp->type(),
- QString(aProp->section().c_str()), QString(aProp->name().c_str()));
- }
- }
-}
-
void XGUI_PreferencesDlg::accept()
{
myPreferences->store();
#define XGUI_Preferences_H
#include "XGUI.h"
+#include "XGUI_IPrefMgr.h"
-#include <Config_PropManager.h>
#include <SUIT_PreferenceMgr.h>
#include <QDialog>
static bool editPreferences(XGUI_Prefs& theModified);
+ /// Returns currently installed resource manager
static SUIT_ResourceMgr* resourceMgr();
+ /// Sets a resource manager
+ /// It is used in case of necessity to define external resource manager (not NewGeom)
+ static void setResourceMgr(SUIT_ResourceMgr* theMgr) { myResourceMgr = theMgr; }
+
+ /// Updates properties defined by module from SUIT_ResourceMgr to Config_PropManager
static void updateCustomProps();
+ /// Loads properties defined by module to Config_PropManager
static void loadCustomProps();
- private:
+ ///
+ static void createEditContent(XGUI_IPrefMgr* thePref, int thePage);
+
+private:
+ /// Creates content of preferences editing widget
+ static void createCustomPage(XGUI_IPrefMgr* thePref, int thePageId);
+
static SUIT_ResourceMgr* myResourceMgr;
};
void createEditors();
void createViewerPage(int thePageId);
void createMenuPage(int thePageId);
- void createCustomPage(int thePageId);
+ //void createCustomPage(int thePageId);
void updateCustomProps();