Added code from Matt Rice to allow multiple selection of images/sounds.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17068 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-06-29 17:23:39 +00:00
parent f614f555d1
commit 80c950ec34
2 changed files with 32 additions and 9 deletions

View file

@ -1,3 +1,10 @@
2003-06-29 Gregory John Casamento <greg_casamento@yahoo.com>
Applied patch submitted by Matt Rice
* GormDocument.m: Added code to allow multiple selection of
images and sounds when adding them to a .gorm file.
Thanks, Matt!!
2003-06-26 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/2Controls/GormNSColorWellInspector.gorm: Redid the

View file

@ -3498,10 +3498,13 @@ shouldEditTableColumn: (NSTableColumn *)tableColumn
- (id) openSound: (id)sender
{
NSArray *fileTypes = [NSSound soundUnfilteredFileTypes];
NSArray *filenames;
NSString *filename;
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
int result;
int i;
[oPanel setAllowsMultipleSelection: NO];
[oPanel setAllowsMultipleSelection: YES];
[oPanel setCanChooseFiles: YES];
[oPanel setCanChooseDirectories: NO];
result = [oPanel runModalForDirectory: nil
@ -3509,23 +3512,31 @@ shouldEditTableColumn: (NSTableColumn *)tableColumn
types: fileTypes];
if (result == NSOKButton)
{
NSDebugLog(@"Loading sound file: %@",[oPanel filename]);
[soundsView addObject: [self _createSoundPlaceHolder: [oPanel filename]]];
[sounds addObject: [oPanel filename]];
filenames = [oPanel filenames];
for (i=0; i<[filenames count]; i++)
{
filename = [filenames objectAtIndex:i];
NSDebugLog(@"Loading sound file: %@",filenames);
[soundsView addObject: [self _createSoundPlaceHolder: filename]];
[sounds addObject: filename];
}
return self;
}
return nil;
}
// image/sound support...
// image support...
- (id) openImage: (id)sender
{
NSArray *fileTypes = [NSImage imageFileTypes];
NSArray *filenames;
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
NSString *filename;
int result;
int i;
[oPanel setAllowsMultipleSelection: NO];
[oPanel setAllowsMultipleSelection: YES];
[oPanel setCanChooseFiles: YES];
[oPanel setCanChooseDirectories: NO];
result = [oPanel runModalForDirectory: nil
@ -3533,9 +3544,14 @@ shouldEditTableColumn: (NSTableColumn *)tableColumn
types: fileTypes];
if (result == NSOKButton)
{
NSDebugLog(@"Loading image file: %@",[oPanel filename]);
[imagesView addObject: [self _createImagePlaceHolder: [oPanel filename]]];
[images addObject: [oPanel filename]];
filenames = [oPanel filenames];
for (i=0; i<[filenames count]; i++)
{
filename = [filenames objectAtIndex:i];
NSDebugLog(@"Loading image file: %@",filename);
[imagesView addObject: [self _createImagePlaceHolder: filename]];
[images addObject: filename];
}
return self;
}