Merge branch 'master' into NSLayoutConstraint_branch

This commit is contained in:
Gregory John Casamento 2020-07-08 18:45:04 -04:00
commit d2f79dbec0
14 changed files with 124 additions and 76 deletions

View file

@ -1,3 +1,14 @@
2020-07-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSXib5KeyedUnarchiver.m (alternateName:): Be more careful
when chopping of part of the name.
2020-07-03 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSNib.h,
* Source/NSNib.m: Add missing MacOSX methods.
* Source/GSXibLoader.m: Remove semicolon. Add debug logs.
2020-06-15 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/AppKit.h

View file

@ -33,12 +33,12 @@
extern "C" {
#endif
DEFINE_BLOCK_TYPE(GSCustomActionHandler, void, BOOL);
DEFINE_BLOCK_TYPE(GSAccessibilityCustomActionHandler, void, BOOL);
@interface NSAccessibilityCustomAction : NSObject
- (instancetype)initWithName: (NSString *)name
handler: (GSCustomActionHandler)handler;
handler: (GSAccessibilityCustomActionHandler)handler;
- (instancetype)initWithName: (NSString *)name
target: (id)target
@ -47,8 +47,8 @@ DEFINE_BLOCK_TYPE(GSCustomActionHandler, void, BOOL);
- (NSString *) name;
- (void) setName: (NSString *)name;
- (GSCustomActionHandler) handler;
- (void) setHandler: (GSCustomActionHandler)handler;
- (GSAccessibilityCustomActionHandler) handler;
- (void) setHandler: (GSAccessibilityCustomActionHandler)handler;
- (id) target;
- (void) setTarget: (id)target;

View file

@ -60,17 +60,23 @@ APPKIT_EXPORT NSString *NSNibTopLevelObjects;
APPKIT_EXPORT NSString *NSNibOwner;
#endif
typedef NSString *NSNibName;
@interface NSNib : NSObject <NSCoding>
{
NSData *_nibData;
id _loader;
NSURL *_url;
NSBundle *_bundle;
}
// reading the data...
- (id)initWithContentsOfURL: (NSURL *)nibFileURL;
- (id)initWithNibNamed: (NSString *)nibNamed bundle: (NSBundle *)bundle;
- (instancetype)initWithNibNamed: (NSNibName)nibNamed bundle: (NSBundle *)bundle;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
- (instancetype)initWithNibData: (NSData *)nibData
bundle: (NSBundle *)bundle;
#endif
// instantiating the nib.
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable;
@ -79,7 +85,10 @@ APPKIT_EXPORT NSString *NSNibOwner;
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable withZone: (NSZone *)zone;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
- (BOOL)instantiateWithOwner: (id)owner
topLevelObjects: (NSArray **)topLevelObjects;
#endif
@end
#endif /* _GNUstep_H_NSNib */

View file

@ -55,7 +55,7 @@ extern "C" {
- (NSArray *) tagNames;
- (NSPaperOrientation) orientation;
- (void) setOrientation: (NSPaperOrientation)or;
- (void) setOrientation: (NSPaperOrientation)orientation;
- (NSSize) paperSize;
- (void) setPaperSize: (NSSize)size;

View file

@ -57,7 +57,7 @@ extern "C" {
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */

View file

@ -528,6 +528,7 @@ PACKAGE_SCOPE
- (void) orderWindow: (NSWindowOrderingMode)place
relativeTo: (NSInteger)otherWin;
- (BOOL) isVisible;
- (void) setIsVisible: (BOOL)flag;
- (NSInteger) level;
- (void) setLevel: (NSInteger)newLevel;

View file

@ -280,52 +280,40 @@ add comments above this one
"No" = "No";
/* File: ../Source/NSSavePanel.m:1797 */
/* Flag: untranslated */
"Reading Directory " = "Reading Directory ";
"Reading Directory " = "Lettura Cartella ";
/* File: ../Source/NSSpellChecker.m:731 */
/* Flag: untranslated */
"Guess" = "Guess";
"Guess" = "Indovina";
/* File: ../Source/NSTextView.m:651 */
/* Flag: untranslated */
"Cut" = "Cut";
"Cut" = "Taglia";
/* File: ../Source/NSTextView.m:652 */
/* Flag: untranslated */
"Copy" = "Copy";
"Copy" = "Copia";
/* File: ../Source/NSTextView.m:653 */
/* Flag: untranslated */
"Paste" = "Paste";
"Paste" = "Incolla";
/* File: ../Source/NSTextView.m:5904 */
/* Flag: untranslated */
"No Suggestions" = "No Suggestions";
"No Suggestions" = "Nessun Suggerimento";
/* File: ../Source/NSToolbarItem.m:949 */
/* Flag: untranslated */
"Separator" = "Separator";
"Separator" = "Separatore";
/* File: ../Source/NSToolbarItem.m:991 */
/* Flag: untranslated */
"Space" = "Space";
"Space" = "Spazio";
/* File: ../Source/NSToolbarItem.m:1021 */
/* Flag: untranslated */
"Flexible Space" = "Flexible Space";
"Flexible Space" = "Spazio Flessibile";
/* File: ../Source/NSToolbarItem.m:1099 */
/* Flag: untranslated */
"Fonts" = "Fonts";
"Fonts" = "Caratteri";
/* File: ../Source/NSToolbarItem.m:1122 */
/* Flag: untranslated */
"Customize" = "Customize";
"Customize" = "Personalizza";
/* File: ../Source/NSToolbarItem.m:1145 */
/* Flag: untranslated */
"Print..." = "Print...";
"Print..." = "Stampa...";
/* File: ../Source/NSWindow.m:5322 */
/* Flag: untranslated */
@ -514,7 +502,7 @@ add comments above this one
"Quit Anyway" = "Esci comunque";
/* File: ../Source/NSDocumentController.m:972 */
/* File: ../Source/NSDocumentController.m:930 */
"Review Unsaved" = "Rivisita documenti non salvati";
"Review Unsaved" = "Rivedi documenti non salvati";
/* File: ../Source/NSDocumentController.m:979 */
/* File: ../Source/NSDocumentController.m:929 */
"You have unsaved documents" = "Ci sono documenti non salvati";
@ -582,10 +570,10 @@ add comments above this one
= "La directory '%@' non esiste, la vuoi creare?";
/* File: ../Source/NSSavePanel.m:1405 */
"The file '%@' in '%@' exists. Replace it?"
= "Il file '%@' in '%@' esiste. Vuoi sostituirlo?";
= "Il file '%@' in '%@' esiste già. Sostituirlo?";
/* File: ../Source/NSSavePanel.m:1394 */
"The path '%@' is not a directory."
= "Il percorso non '%@' non è una directory.";
= "Il percorso non '%@' non è una cartella.";
/* File: ../Source/NSSavePanel.m:309 */
"Unmount" = "Smonta";
/* File: ../Source/NSSavePanel.m:1371 */

View file

@ -459,7 +459,8 @@ static NSArray *XmlBoolDefaultYes = nil;
NSString *postfix = [self alternateName: name startIndex: 2];
NSString *typeName = [currentElement attributeForKey: @"key"];
if ((typeName != nil) && [postfix hasPrefix: typeName])
if ((typeName != nil) && [postfix hasPrefix: typeName] &&
([XmlTagToObjectClassMap objectForKey: postfix] == nil))
{
return [self alternateName: name startIndex: [typeName length] + 2];
}

View file

@ -95,6 +95,9 @@
return;
}
NSDebugLLog(@"XIB", @"First object %@", [rootObjects objectAtIndex: 0]);
NSDebugLLog(@"XIB", @"Second object %@", [rootObjects objectAtIndex: 1]);
NSDebugLLog(@"XIB", @"Third object %@", [rootObjects objectAtIndex: 2]);
// Use the owner as first root object
[(NSCustomObject*)[rootObjects objectAtIndex: 0] setRealObject: owner];
@ -142,7 +145,7 @@
- (BOOL) loadModelData: (NSData *)data
externalNameTable: (NSDictionary *)context
withZone: (NSZone *)zone;
withZone: (NSZone *)zone
{
BOOL loaded = NO;

View file

@ -27,7 +27,7 @@
@implementation NSAccessibilityCustomAction
- (instancetype)initWithName: (NSString *)name
handler: (GSCustomActionHandler)handler
handler: (GSAccessibilityCustomActionHandler)handler
{
return nil;
}
@ -48,12 +48,12 @@
{
}
- (GSCustomActionHandler) handler
- (GSAccessibilityCustomActionHandler) handler
{
return nil;
}
- (void) setHandler: (GSCustomActionHandler)handler
- (void) setHandler: (GSAccessibilityCustomActionHandler)handler
{
}

View file

@ -1,12 +1,12 @@
/** <title>NSNib</title>
<abstract>
This class serves as a container for a nib file. It's possible
to load a nib file from a URL or from a bundle. Using this
class the nib file can now be "preloaded" and instantiated
multiple times when/if needed. Also, since it's possible to
initialize this class using a NSURL it's possible to load
nib files from remote locations.
This class serves as a container for a nib file. It's possible
to load a nib file from a URL or from a bundle. Using this
class the nib file can now be "preloaded" and instantiated
multiple times when/if needed. Also, since it's possible to
initialize this class using a NSURL it's possible to load
nib files from remote locations.
<br/>
This class uses: NSNibOwner and NSNibTopLevelObjects to allow
the caller to specify the owner of the nib during instantiation
@ -18,7 +18,7 @@
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: 2004
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
@ -33,10 +33,10 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
*/
#import "config.h"
#import <Foundation/NSArray.h>
@ -80,12 +80,12 @@
* any type of resource capable of being pointed to by the NSURL object.
* A file in the local file system or a file on an ftp site.
*/
- (id)initWithContentsOfURL: (NSURL *)nibFileURL
- (id) initWithContentsOfURL: (NSURL *)nibFileURL
{
if ((self = [super init]) != nil)
{
ASSIGN(_url, nibFileURL);
// Currently we need this short cut for GModel files.
// Remove this when the hack there is cleaned up.
if ([nibFileURL isFileURL])
{
[self _readNibData: [nibFileURL path]];
@ -94,10 +94,10 @@
{
NS_DURING
{
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType:
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType:
[[nibFileURL path] pathExtension]]);
// load the nib data into memory...
_nibData = [NSData dataWithContentsOfURL: nibFileURL];
ASSIGN(_nibData, [NSData dataWithContentsOfURL: nibFileURL]);
}
NS_HANDLER
{
@ -111,10 +111,11 @@
/**
* Load the nib indicated by <code>nibNamed</code>. If the <code>bundle</code>
* argument is <code>nil</code>, then the main bundle is used to resolve
* argument is <code>nil</code>, then the main bundle is used to resolve
* the path, otherwise the bundle which is supplied will be used.
*/
- (id)initWithNibNamed: (NSString *)nibNamed bundle: (NSBundle *)bundle
- (instancetype) initWithNibNamed: (NSNibName)nibNamed
bundle: (NSBundle *)bundle
{
if ((self = [super init]) != nil)
{
@ -142,15 +143,28 @@
return self;
}
- (instancetype) initWithNibData: (NSData *)nibData
bundle: (NSBundle *)bundle
{
if ((self = [super init]) != nil)
{
ASSIGN(_bundle, bundle);
ASSIGN(_nibData, nibData);
// FIXME: Hardcode the most likely loader
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType: @"nib"]);
}
return self;
}
/**
* This is a GNUstep specific method. This method is used when the caller
* wants the objects instantiated in the nib to be stored in the given
* This is a GNUstep specific method. This method is used when the caller
* wants the objects instantiated in the nib to be stored in the given
* <code>zone</code>.
*/
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
withZone: (NSZone *)zone
- (BOOL) instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
withZone: (NSZone *)zone
{
return [_loader loadModelData: _nibData
return [_loader loadModelData: _nibData
externalNameTable: externalNameTable
withZone: zone];
}
@ -158,22 +172,23 @@
/**
* This method instantiates the nib file. The externalNameTable dictionary
* accepts the NSNibOwner and NSNibTopLevelObjects entries described earlier.
* It is recommended, for subclasses whose purpose is to change the behaviour
* It is recommended, for subclasses whose purpose is to change the behaviour
* of nib loading, to override this method.
*/
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
- (BOOL) instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
{
return [self instantiateNibWithExternalNameTable: externalNameTable
withZone: NSDefaultMallocZone()];
}
/**
* This method instantiates the nib file. It utilizes the
* instantiateNibWithExternalNameTable: method to, in a convenient way,
* This method instantiates the nib file. It utilizes the
* instantiateNibWithExternalNameTable: method to, in a convenient way,
* allow the user to specify both keys accepted by the
* nib loading process.
*/
- (BOOL)instantiateNibWithOwner: (id)owner topLevelObjects: (NSArray **)topLevelObjects
- (BOOL) instantiateNibWithOwner: (id)owner
topLevelObjects: (NSArray **)topLevelObjects
{
NSMutableDictionary *externalNameTable = [NSMutableDictionary dictionary];
@ -186,7 +201,13 @@
[externalNameTable setObject: *topLevelObjects forKey: NSNibTopLevelObjects];
}
return [self instantiateNibWithExternalNameTable: externalNameTable];
return [self instantiateNibWithExternalNameTable: externalNameTable];
}
- (BOOL) instantiateWithOwner: (id)owner
topLevelObjects: (NSArray **)topLevelObjects
{
return [self instantiateNibWithOwner: owner topLevelObjects: topLevelObjects];
}
- (id) initWithCoder: (NSCoder *)coder
@ -221,8 +242,8 @@
if ([coder allowsKeyedCoding])
{
// TODO_NIB: Need to verify this key...
[coder encodeObject: _nibData
forKey: @"NSData"];
[coder encodeObject: _nibData
forKey: @"NSData"];
}
else
{
@ -236,7 +257,6 @@
RELEASE(_nibData);
RELEASE(_loader);
TEST_RELEASE(_bundle);
TEST_RELEASE(_url);
[super dealloc];
}

View file

@ -76,9 +76,9 @@
return _orientation;
}
- (void) setOrientation: (NSPaperOrientation)or
- (void) setOrientation: (NSPaperOrientation)orientation
{
_orientation = or;
_orientation = orientation;
}
- (NSSize) paperSize;

View file

@ -563,6 +563,8 @@
if ([aDecoder containsValueForKey: @"NSTabViewItems"])
{
ASSIGN(_items, [aDecoder decodeObjectForKey: @"NSTabViewItems"]);
[_items makeObjectsPerformSelector: @selector(_setTabView:) withObject: self];
}
if ([aDecoder containsValueForKey: @"NSSelectedTabViewItem"])
{
@ -570,7 +572,7 @@
// and sets it to [self contentRect].
//
// This is desirable because the subview frame will be different
// depending on whether the arcive is from Cocoa or GNUstep,
// depending on whether the archive is from Cocoa or GNUstep,
// and which GNUstep theme was active at save time.
//
// However, it does mean that the tab view contents should be

View file

@ -1720,6 +1720,19 @@ titleWithRepresentedFilename(NSString *representedFilename)
return _windowLevel;
}
- (void) setIsVisible: (BOOL)flag
{
_f.visible = flag;
if (flag)
{
[self orderFrontRegardless];
}
else
{
[self orderOut: nil];
}
}
- (void) makeKeyAndOrderFront: (id)sender
{
[self deminiaturize: self];