mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
Nib compatibility code merge.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22957 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c91dddc12b
commit
d5e4858a60
36 changed files with 3162 additions and 1236 deletions
387
ChangeLog
387
ChangeLog
|
@ -1,3 +1,125 @@
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
2006-05-14 20:58 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/GSNibCompatibility.m: Added autosaveName.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
2006-05-09 22:48 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSStepperCell.m: Implemented keyed coding.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
2006-05-05 00:41 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSTextView.m: Completion of code in initWithCoder: for
|
||||||
|
keyed unarchiving.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2006-05-12 Nicolas Roard <nicolas@roard.com>
|
2006-05-12 Nicolas Roard <nicolas@roard.com>
|
||||||
|
|
||||||
* TextConverters/RTF/RTFProducer.h:
|
* TextConverters/RTF/RTFProducer.h:
|
||||||
|
@ -115,6 +237,16 @@
|
||||||
modifier mask as suggested by Fred, rather than original hard-coded
|
modifier mask as suggested by Fred, rather than original hard-coded
|
||||||
command modifier.
|
command modifier.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2006-04-30 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-04-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSMenu.m: ([performKeyEquivalent:]) Ignore key eqivalents other
|
* Source/NSMenu.m: ([performKeyEquivalent:]) Ignore key eqivalents other
|
||||||
|
@ -146,12 +278,28 @@
|
||||||
update _leftBorderOffset instead.
|
update _leftBorderOffset instead.
|
||||||
(-drawRect:): Always draw dark gray upper and left border.
|
(-drawRect:): Always draw dark gray upper and left border.
|
||||||
|
|
||||||
|
2006-04-26 22:34 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSTableView.m: Correction for header view.
|
||||||
|
|
||||||
|
|
||||||
2006-04-24 Fred Kiefer <FredKiefer@gmx.de>
|
2006-04-24 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSDocumentController.m (-makeUntitledDocumentOfType:):
|
* Source/NSDocumentController.m (-makeUntitledDocumentOfType:):
|
||||||
Set the type of the new document. Patch by Saso Kiselkov
|
Set the type of the new document. Patch by Saso Kiselkov
|
||||||
<diablos@manga.sk>.
|
<diablos@manga.sk>.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2006-04-19 Adam Fedor <fedor@gnu.org>
|
2006-04-19 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* configure: Add arg to disable aspell (for use on Mac OS X).
|
* configure: Add arg to disable aspell (for use on Mac OS X).
|
||||||
|
@ -160,6 +308,68 @@
|
||||||
is not redefined on MingW by jmorecfg.h (Suggestion from Issac
|
is not redefined on MingW by jmorecfg.h (Suggestion from Issac
|
||||||
Trotts).
|
Trotts).
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
2006-04-14 00:02 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/GSNibCompatibility.m: Changed ordering to allow views
|
||||||
|
to be properly initialized.
|
||||||
|
|
||||||
|
2006-04-11 23:45 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSNib.h
|
||||||
|
* Source/NSNib.m: Added keyed coding.
|
||||||
|
|
||||||
|
2006-04-09 23:14 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/GSModelLoaderFactory.m: Fixed a problem with
|
||||||
|
pathForNibResource:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
2006-04-09 12:25 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Tools/gopen.m: Streamline gopen code.
|
||||||
|
|
||||||
2006-04-09 12:28 Gregory John Casamento <greg_casamento@yahoo.com>
|
2006-04-09 12:28 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Tools/gopen.m: Streamline gopen code.
|
* Tools/gopen.m: Streamline gopen code.
|
||||||
|
@ -168,6 +378,8 @@
|
||||||
|
|
||||||
* Tools/gcloseall.m: Include NSProcessInfo.h. Fixes bug #16212.
|
* Tools/gcloseall.m: Include NSProcessInfo.h. Fixes bug #16212.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2006-03-31 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-03-31 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSMenuView.m: ([-rectOfItemAtIndex:]) fixup origin of
|
* Source/NSMenuView.m: ([-rectOfItemAtIndex:]) fixup origin of
|
||||||
|
@ -299,6 +511,13 @@
|
||||||
config because there was nothing in the user defaults system, save the
|
config because there was nothing in the user defaults system, save the
|
||||||
new config so we don't have to do it again next time.
|
new config so we don't have to do it again next time.
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2006-02-06 Fred Kiefer <FredKiefer@gmx.de>
|
2006-02-06 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSMatrix.m (-deselectAllCells): Allow empty selection,
|
* Source/NSMatrix.m (-deselectAllCells): Allow empty selection,
|
||||||
|
@ -423,6 +642,15 @@
|
||||||
* Tools/GNUmakefile.preamble:
|
* Tools/GNUmakefile.preamble:
|
||||||
Build new utility.
|
Build new utility.
|
||||||
|
|
||||||
|
2006-01-26 00:01 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSScrollView.m: Temporary fix to scrollview.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
2006-01-22 Fred Kiefer <FredKiefer@gmx.de>
|
2006-01-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSPopupButtonCell.m (-synchronizeTitleAndSelectedItem):
|
* Source/NSPopupButtonCell.m (-synchronizeTitleAndSelectedItem):
|
||||||
|
@ -440,22 +668,164 @@
|
||||||
|
|
||||||
* Source/NSWindow.m: minor fixups for 64bit cpu support.
|
* Source/NSWindow.m: minor fixups for 64bit cpu support.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
2006-01-14 08:58 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSTableView.m: Implemented encodeWithCoder: for NSTableView.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
2006-01-13 00:29 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSColorWell.m: Added keyed coding support in initWithCoder:
|
||||||
|
and encodeWithCoder:
|
||||||
|
|
||||||
|
2006-01-11 01:26 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/NSSliderCell.m: Encode NSValue for compatibility with
|
||||||
|
Cocoa.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
2006-01-09 06:25 Gregory John Casamento <greg_casamento@yahoo.com>
|
2006-01-09 06:25 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/NSNib.m: Correction for bug#15348. Removed uneeded
|
* Source/NSNib.m: Correction for bug#15348. Removed uneeded
|
||||||
append in initWithNibNamed:
|
append in initWithNibNamed:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
2006-01-08 Fred Kiefer <FredKiefer@gmx.de>
|
2006-01-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSTableView.m (-initWithFrame:) Use different intercell
|
* Source/NSTableView.m (-initWithFrame:) Use different intercell
|
||||||
spacing. Patch by Andreas Höschler <ahoesch@smartsoft.de>.
|
spacing. Patch by Andreas Höschler <ahoesch@smartsoft.de>.
|
||||||
|
|
||||||
|
2006-01-07 10:38 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/GSNibCompatibility.m: Encoding for NSIBObjectData, and
|
||||||
|
for NSWindowTemplate. Implementation of NSClassSwapper.
|
||||||
|
|
||||||
2006-01-04 Fred Kiefer <FredKiefer@gmx.de>
|
2006-01-04 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSSliderCell.m (-knobRectFlipped,-knobThickness
|
* Source/NSSliderCell.m (-knobRectFlipped,-knobThickness
|
||||||
-drawInteriorWithFrame:inView:, -setKnobThickness:): Protect against knob
|
-drawInteriorWithFrame:inView:, -setKnobThickness:): Protect against knob
|
||||||
image being nil. Fixes Solaris problem reported by <ubossx@gmail.com>.
|
image being nil. Fixes Solaris problem reported by <ubossx@gmail.com>.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
2005-12-31 17:25 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Source/GSNibCompatibility.m: Added code to properly initialize the
|
||||||
|
maptables.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2005-12-31 Matt Rice <ratmice@yahoo.com>
|
2005-12-31 Matt Rice <ratmice@yahoo.com>
|
||||||
|
|
||||||
* Source/NSTableView.m (-mouseDown:): Copy the selected cell before
|
* Source/NSTableView.m (-mouseDown:): Copy the selected cell before
|
||||||
|
@ -463,6 +833,23 @@
|
||||||
(-mouseDown:): Check for pointer equality in addition to isEqual:
|
(-mouseDown:): Check for pointer equality in addition to isEqual:
|
||||||
which doesn't work with nil. (fix for bug #15316)
|
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.
|
||||||
|
|
||||||
|
2005-12-29 00:39 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h
|
||||||
|
* Source/GSNibCompatibility.m: NSClassSwapper, NSCustomView, and
|
||||||
|
NSCustomObject.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2005-12-22 Adam Fedor <fedor@gnu.org>
|
2005-12-22 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Version 0.10.2
|
* Version 0.10.2
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<email address="fedor@gnu.org"/>
|
<email address="fedor@gnu.org"/>
|
||||||
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
|
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
|
||||||
</author>
|
</author>
|
||||||
<version>$Revision: 22201 $</version>
|
<version>$Revision$</version>
|
||||||
<date>$Date$</date>
|
<date>$Date$</date>
|
||||||
<copy>2005 Free Software Foundation, Inc.</copy>
|
<copy>2005 Free Software Foundation, Inc.</copy>
|
||||||
</head>
|
</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/NSControl.h>
|
||||||
#include <AppKit/NSButton.h>
|
#include <AppKit/NSButton.h>
|
||||||
|
|
||||||
/*
|
#include <AppKit/NSGraphicsContext.h>
|
||||||
As these classes are deprecated, they should disappear from the gnustep
|
#include <AppKit/NSGraphics.h>
|
||||||
distribution in the next major release. They are for backwards compatibility
|
#include <AppKit/NSResponder.h>
|
||||||
ONLY.
|
#include <AppKit/NSEvent.h>
|
||||||
*/
|
#include "GNUstepGUI/GSNibContainer.h"
|
||||||
|
#include "GNUstepGUI/GSInstantiator.h"
|
||||||
// DO NOT USE.
|
|
||||||
|
|
||||||
// templates
|
// templates
|
||||||
@protocol __DeprecatedTemplate__
|
@protocol OSXNibTemplate
|
||||||
- (void) setClassName: (NSString *)className;
|
- (void) setClassName: (NSString *)className;
|
||||||
- (NSString *)className;
|
- (NSString *)className;
|
||||||
- (id) instantiateObject: (NSCoder *)coder;
|
- (id) realObject;
|
||||||
@end
|
@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 *_className;
|
||||||
NSString *_parentClassName;
|
id _realObject;
|
||||||
BOOL _deferFlag;
|
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSViewTemplate : NSView <__DeprecatedTemplate__>
|
@interface NSTextTemplate : NSViewTemplate
|
||||||
{
|
{
|
||||||
NSString *_className;
|
|
||||||
NSString *_parentClassName;
|
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSTextTemplate : NSText <__DeprecatedTemplate__>
|
@interface NSTextViewTemplate : NSViewTemplate
|
||||||
{
|
{
|
||||||
NSString *_className;
|
|
||||||
NSString *_parentClassName;
|
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSTextViewTemplate : NSTextView <__DeprecatedTemplate__>
|
@interface NSMenuTemplate : NSObject <OSXNibTemplate, NSCoding>
|
||||||
{
|
{
|
||||||
NSString *_className;
|
NSString *_menuClass;
|
||||||
NSString *_parentClassName;
|
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
|
@end
|
||||||
|
|
||||||
@interface NSMenuTemplate : NSMenu <__DeprecatedTemplate__>
|
@interface NSCustomObject : NSObject <NSCoding>
|
||||||
{
|
{
|
||||||
NSString *_className;
|
NSString *_className;
|
||||||
NSString *_parentClassName;
|
NSString *_extension;
|
||||||
|
id _object;
|
||||||
}
|
}
|
||||||
|
- (void) setClassName: (NSString *)name;
|
||||||
|
- (NSString *)className;
|
||||||
|
- (void) setExtension: (NSString *)ext;
|
||||||
|
- (NSString *)extension;
|
||||||
|
- (void) setObject: (id)obj;
|
||||||
|
- (id)object;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSControlTemplate : NSControl <__DeprecatedTemplate__>
|
@interface NSCustomView : NSView
|
||||||
{
|
{
|
||||||
NSString *_className;
|
NSString *_className;
|
||||||
NSString *_parentClassName;
|
NSString *_extension;
|
||||||
id _delegate;
|
NSView *_superview;
|
||||||
id _dataSource;
|
NSView *_view;
|
||||||
BOOL _usesDataSource;
|
|
||||||
}
|
}
|
||||||
|
- (void) setClassName: (NSString *)name;
|
||||||
|
- (NSString *)className;
|
||||||
|
- (void) setExtension: (NSString *)view;
|
||||||
|
- (NSString *)extension;
|
||||||
|
- (id)nibInstantiate;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSButtonTemplate : NSButton <__DeprecatedTemplate__>
|
@interface NSCustomResource : NSObject <NSCoding>
|
||||||
{
|
{
|
||||||
NSString *_className;
|
NSString *_className;
|
||||||
NSString *_parentClassName;
|
NSString *_resourceName;
|
||||||
NSButtonType _buttonType;
|
|
||||||
}
|
}
|
||||||
|
- (void) setClassName: (NSString *)className;
|
||||||
|
- (NSString *)className;
|
||||||
|
- (void) setResourceName: (NSString *)view;
|
||||||
|
- (NSString *)resourceName;
|
||||||
|
- (id)nibInstantiate;
|
||||||
@end
|
@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 */
|
#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/NSText.h>
|
||||||
#include <AppKit/NSTextView.h>
|
#include <AppKit/NSTextView.h>
|
||||||
#include <AppKit/NSControl.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 GNUSTEP_NIB_VERSION 1
|
||||||
#define GSSWAPPER_VERSION 0
|
#define GSSWAPPER_VERSION 0
|
||||||
#define GSWINDOWT_VERSION 1
|
#define GSWINDOWT_VERSION 1
|
||||||
|
@ -62,17 +63,13 @@ enum {
|
||||||
/*
|
/*
|
||||||
* This is the class that holds objects within a nib.
|
* This is the class that holds objects within a nib.
|
||||||
*/
|
*/
|
||||||
@interface GSNibContainer : NSObject <NSCoding>
|
@interface GSNibContainer : NSObject <NSCoding, GSNibContainer>
|
||||||
{
|
{
|
||||||
NSMutableDictionary *nameTable;
|
NSMutableDictionary *nameTable;
|
||||||
NSMutableArray *connections;
|
NSMutableArray *connections;
|
||||||
NSMutableSet *topLevelObjects;
|
NSMutableSet *topLevelObjects;
|
||||||
BOOL isAwake;
|
BOOL isAwake;
|
||||||
}
|
}
|
||||||
- (void) awakeWithContext: (NSDictionary *)context;
|
|
||||||
- (NSMutableDictionary*) nameTable;
|
|
||||||
- (NSMutableArray*) connections;
|
|
||||||
- (NSMutableSet*) topLevelObjects;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -55,7 +55,8 @@
|
||||||
@interface NSNib : NSObject <NSCoding>
|
@interface NSNib : NSObject <NSCoding>
|
||||||
{
|
{
|
||||||
NSData *_nibData;
|
NSData *_nibData;
|
||||||
NSMutableArray *_topLevelItems;
|
id _loader;
|
||||||
|
NSURL *_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reading the data...
|
// reading the data...
|
||||||
|
|
|
@ -200,8 +200,11 @@ GSWindowDecorationView.m \
|
||||||
GSPrinting.m \
|
GSPrinting.m \
|
||||||
GSPrintOperation.m \
|
GSPrintOperation.m \
|
||||||
GSEPSPrintOperation.m \
|
GSEPSPrintOperation.m \
|
||||||
GSPDFPrintOperation.m
|
GSPDFPrintOperation.m \
|
||||||
|
GSModelLoaderFactory.m \
|
||||||
|
GSGormLoader.m \
|
||||||
|
GSGModelLoader.m \
|
||||||
|
GSNibLoader.m
|
||||||
|
|
||||||
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
|
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
|
||||||
# but does not implement <NSObject>'s methods itself (it inherits
|
# but does not implement <NSObject>'s methods itself (it inherits
|
||||||
|
@ -360,6 +363,7 @@ GSTextConverter.h \
|
||||||
GSTrackingRect.h \
|
GSTrackingRect.h \
|
||||||
GSHelpManagerPanel.h \
|
GSHelpManagerPanel.h \
|
||||||
GSNibTemplates.h \
|
GSNibTemplates.h \
|
||||||
|
GSNibContainer.h \
|
||||||
GSDisplayServer.h \
|
GSDisplayServer.h \
|
||||||
GSFusedSilica.h \
|
GSFusedSilica.h \
|
||||||
GSTable.h \
|
GSTable.h \
|
||||||
|
@ -380,7 +384,9 @@ GSTitleView.h \
|
||||||
GSPrinting.h \
|
GSPrinting.h \
|
||||||
GSPrintOperation.h \
|
GSPrintOperation.h \
|
||||||
GSEPSPrintOperation.h \
|
GSEPSPrintOperation.h \
|
||||||
GSPDFPrintOperation.h
|
GSPDFPrintOperation.h \
|
||||||
|
GSModelLoaderFactory.h \
|
||||||
|
GSInstantiator.h
|
||||||
|
|
||||||
libgnustep-gui_HEADER_FILES = ${GUI_HEADERS}
|
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"]];
|
[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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
Date: 1997
|
Date: 1997
|
||||||
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
Date: 1999
|
Date: 1999
|
||||||
|
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
Date: 2000
|
||||||
|
|
||||||
This file is part of the GNUstep GUI Library.
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
@ -45,10 +47,11 @@
|
||||||
#include <Foundation/NSUserDefaults.h>
|
#include <Foundation/NSUserDefaults.h>
|
||||||
#include <Foundation/NSKeyValueCoding.h>
|
#include <Foundation/NSKeyValueCoding.h>
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
|
#include <AppKit/NSControl.h>
|
||||||
#include "AppKit/NSNibConnector.h"
|
#include "AppKit/NSNibConnector.h"
|
||||||
#include "AppKit/NSNibLoading.h"
|
#include "AppKit/NSNibLoading.h"
|
||||||
#include "GNUstepGUI/GSNibTemplates.h"
|
#include "GNUstepGUI/GSInstantiator.h"
|
||||||
#include "GNUstepGUI/IMLoading.h"
|
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||||
|
|
||||||
@implementation NSNibConnector
|
@implementation NSNibConnector
|
||||||
|
|
||||||
|
@ -67,9 +70,18 @@
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[aCoder encodeObject: _src];
|
if ([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeObject: _dst];
|
{
|
||||||
[aCoder encodeObject: _tag];
|
[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
|
- (void) establishConnection
|
||||||
|
@ -80,8 +92,8 @@
|
||||||
{
|
{
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
|
|
||||||
ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
|
ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
|
||||||
|
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
|
||||||
ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
|
ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -144,6 +156,12 @@
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) instantiateWithInstantiator: (id<GSInstantiator>)instantiator
|
||||||
|
{
|
||||||
|
_src = [instantiator instantiateObject: _src];
|
||||||
|
_dst = [instantiator instantiateObject: _dst];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSNibControlConnector
|
@implementation NSNibControlConnector
|
||||||
|
@ -196,139 +214,14 @@
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSBundle (NSBundleAdditions)
|
@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
|
+ (BOOL) loadNibFile: (NSString*)fileName
|
||||||
externalNameTable: (NSDictionary*)context
|
externalNameTable: (NSDictionary*)context
|
||||||
withZone: (NSZone*)zone
|
withZone: (NSZone*)zone
|
||||||
{
|
{
|
||||||
BOOL loaded = NO;
|
GSModelLoader *loader = [GSModelLoaderFactory modelLoaderForFileName: fileName];
|
||||||
NSUnarchiver *unarchiver = nil;
|
BOOL loaded = [loader loadModelFile: fileName
|
||||||
NSString *ext = [fileName pathExtension];
|
externalNameTable: context
|
||||||
|
withZone: zone];
|
||||||
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");
|
|
||||||
}
|
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,21 +267,12 @@ Class gmodel_class(void)
|
||||||
|
|
||||||
- (NSString *) pathForNibResource: (NSString *)fileName
|
- (NSString *) pathForNibResource: (NSString *)fileName
|
||||||
{
|
{
|
||||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
|
||||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 8];
|
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 8];
|
||||||
NSArray *languages = [NSUserDefaults userLanguages];
|
NSArray *languages = [NSUserDefaults userLanguages];
|
||||||
NSString *rootPath = [self bundlePath];
|
NSString *rootPath = [self bundlePath];
|
||||||
NSString *primary;
|
NSString *primary;
|
||||||
NSString *language;
|
NSString *language;
|
||||||
NSEnumerator *enumerator;
|
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 -
|
* Build an array of resource paths that differs from the normal order -
|
||||||
|
@ -418,32 +302,13 @@ Class gmodel_class(void)
|
||||||
enumerator = [array objectEnumerator];
|
enumerator = [array objectEnumerator];
|
||||||
while ((rootPath = [enumerator nextObject]) != nil)
|
while ((rootPath = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
NSString *path;
|
NSString *modelPath = [rootPath stringByAppendingPathComponent: fileName];
|
||||||
|
NSString *path = [GSModelLoaderFactory supportedModelFileAtPath: modelPath];
|
||||||
rootPath = [rootPath stringByAppendingPathComponent: fileName];
|
|
||||||
// If the file does not have an extension, then we need to
|
if(path != nil)
|
||||||
// figure out what type of model file to load.
|
|
||||||
if ([ext isEqualToString: @""] == YES)
|
|
||||||
{
|
{
|
||||||
path = [rootPath stringByAppendingPathExtension: @"gorm"];
|
|
||||||
if ([mgr isReadableFileAtPath: path] == NO)
|
|
||||||
{
|
|
||||||
path = [rootPath stringByAppendingPathExtension: @"gmodel"];
|
|
||||||
if ([mgr isReadableFileAtPath: path] == NO)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
path = [rootPath stringByAppendingPathExtension: ext];
|
|
||||||
if ([mgr isReadableFileAtPath: path])
|
|
||||||
{
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
@ -55,6 +55,54 @@
|
||||||
|
|
||||||
#include <math.h>
|
#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 inset:2
|
||||||
|
unsigned int unused2:4; // 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)
|
@interface NSButtonCell (Private)
|
||||||
// Overriden private internal method
|
// Overriden private internal method
|
||||||
- (void) _drawImage: (NSImage *)anImage inFrame: (NSRect)aRect
|
- (void) _drawImage: (NSImage *)anImage inFrame: (NSRect)aRect
|
||||||
|
@ -1394,8 +1442,9 @@
|
||||||
*/
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
// FIXME: Add new ivars
|
|
||||||
BOOL tmp;
|
BOOL tmp;
|
||||||
|
|
||||||
|
// FIXME: Add new ivars
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
|
||||||
[aCoder encodeObject: _keyEquivalent];
|
[aCoder encodeObject: _keyEquivalent];
|
||||||
|
@ -1420,10 +1469,10 @@
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
//NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
|
// NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSKeyEquivalent"])
|
if ([aDecoder containsValueForKey: @"NSKeyEquivalent"])
|
||||||
{
|
{
|
||||||
[self setKeyEquivalent: [aDecoder decodeObjectForKey: @"NSKeyEquivalent"]];
|
[self setKeyEquivalent: [aDecoder decodeObjectForKey: @"NSKeyEquivalent"]];
|
||||||
|
@ -1432,52 +1481,38 @@
|
||||||
{
|
{
|
||||||
[self setImage: [aDecoder decodeObjectForKey: @"NSNormalImage"]];
|
[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"])
|
if ([aDecoder containsValueForKey: @"NSAlternateContents"])
|
||||||
{
|
{
|
||||||
[self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
|
[self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
|
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
|
||||||
{
|
{
|
||||||
int bFlags;
|
unsigned int bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
||||||
int highlights = 0;
|
int highlights = 0;
|
||||||
int show_state = NSNoCellMask;
|
int show_state = NSNoCellMask;
|
||||||
|
GSButtonCellFlags buttonCellFlags;
|
||||||
|
memcpy((void *)&buttonCellFlags,(void *)&bFlags,sizeof(struct _GSButtonCellFlags));
|
||||||
|
|
||||||
bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
[self setTransparent: buttonCellFlags.isTransparent];
|
||||||
|
[self setBordered: buttonCellFlags.isBordered];
|
||||||
[self setTransparent: (bFlags & 0x8000)];
|
|
||||||
// FIXME
|
if (buttonCellFlags.highlightByBackground)
|
||||||
if ((bFlags & 0x800000) == 0x800000)
|
|
||||||
{
|
|
||||||
[self setBordered: YES];
|
|
||||||
}
|
|
||||||
if ((bFlags & 0x6000000) == 0x6000000)
|
|
||||||
{
|
{
|
||||||
highlights |= NSChangeBackgroundCellMask;
|
highlights |= NSChangeBackgroundCellMask;
|
||||||
}
|
}
|
||||||
if ((bFlags & 0x8000000) == 0x8000000)
|
if (buttonCellFlags.highlightByContents)
|
||||||
{
|
{
|
||||||
highlights |= NSContentsCellMask;
|
highlights |= NSContentsCellMask;
|
||||||
}
|
}
|
||||||
if ((bFlags & 0x30000000) == 0x30000000)
|
if (buttonCellFlags.changeBackground)
|
||||||
{
|
{
|
||||||
show_state |= NSChangeBackgroundCellMask;
|
show_state |= NSChangeBackgroundCellMask;
|
||||||
}
|
}
|
||||||
if ((bFlags & 0x40000000) == 0x40000000)
|
if (buttonCellFlags.changeContents)
|
||||||
{
|
{
|
||||||
show_state |= NSContentsCellMask;
|
show_state |= NSContentsCellMask;
|
||||||
}
|
}
|
||||||
if ((bFlags & 0x80000000) == 0x80000000)
|
if (buttonCellFlags.isPushin)
|
||||||
{
|
{
|
||||||
highlights |= NSPushInCellMask;
|
highlights |= NSPushInCellMask;
|
||||||
}
|
}
|
||||||
|
@ -1528,6 +1563,40 @@
|
||||||
break;
|
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"])
|
if ([aDecoder containsValueForKey: @"NSPeriodicDelay"])
|
||||||
{
|
{
|
||||||
delay = [aDecoder decodeIntForKey: @"NSPeriodicDelay"];
|
delay = [aDecoder decodeIntForKey: @"NSPeriodicDelay"];
|
||||||
|
|
|
@ -2256,13 +2256,12 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSCellFlags"])
|
if ([aDecoder containsValueForKey: @"NSCellFlags"])
|
||||||
{
|
{
|
||||||
int cFlags;
|
unsigned long cFlags;
|
||||||
|
|
||||||
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"];
|
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"];
|
||||||
|
|
||||||
// This bit flag is the other way around!
|
// This bit flag is the other way around!
|
||||||
[self setWraps: ((cFlags & 0x40) != 0x40)];
|
[self setWraps: ((cFlags & 0x40) != 0x40)];
|
||||||
[self setContinuous: ((cFlags & 0x80000) == 0x80000)];
|
|
||||||
[self setScrollable: ((cFlags & 0x100000) == 0x100000)];
|
[self setScrollable: ((cFlags & 0x100000) == 0x100000)];
|
||||||
// Strange that this is not a simple bit flag
|
// Strange that this is not a simple bit flag
|
||||||
[self setSelectable: ((cFlags & 0x200001) == 0x200001)];
|
[self setSelectable: ((cFlags & 0x200001) == 0x200001)];
|
||||||
|
@ -2272,12 +2271,13 @@ static NSColor *shadowCol;
|
||||||
{
|
{
|
||||||
[self setType: NSTextCellType];
|
[self setType: NSTextCellType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self setContinuous: ((cFlags & 0x40000) == 0x40000)];
|
||||||
[self setEditable: ((cFlags & 0x10000000) == 0x10000000)];
|
[self setEditable: ((cFlags & 0x10000000) == 0x10000000)];
|
||||||
// This bit flag is the other way around!
|
// This bit flag is the other way around!
|
||||||
[self setEnabled: ((cFlags & 0x20000000) != 0x20000000)];
|
[self setEnabled: ((cFlags & 0x20000000) != 0x20000000)];
|
||||||
[self setHighlighted: ((cFlags & 0x40000000) == 0x40000000)];
|
[self setHighlighted: ((cFlags & 0x40000000) == 0x40000000)];
|
||||||
// FIXME
|
[self setState: ((cFlags & 0x80000000) == 0x80000000)?NSOnState:NSOffState];
|
||||||
|
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSCellFlags2"])
|
if ([aDecoder containsValueForKey: @"NSCellFlags2"])
|
||||||
{
|
{
|
||||||
|
@ -2306,7 +2306,6 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
[self setImportsGraphics: ((cFlags2 & 0x20000000) == 0x20000000)];
|
[self setImportsGraphics: ((cFlags2 & 0x20000000) == 0x20000000)];
|
||||||
[self setAllowsEditingTextAttributes: ((cFlags2 & 0x40000000) == 0x40000000)];
|
[self setAllowsEditingTextAttributes: ((cFlags2 & 0x40000000) == 0x40000000)];
|
||||||
// FIXME
|
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSSupport"])
|
if ([aDecoder containsValueForKey: @"NSSupport"])
|
||||||
{
|
{
|
||||||
|
|
|
@ -753,29 +753,54 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: 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 encodeInt: flags forKey: @"NScvFlags"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
}
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsBackground];
|
else
|
||||||
[aCoder encodeObject: _cursor];
|
{
|
||||||
|
[aCoder encodeObject: _backgroundColor];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsBackground];
|
||||||
|
[aCoder encodeObject: _cursor];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
int flags;
|
[self setAutoresizesSubviews: YES];
|
||||||
|
|
||||||
[self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSBGColor"]];
|
[self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSBGColor"]];
|
||||||
[self setDocumentCursor: [aDecoder decodeObjectForKey: @"NSCursor"]];
|
[self setDocumentCursor: [aDecoder decodeObjectForKey: @"NSCursor"]];
|
||||||
[self setDocumentView: [aDecoder decodeObjectForKey: @"NSDocView"]];
|
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NScvFlags"])
|
if ([aDecoder containsValueForKey: @"NScvFlags"])
|
||||||
{
|
{
|
||||||
flags = [aDecoder decodeIntForKey: @"NScvFlags"];
|
int flags = [aDecoder decodeIntForKey: @"NScvFlags"];
|
||||||
// FIXME setCopiesOnScroll: setDrawsBackground:
|
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
|
else
|
||||||
|
|
|
@ -235,11 +235,22 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
[aCoder encodeObject: _the_color];
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_active];
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_bordered];
|
[aCoder encodeObject: _the_color forKey: @"NSColor"];
|
||||||
[aCoder encodeConditionalObject: _target];
|
// [aCoder encodeBool: _is_active forKey: @"NSEnabled"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
[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
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
@ -247,15 +258,31 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_the_color];
|
if([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_active];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_bordered];
|
NSString *action;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_target];
|
|
||||||
// Undo RETAIN by decoder
|
ASSIGN(_the_color, [aDecoder decodeObjectForKey: @"NSColor"]);
|
||||||
TEST_RELEASE(_target);
|
// _is_active = [aDecoder decodeBoolForKey: @"NSEnabled"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
_is_bordered = [aDecoder decodeBoolForKey: @"NSIsBordered"];
|
||||||
[self registerForDraggedTypes:
|
_target = [aDecoder decodeObjectForKey: @"NSTarget"];
|
||||||
[NSArray arrayWithObjects: NSColorPboardType, nil]];
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2183,7 +2183,9 @@ no_soft_invalidation:
|
||||||
if ([aDecoder containsValueForKey: @"NSLMFlags"])
|
if ([aDecoder containsValueForKey: @"NSLMFlags"])
|
||||||
{
|
{
|
||||||
flags = [aDecoder decodeIntForKey: @"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];
|
[self setDelegate: delegate];
|
||||||
[storage addLayoutManager: self];
|
[storage addLayoutManager: self];
|
||||||
|
|
|
@ -121,6 +121,40 @@ typedef struct {
|
||||||
int height;
|
int height;
|
||||||
} MRect;
|
} 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)
|
static inline MPoint MakePoint (int x, int y)
|
||||||
{
|
{
|
||||||
MPoint point = { x, y };
|
MPoint point = { x, y };
|
||||||
|
@ -2719,10 +2753,28 @@ static SEL getSel;
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSMatrixFlags"])
|
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"];
|
if(matrixFlags.isRadio)
|
||||||
// FIXME
|
{
|
||||||
|
[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"])
|
if ([aDecoder containsValueForKey: @"NSNumCols"])
|
||||||
{
|
{
|
||||||
|
|
|
@ -436,22 +436,40 @@ static Class imageClass;
|
||||||
*/
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[aCoder encodeObject: _title];
|
if ([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeObject: _keyEquivalent];
|
{
|
||||||
[aCoder encodeValueOfObjCType: "I" at: &_keyEquivalentModifierMask];
|
[aCoder encodeObject: _title forKey: @"NSTitle"];
|
||||||
[aCoder encodeValueOfObjCType: "I" at: &_mnemonicLocation];
|
[aCoder encodeObject: NSStringFromSelector(_action) forKey: @"NSAction"];
|
||||||
[aCoder encodeValueOfObjCType: "i" at: &_state];
|
[aCoder encodeObject: _keyEquivalent forKey: @"NSKeyEquiv"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_enabled];
|
[aCoder encodeObject: _onStateImage forKey: @"NSOnImage"];
|
||||||
[aCoder encodeObject: _image];
|
[aCoder encodeObject: _offStateImage forKey: @"NSOffImage"]; // ???????
|
||||||
[aCoder encodeObject: _onStateImage];
|
[aCoder encodeObject: _mixedStateImage forKey: @"NSMixedImage"];
|
||||||
[aCoder encodeObject: _offStateImage];
|
[aCoder encodeObject: _target forKey: @"NSTarget"];
|
||||||
[aCoder encodeObject: _mixedStateImage];
|
[aCoder encodeObject: _menu forKey: @"NSMenu"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_changesState];
|
[aCoder encodeObject: _submenu forKey: @"NSSubmenu"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
[aCoder encodeInt: _keyEquivalentModifierMask forKey: @"NSKeyEquivModMask"];
|
||||||
[aCoder encodeValueOfObjCType: "i" at: &_tag];
|
[aCoder encodeInt: _mnemonicLocation forKey: @"NSMnemonicLoc"];
|
||||||
[aCoder encodeConditionalObject: _representedObject];
|
[aCoder encodeInt: _state forKey: @"NSState"];
|
||||||
[aCoder encodeObject: _submenu];
|
}
|
||||||
[aCoder encodeConditionalObject: _target];
|
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
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
@ -461,10 +479,11 @@ static Class imageClass;
|
||||||
NSString *title = [aDecoder decodeObjectForKey: @"NSTitle"];
|
NSString *title = [aDecoder decodeObjectForKey: @"NSTitle"];
|
||||||
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||||
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquiv"];
|
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquiv"];
|
||||||
//NSMenu *menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
|
||||||
NSImage *mixedImage = [aDecoder decodeObjectForKey: @"NSMixedImage"];
|
NSImage *mixedImage = [aDecoder decodeObjectForKey: @"NSMixedImage"];
|
||||||
NSImage *onImage = [aDecoder decodeObjectForKey: @"NSOnImage"];
|
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
|
self = [self initWithTitle: title
|
||||||
action: NSSelectorFromString(action)
|
action: NSSelectorFromString(action)
|
||||||
|
@ -472,10 +491,12 @@ static Class imageClass;
|
||||||
[self setTarget: target];
|
[self setTarget: target];
|
||||||
[self setMixedStateImage: mixedImage];
|
[self setMixedStateImage: mixedImage];
|
||||||
[self setOnStateImage: onImage];
|
[self setOnStateImage: onImage];
|
||||||
|
[self setSubmenu: submenu];
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSKeyEquivModMask"])
|
if ([aDecoder containsValueForKey: @"NSKeyEquivModMask"])
|
||||||
{
|
{
|
||||||
//int keyMask = [aDecoder decodeIntForKey: @"NSKeyEquivModMask"];
|
int keyMask = [aDecoder decodeIntForKey: @"NSKeyEquivModMask"];
|
||||||
|
[self setKeyEquivalentModifierMask: keyMask];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSMnemonicLoc"])
|
if ([aDecoder containsValueForKey: @"NSMnemonicLoc"])
|
||||||
{
|
{
|
||||||
|
@ -485,7 +506,6 @@ static Class imageClass;
|
||||||
if ([aDecoder containsValueForKey: @"NSState"])
|
if ([aDecoder containsValueForKey: @"NSState"])
|
||||||
{
|
{
|
||||||
int state = [aDecoder decodeIntForKey: @"NSState"];
|
int state = [aDecoder decodeIntForKey: @"NSState"];
|
||||||
|
|
||||||
[self setState: state];
|
[self setState: state];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
131
Source/NSNib.m
131
Source/NSNib.m
|
@ -51,57 +51,21 @@
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
|
#include "GNUstepGUI/GSModelLoaderFactory.h"
|
||||||
#include "GNUstepGUI/GSNibTemplates.h"
|
#include "GNUstepGUI/GSNibTemplates.h"
|
||||||
#include "GNUstepGUI/IMLoading.h"
|
#include "GNUstepGUI/IMLoading.h"
|
||||||
|
|
||||||
@implementation NSNib
|
@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...
|
// private method to read in the data...
|
||||||
- (void) _readNibData: (NSString *)fileName
|
- (void) _readNibData: (NSString *)fileName
|
||||||
{
|
{
|
||||||
NSString *ext = [fileName pathExtension];
|
NSDebugLog(@"Loading model `%@'...\n", fileName);
|
||||||
|
|
||||||
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);
|
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
NSString *newFileName = [NSNib _nibFilename: fileName];
|
NSString *newFileName = [GSModelLoaderFactory supportedModelFileAtPath: fileName];
|
||||||
_nibData = [NSData dataWithContentsOfFile: newFileName];
|
ASSIGN(_nibData, [NSData dataWithContentsOfFile: newFileName]);
|
||||||
|
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileName: newFileName]);
|
||||||
NSDebugLog(@"Loaded data from %@...",newFileName);
|
NSDebugLog(@"Loaded data from %@...",newFileName);
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
|
@ -155,6 +119,7 @@
|
||||||
{
|
{
|
||||||
// load the nib data into memory...
|
// load the nib data into memory...
|
||||||
_nibData = [NSData dataWithContentsOfURL: nibFileURL];
|
_nibData = [NSData dataWithContentsOfURL: nibFileURL];
|
||||||
|
ASSIGN(_url, nibFileURL);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -192,51 +157,9 @@
|
||||||
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
|
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
|
||||||
withZone: (NSZone *)zone
|
withZone: (NSZone *)zone
|
||||||
{
|
{
|
||||||
BOOL loaded = NO;
|
return [_loader loadModelData: _nibData
|
||||||
NSUnarchiver *unarchiver = nil;
|
externalNameTable: externalNameTable
|
||||||
|
withZone: zone];
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -277,21 +200,49 @@
|
||||||
{
|
{
|
||||||
if ((self = [super init]) != nil)
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder *)coder
|
- (void) encodeWithCoder: (NSCoder *)coder
|
||||||
{
|
{
|
||||||
[coder encodeValueOfObjCType: @encode(id)
|
if([coder allowsKeyedCoding])
|
||||||
at: &_nibData];
|
{
|
||||||
|
// Need to verify this key...
|
||||||
|
[coder encodeObject: _nibData
|
||||||
|
forKey: @"NSData"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[coder encodeValueOfObjCType: @encode(id)
|
||||||
|
at: &_nibData];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
RELEASE(_nibData);
|
RELEASE(_nibData);
|
||||||
|
RELEASE(_loader);
|
||||||
|
TEST_RELEASE(_url);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -756,35 +756,65 @@ static NSImage *unexpandable = nil;
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn];
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell];
|
}
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autosaveExpandedItems];
|
else
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_indentationPerLevel];
|
{
|
||||||
[aCoder encodeConditionalObject: _outlineTableColumn];
|
[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
|
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
// Since we only have one version....
|
// Since we only have one version....
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
|
if([aDecoder allowsKeyedCoding])
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell];
|
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||||
[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,
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1010,6 +1010,7 @@ static NSImage *_pbc_image[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
||||||
|
[self setMenu: nil];
|
||||||
[self setMenu: menu];
|
[self setMenu: menu];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,6 +42,27 @@
|
||||||
#include "AppKit/PSOperators.h"
|
#include "AppKit/PSOperators.h"
|
||||||
#include "GNUstepGUI/GSDrawFunctions.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
|
@implementation NSScrollView
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -548,6 +569,15 @@ static float scrollerWidth;
|
||||||
[_contentView scrollToPoint: point];
|
[_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
|
- (void) reflectScrolledClipView: (NSClipView *)aClipView
|
||||||
{
|
{
|
||||||
NSRect documentFrame = NSZeroRect;
|
NSRect documentFrame = NSZeroRect;
|
||||||
|
@ -1188,38 +1218,44 @@ static float scrollerWidth;
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
|
||||||
[aCoder encodeObject: _contentView];
|
if([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
}
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
else
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
[aCoder encodeObject: _contentView];
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll];
|
||||||
if (_hasHorizScroller)
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_hPageScroll];
|
||||||
[aCoder encodeObject: _horizScroller];
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_vLineScroll];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_vPageScroll];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
|
||||||
if (_hasVertScroller)
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizScroller];
|
||||||
[aCoder encodeObject: _vertScroller];
|
if (_hasHorizScroller)
|
||||||
|
[aCoder encodeObject: _horizScroller];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizRuler];
|
|
||||||
if (_hasHorizRuler)
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertScroller];
|
||||||
[aCoder encodeObject: _horizRuler];
|
if (_hasVertScroller)
|
||||||
|
[aCoder encodeObject: _vertScroller];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertRuler];
|
|
||||||
if (_hasVertRuler)
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHorizRuler];
|
||||||
[aCoder encodeObject: _vertRuler];
|
if (_hasHorizRuler)
|
||||||
|
[aCoder encodeObject: _horizRuler];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
|
||||||
if (_hasHeaderView)
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasVertRuler];
|
||||||
[aCoder encodeObject: _headerClipView];
|
if (_hasVertRuler)
|
||||||
|
[aCoder encodeObject: _vertRuler];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
|
||||||
/* We do not need to encode headerview, cornerview stuff */
|
if (_hasHeaderView)
|
||||||
|
[aCoder encodeObject: _headerClipView];
|
||||||
|
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
|
||||||
|
|
||||||
|
/* We do not need to encode headerview, cornerview stuff */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
@ -1228,32 +1264,71 @@ static float scrollerWidth;
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
NSClipView *content = [aDecoder decodeObjectForKey: @"NSContentView"];
|
|
||||||
NSScroller *hScroller = [aDecoder decodeObjectForKey: @"NSHScroller"];
|
NSScroller *hScroller = [aDecoder decodeObjectForKey: @"NSHScroller"];
|
||||||
NSScroller *vScroller = [aDecoder decodeObjectForKey: @"NSVScroller"];
|
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)
|
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];
|
[self setContentView: content];
|
||||||
|
RELEASE(content);
|
||||||
|
_contentView = content;
|
||||||
}
|
}
|
||||||
if (hScroller != nil)
|
|
||||||
|
if (hScroller != nil && _hasHorizScroller)
|
||||||
{
|
{
|
||||||
[self setHorizontalScroller: hScroller];
|
[self setHorizontalScroller: hScroller];
|
||||||
}
|
}
|
||||||
if (vScroller != nil)
|
|
||||||
|
if (vScroller != nil && _hasVertScroller)
|
||||||
{
|
{
|
||||||
[self setVerticalScroller: vScroller];
|
[self setVerticalScroller: vScroller];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
|
||||||
{
|
if ([aDecoder containsValueForKey: @"NSHeaderClipView"])
|
||||||
//int flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
{
|
||||||
// FIXME
|
_hasHeaderView = YES;
|
||||||
|
_hasCornerView = YES;
|
||||||
|
ASSIGN(_headerClipView, [aDecoder decodeObjectForKey: @"NSHeaderClipView"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self tile];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int version = [aDecoder versionForClassName:
|
int version = [aDecoder versionForClassName: @"NSScrollView"];
|
||||||
@"NSScrollView"];
|
|
||||||
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
|
||||||
|
|
|
@ -181,7 +181,25 @@ static NSColor *scrollBarColor = nil;
|
||||||
float value = 0.0;
|
float value = 0.0;
|
||||||
float percent = 0.0;
|
float percent = 0.0;
|
||||||
int flags;
|
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)
|
if (action != nil)
|
||||||
{
|
{
|
||||||
[self setAction: NSSelectorFromString(action)];
|
[self setAction: NSSelectorFromString(action)];
|
||||||
|
@ -201,8 +219,15 @@ static NSColor *scrollBarColor = nil;
|
||||||
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
if ([aDecoder containsValueForKey: @"NSsFlags"])
|
||||||
{
|
{
|
||||||
flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
flags = [aDecoder decodeIntForKey: @"NSsFlags"];
|
||||||
// FIXME
|
// is horiz is set above...
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup...
|
||||||
|
_hitPart = NSScrollerNoPart;
|
||||||
|
|
||||||
|
[self drawParts];
|
||||||
|
[self checkSpaceForParts];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,7 +88,6 @@
|
||||||
{
|
{
|
||||||
return [_cell echosBullets];
|
return [_cell echosBullets];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end /* NSSecureTextField */
|
@end /* NSSecureTextField */
|
||||||
|
|
||||||
@implementation NSSecureTextFieldCell
|
@implementation NSSecureTextFieldCell
|
||||||
|
@ -133,10 +132,17 @@
|
||||||
return [super setUpFieldEditorAttributes: textObject];
|
return [super setUpFieldEditorAttributes: textObject];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder:(NSCoder *)decoder
|
- (id) initWithCoder: (NSCoder *)decoder
|
||||||
{
|
{
|
||||||
[super initWithCoder: decoder];
|
self = [super initWithCoder: decoder];
|
||||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_echosBullets];
|
if([decoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
// do nothing for now...
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_echosBullets];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,15 +564,40 @@ DEFINE_RINT_IF_MISSING
|
||||||
- (id) initWithCoder: (NSCoder*)decoder
|
- (id) initWithCoder: (NSCoder*)decoder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: decoder];
|
self = [super initWithCoder: decoder];
|
||||||
[decoder decodeValuesOfObjCTypes: "fffi",
|
if([decoder allowsKeyedCoding])
|
||||||
&_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];
|
_allowsTickMarkValuesOnly = [decoder decodeBoolForKey: @"NSAllowsTickMarkValuesOnly"];
|
||||||
[decoder decodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
_numberOfTickMarks = [decoder decodeIntForKey: @"NSNumberOfTickMarks"];
|
||||||
[decoder decodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
_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;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -580,14 +605,27 @@ DEFINE_RINT_IF_MISSING
|
||||||
- (void) encodeWithCoder: (NSCoder*)coder
|
- (void) encodeWithCoder: (NSCoder*)coder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: coder];
|
[super encodeWithCoder: coder];
|
||||||
[coder encodeValuesOfObjCTypes: "fffi",
|
if([coder allowsKeyedCoding])
|
||||||
&_minValue, &_maxValue, &_altIncrementValue, &_isVertical];
|
{
|
||||||
[coder encodeValueOfObjCType: @encode(id) at: &_titleCell];
|
[coder encodeBool: _allowsTickMarkValuesOnly forKey: @"NSAllowsTickMarkValuesOnly"];
|
||||||
[coder encodeValueOfObjCType: @encode(id) at: &_knobCell];
|
[coder encodeInt: _numberOfTickMarks forKey: @"NSNumberOfTickMarks"];
|
||||||
// New for version 2
|
[coder encodeInt: _tickMarkPosition forKey: @"NSTickMarkPosition"];
|
||||||
[coder encodeValueOfObjCType: @encode(BOOL) at: &_allowsTickMarkValuesOnly];
|
[coder encodeFloat: _minValue forKey: @"NSMinValue"];
|
||||||
[coder encodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
[coder encodeFloat: _maxValue forKey: @"NSMaxValue"];
|
||||||
[coder encodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
[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
|
@end
|
||||||
|
|
|
@ -333,19 +333,33 @@ static inline void HighlightDownButton(NSRect aRect)
|
||||||
int tmp1, tmp2;
|
int tmp1, tmp2;
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
if([aDecoder allowsKeyedCoding])
|
||||||
at: &_maxValue];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
_autorepeat = [aDecoder decodeBoolForKey: @"NSAutorepeat"];
|
||||||
at: &_minValue];
|
_valueWraps = [aDecoder decodeBoolForKey: @"NSValueWraps"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
_increment = [aDecoder decodeIntForKey: @"NSIncrement"];
|
||||||
at: &_increment];
|
_maxValue = [aDecoder decodeIntForKey: @"NSMaxValue"];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
if([aDecoder containsValueForKey: @"NSMinValue"])
|
||||||
at: &tmp1];
|
{
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
_minValue = [aDecoder decodeIntForKey: @"NSMinValue"];
|
||||||
at: &tmp2];
|
}
|
||||||
|
}
|
||||||
|
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;
|
_autorepeat = (BOOL)tmp1;
|
||||||
_valueWraps = (BOOL)tmp2;
|
_valueWraps = (BOOL)tmp2;
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <Foundation/NSSet.h>
|
#include <Foundation/NSSet.h>
|
||||||
#include <Foundation/NSUserDefaults.h>
|
#include <Foundation/NSUserDefaults.h>
|
||||||
#include <Foundation/NSValue.h>
|
#include <Foundation/NSValue.h>
|
||||||
|
#include <Foundation/NSKeyedArchiver.h>
|
||||||
|
|
||||||
#include "AppKit/NSTableView.h"
|
#include "AppKit/NSTableView.h"
|
||||||
#include "AppKit/NSApplication.h"
|
#include "AppKit/NSApplication.h"
|
||||||
|
@ -73,6 +74,31 @@ static int currentDropRow;
|
||||||
static int lastQuarterPosition;
|
static int lastQuarterPosition;
|
||||||
static unsigned currentDragOperation;
|
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_MULTIPLE (1)
|
||||||
#define ALLOWS_EMPTY (1 << 1)
|
#define ALLOWS_EMPTY (1 << 1)
|
||||||
|
@ -80,7 +106,6 @@ static unsigned currentDragOperation;
|
||||||
#define CONTROL_DOWN (1 << 3)
|
#define CONTROL_DOWN (1 << 3)
|
||||||
#define ADDING_ROW (1 << 4)
|
#define ADDING_ROW (1 << 4)
|
||||||
|
|
||||||
|
|
||||||
@interface NSTableView (NotificationRequestMethods)
|
@interface NSTableView (NotificationRequestMethods)
|
||||||
- (void) _postSelectionIsChangingNotification;
|
- (void) _postSelectionIsChangingNotification;
|
||||||
- (void) _postSelectionDidChangeNotification;
|
- (void) _postSelectionDidChangeNotification;
|
||||||
|
@ -2236,6 +2261,7 @@ _isCellEditable (id delegate, NSArray *tableColumns,
|
||||||
|
|
||||||
/* We do *not* retain the dataSource, it's like a delegate */
|
/* We do *not* retain the dataSource, it's like a delegate */
|
||||||
_dataSource = anObject;
|
_dataSource = anObject;
|
||||||
|
|
||||||
[self tile];
|
[self tile];
|
||||||
[self reloadData];
|
[self reloadData];
|
||||||
}
|
}
|
||||||
|
@ -3766,12 +3792,12 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
- (void) setHeaderView: (NSTableHeaderView*)aHeaderView
|
- (void) setHeaderView: (NSTableHeaderView*)aHeaderView
|
||||||
{
|
{
|
||||||
|
|
||||||
if ([_headerView respondsToSelector:@selector(setTableView)])
|
if ([_headerView respondsToSelector:@selector(setTableView:)])
|
||||||
[_headerView setTableView: nil];
|
[_headerView setTableView: nil];
|
||||||
|
|
||||||
ASSIGN (_headerView, aHeaderView);
|
ASSIGN (_headerView, aHeaderView);
|
||||||
|
|
||||||
if ([_headerView respondsToSelector:@selector(setTableView)])
|
if ([_headerView respondsToSelector:@selector(setTableView:)])
|
||||||
[_headerView setTableView: self];
|
[_headerView setTableView: self];
|
||||||
|
|
||||||
[self tile]; // resizes corner and header views, then displays
|
[self tile]; // resizes corner and header views, then displays
|
||||||
|
@ -5112,30 +5138,70 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
|
||||||
[aCoder encodeConditionalObject: _dataSource];
|
if ([aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeObject: _tableColumns];
|
{
|
||||||
[aCoder encodeObject: _gridColor];
|
unsigned int vFlags = 0; // (raw >> 26); // filter out settings not pertinent to us.
|
||||||
[aCoder encodeObject: _backgroundColor];
|
NSSize intercellSpacing = [self intercellSpacing];
|
||||||
[aCoder encodeObject: _headerView];
|
|
||||||
[aCoder encodeObject: _cornerView];
|
|
||||||
[aCoder encodeConditionalObject: _delegate];
|
|
||||||
[aCoder encodeConditionalObject: _target];
|
|
||||||
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfRows];
|
[aCoder encodeObject: [self dataSource] forKey: @"NSDataSource"];
|
||||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
|
[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];
|
if([self allowsMultipleSelection])
|
||||||
[aCoder encodeValueOfObjCType: @encode(float) at: &_rowHeight];
|
vFlags |= 2;
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
|
|
||||||
[aCoder encodeSize: _intercellSpacing];
|
|
||||||
|
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsMultipleSelection];
|
if([self allowsEmptySelection])
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
|
vFlags |= 4;
|
||||||
[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 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
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
@ -5149,10 +5215,19 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
NSEnumerator *e;
|
NSEnumerator *e;
|
||||||
NSTableColumn *col;
|
NSTableColumn *col;
|
||||||
|
|
||||||
[self setDataSource: [aDecoder decodeObjectForKey: @"NSDataSource"]];
|
[(NSKeyedUnarchiver *)aDecoder setClass: [GSTableCornerView class] forClassName: @"_NSCornerView"];
|
||||||
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
|
if ([aDecoder containsValueForKey: @"NSDataSource"])
|
||||||
|
{
|
||||||
[self setTarget: [aDecoder decodeObjectForKey: @"NSTarget"]];
|
[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"])
|
if ([aDecoder containsValueForKey: @"NSAction"])
|
||||||
{
|
{
|
||||||
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||||
|
@ -5179,19 +5254,66 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
{
|
{
|
||||||
[self setRowHeight: [aDecoder decodeFloatForKey: @"NSRowHeight"]];
|
[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"];
|
columns = [aDecoder decodeObjectForKey: @"NSTableColumns"];
|
||||||
e = [columns objectEnumerator];
|
e = [columns objectEnumerator];
|
||||||
while ((col = [e nextObject]) != nil)
|
while ((col = [e nextObject]) != nil)
|
||||||
{
|
{
|
||||||
[self addTableColumn: col];
|
[self addTableColumn: col];
|
||||||
|
[col setTableView: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSTvFlags"])
|
if ([aDecoder containsValueForKey: @"NSTvFlags"])
|
||||||
{
|
{
|
||||||
//int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
unsigned long flags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
||||||
// FIXME set the flags
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -5250,15 +5372,6 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
{
|
{
|
||||||
[self tile];
|
[self tile];
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
NSLog(@"frame %@", NSStringFromRect([self frame]));
|
|
||||||
NSLog(@"dataSource %@", _dataSource);
|
|
||||||
if (_dataSource != nil)
|
|
||||||
{
|
|
||||||
[self setDataSource: _dataSource];
|
|
||||||
NSLog(@"dataSource set");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -433,10 +433,9 @@ framework intact.
|
||||||
{
|
{
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
//NSLayoutManager *manager = [aDecoder decodeObjectForKey: @"NSLayoutManager"];
|
|
||||||
NSTextView *view = [aDecoder decodeObjectForKey: @"NSTextView"];
|
NSTextView *view = [aDecoder decodeObjectForKey: @"NSTextView"];
|
||||||
NSSize size = NSZeroSize;
|
NSSize size = NSZeroSize;
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSWidth"])
|
if ([aDecoder containsValueForKey: @"NSWidth"])
|
||||||
{
|
{
|
||||||
size.width = [aDecoder decodeFloatForKey: @"NSWidth"];
|
size.width = [aDecoder decodeFloatForKey: @"NSWidth"];
|
||||||
|
@ -444,10 +443,16 @@ framework intact.
|
||||||
self = [self initWithContainerSize: size];
|
self = [self initWithContainerSize: size];
|
||||||
if ([aDecoder containsValueForKey: @"NSTCFlags"])
|
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];
|
[self setTextView: view];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -709,17 +709,19 @@ static Class textFieldCellClass;
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
if(![aCoder allowsKeyedCoding])
|
||||||
[aCoder encodeConditionalObject: _delegate];
|
{
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_error_action];
|
[aCoder encodeConditionalObject: _delegate];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_error_action];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
|
if([aDecoder allowsKeyedCoding])
|
||||||
if ([aDecoder allowsKeyedCoding])
|
|
||||||
{
|
{
|
||||||
|
// do nothing for now...
|
||||||
}
|
}
|
||||||
else
|
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
|
// This class is a helper for keyed unarchiving only
|
||||||
@interface NSTextViewSharedData : NSObject
|
@interface NSTextViewSharedData : NSObject
|
||||||
{
|
{
|
||||||
@public
|
@private
|
||||||
NSColor *backgroundColor;
|
NSColor *backgroundColor;
|
||||||
NSParagraphStyle *paragraphStyle;
|
NSParagraphStyle *paragraphStyle;
|
||||||
int flags;
|
unsigned int flags;
|
||||||
NSColor *insertionColor;
|
NSColor *insertionColor;
|
||||||
NSArray *linkAttr;
|
NSArray *linkAttr;
|
||||||
NSArray *markAttr;
|
NSArray *markAttr;
|
||||||
NSArray *selectedAttr;
|
NSArray *selectedAttr;
|
||||||
NSTextView *textView;
|
NSTextView *textView;
|
||||||
}
|
}
|
||||||
|
- (NSColor *) backgroundColor;
|
||||||
|
- (NSParagraphStyle *) paragraphStyle;
|
||||||
|
- (unsigned int) flags;
|
||||||
|
- (NSColor *) insertionColor;
|
||||||
|
- (NSArray *) linkAttributes;
|
||||||
|
- (NSArray *) markAttributes;
|
||||||
|
- (NSArray *) selectedAttributes;
|
||||||
|
- (NSTextView *) textView;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSTextViewSharedData
|
@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(markAttr, [aDecoder decodeObjectForKey: @"NSMarkedAttributes"]);
|
||||||
ASSIGN(selectedAttr, [aDecoder decodeObjectForKey: @"NSSelectedAttributes"]);
|
ASSIGN(selectedAttr, [aDecoder decodeObjectForKey: @"NSSelectedAttributes"]);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +173,45 @@ Interface for a bunch of internal methods that need to be cleaned up.
|
||||||
RELEASE(selectedAttr);
|
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
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,45 +691,97 @@ that makes decoding and encoding compatible with the old code.
|
||||||
-(id) initWithCoder: (NSCoder *)aDecoder
|
-(id) initWithCoder: (NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
|
NSTextContainer *aTextContainer;
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSDelegate"])
|
if ([aDecoder containsValueForKey: @"NSDelegate"])
|
||||||
{
|
{
|
||||||
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
|
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSMaxSize"])
|
if ([aDecoder containsValueForKey: @"NSMaxSize"])
|
||||||
{
|
{
|
||||||
[self setMaxSize: [aDecoder decodeSizeForKey: @"NSMaxSize"]];
|
[self setMaxSize: [aDecoder decodeSizeForKey: @"NSMaxSize"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSMinize"])
|
if ([aDecoder containsValueForKey: @"NSMinize"])
|
||||||
{
|
{
|
||||||
// it's NSMinize in pre-10.3 formats.
|
// it's NSMinize in pre-10.3 formats.
|
||||||
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinize"]];
|
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinize"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSMinSize"])
|
if ([aDecoder containsValueForKey: @"NSMinSize"])
|
||||||
{
|
{
|
||||||
// However, if NSMinSize is present we want to use it.
|
// However, if NSMinSize is present we want to use it.
|
||||||
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinSize"]];
|
[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"])
|
if ([aDecoder containsValueForKey: @"NSTVFlags"])
|
||||||
{
|
{
|
||||||
//int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"];
|
int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"];
|
||||||
// FIXME set the flags
|
// these flags are not used...
|
||||||
}
|
|
||||||
if ([aDecoder containsValueForKey: @"NSSharedData"])
|
|
||||||
{
|
|
||||||
//NSTextViewSharedData *shared = [aDecoder decodeObjectForKey: @"NSSharedData"];
|
|
||||||
}
|
|
||||||
if ([aDecoder containsValueForKey: @"NSTextStorage"])
|
|
||||||
{
|
|
||||||
//NSTextStorage *storage = [aDecoder decodeObjectForKey: @"NSTextStorage"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -1515,7 +1612,6 @@ incorrectly. */
|
||||||
[self setConstrainedFrameSize: size];
|
[self setConstrainedFrameSize: size];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: There is code in TextEdit that implies that the minimum size is
|
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
|
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
|
[aCoder encodeInt: vFlags
|
||||||
forKey: @"NSvFlags"];
|
forKey: @"NSvFlags"];
|
||||||
|
|
||||||
|
[aCoder encodeObject: _super_view forKey: @"NSSuperview"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3938,6 +3940,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
|
NSEnumerator *e;
|
||||||
|
NSView *sub;
|
||||||
|
NSArray *subs;
|
||||||
|
|
||||||
// decode the superclass...
|
// decode the superclass...
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
|
|
||||||
|
@ -3949,9 +3955,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
NSView *prevKeyView = [aDecoder decodeObjectForKey: @"NSPreviousKeyView"];
|
NSView *prevKeyView = nil;
|
||||||
NSView *nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
NSView *nextKeyView = nil;
|
||||||
NSArray *subViews = [aDecoder decodeObjectForKey: @"NSSubviews"];
|
|
||||||
|
|
||||||
if ([aDecoder containsValueForKey: @"NSFrame"])
|
if ([aDecoder containsValueForKey: @"NSFrame"])
|
||||||
{
|
{
|
||||||
|
@ -3959,17 +3964,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
[_frameMatrix setFrameOrigin: _frame.origin];
|
[_frameMatrix setFrameOrigin: _frame.origin];
|
||||||
}
|
}
|
||||||
self = [self initWithFrame: _frame];
|
self = [self initWithFrame: _frame];
|
||||||
|
|
||||||
if (subViews != nil)
|
subs = [aDecoder decodeObjectForKey: @"NSSubviews"];
|
||||||
{
|
prevKeyView = [aDecoder decodeObjectForKey: @"NSPreviousKeyView"];
|
||||||
NSEnumerator *enumerator = [subViews objectEnumerator];
|
nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
||||||
NSView *sub;
|
|
||||||
|
|
||||||
while ((sub = [enumerator nextObject]) != nil)
|
|
||||||
{
|
|
||||||
[self addSubview: sub];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nextKeyView != nil)
|
if (nextKeyView != nil)
|
||||||
{
|
{
|
||||||
[self setNextKeyView: nextKeyView];
|
[self setNextKeyView: nextKeyView];
|
||||||
|
@ -3992,9 +3990,6 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
NSEnumerator *e;
|
|
||||||
NSView *sub;
|
|
||||||
NSArray *subs;
|
|
||||||
|
|
||||||
NSDebugLLog(@"NSView", @"NSView: start decoding\n");
|
NSDebugLLog(@"NSView", @"NSView: start decoding\n");
|
||||||
|
|
||||||
|
@ -4029,25 +4024,27 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
[[aDecoder decodeObject] setNextKeyView: self];
|
[[aDecoder decodeObject] setNextKeyView: self];
|
||||||
|
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &subs];
|
[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");
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue