X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fforms%2Fcoordinatewidget.cpp;h=0769812c633acf74a45d72c5379f59fd249c5a58;hb=5adb444f3e523d3fd028617ced72d1ea6661db21;hp=bce0b02eb595935143bf9c56586a2d2ec2854ec1;hpb=89e127aa3dbd74d3158e6dbe0ca1703420c04395;p=architektonas diff --git a/src/forms/coordinatewidget.cpp b/src/forms/coordinatewidget.cpp index bce0b02..0769812 100644 --- a/src/forms/coordinatewidget.cpp +++ b/src/forms/coordinatewidget.cpp @@ -3,7 +3,9 @@ // Part of the Architektonas Project // Originally part of QCad Community Edition by Andrew Mustun // Extensively rewritten and refactored by James L. Hammons -// (C) 2010 Underground Software +// 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 // @@ -16,10 +18,10 @@ #include "drawing.h" #include "settings.h" -#include "rs_units.h" +#include "units.h" CoordinateWidget::CoordinateWidget(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): - QWidget(parent, flags)//, actionHandler(NULL), cadToolBar(NULL) + QWidget(parent, flags) { ui.setupUi(this); @@ -28,21 +30,24 @@ CoordinateWidget::CoordinateWidget(QWidget * parent/*= 0*/, Qt::WindowFlags flag ui.lCoord1b->setText(""); ui.lCoord2b->setText(""); - int fsize; #ifdef __APPLE__ - fsize = 9; + int fsize = 9; #else - fsize = 7; + int fsize = 7; #endif settings.beginGroup("Appearance"); fsize = settings.value("StatusBarFontSize", fsize).toInt(); settings.endGroup(); - ui.lCoord1->setFont(QFont("Helvetica", fsize)); - ui.lCoord1b->setFont(QFont("Helvetica", fsize)); - ui.lCoord2->setFont(QFont("Helvetica", fsize)); - ui.lCoord2b->setFont(QFont("Helvetica", fsize)); +// ui.lCoord1->setFont(QFont("Helvetica", fsize)); +// ui.lCoord1b->setFont(QFont("Helvetica", fsize)); +// ui.lCoord2->setFont(QFont("Helvetica", fsize)); +// ui.lCoord2b->setFont(QFont("Helvetica", fsize)); + ui.lCoord1->setFont(QFont("Verdana", fsize)); + ui.lCoord1b->setFont(QFont("Verdana", fsize)); + ui.lCoord2->setFont(QFont("Verdana", fsize)); + ui.lCoord2b->setFont(QFont("Verdana", fsize)); graphic = NULL; prec = 4; @@ -71,7 +76,7 @@ void CoordinateWidget::setAbsCoordinates(const Vector& v) { str.sprintf("%.4f / %.4f", v.x, v.y); lCoord1->setText(str); - double ang = RS_Math::rad2deg(v.angle()); + double ang = Math::rad2deg(v.angle()); double rad = v.magnitude(); str.sprintf("%.4f < %.4f", rad, ang); lCoord1b->setText(str); @@ -91,7 +96,7 @@ void CoordinateWidget::setRelCoordinates(const Vector& v) { str.sprintf("@%.4f / %.4f", v.x, v.y); lCoord2->setText(str); - double ang = RS_Math::rad2deg(v.angle()); + double ang = Math::rad2deg(v.angle()); double rad = v.magnitude(); str.sprintf("@%.4f < %.4f", rad, ang); lCoord2b->setText(str); @@ -125,39 +130,38 @@ void CoordinateWidget::setCoordinates(const Vector & abs, const Vector & rel, bo void CoordinateWidget::setCoordinates(double x, double y, double rx, double ry, bool updateFormat) { - if (graphic != NULL) + if (!graphic) + return; + + if (updateFormat) { - if (updateFormat) - { - format = graphic->getLinearFormat(); - prec = graphic->getLinearPrecision(); - aformat = graphic->getAngleFormat(); - aprec = graphic->getAnglePrecision(); - } - - // abs / rel coordinates: - QString absX = RS_Units::formatLinear(x, graphic->getUnit(), format, prec); - QString absY = RS_Units::formatLinear(y, graphic->getUnit(), format, prec); - QString relX = RS_Units::formatLinear(rx, graphic->getUnit(), format, prec); - QString relY = RS_Units::formatLinear(ry, graphic->getUnit(), format, prec); - - ui.lCoord1->setText(absX + " , " + absY); - ui.lCoord2->setText(relX + " , " + relY); - - // polar coordinates: - Vector v; - v = Vector(x, y); - QString str; - QString rStr = RS_Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec); - QString aStr = RS_Units::formatAngle(v.angle(), aformat, aprec); - - str = rStr + " < " + aStr; - ui.lCoord1b->setText(str); - - v = Vector(rx, ry); - rStr = RS_Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec); - aStr = RS_Units::formatAngle(v.angle(), aformat, aprec); - str = rStr + " < " + aStr; - ui.lCoord2b->setText(str); + format = graphic->getLinearFormat(); + prec = graphic->getLinearPrecision(); + aformat = graphic->getAngleFormat(); + aprec = graphic->getAnglePrecision(); } + + // abs / rel coordinates: + QString absX = Units::formatLinear(x, graphic->getUnit(), format, prec); + QString absY = Units::formatLinear(y, graphic->getUnit(), format, prec); + QString relX = Units::formatLinear(rx, graphic->getUnit(), format, prec); + QString relY = Units::formatLinear(ry, graphic->getUnit(), format, prec); + + ui.lCoord1->setText(absX + ", " + absY); + ui.lCoord2->setText(relX + ", " + relY); + + // polar coordinates: + Vector v = Vector(x, y); + QString rStr = Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec); + QString aStr = Units::formatAngle(v.angle(), aformat, aprec); + + // U+2221 = Measured angle + QString str = rStr + " " + QChar(0x2221) + aStr; + ui.lCoord1b->setText(str); + + v = Vector(rx, ry); + rStr = Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec); + aStr = Units::formatAngle(v.angle(), aformat, aprec); + str = rStr + " " + QChar(0x2221) + aStr; + ui.lCoord2b->setText(str); }