TypeConsApp typeConsApp = typeExpr.rootTypeConsApp();
// Estimate a reasonable preferred width for the various types.
QualifiedName typeConsName = typeConsApp.getName();
if (typeConsName.equals(CAL_Prelude.TypeConstructors.Double) ||
typeConsName.equals(CAL_Prelude.TypeConstructors.Float) ||
typeConsName.equals(CAL_Prelude.TypeConstructors.Byte) ||
typeConsName.equals(CAL_Prelude.TypeConstructors.Int) ||
typeConsName.equals(CAL_Prelude.TypeConstructors.Integer) ||
typeConsName.equals(CAL_Prelude.TypeConstructors.Decimal) ||
typeConsName.equals(CAL_Prelude.TypeConstructors.Long) ||
typeConsName.equals(CAL_Prelude.TypeConstructors.Short)) {
baseline = "999.99";
} else if (typeConsName.equals(CAL_Prelude.TypeConstructors.Char)) {
baseline = "W";
} else if (typeConsName.equals(CAL_Prelude.TypeConstructors.String)) {
baseline = "A reasonably long string value.";
} else if (typeConsName.equals(CAL_RelativeTime.TypeConstructors.RelativeDate)) {
baseline = "Wednesday, September 30, 1970";
} else if (typeConsName.equals(CAL_RelativeTime.TypeConstructors.RelativeTime)) {
baseline = "12:00:00 AM";
} else if (typeConsName.equals(CAL_RelativeTime.TypeConstructors.RelativeDateTime)) {
baseline = "Wednesday, September 30, 1970 12:00:00 AM";
} else if (typeConsName.equals(CAL_Time.TypeConstructors.Time)) {
baseline = "Wednesday, September 30, 1970 12:00:00 AM UTC";
} else if (typeConsName.equals(CAL_Color.TypeConstructors.Color)) {
fixedWidth = 30;
} else if (typeConsName.equals(CAL_File.TypeConstructors.FileName)) {
baseline = "/home/frank/depots/Quark/CAL";
} else if (typeConsName.equals(CAL_Prelude.TypeConstructors.Function)) {
baseline = "Prelude.FunctionName";
} else if (typeConsName.equals(CAL_Prelude.TypeConstructors.List)) {
TypeExpr elementTypeExpr = typeConsApp.getArg(0);
TypeConsApp elementTypeConsApp = elementTypeExpr.rootTypeConsApp();
if (elementTypeConsApp != null) {
QualifiedName elementTypeConsName = elementTypeConsApp.getName();
if (elementTypeConsName.equals(CAL_Prelude.TypeConstructors.Char)) {
// This is just a String, so use same width.
baseline = "A reasonably long string value.";
} else {
fixedWidth = getTypePreferredWidth(elementTypeExpr, fontMetrics);