mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:10:47 +00:00
Numerous WIN32 and bug fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2380 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
72921c6e77
commit
74265dc7fb
17 changed files with 213 additions and 132 deletions
44
ChangeLog
44
ChangeLog
|
@ -1,3 +1,47 @@
|
||||||
|
Sat Aug 16 16:28:31 1997 Scott Christley <scottc@net-community.com>
|
||||||
|
|
||||||
|
* Headers/gnustep/gui/NSApplication.h (+setNullEvent:): New method.
|
||||||
|
(+getNullEvent): New method.
|
||||||
|
(NSApp): Eliminate global variable.
|
||||||
|
* Headers/gnustep/gui/NSWindow.h (-performDeminiaturize:): New method.
|
||||||
|
(-performHide:): New method.
|
||||||
|
(-performUnhide:): New method.
|
||||||
|
* Source/Makefile.in: Rename variables.
|
||||||
|
* Source/NSApplication.m (+setNullEvent:): New method.
|
||||||
|
(+getNullEvent): New method.
|
||||||
|
(-peekEventMatchingMask:untilDate:inMode:dequeue:): Modify to be
|
||||||
|
more like the nextEvent.. method.
|
||||||
|
(-hide:): Call performHide: method.
|
||||||
|
(-unhide:): Call performUnhide: method.
|
||||||
|
* Source/NSButton.m (mouseDown:): Add method calls to capture and
|
||||||
|
release the mouse. Set the action mask.
|
||||||
|
* Source/NSCell.m (-setDoubleValue:): Don't set the cell type.
|
||||||
|
(-setFloatValue:, -setIntValue:, -setStringValue:): Likewise.
|
||||||
|
* Source/NSEvent.m: Don't access application object through
|
||||||
|
the global variable, use method instead.
|
||||||
|
* Source/NSFont.m (getFont, setFont): Rename to getNSFont and
|
||||||
|
setNSFont and make non-static so that they can be called
|
||||||
|
from the backend implementation.
|
||||||
|
* Source/NSMatrix.m (-initWithFrame:mode:prototype:numberOfRows:
|
||||||
|
numberOfColumns:): Call super's initWithFrame:
|
||||||
|
(mouseDown:): Capture and release the mouse when tracking. Don't
|
||||||
|
access application object through the global variable, use
|
||||||
|
method instead.
|
||||||
|
* Source/NSMenu.m: Don't access application object through the
|
||||||
|
global variable, use method instead.
|
||||||
|
* Source/NSScroller.m: Likewise.
|
||||||
|
* Source/NSTextFieldCell.m (-dealloc, -copyWithZone:): New method.
|
||||||
|
Fix retain/release on colors.
|
||||||
|
* Source/NSWindow.m (-deminiaturize:): Call performDeminiaturize.
|
||||||
|
(-makeFirstResponder:): Check that first responder exists before
|
||||||
|
telling it to resign.
|
||||||
|
(-performDeminiaturize:): New method.
|
||||||
|
(-performHide:): New method.
|
||||||
|
(-performUnhide:): New method.
|
||||||
|
* Source/externs.m: Add global variables.
|
||||||
|
* Source/libgnustep-gui.def: Add functions.
|
||||||
|
* Source/libgnustep-gui.m: Eliminate unneeded code.
|
||||||
|
|
||||||
Wed Aug 6 13:27:53 1997 Ovidiu Predescu <ovidiu@net-community.com>
|
Wed Aug 6 13:27:53 1997 Ovidiu Predescu <ovidiu@net-community.com>
|
||||||
|
|
||||||
* Source/NSApplication (-nextEventMatchingMask:untilDate:inMode:
|
* Source/NSApplication (-nextEventMatchingMask:untilDate:inMode:
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
@class NSWindow;
|
@class NSWindow;
|
||||||
@class NSDPSContext;
|
@class NSDPSContext;
|
||||||
|
|
||||||
extern id NSApp;
|
|
||||||
|
|
||||||
typedef struct _NSModalSession *NSModalSession;
|
typedef struct _NSModalSession *NSModalSession;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -270,6 +268,10 @@ extern NSString *NSEventTrackingRunLoopMode;
|
||||||
//
|
//
|
||||||
@interface NSApplication (GNUstepBackend)
|
@interface NSApplication (GNUstepBackend)
|
||||||
|
|
||||||
|
// the null event
|
||||||
|
+ (void)setNullEvent:(NSEvent *)e;
|
||||||
|
+ (NSEvent *)getNullEvent;
|
||||||
|
|
||||||
// Get next event
|
// Get next event
|
||||||
- (NSEvent *)getNextEvent;
|
- (NSEvent *)getNextEvent;
|
||||||
- (NSEvent *)peekNextEvent;
|
- (NSEvent *)peekNextEvent;
|
||||||
|
|
|
@ -419,6 +419,10 @@ extern NSSize NSTokenSize;
|
||||||
- (void)initDefaults;
|
- (void)initDefaults;
|
||||||
- cleanInit;
|
- cleanInit;
|
||||||
|
|
||||||
|
- (void)performDeminiaturize:sender;
|
||||||
|
- (void)performHide:sender;
|
||||||
|
- (void)performUnhide:sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
|
|
@ -68,9 +68,9 @@ LDFLAGS = @LDFLAGS@ -o
|
||||||
LD = ld
|
LD = ld
|
||||||
|
|
||||||
LDOUT =
|
LDOUT =
|
||||||
LIB = ar
|
AR = ar
|
||||||
LIBOUT =
|
AROUT =
|
||||||
LIBFLAGS = rc
|
ARFLAGS = rc
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
RC =
|
RC =
|
||||||
DLLTOOL = @DLLTOOL@
|
DLLTOOL = @DLLTOOL@
|
||||||
|
@ -264,12 +264,12 @@ src: @STATIC_LIBRARY@ @SHARED_LIBRARY@
|
||||||
|
|
||||||
# library
|
# library
|
||||||
$(MAIN_FILE)$(libext): $(OBJS)
|
$(MAIN_FILE)$(libext): $(OBJS)
|
||||||
$(LIB) $(LIBFLAGS) $(LIBOUT)$(MAIN_FILE)$(libext) $(OBJS)
|
$(AR) $(ARFLAGS) $(AROUT)$(MAIN_FILE)$(libext) $(OBJS)
|
||||||
$(RANLIB) $(MAIN_FILE)$(libext)
|
$(RANLIB) $(MAIN_FILE)$(libext)
|
||||||
|
|
||||||
# static library when building DLL
|
# static library when building DLL
|
||||||
$(MAIN_FILE)_s$(libext): $(OBJS)
|
$(MAIN_FILE)_s$(libext): $(OBJS)
|
||||||
$(LIB) $(LIBFLAGS) $(LIBOUT)$(MAIN_FILE)_s$(libext) $(OBJS)
|
$(AR) $(ARFLAGS) $(AROUT)$(MAIN_FILE)_s$(libext) $(OBJS)
|
||||||
$(RANLIB) $(MAIN_FILE)_s$(libext)
|
$(RANLIB) $(MAIN_FILE)_s$(libext)
|
||||||
|
|
||||||
$(MAIN_FILE).def: FORCE
|
$(MAIN_FILE).def: FORCE
|
||||||
|
@ -366,7 +366,9 @@ uninstall:
|
||||||
rm -rf $(includedir)/gnustep/gui
|
rm -rf $(includedir)/gnustep/gui
|
||||||
rm -rf $(includedir)/AppKit
|
rm -rf $(includedir)/AppKit
|
||||||
rm -rf $(includedir)/DPSClient
|
rm -rf $(includedir)/DPSClient
|
||||||
rm -rf $(libdir)/$(MAIN_FILE)$(libext)
|
rm -f $(libdir)/$(MAIN_FILE)$(libext)
|
||||||
|
rm -f $(libdir)/$(MAIN_FILE)_s$(libext)
|
||||||
|
rm -f $(bindir)/$(MAIN_FILE).dll
|
||||||
|
|
||||||
Makefile: $(srcdir)/Makefile.in ../config.status
|
Makefile: $(srcdir)/Makefile.in ../config.status
|
||||||
cd ..; $(SHELL) config.status
|
cd ..; $(SHELL) config.status
|
||||||
|
@ -379,6 +381,8 @@ clean:
|
||||||
rm -f *~
|
rm -f *~
|
||||||
rm -f *$(oext)
|
rm -f *$(oext)
|
||||||
rm -f $(MAIN_FILE)$(libext)
|
rm -f $(MAIN_FILE)$(libext)
|
||||||
|
rm -f $(MAIN_FILE)_s$(libext)
|
||||||
|
rm -f $(MAIN_FILE).dll $(MAIN_FILE).exp $(MAIN_FILE).base
|
||||||
rm -f $(INIT_FILE).c
|
rm -f $(INIT_FILE).c
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f Makefile
|
rm -f Makefile
|
||||||
|
|
|
@ -43,13 +43,13 @@
|
||||||
#include <AppKit/NSMenuItem.h>
|
#include <AppKit/NSMenuItem.h>
|
||||||
#include <AppKit/NSCursor.h>
|
#include <AppKit/NSCursor.h>
|
||||||
|
|
||||||
extern id NSApp;
|
|
||||||
extern NSEvent *gnustep_gui_null_event;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Class variables
|
// Class variables
|
||||||
//
|
//
|
||||||
static BOOL gnustep_gui_app_is_in_dealloc;
|
static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
|
static NSEvent *gnustep_gui_null_event;
|
||||||
|
static id NSApp;
|
||||||
|
|
||||||
@implementation NSApplication
|
@implementation NSApplication
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -465,41 +465,21 @@ static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
inMode:(NSString *)mode
|
inMode:(NSString *)mode
|
||||||
dequeue:(BOOL)flag
|
dequeue:(BOOL)flag
|
||||||
{
|
{
|
||||||
NSEvent *e;
|
NSEvent *event = nil;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
// If the queue isn't empty then check those messages
|
event = [self _eventMatchingMask:mask];
|
||||||
if ([event_queue count])
|
|
||||||
{
|
|
||||||
j = [event_queue count];
|
|
||||||
for (i = j-1;i >= 0; --i)
|
|
||||||
{
|
|
||||||
e = [event_queue objectAtIndex: i];
|
|
||||||
if ([self event: e matchMask: mask])
|
|
||||||
{
|
|
||||||
[event_queue removeObjectAtIndex: i];
|
|
||||||
[self setCurrentEvent: e];
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not in queue so peek for event
|
if (!event)
|
||||||
e = [self peekNextEvent];
|
|
||||||
|
|
||||||
// Check mask
|
|
||||||
if ([self event: e matchMask: mask])
|
|
||||||
{
|
{
|
||||||
if (e)
|
// Not in queue so peek for event
|
||||||
{
|
event = [self peekNextEvent];
|
||||||
[event_queue removeObject: e];
|
|
||||||
}
|
event = [self _eventMatchingMask:mask];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return nil;
|
|
||||||
|
|
||||||
// Unhide the cursor if necessary
|
// Unhide the cursor if necessary
|
||||||
if (e != gnustep_gui_null_event)
|
if (event && (event != gnustep_gui_null_event))
|
||||||
{
|
{
|
||||||
NSEventType type;
|
NSEventType type;
|
||||||
|
|
||||||
|
@ -507,7 +487,7 @@ static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
if ([NSCursor isHiddenUntilMouseMoves])
|
if ([NSCursor isHiddenUntilMouseMoves])
|
||||||
{
|
{
|
||||||
// Make sure the event is a mouse event before unhiding
|
// Make sure the event is a mouse event before unhiding
|
||||||
type = [e type];
|
type = [event type];
|
||||||
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|
||||||
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|
||||||
|| (type == NSMouseMoved))
|
|| (type == NSMouseMoved))
|
||||||
|
@ -515,8 +495,7 @@ static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[self setCurrentEvent: e];
|
return event;
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
||||||
|
@ -583,15 +562,16 @@ static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
//
|
//
|
||||||
- (void)hide:sender
|
- (void)hide:sender
|
||||||
{
|
{
|
||||||
int i, j;
|
id e;
|
||||||
NSWindow *w;
|
NSWindow *w;
|
||||||
|
|
||||||
j = [window_list count];
|
// TODO: hide the menu
|
||||||
for (i = 0;i < j; ++i)
|
|
||||||
{
|
// Tell the windows to hide
|
||||||
w = [window_list objectAtIndex:i];
|
e = [window_list objectEnumerator];
|
||||||
// Do something to hide the window
|
while ((w = [e nextObject]))
|
||||||
}
|
[w performHide: sender];
|
||||||
|
|
||||||
app_is_hidden = YES;
|
app_is_hidden = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,17 +582,19 @@ static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
|
|
||||||
- (void)unhide:sender
|
- (void)unhide:sender
|
||||||
{
|
{
|
||||||
int i, j;
|
id e;
|
||||||
NSWindow *w;
|
NSWindow *w;
|
||||||
|
|
||||||
app_is_hidden = NO;
|
// Tell the windows to unhide
|
||||||
j = [window_list count];
|
e = [window_list objectEnumerator];
|
||||||
for (i = 0;i < j; ++i)
|
while ((w = [e nextObject]))
|
||||||
{
|
[w performUnhide: sender];
|
||||||
w = [window_list objectAtIndex:i];
|
|
||||||
// Do something to unhide the window
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TODO: unhide the menu
|
||||||
|
|
||||||
|
app_is_hidden = NO;
|
||||||
|
|
||||||
|
// Bring the key window to the front
|
||||||
[[self keyWindow] makeKeyAndOrderFront:self];
|
[[self keyWindow] makeKeyAndOrderFront:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,6 +1058,16 @@ static BOOL gnustep_gui_app_is_in_dealloc;
|
||||||
//
|
//
|
||||||
@implementation NSApplication (GNUstepBackend)
|
@implementation NSApplication (GNUstepBackend)
|
||||||
|
|
||||||
|
+ (void)setNullEvent:(NSEvent *)e
|
||||||
|
{
|
||||||
|
gnustep_gui_null_event = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSEvent *)getNullEvent;
|
||||||
|
{
|
||||||
|
return gnustep_gui_null_event;
|
||||||
|
}
|
||||||
|
|
||||||
// Get next event
|
// Get next event
|
||||||
- (NSEvent *)getNextEvent
|
- (NSEvent *)getNextEvent
|
||||||
{
|
{
|
||||||
|
|
|
@ -289,7 +289,7 @@ id gnustep_gui_nsbutton_class = nil;
|
||||||
NSEvent *e;
|
NSEvent *e;
|
||||||
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
|
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
|
||||||
NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDraggedMask;
|
NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDraggedMask;
|
||||||
// int oldActionMask = [cell sendActionOn:0];
|
int oldActionMask;
|
||||||
|
|
||||||
NSDebugLog(@"NSButton mouseDown\n");
|
NSDebugLog(@"NSButton mouseDown\n");
|
||||||
|
|
||||||
|
@ -297,8 +297,15 @@ id gnustep_gui_nsbutton_class = nil;
|
||||||
if (![self isEnabled])
|
if (![self isEnabled])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Have NSCell send action only if we are continuous
|
||||||
|
if ([cell isContinuous])
|
||||||
|
oldActionMask = [cell sendActionOn:0];
|
||||||
|
else
|
||||||
|
oldActionMask = [cell sendActionOn: NSPeriodicMask];
|
||||||
|
|
||||||
// capture mouse
|
// capture mouse
|
||||||
// [[self window] captureMouse: self];
|
[[self window] captureMouse: self];
|
||||||
|
|
||||||
[self lockFocus];
|
[self lockFocus];
|
||||||
|
|
||||||
done = NO;
|
done = NO;
|
||||||
|
@ -321,7 +328,7 @@ id gnustep_gui_nsbutton_class = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release mouse
|
// Release mouse
|
||||||
// [[self window] releaseMouse: self];
|
[[self window] releaseMouse: self];
|
||||||
|
|
||||||
// If the mouse went up in the button
|
// If the mouse went up in the button
|
||||||
if (mouseUp)
|
if (mouseUp)
|
||||||
|
@ -337,11 +344,11 @@ id gnustep_gui_nsbutton_class = nil;
|
||||||
[self unlockFocus];
|
[self unlockFocus];
|
||||||
|
|
||||||
/* Restore the old action mask */
|
/* Restore the old action mask */
|
||||||
// [cell sendActionOn:oldActionMask];
|
[cell sendActionOn:oldActionMask];
|
||||||
|
|
||||||
// Have the target perform the action
|
// Have the target perform the action
|
||||||
// if (mouseUp)
|
if (mouseUp)
|
||||||
// [self sendAction:[self action] to:[self target]];
|
[self sendAction:[self action] to:[self target]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)performClick:(id)sender
|
- (void)performClick:(id)sender
|
||||||
|
|
|
@ -259,7 +259,6 @@
|
||||||
|
|
||||||
[contents release];
|
[contents release];
|
||||||
contents = [[number stringValue] retain];
|
contents = [[number stringValue] retain];
|
||||||
[self setType:NSTextCellType];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFloatValue:(float)aFloat
|
- (void)setFloatValue:(float)aFloat
|
||||||
|
@ -268,7 +267,6 @@
|
||||||
|
|
||||||
[contents release];
|
[contents release];
|
||||||
contents = [[number stringValue] retain];
|
contents = [[number stringValue] retain];
|
||||||
[self setType:NSTextCellType];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setIntValue:(int)anInt
|
- (void)setIntValue:(int)anInt
|
||||||
|
@ -277,12 +275,10 @@
|
||||||
|
|
||||||
[contents release];
|
[contents release];
|
||||||
contents = [[number stringValue] retain];
|
contents = [[number stringValue] retain];
|
||||||
[self setType:NSTextCellType];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStringValue:(NSString *)aString
|
- (void)setStringValue:(NSString *)aString
|
||||||
{
|
{
|
||||||
[self setType:NSTextCellType];
|
|
||||||
aString = [aString copy];
|
aString = [aString copy];
|
||||||
[contents release];
|
[contents release];
|
||||||
if (!aString)
|
if (!aString)
|
||||||
|
|
|
@ -346,13 +346,13 @@ static NSRecursiveLock* timersLock = nil;
|
||||||
modifierFlags:0
|
modifierFlags:0
|
||||||
timestamp:[[NSDate date] timeIntervalSinceReferenceDate]
|
timestamp:[[NSDate date] timeIntervalSinceReferenceDate]
|
||||||
windowNumber:0
|
windowNumber:0
|
||||||
context:[NSApp context]
|
context:[[NSApplication sharedApplication] context]
|
||||||
subtype:0
|
subtype:0
|
||||||
data1:0
|
data1:0
|
||||||
data2:0];
|
data2:0];
|
||||||
|
|
||||||
NSDebugLog (@"_timerFired:");
|
NSDebugLog (@"_timerFired:");
|
||||||
[NSApp postEvent:periodicEvent atStart:NO];
|
[[NSApplication sharedApplication] postEvent:periodicEvent atStart:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)_registerRealTimer:(NSTimer*)timer
|
+ (void)_registerRealTimer:(NSTimer*)timer
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
Convention (see the red book). */
|
Convention (see the red book). */
|
||||||
static NSMutableSet* fontsUsed = nil;
|
static NSMutableSet* fontsUsed = nil;
|
||||||
|
|
||||||
static NSFont* getFont(NSString* key, NSString* defaultFontName, float fontSize)
|
NSFont* getNSFont(NSString* key, NSString* defaultFontName,
|
||||||
|
float fontSize)
|
||||||
{
|
{
|
||||||
NSString* fontName;
|
NSString* fontName;
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ static NSFont* getFont(NSString* key, NSString* defaultFontName, float fontSize)
|
||||||
return [NSFont fontWithName:fontName size:fontSize];
|
return [NSFont fontWithName:fontName size:fontSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setFont(NSString* key, NSFont* font)
|
void setNSFont(NSString* key, NSFont* font)
|
||||||
{
|
{
|
||||||
NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
|
@ -87,34 +88,34 @@ static void setFont(NSString* key, NSFont* font)
|
||||||
|
|
||||||
+ (NSFont*)boldSystemFontOfSize:(float)fontSize
|
+ (NSFont*)boldSystemFontOfSize:(float)fontSize
|
||||||
{
|
{
|
||||||
return getFont (@"NSBoldFont", @"Helvetica-Bold", fontSize);
|
return getNSFont (@"NSBoldFont", @"Helvetica-Bold", fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFont*)systemFontOfSize:(float)fontSize
|
+ (NSFont*)systemFontOfSize:(float)fontSize
|
||||||
{
|
{
|
||||||
return getFont (@"NSFont", @"Helvetica", fontSize);
|
return getNSFont (@"NSFont", @"Helvetica", fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFont*)userFixedPitchFontOfSize:(float)fontSize
|
+ (NSFont*)userFixedPitchFontOfSize:(float)fontSize
|
||||||
{
|
{
|
||||||
return getFont (@"NSUserFixedPitchFont", @"Courier", fontSize);
|
return getNSFont (@"NSUserFixedPitchFont", @"Courier", fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFont*)userFontOfSize:(float)fontSize
|
+ (NSFont*)userFontOfSize:(float)fontSize
|
||||||
{
|
{
|
||||||
return getFont (@"NSUserFont", @"Helvetica", fontSize);
|
return getNSFont (@"NSUserFont", @"Helvetica", fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setting the preferred user fonts */
|
/* Setting the preferred user fonts */
|
||||||
|
|
||||||
+ (void)setUserFixedPitchFont:(NSFont*)font
|
+ (void)setUserFixedPitchFont:(NSFont*)font
|
||||||
{
|
{
|
||||||
setFont (@"NSUserFixedPitchFont", font);
|
setNSFont (@"NSUserFixedPitchFont", font);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)setUserFont:(NSFont*)font
|
+ (void)setUserFont:(NSFont*)font
|
||||||
{
|
{
|
||||||
setFont (@"NSUserFont", font);
|
setNSFont (@"NSUserFont", font);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following method should be rewritten in the backend and it has to be
|
/* The following method should be rewritten in the backend and it has to be
|
||||||
|
|
|
@ -349,6 +349,8 @@ static int mouseDownFlags = 0;
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
[super initWithFrame: frameRect];
|
||||||
|
|
||||||
ASSIGN(cellPrototype, prototype);
|
ASSIGN(cellPrototype, prototype);
|
||||||
|
|
||||||
cells = [[NSMutableArray alloc] initWithCapacity:rows];
|
cells = [[NSMutableArray alloc] initWithCapacity:rows];
|
||||||
|
@ -1164,6 +1166,10 @@ static int mouseDownFlags = 0;
|
||||||
if (mode != NSTrackModeMatrix)
|
if (mode != NSTrackModeMatrix)
|
||||||
[NSEvent startPeriodicEventsAfterDelay:0.05 withPeriod:0.05];
|
[NSEvent startPeriodicEventsAfterDelay:0.05 withPeriod:0.05];
|
||||||
ASSIGN(lastEvent, theEvent);
|
ASSIGN(lastEvent, theEvent);
|
||||||
|
|
||||||
|
// capture mouse
|
||||||
|
[[self window] captureMouse: self];
|
||||||
|
|
||||||
[self lockFocus];
|
[self lockFocus];
|
||||||
|
|
||||||
while (!done) {
|
while (!done) {
|
||||||
|
@ -1286,12 +1292,14 @@ static int mouseDownFlags = 0;
|
||||||
|
|
||||||
/* Get the next event */
|
/* Get the next event */
|
||||||
while (!shouldProceedEvent) {
|
while (!shouldProceedEvent) {
|
||||||
theEvent = [NSApp nextEventMatchingMask:eventMask
|
theEvent = [[NSApplication sharedApplication]
|
||||||
untilDate:[NSDate distantFuture]
|
nextEventMatchingMask:eventMask
|
||||||
inMode:NSEventTrackingRunLoopMode
|
untilDate:[NSDate distantFuture]
|
||||||
dequeue:YES];
|
inMode:NSEventTrackingRunLoopMode
|
||||||
|
dequeue:YES];
|
||||||
switch ([theEvent type]) {
|
switch ([theEvent type]) {
|
||||||
case NSPeriodic:
|
case NSPeriodic:
|
||||||
|
NSDebugLog(@"NSMatrix: got NSPeriodic event\n");
|
||||||
shouldProceedEvent = YES;
|
shouldProceedEvent = YES;
|
||||||
break;
|
break;
|
||||||
case NSLeftMouseUp:
|
case NSLeftMouseUp:
|
||||||
|
@ -1300,6 +1308,7 @@ static int mouseDownFlags = 0;
|
||||||
ASSIGN(lastEvent, theEvent);
|
ASSIGN(lastEvent, theEvent);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
NSDebugLog(@"NSMatrix: got event type: %d\n", [theEvent type]);
|
||||||
ASSIGN(lastEvent, theEvent);
|
ASSIGN(lastEvent, theEvent);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1308,6 +1317,9 @@ static int mouseDownFlags = 0;
|
||||||
lastLocation = [self convertPoint:lastLocation fromView:nil];
|
lastLocation = [self convertPoint:lastLocation fromView:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release mouse
|
||||||
|
[[self window] releaseMouse: self];
|
||||||
|
|
||||||
/* Finalize the selection */
|
/* Finalize the selection */
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case NSTrackModeMatrix:
|
case NSTrackModeMatrix:
|
||||||
|
|
|
@ -428,8 +428,9 @@ static Class menuCellClass = nil;
|
||||||
|
|
||||||
id cells;
|
id cells;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
id theApp = [NSApplication sharedApplication];
|
||||||
|
|
||||||
if (![[NSApp mainMenu] autoenablesItems])
|
if (![[theApp mainMenu] autoenablesItems])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cells = [menuCells itemArray];
|
cells = [menuCells itemArray];
|
||||||
|
@ -471,7 +472,7 @@ static Class menuCellClass = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the key window's responder chain */
|
/* Search the key window's responder chain */
|
||||||
keyWindow = [NSApp keyWindow];
|
keyWindow = [theApp keyWindow];
|
||||||
responder = [keyWindow firstResponder];
|
responder = [keyWindow firstResponder];
|
||||||
while (responder && !found) {
|
while (responder && !found) {
|
||||||
if ([responder respondsToSelector:action]) {
|
if ([responder respondsToSelector:action]) {
|
||||||
|
@ -505,7 +506,7 @@ static Class menuCellClass = nil;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow = [NSApp mainWindow];
|
mainWindow = [theApp mainWindow];
|
||||||
if (mainWindow != keyWindow) {
|
if (mainWindow != keyWindow) {
|
||||||
/* Search the main window's responder chain */
|
/* Search the main window's responder chain */
|
||||||
responder = [mainWindow firstResponder];
|
responder = [mainWindow firstResponder];
|
||||||
|
@ -544,16 +545,16 @@ static Class menuCellClass = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the NSApplication object */
|
/* Search the NSApplication object */
|
||||||
if ([NSApp respondsToSelector:action]) {
|
if ([theApp respondsToSelector:action]) {
|
||||||
if ([NSApp respondsToSelector:@selector(validateMenuItem:)])
|
if ([theApp respondsToSelector:@selector(validateMenuItem:)])
|
||||||
[cell setEnabled:[NSApp validateMenuItem:cell]];
|
[cell setEnabled:[theApp validateMenuItem:cell]];
|
||||||
else
|
else
|
||||||
[cell setEnabled:YES];
|
[cell setEnabled:YES];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the NSApplication object's delegate */
|
/* Search the NSApplication object's delegate */
|
||||||
delegate = [NSApp delegate];
|
delegate = [theApp delegate];
|
||||||
if ([delegate respondsToSelector:action]) {
|
if ([delegate respondsToSelector:action]) {
|
||||||
if ([delegate respondsToSelector:@selector(validateMenuItem:)])
|
if ([delegate respondsToSelector:@selector(validateMenuItem:)])
|
||||||
[cell setEnabled:[delegate validateMenuItem:cell]];
|
[cell setEnabled:[delegate validateMenuItem:cell]];
|
||||||
|
@ -579,6 +580,7 @@ static Class menuCellClass = nil;
|
||||||
NSWindow* mainWindow;
|
NSWindow* mainWindow;
|
||||||
id responder;
|
id responder;
|
||||||
id delegate;
|
id delegate;
|
||||||
|
id theApp = [NSApplication sharedApplication];
|
||||||
|
|
||||||
if (![cell isEnabled])
|
if (![cell isEnabled])
|
||||||
return;
|
return;
|
||||||
|
@ -592,7 +594,7 @@ static Class menuCellClass = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the key window's responder chain */
|
/* Search the key window's responder chain */
|
||||||
keyWindow = [NSApp keyWindow];
|
keyWindow = [theApp keyWindow];
|
||||||
responder = [keyWindow firstResponder];
|
responder = [keyWindow firstResponder];
|
||||||
while (responder) {
|
while (responder) {
|
||||||
if ([responder respondsToSelector:action]) {
|
if ([responder respondsToSelector:action]) {
|
||||||
|
@ -615,7 +617,7 @@ static Class menuCellClass = nil;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow = [NSApp mainWindow];
|
mainWindow = [theApp mainWindow];
|
||||||
if (mainWindow != keyWindow) {
|
if (mainWindow != keyWindow) {
|
||||||
/* Search the main window's responder chain */
|
/* Search the main window's responder chain */
|
||||||
responder = [mainWindow firstResponder];
|
responder = [mainWindow firstResponder];
|
||||||
|
@ -642,13 +644,13 @@ static Class menuCellClass = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the NSApplication object */
|
/* Search the NSApplication object */
|
||||||
if ([NSApp respondsToSelector:action]) {
|
if ([theApp respondsToSelector:action]) {
|
||||||
[NSApp perform:action withObject:cell];
|
[theApp perform:action withObject:cell];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the NSApplication object's delegate */
|
/* Search the NSApplication object's delegate */
|
||||||
delegate = [NSApp delegate];
|
delegate = [theApp delegate];
|
||||||
if ([delegate respondsToSelector:action]) {
|
if ([delegate respondsToSelector:action]) {
|
||||||
[delegate perform:action withObject:cell];
|
[delegate perform:action withObject:cell];
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -395,10 +395,11 @@ static NSButtonCell* knobCell = nil;
|
||||||
[[NSRunLoop currentRunLoop] limitDateForMode:NSEventTrackingRunLoopMode];
|
[[NSRunLoop currentRunLoop] limitDateForMode:NSEventTrackingRunLoopMode];
|
||||||
|
|
||||||
while (eventType != NSLeftMouseUp) {
|
while (eventType != NSLeftMouseUp) {
|
||||||
theEvent = [NSApp nextEventMatchingMask:eventMask
|
theEvent = [[NSApplication sharedApplication]
|
||||||
untilDate:[NSDate distantFuture]
|
nextEventMatchingMask:eventMask
|
||||||
inMode:NSEventTrackingRunLoopMode
|
untilDate:[NSDate distantFuture]
|
||||||
dequeue:YES];
|
inMode:NSEventTrackingRunLoopMode
|
||||||
|
dequeue:YES];
|
||||||
eventType = [theEvent type];
|
eventType = [theEvent type];
|
||||||
|
|
||||||
if (eventType != NSPeriodic)
|
if (eventType != NSPeriodic)
|
||||||
|
@ -467,10 +468,11 @@ static NSButtonCell* knobCell = nil;
|
||||||
if (shouldReturn)
|
if (shouldReturn)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
theEvent = [NSApp nextEventMatchingMask:eventMask
|
theEvent = [[NSApplication sharedApplication]
|
||||||
untilDate:[NSDate distantFuture]
|
nextEventMatchingMask:eventMask
|
||||||
inMode:NSEventTrackingRunLoopMode // NSDefaultRunLoopMode
|
untilDate:[NSDate distantFuture]
|
||||||
dequeue:YES];
|
inMode:NSEventTrackingRunLoopMode // NSDefaultRunLoopMode
|
||||||
|
dequeue:YES];
|
||||||
eventType = [theEvent type];
|
eventType = [theEvent type];
|
||||||
location = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
location = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
_hitPart = [self testPart:location];
|
_hitPart = [self testPart:location];
|
||||||
|
|
|
@ -76,14 +76,31 @@
|
||||||
[self setScrollable:YES];
|
[self setScrollable:YES];
|
||||||
[self setEditable:YES];
|
[self setEditable:YES];
|
||||||
[self setAlignment:NSLeftTextAlignment];
|
[self setAlignment:NSLeftTextAlignment];
|
||||||
|
|
||||||
background_color = [NSColor whiteColor];
|
[self setBackgroundColor: [NSColor whiteColor]];
|
||||||
text_color = [NSColor blackColor];
|
[self setTextColor: [NSColor blackColor]];
|
||||||
cell_font = [NSFont systemFontOfSize:16];
|
[self setFont: [NSFont systemFontOfSize: 16]];
|
||||||
draw_background = YES;
|
draw_background = YES;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[background_color release];
|
||||||
|
[text_color release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)copyWithZone:(NSZone*)zone
|
||||||
|
{
|
||||||
|
NSTextFieldCell* c = [super copyWithZone:zone];
|
||||||
|
|
||||||
|
[c setBackgroundColor: background_color];
|
||||||
|
[c setTextColor: text_color];
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Modifying Graphic Attributes
|
// Modifying Graphic Attributes
|
||||||
//
|
//
|
||||||
|
@ -99,6 +116,8 @@
|
||||||
|
|
||||||
- (void)setBackgroundColor:(NSColor *)aColor
|
- (void)setBackgroundColor:(NSColor *)aColor
|
||||||
{
|
{
|
||||||
|
[aColor retain];
|
||||||
|
[background_color release];
|
||||||
background_color = aColor;
|
background_color = aColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +128,8 @@
|
||||||
|
|
||||||
- (void)setTextColor:(NSColor *)aColor
|
- (void)setTextColor:(NSColor *)aColor
|
||||||
{
|
{
|
||||||
|
[aColor retain];
|
||||||
|
[text_color release];
|
||||||
text_color = aColor;
|
text_color = aColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -791,6 +791,8 @@
|
||||||
is_miniaturized = NO;
|
is_miniaturized = NO;
|
||||||
visible = YES;
|
visible = YES;
|
||||||
|
|
||||||
|
[self performDeminiaturize:self];
|
||||||
|
|
||||||
// Notify our delegate
|
// Notify our delegate
|
||||||
[nc postNotificationName: NSWindowDidDeminiaturizeNotification object: self];
|
[nc postNotificationName: NSWindowDidDeminiaturizeNotification object: self];
|
||||||
}
|
}
|
||||||
|
@ -899,7 +901,7 @@
|
||||||
// Notify current first responder that it should resign
|
// Notify current first responder that it should resign
|
||||||
// If it says NO then no change
|
// If it says NO then no change
|
||||||
// But make sure that there even is a first responder
|
// But make sure that there even is a first responder
|
||||||
if ((![first_responder resignFirstResponder]) && first_responder)
|
if ((first_responder) && (![first_responder resignFirstResponder]))
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
// Make it the first responder
|
// Make it the first responder
|
||||||
|
@ -1626,4 +1628,19 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)performDeminiaturize:sender
|
||||||
|
{
|
||||||
|
// Do nothing, should be overridden by back-end
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)performHide:sender
|
||||||
|
{
|
||||||
|
// Do nothing, should be overridden by back-end
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)performUnhide:sender
|
||||||
|
{
|
||||||
|
// Do nothing, should be overridden by back-end
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -29,12 +29,6 @@
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <AppKit/NSEvent.h>
|
#include <AppKit/NSEvent.h>
|
||||||
|
|
||||||
/* The global application object */
|
|
||||||
/* This should really be accessed through [NSApplication sharedApplication] */
|
|
||||||
id NSApp = nil;
|
|
||||||
|
|
||||||
NSEvent *gnustep_gui_null_event = nil;
|
|
||||||
|
|
||||||
// Global strings
|
// Global strings
|
||||||
NSString *NSModalPanelRunLoopMode = @"ModalPanelMode";
|
NSString *NSModalPanelRunLoopMode = @"ModalPanelMode";
|
||||||
NSString *NSEventTrackingRunLoopMode = @"EventTrackingMode";
|
NSString *NSEventTrackingRunLoopMode = @"EventTrackingMode";
|
||||||
|
|
|
@ -70,6 +70,8 @@ __objc_class_name_NSDataLinkPanel
|
||||||
__objc_class_name_NSDPSContext
|
__objc_class_name_NSDPSContext
|
||||||
__objc_class_name_NSEPSImageRep
|
__objc_class_name_NSEPSImageRep
|
||||||
__objc_class_name_NSEvent
|
__objc_class_name_NSEvent
|
||||||
|
getNSFont
|
||||||
|
setNSFont
|
||||||
__objc_class_name_NSFont
|
__objc_class_name_NSFont
|
||||||
__objc_category_name_NSFontManager_GNUstepBackend
|
__objc_category_name_NSFontManager_GNUstepBackend
|
||||||
__objc_class_name_NSFontManager
|
__objc_class_name_NSFontManager
|
||||||
|
@ -100,7 +102,6 @@ __objc_class_name_NSPopUpButton
|
||||||
__objc_class_name_NSResponder
|
__objc_class_name_NSResponder
|
||||||
__objc_class_name_NSSavePanel
|
__objc_class_name_NSSavePanel
|
||||||
__objc_class_name_NSScreen
|
__objc_class_name_NSScreen
|
||||||
__objc_category_name_NSScroller_GNUstepBackend
|
|
||||||
__objc_class_name_NSScroller
|
__objc_class_name_NSScroller
|
||||||
__objc_class_name_NSScrollView
|
__objc_class_name_NSScrollView
|
||||||
__objc_class_name_NSSelection
|
__objc_class_name_NSSelection
|
||||||
|
|
|
@ -38,23 +38,5 @@ char **NSArgv = NULL;
|
||||||
int
|
int
|
||||||
GNUstepMain(int argc, char **argv)
|
GNUstepMain(int argc, char **argv)
|
||||||
{
|
{
|
||||||
NSFontManager *fm;
|
return 0;
|
||||||
|
|
||||||
// Create the global application object
|
|
||||||
NSApp = [[NSApplication alloc] init];
|
|
||||||
|
|
||||||
// Set the application default fonts
|
|
||||||
fm = [NSFontManager sharedFontManager];
|
|
||||||
[NSFont setUserFixedPitchFont: [fm fontWithFamily:@"Arial"
|
|
||||||
traits:0 weight:0 size:16]];
|
|
||||||
[NSFont setUserFont: [fm fontWithFamily:@"Times New Roman"
|
|
||||||
traits:0 weight:0 size:16]];
|
|
||||||
|
|
||||||
// Call the user's main
|
|
||||||
//user_main(0, NULL);
|
|
||||||
|
|
||||||
// Release the application
|
|
||||||
[NSApp release];
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue