-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFlatsView.m
More file actions
122 lines (102 loc) · 2.17 KB
/
Copy pathFlatsView.m
File metadata and controls
122 lines (102 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#import "ps_quartz.h"
#import "DoomProject.h"
#import "SectorEditor.h"
#import "FlatsView.h"
@implementation FlatsView
- initWithFrame:(NSRect)frameRect
{
dividers_i = [ [ CompatibleStorage alloc ]
initCount: 0
elementSize: sizeof (divider_t)
description: NULL
];
[super initWithFrame:frameRect];
return self;
}
- addDividerX:(int)x Y:(int)y String:(char *)string;
{
divider_t d;
d.x = x;
d.y = y;
strcpy (d.string, string );
[dividers_i addElement:&d ];
return self;
}
- dumpDividers
{
[dividers_i empty];
return self;
}
- drawSelf:(const NSRect *)rects :(int)rectCount
{
flat_t *f;
int max, i, cf;
NSRect r;
divider_t *d;
cf = [sectorEdit_i getCurrentFlat];
if (cf >= 0)
{
f = [sectorEdit_i getFlat:cf];
r = f->r;
r.origin.x -= 5;
r.origin.y -= 5;
r.size.width += 10;
r.size.height += 10;
DE_DrawOutline(&r);
}
max = [sectorEdit_i getNumFlats];
for (i = 0; i < max; i++)
{
f = [sectorEdit_i getFlat:i];
if (NSIntersectsRect(rects[0], f->r))
[f->image composite:NSCompositeCopy toPoint:&f->r.origin];
}
//
// Draw flat set divider text
//
PSselectfont("Helvetica-Bold",12);
PSrotate ( 0 );
max = [dividers_i count ];
for (i = 0; i < max; i++)
{
d = [dividers_i elementAt:i ];
PSsetgray ( 0 );
PSmoveto( d->x,d->y );
PSshow ( d->string );
PSstroke ();
PSsetlinewidth(1.0);
PSsetrgbcolor ( 148,0,0 );
PSmoveto ( d->x, d->y + 12 );
PSlineto ( [self bounds].size.width - SPACING, d->y + 12 );
PSmoveto ( d->x, d->y - 2 );
PSlineto ( [self bounds].size.width - SPACING, d->y - 2 );
PSstroke ();
}
return self;
}
- (void) mouseDown:(NSEvent *)theEvent
{
NSPoint loc;
int i,max,oldwindowmask;
flat_t *f;
// TODO: Needed?
//oldwindowmask = [[self window] addToEventMask:NX_LMOUSEDRAGGEDMASK];
loc = [theEvent locationInWindow];
[self convertPoint:loc fromView:NULL];
max = [sectorEdit_i getNumFlats];
for (i = 0;i < max; i++)
{
f = [sectorEdit_i getFlat:i];
if (NSPointInRect(loc, f->r) == YES)
{
if ([theEvent clickCount] == 2)
[sectorEdit_i selectFlat:i];
else
[sectorEdit_i setCurrentFlat:i];
break;
}
}
// TODO: Needed?
//[[self window] setEventMask:oldwindowmask];
}
@end