mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 20:01:56 +00:00
Minor tidyup - use NSBundle to get info dictionary.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4113 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5c47b2b844
commit
dc098d16e6
1 changed files with 392 additions and 399 deletions
|
@ -103,7 +103,7 @@ NSApplication *NSApp = nil;
|
||||||
//
|
//
|
||||||
// Class methods
|
// Class methods
|
||||||
//
|
//
|
||||||
+ (void)initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NSApplication class])
|
if (self == [NSApplication class])
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ NSApplication *NSApp = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSApplication *)sharedApplication
|
+ (NSApplication *) sharedApplication
|
||||||
{ // If the global application does
|
{ // If the global application does
|
||||||
if (!NSApp) // not yet exist then create it
|
if (!NSApp) // not yet exist then create it
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ NSApplication *NSApp = nil;
|
||||||
//
|
//
|
||||||
// Instance methods
|
// Instance methods
|
||||||
//
|
//
|
||||||
- init
|
- (id) init
|
||||||
{
|
{
|
||||||
if (NSApp != self)
|
if (NSApp != self)
|
||||||
{
|
{
|
||||||
|
@ -161,51 +161,42 @@ NSApplication *NSApp = nil;
|
||||||
current_event = [NSEvent new]; // no current event
|
current_event = [NSEvent new]; // no current event
|
||||||
null_event = [NSEvent new]; // create dummy event
|
null_event = [NSEvent new]; // create dummy event
|
||||||
|
|
||||||
[self setNextResponder:NULL]; // We are the end of
|
[self setNextResponder: nil]; // We are the end of
|
||||||
// the responder chain
|
// the responder chain
|
||||||
|
|
||||||
// Set up the run loop
|
// Set up the run loop object for the current thread
|
||||||
// object for the
|
[self setupRunLoopInputSourcesForMode: NSDefaultRunLoopMode];
|
||||||
// current thread
|
[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
|
||||||
[self setupRunLoopInputSourcesForMode:NSDefaultRunLoopMode];
|
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
||||||
[self setupRunLoopInputSourcesForMode:NSConnectionReplyMode];
|
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
||||||
[self setupRunLoopInputSourcesForMode:NSModalPanelRunLoopMode];
|
|
||||||
[self setupRunLoopInputSourcesForMode:NSEventTrackingRunLoopMode];
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)finishLaunching
|
- (void) finishLaunching
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
NSBundle* mainBundle = [NSBundle mainBundle];
|
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||||
NSString* resourcePath = [mainBundle resourcePath];
|
NSDictionary *infoDict = [mainBundle infoDictionary];
|
||||||
NSString* infoFilePath = [resourcePath
|
NSString *mainModelFile;
|
||||||
stringByAppendingPathComponent:@"Info-gnustep.plist"];
|
|
||||||
NSDictionary* infoDict;
|
|
||||||
NSString* mainModelFile;
|
|
||||||
|
|
||||||
infoDict = [[NSString stringWithContentsOfFile:infoFilePath] propertyList];
|
mainModelFile = [infoDict objectForKey: @"NSMainNibFile"];
|
||||||
mainModelFile = [infoDict objectForKey:@"NSMainNibFile"];
|
|
||||||
|
|
||||||
if (mainModelFile && ![mainModelFile isEqual:@""])
|
if (mainModelFile && ![mainModelFile isEqual: @""])
|
||||||
{
|
{
|
||||||
if (![GMModel loadIMFile:mainModelFile
|
if (![GMModel loadIMFile: mainModelFile
|
||||||
owner:[NSApplication sharedApplication]])
|
owner: [NSApplication sharedApplication]])
|
||||||
NSLog (@"Cannot load the main model file '%@", mainModelFile);
|
NSLog (@"Cannot load the main model file '%@", mainModelFile);
|
||||||
}
|
}
|
||||||
// post notification that
|
|
||||||
// launch will finish
|
/* post notification that launch will finish */
|
||||||
[nc postNotificationName: NSApplicationWillFinishLaunchingNotification
|
[nc postNotificationName: NSApplicationWillFinishLaunchingNotification
|
||||||
object: self];
|
object: self];
|
||||||
// Register our listener to
|
|
||||||
// handle incoming services
|
/* Register our listener to incoming services requests etc. */
|
||||||
// requests etc.
|
|
||||||
[listener registerAsServiceProvider];
|
[listener registerAsServiceProvider];
|
||||||
|
|
||||||
// finish the launching
|
/* finish the launching post notification that launching has finished */
|
||||||
// post notification that
|
|
||||||
// launching has finished
|
|
||||||
[nc postNotificationName: NSApplicationDidFinishLaunchingNotification
|
[nc postNotificationName: NSApplicationDidFinishLaunchingNotification
|
||||||
object: self];
|
object: self];
|
||||||
}
|
}
|
||||||
|
@ -213,16 +204,18 @@ NSString* mainModelFile;
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Freeing NSApplication\n");
|
NSDebugLog(@"Freeing NSApplication\n");
|
||||||
// Let ourselves know we
|
|
||||||
gnustep_gui_app_is_in_dealloc = YES; // are within dealloc
|
/* Let ourselves know we are within dealloc */
|
||||||
|
gnustep_gui_app_is_in_dealloc = YES;
|
||||||
|
|
||||||
[listener release];
|
[listener release];
|
||||||
[event_queue release];
|
[event_queue release];
|
||||||
[current_event release];
|
[current_event release];
|
||||||
|
|
||||||
while (session != 0) // We may need to tidy up
|
/* We may need to tidy up nested modal session structures. */
|
||||||
{ // nested modal session
|
while (session != 0)
|
||||||
NSModalSession tmp = session; // structures.
|
{
|
||||||
|
NSModalSession tmp = session;
|
||||||
|
|
||||||
session = tmp->previous;
|
session = tmp->previous;
|
||||||
NSZoneFree(NSDefaultMallocZone(), tmp);
|
NSZoneFree(NSDefaultMallocZone(), tmp);
|
||||||
|
@ -310,10 +303,10 @@ NSString* mainModelFile;
|
||||||
{
|
{
|
||||||
pool = [arpClass new];
|
pool = [arpClass new];
|
||||||
|
|
||||||
e = [self nextEventMatchingMask:NSAnyEventMask
|
e = [self nextEventMatchingMask: NSAnyEventMask
|
||||||
untilDate:[NSDate distantFuture]
|
untilDate: [NSDate distantFuture]
|
||||||
inMode:NSDefaultRunLoopMode
|
inMode: NSDefaultRunLoopMode
|
||||||
dequeue:YES];
|
dequeue: YES];
|
||||||
if (e)
|
if (e)
|
||||||
[self sendEvent: e];
|
[self sendEvent: e];
|
||||||
|
|
||||||
|
@ -368,7 +361,7 @@ NSString* mainModelFile;
|
||||||
|
|
||||||
if (theSession == 0)
|
if (theSession == 0)
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"null pointer passed to endModalSession:"];
|
format: @"null pointer passed to endModalSession: "];
|
||||||
|
|
||||||
// Remove this session from
|
// Remove this session from
|
||||||
// linked list of sessions.
|
// linked list of sessions.
|
||||||
|
@ -377,7 +370,7 @@ NSString* mainModelFile;
|
||||||
|
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"unknown session passed to endModalSession:"];
|
format: @"unknown session passed to endModalSession: "];
|
||||||
|
|
||||||
while (session != theSession)
|
while (session != theSession)
|
||||||
{
|
{
|
||||||
|
@ -400,7 +393,7 @@ NSString* mainModelFile;
|
||||||
|
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
theSession = [self beginModalSessionForWindow:theWindow];
|
theSession = [self beginModalSessionForWindow: theWindow];
|
||||||
while (code == NSRunContinuesResponse)
|
while (code == NSRunContinuesResponse)
|
||||||
{
|
{
|
||||||
code = [self runModalSession: theSession];
|
code = [self runModalSession: theSession];
|
||||||
|
@ -536,7 +529,7 @@ NSString* mainModelFile;
|
||||||
{
|
{
|
||||||
if (session == 0)
|
if (session == 0)
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format:@"stopModalWithCode: when not in a modal session"];
|
format: @"stopModalWithCode: when not in a modal session"];
|
||||||
else
|
else
|
||||||
if (returnCode == NSRunContinuesResponse)
|
if (returnCode == NSRunContinuesResponse)
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
@ -548,7 +541,7 @@ NSString* mainModelFile;
|
||||||
//
|
//
|
||||||
// Getting, removing, and posting events
|
// Getting, removing, and posting events
|
||||||
//
|
//
|
||||||
- (void)sendEvent:(NSEvent *)theEvent
|
- (void) sendEvent: (NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
if (theEvent == null_event) // Don't send null event
|
if (theEvent == null_event) // Don't send null event
|
||||||
{
|
{
|
||||||
|
@ -564,14 +557,14 @@ NSString* mainModelFile;
|
||||||
case NSKeyDown:
|
case NSKeyDown:
|
||||||
{
|
{
|
||||||
NSDebugLog(@"send key down event\n");
|
NSDebugLog(@"send key down event\n");
|
||||||
[[theEvent window] sendEvent:theEvent];
|
[[theEvent window] sendEvent: theEvent];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NSKeyUp:
|
case NSKeyUp:
|
||||||
{
|
{
|
||||||
NSDebugLog(@"send key up event\n");
|
NSDebugLog(@"send key up event\n");
|
||||||
[[theEvent window] sendEvent:theEvent];
|
[[theEvent window] sendEvent: theEvent];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,9 +578,9 @@ NSString* mainModelFile;
|
||||||
copyOfMainMenu = [main_menu copy]; // under the mouse
|
copyOfMainMenu = [main_menu copy]; // under the mouse
|
||||||
copyMenuWindow = [copyOfMainMenu menuWindow];
|
copyMenuWindow = [copyOfMainMenu menuWindow];
|
||||||
[copyOfMainMenu _rightMouseDisplay];
|
[copyOfMainMenu _rightMouseDisplay];
|
||||||
[copyMenuWindow _captureMouse:self];
|
[copyMenuWindow _captureMouse: self];
|
||||||
[[copyOfMainMenu menuCells] mouseDown:theEvent];
|
[[copyOfMainMenu menuCells] mouseDown: theEvent];
|
||||||
[copyMenuWindow _releaseMouse:self];
|
[copyMenuWindow _releaseMouse: self];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -602,7 +595,7 @@ NSString* mainModelFile;
|
||||||
NSDebugLog([window description]);
|
NSDebugLog([window description]);
|
||||||
if (!window)
|
if (!window)
|
||||||
NSDebugLog(@"no window");
|
NSDebugLog(@"no window");
|
||||||
[window sendEvent:theEvent];
|
[window sendEvent: theEvent];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,18 +605,18 @@ NSString* mainModelFile;
|
||||||
return current_event;
|
return current_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) discardEventsMatchingMask:(unsigned int)mask
|
- (void) discardEventsMatchingMask: (unsigned int)mask
|
||||||
beforeEvent:(NSEvent *)lastEvent
|
beforeEvent: (NSEvent *)lastEvent
|
||||||
{
|
{
|
||||||
int i = 0, count, loop;
|
unsigned i = 0, count, loop;
|
||||||
NSEvent* event = nil;
|
NSEvent *event = nil;
|
||||||
BOOL match;
|
BOOL match;
|
||||||
// if queue contains
|
// if queue contains
|
||||||
if ((count = [event_queue count])) // events check them
|
if ((count = [event_queue count])) // events check them
|
||||||
{
|
{
|
||||||
for (loop = 0; ((event != lastEvent) && (loop < count)); loop++)
|
for (loop = 0; ((event != lastEvent) && (loop < count)); loop++)
|
||||||
{
|
{
|
||||||
event = [event_queue objectAtIndex:i]; // Get next event from
|
event = [event_queue objectAtIndex: i]; // Get next event from
|
||||||
match = NO; // the events queue
|
match = NO; // the events queue
|
||||||
|
|
||||||
if (mask == NSAnyEventMask) // the any event mask
|
if (mask == NSAnyEventMask) // the any event mask
|
||||||
|
@ -707,18 +700,18 @@ BOOL match;
|
||||||
} } // remove event from
|
} } // remove event from
|
||||||
// the queue if it
|
// the queue if it
|
||||||
if (match) // matched the mask
|
if (match) // matched the mask
|
||||||
[event_queue removeObjectAtIndex:i];
|
[event_queue removeObjectAtIndex: i];
|
||||||
else // inc queue cntr only
|
else // inc queue cntr only
|
||||||
i++; // if not a match else
|
i++; // if not a match else
|
||||||
} // we will run off the
|
} // we will run off the
|
||||||
} // end of the queue
|
} // end of the queue
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSEvent*)_eventMatchingMask:(unsigned int)mask dequeue:(BOOL)flag
|
- (NSEvent*) _eventMatchingMask: (unsigned int)mask dequeue: (BOOL)flag
|
||||||
{
|
{
|
||||||
NSEvent* event; // return the next
|
NSEvent *event; // return the next
|
||||||
int i, count; // event in the queue
|
unsigned i, count; // event in the queue
|
||||||
BOOL match = NO; // which matches mask
|
BOOL match = NO; // which matches mask
|
||||||
|
|
||||||
[self _nextEvent];
|
[self _nextEvent];
|
||||||
|
|
||||||
|
@ -726,7 +719,7 @@ BOOL match = NO; // which matches mask
|
||||||
{ // events check them
|
{ // events check them
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{ // Get next event from
|
{ // Get next event from
|
||||||
event = [event_queue objectAtIndex:i]; // the events queue
|
event = [event_queue objectAtIndex: i]; // the events queue
|
||||||
|
|
||||||
if (mask == NSAnyEventMask) // the any event mask
|
if (mask == NSAnyEventMask) // the any event mask
|
||||||
match = YES; // matches all events
|
match = YES; // matches all events
|
||||||
|
@ -738,7 +731,7 @@ BOOL match = NO; // which matches mask
|
||||||
if (flag) // dequeue null event
|
if (flag) // dequeue null event
|
||||||
{ // if flag is set
|
{ // if flag is set
|
||||||
[event retain];
|
[event retain];
|
||||||
[event_queue removeObjectAtIndex:i];
|
[event_queue removeObjectAtIndex: i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -825,7 +818,7 @@ BOOL match = NO; // which matches mask
|
||||||
if (flag) // dequeue the event if
|
if (flag) // dequeue the event if
|
||||||
{ // flag is set
|
{ // flag is set
|
||||||
[event retain];
|
[event retain];
|
||||||
[event_queue removeObjectAtIndex:i];
|
[event_queue removeObjectAtIndex: i];
|
||||||
}
|
}
|
||||||
ASSIGN(current_event, event);
|
ASSIGN(current_event, event);
|
||||||
|
|
||||||
|
@ -837,20 +830,20 @@ BOOL match = NO; // which matches mask
|
||||||
return nil; // queue matches mask
|
return nil; // queue matches mask
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSEvent*) nextEventMatchingMask:(unsigned int)mask
|
- (NSEvent*) nextEventMatchingMask: (unsigned int)mask
|
||||||
untilDate:(NSDate *)expiration
|
untilDate: (NSDate *)expiration
|
||||||
inMode:(NSString *)mode
|
inMode: (NSString *)mode
|
||||||
dequeue:(BOOL)flag
|
dequeue: (BOOL)flag
|
||||||
{
|
{
|
||||||
NSEvent *event;
|
NSEvent *event;
|
||||||
BOOL done = NO;
|
BOOL done = NO;
|
||||||
|
|
||||||
if (mode == NSEventTrackingRunLoopMode) // temporary hack to
|
if (mode == NSEventTrackingRunLoopMode) // temporary hack to
|
||||||
inTrackingLoop = YES; // regulate translation
|
inTrackingLoop = YES; // regulate translation
|
||||||
else // of X motion events
|
else // of X motion events
|
||||||
inTrackingLoop = NO; // while not in a
|
inTrackingLoop = NO; // while not in a
|
||||||
// tracking loop
|
// tracking loop
|
||||||
if ((event = [self _eventMatchingMask:mask dequeue:flag]))
|
if ((event = [self _eventMatchingMask: mask dequeue: flag]))
|
||||||
done = YES;
|
done = YES;
|
||||||
else
|
else
|
||||||
if (!expiration)
|
if (!expiration)
|
||||||
|
@ -861,26 +854,26 @@ BOOL done = NO;
|
||||||
NSDate *limitDate, *originalLimitDate;
|
NSDate *limitDate, *originalLimitDate;
|
||||||
NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
|
NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
|
||||||
// Retain the limitDate so that it doesn't get released
|
// Retain the limitDate so that it doesn't get released
|
||||||
// accidentally by runMode:beforeDate: if a timer which
|
// accidentally by runMode: beforeDate: if a timer which
|
||||||
// has this date as fire date gets released.
|
// has this date as fire date gets released.
|
||||||
limitDate = [[currentLoop limitDateForMode:mode] retain];
|
limitDate = [[currentLoop limitDateForMode: mode] retain];
|
||||||
originalLimitDate = limitDate;
|
originalLimitDate = limitDate;
|
||||||
|
|
||||||
if ((event = [self _eventMatchingMask:mask dequeue:flag]))
|
if ((event = [self _eventMatchingMask: mask dequeue: flag]))
|
||||||
{
|
{
|
||||||
[limitDate release];
|
[limitDate release];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limitDate)
|
if (limitDate)
|
||||||
limitDate = [expiration earlierDate:limitDate];
|
limitDate = [expiration earlierDate: limitDate];
|
||||||
else
|
else
|
||||||
limitDate = expiration;
|
limitDate = expiration;
|
||||||
|
|
||||||
[currentLoop runMode:mode beforeDate:limitDate];
|
[currentLoop runMode: mode beforeDate: limitDate];
|
||||||
[originalLimitDate release];
|
[originalLimitDate release];
|
||||||
|
|
||||||
if ((event = [self _eventMatchingMask:mask dequeue:flag]))
|
if ((event = [self _eventMatchingMask: mask dequeue: flag]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// no need to unhide cursor
|
// no need to unhide cursor
|
||||||
|
@ -901,7 +894,7 @@ BOOL done = NO;
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
- (void) postEvent: (NSEvent *)event atStart: (BOOL)flag
|
||||||
{
|
{
|
||||||
if (!flag)
|
if (!flag)
|
||||||
[event_queue addObject: event];
|
[event_queue addObject: event];
|
||||||
|
@ -1184,7 +1177,7 @@ BOOL done = NO;
|
||||||
j = [window_list count];
|
j = [window_list count];
|
||||||
for (i = 0; i < j; ++i)
|
for (i = 0; i < j; ++i)
|
||||||
{
|
{
|
||||||
w = [window_list objectAtIndex:i];
|
w = [window_list objectAtIndex: i];
|
||||||
if ([w isMainWindow])
|
if ([w isMainWindow])
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
@ -1227,13 +1220,13 @@ BOOL done = NO;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)miniaturizeAll:sender
|
- (void) miniaturizeAll: sender
|
||||||
{
|
{
|
||||||
NSArray *window_list = [self windows];
|
NSArray *window_list = [self windows];
|
||||||
unsigned i, count;
|
unsigned i, count;
|
||||||
|
|
||||||
for (i = 0, count = [window_list count]; i < count; i++)
|
for (i = 0, count = [window_list count]; i < count; i++)
|
||||||
[[window_list objectAtIndex:i] miniaturize:sender];
|
[[window_list objectAtIndex: i] miniaturize: sender];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) preventWindowOrdering
|
- (void) preventWindowOrdering
|
||||||
|
@ -1254,7 +1247,7 @@ BOOL done = NO;
|
||||||
windows_need_update = NO;
|
windows_need_update = NO;
|
||||||
// notify that an update is
|
// notify that an update is
|
||||||
// imminent
|
// imminent
|
||||||
[nc postNotificationName:NSApplicationWillUpdateNotification object: self];
|
[nc postNotificationName: NSApplicationWillUpdateNotification object: self];
|
||||||
|
|
||||||
for (i = 0, count = [window_list count]; i < count; i++)
|
for (i = 0, count = [window_list count]; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -1263,7 +1256,7 @@ BOOL done = NO;
|
||||||
[win update]; // window is visible
|
[win update]; // window is visible
|
||||||
}
|
}
|
||||||
// notify update did occur
|
// notify update did occur
|
||||||
[nc postNotificationName:NSApplicationDidUpdateNotification object:self];
|
[nc postNotificationName: NSApplicationDidUpdateNotification object: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray*) windows
|
- (NSArray*) windows
|
||||||
|
@ -1272,7 +1265,7 @@ BOOL done = NO;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSWindow *)windowWithWindowNumber:(int)windowNum
|
- (NSWindow *) windowWithWindowNumber: (int)windowNum
|
||||||
{
|
{
|
||||||
NSArray *window_list = [self windows];
|
NSArray *window_list = [self windows];
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
|
@ -1292,19 +1285,19 @@ BOOL done = NO;
|
||||||
//
|
//
|
||||||
// Showing Standard Panels
|
// Showing Standard Panels
|
||||||
//
|
//
|
||||||
- (void)orderFrontColorPanel:sender
|
- (void) orderFrontColorPanel: sender
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)orderFrontDataLinkPanel:sender
|
- (void) orderFrontDataLinkPanel: sender
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)orderFrontHelpPanel:sender
|
- (void) orderFrontHelpPanel: sender
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)runPageLayout:sender
|
- (void) runPageLayout: sender
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,7 +1325,7 @@ BOOL done = NO;
|
||||||
windows_menu = nil; // this is the default
|
windows_menu = nil; // this is the default
|
||||||
for (i = 0; i < j; ++i) // windows menu
|
for (i = 0; i < j; ++i) // windows menu
|
||||||
{
|
{
|
||||||
mc = [mi objectAtIndex:i];
|
mc = [mi objectAtIndex: i];
|
||||||
if ([[mc stringValue] compare: @"Windows"] == NSOrderedSame)
|
if ([[mc stringValue] compare: @"Windows"] == NSOrderedSame)
|
||||||
{
|
{
|
||||||
windows_menu = mc; // Found it!
|
windows_menu = mc; // Found it!
|
||||||
|
@ -1413,8 +1406,8 @@ BOOL done = NO;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we insert a menu item for the window in the correct order.
|
* Now we insert a menu item for the window in the correct order.
|
||||||
* Make special allowance for menu entries to 'arrangeInFront:'
|
* Make special allowance for menu entries to 'arrangeInFront: '
|
||||||
* 'performMiniaturize:' and 'preformClose:'. If these exist the
|
* 'performMiniaturize: ' and 'preformClose: '. If these exist the
|
||||||
* window entries should stay after the first one and before the
|
* window entries should stay after the first one and before the
|
||||||
* other two.
|
* other two.
|
||||||
*/
|
*/
|
||||||
|
@ -1516,7 +1509,7 @@ BOOL done = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now use [-changeWindowsItem:title:filename:] to build the new menu.
|
* Now use [-changeWindowsItem: title: filename: ] to build the new menu.
|
||||||
*/
|
*/
|
||||||
[main_menu setSubmenu: aMenu forItem: (id<NSMenuItem>)windows_menu];
|
[main_menu setSubmenu: aMenu forItem: (id<NSMenuItem>)windows_menu];
|
||||||
while ((win = [windows lastObject]) != nil)
|
while ((win = [windows lastObject]) != nil)
|
||||||
|
@ -1641,7 +1634,7 @@ BOOL done = NO;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSGraphicsContext *)context // return the current draw
|
- (NSGraphicsContext *) context // return the current draw
|
||||||
{ // context (drawing dest)
|
{ // context (drawing dest)
|
||||||
return [NSGraphicsContext currentContext];
|
return [NSGraphicsContext currentContext];
|
||||||
}
|
}
|
||||||
|
@ -1678,10 +1671,10 @@ BOOL done = NO;
|
||||||
delegate = anObject;
|
delegate = anObject;
|
||||||
|
|
||||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||||
if ([delegate respondsToSelector:@selector(application##notif_name:)]) \
|
if ([delegate respondsToSelector: @selector(application##notif_name:)]) \
|
||||||
[nc addObserver:delegate \
|
[nc addObserver: delegate \
|
||||||
selector:@selector(application##notif_name:) \
|
selector: @selector(application##notif_name:) \
|
||||||
name:NSApplication##notif_name##Notification object:self]
|
name: NSApplication##notif_name##Notification object: self]
|
||||||
|
|
||||||
SET_DELEGATE_NOTIFICATION(DidBecomeActive);
|
SET_DELEGATE_NOTIFICATION(DidBecomeActive);
|
||||||
SET_DELEGATE_NOTIFICATION(DidFinishLaunching);
|
SET_DELEGATE_NOTIFICATION(DidFinishLaunching);
|
||||||
|
@ -1700,126 +1693,126 @@ BOOL done = NO;
|
||||||
//
|
//
|
||||||
// Implemented by the delegate
|
// Implemented by the delegate
|
||||||
//
|
//
|
||||||
- (BOOL)application:sender openFileWithoutUI:(NSString *)filename
|
- (BOOL) application: sender openFileWithoutUI: (NSString *)filename
|
||||||
{
|
{
|
||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
|
|
||||||
if ([delegate respondsToSelector:@selector(application:openFileWithoutUI:)])
|
if ([delegate respondsToSelector: @selector(application:openFileWithoutUI:)])
|
||||||
result = [delegate application:sender openFileWithoutUI:filename];
|
result = [delegate application: sender openFileWithoutUI: filename];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)application:(NSApplication *)app openFile:(NSString *)filename
|
- (BOOL) application: (NSApplication *)app openFile: (NSString *)filename
|
||||||
{
|
{
|
||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
|
|
||||||
if ([delegate respondsToSelector:@selector(application:openFile:)])
|
if ([delegate respondsToSelector: @selector(application:openFile:)])
|
||||||
result = [delegate application:app openFile:filename];
|
result = [delegate application: app openFile: filename];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)application:(NSApplication *)app openTempFile:(NSString *)filename
|
- (BOOL) application: (NSApplication *)app openTempFile: (NSString *)filename
|
||||||
{
|
{
|
||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
|
|
||||||
if ([delegate respondsToSelector:@selector(application:openTempFile:)])
|
if ([delegate respondsToSelector: @selector(application:openTempFile:)])
|
||||||
result = [delegate application:app openTempFile:filename];
|
result = [delegate application: app openTempFile: filename];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
|
- (void) applicationDidBecomeActive: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationDidBecomeActive:)])
|
if ([delegate respondsToSelector: @selector(applicationDidBecomeActive:)])
|
||||||
[delegate applicationDidBecomeActive:aNotification];
|
[delegate applicationDidBecomeActive: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
- (void) applicationDidFinishLaunching: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationDidFinishLaunching:)])
|
if ([delegate respondsToSelector: @selector(applicationDidFinishLaunching:)])
|
||||||
[delegate applicationDidFinishLaunching:aNotification];
|
[delegate applicationDidFinishLaunching: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidHide:(NSNotification *)aNotification
|
- (void) applicationDidHide: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationDidHide:)])
|
if ([delegate respondsToSelector: @selector(applicationDidHide:)])
|
||||||
[delegate applicationDidHide:aNotification];
|
[delegate applicationDidHide: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidResignActive:(NSNotification *)aNotification
|
- (void) applicationDidResignActive: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationDidResignActive:)])
|
if ([delegate respondsToSelector: @selector(applicationDidResignActive:)])
|
||||||
[delegate applicationDidResignActive:aNotification];
|
[delegate applicationDidResignActive: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidUnhide:(NSNotification *)aNotification
|
- (void) applicationDidUnhide: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationDidUnhide:)])
|
if ([delegate respondsToSelector: @selector(applicationDidUnhide:)])
|
||||||
[delegate applicationDidUnhide:aNotification];
|
[delegate applicationDidUnhide: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidUpdate:(NSNotification *)aNotification
|
- (void) applicationDidUpdate: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationDidUpdate:)])
|
if ([delegate respondsToSelector: @selector(applicationDidUpdate:)])
|
||||||
[delegate applicationDidUpdate:aNotification];
|
[delegate applicationDidUpdate: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)applicationOpenUntitledFile:(NSApplication *)app
|
- (BOOL) applicationOpenUntitledFile: (NSApplication *)app
|
||||||
{
|
{
|
||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
|
|
||||||
if ([delegate respondsToSelector:@selector(applicationOpenUntitledFile:)])
|
if ([delegate respondsToSelector: @selector(applicationOpenUntitledFile:)])
|
||||||
result = [delegate applicationOpenUntitledFile:app];
|
result = [delegate applicationOpenUntitledFile: app];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)applicationShouldTerminate:sender
|
- (BOOL) applicationShouldTerminate: sender
|
||||||
{
|
{
|
||||||
BOOL result = YES;
|
BOOL result = YES;
|
||||||
|
|
||||||
if ([delegate respondsToSelector:@selector(applicationShouldTerminate:)])
|
if ([delegate respondsToSelector: @selector(applicationShouldTerminate:)])
|
||||||
result = [delegate applicationShouldTerminate:sender];
|
result = [delegate applicationShouldTerminate: sender];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
|
- (void) applicationWillBecomeActive: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationWillBecomeActive:)])
|
if ([delegate respondsToSelector: @selector(applicationWillBecomeActive:)])
|
||||||
[delegate applicationWillBecomeActive:aNotification];
|
[delegate applicationWillBecomeActive: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
|
- (void) applicationWillFinishLaunching: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationWillFinishLaunching:)])
|
if ([delegate respondsToSelector: @selector(applicationWillFinishLaunching:)])
|
||||||
[delegate applicationWillFinishLaunching:aNotification];
|
[delegate applicationWillFinishLaunching: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillHide:(NSNotification *)aNotification
|
- (void) applicationWillHide: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationWillHide:)])
|
if ([delegate respondsToSelector: @selector(applicationWillHide:)])
|
||||||
[delegate applicationWillHide:aNotification];
|
[delegate applicationWillHide: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillResignActive:(NSNotification *)aNotification
|
- (void) applicationWillResignActive: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationWillResignActive:)])
|
if ([delegate respondsToSelector: @selector(applicationWillResignActive:)])
|
||||||
[delegate applicationWillResignActive:aNotification];
|
[delegate applicationWillResignActive: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillUnhide:(NSNotification *)aNotification
|
- (void) applicationWillUnhide: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationWillUnhide:)])
|
if ([delegate respondsToSelector: @selector(applicationWillUnhide:)])
|
||||||
[delegate applicationWillUnhide:aNotification];
|
[delegate applicationWillUnhide: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillUpdate:(NSNotification *)aNotification
|
- (void) applicationWillUpdate: (NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector:@selector(applicationWillUpdate:)])
|
if ([delegate respondsToSelector: @selector(applicationWillUpdate:)])
|
||||||
[delegate applicationWillUpdate:aNotification];
|
[delegate applicationWillUpdate: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1849,21 +1842,21 @@ BOOL result = YES;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)setNullEvent:(NSEvent *)e
|
+ (void) setNullEvent: (NSEvent *)e
|
||||||
{
|
{
|
||||||
ASSIGN(null_event, e);
|
ASSIGN(null_event, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSEvent *)getNullEvent;
|
+ (NSEvent *) getNullEvent;
|
||||||
{ // return the class
|
{ // return the class
|
||||||
return null_event; // dummy event
|
return null_event; // dummy event
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_nextEvent // get next event
|
- (void) _nextEvent // get next event
|
||||||
{ // implemented in
|
{ // implemented in
|
||||||
} // backend
|
} // backend
|
||||||
|
|
||||||
- (void)setupRunLoopInputSourcesForMode:(NSString*)mode
|
- (void) setupRunLoopInputSourcesForMode: (NSString*)mode
|
||||||
{ // implemented in
|
{ // implemented in
|
||||||
} // backend
|
} // backend
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue