mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:00:48 +00:00
Reinstate changes to NSWindow.m to keep it working.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3480 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ed8cb51bc9
commit
582f5f44ad
2 changed files with 671 additions and 658 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Dec 17 13:20:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* NSWindow.m: Reinstated changes lost in last update (to fix
|
||||
recursion problem on menu creation) and added acceptsFirstResponder.
|
||||
|
||||
Wed Dec 16 1998 Felipe A. Rodriguez <far@ix.netcom.com>
|
||||
|
||||
* NSWindow.m acceptsFirstResponder implement.
|
||||
|
|
|
@ -130,7 +130,7 @@ int style;
|
|||
[content_view release]; // Release the content view
|
||||
}
|
||||
|
||||
if(_fieldEditor)
|
||||
if (_fieldEditor)
|
||||
[_fieldEditor release];
|
||||
[background_color release];
|
||||
[represented_filename release];
|
||||
|
@ -192,9 +192,9 @@ NSRect cframe;
|
|||
cframe.origin = NSZeroPoint; // Create the content view
|
||||
cframe.size = frame.size;
|
||||
[self setContentView:[[[NSView alloc] initWithFrame:cframe] autorelease]];
|
||||
// Register ourselves with
|
||||
// the Application object
|
||||
[theApp addWindowsItem:self title:window_title filename:NO];
|
||||
|
||||
|
||||
[theApp addWindowsItem: self title: nil filename: NO];
|
||||
|
||||
_flushRectangles = [[NSMutableArray alloc] initWithCapacity:10];
|
||||
|
||||
|
@ -247,17 +247,21 @@ NSView *wv;
|
|||
ASSIGN(background_color, color);
|
||||
}
|
||||
|
||||
- (void)setRepresentedFilename:(NSString *)aString
|
||||
- (void) setRepresentedFilename: (NSString*)aString
|
||||
{
|
||||
ASSIGN(represented_filename, aString);
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)aString { ASSIGN(window_title,aString); }
|
||||
|
||||
- (void)setTitleWithRepresentedFilename:(NSString *)aString
|
||||
- (void) setTitle: (NSString*)aString
|
||||
{
|
||||
[self setRepresentedFilename:aString];
|
||||
[self setTitle:aString];
|
||||
ASSIGN(window_title, aString);
|
||||
[self setMiniwindowTitle: aString];
|
||||
}
|
||||
|
||||
- (void) setTitleWithRepresentedFilename: (NSString*)aString
|
||||
{
|
||||
[self setRepresentedFilename: aString];
|
||||
[self setTitle: aString];
|
||||
}
|
||||
|
||||
- (unsigned int)styleMask { return style_mask; }
|
||||
|
@ -291,16 +295,15 @@ NSView *wv;
|
|||
ASSIGN(miniaturized_image, image);
|
||||
}
|
||||
|
||||
- (void)setMiniwindowTitle:(NSString *)title;
|
||||
- (void) setMiniwindowTitle: (NSString*)title
|
||||
{
|
||||
BOOL isDoc = NO;
|
||||
BOOL isDoc = NO;
|
||||
|
||||
ASSIGN(miniaturized_title, title);
|
||||
if (is_miniaturized == NO)
|
||||
title = window_title;
|
||||
if ([title isEqual: represented_filename])
|
||||
isDoc = YES;
|
||||
|
||||
[[NSApplication sharedApplication] changeWindowsItem: self
|
||||
title: title
|
||||
filename: isDoc];
|
||||
|
@ -503,7 +506,6 @@ NSPoint basePoint;
|
|||
visible = YES;
|
||||
needs_display = NO; // inform first responder
|
||||
// of it's status so it can
|
||||
if(first_responder)
|
||||
[first_responder becomeFirstResponder]; // set the focus to itself
|
||||
|
||||
[self disableFlushWindow]; // tmp disable display
|
||||
|
@ -526,7 +528,7 @@ if(first_responder)
|
|||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if(is_autodisplay && needs_display) // if autodisplay is
|
||||
if (is_autodisplay && needs_display) // if autodisplay is
|
||||
{ // enabled and window
|
||||
[self displayIfNeeded]; // display
|
||||
[self flushWindowIfNeeded];
|
||||
|
@ -623,25 +625,26 @@ NSView *v;
|
|||
//
|
||||
// Handling user actions and events
|
||||
//
|
||||
- (void)close
|
||||
- (void) close
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
// Notify delegate
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
|
||||
/*
|
||||
* If 'is_released_when_closed' then the window will be removed from the
|
||||
* applications list of windows (causing it to be released) - so we must
|
||||
* bracket any work we do in a retain/release sequence.
|
||||
*/
|
||||
if (is_released_when_closed)
|
||||
[self retain];
|
||||
|
||||
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
||||
[self orderOut:self];
|
||||
[theApp removeWindowsItem: self];
|
||||
[self orderOut: self];
|
||||
visible = NO;
|
||||
// if app has no
|
||||
if(![theApp mainMenu]) // menu terminate
|
||||
[theApp terminate:self];
|
||||
else
|
||||
{ // else if should
|
||||
if (is_released_when_closed) // release do so
|
||||
{ // default is YES
|
||||
[theApp removeWindowsItem: self]; // for windows and
|
||||
[self autorelease]; // NO for panels
|
||||
}
|
||||
}
|
||||
|
||||
if (is_released_when_closed)
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void)deminiaturize:sender
|
||||
|
@ -672,7 +675,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|||
|
||||
- (void)performClose:sender
|
||||
{
|
||||
if(!([self styleMask] & NSClosableWindowMask))
|
||||
if (!([self styleMask] & NSClosableWindowMask))
|
||||
{ // self must have a close
|
||||
NSBeep(); // button in order to be
|
||||
return; // closed
|
||||
|
@ -680,7 +683,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|||
|
||||
if ([delegate respondsToSelector:@selector(windowShouldClose:)])
|
||||
{ // if delegate responds to
|
||||
if(![delegate windowShouldClose:self]) // windowShouldClose query
|
||||
if (![delegate windowShouldClose:self]) // windowShouldClose query
|
||||
{ // it to see if it's ok to
|
||||
NSBeep(); // close the window
|
||||
return;
|
||||
|
@ -690,7 +693,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|||
{
|
||||
if ([self respondsToSelector:@selector(windowShouldClose:)])
|
||||
{ // else if self responds to
|
||||
if(![self windowShouldClose:self]) // windowShouldClose query
|
||||
if (![self windowShouldClose:self]) // windowShouldClose query
|
||||
{ // self to see if it's ok
|
||||
NSBeep(); // to close self
|
||||
return;
|
||||
|
@ -721,17 +724,17 @@ NSApplication *theApp = [NSApplication sharedApplication];
|
|||
[theApp discardEventsMatchingMask:mask beforeEvent:lastEvent];
|
||||
}
|
||||
|
||||
- (NSResponder *)firstResponder { return first_responder; }
|
||||
- (BOOL)acceptsFirstResponder { return YES; }
|
||||
- (NSResponder*) firstResponder
|
||||
{
|
||||
return first_responder;
|
||||
}
|
||||
|
||||
- (void)keyDown:(NSEvent *)theEvent // save the first responder
|
||||
{ // so that the key up goes
|
||||
original_responder = first_responder; // to it and not a possible
|
||||
// new first responder
|
||||
[first_responder keyDown:theEvent]; // Send the first responder
|
||||
} // the key down
|
||||
- (BOOL) acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)makeFirstResponder:(NSResponder *)aResponder
|
||||
- (BOOL) makeFirstResponder: (NSResponder*)aResponder
|
||||
{
|
||||
if (first_responder == aResponder) // if responder is already
|
||||
return YES; // first responder return Y
|
||||
|
@ -919,7 +922,7 @@ NSView *v;
|
|||
v = [content_view hitTest:[theEvent locationInWindow]];
|
||||
NSDebugLog([v description]);
|
||||
NSDebugLog(@"\n");
|
||||
if(first_responder != v) // if hit view is not first
|
||||
if (first_responder != v) // if hit view is not first
|
||||
[self makeFirstResponder:v]; // responder ask it to be
|
||||
[v mouseDown:theEvent];
|
||||
last_point = [theEvent locationInWindow];
|
||||
|
@ -972,8 +975,13 @@ NSView *v;
|
|||
case NSMouseExited: // Mouse exited
|
||||
break;
|
||||
|
||||
case NSKeyDown: // Key down
|
||||
[self keyDown:theEvent];
|
||||
case NSKeyDown:
|
||||
/*
|
||||
* Save the first responder so that the key up goes to it and not a
|
||||
* possible new first responder.
|
||||
*/
|
||||
original_responder = first_responder;
|
||||
[first_responder keyDown: theEvent];
|
||||
break;
|
||||
|
||||
case NSKeyUp: // Key up
|
||||
|
@ -1309,7 +1317,7 @@ id result = nil;
|
|||
// +++ we shouldn't do this because coding may not be done?
|
||||
// better to do it in the awakeFromCoder method
|
||||
theApp = [NSApplication sharedApplication];
|
||||
[theApp addWindowsItem:self title:nil filename:NO];
|
||||
[theApp addWindowsItem: self title: nil filename: NO];
|
||||
NSDebugLog(@"NSWindow: finish decoding\n");
|
||||
|
||||
return self;
|
||||
|
@ -1362,7 +1370,7 @@ id result = nil;
|
|||
is_key = NO;
|
||||
is_main = NO;
|
||||
is_edited = NO;
|
||||
is_released_when_closed = NO;
|
||||
is_released_when_closed = YES;
|
||||
is_miniaturized = NO;
|
||||
disable_flush_window = NO;
|
||||
menu_exclude = NO;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue