From: stv Date: Tue, 17 Jan 2006 11:20:09 +0000 (+0000) Subject: Not defined min / max limits if it not specified in XML file. X-Git-Tag: T_Before_Join_BR-D5-38-2003~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=afda2e2f769623f15303e1b8ea71dfb261d25d63;p=modules%2Fgui.git Not defined min / max limits if it not specified in XML file. --- diff --git a/src/DDS/DDS_DicItem.cxx b/src/DDS/DDS_DicItem.cxx index fd59f3cd6..bbf388814 100644 --- a/src/DDS/DDS_DicItem.cxx +++ b/src/DDS/DDS_DicItem.cxx @@ -305,6 +305,14 @@ Standard_Real DDS_DicItem::FromSI( const Standard_Real theVal, const UnitSystem& return aRes; } +/*! + Returns 'true' if specified data exist. +*/ +Standard_Boolean DDS_DicItem::HasData( const Standard_Integer flag ) const +{ + return ( myData & flag ) == flag; +} + /*! Parse record in XML file and retrieve information relevant for this data dic item */ @@ -436,15 +444,22 @@ void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element else if ( aType.IsEqual( "Integer" ) ) aEnumType = Integer; + if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MAXV" ) ).isNull() ) + myData |= MinValue; aMinV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MINV" ) ); aMinV.RemoveAll( ' ' ); if ( aMinV.IsRealValue() ) aRealMinV = aMinV.RealValue(); + if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MAXV" ) ).isNull() ) + myData |= MaxValue; aMaxV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MAXV" ) ); aMaxV.RemoveAll( ' ' ); if ( aMaxV.IsRealValue() ) aRealMaxV = aMaxV.RealValue(); aDefV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_DEFV" ) ); + if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_DEFV" ) ).isNull() ) + myData |= DefaultValue; + aDefV.RemoveAll( ' ' ); if ( aDefV.IsRealValue() ) aRealDefV = aDefV.RealValue(); diff --git a/src/DDS/DDS_DicItem.h b/src/DDS/DDS_DicItem.h index 871149407..dbbedc0a7 100644 --- a/src/DDS/DDS_DicItem.h +++ b/src/DDS/DDS_DicItem.h @@ -30,6 +30,7 @@ class DDS_DicItem : public MMgt_TShared { public: enum Type { String, Float, Integer, List, Unknown }; + enum Data { MinValue = 0x01, MaxValue = 0x02, DefaultValue = 0x04 }; // This struct is intended for map of Format, Units, Precision and Scale struct UnitData @@ -134,6 +135,8 @@ public: Standard_EXPORT Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const; // convert value to and from default SI units according to current units + Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const; + private: DDS_DicItem( const DDS_DicItem& ); // Copy constructor @@ -200,6 +203,8 @@ private: Standard_Real myDefValue; TCollection_ExtendedString myDefString; + Standard_Integer myData; + // valueList TCollection_ExtendedString myListName; diff --git a/src/QDS/QDS_Datum.cxx b/src/QDS/QDS_Datum.cxx index b24581955..3b6eb58e4 100644 --- a/src/QDS/QDS_Datum.cxx +++ b/src/QDS/QDS_Datum.cxx @@ -248,8 +248,8 @@ QString QDS_Datum::minimumValue() const initDatum(); QString min; - if ( !myDicItem.IsNull() ) - min = format( format(), type(), myDicItem->GetMinValue() ); + if ( !myDicItem.IsNull() && myDicItem->HasData( DDS_DicItem::MinValue ) ) + min = format( format(), type(), myDicItem->GetMinValue() ); return min; } @@ -258,7 +258,7 @@ QString QDS_Datum::maximumValue() const initDatum(); QString max; - if ( !myDicItem.IsNull() ) + if ( !myDicItem.IsNull() && myDicItem->HasData( DDS_DicItem::MaxValue ) ) max = format( format(), type(), myDicItem->GetMaxValue() ); return max; } diff --git a/src/QDS/QDS_SpinBoxDbl.cxx b/src/QDS/QDS_SpinBoxDbl.cxx index 92ffe65c8..8a4160e70 100644 --- a/src/QDS/QDS_SpinBoxDbl.cxx +++ b/src/QDS/QDS_SpinBoxDbl.cxx @@ -134,6 +134,6 @@ void QDS_SpinBoxDbl::unitSystemChanged( const QString& system ) sb->setPrecision( aPreci ); sb->setLineStep( .1 ); - sb->setMinValue( minValue().toDouble() ); - sb->setMaxValue( maxValue().toDouble() ); + sb->setMinValue( minValue().isEmpty() ? -DBL_MAX : minValue().toDouble() ); + sb->setMaxValue( maxValue().isEmpty() ? DBL_MAX : maxValue().toDouble() ); }