mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Changes to allow the user to switch between a browser and an outline view for classes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21242 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6e690fad5e
commit
d4ce568b41
12 changed files with 279 additions and 95 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2005-05-21 11:06 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* English.lproj/GormPrefGeneral.gorm: Added oulets/actions for
|
||||
matrix to choose outline or browser view.
|
||||
* GormCore/GormClassEditor.h: Added forward declaration for
|
||||
NSBrowser.
|
||||
* GormCore/GormClassEditor.m: Added new private methods and
|
||||
also added code to existing methods to handle the browser view.
|
||||
* GormCore/GormClassManager.m: Removed artificial returning of
|
||||
NSObject in subClassesOf: and allSubclassesOf: so that it's now
|
||||
possible to all root classes when querying for "nil".
|
||||
* GormCore/GormFilePrefsManager.m: Updated version.
|
||||
* GormInfo.plist: Updated version.
|
||||
* GormPrefs/GormGeneralPref.h: Added interfaceMatrix and classesAction:
|
||||
* GormPrefs/GormGeneralPref.m: Implemented classesAction.
|
||||
* Resources/Defaults.plist: Added new default so that the user's
|
||||
preference for the classes view is stored.
|
||||
|
||||
2005-05-19 23:54 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Version 0.9.10
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"orderFrontFontPanel:",
|
||||
"archiveAction:"
|
||||
"archiveAction:",
|
||||
"classesAction:",
|
||||
"orderFrontFontPanel:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
@ -12,14 +13,16 @@
|
|||
"palettesAction:",
|
||||
"inspectorAction:",
|
||||
"backupAction:",
|
||||
"archiveAction:"
|
||||
"archiveAction:",
|
||||
"classesAction:"
|
||||
);
|
||||
Outlets = (
|
||||
window,
|
||||
palettesButton,
|
||||
inspectorButton,
|
||||
backupButton,
|
||||
archiveMatrix
|
||||
archiveMatrix,
|
||||
interfaceMatrix
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -29,9 +29,10 @@
|
|||
#include <AppKit/NSBox.h>
|
||||
#include <GormCore/GormOutlineView.h>
|
||||
|
||||
@class NSString, NSArray, GormDocument, GormClassManager;
|
||||
@class NSString, NSArray, GormDocument, GormClassManager, NSBrowser;
|
||||
|
||||
extern NSString *GormClassPboardType;
|
||||
extern NSString *GormSwitchViewPreferencesNotification;
|
||||
|
||||
@interface GormClassEditor : NSBox <IBEditors, IBSelectionOwners>
|
||||
{
|
||||
|
|
|
@ -33,12 +33,19 @@
|
|||
#include "GormPrivate.h"
|
||||
|
||||
NSString *GormClassPboardType = @"GormClassPboardType";
|
||||
NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNotification";
|
||||
|
||||
@interface GormOutlineView (PrivateMethods)
|
||||
- (void) _addNewActionToObject: (id)item;
|
||||
- (void) _addNewOutletToObject: (id)item;
|
||||
@end
|
||||
|
||||
@interface GormClassEditor (PrivateMethods)
|
||||
- (void) browserClick: (id)sender;
|
||||
- (void) switchView;
|
||||
- (void) handleNotification: (NSNotification *)notification;
|
||||
@end
|
||||
|
||||
@implementation GormClassEditor
|
||||
|
||||
- (GormClassEditor*) initWithDocument: (GormDocument*)doc
|
||||
|
@ -46,6 +53,7 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSRect scrollRect = {{0, 0}, {340, 188}};
|
||||
NSRect mainRect = {{20, 0}, {320, 188}};
|
||||
NSColor *salmonColor =
|
||||
|
@ -73,11 +81,7 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
[scrollView setDocumentView: outlineView];
|
||||
RELEASE(outlineView);
|
||||
|
||||
// add outline view to self;
|
||||
[self setContentView: scrollView];
|
||||
[self setContentViewMargins: NSZeroSize];
|
||||
[self sizeToFit];
|
||||
RELEASE(scrollView);
|
||||
// RELEASE(scrollView);
|
||||
|
||||
// weak connections...
|
||||
document = doc;
|
||||
|
@ -96,7 +100,7 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
[outlineView setAttributeOffset: 30];
|
||||
[outlineView setRowHeight: 18];
|
||||
[outlineView setMenu: [(id<Gorm>)NSApp classMenu]];
|
||||
[outlineView setBackgroundColor: salmonColor ];
|
||||
[outlineView setBackgroundColor: salmonColor];
|
||||
|
||||
// add the table columns...
|
||||
tableColumn = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier: @"classes"];
|
||||
|
@ -130,12 +134,31 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
[outlineView expandItem: @"NSObject"];
|
||||
|
||||
// allocate the NSBrowser view.
|
||||
/*
|
||||
browserView = [[NSBrowser alloc] initWithFrame: mainRect];
|
||||
[browserView setDelegate: self];
|
||||
[browserView setRefusesFirstResponder:YES];
|
||||
[browserView setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin];
|
||||
[browserView setTitled:NO];
|
||||
[browserView setMaxVisibleColumns:3];
|
||||
[browserView setSeparatesColumns:NO];
|
||||
[browserView setAllowsMultipleSelection:YES];
|
||||
[browserView setDelegate:self];
|
||||
[browserView setTarget:self];
|
||||
[browserView setAction: @selector(browserClick:)];
|
||||
// [browserView setDoubleAction: nil]; // @selector(doubleClick:)];
|
||||
[browserView setRefusesFirstResponder:YES];
|
||||
[browserView loadColumnZero];
|
||||
[browserView selectRow: 0 inColumn: 0];
|
||||
*/
|
||||
|
||||
|
||||
// observe certain notifications...
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: GormSwitchViewPreferencesNotification
|
||||
object: nil];
|
||||
|
||||
// switch...
|
||||
[self setContentViewMargins: NSZeroSize];
|
||||
[self switchView];
|
||||
[self sizeToFit];
|
||||
|
||||
// register for types...
|
||||
[IBResourceManager registerForAllPboardTypes: self
|
||||
|
@ -150,6 +173,31 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
return AUTORELEASE([(GormClassEditor *)[self alloc] initWithDocument: doc]);
|
||||
}
|
||||
|
||||
- (void) switchView
|
||||
{
|
||||
NSString *viewType = [[NSUserDefaults standardUserDefaults] stringForKey: @"ClassViewType"];
|
||||
if([viewType isEqual: @"Outline"] || viewType == nil)
|
||||
{
|
||||
[self setContentView: scrollView];
|
||||
}
|
||||
else if([viewType isEqual: @"Browser"])
|
||||
{
|
||||
[self setContentView: browserView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) handleNotification: (NSNotification *)notification
|
||||
{
|
||||
[self switchView];
|
||||
}
|
||||
|
||||
- (void) browserClick: (id)sender
|
||||
{
|
||||
NSString *className = [[sender selectedCell] stringValue];
|
||||
ASSIGN(selectedClass, className);
|
||||
[document setSelectionFromEditor: (id)self];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(selectedClass);
|
||||
|
@ -163,12 +211,21 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
|
||||
- (NSString *)selectedClassName
|
||||
{
|
||||
int row = [outlineView selectedRow];
|
||||
id className = [outlineView itemAtRow: row];
|
||||
id className = nil;
|
||||
|
||||
if ([className isKindOfClass: [GormOutletActionHolder class]])
|
||||
if([self contentView] == scrollView)
|
||||
{
|
||||
className = [outlineView itemBeingEdited];
|
||||
int row = [outlineView selectedRow];
|
||||
className = [outlineView itemAtRow: row];
|
||||
|
||||
if ([className isKindOfClass: [GormOutletActionHolder class]])
|
||||
{
|
||||
className = [outlineView itemBeingEdited];
|
||||
}
|
||||
}
|
||||
else if([self contentView] == browserView)
|
||||
{
|
||||
className = [[browserView selectedCell] stringValue];
|
||||
}
|
||||
|
||||
return className;
|
||||
|
@ -183,9 +240,10 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
- (void) selectClass: (NSString *)className editClass: (BOOL)flag
|
||||
{
|
||||
NSString *currentClass = nil;
|
||||
NSArray *classes;
|
||||
NSArray *classes, *subclasses;
|
||||
NSEnumerator *en;
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
// abort, if we're editing a class.
|
||||
if([outlineView isEditing])
|
||||
|
@ -209,14 +267,13 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
|
||||
classes = [classManager allSuperClassesOf: className];
|
||||
en = [classes objectEnumerator];
|
||||
|
||||
// open the items...
|
||||
while ((currentClass = [en nextObject]) != nil)
|
||||
{
|
||||
[outlineView expandItem: currentClass];
|
||||
}
|
||||
|
||||
// select the item...
|
||||
// select the item in the outline view...
|
||||
row = [outlineView rowForItem: className];
|
||||
if (row != NSNotFound)
|
||||
{
|
||||
|
@ -224,6 +281,20 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
[outlineView scrollRowToVisible: row];
|
||||
}
|
||||
|
||||
// select class in browser...
|
||||
subclasses = [classManager subClassesOf: [classManager superClassNameForClassNamed: className]];
|
||||
row = [subclasses indexOfObject: className];
|
||||
col = [classes count];
|
||||
if(col > 0)
|
||||
{
|
||||
[browserView reloadColumn: col];
|
||||
if(col > 1)
|
||||
{
|
||||
[browserView reloadColumn: col - 1];
|
||||
}
|
||||
}
|
||||
[browserView selectRow: row inColumn: col];
|
||||
|
||||
if(flag)
|
||||
{
|
||||
// set the editor...
|
||||
|
@ -267,17 +338,26 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
|
||||
- (BOOL) currentSelectionIsClass
|
||||
{
|
||||
int i = [outlineView selectedRow];
|
||||
BOOL result = NO;
|
||||
|
||||
if (i >= 0 && i <= ([outlineView numberOfRows] - 1))
|
||||
|
||||
if([self contentView] == scrollView)
|
||||
{
|
||||
id object = [outlineView itemAtRow: i];
|
||||
if([object isKindOfClass: [NSString class]])
|
||||
int i = [outlineView selectedRow];
|
||||
|
||||
if (i >= 0 && i <= ([outlineView numberOfRows] - 1))
|
||||
{
|
||||
result = YES;
|
||||
id object = [outlineView itemAtRow: i];
|
||||
if([object isKindOfClass: [NSString class]])
|
||||
{
|
||||
result = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if([self contentView] == browserView)
|
||||
{
|
||||
result = YES;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -296,22 +376,29 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
{
|
||||
if (![outlineView isEditing])
|
||||
{
|
||||
NSString *newClassName;
|
||||
NSString *itemSelected = [self selectedClassName];
|
||||
|
||||
if(itemSelected != nil)
|
||||
{
|
||||
if(![itemSelected isEqualToString: @"FirstResponder"])
|
||||
NSString *newClassName;
|
||||
|
||||
newClassName = [classManager addClassWithSuperClassName:
|
||||
itemSelected];
|
||||
if(newClassName != nil)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
newClassName = [classManager addClassWithSuperClassName:
|
||||
itemSelected];
|
||||
[outlineView reloadData];
|
||||
[outlineView expandItem: itemSelected];
|
||||
i = [outlineView rowForItem: newClassName];
|
||||
[outlineView selectRow: i byExtendingSelection: NO];
|
||||
[outlineView scrollRowToVisible: i];
|
||||
if([self contentView] == scrollView)
|
||||
{
|
||||
[outlineView reloadData];
|
||||
[outlineView expandItem: itemSelected];
|
||||
i = [outlineView rowForItem: newClassName];
|
||||
[outlineView selectRow: i byExtendingSelection: NO];
|
||||
[outlineView scrollRowToVisible: i];
|
||||
}
|
||||
else if([self contentView] == browserView)
|
||||
{
|
||||
[self selectClass: newClassName editClass: NO];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -548,6 +635,7 @@ NSString *GormClassPboardType = @"GormClassPboardType";
|
|||
- (void) reloadData
|
||||
{
|
||||
[outlineView reloadData];
|
||||
// [browserView loadColumnZero];
|
||||
}
|
||||
|
||||
- (BOOL) isEditing
|
||||
|
@ -887,17 +975,8 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
- (int) outlineView: (NSOutlineView *)anOutlineView
|
||||
numberOfChildrenOfItem: (id)item
|
||||
{
|
||||
if (item == nil)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSArray *subclasses = [classManager subClassesOf: item];
|
||||
return [subclasses count];
|
||||
}
|
||||
|
||||
return 0;
|
||||
NSArray *subclasses = [classManager subClassesOf: item];
|
||||
return [subclasses count];
|
||||
}
|
||||
|
||||
- (BOOL) outlineView: (NSOutlineView *)anOutlineView
|
||||
|
@ -918,17 +997,8 @@ numberOfChildrenOfItem: (id)item
|
|||
child: (int)index
|
||||
ofItem: (id)item
|
||||
{
|
||||
if (item == nil && index == 0)
|
||||
{
|
||||
return @"NSObject";
|
||||
}
|
||||
else
|
||||
{
|
||||
NSArray *subclasses = [classManager subClassesOf: item];
|
||||
return [subclasses objectAtIndex: index];
|
||||
}
|
||||
|
||||
return nil;
|
||||
NSArray *subclasses = [classManager subClassesOf: item];
|
||||
return [subclasses objectAtIndex: index];
|
||||
}
|
||||
|
||||
// GormOutlineView data source methods...
|
||||
|
@ -1035,10 +1105,41 @@ shouldEditTableColumn: (NSTableColumn *)tableColumn
|
|||
@end // end of data source
|
||||
|
||||
@implementation GormClassEditor (NSBrowserDelegate)
|
||||
- (void) browser: (NSBrowser *)browser createRowsForColumn: (int)column inMatrix: (NSMatrix *)matrix
|
||||
{
|
||||
}
|
||||
|
||||
- (void)browser:(NSBrowser *)sender createRowsForColumn:(int)column inMatrix:(NSMatrix *)matrix
|
||||
{
|
||||
NSArray *classes = nil;
|
||||
NSEnumerator *en = nil;
|
||||
NSString *className = nil;
|
||||
int i = 0;
|
||||
|
||||
if (sender != browserView || !matrix || ![matrix isKindOfClass:[NSMatrix class]])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(column == 0)
|
||||
{
|
||||
classes = [classManager subClassesOf: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
className = [[sender selectedCellInColumn: column - 1] stringValue];
|
||||
classes = [classManager subClassesOf: className];
|
||||
}
|
||||
|
||||
en = [classes objectEnumerator];
|
||||
for(i = 0; ((className = [en nextObject]) != nil); i++)
|
||||
{
|
||||
id cell;
|
||||
NSArray *sub = [classManager subClassesOf: className];
|
||||
|
||||
[matrix insertRow:i];
|
||||
cell = [matrix cellAtRow:i column:0];
|
||||
[cell setStringValue: className];
|
||||
[cell setLeaf: ([sub count] == 0)];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -185,8 +185,9 @@
|
|||
|
||||
- (NSString *) addClassWithSuperClassName: (NSString*)name
|
||||
{
|
||||
if ([name isEqualToString: @"NSObject"]
|
||||
|| [classInformation objectForKey: name] != nil)
|
||||
if (([name isEqualToString: @"NSObject"]
|
||||
|| [classInformation objectForKey: name] != nil)
|
||||
&& [name isEqual: @"FirstResponder"] == NO)
|
||||
{
|
||||
NSMutableDictionary *classInfo;
|
||||
NSMutableArray *outlets;
|
||||
|
@ -979,12 +980,14 @@
|
|||
while ((object = [cen nextObject]))
|
||||
{
|
||||
NSDictionary *dictForClass = [classInformation objectForKey: object];
|
||||
if ([[dictForClass objectForKey: @"Super"] isEqual: superclass])
|
||||
NSString *superClassName = [dictForClass objectForKey: @"Super"];
|
||||
if ([superClassName isEqual: superclass] ||
|
||||
(superClassName == nil && superclass == nil))
|
||||
{
|
||||
[array addObject: object];
|
||||
[self allSubclassesOf: object
|
||||
referenceClassList: classList
|
||||
intoArray: array];
|
||||
referenceClassList: classList
|
||||
intoArray: array];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -993,12 +996,9 @@
|
|||
{
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
|
||||
if(superClass != nil)
|
||||
{
|
||||
[self allSubclassesOf: superClass
|
||||
referenceClassList: [classInformation allKeys]
|
||||
intoArray: array];
|
||||
}
|
||||
[self allSubclassesOf: superClass
|
||||
referenceClassList: [classInformation allKeys]
|
||||
intoArray: array];
|
||||
|
||||
return array;
|
||||
}
|
||||
|
@ -1006,19 +1006,10 @@
|
|||
- (NSArray *) allCustomSubclassesOf: (NSString *)superClass
|
||||
{
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
|
||||
if(superClass != nil)
|
||||
{
|
||||
[self allSubclassesOf: superClass
|
||||
referenceClassList: customClasses
|
||||
intoArray: array];
|
||||
}
|
||||
|
||||
// add known allowable subclasses to the list.
|
||||
// if ([superClass isEqualToString: @"NSTextField"])
|
||||
// {
|
||||
// [array addObject: @"NSSecureTextField"];
|
||||
// }
|
||||
|
||||
[self allSubclassesOf: superClass
|
||||
referenceClassList: customClasses
|
||||
intoArray: array];
|
||||
|
||||
return array;
|
||||
}
|
||||
|
@ -1052,8 +1043,9 @@
|
|||
while ((object = [cen nextObject]))
|
||||
{
|
||||
NSDictionary *dictForClass = [classInformation objectForKey: object];
|
||||
|
||||
if ([[dictForClass objectForKey: @"Super"] isEqual: superclass])
|
||||
NSString *superClassName = [dictForClass objectForKey: @"Super"];
|
||||
if ([superClassName isEqual: superclass] ||
|
||||
(superClassName == nil && superclass == nil))
|
||||
{
|
||||
[subclasses addObject: object];
|
||||
}
|
||||
|
@ -1852,7 +1844,10 @@
|
|||
if(dict != nil)
|
||||
{
|
||||
className = [dict objectForKey: @"Super"];
|
||||
[classes insertObject: className atIndex: 0];
|
||||
if(className != nil)
|
||||
{
|
||||
[classes insertObject: className atIndex: 0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ NSString *formatVersion(int version)
|
|||
|
||||
+ (int) currentVersion
|
||||
{
|
||||
return appVersion(0,9,10);
|
||||
return appVersion(0,10,0);
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
ApplicationDescription = "[GNUstep | Graphical] Object Relationship Modeller";
|
||||
ApplicationIcon = "Gorm.tiff";
|
||||
ApplicationName = "Gorm";
|
||||
ApplicationRelease = "Gorm 0.9.10 (Alpha)";
|
||||
ApplicationRelease = "Gorm 0.10.0 (Alpha)";
|
||||
Authors = ("Gregory John Casamento <greg_casamento@yahoo.com>","Richard Frith-Macdonald <rfm@gnu.org>","Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>");
|
||||
Copyright = "Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 FSF";
|
||||
CopyrightDescription = "Released under the GNU General Public License 2.0";
|
||||
NSBuildVersion = "0.9.10 May 19 2005";
|
||||
NSBuildVersion = "0.10.0 May 20 2005";
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
id inspectorButton;
|
||||
id palettesButton;
|
||||
id archiveMatrix;
|
||||
id interfaceMatrix;
|
||||
|
||||
id _view;
|
||||
}
|
||||
|
@ -20,6 +21,7 @@
|
|||
- (void) inspectorAction: (id)sender;
|
||||
- (void) backupAction: (id)sender;
|
||||
- (void) archiveAction: (id)sender;
|
||||
- (void) classesAction: (id)sender;
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -1,18 +1,44 @@
|
|||
/* GormGeneralPref.m
|
||||
*
|
||||
* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 2003, 2004, 2005
|
||||
*
|
||||
* 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 "GormGeneralPref.h"
|
||||
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
|
||||
#include <AppKit/NSButtonCell.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSMatrix.h>
|
||||
|
||||
#include <GormCore/GormClassEditor.h>
|
||||
|
||||
static NSString *SHOWPALETTES=@"ShowPalettes";
|
||||
static NSString *SHOWINSPECTOR=@"ShowInspectors";
|
||||
static NSString *BACKUPFILE=@"BackupFile";
|
||||
static NSString *ARCTYPE=@"ArchiveType";
|
||||
|
||||
static NSString *INTTYPE=@"ClassViewType";
|
||||
|
||||
@implementation GormGeneralPref
|
||||
|
||||
|
@ -38,8 +64,8 @@ static NSString *ARCTYPE=@"ArchiveType";
|
|||
[inspectorButton setState: [defaults integerForKey: SHOWINSPECTOR]];
|
||||
[palettesButton setState: [defaults integerForKey: SHOWPALETTES]];
|
||||
[backupButton setState: [defaults integerForKey: BACKUPFILE]];
|
||||
|
||||
|
||||
// set the archive matrix...
|
||||
if([arcType isEqual: @"Typed"])
|
||||
{
|
||||
[archiveMatrix setState: NSOnState atRow: 0 column: 0];
|
||||
|
@ -59,6 +85,17 @@ static NSString *ARCTYPE=@"ArchiveType";
|
|||
[archiveMatrix setState: NSOnState atRow: 2 column: 0];
|
||||
}
|
||||
|
||||
// set the archive matrix...
|
||||
if([arcType isEqual: @"Outline"])
|
||||
{
|
||||
[interfaceMatrix setState: NSOnState atRow: 0 column: 0];
|
||||
[interfaceMatrix setState: NSOffState atRow: 1 column: 0];
|
||||
}
|
||||
else if([arcType isEqual: @"Browser"])
|
||||
{
|
||||
[interfaceMatrix setState: NSOffState atRow: 0 column: 0];
|
||||
[interfaceMatrix setState: NSOnState atRow: 1 column: 0];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -136,5 +173,31 @@ static NSString *ARCTYPE=@"ArchiveType";
|
|||
[defaults synchronize];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) classesAction: (id)sender
|
||||
{
|
||||
if (sender != interfaceMatrix)
|
||||
return;
|
||||
else
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if([[interfaceMatrix cellAtRow: 0 column: 0] state] == NSOnState)
|
||||
{
|
||||
[defaults setObject: @"Outline" forKey: INTTYPE];
|
||||
}
|
||||
else if([[interfaceMatrix cellAtRow: 1 column: 0] state] == NSOnState)
|
||||
{
|
||||
[defaults setObject: @"Browser" forKey: INTTYPE];
|
||||
}
|
||||
|
||||
// let the world know it's changed.
|
||||
[nc postNotificationName: GormSwitchViewPreferencesNotification
|
||||
object: nil];
|
||||
|
||||
[defaults synchronize];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
4Data.palette
|
||||
);
|
||||
CellSizeWidth = 72;
|
||||
ClassViewType = Outline;
|
||||
GuideColor = {
|
||||
alpha = 1;
|
||||
blue = 0;
|
||||
|
|
Loading…
Reference in a new issue