Permalink
Browse files

show tags and due date on title cell

  • Loading branch information...
1 parent 1c5e09a commit da94828dc30cb1a4a166b5c9b39eec13e1c880cb Greg Allen committed Feb 18, 2010
Showing with 115 additions and 71 deletions.
  1. +11 −9 English.lproj/MainMenu.xib
  2. +14 −2 MilkMaid.xcodeproj/project.pbxproj
  3. +12 −28 MilkMaidAppDelegate.m
  4. +35 −4 RTMHelper.m
  5. +2 −0 TransparentTableViewCell.h
  6. +41 −28 TransparentTableViewCell.m
View
@@ -1010,8 +1010,8 @@
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTableColumn" id="625209997">
- <double key="NSWidth">40</double>
- <double key="NSMinWidth">40</double>
+ <double key="NSWidth">20</double>
+ <double key="NSMinWidth">20</double>
<double key="NSMaxWidth">1000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
<int key="NSCellFlags">75628096</int>
@@ -1096,7 +1096,7 @@
<reference key="NSTableView" ref="1010431952"/>
</object>
<object class="NSTableColumn" id="385279558">
- <double key="NSWidth">166</double>
+ <double key="NSWidth">175</double>
<double key="NSMinWidth">10</double>
<double key="NSMaxWidth">3.4028234663852886e+38</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -1152,7 +1152,7 @@
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
- <double key="NSRowHeight">20</double>
+ <double key="NSRowHeight">25</double>
<int key="NSTvFlags">381681664</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
@@ -1201,7 +1201,7 @@
<reference key="NSVScroller" ref="646975129"/>
<reference key="NSHScroller" ref="1064800039"/>
<reference key="NSContentView" ref="281667900"/>
- <bytes key="NSScrollAmts">QSAAAEEgAABBsAAAQbAAAA</bytes>
+ <bytes key="NSScrollAmts">QSAAAEEgAABB2AAAQdgAAA</bytes>
</object>
<object class="NSCustomView" id="746587900">
<reference key="NSNextResponder" ref="625837263"/>
@@ -2564,7 +2564,7 @@
<reference key="parent" ref="1052006821"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">685</int>
+ <int key="objectID">689</int>
<reference key="object" ref="623777842"/>
<reference key="parent" ref="385279558"/>
</object>
@@ -2763,9 +2763,10 @@
<string>665.IBPluginDependency</string>
<string>676.IBPluginDependency</string>
<string>678.IBPluginDependency</string>
+ <string>680.IBPluginDependency</string>
<string>684.IBPluginDependency</string>
- <string>685.CustomClassName</string>
- <string>685.IBPluginDependency</string>
+ <string>689.CustomClassName</string>
+ <string>689.IBPluginDependency</string>
<string>73.IBPluginDependency</string>
<string>73.ImportedFromIB2</string>
<string>79.IBPluginDependency</string>
@@ -2979,6 +2980,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>TransparentTableViewCell</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3013,7 +3015,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">685</int>
+ <int key="maxID">689</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -33,6 +33,9 @@
C9A02F2C111BF11F00ACBFE1 /* NSDateHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = C9A02F2A111BF11F00ACBFE1 /* NSDateHelper.m */; };
C9AF1F771116999500BC2280 /* TransparentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C9AF1F751116999500BC2280 /* TransparentTableViewCell.m */; };
C9AF203E1116A44D00BC2280 /* rtm.icns in Resources */ = {isa = PBXBuildFile; fileRef = C9AF203D1116A44D00BC2280 /* rtm.icns */; };
+ C9F45ECC112B727E00F48377 /* priority1.png in Resources */ = {isa = PBXBuildFile; fileRef = C9F45ECB112B727D00F48377 /* priority1.png */; };
+ C9F45EDE112B74E100F48377 /* priority2.png in Resources */ = {isa = PBXBuildFile; fileRef = C9F45EDC112B74E100F48377 /* priority2.png */; };
+ C9F45EDF112B74E100F48377 /* priority3.png in Resources */ = {isa = PBXBuildFile; fileRef = C9F45EDD112B74E100F48377 /* priority3.png */; };
C9F70849111653CE00D3BB5B /* YRKSpinningProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = C9F70848111653CE00D3BB5B /* YRKSpinningProgressIndicator.m */; };
C9FBE61F1123D73300115FFF /* AddTask.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9FBE61E1123D73300115FFF /* AddTask.xib */; };
C9FBE6251123D98600115FFF /* AddTaskWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FBE6241123D98600115FFF /* AddTaskWindowController.m */; };
@@ -97,6 +100,9 @@
C9AF1F751116999500BC2280 /* TransparentTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TransparentTableViewCell.m; sourceTree = "<group>"; };
C9AF1F761116999500BC2280 /* TransparentTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransparentTableViewCell.h; sourceTree = "<group>"; };
C9AF203D1116A44D00BC2280 /* rtm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = rtm.icns; sourceTree = "<group>"; };
+ C9F45ECB112B727D00F48377 /* priority1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = priority1.png; sourceTree = "<group>"; };
+ C9F45EDC112B74E100F48377 /* priority2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = priority2.png; sourceTree = "<group>"; };
+ C9F45EDD112B74E100F48377 /* priority3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = priority3.png; sourceTree = "<group>"; };
C9F70847111653CE00D3BB5B /* YRKSpinningProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YRKSpinningProgressIndicator.h; sourceTree = "<group>"; };
C9F70848111653CE00D3BB5B /* YRKSpinningProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YRKSpinningProgressIndicator.m; sourceTree = "<group>"; };
C9FBE61E1123D73300115FFF /* AddTask.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AddTask.xib; sourceTree = "<group>"; };
@@ -196,6 +202,9 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
+ C9F45ECB112B727D00F48377 /* priority1.png */,
+ C9F45EDC112B74E100F48377 /* priority2.png */,
+ C9F45EDD112B74E100F48377 /* priority3.png */,
C927F87A1120FC1B00EA191B /* rtm2.icns */,
76F79642111DD45900FD7EFB /* dsa_pub.pem */,
C9AF203D1116A44D00BC2280 /* rtm.icns */,
@@ -293,6 +302,9 @@
C9FBE61F1123D73300115FFF /* AddTask.xib in Resources */,
7693DFF21125B27900DDF1A1 /* Search.xib in Resources */,
767A8743112AF51E00A77326 /* MultiAdd.xib in Resources */,
+ C9F45ECC112B727E00F48377 /* priority1.png in Resources */,
+ C9F45EDE112B74E100F48377 /* priority2.png in Resources */,
+ C9F45EDF112B74E100F48377 /* priority3.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -395,7 +407,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
- SDKROOT = macosx10.6;
+ SDKROOT = macosx10.5;
};
name = Debug;
};
@@ -407,7 +419,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
- SDKROOT = macosx10.6;
+ SDKROOT = macosx10.5;
};
name = Release;
};
View
@@ -188,27 +188,7 @@ -(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
return [tasks count];
}
-+ (NSColor *) colorFromHexRGB:(NSString *) inColorString
-{
- NSColor *result = nil;
- unsigned int colorCode = 0;
- unsigned char redByte, greenByte, blueByte;
-
- if (nil != inColorString)
- {
- NSScanner *scanner = [NSScanner scannerWithString:inColorString];
- (void) [scanner scanHexInt:&colorCode]; // ignore error
- }
- redByte = (unsigned char) (colorCode >> 16);
- greenByte = (unsigned char) (colorCode >> 8);
- blueByte = (unsigned char) (colorCode); // masks off high bits
- result = [NSColor
- colorWithCalibratedRed: (float)redByte / 0xff
- green: (float)greenByte/ 0xff
- blue: (float)blueByte / 0xff
- alpha:1.0];
- return result;
-}
+
-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
//check type of cell
@@ -232,17 +212,21 @@ -(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn
} else {//if ([cell isMemberOfClass:[BWTransparentTableViewCell class]]) {
NSDictionary *task = [tasks objectAtIndex:row];
-
- [cell setTextColor:[NSColor whiteColor]];
-
-
id due = [task objectForKey:@"due"];
- if ([due isKindOfClass:[NSDate class]] && ([due isPastDate] || [[NSDate date] isEqualToDate:due])) {
- [cell setBold:YES];
+ if ([due isKindOfClass:[NSDate class]]) {
+ [cell setAlternate2Text:[due relativeFormattedDateOnly]];
+ if ([due isPastDate] || [[NSDate date] isEqualToDate:due]) {
+ [cell setBold:YES];
+ } else {
+ [cell setBold:NO];
+ }
} else {
- [cell setBold:NO];
+ [cell setAlternate2Text:@""];
}
+
+ [cell setAlternateText:[task objectForKey:@"tags"]];
+
return [task objectForKey:@"name"];
}
View
@@ -104,12 +104,21 @@ -(NSMutableArray*)getFlatTaskList:(NSDictionary *)rtmResponse {
} else {
due = @"";
}
-
-
+ NSString *tags = @"";
+ id *tagNode = [taskSeries objectForKey:@"tags"];
+ if ([tagNode isKindOfClass:[NSDictionary class]]) {
+ id *tn = [tagNode objectForKey:@"tag"];
+
+ if ([tn isKindOfClass:[NSArray class]]) {
+ tags = [tn componentsJoinedByString:@","];
+ } else {
+ tags = tn;
+ }
+ }
NSDictionary *task = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[list objectForKey:@"id"], [taskSeries objectForKey:@"id"],
- [t objectForKey:@"id"], [taskSeries objectForKey:@"name"], [t objectForKey:@"priority"], due ,nil]
- forKeys:[NSArray arrayWithObjects:@"list_id", @"taskseries_id", @"task_id", @"name", @"priority", @"due", nil]];
+ [t objectForKey:@"id"], [taskSeries objectForKey:@"name"], [t objectForKey:@"priority"], due , tags, nil]
+ forKeys:[NSArray arrayWithObjects:@"list_id", @"taskseries_id", @"task_id", @"name", @"priority", @"due", @"tags", nil]];
[tasks addObject:task];
}
}
@@ -132,4 +141,26 @@ -(NSArray*)getArray:(id)obj {
}
}
++ (NSColor *) colorFromHexRGB:(NSString *) inColorString
+{
+ NSColor *result = nil;
+ unsigned int colorCode = 0;
+ unsigned char redByte, greenByte, blueByte;
+
+ if (nil != inColorString)
+ {
+ NSScanner *scanner = [NSScanner scannerWithString:inColorString];
+ (void) [scanner scanHexInt:&colorCode]; // ignore error
+ }
+ redByte = (unsigned char) (colorCode >> 16);
+ greenByte = (unsigned char) (colorCode >> 8);
+ blueByte = (unsigned char) (colorCode); // masks off high bits
+ result = [NSColor
+ colorWithCalibratedRed: (float)redByte / 0xff
+ green: (float)greenByte/ 0xff
+ blue: (float)blueByte / 0xff
+ alpha:1.0];
+ return result;
+}
+
@end
@@ -13,6 +13,8 @@
BOOL mIsEditingOrSelecting;
BOOL customTextColor;
BOOL shouldBold;
+ NSString *altText;
+ NSString *alt2Text;
}
View
@@ -7,40 +7,43 @@
//
#import "TransparentTableViewCell.h"
-
+#import "RTMHelper.h"
@implementation TransparentTableViewCell
-- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
-{
- if (![[self title] isEqualToString:@""])
- {
- NSColor *textColor;
- if (!self.isHighlighted)
- textColor = [NSColor colorWithCalibratedWhite:(198.0f / 255.0f) alpha:1];
- else
- textColor = [NSColor whiteColor];
-
- NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] init] autorelease];
- [attributes addEntriesFromDictionary:[[self attributedStringValue] attributesAtIndex:0 effectiveRange:NULL]];
- if (!customTextColor) {
- [attributes setObject:textColor forKey:NSForegroundColorAttributeName];
- }
- if (shouldBold) {
- [attributes setObject:[NSFont boldSystemFontOfSize:11] forKey:NSFontAttributeName];
- } else {
- [attributes setObject:[NSFont systemFontOfSize:11] forKey:NSFontAttributeName];
- }
-
-
- NSMutableAttributedString *string = [[[NSMutableAttributedString alloc] initWithString:[self title] attributes:attributes] autorelease];
- [self setAttributedStringValue:string];
+-(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
+
+ NSColor* primaryColor = [self isHighlighted] ? [NSColor whiteColor] : [NSColor colorWithCalibratedWhite:(225.0f / 255.0f) alpha:1];
+ NSString* primaryText = [self title];
+
+ int y = ([altText isEqualToString:@""] || [alt2Text isEqualToString:@""]) ? cellFrame.origin.y : cellFrame.origin.y+cellFrame.size.height/5;
+ NSMutableDictionary* primaryTextAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: primaryColor, NSForegroundColorAttributeName, nil];
+ if (shouldBold) {
+ [primaryTextAttributes setObject:[NSFont boldSystemFontOfSize:11] forKey:NSFontAttributeName];
+ } else {
+ [primaryTextAttributes setObject:[NSFont systemFontOfSize:11] forKey:NSFontAttributeName];
}
+ [primaryText drawAtPoint:NSMakePoint(cellFrame.origin.x, y) withAttributes:primaryTextAttributes];
+
- cellFrame.size.width -= 1;
- cellFrame.origin.x += 1;
- [super drawInteriorWithFrame:cellFrame inView:controlView];
+ //#0060BF
+ if (![altText isEqualToString:@""]) {
+ NSColor* secondaryColor = [self isHighlighted] ? [NSColor colorWithCalibratedWhite:(198.0f / 255.0f) alpha:1] : [NSColor disabledControlTextColor];
+ NSDictionary* secondaryTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys: secondaryColor, NSForegroundColorAttributeName,
+ [NSFont systemFontOfSize:9], NSFontAttributeName, nil];
+ [altText drawAtPoint:NSMakePoint(cellFrame.origin.x, cellFrame.origin.y+cellFrame.size.height/2)
+ withAttributes:secondaryTextAttributes];
+ }
+
+ if (![alt2Text isEqualToString:@""]) {
+ NSColor* secondaryColor = [self isHighlighted] ? [NSColor colorWithCalibratedWhite:(198.0f / 255.0f) alpha:1] : [NSColor disabledControlTextColor];
+ NSDictionary* secondaryTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys: secondaryColor, NSForegroundColorAttributeName,
+ [NSFont systemFontOfSize:9], NSFontAttributeName, nil];
+ NSSize size = [alt2Text sizeWithAttributes:secondaryTextAttributes];
+ [alt2Text drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - size.width, cellFrame.origin.y+cellFrame.size.height/2)
+ withAttributes:secondaryTextAttributes];
+ }
}
#pragma mark RSVerticallyCenteredTextFieldCell
@@ -99,4 +102,14 @@ - (void)setBold:(BOOL)bold {
shouldBold = bold;
}
+- (void)setAlternateText:(NSString*)text {
+ altText = text;
+ [altText retain];
+}
+
+- (void)setAlternate2Text:(NSString *)text {
+ alt2Text = text;
+ [alt2Text retain];
+}
+
@end

0 comments on commit da94828

Please sign in to comment.