Tidied a little

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4356 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-06-04 14:02:18 +00:00
parent 986380a33f
commit 145d4fba64
2 changed files with 73 additions and 66 deletions

View file

@ -420,6 +420,7 @@ NSApplication *NSApp = nil;
- (int) runModalSession: (NSModalSession)theSession
{
NSAutoreleasePool *pool;
NSGraphicsContext *ctxt;
BOOL found = NO;
NSEvent *event;
@ -429,8 +430,7 @@ NSApplication *NSApp = nil;
[NSException raise: NSInvalidArgumentException
format: @"runModalSession: with wrong session"];
theSession->runState = NSRunContinuesResponse;
[theSession->window display];
pool = [NSAutoreleasePool new];
[theSession->window makeKeyAndOrderFront: self];
ctxt = GSCurrentContext();
@ -453,12 +453,13 @@ NSApplication *NSApp = nil;
}
while (found == NO && theSession->runState == NSRunContinuesResponse);
RELEASE(pool);
/*
* Deal with the events in the queue.
*/
while (found == YES && theSession->runState == NSRunContinuesResponse)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
pool = [NSAutoreleasePool new];
event = DPSGetEvent(ctxt, NSAnyEventMask, nil, NSDefaultRunLoopMode);
if (event != nil && [event window] == theSession->window)
@ -998,24 +999,22 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
windows_need_update = flag;
}
- (void) updateWindows // send an update message
{ // to all visible windows
int i, count;
- (void) updateWindows
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSArray *window_list = [self windows];
unsigned count = [window_list count];
unsigned i;
windows_need_update = NO;
// notify that an update is
// imminent
[nc postNotificationName: NSApplicationWillUpdateNotification object: self];
for (i = 0, count = [window_list count]; i < count; i++)
for (i = 0; i < count; i++)
{
NSWindow *win = [window_list objectAtIndex: i];
if ([win isVisible]) // send update only if the
[win update]; // window is visible
if ([win isVisible])
[win update];
}
// notify update did occur
[nc postNotificationName: NSApplicationDidUpdateNotification object: self];
}

View file

@ -1246,37 +1246,46 @@
- (NSString *)pathToColumn: (int)column
{
int i;
NSMutableString *s = [NSMutableString stringWithCString: ""];
NSMutableString *s = [_pathSeparator mutableCopy];
unsigned i;
// Cannot go past the number of loaded columns
/*
* Cannot go past the number of loaded columns
*/
if (column > _lastColumnLoaded)
column = _lastColumnLoaded + 1;
[s appendString: _pathSeparator];
for (i = 0;i < column; ++i)
{
id c = [self selectedCellInColumn: i];
if (i != 0)
[s appendString: _pathSeparator];
[s appendString: [c stringValue]];
}
return [[[NSString alloc] initWithString: s] autorelease];
/*
* We actually return a mutable string, but that's ok since a mutable
* string is a string and the documentation specifically says that
* people should not depend on methods that return strings to return
* immutable strings.
*/
return s;
}
- (BOOL) setPath: (NSString *)path
{
NSArray *subStrings = [path componentsSeparatedByString:_pathSeparator];
unsigned numberOfSubStrings, i;
NSArray *subStrings;
NSString *aStr;
unsigned numberOfSubStrings;
unsigned i;
subStrings = [path componentsSeparatedByString: _pathSeparator];
[self setLastColumn: 0];
numberOfSubStrings = [subStrings count];
if (numberOfSubStrings <= 2)
if (numberOfSubStrings == 2)
{
// select root path
/* select root path *.
if ([[subStrings objectAtIndex: 1] length] == 0)
{
[self scrollColumnsLeftBy: [_browserColumns count]];
@ -1539,17 +1548,16 @@
}
else
{
// If it is not visible
NSBrowserColumn *bc = [_browserColumns objectAtIndex: i];
id sc = [bc columnScrollView];
// Remove it from its superview if it has one
if (sc)
{
if ([sc superview])
{
NSLog(@"before: %d\n", [sc retainCount]);
[sc removeFromSuperview];
NSLog(@"after: %d\n", [sc retainCount]);
}
}
}
}