]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBox.cpp
Amend f441590c
[lyx.git] / src / frontends / qt4 / GuiBox.cpp
index afc646281fcd6ca8fc5cc4fe01ff3e7063304b3a..e4d425692a7e93e1ca4d5e4fc0022099decc3367 100644 (file)
@@ -103,19 +103,6 @@ static QList<ColorCode> colors()
 }
 
 
-namespace {
-
-struct ColorSorter
-{
-       bool operator()(ColorCode lhs, ColorCode rhs) const {
-               return
-                       support::compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
-       }
-};
-
-} // namespace anon
-
-
 GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
 {
        setupUi(this);
@@ -169,7 +156,7 @@ GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
 
        // the background can be uncolored while the frame cannot
        color_codes_ = colors();
-       sort(color_codes_.begin(), color_codes_.end(), ColorSorter());
+       qSort(color_codes_.begin(), color_codes_.end(), ColorSorter);
        fillComboColor(backgroundColorCO, true);
        fillComboColor(frameColorCO, false);
 
@@ -347,8 +334,10 @@ void GuiBox::paramsToDialog(Inset const * inset)
        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)
@@ -560,8 +549,10 @@ bool GuiBox::checkWidgets(bool readonly) const
                        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)