Changes to make class editor more self sufficient. Some minor refactoring.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20421 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-12-05 20:52:36 +00:00
parent b53a7e50eb
commit 0778f595b4
21 changed files with 554 additions and 445 deletions

View file

@ -1,3 +1,25 @@
2004-12-05 15:40 Gregory John Casamento <greg_casamento@yahoo.com>
* GNUmakefile: Added new classes to the makefile.
* GormClassEditor.m: Moved some methods from GormDocument to here.
* GormDocument.[hm]: Changes for new GormSound/GormImage methods.
Also modifications for changes in GormClassEditor.
* GormImage.[hm]: New files.
* GormImageEditor.m: Added imageForPath: call.
* GormImageInspector.m: Added imageForPath: call.
* GormInspectorsManager.m: Added GormImage/GormSound include
* GormPrivate.h: Added incudes
* GormSound.[hm]: New files.
* GormSoundEditor.m: Added includes and soundForPath call.
* GormSoundInspector.m: Added includes and soundForPath call.
* Palettes/0Menus/GormMenuAttributesInspector.gorm: Made correction
to allow "Title" field to resize properly.
* Palettes/3Containers/GormNSTableViewInspector.gorm: Corrected
a slight problem with one of the boxes cutting off text on the
bottom.
* Resources/GormClassInspector.gorm: Made outlets table resize
properly
2004-12-05 07:48 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCustomClassInspector.m: Set the max visible columns to 1 in

View file

@ -178,7 +178,9 @@ Gorm_HEADERS = \
GormSoundView.h \
GormFilePrefsManager.h \
GormClassPanelController.h \
NSView+GormExtensions.h
NSView+GormExtensions.h \
GormSound.h \
GormImage.h
Gorm_OBJC_FILES = \
main.m \
@ -228,7 +230,9 @@ Gorm_OBJC_FILES = \
GormSoundView.m \
GormFilePrefsManager.m \
GormClassPanelController.m \
NSView+GormExtensions.m
NSView+GormExtensions.m \
GormSound.m \
GormImage.m
-include GNUmakefile.preamble

View file

@ -42,8 +42,9 @@
NSTableColumn *tableColumn;
document = doc; // loose connection
[self setDataSource: document];
[self setDelegate: document];
classManager = [doc classManager];
[self setDataSource: self];
[self setDelegate: self];
[self setAutoresizesAllColumnsToFit: YES];
[self setAllowsColumnResizing: NO];
[self setDrawsGrid: NO];
@ -90,13 +91,6 @@
return self;
}
- (void) dealloc
{
RELEASE(selectedClassName);
[super dealloc];
}
+ (GormClassEditor*) classEditorForDocument: (GormDocument*)doc
{
return AUTORELEASE([(GormClassEditor *)[self alloc] initWithDocument: doc]);
@ -104,17 +98,32 @@
- (void) setSelectedClassName: (NSString*)cn
{
ASSIGN(selectedClassName, cn);
[self selectClass: cn];
}
- (NSString *)selectedClassName
{
int row = [self selectedRow];
id className = [self itemAtRow: row];
if ([className isKindOfClass: [GormOutletActionHolder class]])
{
className = [self itemBeingEdited];
}
return className;
}
//--- IBSelectionOwners protocol ---
- (unsigned) selectionCount
{
return (selectedClassName == nil)?0: 1;
return ([self selectedRow] == -1)?0:1;
}
- (NSArray*) selection
{
NSString *selectedClassName = [self selectedClassName];
// when asked for a selection, it returns a class proxy
if (selectedClassName != nil)
{
@ -135,20 +144,102 @@
- (void) drawSelection
{
}
- (void) makeSelectionVisible: (BOOL)flag
{
}
// class selection...
- (void) selectClass: (NSString *)className
{
NSString *currentClass = nil;
NSArray *classes;
NSEnumerator *en;
int row = 0;
if(className != nil)
{
if([className isEqual: @"CustomView"] ||
[className isEqual: @"GormSound"] ||
[className isEqual: @"GormImage"])
{
return; // return only if it is a special class name...
}
}
else
{
return; // return if it is nil
}
classes = [classManager allSuperClassesOf: className];
en = [classes objectEnumerator];
// open the items...
while ((currentClass = [en nextObject]) != nil)
{
[self expandItem: currentClass];
}
// select the item...
row = [self rowForItem: className];
if (row != NSNotFound)
{
[self selectRow: row byExtendingSelection: NO];
[self scrollRowToVisible: row];
}
// set the editor...
[document setSelectionFromEditor: (id)self];
}
- (void) selectClassWithObject: (id)obj
{
NSString *customClass = [classManager customClassForObject: obj];
if(customClass != nil)
{
[self selectClass: customClass];
}
else if ([obj respondsToSelector: @selector(className)])
{
[self selectClass: [obj className]];
}
}
- (void) selectObjects: (NSArray*)objects
{
id obj = [objects objectAtIndex: 0];
[self selectClassWithObject: obj];
}
- (BOOL) currentSelectionIsClass
{
int i = [self selectedRow];
BOOL result = NO;
if (i >= 0 && i <= ([self numberOfRows] - 1))
{
id object = [self itemAtRow: i];
if([object isKindOfClass: [NSString class]])
{
result = YES;
}
}
return result;
}
- (void) editClass: (id)sender
{
int row = [self selectedRow];
if (row >= 0)
{
[document setSelectionFromEditor: (id)self];
}
}
@end
@implementation GormDocument (NSOutlineViewDataSource)
@implementation GormClassEditor (NSOutlineViewDataSource)
// --- NSOutlineView dataSource ---
- (id) outlineView: (NSOutlineView *)anOutlineView
@ -202,7 +293,7 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
{
BOOL removed;
removed = [self removeConnectionsWithLabel: name
removed = [document removeConnectionsWithLabel: name
forClassNamed: [gov itemBeingEdited] isAction: YES];
if (removed)
{
@ -234,8 +325,9 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
{
BOOL removed;
removed = [self removeConnectionsWithLabel: name
forClassNamed: [gov itemBeingEdited] isAction: NO];
removed = [document removeConnectionsWithLabel: name
forClassNamed: [gov itemBeingEdited]
isAction: NO];
if (removed)
{
[classManager replaceOutlet: name
@ -264,7 +356,7 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
{
BOOL rename;
rename = [self renameConnectionsForClassNamed: item toName: anObject];
rename = [document renameConnectionsForClassNamed: item toName: anObject];
if (rename)
{
int row = 0;
@ -279,7 +371,6 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
// scroll to the item..
[gov scrollRowToVisible: row];
// [gov selectRow: row byExtendingSelection: NO];
}
}
}

View file

@ -128,14 +128,11 @@
// classes support..
- (id) createSubclass: (id)sender;
- (id) instantiateClass: (id)sender;
- (id) editClass: (id)sender;
- (id) createClassFiles: (id)sender;
- (void) changeCurrentClass: (id)sender;
- (id) addAttributeToClass: (id)sender;
- (id) remove: (id)sender;
- (id) createClassFiles: (id)sender;
- (id) instantiateClass: (id)sender;
- (void) selectClassWithObject: (id)obj;
- (void) selectClass: (NSString *)className;
- (BOOL) classIsSelected;

View file

@ -39,6 +39,8 @@
#include <AppKit/NSNibLoading.h>
#include <GNUstepGUI/GSNibTemplates.h>
#include "NSView+GormExtensions.h"
#include "GormSound.h"
#include "GormImage.h"
@interface GormDisplayCell : NSButtonCell
@end
@ -627,20 +629,6 @@ static NSImage *fileImage = nil;
}
}
// sound support
- (GormSound *)_createSoundPlaceHolder: (NSString *)path
{
NSString *name = [[path lastPathComponent] stringByDeletingPathExtension];
return [[GormSound alloc] initWithName: name path: path];
}
// image support
- (GormImage *)_createImagePlaceHolder: (NSString *)path
{
NSString *name = [[path lastPathComponent] stringByDeletingPathExtension];
return [[GormImage alloc] initWithName: name path: path];
}
- (void) beginArchiving
{
NSEnumerator *enumerator;
@ -699,70 +687,6 @@ static NSImage *fileImage = nil;
[filePrefsManager setClassVersions];
}
- (void) changeCurrentClass: (id)sender
{
int row = [classesView selectedRow];
if (row >= 0)
{
[classesView setSelectedClassName: [classesView itemAtRow: row]];
[self setSelectionFromEditor: (id)classesView];
}
}
// class selection...
- (void) selectClass: (NSString *)className
{
NSString *currentClass = nil;
NSArray *classes;
NSEnumerator *en;
int row = 0;
if(className != nil)
{
if([className isEqual: @"CustomView"] ||
[className isEqual: @"GormSound"] ||
[className isEqual: @"GormImage"])
{
return; // return only if it is a special class name...
}
}
else
{
return; // return if it is nil
}
classes = [[self classManager] allSuperClassesOf: className];
en = [classes objectEnumerator];
// open the items...
while ((currentClass = [en nextObject]) != nil)
{
[classesView expandItem: currentClass];
}
// select the item...
row = [classesView rowForItem: className];
if (row != NSNotFound)
{
[classesView selectRow: row byExtendingSelection: NO];
[classesView scrollRowToVisible: row];
}
}
- (void) selectClassWithObject: (id)obj
{
NSString *customClass = [classManager customClassForObject: obj];
if(customClass != nil)
{
[self selectClass: customClass];
}
else if ([obj respondsToSelector: @selector(className)])
{
[self selectClass: [obj className]];
}
}
// change the views...
- (void) changeView: (id)sender
{
@ -805,7 +729,7 @@ static NSImage *fileImage = nil;
obj = newobj;
}
}
[self selectClassWithObject: obj];
[classesView selectClassWithObject: obj];
}
}
break;
@ -972,7 +896,7 @@ static NSImage *fileImage = nil;
i = [classesView rowForItem: newClassName];
[classesView selectRow: i byExtendingSelection: NO];
[classesView scrollRowToVisible: i];
[self editClass: self];
// [self editClass: self];
}
else
{
@ -1289,13 +1213,6 @@ static NSImage *fileImage = nil;
return nil;
}
- (id) editClass: (id)sender
{
[self changeCurrentClass: sender];
return self;
}
- (id) createClassFiles: (id)sender
{
NSSavePanel *sp;
@ -1696,7 +1613,7 @@ static NSImage *fileImage = nil;
if(newClass != nil)
{
[self selectClass: newClass];
[classesView selectClass: newClass];
}
}
}
@ -1809,19 +1726,12 @@ static NSImage *fileImage = nil;
- (BOOL) classIsSelected
{
int i = [classesView selectedRow];
BOOL result = NO;
return [classesView currentSelectionIsClass];
}
if (i >= 0 && i <= ([classesView numberOfRows] - 1))
{
id object = [classesView itemAtRow: i];
if([object isKindOfClass: [NSString class]])
{
result = YES;
}
}
return result;
- (void) selectClass: (NSString *)className
{
[classesView selectClass: className];
}
// The sole purpose of this method is to clean up .gorm files from older
@ -2156,7 +2066,7 @@ static NSImage *fileImage = nil;
NSDebugLog(@"Add the sound %@", file);
soundPath = [documentPath stringByAppendingPathComponent: file];
[soundsView addObject: [self _createSoundPlaceHolder: soundPath]];
[soundsView addObject: [GormSound soundForPath: soundPath]];
}
}
}
@ -2178,7 +2088,7 @@ static NSImage *fileImage = nil;
id placeHolder;
imagePath = [documentPath stringByAppendingPathComponent: file];
placeHolder = [self _createImagePlaceHolder: imagePath];
placeHolder = [GormImage imageForPath: imagePath];
if (placeHolder)
{
NSDebugLog(@"Add the image %@", file);
@ -3544,7 +3454,7 @@ static NSImage *fileImage = nil;
{
filename = [filenames objectAtIndex:i];
NSDebugLog(@"Loading sound file: %@",filenames);
[soundsView addObject: [self _createSoundPlaceHolder: filename]];
[soundsView addObject: [GormSound soundForPath: filename]];
}
return self;
}
@ -3575,7 +3485,7 @@ static NSImage *fileImage = nil;
{
filename = [filenames objectAtIndex:i];
NSDebugLog(@"Loading image file: %@",filename);
[imagesView addObject: [self _createImagePlaceHolder: filename]];
[imagesView addObject: [GormImage imageForPath: filename]];
}
return self;
}

61
GormImage.h Normal file
View file

@ -0,0 +1,61 @@
/** <title>GormImage</title>
<abstract>This class is a placeholder for a real image.</abstract>
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: Dec 2004
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; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef INCLUDED_GormImage_h
#define INCLUDED_GormImage_h
#include <Foundation/NSObject.h>
@class NSString, NSImage;
@interface GormImage : NSObject
{
NSString *name;
NSString *path;
NSImage *image;
NSImage *smallImage;
BOOL isSystemImage;
BOOL isInWrapper;
}
+ (GormImage *) imageForPath: (NSString *)path;
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath;
- (void) setImageName: (NSString *)aName;
- (NSString *) imageName;
- (void) setImagePath: (NSString *)aPath;
- (NSString *) imagePath;
- (void) setSystemImage: (BOOL)flag;
- (BOOL) isSystemImage;
- (void) setInWrapper: (BOOL)flag;
- (BOOL) isInWrapper;
- (NSString *)inspectorClassName;
- (NSImage *)image;
- (NSImage *)normalImage;
@end
#endif

156
GormImage.m Normal file
View file

@ -0,0 +1,156 @@
/* GormImageEditor.m
*
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 2002
*
* 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 <AppKit/NSImage.h>
#include "GormImage.h"
// image proxy object...
@implementation GormImage
+ (GormImage*)imageForPath: (NSString *)apath
{
NSString *aname = [[apath lastPathComponent] stringByDeletingPathExtension];
return AUTORELEASE([[GormImage alloc] initWithName: aname path: apath]);
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
{
NSSize originalSize;
float ratioH;
float ratioW;
[super init];
ASSIGN(name, aName);
ASSIGN(path, aPath);
image = [[NSImage alloc] initByReferencingFile: aPath];
smallImage = [[NSImage alloc] initWithContentsOfFile: aPath];
[image setName: aName];
if (smallImage == nil)
{
RELEASE(name);
RELEASE(path);
return nil;
}
originalSize = [smallImage size];
ratioW = originalSize.width / 70;
ratioH = originalSize.height / 55;
if (ratioH > 1 || ratioW > 1)
{
[smallImage setScalesWhenResized: YES];
if (ratioH > ratioW)
{
[smallImage setSize: NSMakeSize(originalSize.width / ratioH, 55)];
}
else
{
[smallImage setSize: NSMakeSize(70, originalSize.height / ratioW)];
}
}
isSystemImage = NO;
isInWrapper = NO;
return self;
}
- (void) dealloc
{
RELEASE(name);
RELEASE(path);
RELEASE(image);
RELEASE(smallImage);
[super dealloc];
}
- (void) setImageName: (NSString *)aName
{
ASSIGN(name, aName);
}
- (NSString *) imageName
{
return name;
}
- (void) setImagePath: (NSString *)aPath
{
ASSIGN(path, aPath);
}
- (NSString *) imagePath
{
return path;
}
- (NSImage *) normalImage
{
return image;
}
- (NSImage *) image
{
return smallImage;
}
- (void) setSystemImage: (BOOL)flag
{
isSystemImage = flag;
}
- (BOOL) isSystemImage
{
return isSystemImage;
}
- (void) setInWrapper: (BOOL)flag
{
isInWrapper = flag;
}
- (BOOL) isInWrapper
{
return isInWrapper;
}
- (NSString *)inspectorClassName
{
return @"GormImageInspector";
}
- (NSString*) classInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) connectInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormNotApplicableInspector";
}
@end

View file

@ -26,6 +26,7 @@
#include "GormFunctions.h"
#include "GormPalettesManager.h"
#include <AppKit/NSImage.h>
#include "GormImage.h"
/*
* Method to return the image that should be used to display objects within
@ -138,7 +139,7 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
id placeHolder = nil;
NSLog(@"====> %@",[data objectAtIndex:i]);
placeHolder = [(GormDocument *)document _createImagePlaceHolder: [data objectAtIndex: i]];
placeHolder = [GormImage imageForPath: [data objectAtIndex: i]];
NSLog(@"here1 %@", [data objectAtIndex: i]);
if (placeHolder)
@ -240,11 +241,9 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
en = [list objectEnumerator];
while((obj = [en nextObject]) != nil)
{
NSString *name = [[obj lastPathComponent] stringByDeletingPathExtension];
GormImage *image = [[GormImage alloc] initWithName: name path: obj];
GormImage *image = [GormImage imageForPath: obj];
[image setSystemImage: YES];
[self addObject: image];
RELEASE(image);
}
// set up the notification...
@ -479,126 +478,4 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
*/
@end
// image proxy object...
@implementation GormImage
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
{
NSSize originalSize;
float ratioH;
float ratioW;
[super init];
ASSIGN(name, aName);
ASSIGN(path, aPath);
image = [[NSImage alloc] initByReferencingFile: aPath];
smallImage = [[NSImage alloc] initWithContentsOfFile: aPath];
[image setName: aName];
if (smallImage == nil)
{
RELEASE(name);
RELEASE(path);
return nil;
}
originalSize = [smallImage size];
ratioW = originalSize.width / 70;
ratioH = originalSize.height / 55;
if (ratioH > 1 || ratioW > 1)
{
[smallImage setScalesWhenResized: YES];
if (ratioH > ratioW)
{
[smallImage setSize: NSMakeSize(originalSize.width / ratioH, 55)];
}
else
{
[smallImage setSize: NSMakeSize(70, originalSize.height / ratioW)];
}
}
isSystemImage = NO;
isInWrapper = NO;
return self;
}
- (void) dealloc
{
RELEASE(name);
RELEASE(path);
RELEASE(image);
RELEASE(smallImage);
[super dealloc];
}
- (void) setImageName: (NSString *)aName
{
ASSIGN(name, aName);
}
- (NSString *) imageName
{
return name;
}
- (void) setImagePath: (NSString *)aPath
{
ASSIGN(path, aPath);
}
- (NSString *) imagePath
{
return path;
}
- (NSImage *) normalImage
{
return image;
}
- (NSImage *) image
{
return smallImage;
}
- (void) setSystemImage: (BOOL)flag
{
isSystemImage = flag;
}
- (BOOL) isSystemImage
{
return isSystemImage;
}
- (void) setInWrapper: (BOOL)flag
{
isInWrapper = flag;
}
- (BOOL) isInWrapper
{
return isInWrapper;
}
- (NSString *)inspectorClassName
{
return @"GormImageInspector";
}
- (NSString*) classInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) connectInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormNotApplicableInspector";
}
@end

View file

@ -3,6 +3,7 @@
#include <AppKit/AppKit.h>
#include "GormImageInspector.h"
#include "GormPrivate.h"
#include "GormImage.h"
@implementation GormImageInspector
+ (void) initialize

View file

@ -25,7 +25,10 @@
#include <AppKit/NSNibConnector.h>
#include <Foundation/NSException.h>
#include <InterfaceBuilder/IBInspector.h>
#include <InterfaceBuilder/IBObjectAdditions.h>
#include "GormPrivate.h"
#include "GormImage.h"
#include "GormSound.h"
#define HASFORMATTER(obj) \
[obj respondsToSelector: @selector(cell)] && \
@ -425,7 +428,7 @@
}
else
{
NSString *newTitle = [obj className];
NSString *newTitle = [obj objectNameForInspectorTitle];
[panel setTitle: [NSString stringWithFormat:_(@"%@ Inspector"), newTitle]];
}

View file

@ -169,11 +169,16 @@ extern NSString *GormResizeCellNotification;
@interface GormClassEditor : GormOutlineView <IBSelectionOwners>
{
GormDocument *document;
NSString *selectedClassName;
GormClassManager *classManager;
}
- (GormClassEditor*) initWithDocument: (GormDocument*)doc;
+ (GormClassEditor*) classEditorForDocument: (GormDocument*)doc;
- (void) setSelectedClassName: (NSString*)cn;
- (NSString *) selectedClassName;
- (void) selectClassWithObject: (id)obj;
- (void) selectClass: (NSString *)className;
- (BOOL) currentSelectionIsClass;
- (void) editClass: (id)sender;
@end
@interface GormGenericEditor : NSMatrix <IBEditors, IBSelectionOwners>
@ -302,58 +307,6 @@ extern NSString *GormResizeCellNotification;
- (NSImage *) imageForViewer;
@end
// we don't use the actual sound since we don't want to read the entire sound into
// memory.
@interface GormSound : NSObject
{
NSString *name;
NSString *path;
BOOL isSystemSound;
BOOL isInWrapper;
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath;
- (void) setSoundName: (NSString *)aName;
- (NSString *) soundName;
- (void) setSoundPath: (NSString *)aPath;
- (NSString *) soundPath;
- (void) setSystemSound: (BOOL)flag;
- (BOOL) isSystemSound;
- (void) setInWrapper: (BOOL)flag;
- (BOOL) isInWrapper;
- (NSString *)inspectorClassName;
@end
@interface GormImage : NSObject
{
NSString *name;
NSString *path;
NSImage *image;
NSImage *smallImage;
BOOL isSystemImage;
BOOL isInWrapper;
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath;
- (void) setImageName: (NSString *)aName;
- (NSString *) imageName;
- (void) setImagePath: (NSString *)aPath;
- (NSString *) imagePath;
- (void) setSystemImage: (BOOL)flag;
- (BOOL) isSystemImage;
- (void) setInWrapper: (BOOL)flag;
- (BOOL) isInWrapper;
- (NSString *)inspectorClassName;
- (NSImage *)image;
- (NSImage *)normalImage;
@end
@interface GormDocument (PrivateMethodsForImagesAndSounds)
- (GormImage *)_createImagePlaceHolder: (NSString *)path;
- (GormSound *)_createSoundPlaceHolder: (NSString *)path;
- (void) addImage: (NSString*) path;
@end
// to allow us to load the image by name, but save it within the archive.
// this is a bit of a cheat.
@interface NSImage (GormNSImageAddition)

56
GormSound.h Normal file
View file

@ -0,0 +1,56 @@
/** <title>GormSound</title>
<abstract>A place holder for a sound.</abstract>
Copyright (C) 2001 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: Dec 2004
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; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef INCLUDED_GormSound_h
#define INCLUDED_GormSound_h
#include <Foundation/NSObject.h>
@class NSString;
@interface GormSound : NSObject
{
NSString *name;
NSString *path;
BOOL isSystemSound;
BOOL isInWrapper;
}
+ (GormSound*) soundForPath: (NSString *)path;
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath;
- (void) setSoundName: (NSString *)aName;
- (NSString *) soundName;
- (void) setSoundPath: (NSString *)aPath;
- (NSString *) soundPath;
- (void) setSystemSound: (BOOL)flag;
- (BOOL) isSystemSound;
- (void) setInWrapper: (BOOL)flag;
- (BOOL) isInWrapper;
- (NSString *)inspectorClassName;
@end
#endif

112
GormSound.m Normal file
View file

@ -0,0 +1,112 @@
/* GormSound.m
*
* Copyright (C) 2002 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: Dec 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/NSString.h>
#include <AppKit/NSSound.h>
#include "GormSound.h"
// sound proxy object...
@implementation GormSound
+ (GormSound*) soundForPath: (NSString *)apath
{
NSString *aname = [[apath lastPathComponent] stringByDeletingPathExtension];
return AUTORELEASE([[GormSound alloc] initWithName: aname path: apath]);
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
{
NSSound *sound = [[NSSound alloc] initWithContentsOfFile: aPath
byReference: YES];
[super init];
ASSIGN(name, aName);
ASSIGN(path, aPath);
//#warning "we want to store the sound somewhere"
[(NSSound *)sound setName: aName];
isSystemSound = NO;
isInWrapper = NO;
return self;
}
- (void) setSoundName: (NSString *)aName
{
ASSIGN(name, aName);
}
- (NSString *) soundName
{
return name;
}
- (void) setSoundPath: (NSString *)aPath
{
ASSIGN(path, aPath);
}
- (NSString *) soundPath
{
return path;
}
- (void) setSystemSound: (BOOL)flag
{
isSystemSound = flag;
}
- (BOOL) isSystemSound
{
return isSystemSound;
}
- (void) setInWrapper: (BOOL)flag
{
isInWrapper = flag;
}
- (BOOL) isInWrapper
{
return isInWrapper;
}
- (NSString *)inspectorClassName
{
return @"GormSoundInspector";
}
- (NSString*) classInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) connectInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormNotApplicableInspector";
}
@end

View file

@ -26,6 +26,7 @@
#include "GormFunctions.h"
#include "GormPalettesManager.h"
#include <AppKit/NSSound.h>
#include "GormSound.h"
/*
* Method to return the image that should be used to display objects within
@ -242,8 +243,7 @@ static NSMapTable *docMap = 0;
en = [list objectEnumerator];
while((obj = [en nextObject]) != nil)
{
NSString *name = [[obj lastPathComponent] stringByDeletingPathExtension];
GormSound *sound = [[GormSound alloc] initWithName: name path: obj];
GormSound *sound = [GormSound soundForPath: obj];
[sound setSystemSound: YES];
[self addObject: sound];
}
@ -567,81 +567,3 @@ static NSMapTable *docMap = 0;
@end
// sound proxy object...
@implementation GormSound
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
{
NSSound *sound = [[NSSound alloc] initWithContentsOfFile: aPath
byReference: YES];
[super init];
ASSIGN(name, aName);
ASSIGN(path, aPath);
//#warning "we want to store the sound somewhere"
[(NSSound *)sound setName: aName];
isSystemSound = NO;
isInWrapper = NO;
return self;
}
- (void) setSoundName: (NSString *)aName
{
ASSIGN(name, aName);
}
- (NSString *) soundName
{
return name;
}
- (void) setSoundPath: (NSString *)aPath
{
ASSIGN(path, aPath);
}
- (NSString *) soundPath
{
return path;
}
- (void) setSystemSound: (BOOL)flag
{
isSystemSound = flag;
}
- (BOOL) isSystemSound
{
return isSystemSound;
}
- (void) setInWrapper: (BOOL)flag
{
isInWrapper = flag;
}
- (BOOL) isInWrapper
{
return isInWrapper;
}
- (NSString *)inspectorClassName
{
return @"GormSoundInspector";
}
- (NSString*) classInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) connectInspectorClassName
{
return @"GormNotApplicableInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormNotApplicableInspector";
}
@end

View file

@ -33,6 +33,7 @@
#include "GormDocument.h"
#include "GormPrivate.h"
#include "GormSoundView.h"
#include "GormSound.h"
@implementation GormSoundInspector
+ (void) initialize

View file

@ -2,41 +2,24 @@
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"alignLeft:",
"capitalizeWord:",
"changeFont:",
"copy:",
"delete:",
"deleteToBeginningOfParagraph:",
"deleteWordBackward:",
"fax:",
"loosenKerning:",
"miniaturize:",
"moveDown:",
"moveLeft:",
"moveToBeginningOfParagraph:",
"moveUp:",
"moveWordForward:",
"openDocument:",
"orderFrontDataLinkPanel:",
"orderFrontFontPanel:",
"orderOut:",
"pasteAsPlainText:",
"performClose:",
"raiseBaseline:",
"saveAllDocuments:",
"scrollLineDown:",
"scrollViaScroller:",
"selectParagraph:",
"selectWord:",
"showWindow:",
"swapWithMark:",
"takeObjectValueFrom:",
"toggle:",
"toggleTraditionalCharacterShape:",
"turnOffLigatures:",
"unscript:",
"useStandardLigatures:",
"setObject:",
"updateMenuType:",
"updateAutoenable:"

View file

@ -2,40 +2,23 @@
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"alignLeft:",
"capitalizeWord:",
"changeFont:",
"copy:",
"delete:",
"deleteToBeginningOfParagraph:",
"deleteWordBackward:",
"fax:",
"loosenKerning:",
"miniaturize:",
"moveDown:",
"moveLeft:",
"moveToBeginningOfParagraph:",
"moveUp:",
"moveWordForward:",
"openDocument:",
"orderFrontDataLinkPanel:",
"orderOut:",
"pasteAsPlainText:",
"performClose:",
"raiseBaseline:",
"saveAllDocuments:",
"scrollLineDown:",
"scrollViaScroller:",
"selectParagraph:",
"selectWord:",
"showWindow:",
"swapWithMark:",
"takeObjectValueFrom:",
"toggle:",
"toggleTraditionalCharacterShape:",
"turnOffLigatures:",
"unscript:",
"useStandardLigatures:"
"unscript:"
);
Super = NSObject;
};
@ -53,10 +36,4 @@
);
Super = IBInspector;
};
NSControl = {
Actions = (
"takeObjectValueFrom:"
);
Super = NSView;
};
}

View file

@ -2,41 +2,24 @@
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"alignLeft:",
"capitalizeWord:",
"changeFont:",
"copy:",
"delete:",
"deleteToBeginningOfParagraph:",
"deleteWordBackward:",
"fax:",
"loosenKerning:",
"miniaturize:",
"moveDown:",
"moveLeft:",
"moveToBeginningOfParagraph:",
"moveUp:",
"moveWordForward:",
"openDocument:",
"orderFrontDataLinkPanel:",
"orderFrontFontPanel:",
"orderOut:",
"pasteAsPlainText:",
"performClose:",
"raiseBaseline:",
"saveAllDocuments:",
"scrollLineDown:",
"scrollViaScroller:",
"selectParagraph:",
"selectWord:",
"showWindow:",
"swapWithMark:",
"takeObjectValueFrom:",
"toggle:",
"toggleTraditionalCharacterShape:",
"turnOffLigatures:",
"unscript:",
"useStandardLigatures:",
"removeOutlet:",
"addOutlet:",
"selectClass:",