mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-02 21:11:05 +00:00
Fix memory leaks, -copyWithZone:, and use predefined attribute name variables.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19773 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fc236ac493
commit
7bd6218f56
2 changed files with 17 additions and 5 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2004-07-24 22:47 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
* Source/NSToolbarItem.m: Use the predefined variables instead of
|
||||||
|
inline string literals for attribute names.
|
||||||
|
([GSToolbarButton -layout], [GSToolbarBackView -drawRect:],
|
||||||
|
[GSToolbarBackView -layout]): Release attrStr/attrString.
|
||||||
|
(-copyWithZone:): Return new, not self.
|
||||||
|
|
||||||
2004-07-23 01:54 Matt Rice <ratmice@yahoo.com>
|
2004-07-23 01:54 Matt Rice <ratmice@yahoo.com>
|
||||||
|
|
||||||
* Documentation/GuiUser/DefaultsSummary.gsdoc: Document
|
* Documentation/GuiUser/DefaultsSummary.gsdoc: Document
|
||||||
|
|
|
@ -181,7 +181,7 @@ static NSFont *SmallFont = nil;
|
||||||
|
|
||||||
// Adjust the layout in accordance with the label
|
// Adjust the layout in accordance with the label
|
||||||
|
|
||||||
attr = [NSDictionary dictionaryWithObject: font forKey: @"NSFontAttributeName"];
|
attr = [NSDictionary dictionaryWithObject: font forKey: NSFontAttributeName];
|
||||||
if (label == nil || [label isEqualToString: @""])
|
if (label == nil || [label isEqualToString: @""])
|
||||||
label = @"Dummy";
|
label = @"Dummy";
|
||||||
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
|
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
|
||||||
|
@ -212,6 +212,7 @@ static NSFont *SmallFont = nil;
|
||||||
default:
|
default:
|
||||||
; // Invalid
|
; // Invalid
|
||||||
}
|
}
|
||||||
|
DESTROY(attrStr);
|
||||||
|
|
||||||
// Set the frame size to use the new layout
|
// Set the frame size to use the new layout
|
||||||
|
|
||||||
|
@ -324,13 +325,14 @@ static NSFont *SmallFont = nil;
|
||||||
{
|
{
|
||||||
// We draw the label
|
// We draw the label
|
||||||
attr = [NSDictionary dictionaryWithObjectsAndKeys: _font,
|
attr = [NSDictionary dictionaryWithObjectsAndKeys: _font,
|
||||||
@"NSFontAttributeName",
|
NSFontAttributeName,
|
||||||
color,
|
color,
|
||||||
@"NSForegroundColorAttributeName",
|
NSForegroundColorAttributeName,
|
||||||
nil];
|
nil];
|
||||||
attrString = [[NSAttributedString alloc] initWithString: [_toolbarItem label] attributes: attr];
|
attrString = [[NSAttributedString alloc] initWithString: [_toolbarItem label] attributes: attr];
|
||||||
textX = (([self frame].size.width - _InsetItemTextX) - [attrString size].width) / 2;
|
textX = (([self frame].size.width - _InsetItemTextX) - [attrString size].width) / 2;
|
||||||
[attrString drawAtPoint: NSMakePoint(textX, _InsetItemTextY)];
|
[attrString drawAtPoint: NSMakePoint(textX, _InsetItemTextY)];
|
||||||
|
DESTROY(attrString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +394,7 @@ static NSFont *SmallFont = nil;
|
||||||
|
|
||||||
// Adjust the layout in accordance with the label
|
// Adjust the layout in accordance with the label
|
||||||
|
|
||||||
attr = [NSDictionary dictionaryWithObject: _font forKey: @"NSFontAttributeName"];
|
attr = [NSDictionary dictionaryWithObject: _font forKey: NSFontAttributeName];
|
||||||
if (label == nil || [label isEqualToString: @""])
|
if (label == nil || [label isEqualToString: @""])
|
||||||
label = @"Dummy";
|
label = @"Dummy";
|
||||||
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
|
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
|
||||||
|
@ -460,6 +462,7 @@ static NSFont *SmallFont = nil;
|
||||||
[view setFrameOrigin:
|
[view setFrameOrigin:
|
||||||
NSMakePoint((layoutedWidth - [view frame].size.width) / 2, insetItemViewY)];
|
NSMakePoint((layoutedWidth - [view frame].size.width) / 2, insetItemViewY)];
|
||||||
}
|
}
|
||||||
|
DESTROY(attrStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSToolbarItem *)toolbarItem
|
- (NSToolbarItem *)toolbarItem
|
||||||
|
@ -1157,7 +1160,8 @@ static NSFont *SmallFont = nil;
|
||||||
[new setMinSize: NSMakeSize(_minSize.width, _minSize.height)];
|
[new setMinSize: NSMakeSize(_minSize.width, _minSize.height)];
|
||||||
[new setMaxSize: NSMakeSize(_maxSize.width, _maxSize.height)];
|
[new setMaxSize: NSMakeSize(_maxSize.width, _maxSize.height)];
|
||||||
|
|
||||||
return self;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue