~ubuntu-branches/ubuntu/trusty/paje.app/trusty

« back to all changes in this revision

Viewing changes to ContainerFilter/ContainerSelector.m

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-07 22:59:54 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060707225954-cxx4jqfru2lvu4og
Tags: 1.4.0-1ubuntu1
* Re-sync with Debian
* Add desktop file from Phil Bull (Closes Malone: #36387)

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    // view is an NSBox. we need its contents.
49
49
    view = [[(NSBox *)view contentView] retain];
50
50
 
51
 
    [matrix registerForDraggedTypes:[NSArray arrayWithObject:NSColorPboardType]];
 
51
    [matrix registerForDraggedTypes:
 
52
                                 [NSArray arrayWithObject:NSColorPboardType]];
52
53
    [matrix setDelegate:self];
53
54
//    [matrix setCellClass:[ColoredSwitchButtonCell class]];
54
55
 
65
66
 
66
67
- (void)dealloc
67
68
{
 
69
    [entityTypePopUp removeAllItems];
68
70
    [filters release];
69
71
    [hiddenEntityTypes release];
70
72
    [view release];
273
275
 
274
276
- (void)setConfiguration:(id)config
275
277
{
 
278
    NSDictionary *configuration;
276
279
    NSMutableDictionary *hiddenContainers;
277
280
    NSEnumerator *keyEnum;
278
281
    id key;
279
282
    NSArray *value;
280
283
    NSArray *hiddenTypes;
281
284
 
282
 
    hiddenContainers = [[config objectForKey:@"HiddenContainers"] unifyStrings];
 
285
    NSParameterAssert([config isKindOfClass:[NSDictionary class]]);
 
286
    configuration = config;
 
287
 
 
288
    hiddenContainers = [[configuration objectForKey:@"HiddenContainers"]
 
289
                                                                unifyStrings];
283
290
 
284
291
    keyEnum = [hiddenContainers keyEnumerator];
285
292
    while ((key = [keyEnum nextObject]) != nil) {
287
294
        [filters setObject:[NSMutableSet setWithArray:value] forKey:key];
288
295
    }
289
296
 
290
 
    hiddenTypes = [[config objectForKey:@"HiddenContainerTypes"] unifyStrings];
 
297
    hiddenTypes = [[configuration objectForKey:@"HiddenContainerTypes"]
 
298
                                                               unifyStrings];
291
299
    Assign(hiddenEntityTypes, [NSMutableSet setWithArray:hiddenTypes]);
292
300
    [self hierarchyChanged];
293
301
    [super dataChangedForEntityType:nil];
359
367
    id entityName;
360
368
    int i = 0;
361
369
    ColoredSwitchButtonCell *cell;
362
 
    NSMutableAttributedString *title;
363
370
 
364
371
    if (entityType == nil) {
365
372
        return;
379
386
        [cell setRepresentedObject:entityName];
380
387
#if 0
381
388
#ifndef xxGNUSTEP
 
389
        NSMutableAttributedString *title;
382
390
        title = [[[NSMutableAttributedString alloc] initWithString:[entityName description]] autorelease];
383
391
#if defined(__APPLE__)// || defined(GNUSTEP)
384
392
        [title replaceCharactersInRange:NSMakeRange(0,0) withString:@"# "];
475
483
    return filteredTypes;
476
484
}
477
485
 
478
 
- (BOOL)isHiddenContainer:(PajeContainer *)container
479
 
                   filter:(NSSet *)filter
 
486
- (id)filterHiddenContainer:(PajeContainer *)container
 
487
                     filter:(NSSet *)filter
480
488
{
481
 
    return [filter containsObject:[self nameForEntity:container]];
 
489
    if ([filter containsObject:[self nameForEntity:container]]) {
 
490
        return nil;
 
491
    } else {
 
492
        return container;
 
493
    }
482
494
}
483
495
 
484
496
- (NSEnumerator *)enumeratorOfContainersTyped:(PajeContainerType *)entityType
488
500
    NSMutableSet *filter;
489
501
 
490
502
    if ([self isHiddenEntityType:entityType]) {
491
 
        NSLog(@"enumerating hidden type %@", entityType);
 
503
        NSWarnLog(@"enumerating hidden type %@", entityType);
492
504
        return nil;
493
505
    }
494
506
 
497
509
 
498
510
    filter = [self filterForEntityType:entityType];
499
511
    if (filter != nil) {
500
 
        return [[[FilteredEnumerator alloc] initWithEnumerator:origEnum filter:self selector:@selector(isHiddenContainer:filter:) context:filter] autorelease];
 
512
        return [[[FilteredEnumerator alloc]
 
513
                    initWithEnumerator:origEnum
 
514
                                filter:self
 
515
                              selector:@selector(filterHiddenContainer:filter:)
 
516
                               context:filter] autorelease];
501
517
    } else {
502
518
        return origEnum;
503
519
    }