Attached is a patch that fixes the regression bug 
http://www.lyx.org/trac/ticket/6298

The fix is simply to take the Apply code we have in trunk in GuiBox.cpp. I tested the patch well and cannot see any further problems. Please test it too.

Jürgen, this should go in to LyX 1.6.5.

thanks and regards
Uwe
Index: GuiBox.cpp
===================================================================
--- GuiBox.cpp	(revision 31815)
+++ GuiBox.cpp	(working copy)
@@ -328,82 +328,37 @@
 	params_.inner_pos = "tcbs"[ialignCO->currentIndex()];
 	params_.hor_pos = "lcrs"[halignCO->currentIndex()];
 
-	int i = -1;
-	bool spec = false;
-	QString special = widthUnitsLC->currentText();
+	QString unit =
+		widthUnitsLC->itemData(widthUnitsLC->currentIndex()).toString();
 	QString value = widthED->text();
-	if (special == qt_("Height")) {
-		i = 0;
-		spec = true;
-	} else if (special == qt_("Depth")) {
-		i = 1;
-		spec = true;
-	} else if (special == qt_("Total Height")) {
-		i = 2;
-		spec = true;
-	} else if (special == qt_("Width")) {
-		i = 3;
-		spec = true;
-	}
-	// the user might insert a non-special value in the line edit
-	if (isValidLength(fromqstr(value)) || i == -1) {
-		params_.special = "none";
-		spec = false;
-	} else
-		params_.special = fromqstr(ids_spec_[i]);
-
-	string width;
-	if (spec) {
-		width = fromqstr(value);
-		// beware: bogosity! the unit is simply ignored in this case
-		width += "in";
+	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);
 	} else {
-		width = widgetsToLength(widthED, widthUnitsLC);
+		params_.special = "none";
+		params_.width = Length(widgetsToLength(widthED, widthUnitsLC));
 	}
 
-	params_.width = Length(width);
-
-	i = -1;
-	spec = false;
-	special = heightUnitsLC->currentText();
-	value = heightED->text();
-	if (special == qt_("Height")) {
-		i = 0;
-		spec = true;
-	} else if (special == qt_("Depth")) {
-		i = 1;
-		spec = true;
-	} else if (special == qt_("Total Height")) {
-		i = 2;
-		spec = true;
-	} else if (special == qt_("Width")) {
-		i = 3;
-		spec = true;
-	}
-	// the user might insert a non-special value in the line edit
-	if (isValidLength(fromqstr(value)) || i == -1) {
-		params_.height_special = "none";
-		spec = false;
-	} else
-		params_.height_special = fromqstr(ids_spec_[i]);
-
-	string height;
-	if (spec  && !isValidLength(fromqstr(heightED->text()))) {
-		height = fromqstr(value);
-		// beware: bogosity! the unit is simply ignored in this case
-		height += "in";
-	} else
-		height = widgetsToLength(heightED, heightUnitsLC);
-
-	// the height parameter is omitted in InsetBox.cpp when the value
+	// the height parameter is omitted if the value
 	// is "1in" and "Total Height" is used as unit.
-	// 1in + "Total Height" means "1\height" which is the LaTeX default when
-	// no height is given
-	if (heightCB->checkState() == Qt::Checked)
-		params_.height = Length(height);
-	else {
+	// 1in + "Total Height" means "1\height" which is the LaTeX default
+	// if no height is given
+	if (heightCB->checkState() == Qt::Unchecked) {
 		params_.height = Length("1in");
 		params_.height_special = "totalheight";
+	} else {
+		unit = heightUnitsLC->itemData(heightUnitsLC->currentIndex()).toString();
+		value = heightED->text();
+		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);
+		} else {
+			params_.height_special = "none";
+			params_.height =
+				Length(widgetsToLength(heightED, heightUnitsLC));
+		}
 	}
 }
 

Reply via email to