#include "insets/InsetBox.h"
#include "support/gettext.h"
-#include "support/foreach.h"
#include "support/lstrings.h"
#include <QComboBox>
}
-namespace {
-
-bool ColorSorter(ColorCode lhs, ColorCode rhs)
-{
- return support::compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
-}
-
-} // namespace anon
-
-
GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
{
setupUi(this);
ialignCO->setEnabled(ibox);
setSpecial(ibox);
- // halign is only allowed if a width is used
- halignCO->setEnabled(widthCB->isChecked());
+ // halign is only allowed without inner box and if a width is used and if
+ // pagebreak is not used
+ halignCO->setEnabled(!pagebreakCB->isChecked() && widthCB->isChecked()
+ && ((!ibox && type == "Boxed") || inner_type == "makebox"));
// add the entry "Stretch" if the box is \makebox or \framebox and if not already there
if ((inner_type == "makebox" || (type == "Boxed" && inner_type == "none"))
&& halignCO->count() < 4)
- halignCO->addItem(toqstr("Stretch"));
+ halignCO->addItem(qt_("Stretch"));
else if (inner_type != "makebox" && (type != "Boxed" && inner_type != "none"))
- halignCO->removeItem(3);
+ halignCO->removeItem(3);
// pagebreak is only allowed for Boxed without inner box
pagebreakCB->setEnabled(!ibox && type == "Boxed");
if (ids_spec_.contains(unit) && !isValidLength(fromqstr(value))) {
params.special = fromqstr(unit);
// Note: the unit is simply ignored in this case
- params.width = Length(value.toDouble(), Length::IN);
+ params.width = Length(widgetToDouble(widthED), Length::IN);
} else {
params.special = "none";
// we must specify a valid length in this case
if (ids_spec_.contains(unit) && !isValidLength(fromqstr(value))) {
params.height_special = fromqstr(unit);
// Note: the unit is simply ignored in this case
- params.height = Length(value.toDouble(), Length::IN);
+ params.height = Length(widgetToDouble(heightED), Length::IN);
} else {
params.height_special = "none";
params.height =
widthED->setEnabled(false);
widthUnitsLC->setEnabled(false);
}
- // halign is only allowed if a width is used
- halignCO->setEnabled(widthCB->isChecked());
+ // halign is only allowed without inner box and if a width is used and if
+ // pagebreak is not used
+ halignCO->setEnabled(!pagebreakCB->isChecked() && widthCB->isChecked()
+ && ((!ibox && outer == "Boxed") || itype == "makebox"));
// add the entry "Stretch" if the box is \makebox or \framebox and if not already there
if ((itype == "makebox" || (outer == "Boxed" && itype == "none"))
&& halignCO->count() < 4)
- halignCO->addItem(toqstr("Stretch"));
+ halignCO->addItem(qt_("Stretch"));
else if (itype != "makebox" && (outer != "Boxed" && itype != "none"))
halignCO->removeItem(3);
// pagebreak is only allowed for Boxed without inner box