From ed2f2ce2cadb3f196187f51a355f8830431e0b65 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Fri, 16 Mar 2001 19:19:24 +0000 Subject: [PATCH] Forge: InspectorControl and KeypairView compile with no warnings now. --- tools/Forge/Headers/InspectorControl.h | 8 +-- tools/Forge/Headers/KeypairView.h | 2 +- tools/Forge/InspectorControl.m | 18 +++--- tools/Forge/KeypairView.m | 85 +++++++++++++------------- 4 files changed, 55 insertions(+), 58 deletions(-) diff --git a/tools/Forge/Headers/InspectorControl.h b/tools/Forge/Headers/InspectorControl.h index 5b90778dc..60b781b80 100644 --- a/tools/Forge/Headers/InspectorControl.h +++ b/tools/Forge/Headers/InspectorControl.h @@ -59,10 +59,10 @@ extern id inspcontrol_i; id itemHelp_i; // docs } -- awakeFromNib; -- changeInspector:sender; -- changeInspectorTo:(insp_e)which; -- (insp_e)getCurrentInspector; +- (id) awakeFromNib; +- (void) changeInspector: (id) sender; +- (void) changeInspectorTo: (insp_e) which; +- (insp_e) currentInspector; @end diff --git a/tools/Forge/Headers/KeypairView.h b/tools/Forge/Headers/KeypairView.h index 81b67a83f..ba865c903 100644 --- a/tools/Forge/Headers/KeypairView.h +++ b/tools/Forge/Headers/KeypairView.h @@ -5,7 +5,7 @@ extern id keypairview_i; { } -- calcViewSize; +- (void) calcViewSize; #define SPACING 4 #define FONTSIZE 12 diff --git a/tools/Forge/InspectorControl.m b/tools/Forge/InspectorControl.m index 8beffce33..a60fb85c1 100644 --- a/tools/Forge/InspectorControl.m +++ b/tools/Forge/InspectorControl.m @@ -10,7 +10,7 @@ id inspcontrol_i; @implementation InspectorControl -- awakeFromNib +- (id) awakeFromNib { inspcontrol_i = self; @@ -65,7 +65,7 @@ id inspcontrol_i; [inspectorView_i addSubview: inspectorSubview_i]; currentInspectorType = -1; - [self changeInspectorTo:i_project]; + [self changeInspectorTo: i_project]; return self; } @@ -75,19 +75,19 @@ id inspcontrol_i; // Sent by the PopUpList in the Inspector // Each cell in the PopUpList must have the correct tag // -- changeInspector:sender +- (void) changeInspector: (id) sender { id cell; cell = [sender selectedCell]; - [self changeInspectorTo:[cell tag]]; - return self; + [self changeInspectorTo: [cell tag]]; + return; } // // Change to specific Inspector // -- changeInspectorTo:(insp_e)which +- (void) changeInspectorTo: (insp_e) which { id newView; NSRect r; @@ -95,7 +95,7 @@ id inspcontrol_i; NSRect f; if (which == currentInspectorType) - return self; + return; currentInspectorType = which; newView = [contentList objectAtIndex: which]; @@ -118,10 +118,10 @@ id inspcontrol_i; [inspectorSubview_i unlockFocus]; [inspectorView_i display]; - return self; + return; } -- (insp_e)getCurrentInspector +- (insp_e) currentInspector { return currentInspectorType; } diff --git a/tools/Forge/KeypairView.m b/tools/Forge/KeypairView.m index 5cbb39829..013bff6a6 100644 --- a/tools/Forge/KeypairView.m +++ b/tools/Forge/KeypairView.m @@ -10,87 +10,84 @@ id keypairview_i; initFrame: ================== */ -- initFrame:(const NXRect *)frameRect +- (id) initWithFrame: (NSRect) frameRect { - [super initFrame:frameRect]; + [super initWithFrame: frameRect]; keypairview_i = self; return self; } -- calcViewSize +- (void) calcViewSize { - NXCoord w; - NXCoord h; - NXRect b; - NXPoint pt; - int count; - id ent; - - ent = [map_i currentEntity]; - count = [ent numPairs]; + NSRect b = [[self superview] bounds]; + NSRect newFrame; + NSPoint pt; + id ent = [map_i currentEntity]; + int count = [ent numPairs]; - [superview setFlipped: YES]; +// [[self superview] setFlipped: YES]; + + newFrame = b; + newFrame.size.height = LINEHEIGHT * count + SPACING; + + [[self superview] setNeedsDisplayInRect: newFrame]; + [self setFrame: newFrame]; + [self setNeedsDisplay: YES]; - [superview getBounds:&b]; - w = b.size.width; - h = LINEHEIGHT*count + SPACING; - [self sizeTo:w :h]; pt.x = pt.y = 0; - [self scrollPoint: &pt]; - return self; + [self scrollPoint: pt]; + return; } -- drawSelf:(const NXRect *)rects :(int)rectCount +- (void) drawSelf: (NSRect) aRect { epair_t *pair; int y; - - PSsetgray(NXGrayComponent(NX_COLORLTGRAY)); - PSrectfill(0,0,bounds.size.width,bounds.size.height); + + PSsetgray (NSLightGray); + NSRectFill (aRect); - PSselectfont("Helvetica-Bold",FONTSIZE); - PSrotate(0); - PSsetgray(0); + PSselectfont ("Helvetica-Bold", FONTSIZE); + PSrotate (0); + PSsetgray (0); pair = [[map_i currentEntity] epairs]; - y = bounds.size.height - LINEHEIGHT; - for ( ; pair ; pair=pair->next) - { - PSmoveto(SPACING, y); - PSshow(pair->key); - PSmoveto(100, y); - PSshow(pair->value); + y = [self bounds].size.height - LINEHEIGHT; + for (; pair; pair = pair->next) { + PSmoveto (SPACING, y); + PSshow (pair->key); + PSmoveto (100, y); + PSshow (pair->value); y -= LINEHEIGHT; } - PSstroke(); + PSstroke (); - return self; + return; } -- mouseDown:(NXEvent *)theEvent +- (void) mouseDown: (NSEvent *) theEvent { - NXPoint loc; + NSPoint loc = [theEvent locationInWindow]; + NSRect bounds = [self bounds]; int i; epair_t *p; - loc = theEvent->location; - [self convertPoint:&loc fromView:NULL]; + [self convertPoint: loc fromView: NULL]; i = (bounds.size.height - loc.y - 4) / LINEHEIGHT; p = [[map_i currentEntity] epairs]; - while ( i ) - { - p=p->next; + while ( i ) { + p = p->next; if (!p) - return self; + return; i--; } if (p) [things_i setSelectedKey: p]; - return self; + return; } @end