KeypairView now seems to work properly.

This commit is contained in:
Bill Currie 2010-09-23 22:09:58 +09:00
parent c0236955f2
commit 6509a24a54

View file

@ -19,6 +19,11 @@ initWithFrame:
return self; return self;
} }
-(BOOL) isFlipped
{
return YES;
}
-calcViewSize -calcViewSize
{ {
@ -27,41 +32,38 @@ initWithFrame:
int count; int count;
id ent; id ent;
ent =[map_i currentEntity]; ent = [map_i currentEntity];
count =[ent numPairs]; count = [ent numPairs];
//XXX[[self superview] setFlipped: YES]; b = [[self superview] bounds];
b =[[self superview] bounds];
b.size.height = LINEHEIGHT * count + SPACING; b.size.height = LINEHEIGHT * count + SPACING;
[self setBounds:b]; [self setFrameSize:b.size];
pt.x = pt.y = 0; pt.x = pt.y = 0;
[self scrollPoint:pt]; [self scrollPoint:pt];
return self; return self;
} }
-drawSelf: (const NSRect *) rects:(int) rectCount -drawRect: (NSRect) rects
{ {
epair_t *pair; epair_t *pair;
int y; int y;
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
PSsetgray(NSLightGray); [[NSColor lightGrayColor] set];
PSrectfill (0, 0, _bounds.size.width, _bounds.size.height); NSRectFill (NSMakeRect (0, 0, _bounds.size.width, _bounds.size.height));
[[NSFont systemFontOfSize: FONTSIZE] set]; [[NSFont systemFontOfSize: FONTSIZE] set];
PSrotate (0); [[NSColor blackColor] set];
PSsetgray (0);
pair =[[map_i currentEntity] epairs]; pair =[[map_i currentEntity] epairs];
y = _bounds.size.height - LINEHEIGHT; y = _bounds.size.height - LINEHEIGHT;
for (; pair; pair = pair->next) { for (; pair; pair = pair->next) {
PSmoveto (SPACING, y); NSString *key = [NSString stringWithCString: pair->key];
PSshow (pair->key); NSString *value = [NSString stringWithCString: pair->value];
PSmoveto (100, y); [key drawAtPoint: NSMakePoint (SPACING, y) withAttributes: attribs];
PSshow (pair->value); [value drawAtPoint: NSMakePoint (100, y) withAttributes: attribs];
y -= LINEHEIGHT; y -= LINEHEIGHT;
} }
PSstroke ();
return self; return self;
} }