mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 11:41:05 +00:00
* 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:
parent
4b4435cb68
commit
98c835c50c
14 changed files with 224 additions and 5 deletions
14
ChangeLog
14
ChangeLog
|
@ -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>
|
2008-09-27 21:10-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* GormCore/GormPalettesManager.h
|
* GormCore/GormPalettesManager.h
|
||||||
|
|
32
English.lproj/GormPrefPlugins.gorm/data.classes
Normal file
32
English.lproj/GormPrefPlugins.gorm/data.classes
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
BIN
English.lproj/GormPrefPlugins.gorm/data.info
Normal file
BIN
English.lproj/GormPrefPlugins.gorm/data.info
Normal file
Binary file not shown.
BIN
English.lproj/GormPrefPlugins.gorm/objects.gorm
Normal file
BIN
English.lproj/GormPrefPlugins.gorm/objects.gorm
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -159,6 +159,7 @@ Gorm_LOCALIZED_RESOURCE_FILES = \
|
||||||
GormPrefGuideline.gorm \
|
GormPrefGuideline.gorm \
|
||||||
GormPrefHeaders.gorm \
|
GormPrefHeaders.gorm \
|
||||||
GormPrefPalettes.gorm \
|
GormPrefPalettes.gorm \
|
||||||
|
GormPrefPlugins.gorm \
|
||||||
GormScrollViewAttributesInspector.gorm \
|
GormScrollViewAttributesInspector.gorm \
|
||||||
GormSetName.gorm \
|
GormSetName.gorm \
|
||||||
GormShelfPref.gorm \
|
GormShelfPref.gorm \
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* GormPalettesManager.m
|
/* GormPluginManager.m
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Free Software Foundation, Inc.
|
* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
||||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
* Date: 1999, 2004
|
* Date: 1999, 2004, 2008
|
||||||
*
|
*
|
||||||
* This file is part of GNUstep.
|
* This file is part of GNUstep.
|
||||||
*
|
*
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
pluginClass = [bundle classNamed: className];
|
pluginClass = [bundle classNamed: className];
|
||||||
if (pluginClass == 0)
|
if (pluginClass == 0)
|
||||||
{
|
{
|
||||||
NSRunAlertPanel (nil, _(@"Could not load palette class"),
|
NSRunAlertPanel (nil, _(@"Could not load plugin class"),
|
||||||
_(@"OK"), nil, nil);
|
_(@"OK"), nil, nil);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ GormGeneralPref.h \
|
||||||
GormGuidelinePref.h \
|
GormGuidelinePref.h \
|
||||||
GormHeadersPref.h \
|
GormHeadersPref.h \
|
||||||
GormPalettesPref.h \
|
GormPalettesPref.h \
|
||||||
|
GormPluginsPref.h \
|
||||||
GormPrefController.h \
|
GormPrefController.h \
|
||||||
GormShelfPref.h
|
GormShelfPref.h
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ GormGeneralPref.m \
|
||||||
GormGuidelinePref.m \
|
GormGuidelinePref.m \
|
||||||
GormHeadersPref.m \
|
GormHeadersPref.m \
|
||||||
GormPalettesPref.m \
|
GormPalettesPref.m \
|
||||||
|
GormPluginsPref.m \
|
||||||
GormPrefController.m \
|
GormPrefController.m \
|
||||||
GormShelfPref.m
|
GormShelfPref.m
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
id removeButton;
|
id removeButton;
|
||||||
id window;
|
id window;
|
||||||
id _view;
|
id _view;
|
||||||
|
|
||||||
NSMutableArray *palettes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
33
GormPrefs/GormPluginsPref.h
Normal file
33
GormPrefs/GormPluginsPref.h
Normal 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
132
GormPrefs/GormPluginsPref.m
Normal 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
|
|
@ -40,6 +40,7 @@
|
||||||
id _shelfView;
|
id _shelfView;
|
||||||
id _colorsView;
|
id _colorsView;
|
||||||
id _palettesView;
|
id _palettesView;
|
||||||
|
id _pluginsView;
|
||||||
id _guidelineView;
|
id _guidelineView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "GormShelfPref.h"
|
#include "GormShelfPref.h"
|
||||||
#include "GormColorsPref.h"
|
#include "GormColorsPref.h"
|
||||||
#include "GormPalettesPref.h"
|
#include "GormPalettesPref.h"
|
||||||
|
#include "GormPluginsPref.h"
|
||||||
#include "GormGuidelinePref.h"
|
#include "GormGuidelinePref.h"
|
||||||
|
|
||||||
#include <AppKit/NSBox.h>
|
#include <AppKit/NSBox.h>
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
_shelfView = [[GormShelfPref alloc] init];
|
_shelfView = [[GormShelfPref alloc] init];
|
||||||
_colorsView = [[GormColorsPref alloc] init];
|
_colorsView = [[GormColorsPref alloc] init];
|
||||||
_palettesView = [[GormPalettesPref alloc] init];
|
_palettesView = [[GormPalettesPref alloc] init];
|
||||||
|
_pluginsView = [[GormPluginsPref alloc] init];
|
||||||
_guidelineView = [[GormGuidelinePref alloc] init];
|
_guidelineView = [[GormGuidelinePref alloc] init];
|
||||||
|
|
||||||
[prefBox setContentView:[_generalView view]];
|
[prefBox setContentView:[_generalView view]];
|
||||||
|
@ -70,6 +72,9 @@
|
||||||
case 5:
|
case 5:
|
||||||
[prefBox setContentView: [_guidelineView view]];
|
[prefBox setContentView: [_guidelineView view]];
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
[prefBox setContentView: [_pluginsView view]];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
NSLog(@"Error Default (GormPrefController.m) : - (void) popupAction: (id)sender, no match for tag %d",tag);
|
NSLog(@"Error Default (GormPrefController.m) : - (void) popupAction: (id)sender, no match for tag %d",tag);
|
||||||
break;
|
break;
|
||||||
|
@ -83,6 +88,7 @@
|
||||||
RELEASE(_shelfView);
|
RELEASE(_shelfView);
|
||||||
RELEASE(_colorsView);
|
RELEASE(_colorsView);
|
||||||
RELEASE(_palettesView);
|
RELEASE(_palettesView);
|
||||||
|
RELEASE(_pluginsView);
|
||||||
RELEASE(panel);
|
RELEASE(panel);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue