diff --git a/ChangeLog b/ChangeLog index 59583821c..cede733b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Wed Oct 29 12:22:22 1997 Ovidiu Predescu + + Bug fixes for NSForm and NSFormCell from Benhur Stein + . + * Headers/gnustep/gui/NSFormCell.h: The text field cell is keeping the + value now not the title. Changed drawInteriorWithFrame:inView: to + drawWithFrame:inView:. + * Source/NSForm.m: Likewise. + * Source/NSFormCell.m: Likewise. + (drawInteriorWithFrame:inView:): Changed to drawWithFrame:inView:. + * Source/NSCell.m (init): Make a text cell by default. + (_init): Invoke super's init. + * Source/NSView.m (opaqueAncestor): Implemented. + (visibleRect): Intersect the super view's visible rectangle with the + receiver's bounds instead of the receiver's frame. + + * GNUmakefile: Fixed typo. + * Source/GNUmakefile: Changed the name of the variables to work with + the new multi-library building capabilities of library.make. + Tue Oct 28 11:24:40 1997 Ovidiu Predescu * Makefile: Changed to GNUmakefile. diff --git a/GNUmakefile b/GNUmakefile index 9dec46f4c..5a37e50c2 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -32,7 +32,7 @@ include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/common.make # # The list of subproject directories # -SUBPROJECTS = Source Images Tools +SUBPROJECTS = Source Images Testing -include GNUmakefile.preamble diff --git a/Headers/gnustep/gui/NSFormCell.h b/Headers/gnustep/gui/NSFormCell.h index 6e01b549d..9240d625a 100644 --- a/Headers/gnustep/gui/NSFormCell.h +++ b/Headers/gnustep/gui/NSFormCell.h @@ -31,12 +31,10 @@ #include -@class NSTextFieldCell; - @interface NSFormCell : NSActionCell { float titleWidth; - NSTextFieldCell* textCell; + NSCell* titleCell; } // @@ -60,8 +58,8 @@ // // Displaying // -- (void)drawInteriorWithFrame:(NSRect)cellFrame - inView:(NSView*)controlView; +- (void)drawWithFrame:(NSRect)cellFrame + inView:(NSView*)controlView; // // NSCoding protocol diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 432fb6793..a2c74dac8 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -34,7 +34,7 @@ include ../Version LIBRARY_NAME=libgnustep-gui # The Objective-C source files to be compiled -OBJC_FILES = libgnustep-gui.m \ +libgnustep-gui_OBJC_FILES = libgnustep-gui.m \ NSActionCell.m \ NSApplication.m \ NSBitmapImageRep.m \ @@ -104,10 +104,10 @@ tiff.m \ externs.m # NSPasteboard.m -HEADER_FILES_DIR = ../Headers -HEADER_FILES_INSTALL_DIR = /gnustep/gui +libgnustep-gui_HEADER_FILES_DIR = ../Headers +libgnustep-gui_HEADER_FILES_INSTALL_DIR = /gnustep/gui -HEADER_FILES = \ +libgnustep-gui_HEADER_FILES = \ AppKit/AppKit.h \ AppKit/NSActionCell.h \ AppKit/NSApplication.h \ diff --git a/Source/NSCell.m b/Source/NSCell.m index e0c23222a..c3d57adfa 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -70,6 +70,7 @@ // - _init { + self = [super init]; cell_type = NSNullCellType; cell_image = nil; cell_font = nil; @@ -92,9 +93,7 @@ - init { - self = [super init]; - [self _init]; - return self; + return [self initTextCell:@""]; } - (id)initImageCell:(NSImage *)anImage diff --git a/Source/NSForm.m b/Source/NSForm.m index 91de23672..cdb254488 100644 --- a/Source/NSForm.m +++ b/Source/NSForm.m @@ -64,8 +64,13 @@ static Class defaultCellClass = nil; - (NSFormCell*)insertEntry:(NSString*)title atIndex:(int)index { + NSFormCell *new_cell = [[[isa cellClass] alloc] initTextCell:title]; + [self insertRow:index]; - return [self cellAtRow:index column:0]; + [self putCell:new_cell atRow:index column:0]; + [new_cell release]; + + return new_cell; } - (void)removeEntryAtIndex:(int)index diff --git a/Source/NSFormCell.m b/Source/NSFormCell.m index 1b1f80166..589dd7976 100644 --- a/Source/NSFormCell.m +++ b/Source/NSFormCell.m @@ -37,40 +37,47 @@ - init { - self = [super init]; - [self setBordered:NO]; - [self setBezeled:NO]; + return [self initTextCell:@"Field:"]; +} + +- initTextCell: (NSString *)aString +{ + self = [super initTextCell:@""]; + [self setBordered:YES]; + [self setBezeled:YES]; + [self setAlignment:NSLeftTextAlignment]; titleWidth = -1; - textCell = [NSTextFieldCell new]; - [textCell setBordered:YES]; - [textCell setBezeled:YES]; + titleCell = [[NSCell alloc] initTextCell:aString]; + [titleCell setBordered:NO]; + [titleCell setBezeled:NO]; + [titleCell setAlignment:NSRightTextAlignment]; return self; } - (void)dealloc { - [textCell release]; + [titleCell release]; [super dealloc]; } - (BOOL)isOpaque { - return [super isOpaque] && [textCell isOpaque]; + return [super isOpaque] && [titleCell isOpaque]; } - (void)setTitle:(NSString*)aString { - [self setStringValue:aString]; + [titleCell setStringValue:aString]; } - (void)setTitleAlignment:(NSTextAlignment)mode { - [self setAlignment:mode]; + [titleCell setAlignment:mode]; } - (void)setTitleFont:(NSFont*)fontObject { - [self setFont:fontObject]; + [titleCell setFont:fontObject]; } - (void)setTitleWidth:(float)width @@ -80,23 +87,23 @@ - (NSString*)title { - return [self stringValue]; + return [titleCell stringValue]; } - (NSTextAlignment)titleAlignment { - return [self alignment]; + return [titleCell alignment]; } - (NSFont*)titleFont { - return [self font]; + return [titleCell font]; } - (float)titleWidth { if (titleWidth < 0) - return [[self font] widthOfString:[self title]]; + return [[titleCell font] widthOfString:[self title]]; else return titleWidth; } @@ -107,20 +114,17 @@ return 0; } -- (void)drawInteriorWithFrame:(NSRect)cellFrame +- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { - NSRect titleRect = cellFrame; - NSRect textRect; + NSRect titleFrame; + NSRect textFrame; - titleRect.size.width = [self titleWidth] + 4; - [super drawInteriorWithFrame:titleRect inView:controlView]; + NSDivideRect(cellFrame, &titleFrame, &textFrame, + [self titleWidth] + 4, NSMinXEdge); - textRect.origin.x = cellFrame.origin.x + titleRect.size.width; - textRect.origin.y = cellFrame.origin.y; - textRect.size.width = cellFrame.size.width - titleRect.size.width; - textRect.size.height = cellFrame.size.height; - [textCell drawInteriorWithFrame:textRect inView:controlView]; + [titleCell drawWithFrame:titleFrame inView:controlView]; + [super drawWithFrame:textFrame inView:controlView]; } - (void)encodeWithCoder:aCoder diff --git a/Source/NSView.m b/Source/NSView.m index 2b48dd6a7..6240889b6 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -259,7 +259,10 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil; - (NSView *)opaqueAncestor { - return nil; + if ([self isOpaque] || !super_view) + return self; + else + return [super_view opaqueAncestor]; } - (void)removeFromSuperview @@ -833,7 +836,7 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil; NSRect superviewsVisibleRect = [self convertRect:[super_view visibleRect] fromView:super_view]; - return NSIntersectionRect (superviewsVisibleRect, frame); + return NSIntersectionRect (superviewsVisibleRect, bounds); } }