Changeset 10514


Ignore:
Timestamp:
Apr 23, 2010, 2:13:54 AM (8 years ago)
Author:
livings124
Message:

#3006 Allow Trackers to be copied in Create Window

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/CreatorWindowController.h

    r10513 r10514  
    6161- (void) addRemoveTracker: (id) sender;
    6262
     63- (void) copy: (id) sender;
    6364- (void) paste: (id) sender;
    6465
  • trunk/macosx/CreatorWindowController.m

    r10513 r10514  
    323323}
    324324
     325- (void) copy: (id) sender
     326{
     327    NSArray * addresses = [fTrackers objectsAtIndexes: [fTrackerTable selectedRowIndexes]];
     328    NSString * text = [addresses componentsJoinedByString: @"\n"];
     329   
     330    NSPasteboard * pb = [NSPasteboard generalPasteboard];
     331    if ([NSApp isOnSnowLeopardOrBetter])
     332    {
     333        [pb clearContents];
     334        [pb writeObjects: [NSArray arrayWithObject: text]];
     335    }
     336    else
     337    {
     338        [pb declareTypes: [NSArray arrayWithObject: NSStringPboardType] owner: nil];
     339        [pb setString: text forType: NSStringPboardType];
     340    }
     341}
     342
    325343- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
    326344{
    327345    const SEL action = [menuItem action];
     346   
     347    if (action == @selector(copy:))
     348        return [[self window] firstResponder] == fTrackerTable && [fTrackerTable numberOfSelectedRows] > 0;
    328349   
    329350    if (action == @selector(paste:))
Note: See TracChangeset for help on using the changeset viewer.