mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:51:02 +00:00
* NSApplication.m minor optimiztions.
* NSAttributedString.m sizeWithAttributes: implement tab support. * NSStringDrawing.m sizeWithAttributes: implement tab support. * NSScroller.m trackScrollButtons: add temporary hack in support of XRAW's heavily optimized scrolling machinery. * NSScroller.m remove sendAction:to: * NSScrolView.m _doScroll: implement scroller update when scrolling via buttons * NSScrolView.m reflectScrolledClipView comment out setNeedsDisplay as it causes display flicker. * NSText.m add changes from Daniel B�hringer, set initFrame to default values to prevent infinite loop in rebuildLineLayout, minor tweaks * NSView.m minor optimiztions. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3071 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2e3f81e829
commit
748f6b3661
14 changed files with 1042 additions and 535 deletions
|
@ -35,11 +35,30 @@
|
|||
- (NSSize)sizeWithAttributes:(NSDictionary *)attrs
|
||||
{
|
||||
NSFont *font;
|
||||
const char *str = [self cString];
|
||||
int i = 0, j = 4;
|
||||
float tabSize;
|
||||
|
||||
while(*str++ != '\0') // count the tabs
|
||||
{
|
||||
if(*str == '\t')
|
||||
{
|
||||
i += j;
|
||||
j = 4;
|
||||
}
|
||||
else
|
||||
j = j == 0 ? 4 : j--;
|
||||
};
|
||||
// if font is not
|
||||
if(!(font = [attrs objectForKey:NSFontAttributeName])) // specified, use
|
||||
font = [NSFont userFontOfSize:12]; // the default
|
||||
|
||||
return NSMakeSize([font widthOfString:self], [font pointSize]);
|
||||
fprintf(stderr,"string %s width: %f\n", [self cString], [font widthOfString:self]);
|
||||
|
||||
// tabSize = 4 * i * [font widthOfString:@" "];
|
||||
tabSize = (float)i * [font widthOfString:@" "];
|
||||
|
||||
return NSMakeSize(([font widthOfString:self] + tabSize), [font pointSize]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue