Move and install resources to more appropriate place.

Minor fixes.
Incorporate Adam Fedor's NSImage patches.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2070 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Scott Christley 1997-01-31 13:40:15 +00:00
parent e3dde2fd9a
commit 9211409e28
24 changed files with 145 additions and 158 deletions

View file

@ -39,6 +39,7 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
gnustep_libdir = $(libdir)/gnustep
includedir = @includedir@
bindir = @bindir@
@ -47,6 +48,7 @@ MAKEDEFINES =
CC = @CC@ -g
CPPFLAGS = @CPPFLAGS@
CFLAGS = -c $(GCCFLAGS) -I../Headers $(CPPFLAGS)
DEFS = -DGNUSTEP_INSTALL_LIBDIR=$(gnustep_libdir) @DEFS@
GCC_LIB =
OBJC_LIB = -lobjc
@ -164,17 +166,6 @@ GNUSTEP_DPS_HEADERS = dps/NSDPSContext.h \
dps/DPSOperators.h \
dps/TypesandConstants.h
GNUSTEP_RESOURCE = gui/common_ArrowDown.tiff \
gui/common_ArrowLeft.tiff \
gui/common_ArrowRight.tiff \
gui/common_ArrowUp.tiff \
gui/common_Dimple.tiff \
gui/common_RadioOff.tiff \
gui/common_RadioOn.tiff \
gui/common_SwitchOff.tiff \
gui/common_SwitchOn.tiff \
gui/common_ret.tiff
OBJS_WITHOUT_INIT = $(MAIN_FILE)$(oext) \
NSActionCell$(oext) \
NSApplication$(oext) \
@ -249,9 +240,9 @@ OBJS = $(OBJS_WITHOUT_INIT)
.SUFFIXES: .m
.m$(oext):
$(CC) $(CFLAGS) $<
$(CC) $(CFLAGS) $(DEFS) $<
.c$(oext):
$(CC) $(CFLAGS) $<
$(CC) $(CFLAGS) $(DEFS) $<
#
# libraries
@ -266,9 +257,9 @@ all: header_links src
header_links:
-rm -rf ../Headers/AppKit
cp -r ../Headers/gnustep/gui ../Headers/AppKit
$(LN_S) ../Headers/gnustep/gui ../Headers/AppKit
-rm -rf ../Headers/DPSClient
cp -r ../Headers/gnustep/dps ../Headers/DPSClient
$(LN_S) ../Headers/gnustep/dps ../Headers/DPSClient
src: $(MAIN_FILE)$(libext)
@ -286,14 +277,12 @@ $(INIT_FILE_OBJ): $(OBJS_WITHOUT_INIT)
$(CC) $(CFLAGS) $(INIT_FILE).c
rm tmpinit.c
install: installdirs install-lib install-headers install-resource
install: installdirs install-lib install-headers
installdirs:
$(srcdir)/../mkinstalldirs \
$(libdir) \
$(libdir)/gnustep \
$(libdir)/gnustep/resource \
$(libdir)/gnustep/resource/gui \
$(includedir)/gnustep \
$(includedir)/gnustep/dps \
$(includedir)/gnustep/gui
@ -319,14 +308,8 @@ install-headers:
$(INSTALL_DATA) ../Headers/gnustep/$$file \
$(includedir)/gnustep/$$file ; \
done
cd $(includedir); rm -rf AppKit; cp -r ./gnustep/gui ./AppKit
cd $(includedir); rm -rf DPSClient; cp -r ./gnustep/dps ./DPSClient
install-resource:
for file in $(GNUSTEP_RESOURCE); do \
$(INSTALL_DATA) ../Headers/gnustep/resource/$$file \
$(libdir)/gnustep/resource/$$file ; \
done
cd $(includedir); rm -rf AppKit; $(LN_S) ./gnustep/gui ./AppKit
cd $(includedir); rm -rf DPSClient; $(LN_S) ./gnustep/dps ./DPSClient
# end of install targets
uninstall:
@ -335,7 +318,6 @@ uninstall:
rm -rf $(includedir)/AppKit
rm -rf $(includedir)/DPSClient
rm -rf $(libdir)/$(MAIN_FILE)$(libext)
rm -rf $(libdir)/gnustep/resource/gui
#
# Cleaning

View file

@ -284,15 +284,14 @@
{
unsigned char *planes[MAX_PLANES];
[self getBitmapDataPlanes: planes];
return (unsigned char *)[imageData mutableBytes];
// return planes[0];
return planes[0];
}
- (void) getBitmapDataPlanes: (unsigned char **)data
{
int i;
if (!imagePlanes)
if (!imagePlanes || !imagePlanes[0])
{
long length;
unsigned char* bits;

View file

@ -63,6 +63,7 @@
- initImageCell:(NSImage *)anImage
{
[super initImageCell:anImage];
contents = @"Button";
cell_type = NSMomentaryPushButton;
[self setEnabled:YES];
transparent = NO;
@ -73,7 +74,6 @@
- initTextCell:(NSString *)aString
{
[super initTextCell:aString];
support = [NSFont userFontOfSize:12];
alt_contents = @"Button";
cell_type = NSMomentaryPushButton;
[self setEnabled:YES];

View file

@ -63,6 +63,8 @@
{
[super init];
cell_type = NSNullCellType;
cell_image = nil;
cell_font = nil;
image_position = NSNoImage;
cell_state = NO;
cell_highlighted = NO;
@ -87,9 +89,10 @@
if (![anImage isKindOfClass:[NSImage class]])
return nil;
support = anImage;
cell_type = NSImageCellType;
cell_image = anImage;
image_position = NSImageOnly;
cell_font = [NSFont userFontOfSize:12];
cell_state = NO;
cell_highlighted = NO;
cell_enabled = YES;
@ -113,10 +116,11 @@
//if (![aString isKindOfClass:[NSString class]])
// return nil;
support = [NSFont userFontOfSize:12];
cell_font = [NSFont userFontOfSize:12];
contents = aString;
cell_type = NSTextCellType;
text_align = NSLeftTextAlignment;
cell_image = nil;
image_position = NSNoImage;
cell_state = NO;
cell_highlighted = NO;
@ -208,10 +212,7 @@
//
- (NSImage *)image
{
if (cell_type == NSImageCellType)
return support;
else
return nil;
return cell_image;
}
- (void)setImage:(NSImage *)anImage
@ -220,9 +221,8 @@
if (![anImage isKindOfClass:[NSImage class]])
return;
// Only set the image if we are an image cell
if (cell_type == NSImageCellType)
support = anImage;
// Only set the image if we are an image cell
cell_image = anImage;
}
//
@ -330,10 +330,7 @@
- (NSFont *)font
{
if ([support isKindOfClass:[NSFont class]])
return support;
else
return nil;
return cell_font;
}
- (BOOL)isEditable
@ -370,9 +367,7 @@
if (![fontObject isKindOfClass:[NSFont class]])
return;
// Only set the font if we are a text cell
if ([support isKindOfClass:[NSFont class]])
support = fontObject;
cell_font = fontObject;
}
- (void)setSelectable:(BOOL)flag
@ -741,7 +736,8 @@
[super encodeWithCoder:aCoder];
[aCoder encodeObject: contents];
[aCoder encodeObject: support];
[aCoder encodeObject: cell_image];
[aCoder encodeObject: cell_font];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_state];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_highlighted];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &cell_enabled];
@ -766,7 +762,8 @@
[super initWithCoder:aDecoder];
contents = [aDecoder decodeObject];
support = [aDecoder decodeObject];
cell_image = [aDecoder decodeObject];
cell_font = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_state];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_highlighted];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &cell_enabled];

View file

@ -33,9 +33,16 @@
// Initializing a New Instance
+ (id) imageRepWithData: (NSData *)epsData
{
// [self notImplemented: _cmd];
return [[self alloc] init];
//[self notImplemented: _cmd];
return nil;
}
+ (NSArray *) imageRepsWithData: (NSData *)epsData
{
//[self notImplemented: _cmd];
return nil;
}
- (id) initWithData: (NSData *)epsData
{
[self notImplemented: _cmd];

View file

@ -43,6 +43,10 @@
#include <Foundation/NSBundle.h>
#include <string.h>
#ifndef NSImage_PATH
#define NSImage_PATH OBJC_STRINGIFY(GNUSTEP_INSTALL_LIBDIR) @"/Images"
#endif
/* Backend protocol - methods that must be implemented by the backend to
complete the class */
@protocol NSImageBackend
@ -155,27 +159,65 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
if (!nameDict || ![nameDict objectForKey:aName])
{
NSString* ext;
NSString* path;
NSString* path = nil;
NSBundle* main;
main = [NSBundle mainBundle];
ext = extension(aName);
NSLog(@"search locally\n");
NSLog(@"extension is %s\n", [ext cString]);
/* First search locally */
if (ext)
path = [main pathForResource: aName ofType: ext];
else
{
int i, count;
id o, e;
NSArray* array;
array = [self imageFileTypes];
count = [array count];
for (i = 0; i < count; i++)
if (!array)
NSLog(@"array is nil\n");
e = [array objectEnumerator];
while ((o = [e nextObject]))
{
NSLog(@"extension %s\n", [o cString]);
path = [main pathForResource:aName
ofType: [array objectAtIndex: i]];
ofType: o];
if ([path length] != 0)
break;
}
}
/* If not found then search in system */
if (!path)
{
if (ext)
path = [NSBundle pathForResource: aName
ofType: ext
inDirectory: NSImage_PATH
withVersion: 0];
else
{
id o, e;
NSArray* array;
array = [self imageFileTypes];
if (!array)
NSLog(@"array is nil\n");
e = [array objectEnumerator];
while ((o = [e nextObject]))
{
NSLog(@"extension %s\n", [o cString]);
path = [NSBundle pathForResource: aName
ofType: o
inDirectory: NSImage_PATH
withVersion: 0];
if ([path length] != 0)
break;
}
}
}
if ([path length] != 0)
{
NSImage* image = [[NSImage alloc] initByReferencingFile:path];
@ -593,7 +635,7 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
if (!ext)
return NO;
array = [[self class] imageFileTypes];
if (![array indexOfObject: ext])
if ([array indexOfObject: ext] == NSNotFound)
return NO;
repd.fileName = [fileName retain];
[_reps addObject: [NSValue value: &repd withObjCType: @encode(rep_data_t)]];
@ -906,7 +948,7 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
obj = [e1 nextObject];
while (obj)
{
if (![types indexOfObject: obj])
if ([types indexOfObject: obj] == NSNotFound)
[types addObject: obj];
obj = [e1 nextObject];
}

View file

@ -77,7 +77,7 @@
background_color = [NSColor whiteColor];
text_color = [NSColor blackColor];
support = [NSFont systemFontOfSize:12];
cell_font = [NSFont systemFontOfSize:12];
return self;
}