Use NSNibOwner instead of @"NSOwner". Remove the hard coded "gorm"

extension. Try to use higher level NIB loading methods where possible.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30077 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-03-30 07:54:04 +00:00
parent 4b8af18a65
commit c5e1f2e6a2
8 changed files with 102 additions and 98 deletions

View file

@ -1,3 +1,16 @@
2010-03-30 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSNib.h: Make NSNibOwner and NSNibTopLevelObjects
available only for version > 10.3.
* Source/NSWindowController.m,
* Source/NSPageLayout.m,
* Source/GSGModelLoader.m,
* Source/NSDataLinkPanel.m,
* Source/NSPrintPanel.m,
* Source/NSSpellChecker.m: Use NSNibOwner instead of
@"NSOwner". Remove the hard coded "gorm" extension. Try to use
higher level NIB loading methods where possible.
2010-03-30 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSWindow.m (-sendEvent:): Remove a stray semicolon, which

View file

@ -55,8 +55,10 @@
@class NSArray;
@class NSMutableArray;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
APPKIT_EXPORT NSString *NSNibTopLevelObjects;
APPKIT_EXPORT NSString *NSNibOwner;
#endif
@interface NSNib : NSObject <NSCoding>
{

View file

@ -26,11 +26,17 @@
Boston, MA 02110-1301, USA.
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSException.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSString.h>
#import "AppKit/NSNib.h"
#include "GNUstepGUI/GSModelLoaderFactory.h"
#include "GNUstepGUI/IMLoading.h"
#import "GNUstepGUI/GSModelLoaderFactory.h"
#import "GNUstepGUI/IMLoading.h"
static
Class gmodel_class(void)
@ -87,7 +93,7 @@ Class gmodel_class(void)
externalNameTable: (NSDictionary *)context
withZone: (NSZone *)zone;
{
NSString *ext = [fileName pathExtension];
NSString *ext = [fileName pathExtension];
/*
* If the file to be read is a gmodel, use the GMModel method to
@ -96,7 +102,7 @@ Class gmodel_class(void)
if ([ext isEqualToString: @"gmodel"])
{
return [gmodel_class() loadIMFile: fileName
owner: [context objectForKey: @"NSOwner"]];
owner: [context objectForKey: NSNibOwner]];
}
return NO;

View file

@ -25,15 +25,16 @@
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "Foundation/NSDictionary.h"
#include "AppKit/NSDataLinkPanel.h"
#include "AppKit/NSDataLinkManager.h"
#include "AppKit/NSDataLink.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSView.h"
#include "AppKit/NSNibLoading.h"
#include "GSGuiPrivate.h"
#import "config.h"
#import <Foundation/NSDictionary.h>
#import "AppKit/NSApplication.h"
#import "AppKit/NSDataLinkPanel.h"
#import "AppKit/NSDataLinkManager.h"
#import "AppKit/NSDataLink.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSView.h"
#import "AppKit/NSNibLoading.h"
#import "GSGuiPrivate.h"
static NSDataLinkPanel *_sharedDataLinkPanel;
@ -47,19 +48,9 @@ static NSDataLinkPanel *_sharedDataLinkPanel;
@implementation GSDataLinkPanelController
- (id) init
{
NSString *panelPath;
NSDictionary *table;
if ((self = [super init]) != nil)
{
panelPath = [GSGuiBundle() pathForResource: @"GSDataLinkPanel"
ofType: @"gorm"
inDirectory: nil];
NSLog(@"Panel path=%@",panelPath);
table = [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"];
if ([NSBundle loadNibFile: panelPath
externalNameTable: table
withZone: [self zone]] == NO)
if ([NSBundle loadNibNamed: @"GSDataLinkPanel" owner: self] == NO)
{
NSRunAlertPanel(@"Error", @"Could not load data link panel resource",
@"OK", NULL, NULL);

View file

@ -29,32 +29,32 @@
Boston, MA 02110-1301, USA.
*/
#include <Foundation/NSNumberFormatter.h>
#include <Foundation/NSDecimalNumber.h>
#include <Foundation/NSUserDefaults.h>
#include "AppKit/NSApplication.h"
#include "AppKit/NSFont.h"
#include "AppKit/NSTextField.h"
#include "AppKit/NSImage.h"
#include "AppKit/NSImageView.h"
#include "AppKit/NSBezierPath.h"
#include "AppKit/NSBox.h"
#include "AppKit/NSButton.h"
#include "AppKit/NSColor.h"
#include "AppKit/NSComboBox.h"
#include "AppKit/NSPopUpButton.h"
#include "AppKit/NSMatrix.h"
#include "AppKit/NSNibLoading.h"
#include "AppKit/NSForm.h"
#include "AppKit/NSFormCell.h"
#include "AppKit/NSPrintInfo.h"
#include "AppKit/NSPageLayout.h"
#include "AppKit/NSTableView.h"
#include "AppKit/NSTabView.h"
#include "AppKit/NSTabViewItem.h"
#include "AppKit/NSPrinter.h"
#include "GSGuiPrivate.h"
#include "GNUstepGUI/GSPrinting.h"
#import <Foundation/NSNumberFormatter.h>
#import <Foundation/NSDecimalNumber.h>
#import <Foundation/NSUserDefaults.h>
#import "AppKit/NSApplication.h"
#import "AppKit/NSFont.h"
#import "AppKit/NSTextField.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSImageView.h"
#import "AppKit/NSBezierPath.h"
#import "AppKit/NSBox.h"
#import "AppKit/NSButton.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSComboBox.h"
#import "AppKit/NSPopUpButton.h"
#import "AppKit/NSMatrix.h"
#import "AppKit/NSNibLoading.h"
#import "AppKit/NSForm.h"
#import "AppKit/NSFormCell.h"
#import "AppKit/NSPrintInfo.h"
#import "AppKit/NSPageLayout.h"
#import "AppKit/NSTableView.h"
#import "AppKit/NSTabView.h"
#import "AppKit/NSTabViewItem.h"
#import "AppKit/NSPrinter.h"
#import "GSGuiPrivate.h"
#import "GNUstepGUI/GSPrinting.h"
static NSPageLayout *shared_instance;
@ -404,25 +404,14 @@ enum {
@implementation GSPageLayoutController
- (id) init
{
NSString *panelPath;
NSDictionary *table;
NSImage *image;
NSNumberFormatter *sizeFormatter;
NSNumberFormatter *scaleFormatter;
self = [super init];
if ((self = [super init]) == nil)
return nil;
panelPath = [GSGuiBundle() pathForResource: @"GSPageLayout"
ofType: @"gorm"
inDirectory: nil];
NSLog(@"Panel path=%@",panelPath);
table = [NSDictionary dictionaryWithObject: self
forKey: @"NSOwner"];
if ([NSBundle loadNibFile: panelPath
externalNameTable: table
withZone: [self zone]] == NO)
if ([NSBundle loadNibNamed: @"GSPageLayout" owner: self] == NO)
{
NSRunAlertPanel(@"Error", @"Could not load page layout panel resource",
@"OK", NULL, NULL);

View file

@ -37,6 +37,7 @@
#import <Foundation/NSValue.h>
#import "AppKit/NSApplication.h"
#import "AppKit/NSForm.h"
#import "AppKit/NSNib.h"
#import "AppKit/NSNibLoading.h"
#import "AppKit/NSPrinter.h"
#import "AppKit/NSPrintPanel.h"
@ -138,15 +139,16 @@ static NSPrintPanel *shared_instance;
if (self == nil)
return nil;
panel = [GSGuiBundle() pathForResource: GSPANELNAME ofType: @"gorm"
inDirectory: nil];
// self will come from a bundle, to get the panel from the GUI library
// we have to select that bundle explicitly
panel = [GSGuiBundle() pathForNibResource: GSPANELNAME];
if (panel == nil)
{
NSRunAlertPanel(@"Error", @"Could not find print panel resource",
@"OK", NULL, NULL);
return nil;
}
table = [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"];
table = [NSDictionary dictionaryWithObject: self forKey: NSNibOwner];
if ([NSBundle loadNibFile: panel
externalNameTable: table
withZone: [self zone]] == NO)

View file

@ -30,7 +30,7 @@
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#import "config.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSConnection.h>
@ -44,21 +44,22 @@
#import <Foundation/NSSpellServer.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import "AppKit/NSNibLoading.h"
#import "AppKit/NSBrowser.h"
#import "AppKit/NSBrowserCell.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSMatrix.h"
#import "AppKit/NSNib.h"
#import "AppKit/NSNibLoading.h"
#import "AppKit/NSPanel.h"
#import "AppKit/NSPopUpButton.h"
#import "AppKit/NSSpellChecker.h"
#import "AppKit/NSApplication.h"
#import "AppKit/NSTextField.h"
#import "AppKit/NSMatrix.h"
#import "AppKit/NSBrowser.h"
#import "AppKit/NSBrowserCell.h"
#import "AppKit/NSPopUpButton.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSWindow.h"
#import "AppKit/NSPanel.h"
#include "GSGuiPrivate.h"
#include "GNUstepGUI/GSServicesManager.h"
#import "GSGuiPrivate.h"
#import "GNUstepGUI/GSServicesManager.h"
// prototype for function to create name for server
NSString *GSSpellServerName(NSString *checkerDictionary, NSString *language);
@ -264,10 +265,12 @@ static int __documentTag = 0;
- init
{
NSArray *userLanguages = [NSUserDefaults userLanguages];
NSString *panel = nil;
self = [super init];
if (self == nil)
return nil;
// Set the language to the default for the user.
self = [super init];
_language = [userLanguages objectAtIndex: 0];
_wrapFlag = NO;
_position = 0;
@ -276,11 +279,9 @@ static int __documentTag = 0;
_currentTag = 0;
_ignoredWords = [NSMutableDictionary new];
// Load the gmodel file
panel = [GSGuiBundle() pathForResource: @"GSSpellPanel" ofType: @"gorm"
inDirectory: nil];
if (![NSBundle loadNibFile: panel
externalNameTable: [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"]
// Load the NIB file from the GUI bundle
if (![GSGuiBundle() loadNibFile: @"GSSpellPanel"
externalNameTable: [NSDictionary dictionaryWithObject: self forKey: NSNibOwner]
withZone: [self zone]])
{
NSLog(@"Model file load failed for GSSpellPanel");

View file

@ -26,17 +26,18 @@
Boston, MA 02110-1301, USA.
*/
#include <Foundation/NSBundle.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSException.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSString.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSException.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSString.h>
#include "AppKit/NSNibLoading.h"
#include "AppKit/NSPanel.h"
#include "AppKit/NSWindowController.h"
#include "NSDocumentFrameworkPrivate.h"
#import "AppKit/NSNib.h"
#import "AppKit/NSNibLoading.h"
#import "AppKit/NSPanel.h"
#import "AppKit/NSWindowController.h"
#import "NSDocumentFrameworkPrivate.h"
@implementation NSWindowController
@ -468,8 +469,7 @@
return;
}
table = [NSDictionary dictionaryWithObject: _owner forKey: @"NSOwner"];
table = [NSDictionary dictionaryWithObject: _owner forKey: NSNibOwner];
if ([NSBundle loadNibFile: [self windowNibPath]
externalNameTable: table
withZone: [_owner zone]])