Synchronised with trunk at revision 23586

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/themes@23587 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-09-22 12:29:31 +00:00
parent 7955334e4d
commit a50e814e6d
66 changed files with 3847 additions and 1439 deletions

View file

@ -1,7 +1,7 @@
1 ANNOUNCE
**********
This is version 0.10.3 of the GNUstep GUI library (`gnustep-gui').
This is version 0.11.0 of the GNUstep GUI library (`gnustep-gui').
1.1 What is the GNUstep GUI Library?
====================================
@ -27,17 +27,21 @@ systems.
GNUstep Base Library, the TIFF Graphics library, and a back-end
component like the GNUstep 'Back' Backend.
1.2 Noteworthy changes in version `0.10.3'
1.2 Noteworthy changes in version `0.11.0'
==========================================
* Horizontal menus now work
* Added support for keyed encoding in all gui classes.
* Better support for tracking active applications.
* Added mechanism to allow for dynamic extension of model loading
mechanism
* Implemented glue code in GSNibCompatibility for classes such as
NSIBObjectData, NSClassSwapper, etc. to facilitate nib loading.
1.3 Where can you get it? How can you compile it?
==================================================
The gstep-gui-0.10.3.tar.gz distribution file has been placed at
The gstep-gui-0.11.0.tar.gz distribution file has been placed at
`ftp://ftp.gnustep.org/pub/gnustep/core'.
Read the INSTALL file or the GNUstep-HOWTO for installation

728
ChangeLog
View file

@ -1,20 +1,724 @@
2006-05-20 [themes] Nicolas Roard <nicolas@roard.com>
* merged with trunk from revision 22954:22963 (nib changes)
2006-05-20 [thenes] Nicolas Roard <nicolas@roard.com>
2006-09-22 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepGUI/GSDrawFunctions.h:
* Headers/Additions/GNUstepGUI/GSTheme.h:
* Source/GSDrawFunctions.m:
* Source/GSWindowDecorationView.m: added the drawWindowdBackground:view: method
* Source/GSTheme.m:
Renamed file.
* Source/NSBrowser.m:
* Source/NSTableHeaderCell.m:
* Source/GSWindowDecorationView.m:
* Source/NSImageCell.m:
* Source/NSBox.m:
* Source/GNUmakefile:
* Source/NSFormCell.m:
* Source/NSButtonCell.m:
* Source/NSColorWell.m:
* Source/NSColor.m:
* Source/NSMenuItemCell.m:
* Source/GSTitleView.m:
* Source/NSProgressIndicator.m:
* Source/DocMakefile:
* Source/NSComboBoxCell.m:
* Source/NSStepperCell.m:
* Source/NSScrollView.m:
* Source/NSTabView.m:
* Source/NSCell.m:
* Source/NSTableView.m:
* Documentation/GuiAdditions.gsdoc:
Update for rename of 'GSDrawFunctions to GSTheme.
Change all class based access to drawing methods to go via current
instance.
Remove all class based versions of drawing methods.
2006-05-18 [themes] Nicolas Roard <nicolas@roard.com>
2006-09-22 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepGUI/GSDrawFunctions.h:
* Source/GSDrawFunctions.m:
* Source/NSButtonCell.m: Added theme support for NSButtonCell
with two new methods in GSDrawFunctions:
drawButton:in:view:style:state: and drawFoctusFrame:view:
* Source/GSWindowDecorationView.m: Merge in theme branch changes.
* Source/NSColorList.m: Cooperate with NSColor to change system
color list when a new theme is activated.
* Source/GSDrawFunctions.m: Merge in theme branch changes.
Reorganize, add theme loading functionality, add image tiling
methods.
* Source/NSButtonCell.m: Merge in theme branch changes.
* Source/NSColor.m: Take notice of themes changing the system
color list and interface with NSColorList to make the chanes and
then send out the notification to tell all observers.
* Source/GSTitleView.m: call instance method rather than class method
* Source/DocMakefile: Document theme changes
* Source/NSTabView.m: call instance method rather than class method
* Documentation/GuiAdditions.gsdoc: link to theme documentation
* Documentation/General/GNUmakefile: make theme documentation
* Headers/AppKit/NSWindow.h: improve comments
* Headers/Additions/GNUstepGUI/GSDrawFunctions.h: reorganize
2006-09-21 Matt Rice <ratmice@yahoo.com>
* Source/NSTextFieldCell.m (-setEnabled:): Revert previous patch.
2006-09-20 Matt Rice <ratmice@yahoo.com>
* Source/NSTextField.m (-mouseDown:): Check if the control is
disabled. (bug #13916)
(-acceptFirstResponder:): Return no if disabled.
(-acceptFirstMouse:): Ditto.
* Source/NSTextFieldCell.m (-setEnabled:): Reset the string value
to an empty string if disabling.
2006-09-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSWindowDecorationView.m: ([removeSubview:]) override to
check for removal of the window's content view and handle that
case so that the window knows the content view has gone.
2006-09-17 Matt Rice <ratmice@yahoo.com>
* Source/NSDocument.m (-initWithContentsOfFile:ofType:): Set the
file name and type before attempting to read the document.
2006-09-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-_isCellEditableColumn:row:): Correced
error in last patch, pointed out by David Ayers <ayers@fsfe.org>.
2006-09-17 Fred Kiefer <FredKiefer@gmx.de>
* Images/GSSearch.tiff,
* Images/GSStop.tiff: New icons for the NSSearchButtonCell by
Nikolaus Schaller <hns@computer.org>.
2006-09-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m: Changed _isCellEditable into a method
[_isCellEditableColumn:row:] and use this everywhere. Have this new
method check, if the table column is editable and only when not ask
the delegate wether the cell should be editable. The matches the Cocoa
behaviour as reported by Quentin Mathe <qmathe@club-internet.fr>.
* Source/NSTableView.m (-editColumn:row:withEvent:select:): Allow
selection of cell, even when the data source is not editable.
* Source/NSTableView.m (-mouseDown:): Abort editing.
* Source/NSOutlineView.m (-editColumn:row:withEvent:select:):
Similar changes to super class, plus some code reordering and correction.
2006-09-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSColor.m: Fix memory leak (bug #17769)
2006-09-13 00:28-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/AppKit/NSDrawer.h: Added ivars to support implementation.
* Source/GSNibCompatibility.m: Moved comments to top, for gcc < 3.0
compilation.
* Source/NSDrawer.m: Added GSDrawerWindow implementation and
implementation of some methods in NSDrawer to interact with the
window.
2006-09-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSWindowDecorationView.m: Simplify/rewrite to have the view
always match the window frame so that the window base coordinate
system has its origin at the bottom left corner of the window frame.
* Headers/AppKit/NSWindow.h: Improve documentation
* Headers/Additions/GNUstepGUI/GSDisplayServer.h: ditto
2006-09-06 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/AppKit/NSWindow.h: Add some documentation about what
frame management methods should do. Remove some bogus additional
methods for messing with frames.
* Source/NSWindow.m: ([cascadeTopLeftFromPoint:]) implement to match
MacOS-X specification. Remove unused additional frame methods.
* Source/GSWindowDecorationView.h:
* Source/GSWindowDecorationView.m:
* Source/GSStandardWindowDecorationView.m:
Remove unused/unnecessary methods and simplify.
NB. These fixups require corresponding fixups in the backend.
2006-09-05 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBitmapImageRep+JPEG.m: Fix declaration position causing
compile failure on older compilers. Make more consistent with coding
(indentation and white space usage) standards.
2006-09-04 00:23 Nicolas Roard <nicolas@roard.com>
* Source/NSBitmapImageRep+JPEG.m: Added JPEG writing support to
NSBitmapImageRep. Only handles RGB images (NS*RGBColorSpace).
You can specify the compression ratio by using the
NSImageCompressionFactor key in the properties dictionary.
2006-09-03 12:12-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSStandardWindowDecorationView.m: Put back RELEASE to
prevent memory leak.
* Source/NSControl.m: Reverted last change.
* Source/NSWindow.m: Added autogsdoc comments to methods.
2006-08-31 00:21-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSStandardWindowDecorationView.m: Correct issue in
initWithFrame:window: that was causing a crash when the window
was closed.
* Source/NSControl.m: Reinstated fix from Fred Kiefer for
mouseDown: simplification and refactoring.
2006-08-29 Adam Fedor <fedor@gnu.org>
* Documentation/ReleaseNotes.gsdoc: Updates.
2006-08-28 00:00-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Version 0.11.0
2006-08-26 22:30-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibLoader.m: loadModelData:... Remove TEST_RELEASE
from handler block.
* Source/NSColor.m: initWithCoder: retain autoreleased instances
of NSColor to prevent double release when the pool is cleared.
* Source/NSControl.m: initWithCoder: retain cell to prevent
double release when the pool is cleared.
* Source/NSFont.m: initWithCoder: retain autoreleased instances
of NSFont to prevent double release when the pool is cleared.
2006-08-26 18:25-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSTableView.m: initWithCoder: minor cleanup.
* Source/NSTextFieldCell.m: Retain text/background colors to
prevent crash.
2006-08-26 10:01-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: In [NSIBObjectData initWithCoder:]
clean up the buildMap calls. In NSCustomResource retain the resource
that is returned to prevent a crash. Add dealloc method to
NSCustomObject.
* Source/NSClipView.m: In initWithCoder: retain and release
documentView before removing it from the view and resetting
it as the document view. This ensures that the view will
not be deallocated.
* Source/NSScrollView.m: Retain the contentView before exchanging
it and then release to prevent the view from being deallocated in
initWithCoder:
* Source/NSTableView.m: Replace call to "new" with alloc/init for
NSTableHeaderView in initWithCoder:
* Source/NSView.m: in initWithCoder: keyed coding don't release
the subs array since it's already autoreleased. This was causing
a crash.
2006-08-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBrowser.m (-encodeWithCoder:): Moved variable
declaration to the beginning of the block to not break old
compilers deliberately.
2006-08-20 12:14-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSApplication.m: Remove keys from initWithCoder: and
encodeWithCoder:.
* Source/NSCell.m: Initialize the cell based on content in
initWithCoder:.
* Source/NSFormCell.m: Removed unnecessary decoding of NSContents key
in initWithCoder: since it is already done in NSCell.m.
* Source/NSMatrix.m: initWithCoder:/encodeWithCoder: added
autosizesCells flag and clear flags which are not used
prior to encoding.
* Source/NSPopUpButtonCell.m: Implemented encoding in
encodeWithCoder:.
2006-08-19 15:56-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSBrowser.m: Added comment in encodeWithCoder:.
2006-08-19 10:33-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSBrowserCell.m: Improved encoding and decoding in
encodeWithCoder: and initWithCoder:
* Source/NSBrowser.m: Improved encoding and decoding in
encodeWithCoder: and initWithCoder:
* Source/NSScrollView.m: Improved encoding and decoding in
encodeWithCoder: and initWithCoder:
2006-08-17 00:54-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSButtonCell.m: Improvements in both initWithCoder: and
encodeWithCoder: utilize the setCellAttribute:to: method and
the cellAttribute: method to determine settings when saving
to a keyed archive.
2006-08-16 00:53-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSTabView.m: Corrections in initWithCoder: and
encodeWithCoder: to properly encode items and tabview orientation.
2006-08-15 01:02-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added oids method.
* Images/common_Printer.tiff: Replaced old printer icon with one
created from the PrefsIcon_SelectSpooler_Tile.jpg image on the website.
* Source/GSNibCompatibility.m: Added oids method to get the map.
2006-08-13 16:18-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSCell.m: Conditionally encode the formatter in
encodeWithCoder:.
* Source/NSMenu.m: Change in encodeWithCoder: to add NSName to the
menu with "_NSMainMenu" as the value so that IB will display the menu
properly when loading.
* Source/NSTableView.m: Conditionally encode datasource, delegate,
target and action in encodeWithCoder:
2006-08-13 13:05-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSControl.m: Rolling back previous change to mouseDown:
until it can be determined why it is causing some apps to crash.
2006-08-12 18:37-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
NSPSMatrix placeholder class.
* Source/GSNibCompatibility.m: Added dummy implementation of
NSPSMatrix placeholder class.
* Source/NSOutlineView.m: Eliminated empty if conditional
in encodeWithCoder:.
* Source/NSProgressIndicator.m: Added code to initWithCoder:
to properly unarchive. Also implemented encodeWithCoder: and added
GNUstep specific keys for information that GNUstep uses, but IB
doesn't. All GNUstep specific keys should be prefixed with
GS*.
* Source/NSTableColumn.m: Implemented encodeWithCoder:.
* Source/NSTableView.m: Fixes in encodeWithCoder: to correct issues
during load in InterfaceBuilder.
2006-08-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (displayIfNeededInRect:): Check for
needs_display == YES, instead of NO.
* Headers/AppKit/AppKit.h: Added missing header files and moved
the non-OpenStep ones inside the #ifdef.
* Source/NSTableView.m (-sizeLastColumnToFit): Don't clamp the
value of the new column width, as the column those this by
itself, and rely on the automatic tiling
2006-08-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSSlider.m (mouseDown:, trackKnob:knobRect:,
_floatValueForMousePoint()): Moved all track related code to
cell class.
* Source/NSSliderCell.m (_floatValueForMousePoint(),
trackMouse:...untilMouseUp:): Code previously in the NSSlider class.
Reworked slightly to be more similar to [NSCell trackMouse:...
untilMouseUp:].
2006-08-11 01:50-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Assign copies of the parameters to
setClassName: and setExtension:.
* Source/NSActionCell.m: Encode contro view, since it may be needed
by IB in encodeWithCoder:
* Source/NSButtonCell.m: Unarchive controlview for debugging purposes
in initWithCoder:
* Source/NSCell.m: Addecomment.
2006-08-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSControl.m (mouseDown:): Simplified code to no longer
fiddle with the cells action mask nor to capture the mouse.
2006-08-09 02:28-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSButtonCell.m: Correct encoding of repeat and delay in
encodeWithCoder: since they are encoded as integers.
2006-08-09 01:44-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSFont.m: Correct issue with size encoding in encodeWithCoder:
and initWithCoder:. Properly encode/decode as a float.
* Source/NSImageCell.m: Implement encodeWithCoder:.
* Source/NSImage.m: Comment out code in encodeWithCoder: which
encodes reps until can determine how to properly encode images.
* Source/NSImageView.m: implement encoding in encodeWithCoder:
* Source/NSScrollView.m: Don't encode headerClipView if it's
nil.
* Source/NSTextView.m: Properly encode background color in
NSTextViewSharedData.
* Source/NSView.m: Encoding corrections in initWithCoder: and
encodeWithCoder:.
2006-08-08 21:33-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
* Source/GSNibCompatibility.m: Fix for window size issue caused
by previous change.
* Source/NSBitmapImageRep.m
* Source/NSBox.m
* Source/NSButtonCell.m
* Source/NSCachedImageRep.m
* Source/NSImage.m
* Source/NSTabViewItem.m
* Source/NSTabView.m
* Source/NSTextFieldCell.m: Added encoding in encodeWithCoder:
2006-08-09 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSStepper.h
* Headers/AppKit/NSStepperCell.h: Removed private method declarations.
* Source/NSStepper.m: Moved code from mouseDown: method to the cell
method trackMouse:...untilMouseUp:. Also moved the _increment and
_decrement methods to the cell class.
* Source/NSStepperCell.m: Rewrote mouse tracking to be more
similar to NSCell's implementation and not use any direct
drawing. Do not use hard coded colour values in the drawing
methods, implemented keyed encoding and cleaned up the rest of the
class.
* Source/NSCell.m (trackMouse:...untilMouseUp:): Moved
initialisation of periodCount out of the loop. In the old version
the value stayed always 0.
2006-08-07 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCell.m (-setBezeled:, -setBordered:): Switch border off,
if setBezeled: is called and visa versa, independent of the actual
parameter setting. This matches documented Cocoa behaviour.
2006-08-06 00:30-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Correction in nibInstantiate for
window frame.
* Source/NSActionCell.m
* Source/NSButtonCell.m
* Source/NSCell.m
* Source/NSComboBoxCell.m
* Source/NSControl.m
* Source/NSMatrix.m
* Source/NSTableView.m
* Source/NSTextContainer.m
* Source/NSTextStorage.m
* Source/NSTextView.m: Encoding in encodeWithCoder:.
2006-08-05 09:08-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSMenu.m: encodeWithCoder: encode items and title of
menu.
2006-08-05 08:43-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
* Source/GSNibCompatibility.m: Changed visibleWindows to an Array, as
it should be.
* Source/NSView.m: Avoid encoding of super_view in encodeWithCoder: if
it is the contentView of the window.
2006-07-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-setTypingAttributes:): Make sure to keep
the main parts of the old attributes, if they are not provided by
the new ones.
2006-07-18 23:11-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Added category on NSView and
_fixSubviews method to correct window and superview after
loading the nib file. The _fixSubviews method is called in
nibInstantiate.
* Source/GSNibTemplates.m: More helpful error message for when
decoding fails due to the user attempting to load a version of
GSNibContainer that the container doesn't know about in initWithCoder:
2006-07-17 Enrico Sersale <enrico@fibernet.ro>
* Headers/AppKit/NSHelpManager.h:
* Source/NSHelpManager.m:
added -setContextHelp:forObject: as specified in Apple docs;
-setContextHelp:withObject: deprecated.
2006-07-16 Enrico Sersale <enrico@fibernet.ro>
* Headers/Additions/GNUstepGUI/GSHelpManagerPanel.h: added -buttonAction:
method.
* Source/GSHelpManagerPanel.m: implemented -buttonAction:.
added a button to close the panel and changed the style mask of the window
to NSTitledWindowMask | NSResizableWindowMask.
2006-07-15 Enrico Sersale <enrico@fibernet.ro>
* Headers/AppKit/AppKit.h: added NSHelpManager.h.
* Headers/AppKit/NSHelpManager.h: declaration for new method -pathForHelpResource:
* Source/NSHelpManager.m: implemented -pathForHelpResource: in the NSBundle
category. -pathForHelpResource: looks for help files giving the priority
to localized resources.
-showHelp: looks for rtfd files too.
* Source/GSHelpManagerPanel.m: various fixes to avoid a crash when quitting
and to resize correctly the NSTextView.
2006-07-14 01:17 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h:
* Source/GSNibCompatibility.m: Added method initWithWindow:.. to
initialize the template from an actual window instance.
2006-07-10 00:12 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSSplitView.m: Keyed encoding changes in initWithCoder:
2006-07-09 10:50 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibTemplates.h: Declaration for
new methods: visibleWindows, deferredWindows, & customClasses.
* Source/GSNibTemplates.m: Simplification of awakeFromContext: code
due to new gorm format changes. Also, changes to init to initialize
the new ivars, dealloc to release them and modifications to
initWithCoder: and encodeWithCoder: to decode and encode the new
data. Added new methods: visibleWindows, deferredWindows, &
customClasses.
* Source/NSView.m: Minor cleanup.
2006-07-06 21:35 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSBrowser.m:
* Source/NSClipView.m:
* Source/NSScrollView.m:
* Source/NSTableView.m: Copy some initialization code from
initWithFrame: to initWithCoder.
* Source/NSView.m: Remove from initWithCoder: a call to initWithFrame:
according to the documentation normal objects in a nib should not have
thier initWithFrame: method called at the time they are unarchived.
Also, copy some initialization code here.
2006-07-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSpellServer.m:
* Source/NSAlert.m:
* Source/NSWindowController.m:
* Source/GSDisplayServer.m:
* Source/NSWorkspace.m:
* Source/GSLayoutManager.m:
* Source/NSWindow.m:
* Source/NSLayoutManager.m:
* Source/GSStandardWindowDecorationView.m:
* Source/GSTextStorage.m:
* Source/GSHorizontalTypesetter.m:
* Source/NSColor.m:
* Source/NSPasteboard.m:
* Source/NSMenuItem.m:
* Source/NSPageLayout.m:
* Source/NSOutlineView.m:
* Source/NSTextView.m:
* Source/NSBitmapImageRep+JPEG.m:
* Source/NSComboBoxCell.m:
* Source/NSToolbarItem.m:
* Source/NSImage.m:
* Source/NSDataLink.m:
* Source/GSServicesManager.m:
* Source/NSPrintPanel.m:
* Source/NSEvent.m:
* Source/GSDragView.m:
* Model/GMArchiver.m:
* Model/IMConnectors.m:
* Tools/GSspell.m:
Tweaks to avoid spurious warnings in recent gcc-4.1 and a few casts
etc to deal with a few real issues when working on 64bit cpus.
2006-07-02 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-rulerView:didMoveMarker:,
-rulerView:didRemoveMarker:, -rulerView:didAddMarker:): Removed a
compiler warning by adding a type cast.
* Source/NSTextView.m (-initWithCoder:) Removed unused variables.
* Source/NSTextView.m (NSTextViewSharedData -dealloc) Call super dealloc.
* Source/NSApplication.m (-initWithCoder:) Set delegate only when
the keyed decoder contains it.
* Source/NSSlider.m (-trackKnob:knobRect:, mouseDown:) Don't draw
explicitly, as this gets handled automatically by the cell.
* Source/NSOutlineView.m (-editColumn:row:withEvent:select:) Moved
the lockFocus call right around the image cell drawing, as it is
only needed here.
2006-06-25 12:40 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Added NSDecimalNumberPlaceholder
class implementation to decode NSDecimalNumber instances in
nib files.
2006-06-25 00:26 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: in -[NSIBObjectData
instantiateWithOwner:topLevelObjects:] properly initialize
the NSWindowTemplate and fill in the topLevelObjects array.
2006-06-20 20:58 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
declarations for classes and names methods and change return
type for objects method.
* Source/GSNibCompatibility.m: Properly return the pointer in
objects method and also add methods for names, and classes
maps in the nib file.
* Source/NSDocument.m: Refuse to write a file for a type which isn't
native. If the class method isNativeType: returns YES, then write the
file in writeToFile:ofType:saveOperation:.
* Source/NSSliderCell.m: Make the cell non-bordered in initWithCoder:
2006-06-18 14:38 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
NSIBHelpConnector declaration.
* Source/GSNibCompatibility.m: Added skeleton implementation of
NSIBHelpConnector.
2006-06-17 20:39 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Resize window to window rect
size in nibInstantiate.
2006-06-17 10:52 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Removed
unecessary ivar.
* Source/GSNibCompatibility.m: Remove some uneeded code. Added
code to translate a class properly NSClassSwapper when the class has
a replacement registered with the current NSKeyedUnarchiver.
2006-06-15 00:51 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
new method declarations.
* Source/GSNibCompatibility.m: Added isInterfaceBuilder method
here.
* Source/NSDocument.m: Added code to prevent the popup from
showing blank when the fileType is set to a non-Editor type.
2006-06-11 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView_actions.m (-deleteToEndOfLine:): New method
based on patch by Andreas Höschler <ahoesch@smartsoft.de>.
* KeyBindings/DefaultKeyBindings.dict: Enable Control-k.
2006-06-09 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (-discardCursorRects)
* Source/NSWindow.m (-invalidateCursorRectsForView:): Updated
version of patch for improved handling of cursor rects to fix bug #5871.
Patch by Mircea Trache <aer@shaw.ca>.
2006-06-08 00:00 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibContainer.h: Minor cleanup.
* Source/GSNibCompatibility.m: Added exception similar to the
one for NSWindow to classes here, which don't implement non-keyed
coding.
* Source/GSNibTemplates.m: Added initial objects for GSCustomClass,
NSDeferred, NSVisible names in name table.
* Source/NSWindow.m: Added corrected exception text.
2006-06-04 13:30 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/AppKit/NSDrawer.h: Added ivar _contentSize to header.
* Source/NSDrawer.m: Implemented keyed and non-keyed encoding.
2006-06-04 12:28 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSTrackingRect.m: Encode, if not a keyed archiver.
* Source/NSApplication.m: Added coding
* Source/NSDataLink.m: Added coding
* Source/NSDataLinkManager.m: Added coding
* Source/NSNib.m: Made comment use "TODO_NIB" instead of TODO, so that
it can be pulled later.
* Source/NSParagraphStyle.m: Added TODO_NIB.
* Source/NSSelection.m: Added coding.
* Source/NSSound.m: Added TODO_NIB
* Source/NSTextAttachment.m: Added TODO_NIB.
2006-06-04 01:09 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSHbox.m: Implemented keyed coding.
* Source/GSNibCompatibility.m: Added private method to help
better decode keys/values in the nib data structures.
* Source/GSTable.m: Implemented keyed coding.
* Source/GSTextStorage.m: Added code to skip existing
coding method contents, if the coder is a keyed coder.
* Source/GSVbox.m: Implemented keyed coding.
* Source/NSMenuView.m: Added code to skip coding, if
it is a keyed coder.
* Source/NSPanel.m: Added comment indicating that the
call to the superclass initWithCoder method should throw
an exception per documentation.
* Source/NSPrinter.m: Added if to skip the coder logic,
if using a keyed coder.
* Source/NSStepper.m: Removed dummy initWithCoder:/encodeWithCoder:
methods since they only called the superclass.
* Source/NSWindow.m: Added exception called for in the
documentation if NSWindow initWithCoder:/encodeWithCoder:
is called with a keyed archiver.
2006-06-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPrinter.m (-interpretQuotedValue:, -gethex:): Better
error reporting on non-hexadecimal substring. Ignore "<<" sequence
as this is valid as part of a PS command string.
2006-06-01 00:13 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/AppKit/NSDocumentFrameworkPrivate.h: Addition of new
private methods to manage file types.
* Headers/AppKit/NSDocument.h: New ivar _saveType.
* Source/NSDocumentController.m: Implementation of new private
methods.
* Source/NSDocument.m: Changed writeWithBackupToFile:ofType:
saveOperation: to use new methods to get the human readable
filetypes to be listed in the dropdown in the savepanel and to
properly retrieve the extension for the specified filetype
and apply it to the backup filename and filename being saved.
Also modified changeSaveType: to update the save panel's
requiredFileType when the type is changed.
2006-05-21 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSApplication.m: Implement MacOS-X behavior (as determined
by experimentation) of sending ([performKeyEquivalent:]) to main menu
and to the key window. This differs from the old behavior of sending
to all windows and means that popup/pulldown menus on windows other
than the key window now cannot be activated using key equivalents.
2006-05-30 00:53 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSDocument.m: Implemented accessory view logic when
the document can save more than one filetype.
2006-05-29 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSApplication.m: Revert last change which broke menu
key equivalents for off-screen windows.
* Source/NSOpenPanel.m: Fix handling CR key equivalent (bug #16688)
so that panel only takes action when it is active.
* Source/NSSavePanel.m: ditto
Fix done by disabling the ok button when the panel is not active,
but what about if other panels have similar bugs ... shouldn't there
be some automatic mechanism to stop buttons (but not menu items) from
responding to key equivalents when a window is not the key window?
* Source/NSButton.m: ([performKeyEquivalent:]) return NO if blocked
by a modal window as per macos-x documentation.
2006-05-29 00:58 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSApplication.m: Correction for bug#16688.
* Source/NSDocumentController.m: Changed comment for currentDirectory.
* Source/NSDocument.m: Removed "FIXME" since it is inaccurate.
The signature of the method is the same as in the documentation.
2006-05-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (-discardCursorRects, -removeCursorRect:cursor:)
* Source/NSWindow.m (-invalidateCursorRectsForView:,
-resetCursorRects): Improved handling of cursor rects to fix bug #5871.
* Source/NSCursor.m (-mouseExited:):
Set the default cursor, when the cursor was set on enter.
Patch by Mircea Trache <aer@shaw.ca>.
2006-05-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTabView.m (-tabViewItemAtPoint:, -mouseDown:): Moved
conversion of point with view transformation into the mouseDown:
method to be compatible with Cocoa.
Patch by Andreas Höschler <ahoesch@smartsoft.de>.
2006-05-20 18:25 Gregory John Casamento <greg_casamento@yahoo.com>

View file

@ -18,7 +18,8 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02111 USA.
# Install into the system root by default
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)

View file

@ -19,7 +19,8 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02111 USA
#
# Install into the system root by default

View file

@ -25,6 +25,7 @@
</p>
<list>
<item><uref url="GSDisplayServer.html">GSDisplayServer</uref></item>
<item><uref url="GSTheme.html">GSTheme</uref></item>
<item><uref url="GSHbox.html">GSHbox</uref></item>
<item><uref url="GSTable.html">GSTable</uref></item>
<item><uref url="GSVbox.html">GSVbox</uref></item>

View file

@ -215,7 +215,11 @@
<desc>
<p>
An interface style specific to menu operation. If not set
the NSInterfaceStyleDefault value is used.
the NSInterfaceStyleDefault value is used. <br />
Setting this to NSMacintoshInterfaceStyle produces a horizontal
menu at the top of the screen.<br />
Setting it to NSNextStepInterfaceStyle reverts to the defaults
vertical menu layout.
</p>
</desc>
<term>NSCommandKeys</term>
@ -282,6 +286,15 @@
directory. This color list can also be manipulated through the
NSColorList class (typically through a preferences module).
</p>
<p>
Individual system colors may be set by specifying the name of
the system color and giving it a value consisting of aan RGB
color specification (three floating point numbers in the range
0.0 to 1.0 and separated by spaces).<br />
eg.<br />
'defaults write NSGlobalDomain controlBackgroundColor "1.0 0.0 0.0"'
</p>
</desc>
<term><em>System Fonts</em></term>
<desc>

View file

@ -19,6 +19,29 @@
changes and other information that might help developers and users
migrate to using a newer version of the library.
</p>
<section>
<heading>Version 0.11.0</heading>
<deflist>
<term>Keyed Encoding/Archiving</term>
<desc>
Support for keyed encoding has been added to all gui classes.
</desc>
<term>Nib loading</term>
<desc>
Nib loading has been implemented. For the most part, nibs
are (or should be) compatible between GNUstep and Mac OS X.
</desc>
<term>Color schemes and Themes</term>
<desc>
Better support for color schemes and themes has been added. In
the near future theming should be integrated into gui itself.
</desc>
<term>RTFD</term>
<desc>
Loading and writting of RTFD format was implemented.
</desc>
</deflist>
</section>
<section>
<heading>Version 0.10.3</heading>
<deflist>

View file

@ -9,6 +9,19 @@
The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}.
@end ifclear
@section Noteworthy changes in version @samp{0.11.0}
@itemize @bullet
@item Added support for keyed encoding in all gui classes.
@item Added mechanism to allow for dynamic extension of
model loading mechanism
@item Implemented glue code in GSNibCompatibility for
classes such as NSIBObjectData, NSClassSwapper, etc. to
facilitate nib loading.
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.10.3}
@itemize @bullet
@ -16,8 +29,6 @@ The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSIO
@item Better support for tracking active applications.
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.10.2}
Mostly bug fixes.
@ -36,7 +47,7 @@ and libraries that use the base library need to be recompiled to use
this new version.
@itemize @bullet
@item Nib loading supports window auto-positioning
@item Model loading supports window auto-positioning
@item Keyed encoding is supported in many classes.
@end itemize

View file

@ -21,7 +21,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _GSDisplayServer_h_INCLUDE

View file

@ -1,75 +0,0 @@
/** <title>GSDrawFunctions</title>
<abstract>Useful/configurable drawing functions</abstract>
Copyright (C) 2004 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Date: Jan 2004
This file is part of the GNU Objective C User interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#ifndef _GNUstep_H_GSDrawFunctions
#define _GNUstep_H_GSDrawFunctions
#include <Foundation/NSGeometry.h>
// For gradient types
#include "AppKit/NSButtonCell.h"
@class NSColor;
@interface GSDrawFunctions : NSObject
+ (id) theme;
+ (void) setTheme: (id)theme;
+ (NSRect) drawButton: (NSRect)border : (NSRect)clip;
+ (NSRect) drawDarkButton: (NSRect)border : (NSRect)clip;
+ (NSRect) drawDarkBezel: (NSRect)border : (NSRect)clip;
+ (NSRect) drawLightBezel: (NSRect)border : (NSRect)clip;
+ (NSRect) drawGrayBezel: (NSRect)border : (NSRect)clip;
+ (NSRect) drawWhiteBezel: (NSRect)border : (NSRect)clip;
+ (NSRect) drawGroove: (NSRect)border : (NSRect)clip;
+ (NSRect) drawFramePhoto: (NSRect)border : (NSRect)clip;
+ (NSRect) drawGradientBorder: (NSGradientType)gradientType
inRect: (NSRect)border
withClip: (NSRect)clip;
- (NSRect) drawButton: (NSRect)border : (NSRect)clip;
- (NSRect) drawDarkButton: (NSRect)border : (NSRect)clip;
- (NSRect) drawDarkBezel: (NSRect)border : (NSRect)clip;
- (NSRect) drawLightBezel: (NSRect)border : (NSRect)clip;
- (NSRect) drawGrayBezel: (NSRect)border : (NSRect)clip;
- (NSRect) drawWhiteBezel: (NSRect)border : (NSRect)clip;
- (NSRect) drawGroove: (NSRect)border : (NSRect)clip;
- (NSRect) drawFramePhoto: (NSRect)border : (NSRect)clip;
- (NSRect) drawGradientBorder: (NSGradientType)gradientType
inRect: (NSRect)border
withClip: (NSRect)clip;
/* Themes */
- (NSRect) drawButton: (NSRect) frame in: (NSButtonCell*) cell
view: (NSView*) view style: (int) style state: (int) state;
- (void) drawFocusFrame: (NSRect) frame view: (NSView*) view;
- (void) drawWindowBackground: (NSRect) frame view: (NSView*) view;
@end
#endif /* _GNUstep_H_GSDrawFunctions */

View file

@ -0,0 +1,283 @@
/** <title>GSTheme</title>
<abstract>Useful/configurable drawing functions</abstract>
Copyright (C) 2004-2006 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Author: Richard Frith-Macdonald <rfm@gnu.org>
Date: Jan 2004
This file is part of the GNU Objective C User interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _GNUstep_H_GSTheme
#define _GNUstep_H_GSTheme
#include <Foundation/NSGeometry.h>
// For gradient types
#include "AppKit/NSButtonCell.h"
@class NSBundle;
@class NSColor;
@class GSDrawTiles;
/**
* This defines how the center middle image in a tile array should be
* used when drawing a rectangle.
*/
typedef enum {
FillStyleNone, /** The image is not drawn */
FillStyleScale, /** The image is scaled to fit */
FillStyleRepeat, /** The image is tiled from bottom left */
FillStyleCenter /** The image is tiled from the center */
} GSThemeFillStyle;
/** Notification sent when a theme has just become active.
*/
APPKIT_EXPORT NSString *GSThemeDidActivateNotification;
/** Notification sent when a theme has become inactive.
*/
APPKIT_EXPORT NSString *GSThemeDidDeactivateNotification;
/**
<p><em>This interface is <strong>HIGHLY</strong> unstable
and incomplete at present.</em>
</p>
<p>
This is a class used for 'theming', which is mostly a matter of
encapsulating common drawing behaviors so that GUI appearance can
be easily modified, but also includes mechanisms for altering
some GUI behavior (such mas orientation and position of menus).
</p>
<p>
Methods in this class standardize drawing of buttons, borders
and other common GUI elements, so that all other classes within
the GUI will provide a consistent appearance by using these
methods.
</p>
<p>
The default implementation uses the standard configurable colors
defined in NSColor, such as <code>controlLightHighlightColor</code>,
<code>controlShadowColor</code> and <code>controlDarkShadowColor</code>.<br />
Themes are expected to override the default system color list with their
own versions, and this class cooperates with [NSColor] and [NSColorList]
to establish the correct system color list when a theme is activated.
</p>
<p>
The class provides a mechanism for automatic loading of theme bundles
consisting of resources used to define how drawing is done, plus an
optional binary subclass of this class (to replace/extend the drawing
methods this class provides).
</p>
<p>
In future this class should provide mechanisms to draw controls by
tiling of images, and provide control over GUI behavior by controlling
the values returned by NSInterfaceStyleForKey() so that controls
use the appropriate behavior.
</p>
*/
@interface GSTheme : NSObject
{
@private
NSBundle *_bundle;
NSMutableArray *_images;
NSMutableDictionary *_tiles;
}
/**
* Set the currently active theme to be the instance specified.<br />
* You do not normally need to call this method as it is called
* automatically when the user default which specifies the current
* theme (GSTheme) is updated.
*/
+ (void) setTheme: (GSTheme*)theme;
/**
* Returns the currently active theme instance. This is the value most
* recently set using +setTheme: or (if none has been set) is a default
* instance of the base class.
*/
+ (GSTheme*) theme;
/**
* <p>This method is called automatically when the receiver is made into
* the currently active theme by the +setTheme: method. Subclasses may
* override it to perform startup operations, but should call the super
* class implementation before doing their own thing.
* </p>
* <p>The base implementation handles setup and caching of certain image
* information and then sends a GSThemeDidActivateNotification to allow
* other parts of the GUI library to update themselves from the new theme.<br />
* If the theme sets an alternative system color list, the notification
* userInfo dictionary will contain that list keyed on <em>Colors</em>.
* </p>
*/
- (void) activate;
/**
* Return the bundle containing the resources used by the current theme.
*/
- (NSBundle*) bundle;
/**
* <p>This method is called automatically when the receiver is stopped from
* being the currently active theme by the use of the +setTheme: method
* to make another theme active. Subclasses may override it to perform
* shutdown operations, but should call the super class implementation
* after their own.
* </p>
* <p>The base implementation handles some cleanup and then sends a
* GSThemeDidDeactivateNotification to allow other parts of the GUI library
* to update themselves.
* </p>
*/
- (void) deactivate;
/** <init />
* Initialise an instance of a theme with the specified resource bundle.<br />
* You don't need to call this method directly, but if you are subclassing
* you may need to override this to provide additional initialisation.
*/
- (id) initWithBundle: (NSBundle*)bundle;
/**
* Returns the tile image information for a particular image name,
* or nil if there is no such information.<br />
* The GUI library uses this internally to handling tiling of image
* information to draw user interface elements. The tile information
* returned by this method can be passed to the
* -fillRect:withTiles:background:fillStyle: method.
*/
- (GSDrawTiles*) tilesNamed: (NSString*)aName;
@end
/**
* Theme drawing methods
*/
@interface GSTheme (Drawing)
/**
* Draws a button frame and background (not its content) for the specified
* cell and view.<br />
* Returns the rectangle into which the cell contents should be drawn.
*/
- (NSRect) drawButton: (NSRect)frame
in: (NSButtonCell*)cell
view: (NSView*)view
style: (int)style
state: (int)state;
/** Draws the indicator (normally a dotted rectangle) to show that
* the view currently has keyboard focus.
*/
- (void) drawFocusFrame: (NSRect)frame view: (NSView*)view;
/**
* Draws the background of a window ... normally a simple fill with the
* the window's background color.
*/
- (void) drawWindowBackground: (NSRect)frame view: (NSView*)view;
@end
/**
* Helper functions for drawing standard items.
*/
@interface GSTheme (MidLevelDrawing)
/** Draw a standard button */
- (NSRect) drawButton: (NSRect)border withClip: (NSRect)clip;
/** Draw a dark bezel border */
- (NSRect) drawDarkBezel: (NSRect)border withClip: (NSRect)clip;
/** Draw a "dark" button border (used in tableviews) */
- (NSRect) drawDarkButton: (NSRect)border withClip: (NSRect)clip;
/** Draw a frame photo border. Used in NSImageView. */
- (NSRect) drawFramePhoto: (NSRect)border withClip: (NSRect)clip;
/** Draw a gradient border. */
- (NSRect) drawGradientBorder: (NSGradientType)gradientType
inRect: (NSRect)border
withClip: (NSRect)clip;
/** Draw a grey bezel border */
- (NSRect) drawGrayBezel: (NSRect)border withClip: (NSRect)clip;
/** Draw a groove border */
- (NSRect) drawGroove: (NSRect)border withClip: (NSRect)clip;
/** Draw a light bezel border */
- (NSRect) drawLightBezel: (NSRect)border withClip: (NSRect)clip;
/** Draw a white bezel border */
- (NSRect) drawWhiteBezel: (NSRect)border withClip: (NSRect)clip;
@end
/**
* Low level drawiong methods ... themes may use these for drawing,
* but should not normally override them.
*/
@interface GSTheme (LowLevelDrawing)
/**
* Method to tile the supplied image to fill the horizontal rectangle.
*/
- (void) fillHorizontalRect: (NSRect)rect
withImage: (NSImage*)image
fromRect: (NSRect)source
flipped: (BOOL)flipped;
/**
* Tile rect with image. The tiling starts with the origin of the
* first copy of the image at the bottom left corner of the rect
* unless center is YES, in which case the image is centered in rect
* and tiled outwards from that.
*/
- (void) fillRect: (NSRect)rect
withRepeatedImage: (NSImage*)image
fromRect: (NSRect)source
center: (BOOL)center;
/**
* Method to tile a rectangle given an array of nine tile images.<br />
* This draws the left, right, top and bottom borders by tiling the
* images at TileCL, TileCR, TileTM and TileBM respectively. It then
* draws the four corner images and finally deals with the remaining
* space in the middle according to the specified style.<br />
* The background color specified is used where style is FillStyleNone.
*/
- (void) fillRect: (NSRect)rect
withTiles: (GSDrawTiles*)tiles
background: (NSColor*)color
fillStyle: (GSThemeFillStyle)style;
/**
* Method to tile the supplied image to fill the vertical rectangle.
*/
- (void) fillVerticalRect: (NSRect)rect
withImage: (NSImage*)image
fromRect: (NSRect)source
flipped: (BOOL)flipped;
@end
#endif /* _GNUstep_H_GSTheme */

View file

@ -43,10 +43,8 @@
#include <AppKit/NSGraphics.h>
#include <AppKit/NSActionCell.h>
#include <AppKit/NSAffineTransform.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSAttributedString.h>
#include <AppKit/NSBezierPath.h>
#include <AppKit/NSBitmapImageRep.h>
#include <AppKit/NSBox.h>
#include <AppKit/NSBrowser.h>
@ -62,16 +60,12 @@
#include <AppKit/NSColorPicker.h>
#include <AppKit/NSColorPicking.h>
#include <AppKit/NSColorWell.h>
#include <AppKit/NSComboBox.h>
#include <AppKit/NSComboBoxCell.h>
#include <AppKit/NSControl.h>
#include <AppKit/NSCursor.h>
#include <AppKit/NSCustomImageRep.h>
#include <AppKit/NSDataLink.h>
#include <AppKit/NSDataLinkManager.h>
#include <AppKit/NSDataLinkPanel.h>
#include <AppKit/NSDocument.h>
#include <AppKit/NSDocumentController.h>
#include <AppKit/NSDragging.h>
#include <AppKit/NSEPSImageRep.h>
#include <AppKit/NSEvent.h>
@ -80,13 +74,11 @@
#include <AppKit/NSFontPanel.h>
#include <AppKit/NSForm.h>
#include <AppKit/NSFormCell.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSHelpPanel.h>
#include <AppKit/NSImage.h>
#include <AppKit/NSImageCell.h>
#include <AppKit/NSImageRep.h>
#include <AppKit/NSImageView.h>
#include <AppKit/NSInterfaceStyle.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSMenu.h>
#include <AppKit/NSMenuItem.h>
@ -94,10 +86,8 @@
#include <AppKit/NSMenuView.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/NSOpenPanel.h>
#include <AppKit/NSOutlineView.h>
#include <AppKit/NSPageLayout.h>
#include <AppKit/NSPanel.h>
#include <AppKit/NSParagraphStyle.h>
#include <AppKit/NSPasteboard.h>
#include <AppKit/NSPopUpButton.h>
#include <AppKit/NSPopUpButtonCell.h>
@ -105,54 +95,74 @@
#include <AppKit/NSPrintInfo.h>
#include <AppKit/NSPrintOperation.h>
#include <AppKit/NSPrintPanel.h>
#include <AppKit/NSProgressIndicator.h>
#include <AppKit/NSResponder.h>
#include <AppKit/NSSavePanel.h>
#include <AppKit/NSScreen.h>
#include <AppKit/NSScroller.h>
#include <AppKit/NSScrollView.h>
#include <AppKit/NSSecureTextField.h>
#include <AppKit/NSSelection.h>
#include <AppKit/NSSlider.h>
#include <AppKit/NSSliderCell.h>
#include <AppKit/NSSound.h>
#include <AppKit/NSSpellChecker.h>
#include <AppKit/NSSpellProtocol.h>
#include <AppKit/NSSpellServer.h>
#include <AppKit/NSSplitView.h>
#include <AppKit/NSStringDrawing.h>
#include <AppKit/NSText.h>
#include <AppKit/NSTextField.h>
#include <AppKit/NSTextFieldCell.h>
#include <AppKit/NSView.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSWorkspace.h>
#ifndef STRICT_OPENSTEP
#include <AppKit/NSAlert.h>
#include <AppKit/NSAffineTransform.h>
#include <AppKit/NSBezierPath.h>
#include <AppKit/NSComboBox.h>
#include <AppKit/NSComboBoxCell.h>
#include <AppKit/NSDocument.h>
#include <AppKit/NSDocumentController.h>
#include <AppKit/NSDrawer.h>
#include <AppKit/NSFileWrapper.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSHelpManager.h>
#include <AppKit/NSInputManager.h>
#include <AppKit/NSInputServer.h>
#include <AppKit/NSInterfaceStyle.h>
#include <AppKit/NSLayoutManager.h>
#include <AppKit/NSMovie.h>
#include <AppKit/NSMovieView.h>
#include <AppKit/NSNib.h>
#include <AppKit/NSNibDeclarations.h>
#include <AppKit/NSOpenGL.h>
#include <AppKit/NSOpenGLView.h>
#include <AppKit/NSOutlineView.h>
#include <AppKit/NSParagraphStyle.h>
#include <AppKit/NSProgressIndicator.h>
#include <AppKit/NSRulerMarker.h>
#include <AppKit/NSRulerView.h>
#include <AppKit/NSSearchField.h>
#include <AppKit/NSSearchFieldCell.h>
#include <AppKit/NSSecureTextField.h>
#include <AppKit/NSSound.h>
#include <AppKit/NSStepper.h>
#include <AppKit/NSStepperCell.h>
#include <AppKit/NSStringDrawing.h>
#include <AppKit/NSTableColumn.h>
#include <AppKit/NSTableHeaderCell.h>
#include <AppKit/NSTableHeaderView.h>
#include <AppKit/NSTableView.h>
#include <AppKit/NSTabView.h>
#include <AppKit/NSTabViewItem.h>
#include <AppKit/NSText.h>
#include <AppKit/NSTextField.h>
#include <AppKit/NSTextFieldCell.h>
#include <AppKit/NSTextView.h>
#include <AppKit/NSView.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSWorkspace.h>
#include <AppKit/NSNibDeclarations.h>
#ifndef STRICT_OPENSTEP
#include <AppKit/NSDrawer.h>
#include <AppKit/NSFileWrapper.h>
#include <AppKit/NSLayoutManager.h>
#include <AppKit/NSOutlineView.h>
#include <AppKit/NSNib.h>
#include <AppKit/NSRulerMarker.h>
#include <AppKit/NSRulerView.h>
#include <AppKit/NSTextAttachment.h>
#include <AppKit/NSTextContainer.h>
#include <AppKit/NSTextStorage.h>
#include <AppKit/NSTextView.h>
#include <AppKit/NSToolbar.h>
#include <AppKit/NSToolbarItem.h>
#include <AppKit/NSUserInterfaceValidation.h>
#include <AppKit/NSWindowController.h>
#include <AppKit/NSWindow+Toolbar.h>
#include <AppKit/NSToolbar.h>
#include <AppKit/NSToolbarItem.h>
#endif
#include <AppKit/PSOperators.h>

View file

@ -80,6 +80,7 @@ typedef enum _NSSaveOperationType {
NSPopUpButton *spaButton; // outlet for "the File Format:" button in the save panel.
int _documentIndex; // Untitled index
NSUndoManager *_undoManager; // Undo manager for this document
NSString *_saveType; // the currently selected extension.
struct __docFlags {
unsigned int inClose:1;
unsigned int hasUndoManager:1;

View file

@ -34,6 +34,9 @@
- (NSArray *)_editorAndViewerTypesForClass:(Class)documentClass;
- (NSArray *)_editorTypesForClass:(Class)fp12;
- (NSArray *)_exportableTypesForClass:(Class)documentClass;
- (NSString *)_nameForHumanReadableType: (NSString *)type;
- (NSArray *)_displayNamesForTypes: (NSArray *)types;
- (NSArray *)_displayNamesForClass: (Class)documentClass;
@end

View file

@ -47,12 +47,12 @@ enum {
{
// Attributes
id _delegate;
NSView *_contentView;
NSWindow *_parentWindow;
id _drawerWindow;
NSRectEdge _preferredEdge;
NSRectEdge _currentEdge;
NSSize _maxContentSize;
NSSize _minContentSize;
NSSize _contentSize;
float _leadingOffset;
float _trailingOffset;
int _state;

View file

@ -37,7 +37,8 @@
@class NSAttributedString;
@interface NSBundle (NSHelpManager)
- (NSAttributedString*) contextHelpForKey: (NSString*) key;
- (NSString *)pathForHelpResource:(NSString *)fileName;
- (NSAttributedString *)contextHelpForKey:(NSString *)key;
@end
@interface NSApplication (NSHelpManager)
@ -67,6 +68,8 @@
- (void) removeContextHelpForObject: (id)object;
- (void)setContextHelp:(NSAttributedString *)help forObject:(id)object;
- (void) setContextHelp: (NSAttributedString*) help withObject: (id) object;
- (BOOL) showContextHelpForObject: (id)object locationHint: (NSPoint) point;

View file

@ -31,8 +31,6 @@
#include <AppKit/NSControl.h>
@class NSEvent;
@interface NSStepper : NSControl
{
// Attributes
@ -44,18 +42,11 @@
- (double) increment;
- (void) setIncrement: (double)increment;
- (BOOL)autorepeat;
- (void)setAutorepeat: (BOOL)autorepeat;
- (BOOL)valueWraps;
- (void)setValueWraps: (BOOL)valueWraps;
- (void)mouseDown:(NSEvent*)event;
@end
@interface NSStepper (Private)
- (void)_increment;
- (void)_decrement;
@end
#endif // _GNUstep_H_NSStepper

View file

@ -29,8 +29,7 @@
#include <AppKit/NSActionCell.h>
@interface NSStepperCell : NSActionCell <NSCoding>
@interface NSStepperCell : NSActionCell
{
// Think of the following ones as of two BOOL ivars
#define _autorepeat _cell.subclass_bool_one
@ -50,29 +49,11 @@
- (double)increment;
- (void)setIncrement: (double)increment;
- (BOOL)autorepeat;
- (void)setAutorepeat: (BOOL)autorepeat;
- (BOOL)valueWraps;
- (void)setValueWraps: (BOOL)valueWraps;
//
// NSCoding protocol
//
- (void)encodeWithCoder: (NSCoder *)aCoder;
- initWithCoder: (NSCoder *)aDecoder;
@end
@interface NSStepperCell (Private)
- (void) highlight: (BOOL) highlight
upButton: (BOOL) upButton
withFrame: (NSRect) frame
inView: (NSView*) controlView;
- (NSRect)upButtonRectWithFrame: (NSRect) frame;
- (NSRect)downButtonRectWithFrame: (NSRect) frame;
- (void)_drawText: (NSRect)aRect;
@end
#endif // _GNUstep_H_NSStepperCell

View file

@ -101,38 +101,44 @@ typedef enum _NSSelectionDirection {
APPKIT_EXPORT NSSize NSIconSize;
APPKIT_EXPORT NSSize NSTokenSize;
/**
* <p>An NSWindow instance represents a window, panel or menu on the
* screen.<br />
* Each window has a style, which determines how the window is decorated:
* ie whether it has a border, a title bar, a resize bar, minimise and
* close buttons.
* </p>
* <p>A window has a <em>frame</em>. This is the frame of the <em>entire</em>
* window on the screen, including all decorations and borders. The origin
* of the frame represents its bottom left corner and the frame is expressed
* in screen coordinates (see [NSScreen]).
* </p>
* <p>When a window is created, it has a <em>private</em> [NSView] instance
* which fills the entire window frame and whose coordinate system is the
* same as the base coordinate system of the window (ie zero x and
* y coordinates are at the bottom left corner of the window, with increasing
* x and y corresponding to points to the right and above the origin).<br />
* This view may be used by the library internals (and theme engines) to
* draw window decorations if the backend library is not handling the
* window decorations.
* </p>
* <p>A window always contains a <em>content view</em> which is the highest
* level view available for public (application) use. This view fills the
* area of the window inside any decoration/border.<br />
* This is the only part of the window that application programmers are
* allowed to draw in directly.
* </p>
* <p>You can convert between view coordinates and window base coordinates
* using the [NSView-convertPoint:fromView:], [NSView-convertPoint:toView:],
* [NSView-convertRect:fromView:], and [NSView-convertRect:toView:]
* methods with a nil view argument.<br />
* You can convert between window and screen coordinates using the
* -convertBaseToScreen: and -convertScreenToBase: methods.
* </p>
*/
@interface NSWindow : NSResponder <NSCoding>
{
/*
A window really has three interesting frames:
The screen frame. This is the frame of the _entire_ window on the screen,
including all decorations and borders (regardless of where they come from).
(On X, we can only guess what the screen frame is.)
The window frame. This is the frame of the backend window for this window,
and is thus the base of the coordinate system for the window. IOW, it's
the frame of the area we can draw into.
The contect rect. This is the frame of the content view.
Wrt. size, ScreenFrame >= WindowFrame >= ContentRect. When -gui doesn't
manage the window decorations, WindowFrame == ContentRect. When -gui does
manage the window decorations, WindowFrame will include the decorations,
and ScreenFrame == WindowFrame.
To get coordinate transforms and stuff right wrt. OpenStep, we really want
the window frame here.
For hysterical reasons, _frame used to be the screen frame. However, the
resulting inconsistencies caused a bunch of problems. Thus, _frame is the
window frame. The other rectangles/sizes passed around in NSWindow
methods are supposed to all be window frames.
*/
NSRect _frame;
NSSize _minimumSize;
NSSize _maximumSize;
NSSize _increments;
@ -219,21 +225,29 @@ APPKIT_EXPORT NSSize NSTokenSize;
* Computing frame and content rectangles
*/
/* These methods convert between the various frames discussed above. */
/**
* Returns the rectangle which would be used for the content view of
* a window whose on-screen size and position is specified by aRect
* and which is decorated with the border and title etc given by aStyle.<br />
* Both rectangles are expressed in screen coordinates.
*/
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
/**
* Returns the rectangle which would be used for the on-screen frame of
* a window if that window had a content view occupying the rectangle aRect
* and was decorated with the border and title etc given by aStyle.<br />
* Both rectangles are expressed in screen coordinates.
*/
+ (NSRect) frameRectForContentRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
+ (NSRect) screenRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
+ (NSRect) frameRectForScreenRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
/* Returns the smallest window width that will fit the given title and
style. */
/**
* Returns the smallest frame width that will fit the given title
* and style. This is the on-screen width of the window including
* decorations.
*/
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
styleMask: (unsigned int)aStyle;
@ -246,28 +260,78 @@ style. */
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag;
/**
* Creates a new window with the specified characteristics.<br />
* The contentRect is expressed in screen coordinates (for aScreen)
* and the window frame is calculated from the content rectangle and
* the window style mask.
*/
- (id) initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
screen: (NSScreen*)aScreen;
/*
* Converting coordinates
/**
* Converts aPoint from the base coordinate system of the receiver
* to a point in the screen coordinate system.
*/
- (NSPoint) convertBaseToScreen: (NSPoint)aPoint;
/**
* Converts aPoint from the screen coordinate system to a point in
* the base coordinate system of the receiver.
*/
- (NSPoint) convertScreenToBase: (NSPoint)aPoint;
/*
* Moving and resizing the window
/**
* Returns the frame of the receiver ... the rectangular area that the window
* (including any border, title, and other decorations) occupies on screen.
*/
- (NSRect) frame;
/**
* <p>Sets the frame for the receiver to frameRect and if flag is YES causes
* the window contents to be refreshed. The value of frameRect is the
* desired on-screen size and position of the window including all
* border/decoration.
* </p>
* <p>The size of the frame is constrained to the minimum and maximum
* sizes set for the receiver (if any).<br />
* Its position is constrained to be on screen if it is a titled window.
* </p>
*/
- (void) setFrame: (NSRect)frameRect
display: (BOOL)flag;
/**
* Sets the origin (bottom left corner) of the receiver's frame to be the
* specified point (in screen coordinates).
*/
- (void) setFrameOrigin: (NSPoint)aPoint;
/**
* Sets the top left corner of the receiver's frame to be the
* specified point (in screen coordinates).
*/
- (void) setFrameTopLeftPoint: (NSPoint)aPoint;
/**
* Sets the size of the receiver's content view to aSize, implicitly
* adjusting the size of the receiver's frame to match.
*/
- (void) setContentSize: (NSSize)aSize;
/**
* Positions the receiver at topLeftPoint (or if topLeftPoint is NSZeroPoint,
* leaves the receiver unmoved except for any necessary constraint to fit
* on screen).<br />
* Returns the position of the top left corner of the receivers content
* view (after repositioning), so that another window cascaded at the
* returned point will not obscure the title bar of the receiver.
*/
- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint;
- (void) center;
- (int) resizeFlags;
#ifndef STRICT_OPENSTEP
@ -309,7 +373,7 @@ style. */
- (NSString*) stringWithSavedFrame;
#ifndef STRICT_OPENSTEP
- (BOOL) setFrameUsingName: (NSString *)name
force: (BOOL)force;
force: (BOOL)force;
#endif
/*
@ -556,7 +620,7 @@ style. */
- (void) print: (id)sender;
- (NSData*) dataWithEPSInsideRect: (NSRect)rect;
#ifndef STRICT_OPENSTEP
- (NSData *)dataWithPDFInsideRect:(NSRect)aRect;
- (NSData*) dataWithPDFInsideRect:(NSRect)aRect;
#endif
/*

BIN
Images/GSSearch.tiff Normal file

Binary file not shown.

BIN
Images/GSStop.tiff Normal file

Binary file not shown.

Binary file not shown.

View file

@ -49,7 +49,7 @@
"Control-f" = "moveRight:";
"Control-h" = "deleteBackward:";
/* "Control-l" = "centerSelectionInVisibleArea:"; */
/* "Control-k" = "deleteToEndOfLine:"; */
"Control-k" = "deleteToEndOfLine:";
"Control-n" = "moveDown:";
"Control-p" = "moveUp:";
"Control-t" = "transpose:";

View file

@ -238,7 +238,7 @@
return @"nil";
}
else {
id label;
NSString *label;
id upperObjectRepresentation;
anObject = [anObject replacementObjectForModelArchiver: self];
@ -258,7 +258,7 @@
}
}
if (!label) {
if (label == nil) {
Class archiveClass;
/* If the object gets encoded on the top level, set the label to be
@ -577,7 +577,7 @@
- (NSString*) classNameEncodedForTrueClassName: (NSString*)trueName
{
id inArchiveName = [(id)NSMapGet(classes, trueName) className];
NSString *inArchiveName = [(id)NSMapGet(classes, trueName) className];
return inArchiveName ? inArchiveName : trueName;
}

View file

@ -76,7 +76,7 @@
{
const char *type;
unsigned int size;
unsigned int offset;
int offset;
/*
* Use the GNUstep additional function to set the instance
@ -100,7 +100,7 @@
{
const char *type;
unsigned int size;
unsigned int offset;
int offset;
/*
* Use the GNUstep additional function to set the instance
@ -158,7 +158,7 @@
const char *nam = [label cString];
const char *type;
unsigned int size;
unsigned int offset;
int offset;
/*
* Use the GNUstep additional function to set the instance

89
NEWS
View file

@ -1,28 +1,39 @@
1 NEWS
******
The currently released version of the library is `0.10.3'.
The currently released version of the library is `0.11.0'.
1.1 Noteworthy changes in version `0.10.3'
1.1 Noteworthy changes in version `0.11.0'
==========================================
* Added support for keyed encoding in all gui classes.
* Added mechanism to allow for dynamic extension of model loading
mechanism
* Implemented glue code in GSNibCompatibility for classes such as
NSIBObjectData, NSClassSwapper, etc. to facilitate nib loading.
1.2 Noteworthy changes in version `0.10.3'
==========================================
* Horizontal menus now work
* Better support for tracking active applications.
1.2 Noteworthy changes in version `0.10.2'
1.3 Noteworthy changes in version `0.10.2'
==========================================
Mostly bug fixes.
1.3 Noteworthy changes in version `0.10.1'
1.4 Noteworthy changes in version `0.10.1'
==========================================
GNUstep now uses v19 of portaudio for the sound daemon. Version v19
hasn't been officially released, but it is still used in several
distributions (SuSE, etc) as v18 is very old.
1.4 Noteworthy changes in version `0.10.0'
1.5 Noteworthy changes in version `0.10.0'
==========================================
This release is binary incompatible with previous releases. The
@ -30,11 +41,11 @@ interface version of the library has changed so that apps, tools and
libraries that use the base library need to be recompiled to use this
new version.
* Nib loading supports window auto-positioning
* Model loading supports window auto-positioning
* Keyed encoding is supported in many classes.
1.5 Noteworthy changes in version `0.9.5'
1.6 Noteworthy changes in version `0.9.5'
=========================================
* Beginnings of CUPS interface were added.
@ -47,7 +58,7 @@ new version.
* You can find the GUI library's version using the Info.plist
1.6 Noteworthy changes in version `0.9.4'
1.7 Noteworthy changes in version `0.9.4'
=========================================
* The printing classes have been completely reorganized to
@ -62,7 +73,7 @@ new version.
* Some improvement of NSDataLink classes.
1.7 Noteworthy changes in version `0.9.3'
1.8 Noteworthy changes in version `0.9.3'
=========================================
* Spell checker reimplemented using libaspell
@ -74,7 +85,7 @@ new version.
* Binary incompatibilites from ivar additions in NSView and
subclasses.
1.8 Noteworthy changes in version `0.9.2'
1.9 Noteworthy changes in version `0.9.2'
=========================================
* Working NSToolbar implementation
@ -93,22 +104,22 @@ new version.
* Much improved loading of gorm files
1.9 Noteworthy changes in version `0.9.1'
=========================================
1.10 Noteworthy changes in version `0.9.1'
==========================================
* NSWindow - DnD works on whole window and events are propogated up
to first DnD aware view.
* Absolute paths and DnD works in OpenPanels.
1.10 Noteworthy changes in version `0.9.0'
1.11 Noteworthy changes in version `0.9.0'
==========================================
Improvements in various classes, include NSPopUpButton,
NSBitmapImageRep, NSMenu, NSToolbar. Added support for thumbnail images
in NSWorkspace.
1.11 Noteworthy changes in version `0.8.9'
1.12 Noteworthy changes in version `0.8.9'
==========================================
Note that many headers have moved to new locations (both in the package
@ -117,14 +128,14 @@ applications may not compile because they cannot find the right header.
* New Language Setup documentation.
1.12 Noteworthy changes in version `0.8.8'
1.13 Noteworthy changes in version `0.8.8'
==========================================
* Updated LanguageSetup documentation
* Improved RTF reader (unicode support, etc).
1.13 Noteworthy changes in version `0.8.7'
1.14 Noteworthy changes in version `0.8.7'
==========================================
* NSBezierPath glyph methods implemented (depends on backend).
@ -134,7 +145,7 @@ applications may not compile because they cannot find the right header.
* Added default to load user-defined bundles (GSAppKitUserBundles
default).
1.14 Noteworthy changes in version `0.8.6'
1.15 Noteworthy changes in version `0.8.6'
==========================================
Updated to install in new locations based on changes in gnustep-make
@ -146,12 +157,12 @@ Updated to install in new locations based on changes in gnustep-make
* Lots of menu improvements.
1.15 Noteworthy changes in version `0.8.5'
1.16 Noteworthy changes in version `0.8.5'
==========================================
Bug fixes. NSStringDrawing now uses text system implementation.
1.16 Noteworthy changes in version `0.8.4'
1.17 Noteworthy changes in version `0.8.4'
==========================================
This release features a brand new text and layout system thanks to
@ -165,7 +176,7 @@ Alexander Malmberg. Other improvements include:
* NSToolbar partially implemented.
1.17 Noteworthy changes in version `0.8.3'
1.18 Noteworthy changes in version `0.8.3'
==========================================
* Additions for Gorm support.
@ -182,7 +193,7 @@ Alexander Malmberg. Other improvements include:
* Key view handling rewritten.
1.18 Noteworthy changes in version `0.8.2'
1.19 Noteworthy changes in version `0.8.2'
==========================================
* Handle fonts that aren't found better.
@ -199,7 +210,7 @@ Alexander Malmberg. Other improvements include:
* Fix firstResponder status in text fields.
1.19 Noteworthy changes in version `0.8.1'
1.20 Noteworthy changes in version `0.8.1'
==========================================
* Handle scaled curves correctly.
@ -212,10 +223,10 @@ Alexander Malmberg. Other improvements include:
* Spell checker starts correctly now.
1.20 Noteworthy changes in version `0.8.0'
1.21 Noteworthy changes in version `0.8.0'
==========================================
1.21 Noteworthy changes in version `0.7.9'
1.22 Noteworthy changes in version `0.7.9'
==========================================
* NSTableView, NSOutlineView improvements.
@ -224,14 +235,14 @@ Alexander Malmberg. Other improvements include:
* Skeleton implementation of NSToolBar
1.22 Noteworthy changes in version `0.7.8'
1.23 Noteworthy changes in version `0.7.8'
==========================================
* Wheel color picker, standard color picker (bundles) added.
* System colors now use named colors. Easier configuration
1.23 Noteworthy changes in version `0.7.7'
1.24 Noteworthy changes in version `0.7.7'
==========================================
The graphics/window interface was completely revamped. Window functions
@ -255,7 +266,7 @@ computers, although it is in a very alpha state.
* NSOutlineView much improved.
1.24 Noteworthy changes in version `0.7.6'
1.25 Noteworthy changes in version `0.7.6'
==========================================
* NSOutlineView implemented.
@ -268,7 +279,7 @@ computers, although it is in a very alpha state.
* Memory panel available from Info Panel.
1.25 Noteworthy changes in version `0.7.5'
1.26 Noteworthy changes in version `0.7.5'
==========================================
* Drag and drop and image sliding much improved.
@ -299,7 +310,7 @@ computers, although it is in a very alpha state.
* Gmodel code compiled as a separate bundle.
1.26 Noteworthy changes in version `0.7.0'
1.27 Noteworthy changes in version `0.7.0'
==========================================
* Much improvement in NSBrowser, NSMatrix, NSPopUpButton, combo
@ -315,7 +326,7 @@ computers, although it is in a very alpha state.
* NSColorWell works.
1.27 Noteworthy changes in version `0.6.7'
1.28 Noteworthy changes in version `0.6.7'
==========================================
* App Icons can support documents dropped using DnD.
@ -342,7 +353,7 @@ computers, although it is in a very alpha state.
* Support middle mouse button.
1.28 Noteworthy changes in version `0.6.6'
1.29 Noteworthy changes in version `0.6.6'
==========================================
* Window hints for motif and generic window managers.
@ -379,7 +390,7 @@ however, that the xdps backend is still considered experimental and you
may have to deal with many problems in order to get it working. We
recommend sticking with the xgps backend (the default) for now.
1.29 Noteworthy changes in version `0.6.5'
1.30 Noteworthy changes in version `0.6.5'
==========================================
Many of the basic GUI classes have been vastly improved or rewritten,
@ -413,7 +424,7 @@ thanks to Nicola Pero <n.pero@mi.flashnet.it> and many others.
been written, thanks to Richard Frith-Macdonald
<richard@brainstorm.co.uk>
1.30 Noteworthy changes in version `0.6.0'
1.31 Noteworthy changes in version `0.6.0'
==========================================
A Huge amount of progress, although a lot still needs to be done. It's
@ -444,7 +455,7 @@ apps and libraries have been ported with little changes.
* Several fixes that at least double the speed of the gui.
1.31 Noteworthy changes in version `0.5.5'
1.32 Noteworthy changes in version `0.5.5'
==========================================
Too extensive to list.
@ -453,7 +464,7 @@ Too extensive to list.
cleanup of coordinate conversion code, etc.
1.32 Noteworthy changes in version `0.5.0'
1.33 Noteworthy changes in version `0.5.0'
==========================================
* NSBrowser and NSBrowserCell have been implemented. There is one
@ -503,7 +514,7 @@ Too extensive to list.
* Several cleanups and as usual, many bug fixes.
1.33 Noteworthy changes in version `0.3.0'
1.34 Noteworthy changes in version `0.3.0'
==========================================
* Completely reworked the menu class. The NSMenu class is now
@ -535,7 +546,7 @@ Too extensive to list.
implement the NSCopying protocol and many others.
1.34 Noteworthy changes in version `0.2.0'
1.35 Noteworthy changes in version `0.2.0'
==========================================
* Additional NSImage and NSImageRep class work. Incorporated common
@ -570,7 +581,7 @@ Too extensive to list.
* Many bug fixes and minor enhancements.
1.35 Noteworthy changes in version `0.1.1'
1.36 Noteworthy changes in version `0.1.1'
==========================================
* Almost complete implementation of the PXKMenu and PXKMenuCell
@ -594,7 +605,7 @@ Too extensive to list.
manipulating tiff files and images.
1.36 Noteworthy changes in version `0.1.0'
1.37 Noteworthy changes in version `0.1.0'
==========================================
* Integration of the GNUstep X/DPS GUI Backend. This has finally

View file

@ -19,7 +19,8 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02111 USA
#
MAKEFILE_NAME = DocMakefile
@ -147,6 +148,7 @@ NSWorkspace.h
AUTOGSDOC_HEADERS_GUIADD = \
GSDisplayServer.h \
GSTheme.h \
GSFusedSilica.h \
GSTable.h \
GSHbox.h \

View file

@ -177,7 +177,7 @@ GSServicesManager.m \
tiff.m \
externs.m \
linking.m \
GSDrawFunctions.m \
GSTheme.m \
GSDragView.m \
GSFontInfo.m \
GSTable.m \
@ -354,7 +354,7 @@ GUI_HEADERS = \
GSVersion.h \
GMAppKit.h \
GMArchiver.h \
GSDrawFunctions.h \
GSTheme.h \
GSFontInfo.h \
GSMemoryPanel.h \
GSInfoPanel.h \

View file

@ -21,7 +21,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include <Foundation/NSArray.h>
@ -278,7 +279,9 @@ GSCurrentServer(void)
return nil;
}
/** Returns YES if the backend handles window decorations and NO
* if the gui library must do that instead.
*/
- (BOOL) handlesWindowDecorations
{
return YES;
@ -516,13 +519,15 @@ GSCurrentServer(void)
/** Creates a window whose location and size is described by frame and
whose backing store is described by type. This window is not
mapped to the screen by this call.
mapped to the screen by this call.<br />
Note that frame is the frame of the drawable window and does not include
any external window decorations. If handlesWindowDecorations returns YES,
a window manager (or something equivalent) might add decorations outside
the drawable window. Use -styleoffsets::::: to determine the extent of
those decorations.
Note that frame is the frame of the entire GNUstep window including
borders, titlebar and other standard decorations.<br />
If -handlesWindowDecorations returns YES, the backend will produce
(and return the identifier of) a smaller drawable window inside this
decorated area.<br />
Use -styleoffsets::::: to determine the extent of the decorations
and determine the size of the drawable area inside them.
*/
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
{
@ -549,8 +554,11 @@ GSCurrentServer(void)
/** Create all the backend structures for a reference to a native window and
return the extend, backing type, style and screen for that window. */
- (int) nativeWindow: (void *)winref : (NSRect*)frame : (NSBackingStoreType*)type
: (unsigned int*)style : (int*)screen
- (int) nativeWindow: (void *)winref
: (NSRect*)frame
: (NSBackingStoreType*)type
: (unsigned int*)style
: (int*)screen
{
[self subclassResponsibility: _cmd];
return 0;
@ -612,19 +620,31 @@ GSCurrentServer(void)
[self subclassResponsibility: _cmd];
}
/** Moves the bottom left cornder of the window to loc */
/** Moves the bottom left corner of the window (including any border)
* to loc.<br />
* The position is expressed as an offset from the bottom left
* corner of the screen.
*/
- (void) movewindow: (NSPoint)loc : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Moves and resizes the window on the screen as described by frame. */
/** Moves and resizes the window on the screen as described by frame.
* The value of frame is a rectangle containing the entire window, including
* any border/decorations. Its position is expressed as an offset from
* the bottom left corner of the screen.
*/
- (void) placewindow: (NSRect)frame : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Returns the frame of the window on the screen */
/** Returns the frame of the window on the screen.<br />
* The value of frame is a rectangle containing the entire window, including
* any border/decorations. Its position is expressed as an offset from
* the bottom left corner of the screen.
*/
- (NSRect) windowbounds: (int) win
{
[self subclassResponsibility: _cmd];
@ -658,13 +678,13 @@ GSCurrentServer(void)
return 0;
}
/** Set the maximum size of the window */
/** Set the maximum size (pixels) of the window */
- (void) setmaxsize: (NSSize)size : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Set the minimum size of the window */
/** Set the minimum size (pixels) of the window */
- (void) setminsize: (NSSize)size : (int) win
{
[self subclassResponsibility: _cmd];
@ -676,18 +696,22 @@ GSCurrentServer(void)
[self subclassResponsibility: _cmd];
}
/** Causes buffered graphics to be flushed to the screen */
/** Causes buffered graphics to be flushed to the screen.
* The value of rect is expressed in OpenStep window coordinates.
*/
- (void) flushwindowrect: (NSRect)rect : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Returns the dimensions of window decorations added outside the drawable
window frame by a window manager or equivalent. For instance, t
gives the height of the title bar for the window. The values returned
may be approximations. If handlesWindowDecorations returns NO, there
are no decorations outside the drawable window frame and this method
shouldn't be called. */
/**
* Returns the dimensions of window decorations added outside the drawable
* window frame by a window manager or equivalent. For instance, t
* gives the height of the title bar for the window.<br />
* If -handlesWindowDecorations returns NO, there
* are no decorations outside the drawable window frame and this method
* shouldn't be called.
* */
- (void) styleoffsets: (float*) l : (float*) r : (float*) t : (float*) b
: (unsigned int) style
{
@ -722,8 +746,11 @@ GSCurrentServer(void)
}
/** Returns the current mouse location on the default screen. If the
pointer is not on the default screen, an invalid point (-1,-1} is
returned. */
* pointer is not on the default screen, an invalid point (-1,-1} is
* returned.<br />
* The location is expressed as an offset from the bottom left corner
* of the screen.
*/
- (NSPoint) mouselocation
{
[self subclassResponsibility: _cmd];
@ -731,10 +758,13 @@ GSCurrentServer(void)
}
/** Returns the current mouse location on aScreen. If the pointer is
not on aScreen, this method acts like -mouselocation. If aScreen is -1,
then the location of the mouse on any screen is returned. The
win pointer returns the window number of the GNUstep window
that the mouse is in or 0 if it is not in a window. */
* not on aScreen, this method acts like -mouselocation. If aScreen is -1,
* then the location of the mouse on any screen is returned. The
* win pointer returns the window number of the GNUstep window
* that the mouse is in or 0 if it is not in a window.<br />
* The location is expressed as an offset from the bottom left corner
* of the screen.
*/
- (NSPoint) mouseLocationOnScreen: (int)aScreen window: (int *)win
{
[self subclassResponsibility: _cmd];
@ -802,6 +832,16 @@ GSCurrentServer(void)
/* GNUstep Event Operations */
/* ----------------------------------------------------------------------- */
@implementation GSDisplayServer (EventOps)
/**
* Scans through the event queue to find the first event whose type matches
* mask. If no event is found, then the current run loop is run in the
* specified mode to allow more events to arrive.<br />
* If a matching event is found, it is returned and either removed from or
* left in the queue according to flag.<br />
* If no matching event is found and the limit date is reached, this method
* returns nil.
*/
- (NSEvent*) getEventMatchingMask: (unsigned)mask
beforeDate: (NSDate*)limit
inMode: (NSString*)mode
@ -853,7 +893,7 @@ GSCurrentServer(void)
}
/*
* Note the positon we have read up to.
* Note the position we have read up to.
*/
pos += i;
@ -884,6 +924,11 @@ GSCurrentServer(void)
return nil; /* No events in specified time */
}
/**
* Steps through the event queue and removes all events whose timestamp
* is earlier than that of limit wand which match the supplied mask
* of event types.
*/
- (void) discardEventsMatchingMask: (unsigned)mask
beforeEvent: (NSEvent*)limit
{
@ -906,14 +951,20 @@ GSCurrentServer(void)
if ([event timestamp] < when)
{
if ((mask == NSAnyEventMask) ||
(mask & NSEventMaskFromType([event type])))
[event_queue removeObjectAtIndex: index];
if ((mask == NSAnyEventMask)
|| (mask & NSEventMaskFromType([event type])))
{
[event_queue removeObjectAtIndex: index];
}
}
}
}
}
/** Posts an event to the event queue. The value of flag determines
* whether the event is inserted at the start of the queue or appended
* at the end.
*/
- (void) postEvent: (NSEvent*)anEvent atStart: (BOOL)flag
{
if (flag)

View file

@ -1,450 +0,0 @@
/** <title>GSDrawFunctions</title>
<abstract>Useful/configurable drawing functions</abstract>
Copyright (C) 2004 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Date: Jan 2004
This file is part of the GNU Objective C User interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#include "GNUstepGUI/GSDrawFunctions.h"
#include "AppKit/NSColor.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSView.h"
#include "AppKit/PSOperators.h"
/**
<unit>
<heading>Class Description</heading>
<p>
This is a simple class used for encapsulating common drawing behaviors.
These methods standardize drawing of buttons, borders and other common
GUI elements. The drawing functions are encapsulated in a class to
allow overriding of the methods so that these elements can be drawn
in different ways (e.g. with themes).
</p>
<p>
The default implementation uses the standard configurable colors defined in
NSColor, such as <code>controlLightHighlightColor</code>,
<code>controlShadowColor</code> and <code>controlDarkShadowColor</code>.
</p>
</unit>
*/
@implementation GSDrawFunctions
static id theTheme = nil;
+ (id) theme
{
if (theTheme == nil)
{
theTheme = [self new];
}
return theTheme;
}
+ (void) setTheme: (id) aTheme
{
ASSIGN (theTheme, aTheme);
}
/** Tell current theme to draw a button border */
+ (NSRect) drawButton: (NSRect)border : (NSRect)clip
{
return [[self theme] drawButton: border : clip];
}
/** Tell current theme to draw a "dark" button border (used in tableviews) */
+ (NSRect) drawDarkButton: (NSRect)border : (NSRect)clip
{
return [[self theme] drawDarkButton: border : clip];
}
/** Tell current theme to draw a dark bezel border */
+ (NSRect) drawDarkBezel: (NSRect)border : (NSRect)clip
{
return [[self theme] drawDarkBezel: border : clip];
}
/** Tell current theme to draw a light bezel border */
+ (NSRect) drawLightBezel: (NSRect)border : (NSRect)clip
{
return [[self theme] drawLightBezel: border : clip];
}
/** Tell current theme to draw a white bezel border */
+ (NSRect) drawWhiteBezel: (NSRect)border : (NSRect)clip
{
return [[self theme] drawWhiteBezel: border : clip];
}
/** Tell current theme to draw a grey bezel border */
+ (NSRect) drawGrayBezel: (NSRect)border : (NSRect)clip
{
return [[self theme] drawGrayBezel: border : clip];
}
/** Tell current theme to draw a groove border */
+ (NSRect) drawGroove: (NSRect)border : (NSRect)clip
{
return [[self theme] drawGroove: border : clip];
}
/** Tell current theme to draw a frame photo border. Used in NSImageView. */
+ (NSRect) drawFramePhoto: (NSRect)border : (NSRect)clip
{
return [[self theme] drawFramePhoto: border : clip];
}
/** Tell current theme to draw a gradient border. */
+ (NSRect) drawGradientBorder: (NSGradientType)gradientType
inRect: (NSRect)border
withClip: (NSRect)clip
{
return [[self theme] drawGradientBorder: gradientType
inRect: border
withClip: clip];
}
- (NSRect) drawButton: (NSRect)border : (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
NSMinXEdge, NSMaxYEdge,
NSMaxXEdge, NSMinYEdge};
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge,
NSMinXEdge, NSMinYEdge,
NSMaxXEdge, NSMaxYEdge};
// These names are role names not the actual colours
NSColor *black = [NSColor controlDarkShadowColor];
NSColor *dark = [NSColor controlShadowColor];
NSColor *white = [NSColor controlLightHighlightColor];
NSColor *colors[] = {black, black, white, white,
dark, dark};
if ([[NSView focusView] isFlipped] == YES)
{
return NSDrawColorTiledRects(border, clip, dn_sides, colors, 6);
}
else
{
return NSDrawColorTiledRects(border, clip, up_sides, colors, 6);
}
}
/** Draw a "dark" button border (used in tableviews) */
- (NSRect) drawDarkButton: (NSRect)border : (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
NSMinXEdge, NSMaxYEdge};
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge,
NSMinXEdge, NSMinYEdge};
// These names are role names not the actual colours
NSColor *black = [NSColor controlDarkShadowColor];
NSColor *white = [NSColor controlHighlightColor];
NSColor *colors[] = {black, black, white, white};
if ([[NSView focusView] isFlipped] == YES)
{
return NSDrawColorTiledRects(border, clip, dn_sides, colors, 4);
}
else
{
return NSDrawColorTiledRects(border, clip, up_sides, colors, 4);
}
}
/** Draw a dark bezel border */
- (NSRect) drawDarkBezel: (NSRect)border : (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge,
NSMinXEdge, NSMaxYEdge, NSMaxXEdge, NSMinYEdge};
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge,
NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge};
// These names are role names not the actual colours
NSColor *black = [NSColor controlDarkShadowColor];
NSColor *dark = [NSColor controlShadowColor];
NSColor *light = [NSColor controlColor];
NSColor *white = [NSColor controlLightHighlightColor];
NSColor *colors[] = {white, white, dark, dark,
black, black, light, light};
NSRect rect;
if ([[NSView focusView] isFlipped] == YES)
{
rect = NSDrawColorTiledRects(border, clip, dn_sides, colors, 8);
[dark set];
PSrectfill(NSMinX(border) + 1., NSMinY(border) - 2., 1., 1.);
PSrectfill(NSMaxX(border) - 2., NSMaxY(border) + 1., 1., 1.);
}
else
{
rect = NSDrawColorTiledRects(border, clip, up_sides, colors, 8);
[dark set];
PSrectfill(NSMinX(border) + 1., NSMinY(border) + 1., 1., 1.);
PSrectfill(NSMaxX(border) - 2., NSMaxY(border) - 2., 1., 1.);
}
return rect;
}
/** Draw a light bezel border */
- (NSRect) drawLightBezel: (NSRect)border : (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge,
NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge};
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge,
NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge};
// These names are role names not the actual colours
NSColor *dark = [NSColor controlShadowColor];
NSColor *light = [NSColor controlColor];
NSColor *white = [NSColor controlLightHighlightColor];
NSColor *colors[] = {white, white, dark, dark,
light, light, dark, dark};
if ([[NSView focusView] isFlipped] == YES)
{
return NSDrawColorTiledRects(border, clip, dn_sides, colors, 8);
}
else
{
return NSDrawColorTiledRects(border, clip, up_sides, colors, 8);
}
}
/** Draw a white bezel border */
- (NSRect) drawWhiteBezel: (NSRect)border : (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxYEdge, NSMaxXEdge, NSMinYEdge, NSMinXEdge,
NSMaxYEdge, NSMaxXEdge, NSMinYEdge, NSMinXEdge};
NSRectEdge dn_sides[] = {NSMinYEdge, NSMaxXEdge, NSMaxYEdge, NSMinXEdge,
NSMinYEdge, NSMaxXEdge, NSMaxYEdge, NSMinXEdge};
// These names are role names not the actual colours
NSColor *dark = [NSColor controlShadowColor];
NSColor *light = [NSColor controlColor];
NSColor *white = [NSColor controlLightHighlightColor];
NSColor *colors[] = {dark, white, white, dark,
dark, light, light, dark};
if ([[NSView focusView] isFlipped] == YES)
{
return NSDrawColorTiledRects(border, clip, dn_sides, colors, 8);
}
else
{
return NSDrawColorTiledRects(border, clip, up_sides, colors, 8);
}
}
/** Draw a grey bezel border */
- (NSRect) drawGrayBezel: (NSRect)border : (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge,
NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge};
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge,
NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge};
// These names are role names not the actual colours
NSColor *black = [NSColor controlDarkShadowColor];
NSColor *dark = [NSColor controlShadowColor];
NSColor *light = [NSColor controlColor];
NSColor *white = [NSColor controlLightHighlightColor];
NSColor *colors[] = {white, white, dark, dark,
light, light, black, black};
NSRect rect;
if ([[NSView focusView] isFlipped] == YES)
{
rect = NSDrawColorTiledRects(border, clip, dn_sides, colors, 8);
[dark set];
PSrectfill(NSMinX(border) + 1., NSMaxY(border) - 2., 1., 1.);
PSrectfill(NSMaxX(border) - 2., NSMinY(border) + 1., 1., 1.);
}
else
{
rect = NSDrawColorTiledRects(border, clip, up_sides, colors, 8);
[dark set];
PSrectfill(NSMinX(border) + 1., NSMinY(border) + 1., 1., 1.);
PSrectfill(NSMaxX(border) - 2., NSMaxY(border) - 2., 1., 1.);
}
return rect;
}
/** Draw a groove border */
- (NSRect) drawGroove: (NSRect)border : (NSRect)clip
{
// go clockwise from the top twice -- makes the groove come out right
NSRectEdge up_sides[] = {NSMaxYEdge, NSMaxXEdge, NSMinYEdge, NSMinXEdge,
NSMaxYEdge, NSMaxXEdge, NSMinYEdge, NSMinXEdge};
NSRectEdge dn_sides[] = {NSMinYEdge, NSMaxXEdge, NSMaxYEdge, NSMinXEdge,
NSMinYEdge, NSMaxXEdge, NSMaxYEdge, NSMinXEdge};
// These names are role names not the actual colours
NSColor *dark = [NSColor controlShadowColor];
NSColor *white = [NSColor controlLightHighlightColor];
NSColor *colors[] = {dark, white, white, dark,
white, dark, dark, white};
if ([[NSView focusView] isFlipped] == YES)
{
return NSDrawColorTiledRects(border, clip, dn_sides, colors, 8);
}
else
{
return NSDrawColorTiledRects(border, clip, up_sides, colors, 8);
}
}
/** Draw a frame photo border. Used in NSImageView. */
- (NSRect) drawFramePhoto: (NSRect)border : (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
NSMinXEdge, NSMaxYEdge,
NSMaxXEdge, NSMinYEdge};
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge,
NSMinXEdge, NSMinYEdge,
NSMaxXEdge, NSMaxYEdge};
// These names are role names not the actual colours
NSColor *black = [NSColor controlDarkShadowColor];
NSColor *dark = [NSColor controlShadowColor];
NSColor *colors[] = {dark, dark, dark, dark,
black,black};
if ([[NSView focusView] isFlipped] == YES)
{
return NSDrawColorTiledRects(border, clip, dn_sides, colors, 6);
}
else
{
return NSDrawColorTiledRects(border, clip, up_sides, colors, 6);
}
}
/** Draw a gradient border. */
- (NSRect) drawGradientBorder: (NSGradientType)gradientType
inRect: (NSRect)border
withClip: (NSRect)clip
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
NSMinXEdge, NSMaxYEdge};
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge,
NSMinXEdge, NSMinYEdge};
NSColor *black = [NSColor controlDarkShadowColor];
NSColor *dark = [NSColor controlShadowColor];
NSColor *light = [NSColor controlColor];
NSColor **colors;
NSColor *concaveWeak[] = {dark, dark,
light, light};
NSColor *concaveStrong[] = {black, black,
light, light};
NSColor *convexWeak[] = {light, light,
dark, dark};
NSColor *convexStrong[] = {light, light,
black, black};
NSRect rect;
switch (gradientType)
{
case NSGradientConcaveWeak:
colors = concaveWeak;
break;
case NSGradientConcaveStrong:
colors = concaveStrong;
break;
case NSGradientConvexWeak:
colors = convexWeak;
break;
case NSGradientConvexStrong:
colors = convexStrong;
break;
case NSGradientNone:
default:
return border;
}
if ([[NSView focusView] isFlipped] == YES)
{
rect = NSDrawColorTiledRects(border, clip, dn_sides, colors, 4);
}
else
{
rect = NSDrawColorTiledRects(border, clip, up_sides, colors, 4);
}
return rect;
}
/** theme drawing methos */
- (NSRect) drawButton: (NSRect) frame
in: (NSButtonCell*) cell
view: (NSView*) view
style: (int) style
state: (int) state
{
/* computes the interior frame rect */
NSRect interiorFrame = [cell drawingRectForBounds: frame];
/* Draw the button background */
if (state == 0) /* default state, unpressed */
{
//[[NSColor redColor] set];
[[NSColor controlBackgroundColor] set];
NSRectFill(frame);
[GSDrawFunctions drawButton: frame : NSZeroRect];
}
else if (state == 1) /* highlighted state */
{
//[[NSColor blueColor] set];
[[NSColor selectedControlColor] set];
NSRectFill(frame);
[GSDrawFunctions drawGrayBezel: frame : NSZeroRect];
}
else if (state == 2) /* pushed state */
{
//[[NSColor yellowColor] set];
[[NSColor selectedControlColor] set];
NSRectFill(frame);
[GSDrawFunctions drawGrayBezel: frame : NSZeroRect];
interiorFrame = NSOffsetRect(interiorFrame, 1.0, [view isFlipped] ? 1.0 : -1.0);
}
/* returns the interior frame rect */
return interiorFrame;
}
- (void) drawFocusFrame: (NSRect) frame view: (NSView*) view
{
NSDottedFrameRect(frame);
}
- (void) drawWindowBackground: (NSRect) frame view: (NSView*) view
{
NSColor *c = [[view window] backgroundColor];
[c set];
//[[NSColor redColor] set];
NSRectFill (frame);
}
@end

View file

@ -1489,15 +1489,16 @@ static BOOL _isInInterfaceBuilder = NO;
if([coder allowsKeyedCoding])
{
unsigned int len = 0;
// BOOL compact = [coder decodeBoolForKey: @"NS.compact"];
short exponent = (short)[coder decodeIntForKey: @"NS.exponent"];
// int length = [coder decodeIntForKey: @"NS.length"];
NSByteOrder bo = [coder decodeIntForKey: @"NS.mantissa.bo"];
BOOL negative = [coder decodeBoolForKey: @"NS.negative"];
void *mantissaBytes = (void *)[coder decodeBytesForKey: @"NS.mantissa" returnedLength: &len];
unsigned long long unswapped = 0;
unsigned long long mantissa = 0;
// BOOL compact = [coder decodeBoolForKey: @"NS.compact"];
// int length = [coder decodeIntForKey: @"NS.length"];
memcpy((void *)&unswapped, (void *)mantissaBytes, sizeof(unsigned long long));
switch(bo)

View file

@ -44,18 +44,22 @@
#define TITLE_HEIGHT 23.0
#define RESIZE_HEIGHT 9.0
+(void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
+ (void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
{
if (style
& (NSTitledWindowMask | NSClosableWindowMask
| NSMiniaturizableWindowMask | NSResizableWindowMask))
*l = *r = *t = *b = 1.0;
& (NSTitledWindowMask | NSClosableWindowMask
| NSMiniaturizableWindowMask | NSResizableWindowMask))
{
*l = *r = *t = *b = 1.0;
}
else
*l = *r = *t = *b = 0.0;
{
*l = *r = *t = *b = 0.0;
}
if (style
& (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask))
& (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask))
{
*t = TITLE_HEIGHT;
}
@ -65,24 +69,19 @@
}
}
+(void) screenOffsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
{
*l = *r = *r = *b = 0.0;
}
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
styleMask: (unsigned int)aStyle
{
float l, r, t, b, width;
[self offsets: &l : &r : &t : &b
forStyleMask: aStyle];
[self offsets: &l : &r : &t : &b forStyleMask: aStyle];
width = l + r;
if (aStyle & NSTitledWindowMask)
width += [aTitle sizeWithAttributes: nil].width;
{
width += [aTitle sizeWithAttributes: nil].width;
}
return width;
}
@ -90,14 +89,17 @@
static NSDictionary *titleTextAttributes[3];
static NSColor *titleColor[3];
-(void) updateRects
- (void) updateRects
{
if (hasTitleBar)
titleBarRect = NSMakeRect(0.0, _frame.size.height - TITLE_HEIGHT,
_frame.size.width, TITLE_HEIGHT);
{
titleBarRect = NSMakeRect(0.0, _frame.size.height - TITLE_HEIGHT,
_frame.size.width, TITLE_HEIGHT);
}
if (hasResizeBar)
resizeBarRect = NSMakeRect(0.0, 0.0, _frame.size.width, RESIZE_HEIGHT);
{
resizeBarRect = NSMakeRect(0.0, 0.0, _frame.size.width, RESIZE_HEIGHT);
}
if (hasCloseButton)
{
closeButtonRect = NSMakeRect(
@ -107,18 +109,18 @@ static NSColor *titleColor[3];
if (hasMiniaturizeButton)
{
miniaturizeButtonRect = NSMakeRect(4, _frame.size.height - 15 - 4,
15, 15);
miniaturizeButtonRect = NSMakeRect(
4, _frame.size.height - 15 - 4, 15, 15);
[miniaturizeButton setFrame: miniaturizeButtonRect];
}
}
- initWithFrame: (NSRect)frame
window: (NSWindow *)w
- (id) initWithFrame: (NSRect)frame
window: (NSWindow *)w
{
if (!titleTextAttributes[0])
{
NSMutableParagraphStyle *p;
NSMutableParagraphStyle *p;
p = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[p setLineBreakMode: NSLineBreakByClipping];
@ -129,12 +131,14 @@ static NSColor *titleColor[3];
[NSColor windowFrameTextColor], NSForegroundColorAttributeName,
p, NSParagraphStyleAttributeName,
nil];
titleTextAttributes[1] = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
[NSFont titleBarFontOfSize: 0], NSFontAttributeName,
[NSColor blackColor], NSForegroundColorAttributeName, /* TODO: need a named color for this */
p, NSParagraphStyleAttributeName,
nil];
titleTextAttributes[2] = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
[NSFont titleBarFontOfSize: 0], NSFontAttributeName,
@ -148,18 +152,18 @@ static NSColor *titleColor[3];
titleColor[2] = RETAIN([NSColor darkGrayColor]);
}
self = [super initWithFrame: frame
window: w];
self = [super initWithFrame: frame window: w];
if (!self) return nil;
if ([w styleMask]
& (NSTitledWindowMask | NSClosableWindowMask
| NSMiniaturizableWindowMask))
& (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask))
{
hasTitleBar = YES;
}
if ([w styleMask] & NSTitledWindowMask)
isTitled = YES;
{
isTitled = YES;
}
if ([w styleMask] & NSClosableWindowMask)
{
hasCloseButton = YES;
@ -177,7 +181,7 @@ static NSColor *titleColor[3];
different method here. */
[closeButton setAction: @selector(performClose:)];
[self addSubview: closeButton];
// RELEASE(closeButton); // FIXME... causes crash when closing.
RELEASE(closeButton);
}
if ([w styleMask] & NSMiniaturizableWindowMask)
{
@ -200,17 +204,18 @@ static NSColor *titleColor[3];
RELEASE(miniaturizeButton);
}
if ([w styleMask] & NSResizableWindowMask)
hasResizeBar = YES;
{
hasResizeBar = YES;
}
[self updateRects];
return self;
}
-(void) drawTitleBar
- (void) drawTitleBar
{
static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
NSMaxXEdge, NSMinYEdge};
float grays[3][4] =
{{NSLightGray, NSLightGray, NSDarkGray, NSDarkGray},
@ -271,7 +276,7 @@ static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
}
}
-(void) drawResizeBar
- (void) drawResizeBar
{
[[NSColor lightGrayColor] set];
PSrectfill(1.0, 1.0, resizeBarRect.size.width - 2.0, RESIZE_HEIGHT - 3.0);
@ -313,7 +318,7 @@ static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
PSstroke();
}
-(void) drawRect: (NSRect)rect
- (void) drawRect: (NSRect)rect
{
if (hasTitleBar && NSIntersectsRect(rect, titleBarRect))
{
@ -359,14 +364,14 @@ static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
}
-(void) setTitle: (NSString *)newTitle
- (void) setTitle: (NSString *)newTitle
{
if (isTitled)
[self setNeedsDisplayInRect: titleBarRect];
[super setTitle: newTitle];
}
-(void) setInputState: (int)state
- (void) setInputState: (int)state
{
NSAssert(state >= 0 && state <= 2, @"Invalid state!");
[super setInputState: state];
@ -374,7 +379,7 @@ static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
[self setNeedsDisplayInRect: titleBarRect];
}
-(void) setDocumentEdited: (BOOL)flag
- (void) setDocumentEdited: (BOOL)flag
{
if (flag)
{
@ -392,14 +397,14 @@ static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
}
-(NSPoint) mouseLocationOnScreenOutsideOfEventStream
- (NSPoint) mouseLocationOnScreenOutsideOfEventStream
{
int screen = [[window screen] screenNumber];
return [GSServerForWindow(window) mouseLocationOnScreen: screen
window: NULL];
}
-(void) moveWindowStartingWithEvent: (NSEvent *)event
- (void) moveWindowStartingWithEvent: (NSEvent *)event
{
unsigned int mask = NSLeftMouseDraggedMask | NSLeftMouseUpMask;
NSEvent *currentEvent = event;
@ -436,8 +441,9 @@ static const NSRectEdge edges[4] = {NSMinXEdge, NSMaxYEdge,
}
static NSRect calc_new_frame(NSRect frame, NSPoint point, NSPoint firstPoint,
int mode, NSSize minSize, NSSize maxSize)
static NSRect
calc_new_frame(NSRect frame, NSPoint point, NSPoint firstPoint,
int mode, NSSize minSize, NSSize maxSize)
{
NSRect newFrame = frame;
newFrame.origin.y = point.y - firstPoint.y;
@ -473,7 +479,7 @@ static NSRect calc_new_frame(NSRect frame, NSPoint point, NSPoint firstPoint,
return newFrame;
}
-(void) resizeWindowStartingWithEvent: (NSEvent *)event
- (void) resizeWindowStartingWithEvent: (NSEvent *)event
{
unsigned int mask = NSLeftMouseDraggedMask | NSLeftMouseUpMask;
NSEvent *currentEvent = event;
@ -517,7 +523,8 @@ static NSRect calc_new_frame(NSRect frame, NSPoint point, NSPoint firstPoint,
}
point = [self mouseLocationOnScreenOutsideOfEventStream];
newFrame = calc_new_frame(frame, point, firstPoint, mode, minSize, maxSize);
newFrame
= calc_new_frame(frame, point, firstPoint, mode, minSize, maxSize);
if (currentEvent && [currentEvent type] == NSLeftMouseUp)
break;
@ -532,12 +539,12 @@ static NSRect calc_new_frame(NSRect frame, NSPoint point, NSPoint firstPoint,
[window setFrame: newFrame display: YES];
}
-(BOOL) acceptsFirstMouse: (NSEvent*)theEvent
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
{
return YES;
}
-(void) mouseDown: (NSEvent *)event
- (void) mouseDown: (NSEvent *)event
{
NSPoint p = [self convertPoint: [event locationInWindow] fromView: nil];

1028
Source/GSTheme.m Normal file

File diff suppressed because it is too large Load diff

View file

@ -37,7 +37,7 @@
#include <Foundation/NSDebug.h>
#include <Foundation/NSRunLoop.h>
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
@implementation GSTitleView
@ -195,6 +195,7 @@
- (void) drawRect: (NSRect)rect
{
GSTheme *theme = [GSTheme theme];
NSRect workRect = [self bounds];
NSSize titleSize;
NSRectEdge top_left[] = {NSMinXEdge, NSMaxYEdge};
@ -213,7 +214,7 @@
// Rectangle 2
// Draw the title box's button.
[GSDrawFunctions drawButton: workRect :workRect];
[theme drawButton: workRect withClip: workRect];
// Overdraw white top and left lines with light gray lines for window title
workRect.origin.y += 1;

View file

@ -39,10 +39,6 @@
styleMask: (unsigned int)aStyle;
- (NSRect) frameRectForContentRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
- (NSRect) screenRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
- (NSRect) frameRectForScreenRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
- (float) minFrameWidthWithTitle: (NSString *)aTitle
styleMask: (unsigned int)aStyle;
@end
@ -63,23 +59,22 @@ this, either directly, or indirectly (by using the backend).
int inputState;
BOOL documentEdited;
}
+(id<GSWindowDecorator>) windowDecorator;
+ (id<GSWindowDecorator>) windowDecorator;
- initWithFrame: (NSRect)frame
window: (NSWindow *)w;
- (id) initWithFrame: (NSRect)frame window: (NSWindow *)w;
-(void) setContentView: (NSView *)contentView;
- (void) setBackgroundColor: (NSColor *)color;
- (void) setContentView: (NSView *)contentView;
- (void) setDocumentEdited: (BOOL)flag;
- (void) setInputState: (int)state;
- (void) setTitle: (NSString *)title;
/*
Called when the backend window is created or destroyed. When it's destroyed,
windowNumber will be 0.
*/
-(void) setWindowNumber: (int)windowNumber;
- (void) setWindowNumber: (int)windowNumber;
-(void) setTitle: (NSString *)title;
-(void) setInputState: (int)state;
-(void) setDocumentEdited: (BOOL)flag;
-(void) setBackgroundColor: (NSColor *)color;
@end

View file

@ -30,7 +30,7 @@
#include "AppKit/NSColor.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDisplayServer.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
struct NSWindow_struct
@ -39,20 +39,16 @@ struct NSWindow_struct
};
/*
Manage window decorations by using the backend functions. This only works
on backends that can handle window decorations.
*/
/* Manage window decorations by using the backend functions. This only works
* on backends that can handle window decorations.
*/
@interface GSBackendWindowDecorationView : GSWindowDecorationView
@end
/*
GSWindowDecorationView implementation.
*/
@implementation GSWindowDecorationView
+(id<GSWindowDecorator>) windowDecorator
+ (id<GSWindowDecorator>) windowDecorator
{
if ([GSCurrentServer() handlesWindowDecorations])
return [GSBackendWindowDecorationView self];
@ -61,22 +57,16 @@ GSWindowDecorationView implementation.
}
+(id) newWindowDecorationViewWithFrame: (NSRect)frame
window: (NSWindow *)aWindow
+ (id) newWindowDecorationViewWithFrame: (NSRect)frame
window: (NSWindow *)aWindow
{
return [[self alloc] initWithFrame: frame
window: aWindow];
}
+(void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)stylek
{
[self subclassResponsibility: _cmd];
}
+(void) screenOffsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
+ (void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
{
[self subclassResponsibility: _cmd];
}
@ -86,8 +76,7 @@ GSWindowDecorationView implementation.
{
float t, b, l, r;
[self offsets: &l : &r : &t : &b
forStyleMask: aStyle];
[self offsets: &l : &r : &t : &b forStyleMask: aStyle];
aRect.size.width -= l + r;
aRect.size.height -= t + b;
aRect.origin.x += l;
@ -100,8 +89,7 @@ GSWindowDecorationView implementation.
{
float t, b, l, r;
[self offsets: &l : &r : &t : &b
forStyleMask: aStyle];
[self offsets: &l : &r : &t : &b forStyleMask: aStyle];
aRect.size.width += l + r;
aRect.size.height += t + b;
aRect.origin.x -= l;
@ -109,34 +97,6 @@ GSWindowDecorationView implementation.
return aRect;
}
+ (NSRect) screenRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
float t, b, l, r;
[self screenOffsets: &l : &r : &t : &b
forStyleMask: aStyle];
aRect.size.width += l + r;
aRect.size.height += t + b;
aRect.origin.x -= l;
aRect.origin.y -= b;
return aRect;
}
+ (NSRect) frameRectForScreenRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
float t, b, l, r;
[self screenOffsets: &l : &r : &t : &b
forStyleMask: aStyle];
aRect.size.width -= l + r;
aRect.size.height -= t + b;
aRect.origin.x += l;
aRect.origin.y += b;
return aRect;
}
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
styleMask: (unsigned int)aStyle
{
@ -145,73 +105,42 @@ GSWindowDecorationView implementation.
}
/*
Internal helpers.
Returns the internal window frame rect for a given (screen) frame.
*/
+(NSRect) windowFrameRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
aRect.origin = NSZeroPoint;
return aRect;
}
/*
Returns the content rect for a given window frame.
*/
+(NSRect) contentRectForWindowFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
return [self contentRectForFrameRect: aRect styleMask: aStyle];
}
- initWithFrame: (NSRect)frame
- (id) initWithFrame: (NSRect)frame
{
NSAssert(NO, @"Tried to create GSWindowDecorationView without a window!");
return nil;
}
- initWithFrame: (NSRect)frame
window: (NSWindow *)w
- (id) initWithFrame: (NSRect)frame
window: (NSWindow *)w
{
frame = [isa windowFrameRectForFrameRect: frame
styleMask: [w styleMask]];
self = [super initWithFrame: frame];
if (!self)
return nil;
window = w;
contentRect = frame;
contentRect =
[isa contentRectForWindowFrameRect: contentRect
styleMask: [window styleMask]];
if (self != nil)
{
contentRect = [isa contentRectForFrameRect: frame
styleMask: [w styleMask]];
window = w;
}
return self;
}
/*
* Special setFrame: implementation - a minimal autoresize mechanism
*/
- (void) setFrame: (NSRect)frameRect
- (void) removeSubview: (NSView*)aView
{
NSSize oldSize = _frame.size;
NSView *cv = [_window contentView];
RETAIN(aView);
/*
* If the content view is removed, we must let the window know.
*/
[super removeSubview: aView];
if (aView == [_window contentView])
{
[_window setContentView: nil];
}
RELEASE(aView);
}
frameRect = [isa windowFrameRectForFrameRect: frameRect
styleMask: [window styleMask]];
_autoresizes_subviews = NO;
[super setFrame: frameRect];
contentRect = [isa contentRectForWindowFrameRect: frameRect
styleMask: [window styleMask]];
// Safety Check.
[cv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[cv resizeWithOldSuperviewSize: oldSize];
- (void) setBackgroundColor: (NSColor *)color
{
[self setNeedsDisplayInRect: contentRect];
}
- (void) setContentView: (NSView *)contentView
@ -229,7 +158,46 @@ Returns the content rect for a given window frame.
contentRect.origin.y)];
}
-(void) setWindowNumber: (int)theWindowNumber
- (void) setDocumentEdited: (BOOL)flag
{
documentEdited = flag;
if (windowNumber)
[GSServerForWindow(window) docedited: documentEdited : windowNumber];
}
/*
* Special setFrame: implementation - a minimal autoresize mechanism
*/
- (void) setFrame: (NSRect)frameRect
{
NSSize oldSize = _frame.size;
NSView *cv = [_window contentView];
_autoresizes_subviews = NO;
[super setFrame: frameRect];
contentRect = [isa contentRectForFrameRect: frameRect
styleMask: [window styleMask]];
// Safety Check.
[cv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[cv resizeWithOldSuperviewSize: oldSize];
}
- (void) setInputState: (int)state
{
inputState = state;
if (windowNumber)
[GSServerForWindow(window) setinputstate: inputState : windowNumber];
}
- (void) setTitle: (NSString *)title
{
if (windowNumber)
[GSServerForWindow(window) titlewindow: title : windowNumber];
}
- (void) setWindowNumber: (int)theWindowNumber
{
windowNumber = theWindowNumber;
if (!windowNumber)
@ -240,29 +208,6 @@ Returns the content rect for a given window frame.
[GSServerForWindow(window) docedited: documentEdited : windowNumber];
}
-(void) setTitle: (NSString *)title
{
if (windowNumber)
[GSServerForWindow(window) titlewindow: title : windowNumber];
}
-(void) setInputState: (int)state
{
inputState = state;
if (windowNumber)
[GSServerForWindow(window) setinputstate: inputState : windowNumber];
}
-(void) setDocumentEdited: (BOOL)flag
{
documentEdited = flag;
if (windowNumber)
[GSServerForWindow(window) docedited: documentEdited : windowNumber];
}
-(void) setBackgroundColor: (NSColor *)color
{
[self setNeedsDisplayInRect: contentRect];
}
- (BOOL) isOpaque
{
@ -271,24 +216,19 @@ Returns the content rect for a given window frame.
- (void) drawRect: (NSRect)rect
{
//NSColor *c = [_window backgroundColor];
if (NSIntersectsRect(rect, contentRect))
{
// [c set];
// NSRectFill(contentRect);
[[GSDrawFunctions theme] drawWindowBackground: contentRect view: self];
[[GSTheme theme] drawWindowBackground: contentRect view: self];
}
}
- initWithCoder: (NSCoder*)aCoder
- (id) initWithCoder: (NSCoder*)aCoder
{
NSAssert(NO, @"The top-level window view should never be encoded.");
return nil;
}
-(void) encodeWithCoder: (NSCoder*)aCoder
- (void) encodeWithCoder: (NSCoder*)aCoder
{
NSAssert(NO, @"The top-level window view should never be encoded.");
}
@ -299,14 +239,8 @@ Returns the content rect for a given window frame.
@implementation GSBackendWindowDecorationView
+(void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
{
*l = *r = *t = *b = 0.0;
}
+(void) screenOffsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
+ (void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
forStyleMask: (unsigned int)style
{
[GSCurrentServer() styleoffsets: l : r : t : b : style];
}
@ -318,24 +252,5 @@ Returns the content rect for a given window frame.
return 0.0;
}
+(NSRect) windowFrameRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
float l, r, t, b;
[self offsets: &l : &r : &t : &b forStyleMask: aStyle];
aRect.size.width -= l + r;
aRect.size.height -= t + b;
return aRect;
}
/*
Returns the content rect for a given window frame.
*/
+(NSRect) contentRectForWindowFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
return aRect;
}
@end

View file

@ -33,6 +33,7 @@
#include <Foundation/NSString.h>
#include <Foundation/NSData.h>
#include <Foundation/NSException.h>
#include <Foundation/NSValue.h>
#include "AppKit/NSGraphics.h"
#include <jerror.h>
@ -70,7 +71,6 @@ struct gs_jpeg_error_mgr
};
typedef struct gs_jpeg_error_mgr *gs_jpeg_error_mgr_ptr;
/* Print the last jpeg library error and returns
* the control to the caller of the libary.
* libjpegs default error handling would exit
@ -197,6 +197,132 @@ static void gs_jpeg_memory_src_destroy(j_decompress_ptr cinfo)
cinfo->src = NULL;
}
/* ------------------------------------------------------------------*/
/*
* A custom destination manager.
*/
typedef struct
{
struct jpeg_destination_mgr pub; // public fields
unsigned char* buffer;
unsigned char* data;
NSData** finalData;
int length;
} gs_jpeg_destination_mgr;
typedef gs_jpeg_destination_mgr * gs_jpeg_dest_ptr;
/*
Initialize destination. This is called by jpeg_start_compress()
before any data is actually written. It must initialize
next_output_byte and free_in_buffer. free_in_buffer must be
initialized to a positive value.
*/
static void gs_init_destination (j_compress_ptr cinfo)
{
//NSLog (@"gs_init_destination");
gs_jpeg_dest_ptr dest = (gs_jpeg_dest_ptr) cinfo->dest;
// allocate the output image
int imageSize = cinfo->image_width * cinfo->image_height;
dest->buffer = (void*) calloc ((imageSize * cinfo->input_components),
sizeof(unsigned char));
dest->data = (void*) calloc ((imageSize * cinfo->input_components),
sizeof(unsigned char));
dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = imageSize * cinfo->input_components;
dest->length = 0;
}
/*
This is called whenever the buffer has filled (free_in_buffer
reaches zero). In typical applications, it should write out the
*entire* buffer (use the saved start address and buffer length;
ignore the current state of next_output_byte and free_in_buffer).
Then reset the pointer & count to the start of the buffer, and
return TRUE indicating that the buffer has been dumped.
free_in_buffer must be set to a positive value when TRUE is
returned. A FALSE return should only be used when I/O suspension is
desired (this operating mode is discussed in the next section).
*/
static boolean gs_empty_output_buffer (j_compress_ptr cinfo)
{
//NSLog (@"gs_empty_output_buffer...");
gs_jpeg_dest_ptr dest = (gs_jpeg_dest_ptr) cinfo->dest;
//NSLog (@"length added (%d)", dest->length);
int imageSize = cinfo->image_width * cinfo->image_height;
int bufSize = imageSize * cinfo->input_components;
int i;
for (i = 0; i < bufSize; i++)
{
dest->data [dest->length + i] = dest->buffer [i];
}
dest->length = dest->length + bufSize;
dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = imageSize * cinfo->input_components;
return TRUE;
}
/*
Terminate destination --- called by jpeg_finish_compress() after all
data has been written. In most applications, this must flush any
data remaining in the buffer. Use either next_output_byte or
free_in_buffer to determine how much data is in the buffer.
*/
static void gs_term_destination (j_compress_ptr cinfo)
{
//NSLog (@"gs_term_destination");
gs_jpeg_dest_ptr dest = (gs_jpeg_dest_ptr) cinfo->dest;
int imageSize = cinfo->image_width * cinfo->image_height;
int bufSize = imageSize * cinfo->input_components;
int i;
for (i = 0; i < bufSize; i++)
{
dest->data [dest->length + i] = dest->buffer [i];
}
dest->length = dest->length + bufSize;
*dest->finalData = [[NSData alloc] initWithBytes: dest->data
length: (dest->length) - dest->pub.free_in_buffer];
}
static void gs_jpeg_memory_dest_create (j_compress_ptr cinfo, NSData** data)
{
gs_jpeg_dest_ptr dest;
cinfo->dest = (struct jpeg_destination_mgr*)
malloc (sizeof (gs_jpeg_destination_mgr));
dest = (gs_jpeg_dest_ptr) cinfo->dest;
dest->pub.init_destination = gs_init_destination;
dest->pub.empty_output_buffer = gs_empty_output_buffer;
dest->pub.term_destination = gs_term_destination;
dest->finalData = data;
}
static void gs_jpeg_memory_dest_destroy (j_compress_ptr cinfo)
{
gs_jpeg_dest_ptr dest = (gs_jpeg_dest_ptr) cinfo->dest;
free (dest->buffer);
free (dest->data);
free (dest);
cinfo->dest = NULL;
}
/* -----------------------------------------------------------
The jpeg loading part of NSBitmapImageRep
@ -245,8 +371,9 @@ static void gs_jpeg_memory_src_destroy(j_decompress_ptr cinfo)
}
/* Read the jpeg image. Assume it is from a jpeg file and imageData is not
nil. */
/* Read the jpeg image. Assume it is from a jpeg file and imageData
* is not nil.
*/
- (id) _initBitmapFromJPEG: (NSData *)imageData
errorMessage: (NSString **)errorMsg
{
@ -319,15 +446,17 @@ nil. */
i = 0;
while (cinfo.output_scanline < cinfo.output_height)
{
sclcount = jpeg_read_scanlines(&cinfo, sclbuffer, cinfo.rec_outbuf_height);
sclcount
= jpeg_read_scanlines(&cinfo, sclbuffer, cinfo.rec_outbuf_height);
for (j = 0; j < sclcount; j++)
{
// copy a row to the image buffer
memcpy((imgbuffer + (i * rowSize)),
*(sclbuffer + (j * rowSize)),
rowSize);
i++;
}
{
// copy a row to the image buffer
memcpy((imgbuffer + (i * rowSize)),
*(sclbuffer + (j * rowSize)),
rowSize);
i++;
}
}
/* done */
@ -338,8 +467,8 @@ nil. */
if (jerrMgr.parent.num_warnings)
{
NSLog(@"NSBitmapImageRep+JPEG: %d warnings during jpeg decompression, image may be corrupted",
jerrMgr.parent.num_warnings);
NSLog(@"NSBitmapImageRep+JPEG: %d warnings during jpeg decompression, "
@"image may be corrupted", jerrMgr.parent.num_warnings);
}
// create the imagerep
@ -364,6 +493,100 @@ nil. */
@end
/* -----------------------------------------------------------
The jpeg writing part of NSBitmapImageRep
----------------------------------------------------------- */
@implementation NSBitmapImageRep (JPEGWriting)
- (NSData*) representationUsingType: (NSBitmapImageFileType) storageType
properties: (NSDictionary*) properties
{
NSData *ret;
unsigned char *imageSource = [self bitmapData];
int sPP = [self samplesPerPixel];
int width = [self size].width;
int height = [self size].height;
int row_stride = width * sPP;
int quality = 90;
NSNumber *qualityNumber = nil;
NSString *colorSpace = nil;
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
JSAMPROW row_pointer[1]; // pointer to a single row
cinfo.err = jpeg_std_error (&jerr);
jpeg_create_compress (&cinfo);
// TODO: handles planar images
if ([self isPlanar])
{
NSLog (@"Planar Image, not handled yet !");
return nil;
}
// specify the destination for the compressed data..
gs_jpeg_memory_dest_create (&cinfo, &ret);
// set parameters
cinfo.image_width = width;
cinfo.image_height = height;
cinfo.input_components = sPP;
// TODO: use the image infos to choose the proper color space
//cinfo.in_color_space = JCS_GRAYSCALE;
colorSpace = [self colorSpaceName];
if ([colorSpace isEqualToString: @"NSCalibratedRGBColorSpace"]
|| [colorSpace isEqualToString: @"NSDeviceRGBColorSpace"])
{
cinfo.in_color_space = JCS_RGB;
}
else
{
NSLog (@"Image Color Space: %@ not handled yet !", colorSpace);
return nil;
}
// set quality
qualityNumber = [properties objectForKey: @"NSImageCompressionFactor"];
if (qualityNumber != nil)
{
quality = (int) ([qualityNumber floatValue] * 100);
}
jpeg_set_defaults (&cinfo);
// compress the image
jpeg_set_quality (&cinfo, quality, TRUE);
jpeg_start_compress (&cinfo, TRUE);
while (cinfo.next_scanline < cinfo.image_height)
{
int index = cinfo.next_scanline * row_stride;
row_pointer[0] = &imageSource[index];
jpeg_write_scanlines (&cinfo, row_pointer, 1);
}
jpeg_finish_compress(&cinfo);
gs_jpeg_memory_dest_destroy (&cinfo);
jpeg_destroy_compress(&cinfo);
return AUTORELEASE(ret);
}
@end
#else /* !HAVE_LIBJPEG */
@implementation NSBitmapImageRep (JPEGReading)
@ -371,6 +594,7 @@ nil. */
{
return NO;
}
- (id) _initBitmapFromJPEG: (NSData *)imageData
errorMessage: (NSString **)errorMsg
{

View file

@ -38,7 +38,7 @@
#include "AppKit/NSGraphics.h"
#include "AppKit/NSTextFieldCell.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
#include <math.h>
@ -445,10 +445,10 @@
NSFrameRect(_border_rect);
break;
case NSBezelBorder:
[GSDrawFunctions drawDarkBezel: _border_rect : rect];
[[GSTheme theme] drawDarkBezel: _border_rect withClip: rect];
break;
case NSGrooveBorder:
[GSDrawFunctions drawGroove: _border_rect : rect];
[[GSTheme theme] drawGroove: _border_rect withClip: rect];
break;
}

View file

@ -52,7 +52,7 @@
#include "AppKit/NSEvent.h"
#include "AppKit/NSWindow.h"
#include "AppKit/NSBezierPath.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
DEFINE_RINT_IF_MISSING
@ -206,7 +206,7 @@ static NSTextFieldCell *titleCell;
return;
}
[GSDrawFunctions drawGrayBezel: cellFrame : NSZeroRect];
[[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect];
[self drawInteriorWithFrame: cellFrame inView: controlView];
}
@end
@ -2219,7 +2219,7 @@ static NSTextFieldCell *titleCell;
if ((NSIntersectsRect (scrollerBorderRect, rect) == YES) && _window)
{
[GSDrawFunctions drawGrayBezel: scrollerBorderRect : rect];
[[GSTheme theme] drawGrayBezel: scrollerBorderRect withClip: rect];
}
}
@ -2230,7 +2230,7 @@ static NSTextFieldCell *titleCell;
float hScrollerWidth = _hasHorizontalScroller ? scrollerWidth : 0;
// Columns borders
[GSDrawFunctions drawGrayBezel: _bounds : rect];
[[GSTheme theme] drawGrayBezel: _bounds withClip: rect];
[[NSColor blackColor] set];
visibleColumns = [self numberOfVisibleColumns];

View file

@ -51,7 +51,7 @@
#include "AppKit/NSImage.h"
#include "AppKit/NSSound.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
#include "GNUstepGUI/GSNibCompatibility.h"
#include <math.h>
@ -837,7 +837,7 @@ typedef struct _GSButtonCellFlags
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
unsigned mask;
int buttonState = 0;
int buttonState = 0;
// Save last view drawn to
if (_control_view != controlView)
@ -855,9 +855,10 @@ typedef struct _GSButtonCellFlags
if (_cell.is_highlighted)
{
mask = _highlightsByMask;
if (_cell.state)
mask &= ~_showAltStateMask;
{
mask &= ~_showAltStateMask;
}
}
else if (_cell.state)
mask = _showAltStateMask;
@ -869,8 +870,8 @@ typedef struct _GSButtonCellFlags
is NSChangeBackgroundCellMask or NSChangeGrayCellMask,
as required by our nextstep-like look and feel. */
if (_cell.is_bordered
|| (_highlightsByMask & NSChangeBackgroundCellMask)
|| (_highlightsByMask & NSChangeGrayCellMask))
|| (_highlightsByMask & NSChangeBackgroundCellMask)
|| (_highlightsByMask & NSChangeGrayCellMask))
{
/* Determine the background color. */
if (mask & (NSChangeGrayCellMask | NSChangeBackgroundCellMask))
@ -882,15 +883,14 @@ typedef struct _GSButtonCellFlags
/* Pushed in buttons contents are displaced to the bottom right 1px. */
if (_cell.is_bordered && (mask & NSPushInCellMask))
{
//cellFrame = NSOffsetRect(cellFrame, 1., flippedView ? 1. : -1.);
buttonState = 2; // pushed button
}
// draw the border if needed
if ((_cell.is_bordered) &&
(!_shows_border_only_while_mouse_inside || _mouse_inside))
if ((_cell.is_bordered)
&& (!_shows_border_only_while_mouse_inside || _mouse_inside))
{
cellFrame = [[GSDrawFunctions theme]
cellFrame = [[GSTheme theme]
drawButton: cellFrame in: self view: controlView
style: _bezel_style
state: buttonState];
@ -900,11 +900,9 @@ typedef struct _GSButtonCellFlags
// Draw first responder
if (_cell.shows_first_responder
&& [[controlView window] firstResponder] == controlView)
&& [[controlView window] firstResponder] == controlView)
{
//NSDottedFrameRect(cellFrame);
[[GSDrawFunctions theme]
drawFocusFrame: cellFrame view: controlView];
[[GSTheme theme] drawFocusFrame: cellFrame view: controlView];
}
}
@ -926,47 +924,47 @@ typedef struct _GSButtonCellFlags
switch (_gradient_type)
{
case NSGradientNone:
return;
break;
case NSGradientNone:
return;
break;
case NSGradientConcaveWeak:
[gray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [lightGray brightnessComponent];
end_white = [gray brightnessComponent];
break;
case NSGradientConvexWeak:
[darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [gray brightnessComponent];
end_white = [lightGray brightnessComponent];
break;
case NSGradientConcaveStrong:
[lightGray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [lightGray brightnessComponent];
end_white = [darkGray brightnessComponent];
break;
case NSGradientConvexStrong:
[darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [darkGray brightnessComponent];
end_white = [lightGray brightnessComponent];
break;
case NSGradientConcaveWeak:
[gray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [lightGray brightnessComponent];
end_white = [gray brightnessComponent];
break;
case NSGradientConvexWeak:
[darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [gray brightnessComponent];
end_white = [lightGray brightnessComponent];
break;
case NSGradientConcaveStrong:
[lightGray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [lightGray brightnessComponent];
end_white = [darkGray brightnessComponent];
break;
case NSGradientConvexStrong:
[darkGray getHue: &h saturation: &s brightness: &v alpha: &a];
start_white = [darkGray brightnessComponent];
end_white = [lightGray brightnessComponent];
break;
default:
break;
default:
break;
}
white = start_white;
white_step = fabs(start_white - end_white)/
(cellFrame.size.width + cellFrame.size.height);
white_step = fabs(start_white - end_white)
/ (cellFrame.size.width + cellFrame.size.height);
// Start from top left
p1 = NSMakePoint(cellFrame.origin.x,
cellFrame.size.height + cellFrame.origin.y);
p1 = NSMakePoint(cellFrame.origin.x,
cellFrame.size.height + cellFrame.origin.y);
p2 = NSMakePoint(cellFrame.origin.x,
cellFrame.size.height + cellFrame.origin.y);
cellFrame.size.height + cellFrame.origin.y);
// Move by Y
while (p1.y > cellFrame.origin.y)
@ -1016,7 +1014,6 @@ typedef struct _GSButtonCellFlags
NSRect titleRect;
NSSize imageSize = {0, 0};
NSSize titleSize = {0, 0};
NSColor *backgroundColor = nil;
BOOL flippedView = [controlView isFlipped];
NSCellImagePosition ipos = _cell.image_position;
@ -1026,8 +1023,8 @@ typedef struct _GSButtonCellFlags
_control_view = controlView;
//TODO: we should be able to get rid of "mask"
// set the mask
cellFrame = [self drawingRectForBounds: cellFrame];
if (_cell.is_highlighted)
{
mask = _highlightsByMask;
@ -1205,7 +1202,8 @@ typedef struct _GSButtonCellFlags
imageRect.origin.x = cellFrame.origin.x;
imageRect.origin.y = cellFrame.origin.y;
imageRect.size.width = cellFrame.size.width;
imageRect.size.height = titleRect.origin.y - GSCellTextImageYDist - imageRect.origin.y;
imageRect.size.height
= titleRect.origin.y - GSCellTextImageYDist - imageRect.origin.y;
if (_cell.is_bordered || _cell.is_bezeled)
{
@ -1239,7 +1237,9 @@ typedef struct _GSButtonCellFlags
// Draw image
if (imageToDisplay != nil)
{
[self _drawImage: imageToDisplay inFrame: imageRect isFlipped: flippedView];
[self _drawImage: imageToDisplay
inFrame: imageRect
isFlipped: flippedView];
}
// Draw title
@ -1247,7 +1247,6 @@ typedef struct _GSButtonCellFlags
{
[self _drawAttributedText: titleToDisplay inFrame: titleRect];
}
}
- (NSSize) cellSize
@ -1446,6 +1445,7 @@ typedef struct _GSButtonCellFlags
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
BOOL tmp;
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])

View file

@ -60,7 +60,7 @@
#include "AppKit/NSTextContainer.h"
#include "AppKit/NSView.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
static Class colorClass;
static Class cellClass;
@ -1937,7 +1937,7 @@ static NSColor *shadowCol;
}
else if (_cell.is_bezeled)
{
[GSDrawFunctions drawWhiteBezel: cellFrame : NSZeroRect];
[[GSTheme theme] drawWhiteBezel: cellFrame withClip: NSZeroRect];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];

View file

@ -45,9 +45,19 @@
#include "AppKit/NSImage.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSTheme.h"
static Class NSColorClass;
/* This interface must be provided in NSColorList to let us manage
* system colors.
*/
@interface NSColorList (GNUstepPrivate)
+ (void) _setDefaultSystemColorList: (NSColorList*)aList;
+ (void) _setThemeSystemColorList: (NSColorList*)aList;
@end
@interface GSNamedColor : NSColor
{
NSString *_catalog_name;
@ -153,12 +163,14 @@ static Class NSColorClass;
+ (NSColor*) colorFromString: (NSString*)string;
+ (void) defaultsDidChange: (NSNotification*)notification;
+ (void) themeDidActivate: (NSNotification*)notification;
@end
// Class variables
static BOOL gnustep_gui_ignores_alpha = YES;
static NSColorList *systemColors = nil;
static NSColorList *defaultSystemColors = nil;
static NSMutableDictionary *colorStrings = nil;
static NSMutableDictionary *systemDict = nil;
@ -224,9 +236,11 @@ void initSystemColors(void)
nil];
systemColors = [NSColorList colorListNamed: @"System"];
defaultSystemColors = [[NSColorList alloc] initWithName: @"System"];
[NSColorList _setDefaultSystemColorList: defaultSystemColors];
if (systemColors == nil)
{
systemColors = [[NSColorList alloc] initWithName: @"System"];
ASSIGN(systemColors, defaultSystemColors);
}
{
@ -240,24 +254,24 @@ void initSystemColors(void)
while ((key = (NSString *)[enumerator nextObject]))
{
NSString *aColorString;
NSColor *color;
if ([systemColors colorWithKey: key])
continue;
if ((color = [systemColors colorWithKey: key]) == nil)
{
NSString *aColorString;
aColorString = [colorStrings objectForKey: key];
color = [NSColorClass colorFromString: aColorString];
aColorString = [colorStrings objectForKey: key];
color = [NSColorClass colorFromString: aColorString];
NSCAssert1(color, @"couldn't get default system color %@", key);
[systemColors setColor: color forKey: key];
changed = YES;
NSCAssert1(color, @"couldn't get default system color %@", key);
[systemColors setColor: color forKey: key];
changed = YES;
}
if (defaultSystemColors != systemColors)
{
[defaultSystemColors setColor: color forKey: key];
}
}
if (changed)
[systemColors writeToFile: nil];
}
systemDict = [NSMutableDictionary new];
@ -309,6 +323,12 @@ systemColorWithName(NSString *name)
selector: @selector(defaultsDidChange:)
name: NSUserDefaultsDidChangeNotification
object: nil];
// watch for themes which may provide new system color lists
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(themeDidActivate:)
name: GSThemeDidActivateNotification
object: nil];
}
}
@ -1636,6 +1656,35 @@ systemColorWithName(NSString *name)
}
}
/*
* Handle activation of a new theme ... look for a 'System' color list
* in the theme bundle and use it instead of the default system color
* list if it is present.
*/
+ (void) themeDidActivate: (NSNotification*)notification
{
NSDictionary *userInfo = [notification userInfo];
NSColorList *list = [userInfo objectForKey: @"Colors"];
if (list == nil)
{
list = defaultSystemColors;
}
NSAssert([[list name] isEqual: @"System"], NSInvalidArgumentException);
[NSColorList _setThemeSystemColorList: list];
/* We always update the system dictionary and send a notification, since
* the theme may have gicen us a pre-existing color list, but have changed
* one or more of the colors in it.
*/
list = [NSColorList colorListNamed: @"System"];
ASSIGN(systemColors, list);
[systemDict removeAllObjects];
NSLog(@"Theme activation with control background %@", [self controlBackgroundColor]);
[[NSNotificationCenter defaultCenter]
postNotificationName: NSSystemColorsDidChangeNotification object: nil];
}
@end
@ -1660,7 +1709,7 @@ systemColorWithName(NSString *name)
[super dealloc];
}
- (NSString *)colorSpaceName
- (NSString *) colorSpaceName
{
return NSNamedColorSpace;
}
@ -1740,7 +1789,7 @@ systemColorWithName(NSString *name)
return NO;
}
- (NSColor *)colorUsingColorSpaceName: (NSString *)colorSpace
- (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace
device: (NSDictionary *)deviceDescription
{
NSColorList *list;
@ -1888,7 +1937,7 @@ systemColorWithName(NSString *name)
aCopy->_alpha_component = alpha;
}
return aCopy;
return AUTORELEASE(aCopy);
}
- (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace
@ -1912,43 +1961,43 @@ systemColorWithName(NSString *name)
return nil;
}
if ([colorSpace isEqualToString: NSDeviceWhiteColorSpace] ||
[colorSpace isEqualToString: NSDeviceBlackColorSpace])
if ([colorSpace isEqualToString: NSDeviceWhiteColorSpace]
|| [colorSpace isEqualToString: NSDeviceBlackColorSpace])
{
return [NSColor colorWithDeviceWhite: _white_component
alpha: _alpha_component];
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSCalibratedWhiteColorSpace] ||
[colorSpace isEqualToString: NSCalibratedBlackColorSpace])
if ([colorSpace isEqualToString: NSCalibratedWhiteColorSpace]
|| [colorSpace isEqualToString: NSCalibratedBlackColorSpace])
{
return [NSColor colorWithCalibratedWhite: _white_component
alpha: _alpha_component];
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSCalibratedRGBColorSpace])
{
return [NSColor colorWithCalibratedRed: _white_component
green: _white_component
blue: _white_component
alpha: _alpha_component];
green: _white_component
blue: _white_component
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSDeviceRGBColorSpace])
{
return [NSColor colorWithDeviceRed: _white_component
green: _white_component
blue: _white_component
alpha: _alpha_component];
green: _white_component
blue: _white_component
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSDeviceCMYKColorSpace])
{
return [NSColor colorWithDeviceCyan: 0.0
magenta: 0.0
yellow: 0.0
black: 1.0 - _white_component
alpha: _alpha_component];
magenta: 0.0
yellow: 0.0
black: 1.0 - _white_component
alpha: _alpha_component];
}
return nil;
@ -2007,7 +2056,7 @@ systemColorWithName(NSString *name)
@implementation GSDeviceWhiteColor
- (NSString *)colorSpaceName
- (NSString *) colorSpaceName
{
return NSDeviceWhiteColorSpace;
}
@ -2030,7 +2079,7 @@ systemColorWithName(NSString *name)
@implementation GSCalibratedWhiteColor
- (NSString *)colorSpaceName
- (NSString *) colorSpaceName
{
return NSCalibratedWhiteColorSpace;
}
@ -2082,7 +2131,7 @@ systemColorWithName(NSString *name)
return self;
}
- (NSString *)colorSpaceName
- (NSString *) colorSpaceName
{
return NSDeviceCMYKColorSpace;
}
@ -2160,12 +2209,14 @@ systemColorWithName(NSString *name)
{
GSDeviceCMYKColor *col = (GSDeviceCMYKColor*)other;
if (col->_cyan_component != _cyan_component ||
col->_magenta_component != _magenta_component ||
col->_yellow_component != _yellow_component ||
col->_black_component != _black_component ||
col->_alpha_component != _alpha_component)
return NO;
if (col->_cyan_component != _cyan_component
|| col->_magenta_component != _magenta_component
|| col->_yellow_component != _yellow_component
|| col->_black_component != _black_component
|| col->_alpha_component != _alpha_component)
{
return NO;
}
return YES;
}
return NO;
@ -2188,7 +2239,7 @@ systemColorWithName(NSString *name)
aCopy->_alpha_component = alpha;
}
return aCopy;
return AUTORELEASE(aCopy);
}
- (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace
@ -2238,20 +2289,20 @@ systemColorWithName(NSString *name)
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSCalibratedWhiteColorSpace] ||
[colorSpace isEqualToString: NSCalibratedBlackColorSpace])
if ([colorSpace isEqualToString: NSCalibratedWhiteColorSpace]
|| [colorSpace isEqualToString: NSCalibratedBlackColorSpace])
{
return [NSColor colorWithCalibratedWhite: 1 - _black_component -
(_cyan_component + _magenta_component + _yellow_component)/3
alpha: _alpha_component];
(_cyan_component + _magenta_component + _yellow_component)/3
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSDeviceWhiteColorSpace] ||
[colorSpace isEqualToString: NSDeviceBlackColorSpace])
if ([colorSpace isEqualToString: NSDeviceWhiteColorSpace]
|| [colorSpace isEqualToString: NSDeviceBlackColorSpace])
{
return [NSColor colorWithDeviceWhite: 1 - _black_component -
(_cyan_component + _magenta_component + _yellow_component)/3
alpha: _alpha_component];
(_cyan_component + _magenta_component + _yellow_component)/3
alpha: _alpha_component];
}
return nil;
@ -2281,10 +2332,10 @@ systemColorWithName(NSString *name)
// FIXME: Missing handling of alpha value
[aCoder encodeInt: 5 forKey: @"NSColorSpace"];
str = [[NSString alloc] initWithFormat: @"%f %f %f %f", _cyan_component,
_magenta_component, _yellow_component, _black_component];
_magenta_component, _yellow_component, _black_component];
[aCoder encodeBytes: (const uint8_t*)[str cString]
length: [str cStringLength]
forKey: @"NSCYMK"];
length: [str cStringLength]
forKey: @"NSCYMK"];
RELEASE(str);
}
else
@ -2392,9 +2443,11 @@ systemColorWithName(NSString *name)
GSRGBColor *col = (GSRGBColor*)other;
if (col->_red_component != _red_component
|| col->_green_component != _green_component
|| col->_blue_component != _blue_component)
return NO;
|| col->_green_component != _green_component
|| col->_blue_component != _blue_component)
{
return NO;
}
return YES;
}
@ -2418,7 +2471,7 @@ systemColorWithName(NSString *name)
aCopy->_alpha_component = alpha;
}
return aCopy;
return AUTORELEASE(aCopy);
}
- (NSColor*) colorUsingColorSpaceName: (NSString *)colorSpace
@ -2458,29 +2511,29 @@ systemColorWithName(NSString *name)
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSCalibratedWhiteColorSpace] ||
[colorSpace isEqualToString: NSCalibratedBlackColorSpace])
if ([colorSpace isEqualToString: NSCalibratedWhiteColorSpace]
|| [colorSpace isEqualToString: NSCalibratedBlackColorSpace])
{
return [NSColor colorWithCalibratedWhite:
(_red_component + _green_component + _blue_component)/3
alpha: _alpha_component];
(_red_component + _green_component + _blue_component)/3
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSDeviceWhiteColorSpace] ||
[colorSpace isEqualToString: NSDeviceBlackColorSpace])
if ([colorSpace isEqualToString: NSDeviceWhiteColorSpace]
|| [colorSpace isEqualToString: NSDeviceBlackColorSpace])
{
return [NSColor colorWithDeviceWhite:
(_red_component + _green_component + _blue_component)/3
alpha: _alpha_component];
(_red_component + _green_component + _blue_component)/3
alpha: _alpha_component];
}
if ([colorSpace isEqualToString: NSDeviceCMYKColorSpace])
{
return [NSColor colorWithDeviceCyan: 1 - _red_component
magenta: 1 - _green_component
yellow: 1 - _blue_component
black: 0.0
alpha: _alpha_component];
magenta: 1 - _green_component
yellow: 1 - _blue_component
black: 0.0
alpha: _alpha_component];
}
return nil;
@ -2513,7 +2566,9 @@ systemColorWithName(NSString *name)
- (void) set
{
// This should only be in GSDeviceRGBColor, but is here to keep old code working.
/* This should only be in GSDeviceRGBColor,
* but is here to keep old code working.
*/
NSDebugLLog(@"NSColor", @"RGB %f %f %f\n", _red_component,
_green_component, _blue_component);
PSsetrgbcolor(_red_component, _green_component,
@ -2577,7 +2632,7 @@ systemColorWithName(NSString *name)
@implementation GSDeviceRGBColor
- (NSString *)colorSpaceName
- (NSString *) colorSpaceName
{
return NSDeviceRGBColorSpace;
}
@ -2703,7 +2758,7 @@ systemColorWithName(NSString *name)
@implementation GSCalibratedRGBColor
- (NSString *)colorSpaceName
- (NSString *) colorSpaceName
{
return NSCalibratedRGBColorSpace;
}
@ -2842,7 +2897,7 @@ systemColorWithName(NSString *name)
[super dealloc];
}
- (NSString *)colorSpaceName
- (NSString *) colorSpaceName
{
return NSPatternColorSpace;
}

View file

@ -29,6 +29,7 @@
#include "config.h"
#include <Foundation/NSNotification.h>
#include <Foundation/NSNotificationQueue.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSArchiver.h>
@ -43,82 +44,51 @@
#include "AppKit/NSColor.h"
#include "AppKit/AppKitExceptions.h"
// The list of available color lists is created only once -- this has
// a drawback, that you need to restart your program to get the color
// lists read again.
static NSMutableArray *_gnustep_available_color_lists = nil;
static NSLock *_gnustep_color_list_lock = nil;
// The list of available color lists is cached and re-loaded only
// after a time.
static NSMutableArray *_availableColorLists = nil;
static NSLock *_colorListLock = nil;
static NSColorList *defaultSystemColorList = nil;
static NSColorList *themeColorList = nil;
@interface NSColorList (GNUstepPrivate)
/* Loads the available color lists from standard directories.<br />
* If called with a nil argument, this will check to see if the
* lists have already been loaded, and only load if they haven't been.
*/
+ (void) _loadAvailableColorLists: (NSNotification*)aNotification;
/* Set the default system color list ... to be used if no system color
* list has been loaded from file. This should always be the last of
* the array of available color lists even though it has noit been
* written to file.
*/
+ (void) _setDefaultSystemColorList: (NSColorList*)aList;
/* Set the theme system color list ... if this is not nil, it is placed
* at the start of the array of available lists and is used as the system
* color list.
*/
+ (void) _setThemeSystemColorList: (NSColorList*)aList;
@end
@implementation NSColorList
//
// Class methods
//
+ (void)initialize
+ (void) initialize
{
if (self == [NSColorList class])
{
[self setVersion: 2];
_colorListLock = [NSRecursiveLock new];
}
}
/*
* Private Method which loads the color lists.
* Invoke if _gnustep_available_color_lists == nil
* before any operation with that object or its lock.
*
* The aim is to defer reading the available color lists
* till we really need to, so that only programs which really use
* this feature get the overhead.
*/
+ (void) _loadAvailableColorLists
{
NSString *dir;
NSString *file;
NSEnumerator *e;
NSFileManager *fm = [NSFileManager defaultManager];
NSDirectoryEnumerator *de;
NSColorList *newList;
// Create the global array of color lists
_gnustep_available_color_lists = [[NSMutableArray alloc] init];
/*
* Load color lists found in standard paths into the array
* FIXME: Check exactly where in the directory tree we should scan.
*/
e = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSAllDomainsMask, YES) objectEnumerator];
while ((dir = (NSString *)[e nextObject]))
{
BOOL flag;
dir = [dir stringByAppendingPathComponent: @"Colors"];
if (![fm fileExistsAtPath: dir isDirectory: &flag] || !flag)
{
// Only process existing directories
continue;
}
de = [fm enumeratorAtPath: dir];
while ((file = [de nextObject]))
{
if ([[file pathExtension] isEqualToString: @"clr"])
{
NSString *name = [file stringByDeletingPathExtension];
newList = [[NSColorList alloc] initWithName: name
fromFile: [dir stringByAppendingPathComponent: file]];
[_gnustep_available_color_lists addObject: newList];
RELEASE(newList);
}
}
}
// And create its access lock
_gnustep_color_list_lock = [[NSLock alloc] init];
}
/*
* Getting All Color Lists
*/
@ -126,15 +96,11 @@ static NSLock *_gnustep_color_list_lock = nil;
{
NSArray *a;
if (_gnustep_available_color_lists == nil)
[NSColorList _loadAvailableColorLists];
// Serialize access to color list
[_gnustep_color_list_lock lock];
a = [NSArray arrayWithArray: _gnustep_available_color_lists];
[_gnustep_color_list_lock unlock];
[_colorListLock lock];
[NSColorList _loadAvailableColorLists: nil];
a = [NSArray arrayWithArray: _availableColorLists];
[_colorListLock unlock];
return a;
}
@ -146,31 +112,25 @@ static NSLock *_gnustep_color_list_lock = nil;
{
NSColorList *r;
NSEnumerator *e;
BOOL found = NO;
if (_gnustep_available_color_lists == nil)
[NSColorList _loadAvailableColorLists];
// Serialize access to color list
[_gnustep_color_list_lock lock];
[_colorListLock lock];
e = [_gnustep_available_color_lists objectEnumerator];
[NSColorList _loadAvailableColorLists: nil];
e = [_availableColorLists objectEnumerator];
while ((r = (NSColorList *)[e nextObject]))
while ((r = (NSColorList *)[e nextObject]) != nil)
{
if ([[r name] isEqualToString: name])
{
found = YES;
RETAIN(r);
break;
}
}
[_gnustep_color_list_lock unlock];
[_colorListLock unlock];
if (found)
return r;
else
return nil;
return AUTORELEASE(r);
}
@ -371,6 +331,8 @@ static NSLock *_gnustep_color_list_lock = nil;
key: (NSString *)key
atIndex: (unsigned)location
{
NSNotification *n;
if (_is_editable == NO)
[NSException raise: NSColorListNotEditableException
format: @"Color list cannot be edited\n"];
@ -379,13 +341,20 @@ static NSLock *_gnustep_color_list_lock = nil;
[_orderedColorKeys removeObject: key];
[_orderedColorKeys insertObject: key atIndex: location];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSColorListChangedNotification
object: self];
n = [NSNotification notificationWithName: NSColorListChangedNotification
object: self
userInfo: nil];
[[NSNotificationQueue defaultQueue]
enqueueNotification: n
postingStyle: NSPostASAP
coalesceMask: NSNotificationCoalescingOnSender
forModes: nil];
}
- (void) removeColorWithKey: (NSString *)key
{
NSNotification *n;
if (_is_editable == NO)
[NSException raise: NSColorListNotEditableException
format: @"Color list cannot be edited\n"];
@ -393,14 +362,21 @@ static NSLock *_gnustep_color_list_lock = nil;
[_colorDictionary removeObjectForKey: key];
[_orderedColorKeys removeObject: key];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSColorListChangedNotification
object: self];
n = [NSNotification notificationWithName: NSColorListChangedNotification
object: self
userInfo: nil];
[[NSNotificationQueue defaultQueue]
enqueueNotification: n
postingStyle: NSPostASAP
coalesceMask: NSNotificationCoalescingOnSender
forModes: nil];
}
- (void) setColor: (NSColor *)aColor
forKey: (NSString *)key
{
NSNotification *n;
if (_is_editable == NO)
[NSException raise: NSColorListNotEditableException
format: @"Color list cannot be edited\n"];
@ -410,9 +386,14 @@ static NSLock *_gnustep_color_list_lock = nil;
if ([_orderedColorKeys containsObject: key] == NO)
[_orderedColorKeys addObject: key];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSColorListChangedNotification
object: self];
n = [NSNotification notificationWithName: NSColorListChangedNotification
object: self
userInfo: nil];
[[NSNotificationQueue defaultQueue]
enqueueNotification: n
postingStyle: NSPostASAP
coalesceMask: NSNotificationCoalescingOnSender
forModes: nil];
}
/*
@ -438,8 +419,7 @@ static NSLock *_gnustep_color_list_lock = nil;
* We need to initialize before saving, to avoid the new file being
* counted as a different list thus making us appear twice
*/
if (_gnustep_available_color_lists == nil)
[NSColorList _loadAvailableColorLists];
[NSColorList _loadAvailableColorLists: nil];
if (path == nil || ([fm fileExistsAtPath: path isDirectory: &isDir] == NO))
{
@ -513,10 +493,10 @@ static NSLock *_gnustep_color_list_lock = nil;
if (success && path_is_standard)
{
[_gnustep_color_list_lock lock];
if ([_gnustep_available_color_lists containsObject: self] == NO)
[_gnustep_available_color_lists addObject: self];
[_gnustep_color_list_lock unlock];
[_colorListLock lock];
if ([_availableColorLists containsObject: self] == NO)
[_availableColorLists addObject: self];
[_colorListLock unlock];
return YES;
}
@ -532,12 +512,9 @@ static NSLock *_gnustep_color_list_lock = nil;
handler: nil];
// Remove the color list from the global list of colors
if (_gnustep_available_color_lists == nil)
[NSColorList _loadAvailableColorLists];
[_gnustep_color_list_lock lock];
[_gnustep_available_color_lists removeObject: self];
[_gnustep_color_list_lock unlock];
[_colorListLock lock];
[_availableColorLists removeObject: self];
[_colorListLock unlock];
// Reset file name
_fullFileName = nil;
@ -562,3 +539,117 @@ static NSLock *_gnustep_color_list_lock = nil;
@end
@implementation NSColorList (GNUstepPrivate)
+ (void) _loadAvailableColorLists: (NSNotification*)aNotification
{
[_colorListLock lock];
/* FIXME ... we should ensure that we get housekeeping notifications */
if (_availableColorLists != nil && aNotification == nil)
{
// Nothing to do ... already loaded
[_colorListLock unlock];
}
else
{
NSString *dir;
NSString *file;
NSEnumerator *e;
NSFileManager *fm = [NSFileManager defaultManager];
NSDirectoryEnumerator *de;
NSColorList *newList;
if (_availableColorLists == nil)
{
// Create the global array of color lists
_availableColorLists = [[NSMutableArray alloc] init];
}
else
{
[_availableColorLists removeAllObjects];
}
/*
* Keep any pre-loaded system color list.
*/
if (themeColorList != nil)
{
[_availableColorLists addObject: themeColorList];
}
/*
* Load color lists found in standard paths into the array
* FIXME: Check exactly where in the directory tree we should scan.
*/
e = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSAllDomainsMask, YES) objectEnumerator];
while ((dir = (NSString *)[e nextObject]))
{
BOOL flag;
dir = [dir stringByAppendingPathComponent: @"Colors"];
if (![fm fileExistsAtPath: dir isDirectory: &flag] || !flag)
{
// Only process existing directories
continue;
}
de = [fm enumeratorAtPath: dir];
while ((file = [de nextObject]))
{
if ([[file pathExtension] isEqualToString: @"clr"])
{
NSString *name;
name = [file stringByDeletingPathExtension];
newList = [[NSColorList alloc] initWithName: name
fromFile: [dir stringByAppendingPathComponent: file]];
[_availableColorLists addObject: newList];
RELEASE(newList);
}
}
}
if (defaultSystemColorList != nil)
{
[_availableColorLists addObject: defaultSystemColorList];
}
[_colorListLock unlock];
}
}
+ (void) _setDefaultSystemColorList: (NSColorList*)aList
{
[_colorListLock lock];
if (defaultSystemColorList != aList)
{
if (defaultSystemColorList != nil
&& [_availableColorLists lastObject] == defaultSystemColorList)
{
[_availableColorLists removeLastObject];
}
ASSIGN(defaultSystemColorList, aList);
[_availableColorLists addObject: aList];
}
[_colorListLock unlock];
}
+ (void) _setThemeSystemColorList: (NSColorList*)aList
{
[_colorListLock lock];
if (themeColorList != aList)
{
if (themeColorList != nil && [_availableColorLists count] > 0
&& [_availableColorLists objectAtIndex: 0] == themeColorList)
{
[_availableColorLists removeObjectAtIndex: 0];
}
ASSIGN(themeColorList, aList);
[_availableColorLists insertObject: aList atIndex: 0];
}
[_colorListLock unlock];
}
@end

View file

@ -37,7 +37,7 @@
#include "AppKit/NSGraphics.h"
#include "AppKit/NSPasteboard.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
#include <Foundation/NSDebug.h>
#include <Foundation/NSNotification.h>
@ -176,7 +176,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
/*
* Draw border.
*/
[GSDrawFunctions drawButton: aRect : clipRect];
[[GSTheme theme] drawButton: aRect withClip: clipRect];
/*
* Fill in control color.
@ -213,7 +213,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
/*
* Draw inner frame.
*/
[GSDrawFunctions drawGrayBezel: aRect : clipRect];
[[GSTheme theme] drawGrayBezel: aRect withClip: clipRect];
aRect = NSInsetRect(aRect, 2.0, 2.0);
}

View file

@ -50,7 +50,7 @@
#include "AppKit/NSTableColumn.h"
#include "AppKit/NSTableView.h"
#include "AppKit/NSTextView.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
static NSNotificationCenter *nc;
static const BOOL ForceBrowser = NO;

View file

@ -726,16 +726,15 @@ static Class actionCellClass;
return [[self selectedCell] acceptsFirstResponder];
}
/** <p>This method is invoked when the user click into the NSControl.</p>
*
*/
- (void) mouseDown: (NSEvent *)theEvent
{
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask
| NSMouseMovedMask | NSLeftMouseDraggedMask | NSOtherMouseDraggedMask
| NSRightMouseDraggedMask;
BOOL mouseUp = NO;
int oldActionMask = 0;
NSEvent *e = nil;
// If not enabled ignore mouse clicks
if (![self isEnabled])
@ -748,11 +747,15 @@ static Class actionCellClass;
return;
}
// stop cell from sending action while tracking the mouse...
oldActionMask = [_cell sendActionOn: ([_cell isContinuous]?NSPeriodicMask:0)];
// loop until mouse goes up
e = theEvent;
while (1)
{
NSPoint location = [self convertPoint: [theEvent locationInWindow]
fromView: nil];
NSPoint location = [self convertPoint: [e locationInWindow]
fromView: nil];
// ask the cell to track the mouse only,
// if the mouse is within the cell
@ -762,28 +765,34 @@ static Class actionCellClass;
[_cell setHighlighted: YES];
[self setNeedsDisplay: YES];
done = [_cell trackMouse: theEvent
inRect: _bounds
ofView: self
untilMouseUp: [[_cell class] prefersTrackingUntilMouseUp]];
done = [_cell trackMouse: e
inRect: _bounds
ofView: self
untilMouseUp: [[_cell class] prefersTrackingUntilMouseUp]];
[_cell setHighlighted: NO];
[self setNeedsDisplay: YES];
if (done)
break;
{
mouseUp = YES;
break;
}
}
theEvent = [NSApp nextEventMatchingMask: event_mask
untilDate: nil
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
if ([theEvent type] == NSLeftMouseUp)
e = [NSApp nextEventMatchingMask: event_mask
untilDate: nil
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
if ([e type] == NSLeftMouseUp)
{
mouseUp = YES;
break;
}
}
// allow the cell to send actions again...
[_cell sendActionOn: oldActionMask];
// Mouse went up inside the control but not inside the cell
if (mouseUp)
{

View file

@ -94,12 +94,10 @@
self = [self init];
if (self != nil)
{
if ([self readFromFile: fileName ofType: fileType])
{
[self setFileType: fileType];
[self setFileName: fileName];
}
else
[self setFileType: fileType];
[self setFileName: fileName];
if (![self readFromFile: fileName ofType: fileType])
{
NSRunAlertPanel (_(@"Load failed"),
_(@"Could not load file %@."),

View file

@ -4,6 +4,8 @@
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Gregory Casamento <greg_casamento@yahoo.com>
Date: 2006
Author: Fred Kiefer <FredKiefer@gmx.de>
Date: 2001
@ -29,12 +31,316 @@
#include <Foundation/NSArchiver.h>
#include <Foundation/NSKeyedArchiver.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSException.h>
#include "AppKit/NSWindow.h"
#include "AppKit/NSBox.h"
#include "AppKit/NSView.h"
#include "AppKit/NSDrawer.h"
static NSNotificationCenter *nc = nil;
@interface GSDrawerWindow : NSWindow
{
NSWindow *_parentWindow;
NSWindow *_pendingParentWindow;
NSDrawer *_drawer;
NSBox *_box;
}
- (NSRect) frameFromParentWindowFrame;
// open/close
- (void) openOnEdge;
- (void) closeOnEdge;
- (void) slide;
// window/drawer properties
- (void) setParentWindow: (NSWindow *)window;
- (NSWindow *) parentWindow;
- (void) setPendingParentWindow: (NSWindow *)window;
- (NSWindow *) pendingParentWindow;
- (void) setDrawer: (NSDrawer *)drawer;
- (NSDrawer *) drawer;
// handle notifications...
- (void) handleWindowClose: (NSNotification *)notification;
- (void) handleWindowMiniaturize: (NSNotification *)notification;
- (void) handleWindowMove: (NSNotification *)notification;
@end
@implementation GSDrawerWindow
+ (void) initialize
{
if (self == [GSDrawerWindow class])
{
nc = [NSNotificationCenter defaultCenter];
[self setVersion: 0];
}
}
- (id) initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
screen: (NSScreen*)aScreen
{
self = [super initWithContentRect: contentRect
styleMask: aStyle
backing: bufferingType
defer: flag
screen: aScreen];
if (self != nil)
{
/*
_box = [[NSBox alloc] init];
[_box setTitle: @""];
[_box setTitlePosition: NSNoTitle];
[_box setBorderType: NSBezelBorder];
[_box setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[[super contentView] addSubview: _box];
*/
}
return self;
}
/*
- (void) setContentView: (NSView *)view
{
[_box setContentView: view];
}
- (NSView *) contentView
{
return [_box contentView];
}
*/
- (NSRect) frameFromParentWindowFrame
{
NSRect newFrame = [_parentWindow frame];
float total = [_drawer leadingOffset] + [_drawer trailingOffset];
NSRectEdge edge = [_drawer preferredEdge];
int state = [_drawer state];
BOOL opened = (state == NSDrawerOpenState);
NSSize size = [_drawer maxContentSize];
if (edge == NSMinXEdge) // left
{
newFrame.size.height -= total;
newFrame.origin.y += [_drawer trailingOffset];
newFrame.origin.x -= (opened)?size.width:0;
}
else if (edge == NSMinYEdge) // bottom
{
newFrame.size.width -= total;
newFrame.origin.x += [_drawer leadingOffset];
newFrame.origin.y -= (opened)?size.height:0;
}
else if (edge == NSMaxXEdge) // right
{
newFrame.size.height -= total;
newFrame.origin.y += [_drawer trailingOffset];
newFrame.origin.x += (opened)?size.width:0;
}
else if (edge == NSMaxYEdge) // top
{
newFrame.size.width -= total;
newFrame.origin.x += [_drawer leadingOffset];
newFrame.origin.y += (opened)?size.height:0;
}
return newFrame;
}
- (BOOL) canBecomeKeyWindow
{
return NO;
}
- (BOOL) canBecomeMainWindow
{
return NO;
}
- (void) orderFront: (id)sender
{
NSPoint holdOrigin = [self frame].origin;
NSPoint newOrigin = NSMakePoint(-10000,-10000);
NSRect tempFrame = [self frame];
// order the window under the parent...
tempFrame.origin = newOrigin;
[self setFrame: tempFrame display: NO];
[super orderFront: sender];
[_parentWindow orderWindow: NSWindowAbove relativeTo: [self windowNumber]];
tempFrame.origin = holdOrigin;
[self setFrame: tempFrame display: YES];
}
- (void) openOnEdge
{
[self orderFront: self];
[self slide];
}
- (void) closeOnEdge
{
NSRect frame = [self frameFromParentWindowFrame]; // : [_parentWindow frame]];
// slide the drawer closed....
[self slide];
[self setFrame: frame display: YES];
[self orderOut: self];
if (_pendingParentWindow != nil
&& _pendingParentWindow != _parentWindow)
{
[self setParentWindow: _pendingParentWindow];
ASSIGN(_pendingParentWindow, nil);
}
}
- (void) slide
{
NSRect frame = [self frame];
float i;
NSRectEdge edge = [_drawer preferredEdge];
NSSize size = [_drawer maxContentSize];
float factor = 1.0;
// if it's open, then slide it closed.
if ([_drawer state] == NSDrawerClosingState)
{
factor = -factor;
}
else if ([_drawer state] == NSDrawerOpeningState)
{
factor = 1.0;
}
if (edge == NSMinXEdge) // left
{
// slide left...
for (i = 0; i < size.width; i++)
{
frame.origin.x -= factor;
[self setFrame: frame display: YES];
}
}
else if (edge == NSMinYEdge) // bottom
{
// slide down...
for (i = 0; i < size.height; i++)
{
frame.origin.y -= factor;
[self setFrame: frame display: YES];
}
}
else if (edge == NSMaxXEdge) // right
{
// slide right...
for (i = 0; i < size.width; i++)
{
frame.origin.x += factor;
[self setFrame: frame display: YES];
}
}
else if (edge == NSMaxYEdge) // top
{
// slide up...
for (i = 0; i < size.height; i++)
{
frame.origin.y += factor;
[self setFrame: frame display: YES];
}
}
}
- (void) handleWindowClose: (NSNotification *)notification
{
[self close];
}
- (void) handleWindowMiniaturize: (NSNotification *)notification
{
[self close];
}
- (void) handleWindowMove: (NSNotification *)notification
{
NSRect frame = [self frameFromParentWindowFrame]; // : [obj frame]];
NSLog(@"%@",NSStringFromRect(frame));
[self setFrame: frame display: NO];
}
- (void) setParentWindow: (NSWindow *)window
{
if (_parentWindow != window)
{
ASSIGN(_parentWindow, window);
[nc removeObserver: self];
if (_parentWindow != nil)
{
NSRect frame = [self frameFromParentWindowFrame];
[self setFrame: frame display: YES];
// add observers....
[nc addObserver: self
selector: @selector(handleWindowClose:)
name: NSWindowWillCloseNotification
object: _parentWindow];
[nc addObserver: self
selector: @selector(handleWindowMiniaturize:)
name: NSWindowWillMiniaturizeNotification
object: _parentWindow];
[nc addObserver: self
selector: @selector(handleWindowMove:)
name: NSWindowDidMoveNotification
object: _parentWindow];
[nc addObserver: self
selector: @selector(handleWindowMove:)
name: NSWindowDidResizeNotification
object: _parentWindow];
}
}
}
- (NSWindow *) parentWindow
{
return _parentWindow;
}
- (void) setPendingParentWindow: (NSWindow *)window
{
ASSIGN(_pendingParentWindow, window);
}
- (NSWindow *) pendingParentWindow
{
return _pendingParentWindow;
}
- (void) setDrawer: (NSDrawer *)drawer
{
// don't retain, since the drawer retains us...
_drawer = drawer;
}
- (NSDrawer *) drawer
{
return _drawer;
}
- (void) dealloc
{
RELEASE(_parentWindow);
TEST_RELEASE(_pendingParentWindow);
[super dealloc];
}
@end
@implementation NSDrawer
+ (void) initialize
@ -42,7 +348,7 @@ static NSNotificationCenter *nc = nil;
if (self == [NSDrawer class])
{
nc = [NSNotificationCenter defaultCenter];
[self setVersion: 1];
[self setVersion: 0];
}
}
@ -57,29 +363,35 @@ static NSNotificationCenter *nc = nil;
preferredEdge: (NSRectEdge)edge
{
self = [super init];
// initialize the drawer window...
_drawerWindow = [[GSDrawerWindow alloc]
initWithContentRect: NSMakeRect(0, 0, contentSize.width,
contentSize.height)
styleMask: 0
backing: NSBackingStoreBuffered
defer: NO];
[_drawerWindow setDrawer: self];
[_drawerWindow setReleasedWhenClosed: NO];
_contentView = [[NSView alloc] initWithFrame:
NSMakeRect(0, 0, contentSize.width,
contentSize.height)];
_preferredEdge = edge;
_currentEdge = edge;
_maxContentSize = contentSize;
_minContentSize = contentSize;
_maxContentSize = NSMakeSize(200,200);
_minContentSize = NSMakeSize(50,50);
_state = NSDrawerClosedState;
_leadingOffset = 10.0;
_trailingOffset = 10.0;
return self;
}
- (void) dealloc
{
RELEASE(_contentView);
RELEASE(_drawerWindow);
if (_delegate != nil)
{
[nc removeObserver: _delegate name: nil object: self];
_delegate = nil;
}
[super dealloc];
}
@ -89,16 +401,15 @@ static NSNotificationCenter *nc = nil;
if (_state != NSDrawerOpenState)
return;
if ((_delegate != nil) &&
([_delegate respondsToSelector:
@selector(drawerShouldClose:)]) &&
![_delegate drawerShouldClose: self])
if ((_delegate != nil)
&& ([_delegate respondsToSelector: @selector(drawerShouldClose:)])
&& ![_delegate drawerShouldClose: self])
return;
_state = NSDrawerClosingState;
[nc postNotificationName: NSDrawerWillCloseNotification object: self];
// FIXME Here should be the actual closing code
[_drawerWindow closeOnEdge];
_state = NSDrawerClosedState;
[nc postNotificationName: NSDrawerDidCloseNotification object: self];
@ -121,22 +432,21 @@ static NSNotificationCenter *nc = nil;
- (void) openOnEdge: (NSRectEdge)edge
{
if ((_state != NSDrawerClosedState) ||
(_parentWindow == nil))
if ((_state != NSDrawerClosedState)
|| ([self parentWindow] == nil))
return;
if ((_delegate != nil) &&
([_delegate respondsToSelector:
@selector(drawerShouldOpen:)]) &&
![_delegate drawerShouldOpen: self])
if ((_delegate != nil)
&& ([_delegate respondsToSelector: @selector(drawerShouldOpen:)])
&& ![_delegate drawerShouldOpen: self])
return;
_state = NSDrawerOpeningState;
[nc postNotificationName: NSDrawerWillOpenNotification object: self];
// FIXME Here should be the actual opening code
_currentEdge = edge;
[_drawerWindow openOnEdge];
_state = NSDrawerOpenState;
[nc postNotificationName: NSDrawerDidOpenNotification object: self];
}
@ -153,7 +463,7 @@ static NSNotificationCenter *nc = nil;
// Managing Size
- (NSSize) contentSize
{
return [_contentView frame].size;
return [[_drawerWindow contentView] frame].size;
}
- (float) leadingOffset
@ -184,13 +494,15 @@ static NSNotificationCenter *nc = nil;
size.height = _maxContentSize.height;
// Check with delegate
if ((_delegate != nil) &&
([_delegate respondsToSelector:
@selector(drawerWillResizeContents:toSize:)]))
size = [_delegate drawerWillResizeContents: self
toSize: size];
if ((_delegate != nil)
&& ([_delegate respondsToSelector:
@selector(drawerWillResizeContents:toSize:)]))
{
size = [_delegate drawerWillResizeContents: self
toSize: size];
}
[_contentView setFrameSize: size];
[_drawerWindow setContentSize: size];
}
- (void) setLeadingOffset: (float)offset
@ -237,22 +549,29 @@ static NSNotificationCenter *nc = nil;
// Managing Views
- (NSView *) contentView
{
return _contentView;
return [_drawerWindow contentView];
}
- (NSWindow *) parentWindow
{
return _parentWindow;
return [_drawerWindow parentWindow];
}
- (void) setContentView: (NSView *)aView
{
ASSIGN(_contentView, aView);
[_drawerWindow setContentView: aView];
}
- (void) setParentWindow: (NSWindow *)parent
{
_parentWindow = parent;
if (_state == NSDrawerClosedState)
{
[_drawerWindow setParentWindow: parent];
}
else
{
[_drawerWindow setPendingParentWindow: parent];
}
}
@ -293,26 +612,38 @@ static NSNotificationCenter *nc = nil;
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
id parent = [self parentWindow];
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeSize: _contentSize forKey: @"NSContentSize"];
[aCoder encodeObject: _delegate forKey: @"NSDelegate"];
[aCoder encodeSize: [self contentSize] forKey: @"NSContentSize"];
if (_delegate != nil)
{
[aCoder encodeObject: _delegate forKey: @"NSDelegate"];
}
[aCoder encodeFloat: _leadingOffset forKey: @"NSLeadingOffset"];
[aCoder encodeSize: _maxContentSize forKey: @"NSMaxContentSize"];
[aCoder encodeSize: _minContentSize forKey: @"NSMinContentSize"];
[aCoder encodeObject: _parentWindow forKey: @"NSParentWindow"];
if (parent != nil)
{
[aCoder encodeObject: parent forKey: @"NSParentWindow"];
}
[aCoder encodeInt: _preferredEdge forKey: @"NSPreferredEdge"];
[aCoder encodeFloat: _trailingOffset forKey: @"NSTrailingOffset"];
}
else
{
[aCoder encodeSize: _contentSize];
[aCoder encodeSize: [self contentSize]];
[aCoder encodeObject: _delegate];
[aCoder encodeValueOfObjCType: @encode(float) at: &_leadingOffset];
[aCoder encodeSize: _maxContentSize];
[aCoder encodeSize: _minContentSize];
[aCoder encodeObject: _parentWindow];
[aCoder encodeObject: parent];
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &_preferredEdge];
[aCoder encodeValueOfObjCType: @encode(float) at: &_trailingOffset];
}
@ -320,36 +651,72 @@ static NSNotificationCenter *nc = nil;
- (id) initWithCoder: (NSCoder*)aDecoder
{
if((self = [super initWithCoder: aDecoder]) != nil)
if ((self = [super initWithCoder: aDecoder]) != nil)
{
if([aDecoder allowsKeyedCoding])
NSWindow *parentWindow = nil;
if ([aDecoder allowsKeyedCoding])
{
_contentSize = [aDecoder decodeSizeForKey: @"NSContentSize"];
ASSIGN(_delegate, [aDecoder decodeObjectForKey: @"NSDelegate"]);
if ([aDecoder containsValueForKey: @"NSDelegate"])
{
ASSIGN(_delegate, [aDecoder decodeObjectForKey: @"NSDelegate"]);
}
_leadingOffset = [aDecoder decodeFloatForKey: @"NSLeadingOffset"];
_maxContentSize = [aDecoder decodeSizeForKey: @"NSMaxContentSize"];
_minContentSize = [aDecoder decodeSizeForKey: @"NSMinContentSize"];
ASSIGN(_parentWindow, [aDecoder decodeObjectForKey: @"NSParentWindow"]);
if ([aDecoder containsValueForKey: @"NSParentWindow"])
{
parentWindow = [aDecoder decodeObjectForKey: @"NSParentWindow"];
}
_preferredEdge = [aDecoder decodeIntForKey: @"NSPreferredEdge"];
_trailingOffset = [aDecoder decodeFloatForKey: @"NSTrailingOffset"];
}
else
{
int version = [aDecoder versionForClassName: @"NSDrawer"];
if(version == 0)
if (version == 0)
{
_contentSize = [aDecoder decodeSize];
ASSIGN(_delegate, [aDecoder decodeObject]);
[aDecoder decodeValueOfObjCType: @encode(float) at: &_leadingOffset];
[aDecoder decodeValueOfObjCType: @encode(float)
at: &_leadingOffset];
_maxContentSize = [aDecoder decodeSize];
_minContentSize = [aDecoder decodeSize];
ASSIGN(_parentWindow, [aDecoder decodeObject]);
[aDecoder decodeValueOfObjCType: @encode(unsigned) at: &_preferredEdge];
[aDecoder decodeValueOfObjCType: @encode(float) at: &_trailingOffset];
parentWindow = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(unsigned)
at: &_preferredEdge];
[aDecoder decodeValueOfObjCType: @encode(float)
at: &_trailingOffset];
}
else
{
[NSException raise: NSInternalInconsistencyException
format: @"Invalid version of NSDrawer (version = %d).",
version];
return nil; // not reached, but keeps gcc happy...
}
else
return nil;
}
// set up drawer...
_drawerWindow = [[GSDrawerWindow alloc]
initWithContentRect:
NSMakeRect(0, 0,_contentSize.width,
_contentSize.height)
styleMask: 0
backing: NSBackingStoreBuffered
defer: NO];
[_drawerWindow setParentWindow: parentWindow];
[_drawerWindow setDrawer: self];
[_drawerWindow setReleasedWhenClosed: NO];
// initial state...
_state = NSDrawerClosedState;
}
return self;
}

View file

@ -34,7 +34,7 @@
#include "AppKit/NSFont.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSTextFieldCell.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
static NSColor *shadowCol;
@ -361,7 +361,10 @@ static NSColor *shadowCol;
}
else if (_cell.is_bezeled)
{
NSRect frame = [GSDrawFunctions drawWhiteBezel: borderedFrame : NSZeroRect];
NSRect frame;
frame = [[GSTheme theme] drawWhiteBezel: borderedFrame
withClip: NSZeroRect];
[[NSColor textBackgroundColor] set];
NSRectFill (frame);
}

View file

@ -23,7 +23,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
@ -295,12 +296,12 @@ NSGraphicsContext *GSCurrentContext(void)
return context_info;
}
- (void)flushGraphics
- (void) flushGraphics
{
[self subclassResponsibility: _cmd];
}
- (void *)graphicsPort
- (void *) graphicsPort
{
return NULL;
}

View file

@ -131,7 +131,7 @@
nil) ;
}
else
else
{
helpFile = [self pathForHelpResource: key];
@ -167,22 +167,25 @@
if (help)
{
NSString *file;
NSString *file = nil;
if ([[help pathExtension] length] == 0)
{
file = [mb pathForHelpResource: [help stringByAppendingPathExtension: @"rtfd"]];
file = [mb pathForHelpResource:
[help stringByAppendingPathExtension: @"rtfd"]];
if (file == nil)
{
file = [mb pathForHelpResource: [help stringByAppendingPathExtension: @"rtf"]];
file = [mb pathForHelpResource:
[help stringByAppendingPathExtension: @"rtf"]];
}
}
if (file) {
[[NSWorkspace sharedWorkspace] openFile: file];
return;
}
if (file)
{
[[NSWorkspace sharedWorkspace] openFile: file];
return;
}
}
NSBeep();
@ -304,10 +307,11 @@ static BOOL _gnu_contextHelpActive = NO;
if (contextHelp)
{
GSHelpManagerPanel *helpPanel = [GSHelpManagerPanel sharedHelpManagerPanel];
GSHelpManagerPanel *helpPanel;
// FIXME: We should position the window at point!
// runModalForWindow will centre the window.
helpPanel = [GSHelpManagerPanel sharedHelpManagerPanel];
[helpPanel setHelpText: contextHelp];
[NSApp runModalForWindow: helpPanel];
return YES;

View file

@ -31,7 +31,7 @@
#include "AppKit/NSGraphics.h"
#include "AppKit/NSImageCell.h"
#include "AppKit/NSImage.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
@implementation NSImageCell
@ -134,16 +134,16 @@
// nada
break;
case NSImageFramePhoto:
[GSDrawFunctions drawFramePhoto: cellFrame : NSZeroRect];
[[GSTheme theme] drawFramePhoto: cellFrame withClip: NSZeroRect];
break;
case NSImageFrameGrayBezel:
[GSDrawFunctions drawGrayBezel: cellFrame : NSZeroRect];
[[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect];
break;
case NSImageFrameGroove:
[GSDrawFunctions drawGroove: cellFrame : NSZeroRect];
[[GSTheme theme] drawGroove: cellFrame withClip: NSZeroRect];
break;
case NSImageFrameButton:
[GSDrawFunctions drawButton: cellFrame : NSZeroRect];
[[GSTheme theme] drawButton: cellFrame withClip: NSZeroRect];
break;
}

View file

@ -42,7 +42,7 @@
#include "AppKit/NSMenuItemCell.h"
#include "AppKit/NSMenuView.h"
#include "AppKit/NSParagraphStyle.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
@implementation NSMenuItemCell
@ -446,11 +446,11 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
if (_cell.is_highlighted && (_highlightsByMask & NSPushInCellMask))
{
[GSDrawFunctions drawGrayBezel: cellFrame : NSZeroRect];
[[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect];
}
else
{
[GSDrawFunctions drawButton: cellFrame : NSZeroRect];
[[GSTheme theme] drawButton: cellFrame withClip: NSZeroRect];
}
}
@ -479,7 +479,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
{
cellFrame = [self keyEquivalentRectForBounds: cellFrame];
if ([_menuItem hasSubmenu])
if ([_menuItem hasSubmenu] && arrowImage != nil)
{
NSSize size;
NSPoint position;
@ -710,7 +710,8 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
// pushed in buttons contents are displaced to the bottom right 1px
if (_cell.is_bordered && (mask & NSPushInCellMask))
{
cellFrame = NSOffsetRect(cellFrame, 1., [controlView isFlipped] ? 1. : -1.);
cellFrame
= NSOffsetRect(cellFrame, 1., [controlView isFlipped] ? 1. : -1.);
}
/*

View file

@ -1361,17 +1361,14 @@ static NSImage *unexpandable = nil;
NSTableColumn *tb;
NSRect drawingRect, imageRect;
unsigned length = 0;
id item = nil;
int level = 0;
float indentationFactor = 0.0;
NSImage *image = nil;
NSCell *imageCell = nil;
// We refuse to edit cells if the delegate can not accept results
// of editing.
if (_dataSource_editable == NO)
{
return;
flag = YES;
}
[self scrollRowToVisible: rowIndex];
@ -1404,14 +1401,13 @@ static NSImage *unexpandable = nil;
_editedRow = rowIndex;
_editedColumn = columnIndex;
item = [self itemAtRow: _editedRow];
// Prepare the cell
tb = [_tableColumns objectAtIndex: columnIndex];
// NB: need to be released when no longer used
_editedCell = [[tb dataCellForRow: rowIndex] copy];
[_editedCell setEditable: YES];
[_editedCell setEditable: _dataSource_editable];
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
row: rowIndex]];
@ -1447,29 +1443,32 @@ static NSImage *unexpandable = nil;
_textObject = [_editedCell setUpFieldEditorAttributes: t];
// determine which image to use...
if ([self isItemExpanded: item])
{
image = expanded;
}
else
{
image = collapsed;
}
if (![self isExpandable: item])
{
image = unexpandable;
}
// move the drawing rect over like in the drawRow routine...
drawingRect = [self frameOfCellAtColumn: columnIndex row: rowIndex];
if (tb == [self outlineTableColumn])
{
id item = nil;
NSImage *image = nil;
NSCell *imageCell = nil;
item = [self itemAtRow: _editedRow];
// determine which image to use...
if ([self isItemExpanded: item])
{
image = expanded;
}
else
{
image = collapsed;
}
if (![self isExpandable: item])
{
image = unexpandable;
}
level = [self levelForItem: item];
indentationFactor = _indentationPerLevel * level;
drawingRect.origin.x += indentationFactor + 5 + [image size].width;
drawingRect.size.width -= indentationFactor + 5 + [image size].width;
// create the image cell..
imageCell = [[NSCell alloc] initImageCell: image];
@ -1484,13 +1483,19 @@ static NSImage *unexpandable = nil;
imageRect.origin.y = drawingRect.origin.y;
}
// draw...
imageRect.size.width = [image size].width;
imageRect.size.height = [image size].height;
// draw...
[self lockFocus];
[imageCell drawWithFrame: imageRect inView: self];
[self unlockFocus];
// move the drawing rect over like in the drawRow routine...
drawingRect.origin.x += indentationFactor + 5 + [image size].width;
drawingRect.size.width -= indentationFactor + 5 + [image size].width;
RELEASE(imageCell);
}
if (flag)

View file

@ -27,7 +27,7 @@
#include "AppKit/NSProgressIndicator.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
#include "GNUstepGUI/GSNibCompatibility.h"
@implementation NSProgressIndicator
@ -231,7 +231,7 @@ static NSColor *fillColour = nil;
if (_isBezeled)
{
// Calc the inside rect to be drawn
r = [GSDrawFunctions drawGrayBezel: _bounds :rect];
r = [[GSTheme theme] drawGrayBezel: _bounds withClip: rect];
}
else
r = _bounds;

View file

@ -307,7 +307,12 @@ static NSMutableArray *screenArray = nil;
switch (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil))
{
case NSMacintoshInterfaceStyle:
if ([NSApp mainMenu] != nil)
if ([NSApp mainMenu] == nil)
{
// No menu yet ... assume a standard height
visFrame.size.height -= 23.0;
}
else
{
float menuHeight = [[[NSApp mainMenu] window] frame].size.height;

View file

@ -40,7 +40,7 @@
#include "AppKit/NSTableView.h"
#include "AppKit/NSWindow.h"
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
//
// For nib compatibility, this is used to properly
@ -951,11 +951,11 @@ static float scrollerWidth;
break;
case NSBezelBorder:
[GSDrawFunctions drawGrayBezel: _bounds : rect];
[[GSTheme theme] drawGrayBezel: _bounds : rect];
break;
case NSGrooveBorder:
[GSDrawFunctions drawGroove: _bounds : rect];
[[GSTheme theme] drawGroove: _bounds : rect];
break;
}

View file

@ -36,7 +36,7 @@
#include "AppKit/NSStepperCell.h"
#include "AppKit/NSWindow.h"
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
// Hard coded values for button sizes
#define STEPPER_WIDTH 15
@ -144,7 +144,7 @@ static inline NSRect DrawLightButton(NSRect border, NSRect clip)
{
/*
NSRect highlightRect = NSInsetRect(border, 1., 1.);
[GSDrawFunctions drawButton: border : clip];
[[GSTheme theme] drawButton: border : clip];
return highlightRect;
*/
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,

View file

@ -35,7 +35,7 @@
#include "AppKit/NSTabView.h"
#include "AppKit/NSTabViewItem.h"
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
@implementation NSTabView
@ -365,6 +365,7 @@
- (void) drawRect: (NSRect)rect
{
NSGraphicsContext *ctxt = GSCurrentContext();
GSTheme *theme = [GSTheme theme];
int howMany = [_items count];
int i;
NSRect previousRect = NSMakeRect(0, 0, 0, 0);
@ -378,18 +379,18 @@
default:
case NSTopTabsBezelBorder:
aRect.size.height -= 16;
[GSDrawFunctions drawButton: aRect : NSZeroRect];
[theme drawButton: aRect withClip: NSZeroRect];
break;
case NSBottomTabsBezelBorder:
aRect.size.height -= 16;
aRect.origin.y += 16;
[GSDrawFunctions drawButton: aRect : rect];
[theme drawButton: aRect withClip: rect];
aRect.origin.y -= 16;
break;
case NSNoTabsBezelBorder:
[GSDrawFunctions drawButton: aRect : rect];
[theme drawButton: aRect withClip: rect];
break;
case NSNoTabsLineBorder:

View file

@ -26,7 +26,7 @@
#include "AppKit/NSTableHeaderCell.h"
#include "AppKit/NSColor.h"
#include "AppKit/NSFont.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
@implementation NSTableHeaderCell
{
@ -66,11 +66,11 @@
if (_cell.is_highlighted == YES)
{
[GSDrawFunctions drawButton: cellFrame : cellFrame];
[[GSTheme theme] drawButton: cellFrame withClip: cellFrame];
}
else
{
[GSDrawFunctions drawDarkButton: cellFrame : cellFrame];
[[GSTheme theme] drawDarkButton: cellFrame withClip: cellFrame];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];

View file

@ -59,7 +59,7 @@
#include "AppKit/NSPasteboard.h"
#include "AppKit/NSDragging.h"
#include "AppKit/NSCustomImageRep.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include "GNUstepGUI/GSTheme.h"
#include <math.h>
static NSNotificationCenter *nc = nil;
@ -130,6 +130,9 @@ typedef struct _tableViewFlags
- (void)_setObjectValue: (id)value
forTableColumn: (NSTableColumn *)tb
row: (int)index;
- (BOOL) _isCellEditableColumn: (int) columnIndex
row: (int) rowIndex;
@end
@interface NSTableView (SelectionHelper)
@ -1910,23 +1913,6 @@ static void computeNewSelection
}
}
static inline BOOL
_isCellEditable (id delegate, NSArray *tableColumns,
NSTableView *tableView, int row, int column)
{
{
NSTableColumn *tb;
tb = [tableColumns objectAtIndex: column];
if ([tableView _shouldEditTableColumn: tb
row: row] == NO)
{
return NO;
}
}
return YES;
}
@interface GSTableCornerView : NSView
{}
@end
@ -1942,7 +1928,7 @@ _isCellEditable (id delegate, NSArray *tableColumns,
[[NSColor blackColor] set];
NSRectFill (divide);
rect = [GSDrawFunctions drawDarkButton: rect :aRect];
rect = [[GSTheme theme] drawDarkButton: rect withClip: aRect];
[[NSColor controlShadowColor] set];
NSRectFill (rect);
}
@ -2505,6 +2491,7 @@ _isCellEditable (id delegate, NSArray *tableColumns,
{
return _backgroundColor;
}
- (void) setUsesAlternatingRowBackgroundColors: (BOOL)useAlternatingRowColors
{
// FIXME
@ -3217,7 +3204,7 @@ byExtendingSelection: (BOOL)flag
// of editing.
if (_dataSource_editable == NO)
{
return;
flag = YES;
}
[self scrollRowToVisible: rowIndex];
@ -3256,7 +3243,7 @@ byExtendingSelection: (BOOL)flag
// NB: need to be released when no longer used
_editedCell = [[tb dataCellForRow: rowIndex] copy];
[_editedCell setEditable: YES];
[_editedCell setEditable: _dataSource_editable];
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
row: rowIndex]];
/* [_dataSource tableView: self
@ -3373,6 +3360,13 @@ static inline float computePeriod(NSPoint mouseLocationWin,
return;
}
/* Stop editing if any */
if (_textObject != nil)
{
[self validateEditing];
[self abortEditing];
}
// Determine row and column which were clicked
location = [self convertPoint: initialLocation fromView: nil];
_clickedRow = [self rowAtPoint: location];
@ -3381,17 +3375,13 @@ static inline float computePeriod(NSPoint mouseLocationWin,
if (clickCount == 2)
{
// Double-click event
NSTableColumn *tb;
if ([self isRowSelected: _clickedRow] == NO)
if (![self isRowSelected: _clickedRow])
{
return;
}
tb = [_tableColumns objectAtIndex: _clickedColumn];
if (([tb isEditable] == NO) ||
([self _shouldEditTableColumn: tb
row: _clickedRow] == NO))
if (![self _isCellEditableColumn: _clickedColumn row: _clickedRow ])
{
// Send double-action but don't edit
[self sendAction: _doubleAction to: _target];
@ -5486,7 +5476,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
// First look for cells in the same row
for (j = column + 1; j < _numberOfColumns; j++)
{
if (_isCellEditable (_delegate, _tableColumns, self, row, j) == YES)
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
@ -5500,7 +5490,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
[self selectRow: i byExtendingSelection: NO];
for (j = 0; j < _numberOfColumns; j++)
{
if (_isCellEditable (_delegate, _tableColumns, self, i, j) == YES)
if ([self _isCellEditableColumn: j row: i])
{
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
@ -5509,6 +5499,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
}
return NO;
}
-(BOOL) _editPreviousEditableCellBeforeRow: (int)row
column: (int)column
{
@ -5518,7 +5509,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
// First look for cells in the same row
for (j = column - 1; j > -1; j--)
{
if (_isCellEditable (_delegate, _tableColumns, self, row, j) == YES)
if ([self _isCellEditableColumn: j row: row])
{
[self editColumn: j row: row withEvent: nil select: YES];
return YES;
@ -5532,7 +5523,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
[self selectRow: i byExtendingSelection: NO];
for (j = _numberOfColumns - 1; j > -1; j--)
{
if (_isCellEditable (_delegate, _tableColumns, self, i, j) == YES)
if ([self _isCellEditableColumn: j row: i])
{
[self editColumn: j row: i withEvent: nil select: YES];
return YES;
@ -5541,6 +5532,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
}
return NO;
}
- (void) _autosaveTableColumns
{
if (_autosaveTableColumns && _autosaveName != nil)
@ -6017,13 +6009,27 @@ static inline float computePeriod(NSPoint mouseLocationWin,
row: (int) rowIndex
{
if ([_delegate respondsToSelector:
@selector(tableView:shouldEditTableColumn:row:)])
@selector(tableView:shouldEditTableColumn:row:)])
{
if ([_delegate tableView: self shouldEditTableColumn: tableColumn
row: rowIndex] == NO)
{
return NO;
}
return [_delegate tableView: self shouldEditTableColumn: tableColumn
row: rowIndex] == NO;
}
return YES;
}
- (BOOL) _isCellEditableColumn: (int) columnIndex
row: (int) rowIndex
{
NSTableColumn *tableColumn;
tableColumn = [_tableColumns objectAtIndex: columnIndex];
// If the column is editable, the cell always is
if (![tableColumn isEditable])
{
// otherwise ask the delegate, if any.
return [self _shouldEditTableColumn: tableColumn row: rowIndex];
}
return YES;

View file

@ -338,7 +338,7 @@ static Class textFieldCellClass;
//
- (void) mouseDown: (NSEvent*)theEvent
{
if ([self isSelectable] == NO)
if ([self isSelectable] == NO || [self isEnabled] == NO)
{
[super mouseDown: theEvent];
return;
@ -392,7 +392,7 @@ static Class textFieldCellClass;
- (BOOL) acceptsFirstMouse: (NSEvent *)aEvent
{
return [self isEditable];
return [self isEditable] && [self isEnabled];
}
/** <p>Returns whether the NSTextField accepts to be the first responder.
@ -405,7 +405,7 @@ static Class textFieldCellClass;
// we do not accept first responder if there is already a
// _text_object, else it would make the _text_object resign
// and end editing
return (_text_object == nil) && [self isSelectable];
return (_text_object == nil) && [self isSelectable] && [self isEnabled];
}
- (BOOL) becomeFirstResponder

View file

@ -2289,6 +2289,7 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
NSRect rect;
struct NSWindow_struct *window_t;
aRect = [self convertRect: aRect toView: nil];
window_t = (struct NSWindow_struct *)_window;
rect = [[window_t->_rectsBeingDrawn lastObject] rectValue];
return NSIntersectsRect(rect, aRect);

View file

@ -616,26 +616,6 @@ static NSNotificationCenter *nc = nil;
styleMask: aStyle];
}
+ (NSRect) screenRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
if (!windowDecorator)
windowDecorator = [GSWindowDecorationView windowDecorator];
return [windowDecorator screenRectForFrameRect: aRect
styleMask: aStyle];
}
+ (NSRect) frameRectForScreenRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
if (!windowDecorator)
windowDecorator = [GSWindowDecorationView windowDecorator];
return [windowDecorator frameRectForScreenRect: aRect
styleMask: aStyle];
}
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
styleMask: (unsigned int)aStyle
{
@ -1706,16 +1686,20 @@ many times.
}
}
/*
* Moving and resizing the window
*/
- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint
{
// FIXME: As we know nothing about the other window we can only guess
topLeftPoint.x += 20;
topLeftPoint.y += 20;
NSRect cRect;
if (NSEqualPoints(topLeftPoint, NSZeroPoint) == YES)
{
topLeftPoint.x = _frame.origin.x;
topLeftPoint.y = _frame.origin.y + _frame.size.height;
}
[self setFrameTopLeftPoint: topLeftPoint];
cRect = [isa contentRectForFrameRect: _frame styleMask: _styleMask];
topLeftPoint.x = cRect.origin.x;
topLeftPoint.y = cRect.origin.y + cRect.size.height;
return topLeftPoint;
}
@ -2490,11 +2474,18 @@ resetCursorRectsForView(NSView *theView)
[self _didDeminiaturize: sender];
}
/**
Returns YES, if the document has been changed.
*/
- (BOOL) isDocumentEdited
{
return _f.is_edited;
}
/**
Returns YES, if the window is released when it is closed.
*/
- (BOOL) isReleasedWhenClosed
{
return _f.is_released_when_closed;
@ -2564,6 +2555,11 @@ resetCursorRectsForView(NSView *theView)
object: self];
}
/**
Causes the window to close. Calls the windowShouldClose: method
on the delegate to determine if it should close and calls
shouldCloseWindowController on the controller for the receiver.
*/
- (void) performClose: (id)sender
{
/* Don't close if a modal session is running and we are not the
@ -2620,6 +2616,9 @@ resetCursorRectsForView(NSView *theView)
[self close];
}
/**
Performs the key equivalent represented by theEvent.
*/
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent
{
if (_contentView)
@ -2654,6 +2653,11 @@ resetCursorRectsForView(NSView *theView)
return 0;
}
/**
Set document edit status. If YES, then, if the receiver has a close
button, the close button will show a broken X. If NO, then, if the reciever
has a close button, the close button will show a solid X.
*/
- (void) setDocumentEdited: (BOOL)flag
{
if (_f.is_edited != flag)
@ -2667,6 +2671,9 @@ resetCursorRectsForView(NSView *theView)
}
}
/**
If YES, then the window is released when the close method is called.
*/
- (void) setReleasedWhenClosed: (BOOL)flag
{
_f.is_released_when_closed = flag;
@ -2691,16 +2698,26 @@ resetCursorRectsForView(NSView *theView)
[NSApp discardEventsMatchingMask: mask beforeEvent: lastEvent];
}
/**
Returns the first responder of the window.
*/
- (NSResponder*) firstResponder
{
return _firstResponder;
}
/**
Returns YES, if the window can accept first responder. The default
implementation of this method returns YES.
*/
- (BOOL) acceptsFirstResponder
{
return YES;
}
/**
Makes aResponder the first responder within the receiver.
*/
- (BOOL) makeFirstResponder: (NSResponder*)aResponder
{
if (_firstResponder == aResponder)
@ -2738,6 +2755,9 @@ resetCursorRectsForView(NSView *theView)
return YES;
}
/**
Sets the initial first responder of the receiver.
*/
- (void) setInitialFirstResponder: (NSView*)aView
{
if ([aView isKindOfClass: viewClass])
@ -2746,11 +2766,18 @@ resetCursorRectsForView(NSView *theView)
}
}
/**
returns the initial first responder of the receiver.
*/
- (NSView*) initialFirstResponder
{
return _initialFirstResponder;
}
/**
Processes theEvent when a key is pressed while within
the window.
*/
- (void) keyDown: (NSEvent*)theEvent
{
NSString *characters = [theEvent characters];
@ -4018,17 +4045,25 @@ resetCursorRectsForView(NSView *theView)
[_wv convertRect: rect fromView: nil]];
}
- (NSData *)dataWithPDFInsideRect:(NSRect)aRect
- (NSData *) dataWithPDFInsideRect:(NSRect)aRect
{
return [_wv dataWithPDFInsideRect:
[_wv convertRect: aRect fromView: nil]];
}
/**
Opens the fax panel to allow the user to fax the contents of
the window view.
*/
- (void) fax: (id)sender
{
[_wv fax: sender];
}
/**
Opens the print panel to allow the user to print the contents of
the window view.
*/
- (void) print: (id)sender
{
[_wv print: sender];
@ -4038,12 +4073,18 @@ resetCursorRectsForView(NSView *theView)
* Zooming
*/
/**
Returns yes, if the receiver is zoomed.
*/
- (BOOL) isZoomed
{
// FIXME: Method is missing
return NO;
}
/**
Performs the zoom method on the receiver.
*/
- (void) performZoom: (id)sender
{
// FIXME: We should check for the style and highlight the button
@ -4052,6 +4093,11 @@ resetCursorRectsForView(NSView *theView)
#define DIST 3
/**
Zooms the receiver. This method calls the delegate method
windowShouldZoom:toFrame: to determine if the window should
be allowed to zoom to full screen.
*/
- (void) zoom: (id)sender
{
NSRect maxRect = [[self screen] visibleFrame];
@ -4132,11 +4178,18 @@ resetCursorRectsForView(NSView *theView)
/*
* Assigning a delegate
*/
/**
Returns the delegate.
*/
- (id) delegate
{
return _delegate;
}
/**
Sets the delegate to anObject.
*/
- (void) setDelegate: (id)anObject
{
if (_delegate)
@ -4327,6 +4380,9 @@ resetCursorRectsForView(NSView *theView)
return self;
}
/**
Returns all drawers associated with this window.
*/
- (NSArray *) drawers
{
// TODO

View file

@ -99,12 +99,12 @@ findMisspelledWordInString:(NSString *)stringToCheck
inLanguage:(NSString *)language
{
NSMutableArray *array = [NSMutableArray array];
const char *p = [word UTF8String];
int len = strlen(p);
int words = 0;
#ifdef HAVE_ASPELL_H
{
const char *p = [word UTF8String];
int len = strlen(p);
int words = 0;
const struct AspellWordList *list = aspell_speller_suggest(speller, p, len);
AspellStringEnumeration *en;

View file

@ -5,15 +5,15 @@
GNUSTEP_GUI_GCC=2.9.5
# Versions for libraries that gnustep-gui is dependent upon
GNUSTEP_GUI_BASE=1.11.0
GNUSTEP_GUI_BASE=1.13.0
GNUSTEP_GUI_LIBTIFF=3.4
# The version number of this release.
GNUSTEP_GUI_MAJOR_VERSION=0
GNUSTEP_GUI_MINOR_VERSION=10
GNUSTEP_GUI_SUBMINOR_VERSION=3
GNUSTEP_GUI_MINOR_VERSION=11
GNUSTEP_GUI_SUBMINOR_VERSION=0
# numeric value should match above
VERSION_NUMBER=010.3
VERSION_NUMBER=011.0
GNUSTEP_GUI_VERSION=${GNUSTEP_GUI_MAJOR_VERSION}.${GNUSTEP_GUI_MINOR_VERSION}.${GNUSTEP_GUI_SUBMINOR_VERSION}
VERSION=${GNUSTEP_GUI_VERSION}