mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
Initial implementation of NSScroller.
Reinstate NSCursor and NSColorWell changes that got lost. Utilize config.h file instead of compiler defines. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2228 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6e7bcfc175
commit
1c8d394839
24 changed files with 916 additions and 144 deletions
42
ChangeLog
42
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
Tue Mar 4 17:04:16 1997 GNUstep Development <gnustep@net-community.com>
|
||||||
|
|
||||||
|
* Reinstate NSCursor and NSColorWell changes that got lost.
|
||||||
|
|
||||||
|
* configure.in: Utilize config.h file instead of compiler defines.
|
||||||
|
* configure: Regenerate for configure.in changes.
|
||||||
|
* Headers/gnustep/dps/DPSOperators.h: Correct name.
|
||||||
|
* Headers/gnsutep/gui/Headers/TypesandConstants.h: Correct name.
|
||||||
|
* Headers/gnustep/gui/config.h.in: Correct names.
|
||||||
|
* Headers/gnustep/gui/nsimage-tiff.h: Correct name.
|
||||||
|
|
||||||
|
* Source/NSCell.m: Redraw cell when needed during tracking.
|
||||||
|
|
||||||
|
* Initial NSScroller implementation.
|
||||||
|
* Headers/gnustep/gui/NSScroller.h: Likewise.
|
||||||
|
* Source/NSScroller.m: Likewise.
|
||||||
|
|
||||||
Tue Mar 4 09:28:57 1997 GNUstep Development <gnustep@net-community.com>
|
Tue Mar 4 09:28:57 1997 GNUstep Development <gnustep@net-community.com>
|
||||||
|
|
||||||
* Headers/gnustep/gui/NSEvent.h: Include needed header file.
|
* Headers/gnustep/gui/NSEvent.h: Include needed header file.
|
||||||
|
@ -58,6 +75,31 @@ Sat Feb 15 23:12:35 1997 Ovidiu Predescu <ovidiu@bx.logicnet.ro>
|
||||||
* Headers/gnustep/gui/NSNibLoading.h: Added category to NSBundle that
|
* Headers/gnustep/gui/NSNibLoading.h: Added category to NSBundle that
|
||||||
deals with nib loading.
|
deals with nib loading.
|
||||||
|
|
||||||
|
Wed Feb 12 14:14:47 1997 GNUstep Development <gnustep@net-community.com>
|
||||||
|
|
||||||
|
* Initial implementation of NSCursor.
|
||||||
|
* Headers/gnustep/gui/NSCursor.h: Likewise.
|
||||||
|
* Source/NSCursor.m: Likewise.
|
||||||
|
* Headers/gnustep/gui/NSWindow.h: Implement cursor rectangles.
|
||||||
|
* Source/NSView.m: Likewise.
|
||||||
|
* Source/NSWindow.m: Likewise.
|
||||||
|
* Source/Makefile.in: Clean up variables
|
||||||
|
* Source/NSApplication.m: Fixes to event posting. Unhide the
|
||||||
|
cursor when a mouse event occurs.
|
||||||
|
* Source/NSEvent.m: NSCursorUpdate events are implemented
|
||||||
|
as enter/exit events instead of other events.
|
||||||
|
* Headers/gnustep/gui/NSTextField.h: Add text field cursor.
|
||||||
|
* Source/NSTextField.m: Likewise.
|
||||||
|
|
||||||
|
Thu Feb 6 19:31:54 1997 GNUstep Development <gnustep@net-community.com>
|
||||||
|
|
||||||
|
* Fill out implementation of NSColorWell.
|
||||||
|
* Headers/gnustep/gui/NSColorWell.h: Add backend instance variable
|
||||||
|
and backend method.
|
||||||
|
* Source/NSColorWell.m: Initial implementation.
|
||||||
|
* NSView.m: Don't use -isKindOfClass: because it isn't working
|
||||||
|
as we expect with the backend classes doing a +poseAs:
|
||||||
|
|
||||||
Mon Feb 10 17:23:06 1997 Ovidiu Predescu <ovidiu@bx.logicnet.ro>
|
Mon Feb 10 17:23:06 1997 Ovidiu Predescu <ovidiu@bx.logicnet.ro>
|
||||||
|
|
||||||
* Source/NSFont.m: Completely reworked. Get the default fonts using
|
* Source/NSFont.m: Completely reworked. Get the default fonts using
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
#include <gnustep/gui/config.h>
|
#include <gnustep/gui/config.h>
|
||||||
|
|
||||||
// Use the DPSclient library if we have it
|
// Use the DPSclient library if we have it
|
||||||
#ifdef HAVE_DPSCLIENT
|
#ifdef HAVE_DPS_DPSCLIENT_H
|
||||||
|
|
||||||
#include <DPS/dpsclient.h>
|
#include <DPS/dpsclient.h>
|
||||||
#include <DPS/psops.h>
|
#include <DPS/psops.h>
|
||||||
|
|
||||||
#endif /* HAVE_DPSCLIENT */
|
#endif /* HAVE_DPS_DPSCLIENT_H */
|
||||||
|
|
||||||
#endif /* _GNUstep_H_DPSOperators */
|
#endif /* _GNUstep_H_DPSOperators */
|
||||||
|
|
|
@ -34,14 +34,14 @@
|
||||||
@class NSString;
|
@class NSString;
|
||||||
|
|
||||||
// These are already defined in the DPSclient headers
|
// These are already defined in the DPSclient headers
|
||||||
#ifndef HAVE_DPSCLIENT
|
#ifndef HAVE_DPS_DPSCLIENT_H
|
||||||
typedef void *DPSProgramEncoding;
|
typedef void *DPSProgramEncoding;
|
||||||
typedef void *DPSNameEncoding;
|
typedef void *DPSNameEncoding;
|
||||||
typedef void *DPSTextProc;
|
typedef void *DPSTextProc;
|
||||||
typedef void *DPSErrorProc;
|
typedef void *DPSErrorProc;
|
||||||
typedef void DPSBinObjSeqRec;
|
typedef void DPSBinObjSeqRec;
|
||||||
typedef unsigned int DPSDefinedType;
|
typedef unsigned int DPSDefinedType;
|
||||||
#endif /* HAVE_DPSCLIENT */
|
#endif /* HAVE_DPS_DPSCLIENT_H */
|
||||||
|
|
||||||
//
|
//
|
||||||
// Backing Store Types
|
// Backing Store Types
|
||||||
|
|
|
@ -40,6 +40,9 @@
|
||||||
NSColor *the_color;
|
NSColor *the_color;
|
||||||
BOOL is_active;
|
BOOL is_active;
|
||||||
BOOL is_bordered;
|
BOOL is_bordered;
|
||||||
|
|
||||||
|
// Reserved for back-end use
|
||||||
|
void *be_cwell_reserved;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -75,4 +78,13 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
// GNUstep backend methods
|
||||||
|
//
|
||||||
|
@interface NSColorWell (GNUstepBackend)
|
||||||
|
|
||||||
|
- (void)drawBorderRect:(NSRect)aRect;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
#endif // _GNUstep_H_NSColorWell
|
#endif // _GNUstep_H_NSColorWell
|
||||||
|
|
|
@ -66,10 +66,12 @@ extern const float NSScrollerWidth;
|
||||||
{
|
{
|
||||||
// Attributes
|
// Attributes
|
||||||
BOOL is_horizontal;
|
BOOL is_horizontal;
|
||||||
SEL action;
|
float knob_proportion;
|
||||||
id target;
|
NSScrollerPart hit_part;
|
||||||
float percent;
|
NSScrollArrowPosition arrows_position;
|
||||||
float cur_value;
|
NSImage *increment_arrow;
|
||||||
|
NSImage *decrement_arrow;
|
||||||
|
NSImage *knob_dimple;
|
||||||
|
|
||||||
// Reserved for back-end use
|
// Reserved for back-end use
|
||||||
void *be_scroll_reserved;
|
void *be_scroll_reserved;
|
||||||
|
@ -119,4 +121,18 @@ extern const float NSScrollerWidth;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
// Methods implemented by the backend
|
||||||
|
//
|
||||||
|
@interface NSScroller (GNUstepBackend)
|
||||||
|
|
||||||
|
- (void)drawBar;
|
||||||
|
- (NSRect)boundsOfScrollerPart:(NSScrollerPart)part;
|
||||||
|
- (BOOL)isPointInIncrementArrow:(NSPoint)aPoint;
|
||||||
|
- (BOOL)isPointInDecrementArrow:(NSPoint)aPoint;
|
||||||
|
- (BOOL)isPointInKnob:(NSPoint)aPoint;
|
||||||
|
- (BOOL)isPointInBar:(NSPoint)aPoint;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
#endif // _GNUstep_H_NSScroller
|
#endif // _GNUstep_H_NSScroller
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
@class NSNotification;
|
@class NSNotification;
|
||||||
@class NSColor;
|
@class NSColor;
|
||||||
@class NSText;
|
@class NSText;
|
||||||
|
@class NSCursor;
|
||||||
|
|
||||||
@interface NSTextField : NSControl <NSCoding>
|
@interface NSTextField : NSControl <NSCoding>
|
||||||
{
|
{
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
id previous_text;
|
id previous_text;
|
||||||
id text_delegate;
|
id text_delegate;
|
||||||
SEL error_action;
|
SEL error_action;
|
||||||
|
NSCursor *text_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -74,6 +74,7 @@ enum {
|
||||||
NSMutableArray *sub_views;
|
NSMutableArray *sub_views;
|
||||||
id window;
|
id window;
|
||||||
NSMutableArray *tracking_rects;
|
NSMutableArray *tracking_rects;
|
||||||
|
NSMutableArray *cursor_rects;
|
||||||
|
|
||||||
BOOL is_flipped;
|
BOOL is_flipped;
|
||||||
BOOL is_rotated_from_base;
|
BOOL is_rotated_from_base;
|
||||||
|
@ -229,6 +230,7 @@ enum {
|
||||||
- (void)removeCursorRect:(NSRect)aRect
|
- (void)removeCursorRect:(NSRect)aRect
|
||||||
cursor:(NSCursor *)anObject;
|
cursor:(NSCursor *)anObject;
|
||||||
- (void)resetCursorRects;
|
- (void)resetCursorRects;
|
||||||
|
- (NSArray *)cursorRectangles;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assigning a Tag
|
// Assigning a Tag
|
||||||
|
|
|
@ -98,6 +98,7 @@ extern NSSize NSTokenSize;
|
||||||
BOOL dynamic_depth_limit;
|
BOOL dynamic_depth_limit;
|
||||||
|
|
||||||
BOOL cursor_rects_enabled;
|
BOOL cursor_rects_enabled;
|
||||||
|
BOOL cursor_rects_valid;
|
||||||
|
|
||||||
BOOL visible;
|
BOOL visible;
|
||||||
BOOL is_key;
|
BOOL is_key;
|
||||||
|
|
|
@ -33,10 +33,11 @@
|
||||||
|
|
||||||
#include <Foundation/NSGeometry.h>
|
#include <Foundation/NSGeometry.h>
|
||||||
|
|
||||||
@config_include@
|
/* Do we have the TIFF Graphics library */
|
||||||
|
#undef HAVE_TIFF_H
|
||||||
|
|
||||||
#define HAVE_TIFF @HAVE_TIFF@
|
/* Do we have the DPS Client library? */
|
||||||
#define HAVE_DPSCLIENT @HAVE_DPSCLIENT@
|
#undef HAVE_DPS_DPSCLIENT_H
|
||||||
|
|
||||||
#endif /* _GNUstep_H_AppKitConfig */
|
#endif /* _GNUstep_H_AppKitConfig */
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#ifndef _GNUstep_H_tiff
|
#ifndef _GNUstep_H_tiff
|
||||||
#define _GNUstep_H_tiff
|
#define _GNUstep_H_tiff
|
||||||
|
|
||||||
#ifdef HAVE_TIFF
|
#ifdef HAVE_TIFF_H
|
||||||
#include <tiffio.h>
|
#include <tiffio.h>
|
||||||
#else
|
#else
|
||||||
#define TIFF void
|
#define TIFF void
|
||||||
|
|
|
@ -55,8 +55,8 @@ common_RadioOn.tiff \
|
||||||
common_RadioOff.tiff \
|
common_RadioOff.tiff \
|
||||||
common_SwitchOn.tiff \
|
common_SwitchOn.tiff \
|
||||||
common_SwitchOff.tiff \
|
common_SwitchOff.tiff \
|
||||||
common_ret.tiff \
|
common_Dimple.tiff \
|
||||||
common_Dimple.tiff
|
common_ret.tiff
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
$(srcdir)/../mkinstalldirs $(libdir) $(gnustep_libdir) $(imagedir)
|
$(srcdir)/../mkinstalldirs $(libdir) $(gnustep_libdir) $(imagedir)
|
||||||
|
|
|
@ -45,9 +45,11 @@ bindir = @bindir@
|
||||||
|
|
||||||
MAKEDEFINES =
|
MAKEDEFINES =
|
||||||
|
|
||||||
CC = @CC@ -g
|
CC = @CC@
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
CFLAGS = -c $(GCCFLAGS) -I../Headers $(CPPFLAGS)
|
CFLAGS = -g -O -Wall $(GCCFLAGS)
|
||||||
|
ALL_CPPFLAGS = $(CPPFLAGS) -I../Headers
|
||||||
|
ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS)
|
||||||
DEFS = -DGNUSTEP_INSTALL_LIBDIR=\"$(gnustep_libdir)\" @DEFS@
|
DEFS = -DGNUSTEP_INSTALL_LIBDIR=\"$(gnustep_libdir)\" @DEFS@
|
||||||
|
|
||||||
GCC_LIB =
|
GCC_LIB =
|
||||||
|
@ -236,9 +238,9 @@ OBJS = $(OBJS_WITHOUT_INIT)
|
||||||
|
|
||||||
.SUFFIXES: .m
|
.SUFFIXES: .m
|
||||||
.m$(oext):
|
.m$(oext):
|
||||||
$(CC) $(CFLAGS) $(DEFS) $<
|
$(CC) -c $(ALL_CFLAGS) $(DEFS) -o $@ $<
|
||||||
.c$(oext):
|
.c$(oext):
|
||||||
$(CC) $(CFLAGS) $(DEFS) $<
|
$(CC) -c $(ALL_CFLAGS) $(DEFS) -o $@ $<
|
||||||
|
|
||||||
#
|
#
|
||||||
# libraries
|
# libraries
|
||||||
|
@ -270,7 +272,7 @@ $(MAIN_FILE)$(libext): $(OBJS)
|
||||||
$(INIT_FILE_OBJ): $(OBJS_WITHOUT_INIT)
|
$(INIT_FILE_OBJ): $(OBJS_WITHOUT_INIT)
|
||||||
nm $(OBJS_WITHOUT_INIT) | grep " __GLOBAL_" > tmpinit.c
|
nm $(OBJS_WITHOUT_INIT) | grep " __GLOBAL_" > tmpinit.c
|
||||||
collect tmpinit.c $(INIT_FILE)
|
collect tmpinit.c $(INIT_FILE)
|
||||||
$(CC) $(CFLAGS) $(INIT_FILE).c
|
$(CC) $(ALL_CFLAGS) $(INIT_FILE).c
|
||||||
rm tmpinit.c
|
rm tmpinit.c
|
||||||
|
|
||||||
install: installdirs install-lib install-headers
|
install: installdirs install-lib install-headers
|
||||||
|
@ -315,6 +317,9 @@ uninstall:
|
||||||
rm -rf $(includedir)/DPSClient
|
rm -rf $(includedir)/DPSClient
|
||||||
rm -rf $(libdir)/$(MAIN_FILE)$(libext)
|
rm -rf $(libdir)/$(MAIN_FILE)$(libext)
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in ../config.status
|
||||||
|
cd ..; $(SHELL) config.status
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleaning
|
# Cleaning
|
||||||
#
|
#
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <AppKit/NSImage.h>
|
#include <AppKit/NSImage.h>
|
||||||
#include <AppKit/NSMenu.h>
|
#include <AppKit/NSMenu.h>
|
||||||
#include <AppKit/NSMenuCell.h>
|
#include <AppKit/NSMenuCell.h>
|
||||||
|
#include <AppKit/NSCursor.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Class variables
|
// Class variables
|
||||||
|
@ -269,7 +270,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
|
||||||
e = [self nextEventMatchingMask:NSAnyEventMask untilDate:nil
|
e = [self nextEventMatchingMask:NSAnyEventMask untilDate:nil
|
||||||
inMode:nil dequeue:YES];
|
inMode:nil dequeue:YES];
|
||||||
if (e)
|
if (e)
|
||||||
[self postEvent:e atStart:YES];
|
[self sendEvent: e];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Null event
|
// Null event
|
||||||
|
@ -446,7 +447,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
|
||||||
if ([event_queue count])
|
if ([event_queue count])
|
||||||
{
|
{
|
||||||
j = [event_queue count];
|
j = [event_queue count];
|
||||||
for (i = j-1;i > 0; --i)
|
for (i = j-1;i >= 0; --i)
|
||||||
{
|
{
|
||||||
e = [event_queue objectAtIndex: i];
|
e = [event_queue objectAtIndex: i];
|
||||||
if ([self event: e matchMask: mask])
|
if ([self event: e matchMask: mask])
|
||||||
|
@ -475,13 +476,32 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unhide the cursor if necessary
|
||||||
|
{
|
||||||
|
NSEventType type;
|
||||||
|
|
||||||
|
// Only if we should unhide when mouse moves
|
||||||
|
if ([NSCursor isHiddenUntilMouseMoves])
|
||||||
|
{
|
||||||
|
// Make sure the event is a mouse event before unhiding
|
||||||
|
type = [e type];
|
||||||
|
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|
||||||
|
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|
||||||
|
|| (type == NSMouseMoved))
|
||||||
|
[NSCursor unhide];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[self setCurrentEvent: e];
|
[self setCurrentEvent: e];
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
||||||
{
|
{
|
||||||
[self sendEvent:event];
|
if (flag)
|
||||||
|
[event_queue addObject: event];
|
||||||
|
else
|
||||||
|
[event_queue insertObject: event atIndex: 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
//
|
//
|
||||||
// class variables
|
// class variables
|
||||||
//
|
//
|
||||||
static id MB_NSBUTTON_CLASS = nil;
|
id gnustep_gui_nsbutton_class = nil;
|
||||||
|
|
||||||
//
|
//
|
||||||
// NSButton implementation
|
// NSButton implementation
|
||||||
|
@ -61,12 +61,12 @@ static id MB_NSBUTTON_CLASS = nil;
|
||||||
//
|
//
|
||||||
+ (Class)cellClass
|
+ (Class)cellClass
|
||||||
{
|
{
|
||||||
return MB_NSBUTTON_CLASS;
|
return gnustep_gui_nsbutton_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)setCellClass:(Class)classId
|
+ (void)setCellClass:(Class)classId
|
||||||
{
|
{
|
||||||
MB_NSBUTTON_CLASS = classId;
|
gnustep_gui_nsbutton_class = classId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -86,7 +86,7 @@ static id MB_NSBUTTON_CLASS = nil;
|
||||||
|
|
||||||
// set our cell
|
// set our cell
|
||||||
[[self cell] release];
|
[[self cell] release];
|
||||||
[self setCell:[[MB_NSBUTTON_CLASS alloc] init]];
|
[self setCell:[[gnustep_gui_nsbutton_class alloc] init]];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -640,26 +640,42 @@
|
||||||
// should be in the window coordinates, but is in the receiving
|
// should be in the window coordinates, but is in the receiving
|
||||||
// view's coordinate.
|
// view's coordinate.
|
||||||
location = [e locationInWindow];
|
location = [e locationInWindow];
|
||||||
// point = [controlView convertPoint: location fromView: nil];
|
point = [controlView convertPoint: location fromView: nil];
|
||||||
NSDebugLog(@"NSCell location %f %f\n", location.x, location.y);
|
NSDebugLog(@"NSCell location %f %f\n", location.x, location.y);
|
||||||
NSDebugLog(@"NSCell point %f %f\n", point.x, point.y);
|
NSDebugLog(@"NSCell point %f %f\n", point.x, point.y);
|
||||||
|
|
||||||
|
// Point is not in cell
|
||||||
if (![controlView mouse: point inRect: cellFrame])
|
if (![controlView mouse: point inRect: cellFrame])
|
||||||
{
|
{
|
||||||
NSDebugLog(@"NSCell point not in cell frame\n");
|
NSDebugLog(@"NSCell point not in cell frame\n");
|
||||||
// If point not in cell then unhighlight cell
|
// unhighlight cell is highlighted
|
||||||
[self highlight: NO withFrame: cellFrame
|
if (cell_highlighted)
|
||||||
inView: controlView];
|
{
|
||||||
|
[self highlight: NO withFrame: cellFrame
|
||||||
|
inView: controlView];
|
||||||
|
[self drawWithFrame: cellFrame inView: controlView];
|
||||||
|
}
|
||||||
|
|
||||||
// Do we now return or keep tracking
|
// Do we now return or keep tracking
|
||||||
if ((![[self class] prefersTrackingUntilMouseUp])
|
if ((![[self class] prefersTrackingUntilMouseUp])
|
||||||
|| (!flag))
|
&& (!flag))
|
||||||
{
|
{
|
||||||
NSDebugLog(@"NSCell return immediately\n");
|
NSDebugLog(@"NSCell return immediately\n");
|
||||||
done = YES;
|
done = YES;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Point is in cell
|
||||||
|
// highlight cell if not highlighted
|
||||||
|
if (!cell_highlighted)
|
||||||
|
{
|
||||||
|
[self highlight: YES withFrame: cellFrame
|
||||||
|
inView: controlView];
|
||||||
|
//[self drawWithFrame: cellFrame inView: controlView];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// should we continue tracking?
|
// should we continue tracking?
|
||||||
if (![self continueTracking: last_point at: point
|
if (![self continueTracking: last_point at: point
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AppKit/NSColorWell.h>
|
#include <AppKit/NSColorWell.h>
|
||||||
|
#include <AppKit/NSColor.h>
|
||||||
|
|
||||||
@implementation NSColorWell
|
@implementation NSColorWell
|
||||||
|
|
||||||
|
@ -45,14 +46,30 @@
|
||||||
//
|
//
|
||||||
// Instance methods
|
// Instance methods
|
||||||
//
|
//
|
||||||
|
- initWithFrame:(NSRect)frameRect
|
||||||
|
{
|
||||||
|
[super initWithFrame: frameRect];
|
||||||
|
|
||||||
|
is_bordered = YES;
|
||||||
|
is_active = NO;
|
||||||
|
the_color = [NSColor blackColor];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Drawing
|
// Drawing
|
||||||
//
|
//
|
||||||
- (void)drawRect:(NSRect)rect
|
- (void)drawRect:(NSRect)rect
|
||||||
{
|
{
|
||||||
// xxx Draw border
|
NSLog(@"NSColorWell drawRect: %f %f %f %f\n", rect.origin.x, rect.origin.y,
|
||||||
|
rect.size.width, rect.size.height);
|
||||||
|
|
||||||
|
// Draw border
|
||||||
|
if (is_bordered)
|
||||||
|
[self drawBorderRect: rect];
|
||||||
|
|
||||||
|
// Draw the color inside
|
||||||
[self drawWellInside: rect];
|
[self drawWellInside: rect];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,3 +150,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
// GNUstep backend methods
|
||||||
|
//
|
||||||
|
@implementation NSColorWell (GNUstepBackend)
|
||||||
|
|
||||||
|
- (void)drawBorderRect:(NSRect)aRect
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -163,7 +163,8 @@
|
||||||
e = [[[NSEvent alloc] init] autorelease];
|
e = [[[NSEvent alloc] init] autorelease];
|
||||||
|
|
||||||
// Make sure it is one of the right event types
|
// Make sure it is one of the right event types
|
||||||
if ((type != NSMouseEntered) && (type != NSMouseExited))
|
if ((type != NSMouseEntered) && (type != NSMouseExited)
|
||||||
|
&& (type != NSCursorUpdate))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
// Set the event fields
|
// Set the event fields
|
||||||
|
@ -264,8 +265,7 @@
|
||||||
e = [[[NSEvent alloc] init] autorelease];
|
e = [[[NSEvent alloc] init] autorelease];
|
||||||
|
|
||||||
// Make sure it is one of the right event types
|
// Make sure it is one of the right event types
|
||||||
if ((type != NSFlagsChanged) && (type != NSCursorUpdate) &&
|
if ((type != NSFlagsChanged) && (type != NSPeriodic))
|
||||||
(type != NSPeriodic))
|
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
// Set the event fields
|
// Set the event fields
|
||||||
|
@ -428,7 +428,8 @@
|
||||||
//
|
//
|
||||||
- (int)trackingNumber
|
- (int)trackingNumber
|
||||||
{
|
{
|
||||||
if ((event_type != NSMouseEntered) && (event_type != NSMouseExited))
|
if ((event_type != NSMouseEntered) && (event_type != NSMouseExited)
|
||||||
|
&& (event_type != NSCursorUpdate))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return event_data.tracking.tracking_num;
|
return event_data.tracking.tracking_num;
|
||||||
|
@ -436,7 +437,8 @@
|
||||||
|
|
||||||
- (void *)userData
|
- (void *)userData
|
||||||
{
|
{
|
||||||
if ((event_type != NSMouseEntered) && (event_type != NSMouseExited))
|
if ((event_type != NSMouseEntered) && (event_type != NSMouseExited)
|
||||||
|
&& (event_type != NSCursorUpdate))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return event_data.tracking.user_data;
|
return event_data.tracking.user_data;
|
||||||
|
@ -448,8 +450,7 @@
|
||||||
- (int)data1
|
- (int)data1
|
||||||
{
|
{
|
||||||
// Make sure it is one of the right event types
|
// Make sure it is one of the right event types
|
||||||
if ((event_type != NSFlagsChanged) && (event_type != NSCursorUpdate) &&
|
if ((event_type != NSFlagsChanged) && (event_type != NSPeriodic))
|
||||||
(event_type != NSPeriodic))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return event_data.misc.data1;
|
return event_data.misc.data1;
|
||||||
|
@ -458,8 +459,7 @@
|
||||||
- (int)data2
|
- (int)data2
|
||||||
{
|
{
|
||||||
// Make sure it is one of the right event types
|
// Make sure it is one of the right event types
|
||||||
if ((event_type != NSFlagsChanged) && (event_type != NSCursorUpdate) &&
|
if ((event_type != NSFlagsChanged) && (event_type != NSPeriodic))
|
||||||
(event_type != NSPeriodic))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return event_data.misc.data2;
|
return event_data.misc.data2;
|
||||||
|
@ -468,8 +468,7 @@
|
||||||
- (short)subtype
|
- (short)subtype
|
||||||
{
|
{
|
||||||
// Make sure it is one of the right event types
|
// Make sure it is one of the right event types
|
||||||
if ((event_type != NSFlagsChanged) && (event_type != NSCursorUpdate) &&
|
if ((event_type != NSFlagsChanged) && (event_type != NSPeriodic))
|
||||||
(event_type != NSPeriodic))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return event_data.misc.sub_type;;
|
return event_data.misc.sub_type;;
|
||||||
|
@ -505,6 +504,7 @@
|
||||||
|
|
||||||
case NSMouseEntered:
|
case NSMouseEntered:
|
||||||
case NSMouseExited:
|
case NSMouseExited:
|
||||||
|
case NSCursorUpdate:
|
||||||
// Can't do anything with the user_data!?
|
// Can't do anything with the user_data!?
|
||||||
[aCoder encodeValuesOfObjCTypes: "ii", &event_data.tracking.event_num,
|
[aCoder encodeValuesOfObjCTypes: "ii", &event_data.tracking.event_num,
|
||||||
&event_data.tracking.tracking_num];
|
&event_data.tracking.tracking_num];
|
||||||
|
@ -520,7 +520,6 @@
|
||||||
|
|
||||||
case NSFlagsChanged:
|
case NSFlagsChanged:
|
||||||
case NSPeriodic:
|
case NSPeriodic:
|
||||||
case NSCursorUpdate:
|
|
||||||
[aCoder encodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type,
|
[aCoder encodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type,
|
||||||
&event_data.misc.data1, &event_data.misc.data2];
|
&event_data.misc.data1, &event_data.misc.data2];
|
||||||
break;
|
break;
|
||||||
|
@ -551,6 +550,7 @@
|
||||||
|
|
||||||
case NSMouseEntered:
|
case NSMouseEntered:
|
||||||
case NSMouseExited:
|
case NSMouseExited:
|
||||||
|
case NSCursorUpdate:
|
||||||
// Can't do anything with the user_data!?
|
// Can't do anything with the user_data!?
|
||||||
[aDecoder decodeValuesOfObjCTypes: "ii", &event_data.tracking.event_num,
|
[aDecoder decodeValuesOfObjCTypes: "ii", &event_data.tracking.event_num,
|
||||||
&event_data.tracking.tracking_num];
|
&event_data.tracking.tracking_num];
|
||||||
|
@ -567,7 +567,6 @@
|
||||||
|
|
||||||
case NSFlagsChanged:
|
case NSFlagsChanged:
|
||||||
case NSPeriodic:
|
case NSPeriodic:
|
||||||
case NSCursorUpdate:
|
|
||||||
[aDecoder decodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type,
|
[aDecoder decodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type,
|
||||||
&event_data.misc.data1, &event_data.misc.data2];
|
&event_data.misc.data1, &event_data.misc.data2];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -151,6 +151,18 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
|
||||||
|
|
||||||
@implementation NSImage
|
@implementation NSImage
|
||||||
|
|
||||||
|
+ (void)initialize
|
||||||
|
{
|
||||||
|
if (self == [NSImage class])
|
||||||
|
{
|
||||||
|
// Initial version
|
||||||
|
[self setVersion:1];
|
||||||
|
|
||||||
|
// initialize the class variables
|
||||||
|
nameDict = [[NSMutableDictionary alloc] initWithCapacity: 10];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+ imageNamed: (NSString *)aName
|
+ imageNamed: (NSString *)aName
|
||||||
{
|
{
|
||||||
/* If there is no image with that name, search in the main bundle */
|
/* If there is no image with that name, search in the main bundle */
|
||||||
|
@ -220,6 +232,7 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
|
||||||
NSImage* image = [[NSImage alloc] initByReferencingFile:path];
|
NSImage* image = [[NSImage alloc] initByReferencingFile:path];
|
||||||
if (image)
|
if (image)
|
||||||
[image setName:_base_name(path)];
|
[image setName:_base_name(path)];
|
||||||
|
[nameDict setObject: image forKey: [image name]];
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,15 @@
|
||||||
#include <Foundation/NSCoder.h>
|
#include <Foundation/NSCoder.h>
|
||||||
#include <AppKit/NSScroller.h>
|
#include <AppKit/NSScroller.h>
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include <AppKit/NSActionCell.h>
|
||||||
|
#include <AppKit/NSApplication.h>
|
||||||
|
#include <AppKit/NSImage.h>
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class variables
|
||||||
|
//
|
||||||
|
static float gnustep_gui_scroller_width = 18;
|
||||||
|
id gnustep_gui_nsscroller_class = nil;
|
||||||
|
|
||||||
@implementation NSScroller
|
@implementation NSScroller
|
||||||
|
|
||||||
|
@ -41,42 +50,72 @@
|
||||||
{
|
{
|
||||||
// Initial version
|
// Initial version
|
||||||
[self setVersion:1];
|
[self setVersion:1];
|
||||||
|
|
||||||
|
// Set our cell class to NSButtonCell
|
||||||
|
[self setCellClass:[NSActionCell class]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initializing the NSScroller Factory
|
||||||
|
//
|
||||||
|
+ (Class)cellClass
|
||||||
|
{
|
||||||
|
return gnustep_gui_nsscroller_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)setCellClass:(Class)classId
|
||||||
|
{
|
||||||
|
gnustep_gui_nsscroller_class = classId;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Laying out the NSScroller
|
// Laying out the NSScroller
|
||||||
//
|
//
|
||||||
+ (float)scrollerWidth
|
+ (float)scrollerWidth
|
||||||
{
|
{
|
||||||
return 0;
|
return gnustep_gui_scroller_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Instance methods
|
// Instance methods
|
||||||
//
|
//
|
||||||
- init
|
|
||||||
{
|
|
||||||
return [self initWithFrame:NSZeroRect];
|
|
||||||
}
|
|
||||||
|
|
||||||
- initWithFrame:(NSRect)frameRect
|
- initWithFrame:(NSRect)frameRect
|
||||||
{
|
{
|
||||||
[super initWithFrame:frameRect];
|
// Determine if its horizontal or vertical
|
||||||
if (frame.size.width > frame.size.height)
|
// then adjust the width to the standard
|
||||||
is_horizontal = YES;
|
if (frameRect.size.width > frameRect.size.height)
|
||||||
|
{
|
||||||
|
is_horizontal = YES;
|
||||||
|
frameRect.size.height = gnustep_gui_scroller_width;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
is_horizontal = NO;
|
{
|
||||||
target = nil;
|
is_horizontal = NO;
|
||||||
action = NULL;
|
frameRect.size.width = gnustep_gui_scroller_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
[super initWithFrame:frameRect];
|
||||||
|
|
||||||
|
// set our cell
|
||||||
|
[[self cell] release];
|
||||||
|
[self setCell:[[gnustep_gui_nsscroller_class alloc] init]];
|
||||||
|
[self selectCell: cell];
|
||||||
|
|
||||||
|
arrows_position = NSScrollerArrowsMaxEnd;
|
||||||
|
knob_proportion = 0.1;
|
||||||
|
hit_part = NSScrollerNoPart;
|
||||||
|
[self setFloatValue: 0];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Laying out the NSScroller
|
// Laying out the NSScroller
|
||||||
//
|
//
|
||||||
- (NSScrollArrowPosition)arrowsPosition
|
- (NSScrollArrowPosition)arrowsPosition
|
||||||
{
|
{
|
||||||
return 0;
|
return arrows_position;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)checkSpaceForParts
|
- (void)checkSpaceForParts
|
||||||
|
@ -88,11 +127,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setArrowsPosition:(NSScrollArrowPosition)where
|
- (void)setArrowsPosition:(NSScrollArrowPosition)where
|
||||||
{}
|
{
|
||||||
|
arrows_position = where;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSUsableScrollerParts)usableParts
|
- (NSUsableScrollerParts)usableParts
|
||||||
{
|
{
|
||||||
return 0;
|
return NSNoScrollerParts;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -100,18 +141,31 @@
|
||||||
//
|
//
|
||||||
- (float)knobProportion
|
- (float)knobProportion
|
||||||
{
|
{
|
||||||
return 0;
|
return knob_proportion;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFloatValue:(float)aFloat
|
- (void)setFloatValue:(float)aFloat
|
||||||
knobProportion:(float)ratio
|
knobProportion:(float)ratio
|
||||||
{}
|
{
|
||||||
|
[cell setFloatValue: aFloat];
|
||||||
|
knob_proportion = ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setFloatValue:(float)aFloat
|
||||||
|
{
|
||||||
|
if (aFloat < 0)
|
||||||
|
aFloat = 0;
|
||||||
|
if (aFloat > 1)
|
||||||
|
aFloat = 1;
|
||||||
|
[super setFloatValue: aFloat];
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Displaying
|
// Displaying
|
||||||
//
|
//
|
||||||
- (void)drawRect:(NSRect)rect
|
- (void)drawRect:(NSRect)rect
|
||||||
{
|
{
|
||||||
|
[self drawParts];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawArrow:(NSScrollerArrow)whichButton
|
- (void)drawArrow:(NSScrollerArrow)whichButton
|
||||||
|
@ -122,7 +176,38 @@
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (void)drawParts
|
- (void)drawParts
|
||||||
{}
|
{
|
||||||
|
// Draw the bar
|
||||||
|
[self drawBar];
|
||||||
|
|
||||||
|
// Cache the arrow images
|
||||||
|
if (arrows_position != NSScrollerArrowsNone)
|
||||||
|
{
|
||||||
|
if (!increment_arrow)
|
||||||
|
{
|
||||||
|
if (is_horizontal)
|
||||||
|
increment_arrow = [NSImage imageNamed: @"common_ArrowLeft"];
|
||||||
|
else
|
||||||
|
increment_arrow = [NSImage imageNamed: @"common_ArrowUp"];
|
||||||
|
}
|
||||||
|
if (!decrement_arrow)
|
||||||
|
{
|
||||||
|
if (is_horizontal)
|
||||||
|
decrement_arrow = [NSImage imageNamed: @"common_ArrowRight"];
|
||||||
|
else
|
||||||
|
decrement_arrow = [NSImage imageNamed: @"common_ArrowDown"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the arrows
|
||||||
|
[self drawArrow: NSScrollerIncrementArrow highlight: NO];
|
||||||
|
[self drawArrow: NSScrollerDecrementArrow highlight: NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the knob
|
||||||
|
if (!knob_dimple)
|
||||||
|
knob_dimple = [NSImage imageNamed: @"common_Dimple"];
|
||||||
|
[self drawKnob];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)highlight:(BOOL)flag
|
- (void)highlight:(BOOL)flag
|
||||||
{}
|
{}
|
||||||
|
@ -132,19 +217,195 @@
|
||||||
//
|
//
|
||||||
- (NSScrollerPart)hitPart
|
- (NSScrollerPart)hitPart
|
||||||
{
|
{
|
||||||
return 0;
|
return hit_part;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSScrollerPart)testPart:(NSPoint)thePoint
|
- (NSScrollerPart)testPart:(NSPoint)thePoint
|
||||||
{
|
{
|
||||||
return 0;
|
NSScrollerPart the_part = NSScrollerNoPart;
|
||||||
|
NSRect partRect;
|
||||||
|
|
||||||
|
// Test hit on arrow buttons
|
||||||
|
if (arrows_position != NSScrollerArrowsNone)
|
||||||
|
{
|
||||||
|
partRect = [self boundsOfScrollerPart: NSScrollerIncrementLine];
|
||||||
|
if ([self mouse: thePoint inRect: partRect])
|
||||||
|
the_part = NSScrollerIncrementLine;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
partRect = [self boundsOfScrollerPart: NSScrollerDecrementLine];
|
||||||
|
if ([self mouse: thePoint inRect: partRect])
|
||||||
|
the_part = NSScrollerDecrementLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not on the arrow buttons
|
||||||
|
// then test the know area
|
||||||
|
if (the_part == NSScrollerNoPart)
|
||||||
|
{
|
||||||
|
partRect = [self boundsOfScrollerPart: NSScrollerKnob];
|
||||||
|
if ([self mouse: thePoint inRect: partRect])
|
||||||
|
the_part = NSScrollerKnob;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
partRect = [self boundsOfScrollerPart: NSScrollerKnobSlot];
|
||||||
|
if ([self mouse: thePoint inRect: partRect])
|
||||||
|
the_part = NSScrollerKnobSlot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return the_part;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)trackKnob:(NSEvent *)theEvent
|
- (void)trackKnob:(NSEvent *)theEvent
|
||||||
{}
|
{
|
||||||
|
NSApplication *theApp = [NSApplication sharedApplication];
|
||||||
|
BOOL mouseUp, done;
|
||||||
|
NSEvent *e;
|
||||||
|
|
||||||
|
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
|
||||||
|
NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDraggedMask;
|
||||||
|
NSRect partRect = [self boundsOfScrollerPart: NSScrollerKnob];
|
||||||
|
NSPoint point = [self convertPoint: [theEvent locationInWindow]
|
||||||
|
fromView: nil];
|
||||||
|
NSPoint last_point;
|
||||||
|
NSRect barRect = [self boundsOfScrollerPart: NSScrollerKnobSlot];
|
||||||
|
float pos;
|
||||||
|
|
||||||
|
// capture mouse
|
||||||
|
[[self window] captureMouse: self];
|
||||||
|
|
||||||
|
done = NO;
|
||||||
|
e = theEvent;
|
||||||
|
mouseUp = NO;
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
last_point = point;
|
||||||
|
e = [theApp nextEventMatchingMask:event_mask untilDate:nil
|
||||||
|
inMode:nil dequeue:YES];
|
||||||
|
point = [self convertPoint: [e locationInWindow] fromView: nil];
|
||||||
|
|
||||||
|
if (is_horizontal)
|
||||||
|
{
|
||||||
|
pos = (point.x - barRect.origin.x) / barRect.size.width;
|
||||||
|
[self setFloatValue: pos];
|
||||||
|
[self lockFocus];
|
||||||
|
[self drawBar];
|
||||||
|
[self drawKnob];
|
||||||
|
[self unlockFocus];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos = (point.y - barRect.origin.y) / barRect.size.height;
|
||||||
|
[self setFloatValue: pos];
|
||||||
|
[self lockFocus];
|
||||||
|
[self drawBar];
|
||||||
|
[self drawKnob];
|
||||||
|
[self unlockFocus];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Did the mouse go up?
|
||||||
|
if ([e type] == NSLeftMouseUp)
|
||||||
|
{
|
||||||
|
mouseUp = YES;
|
||||||
|
done = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release mouse
|
||||||
|
[[self window] releaseMouse: self];
|
||||||
|
|
||||||
|
// Have the target perform the action
|
||||||
|
[self sendAction:[self action] to:[self target]];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)trackScrollButtons:(NSEvent *)theEvent
|
- (void)trackScrollButtons:(NSEvent *)theEvent
|
||||||
{}
|
{
|
||||||
|
NSApplication *theApp = [NSApplication sharedApplication];
|
||||||
|
BOOL mouseUp, done;
|
||||||
|
NSEvent *e;
|
||||||
|
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
|
||||||
|
NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDraggedMask;
|
||||||
|
|
||||||
|
// capture mouse
|
||||||
|
[[self window] captureMouse: self];
|
||||||
|
|
||||||
|
done = NO;
|
||||||
|
e = theEvent;
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
mouseUp = [cell trackMouse: e inRect: bounds
|
||||||
|
ofView:self untilMouseUp:YES];
|
||||||
|
e = [theApp currentEvent];
|
||||||
|
|
||||||
|
// If mouse went up then we are done
|
||||||
|
if ((mouseUp) || ([e type] == NSLeftMouseUp))
|
||||||
|
done = YES;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSDebugLog(@"NSScroller process another event\n");
|
||||||
|
e = [theApp nextEventMatchingMask:event_mask untilDate:nil
|
||||||
|
inMode:nil dequeue:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release mouse
|
||||||
|
[[self window] releaseMouse: self];
|
||||||
|
|
||||||
|
// If the mouse went up in the button
|
||||||
|
if (mouseUp)
|
||||||
|
{
|
||||||
|
// Set a new value
|
||||||
|
|
||||||
|
// Have the target perform the action
|
||||||
|
[self sendAction:[self action] to:[self target]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handling Events and Action Messages
|
||||||
|
//
|
||||||
|
- (void)mouseDown:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
NSScrollerPart area;
|
||||||
|
NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
|
||||||
|
|
||||||
|
NSDebugLog(@"NSScroller mouseDown\n");
|
||||||
|
|
||||||
|
// If we are not enabled then ignore the mouse
|
||||||
|
if (![self isEnabled])
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Test where the mouse down is
|
||||||
|
area = [self testPart: p];
|
||||||
|
|
||||||
|
// If we didn't hit anywhere on the scroller then ignore
|
||||||
|
if (area == NSScrollerNoPart)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Do we have the ALT key held down?
|
||||||
|
if ([theEvent modifierFlags] & NSAlternateKeyMask)
|
||||||
|
{
|
||||||
|
if (area == NSScrollerDecrementLine)
|
||||||
|
area = NSScrollerDecrementPage;
|
||||||
|
if (area == NSScrollerIncrementLine)
|
||||||
|
area = NSScrollerIncrementPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We must have hit a real part so record it
|
||||||
|
hit_part = area;
|
||||||
|
|
||||||
|
// Track the knob if that's where it hit
|
||||||
|
if ((hit_part == NSScrollerKnob) || (hit_part == NSScrollerKnobSlot))
|
||||||
|
[self trackKnob: theEvent];
|
||||||
|
|
||||||
|
// Track the scroll buttons if that's where it hit
|
||||||
|
if ((hit_part == NSScrollerDecrementPage) ||
|
||||||
|
(hit_part == NSScrollerDecrementLine) ||
|
||||||
|
(hit_part == NSScrollerIncrementPage) ||
|
||||||
|
(hit_part == NSScrollerIncrementLine))
|
||||||
|
[self trackScrollButtons: theEvent];
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// NSCoding protocol
|
// NSCoding protocol
|
||||||
|
@ -154,13 +415,11 @@
|
||||||
[super encodeWithCoder:aCoder];
|
[super encodeWithCoder:aCoder];
|
||||||
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_horizontal];
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_horizontal];
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &action];
|
[aCoder encodeValueOfObjCType: @encode(float) at: &knob_proportion];
|
||||||
#if 0
|
[aCoder encodeValueOfObjCType: @encode(NSScrollerPart) at: &hit_part];
|
||||||
[aCoder encodeObjectReference: target withName: @"Target"];
|
[aCoder encodeValueOfObjCType: @encode(NSScrollArrowPosition)
|
||||||
#else
|
at: &arrows_position];
|
||||||
[aCoder encodeConditionalObject:target];
|
/* xxx What about the images? */
|
||||||
#endif
|
|
||||||
[aCoder encodeValuesOfObjCTypes: "ff", &percent, &cur_value];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithCoder:aDecoder
|
- initWithCoder:aDecoder
|
||||||
|
@ -168,16 +427,48 @@
|
||||||
[super initWithCoder:aDecoder];
|
[super initWithCoder:aDecoder];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_horizontal];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_horizontal];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &action];
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &knob_proportion];
|
||||||
#if 0
|
[aDecoder decodeValueOfObjCType: @encode(NSScrollerPart) at: &hit_part];
|
||||||
[aDecoder decodeObjectAt: &target withName: NULL];
|
[aDecoder decodeValueOfObjCType: @encode(NSScrollArrowPosition)
|
||||||
#else
|
at: &arrows_position];
|
||||||
target = [aDecoder decodeObject];
|
/* xxx What about the images? */
|
||||||
#endif
|
|
||||||
[aDecoder decodeValuesOfObjCTypes: "ff", &percent, &cur_value];
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
// Methods implemented by the backend
|
||||||
|
//
|
||||||
|
@implementation NSScroller (GNUstepBackend)
|
||||||
|
|
||||||
|
- (void)drawBar
|
||||||
|
{}
|
||||||
|
|
||||||
|
- (NSRect)boundsOfScrollerPart:(NSScrollerPart)part
|
||||||
|
{
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isPointInIncrementArrow:(NSPoint)aPoint
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isPointInDecrementArrow:(NSPoint)aPoint
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isPointInKnob:(NSPoint)aPoint
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isPointInBar:(NSPoint)aPoint
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
#include <AppKit/NSTextFieldCell.h>
|
#include <AppKit/NSTextFieldCell.h>
|
||||||
#include <AppKit/NSApplication.h>
|
#include <AppKit/NSApplication.h>
|
||||||
|
#include <AppKit/NSCursor.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// class variables
|
// class variables
|
||||||
|
@ -82,6 +83,7 @@ static id MB_NSTEXTFIELDCELL_CLASS = nil;
|
||||||
[[self cell] release];
|
[[self cell] release];
|
||||||
[self setCell:[[MB_NSTEXTFIELDCELL_CLASS alloc] init]];
|
[self setCell:[[MB_NSTEXTFIELDCELL_CLASS alloc] init]];
|
||||||
[cell setState:1];
|
[cell setState:1];
|
||||||
|
text_cursor = [NSCursor IBeamCursor];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -393,6 +395,14 @@ static id MB_NSTEXTFIELDCELL_CLASS = nil;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Manage the cursor
|
||||||
|
//
|
||||||
|
- (void)resetCursorRects
|
||||||
|
{
|
||||||
|
[self addCursorRect: bounds cursor: text_cursor];
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// NSCoding protocol
|
// NSCoding protocol
|
||||||
//
|
//
|
||||||
|
|
|
@ -155,6 +155,9 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
// Initialize tracking rectangle list
|
// Initialize tracking rectangle list
|
||||||
tracking_rects = [NSMutableArray array];
|
tracking_rects = [NSMutableArray array];
|
||||||
|
|
||||||
|
// Initialize cursor rect list
|
||||||
|
cursor_rects = [NSMutableArray array];
|
||||||
|
|
||||||
super_view = nil;
|
super_view = nil;
|
||||||
window = nil;
|
window = nil;
|
||||||
is_flipped = NO;
|
is_flipped = NO;
|
||||||
|
@ -187,6 +190,11 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
for (i = 0;i < j; ++i)
|
for (i = 0;i < j; ++i)
|
||||||
[[tracking_rects objectAtIndex:i] release];
|
[[tracking_rects objectAtIndex:i] release];
|
||||||
|
|
||||||
|
// Free the cursor rectangles
|
||||||
|
j = [cursor_rects count];
|
||||||
|
for (i = 0;i < j; ++i)
|
||||||
|
[[cursor_rects objectAtIndex:i] release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,10 +204,22 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
- (void)addSubview:(NSView *)aView
|
- (void)addSubview:(NSView *)aView
|
||||||
{
|
{
|
||||||
// Not a NSView --then forget it
|
// Not a NSView --then forget it
|
||||||
|
// xxx but NSView will really be the backend class
|
||||||
|
// so how do we check that its really a subclass of NSView
|
||||||
|
// and not of the backend class?
|
||||||
|
#if 0
|
||||||
if (![aView isKindOfClass:[NSView class]])
|
if (![aView isKindOfClass:[NSView class]])
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// make sure we aren't making ourself a subview of ourself
|
||||||
|
if (self == aView)
|
||||||
|
{
|
||||||
|
NSLog(@"Attempt to make view a subview of itself\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// retain the object
|
// retain the object
|
||||||
[aView retain];
|
[aView retain];
|
||||||
|
@ -216,9 +236,14 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
relativeTo:(NSView *)otherView
|
relativeTo:(NSView *)otherView
|
||||||
{
|
{
|
||||||
// Not a NSView --then forget it
|
// Not a NSView --then forget it
|
||||||
|
// xxx but NSView will really be the backend class
|
||||||
|
// so how do we check that its really a subclass of NSView
|
||||||
|
// and not of the backend class?
|
||||||
|
#if 0
|
||||||
if (![aView isKindOfClass:[NSView class]]) return;
|
if (![aView isKindOfClass:[NSView class]]) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
// retain the object
|
// retain the object
|
||||||
[aView retain];
|
[aView retain];
|
||||||
|
|
||||||
// Add to our subview list
|
// Add to our subview list
|
||||||
|
@ -242,7 +267,12 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
- (BOOL)isDescendantOf:(NSView *)aView
|
- (BOOL)isDescendantOf:(NSView *)aView
|
||||||
{
|
{
|
||||||
// Not a NSView --then forget it
|
// Not a NSView --then forget it
|
||||||
|
// xxx but NSView will really be the backend class
|
||||||
|
// so how do we check that its really a subclass of NSView
|
||||||
|
// and not of the backend class?
|
||||||
|
#if o
|
||||||
if (![aView isKindOfClass:[NSView class]]) return NO;
|
if (![aView isKindOfClass:[NSView class]]) return NO;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Quick check
|
// Quick check
|
||||||
if (aView == self) return YES;
|
if (aView == self) return YES;
|
||||||
|
@ -284,7 +314,12 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
NSView *v;
|
NSView *v;
|
||||||
|
|
||||||
// Not a NSView --then forget it
|
// Not a NSView --then forget it
|
||||||
|
// xxx but NSView will really be the backend class
|
||||||
|
// so how do we check that its really a subclass of NSView
|
||||||
|
// and not of the backend class?
|
||||||
|
#if 0
|
||||||
if (![newView isKindOfClass:[NSView class]]) return;
|
if (![newView isKindOfClass:[NSView class]]) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
j = [sub_views count];
|
j = [sub_views count];
|
||||||
for (i = 0;i < j; ++i)
|
for (i = 0;i < j; ++i)
|
||||||
|
@ -322,7 +357,12 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
- (void)setSuperview:(NSView *)superview
|
- (void)setSuperview:(NSView *)superview
|
||||||
{
|
{
|
||||||
// Not a NSView --then forget it
|
// Not a NSView --then forget it
|
||||||
|
// xxx but NSView will really be the backend class
|
||||||
|
// so how do we check that its really a subclass of NSView
|
||||||
|
// and not of the backend class?
|
||||||
|
#if 0
|
||||||
if (![superview isKindOfClass:[NSView class]]) return;
|
if (![superview isKindOfClass:[NSView class]]) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
super_view = superview;
|
super_view = superview;
|
||||||
}
|
}
|
||||||
|
@ -811,20 +851,55 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
|
||||||
//
|
//
|
||||||
// Managing the Cursor
|
// Managing the Cursor
|
||||||
//
|
//
|
||||||
|
// We utilize the tracking rectangle class
|
||||||
|
// to also maintain the cursor rects
|
||||||
|
//
|
||||||
- (void)addCursorRect:(NSRect)aRect
|
- (void)addCursorRect:(NSRect)aRect
|
||||||
cursor:(NSCursor *)anObject
|
cursor:(NSCursor *)anObject
|
||||||
{}
|
{
|
||||||
|
TrackingRectangle *m;
|
||||||
|
|
||||||
|
m = [[TrackingRectangle alloc] initWithRect: aRect tag: 0 owner: anObject
|
||||||
|
userData: NULL inside: YES];
|
||||||
|
[cursor_rects addObject:m];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)discardCursorRects
|
- (void)discardCursorRects
|
||||||
{}
|
{
|
||||||
|
[cursor_rects removeAllObjects];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)removeCursorRect:(NSRect)aRect
|
- (void)removeCursorRect:(NSRect)aRect
|
||||||
cursor:(NSCursor *)anObject
|
cursor:(NSCursor *)anObject
|
||||||
{}
|
{
|
||||||
|
id e = [cursor_rects objectEnumerator];
|
||||||
|
TrackingRectangle *o;
|
||||||
|
NSCursor *c;
|
||||||
|
BOOL found = NO;
|
||||||
|
|
||||||
|
// Base remove test upon cursor object
|
||||||
|
o = [e nextObject];
|
||||||
|
while (o && (!found))
|
||||||
|
{
|
||||||
|
c = [o owner];
|
||||||
|
if (c == anObject)
|
||||||
|
found = YES;
|
||||||
|
else
|
||||||
|
o = [e nextObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
[cursor_rects removeObject: o];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)resetCursorRects
|
- (void)resetCursorRects
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
- (NSArray *)cursorRectangles
|
||||||
|
{
|
||||||
|
return cursor_rects;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assigning a Tag
|
// Assigning a Tag
|
||||||
//
|
//
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <AppKit/TrackingRectangle.h>
|
#include <AppKit/TrackingRectangle.h>
|
||||||
#include <AppKit/NSSliderCell.h>
|
#include <AppKit/NSSliderCell.h>
|
||||||
#include <AppKit/NSScreen.h>
|
#include <AppKit/NSScreen.h>
|
||||||
|
#include <AppKit/NSCursor.h>
|
||||||
|
|
||||||
// NSWindow notifications
|
// NSWindow notifications
|
||||||
NSString *NSWindowDidBecomeKeyNotification = @"WindowDidBecomeKey";
|
NSString *NSWindowDidBecomeKeyNotification = @"WindowDidBecomeKey";
|
||||||
|
@ -180,6 +181,10 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
// Next responder is the application
|
// Next responder is the application
|
||||||
[self setNextResponder:theApp];
|
[self setNextResponder:theApp];
|
||||||
|
|
||||||
|
// Cursor management
|
||||||
|
cursor_rects_enabled = YES;
|
||||||
|
cursor_rects_valid = NO;
|
||||||
|
|
||||||
// Create our content view
|
// Create our content view
|
||||||
[self setContentView:[[NSView alloc] initWithFrame:frame]];
|
[self setContentView:[[NSView alloc] initWithFrame:frame]];
|
||||||
|
|
||||||
|
@ -352,6 +357,9 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
// We are the key window
|
// We are the key window
|
||||||
is_key = YES;
|
is_key = YES;
|
||||||
|
|
||||||
|
// Reset the cursor rects
|
||||||
|
[self resetCursorRects];
|
||||||
|
|
||||||
// Post notification
|
// Post notification
|
||||||
[nc postNotificationName: NSWindowDidBecomeKeyNotification object: self];
|
[nc postNotificationName: NSWindowDidBecomeKeyNotification object: self];
|
||||||
}
|
}
|
||||||
|
@ -474,6 +482,9 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
|
|
||||||
is_key = NO;
|
is_key = NO;
|
||||||
|
|
||||||
|
// Discard the cursor rects
|
||||||
|
[self discardCursorRects];
|
||||||
|
|
||||||
// Post notification
|
// Post notification
|
||||||
[nc postNotificationName: NSWindowDidResignKeyNotification object: self];
|
[nc postNotificationName: NSWindowDidResignKeyNotification object: self];
|
||||||
}
|
}
|
||||||
|
@ -719,8 +730,26 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
cursor_rects_enabled = NO;
|
cursor_rects_enabled = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)discardCursorRectsForView:(NSView *)theView
|
||||||
|
{
|
||||||
|
NSArray *s;
|
||||||
|
id e;
|
||||||
|
NSView *v;
|
||||||
|
|
||||||
|
// Discard for the view
|
||||||
|
[theView discardCursorRects];
|
||||||
|
|
||||||
|
// Discard for the view's subviews
|
||||||
|
s = [theView subviews];
|
||||||
|
e = [s objectEnumerator];
|
||||||
|
while ((v = [e nextObject]))
|
||||||
|
[self discardCursorRectsForView: v];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)discardCursorRects
|
- (void)discardCursorRects
|
||||||
{}
|
{
|
||||||
|
[self discardCursorRectsForView: content_view];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)enableCursorRects
|
- (void)enableCursorRects
|
||||||
{
|
{
|
||||||
|
@ -728,10 +757,34 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)invalidateCursorRectsForView:(NSView *)aView
|
- (void)invalidateCursorRectsForView:(NSView *)aView
|
||||||
{}
|
{
|
||||||
|
cursor_rects_valid = NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)resetCursorRectsForView:(NSView *)theView
|
||||||
|
{
|
||||||
|
NSArray *s;
|
||||||
|
id e;
|
||||||
|
NSView *v;
|
||||||
|
|
||||||
|
// Reset the view
|
||||||
|
[theView resetCursorRects];
|
||||||
|
|
||||||
|
// Reset the view's subviews
|
||||||
|
s = [theView subviews];
|
||||||
|
e = [s objectEnumerator];
|
||||||
|
while ((v = [e nextObject]))
|
||||||
|
[self resetCursorRectsForView: v];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)resetCursorRects
|
- (void)resetCursorRects
|
||||||
{}
|
{
|
||||||
|
// Tell all the views to reset their cursor rects
|
||||||
|
[self resetCursorRectsForView: content_view];
|
||||||
|
|
||||||
|
// Cursor rects are now valid
|
||||||
|
cursor_rects_valid = YES;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handling user actions and events
|
// Handling user actions and events
|
||||||
|
@ -931,27 +984,31 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
// Mouse entered event
|
// Mouse entered event
|
||||||
if ((!last) && (now))
|
if ((!last) && (now))
|
||||||
{
|
{
|
||||||
|
id owner = [r owner];
|
||||||
e = [NSEvent enterExitEventWithType:NSMouseEntered
|
e = [NSEvent enterExitEventWithType:NSMouseEntered
|
||||||
location:[theEvent locationInWindow]
|
location:[theEvent locationInWindow]
|
||||||
modifierFlags:[theEvent modifierFlags]
|
modifierFlags:[theEvent modifierFlags]
|
||||||
timestamp:0 windowNumber:[theEvent windowNumber]
|
timestamp:0 windowNumber:[theEvent windowNumber]
|
||||||
context:NULL eventNumber:0
|
context:NULL eventNumber:0
|
||||||
trackingNumber:[r tag] userData:[r userData]];
|
trackingNumber:[r tag] userData:[r userData]];
|
||||||
// Send the event to the view
|
// Send the event to the owner
|
||||||
[theView mouseEntered:e];
|
if ([owner respondsToSelector:@selector(mouseEntered:)])
|
||||||
|
[owner mouseEntered:e];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse exited event
|
// Mouse exited event
|
||||||
if ((last) && (!now))
|
if ((last) && (!now))
|
||||||
{
|
{
|
||||||
|
id owner = [r owner];
|
||||||
e = [NSEvent enterExitEventWithType:NSMouseExited
|
e = [NSEvent enterExitEventWithType:NSMouseExited
|
||||||
location:[theEvent locationInWindow]
|
location:[theEvent locationInWindow]
|
||||||
modifierFlags:[theEvent modifierFlags]
|
modifierFlags:[theEvent modifierFlags]
|
||||||
timestamp:0 windowNumber:[theEvent windowNumber]
|
timestamp:0 windowNumber:[theEvent windowNumber]
|
||||||
context:NULL eventNumber:0
|
context:NULL eventNumber:0
|
||||||
trackingNumber:[r tag] userData:[r userData]];
|
trackingNumber:[r tag] userData:[r userData]];
|
||||||
// Send the event to the view
|
// Send the event to the owner
|
||||||
[theView mouseExited:e];
|
if ([owner respondsToSelector:@selector(mouseExited:)])
|
||||||
|
[owner mouseExited:e];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,12 +1018,81 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
[self checkTrackingRectangles:[sb objectAtIndex:i] forEvent:theEvent];
|
[self checkTrackingRectangles:[sb objectAtIndex:i] forEvent:theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)checkCursorRectangles:(NSView *)theView forEvent:(NSEvent *)theEvent
|
||||||
|
{
|
||||||
|
NSArray *tr = [theView cursorRectangles];
|
||||||
|
NSArray *sb = [theView subviews];
|
||||||
|
TrackingRectangle *r;
|
||||||
|
int i, j;
|
||||||
|
BOOL last, now;
|
||||||
|
NSEvent *e;
|
||||||
|
NSRect convRect;
|
||||||
|
NSPoint loc = [theEvent locationInWindow];
|
||||||
|
|
||||||
|
// Loop through cursor rectangles
|
||||||
|
j = [tr count];
|
||||||
|
for (i = 0;i < j; ++i)
|
||||||
|
{
|
||||||
|
// Convert cursor rectangle to window coordinates
|
||||||
|
r = (TrackingRectangle *)[tr objectAtIndex:i];
|
||||||
|
convRect = [r rectangle];
|
||||||
|
convRect = [theView convertRect: convRect toView: nil];
|
||||||
|
// Check mouse at last point
|
||||||
|
last = [theView mouse:last_point inRect: convRect];
|
||||||
|
// Check mouse at current point
|
||||||
|
now = [theView mouse: loc inRect: convRect];
|
||||||
|
|
||||||
|
// Mouse entered
|
||||||
|
if ((!last) && (now))
|
||||||
|
{
|
||||||
|
// Post cursor update event
|
||||||
|
e = [NSEvent enterExitEventWithType: NSCursorUpdate
|
||||||
|
location: loc
|
||||||
|
modifierFlags: [theEvent modifierFlags]
|
||||||
|
timestamp: 0
|
||||||
|
windowNumber: [theEvent windowNumber]
|
||||||
|
context: [theEvent context]
|
||||||
|
eventNumber: 0
|
||||||
|
trackingNumber: (int)YES
|
||||||
|
userData: (void *)r];
|
||||||
|
[self postEvent: e atStart: YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mouse exited event
|
||||||
|
if ((last) && (!now))
|
||||||
|
{
|
||||||
|
// Post cursor update event
|
||||||
|
e = [NSEvent enterExitEventWithType: NSCursorUpdate
|
||||||
|
location: loc
|
||||||
|
modifierFlags: [theEvent modifierFlags]
|
||||||
|
timestamp: 0
|
||||||
|
windowNumber: [theEvent windowNumber]
|
||||||
|
context: [theEvent context]
|
||||||
|
eventNumber: 0
|
||||||
|
trackingNumber: (int)NO
|
||||||
|
userData: (void *)r];
|
||||||
|
[self postEvent: e atStart: YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the cursor rectangles for the subviews
|
||||||
|
j = [sb count];
|
||||||
|
for (i = 0;i < j; ++i)
|
||||||
|
[self checkCursorRectangles:[sb objectAtIndex:i] forEvent:theEvent];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)theEvent
|
- (void)sendEvent:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
|
// If the cursor rects are invalid
|
||||||
|
// Then discard and reset
|
||||||
|
if (!cursor_rects_valid)
|
||||||
|
{
|
||||||
|
[self discardCursorRects];
|
||||||
|
[self resetCursorRects];
|
||||||
|
}
|
||||||
|
|
||||||
switch ([theEvent type])
|
switch ([theEvent type])
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// Mouse events
|
// Mouse events
|
||||||
//
|
//
|
||||||
|
@ -976,7 +1102,7 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
case NSLeftMouseDown:
|
case NSLeftMouseDown:
|
||||||
{
|
{
|
||||||
NSView *v = [content_view hitTest:[theEvent locationInWindow]];
|
NSView *v = [content_view hitTest:[theEvent locationInWindow]];
|
||||||
NSDebugLog([content_view description]);
|
NSDebugLog([v description]);
|
||||||
NSDebugLog(@"\n");
|
NSDebugLog(@"\n");
|
||||||
[v mouseDown:theEvent];
|
[v mouseDown:theEvent];
|
||||||
last_point = [theEvent locationInWindow];
|
last_point = [theEvent locationInWindow];
|
||||||
|
@ -1027,6 +1153,13 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
// should send a NSMouseEntered or NSMouseExited event
|
// should send a NSMouseEntered or NSMouseExited event
|
||||||
[self checkTrackingRectangles:content_view forEvent:theEvent];
|
[self checkTrackingRectangles:content_view forEvent:theEvent];
|
||||||
|
|
||||||
|
// We need to go through all of the views, and any with
|
||||||
|
// a cursor rectangle then we need to determine if we
|
||||||
|
// should send a cursor update event
|
||||||
|
// We only do this if we are the key window
|
||||||
|
if ([self isKeyWindow])
|
||||||
|
[self checkCursorRectangles: content_view forEvent: theEvent];
|
||||||
|
|
||||||
last_point = [theEvent locationInWindow];
|
last_point = [theEvent locationInWindow];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1098,6 +1231,20 @@ NSString *NSWindowWillMoveNotification = @"WindowWillMove";
|
||||||
//
|
//
|
||||||
case NSCursorUpdate:
|
case NSCursorUpdate:
|
||||||
{
|
{
|
||||||
|
// Is it a mouse entered
|
||||||
|
if ([theEvent trackingNumber])
|
||||||
|
{
|
||||||
|
// push the cursor
|
||||||
|
TrackingRectangle *r = (TrackingRectangle *)[theEvent userData];
|
||||||
|
NSCursor *c = (NSCursor *)[r owner];
|
||||||
|
[c push];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// it is a mouse exited
|
||||||
|
// so pop the cursor
|
||||||
|
[NSCursor pop];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSPeriodic:
|
case NSPeriodic:
|
||||||
|
|
169
configure
vendored
169
configure
vendored
|
@ -851,6 +851,11 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Use a .h file with #define's, instead of -D command-line switches
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Standard ANSI headers
|
# Standard ANSI headers
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
@ -863,11 +868,11 @@ else
|
||||||
ac_cv_c_cross=yes
|
ac_cv_c_cross=yes
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 867 "configure"
|
#line 872 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
main(){return(0);}
|
main(){return(0);}
|
||||||
EOF
|
EOF
|
||||||
{ (eval echo configure:871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
|
{ (eval echo configure:876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
|
||||||
if test -s conftest && (./conftest; exit) 2>/dev/null; then
|
if test -s conftest && (./conftest; exit) 2>/dev/null; then
|
||||||
ac_cv_c_cross=no
|
ac_cv_c_cross=no
|
||||||
else
|
else
|
||||||
|
@ -885,7 +890,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 889 "configure"
|
#line 894 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -893,7 +898,7 @@ else
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
EOF
|
EOF
|
||||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
{ (eval echo configure:897: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
{ (eval echo configure:902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||||
ac_err=`grep -v '^ *+' conftest.out`
|
ac_err=`grep -v '^ *+' conftest.out`
|
||||||
if test -z "$ac_err"; then
|
if test -z "$ac_err"; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
|
@ -908,7 +913,7 @@ rm -f conftest*
|
||||||
if test $ac_cv_header_stdc = yes; then
|
if test $ac_cv_header_stdc = yes; then
|
||||||
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
|
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 912 "configure"
|
#line 917 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -926,7 +931,7 @@ fi
|
||||||
if test $ac_cv_header_stdc = yes; then
|
if test $ac_cv_header_stdc = yes; then
|
||||||
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
|
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 930 "configure"
|
#line 935 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
EOF
|
EOF
|
||||||
|
@ -947,7 +952,7 @@ if test "$cross_compiling" = yes; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 951 "configure"
|
#line 956 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
|
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
|
||||||
|
@ -958,7 +963,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
|
||||||
exit (0); }
|
exit (0); }
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
{ (eval echo configure:962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
|
{ (eval echo configure:967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
|
||||||
if test -s conftest && (./conftest; exit) 2>/dev/null; then
|
if test -s conftest && (./conftest; exit) 2>/dev/null; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
|
@ -989,12 +994,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 993 "configure"
|
#line 998 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <$ac_hdr>
|
#include <$ac_hdr>
|
||||||
EOF
|
EOF
|
||||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
{ (eval echo configure:998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
{ (eval echo configure:1003: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||||
ac_err=`grep -v '^ *+' conftest.out`
|
ac_err=`grep -v '^ *+' conftest.out`
|
||||||
if test -z "$ac_err"; then
|
if test -z "$ac_err"; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
|
@ -1012,18 +1017,17 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
||||||
cat >> confdefs.h <<EOF
|
cat >> confdefs.h <<EOF
|
||||||
#define $ac_tr_hdr 1
|
#define $ac_tr_hdr 1
|
||||||
EOF
|
EOF
|
||||||
HAVE_TIFF=1
|
|
||||||
else
|
else
|
||||||
echo "$ac_t""no" 1>&6
|
echo "$ac_t""no" 1>&6
|
||||||
HAVE_TIFF=1
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if test "x$HAVE_TIFF" = "x0"
|
if test "x$ac_cv_header_tiff_h" != "xyes"
|
||||||
then
|
then
|
||||||
echo You must have the TIFF library installed.
|
echo You must have the TIFF Graphics library installed.
|
||||||
echo The most recent version "(v3.4)" should be available at:
|
echo The most required version "(v3.4)" should be available at:
|
||||||
echo
|
echo
|
||||||
echo ftp://ftp.sgi.com/graphics/tiff
|
echo ftp://ftp.sgi.com/graphics/tiff
|
||||||
echo
|
echo
|
||||||
|
@ -1031,7 +1035,6 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Look for the DPSClient library
|
# Look for the DPSClient library
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
@ -1043,12 +1046,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1047 "configure"
|
#line 1050 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <$ac_hdr>
|
#include <$ac_hdr>
|
||||||
EOF
|
EOF
|
||||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
{ (eval echo configure:1052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
{ (eval echo configure:1055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||||
ac_err=`grep -v '^ *+' conftest.out`
|
ac_err=`grep -v '^ *+' conftest.out`
|
||||||
if test -z "$ac_err"; then
|
if test -z "$ac_err"; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
|
@ -1066,15 +1069,14 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
||||||
cat >> confdefs.h <<EOF
|
cat >> confdefs.h <<EOF
|
||||||
#define $ac_tr_hdr 1
|
#define $ac_tr_hdr 1
|
||||||
EOF
|
EOF
|
||||||
HAVE_DPSCLIENT=1
|
|
||||||
else
|
else
|
||||||
echo "$ac_t""no" 1>&6
|
echo "$ac_t""no" 1>&6
|
||||||
HAVE_DPSCLIENT=0
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if test "x$HAVE_DPSCLIENT" = "x0"
|
if test "x$ac_cv_header_DPS_dpsclient_h" != "xyes"
|
||||||
then
|
then
|
||||||
echo You must have the DPSClient library installed.
|
echo You must have the DPSClient library installed.
|
||||||
echo The most recent public release, patched for GNUstep,
|
echo The most recent public release, patched for GNUstep,
|
||||||
|
@ -1084,13 +1086,12 @@ then
|
||||||
echo
|
echo
|
||||||
echo The most recent snapshot should be available at:
|
echo The most recent snapshot should be available at:
|
||||||
echo
|
echo
|
||||||
echo ftp://ftp.net-community.com/pub/GNUstep
|
echo ftp://alpha.gnu.ai.mit.edu/pub/gnustep
|
||||||
echo
|
echo
|
||||||
echo Configuration of the GNUstep GUI Library cannot continue.
|
echo Configuration of the GNUstep GUI Library cannot continue.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Operating system configuration
|
# Operating system configuration
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
@ -1149,19 +1150,7 @@ fi
|
||||||
|
|
||||||
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
||||||
|
|
||||||
# Transform confdefs.h into DEFS.
|
DEFS=-DHAVE_CONFIG_H
|
||||||
# Protect against shell expansion while executing Makefile rules.
|
|
||||||
# Protect against Makefile macro expansion.
|
|
||||||
cat > conftest.defs <<\EOF
|
|
||||||
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
|
|
||||||
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
|
|
||||||
s%\[%\\&%g
|
|
||||||
s%\]%\\&%g
|
|
||||||
s%\$%$$%g
|
|
||||||
EOF
|
|
||||||
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
|
|
||||||
rm -f conftest.defs
|
|
||||||
|
|
||||||
|
|
||||||
# Without the "./", some shells look in PATH for config.status.
|
# Without the "./", some shells look in PATH for config.status.
|
||||||
: ${CONFIG_STATUS=./config.status}
|
: ${CONFIG_STATUS=./config.status}
|
||||||
|
@ -1199,7 +1188,7 @@ done
|
||||||
ac_given_srcdir=$srcdir
|
ac_given_srcdir=$srcdir
|
||||||
ac_given_INSTALL="$INSTALL"
|
ac_given_INSTALL="$INSTALL"
|
||||||
|
|
||||||
trap 'rm -fr `echo "Makefile Source/Makefile Testing/Makefile Headers/gnustep/gui/config.h Documentation/Makefile Images/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
trap 'rm -fr `echo "Makefile Source/Makefile Testing/Makefile Documentation/Makefile Images/Makefile Headers/gnustep/gui/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||||
EOF
|
EOF
|
||||||
cat >> $CONFIG_STATUS <<EOF
|
cat >> $CONFIG_STATUS <<EOF
|
||||||
|
|
||||||
|
@ -1235,15 +1224,13 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
|
||||||
s%@INSTALL_DATA@%$INSTALL_DATA%g
|
s%@INSTALL_DATA@%$INSTALL_DATA%g
|
||||||
s%@RANLIB@%$RANLIB%g
|
s%@RANLIB@%$RANLIB%g
|
||||||
s%@LN_S@%$LN_S%g
|
s%@LN_S@%$LN_S%g
|
||||||
s%@HAVE_TIFF@%$HAVE_TIFF%g
|
|
||||||
s%@HAVE_DPSCLIENT@%$HAVE_DPSCLIENT%g
|
|
||||||
s%@config_include@%$config_include%g
|
s%@config_include@%$config_include%g
|
||||||
|
|
||||||
CEOF
|
CEOF
|
||||||
EOF
|
EOF
|
||||||
cat >> $CONFIG_STATUS <<EOF
|
cat >> $CONFIG_STATUS <<EOF
|
||||||
|
|
||||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile Source/Makefile Testing/Makefile Headers/gnustep/gui/config.h Documentation/Makefile Images/Makefile"}
|
CONFIG_FILES=\${CONFIG_FILES-"Makefile Source/Makefile Testing/Makefile Documentation/Makefile Images/Makefile"}
|
||||||
EOF
|
EOF
|
||||||
cat >> $CONFIG_STATUS <<\EOF
|
cat >> $CONFIG_STATUS <<\EOF
|
||||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||||
|
@ -1299,6 +1286,108 @@ s%@INSTALL@%$INSTALL%g
|
||||||
fi; done
|
fi; done
|
||||||
rm -f conftest.subs
|
rm -f conftest.subs
|
||||||
|
|
||||||
|
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
|
||||||
|
# NAME is the cpp macro being defined and VALUE is the value it is being given.
|
||||||
|
#
|
||||||
|
# ac_d sets the value in "#define NAME VALUE" lines.
|
||||||
|
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
|
||||||
|
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
|
||||||
|
ac_dC='\3'
|
||||||
|
ac_dD='%g'
|
||||||
|
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
|
||||||
|
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||||
|
ac_uB='\([ ]\)%\1#\2define\3'
|
||||||
|
ac_uC=' '
|
||||||
|
ac_uD='\4%g'
|
||||||
|
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
|
||||||
|
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||||
|
ac_eB='$%\1#\2define\3'
|
||||||
|
ac_eC=' '
|
||||||
|
ac_eD='%g'
|
||||||
|
|
||||||
|
CONFIG_HEADERS=${CONFIG_HEADERS-"Headers/gnustep/gui/config.h"}
|
||||||
|
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
|
||||||
|
# Support "outfile[:infile]", defaulting infile="outfile.in".
|
||||||
|
case "$ac_file" in
|
||||||
|
*:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
|
||||||
|
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||||
|
*) ac_file_in="${ac_file}.in" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo creating $ac_file
|
||||||
|
|
||||||
|
rm -f conftest.frag conftest.in conftest.out
|
||||||
|
cp $ac_given_srcdir/$ac_file_in conftest.in
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Transform confdefs.h into a sed script conftest.vals that substitutes
|
||||||
|
# the proper values into config.h.in to produce config.h. And first:
|
||||||
|
# Protect against being on the right side of a sed subst in config.status.
|
||||||
|
# Protect against being in an unquoted here document in config.status.
|
||||||
|
rm -f conftest.vals
|
||||||
|
cat > conftest.hdr <<\EOF
|
||||||
|
s/[\\&%]/\\&/g
|
||||||
|
s%[\\$`]%\\&%g
|
||||||
|
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
|
||||||
|
s%ac_d%ac_u%gp
|
||||||
|
s%ac_u%ac_e%gp
|
||||||
|
EOF
|
||||||
|
sed -n -f conftest.hdr confdefs.h > conftest.vals
|
||||||
|
rm -f conftest.hdr
|
||||||
|
|
||||||
|
# This sed command replaces #undef with comments. This is necessary, for
|
||||||
|
# example, in the case of _POSIX_SOURCE, which is predefined and required
|
||||||
|
# on some systems where configure will not decide to define it.
|
||||||
|
cat >> conftest.vals <<\EOF
|
||||||
|
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Break up conftest.vals because some shells have a limit on
|
||||||
|
# the size of here documents, and old seds have small limits too.
|
||||||
|
# Maximum number of lines to put in a single here document.
|
||||||
|
ac_max_here_lines=12
|
||||||
|
|
||||||
|
rm -f conftest.tail
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
ac_lines=`grep -c . conftest.vals`
|
||||||
|
# grep -c gives empty output for an empty file on some AIX systems.
|
||||||
|
if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
|
||||||
|
# Write a limited-size here document to conftest.frag.
|
||||||
|
echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
|
||||||
|
sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
|
||||||
|
echo 'CEOF
|
||||||
|
sed -f conftest.frag conftest.in > conftest.out
|
||||||
|
rm -f conftest.in
|
||||||
|
mv conftest.out conftest.in
|
||||||
|
' >> $CONFIG_STATUS
|
||||||
|
sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
|
||||||
|
rm -f conftest.vals
|
||||||
|
mv conftest.tail conftest.vals
|
||||||
|
done
|
||||||
|
rm -f conftest.vals
|
||||||
|
|
||||||
|
cat >> $CONFIG_STATUS <<\EOF
|
||||||
|
rm -f conftest.frag conftest.h
|
||||||
|
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
|
||||||
|
cat conftest.in >> conftest.h
|
||||||
|
rm -f conftest.in
|
||||||
|
if cmp -s $ac_file conftest.h 2>/dev/null; then
|
||||||
|
echo "$ac_file is unchanged"
|
||||||
|
rm -f conftest.h
|
||||||
|
else
|
||||||
|
# Remove last slash and all that follows it. Not all systems have dirname.
|
||||||
|
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
|
||||||
|
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
||||||
|
# The file is in a subdirectory.
|
||||||
|
test ! -d "$ac_dir" && mkdir "$ac_dir"
|
||||||
|
fi
|
||||||
|
rm -f $ac_file
|
||||||
|
mv conftest.h $ac_file
|
||||||
|
fi
|
||||||
|
fi; done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
23
configure.in
23
configure.in
|
@ -38,6 +38,11 @@ AC_PROG_INSTALL
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_LN_S
|
AC_LN_S
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Use a .h file with #define's, instead of -D command-line switches
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
AC_CONFIG_HEADER(Headers/gnustep/gui/config.h)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Standard ANSI headers
|
# Standard ANSI headers
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
@ -46,26 +51,25 @@ AC_HEADER_STDC
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Look for the TIFF library
|
# Look for the TIFF library
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
AC_CHECK_HEADERS(tiff.h, HAVE_TIFF=1, HAVE_TIFF=1)
|
AC_CHECK_HEADERS(tiff.h)
|
||||||
|
|
||||||
if test "x$HAVE_TIFF" = "x0"
|
if test "x$ac_cv_header_tiff_h" != "xyes"
|
||||||
then
|
then
|
||||||
echo You must have the TIFF library installed.
|
echo You must have the TIFF Graphics library installed.
|
||||||
echo The most recent version "(v3.4)" should be available at:
|
echo The most required version "(v3.4)" should be available at:
|
||||||
echo
|
echo
|
||||||
echo ftp://ftp.sgi.com/graphics/tiff
|
echo ftp://ftp.sgi.com/graphics/tiff
|
||||||
echo
|
echo
|
||||||
echo Configuration of the GNUstep GUI Library cannot continue.
|
echo Configuration of the GNUstep GUI Library cannot continue.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
AC_SUBST(HAVE_TIFF)
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Look for the DPSClient library
|
# Look for the DPSClient library
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
AC_CHECK_HEADERS(DPS/dpsclient.h, HAVE_DPSCLIENT=1, HAVE_DPSCLIENT=0)
|
AC_CHECK_HEADERS(DPS/dpsclient.h)
|
||||||
|
|
||||||
if test "x$HAVE_DPSCLIENT" = "x0"
|
if test "x$ac_cv_header_DPS_dpsclient_h" != "xyes"
|
||||||
then
|
then
|
||||||
echo You must have the DPSClient library installed.
|
echo You must have the DPSClient library installed.
|
||||||
echo The most recent public release, patched for GNUstep,
|
echo The most recent public release, patched for GNUstep,
|
||||||
|
@ -75,12 +79,11 @@ then
|
||||||
echo
|
echo
|
||||||
echo The most recent snapshot should be available at:
|
echo The most recent snapshot should be available at:
|
||||||
echo
|
echo
|
||||||
echo ftp://ftp.net-community.com/pub/GNUstep
|
echo ftp://alpha.gnu.ai.mit.edu/pub/gnustep
|
||||||
echo
|
echo
|
||||||
echo Configuration of the GNUstep GUI Library cannot continue.
|
echo Configuration of the GNUstep GUI Library cannot continue.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
AC_SUBST(HAVE_DPSCLIENT)
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Operating system configuration
|
# Operating system configuration
|
||||||
|
@ -91,5 +94,5 @@ AC_SUBST(config_include)
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Write the Makefiles and configuration files
|
# Write the Makefiles and configuration files
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
AC_OUTPUT(Makefile Source/Makefile Testing/Makefile Headers/gnustep/gui/config.h Documentation/Makefile Images/Makefile)
|
AC_OUTPUT(Makefile Source/Makefile Testing/Makefile Documentation/Makefile Images/Makefile)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue