* English.lproj/GormPreferences.gorm

* English.lproj/GormPrefPlugins.gorm
	* GNUmakefile
	* GormCore/GormPluginManager.m
	* GormPrefs/GNUmakefile
	* GormPrefs/GormPalettesPref.h
	* GormPrefs/GormPluginsPref.h
	* GormPrefs/GormPluginsPref.m
	* GormPrefs/GormPrefController.h
	* GormPrefs/GormPrefController.m: Changes to allow addition of 
	plugins by users.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@26891 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2008-09-28 03:01:18 +00:00
parent 4b4435cb68
commit 98c835c50c
14 changed files with 224 additions and 5 deletions

View file

@ -1,3 +1,17 @@
2008-09-27 23:02-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormPreferences.gorm
* English.lproj/GormPrefPlugins.gorm
* GNUmakefile
* GormCore/GormPluginManager.m
* GormPrefs/GNUmakefile
* GormPrefs/GormPalettesPref.h
* GormPrefs/GormPluginsPref.h
* GormPrefs/GormPluginsPref.m
* GormPrefs/GormPrefController.h
* GormPrefs/GormPrefController.m: Changes to allow addition of
plugins by users.
2008-09-27 21:10-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormPalettesManager.h

View file

@ -0,0 +1,32 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"orderFrontFontPanel:",
"removeAction:",
"addAction:"
);
Super = NSObject;
};
GormPluginsPref = {
Actions = (
"removeAction:",
"addAction:"
);
Outlets = (
_view,
window,
removeButton,
addButton,
table
);
Super = NSObject;
};
PluginDataSource = {
Actions = (
);
Outlets = (
);
Super = NSObject;
};
}

Binary file not shown.

Binary file not shown.

View file

@ -159,6 +159,7 @@ Gorm_LOCALIZED_RESOURCE_FILES = \
GormPrefGuideline.gorm \
GormPrefHeaders.gorm \
GormPrefPalettes.gorm \
GormPrefPlugins.gorm \
GormScrollViewAttributesInspector.gorm \
GormSetName.gorm \
GormShelfPref.gorm \

View file

@ -1,10 +1,10 @@
/* GormPalettesManager.m
/* GormPluginManager.m
*
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 1999, 2004
* Date: 1999, 2004, 2008
*
* This file is part of GNUstep.
*
@ -239,7 +239,7 @@
pluginClass = [bundle classNamed: className];
if (pluginClass == 0)
{
NSRunAlertPanel (nil, _(@"Could not load palette class"),
NSRunAlertPanel (nil, _(@"Could not load plugin class"),
_(@"OK"), nil, nil);
return NO;
}

View file

@ -48,6 +48,7 @@ GormGeneralPref.h \
GormGuidelinePref.h \
GormHeadersPref.h \
GormPalettesPref.h \
GormPluginsPref.h \
GormPrefController.h \
GormShelfPref.h
@ -61,6 +62,7 @@ GormGeneralPref.m \
GormGuidelinePref.m \
GormHeadersPref.m \
GormPalettesPref.m \
GormPluginsPref.m \
GormPrefController.m \
GormShelfPref.m

View file

@ -12,8 +12,6 @@
id removeButton;
id window;
id _view;
NSMutableArray *palettes;
}
/**

View file

@ -0,0 +1,33 @@
#ifndef INCLUDED_GormPluginsPref_h
#define INCLUDED_GormPluginsPref_h
#include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
#include <AppKit/NSView.h>
@interface GormPluginsPref : NSObject
{
id table;
id addButton;
id removeButton;
id window;
id _view;
}
/**
* View to be shown in the preferences panel.
*/
- (NSView *) view;
/**
* Add a palette to the list.
*/
- (void) addAction: (id)sender;
/**
* Remove a palette from the list.
*/
- (void) removeAction: (id)sender;
@end
#endif

132
GormPrefs/GormPluginsPref.m Normal file
View file

@ -0,0 +1,132 @@
#/* GormPluginsPref.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 3 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 <Foundation/NSUserDefaults.h>
#include <AppKit/NSWindow.h>
#include <AppKit/NSNibLoading.h>
#include <GormCore/GormPrivate.h>
#include "GormPluginsPref.h"
@class NSTableView;
// data source...
@interface PluginDataSource : NSObject
@end
@implementation PluginDataSource
- (int) numberOfRowsInTableView: (NSTableView *)tv
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *list = [defaults objectForKey: @"UserPlugins"];
return [list count];
}
- (id) tableView: (NSTableView *)tv
objectValueForTableColumn: (NSTableColumn *)tc
row: (int)rowIndex
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *list = [defaults objectForKey: @"UserPlugins"];
id value = nil;
if([list count] > 0)
{
value = [[list objectAtIndex: rowIndex] lastPathComponent];
}
return value;
}
@end
@implementation GormPluginsPref
- (id) init
{
_view = nil;
self = [super init];
if ( ! [NSBundle loadNibNamed:@"GormPrefPlugins" owner:self] )
{
NSLog(@"Can not load bundle GormPrefPlugins");
return nil;
}
_view = [[(NSWindow *)window contentView] retain];
return self;
}
- (void) dealloc
{
TEST_RELEASE(_view);
[super dealloc];
}
-(NSView *) view
{
return _view;
}
- (void) addAction: (id)sender
{
[[(id<Gorm>)NSApp pluginManager] openPlugin: self];
[table reloadData];
}
- (void) removeAction: (id)sender
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray *list = [defaults objectForKey: @"UserPlugins"];
int row = [table selectedRow];
if(row >= 0)
{
NSString *stringValue = [list objectAtIndex: row];
if(stringValue != nil)
{
[list removeObject: stringValue];
[defaults setObject: list forKey: @"UserPlugins"];
[table reloadData];
}
}
}
- (BOOL) tableView: (NSTableView *)tableView
shouldEditTableColumn: (NSTableColumn *)aTableColumn
row: (int)rowIndex
{
BOOL result = NO;
return result;
}
- (BOOL) tableView: (NSTableView *)tv
shouldSelectRow: (int)rowIndex
{
BOOL result = YES;
return result;
}
@end

View file

@ -40,6 +40,7 @@
id _shelfView;
id _colorsView;
id _palettesView;
id _pluginsView;
id _guidelineView;
}

View file

@ -4,6 +4,7 @@
#include "GormShelfPref.h"
#include "GormColorsPref.h"
#include "GormPalettesPref.h"
#include "GormPluginsPref.h"
#include "GormGuidelinePref.h"
#include <AppKit/NSBox.h>
@ -33,6 +34,7 @@
_shelfView = [[GormShelfPref alloc] init];
_colorsView = [[GormColorsPref alloc] init];
_palettesView = [[GormPalettesPref alloc] init];
_pluginsView = [[GormPluginsPref alloc] init];
_guidelineView = [[GormGuidelinePref alloc] init];
[prefBox setContentView:[_generalView view]];
@ -70,6 +72,9 @@
case 5:
[prefBox setContentView: [_guidelineView view]];
break;
case 6:
[prefBox setContentView: [_pluginsView view]];
break;
default:
NSLog(@"Error Default (GormPrefController.m) : - (void) popupAction: (id)sender, no match for tag %d",tag);
break;
@ -83,6 +88,7 @@
RELEASE(_shelfView);
RELEASE(_colorsView);
RELEASE(_palettesView);
RELEASE(_pluginsView);
RELEASE(panel);
[super dealloc];
}