InsetBox.cpp:
        
Corrected text in the box. Currently, the text says only either the type
of inner box or the framestyle. 
        
GuiBox.cpp:
        
Some strange things happened when toying with the gui. When refilling
the widthUnits box, the current state was not remembered. The handling
of the index of the inner box widget was not completely correct when the
number of items change. This can be seen when selecting No Frame twice,
then Parbox changes into Minipage. 
        
Vincent
Index: src/insets/InsetBox.cpp
===================================================================
--- src/insets/InsetBox.cpp	(revision 26699)
+++ src/insets/InsetBox.cpp	(working copy)
@@ -139,21 +139,26 @@
 
 void InsetBox::setButtonLabel()
 {
-	BoxType btype = boxtranslator().find(params_.type);
+	BoxType const btype = boxtranslator().find(params_.type);
 
 	docstring label;
 	label += _("Box");
-	label += " (";
-	if (btype == Frameless) {
+	label += " (";	
+
+	if (params_.inner_box) {
 		if (params_.use_parbox)
 			label += _("Parbox");
 		else
 			label += _("Minipage");
-	} else {
+	}
+
+	if (params_.inner_box && btype != Frameless)
+		label += ", ";	
+
+	if (btype != Frameless)
 		label += boxtranslator_loc().find(btype);
-	}
+
 	label += ")";
-
 	setLabel(label);
 }
 
Index: src/frontends/qt4/GuiBox.cpp
===================================================================
--- src/frontends/qt4/GuiBox.cpp	(revision 26699)
+++ src/frontends/qt4/GuiBox.cpp	(working copy)
@@ -185,6 +185,8 @@
 	if (index != 1)
 		pagebreakCB->setChecked(false);
 	int itype = innerBoxCO->currentIndex();
+	if (innerBoxCO->count() == 2)
+		++itype;
 	pagebreakCB->setEnabled(index == 1 && itype == 0);
 	widthED->setEnabled(index != 5);
 	widthUnitsLC->setEnabled(index != 5);
@@ -414,8 +416,10 @@
 	ids_spec_ = boxGuiSpecialLengthIds();
 	gui_names_spec_ = boxGuiSpecialLengthNames();
 
+	QString const current_text = widthUnitsLC->currentText();
+
 	// check if the widget contains the special units
-	int count = widthUnitsLC->count();
+	int const count = widthUnitsLC->count();
 	bool has_special = false;
 	for (int i = 0; i != count; ++i)
 		if (widthUnitsLC->itemText(i).contains(qt_("Total Height")) > 0)
@@ -430,6 +434,10 @@
 		for (int i = 0; i != num_units; ++i)
 			widthUnitsLC->addItem(qt_(unit_name_gui[i]));
 	}
+	// restore selected text, if possible
+	int const idx = widthUnitsLC->findText(current_text);
+	if (idx != -1)
+		widthUnitsLC->setCurrentIndex(idx);
 }
 
 
@@ -446,8 +454,6 @@
 		else
 			innerBoxCO->setCurrentIndex(i);
 	} else {
-		if (innerBoxCO->count() == 2)
-			++i;
 		innerBoxCO->clear();
 		innerBoxCO->addItem(qt_("None"));
 		innerBoxCO->addItem(qt_("Parbox"));

Reply via email to