decouple the group controller with the group window, and as a result only have the groups window loaded when it's opened
This commit is contained in:
parent
bfac9268c4
commit
c402442786
|
@ -183,6 +183,7 @@
|
|||
A2F41DBD0D0B96C0006CE378 /* InfoBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F41DBB0D0B96C0006CE378 /* InfoBlue.png */; };
|
||||
A2F41F8E0D73595100B82116 /* InfoTracker.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F41F8D0D73595100B82116 /* InfoTracker.png */; };
|
||||
A2FB057F0BFEB6800095564D /* DragOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2FB057D0BFEB6800095564D /* DragOverlayView.m */; };
|
||||
A2FB701C0D95CAEA0001F331 /* GroupsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2FB701B0D95CAEA0001F331 /* GroupsController.m */; };
|
||||
A2FE61D80CD3D0A500D683E1 /* InfoTabBackGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A2FE61D70CD3D0A500D683E1 /* InfoTabBackGraphite.png */; };
|
||||
BE1183570CE160C50002D0F3 /* bsdqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BE11834D0CE160C50002D0F3 /* bsdqueue.h */; };
|
||||
BE1183580CE160C50002D0F3 /* declspec.h in Headers */ = {isa = PBXBuildFile; fileRef = BE11834E0CE160C50002D0F3 /* declspec.h */; };
|
||||
|
@ -611,6 +612,8 @@
|
|||
A2FB057C0BFEB6800095564D /* DragOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DragOverlayView.h; path = macosx/DragOverlayView.h; sourceTree = "<group>"; };
|
||||
A2FB057D0BFEB6800095564D /* DragOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = DragOverlayView.m; path = macosx/DragOverlayView.m; sourceTree = "<group>"; };
|
||||
A2FB06950BFF484A0095564D /* Globe.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Globe.png; path = macosx/Images/Globe.png; sourceTree = "<group>"; };
|
||||
A2FB701A0D95CAEA0001F331 /* GroupsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GroupsController.h; path = macosx/GroupsController.h; sourceTree = "<group>"; };
|
||||
A2FB701B0D95CAEA0001F331 /* GroupsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GroupsController.m; path = macosx/GroupsController.m; sourceTree = "<group>"; };
|
||||
A2FE61D70CD3D0A500D683E1 /* InfoTabBackGraphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoTabBackGraphite.png; path = macosx/Images/InfoTabBackGraphite.png; sourceTree = "<group>"; };
|
||||
BE1183480CE160960002D0F3 /* libminiupnp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libminiupnp.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BE11834D0CE160C50002D0F3 /* bsdqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bsdqueue.h; path = "third-party/miniupnp/bsdqueue.h"; sourceTree = "<group>"; };
|
||||
|
@ -853,6 +856,8 @@
|
|||
A20BFFB60D091CC700CE5D2B /* ToolbarSegmentedCell.m */,
|
||||
A22180960D148A71007D09ED /* GroupsWindowController.h */,
|
||||
A22180970D148A71007D09ED /* GroupsWindowController.m */,
|
||||
A2FB701A0D95CAEA0001F331 /* GroupsController.h */,
|
||||
A2FB701B0D95CAEA0001F331 /* GroupsController.m */,
|
||||
);
|
||||
name = Sources;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1809,6 +1814,7 @@
|
|||
A22180980D148A71007D09ED /* GroupsWindowController.m in Sources */,
|
||||
A26AF21A0D2DA35A00FF7140 /* FileOutlineController.m in Sources */,
|
||||
A26AF2840D2DC27C00FF7140 /* AddWindowController.m in Sources */,
|
||||
A2FB701C0D95CAEA0001F331 /* GroupsController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -2119,7 +2125,7 @@
|
|||
GCC_WARN_UNUSED_FUNCTION = NO;
|
||||
GCC_WARN_UNUSED_PARAMETER = NO;
|
||||
GCC_WARN_UNUSED_VALUE = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IBC_FLATTEN_NIBS = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.4;
|
||||
OTHER_CFLAGS = "$(inherited)";
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#import "AddWindowController.h"
|
||||
#import "Controller.h"
|
||||
#import "GroupsWindowController.h"
|
||||
#import "GroupsController.h"
|
||||
#import "NSStringAdditions.h"
|
||||
#import "NSMenuAdditions.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
|
@ -291,7 +291,7 @@
|
|||
for (i = [menu numberOfItems]-1 - 2; i >= 0; i--)
|
||||
[menu removeItemAtIndex: i];
|
||||
|
||||
NSMenu * groupMenu = [[GroupsWindowController groups] groupMenuWithTarget: self action: @selector(changeGroupValue:) isSmall: NO];
|
||||
NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(changeGroupValue:) isSmall: NO];
|
||||
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(0, [groupMenu numberOfItems])] atBottom: NO];
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#import "CreatorWindowController.h"
|
||||
#import "StatsWindowController.h"
|
||||
#import "GroupsWindowController.h"
|
||||
#import "GroupsController.h"
|
||||
#import "AboutWindowController.h"
|
||||
#import "ButtonToolbarItem.h"
|
||||
#import "GroupToolbarItem.h"
|
||||
|
@ -2099,7 +2100,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
|
||||
- (void) showGroups: (id) sender
|
||||
{
|
||||
[[GroupsWindowController groups] showWindow: self];
|
||||
[[GroupsWindowController groupsWindow] showWindow: self];
|
||||
}
|
||||
|
||||
- (void) menuNeedsUpdate: (NSMenu *) menu
|
||||
|
@ -2110,7 +2111,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
for (i = [menu numberOfItems]-1 - 2; i >= 0; i--)
|
||||
[menu removeItemAtIndex: i];
|
||||
|
||||
NSMenu * groupMenu = [[GroupsWindowController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO];
|
||||
NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO];
|
||||
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(0, [groupMenu numberOfItems])] atBottom: NO];
|
||||
}
|
||||
|
@ -2120,7 +2121,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
for (i = [menu numberOfItems]-1; i >= 3; i--)
|
||||
[menu removeItemAtIndex: i];
|
||||
|
||||
NSMenu * groupMenu = [[GroupsWindowController groups] groupMenuWithTarget: self action: @selector(setGroupFilter:)
|
||||
NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(setGroupFilter:)
|
||||
isSmall: YES];
|
||||
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(0, [groupMenu numberOfItems])] atBottom: YES];
|
||||
|
@ -2208,9 +2209,9 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
toolTip = NSLocalizedString(@"Group: No Label", "Groups -> Button");
|
||||
break;
|
||||
default:
|
||||
icon = [[GroupsWindowController groups] imageForIndex: index isSmall: YES];
|
||||
icon = [[GroupsController groups] imageForIndex: index isSmall: YES];
|
||||
toolTip = [NSLocalizedString(@"Group: ", "Groups -> Button") stringByAppendingString:
|
||||
[[GroupsWindowController groups] nameForIndex: index]];
|
||||
[[GroupsController groups] nameForIndex: index]];
|
||||
}
|
||||
|
||||
[[fGroupFilterMenu itemAtIndex: 0] setImage: icon];
|
||||
|
@ -2488,13 +2489,13 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
if ([ident isEqualToString: @"Group"])
|
||||
{
|
||||
int group = [[item objectForKey: @"Group"] intValue];
|
||||
return group != -1 ? [[GroupsWindowController groups] nameForIndex: group]
|
||||
return group != -1 ? [[GroupsController groups] nameForIndex: group]
|
||||
: NSLocalizedString(@"No Group", "Group table row");
|
||||
}
|
||||
else if ([ident isEqualToString: @"Color"])
|
||||
{
|
||||
int group = [[item objectForKey: @"Group"] intValue];
|
||||
return group != -1 ? [[GroupsWindowController groups] imageForIndex: group isSmall: YES]
|
||||
return group != -1 ? [[GroupsController groups] imageForIndex: group isSmall: YES]
|
||||
: [NSImage imageNamed: NSImageNameStopProgressTemplate];
|
||||
}
|
||||
else if ([ident isEqualToString: @"DL Image"])
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2007-2008 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class CTGradient;
|
||||
|
||||
@interface GroupsController : NSObject
|
||||
{
|
||||
NSMutableArray * fGroups;
|
||||
}
|
||||
|
||||
+ (GroupsController *) groups;
|
||||
|
||||
- (int) numberOfGroups;
|
||||
|
||||
- (int) orderValueForIndex: (int) index;
|
||||
- (CTGradient *) gradientForIndex: (int) index;
|
||||
|
||||
- (NSString *) nameForIndex: (int) index;
|
||||
- (NSString *) nameForRowIndex: (int) row;
|
||||
- (void) setName: (NSString *) name forRowIndex: (int) index;
|
||||
|
||||
- (NSImage *) imageForIndex: (int) index isSmall: (BOOL) small;
|
||||
- (NSImage *) imageForRowIndex: (int) row isSmall: (BOOL) small;
|
||||
|
||||
- (NSColor *) colorForRowIndex: (int) row;
|
||||
- (NSColor *) setColor: (NSColor *) color forRowIndex: (int) row;
|
||||
|
||||
- (void) addGroupWithName: (NSString *) name color: (NSColor *) color;
|
||||
- (void) removeGroupWithRowIndexes: (NSIndexSet *) rowIndexes;
|
||||
|
||||
- (NSIndexSet *) moveGroupsAtIndexes: (NSIndexSet *) indexes toRow: (int) newRow oldSelected: (NSIndexSet *) selectedIndexes;
|
||||
|
||||
- (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action isSmall: (BOOL) small;
|
||||
|
||||
@end
|
|
@ -0,0 +1,315 @@
|
|||
/******************************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2007-2008 Transmission authors and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#import "GroupsController.h"
|
||||
#import "CTGradient.h"
|
||||
#import "NSBezierPathAdditions.h"
|
||||
|
||||
#define ICON_WIDTH 16.0
|
||||
#define ICON_WIDTH_SMALL 12.0
|
||||
|
||||
@interface GroupsController (Private)
|
||||
|
||||
- (void) saveGroups;
|
||||
|
||||
- (CTGradient *) gradientForColor: (NSColor *) color;
|
||||
- (NSImage *) imageForGroup: (NSDictionary *) dict isSmall: (BOOL) small;
|
||||
|
||||
@end
|
||||
|
||||
@implementation GroupsController
|
||||
|
||||
GroupsController * fGroupsInstance = nil;
|
||||
+ (GroupsController *) groups
|
||||
{
|
||||
if (!fGroupsInstance)
|
||||
fGroupsInstance = [[GroupsController alloc] init];
|
||||
return fGroupsInstance;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
NSData * data;
|
||||
if ((data = [[NSUserDefaults standardUserDefaults] dataForKey: @"Groups"]))
|
||||
fGroups = [[NSUnarchiver unarchiveObjectWithData: data] retain];
|
||||
else
|
||||
{
|
||||
//default groups
|
||||
NSMutableDictionary * red = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor redColor], @"Color",
|
||||
NSLocalizedString(@"Red", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 0], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * orange = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor orangeColor], @"Color",
|
||||
NSLocalizedString(@"Orange", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 1], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * yellow = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor yellowColor], @"Color",
|
||||
NSLocalizedString(@"Yellow", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 2], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * green = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor greenColor], @"Color",
|
||||
NSLocalizedString(@"Green", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 3], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * blue = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor blueColor], @"Color",
|
||||
NSLocalizedString(@"Blue", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 4], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * purple = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor purpleColor], @"Color",
|
||||
NSLocalizedString(@"Purple", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 5], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * gray = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor grayColor], @"Color",
|
||||
NSLocalizedString(@"Gray", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 6], @"Index", nil];
|
||||
|
||||
fGroups = [[NSMutableArray alloc] initWithObjects: red, orange, yellow, green, blue, purple, gray, nil];
|
||||
[self saveGroups]; //make sure this is saved right away
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[fGroups release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (int) numberOfGroups
|
||||
{
|
||||
return [fGroups count];
|
||||
}
|
||||
|
||||
- (int) orderValueForIndex: (int) index
|
||||
{
|
||||
if (index != -1)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < [fGroups count]; i++)
|
||||
if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] intValue])
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (CTGradient *) gradientForIndex: (int) index
|
||||
{
|
||||
int orderIndex = [self orderValueForIndex: index];
|
||||
return orderIndex != -1 ? [self gradientForColor: [[fGroups objectAtIndex: orderIndex] objectForKey: @"Color"]] : nil;
|
||||
}
|
||||
|
||||
- (NSString *) nameForIndex: (int) index
|
||||
{
|
||||
int orderIndex = [self orderValueForIndex: index];
|
||||
return orderIndex != -1 ? [self nameForRowIndex: [self orderValueForIndex: orderIndex]] : nil;
|
||||
}
|
||||
|
||||
- (NSString *) nameForRowIndex: (int) index
|
||||
{
|
||||
return [[fGroups objectAtIndex: index] objectForKey: @"Name"];
|
||||
}
|
||||
|
||||
- (void) setName: (NSString *) name forRowIndex: (int) row
|
||||
{
|
||||
[[fGroups objectAtIndex: row] setObject: name forKey: @"Name"];
|
||||
[self saveGroups];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
}
|
||||
|
||||
- (NSImage *) imageForIndex: (int) index isSmall: (BOOL) small
|
||||
{
|
||||
int orderIndex = [self orderValueForIndex: index];
|
||||
return orderIndex != -1 ? [self imageForRowIndex: orderIndex isSmall: small] : nil;
|
||||
}
|
||||
|
||||
- (NSImage *) imageForRowIndex: (int) row isSmall: (BOOL) small
|
||||
{
|
||||
return [self imageForGroup: [fGroups objectAtIndex: row] isSmall: small];
|
||||
}
|
||||
|
||||
- (NSColor *) colorForRowIndex: (int) row
|
||||
{
|
||||
return [[fGroups objectAtIndex: row] objectForKey: @"Color"];
|
||||
}
|
||||
|
||||
- (NSColor *) setColor: (NSColor *) color forRowIndex: (int) row
|
||||
{
|
||||
[[fGroups objectAtIndex: row] setObject: color forKey: @"Color"];
|
||||
|
||||
[[GroupsController groups] saveGroups];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
}
|
||||
|
||||
- (void) addGroupWithName: (NSString *) name color: (NSColor *) color
|
||||
{
|
||||
//find the lowest index
|
||||
int index;
|
||||
for (index = 0; index < [fGroups count]; index++)
|
||||
{
|
||||
BOOL found = NO;
|
||||
NSEnumerator * enumerator = [fGroups objectEnumerator];
|
||||
NSDictionary * dict;
|
||||
while ((dict = [enumerator nextObject]))
|
||||
if ([[dict objectForKey: @"Index"] intValue] == index)
|
||||
{
|
||||
found = YES;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
break;
|
||||
}
|
||||
|
||||
[fGroups addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: index], @"Index",
|
||||
[NSColor cyanColor], @"Color", @"", @"Name", nil]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
[self saveGroups];
|
||||
}
|
||||
|
||||
- (void) removeGroupWithRowIndexes: (NSIndexSet *) rowIndexes
|
||||
{
|
||||
NSMutableIndexSet * indexes = [NSMutableIndexSet indexSet];
|
||||
int index;
|
||||
for (index = [rowIndexes firstIndex]; index != NSNotFound; index = [rowIndexes indexGreaterThanIndex: index])
|
||||
[indexes addIndex: [[[fGroups objectAtIndex: index] objectForKey: @"Index"] intValue]];
|
||||
|
||||
[fGroups removeObjectsAtIndexes: rowIndexes];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"GroupValueRemoved" object: self userInfo:
|
||||
[NSDictionary dictionaryWithObject: indexes forKey: @"Indexes"]];
|
||||
|
||||
#warning move to controller?
|
||||
if ([indexes containsIndex: [[NSUserDefaults standardUserDefaults] integerForKey: @"FilterGroup"]])
|
||||
[[NSUserDefaults standardUserDefaults] setInteger: -2 forKey: @"FilterGroup"];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
[self saveGroups];
|
||||
}
|
||||
|
||||
- (NSIndexSet *) moveGroupsAtIndexes: (NSIndexSet *) indexes toRow: (int) newRow oldSelected: (NSIndexSet *) selectedIndexes
|
||||
{
|
||||
NSArray * selectedGroups = [fGroups objectsAtIndexes: selectedIndexes];
|
||||
|
||||
//determine where to move them
|
||||
int i, originalRow = newRow;
|
||||
for (i = [indexes firstIndex]; i < originalRow && i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||
newRow--;
|
||||
|
||||
//remove objects to reinsert
|
||||
NSArray * movingGroups = [[fGroups objectsAtIndexes: indexes] retain];
|
||||
[fGroups removeObjectsAtIndexes: indexes];
|
||||
|
||||
//insert objects at new location
|
||||
for (i = 0; i < [movingGroups count]; i++)
|
||||
[fGroups insertObject: [movingGroups objectAtIndex: i] atIndex: newRow + i];
|
||||
|
||||
[movingGroups release];
|
||||
|
||||
[self saveGroups];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
|
||||
NSMutableIndexSet * newSelectedIndexes = nil;
|
||||
if ([selectedGroups count] > 0)
|
||||
{
|
||||
newSelectedIndexes = [NSMutableIndexSet indexSet];
|
||||
NSEnumerator * enumerator = [selectedGroups objectEnumerator];
|
||||
NSDictionary * dict;
|
||||
while ((dict = [enumerator nextObject]))
|
||||
[newSelectedIndexes addIndex: [fGroups indexOfObject: dict]];
|
||||
}
|
||||
|
||||
return newSelectedIndexes;
|
||||
}
|
||||
|
||||
- (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action isSmall: (BOOL) small
|
||||
{
|
||||
NSMenu * menu = [[NSMenu alloc] initWithTitle: @"Groups"];
|
||||
|
||||
NSMenuItem * item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"None", "Groups -> Menu") action: action
|
||||
keyEquivalent: @""];
|
||||
[item setTarget: target];
|
||||
[item setTag: -1];
|
||||
[menu addItem: item];
|
||||
[item release];
|
||||
|
||||
NSEnumerator * enumerator = [fGroups objectEnumerator];
|
||||
NSDictionary * dict;
|
||||
while ((dict = [enumerator nextObject]))
|
||||
{
|
||||
item = [[NSMenuItem alloc] initWithTitle: [dict objectForKey: @"Name"] action: action keyEquivalent: @""];
|
||||
[item setTarget: target];
|
||||
|
||||
[item setImage: [self imageForGroup: dict isSmall: small]];
|
||||
[item setTag: [[dict objectForKey: @"Index"] intValue]];
|
||||
|
||||
[menu addItem: item];
|
||||
[item release];
|
||||
}
|
||||
|
||||
return [menu autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GroupsController (Private)
|
||||
|
||||
- (void) saveGroups
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject: [NSArchiver archivedDataWithRootObject: fGroups] forKey: @"Groups"];
|
||||
}
|
||||
|
||||
- (CTGradient *) gradientForColor: (NSColor *) color
|
||||
{
|
||||
return [CTGradient gradientWithBeginningColor: [color blendedColorWithFraction: 0.65 ofColor: [NSColor whiteColor]]
|
||||
endingColor: [color blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]];
|
||||
}
|
||||
|
||||
- (NSImage *) imageForGroup: (NSDictionary *) dict isSmall: (BOOL) small
|
||||
{
|
||||
float width = small ? ICON_WIDTH_SMALL : ICON_WIDTH;
|
||||
NSRect rect = NSMakeRect(0.0, 0.0, width, width);
|
||||
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: rect radius: 4.0];
|
||||
NSImage * icon = [[NSImage alloc] initWithSize: rect.size];
|
||||
|
||||
[icon lockFocus];
|
||||
[[self gradientForColor: [dict objectForKey: @"Color"]] fillBezierPath: bp angle: 270.0];
|
||||
[icon unlockFocus];
|
||||
|
||||
return [icon autorelease];
|
||||
}
|
||||
|
||||
@end
|
File diff suppressed because it is too large
Load Diff
|
@ -28,23 +28,14 @@
|
|||
|
||||
@interface GroupsWindowController : NSWindowController
|
||||
{
|
||||
NSMutableArray * fGroups;
|
||||
|
||||
IBOutlet NSTableView * fTableView;
|
||||
IBOutlet NSSegmentedControl * fAddRemoveControl;
|
||||
|
||||
NSMutableDictionary * fCurrentColorDict;
|
||||
int fCurrentColorRow;
|
||||
}
|
||||
|
||||
+ (GroupsWindowController *) groups;
|
||||
|
||||
- (int) orderValueForIndex: (int) index;
|
||||
- (CTGradient *) gradientForIndex: (int) index;
|
||||
- (NSString *) nameForIndex: (int) index;
|
||||
- (NSImage *) imageForIndex: (int) index isSmall: (BOOL) small;
|
||||
+ (GroupsWindowController *) groupsWindow;
|
||||
|
||||
- (void) addRemoveGroup: (id) sender;
|
||||
|
||||
- (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action isSmall: (BOOL) small;
|
||||
|
||||
@end
|
||||
|
|
|
@ -23,13 +23,9 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#import "GroupsWindowController.h"
|
||||
#import "CTGradient.h"
|
||||
#import "NSBezierPathAdditions.h"
|
||||
#import "GroupsController.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
|
||||
#define ICON_WIDTH 16.0
|
||||
#define ICON_WIDTH_SMALL 12.0
|
||||
|
||||
#define GROUP_TABLE_VIEW_DATA_TYPE @"GroupTableViewDataType"
|
||||
|
||||
typedef enum
|
||||
|
@ -40,77 +36,20 @@ typedef enum
|
|||
|
||||
@interface GroupsWindowController (Private)
|
||||
|
||||
- (void) saveGroups;
|
||||
|
||||
- (CTGradient *) gradientForColor: (NSColor *) color;
|
||||
- (void) changeColor: (id) sender;
|
||||
- (NSImage *) imageForGroup: (NSDictionary *) dict isSmall: (BOOL) small;
|
||||
|
||||
@end
|
||||
|
||||
@implementation GroupsWindowController
|
||||
|
||||
GroupsWindowController * fGroupsWindowInstance = nil;
|
||||
+ (GroupsWindowController *) groups
|
||||
+ (GroupsWindowController *) groupsWindow
|
||||
{
|
||||
if (!fGroupsWindowInstance)
|
||||
fGroupsWindowInstance = [[GroupsWindowController alloc] init];
|
||||
fGroupsWindowInstance = [[GroupsWindowController alloc] initWithWindowNibName: @"GroupsWindow"];
|
||||
return fGroupsWindowInstance;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super initWithWindowNibName: @"GroupsWindow"]))
|
||||
{
|
||||
NSData * data;
|
||||
if ((data = [[NSUserDefaults standardUserDefaults] dataForKey: @"Groups"]))
|
||||
fGroups = [[NSUnarchiver unarchiveObjectWithData: data] retain];
|
||||
else
|
||||
{
|
||||
//default groups
|
||||
NSMutableDictionary * red = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor redColor], @"Color",
|
||||
NSLocalizedString(@"Red", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 0], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * orange = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor orangeColor], @"Color",
|
||||
NSLocalizedString(@"Orange", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 1], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * yellow = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor yellowColor], @"Color",
|
||||
NSLocalizedString(@"Yellow", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 2], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * green = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor greenColor], @"Color",
|
||||
NSLocalizedString(@"Green", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 3], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * blue = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor blueColor], @"Color",
|
||||
NSLocalizedString(@"Blue", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 4], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * purple = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor purpleColor], @"Color",
|
||||
NSLocalizedString(@"Purple", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 5], @"Index", nil];
|
||||
|
||||
NSMutableDictionary * gray = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSColor grayColor], @"Color",
|
||||
NSLocalizedString(@"Gray", "Groups -> Name"), @"Name",
|
||||
[NSNumber numberWithInt: 6], @"Index", nil];
|
||||
|
||||
fGroups = [[NSMutableArray alloc] initWithObjects: red, orange, yellow, green, blue, purple, gray, nil];
|
||||
[self saveGroups]; //make sure this is saved right away
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
[[[fTableView tableColumnWithIdentifier: @"Button"] dataCell] setTitle: NSLocalizedString(@"Color", "Groups -> Color Button")];
|
||||
|
@ -128,54 +67,24 @@ GroupsWindowController * fGroupsWindowInstance = nil;
|
|||
[fAddRemoveControl setEnabled: NO forSegment: REMOVE_TAG];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
- (void) windowWillClose: (id)sender
|
||||
{
|
||||
[fGroups release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (int) orderValueForIndex: (int) index
|
||||
{
|
||||
if (index != -1)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < [fGroups count]; i++)
|
||||
if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] intValue])
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (CTGradient *) gradientForIndex: (int) index
|
||||
{
|
||||
int orderIndex = [self orderValueForIndex: index];
|
||||
return orderIndex != -1 ? [self gradientForColor: [[fGroups objectAtIndex: orderIndex] objectForKey: @"Color"]] : nil;
|
||||
}
|
||||
|
||||
- (NSString *) nameForIndex: (int) index
|
||||
{
|
||||
int orderIndex = [self orderValueForIndex: index];
|
||||
return orderIndex != -1 ? [[fGroups objectAtIndex: orderIndex] objectForKey: @"Name"] : nil;
|
||||
}
|
||||
|
||||
- (NSImage *) imageForIndex: (int) index isSmall: (BOOL) small
|
||||
{
|
||||
int orderIndex = [self orderValueForIndex: index];
|
||||
return orderIndex != -1 ? [self imageForGroup: [fGroups objectAtIndex: orderIndex] isSmall: small] : nil;
|
||||
[fGroupsWindowInstance release];
|
||||
fGroupsWindowInstance = nil;
|
||||
}
|
||||
|
||||
- (NSInteger) numberOfRowsInTableView: (NSTableView *) tableview
|
||||
{
|
||||
return [fGroups count];
|
||||
return [[GroupsController groups] numberOfGroups];
|
||||
}
|
||||
|
||||
- (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) tableColumn row: (NSInteger) row
|
||||
{
|
||||
NSString * identifier = [tableColumn identifier];
|
||||
if ([identifier isEqualToString: @"Color"])
|
||||
return [self imageForGroup: [fGroups objectAtIndex: row] isSmall: NO];
|
||||
return [[GroupsController groups] imageForRowIndex: row isSmall: NO];
|
||||
else
|
||||
return [[fGroups objectAtIndex: row] objectForKey: @"Name"];
|
||||
return [[GroupsController groups] nameForRowIndex: row];
|
||||
}
|
||||
|
||||
- (void) tableView: (NSTableView *) tableView setObjectValue: (id) object forTableColumn: (NSTableColumn *) tableColumn
|
||||
|
@ -183,19 +92,14 @@ GroupsWindowController * fGroupsWindowInstance = nil;
|
|||
{
|
||||
NSString * identifier = [tableColumn identifier];
|
||||
if ([identifier isEqualToString: @"Name"])
|
||||
{
|
||||
[[fGroups objectAtIndex: row] setObject: object forKey: @"Name"];
|
||||
[self saveGroups];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
}
|
||||
[[GroupsController groups] setName: object forRowIndex: row];
|
||||
else if ([identifier isEqualToString: @"Button"])
|
||||
{
|
||||
fCurrentColorDict = [fGroups objectAtIndex: row];
|
||||
fCurrentColorRow = row;
|
||||
|
||||
NSColorPanel * colorPanel = [NSColorPanel sharedColorPanel];
|
||||
[colorPanel setContinuous: YES];
|
||||
[colorPanel setColor: [[fGroups objectAtIndex: row] objectForKey: @"Color"]];
|
||||
[colorPanel setColor: [[GroupsController groups] colorForRowIndex: row]];
|
||||
|
||||
[colorPanel setTarget: self];
|
||||
[colorPanel setAction: @selector(changeColor:)];
|
||||
|
@ -230,83 +134,32 @@ GroupsWindowController * fGroupsWindowInstance = nil;
|
|||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
- (BOOL) tableView: (NSTableView *) t acceptDrop: (id <NSDraggingInfo>) info
|
||||
row: (int) newRow dropOperation: (NSTableViewDropOperation) operation
|
||||
- (BOOL) tableView: (NSTableView *) t acceptDrop: (id <NSDraggingInfo>) info row: (int) newRow
|
||||
dropOperation: (NSTableViewDropOperation) operation
|
||||
{
|
||||
NSPasteboard * pasteboard = [info draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject: GROUP_TABLE_VIEW_DATA_TYPE])
|
||||
{
|
||||
NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [pasteboard dataForType: GROUP_TABLE_VIEW_DATA_TYPE]];
|
||||
NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [pasteboard dataForType: GROUP_TABLE_VIEW_DATA_TYPE]],
|
||||
* selectedIndexes = [[GroupsController groups] moveGroupsAtIndexes: indexes toRow: newRow
|
||||
oldSelected: [fTableView selectedRowIndexes]];
|
||||
|
||||
NSArray * selectedGroups = [fGroups objectsAtIndexes: [fTableView selectedRowIndexes]];
|
||||
|
||||
//determine where to move them
|
||||
int i, originalRow = newRow;
|
||||
for (i = [indexes firstIndex]; i < originalRow && i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||
newRow--;
|
||||
|
||||
//remove objects to reinsert
|
||||
NSArray * movingGroups = [[fGroups objectsAtIndexes: indexes] retain];
|
||||
[fGroups removeObjectsAtIndexes: indexes];
|
||||
|
||||
//insert objects at new location
|
||||
for (i = 0; i < [movingGroups count]; i++)
|
||||
[fGroups insertObject: [movingGroups objectAtIndex: i] atIndex: newRow + i];
|
||||
|
||||
[movingGroups release];
|
||||
|
||||
[self saveGroups];
|
||||
|
||||
if ([selectedGroups count] > 0)
|
||||
{
|
||||
NSMutableIndexSet * indexSet = [NSMutableIndexSet indexSet];
|
||||
NSEnumerator * enumerator = [selectedGroups objectEnumerator];
|
||||
NSDictionary * dict;
|
||||
while ((dict = [enumerator nextObject]))
|
||||
[indexSet addIndex: [fGroups indexOfObject: dict]];
|
||||
|
||||
[fTableView selectRowIndexes: indexSet byExtendingSelection: NO];
|
||||
}
|
||||
[fTableView selectRowIndexes: selectedIndexes byExtendingSelection: NO];
|
||||
|
||||
[fTableView reloadData];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#warning make the color picker a nicer experience
|
||||
- (void) addRemoveGroup: (id) sender
|
||||
{
|
||||
NSEnumerator * enumerator;
|
||||
NSDictionary * dict;
|
||||
int index;
|
||||
BOOL found;
|
||||
NSIndexSet * rowIndexes;
|
||||
NSMutableIndexSet * indexes;
|
||||
|
||||
switch ([[sender cell] tagForSegment: [sender selectedSegment]])
|
||||
{
|
||||
case ADD_TAG:
|
||||
[[GroupsController groups] addGroupWithName: @"" color: [NSColor cyanColor]];
|
||||
|
||||
//find the lowest index
|
||||
for (index = 0; index < [fGroups count]; index++)
|
||||
{
|
||||
found = NO;
|
||||
enumerator = [fGroups objectEnumerator];
|
||||
while ((dict = [enumerator nextObject]))
|
||||
if ([[dict objectForKey: @"Index"] intValue] == index)
|
||||
{
|
||||
found = YES;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
break;
|
||||
}
|
||||
|
||||
[fGroups addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: index], @"Index",
|
||||
[NSColor cyanColor], @"Color", @"", @"Name", nil]];
|
||||
[fTableView reloadData];
|
||||
[fTableView deselectAll: self];
|
||||
|
||||
|
@ -315,96 +168,29 @@ GroupsWindowController * fGroupsWindowInstance = nil;
|
|||
break;
|
||||
|
||||
case REMOVE_TAG:
|
||||
//safety: when removing a row, just close the color picker
|
||||
[[NSColorPanel sharedColorPanel] close];
|
||||
|
||||
rowIndexes = [fTableView selectedRowIndexes];
|
||||
indexes = [NSMutableIndexSet indexSet];
|
||||
for (index = [rowIndexes firstIndex]; index != NSNotFound; index = [rowIndexes indexGreaterThanIndex: index])
|
||||
[indexes addIndex: [[[fGroups objectAtIndex: index] objectForKey: @"Index"] intValue]];
|
||||
[[GroupsController groups] removeGroupWithRowIndexes: [fTableView selectedRowIndexes]];
|
||||
|
||||
[fGroups removeObjectsAtIndexes: rowIndexes];
|
||||
[fTableView deselectAll: self];
|
||||
[fTableView reloadData];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"GroupValueRemoved" object: self userInfo:
|
||||
[NSDictionary dictionaryWithObject: indexes forKey: @"Indexes"]];
|
||||
|
||||
if ([indexes containsIndex: [[NSUserDefaults standardUserDefaults] integerForKey: @"FilterGroup"]])
|
||||
[[NSUserDefaults standardUserDefaults] setInteger: -2 forKey: @"FilterGroup"];
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
[self saveGroups];
|
||||
}
|
||||
|
||||
- (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action isSmall: (BOOL) small
|
||||
{
|
||||
NSMenu * menu = [[NSMenu alloc] initWithTitle: @"Groups"];
|
||||
|
||||
NSMenuItem * item = [[NSMenuItem alloc] initWithTitle: NSLocalizedString(@"None", "Groups -> Menu") action: action
|
||||
keyEquivalent: @""];
|
||||
[item setTarget: target];
|
||||
[item setTag: -1];
|
||||
[menu addItem: item];
|
||||
[item release];
|
||||
|
||||
NSEnumerator * enumerator = [fGroups objectEnumerator];
|
||||
NSDictionary * dict;
|
||||
while ((dict = [enumerator nextObject]))
|
||||
{
|
||||
item = [[NSMenuItem alloc] initWithTitle: [dict objectForKey: @"Name"] action: action keyEquivalent: @""];
|
||||
[item setTarget: target];
|
||||
|
||||
[item setImage: [self imageForGroup: dict isSmall: small]];
|
||||
[item setTag: [[dict objectForKey: @"Index"] intValue]];
|
||||
|
||||
[menu addItem: item];
|
||||
[item release];
|
||||
}
|
||||
|
||||
return [menu autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GroupsWindowController (Private)
|
||||
|
||||
- (void) saveGroups
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject: [NSArchiver archivedDataWithRootObject: fGroups] forKey: @"Groups"];
|
||||
}
|
||||
|
||||
- (CTGradient *) gradientForColor: (NSColor *) color
|
||||
{
|
||||
return [CTGradient gradientWithBeginningColor: [color blendedColorWithFraction: 0.65 ofColor: [NSColor whiteColor]]
|
||||
endingColor: [color blendedColorWithFraction: 0.2 ofColor: [NSColor whiteColor]]];
|
||||
}
|
||||
|
||||
- (void) changeColor: (id) sender
|
||||
{
|
||||
[fCurrentColorDict setObject: [sender color] forKey: @"Color"];
|
||||
[[GroupsController groups] setColor: [sender color] forRowIndex: fCurrentColorRow];
|
||||
[fTableView reloadData];
|
||||
|
||||
[self saveGroups];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||
}
|
||||
|
||||
- (NSImage *) imageForGroup: (NSDictionary *) dict isSmall: (BOOL) small
|
||||
{
|
||||
float width = small ? ICON_WIDTH_SMALL : ICON_WIDTH;
|
||||
NSRect rect = NSMakeRect(0.0, 0.0, width, width);
|
||||
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: rect radius: 4.0];
|
||||
NSImage * icon = [[NSImage alloc] initWithSize: rect.size];
|
||||
|
||||
[icon lockFocus];
|
||||
[[self gradientForColor: [dict objectForKey: @"Color"]] fillBezierPath: bp angle: 270.0];
|
||||
[icon unlockFocus];
|
||||
|
||||
return [icon autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#import "Torrent.h"
|
||||
#import "GroupsWindowController.h"
|
||||
#import "GroupsController.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
#import "NSStringAdditions.h"
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
|
||||
- (int) groupOrderValue
|
||||
{
|
||||
return [[GroupsWindowController groups] orderValueForIndex: fGroupValue];
|
||||
return [[GroupsController groups] orderValueForIndex: fGroupValue];
|
||||
}
|
||||
|
||||
- (void) checkGroupValueForRemoval: (NSNotification *) notification
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#import "TorrentCell.h"
|
||||
#import "TorrentTableView.h"
|
||||
#import "GroupsWindowController.h"
|
||||
#import "GroupsController.h"
|
||||
#import "NSApplicationAdditions.h"
|
||||
#import "NSStringAdditions.h"
|
||||
#import "NSBezierPathAdditions.h"
|
||||
|
@ -472,7 +472,7 @@
|
|||
groupRect.origin.y--;
|
||||
}
|
||||
|
||||
[[[GroupsWindowController groups] gradientForIndex: groupValue] fillBezierPath:
|
||||
[[[GroupsController groups] gradientForIndex: groupValue] fillBezierPath:
|
||||
[NSBezierPath bezierPathWithRoundedRect: groupRect radius: 6.0] angle: 90.0];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue