Revision: 15201
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15201&view=rev
Author: hofman
Date: 2009-04-26 20:28:34 +0000 (Sun, 26 Apr 2009)
Log Message:
-----------
Determine the highlighted state in the complex string formatter by examining
the default text color. It's highlighted when the default text color is white.
Modified Paths:
--------------
trunk/bibdesk/BDSKComplexStringFormatter.h
trunk/bibdesk/BDSKComplexStringFormatter.m
trunk/bibdesk/BDSKMacroWindowController.m
trunk/bibdesk/BDSKTextImportController.m
Modified: trunk/bibdesk/BDSKComplexStringFormatter.h
===================================================================
--- trunk/bibdesk/BDSKComplexStringFormatter.h 2009-04-26 20:04:47 UTC (rev
15200)
+++ trunk/bibdesk/BDSKComplexStringFormatter.h 2009-04-26 20:28:34 UTC (rev
15201)
@@ -42,7 +42,6 @@
id macroResolver;
BOOL editAsComplexString;
id delegate;
- BOOL highlighted;
}
- (id)initWithDelegate:(id)anObject macroResolver:(BDSKMacroResolver
*)aMacroResolver;
@@ -56,9 +55,6 @@
- (id)delegate;
- (void)setDelegate:(id)newDelegate;
-- (BOOL)isHighlighted;
-- (void)setHighlighted:(BOOL)flag;
-
@end
@interface NSObject (BDSKComplexStringFormatterDelegate)
Modified: trunk/bibdesk/BDSKComplexStringFormatter.m
===================================================================
--- trunk/bibdesk/BDSKComplexStringFormatter.m 2009-04-26 20:04:47 UTC (rev
15200)
+++ trunk/bibdesk/BDSKComplexStringFormatter.m 2009-04-26 20:28:34 UTC (rev
15201)
@@ -48,7 +48,6 @@
- (id)initWithDelegate:(id)anObject macroResolver:(BDSKMacroResolver
*)aMacroResolver {
if (self = [super init]) {
- highlighted = NO;
editAsComplexString = NO;
[self setMacroResolver:aMacroResolver];
[self setDelegate:anObject];
@@ -78,15 +77,15 @@
- (NSAttributedString *)attributedStringForObjectValue:(id)obj
withDefaultAttributes:(NSDictionary *)defaultAttrs{
- if(![obj isComplex] && ![obj isInherited])
+ if ([obj isComplex] == NO && [obj isInherited] == NO)
return nil;
NSMutableDictionary *attrs = [[NSMutableDictionary alloc]
initWithDictionary:defaultAttrs];
- NSColor *color;
- NSString *string = (NSString *)obj;
-
- if ([string isComplex]) {
- if ([string isInherited]) {
+ NSColor *color = nil;
+ BOOL highlighted = [[[attrs
objectForKey:NSForegroundColorAttributeName]
colorUsingColorSpaceName:NSDeviceRGBColorSpace] isEqual:[NSColor
colorWithDeviceRed:1 green:1 blue:1 alpha:1]];
+
+ if ([obj isComplex]) {
+ if ([obj isInherited]) {
if (highlighted)
color = [[NSColor blueColor]
blendedColorWithFraction:0.5 ofColor:[NSColor controlBackgroundColor]];
else
@@ -97,18 +96,15 @@
else
color = [NSColor blueColor];
}
- } else {
- if ([string isInherited]) {
- if (highlighted)
- color = [NSColor lightGrayColor];
- else
- color = [NSColor disabledControlTextColor];
- } else {
- color = [NSColor controlTextColor];
- }
+ } else if ([obj isInherited]) {
+ if (highlighted)
+ color = [NSColor lightGrayColor];
+ else
+ color = [NSColor disabledControlTextColor];
}
- [attrs setObject:color forKey:NSForegroundColorAttributeName];
- NSAttributedString *attStr = [[[NSAttributedString alloc]
initWithString:[self stringForObjectValue:obj] attributes:attrs] autorelease];
+ if (color)
+ [attrs setObject:color forKey:NSForegroundColorAttributeName];
+ NSAttributedString *attStr = [[[NSAttributedString alloc]
initWithString:obj attributes:attrs] autorelease];
[attrs release];
return attStr;
}
@@ -174,12 +170,4 @@
delegate = newDelegate;
}
-- (BOOL)isHighlighted{
- return highlighted;
-}
-
-- (void)setHighlighted:(BOOL)flag{
- highlighted = flag;
-}
-
@end
Modified: trunk/bibdesk/BDSKMacroWindowController.m
===================================================================
--- trunk/bibdesk/BDSKMacroWindowController.m 2009-04-26 20:04:47 UTC (rev
15200)
+++ trunk/bibdesk/BDSKMacroWindowController.m 2009-04-26 20:28:34 UTC (rev
15201)
@@ -579,12 +579,6 @@
#pragma mark NSTableView delegate methods
-- (void)tableView:(NSTableView *)tv willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row{
- if([[tableColumn identifier] isEqualToString:@"definition"]){
- [tableCellFormatter setHighlighted:[tv isRowSelected:row]];
- }
-}
-
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification{
[self updateButtons];
}
Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m 2009-04-26 20:04:47 UTC (rev
15200)
+++ trunk/bibdesk/BDSKTextImportController.m 2009-04-26 20:28:34 UTC (rev
15201)
@@ -1577,7 +1577,6 @@
formatter = citationFormatter;
} else {
formatter = tableCellFormatter;
- [(BDSKComplexStringFormatter *)formatter
setHighlighted:[tv isRowSelected:row]];
}
[cell setFormatter:formatter];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit