diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp index 80aff03..5d318c5 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp @@ -23,7 +23,6 @@ #include "dimensionsplugin.h" #include "pdfdrawwidget.h" #include "pdfwidgetutils.h" -#include "pdfcms.h" #include "settingsdialog.h" #include @@ -216,8 +215,7 @@ void DimensionsPlugin::drawPage(QPainter* painter, qreal angle = line.angle(); QFontMetricsF fontMetrics(painter->font()); QRectF textRect(-line.length() * 0.5, -fontMetrics.lineSpacing(), line.length(), fontMetrics.lineSpacing()); - - QString text = QString("%1 %2").arg(locale.toString(dimension.getMeasuredValue() * m_lengthUnit.scale, 'f', 2), m_lengthUnit.symbol); + QString text = QString("%1 %2").arg(locale.toString(dimension.getMeasuredValue() * m_scale * m_lengthUnit.scale, 'f', 2), m_lengthUnit.symbol); painter->save(); painter->translate(textPoint); @@ -270,11 +268,11 @@ void DimensionsPlugin::drawPage(QPainter* painter, if (isArea) { - text = tr("A = %1 %2").arg(locale.toString(dimension.getMeasuredValue() * m_areaUnit.scale, 'f', 2), m_areaUnit.symbol); + text = tr("A = %1 %2").arg(locale.toString(dimension.getMeasuredValue() * m_scale * m_scale * m_areaUnit.scale, 'f', 2), m_areaUnit.symbol); } else { - text = tr("p = %1 %2").arg(locale.toString(dimension.getMeasuredValue() * m_lengthUnit.scale, 'f', 2), m_lengthUnit.symbol); + text = tr("p = %1 %2").arg(locale.toString(dimension.getMeasuredValue() * m_scale * m_lengthUnit.scale, 'f', 2), m_lengthUnit.symbol); } painter->drawText(centerPoint, text); @@ -349,7 +347,7 @@ void DimensionsPlugin::onClearDimensionsTriggered() void DimensionsPlugin::onSettingsTriggered() { - SettingsDialog dialog(m_widget, m_lengthUnit, m_areaUnit, m_angleUnit); + SettingsDialog dialog(m_widget, m_lengthUnit, m_areaUnit, m_angleUnit, m_scale); dialog.exec(); updateGraphics(); diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h index 45e42a6..1b7d1d1 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h @@ -55,6 +55,9 @@ public: const pdf::PDFColorConvertor& convertor, QList& errors) const override; + void setScale(double scale); + double getScale() const; + private: void onShowDimensionsTriggered(); void onClearDimensionsTriggered(); @@ -73,6 +76,9 @@ private: DimensionUnit m_lengthUnit; DimensionUnit m_areaUnit; DimensionUnit m_angleUnit; + + // New member variable for scaling + double m_scale = 1.0; }; } // namespace pdfplugin diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensiontool.cpp b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensiontool.cpp index 5e1191c..ff8c32a 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensiontool.cpp +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensiontool.cpp @@ -289,6 +289,9 @@ DimensionUnits DimensionUnit::getLengthUnits() units.emplace_back(pdf::PDF_POINT_TO_INCH, DimensionTool::tr("in")); units.emplace_back(pdf::PDF_POINT_TO_MM, DimensionTool::tr("mm")); units.emplace_back(pdf::PDF_POINT_TO_MM * 0.1, DimensionTool::tr("cm")); + units.emplace_back(pdf::PDF_POINT_TO_MM * 0.001, DimensionTool::tr("m")); + units.emplace_back(pdf::PDF_POINT_TO_INCH * 12.0, DimensionTool::tr("ft")); // Feet + units.emplace_back(pdf::PDF_POINT_TO_INCH * 36.0, DimensionTool::tr("yd")); // Yards return units; } @@ -301,6 +304,9 @@ DimensionUnits DimensionUnit::getAreaUnits() units.emplace_back(pdf::PDF_POINT_TO_INCH * pdf::PDF_POINT_TO_INCH, DimensionTool::tr("sq. in")); units.emplace_back(pdf::PDF_POINT_TO_MM * pdf::PDF_POINT_TO_MM, DimensionTool::tr("sq. mm")); units.emplace_back(pdf::PDF_POINT_TO_MM * 0.1 * pdf::PDF_POINT_TO_MM * 0.1, DimensionTool::tr("sq. cm")); + units.emplace_back(pdf::PDF_POINT_TO_MM * 0.001 * pdf::PDF_POINT_TO_MM * 0.001, DimensionTool::tr("sq. m")); + units.emplace_back(pdf::PDF_POINT_TO_INCH * 12.0 * pdf::PDF_POINT_TO_INCH * 12.0, DimensionTool::tr("sq. ft")); // Square Feet + units.emplace_back(pdf::PDF_POINT_TO_INCH * 36.0 * pdf::PDF_POINT_TO_INCH * 36.0, DimensionTool::tr("sq. yd")); // Square Yards return units; } diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.cpp b/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.cpp index 50748a1..e564f1f 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.cpp +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.cpp @@ -25,12 +25,17 @@ #include "pdfwidgetutils.h" -SettingsDialog::SettingsDialog(QWidget* parent, DimensionUnit& lengthUnit, DimensionUnit& areaUnit, DimensionUnit& angleUnit) : +SettingsDialog::SettingsDialog(QWidget* parent, + DimensionUnit& lengthUnit, + DimensionUnit& areaUnit, + DimensionUnit& angleUnit, + double& scale) : QDialog(parent), ui(new Ui::SettingsDialog), m_lengthUnit(lengthUnit), m_areaUnit(areaUnit), - m_angleUnit(angleUnit) + m_angleUnit(angleUnit), + m_scale(scale) { ui->setupUi(this); @@ -41,6 +46,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, DimensionUnit& lengthUnit, Dimen initComboBox(m_lengthUnits, m_lengthUnit, ui->lengthsComboBox); initComboBox(m_areaUnits, m_areaUnit, ui->areasComboBox); initComboBox(m_angleUnits, m_angleUnit, ui->anglesComboBox); + ui->scaleEdit->setValue(m_scale); setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(320, 240))); pdf::PDFWidgetUtils::style(this); @@ -66,6 +72,7 @@ void SettingsDialog::accept() m_lengthUnit = m_lengthUnits[ui->lengthsComboBox->currentIndex()]; m_areaUnit = m_areaUnits[ui->areasComboBox->currentIndex()]; m_angleUnit = m_angleUnits[ui->anglesComboBox->currentIndex()]; + m_scale = ui->scaleEdit->value(); QDialog::accept(); } diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.h b/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.h index 242479f..d87025c 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.h +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.h @@ -42,7 +42,8 @@ public: explicit SettingsDialog(QWidget* parent, DimensionUnit& lengthUnit, DimensionUnit& areaUnit, - DimensionUnit& angleUnit); + DimensionUnit& angleUnit, + double& scale); virtual ~SettingsDialog() override; virtual void accept() override; @@ -58,6 +59,7 @@ private: DimensionUnit& m_lengthUnit; DimensionUnit& m_areaUnit; DimensionUnit& m_angleUnit; + double& m_scale; }; #endif // SETTINGSDIALOG_H diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.ui b/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.ui index 6b9a61f..d265144 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.ui +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/settingsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 254 - 165 + 405 + 186 @@ -50,16 +50,33 @@ + + + + 1.000000000000000 + + + 1000000.000000000000000 + + + + + + + Scale 1: + + + - Qt::Horizontal + Qt::Orientation::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok diff --git a/RELEASES.txt b/RELEASES.txt index 12e671c..181641b 100644 --- a/RELEASES.txt +++ b/RELEASES.txt @@ -1,6 +1,8 @@ CURRENT: + - Issue #284: Scaling dimensions [Enhancements, Features] - Issue #281: install API headers for reuse by other applications ? + V: 1.5.1.0 27.4.2025 - Issue #271: Change of the license to MIT - Issue #257: Force light mode (or dark mode) diff --git a/translations/PDF4QT_cs.ts b/translations/PDF4QT_cs.ts index ec94342..ecfde80 100644 --- a/translations/PDF4QT_cs.ts +++ b/translations/PDF4QT_cs.ts @@ -165,32 +165,62 @@ - + + m + + + + + ft + + + + + yd + + + + sq. pt - + sq. in - + sq. mm - + sq. cm - + + sq. m + + + + + sq. ft + + + + + sq. yd + + + + ° - + rad @@ -6071,6 +6101,11 @@ li.checked::marker { content: "\2612"; } Angles Úhly + + + Scale 1: + + @@ -12032,72 +12067,72 @@ li.checked::marker { content: "\2612"; } pdfplugin::DimensionsPlugin - + &Horizontal Dimension &Vodorovná kóta - + &Vertical Dimension Svislá &kóta - + &Linear Dimension &Liniová kóta - + &Perimeter &Obvod - + &Rectangle Perimeter Obvod o&bdélníka - + &Area &Plocha - + R&ectangle Area Ploc&ha obdélníka - + An&gle Ú&hel - + &Show Dimensions &Zobrazid kóty - + &Clear Dimensions S&mazat kóty - + Se&ttings &Nastavení - + &Dimensions Kót&y - + A = %1 %2 - + p = %1 %2 diff --git a/translations/PDF4QT_de.ts b/translations/PDF4QT_de.ts index 4f9e73a..4483505 100644 --- a/translations/PDF4QT_de.ts +++ b/translations/PDF4QT_de.ts @@ -165,32 +165,62 @@ - - sq. pt + + m - - sq. in + + ft - - sq. mm + + yd + sq. pt + + + + + sq. in + + + + + sq. mm + + + + sq. cm - + + sq. m + + + + + sq. ft + + + + + sq. yd + + + + ° - + rad @@ -6071,6 +6101,11 @@ li.checked::marker { content: "\2612"; } Angles + + + Scale 1: + + @@ -12032,72 +12067,72 @@ li.checked::marker { content: "\2612"; } pdfplugin::DimensionsPlugin - + &Horizontal Dimension - + &Vertical Dimension - + &Linear Dimension - + &Perimeter - + &Rectangle Perimeter - + &Area - + R&ectangle Area - + An&gle - + &Show Dimensions - + &Clear Dimensions - + Se&ttings - + &Dimensions - + A = %1 %2 - + p = %1 %2 diff --git a/translations/PDF4QT_en.ts b/translations/PDF4QT_en.ts index 6efdeea..9d50a44 100644 --- a/translations/PDF4QT_en.ts +++ b/translations/PDF4QT_en.ts @@ -165,32 +165,62 @@ - - sq. pt + + m - - sq. in + + ft - - sq. mm + + yd + sq. pt + + + + + sq. in + + + + + sq. mm + + + + sq. cm - + + sq. m + + + + + sq. ft + + + + + sq. yd + + + + ° - + rad @@ -6071,6 +6101,11 @@ li.checked::marker { content: "\2612"; } Angles + + + Scale 1: + + @@ -12032,72 +12067,72 @@ li.checked::marker { content: "\2612"; } pdfplugin::DimensionsPlugin - + &Horizontal Dimension - + &Vertical Dimension - + &Linear Dimension - + &Perimeter - + &Rectangle Perimeter - + &Area - + R&ectangle Area - + An&gle - + &Show Dimensions - + &Clear Dimensions - + Se&ttings - + &Dimensions - + A = %1 %2 - + p = %1 %2 diff --git a/translations/PDF4QT_es.ts b/translations/PDF4QT_es.ts index b8dde38..9b6edb1 100644 --- a/translations/PDF4QT_es.ts +++ b/translations/PDF4QT_es.ts @@ -165,32 +165,62 @@ - - sq. pt + + m - - sq. in + + ft - - sq. mm + + yd + sq. pt + + + + + sq. in + + + + + sq. mm + + + + sq. cm - + + sq. m + + + + + sq. ft + + + + + sq. yd + + + + ° - + rad @@ -6071,6 +6101,11 @@ li.checked::marker { content: "\2612"; } Angles + + + Scale 1: + + @@ -12032,72 +12067,72 @@ li.checked::marker { content: "\2612"; } pdfplugin::DimensionsPlugin - + &Horizontal Dimension - + &Vertical Dimension - + &Linear Dimension - + &Perimeter - + &Rectangle Perimeter - + &Area - + R&ectangle Area - + An&gle - + &Show Dimensions - + &Clear Dimensions - + Se&ttings - + &Dimensions - + A = %1 %2 - + p = %1 %2 diff --git a/translations/PDF4QT_ko.ts b/translations/PDF4QT_ko.ts index b952459..8a7b1d6 100644 --- a/translations/PDF4QT_ko.ts +++ b/translations/PDF4QT_ko.ts @@ -165,32 +165,62 @@ - - sq. pt + + m - - sq. in + + ft - - sq. mm + + yd + sq. pt + + + + + sq. in + + + + + sq. mm + + + + sq. cm - + + sq. m + + + + + sq. ft + + + + + sq. yd + + + + ° - + rad @@ -6071,6 +6101,11 @@ li.checked::marker { content: "\2612"; } Angles + + + Scale 1: + + @@ -12032,72 +12067,72 @@ li.checked::marker { content: "\2612"; } pdfplugin::DimensionsPlugin - + &Horizontal Dimension - + &Vertical Dimension - + &Linear Dimension - + &Perimeter - + &Rectangle Perimeter - + &Area - + R&ectangle Area - + An&gle - + &Show Dimensions - + &Clear Dimensions - + Se&ttings - + &Dimensions - + A = %1 %2 - + p = %1 %2 diff --git a/translations/PDF4QT_zh_CN.ts b/translations/PDF4QT_zh_CN.ts index aa0cc67..58f7472 100644 --- a/translations/PDF4QT_zh_CN.ts +++ b/translations/PDF4QT_zh_CN.ts @@ -165,32 +165,62 @@ - - sq. pt + + m - - sq. in + + ft - - sq. mm + + yd + sq. pt + + + + + sq. in + + + + + sq. mm + + + + sq. cm - + + sq. m + + + + + sq. ft + + + + + sq. yd + + + + ° - + rad 弧度 @@ -6209,6 +6239,11 @@ li.checked::marker { content: "\2612"; } Angles 角度 + + + Scale 1: + + @@ -12170,72 +12205,72 @@ li.checked::marker { content: "\2612"; } pdfplugin::DimensionsPlugin - + &Horizontal Dimension 水平尺寸(&H) - + &Vertical Dimension 垂直尺寸(&V) - + &Linear Dimension 直线尺寸(&L) - + &Perimeter 周长(&P) - + &Rectangle Perimeter 矩形周长(&R) - + &Area 区域(&A) - + R&ectangle Area 矩形区域(&E) - + An&gle 角度(&G) - + &Show Dimensions 显示尺寸(&S) - + &Clear Dimensions 清空尺寸(&C) - + Se&ttings 设置(&T) - + &Dimensions 尺寸(&D) - + A = %1 %2 A = %1 %2 - + p = %1 %2 p = %1 %2