Merge from 0.6.5

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6040 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2000-02-19 00:40:47 +00:00
parent 6b5e33078b
commit f34100ac45
42 changed files with 2343 additions and 1170 deletions

View file

@ -1,7 +1,7 @@
ANNOUNCE ANNOUNCE
******** ********
This is version 0.6.0 of the GNUstep GUI library (`gnustep-gui'). This is version 0.6.5 of the GNUstep GUI library (`gnustep-gui').
What is the GNUstep GUI Library? What is the GNUstep GUI Library?
================================ ================================
@ -31,11 +31,74 @@ component like the GNUstep X/DPS GUI Backend.
What's new in this release? What's new in this release?
=========================== ===========================
The currently released version of the library is `0.6.0'. The currently released version of the library is `0.6.5'.
Noteworthy changes in version `0.6.5'
=====================================
Many of the basic GUI classes have been vastly improved or
rewritten, thanks to Nicola Pero <n.pero@mi.flashnet.it> and many
others.
* New Info Panel support
* New NSBezierPath
* Rewrite of several classes including Cell and Button classes.
* Rewrite of NSBrowser, NSSavePanel, menus, text classes,
NSTableHeader.
* RTF Parser
* Implemented image caching.
* Implemented editing in Forms, Matricies.
* New autolayout classes GSHBox, GSTable, and GSVBox.
* Almost all back-end classes have been removed and code incorporated
in a DPS-like graphics context structure.
* Better keyboard handling.
* NSHelpManager, NSComboBox, ProgressIndicator written.
In addition a preliminary version of an Interface Builder (Gorm) has
been written, thanks to Richard Frith-Macdonald
<richard@brainstorm.co.uk>
Noteworthy changes in version `0.6.0' Noteworthy changes in version `0.6.0'
===================================== =====================================
A Huge amount of progress, although a lot still needs to be done.
It's usable for a large base of moderately simple apps. Several
NeXT/OpenStep apps and libraries have been ported with little changes.
* Drag and Drop support fleshed out but not completed.
* NSText and related classes rewritten. Basic functionality but much
needs to be done to finish them off.
* nib2gmodel app works with MacOS-X
* Work done in minimizing the backend which allowed a lot of
functionality to move to the GNU library.
* Menu code rewritten.
* PopupButtons now work.
* Many new images
* Basic functionality for NSTabView
* Much better lockFocus support in NSView. Flipped views handled.
* Rewrite of NSSavePanel and NSOpenPanel
* Several fixes that at least double the speed of the gui.
Noteworthy changes in version `0.5.5' Noteworthy changes in version `0.5.5'
===================================== =====================================
@ -44,6 +107,7 @@ Noteworthy changes in version `0.5.5'
* A lot of rewritting has been done to the classes, with general * A lot of rewritting has been done to the classes, with general
cleanup of coordinate conversion code, etc. cleanup of coordinate conversion code, etc.
Noteworthy changes in version `0.5.0' Noteworthy changes in version `0.5.0'
===================================== =====================================
@ -93,6 +157,7 @@ Noteworthy changes in version `0.5.0'
* Several cleanups and as usual, many bug fixes. * Several cleanups and as usual, many bug fixes.
How can I get support for this software? How can I get support for this software?
======================================== ========================================
@ -105,7 +170,7 @@ the GNUstep Web Pages for more information regarding GNUstep resources
Where can you get it? How can you compile it? Where can you get it? How can you compile it?
============================================== ==============================================
The gstep-gui-0.6.0.tar.gz distribution file has been placed on The gstep-gui-0.6.5.tar.gz distribution file has been placed on
`ftp.gnustep.org' in `pub/gnustep/core'. `ftp.gnustep.org' in `pub/gnustep/core'.
The program requires gcc 2.8.0 or higher. The program requires gcc 2.8.0 or higher.
@ -115,7 +180,7 @@ library version 3.4 may be required depending on the backend you choose.
It also requires a FoundationKit library as specified by the OpenStep It also requires a FoundationKit library as specified by the OpenStep
specification. The FoundationKit libraries known to work are the specification. The FoundationKit libraries known to work are the
GNUstep Base Library version `0.6.0'. GNUstep Base Library version `0.6.5'.
The `.tar' file is compressed with GNU gzip. Gzip can be obtained by The `.tar' file is compressed with GNU gzip. Gzip can be obtained by
anonymous ftp at any of the GNU archive sites. anonymous ftp at any of the GNU archive sites.
@ -132,13 +197,10 @@ Where do I send bug reports?
Bug reports can be sent to <bug-gnustep@gnu.org>. Bug reports can be sent to <bug-gnustep@gnu.org>.
Creators rejoice!
Scott Christley
<scottc@net-community.com>
Obtaining GNU Software Obtaining GNU Software
====================== ======================
Check out the GNU web site. (`http://www.gnu.org/') Check out the GNU web site. (`http://www.gnu.org/')
Check out the GNUstep web site. (`http://www.gnustep.org/') Check out the GNUstep web site. (`http://www.gnustep.org/')

93
BUGS Normal file
View file

@ -0,0 +1,93 @@
TODO
****
Bugs in the GUI library
=======================
Windows
-------
* Code to manage window decorations is not finished. The reported
frame origin of a window might be wrong.
* Windows never get released. Setting isReleasedWhenClosed does not
work.
Fixing these bugs requires touching delicate parts of the library.
This is why fixing them has been postponed after 0.6.5, to keep
0.6.5 reasonably stable.
Texts
-----
* The NSText code is particularly complex to work on and it has not
improved much since 0.6.0. Many bugs are know in the code - it is
somewhat usable though. We hope on a big improvement of this area
for next release.
Matrices
--------
* Encoding/Decoding of matrices is unimplemented. There are some
minor known bugs with handling of mouse down in matrices.
Cells
-----
* Since NSText does only left alignment, when you select or edit text
in a cell it becomes automatically left aligned regardless of the
original alignment.
* Multi line texts are unsupported; isScrollable, wordWraps etc do
nothing. This restriction will hopefully be removed in next
releases.
Images anf Graphics
-------------------
* There are problems with alpha composing. To avoid these problems,
you may set manually the background color of your image when
displaying it.
* Only TIFF images are supported in 0.6.5. Support at least for PNG
and JPEG images is planned for next release.
* alpha drawing and compositing of graphics doesn't work.
Alert, Info Panels
------------------
* Multi line messages are generally unsupported due to the similar
restriction in the cells code.
Unimplemented Classes
---------------------
The following classes are currently unimplemented or unfinished to
such a degree to be unusable.
* NSColorPanel
* NSDataLink
* NSFontManager
* NSFontPanel
* NSHelpPanel
* NSLayoutManager
* NSPageLayout
* NSPrintPanel
* NSSecureTextField
* NSSpellChecker
* NSTableView
* NSTextView

297
ChangeLog
View file

@ -1,8 +1,3 @@
Wed Feb 09 18:50:12 2000 Enrico Sersale <enrico@imago.ro>
* Source/NSBezierPath.m Headers/gnustep/gui/NSBezierPath.h :
Rewritten conforming to MacOS-X implementation details.
Tue Jan 25 14:52:27 2000 Nicola Pero <n.pero@mi.flashnet.it> Tue Jan 25 14:52:27 2000 Nicola Pero <n.pero@mi.flashnet.it>
Contributed by Fred Kiefer: Contributed by Fred Kiefer:
@ -11,6 +6,284 @@ Tue Jan 25 14:52:27 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Headers/AppKit/NSFontManager.h: Corresponding rewrite. * Headers/AppKit/NSFontManager.h: Corresponding rewrite.
* Headers/AppKit/NSFontPanel.h: Idem. * Headers/AppKit/NSFontPanel.h: Idem.
2000-02-17 Adam Fedor <fedor@gnu.org>
* Version: 0.6.5 released.
2000-02-16 Adam Fedor <fedor@gnu.org>
* gnustep-gui.spec: Newfile
2000-02-15 Adam Fedor <fedor@gnu.org>
* configure.in: Fix test for rintf
2000-02-14 Adam Fedor <fedor@gnu.org>
* Version: Update version number
* Documentation/announce.tmpl.texi: Update
* Documentation/readme.tmpl.texi: Likewise.
* Documentation/news.tmpl.texi: Likewise.
* Documentation/todo.tmpl.texi: Likewise.
* ANNOUNCE, BUGS, NEWS, README: Regenerate
Mon Feb 14 13:23:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSLayoutManager.m: Tidied and simplified by removing
inefficient scanner class and using NSScanner instead.
* Source/NSText.m: ditto.
* Source/NSTextView.m: fix a couple of bugs that were causing crash in
text network demo - lets the demo run a while longer before crashing.
2000-02-13 Adam Fedor <fedor@gnu.org>
* Source/NSAffineTransform (-transformBezierPath:): Implement.
(from Enrico Sersale <enrico@imago.ro>).
Mon Feb 14 00:59:33 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSApplication.m ([-orderFrontStandardAboutPanel:]): Fixed
typo/bug. Reported by Fred Kiefer <FredKiefer@gmx.de>
Sun Feb 13 22:24:54 2000 Nicola Pero <n.pero@mi.flashnet.it>
This fixes a bug; the same bug that produced those little white
vertical lines at the bottom of windows with editable textfields
when windows were ordered out then in after editing.
* Source/NSView.m ([-removeFromSuperviewWithoutNeedingDisplay]),
([-removeFromSuperview]): Ask the window to take first responder
status in our place if we are. Important: this is done *before*
any other action is undertaken, because changing first responder
invokes -resignFirstResponder:, which should be allowed to assume
that the view is normally placed in the view hierarchy.
Sun Feb 13 19:20:00 2000 Enrico Sersale <enrico@imago.ro>
* Source/NSBezierPath.m: ([-copyWithZone:]) implemented.
Sat Feb 12 21:16:00 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSBrowser.m ([-loadColumnZero]), ([-reloadColumn:]):
Adjust frame of column after loading it.
Sat Feb 12 20:27:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSView.m: ([setNeedsDisplayInRect:]) change to ensure that
superviews are always marked as needing display when we are.
* Source/NSPopUpButton.m: ([-encodeWithCoder:]) ([-initWithCoder:])
implemented for Gorm.
Sat Feb 12 19:47:14 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSPopUpButton.m ([-selectItem:]): Bug fix: Update menu
knowledge of the selected item. ([-selectItemWithTitle:]),
([-selectItemAtIndex:]), ([-selectItem:]): Bug fix: Invoke
synchronizeTitleAndSelectedItem to update what is displayed.
Sat Feb 12 18:11:32 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSWindow.m ([-setContentView:]): When expanding the new
content view to cover the whole window, do it using the nice way,
resizeWithOldSuperviewSize:, which allows the view to reorganize
its subviews for the new size.
Sat Feb 12 17:53:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSMenu.m: Replace non-working archiving code with
drastically simplified code that does work in the normal case, but
doesn't deal with non-standard menu representations. This lets
Gorm work with menus.
* Source/NSMenuItem.m: Don't archive parent menu.
Fri Feb 11 20:18:10 2000 Enrico Sersale <enrico@imago.ro>
* Source/NSBezierPath.m: ([-transformUsingAffineTransform:]) implement.
2000-02-09 Adam Fedor <fedor@gnu.org>
* Documentation/announce.tmpl.texi: Update.
* Documentation/news.tmpl.texi: Likewise.
* Documentation/readme.tmpl.texi: Likewise.
Thu Feb 10 00:56:08 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSText.m ([-keyDown:]): Implemented NSDeleteFunctionKey,
which was unimplemented - problem reported by Jory van Zessen.
Simple superficial improvements to make NSText just a little
faster:
* Source/NSText.m: Changed everywhere [self selectedRange] simply
to selected_range. ([-moveCursorUp:]), ([-moveCursorLeft:]):
Return at once if cursor is already at the beginning of text.
([-moveCursorDown:]), ([-moveCursorRight:]): Return at once if
cursor is already at the end of text.
Wed Feb 09 18:59:02 2000 Enrico Sersale <enrico@imago.ro>
* Source/NSBezierPath.m Headers/gnustep/gui/NSBezierPath.h :
Rewritten conforming to MacOS-X implementation details.
Tue Feb 8 17:22:05 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Model/GMAppKit.m ([NSMenuItem -initWithModelUnarchiver:]): Fix
for having GNUstep load gmodels created from OPENSTEP NIBs.
NSMenu internals are slightly different in GNUstep and OPENSTEP;
OPENSTEP stores an item submenu as the item target, while GNUstep
stores it in a special mi_submenu ivar. This patch, for GNUstep
only, sets the submenu ivar from the target for items which have a
submenu.
2000-02-07 Adam Fedor <fedor@gnu.org>
* configure.in: Add check for rintf.
* Source/NSBrowser.m: Use rint i no rintf.
* Source/NSApplication.m: Convert NSDebugLog to NSDebugLLog for
various NSEvent debugs.
* Source/NSMenuItemCell.m ([NSMenuItemCell -calcSize]): Make
sure anImage exists before getting size (methods with nil receivers
returning structs segfaults on Solaris).
Mon Feb 7 18:55:29 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSMatrix.m ([-mouseDown:]): Pass mouse down to super if
we have no cells.
Mon Feb 7 03:06:36 2000 Nicola Pero <n.pero@mi.flashnet.it>
This bug was crashing GNUstep while I was doing experiments with
the Save Panel's code. It wasn't easy to find.
* Source/NSMatrix.m ([-putCell:atRow:column:]): Fixed bug. If we
are putting a new cell precisely in _selectedRow, _selectedColumn,
we have to update _selectedCell, otherwise it remains pointing to
the released cell! ([-insertRow:withCells:]): Update _selectedRow
if needed. ([-insertColumn:withCells:]): Update _selectedColumn if
needed.
Sun Feb 6 8:52:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/GSInfoPanel.m: Make newly created panel appear in center
of screen.
Sun Feb 6 05:50:20 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Documentation/gnustep-gui.tmpl.texi (Window Manager): Added a
tiny section recommending to set "Click Window To Focus" in the
window manager configuration. Also, improved the section on the
Standard Info Panel.
Sat Feb 5 03:02:04 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSWindow.m ([-orderWindow:relativeTo:]): Fixed a quite
serious bug appearing twice, in two for loops. It was messing
window ordering, causing the app to freeze under certain
circumstances.
Fri Feb 4 18:35:59 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/GSInfoPanel.m ([-initWithDictionary:]): Use
Helvetica-Bold instead of Helvetica-BoldOblique [for now].
Thu Feb 3 17:24:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSMenu.m: ([NSMenuWindowTitleView -mouseDown:]) fix memory
allocation error when setting new menu location frame info.
Thu Feb 3 02:56:10 2000 Enrico Sersale <enrico@imago.ro>
* Source/NSBezierPath.m Partially rewritten, fixed,
added a concrete class
([-setCachesBezierPath:]): Implemented using NSImage.
Thu Feb 3 03:45:08 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSButtonCell.m ([-drawInteriorWithFrame:inView:]):
NSImageAbove, NSImageBelow: Rewritten. In these cases now we
determine the space taken by the text; then all the remaining
space is given to the image, which is centered in it.
Thu Feb 3 02:20:29 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSButtonCell.m ([-cellSize]): Bug fix: typo would prevent
button with both image and text, image above/below text, to size
correctly.
Wed Feb 2 06:56:33 2000 Nicola Pero <n.pero@mi.flashnet.it>
With a hack the library is now able to pop up popupbuttons in the
right position, correcting at run time bugs in the window frame
code. This was hard.
* Source/NSPopUpButtonCell.m (_convertBaseToScreen_with_fix):
Added private function to do the conversion right, automatically
fixing window frame origin bugs.
* Source/NSPopUpButtonCell.m ([-attachPopUpWithFrame:inView:]):
Use the above mentioned function to perform the coordinate
conversion right.
* Source/NSPopUpButton.m ([-mouseDown:]): Idem.
Tue Feb 1 00:46:42 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Headers/AppKit/NSMenuItem.h: Removed unused ivar mi_hasSubmenu.
* Source/NSMenuItem.m ([-init]): Removed reference to the unused
ivar.
Mon Jan 31 00:24:17 2000 Nicola Pero <n.pero@mi.flashnet.it>
Rewritten, fixed, NSPopUpButton appearance. NB: When the button
popups in the wrong position, that is a bug elsewhere.
* Headers/AppKit/NSMenuItemCell.h: Added ivar
_mcell_belongs_to_popupbutton.
* Source/NSMenuItemCell.m ([-imageRectForBounds:]): In the special
case _mcell_belongs_to_popupbutton == YES and there is an image,
draw it at the extreme right.
* Source/NSPopUpButtonCell.m: Added private method [NSMenuItemCell
-setBelongsToPopUpButton:]. ([+initialize]): Added method. We
are now caching the two standard images. ([-addItemWithTitle:]):
Simplified. ([-insertItemWithTitle:atIndex:]): Set image position
to right, and set cell to belong to popup button.
([-selectItem:]): Invoke setChangesState: NO and set proper image
after setting state of any item. ([-selectItemAtIndex:]): Made
code readable. ([-drawWithFrame:inView:]): Set background of
image.
* Source/NSMenuItemCell.m ([-calcSize]): Bug fix: don't move the
image to the left if a valid image position has been already set.
* Source/NSMenuView.m ([-setMenuItemCell:forItemAtIndex:]): Bug
fix: Connect new cell to menuItem and menu so that it works.
* Source/NSApplication.m
([-orderFrontStandardAboutPanelWithOptions:]): Display 'Info' in
the title.
2000-01-28 Adam Fedor <fedor@gnu.org>
* Source/NSBrowser.m ([NSBrowser -_performLoadOfColumn:]): Don't
release columns's columnMatrix, the column will do it.
2000-01-26 Adam Fedor <fedor@gnu.org>
* Source/NSGraphicsContext.m ([NSGraphicsContext
+setCurrentContext:]): Retain (assign) the new context (fix
suggested by Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>)
* gui/Model/GMAppkit.m ([NSMenuItem -encodeWithModelArchiver:]):
Check to see if object responds to various selectors before
invoking them.
Wed Jan 26 06:50:14 2000 Nicola Pero <n.pero@mi.flashnet.it>
Fixed mixed state stuff so that it is exactly as in macosx
[untested]:
* Headers/AppKit/NSCell.h: Turned _cell.state into a normal int;
changed NSMixedState to -1.
* Source/NSCell.m ([-setState:]): Rewritten, mixed state support.
Wed Jan 26 02:03:25 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Documentation/gnustep-gui.tmpl.texi (Standard Info Panel): Added
documentation for [NSApplication -orderFrontInfoPanel:] and
[NSApplication -orderFrontInfoPanelWithOptions:].
Mon Jan 24 23:45:30 2000 Nicola Pero <n.pero@mi.flashnet.it> Mon Jan 24 23:45:30 2000 Nicola Pero <n.pero@mi.flashnet.it>
Implemented a standard Info Panel for GNUstep. To make everyone Implemented a standard Info Panel for GNUstep. To make everyone
@ -18,17 +291,19 @@ Mon Jan 24 23:45:30 2000 Nicola Pero <n.pero@mi.flashnet.it>
-orderFrontStandardInfoPanel: are available; one displays 'About' -orderFrontStandardInfoPanel: are available; one displays 'About'
in the title, and the other displays 'Info'; they are otherwise in the title, and the other displays 'Info'; they are otherwise
identical. GNUstep recommends using the 'Info' version. identical. GNUstep recommends using the 'Info' version.
* Source/GNUmakefile (libgnustep-gui_OBJC_FILES): Added GSInfoPanel. * Source/GNUmakefile (libgnustep-gui_OBJC_FILES): Added
(libgnustep-gui_HEADER_FILES): Idem. GSInfoPanel. (libgnustep-gui_HEADER_FILES): Idem.
* Source/GSInfoPanel.m: New class. * Source/GSInfoPanel.m: New class.
* Headers/AppKit/GSInfoPanel.h: New class. * Headers/AppKit/GSInfoPanel.h: New class.
* Headers/AppKit/NSApplication.h: Added ivar _infoPanel, declaration * Headers/AppKit/NSApplication.h: Added ivar _infoPanel, declaration
of new methods. of new methods.
* Source/NSApplication.m * Source/NSApplication.m
([-orderFrontStandardInfoPanelWithOptions:]): New method, implemented. ([-orderFrontStandardInfoPanelWithOptions:]): New method,
([-orderFrontStandardInfoPanel:]): Idem. ([-orderFrontStandardAboutPanel:]): implemented.
Idem. ([-orderFrontStandardAboutPanelWithOptions:]): Idem. ([-dealloc]): ([-orderFrontStandardInfoPanel:]): Idem.
Added release of _infoPanel. ([-orderFrontStandardAboutPanel:]): Idem.
([-orderFrontStandardAboutPanelWithOptions:]): Idem.
([-dealloc]): Added release of _infoPanel.
Mon Jan 24 04:01:55 2000 Nicola Pero <n.pero@mi.flashnet.it> Mon Jan 24 04:01:55 2000 Nicola Pero <n.pero@mi.flashnet.it>

View file

@ -81,11 +81,6 @@ be placed in
Bug reports can be sent to Bug reports can be sent to
@email{bug-gnustep@@gnu.org}. @email{bug-gnustep@@gnu.org}.
@noindent
Creators rejoice!@*
Scott Christley@*
@email{scottc@@net-community.com}@*
@section Obtaining GNU Software @section Obtaining GNU Software
Check out the GNU web site. (@url{http://www.gnu.org/}) Check out the GNU web site. (@url{http://www.gnu.org/})

View file

@ -1,124 +0,0 @@
@c -*-texinfo-*-
@chapter Frequently Asked Questions With Answers
@ifset TEXT-ONLY
@include version.texi
@end ifset
Maintained by Scott Christley @email{scottc@@net-community.com}.
Last updated March 28 1997. The most up-to-date version of this FAQ
is available at:
@example
@url{ftp://www.gnustep.org/Documentation/gnustep-gui/gnustep-gui_toc.html}
@end example
Please send corrections to @email{scottc@@net-community.com}.
@enumerate
@item @b{What is the GNUstep GUI Library?}
The GNUstep GUI Library is a library of objects useful for writing
graphical applications. For example, it includes classes for drawing
and manipulating graphics objects on the screen: windows, menus,
buttons, sliders, text fields, and events. There are also many
peripheral classes that offer operating-system-independent interfaces to
images, cursors, colors, fonts, pasteboards, printing. There are also
workspace support classes such as data links, open/save panels,
context-dependent help, spell checking.
It provides functionality that aims to implement the @samp{AppKit}
portion of the OpenStep standard. However the implementation has
been written to take advantage of GNUstep enhancements wherever possible.
@item @b{Explain the organization of the front and back-ends.}
The GNUstep GUI Library is divided into a front and back-end. The
front-end contains the majority of implementation, but leaves out the
low-level drawing and event code. A back-end can override whatever
methods necessary in order to implement low-level drawing event
receiving. Different back-ends will make GNUstep available on various
platforms. The default GNU back-end will run on top of the X Window
System and the Display Ghostscript Server. Other back-ends could allow
GNUstep to run on Mac, OS/2, and WIN32 graphics/event platforms.
Much work will be saved by this clean separation between front and
back-end, because it allows different platforms to share the large
amount of front-end code.
The front-end does not specify what mechanism to use in order to "plug
in" the back-end; that is the back-end implementor's choice. At least
two backends will use @samp{+poseAs:} method, for example, running
@samp{[XDPSWindow poseAs: [NSWindow class]]}. Using @samp{+poseAs:} is
more flexible than using Categories because it allows the the back-end
implementor to choose what to override in the front-end, instead of
having the interface between front and back-end fixed by the front-end.
@item @b{What is the current state of development of the front-end?}
A number of classes in the front-end are complete or almost complete;
these include: NSActionCell, NSButtonCell, NSButton, NSCell, NSColor,
NSColorWell, NSControl, NSCursor, NSEvent, NSFont, NSImage, NSImageRep,
NSBitmapImageRep, NSResponder, NSSlider, NSScroller, NSTextField, and
NSTextFieldCell.
Other classes are complete enough to use, but still require some major
additions before being considered almost complete: NSApplication, NSBox,
NSFontManager, NSMatrix, NSMenu, NSMenuCell, NSPopUpButton,
NSSliderCell, NSText, NSView, and NSWindow.
You can review the most up-to-date status report at:
@example
@url{http://www.gnustep.org/Documentation/gnustep-gui/gnustep-gui_toc.html}.
@end example
@item @b{What back-ends are available?}
The official back-end is the GNUstep X/DPS GUI Backend which runs
under the X Window System and interfaces to the Display Ghostscript
System. You can learn more at:
@example
@url{http://www.gnustep.org/Documentation/gnustep-xdps/gnustep-xdps_toc.html}
@end example
@item @b{Where can I get a copy?}
@ifset GNUSTEP-GUI-FTP-MACHINE
The gstep-gui-@value{GNUSTEP-GUI-VERSION}.tar.gz distribution
file has been placed on @samp{@value{GNUSTEP-GUI-FTP-MACHINE}} in
@samp{@value{GNUSTEP-GUI-FTP-DIRECTORY}}.
@end ifset
@ifclear GNUSTEP-GUI-FTP-MACHINE
The gstep-gui-@value{GNUSTEP-GUI-VERSION}.tar.gz distribution
file has not been made available by anonymous ftp.
@end ifclear
The program requires gcc @value{GNUSTEP-GUI-GCC} or higher.
It requires the Display Ghostscript System version
@value{GNUSTEP-GUI-DGS} and the TIFF Graphics library version
@value{GNUSTEP-GUI-LIBTIFF}.
It also requires a FoundationKit library as specified by the OpenStep
specification. The FoundationKit libraries known to work are the GNUstep
Base Library version @samp{@value{GNUSTEP-GUI-BASE}} and libFoundation version
@samp{@value{LIB-FOUNDATION}}.
The @samp{.tar} file is compressed with GNU gzip. Gzip can be obtained by
anonymous ftp at any of the GNU archive sites.
For info about FTP via email, send email to
@email{ftpmail@@decwrl.dec.com} with no subject line, and two-line body
with line one @samp{help} and line two @samp{quit}.
The most recent (not necessarily tested) snapshots of the library will
be placed in
@url{ftp://@value{GNUSTEP-GUI-SNAP-FTP-MACHINE}/@value{GNUSTEP-GUI-SNAP-FTP-DIRECTORY}}.
@end enumerate

View file

@ -147,6 +147,7 @@ installed the GNUstep Makefile Pacakge and the GNUstep Base Library.
@chapter Special Features of GUI Classes. @chapter Special Features of GUI Classes.
@menu @menu
* NSApplication::
* NSBrowserCell:: * NSBrowserCell::
* NSSavePanel:: * NSSavePanel::
* GSHbox:: * GSHbox::
@ -154,7 +155,111 @@ installed the GNUstep Makefile Pacakge and the GNUstep Base Library.
* GSVbox:: * GSVbox::
@end menu @end menu
@node NSBrowserCell, NSSavePanel, Classes, Classes @node NSApplication, NSBrowserCell, Classes, Classes
@section NSApplication
@menu
* Standard Info Panel::
@end menu
@node Standard Info Panel, , NSApplication, NSApplication
@subsection Standard Info Panel
GNUstep NSApplication provides the following two methods to easily
create a standard Info Panel for your application:
@noindent
- (void) @b{orderFrontStandardInfoPanel:} (id)@t{sender}
Invokes @code{orderFrontStandardInfoPanelWithOptions:} with a @code{nil}
dictionary. You may use this method as action of a menu item, even
if it is generally preferred to use the full method so that you can
fill in all the information to show in the Info Panel.
@noindent
- (void) @b{orderFrontStandardInfoPanelWithOptions:} (NSDictionary *)@t{dictionary}
Orders front the standard info panel for the application, taking the
needed information from the @t{dictionary} argument. There is a single
standard info panel per application; it is created the first time that
this method is invoked, and then reused in all subsequent calls. The
application standard info panel is immutable and can not be changed
after creation. Useful keys for the @t{dictionary} are:
@code{ApplicationName}: A string with the name of the application (eg,
@code{@@"Gorm"}). If not available, the @file{Info-gnustep.plist} file is
searched for the value of @code{ApplicationName}; if this fails, the
@file{Info-gnustep.plist} file is searched for the value of
@code{NSHumanReadableShortName}; if this also fails, the string returned
by @code{[[NSProcessInfo processInfo] processName]} is used.
@code{ApplicationDescription}: A string with a very short description
of the application (eg, @code{@@"GNUstep Graphics Objects Relationship
Modeller"}). If not available, @file{Info-gnustep.plist} is searched
for that key; if this fails, no application description is shown.
@code{ApplicationIcon}: An image to be shown near the title. If not
available, @file{Info-gnustep.plist} is looked for
@code{ApplicationIcon}; if this fails, @code{[NSApp
applicationIconImage]} is used instead. Since this is what you usually
want, you usually do not need to set the @code{ApplicationIcon}
key/value in the @code{dictionary}.
@code{ApplicationRelease}: A string with the name of the application,
release included (eg, @code{@@"Gorm 0.1"}). If not available, the value
for @code{ApplicationVersion} is used instead. If this fails,
@file{Info-gnustep.plist} is looked for @code{ApplicationRelease} or
(failing this) for @code{NSAppVersion}. If all fails, @code{"Unknown"}
is used.
@code{FullVersionID}: A string with the full version of the application
(eg, @code{@@"0.1.2b"} or @code{@@"snap011100"}). If not available,
@code{Version} is used instead. If this fails,
@file{Info-gnustep.plist} is looked for @code{NSBuildVersion}. If all
fails, no full version is shown.
@code{Authors}: An array of strings, each one with the name of an author
(eg,
@code{[NSArray arrayWithObject: @@"Nicola Pero <n.pero@@mi.flashnet.it>"]}).
If not found, @file{Info-gnustep.plist} is
looked for @code{Authors}, if this fails, @code{@@"Unknown"} is
displayed.
@code{URL}: [This field is still under work, so it might be changed] A
string with an URL (eg, @code{@@"See http://www.gnustep.org"}).
@code{Copyright}: A string with copyright owners (eg, @code{@@"Copyright
(C) 2000 The Free Software Foundation, Inc."}). Support for multiple
line strings is planned but not yet available. If not found,
@file{Info-gnustep.plist} is searched for @code{Copyright} and then
(failing this) for @code{NSHumanReadableCopyright}. If all fails,
@code{@@"Copyright Information Not Available"} is used.
@code{CopyrightDescription}: A string describing the kind of copyright
(eg, @code{@@"Released under the GNU General Public License 2.0"}). If
not available, @file{Info-gnustep.plist} is looked for
@code{CopyrightDescription}. If this fails, no copyright description
is shown.
For compatibility reasons only, the following MacOSX API is also
available:
@noindent
- (void) @b{orderFrontStandardAboutPanel:} (id)@t{sender}
@noindent
- (void) @b{orderFrontStandardAboutPanelWithOptions:} (NSDictionary *)@t{dictionary}
These methods do the same as the ones above, but are deprecated.
Please note that you are free to implement your own info panel for your
app without breaking the GNUstep User Interface; the standard one is
available only as a facility -- it's not at all compulsory to use the
standard one -- you are encouraged to create your own if you like. What
is important instead is that you make your info panel available from the
@t{Info...} item in the @t{Info} menu.
@node NSBrowserCell, NSSavePanel, NSApplication, Classes
@section NSBrowserCell @section NSBrowserCell
@menu @menu
@ -1139,10 +1244,11 @@ argument was given. The Info-gnustep.plist file could look like this:
@chapter Special Setup Instructions. @chapter Special Setup Instructions.
@menu @menu
* Keyboard Modifiers:: * Keyboard Modifiers::
* Window Manager::
@end menu @end menu
@node Keyboard Modifiers, , Setup, Setup @node Keyboard Modifiers, Window Manager, Setup, Setup
@section Keyboard Modifiers @section Keyboard Modifiers
This section applies only to the xgps and the xdps backend. This section applies only to the xgps and the xdps backend.
@ -1280,6 +1386,16 @@ Good window managers let you change the keyboard shortcuts,
so you may move the wm shortcuts that you do not use to keys so you may move the wm shortcuts that you do not use to keys
which do not conflict (at least not too much) with GNUstep. which do not conflict (at least not too much) with GNUstep.
@node Window Manager, , Keyboard Modifiers, Setup
@section Window Manager Recommended Configuration
If you are using GNUstep GUI library with the Window Maker window
manager it is recommended that you set the Window Maker option "Input
Focus Mouse" (under "Window Focus Preferences") to "Click Window To
Focus".
If you are using another window manager, look for a similar option.
@node Contributing, Concept Index, Setup, Top @node Contributing, Concept Index, Setup, Top
@chapter Contributing @chapter Contributing

View file

@ -9,8 +9,51 @@
The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}. The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}.
@section Noteworthy changes in version @samp{0.6.5}
Many of the basic GUI classes have been vastly improved or rewritten, thanks
to Nicola Pero @email{n.pero@@mi.flashnet.it} and many others.
@itemize @bullet
@item New Info Panel support
@item New NSBezierPath
@item Rewrite of several classes including Cell and Button classes.
@item Rewrite of NSBrowser, NSSavePanel, menus, text classes, NSTableHeader.
@item RTF Parser
@item Implemented image caching.
@item Implemented editing in Forms, Matricies.
@item New autolayout classes GSHBox, GSTable, and GSVBox.
@item Almost all back-end classes have been removed and code incorporated
in a DPS-like graphics context structure.
@item Better keyboard handling.
@item NSHelpManager, NSComboBox, ProgressIndicator written.
@end itemize
In addition a preliminary version of an Interface Builder (Gorm) has
been written, thanks to Richard Frith-Macdonald @email{richard@@brainstorm.co.uk}
@section Noteworthy changes in version @samp{0.6.0} @section Noteworthy changes in version @samp{0.6.0}
A Huge amount of progress, although a lot still needs to be done. It's
usable for a large base of moderately simple apps. Several NeXT/OpenStep
apps and libraries have been ported with little changes.
@itemize @bullet
@item Drag and Drop support fleshed out but not completed.
@item NSText and related classes rewritten. Basic functionality but
much needs to be done to finish them off.
@item nib2gmodel app works with MacOS-X
@item Work done in minimizing the backend which allowed a lot
of functionality to move to the GNU library.
@item Menu code rewritten.
@item PopupButtons now work.
@item Many new images
@item Basic functionality for NSTabView
@item Much better lockFocus support in NSView. Flipped views handled.
@item Rewrite of NSSavePanel and NSOpenPanel
@item Several fixes that at least double the speed of the gui.
@end itemize
@section Noteworthy changes in version @samp{0.5.5} @section Noteworthy changes in version @samp{0.5.5}
Too extensive to list. Too extensive to list.

View file

@ -32,7 +32,3 @@ Give us feedback! Tell us what you like; tell us what you think
could be better. Send bug reports to @email{bug-gnustep@@gnu.org}. could be better. Send bug reports to @email{bug-gnustep@@gnu.org}.
@end itemize @end itemize
@noindent
Creators rejoice!@*
Scott Christley@*
@email{scottc@@net-community.com}

View file

@ -6,17 +6,86 @@
@include version.texi @include version.texi
@end ifset @end ifset
@section Projects Looking for Volunteers @section Bugs in the GUI library
If you think you can do one of these projects, please let me know. Your
help is greatly appreciated. Send email to @email{scottc@@net-community.com}.
@end ifclear @end ifclear
@subsection Windows
@itemize @bullet @itemize @bullet
@item Code to manage window decorations is not finished.
The reported frame origin of a window might be wrong.
@item Consolodate examples and tests [3, OpenStep] (980913). @item Windows never get released. Setting isReleasedWhenClosed
Also fix or document whatever bugs are there. does not work.
@item Need an rtf parser [6 - Objective-C, RTF] (980820). Fixing these bugs requires touching delicate parts of the library.
This is why fixing them has been postponed after 0.6.5, to keep 0.6.5
reasonably stable.
@end itemize
@subsection Texts
@itemize @bullet
@item The NSText code is particularly complex to work on and it has not
improved much since 0.6.0. Many bugs are know in the code -- it is
somewhat usable though. We hope on a big improvement of this area
for next release.
@end itemize
@subsection Matrices
@itemize @bullet
@item Encoding/Decoding of matrices is unimplemented. There are some minor
known bugs with handling of mouse down in matrices.
@end itemize
@subsection Cells
@itemize @bullet
@item Since NSText does only left alignment, when you select or edit text
in a cell it becomes automatically left aligned regardless of the original
alignment.
@item Multi line texts are unsupported; isScrollable, wordWraps etc do nothing.
This restriction will hopefully be removed in next releases.
@end itemize
@subsection Images anf Graphics
@itemize @bullet
@item There are problems with alpha composing. To avoid these problems,
you may set manually the background color of your image when displaying it.
@item Only TIFF images are supported in 0.6.5. Support at least for PNG and
JPEG images is planned for next release.
@item alpha drawing and compositing of graphics doesn't work.
@end itemize @end itemize
@subsection Alert, Info Panels
@itemize @bullet
@item Multi line messages are generally unsupported due to the similar
restriction in the cells code.
@end itemize
@subsection Unimplemented Classes
The following classes are currently unimplemented or unfinished
to such a degree to be unusable.
@itemize @bullet
@item NSColorPanel
@item NSDataLink
@item NSFontManager
@item NSFontPanel
@item NSHelpPanel
@item NSLayoutManager
@item NSPageLayout
@item NSPrintPanel
@item NSSecureTextField
@item NSSpellChecker
@item NSTableView
@item NSTextView
@end itemize

View file

@ -189,6 +189,7 @@ typedef enum {
// Path modifications. // Path modifications.
// //
- (NSBezierPath *)bezierPathByFlatteningPath; - (NSBezierPath *)bezierPathByFlatteningPath;
- (NSBezierPath *)bezierPathByReversingPath; - (NSBezierPath *)bezierPathByReversingPath;
// //

View file

@ -99,10 +99,13 @@ enum {
yDist = 2 // vertical distance between the text and image rects. yDist = 2 // vertical distance between the text and image rects.
}; };
/*
* We try to do as in macosx.
*/
enum { enum {
NSOffState = 0, NSOffState = 0,
NSOnState = 1, NSOnState = 1,
NSMixedState = 2 NSMixedState = -1
}; };
@interface NSCell : NSObject <NSCopying, NSCoding> @interface NSCell : NSObject <NSCopying, NSCoding>
@ -112,7 +115,7 @@ enum {
NSImage *_cell_image; NSImage *_cell_image;
NSFont *_cell_font; NSFont *_cell_font;
struct GSCellFlagsType { struct GSCellFlagsType {
// total 30 bits. 2 bits left. // total 28 bits. 4 bits left.
unsigned is_highlighted:1; unsigned is_highlighted:1;
unsigned is_disabled:1; unsigned is_disabled:1;
unsigned is_editable:1; unsigned is_editable:1;
@ -124,7 +127,6 @@ enum {
unsigned float_autorange:1; unsigned float_autorange:1;
unsigned wraps:1; unsigned wraps:1;
unsigned allows_mixed_state:1; unsigned allows_mixed_state:1;
unsigned state:2; // 3 values;
unsigned text_align:3; // 5 values unsigned text_align:3; // 5 values
unsigned image_position:4; // 7 values unsigned image_position:4; // 7 values
unsigned type:4; // 8 values (see NSButtonCell) unsigned type:4; // 8 values (see NSButtonCell)
@ -132,6 +134,9 @@ enum {
// 2 bits reserved for subclass use // 2 bits reserved for subclass use
unsigned subclass_bool_one:1; unsigned subclass_bool_one:1;
unsigned subclass_bool_two:1; unsigned subclass_bool_two:1;
/* This is not in the bitfield now (for simpler macosx compatibility)
but who knows in the future */
int state; // 3 values but one negative
} _cell; } _cell;
unsigned int _cell_float_left; unsigned int _cell_float_left;
unsigned int _cell_float_right; unsigned int _cell_float_right;

View file

@ -113,7 +113,6 @@
SEL mi_action; SEL mi_action;
int mi_tag; int mi_tag;
id mi_representedObject; id mi_representedObject;
BOOL mi_hasSubmenu;
NSMenu *mi_submenu; NSMenu *mi_submenu;
BOOL mi_changesState; BOOL mi_changesState;

View file

@ -54,6 +54,10 @@ typedef void (*DrawingIMP)(id, SEL, NSRect, NSView*);
NSString *mcell_titleToDisplay; NSString *mcell_titleToDisplay;
NSSize mcell_imageSize; NSSize mcell_imageSize;
/* If we belong to a popupbutton, we display image on the extreme
right */
BOOL _mcell_belongs_to_popupbutton;
@private @private
NSColor *_backgroundColor; NSColor *_backgroundColor;
} }

View file

@ -42,4 +42,7 @@
if (pointer) free(pointer) if (pointer) free(pointer)
#endif #endif
/* Define if you have the rintf function. */
#undef HAVE_RINTF
#endif /* _GNUstep_H_config */ #endif /* _GNUstep_H_config */

View file

@ -6,7 +6,7 @@ This file documents the installation of the GNUstep GUI Library,
may copy, distribute, and modify it freely as long as you preserve this may copy, distribute, and modify it freely as long as you preserve this
copyright notice and permission notice. copyright notice and permission notice.
This is version 0.6.0 of the GNUstep GUI library. This is version 0.6.5 of the GNUstep GUI library.
Installing `gnustep-gui' Installing `gnustep-gui'
======================== ========================

View file

@ -723,18 +723,25 @@ void __dummy_GMAppKit_functionForLinking() {}
- (void)encodeWithModelArchiver:(GMArchiver*)archiver - (void)encodeWithModelArchiver:(GMArchiver*)archiver
{ {
[archiver encodeString:[self title] withName:@"title"]; [archiver encodeString:[self title] withName:@"title"];
[archiver encodeObject:[self image] withName:@"image"]; if ([self respondsToSelector: @selector(image)])
[archiver encodeObject:[self onStateImage] withName:@"onStateImage"]; [archiver encodeObject:[self image] withName:@"image"];
[archiver encodeObject:[self offStateImage] withName:@"offStateImage"]; if ([self respondsToSelector: @selector(onStateImage)])
[archiver encodeObject:[self mixedStateImage] withName:@"mixedStateImage"]; [archiver encodeObject:[self onStateImage] withName:@"onStateImage"];
if ([self respondsToSelector: @selector(offStateImage)])
[archiver encodeObject:[self offStateImage] withName:@"offStateImage"];
if ([self respondsToSelector: @selector(mixedStateImage)])
[archiver encodeObject:[self mixedStateImage] withName:@"mixedStateImage"];
[archiver encodeString:[self keyEquivalent] withName:@"keyEquivalent"]; [archiver encodeString:[self keyEquivalent] withName:@"keyEquivalent"];
[archiver encodeInt:[self state] withName:@"state"]; if ([self respondsToSelector: @selector(state)])
[archiver encodeInt:[self state] withName:@"state"];
[archiver encodeObject:[self target] withName:@"target"]; [archiver encodeObject:[self target] withName:@"target"];
[archiver encodeSelector:[self action] withName:@"action"]; [archiver encodeSelector:[self action] withName:@"action"];
[archiver encodeInt:[self tag] withName:@"tag"]; [archiver encodeInt:[self tag] withName:@"tag"];
[archiver encodeBOOL:[self isEnabled] withName:@"isEnabled"]; [archiver encodeBOOL:[self isEnabled] withName:@"isEnabled"];
[archiver encodeBOOL:[self changesState] withName:@"changesState"]; if ([self respondsToSelector: @selector(changesState)])
[archiver encodeObject:[self submenu] withName:@"submenu"]; [archiver encodeBOOL:[self changesState] withName:@"changesState"];
if ([self respondsToSelector: @selector(submenu)])
[archiver encodeObject:[self submenu] withName:@"submenu"];
[archiver encodeConditionalObject:[self representedObject] [archiver encodeConditionalObject:[self representedObject]
withName:@"representedObject"]; withName:@"representedObject"];
} }
@ -759,6 +766,18 @@ void __dummy_GMAppKit_functionForLinking() {}
[self setRepresentedObject:[unarchiver [self setRepresentedObject:[unarchiver
decodeObjectWithName:@"representedObject"]]; decodeObjectWithName:@"representedObject"]];
#ifdef GNU_GUI_LIBRARY
/*
* Set submenu from target if not set
*/
if ([NSStringFromSelector ([self action])
isEqualToString: @"submenuAction:"])
{
if ([self submenu] == nil)
[self setSubmenu: [self target]];
}
#endif
#if 0 #if 0
NSLog (@"menu item %@: target = %@, isEnabled = %d", NSLog (@"menu item %@: target = %@, isEnabled = %d",
[self title], [self target], [self isEnabled]); [self title], [self target], [self isEnabled]);

70
NEWS
View file

@ -1,11 +1,74 @@
NEWS NEWS
**** ****
The currently released version of the library is `0.6.0'. The currently released version of the library is `0.6.5'.
Noteworthy changes in version `0.6.5'
=====================================
Many of the basic GUI classes have been vastly improved or
rewritten, thanks to Nicola Pero <n.pero@mi.flashnet.it> and many
others.
* New Info Panel support
* New NSBezierPath
* Rewrite of several classes including Cell and Button classes.
* Rewrite of NSBrowser, NSSavePanel, menus, text classes,
NSTableHeader.
* RTF Parser
* Implemented image caching.
* Implemented editing in Forms, Matricies.
* New autolayout classes GSHBox, GSTable, and GSVBox.
* Almost all back-end classes have been removed and code incorporated
in a DPS-like graphics context structure.
* Better keyboard handling.
* NSHelpManager, NSComboBox, ProgressIndicator written.
In addition a preliminary version of an Interface Builder (Gorm) has
been written, thanks to Richard Frith-Macdonald
<richard@brainstorm.co.uk>
Noteworthy changes in version `0.6.0' Noteworthy changes in version `0.6.0'
===================================== =====================================
A Huge amount of progress, although a lot still needs to be done.
It's usable for a large base of moderately simple apps. Several
NeXT/OpenStep apps and libraries have been ported with little changes.
* Drag and Drop support fleshed out but not completed.
* NSText and related classes rewritten. Basic functionality but much
needs to be done to finish them off.
* nib2gmodel app works with MacOS-X
* Work done in minimizing the backend which allowed a lot of
functionality to move to the GNU library.
* Menu code rewritten.
* PopupButtons now work.
* Many new images
* Basic functionality for NSTabView
* Much better lockFocus support in NSView. Flipped views handled.
* Rewrite of NSSavePanel and NSOpenPanel
* Several fixes that at least double the speed of the gui.
Noteworthy changes in version `0.5.5' Noteworthy changes in version `0.5.5'
===================================== =====================================
@ -14,6 +77,7 @@ Noteworthy changes in version `0.5.5'
* A lot of rewritting has been done to the classes, with general * A lot of rewritting has been done to the classes, with general
cleanup of coordinate conversion code, etc. cleanup of coordinate conversion code, etc.
Noteworthy changes in version `0.5.0' Noteworthy changes in version `0.5.0'
===================================== =====================================
@ -63,6 +127,7 @@ Noteworthy changes in version `0.5.0'
* Several cleanups and as usual, many bug fixes. * Several cleanups and as usual, many bug fixes.
Noteworthy changes in version `0.3.0' Noteworthy changes in version `0.3.0'
===================================== =====================================
@ -94,6 +159,7 @@ Noteworthy changes in version `0.3.0'
retain/release policy has been fixed, the cell classes correctly retain/release policy has been fixed, the cell classes correctly
implement the NSCopying protocol and many others. implement the NSCopying protocol and many others.
Noteworthy changes in version `0.2.0' Noteworthy changes in version `0.2.0'
===================================== =====================================
@ -128,6 +194,7 @@ Noteworthy changes in version `0.2.0'
* Many bug fixes and minor enhancements. * Many bug fixes and minor enhancements.
Noteworthy changes in version `0.1.1' Noteworthy changes in version `0.1.1'
===================================== =====================================
@ -151,6 +218,7 @@ Noteworthy changes in version `0.1.1'
* Now requires the TIFF library for reading, writing, and * Now requires the TIFF library for reading, writing, and
manipulating tiff files and images. manipulating tiff files and images.
Noteworthy changes in version `0.1.0' Noteworthy changes in version `0.1.0'
===================================== =====================================

6
README
View file

@ -1,7 +1,7 @@
README README
****** ******
This is version 0.6.0 of the GNUstep GUI library (`gnustep-gui'). This is version 0.6.5 of the GNUstep GUI library (`gnustep-gui').
Here is some introductory info to get you started: Here is some introductory info to get you started:
@ -21,7 +21,3 @@ How can you help?
* Give us feedback! Tell us what you like; tell us what you think * Give us feedback! Tell us what you like; tell us what you think
could be better. Send bug reports to <bug-gnustep@gnu.org>. could be better. Send bug reports to <bug-gnustep@gnu.org>.
Creators rejoice!
Scott Christley
<scottc@net-community.com>

View file

@ -272,8 +272,9 @@ static NSAffineTransformStruct identityTransform = {
- (NSBezierPath*) transformBezierPath: (NSBezierPath*)aPath - (NSBezierPath*) transformBezierPath: (NSBezierPath*)aPath
{ {
[self notImplemented: _cmd]; NSBezierPath *path = [aPath copyWithZone: [aPath zone]];
return nil; [path transformUsingAffineTransform: self];
return path;
} }
- (NSPoint) transformPoint: (NSPoint)point - (NSPoint) transformPoint: (NSPoint)point

View file

@ -1146,7 +1146,7 @@ static NSCell* tileCell = nil;
{ {
if (theEvent == null_event) if (theEvent == null_event)
{ {
NSDebugLog(@"Not sending the Null Event\n"); NSDebugLLog(@"NSEvent", @"Not sending the Null Event\n");
return; return;
} }
@ -1157,7 +1157,7 @@ static NSCell* tileCell = nil;
case NSKeyDown: case NSKeyDown:
{ {
NSDebugLog(@"send key down event\n"); NSDebugLLog(@"NSEvent", @"send key down event\n");
if ([theEvent modifierFlags] & NSCommandKeyMask) if ([theEvent modifierFlags] & NSCommandKeyMask)
{ {
NSArray *window_list = [self windows]; NSArray *window_list = [self windows];
@ -1179,7 +1179,7 @@ static NSCell* tileCell = nil;
case NSKeyUp: case NSKeyUp:
{ {
NSDebugLog(@"send key up event\n"); NSDebugLLog(@"NSEvent", @"send key up event\n");
[[theEvent window] sendEvent: theEvent]; [[theEvent window] sendEvent: theEvent];
break; break;
} }
@ -1189,16 +1189,16 @@ static NSCell* tileCell = nil;
NSWindow *window = [theEvent window]; NSWindow *window = [theEvent window];
if (!theEvent) if (!theEvent)
NSDebugLog(@"NSEvent is nil!\n"); NSDebugLLog(@"NSEvent", @"NSEvent is nil!\n");
NSDebugLog(@"NSEvent type: %d", [theEvent type]); NSDebugLLog(@"NSEvent", @"NSEvent type: %d", [theEvent type]);
NSDebugLog(@"send event to window"); NSDebugLLog(@"NSEvent", @"send event to window");
NSDebugLog([window description]); NSDebugLLog(@"NSEvent", [window description]);
if (window) if (window)
[window sendEvent: theEvent]; [window sendEvent: theEvent];
else if ([theEvent type] == NSRightMouseDown) else if ([theEvent type] == NSRightMouseDown)
[self rightMouseDown: theEvent]; [self rightMouseDown: theEvent];
else else
NSDebugLog(@"no window"); NSDebugLLog(@"NSEvent", @"no window");
} }
} }
} }
@ -1637,22 +1637,18 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
@"OK", NULL, NULL); @"OK", NULL, NULL);
} }
/* infoPanel, macosx API -- 'About' in the title */ /* infoPanel, macosx API -- Deprecated */
- (void) orderFrontStandardAboutPanel: sender - (void) orderFrontStandardAboutPanel: sender
{ {
[self orderFrontStandardAboutPanel: sender]; [self orderFrontStandardInfoPanel: sender];
} }
- (void) orderFrontStandardAboutPanelWithOptions: (NSDictionary *)options - (void) orderFrontStandardAboutPanelWithOptions: (NSDictionary *)options
{ {
if (_infoPanel == nil) [self orderFrontStandardInfoPanelWithOptions: options];
_infoPanel = [[GSInfoPanel alloc] initWithDictionary: options];
[_infoPanel setTitle: @"About"];
[_infoPanel orderFront: self];
} }
/* infoPanel, GNUstep API -- 'Info' in the title */ /* infoPanel, GNUstep API */
- (void) orderFrontStandardInfoPanel: sender - (void) orderFrontStandardInfoPanel: sender
{ {
[self orderFrontStandardInfoPanelWithOptions: nil]; [self orderFrontStandardInfoPanelWithOptions: nil];

View file

@ -58,7 +58,7 @@ void subdiv(int degree, float coeff[], float t, float bleft[], float bright[]);
NSPoint rotatePoint(NSPoint p, NSPoint centre, float angle); NSPoint rotatePoint(NSPoint p, NSPoint centre, float angle);
@interface PathElement : NSObject @interface PathElement : NSObject <NSCopying, NSCoding>
{ {
NSPoint p[3]; NSPoint p[3];
NSBezierPathElement type; NSBezierPathElement type;
@ -140,6 +140,39 @@ NSPoint rotatePoint(NSPoint p, NSPoint centre, float angle);
return AUTORELEASE(element); return AUTORELEASE(element);
} }
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[super encodeWithCoder: aCoder];
[aCoder encodeValueOfObjCType: @encode(NSBezierPathElement) at: &type];
[aCoder encodeValueOfObjCType: @encode(NSPoint *) at: &p];
}
- (id)initWithCoder:(NSCoder *)aCoder
{
self = [super initWithCoder: aCoder];
[aCoder decodeValueOfObjCType: @encode(NSBezierPathElement) at: &type];
[aCoder decodeValueOfObjCType: @encode(NSPoint *) at: &p];
return self;
}
- (id)copyWithZone:(NSZone *)zone
{
PathElement *element = [[PathElement allocWithZone: zone] init];
element->type = type;
if(type == NSMoveToBezierPathElement || type == NSLineToBezierPathElement) {
element->p[0].x = p[0].x;
element->p[0].y = p[0].y;
} else if(type == NSCurveToBezierPathElement) {
element->p[0].x = p[0].x;
element->p[0].y = p[0].y;
element->p[1].x = p[1].x;
element->p[1].y = p[1].y;
element->p[2].x = p[2].x;
element->p[2].y = p[2].y;
}
return AUTORELEASE(element);
}
- (void)setType:(NSBezierPathElement)t - (void)setType:(NSBezierPathElement)t
{ {
type = t; type = t;
@ -491,7 +524,7 @@ static Class NSBezierPath_concrete_class = nil;
// //
- (void)transformUsingAffineTransform:(NSAffineTransform *)transform - (void)transformUsingAffineTransform:(NSAffineTransform *)transform
{ {
[self subclassResponsibility:_cmd];
} }
// //
@ -636,23 +669,24 @@ static Class NSBezierPath_concrete_class = nil;
// //
// NSCoding protocol // NSCoding protocol
// //
- (void)encodeWithCoder:(NSCoder*)aCoder - (void)encodeWithCoder:(NSCoder *)aCoder
{ {
[super encodeWithCoder: aCoder]; [self subclassResponsibility:_cmd];
} }
- (id)initWithCoder:(NSCoder*)aCoder - (id)initWithCoder:(NSCoder *)aCoder
{ {
[super initWithCoder: aCoder]; [self subclassResponsibility:_cmd];
return self; return self;
} }
// //
// NSCopying Protocol // NSCopying Protocol
// //
- (id)copyWithZone:(NSZone*)zone - (id)copyWithZone:(NSZone *)zone
{ {
return self; [self subclassResponsibility:_cmd];
return self;
} }
@end @end
@ -686,6 +720,9 @@ static Class NSBezierPath_concrete_class = nil;
if(self) { if(self) {
pathElements = [[NSMutableArray alloc] initWithCapacity: 1]; pathElements = [[NSMutableArray alloc] initWithCapacity: 1];
subPaths = [[NSMutableArray alloc] initWithCapacity: 1]; subPaths = [[NSMutableArray alloc] initWithCapacity: 1];
[self setLineWidth: 1];
[self setLineCapStyle: NSButtLineCapStyle];
[self setLineJoinStyle: NSMiterLineJoinStyle];
[self setWindingRule: NSNonZeroWindingRule]; [self setWindingRule: NSNonZeroWindingRule];
[self setBounds: NSZeroRect]; [self setBounds: NSZeroRect];
[self setControlPointBounds: NSZeroRect]; [self setControlPointBounds: NSZeroRect];
@ -831,7 +868,6 @@ static Class NSBezierPath_concrete_class = nil;
PathElement *elm; PathElement *elm;
NSBezierPathElement t; NSBezierPathElement t;
NSPoint *pts, origin; NSPoint *pts, origin;
float r, g, b, w;
int i; int i;
if(cachesBezierPath) { if(cachesBezierPath) {
@ -842,12 +878,10 @@ static Class NSBezierPath_concrete_class = nil;
cacheimg = [[NSImage alloc] initWithSize: [self bounds].size]; cacheimg = [[NSImage alloc] initWithSize: [self bounds].size];
[self movePathToPoint: NSMakePoint(0, 0)]; [self movePathToPoint: NSMakePoint(0, 0)];
PScurrentrgbcolor(&r, &g, &b);
PScurrentlinewidth(&w);
[cacheimg lockFocus]; [cacheimg lockFocus];
PSsetrgbcolor(r, g, b); PSsetlinewidth([self lineWidth]);
PSsetlinewidth(w); PSsetlinejoin([self lineJoinStyle]);
PSsetlinecap([self lineCapStyle]);
for(i = 0; i < [pathElements count]; i++) { for(i = 0; i < [pathElements count]; i++) {
elm = [pathElements objectAtIndex: i]; elm = [pathElements objectAtIndex: i];
pts = [elm points]; pts = [elm points];
@ -874,6 +908,9 @@ static Class NSBezierPath_concrete_class = nil;
} }
[cacheimg compositeToPoint: origin operation: NSCompositeCopy]; [cacheimg compositeToPoint: origin operation: NSCompositeCopy];
} else { } else {
PSsetlinewidth([self lineWidth]);
PSsetlinejoin([self lineJoinStyle]);
PSsetlinecap([self lineCapStyle]);
for(i = 0; i < [pathElements count]; i++) { for(i = 0; i < [pathElements count]; i++) {
elm = [pathElements objectAtIndex: i]; elm = [pathElements objectAtIndex: i];
pts = [elm points]; pts = [elm points];
@ -904,7 +941,6 @@ static Class NSBezierPath_concrete_class = nil;
PathElement *elm; PathElement *elm;
NSBezierPathElement t; NSBezierPathElement t;
NSPoint *pts, origin; NSPoint *pts, origin;
float r, g, b;
int i; int i;
if(cachesBezierPath) { if(cachesBezierPath) {
@ -914,10 +950,8 @@ static Class NSBezierPath_concrete_class = nil;
[cacheimg release]; [cacheimg release];
cacheimg = [[NSImage alloc] initWithSize: [self bounds].size]; cacheimg = [[NSImage alloc] initWithSize: [self bounds].size];
[self movePathToPoint: NSMakePoint(0, 0)]; [self movePathToPoint: NSMakePoint(0, 0)];
PScurrentrgbcolor(&r, &g, &b);
[cacheimg lockFocus]; [cacheimg lockFocus];
PSsetrgbcolor(r, g, b);
for(i = 0; i < [pathElements count]; i++) { for(i = 0; i < [pathElements count]; i++) {
elm = [pathElements objectAtIndex: i]; elm = [pathElements objectAtIndex: i];
pts = [elm points]; pts = [elm points];
@ -985,6 +1019,36 @@ static Class NSBezierPath_concrete_class = nil;
} }
//
// Applying transformations.
//
- (void)transformUsingAffineTransform:(NSAffineTransform *)transform
{
PathElement *elm;
NSBezierPathElement t;
NSPoint p, *pts;
int i;
for(i = 0; i < [pathElements count]; i++) {
elm = [pathElements objectAtIndex: i];
pts = [elm points];
t = [elm type];
if(t == NSCurveToBezierPathElement) {
p = [transform transformPoint: pts[0]];
[elm setPointAtIndex: 0 toPoint: p];
p = [transform transformPoint: pts[1]];
[elm setPointAtIndex: 1 toPoint: p];
p = [transform transformPoint: pts[2]];
[elm setPointAtIndex: 2 toPoint: p];
} else {
p = [transform transformPoint: pts[0]];
[elm setPointAtIndex: 0 toPoint: p];
}
}
[self calculateDraftPolygon];
}
// //
// Path info // Path info
// //
@ -1229,6 +1293,83 @@ static Class NSBezierPath_concrete_class = nil;
[self calculateDraftPolygon]; [self calculateDraftPolygon];
} }
//
// NSCoding protocol
//
- (void)encodeWithCoder:(NSCoder *)aCoder
{
float f;
int i;
NSRect r;
[aCoder encodeValueOfObjCType: @encode(NSMutableArray) at: &pathElements];
[aCoder encodeValueOfObjCType: @encode(NSMutableArray) at: &subPaths];
r = [self bounds];
[aCoder encodeValueOfObjCType: @encode(NSRect) at: &r];
r = [self controlPointBounds];
[aCoder encodeValueOfObjCType: @encode(NSRect) at: &r];
f = [self lineWidth];
[aCoder encodeValueOfObjCType: @encode(float) at: &f];
i = [self lineCapStyle];
[aCoder encodeValueOfObjCType: @encode(int) at: &i];
i = [self lineJoinStyle];
[aCoder encodeValueOfObjCType: @encode(int) at: &i];
i = [self windingRule];
[aCoder encodeValueOfObjCType: @encode(int) at: &i];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &cachesBezierPath];
[aCoder encodeValueOfObjCType: @encode(NSImage) at: &cacheimg];
}
- (id)initWithCoder:(NSCoder *)aCoder
{
float f;
int i;
NSRect r;
self = [super init];
if(self) {
[aCoder decodeValueOfObjCType: @encode(NSMutableArray) at: &pathElements];
[aCoder decodeValueOfObjCType: @encode(NSMutableArray) at: &subPaths];
[aCoder decodeValueOfObjCType: @encode(NSRect) at: &r];
[self setBounds: r];
[aCoder decodeValueOfObjCType: @encode(NSRect) at: &r];
[self setControlPointBounds: r];
[aCoder decodeValueOfObjCType: @encode(float) at: &f];
[self setLineWidth: f];
[aCoder decodeValueOfObjCType: @encode(int) at: &i];
[self setLineCapStyle: i];
[aCoder decodeValueOfObjCType: @encode(int) at: &i];
[self setLineJoinStyle: i];
[aCoder decodeValueOfObjCType: @encode(int) at: &i];
[self setWindingRule: i];
[aCoder decodeValueOfObjCType: @encode(BOOL) at: &cachesBezierPath];
[aCoder decodeValueOfObjCType: @encode(NSImage) at: &cacheimg];
isValid = NO;
}
return self;
}
//
// NSCopying Protocol
//
- (id)copyWithZone:(NSZone *)zone
{
GSBezierPath *path = [[GSBezierPath allocWithZone: zone] init];
path->pathElements = [[pathElements copy] retain];
path->subPaths = [[subPaths copy] retain];
path->cachesBezierPath = cachesBezierPath;
if(cachesBezierPath && cacheimg)
path->cacheimg = [[cacheimg copy] retain];
[path setLineWidth: [self lineWidth]];
[path setLineCapStyle: [self lineCapStyle]];
[path setLineJoinStyle: [self lineJoinStyle]];
[path setWindingRule: [self windingRule]];
[path setBounds: [self bounds]];
[path setControlPointBounds: [self controlPointBounds]];
return path;
}
// //
// Private Methods // Private Methods
@ -1238,7 +1379,7 @@ static Class NSBezierPath_concrete_class = nil;
PathElement *elm; PathElement *elm;
NSBezierPathElement bpt; NSBezierPathElement bpt;
NSPoint p, *pts; NSPoint p, *pts;
double x, y, t, k = 0.025; double x, y, t, k = 0.25;
float maxx, minx, maxy, miny; float maxx, minx, maxy, miny;
float cpmaxx, cpminx, cpmaxy, cpminy; float cpmaxx, cpminx, cpmaxy, cpminy;
int i; int i;

View file

@ -47,6 +47,10 @@
#include <AppKit/NSTextFieldCell.h> #include <AppKit/NSTextFieldCell.h>
#include <AppKit/PSOperators.h> #include <AppKit/PSOperators.h>
#ifndef HAVE_RINTF
#define rintf rint
#endif
#define NSBR_COLUMN_SEP 6 #define NSBR_COLUMN_SEP 6
#define NSBR_VOFFSET 3 #define NSBR_VOFFSET 3
@ -951,6 +955,7 @@
// load column 0 // load column 0
[self _performLoadOfColumn: 0]; [self _performLoadOfColumn: 0];
[self _adjustMatrixOfColumn: 0];
_isLoaded = YES; _isLoaded = YES;
@ -984,6 +989,7 @@
// Perform the data load // Perform the data load
[self _performLoadOfColumn: column]; [self _performLoadOfColumn: column];
[self _adjustMatrixOfColumn: column];
// set last column loaded // set last column loaded
[self setLastColumn: column]; [self setLastColumn: column];
@ -2592,7 +2598,6 @@
[matrix setDoubleAction: @selector(doDoubleClick:)]; [matrix setDoubleAction: @selector(doDoubleClick:)];
// set new col matrix and release old // set new col matrix and release old
[[bc columnMatrix] release];
[bc setColumnMatrix: matrix]; [bc setColumnMatrix: matrix];
[sc setDocumentView: matrix]; [sc setDocumentView: matrix];

View file

@ -408,8 +408,10 @@
NSString *titleToDisplay; NSString *titleToDisplay;
NSRect titleRect; NSRect titleRect;
NSSize imageSize = {0, 0}; NSSize imageSize = {0, 0};
NSSize titleSize = {0, 0};
NSColor *backgroundColor = nil; NSColor *backgroundColor = nil;
BOOL flippedView = [controlView isFlipped]; BOOL flippedView = [controlView isFlipped];
NSCellImagePosition ipos = _cell.image_position;
// transparent buttons never draw // transparent buttons never draw
if (_buttoncell_is_transparent) if (_buttoncell_is_transparent)
@ -484,11 +486,29 @@
if (imageToDisplay) if (imageToDisplay)
{ {
imageSize = [imageToDisplay size];
[imageToDisplay setBackgroundColor: backgroundColor]; [imageToDisplay setBackgroundColor: backgroundColor];
imageSize = [imageToDisplay size];
} }
switch (_cell.image_position) if (titleToDisplay && (ipos == NSImageAbove || ipos == NSImageBelow))
{
titleSize = NSMakeSize([_cell_font widthOfString: titleToDisplay],
[_cell_font boundingRectForFont].size.height);
}
if (flippedView == YES)
{
if (ipos == NSImageAbove)
{
ipos = NSImageBelow;
}
else if (ipos == NSImageBelow)
{
ipos = NSImageAbove;
}
}
switch (ipos)
{ {
case NSNoImage: case NSNoImage:
imageToDisplay = nil; imageToDisplay = nil;
@ -541,44 +561,56 @@
break; break;
case NSImageAbove: case NSImageAbove:
imageRect.origin.x = cellFrame.origin.x; /* In this case, imageRect is all the space we can allocate above the text.
imageRect.size.width = cellFrame.size.width; The drawing code below will then center the image in imageRect. */
imageRect.size.height = imageSize.height;
titleRect.origin.x = cellFrame.origin.x; titleRect.origin.x = cellFrame.origin.x;
titleRect.origin.y = cellFrame.origin.y;
titleRect.size.width = cellFrame.size.width; titleRect.size.width = cellFrame.size.width;
titleRect.size.height = cellFrame.size.height - imageSize.height titleRect.size.height = titleSize.height;
- yDist;
// TODO: Add distance from border if needed imageRect.origin.x = cellFrame.origin.x;
if (flippedView) imageRect.origin.y = cellFrame.origin.y;
imageRect.origin.y += titleRect.size.height + yDist;
imageRect.size.width = cellFrame.size.width;
imageRect.size.height = cellFrame.size.height;
imageRect.size.height -= titleSize.height + yDist;
if (_cell.is_bordered || _cell.is_bezeled)
{ {
imageRect.origin.y = NSMinY(cellFrame); imageRect.size.width -= 6;
titleRect.origin.y = NSMaxY(cellFrame) - titleRect.size.height; imageRect.origin.x += 3;
} titleRect.size.width -= 6;
else titleRect.origin.x += 3;
{ imageRect.size.height -= 1;
imageRect.origin.y = NSMaxY(cellFrame) - imageRect.size.height; titleRect.size.height -= 1;
titleRect.origin.y = NSMinY(cellFrame); titleRect.origin.y += 1;
} }
break; break;
case NSImageBelow: case NSImageBelow:
imageRect.origin.x = cellFrame.origin.x; /* In this case, imageRect is all the space we can allocate below the text.
imageRect.size.width = cellFrame.size.width; The drawing code below will then center the image in imageRect. */
imageRect.size.height = imageSize.height;
titleRect.origin.x = cellFrame.origin.x; titleRect.origin.x = cellFrame.origin.x;
titleRect.origin.y = cellFrame.origin.y + cellFrame.size.height;
titleRect.origin.y -= titleSize.height;
titleRect.size.width = cellFrame.size.width; titleRect.size.width = cellFrame.size.width;
titleRect.size.height = cellFrame.size.height - imageSize.height titleRect.size.height = titleSize.height;
- yDist;
// TODO: Add distance from border if needed imageRect.origin.x = cellFrame.origin.x;
if (flippedView) imageRect.origin.y = cellFrame.origin.y;
imageRect.size.width = cellFrame.size.width;
imageRect.size.height = cellFrame.size.height;
imageRect.size.height -= titleSize.height + yDist;
if (_cell.is_bordered || _cell.is_bezeled)
{ {
imageRect.origin.y = NSMaxY(cellFrame) - imageRect.size.height; imageRect.size.width -= 6;
titleRect.origin.y = NSMinY(cellFrame); imageRect.origin.x += 3;
} titleRect.size.width -= 6;
else titleRect.origin.x += 3;
{ imageRect.size.height -= 1;
imageRect.origin.y = NSMinY(cellFrame); imageRect.origin.y += 1;
titleRect.origin.y = NSMaxY(cellFrame) - titleRect.size.height; titleRect.size.height -= 1;
} }
break; break;
@ -683,7 +715,7 @@
case NSImageBelow: case NSImageBelow:
case NSImageAbove: case NSImageAbove:
if (imageSize.width > titleSize.width) if (imageSize.width > titleSize.width)
s.height = imageSize.width; s.width = imageSize.width;
else else
s.width = titleSize.width; s.width = titleSize.width;
s.height = imageSize.height + titleSize.height; // + yDist ?? s.height = imageSize.height + titleSize.height; // + yDist ??
@ -720,7 +752,7 @@
// Add border size // Add border size
s.width += 2 * borderSize.width; s.width += 2 * borderSize.width;
s.height += 2 * borderSize.height; s.height += 2 * borderSize.height;
return s; return s;
} }

View file

@ -346,8 +346,18 @@ static NSColor *shadowCol;
*/ */
- (void) setState: (int)value - (void) setState: (int)value
{ {
// FIXME /* We do exactly as in macosx when value is not NSOnState,
_cell.state = value; * NSOffState, NSMixedState, even if their behaviour (value < 0 ==>
* NSMixedState) is a bit strange. We could decide to do
* differently in the future, so please use always symbolic
* constants when calling this method, this way your code won't be
* broken by changes. */
if (value > 0)
_cell.state = NSOnState;
else if (value == 0 || (_cell.allows_mixed_state == NO))
_cell.state = NSOffState;
else
_cell.state = NSMixedState;
} }
- (int) state - (int) state

View file

@ -129,7 +129,7 @@ NSGraphicsContext *GSCurrentContext()
*/ */
NSThread *th = GSCurrentThread(); NSThread *th = GSCurrentThread();
th->_gcontext = context; ASSIGN(th->_gcontext, context);
#else #else
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary]; NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];

File diff suppressed because it is too large Load diff

View file

@ -348,6 +348,8 @@ static SEL getSel = @selector(objectAtIndex:);
cells[i][column] = old; cells[i][column] = old;
selectedCells[i][column] = NO; selectedCells[i][column] = NO;
} }
if (_selectedCell && (_selectedColumn >= column))
_selectedColumn++;
} }
/* /*
@ -425,6 +427,8 @@ static SEL getSel = @selector(objectAtIndex:);
} }
cells[row] = oldr; cells[row] = oldr;
selectedCells[row] = olds; selectedCells[row] = olds;
if (_selectedCell && (_selectedRow >= row))
_selectedRow++;
} }
/* /*
@ -501,7 +505,13 @@ static SEL getSel = @selector(objectAtIndex:);
[NSException raise: NSRangeException [NSException raise: NSRangeException
format: @"attempt to put cell outside matrix bounds"]; format: @"attempt to put cell outside matrix bounds"];
} }
if ((row == _selectedRow) && (column == _selectedColumn)
&& (_selectedCell != nil))
_selectedCell = newCell;
ASSIGN(cells[row][column], newCell); ASSIGN(cells[row][column], newCell);
[self setNeedsDisplayInRect: [self cellFrameAtRow: row column: column]]; [self setNeedsDisplayInRect: [self cellFrameAtRow: row column: column]];
} }
@ -1780,6 +1790,15 @@ static SEL getSel = @selector(objectAtIndex:);
static MPoint anchor = {0, 0}; static MPoint anchor = {0, 0};
int clickCount; int clickCount;
/*
* Pathological case -- ignore mouse down
*/
if ((numRows == 0) || (numCols == 0))
{
[super mouseDown: theEvent];
return;
}
// Manage multi-click events // Manage multi-click events
clickCount = [theEvent clickCount]; clickCount = [theEvent clickCount];

View file

@ -496,16 +496,16 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
// Managing Submenus. // Managing Submenus.
// //
- (void) setSubmenu: (NSMenu *)aMenu - (void) setSubmenu: (NSMenu *)aMenu
forItem: (id <NSMenuItem>) anItem forItem: (id <NSMenuItem>)anItem
{ {
[(NSMenuItem *)anItem setSubmenu: aMenu]; [(NSMenuItem *)anItem setSubmenu: aMenu];
[anItem setTarget: self]; [anItem setTarget: self];
[anItem setAction: @selector(submenuAction:)]; [anItem setAction: @selector(submenuAction:)];
if (aMenu) if (aMenu != nil)
aMenu->menu_supermenu = self; {
aMenu->menu_supermenu = self;
ASSIGN(aMenu->menu_title, [anItem title]); ASSIGN(aMenu->menu_title, [anItem title]);
}
[self itemChanged: anItem]; [self itemChanged: anItem];
} }
@ -856,66 +856,37 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
{ {
[encoder encodeObject: menu_title]; [encoder encodeObject: menu_title];
[encoder encodeObject: menu_items]; [encoder encodeObject: menu_items];
[encoder encodeObject: menu_view];
[encoder encodeConditionalObject: menu_supermenu];
[encoder encodeConditionalObject: menu_popb];
[encoder encodeValueOfObjCType: @encode(BOOL) at: &menu_autoenable]; [encoder encodeValueOfObjCType: @encode(BOOL) at: &menu_autoenable];
[encoder encodeValueOfObjCType: @encode(BOOL) at: &menu_is_tornoff];
[encoder encodeValueOfObjCType: @encode(BOOL)
at: &menu_is_beholdenToPopUpButton];
} }
- (id) initWithCoder: (NSCoder*)decoder - (id) initWithCoder: (NSCoder*)decoder
{ {
NSNotificationCenter *theCenter = [NSNotificationCenter defaultCenter]; NSString *dTitle;
NSRect winRect = {{0,0},{20,23}}; NSArray *dItems;
BOOL dAuto;
unsigned i;
[decoder decodeValueOfObjCType: @encode(id) at: &menu_title]; dTitle = [decoder decodeObject];
[decoder decodeValueOfObjCType: @encode(id) at: &menu_items]; dItems = [decoder decodeObject];
[decoder decodeValueOfObjCType: @encode(id) at: &menu_view]; [decoder decodeValueOfObjCType: @encode(BOOL) at: &dAuto];
[menu_view setMenu: self]; // Sets notifications up
menu_supermenu = [decoder decodeObject];
menu_popb = [decoder decodeObject];
[decoder decodeValueOfObjCType: @encode(BOOL) at: &menu_autoenable];
[decoder decodeValueOfObjCType: @encode(BOOL) at: &menu_is_tornoff];
[decoder decodeValueOfObjCType: @encode(BOOL)
at: &menu_is_beholdenToPopUpButton];
menu_attachedMenu = nil; self = [self initWithTitle: dTitle];
menu_changedMessagesEnabled = YES; [self setAutoenablesItems: dAuto];
menu_notifications = [NSMutableArray new];
menu_follow_transient = NO;
menu_is_visible = NO;
// Mark the menu as changed in order to get it resized. /*
menu_changed = YES; * Make sure that items and submenus are set correctly.
*/
for (i = 0; i < [dItems count]; i++)
{
NSMenuItem *item = [dItems objectAtIndex: i];
NSMenu *sub = [item submenu];
// Transient windows private stuff. [self addItem: item];
_oldAttachedMenu = nil; if (sub != nil)
{
// Create the windows that will display the menu. [self setSubmenu: sub forItem: item];
aWindow = [[NSMenuWindow alloc] initWithContentRect: winRect }
styleMask: NSBorderlessWindowMask }
backing: NSBackingStoreRetained
defer: NO];
bWindow = [[NSMenuWindow alloc] initWithContentRect: winRect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
titleView = [NSMenuWindowTitleView new];
[titleView setFrameOrigin: NSMakePoint(0, winRect.size.height - 23)];
[titleView setFrameSize: NSMakeSize (winRect.size.width, 23)];
[[aWindow contentView] addSubview: menu_view];
[[aWindow contentView] addSubview: titleView];
[titleView setMenu: self];
// Set up the notification to start the process of redisplaying
// the menus where the user left them the last time.
[theCenter addObserver: self
selector: @selector(_showTornOffMenuIfAny:)
name: NSApplicationWillFinishLaunchingNotification
object: NSApp];
return self; return self;
} }
@ -1010,7 +981,10 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
defaults = [NSUserDefaults standardUserDefaults]; defaults = [NSUserDefaults standardUserDefaults];
menuLocations = [[defaults objectForKey: NSMenuLocationsKey] mutableCopy]; menuLocations = [[defaults objectForKey: NSMenuLocationsKey] mutableCopy];
[menuLocations removeObjectForKey: key]; [menuLocations removeObjectForKey: key];
[defaults setObject: menuLocations forKey: NSMenuLocationsKey]; if ([menuLocations count] > 0)
[defaults setObject: menuLocations forKey: NSMenuLocationsKey];
else
[defaults removeObjectForKey: NSMenuLocationsKey];
RELEASE(menuLocations); RELEASE(menuLocations);
[defaults synchronize]; [defaults synchronize];
} }
@ -1448,7 +1422,9 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
defaults = [NSUserDefaults standardUserDefaults]; defaults = [NSUserDefaults standardUserDefaults];
menuLocations = [[defaults objectForKey: NSMenuLocationsKey] mutableCopy]; menuLocations = [[defaults objectForKey: NSMenuLocationsKey] mutableCopy];
if (menuLocations == nil) if (menuLocations == nil)
menuLocations = [NSMutableDictionary dictionaryWithCapacity: 2]; {
menuLocations = [[NSMutableDictionary alloc] initWithCapacity: 2];
}
locString = [[menu window] stringWithSavedFrame]; locString = [[menu window] stringWithSavedFrame];
[menuLocations setObject: locString forKey: key]; [menuLocations setObject: locString forKey: key];
[defaults setObject: menuLocations forKey: NSMenuLocationsKey]; [defaults setObject: menuLocations forKey: NSMenuLocationsKey];

View file

@ -70,7 +70,6 @@ static Class imageClass;
- (id) init - (id) init
{ {
self = [super init]; self = [super init];
mi_hasSubmenu = NO;
mi_target = nil; mi_target = nil;
mi_menu = nil; mi_menu = nil;
mi_mnemonicLocation = 255; // No mnemonic mi_mnemonicLocation = 255; // No mnemonic
@ -395,7 +394,6 @@ static Class imageClass;
- (void) encodeWithCoder: (NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
[super encodeWithCoder: aCoder]; [super encodeWithCoder: aCoder];
[aCoder encodeConditionalObject: mi_menu];
[aCoder encodeObject: mi_title]; [aCoder encodeObject: mi_title];
[aCoder encodeObject: mi_keyEquivalent]; [aCoder encodeObject: mi_keyEquivalent];
[aCoder encodeValueOfObjCType: "I" at: &mi_keyEquivalentModifierMask]; [aCoder encodeValueOfObjCType: "I" at: &mi_keyEquivalentModifierMask];
@ -417,7 +415,6 @@ static Class imageClass;
- (id) initWithCoder: (NSCoder*)aDecoder - (id) initWithCoder: (NSCoder*)aDecoder
{ {
self = [super initWithCoder: aDecoder]; self = [super initWithCoder: aDecoder];
mi_menu = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(id) at: &mi_title]; [aDecoder decodeValueOfObjCType: @encode(id) at: &mi_title];
[aDecoder decodeValueOfObjCType: @encode(id) at: &mi_keyEquivalent]; [aDecoder decodeValueOfObjCType: @encode(id) at: &mi_keyEquivalent];
[aDecoder decodeValueOfObjCType: "I" at: &mi_keyEquivalentModifierMask]; [aDecoder decodeValueOfObjCType: "I" at: &mi_keyEquivalentModifierMask];

View file

@ -159,9 +159,11 @@ static NSImage *arrowImageH = nil;
} }
// Image // Image
if ((anImage = [mcell_item image])) if ((anImage = [mcell_item image]) && _cell.image_position == NSNoImage)
[self setImagePosition: NSImageLeft]; [self setImagePosition: NSImageLeft];
componentSize = [anImage size]; componentSize = NSMakeSize(0,0);
if (anImage)
componentSize = [anImage size];
mcell_imageWidth = componentSize.width; mcell_imageWidth = componentSize.width;
if (componentSize.height > neededMenuItemHeight) if (componentSize.height > neededMenuItemHeight)
neededMenuItemHeight = componentSize.height; neededMenuItemHeight = componentSize.height;
@ -245,6 +247,13 @@ static NSImage *arrowImageH = nil;
// //
- (NSRect) imageRectForBounds:(NSRect)cellFrame - (NSRect) imageRectForBounds:(NSRect)cellFrame
{ {
if (_mcell_belongs_to_popupbutton && _cell.image_position)
{
/* Special case: draw image on the extreme right [FIXME check the distance]*/
cellFrame.origin.x += cellFrame.size.width - mcell_imageWidth - 2;
cellFrame.size.width = mcell_imageWidth;
return cellFrame;
}
// Calculate the image part of cell frame from NSMenuView // Calculate the image part of cell frame from NSMenuView
cellFrame.origin.x += [mcell_menuView imageAndTitleOffset]; cellFrame.origin.x += [mcell_menuView imageAndTitleOffset];
cellFrame.size.width = [mcell_menuView imageAndTitleWidth]; cellFrame.size.width = [mcell_menuView imageAndTitleWidth];

View file

@ -228,8 +228,18 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
- (void) setMenuItemCell: (NSMenuItemCell *)cell - (void) setMenuItemCell: (NSMenuItemCell *)cell
forItemAtIndex: (int)index forItemAtIndex: (int)index
{ {
NSMenuItem *anItem = [menuv_items_link objectAtIndex: index];
[menuv_itemCells replaceObjectAtIndex: index withObject: cell]; [menuv_itemCells replaceObjectAtIndex: index withObject: cell];
[cell setMenuItem: anItem];
[cell setMenuView: self];
if ([self highlightedItemIndex] == index)
[cell setHighlighted: YES];
else
[cell setHighlighted: NO];
// Mark the new cell and the menu view as needing resizing. // Mark the new cell and the menu view as needing resizing.
[cell setNeedsSizing: YES]; [cell setNeedsSizing: YES];
[self setNeedsSizing: YES]; [self setNeedsSizing: YES];

View file

@ -195,16 +195,19 @@ Class _nspopupbuttonCellClass = 0;
- (void) selectItem: (id <NSMenuItem>)anObject - (void) selectItem: (id <NSMenuItem>)anObject
{ {
[_cell selectItem: anObject]; [_cell selectItem: anObject];
[self synchronizeTitleAndSelectedItem];
} }
- (void) selectItemAtIndex: (int)index - (void) selectItemAtIndex: (int)index
{ {
[_cell selectItemAtIndex: index]; [_cell selectItemAtIndex: index];
[self synchronizeTitleAndSelectedItem];
} }
- (void) selectItemWithTitle: (NSString*)title - (void) selectItemWithTitle: (NSString*)title
{ {
[_cell selectItemWithTitle: title]; [_cell selectItemWithTitle: title];
[self synchronizeTitleAndSelectedItem];
} }
- (int) numberOfItems - (int) numberOfItems
@ -302,7 +305,8 @@ Class _nspopupbuttonCellClass = 0;
NSMenuView *mr = [[_cell menu] menuRepresentation]; NSMenuView *mr = [[_cell menu] menuRepresentation];
NSEvent *e; NSEvent *e;
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSPoint p;
if ([self isEnabled] == NO) if ([self isEnabled] == NO)
return; return;
@ -313,12 +317,23 @@ Class _nspopupbuttonCellClass = 0;
[_cell attachPopUpWithFrame: _bounds [_cell attachPopUpWithFrame: _bounds
inView: self]; inView: self];
{
// Hack, function in NSPopUpButtonCell
extern NSPoint
_convertBaseToScreen_with_fix (NSRect frame, NSWindow *window,
NSPoint point);
p = [[mr window]
convertScreenToBase:
_convertBaseToScreen_with_fix ([self convertRect:_bounds
toView: nil], _window,
[theEvent locationInWindow])];
}
// Process events; we start menu events processing by converting // Process events; we start menu events processing by converting
// this event to the menu window, and sending it there. // this event to the menu window, and sending it there.
e = [NSEvent mouseEventWithType: [theEvent type] e = [NSEvent mouseEventWithType: [theEvent type]
location: [[mr window] convertScreenToBase: location: p
[_window convertBaseToScreen:
[theEvent locationInWindow]]]
modifierFlags: [theEvent modifierFlags] modifierFlags: [theEvent modifierFlags]
timestamp: [theEvent timestamp] timestamp: [theEvent timestamp]
windowNumber: [[mr window] windowNumber] windowNumber: [[mr window] windowNumber]
@ -336,8 +351,7 @@ Class _nspopupbuttonCellClass = 0;
// Send action to target // Send action to target
[super sendAction: [self action] [super sendAction: [self action]
to: [self target]]; to: [self target]];
} }
/* /*
@ -345,30 +359,58 @@ Class _nspopupbuttonCellClass = 0;
*/ */
- (void) encodeWithCoder: (NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
int i;
BOOL f;
id c;
/*
* Don't encode all the cell information!
*/
c = RETAIN([self cell]);
[super encodeWithCoder: aCoder]; [super encodeWithCoder: aCoder];
/* [self setCell: c];
[aCoder encodeObject: list_items]; RELEASE(c);
[aCoder encodeRect: list_rect]; f = [self pullsDown];
[aCoder encodeValueOfObjCType: @encode(int) at: &selected_item]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &f];
[aCoder encodeConditionalObject: pub_target]; [aCoder encodeObject: [self itemArray]];
[aCoder encodeValueOfObjCType: @encode(SEL) at: &pub_action]; i = [self indexOfSelectedItem];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_up]; [aCoder encodeValueOfObjCType: @encode(int) at: &i];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &pulls_down];
*/
} }
- (id) initWithCoder: (NSCoder*)aDecoder - (id) initWithCoder: (NSCoder*)aDecoder
{ {
NSArray *dItems;
int dSelected;
BOOL dPull;
unsigned i;
id aCell;
[super initWithCoder: aDecoder]; [super initWithCoder: aDecoder];
/* /*
[aDecoder decodeValueOfObjCType: @encode(id) at: &list_items]; * Set a newly created cell.
list_rect = [aDecoder decodeRect]; */
[aDecoder decodeValueOfObjCType: @encode(int) at: &selected_item]; aCell = [[[self class] cellClass] new];
pub_target = [aDecoder decodeObject]; [self setCell: aCell];
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &pub_action]; RELEASE(aCell);
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_up]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &dPull];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &pulls_down]; [self setPullsDown: dPull];
*/ dItems = [aDecoder decodeObject];
for (i = 0; i < [dItems count]; i++)
{
NSMenuItem *dItem = [dItems objectAtIndex: i];
NSMenuItem *item;
[self addItemWithTitle: [dItem title]];
item = [self itemAtIndex: i];
[item setTarget: [dItem target]];
[item setAction: [dItem action]];
[item setEnabled: [dItem isEnabled]];
[item setTag: [dItem tag]];
[item setKeyEquivalent: [dItem keyEquivalent]];
}
[aDecoder decodeValueOfObjCType: @encode(int) at: &dSelected];
[self selectItemAtIndex: dSelected];
[self synchronizeTitleAndSelectedItem];
return self; return self;
} }

View file

@ -36,7 +36,75 @@
#include <AppKit/NSPopUpButtonCell.h> #include <AppKit/NSPopUpButtonCell.h>
#include <AppKit/PSOperators.h> #include <AppKit/PSOperators.h>
@interface NSMenuItemCell (GNUStepPrivate)
- (void) setBelongsToPopUpButton: (BOOL)flag;
@end
@implementation NSMenuItemCell (GNUStepPrivate)
- (void) setBelongsToPopUpButton: (BOOL)flag
{
_mcell_belongs_to_popupbutton = flag;
}
@end
/* Same as [NSWindow -convertBaseToScreen:] with the difference
that detects and fixes at run time bugs in the window frame management */
/* frame is a frame where the mouse is supposed to be.
If the mouse is out of that frame, it means the window code has got the
window origin wrong -- presumably by a decoration height.
Looking if mouse is upper or lower than the given frame we determine
if decoration window size need to be added or subtracted. */
NSPoint
_convertBaseToScreen_with_fix(NSRect frame, NSWindow *window, NSPoint point)
{
/* We get mouse position */
NSPoint mouse = [window mouseLocationOutsideOfEventStream];
float l, r, b;
float t = 0;
NSPoint ret;
/* If the reported mouse position is not in frame
this means that the window frame origin is broken. */
if (mouse.y > frame.origin.y + frame.size.height)
{
NSLog (@"Window Frame Origin Bug Detected: point reported higher");
NSLog (@"Workaround enabled.");
DPSstyleoffsets (GSCurrentContext (), &l, &r, &t, &b,
[window styleMask]);
}
else if (mouse.y < frame.origin. y)
{
NSLog (@"Window Frame Origin Bug Detected: point reported lower");
NSLog (@"Workaround enabled.");
DPSstyleoffsets (GSCurrentContext (), &l, &r, &t, &b,
[window styleMask]);
t = -t;
}
/* Convert the origin */
ret = [window convertBaseToScreen: point];
/* Add the bug correction */
ret.y += t;
return ret;
}
/* The image to use in a specific popupbutton is
* _pbc_image[_pbcFlags.pullsDown]; that is, _pbc_image[0] if it is a
* popup menu, _pbc_image[1] if it is a pulls down list. */
static NSImage *_pbc_image[2];
@implementation NSPopUpButtonCell @implementation NSPopUpButtonCell
+ (void) initialize
{
if (self == [NSPopUpButtonCell class])
{
[self setVersion: 1];
ASSIGN(_pbc_image[0], [NSImage imageNamed: @"common_Nibble"]);
ASSIGN(_pbc_image[1], [NSImage imageNamed: @"common_3DArrowDown"]);
}
}
- (void) dealloc - (void) dealloc
{ {
RELEASE(_menu); RELEASE(_menu);
@ -146,15 +214,8 @@
// Adding and removing items // Adding and removing items
- (void) addItemWithTitle: (NSString *)title - (void) addItemWithTitle: (NSString *)title
{ {
NSMenuItem *anItem = [NSMenuItem new]; [self insertItemWithTitle: title
atIndex: [_menu numberOfItems]];
[anItem setTitle: title];
// Not bad as defaults:
[anItem setTarget: nil];
[anItem setAction: NULL];
[_menu insertItem: anItem atIndex: [_menu numberOfItems]];
RELEASE(anItem);
} }
- (void) addItemsWithTitles: (NSArray *)itemTitles - (void) addItemsWithTitles: (NSArray *)itemTitles
@ -171,19 +232,25 @@
- (void) insertItemWithTitle: (NSString *)title atIndex: (int)index - (void) insertItemWithTitle: (NSString *)title atIndex: (int)index
{ {
NSMenuItem *anItem = [NSMenuItem new]; NSMenuItem *anItem = [NSMenuItem new];
NSMenuItemCell *aCell;
int count = [_menu numberOfItems];
if (index < 0) if (index < 0)
index = 0; index = 0;
if (index > [_menu numberOfItems]) if (index > count)
index = [_menu numberOfItems]; index = count;
[anItem setTitle: title]; [anItem setTitle: title];
// Not bad as defaults:
[anItem setTarget: nil]; [anItem setTarget: nil];
[anItem setAction: NULL]; [anItem setAction: NULL];
[_menu insertItem: anItem atIndex: index]; [_menu insertItem: anItem atIndex: index];
RELEASE(anItem); RELEASE(anItem);
aCell = [[_menu menuRepresentation] menuItemCellForItemAtIndex: index];
[aCell setBelongsToPopUpButton: YES];
[aCell setImagePosition: NSImageRight];
} }
- (void) removeItemWithTitle: (NSString *)title - (void) removeItemWithTitle: (NSString *)title
@ -265,8 +332,11 @@
if (!item) if (!item)
{ {
if (_pbcFlags.altersStateOfSelectedItem) if (_pbcFlags.altersStateOfSelectedItem)
[_selectedItem setState: NSOffState]; {
[_selectedItem setState: NSOffState];
[_selectedItem setChangesState: NO];
}
[_selectedItem setImage: nil];
_selectedItem = nil; _selectedItem = nil;
} }
else else
@ -274,18 +344,32 @@
if (_pbcFlags.altersStateOfSelectedItem) if (_pbcFlags.altersStateOfSelectedItem)
{ {
[_selectedItem setState: NSOffState]; [_selectedItem setState: NSOffState];
} [_selectedItem setChangesState: NO];
}
[_selectedItem setImage: nil];
_selectedItem = item; _selectedItem = item;
if (_pbcFlags.altersStateOfSelectedItem) if (_pbcFlags.altersStateOfSelectedItem)
{ {
[_selectedItem setState: NSOnState]; [_selectedItem setState: NSOnState];
[_selectedItem setChangesState: NO];
} }
[_selectedItem setImage: _pbc_image[_pbcFlags.pullsDown]];
} }
/* Set the item in the menu */
[(NSMenuView *)[_menu menuRepresentation] setHighlightedItemIndex:
[_menu indexOfItem: _selectedItem]];
} }
- (void) selectItemAtIndex: (int)index - (void) selectItemAtIndex: (int)index
{ {
NSMenuItem *anItem = (index == -1) ? nil : [self itemAtIndex: index]; NSMenuItem *anItem;
if (index < 0)
anItem = nil;
else
anItem = [self itemAtIndex: index];
[self selectItem: anItem]; [self selectItem: anItem];
} }
@ -349,8 +433,8 @@
} }
else else
{ {
int index = [[_menu menuRepresentation] highlightedItemIndex]; int index = [[_menu menuRepresentation] highlightedItemIndex];
if (index < 0) if (index < 0)
index = 0; index = 0;
[self selectItemAtIndex: index]; [self selectItemAtIndex: index];
@ -393,6 +477,8 @@
NSWindow *cvWin = [controlView window]; NSWindow *cvWin = [controlView window];
NSMenuView *mr = [_menu menuRepresentation]; NSMenuView *mr = [_menu menuRepresentation];
int items; int items;
NSRect origCellFrame = [controlView convertRect: cellFrame
toView: nil];
[nc postNotificationName: NSPopUpButtonCellWillPopUpNotification [nc postNotificationName: NSPopUpButtonCellWillPopUpNotification
object: self]; object: self];
@ -417,10 +503,14 @@
} }
// Convert to Screen Coordinates // Convert to Screen Coordinates
/* Convert to content view */
cellFrame = [controlView convertRect: cellFrame cellFrame = [controlView convertRect: cellFrame
toView: nil]; toView: nil];
cellFrame.origin = [cvWin convertBaseToScreen: cellFrame.origin];
cellFrame.origin = _convertBaseToScreen_with_fix (origCellFrame, cvWin,
cellFrame.origin);
// Ask the MenuView to attach the menu to this rect // Ask the MenuView to attach the menu to this rect
if (_pbcFlags.pullsDown) if (_pbcFlags.pullsDown)
{ {
@ -464,17 +554,6 @@
// This method is not executed upon mouse down; rather, it should // This method is not executed upon mouse down; rather, it should
// simulate what would happen upon mouse down. It should not start // simulate what would happen upon mouse down. It should not start
// any real mouse tracking. // any real mouse tracking.
/*
int indexToClick;
[self attachPopUpWithFrame: frame
inView: controlView];
indexToClick = [[_menu menuRepresentation] indexOfItemAtPoint:
[[_menu window] mouseLocationOutsideOfEventStream]];
[[_menu menuRepresentation] mouseDown: [NSApp currentEvent]];
[[[_menu menuRepresentation] menuItemCellForItemAtIndex: indexToClick]
performClick: nil];*/
} }
// Arrow position for bezel style and borderless popups. // Arrow position for bezel style and borderless popups.
@ -483,18 +562,26 @@
return _pbcFlags.arrowPosition; return _pbcFlags.arrowPosition;
} }
/*
* Does nothing for now.
*/
- (void) setArrowPosition: (NSPopUpArrowPosition)position - (void) setArrowPosition: (NSPopUpArrowPosition)position
{ {
_pbcFlags.arrowPosition = position; _pbcFlags.arrowPosition = position;
} }
/*
* What would be nice and natural is to make this drawing using the same code
* that is used to draw cells in the menu.
* This looks like a mess to do in this framework.
*/
- (void) drawWithFrame: (NSRect)cellFrame - (void) drawWithFrame: (NSRect)cellFrame
inView: (NSView*)view inView: (NSView*)view
{ {
NSSize size; NSSize size;
NSPoint position; NSPoint position;
NSImage *aImage; NSImage *anImage;
// Save last view drawn to // Save last view drawn to
if (_control_view != view) if (_control_view != view)
_control_view = view; _control_view = view;
@ -508,17 +595,13 @@
cellFrame.size.width -= 5; cellFrame.size.width -= 5;
[self _drawText: [self titleOfSelectedItem] inFrame: cellFrame]; [self _drawText: [self titleOfSelectedItem] inFrame: cellFrame];
anImage = _pbc_image[_pbcFlags.pullsDown];
if (_pbcFlags.pullsDown) /* NB: If we are drawing here, then the control can't be selected */
{ [anImage setBackgroundColor: [NSColor controlBackgroundColor]];
aImage = [NSImage imageNamed: @"common_3DArrowDown"];
}
else
{
aImage = [NSImage imageNamed: @"common_Nibble"];
}
size = [aImage size]; size = [anImage size];
position.x = cellFrame.origin.x + cellFrame.size.width - size.width - 4; position.x = cellFrame.origin.x + cellFrame.size.width - size.width - 4;
position.y = MAX(NSMidY(cellFrame) - (size.height/2.), 0.); position.y = MAX(NSMidY(cellFrame) - (size.height/2.), 0.);
/* /*
@ -527,9 +610,8 @@
*/ */
if ([view isFlipped]) if ([view isFlipped])
position.y += size.height; position.y += size.height;
[aImage compositeToPoint: position operation: NSCompositeCopy]; [anImage compositeToPoint: position operation: NSCompositeCopy];
[view unlockFocus]; [view unlockFocus];
} }
@end @end

View file

@ -37,10 +37,6 @@
// - optimization: 3.paragraph made one less line due to delition // - optimization: 3.paragraph made one less line due to delition
// of single char [opti hook 1; diff from 1.] // of single char [opti hook 1; diff from 1.]
#if !defined(ABS)
#define ABS(A) ({ typeof(A) __a = (A); __a < 0 ? - __a : __a; })
#endif // the definition in gstep-base produces warnings FIX ME FAR
#include <gnustep/gui/config.h> #include <gnustep/gui/config.h>
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
@ -68,6 +64,23 @@
#define HUGE 1e99 #define HUGE 1e99
/*
* A little utility function to determine the range of characters in a scanner
* that are present in a specified character set.
*/
static inline NSRange
scanRange(NSScanner *scanner, NSCharacterSet* aSet)
{
unsigned start = [scanner scanLocation];
unsigned end = start;
if ([scanner scanCharactersFromSet: aSet intoString: 0] == YES)
{
end = [scanner scanLocation];
}
return NSMakeRange(start, end - start);
}
enum { enum {
NSBackspaceKey = 8, NSBackspaceKey = 8,
NSCarriageReturnKey = 13, NSCarriageReturnKey = 13,
@ -82,7 +95,6 @@ enum {
float drawingOffset; float drawingOffset;
BOOL dontDisplay; BOOL dontDisplay;
unsigned type; unsigned type;
NSString *fingerprintString; // obsolete, unused
} }
typedef enum typedef enum
@ -106,8 +118,6 @@ typedef enum
- (void) setDrawingOffset: (float) anOffset; - (void) setDrawingOffset: (float) anOffset;
- (void) setDontDisplay: (BOOL) flag; - (void) setDontDisplay: (BOOL) flag;
- (void) setType: (unsigned) aType; - (void) setType: (unsigned) aType;
- (NSString*) fingerprintString;
- (void) setFingerprintString: (NSString*) aString;
- (BOOL) isLineTerminatingParagraph; - (BOOL) isLineTerminatingParagraph;
- (NSString*) description; - (NSString*) description;
@ -151,11 +161,6 @@ typedef enum
return drawingOffset; return drawingOffset;
} }
- (NSString*) fingerprintString
{
return fingerprintString;
}
- (void) setLineRange: (NSRange) aRange - (void) setLineRange: (NSRange) aRange
{ {
lineRange = aRange; lineRange = aRange;
@ -184,17 +189,11 @@ typedef enum
type = aType; type = aType;
} }
- (void) setFingerprintString: (NSString*) aString
{
ASSIGN (fingerprintString, aString);
}
- (NSString*) description - (NSString*) description
{ {
return [[NSDictionary dictionaryWithObjectsAndKeys: return [[NSDictionary dictionaryWithObjectsAndKeys:
NSStringFromRange(lineRange), @"LineRange", NSStringFromRange(lineRange), @"LineRange",
NSStringFromRect(lineRect), @"LineRect", NSStringFromRect(lineRect), @"LineRect",
fingerprintString, @"fingerprint",
nil] nil]
description]; description];
} }
@ -204,13 +203,6 @@ typedef enum
// sort of hackish // sort of hackish
return type == LineLayoutInfoType_Paragraph && lineRect.origin.x> 0; return type == LineLayoutInfoType_Paragraph && lineRect.origin.x> 0;
} }
- (void) dealloc
{
if (fingerprintString)
[fingerprintString release];
[super dealloc];
}
@end @end
static NSRange MakeRangeFromAbs (int a1,int a2) // not the same as NSMakeRange! static NSRange MakeRangeFromAbs (int a1,int a2) // not the same as NSMakeRange!
@ -233,118 +225,6 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
*/ */
// end: _GNULineLayoutInfo------------------------------------------------------------------------------------------ // end: _GNULineLayoutInfo------------------------------------------------------------------------------------------
// NeXT's NSScanner's scanCharactersFromSet and friends seem to be
// a bit sluggish on whitespaces and newlines
// (have not tried GNUstep - base implementation though).
// so here is a more pedantic (and faster) implementation:
// this class should be considered private since it is not polished at all!
@interface _GNUTextScanner: NSObject
{
NSString *string;
NSCharacterSet *set,*iSet;
unsigned stringLength;
NSRange activeRange;
}
+ (_GNUTextScanner*) scannerWithString: (NSString*) aStr
set: (NSCharacterSet*) aSet
invertedSet: (NSCharacterSet*) anInvSet;
- (void) setString: (NSString*) aString set: (NSCharacterSet*)
aSet invertedSet: (NSCharacterSet*) anInvSet;
- (NSRange) _scanCharactersInverted: (BOOL) inverted;
- (NSRange) scanSetCharacters;
- (NSRange) scanNonSetCharacters;
- (BOOL) isAtEnd;
- (unsigned) scanLocation;
- (void) setScanLocation: (unsigned) aLoc;
@end
@implementation _GNUTextScanner
+ (_GNUTextScanner*) scannerWithString: (NSString*) aStr
set: (NSCharacterSet*) aSet
invertedSet: (NSCharacterSet*) anInvSet
{
_GNUTextScanner *ret = [[self alloc] init];
[ret setString: aStr set: aSet invertedSet: anInvSet];
return [ret autorelease];
}
- (void) setString: (NSString*) aString set: (NSCharacterSet*) aSet
invertedSet: (NSCharacterSet*) anInvSet
{
ASSIGN (string, aString);
stringLength = [string length];
activeRange = NSMakeRange (0, stringLength);
ASSIGN (set, aSet);
ASSIGN (iSet, anInvSet);
}
- (NSRange) _scanCharactersInverted: (BOOL) inverted
{
NSRange range = NSMakeRange (activeRange.location, 0);
NSCharacterSet *currentSet = inverted? iSet: set;
NSCharacterSet *currentISet = inverted? set: iSet;
if (activeRange.location >= stringLength)
return range;
if ([currentSet characterIsMember: [string characterAtIndex:
activeRange.location]])
{
range = [string rangeOfCharacterFromSet: currentSet options: 0
range: activeRange];
}
if (range.length)
{
NSRange iRange = range;
iRange = [string rangeOfCharacterFromSet: currentISet options: 0
range: MakeRangeFromAbs (NSMaxRange (range),
stringLength)];
if (iRange.length)
range = MakeRangeFromAbs (range.location, iRange.location);
else
range = MakeRangeFromAbs (range.location, stringLength);
activeRange = MakeRangeFromAbs (NSMaxRange(range), stringLength);
}
return range;
}
- (NSRange) scanSetCharacters
{
return [self _scanCharactersInverted: NO];
}
- (NSRange) scanNonSetCharacters
{
return [self _scanCharactersInverted: YES];
}
- (BOOL) isAtEnd
{
return activeRange.location >= stringLength;
}
- (unsigned) scanLocation
{
return activeRange.location;
}
- (void) setScanLocation: (unsigned) aLoc
{
activeRange = MakeRangeFromAbs (aLoc, stringLength);
}
- (void) dealloc
{
[string release];
[set release];
[iSet release];
[super dealloc];
}
@end
// end: _GNUTextScanner implementation--------------------------------------
/* /*
@interface NSAttributedString(DrawingAddition) @interface NSAttributedString(DrawingAddition)
- (NSSize) sizeRange: (NSRange) aRange; - (NSSize) sizeRange: (NSRange) aRange;
@ -602,7 +482,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
if ((!sendType || [sendType isEqual: NSStringPboardType]) if ((!sendType || [sendType isEqual: NSStringPboardType])
&& (!returnType || [returnType isEqual: NSStringPboardType])) && (!returnType || [returnType isEqual: NSStringPboardType]))
{ {
if (([self selectedRange].length || !sendType) if ((selected_range.length || !sendType)
&& ([self isEditable] || !returnType)) && ([self isEditable] || !returnType))
{ {
return self; return self;
@ -617,7 +497,6 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
types: (NSArray*)sendTypes types: (NSArray*)sendTypes
{ {
NSArray *types; NSArray *types;
NSRange range;
NSString *string; NSString *string;
if ([sendTypes containsObject: NSStringPboardType] == NO) if ([sendTypes containsObject: NSStringPboardType] == NO)
@ -626,9 +505,8 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
} }
types = [NSArray arrayWithObjects: NSStringPboardType, nil]; types = [NSArray arrayWithObjects: NSStringPboardType, nil];
[pb declareTypes: types owner: nil]; [pb declareTypes: types owner: nil];
range = [self selectedRange];
string = [self string]; string = [self string];
string = [string substringWithRange: range]; string = [string substringWithRange: selected_range];
return [pb setString: string forType: NSStringPboardType]; return [pb setString: string forType: NSStringPboardType];
} }
@ -645,7 +523,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
if ([self isRichText]) if ([self isRichText])
{ {
[self setTextColor: color range: [self selectedRange]]; [self setTextColor: color range: selected_range];
} }
else else
[self setTextColor: color]; [self setTextColor: color];
@ -788,7 +666,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
return NSMakeRange(0,0); return NSMakeRange(0,0);
} }
switch(granularity) switch (granularity)
{ {
case NSSelectByCharacter: case NSSelectByCharacter:
return NSIntersectionRange (proposedCharRange, return NSIntersectionRange (proposedCharRange,
@ -1033,12 +911,11 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
{ {
if ([self isRichText]) if ([self isRichText])
{ {
NSRange selectedRange = [self selectedRange]; NSRange searchRange = selected_range;
NSRange searchRange = selectedRange;
NSRange foundRange; NSRange foundRange;
int maxSelRange; int maxSelRange;
for (maxSelRange = NSMaxRange(selectedRange); for (maxSelRange = NSMaxRange(selected_range);
searchRange.location < maxSelRange; searchRange.location < maxSelRange;
searchRange = NSMakeRange (NSMaxRange (foundRange), searchRange = NSMakeRange (NSMaxRange (foundRange),
maxSelRange - NSMaxRange(foundRange))) maxSelRange - NSMaxRange(foundRange)))
@ -1158,7 +1035,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
- (BOOL) shouldDrawInsertionPoint - (BOOL) shouldDrawInsertionPoint
{ {
return ([self selectedRange].length == 0) && [self isEditable]; return (selected_range.length == 0) && [self isEditable];
} }
- (void) drawInsertionPointInRect: (NSRect)rect - (void) drawInsertionPointInRect: (NSRect)rect
@ -1540,16 +1417,16 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
{ {
BOOL doUnderline = YES; BOOL doUnderline = YES;
if ([[rtfContent attribute: NSUnderlineStyleAttributeName if ([[rtfContent attribute: NSUnderlineStyleAttributeName
atIndex: [self selectedRange].location atIndex: selected_range.location
effectiveRange: NULL] intValue]) effectiveRange: NULL] intValue])
doUnderline = NO; doUnderline = NO;
if ([self selectedRange].length) if (selected_range.length)
{ {
[rtfContent addAttribute: NSUnderlineStyleAttributeName [rtfContent addAttribute: NSUnderlineStyleAttributeName
value: [NSNumber numberWithInt: doUnderline] value: [NSNumber numberWithInt: doUnderline]
range: [self selectedRange]]; range: selected_range];
[self rebuildFromCharacterIndex: [self selectedRange].location]; [self rebuildFromCharacterIndex: selected_range.location];
} }
else // no redraw necess. else // no redraw necess.
[[self typingAttributes] [[self typingAttributes]
@ -1562,11 +1439,11 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
{ {
if ([self isRichText]) if ([self isRichText])
{ {
if ([self selectedRange].length) if (selected_range.length)
{ {
[rtfContent removeAttribute: NSUnderlineStyleAttributeName [rtfContent removeAttribute: NSUnderlineStyleAttributeName
range: [self selectedRange]]; range: selected_range];
[self rebuildFromCharacterIndex: [self selectedRange].location]; [self rebuildFromCharacterIndex: selected_range.location];
} }
else // no redraw necess. else // no redraw necess.
[[self typingAttributes] [[self typingAttributes]
@ -1595,9 +1472,9 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
{ {
[self scrollRectToVisible: [self scrollRectToVisible:
NSUnionRect ([self rectForCharacterIndex: NSUnionRect ([self rectForCharacterIndex:
[self selectedRange].location], selected_range.location],
[self rectForCharacterIndex: [self rectForCharacterIndex:
NSMaxRange ([self selectedRange])])]; NSMaxRange (selected_range)])];
} }
// //
@ -1679,14 +1556,18 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
unsigned cursorIndex; unsigned cursorIndex;
NSPoint cursorPoint; NSPoint cursorPoint;
if ([self selectedRange].length) /* Do nothing if we are at beginning of text */
if (selected_range.location == 0)
return;
if (selected_range.length)
{ {
currentCursorX = [self rectForCharacterIndex: currentCursorX = [self rectForCharacterIndex:
[self selectedRange].location].origin.x; selected_range.location].origin.x;
currentCursorY = [self rectForCharacterIndex: currentCursorY = [self rectForCharacterIndex:
[self selectedRange].location].origin.y; selected_range.location].origin.y;
} }
cursorIndex = [self selectedRange].location; cursorIndex = selected_range.location;
cursorPoint = [self rectForCharacterIndex: cursorIndex].origin; cursorPoint = [self rectForCharacterIndex: cursorIndex].origin;
cursorIndex = [self characterIndexForPoint: cursorIndex = [self characterIndexForPoint:
NSMakePoint (currentCursorX + 0.001, NSMakePoint (currentCursorX + 0.001,
@ -1703,14 +1584,18 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
unsigned cursorIndex; unsigned cursorIndex;
NSRect cursorRect; NSRect cursorRect;
if ([self selectedRange].length) /* Do nothing if we are at end of text */
if (selected_range.location == [self textLength])
return;
if (selected_range.length)
{ {
currentCursorX = [self rectForCharacterIndex: currentCursorX = [self rectForCharacterIndex:
NSMaxRange ([self selectedRange])].origin.x; NSMaxRange (selected_range)].origin.x;
currentCursorY = [self rectForCharacterIndex: currentCursorY = [self rectForCharacterIndex:
NSMaxRange ([self selectedRange])].origin.y; NSMaxRange (selected_range)].origin.y;
} }
cursorIndex = [self selectedRange].location; cursorIndex = selected_range.location;
cursorRect = [self rectForCharacterIndex: cursorIndex]; cursorRect = [self rectForCharacterIndex: cursorIndex];
cursorIndex = [self characterIndexForPoint: cursorIndex = [self characterIndexForPoint:
NSMakePoint (currentCursorX + 0.001, NSMakePoint (currentCursorX + 0.001,
@ -1723,22 +1608,30 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
} }
- (void) moveCursorLeft: sender - (void) moveCursorLeft: sender
{ {
/* Do nothing if we are at beginning of text */
if (selected_range.location == 0)
return;
[self setSelectedRange: [self setSelectedRange:
[self selectionRangeForProposedRange: [self selectionRangeForProposedRange:
NSMakeRange ([self selectedRange].location - 1, 0) NSMakeRange (selected_range.location - 1, 0)
granularity: NSSelectByCharacter]]; granularity: NSSelectByCharacter]];
currentCursorX = [self rectForCharacterIndex: currentCursorX = [self rectForCharacterIndex:
[self selectedRange].location].origin.x; selected_range.location].origin.x;
} }
- (void) moveCursorRight: sender - (void) moveCursorRight: sender
{ {
/* Do nothing if we are at end of text */
if (selected_range.location == [self textLength])
return;
[self setSelectedRange: [self setSelectedRange:
[self selectionRangeForProposedRange: [self selectionRangeForProposedRange:
NSMakeRange (MIN (NSMaxRange ([self selectedRange]) + 1, NSMakeRange (MIN (NSMaxRange (selected_range) + 1,
[self textLength]), 0) [self textLength]), 0)
granularity: NSSelectByCharacter]]; granularity: NSSelectByCharacter]];
currentCursorX = [self rectForCharacterIndex: currentCursorX = [self rectForCharacterIndex:
[self selectedRange].location].origin.x; selected_range.location].origin.x;
} }
// //
@ -1759,7 +1652,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
[_window makeFirstResponder: self]; [_window makeFirstResponder: self];
switch([theEvent clickCount]) switch ([theEvent clickCount])
{ {
case 1: granularity = NSSelectByCharacter; case 1: granularity = NSSelectByCharacter;
break; break;
@ -1780,13 +1673,13 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
[self lockFocus]; [self lockFocus];
// clean up before doing the dragging // clean up before doing the dragging
if ([self selectedRange].length == 0) // remove old cursor if (selected_range.length == 0) // remove old cursor
{ {
[self drawInsertionPointAtIndex: [self selectedRange].location [self drawInsertionPointAtIndex: selected_range.location
color: nil turnedOn: NO]; color: nil turnedOn: NO];
} }
else else
[self drawSelectionAsRangeNoCaret: [self selectedRange]]; [self drawSelectionAsRangeNoCaret: selected_range];
//<!> make this non - blocking (or make use of timed entries) //<!> make this non - blocking (or make use of timed entries)
for (currentEvent = [_window for (currentEvent = [_window
@ -1906,7 +1799,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
{ {
[self drawPlainLinesInLineRange: redrawLineRange]; [self drawPlainLinesInLineRange: redrawLineRange];
} }
[self drawSelectionAsRange: [self selectedRange]]; [self drawSelectionAsRange: selected_range];
} }
if ([self drawsBackground]) // clean up the remaining area under text of us if ([self drawsBackground]) // clean up the remaining area under text of us
@ -1927,7 +1820,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
if (![lineLayoutInformation count] if (![lineLayoutInformation count]
|| [[lineLayoutInformation lastObject] || [[lineLayoutInformation lastObject]
type] == LineLayoutInfoType_Paragraph) type] == LineLayoutInfoType_Paragraph)
[self drawSelectionAsRange: [self selectedRange]]; [self drawSelectionAsRange: selected_range];
} }
} }
@ -1958,7 +1851,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
- (void) insertText: insertObjc - (void) insertText: insertObjc
{ {
NSRange selectedRange = [self selectedRange]; NSRange selectedRange = selected_range;
int lineIndex = [self lineLayoutIndexForCharacterIndex: int lineIndex = [self lineLayoutIndexForCharacterIndex:
selectedRange.location]; selectedRange.location];
int origLineIndex = lineIndex; int origLineIndex = lineIndex;
@ -1986,7 +1879,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
if ([self isRichText]) if ([self isRichText])
{ {
[self replaceRange: [self selectedRange] [self replaceRange: selected_range
withAttributedString: [insertObjc isKindOfClass: withAttributedString: [insertObjc isKindOfClass:
[NSAttributedString class]]? [NSAttributedString class]]?
insertObjc: insertObjc:
@ -1997,7 +1890,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
} }
else else
{ {
[self replaceRange: [self selectedRange] withString: insertString]; [self replaceRange: selected_range withString: insertString];
} }
redrawLineRange.length = [self rebuildLineLayoutInformationStartingAtLine: redrawLineRange.length = [self rebuildLineLayoutInformationStartingAtLine:
redrawLineRange.location redrawLineRange.location
@ -2011,14 +1904,15 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
// move cursor <!> [self selectionRangeForProposedRange: ] // move cursor <!> [self selectionRangeForProposedRange: ]
[self [self
setSelectedRange: setSelectedRange:
NSMakeRange ([self selectedRange].location + [insertString length], 0)]; NSMakeRange (selected_range.location + [insertString length], 0)];
// remember x for row - stable cursor movements // remember x for row - stable cursor movements
currentCursorX = [self rectForCharacterIndex: currentCursorX = [self rectForCharacterIndex:
[self selectedRange].location].origin.x; selected_range.location].origin.x;
// remember x for row - stable cursor movements // remember x for row - stable cursor movements
currentCursorY = [self rectForCharacterIndex: currentCursorY = [self rectForCharacterIndex:
[self selectedRange].location].origin.y; selected_range.location].origin.y;
redrawLineRange = NSIntersectionRange (redrawLineRange, redrawLineRange = NSIntersectionRange (redrawLineRange,
[self lineRangeForRect: [self lineRangeForRect:
@ -2103,10 +1997,11 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
// remember x for row - stable cursor movements // remember x for row - stable cursor movements
currentCursorX = [self rectForCharacterIndex: currentCursorX = [self rectForCharacterIndex:
[self selectedRange].location].origin.x; selected_range.location].origin.x;
// remember x for row - stable cursor movements // remember x for row - stable cursor movements
currentCursorY = [self rectForCharacterIndex: currentCursorY = [self rectForCharacterIndex:
[self selectedRange].location].origin.y; selected_range.location].origin.y;
redrawLineRange redrawLineRange
= NSIntersectionRange (redrawLineRange, = NSIntersectionRange (redrawLineRange,
@ -2192,7 +2087,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
} }
// Special Characters for generic NSText // Special Characters for generic NSText
switch(keyCode) switch (keyCode)
{ {
case NSUpArrowFunctionKey: case NSUpArrowFunctionKey:
[self moveCursorUp: self]; [self moveCursorUp: self];
@ -2206,8 +2101,20 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
case NSRightArrowFunctionKey: case NSRightArrowFunctionKey:
[self moveCursorRight: self]; [self moveCursorRight: self];
return; return;
case NSDeleteFunctionKey:
if (selected_range.location != [self textLength])
{
/* Not at the end of text -- delete following character */
[self deleteRange:
[self selectionRangeForProposedRange:
NSMakeRange (selected_range.location, 1)
granularity: NSSelectByCharacter]
backspace: NO];
return;
}
/* end of text: behave the same way as NSBackspaceKey */
case NSBackspaceKey: case NSBackspaceKey:
[self deleteRange: [self selectedRange] backspace: YES]; [self deleteRange: selected_range backspace: YES];
return; return;
#if 1 #if 1
case 0x6d: // end - key: debugging: enforce complete re - layout case 0x6d: // end - key: debugging: enforce complete re - layout
@ -2252,7 +2159,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
if ([self shouldDrawInsertionPoint]) if ([self shouldDrawInsertionPoint])
{ {
[self drawInsertionPointAtIndex: [self selectedRange].location [self drawInsertionPointAtIndex: selected_range.location
color: nil turnedOn: NO]; color: nil turnedOn: NO];
//<!> stop timed entry //<!> stop timed entry
@ -2278,7 +2185,7 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
//if ([self shouldDrawInsertionPoint]) //if ([self shouldDrawInsertionPoint])
// { // {
// [self lockFocus]; // [self lockFocus];
// [self drawInsertionPointAtIndex: [self selectedRange].location // [self drawInsertionPointAtIndex: selected_range.location
// color: [NSColor blackColor] turnedOn: YES]; // color: [NSColor blackColor] turnedOn: YES];
// [self unlockFocus]; // [self unlockFocus];
// //<!> restart timed entry // //<!> restart timed entry
@ -2619,13 +2526,13 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
delta: (int) insertionDelta delta: (int) insertionDelta
actualLine: (int) insertionLineIndex actualLine: (int) insertionLineIndex
{ {
NSDictionary *attributes = [self defaultTypingAttributes]; NSDictionary *attributes = [self defaultTypingAttributes];
NSPoint drawingPoint = NSZeroPoint; NSPoint drawingPoint = NSZeroPoint;
_GNUTextScanner *parscanner; NSScanner *pScanner;
float width = _frame.size.width; float width = _frame.size.width;
unsigned startingIndex = 0,currentLineIndex; unsigned startingIndex = 0,currentLineIndex;
_GNULineLayoutInfo *lastValidLineInfo = nil; _GNULineLayoutInfo *lastValidLineInfo = nil;
NSArray *ghostArray = nil; // for optimization detection NSArray *ghostArray = nil; // for optimization detection
_GNUSeekableArrayEnumerator *prevArrayEnum = nil; _GNUSeekableArrayEnumerator *prevArrayEnum = nil;
NSCharacterSet *invSelectionWordGranularitySet NSCharacterSet *invSelectionWordGranularitySet
= [selectionWordGranularitySet invertedSet]; = [selectionWordGranularitySet invertedSet];
@ -2684,37 +2591,39 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
currentLineIndex = aLine; currentLineIndex = aLine;
// each paragraph // each paragraph
for (parscanner
= [_GNUTextScanner parsedString = [[self string] substringFromIndex: startingIndex];
scannerWithString: parsedString = [[self string] pScanner = [NSScanner scannerWithString: parsedString];
substringFromIndex: [pScanner setCharactersToBeSkipped: nil];
startingIndex] while ([pScanner isAtEnd] == NO)
set: selectionParagraphGranularitySet
invertedSet: invSelectionParagraphGranularitySet];
![parscanner isAtEnd];)
{ {
_GNUTextScanner *linescanner; NSScanner *lScanner;
NSString *paragraph; NSString *paragraph;
NSRange paragraphRange, leadingNlRange, trailingNlRange; NSRange paragraphRange, leadingNlRange, trailingNlRange;
unsigned startingParagraphIndex unsigned currentLoc = [pScanner scanLocation];
= [parscanner scanLocation] + startingIndex; unsigned startingParagraphIndex = currentLoc + startingIndex;
unsigned startingLineCharIndex = startingParagraphIndex; unsigned startingLineCharIndex = startingParagraphIndex;
BOOL isBuckled = NO, inBuckling = NO; BOOL isBuckled = NO, inBuckling = NO;
leadingNlRange = [parscanner scanSetCharacters]; leadingNlRange
// add the leading newlines of current paragraph = scanRange(pScanner, selectionParagraphGranularitySet);
// if any (only the first time) paragraphRange
if (leadingNlRange.length) = scanRange(pScanner, invSelectionParagraphGranularitySet);
{ trailingNlRange
[self addNewlines: leadingNlRange = scanRange(pScanner, selectionParagraphGranularitySet);
intoLayoutArray: lineLayoutInformation
attributes: attributes if (leadingNlRange.length > 0)
atPoint: &drawingPoint {
width: width [self addNewlines: leadingNlRange
characterIndex: startingLineCharIndex intoLayoutArray: lineLayoutInformation
ghostEnumerator: prevArrayEnum attributes: attributes
didShift: &nlDidShift atPoint: &drawingPoint
verticalDisplacement: &yDisplacement]; width: width
characterIndex: startingLineCharIndex
ghostEnumerator: prevArrayEnum
didShift: &nlDidShift
verticalDisplacement: &yDisplacement];
if (nlDidShift) if (nlDidShift)
{ {
if (insertionDelta == 1) if (insertionDelta == 1)
@ -2733,43 +2642,41 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
startingLineCharIndex += leadingNlRange.length; startingLineCharIndex += leadingNlRange.length;
currentLineIndex += leadingNlRange.length; currentLineIndex += leadingNlRange.length;
} }
paragraphRange = [parscanner scanNonSetCharacters];
trailingNlRange = [parscanner scanSetCharacters];
// each line // each line
for (linescanner paragraph = [parsedString substringWithRange: paragraphRange];
= [_GNUTextScanner lScanner = [NSScanner scannerWithString: paragraph];
scannerWithString: paragraph = [parsedString [lScanner setCharactersToBeSkipped: nil];
substringWithRange: while ([lScanner isAtEnd] == NO)
paragraphRange]
set: selectionWordGranularitySet
invertedSet: invSelectionWordGranularitySet];
![linescanner isAtEnd];)
{ {
NSRect currentLineRect = NSMakeRect (0, drawingPoint.y, 0, 0); NSRect currentLineRect = NSMakeRect (0, drawingPoint.y, 0, 0);
// starts with zero, do not confuse with startingLineCharIndex // starts with zero, do not confuse with startingLineCharIndex
unsigned localLineStartIndex = [linescanner scanLocation]; unsigned localLineStartIndex = [lScanner scanLocation];
NSSize advanceSize = NSZeroSize; NSSize advanceSize = NSZeroSize;
// scan the individual words to the end of the line // scan the individual words to the end of the line
for (; ![linescanner isAtEnd]; drawingPoint.x += advanceSize.width) for (; ![lScanner isAtEnd]; drawingPoint.x += advanceSize.width)
{ {
NSRange currentStringRange, trailingSpacesRange; NSRange currentStringRange, trailingSpacesRange;
NSRange leadingSpacesRange; NSRange leadingSpacesRange;
unsigned scannerPosition = [linescanner scanLocation]; unsigned scannerPosition = [lScanner scanLocation];
// snack next word // snack next word
// leading spaces: only first time // leading spaces: only first time
leadingSpacesRange = [linescanner scanSetCharacters]; leadingSpacesRange
currentStringRange = [linescanner scanNonSetCharacters]; = scanRange(lScanner, selectionWordGranularitySet);
trailingSpacesRange = [linescanner scanSetCharacters]; currentStringRange
= scanRange(lScanner, invSelectionWordGranularitySet);
trailingSpacesRange
= scanRange(lScanner, selectionWordGranularitySet);
if (leadingSpacesRange.length) if (leadingSpacesRange.length)
currentStringRange = NSUnionRange (leadingSpacesRange, currentStringRange = NSUnionRange(leadingSpacesRange,
currentStringRange); currentStringRange);
if (trailingSpacesRange.length) if (trailingSpacesRange.length)
currentStringRange = NSUnionRange (trailingSpacesRange, currentStringRange = NSUnionRange(trailingSpacesRange,
currentStringRange); currentStringRange);
// evaluate size of current word and line so far // evaluate size of current word and line so far
@ -2849,7 +2756,7 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
_GNULineLayoutInfo *ghostInfo = nil, *thisInfo; _GNULineLayoutInfo *ghostInfo = nil, *thisInfo;
// undo layout of last word // undo layout of last word
[linescanner setScanLocation: scannerPosition]; [lScanner setScanLocation: scannerPosition];
currentLineRect.origin.x = 0; currentLineRect.origin.x = 0;
currentLineRect.origin.y = drawingPoint.y; currentLineRect.origin.y = drawingPoint.y;
@ -2952,10 +2859,10 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
// newline - induced premature lineending: flush // newline - induced premature lineending: flush
} }
else if ([linescanner isAtEnd]) else if ([lScanner isAtEnd])
{ {
_GNULineLayoutInfo *thisInfo; _GNULineLayoutInfo *thisInfo;
scannerPosition = [linescanner scanLocation]; scannerPosition = [lScanner scanLocation];
[lineLayoutInformation [lineLayoutInformation
addObject: (thisInfo addObject: (thisInfo
= [_GNULineLayoutInfo = [_GNULineLayoutInfo
@ -3188,7 +3095,7 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
return; return;
[self drawRectNoSelection: rect]; [self drawRectNoSelection: rect];
[self drawSelectionAsRange: [self selectedRange]]; [self drawSelectionAsRange: selected_range];
} }
// text lays out from top to bottom // text lays out from top to bottom
@ -3224,15 +3131,15 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
[pboard declareTypes: types owner: self]; [pboard declareTypes: types owner: self];
[pboard setString: [[self string] substringWithRange: [self selectedRange]] [pboard setString: [[self string] substringWithRange: selected_range]
forType: NSStringPboardType]; forType: NSStringPboardType];
if ([self isRichText]) if ([self isRichText])
[pboard setData: [self RTFFromRange: [self selectedRange]] [pboard setData: [self RTFFromRange: selected_range]
forType: NSRTFPboardType]; forType: NSRTFPboardType];
if ([self importsGraphics]) if ([self importsGraphics])
[pboard setData: [self RTFDFromRange: [self selectedRange]] [pboard setData: [self RTFDFromRange: selected_range]
forType: NSRTFDPboardType]; forType: NSRTFDPboardType];
} }
@ -3248,11 +3155,11 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
- (void) delete: sender - (void) delete: sender
{ {
[self deleteRange: [self selectedRange] backspace: NO]; [self deleteRange: selected_range backspace: NO];
} }
- (void) cut: sender - (void) cut: sender
{ {
if ([self selectedRange].length) if (selected_range.length)
{ {
[self copy: self]; [self copy: self];
[self delete: self]; [self delete: self];
@ -3344,7 +3251,7 @@ _relocLayoutArray (NSMutableArray *lineLayoutInformation,
NSRange errorRange NSRange errorRange
= [[NSSpellChecker sharedSpellChecker] = [[NSSpellChecker sharedSpellChecker]
checkSpellingOfString: [self string] checkSpellingOfString: [self string]
startingAt: NSMaxRange ([self selectedRange])]; startingAt: NSMaxRange (selected_range)];
if (errorRange.length) if (errorRange.length)
[self setSelectedRange: errorRange]; [self setSelectedRange: errorRange];

View file

@ -32,26 +32,26 @@
#import <Foundation/NSNotification.h> #import <Foundation/NSNotification.h>
@interface NSTextContainer (TextViewObserver) @interface NSTextContainer (TextViewObserver)
- (void) _textViewFrameChanged: (NSNotification *)aNotification; - (void) _textViewFrameChanged: (NSNotification*)aNotification;
@end @end
@implementation NSTextContainer (TextViewObserver) @implementation NSTextContainer (TextViewObserver)
- (void) _textViewFrameChanged: (NSNotification *)aNotification - (void) _textViewFrameChanged: (NSNotification*)aNotification
{ {
id textView; id textView;
NSSize newSize; NSSize newSize;
NSSize inset; NSSize inset;
if ( _observingFrameChanges ) if (_observingFrameChanges)
{ {
textView = [aNotification object]; textView = [aNotification object];
newSize = [textView frame].size; newSize = [textView frame].size;
inset = [textView textContainerInset]; inset = [textView textContainerInset];
if ( _widthTracksTextView ) if (_widthTracksTextView)
newSize.width = MAX(newSize.width - (inset.width * 2.0), 0.0); newSize.width = MAX(newSize.width - (inset.width * 2.0), 0.0);
if ( _heightTracksTextView ) if (_heightTracksTextView)
newSize.height = MAX(newSize.height - (inset.height * 2.0), 0.0); newSize.height = MAX(newSize.height - (inset.height * 2.0), 0.0);
[self setContainerSize: newSize]; [self setContainerSize: newSize];
@ -64,8 +64,10 @@
+ (void) initialize + (void) initialize
{ {
if ( self == [NSTextContainer class] ) if (self == [NSTextContainer class])
[self setVersion: 1]; {
[self setVersion: 1];
}
} }
- (id) initWithContainerSize: (NSSize)aSize - (id) initWithContainerSize: (NSSize)aSize
@ -82,36 +84,43 @@
return self; return self;
} }
- (void) setLayoutManager: (NSLayoutManager *)aLayoutManager - (void) setLayoutManager: (NSLayoutManager*)aLayoutManager
{ {
ASSIGN(_layoutManager, aLayoutManager); ASSIGN(_layoutManager, aLayoutManager);
} }
- (NSLayoutManager *) layoutManager - (NSLayoutManager*) layoutManager
{ {
return _layoutManager; return _layoutManager;
} }
- (void) replaceLayoutManager: (NSLayoutManager *)newLayoutManager - (void) replaceLayoutManager: (NSLayoutManager*)newLayoutManager
{ {
id textStorage = [_layoutManager textStorage]; if (newLayoutManager != _layoutManager)
NSArray *textContainers = [_layoutManager textContainers];
unsigned i, count = [textContainers count];
[textStorage removeLayoutManager: _layoutManager];
[textStorage addLayoutManager: newLayoutManager];
[_layoutManager setTextStorage: nil];
for ( i = 0; i < count; i++ )
{ {
[newLayoutManager addTextContainer: [textContainers objectAtIndex: i]]; id textStorage = [_layoutManager textStorage];
[_layoutManager removeTextContainerAtIndex: i]; NSArray *textContainers = [_layoutManager textContainers];
unsigned i, count = [textContainers count];
[textStorage removeLayoutManager: _layoutManager];
[textStorage addLayoutManager: newLayoutManager];
[_layoutManager setTextStorage: nil];
for (i = 0; i < count; i++)
{
NSTextContainer *container;
container = RETAIN([textContainers objectAtIndex: i]);
[_layoutManager removeTextContainerAtIndex: i];
[newLayoutManager addTextContainer: container];
RELEASE(container);
}
} }
} }
- (void) setTextView: (NSTextView *)aTextView - (void) setTextView: (NSTextView*)aTextView
{ {
if ( _textView ) if (_textView)
{ {
[_textView setTextContainer: nil]; [_textView setTextContainer: nil];
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
@ -119,17 +128,17 @@
ASSIGN(_textView, aTextView); ASSIGN(_textView, aTextView);
if ( aTextView ) if (aTextView)
{ {
[_textView setTextContainer: self]; [_textView setTextContainer: self];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(_textViewFrameChanged: ) selector: @selector(_textViewFrameChanged:)
name: NSViewFrameDidChangeNotification name: NSViewFrameDidChangeNotification
object: _textView]; object: _textView];
} }
} }
- (NSTextView *) textView - (NSTextView*) textView
{ {
return _textView; return _textView;
} }
@ -138,7 +147,7 @@
{ {
_containerRect = NSMakeRect(0, 0, aSize.width, aSize.height); _containerRect = NSMakeRect(0, 0, aSize.width, aSize.height);
if ( _layoutManager ) if (_layoutManager)
[_layoutManager textContainerChangedGeometry: self]; [_layoutManager textContainerChangedGeometry: self];
} }
@ -173,7 +182,7 @@
{ {
_lineFragmentPadding = aFloat; _lineFragmentPadding = aFloat;
if ( _layoutManager ) if (_layoutManager)
[_layoutManager textContainerChangedGeometry: self]; [_layoutManager textContainerChangedGeometry: self];
} }
@ -185,7 +194,7 @@
- (NSRect) lineFragmentRectForProposedRect: (NSRect)proposedRect - (NSRect) lineFragmentRectForProposedRect: (NSRect)proposedRect
sweepDirection: (NSLineSweepDirection)sweepDir sweepDirection: (NSLineSweepDirection)sweepDir
movementDirection: (NSLineMovementDirection)moveDir movementDirection: (NSLineMovementDirection)moveDir
remainingRect: (NSRect *)remainingRect; remainingRect: (NSRect*)remainingRect;
{ {
// line fragment rectangle simply must fit within the container rectangle // line fragment rectangle simply must fit within the container rectangle
*remainingRect = NSZeroRect; *remainingRect = NSZeroRect;

File diff suppressed because it is too large Load diff

View file

@ -372,6 +372,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) removeFromSuperviewWithoutNeedingDisplay - (void) removeFromSuperviewWithoutNeedingDisplay
{ {
/* This must be first because it invokes -resignFirstResponder:,
which assumes the view is still in the view hierarchy */
if ([_window firstResponder] == self)
[_window makeFirstResponder: _window];
/* /*
* We MUST make sure that coordinates are invalidated even if we have * We MUST make sure that coordinates are invalidated even if we have
* no superview - cos they may have been rebuilt since we lost the * no superview - cos they may have been rebuilt since we lost the
@ -400,6 +404,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) removeFromSuperview - (void) removeFromSuperview
{ {
/* This must be first because it invokes -resignFirstResponder:,
which assumes the view is still in the view hierarchy */
if ([_window firstResponder] == self)
[_window makeFirstResponder: _window];
/* /*
* We MUST make sure that coordinates are invalidated even if we have * We MUST make sure that coordinates are invalidated even if we have
* no superview - cos they may have been rebuilt since we lost the * no superview - cos they may have been rebuilt since we lost the
@ -1703,6 +1711,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) setNeedsDisplayInRect: (NSRect)rect - (void) setNeedsDisplayInRect: (NSRect)rect
{ {
NSView *currentView = _super_view;
/* /*
* Limit to bounds, combine with old _invalidRect, and then check to see * Limit to bounds, combine with old _invalidRect, and then check to see
* if the result is the same as the old _invalidRect - if it isn't then * if the result is the same as the old _invalidRect - if it isn't then
@ -1713,7 +1723,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
if (NSEqualRects(rect, _invalidRect) == NO) if (NSEqualRects(rect, _invalidRect) == NO)
{ {
NSView *firstOpaque = [self opaqueAncestor]; NSView *firstOpaque = [self opaqueAncestor];
NSView *currentView = _super_view;
_rFlags.needs_display = YES; _rFlags.needs_display = YES;
_invalidRect = rect; _invalidRect = rect;
@ -1726,12 +1735,16 @@ GSSetDragTypes(NSView* obj, NSArray *types)
rect = [firstOpaque convertRect: _invalidRect fromView: self]; rect = [firstOpaque convertRect: _invalidRect fromView: self];
[firstOpaque setNeedsDisplayInRect: rect]; [firstOpaque setNeedsDisplayInRect: rect];
} }
}
while (currentView) /*
{ * Must make sure that superviews know that we need display.
currentView->_rFlags.needs_display = YES; * NB. we may have been marked as needing display and then moved to another
currentView = currentView->_super_view; * parent, so we can't assume that our parent is marked simply because we are.
} */
while (currentView)
{
currentView->_rFlags.needs_display = YES;
currentView = currentView->_super_view;
} }
} }

View file

@ -344,9 +344,12 @@ static NSMapTable* windowmaps = NULL;
[content_view removeFromSuperview]; [content_view removeFromSuperview];
} }
content_view = aView; content_view = aView;
[content_view setFrame: [_wv frame]]; // Resize to fill window. [content_view setAutoresizingMask: (NSViewWidthSizable
[content_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; | NSViewHeightSizable)];
[_wv addSubview: content_view]; // Add to our window view [_wv addSubview: content_view];
[content_view resizeWithOldSuperviewSize: [content_view frame].size];
[content_view setFrameOrigin: [_wv bounds].origin];
NSAssert1 ([[_wv subviews] count] == 1, NSAssert1 ([[_wv subviews] count] == 1,
@"window's view has %d subviews!", [[_wv subviews] count]); @"window's view has %d subviews!", [[_wv subviews] count]);
@ -679,18 +682,25 @@ static NSMapTable* windowmaps = NULL;
if ([self isKeyWindow]) if ([self isKeyWindow])
{ {
[self resignKeyWindow]; [self resignKeyWindow];
for (i = pos + 1; i != pos; i++) i = pos + 1;
if (i == c)
{
i = 0;
}
while (i != pos)
{ {
if (i == c)
{
i = 0;
}
w = [windowList objectAtIndex: i]; w = [windowList objectAtIndex: i];
if ([w isVisible] && [w canBecomeKeyWindow]) if ([w isVisible] && [w canBecomeKeyWindow])
{ {
[w makeKeyWindow]; [w makeKeyWindow];
break; break;
} }
i++;
if (i == c)
{
i = 0;
}
} }
/* /*
* if we didn't find a possible key window - use the app icon or, * if we didn't find a possible key window - use the app icon or,
@ -720,18 +730,25 @@ static NSMapTable* windowmaps = NULL;
} }
else else
{ {
for (i = pos + 1; i != pos; i++) i = pos + 1;
if (i == c)
{
i = 0;
}
while (i != pos)
{ {
if (i == c)
{
i = 0;
}
w = [windowList objectAtIndex: i]; w = [windowList objectAtIndex: i];
if ([w isVisible] && [w canBecomeMainWindow]) if ([w isVisible] && [w canBecomeMainWindow])
{ {
[w makeMainWindow]; [w makeMainWindow];
break; break;
} }
i++;
if (i == c)
{
i = 0;
}
} }
} }
} }

View file

@ -5,7 +5,7 @@
GNUSTEP_GUI_GCC=2.8.0 GNUSTEP_GUI_GCC=2.8.0
# Versions for libraries that gnustep-gui is dependent upon # Versions for libraries that gnustep-gui is dependent upon
GNUSTEP_GUI_BASE=0.6.0 GNUSTEP_GUI_BASE=0.6.5
LIB_FOUNDATION=0.8.1 LIB_FOUNDATION=0.8.1
GNUSTEP_GUI_LIBTIFF=3.4 GNUSTEP_GUI_LIBTIFF=3.4
GNUSTEP_GUI_DGS=0.5.7 GNUSTEP_GUI_DGS=0.5.7
@ -14,7 +14,7 @@ GNUSTEP_GUI_DPSCLIENT=6.1
# The version number of this release. # The version number of this release.
GNUSTEP_GUI_MAJOR_VERSION=0 GNUSTEP_GUI_MAJOR_VERSION=0
GNUSTEP_GUI_MINOR_VERSION=6 GNUSTEP_GUI_MINOR_VERSION=6
GNUSTEP_GUI_SUBMINOR_VERSION=0 GNUSTEP_GUI_SUBMINOR_VERSION=5
GNUSTEP_GUI_VERSION=${GNUSTEP_GUI_MAJOR_VERSION}.${GNUSTEP_GUI_MINOR_VERSION}.${GNUSTEP_GUI_SUBMINOR_VERSION} GNUSTEP_GUI_VERSION=${GNUSTEP_GUI_MAJOR_VERSION}.${GNUSTEP_GUI_MINOR_VERSION}.${GNUSTEP_GUI_SUBMINOR_VERSION}
VERSION=${GNUSTEP_GUI_VERSION} VERSION=${GNUSTEP_GUI_VERSION}

114
configure vendored
View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.12 # Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
# #
# This configure script is free software; the Free Software Foundation # This configure script is free software; the Free Software Foundation
@ -49,6 +49,7 @@ mandir='${prefix}/man'
# Initialize some other variables. # Initialize some other variables.
subdirs= subdirs=
MFLAGS= MAKEFLAGS= MFLAGS= MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document. # Maximum number of lines to put in a shell here document.
ac_max_here_lines=12 ac_max_here_lines=12
@ -332,7 +333,7 @@ EOF
verbose=yes ;; verbose=yes ;;
-version | --version | --versio | --versi | --vers) -version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.12" echo "configure generated by autoconf version 2.13"
exit 0 ;; exit 0 ;;
-with-* | --with-*) -with-* | --with-*)
@ -502,9 +503,11 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS' ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross cross_compiling=$ac_cv_prog_cc_cross
ac_exeext=
ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@ -521,6 +524,105 @@ fi
echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
echo "configure:529: checking for main in -lm" >&5
ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
#line 537 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
LIBS="-lm $LIBS"
else
echo "$ac_t""no" 1>&6
fi
for ac_func in rintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:574: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 579 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
trap '' 1 2 15 trap '' 1 2 15
cat > confcache <<\EOF cat > confcache <<\EOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
@ -544,7 +646,7 @@ EOF
# Ultrix sh set writes to stderr and can't be redirected directly, # Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars. # and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 | (set) 2>&1 |
case `(ac_space=' '; set) 2>&1` in case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *) *ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution # `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \). # turns \\\\ into \\, and sed turns \\ into \).
@ -611,7 +713,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v) -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "$CONFIG_STATUS generated by autoconf version 2.12" echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;; exit 0 ;;
-help | --help | --hel | --he | --h) -help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;; echo "\$ac_cs_usage"; exit 0 ;;
@ -630,9 +732,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub $ac_vpsub
$extrasub $extrasub
s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g
s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g s%@LIBS@%$LIBS%g

View file

@ -27,6 +27,9 @@ AC_INIT(Source/NSApplication.m)
AC_CONFIG_HEADER(Headers/gnustep/gui/config.h) AC_CONFIG_HEADER(Headers/gnustep/gui/config.h)
AC_CHECK_LIB(m, main)
AC_CHECK_FUNCS(rintf)
AC_OUTPUT() AC_OUTPUT()

121
gnustep-gui.spec Normal file
View file

@ -0,0 +1,121 @@
# This package is not relocatable
%define ver 0.6.5
%define date 20000217
%define prefix /usr
%define gsr %{prefix}/GNUstep
%define libcombo gnu-gnu-gnu-xgps
Name: gnustep-gui
Version: %{ver}
Release: 1
Source: ftp://ftp.gnustep.org/pub/gnustep/core/gstep-gui-%{ver}.tar.gz
#Source: /cvs/gnustep-gui-%{ver}-%{date}.tar.gz
Copyright: GPL
Group: Development/Tools
Summary: GNUstep GUI library package
Packager: Christopher Seawood <cls@seawood.org>
Distribution: Seawood's Random RPMS (%{_buildsym})
Vendor: The Seawood Project
URL: http://www.gnustep.org/
BuildRoot: /var/tmp/build-%{name}
Conflicts: gnustep-core
Requires: gnustep-base
%description
It is a library of graphical user interface classes written
completely in the Objective-C language; the classes are based upon the
OpenStep specification as release by NeXT Software, Inc. The library
does not completely conform to the specification and has been enhanced
in a number of ways to take advantage of the GNU system. These classes
include graphical objects such as buttons, text fields, popup lists,
browser lists, and windows; there are also many associated classes for
handling events, colors, fonts, pasteboards and images.
Library combo is %{libcombo}.
%{_buildblurb}
%package devel
Summary: GNUstep GUI headers and libs.
Group: Development/Libraries
Requires: %{name} = %{ver}, gnustep-base-devel
Conflicts: gnustep-core
%description devel
Header files required to build applications against the GNUstep GUI library.
Library combo is %{libcombo}.
%{_buildblurb}
%prep
%setup -q -n gstep-%{ver}/gui
%patch -p2 -b .headers
%build
if [ -z "$GNUSTEP_SYSTEM_ROOT" ]; then
. %{gsr}/Makefiles/GNUstep.sh
fi
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{gsr} --with-library-combo=%{libcombo}
make
%install
rm -rf $RPM_BUILD_ROOT
if [ -z "$GNUSTEP_SYSTEM_ROOT" ]; then
. %{gsr}/Makefiles/GNUstep.sh
fi
mkdir -p ${RPM_BUILD_ROOT}%{gsr}/Library/Services
make install GNUSTEP_INSTALLATION_DIR=${RPM_BUILD_ROOT}%{gsr}
cat > filelist.rpm.in << EOF
%defattr (-, bin, bin)
%doc ANNOUNCE COPYING* ChangeLog INSTALL NEWS NOTES README SUPPORT Version
%dir %{gsr}/Library
%{gsr}/Libraries/GSARCH/GSOS/%{libcombo}/lib*.so.*
%{gsr}/Libraries/Resources
%{gsr}/Library/Model
%{gsr}/Library/Services/*
%{gsr}/Tools/make_services
%{gsr}/Tools/set_show_service
# gpbs is now provided by xgps
#%{gsr}/Tools/GSARCH/GSOS/%{libcombo}/gpbs
%{gsr}/Tools/GSARCH/GSOS/%{libcombo}/make_services
%{gsr}/Tools/GSARCH/GSOS/%{libcombo}/set_show_service
EOF
cat > filelist-devel.rpm.in << EOF
%defattr(-, bin, bin)
%{gsr}/Headers/gnustep/gui
%{gsr}/Libraries/GSARCH/GSOS/%{libcombo}/lib*.so
EOF
sed -e "s|GSARCH|${GNUSTEP_HOST_CPU}|" -e "s|GSOS|${GNUSTEP_HOST_OS}|" < filelist.rpm.in > filelist.rpm
sed -e "s|GSARCH|${GNUSTEP_HOST_CPU}|" -e "s|GSOS|${GNUSTEP_HOST_OS}|" < filelist-devel.rpm.in > filelist-devel.rpm
# Don't worry about ld.so.conf on linux as gnustep-base should take care of it.
%ifos Linux
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files -f filelist.rpm
%files -f filelist-devel.rpm devel
%changelog
* Sat Sep 18 1999 Christopher Seawood <cls@seawood.org>
- Version 0.6.0
- Added headers patch
* Sat Aug 07 1999 Christopher Seawood <cls@seawood.org>
- Updated to cvs dawn_6 branch
* Sat Jun 26 1999 Christopher Seawood <cls@seawood.org>
- Split into separate rpm from gnustep-core
- Build from cvs snapshot
- Split into -devel, -libs & -zoneinfo packages