Changeset 3597


Ignore:
Timestamp:
Oct 27, 2007, 2:57:46 PM (14 years ago)
Author:
livings124
Message:

on Leopard us the built-in delegate to select a row while typing, and make Tiger's behavior similar to the new behavior

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r3592 r3597  
    805805}
    806806
    807 - (NSString *)outlineView:(NSOutlineView *)outlineView typeSelectStringForTableColumn:(NSTableColumn *)tableColumn item:(id)item
     807- (NSString *) outlineView: (NSOutlineView *) outlineView typeSelectStringForTableColumn: (NSTableColumn *) tableColumn item: (id) item
    808808{
    809809    return [item objectForKey: @"Name"];
  • trunk/macosx/NSApplicationAdditions.m

    r3595 r3597  
    2525#import "NSApplicationAdditions.h"
    2626
     27#ifndef NSAppKitVersionNumber10_4
     28#define NSAppKitVersionNumber10_4 824
     29#endif
     30
    2731@implementation NSApplication (NSApplicationAdditions)
    2832
  • trunk/macosx/TorrentTableView.m

    r3582 r3597  
    2727#import "Controller.h"
    2828#import "Torrent.h"
     29#import "NSApplicationAdditions.h"
    2930#import "NSMenuAdditions.h"
    3031
     
    107108}
    108109
     110
     111- (NSString *) tableView: (NSTableView *) tableView typeSelectStringForTableColumn: (NSTableColumn *) tableColumn row: (int) row
     112{
     113    return [[fTorrents objectAtIndex: row] name];
     114}
     115
    109116- (void) mouseDown: (NSEvent *) event
    110117{
     118    //NSLog(@"down");
    111119    fClickPoint = [self convertPoint: [event locationInWindow] fromView: nil];
    112120
     
    151159- (void) mouseUp: (NSEvent *) event
    152160{
     161    //NSLog(@"up");
    153162    NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
    154163    int row = [self rowAtPoint: point], oldRow = [self rowAtPoint: fClickPoint];
     
    240249}
    241250
     251- (void) flagsChanged: (NSEvent *) event
     252{
     253    [self display];
     254    [super flagsChanged: event];
     255}
     256
    242257- (void) keyDown: (NSEvent *) event
    243258{
     259    //this is handled by the delegate in Leopard
     260    if ([NSApp isOnLeopardOrBetter])
     261    {
     262        [super keyDown: event];
     263        return;
     264    }
     265   
    244266    if (!fKeyStrokes)
    245267        fKeyStrokes = [[NSMutableArray alloc] init];
     
    263285}
    264286
    265 - (void) flagsChanged: (NSEvent *) event
    266 {
    267     [self display];
    268     [super flagsChanged: event];
    269 }
    270 
    271287- (void) insertText: (NSString *) text
    272288{
     289    //this is handled by the delegate in Leopard
     290    if ([NSApp isOnLeopardOrBetter])
     291    {
     292        [super insertText: text];
     293        return;
     294    }
     295   
    273296    //sort torrents by name before finding closest match
    274297    NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES
     
    278301    NSArray * tempTorrents = [fTorrents sortedArrayUsingDescriptors: descriptors];
    279302    [descriptors release];
     303   
     304    text = [text lowercaseString];
    280305   
    281306    //select torrent closest to text that isn't before text alphabetically
     
    284309    Torrent * torrent;
    285310    while ((torrent = [enumerator nextObject]))
    286         if ([[torrent name] caseInsensitiveCompare: text] != NSOrderedAscending)
     311        if ([[[torrent name] lowercaseString] hasPrefix: text])
    287312        {
    288313            row = [fTorrents indexOfObject: torrent];
Note: See TracChangeset for help on using the changeset viewer.