mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
tidyups and minor theme tiling updates.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23871 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
477b1ee968
commit
cc3cafa874
58 changed files with 422 additions and 230 deletions
63
ChangeLog
63
ChangeLog
|
@ -1,3 +1,66 @@
|
|||
2006-10-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSBrowser.m:
|
||||
* Source/NSSound.m:
|
||||
* Source/NSTextAttachment.m:
|
||||
* Source/NSPopUpButtonCell.m:
|
||||
* Source/NSPanel.m:
|
||||
* Source/NSImageCell.m:
|
||||
* Source/NSSliderCell.m:
|
||||
* Source/GSGormLoader.m:
|
||||
* Source/NSParagraphStyle.m:
|
||||
* Source/NSFormCell.m:
|
||||
* Source/NSMenu.m:
|
||||
* Source/NSWindow.m:
|
||||
* Source/NSButtonCell.m:
|
||||
* Source/NSImageView.m:
|
||||
* Source/NSActionCell.m:
|
||||
* Source/NSDataLinkManager.m:
|
||||
* Source/NSClipView.m:
|
||||
* Source/NSBitmapImageRep.m:
|
||||
* Source/NSTextFieldCell.m:
|
||||
* Source/NSColorWell.m:
|
||||
* Source/GSTextStorage.m:
|
||||
* Source/NSApplication.m:
|
||||
* Source/NSTableColumn.m:
|
||||
* Source/GSVbox.m:
|
||||
* Source/NSNib.m:
|
||||
* Source/NSCachedImageRep.m:
|
||||
* Source/NSPrinter.m:
|
||||
* Source/NSTextContainer.m:
|
||||
* Source/GSNibLoader.m:
|
||||
* Source/GSNibCompatibility.m:
|
||||
* Source/GSTrackingRect.m:
|
||||
* Source/NSSearchFieldCell.m:
|
||||
* Source/NSControl.m:
|
||||
* Source/GSHbox.m:
|
||||
* Source/NSProgressIndicator.m:
|
||||
* Source/GSModelLoaderFactory.m:
|
||||
* Source/NSTextStorage.m:
|
||||
* Source/NSTextView.m:
|
||||
* Source/NSDocumentController.m:
|
||||
* Source/NSMenuView.m:
|
||||
* Source/NSSecureTextField.m:
|
||||
* Source/NSComboBoxCell.m:
|
||||
* Source/NSImage.m:
|
||||
* Source/NSStepperCell.m:
|
||||
* Source/NSDataLink.m:
|
||||
* Source/NSScrollView.m:
|
||||
* Source/NSBundleAdditions.m:
|
||||
* Source/NSCell.m:
|
||||
* Source/GSTable.m:
|
||||
* Source/NSTableView.m:
|
||||
* Source/NSBrowserCell.m:
|
||||
* Source/NSSelection.m:
|
||||
* Source/NSTextField.m:
|
||||
* Source/NSView.m:
|
||||
* Source/NSDocument.m:
|
||||
Fixup some minor coding standard violations ... add white space.
|
||||
* Headers/Additions/GNUstepGUI/GSTheme.h:
|
||||
* Source/GSTheme.m:
|
||||
Add control for caching of tiles. Add another fill style for tiling.
|
||||
Make fill style names avoid possible name clashes by using GS prefix.
|
||||
|
||||
2006-10-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSImageView.m: Fix error in initial drag position.
|
||||
|
|
|
@ -147,14 +147,18 @@
|
|||
@class GSDrawTiles;
|
||||
|
||||
/**
|
||||
* This defines how the center middle image in a tile array should be
|
||||
* used when drawing a rectangle.
|
||||
* This defines how the values in a tile array should be used when
|
||||
* drawing a rectangle. Mostly this just effects the center, middle
|
||||
* image of the rectangle.<br />
|
||||
* FillStyleMatrix is provided for the use of theme editors wishing
|
||||
* to display the tile.
|
||||
*/
|
||||
typedef enum {
|
||||
FillStyleNone, /** The image is not drawn */
|
||||
FillStyleScale, /** The image is scaled to fit */
|
||||
FillStyleRepeat, /** The image is tiled from bottom left */
|
||||
FillStyleCenter /** The image is tiled from the center */
|
||||
GSThemeFillStyleNone, /** CM image is not drawn */
|
||||
GSThemeFillStyleScale, /** CM image is scaled to fit */
|
||||
GSThemeFillStyleRepeat, /** CM image is tiled from bottom left */
|
||||
GSThemeFillStyleCenter, /** CM image is tiled from the center */
|
||||
GSThemeFillStyleMatrix /** a matrix of nine separated images */
|
||||
} GSThemeFillStyle;
|
||||
|
||||
|
||||
|
@ -349,9 +353,11 @@ APPKIT_EXPORT NSString *GSThemeDidDeactivateNotification;
|
|||
* The GUI library uses this internally to handling tiling of image
|
||||
* information to draw user interface elements. The tile information
|
||||
* returned by this method can be passed to the
|
||||
* -fillRect:withTiles:background:fillStyle: method.
|
||||
* -fillRect:withTiles:background:fillStyle: method.<br />
|
||||
* The useCache argument controls whether the information is retrieved
|
||||
* from cache or regenerated from information in the theme bundle.
|
||||
*/
|
||||
- (GSDrawTiles*) tilesNamed: (NSString*)aName;
|
||||
- (GSDrawTiles*) tilesNamed: (NSString*)aName cache: (BOOL)useCache;
|
||||
@end
|
||||
|
||||
/**
|
||||
|
|
143
Source/GSTheme.m
143
Source/GSTheme.m
|
@ -397,8 +397,8 @@ static NSNull *null = nil;
|
|||
}
|
||||
|
||||
/*
|
||||
* We could cache tile info here, but it's probabaly better for the
|
||||
* tilesNamed: method to do it lazily.
|
||||
* We could cache tile info here, but it's probably better for the
|
||||
* tilesNamed:cache: method to do it lazily.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -566,10 +566,11 @@ static NSNull *null = nil;
|
|||
return [GSThemeInspector sharedThemeInspector];
|
||||
}
|
||||
|
||||
- (GSDrawTiles*) tilesNamed: (NSString*)aName
|
||||
- (GSDrawTiles*) tilesNamed: (NSString*)aName cache: (BOOL)useCache
|
||||
{
|
||||
GSDrawTiles *tiles = [_tiles objectForKey: aName];
|
||||
GSDrawTiles *tiles;
|
||||
|
||||
tiles = (useCache == YES) ? [_tiles objectForKey: aName] : nil;
|
||||
if (tiles == nil)
|
||||
{
|
||||
NSDictionary *info;
|
||||
|
@ -1074,7 +1075,129 @@ withRepeatedImage: (NSImage*)image
|
|||
}
|
||||
NSRectFill(rect);
|
||||
|
||||
if (style == GSThemeFillStyleMatrix)
|
||||
{
|
||||
NSRect grid;
|
||||
float x;
|
||||
float y;
|
||||
|
||||
if (tiles->images[TileTM] == nil)
|
||||
{
|
||||
grid.size.width = (tiles->rects[TileTL].size.width
|
||||
+ tiles->rects[TileTR].size.width
|
||||
+ 9);
|
||||
}
|
||||
else
|
||||
{
|
||||
grid.size.width = (tiles->rects[TileTL].size.width
|
||||
+ tiles->rects[TileTM].size.width
|
||||
+ tiles->rects[TileTR].size.width
|
||||
+ 12);
|
||||
}
|
||||
grid.origin.x = rect.origin.x + (rect.size.width - grid.size.width) / 2;
|
||||
x = grid.origin.x;
|
||||
if (flipped)
|
||||
{
|
||||
grid.origin.y
|
||||
= NSMaxY(rect) - (rect.size.height - grid.size.height) / 2;
|
||||
y = NSMaxY(grid);
|
||||
}
|
||||
else
|
||||
{
|
||||
grid.origin.y
|
||||
= rect.origin.y + (rect.size.height - grid.size.height) / 2;
|
||||
y = grid.origin.y;
|
||||
}
|
||||
|
||||
/* Draw bottom row
|
||||
*/
|
||||
if (flipped)
|
||||
{
|
||||
y -= (tiles->rects[TileBL].size.height + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
y += 3;
|
||||
}
|
||||
[tiles->images[TileBL] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
x += tiles->rects[TileBL].size.width + 3;
|
||||
if (tiles->images[TileBM] != nil)
|
||||
{
|
||||
[tiles->images[TileBM] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
x += tiles->rects[TileBM].size.width + 3;
|
||||
}
|
||||
[tiles->images[TileBR] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
if (!flipped)
|
||||
{
|
||||
y += tiles->rects[TileBL].size.height;
|
||||
}
|
||||
|
||||
if (tiles->images[TileCL] != nil)
|
||||
{
|
||||
/* Draw middle row
|
||||
*/
|
||||
x = grid.origin.x;
|
||||
if (flipped)
|
||||
{
|
||||
y -= (tiles->rects[TileCL].size.height + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
y += 3;
|
||||
}
|
||||
[tiles->images[TileCL] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
x += tiles->rects[TileCL].size.width + 3;
|
||||
if (tiles->images[TileCM] != nil)
|
||||
{
|
||||
[tiles->images[TileCM] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
x += tiles->rects[TileCM].size.width + 3;
|
||||
}
|
||||
[tiles->images[TileCR] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
if (!flipped)
|
||||
{
|
||||
y += tiles->rects[TileCL].size.height;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw top row
|
||||
*/
|
||||
x = grid.origin.x;
|
||||
if (flipped)
|
||||
{
|
||||
y -= (tiles->rects[TileTL].size.height + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
y += 3;
|
||||
}
|
||||
[tiles->images[TileTL] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
x += tiles->rects[TileTL].size.width + 3;
|
||||
if (tiles->images[TileTM] != nil)
|
||||
{
|
||||
[tiles->images[TileTM] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
x += tiles->rects[TileTM].size.width + 3;
|
||||
}
|
||||
[tiles->images[TileTR] compositeToPoint:
|
||||
NSMakePoint(x, y)
|
||||
operation: NSCompositeSourceOver];
|
||||
}
|
||||
else if (flipped)
|
||||
{
|
||||
[self fillHorizontalRect:
|
||||
NSMakeRect (rect.origin.x + bls.width,
|
||||
|
@ -1134,21 +1257,21 @@ withRepeatedImage: (NSImage*)image
|
|||
rect.origin.y + bms.height,
|
||||
rect.size.width - cls.width - crs.width,
|
||||
rect.size.height - bms.height - tms.height);
|
||||
if (style == FillStyleCenter)
|
||||
if (style == GSThemeFillStyleCenter)
|
||||
{
|
||||
[self fillRect: inFill
|
||||
withRepeatedImage: tiles->images[TileCM]
|
||||
fromRect: tiles->rects[TileCM]
|
||||
center: NO];
|
||||
}
|
||||
else if (style == FillStyleRepeat)
|
||||
else if (style == GSThemeFillStyleRepeat)
|
||||
{
|
||||
[self fillRect: inFill
|
||||
withRepeatedImage: tiles->images[TileCM]
|
||||
fromRect: tiles->rects[TileCM]
|
||||
center: NO];
|
||||
}
|
||||
else if (style == FillStyleScale)
|
||||
else if (style == GSThemeFillStyleScale)
|
||||
{
|
||||
[tiles->images[TileCM] setScalesWhenResized: YES];
|
||||
[tiles->images[TileCM] setSize: inFill.size];
|
||||
|
@ -1226,21 +1349,21 @@ withRepeatedImage: (NSImage*)image
|
|||
rect.size.width - cls.width - crs.width,
|
||||
rect.size.height - bms.height - tms.height);
|
||||
|
||||
if (style == FillStyleCenter)
|
||||
if (style == GSThemeFillStyleCenter)
|
||||
{
|
||||
[self fillRect: inFill
|
||||
withRepeatedImage: tiles->images[TileCM]
|
||||
fromRect: tiles->rects[TileCM]
|
||||
center: NO];
|
||||
}
|
||||
else if (style == FillStyleRepeat)
|
||||
else if (style == GSThemeFillStyleRepeat)
|
||||
{
|
||||
[self fillRect: inFill
|
||||
withRepeatedImage: tiles->images[TileCM]
|
||||
fromRect: tiles->rects[TileCM]
|
||||
center: YES];
|
||||
}
|
||||
else if (style == FillStyleScale)
|
||||
else if (style == GSThemeFillStyleScale)
|
||||
{
|
||||
[tiles->images[TileCM] setScalesWhenResized: YES];
|
||||
[tiles->images[TileCM] setSize: inFill.size];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue