Commented out the archiving of NSPopUpButton since it crashes the translator; probably it interferes with NeXT's NIB handling.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2700 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ovidiu 1998-01-16 00:57:21 +00:00
parent 836a3746d2
commit b877a664ea
8 changed files with 129 additions and 99 deletions

View file

@ -5,4 +5,5 @@
id textField; id textField;
} }
- (void)buttonPressed:(id)sender; - (void)buttonPressed:(id)sender;
- (id)window;
@end @end

View file

@ -10,4 +10,9 @@
[textField setStringValue:text]; [textField setStringValue:text];
} }
- (id)window
{
return [textField window];
}
@end @end

View file

@ -148,10 +148,12 @@ void __dummy_GMAppKit_functionForLinking() {}
[archiver encodeInt:[self state] withName:@"state"]; [archiver encodeInt:[self state] withName:@"state"];
[archiver encodeFloat:delay withName:@"delay"]; [archiver encodeFloat:delay withName:@"delay"];
[archiver encodeFloat:interval withName:@"interval"]; [archiver encodeFloat:interval withName:@"interval"];
#if 1
[archiver encodeString:[self title] withName:@"title"]; [archiver encodeString:[self title] withName:@"title"];
[archiver encodeString:[self alternateTitle] withName:@"alternateTitle"]; [archiver encodeString:[self alternateTitle] withName:@"alternateTitle"];
[archiver encodeObject:[self image] withName:@"image"]; [archiver encodeObject:[self image] withName:@"image"];
[archiver encodeObject:[self alternateImage] withName:@"alternateImage"]; [archiver encodeObject:[self alternateImage] withName:@"alternateImage"];
#endif
[archiver encodeInt:[self imagePosition] withName:@"imagePosition"]; [archiver encodeInt:[self imagePosition] withName:@"imagePosition"];
[archiver encodeBOOL:[self isBordered] withName:@"isBordered"]; [archiver encodeBOOL:[self isBordered] withName:@"isBordered"];
[archiver encodeBOOL:[self isTransparent] withName:@"isTransparent"]; [archiver encodeBOOL:[self isTransparent] withName:@"isTransparent"];
@ -520,10 +522,15 @@ void __dummy_GMAppKit_functionForLinking() {}
- (void)encodeWithModelArchiver:(GMArchiver*)archiver - (void)encodeWithModelArchiver:(GMArchiver*)archiver
{ {
[super encodeWithModelArchiver:archiver];
[archiver encodeBOOL:[self pullsDown] withName:@"pullsDown"]; [archiver encodeBOOL:[self pullsDown] withName:@"pullsDown"];
#if 0
/* OUCH! This code crashes the translator; probably we interfere somehow with
the way NSPopUpButton is handled by the NeXT's NIB code. Sorry, the
popup buttons cannot be handled by the convertor! */
[archiver encodeArray:[self itemArray] withName:@"itemArray"]; [archiver encodeArray:[self itemArray] withName:@"itemArray"];
[archiver encodeString:[self titleOfSelectedItem] withName:@"selectedItem"]; [archiver encodeString:[self titleOfSelectedItem] withName:@"selectedItem"];
[super encodeWithModelArchiver:archiver];
#endif
} }
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver - (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver

View file

@ -40,6 +40,8 @@ libgmodel_HEADER_FILES_INSTALL_DIR = /gnustep/gui/AppKit
libgmodel_HEADER_FILES = IMConnectors.h IMCustomObject.h IMLoading.h GMAppKit.h libgmodel_HEADER_FILES = IMConnectors.h IMCustomObject.h IMLoading.h GMAppKit.h
test_OBJC_FILES = test.m Controller.m test_OBJC_FILES = test.m Controller.m
test_MAIN_MODEL_FILE = test.gmodel
test_RESOURCES = test.gmodel
nib2gmodel_OBJC_FILES = IBClasses.m Translator.m nib2gmodel.m nib2gmodel_OBJC_FILES = IBClasses.m Translator.m nib2gmodel.m

View file

@ -34,6 +34,10 @@ extern NSMutableArray* objects;
extern NSMutableArray* connections; extern NSMutableArray* connections;
@interface Translator : NSObject @interface Translator : NSObject
{
NSString* gmodelFile;
}
- (void)translateNibFile:(NSString*)nibFile toModelFile:(NSString*)gmodelFile; - (void)translateNibFile:(NSString*)nibFile toModelFile:(NSString*)gmodelFile;
@end @end

View file

@ -30,6 +30,7 @@
Imran Qureshi. Imran Qureshi.
*/ */
#import <Foundation/NSNotification.h>
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#import <extensions/GMArchiver.h> #import <extensions/GMArchiver.h>
#import "IMLoading.h" #import "IMLoading.h"
@ -41,14 +42,14 @@ NSMutableArray* connections;
@implementation Translator @implementation Translator
- (void)translateNibFile:(NSString*)nibFile toModelFile:(NSString*)gmodelFile - (void)translateNibFile:(NSString*)nibFile toModelFile:(NSString*)modelFile
{ {
GMArchiver* archiver; GMArchiver* archiver = [[GMArchiver new] autorelease];
GMModel* model; GMModel* model = [[GMModel new] autorelease];
objects = [[NSMutableArray new] autorelease]; objects = [[NSMutableArray new] autorelease];
connections = [[NSMutableArray new] autorelease]; connections = [[NSMutableArray new] autorelease];
model = [[GMModel new] autorelease]; gmodelFile = [modelFile retain];
[NSApplication sharedApplication]; [NSApplication sharedApplication];
if (![NSBundle loadNibFile:nibFile if (![NSBundle loadNibFile:nibFile
@ -59,7 +60,6 @@ NSMutableArray* connections;
exit (1); exit (1);
} }
archiver = [[GMArchiver new] autorelease];
[model _setObjects:objects connections:connections]; [model _setObjects:objects connections:connections];
[archiver encodeRootObject:model withName:@"RootObject"]; [archiver encodeRootObject:model withName:@"RootObject"];
if (![archiver writeToFile:gmodelFile]) if (![archiver writeToFile:gmodelFile])

View file

@ -1,13 +1,14 @@
{ {
"Object 1" = { "Object 1" = {
elements = ("Object 2", "Object 51", "Object 52"); elements = ("Object 2", "Object 52", "Object 53");
isa = NSMutableArray; isa = NSMutableArray;
}; };
"Object 2" = {className = NSApplication; isa = IMCustomObject; realObject = "Object 3"; }; "Object 2" = {className = NSApplication; isa = IMCustomObject; realObject = "Object 3"; };
"Object 3" = { "Object 3" = {
delegate = nil;
isa = NSApplication; isa = NSApplication;
keyWindow = nil; keyWindow = nil;
mainMenu = "Object 30"; mainMenu = "Object 31";
mainWindow = nil; mainWindow = nil;
windows = "Object 4"; windows = "Object 4";
}; };
@ -127,7 +128,8 @@
"Object 20", "Object 20",
"Object 21", "Object 21",
"Object 24", "Object 24",
"Object 27" "Object 27",
"Object 30"
); );
isa = NSMutableArray; isa = NSMutableArray;
}; };
@ -265,7 +267,7 @@
bounds = "{x = 0; y = 0; width = 114; height = 24}"; bounds = "{x = 0; y = 0; width = 114; height = 24}";
delay = 0.200000; delay = 0.200000;
font = "Object 15"; font = "Object 15";
frame = "{x = 16; y = 56; width = 114; height = 24}"; frame = "{x = 15; y = 56; width = 114; height = 24}";
highlightsBy = 12; highlightsBy = 12;
ignoresMultiClick = NO; ignoresMultiClick = NO;
image = nil; image = nil;
@ -365,7 +367,7 @@
drawsBackground = NO; drawsBackground = NO;
errorAction = nil; errorAction = nil;
font = "Object 25"; font = "Object 25";
frame = "{x = 194; y = 159; width = 132; height = 26}"; frame = "{x = 193; y = 159; width = 132; height = 26}";
ignoresMultiClick = NO; ignoresMultiClick = NO;
isBezeled = NO; isBezeled = NO;
isBordered = YES; isBordered = YES;
@ -451,43 +453,35 @@
red = 1.000000; red = 1.000000;
saturation = 0.000000; saturation = 0.000000;
}; };
"Object 30" = { "Object 30" = {isa = NSPopUpButton; pullsDown = NO; };
"Object 31" = {
autoenablesItems = YES; autoenablesItems = YES;
isa = NSMenu; isa = NSMenu;
itemArray = "Object 31"; itemArray = "Object 32";
title = test; title = test;
}; };
"Object 31" = { "Object 32" = {
elements = ("Object 32", "Object 38", "Object 49", "Object 50"); elements = ("Object 33", "Object 39", "Object 50", "Object 51");
isa = NSMutableArray; isa = NSMutableArray;
}; };
"Object 32" = { "Object 33" = {
action = "submenuAction:"; action = "submenuAction:";
isEnabled = YES; isEnabled = YES;
isa = NSMenuItem; isa = NSMenuItem;
keyEquivalent = ""; keyEquivalent = "";
tag = 0; tag = 0;
target = "Object 33"; target = "Object 34";
title = Info;
};
"Object 33" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 34";
title = Info; title = Info;
}; };
"Object 34" = { "Object 34" = {
elements = ("Object 35", "Object 36", "Object 37"); autoenablesItems = YES;
isa = NSMutableArray; isa = NSMenu;
itemArray = "Object 35";
title = Info;
}; };
"Object 35" = { "Object 35" = {
action = nil; elements = ("Object 36", "Object 37", "Object 38");
isEnabled = NO; isa = NSMutableArray;
isa = NSMenuItem;
keyEquivalent = "";
tag = 0;
target = nil;
title = "Info Panel...";
}; };
"Object 36" = { "Object 36" = {
action = nil; action = nil;
@ -496,9 +490,18 @@
keyEquivalent = ""; keyEquivalent = "";
tag = 0; tag = 0;
target = nil; target = nil;
title = Preferences...; title = "Info Panel...";
}; };
"Object 37" = { "Object 37" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
keyEquivalent = "";
tag = 0;
target = nil;
title = Preferences...;
};
"Object 38" = {
action = nil; action = nil;
isEnabled = YES; isEnabled = YES;
isa = NSMenuItem; isa = NSMenuItem;
@ -507,35 +510,35 @@
target = nil; target = nil;
title = Help...; title = Help...;
}; };
"Object 38" = { "Object 39" = {
action = "submenuAction:"; action = "submenuAction:";
isEnabled = YES; isEnabled = YES;
isa = NSMenuItem; isa = NSMenuItem;
keyEquivalent = ""; keyEquivalent = "";
tag = 0; tag = 0;
target = "Object 39"; target = "Object 40";
title = Document;
};
"Object 39" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 40";
title = Document; title = Document;
}; };
"Object 40" = { "Object 40" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 41";
title = Document;
};
"Object 41" = {
elements = ( elements = (
"Object 41",
"Object 42", "Object 42",
"Object 43", "Object 43",
"Object 44", "Object 44",
"Object 45", "Object 45",
"Object 46", "Object 46",
"Object 47", "Object 47",
"Object 48" "Object 48",
"Object 49"
); );
isa = NSMutableArray; isa = NSMutableArray;
}; };
"Object 41" = { "Object 42" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -544,7 +547,7 @@
target = nil; target = nil;
title = Open...; title = Open...;
}; };
"Object 42" = { "Object 43" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -553,7 +556,7 @@
target = nil; target = nil;
title = New; title = New;
}; };
"Object 43" = { "Object 44" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -562,7 +565,7 @@
target = nil; target = nil;
title = Save; title = Save;
}; };
"Object 44" = { "Object 45" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -571,7 +574,7 @@
target = nil; target = nil;
title = "Save As..."; title = "Save As...";
}; };
"Object 45" = { "Object 46" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -580,7 +583,7 @@
target = nil; target = nil;
title = "Save To..."; title = "Save To...";
}; };
"Object 46" = { "Object 47" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -589,7 +592,7 @@
target = nil; target = nil;
title = "Save All"; title = "Save All";
}; };
"Object 47" = { "Object 48" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -598,7 +601,7 @@
target = nil; target = nil;
title = "Revert to Saved"; title = "Revert to Saved";
}; };
"Object 48" = { "Object 49" = {
action = nil; action = nil;
isEnabled = NO; isEnabled = NO;
isa = NSMenuItem; isa = NSMenuItem;
@ -607,7 +610,7 @@
target = nil; target = nil;
title = Close; title = Close;
}; };
"Object 49" = { "Object 50" = {
action = nil; action = nil;
isEnabled = YES; isEnabled = YES;
isa = NSMenuItem; isa = NSMenuItem;
@ -616,7 +619,7 @@
target = nil; target = nil;
title = Hide; title = Hide;
}; };
"Object 50" = { "Object 51" = {
action = nil; action = nil;
isEnabled = YES; isEnabled = YES;
isa = NSMenuItem; isa = NSMenuItem;
@ -625,88 +628,96 @@
target = nil; target = nil;
title = Quit; title = Quit;
}; };
"Object 51" = {className = NSFontManager; isa = IMCustomObject; }; "Object 52" = {className = NSFontManager; isa = IMCustomObject; };
"Object 52" = {className = Controller; isa = IMCustomObject; }; "Object 53" = {className = Controller; isa = IMCustomObject; };
"Object 53" = { "Object 54" = {
elements = ( elements = (
"Object 54", "Object 55",
"Object 56", "Object 57",
"Object 58", "Object 59",
"Object 60", "Object 61",
"Object 62",
"Object 63", "Object 63",
"Object 64", "Object 64",
"Object 65", "Object 65",
"Object 66", "Object 66",
"Object 67" "Object 67",
"Object 68",
"Object 69"
); );
isa = NSMutableArray; isa = NSMutableArray;
}; };
"Object 54" = { "Object 55" = {
destination = "Object 2"; destination = "Object 2";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 55"; label = "Object 56";
source = "Object 51";
};
"Object 56" = {isa = NSString; string = "terminate:"; };
"Object 57" = {
destination = "Object 2";
isa = IMControlConnector;
label = "Object 58";
source = "Object 50"; source = "Object 50";
}; };
"Object 55" = {isa = NSString; string = "terminate:"; }; "Object 58" = {isa = NSString; string = "hide:"; };
"Object 56" = { "Object 59" = {
destination = "Object 2";
isa = IMControlConnector;
label = "Object 57";
source = "Object 49";
};
"Object 57" = {isa = NSString; string = "hide:"; };
"Object 58" = {
destination = "Object 27"; destination = "Object 27";
isa = IMOutletConnector; isa = IMOutletConnector;
label = "Object 59"; label = "Object 60";
source = "Object 52"; source = "Object 53";
}; };
"Object 59" = {isa = NSString; string = textField; }; "Object 60" = {isa = NSString; string = textField; };
"Object 60" = { "Object 61" = {
destination = "Object 52"; destination = "Object 53";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 61"; label = "Object 62";
source = "Object 16"; source = "Object 16";
}; };
"Object 61" = {isa = NSString; string = "buttonPressed:"; }; "Object 62" = {isa = NSString; string = "buttonPressed:"; };
"Object 62" = { "Object 63" = {
destination = "Object 52"; destination = "Object 53";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 61"; label = "Object 62";
source = "Object 17"; source = "Object 17";
}; };
"Object 63" = { "Object 64" = {
destination = "Object 52"; destination = "Object 53";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 61"; label = "Object 62";
source = "Object 14"; source = "Object 14";
}; };
"Object 64" = { "Object 65" = {
destination = "Object 52"; destination = "Object 53";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 61"; label = "Object 62";
source = "Object 18"; source = "Object 18";
}; };
"Object 65" = { "Object 66" = {
destination = "Object 52"; destination = "Object 53";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 61"; label = "Object 62";
source = "Object 19"; source = "Object 19";
}; };
"Object 66" = { "Object 67" = {
destination = "Object 52"; destination = "Object 53";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 61"; label = "Object 62";
source = "Object 20"; source = "Object 20";
}; };
"Object 67" = { "Object 68" = {
destination = "Object 52"; destination = "Object 53";
isa = IMControlConnector; isa = IMControlConnector;
label = "Object 61"; label = "Object 62";
source = "Object 21"; source = "Object 21";
}; };
RootObject = {Connections = "Object 53"; Objects = "Object 1"; isa = GMModel; }; "Object 69" = {
destination = "Object 53";
isa = IMOutletConnector;
label = "Object 70";
source = "Object 2";
};
"Object 70" = {isa = NSString; string = delegate; };
RootObject = {Connections = "Object 54"; Objects = "Object 1"; isa = GMModel; };
TopLevelObjects = (RootObject); TopLevelObjects = (RootObject);
Version = 1; Version = 1;
} }

Binary file not shown.