More windows menu fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5370 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-12-03 11:32:39 +00:00
parent 2243389ba2
commit 61e1bfe8af
2 changed files with 37 additions and 21 deletions

View file

@ -1672,6 +1672,16 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"Object of bad type passed as window"]; format: @"Object of bad type passed as window"];
if (isFilename)
{
NSRange r = [aString rangeOfString: @" -- "];
if (r.length > 0)
{
aString = [aString substringToIndex: r.location];
}
}
/* /*
* Can't permit an untitled window in the window menu. * Can't permit an untitled window in the window menu.
*/ */

View file

@ -395,27 +395,43 @@ static NSMapTable* windowmaps = NULL;
- (void) setRepresentedFilename: (NSString*)aString - (void) setRepresentedFilename: (NSString*)aString
{ {
id old = represented_filename;
BOOL changed = (_f.menu_exclude == NO && [aString isEqual: old] == NO);
ASSIGN(represented_filename, aString); ASSIGN(represented_filename, aString);
if (changed)
{
[NSApp updateWindowsItem: self];
}
} }
- (void) setTitle: (NSString*)aString - (void) setTitle: (NSString*)aString
{ {
ASSIGN(window_title, aString); if ([window_title isEqual: aString] == NO)
DPStitlewindow(GSCurrentContext(), [window_title cString], window_num); {
[self setMiniwindowTitle: aString]; ASSIGN(window_title, aString);
[self setMiniwindowTitle: aString];
DPStitlewindow(GSCurrentContext(), [aString cString], window_num);
if (_f.menu_exclude == NO)
{
[NSApp changeWindowsItem: self
title: aString
filename: NO];
}
}
} }
- (void) setTitleWithRepresentedFilename: (NSString*)aString - (void) setTitleWithRepresentedFilename: (NSString*)aString
{ {
[self setRepresentedFilename: aString]; [self setRepresentedFilename: aString];
[self setTitle: aString]; aString = [NSString stringWithFormat:
@"%@ -- %@", [aString lastPathComponent],
[aString stringByDeletingLastPathComponent]];
if ([window_title isEqual: aString] == NO)
{
ASSIGN(window_title, aString);
[self setMiniwindowTitle: aString];
DPStitlewindow(GSCurrentContext(), [aString cString], window_num);
if (_f.menu_exclude == NO)
{
[NSApp changeWindowsItem: self
title: aString
filename: YES];
}
}
} }
- (unsigned int) styleMask - (unsigned int) styleMask
@ -486,17 +502,7 @@ static NSMapTable* windowmaps = NULL;
- (void) setMiniwindowTitle: (NSString*)title - (void) setMiniwindowTitle: (NSString*)title
{ {
BOOL isDoc = NO;
ASSIGN(miniaturized_title, title); ASSIGN(miniaturized_title, title);
if (_f.is_miniaturized == NO)
title = window_title;
if ([title isEqual: represented_filename])
isDoc = YES;
if (_f.menu_exclude == NO)
[NSApp changeWindowsItem: self
title: title
filename: isDoc];
} }
/* /*