Forge: InspectorControl and KeypairView compile with no warnings now.

This commit is contained in:
Jeff Teunissen 2001-03-16 19:19:24 +00:00
parent cc85f21430
commit ed2f2ce2ca
4 changed files with 55 additions and 58 deletions

View file

@ -59,10 +59,10 @@ extern id inspcontrol_i;
id itemHelp_i; // docs id itemHelp_i; // docs
} }
- awakeFromNib; - (id) awakeFromNib;
- changeInspector:sender; - (void) changeInspector: (id) sender;
- changeInspectorTo:(insp_e)which; - (void) changeInspectorTo: (insp_e) which;
- (insp_e)getCurrentInspector; - (insp_e) currentInspector;
@end @end

View file

@ -5,7 +5,7 @@ extern id keypairview_i;
{ {
} }
- calcViewSize; - (void) calcViewSize;
#define SPACING 4 #define SPACING 4
#define FONTSIZE 12 #define FONTSIZE 12

View file

@ -10,7 +10,7 @@ id inspcontrol_i;
@implementation InspectorControl @implementation InspectorControl
- awakeFromNib - (id) awakeFromNib
{ {
inspcontrol_i = self; inspcontrol_i = self;
@ -65,7 +65,7 @@ id inspcontrol_i;
[inspectorView_i addSubview: inspectorSubview_i]; [inspectorView_i addSubview: inspectorSubview_i];
currentInspectorType = -1; currentInspectorType = -1;
[self changeInspectorTo:i_project]; [self changeInspectorTo: i_project];
return self; return self;
} }
@ -75,19 +75,19 @@ id inspcontrol_i;
// Sent by the PopUpList in the Inspector // Sent by the PopUpList in the Inspector
// Each cell in the PopUpList must have the correct tag // Each cell in the PopUpList must have the correct tag
// //
- changeInspector:sender - (void) changeInspector: (id) sender
{ {
id cell; id cell;
cell = [sender selectedCell]; cell = [sender selectedCell];
[self changeInspectorTo:[cell tag]]; [self changeInspectorTo: [cell tag]];
return self; return;
} }
// //
// Change to specific Inspector // Change to specific Inspector
// //
- changeInspectorTo:(insp_e)which - (void) changeInspectorTo: (insp_e) which
{ {
id newView; id newView;
NSRect r; NSRect r;
@ -95,7 +95,7 @@ id inspcontrol_i;
NSRect f; NSRect f;
if (which == currentInspectorType) if (which == currentInspectorType)
return self; return;
currentInspectorType = which; currentInspectorType = which;
newView = [contentList objectAtIndex: which]; newView = [contentList objectAtIndex: which];
@ -118,10 +118,10 @@ id inspcontrol_i;
[inspectorSubview_i unlockFocus]; [inspectorSubview_i unlockFocus];
[inspectorView_i display]; [inspectorView_i display];
return self; return;
} }
- (insp_e)getCurrentInspector - (insp_e) currentInspector
{ {
return currentInspectorType; return currentInspectorType;
} }

View file

@ -10,87 +10,84 @@ id keypairview_i;
initFrame: initFrame:
================== ==================
*/ */
- initFrame:(const NXRect *)frameRect - (id) initWithFrame: (NSRect) frameRect
{ {
[super initFrame:frameRect]; [super initWithFrame: frameRect];
keypairview_i = self; keypairview_i = self;
return self; return self;
} }
- calcViewSize - (void) calcViewSize
{ {
NXCoord w; NSRect b = [[self superview] bounds];
NXCoord h; NSRect newFrame;
NXRect b; NSPoint pt;
NXPoint pt; id ent = [map_i currentEntity];
int count; int count = [ent numPairs];
id ent;
ent = [map_i currentEntity];
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; pt.x = pt.y = 0;
[self scrollPoint: &pt]; [self scrollPoint: pt];
return self; return;
} }
- drawSelf:(const NXRect *)rects :(int)rectCount - (void) drawSelf: (NSRect) aRect
{ {
epair_t *pair; epair_t *pair;
int y; int y;
PSsetgray(NXGrayComponent(NX_COLORLTGRAY)); PSsetgray (NSLightGray);
PSrectfill(0,0,bounds.size.width,bounds.size.height); NSRectFill (aRect);
PSselectfont("Helvetica-Bold",FONTSIZE); PSselectfont ("Helvetica-Bold", FONTSIZE);
PSrotate(0); PSrotate (0);
PSsetgray(0); PSsetgray (0);
pair = [[map_i currentEntity] epairs]; pair = [[map_i currentEntity] epairs];
y = bounds.size.height - LINEHEIGHT; y = [self bounds].size.height - LINEHEIGHT;
for ( ; pair ; pair=pair->next) for (; pair; pair = pair->next) {
{ PSmoveto (SPACING, y);
PSmoveto(SPACING, y); PSshow (pair->key);
PSshow(pair->key); PSmoveto (100, y);
PSmoveto(100, y); PSshow (pair->value);
PSshow(pair->value);
y -= LINEHEIGHT; 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; int i;
epair_t *p; epair_t *p;
loc = theEvent->location; [self convertPoint: loc fromView: NULL];
[self convertPoint:&loc fromView:NULL];
i = (bounds.size.height - loc.y - 4) / LINEHEIGHT; i = (bounds.size.height - loc.y - 4) / LINEHEIGHT;
p = [[map_i currentEntity] epairs]; p = [[map_i currentEntity] epairs];
while ( i ) while ( i ) {
{ p = p->next;
p=p->next;
if (!p) if (!p)
return self; return;
i--; i--;
} }
if (p) if (p)
[things_i setSelectedKey: p]; [things_i setSelectedKey: p];
return self; return;
} }
@end @end