]> git.lyx.org Git - features.git/commitdiff
Remove relative units from bounding box
authorGeorg Baum <baum@lyx.org>
Sat, 18 Jul 2015 14:41:52 +0000 (16:41 +0200)
committerGeorg Baum <baum@lyx.org>
Sat, 18 Jul 2015 14:41:52 +0000 (16:41 +0200)
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
src/frontends/qt4/LengthCombo.cpp
src/frontends/qt4/LengthCombo.h

index a7c84bef7a7350bc2d8db74afbff9a4aa8b3999d..c72a65a8599b266dc360d016b0073e7970e021e9 100644 (file)
@@ -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();
 }
 
 
index f02868449418ded7c100bec96cc82b9c79e7f916..6eacfbfb36d715d5ae2a2586cde557d7232f3084 100644 (file)
@@ -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));
index 4d32318787f780daf0ac7b2cc4a441235cc22f60..f54d53157e6a0384783f7bf4c6b60dad8a6b96dc 100644 (file)
@@ -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