From 4193d16a549c7dad92d9af53f05e7834f5ff711b Mon Sep 17 00:00:00 2001 From: san Date: Fri, 8 Jun 2007 08:16:16 +0000 Subject: [PATCH] Porting to Qt4: changes for Win32 platform and MS VC++ 7.1 compiler --- src/DDS/DDS_DicGroup.h | 30 ++--- src/DDS/DDS_DicItem.h | 153 ++++++++++++----------- src/DDS/DDS_Dictionary.h | 54 ++++---- src/DDS/DDS_KeyWords.h | 12 +- src/GLViewer/GLViewer_BaseObjects.cxx | 2 +- src/GLViewer/GLViewer_Drawer.cxx | 4 +- src/GLViewer/GLViewer_ViewFrame.cxx | 6 + src/GLViewer/GLViewer_ViewPort.cxx | 2 +- src/GLViewer/GLViewer_ViewPort2d.cxx | 8 +- src/GLViewer/GLViewer_Viewer2d.cxx | 2 +- src/VTKViewer/VTKViewer_RenderWindow.cxx | 2 +- 11 files changed, 147 insertions(+), 128 deletions(-) diff --git a/src/DDS/DDS_DicGroup.h b/src/DDS/DDS_DicGroup.h index 9fc525b77..a804776ea 100644 --- a/src/DDS/DDS_DicGroup.h +++ b/src/DDS/DDS_DicGroup.h @@ -32,37 +32,39 @@ class LDOM_Element; class TColStd_SequenceOfAsciiString; -class Standard_EXPORT DDS_DicGroup : public MMgt_TShared +DEFINE_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared) + +class DDS_DicGroup : public MMgt_TShared { public: DDS_DicGroup( const TCollection_AsciiString& ); - TCollection_AsciiString GetName() const; + TCollection_AsciiString GetName() const; - Handle_DDS_DicItem GetDicItem( const TCollection_AsciiString& ) const; + Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; - void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; - TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; + Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; + Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; - TCollection_AsciiString GetActiveUnitSystem() const; - void SetActiveUnitSystem( const TCollection_AsciiString& ); + Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem() const; + Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString& ); private: DDS_DicGroup( const DDS_DicGroup& ); - void operator=( const DDS_DicGroup& ); + void operator=( const DDS_DicGroup& ); - void FillDataMap( const LDOM_Element&, const LDOM_Element& ); + void FillDataMap( const LDOM_Element&, const LDOM_Element& ); private: typedef NCollection_DataMap UnitSystemMap; private: - TCollection_AsciiString myName; - DDS_IndexedDataMapOfDicItems myDataMap; - UnitSystemMap myUnitSystem; - TCollection_AsciiString myActiveSystem; + TCollection_AsciiString myName; + DDS_IndexedDataMapOfDicItems myDataMap; + UnitSystemMap myUnitSystem; + TCollection_AsciiString myActiveSystem; friend class DDS_Dictionary; @@ -70,8 +72,6 @@ public: DEFINE_STANDARD_RTTI(DDS_DicGroup) }; -DEFINE_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared) - DEFINE_BASECOLLECTION(DDS_BaseCollectionOfDicGroups, Handle(DDS_DicGroup)) DEFINE_INDEXEDDATAMAP(DDS_IndexedDataMapOfDicGroups, DDS_BaseCollectionOfDicGroups, TCollection_AsciiString, Handle(DDS_DicGroup)) diff --git a/src/DDS/DDS_DicItem.h b/src/DDS/DDS_DicItem.h index f6c7dcc87..b32639900 100644 --- a/src/DDS/DDS_DicItem.h +++ b/src/DDS/DDS_DicItem.h @@ -38,10 +38,16 @@ class TColStd_SequenceOfInteger; class TColStd_SequenceOfAsciiString; class TColStd_SequenceOfExtendedString; -class Standard_EXPORT DDS_DicItem : public MMgt_TShared +// Class, containing all information about one parameter: +// unique : id +// obligative: label, type, short description, required +// optional : format, units, +// min value, max value, default value. + +class DDS_DicItem : public MMgt_TShared { public: - //! Enum describes type of datum value + /*! Enum describes type of datum value */ enum Type { String, //!< String type of value @@ -51,7 +57,7 @@ public: Unknown //!< Unknown or undefined type of value }; - //! Enum describes the flags for existance of domain data + /*! Enum describes the flags for existance of domain data */ enum Data { MinValue = 0x01, //!< Flag of minimum value definition existence @@ -59,7 +65,7 @@ public: DefaultValue = 0x04 //!< Flag of default value definition existence }; - //! This struct is intended for map of Format, Units, Precision and Scale + // This struct is intended for map of Format, Units, Precision and Scale struct UnitData { Standard_Real myZero; @@ -74,88 +80,88 @@ public: public: DDS_DicItem(); - TCollection_AsciiString GetId() const; - DDS_DicItem::Type GetType() const; - TCollection_ExtendedString GetLabel() const; - TCollection_ExtendedString GetFilter() const; - TCollection_ExtendedString GetRequired() const; - DDS_MsgType GetWarningLevel() const; - TCollection_ExtendedString GetLongDescription() const; - TCollection_ExtendedString GetShortDescription() const; - TCollection_AsciiString GetComponent() const; + Standard_EXPORT TCollection_AsciiString GetId() const; + Standard_EXPORT DDS_DicItem::Type GetType() const; + Standard_EXPORT TCollection_ExtendedString GetLabel() const; + Standard_EXPORT TCollection_ExtendedString GetFilter() const; + Standard_EXPORT TCollection_ExtendedString GetRequired() const; + Standard_EXPORT DDS_MsgType GetWarningLevel() const; + Standard_EXPORT TCollection_ExtendedString GetLongDescription() const; + Standard_EXPORT TCollection_ExtendedString GetShortDescription() const; + Standard_EXPORT TCollection_AsciiString GetComponent() const; - TCollection_AsciiString GetUnits() const; - TCollection_AsciiString GetUnits( const UnitSystem& ) const; + Standard_EXPORT TCollection_AsciiString GetUnits() const; + Standard_EXPORT TCollection_AsciiString GetUnits( const UnitSystem& ) const; - TCollection_ExtendedString GetDefaultValue() const; - TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const; + Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const; + Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const; - Standard_Real GetMinValue() const; - Standard_Real GetMinValue( const UnitSystem& ) const; + Standard_EXPORT Standard_Real GetMinValue() const; + Standard_EXPORT Standard_Real GetMinValue( const UnitSystem& ) const; - Standard_Real GetMaxValue() const; - Standard_Real GetMaxValue( const UnitSystem& ) const; + Standard_EXPORT Standard_Real GetMaxValue() const; + Standard_EXPORT Standard_Real GetMaxValue( const UnitSystem& ) const; - Standard_Integer GetPrecision() const; - Standard_Integer GetPrecision( const UnitSystem& ) const; + Standard_EXPORT Standard_Integer GetPrecision() const; + Standard_EXPORT Standard_Integer GetPrecision( const UnitSystem& ) const; - TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const; - TCollection_AsciiString GetFormat( const UnitSystem&, - const Standard_Boolean = Standard_True ) const; - TCollection_ExtendedString GetNameOfValues() const; - Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, - Handle(TColStd_HArray1OfInteger)& ) const; - Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, - Handle(TColStd_HArray1OfInteger)&, - Handle(TColStd_HArray1OfExtendedString)& ) const; - Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const; + Standard_EXPORT TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const; + Standard_EXPORT TCollection_AsciiString GetFormat( const UnitSystem&, + const Standard_Boolean = Standard_True ) const; + Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const; + Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, + Handle(TColStd_HArray1OfInteger)& ) const; + Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, + Handle(TColStd_HArray1OfInteger)&, + Handle(TColStd_HArray1OfExtendedString)& ) const; + Standard_EXPORT Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const; - Standard_Real GetMinZoom() const; - Standard_Real GetMaxZoom() const; - Standard_Real GetZoomOrder() const; + Standard_EXPORT Standard_Real GetMinZoom() const; + Standard_EXPORT Standard_Real GetMaxZoom() const; + Standard_EXPORT Standard_Real GetZoomOrder() const; - Standard_Real ToSI( const Standard_Real ) const; - Standard_Real FromSI( const Standard_Real ) const; + Standard_EXPORT Standard_Real ToSI( const Standard_Real ) const; + Standard_EXPORT Standard_Real FromSI( const Standard_Real ) const; - Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const; - Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const; + Standard_EXPORT Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const; + Standard_EXPORT Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const; - Standard_Boolean HasData( const Standard_Integer ) const; + Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const; - TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const; - Standard_Boolean GetOptionNames( TColStd_SequenceOfAsciiString& ) const; + Standard_EXPORT TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const; + Standard_EXPORT Standard_Boolean GetOptionNames( TColStd_SequenceOfAsciiString& ) const; private: DDS_DicItem( const DDS_DicItem& ); - void operator=( const DDS_DicItem& ); - void FillDataMap( TCollection_AsciiString, const LDOM_Element&, - const LDOM_Element&, const LDOM_Element&, - const TColStd_SequenceOfAsciiString& ); - void PrepareFormats( const TCollection_AsciiString& ); - void GetDefaultFormat(); - UnitSystem GetActiveUnitSystem() const; - - void GetStringFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - TCollection_AsciiString& ); - void GetIntegerFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const Standard_Character, - TCollection_AsciiString& ); - void GetFloatFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const Standard_Character, - TCollection_AsciiString& ); - void Split( const TCollection_AsciiString&, - Handle(TColStd_HArray1OfExtendedString)& ); - - UnitData* GetUnitData( const UnitSystem& ) const; + void operator=( const DDS_DicItem& ); + void FillDataMap( TCollection_AsciiString, const LDOM_Element&, + const LDOM_Element&, const LDOM_Element&, + const TColStd_SequenceOfAsciiString& ); + void PrepareFormats( const TCollection_AsciiString& ); + void GetDefaultFormat(); + UnitSystem GetActiveUnitSystem() const; + + void GetStringFormat( const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + TCollection_AsciiString& ); + void GetIntegerFormat( const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const Standard_Character, + TCollection_AsciiString& ); + void GetFloatFormat( const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const TCollection_AsciiString&, + const Standard_Character, + TCollection_AsciiString& ); + void Split( const TCollection_AsciiString&, + Handle(TColStd_HArray1OfExtendedString)& ); + + UnitData* GetUnitData( const UnitSystem& ) const; private: typedef NCollection_DataMap OptionsMap; @@ -179,12 +185,14 @@ private: Standard_Integer myData; + // valueList TCollection_ExtendedString myListName; Handle(TColStd_HArray1OfExtendedString) myListRef; Handle(TColStd_HArray1OfInteger) myListRefID; Handle(TColStd_HArray1OfExtendedString) myListRefIcons; + // presentation Standard_Real myMinZoom; Standard_Real myMaxZoom; Standard_Real myZoomOrder; @@ -192,6 +200,7 @@ private: Handle(Standard_Transient) myComponent; OptionsMap myOptions; + // unitData NCollection_DataMap myUnitData; friend class DDS_DicGroup; diff --git a/src/DDS/DDS_Dictionary.h b/src/DDS/DDS_Dictionary.h index 289eb7d5d..9a5d5a886 100644 --- a/src/DDS/DDS_Dictionary.h +++ b/src/DDS/DDS_Dictionary.h @@ -25,50 +25,52 @@ #include -DEFINE_STANDARD_HANDLE(DDS_Dictionary, MMgt_TShared) - class LDOM_Element; class TCollection_AsciiString; -class Standard_EXPORT DDS_Dictionary : public MMgt_TShared +DEFINE_STANDARD_HANDLE(DDS_Dictionary, MMgt_TShared) + +class DDS_Dictionary : public MMgt_TShared { public: - static Handle_DDS_Dictionary Get(); + Standard_EXPORT static Handle(DDS_Dictionary) Get(); + + // Return instance of data dictionary. Create instance if it is NULL. + + Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; + Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString&, + const TCollection_AsciiString& ) const; - Handle_DDS_DicItem GetDicItem( const TCollection_AsciiString& ) const; - Handle_DDS_DicItem GetDicItem( const TCollection_AsciiString&, - const TCollection_AsciiString& ) const; + Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; + Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString&, + const TCollection_AsciiString& ) const; + Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; + Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString&, + const TCollection_AsciiString& ) const; + Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem() const; + Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem( const TCollection_AsciiString& ) const; + Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString& ); + Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString&, + const TCollection_AsciiString& ); - void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; - void GetUnitSystems( TColStd_SequenceOfAsciiString&, - const TCollection_AsciiString& ) const; - TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; - TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString&, - const TCollection_AsciiString& ) const; - TCollection_AsciiString GetActiveUnitSystem() const; - TCollection_AsciiString GetActiveUnitSystem( const TCollection_AsciiString& ) const; - void SetActiveUnitSystem( const TCollection_AsciiString& ); - void SetActiveUnitSystem( const TCollection_AsciiString&, - const TCollection_AsciiString& ); - - static Standard_Boolean Load( const TCollection_AsciiString ); + static Standard_EXPORT Standard_Boolean Load( const TCollection_AsciiString ); - static Standard_Real ToSI( const Standard_Real, const Standard_CString ); - static Standard_Real FromSI( const Standard_Real, const Standard_CString ); + static Standard_EXPORT Standard_Real ToSI( const Standard_Real, const Standard_CString ); + static Standard_EXPORT Standard_Real FromSI( const Standard_Real, const Standard_CString ); - static LDOMString KeyWord( const TCollection_AsciiString& ); + static Standard_EXPORT LDOMString KeyWord( const TCollection_AsciiString& ); private: DDS_Dictionary(); DDS_Dictionary( const DDS_Dictionary& ); - void operator=( const DDS_Dictionary& ); + void operator=( const DDS_Dictionary& ); - void FillDataMap( const LDOM_Element&, const LDOM_Element& ); + void FillDataMap( const LDOM_Element&, const LDOM_Element& ); private: - DDS_IndexedDataMapOfDicGroups myGroupMap; + DDS_IndexedDataMapOfDicGroups myGroupMap; public: DEFINE_STANDARD_RTTI(DDS_Dictionary) diff --git a/src/DDS/DDS_KeyWords.h b/src/DDS/DDS_KeyWords.h index f42fb4f66..2161f71f3 100644 --- a/src/DDS/DDS_KeyWords.h +++ b/src/DDS/DDS_KeyWords.h @@ -29,14 +29,14 @@ DEFINE_STANDARD_HANDLE(DDS_KeyWords, MMgt_TShared) class TCollection_AsciiString; -class Standard_EXPORT DDS_KeyWords : public MMgt_TShared +class DDS_KeyWords : public MMgt_TShared { public: - static Handle_DDS_KeyWords Get(); + Standard_EXPORT static Handle(DDS_KeyWords) Get(); - TCollection_AsciiString GetKeyWord( const TCollection_AsciiString& ) const; - void SetKeyWord( const TCollection_AsciiString&, - const TCollection_AsciiString& ); + Standard_EXPORT TCollection_AsciiString GetKeyWord( const TCollection_AsciiString& ) const; + Standard_EXPORT void SetKeyWord( const TCollection_AsciiString&, + const TCollection_AsciiString& ); private: DDS_KeyWords(); @@ -46,7 +46,7 @@ private: TCollection_AsciiString> KeyWordMap; private: - KeyWordMap myKeyWord; + KeyWordMap myKeyWord; public: DEFINE_STANDARD_RTTI(DDS_KeyWords) diff --git a/src/GLViewer/GLViewer_BaseObjects.cxx b/src/GLViewer/GLViewer_BaseObjects.cxx index ad1190e0a..7a049ffc6 100644 --- a/src/GLViewer/GLViewer_BaseObjects.cxx +++ b/src/GLViewer/GLViewer_BaseObjects.cxx @@ -1442,7 +1442,7 @@ bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerC y = double( yPos ); aViewerCS->transform( *aEMFCS, x, y ); - const char* str = aText.ascii(); + const char* str = aText.toAscii(); int nHeight = 35*14; // height of font int nWidth = 35*12; // average character width diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx index 433074a46..6fbf36182 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -390,8 +390,8 @@ static GLuint displayListBase( QFont* theFont ) QMap::iterator it = GLViewer_TexFont::BitmapFontCache.begin(); for ( ; it != GLViewer_TexFont::BitmapFontCache.end(); ++it ) { - if ( it.key().myViewPortId == (int)ctx && it.data() > listBase ) - listBase = it.data(); + if ( it.key().myViewPortId == (int)ctx && it.value() > listBase ) + listBase = it.value(); } listBase += 256; diff --git a/src/GLViewer/GLViewer_ViewFrame.cxx b/src/GLViewer/GLViewer_ViewFrame.cxx index 11e1229da..0461a4edd 100644 --- a/src/GLViewer/GLViewer_ViewFrame.cxx +++ b/src/GLViewer/GLViewer_ViewFrame.cxx @@ -44,6 +44,12 @@ #include #include +#ifdef WIN32 +#include +#include +using namespace std; +#endif + /*! Constructor */ diff --git a/src/GLViewer/GLViewer_ViewPort.cxx b/src/GLViewer/GLViewer_ViewPort.cxx index 5f9a48434..663afcf45 100644 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ b/src/GLViewer/GLViewer_ViewPort.cxx @@ -38,11 +38,11 @@ #include #include #include -#include #include #if !defined WIN32 +#include #include #include #include diff --git a/src/GLViewer/GLViewer_ViewPort2d.cxx b/src/GLViewer/GLViewer_ViewPort2d.cxx index 25fd15ac6..d80bddadb 100644 --- a/src/GLViewer/GLViewer_ViewPort2d.cxx +++ b/src/GLViewer/GLViewer_ViewPort2d.cxx @@ -34,7 +34,8 @@ #include "GLViewer_Grid.h" #include "GLViewer_Drawer.h" -#include +// TODO: Porting to Qt4 +//#include #include #include @@ -104,10 +105,11 @@ GLViewer_ViewPort2d::GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* t mypFirstPoint = NULL; mypLastPoint = NULL; - myObjectTip = new QtxToolTip( myGLWidget );///GLViewer_ObjectTip( this ); + // TODO: Porting to Qt4 + /*myObjectTip = new QtxToolTip( myGLWidget );///GLViewer_ObjectTip( this ); myObjectTip->setShowDelayTime( 60000 ); connect( myObjectTip, SIGNAL( maybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ), - this, SLOT( onMaybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) ); + this, SLOT( onMaybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) );*/ // myGLWidget->installEventFilter( myObjectTip ); } diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx index 0f69c54e1..3a51f5c89 100644 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ b/src/GLViewer/GLViewer_Viewer2d.cxx @@ -794,7 +794,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap HDC screen_dc = GetDC( 0 ); //The screen device context HDC bitDC = CreateCompatibleDC ( screen_dc ); //The context compatible with screen - hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.ascii(), &r, "" ); + hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.toAscii(), &r, "" ); SetMapMode( hMetaFileDC, MM_HIMETRIC ); SetWindowOrgEx( hMetaFileDC, 0, r.bottom, NULL ); HRGN ClipRgn = CreateRectRgn( 0, 0, AW, AH ); diff --git a/src/VTKViewer/VTKViewer_RenderWindow.cxx b/src/VTKViewer/VTKViewer_RenderWindow.cxx index a0d7e7195..69971a7b2 100755 --- a/src/VTKViewer/VTKViewer_RenderWindow.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindow.cxx @@ -19,7 +19,6 @@ #include "VTKViewer_RenderWindow.h" #include -#include #include #include @@ -29,6 +28,7 @@ #include #include #ifndef WIN32 +#include #include //#include //#include -- 2.39.2