diff --git a/ANNOUNCE b/ANNOUNCE
index 0c2fc4686..6d5d70b3d 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -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
diff --git a/ChangeLog b/ChangeLog
index 0e2236535..3f56daf04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,724 @@
-2006-05-20 [themes] Nicolas Roard
-
- * merged with trunk from revision 22954:22963 (nib changes)
-
-2006-05-20 [thenes] Nicolas Roard
+2006-09-22 Richard Frith-Macdonald
* 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
+2006-09-22 Richard Frith-Macdonald
- * 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
+
+ * Source/NSTextFieldCell.m (-setEnabled:): Revert previous patch.
+
+2006-09-20 Matt Rice
+
+ * 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
+
+ * 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
+
+ * Source/NSDocument.m (-initWithContentsOfFile:ofType:): Set the
+ file name and type before attempting to read the document.
+
+2006-09-17 Fred Kiefer
+
+ * Source/NSTableView.m (-_isCellEditableColumn:row:): Correced
+ error in last patch, pointed out by David Ayers .
+
+2006-09-17 Fred Kiefer
+
+ * Images/GSSearch.tiff,
+ * Images/GSStop.tiff: New icons for the NSSearchButtonCell by
+ Nikolaus Schaller .
+
+2006-09-17 Fred Kiefer
+
+ * 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 .
+ * 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
+
+ * Source/NSColor.m: Fix memory leak (bug #17769)
+
+2006-09-13 00:28-EDT Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Documentation/ReleaseNotes.gsdoc: Updates.
+
+2006-08-28 00:00-EDT Gregory John Casamento
+
+ * Version 0.11.0
+
+2006-08-26 22:30-EDT Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Source/NSBrowser.m: Added comment in encodeWithCoder:.
+
+2006-08-19 10:33-EDT Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * Source/NSTabView.m: Corrections in initWithCoder: and
+ encodeWithCoder: to properly encode items and tabview orientation.
+
+2006-08-15 01:02-EDT Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Source/NSMenu.m: encodeWithCoder: encode items and title of
+ menu.
+
+2006-08-05 08:43-EDT Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Headers/AppKit/NSHelpManager.h:
+ * Source/NSHelpManager.m:
+ added -setContextHelp:forObject: as specified in Apple docs;
+ -setContextHelp:withObject: deprecated.
+
+2006-07-16 Enrico Sersale
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Source/NSSplitView.m: Keyed encoding changes in initWithCoder:
+
+2006-07-09 10:50 Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Source/GSNibCompatibility.m: Added NSDecimalNumberPlaceholder
+ class implementation to decode NSDecimalNumber instances in
+ nib files.
+
+2006-06-25 00:26 Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
+ NSIBHelpConnector declaration.
+ * Source/GSNibCompatibility.m: Added skeleton implementation of
+ NSIBHelpConnector.
+
+2006-06-17 20:39 Gregory John Casamento
+
+ * Source/GSNibCompatibility.m: Resize window to window rect
+ size in nibInstantiate.
+
+2006-06-17 10:52 Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * Source/NSTextView_actions.m (-deleteToEndOfLine:): New method
+ based on patch by Andreas Höschler .
+ * KeyBindings/DefaultKeyBindings.dict: Enable Control-k.
+
+2006-06-09 Fred Kiefer
+
+ * 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 .
+
+2006-06-08 00:00 Gregory John Casamento
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * 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
+
+ * Source/NSDocument.m: Implemented accessory view logic when
+ the document can save more than one filetype.
+
+2006-05-29 Richard Frith-Macdonald
+
+ * 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
+
+ * 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
+
+ * 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 .
+
+2006-05-23 Fred Kiefer
+
+ * 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 .
2006-05-20 18:25 Gregory John Casamento
diff --git a/Documentation/GNUmakefile b/Documentation/GNUmakefile
index 19a12068f..a2ebc2013 100644
--- a/Documentation/GNUmakefile
+++ b/Documentation/GNUmakefile
@@ -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)
diff --git a/Documentation/General/GNUmakefile b/Documentation/General/GNUmakefile
index 136f6d225..7907ba5c0 100644
--- a/Documentation/General/GNUmakefile
+++ b/Documentation/General/GNUmakefile
@@ -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
diff --git a/Documentation/GuiAdditions.gsdoc b/Documentation/GuiAdditions.gsdoc
index d90808ecf..cd8413be7 100644
--- a/Documentation/GuiAdditions.gsdoc
+++ b/Documentation/GuiAdditions.gsdoc
@@ -25,6 +25,7 @@
- GSDisplayServer
+ - GSTheme
- GSHbox
- GSTable
- GSVbox
diff --git a/Documentation/GuiUser/DefaultsSummary.gsdoc b/Documentation/GuiUser/DefaultsSummary.gsdoc
index dc12b335d..e375cc78a 100644
--- a/Documentation/GuiUser/DefaultsSummary.gsdoc
+++ b/Documentation/GuiUser/DefaultsSummary.gsdoc
@@ -215,7 +215,11 @@
An interface style specific to menu operation. If not set
- the NSInterfaceStyleDefault value is used.
+ the NSInterfaceStyleDefault value is used.
+ Setting this to NSMacintoshInterfaceStyle produces a horizontal
+ menu at the top of the screen.
+ Setting it to NSNextStepInterfaceStyle reverts to the defaults
+ vertical menu layout.
NSCommandKeys
@@ -282,6 +286,15 @@
directory. This color list can also be manipulated through the
NSColorList class (typically through a preferences module).
+
+ 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).
+ eg.
+ 'defaults write NSGlobalDomain controlBackgroundColor "1.0 0.0 0.0"'
+
+
System Fonts
diff --git a/Documentation/ReleaseNotes.gsdoc b/Documentation/ReleaseNotes.gsdoc
index 71e8c84ae..1db2371e3 100644
--- a/Documentation/ReleaseNotes.gsdoc
+++ b/Documentation/ReleaseNotes.gsdoc
@@ -19,6 +19,29 @@
changes and other information that might help developers and users
migrate to using a newer version of the library.
+
+ Version 0.11.0
+
+ Keyed Encoding/Archiving
+
+ Support for keyed encoding has been added to all gui classes.
+
+ Nib loading
+
+ Nib loading has been implemented. For the most part, nibs
+ are (or should be) compatible between GNUstep and Mac OS X.
+
+ Color schemes and Themes
+
+ Better support for color schemes and themes has been added. In
+ the near future theming should be integrated into gui itself.
+
+ RTFD
+
+ Loading and writting of RTFD format was implemented.
+
+
+
Version 0.10.3
diff --git a/Documentation/news.texi b/Documentation/news.texi
index 4715a4349..9cd9369a1 100644
--- a/Documentation/news.texi
+++ b/Documentation/news.texi
@@ -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
diff --git a/Headers/Additions/GNUstepGUI/GSDisplayServer.h b/Headers/Additions/GNUstepGUI/GSDisplayServer.h
index 102d2da55..b6421c546 100644
--- a/Headers/Additions/GNUstepGUI/GSDisplayServer.h
+++ b/Headers/Additions/GNUstepGUI/GSDisplayServer.h
@@ -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
diff --git a/Headers/Additions/GNUstepGUI/GSDrawFunctions.h b/Headers/Additions/GNUstepGUI/GSDrawFunctions.h
deleted file mode 100644
index 106ae7aec..000000000
--- a/Headers/Additions/GNUstepGUI/GSDrawFunctions.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/** GSDrawFunctions
-
- Useful/configurable drawing functions
-
- Copyright (C) 2004 Free Software Foundation, Inc.
-
- Author: Adam Fedor
- 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
-// 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 */
diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h
new file mode 100644
index 000000000..5971ed615
--- /dev/null
+++ b/Headers/Additions/GNUstepGUI/GSTheme.h
@@ -0,0 +1,283 @@
+/** GSTheme
+
+ Useful/configurable drawing functions
+
+ Copyright (C) 2004-2006 Free Software Foundation, Inc.
+
+ Author: Adam Fedor
+ Author: Richard Frith-Macdonald
+ 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
+// 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;
+
+
+/**
+ This interface is HIGHLY unstable
+ and incomplete at present.
+
+
+ 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).
+
+
+ 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.
+
+
+ The default implementation uses the standard configurable colors
+ defined in NSColor, such as controlLightHighlightColor
,
+ controlShadowColor
and controlDarkShadowColor
.
+ 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.
+
+
+ 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).
+
+
+ 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.
+
+*/
+@interface GSTheme : NSObject
+{
+@private
+ NSBundle *_bundle;
+ NSMutableArray *_images;
+ NSMutableDictionary *_tiles;
+}
+
+/**
+ * Set the currently active theme to be the instance specified.
+ * 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;
+
+/**
+ * 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.
+ *
+ * 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.
+ * If the theme sets an alternative system color list, the notification
+ * userInfo dictionary will contain that list keyed on Colors.
+ *
+ */
+- (void) activate;
+
+/**
+ * Return the bundle containing the resources used by the current theme.
+ */
+- (NSBundle*) bundle;
+
+/**
+ * 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.
+ *
+ * The base implementation handles some cleanup and then sends a
+ * GSThemeDidDeactivateNotification to allow other parts of the GUI library
+ * to update themselves.
+ *
+ */
+- (void) deactivate;
+
+/**
+ * Initialise an instance of a theme with the specified resource bundle.
+ * 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.
+ * 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.
+ * 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.
+ * 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.
+ * 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 */
diff --git a/Headers/AppKit/AppKit.h b/Headers/AppKit/AppKit.h
index 961470fce..d761ed69e 100644
--- a/Headers/AppKit/AppKit.h
+++ b/Headers/AppKit/AppKit.h
@@ -43,10 +43,8 @@
#include
#include
-#include
#include
#include
-#include
#include
#include
#include
@@ -62,16 +60,12 @@
#include
#include
#include
-#include
-#include
#include
#include
#include
#include
#include
#include
-#include
-#include
#include
#include
#include
@@ -80,13 +74,11 @@
#include
#include
#include
-#include
#include
#include
#include
#include
#include
-#include
#include
#include
#include
@@ -94,10 +86,8 @@
#include
#include
#include
-#include
#include
#include
-#include
#include
#include
#include
@@ -105,54 +95,74 @@
#include
#include
#include
-#include
#include
#include
#include
#include
#include
-#include
#include
#include
#include
-#include
#include
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifndef STRICT_OPENSTEP
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include
#include
-#include
#include
#include
#include
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#ifndef STRICT_OPENSTEP
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
#include
#include
+#include
+#include
+#include
#include
#include
#include
-#include
-#include
#endif
#include
diff --git a/Headers/AppKit/NSDocument.h b/Headers/AppKit/NSDocument.h
index 165bda9fc..a21bdc935 100644
--- a/Headers/AppKit/NSDocument.h
+++ b/Headers/AppKit/NSDocument.h
@@ -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;
diff --git a/Headers/AppKit/NSDocumentFrameworkPrivate.h b/Headers/AppKit/NSDocumentFrameworkPrivate.h
index a724fa7dc..2ce0ebf31 100644
--- a/Headers/AppKit/NSDocumentFrameworkPrivate.h
+++ b/Headers/AppKit/NSDocumentFrameworkPrivate.h
@@ -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
diff --git a/Headers/AppKit/NSDrawer.h b/Headers/AppKit/NSDrawer.h
index 4a2c06e01..ad050f3f9 100644
--- a/Headers/AppKit/NSDrawer.h
+++ b/Headers/AppKit/NSDrawer.h
@@ -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;
diff --git a/Headers/AppKit/NSHelpManager.h b/Headers/AppKit/NSHelpManager.h
index 51d9a2f85..cca9110d5 100644
--- a/Headers/AppKit/NSHelpManager.h
+++ b/Headers/AppKit/NSHelpManager.h
@@ -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;
diff --git a/Headers/AppKit/NSStepper.h b/Headers/AppKit/NSStepper.h
index fcc384258..8b41d195f 100644
--- a/Headers/AppKit/NSStepper.h
+++ b/Headers/AppKit/NSStepper.h
@@ -31,8 +31,6 @@
#include
-@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
diff --git a/Headers/AppKit/NSStepperCell.h b/Headers/AppKit/NSStepperCell.h
index 0c53e821b..c8d584a6f 100644
--- a/Headers/AppKit/NSStepperCell.h
+++ b/Headers/AppKit/NSStepperCell.h
@@ -29,8 +29,7 @@
#include
-
-@interface NSStepperCell : NSActionCell
+@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
diff --git a/Headers/AppKit/NSWindow.h b/Headers/AppKit/NSWindow.h
index c2323e1c8..123bcb637 100644
--- a/Headers/AppKit/NSWindow.h
+++ b/Headers/AppKit/NSWindow.h
@@ -101,38 +101,44 @@ typedef enum _NSSelectionDirection {
APPKIT_EXPORT NSSize NSIconSize;
APPKIT_EXPORT NSSize NSTokenSize;
+/**
+ * An NSWindow instance represents a window, panel or menu on the
+ * screen.
+ * 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.
+ *
+ * A window has a frame. This is the frame of the entire
+ * 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]).
+ *
+ * When a window is created, it has a private [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).
+ * 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.
+ *
+ * A window always contains a content view which is the highest
+ * level view available for public (application) use. This view fills the
+ * area of the window inside any decoration/border.
+ * This is the only part of the window that application programmers are
+ * allowed to draw in directly.
+ *
+ * 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.
+ * You can convert between window and screen coordinates using the
+ * -convertBaseToScreen: and -convertScreenToBase: methods.
+ *
+ */
@interface NSWindow : NSResponder
{
- /*
- 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.
+ * 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.
+ * 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.
+ * 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;
+
+/**
+ * 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.
+ *
+ * The size of the frame is constrained to the minimum and maximum
+ * sizes set for the receiver (if any).
+ * Its position is constrained to be on screen if it is a titled window.
+ *
+ */
- (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).
+ * 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
/*
diff --git a/Images/GSSearch.tiff b/Images/GSSearch.tiff
new file mode 100644
index 000000000..8a49d7a7c
Binary files /dev/null and b/Images/GSSearch.tiff differ
diff --git a/Images/GSStop.tiff b/Images/GSStop.tiff
new file mode 100644
index 000000000..468c7d10b
Binary files /dev/null and b/Images/GSStop.tiff differ
diff --git a/Images/common_Printer.tiff b/Images/common_Printer.tiff
index 8e0b99a56..6637ba328 100644
Binary files a/Images/common_Printer.tiff and b/Images/common_Printer.tiff differ
diff --git a/KeyBindings/DefaultKeyBindings.dict b/KeyBindings/DefaultKeyBindings.dict
index 598ee4592..caed2e176 100644
--- a/KeyBindings/DefaultKeyBindings.dict
+++ b/KeyBindings/DefaultKeyBindings.dict
@@ -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:";
diff --git a/Model/GMArchiver.m b/Model/GMArchiver.m
index acfb1f775..0ab7a4326 100644
--- a/Model/GMArchiver.m
+++ b/Model/GMArchiver.m
@@ -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;
}
diff --git a/Model/IMConnectors.m b/Model/IMConnectors.m
index 836c77d88..b1445e599 100644
--- a/Model/IMConnectors.m
+++ b/Model/IMConnectors.m
@@ -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
diff --git a/NEWS b/NEWS
index e0454cb3e..883b7d537 100644
--- a/NEWS
+++ b/NEWS
@@ -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 and many others.
been written, thanks to Richard Frith-Macdonald
-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
diff --git a/Source/DocMakefile b/Source/DocMakefile
index e99603f82..387970895 100644
--- a/Source/DocMakefile
+++ b/Source/DocMakefile
@@ -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 \
diff --git a/Source/GNUmakefile b/Source/GNUmakefile
index 5c595f03f..5e917ef73 100644
--- a/Source/GNUmakefile
+++ b/Source/GNUmakefile
@@ -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 \
diff --git a/Source/GSDisplayServer.m b/Source/GSDisplayServer.m
index 466f7f534..84a452316 100644
--- a/Source/GSDisplayServer.m
+++ b/Source/GSDisplayServer.m
@@ -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
@@ -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.
- 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.
+ If -handlesWindowDecorations returns YES, the backend will produce
+ (and return the identifier of) a smaller drawable window inside this
+ decorated area.
+ 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.
+ * 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.
+ * 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.
+ * 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.
+ * 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.
+ * 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.
+ * If a matching event is found, it is returned and either removed from or
+ * left in the queue according to flag.
+ * 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)
diff --git a/Source/GSDrawFunctions.m b/Source/GSDrawFunctions.m
deleted file mode 100644
index a015881f0..000000000
--- a/Source/GSDrawFunctions.m
+++ /dev/null
@@ -1,450 +0,0 @@
-/** GSDrawFunctions
-
- Useful/configurable drawing functions
-
- Copyright (C) 2004 Free Software Foundation, Inc.
-
- Author: Adam Fedor
- 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"
-
-
-/**
-
- Class Description
-
- 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).
-
-
- The default implementation uses the standard configurable colors defined in
- NSColor, such as controlLightHighlightColor
,
- controlShadowColor
and controlDarkShadowColor
.
-
-
-*/
-@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
diff --git a/Source/GSNibCompatibility.m b/Source/GSNibCompatibility.m
index bb5862255..63813e405 100644
--- a/Source/GSNibCompatibility.m
+++ b/Source/GSNibCompatibility.m
@@ -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)
diff --git a/Source/GSStandardWindowDecorationView.m b/Source/GSStandardWindowDecorationView.m
index 7c7ebf4f7..8800d9ea7 100644
--- a/Source/GSStandardWindowDecorationView.m
+++ b/Source/GSStandardWindowDecorationView.m
@@ -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];
diff --git a/Source/GSTheme.m b/Source/GSTheme.m
new file mode 100644
index 000000000..461a0cf42
--- /dev/null
+++ b/Source/GSTheme.m
@@ -0,0 +1,1028 @@
+/** GSTheme
+
+ Useful/configurable drawing functions
+
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ Author: Adam Fedor
+ 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 "Foundation/NSBundle.h"
+#include "Foundation/NSDictionary.h"
+#include "Foundation/NSFileManager.h"
+#include "Foundation/NSNotification.h"
+#include "Foundation/NSNull.h"
+#include "Foundation/NSPathUtilities.h"
+#include "Foundation/NSUserDefaults.h"
+#include "GNUstepGUI/GSTheme.h"
+#include "AppKit/NSColor.h"
+#include "AppKit/NSColorList.h"
+#include "AppKit/NSGraphics.h"
+#include "AppKit/NSImage.h"
+#include "AppKit/NSView.h"
+#include "AppKit/NSBezierPath.h"
+#include "AppKit/PSOperators.h"
+
+NSString *GSThemeDidActivateNotification
+ = @"GSThemeDidActivateNotification";
+NSString *GSThemeDidDeactivateNotification
+ = @"GSThemeDidDeactivateNotification";
+
+/** These are the nine types of tile used to draw a rectangular object.
+ */
+typedef enum {
+ TileTL = 0, /** Top left corner */
+ TileTM = 1, /** Top middle section */
+ TileTR = 2, /** Top right corner */
+ TileCL = 3, /** Centerj left corner */
+ TileCM = 4, /** Centerj middle section */
+ TileCR = 5, /** Centerj right corner */
+ TileBL = 6, /** Bottom left corner */
+ TileBM = 7, /** Bottom middle section */
+ TileBR = 8 /** Bottom right corner */
+} GSThemeTileOffset;
+
+/** This is a trivial class to hold the nine tiles needed to draw a rectangle
+ */
+@interface GSDrawTiles : NSObject
+{
+@public
+ NSImage *images[9]; /** The tile images */
+ NSRect rects[9]; /** The rectangles to use when drawing */
+}
+- (id) initWithImage: (NSImage*)image;
+@end
+
+@implementation GSDrawTiles
+- (void) dealloc
+{
+ unsigned i;
+
+ for (i = 0; i < 9; i++)
+ {
+ RELEASE(images[i]);
+ }
+ [super dealloc];
+}
+
+/**
+ * Simple initialiser, assume the single image is split into nine equal tiles.
+ * If the image size is not divisible by three, the corners are made equal
+ * in size and the central parts slightly smaller.
+ */
+- (id) initWithImage: (NSImage*)image
+{
+ unsigned i;
+ unsigned j;
+ NSSize s = [image size];
+
+ for (i = 0; i < 9; i++)
+ {
+ images[i] = RETAIN(image);
+ }
+ i = s.width / 3;
+ j = s.height / 3;
+ rects[TileTL] = NSMakeRect(0.0, s.height - j, i, j);
+ rects[TileTM] = NSMakeRect(i, s.height - j, s.width - 2 * i, j);
+ rects[TileTR] = NSMakeRect(s.width - i, s.height - j, i, j);
+ rects[TileCL] = NSMakeRect(0.0, j, i, s.height - 2 * j);
+ rects[TileCM] = NSMakeRect(i, j, s.width - 2 * i, s.height - 2 * j);
+ rects[TileCR] = NSMakeRect(s.width - i, j, i, s.height - 2 * j);
+ rects[TileBL] = NSMakeRect(0.0, 0.0, i, j);
+ rects[TileBM] = NSMakeRect(i, 0.0, s.width - 2 * i, j);
+ rects[TileBR] = NSMakeRect(s.width - i, 0.0, i, j);
+ return self;
+}
+@end
+
+@interface GSTheme (internal)
+/**
+ * Called whenever user defaults are changed ... this checks for the
+ * GSTheme user default and ensures that the specified theme is the
+ * current active theme.
+ */
++ (void) defaultsDidChange: (NSNotification*)n;
+
+/**
+ * Called to load and make active the specified theme.
+ * If aName is nil or an empty string, this reverts to the default theme.
+ * If the named theme is already active, this has no effect.
+ * Returns YES on success, NO if the theme could not be loaded.
+ */
++ (BOOL) loadThemeNamed: (NSString*)aName;
+@end
+
+
+@implementation GSTheme
+
+static GSTheme *defaultTheme = nil;
+static GSTheme *theTheme = nil;
+static NSString *theThemeName = nil;
+static NSMutableDictionary *themes = nil;
+static NSNull *null = nil;
+
++ (void) defaultsDidChange: (NSNotification*)n
+{
+ NSUserDefaults *defs;
+ NSString *name;
+
+ defs = [NSUserDefaults standardUserDefaults];
+ name = [defs stringForKey: @"GSTheme"];
+ if (name != theThemeName && [name isEqual: theThemeName] == NO)
+ {
+ [self loadThemeNamed: name];
+ }
+}
+
++ (void) initialize
+{
+ if (themes == nil)
+ {
+ themes = [NSMutableDictionary new];
+ [self theme]; // Initialise/create the default theme
+ [[NSNotificationCenter defaultCenter]
+ addObserver: self
+ selector: @selector(defaultsDidChange:)
+ name: NSUserDefaultsDidChangeNotification
+ object: nil];
+ }
+ if (null == nil)
+ {
+ null = RETAIN([NSNull null]);
+ }
+ if (defaultTheme == nil)
+ {
+ NSBundle *aBundle = [NSBundle bundleForClass: self];
+
+ defaultTheme = [[self alloc] initWithBundle: aBundle];
+ ASSIGN(theTheme, defaultTheme);
+ }
+}
+
++ (BOOL) loadThemeNamed: (NSString*)aName
+{
+ NSBundle *bundle;
+ Class cls;
+ GSTheme *instance;
+ NSString *theme;
+
+ if ([aName length] == 0)
+ {
+ [self setTheme: nil];
+ [self theme];
+ return YES;
+ }
+
+ /* Ensure that the theme name does not contain path components
+ * and has the 'theme' extension.
+ */
+ aName = [aName lastPathComponent];
+ if ([[aName pathExtension] isEqualToString: @"theme"] == YES)
+ {
+ theme = aName;
+ }
+ else
+ {
+ theme = [aName stringByAppendingPathExtension: @"theme"];
+ }
+
+ bundle = [themes objectForKey: theme];
+ if (bundle == nil)
+ {
+ NSString *path;
+ NSEnumerator *enumerator;
+ NSFileManager *mgr = [NSFileManager defaultManager];
+
+ enumerator = [NSSearchPathForDirectoriesInDomains
+ (NSAllLibrariesDirectory, NSAllDomainsMask, YES) objectEnumerator];
+ while ((path = [enumerator nextObject]) != nil)
+ {
+ BOOL isDir;
+
+ path = [path stringByAppendingPathComponent: @"Themes"];
+ path = [path stringByAppendingPathComponent: theme];
+ if ([mgr fileExistsAtPath: path isDirectory: &isDir])
+ {
+ break;
+ }
+ }
+
+ if (path == nil)
+ {
+ NSLog (@"No theme named '%@' found", aName);
+ return NO;
+ }
+ else
+ {
+ bundle = [NSBundle bundleWithPath: path];
+ [themes setObject: bundle forKey: theme];
+ [bundle load]; // Ensure code is loaded.
+ }
+ }
+
+ cls = [bundle principalClass];
+ if (cls == 0)
+ {
+ cls = self;
+ }
+ instance = [[cls alloc] initWithBundle: bundle];
+ [self setTheme: instance];
+ RELEASE(instance);
+ return YES;
+}
+
++ (void) setTheme: (GSTheme*)theme
+{
+ if (theme == nil)
+ {
+ theme = defaultTheme;
+ }
+ if (theme != theTheme)
+ {
+ [theTheme deactivate];
+ ASSIGN (theTheme, theme);
+ [theTheme activate];
+ }
+}
+
++ (GSTheme*) theme
+{
+ return theTheme;
+}
+
+
+- (void) activate
+{
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
+ NSArray *imagePaths;
+ NSEnumerator *enumerator;
+ NSString *imagePath;
+ NSString *colorsPath;
+
+ colorsPath = [_bundle pathForResource: @"ThemeColors" ofType: @"clr"];
+ if (colorsPath != nil)
+ {
+ NSColorList *list = nil;
+
+ list = [[NSColorList alloc] initWithName: @"System"
+ fromFile: colorsPath];
+ if (list != nil)
+ {
+ [userInfo setObject: list forKey: @"Colors"];
+ RELEASE(list);
+ }
+ }
+
+ /*
+ * We step through all the bundle image resources and load them in
+ * to memory, setting their names so that they are visible to
+ * [NSImage+imageNamed:] and storing them in our local array.
+ */
+ imagePaths = [_bundle pathsForResourcesOfType: nil
+ inDirectory: @"ThemeImages"];
+ enumerator = [imagePaths objectEnumerator];
+ while ((imagePath = [enumerator nextObject]) != nil)
+ {
+ NSImage *image;
+
+ image = [[NSImage alloc] initWithContentsOfFile: imagePath];
+ if (image != nil)
+ {
+ NSString *imageName;
+
+ imageName = [imagePath lastPathComponent];
+ imageName = [imageName stringByDeletingPathExtension];
+ [_images addObject: image];
+ [image setName: imageName];
+ RELEASE(image);
+ }
+ }
+
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName: GSThemeDidActivateNotification
+ object: self
+ userInfo: userInfo];
+}
+
+- (NSBundle*) bundle
+{
+ return _bundle;
+}
+
+- (void) deactivate
+{
+ NSEnumerator *enumerator;
+ NSImage *image;
+
+ /*
+ * Remove all cached bundle images from both NSImage's name dictionary
+ * and our cache array.
+ */
+ enumerator = [_images objectEnumerator];
+ while ((image = [enumerator nextObject]) != nil)
+ {
+ [image setName: nil];
+ }
+ [_images removeAllObjects];
+
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName: GSThemeDidDeactivateNotification
+ object: self
+ userInfo: nil];
+
+}
+
+- (void) dealloc
+{
+ RELEASE(_bundle);
+ RELEASE(_images);
+ RELEASE(_tiles);
+ [super dealloc];
+}
+
+- (id) initWithBundle: (NSBundle*)bundle
+{
+ ASSIGN(_bundle, bundle);
+ _images = [NSMutableArray new];
+ _tiles = [NSMutableDictionary new];
+ return self;
+}
+
+- (GSDrawTiles*) tilesNamed: (NSString*)aName
+{
+ GSDrawTiles *tiles = [_tiles objectForKey: aName];
+
+ if (tiles == nil)
+ {
+ NSImage *image = [NSImage imageNamed: aName];
+
+ if (image != nil)
+ {
+ tiles = [[GSDrawTiles alloc] initWithImage: image];
+ }
+ else
+ {
+ tiles = RETAIN(null);
+ }
+ [_tiles setObject: tiles forKey: aName];
+ RELEASE(_tiles);
+ }
+ if (tiles == (id)null)
+ {
+ tiles = nil;
+ }
+ return tiles;
+}
+
+@end
+
+
+@implementation GSTheme (Drawing)
+
+- (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 controlBackgroundColor] set];
+ NSRectFill(frame);
+ [self drawButton: frame withClip: NSZeroRect];
+ }
+ else if (state == 1) /* highlighted state */
+ {
+ [[NSColor selectedControlColor] set];
+ NSRectFill(frame);
+ [self drawGrayBezel: frame withClip: NSZeroRect];
+ }
+ else if (state == 2) /* pushed state */
+ {
+ [[NSColor selectedControlColor] set];
+ NSRectFill(frame);
+ [self drawGrayBezel: frame withClip: 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;
+
+ c = [[view window] backgroundColor];
+ [c set];
+ NSRectFill (frame);
+}
+
+@end
+
+
+
+@implementation GSTheme (MidLevelDrawing)
+
+- (NSRect) drawButton: (NSRect)border withClip: (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);
+ }
+}
+
+- (NSRect) drawDarkBezel: (NSRect)border withClip: (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;
+}
+
+- (NSRect) drawDarkButton: (NSRect)border withClip: (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);
+ }
+}
+
+- (NSRect) drawFramePhoto: (NSRect)border withClip: (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);
+ }
+}
+
+- (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;
+}
+
+- (NSRect) drawGrayBezel: (NSRect)border withClip: (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;
+}
+
+- (NSRect) drawGroove: (NSRect)border withClip: (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);
+ }
+}
+
+- (NSRect) drawLightBezel: (NSRect)border withClip: (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);
+ }
+}
+
+- (NSRect) drawWhiteBezel: (NSRect)border withClip: (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);
+ }
+}
+
+@end
+
+
+
+@implementation GSTheme (LowLevelDrawing)
+
+- (void) fillHorizontalRect: (NSRect)rect
+ withImage: (NSImage*)image
+ fromRect: (NSRect)source
+ flipped: (BOOL)flipped
+{
+ NSGraphicsContext *ctxt = GSCurrentContext();
+ NSBezierPath *path;
+ unsigned repetitions;
+ unsigned count;
+ float y;
+
+ DPSgsave (ctxt);
+ path = [NSBezierPath bezierPathWithRect: rect];
+ [path addClip];
+ repetitions = (rect.size.width / source.size.width) + 1;
+ y = rect.origin.y;
+
+ if (flipped) y = rect.origin.y + rect.size.height;
+
+ for (count = 0; count < repetitions; count++)
+ {
+ NSPoint p = NSMakePoint (rect.origin.x + count * source.size.width, y);
+
+ [image compositeToPoint: p
+ fromRect: source
+ operation: NSCompositeSourceOver];
+ }
+ DPSgrestore (ctxt);
+}
+
+- (void) fillRect: (NSRect)rect
+withRepeatedImage: (NSImage*)image
+ fromRect: (NSRect)source
+ center: (BOOL)center
+{
+ NSGraphicsContext *ctxt = GSCurrentContext ();
+ NSBezierPath *path;
+ NSSize size;
+ unsigned xrepetitions;
+ unsigned yrepetitions;
+ unsigned x;
+ unsigned y;
+
+ DPSgsave (ctxt);
+ path = [NSBezierPath bezierPathWithRect: rect];
+ [path addClip];
+ size = [image size];
+ xrepetitions = (rect.size.width / size.width) + 1;
+ yrepetitions = (rect.size.height / size.height) + 1;
+
+ for (x = 0; x < xrepetitions; x++)
+ {
+ for (y = 0; y < yrepetitions; y++)
+ {
+ NSPoint p;
+
+ p = NSMakePoint (rect.origin.x + x * size.width,
+ rect.origin.y + y * size.height);
+ [image compositeToPoint: p
+ fromRect: source
+ operation: NSCompositeSourceOver];
+ }
+ }
+ DPSgrestore (ctxt);
+}
+
+- (void) fillRect: (NSRect)rect
+ withTiles: (GSDrawTiles*)tiles
+ background: (NSColor*)color
+ fillStyle: (GSThemeFillStyle)style
+{
+ NSGraphicsContext *ctxt = GSCurrentContext();
+ NSSize tls = tiles->rects[TileTL].size;
+ NSSize tms = tiles->rects[TileTM].size;
+ NSSize trs = tiles->rects[TileTR].size;
+ NSSize cls = tiles->rects[TileCL].size;
+ NSSize crs = tiles->rects[TileCR].size;
+ NSSize bls = tiles->rects[TileBL].size;
+ NSSize bms = tiles->rects[TileBM].size;
+ NSSize brs = tiles->rects[TileBR].size;
+ NSRect inFill;
+ BOOL flipped = [[ctxt focusView] isFlipped];
+
+ if (color == nil)
+ {
+ [[NSColor redColor] set];
+ }
+ else
+ {
+ [color set];
+ }
+ NSRectFill(rect);
+
+ if (flipped)
+ {
+ [self fillHorizontalRect:
+ NSMakeRect (rect.origin.x + bls.width,
+ rect.origin.y + rect.size.height - bms.height,
+ rect.size.width - bls.width - brs.width,
+ bms.height)
+ withImage: tiles->images[TileBM]
+ fromRect: tiles->rects[TileBM]
+ flipped: YES];
+ [self fillHorizontalRect:
+ NSMakeRect (rect.origin.x + tls.width,
+ rect.origin.y,
+ rect.size.width - tls.width - trs.width,
+ tms.height)
+ withImage: tiles->images[TileTM]
+ fromRect: tiles->rects[TileTM]
+ flipped: YES];
+ [self fillVerticalRect:
+ NSMakeRect (rect.origin.x,
+ rect.origin.y + bls.height,
+ cls.width,
+ rect.size.height - bls.height - tls.height)
+ withImage: tiles->images[TileCL]
+ fromRect: tiles->rects[TileCL]
+ flipped: NO];
+ [self fillVerticalRect:
+ NSMakeRect (rect.origin.x + rect.size.width - crs.width,
+ rect.origin.y + brs.height,
+ crs.width,
+ rect.size.height - brs.height - trs.height)
+ withImage: tiles->images[TileCR]
+ fromRect: tiles->rects[TileCR]
+ flipped: NO];
+
+ [tiles->images[TileTL] compositeToPoint:
+ NSMakePoint (rect.origin.x,
+ rect.origin.y)
+ fromRect: tiles->rects[TileTL]
+ operation: NSCompositeSourceOver];
+ [tiles->images[TileTR] compositeToPoint:
+ NSMakePoint (rect.origin.x + rect.size.width - tls.width,
+ rect.origin.y)
+ fromRect: tiles->rects[TileTR]
+ operation: NSCompositeSourceOver];
+ [tiles->images[TileBL] compositeToPoint:
+ NSMakePoint (rect.origin.x,
+ rect.origin.y + rect.size.height - tls.height)
+ fromRect: tiles->rects[TileBL]
+ operation: NSCompositeSourceOver];
+ [tiles->images[TileBR] compositeToPoint:
+ NSMakePoint (rect.origin.x + rect.size.width - brs.width,
+ rect.origin.y + rect.size.height - tls.height)
+ fromRect: tiles->rects[TileBR]
+ operation: NSCompositeSourceOver];
+
+ inFill = NSMakeRect (rect.origin.x +cls.width,
+ rect.origin.y + bms.height,
+ rect.size.width - cls.width - crs.width,
+ rect.size.height - bms.height - tms.height);
+ if (style == FillStyleCenter)
+ {
+ [self fillRect: inFill
+ withRepeatedImage: tiles->images[TileCM]
+ fromRect: tiles->rects[TileCM]
+ center: NO];
+ }
+ else if (style == FillStyleRepeat)
+ {
+ [self fillRect: inFill
+ withRepeatedImage: tiles->images[TileCM]
+ fromRect: tiles->rects[TileCM]
+ center: NO];
+ }
+ else if (style == FillStyleScale)
+ {
+ [tiles->images[TileCM] setScalesWhenResized: YES];
+ [tiles->images[TileCM] setSize: inFill.size];
+ [tiles->images[TileCM] compositeToPoint: inFill.origin
+ fromRect: tiles->rects[TileCM]
+ operation: NSCompositeSourceOver];
+ }
+ }
+ else
+ {
+ [self fillHorizontalRect:
+ NSMakeRect(
+ rect.origin.x + tls.width,
+ rect.origin.y + rect.size.height - tms.height,
+ rect.size.width - bls.width - brs.width,
+ tms.height)
+ withImage: tiles->images[TileTM]
+ fromRect: tiles->rects[TileTM]
+ flipped: NO];
+ [self fillHorizontalRect:
+ NSMakeRect(
+ rect.origin.x + bls.width,
+ rect.origin.y,
+ rect.size.width - bls.width - brs.width,
+ bms.height)
+ withImage: tiles->images[TileBM]
+ fromRect: tiles->rects[TileBM]
+ flipped: NO];
+ [self fillVerticalRect:
+ NSMakeRect(
+ rect.origin.x,
+ rect.origin.y + bls.height,
+ cls.width,
+ rect.size.height - tls.height - bls.height)
+ withImage: tiles->images[TileCL]
+ fromRect: tiles->rects[TileCL]
+ flipped: NO];
+ [self fillVerticalRect:
+ NSMakeRect(
+ rect.origin.x + rect.size.width - crs.width,
+ rect.origin.y + brs.height,
+ crs.width,
+ rect.size.height - trs.height - brs.height)
+ withImage: tiles->images[TileCR]
+ fromRect: tiles->rects[TileCR]
+ flipped: NO];
+
+ [tiles->images[TileTL] compositeToPoint:
+ NSMakePoint (
+ rect.origin.x,
+ rect.origin.y + rect.size.height - tls.height)
+ fromRect: tiles->rects[TileTL]
+ operation: NSCompositeSourceOver];
+ [tiles->images[TileTR] compositeToPoint:
+ NSMakePoint(
+ rect.origin.x + rect.size.width - trs.width,
+ rect.origin.y + rect.size.height - trs.height)
+ fromRect: tiles->rects[TileTR]
+ operation: NSCompositeSourceOver];
+ [tiles->images[TileBL] compositeToPoint:
+ NSMakePoint(
+ rect.origin.x,
+ rect.origin.y)
+ fromRect: tiles->rects[TileBL]
+ operation: NSCompositeSourceOver];
+ [tiles->images[TileBR] compositeToPoint:
+ NSMakePoint(
+ rect.origin.x + rect.size.width - brs.width,
+ rect.origin.y)
+ fromRect: tiles->rects[TileBR]
+ operation: NSCompositeSourceOver];
+
+ inFill = NSMakeRect (rect.origin.x +cls.width,
+ rect.origin.y + bms.height,
+ rect.size.width - cls.width - crs.width,
+ rect.size.height - bms.height - tms.height);
+
+ if (style == FillStyleCenter)
+ {
+ [self fillRect: inFill
+ withRepeatedImage: tiles->images[TileCM]
+ fromRect: tiles->rects[TileCM]
+ center: NO];
+ }
+ else if (style == FillStyleRepeat)
+ {
+ [self fillRect: inFill
+ withRepeatedImage: tiles->images[TileCM]
+ fromRect: tiles->rects[TileCM]
+ center: YES];
+ }
+ else if (style == FillStyleScale)
+ {
+ [tiles->images[TileCM] setScalesWhenResized: YES];
+ [tiles->images[TileCM] setSize: inFill.size];
+ [tiles->images[TileCM] compositeToPoint: inFill.origin
+ fromRect: tiles->rects[TileCM]
+ operation: NSCompositeSourceOver];
+ }
+ }
+}
+
+- (void) fillVerticalRect: (NSRect)rect
+ withImage: (NSImage*)image
+ fromRect: (NSRect)source
+ flipped: (BOOL)flipped
+{
+ NSGraphicsContext *ctxt = GSCurrentContext();
+ NSBezierPath *path;
+ unsigned repetitions;
+ unsigned count;
+ NSPoint p;
+
+ DPSgsave (ctxt);
+ path = [NSBezierPath bezierPathWithRect: rect];
+ [path addClip];
+ repetitions = (rect.size.height / source.size.height) + 1;
+
+ if (flipped)
+ {
+ for (count = 0; count < repetitions; count++)
+ {
+ p = NSMakePoint (rect.origin.x,
+ rect.origin.y + rect.size.height - count * source.size.height);
+ [image compositeToPoint: p
+ fromRect: source
+ operation: NSCompositeSourceOver];
+ }
+ }
+ else
+ {
+ for (count = 0; count < repetitions; count++)
+ {
+ p = NSMakePoint (rect.origin.x,
+ rect.origin.y + count * source.size.height);
+ [image compositeToPoint: p
+ fromRect: source
+ operation: NSCompositeSourceOver];
+ }
+ }
+ DPSgrestore (ctxt);
+}
+
+@end
+
diff --git a/Source/GSTitleView.m b/Source/GSTitleView.m
index 304dade63..09b53d953 100644
--- a/Source/GSTitleView.m
+++ b/Source/GSTitleView.m
@@ -37,7 +37,7 @@
#include
#include
-#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;
diff --git a/Source/GSWindowDecorationView.h b/Source/GSWindowDecorationView.h
index a27c51e8f..d0ff45955 100644
--- a/Source/GSWindowDecorationView.h
+++ b/Source/GSWindowDecorationView.h
@@ -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) windowDecorator;
++ (id) 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
diff --git a/Source/GSWindowDecorationView.m b/Source/GSWindowDecorationView.m
index 341fc4311..58316e870 100644
--- a/Source/GSWindowDecorationView.m
+++ b/Source/GSWindowDecorationView.m
@@ -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) windowDecorator
++ (id) 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
diff --git a/Source/NSBitmapImageRep+JPEG.m b/Source/NSBitmapImageRep+JPEG.m
index cd4424c9d..cb7c4a3ee 100644
--- a/Source/NSBitmapImageRep+JPEG.m
+++ b/Source/NSBitmapImageRep+JPEG.m
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include "AppKit/NSGraphics.h"
#include
@@ -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
{
diff --git a/Source/NSBox.m b/Source/NSBox.m
index 7ab474644..037fe6bbb 100644
--- a/Source/NSBox.m
+++ b/Source/NSBox.m
@@ -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
@@ -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;
}
diff --git a/Source/NSBrowser.m b/Source/NSBrowser.m
index 923adacdd..4a5fe0e43 100644
--- a/Source/NSBrowser.m
+++ b/Source/NSBrowser.m
@@ -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];
diff --git a/Source/NSButtonCell.m b/Source/NSButtonCell.m
index dfe52a2eb..3c9bff6c3 100644
--- a/Source/NSButtonCell.m
+++ b/Source/NSButtonCell.m
@@ -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
@@ -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])
diff --git a/Source/NSCell.m b/Source/NSCell.m
index 6f31182ab..c9a56b774 100644
--- a/Source/NSCell.m
+++ b/Source/NSCell.m
@@ -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];
diff --git a/Source/NSColor.m b/Source/NSColor.m
index 34b952c3b..35a2286ca 100644
--- a/Source/NSColor.m
+++ b/Source/NSColor.m
@@ -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;
}
diff --git a/Source/NSColorList.m b/Source/NSColorList.m
index 4cdfddaf3..2d78b6dbb 100644
--- a/Source/NSColorList.m
+++ b/Source/NSColorList.m
@@ -29,6 +29,7 @@
#include "config.h"
#include
+#include
#include
#include
#include
@@ -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.
+ * 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
+
diff --git a/Source/NSColorWell.m b/Source/NSColorWell.m
index 8f2c4e109..0aa2cc0b0 100644
--- a/Source/NSColorWell.m
+++ b/Source/NSColorWell.m
@@ -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
#include
@@ -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);
}
diff --git a/Source/NSComboBoxCell.m b/Source/NSComboBoxCell.m
index 5d90503c5..cba121de4 100644
--- a/Source/NSComboBoxCell.m
+++ b/Source/NSComboBoxCell.m
@@ -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;
diff --git a/Source/NSControl.m b/Source/NSControl.m
index 6e55a3e80..ddb1a7fb6 100644
--- a/Source/NSControl.m
+++ b/Source/NSControl.m
@@ -726,16 +726,15 @@ static Class actionCellClass;
return [[self selectedCell] acceptsFirstResponder];
}
-/** This method is invoked when the user click into the NSControl.
-
- *
- */
+
- (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)
{
diff --git a/Source/NSDocument.m b/Source/NSDocument.m
index d6fdfa8f6..acc6fc670 100644
--- a/Source/NSDocument.m
+++ b/Source/NSDocument.m
@@ -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 %@."),
diff --git a/Source/NSDrawer.m b/Source/NSDrawer.m
index 871a86cad..bfa7fbdc6 100644
--- a/Source/NSDrawer.m
+++ b/Source/NSDrawer.m
@@ -4,6 +4,8 @@
Copyright (C) 2001 Free Software Foundation, Inc.
+ Author: Gregory Casamento
+ Date: 2006
Author: Fred Kiefer
Date: 2001
@@ -29,12 +31,316 @@
#include
#include
#include
+#include
#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;
}
diff --git a/Source/NSFormCell.m b/Source/NSFormCell.m
index e72d2312d..cc2ece69d 100644
--- a/Source/NSFormCell.m
+++ b/Source/NSFormCell.m
@@ -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);
}
diff --git a/Source/NSGraphicsContext.m b/Source/NSGraphicsContext.m
index 6ebd6c576..facaead90 100644
--- a/Source/NSGraphicsContext.m
+++ b/Source/NSGraphicsContext.m
@@ -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;
}
diff --git a/Source/NSHelpManager.m b/Source/NSHelpManager.m
index 8ecb2b5ce..088be47ad 100644
--- a/Source/NSHelpManager.m
+++ b/Source/NSHelpManager.m
@@ -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;
diff --git a/Source/NSImageCell.m b/Source/NSImageCell.m
index 2677d4508..4c969701a 100644
--- a/Source/NSImageCell.m
+++ b/Source/NSImageCell.m
@@ -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;
}
diff --git a/Source/NSMenuItemCell.m b/Source/NSMenuItemCell.m
index c21f4f955..139b317df 100644
--- a/Source/NSMenuItemCell.m
+++ b/Source/NSMenuItemCell.m
@@ -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.);
}
/*
diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m
index 5faabf34d..be1b2e60d 100644
--- a/Source/NSOutlineView.m
+++ b/Source/NSOutlineView.m
@@ -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)
diff --git a/Source/NSProgressIndicator.m b/Source/NSProgressIndicator.m
index 5d8eaee09..641180094 100644
--- a/Source/NSProgressIndicator.m
+++ b/Source/NSProgressIndicator.m
@@ -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;
diff --git a/Source/NSScreen.m b/Source/NSScreen.m
index 4497642b6..0791b494f 100644
--- a/Source/NSScreen.m
+++ b/Source/NSScreen.m
@@ -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;
diff --git a/Source/NSScrollView.m b/Source/NSScrollView.m
index 58492db29..2b3856c68 100644
--- a/Source/NSScrollView.m
+++ b/Source/NSScrollView.m
@@ -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;
}
diff --git a/Source/NSStepperCell.m b/Source/NSStepperCell.m
index 4e9d0d005..429991108 100644
--- a/Source/NSStepperCell.m
+++ b/Source/NSStepperCell.m
@@ -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,
diff --git a/Source/NSTabView.m b/Source/NSTabView.m
index 7a9988941..9b0adc5e4 100644
--- a/Source/NSTabView.m
+++ b/Source/NSTabView.m
@@ -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:
diff --git a/Source/NSTableHeaderCell.m b/Source/NSTableHeaderCell.m
index 239e129f8..03aa38d79 100644
--- a/Source/NSTableHeaderCell.m
+++ b/Source/NSTableHeaderCell.m
@@ -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];
diff --git a/Source/NSTableView.m b/Source/NSTableView.m
index 79ce07ed6..08193142f 100644
--- a/Source/NSTableView.m
+++ b/Source/NSTableView.m
@@ -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
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;
diff --git a/Source/NSTextField.m b/Source/NSTextField.m
index 281c33164..f6d39f2bf 100644
--- a/Source/NSTextField.m
+++ b/Source/NSTextField.m
@@ -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];
}
/** 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
diff --git a/Source/NSView.m b/Source/NSView.m
index 7253c2f38..11a57196f 100644
--- a/Source/NSView.m
+++ b/Source/NSView.m
@@ -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);
diff --git a/Source/NSWindow.m b/Source/NSWindow.m
index 13e3a8a80..57ef1c25e 100644
--- a/Source/NSWindow.m
+++ b/Source/NSWindow.m
@@ -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
diff --git a/Tools/GSspell.m b/Tools/GSspell.m
index b659d72e3..e4391ca97 100644
--- a/Tools/GSspell.m
+++ b/Tools/GSspell.m
@@ -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;
diff --git a/Version b/Version
index ccceb2be0..c489631b4 100644
--- a/Version
+++ b/Version
@@ -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}