Get TextureView working.

This commit is contained in:
Bill Currie 2010-09-24 00:09:52 +09:00
parent 3c33652dae
commit 940d9613f5
2 changed files with 24 additions and 28 deletions

View file

@ -376,7 +376,7 @@ TEX_ForName (char *name)
viewWidth = maxwidth; viewWidth = maxwidth;
viewHeight = y + TEX_SPACING; viewHeight = y + TEX_SPACING;
[textureView_i setBoundsSize:NSMakeSize (viewWidth, viewHeight)]; [textureView_i setFrameSize:NSMakeSize (viewWidth, viewHeight)];
pt.x = pt.y = 0; pt.x = pt.y = 0;
[textureView_i scrollPoint:pt]; [textureView_i scrollPoint:pt];

View file

@ -1,3 +1,4 @@
#include "QF/sys.h"
#include "KeypairView.h" #include "KeypairView.h"
#include "TextureView.h" #include "TextureView.h"
@ -41,19 +42,18 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
NSPoint p; NSPoint p;
NSRect r; NSRect r;
int selected; int selected;
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
selected =[parent_i getSelectedTexture]; selected =[parent_i getSelectedTexture];
list_i =[parent_i getList]; list_i =[parent_i getList];
[[NSFont systemFontOfSize: FONTSIZE] set]; [[NSFont systemFontOfSize: FONTSIZE] set];
PSrotate (0);
PSsetgray (NSLightGray);
PSrectfill (rects.origin.x, rects.origin.y,
rects.size.width, rects.size.height);
[[NSColor lightGrayColor] set];
NSRectFill (rects);
Sys_Printf ("TextureView drawRect\n");
if (!list_i) // WADfile didn't init if (!list_i) // WADfile didn't init
return self; return self;
Sys_Printf (" ok\n");
if (deselectIndex != -1) { if (deselectIndex != -1) {
t =[list_i elementAt:deselectIndex]; t =[list_i elementAt:deselectIndex];
r = t->r; r = t->r;
@ -62,22 +62,21 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
r.size.width += TEX_INDENT * 2; r.size.width += TEX_INDENT * 2;
r.size.height += TEX_INDENT * 2; r.size.height += TEX_INDENT * 2;
PSsetgray(NSLightGray); [[NSColor lightGrayColor] set];
PSrectfill (r.origin.x, r.origin.y, r.size.width, r.size.height); NSRectFill (r);
p = t->r.origin; p = t->r.origin;
p.y += TEX_SPACING; p.y += TEX_SPACING;
[t->image drawAtPoint: p fromRect: r operation: NSCompositeCopy fraction:1.0]; [t->image drawAtPoint: p];
PSsetgray (0); [[NSColor blackColor] set];
x = t->r.origin.x; x = t->r.origin.x;
y = t->r.origin.y + 7; y = t->r.origin.y + 7;
PSmoveto (x, y); [[NSString stringWithCString: t->name]
PSshow (t->name); drawAtPoint: NSMakePoint (x, y) withAttributes: attribs];
PSstroke ();
deselectIndex = -1; deselectIndex = -1;
} }
max =[list_i count]; max =[list_i count];
PSsetgray (0); [[NSColor blackColor] set];
for (i = 0; i < max; i++) { for (i = 0; i < max; i++) {
t =[list_i elementAt:i]; t =[list_i elementAt:i];
@ -87,27 +86,24 @@ NOTE: I am specifically not using cached image reps, because the data is also ne
r.origin.y += 4; r.origin.y += 4;
if (NSIntersectsRect (rects, r) == YES && t->display) { if (NSIntersectsRect (rects, r) == YES && t->display) {
if (selected == i) { if (selected == i) {
PSsetgray (1); [[NSColor whiteColor] set];
PSrectfill (r.origin.x, r.origin.y, NSRectFill (r);
r.size.width, r.size.height); [[NSColor redColor] set];
PSsetrgbcolor (1, 0, 0); NSFrameRect(r);
PSrectstroke (r.origin.x, r.origin.y, [[NSColor blackColor] set];
r.size.width, r.size.height);
PSsetgray (0);
} }
p = t->r.origin; p = t->r.origin;
p.y += TEX_SPACING; p.y += TEX_SPACING;
//[t->image drawAtPoint: p fromRect: r operation: NSCompositeCopy fraction:1.0]; Sys_Printf ("tex %4d '%s' %p\n", t->index, t->name, t->image);
//[t->image drawAtPoint: p]; [t->image drawAtPoint: p];
[t->image drawInRect: t->r]; Sys_Printf (" ok\n");
x = t->r.origin.x; x = t->r.origin.x;
y = t->r.origin.y + 7; y = t->r.origin.y + 7;
PSmoveto (x, y); [[NSString stringWithCString: t->name]
PSshow (t->name); drawAtPoint: NSMakePoint (x, y) withAttributes: attribs];
} }
} }
PSstroke ();
return self; return self;
} }