Ignore:
Timestamp:
Jan 2, 2009, 3:35:59 AM (12 years ago)
Author:
livings124
Message:

make the toolbar images templates; auto-generate the blue highlight for selected toolbar buttons (thanks to Leopard)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r7522 r7570  
    31053105    [button release];
    31063106   
    3107     NSSize buttonSize = NSMakeSize(36.0, 25.0);
     3107    const NSSize buttonSize = NSMakeSize(36.0, 25.0);
    31083108    [item setMinSize: buttonSize];
    31093109    [item setMaxSize: buttonSize];
     
    31213121        [item setPaletteLabel: NSLocalizedString(@"Create Torrent File", "Create toolbar item -> palette label")];
    31223122        [item setToolTip: NSLocalizedString(@"Create torrent file", "Create toolbar item -> tooltip")];
    3123         [item setImage: [NSImage imageNamed: @"Create.png"]];
     3123        [item setImage: [NSImage imageNamed: @"ToolbarCreateTemplate.png"]];
    31243124        [item setTarget: self];
    31253125        [item setAction: @selector(createFile:)];
     
    31353135        [item setPaletteLabel: NSLocalizedString(@"Open Torrent Files", "Open toolbar item -> palette label")];
    31363136        [item setToolTip: NSLocalizedString(@"Open torrent files", "Open toolbar item -> tooltip")];
    3137         [item setImage: [NSImage imageNamed: @"Open.png"]];
     3137        [item setImage: [NSImage imageNamed: @"ToolbarOpenTemplate.png"]];
    31383138        [item setTarget: self];
    31393139        [item setAction: @selector(openShowSheet:)];
     
    31493149        [item setPaletteLabel: NSLocalizedString(@"Open Torrent Address", "Open address toolbar item -> palette label")];
    31503150        [item setToolTip: NSLocalizedString(@"Open torrent web address", "Open address toolbar item -> tooltip")];
    3151         [item setImage: [NSImage imageNamed: @"OpenWeb.png"]];
     3151        [item setImage: [NSImage imageNamed: @"ToolbarOpenWebTemplate.png"]];
    31523152        [item setTarget: self];
    31533153        [item setAction: @selector(openURLShowSheet:)];
     
    31633163        [item setPaletteLabel: NSLocalizedString(@"Remove Selected", "Remove toolbar item -> palette label")];
    31643164        [item setToolTip: NSLocalizedString(@"Remove selected transfers", "Remove toolbar item -> tooltip")];
    3165         [item setImage: [NSImage imageNamed: @"Remove.png"]];
     3165        [item setImage: [NSImage imageNamed: @"ToolbarRemoveTemplate.png"]];
    31663166        [item setTarget: self];
    31673167        [item setAction: @selector(removeNoDelete:)];
     
    31723172    {
    31733173        ButtonToolbarItem * item = [self standardToolbarButtonWithIdentifier: ident];
     3174        [[(NSButton *)[item view] cell] setShowsStateBy: NSContentsCellMask]; //blue when enabled
    31743175       
    31753176        [item setLabel: NSLocalizedString(@"Inspector", "Inspector toolbar item -> label")];
    31763177        [item setPaletteLabel: NSLocalizedString(@"Toggle Inspector", "Inspector toolbar item -> palette label")];
    31773178        [item setToolTip: NSLocalizedString(@"Toggle the torrent inspector", "Inspector toolbar item -> tooltip")];
    3178         [item setImage: [NSImage imageNamed: @"Info.png"]];
     3179        [item setImage: [NSImage imageNamed: @"ToolbarInfoTemplate.png"]];
    31793180        [item setTarget: self];
    31803181        [item setAction: @selector(showInfo:)];
     
    31943195        [segmentedCell setTrackingMode: NSSegmentSwitchTrackingMomentary];
    31953196       
    3196         NSSize groupSize = NSMakeSize(72.0, 25.0);
     3197        const NSSize groupSize = NSMakeSize(72.0, 25.0);
    31973198        [groupItem setMinSize: groupSize];
    31983199        [groupItem setMaxSize: groupSize];
     
    32063207       
    32073208        [segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
    3208         [segmentedControl setImage: [NSImage imageNamed: @"PauseAll.png"] forSegment: TOOLBAR_PAUSE_TAG];
     3209        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseAllTemplate.png"] forSegment: TOOLBAR_PAUSE_TAG];
    32093210        [segmentedCell setToolTip: NSLocalizedString(@"Pause all transfers",
    32103211                                    "All toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    32113212       
    32123213        [segmentedCell setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    3213         [segmentedControl setImage: [NSImage imageNamed: @"ResumeAll.png"] forSegment: TOOLBAR_RESUME_TAG];
     3214        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarResumeAllTemplate.png"] forSegment: TOOLBAR_RESUME_TAG];
    32143215        [segmentedCell setToolTip: NSLocalizedString(@"Resume all transfers",
    32153216                                    "All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
     
    32333234        [segmentedCell setTrackingMode: NSSegmentSwitchTrackingMomentary];
    32343235       
    3235         NSSize groupSize = NSMakeSize(72.0, 25.0);
     3236        const NSSize groupSize = NSMakeSize(72.0, 25.0);
    32363237        [groupItem setMinSize: groupSize];
    32373238        [groupItem setMaxSize: groupSize];
     
    32453246       
    32463247        [segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
    3247         [segmentedControl setImage: [NSImage imageNamed: @"PauseSelected.png"] forSegment: TOOLBAR_PAUSE_TAG];
     3248        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseSelectedTemplate.png"] forSegment: TOOLBAR_PAUSE_TAG];
    32483249        [segmentedCell setToolTip: NSLocalizedString(@"Pause selected transfers",
    32493250                                    "Selected toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    32503251       
    32513252        [segmentedCell setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    3252         [segmentedControl setImage: [NSImage imageNamed: @"ResumeSelected.png"] forSegment: TOOLBAR_RESUME_TAG];
     3253        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarResumeSelectedTemplate.png"] forSegment: TOOLBAR_RESUME_TAG];
    32533254        [segmentedCell setToolTip: NSLocalizedString(@"Resume selected transfers",
    32543255                                    "Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
     
    32633264    {
    32643265        ButtonToolbarItem * item = [self standardToolbarButtonWithIdentifier: ident];
     3266        [[(NSButton *)[item view] cell] setShowsStateBy: NSContentsCellMask]; //blue when enabled
    32653267       
    32663268        [item setLabel: NSLocalizedString(@"Filter", "Filter toolbar item -> label")];
    32673269        [item setPaletteLabel: NSLocalizedString(@"Toggle Filter", "Filter toolbar item -> palette label")];
    32683270        [item setToolTip: NSLocalizedString(@"Toggle the filter bar", "Filter toolbar item -> tooltip")];
    3269         [item setImage: [NSImage imageNamed: @"Filter.png"]];
     3271        [item setImage: [NSImage imageNamed: @"ToolbarFilterTemplate.png"]];
    32703272        [item setTarget: self];
    32713273        [item setAction: @selector(toggleFilterBar:)];
     
    33873389    if ([ident isEqualToString: TOOLBAR_INFO])
    33883390    {
    3389         [toolbarItem setImage: [[fInfoController window] isVisible] ? [NSImage imageNamed: @"InfoBlue.png"]
    3390                                                                     : [NSImage imageNamed: @"Info.png"]];
     3391        [(NSButton *)[toolbarItem view] setState: [[fInfoController window] isVisible]];
    33913392        return YES;
    33923393    }
     
    33953396    if ([ident isEqualToString: TOOLBAR_FILTER])
    33963397    {
    3397         [toolbarItem setImage: ![fFilterBar isHidden] ? [NSImage imageNamed: @"FilterBlue.png"] : [NSImage imageNamed: @"Filter.png"]];
     3398        [(NSButton *)[toolbarItem view] setState: ![fFilterBar isHidden]];
    33983399        return YES;
    33993400    }
Note: See TracChangeset for help on using the changeset viewer.