diff --git a/ChangeLog b/ChangeLog index d7ae3321..8f6ccf70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-06-20 19:32 Gregory John Casamento + + * GNUmakefile.preamble: Add -lGL to ADDITIONAL_LIBS + * GormCore/GNUmakefile: Added new opengl view. + * GormCore/GormCustomView.m: Added include for GormOpenGLView and + modified _bestPossibleSuperClass to return the GormOpenGLView. + * GormCore/GormOpenGLView.[hm]: Displays a rotating polygon to + illustrate that this is a OpenGL view to the user when in test mode. + * GormCore/GormViewWithSubviewsEditor.m: Corrected includes. + * Gorm.m: Corrected a memory leak in testInterface and endTesting. + 2005-06-17 17:33 Gregory John Casamento * Palettes/0Menus/GormNSMenu.m: Code cleanup. diff --git a/GNUmakefile.preamble b/GNUmakefile.preamble index 9f6674a2..d70573bf 100644 --- a/GNUmakefile.preamble +++ b/GNUmakefile.preamble @@ -28,7 +28,8 @@ ADDITIONAL_GUI_LIBS += \ -lGormCore \ -lGorm \ -lGormObjCHeaderParser \ - -lGormPrefs + -lGormPrefs \ + -lGL ADDITIONAL_INCLUDE_DIRS += \ -IInterfaceBuilder \ diff --git a/Gorm.m b/Gorm.m index ba8135d9..7d359381 100644 --- a/Gorm.m +++ b/Gorm.m @@ -45,8 +45,8 @@ BOOL isTesting; id testContainer; id gormMenu; - NSMenu *mainMenu; // saves the main menu when testing... - NSMenu *servicesMenu; // saves the services menu when testing... + NSMenu *mainMenu; // saves the main menu... + NSMenu *servicesMenu; // saves the services menu... NSMenu *classMenu; // so we can set it for the class view NSMenuItem *guideLineMenuItem; NSDictionary *menuLocations; @@ -63,6 +63,7 @@ NSRect connectDRect; NSPoint cascadePoint; NSMutableArray *testingWindows; + NSMutableArray *topObjects; } // handle notifications the object recieves. @@ -550,6 +551,9 @@ } else { + // top level objects + topObjects = [[NSMutableArray alloc] init]; + NS_DURING { NSUserDefaults *defaults; @@ -561,7 +565,9 @@ NSDictionary *substituteClasses = [palettesManager substituteClasses]; NSString *subClassName; id obj; - + NSDictionary *context = [NSDictionary dictionaryWithObject: topObjects + forKey: @"NSTopLevelObjects"]; + // which windows were open when testing started... testingWindows = [[NSMutableArray alloc] init]; en = [[self windows] objectEnumerator]; @@ -573,26 +579,15 @@ } } - isTesting = YES; // set here, so that beginArchiving and endArchiving do not use templates. + // set here, so that beginArchiving and endArchiving do not use templates. + isTesting = YES; [self setApplicationIconImage: testingImage]; archiver = [[NSArchiver alloc] init]; [activeDoc beginArchiving]; [archiver encodeClassName: @"GormCustomView" intoClassName: @"GormTestCustomView"]; - - /* - [archiver encodeClassName: @"GormNSMenu" - intoClassName: @"NSMenu"]; - [archiver encodeClassName: @"GormNSWindow" - intoClassName: @"NSWindow"]; - [archiver encodeClassName: @"GormNSPanel" - intoClassName: @"NSPanel"]; - [archiver encodeClassName: @"GormNSPopUpButton" - intoClassName: @"NSPopUpButton"]; - [archiver encodeClassName: @"GormNSPopUpButtonCell" - intoClassName: @"NSPopUpButtonCell"]; - */ + // substitute classes from palettes. en = [substituteClasses keyEnumerator]; while((subClassName = [en nextObject]) != nil) { @@ -601,22 +596,15 @@ intoClassName: realClassName]; } - /* - [archiver encodeClassName: @"GormNSBrowser" - intoClassName: @"NSBrowser"]; - [archiver encodeClassName: @"GormNSTableView" - intoClassName: @"NSTableView"]; - [archiver encodeClassName: @"GormNSOutlineView" - intoClassName: @"NSOutlineView"]; - */ - - [GSClassSwapper setIsInInterfaceBuilder: YES]; // do not allow custom classes during testing. + // do not allow custom classes during testing. + [GSClassSwapper setIsInInterfaceBuilder: YES]; [archiver encodeRootObject: activeDoc]; data = RETAIN([archiver archiverData]); // Released below... [activeDoc endArchiving]; RELEASE(archiver); - [GSClassSwapper setIsInInterfaceBuilder: NO]; // begin allowing custom classes... + [GSClassSwapper setIsInInterfaceBuilder: NO]; + // signal the start of testing... [notifCenter postNotificationName: IBWillBeginTestingInterfaceNotification object: self]; @@ -636,8 +624,7 @@ NSMutableDictionary *nameTable = [testContainer nameTable]; [nameTable removeObjectForKey: @"NSServicesMenu"]; [nameTable removeObjectForKey: @"NSWindowsMenu"]; - [testContainer awakeWithContext: nil]; - RETAIN(testContainer); // released in endTesting: + [testContainer awakeWithContext: context]; } /* @@ -678,10 +665,7 @@ // so we don't get the warning... [self setServicesMenu: nil]; - - // display the current main menu... [[self mainMenu] display]; - [notifCenter postNotificationName: IBDidBeginTestingInterfaceNotification object: self]; @@ -936,15 +920,14 @@ NSEnumerator *e; id val; - CREATE_AUTORELEASE_POOL(pool); - + // CREATE_AUTORELEASE_POOL(pool); [nc postNotificationName: IBWillEndTestingInterfaceNotification object: self]; /* * Make sure windows will go away when the container is destroyed. */ - e = [[testContainer nameTable] objectEnumerator]; + e = [topObjects objectEnumerator]; while ((val = [e nextObject]) != nil) { if ([val isKindOfClass: [NSWindow class]] == YES) @@ -990,7 +973,6 @@ NS_ENDHANDLER [mainMenu display]; // bring it to the front... - isTesting = NO; if ([selectionOwner conformsToProtocol: @protocol(IBEditors)] == YES) @@ -1002,8 +984,10 @@ DESTROY(testingWindows); + // RELEASE(pool); - RELEASE(pool); + // deallocate top leve objects + RELEASE(topObjects); return self; } diff --git a/GormCore/GNUmakefile b/GormCore/GNUmakefile index ba3ce53c..36cc7cfd 100644 --- a/GormCore/GNUmakefile +++ b/GormCore/GNUmakefile @@ -59,6 +59,8 @@ GormCore_HEADER_FILES = \ GormInternalViewEditor.h \ GormMatrixEditor.h \ GormNSSplitViewInspector.h \ + GormObjectEditor.h \ + GormOpenGLView.h \ GormOutlineView.h \ GormPalettesManager.h \ GormPlacementInfo.h \ @@ -109,6 +111,7 @@ GormCore_OBJC_FILES = \ GormNSSplitViewInspector.m \ GormObjectEditor.m \ GormObjectInspector.m \ + GormOpenGLView.m \ GormOutlineView.m \ GormPalettesManager.m \ GormResource.m \ diff --git a/GormCore/GormCustomView.m b/GormCore/GormCustomView.m index 0f424634..b2c771c5 100644 --- a/GormCore/GormCustomView.m +++ b/GormCore/GormCustomView.m @@ -22,14 +22,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. */ -#include "GormCustomView.h" +#include +#include +#include + #include #include #include - #include + #include -#include "GormPrivate.h" @class GSCustomView; @@ -132,7 +134,12 @@ Class cls = [NSView class]; GormClassManager *classManager = [(id)NSApp classManager]; - if([classManager isSuperclass: @"NSView" linkedToClass: theClass]) + if([classManager isSuperclass: @"NSOpenGLView" linkedToClass: theClass] || + [theClass isEqual: @"NSOpenGLView"]) + { + cls = [GormOpenGLView class]; + } + else if([classManager isSuperclass: @"NSView" linkedToClass: theClass]) { NSString *superClass = [classManager nonCustomSuperClassOf: theClass]; @@ -155,6 +162,7 @@ id obj; Class cls; unsigned int mask; + GormClassManager *classManager = [(id)NSApp classManager]; [aCoder decodeValueOfObjCType: @encode(id) at: &theClass]; theFrame = [aCoder decodeRect]; @@ -162,7 +170,8 @@ at: &mask]; cls = NSClassFromString(theClass); - if (cls == nil) + if([classManager isSuperclass: @"NSOpenGLView" linkedToClass: theClass] || + [theClass isEqual: @"NSOpenGLView"] || cls == nil) { cls = [self _bestPossibleSuperClass]; } @@ -178,12 +187,13 @@ [obj setAutoresizingMask: mask]; } - + /* if (![self isKindOfClass: [GSCustomView class]]) { RETAIN(obj); } - + */ + RELEASE(self); return obj; } diff --git a/GormCore/GormOpenGLView.h b/GormCore/GormOpenGLView.h new file mode 100644 index 00000000..771dfa32 --- /dev/null +++ b/GormCore/GormOpenGLView.h @@ -0,0 +1,40 @@ +/* GormOpenGLView.h - Demo view for show when displaying a NSOpenGLView during + * testing only. + * + * Copyright (C) 2005 Free Software Foundation, Inc. + * + * Author: Gregory John Casamento + * Date: 2005 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + */ + +#ifndef INCLUDED_GormOpenGLView_h +#define INCLUDED_GormOpenGLView_h + +#include + +@class NSTimer; + +@interface GormOpenGLView : NSOpenGLView +{ + float rtri; + NSTimer *timer; +} +@end + +#endif diff --git a/GormCore/GormOpenGLView.m b/GormCore/GormOpenGLView.m new file mode 100644 index 00000000..2a3854be --- /dev/null +++ b/GormCore/GormOpenGLView.m @@ -0,0 +1,67 @@ +/* GormOpenGLView.h - Demo view for show when displaying a NSOpenGLView during + * testing only. + * + * Copyright (C) 2005 Free Software Foundation, Inc. + * + * Author: Gregory John Casamento + * Date: 2005 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + */ + +#include +#include +#include +#include + +@implementation GormOpenGLView +- (id) initWithFrame: (NSRect)rect +{ + if((self = [super initWithFrame: rect]) != nil) + { + rtri = 0.0f; + timer = [NSTimer scheduledTimerWithTimeInterval: 0.05 + target: self + selector: @selector(oneStep) + userInfo: nil + repeats: YES]; + } + return self; +} + +- (void) dealloc +{ + [timer invalidate]; + [super dealloc]; +} + +- (void) oneStep +{ + // rotate. + // rtri -= 0.2f; + rtri = 0.5f; // fabs( sin( 2.0 * M_PI * [startTime timeIntervalSinceNow] ) ) ; + + [self setNeedsDisplay: YES]; +} + +- (void) drawRect: (NSRect)rect +{ + // do nothing for now... +} + +@end + diff --git a/GormCore/GormViewWithSubviewsEditor.m b/GormCore/GormViewWithSubviewsEditor.m index 50c97b7b..98f631f0 100644 --- a/GormCore/GormViewWithSubviewsEditor.m +++ b/GormCore/GormViewWithSubviewsEditor.m @@ -24,11 +24,9 @@ #include -#include "GormPrivate.h" - -#include "GormViewWithSubviewsEditor.h" - -#include "GormFontViewController.h" +#include +#include +#include @class GormEditorToParent;