mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 14:10:44 +00:00
Changes to correct header reading issue.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17212 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
db162f282c
commit
9b150d6e34
7 changed files with 168 additions and 200 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2003-07-14 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassManager.[hm]: Added implementation for new methods
|
||||
to add an array of outlets and actions to a class.
|
||||
* GormDocument.[hm]: Added GPL notice to top of file .h file
|
||||
and made changes in the -parseHeader method to properly
|
||||
handle .h files with categories.
|
||||
* GormWindowEditor.m: Removed some very old and commented out
|
||||
code.
|
||||
|
||||
2003-06-29 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassManager.m: Added code to send notifications when
|
||||
|
|
4
Gorm.m
4
Gorm.m
|
@ -213,6 +213,10 @@ static NSButtonType _buttonTypeForObject( id button )
|
|||
- (id) initWithObject: (id)object
|
||||
className: (NSString *)name
|
||||
{
|
||||
// GSDataObject *data = [[GSDataObject alloc] initWithObject: object];
|
||||
// RETAIN(data);
|
||||
// NSLog(@"!!!!!!I'm here!!!!!!!!! %@",self);
|
||||
|
||||
[super init];
|
||||
[self setBackgroundColor: [object backgroundColor]];
|
||||
[self setContentView: [object contentView]];
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
- (void) removeOutlet: (NSString*)anOutlet fromClassNamed: (NSString*)anObject;
|
||||
- (void) addOutlet: (NSString *)anOutlet forClassNamed: (NSString *)className;
|
||||
- (void) addAction: (NSString *)anAction forClassNamed: (NSString *)className;
|
||||
- (void) addActions: (NSArray *)actions forClassNamed: (NSString *)className;
|
||||
- (void) addOutlets: (NSArray *)outlets forClassNamed: (NSString *)className;
|
||||
- (NSString *) addNewActionToClassNamed: (NSString *)name;
|
||||
- (NSString *) addNewOutletToClassNamed: (NSString *)name;
|
||||
- (void) replaceAction: (NSString *)oldAction withAction: (NSString *)newAction forClassNamed: className;
|
||||
|
|
|
@ -1427,4 +1427,25 @@
|
|||
|
||||
return className;
|
||||
}
|
||||
|
||||
- (void) addActions: (NSArray *)actions forClassNamed: (NSString *)className
|
||||
{
|
||||
id action = nil;
|
||||
NSEnumerator *e = [actions objectEnumerator];
|
||||
while((action = [e nextObject]))
|
||||
{
|
||||
[self addAction: action forClassNamed: className];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) addOutlets: (NSArray *)outlets forClassNamed: (NSString *)className
|
||||
{
|
||||
id action = nil;
|
||||
NSEnumerator *e = [outlets objectEnumerator];
|
||||
while((action = [e nextObject]))
|
||||
{
|
||||
[self addOutlet: action forClassNamed: className];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/* GormDocument.h
|
||||
*
|
||||
* Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 1999, 2003
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_GormDocument_h
|
||||
#define INCLUDED_GormDocument_h
|
||||
|
|
191
GormDocument.m
191
GormDocument.m
|
@ -320,7 +320,7 @@ static NSImage *classesImage = nil;
|
|||
NSString *className = [classManager customClassForName: key];
|
||||
|
||||
[tempNameTable setObject: obj forKey: key]; // save the old object
|
||||
NSLog(@"className = (%@), obj = (%@), key = (%@)", className, obj, key);
|
||||
NSDebugLog(@"className = (%@), obj = (%@), key = (%@)", className, obj, key);
|
||||
if (className != nil)
|
||||
{
|
||||
/*
|
||||
|
@ -774,7 +774,7 @@ static NSImage *classesImage = nil;
|
|||
GormClassManager *cm = [self classManager];
|
||||
NSCharacterSet *superClassStopSet = [NSCharacterSet characterSetWithCharactersInString: @" \n"];
|
||||
NSCharacterSet *commentStopSet = [NSCharacterSet characterSetWithCharactersInString: @"\n"];
|
||||
NSCharacterSet *classStopSet = [NSCharacterSet characterSetWithCharactersInString: @" :"];
|
||||
NSCharacterSet *classStopSet = [NSCharacterSet characterSetWithCharactersInString: @" :("];
|
||||
NSCharacterSet *typeStopSet = [NSCharacterSet characterSetWithCharactersInString: @" "];
|
||||
NSCharacterSet *actionStopSet = [NSCharacterSet characterSetWithCharactersInString: @";:"];
|
||||
NSCharacterSet *outletStopSet = [NSCharacterSet characterSetWithCharactersInString: @";,"];
|
||||
|
@ -787,11 +787,12 @@ static NSImage *classesImage = nil;
|
|||
while (![headerScanner isAtEnd])
|
||||
{
|
||||
NSString *classString = nil;
|
||||
BOOL classfound = NO, result = NO;
|
||||
BOOL classfound = NO, result = NO, category = NO;
|
||||
NSEnumerator *outletEnum = [outletTokens objectEnumerator];
|
||||
NSEnumerator *actionEnum = [actionTokens objectEnumerator];
|
||||
NSString *outletToken = nil;
|
||||
NSString *actionToken = nil;
|
||||
int alert;
|
||||
|
||||
classfound = [headerScanner scanUpToString: @"@interface"
|
||||
intoString: NULL];
|
||||
|
@ -831,51 +832,73 @@ static NSImage *classesImage = nil;
|
|||
NSDebugLog(@"Found a class \"%@\" with super class \"%@\"", className,
|
||||
superClassName);
|
||||
|
||||
// Interate over the possible tokens which can make an
|
||||
// ivar an outlet.
|
||||
while ((outletToken = [outletEnum nextObject]) != nil)
|
||||
category = (ivarString == nil);
|
||||
|
||||
// if its' not a category and it's known, ask before proceeding...
|
||||
if([cm isKnownClass: className] && !category)
|
||||
{
|
||||
NSString *delimiter = nil;
|
||||
NSDebugLog(@"outlet Token = %@", outletToken);
|
||||
// Scan the variables of the class...
|
||||
ivarScanner = [NSScanner scannerWithString: ivarString];
|
||||
while (![ivarScanner isAtEnd])
|
||||
NSString *message = [NSString stringWithFormat:
|
||||
_(@"The class %@ already exists. Replace it?"),
|
||||
className];
|
||||
alert = NSRunAlertPanel(_(@"Problem adding class from header"),
|
||||
message,
|
||||
_(@"Yes"),
|
||||
_(@"No"),
|
||||
nil);
|
||||
if (alert != NSAlertDefaultReturn)
|
||||
return self;
|
||||
}
|
||||
|
||||
// if it's not a category go through the ivars...
|
||||
if(!category)
|
||||
{
|
||||
NSDebugLog(@"Ivar string is not nil");
|
||||
// Interate over the possible tokens which can make an
|
||||
// ivar an outlet.
|
||||
while ((outletToken = [outletEnum nextObject]) != nil)
|
||||
{
|
||||
NSString *outlet = nil;
|
||||
NSString *type = nil;
|
||||
|
||||
if (delimiter == nil || [delimiter isEqualToString: @";"])
|
||||
NSString *delimiter = nil;
|
||||
NSDebugLog(@"outlet Token = %@", outletToken);
|
||||
// Scan the variables of the class...
|
||||
ivarScanner = [NSScanner scannerWithString: ivarString];
|
||||
while (![ivarScanner isAtEnd])
|
||||
{
|
||||
[ivarScanner scanUpToString: outletToken
|
||||
intoString: NULL];
|
||||
[ivarScanner scanString: outletToken
|
||||
intoString: NULL];
|
||||
}
|
||||
|
||||
// if using the IBOutlet token in the header, scan in the outlet type
|
||||
// as well.
|
||||
if([outletToken isEqualToString: @"IBOutlet"])
|
||||
{
|
||||
[ivarScanner scanUpToCharactersFromSet: typeStopSet
|
||||
intoString: NULL];
|
||||
[ivarScanner scanCharactersFromSet: typeStopSet
|
||||
intoString: NULL];
|
||||
[ivarScanner scanUpToCharactersFromSet: typeStopSet
|
||||
intoString: &type];
|
||||
NSDebugLog(@"outlet type = %@",type);
|
||||
}
|
||||
|
||||
[ivarScanner scanUpToCharactersFromSet: outletStopSet
|
||||
intoString: &outlet];
|
||||
[ivarScanner scanCharactersFromSet: outletStopSet
|
||||
intoString: &delimiter];
|
||||
if ([ivarScanner isAtEnd] == NO
|
||||
&& [outlets indexOfObject: outlet] == NSNotFound)
|
||||
{
|
||||
NSDebugLog(@"outlet = %@", outlet);
|
||||
if(NSEqualRanges([outlet rangeOfCharacterFromSet: illegalOutletSet],notFoundRange))
|
||||
NSString *outlet = nil;
|
||||
NSString *type = nil;
|
||||
|
||||
if (delimiter == nil || [delimiter isEqualToString: @";"])
|
||||
{
|
||||
[outlets addObject: outlet];
|
||||
[ivarScanner scanUpToString: outletToken
|
||||
intoString: NULL];
|
||||
[ivarScanner scanString: outletToken
|
||||
intoString: NULL];
|
||||
}
|
||||
|
||||
// if using the IBOutlet token in the header, scan in the outlet type
|
||||
// as well.
|
||||
if([outletToken isEqualToString: @"IBOutlet"])
|
||||
{
|
||||
[ivarScanner scanUpToCharactersFromSet: typeStopSet
|
||||
intoString: NULL];
|
||||
[ivarScanner scanCharactersFromSet: typeStopSet
|
||||
intoString: NULL];
|
||||
[ivarScanner scanUpToCharactersFromSet: typeStopSet
|
||||
intoString: &type];
|
||||
NSDebugLog(@"outlet type = %@",type);
|
||||
}
|
||||
|
||||
[ivarScanner scanUpToCharactersFromSet: outletStopSet
|
||||
intoString: &outlet];
|
||||
[ivarScanner scanCharactersFromSet: outletStopSet
|
||||
intoString: &delimiter];
|
||||
if ([ivarScanner isAtEnd] == NO
|
||||
&& [outlets indexOfObject: outlet] == NSNotFound)
|
||||
{
|
||||
NSDebugLog(@"outlet = %@", outlet);
|
||||
if(NSEqualRanges([outlet rangeOfCharacterFromSet: illegalOutletSet],notFoundRange))
|
||||
{
|
||||
[outlets addObject: outlet];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -933,52 +956,52 @@ static NSImage *classesImage = nil;
|
|||
} // end while
|
||||
} // end while
|
||||
|
||||
result = [cm addClassNamed: className
|
||||
withSuperClassNamed: superClassName
|
||||
withActions: actions
|
||||
withOutlets: outlets];
|
||||
if([cm isKnownClass: className] &&
|
||||
[cm isCustomClass: className] && category)
|
||||
{
|
||||
[cm addActions: actions forClassNamed: className];
|
||||
[cm addOutlets: actions forClassNamed: className];
|
||||
result = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [cm addClassNamed: className
|
||||
withSuperClassNamed: superClassName
|
||||
withActions: actions
|
||||
withOutlets: outlets];
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
NSDebugLog(@"Class %@ added", className);
|
||||
[classesView reloadData];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat:
|
||||
_(@"The class %@ already exists. Replace it?"), className];
|
||||
int alert = NSRunAlertPanel(_(@"Problem adding class from header"),
|
||||
message,
|
||||
_(@"Yes"),
|
||||
_(@"No"),
|
||||
nil);
|
||||
|
||||
if (alert == NSAlertDefaultReturn)
|
||||
{
|
||||
[cm removeClassNamed: className];
|
||||
result = [cm addClassNamed: className
|
||||
withSuperClassNamed: superClassName
|
||||
withActions: actions
|
||||
withOutlets: outlets];
|
||||
if (!result)
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat:
|
||||
_(@"Could not replace class %@."), className];
|
||||
NSRunAlertPanel(_(@"Problem adding class from header"),
|
||||
if (alert == NSAlertDefaultReturn)
|
||||
{
|
||||
[cm removeClassNamed: className];
|
||||
result = [cm addClassNamed: className
|
||||
withSuperClassNamed: superClassName
|
||||
withActions: actions
|
||||
withOutlets: outlets];
|
||||
if (!result)
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat:
|
||||
_(@"Could not replace class %@."), className];
|
||||
NSRunAlertPanel(_(@"Problem adding class from header"),
|
||||
message,
|
||||
nil,
|
||||
nil,
|
||||
nil);
|
||||
NSDebugLog(@"Class %@ failed to add", className);
|
||||
nil,
|
||||
nil,
|
||||
nil);
|
||||
NSDebugLog(@"Class %@ failed to add", className);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugLog(@"Class %@ replaced.", className);
|
||||
[classesView reloadData];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugLog(@"Class %@ replaced.", className);
|
||||
[classesView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
// go to the class which was just loaded in the classes view...
|
||||
|
@ -1806,7 +1829,7 @@ static NSImage *classesImage = nil;
|
|||
|
||||
while ((obj = [en nextObject]) != nil)
|
||||
{
|
||||
NSLog(@"Preloading %@", obj);
|
||||
NSDebugLog(@"Preloading %@", obj);
|
||||
[self parseHeader: (NSString *)obj];
|
||||
}
|
||||
}
|
||||
|
@ -2793,7 +2816,7 @@ static NSImage *classesImage = nil;
|
|||
}
|
||||
}
|
||||
|
||||
[self endArchiving];
|
||||
[self endArchiving];
|
||||
|
||||
if (archiveResult == NO)
|
||||
{
|
||||
|
|
|
@ -28,122 +28,6 @@
|
|||
#define _EO ((NSWindow *)_editedObject)
|
||||
#include "GormInternalViewEditor.h"
|
||||
|
||||
|
||||
// static NSRect
|
||||
// NSRectFromPoints(NSPoint p0, NSPoint p1)
|
||||
// {
|
||||
// NSRect r;
|
||||
|
||||
// if (p0.x < p1.x)
|
||||
// {
|
||||
// r.origin.x = p0.x;
|
||||
// r.size.width = p1.x - p0.x;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// r.origin.x = p1.x;
|
||||
// r.size.width = p0.x - p1.x;
|
||||
// }
|
||||
// if (p0.y < p1.y)
|
||||
// {
|
||||
// r.origin.y = p0.y;
|
||||
// r.size.height = p1.y - p0.y;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// r.origin.y = p1.y;
|
||||
// r.size.height = p0.y - p1.y;
|
||||
// }
|
||||
// return r;
|
||||
// }
|
||||
|
||||
// static NSPoint
|
||||
// _constrainPointToBounds(NSPoint point, NSRect bounds)
|
||||
// {
|
||||
// point.x = MAX(point.x, NSMinX(bounds));
|
||||
// point.x = MIN(point.x, NSMaxX(bounds));
|
||||
// point.y = MAX(point.y, NSMinY(bounds));
|
||||
// point.y = MIN(point.y, NSMaxY(bounds));
|
||||
// return point;
|
||||
// }
|
||||
|
||||
// @class GSTableCornerView;
|
||||
|
||||
// static NSView *bestKnownSuperview(NSView *aView, NSPoint loc)
|
||||
// {
|
||||
// NSView *best = aView;
|
||||
// NSView *view = aView;
|
||||
// NSLog(@"Convert %@", aView);
|
||||
|
||||
// if ([view isKindOfClass:[NSTableHeaderView class]])
|
||||
// {
|
||||
// NSPoint p = [view convertPoint: loc
|
||||
// fromView: nil];
|
||||
// int columnNumber = [(NSTableHeaderView*) view columnAtPoint: p];
|
||||
|
||||
// if (columnNumber == -1)
|
||||
// return nil;
|
||||
|
||||
// if ([(NSTableHeaderView*)view tableView] == nil)
|
||||
// return nil;
|
||||
|
||||
// return [[[(NSTableHeaderView*)view tableView] tableColumns]
|
||||
// objectAtIndex: columnNumber];
|
||||
// }
|
||||
// else if ([view isKindOfClass:[GSTableCornerView class]])
|
||||
// {
|
||||
// if ([view enclosingScrollView] != nil)
|
||||
// return [view enclosingScrollView];
|
||||
// }
|
||||
// else if ([view isKindOfClass:[NSScroller class]])
|
||||
// {
|
||||
// if ([view enclosingScrollView] != nil)
|
||||
// {
|
||||
// if ([[view enclosingScrollView] documentView]
|
||||
// && ([[[view enclosingScrollView] documentView]
|
||||
// isKindOfClass: [NSTableView class]]
|
||||
// || [[[view enclosingScrollView] documentView]
|
||||
// isKindOfClass: [NSTextView class]])
|
||||
// )
|
||||
// return [view enclosingScrollView];
|
||||
// }
|
||||
// }
|
||||
|
||||
// while( view )
|
||||
// {
|
||||
// if([view isKindOfClass:[NSBrowser class]]
|
||||
// || [view isKindOfClass:[NSTextView class]]
|
||||
// || [view isKindOfClass:[NSTableView class]])
|
||||
// {
|
||||
// best = view;
|
||||
// break;
|
||||
// }
|
||||
// else if([view isKindOfClass:[NSScrollView class]])
|
||||
// {
|
||||
// best = view;
|
||||
// }
|
||||
|
||||
// view = [view superview];
|
||||
// }
|
||||
|
||||
// if([best isKindOfClass:[NSScrollView class]])
|
||||
// {
|
||||
// view = [best contentView];
|
||||
// if([view isKindOfClass:[NSClipView class]])
|
||||
// {
|
||||
// view = [view documentView];
|
||||
|
||||
// if([view isKindOfClass:[NSTextView class]]
|
||||
// || [view isKindOfClass:[NSTableView class]])
|
||||
// {
|
||||
// return view;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return best;
|
||||
// }
|
||||
|
||||
@implementation NSWindow (GormObjectAdditions)
|
||||
- (NSString*) editorClassName
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue