From bf515425e12ad44e977c26ecdd05fbe3c8be1f5e Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 18 Jul 2015 16:41:52 +0200 Subject: [PATCH] Remove relative units from bounding box When adding units to the external inset bounding box I overlooked that InsetGraphics supports only bb, cm, mm and in. Therefore I added too many units for the external insets. We are not as strict as the graphics inset and allow all absolute units, but no relative ones. --- src/frontends/qt4/GuiExternal.cpp | 12 ++++++++++++ src/frontends/qt4/LengthCombo.cpp | 8 ++++++++ src/frontends/qt4/LengthCombo.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index a7c84bef7a..c72a65a859 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -220,6 +220,18 @@ GuiExternal::GuiExternal(GuiView & lv) // add scale item widthUnitCO->insertItem(0, qt_("Scale%"), "scale"); + + // remove all units from bb that depend on font or other dimensions + // we cannot use these, since we need to compare against absolute + // values from the image file. + xlUnitCO->noPercents(); + xlUnitCO->removeFontDependent(); + xrUnitCO->noPercents(); + xrUnitCO->removeFontDependent(); + ytUnitCO->noPercents(); + ytUnitCO->removeFontDependent(); + ybUnitCO->noPercents(); + ybUnitCO->removeFontDependent(); } diff --git a/src/frontends/qt4/LengthCombo.cpp b/src/frontends/qt4/LengthCombo.cpp index f028684494..6eacfbfb36 100644 --- a/src/frontends/qt4/LengthCombo.cpp +++ b/src/frontends/qt4/LengthCombo.cpp @@ -98,6 +98,14 @@ void LengthCombo::noPercents() } +void LengthCombo::removeFontDependent() +{ + removeUnit(Length::EM); + removeUnit(Length::EX); + removeUnit(Length::MU); +} + + void LengthCombo::removeUnit(lyx::Length::UNIT unit) { QString const val = lyx::toqstr(lyx::stringFromUnit(unit)); diff --git a/src/frontends/qt4/LengthCombo.h b/src/frontends/qt4/LengthCombo.h index 4d32318787..f54d53157e 100644 --- a/src/frontends/qt4/LengthCombo.h +++ b/src/frontends/qt4/LengthCombo.h @@ -41,6 +41,8 @@ public: virtual void setEnabled(bool b); /// use the %-items? void noPercents(); + /// Remove EM, EX and MU units + void removeFontDependent(); /// remove a unit from the combo void removeUnit(lyx::Length::UNIT unit); /// add a unit to the combo -- 2.39.2