ftp.nice.ch/pub/next/tools/dock/Locus.1.0.NI.bs.tar.gz#/Locus/Source/CustomApp.m

This is CustomApp.m in view mode; [Download] [Up]

/*
	Copyright 1993  Jeremy Slade.

	You are free to use all or any parts of the Locus project
	however you wish, just give credit where credit is due.
	The author (Jeremy Slade) shall not be held responsible
	for any damages that result out of use or misuse of any
	part of this project.

*/

/*
	Project: Locus

	File: CustomApp.m

	Description: See CustomApp.h

	Original Author: Jeremy Slade

	Revision History:
		Created
			V.101	JGS	Sat Mar 27 19:09:26 GMT-0700 1993

*/


#import "CustomApp.h"

#import "Globals.h"



@implementation CustomApp : Application


// -------------------------------------------------------------------------
//   Creating, Initializing
// -------------------------------------------------------------------------


+ initialize
{
	[self setVersion:CustomApp_VERSION];
	return ( self );
}



// -------------------------------------------------------------------------
//   Events
// -------------------------------------------------------------------------


- sendEvent:(NXEvent *)theEvent
/*
	This method overrides Application's normal behavior so that all command key events (keydown w/ NX_COMMANDMASK) go first to the KeyWindow, so that responders there get a chance to intercept them before they get to the menus.
*/
{
	if ( theEvent->type == NX_KEYDOWN && theEvent->flags
			& NX_COMMANDMASK ) {
		if ( [keyWindow commandKey:theEvent] )
			return ( self ); // The keywindow handled this event
		if ( mainWindow != keyWindow && [mainWindow commandKey:theEvent] )
			return ( self ); // The MainWindow handled this event
	}
	return ( [super sendEvent:theEvent] );
}




// -------------------------------------------------------------------------
//   Debugging Support
// -------------------------------------------------------------------------


- (const char *)appName
/*
	This method appends ".debug" to the appName if the DEBUGGING global is turned on, otherwise behaves as normal.  This is used to have Locus writes defaults under a different owner when running in test mode
*/ 
{
	static char *debugName = NULL;
	
	if ( !debugName ) {
		char buf[60];
		sprintf ( buf, "%s.debug", [super appName] );
		debugName = NXCopyStringBuffer ( buf );
	}
	
	return ( DEBUGGING ? debugName : [super appName] );
}



@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.