Ignore:
Timestamp:
06/11/07 01:21:55 (17 years ago)
Author:
Nicholas Riley
Message:

VERSION: Starting with 1.5d1.

ICeCoffEEKeyEquivalents.m: Support "collision font" for displaying key
equivalent conflicts.

ICeCoffEE.m: Increase debug ICCF_MAX_URL_LEN to 120 for testing. Set
icons in ICCF_ConsolidateServicesMenu (needs better caching).

ICeCoffEEServicePrefController.m: Display icons, proper key
equivalents (instead of #, what was I thinking?!) and conflicts. Fix
a dumb bug in ICCF_PropagateServiceStateChange. Ellipsize long menu
items rather than chopping them off. Fix key equivalent column
getting moved when expanding disclosure triangles.

ICeCoffEELabeledIconCell.[hm]: An IconRef-displaying text cell.

Info-APE Module.plist: Update version to 1.5d1.

ICeCoffEE.xcodeproj: Added files, no significant changes.

English.lproj/InfoPlist.strings: Update version to 1.5d1.

English.lproj/APEInfo.rtfd/TXT.rtf: Some overdue documentation
updates.

ICeCoffEEShared.[hm]: Enable debugging; we're now using
kICServiceShortcut (though not yet for customizable shortcuts) so
define its data type.

ICeCoffEETerminal.m: Remove some useless code to "extend to beginning
of string" which seems to have been stolen from the NSTextView
implementation and not well understood. Handle common uses of
parentheses in URLs; still need to do this for NSTextView.

ICeCoffEESetServicesMenu.[hm]: Needs renaming; now with icon
extraction functionality and semi-working code to create a service
info dictionary.

Info-APEManagerPrefPane.plist: Update version to 1.5d1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m

    r272 r319  
    291291// RFC-ordained max URL length, just to avoid passing IC/LS multi-megabyte documents
    292292#if ICCF_DEBUG
    293 const long ICCF_MAX_URL_LEN = 60; // XXX change later
     293const long ICCF_MAX_URL_LEN = 120; // XXX change later
    294294#else
    295295const long ICCF_MAX_URL_LEN = 1024;
     
    436436
    437437// returns YES if menu contains useful items, NO otherwise
    438 BOOL ICCF_ConsolidateServicesMenu(NSMenu *menu, NSDictionary *serviceOptions) {
     438BOOL ICCF_ConsolidateServicesMenu(NSMenu *menu, NSDictionary *serviceOptions, NSDictionary *serviceInfo) {
    439439    [menu update]; // doesn't propagate to submenus, so we need to do this first
    440440    NSEnumerator *enumerator = [[menu itemArray] objectEnumerator];
    441441    NSMenuItem *menuItem;
    442442    NSMenu *submenu;
    443     NSDictionary *itemOptions = nil;
     443    NSDictionary *itemOptions = nil, *itemInfo = nil;
    444444    BOOL shouldKeepItem = NO, shouldKeepMenu = NO;
    445445
     
    447447        if (serviceOptions != nil)
    448448            itemOptions = [serviceOptions objectForKey: [menuItem title]];
     449        if (serviceInfo != nil)
     450            itemInfo = [serviceInfo objectForKey: [menuItem title]];
    449451        if ([[itemOptions objectForKey: (NSString *)kICServiceHidden] boolValue]) {
    450452            shouldKeepItem = NO;
    451453        } else if ( (submenu = [menuItem submenu]) != nil) {
    452             shouldKeepItem = ICCF_ConsolidateServicesMenu(submenu, [itemOptions objectForKey: (NSString *)kICServiceSubmenu]);
     454            // XXX don't rely on nil-sending working
     455            shouldKeepItem = ICCF_ConsolidateServicesMenu(submenu, [itemOptions objectForKey: (NSString *)kICServiceSubmenu], itemInfo);
    453456            if (shouldKeepItem && [submenu numberOfItems] == 1) { // consolidate
    454457                NSMenuItem *serviceItem = [[submenu itemAtIndex: 0] retain];
    455458                [serviceItem setTitle:
    456459                    [NSString stringWithFormat: @"%@ %@ %@", [menuItem title], [NSString stringWithCharacters: &UNICHAR_BLACK_RIGHT_POINTING_SMALL_TRIANGLE length: 1], [serviceItem title]]];
    457 
     460               
    458461                int serviceIndex = [menu indexOfItem: menuItem];
    459462                [submenu removeItemAtIndex: 0]; // can't have item in two menus
     
    461464                [menu insertItem: serviceItem atIndex: serviceIndex];
    462465                [serviceItem release];
     466                menuItem = serviceItem;
    463467            }
    464468        } else {
     
    466470            shouldKeepItem = [menuItem isEnabled];
    467471        }
    468         if (shouldKeepItem) {
    469             shouldKeepMenu = YES;
    470         } else {
     472        if (!shouldKeepItem) {
    471473            [menu removeItem: menuItem];
    472         }
     474            continue;
     475        }
     476        shouldKeepMenu = YES;
     477       
     478        if (itemInfo == nil) continue;
     479        NSString *bundlePath = (NSString *)[itemInfo objectForKey: (NSString *)kICServiceBundlePath];
     480        if (bundlePath == NULL) continue;
     481        IconRef serviceIcon = ICCF_CopyIconRefForPath(bundlePath);
     482        if (serviceIcon == NULL) continue;
     483        [menuItem _setIconRef: serviceIcon];
     484        ReleaseIconRef(serviceIcon);
    473485    }
    474486
     
    478490NSMenuItem *ICCF_ContextualServicesMenuItem() {
    479491    NSMenuItem *servicesItem = ICCF_ServicesMenuItem();
    480     if (ICCF_ConsolidateServicesMenu([servicesItem submenu], (NSDictionary *)ICCF_prefs.serviceOptions))
     492    NSDictionary *servicesInfo = ICCF_GetServicesInfo(); // XXX cache/retain
     493    if (ICCF_ConsolidateServicesMenu([servicesItem submenu], (NSDictionary *)ICCF_prefs.serviceOptions, servicesInfo))
    481494        return servicesItem;
    482495    else
Note: See TracChangeset for help on using the changeset viewer.