# HG changeset patch
# User Santeri Piippo <crimsondusk64@gmail.com>
# Date 1363883217 -7200
# Node ID 109b07334fa0fe35db18c8138f2765043e4353d0
# Parent  961663d054634f27dcb2b58ca900de3ef66bea45
If editing contents of a gibberish object, show the reason for the gibberishness in the dialog. Clamp the bounding box scale to at least 1.0 so that polygons are visible in new files.

diff -r 961663d05463 -r 109b07334fa0 bbox.cpp
--- a/bbox.cpp	Thu Mar 21 16:25:03 2013 +0200
+++ b/bbox.cpp	Thu Mar 21 18:26:57 2013 +0200
@@ -107,13 +107,15 @@
 	double fXScale = (v0.x - v1.x);
 	double fYScale = (v0.y - v1.y);
 	double fZScale = (v0.z - v1.z);
-	double* fpSize = &fZScale;
+	double fSize = fZScale;
 	
 	if (fXScale > fYScale) {
 		if (fXScale > fZScale)
-			fpSize = &fXScale;
+			fSize = fXScale;
 	} else if (fYScale > fZScale)
-		fpSize = &fYScale;
+		fSize = fYScale;
 	
-	return (*fpSize) / 2;
+	if (fSize >= 2.0f)
+		return (fSize / 2);
+	return 1.0f;
 }
diff -r 961663d05463 -r 109b07334fa0 zz_setContentsDialog.cpp
--- a/zz_setContentsDialog.cpp	Thu Mar 21 16:25:03 2013 +0200
+++ b/zz_setContentsDialog.cpp	Thu Mar 21 18:26:57 2013 +0200
@@ -39,12 +39,25 @@
 		"standard</a> for further information.");
 	qContents->setMinimumWidth (384);
 	
+	if (obj->getType() == OBJ_Gibberish) {
+		qErrorLabel = new QLabel;
+		qErrorLabel->setText (str::mkfmt ("<span style=\"color: #900\">%s</span>",
+			static_cast<LDGibberish*> (obj)->zReason.chars()));
+	}
+	
 	IMPLEMENT_DIALOG_BUTTONS
 	
 	QVBoxLayout* layout = new QVBoxLayout;
 	layout->addWidget (qContentsLabel);
 	layout->addWidget (qContents);
-	layout->addWidget (qButtons);
+	
+	QHBoxLayout* layout2 = new QHBoxLayout;
+	
+	if (obj->getType() == OBJ_Gibberish)
+		layout2->addWidget (qErrorLabel);
+	
+	layout2->addWidget (qButtons);
+	layout->addLayout (layout2);
 	setLayout (layout);
 	
 	setWindowTitle (APPNAME_DISPLAY " - setting contents");
diff -r 961663d05463 -r 109b07334fa0 zz_setContentsDialog.h
--- a/zz_setContentsDialog.h	Thu Mar 21 16:25:03 2013 +0200
+++ b/zz_setContentsDialog.h	Thu Mar 21 18:26:57 2013 +0200
@@ -31,7 +31,7 @@
 // =============================================================================
 class SetContentsDialog : public QDialog {
 public:
-	QLabel* qContentsLabel;
+	QLabel* qContentsLabel, *qErrorLabel;
 	QLineEdit* qContents;
 	QDialogButtonBox* qButtons;