Changeset 622


Ignore:
Timestamp:
03/02/10 08:04:08 (14 years ago)
Author:
Nicholas Riley
Message:

Fix up date completion with field editor.

Still to do:

  • autocomplete still doesn't trigger in some cases when it should
  • move things into PSTimeDateEditor so they're usable in "until..."
Location:
trunk/Cocoa/Pester/Source
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSAlarmSetController.h

    r579 r622  
    1515@class NJRValidatingField;
    1616@class NJRVoicePopUpButton;
     17@class PSDateFieldEditor;
    1718
    1819@interface PSAlarmSetController : NSWindowController <NSUserInterfaceValidations> {
     
    5051    NSTimer *updateTimer;
    5152    PSAlarm *alarm;
     53    PSDateFieldEditor *dateFieldEditor;
    5254    BOOL isInterval;
    5355}
  • trunk/Cocoa/Pester/Source/PSAlarmSetController.m

    r621 r622  
    2525
    2626#import "PSAlerts.h"
     27#import "PSDateFieldEditor.h"
    2728#import "PSDockBounceAlert.h"
    2829#import "PSScriptAlert.h"
     
    113114    [voice setDelegate: self]; // XXX why don't we do this in IB?  It should use the accessor...
    114115    [wakeUp setEnabled: [PSPowerManager autoWakeSupported]];
     116   
     117    dateFieldEditor = [[PSDateFieldEditor alloc] init];
     118    [dateFieldEditor setFieldEditor: YES];
     119    [dateFieldEditor setDelegate: timeDate];
    115120   
    116121    // XXX workaround for 10.1.x and 10.2.x bug which sets the first responder to the wrong field alternately, but it works if I set the initial first responder to nil... go figure.
     
    605610        [completions removeObjectAtIndex: i];
    606611    }
    607     NSLog(@"%@ %d %@", partialMatch, partialLength, completions);
    608612    return [completions autorelease];
    609613}
    610614
    611615@end
     616
     617@implementation PSAlarmSetController (NSWindowDelegate)
     618
     619- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client;
     620{
     621    if (client == timeDate)
     622        return dateFieldEditor;
     623
     624    return nil;
     625}
     626
     627@end
     628
    612629
    613630@implementation PSAlarmSetController (NSWindowNotifications)
     
    629646- (void)controlTextDidEndEditing:(NSNotification *)notification;
    630647{
    631     NSControl *control = [notification object];
    632 
    633     if (control != timeOfDay)
     648    if ([notification object] != timeOfDay)
    634649        return;
    635650   
     
    683698}
    684699
    685 // XXX need to override NSTextView; when completing with space or tab, we don't get a selector, which causes usability problems with tab and bugs with space
    686700- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector;
    687701{
  • trunk/Cocoa/Pester/Source/Pester.xcodeproj/project.pbxproj

    r619 r622  
    1515                E17562720CF8C53F00FC5057 /* Sparkle.framework in Copy Sparkle.framework */ = {isa = PBXBuildFile; fileRef = E17562610CF8C50B00FC5057 /* Sparkle.framework */; };
    1616                E17CA9AB0CF7F8CB00018B34 /* Manip.pm in Copy Perl Modules */ = {isa = PBXBuildFile; fileRef = E17CA9A90CF7F8C200018B34 /* Manip.pm */; };
     17                E18E8230113CC5C300687310 /* PSDateFieldEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = E18E822F113CC5C300687310 /* PSDateFieldEditor.m */; };
    1718                E1985796104F68EC0082AC3E /* ParseDate.m in Sources */ = {isa = PBXBuildFile; fileRef = E19CC53E0CFDE48C0079DCFC /* ParseDate.m */; };
    1819                E1985798104F68EC0082AC3E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B97325FDCFA39411CA2CEA /* Foundation.framework */; };
     
    230231                E18DAAEB0442CC3E00050002 /* NJRSoundManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJRSoundManager.m; sourceTree = "<group>"; };
    231232                E18DAAEE0442D02500050002 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
     233                E18E822E113CC5C300687310 /* PSDateFieldEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSDateFieldEditor.h; sourceTree = "<group>"; };
     234                E18E822F113CC5C300687310 /* PSDateFieldEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSDateFieldEditor.m; sourceTree = "<group>"; };
    232235                E198579D104F68EC0082AC3E /* libParseDate-10.6.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libParseDate-10.6.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
    233236                E19CC5220CFDE3350079DCFC /* libParseDate-10.4.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libParseDate-10.4.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
     
    687690                                F5F19871036B822E01EB0372 /* NJRVoicePopUpButton.h */,
    688691                                F5F19870036B822E01EB0372 /* NJRVoicePopUpButton.m */,
     692                                E18E822E113CC5C300687310 /* PSDateFieldEditor.h */,
     693                                E18E822F113CC5C300687310 /* PSDateFieldEditor.m */,
    689694                        );
    690695                        name = Views;
     
    950955                                E15044670CFCDC7E00DE47E9 /* NJRValidatingField.m in Sources */,
    951956                                E12CBFD310CC310800159E88 /* NJRMenuSlider.m in Sources */,
     957                                E18E8230113CC5C300687310 /* PSDateFieldEditor.m in Sources */,
    952958                        );
    953959                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.