Load backend as a bundle.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9580 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-04-13 20:04:04 +00:00
parent 9007f47800
commit 1ff4d1c990
14 changed files with 793 additions and 123 deletions

View file

@ -1,3 +1,73 @@
2001-03-27 Frederic De Jaeger <dejaeger@free.fr>
* Tools/Functions.m: remove some dummy functions that are useless
now.
* Source/NSWindow.m: remove GSWraps.h
* Source/NSView.m: idem
* Source/NSScreen.m: removed declaration of
GSWindowDepthForScreen and GSAvailableDepthsForScreen.
include AppKit/NSView.h
* Source/NSGraphicsContext.m ([NSGraphicsContext
+_initializeMethodTable]): fill the gsMethodTable with the address
of the new methods
Dummy implementation of all the following functions :
NSEraseRect
NSHighlightRect
NSRectClip
NSRectClipList
NSRectFill
NSRectFillList
NSRectFillListWithGrays
NSDrawButton
NSDrawGrayBezel
NSDrawBezel
NSDrawGroove
NSDrawTiledRects
NSDrawWhiteBezel
NSDottedFrameRect
NSFrameRect
NSFrameRectWithWidth
NSReadPixel
NSCopyBitmapFromGState
NSCopyBits
NSDrawBitmap
NSBeep
GSWDefineAsUserObj
GSWViewIsFlipped
GSWindowDepthForScreen
GSAvailableDepthsForScreen
+initializeBackend
* Source/NSApplication.m:
(initialize_gnustep_backend): load the backend bundle if it is
compiled with -DBACKEND_BUNDLE and initialize it. By defaults, only
loads libgnustep-xgps, can be overrident with the GSBackend default.
Only initialize the backend otherwise.
* Source/GNUmakefile.preamble (ADDITIONAL_CPPFLAGS): add
-DBACKEND_BUNDLE=1 in case we want the backend as a bundle.
* Source/GNUmakefile (libgnustep-gui_HEADER_FILES): remove
GSWraps.h, add GStype.h
* Headers/AppKit/NSGraphicsContext.h: NSGraphicsContext(Ops)
add some methods that implements some functions of NSGraphics.
declare +initializeBackend.
* Headers/AppKit/NSGraphics.h (NSEraseRect): Replace declaration
of a bunch of backend dependant functions by inline definition of
stubs that call the new method define in NSGraphicsContext.m. The
call is done with a cached address of the method.
* Headers/AppKit/GSWraps.h: removed.
* Headers/AppKit/GSMethodTable.h: include AppKit/GStype.h,
add method that correspond to functions that are define in
AppKit/NSGraphics.h
Thu Apr 12 15:09:34 2001 Nicola Pero <nicola@brainstorm.co.uk>
* Model/GMArchiver.m ([GMUnarchiver

View file

@ -25,11 +25,13 @@
#define _GSMethodTable_h_INCLUDE
#include <Foundation/NSObject.h>
typedef int NSWindowDepth;
@class NSDate;
@class NSEvent;
@class NSGraphicsContext;
@class NSString;
@class NSColor;
typedef struct {
@ -522,6 +524,78 @@ typedef struct {
void (*DPScurrentwindowdevice__)
(NSGraphicsContext*, SEL, int, void **);
/*
* Rectangle Drawing Functions
*/
void (*NSEraseRect_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSHighlightRect_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSRectClip_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSRectClipList__)(NSGraphicsContext*, SEL, const NSRect *rects, int count);
void (*NSRectFill_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSRectFillList__)(NSGraphicsContext*, SEL, const NSRect *rects, int count);
void (*NSRectFillListWithGrays___)(NSGraphicsContext*, SEL, const NSRect *rects,
const float *grays, int count);
/*
* Draw a Bordered Rectangle
*/
void (*NSDrawButton__)(NSGraphicsContext*, SEL, const NSRect aRect, const NSRect clipRect);
void (*NSDrawGrayBezel__)(NSGraphicsContext*, SEL, const NSRect aRect, const NSRect clipRect);
void (*NSDrawBezel__)(NSGraphicsContext*, SEL, const NSRect aRect, const NSRect clipRect);
void (*NSDrawGroove__)(NSGraphicsContext*, SEL, const NSRect aRect, const NSRect clipRect);
NSRect (*NSDrawTiledRects_____)(NSGraphicsContext*, SEL, NSRect aRect, const NSRect clipRect,
const NSRectEdge *sides, const float *grays,
int count);
void (*NSDrawWhiteBezel__)(NSGraphicsContext*, SEL, const NSRect aRect, const NSRect clipRect);
void (*NSDottedFrameRect_)(NSGraphicsContext*, SEL, const NSRect aRect);
void (*NSFrameRect_)(NSGraphicsContext*, SEL, const NSRect aRect);
void (*NSFrameRectWithWidth__)(NSGraphicsContext*, SEL, const NSRect aRect, float frameWidth);
/*
* Read the Color at a Screen Position
*/
NSColor *(*NSReadPixel_)(NSGraphicsContext*, SEL, NSPoint location);
/*
* Copy an image
*/
void (*NSCopyBitmapFromGState___)(NSGraphicsContext*, SEL, int srcGstate, NSRect srcRect,
NSRect destRect);
void (*NSCopyBits___)(NSGraphicsContext*, SEL, int srcGstate, NSRect srcRect, NSPoint destPoint);
/*
* Render Bitmap Images
*/
void (*NSDrawBitmap___________)(NSGraphicsContext*, SEL, NSRect rect,
int pixelsWide,
int pixelsHigh,
int bitsPerSample,
int samplesPerPixel,
int bitsPerPixel,
int bytesPerRow,
BOOL isPlanar,
BOOL hasAlpha,
NSString *colorSpaceName,
const unsigned char *const data[5]);
/*
* Play the System Beep
*/
void (*NSBeep)(NSGraphicsContext*, SEL);
/* Context helper wraps */
unsigned int (*GSWDefineAsUserObj)(NSGraphicsContext*, SEL);
void (*GSWViewIsFlipped_)(NSGraphicsContext*, SEL, BOOL flipped);
NSWindowDepth (*GSWindowDepthForScreen_)(NSGraphicsContext*, SEL, int screen);
const NSWindowDepth *(*GSAvailableDepthsForScreen_)(NSGraphicsContext*, SEL,
int screen);
} gsMethodTable;
#endif

View file

@ -1,32 +0,0 @@
/* GSWraps.h - Definitions of PostScript wraps for NSGraphicsContext
Copyright (C) 1999 Free Software Foundation, Inc.
Written by: Adam Fedor <fedor@gnu.org>
This file is part of the GNU Objective C User Interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
*/
#ifndef _GSWraps_h_INCLUDE
#define _GSWraps_h_INCLUDE
#include <AppKit/NSGraphicsContext.h>
/* Context helper wraps */
extern unsigned int GSWDefineAsUserObj(NSGraphicsContext *ctxt);
extern void GSWViewIsFlipped(NSGraphicsContext *ctxt, BOOL flipped);
#endif

View file

@ -28,6 +28,10 @@
#include <Foundation/NSObject.h>
#include <Foundation/NSGeometry.h>
#include <AppKit/NSGraphicsContext.h>
@class NSString;
@class NSColor;
@class NSGraphicsContext;
@ -45,7 +49,6 @@ extern NSString *NSDeviceCMYKColorSpace;
extern NSString *NSNamedColorSpace;
extern NSString *NSCustomColorSpace;
typedef int NSWindowDepth;
/*
* Color function externs
@ -83,32 +86,6 @@ extern NSString *NSDeviceIsScreen;
extern NSString *NSDeviceIsPrinter;
extern NSString *NSDeviceSize;
/*
* Rectangle Drawing Functions
*/
void NSEraseRect(NSRect aRect);
void NSHighlightRect(NSRect aRect);
void NSRectClip(NSRect aRect);
void NSRectClipList(const NSRect *rects, int count);
void NSRectFill(NSRect aRect);
void NSRectFillList(const NSRect *rects, int count);
void NSRectFillListWithGrays(const NSRect *rects,
const float *grays, int count);
/*
* Draw a Bordered Rectangle
*/
void NSDrawButton(const NSRect aRect, const NSRect clipRect);
void NSDrawGrayBezel(const NSRect aRect, const NSRect clipRect);
void NSDrawGroove(const NSRect aRect, const NSRect clipRect);
NSRect NSDrawTiledRects(NSRect aRect, const NSRect clipRect,
const NSRectEdge *sides, const float *grays,
int count);
void NSDrawWhiteBezel(const NSRect aRect, const NSRect clipRect);
void NSDottedFrameRect(const NSRect aRect);
void NSFrameRect(const NSRect aRect);
void NSFrameRectWithWidth(const NSRect aRect, float frameWidth);
/*
* Get Information About Color Space and Window Depth
*/
@ -122,36 +99,6 @@ NSString *NSColorSpaceFromDepth(NSWindowDepth depth);
int NSNumberOfColorComponents(NSString *colorSpaceName);
BOOL NSPlanarFromDepth(NSWindowDepth depth);
/*
* Read the Color at a Screen Position
*/
NSColor *NSReadPixel(NSPoint location);
/*
* Copy an image
*/
void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect);
void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint);
/*
* Render Bitmap Images
*/
void NSDrawBitmap(NSRect rect,
int pixelsWide,
int pixelsHigh,
int bitsPerSample,
int samplesPerPixel,
int bitsPerPixel,
int bytesPerRow,
BOOL isPlanar,
BOOL hasAlpha,
NSString *colorSpaceName,
const unsigned char *const data[5]);
/*
* Play the System Beep
*/
void NSBeep(void);
/*
* Functions for getting information about windows.
@ -159,13 +106,231 @@ void NSBeep(void);
void NSCountWindows(int *count);
void NSWindowList(int size, int list[]);
static inline void
NSEraseRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSEraseRect_)
(ctxt, @selector(NSEraseRect:), aRect);
}
static inline void
NSHighlightRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSHighlightRect_)
(ctxt, @selector(NSHighlightRect:), aRect);
}
static inline void
NSRectClip(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectClip_)
(ctxt, @selector(NSRectClip:), aRect);
}
static inline void
NSRectClipList(const NSRect *rects, int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectClipList__)
(ctxt, @selector(NSRectClipList::), rects, count);
}
static inline void
NSRectFill(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectFill_)
(ctxt, @selector(NSRectFill:), aRect);
}
static inline void
NSRectFillList(const NSRect *rects, int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectFillList__)
(ctxt, @selector(NSRectFillList::), rects, count);
}
static inline void
NSRectFillListWithGrays(const NSRect *rects,const float *grays,int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectFillListWithGrays___)
(ctxt, @selector(NSRectFillListWithGrays:::), rects, grays, count);
}
static inline void
NSDrawButton(const NSRect aRect, const NSRect clipRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDrawButton__)
(ctxt, @selector(NSDrawButton::), aRect, clipRect);
}
static inline void
NSDrawGrayBezel(const NSRect aRect, const NSRect clipRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDrawGrayBezel__)
(ctxt, @selector(NSDrawGrayBezel::), aRect, clipRect);
}
static inline void
NSDrawGroove(const NSRect aRect, const NSRect clipRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDrawGroove__)
(ctxt, @selector(NSDrawGroove::), aRect, clipRect);
}
static inline void
NSDrawWhiteBezel(const NSRect aRect, const NSRect clipRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDrawWhiteBezel__)
(ctxt, @selector(NSDrawWhiteBezel::), aRect, clipRect);
}
static inline void
NSDrawBezel(NSRect aRect, NSRect clipRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDrawGrayBezel__)
(ctxt, @selector(NSDrawGrayBezel::), aRect, clipRect);
}
static inline NSRect
NSDrawTiledRects(NSRect boundsRect, NSRect clipRect,
const NSRectEdge *sides, const float *grays, int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
return (ctxt->methods->NSDrawTiledRects_____)
(ctxt, @selector(NSDrawTiledRects:::::), boundsRect, clipRect,
sides, grays, count);
}
static inline void
NSDottedFrameRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDottedFrameRect_)
(ctxt, @selector(NSDottedFrameRect:), aRect);
}
static inline void
NSFrameRect(const NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSFrameRect_)
(ctxt, @selector(NSFrameRect:), aRect);
}
static inline void
NSFrameRectWithWidth(const NSRect aRect, float frameWidth)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSFrameRectWithWidth__)
(ctxt, @selector(NSFrameRectWithWidth::), aRect, frameWidth);
}
static inline NSColor*
NSReadPixel(NSPoint location)
{
NSGraphicsContext *ctxt = GSCurrentContext();
return (ctxt->methods->NSReadPixel_)
(ctxt, @selector(NSReadPixel:), location);
}
static inline void
NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSCopyBitmapFromGState___)
(ctxt, @selector(NSCopyBitmapFromGState:::), srcGstate, srcRect, destRect);
}
static inline void
NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSCopyBits___)
(ctxt, @selector(NSCopyBits:::), srcGstate, srcRect, destPoint);
}
static inline void
NSDrawBitmap(NSRect rect,
int pixelsWide,
int pixelsHigh,
int bitsPerSample,
int samplesPerPixel,
int bitsPerPixel,
int bytesPerRow,
BOOL isPlanar,
BOOL hasAlpha,
NSString *colorSpaceName,
const unsigned char *const data[5])
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDrawBitmap___________)
(ctxt, @selector(NSDrawBitmap:::::::::::), rect,
pixelsWide,
pixelsHigh,
bitsPerSample,
samplesPerPixel,
bitsPerPixel,
bytesPerRow,
isPlanar,
hasAlpha,
colorSpaceName,
data);
}
static inline void
NSBeep(void)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSBeep)
(ctxt, @selector(NSBeep));
}
static inline unsigned int
GSWDefineAsUserObj(NSGraphicsContext *ctxt)
{
return (ctxt->methods->GSWDefineAsUserObj)
(ctxt, @selector(GSWDefineAsUserObj));
}
static inline void
GSWViewIsFlipped(NSGraphicsContext *ctxt, BOOL flipped)
{
(ctxt->methods->GSWViewIsFlipped_)
(ctxt, @selector(GSWViewIsFlipped::), flipped);
}
static inline NSWindowDepth
GSWindowDepthForScreen(NSGraphicsContext *ctxt, int screen_num)
{
return (ctxt->methods->GSWindowDepthForScreen_)
(ctxt, @selector(GSWindowDepthForScreen::), screen_num);
}
static inline const NSWindowDepth*
GSAvailableDepthsForScreen(NSGraphicsContext *ctxt, int screen_num)
{
return (ctxt->methods->GSAvailableDepthsForScreen_)
(ctxt, @selector(GSAvailableDepthsForScreen::), screen_num);
}
#ifndef NO_GNUSTEP
@class NSArray;
@class NSWindow;
NSArray* GSAllWindows();
NSWindow* GSWindowWithNumber(int num);
#endif
#endif /* __NSGraphics_h__ */

View file

@ -34,8 +34,9 @@
#include <Foundation/NSMapTable.h>
#include <Foundation/NSSet.h>
#include <AppKit/GSMethodTable.h>
#include <AppKit/NSDragging.h>
#include <AppKit/GSMethodTable.h>
@class NSDate;
@class NSDictionary;
@ -45,6 +46,9 @@
@class NSString;
@class NSView;
@class NSWindow;
@class NSGraphicsContext;
/*
* Backing Store Types
@ -166,7 +170,8 @@ NSGraphicsContext *GSCurrentContext();
*/
@interface NSGraphicsContext (Ops)
/* initialize the backend */
+ (void)initializeBackend;
/* ----------------------------------------------------------------------- */
/* Color operations */
/* ----------------------------------------------------------------------- */
@ -439,6 +444,70 @@ NSGraphicsContext *GSCurrentContext();
- (void) DPScurrentserverdevice: (void **)serverptr;
- (void) DPScurrentwindowdevice: (int)win : (void **)windowptr;
/* ----------------------------------------------------------------------- */
/* NSGraphics Ops */
/* ----------------------------------------------------------------------- */
/*
* Rectangle Drawing Functions
*/
- (void) NSEraseRect: (NSRect) aRect;
- (void) NSHighlightRect: (NSRect) aRect;
- (void) NSRectClip: (NSRect) aRect;
- (void) NSRectClipList: (const NSRect *)rects : (int) count;
- (void) NSRectFill: (NSRect) aRect;
- (void) NSRectFillList: (const NSRect *)rects : (int) count;
- (void) NSRectFillListWithGrays: (const NSRect *)rects : (const float *)grays
:(int) count;
/*
* Draw a Bordered Rectangle
*/
- (void) NSDrawButton: (const NSRect) aRect : (const NSRect) clipRect;
- (void) NSDrawGrayBezel: (const NSRect) aRect : (const NSRect) clipRect;
- (void) NSDrawBezel: (const NSRect) aRect : (const NSRect) clipRect;
- (void) NSDrawGroove: (const NSRect) aRect : (const NSRect) clipRect;
- (NSRect) NSDrawTiledRects: (NSRect) aRect : (const NSRect) clipRect
: (const NSRectEdge *) sides
: (const float *)grays : (int) count;
- (void) NSDrawWhiteBezel: (const NSRect) aRect : (const NSRect) clipRect;
- (void) NSDottedFrameRect: (const NSRect) aRect;
- (void) NSFrameRect: (const NSRect) aRect;
- (void) NSFrameRectWithWidth: (const NSRect) aRect : (float) frameWidth;
/*
* Read the Color at a Screen Position
*/
- (NSColor *) NSReadPixel: (NSPoint) location;
/*
* Copy an image
*/
- (void) NSCopyBitmapFromGState: (int) srcGstate: (NSRect) srcRect
: (NSRect) destRect;
- (void) NSCopyBits: (int) srcGstate : (NSRect) srcRect : (NSPoint) destPoint;
/*
* Render Bitmap Images
*/
- (void) NSDrawBitmap: (NSRect) rect : (int) pixelsWide : (int) pixelsHigh
: (int) bitsPerSample : (int) samplesPerPixel
: (int) bitsPerPixel : (int) bytesPerRow : (BOOL) isPlanar
: (BOOL) hasAlpha : (NSString *) colorSpaceName
: (const unsigned char *const [5]) data;
/*
* Play the System Beep
*/
- (void) NSBeep;
/* Context helper wraps */
- (unsigned int) GSWDefineAsUserObj;
- (void) GSWViewIsFlipped: (BOOL) flipped;
- (NSWindowDepth) GSWindowDepthForScreen: (int) screen;
- (const NSWindowDepth *) GSAvailableDepthsForScreen: (int) screen;
@end
#endif /* _NSGraphicsContext_h_INCLUDE */

View file

@ -173,7 +173,6 @@ GSMethodTable.h \
GSPasteboardServer.h \
GSServicesManager.h \
GSTrackingRect.h \
GSWraps.h \
GSHelpManagerPanel.h \
GSTable.h \
GSHbox.h \

View file

@ -52,6 +52,11 @@ ADDITIONAL_CPPFLAGS = -DGNUSTEP_INSTALL_LIBDIR=\"$(GNUSTEP_INSTALL_LIBDIR)\" \
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
ifneq ($(BACKEND_BUNDLE),)
ADDITIONAL_CPPFLAGS += -DBACKEND_BUNDLE=1
endif
BISON_FLAGS = -d -p GSRTF
BISON = BISON_SIMPLE=Parsers/bison.simple bison

View file

@ -45,6 +45,9 @@
#include <Foundation/NSProcessInfo.h>
#include <Foundation/NSFileManager.h>
#include <Foundation/NSUserDefaults.h>
/*GG :
*/
#include <Foundation/NSBundle.h>
#ifndef LIB_FOUNDATION_LIBRARY
# include <Foundation/NSConnection.h>
@ -71,6 +74,7 @@
#include <AppKit/NSDataLinkPanel.h>
#include <AppKit/NSHelpPanel.h>
/*
* Base library exception handler
*/
@ -123,6 +127,62 @@ _NSAppKitUncaughtExceptionHandler (NSException *exception)
NSSetUncaughtExceptionHandler (_NSAppKitUncaughtExceptionHandler);
}
/* GG :
*/
@interface GSBackend : NSGraphicsContext
{}
+ (void) initializeBackend;
@end
BOOL
initialize_gnustep_backend(void)
{
static int first = 1;
if( first )
{
first = 0;
#ifdef BACKEND_BUNDLE
{
NSBundle *theBundle;
NSEnumerator *benum;
NSString *path, *bundleName;
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
/* What backend ? */
bundleName = [defs stringForKey: @"GSBackend"];
if ( bundleName == nil )
bundleName = @"libgnustep-xgps.bundle";
else
bundleName = [bundleName stringByAppendingString: @".bundle"];
NSDebugFLLog(@"BackendBundle", @"Looking for %@", bundleName);
/* Find the backend bundle */
benum = [NSStandardLibraryPaths() objectEnumerator];
while ((path = [benum nextObject]))
{
path = [path stringByAppendingPathComponent: @"Bundles"];
path = [path stringByAppendingPathComponent: bundleName];
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
break;
path = nil;
}
NSCAssert(path != nil, @"Unable to load backend, aborting");
NSDebugLog(@"Loading Backend from %@", path);
theBundle = [NSBundle bundleWithPath: path];
NSCAssert(theBundle != nil, @"Can't init backend bundle");
[[theBundle classNamed: @"GSBackend"] initializeBackend];
}
#else
[GSBackend initializeBackend];
#endif
}
return YES;
}
/*
* Types
*/
@ -411,6 +471,9 @@ static NSCell* tileCell = nil;
our window server, so if someone wants to query information that might
require the backend, they just need to instantiate a sharedApplication
*/
/* GG : Load the xgps bundle
*/
initialize_gnustep_backend();
self = [super init];

View file

@ -836,6 +836,88 @@ NSGraphicsContext *GSCurrentContext()
methodTable.DPScurrentwindowdevice__ =
GET_IMP(@selector(DPScurrentwindowdevice::));
/*
* Rectangle Drawing Functions
*/
methodTable.NSEraseRect_ =
GET_IMP(@selector(NSEraseRect:));
methodTable.NSHighlightRect_ =
GET_IMP(@selector(NSHighlightRect:));
methodTable.NSRectClip_ =
GET_IMP(@selector(NSRectClip:));
methodTable.NSRectClipList__ =
GET_IMP(@selector(NSRectClipList::));
methodTable.NSRectFill_ =
GET_IMP(@selector(NSRectFill:));
methodTable.NSRectFillList__ =
GET_IMP(@selector(NSRectFillList::));
methodTable.NSRectFillListWithGrays___ =
GET_IMP(@selector(NSRectFillListWithGrays:::));
/*
* Draw a Bordered Rectangle
*/
methodTable.NSDrawButton__ =
GET_IMP(@selector(NSDrawButton::));
methodTable.NSDrawGrayBezel__ =
GET_IMP(@selector(NSDrawGrayBezel::));
methodTable.NSDrawBezel__ =
GET_IMP(@selector(NSDrawBezel::));
methodTable.NSDrawGroove__ =
GET_IMP(@selector(NSDrawGroove::));
methodTable.NSDrawTiledRects_____ =
GET_IMP(@selector(NSDrawTiledRects:::::));
methodTable.NSDrawWhiteBezel__ =
GET_IMP(@selector(NSDrawWhiteBezel::));
methodTable.NSDottedFrameRect_ =
GET_IMP(@selector(NSDottedFrameRect:));
methodTable.NSFrameRect_ =
GET_IMP(@selector(NSFrameRect:));
methodTable.NSFrameRectWithWidth__ =
GET_IMP(@selector(NSFrameRectWithWidth::));
/*
* Read the Color at a Screen Position
*/
methodTable.NSReadPixel_ =
GET_IMP(@selector(NSReadPixel:));
/*
* Copy an image
*/
methodTable.NSCopyBitmapFromGState___ =
GET_IMP(@selector(NSCopyBitmapFromGState:::));
methodTable.NSCopyBits___ =
GET_IMP(@selector(NSCopyBits:::));
/*
* Render Bitmap Images
*/
methodTable.NSDrawBitmap___________ =
GET_IMP(@selector(NSDrawBitmap:::::::::::));
/*
* Play the System Beep
*/
methodTable.NSBeep =
GET_IMP(@selector(NSBeep));
/* Context helper wraps */
methodTable.GSWDefineAsUserObj =
GET_IMP(@selector(GSWDefineAsUserObj));
methodTable.GSWViewIsFlipped_ =
GET_IMP(@selector(GSWViewIsFlipped:));
methodTable.GSWindowDepthForScreen_ =
GET_IMP(@selector(GSWindowDepthForScreen:));
methodTable.GSAvailableDepthsForScreen_ =
GET_IMP(@selector(GSAvailableDepthsForScreen:));
mptr = NSZoneMalloc(_globalGSZone, sizeof(gsMethodTable));
memcpy(mptr, &methodTable, sizeof(gsMethodTable));
return mptr;
@ -2331,4 +2413,176 @@ NSGraphicsContext *GSCurrentContext()
[self subclassResponsibility: _cmd];
}
/* ----------------------------------------------------------------------- */
/* NSGraphics Ops */
/* ----------------------------------------------------------------------- */
/*
* Rectangle Drawing Functions
*/
- (void) NSEraseRect: (NSRect) aRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSHighlightRect: (NSRect) aRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSRectClip: (NSRect) aRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSRectClipList: (const NSRect *)rects : (int) count
{
[self subclassResponsibility: _cmd];
}
- (void) NSRectFill: (NSRect) aRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSRectFillList: (const NSRect *)rects : (int) count
{
[self subclassResponsibility: _cmd];
}
- (void) NSRectFillListWithGrays: (const NSRect *)rects : (const float *)grays
:(int) count
{
[self subclassResponsibility: _cmd];
}
/*
* Draw a Bordered Rectangle
*/
- (void) NSDrawButton: (const NSRect) aRect : (const NSRect) clipRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSDrawGrayBezel: (const NSRect) aRect : (const NSRect) clipRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSDrawBezel: (const NSRect) aRect : (const NSRect) clipRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSDrawGroove: (const NSRect) aRect : (const NSRect) clipRect
{
[self subclassResponsibility: _cmd];
}
- (NSRect) NSDrawTiledRects: (NSRect) aRect : (const NSRect) clipRect
: (const NSRectEdge *) sides
: (const float *)grays : (int) count
{
[self subclassResponsibility: _cmd];
return NSZeroRect;
}
- (void) NSDrawWhiteBezel: (const NSRect) aRect : (const NSRect) clipRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSDottedFrameRect: (const NSRect) aRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSFrameRect: (const NSRect) aRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSFrameRectWithWidth: (const NSRect) aRect : (float) frameWidth
{
[self subclassResponsibility: _cmd];
}
/*
* Read the Color at a Screen Position
*/
- (NSColor *) NSReadPixel: (NSPoint) location
{
[self subclassResponsibility: _cmd];
return nil;
}
/*
* Copy an image
*/
- (void) NSCopyBitmapFromGState: (int) srcGstate: (NSRect) srcRect
: (NSRect) destRect
{
[self subclassResponsibility: _cmd];
}
- (void) NSCopyBits: (int) srcGstate : (NSRect) srcRect : (NSPoint) destPoint
{
[self subclassResponsibility: _cmd];
}
/*
* Render Bitmap Images
*/
- (void) NSDrawBitmap: (NSRect) rect : (int) pixelsWide : (int) pixelsHigh
: (int) bitsPerSample : (int) samplesPerPixel
: (int) bitsPerPixel : (int) bytesPerRow : (BOOL) isPlanar
: (BOOL) hasAlpha : (NSString *) colorSpaceName
: (const unsigned char *const [5]) data
{
[self subclassResponsibility: _cmd];
}
/*
* Play the System Beep
*/
- (void) NSBeep
{
[self subclassResponsibility: _cmd];
}
/* Context helper wraps */
- (unsigned int) GSWDefineAsUserObj
{
[self subclassResponsibility: _cmd];
return 0;
}
- (void) GSWViewIsFlipped: (BOOL) flipped
{
[self subclassResponsibility: _cmd];
}
- (NSWindowDepth) GSWindowDepthForScreen: (int) screen
{
[self subclassResponsibility: _cmd];
return 0;
}
- (const NSWindowDepth *) GSAvailableDepthsForScreen: (int) screen
{
[self subclassResponsibility: _cmd];
return NULL;
}
+ (void) initializeBackend
{
[self subclassResponsibility: _cmd];
}
@end

View file

@ -43,9 +43,7 @@
/*
* Forward references
*/
NSWindowDepth GSWindowDepthForScreen(NSGraphicsContext *ctxt, int screen);
const NSWindowDepth *GSAvailableDepthsForScreen(NSGraphicsContext *ctxt,
int screen);
#include <AppKit/NSGraphics.h>
/*
* Returns a list of the screens attached to the system.

View file

@ -50,7 +50,7 @@
#include <AppKit/NSView.h>
#include <AppKit/NSWindow.h>
#include <AppKit/GSTrackingRect.h>
#include <AppKit/GSWraps.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/PSOperators.h>
#include <AppKit/NSAffineTransform.h>
#include <AppKit/NSScrollView.h>

View file

@ -63,7 +63,6 @@
#include <AppKit/NSHelpManager.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/GSWraps.h>
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);

View file

@ -26,13 +26,41 @@
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSCStringText.h>
#include <AppKit/NSEvent.h>
#include <AppKit/GSWraps.h>
/*
* Dummy definitions provided here to avoid errors when not linking with
* a back end.
*/
@interface GMModel : NSObject
@end
@implementation GMModel
@end
@interface GMUnarchiver : NSObject
@end
@implementation GMUnarchiver
@end
@interface NSWindowView : NSObject
@end
@implementation NSWindowView
@end
@interface GPSDrawContext : NSObject
@end
@implementation GPSDrawContext
@end
/*
* Should not be needed anymore
*/
#if 0
BOOL initialize_gnustep_backend(void)
{
return YES;
@ -64,29 +92,6 @@ void NSDottedFrameRect(NSRect aRect)
unsigned int GSWDefineAsUserObj(NSGraphicsContext *ctxt) {return 0;}
void GSWViewIsFlipped(NSGraphicsContext *ctxt, BOOL flipped) {}
@interface GMModel : NSObject
@end
@implementation GMModel
@end
@interface GMUnarchiver : NSObject
@end
@implementation GMUnarchiver
@end
@interface NSWindowView : NSObject
@end
@implementation NSWindowView
@end
@interface GPSDrawContext : NSObject
@end
@implementation GPSDrawContext
@end
void NSDrawWhiteBezel(NSRect aRect, NSRect clipRect)
@ -284,3 +289,4 @@ float NSLinkFrameThickness(void)
NSWindowDepth GSWindowDepthForScreen(int screen) {}
const NSWindowDepth *GSAvailableDepthsForScreen(int screen) {}
#endif

View file

@ -1,4 +1,4 @@
#
# -*-makefile-*-
# gui.make
#
# Makefile flags and configs to build with the gui library.