mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 03:11:18 +00:00
2004-11-10 Matt Rice <ratmice@yahoo.com>
* Headers/Additions/GNUstepGUI/GSDisplayServer.h (-iconSize): New method declaration. (-iconTileImage): Ditto. * Source/GSDisplayServer.m (-resolutionForScreen:): Fix Typo in Docs. (-boundsForScreen:): Ditto. (-windowBounds:): Ditto. (-iconSize): Implement new method. (-iconTileImage): Ditto. * Source/NSApplication.m (NSAppIconView): Remove useWindowmakerIconBackground variable. (scaledIconSizeForSize): New function. ([NSAppIconView +initialize]): Dont set a default image here. Remove usage of GSUseWindowmakerIconBackground default. Use backend tile and scale it to the backend icon size. ([NSAppIconView -drawRect:]): Remove usage of useWindowmakerIconBackground. Draw cells with the backend icon size. ([NSAppIconView -setImage:]): Set the image to a scaled copy. setNeedsDisplay instead of drawing directly. ([NSApplication -_appIconInit]): Use backend icon size. * Source/NSWindow.m: Remove useWindowmakerIconBackground variable. (scaledIconSizeForSize): New function. ([NSMiniWindowView +initialize]): Remove usage of GSUseWindowmakerIconBackground default. Use backend tile image and scale it to the backend icon size. ([NSMiniWindowView -drawRect:]): Remove usage of useWindowmakerIconBackground. Draw cells with the backend iconSize. ([NSMiniWindowView -setImage:]): Set the image to a scaled copy. setNeedsDisplay instead of drawing directly. ([NSMiniWindowView -setTitle:]): setNeedsDisplay instead of drawing directly. ([NSWindow -miniaturize:]): Use backend icon size. * Documentation/GuiUser/DefaultsSummary.gsdoc: Remove docs for GSUseWindowmakerIconBackground. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20336 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
409e8d2388
commit
d714152e8f
6 changed files with 147 additions and 95 deletions
36
ChangeLog
36
ChangeLog
|
@ -1,3 +1,39 @@
|
|||
2004-11-10 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSDisplayServer.h (-iconSize): New method
|
||||
declaration.
|
||||
(-iconTileImage): Ditto.
|
||||
* Source/GSDisplayServer.m (-resolutionForScreen:): Fix Typo in Docs.
|
||||
(-boundsForScreen:): Ditto.
|
||||
(-windowBounds:): Ditto.
|
||||
(-iconSize): Implement new method.
|
||||
(-iconTileImage): Ditto.
|
||||
* Source/NSApplication.m (NSAppIconView): Remove
|
||||
useWindowmakerIconBackground variable.
|
||||
(scaledIconSizeForSize): New function.
|
||||
([NSAppIconView +initialize]): Dont set a default image here. Remove
|
||||
usage of GSUseWindowmakerIconBackground default. Use backend tile and
|
||||
scale it to the backend icon size.
|
||||
([NSAppIconView -drawRect:]): Remove usage of
|
||||
useWindowmakerIconBackground. Draw cells with the backend icon size.
|
||||
([NSAppIconView -setImage:]): Set the image to a scaled copy.
|
||||
setNeedsDisplay instead of drawing directly.
|
||||
([NSApplication -_appIconInit]): Use backend icon size.
|
||||
* Source/NSWindow.m: Remove useWindowmakerIconBackground variable.
|
||||
(scaledIconSizeForSize): New function.
|
||||
([NSMiniWindowView +initialize]): Remove usage of
|
||||
GSUseWindowmakerIconBackground default. Use backend tile image and scale
|
||||
it to the backend icon size.
|
||||
([NSMiniWindowView -drawRect:]): Remove usage of
|
||||
useWindowmakerIconBackground. Draw cells with the backend iconSize.
|
||||
([NSMiniWindowView -setImage:]): Set the image to a scaled copy.
|
||||
setNeedsDisplay instead of drawing directly.
|
||||
([NSMiniWindowView -setTitle:]): setNeedsDisplay instead of drawing
|
||||
directly.
|
||||
([NSWindow -miniaturize:]): Use backend icon size.
|
||||
* Documentation/GuiUser/DefaultsSummary.gsdoc: Remove docs for
|
||||
GSUseWindowmakerIconBackground.
|
||||
|
||||
2004-11-09 Adrian Robert <arobert@cogsci.ucsd.edu>
|
||||
|
||||
* Source/NSTabView.m (-insertTabViewItem:): Update display.
|
||||
|
|
|
@ -165,18 +165,6 @@
|
|||
specification are used in [NSWorkspace iconForFile:] when available.
|
||||
</p>
|
||||
</desc>
|
||||
<term>GSUseWindowmakerIconBackground</term>
|
||||
<desc>
|
||||
<p>
|
||||
A boolean value, <code>NO</code> by default. When set to YES,
|
||||
GNUstep uses the windowmaker icon background
|
||||
for app icons and mini-windows.
|
||||
</p>
|
||||
<p>
|
||||
Note that this only works when using back-art, and the
|
||||
XWindowBuffer-shape-hack default must be set to YES.
|
||||
</p>
|
||||
</desc>
|
||||
<term>GSLogWorkspaceTimeout</term>
|
||||
<desc>
|
||||
<p>
|
||||
|
|
|
@ -100,6 +100,11 @@ APPKIT_EXPORT NSString * GSScreenNumber;
|
|||
- (void *) windowDevice: (int)win;
|
||||
|
||||
- (void) beep;
|
||||
|
||||
/* AppIcon/MiniWindow information */
|
||||
- (NSImage *) iconTileImage;
|
||||
- (NSSize) iconSize;
|
||||
|
||||
@end
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <Foundation/NSLock.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <Foundation/NSGeometry.h>
|
||||
|
||||
#include "AppKit/NSEvent.h"
|
||||
#include "AppKit/NSImage.h"
|
||||
|
@ -414,7 +415,7 @@ GSCurrentServer(void)
|
|||
}
|
||||
|
||||
/* Screen information */
|
||||
/** Retuns the resolution, in points, for the indicated screen of the
|
||||
/** Returns the resolution, in points, for the indicated screen of the
|
||||
display. */
|
||||
- (NSSize) resolutionForScreen: (int)screen
|
||||
{
|
||||
|
@ -422,7 +423,7 @@ GSCurrentServer(void)
|
|||
return NSMakeSize(72, 72);
|
||||
}
|
||||
|
||||
/** Retuns the bounds, in pixels, for the indicated screen of the
|
||||
/** Returns the bounds, in pixels, for the indicated screen of the
|
||||
display. */
|
||||
- (NSRect) boundsForScreen: (int)screen
|
||||
{
|
||||
|
@ -481,6 +482,22 @@ GSCurrentServer(void)
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a display dependent NSImage which will be used as the background
|
||||
image for AppIcons and MiniWindows. Under Windowmaker, for example this
|
||||
could be a user specified gradient. */
|
||||
- (NSImage *) iconTileImage
|
||||
{
|
||||
return [NSImage imageNamed: @"common_Tile"];
|
||||
}
|
||||
|
||||
|
||||
/** Returns the size of icons and miniwindows for screen. */
|
||||
- (NSSize) iconSize
|
||||
{
|
||||
return NSMakeSize(64.0, 64.0);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
@ -598,7 +615,7 @@ GSCurrentServer(void)
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/** Retuns the frame of the window on the screen */
|
||||
/** Returns the frame of the window on the screen */
|
||||
- (NSRect) windowbounds: (int) win
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
|
|
@ -343,26 +343,33 @@ NSApplication *NSApp = nil;
|
|||
// Class variables
|
||||
static NSCell* dragCell = nil;
|
||||
static NSCell* tileCell = nil;
|
||||
static BOOL useWindowmakerIconBackground = NO;
|
||||
|
||||
static NSSize scaledIconSizeForSize(NSSize imageSize)
|
||||
{
|
||||
NSSize iconSize, retSize;
|
||||
|
||||
iconSize = [GSCurrentServer() iconSize];
|
||||
retSize.width = imageSize.width * iconSize.width / 64;
|
||||
retSize.height = imageSize.height * iconSize.height / 64;
|
||||
return retSize;
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSImage *defImage = [NSImage imageNamed: @"GNUstep"];
|
||||
NSImage *tileImage;
|
||||
NSSize iconSize;
|
||||
|
||||
dragCell = [[NSCell alloc] initImageCell: defImage];
|
||||
iconSize = [GSCurrentServer() iconSize];
|
||||
/* _appIconInit will set our image */
|
||||
dragCell = [[NSCell alloc] initImageCell: nil];
|
||||
[dragCell setBordered: NO];
|
||||
if ([[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSUseWindowmakerIconBackground"])
|
||||
{
|
||||
useWindowmakerIconBackground = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
tileImage = [NSImage imageNamed: @"common_Tile"];
|
||||
tileCell = [[NSCell alloc] initImageCell: tileImage];
|
||||
[tileCell setBordered: NO];
|
||||
}
|
||||
|
||||
tileImage = [[GSCurrentServer() iconTileImage] copy];
|
||||
[tileImage setScalesWhenResized: YES];
|
||||
[tileImage setSize: iconSize];
|
||||
tileCell = [[NSCell alloc] initImageCell: tileImage];
|
||||
RELEASE(tileImage);
|
||||
[tileCell setBordered: NO];
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
||||
|
@ -390,20 +397,13 @@ static BOOL useWindowmakerIconBackground = NO;
|
|||
|
||||
- (void) drawRect: (NSRect)rect
|
||||
{
|
||||
if (useWindowmakerIconBackground)
|
||||
{
|
||||
PScompositerect(_bounds.origin.x,
|
||||
_bounds.origin.y,
|
||||
_bounds.size.width,
|
||||
_bounds.size.height,
|
||||
NSCompositeClear);
|
||||
}
|
||||
else
|
||||
{
|
||||
[tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self];
|
||||
}
|
||||
NSSize iconSize = [GSCurrentServer() iconSize];
|
||||
|
||||
[tileCell drawWithFrame: NSMakeRect(0, 0, iconSize.width, iconSize.height)
|
||||
inView: self];
|
||||
[dragCell drawWithFrame: NSMakeRect(0, 0, iconSize.width, iconSize.height)
|
||||
inView: self];
|
||||
|
||||
[dragCell drawWithFrame: NSMakeRect(8,8,48,48) inView: self];
|
||||
if ([NSApp isHidden])
|
||||
{
|
||||
NSRectEdge mySides[] = {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge};
|
||||
|
@ -560,14 +560,13 @@ static BOOL useWindowmakerIconBackground = NO;
|
|||
|
||||
- (void) setImage: (NSImage *)anImage
|
||||
{
|
||||
[dragCell setImage: anImage];
|
||||
|
||||
if ([self lockFocusIfCanDraw])
|
||||
{
|
||||
[self drawRect: NSMakeRect(0,0,64,64)];
|
||||
[self unlockFocus];
|
||||
[_window flushWindow];
|
||||
}
|
||||
NSImage *imgCopy = [anImage copy];
|
||||
NSSize imageSize = [imgCopy size];
|
||||
[imgCopy setScalesWhenResized: YES];
|
||||
[imgCopy setSize: scaledIconSizeForSize(imageSize)];
|
||||
[dragCell setImage: imgCopy];
|
||||
RELEASE(imgCopy);
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -2870,20 +2869,21 @@ image.
|
|||
- _appIconInit
|
||||
{
|
||||
NSAppIconView *iv;
|
||||
NSSize iconSize = [GSCurrentServer() iconSize];
|
||||
NSRect iconRect = NSMakeRect(0, 0, iconSize.width, iconSize.height);
|
||||
|
||||
if (_app_icon == nil)
|
||||
{
|
||||
[self setApplicationIconImage: [NSImage imageNamed: @"GNUstep"]];
|
||||
}
|
||||
|
||||
_app_icon_window = [[NSIconWindow alloc] initWithContentRect:
|
||||
NSMakeRect(0,0,64,64)
|
||||
_app_icon_window = [[NSIconWindow alloc] initWithContentRect: iconRect
|
||||
styleMask: NSIconWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO
|
||||
screen: nil];
|
||||
|
||||
iv = [[NSAppIconView alloc] initWithFrame: NSMakeRect(0,0,64,64)];
|
||||
iv = [[NSAppIconView alloc] initWithFrame: iconRect];
|
||||
[iv setImage: _app_icon];
|
||||
[_app_icon_window setContentView: iv];
|
||||
RELEASE(iv);
|
||||
|
|
|
@ -342,24 +342,33 @@ has blocked and waited for events.
|
|||
@end
|
||||
|
||||
static NSCell *tileCell = nil;
|
||||
static BOOL useWindowmakerIconBackground = NO;
|
||||
|
||||
static NSSize scaledIconSizeForSize(NSSize imageSize)
|
||||
{
|
||||
NSSize iconSize, retSize;
|
||||
|
||||
iconSize = [GSCurrentServer() iconSize];
|
||||
retSize.width = imageSize.width * iconSize.width / 64;
|
||||
retSize.height = imageSize.height * iconSize.height / 64;
|
||||
return retSize;
|
||||
}
|
||||
|
||||
@implementation NSMiniWindowView
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSImage *tileImage;
|
||||
if ([[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSUseWindowmakerIconBackground"])
|
||||
{
|
||||
useWindowmakerIconBackground = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
tileImage = [NSImage imageNamed: @"common_Tile"];
|
||||
tileCell = [[NSCell alloc] initImageCell: tileImage];
|
||||
[tileCell setBordered: NO];
|
||||
}
|
||||
NSSize iconSize;
|
||||
|
||||
iconSize = [GSCurrentServer() iconSize];
|
||||
|
||||
tileImage = [[GSCurrentServer() iconTileImage] copy];
|
||||
[tileImage setScalesWhenResized: YES];
|
||||
[tileImage setSize: iconSize];
|
||||
|
||||
tileCell = [[NSCell alloc] initImageCell: tileImage];
|
||||
RELEASE(tileImage);
|
||||
[tileCell setBordered: NO];
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
||||
|
@ -376,20 +385,19 @@ static BOOL useWindowmakerIconBackground = NO;
|
|||
|
||||
- (void) drawRect: (NSRect)rect
|
||||
{
|
||||
if (useWindowmakerIconBackground)
|
||||
{
|
||||
PScompositerect(_bounds.origin.x,
|
||||
_bounds.origin.y,
|
||||
_bounds.size.width,
|
||||
_bounds.size.height,
|
||||
NSCompositeClear);
|
||||
}
|
||||
else
|
||||
{
|
||||
[tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self];
|
||||
}
|
||||
[imageCell drawWithFrame: NSMakeRect(8,4,48,48) inView: self];
|
||||
[titleCell drawWithFrame: NSMakeRect(1,52,62,11) inView: self];
|
||||
NSSize iconSize = [GSCurrentServer() iconSize];
|
||||
|
||||
[tileCell drawWithFrame: NSMakeRect(0, 0, iconSize.width, iconSize.height)
|
||||
inView: self];
|
||||
[imageCell
|
||||
drawWithFrame: NSMakeRect(iconSize.width / 8,
|
||||
(iconSize.height / 16),
|
||||
iconSize.width - ((iconSize.width / 8) * 2),
|
||||
iconSize.height - ((iconSize.height / 8) * 2))
|
||||
inView: self];
|
||||
[titleCell drawWithFrame: NSMakeRect(1, iconSize.height - 12,
|
||||
iconSize.width - 2, 11)
|
||||
inView: self];
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
|
@ -448,21 +456,22 @@ static BOOL useWindowmakerIconBackground = NO;
|
|||
|
||||
- (void) setImage: (NSImage*)anImage
|
||||
{
|
||||
NSImage *imgCopy = [anImage copy];
|
||||
|
||||
[imgCopy setScalesWhenResized: YES];
|
||||
[imgCopy setSize: scaledIconSizeForSize([imgCopy size])];
|
||||
|
||||
if (imageCell == nil)
|
||||
{
|
||||
imageCell = [[NSCell alloc] initImageCell: anImage];
|
||||
imageCell = [[NSCell alloc] initImageCell: imgCopy];
|
||||
[imageCell setBordered: NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[imageCell setImage: anImage];
|
||||
}
|
||||
if ([self lockFocusIfCanDraw])
|
||||
{
|
||||
[self drawRect: [self bounds]];
|
||||
[self unlockFocus];
|
||||
[_window flushWindow];
|
||||
[imageCell setImage: imgCopy];
|
||||
}
|
||||
RELEASE(imgCopy);
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void) setTitle: (NSString*)aString
|
||||
|
@ -483,12 +492,7 @@ static BOOL useWindowmakerIconBackground = NO;
|
|||
{
|
||||
[titleCell setStringValue: aString];
|
||||
}
|
||||
if ([self lockFocusIfCanDraw])
|
||||
{
|
||||
[self drawRect: [self bounds]];
|
||||
[self unlockFocus];
|
||||
[_window flushWindow];
|
||||
}
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -2340,6 +2344,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
- (void) miniaturize: (id)sender
|
||||
{
|
||||
GSDisplayServer *srv = GSServerForWindow(self);
|
||||
NSSize iconSize = [GSCurrentServer() iconSize];
|
||||
|
||||
if (_f.is_miniaturized
|
||||
|| (!(_styleMask & NSMiniaturizableWindowMask))
|
||||
|
@ -2363,14 +2368,15 @@ resetCursorRectsForView(NSView *theView)
|
|||
{
|
||||
NSWindow *mini;
|
||||
NSMiniWindowView *v;
|
||||
NSRect rect = NSMakeRect(0, 0, iconSize.height, iconSize.width);
|
||||
|
||||
mini = [[NSMiniWindow alloc] initWithContentRect: NSMakeRect(0,0,64,64)
|
||||
mini = [[NSMiniWindow alloc] initWithContentRect: rect
|
||||
styleMask: NSMiniWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
mini->_counterpart = [self windowNumber];
|
||||
_counterpart = [mini windowNumber];
|
||||
v = [[NSMiniWindowView alloc] initWithFrame: NSMakeRect(0,0,64,64)];
|
||||
v = [[NSMiniWindowView alloc] initWithFrame: rect];
|
||||
[v setImage: [self miniwindowImage]];
|
||||
[v setTitle: [self miniwindowTitle]];
|
||||
[mini setContentView: v];
|
||||
|
|
Loading…
Reference in a new issue