mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +00:00
Tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4392 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
82e0f3f712
commit
8aba8fdfb4
1 changed files with 277 additions and 273 deletions
|
@ -64,18 +64,18 @@
|
|||
#include <AppKit/IMLoading.h>
|
||||
#include <AppKit/DPSOperators.h>
|
||||
|
||||
//
|
||||
// Types
|
||||
//
|
||||
/*
|
||||
* Types
|
||||
*/
|
||||
struct _NSModalSession {
|
||||
int runState;
|
||||
NSWindow *window;
|
||||
NSModalSession previous;
|
||||
};
|
||||
|
||||
//
|
||||
// Class variables
|
||||
//
|
||||
/*
|
||||
* Class variables
|
||||
*/
|
||||
static BOOL gnustep_gui_app_is_in_dealloc;
|
||||
static NSEvent *null_event;
|
||||
static NSString *NSAbortModalException = @"NSAbortModalException";
|
||||
|
@ -84,9 +84,9 @@ NSApplication *NSApp = nil;
|
|||
|
||||
@implementation NSApplication
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSApplication class])
|
||||
|
@ -111,19 +111,24 @@ NSApplication *NSApp = nil;
|
|||
}
|
||||
|
||||
+ (NSApplication *) sharedApplication
|
||||
{ // If the global application does
|
||||
if (!NSApp) // not yet exist then create it
|
||||
{
|
||||
NSApp = [self alloc]; // Don't combine the following two
|
||||
[NSApp init]; // statements into one to avoid
|
||||
} // problems with some classes'
|
||||
// initialization code that tries
|
||||
return NSApp; // to get the shared application.
|
||||
/* If the global application does not yet exist then create it */
|
||||
if (!NSApp)
|
||||
{
|
||||
/*
|
||||
* Don't combine the following two statements into one to avoid
|
||||
* problems with some classes' initialization code that tries
|
||||
* to get the shared application.
|
||||
*/
|
||||
NSApp = [self alloc];
|
||||
[NSApp init];
|
||||
}
|
||||
return NSApp;
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
- (id) init
|
||||
{
|
||||
if (NSApp != self)
|
||||
|
@ -226,9 +231,9 @@ NSApplication *NSApp = nil;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
//
|
||||
// Changing the active application
|
||||
//
|
||||
/*
|
||||
* Changing the active application
|
||||
*/
|
||||
- (void) activateIgnoringOtherApps: (BOOL)flag
|
||||
{
|
||||
if (app_is_active == NO)
|
||||
|
@ -278,9 +283,9 @@ NSApplication *NSApp = nil;
|
|||
return app_is_active;
|
||||
}
|
||||
|
||||
//
|
||||
// Running the main event loop
|
||||
//
|
||||
/*
|
||||
* Running the main event loop
|
||||
*/
|
||||
- (void) run
|
||||
{
|
||||
NSEvent *e;
|
||||
|
@ -331,9 +336,9 @@ NSApplication *NSApp = nil;
|
|||
return app_is_running;
|
||||
}
|
||||
|
||||
//
|
||||
// Running modal event loops
|
||||
//
|
||||
/*
|
||||
* Running modal event loops
|
||||
*/
|
||||
- (void) abortModal
|
||||
{
|
||||
if (session == 0)
|
||||
|
@ -365,8 +370,7 @@ NSApplication *NSApp = nil;
|
|||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"null pointer passed to endModalSession: "];
|
||||
|
||||
// Remove this session from
|
||||
// linked list of sessions.
|
||||
/* Remove this session from linked list of sessions. */
|
||||
while (tmp && tmp != theSession)
|
||||
tmp = tmp->previous;
|
||||
|
||||
|
@ -524,9 +528,9 @@ NSApplication *NSApp = nil;
|
|||
session->runState = returnCode;
|
||||
}
|
||||
|
||||
//
|
||||
// Getting, removing, and posting events
|
||||
//
|
||||
/*
|
||||
* Getting, removing, and posting events
|
||||
*/
|
||||
- (void) sendEvent: (NSEvent *)theEvent
|
||||
{
|
||||
if (theEvent == null_event)
|
||||
|
@ -575,8 +579,8 @@ NSApplication *NSApp = nil;
|
|||
static NSMenu *copyOfMainMenu = nil;
|
||||
NSWindow *copyMenuWindow;
|
||||
|
||||
if (!copyOfMainMenu) // display the menu
|
||||
copyOfMainMenu = [main_menu copy]; // under the mouse
|
||||
if (!copyOfMainMenu) /* display the menu under the mouse */
|
||||
copyOfMainMenu = [main_menu copy];
|
||||
copyMenuWindow = [copyOfMainMenu menuWindow];
|
||||
[copyOfMainMenu _rightMouseDisplay];
|
||||
[copyMenuWindow _captureMouse: self];
|
||||
|
@ -659,9 +663,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
DPSPostEvent(GSCurrentContext(), event, flag);
|
||||
}
|
||||
|
||||
//
|
||||
// Sending action messages
|
||||
//
|
||||
/*
|
||||
* Sending action messages
|
||||
*/
|
||||
- (BOOL) sendAction: (SEL)aSelector to: aTarget from: sender
|
||||
{
|
||||
/*
|
||||
|
@ -775,9 +779,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
return app_icon;
|
||||
}
|
||||
|
||||
//
|
||||
// Hiding and arranging windows
|
||||
//
|
||||
/*
|
||||
* Hiding and arranging windows
|
||||
*/
|
||||
- (void) hide: (id)sender
|
||||
{
|
||||
if (app_is_hidden == NO)
|
||||
|
@ -882,7 +886,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
}
|
||||
}
|
||||
|
||||
- (void) arrangeInFront: (id)sender // preliminary FIX ME
|
||||
- (void) arrangeInFront: (id)sender
|
||||
{
|
||||
NSMenu *menu;
|
||||
|
||||
|
@ -907,9 +911,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Managing windows
|
||||
//
|
||||
/*
|
||||
* Managing windows
|
||||
*/
|
||||
- (NSWindow*) keyWindow
|
||||
{
|
||||
NSArray *window_list = [self windows];
|
||||
|
@ -1039,9 +1043,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// Showing Standard Panels
|
||||
//
|
||||
/*
|
||||
* Showing Standard Panels
|
||||
*/
|
||||
- (void) orderFrontColorPanel: sender
|
||||
{
|
||||
}
|
||||
|
@ -1058,9 +1062,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Getting the main menu
|
||||
//
|
||||
/*
|
||||
* Getting the main menu
|
||||
*/
|
||||
- (NSMenu*) mainMenu
|
||||
{
|
||||
return main_menu;
|
||||
|
@ -1085,15 +1089,15 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
mc = [mi objectAtIndex: i];
|
||||
if ([[mc stringValue] compare: @"Windows"] == NSOrderedSame)
|
||||
{
|
||||
windows_menu = mc; // Found it!
|
||||
windows_menu = mc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Managing the Windows menu
|
||||
//
|
||||
/*
|
||||
* Managing the Windows menu
|
||||
*/
|
||||
- (void) addWindowsItem: (NSWindow*)aWindow
|
||||
title: (NSString*)aString
|
||||
filename: (BOOL)isFilename
|
||||
|
@ -1355,9 +1359,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// Managing the Service menu
|
||||
//
|
||||
/*
|
||||
* Managing the Service menu
|
||||
*/
|
||||
- (void) registerServicesMenuSendTypes: (NSArray *)sendTypes
|
||||
returnTypes: (NSArray *)returnTypes
|
||||
{
|
||||
|
@ -1397,14 +1401,14 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
}
|
||||
|
||||
- (void) reportException: (NSException *)anException
|
||||
{ // Reporting an exception
|
||||
{
|
||||
if (anException)
|
||||
NSLog(@"reported exception - %@", anException);
|
||||
}
|
||||
|
||||
//
|
||||
// Terminating the application
|
||||
//
|
||||
/*
|
||||
* Terminating the application
|
||||
*/
|
||||
- (void) terminate: (id)sender
|
||||
{
|
||||
if ([self applicationShouldTerminate: self])
|
||||
|
@ -1418,7 +1422,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
}
|
||||
}
|
||||
|
||||
- (id) delegate // Assigning a delegate
|
||||
- (id) delegate
|
||||
{
|
||||
return delegate;
|
||||
}
|
||||
|
@ -1451,9 +1455,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
SET_DELEGATE_NOTIFICATION(WillUpdate);
|
||||
}
|
||||
|
||||
//
|
||||
// Implemented by the delegate
|
||||
//
|
||||
/*
|
||||
* Implemented by the delegate
|
||||
*/
|
||||
- (BOOL) application: sender openFileWithoutUI: (NSString *)filename
|
||||
{
|
||||
BOOL result = NO;
|
||||
|
@ -1576,9 +1580,9 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
[delegate applicationWillUpdate: aNotification];
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue