Added categories for old templates for compatiblity. Also removed some commented code.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17978 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-10-25 20:56:14 +00:00
parent d8c22f676a
commit eb6f3a012b
4 changed files with 82 additions and 189 deletions

View file

@ -1,3 +1,10 @@
2003-10-25 17:00 Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: Added categories for the old templates to allow them
to be loaded. The old templates are for backwards compatibility
only and will be removed in future versions of both GNUstep and
Gorm.
2003-10-19 23:12 Gregory John Casamento <greg_casamento@yahoo.com>
* GormOutlineView.m: Corrected issue in addAttributeToClass which

76
Gorm.m
View file

@ -27,6 +27,7 @@
#include "GormPrefController.h"
#include "GormFontViewController.h"
#include "GormSetNameController.h"
#include "GNUstepGUI/GSNibCompatibility.h"
// for templates...
#include <AppKit/NSControl.h>
@ -277,7 +278,7 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF
RELEASE(palettesManager);
RELEASE(documents);
RELEASE(classManager);
// [super dealloc];
[super dealloc];
}
@ -518,9 +519,9 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF
forKey: @"ApplicationName"];
[dict setObject: @"[GNUstep | Graphical] Object Relationship Modeller"
forKey: @"ApplicationDescription"];
[dict setObject: @"Gorm 0.4.5 (Beta)"
[dict setObject: @"Gorm 0.4.6 (Beta)"
forKey: @"ApplicationRelease"];
[dict setObject: @"0.4.5 Oct 19 2003"
[dict setObject: @"0.4.6 Oct 25 2003"
forKey: @"FullVersionID"];
[dict setObject: [NSArray arrayWithObjects: @"Gregory John Casamento <greg_casamento@yahoo.com>",
@"Richard Frith-Macdonald <rfm@gnu.org>",
@ -1328,11 +1329,13 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF
}
@end
// temporary until the deprecated template is removed...
// these are temporary until the deprecated templates are removed...
////////////////////////////////////////////////////////
// DEPRECATED TEMPLATES //
////////////////////////////////////////////////////////
@interface NSWindowTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder;
@end
@implementation NSWindowTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder
{
@ -1340,6 +1343,69 @@ NSString *GormWillDetachObjectFromDocumentNotification = @"GormWillDetachObjectF
}
@end
@interface NSViewTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder;
@end
@implementation NSViewTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder
{
return YES;
}
@end
@interface NSTextTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder;
@end
@implementation NSTextTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder
{
return YES;
}
@end
@interface NSTextViewTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder;
@end
@implementation NSTextViewTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder
{
return YES;
}
@end
@interface NSMenuTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder;
@end
@implementation NSMenuTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder
{
return YES;
}
@end
@interface NSControlTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder;
@end
@implementation NSControlTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder
{
return YES;
}
@end
@interface NSButtonTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder;
@end
@implementation NSButtonTemplate (GormCustomClassAdditions)
- (BOOL) isInInterfaceBuilder
{
return YES;
}
@end
////////////////////////////////////////////////////////
// END OF DEPRECATED TEMPLATES //
////////////////////////////////////////////////////////
// main...
int
main(int argc, const char **argv)

View file

@ -56,10 +56,6 @@
BOOL flippedView = [controlView isFlipped];
NSCellImagePosition ipos = _cell.image_position;
// // transparent buttons never draw
// if (_buttoncell_is_transparent)
// return;
cellFrame = [self drawingRectForBounds: cellFrame];
if (_cell.is_highlighted)
@ -244,7 +240,6 @@
titleRect.origin.x += 3;
imageRect.size.height -= 1;
titleRect.size.height -= 1;
// titleRect.origin.y += 1;
}
break;
@ -274,7 +269,6 @@
titleRect.origin.x += 3;
imageRect.size.height -= 1;
imageRect.origin.y += 1;
// titleRect.size.height -= 1;
}
break;
@ -286,7 +280,6 @@
titleRect.origin.y += heightDiff - heightDiff / 2;
titleRect.size.height -= heightDiff;
}
// TODO: Add distance from border if needed
break;
}
@ -363,8 +356,6 @@ static NSRect oldFrame;
didDrawBackground = [editField drawsBackground];
[editField setDrawsBackground: YES];
// [editField display];
[nc addObserver: self
selector: @selector(handleNotification:)
name: NSControlTextDidEndEditingNotification
@ -407,36 +398,9 @@ static NSRect oldFrame;
break;
case NSKeyDown:
[[editField currentEditor] keyDown: e];
// {
// NSSize suggestedSize;
// suggestedSize = [[(NSTextView *)[editField currentEditor] textStorage] size];
// if (suggestedSize.width > originalFrame.size.width)
// {
// frame.origin.x = originalFrame.origin.x
// - (int)((suggestedSize.width - originalFrame.size.width) / 2);
// frame.size.width = suggestedSize.width;
// [editField setFrame: frame];
// [[(NSTextView*)[editField currentEditor]
// layoutManager] invalidateLayoutForCharacterRange: NSMakeRange(0, [[[editField currentEditor] string] length])
// isSoft: NO
// actualCharacterRange: NULL];
// NSLog(@"%@ %@ %@",
// NSStringFromRect([[editField currentEditor] frame]),
// NSStringFromRect(frame),
// [[editField currentEditor] string]);
// [[self window] disableFlushWindow];
// [[self window] display];
// // [[editField currentEditor]
// // setString: [editField stringValue]];
// [editField display];
// [[self window] enableFlushWindow];
// [[self window] flushWindow];
// }
// }
break;
case NSKeyUp:
[[editField currentEditor] keyUp: e];
[[editField currentEditor] keyUp: e];
break;
case NSFlagsChanged:
[[editField currentEditor] flagsChanged: e];
@ -511,60 +475,20 @@ static NSRect oldFrame;
}
[/*[[self window] contentView]*/[self superview] setNeedsDisplayInRect: oldFrame];
[[self superview] setNeedsDisplayInRect: oldFrame];
inside = NO;
}
- (void) mouseDown: (NSEvent*)theEvent
{
if (([theEvent clickCount] == 2) && [parent isOpened])
// double-clicked -> let's edit
if (([theEvent clickCount] == 2) && [parent isOpened])
{
// NSTextField *tf =
// [[NSTextField alloc] initWithFrame: [self bounds]];
// NSRect frame = [[_EO cell]
// gormTitleRectForFrame: [_EO frame]
// inView: _EO];
// frame.origin.y -= 2;
// frame.size.height += 4;
// [tf setFrame: frame];
// [tf setEditable: YES];
// [tf setBezeled: NO];
// [tf setBordered: YES];
// [tf setAlignment: [_EO alignment]];
// [tf setFont: [_EO font]];
// [[[self window] contentView] addSubview: tf];
// [tf setStringValue: [_EO stringValue]];
// [self editTextField: tf
// withEvent: theEvent];
// [_EO setStringValue: [tf stringValue]];
// {
// NSSize suggestedSize;
// NSRect newFrame = [_EO frame];
// suggestedSize = [[_EO cell] cellSize];
// if (suggestedSize.width > newFrame.size.width)
// {
// newFrame.origin.x = newFrame.origin.x
// - (int)((suggestedSize.width - newFrame.size.width) / 2);
// newFrame.size.width = suggestedSize.width;
// [_EO setFrame: newFrame];
// [[self window] disableFlushWindow];
// [[self window] display];
// [[self window] enableFlushWindow];
// }
// }
// [tf removeFromSuperview];
// RELEASE(tf);
// [[NSNotificationCenter defaultCenter]
// postNotificationName: IBSelectionChangedNotification
// object: parent];
NSRect frame = [[_EO cell]
gormTitleRectForFrame: [_EO frame]
inView: _EO];
// frame.origin.y -= 2;
// frame.size.height = 2;
NSTextView *tv = [self startEditingInFrame: frame];
[/*[[self window] contentView]*/[self superview] addSubview: tv];
[[self superview] addSubview: tv];
[tv setText: [_EO stringValue]];
[tv setAlignment: [_EO alignment]];
[tv setFont: [_EO font]];

View file

@ -1129,110 +1129,6 @@ static BOOL currently_displaying = NO;
return gpi->hintFrame;
}
// - (void) displayHintForFrame: (NSRect) frame
// withEvent: (NSEvent *)theEvent
// andKnob: (IBKnobPosition) knob
// {
// static NSView *superview;
// static NSArray *subviews;
// static int count;
// static NSRect bounds;
// NSMutableArray *oldMagnetizedTo;
// NSMutableArray *attractness0 = [[NSMutableArray alloc] initWithCapacity: 4];
// NSMutableArray *attractness1 = [[NSMutableArray alloc] initWithCapacity: 4];
// NSMutableArray *attractness2 = [[NSMutableArray alloc] initWithCapacity: 4];
// int i;
// NSRect svFrame;
// if (displayingHints == NO)
// {
// superview = [self superview];
// subviews = [superview subviews];
// count = [subviews count];
// displayingHints = NO;
// bounds = [superview bounds];
// displayingHints = YES;
// magnetizedTo = [[NSMutableArray alloc] initWithCapacity: 4];
// }
// // for (i = 0; i < count; i ++ )
// // {
// // svFrame = [[subviews objectAtIndex: i] frame];
// // }
// oldMagnetizedTo = magnetizedTo;
// if (knob == IBTopMiddleKnobPosition)
// {
// for ( i = 0; i < count; i++ )
// {
// NSView *v = [subviews objectAtIndex: i];
// NSRect vframe = [v frame];
// switch(ATTRACTNESS12(NSMaxY(frame), NSMinY(vframe), NSMaxY(vframe)))
// {
// case 0:
// [attractness0 addObject: v];
// break;
// case 1:
// [attractness1 addObject: v];
// break;
// case 2:
// [attractness2 addObject: v];
// break;
// }
// }
// }
// if ([attractness0 count] != 0)
// magnetizedTo = RETAIN(attractness0);
// else if ([attractness1 count] != 0)
// magnetizedTo = RETAIN(attractness1);
// else if ([attractness2 count] != 0)
// magnetizedTo = RETAIN(attractness2);
// else
// magnetizedTo = [[NSMutableArray alloc] initWithCapacity: 4];
// RELEASE(attractness0);
// RELEASE(attractness1);
// RELEASE(attractness2);
// // NSLog(@"attractedTo (%@)", magnetizedTo);
// return;
// for (i = 0; i < [oldMagnetizedTo count]; i++)
// {
// if ([magnetizedTo containsObject:
// [oldMagnetizedTo objectAtIndex: i]] == NO)
// {
// [superview setNeedsDisplayInRect:
// NSMakeRect(bounds.origin.x, NSMaxY(bounds) - 6,
// bounds.size.width, 3)];
// }
// }
// for (i = 0; i < [magnetizedTo count]; i++)
// {
// [[NSColor blueColor] set];
// NSRectFill(NSMakeRect(bounds.origin.x, NSMaxY(bounds) - 6,
// bounds.size.width, 3));
// }
// }
// - (void) stopDisplayingHints
// {
// if (displayingHints)
// {
// RELEASE(magnetizedTo);
// [[self superview] setNeedsDisplay: YES];
// }
// displayingHints = NO;
// }
- (NSView *)hitTest: (NSPoint)loc
{
id result;