mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 08:30:59 +00:00
* Source/GSThemeTools.m: Fix unflipped/flipped coordinates bug
in the 9-patch content rect parsing code. Add some comments. Simplify contentRectForRect: implementation. * Source/GSThemeDrawing.m (-browserHeaderDrawingRectForCell:...): Use -contentRectForRect: to get the content rect instead of incorrectly reading from ivar. Fixes broken text positioning in browser header with Nesedah theme. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37217 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c713f8cb04
commit
1411fdfa3a
3 changed files with 27 additions and 20 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2013-10-11 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSThemeTools.m: Fix unflipped/flipped coordinates bug
|
||||
in the 9-patch content rect parsing code. Add some comments.
|
||||
Simplify contentRectForRect: implementation.
|
||||
* Source/GSThemeDrawing.m (-browserHeaderDrawingRectForCell:...):
|
||||
Use -contentRectForRect: to get the content rect instead of
|
||||
incorrectly reading from ivar. Fixes broken text positioning
|
||||
in browser header with Nesedah theme.
|
||||
|
||||
2013-10-09 German Arias <germanandre@gmx.es>
|
||||
|
||||
* NSWindow.m (-sendEvent:): Fix last commit.
|
||||
|
|
|
@ -1843,11 +1843,8 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
|
|||
}
|
||||
else
|
||||
{
|
||||
// FIXME: We assume the button's top and right padding are the same as
|
||||
// its bottom and left.
|
||||
return NSInsetRect(rect,
|
||||
tiles->contentRect.origin.x,
|
||||
tiles->contentRect.origin.y);
|
||||
NSRect result = [tiles contentRectForRect: rect];
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -783,8 +783,8 @@ withRepeatedImage: (NSImage*)image
|
|||
{
|
||||
int i;
|
||||
CGFloat r,g,b,a;
|
||||
int x1 = -1;
|
||||
int x2 = -1;
|
||||
int x1 = -1; // x1, x2, y1, y2, are in flipped coordinates
|
||||
int x2 = -1; // 0,0 is the top-left pixel
|
||||
int y1 = -1;
|
||||
int y2 = -1;
|
||||
NSSize s = [image size];
|
||||
|
@ -825,6 +825,7 @@ withRepeatedImage: (NSImage*)image
|
|||
scaleFactor = 1.0f;
|
||||
style = GSThemeFillStyleScaleAll;
|
||||
|
||||
// These are all in _unflipped_ coordinates
|
||||
rects[TileTL] = NSMakeRect(1, s.height - y1, x1 - 1, y1 - 1);
|
||||
rects[TileTM] = NSMakeRect(x1, s.height - y1, 1 + x2 - x1, y1 - 1);
|
||||
rects[TileTR] = NSMakeRect(x2 + 1, s.height - y1, s.width - x2 - 2, y1 - 1);
|
||||
|
@ -879,6 +880,8 @@ withRepeatedImage: (NSImage*)image
|
|||
// ; if either the horizontal or vertical information is missing, use the
|
||||
// geometry from rects[TileCM]
|
||||
|
||||
// contentRect is in unflipped coordinates, like rects[]
|
||||
|
||||
if (x1 == -1)
|
||||
{
|
||||
contentRect.origin.x = rects[TileCM].origin.x;
|
||||
|
@ -897,7 +900,7 @@ withRepeatedImage: (NSImage*)image
|
|||
}
|
||||
else
|
||||
{
|
||||
contentRect.origin.y = y1;
|
||||
contentRect.origin.y = s.height - y2 - 1;
|
||||
contentRect.size.height = 1 + y2 - y1;
|
||||
}
|
||||
|
||||
|
@ -1105,20 +1108,17 @@ withRepeatedImage: (NSImage*)image
|
|||
|
||||
- (NSRect) contentRectForRect: (NSRect)rect
|
||||
{
|
||||
NSRect cm = originalRectCM;
|
||||
NSRect result = NSMakeRect(rect.origin.x + rects[TileCL].size.width,
|
||||
rect.origin.y + rects[TileBM].size.height,
|
||||
rect.size.width - (rects[TileCL].size.width + rects[TileCR].size.width),
|
||||
rect.size.height - (rects[TileTM].size.height + rects[TileBM].size.height));
|
||||
GSThemeMargins margins = [self themeMargins];
|
||||
|
||||
|
||||
result.origin.x += (contentRect.origin.x - cm.origin.x);
|
||||
result.size.width += (contentRect.size.width - cm.size.width);
|
||||
// N.B. Assumes the caller is using unflipped coords.
|
||||
|
||||
result.origin.y += (contentRect.origin.y - cm.origin.y);
|
||||
result.size.height += (contentRect.size.height - cm.size.height);
|
||||
|
||||
return result;
|
||||
rect.origin.x += margins.left;
|
||||
rect.origin.y += margins.bottom;
|
||||
|
||||
rect.size.width -= (margins.left + margins.right);
|
||||
rect.size.height -= (margins.top + margins.bottom);
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (NSRect) noneStyleFillRect: (NSRect)rect
|
||||
|
|
Loading…
Reference in a new issue