diff --git a/hurricane/src/hurricane/DbU.cpp b/hurricane/src/hurricane/DbU.cpp index f941a1bc..de300d8d 100644 --- a/hurricane/src/hurricane/DbU.cpp +++ b/hurricane/src/hurricane/DbU.cpp @@ -256,23 +256,25 @@ namespace Hurricane { string DbU::getValueString ( DbU::Unit u, int mode ) { char buffer[1024]; - char unitSymbol = 'u'; + char unitPower = 'u'; + char unitSymbol = '\0'; if ( _stringMode == Grid ) { - unitSymbol = 'g'; + unitPower = 'g'; snprintf ( buffer, 1024, "%.1f", getGrid(u) ); } else if ( _stringMode == Symbolic ) { - unitSymbol = 'l'; + unitPower = 'l'; snprintf ( buffer, 1024, "%.1f", getLambda(u) ); } else if ( _stringMode == Physical ) { + unitSymbol = 'm'; switch ( _stringModeUnitPower ) { - case Pico: unitSymbol = 'p'; break; - case Nano: unitSymbol = 'n'; break; - case Micro: unitSymbol = 'u'; break; - case Milli: unitSymbol = 'm'; break; - case Unity: unitSymbol = 'U'; break; - case Kilo: unitSymbol = 'k'; break; - default: unitSymbol = '?'; break; + case Pico: unitPower = 'p'; break; + case Nano: unitPower = 'n'; break; + case Micro: unitPower = 'u'; break; + case Milli: unitPower = 'm'; break; + case Unity: unitPower = 'U'; break; + case Kilo: unitPower = 'k'; break; + default: unitPower = '?'; break; } snprintf ( buffer, 1024, "%.3f", getPhysical(u,_stringModeUnitPower) ); } else { @@ -289,7 +291,8 @@ namespace Hurricane { if ( buffer[length] != '0' ) break; } } - buffer[++length] = unitSymbol; + buffer[++length] = unitPower; + if ( unitSymbol ) buffer[++length] = unitSymbol; buffer[++length] = '\0'; return buffer; diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 5707e913..b84af9d4 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -1906,7 +1906,7 @@ namespace Hurricane { textGrad = DbU::getValueString( gradStep*tick , DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) ); - if ( tick ) textGrad.resize ( textGrad.size()-1 ); + textGrad.resize ( textGrad.size()-((*textGrad.rbegin()=='m')?2:1) ); drawDisplayText ( QPoint ( pxGrad - 1, pxOrigin.y() + tickLength ) , textGrad.c_str() @@ -1920,7 +1920,7 @@ namespace Hurricane { _drawingPlanes.painter().drawLine ( pxAngle.x(), pxAngle.y() , pxAngle.x(), pxAngle.y()+tickLength ); - textGrad = DbU::getValueString ( angle.getX() - origin.getX() + textGrad = DbU::getValueString ( abs(angle.getX() - origin.getX()) , DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) ); //textGrad.resize ( textGrad.size()-1 ); @@ -1966,7 +1966,7 @@ namespace Hurricane { textGrad = DbU::getValueString( gradStep*tick , DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) ); - if ( tick ) textGrad.resize ( textGrad.size()-1 ); + textGrad.resize ( textGrad.size()-((*textGrad.rbegin()=='m')?2:1) ); drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pyGrad + 1) , textGrad.c_str() @@ -1980,8 +1980,8 @@ namespace Hurricane { _drawingPlanes.painter().drawLine ( pxOrigin.x() , pxAngle.y() , pxOrigin.x()-tickLength, pxAngle.y() ); - textGrad = DbU::getValueString( angle.getY() - origin.getY() - , DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) ); + textGrad = DbU::getValueString( abs(angle.getY() - origin.getY()) + , DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) ); //textGrad.resize ( textGrad.size()-1 ); drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pxAngle.y() + 1)