Ignore:
Timestamp:
11/23/07 04:58:05 (17 years ago)
Author:
Nicholas Riley
Message:

English.lproj/MainMenu.nib: Modernize menu and alarm set dialog
layout. Use keyed archiving (10.2+) nib format.

Info-Pester.plist: Moved from old PBX project.

NJRFSObjectSelector.m: Bug fixes from code sent to Joey: remove
incorrect usage of tryToPerform:with:; fix logic error in menu
construction. Work around Cocoa's deciding that the menu font size
needs adjustment when it doesn't - so the menu font size now matches
the button font size, though the position is still off. Don't pop up
a menu if we're disabled. Use IconRefs for menu icons, though not
(yet) for the button icon.

NJRHistoryTrackingComboBox.m: Remove item height adjustment
workaround; it now makes the items too tall.

NJRHotKey.m: Add a missing [super dealloc] caught by current GCC.

NJRHotKeyField.m: Add a missing [super dealloc] caught by current GCC.

NJRHotKeyManager.m: Add a missing [super dealloc] caught by current
GCC.

NJRIntervalField.m: Fix some type errors.

NJRQTMediaPopUpButton.m: Replace SoundFileManager SPI usage, which
doesn't work in Leopard anyway, with manual enumeration of system
sounds. Start migration to QTKit. Use IconRefs for menu icons.

NJRReadMeController.m: Change source encoding to UTF-8.

NJRSoundManager.m: Fix a type error.

NJRVoicePopUpButton.m: Change source encoding to UTF-8.

NSMenuItem-NJRExtensions.[hm]: Code from ICeCoffEE to use IconRefs for
menu item icons.

PSAlarm.m: Change source encoding to UTF-8.

PSAlarms.m: Fix a signedness mismatch.

PSAlarmsController.m: Change source encoding to UTF-8.

PSAlarmSetController.m: Set keyboard focus after unchecking "Do
script:" and "Play" checkboxes.

PSAlerts.m: Add a missing [super dealloc] caught by current GCC. Fix
a memory leak in property list serialization.

PSPowerManager.[hm]: There's now API for scheduling wakeups; use it
(the old code asserted on startup). To fix: removing scheduled
wakeup. Fix a small type-checking error.

PSPreferencesController.m: Add a missing [super dealloc] caught by
current GCC.

PSScriptAlert.m: Change source encoding to UTF-8.

PSTimeDateEditor.m: Fix a tiny, and one-time, memory leak.

PSTimer.m: Update for new PSPowerManager API.

Pester.pbproj: Deleted; now supporting OS X 10.4+ (up from 10.1,
aiee.)

Pester.xcodeproj: Xcode 2.4+ project, upgraded targets, etc.

SoundFileManager.h: Deleted; this SPI no longer exists in Leopard and
possibly earlier.

File:
1 edited

Legend:

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

    r53 r355  
    11#import "NJRFSObjectSelector.h"
     2#import "NSMenuItem-NJRExtensions.h"
    23#import "NSImage-NJRExtensions.h"
    34#import "NSString-NJRExtensions.h"
     
    8485- (void)setImage:(NSImage *)image;
    8586{
     87    // XXX change to use IconRef; see ICeCoffEELabeledIconCell and Google
    8688    [super setImage: [image bestFitImageForSize: [[self cell] cellSize]]];
    8789}
     
    111113        NSAssert1([files count] == 1, @"%d items returned, only one expected", [files count]);
    112114        [self setPath: [files objectAtIndex: 0]];
    113         [[self target] tryToPerform: [self action] with: self];
     115                if ([self target] != nil && [[self target] respondsToSelector:[self action]])
     116                        [[self target] performSelector: [self action] withObject: self];
    114117    }
    115118}
     
    145148            }
    146149            do {
     150                NSAssert1(![path isEqualToString: revealPath], @"Stuck on path |%@|", [alias fullPath]);
    147151                item = [menu addItemWithTitle: [fmgr displayNameAtPath: path]
    148152                                       action: @selector(revealInFinder:)
     
    150154                [item setTarget: self];
    151155                [item setRepresentedObject: revealPath];
    152                 [item setImage:
    153                     [[[NSWorkspace sharedWorkspace] iconForFile: path] bestFitImageForSize: NSMakeSize(16, 16)]];
     156                [item setImageFromPath: path];
    154157                revealPath = path;
    155158                path = [path stringByDeletingLastPathComponent];
    156                 NSAssert1(![path isEqualToString: revealPath], @"Stuck on path |%@|", [alias fullPath]);
    157159            } while (![revealPath isEqualToString: @"/"] && ![path isEqualToString: @"/Volumes"]);
    158160            [[self cell] setMenu: menu];
     
    195197- (void)mouseDown:(NSEvent *)theEvent;
    196198{
     199    if (![self isEnabled]) return;
     200   
    197201    NSMenu *menu = [[self cell] menu];
    198202    MenuRef mRef = _NSGetCarbonMenu(menu);
     
    219223                                  pressure: [theEvent pressure]];
    220224
    221     // this undocumented API does not work any better; contextual menu items are still added:
    222     // [menu _popUpMenuWithEvent: theEvent forView: self];
    223     [NSMenu popUpContextMenu: menu withEvent: theEvent forView: self];
     225    // XXX otherwise Cocoa thoughtfully doesn't give me the font I want
     226    NSFont *font = [[self cell] font];
     227    [NSMenu popUpContextMenu: menu withEvent: theEvent forView: self withFont:
     228     [NSFont fontWithName: [font fontName] size: [font pointSize] - 0.001]];
    224229}
    225230
     
    310315        if (url == nil) return NO;
    311316        [self setPath: [url path]];
    312         [[self target] tryToPerform: [self action] with: self];
     317                if ([self target] != nil && [[self target] respondsToSelector:[self action]])
     318                        [[self target] performSelector: [self action] withObject: self];
    313319    }
    314320    return YES;
Note: See TracChangeset for help on using the changeset viewer.