* 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>
* Source/NSScroller.m: Minor efficiency hacks (inspired by xraw) plus

View file

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

View file

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

View file

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

View file

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