Set target/action for all NSForms in inspectors.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@11290 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-11-02 04:59:43 +00:00
parent 1da155b9d1
commit c9b7a1cc94
15 changed files with 30 additions and 153 deletions

View file

@ -1,3 +1,15 @@
2001-11-01 Adam Fedor <fedor@gnu.org>
* GormDocument.m ([GormDocument -openDocument:]): Open file
from current dir.
* Palettes/1Windows/main.m: Set action/target to ok: in NSForms in
GormWindowInspector and GormWindowSizeInspector. Remove all
TextDidEndEditing Notifications.
* Palettes/2Controls/inspectors.m: Likewise for all control
inspectors. Also make sure all setStringValue: messages get sent
a non-nil string.
2001-10-30 Richard Frith-Macdonald <rfm@gnu.org> 2001-10-30 Richard Frith-Macdonald <rfm@gnu.org>
* GormWindowEditor.m: Fixed various drawing glitches when managing * GormWindowEditor.m: Fixed various drawing glitches when managing

View file

@ -1277,7 +1277,7 @@ static NSImage *classesImage = nil;
[oPanel setAllowsMultipleSelection: NO]; [oPanel setAllowsMultipleSelection: NO];
[oPanel setCanChooseFiles: YES]; [oPanel setCanChooseFiles: YES];
[oPanel setCanChooseDirectories: NO]; [oPanel setCanChooseDirectories: NO];
result = [oPanel runModalForDirectory: NSHomeDirectory() result = [oPanel runModalForDirectory: nil
file: nil file: nil
types: fileTypes]; types: fileTypes];
if (result == NSOKButton) if (result == NSOKButton)

View file

@ -11,6 +11,9 @@
}; };
IBInspector = { IBInspector = {
Actions = ( Actions = (
ok:,
revert:,
touch:
); );
Outlets = ( Outlets = (
); );
@ -27,11 +30,11 @@
}; };
NSControl = { NSControl = {
Actions = ( Actions = (
"takeDoubleValueFrom:", takeDoubleValueFrom:,
"takeFloatValueFrom:", takeFloatValueFrom:,
"takeIntValueFrom:", takeIntValueFrom:,
"takeObjectValueFrom:", takeObjectValueFrom:,
"takeStringValueFrom:" takeStringValueFrom:
); );
Outlets = ( Outlets = (
target target

View file

@ -283,15 +283,8 @@ NSwindow inspector
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
[super dealloc]; [super dealloc];
} }
@ -306,12 +299,6 @@ NSwindow inspector
NSLog(@"Could not gorm GormWindowInspector"); NSLog(@"Could not gorm GormWindowInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -378,12 +365,6 @@ NSwindow inspector
[[minForm cellAtIndex: 1] setFloatValue: size.height]; [[minForm cellAtIndex: 1] setFloatValue: size.height];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) windowChangeNotification: (NSNotification*)aNotification - (void) windowChangeNotification: (NSNotification*)aNotification
{ {
id notifier = [aNotification object]; id notifier = [aNotification object];
@ -418,11 +399,6 @@ NSwindow inspector
selector: @selector(windowChangeNotification:) selector: @selector(windowChangeNotification:)
name: NSWindowDidResizeNotification name: NSWindowDidResizeNotification
object: object]; object: object];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }

View file

@ -26,6 +26,9 @@
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include "../../GormPrivate.h" #include "../../GormPrivate.h"
/* This macro makes sure that the string contains a value, even if @"" */
#define VSTR(str) ({id _str = str; (_str) ? _str : @"";})
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* NSBox * NSBox
*/ */
@ -84,21 +87,13 @@
} }
[positionMatrix selectCellWithTag: [anObject titlePosition]]; [positionMatrix selectCellWithTag: [anObject titlePosition]];
[borderMatrix selectCellWithTag: [anObject borderType]]; [borderMatrix selectCellWithTag: [anObject borderType]];
[[titleField cellAtIndex: 0] setStringValue: [anObject title]]; [[titleField cellAtIndex: 0] setStringValue: VSTR([anObject title])];
[horizontalSlider setFloatValue: [anObject contentViewMargins].width]; [horizontalSlider setFloatValue: [anObject contentViewMargins].width];
[verticalSlider setFloatValue: [anObject contentViewMargins].height]; [verticalSlider setFloatValue: [anObject contentViewMargins].height];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
[super dealloc]; [super dealloc];
} }
@ -114,11 +109,6 @@
NSLog(@"Could not gorm GormBoxInspector"); NSLog(@"Could not gorm GormBoxInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -296,7 +286,7 @@
} }
[alignMatrix selectCellWithTag: [anObject alignment]]; [alignMatrix selectCellWithTag: [anObject alignment]];
[iconMatrix selectCellWithTag: [anObject imagePosition]]; [iconMatrix selectCellWithTag: [anObject imagePosition]];
[[keyField cellAtIndex: 0] setStringValue: [anObject keyEquivalent]]; [[keyField cellAtIndex: 0] setStringValue: VSTR([anObject keyEquivalent])];
[optionMatrix deselectAllCells]; [optionMatrix deselectAllCells];
if ([anObject isBordered]) if ([anObject isBordered])
@ -312,13 +302,13 @@
[[tagField cellAtIndex: 0] setIntValue: [anObject tag]]; [[tagField cellAtIndex: 0] setIntValue: [anObject tag]];
[[titleForm cellAtIndex: 0] setStringValue: [anObject title]]; [[titleForm cellAtIndex: 0] setStringValue: VSTR([anObject title])];
[[titleForm cellAtIndex: 1] setStringValue: [anObject alternateTitle]]; [[titleForm cellAtIndex: 1] setStringValue: VSTR([anObject alternateTitle])];
image = [anObject image]; image = [anObject image];
if (image != nil) if (image != nil)
{ {
[[titleForm cellAtIndex: 2] setStringValue: [image name]]; [[titleForm cellAtIndex: 2] setStringValue: VSTR([image name])];
} }
else else
{ {
@ -328,7 +318,7 @@
image = [anObject alternateImage]; image = [anObject alternateImage];
if (image != nil) if (image != nil)
{ {
[[titleForm cellAtIndex: 3] setStringValue: [image name]]; [[titleForm cellAtIndex: 3] setStringValue: VSTR([image name])];
} }
else else
{ {
@ -339,16 +329,8 @@
[typeButton indexOfItemWithTag: [self buttonTypeForObject: anObject]]]; [typeButton indexOfItemWithTag: [self buttonTypeForObject: anObject]]];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
RELEASE(okButton); RELEASE(okButton);
[super dealloc]; [super dealloc];
@ -365,11 +347,6 @@
NSLog(@"Could not gorm GormButtonInspector"); NSLog(@"Could not gorm GormButtonInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
/* Need to set up popup button */ /* Need to set up popup button */
[typeButton removeAllItems]; [typeButton removeAllItems];
@ -474,16 +451,8 @@
[[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag]]; [[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag]];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
[super dealloc]; [super dealloc];
} }
@ -499,11 +468,6 @@
NSLog(@"Could not gorm GormCellInspector"); NSLog(@"Could not gorm GormCellInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -656,16 +620,8 @@
[[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag]]; [[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag]];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
[super dealloc]; [super dealloc];
} }
@ -681,11 +637,6 @@
NSLog(@"Could not gorm GormFormInspector"); NSLog(@"Could not gorm GormFormInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -834,16 +785,8 @@
[[tagForm cellAtIndex: 0] setIntValue: [anObject tag]]; [[tagForm cellAtIndex: 0] setIntValue: [anObject tag]];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
RELEASE(okButton); RELEASE(okButton);
[super dealloc]; [super dealloc];
@ -860,11 +803,6 @@
NSLog(@"Could not gorm GormMatrixInspector"); NSLog(@"Could not gorm GormMatrixInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -931,16 +869,8 @@
[[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag]]; [[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag]];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
[super dealloc]; [super dealloc];
} }
@ -956,11 +886,6 @@
NSLog(@"Could not gorm GormPopUpButtonInspector"); NSLog(@"Could not gorm GormPopUpButtonInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -1066,16 +991,8 @@
[[tagForm cellAtIndex: 0] setIntValue: [[anObject cell] tag]]; [[tagForm cellAtIndex: 0] setIntValue: [[anObject cell] tag]];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
[super dealloc]; [super dealloc];
} }
@ -1091,11 +1008,6 @@
NSLog(@"Could not gorm GormSliderInspector"); NSLog(@"Could not gorm GormSliderInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -1209,16 +1121,8 @@
[valueWrapsButton setState: 0]; [valueWrapsButton setState: 0];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
[super dealloc]; [super dealloc];
} }
@ -1235,11 +1139,6 @@
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }
@ -1402,16 +1301,8 @@
[[tagForm cellAtIndex: 0] setIntValue: [anObject tag]]; [[tagForm cellAtIndex: 0] setIntValue: [anObject tag]];
} }
- (void) controlTextDidEndEditing: (NSNotification*)aNotification
{
id notifier = [aNotification object];
[self _setValuesFromControl: notifier];
}
- (void) dealloc - (void) dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(window); RELEASE(window);
RELEASE(okButton); RELEASE(okButton);
[super dealloc]; [super dealloc];
@ -1429,11 +1320,6 @@
NSLog(@"Could not gorm GormTextFieldInspector"); NSLog(@"Could not gorm GormTextFieldInspector");
return nil; return nil;
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(controlTextDidEndEditing:)
name: NSControlTextDidEndEditingNotification
object: nil];
return self; return self;
} }