optimizations

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3084 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Felipe A. Rodriguez 1998-10-19 06:10:49 +00:00
parent 92978c29e6
commit 75b8e3cdaa
3 changed files with 19 additions and 14 deletions

View file

@ -32,6 +32,7 @@
#define TABWIDTH 3 // char so this value is set to one
// minus the default tab width of 4
@implementation NSString(NSAttributedString)
- (NSSize)sizeWithAttributes:(NSDictionary *)attrs
@ -45,25 +46,17 @@ float tabSize;
{ // to be added for tabs.
if(*str++ == '\t')
{
i += j; // j is the max number of spaces needed per
j = TABWIDTH; // tab. the number of spaces needed per
} // tab varies in order to align each tab at
else // even multiples of TABWIDTH+1.
i += j; // j is the max number of spaces
j = TABWIDTH; // needed per tab. this number
} // varies in order to align tabs
else // at even multiples of TABWIDTH+1.
j = j-- > 0 ? j : TABWIDTH;
};
// fprintf(stderr,"NSAttributedString sizeWithAttributes tabs: %d\n", i);
// if font is not
if(!(font = [attrs objectForKey:NSFontAttributeName])) // specified, use
font = [NSFont userFontOfSize:12]; // the default
#ifdef FAR_DEBUG
fprintf(stderr,"NSAttributedString sizeWithAttributes \"%s\" width: %f\n", [self cString], [font widthOfString:self]);
fprintf(stderr,"NSAttributedString sizeWithAttributes width: %f\n", [font widthOfString:self]);
#endif
tabSize = (float)i * [font widthOfString:@" "];
tabSize = (float)i * [font widthOfString:@"\t"];
return NSMakeSize(([font widthOfString:self] + tabSize), [font pointSize]);
}

View file

@ -241,7 +241,8 @@ static NSDictionary* nsmapping = nil;
if (image)
[image setName: [[path lastPathComponent]
stringByDeletingPathExtension]];
return image;
return image;
}
}

View file

@ -509,6 +509,17 @@ static NSButtonCell* knobCell = nil;
NSDebugLog (@"return from trackScrollButtons");
}
- (BOOL)sendActionO:(SEL)theAction to:(id)theTarget
{ // send action to
BOOL ret = [super sendAction:theAction to:theTarget]; // the target on
// behalf of cell
[self drawKnobSlot]; // lockFocus set in mouseDown method is
[self drawKnob]; // active so we simply redraw the knob and
[window flushWindow]; // slot to reflect the hit scroll button
return ret;
}
- (void)encodeWithCoder:aCoder
{
}