The attached patch fixes: http://bugzilla.lyx.org/show_bug.cgi?id=3242 and http://bugzilla.lyx.org/show_bug.cgi?id=4233
The problem was that we set a height as second optional argument for plain minipages and parboxes, but they only have one optional argument. Only when there is a decoration box around it, a second argument can be used.
There is one minor issue: I can't set the height unit box to disabled state when the box dialog is first shown. I tried to disable this in all places of GuiBox.cpp and also in the BoxUi.ui, but it is set enabled somewhere else.
Can anybody help me here please? Jürgen, OK also for branch when this issue is solved? (The patch for bug 4233 can go in independent from this open issue.) regards Uwe
Index: frontends/qt4/GuiBox.cpp =================================================================== --- frontends/qt4/GuiBox.cpp (revision 20455) +++ frontends/qt4/GuiBox.cpp (working copy) @@ -51,7 +51,7 @@ box_gui_tokens_special_length(ids_spec_, gui_names_spec_); for (unsigned int i = 1; i < gui_names_spec_.size(); ++i) heightUnitsLC->addItem(toqstr(gui_names_spec_[i])); - + connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); @@ -79,6 +79,12 @@ heightED->setValidator(unsignedLengthValidator(heightED)); widthED->setValidator(unsignedLengthValidator(widthED)); + // height is not allowed in default setting: minipage + no frame + heightED->setEnabled(false); + // FIXME: + // heightUnitsLC still appears enabled in the dialog + heightUnitsLC->setEnabled(false); + bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy); bc().addReadOnly(typeCO); @@ -127,8 +133,11 @@ valignCO->setEnabled(ibox); ialignCO->setEnabled(ibox); halignCO->setEnabled(!ibox); - heightED->setEnabled(ibox); - heightUnitsLC->setEnabled(ibox); + // height only allowed when parbox/minipage AND a frame + if (typeCO->currentIndex() != 0) { + heightED->setEnabled(ibox); + heightUnitsLC->setEnabled(ibox); + } setSpecial(ibox); } @@ -140,10 +149,15 @@ valignCO->setEnabled(true); ialignCO->setEnabled(true); halignCO->setEnabled(false); - heightED->setEnabled(true); - heightUnitsLC->setEnabled(true); + heightED->setEnabled(false); + heightUnitsLC->setEnabled(false); setSpecial(true); - } + } else + // height only allowed when parbox/minipage AND a frame + if (innerBoxCO->currentText() != qt_("None")) { + heightED->setEnabled(true); + heightUnitsLC->setEnabled(true); + } int itype = innerBoxCO->currentIndex(); setInnerType(frameless, itype); } @@ -155,6 +169,9 @@ widthED->setText("100"); widthUnitsLC->setCurrentItem(Length::PCW); heightED->setText("1"); + // height is not allowed in default setting: minipage + no frame + heightED->setEnabled(false); + heightUnitsLC->setEnabled(false); for (int j = 0; j < heightUnitsLC->count(); j++) { if (heightUnitsLC->itemText(j) == qt_("Total Height")) heightUnitsLC->setCurrentItem(j); @@ -229,10 +246,7 @@ heightUnitsLC->setCurrentIndex(j); } } - } - - heightED->setEnabled(ibox); - heightUnitsLC->setEnabled(ibox); + } //end if !height } @@ -353,7 +367,10 @@ innerBoxCO->clear(); innerBoxCO->addItem(qt_("Parbox")); innerBoxCO->addItem(qt_("Minipage")); - innerBoxCO->setCurrentIndex(i - 1); + if (i != 0) + innerBoxCO->setCurrentIndex(i - 1); + else + innerBoxCO->setCurrentIndex(i); } else { if (innerBoxCO->count() == 2) ++i; Index: insets/InsetBox.cpp =================================================================== --- insets/InsetBox.cpp (revision 20455) +++ insets/InsetBox.cpp (working copy) @@ -338,9 +338,11 @@ } else { // Special heights // FIXME UNICODE + if (btype != Frameless) { os << "[" << params_.height.value() << '\\' << from_utf8(params_.height_special) << ']'; + } } if (params_.inner_pos != params_.pos) os << "[" << params_.inner_pos << "]";