* NSMenu.m->NSMenuMatrix in insertItemWithTitle: removed call to

_resizeMenuForCellSize for performance reasons.  _resizeMenuForCellSize
		is called later on a sizeToFit.
	* NSMenu.m->NSMenuMatrix in removeItem: removed call to
		_resizeMenuForCellSize for performance reasons.  _resizeMenuForCellSize
		is called later on a sizeToFit.
	* NSMenu.m->NSMenu in insertItemWithTitle: replaced call to _menuChanged
		with menuHasChanged=YES for performance reasons.
	* NSMenu.m->NSMenu in removeItem: replaced call to _menuChanged with
		menuHasChanged=YES for performance reasons.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2973 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
far 1998-09-08 21:50:33 +00:00
parent e77403ce70
commit 24eac4c538
5 changed files with 66 additions and 53 deletions

View file

@ -1,3 +1,16 @@
Tue Sep 8 1998 Felipe A. Rodriguez <far@ix.netcom.com>
* NSMenu.m->NSMenuMatrix in insertItemWithTitle: removed call to
_resizeMenuForCellSize for performance reasons. _resizeMenuForCellSize
is called later on a sizeToFit.
* NSMenu.m->NSMenuMatrix in removeItem: removed call to
_resizeMenuForCellSize for performance reasons. _resizeMenuForCellSize
is called later on a sizeToFit.
* NSMenu.m->NSMenu in insertItemWithTitle: replaced call to _menuChanged
with menuHasChanged=YES for performance reasons.
* NSMenu.m->NSMenu in removeItem: replaced call to _menuChanged with
menuHasChanged=YES for performance reasons.
Tue Sep 8 16:30:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk> Tue Sep 8 16:30:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSScroller.m: Minor efficiency hacks (inspired by xraw) plus * Source/NSScroller.m: Minor efficiency hacks (inspired by xraw) plus

View file

@ -36,25 +36,28 @@
// global NSString attribute names used in ascessing // global NSString attribute names used in ascessing
// the respective property in a text attributes // the respective property in a text attributes
// dictionary. if the key is not in the dictionary the // dictionary. if the key is not in the dictionary
// default value is assumed // the default value is assumed
extern NSString *NSFontAttributeName; // NSFont, defaults to Helvetica 12 extern NSString *NSFontAttributeName; // NSFont, Helvetica 12
// NSParagraphStyle, default is defaultParagraphStyle extern NSString *NSParagraphStyleAttributeName; // defaultParagraphStyle
extern NSString *NSParagraphStyleAttributeName; extern NSString *NSForegroundColorAttributeName; // NSColor, blackColor
// NSColor, default is blackColor extern NSString *NSUnderlineStyleAttributeName; // NSNumber int, 0 no line
extern NSString *NSForegroundColorAttributeName; extern NSString *NSSuperscriptAttributeName; // NSNumber int, 0
// int, default 0 = no underline extern NSString *NSBackgroundColorAttributeName; // NSColor, nil
extern NSString *NSUnderlineStyleAttributeName; extern NSString *NSAttachmentAttributeName; // NSTextAttachment, nil
extern NSString *NSSuperscriptAttributeName; // int, default 0 extern NSString *NSLigatureAttributeName; // NSNumber int, 1
// NSColor, default nil = no background color extern NSString *NSBaselineOffsetAttributeName; // NSNumber float, 0 points
extern NSString *NSBackgroundColorAttributeName; extern NSString *NSKernAttributeName; // NSNumber float, 0
extern NSString *NSAttachmentAttributeName; // NSTextAttachment, default nil //
// int, default 1, 0 = no ligatures, 2 = all ligatures // Extended definitions:
extern NSString *NSLigatureAttributeName; //
extern NSString *NSBaselineOffsetAttributeName; // float, default 0 in points; // NSParagraphStyleAttributeName NSParagraphStyle, default is
// float, offset from baseline, // defaultParagraphStyle
extern NSString *NSKernAttributeName; // amount to modify default //
// kerning, if 0 kerning is off // NSKernAttributeName NSNumber float, offset from
// baseline, amount tomodify default
// kerning, if 0 kerning is off
enum enum
{ // Currently supported values for { // Currently supported values for
NSSingleUnderlineStyle = 1 // NSUnderlineStyleAttributeName NSSingleUnderlineStyle = 1 // NSUnderlineStyleAttributeName

View file

@ -37,26 +37,24 @@
// //
// Initialization // Initialization
// //
// Init instance of directory type - (id)initDirectoryWithFileWrappers:(NSDictionary *)docs // Init instance of
- (id)initDirectoryWithFileWrappers:(NSDictionary *)docs { // directory type
{
return nil; return nil;
} }
// Init instance of regular file type
- (id)initRegularFileWithContents:(NSData *)data - (id)initRegularFileWithContents:(NSData *)data // Init instance of
{ { // regular file type
return nil; return nil;
} }
// Init instance of symbolic link type
- (id)initSymbolicLinkWithDestination:(NSString *)path - (id)initSymbolicLinkWithDestination:(NSString *)path // Init instance of
{ { // symbolic link type
return nil; return nil;
} }
// Init an instance from the file, // Init an instance from the file,
// directory, or symbolic link at path. // directory, or symbolic link at path.
// This can create a tree of instances - (id)initWithPath:(NSString *)path // This can create a tree of instances
- (id)initWithPath:(NSString *)path // with a directory instance at the top { // with a directory instance at the top
{
return nil; return nil;
} }
// Init an instance from data in std // Init an instance from data in std

View file

@ -901,7 +901,7 @@ fprintf(stderr, " NSMatrix: selectText --- ");
- (id)selectTextAtRow:(int)row column:(int)column - (id)selectTextAtRow:(int)row column:(int)column
{ {
// TODO // TODO
NSCell* aCell = [self cellAtRow:row column:column]; // NSCell* aCell = [self cellAtRow:row column:column];
fprintf(stderr, " NSMatrix: selectTextAtRow --- "); fprintf(stderr, " NSMatrix: selectTextAtRow --- ");
@ -1164,7 +1164,7 @@ static MPoint anchor = {0, 0};
[NSEvent startPeriodicEventsAfterDelay:0.05 withPeriod:0.05]; [NSEvent startPeriodicEventsAfterDelay:0.05 withPeriod:0.05];
ASSIGN(lastEvent, theEvent); ASSIGN(lastEvent, theEvent);
[[self window] captureMouse: self]; // grab the mouse [window captureMouse: self]; // grab the mouse
[self lockFocus]; // selection involves two steps, first [self lockFocus]; // selection involves two steps, first
// a loop that continues until the left // a loop that continues until the left
while (!done) // mouse goes up; then a series of while (!done) // mouse goes up; then a series of
@ -1324,7 +1324,7 @@ static MPoint anchor = {0, 0};
lastLocation = [self convertPoint:lastLocation fromView:nil]; lastLocation = [self convertPoint:lastLocation fromView:nil];
} }
[[self window] releaseMouse: self]; // Release the mouse [window releaseMouse: self]; // Release the mouse
switch (mode) // Finish the selection switch (mode) // Finish the selection
{ // process { // process

View file

@ -141,9 +141,9 @@ static NSFont* menuFont = nil;
} }
- (id <NSMenuItem>)insertItemWithTitle:(NSString*)aString - (id <NSMenuItem>)insertItemWithTitle:(NSString*)aString
action:(SEL)aSelector action:(SEL)aSelector
keyEquivalent:(NSString*)charCode keyEquivalent:(NSString*)charCode
atIndex:(unsigned int)index atIndex:(unsigned int)index
{ {
id menuCell = [[[NSMenu cellClass] new] autorelease]; id menuCell = [[[NSMenu cellClass] new] autorelease];
@ -154,7 +154,6 @@ static NSFont* menuFont = nil;
[menuCell setKeyEquivalent:charCode]; [menuCell setKeyEquivalent:charCode];
[cells insertObject:menuCell atIndex:index]; [cells insertObject:menuCell atIndex:index];
[self _resizeMenuForCellSize];
return menuCell; return menuCell;
} }
@ -167,7 +166,6 @@ static NSFont* menuFont = nil;
return; return;
[cells removeObjectAtIndex:row]; [cells removeObjectAtIndex:row];
[self _resizeMenuForCellSize];
} }
- (NSArray*)itemArray { return cells; } - (NSArray*)itemArray { return cells; }
@ -343,25 +341,25 @@ static Class menuCellClass = nil;
} }
- (id <NSMenuItem>)addItemWithTitle:(NSString*)aString - (id <NSMenuItem>)addItemWithTitle:(NSString*)aString
action:(SEL)aSelector action:(SEL)aSelector
keyEquivalent:(NSString*)charCode keyEquivalent:(NSString*)charCode
{ {
return [self insertItemWithTitle:aString return [self insertItemWithTitle:aString
action:aSelector action:aSelector
keyEquivalent:charCode keyEquivalent:charCode
atIndex:[[menuCells itemArray] count]]; atIndex:[[menuCells itemArray] count]];
} }
- (id <NSMenuItem>)insertItemWithTitle:(NSString*)aString - (id <NSMenuItem>)insertItemWithTitle:(NSString*)aString
action:(SEL)aSelector action:(SEL)aSelector
keyEquivalent:(NSString*)charCode keyEquivalent:(NSString*)charCode
atIndex:(unsigned int)index atIndex:(unsigned int)index
{ {
id menuCell = [menuCells insertItemWithTitle:aString id menuCell = [menuCells insertItemWithTitle:aString
action:aSelector action:aSelector
keyEquivalent:charCode keyEquivalent:charCode
atIndex:index]; atIndex:index];
[self _menuChanged]; menuHasChanged = YES; // menu needs update
return menuCell; return menuCell;
} }
@ -369,7 +367,7 @@ static Class menuCellClass = nil;
- (void)removeItem:(id <NSMenuItem>)anItem - (void)removeItem:(id <NSMenuItem>)anItem
{ {
[menuCells removeItem:anItem]; [menuCells removeItem:anItem];
[self _menuChanged]; menuHasChanged = YES; // menu needs update
} }
- (NSArray*)itemArray - (NSArray*)itemArray
@ -592,7 +590,8 @@ static Class menuCellClass = nil;
/* Reenable displaying of menus */ /* Reenable displaying of menus */
[self setMenuChangedMessagesEnabled:YES]; [self setMenuChangedMessagesEnabled:YES];
[self sizeToFit]; if(menuHasChanged) // resize if menu
[self sizeToFit]; // has been changed
} }
- (void)performActionForItem:(id <NSMenuItem>)cell - (void)performActionForItem:(id <NSMenuItem>)cell