Cleanup of warnings with gcc 3.4.x and some minor bug fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20357 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-11-18 05:34:19 +00:00
parent 37839119b2
commit c0e1de4049
22 changed files with 269 additions and 38 deletions

View file

@ -1,4 +1,37 @@
2004-11-17 12:59 Gregory John Casamento <greg_casamento@yahoo.com>
2004-11-18 00:23 Gregory John Casamento <greg_casamento@yahoo.com>
* GNUmakefile: Addition of entries for new
NSView+GormExtensions.[hm] files.
* NSView+GormExtensions.[hm]: Added to hold extensions for the
NSView class in Gorm.
* GModelDecoder.m: Changes to minimize warnings during compilation
with gcc 3.x.
* GormClassEditor.m: Same as above
* GormClassManager.m: Same as above
* GormDocument.m: Same as above + new code to eliminate orphaned
views in _repairFile.
* GormGenericEditor.m: Added copyright comment.
* GormInspectorsManager.h: Added copyright comment. Made
changes to minimize warnings.
* GormPrivate.h: Removed AppKit.h include and replaced it with
several specific includes to reduce compile issues. This was
causing a lot of warnings because of similar selectors.
* GormLib/IBEditors.h: removed circular referece to IBDocuments.h
* Palettes/3Containers/GormNSBrowser.h: Removed AppKit.h and
replaced it with a specific include.
* Palettes/3Containers/GormNSBrowser.m: Added specific includes
for classes used.
* Palettes/3Containers/GormNSOutlineView.m: Same as above.
* Palettes/3Containers/GormNSTableView.m: Same as above.
* Palettes/3Containers/inspectors.m: fix for method name
on GormClassManager which changed from setCustomClass:forObject: to
setCustomClass:forName:. Also, other changes which needed
to be made to minimize warnings.
* Palettes/3Containers/main.m: Removed overly general includes
and added specific includes for each class used. Made changes to
minimize warnings.
2004-11-17 00:59 Gregory John Casamento <greg_casamento@yahoo.com>
* GormViewEditor.m: initWithObject:withDocument: added code
to instantiated GormViewWindow if the view being added has no

View file

@ -339,7 +339,7 @@ static BOOL gormFileOwnerDecoded;
{
if([obj isKindOfClass: [NSDictionary class]])
{
NSString *objIsa = [obj objectForKey: @"isa"];
NSString *objIsa = [(NSMutableDictionary *)obj objectForKey: @"isa"];
Class cls = NSClassFromString(objIsa);
// NSLog(@"isa = %@",objIsa);
@ -355,7 +355,7 @@ static BOOL gormFileOwnerDecoded;
NSLog(@"%@ is not a known class",objIsa);
[self defineClass: objIsa inFile: path];
superClass = [classManager superClassNameForClassNamed: objIsa];
[obj setObject: superClass forKey: @"isa"];
[(NSMutableDictionary *)obj setObject: superClass forKey: @"isa"];
// guess at name which will be given in the nameTable...
/*
@ -566,9 +566,9 @@ static BOOL gormFileOwnerDecoded;
if([gormRealObject respondsToSelector: @selector(mainMenu)])
{
if ([gormRealObject mainMenu])
if ([(GModelApplication *)gormRealObject mainMenu])
{
[self attachObject: [gormRealObject mainMenu] toParent: nil];
[self attachObject: [(GModelApplication *)gormRealObject mainMenu] toParent: nil];
}
}
}

View file

@ -176,7 +176,8 @@ Gorm_HEADERS = \
GormPalettesPref.h \
GormSoundView.h \
GormFilePrefsManager.h \
GormClassPanelController.h
GormClassPanelController.h \
NSView+GormExtensions.h
Gorm_OBJC_FILES = \
main.m \
@ -225,7 +226,8 @@ Gorm_OBJC_FILES = \
GormPalettesPref.m \
GormSoundView.m \
GormFilePrefsManager.m \
GormClassPanelController.m
GormClassPanelController.m \
NSView+GormExtensions.m
-include GNUmakefile.preamble

View file

@ -57,7 +57,7 @@
[self setBackgroundColor: salmonColor ];
// add the table columns...
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"classes"];
tableColumn = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: @"classes"];
[[tableColumn headerCell] setStringValue: _(@"Classes")];
[tableColumn setMinWidth: 190];
[tableColumn setResizable: YES];
@ -66,7 +66,7 @@
[self setOutlineTableColumn: tableColumn];
RELEASE(tableColumn);
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"outlets"];
tableColumn = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: @"outlets"];
[[tableColumn headerCell] setStringValue: _(@"Outlet")];
[tableColumn setWidth: 50];
[tableColumn setResizable: NO];
@ -75,7 +75,7 @@
[self setOutletColumn: tableColumn];
RELEASE(tableColumn);
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"actions"];
tableColumn = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: @"actions"];
[[tableColumn headerCell] setStringValue: _(@"Action")];
[tableColumn setWidth: 50];
[tableColumn setResizable: NO];
@ -99,7 +99,7 @@
+ (GormClassEditor*) classEditorForDocument: (GormDocument*)doc
{
return AUTORELEASE([[self alloc] initWithDocument: doc]);
return AUTORELEASE([(GormClassEditor *)[self alloc] initWithDocument: doc]);
}
- (void) setSelectedClassName: (NSString*)cn

View file

@ -1279,8 +1279,8 @@
NSMutableDictionary *dict;
NSEnumerator *en;
id key;
int hash;
int hashDict;
// int hash;
// int hashDict;
NSDebugLog(@"Load custom classes from file %@",path);

View file

@ -37,7 +37,7 @@
#include <AppKit/NSNibConnector.h>
#include <AppKit/NSNibLoading.h>
#include <GNUstepGUI/GSNibTemplates.h>
#include "NSView+GormExtensions.h"
@interface GormDisplayCell : NSButtonCell
@end
@ -196,7 +196,7 @@ static NSImage *fileImage = nil;
// initialize...
openEditors = [NSMutableArray new];
classManager = [[GormClassManager alloc] initWithDocument: self];
classManager = [(GormClassManager *)[GormClassManager alloc] initWithDocument: self];
/*
* NB. We must retain the map values (object names) as the nameTable
@ -310,7 +310,7 @@ static NSImage *fileImage = nil;
[classesScrollView setBorderType: NSBezelBorder];
mainRect.origin = NSMakePoint(0,0);
classesView = [[GormClassEditor alloc] initWithDocument: self];
classesView = [(GormClassEditor *)[GormClassEditor alloc] initWithDocument: self];
[classesView setFrame: mainRect];
[classesScrollView setDocumentView: classesView];
RELEASE(classesView);
@ -370,7 +370,7 @@ static NSImage *fileImage = nil;
- (void) awakeFromNib
{
// set up the toolbar...
toolbar = [[NSToolbar alloc] initWithIdentifier: @"GormToolbar"];
toolbar = [(NSToolbar *)[NSToolbar alloc] initWithIdentifier: @"GormToolbar"];
[toolbar setAllowsUserCustomization: NO];
[toolbar setDelegate: self];
[window setToolbar: toolbar];
@ -1841,6 +1841,21 @@ static NSImage *fileImage = nil;
}
}
}
/**
* If it's a view and it does't have a window *AND* it's not a top level object
* then it's not a standalone view, it's an orphan. Delete it.
*/
if([obj isKindOfClass: [NSView class]])
{
if([obj window] == nil &&
[topLevelObjects containsObject: obj] == NO &&
[obj hasSuperviewKindOfClass: [NSTabView class]] == NO)
{
NSLog(@"Found and removed an orphan view %@, %@",obj,[self nameForObject: obj]);
[self detachObject: obj];
}
}
}
}

View file

@ -1,3 +1,28 @@
/* GormGenericEditor.m
*
* Copyright (C) 1999, 2003 Free Software Foundation, Inc.
*
* Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
* 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.
*/
#include "GormPrivate.h"
@implementation GormGenericEditor

View file

@ -1,6 +1,39 @@
/* GormInspectorsManager.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_GormInspectorsManager_h
#define INCLUDED_GormInspectorsManager_h
#include <Foundation/NSObject.h>
@class NSPanel;
@class NSMutableDictionary;
@class NSPopUpButton;
@class NSView;
@class IBInspector;
@interface GormInspectorsManager : NSObject
{
NSPanel *panel;

View file

@ -24,6 +24,7 @@
#include <AppKit/NSNibConnector.h>
#include <Foundation/NSException.h>
#include <InterfaceBuilder/IBInspector.h>
#include "GormPrivate.h"
#define HASFORMATTER(obj) \
@ -1192,7 +1193,7 @@ selectCellWithString: (NSString*)title
}
else
{
id active = [(id<IB>)NSApp activeDocument];
GormDocument *active = (GormDocument *)[(id<IB>)NSApp activeDocument];
id src = [currentConnector source];
id dest = [currentConnector destination];

View file

@ -26,7 +26,7 @@
#define INCLUDED_IBEDITORS_H
#include <Foundation/NSObject.h>
#include <InterfaceBuilder/IBDocuments.h>
// #include <InterfaceBuilder/IBDocuments.h>
// forward references
@class NSString;

View file

@ -30,7 +30,9 @@
@class GormInspectorsManager;
@class GormPalettesManager;
#include <InterfaceBuilder/InterfaceBuilder.h>
#include <InterfaceBuilder/IBApplicationAdditions.h>
#include <InterfaceBuilder/IBInspector.h>
#include <InterfaceBuilder/IBViewAdditions.h>
#include "GormFilesOwner.h"
#include "GormDocument.h"
#include "GormInspectorsManager.h"
@ -198,7 +200,7 @@ extern NSString *GormResizeCellNotification;
- (void) refreshCells;
- (void) removeObject: (id)anObject;
- (BOOL) activate;
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument;
- (id) initWithObject: (id)anObject inDocument: (id)aDocument;
- (void) close;
- (void) closeSubeditors;
- (BOOL) containsObject: (id)anObject;
@ -228,6 +230,7 @@ extern NSString *GormResizeCellNotification;
@interface GormObjectEditor : GormGenericEditor
{
}
+ (void) setEditor: (id)editor forDocument: (id<IBDocuments>)aDocument;
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
- (BOOL) acceptsTypeFromArray: (NSArray*)types;

37
NSView+GormExtensions.h Normal file
View file

@ -0,0 +1,37 @@
/* NSView+GormExtensions.h
*
* Copyright (C) 2004 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 2004
*
* 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_NSView_GormExtensions_h
#define INCLUDED_NSView_GormExtensions_h
#include <AppKit/NSView.h>
@class NSArray;
@interface NSView (GormExtensions)
- (NSArray *) superviews;
- (BOOL) hasSuperviewKindOfClass: (Class)cls;
@end
#endif

58
NSView+GormExtensions.m Normal file
View file

@ -0,0 +1,58 @@
/* NSView+GormExtensions.m
*
* Copyright (C) 2004 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 2004
*
* 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.
*/
#include <Foundation/NSArray.h>
#include <Foundation/NSEnumerator.h>
#include "NSView+GormExtensions.h"
@implementation NSView (GormExtensions)
- (NSArray *) superviews
{
NSMutableArray *result = [NSMutableArray array];
NSView *currentView = nil;
for(currentView = self; currentView != nil;
currentView = [currentView superview])
{
[result addObject: currentView];
}
return result;
}
- (BOOL) hasSuperviewKindOfClass: (Class)cls
{
NSEnumerator *en = [[self superviews] objectEnumerator];
NSView *v = nil;
BOOL result = NO;
while(((v = [en nextObject]) != nil) &&
result == NO)
{
result = [v isKindOfClass: cls];
}
return result;
}
@end

View file

@ -24,7 +24,7 @@
#ifndef INCLUDED_GormNSBrowser_h
#define INCLUDED_GormNSBrowser_h
#include <AppKit/AppKit.h>
#include <AppKit/NSBrowser.h>
@interface GormNSBrowser : NSBrowser
{

View file

@ -22,6 +22,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <Foundation/NSObject.h>
#include <Foundation/NSDebug.h>
#include <AppKit/NSBrowserCell.h>
#include "GormNSBrowser.h"
/* ---------------------------------------------------------------

View file

@ -24,7 +24,9 @@
#ifndef INCLUDED_GormNSOutlineView_h
#define INCLUDED_GormNSOutlineView_h
#include <AppKit/AppKit.h>
#include <Foundation/Foundation.h>
#include <AppKit/NSColor.h>
#include <AppKit/NSOutlineView.h>
@interface GormNSOutlineView : NSOutlineView
{

View file

@ -23,6 +23,7 @@
*/
#include "GormNSOutlineView.h"
#include <AppKit/NSTableColumn.h>
/* ---------------------------------------------------------------
* NSTableView dataSource

View file

@ -24,7 +24,9 @@
#ifndef INCLUDED_GormNSTableView_h
#define INCLUDED_GormNSTableView_h
#include <AppKit/AppKit.h>
#include <Foundation/Foundation.h>
#include <AppKit/NSColor.h>
#include <AppKit/NSTableView.h>
@interface GormNSTableView : NSTableView
{

View file

@ -22,6 +22,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <Foundation/NSObject.h>
#include <AppKit/NSTableColumn.h>
#include "GormNSTableView.h"
/* ---------------------------------------------------------------

View file

@ -24,8 +24,9 @@
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>
#include <AppKit/NSTableColumn.h>
#include <AppKit/NSBrowser.h>
#include <InterfaceBuilder/IBInspector.h>
#include "GormNSTableView.h"
#include "GormPrivate.h"
@ -288,7 +289,7 @@
break;
}
[identifierTextField setStringValue: [anObject identifier]];
[identifierTextField setStringValue: [(NSTableColumn *)anObject identifier]];
if ([anObject isResizable])
[resizableSwitch setState: NSOnState];
@ -392,7 +393,7 @@
[doc attachObject: cell toParent: object];
if((name = [doc nameForObject: cell]) != nil)
{
[classManager setCustomClass: className forObject: name];
[classManager setCustomClass: className forName: name];
}
}
@ -589,7 +590,7 @@ shouldEditTableColumn: (NSTableColumn *)aTableColumn
for(i = 0; i < colsToAdd; i++)
{
NSString *identifier = [NSString stringWithFormat: @"column%d",(numCols + i + 1)];
NSTableColumn *tc = AUTORELEASE([[NSTableColumn alloc] initWithIdentifier: identifier]);
NSTableColumn *tc = AUTORELEASE([(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: (id)identifier]);
[tc setWidth: 50];
[tc setMinWidth: 20];
[tc setResizable: YES];
@ -793,7 +794,7 @@ static NSString *ITEM=@"item";
for (i=([object numberOfTabViewItems]+1);i<=newNumber;i++)
{
NSString *identif = [NSString stringWithFormat:@"%i",i];
newTabItem = [[NSTabViewItem alloc] initWithIdentifier:identif];
newTabItem = [(NSTabViewItem *)[NSTabViewItem alloc] initWithIdentifier: (id)identif];
[newTabItem setLabel:[ITEM stringByAppendingString:identif]];
[newTabItem setView:[[NSView alloc] init]];
[object addTabViewItem:newTabItem];

View file

@ -22,7 +22,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include <AppKit/NSTableColumn.h>
#include <AppKit/NSTabView.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSTabViewItem.h>
#include <AppKit/NSScrollView.h>
#include <InterfaceBuilder/InterfaceBuilder.h>
#include "GormNSBrowser.h"
#include "GormNSTableView.h"

View file

@ -23,8 +23,18 @@
*/
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>
#include <Foundation/NSFormatter.h>
#include <Foundation/NSNumberFormatter.h>
#include <AppKit/NSComboBox.h>
#include <AppKit/NSScrollView.h>
#include <AppKit/NSImage.h>
#include <AppKit/NSImageView.h>
#include <AppKit/NSTextContainer.h>
#include <AppKit/NSTextView.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSClipView.h>
#include <InterfaceBuilder/IBPalette.h>
#include "GormPrivate.h"
/* -----------------------------------------------------------
* Some additions to the NSNumberFormatter Class specific to Gorm
@ -215,12 +225,12 @@ int defaultDateFormatIndex = 3;
[v setHasVerticalScroller: YES];
[v setHasHorizontalScroller: NO];
[v setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
[[v contentView] setAutoresizingMask: NSViewHeightSizable
[[(NSScrollView *)v contentView] setAutoresizingMask: NSViewHeightSizable
| NSViewWidthSizable];
[[v contentView] setAutoresizesSubviews:YES];
[[(NSScrollView *)v contentView] setAutoresizesSubviews:YES];
[v setBorderType: NSBezelBorder];
rect = [[v contentView] frame];
rect = [[(NSScrollView *)v contentView] frame];
tv = [[NSTextView alloc] initWithFrame: rect];
[tv setMinSize: NSMakeSize(0.0, 0.0)];
@ -233,8 +243,7 @@ int defaultDateFormatIndex = 3;
[tv setRichText: YES];
[tv setImportsGraphics: YES];
[[tv textContainer] setContainerSize:NSMakeSize(rect.size.width,
1e7)];
[[tv textContainer] setContainerSize:NSMakeSize(rect.size.width,1e7)];
[[tv textContainer] setWidthTracksTextView:YES];
[v setDocumentView:tv];