mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 12:00:45 +00:00
Convert libgmodel to a bundle
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10615 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6fc3726a02
commit
1ff9a64bc3
7 changed files with 65 additions and 32 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2001-07-31 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Convert libgmodel to a bundle to remove the semi-recursive
|
||||
gui<->gmodel dependancy
|
||||
* gui.make.in (GUI_LIBS): Remove -lgmodel
|
||||
* Model/GNUmakefile: Compile libgmodel as a bundle.
|
||||
* Source/NSBundleAdditions.m (gmodel_class): New function.
|
||||
([NSBundle +loadNibFile:externalNameTable:withZone:]): Use it.
|
||||
* Source/NSSpellChecker.m (-init): Use NSBundle method to find
|
||||
model file.
|
||||
|
||||
2001-07-30 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Fixes to compile shared (DLL) on Windows.
|
||||
|
|
|
@ -30,7 +30,11 @@ GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../gui.make
|
|||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
include ../Version
|
||||
ifeq ($(FOUNDATION_LIB), nx)
|
||||
LIBRARY_NAME = libgmodel
|
||||
else
|
||||
BUNDLE_NAME = libgmodel
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_NIB2GMODEL), yes)
|
||||
TOOL_NAME = nib2gmodel
|
||||
|
@ -46,7 +50,7 @@ libgmodel_HEADER_FILES = IMConnectors.h IMCustomObject.h IMLoading.h \
|
|||
GMAppKit.h GMArchiver.h
|
||||
|
||||
test_OBJC_FILES = test.m Controller.m
|
||||
test_MAIN_MODEL_FILE = test.gmodel
|
||||
#test_MAIN_MODEL_FILE = test.gmodel
|
||||
test_RESOURCE_FILES = test.gmodel
|
||||
|
||||
nib2gmodel_OBJC_FILES = IBClasses.m Translator.m nib2gmodel.m
|
||||
|
@ -65,7 +69,6 @@ ifneq ($(GUI_LIB), nx)
|
|||
ADDITIONAL_LIB_DIRS += -L../Source/$(GNUSTEP_OBJ_DIR)
|
||||
endif
|
||||
|
||||
ADDITIONAL_TOOL_LIBS += -lgmodel
|
||||
ADDITIONAL_OBJC_FLAGS += $(BACKEND_DEFINE)
|
||||
|
||||
# Additional include directories the compiler should search
|
||||
|
@ -87,6 +90,7 @@ nib2gmodel_LIBRARIES_DEPEND_UPON = $(BACKEND_LIBS) $(GUI_LIBS) \
|
|||
|
||||
-include GNUmakefile.local
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||
include $(GNUSTEP_MAKEFILES)/library.make
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
include $(GNUSTEP_MAKEFILES)/application.make
|
||||
|
|
36
Model/test.m
36
Model/test.m
|
@ -1,42 +1,28 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "AppKit/IMLoading.h"
|
||||
|
||||
@interface MyView : NSView
|
||||
@end
|
||||
|
||||
@implementation MyView
|
||||
- (void)drawRect:(NSRect)rect
|
||||
{
|
||||
[[NSColor greenColor] set];
|
||||
NSRectFill (rect);
|
||||
}
|
||||
@end
|
||||
|
||||
int main (int argc, char** argv, char** env)
|
||||
{
|
||||
id pool = [NSAutoreleasePool new];
|
||||
NSArray* arguments;
|
||||
NSProcessInfo* processInfo;
|
||||
id pool = [NSAutoreleasePool new];
|
||||
NSArray* arguments;
|
||||
NSProcessInfo* processInfo;
|
||||
NSString *model;
|
||||
|
||||
#ifdef LIB_FOUNDATION_LIBRARY
|
||||
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
|
||||
#endif
|
||||
#ifndef NX_CURRENT_COMPILER_RELEASE
|
||||
initialize_gnustep_backend();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
processInfo = [NSProcessInfo processInfo];
|
||||
arguments = [processInfo arguments];
|
||||
if ([arguments count] != 2) {
|
||||
printf ("usage: %s gmodel-file\n", [[processInfo processName] cString]);
|
||||
exit (1);
|
||||
}
|
||||
if ([arguments count] < 2)
|
||||
model = @"test.gmodel";
|
||||
else
|
||||
model = [arguments objectAtIndex: 1];
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (![GMModel loadIMFile:[arguments objectAtIndex:1]
|
||||
#if 1
|
||||
if (![NSBundle loadNibNamed: model
|
||||
owner:[NSApplication sharedApplication]]) {
|
||||
printf ("Cannot load Interface Modeller file!\n");
|
||||
exit (1);
|
||||
|
|
|
@ -197,6 +197,38 @@
|
|||
return path;
|
||||
}
|
||||
|
||||
static
|
||||
Class gmodel_class(void)
|
||||
{
|
||||
static Class gmclass = Nil;
|
||||
|
||||
if (gmclass == Nil)
|
||||
{
|
||||
NSBundle *theBundle;
|
||||
NSEnumerator *benum;
|
||||
NSString *path;
|
||||
|
||||
/* Find the bundle */
|
||||
benum = [NSStandardLibraryPaths() objectEnumerator];
|
||||
while ((path = [benum nextObject]))
|
||||
{
|
||||
path = [path stringByAppendingPathComponent: @"Bundles"];
|
||||
path = [path stringByAppendingPathComponent: @"libgmodel.bundle"];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
|
||||
break;
|
||||
path = nil;
|
||||
}
|
||||
NSCAssert(path != nil, @"Unable to load gmodel bundle");
|
||||
NSDebugLog(@"Loading gmodel from %@", path);
|
||||
|
||||
theBundle = [NSBundle bundleWithPath: path];
|
||||
NSCAssert(theBundle != nil, @"Can't init gmodel bundle");
|
||||
gmclass = [theBundle classNamed: @"GMModel"];
|
||||
NSCAssert(gmclass, @"Can't load gmodel bundle");
|
||||
}
|
||||
return gmclass;
|
||||
}
|
||||
|
||||
+ (BOOL) loadNibFile: (NSString *)fileName
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone
|
||||
|
@ -210,7 +242,7 @@
|
|||
// read it in and skip the dearchiving below.
|
||||
if([ext isEqualToString: @"gmodel"])
|
||||
{
|
||||
return [GMModel loadIMFile: fileName
|
||||
return [gmodel_class() loadIMFile: fileName
|
||||
owner: [context objectForKey: @"NSOwner"]];
|
||||
}
|
||||
|
||||
|
|
|
@ -448,7 +448,6 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
// complicated initializations, you get a simple panel from super.
|
||||
-(id) init
|
||||
{
|
||||
// if (![GMModel loadIMFile: @"SavePanel" owner: self]);
|
||||
[self _initWithoutGModel];
|
||||
|
||||
_directory = nil;
|
||||
|
|
|
@ -274,8 +274,9 @@ static int __documentTag = 0;
|
|||
RETAIN(_ignoredWords);
|
||||
|
||||
// Load the gmodel file
|
||||
if(![GMModel loadIMFile: @"SpellPanel"
|
||||
owner: self])
|
||||
if(![NSBundle loadNibFile: @"SpellPanel.gmodel"
|
||||
externalNameTable: [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"]
|
||||
withZone: [self zone]])
|
||||
{
|
||||
NSLog(@"NIB file load failed for SpellPanel");
|
||||
return nil;
|
||||
|
|
|
@ -31,7 +31,7 @@ ifeq ($(GUI_LIB),gnu)
|
|||
GNUSTEP_GUI_SUBMINOR_VERSION = @GNUSTEP_GUI_SUBMINOR_VERSION@
|
||||
|
||||
GUI_LDFLAGS =
|
||||
GUI_LIBS = -lgnustep-gui -lgmodel -lgnustep-gui
|
||||
GUI_LIBS = -lgnustep-gui
|
||||
GUI_DEFINE = -DGNU_GUI_LIBRARY=1
|
||||
GNUSTEP_DEFINE = -DGNUSTEP
|
||||
|
||||
|
|
Loading…
Reference in a new issue