Ignore:
Timestamp:
10/20/02 06:40:54 (20 years ago)
Author:
Nicholas Riley
Message:

Pester 1.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSAlarmsController.m

    r26 r28  
    1818    if ( (self = [super initWithWindowNibName: @"Alarms"]) != nil) {
    1919        alarms = [PSAlarms allAlarms];
    20         [[self window] center];
     20        // XXX workaround for bug in 10.2.1, 10.1.5: autosave name set in IB doesn't show up
     21        [self setWindowFrameAutosaveName: @"Pester alarm list"];
     22        // Apple documents the NSUserDefaults key, so we can rely on it hopefully.
     23        if (nil == [[NSUserDefaults standardUserDefaults] objectForKey:
     24            [@"NSWindow Frame " stringByAppendingString: [[self window] frameAutosaveName]]])
     25        {
     26            [[self window] center];
     27        }
    2128        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(alarmsChanged) name: PSAlarmsDidChangeNotification object: alarms];
    2229        [tableView setAutosaveName: @"Alarm list"];
     
    5562    else {
    5663        NSCalendarDate *date = [alarm date];
    57         if ([[tableColumn identifier] isEqualToString: @"date"]) return [date descriptionWithCalendarFormat: [[NSUserDefaults standardUserDefaults] stringForKey: NSShortDateFormatString]];
     64        if ([[tableColumn identifier] isEqualToString: @"date"]) return [alarm shortDateString];
    5865        if ([[tableColumn identifier] isEqualToString: @"time"]) {
    5966            if (date == nil) return @"ÇexpiredÈ";
    60             return [date descriptionWithCalendarFormat: @"%1I:%M:%S%p"]; // XXX regular format doesn't work
     67            return [alarm timeString];
    6168        }
    6269    }
     
    7582
    7683@implementation PSAlarmsController (NSWindowDelegate)
     84
     85// XXX workaround for bug in 10.1.5, 10.2.1 (and earlier?): no autosave on window move
     86- (void)windowDidMove:(NSNotification *)aNotification
     87{
     88    NSString *autosaveName = [[self window] frameAutosaveName];
     89    // on initial display, we get a notification inside -[NSWindow setFrameAutosaveName]!
     90    if (autosaveName != nil) {
     91        [[self window] saveFrameUsingName: autosaveName];
     92    }
     93}
    7794
    7895- (NSRect)windowWillUseStandardFrame:(NSWindow *)sender defaultFrame:(NSRect)defaultFrame;
Note: See TracChangeset for help on using the changeset viewer.