]> Shamusworld >> Repos - architektonas/blobdiff - src/base/rs_units.cpp
Partially fixed thumbnail rendering on Library Browser.
[architektonas] / src / base / rs_units.cpp
index 7b7bcd69f27a25dc21cdd9fde7ccfbe66d2c3690..0c193fdc783e8dc61cdd415340bdfd41dc18e6b7 100644 (file)
@@ -1,28 +1,18 @@
-/****************************************************************************
-** $Id: rs_units.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_units.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -----------------------------------------------------------
+// JLH  05/05/2010  Moved implementation from header to this file. :-)
+//
 
 #include "rs_units.h"
 
@@ -255,89 +245,47 @@ RS2::Unit RS_Units::stringToUnit(const QString & u)
        RS2::Unit ret = RS2::None;
 
        if (u == "None")
-       {
                ret = RS2::None;
-       }
        else if (u == QObject::tr("Inch"))
-       {
                ret = RS2::Inch;
-       }
-       else if (u==QObject::tr("Foot"))
-       {
+       else if (u == QObject::tr("Foot"))
                ret = RS2::Foot;
-       }
-       else if (u==QObject::tr("Mile"))
-       {
+       else if (u == QObject::tr("Mile"))
                ret = RS2::Mile;
-       }
-       else if (u==QObject::tr("Millimeter"))
-       {
+       else if (u == QObject::tr("Millimeter"))
                ret = RS2::Millimeter;
-       }
-       else if (u==QObject::tr("Centimeter"))
-       {
+       else if (u == QObject::tr("Centimeter"))
                ret = RS2::Centimeter;
-       }
-       else if (u==QObject::tr("Meter"))
-       {
+       else if (u == QObject::tr("Meter"))
                ret = RS2::Meter;
-       }
-       else if (u==QObject::tr("Kilometer"))
-       {
+       else if (u == QObject::tr("Kilometer"))
                ret = RS2::Kilometer;
-       }
-       else if (u==QObject::tr("Microinch"))
-       {
+       else if (u == QObject::tr("Microinch"))
                ret = RS2::Microinch;
-       }
-       else if (u==QObject::tr("Mil"))
-       {
+       else if (u == QObject::tr("Mil"))
                ret = RS2::Mil;
-       }
-       else if (u==QObject::tr("Yard"))
-       {
+       else if (u == QObject::tr("Yard"))
                ret = RS2::Yard;
-       }
-       else if (u==QObject::tr("Angstrom"))
-       {
+       else if (u == QObject::tr("Angstrom"))
                ret = RS2::Angstrom;
-       }
-       else if (u==QObject::tr("Nanometer"))
-       {
+       else if (u == QObject::tr("Nanometer"))
                ret = RS2::Nanometer;
-       }
-       else if (u==QObject::tr("Micron"))
-       {
+       else if (u == QObject::tr("Micron"))
                ret = RS2::Micron;
-       }
-       else if (u==QObject::tr("Decimeter"))
-       {
+       else if (u == QObject::tr("Decimeter"))
                ret = RS2::Decimeter;
-       }
-       else if (u==QObject::tr("Decameter"))
-       {
+       else if (u == QObject::tr("Decameter"))
                ret = RS2::Decameter;
-       }
-       else if (u==QObject::tr("Hectometer"))
-       {
+       else if (u == QObject::tr("Hectometer"))
                ret = RS2::Hectometer;
-       }
-       else if (u==QObject::tr("Gigameter"))
-       {
+       else if (u == QObject::tr("Gigameter"))
                ret = RS2::Gigameter;
-       }
-       else if (u==QObject::tr("Astro"))
-       {
+       else if (u == QObject::tr("Astro"))
                ret = RS2::Astro;
-       }
-       else if (u==QObject::tr("Lightyear"))
-       {
+       else if (u == QObject::tr("Lightyear"))
                ret = RS2::Lightyear;
-       }
-       else if (u==QObject::tr("Parsec"))
-       {
+       else if (u == QObject::tr("Parsec"))
                ret = RS2::Parsec;
-       }
 
        return ret;
 }
@@ -480,37 +428,37 @@ QString RS_Units::formatLinear(double length, RS2::Unit unit, RS2::LinearFormat
         unitString = unitToSign(unit);
 }*/
 
-    // barbarian display: show as fraction:
-    switch (format)
+       // Barbarian display: Show as fraction:
+       switch (format)
        {
-    case RS2::Scientific:
-        ret = formatScientific(length, unit, prec, showUnit);
-        break;
+       case RS2::Scientific:
+               ret = formatScientific(length, unit, prec, showUnit);
+               break;
 
-    case RS2::Decimal:
-        ret = formatDecimal(length, unit, prec, showUnit);
-        break;
+       case RS2::Decimal:
+               ret = formatDecimal(length, unit, prec, showUnit);
+               break;
 
-    case RS2::Engineering:
-        ret = formatEngineering(length, unit, prec, showUnit);
-        break;
+       case RS2::Engineering:
+               ret = formatEngineering(length, unit, prec, showUnit);
+               break;
 
-    case RS2::Architectural:
-        ret = formatArchitectural(length, unit, prec, showUnit);
-        break;
+       case RS2::Architectural:
+               ret = formatArchitectural(length, unit, prec, showUnit);
+               break;
 
-    case RS2::Fractional:
-        ret = formatFractional(length, unit, prec, showUnit);
-        break;
+       case RS2::Fractional:
+               ret = formatFractional(length, unit, prec, showUnit);
+               break;
 
-    default:
-        RS_DEBUG->print(RS_Debug::D_WARNING,
+       default:
+               RS_DEBUG->print(RS_Debug::D_WARNING,
                        "RS_Units::formatLinear: Unknown format");
-        ret = "";
-        break;
-    }
+               ret = "";
+               break;
+       }
 
-    return ret;
+       return ret;
 }
 
 /**