commit bf515425e12ad44e977c26ecdd05fbe3c8be1f5e
Author: Georg Baum <b...@lyx.org>
Date:   Sat Jul 18 16:41:52 2015 +0200

    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.

diff --git a/src/frontends/qt4/GuiExternal.cpp 
b/src/frontends/qt4/GuiExternal.cpp
index a7c84be..c72a65a 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 f028684..6eacfbf 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 4d32318..f54d531 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

Reply via email to