* English.lproj/GormClassEditor.gorm: Make button momentary push

and remove the image.
        * English.lproj/GormPrefGeneral.gorm: Change box title.
        * GormCore/GormClassEditor.[hm]: Change switchView to 
        switchViewToDefault, add method toggleView:, add code to change
        image as appropriate.
        * GormPrefs/GormGeneralPref.m: Remove notification in classesAction:
        so that the default changes don't effect all class editors.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23841 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-10-11 00:58:56 +00:00
parent c6a2cea11f
commit 94708f88b1
8 changed files with 45 additions and 16 deletions

View file

@ -1,3 +1,14 @@
2006-10-10 20:56-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormClassEditor.gorm: Make button momentary push
and remove the image.
* English.lproj/GormPrefGeneral.gorm: Change box title.
* GormCore/GormClassEditor.[hm]: Change switchView to
switchViewToDefault, add method toggleView:, add code to change
image as appropriate.
* GormPrefs/GormGeneralPref.m: Remove notification in classesAction:
so that the default changes don't effect all class editors.
2006-10-10 00:37-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormClassEditor.gorm: Aligned the toggle with

View file

@ -22,7 +22,8 @@
);
Outlets = (
classesView,
mainView
mainView,
viewToggle
);
Super = NSView;
};

View file

@ -44,6 +44,7 @@ extern NSString *GormSwitchViewPreferencesNotification;
NSBrowser *browserView;
id classesView;
id mainView;
id viewToggle;
}
- (GormClassEditor*) initWithDocument: (GormDocument*)doc;
+ (GormClassEditor*) classEditorForDocument: (GormDocument*)doc;

View file

@ -34,6 +34,8 @@
NSString *GormClassPboardType = @"GormClassPboardType";
NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNotification";
NSImage *outlineImage = nil;
NSImage *browserImage = nil;
@interface GormOutlineView (PrivateMethods)
- (void) _addNewActionToObject: (id)item;
@ -43,12 +45,21 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
@interface GormClassEditor (PrivateMethods)
- (void) browserClick: (id)sender;
- (void) toggleView: (id) sender;
- (void) switchView;
- (void) switchViewToDefault;
- (void) handleNotification: (NSNotification *)notification;
@end
@implementation GormClassEditor
+ (void) initialize
{
if(self == [GormClassEditor class])
{
outlineImage = [NSImage imageNamed: @"outlineView"];
browserImage = [NSImage imageNamed: @"browserView"];
}
}
- (GormClassEditor*) initWithDocument: (GormDocument*)doc
{
self = [super init];
@ -168,7 +179,7 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
[classesView sizeToFit];
// switch...
[self switchView];
[self switchViewToDefault];
// register for types...
[IBResourceManager registerForAllPboardTypes: self
@ -189,22 +200,25 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
- (void) toggleView: (id) sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *viewType = [ud stringForKey: @"ClassViewType"];
if([viewType isEqual: @"Outline"] || viewType == nil)
id contentView = [classesView contentView];
if(contentView == browserView)
{
[ud setObject: @"Browser" forKey: @"ClassViewType"];
NSRect rect = [classesView frame];
[classesView setContentView: scrollView];
[outlineView setFrame: rect];
[outlineView sizeToFit];
[viewToggle setImage: browserImage];
}
else if([viewType isEqual: @"Browser"] || viewType == nil)
else if(contentView == scrollView)
{
[ud setObject: @"Outline" forKey: @"ClassViewType"];
[classesView setContentView: browserView];
[viewToggle setImage: outlineImage];
}
[self switchView];
[self setSelectedClassName: selectedClass];
}
- (void) switchView
- (void) switchViewToDefault
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *viewType = [ud stringForKey: @"ClassViewType"];
@ -215,10 +229,12 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
[classesView setContentView: scrollView];
[outlineView setFrame: rect];
[outlineView sizeToFit];
[viewToggle setImage: browserImage];
}
else if([viewType isEqual: @"Browser"])
{
[classesView setContentView: browserView];
[viewToggle setImage: outlineImage];
}
[self setSelectedClassName: selectedClass];
@ -228,7 +244,7 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
{
if([[notification name] isEqualToString: GormSwitchViewPreferencesNotification])
{
[self switchView];
[self switchViewToDefault];
}
}

View file

@ -105,7 +105,7 @@ static NSString *INTTYPE=@"ClassViewType";
else
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
// NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
if([[interfaceMatrix cellAtRow: 0 column: 0] state] == NSOnState)
{
@ -117,8 +117,8 @@ static NSString *INTTYPE=@"ClassViewType";
}
// let the world know it's changed.
[nc postNotificationName: GormSwitchViewPreferencesNotification
object: nil];
// [nc postNotificationName: GormSwitchViewPreferencesNotification
// object: nil];
}
}