Fixes to make the code work with the BaseFinderOpen port to GNUstep.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2713 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Ovidiu Predescu 1998-01-30 00:34:25 +00:00
parent 5557196f20
commit 8f9aad2c38
24 changed files with 588 additions and 171 deletions

View file

@ -1,3 +1,33 @@
Thu Jan 29 12:02:08 Ovidiu Predescu <ovidiu@net-community.com>
* Model/IBClasses.h: New class NSCustomView.
* Model/IBClasses.m: Likewise.
* Model/GMAppKit.h: Moved to Headers/AppKit.
* Model/IMCustomObject.m: Likewise.
* Model/IMLoading.h: Likewise.
* Model/GMAppKit.m ([NSApplication -encodeWithModelArchiver:]):
Encode the delegate.
(NSBox): Support for encoding and decoding it.
([NSCell -initWithModelUnarchiver:]): Check for the font.
(NSClipView): Support for encoding and decoding.
(NSImage): Return a dummy image in case the requested one doesn't
exist. Don't return nil as it breaks the code, maybe we should
raise an exception.
(NSPopUpButton): Code to support encoding and
decoding. Unfortunately it doesn't work properly, it causes a
crash when loading.
* Model/test.nib: Added a custom view to test loading.
* Source/GNUmakefile: Added NSTextView.m.
* Source/NSApplication.m ([NSApplication -finishLaunching]): Add support
for loading the model file.
* Source/NSBrowser.m: Fixed several allocation bugs.
* Source/NSClipView.m ([NSClipView -setDocumentView:]): Check for
invalid document view.
* Source/NSPopUpButton.m: Minimaly fill out the implementation so
we don't get a crash at the loading time.
* Source/NSTextView.m: Define the class so we don't linking errors
while trying to link with OPENSTEP converted applications.
Fri Jan 9 14:06:57 1998 Ovidiu Predescu <ovidiu@net-community.com>
* Model/GNUmakefile: Copy the header files to the AppKit directory

View file

@ -132,6 +132,7 @@
#include <AppKit/NSText.h>
#include <AppKit/NSTextField.h>
#include <AppKit/NSTextFieldCell.h>
#include <AppKit/NSTextView.h>
#include <AppKit/NSView.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSWorkspace.h>

View file

@ -41,6 +41,9 @@
@interface NSCell (GMArchiverMethods) <ModelCoding>
@end
@interface NSClipView (GMArchiverMethods) <ModelCoding>
@end
@interface NSColor (GMArchiverMethods) <ModelCoding>
@end

View file

@ -0,0 +1,55 @@
/*
IMConnectors.h
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: November 1997
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* These classes were inspired by IBConnectors classes from objcX, "an
Objective-C class library for a window system". The code was originally
written by Scott Francis, Paul Kunz, Imran Qureshi and Libing Wang. */
#ifndef _GNUstep_H_IMConnectors
#define _GNUstep_H_IMConnectors
#import <Foundation/NSObject.h>
@interface IMConnector : NSObject
{
id source;
id destination;
NSString* label;
}
- source;
- destination;
- label;
@end
@interface IMControlConnector:IMConnector
- (void)establishConnection;
@end
@interface IMOutletConnector : IMConnector
- (void)establishConnection;
@end
#endif /* _GNUstep_H_IMConnectors */

View file

@ -51,4 +51,16 @@
@end
@interface IMCustomView : NSView
{
NSString* className;
id realObject;
id extension;
}
- (id)nibInstantiate;
@end
#endif /* _GNUstep_H_IMCustomObject */

View file

@ -34,7 +34,7 @@
@interface NSBundle (IMLoading)
+ (BOOL)loadIMFile:(NSString*)filename owner:(id)owner;
- (BOOL)loadIMFile:(NSString*)filename owner:(id)owner;
@end
@ -44,6 +44,7 @@
NSArray* connections;
}
+ (BOOL)loadIMFile:(NSString*)path owner:(id)owner;
+ (BOOL)loadIMFile:(NSString*)path owner:(id)owner bundle:(NSBundle*)bundle;
- (void)_makeConnections;
- (void)_setObjects:objects connections:connections;
@end

View file

@ -30,12 +30,12 @@
#define _GNUstep_H_NSPopUpButton
#include <AppKit/NSButton.h>
#include <AppKit/NSMenuItem.h>
@class NSString;
@class NSArray;
@class NSMutableArray;
@class NSMenuCell;
@class NSFont;
@class NSMatrix;
@ -89,14 +89,14 @@
- (int)indexOfItemWithTitle:(NSString *)title;
- (int)indexOfSelectedItem;
- (int)numberOfItems;
- (NSMenuCell *)itemAtIndex:(int)index;
- (NSMatrix *)itemMatrix;
- (id <NSMenuItem>)itemAtIndex:(int)index;
- (NSArray *)itemArray;
- (NSString *)itemTitleAtIndex:(int)index;
- (NSArray *)itemTitles;
- (NSMenuCell *)itemWithTitle:(NSString *)title;
- (NSMenuCell *)lastItem;
- (NSMenuCell *)selectedItem;
- (NSString *)titleOfSelectedItem;
- (id <NSMenuItem>)itemWithTitle:(NSString *)title;
- (id <NSMenuItem>)lastItem;
- (id <NSMenuItem>)selectedItem;
- (NSString*)titleOfSelectedItem;
//
// Manipulating the NSPopUpButton

View file

@ -0,0 +1,34 @@
/*
NSTextView.h
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: January 1998
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _GNUstep_H_NSTextView
#define _GNUstep_H_NSTextView
#include <AppKit/NSText.h>
@interface NSTextView : NSText
@end
#endif /* _GNUstep_H_NSTextView */

View file

@ -148,12 +148,10 @@ void __dummy_GMAppKit_functionForLinking() {}
[archiver encodeInt:[self state] withName:@"state"];
[archiver encodeFloat:delay withName:@"delay"];
[archiver encodeFloat:interval withName:@"interval"];
#if 1
[archiver encodeString:[self title] withName:@"title"];
[archiver encodeString:[self alternateTitle] withName:@"alternateTitle"];
[archiver encodeObject:[self image] withName:@"image"];
[archiver encodeObject:[self alternateImage] withName:@"alternateImage"];
#endif
[archiver encodeInt:[self imagePosition] withName:@"imagePosition"];
[archiver encodeBOOL:[self isBordered] withName:@"isBordered"];
[archiver encodeBOOL:[self isTransparent] withName:@"isTransparent"];
@ -214,6 +212,30 @@ void __dummy_GMAppKit_functionForLinking() {}
@end /* NSCell (GMArchiverMethods) */
@implementation NSClipView (GMArchiverMethods)
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[super encodeWithModelArchiver:archiver];
[archiver encodeObject:[self documentView] withName:@"documentView"];
[archiver encodeBOOL:[self copiesOnScroll] withName:@"copiesOnScroll"];
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
}
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
{
self = [super initWithModelUnarchiver:unarchiver];
[self setDocumentView:[unarchiver decodeObjectWithName:@"documentView"]];
[self setCopiesOnScroll:[unarchiver decodeBOOLWithName:@"copiesOnScroll"]];
[self setBackgroundColor:[unarchiver decodeObjectWithName:@"backgroundColor"]];
return self;
}
@end /* NSClipView (GMArchiverMethods) */
@implementation NSColor (GMArchiverMethods)
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
@ -535,6 +557,9 @@ void __dummy_GMAppKit_functionForLinking() {}
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
{
/* Check the following: the program simply crashes if there's nothing in the
model file */
#if 0
int i, count;
NSMutableArray* decodedItems
= [unarchiver decodeObjectWithName:@"itemArray"];
@ -556,6 +581,7 @@ void __dummy_GMAppKit_functionForLinking() {}
[self selectItemWithTitle:[unarchiver decodeStringWithName:@"selectedItem"]];
[self synchronizeTitleAndSelectedItem];
#endif
return self;
}
@ -666,6 +692,8 @@ void __dummy_GMAppKit_functionForLinking() {}
NSView* view = [[[self allocWithZone:[unarchiver objectZone]]
initWithFrame:rect]
autorelease];
if (!view)
NSLog (@"cannot create the requested view!");
return view;
}

View file

@ -29,7 +29,7 @@
#ifndef _GNUstep_H_IBClasses
#define _GNUstep_H_IBClasses
#import <Foundation/NSObject.h>
#import <AppKit/NSView.h>
@class NSString;
@ -42,6 +42,18 @@
@end
@interface NSCustomView : NSView
{
id className;
id realObject;
id extension;
}
- (id)nibInstantiate;
@end
@interface NSIBConnector : NSObject
{
id source;

View file

@ -74,6 +74,45 @@
@end /* NSCustomObject */
@implementation NSCustomView (NibToGModel)
- (id)awakeAfterUsingCoder:(NSCoder*)aDecoder
{
#ifdef DEBUG
NSLog (@"%x awakeAfterUsingCoder NSCustomView: className = %@, realObject = %@, "
@"extension = %@", self, className, realObject, extension);
#endif
[objects addObject:self];
return self;
}
- description
{
return [NSString stringWithFormat:@"className = %@, realObject = %@, extension = %@", className, realObject, extension];
}
- nibInstantiate
{
return self;
}
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[archiver encodeString:className withName:@"className"];
if (realObject)
[archiver encodeObject:realObject withName:@"realObject"];
if (extension)
[archiver encodeObject:extension withName:@"extension"];
}
- (Class)classForModelArchiver
{
return [IMCustomView class];
}
@end
@implementation NSIBConnector (NibToGModel)
- (id)awakeAfterUsingCoder:(NSCoder*)aDecoder
{

View file

@ -87,3 +87,52 @@ extern BOOL _fileOwnerDecoded;
}
@end
@implementation IMCustomView
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
{
IMCustomView* customView = [[self new] autorelease];
Class class;
customView->className = [unarchiver decodeStringWithName:@"className"];
customView->extension = [unarchiver decodeObjectWithName:@"extension"];
customView->realObject = [unarchiver decodeObjectWithName:@"realObject"];
if (!_fileOwnerDecoded) {
_fileOwnerDecoded = YES;
customView->realObject = _nibOwner;
return customView;
}
class = NSClassFromString (customView->className);
if (class)
customView->realObject = [[class alloc] init];
else {
NSLog (@"Class %@ not linked into application!", customView->className);
}
return customView;
}
- (id)nibInstantiate
{
return realObject;
}
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[archiver encodeString:className withName:@"className"];
if (realObject)
[archiver encodeObject:realObject withName:@"realObject"];
if (extension)
[archiver encodeObject:extension withName:@"extension"];
}
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
{
return self;
}
@end

View file

@ -26,6 +26,8 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSPathUtilities.h>
#include <extensions/GMArchiver.h>
#include "IMLoading.h"
#include "IMCustomObject.h"
@ -37,9 +39,9 @@ void __dummy_IMLoading_functionForLinking()
@implementation NSBundle (IMLoading)
+ (BOOL)loadIMFile:(NSString*)path owner:(id)owner
- (BOOL)loadIMFile:(NSString*)path owner:(id)owner
{
return [GMModel loadIMFile:path owner:owner];
return [GMModel loadIMFile:path owner:owner bundle:self];
}
@end /* NSBundle(IMLoading) */
@ -59,7 +61,11 @@ BOOL _fileOwnerDecoded = NO;
+ (BOOL)loadIMFile:(NSString*)path owner:(id)owner
{
NSBundle* mainBundle = [NSBundle mainBundle];
return [self loadIMFile:path owner:owner bundle:[NSBundle mainBundle]];
}
+ (BOOL)loadIMFile:(NSString*)path owner:(id)owner bundle:(NSBundle*)mainBundle
{
NSString* resourcePath = [mainBundle resourcePath];
GMUnarchiver* unarchiver;
id previousNibOwner = _nibOwner;
@ -67,9 +73,21 @@ BOOL _fileOwnerDecoded = NO;
if (![path hasSuffix:@".gmodel"])
path = [path stringByAppendingPathExtension:@"gmodel"];
path = [resourcePath stringByAppendingPathComponent:path];
if (![[NSFileManager defaultManager] fileExistsAtPath:path])
return NO;
/* First check to see if path is an absolute path; if so try to load the
pointed file. */
if ([path isAbsolutePath]) {
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
/* The file is an absolute path name but the model file doesn't exist. */
return NO;
}
}
else {
/* The path is a relative path; search it in the current bundle. */
path = [resourcePath stringByAppendingPathComponent:path];
if (![[NSFileManager defaultManager] fileExistsAtPath:path])
return NO;
}
NSLog (@"loading model file %@...", path);
unarchiver = [GMUnarchiver unarchiverWithContentsOfFile:path];

View file

@ -1,6 +1,6 @@
{
"Object 1" = {
elements = ("Object 2", "Object 52", "Object 53");
elements = ("Object 2", "Object 31", "Object 55", "Object 56");
isa = NSMutableArray;
};
"Object 2" = {className = NSApplication; isa = IMCustomObject; realObject = "Object 3"; };
@ -8,12 +8,12 @@
delegate = nil;
isa = NSApplication;
keyWindow = nil;
mainMenu = "Object 31";
mainMenu = "Object 34";
mainWindow = nil;
windows = "Object 4";
};
"Object 4" = {
elements = ("Object 5", "Object 9", "Object 11");
elements = ("Object 5", "Object 9", "Object 11", "Object 32");
isa = NSMutableArray;
};
"Object 5" = {
@ -92,7 +92,7 @@
backgroundColor = "Object 8";
backingType = 2;
contentView = "Object 12";
frame = "{x = 258; y = 519; width = 422; height = 296}";
frame = "{x = 258; y = 511; width = 422; height = 304}";
frameAutosaveName = nil;
hidesOnDeactivate = NO;
isAutodisplay = YES;
@ -109,8 +109,8 @@
"Object 12" = {
autoresizesSubviews = NO;
autoresizingMask = 0;
bounds = "{x = 0; y = 0; width = 420; height = 264}";
frame = "{x = 1; y = 9; width = 420; height = 264}";
bounds = "{x = 0; y = 0; width = 420; height = 272}";
frame = "{x = 1; y = 9; width = 420; height = 272}";
isa = NSView;
nextResponder = "Object 11";
postsBoundsChangedNotifications = YES;
@ -129,7 +129,8 @@
"Object 21",
"Object 24",
"Object 27",
"Object 30"
"Object 30",
"Object 31"
);
isa = NSMutableArray;
};
@ -142,7 +143,7 @@
bounds = "{x = 0; y = 0; width = 114; height = 24}";
delay = 0.200000;
font = "Object 15";
frame = "{x = 16; y = 140; width = 114; height = 24}";
frame = "{x = 16; y = 148; width = 114; height = 24}";
highlightsBy = 12;
ignoresMultiClick = NO;
image = nil;
@ -174,7 +175,7 @@
bounds = "{x = 0; y = 0; width = 114; height = 24}";
delay = 0.200000;
font = "Object 15";
frame = "{x = 16; y = 224; width = 114; height = 24}";
frame = "{x = 16; y = 232; width = 114; height = 24}";
highlightsBy = 14;
ignoresMultiClick = NO;
image = nil;
@ -205,7 +206,7 @@
bounds = "{x = 0; y = 0; width = 114; height = 24}";
delay = 0.200000;
font = "Object 15";
frame = "{x = 16; y = 182; width = 114; height = 24}";
frame = "{x = 16; y = 190; width = 114; height = 24}";
highlightsBy = 1;
ignoresMultiClick = NO;
image = nil;
@ -236,7 +237,7 @@
bounds = "{x = 0; y = 0; width = 114; height = 24}";
delay = 0.200000;
font = "Object 15";
frame = "{x = 17; y = 98; width = 114; height = 24}";
frame = "{x = 17; y = 106; width = 114; height = 24}";
highlightsBy = 14;
ignoresMultiClick = NO;
image = nil;
@ -267,7 +268,7 @@
bounds = "{x = 0; y = 0; width = 114; height = 24}";
delay = 0.200000;
font = "Object 15";
frame = "{x = 15; y = 56; width = 114; height = 24}";
frame = "{x = 15; y = 64; width = 114; height = 24}";
highlightsBy = 12;
ignoresMultiClick = NO;
image = nil;
@ -298,7 +299,7 @@
bounds = "{x = 0; y = 0; width = 114; height = 24}";
delay = 0.200000;
font = "Object 15";
frame = "{x = 16; y = 14; width = 114; height = 24}";
frame = "{x = 16; y = 22; width = 114; height = 24}";
highlightsBy = 3;
ignoresMultiClick = NO;
image = nil;
@ -329,7 +330,7 @@
bounds = "{x = 0; y = 0; width = 109; height = 15}";
delay = 0.200000;
font = "Object 15";
frame = "{x = 204; y = 208; width = 109; height = 15}";
frame = "{x = 204; y = 216; width = 109; height = 15}";
highlightsBy = 3;
ignoresMultiClick = NO;
image = "Object 22";
@ -367,7 +368,7 @@
drawsBackground = NO;
errorAction = nil;
font = "Object 25";
frame = "{x = 193; y = 159; width = 132; height = 26}";
frame = "{x = 193; y = 167; width = 132; height = 26}";
ignoresMultiClick = NO;
isBezeled = NO;
isBordered = YES;
@ -410,7 +411,7 @@
drawsBackground = YES;
errorAction = nil;
font = "Object 15";
frame = "{x = 172; y = 100; width = 214; height = 21}";
frame = "{x = 172; y = 108; width = 214; height = 21}";
ignoresMultiClick = NO;
isBezeled = YES;
isBordered = NO;
@ -454,36 +455,67 @@
saturation = 0.000000;
};
"Object 30" = {isa = NSPopUpButton; pullsDown = NO; };
"Object 31" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 32";
title = test;
};
"Object 31" = {className = MyView; isa = IMCustomView; };
"Object 32" = {
elements = ("Object 33", "Object 39", "Object 50", "Object 51");
isa = NSMutableArray;
backgroundColor = "Object 8";
backingType = 2;
contentView = "Object 33";
frame = "{x = 178; y = 312; width = 370; height = 357}";
frameAutosaveName = nil;
hidesOnDeactivate = NO;
isAutodisplay = YES;
isReleasedWhenClosed = NO;
isVisible = NO;
isa = NSWindow;
level = 0;
maxSize = "{width = 3.40282e+38; height = 3.40282e+38}";
minSize = "{width = 0; height = 0}";
representedFilename = "";
styleMask = 14;
title = Window;
};
"Object 33" = {
action = "submenuAction:";
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
tag = 0;
target = "Object 34";
title = Info;
autoresizesSubviews = NO;
autoresizingMask = 0;
bounds = "{x = 0; y = 0; width = 368; height = 325}";
frame = "{x = 1; y = 9; width = 368; height = 325}";
isa = NSView;
nextResponder = "Object 32";
postsBoundsChangedNotifications = YES;
postsFrameChangedNotifications = YES;
subviews = "Object 7";
superview = nil;
};
"Object 34" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 35";
title = Info;
title = test;
};
"Object 35" = {
elements = ("Object 36", "Object 37", "Object 38");
elements = ("Object 36", "Object 42", "Object 53", "Object 54");
isa = NSMutableArray;
};
"Object 36" = {
action = "submenuAction:";
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
tag = 0;
target = "Object 37";
title = Info;
};
"Object 37" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 38";
title = Info;
};
"Object 38" = {
elements = ("Object 39", "Object 40", "Object 41");
isa = NSMutableArray;
};
"Object 39" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -492,7 +524,7 @@
target = nil;
title = "Info Panel...";
};
"Object 37" = {
"Object 40" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -501,7 +533,7 @@
target = nil;
title = Preferences...;
};
"Object 38" = {
"Object 41" = {
action = nil;
isEnabled = YES;
isa = NSMenuItem;
@ -510,35 +542,35 @@
target = nil;
title = Help...;
};
"Object 39" = {
"Object 42" = {
action = "submenuAction:";
isEnabled = YES;
isa = NSMenuItem;
keyEquivalent = "";
tag = 0;
target = "Object 40";
target = "Object 43";
title = Document;
};
"Object 40" = {
"Object 43" = {
autoenablesItems = YES;
isa = NSMenu;
itemArray = "Object 41";
itemArray = "Object 44";
title = Document;
};
"Object 41" = {
"Object 44" = {
elements = (
"Object 42",
"Object 43",
"Object 44",
"Object 45",
"Object 46",
"Object 47",
"Object 48",
"Object 49"
"Object 49",
"Object 50",
"Object 51",
"Object 52"
);
isa = NSMutableArray;
};
"Object 42" = {
"Object 45" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -547,7 +579,7 @@
target = nil;
title = Open...;
};
"Object 43" = {
"Object 46" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -556,7 +588,7 @@
target = nil;
title = New;
};
"Object 44" = {
"Object 47" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -565,7 +597,7 @@
target = nil;
title = Save;
};
"Object 45" = {
"Object 48" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -574,7 +606,7 @@
target = nil;
title = "Save As...";
};
"Object 46" = {
"Object 49" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -583,7 +615,7 @@
target = nil;
title = "Save To...";
};
"Object 47" = {
"Object 50" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -592,7 +624,7 @@
target = nil;
title = "Save All";
};
"Object 48" = {
"Object 51" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -601,7 +633,7 @@
target = nil;
title = "Revert to Saved";
};
"Object 49" = {
"Object 52" = {
action = nil;
isEnabled = NO;
isa = NSMenuItem;
@ -610,7 +642,7 @@
target = nil;
title = Close;
};
"Object 50" = {
"Object 53" = {
action = nil;
isEnabled = YES;
isa = NSMenuItem;
@ -619,7 +651,7 @@
target = nil;
title = Hide;
};
"Object 51" = {
"Object 54" = {
action = nil;
isEnabled = YES;
isa = NSMenuItem;
@ -628,96 +660,96 @@
target = nil;
title = Quit;
};
"Object 52" = {className = NSFontManager; isa = IMCustomObject; };
"Object 53" = {className = Controller; isa = IMCustomObject; };
"Object 54" = {
"Object 55" = {className = Controller; isa = IMCustomObject; };
"Object 56" = {className = NSFontManager; isa = IMCustomObject; };
"Object 57" = {
elements = (
"Object 55",
"Object 57",
"Object 59",
"Object 61",
"Object 63",
"Object 58",
"Object 60",
"Object 62",
"Object 64",
"Object 65",
"Object 66",
"Object 67",
"Object 68",
"Object 69"
"Object 69",
"Object 70",
"Object 71",
"Object 72"
);
isa = NSMutableArray;
};
"Object 55" = {
"Object 58" = {
destination = "Object 2";
isa = IMControlConnector;
label = "Object 56";
source = "Object 51";
label = "Object 59";
source = "Object 54";
};
"Object 56" = {isa = NSString; string = "terminate:"; };
"Object 57" = {
"Object 59" = {isa = NSString; string = "terminate:"; };
"Object 60" = {
destination = "Object 2";
isa = IMControlConnector;
label = "Object 58";
source = "Object 50";
};
"Object 58" = {isa = NSString; string = "hide:"; };
"Object 59" = {
destination = "Object 27";
isa = IMOutletConnector;
label = "Object 60";
label = "Object 61";
source = "Object 53";
};
"Object 60" = {isa = NSString; string = textField; };
"Object 61" = {
destination = "Object 53";
"Object 61" = {isa = NSString; string = "hide:"; };
"Object 62" = {
destination = "Object 27";
isa = IMOutletConnector;
label = "Object 63";
source = "Object 55";
};
"Object 63" = {isa = NSString; string = textField; };
"Object 64" = {
destination = "Object 55";
isa = IMControlConnector;
label = "Object 62";
label = "Object 65";
source = "Object 16";
};
"Object 62" = {isa = NSString; string = "buttonPressed:"; };
"Object 63" = {
destination = "Object 53";
"Object 65" = {isa = NSString; string = "buttonPressed:"; };
"Object 66" = {
destination = "Object 55";
isa = IMControlConnector;
label = "Object 62";
label = "Object 65";
source = "Object 17";
};
"Object 64" = {
destination = "Object 53";
"Object 67" = {
destination = "Object 55";
isa = IMControlConnector;
label = "Object 62";
label = "Object 65";
source = "Object 14";
};
"Object 65" = {
destination = "Object 53";
"Object 68" = {
destination = "Object 55";
isa = IMControlConnector;
label = "Object 62";
label = "Object 65";
source = "Object 18";
};
"Object 66" = {
destination = "Object 53";
"Object 69" = {
destination = "Object 55";
isa = IMControlConnector;
label = "Object 62";
label = "Object 65";
source = "Object 19";
};
"Object 67" = {
destination = "Object 53";
"Object 70" = {
destination = "Object 55";
isa = IMControlConnector;
label = "Object 62";
label = "Object 65";
source = "Object 20";
};
"Object 68" = {
destination = "Object 53";
"Object 71" = {
destination = "Object 55";
isa = IMControlConnector;
label = "Object 62";
label = "Object 65";
source = "Object 21";
};
"Object 69" = {
destination = "Object 53";
"Object 72" = {
destination = "Object 55";
isa = IMOutletConnector;
label = "Object 70";
label = "Object 73";
source = "Object 2";
};
"Object 70" = {isa = NSString; string = delegate; };
RootObject = {Connections = "Object 54"; Objects = "Object 1"; isa = GMModel; };
"Object 73" = {isa = NSString; string = delegate; };
RootObject = {Connections = "Object 57"; Objects = "Object 1"; isa = GMModel; };
TopLevelObjects = (RootObject);
Version = 1;
}

View file

@ -2,6 +2,18 @@
#import <AppKit/AppKit.h>
#import "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;
@ -13,23 +25,28 @@ int main (int argc, char** argv, char** env)
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
#if 0
processInfo = [NSProcessInfo processInfo];
arguments = [processInfo arguments];
if ([arguments count] != 2) {
printf ("usage: %s gmodel-file\n", [[processInfo processName] cString]);
exit (1);
}
#endif
#ifndef NX_CURRENT_COMPILER_RELEASE
initialize_gnustep_backend();
#endif
#if 0
if (![GMModel loadIMFile:[arguments objectAtIndex:1]
owner:[NSApplication sharedApplication]]) {
printf ("Cannot load Interface Modeller file!\n");
exit (1);
}
#endif
[[NSDPSContext currentContext] wait];
[[NSApplication sharedApplication] run];
printf ("exiting...\n");

View file

@ -4,3 +4,4 @@
SUPERCLASS = NSObject;
};
"FirstResponder" = {ACTIONS = {}; OUTLETS = {}; SUPERCLASS = NSObject; };
"MyView" = {ACTIONS = {}; OUTLETS = {}; SUPERCLASS = NSView; };

Binary file not shown.

View file

@ -96,6 +96,7 @@ NSSplitView.m \
NSText.m \
NSTextField.m \
NSTextFieldCell.m \
NSTextView.m \
NSView.m \
NSWindow.m \
NSWindowView.m \
@ -179,6 +180,7 @@ AppKit/NSSplitView.h \
AppKit/NSText.h \
AppKit/NSTextField.h \
AppKit/NSTextFieldCell.h \
AppKit/NSTextView.h \
AppKit/NSView.h \
AppKit/NSWindow.h \
AppKit/NSWindowView.h \

View file

@ -151,12 +151,10 @@ static id NSApp;
propertyList];
NSString* mainModelFile = [infoDict objectForKey:@"NSMainNibFile"];
if (mainModelFile) {
if (mainModelFile && ![mainModelFile isEqual:@""]) {
if (![GMModel loadIMFile:mainModelFile
owner:[NSApplication sharedApplication]])
NSLog (@"Cannot load the main model file '%@", mainModelFile);
else
NSLog (@"Model loading ready!");
}
// notify that we will finish the launching

View file

@ -82,6 +82,9 @@
- (void)dealloc
{
[_columnScrollView release];
[_columnMatrix release];
[_emptyView release];
[_columnTitle release];
[super dealloc];
}
@ -98,6 +101,8 @@
- (void)setColumnScrollView:(id)aView
{
[aView retain];
[_columnScrollView release];
_columnScrollView = aView;
}
@ -108,6 +113,8 @@
- (void)setColumnMatrix:(id)aMatrix
{
[aMatrix retain];
[_columnMatrix release];
_columnMatrix = aMatrix;
}
@ -194,7 +201,7 @@
_browserCellClass = [NSBrowser cellClass];
_browserCellPrototype = [[_browserCellClass alloc] init];
_browserMatrixClass = [NSMatrix class];
_pathSeparator = [[NSString alloc] initWithCString: "/"];
_pathSeparator = @"/";
_isLoaded = NO;
_allowsBranchSelection = YES;
_allowsEmptySelection = YES;
@ -527,8 +534,9 @@
bc = [[[NSBrowserColumn alloc] init] autorelease];
// Create a scrollview
sc = [[NSScrollView alloc]
initWithFrame: [self frameOfInsideOfColumn: n]];
sc = [[[NSScrollView alloc]
initWithFrame: [self frameOfInsideOfColumn: n]]
autorelease];
[sc setHasHorizontalScroller: NO];
[sc setHasVerticalScroller: YES];
[bc setColumnScrollView: sc];
@ -1470,12 +1478,13 @@
// If we are not reusing matrixes
// then delete the old matrix and create a new one
[oldm release];
matrix = [[_browserMatrixClass alloc]
matrix = [[[_browserMatrixClass alloc]
initWithFrame: matrixRect
mode: NSListModeMatrix
prototype: _browserCellPrototype
numberOfRows: n
numberOfColumns: 1];
numberOfColumns: 1]
autorelease];
[matrix setAllowsEmptySelection: _allowsEmptySelection];
if (!_allowsMultipleSelection)
[matrix setMode: NSRadioModeMatrix];
@ -1506,12 +1515,13 @@
// If we are not reusing matrixes
// then delete the old matrix and create a new one
[oldm release];
matrix = [[_browserMatrixClass alloc]
matrix = [[[_browserMatrixClass alloc]
initWithFrame: matrixRect
mode: NSListModeMatrix
prototype: _browserCellPrototype
numberOfRows: 0
numberOfColumns: 0];
numberOfColumns: 0]
autorelease];
[matrix setAllowsEmptySelection: _allowsEmptySelection];
if (!_allowsMultipleSelection)
[matrix setMode: NSRadioModeMatrix];

View file

@ -69,18 +69,21 @@
[_documentView removeFromSuperview];
ASSIGN(_documentView, aView);
[self addSubview:_documentView];
/* Register to notifications sent by the document view */
[_documentView setPostsFrameChangedNotifications:YES];
[_documentView setPostsBoundsChangedNotifications:YES];
if (_documentView) {
[self addSubview:_documentView];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(viewFrameChanged:)
name:NSViewFrameDidChangeNotification object:_documentView];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(viewBoundsChanged:)
name:NSViewBoundsDidChangeNotification object:_documentView];
/* Register to notifications sent by the document view */
[_documentView setPostsFrameChangedNotifications:YES];
[_documentView setPostsBoundsChangedNotifications:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(viewFrameChanged:)
name:NSViewFrameDidChangeNotification object:_documentView];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(viewBoundsChanged:)
name:NSViewBoundsDidChangeNotification object:_documentView];
}
/* TODO: invoke superview's reflectScrolledClipView:? */
[[self superview] reflectScrolledClipView:self];

View file

@ -30,6 +30,7 @@
#include <Foundation/NSArray.h>
#include <AppKit/NSPopUpButton.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSMenu.h>
//
// NSPopUpButton implementation
@ -108,35 +109,64 @@
//
- (void)addItemWithTitle:(NSString *)title
{
[list_items addObject:title];
id item = [[[NSMenu cellClass] new] autorelease];
[list_items addObject:item];
[item setTitle:title];
[self synchronizeTitleAndSelectedItem];
}
- (void)addItemsWithTitles:(NSArray *)itemTitles
{}
{
int i, count = [itemTitles count];
for (i = 0; i < count; i++)
[self addItemWithTitle:[itemTitles objectAtIndex:i]];
}
- (void)insertItemWithTitle:(NSString *)title
atIndex:(unsigned int)index
{}
{
id item = [[[NSMenu cellClass] new] autorelease];
[list_items insertObject:item atIndex:index];
[item setTitle:title];
[self synchronizeTitleAndSelectedItem];
}
//
// Removing Items
//
- (void)removeAllItems
{}
{
[list_items removeAllObjects];
}
- (void)removeItemWithTitle:(NSString *)title
{}
{
int index = [self indexOfItemWithTitle:title];
if (index != NSNotFound)
[list_items removeObjectAtIndex:index];
}
- (void)removeItemAtIndex:(int)index
{}
{
[list_items removeObjectAtIndex:index];
}
//
// Querying the NSPopUpButton about Its Items
//
- (int)indexOfItemWithTitle:(NSString *)title
{
return 0;
int i, count = [list_items count];
for (i = 0; i < count; i++)
if ([[[list_items objectAtIndex:i] title] isEqual:title])
return i;
return NSNotFound;
}
- (int)indexOfSelectedItem
@ -149,32 +179,42 @@
return [list_items count];
}
- (NSMenuCell *)itemAtIndex:(int)index
- (id <NSMenuItem>)itemAtIndex:(int)index
{
return nil;
return [list_items objectAtIndex:index];
}
- (NSMatrix *)itemMatrix
{
return nil;
}
- (NSString *)itemTitleAtIndex:(int)index
{
return nil;
}
- (NSArray *)itemTitles
- (NSArray *)itemArray
{
return list_items;
}
- (NSMenuCell *)itemWithTitle:(NSString *)title
- (NSString *)itemTitleAtIndex:(int)index
{
return [[list_items objectAtIndex:index] title];
}
- (NSArray *)itemTitles
{
int i, count = [list_items count];
NSMutableArray* titles = [NSMutableArray arrayWithCapacity:count];
for (i = 0; i < count; i++)
[titles addObject:[[list_items objectAtIndex:i] title]];
return titles;
}
- (id <NSMenuItem>)itemWithTitle:(NSString *)title
{
int index = [self indexOfItemWithTitle:title];
if (index != NSNotFound)
return [list_items objectAtIndex:index];
return nil;
}
- (NSMenuCell *)lastItem
- (id <NSMenuItem>)lastItem
{
if ([list_items count])
return [list_items lastObject];
@ -182,17 +222,14 @@
return nil;
}
- (NSMenuCell *)selectedItem
- (id <NSMenuItem>)selectedItem
{
return nil;
return [list_items objectAtIndex:selected_item];
}
- (NSString *)titleOfSelectedItem
{
if ([list_items count])
return [list_items objectAtIndex:selected_item];
else
return nil;
return [[self selectedItem] title];
}
//
@ -218,7 +255,12 @@
}
- (void)selectItemWithTitle:(NSString *)title
{}
{
int index = [self indexOfItemWithTitle:title];
if (index != NSNotFound)
[self selectItemAtIndex:index];
}
- (void)setFont:(NSFont *)fontObject
{}

29
Source/NSTextView.m Normal file
View file

@ -0,0 +1,29 @@
/*
NSTextView.m
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: January 1998
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#import <AppKit/NSTextView.h>
@implementation NSTextView
@end

View file

@ -1 +1,2 @@
Makefile
*obj