#include "GuiBox.h"
-#include "FuncRequest.h"
#include "LengthCombo.h"
#include "Length.h"
#include "qt_helpers.h"
}
-void GuiBox::on_innerBoxCO_activated(int index)
+void GuiBox::on_innerBoxCO_activated(int /* index */)
{
+ QString itype =
+ innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+ // handle parbox and minipage the same way
bool const ibox =
- (innerBoxCO->itemData(index).toString() != "none");
+ (itype != "none"
+ && itype != "makebox");
QString const outer =
typeCO->itemData(typeCO->currentIndex()).toString();
valignCO->setEnabled(ibox);
ialignCO->setEnabled(ibox);
+ if (heightCB->isChecked() && !ibox)
+ heightCB->setChecked(false);
heightCB->setEnabled(ibox);
// except for frameless and boxed, the width cannot be specified if
// there is no inner box
- bool const width_disabled = (!ibox && outer != "Frameless" &&
- outer != "Boxed");
- widthED->setEnabled(!width_disabled);
- widthUnitsLC->setEnabled(!width_disabled);
- // halign and pagebreak are only allowed for Boxed without inner box
- halignCO->setEnabled(!ibox && outer == "Boxed");
+ bool const width_enabled =
+ ibox || outer == "Frameless" || outer == "Boxed";
+ widthED->setEnabled(width_enabled);
+ widthUnitsLC->setEnabled(width_enabled);
+ // halign is only allowed for Boxed without inner box or for makebox
+ halignCO->setEnabled((!ibox && outer == "Boxed")
+ || (itype == "makebox"));
+ // pagebreak is only allowed for Boxed without inner box
pagebreakCB->setEnabled(!ibox && outer == "Boxed");
setSpecial(ibox);
changed();
QString const type =
typeCO->itemData(index).toString();
bool const frameless = (type == "Frameless");
- if (frameless) {
- valignCO->setEnabled(true);
- ialignCO->setEnabled(true);
- heightCB->setEnabled(true);
- setSpecial(true);
- }
- if (type != "Boxed")
- pagebreakCB->setChecked(false);
QString itype =
innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+ setInnerType(frameless, itype);
+ // refresh itype because it might have been changed in setInnerType
+ itype =
+ innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+ // handle parbox and minipage the same way
+ bool const ibox =
+ (itype != "none"
+ && itype != "makebox");
+ if (frameless && itype != "makebox") {
+ valignCO->setEnabled(ibox);
+ ialignCO->setEnabled(ibox);
+ if (heightCB->isChecked() && !ibox)
+ heightCB->setChecked(false);
+ heightCB->setEnabled(ibox);
+ setSpecial(ibox);
+ }
// except for frameless and boxed, the width cannot be specified if
// there is no inner box
- bool const width_disabled = (itype == "none" && !frameless
- && type != "Boxed");
- widthED->setEnabled(!width_disabled);
- widthUnitsLC->setEnabled(!width_disabled);
- // halign and pagebreak are only allowed for Boxed without inner box
- halignCO->setEnabled(type == "Boxed" && itype == "none");
+ bool const width_enabled =
+ itype != "none" || frameless || type == "Boxed";
+ widthED->setEnabled(width_enabled);
+ widthUnitsLC->setEnabled(width_enabled);
+ // halign is only allowed for Boxed without inner box or for makebox
+ halignCO->setEnabled((type == "Boxed" && itype == "none") || (itype == "makebox"));
+ // pagebreak is only allowed for Boxed without inner box
pagebreakCB->setEnabled(type == "Boxed" && itype == "none");
- setInnerType(frameless, itype);
changed();
}
inner_type = "none";
if (params.use_parbox)
inner_type = "parbox";
+ if (params.use_makebox)
+ inner_type = "makebox";
bool const frameless = (params.type == "Frameless");
setInnerType(frameless, inner_type);
c = params.hor_pos;
halignCO->setCurrentIndex(string("lcrs").find(c, 0));
- bool ibox = params.inner_box;
+ bool ibox = (params.inner_box && !params.use_makebox);
valignCO->setEnabled(ibox);
ialignCO->setEnabled(ibox);
setSpecial(ibox);
// halign and pagebreak are only allowed for Boxed without inner box
- halignCO->setEnabled(!ibox && type == "Boxed");
+ halignCO->setEnabled((!ibox && type == "Boxed") || (params.use_makebox));
+ // pagebreak is only allowed for Boxed without inner box
pagebreakCB->setEnabled(!ibox && type == "Boxed");
// except for frameless and boxed, the width cannot be specified if
// there is no inner box
- bool const width_disabled = (!ibox && !frameless
- && type != "Boxed");
- widthED->setEnabled(!width_disabled);
- widthUnitsLC->setEnabled(!width_disabled);
+ bool const width_enabled = (ibox || frameless || type == "Boxed");
+ widthED->setEnabled(width_enabled);
+ widthUnitsLC->setEnabled(width_enabled);
Length::UNIT const default_unit = Length::defaultUnit();
(!pagebreak && innerBoxCO->currentText() != qt_("None"));
params.use_parbox =
(!pagebreak && innerBoxCO->currentText() == qt_("Parbox"));
+ params.use_makebox =
+ (!pagebreak && innerBoxCO->currentText() == qt_("Makebox"));
params.pos = "tcb"[valignCO->currentIndex()];
params.inner_pos = "tcbs"[ialignCO->currentIndex()];
innerBoxCO->clear();
if (!frameless)
innerBoxCO->addItem(qt_("None"), toqstr("none"));
+ else
+ innerBoxCO->addItem(qt_("Makebox"), toqstr("makebox"));
innerBoxCO->addItem(qt_("Parbox"), toqstr("parbox"));
innerBoxCO->addItem(qt_("Minipage"), toqstr("minipage"));
int i = (innerBoxCO->findData(type) != -1)