mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:50:37 +00:00
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:
parent
4b8af18a65
commit
c5e1f2e6a2
8 changed files with 102 additions and 98 deletions
13
ChangeLog
13
ChangeLog
|
@ -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>
|
2010-03-30 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* Source/NSWindow.m (-sendEvent:): Remove a stray semicolon, which
|
* Source/NSWindow.m (-sendEvent:): Remove a stray semicolon, which
|
||||||
|
|
|
@ -55,8 +55,10 @@
|
||||||
@class NSArray;
|
@class NSArray;
|
||||||
@class NSMutableArray;
|
@class NSMutableArray;
|
||||||
|
|
||||||
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||||
APPKIT_EXPORT NSString *NSNibTopLevelObjects;
|
APPKIT_EXPORT NSString *NSNibTopLevelObjects;
|
||||||
APPKIT_EXPORT NSString *NSNibOwner;
|
APPKIT_EXPORT NSString *NSNibOwner;
|
||||||
|
#endif
|
||||||
|
|
||||||
@interface NSNib : NSObject <NSCoding>
|
@interface NSNib : NSObject <NSCoding>
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,11 +26,17 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Foundation/Foundation.h>
|
#import <Foundation/NSBundle.h>
|
||||||
#include <AppKit/AppKit.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"
|
#import "GNUstepGUI/GSModelLoaderFactory.h"
|
||||||
#include "GNUstepGUI/IMLoading.h"
|
#import "GNUstepGUI/IMLoading.h"
|
||||||
|
|
||||||
static
|
static
|
||||||
Class gmodel_class(void)
|
Class gmodel_class(void)
|
||||||
|
@ -87,7 +93,7 @@ Class gmodel_class(void)
|
||||||
externalNameTable: (NSDictionary *)context
|
externalNameTable: (NSDictionary *)context
|
||||||
withZone: (NSZone *)zone;
|
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
|
* 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"])
|
if ([ext isEqualToString: @"gmodel"])
|
||||||
{
|
{
|
||||||
return [gmodel_class() loadIMFile: fileName
|
return [gmodel_class() loadIMFile: fileName
|
||||||
owner: [context objectForKey: @"NSOwner"]];
|
owner: [context objectForKey: NSNibOwner]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
|
|
|
@ -25,15 +25,16 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#import "config.h"
|
||||||
#include "Foundation/NSDictionary.h"
|
#import <Foundation/NSDictionary.h>
|
||||||
#include "AppKit/NSDataLinkPanel.h"
|
#import "AppKit/NSApplication.h"
|
||||||
#include "AppKit/NSDataLinkManager.h"
|
#import "AppKit/NSDataLinkPanel.h"
|
||||||
#include "AppKit/NSDataLink.h"
|
#import "AppKit/NSDataLinkManager.h"
|
||||||
#include "AppKit/NSGraphics.h"
|
#import "AppKit/NSDataLink.h"
|
||||||
#include "AppKit/NSView.h"
|
#import "AppKit/NSGraphics.h"
|
||||||
#include "AppKit/NSNibLoading.h"
|
#import "AppKit/NSView.h"
|
||||||
#include "GSGuiPrivate.h"
|
#import "AppKit/NSNibLoading.h"
|
||||||
|
#import "GSGuiPrivate.h"
|
||||||
|
|
||||||
static NSDataLinkPanel *_sharedDataLinkPanel;
|
static NSDataLinkPanel *_sharedDataLinkPanel;
|
||||||
|
|
||||||
|
@ -47,19 +48,9 @@ static NSDataLinkPanel *_sharedDataLinkPanel;
|
||||||
@implementation GSDataLinkPanelController
|
@implementation GSDataLinkPanelController
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
NSString *panelPath;
|
|
||||||
NSDictionary *table;
|
|
||||||
|
|
||||||
if ((self = [super init]) != nil)
|
if ((self = [super init]) != nil)
|
||||||
{
|
{
|
||||||
panelPath = [GSGuiBundle() pathForResource: @"GSDataLinkPanel"
|
if ([NSBundle loadNibNamed: @"GSDataLinkPanel" owner: self] == NO)
|
||||||
ofType: @"gorm"
|
|
||||||
inDirectory: nil];
|
|
||||||
NSLog(@"Panel path=%@",panelPath);
|
|
||||||
table = [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"];
|
|
||||||
if ([NSBundle loadNibFile: panelPath
|
|
||||||
externalNameTable: table
|
|
||||||
withZone: [self zone]] == NO)
|
|
||||||
{
|
{
|
||||||
NSRunAlertPanel(@"Error", @"Could not load data link panel resource",
|
NSRunAlertPanel(@"Error", @"Could not load data link panel resource",
|
||||||
@"OK", NULL, NULL);
|
@"OK", NULL, NULL);
|
||||||
|
|
|
@ -29,32 +29,32 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Foundation/NSNumberFormatter.h>
|
#import <Foundation/NSNumberFormatter.h>
|
||||||
#include <Foundation/NSDecimalNumber.h>
|
#import <Foundation/NSDecimalNumber.h>
|
||||||
#include <Foundation/NSUserDefaults.h>
|
#import <Foundation/NSUserDefaults.h>
|
||||||
#include "AppKit/NSApplication.h"
|
#import "AppKit/NSApplication.h"
|
||||||
#include "AppKit/NSFont.h"
|
#import "AppKit/NSFont.h"
|
||||||
#include "AppKit/NSTextField.h"
|
#import "AppKit/NSTextField.h"
|
||||||
#include "AppKit/NSImage.h"
|
#import "AppKit/NSImage.h"
|
||||||
#include "AppKit/NSImageView.h"
|
#import "AppKit/NSImageView.h"
|
||||||
#include "AppKit/NSBezierPath.h"
|
#import "AppKit/NSBezierPath.h"
|
||||||
#include "AppKit/NSBox.h"
|
#import "AppKit/NSBox.h"
|
||||||
#include "AppKit/NSButton.h"
|
#import "AppKit/NSButton.h"
|
||||||
#include "AppKit/NSColor.h"
|
#import "AppKit/NSColor.h"
|
||||||
#include "AppKit/NSComboBox.h"
|
#import "AppKit/NSComboBox.h"
|
||||||
#include "AppKit/NSPopUpButton.h"
|
#import "AppKit/NSPopUpButton.h"
|
||||||
#include "AppKit/NSMatrix.h"
|
#import "AppKit/NSMatrix.h"
|
||||||
#include "AppKit/NSNibLoading.h"
|
#import "AppKit/NSNibLoading.h"
|
||||||
#include "AppKit/NSForm.h"
|
#import "AppKit/NSForm.h"
|
||||||
#include "AppKit/NSFormCell.h"
|
#import "AppKit/NSFormCell.h"
|
||||||
#include "AppKit/NSPrintInfo.h"
|
#import "AppKit/NSPrintInfo.h"
|
||||||
#include "AppKit/NSPageLayout.h"
|
#import "AppKit/NSPageLayout.h"
|
||||||
#include "AppKit/NSTableView.h"
|
#import "AppKit/NSTableView.h"
|
||||||
#include "AppKit/NSTabView.h"
|
#import "AppKit/NSTabView.h"
|
||||||
#include "AppKit/NSTabViewItem.h"
|
#import "AppKit/NSTabViewItem.h"
|
||||||
#include "AppKit/NSPrinter.h"
|
#import "AppKit/NSPrinter.h"
|
||||||
#include "GSGuiPrivate.h"
|
#import "GSGuiPrivate.h"
|
||||||
#include "GNUstepGUI/GSPrinting.h"
|
#import "GNUstepGUI/GSPrinting.h"
|
||||||
|
|
||||||
static NSPageLayout *shared_instance;
|
static NSPageLayout *shared_instance;
|
||||||
|
|
||||||
|
@ -404,25 +404,14 @@ enum {
|
||||||
@implementation GSPageLayoutController
|
@implementation GSPageLayoutController
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
NSString *panelPath;
|
|
||||||
NSDictionary *table;
|
|
||||||
NSImage *image;
|
NSImage *image;
|
||||||
NSNumberFormatter *sizeFormatter;
|
NSNumberFormatter *sizeFormatter;
|
||||||
NSNumberFormatter *scaleFormatter;
|
NSNumberFormatter *scaleFormatter;
|
||||||
|
|
||||||
self = [super init];
|
if ((self = [super init]) == nil)
|
||||||
|
return nil;
|
||||||
|
|
||||||
panelPath = [GSGuiBundle() pathForResource: @"GSPageLayout"
|
if ([NSBundle loadNibNamed: @"GSPageLayout" owner: self] == NO)
|
||||||
ofType: @"gorm"
|
|
||||||
inDirectory: nil];
|
|
||||||
|
|
||||||
NSLog(@"Panel path=%@",panelPath);
|
|
||||||
table = [NSDictionary dictionaryWithObject: self
|
|
||||||
forKey: @"NSOwner"];
|
|
||||||
|
|
||||||
if ([NSBundle loadNibFile: panelPath
|
|
||||||
externalNameTable: table
|
|
||||||
withZone: [self zone]] == NO)
|
|
||||||
{
|
{
|
||||||
NSRunAlertPanel(@"Error", @"Could not load page layout panel resource",
|
NSRunAlertPanel(@"Error", @"Could not load page layout panel resource",
|
||||||
@"OK", NULL, NULL);
|
@"OK", NULL, NULL);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
#import "AppKit/NSApplication.h"
|
#import "AppKit/NSApplication.h"
|
||||||
#import "AppKit/NSForm.h"
|
#import "AppKit/NSForm.h"
|
||||||
|
#import "AppKit/NSNib.h"
|
||||||
#import "AppKit/NSNibLoading.h"
|
#import "AppKit/NSNibLoading.h"
|
||||||
#import "AppKit/NSPrinter.h"
|
#import "AppKit/NSPrinter.h"
|
||||||
#import "AppKit/NSPrintPanel.h"
|
#import "AppKit/NSPrintPanel.h"
|
||||||
|
@ -138,15 +139,16 @@ static NSPrintPanel *shared_instance;
|
||||||
if (self == nil)
|
if (self == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
panel = [GSGuiBundle() pathForResource: GSPANELNAME ofType: @"gorm"
|
// self will come from a bundle, to get the panel from the GUI library
|
||||||
inDirectory: nil];
|
// we have to select that bundle explicitly
|
||||||
|
panel = [GSGuiBundle() pathForNibResource: GSPANELNAME];
|
||||||
if (panel == nil)
|
if (panel == nil)
|
||||||
{
|
{
|
||||||
NSRunAlertPanel(@"Error", @"Could not find print panel resource",
|
NSRunAlertPanel(@"Error", @"Could not find print panel resource",
|
||||||
@"OK", NULL, NULL);
|
@"OK", NULL, NULL);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
table = [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"];
|
table = [NSDictionary dictionaryWithObject: self forKey: NSNibOwner];
|
||||||
if ([NSBundle loadNibFile: panel
|
if ([NSBundle loadNibFile: panel
|
||||||
externalNameTable: table
|
externalNameTable: table
|
||||||
withZone: [self zone]] == NO)
|
withZone: [self zone]] == NO)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#import "config.h"
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSBundle.h>
|
#import <Foundation/NSBundle.h>
|
||||||
#import <Foundation/NSConnection.h>
|
#import <Foundation/NSConnection.h>
|
||||||
|
@ -44,21 +44,22 @@
|
||||||
#import <Foundation/NSSpellServer.h>
|
#import <Foundation/NSSpellServer.h>
|
||||||
#import <Foundation/NSUserDefaults.h>
|
#import <Foundation/NSUserDefaults.h>
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
#import "AppKit/NSNibLoading.h"
|
#import "AppKit/NSBrowser.h"
|
||||||
|
#import "AppKit/NSBrowserCell.h"
|
||||||
#import "AppKit/NSEvent.h"
|
#import "AppKit/NSEvent.h"
|
||||||
|
#import "AppKit/NSGraphics.h"
|
||||||
#import "AppKit/NSImage.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/NSSpellChecker.h"
|
||||||
#import "AppKit/NSApplication.h"
|
#import "AppKit/NSApplication.h"
|
||||||
#import "AppKit/NSTextField.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/NSWindow.h"
|
||||||
#import "AppKit/NSPanel.h"
|
#import "GSGuiPrivate.h"
|
||||||
#include "GSGuiPrivate.h"
|
#import "GNUstepGUI/GSServicesManager.h"
|
||||||
#include "GNUstepGUI/GSServicesManager.h"
|
|
||||||
|
|
||||||
// prototype for function to create name for server
|
// prototype for function to create name for server
|
||||||
NSString *GSSpellServerName(NSString *checkerDictionary, NSString *language);
|
NSString *GSSpellServerName(NSString *checkerDictionary, NSString *language);
|
||||||
|
@ -264,10 +265,12 @@ static int __documentTag = 0;
|
||||||
- init
|
- init
|
||||||
{
|
{
|
||||||
NSArray *userLanguages = [NSUserDefaults userLanguages];
|
NSArray *userLanguages = [NSUserDefaults userLanguages];
|
||||||
NSString *panel = nil;
|
|
||||||
|
self = [super init];
|
||||||
|
if (self == nil)
|
||||||
|
return nil;
|
||||||
|
|
||||||
// Set the language to the default for the user.
|
// Set the language to the default for the user.
|
||||||
self = [super init];
|
|
||||||
_language = [userLanguages objectAtIndex: 0];
|
_language = [userLanguages objectAtIndex: 0];
|
||||||
_wrapFlag = NO;
|
_wrapFlag = NO;
|
||||||
_position = 0;
|
_position = 0;
|
||||||
|
@ -276,11 +279,9 @@ static int __documentTag = 0;
|
||||||
_currentTag = 0;
|
_currentTag = 0;
|
||||||
_ignoredWords = [NSMutableDictionary new];
|
_ignoredWords = [NSMutableDictionary new];
|
||||||
|
|
||||||
// Load the gmodel file
|
// Load the NIB file from the GUI bundle
|
||||||
panel = [GSGuiBundle() pathForResource: @"GSSpellPanel" ofType: @"gorm"
|
if (![GSGuiBundle() loadNibFile: @"GSSpellPanel"
|
||||||
inDirectory: nil];
|
externalNameTable: [NSDictionary dictionaryWithObject: self forKey: NSNibOwner]
|
||||||
if (![NSBundle loadNibFile: panel
|
|
||||||
externalNameTable: [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"]
|
|
||||||
withZone: [self zone]])
|
withZone: [self zone]])
|
||||||
{
|
{
|
||||||
NSLog(@"Model file load failed for GSSpellPanel");
|
NSLog(@"Model file load failed for GSSpellPanel");
|
||||||
|
|
|
@ -26,17 +26,18 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Foundation/NSBundle.h>
|
#import <Foundation/NSBundle.h>
|
||||||
#include <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#include <Foundation/NSEnumerator.h>
|
#import <Foundation/NSEnumerator.h>
|
||||||
#include <Foundation/NSException.h>
|
#import <Foundation/NSException.h>
|
||||||
#include <Foundation/NSNotification.h>
|
#import <Foundation/NSNotification.h>
|
||||||
#include <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
#include "AppKit/NSNibLoading.h"
|
#import "AppKit/NSNib.h"
|
||||||
#include "AppKit/NSPanel.h"
|
#import "AppKit/NSNibLoading.h"
|
||||||
#include "AppKit/NSWindowController.h"
|
#import "AppKit/NSPanel.h"
|
||||||
#include "NSDocumentFrameworkPrivate.h"
|
#import "AppKit/NSWindowController.h"
|
||||||
|
#import "NSDocumentFrameworkPrivate.h"
|
||||||
|
|
||||||
@implementation NSWindowController
|
@implementation NSWindowController
|
||||||
|
|
||||||
|
@ -468,8 +469,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
table = [NSDictionary dictionaryWithObject: _owner forKey: @"NSOwner"];
|
table = [NSDictionary dictionaryWithObject: _owner forKey: NSNibOwner];
|
||||||
|
|
||||||
if ([NSBundle loadNibFile: [self windowNibPath]
|
if ([NSBundle loadNibFile: [self windowNibPath]
|
||||||
externalNameTable: table
|
externalNameTable: table
|
||||||
withZone: [_owner zone]])
|
withZone: [_owner zone]])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue