From ca27dcbdf19a0b76ef78b3f6124bd011600a6502 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Fri, 13 Feb 2004 00:08:27 +0000 Subject: [PATCH] Status windows with buttons now scale properly. Trials that are expired now get extended by 3 days. --- MTBlingController.m | 5 +++-- MainController.m | 15 +++++++++++++++ StatusWindow.m | 21 +++++++++++++++++---- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/MTBlingController.m b/MTBlingController.m index 8e9af92..a09be61 100755 --- a/MTBlingController.m +++ b/MTBlingController.m @@ -50,9 +50,10 @@ if ( ! window ) { window = [MTShizzleWindow sharedWindowForSender:self]; } - + [NSApp activateIgnoringOtherApps:YES]; [window center]; - [window makeKeyAndOrderFront:nil]; + [window orderFrontRegardless]; + [window makeKeyWindow]; // [window setLevel:NSStatusWindowLevel]; } diff --git a/MainController.m b/MainController.m index bf3bda3..a543288 100755 --- a/MainController.m +++ b/MainController.m @@ -214,8 +214,10 @@ static MainController *sharedController; globalPrefs = [[df persistentDomainForName:@".GlobalPreferences"] mutableCopy]; if (date) { [globalPrefs setObject:date forKey:@"ITMTTrialStart"]; + [globalPrefs setObject:[NSNumber numberWithInt:1200] forKey:@"ITMTTrialVers"]; } else { [globalPrefs removeObjectForKey:@"ITMTTrialStart"]; + [globalPrefs removeObjectForKey:@"ITMTTrialVers"]; } [df setPersistentDomain:globalPrefs forName:@".GlobalPreferences"]; [df synchronize]; @@ -234,7 +236,20 @@ static MainController *sharedController; if (![self blingBling]) { if ( (! [self getBlingTime] ) || ([now timeIntervalSinceDate:[self getBlingTime]] < 0) ) { [self setBlingTime:now]; + } else if ([[[df persistentDomainForName:@".GlobalPreferences"] objectForKey:@"ITMTTrialVers"] intValue] < 1200) { + if ([now timeIntervalSinceDate:[self getBlingTime]] >= 345600) { + [self setBlingTime:[now addTimeInterval:-259200]]; + } else { + NSMutableDictionary *globalPrefs; + [df synchronize]; + globalPrefs = [[df persistentDomainForName:@".GlobalPreferences"] mutableCopy]; + [globalPrefs setObject:[NSNumber numberWithInt:1200] forKey:@"ITMTTrialVers"]; + [df setPersistentDomain:globalPrefs forName:@".GlobalPreferences"]; + [df synchronize]; + [globalPrefs release]; + } } + if ( ([now timeIntervalSinceDate:[self getBlingTime]] >= 604800) && (blinged != YES) ) { blinged = YES; [statusItem setEnabled:NO]; diff --git a/StatusWindow.m b/StatusWindow.m index 8e88f47..ef0f878 100755 --- a/StatusWindow.m +++ b/StatusWindow.m @@ -341,6 +341,7 @@ { if ( ! _locked ) { + float divisor = 1.0; float textWidth = 0.0; float textHeight = 0.0; float okWidth = 0.0; @@ -358,14 +359,26 @@ NSArray *lines = [message componentsSeparatedByString:@"\n"]; id oneLine = nil; NSEnumerator *lineEnum = [lines objectEnumerator]; + float baseFontSize = 18.0; ITTextField *textField; ITButton *okButton; ITButton *cancelButton; NSColor *textColor = [NSColor whiteColor]; - NSFont *font = [NSFont fontWithName:@"Lucida Grande Bold" size:18]; - NSDictionary *attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; - NSFont *buttonFont = [NSFont fontWithName:@"Lucida Grande Bold" size:14]; - NSDictionary *buttonAttr = [NSDictionary dictionaryWithObjectsAndKeys: + NSFont *font; + NSDictionary *attr; + NSFont *buttonFont; + NSDictionary *buttonAttr; + + if ( _sizing == ITTransientStatusWindowSmall ) { + divisor = SMALL_DIVISOR; + } else if ( _sizing == ITTransientStatusWindowMini ) { + divisor = MINI_DIVISOR; + } + + font = [NSFont fontWithName:@"Lucida Grande Bold" size:(baseFontSize / divisor)]; + attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; + buttonFont = [NSFont fontWithName:@"Lucida Grande Bold" size:(14 / divisor)]; + buttonAttr = [NSDictionary dictionaryWithObjectsAndKeys: buttonFont , NSFontAttributeName, textColor , NSForegroundColorAttributeName, nil]; -- 2.20.1