mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 01:01:21 +00:00
Make code a little easier to read (and a tiny bit more efficient).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27452 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c2dc1e5647
commit
3217c7304a
7 changed files with 269 additions and 252 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2008-12-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSBrowser.m:
|
||||||
|
* Source/NSPopUpButtonCell.m:
|
||||||
|
* Source/NSBox.m:
|
||||||
|
* Source/NSComboBoxCell.m:
|
||||||
|
* Source/NSScrollView.m:
|
||||||
|
* Headers/Additions/GNUstepGUI/GSTheme.h:
|
||||||
|
Make code clearer by removing function and replacing it with
|
||||||
|
method call so you can see what's actually going on and also
|
||||||
|
be a little more efficient.
|
||||||
|
|
||||||
2008-12-29 Richard Frith-Macdonald <rfm@gnu.org>
|
2008-12-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSHelpManager.m: Allow the GSHelpViewer user default to
|
* Source/NSHelpManager.m: Allow the GSHelpViewer user default to
|
||||||
|
|
|
@ -556,14 +556,5 @@ withRepeatedImage: (NSImage*)image
|
||||||
flipped: (BOOL)flipped;
|
flipped: (BOOL)flipped;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
//
|
|
||||||
// Function which should be somewhere else
|
|
||||||
//
|
|
||||||
static inline NSSize
|
|
||||||
_sizeForBorderType (NSBorderType aType)
|
|
||||||
{
|
|
||||||
return [[GSTheme theme] sizeForBorderType: aType];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* OS_API_VERSION */
|
#endif /* OS_API_VERSION */
|
||||||
#endif /* _GNUstep_H_GSTheme */
|
#endif /* _GNUstep_H_GSTheme */
|
||||||
|
|
474
Source/NSBox.m
474
Source/NSBox.m
|
@ -332,7 +332,7 @@
|
||||||
-(NSSize) minimumSize
|
-(NSSize) minimumSize
|
||||||
{
|
{
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [[GSTheme theme] sizeForBorderType: _border_type];
|
||||||
|
|
||||||
if ([_content_view respondsToSelector: @selector(minimumSize)])
|
if ([_content_view respondsToSelector: @selector(minimumSize)])
|
||||||
{
|
{
|
||||||
|
@ -460,27 +460,26 @@
|
||||||
// Draw border
|
// Draw border
|
||||||
switch (_border_type)
|
switch (_border_type)
|
||||||
{
|
{
|
||||||
case NSNoBorder:
|
case NSNoBorder:
|
||||||
break;
|
break;
|
||||||
case NSLineBorder:
|
case NSLineBorder:
|
||||||
[[NSColor controlDarkShadowColor] set];
|
[[NSColor controlDarkShadowColor] set];
|
||||||
NSFrameRect(_border_rect);
|
NSFrameRect(_border_rect);
|
||||||
break;
|
break;
|
||||||
case NSBezelBorder:
|
case NSBezelBorder:
|
||||||
[[GSTheme theme] drawDarkBezel: _border_rect withClip: rect];
|
[[GSTheme theme] drawDarkBezel: _border_rect withClip: rect];
|
||||||
break;
|
break;
|
||||||
case NSGrooveBorder:
|
case NSGrooveBorder:
|
||||||
[[GSTheme theme] drawGroove: _border_rect withClip: rect];
|
[[GSTheme theme] drawGroove: _border_rect withClip: rect];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw title
|
// Draw title
|
||||||
if (_title_position != NSNoTitle)
|
if (_title_position != NSNoTitle)
|
||||||
{
|
{
|
||||||
// If the title is on the border, clip a hole in the later
|
// If the title is on the border, clip a hole in the later
|
||||||
if ((_border_type != NSNoBorder) &&
|
if ((_border_type != NSNoBorder)
|
||||||
((_title_position == NSAtTop) ||
|
&& ((_title_position == NSAtTop) || (_title_position == NSAtBottom)))
|
||||||
(_title_position == NSAtBottom)))
|
|
||||||
{
|
{
|
||||||
[color set];
|
[color set];
|
||||||
NSRectFill(_title_rect);
|
NSRectFill(_title_rect);
|
||||||
|
@ -598,262 +597,277 @@
|
||||||
|
|
||||||
- (NSRect) calcSizesAllowingNegative: (BOOL)aFlag
|
- (NSRect) calcSizesAllowingNegative: (BOOL)aFlag
|
||||||
{
|
{
|
||||||
|
GSTheme *theme = [GSTheme theme];
|
||||||
NSRect r = NSZeroRect;
|
NSRect r = NSZeroRect;
|
||||||
|
|
||||||
switch (_title_position)
|
switch (_title_position)
|
||||||
{
|
{
|
||||||
case NSNoTitle:
|
case NSNoTitle:
|
||||||
{
|
{
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [theme sizeForBorderType: _border_type];
|
||||||
_border_rect = _bounds;
|
_border_rect = _bounds;
|
||||||
_title_rect = NSZeroRect;
|
_title_rect = NSZeroRect;
|
||||||
|
|
||||||
// Add the offsets to the border rect
|
// Add the offsets to the border rect
|
||||||
r.origin.x = _offsets.width + borderSize.width;
|
r.origin.x = _offsets.width + borderSize.width;
|
||||||
r.origin.y = _offsets.height + borderSize.height;
|
r.origin.y = _offsets.height + borderSize.height;
|
||||||
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
||||||
- (2 * borderSize.width);
|
- (2 * borderSize.width);
|
||||||
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
||||||
- (2 * borderSize.height);
|
- (2 * borderSize.height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSAboveTop:
|
case NSAboveTop:
|
||||||
{
|
{
|
||||||
NSSize titleSize = [_cell cellSize];
|
NSSize titleSize = [_cell cellSize];
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [theme sizeForBorderType: _border_type];
|
||||||
float c;
|
float c;
|
||||||
|
|
||||||
// Add spacer around title
|
// Add spacer around title
|
||||||
titleSize.width += 6;
|
titleSize.width += 6;
|
||||||
titleSize.height += 2;
|
titleSize.height += 2;
|
||||||
|
|
||||||
// Adjust border rect by title cell
|
// Adjust border rect by title cell
|
||||||
_border_rect = _bounds;
|
_border_rect = _bounds;
|
||||||
_border_rect.size.height -= titleSize.height + borderSize.height;
|
_border_rect.size.height -= titleSize.height + borderSize.height;
|
||||||
|
|
||||||
// Add the offsets to the border rect
|
// Add the offsets to the border rect
|
||||||
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
|
r.origin.x
|
||||||
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
|
= _border_rect.origin.x + _offsets.width + borderSize.width;
|
||||||
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
r.origin.y
|
||||||
- (2 * borderSize.width);
|
= _border_rect.origin.y + _offsets.height + borderSize.height;
|
||||||
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
||||||
- (2 * borderSize.height);
|
- (2 * borderSize.width);
|
||||||
|
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
||||||
|
- (2 * borderSize.height);
|
||||||
|
|
||||||
// center the title cell
|
// center the title cell
|
||||||
c = (_bounds.size.width - titleSize.width) / 2;
|
c = (_bounds.size.width - titleSize.width) / 2;
|
||||||
if (c < 0) c = 0;
|
if (c < 0) c = 0;
|
||||||
_title_rect.origin.x = _bounds.origin.x + c;
|
_title_rect.origin.x = _bounds.origin.x + c;
|
||||||
_title_rect.origin.y = _bounds.origin.y + _border_rect.size.height
|
_title_rect.origin.y = _bounds.origin.y + _border_rect.size.height
|
||||||
+ borderSize.height;
|
+ borderSize.height;
|
||||||
_title_rect.size = titleSize;
|
_title_rect.size = titleSize;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSBelowTop:
|
case NSBelowTop:
|
||||||
{
|
{
|
||||||
NSSize titleSize = [_cell cellSize];
|
NSSize titleSize = [_cell cellSize];
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [theme sizeForBorderType: _border_type];
|
||||||
float c;
|
float c;
|
||||||
|
|
||||||
// Add spacer around title
|
// Add spacer around title
|
||||||
titleSize.width += 6;
|
titleSize.width += 6;
|
||||||
titleSize.height += 2;
|
titleSize.height += 2;
|
||||||
|
|
||||||
// Adjust border rect by title cell
|
// Adjust border rect by title cell
|
||||||
_border_rect = _bounds;
|
_border_rect = _bounds;
|
||||||
|
|
||||||
// Add the offsets to the border rect
|
// Add the offsets to the border rect
|
||||||
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
|
r.origin.x
|
||||||
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
|
= _border_rect.origin.x + _offsets.width + borderSize.width;
|
||||||
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
r.origin.y
|
||||||
- (2 * borderSize.width);
|
= _border_rect.origin.y + _offsets.height + borderSize.height;
|
||||||
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
||||||
- (2 * borderSize.height);
|
- (2 * borderSize.width);
|
||||||
|
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
||||||
|
- (2 * borderSize.height);
|
||||||
|
|
||||||
// Adjust by the title size
|
// Adjust by the title size
|
||||||
r.size.height -= titleSize.height + borderSize.height;
|
r.size.height -= titleSize.height + borderSize.height;
|
||||||
|
|
||||||
// center the title cell
|
// center the title cell
|
||||||
c = (_border_rect.size.width - titleSize.width) / 2;
|
c = (_border_rect.size.width - titleSize.width) / 2;
|
||||||
if (c < 0) c = 0;
|
if (c < 0) c = 0;
|
||||||
_title_rect.origin.x = _border_rect.origin.x + c;
|
_title_rect.origin.x = _border_rect.origin.x + c;
|
||||||
_title_rect.origin.y = _border_rect.origin.y + _border_rect.size.height
|
_title_rect.origin.y
|
||||||
- titleSize.height - borderSize.height;
|
= _border_rect.origin.y + _border_rect.size.height
|
||||||
_title_rect.size = titleSize;
|
- titleSize.height - borderSize.height;
|
||||||
|
_title_rect.size = titleSize;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSAtTop:
|
case NSAtTop:
|
||||||
{
|
{
|
||||||
NSSize titleSize = [_cell cellSize];
|
NSSize titleSize = [_cell cellSize];
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [theme sizeForBorderType: _border_type];
|
||||||
float c;
|
float c;
|
||||||
float topMargin;
|
float topMargin;
|
||||||
float topOffset;
|
float topOffset;
|
||||||
|
|
||||||
// Add spacer around title
|
// Add spacer around title
|
||||||
titleSize.width += 6;
|
titleSize.width += 6;
|
||||||
titleSize.height += 2;
|
titleSize.height += 2;
|
||||||
|
|
||||||
_border_rect = _bounds;
|
_border_rect = _bounds;
|
||||||
|
|
||||||
topMargin = ceil(titleSize.height / 2);
|
topMargin = ceil(titleSize.height / 2);
|
||||||
topOffset = titleSize.height - topMargin;
|
topOffset = titleSize.height - topMargin;
|
||||||
|
|
||||||
// Adjust by the title size
|
// Adjust by the title size
|
||||||
_border_rect.size.height -= topMargin;
|
_border_rect.size.height -= topMargin;
|
||||||
|
|
||||||
// Add the offsets to the border rect
|
// Add the offsets to the border rect
|
||||||
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
|
r.origin.x
|
||||||
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
= _border_rect.origin.x + _offsets.width + borderSize.width;
|
||||||
- (2 * borderSize.width);
|
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
||||||
|
- (2 * borderSize.width);
|
||||||
if (topOffset > _offsets.height)
|
|
||||||
{
|
if (topOffset > _offsets.height)
|
||||||
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
|
{
|
||||||
r.size.height = _border_rect.size.height - _offsets.height
|
r.origin.y
|
||||||
- (2 * borderSize.height) - topOffset;
|
= _border_rect.origin.y + _offsets.height + borderSize.height;
|
||||||
}
|
r.size.height = _border_rect.size.height - _offsets.height
|
||||||
else
|
- (2 * borderSize.height) - topOffset;
|
||||||
{
|
}
|
||||||
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
|
else
|
||||||
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
{
|
||||||
- (2 * borderSize.height);
|
r.origin.y
|
||||||
}
|
= _border_rect.origin.y + _offsets.height + borderSize.height;
|
||||||
|
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
||||||
|
- (2 * borderSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust by the title size
|
// Adjust by the title size
|
||||||
// r.size.height -= titleSize.height + borderSize.height;
|
// r.size.height -= titleSize.height + borderSize.height;
|
||||||
|
|
||||||
// center the title cell
|
// center the title cell
|
||||||
c = (_border_rect.size.width - titleSize.width) / 2;
|
c = (_border_rect.size.width - titleSize.width) / 2;
|
||||||
if (c < 0) c = 0;
|
if (c < 0) c = 0;
|
||||||
_title_rect.origin.x = _border_rect.origin.x + c;
|
_title_rect.origin.x = _border_rect.origin.x + c;
|
||||||
_title_rect.origin.y = _border_rect.origin.y + _border_rect.size.height
|
_title_rect.origin.y
|
||||||
- topMargin;
|
= _border_rect.origin.y + _border_rect.size.height - topMargin;
|
||||||
_title_rect.size = titleSize;
|
_title_rect.size = titleSize;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSAtBottom:
|
case NSAtBottom:
|
||||||
{
|
{
|
||||||
NSSize titleSize = [_cell cellSize];
|
NSSize titleSize = [_cell cellSize];
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [theme sizeForBorderType: _border_type];
|
||||||
float c;
|
float c;
|
||||||
float bottomMargin;
|
float bottomMargin;
|
||||||
float bottomOffset;
|
float bottomOffset;
|
||||||
|
|
||||||
// Add spacer around title
|
// Add spacer around title
|
||||||
titleSize.width += 6;
|
titleSize.width += 6;
|
||||||
titleSize.height += 2;
|
titleSize.height += 2;
|
||||||
|
|
||||||
_border_rect = _bounds;
|
_border_rect = _bounds;
|
||||||
|
|
||||||
bottomMargin = ceil(titleSize.height / 2);
|
bottomMargin = ceil(titleSize.height / 2);
|
||||||
bottomOffset = titleSize.height - bottomMargin;
|
bottomOffset = titleSize.height - bottomMargin;
|
||||||
|
|
||||||
// Adjust by the title size
|
// Adjust by the title size
|
||||||
_border_rect.origin.y += bottomMargin;
|
_border_rect.origin.y += bottomMargin;
|
||||||
_border_rect.size.height -= bottomMargin;
|
_border_rect.size.height -= bottomMargin;
|
||||||
|
|
||||||
// Add the offsets to the border rect
|
// Add the offsets to the border rect
|
||||||
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
|
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
|
||||||
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
||||||
- (2 * borderSize.width);
|
- (2 * borderSize.width);
|
||||||
|
|
||||||
if (bottomOffset > _offsets.height)
|
if (bottomOffset > _offsets.height)
|
||||||
{
|
{
|
||||||
r.origin.y = _border_rect.origin.y + bottomOffset + borderSize.height;
|
r.origin.y
|
||||||
r.size.height = _border_rect.size.height - _offsets.height
|
= _border_rect.origin.y + bottomOffset + borderSize.height;
|
||||||
- bottomOffset
|
r.size.height = _border_rect.size.height - _offsets.height
|
||||||
- (2 * borderSize.height);
|
- bottomOffset
|
||||||
}
|
- (2 * borderSize.height);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
|
{
|
||||||
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
r.origin.y
|
||||||
- (2 * borderSize.height);
|
= _border_rect.origin.y + _offsets.height + borderSize.height;
|
||||||
}
|
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
||||||
|
- (2 * borderSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust by the title size
|
// Adjust by the title size
|
||||||
/*
|
/*
|
||||||
r.origin.y += (titleSize.height / 2) + borderSize.height;
|
r.origin.y += (titleSize.height / 2) + borderSize.height;
|
||||||
r.size.height -= (titleSize.height / 2) + borderSize.height;
|
r.size.height -= (titleSize.height / 2) + borderSize.height;
|
||||||
*/
|
*/
|
||||||
// center the title cell
|
// center the title cell
|
||||||
c = (_border_rect.size.width - titleSize.width) / 2;
|
c = (_border_rect.size.width - titleSize.width) / 2;
|
||||||
if (c < 0) c = 0;
|
if (c < 0) c = 0;
|
||||||
_title_rect.origin.x = c;
|
_title_rect.origin.x = c;
|
||||||
_title_rect.origin.y = 0;
|
_title_rect.origin.y = 0;
|
||||||
_title_rect.size = titleSize;
|
_title_rect.size = titleSize;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSBelowBottom:
|
case NSBelowBottom:
|
||||||
{
|
{
|
||||||
NSSize titleSize = [_cell cellSize];
|
NSSize titleSize = [_cell cellSize];
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [theme sizeForBorderType: _border_type];
|
||||||
float c;
|
float c;
|
||||||
|
|
||||||
// Add spacer around title
|
// Add spacer around title
|
||||||
titleSize.width += 6;
|
titleSize.width += 6;
|
||||||
titleSize.height += 2;
|
titleSize.height += 2;
|
||||||
|
|
||||||
// Adjust by the title
|
// Adjust by the title
|
||||||
_border_rect = _bounds;
|
_border_rect = _bounds;
|
||||||
_border_rect.origin.y += titleSize.height + borderSize.height;
|
_border_rect.origin.y += titleSize.height + borderSize.height;
|
||||||
_border_rect.size.height -= titleSize.height + borderSize.height;
|
_border_rect.size.height -= titleSize.height + borderSize.height;
|
||||||
|
|
||||||
// Add the offsets to the border rect
|
// Add the offsets to the border rect
|
||||||
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
|
r.origin.x
|
||||||
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
|
= _border_rect.origin.x + _offsets.width + borderSize.width;
|
||||||
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
r.origin.y
|
||||||
- (2 * borderSize.width);
|
= _border_rect.origin.y + _offsets.height + borderSize.height;
|
||||||
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
||||||
- (2 * borderSize.height);
|
- (2 * borderSize.width);
|
||||||
|
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
||||||
|
- (2 * borderSize.height);
|
||||||
|
|
||||||
// center the title cell
|
// center the title cell
|
||||||
c = (_border_rect.size.width - titleSize.width) / 2;
|
c = (_border_rect.size.width - titleSize.width) / 2;
|
||||||
if (c < 0) c = 0;
|
if (c < 0) c = 0;
|
||||||
_title_rect.origin.x = c;
|
_title_rect.origin.x = c;
|
||||||
_title_rect.origin.y = 0;
|
_title_rect.origin.y = 0;
|
||||||
_title_rect.size = titleSize;
|
_title_rect.size = titleSize;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSAboveBottom:
|
case NSAboveBottom:
|
||||||
{
|
{
|
||||||
NSSize titleSize = [_cell cellSize];
|
NSSize titleSize = [_cell cellSize];
|
||||||
NSSize borderSize = _sizeForBorderType (_border_type);
|
NSSize borderSize = [theme sizeForBorderType: _border_type];
|
||||||
float c;
|
float c;
|
||||||
|
|
||||||
// Add spacer around title
|
// Add spacer around title
|
||||||
titleSize.width += 6;
|
titleSize.width += 6;
|
||||||
titleSize.height += 2;
|
titleSize.height += 2;
|
||||||
|
|
||||||
_border_rect = _bounds;
|
_border_rect = _bounds;
|
||||||
|
|
||||||
// Add the offsets to the border rect
|
// Add the offsets to the border rect
|
||||||
r.origin.x = _border_rect.origin.x + _offsets.width + borderSize.width;
|
r.origin.x
|
||||||
r.origin.y = _border_rect.origin.y + _offsets.height + borderSize.height;
|
= _border_rect.origin.x + _offsets.width + borderSize.width;
|
||||||
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
r.origin.y
|
||||||
- (2 * borderSize.width);
|
= _border_rect.origin.y + _offsets.height + borderSize.height;
|
||||||
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
r.size.width = _border_rect.size.width - (2 * _offsets.width)
|
||||||
- (2 * borderSize.height);
|
- (2 * borderSize.width);
|
||||||
|
r.size.height = _border_rect.size.height - (2 * _offsets.height)
|
||||||
|
- (2 * borderSize.height);
|
||||||
|
|
||||||
// Adjust by the title size
|
// Adjust by the title size
|
||||||
r.origin.y += titleSize.height + borderSize.height;
|
r.origin.y += titleSize.height + borderSize.height;
|
||||||
r.size.height -= titleSize.height + borderSize.height;
|
r.size.height -= titleSize.height + borderSize.height;
|
||||||
|
|
||||||
// center the title cell
|
// center the title cell
|
||||||
c = (_border_rect.size.width - titleSize.width) / 2;
|
c = (_border_rect.size.width - titleSize.width) / 2;
|
||||||
if (c < 0) c = 0;
|
if (c < 0) c = 0;
|
||||||
_title_rect.origin.x = _border_rect.origin.x + c;
|
_title_rect.origin.x = _border_rect.origin.x + c;
|
||||||
_title_rect.origin.y = _border_rect.origin.y + borderSize.height;
|
_title_rect.origin.y = _border_rect.origin.y + borderSize.height;
|
||||||
_title_rect.size = titleSize;
|
_title_rect.size = titleSize;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aFlag)
|
if (!aFlag)
|
||||||
|
|
|
@ -1236,7 +1236,7 @@ static NSTextFieldCell *titleCell;
|
||||||
sw = scrollerWidth;
|
sw = scrollerWidth;
|
||||||
// Take the border into account
|
// Take the border into account
|
||||||
if (_separatesColumns)
|
if (_separatesColumns)
|
||||||
sw += 2 * (_sizeForBorderType (NSBezelBorder)).width;
|
sw += 2 * ([[GSTheme theme] sizeForBorderType: NSBezelBorder]).width;
|
||||||
|
|
||||||
// Column width cannot be less than scroller and border
|
// Column width cannot be less than scroller and border
|
||||||
if (columnWidth < sw)
|
if (columnWidth < sw)
|
||||||
|
@ -1296,7 +1296,7 @@ static NSTextFieldCell *titleCell;
|
||||||
|
|
||||||
// Take the border into account
|
// Take the border into account
|
||||||
if (_separatesColumns)
|
if (_separatesColumns)
|
||||||
cw += 2 * (_sizeForBorderType(NSBezelBorder)).width;
|
cw += 2 * ([[GSTheme theme] sizeForBorderType: NSBezelBorder]).width;
|
||||||
|
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
@ -1308,7 +1308,7 @@ static NSTextFieldCell *titleCell;
|
||||||
cw = columnWidth;
|
cw = columnWidth;
|
||||||
// Take the border into account
|
// Take the border into account
|
||||||
if (_separatesColumns)
|
if (_separatesColumns)
|
||||||
cw -= 2 * (_sizeForBorderType(NSBezelBorder)).width;
|
cw -= 2 * ([[GSTheme theme] sizeForBorderType: NSBezelBorder]).width;
|
||||||
|
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
@ -1753,7 +1753,7 @@ static NSTextFieldCell *titleCell;
|
||||||
- (NSRect) frameOfColumn: (int)column
|
- (NSRect) frameOfColumn: (int)column
|
||||||
{
|
{
|
||||||
NSRect rect = NSZeroRect;
|
NSRect rect = NSZeroRect;
|
||||||
NSSize bezelBorderSize = _sizeForBorderType (NSBezelBorder);
|
NSSize bezelBorderSize = [[GSTheme theme] sizeForBorderType: NSBezelBorder];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
// Number of columns over from the first
|
// Number of columns over from the first
|
||||||
|
@ -1846,7 +1846,7 @@ static NSTextFieldCell *titleCell;
|
||||||
*/
|
*/
|
||||||
- (void) tile
|
- (void) tile
|
||||||
{
|
{
|
||||||
NSSize bezelBorderSize = _sizeForBorderType (NSBezelBorder);
|
NSSize bezelBorderSize = [[GSTheme theme] sizeForBorderType: NSBezelBorder];
|
||||||
int i, num, columnCount, delta;
|
int i, num, columnCount, delta;
|
||||||
float frameWidth;
|
float frameWidth;
|
||||||
|
|
||||||
|
@ -2231,7 +2231,7 @@ static NSTextFieldCell *titleCell;
|
||||||
_browserDelegate = nil;
|
_browserDelegate = nil;
|
||||||
_passiveDelegate = YES;
|
_passiveDelegate = YES;
|
||||||
_doubleAction = NULL;
|
_doubleAction = NULL;
|
||||||
bs = _sizeForBorderType (NSBezelBorder);
|
bs = [[GSTheme theme] sizeForBorderType: NSBezelBorder];
|
||||||
_minColumnWidth = scrollerWidth + (2 * bs.width);
|
_minColumnWidth = scrollerWidth + (2 * bs.width);
|
||||||
if (_minColumnWidth < 100.0)
|
if (_minColumnWidth < 100.0)
|
||||||
_minColumnWidth = 100.0;
|
_minColumnWidth = 100.0;
|
||||||
|
@ -2340,7 +2340,7 @@ static NSTextFieldCell *titleCell;
|
||||||
if (_hasHorizontalScroller && _separatesColumns)
|
if (_hasHorizontalScroller && _separatesColumns)
|
||||||
{
|
{
|
||||||
NSRect scrollerBorderRect = _scrollerRect;
|
NSRect scrollerBorderRect = _scrollerRect;
|
||||||
NSSize bs = _sizeForBorderType (NSBezelBorder);
|
NSSize bs = [[GSTheme theme] sizeForBorderType: NSBezelBorder];
|
||||||
|
|
||||||
scrollerBorderRect.origin.x = 0;
|
scrollerBorderRect.origin.x = 0;
|
||||||
scrollerBorderRect.origin.y = 0;
|
scrollerBorderRect.origin.y = 0;
|
||||||
|
@ -2745,7 +2745,7 @@ static NSTextFieldCell *titleCell;
|
||||||
_browserDelegate = nil;
|
_browserDelegate = nil;
|
||||||
_passiveDelegate = YES;
|
_passiveDelegate = YES;
|
||||||
_doubleAction = NULL;
|
_doubleAction = NULL;
|
||||||
bs = _sizeForBorderType (NSBezelBorder);
|
bs = [[GSTheme theme] sizeForBorderType: NSBezelBorder];
|
||||||
_minColumnWidth = scrollerWidth + (2 * bs.width);
|
_minColumnWidth = scrollerWidth + (2 * bs.width);
|
||||||
if (_minColumnWidth < 100.0)
|
if (_minColumnWidth < 100.0)
|
||||||
_minColumnWidth = 100.0;
|
_minColumnWidth = 100.0;
|
||||||
|
|
|
@ -220,7 +220,7 @@ static GSComboWindow *gsWindow = nil;
|
||||||
- (void) layoutWithComboBoxCell: (NSComboBoxCell *)comboBoxCell
|
- (void) layoutWithComboBoxCell: (NSComboBoxCell *)comboBoxCell
|
||||||
{
|
{
|
||||||
NSMatrix *matrix = [_browser matrixInColumn: 0];
|
NSMatrix *matrix = [_browser matrixInColumn: 0];
|
||||||
NSSize bsize = _sizeForBorderType(NSLineBorder);
|
NSSize bsize = [[GSTheme theme] sizeForBorderType: NSLineBorder];
|
||||||
NSSize size;
|
NSSize size;
|
||||||
float itemHeight;
|
float itemHeight;
|
||||||
float textCellWidth;
|
float textCellWidth;
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ static NSImage *_pbc_image[5];
|
||||||
s.width += 4; /* Right border to image (border included) */
|
s.width += 4; /* Right border to image (border included) */
|
||||||
|
|
||||||
/* (vertical) border: */
|
/* (vertical) border: */
|
||||||
s.height += 2 * (_sizeForBorderType (NSBezelBorder).height);
|
s.height += 2 * [[GSTheme theme] sizeForBorderType: NSBezelBorder].height;
|
||||||
|
|
||||||
/* Spacing between border and inside: */
|
/* Spacing between border and inside: */
|
||||||
s.height += 2 * 1;
|
s.height += 2 * 1;
|
||||||
|
|
|
@ -121,7 +121,7 @@ static float scrollerWidth;
|
||||||
borderType: (NSBorderType)borderType
|
borderType: (NSBorderType)borderType
|
||||||
{
|
{
|
||||||
NSSize size = frameSize;
|
NSSize size = frameSize;
|
||||||
NSSize border = _sizeForBorderType(borderType);
|
NSSize border = [[GSTheme theme] sizeForBorderType: borderType];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Substract 1 from the width and height of
|
* Substract 1 from the width and height of
|
||||||
|
@ -149,7 +149,7 @@ static float scrollerWidth;
|
||||||
borderType: (NSBorderType)borderType
|
borderType: (NSBorderType)borderType
|
||||||
{
|
{
|
||||||
NSSize size = contentSize;
|
NSSize size = contentSize;
|
||||||
NSSize border = _sizeForBorderType(borderType);
|
NSSize border = [[GSTheme theme] sizeForBorderType: borderType];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add 1 to the width and height for the line that separates the
|
* Add 1 to the width and height for the line that separates the
|
||||||
|
@ -974,7 +974,7 @@ static float scrollerWidth;
|
||||||
- (void) tile
|
- (void) tile
|
||||||
{
|
{
|
||||||
NSRect headerRect, contentRect;
|
NSRect headerRect, contentRect;
|
||||||
NSSize border = _sizeForBorderType(_borderType);
|
NSSize border = [[GSTheme theme] sizeForBorderType: _borderType];
|
||||||
NSRectEdge bottomEdge, topEdge;
|
NSRectEdge bottomEdge, topEdge;
|
||||||
float headerViewHeight = 0;
|
float headerViewHeight = 0;
|
||||||
NSRectEdge verticalScrollerEdge = NSMinXEdge;
|
NSRectEdge verticalScrollerEdge = NSMinXEdge;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue