Bugfix for button/textview problem and bugfix for NSSecureTextField problem.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21123 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-04-18 00:54:54 +00:00
parent 6a0a061693
commit 42aeea536e
4 changed files with 61 additions and 9 deletions

View file

@ -1,3 +1,14 @@
2005-04-17 20:46 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormCustomClassInspector.m: In _replaceCellClassForObject:
className: corrected a problem where the drawBackground flag
is set to NO when changing the cell type. It is now preserved when
the new cell object is set.
* Palettes/2Controls/GormButtonEditor.h: Added ivar.
* Palettes/2Controls/GormButtonEditor.m: Corrects a bug reported
by Matt Rice where the temporary text field becomes part of
the document when saving while editing a button.
2005-04-17 12:06 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Added code in loadDocument: and

View file

@ -125,6 +125,7 @@
{
NSCell *cell = [obj cell];
NSCell *newCell = nil;
BOOL drawsBackground = [object drawsBackground];
// instantiate the cell...
if([name isEqualToString: @"NSSecureTextField"])
@ -140,7 +141,6 @@
[newCell setFont: [cell font]];
[newCell setEnabled: [cell isEnabled]];
[newCell setEditable: [cell isEditable]];
// [newCell setRichText: [cell isRichText]];
[newCell setImportsGraphics: [cell importsGraphics]];
[newCell setShowsFirstResponder: [cell showsFirstResponder]];
[newCell setRefusesFirstResponder: [cell refusesFirstResponder]];
@ -150,7 +150,9 @@
[newCell setSelectable: [cell isSelectable]];
[newCell setState: [cell state]];
// set attributes of textfield.
[object setCell: newCell];
[object setDrawsBackground: drawsBackground];
}
}

View file

@ -26,8 +26,11 @@
#include <GormCore/GormControlEditor.h>
@class NSTextView;
@interface GormButtonEditor : GormControlEditor
{
NSTextView *tempTextView;
}
@end

View file

@ -266,6 +266,8 @@ static NSRect oldFrame;
@implementation GormButtonEditor
- (void) handleNotification: (NSNotification*)aNotification
{
NSString *name = [aNotification name];
@ -273,6 +275,21 @@ static NSRect oldFrame;
{
done_editing = YES;
}
else if([name isEqual: IBWillSaveDocumentNotification] == YES)
{
done_editing = YES;
[[NSNotificationCenter defaultCenter]
removeObserver: self
name: IBWillSaveDocumentNotification
object: nil];
[tempTextView resignFirstResponder];
[tempTextView removeFromSuperview];
[tempTextView setDelegate: nil];
tempTextView = nil;
}
}
- (void) textDidChange: (NSNotification *)aNotification
@ -305,6 +322,11 @@ static NSRect oldFrame;
[[self window] flushWindow];
}
}
[[NSNotificationCenter defaultCenter]
removeObserver: self
name: NSViewFrameDidChangeNotification
object: nil];
}
@ -331,9 +353,9 @@ static NSRect oldFrame;
[editField setDrawsBackground: YES];
[nc addObserver: self
selector: @selector(handleNotification:)
name: NSControlTextDidEndEditingNotification
object: nil];
selector: @selector(handleNotification:)
name: NSControlTextDidEndEditingNotification
object: nil];
/* Do some modal editing */
[editField selectText: self];
@ -387,6 +409,7 @@ static NSRect oldFrame;
[editField setEditable: wasEditable];
[editField setDrawsBackground: didDrawBackground];
[nc removeObserver: self
name: NSControlTextDidEndEditingNotification
object: nil];
@ -394,6 +417,8 @@ static NSRect oldFrame;
[[editField currentEditor] resignFirstResponder];
[self setNeedsDisplay: YES];
tempTextView = nil;
return e;
}
@ -401,11 +426,13 @@ static NSRect oldFrame;
{
NSTextView *textView = [[NSTextView alloc] initWithFrame: frame];
NSTextContainer *textContainer = [textView textContainer];
tempTextView = textView;
[textContainer setContainerSize: NSMakeSize(3000, NSHeight([textView frame]))];
[textContainer setWidthTracksTextView: NO];
[textContainer setHeightTracksTextView: NO];
[textView setMinSize: frame.size];
[textView setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin];
[textView setSelectable: YES];
@ -416,10 +443,19 @@ static NSRect oldFrame;
[textView setHorizontallyResizable: YES];
[textView setDelegate: self];
[textView setPostsFrameChangedNotifications:YES];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(textViewFrameChanged:)
name: NSViewFrameDidChangeNotification
object: textView];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(textViewFrameChanged:)
name: NSViewFrameDidChangeNotification
object: textView];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(handleNotification:)
name: IBWillSaveDocumentNotification
object: nil];
oldFrame = frame;
return textView;
}