Add new branch with corrected revision number.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/testplant_1@28488 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2009-08-19 22:25:33 +00:00
commit ca241e19ea
76 changed files with 1216 additions and 3381 deletions

View file

@ -1,7 +1,7 @@
1 ANNOUNCE
**********
This is version 0.17.1 of the GNUstep GUI library (`gnustep-gui').
This is version 0.16.0 of the GNUstep GUI library (`gnustep-gui').
1.1 What is the GNUstep GUI Library?
====================================
@ -27,17 +27,21 @@ systems.
GNUstep Base Library, the TIFF Graphics library, and a back-end
component like the GNUstep 'Back' Backend.
1.2 Noteworthy changes in version `0.17.1'
1.2 Noteworthy changes in version `0.16.0'
==========================================
* New Mac OS X 10.5 methods in NSFont
* Nib loading refractored and improved.
* Add live resize in NSSplitView
* Added support for autosaving in NSDocuments
* NSWindowController made a subclass of NSResponder
* NSTokenField and netokenFiledCell classes added.
1.3 Where can you get it? How can you compile it?
==================================================
The gstep-gui-0.17.1.tar.gz distribution file has been placed at
The gstep-gui-0.16.0.tar.gz distribution file has been placed at
`ftp://ftp.gnustep.org/pub/gnustep/core'.
Read the INSTALL file or the GNUstep-HOWTO for installation

391
ChangeLog
View file

@ -1,381 +1,3 @@
2009-08-19 00:57-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSTextView.m: Don't add the text storage if it's nil
in initWithCoder:
2009-08-16 15:14-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSTextStorage.m: Correct spelling of header file.
2009-08-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (-initWithFrame:, -initWithCoder:) Set
_post_frame_changes and _post_bounds_changes to YES by default.
Patch by Quentin Mathe <qmathe@gmail.com>.
2009-08-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextStorage.m (-replacementObjectForPortCoder:): Added
this method as suggested by Richard.
2009-08-15 17:17-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Tools/say/GNUmakefile
* Tools/speech/GNUmakefile: Makefile corrections.
2009-08-12 18:26-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSDrawer.m: Changed - (void) stopTimer. Fixed to
prevent a crash when the drawer is opened/closed and then the
window is then closed causing a double release.
2009-08-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextStorage.m (-classForCoder, -initWithCoder:,
-encodeWithCoder:): Encode this class and not the concrete
one. Also call super encoding/decoding methods as they are
correct in base now.
* Source/GSTextStorage.m (-classForPortCoder, -encodeWithCoder:,
-replacementObjectForPortCoder:): Remove these methods.
2009-08-10 23:25-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Sounds/Basso.wav
* Sounds/Hero.wav
* Sounds/Ping.wav
* Sounds/Pop.wav
* Sounds/Sosumi.wav
* Sounds/Tink.wav: Added new sound files.
* Sounds/GNUmakefile: Copy sound files.
2009-08-08 23:26-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSMenuItem.m: encodeWithCoder: only encode the NSSubitems
key if the menu is not owned by a popup. This avoids an
assertion error when loading the resulting nib into InterfaceBuilder.
2009-08-08 13:06-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSTextView.m: initWithCoder: change to use text storage
more directly to allow the handling of attributed strings.
2009-08-08 03:06-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSTextStorage.m: In initWithCoder: don't overwrite the
contents of the text storage by attempting to unarchive when the
unarchiver is keyed.
* Source/NSTextView.m: In initWithCoder: retrieve the contents
of the text storage for display in the text view.
2009-08-06 01:42-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSTextView.m: initWithCoder: temporarily remove decoding
of NSTextContainer since it is causing a crash when editing a text
view's that was loaded from a nib file.
2009-08-04 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSToolbarItem.h: Move the _flags to the class
GSToolbarBackView in NSToolbarItem.m.
* Source/NSToolbarItem.m: More clean up of code.
2009-08-02 10:15-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSWindow.h
* Source/NSApplication.m
* Source/NSWindow.m: Added ivar for attached sheet back.
2009-08-01 20:28-EDT Gregory John Casamento <greg.casamento@gmail.com>
* config.make.in: Change to include BUILD_SPEECH in output
* configure: Regenerated
* configure.ac: Check for flite library and flite.h header.
* Tools/GNUmakefile: Add ${BUILD_SPEECH} to subproject list.
* Tools/say/GNUmakefile
* Tools/say/say.m: Say utility
* Tools/speech/FliteSpeechEngine.m:
* Tools/speech/GNUmakefile
* Tools/speech/GSSpeechEngine.[hm]
* Tools/speech/GSSpeechServer.[hm]
* Tools/speech/GSSpeechSynthesizer.[hm]: Speech synthesis engine
implementation using flite.
* Tools/speech/main.m: main for the server application.
Speech code by David Chisnall <theraven@sucs.org>
Changes to makefiles and config by Gregory Casamento.
2009-08-01 17:49-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Sounds/GNUmakefile: Change makefile to copy wav files.
2009-08-01 17:47-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Sounds/Basso.ogg: Deleted..
* Sounds/Basso.wav: Added
* Sounds/Blow.ogg: Deleted..
* Sounds/Blow.wav: Added
* Sounds/Bottle.ogg: Deleted
* Sounds/Bottle.wav: Added
* Sounds/Glass.ogg: Deleted
* Sounds/Glass.wav: Added.
Changed sounds to .wav instead of .ogg.
2009-08-01 12:22-EDT Gregory John Casamento <greg.casamento@gmail.com>
* GNUmakefile
* Sounds/Basso.ogg
* Sounds/Blow.ogg
* Sounds/Bottle.ogg
* Sounds/Glass.ogg: Add new sounds.
* Sounds/GNUmakefile
* Sounds/GNUmakefile.postamble: Add sounds directory and makefiles.
2009-07-31 Adam Fedor <fedor@gnu.org>
* Version 0.17.1
2009-07-30 15:43-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSThemeTools.m: -[GSThemeTools drawRoundBezel:withColor:]
add code to draw highlights for rounded buttons to give them a
better 3D look.
2009-07-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSDocument.m (-setFileName:): Set the file name to the
absolute file path.
Patch by Jonathan Gillaspie <jonathan.gillaspie@testplant.com>.
2009-07-27 12:18-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSWindow.h: Comment out _attachedSheet ivar.
* Source/NSAlert.m: Change code to use hightlightWithLevel: method
in resetWindow method.
* Source/NSApplication.m: Stub out setAttachedSheet method.
* Source/NSWindow.m: Remove new ivar for next release and stub out
attachedSheet method.
2009-07-26 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSFontDescriptor.h,
* Headers/AppKit/NSFont.h: Add missing interface method from 10.5.
* Source/NSFontDescriptor.m,
* Source/NSFont.m: Small fixes for font descriptor handling.
2009-07-25 22:54-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSAlert.m: Offset color by less in -resetWindow. Remove
redundant logic for calling the "didEnd" method in the NSBeginSheet...
functions.
* Source/NSApplication.m: Add code to reset parent window in
beginSheet:... method. Also added check to make sure the
modalDelegate is not nil.
2009-07-25 20:54-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSAlert.m: Remove category for setAttachedSheet method.
* Source/NSApplication.m: Added private category to add
setAttachedSheet: to NSWindow. Modified beginSheet:... method
to call the new method with the sheet that is associated with it.
2009-07-25 20:25-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSAlert.m: GSAlertSheet - removed unecessary parentWindow
and container ivars in interface declaration. Removed uneeded
accessors for parentWindow and contentRect. Added check in
frameFromParentWindowFrame to check to see if parent is initialized
prior to using it. Removed NSBox in the init.. method since it
could cause issues with drawing. Added code to lighten the
color of the background of the sheet relative to the parent window.
2009-07-24 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-initWithCoder:, -setTextContainer:):
Attempt to resolve the memory issues when coding a text container.
2009-07-21 15:06-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSFontDescriptor.h: Correct mispelling pointed
out by David Chisnall.
2009-07-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPrintOperation.m: Add include needed for Windows.
2009-07-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPrintOperation.m (-_printPaginateWithInfo:knowsRange:, -_print):
Try to handle not set print information more graceful.
2009-07-14 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPrintOperation.m (-_printPaginateWithInfo:knowsRange:):
Use scale 1.0 if none is given.
Patch by Georg Fleischmann <G.Fleischmann@vhf.de>.
2009-07-13 14:12-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSAlert.m: Implementation of GSAlertSheet.
* Source/NSApplication.m: Change order in which setWindowParent:
and runModalForWindow: are called in beginSheet:... method.
* Source/NSDrawer.m: Remove notifications when drawer is closed
in dealloc.
2009-07-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-_editPreviousEditableCellBeforeRow:column:,
-_editNextEditableCellAfterRow:column:): Comment out the loop
around of the last change. This leads to wrong results, when the
table view isn't the only view in the window.
2009-07-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (-_setNeedsDisplayInRect_real:) Set the window
views as needing display, even when the invalidated rectangle
didn't change.
2009-07-05 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-_editPreviousEditableCellBeforeRow:column:,
-_editNextEditableCellAfterRow:column:): Try to handle all cases
of changing the current edited cell correctly.
2009-07-05 Riccardo Mottola <rmottola@users.sf.net>
* Source/NSTableHeaderView.m
Removed c99-ism
2009-07-05 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (_editPreviousEditableCellBeforeRow:column:):
Compare row against _numberOfRows not _numberOfColumns.
Patch by Tim Schmielau <tim@smmo.org>.
2009-06-30 Nicolas Roard <nicolas@roard.com>
* Source/NSTableHeaderView.m: Apply patch from Eric
Wasylishen <ewasylishen@gmail.com>, add live resize and
live moving for table columns if GSUseGhostResize is
set to NO.
2009-06-28 23:46-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSTextView.m (-initWithCoder:): Retain the text
container and storage to prevent a crash since both are
autoreleased by the archiver.
2009-06-29 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSKeyValueBinding.h,
* Source/externs.m: Add NSContentObjectBinding.
* Source/NSObjectController.m: Add more implementation to this
class.
Patch by Andy Balholm <andy@balholm.com>.
2009-06-28 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/AppKit.h : Addd NSFontDescriptor.h.
2009-06-22 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSUserDefaultsController.m (-initWithCoder:): Retain the
shared controller before returning it.
2009-06-22 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSKeyValueBinding.m (GSKeyValueBinding+initialize):
Correc the setup of the map tables.
* Source/NSKeyValueBinding.m (GSKeyValueBinding+unbindAllForObject):
Use a copy of the keys for the enumerator.
2009-06-05 18:21-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSSpeechSynthesizer.h:
* Source/NSSpeechSynthesizer.m: Implementation of
NSSpeechSynthesizer.
Patch by David Chisnall <theraven@sucs.org>
2009-06-02 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSDocument.m (-runModalSavePanelForSaveOperation:...):
Check whether there is a returned save panel, this wont be the case
when the user cancels the save operation.
2009-05-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSApplication.m (detachDrawingThread:toTarget:withObject:):
Replace a call to a now longer existing extension on NSInvocation
with the correct method calls.
2009-05-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSDisplayServer.m (+initialize,
-_setWindowOwnedByServer:(), -dealloc): Set the windowmaps
variable in the initialize method and protect all usages.
2009-05-23 22:17-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSWorkspace.m: Improve handling of CFBundleType...
constants in the private method _extIconForApp:info:.
2009-05-23 11:48-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSStandardWindowDecorationView.m: Live window resize changes
for when using GNUstep decorations in resizeWindowStartingWithEvent:.
* Source/NSLayoutManager.m: Unarchive the text containers into an
array in initWithCoder:.
* Source/NSTextContainer.m: Get the layout manager in initWithCoder:.
* Source/NSTextView.m: Changes to include text container from nib
file into the nib loading process in initWithCoder:.
2009-05-22 Nicolas Roard <nicolas@roard.com>
Add a live resize for splitviews. Users can revert to the old behaviour
by doing: defaults write NSGlobalDomain GSUseGhostResize YES
* Source/NSSplitView.m: Added live resize of splitviews
2009-05-14 Riccardo Mottola <rmottola@users.sf.net>
* Source/NSApplication.m: fixed allocation of Mutable array instead of
Array
2009-05-14 14:15-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/AppKit/NSWindow.h: Added ivar to contain attachedSheet.
* Source/NSAlert.m: New class GSSheetPanel. Initial changes for
sheet implementation.
* Source/NSWindow.m: Added code to return value of new ivar.
2009-05-10 Adam Fedor <fedor@gnu.org>
* Version 0.17.0
2009-05-02 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMenu.m (-_updateUserDefaults:): Fix small memory leak.
* Source/GSTitleView.m (+height: Get height from NSMenuView.
* Source/GSTitleView.m (-addCloseButtonWithAction:,
-addMiniaturizeButtonWithAction:): Get buttons from NSWindow.
* Source/GSTitleView.m: Clean up a bit.
2009-04-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBezierPath.m (-appendBezierPathWithRoundedRect:xRadius:
yRadius:):
Small rearangment of code.
Patch by Fred Morcos <fred.morcos@gmail.com>
2009-04-25 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSBezierPath.h,
* Source/NSBezierPath.m (+bezierPathWithRoundedRect:xRadius:yRadius:,
-appendBezierPathWithRoundedRect:xRadius:yRadius:):
New 10.5 methods.
Patch by Fred Morcos <fred.morcos@gmail.com>
2009-04-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSColorWell.m: Only send action if color changes ... fix
for bug #26277
2009-04-19 00:46-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSSearchFieldCell.h: Give the values assigned in
@ -2382,15 +2004,14 @@
-frameRectForContentRect:styleMask): New instance methods.
* Source/NSWindow.m: Use these new methods.
2008-10-19 Riccardo Mottola <rmottola@users.sf.net>
2008-10-19 Riccardo Mottola <rmottola@users.sf.net>>
* Source/GSServicesManager.m: dont unreigster non existent named port
2008-10-18 19:06-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSWindow.m: Remove code in stringWithSavedFrame which
was causing a crash due to issues in NSToolbar described
in bug#24601.
* Source/NSWindow.m: Remove code in stringWithSavedFrame which was causing a
crash due to issues in NSToolbar described in bug#24601.
2008-10-18 Riccardo Mottola <rmottola@users.sf.net>>
@ -2757,8 +2378,8 @@
2008-05-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-selectRow:byExtendingSelection:,
-selectColumn:byExtendingSelection:, -rectOfColumn:, -rectOfRow:):
Don't raise an exception for invalid indexes.
-selectColumn:byExtendingSelection:, -rectOfColumn:, -rectOfRow:): Don't
raise an exception for invalid indexes.
2008-05-01 Fred Kiefer <FredKiefer@gmx.de>
@ -2799,7 +2420,7 @@
2008-04-07 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSFont.m (NSConvertGlyphsToPackedGlyphs): Store the glyph
count in the first byte.
count in th efirst byte.
* Source/NSBezierPath.m (-appendBezierPathWithPackedGlyphs): Send
this method on to the graphics context.
* Headers/AppKit/NSGraphicsContext.h,

View file

@ -100,13 +100,6 @@
begin with a dot ('.') are not shown in the NSSavePanel or
NSOpenPanel.
</p>
<term>GSUseGhostResize</term>
<desc>
<p>
A boolean, by default NO. If you set it to YES, NSSplitView
uses a 'ghost' bar to show resizing instead of doing a live
resizing of the views.
</p>
<term>GSHelpViewer</term>
<desc>
<p>

View file

@ -19,57 +19,6 @@
changes and other information that might help developers and users
migrate to using a newer version of the library.
</p>
<section>
<heading>Version 0.17.1</heading>
<p>Bug fixes.
</p>
<deflist>
<term>NSFont</term>
<desc>
Add some missing interface methods from 10.5
</desc>
<term>NSSplitView</term>
<desc>
Add live resize (can be turned off with GSUseGhostResize default)
</desc>
</deflist>
</section>
<section>
<heading>Version 0.17.0</heading>
<p>Many many bug fixes and almost complete reorganization of NSToolbar
code.
</p>
<deflist>
<term>NSBezierPath, NSAttributedString, NSLayoutManager</term>
<desc>
New Mac OS X 10.5 methods.
</desc>
<term>NSSpeechSynthesizer</term>
<desc>
New class.
</desc>
<term>NSSplitView</term>
<desc>
Added new Mac OS X 10.5 methods and some ivars
</desc>
<term>Toolbars</term>
<desc>
Many improvements. NSToolbar methods rearragned and ivar removed.
</desc>
<term>Menus</term>
<desc>
MS Window-stype menus inside a window implemented
</desc>
<term>Garbage Collection</term>
<desc>
Several improvements to work better with GC
</desc>
<term>HelpViewer</term>
<desc>
GSHelpViewer use default added.
</desc>
</deflist>
</section>
<section>
<heading>Version 0.16.0</heading>
<p>This is an stable release. A lot of improvements and bug
@ -107,7 +56,7 @@
<desc>
New methods added to handle temporary attributes.
</desc>
<term>NSWindowController</term>
<term>NSWindowContrller</term>
<desc>
NSWindowController was made a subclass of NSResponder.
</desc>
@ -117,7 +66,7 @@
</desc>
<term>NSTokenField, NSTokenFieldCell</term>
<desc>
New classes added.
Ned classes added.
</desc>
</deflist>
</section>

View file

@ -9,23 +9,6 @@
The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}.
@end ifclear
@section Noteworthy changes in version @samp{0.17.1}
@itemize @bullet
@item New Mac OS X 10.5 methods in NSFont
@item Add live resize in NSSplitView
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.17.0}
@itemize @bullet
@item New Mac OS X 10.5 methods in many classes
@item Toolbars have been completely rewritten and improved.
@item Several improvements for Garbage Collection
@end itemize
@section Noteworthy changes in version @samp{0.16.0}
@itemize @bullet
@ -35,6 +18,8 @@ The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSIO
@item NSTokenField and netokenFiledCell classes added.
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.14.0}
@itemize @bullet

View file

@ -54,7 +54,6 @@ doc=no
SUBPROJECTS = \
Source \
Images \
Sounds \
Model \
Tools \
Panels \

View file

@ -131,7 +131,6 @@
#include <AppKit/NSDocumentController.h>
#include <AppKit/NSDrawer.h>
#include <AppKit/NSFileWrapper.h>
#include <AppKit/NSFontDescriptor.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSHelpManager.h>
#include <AppKit/NSInputManager.h>

View file

@ -481,7 +481,7 @@ static inline void
DPScurrentcmykcolor(GSCTXT *ctxt, float* c, float* m, float* y, float* k)
{
(ctxt->methods->DPScurrentcmykcolor____)
(ctxt, @selector(DPScurrentcmykcolor: : : :), c, m, y, k);
(ctxt, @selector(DPScurrentcmykcolor: : : : :), c, m, y, k);
}
static inline void
@ -1125,7 +1125,7 @@ static inline void
GSCurrentDevice(GSCTXT *ctxt, void** device, int* x, int* y)
{
(ctxt->methods->GSCurrentDevice___)
(ctxt, @selector(GSCurrentDevice: : :), device, x, y);
(ctxt, @selector(GSCurrentGCDevice: : :), device, x, y);
}
static inline void
@ -1139,7 +1139,7 @@ static inline void
GSSetDevice(GSCTXT *ctxt, void* device, int x, int y)
{
(ctxt->methods->GSSetDevice___)
(ctxt, @selector(GSSetDevice: : :), device, x, y);
(ctxt, @selector(GSSetGCDevice: : :), device, x, y);
}
static inline void

View file

@ -95,11 +95,6 @@ typedef enum {
+ (NSBezierPath *)bezierPath;
+ (NSBezierPath *)bezierPathWithRect:(NSRect)aRect;
+ (NSBezierPath *)bezierPathWithOvalInRect:(NSRect)aRect;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
+ (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)aRect
xRadius:(CGFloat)xRadius
yRadius:(CGFloat)yRadius;
#endif
//
// Immediate mode drawing of common paths
@ -224,11 +219,6 @@ typedef enum {
count:(int)count
inFont:(NSFont *)font;
- (void)appendBezierPathWithPackedGlyphs:(const char *)packedGlyphs;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (void)appendBezierPathWithRoundedRect:(NSRect)aRect
xRadius:(CGFloat)xRadius
yRadius:(CGFloat)yRadius;
#endif
//
// Hit detection

View file

@ -133,12 +133,9 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
+ (NSFont*) menuBarFontOfSize: (float)fontSize;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor size: (CGFloat)size;
+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor size: (float)size;
+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor
textTransform: (NSAffineTransform*)transform;
// This method was a mistake in the 10.4 documentation
+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor
size: (CGFloat)size
size: (float)size
textTransform: (NSAffineTransform*)transform;
#endif

View file

@ -61,8 +61,8 @@ typedef enum _NSFontFamilyClass
NSFontSymbolicClass = 12 << 28
} NSFontFamilyClass;
enum _NSFontFamilyClassMask {
NSFontFamilyClassMask = 0xF0000000
enum _NSFontFamiliyClassMask {
NSFontFamiliyClassMask = 0xF0000000
};
enum _NSFontTrait
@ -109,7 +109,7 @@ extern NSString *NSFontVariationAxisNameKey;
+ (id) fontDescriptorWithFontAttributes: (NSDictionary *)attributes;
+ (id) fontDescriptorWithName: (NSString *)name
size: (CGFloat)size;
size: (float)size;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
+ (id) fontDescriptorWithName: (NSString *)name
matrix: (NSAffineTransform *)matrix;
@ -124,20 +124,17 @@ extern NSString *NSFontVariationAxisNameKey;
- (NSFontDescriptor *) fontDescriptorWithFace: (NSString *)face;
- (NSFontDescriptor *) fontDescriptorWithFamily: (NSString *)family;
- (NSFontDescriptor *) fontDescriptorWithMatrix: (NSAffineTransform *)matrix;
- (NSFontDescriptor *) fontDescriptorWithSize: (CGFloat)size;
- (NSFontDescriptor *) fontDescriptorWithSize: (float)size;
- (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:
(NSFontSymbolicTraits)traits;
- (NSArray *) matchingFontDescriptorsWithMandatoryKeys: (NSSet *)keys;
- (id) objectForKey: (NSString *)attribute;
- (NSAffineTransform *) matrix;
- (CGFloat) pointSize;
- (float) pointSize;
- (NSString *) postscriptName;
- (NSFontSymbolicTraits) symbolicTraits;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (NSFontDescriptor *) matchingFontDescriptorWithMandatoryKeys: (NSSet *)keys;
#endif
@end

View file

@ -103,7 +103,6 @@ APPKIT_EXPORT id NSNotApplicableMarker;
// Binding name constants
APPKIT_EXPORT NSString *NSAlignmentBinding;
APPKIT_EXPORT NSString *NSContentObjectBinding;
APPKIT_EXPORT NSString *NSEditableBinding;
APPKIT_EXPORT NSString *NSEnabledBinding;
APPKIT_EXPORT NSString *NSFontBinding;

View file

@ -95,6 +95,17 @@ extern NSString *NSSpeechDictionaryEntryPhonemes;
// class declaration...
@interface NSSpeechSynthesizer : NSObject
{
NSString *_voice;
BOOL _usesFeedbackWindow;
float _rate;
float _volume;
id _delegate;
NSMutableArray *_dictionaries;
NSMutableDictionary *_properties;
BOOL _isSpeaking;
id _module;
}
// init...
- (id) initWithVoice: (NSString *)voice;

View file

@ -89,6 +89,25 @@ enum _NSToolbarItemVisibilityPriority {
// size
NSSize _maxSize;
NSSize _minSize;
// record the fact that the view responds to these
// to save time.
struct __flags
{
// gets
unsigned int _isEnabled:1;
unsigned int _action:1;
unsigned int _target:1;
unsigned int _image:1;
// sets
unsigned int _setEnabled:1;
unsigned int _setAction:1;
unsigned int _setTarget:1;
unsigned int _setImage:1;
// to even out the int.
unsigned int RESERVED:24;
} _flags;
}
// Instance methods

View file

@ -203,7 +203,6 @@ APPKIT_EXPORT NSSize NSTokenSize;
NSWindow *_parent;
NSCachedImageRep *_cachedImage;
NSPoint _cachedImageOrigin;
NSWindow *_attachedSheet;
struct GSWindowFlagsType {
unsigned accepts_drag:1;

108
NEWS
View file

@ -1,25 +1,9 @@
1 NEWS
******
The currently released version of the library is `0.17.1'.
The currently released version of the library is `0.16.0'.
1.1 Noteworthy changes in version `0.17.1'
==========================================
* New Mac OS X 10.5 methods in NSFont
* Add live resize in NSSplitView
1.2 Noteworthy changes in version `0.17.0'
==========================================
* New Mac OS X 10.5 methods in many classes
* Toolbars have been completely rewritten and improved.
* Several improvements for Garbage Collection
1.3 Noteworthy changes in version `0.16.0'
1.1 Noteworthy changes in version `0.16.0'
==========================================
* Nib loading refractored and improved.
@ -30,7 +14,7 @@ The currently released version of the library is `0.17.1'.
* NSTokenField and netokenFiledCell classes added.
1.4 Noteworthy changes in version `0.14.0'
1.2 Noteworthy changes in version `0.14.0'
==========================================
* New class NSGlyphGenerator for glyph generation
@ -41,7 +25,7 @@ The currently released version of the library is `0.17.1'.
* Manu bug fixes.
1.5 Noteworthy changes in version `0.13.2'
1.3 Noteworthy changes in version `0.13.2'
==========================================
* Printing works a little better now.
@ -57,7 +41,7 @@ The currently released version of the library is `0.17.1'.
* NSDrawer was implemented.
1.6 Noteworthy changes in version `0.13.1'
1.4 Noteworthy changes in version `0.13.1'
==========================================
* NSMenu - Added more MacOS X methods and an ivar.
@ -71,7 +55,7 @@ The currently released version of the library is `0.17.1'.
* Changed the NSCursor hot point to 0,0 for MacOS X compatibility.
1.7 Noteworthy changes in version `0.13.0'
1.5 Noteworthy changes in version `0.13.0'
==========================================
This is an unstable release. There may be backward compatibility issues
@ -108,7 +92,7 @@ with previous releases of the gui library.
* Base library version 1.15.1 is required for this release
1.8 Noteworthy changes in version `0.12.0'
1.6 Noteworthy changes in version `0.12.0'
==========================================
It has been a long time since the last release and many things have been
@ -133,7 +117,7 @@ added and changed, including new classes, new ivars, and new methods.
* NSSpellServer and NSAffineTransform was moved to GNUstep base for
Mac OS X compatibility.
1.9 Noteworthy changes in version `0.11.0'
1.7 Noteworthy changes in version `0.11.0'
==========================================
* Added support for keyed encoding in all gui classes.
@ -144,26 +128,26 @@ added and changed, including new classes, new ivars, and new methods.
* Implemented glue code in GSNibCompatibility for classes such as
NSIBObjectData, NSClassSwapper, etc. to facilitate nib loading.
1.10 Noteworthy changes in version `0.10.3'
===========================================
1.8 Noteworthy changes in version `0.10.3'
==========================================
* Horizontal menus now work
* Better support for tracking active applications.
1.11 Noteworthy changes in version `0.10.2'
===========================================
1.9 Noteworthy changes in version `0.10.2'
==========================================
Mostly bug fixes.
1.12 Noteworthy changes in version `0.10.1'
1.10 Noteworthy changes in version `0.10.1'
===========================================
GNUstep now uses v19 of portaudio for the sound daemon. Version v19
hasn't been officially released, but it is still used in several
distributions (SuSE, etc) as v18 is very old.
1.13 Noteworthy changes in version `0.10.0'
1.11 Noteworthy changes in version `0.10.0'
===========================================
This release is binary incompatible with previous releases. The
@ -175,7 +159,7 @@ new version.
* Keyed encoding is supported in many classes.
1.14 Noteworthy changes in version `0.9.5'
1.12 Noteworthy changes in version `0.9.5'
==========================================
* Beginnings of CUPS interface were added.
@ -188,7 +172,7 @@ new version.
* You can find the GUI library's version using the Info.plist
1.15 Noteworthy changes in version `0.9.4'
1.13 Noteworthy changes in version `0.9.4'
==========================================
* The printing classes have been completely reorganized to
@ -203,7 +187,7 @@ new version.
* Some improvement of NSDataLink classes.
1.16 Noteworthy changes in version `0.9.3'
1.14 Noteworthy changes in version `0.9.3'
==========================================
* Spell checker reimplemented using libaspell
@ -215,7 +199,7 @@ new version.
* Binary incompatibilites from ivar additions in NSView and
subclasses.
1.17 Noteworthy changes in version `0.9.2'
1.15 Noteworthy changes in version `0.9.2'
==========================================
* Working NSToolbar implementation
@ -234,7 +218,7 @@ new version.
* Much improved loading of gorm files
1.18 Noteworthy changes in version `0.9.1'
1.16 Noteworthy changes in version `0.9.1'
==========================================
* NSWindow - DnD works on whole window and events are propogated up
@ -242,14 +226,14 @@ new version.
* Absolute paths and DnD works in OpenPanels.
1.19 Noteworthy changes in version `0.9.0'
1.17 Noteworthy changes in version `0.9.0'
==========================================
Improvements in various classes, include NSPopUpButton,
NSBitmapImageRep, NSMenu, NSToolbar. Added support for thumbnail images
in NSWorkspace.
1.20 Noteworthy changes in version `0.8.9'
1.18 Noteworthy changes in version `0.8.9'
==========================================
Note that many headers have moved to new locations (both in the package
@ -258,14 +242,14 @@ applications may not compile because they cannot find the right header.
* New Language Setup documentation.
1.21 Noteworthy changes in version `0.8.8'
1.19 Noteworthy changes in version `0.8.8'
==========================================
* Updated LanguageSetup documentation
* Improved RTF reader (unicode support, etc).
1.22 Noteworthy changes in version `0.8.7'
1.20 Noteworthy changes in version `0.8.7'
==========================================
* NSBezierPath glyph methods implemented (depends on backend).
@ -275,7 +259,7 @@ applications may not compile because they cannot find the right header.
* Added default to load user-defined bundles (GSAppKitUserBundles
default).
1.23 Noteworthy changes in version `0.8.6'
1.21 Noteworthy changes in version `0.8.6'
==========================================
Updated to install in new locations based on changes in gnustep-make
@ -287,12 +271,12 @@ Updated to install in new locations based on changes in gnustep-make
* Lots of menu improvements.
1.24 Noteworthy changes in version `0.8.5'
1.22 Noteworthy changes in version `0.8.5'
==========================================
Bug fixes. NSStringDrawing now uses text system implementation.
1.25 Noteworthy changes in version `0.8.4'
1.23 Noteworthy changes in version `0.8.4'
==========================================
This release features a brand new text and layout system thanks to
@ -306,7 +290,7 @@ Alexander Malmberg. Other improvements include:
* NSToolbar partially implemented.
1.26 Noteworthy changes in version `0.8.3'
1.24 Noteworthy changes in version `0.8.3'
==========================================
* Additions for Gorm support.
@ -323,7 +307,7 @@ Alexander Malmberg. Other improvements include:
* Key view handling rewritten.
1.27 Noteworthy changes in version `0.8.2'
1.25 Noteworthy changes in version `0.8.2'
==========================================
* Handle fonts that aren't found better.
@ -340,7 +324,7 @@ Alexander Malmberg. Other improvements include:
* Fix firstResponder status in text fields.
1.28 Noteworthy changes in version `0.8.1'
1.26 Noteworthy changes in version `0.8.1'
==========================================
* Handle scaled curves correctly.
@ -353,10 +337,10 @@ Alexander Malmberg. Other improvements include:
* Spell checker starts correctly now.
1.29 Noteworthy changes in version `0.8.0'
1.27 Noteworthy changes in version `0.8.0'
==========================================
1.30 Noteworthy changes in version `0.7.9'
1.28 Noteworthy changes in version `0.7.9'
==========================================
* NSTableView, NSOutlineView improvements.
@ -365,14 +349,14 @@ Alexander Malmberg. Other improvements include:
* Skeleton implementation of NSToolBar
1.31 Noteworthy changes in version `0.7.8'
1.29 Noteworthy changes in version `0.7.8'
==========================================
* Wheel color picker, standard color picker (bundles) added.
* System colors now use named colors. Easier configuration
1.32 Noteworthy changes in version `0.7.7'
1.30 Noteworthy changes in version `0.7.7'
==========================================
The graphics/window interface was completely revamped. Window functions
@ -396,7 +380,7 @@ computers, although it is in a very alpha state.
* NSOutlineView much improved.
1.33 Noteworthy changes in version `0.7.6'
1.31 Noteworthy changes in version `0.7.6'
==========================================
* NSOutlineView implemented.
@ -409,7 +393,7 @@ computers, although it is in a very alpha state.
* Memory panel available from Info Panel.
1.34 Noteworthy changes in version `0.7.5'
1.32 Noteworthy changes in version `0.7.5'
==========================================
* Drag and drop and image sliding much improved.
@ -440,7 +424,7 @@ computers, although it is in a very alpha state.
* Gmodel code compiled as a separate bundle.
1.35 Noteworthy changes in version `0.7.0'
1.33 Noteworthy changes in version `0.7.0'
==========================================
* Much improvement in NSBrowser, NSMatrix, NSPopUpButton, combo
@ -456,7 +440,7 @@ computers, although it is in a very alpha state.
* NSColorWell works.
1.36 Noteworthy changes in version `0.6.7'
1.34 Noteworthy changes in version `0.6.7'
==========================================
* App Icons can support documents dropped using DnD.
@ -483,7 +467,7 @@ computers, although it is in a very alpha state.
* Support middle mouse button.
1.37 Noteworthy changes in version `0.6.6'
1.35 Noteworthy changes in version `0.6.6'
==========================================
* Window hints for motif and generic window managers.
@ -520,7 +504,7 @@ however, that the xdps backend is still considered experimental and you
may have to deal with many problems in order to get it working. We
recommend sticking with the xgps backend (the default) for now.
1.38 Noteworthy changes in version `0.6.5'
1.36 Noteworthy changes in version `0.6.5'
==========================================
Many of the basic GUI classes have been vastly improved or rewritten,
@ -554,7 +538,7 @@ thanks to Nicola Pero <n.pero@mi.flashnet.it> and many others.
been written, thanks to Richard Frith-Macdonald
<richard@brainstorm.co.uk>
1.39 Noteworthy changes in version `0.6.0'
1.37 Noteworthy changes in version `0.6.0'
==========================================
A Huge amount of progress, although a lot still needs to be done. It's
@ -585,7 +569,7 @@ apps and libraries have been ported with little changes.
* Several fixes that at least double the speed of the gui.
1.40 Noteworthy changes in version `0.5.5'
1.38 Noteworthy changes in version `0.5.5'
==========================================
Too extensive to list.
@ -594,7 +578,7 @@ Too extensive to list.
cleanup of coordinate conversion code, etc.
1.41 Noteworthy changes in version `0.5.0'
1.39 Noteworthy changes in version `0.5.0'
==========================================
* NSBrowser and NSBrowserCell have been implemented. There is one
@ -644,7 +628,7 @@ Too extensive to list.
* Several cleanups and as usual, many bug fixes.
1.42 Noteworthy changes in version `0.3.0'
1.40 Noteworthy changes in version `0.3.0'
==========================================
* Completely reworked the menu class. The NSMenu class is now
@ -676,7 +660,7 @@ Too extensive to list.
implement the NSCopying protocol and many others.
1.43 Noteworthy changes in version `0.2.0'
1.41 Noteworthy changes in version `0.2.0'
==========================================
* Additional NSImage and NSImageRep class work. Incorporated common
@ -711,7 +695,7 @@ Too extensive to list.
* Many bug fixes and minor enhancements.
1.44 Noteworthy changes in version `0.1.1'
1.42 Noteworthy changes in version `0.1.1'
==========================================
* Almost complete implementation of the PXKMenu and PXKMenuCell
@ -735,7 +719,7 @@ Too extensive to list.
manipulating tiff files and images.
1.45 Noteworthy changes in version `0.1.0'
1.43 Noteworthy changes in version `0.1.0'
==========================================
* Integration of the GNUstep X/DPS GUI Backend. This has finally

0
Sounds/.gitignore vendored Normal file
View file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,53 +0,0 @@
#
# Sounds makefile for GNUstep GUI Library
# Copyright (C) 2009 Free Software Foundation, Inc.
#
# Author: Gregory Casamento <greg.casamento@gmail.com>
# Date: July 2009
#
# This file is part of the GNUstep GUI Library.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
PACKAGE_NAME = gnustep-gui
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../gui.make
include $(GNUSTEP_MAKEFILES)/common.make
include ../Version
sounddir = $(GNUSTEP_LIBRARY)/Sounds
SOUND_FILES = \
Glass.wav \
Basso.wav \
Blow.wav \
Bottle.wav \
Glass.wav \
Hero.wav \
Ping.wav \
Pop.wav \
Sosumi.wav \
Tink.wav
-include GNUmakefile.preamble
-include GNUmakefile.local
# We don't actually build anything in this directory so
# just include the common makefile rules
include $(GNUSTEP_MAKEFILES)/rules.make
include GNUmakefile.postamble

View file

@ -1,79 +0,0 @@
#
# GNUmakefile.postamble
#
# Copyright (C) 2009 Free Software Foundation, Inc.
#
# Author: Gregory Casamento <greg.casamento@gmail.com>
#
# This file is part of the GNUstep GUI Library.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# GNUmakefile.postamble
#
# Project specific makefile rules
#
# Uncomment the targets you want.
# The double colons (::) are important, do not make them single colons
# otherwise the normal makefile rules will not be performed.
#
# Things to do before compiling
# before-all::
# Things to do after compiling
# after-all::
$(sounddir):
$(MKDIRS) $(sounddir)
# Things to do before installing
before-install:: $(sounddir)
# Things to do after installing
after-install::
for file in $(SOUND_FILES); do \
$(INSTALL_DATA) $$file $(sounddir)/$$file ; \
done
# Things to do before uninstalling
# before-uninstall::
# Things to do after uninstalling
after-uninstall::
for file in $(SOUND_FILES); do \
rm -f $(sounddir)/$$file ; \
done
# Things to do before cleaning
# before-clean::
# Things to do after cleaning
# after-clean::
# Things to do before distcleaning
# before-distclean::
# Things to do after distcleaning
# after-distclean::
# Things to do before checking
# before-check::
# Things to do after checking
# after-check::

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -72,7 +72,6 @@ GSDisplayServer *
GSServerForWindow(NSWindow *window)
{
int num;
if (windowmaps == NULL)
{
NSLog(@"GSServerForWindow: No window server");
@ -127,14 +126,12 @@ GSCurrentServer(void)
{
[gnustep_global_lock lock];
if (serverLock == nil)
{
serverLock = [NSRecursiveLock new];
_globalGSZone = NSDefaultMallocZone();
defaultServerClass = [GSDisplayServer class];
NSCurrentServerThreadKey = @"NSCurrentServerThreadKey";
windowmaps = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 20);
}
{
serverLock = [NSRecursiveLock new];
_globalGSZone = NSDefaultMallocZone();
defaultServerClass = [GSDisplayServer class];
NSCurrentServerThreadKey = @"NSCurrentServerThreadKey";
}
[gnustep_global_lock unlock];
}
}
@ -179,6 +176,12 @@ GSCurrentServer(void)
{
GSDisplayServer *server;
if (windowmaps == NULL)
{
windowmaps = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 20);
}
if (self == [GSDisplayServer class])
{
server = [[defaultServerClass allocWithZone: _globalGSZone]
@ -248,23 +251,20 @@ GSCurrentServer(void)
void *key;
void *val;
if (windowmaps != NULL)
/*
* Remove the display server from the windows map.
* This depends on a property of GNUstep map tables, that an
* enumerated object can safely be removed from the map.
*/
enumerator = NSEnumerateMapTable(windowmaps);
while (NSNextMapEnumeratorPair(&enumerator, &key, &val))
{
/*
* Remove the display server from the windows map.
* This depends on a property of GNUstep map tables, that an
* enumerated object can safely be removed from the map.
*/
enumerator = NSEnumerateMapTable(windowmaps);
while (NSNextMapEnumeratorPair(&enumerator, &key, &val))
{
if (val == (void*)self)
{
NSMapRemove(windowmaps, key);
}
}
NSEndMapTableEnumeration(&enumerator);
if (val == (void*)self)
{
NSMapRemove(windowmaps, key);
}
}
NSEndMapTableEnumeration(&enumerator);
DESTROY(server_info);
DESTROY(event_queue);
@ -517,10 +517,7 @@ GSCurrentServer(void)
for a window that has already been created */
- (void) _setWindowOwnedByServer: (int)win
{
if (windowmaps != NULL)
{
NSMapInsert(windowmaps, (void*)(intptr_t)win, self);
}
NSMapInsert (windowmaps, (void*)(intptr_t)win, self);
}
/** Creates a window whose location and size is described by frame and

View file

@ -467,7 +467,6 @@ calc_new_frame(NSRect frame, NSPoint point, NSPoint firstPoint,
NSPoint firstPoint, point;
NSRect newFrame, frame;
NSSize minSize, maxSize;
int num = 0;
/*
0 drag lower left corner
@ -514,13 +513,6 @@ calc_new_frame(NSRect frame, NSPoint point, NSPoint firstPoint,
untilDate: [NSDate distantFuture]
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
num++;
if(num == 5)
{
[window setFrame: newFrame display: YES];
num = 0;
}
} while ([currentEvent type] != NSLeftMouseUp);
[window _releaseMouse: nil];

View file

@ -464,35 +464,48 @@ _attributesAtIndexEffectiveRange(
}
}
- (Class) classForPortCoder
{
return [self class];
}
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
{
return self;
}
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
[aCoder encodeValueOfObjCType: @encode(id) at: &_textChars];
[aCoder encodeValueOfObjCType: @encode(id) at: &_infoArray];
}
- (id) initWithCoder: (NSCoder*)aCoder
{
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
self = [super initWithCoder: aCoder];
if([aCoder allowsKeyedCoding] == NO)
{
[aCoder decodeValueOfObjCType: @encode(id) at: &_textChars];
[aCoder decodeValueOfObjCType: @encode(id) at: &_infoArray];
}
[aCoder decodeValueOfObjCType: @encode(id) at: &_textChars];
[aCoder decodeValueOfObjCType: @encode(id) at: &_infoArray];
return self;
}
- (id) initWithString: (NSString*)aString
attributes: (NSDictionary*)attributes
{
NSZone *z = [self zone];
NSZone *z = [self zone];
self = [super initWithString: aString attributes: attributes];
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
{
NSAttributedString *as = (NSAttributedString*)aString;
NSAttributedString *as = (NSAttributedString*)aString;
aString = [as string];
_setAttributesFrom(as, NSMakeRange(0, [aString length]), _infoArray);
}
else
{
GSTextInfo *info;
GSTextInfo *info;
if (attributes == nil)
{
@ -522,7 +535,7 @@ _attributesAtIndexEffectiveRange(
- (NSDictionary*) attributesAtIndex: (unsigned)index
effectiveRange: (NSRange*)aRange
{
unsigned dummy;
unsigned dummy;
return _attributesAtIndexEffectiveRange(
index, aRange, [_textChars length], _infoArray, &dummy);

View file

@ -419,10 +419,7 @@
point = cellFrame.origin;
point.x += radius;
point.y += radius;
// Draw initial path to enclose the button...
// left half-circle
p = [NSBezierPath bezierPath];
[p appendBezierPathWithArcWithCenter: point
radius: radius
startAngle: 90.0
@ -443,26 +440,6 @@
// and stroke rounded button
[[NSColor shadowColor] set];
[p stroke];
// Add highlights...
point = cellFrame.origin;
point.x += radius;
point.y += radius;
p = [NSBezierPath bezierPath];
[p setLineWidth: 2.0];
[p appendBezierPathWithArcWithCenter: point
radius: radius
startAngle: 120.0
endAngle: 270.0];
// line to first point and right halfcircle
point.x += cellFrame.size.width - cellFrame.size.height;
[p appendBezierPathWithArcWithCenter: point
radius: radius
startAngle: 270.0
endAngle: 270.0];
[[NSColor controlLightHighlightColor] set];
[p stroke];
}
- (void) drawCircularBezel: (NSRect)cellFrame

View file

@ -49,17 +49,31 @@
+ (float) height
{
return [NSMenuView menuBarHeight] + 1;
static float height = 0.0;
if (height == 0.0)
{
NSFont *font = [NSFont menuFontOfSize: 0.0];
/* Minimum title height is 23 */
height = ([font boundingRectForFont].size.height) + 9;
if (height < 23)
{
height = 23;
}
}
return height;
}
- (id) init
{
self = [super init];
if (!self)
return nil;
_owner = nil;
_ownedByMenu = NO;
_hasCloseButton = NO;
_hasMiniaturizeButton = NO;
_isKeyWindow = NO;
_isMainWindow = NO;
_isActiveApplication = NO;
@ -77,10 +91,7 @@
- (id) initWithOwner: (id)owner
{
self = [self init];
if (!self)
return nil;
[self init];
[self setOwner: owner];
return self;
@ -90,7 +101,7 @@
{
NSNotificationCenter *theCenter = [NSNotificationCenter defaultCenter];
if ([owner isKindOfClass: [NSWindow class]])
if ([owner isKindOfClass:[NSWindow class]])
{
NSDebugLLog(@"GSTitleView", @"owner is NSWindow or NSPanel");
_owner = owner;
@ -101,13 +112,13 @@
[_owner frame].size.width+2, [GSTitleView height])];
if ([_owner styleMask] & NSClosableWindowMask)
{
[self addCloseButtonWithAction: @selector(performClose:)];
}
{
[self addCloseButtonWithAction:@selector (performClose:)];
}
if ([_owner styleMask] & NSMiniaturizableWindowMask)
{
[self addMiniaturizeButtonWithAction: @selector(performMiniaturize:)];
}
{
[self addMiniaturizeButtonWithAction:@selector (performMiniaturize:)];
}
// NSWindow observers
[theCenter addObserver: self
@ -137,7 +148,7 @@
name: NSApplicationWillResignActiveNotification
object: NSApp];
}
else if ([owner isKindOfClass: [NSMenu class]])
else if ([owner isKindOfClass:[NSMenu class]])
{
NSDebugLLog(@"GSTitleView", @"owner is NSMenu");
_owner = owner;
@ -166,13 +177,11 @@
{
if (!_ownedByMenu)
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
RELEASE(textAttributes);
RELEASE(titleColor);
TEST_RELEASE(closeButton);
TEST_RELEASE(miniaturizeButton);
RELEASE (textAttributes);
RELEASE (titleColor);
[super dealloc];
}
@ -304,17 +313,17 @@
{
NSPoint origin = [_window frame].origin;
moved = YES;
moved = YES;
origin.x += (location.x - lastLocation.x);
origin.y += (location.y - lastLocation.y);
if (_ownedByMenu)
{
[_owner nestedSetFrameOrigin: origin];
}
else
{
[_owner setFrameOrigin: origin];
}
if (_ownedByMenu)
{
[_owner nestedSetFrameOrigin: origin];
}
else
{
[_owner setFrameOrigin: origin];
}
}
break;
@ -329,9 +338,9 @@
endWindowOrigin = [_window frame].origin;
if ((startWindowOrigin.x != endWindowOrigin.x
|| startWindowOrigin.y != endWindowOrigin.y))
{
[_owner setTornOff: YES];
}
{
[_owner setTornOff: YES];
}
}
[NSEvent stopPeriodicEvents];
@ -340,7 +349,7 @@
{
// Let everything know the window has moved.
[[NSNotificationCenter defaultCenter]
postNotificationName: NSWindowDidMoveNotification object: _window];
postNotificationName: NSWindowDidMoveNotification object: _window];
}
}
@ -418,32 +427,49 @@
// ==== Buttons
// ============================================================================
- (NSButton *) _createButtonWithImage: (NSImage *)image
highlightImage: (NSImage *)imageH
action: (SEL)action
{
NSButton *button;
NSSize imageSize = [image size];
NSRect rect = NSMakeRect (0, 0, imageSize.width+3, imageSize.height+3);
button = [[NSButton alloc] initWithFrame: rect];
[button setRefusesFirstResponder: YES];
[button setButtonType: NSMomentaryChangeButton];
[button setImagePosition: NSImageOnly];
[button setBordered: YES];
[button setAutoresizingMask: NSViewMaxXMargin | NSViewMaxYMargin];
[button setImage: image];
[button setAlternateImage: imageH];
[button setTarget: _owner];
[button setAction: action];
return button;
}
- (void) addCloseButtonWithAction: (SEL)closeAction
{
if (closeButton == nil)
{
NSImage *closeImage = [NSImage imageNamed: @"common_Close"];
NSImage *closeHImage = [NSImage imageNamed: @"common_CloseH"];
NSSize viewSize;
NSSize buttonSize;
ASSIGN(closeButton,
[NSWindow standardWindowButton:
NSWindowCloseButton
forStyleMask:
NSTitledWindowMask | NSClosableWindowMask
| NSMiniaturizableWindowMask]);
[closeButton setTarget: _owner];
[closeButton setAction: closeAction];
closeButton = [self _createButtonWithImage: closeImage
highlightImage: closeHImage
action: closeAction];
viewSize = [self frame].size;
buttonSize = [[closeButton image] size];
buttonSize = NSMakeSize(buttonSize.width + 3, buttonSize.height + 3);
buttonSize = [closeButton frame].size;
// Update location
[closeButton setFrame:
NSMakeRect(viewSize.width - buttonSize.width - 4,
(viewSize.height - buttonSize.height) / 2,
buttonSize.width, buttonSize.height)];
[closeButton setFrameOrigin:
NSMakePoint (viewSize.width - buttonSize.width - 4,
(viewSize.height - buttonSize.height) / 2)];
[closeButton setAutoresizingMask: NSViewMinXMargin | NSViewMaxYMargin];
}
@ -451,6 +477,7 @@
if ([closeButton superview] == nil)
{
[self addSubview: closeButton];
RELEASE (closeButton);
[self setNeedsDisplay: YES];
}
}
@ -464,6 +491,7 @@
{
if ([closeButton superview] != nil)
{
RETAIN (closeButton);
[closeButton removeFromSuperview];
}
}
@ -472,33 +500,31 @@
{
if (miniaturizeButton == nil)
{
NSImage *miniImage = [NSImage imageNamed: @"common_Miniaturize"];
NSImage *miniHImage = [NSImage imageNamed: @"common_MiniaturizeH"];
NSSize viewSize;
NSSize buttonSize;
ASSIGN(miniaturizeButton,
[NSWindow standardWindowButton:
NSWindowMiniaturizeButton
forStyleMask:
NSTitledWindowMask | NSClosableWindowMask
| NSMiniaturizableWindowMask]);
[miniaturizeButton setTarget: _owner];
[miniaturizeButton setAction: miniaturizeAction];
miniaturizeButton = [self _createButtonWithImage: miniImage
highlightImage: miniHImage
action: miniaturizeAction];
viewSize = [self frame].size;
buttonSize = [[miniaturizeButton image] size];
buttonSize = NSMakeSize(buttonSize.width + 3, buttonSize.height + 3);
buttonSize = [miniaturizeButton frame].size;
// Update location
[miniaturizeButton setFrame:
NSMakeRect(4, (viewSize.height - buttonSize.height) / 2,
buttonSize.width, buttonSize.height)];
[miniaturizeButton setFrameOrigin:
NSMakePoint (4, (viewSize.height - buttonSize.height) / 2)];
[miniaturizeButton setAutoresizingMask: NSViewMaxXMargin | NSViewMaxYMargin];
[miniaturizeButton setAutoresizingMask:
NSViewMaxXMargin | NSViewMaxYMargin];
}
if ([miniaturizeButton superview] == nil)
{
[self addSubview: miniaturizeButton];
RELEASE (miniaturizeButton);
[self setNeedsDisplay: YES];
}
}
@ -512,8 +538,10 @@
{
if ([miniaturizeButton superview] != nil)
{
RETAIN (miniaturizeButton);
[miniaturizeButton removeFromSuperview];
}
}
@end

View file

@ -59,8 +59,6 @@
extern NSThread *GSAppKitThread;
static NSNotificationCenter *nc = nil;
#ifdef ALERT_TITLE
static NSString *defaultTitle = @"Alert";
#else
@ -894,156 +892,6 @@ setControl(NSView* content, id control, NSString *title)
@end /* GSAlertPanel GMArchiverMethods */
/*
GSAlertSheet. This class provides a borderless window which is
attached to the parent window.
*/
@interface GSAlertSheet : GSAlertPanel
@end
@implementation GSAlertSheet
+ (void) initialize
{
if (self == [GSAlertSheet class])
{
if (nc == nil)
{
nc = [NSNotificationCenter defaultCenter];
}
[self setVersion: 0];
}
}
- (id) initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
screen: (NSScreen*)aScreen
{
if(NSIsEmptyRect(contentRect))
{
contentRect = NSMakeRect(0,0,100,100);
}
self = [super initWithContentRect: contentRect
styleMask: NSBorderlessWindowMask
backing: bufferingType
defer: flag
screen: aScreen];
if (self != nil)
{
//
}
return self;
}
- (NSRect) frameFromParentWindowFrame
{
id parent = [self parentWindow];
NSRect frame = [self frame];
NSRect newFrame = NSZeroRect; // return zero rect, if parent isn't set.
if(parent != nil)
{
NSRect contentRect = [[parent contentView] frame];
//
// The calculation is based on the contentRect of the parent window
// since we want the sheet to appear just inside of it.
//
newFrame = [parent frame];
newFrame.origin.x += ((newFrame.size.width - frame.size.width) / 2);
newFrame.origin.y += (contentRect.size.height - frame.size.height) + 5;
}
return newFrame;
}
- (void) resetWindow
{
NSRect frame = [self frameFromParentWindowFrame];
NSWindow *parent = nil;
if((parent = [self parentWindow]) != nil)
{
[self setBackgroundColor:
[[parent backgroundColor]
highlightWithLevel: 0.4]];
}
[self setFrame: frame display: YES];
}
- (void) setParentWindow: (NSWindow *)window
{
[super setParentWindow: window];
[self resetWindow];
/*
[nc removeObserver: self];
if (parent != nil)
{
// add observers....
[nc addObserver: self
selector: @selector(handleWindowClose:)
name: NSWindowWillCloseNotification
object: parent];
[nc addObserver: self
selector: @selector(handleWindowMiniaturize:)
name: NSWindowWillMiniaturizeNotification
object: parent];
[nc addObserver: self
selector: @selector(handleWindowMove:)
name: NSWindowWillMoveNotification
object: parent];
[nc addObserver: self
selector: @selector(handleWindowMove:)
name: NSWindowDidResizeNotification
object: parent];
[nc addObserver: self
selector: @selector(handleWindowDidBecomeKey:)
name: NSWindowDidBecomeKeyNotification
object: parent];
}
*/
}
/*
- (void) handleWindowClose: (NSNotification *)notification
{
[self close];
}
- (void) handleWindowMiniaturize: (NSNotification *)notification
{
[self close];
}
- (void) handleWindowMove: (NSNotification *)notification
{
[self _resetWindowPosition];
}
- (void) handleWindowDidBecomeKey: (NSNotification *)notification
{
[self _resetWindowPosition];
}
- (void) dealloc
{
[nc removeObserver: self];
[super dealloc];
}
*/
@end
/*
These functions may be called "recursively". For example, from a
timed event. Therefore, there may be several alert panel active
@ -1088,7 +936,6 @@ setControl(NSView* content, id control, NSString *title)
alternateButton: (NSString*)_alternateButton
otherButton: (NSString*)_otherButton;
- (void) makePanel;
- (void) makeSheet;
- (GSAlertPanel*) panel;
@end
@ -1123,7 +970,7 @@ setControl(NSView* content, id control, NSString *title)
- (void) makePanel
{
if (*instance != 0 && [*instance isMemberOfClass: [GSAlertPanel class]])
if (*instance != 0)
{
if ([*instance isActivePanel])
{ // c:
@ -1149,34 +996,6 @@ setControl(NSView* content, id control, NSString *title)
other: otherButton];
}
- (void) makeSheet
{
if (*instance != 0 && [*instance isMemberOfClass: [GSAlertSheet class]])
{
if ([*instance isActivePanel])
{ // c:
panel = [[GSAlertSheet alloc] init];
}
else
{ // b:
panel = *instance;
}
}
else
{ // a:
panel = [[GSAlertSheet alloc] init];
*instance = panel;
}
[panel setTitleBar: defaultTitle
icon: nil
title: title
message: message
def: defaultButton
alt: alternateButton
other: otherButton];
}
- (GSAlertPanel*) panel
{
return panel;
@ -1218,7 +1037,7 @@ getSomePanel(
}
else
{
if (*instance != 0 && [*instance isMemberOfClass: [GSAlertPanel class]])
if (*instance != 0)
{
if ([*instance isActivePanel])
{ // c:
@ -1246,69 +1065,6 @@ getSomePanel(
return panel;
}
static GSAlertPanel*
getSomeSheet(
GSAlertPanel **instance,
NSString *defaultTitle,
NSString *title,
NSString *message,
NSString *defaultButton,
NSString *alternateButton,
NSString *otherButton)
{
GSAlertSheet *panel;
if (GSCurrentThread() != GSAppKitThread)
{
_GSAlertCreation *c;
NSWarnFLog(@"Alert Sheet functionality called from a thread other than"
@" the main one, this may not work on MacOS-X and could therefore be"
@" a portability problem in your code");
c = [_GSAlertCreation alloc];
c = [c initWithInstance: instance
defaultTitle: defaultTitle
title: title
message: message
defaultButton: defaultButton
alternateButton: alternateButton
otherButton: otherButton];
[c performSelectorOnMainThread: @selector(makeSheet)
withObject: nil
waitUntilDone: YES];
panel = (GSAlertSheet *)[c panel];
RELEASE(c);
}
else
{
if (*instance != 0 && [*instance isMemberOfClass: [GSAlertSheet class]])
{
if ([*instance isActivePanel])
{ // c:
panel = [[GSAlertSheet alloc] init];
}
else
{ // b:
panel = (GSAlertSheet *)*instance;
}
}
else
{ // a:
panel = [[GSAlertSheet alloc] init];
*instance = panel;
}
[panel setTitleBar: defaultTitle
icon: nil
title: title
message: message
def: defaultButton
alt: alternateButton
other: otherButton];
}
return panel;
}
id
NSGetAlertPanel(
NSString *title,
@ -1536,18 +1292,23 @@ void NSBeginAlertSheet(NSString *title,
defaultButton = @"OK";
}
panel = getSomeSheet(&standardAlertPanel, defaultTitle, title, message,
panel = getSomePanel(&standardAlertPanel, defaultTitle, title, message,
defaultButton, alternateButton, otherButton);
// FIXME: We should also change the button action to call endSheet:
[NSApp beginSheet: panel
modalForWindow: docWindow
modalDelegate: modalDelegate
didEndSelector: willEndSelector
contextInfo: contextInfo];
[panel close];
if (modalDelegate && [modalDelegate respondsToSelector: didEndSelector])
{
void (*didEnd)(id, SEL, id, int, void*);
didEnd = (void (*)(id, SEL, id, int, void*))[modalDelegate methodForSelector:
didEndSelector];
didEnd(modalDelegate, didEndSelector, panel, [panel result], contextInfo);
}
NSReleaseAlertPanel(panel);
}
@ -1570,7 +1331,7 @@ void NSBeginCriticalAlertSheet(NSString *title,
message = [NSString stringWithFormat: msg arguments: ap];
va_end(ap);
panel = getSomeSheet(&criticalAlertPanel, @"Critical", title, message,
panel = getSomePanel(&criticalAlertPanel, @"Critical", title, message,
defaultButton, alternateButton, otherButton);
// FIXME: We should also change the button action to call endSheet:
[NSApp beginSheet: panel
@ -1579,7 +1340,14 @@ void NSBeginCriticalAlertSheet(NSString *title,
didEndSelector: willEndSelector
contextInfo: contextInfo];
[panel close];
if (modalDelegate && [modalDelegate respondsToSelector: didEndSelector])
{
void (*didEnd)(id, SEL, id, int, void*);
didEnd = (void (*)(id, SEL, id, int, void*))[modalDelegate methodForSelector:
didEndSelector];
didEnd(modalDelegate, didEndSelector, panel, [panel result], contextInfo);
}
NSReleaseAlertPanel(panel);
}
@ -1602,7 +1370,7 @@ void NSBeginInformationalAlertSheet(NSString *title,
message = [NSString stringWithFormat: msg arguments: ap];
va_end(ap);
panel = getSomeSheet(&informationalAlertPanel,
panel = getSomePanel(&informationalAlertPanel,
@"Information",
title, message,
defaultButton, alternateButton, otherButton);
@ -1613,7 +1381,14 @@ void NSBeginInformationalAlertSheet(NSString *title,
didEndSelector: willEndSelector
contextInfo: contextInfo];
[panel close];
if (modalDelegate && [modalDelegate respondsToSelector: didEndSelector])
{
void (*didEnd)(id, SEL, id, int, void*);
didEnd = (void (*)(id, SEL, id, int, void*))[modalDelegate methodForSelector:
didEndSelector];
didEnd(modalDelegate, didEndSelector, panel, [panel result], contextInfo);
}
NSReleaseAlertPanel(panel);
}

View file

@ -372,20 +372,6 @@ struct _NSModalSession {
- (void) _workspaceNotification: (NSNotification*) notification;
@end
@interface NSWindow (ApplicationPrivate)
- (void) setAttachedSheet: (id) sheet;
@end
@implementation NSWindow (ApplicationPrivate)
/**
* Associate sheet with the window it's attached to. The window is not retained.
*/
- (void) setAttachedSheet: (id) sheet
{
_attachedSheet = sheet;
}
@end
@interface NSIconWindow : NSWindow
@end
@ -750,12 +736,9 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
{
NSInvocation *inv;
inv = [[NSInvocation alloc]
invocationWithMethodSignature:
[target methodSignatureForSelector: selector]];
[inv setTarget: target];
[inv setSelector: selector];
[inv setArgument: argument atIndex: 2];
// This uses a GNUstep extension on NSInvocation
inv = [[NSInvocation alloc] initWithTarget: target
selector: selector, argument];
[NSThread detachNewThreadSelector: @selector(_invokeWithAutoreleasePool:)
toTarget: self
withObject: inv];
@ -1891,13 +1874,10 @@ See -runModalForWindow:
// FIXME
int ret;
[sheet setParentWindow: docWindow];
[docWindow setAttachedSheet: sheet];
ret = [self runModalForWindow: sheet
relativeToWindow: docWindow];
if (modalDelegate && [modalDelegate respondsToSelector: didEndSelector])
if ([modalDelegate respondsToSelector: didEndSelector])
{
void (*didEnd)(id, SEL, id, int, void*);
@ -1905,9 +1885,6 @@ See -runModalForWindow:
didEndSelector];
didEnd(modalDelegate, didEndSelector, sheet, ret, contextInfo);
}
[docWindow setAttachedSheet: nil];
[sheet setParentWindow: nil];
}
/**
@ -3479,7 +3456,7 @@ struct _DelegateWrapper
- (NSArray *) orderedWindows
{
NSArray *arr = GSOrderedWindows();
NSMutableArray *ret = [[NSMutableArray alloc] initWithCapacity:[arr count]];
NSMutableArray *ret = [[NSArray alloc] initWithCapacity:[arr count]];
NSEnumerator *iter = [arr objectEnumerator];
id win;
while ((win = [iter nextObject]))

View file

@ -146,20 +146,6 @@ typedef struct _PathElement
return path;
}
+ (NSBezierPath *)bezierPathWithRoundedRect: (NSRect)aRect
xRadius: (CGFloat)xRadius
yRadius: (CGFloat)yRadius
{
NSBezierPath *path;
path = [self bezierPath];
[path appendBezierPathWithRoundedRect: aRect
xRadius: xRadius
yRadius: yRadius];
return path;
}
//
// Immediate mode drawing of common paths
//
@ -1187,55 +1173,6 @@ typedef struct _PathElement
path: self];
}
- (void) appendBezierPathWithRoundedRect: (NSRect)aRect
xRadius: (CGFloat)xRadius
yRadius: (CGFloat)yRadius
{
NSPoint startp, endp, controlp1, controlp2, topLeft, topRight, bottomRight;
xRadius = MIN(xRadius, aRect.size.width / 2.0);
yRadius = MIN(yRadius, aRect.size.height / 2.0);
if (xRadius == 0.0 || yRadius == 0.0)
{
[self appendBezierPathWithRect: aRect];
return;
}
topLeft = NSMakePoint(NSMinX(aRect), NSMaxY(aRect));
topRight = NSMakePoint(NSMaxX(aRect), NSMaxY(aRect));
bottomRight = NSMakePoint(NSMaxX(aRect), NSMinY(aRect));
startp = NSMakePoint(topLeft.x + xRadius, topLeft.y);
endp = NSMakePoint(topLeft.x, topLeft.y - yRadius);
controlp1 = NSMakePoint(startp.x - (KAPPA * xRadius), startp.y);
controlp2 = NSMakePoint(endp.x, endp.y + (KAPPA * yRadius));
[self moveToPoint: startp];
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
startp = NSMakePoint(aRect.origin.x, aRect.origin.y + yRadius);
endp = NSMakePoint(aRect.origin.x + xRadius, aRect.origin.y);
controlp1 = NSMakePoint(startp.x, startp.y - (KAPPA * yRadius));
controlp2 = NSMakePoint(endp.x - (KAPPA * xRadius), endp.y);
[self lineToPoint: startp];
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
startp = NSMakePoint(bottomRight.x - xRadius, bottomRight.y);
endp = NSMakePoint(bottomRight.x, bottomRight.y + yRadius);
controlp1 = NSMakePoint(startp.x + (KAPPA * xRadius), startp.y);
controlp2 = NSMakePoint(endp.x, endp.y - (KAPPA * yRadius));
[self lineToPoint: startp];
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
startp = NSMakePoint(topRight.x, topRight.y - yRadius);
endp = NSMakePoint(topRight.x - xRadius, topRight.y);
controlp1 = NSMakePoint(startp.x, startp.y + (KAPPA * yRadius));
controlp2 = NSMakePoint(endp.x + (KAPPA * xRadius), endp.y);
[self lineToPoint: startp];
[self curveToPoint: endp controlPoint1: controlp1 controlPoint2: controlp2];
[self closePath];
}
/* We use our own point structure with double elements while recursing to
avoid losing accuracy at really fine subdivisions of curves. */

View file

@ -432,23 +432,16 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
if ([sender respondsToSelector: @selector(color)])
{
NSColor *c = [(id)sender color];
/* Don't use -setColor: as that would send a message back to the
* panel telling it to se its color again.
* Instead we assign the color and mark for redisplay directly.
* NB. For MacOS-X compatibility, we only send the action if the
* coor has actually changed.
*/
if (c != nil && [c isEqual: _the_color] == NO)
{
ASSIGN(_the_color, [(id)sender color]);
[self setNeedsDisplay: YES];
/* When our color is changed from the color panel, we should
* send our action.
*/
[self sendAction: _action to: _target];
}
ASSIGN(_the_color, [(id)sender color]);
[self setNeedsDisplay: YES];
/* When our color is changed from the color panel, we should
* send our action.
*/
[self sendAction: _action to: _target];
}
}

View file

@ -228,19 +228,7 @@ withContentsOfURL: (NSURL *)url
- (void) setFileName: (NSString *)fileName
{
NSURL *fileUrl;
if (fileName && ![fileName isAbsolutePath])
{
NSString *dir = [[NSFileManager defaultManager] currentDirectoryPath];
if (dir)
{
fileName = [dir stringByAppendingPathComponent: fileName];
}
}
fileUrl = fileName ? [NSURL fileURLWithPath: fileName] : nil;
NSURL *fileUrl = fileName ? [NSURL fileURLWithPath: fileName] : nil;
// This check is to prevent super calls from recursing.
if (!OVERRIDDEN(setFileName:))
@ -1183,27 +1171,29 @@ originalContentsURL: (NSURL *)orig
contextInfo: (void *)contextInfo
{
// FIXME: Commit registered editors
NSSavePanel *savePanel = [self _runSavePanelForSaveOperation: saveOperation];
if (savePanel)
if (OVERRIDDEN(saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:))
{
if (OVERRIDDEN(saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:))
{
[self saveToFile: [savePanel filename]
saveOperation: saveOperation
delegate: delegate
didSaveSelector: didSaveSelector
contextInfo: contextInfo];
}
else
{
[self saveToURL: [savePanel URL]
ofType: [self fileTypeFromLastRunSavePanel]
forSaveOperation: saveOperation
delegate: delegate
didSaveSelector: didSaveSelector
contextInfo: contextInfo];
}
NSString *fileName;
fileName = [self fileNameFromRunningSavePanelForSaveOperation: saveOperation];
[self saveToFile: fileName
saveOperation: saveOperation
delegate: delegate
didSaveSelector: didSaveSelector
contextInfo: contextInfo];
}
else
{
NSSavePanel *savePanel = [self _runSavePanelForSaveOperation: saveOperation];
NSURL *url = [savePanel URL];
[self saveToURL: url
ofType: [self fileTypeFromLastRunSavePanel]
forSaveOperation: saveOperation
delegate: delegate
didSaveSelector: didSaveSelector
contextInfo: contextInfo];
}
}

View file

@ -218,11 +218,7 @@ static NSNotificationCenter *nc = nil;
- (void) stopTimer
{
if(_timer != nil)
{
[_timer invalidate];
DESTROY(_timer);
}
[_timer invalidate];
}
- (void) orderFrontRegardless
@ -411,7 +407,6 @@ static NSNotificationCenter *nc = nil;
[self stopTimer];
RELEASE(_parentWindow);
TEST_RELEASE(_pendingParentWindow);
[nc removeObserver: self];
[super dealloc];
}
@end

View file

@ -503,63 +503,43 @@ static void setNSFont(NSString *key, NSFont *font)
}
+ (NSFont *) fontWithDescriptor: (NSFontDescriptor *)descriptor
size: (CGFloat)size
size: (float)size
{
NSArray *a;
descriptor = [descriptor matchingFontDescriptorWithMandatoryKeys:
[NSSet setWithArray: [[descriptor fontAttributes] allKeys]]];
if (descriptor == nil)
return nil;
a = [[NSFontManager sharedFontManager] availableFontNamesMatchingFontDescriptor:
descriptor];
if ((a == nil) || ([a count] == 0))
return nil;
return [self fontWithName: [a objectAtIndex: 0]
size: size];
return [self fontWithDescriptor: descriptor size: size textTransform: nil];
}
+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor
textTransform: (NSAffineTransform*)transform
{
NSArray *a;
float fontMatrix[6];
descriptor = [descriptor matchingFontDescriptorWithMandatoryKeys:
[NSSet setWithArray: [[descriptor fontAttributes] allKeys]]];
if (descriptor == nil)
return nil;
a = [[NSFontManager sharedFontManager] availableFontNamesMatchingFontDescriptor:
descriptor];
if ((a == nil) || ([a count] == 0))
return nil;
// FIXME: This method is deprecated
[transform getMatrix: fontMatrix];
return [self fontWithName: [a objectAtIndex: 0]
matrix: fontMatrix];
}
// the transform/matrix can be used to rotate/scale/shear the whole font (independently of the CTM!)
+ (NSFont *) fontWithDescriptor: (NSFontDescriptor *)descriptor
size: (CGFloat)size
size: (float)size
textTransform: (NSAffineTransform *)transform
{
NSArray *a;
NSFontDescriptor *fd;
if (size == 0.0)
size = [NSFont systemFontSize]; // default
descriptor = [descriptor fontDescriptorWithSize: size];
if (transform)
{
return [self fontWithDescriptor: descriptor
textTransform: transform];
}
else
{
return [self fontWithDescriptor: descriptor
size: size];
descriptor = [descriptor fontDescriptorByAddingAttributes:
[NSDictionary dictionaryWithObject: transform
forKey: NSFontMatrixAttribute]];
}
// match all keys
// FIXME: Matching on size and matrix seems nonsensical.
a = [descriptor matchingFontDescriptorsWithMandatoryKeys:
[NSSet setWithArray: [[descriptor fontAttributes] allKeys]]];
if ([a count] == 0)
return nil;
// return first matching font
fd = [a objectAtIndex: 0];
// FIXME: Use NSFontManger to get a font name and create that font
return nil;
}

View file

@ -57,7 +57,7 @@
nil]];
}
+ (id) fontDescriptorWithName: (NSString *)name size: (CGFloat)size
+ (id) fontDescriptorWithName: (NSString *)name size: (float)size
{
return [self fontDescriptorWithFontAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
@ -74,15 +74,11 @@
- (NSFontDescriptor *) fontDescriptorByAddingAttributes:
(NSDictionary *)attributes
{
NSMutableDictionary *m = [_attributes mutableCopy];
NSFontDescriptor *new;
NSMutableDictionary *m = [_attributes mutableCopy];
[m addEntriesFromDictionary: attributes];
new = [isa fontDescriptorWithFontAttributes: m];
RELEASE(m);
return new;
return [isa fontDescriptorWithFontAttributes: m] ;
}
- (NSFontDescriptor *) fontDescriptorWithFace: (NSString *)face
@ -103,36 +99,19 @@
[NSDictionary dictionaryWithObject: matrix forKey: NSFontMatrixAttribute]];
}
- (NSFontDescriptor *) fontDescriptorWithSize: (CGFloat)size
- (NSFontDescriptor *) fontDescriptorWithSize: (float)size
{
return [self fontDescriptorByAddingAttributes:
[NSDictionary dictionaryWithObject: [NSString stringWithFormat:@"%f", size]
[NSDictionary dictionaryWithObject: [NSNumber numberWithFloat: size]
forKey: NSFontSizeAttribute]];
}
- (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:
(NSFontSymbolicTraits)symbolicTraits
(NSFontSymbolicTraits)traits
{
NSDictionary *traits;
traits = [_attributes objectForKey: NSFontTraitsAttribute];
if (traits == nil)
{
traits = [NSDictionary dictionaryWithObject:
[NSNumber numberWithUnsignedInt: symbolicTraits]
forKey: NSFontSymbolicTrait];
}
else
{
traits = AUTORELEASE([traits mutableCopy]);
[(NSMutableDictionary*)traits setObject:
[NSNumber numberWithUnsignedInt: symbolicTraits]
forKey: NSFontSymbolicTrait];
}
return [self fontDescriptorByAddingAttributes:
[NSDictionary dictionaryWithObject: traits
forKey: NSFontTraitsAttribute]];
[NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedInt: traits]
forKey: NSFontSymbolicTrait]];
}
- (id) initWithFontAttributes: (NSDictionary *) attributes
@ -155,7 +134,7 @@
}
else
{
[aCoder encodeObject: _attributes];
// FIXME
}
}
@ -167,7 +146,7 @@
}
else
{
[aDecoder decodeValueOfObjCType: @encode(id) at: &_attributes];
// FIXME
}
return self;
}
@ -212,7 +191,6 @@
if (value != nil)
{
// FIXME: Special handling for NSFontTraitsAttribute
if (![value isEqual: [fd objectForKey: key]])
{
match = NO;
@ -230,19 +208,6 @@
return found;
}
- (NSFontDescriptor *) matchingFontDescriptorWithMandatoryKeys: (NSSet *)keys;
{
NSArray *found = [self matchingFontDescriptorsWithMandatoryKeys: keys];
if (found && ([found count] > 0))
{
return [found objectAtIndex: 0];
}
else
{
return nil;
}
}
- (NSAffineTransform *) matrix
{
@ -254,7 +219,7 @@
return [_attributes objectForKey: attribute];
}
- (CGFloat) pointSize
- (float) pointSize
{
id size = [_attributes objectForKey: NSFontSizeAttribute];
@ -268,9 +233,14 @@
}
}
- (NSFontSymbolicTraits) symbolicTraits
{
return [[_attributes objectForKey: NSFontSymbolicTrait] unsignedIntValue];
}
- (NSString *) postscriptName
{
NSMutableString *family;
NSMutableString *family;
NSString *face;
family = AUTORELEASE([[self objectForKey: NSFontFamilyAttribute] mutableCopy]);
@ -284,19 +254,4 @@
return [NSString stringWithFormat: @"%@-%@", family, face];
}
- (NSFontSymbolicTraits) symbolicTraits
{
NSDictionary *traits;
traits = [_attributes objectForKey: NSFontTraitsAttribute];
if (traits == nil)
{
return 0;
}
else
{
return [[traits objectForKey: NSFontSymbolicTrait] unsignedIntValue];
}
}
@end

View file

@ -141,9 +141,9 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
{
bindingLock = [GSLazyRecursiveLock new];
classTable = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSObjectMapValueCallBacks, 128);
objectTable = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
NSObjectMapValueCallBacks, 128);
NSOwnedPointerMapValueCallBacks, 128);
objectTable = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSOwnedPointerMapValueCallBacks, 128);
}
}
@ -155,9 +155,9 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
bindings = (NSMutableArray *)NSMapGet(classTable, (void*)clazz);
if (bindings == nil)
{
// Need to retain it ourselves
bindings = [[NSMutableArray alloc] initWithCapacity: 5];
NSMapInsert(classTable, (void*)clazz, (void*)bindings);
RELEASE(bindings);
}
[bindings addObject: binding];
[bindingLock unlock];
@ -249,14 +249,13 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
list = (NSDictionary *)NSMapGet(objectTable, (void *)anObject);
if (list != nil)
{
NSArray *keys = [list allKeys];
enumerator = [keys objectEnumerator];
enumerator = [list keyEnumerator];
while ((binding = [enumerator nextObject]))
{
[anObject unbind: binding];
}
NSMapRemove(objectTable, (void *)anObject);
RELEASE(list);
}
[bindingLock unlock];
}
@ -298,7 +297,6 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
{
bindings = [NSMutableDictionary new];
NSMapInsert(objectTable, (void*)source, (void*)bindings);
RELEASE(bindings);
}
[bindings setObject: self forKey: name];
[bindingLock unlock];

View file

@ -2292,6 +2292,7 @@ no_soft_invalidation:
if ([aDecoder allowsKeyedCoding])
{
/*
int i;
int flags;
NSArray *array = [aDecoder decodeObjectForKey: @"NSTextContainers"];
@ -2311,6 +2312,7 @@ no_soft_invalidation:
{
[self addTextContainer: [array objectAtIndex: i]];
}
*/
return self;
}
else

View file

@ -466,45 +466,45 @@ static BOOL menuBarVisible = YES;
NSDebugLLog (@"NSMenu", @"Synchronizing user defaults");
key = [self _locationKey];
if (key != nil)
{
NSUserDefaults *defaults;
NSMutableDictionary *menuLocations;
NSString *locString;
{
NSUserDefaults *defaults;
NSMutableDictionary *menuLocations;
NSString *locString;
defaults = [NSUserDefaults standardUserDefaults];
menuLocations = [defaults objectForKey: NSMenuLocationsKey];
if ([menuLocations isKindOfClass: [NSDictionary class]])
menuLocations = AUTORELEASE([menuLocations mutableCopy]);
else
menuLocations = nil;
defaults = [NSUserDefaults standardUserDefaults];
menuLocations = [defaults objectForKey: NSMenuLocationsKey];
if ([menuLocations isKindOfClass: [NSDictionary class]])
menuLocations = [menuLocations mutableCopy];
else
menuLocations = nil;
if ([_aWindow isVisible]
&& ([self isTornOff] || ([NSApp mainMenu] == self)))
{
if (menuLocations == nil)
{
menuLocations = AUTORELEASE([[NSMutableDictionary alloc]
initWithCapacity: 2]);
}
locString = [[self window] stringWithSavedFrame];
[menuLocations setObject: locString forKey: key];
}
else
{
[menuLocations removeObjectForKey: key];
}
if ([menuLocations count] > 0)
{
[defaults setObject: menuLocations
forKey: NSMenuLocationsKey];
}
else
{
[defaults removeObjectForKey: NSMenuLocationsKey];
}
[defaults synchronize];
}
if ([_aWindow isVisible]
&& ([self isTornOff] || ([NSApp mainMenu] == self)))
{
if (menuLocations == nil)
{
menuLocations = AUTORELEASE([[NSMutableDictionary alloc]
initWithCapacity: 2]);
}
locString = [[self window] stringWithSavedFrame];
[menuLocations setObject: locString forKey: key];
}
else
{
[menuLocations removeObjectForKey: key];
}
if ([menuLocations count] > 0)
{
[defaults setObject: menuLocations
forKey: NSMenuLocationsKey];
}
else
{
[defaults removeObjectForKey: NSMenuLocationsKey];
}
[defaults synchronize];
}
}
}

View file

@ -506,17 +506,9 @@ static Class imageClass;
[aCoder encodeObject: _onStateImage forKey: @"NSOnImage"];
[aCoder encodeObject: _offStateImage forKey: @"NSOffImage"]; // ???????
[aCoder encodeObject: _mixedStateImage forKey: @"NSMixedImage"];
[aCoder encodeObject: _target forKey: @"NSTarget"];
[aCoder encodeObject: _target forKey: @"NSTarget"];
[aCoder encodeObject: _menu forKey: @"NSMenu"];
// If the menu is owned by a popup, then don't encode the children.
// This prevents an assertion error in IB as these keys should not
// be present in a menu item when it's encoded as part of a popup.
if([_menu _ownedByPopUp] == NO)
{
[aCoder encodeObject: _submenu forKey: @"NSSubmenu"];
}
[aCoder encodeObject: _submenu forKey: @"NSSubmenu"];
[aCoder encodeInt: _keyEquivalentModifierMask forKey: @"NSKeyEquivModMask"];
[aCoder encodeInt: _mnemonicLocation forKey: @"NSMnemonicLoc"];
[aCoder encodeInt: _state forKey: @"NSState"];

View file

@ -32,13 +32,8 @@
#include <Foundation/NSString.h>
#include <Foundation/NSArchiver.h>
#include <Foundation/NSKeyedArchiver.h>
#include <Foundation/NSKeyValueObserving.h>
#include <Foundation/NSKeyValueCoding.h>
#include <AppKit/NSObjectController.h>
#include "AppKit/NSKeyValueBinding.h"
#include "GSBindingHelpers.h"
@interface _NSManagedProxy : NSObject
{
NSString *_entity_name_key;
@ -96,20 +91,6 @@
@implementation NSObjectController
+ (void) initialize
{
if (self == [NSObjectController class])
{
[self exposeBinding: NSContentObjectBinding];
[self setKeys: [NSArray arrayWithObject: @"editable"]
triggerChangeNotificationsForDependentKey: @"canAdd"];
[self setKeys: [NSArray arrayWithObject: @"editable"]
triggerChangeNotificationsForDependentKey: @"canRemove"];
[self setKeys: [NSArray arrayWithObject: @"content"]
triggerChangeNotificationsForDependentKey: @"selectedObjects"];
}
}
- (id) initWithContent: (id)content
{
if ((self = [super init]) != nil)
@ -130,11 +111,9 @@
- (void) dealloc
{
[GSKeyValueBinding unbindAllForObject: self];
RELEASE(_content);
RELEASE(_entity_name_key);
RELEASE(_fetch_predicate);
RELEASE(_selection);
[super dealloc];
}
@ -195,43 +174,7 @@
- (void) setContent: (id)content
{
NSMutableArray *selection;
ASSIGN(_content, content);
if (content)
{
selection = [[NSMutableArray alloc] initWithObjects: &content count: 1];
}
else
{
selection = [[NSMutableArray alloc] init];
}
ASSIGN(_selection, selection);
RELEASE(selection);
}
- (void)bind: (NSString *)binding
toObject: (id)anObject
withKeyPath: (NSString *)keyPath
options: (NSDictionary *)options
{
if ([binding isEqual:NSContentObjectBinding])
{
[self unbind: binding];
[[GSKeyValueBinding alloc] initWithBinding: @"content"
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
}
else
{
[super bind: binding
toObject: anObject
withKeyPath: keyPath
options: options];
}
}
- (Class) objectClass
@ -269,62 +212,40 @@
- (void) add: (id)sender
{
if ([self canAdd])
{
id new = [self newObject];
id new = [self newObject];
[self addObject: new];
RELEASE(new);
}
[self addObject: new];
RELEASE(new);
}
- (void) addObject: (id)obj
{
NSDictionary * bindingInfo = [self infoForBinding: NSContentObjectBinding];
[self setContent: obj];
if (bindingInfo)
{
// Change the relationship of the object that our content is bound to.
id masterObject = [bindingInfo objectForKey: NSObservedObjectKey];
NSString * keyPath = [bindingInfo objectForKey: NSObservedKeyPathKey];
[masterObject setValue: obj forKeyPath: keyPath];
}
// TODO
}
- (void) remove: (id)sender
{
if ([self canRemove])
{
[self removeObject: [self content]];
}
[self removeObject: [self content]];
}
- (void) removeObject: (id)obj
{
if (obj == [self content])
{
NSDictionary * bindingInfo = [self infoForBinding: NSContentObjectBinding];
[self setContent: nil];
if (bindingInfo)
{
// Change the relationship of the object that our content is bound to.
id masterObject = [bindingInfo objectForKey: NSObservedObjectKey];
NSString * keyPath = [bindingInfo objectForKey: NSObservedKeyPathKey];
[masterObject setValue: nil forKeyPath: keyPath];
}
// TODO
}
}
- (BOOL) canAdd
{
return [self isEditable];
return YES;
}
- (BOOL) canRemove
{
return [self isEditable] && [[self selectedObjects] count] > 0;
return YES;
}
- (BOOL) isEditable
@ -340,7 +261,7 @@
- (NSArray*) selectedObjects
{
// TODO
return _selection;
return nil;
}
- (id) selection

View file

@ -33,7 +33,6 @@
Boston, MA 02110-1301, USA.
*/
#include <limits.h>
#include <math.h>
#include "config.h"
#include <Foundation/NSString.h>
@ -761,18 +760,11 @@ scaleRect(NSRect rect, double scale)
- (void) _printPaginateWithInfo: (page_info_t *)info knowsRange: (BOOL)knowsRange
{
NSMutableDictionary *dict;
NSNumber *value;
dict = [_print_info dictionary];
info->paperSize = [_print_info paperSize];
info->orient = [_print_info orientation];
value = [dict objectForKey: NSPrintScalingFactor];
if (value != nil)
info->printScale = [value doubleValue];
else
info->printScale = 1.0;
info->printScale = [[dict objectForKey: NSPrintScalingFactor] doubleValue];
info->nup = [[dict objectForKey: NSPrintPagesPerSheet] intValue];
info->nupScale = 1;
if (info->nup < 1 || (info->nup > 1 && (((info->nup) & 0x1) == 1)))
@ -947,7 +939,6 @@ scaleRect(NSRect rect, double scale)
BOOL knowsPageRange, allPages;
NSRange viewPageRange;
NSMutableDictionary *dict;
NSNumber *value;
page_info_t info;
dict = [_print_info dictionary];
@ -968,11 +959,7 @@ scaleRect(NSRect rect, double scale)
[dict setObject: NSNUMBER(NSMaxRange(viewPageRange))
forKey: @"NSPrintTotalPages"];
value = [dict objectForKey: NSPrintAllPages];
if (value != nil)
allPages = [value boolValue];
else
allPages = YES;
allPages = [[dict objectForKey: NSPrintAllPages] boolValue];
if (allPages == YES)
{
info.first = viewPageRange.location;
@ -980,18 +967,8 @@ scaleRect(NSRect rect, double scale)
}
else
{
value = [dict objectForKey: NSPrintFirstPage];
if (value != nil)
info.first = [value intValue];
else
info.first = 1;
value = [dict objectForKey: NSPrintLastPage];
if (value != nil)
info.last = [value intValue];
else
info.last = INT_MAX;
info.first = [[dict objectForKey: NSPrintFirstPage] intValue];
info.last = [[dict objectForKey: NSPrintLastPage] intValue];
info.first = MAX(info.first, (int)viewPageRange.location);
info.first = MIN(info.first, (int)(NSMaxRange(viewPageRange) - 1));
info.last = MAX(info.last, info.first);

View file

@ -29,10 +29,7 @@
#include <Foundation/NSString.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSThread.h>
#include <Foundation/NSError.h>
#include <Foundation/NSConnection.h>
#include "AppKit/NSWorkspace.h"
#include "AppKit/NSSpeechSynthesizer.h"
// Keys for properties...
@ -86,106 +83,53 @@ NSString *NSSpeechDictionaryAbreviations = @"NSSpeechDictionaryAbreviations";
NSString *NSSpeechDictionaryEntrySpelling = @"NSSpeechDictionaryEntrySpelling";
NSString *NSSpeechDictionaryEntryPhonemes = @"NSSpeechDictionaryEntryPhonemes";
// Speech daemon
static id server;
// Flag indicating whether we should wait for the daemon to finish launching.
static BOOL serverLaunchTested;
// Class of the NSSpeechSynthesizer
static Class NSSpeechSynthesizerClass;
// Informal protocol used for the server.
@interface NSObject (GSSpeechServer)
- (NSSpeechSynthesizer*)newSynthesizer;
@end
// class declaration...
@implementation NSSpeechSynthesizer
// init...
- (id) initWithVoice: (NSString *)voice
{
return self;
}
+ (void)initialize
{
NSSpeechSynthesizerClass = [NSSpeechSynthesizer class];
server = [[NSConnection rootProxyForConnectionWithRegisteredName: @"GSSpeechServer"
host: nil] retain];
if (nil == server)
{
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
[ws launchApplication: @"GSSpeechServer"
showIcon: NO
autolaunch: NO];
}
}
+ (BOOL)isAnyApplicationSpeaking
{
return [server isSpeaking];
}
// Never really allocate one of these.
+ (id)allocWithZone: (NSZone*)aZone
{
if (self == NSSpeechSynthesizerClass)
{
if (nil == server && !serverLaunchTested)
{
unsigned int i=0;
// Wait for up to five seconds for the server to launch, then give up.
for (i=0 ; i<50 ; i++)
{
server =
[[NSConnection rootProxyForConnectionWithRegisteredName:
@"GSSpeechServer"
host: nil]
retain];
if (nil != server)
{
break;
}
[NSThread sleepForTimeInterval: 0.1];
}
// Set a flag so we don't bother waiting for the speech server to
// launch the next time if it didn't work this time.
serverLaunchTested = YES;
}
// If there is no server, this will return nil
return [server newSynthesizer];
}
return [super allocWithZone: aZone];
}
// configuring speech synthesis
- (BOOL) usesFeebackWindow
{
return NO;
return _usesFeedbackWindow;
}
- (void) setUsesFeebackWindow: (BOOL)flag
{
_usesFeedbackWindow = flag;
}
- (NSString *) voice
{
return nil;
return _voice;
}
- (void) setVoice: (NSString *)voice
{
ASSIGN(_voice, voice);
}
- (float) rate
{
return 0;
return _rate;
}
- (void) setRate: (float)rate
{
_rate = rate;
}
- (float) volume
{
return 0;
return _volume;
}
- (void) setVolume: (float)volume
{
_volume = volume;
}
- (void) addSpeechDictionary: (NSDictionary *)speechDictionary
@ -201,16 +145,18 @@ static Class NSSpeechSynthesizerClass;
forProperty: (NSString *)property
error: (NSError **)error
{
[self subclassResponsibility: _cmd];
return nil;
}
- (id) delegate
{
return nil;
return _delegate;
}
- (void) setDelegate: (id)delegate
{
_delegate = delegate;
}
// Getting information...
@ -226,43 +172,57 @@ static Class NSSpeechSynthesizerClass;
+ (NSString *) defaultVoice
{
[self subclassResponsibility: _cmd];
return nil;
}
// Getting state...
+ (BOOL) isAnyApplicationSpeaking
{
return NO;
}
// Synthesizing..
- (BOOL) isSpeaking
{
return NO;
return _isSpeaking;
}
- (BOOL) startSpeakingString: (NSString *)text
{
[self subclassResponsibility: _cmd];
return NO;
}
- (BOOL) startSpeakingString: (NSString *)text toURL: (NSURL *)url
{
[self subclassResponsibility: _cmd];
return NO;
}
- (void) stopSpeaking
{
[self subclassResponsibility: _cmd];
}
- (void) stopSpeakingAtBoundary: (NSSpeechBoundary)boundary
{
[self subclassResponsibility: _cmd];
}
- (void) pauseSpeakingAtBoundary: (NSSpeechBoundary)boundary
{
[self subclassResponsibility: _cmd];
}
- (void) continueSpeaking
{
[self subclassResponsibility: _cmd];
}
- (NSString *) phonemesFromText: (NSString *)text
{
[self subclassResponsibility: _cmd];
return nil;
}
@end

View file

@ -164,241 +164,11 @@ static NSNotificationCenter *nc = nil;
return YES;
}
/**
* Utility function to draw the xor-ed splitview divider
* It is only used in the non-live resize mode.
*/
- (BOOL) _drawHighlightedDividerWithSize: (NSRect) r
andOldSize: (NSRect) oldRect
isLit: (BOOL) lit
{
if (NSEqualRects(r, oldRect) == YES)
{
return lit;
}
NSDebugLLog(@"NSSplitView", @"drawing divider at %@\n",
NSStringFromRect(r));
[_dividerColor set];
if (lit == YES)
{
if (_isVertical == NO)
{
if ((NSMinY(r) > NSMaxY(oldRect))
|| (NSMaxY(r) < NSMinY(oldRect)))
// the two rects don't intersect
{
NSHighlightRect(oldRect);
NSHighlightRect(r);
}
else
// the two rects intersect
{
if (NSMinY(r) > NSMinY(oldRect))
{
NSRect onRect, offRect;
onRect.size.width = r.size.width;
onRect.origin.x = r.origin.x;
offRect.size.width = r.size.width;
offRect.origin.x = r.origin.x;
offRect.origin.y = NSMinY(oldRect);
offRect.size.height =
NSMinY(r) - NSMinY(oldRect);
onRect.origin.y = NSMaxY(oldRect);
onRect.size.height =
NSMaxY(r) - NSMaxY(oldRect);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
//NSLog(@"on : %@", NSStringFromRect(onRect));
//NSLog(@"off : %@", NSStringFromRect(offRect));
//NSLog(@"old : %@", NSStringFromRect(oldRect));
//NSLog(@"r : %@", NSStringFromRect(r));
}
else
{
NSRect onRect, offRect;
onRect.size.width = r.size.width;
onRect.origin.x = r.origin.x;
offRect.size.width = r.size.width;
offRect.origin.x = r.origin.x;
offRect.origin.y = NSMaxY(r);
offRect.size.height =
NSMaxY(oldRect) - NSMaxY(r);
onRect.origin.y = NSMinY(r);
onRect.size.height =
NSMinY(oldRect) - NSMinY(r);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
//NSLog(@"on : %@", NSStringFromRect(onRect));
//NSLog(@"off : %@", NSStringFromRect(offRect));
//NSLog(@"old : %@", NSStringFromRect(oldRect));
//NSLog(@"r : %@", NSStringFromRect(r));
}
}
}
else
{
if ((NSMinX(r) > NSMaxX(oldRect))
|| (NSMaxX(r) < NSMinX(oldRect)))
// the two rects don't intersect
{
NSHighlightRect(oldRect);
NSHighlightRect(r);
}
else
// the two rects intersect
{
if (NSMinX(r) > NSMinX(oldRect))
{
NSRect onRect, offRect;
onRect.size.height = r.size.height;
onRect.origin.y = r.origin.y;
offRect.size.height = r.size.height;
offRect.origin.y = r.origin.y;
offRect.origin.x = NSMinX(oldRect);
offRect.size.width =
NSMinX(r) - NSMinX(oldRect);
onRect.origin.x = NSMaxX(oldRect);
onRect.size.width =
NSMaxX(r) - NSMaxX(oldRect);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
}
else
{
NSRect onRect, offRect;
onRect.size.height = r.size.height;
onRect.origin.y = r.origin.y;
offRect.size.height = r.size.height;
offRect.origin.y = r.origin.y;
offRect.origin.x = NSMaxX(r);
offRect.size.width =
NSMaxX(oldRect) - NSMaxX(r);
onRect.origin.x = NSMinX(r);
onRect.size.width =
NSMinX(oldRect) - NSMinX(r);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
}
}
}
}
else
{
NSHighlightRect(r);
}
[_window flushWindow];
/*
if (lit == YES)
{
NSHighlightRect(oldRect);
lit = NO;
}
NSHighlightRect(r);
*/
return YES;
}
/**
* Utility function handling the splitview resize after
* the divider has been moved
*/
- (void) _resize: (id) v withOldSplitView: (id) prev
withFrame: (NSRect) r fromPoint: (NSPoint) p
withBigRect: (NSRect) bigRect divHorizontal: (float) divHorizontal
divVertical: (float) divVertical
{
NSRect r1 = NSZeroRect;
[nc postNotificationName: NSSplitViewWillResizeSubviewsNotification
object: self];
/* resize the subviews accordingly */
r = [prev frame];
if (_isVertical == NO)
{
r.size.height = p.y - NSMinY(bigRect) - (divVertical/2.);
if (NSHeight(r) < 1.)
{
r.size.height = 1.;
}
}
else
{
r.size.width = p.x - NSMinX(bigRect) - (divHorizontal/2.);
if (NSWidth(r) < 1.)
{
r.size.width = 1.;
}
}
[prev setFrame: r];
NSDebugLLog(@"NSSplitView", @"drawing PREV at x: %d, y: %d, w: %d, h: %d\n",
(int)NSMinX(r),(int)NSMinY(r),(int)NSWidth(r),(int)NSHeight(r));
r1 = [v frame];
if (_isVertical == NO)
{
r1.origin.y = p.y + (divVertical/2.);
if (NSMinY(r1) < 0.)
{
r1.origin.y = 0.;
}
r1.size.height = NSHeight(bigRect) - NSHeight(r) - divVertical;
if (NSHeight(r) < 1.)
{
r.size.height = 1.;
}
}
else
{
r1.origin.x = p.x + (divHorizontal/2.);
if (NSMinX(r1) < 0.)
{
r1.origin.x = 0.;
}
r1.size.width = NSWidth(bigRect) - NSWidth(r) - divHorizontal;
if (NSWidth(r1) < 1.)
{
r1.size.width = 1.;
}
}
[v setFrame: r1];
NSDebugLLog(@"NSSplitView", @"drawing LAST at x: %d, y: %d, w: %d, h: %d\n",
(int)NSMinX(r1),(int)NSMinY(r1),(int)NSWidth(r1),
(int)NSHeight(r1));
[nc postNotificationName: NSSplitViewDidResizeSubviewsNotification
object: self];
}
/**
* In -mouseDown we intercept the mouse event to handle the
* splitview divider move. Moving the divider will do a live
* resize of the subviews by default. Users can revert to
* a "ghost" display of the splitview (without doing the
* resize) by doing:
* defaults write NSGlobalDomain GSUseGhostResize YES
*/
- (void) mouseDown: (NSEvent*)theEvent
{
NSApplication *app = [NSApplication sharedApplication];
static NSRect oldRect; //only one can be dragged at a time
static BOOL lit = NO;
NSPoint p, op;
NSEvent *e;
NSRect r, r1, bigRect, vis;
@ -415,9 +185,6 @@ static NSNotificationCenter *nc = nil;
SEL constrainSel = @selector(splitView:constrainSplitPosition:ofSubviewAt:);
typedef float (*floatIMP)(id, SEL, id, float, int);
floatIMP constrainImp = NULL;
BOOL liveResize = ![[NSUserDefaults standardUserDefaults] boolForKey: @"GSUseGhostResize"];
NSRect oldRect; //only one can be dragged at a time
BOOL lit = NO;
/* if there are less the two subviews, there is nothing to do */
if (count < 2)
@ -578,15 +345,12 @@ static NSNotificationCenter *nc = nil;
}
}
if (!liveResize)
{
oldRect = NSZeroRect;
[self lockFocus];
[_dividerColor set];
}
oldRect = NSZeroRect;
[self lockFocus];
[[NSRunLoop currentRunLoop] limitDateForMode: NSEventTrackingRunLoopMode];
[_dividerColor set];
r.size.width = divHorizontal;
r.size.height = divVertical;
e = [app nextEventMatchingMask: eventMask
@ -599,20 +363,12 @@ static NSNotificationCenter *nc = nil;
constrainImp = (floatIMP)[_delegate methodForSelector: constrainSel];
}
if (!liveResize)
{
// Save the old position
op = p;
}
// Save the old position
op = p;
// user is moving the knob loop until left mouse up
while ([e type] != NSLeftMouseUp)
{
if (liveResize)
{
// Save the old position
op = p;
}
p = [self convertPoint: [e locationInWindow] fromView: nil];
if (delegateConstrains)
{
@ -654,12 +410,145 @@ static NSNotificationCenter *nc = nil;
r.origin.x = p.x - (divHorizontal/2.);
r.origin.y = NSMinY(vis);
}
if (!liveResize)
if (NSEqualRects(r, oldRect) == NO)
{
lit = [self _drawHighlightedDividerWithSize: r
andOldSize: oldRect
isLit: lit];
NSDebugLLog(@"NSSplitView", @"drawing divider at %@\n",
NSStringFromRect(r));
[_dividerColor set];
if (lit == YES)
{
if (_isVertical == NO)
{
if ((NSMinY(r) > NSMaxY(oldRect))
|| (NSMaxY(r) < NSMinY(oldRect)))
// the two rects don't intersect
{
NSHighlightRect(oldRect);
NSHighlightRect(r);
}
else
// the two rects intersect
{
if (NSMinY(r) > NSMinY(oldRect))
{
NSRect onRect, offRect;
onRect.size.width = r.size.width;
onRect.origin.x = r.origin.x;
offRect.size.width = r.size.width;
offRect.origin.x = r.origin.x;
offRect.origin.y = NSMinY(oldRect);
offRect.size.height =
NSMinY(r) - NSMinY(oldRect);
onRect.origin.y = NSMaxY(oldRect);
onRect.size.height =
NSMaxY(r) - NSMaxY(oldRect);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
//NSLog(@"on : %@", NSStringFromRect(onRect));
//NSLog(@"off : %@", NSStringFromRect(offRect));
//NSLog(@"old : %@", NSStringFromRect(oldRect));
//NSLog(@"r : %@", NSStringFromRect(r));
}
else
{
NSRect onRect, offRect;
onRect.size.width = r.size.width;
onRect.origin.x = r.origin.x;
offRect.size.width = r.size.width;
offRect.origin.x = r.origin.x;
offRect.origin.y = NSMaxY(r);
offRect.size.height =
NSMaxY(oldRect) - NSMaxY(r);
onRect.origin.y = NSMinY(r);
onRect.size.height =
NSMinY(oldRect) - NSMinY(r);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
//NSLog(@"on : %@", NSStringFromRect(onRect));
//NSLog(@"off : %@", NSStringFromRect(offRect));
//NSLog(@"old : %@", NSStringFromRect(oldRect));
//NSLog(@"r : %@", NSStringFromRect(r));
}
}
}
else
{
if ((NSMinX(r) > NSMaxX(oldRect))
|| (NSMaxX(r) < NSMinX(oldRect)))
// the two rects don't intersect
{
NSHighlightRect(oldRect);
NSHighlightRect(r);
}
else
// the two rects intersect
{
if (NSMinX(r) > NSMinX(oldRect))
{
NSRect onRect, offRect;
onRect.size.height = r.size.height;
onRect.origin.y = r.origin.y;
offRect.size.height = r.size.height;
offRect.origin.y = r.origin.y;
offRect.origin.x = NSMinX(oldRect);
offRect.size.width =
NSMinX(r) - NSMinX(oldRect);
onRect.origin.x = NSMaxX(oldRect);
onRect.size.width =
NSMaxX(r) - NSMaxX(oldRect);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
}
else
{
NSRect onRect, offRect;
onRect.size.height = r.size.height;
onRect.origin.y = r.origin.y;
offRect.size.height = r.size.height;
offRect.origin.y = r.origin.y;
offRect.origin.x = NSMaxX(r);
offRect.size.width =
NSMaxX(oldRect) - NSMaxX(r);
onRect.origin.x = NSMinX(r);
onRect.size.width =
NSMinX(oldRect) - NSMinX(r);
NSHighlightRect(onRect);
NSHighlightRect(offRect);
}
}
}
}
else
{
NSHighlightRect(r);
}
[_window flushWindow];
/*
if (lit == YES)
{
NSHighlightRect(oldRect);
lit = NO;
}
NSHighlightRect(r);
*/
lit = YES;
oldRect = r;
}
@ -694,46 +583,91 @@ static NSNotificationCenter *nc = nil;
while (ee != nil);
}
}
if (liveResize)
{
// If the splitview was moved, we resize the subviews
if ((_isVertical == YES && p.x != op.x)
|| (_isVertical == NO && p.y != op.y))
{
[self _resize: v withOldSplitView: prev withFrame: r fromPoint: p
withBigRect: bigRect divHorizontal: divHorizontal
divVertical: divVertical];
[_window invalidateCursorRectsForView: self];
[self setNeedsDisplay: YES];
}
}
}
if (!liveResize)
if (lit == YES)
{
if (lit == YES)
{
[_dividerColor set];
NSHighlightRect(oldRect);
lit = NO;
}
[self unlockFocus];
[_dividerColor set];
NSHighlightRect(oldRect);
lit = NO;
}
if (!liveResize)
[self unlockFocus];
// Divider position hasn't changed don't try to resize subviews
if (_isVertical == YES && p.x == op.x)
{
// If the splitview was moved, we resize the subviews
if ((_isVertical == YES && p.x != op.x)
|| (_isVertical == NO && p.y != op.y))
[self setNeedsDisplay: YES];
return;
}
else if (_isVertical == NO && p.y == op.y)
{
[self setNeedsDisplay: YES];
return;
}
[nc postNotificationName: NSSplitViewWillResizeSubviewsNotification
object: self];
/* resize the subviews accordingly */
r = [prev frame];
if (_isVertical == NO)
{
r.size.height = p.y - NSMinY(bigRect) - (divVertical/2.);
if (NSHeight(r) < 1.)
{
[self _resize: v withOldSplitView: prev withFrame: r fromPoint: p
withBigRect: bigRect divHorizontal: divHorizontal
divVertical: divVertical];
[_window invalidateCursorRectsForView: self];
r.size.height = 1.;
}
}
else
{
r.size.width = p.x - NSMinX(bigRect) - (divHorizontal/2.);
if (NSWidth(r) < 1.)
{
r.size.width = 1.;
}
}
[prev setFrame: r];
NSDebugLLog(@"NSSplitView", @"drawing PREV at x: %d, y: %d, w: %d, h: %d\n",
(int)NSMinX(r),(int)NSMinY(r),(int)NSWidth(r),(int)NSHeight(r));
r1 = [v frame];
if (_isVertical == NO)
{
r1.origin.y = p.y + (divVertical/2.);
if (NSMinY(r1) < 0.)
{
r1.origin.y = 0.;
}
r1.size.height = NSHeight(bigRect) - NSHeight(r) - divVertical;
if (NSHeight(r) < 1.)
{
r.size.height = 1.;
}
}
else
{
r1.origin.x = p.x + (divHorizontal/2.);
if (NSMinX(r1) < 0.)
{
r1.origin.x = 0.;
}
r1.size.width = NSWidth(bigRect) - NSWidth(r) - divHorizontal;
if (NSWidth(r1) < 1.)
{
r1.size.width = 1.;
}
}
[v setFrame: r1];
NSDebugLLog(@"NSSplitView", @"drawing LAST at x: %d, y: %d, w: %d, h: %d\n",
(int)NSMinX(r1),(int)NSMinY(r1),(int)NSWidth(r1),
(int)NSHeight(r1));
[_window invalidateCursorRectsForView: self];
[nc postNotificationName: NSSplitViewDidResizeSubviewsNotification
object: self];
[self _autosaveSubviewProportions];

View file

@ -32,7 +32,6 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSDebug.h>
#include <Foundation/NSRunLoop.h>
#include <Foundation/NSUserDefaults.h>
#include "AppKit/NSTableHeaderCell.h"
#include "AppKit/NSTableHeaderView.h"
#include "AppKit/NSTableColumn.h"
@ -271,13 +270,6 @@
}
}
/**
* In -mouseDown we intercept the mouse event to handle the
* colum resize and rearrangement. Resizing or moving columns
* will do a live resize/move of the columns by default. Users can revert to
* a "ghost" resize/move indicator by doing:
* defaults write NSGlobalDomain GSUseGhostResize YES
*/
- (void) mouseDown: (NSEvent*)event
{
NSPoint location = [event locationInWindow];
@ -348,150 +340,186 @@
/* Resizing */
if (_resizedColumn != -1)
{
float p;
NSEvent *e;
BOOL lit;
unsigned int eventMask;
BOOL liveResize;
/* Width of the highlighted area. */
const float divWidth = 4;
/* Coordinates of visible part of table */
float minVisCoord = NSMinX([self visibleRect]);
float maxVisCoord = NSMaxX([self visibleRect]);
NSPoint unconverted = [event locationInWindow];
NSArray *columns = [_tableView tableColumns];
/* Dragging limits */
float minCoord;
float maxCoord;
float minAbsCoord;
float maxAbsCoord;
float minVisCoord;
float maxVisCoord;
NSRect tvRect;
NSPoint unconverted;
NSArray *columns;
/* Column on the left of resizing bound */
NSTableColumn *column = [columns objectAtIndex: _resizedColumn];
const float columnMinX = NSMinX([self headerRectOfColumn: _resizedColumn]);
const float columnMinWidth = [column minWidth];
const float columnMaxWidth = [column maxWidth];
float newColumnWidth;
float newColumnMaxX;
NSRect oldHighlightRect;
NSRect highlightRect = [self visibleRect];
highlightRect.size.width = divWidth;
NSTableColumn *column;
NSRect rectLow = [self headerRectOfColumn: _resizedColumn];
/* Old highlighted rect, used to avoid useless redrawing */
NSRect oldRect = NSZeroRect;
/* Current highlighted rect */
NSRect r;
/* Mouse position */
float p;
float q;
BOOL outside = NO;
/* YES if some highlighting was done and needs to be undone */
lit = NO;
eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask | NSPeriodicMask;
liveResize = ![[NSUserDefaults standardUserDefaults] boolForKey: @"GSUseGhostResize"];
BOOL lit = NO;
/* YES if some dragging was actually done - to avoid
retiling/redrawing the table if no dragging is done */
BOOL dragged = NO;
NSEvent *e;
NSDate *farAway = [NSDate distantFuture];
unsigned int eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask
| NSPeriodicMask;
/* Determine dragging limits, constrained to visible rect */
rect = [self visibleRect];
minVisCoord = MAX (NSMinX (rectLow), NSMinX (rect)) + divWidth;
maxVisCoord = NSMaxX (rect) - divWidth;
/* Then constrain to minimum and maximum column width if any */
columns = [_tableView tableColumns];
/* Column at the left */
column = [columns objectAtIndex: _resizedColumn];
if ([column isResizable] == NO)
{
_resizedColumn = -1;
return;
}
/* We use p as a temporary variable for a while */
minAbsCoord = NSMinX (rectLow) + [column minWidth];
maxAbsCoord = NSMinX (rectLow) + [column maxWidth];
minCoord = MAX (minAbsCoord, minVisCoord);
maxCoord = MIN (maxAbsCoord, maxVisCoord);
/* Do we need to check that we already fit into this area ?
We should */
if (!liveResize)
{
oldHighlightRect = NSZeroRect;
[self lockFocus];
[[NSColor lightGrayColor] set];
}
[self lockFocus];
[[NSRunLoop currentRunLoop] limitDateForMode: NSEventTrackingRunLoopMode];
[[NSColor lightGrayColor] set];
r.size.width = divWidth;
r.size.height = NSHeight (rect);
r.origin.y = NSMinY (rect);
[NSEvent startPeriodicEventsAfterDelay: 0.05 withPeriod: 0.05];
e = [NSApp nextEventMatchingMask: eventMask
untilDate: [NSDate distantFuture]
untilDate: farAway
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
/* Safety assignment to make sure p is never left
unitialized - should make no difference with current code
but anyway */
p = NSMaxX (rectLow);
while ([e type] != NSLeftMouseUp)
{
if ([e type] != NSPeriodic)
{
dragged = YES;
unconverted = [e locationInWindow];
}
p = [self convertPoint: unconverted fromView: nil].x;
minVisCoord = NSMinX([self visibleRect]);
maxVisCoord = NSMaxX([self visibleRect]);
/* newColumnWidth is always positive, since we always resize
the column to the left of the mouse pointer */
newColumnWidth = (p - columnMinX);
newColumnWidth = MAX(MIN(newColumnWidth, columnMaxWidth), columnMinWidth);
newColumnMaxX = columnMinX + newColumnWidth;
if (liveResize && [column width] != newColumnWidth)
{
[_tableView _userResizedTableColumn: _resizedColumn
width: newColumnWidth];
}
else if (!liveResize)
{
highlightRect.origin.x = newColumnMaxX;
/* Only draw the divider if it is not the same as the currently
drawn one, and lies within the header view area */
if (!NSEqualRects(oldHighlightRect,highlightRect) &&
highlightRect.origin.x > [self visibleRect].origin.x &&
highlightRect.origin.x + divWidth < [self visibleRect].origin.x + [self visibleRect].size.width)
p = [self convertPoint: unconverted fromView: nil].x;
q = p;
if (p > maxVisCoord || p < minVisCoord)
{
outside = YES;
}
else
{
outside = NO;
}
if (p < minCoord)
{
p = minCoord;
}
else if (p > maxCoord)
{
p = maxCoord;
}
r.origin.x = p - (divWidth / 2.);
if (!outside && NSEqualRects(r, oldRect) == NO)
{
if (lit == YES)
{
NSHighlightRect (oldRect);
}
NSHighlightRect (r);
[_window flushWindow];
lit = YES;
oldRect = r;
}
}
else
{
if (outside)
{
q = [self convertPoint: unconverted
fromView: nil].x;
if (lit)
{
NSHighlightRect(oldHighlightRect);
NSHighlightRect (oldRect);
[_window flushWindow];
lit = NO;
}
NSHighlightRect(highlightRect);
[_window flushWindow];
lit = YES;
oldHighlightRect = highlightRect;
tvRect = [_tableView visibleRect];
if (q > maxVisCoord)
{
if (q > maxAbsCoord + 5)
q = maxAbsCoord + 5;
tvRect.origin.x += (q - maxVisCoord)/2;
}
else if (q < minVisCoord)
{
if (q < minAbsCoord - 5)
q = minAbsCoord - 5;
tvRect.origin.x += (q - minVisCoord)/2;
}
else // TODO remove this condition
{
NSLog(@"not outside !");
}
[_tableView scrollPoint: tvRect.origin];
rect = [self visibleRect];
minVisCoord = NSMinX (rect) + divWidth;
maxVisCoord = NSMaxX (rect) - divWidth;
minCoord = MAX (minAbsCoord, minVisCoord);
maxCoord = MIN (maxAbsCoord, maxVisCoord);
}
}
/* Scroll the tableview, if needed, so the user's desired new
column edge position lies at the edge of the visible part of
the table */
if ((p > maxVisCoord && newColumnMaxX > maxVisCoord)
|| (p < minVisCoord && newColumnMaxX < minVisCoord))
{
NSRect tvRect = [_tableView visibleRect];
if (!liveResize && lit)
{
NSHighlightRect(oldHighlightRect);
lit = NO;
[_window flushWindow];
}
if (p > maxVisCoord) /* resizing to the right */
tvRect.origin.x = newColumnMaxX - tvRect.size.width;
else /* resizing to the left */
tvRect.origin.x = newColumnMaxX;
[_tableView scrollPoint: tvRect.origin];
}
e = [NSApp nextEventMatchingMask: eventMask
untilDate: [NSDate distantFuture]
untilDate: farAway
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
}
[NSEvent stopPeriodicEvents];
if (!liveResize)
if (outside)
{
if (lit)
{
NSHighlightRect(oldHighlightRect);
[_window flushWindow];
}
[self unlockFocus];
/* The following tiles the table. We use a private method
which avoids tiling the table twice. */
if ([column width] != newColumnWidth)
{
[_tableView _userResizedTableColumn: _resizedColumn
width: newColumnWidth];
}
p = [self convertPoint: [e locationInWindow] fromView: nil].x;
if (p > maxAbsCoord)
p = maxAbsCoord;
else if (p < minAbsCoord)
p = minAbsCoord;
}
if (lit == YES)
{
NSHighlightRect(oldRect);
[_window flushWindow];
}
[self unlockFocus];
/* The following tiles the table. We use a private method
which avoids tiling the table twice. */
if (dragged == YES)
{
[_tableView _userResizedTableColumn: _resizedColumn
width: (p - NSMinX (rectLow))];
}
/* Clean up */
@ -547,8 +575,7 @@
NSRect highlightRect = NSZeroRect, oldRect = NSZeroRect;
BOOL outside = NO;
BOOL lit = NO;
BOOL liveResize = ![[NSUserDefaults standardUserDefaults] boolForKey: @"GSUseGhostResize"];
BOOL mouseDragged = NO;
float p;
NSPoint unconverted;
@ -572,11 +599,8 @@
highlightRect.size.height = NSHeight (visibleRect);
highlightRect.origin.y = NSMinY (visibleRect);
if (!liveResize)
{
[self lockFocus];
[[NSColor lightGrayColor] set];
}
[self lockFocus];
[[NSColor lightGrayColor] set];
[NSEvent startPeriodicEventsAfterDelay: 0.05
withPeriod: 0.05];
e = [NSApp nextEventMatchingMask: eventMask
@ -614,93 +638,76 @@
while (p < (_cO[i] + _cO[i-1]) / 2)
i--;
}
if (!liveResize)
{
if (i != columnIndex
&& i != columnIndex + 1)
if (i != columnIndex
&& i != columnIndex + 1)
{
j = i;
highlightRect.size.height = NSHeight (visibleRect);
highlightRect.origin.y = NSMinY (visibleRect);
highlightRect.size.width = 7;
if (i == numberOfColumns)
{
j = i;
highlightRect.size.height = NSHeight (visibleRect);
highlightRect.origin.y = NSMinY (visibleRect);
highlightRect.size.width = 7;
if (i == numberOfColumns)
{
highlightRect.origin.x = _cO[i] - 3;
}
else if (i == 0)
{
highlightRect.origin.x = _cO[i] - 3;
}
else
{
highlightRect.origin.x = _cO[i] - 3;
}
if (!NSEqualRects(highlightRect, oldRect))
{
if (lit)
NSHighlightRect(oldRect);
NSHighlightRect(highlightRect);
[_window flushWindow];
}
else if (!lit)
{
NSHighlightRect(highlightRect);
[_window flushWindow];
}
oldRect = highlightRect;
lit = YES;
highlightRect.origin.x = _cO[i] - 3;
}
else if (i == 0)
{
highlightRect.origin.x = _cO[i] - 3;
}
else
{
i = columnIndex;
highlightRect.size.height = NSHeight (visibleRect);
highlightRect.origin.y = NSMinY (visibleRect);
highlightRect.origin.x = _cO[columnIndex];
highlightRect.size.width =
_cO[columnIndex + 1] - _cO[columnIndex];
if (!NSEqualRects(highlightRect, oldRect))
{
if (lit)
NSHighlightRect(oldRect);
// NSHighlightRect(highlightRect);
[_window flushWindow];
}
else if (!lit)
{
// NSHighlightRect(highlightRect);
// [_window flushWindow];
}
// oldRect = highlightRect;
oldRect = NSZeroRect;
lit = NO; //lit = YES;
highlightRect.origin.x = _cO[i] - 3;
}
}
else if (liveResize)
{
if (i > columnIndex)
i--;
if (i != columnIndex)
{
[_tableView moveColumn: columnIndex
toColumn: i];
}
columnIndex = i;
}
if (!NSEqualRects(highlightRect, oldRect))
{
if (lit)
NSHighlightRect(oldRect);
NSHighlightRect(highlightRect);
[_window flushWindow];
}
else if (!lit)
{
NSHighlightRect(highlightRect);
[_window flushWindow];
}
oldRect = highlightRect;
lit = YES;
}
else
{
i = columnIndex;
highlightRect.size.height = NSHeight (visibleRect);
highlightRect.origin.y = NSMinY (visibleRect);
highlightRect.origin.x = _cO[columnIndex];
highlightRect.size.width =
_cO[columnIndex + 1] - _cO[columnIndex];
if (!NSEqualRects(highlightRect, oldRect))
{
if (lit)
NSHighlightRect(oldRect);
// NSHighlightRect(highlightRect);
[_window flushWindow];
}
else if (!lit)
{
// NSHighlightRect(highlightRect);
// [_window flushWindow];
}
// oldRect = highlightRect;
oldRect = NSZeroRect;
lit = NO; //lit = YES;
}
}
break;
case NSPeriodic:
if (outside == YES)
{
if (!liveResize)
if (lit)
{
if (lit)
{
NSHighlightRect(oldRect);
[_window flushWindow];
lit = NO;
oldRect = NSZeroRect;
}
NSHighlightRect(oldRect);
[_window flushWindow];
lit = NO;
oldRect = NSZeroRect;
}
p = [self convertPoint: unconverted
fromView: nil].x;
@ -737,20 +744,17 @@
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
}
if (!liveResize)
if (lit)
{
if (lit)
{
NSHighlightRect(highlightRect);
[_window flushWindow];
lit = NO;
}
[self unlockFocus];
NSHighlightRect(highlightRect);
[_window flushWindow];
lit = NO;
}
[NSEvent stopPeriodicEvents];
[NSEvent stopPeriodicEvents];
[self unlockFocus];
if (mouseDragged == NO)
{
[_tableView _selectColumn: columnIndex

View file

@ -5950,7 +5950,7 @@ static BOOL selectContiguousRegion(NSTableView *self,
}
-(BOOL) _editNextEditableCellAfterRow: (int)row
column: (int)column
column: (int)column
{
int i, j;
@ -5958,130 +5958,61 @@ static BOOL selectContiguousRegion(NSTableView *self,
{
// First look for cells in the same row
for (j = column + 1; j < _numberOfColumns; j++)
{
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
}
}
{
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
}
}
}
// Otherwise, make the big cycle.
for (i = row + 1; i < _numberOfRows; i++)
{
// Need to select row to be able to edit it.
[self selectRow: i byExtendingSelection: NO];
for (j = 0; j < _numberOfColumns; j++)
{
if ([self _isCellEditableColumn: j row: i])
{
// Need to select row to be able to edit it.
[self selectRow: i byExtendingSelection: NO];
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
}
}
{
if ([self _isCellEditableColumn: j row: i])
{
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
}
}
}
// Should we loop around or not?
#if 0
// Nothing found? Search in the rows before the current
for (i = 0; i < row; i++)
{
for (j = 0; j < _numberOfColumns; j++)
{
if ([self _isCellEditableColumn: j row: i])
{
// Need to select row to be able to edit it.
[self selectRow: i byExtendingSelection: NO];
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
}
}
}
// Still nothing? Look at the beginning of the current row
if (row > -1)
{
// First look for cells in the same row
for (j = 0; j < column; j++)
{
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
}
}
}
#endif
return NO;
}
-(BOOL) _editPreviousEditableCellBeforeRow: (int)row
column: (int)column
{
int i, j;
if (row > -1)
int i,j;
if (row < _numberOfColumns)
{
// First look for cells in the same row
for (j = column - 1; j > -1; j--)
{
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
}
}
{
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
}
}
}
// Otherwise, make the big cycle.
for (i = row - 1; i > -1; i--)
{
// Need to select row to be able to edit it.
[self selectRow: i byExtendingSelection: NO];
for (j = _numberOfColumns - 1; j > -1; j--)
{
if ([self _isCellEditableColumn: j row: i])
{
// Need to select row to be able to edit it.
[self selectRow: i byExtendingSelection: NO];
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
}
}
{
if ([self _isCellEditableColumn: j row: i])
{
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
}
}
}
// Should we loop around or not?
#if 0
// Nothing found? Search in the rows after the current
for (i = _numberOfRows - 1; i > row; i--)
{
for (j = _numberOfColumns - 1; j > -1; j--)
{
if ([self _isCellEditableColumn: j row: i])
{
// Need to select row to be able to edit it.
[self selectRow: i byExtendingSelection: NO];
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
}
}
}
// Still nothing? Look at the end of the current row
if (row > -1)
{
// First look for cells in the same row
for (j = _numberOfColumns - 1; j > column; j++)
{
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
}
}
}
#endif
return NO;
}

View file

@ -473,11 +473,7 @@ framework intact.
}
// decoding the manager adds this text container automatically...
if ([aDecoder containsValueForKey: @"NSLayoutManager"])
{
_layoutManager = [aDecoder decodeObjectForKey: @"NSLayoutManager"];
}
[aDecoder decodeObjectForKey: @"NSLayoutManager"];
[self setTextView: view];
return self;
}

View file

@ -27,7 +27,6 @@
#include <Foundation/NSNotification.h>
#include <Foundation/NSException.h>
#include <Foundation/NSDebug.h>
#include <Foundation/NSPortCoder.h>
#include "AppKit/NSAttributedString.h"
#include "AppKit/NSTextStorage.h"
#include "GNUstepGUI/GSLayoutManager.h"
@ -35,8 +34,8 @@
@implementation NSTextStorage
static Class abstract;
static Class concrete;
static Class abstract;
static Class concrete;
static NSNotificationCenter *nc = nil;
@ -60,8 +59,12 @@ static NSNotificationCenter *nc = nil;
- (void) dealloc
{
[self setDelegate: nil];
RELEASE (_layoutManagers);
if (_delegate != nil)
{
[nc removeObserver: _delegate name: nil object: self];
_delegate = nil;
}
[super dealloc];
}
@ -334,41 +337,33 @@ static NSNotificationCenter *nc = nil;
[self fixAttributesInRange: range];
}
- (Class) classForCoder
{
return abstract;
}
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
{
return self;
}
- (id) initWithCoder: (NSCoder*)aDecoder
{
self = [super initWithCoder: aDecoder];
if ([aDecoder allowsKeyedCoding])
{
id delegate = [aDecoder decodeObjectForKey: @"NSDelegate"];
NSString *string = [aDecoder decodeObjectForKey: @"NSString"];
self = [self initWithString: string];
[self setDelegate: delegate];
}
else
{
}
self = [super initWithCoder: aDecoder];
}
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
[super encodeWithCoder: coder];
if ([coder allowsKeyedCoding])
{
[coder encodeObject: [self delegate] forKey: @"NSDelegate"];
[coder encodeObject: [self string] forKey: @"NSString"];
}
else
{
[super encodeWithCoder: coder];
}
}

View file

@ -785,7 +785,6 @@ that makes decoding and encoding compatible with the old code.
self = [super initWithCoder: aDecoder];
if ([aDecoder allowsKeyedCoding])
{
id textString = nil;
if ([aDecoder containsValueForKey: @"NSDelegate"])
{
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
@ -845,40 +844,30 @@ that makes decoding and encoding compatible with the old code.
_tf.is_vertically_resizable = YES;
}
// Get the text container to retrieve the text which was previously archived
// so that it can be inserted into the current textview.
// currently not used....
if ([aDecoder containsValueForKey: @"NSTextStorage"])
{
_textStorage = [aDecoder decodeObjectForKey: @"NSTextStorage"];
}
// currently not used....
if ([aDecoder containsValueForKey: @"NSTextContainer"])
{
NSTextContainer *container = [aDecoder decodeObjectForKey: @"NSTextContainer"];
GSLayoutManager *lm = [container layoutManager];
textString = [lm textStorage];
[self setRichText: YES];
{
NSSize size = NSMakeSize(0,_maxSize.height);
NSTextContainer *aTextContainer = [self buildUpTextNetwork: NSZeroSize];
[aTextContainer setTextView: (NSTextView *)self];
/* See initWithFrame: for comments on this RELEASE */
RELEASE(self);
[aTextContainer setContainerSize: size];
[aTextContainer setWidthTracksTextView: YES];
[aTextContainer setHeightTracksTextView: NO];
}
// set up the text network...
{
NSSize size = NSMakeSize(0,_maxSize.height);
NSTextContainer *aTextContainer = [self buildUpTextNetwork: NSZeroSize];
[aTextContainer setTextView: self];
// See initWithFrame: for comments on this RELEASE
RELEASE(self);
[aTextContainer setContainerSize: size];
[aTextContainer setWidthTracksTextView: YES];
[aTextContainer setHeightTracksTextView: NO];
}
if ([aDecoder containsValueForKey: @"NSTVFlags"])
{
[aDecoder decodeIntForKey: @"NSTVFlags"];
}
// Don't add the string if it's nil
if(textString != nil)
{
[self insertText: textString];
}
}
else
{
@ -1036,14 +1025,7 @@ to this method from the text container or layout manager.
/* Any of these three might be nil. */
_textContainer = container;
_layoutManager = (NSLayoutManager *)[container layoutManager];
if (_tf.owns_text_network)
{
ASSIGN(_textStorage, [_layoutManager textStorage]);
}
else
{
_textStorage = [_layoutManager textStorage];
}
_textStorage = [_layoutManager textStorage];
/* Search for an existing text view attached to this layout manager. */
tcs = [_layoutManager textContainers];

View file

@ -87,8 +87,8 @@ static const int InsetItemViewY = 26;
static const int InsetItemTextX = 3;
static const int InsetItemTextY = 4;
// See NSToolbarItem -initialize method
static NSFont *NormalFont = nil;
static NSFont *NormalFont = nil; // See NSToolbarItem -initialize method
// [NSFont smallSystemFontSize] or better should be NSControlContentFontSize
static NSFont *SmallFont = nil;
NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
@ -99,6 +99,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
@interface GSToolbarButton : NSButton
{
NSToolbarItem *_toolbarItem;
SEL _toolbarItemAction;
}
- (id) initWithToolbarItem: (NSToolbarItem *)toolbarItem;
@ -106,6 +107,8 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
// Accessors
- (NSToolbarItem *) toolbarItem;
- (SEL) toolbarItemAction;
- (void) setToolbarItemAction: (SEL)action;
@end
@interface GSToolbarButtonCell : NSButtonCell
@ -119,7 +122,6 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
// ---
@implementation GSToolbarButton
+ (Class) cellClass
{
return [GSToolbarButtonCell class];
@ -127,9 +129,9 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (id) initWithToolbarItem: (NSToolbarItem *)toolbarItem
{
// Frame will be reset by the layout method
self = [super initWithFrame: NSMakeRect(ItemBackViewX, ItemBackViewY,
ItemBackViewDefaultWidth, ItemBackViewDefaultHeight)];
// Frame will be reset by the layout method
if (self != nil)
{
@ -142,27 +144,27 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
[self setImagePosition: NSImageAbove];
[self setHighlightsBy:
NSChangeGrayCellMask | NSChangeBackgroundCellMask];
[self setFont: NormalFont];
[self setFont: [NSFont systemFontOfSize: 11]];
/* [NSFont smallSystemFontSize] or better should be
controlContentFontSize. */
}
return self;
}
/*
* The code below should be kept in sync with GSToolbarBackView methods which
* have identical names.
*/
- (void) layout
{
float textWidth, layoutedWidth = -1, layoutedHeight = -1;
NSAttributedString *attrStr;
NSDictionary *attr;
NSFont *font;
unsigned int borderMask = [[[_toolbarItem toolbar] _toolbarView] borderMask];
NSSize labelSize = NSZeroSize;
font = NormalFont;
NSString *label = [_toolbarItem label];
// Adjust the layout in accordance with NSToolbarSizeMode
font = NormalFont;
switch ([[_toolbarItem toolbar] sizeMode])
{
case NSToolbarSizeModeDefault:
@ -178,20 +180,21 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
case NSToolbarSizeModeSmall:
layoutedWidth = ItemBackViewSmallWidth;
layoutedHeight = ItemBackViewSmallHeight;
[[_toolbarItem image] setSize: NSMakeSize(24, 24)];
/* Not use [self image] here because it can return nil, when image
position is set to NSNoImage. Even if NSToolbarDisplayModeTextOnly
is not true anymore -setImagePosition: is only called below, then
[self image] can still returns nil. */
[[_toolbarItem image] setSize: NSMakeSize(24, 24)];
font = SmallFont;
break;
default:
NSLog(@"Invalid NSToolbarSizeMode"); // Invalid
; // Invalid
}
[self setFont: font];
// Adjust the layout in accordance with the border
if (!(borderMask & GSToolbarViewBottomBorder))
{
layoutedHeight++;
@ -205,25 +208,19 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
// Adjust the layout in accordance with the label
{
NSAttributedString *attrStr;
NSDictionary *attr;
NSString *label = [_toolbarItem label];
attr = [NSDictionary dictionaryWithObject: font forKey: NSFontAttributeName];
if (label == nil || [label isEqualToString: @""])
label = @"Dummy";
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
labelSize = [attrStr size];
DESTROY(attrStr);
}
attr = [NSDictionary dictionaryWithObject: font forKey: NSFontAttributeName];
if (label == nil || [label isEqualToString: @""])
label = @"Dummy";
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
textWidth = labelSize.width + 2 * InsetItemTextX;
textWidth = [attrStr size].width + 2 * InsetItemTextX;
if ([[_toolbarItem toolbar] displayMode] != NSToolbarDisplayModeIconOnly
&& layoutedWidth != -1 && textWidth > layoutedWidth)
layoutedWidth = textWidth;
// Adjust the layout in accordance with NSToolbarDisplayMode
switch ([[_toolbarItem toolbar] displayMode])
{
case NSToolbarDisplayModeDefault:
@ -234,20 +231,28 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
break;
case NSToolbarDisplayModeIconOnly:
[self setImagePosition: NSImageOnly];
layoutedHeight -= labelSize.height + InsetItemTextY;
layoutedHeight -= [attrStr size].height + InsetItemTextY;
break;
case NSToolbarDisplayModeLabelOnly:
[self setImagePosition: NSNoImage];
layoutedHeight = labelSize.height + InsetItemTextY * 2;
layoutedHeight = [attrStr size].height + InsetItemTextY * 2;
break;
default:
; // Invalid
}
DESTROY(attrStr);
// Set the frame size to use the new layout
[self setFrameSize: NSMakeSize(layoutedWidth, layoutedHeight)];
}
/*
* The code below should be kept in sync with GSToolbarBackView methods which
* have identical names.
*/
- (void) mouseDown: (NSEvent *)event
{
NSToolbar *toolbar = [_toolbarItem toolbar];
@ -264,11 +269,12 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
// Prepare the drag
RETAIN(self);
/* We need to keep this view (aka self) to be able to draw the drag
image. */
RETAIN(self);
// Draw the drag content in an image
/* The code below is only partially supported by GNUstep, then NSImage
needs to be improved. */
[image lockFocus];
@ -282,7 +288,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
[pboard declareTypes: [NSArray arrayWithObject: GSMovableToolbarItemPboardType]
owner: nil];
if (toolbar != nil)
{
{
index = [toolbar _indexOfItem: _toolbarItem];
}
[pboard setString: [NSString stringWithFormat:@"%d", index]
@ -305,12 +311,14 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) draggedImage: (NSImage *)dragImage beganAt: (NSPoint)location
{
/* We retain the toolbar item to be able to have have it reinsered later by
the dragging destination. */
NSToolbar *toolbar = [_toolbarItem toolbar];
// FIXME: Where is this released?
RETAIN(_toolbarItem);
/* We retain the toolbar item to be able to have have it reinsered later by
the dragging destination. */
[[_toolbarItem toolbar] _performRemoveItem: _toolbarItem];
[toolbar _performRemoveItem: _toolbarItem];
}
- (void) draggedImage: (NSImage *)dragImage
@ -325,11 +333,6 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
return isLocal ? NSDragOperationGeneric : NSDragOperationNone;
}
- (NSToolbarItem *) toolbarItem
{
return _toolbarItem;
}
/*
* End of the code to keep in sync
*/
@ -342,10 +345,9 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
setSelectedItemIdentifier: [_toolbarItem itemIdentifier]];
}
if (action)
if (_toolbarItemAction)
{
// Send from toolbar item not self
return [NSApp sendAction: action
return [NSApp sendAction: _toolbarItemAction
to: target
from: _toolbarItem];
}
@ -355,6 +357,22 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
}
- (NSToolbarItem *) toolbarItem
{
return _toolbarItem;
}
// FIXME: Why use this and not the action of the cell?
- (void) setToolbarItemAction: (SEL)action
{
_toolbarItemAction = action;
}
- (SEL) toolbarItemAction
{
return _toolbarItemAction;
}
@end
@implementation GSToolbarButtonCell
@ -378,12 +396,6 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
}
/* Allways return the image, even when no image gets displayed. */
- (NSImage*) image
{
return _cell_image;
}
// Overriden NSButtonCell method to make sure all text is at the same height.
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
@ -478,37 +490,18 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
NSFont *_font;
BOOL _enabled;
BOOL _showLabel;
// record the fact that the view responds to these
// to save time.
struct __flags
{
// gets
unsigned int _isEnabled:1;
unsigned int _action:1;
unsigned int _target:1;
unsigned int _image:1;
// sets
unsigned int _setEnabled:1;
unsigned int _setAction:1;
unsigned int _setTarget:1;
unsigned int _setImage:1;
// to even out the int.
unsigned int RESERVED:24;
} _flags;
}
- (id) initWithToolbarItem: (NSToolbarItem *)toolbarItem;
- (void) layout;
- (NSToolbarItem *) toolbarItem;
- (void) layout;
- (BOOL) isEnabled;
- (void) setEnabled: (BOOL)enabled;
@end
@implementation GSToolbarBackView
- (id) initWithToolbarItem: (NSToolbarItem *)toolbarItem
- (id)initWithToolbarItem: (NSToolbarItem *)toolbarItem
{
self = [super initWithFrame: NSMakeRect(ItemBackViewX, ItemBackViewY,
ItemBackViewDefaultWidth, ItemBackViewDefaultHeight)];
@ -516,22 +509,8 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
if (self != nil)
{
NSView *view;
// Don't do an ASSIGN here, the toolbar item itself retains us.
_toolbarItem = toolbarItem;
view = [toolbarItem view];
// gets
_flags._isEnabled = [view respondsToSelector: @selector(isEnabled)];
_flags._action = [view respondsToSelector: @selector(action)];
_flags._target = [view respondsToSelector: @selector(target)];
_flags._image = [view respondsToSelector: @selector(image)];
// sets
_flags._setEnabled = [view respondsToSelector: @selector(setEnabled:)];
_flags._setAction = [view respondsToSelector: @selector(setAction:)];
_flags._setTarget = [view respondsToSelector: @selector(setTarget:)];
_flags._setImage = [view respondsToSelector: @selector(setImage:)];
}
return self;
@ -579,44 +558,23 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
}
- (NSView *) hitTest: (NSPoint)point
{
if (_super_view && [_super_view mouse: point inRect: _frame])
{
NSEvent *event = [NSApp currentEvent];
NSToolbar *toolbar = [_toolbarItem toolbar];
if (([event type] == NSLeftMouseDown)
&& (([event modifierFlags] == NSCommandKeyMask
&& [toolbar allowsUserCustomization])
|| [toolbar customizationPaletteIsRunning] || toolbar == nil))
{
return self;
}
}
return [super hitTest: point];
}
/*
* The code below should be kept in sync with GSToolbarButton methods which
* have identical names.
*/
- (void) layout
{
NSView *view = [_toolbarItem view];
float insetItemViewY;
float textWidth, layoutedWidth = -1, layoutedHeight = -1;
NSFont *font;
NSAttributedString *attrStr;
NSDictionary *attr;
unsigned int borderMask = [[[_toolbarItem toolbar] _toolbarView] borderMask];
NSSize labelSize = NSZeroSize;
NSString *label = [_toolbarItem label];
font = NormalFont;
_font = NormalFont;
if ([view superview] == nil) // Show the view to eventually hide it later
[self addSubview: view];
// Adjust the layout in accordance with NSToolbarSizeMode
switch ([[_toolbarItem toolbar] sizeMode])
{
case NSToolbarSizeModeDefault:
@ -634,7 +592,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
case NSToolbarSizeModeSmall:
layoutedWidth = ItemBackViewSmallWidth;
layoutedHeight = ItemBackViewSmallHeight;
font = SmallFont;
_font = SmallFont;
if ([view frame].size.height > 24)
[view removeFromSuperview];
break;
@ -642,9 +600,8 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
NSLog(@"Invalid NSToolbarSizeMode"); // Invalid
}
_font = font;
// Adjust the layout in accordance with the border
if (!(borderMask & GSToolbarViewBottomBorder))
{
layoutedHeight++;
@ -658,29 +615,23 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
// Adjust the layout in accordance with the label
{
NSAttributedString *attrStr;
NSDictionary *attr;
NSString *label = [_toolbarItem label];
attr = [NSDictionary dictionaryWithObject: font forKey: NSFontAttributeName];
if (label == nil || [label isEqualToString: @""])
label = @"Dummy";
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
labelSize = [attrStr size];
DESTROY(attrStr);
}
textWidth = labelSize.width + 2 * InsetItemTextX;
attr = [NSDictionary dictionaryWithObject: _font forKey: NSFontAttributeName];
if (label == nil || [label isEqualToString: @""])
label = @"Dummy";
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
textWidth = [attrStr size].width + 2 * InsetItemTextX;
if (textWidth > layoutedWidth)
layoutedWidth = textWidth;
// Adjust the layout in accordance with NSToolbarDisplayMode
_enabled = YES;
_showLabel = YES;
/* This boolean variable is used to known when it's needed to draw the label
in the -drawRect: method. */
_showLabel = YES;
// Adjust the layout in accordance with NSToolbarDisplayMode
switch ([[_toolbarItem toolbar] displayMode])
{
case NSToolbarDisplayModeDefault:
@ -689,11 +640,11 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
break; // Nothing to do
case NSToolbarDisplayModeIconOnly:
_showLabel = NO;
layoutedHeight -= labelSize.height + InsetItemTextY;
layoutedHeight -= [attrStr size].height + InsetItemTextY;
break;
case NSToolbarDisplayModeLabelOnly:
_enabled = NO;
layoutedHeight = labelSize.height + InsetItemTextY * 2;
layoutedHeight = [attrStr size].height + InsetItemTextY * 2;
if ([view superview] != nil)
[view removeFromSuperview];
break;
@ -704,6 +655,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
/* If the view is visible...
Adjust the layout in accordance with the view width in the case it is
needed. */
if ([view superview] != nil)
{
if (layoutedWidth < [view frame].size.width + 2 * InsetItemViewX)
@ -711,25 +663,54 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
// Set the frame size to use the new layout
[self setFrameSize: NSMakeSize(layoutedWidth, layoutedHeight)];
/* If the view is visible...
Adjust the view position in accordance with the new layout. */
if ([view superview] != nil)
{
float insetItemViewY = ([self frame].size.height
- [view frame].size.height) / 2;
if (_showLabel)
{
insetItemViewY += (labelSize.height + InsetItemTextY) / 2;
insetItemViewY = ([self frame].size.height - [view frame].size.height
- [attrStr size].height - InsetItemTextX) / 2
+ [attrStr size].height + InsetItemTextX;
}
else
{
insetItemViewY = ([self frame].size.height
- [view frame].size.height) / 2;
}
[view setFrameOrigin: NSMakePoint((layoutedWidth
- [view frame].size.width) / 2, insetItemViewY)];
}
}
DESTROY(attrStr);
}
- (NSView *) hitTest: (NSPoint)point
{
NSEvent *event = [NSApp currentEvent];
if ([self mouse: point inRect: [self frame]]
&& [event modifierFlags] == NSCommandKeyMask
&& [event type] == NSLeftMouseDown)
{
return self;
}
else
{
return [super hitTest: point];
}
}
/*
* The code below should be kept in sync with GSToolbarButton methods which
* have identical names.
*/
- (void) mouseDown: (NSEvent *)event
{
NSToolbar *toolbar = [_toolbarItem toolbar];
@ -745,11 +726,12 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
// Prepare the drag
RETAIN(self);
/* We need to keep this view (aka self) to be able to draw the drag
image. */
RETAIN(self);
// Draw the drag content in an image
/* The code below is only partially supported by GNUstep, then NSImage
needs to be improved. */
[image lockFocus];
@ -761,15 +743,14 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
[pboard declareTypes: [NSArray arrayWithObject: GSMovableToolbarItemPboardType]
owner: nil];
if (toolbar != nil)
{
{
index = [toolbar _indexOfItem: _toolbarItem];
}
[pboard setString: [NSString stringWithFormat:@"%d", index]
forType: GSMovableToolbarItemPboardType];
[self dragImage: image
//at: NSMakePoint(0.0, viewSize.height)
at: NSMakePoint(0.0, 0.0)
at: NSMakePoint(0.0, viewSize.height)
offset: NSMakeSize(0.0, 0.0)
event: event
pasteboard: pboard
@ -785,12 +766,14 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) draggedImage: (NSImage *)dragImage beganAt: (NSPoint)location
{
/* We retain the toolbar item to be able to have have it reinsered later by
the dragging destination. */
NSToolbar *toolbar = [_toolbarItem toolbar];
// FIXME: Where is this released?
RETAIN(_toolbarItem);
/* We retain the toolbar item to be able to have have it reinsered later by
the dragging destination. */
[[_toolbarItem toolbar] _performRemoveItem: _toolbarItem];
[toolbar _performRemoveItem: _toolbarItem];
}
- (void) draggedImage: (NSImage *)dragImage
@ -805,113 +788,36 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
return isLocal ? NSDragOperationGeneric : NSDragOperationNone;
}
- (NSToolbarItem *) toolbarItem
{
return _toolbarItem;
}
/*
* End of the code to keep in sync
*/
- (NSToolbarItem *)toolbarItem
{
return _toolbarItem;
}
- (BOOL) isEnabled
{
if (_flags._isEnabled)
id view = [_toolbarItem view];
if ([view respondsToSelector: @selector(isEnabled)])
{
id view = [_toolbarItem view];
return [view isEnabled];
}
else
{
return _enabled;
}
return _enabled;
}
- (void) setEnabled: (BOOL)enabled
{
if (_flags._setEnabled)
id view = [_toolbarItem view];
_enabled = enabled;
if ([view respondsToSelector: @selector(setEnabled:)])
{
id view = [_toolbarItem view];
[view setEnabled: enabled];
}
else
{
_enabled = enabled;
}
}
- (NSImage *) image
{
if (_flags._image)
{
id view = [_toolbarItem view];
return [view image];
}
else
{
return nil;
}
}
- (void) setImage: (NSImage *)image
{
if (_flags._setImage)
{
id view = [_toolbarItem view];
[view setImage: image];
}
}
- (void) setAction: (SEL)action
{
if (_flags._setAction)
{
id view = [_toolbarItem view];
[view setAction: action];
}
}
- (SEL) action
{
if (_flags._action)
{
id view = [_toolbarItem view];
return [view action];
}
else
{
return 0;
}
}
- (void) setTarget: (id)target
{
if (_flags._setTarget)
{
id view = [_toolbarItem view];
[view setTarget: target];
}
}
- (id) target
{
if (_flags._target)
{
id view = [_toolbarItem view];
return [view target];
}
else
{
return nil;
}
}
@end
@ -978,10 +884,9 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
return self;
}
// Override the default implementation in order to do nothing
- (NSMenuItem *) _defaultMenuFormRepresentation
{
return nil;
return nil; // Override the default implementation in order to do nothing
}
@end
@ -1003,28 +908,23 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
return self;
}
// Override the default implementation in order to do nothing
- (NSMenuItem *) _defaultMenuFormRepresentation
{
return nil;
return nil; // Override the default implementation in order to do nothing
}
// Override the default implementation in order to reset the _backView to a zero width
- (void) _layout
{
NSView *backView = [self _backView];
NSSize size;
[(id)backView layout];
size = [backView frame].size;
/* If the item is not part of a toolbar, this usually means it is used by
customization palette, we shouldn't resize it in this case. */
if ([self toolbar] != nil)
[backView setFrameSize: NSMakeSize(0, size.height)];
[backView setFrameSize: NSMakeSize(0, [backView frame].size.height)];
[self setMinSize: NSMakeSize(0, size.height)];
[self setMaxSize: NSMakeSize(10000, size.height)];
// Override the default implementation in order to reset the _backView to a zero width
}
- (BOOL) _isFlexibleSpace
@ -1131,10 +1031,10 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
+ (void) initialize
{
// This used to be size 11.
NormalFont = RETAIN([NSFont systemFontOfSize: [NSFont systemFontSize]]);
NormalFont = RETAIN([NSFont systemFontOfSize: 11]);
// [NSFont smallSystemFontSize] or better should be NSControlContentFontSize
SmallFont = RETAIN([NSFont systemFontOfSize: [NSFont smallSystemFontSize]]);
SmallFont = RETAIN([NSFont systemFontOfSize: 9]);
}
- (id) initWithItemIdentifier: (NSString *)itemIdentifier
@ -1198,12 +1098,16 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
if ((self = [super init]) != nil)
{
// Normal toolbar items
ASSIGN(_itemIdentifier, itemIdentifier);
[self setAutovalidates: YES];
// Set the backview to an GSToolbarButton, will get reset to a
// GSToolbarBackView when setView: gets called.
[self setView: nil];
RELEASE(_backView);
_backView = [[GSToolbarButton alloc] initWithToolbarItem: self];
[self _computeFlags];
}
}
@ -1231,12 +1135,26 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (BOOL) isEnabled
{
return [(GSToolbarButton*)_backView isEnabled];
if (_flags._isEnabled)
{
if (_view)
return [_view isEnabled];
else
return [(GSToolbarButton*)_backView isEnabled];
}
return NO;
}
- (NSImage *) image
- (NSImage *)image
{
// return [(GSToolbarButton*)_backView image];
if (_flags._image)
{
if (_view)
return [_view image];
else
return [(GSToolbarButton*)_backView image];
}
return _image;
}
@ -1281,14 +1199,33 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) setAction: (SEL)action
{
[(GSToolbarButton *)_backView setAction: action];
if (_flags._setAction)
{
if (_view)
[_view setAction: action];
else
[(GSToolbarButton *)_backView setToolbarItemAction: action];
[self setEnabled: (action != NULL)];
if (action != NULL)
{
[self setEnabled: YES];
}
else
{
[self setEnabled: NO];
}
}
}
- (void) setEnabled: (BOOL)enabled
{
[(GSToolbarButton*)_backView setEnabled: enabled];
if (_flags._setEnabled)
{
if (_view)
[_view setEnabled: enabled];
else
[(GSToolbarButton*)_backView setEnabled: enabled];
}
}
- (void) setImage: (NSImage *)image
@ -1298,14 +1235,20 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
[_image setScalesWhenResized: YES];
//[_image setSize: NSMakeSize(32, 32)];
[(GSToolbarButton*)_backView setImage: image];
if (_flags._setImage)
{
if (_view)
[_view setImage: image];
else
[(GSToolbarButton*)_backView setImage: image];
}
}
- (void) setLabel: (NSString *)label
{
ASSIGN(_label, label);
if (!_view)
if ([_backView isKindOfClass: [GSToolbarButton class]])
[(GSToolbarButton *)_backView setTitle: _label];
_modified = YES;
@ -1340,7 +1283,13 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) setTarget: (id)target
{
[(NSButton *)_backView setTarget: target];
if (_flags._setTarget)
{
if (_view)
[_view setTarget: target];
else
[(NSButton *)_backView setTarget: target];
}
}
- (void) setToolTip: (NSString *)toolTip
@ -1351,19 +1300,13 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) setView: (NSView *)view
{
if ((_view == view) && (_backView != nil))
if (_view == view)
return;
ASSIGN(_view, view);
if (view)
{
NSSize size;
size = [view frame].size;
[self setMinSize: size];
[self setMaxSize: size];
[_view setToolTip: _toolTip];
RELEASE(_backView);
@ -1374,6 +1317,42 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
RELEASE(_backView);
_backView = [[GSToolbarButton alloc] initWithToolbarItem: self];
}
[self _computeFlags];
}
- (void) _computeFlags
{
if (_view == nil)
{
// gets
_flags._isEnabled = [_backView respondsToSelector: @selector(isEnabled)];
_flags._action =
[_backView respondsToSelector: @selector(toolbarItemAction)];
_flags._target = [_backView respondsToSelector: @selector(target)];
_flags._image = NO;
// sets
_flags._setEnabled =
[_backView respondsToSelector: @selector(setEnabled:)];
_flags._setAction =
[_backView respondsToSelector: @selector(setToolbarItemAction:)];
_flags._setTarget =
[_backView respondsToSelector: @selector(setTarget:)];
_flags._setImage = [_backView respondsToSelector: @selector(setImage:)];
}
else
{
// gets
_flags._isEnabled = [_view respondsToSelector: @selector(isEnabled)];
_flags._action = [_view respondsToSelector: @selector(action)];
_flags._target = [_view respondsToSelector: @selector(target)];
_flags._image = [_view respondsToSelector: @selector(image)];
// sets
_flags._setEnabled = [_view respondsToSelector: @selector(setEnabled:)];
_flags._setAction = [_view respondsToSelector: @selector(setAction:)];
_flags._setTarget = [_view respondsToSelector: @selector(setTarget:)];
_flags._setImage = [_view respondsToSelector: @selector(setImage:)];
}
}
- (NSInteger) tag
@ -1472,7 +1451,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (BOOL) _isFlexibleSpace
{
return (_minSize.width != _maxSize.width);
return NO;
}
- (BOOL) _selectable
@ -1540,12 +1519,27 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
// NSValidatedUserInterfaceItem protocol
- (SEL) action
{
return [(GSToolbarButton *)_backView action];
if (_flags._action)
{
if (_view)
return [_view action];
else
return [(GSToolbarButton *)_backView toolbarItemAction];
}
return 0;
}
- (id) target
{
return [(GSToolbarButton *)_backView target];
if (_flags._target)
{
if (_view)
return [_view target];
else
return [(GSToolbarButton *)_backView target];
}
return nil;
}
// NSCopying protocol

View file

@ -200,12 +200,6 @@ static id shared = nil;
- (void) dealloc
{
if (self == shared)
{
// Should never get here
shared = nil;
}
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(_values);
RELEASE(_defaults);
@ -302,7 +296,7 @@ static id shared = nil;
- (void) encodeWithCoder: (NSCoder *)aCoder
{
if ([aCoder allowsKeyedCoding])
if (self == shared)
if (self == [NSUserDefaultsController sharedUserDefaultsController])
{
[aCoder encodeBool: YES forKey: @"NSSharedInstance"];
return;
@ -317,7 +311,7 @@ static id shared = nil;
if ([aDecoder decodeBoolForKey: @"NSSharedInstance"])
{
RELEASE(self);
return RETAIN([NSUserDefaultsController sharedUserDefaultsController]);
return [NSUserDefaultsController sharedUserDefaultsController];
}
return [super initWithCoder: aDecoder];

View file

@ -548,8 +548,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
//_is_rotated_from_base = NO;
//_is_rotated_or_scaled_from_base = NO;
_rFlags.needs_display = YES;
_post_bounds_changes = YES;
_post_frame_changes = YES;
//_post_frame_changes = NO;
_autoresizes_subviews = YES;
_autoresizingMask = NSViewNotSizable;
//_coordinates_valid = NO;
@ -1784,19 +1783,11 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
return new;
}
/**
* Sets whether the receiver should post NSViewFrameDidChangeNotification
* when its frame changed.
*/
- (void) setPostsFrameChangedNotifications: (BOOL)flag
{
_post_frame_changes = flag;
}
/**
* Sets whether the receiver should post NSViewBoundsDidChangeNotification
* when its bound changed.
*/
- (void) setPostsBoundsChangedNotifications: (BOOL)flag
{
_post_bounds_changes = flag;
@ -2685,8 +2676,7 @@ in the main thread.
[firstOpaque setNeedsDisplayInRect: invalidRect];
}
}
/*
/*
* Must make sure that superviews know that we need display.
* NB. we may have been marked as needing display and then moved to another
* parent, so we can't assume that our parent is marked simply because we are.
@ -2696,8 +2686,6 @@ in the main thread.
currentView->_rFlags.needs_display = YES;
currentView = currentView->_super_view;
}
// Also mark the window, as this may not happen above
[_window setViewsNeedDisplay: YES];
}
/**
@ -4471,8 +4459,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
_is_rotated_from_base = NO;
_is_rotated_or_scaled_from_base = NO;
_rFlags.needs_display = YES;
_post_bounds_changes = YES;
_post_frame_changes = YES;
_post_frame_changes = NO;
_autoresizes_subviews = YES;
_autoresizingMask = NSViewNotSizable;
_coordinates_valid = NO;
@ -4550,21 +4537,21 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
_super_view = nil;
_window = nil;
_rFlags.needs_display = YES;
_coordinates_valid = NO;
_rFlags.flipped_view = [self isFlipped];
[aDecoder decodeValueOfObjCType: @encode(BOOL)
at: &_is_rotated_from_base];
[aDecoder decodeValueOfObjCType: @encode(BOOL)
at: &_is_rotated_or_scaled_from_base];
_post_bounds_changes = YES;
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_post_frame_changes];
[aDecoder decodeValueOfObjCType: @encode(BOOL)
at: &_autoresizes_subviews];
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
at: &_autoresizingMask];
_coordinates_valid = NO;
[self setNextKeyView: [aDecoder decodeObject]];
[[aDecoder decodeObject] setNextKeyView: self];
_rFlags.flipped_view = [self isFlipped];
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
@ -4693,23 +4680,11 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
return 0.0;
}
/**
* Returns whether the receiver posts NSViewFrameDidChangeNotification when
* its frame changed.
*
* Returns YES by default (as documented in Cocoa View Programming Guide).
*/
- (BOOL) postsFrameChangedNotifications
{
return _post_frame_changes;
}
/**
* Returns whether the receiver posts NSViewBoundsDidChangeNotification when
* its bound changed.
*
* Returns YES by default (as documented in Cocoa View Programming Guide).
*/
- (BOOL) postsBoundsChangedNotifications
{
return _post_bounds_changes;

View file

@ -985,8 +985,7 @@ many times.
/* Initialize attributes and flags */
[super init];
[self _initDefaults];
_attachedSheet = nil;
_backingType = bufferingType;
_styleMask = aStyle;
if (aScreen == nil)
@ -5102,7 +5101,7 @@ current key view.<br />
- (NSWindow *) attachedSheet
{
return _attachedSheet;
return nil;
}
@end

View file

@ -2136,29 +2136,10 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
NSDictionary *typeInfo = [extInfo objectForKey: appName];
NSString *file = [typeInfo objectForKey: @"NSIcon"];
//
// If the NSIcon entry isn't there and the CFBundle entries are,
// get the first icon in the list if it's an array, or assign
// the icon to file if it's a string.
//
// FIXME: CFBundleTypeExtensions/IconFile can be arrays which assign
// multiple types to icons. This needs to be handled eventually.
//
if(file == nil)
{
id icon = [typeInfo objectForKey: @"CFBundleTypeIconFile"];
if([icon isKindOfClass: [NSArray class]])
{
if([icon count])
{
file = [icon objectAtIndex: 0];
}
}
else
{
file = icon;
}
file = [typeInfo objectForKey: @"CFBundleTypeIconFile"];
}
if (file && [file length] != 0)

View file

@ -626,7 +626,6 @@ NSString *NSValueTransformerNameBindingOption = @"NSValueTransformerName";
NSString *NSValueTransformerBindingOption = @"NSValueTransformer";
NSString *NSAlignmentBinding = @"alignment";
NSString *NSContentObjectBinding = @"contentObject";
NSString *NSEditableBinding = @"editable";
NSString *NSEnabledBinding = @"enabled";
NSString *NSFontBinding = @"font";

View file

@ -28,7 +28,7 @@ include ../config.make
include ../Version
SUBPROJECTS = $(BUILD_GSND) $(BUILD_SPEECH)
SUBPROJECTS = $(BUILD_GSND)
TOOL_NAME = make_services set_show_service gopen gclose gcloseall
SERVICE_NAME = GSspell

View file

@ -1,24 +0,0 @@
ETOILE_CORE_MODULE = YES
include $(GNUSTEP_MAKEFILES)/common.make
GSSPEECHENGINE = Flite
VERSION = 0.1
TOOL_NAME = say
say_LANGUAGES = English
say_OBJC_FILES = \
say.m
# Add include/lib dirs for currently built headers and libs.
say_INCLUDE_DIRS += -I../../Headers -I../../Headers/Additions
say_LIB_DIRS += -L../../Source/$(GNUSTEP_OBJ_DIR) \
-L/usr/local/lib
say_OBJCFLAGS += -std=c99 -g -Werror
say_LDFLAGS += -lgnustep-gui
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/tool.make

View file

@ -1,62 +0,0 @@
#import <AppKit/AppKit.h>
#include <unistd.h>
#include <getopt.h>
@interface SpeechDelegate : NSObject @end
@implementation SpeechDelegate
- (void)speechSynthesizer: (NSSpeechSynthesizer*)sender
didFinishSpeaking: (BOOL)success
{
exit((int)success);
}
@end
int main(int argc, char **argv)
{
[NSAutoreleasePool new];
NSMutableString *words = [NSMutableString string];
NSString *outFile = nil;
NSString *voice = nil;
NSString *inFile = nil;
int ch;
while ((ch = getopt(argc, argv, "o:v:f:")) != -1)
{
switch (ch)
{
case 'o':
outFile = [NSString stringWithUTF8String: optarg];
break;
case 'f':
inFile = [NSString stringWithUTF8String: optarg];
break;
case 'v':
voice = [NSString stringWithUTF8String: optarg];
break;
}
}
int i;
for (i=optind ; i<argc ; i++)
{
[words appendString: [NSString stringWithUTF8String: argv[i]]];
[words appendString: @" "];
}
NSSpeechSynthesizer *say = [[NSSpeechSynthesizer alloc] initWithVoice: voice];
if (nil != inFile)
{
[words release];
NSData *file = [NSData dataWithContentsOfFile: inFile];
words = [NSString stringWithCString: [file bytes]];
}
// Don't interrupt other apps.
while ([NSSpeechSynthesizer isAnyApplicationSpeaking])
{
[NSThread sleepForTimeInterval: 0.1];
}
[say setDelegate: [SpeechDelegate new]];
[say startSpeakingString: words];
[[NSRunLoop currentRunLoop] run];
// Not reached.
return 0;
}

View file

@ -1,121 +0,0 @@
#import "GSSpeechEngine.h"
#include <flite/flite.h>
cst_voice *register_cmu_us_kal();
/**
* Implementation of a speech engine using flite. This should be the default
* for resource-constrained platforms.
*/
@interface FliteSpeechEngine : GSSpeechEngine {
/** The audio device used for sound output. */
cst_audiodev *ad;
/** The current voice. Only one supported at the moment. */
cst_voice *v;
/** Flag set to tell the playback thread to exit. */
volatile BOOL shouldEndSpeaking;
/** Flag indicating whether the engine is currently speaking. */
volatile BOOL isSpeaking;
}
@end
@implementation FliteSpeechEngine
+ (void)initialize
{
flite_init();
}
- (id)init
{
if (nil == (self = [super init])) { return nil; }
// Only one voice supported by flite unless others are compiled in.
v = register_cmu_us_kal();
if (NULL == v)
{
[self release];
return nil;
}
// Each wave should be the same format.
cst_wave *w = flite_text_to_wave("test", v);
ad = audio_open(w->sample_rate, w->num_channels, CST_AUDIO_LINEAR16);
delete_wave(w);
if (NULL == ad)
{
[self release];
return nil;
}
return self;
}
- (void)sayString: (NSArray*)args
{
id pool = [NSAutoreleasePool new];
NSString *aString = [args objectAtIndex: 0];
int i,n,r;
int num_shorts;
BOOL didFinish = YES;
cst_wave *w = flite_text_to_wave([aString UTF8String], v);
num_shorts = w->num_samples * w->num_channels;
for (i=0; i < num_shorts; i += r/2)
{
if (num_shorts > i+CST_AUDIOBUFFSIZE)
{
n = CST_AUDIOBUFFSIZE;
}
else
{
n = num_shorts-i;
}
r = audio_write(ad, &w->samples[i], n*2);
if (shouldEndSpeaking)
{
didFinish = NO;
break;
}
}
isSpeaking = NO;
NS_DURING
[[args objectAtIndex: 1] didFinishSpeaking: didFinish];
NS_HANDLER
NS_ENDHANDLER
[args release];
[pool release];
delete_wave(w);
}
- (void)startSpeaking: (NSString*)aString notifyWhenDone: (id)aDelegate
{
[[[aDelegate delegate] connectionForProxy] enableMultipleThreads];
NSArray *arg = [[NSArray alloc] initWithObjects: aString, aDelegate, nil];
shouldEndSpeaking = NO;
isSpeaking = YES;
[NSThread detachNewThreadSelector: @selector(sayString:)
toTarget: self
withObject: arg];
}
- (BOOL)isSpeaking
{
return isSpeaking;
}
- (void)stopSpeaking
{
shouldEndSpeaking = YES;
// Spin until the other thread has died.
while (isSpeaking) {}
}
- (void)dealloc
{
[self stopSpeaking];
audio_close(ad);
[super dealloc];
}
@end
@implementation GSSpeechEngine (Flite)
+ (GSSpeechEngine*)defaultSpeechEngine
{
return [[[FliteSpeechEngine alloc] init] autorelease];
}
@end

View file

@ -1,33 +0,0 @@
ETOILE_CORE_MODULE = YES
include $(GNUSTEP_MAKEFILES)/common.make
# Set the default. Eventually this should be conditional.
GSSPEECHENGINE = Flite
VERSION = 0.1
# This is an app not a tool because, eventually, it will present the user
# interface for the GUI part of the speech engine.
APP_NAME = GSSpeechServer
GSSpeechServer_LANGUAGES = English
GSSpeechServer_OBJC_FILES = \
GSSpeechEngine.m \
GSSpeechServer.m \
GSSpeechSynthesizer.m \
main.m
ifeq ($(GSSPEECHENGINE), Flite)
GSSpeechServer_OBJC_FILES += FliteSpeechEngine.m
GSSpeechServer_INCLUDE_DIRS += -I/usr/local/include/flite -I../../Headers \
-I../../Headers/Additions
GSSpeechServer_LIB_DIRS += -L../../Source/$(GNUSTEP_OBJ_DIR) \
-L/usr/local/lib -lgnustep-gui -lflite_cmu_us_kal \
-lflite_usenglish -lflite_cmulex -lflite
endif
GSSpeechServer_OBJCFLAGS = -std=c99 -g -Werror
include $(GNUSTEP_MAKEFILES)/application.make

View file

@ -1,50 +0,0 @@
#import <Foundation/Foundation.h>
/**
* GSSpeechEngine is an abstract speech server. One concrete subclass should
* be implemented for each speech engine. Currently, only one may be compiled
* in to the speech server at any given time. This limitation may be removed
* in future if pluggable speech engines are considered beneficial.
*/
@interface GSSpeechEngine : NSObject
/**
* Returns a new instance of the default speech engine.
*/
+ (GSSpeechEngine*)defaultSpeechEngine;
/**
* Begin speaking the specified string.
*/
- (void)startSpeaking: (NSString*)aString notifyWhenDone: (id)aDelegate;
/**
* Stop speaking.
*/
- (void)stopSpeaking;
/**
* Returns YES if the engine is currently outputting speech.
*/
- (BOOL)isSpeaking;
/**
* Returns an array of voices supported by this speech synthesizer.
*/
- (NSArray*)voices;
/**
* Sets the voice.
*/
- (void)setVoice: (NSString*)aVoice;
/**
* Returns the current voice.
*/
- (NSString*)voice;
/**
* Returns the name of the default voice for this speech engine.
*/
- (NSString*)defaultVoice;
@end
@interface NSObject (GSSpeechEngineDelegate)
/**
* Called when the speech engine has finished speaking a phrase. Should be
* used to notify the original caller.
*/
- (void)didFinishSpeaking: (BOOL)didFinish;
@end

View file

@ -1,15 +0,0 @@
#import "GSSpeechEngine.h"
/**
* Dummy implementation of a speech engine. Doesn't do anything.
*/
@implementation GSSpeechEngine
+ (GSSpeechEngine*)defaultSpeechEngine { return [[self new] autorelease]; }
- (void)startSpeaking: (NSString*)aString notifyWhenDone: (id)anObject{}
- (void)stopSpeaking {}
- (BOOL)isSpeaking { return NO; }
- (NSArray*)voices { return [NSArray arrayWithObject: @"default"]; }
- (void)setVoice: (NSString*)aVoice {}
- (NSString*)voice { return @"default"; }
- (NSString*)defaultVoice { return @"default"; }
@end

View file

@ -1,44 +0,0 @@
#import <Foundation/Foundation.h>
@class GSSpeechEngine;
/**
* GSSpeechServer handles all of the engine-agnostic operations. Currently,
* there aren't any, but when the on-screen text interface is added it should
* go in here.
*/
@interface GSSpeechServer : NSObject {
GSSpeechEngine *engine;
}
/**
* Returns a shared instance of the speech server.
*/
+ (id)sharedServer;
/**
* Begins speaking the string specified by the first argument. Calls the
* delegate method on the client when done.
*/
- (BOOL)startSpeakingString: (NSString*)aString notifyWhenDone: (id)client;
/**
* Stop speaking.
*/
- (void)stopSpeaking;
/**
* Returns YES if the engine is currently outputting speech.
*/
- (BOOL)isSpeaking;
/**
* Returns an array of voices supported by this speech synthesizer.
*/
- (NSArray*)voices;
/**
* Sets the voice.
*/
- (void)setVoice: (NSString*)aVoice;
/**
* Returns the current voice.
*/
- (NSString*)voice;
/**
* Returns the name of the default voice.
*/
- (NSString*)defaultVoice;
@end

View file

@ -1,72 +0,0 @@
#import "GSSpeechServer.h"
#import "GSSpeechEngine.h"
#import "GSSpeechSynthesizer.h"
#import <Foundation/Foundation.h>
static GSSpeechServer *sharedInstance;
@implementation GSSpeechServer
+ (void)initialize
{
sharedInstance = [self new];
}
+ (void)start
{
NSConnection *connection = [NSConnection defaultConnection];
[connection setRootObject: sharedInstance];
if (NO == [connection registerName: @"GSSpeechServer"])
{
return;
}
[[NSRunLoop currentRunLoop] run];
}
+ (id)sharedServer
{
return sharedInstance;
}
- (id)init
{
if (nil == (self = [super init])) { return nil; }
engine = [GSSpeechEngine defaultSpeechEngine];
if (nil == engine)
{
[self release];
return nil;
}
return self;
}
- (id)newSynthesizer
{
return [[GSSpeechSynthesizer new] autorelease];
}
- (BOOL)startSpeakingString: (NSString*)aString notifyWhenDone: (id)client
{
[engine stopSpeaking];
[engine startSpeaking: aString notifyWhenDone: client];
return YES;
}
- (void)stopSpeaking
{
[engine stopSpeaking];
}
- (BOOL)isSpeaking
{
return [engine isSpeaking];
}
- (NSArray*)voices
{
return [engine voices];
}
- (oneway void)setVoice: (NSString*)aVoice
{
[engine setVoice: aVoice];
}
- (NSString*)voice
{
return [engine voice];
}
- (NSString*)defaultVoice
{
return [engine defaultVoice];
}
@end

View file

@ -1,17 +0,0 @@
#import "GSSpeechServer.h"
#import <AppKit/NSSpeechSynthesizer.h>
@interface GSSpeechSynthesizer : NSSpeechSynthesizer {
NSString *currentVoice;
id delegate;
}
- (id)initWithVoice: (NSString*)aVoice;
- (id)init;
- (NSString*)voice;
- (id)delegate;
- (void)setDelegate: (id)aDelegate;
- (void)setVoice: (NSString*)aVoice;
- (BOOL)startSpeakingString: (NSString*)aString;
- (void)stopSpeaking;
@end

View file

@ -1,125 +0,0 @@
#import "GSSpeechSynthesizer.h"
static GSSpeechServer *server;
static int clients;
@interface GSSpeechSynthesizer (Private)
+ (void)connectionDied: (NSNotification*)aNotification;
@end
@implementation GSSpeechSynthesizer
+ (void)initialize
{
server = [[GSSpeechServer sharedServer] retain];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(connectionDied:)
name: NSConnectionDidDieNotification
object: nil];
}
/**
* If the remote end exits before freeing the GSSpeechSynthesizer then we need
* to send it a -release message to make sure it dies.
*/
+ (void)connectionDied: (NSNotification*)aNotification
{
NSEnumerator *e = [[[aNotification object] localObjects] objectEnumerator];
for (NSObject *o = [e nextObject] ; nil != o ; o = [e nextObject])
{
if ([o isKindOfClass: self])
{
[o release];
}
}
}
/**
* If no clients have been active for some time, kill the speech server to
* conserve resources.
*/
- (void)exitIfUnneeded: (NSTimer*)sender
{
if (clients == 0)
{
exit(0);
}
}
- (id)initWithVoice: (NSString*)aVoice
{
clients++;
if (nil == (self = [super init])) { return nil; }
[self setVoice: currentVoice];
return self;
}
- (id)init
{
return [self initWithVoice: nil];
}
- (NSString*)voice
{
return currentVoice;
}
- (id)delegate
{
return delegate;
}
- (void)setDelegate: (id)aDelegate
{
// Either -retain or -release can throw an exception due to DO.
NS_DURING
aDelegate = [aDelegate retain];
NS_HANDLER
NS_ENDHANDLER
NS_DURING
[delegate release];
NS_HANDLER
NS_ENDHANDLER
delegate = aDelegate;
}
- (void)setVoice: (NSString*)aVoice
{
if (nil == aVoice)
{
aVoice = [server defaultVoice];
}
ASSIGN(currentVoice, aVoice);
}
- (BOOL)startSpeakingString: (NSString*)aString
{
[server setVoice: currentVoice];
return [server startSpeakingString: aString notifyWhenDone: self];
}
- (void)didFinishSpeaking: (BOOL)didFinish
{
// Throw the delegate away if it is throwing exceptions during
// notification.
NS_DURING
[delegate speechSynthesizer: self didFinishSpeaking: didFinish];
NS_HANDLER
NS_DURING
id d = delegate;
delegate = nil;
[d release];
NS_HANDLER
NS_ENDHANDLER
NS_ENDHANDLER
}
- (void)stopSpeaking
{
[server stopSpeaking];
}
- (void)dealloc
{
clients--;
[currentVoice release];
if (clients == 0)
{
[NSTimer scheduledTimerWithTimeInterval: 600
target: isa
selector: @selector(exitIfUnneeded:)
userInfo: nil
repeats: NO];
}
[super dealloc];
}
@end

View file

@ -1,12 +0,0 @@
#import <Foundation/Foundation.h>
@interface GSSpeechServer
+ (void)start;
@end
int main(void)
{
[NSAutoreleasePool new];
[GSSpeechServer start];
return 0;
}

View file

@ -10,10 +10,10 @@ GNUSTEP_GUI_LIBTIFF=3.4
# The version number of this release.
GNUSTEP_GUI_MAJOR_VERSION=0
GNUSTEP_GUI_MINOR_VERSION=17
GNUSTEP_GUI_SUBMINOR_VERSION=1
GNUSTEP_GUI_MINOR_VERSION=16
GNUSTEP_GUI_SUBMINOR_VERSION=0
# numeric value should match above
VERSION_NUMBER=017.0
VERSION_NUMBER=016.0
GNUSTEP_GUI_VERSION=${GNUSTEP_GUI_MAJOR_VERSION}.${GNUSTEP_GUI_MINOR_VERSION}.${GNUSTEP_GUI_SUBMINOR_VERSION}
VERSION=${GNUSTEP_GUI_VERSION}

View file

@ -7,7 +7,6 @@ ADDITIONAL_LIB_DIRS += @ADDITIONAL_LIB_DIRS@
ADDITIONAL_DEPENDS = @LIBS@
BUILD_GSND=@BUILD_GSND@
BUILD_SPEECH=@BUILD_SPEECH@
GSCUPS_CFLAGS = @GSCUPS_CFLAGS@
GSCUPS_LDFLAGS = @GSCUPS_LDFLAGS@

233
configure vendored
View file

@ -674,7 +674,6 @@ CPP
GREP
EGREP
BUILD_GSND
BUILD_SPEECH
have_cups
GSCUPS_CFLAGS
GSCUPS_LDFLAGS
@ -1284,7 +1283,6 @@ Optional Features:
--enable-libgif Enable libgif-based GIF support
--disable-aspell Disable aspell for spellchecker
--disable-gsnd Disable gsnd server
--disable-speech Disable speech server
--disable-cups Disable cups printing support
Optional Packages:
@ -5406,7 +5404,7 @@ if test "$ac_res" != no; then
ac_cv_func_getmntent=yes
cat >>confdefs.h <<\_ACEOF
#define HAVE_GETMNTENT 1
#define HAVE_GETMNTENT
_ACEOF
else
@ -7281,232 +7279,6 @@ if test $have_portaudio19 = yes -a $have_portaudio = yes -a $enable_gsnd = yes;
fi
#--------------------------------------------------------------------
# NSSpeechSynthesizer
#--------------------------------------------------------------------
# Check whether --enable-speech was given.
if test "${enable_speech+set}" = set; then
enableval=$enable_speech;
else
enable_speech=yes
fi
BUILD_SPEECH=
# has flite, for speech synthesis.
{ echo "$as_me:$LINENO: checking for new_utterance in -lflite" >&5
echo $ECHO_N "checking for new_utterance in -lflite... $ECHO_C" >&6; }
if test "${ac_cv_lib_flite_new_utterance+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lflite $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char new_utterance ();
int
main ()
{
return new_utterance ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_flite_new_utterance=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_flite_new_utterance=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_flite_new_utterance" >&5
echo "${ECHO_T}$ac_cv_lib_flite_new_utterance" >&6; }
if test $ac_cv_lib_flite_new_utterance = yes; then
have_speech=yes
else
have_speech=no
fi
for ac_header in flite/flite.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
;;
esac
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
if test $have_speech = yes -a $enable_speech = yes; then
BUILD_SPEECH="speech say"
fi
#--------------------------------------------------------------------
# Find CUPS
#--------------------------------------------------------------------
@ -8517,7 +8289,6 @@ CPP!$CPP$ac_delim
GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
BUILD_GSND!$BUILD_GSND$ac_delim
BUILD_SPEECH!$BUILD_SPEECH$ac_delim
have_cups!$have_cups$ac_delim
GSCUPS_CFLAGS!$GSCUPS_CFLAGS$ac_delim
GSCUPS_LDFLAGS!$GSCUPS_LDFLAGS$ac_delim
@ -8535,7 +8306,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View file

@ -380,23 +380,6 @@ if test $have_portaudio19 = yes -a $have_portaudio = yes -a $enable_gsnd = yes;
fi
AC_SUBST(BUILD_GSND)
#--------------------------------------------------------------------
# NSSpeechSynthesizer
#--------------------------------------------------------------------
AC_ARG_ENABLE(speech,
[ --disable-speech Disable speech server],,
enable_speech=yes)
BUILD_SPEECH=
# has flite, for speech synthesis.
AC_CHECK_LIB(flite, new_utterance, have_speech=yes, have_speech=no)
AC_CHECK_HEADERS(flite/flite.h)
if test $have_speech = yes -a $enable_speech = yes; then
BUILD_SPEECH="speech say"
fi
AC_SUBST(BUILD_SPEECH)
#--------------------------------------------------------------------
# Find CUPS
#--------------------------------------------------------------------