diff --git a/tools/Forge/Bundles/MapEdit/CameraView.m b/tools/Forge/Bundles/MapEdit/CameraView.m index ef8d3c59d..9bc537f1c 100644 --- a/tools/Forge/Bundles/MapEdit/CameraView.m +++ b/tools/Forge/Bundles/MapEdit/CameraView.m @@ -457,7 +457,7 @@ drawWire drawSelf =================== */ --drawSelf:(NSRect)rects :(int)rectCount +-drawRect:(NSRect)rects { float drawtime = 0; diff --git a/tools/Forge/Bundles/MapEdit/GNUmakefile b/tools/Forge/Bundles/MapEdit/GNUmakefile index 294e007e8..175729408 100644 --- a/tools/Forge/Bundles/MapEdit/GNUmakefile +++ b/tools/Forge/Bundles/MapEdit/GNUmakefile @@ -10,7 +10,7 @@ SUBPROJECTS= # PACKAGE_NAME= QuakeEd APP_NAME= QuakeEd -QuakeEd_PRINCIPAL_CLASS= NSApplication +QuakeEd_PRINCIPAL_CLASS= QuakeEdApp QuakeEd_APPLICATION_ICON= # diff --git a/tools/Forge/Bundles/MapEdit/MapEdit.gorm/objects.gorm b/tools/Forge/Bundles/MapEdit/MapEdit.gorm/objects.gorm index 3342d8d11..6bd6a4e99 100644 Binary files a/tools/Forge/Bundles/MapEdit/MapEdit.gorm/objects.gorm and b/tools/Forge/Bundles/MapEdit/MapEdit.gorm/objects.gorm differ diff --git a/tools/Forge/Bundles/MapEdit/QuakeEd.h b/tools/Forge/Bundles/MapEdit/QuakeEd.h index c2751b9ab..cbd90a640 100644 --- a/tools/Forge/Bundles/MapEdit/QuakeEd.h +++ b/tools/Forge/Bundles/MapEdit/QuakeEd.h @@ -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 // diff --git a/tools/Forge/Bundles/MapEdit/QuakeEd.m b/tools/Forge/Bundles/MapEdit/QuakeEd.m index 740339301..6a94af37b 100644 --- a/tools/Forge/Bundles/MapEdit/QuakeEd.m +++ b/tools/Forge/Bundles/MapEdit/QuakeEd.m @@ -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: diff --git a/tools/Forge/Bundles/MapEdit/QuakeEd_main.m b/tools/Forge/Bundles/MapEdit/QuakeEd_main.m index 54be2c713..b2170c181 100644 --- a/tools/Forge/Bundles/MapEdit/QuakeEd_main.m +++ b/tools/Forge/Bundles/MapEdit/QuakeEd_main.m @@ -1,5 +1,27 @@ #include +#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[]) { diff --git a/tools/Forge/Bundles/MapEdit/XYView.m b/tools/Forge/Bundles/MapEdit/XYView.m index f77586144..55ccfc600 100644 --- a/tools/Forge/Bundles/MapEdit/XYView.m +++ b/tools/Forge/Bundles/MapEdit/XYView.m @@ -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) diff --git a/tools/Forge/Bundles/MapEdit/ZView.m b/tools/Forge/Bundles/MapEdit/ZView.m index 54a907f47..0fbc58c89 100644 --- a/tools/Forge/Bundles/MapEdit/ZView.m +++ b/tools/Forge/Bundles/MapEdit/ZView.m @@ -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];