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.
This commit is contained in:
Georg Baum 2015-07-18 16:41:52 +02:00
parent eaf70913ac
commit bf515425e1
3 changed files with 22 additions and 0 deletions

View File

@ -220,6 +220,18 @@ GuiExternal::GuiExternal(GuiView & lv)
// add scale item // add scale item
widthUnitCO->insertItem(0, qt_("Scale%"), "scale"); 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();
} }

View 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) void LengthCombo::removeUnit(lyx::Length::UNIT unit)
{ {
QString const val = lyx::toqstr(lyx::stringFromUnit(unit)); QString const val = lyx::toqstr(lyx::stringFromUnit(unit));

View File

@ -41,6 +41,8 @@ public:
virtual void setEnabled(bool b); virtual void setEnabled(bool b);
/// use the %-items? /// use the %-items?
void noPercents(); void noPercents();
/// Remove EM, EX and MU units
void removeFontDependent();
/// remove a unit from the combo /// remove a unit from the combo
void removeUnit(lyx::Length::UNIT unit); void removeUnit(lyx::Length::UNIT unit);
/// add a unit to the combo /// add a unit to the combo