mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 01:11:04 +00:00
merged with trunk from revision 22954:22963 (nib changes)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/themes@22964 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6b2d383bd1
commit
64dac156e8
36 changed files with 3250 additions and 1249 deletions
471
ChangeLog
471
ChangeLog
|
@ -1,3 +1,7 @@
|
|||
2006-05-20 [themes] Nicolas Roard <nicolas@roard.com>
|
||||
|
||||
* merged with trunk from revision 22954:22963 (nib changes)
|
||||
|
||||
2006-05-20 [thenes] Nicolas Roard <nicolas@roard.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSDrawFunctions.h:
|
||||
|
@ -12,6 +16,445 @@
|
|||
with two new methods in GSDrawFunctions:
|
||||
drawButton:in:view:style:state: and drawFoctusFrame:view:
|
||||
|
||||
2006-05-20 18:25 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m
|
||||
* Source/NSButtonCell.m: Merged additional changes from
|
||||
NibCompatibility.
|
||||
NOTE: All changes which were merged from the NibCompatilibility
|
||||
branch are tagged at the end with [NibCompatibility].
|
||||
|
||||
2006-05-20 18:11 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* ChangeLog
|
||||
* Documentation/ReleaseNotes.gsdoc
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
|
||||
* Headers/Additions/GNUstepGUI/GSNibTemplates.h
|
||||
* Headers/AppKit/NSNib.h
|
||||
* Source/GNUmakefile
|
||||
* Source/GSNibCompatibility.m
|
||||
* Source/NSActionCell.m
|
||||
* Source/NSBundleAdditions.m
|
||||
* Source/NSButtonCell.m
|
||||
* Source/NSCell.m
|
||||
* Source/NSClipView.m
|
||||
* Source/NSColorWell.m
|
||||
* Source/NSLayoutManager.m
|
||||
* Source/NSMatrix.m
|
||||
* Source/NSMenuItem.m
|
||||
* Source/NSNib.m
|
||||
* Source/NSOutlineView.m
|
||||
* Source/NSPopUpButtonCell.m
|
||||
* Source/NSScroller.m
|
||||
* Source/NSScrollView.m
|
||||
* Source/NSSecureTextField.m
|
||||
* Source/NSSliderCell.m
|
||||
* Source/NSStepperCell.m
|
||||
* Source/NSTableView.m
|
||||
* Source/NSTextContainer.m
|
||||
* Source/NSTextField.m
|
||||
* Source/NSTextView.m
|
||||
* Source/NSView.m: Merged nib loading code from NibCompatibility.
|
||||
|
||||
2006-05-15 21:55 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Streamlined previous change.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-15 00:54 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Add title mask if window has
|
||||
a title in the archive.
|
||||
* Source/NSPopUpButtonCell.m: Clear and reset the menu
|
||||
in the popup button cell initWithCoder: method.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-14 20:58 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Added autosaveName.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-10 23:55 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSButtonCell.m
|
||||
* Source/NSCell.m
|
||||
* Source/NSMatrix.m: Improved initWithCoder: nib support.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-09 22:48 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSStepperCell.m: Implemented keyed coding.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-07 22:36 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
|
||||
_originalClassName member.
|
||||
* Source/GSNibCompatibility.m: use new member in
|
||||
instantiateRealObject:withClassName: to allow auto-substitution
|
||||
of cell classes.
|
||||
* Source/NSSecureTextField.m: Remove code to copy properties.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-07 20:29 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Addition of
|
||||
flags fields for the window.
|
||||
* Source/GSNibCompatibility.m: Improvments to NSWindowTemplate.
|
||||
* Source/NSScrollView.m: Changed unsigned int to unsigned long in
|
||||
initWithCoder:
|
||||
* Source/NSSecureTextField.m: code to copy the text field cell.
|
||||
* Source/NSTextField.m: Changed if and added a comment in
|
||||
initWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-07 11:07 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Removed kludge in nibInstantiate:owner:
|
||||
method and added a category for NSNibControlConnector to reformat
|
||||
the method name.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-07 10:52 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m
|
||||
* Source/NSActionCell.m
|
||||
* Source/NSCell.m
|
||||
* Source/NSSliderCell.m: Changes and improvements to handling of
|
||||
cells for nib decoding.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-06 13:09 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSBundleAdditions.m: Unarchive destination before source.
|
||||
* Source/NSOutlineView.m: Proper initialization of outline view in
|
||||
initWithCoder:
|
||||
* Source/NSTableView.m: Rearrangement of keys in initWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-05 00:41 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSTextView.m: Completion of code in initWithCoder: for
|
||||
keyed unarchiving.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-03 22:43 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Make
|
||||
NSIBObjectData conform to GSNibContainer protocol.
|
||||
* Headers/Additions/GNUstepGUI/GSNibContainer.h: New protocol.
|
||||
* Headers/Additions/GNUstepGUI/GSNibTemplates.h: Use new protocol
|
||||
as protocol for the GSNibContainer object.
|
||||
* Source/GNUmakefile: Add GSNibContainer.h to makefile.
|
||||
* Source/GSNibCompatibility.m: Implement GSNibContainer methods,
|
||||
skeleton implementation for some.
|
||||
* Source/NSScrollView.m: Correct issue with horiz/vert scroller.
|
||||
* Source/NSTextView.m: More keyed archiving changes.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-03 01:00 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSLayoutManager.m
|
||||
* Source/NSTextContainer.m
|
||||
* Source/NSTextView.m: Improved keyed unarchiving for these classes.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-30 17:12 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Addition of keyMap to NSKeyedUnarchiver
|
||||
in a category.
|
||||
* Source/NSScrollView.m: Change to re-align view only if scroller is
|
||||
present.
|
||||
* Source/NSTextView.m: Changed initWithCoder:
|
||||
* Source/NSView.m: Changed the order of initialization so that the
|
||||
view has it's frame prior to the unarchiving of subviews.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-26 22:34 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSTableView.m: Correction for header view.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-24 22:02 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Implementation of
|
||||
NSButtonImageSource.
|
||||
* Source/NSButtonCell.m: Code to compensate for image
|
||||
encoding anomalies in nibs.
|
||||
* Source/NSScrollView.m: Changes to properly decode scrollview
|
||||
attributes and border settings.
|
||||
* Source/NSTableView.m: Changes to properly set height of
|
||||
cornerview.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-18 19:54 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSTableView.m: Corrected code in setHeaderView: to
|
||||
properly set the table view into the header view if it has
|
||||
a "setTableView:" method.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-18 00:55 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSScrollView.m: Corrections for keyed decoding of
|
||||
border style and other settings.
|
||||
* Source/NSTableView.m: Some cleanup of keyed coding.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-15 23:07 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Changed order of decoding.
|
||||
* Source/NSScroller.m: Properly set the horiz/vert flags
|
||||
* Source/NSScrollView.m: Corrections to keyed decoding and
|
||||
contentView handing.
|
||||
* Source/NSTableView.m: Corrections to keyed decoding. Use of a
|
||||
struct to decode.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-15 02:41 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSScrollView.m: initWithCoder: modify position of
|
||||
clipView due to differences in OSX vs. GNUstep.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-15 02:26 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Comment on _NSHeaderView.
|
||||
* Source/NSScrollView.m: Corrected issue with content view and
|
||||
keyed coding.
|
||||
* Source/NSTableView.m: Added additional initialization logic in
|
||||
keyed coder.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-14 00:02 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Changed ordering to allow views
|
||||
to be properly initialized.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-11 23:45 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/AppKit/NSNib.h
|
||||
* Source/NSNib.m: Added keyed coding.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-09 23:14 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSModelLoaderFactory.m: Fixed a problem with
|
||||
pathForNibResource:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-04-09 20:37 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSModelLoaderFactory.h
|
||||
* Source/GSGormLoader.m
|
||||
* Source/GSModelLoaderFactory.m
|
||||
* Source/GSNibLoader.m
|
||||
* Source/NSNib.m: Refactoring to make NSNib use the new
|
||||
model loading framework.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-02-18 08:36 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Changed aDecoder to coder in
|
||||
NSIBObjectData encoderWithCoder: also added code to throw an
|
||||
exception if a coder does not support keyed coding.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-25 22:31 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
|
||||
* Source/GSModelLoaderFactory.m: Fixes to work with gcc 3.x
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-16 00:58 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Minor changes in initWithCoder:
|
||||
* Source/NSClipView.m: Added logic to check flags in initWithCoder:
|
||||
* Source/NSOutlineView.m: Added initial changes for keyed coding.
|
||||
* Source/NSScrollView.m: Added logic to check flags.
|
||||
* Source/NSTableView.m: Added logic to check for old grid flag in
|
||||
initWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-14 09:28 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSTableView.m: Corrected bits used for columnResizing
|
||||
flag in initWithCoder: and encodeWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-14 08:58 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSTableView.m: Implemented encodeWithCoder: for NSTableView.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-14 08:29 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: [NSIBObjectData objectForName:] return
|
||||
nil, if the object is not in the array.
|
||||
* Source/NSTableView.m: implement decoding of flags in initWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-13 00:29 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSColorWell.m: Added keyed coding support in initWithCoder:
|
||||
and encodeWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-11 01:26 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSSliderCell.m: Encode NSValue for compatibility with
|
||||
Cocoa.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-11 01:02 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Changes to NSViewTemplate.
|
||||
* Source/NSSliderCell.m: Addition of code to handle slider to both
|
||||
initWithCoder: and encodeWithCoder:
|
||||
* Source/NSTextField.m: Removed unecessary empty
|
||||
if conditional.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-10 00:12 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Rearranged order of unarchiving in
|
||||
[NSIBObjectData initWithCoder:].
|
||||
* Source/NSView.m: Added "NSSuperview" to encodeWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-09 19:38 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Rearrange order of unarchiving
|
||||
in [NSIBObjectData initWithCoder:] so that NSClassSwapper unarchives
|
||||
and replaces itself correctly.
|
||||
* Source/NSView.m: Move subview initialization to after
|
||||
the decoding section for both keyed/serial archiving in initWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-08 14:01 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSMenuItem.m: initWithCoder: added code to decode
|
||||
NSSubmenu key so that menus are properly constructed.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-08 13:53 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Removed forwardInvocation from
|
||||
NSClassSwapper.
|
||||
* Source/NSMenuItem.m: Added implementation of keyed coding
|
||||
to NSMenu initWithCoder:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-07 10:38 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Encoding for NSIBObjectData, and
|
||||
for NSWindowTemplate. Implementation of NSClassSwapper.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-01 21:02 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSInstantiator.h: Protocol and
|
||||
private method for instantiation.
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added new header
|
||||
* Source/GNUmakefile: Added new header to makefile.
|
||||
* Source/GSNibCompatibility.m: Added nibInstantiation support.
|
||||
* Source/NSBundleAdditions.m: Addition of instantiateWithInstantiator:
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-01 14:36 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
|
||||
NSCustomResource.
|
||||
* Source/GSNibCompatibility.m: Added NSCustomResource.
|
||||
* Source/GSNibLoader.m: Calls keyed archiver with "IB.objectdata"
|
||||
key.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-01-01 09:27 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSModelLoaderFactory.h: Added
|
||||
declaration for priority method.
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added
|
||||
awakeWithContext method.
|
||||
* Source/GSGModelLoader.m: Added priority method.
|
||||
* Source/GSGormLoader.m: Added priority method
|
||||
* Source/GSModelLoaderFactory.m: Implemented sorting by priority
|
||||
* Source/GSNibCompatibility.m: use ASSIGN in initWithCoder:
|
||||
* Source/GSNibLoader.m: Added priority method
|
||||
* Source/NSBundleAdditions.m: Removed AUTORELEASE, since the
|
||||
loader itself is autoreleased by the factory.
|
||||
[NibCompatibility]
|
||||
|
||||
2005-12-31 17:25 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Added code to properly initialize the
|
||||
maptables.
|
||||
[NibCompatibility]
|
||||
|
||||
2005-12-31 16:10 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h:
|
||||
Added awakeWithContext:
|
||||
* Source/GNUmakefile: Added GSNibLoader.m
|
||||
* Source/GSGormLoader.m: Changed some log output
|
||||
* Source/GSNibCompatibility.m: Added awakeWithContext:
|
||||
* Source/GSNibLoader.m: Loader for .nib files.
|
||||
[NibCompatibility]
|
||||
|
||||
2005-12-31 11:49 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSModelLoaderFactory.h: Removed
|
||||
protocol.
|
||||
* Source/GSGModelLoader.m:
|
||||
* Source/GSGormLoader.m: Removed initialize method
|
||||
* Source/GSModelLoaderFactory.m: Renamed
|
||||
abstract class to GSModelLoader. Added code
|
||||
in initialize to register all subclasses of GSModelLoader.
|
||||
* Source/NSBundleAdditions.m: Make changes to use new abstract
|
||||
class name.
|
||||
[NibCompatibility]
|
||||
|
||||
2005-12-31 01:31 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GNUmakefile: Added new classes.
|
||||
* Source/NSBundleAdditions.m: Changes to use new model loader
|
||||
factory and loaders.
|
||||
* Source/GSModelLoaderFactory.h
|
||||
* Source/GSModelLoaderFactory.m: Handles model loading in
|
||||
dynamic way. Allows registration of additional classes to
|
||||
handle loading of guis.
|
||||
* Source/GSGormLoader.m: Loader for .gorm files.
|
||||
* Source/GSGModelLoader.m: Loader for .gmodel files.
|
||||
[NibCompatibility]
|
||||
|
||||
2005-12-31 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
* Source/NSTableView.m (-mouseDown:): Copy the selected cell before
|
||||
tracking mouse, add comment. (patch previously reverted 2005-05-30)
|
||||
(-mouseDown:): Check for pointer equality in addition to isEqual:
|
||||
which doesn't work with nil. (fix for bug #15316)
|
||||
|
||||
2005-12-30 00:49 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
|
||||
* Source/GSNibCompatibility.m: NSCustomView changes.
|
||||
[NibCompatibility]
|
||||
|
||||
2005-12-29 00:39 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
|
||||
* Source/GSNibCompatibility.m: NSClassSwapper, NSCustomView, and
|
||||
NSCustomObject.
|
||||
[NibCompatibility]
|
||||
|
||||
2005-12-27 20:51 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h:
|
||||
* Source/GSNibCompatibility.m: Addition of classes for true OSX nib
|
||||
compatibility.
|
||||
[NibCompatibility]
|
||||
|
||||
2006-05-12 Nicolas Roard <nicolas@roard.com>
|
||||
|
||||
* TextConverters/RTF/RTFProducer.h:
|
||||
|
@ -166,13 +609,9 @@
|
|||
Set the type of the new document. Patch by Saso Kiselkov
|
||||
<diablos@manga.sk>.
|
||||
|
||||
2006-04-19 Adam Fedor <fedor@gnu.org>
|
||||
2006-04-09 12:25 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* configure: Add arg to disable aspell (for use on Mac OS X).
|
||||
|
||||
* Source/NSBitmapImageRep+JPEG.m: Add workaround so that INT32
|
||||
is not redefined on MingW by jmorecfg.h (Suggestion from Issac
|
||||
Trotts).
|
||||
* Tools/gopen.m: Streamline gopen code.
|
||||
|
||||
2006-04-09 12:28 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
|
@ -437,6 +876,10 @@
|
|||
* Tools/GNUmakefile.preamble:
|
||||
Build new utility.
|
||||
|
||||
2006-01-26 00:01 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSScrollView.m: Temporary fix to scrollview.
|
||||
|
||||
2006-01-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSPopupButtonCell.m (-synchronizeTitleAndSelectedItem):
|
||||
|
@ -459,6 +902,7 @@
|
|||
* Source/NSNib.m: Correction for bug#15348. Removed uneeded
|
||||
append in initWithNibNamed:
|
||||
|
||||
|
||||
2006-01-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTableView.m (-initWithFrame:) Use different intercell
|
||||
|
@ -470,13 +914,6 @@
|
|||
-drawInteriorWithFrame:inView:, -setKnobThickness:): Protect against knob
|
||||
image being nil. Fixes Solaris problem reported by <ubossx@gmail.com>.
|
||||
|
||||
2005-12-31 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
* Source/NSTableView.m (-mouseDown:): Copy the selected cell before
|
||||
tracking mouse, add comment. (patch previously reverted 2005-05-30)
|
||||
(-mouseDown:): Check for pointer equality in addition to isEqual:
|
||||
which doesn't work with nil. (fix for bug #15316)
|
||||
|
||||
2005-12-22 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 0.10.2
|
||||
|
@ -1153,6 +1590,14 @@
|
|||
using the same class name for both arguments. Also cleaned
|
||||
up some commented out code.
|
||||
|
||||
2006-04-19 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* configure: Add arg to disable aspell (for use on Mac OS X).
|
||||
|
||||
* Source/NSBitmapImageRep+JPEG.m: Add workaround so that INT32
|
||||
is not redefined on MingW by jmorecfg.h (Suggestion from Issac
|
||||
Trotts).
|
||||
|
||||
2005-04-17 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSPopupButton.m (-keyDown:) Removed unneeded code.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<email address="fedor@gnu.org"/>
|
||||
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
|
||||
</author>
|
||||
<version>$Revision: 22201 $</version>
|
||||
<version>$Revision$</version>
|
||||
<date>$Date$</date>
|
||||
<copy>2005 Free Software Foundation, Inc.</copy>
|
||||
</head>
|
||||
|
|
43
Headers/Additions/GNUstepGUI/GSInstantiator.h
Normal file
43
Headers/Additions/GNUstepGUI/GSInstantiator.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
GSNibCompatibility.h
|
||||
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2002
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU 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_GSInstantiator
|
||||
#define _GNUstep_H_GSInstantiator
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
#include <AppKit/NSNibConnector.h>
|
||||
|
||||
// instantiator
|
||||
@protocol GSInstantiator
|
||||
- (id) instantiateObject: (id)object;
|
||||
@end
|
||||
|
||||
// informal protocol
|
||||
@interface NSNibConnector (NibInstantiation)
|
||||
- (void) instantiateWithInstantiator: (id<GSInstantiator>)instantiator;
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_GSNibCompatibility */
|
52
Headers/Additions/GNUstepGUI/GSModelLoaderFactory.h
Normal file
52
Headers/Additions/GNUstepGUI/GSModelLoaderFactory.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/** <title>NSBundleAdditions</title>
|
||||
|
||||
<abstract>Implementation of NSBundle Additions</abstract>
|
||||
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2005
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU 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,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_GSModelLoaderFactory
|
||||
#define _GNUstep_H_GSModelLoaderFactory
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
@interface GSModelLoader : NSObject
|
||||
+ (NSString *) type;
|
||||
+ (float) priority;
|
||||
- (BOOL) loadModelData: (NSData *)data
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
- (BOOL) loadModelFile: (NSString *)fileName
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
@end
|
||||
|
||||
@interface GSModelLoaderFactory : NSObject
|
||||
+ (void) registerModelLoaderClass: (Class)aClass;
|
||||
+ (Class)classForType: (NSString *)type;
|
||||
+ (NSString *) supportedModelFileAtPath: (NSString *)modelPath;
|
||||
+ (GSModelLoader *)modelLoaderForFileType: (NSString *)type;
|
||||
+ (GSModelLoader *)modelLoaderForFileName: (NSString *)modelPath;
|
||||
@end
|
||||
|
||||
#endif
|
|
@ -35,72 +35,204 @@
|
|||
#include <AppKit/NSControl.h>
|
||||
#include <AppKit/NSButton.h>
|
||||
|
||||
/*
|
||||
As these classes are deprecated, they should disappear from the gnustep
|
||||
distribution in the next major release. They are for backwards compatibility
|
||||
ONLY.
|
||||
*/
|
||||
|
||||
// DO NOT USE.
|
||||
#include <AppKit/NSGraphicsContext.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/NSResponder.h>
|
||||
#include <AppKit/NSEvent.h>
|
||||
#include "GNUstepGUI/GSNibContainer.h"
|
||||
#include "GNUstepGUI/GSInstantiator.h"
|
||||
|
||||
// templates
|
||||
@protocol __DeprecatedTemplate__
|
||||
@protocol OSXNibTemplate
|
||||
- (void) setClassName: (NSString *)className;
|
||||
- (NSString *)className;
|
||||
- (id) instantiateObject: (NSCoder *)coder;
|
||||
- (id) realObject;
|
||||
@end
|
||||
|
||||
@interface NSWindowTemplate : NSWindow <__DeprecatedTemplate__>
|
||||
|
||||
typedef struct _GSWindowTemplateFlags
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
unsigned int isHiddenOnDeactivate:1;
|
||||
unsigned int isNotReleasedOnClose:1;
|
||||
unsigned int isDeferred:1;
|
||||
unsigned int isOneShot:1;
|
||||
unsigned int isVisible:1;
|
||||
unsigned int wantsToBeColor:1;
|
||||
unsigned int dynamicDepthLimit:1;
|
||||
unsigned int autoPositionMask:6;
|
||||
unsigned int savePosition:1;
|
||||
unsigned int style:2;
|
||||
unsigned int _unused:16; // currently not used, contains Cocoa specific info
|
||||
#else
|
||||
unsigned int _unused:16; // currently not used, contains Cocoa specific info
|
||||
unsigned int style:2;
|
||||
unsigned int savePosition:1;
|
||||
unsigned int autoPositionMask:6;
|
||||
unsigned int dynamicDepthLimit:1;
|
||||
unsigned int wantsToBeColor:1;
|
||||
unsigned int isVisible:1;
|
||||
unsigned int isOneShot:1;
|
||||
unsigned int isDeferred:1;
|
||||
unsigned int isNotReleasedOnClose:1;
|
||||
unsigned int isHiddenOnDeactivate:1;
|
||||
#endif
|
||||
} GSWindowTemplateFlags;
|
||||
|
||||
/**
|
||||
* This class acts as a placeholder for the window. It doesn't derive from
|
||||
* NSWindow for two reasons. First, it shouldn't instantiate a window immediately
|
||||
* when it's unarchived and second, it holds certain attributes (but doesn't set them
|
||||
* on the window, when the window is being edited in the application builder.
|
||||
*/
|
||||
@interface NSWindowTemplate : NSObject <OSXNibTemplate, NSCoding>
|
||||
{
|
||||
NSBackingStoreType _backingStoreType;
|
||||
NSSize _maxSize;
|
||||
NSSize _minSize;
|
||||
unsigned _windowStyle;
|
||||
NSString *_title;
|
||||
NSString *_viewClass;
|
||||
NSString *_windowClass;
|
||||
NSRect _windowRect;
|
||||
NSRect _screenRect;
|
||||
id _realObject;
|
||||
id _view;
|
||||
GSWindowTemplateFlags _flags;
|
||||
NSString *_autosaveName;
|
||||
}
|
||||
- (void) setBackingStoreType: (NSBackingStoreType)type;
|
||||
- (NSBackingStoreType) backingStoreType;
|
||||
- (void) setDeferred: (BOOL)flag;
|
||||
- (BOOL) isDeferred;
|
||||
- (void) setMaxSize: (NSSize)maxSize;
|
||||
- (NSSize) maxSize;
|
||||
- (void) setMinSize: (NSSize)minSize;
|
||||
- (NSSize) minSize;
|
||||
- (void) setWindowStyle: (unsigned)sty;
|
||||
- (unsigned) windowStyle;
|
||||
- (void) setTitle: (NSString *) title;
|
||||
- (NSString *)title;
|
||||
- (void) setViewClass: (NSString *)viewClass;
|
||||
- (NSString *)viewClass;
|
||||
- (void) setWindowRect: (NSRect)rect;
|
||||
- (NSRect)windowRect;
|
||||
- (void) setScreenRect: (NSRect)rect;
|
||||
- (NSRect) screenRect;
|
||||
- (id) realObject;
|
||||
- (void) setView: (id)view;
|
||||
- (id) view;
|
||||
@end
|
||||
|
||||
@interface NSViewTemplate : NSView <OSXNibTemplate, NSCoding>
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_parentClassName;
|
||||
BOOL _deferFlag;
|
||||
id _realObject;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSViewTemplate : NSView <__DeprecatedTemplate__>
|
||||
@interface NSTextTemplate : NSViewTemplate
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_parentClassName;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSTextTemplate : NSText <__DeprecatedTemplate__>
|
||||
@interface NSTextViewTemplate : NSViewTemplate
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_parentClassName;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSTextViewTemplate : NSTextView <__DeprecatedTemplate__>
|
||||
@interface NSMenuTemplate : NSObject <OSXNibTemplate, NSCoding>
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_parentClassName;
|
||||
NSString *_menuClass;
|
||||
NSString *_title;
|
||||
id _realObject;
|
||||
id _parentMenu;
|
||||
NSPoint _location;
|
||||
BOOL _isWindowsMenu;
|
||||
BOOL _isServicesMenu;
|
||||
BOOL _isFontMenu;
|
||||
NSInterfaceStyle _interfaceStyle;
|
||||
}
|
||||
- (void) setClassName: (NSString *)name;
|
||||
- (NSString *)className;
|
||||
- (id)nibInstantiate;
|
||||
@end
|
||||
|
||||
@interface NSMenuTemplate : NSMenu <__DeprecatedTemplate__>
|
||||
@interface NSCustomObject : NSObject <NSCoding>
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_parentClassName;
|
||||
NSString *_className;
|
||||
NSString *_extension;
|
||||
id _object;
|
||||
}
|
||||
- (void) setClassName: (NSString *)name;
|
||||
- (NSString *)className;
|
||||
- (void) setExtension: (NSString *)ext;
|
||||
- (NSString *)extension;
|
||||
- (void) setObject: (id)obj;
|
||||
- (id)object;
|
||||
@end
|
||||
|
||||
@interface NSControlTemplate : NSControl <__DeprecatedTemplate__>
|
||||
@interface NSCustomView : NSView
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_parentClassName;
|
||||
id _delegate;
|
||||
id _dataSource;
|
||||
BOOL _usesDataSource;
|
||||
NSString *_className;
|
||||
NSString *_extension;
|
||||
NSView *_superview;
|
||||
NSView *_view;
|
||||
}
|
||||
- (void) setClassName: (NSString *)name;
|
||||
- (NSString *)className;
|
||||
- (void) setExtension: (NSString *)view;
|
||||
- (NSString *)extension;
|
||||
- (id)nibInstantiate;
|
||||
@end
|
||||
|
||||
@interface NSButtonTemplate : NSButton <__DeprecatedTemplate__>
|
||||
@interface NSCustomResource : NSObject <NSCoding>
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_parentClassName;
|
||||
NSButtonType _buttonType;
|
||||
NSString *_className;
|
||||
NSString *_resourceName;
|
||||
}
|
||||
- (void) setClassName: (NSString *)className;
|
||||
- (NSString *)className;
|
||||
- (void) setResourceName: (NSString *)view;
|
||||
- (NSString *)resourceName;
|
||||
- (id)nibInstantiate;
|
||||
@end
|
||||
|
||||
@interface NSClassSwapper : NSObject <NSCoding>
|
||||
{
|
||||
NSString *_className;
|
||||
NSString *_originalClassName;
|
||||
id _template;
|
||||
}
|
||||
- (void) setTemplate: (id)temp;
|
||||
- (id) template;
|
||||
- (void) setClassName: (NSString *)className;
|
||||
- (NSString *)className;
|
||||
@end
|
||||
|
||||
@interface NSIBObjectData : NSObject <NSCoding, GSInstantiator, GSNibContainer>
|
||||
{
|
||||
id _root;
|
||||
NSMapTable *_objects;
|
||||
NSMapTable *_names;
|
||||
NSMapTable *_oids;
|
||||
NSMapTable *_classes;
|
||||
NSMapTable *_instantiatedObjs;
|
||||
NSMutableSet *_visibleWindows;
|
||||
NSMutableArray *_connections;
|
||||
id _firstResponder;
|
||||
id _fontManager;
|
||||
NSString *_framework;
|
||||
id _document;
|
||||
unsigned _nextOid;
|
||||
NSMutableArray *_accessibilityConnectors;
|
||||
NSMapTable *_accessibilityOids;
|
||||
}
|
||||
- (id) instantiateObject: (id)obj;
|
||||
- (void) nibInstantiateWithOwner: (id)owner;
|
||||
- (void) nibInstantiateWithOwner: (id)owner topLevelObjects: (NSMutableArray *)toplevel;
|
||||
- (id) objectForName: (NSString *)name;
|
||||
- (NSString *) nameForObject: (id)name;
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_GSNibCompatibility */
|
||||
|
|
41
Headers/Additions/GNUstepGUI/GSNibContainer.h
Normal file
41
Headers/Additions/GNUstepGUI/GSNibContainer.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
GSNibContainer.h
|
||||
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2006
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU 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_GSNibContainer
|
||||
#define _GNUstep_H_GSNibContainer
|
||||
|
||||
@class NSDictionary;
|
||||
@class NSMutableDictionary;
|
||||
@class NSMutableSet;
|
||||
@class NSMutableArray;
|
||||
|
||||
@protocol GSNibContainer
|
||||
- (void) awakeWithContext: (NSDictionary *)context;
|
||||
- (NSMutableDictionary*) nameTable;
|
||||
- (NSMutableArray*) connections;
|
||||
- (NSMutableSet*) topLevelObjects;
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_GSNibContainer */
|
|
@ -33,8 +33,9 @@
|
|||
#include <AppKit/NSText.h>
|
||||
#include <AppKit/NSTextView.h>
|
||||
#include <AppKit/NSControl.h>
|
||||
#include "GNUstepGUI/GSNibContainer.h"
|
||||
|
||||
// versions of the nib container and the templates.
|
||||
// version of the nib container and the templates.
|
||||
#define GNUSTEP_NIB_VERSION 1
|
||||
#define GSSWAPPER_VERSION 0
|
||||
#define GSWINDOWT_VERSION 1
|
||||
|
@ -62,17 +63,13 @@ enum {
|
|||
/*
|
||||
* This is the class that holds objects within a nib.
|
||||
*/
|
||||
@interface GSNibContainer : NSObject <NSCoding>
|
||||
@interface GSNibContainer : NSObject <NSCoding, GSNibContainer>
|
||||
{
|
||||
NSMutableDictionary *nameTable;
|
||||
NSMutableArray *connections;
|
||||
NSMutableSet *topLevelObjects;
|
||||
BOOL isAwake;
|
||||
}
|
||||
- (void) awakeWithContext: (NSDictionary *)context;
|
||||
- (NSMutableDictionary*) nameTable;
|
||||
- (NSMutableArray*) connections;
|
||||
- (NSMutableSet*) topLevelObjects;
|
||||
@end
|
||||
|
||||
/*
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
@interface NSNib : NSObject <NSCoding>
|
||||
{
|
||||
NSData *_nibData;
|
||||
NSMutableArray *_topLevelItems;
|
||||
id _loader;
|
||||
NSURL *_url;
|
||||
}
|
||||
|
||||
// reading the data...
|
||||
|
|
|
@ -200,8 +200,11 @@ GSWindowDecorationView.m \
|
|||
GSPrinting.m \
|
||||
GSPrintOperation.m \
|
||||
GSEPSPrintOperation.m \
|
||||
GSPDFPrintOperation.m
|
||||
|
||||
GSPDFPrintOperation.m \
|
||||
GSModelLoaderFactory.m \
|
||||
GSGormLoader.m \
|
||||
GSGModelLoader.m \
|
||||
GSNibLoader.m
|
||||
|
||||
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
|
||||
# but does not implement <NSObject>'s methods itself (it inherits
|
||||
|
@ -360,6 +363,7 @@ GSTextConverter.h \
|
|||
GSTrackingRect.h \
|
||||
GSHelpManagerPanel.h \
|
||||
GSNibTemplates.h \
|
||||
GSNibContainer.h \
|
||||
GSDisplayServer.h \
|
||||
GSFusedSilica.h \
|
||||
GSTable.h \
|
||||
|
@ -380,7 +384,9 @@ GSTitleView.h \
|
|||
GSPrinting.h \
|
||||
GSPrintOperation.h \
|
||||
GSEPSPrintOperation.h \
|
||||
GSPDFPrintOperation.h
|
||||
GSPDFPrintOperation.h \
|
||||
GSModelLoaderFactory.h \
|
||||
GSInstantiator.h
|
||||
|
||||
libgnustep-gui_HEADER_FILES = ${GUI_HEADERS}
|
||||
|
||||
|
|
103
Source/GSGModelLoader.m
Normal file
103
Source/GSGModelLoader.m
Normal file
|
@ -0,0 +1,103 @@
|
|||
/** <title>GSGormLoader</title>
|
||||
|
||||
<abstract>Gorm model loader</abstract>
|
||||
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2005
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU 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,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
#include "GNUstepGUI/IMLoading.h"
|
||||
|
||||
static
|
||||
Class gmodel_class(void)
|
||||
{
|
||||
static Class gmclass = Nil;
|
||||
|
||||
if (gmclass == Nil)
|
||||
{
|
||||
NSBundle *theBundle;
|
||||
NSEnumerator *benum;
|
||||
NSString *path;
|
||||
|
||||
/* Find the bundle */
|
||||
benum = [NSStandardLibraryPaths() objectEnumerator];
|
||||
while ((path = [benum nextObject]))
|
||||
{
|
||||
path = [path stringByAppendingPathComponent: @"Bundles"];
|
||||
path = [path stringByAppendingPathComponent: @"libgmodel.bundle"];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
|
||||
break;
|
||||
path = nil;
|
||||
}
|
||||
NSCAssert(path != nil, @"Unable to load gmodel bundle");
|
||||
NSDebugLog(@"Loading gmodel from %@", path);
|
||||
|
||||
theBundle = [NSBundle bundleWithPath: path];
|
||||
NSCAssert(theBundle != nil, @"Can't init gmodel bundle");
|
||||
gmclass = [theBundle classNamed: @"GMModel"];
|
||||
NSCAssert(gmclass, @"Can't load gmodel bundle");
|
||||
}
|
||||
return gmclass;
|
||||
}
|
||||
|
||||
@interface GSGModelLoader : GSModelLoader
|
||||
@end
|
||||
|
||||
@implementation GSGModelLoader
|
||||
+ (void) initialize
|
||||
{
|
||||
// register for the gmodel type.
|
||||
}
|
||||
|
||||
+ (NSString *) type
|
||||
{
|
||||
return @"gmodel";
|
||||
}
|
||||
|
||||
+ (float) priority
|
||||
{
|
||||
return 2.0;
|
||||
}
|
||||
|
||||
- (BOOL) loadModelFile: (NSString *)fileName
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
{
|
||||
NSString *ext = [fileName pathExtension];
|
||||
|
||||
/*
|
||||
* If the file to be read is a gmodel, use the GMModel method to
|
||||
* read it in and skip the dearchiving below.
|
||||
*/
|
||||
if ([ext isEqualToString: @"gmodel"])
|
||||
{
|
||||
return [gmodel_class() loadIMFile: fileName
|
||||
owner: [context objectForKey: @"NSOwner"]];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
@end
|
146
Source/GSGormLoader.m
Normal file
146
Source/GSGormLoader.m
Normal file
|
@ -0,0 +1,146 @@
|
|||
/** <title>GSGormLoader</title>
|
||||
|
||||
<abstract>Gorm model loader</abstract>
|
||||
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2005
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU 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,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
#include "GNUstepGUI/GSNibTemplates.h"
|
||||
|
||||
@interface GSGormLoader : GSModelLoader
|
||||
@end
|
||||
|
||||
@implementation GSGormLoader
|
||||
+ (void) initialize
|
||||
{
|
||||
// should do something...
|
||||
}
|
||||
|
||||
+ (NSString *)type
|
||||
{
|
||||
return @"gorm";
|
||||
}
|
||||
|
||||
+ (float) priority
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) loadModelData: (NSData *)data
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
{
|
||||
BOOL loaded = NO;
|
||||
NSUnarchiver *unarchiver = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
if (data != nil)
|
||||
{
|
||||
unarchiver = [[NSUnarchiver alloc]
|
||||
initForReadingWithData: data];
|
||||
if (unarchiver != nil)
|
||||
{
|
||||
id obj;
|
||||
|
||||
NSDebugLog(@"Invoking unarchiver");
|
||||
[unarchiver setObjectZone: zone];
|
||||
obj = [unarchiver decodeObject];
|
||||
if (obj != nil)
|
||||
{
|
||||
if ([obj isKindOfClass: [GSNibContainer class]])
|
||||
{
|
||||
NSDebugLog(@"Calling awakeWithContext");
|
||||
[obj awakeWithContext: context];
|
||||
loaded = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Gorm does not have a container object!");
|
||||
}
|
||||
}
|
||||
RELEASE(unarchiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Exception occured while loading model: %@",[localException reason]);
|
||||
TEST_RELEASE(unarchiver);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (loaded == NO)
|
||||
{
|
||||
NSLog(@"Failed to load Gorm\n");
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
- (BOOL) loadModelFile: (NSString *)fileName
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL isDir = NO;
|
||||
BOOL loaded = NO;
|
||||
|
||||
NSDebugLog(@"Loading Gorm `%@'...\n", fileName);
|
||||
|
||||
if ([mgr fileExistsAtPath: fileName isDirectory: &isDir])
|
||||
{
|
||||
NSData *data = nil;
|
||||
|
||||
// if the data is in a directory, then load from objects.gorm in the directory
|
||||
if (isDir == NO)
|
||||
{
|
||||
data = [NSData dataWithContentsOfFile: fileName];
|
||||
NSDebugLog(@"Loaded data from file...");
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *newFileName = [fileName stringByAppendingPathComponent: @"objects.gorm"];
|
||||
data = [NSData dataWithContentsOfFile: newFileName];
|
||||
NSDebugLog(@"Loaded data from %@...",newFileName);
|
||||
}
|
||||
|
||||
loaded = [self loadModelData: data
|
||||
externalNameTable: context
|
||||
withZone: zone];
|
||||
|
||||
// report a problem if there is one.
|
||||
if(loaded == NO)
|
||||
{
|
||||
NSLog(@"Could not load Gorm file: %@",fileName);
|
||||
}
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
@end
|
178
Source/GSModelLoaderFactory.m
Normal file
178
Source/GSModelLoaderFactory.m
Normal file
|
@ -0,0 +1,178 @@
|
|||
/** <title>GSModelLoaderFactory</title>
|
||||
|
||||
<abstract>Model loader framework</abstract>
|
||||
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2005
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU 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,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
#include "GNUstepBase/GSObjCRuntime.h"
|
||||
|
||||
@implementation GSModelLoader
|
||||
+ (NSString *) type
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (float) priority
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (BOOL) loadModelData: (NSData *)data
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Abstract model loader."];
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) loadModelFile: (NSString *)fileName
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Abstract model loader."];
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (NSComparisonResult) _comparePriority: (Class)loader
|
||||
{
|
||||
NSComparisonResult result = NSOrderedSame;
|
||||
|
||||
if([self priority] < [loader priority])
|
||||
{
|
||||
result = NSOrderedAscending;
|
||||
}
|
||||
if([self priority] > [loader priority])
|
||||
{
|
||||
result = NSOrderedDescending;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@end
|
||||
|
||||
static NSMutableDictionary *_modelMap = nil;
|
||||
|
||||
@implementation GSModelLoaderFactory
|
||||
+ (void) initialize
|
||||
{
|
||||
NSArray *classes = GSObjCAllSubclassesOfClass([GSModelLoader class]);
|
||||
NSEnumerator *en = [classes objectEnumerator];
|
||||
Class cls = nil;
|
||||
|
||||
while((cls = [en nextObject]) != nil)
|
||||
{
|
||||
[self registerModelLoaderClass: cls];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) registerModelLoaderClass: (Class)aClass
|
||||
{
|
||||
if(_modelMap == nil)
|
||||
{
|
||||
_modelMap = [[NSMutableDictionary alloc] initWithCapacity: 5];
|
||||
}
|
||||
|
||||
[_modelMap setObject: aClass forKey: (NSString *)[aClass type]];
|
||||
}
|
||||
|
||||
+ (Class)classForType: (NSString *)type
|
||||
{
|
||||
return [_modelMap objectForKey: type];
|
||||
}
|
||||
|
||||
+ (NSString *) supportedModelFileAtPath: (NSString *)modelPath
|
||||
{
|
||||
NSString *result = nil;
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
NSString *ext = [modelPath pathExtension];
|
||||
|
||||
if([ext isEqual: @""])
|
||||
{
|
||||
NSArray *objectArray = [_modelMap allValues];
|
||||
NSArray *sortedArray = [objectArray sortedArrayUsingSelector:
|
||||
@selector(_comparePriority:)];
|
||||
NSEnumerator *oen = [sortedArray objectEnumerator];
|
||||
Class cls = nil;
|
||||
|
||||
while((cls = [oen nextObject]) != nil && result == NO)
|
||||
{
|
||||
NSString *path = [modelPath stringByAppendingPathExtension:
|
||||
(NSString *)[cls type]];
|
||||
if([mgr isReadableFileAtPath: path])
|
||||
{
|
||||
result = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if([_modelMap objectForKey: ext] != nil)
|
||||
{
|
||||
if([mgr isReadableFileAtPath: modelPath])
|
||||
{
|
||||
result = modelPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (GSModelLoader *)modelLoaderForFileType: (NSString *)type
|
||||
{
|
||||
Class aClass = [GSModelLoaderFactory classForType: type];
|
||||
GSModelLoader *loader = nil;
|
||||
|
||||
if(aClass != nil)
|
||||
{
|
||||
loader = AUTORELEASE([[aClass alloc] init]);
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Unable to find model loader class."];
|
||||
}
|
||||
|
||||
return loader;
|
||||
}
|
||||
|
||||
+ (GSModelLoader *)modelLoaderForFileName: (NSString *)modelPath
|
||||
{
|
||||
NSString *path = [GSModelLoaderFactory supportedModelFileAtPath: modelPath];
|
||||
GSModelLoader *result = nil;
|
||||
|
||||
if(path != nil)
|
||||
{
|
||||
NSString *ext = [path pathExtension];
|
||||
result = [self modelLoaderForFileType: ext];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@end
|
File diff suppressed because it is too large
Load diff
145
Source/GSNibLoader.m
Normal file
145
Source/GSNibLoader.m
Normal file
|
@ -0,0 +1,145 @@
|
|||
/** <title>GSNibLoader</title>
|
||||
|
||||
<abstract>Nib (Cocoa XML) model loader</abstract>
|
||||
|
||||
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2005
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU 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,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
#include "GNUstepGUI/GSNibCompatibility.h"
|
||||
|
||||
@interface GSNibLoader : GSModelLoader
|
||||
@end
|
||||
|
||||
@implementation GSNibLoader
|
||||
+ (void) initialize
|
||||
{
|
||||
// should do something...
|
||||
}
|
||||
|
||||
+ (NSString *)type
|
||||
{
|
||||
return @"nib";
|
||||
}
|
||||
|
||||
+ (float) priority
|
||||
{
|
||||
return 3.0;
|
||||
}
|
||||
|
||||
- (BOOL) loadModelData: (NSData *)data
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
{
|
||||
BOOL loaded = NO;
|
||||
NSUnarchiver *unarchiver = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
if (data != nil)
|
||||
{
|
||||
unarchiver = [[NSKeyedUnarchiver alloc]
|
||||
initForReadingWithData: data];
|
||||
if (unarchiver != nil)
|
||||
{
|
||||
id obj;
|
||||
|
||||
NSDebugLog(@"Invoking unarchiver");
|
||||
[unarchiver setObjectZone: zone];
|
||||
obj = [unarchiver decodeObjectForKey: @"IB.objectdata"];
|
||||
if (obj != nil)
|
||||
{
|
||||
if ([obj isKindOfClass: [NSIBObjectData class]])
|
||||
{
|
||||
NSDebugLog(@"Calling awakeWithContext");
|
||||
[obj awakeWithContext: context];
|
||||
loaded = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Nib without container object!");
|
||||
}
|
||||
}
|
||||
RELEASE(unarchiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Exception occured while loading model: %@",[localException reason]);
|
||||
TEST_RELEASE(unarchiver);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (loaded == NO)
|
||||
{
|
||||
NSLog(@"Failed to load Nib\n");
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
- (BOOL) loadModelFile: (NSString *)fileName
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL isDir = NO;
|
||||
BOOL loaded = NO;
|
||||
|
||||
NSDebugLog(@"Loading Nib `%@'...\n", fileName);
|
||||
|
||||
if ([mgr fileExistsAtPath: fileName isDirectory: &isDir])
|
||||
{
|
||||
NSData *data = nil;
|
||||
|
||||
// if the data is in a directory, then load from keyedobjects.nib in the directory
|
||||
if (isDir == NO)
|
||||
{
|
||||
data = [NSData dataWithContentsOfFile: fileName];
|
||||
NSDebugLog(@"Loaded data from file...");
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *newFileName = [fileName stringByAppendingPathComponent: @"keyedobjects.nib"];
|
||||
data = [NSData dataWithContentsOfFile: newFileName];
|
||||
NSDebugLog(@"Loaded data from %@...",newFileName);
|
||||
}
|
||||
|
||||
loaded = [self loadModelData: data
|
||||
externalNameTable: context
|
||||
withZone: zone];
|
||||
|
||||
// report a problem if there is one.
|
||||
if(loaded == NO)
|
||||
{
|
||||
NSLog(@"Could not load Gorm file: %@",fileName);
|
||||
}
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
@end
|
|
@ -302,6 +302,15 @@ static Class controlClass;
|
|||
{
|
||||
[self setTag: [aDecoder decodeIntForKey: @"NSTag"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTarget"])
|
||||
{
|
||||
[self setTarget: [aDecoder decodeObjectForKey: @"NSTarget"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSAction"])
|
||||
{
|
||||
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||
[self setAction: NSSelectorFromString(action)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
Date: 1997
|
||||
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: 1999
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2000
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -45,10 +47,11 @@
|
|||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSKeyValueCoding.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <AppKit/NSControl.h>
|
||||
#include "AppKit/NSNibConnector.h"
|
||||
#include "AppKit/NSNibLoading.h"
|
||||
#include "GNUstepGUI/GSNibTemplates.h"
|
||||
#include "GNUstepGUI/IMLoading.h"
|
||||
#include "GNUstepGUI/GSInstantiator.h"
|
||||
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
|
||||
@implementation NSNibConnector
|
||||
|
||||
|
@ -67,9 +70,18 @@
|
|||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[aCoder encodeObject: _src];
|
||||
[aCoder encodeObject: _dst];
|
||||
[aCoder encodeObject: _tag];
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: _src forKey: @"NSSource"];
|
||||
[aCoder encodeObject: _dst forKey: @"NSDestination"];
|
||||
[aCoder encodeObject: _tag forKey: @"NSLabel"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _src];
|
||||
[aCoder encodeObject: _dst];
|
||||
[aCoder encodeObject: _tag];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) establishConnection
|
||||
|
@ -80,8 +92,8 @@
|
|||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
|
||||
ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
|
||||
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
|
||||
ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
|
||||
}
|
||||
else
|
||||
|
@ -144,6 +156,12 @@
|
|||
return desc;
|
||||
}
|
||||
|
||||
- (void) instantiateWithInstantiator: (id<GSInstantiator>)instantiator
|
||||
{
|
||||
_src = [instantiator instantiateObject: _src];
|
||||
_dst = [instantiator instantiateObject: _dst];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSNibControlConnector
|
||||
|
@ -196,139 +214,14 @@
|
|||
@end
|
||||
|
||||
@implementation NSBundle (NSBundleAdditions)
|
||||
|
||||
static
|
||||
Class gmodel_class(void)
|
||||
{
|
||||
static Class gmclass = Nil;
|
||||
|
||||
if (gmclass == Nil)
|
||||
{
|
||||
NSBundle *theBundle;
|
||||
NSEnumerator *benum;
|
||||
NSString *path;
|
||||
|
||||
/* Find the bundle */
|
||||
benum = [NSStandardLibraryPaths() objectEnumerator];
|
||||
while ((path = [benum nextObject]))
|
||||
{
|
||||
path = [path stringByAppendingPathComponent: @"Bundles"];
|
||||
path = [path stringByAppendingPathComponent: @"libgmodel.bundle"];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
|
||||
break;
|
||||
path = nil;
|
||||
}
|
||||
NSCAssert(path != nil, @"Unable to load gmodel bundle");
|
||||
NSDebugLog(@"Loading gmodel from %@", path);
|
||||
|
||||
theBundle = [NSBundle bundleWithPath: path];
|
||||
NSCAssert(theBundle != nil, @"Can't init gmodel bundle");
|
||||
gmclass = [theBundle classNamed: @"GMModel"];
|
||||
NSCAssert(gmclass, @"Can't load gmodel bundle");
|
||||
}
|
||||
return gmclass;
|
||||
}
|
||||
|
||||
+ (BOOL) loadNibFile: (NSString*)fileName
|
||||
externalNameTable: (NSDictionary*)context
|
||||
withZone: (NSZone*)zone
|
||||
{
|
||||
BOOL loaded = NO;
|
||||
NSUnarchiver *unarchiver = nil;
|
||||
NSString *ext = [fileName pathExtension];
|
||||
|
||||
if ([ext isEqual: @"nib"])
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
NSString *base = [fileName stringByDeletingPathExtension];
|
||||
|
||||
/* We can't read nibs, look for an equivalent gorm or gmodel file */
|
||||
fileName = [base stringByAppendingPathExtension: @"gorm"];
|
||||
if ([mgr isReadableFileAtPath: fileName])
|
||||
{
|
||||
ext = @"gorm";
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = [base stringByAppendingPathExtension: @"gmodel"];
|
||||
ext = @"gmodel";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the file to be read is a gmodel, use the GMModel method to
|
||||
* read it in and skip the dearchiving below.
|
||||
*/
|
||||
if ([ext isEqualToString: @"gmodel"])
|
||||
{
|
||||
return [gmodel_class() loadIMFile: fileName
|
||||
owner: [context objectForKey: @"NSOwner"]];
|
||||
}
|
||||
|
||||
NSDebugLog(@"Loading Nib `%@'...\n", fileName);
|
||||
NS_DURING
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL isDir = NO;
|
||||
|
||||
if ([mgr fileExistsAtPath: fileName isDirectory: &isDir])
|
||||
{
|
||||
NSData *data = nil;
|
||||
|
||||
// if the data is in a directory, then load from objects.gorm in the directory
|
||||
if (isDir == NO)
|
||||
{
|
||||
data = [NSData dataWithContentsOfFile: fileName];
|
||||
NSDebugLog(@"Loaded data from file...");
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *newFileName = [fileName stringByAppendingPathComponent: @"objects.gorm"];
|
||||
data = [NSData dataWithContentsOfFile: newFileName];
|
||||
NSDebugLog(@"Loaded data from %@...",newFileName);
|
||||
}
|
||||
|
||||
if (data != nil)
|
||||
{
|
||||
unarchiver = [[NSUnarchiver alloc] initForReadingWithData: data];
|
||||
if (unarchiver != nil)
|
||||
{
|
||||
id obj;
|
||||
|
||||
NSDebugLog(@"Invoking unarchiver");
|
||||
[unarchiver setObjectZone: zone];
|
||||
obj = [unarchiver decodeObject];
|
||||
if (obj != nil)
|
||||
{
|
||||
if ([obj isKindOfClass: [GSNibContainer class]])
|
||||
{
|
||||
NSDebugLog(@"Calling awakeWithContext");
|
||||
[obj awakeWithContext: context];
|
||||
loaded = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Nib '%@' without container object!", fileName);
|
||||
}
|
||||
}
|
||||
// RELEASE(nibitems);
|
||||
RELEASE(unarchiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Exception occured while loading model: %@",[localException reason]);
|
||||
// TEST_RELEASE(nibitems);
|
||||
TEST_RELEASE(unarchiver);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (loaded == NO)
|
||||
{
|
||||
NSLog(@"Failed to load Nib\n");
|
||||
}
|
||||
GSModelLoader *loader = [GSModelLoaderFactory modelLoaderForFileName: fileName];
|
||||
BOOL loaded = [loader loadModelFile: fileName
|
||||
externalNameTable: context
|
||||
withZone: zone];
|
||||
return loaded;
|
||||
}
|
||||
|
||||
|
@ -374,21 +267,12 @@ Class gmodel_class(void)
|
|||
|
||||
- (NSString *) pathForNibResource: (NSString *)fileName
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 8];
|
||||
NSArray *languages = [NSUserDefaults userLanguages];
|
||||
NSString *rootPath = [self bundlePath];
|
||||
NSString *primary;
|
||||
NSString *language;
|
||||
NSEnumerator *enumerator;
|
||||
NSString *ext;
|
||||
|
||||
ext = [fileName pathExtension];
|
||||
fileName = [fileName stringByDeletingPathExtension];
|
||||
if ([ext isEqualToString: @"nib"] == YES)
|
||||
{
|
||||
ext = @"";
|
||||
}
|
||||
|
||||
/*
|
||||
* Build an array of resource paths that differs from the normal order -
|
||||
|
@ -418,32 +302,13 @@ Class gmodel_class(void)
|
|||
enumerator = [array objectEnumerator];
|
||||
while ((rootPath = [enumerator nextObject]) != nil)
|
||||
{
|
||||
NSString *path;
|
||||
|
||||
rootPath = [rootPath stringByAppendingPathComponent: fileName];
|
||||
// If the file does not have an extension, then we need to
|
||||
// figure out what type of model file to load.
|
||||
if ([ext isEqualToString: @""] == YES)
|
||||
NSString *modelPath = [rootPath stringByAppendingPathComponent: fileName];
|
||||
NSString *path = [GSModelLoaderFactory supportedModelFileAtPath: modelPath];
|
||||
|
||||
if(path != nil)
|
||||
{
|
||||
path = [rootPath stringByAppendingPathExtension: @"gorm"];
|
||||
if ([mgr isReadableFileAtPath: path] == NO)
|
||||
{
|
||||
path = [rootPath stringByAppendingPathExtension: @"gmodel"];
|
||||
if ([mgr isReadableFileAtPath: path] == NO)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
path = [rootPath stringByAppendingPathExtension: ext];
|
||||
if ([mgr isReadableFileAtPath: path])
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
|
|
@ -55,6 +55,53 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
typedef struct _GSButtonCellFlags
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
unsigned int isPushin:1;
|
||||
unsigned int changeContents:1;
|
||||
unsigned int changeBackground:1;
|
||||
unsigned int changeGray:1;
|
||||
unsigned int highlightByContents:1;
|
||||
unsigned int highlightByBackground:1;
|
||||
unsigned int highlightByGray:1;
|
||||
unsigned int drawing:1;
|
||||
unsigned int isBordered:1;
|
||||
unsigned int imageDoesOverlap:1;
|
||||
unsigned int isHorizontal:1;
|
||||
unsigned int isBottomOrLeft:1;
|
||||
unsigned int isImageAndText:1;
|
||||
unsigned int isImageSizeDiff:1;
|
||||
unsigned int hasKeyEquiv:1;
|
||||
unsigned int lastState:1;
|
||||
unsigned int isTransparent:1;
|
||||
unsigned int unused2:6; // inset:2 doesn't dim:1 gradient:3
|
||||
unsigned int useButtonImageSource:1;
|
||||
unsigned int unused3:8; // alt mnemonic loc.
|
||||
#else
|
||||
unsigned int unused3:8; // alt mnemonic loc.
|
||||
unsigned int useButtonImageSource:1;
|
||||
unsigned int unused0:6; // inset:2 doesn't dim:1 gradient:3
|
||||
unsigned int isTransparent:1;
|
||||
unsigned int lastState:1;
|
||||
unsigned int hasKeyEquiv:1;
|
||||
unsigned int isImageSizeDiff:1;
|
||||
unsigned int isImageAndText:1;
|
||||
unsigned int isBottomOrLeft:1;
|
||||
unsigned int isHorizontal:1;
|
||||
unsigned int imageDoesOverlap:1;
|
||||
unsigned int isBordered:1;
|
||||
unsigned int drawing:1;
|
||||
unsigned int highlightByGray:1;
|
||||
unsigned int highlightByBackground:1;
|
||||
unsigned int highlightByContents:1;
|
||||
unsigned int changeGray:1;
|
||||
unsigned int changeBackground:1;
|
||||
unsigned int changeContents:1;
|
||||
unsigned int isPushin:1;
|
||||
#endif
|
||||
} GSButtonCellFlags;
|
||||
|
||||
@interface NSButtonCell (Private)
|
||||
// Overriden private internal method
|
||||
- (void) _drawImage: (NSImage *)anImage inFrame: (NSRect)aRect
|
||||
|
@ -1398,8 +1445,9 @@
|
|||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
// FIXME: Add new ivars
|
||||
BOOL tmp;
|
||||
|
||||
// FIXME: Add new ivars
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeObject: _keyEquivalent];
|
||||
|
@ -1424,10 +1472,10 @@
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
//NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
||||
int delay = 0;
|
||||
int interval = 0;
|
||||
|
||||
int interval = 0;
|
||||
// NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSKeyEquivalent"])
|
||||
{
|
||||
[self setKeyEquivalent: [aDecoder decodeObjectForKey: @"NSKeyEquivalent"]];
|
||||
|
@ -1436,52 +1484,38 @@
|
|||
{
|
||||
[self setImage: [aDecoder decodeObjectForKey: @"NSNormalImage"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSAlternateImage"])
|
||||
{
|
||||
id image;
|
||||
|
||||
image = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
|
||||
// This test works around an Apple bug, where a font gets encoded here.
|
||||
if ([image isKindOfClass: [NSImage class]])
|
||||
{
|
||||
[self setAlternateImage: image];
|
||||
}
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSAlternateContents"])
|
||||
{
|
||||
[self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
|
||||
{
|
||||
int bFlags;
|
||||
unsigned int bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
||||
int highlights = 0;
|
||||
int show_state = NSNoCellMask;
|
||||
GSButtonCellFlags buttonCellFlags;
|
||||
memcpy((void *)&buttonCellFlags,(void *)&bFlags,sizeof(struct _GSButtonCellFlags));
|
||||
|
||||
bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
||||
|
||||
[self setTransparent: (bFlags & 0x8000)];
|
||||
// FIXME
|
||||
if ((bFlags & 0x800000) == 0x800000)
|
||||
{
|
||||
[self setBordered: YES];
|
||||
}
|
||||
if ((bFlags & 0x6000000) == 0x6000000)
|
||||
[self setTransparent: buttonCellFlags.isTransparent];
|
||||
[self setBordered: buttonCellFlags.isBordered];
|
||||
|
||||
if (buttonCellFlags.highlightByBackground)
|
||||
{
|
||||
highlights |= NSChangeBackgroundCellMask;
|
||||
}
|
||||
if ((bFlags & 0x8000000) == 0x8000000)
|
||||
if (buttonCellFlags.highlightByContents)
|
||||
{
|
||||
highlights |= NSContentsCellMask;
|
||||
}
|
||||
if ((bFlags & 0x30000000) == 0x30000000)
|
||||
if (buttonCellFlags.changeBackground)
|
||||
{
|
||||
show_state |= NSChangeBackgroundCellMask;
|
||||
}
|
||||
if ((bFlags & 0x40000000) == 0x40000000)
|
||||
if (buttonCellFlags.changeContents)
|
||||
{
|
||||
show_state |= NSContentsCellMask;
|
||||
}
|
||||
if ((bFlags & 0x80000000) == 0x80000000)
|
||||
if (buttonCellFlags.isPushin)
|
||||
{
|
||||
highlights |= NSPushInCellMask;
|
||||
}
|
||||
|
@ -1532,6 +1566,40 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSAlternateImage"])
|
||||
{
|
||||
id image;
|
||||
|
||||
//
|
||||
// NOTE: Okay... this is a humongous kludge. It seems as though
|
||||
// Cocoa is doing something very odd here. It doesn't seem to
|
||||
// encode system images for buttons normally, if it is using
|
||||
// images at all. Until I figure out what, this will stay.
|
||||
// Danger, Will Robinson! :)
|
||||
//
|
||||
image = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
|
||||
if ([image isKindOfClass: [NSImage class]])
|
||||
{
|
||||
if([NSImage imageNamed: @"NSSwitch"] == image)
|
||||
{
|
||||
image = [NSImage imageNamed: @"NSHighlightedSwitch"];
|
||||
if([self image] == nil)
|
||||
{
|
||||
[self setImage: [NSImage imageNamed: @"NSSwitch"]];
|
||||
}
|
||||
}
|
||||
else if([NSImage imageNamed: @"NSRadioButton"] == image)
|
||||
{
|
||||
image = [NSImage imageNamed: @"NSHighlightedRadioButton"];
|
||||
if([self image] == nil)
|
||||
{
|
||||
[self setImage: [NSImage imageNamed: @"NSRadioButton"]];
|
||||
}
|
||||
}
|
||||
|
||||
[self setAlternateImage: image];
|
||||
}
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSPeriodicDelay"])
|
||||
{
|
||||
delay = [aDecoder decodeIntForKey: @"NSPeriodicDelay"];
|
||||
|
|
|
@ -2256,13 +2256,12 @@ static NSColor *shadowCol;
|
|||
|
||||
if ([aDecoder containsValueForKey: @"NSCellFlags"])
|
||||
{
|
||||
int cFlags;
|
||||
unsigned long cFlags;
|
||||
|
||||
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"];
|
||||
|
||||
// This bit flag is the other way around!
|
||||
[self setWraps: ((cFlags & 0x40) != 0x40)];
|
||||
[self setContinuous: ((cFlags & 0x80000) == 0x80000)];
|
||||
[self setScrollable: ((cFlags & 0x100000) == 0x100000)];
|
||||
// Strange that this is not a simple bit flag
|
||||
[self setSelectable: ((cFlags & 0x200001) == 0x200001)];
|
||||
|
@ -2272,12 +2271,13 @@ static NSColor *shadowCol;
|
|||
{
|
||||
[self setType: NSTextCellType];
|
||||
}
|
||||
|
||||
[self setContinuous: ((cFlags & 0x40000) == 0x40000)];
|
||||
[self setEditable: ((cFlags & 0x10000000) == 0x10000000)];
|
||||
// This bit flag is the other way around!
|
||||
[self setEnabled: ((cFlags & 0x20000000) != 0x20000000)];
|
||||
[self setHighlighted: ((cFlags & 0x40000000) == 0x40000000)];
|
||||
// FIXME
|
||||
|
||||
[self setState: ((cFlags & 0x80000000) == 0x80000000)?NSOnState:NSOffState];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSCellFlags2"])
|
||||
{
|
||||
|
@ -2306,7 +2306,6 @@ static NSColor *shadowCol;
|
|||
|
||||
[self setImportsGraphics: ((cFlags2 & 0x20000000) == 0x20000000)];
|
||||
[self setAllowsEditingTextAttributes: ((cFlags2 & 0x40000000) == 0x40000000)];
|
||||
// FIXME
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSupport"])
|
||||
{
|
||||
|
|
|
@ -753,29 +753,54 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
[aCoder encodeObject: [self backgroundColor] forKey: @"NSBGColor"];
|
||||
[aCoder encodeObject: [self documentCursor] forKey: @"NSCursor"];
|
||||
[aCoder encodeObject: [self documentView] forKey: @"NSDocView"];
|
||||
|
||||
if([self drawsBackground])
|
||||
flags |= 4;
|
||||
if([self copiesOnScroll] == NO)
|
||||
flags |= 2;
|
||||
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsBackground];
|
||||
[aCoder encodeObject: _cursor];
|
||||
[aCoder encodeInt: flags forKey: @"NScvFlags"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsBackground];
|
||||
[aCoder encodeObject: _cursor];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
int flags;
|
||||
|
||||
[self setAutoresizesSubviews: YES];
|
||||
|
||||
[self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSBGColor"]];
|
||||
[self setDocumentCursor: [aDecoder decodeObjectForKey: @"NSCursor"]];
|
||||
[self setDocumentView: [aDecoder decodeObjectForKey: @"NSDocView"]];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NScvFlags"])
|
||||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NScvFlags"];
|
||||
// FIXME setCopiesOnScroll: setDrawsBackground:
|
||||
int flags = [aDecoder decodeIntForKey: @"NScvFlags"];
|
||||
BOOL drawsBackground = ((4 & flags) > 0);
|
||||
BOOL noCopyOnScroll = ((2 & flags) > 0); // ??? Not sure...
|
||||
|
||||
[self setCopiesOnScroll: (noCopyOnScroll == NO)];
|
||||
[self setDrawsBackground: drawsBackground];
|
||||
}
|
||||
|
||||
if ([[self subviews] count] > 0)
|
||||
{
|
||||
id document = [aDecoder decodeObjectForKey: @"NSDocView"];
|
||||
[self removeSubview: document];
|
||||
[self setDocumentView: document];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -235,11 +235,22 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
[aCoder encodeObject: _the_color];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_active];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_bordered];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: _the_color forKey: @"NSColor"];
|
||||
// [aCoder encodeBool: _is_active forKey: @"NSEnabled"];
|
||||
[aCoder encodeBool: _is_bordered forKey: @"NSIsBordered"];
|
||||
[aCoder encodeConditionalObject: _target forKey: @"NSTarget"];
|
||||
[aCoder encodeConditionalObject: NSStringFromSelector(_action) forKey: @"NSAction"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _the_color];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_active];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_bordered];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
@ -247,15 +258,31 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
|
|||
self = [super initWithCoder: aDecoder];
|
||||
if (self != nil)
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_the_color];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_active];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_bordered];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_target];
|
||||
// Undo RETAIN by decoder
|
||||
TEST_RELEASE(_target);
|
||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
[self registerForDraggedTypes:
|
||||
[NSArray arrayWithObjects: NSColorPboardType, nil]];
|
||||
if([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *action;
|
||||
|
||||
ASSIGN(_the_color, [aDecoder decodeObjectForKey: @"NSColor"]);
|
||||
// _is_active = [aDecoder decodeBoolForKey: @"NSEnabled"];
|
||||
_is_bordered = [aDecoder decodeBoolForKey: @"NSIsBordered"];
|
||||
_target = [aDecoder decodeObjectForKey: @"NSTarget"];
|
||||
action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||
_action = NSSelectorFromString(action);
|
||||
[self registerForDraggedTypes:
|
||||
[NSArray arrayWithObjects: NSColorPboardType, nil]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_the_color];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_active];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_bordered];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_target];
|
||||
// Undo RETAIN by decoder
|
||||
TEST_RELEASE(_target);
|
||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
[self registerForDraggedTypes:
|
||||
[NSArray arrayWithObjects: NSColorPboardType, nil]];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -2183,7 +2183,9 @@ no_soft_invalidation:
|
|||
if ([aDecoder containsValueForKey: @"NSLMFlags"])
|
||||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NSLMFlags"];
|
||||
// FIXME
|
||||
// nothing really to do with these flags....
|
||||
// they are runtime flags which, even if set into the archive
|
||||
// they are ignored...
|
||||
}
|
||||
[self setDelegate: delegate];
|
||||
[storage addLayoutManager: self];
|
||||
|
|
|
@ -121,6 +121,40 @@ typedef struct {
|
|||
int height;
|
||||
} MRect;
|
||||
|
||||
typedef struct _GSMatrixFlags {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
unsigned int isHighlight:1;
|
||||
unsigned int isRadio:1;
|
||||
unsigned int isList:1;
|
||||
unsigned int allowsEmptySelection:1;
|
||||
unsigned int autoScroll:1;
|
||||
unsigned int selectionByRect:1;
|
||||
unsigned int drawCellBackground:1;
|
||||
unsigned int drawBackground:1;
|
||||
unsigned int autosizesCells:1;
|
||||
unsigned int drawingAncestor:1;
|
||||
unsigned int tabKeyTraversesCells:1;
|
||||
unsigned int tabKeyTraversesCellsExplicitly:1;
|
||||
unsigned int canSearchIncrementally:1;
|
||||
unsigned int unused:19;
|
||||
#else
|
||||
unsigned int unused:19;
|
||||
unsigned int canSearchIncrementally:1;
|
||||
unsigned int tabKeyTraversesCellsExplicitly:1;
|
||||
unsigned int tabKeyTraversesCells:1;
|
||||
unsigned int drawingAncestor:1;
|
||||
unsigned int autosizesCells:1;
|
||||
unsigned int drawBackground:1;
|
||||
unsigned int drawCellBackground:1;
|
||||
unsigned int selectionByRect:1;
|
||||
unsigned int autoScroll:1;
|
||||
unsigned int allowsEmptySelection:1;
|
||||
unsigned int isList:1;
|
||||
unsigned int isRadio:1;
|
||||
unsigned int isHighlight:1;
|
||||
#endif
|
||||
} GSMatrixFlags;
|
||||
|
||||
static inline MPoint MakePoint (int x, int y)
|
||||
{
|
||||
MPoint point = { x, y };
|
||||
|
@ -2719,10 +2753,28 @@ static SEL getSel;
|
|||
}
|
||||
if ([aDecoder containsValueForKey: @"NSMatrixFlags"])
|
||||
{
|
||||
int mFlags;
|
||||
int mFlags = [aDecoder decodeIntForKey: @"NSMatrixFlags"];
|
||||
GSMatrixFlags matrixFlags;
|
||||
memcpy((void *)&matrixFlags,(void *)&mFlags,sizeof(struct _GSMatrixFlags));
|
||||
|
||||
mFlags = [aDecoder decodeIntForKey: @"NSMatrixFlags"];
|
||||
// FIXME
|
||||
if(matrixFlags.isRadio)
|
||||
{
|
||||
[self setMode: NSRadioModeMatrix];
|
||||
}
|
||||
else if(matrixFlags.isList)
|
||||
{
|
||||
[self setMode: NSListModeMatrix];
|
||||
}
|
||||
else if(matrixFlags.isHighlight)
|
||||
{
|
||||
[self setMode: NSHighlightModeMatrix];
|
||||
}
|
||||
|
||||
[self setAllowsEmptySelection: matrixFlags.allowsEmptySelection];
|
||||
[self setSelectionByRect: matrixFlags.selectionByRect];
|
||||
[self setDrawsCellBackground: matrixFlags.drawCellBackground];
|
||||
[self setDrawsBackground: matrixFlags.drawBackground];
|
||||
_tabKeyTraversesCells = matrixFlags.tabKeyTraversesCells;
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSNumCols"])
|
||||
{
|
||||
|
|
|
@ -436,22 +436,40 @@ static Class imageClass;
|
|||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[aCoder encodeObject: _title];
|
||||
[aCoder encodeObject: _keyEquivalent];
|
||||
[aCoder encodeValueOfObjCType: "I" at: &_keyEquivalentModifierMask];
|
||||
[aCoder encodeValueOfObjCType: "I" at: &_mnemonicLocation];
|
||||
[aCoder encodeValueOfObjCType: "i" at: &_state];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_enabled];
|
||||
[aCoder encodeObject: _image];
|
||||
[aCoder encodeObject: _onStateImage];
|
||||
[aCoder encodeObject: _offStateImage];
|
||||
[aCoder encodeObject: _mixedStateImage];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_changesState];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
[aCoder encodeValueOfObjCType: "i" at: &_tag];
|
||||
[aCoder encodeConditionalObject: _representedObject];
|
||||
[aCoder encodeObject: _submenu];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: _title forKey: @"NSTitle"];
|
||||
[aCoder encodeObject: NSStringFromSelector(_action) forKey: @"NSAction"];
|
||||
[aCoder encodeObject: _keyEquivalent forKey: @"NSKeyEquiv"];
|
||||
[aCoder encodeObject: _onStateImage forKey: @"NSOnImage"];
|
||||
[aCoder encodeObject: _offStateImage forKey: @"NSOffImage"]; // ???????
|
||||
[aCoder encodeObject: _mixedStateImage forKey: @"NSMixedImage"];
|
||||
[aCoder encodeObject: _target forKey: @"NSTarget"];
|
||||
[aCoder encodeObject: _menu forKey: @"NSMenu"];
|
||||
[aCoder encodeObject: _submenu forKey: @"NSSubmenu"];
|
||||
[aCoder encodeInt: _keyEquivalentModifierMask forKey: @"NSKeyEquivModMask"];
|
||||
[aCoder encodeInt: _mnemonicLocation forKey: @"NSMnemonicLoc"];
|
||||
[aCoder encodeInt: _state forKey: @"NSState"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _title];
|
||||
[aCoder encodeObject: _keyEquivalent];
|
||||
[aCoder encodeValueOfObjCType: "I" at: &_keyEquivalentModifierMask];
|
||||
[aCoder encodeValueOfObjCType: "I" at: &_mnemonicLocation];
|
||||
[aCoder encodeValueOfObjCType: "i" at: &_state];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_enabled];
|
||||
[aCoder encodeObject: _image];
|
||||
[aCoder encodeObject: _onStateImage];
|
||||
[aCoder encodeObject: _offStateImage];
|
||||
[aCoder encodeObject: _mixedStateImage];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_changesState];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
[aCoder encodeValueOfObjCType: "i" at: &_tag];
|
||||
[aCoder encodeConditionalObject: _representedObject];
|
||||
[aCoder encodeObject: _submenu];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
@ -461,10 +479,11 @@ static Class imageClass;
|
|||
NSString *title = [aDecoder decodeObjectForKey: @"NSTitle"];
|
||||
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquiv"];
|
||||
//NSMenu *menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
||||
NSImage *mixedImage = [aDecoder decodeObjectForKey: @"NSMixedImage"];
|
||||
NSImage *onImage = [aDecoder decodeObjectForKey: @"NSOnImage"];
|
||||
id target = [aDecoder decodeObjectForKey: @"NSTarget"];
|
||||
id target = [aDecoder decodeObjectForKey: @"NSTarget"];
|
||||
NSMenu *menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
||||
NSMenu *submenu = [aDecoder decodeObjectForKey: @"NSSubmenu"];
|
||||
|
||||
self = [self initWithTitle: title
|
||||
action: NSSelectorFromString(action)
|
||||
|
@ -472,10 +491,12 @@ static Class imageClass;
|
|||
[self setTarget: target];
|
||||
[self setMixedStateImage: mixedImage];
|
||||
[self setOnStateImage: onImage];
|
||||
[self setSubmenu: submenu];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSKeyEquivModMask"])
|
||||
{
|
||||
//int keyMask = [aDecoder decodeIntForKey: @"NSKeyEquivModMask"];
|
||||
int keyMask = [aDecoder decodeIntForKey: @"NSKeyEquivModMask"];
|
||||
[self setKeyEquivalentModifierMask: keyMask];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSMnemonicLoc"])
|
||||
{
|
||||
|
@ -485,7 +506,6 @@ static Class imageClass;
|
|||
if ([aDecoder containsValueForKey: @"NSState"])
|
||||
{
|
||||
int state = [aDecoder decodeIntForKey: @"NSState"];
|
||||
|
||||
[self setState: state];
|
||||
}
|
||||
}
|
||||
|
|
131
Source/NSNib.m
131
Source/NSNib.m
|
@ -51,57 +51,21 @@
|
|||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSException.h>
|
||||
|
||||
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
#include "GNUstepGUI/GSNibTemplates.h"
|
||||
#include "GNUstepGUI/IMLoading.h"
|
||||
|
||||
@implementation NSNib
|
||||
|
||||
// Private methods...
|
||||
+ (NSString *) _nibFilename: (NSString *)fileName
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL isDir = NO;
|
||||
NSString *newFileName = nil;
|
||||
|
||||
// assign the filename...
|
||||
ASSIGN(newFileName, fileName);
|
||||
|
||||
// detect if it's a directory or not...
|
||||
if ([mgr fileExistsAtPath: fileName isDirectory: &isDir])
|
||||
{
|
||||
// if the data is in a directory, then load from objects.gorm in the directory
|
||||
if (isDir == YES)
|
||||
{
|
||||
newFileName = [fileName stringByAppendingPathComponent: @"objects.gorm"];
|
||||
}
|
||||
}
|
||||
|
||||
return newFileName;
|
||||
}
|
||||
|
||||
// private method to read in the data...
|
||||
- (void) _readNibData: (NSString *)fileName
|
||||
{
|
||||
NSString *ext = [fileName pathExtension];
|
||||
|
||||
if ([ext isEqual: @"nib"])
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
NSString *base = [fileName stringByDeletingPathExtension];
|
||||
|
||||
/* We can't read nibs, look for an equivalent gorm or gmodel file */
|
||||
fileName = [base stringByAppendingPathExtension: @"gorm"];
|
||||
if ([mgr isReadableFileAtPath: fileName])
|
||||
{
|
||||
ext = @"gorm";
|
||||
}
|
||||
}
|
||||
|
||||
NSDebugLog(@"Loading Nib `%@'...\n", fileName);
|
||||
NSDebugLog(@"Loading model `%@'...\n", fileName);
|
||||
NS_DURING
|
||||
{
|
||||
NSString *newFileName = [NSNib _nibFilename: fileName];
|
||||
_nibData = [NSData dataWithContentsOfFile: newFileName];
|
||||
NSString *newFileName = [GSModelLoaderFactory supportedModelFileAtPath: fileName];
|
||||
ASSIGN(_nibData, [NSData dataWithContentsOfFile: newFileName]);
|
||||
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileName: newFileName]);
|
||||
NSDebugLog(@"Loaded data from %@...",newFileName);
|
||||
}
|
||||
NS_HANDLER
|
||||
|
@ -155,6 +119,7 @@
|
|||
{
|
||||
// load the nib data into memory...
|
||||
_nibData = [NSData dataWithContentsOfURL: nibFileURL];
|
||||
ASSIGN(_url, nibFileURL);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -192,51 +157,9 @@
|
|||
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
|
||||
withZone: (NSZone *)zone
|
||||
{
|
||||
BOOL loaded = NO;
|
||||
NSUnarchiver *unarchiver = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
if (_nibData != nil)
|
||||
{
|
||||
unarchiver = [[NSUnarchiver alloc] initForReadingWithData: _nibData];
|
||||
if (unarchiver != nil)
|
||||
{
|
||||
id obj;
|
||||
|
||||
[unarchiver setObjectZone: zone];
|
||||
obj = [unarchiver decodeObject];
|
||||
if (obj != nil)
|
||||
{
|
||||
if ([obj isKindOfClass: [GSNibContainer class]])
|
||||
{
|
||||
NSDictionary *nameTable = [self _copyTable: externalNameTable];
|
||||
[obj awakeWithContext: nameTable];
|
||||
loaded = YES;
|
||||
RELEASE(nameTable);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Nib '%@' without container object!");
|
||||
}
|
||||
}
|
||||
RELEASE(unarchiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Exception occured while loading model: %@",[localException reason]);
|
||||
TEST_RELEASE(unarchiver);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (loaded == NO)
|
||||
{
|
||||
NSLog(@"Failed to load Nib\n");
|
||||
}
|
||||
|
||||
return loaded;
|
||||
return [_loader loadModelData: _nibData
|
||||
externalNameTable: externalNameTable
|
||||
withZone: zone];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,21 +200,49 @@
|
|||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
[coder decodeValueOfObjCType: @encode(id)
|
||||
at: &_nibData];
|
||||
//
|
||||
// NOTE: This is okay, since the only encodings which will ever be built into
|
||||
// the gui library are nib and gorm. GModel only supports certain
|
||||
// objects and is going to be deprecated in the future. There just so
|
||||
// happens to be a one to one correspondence here.
|
||||
//
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
// Need to verify this key...
|
||||
ASSIGN(_nibData, [coder decodeObjectForKey: @"NSData"]);
|
||||
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType: @"nib"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is sort of a kludge...
|
||||
[coder decodeValueOfObjCType: @encode(id)
|
||||
at: &_nibData];
|
||||
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType: @"gorm"]);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
[coder encodeValueOfObjCType: @encode(id)
|
||||
at: &_nibData];
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
// Need to verify this key...
|
||||
[coder encodeObject: _nibData
|
||||
forKey: @"NSData"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder encodeValueOfObjCType: @encode(id)
|
||||
at: &_nibData];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_nibData);
|
||||
RELEASE(_loader);
|
||||
TEST_RELEASE(_url);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -756,35 +756,65 @@ static NSImage *unexpandable = nil;
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autosaveExpandedItems];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_indentationPerLevel];
|
||||
[aCoder encodeConditionalObject: _outlineTableColumn];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autosaveExpandedItems];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_indentationPerLevel];
|
||||
[aCoder encodeConditionalObject: _outlineTableColumn];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
// Since we only have one version....
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autosaveExpandedItems];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_indentationPerLevel];
|
||||
_outlineTableColumn = [aDecoder decodeObject];
|
||||
|
||||
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
_items = [[NSMutableArray alloc] init];
|
||||
_expandedItems = [[NSMutableArray alloc] init];
|
||||
_selectedItems = [[NSMutableArray alloc] init];
|
||||
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
if([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
64);
|
||||
_items = [[NSMutableArray alloc] init];
|
||||
_expandedItems = [[NSMutableArray alloc] init];
|
||||
_selectedItems = [[NSMutableArray alloc] init];
|
||||
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
|
||||
// these can't be chosen on IB.
|
||||
_indentationPerLevel = 10.0;
|
||||
_indentationMarkerFollowsCell = YES;
|
||||
_autoResizesOutlineColumn = NO;
|
||||
_autosaveExpandedItems = NO;
|
||||
|
||||
// init the table column... (this can't be chosen on IB either)...
|
||||
if([_tableColumns count] > 0)
|
||||
{
|
||||
_outlineTableColumn = [_tableColumns objectAtIndex: 0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autosaveExpandedItems];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_indentationPerLevel];
|
||||
_outlineTableColumn = [aDecoder decodeObject];
|
||||
|
||||
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
_items = [[NSMutableArray alloc] init];
|
||||
_expandedItems = [[NSMutableArray alloc] init];
|
||||
_selectedItems = [[NSMutableArray alloc] init];
|
||||
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks,
|
||||
64);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -1010,6 +1010,7 @@ static NSImage *_pbc_image[2];
|
|||
}
|
||||
|
||||
menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
||||
[self setMenu: nil];
|
||||
[self setMenu: menu];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -42,6 +42,27 @@
|
|||
#include "AppKit/PSOperators.h"
|
||||
#include "GNUstepGUI/GSDrawFunctions.h"
|
||||
|
||||
//
|
||||
// For nib compatibility, this is used to properly
|
||||
// initialize the object from a OS X nib file in initWithCoder:.
|
||||
//
|
||||
typedef struct _scrollViewFlags
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
unsigned int __unused4:26;
|
||||
unsigned int hasHScroller:1; // 16
|
||||
unsigned int hasVScroller:1; // 32
|
||||
unsigned int __unused0:2;
|
||||
NSBorderType border:2;
|
||||
#else
|
||||
NSBorderType border:2;
|
||||
unsigned int __unused0:2;
|
||||
unsigned int hasVScroller:1; // 32
|
||||
unsigned int hasHScroller:1; // 16
|
||||
unsigned int __unused4:26;
|
||||
#endif
|
||||
} GSScrollViewFlags;
|
||||
|
||||
@implementation NSScrollView
|
||||
|
||||
/*
|
||||
|
@ -548,6 +569,15 @@ static float scrollerWidth;
|
|||
[_contentView scrollToPoint: point];
|
||||
}
|
||||
|
||||
//
|
||||
// This method is here purely for nib compatibility. This is the action
|
||||
// connected to by NSScrollers in IB when building a scrollview.
|
||||
//
|
||||
- (void) _doScroller: (NSScroller *)scroller
|
||||
{
|
||||
[self _doScroll: scroller];
|
||||
}
|
||||
|
||||
- (void) reflectScrolledClipView: (NSClipView *)aClipView
|
||||
{
|
||||
NSRect documentFrame = NSZeroRect;
|
||||
|
@ -1188,38 +1218,44 @@ static float scrollerWidth;
|
|||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeObject: _contentView];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
||||
if (_hasHorizScroller)
|
||||
[aCoder encodeObject: _horizScroller];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
||||
if (_hasVertScroller)
|
||||
[aCoder encodeObject: _vertScroller];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizRuler];
|
||||
if (_hasHorizRuler)
|
||||
[aCoder encodeObject: _horizRuler];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertRuler];
|
||||
if (_hasVertRuler)
|
||||
[aCoder encodeObject: _vertRuler];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
||||
if (_hasHeaderView)
|
||||
[aCoder encodeObject: _headerClipView];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
||||
|
||||
/* We do not need to encode headerview, cornerview stuff */
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _contentView];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
||||
if (_hasHorizScroller)
|
||||
[aCoder encodeObject: _horizScroller];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
||||
if (_hasVertScroller)
|
||||
[aCoder encodeObject: _vertScroller];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizRuler];
|
||||
if (_hasHorizRuler)
|
||||
[aCoder encodeObject: _horizRuler];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertRuler];
|
||||
if (_hasVertRuler)
|
||||
[aCoder encodeObject: _vertRuler];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
||||
if (_hasHeaderView)
|
||||
[aCoder encodeObject: _headerClipView];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
||||
|
||||
/* We do not need to encode headerview, cornerview stuff */
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
@ -1228,32 +1264,71 @@ static float scrollerWidth;
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSClipView *content = [aDecoder decodeObjectForKey: @"NSContentView"];
|
||||
NSScroller *hScroller = [aDecoder decodeObjectForKey: @"NSHScroller"];
|
||||
NSScroller *vScroller = [aDecoder decodeObjectForKey: @"NSVScroller"];
|
||||
|
||||
NSClipView *content = [aDecoder decodeObjectForKey: @"NSContentView"];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
||||
{
|
||||
unsigned long flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
||||
GSScrollViewFlags scrollViewFlags;
|
||||
memcpy((void *)&scrollViewFlags,(void *)&flags,sizeof(struct _scrollViewFlags));
|
||||
|
||||
_hasVertScroller = scrollViewFlags.hasVScroller;
|
||||
_hasHorizScroller = scrollViewFlags.hasHScroller;
|
||||
// _scrollsDynamically = (!scrollViewFlags.notDynamic);
|
||||
// _rulersVisible = scrollViewFlags.rulersVisible;
|
||||
// _hasHorizRuler = scrollViewFlags.hasHRuler;
|
||||
// _hasVertRuler = scrollViewFlags.hasVRuler;
|
||||
// [self setDrawsBackground: (!scrollViewFlags.doesNotDrawBack)];
|
||||
_borderType = scrollViewFlags.border;
|
||||
}
|
||||
|
||||
if (content != nil)
|
||||
{
|
||||
NSRect frame = [content frame];
|
||||
float w = [vScroller frame].size.width;
|
||||
|
||||
if(_hasVertScroller)
|
||||
{
|
||||
//
|
||||
// Slide the content view over, since on Mac OS X the scroller is on the
|
||||
// right, the content view is not properly positioned since our scroller
|
||||
// is on the left.
|
||||
//
|
||||
frame.origin.x += w;
|
||||
[content setFrame: frame];
|
||||
}
|
||||
|
||||
// retain the view and reset the content view...
|
||||
RETAIN(content);
|
||||
[self setContentView: content];
|
||||
RELEASE(content);
|
||||
_contentView = content;
|
||||
}
|
||||
if (hScroller != nil)
|
||||
|
||||
if (hScroller != nil && _hasHorizScroller)
|
||||
{
|
||||
[self setHorizontalScroller: hScroller];
|
||||
}
|
||||
if (vScroller != nil)
|
||||
|
||||
if (vScroller != nil && _hasVertScroller)
|
||||
{
|
||||
[self setVerticalScroller: vScroller];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
||||
{
|
||||
//int flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
||||
// FIXME
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSHeaderClipView"])
|
||||
{
|
||||
_hasHeaderView = YES;
|
||||
_hasCornerView = YES;
|
||||
ASSIGN(_headerClipView, [aDecoder decodeObjectForKey: @"NSHeaderClipView"]);
|
||||
}
|
||||
|
||||
[self tile];
|
||||
}
|
||||
else
|
||||
{
|
||||
int version = [aDecoder versionForClassName:
|
||||
@"NSScrollView"];
|
||||
int version = [aDecoder versionForClassName: @"NSScrollView"];
|
||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||
|
|
|
@ -181,7 +181,25 @@ static NSColor *scrollBarColor = nil;
|
|||
float value = 0.0;
|
||||
float percent = 0.0;
|
||||
int flags;
|
||||
|
||||
|
||||
if (_frame.size.width > _frame.size.height)
|
||||
{
|
||||
_isHorizontal = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isHorizontal = NO;
|
||||
}
|
||||
|
||||
if (_isHorizontal)
|
||||
{
|
||||
_floatValue = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_floatValue = 1.0;
|
||||
}
|
||||
|
||||
if (action != nil)
|
||||
{
|
||||
[self setAction: NSSelectorFromString(action)];
|
||||
|
@ -201,8 +219,15 @@ static NSColor *scrollBarColor = nil;
|
|||
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
||||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
||||
// FIXME
|
||||
// is horiz is set above...
|
||||
|
||||
}
|
||||
|
||||
// setup...
|
||||
_hitPart = NSScrollerNoPart;
|
||||
|
||||
[self drawParts];
|
||||
[self checkSpaceForParts];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
{
|
||||
return [_cell echosBullets];
|
||||
}
|
||||
|
||||
@end /* NSSecureTextField */
|
||||
|
||||
@implementation NSSecureTextFieldCell
|
||||
|
@ -133,10 +132,17 @@
|
|||
return [super setUpFieldEditorAttributes: textObject];
|
||||
}
|
||||
|
||||
- (id) initWithCoder:(NSCoder *)decoder
|
||||
- (id) initWithCoder: (NSCoder *)decoder
|
||||
{
|
||||
[super initWithCoder: decoder];
|
||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_echosBullets];
|
||||
self = [super initWithCoder: decoder];
|
||||
if([decoder allowsKeyedCoding])
|
||||
{
|
||||
// do nothing for now...
|
||||
}
|
||||
else
|
||||
{
|
||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_echosBullets];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -564,15 +564,40 @@ DEFINE_RINT_IF_MISSING
|
|||
- (id) initWithCoder: (NSCoder*)decoder
|
||||
{
|
||||
self = [super initWithCoder: decoder];
|
||||
[decoder decodeValuesOfObjCTypes: "fffi",
|
||||
&_minValue, &_maxValue, &_altIncrementValue, &_isVertical];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &_titleCell];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &_knobCell];
|
||||
if ([decoder versionForClassName: @"NSSliderCell"] >= 2)
|
||||
if([decoder allowsKeyedCoding])
|
||||
{
|
||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsTickMarkValuesOnly];
|
||||
[decoder decodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
||||
[decoder decodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
_allowsTickMarkValuesOnly = [decoder decodeBoolForKey: @"NSAllowsTickMarkValuesOnly"];
|
||||
_numberOfTickMarks = [decoder decodeIntForKey: @"NSNumberOfTickMarks"];
|
||||
_tickMarkPosition = [decoder decodeIntForKey: @"NSTickMarkPosition"];
|
||||
_minValue = [decoder decodeFloatForKey: @"NSMinValue"];
|
||||
_maxValue = [decoder decodeFloatForKey: @"NSMaxValue"];
|
||||
_altIncrementValue = [decoder decodeFloatForKey: @"NSAltIncValue"];
|
||||
|
||||
// do these here, since the Cocoa version of the class does not save these values...
|
||||
_knobCell = [NSCell new];
|
||||
_titleCell = [NSTextFieldCell new];
|
||||
[_titleCell setTextColor: [NSColor controlTextColor]];
|
||||
[_titleCell setStringValue: @""];
|
||||
[_titleCell setAlignment: NSCenterTextAlignment];
|
||||
|
||||
// if it's from a nib, make it bordered and bezeled so it's more attractive.
|
||||
[self setBordered: YES];
|
||||
[self setBezeled: YES];
|
||||
|
||||
_isVertical = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
[decoder decodeValuesOfObjCTypes: "fffi",
|
||||
&_minValue, &_maxValue, &_altIncrementValue, &_isVertical];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &_titleCell];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &_knobCell];
|
||||
if ([decoder versionForClassName: @"NSSliderCell"] >= 2)
|
||||
{
|
||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsTickMarkValuesOnly];
|
||||
[decoder decodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
||||
[decoder decodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -580,14 +605,27 @@ DEFINE_RINT_IF_MISSING
|
|||
- (void) encodeWithCoder: (NSCoder*)coder
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
[coder encodeValuesOfObjCTypes: "fffi",
|
||||
&_minValue, &_maxValue, &_altIncrementValue, &_isVertical];
|
||||
[coder encodeValueOfObjCType: @encode(id) at: &_titleCell];
|
||||
[coder encodeValueOfObjCType: @encode(id) at: &_knobCell];
|
||||
// New for version 2
|
||||
[coder encodeValueOfObjCType: @encode(BOOL) at: &_allowsTickMarkValuesOnly];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeBool: _allowsTickMarkValuesOnly forKey: @"NSAllowsTickMarkValuesOnly"];
|
||||
[coder encodeInt: _numberOfTickMarks forKey: @"NSNumberOfTickMarks"];
|
||||
[coder encodeInt: _tickMarkPosition forKey: @"NSTickMarkPosition"];
|
||||
[coder encodeFloat: _minValue forKey: @"NSMinValue"];
|
||||
[coder encodeFloat: _maxValue forKey: @"NSMaxValue"];
|
||||
[coder encodeFloat: _altIncrementValue forKey: @"NSAltIncValue"];
|
||||
[coder encodeFloat: _minValue forKey: @"NSValue"]; // encoded for compatibility
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder encodeValuesOfObjCTypes: "fffi",
|
||||
&_minValue, &_maxValue, &_altIncrementValue, &_isVertical];
|
||||
[coder encodeValueOfObjCType: @encode(id) at: &_titleCell];
|
||||
[coder encodeValueOfObjCType: @encode(id) at: &_knobCell];
|
||||
// New for version 2
|
||||
[coder encodeValueOfObjCType: @encode(BOOL) at: &_allowsTickMarkValuesOnly];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -333,19 +333,33 @@ static inline void HighlightDownButton(NSRect aRect)
|
|||
int tmp1, tmp2;
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_maxValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_minValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_increment];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
||||
at: &tmp1];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
||||
at: &tmp2];
|
||||
if([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
_autorepeat = [aDecoder decodeBoolForKey: @"NSAutorepeat"];
|
||||
_valueWraps = [aDecoder decodeBoolForKey: @"NSValueWraps"];
|
||||
_increment = [aDecoder decodeIntForKey: @"NSIncrement"];
|
||||
_maxValue = [aDecoder decodeIntForKey: @"NSMaxValue"];
|
||||
if([aDecoder containsValueForKey: @"NSMinValue"])
|
||||
{
|
||||
_minValue = [aDecoder decodeIntForKey: @"NSMinValue"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_maxValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_minValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_increment];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
||||
at: &tmp1];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
||||
at: &tmp2];
|
||||
|
||||
_autorepeat = (BOOL)tmp1;
|
||||
_valueWraps = (BOOL)tmp2;
|
||||
_autorepeat = (BOOL)tmp1;
|
||||
_valueWraps = (BOOL)tmp2;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <Foundation/NSSet.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSKeyedArchiver.h>
|
||||
|
||||
#include "AppKit/NSTableView.h"
|
||||
#include "AppKit/NSApplication.h"
|
||||
|
@ -73,6 +74,31 @@ static int currentDropRow;
|
|||
static int lastQuarterPosition;
|
||||
static unsigned currentDragOperation;
|
||||
|
||||
/*
|
||||
* Nib compatibility struct. This structure is used to
|
||||
* pull the attributes out of the nib that we need to fill
|
||||
* in the flags.
|
||||
*/
|
||||
typedef struct _tableViewFlags
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
unsigned int columnOrdering:1;
|
||||
unsigned int columnResizing:1;
|
||||
unsigned int drawsGrid:1;
|
||||
unsigned int emptySelection:1;
|
||||
unsigned int multipleSelection:1;
|
||||
unsigned int columnSelection:1;
|
||||
unsigned int __unused:26;
|
||||
#else
|
||||
unsigned int __unused:26;
|
||||
unsigned int columnSelection:1;
|
||||
unsigned int multipleSelection:1;
|
||||
unsigned int emptySelection:1;
|
||||
unsigned int drawsGrid:1;
|
||||
unsigned int columnResizing:1;
|
||||
unsigned int columnOrdering:1;
|
||||
#endif
|
||||
} GSTableViewFlags;
|
||||
|
||||
#define ALLOWS_MULTIPLE (1)
|
||||
#define ALLOWS_EMPTY (1 << 1)
|
||||
|
@ -80,7 +106,6 @@ static unsigned currentDragOperation;
|
|||
#define CONTROL_DOWN (1 << 3)
|
||||
#define ADDING_ROW (1 << 4)
|
||||
|
||||
|
||||
@interface NSTableView (NotificationRequestMethods)
|
||||
- (void) _postSelectionIsChangingNotification;
|
||||
- (void) _postSelectionDidChangeNotification;
|
||||
|
@ -2236,6 +2261,7 @@ _isCellEditable (id delegate, NSArray *tableColumns,
|
|||
|
||||
/* We do *not* retain the dataSource, it's like a delegate */
|
||||
_dataSource = anObject;
|
||||
|
||||
[self tile];
|
||||
[self reloadData];
|
||||
}
|
||||
|
@ -3766,12 +3792,12 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
- (void) setHeaderView: (NSTableHeaderView*)aHeaderView
|
||||
{
|
||||
|
||||
if ([_headerView respondsToSelector:@selector(setTableView)])
|
||||
if ([_headerView respondsToSelector:@selector(setTableView:)])
|
||||
[_headerView setTableView: nil];
|
||||
|
||||
ASSIGN (_headerView, aHeaderView);
|
||||
|
||||
if ([_headerView respondsToSelector:@selector(setTableView)])
|
||||
if ([_headerView respondsToSelector:@selector(setTableView:)])
|
||||
[_headerView setTableView: self];
|
||||
|
||||
[self tile]; // resizes corner and header views, then displays
|
||||
|
@ -5112,30 +5138,70 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeConditionalObject: _dataSource];
|
||||
[aCoder encodeObject: _tableColumns];
|
||||
[aCoder encodeObject: _gridColor];
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeObject: _headerView];
|
||||
[aCoder encodeObject: _cornerView];
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
unsigned int vFlags = 0; // (raw >> 26); // filter out settings not pertinent to us.
|
||||
NSSize intercellSpacing = [self intercellSpacing];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfRows];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
|
||||
[aCoder encodeObject: [self dataSource] forKey: @"NSDataSource"];
|
||||
[aCoder encodeObject: [self delegate] forKey: @"NSDelegate"];
|
||||
[aCoder encodeObject: [self target] forKey: @"NSTarget"];
|
||||
[aCoder encodeObject: NSStringFromSelector([self action]) forKey: @"NSAction"];
|
||||
[aCoder encodeObject: [self backgroundColor] forKey: @"NSBackgroundColor"];
|
||||
[aCoder encodeObject: [self gridColor] forKey: @"NSGridColor"];
|
||||
[aCoder encodeFloat: intercellSpacing.height forKey: @"NSIntercellSpacingHeight"];
|
||||
[aCoder encodeFloat: intercellSpacing.width forKey: @"NSIntercellSpacingWidth"];
|
||||
[aCoder encodeFloat: [self rowHeight] forKey: @"NSRowHeight"];
|
||||
[aCoder encodeObject: [self tableColumns] forKey: @"NSTableColumns"];
|
||||
|
||||
if([self allowsColumnSelection])
|
||||
vFlags |= 1;
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsGrid];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_rowHeight];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
||||
[aCoder encodeSize: _intercellSpacing];
|
||||
if([self allowsMultipleSelection])
|
||||
vFlags |= 2;
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsMultipleSelection];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnSelection];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnResizing];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnReordering];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autoresizesAllColumnsToFit];
|
||||
if([self allowsEmptySelection])
|
||||
vFlags |= 4;
|
||||
|
||||
if([self allowsColumnResizing])
|
||||
vFlags |= 16;
|
||||
|
||||
if([self allowsColumnReordering])
|
||||
vFlags |= 32;
|
||||
|
||||
// shift...
|
||||
vFlags = vFlags << 26;
|
||||
vFlags |= 0x2400000; // add the constant...
|
||||
|
||||
// encode..
|
||||
[aCoder encodeInt: vFlags forKey: @"NSTvFlags"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeConditionalObject: _dataSource];
|
||||
[aCoder encodeObject: _tableColumns];
|
||||
[aCoder encodeObject: _gridColor];
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeObject: _headerView];
|
||||
[aCoder encodeObject: _cornerView];
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfRows];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsGrid];
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_rowHeight];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
||||
[aCoder encodeSize: _intercellSpacing];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsMultipleSelection];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnSelection];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnResizing];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnReordering];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autoresizesAllColumnsToFit];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
@ -5149,10 +5215,19 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
NSEnumerator *e;
|
||||
NSTableColumn *col;
|
||||
|
||||
[self setDataSource: [aDecoder decodeObjectForKey: @"NSDataSource"]];
|
||||
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
|
||||
|
||||
[self setTarget: [aDecoder decodeObjectForKey: @"NSTarget"]];
|
||||
[(NSKeyedUnarchiver *)aDecoder setClass: [GSTableCornerView class] forClassName: @"_NSCornerView"];
|
||||
if ([aDecoder containsValueForKey: @"NSDataSource"])
|
||||
{
|
||||
[self setDataSource: [aDecoder decodeObjectForKey: @"NSDataSource"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSDelegate"])
|
||||
{
|
||||
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTarget"])
|
||||
{
|
||||
[self setTarget: [aDecoder decodeObjectForKey: @"NSTarget"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSAction"])
|
||||
{
|
||||
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||
|
@ -5179,19 +5254,66 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
{
|
||||
[self setRowHeight: [aDecoder decodeFloatForKey: @"NSRowHeight"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSHeaderView"])
|
||||
{
|
||||
|
||||
NSRect viewFrame = [self frame];
|
||||
float rowHeight = [self rowHeight];
|
||||
|
||||
_headerView = [NSTableHeaderView new];
|
||||
[_headerView setFrameSize: NSMakeSize(viewFrame.size.width, rowHeight)];
|
||||
[_headerView setTableView: self];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSCornerView"])
|
||||
{
|
||||
NSRect viewFrame;
|
||||
float rowHeight = [self rowHeight];
|
||||
|
||||
[self setCornerView: [aDecoder decodeObjectForKey: @"NSCornerView"]];
|
||||
viewFrame = [[self cornerView] frame];
|
||||
viewFrame.size.height = rowHeight;
|
||||
[[self cornerView] setFrame: viewFrame];
|
||||
}
|
||||
|
||||
// get the table columns...
|
||||
columns = [aDecoder decodeObjectForKey: @"NSTableColumns"];
|
||||
e = [columns objectEnumerator];
|
||||
while ((col = [e nextObject]) != nil)
|
||||
{
|
||||
[self addTableColumn: col];
|
||||
[col setTableView: self];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSTvFlags"])
|
||||
{
|
||||
//int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
||||
// FIXME set the flags
|
||||
unsigned long flags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
||||
GSTableViewFlags tableViewFlags;
|
||||
memcpy((void *)&tableViewFlags,(void *)&flags,sizeof(struct _tableViewFlags));
|
||||
|
||||
[self setAllowsColumnSelection: tableViewFlags.columnSelection];
|
||||
[self setAllowsMultipleSelection: tableViewFlags.multipleSelection];
|
||||
[self setAllowsEmptySelection: tableViewFlags.emptySelection];
|
||||
[self setDrawsGrid: tableViewFlags.drawsGrid];
|
||||
[self setAllowsColumnResizing: tableViewFlags.columnResizing];
|
||||
[self setAllowsColumnReordering: tableViewFlags.columnOrdering];
|
||||
}
|
||||
|
||||
_numberOfColumns = [columns count];
|
||||
ASSIGN (_selectedColumns, [NSMutableIndexSet indexSet]);
|
||||
ASSIGN (_selectedRows, [NSMutableIndexSet indexSet]);
|
||||
if (_numberOfColumns)
|
||||
_columnOrigins = NSZoneMalloc (NSDefaultMallocZone (),
|
||||
sizeof(float) * _numberOfColumns);
|
||||
|
||||
_clickedRow = -1;
|
||||
_clickedColumn = -1;
|
||||
_selectingColumns = NO;
|
||||
_selectedColumn = -1;
|
||||
_selectedRow = -1;
|
||||
_editedColumn = -1;
|
||||
_editedRow = -1;
|
||||
|
||||
[self tile];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5250,15 +5372,6 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
{
|
||||
[self tile];
|
||||
}
|
||||
/*
|
||||
NSLog(@"frame %@", NSStringFromRect([self frame]));
|
||||
NSLog(@"dataSource %@", _dataSource);
|
||||
if (_dataSource != nil)
|
||||
{
|
||||
[self setDataSource: _dataSource];
|
||||
NSLog(@"dataSource set");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -433,10 +433,9 @@ framework intact.
|
|||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
//NSLayoutManager *manager = [aDecoder decodeObjectForKey: @"NSLayoutManager"];
|
||||
NSTextView *view = [aDecoder decodeObjectForKey: @"NSTextView"];
|
||||
NSSize size = NSZeroSize;
|
||||
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSWidth"])
|
||||
{
|
||||
size.width = [aDecoder decodeFloatForKey: @"NSWidth"];
|
||||
|
@ -444,10 +443,16 @@ framework intact.
|
|||
self = [self initWithContainerSize: size];
|
||||
if ([aDecoder containsValueForKey: @"NSTCFlags"])
|
||||
{
|
||||
// FIXME
|
||||
//int flags = [aDecoder decodeIntForKey: @"NSTCFlags"];
|
||||
int flags = [aDecoder decodeIntForKey: @"NSTCFlags"];
|
||||
|
||||
// decode the flags.
|
||||
_widthTracksTextView = flags & 1;
|
||||
_heightTracksTextView = flags & 2;
|
||||
_observingFrameChanges = flags & 4;
|
||||
}
|
||||
// No need to set manager as the decoding of the layout manager does it
|
||||
|
||||
// decoding the manager adds this text container automatically...
|
||||
[aDecoder decodeObjectForKey: @"NSLayoutManager"];
|
||||
[self setTextView: view];
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -709,17 +709,19 @@ static Class textFieldCellClass;
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_error_action];
|
||||
if(![aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_error_action];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
if([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
// do nothing for now...
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -125,16 +125,24 @@ Interface for a bunch of internal methods that need to be cleaned up.
|
|||
// This class is a helper for keyed unarchiving only
|
||||
@interface NSTextViewSharedData : NSObject
|
||||
{
|
||||
@public
|
||||
@private
|
||||
NSColor *backgroundColor;
|
||||
NSParagraphStyle *paragraphStyle;
|
||||
int flags;
|
||||
unsigned int flags;
|
||||
NSColor *insertionColor;
|
||||
NSArray *linkAttr;
|
||||
NSArray *markAttr;
|
||||
NSArray *selectedAttr;
|
||||
NSTextView *textView;
|
||||
}
|
||||
- (NSColor *) backgroundColor;
|
||||
- (NSParagraphStyle *) paragraphStyle;
|
||||
- (unsigned int) flags;
|
||||
- (NSColor *) insertionColor;
|
||||
- (NSArray *) linkAttributes;
|
||||
- (NSArray *) markAttributes;
|
||||
- (NSArray *) selectedAttributes;
|
||||
- (NSTextView *) textView;
|
||||
@end
|
||||
|
||||
@implementation NSTextViewSharedData
|
||||
|
@ -151,9 +159,7 @@ Interface for a bunch of internal methods that need to be cleaned up.
|
|||
ASSIGN(markAttr, [aDecoder decodeObjectForKey: @"NSMarkedAttributes"]);
|
||||
ASSIGN(selectedAttr, [aDecoder decodeObjectForKey: @"NSSelectedAttributes"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -167,6 +173,45 @@ Interface for a bunch of internal methods that need to be cleaned up.
|
|||
RELEASE(selectedAttr);
|
||||
}
|
||||
|
||||
- (NSColor *)backgroundColor
|
||||
{
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
- (NSParagraphStyle *) paragraphStyle
|
||||
{
|
||||
return paragraphStyle;
|
||||
}
|
||||
|
||||
- (unsigned int) flags
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
|
||||
- (NSColor *) insertionColor
|
||||
{
|
||||
return insertionColor;
|
||||
}
|
||||
|
||||
- (NSArray *) linkAttributes
|
||||
{
|
||||
return linkAttr;
|
||||
}
|
||||
|
||||
- (NSArray *) markAttributes
|
||||
{
|
||||
return markAttr;
|
||||
}
|
||||
|
||||
- (NSArray *) selectedAttributes
|
||||
{
|
||||
return selectedAttr;
|
||||
}
|
||||
|
||||
- (NSTextView *) textView
|
||||
{
|
||||
return textView;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
@ -646,45 +691,97 @@ that makes decoding and encoding compatible with the old code.
|
|||
-(id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
{
|
||||
NSTextContainer *aTextContainer;
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSDelegate"])
|
||||
{
|
||||
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSMaxSize"])
|
||||
{
|
||||
[self setMaxSize: [aDecoder decodeSizeForKey: @"NSMaxSize"]];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSMinize"])
|
||||
{
|
||||
// it's NSMinize in pre-10.3 formats.
|
||||
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinize"]];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSMinSize"])
|
||||
{
|
||||
// However, if NSMinSize is present we want to use it.
|
||||
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinSize"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTextContainer"])
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSSharedData"])
|
||||
{
|
||||
[self setTextContainer: [aDecoder decodeObjectForKey: @"NSTextContainer"]];
|
||||
NSTextViewSharedData *shared = [aDecoder decodeObjectForKey: @"NSSharedData"];
|
||||
unsigned int flags = [shared flags];
|
||||
|
||||
ASSIGN(_insertionPointColor, [shared insertionColor]);
|
||||
ASSIGN(_backgroundColor, [shared backgroundColor]);
|
||||
|
||||
_tf.is_editable = ((0x01 & flags) > 0);
|
||||
_tf.is_selectable = ((0x02 & flags) > 0);
|
||||
_tf.is_rich_text = ((0x04 & flags) > 0);
|
||||
_tf.imports_graphics = ((0x08 & flags) > 0);
|
||||
_tf.is_field_editor = ((0x10 & flags) > 0);
|
||||
_tf.uses_font_panel = ((0x20 & flags) > 0);
|
||||
_tf.is_ruler_visible = ((0x40 & flags) > 0);
|
||||
_tf.uses_ruler = ((0x100 & flags) > 0);
|
||||
_tf.draws_background = ((0x800 & flags) > 0);
|
||||
_tf.smart_insert_delete = ((0x2000000 & flags) > 0);
|
||||
_tf.allows_undo = ((0x40000000 & flags) > 0);
|
||||
|
||||
_tf.owns_text_network = YES;
|
||||
_tf.is_horizontally_resizable = YES;
|
||||
_tf.is_vertically_resizable = YES;
|
||||
}
|
||||
|
||||
// currently not used....
|
||||
if ([aDecoder containsValueForKey: @"NSTextStorage"])
|
||||
{
|
||||
_textStorage = [aDecoder decodeObjectForKey: @"NSTextStorage"];
|
||||
}
|
||||
|
||||
// currently not used....
|
||||
if ([aDecoder containsValueForKey: @"NSTextContainer"])
|
||||
{
|
||||
NSSize size = NSMakeSize(0,_maxSize.height);
|
||||
NSTextContainer *aTextContainer = [self buildUpTextNetwork: NSZeroSize];
|
||||
[aTextContainer setTextView: (NSTextView *)self];
|
||||
/* See initWithFrame: for comments on this RELEASE */
|
||||
RELEASE(self);
|
||||
|
||||
[aTextContainer setContainerSize: size];
|
||||
[aTextContainer setWidthTracksTextView: YES];
|
||||
[aTextContainer setHeightTracksTextView: NO];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSTVFlags"])
|
||||
{
|
||||
//int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"];
|
||||
// FIXME set the flags
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSharedData"])
|
||||
{
|
||||
//NSTextViewSharedData *shared = [aDecoder decodeObjectForKey: @"NSSharedData"];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTextStorage"])
|
||||
{
|
||||
//NSTextStorage *storage = [aDecoder decodeObjectForKey: @"NSTextStorage"];
|
||||
int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"];
|
||||
// these flags are not used...
|
||||
}
|
||||
|
||||
// register for services and subscribe to notifications.
|
||||
[self _recacheDelegateResponses];
|
||||
[self invalidateTextContainerOrigin];
|
||||
|
||||
if (!did_register_for_services)
|
||||
[isa registerForServices];
|
||||
|
||||
[self updateDragTypeRegistration];
|
||||
|
||||
[self setPostsFrameChangedNotifications: YES];
|
||||
[notificationCenter addObserver: self
|
||||
selector: @selector(_updateState:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: self];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1515,7 +1612,6 @@ incorrectly. */
|
|||
[self setConstrainedFrameSize: size];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
TODO: There is code in TextEdit that implies that the minimum size is
|
||||
mostly ignored, and that the size of the containing clip view is always
|
||||
|
|
|
@ -3915,6 +3915,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
|
||||
[aCoder encodeInt: vFlags
|
||||
forKey: @"NSvFlags"];
|
||||
|
||||
[aCoder encodeObject: _super_view forKey: @"NSSuperview"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3938,6 +3940,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
NSEnumerator *e;
|
||||
NSView *sub;
|
||||
NSArray *subs;
|
||||
|
||||
// decode the superclass...
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
|
@ -3949,9 +3955,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSView *prevKeyView = [aDecoder decodeObjectForKey: @"NSPreviousKeyView"];
|
||||
NSView *nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
||||
NSArray *subViews = [aDecoder decodeObjectForKey: @"NSSubviews"];
|
||||
NSView *prevKeyView = nil;
|
||||
NSView *nextKeyView = nil;
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSFrame"])
|
||||
{
|
||||
|
@ -3959,17 +3964,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
[_frameMatrix setFrameOrigin: _frame.origin];
|
||||
}
|
||||
self = [self initWithFrame: _frame];
|
||||
|
||||
if (subViews != nil)
|
||||
{
|
||||
NSEnumerator *enumerator = [subViews objectEnumerator];
|
||||
NSView *sub;
|
||||
|
||||
while ((sub = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[self addSubview: sub];
|
||||
}
|
||||
}
|
||||
|
||||
subs = [aDecoder decodeObjectForKey: @"NSSubviews"];
|
||||
prevKeyView = [aDecoder decodeObjectForKey: @"NSPreviousKeyView"];
|
||||
nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
||||
if (nextKeyView != nil)
|
||||
{
|
||||
[self setNextKeyView: nextKeyView];
|
||||
|
@ -3992,9 +3990,6 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
else
|
||||
{
|
||||
NSRect rect;
|
||||
NSEnumerator *e;
|
||||
NSView *sub;
|
||||
NSArray *subs;
|
||||
|
||||
NSDebugLLog(@"NSView", @"NSView: start decoding\n");
|
||||
|
||||
|
@ -4029,25 +4024,27 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
[[aDecoder decodeObject] setNextKeyView: self];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
||||
e = [subs objectEnumerator];
|
||||
while ((sub = [e nextObject]) != nil)
|
||||
{
|
||||
NSAssert(sub->_window == nil, NSInternalInconsistencyException);
|
||||
NSAssert(sub->_super_view == nil, NSInternalInconsistencyException);
|
||||
[sub viewWillMoveToWindow: _window];
|
||||
[sub viewWillMoveToSuperview: self];
|
||||
[sub setNextResponder: self];
|
||||
[_sub_views addObject: sub];
|
||||
_rFlags.has_subviews = 1;
|
||||
[sub resetCursorRects];
|
||||
[sub setNeedsDisplay: YES];
|
||||
[sub _viewDidMoveToWindow];
|
||||
[sub viewDidMoveToSuperview];
|
||||
[self didAddSubview: sub];
|
||||
}
|
||||
RELEASE(subs);
|
||||
NSDebugLLog(@"NSView", @"NSView: finish decoding\n");
|
||||
}
|
||||
|
||||
// iterate over subviews and put them into the view...
|
||||
e = [subs objectEnumerator];
|
||||
while ((sub = [e nextObject]) != nil)
|
||||
{
|
||||
NSAssert([sub window] == nil, NSInternalInconsistencyException);
|
||||
NSAssert([sub superview] == nil, NSInternalInconsistencyException);
|
||||
[sub viewWillMoveToWindow: _window];
|
||||
[sub viewWillMoveToSuperview: self];
|
||||
[sub setNextResponder: self];
|
||||
[_sub_views addObject: sub];
|
||||
_rFlags.has_subviews = 1;
|
||||
[sub resetCursorRects];
|
||||
[sub setNeedsDisplay: YES];
|
||||
[sub _viewDidMoveToWindow];
|
||||
[sub viewDidMoveToSuperview];
|
||||
[self didAddSubview: sub];
|
||||
}
|
||||
RELEASE(subs);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue