From 54fad95e5b007eea1d9f8e8e525703489c5aa981 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Mon, 26 Oct 2009 11:11:41 +0000 Subject: [PATCH] Tidied git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28885 72102866-910b-0410-8b05-ffd578937521 --- Source/GSThemeInspector.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/GSThemeInspector.m b/Source/GSThemeInspector.m index b9b882055..679a82844 100644 --- a/Source/GSThemeInspector.m +++ b/Source/GSThemeInspector.m @@ -106,6 +106,8 @@ static GSThemeInspector *sharedInspector = nil; NSTextField *tf; NSRect nameFrame; NSRect frame; + int width; + int fsize = 32; while ((view = [[content subviews] lastObject]) != nil) { @@ -116,12 +118,17 @@ static GSThemeInspector *sharedInspector = nil; [iv setImage: [[GSTheme theme] icon]]; [content addSubview: iv]; + width = cFrame.size.width - 58; tf = new_label([theme name]); - [tf setFont: [NSFont boldSystemFontOfSize: 32]]; - [tf sizeToFit]; - nameFrame = [tf frame]; - nameFrame.origin.x - = (cFrame.size.width - frame.size.width - nameFrame.size.width) / 2; + do + { + [tf setFont: [NSFont boldSystemFontOfSize: fsize]]; + fsize -= 2; + [tf sizeToFit]; + nameFrame = [tf frame]; + } + while (nameFrame.size.width > width && fsize > 8); + nameFrame.origin.x = (width - nameFrame.size.width) / 2; nameFrame.origin.y = cFrame.size.height - nameFrame.size.height - 25; [tf setFrame: nameFrame]; [content addSubview: tf];