Get some screen updates happening.

This commit is contained in:
Bill Currie 2010-09-12 14:31:59 +09:00
parent 2d403391b5
commit 68a55eaf8d
8 changed files with 70 additions and 54 deletions

View File

@ -457,7 +457,7 @@ drawWire
drawSelf
===================
*/
-drawSelf:(NSRect)rects :(int)rectCount
-drawRect:(NSRect)rects
{
float drawtime = 0;

View File

@ -10,7 +10,7 @@ SUBPROJECTS=
#
PACKAGE_NAME= QuakeEd
APP_NAME= QuakeEd
QuakeEd_PRINCIPAL_CLASS= NSApplication
QuakeEd_PRINCIPAL_CLASS= QuakeEdApp
QuakeEd_APPLICATION_ICON=
#

View File

@ -56,7 +56,6 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i
// instance drawing
-redrawInstance; // erase and redraw all instance now
-appDidInit:sender;
-appWillTerminate:sender;
-openProject:sender;
@ -82,10 +81,7 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i
-doOpen:(char *) fname;
-saveBSP:(char *)
cmdline
dialog:(BOOL)
wt;
-saveBSP:(char *)cmdline dialog:(BOOL)wt;
-BSP_Full:sender;
-BSP_FastVis:sender;
@ -94,6 +90,8 @@ dialog:(BOOL)
-BSP_stop:sender;
-BSP_entities:sender;
-applicationDefined:(NSEvent *) theEvent;
//
// UI querie for other objects
//

View File

@ -123,31 +123,6 @@ Every five minutes, save a modified map
[map_i writeStats];
}
/*
===============
init
===============
*/
-initContent: (NSRect) contentRect style: (int) aStyle backing: (int) backingType buttonMask: (int) mask defer:(BOOL) flag
{
[super initWithContentRect: contentRect styleMask: aStyle backing: backingType defer:flag];
// XXX [self addToEventMask:
// XXX NSRightMouseDragged|NSLeftMouseDragged];
// XXX malloc_error(My_Malloc_Error);
quakeed_i = self;
dirty = autodirty = NO;
[NSTimer timerWithTimeInterval: 5 * 60 target: self selector:@selector
(AutoSave)
userInfo: nil repeats:YES];
path =[NSBezierPath new];
return self;
}
#define FN_TEMPSAVE "/qcache/temp.map"
-setDefaultFilename
@ -194,7 +169,7 @@ postappdefined (void)
windowNumber: 0 context:[NSApp context]
subtype: 0 data1: 0 data2:0];
[NSApp postEvent: ev atStart:NO];
//printf ("posted\n");
Sys_Printf ("posted\n");
updateinflight = YES;
}
@ -320,23 +295,25 @@ App delegate methods
updateinflight = NO;
//printf ("serviced\n");
Sys_Printf ("serviced\n");
// update screen
evp =[NSApp nextEventMatchingMask: NSAnyEventMask untilDate:[NSDate
distantPast]
inMode: NSEventTrackingRunLoopMode dequeue:NO];
evp = [NSApp nextEventMatchingMask: NSAnyEventMask
untilDate: [NSDate distantPast]
inMode: NSEventTrackingRunLoopMode
dequeue: NO];
if (evp) {
postappdefined ();
return self;
}
Sys_Printf ("updating %d %d\n", (int)[map_i count], (int)[[map_i currentEntity] count]);
[self disableFlushWindow];
if ([map_i count] !=[entitycount_i intValue])
if ([map_i count] != [entitycount_i intValue])
[entitycount_i setIntValue:[map_i count]];
if ([[map_i currentEntity] count] !=[brushcount_i intValue])
if ([[map_i currentEntity] count] != [brushcount_i intValue])
[brushcount_i setIntValue:[[map_i currentEntity] count]];
if (updatecamera)
@ -356,7 +333,24 @@ App delegate methods
return self;
}
-appDidInit:sender
-(void)awakeFromNib
{
// XXX [self addToEventMask:
// XXX NSRightMouseDragged|NSLeftMouseDragged];
// XXX malloc_error(My_Malloc_Error);
quakeed_i = self;
dirty = autodirty = NO;
[NSTimer timerWithTimeInterval: 5 * 60 target: self selector:@selector
(AutoSave)
userInfo: nil repeats:YES];
path =[NSBezierPath new];
}
-(void)applicationDidFinishLaunching:(NSNotification *) notification
{
NSArray *screens;
NSScreen *scrn;
@ -368,7 +362,7 @@ App delegate methods
[project_i initProject];
[xyview_i setModeRadio:xy_drawmode_i];
// because xy view is inside
// because xy view is inside
// scrollview and can't be
// connected directly in IB
@ -391,8 +385,6 @@ App delegate methods
Sys_Printf ("ready.\n");
//malloc_debug(-1); // DEBUG
return self;
}
-appWillTerminate:sender
@ -888,6 +880,7 @@ keyDown
-keyDown:(NSEvent *) theEvent
{
int ch;
const char *chars;
// function keys
switch ([theEvent keyCode]) {
@ -934,7 +927,8 @@ keyDown
}
// portable things
ch = tolower ([[theEvent characters] cString][0]);
chars = [[theEvent characters] cString];
ch = chars ? tolower (chars[0]) : 0;
switch (ch) {
case KEY_RIGHTARROW:

View File

@ -1,5 +1,27 @@
#include <AppKit/AppKit.h>
#include "QF/sys.h"
#include "QuakeEd.h"
@interface QuakeEdApp:NSApplication
-(void)sendEvent:(NSEvent *) evt;
@end
@implementation QuakeEdApp
-(void)sendEvent:(NSEvent *) evt;
{
if ([evt type] == NSApplicationDefined) {
Sys_Printf ("QuakeEdApp sendEvent\n");
[quakeed_i applicationDefined: evt];
} else {
[super sendEvent:evt];
}
}
@end
int
main (int argc, const char *argv[])
{

View File

@ -786,7 +786,7 @@ drawSelf
*/
NSRect xy_draw_rect;
-drawSelf: (NSRect) rects:(int) rectCount
-drawRect: (NSRect) rects
{
static float drawtime; // static to shut up compiler warning
@ -799,7 +799,8 @@ NSRect xy_draw_rect;
// setup for text
// PSselectfont("Helvetica-Medium",10/scale);
GSSetFont (DEFCTXT,[NSFont fontWithName: @"Helvetica-Medium" size:10 / scale]);
//GSSetFont (DEFCTXT,[NSFont fontWithName: @"Helvetica-Medium" size:10 / scale]);
[[NSFont systemFontOfSize: 10] set];
PSrotate (0);
if (drawmode == dr_texture || drawmode == dr_flat)

View File

@ -303,7 +303,7 @@ Rect is in global world (unscaled) coordinates
============
*/
-drawGrid:(const NSRect *) rect
-drawGrid:(NSRect) rect
{
int y, stopy;
float top, bottom;
@ -321,8 +321,8 @@ Rect is in global world (unscaled) coordinates
left = _bounds.origin.x;
right = 24;
bottom = rect->origin.y - 1;
top = rect->origin.y + rect->size.height + 2;
bottom = rect.origin.y - 1;
top = rect.origin.y + rect.size.height + 2;
//
// grid
@ -389,7 +389,8 @@ Rect is in global world (unscaled) coordinates
[path removeAllPoints];
PSsetgray (0); // for text
GSSetFont (DEFCTXT,[NSFont fontWithName: @"Helvetica-Medium" size:10 / scale]);
//GSSetFont (DEFCTXT,[NSFont fontWithName: @"Helvetica-Medium" size:10 / scale]);
[[NSFont systemFontOfSize: 10] set];
PSrotate (0);
for (; y <= stopy; y += 64) {
@ -439,7 +440,7 @@ drawSelf
===============================================================================
*/
-drawSelf: (const NSRect *) rects:(int) rectCount
-drawRect: (NSRect) rects
{
NSRect visRect;
@ -448,13 +449,13 @@ drawSelf
// allways draw the entire bar
visRect =[self visibleRect];
rects = &visRect;
rects = visRect;
// erase window
NSEraseRect (rects[0]);
NSEraseRect (rects);
// draw grid
[self drawGrid:&rects[0]];
[self drawGrid:rects];
// draw zplane
// [self drawZplane];