r16837 by craig - #10252: When using picas, display them on the status bar location (and also HUD for item creation/resizing)
scribus-commit
scribus-commit at lists.scribus.net
Thu Sep 15 21:01:54 UTC 2011
Author: craig
Date: Thu Sep 15 21:01:54 2011
New Revision: 16837
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16837
Log:
#10252: When using picas, display them on the status bar location (and also HUD for item creation/resizing)
Modified:
trunk/Scribus/scribus/units.cpp
Modified: trunk/Scribus/scribus/units.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16837&path=/trunk/Scribus/scribus/units.cpp
==============================================================================
--- trunk/Scribus/scribus/units.cpp (original)
+++ trunk/Scribus/scribus/units.cpp Thu Sep 15 21:01:54 2011
@@ -19,6 +19,7 @@
* *
***************************************************************************/
+#include <cmath>
#include <QString>
#include <QObject>
#include "units.h"
@@ -364,12 +365,26 @@
QString value2String(double unitValue, int unitIndex, bool round2Precision, bool appendSuffix)
{
QString s;
- if (round2Precision)
- s=QString::number(pts2value(unitValue, unitIndex), 'f', unitGetPrecisionFromIndex(unitIndex));
+
+ if (unitIndex==SC_PICAS)
+ {
+ int a=(static_cast<int>(unitValue))/12;
+ double b=fabs(fmod(unitValue, 12));
+ QString prefix((a==0 && unitValue < 0.0) ? "-" : "");
+// if (round2Precision)
+// s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(QString::number(b, 'f', unitGetPrecisionFromIndex(unitIndex)));
+// else
+ s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(b);
+ }
else
- s=QString::number(pts2value(unitValue, unitIndex));
- if (appendSuffix)
- s += " "+unitGetStrFromIndex(unitIndex);
+ {
+ if (round2Precision)
+ s=QString::number(pts2value(unitValue, unitIndex), 'f', unitGetPrecisionFromIndex(unitIndex));
+ else
+ s=QString::number(pts2value(unitValue, unitIndex));
+ if (appendSuffix)
+ s += " "+unitGetStrFromIndex(unitIndex);
+ }
return s;
}
More information about the scribus-commit
mailing list