mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 07:20:58 +00:00
Fixes galore!
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4737 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d1acdb324d
commit
a009de9b2d
7 changed files with 56 additions and 55 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
1999-08-21 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
|
* Source/NSCell.m: lots of fixes to editWithFrame, and fieldEditor
|
||||||
|
related methods.
|
||||||
|
* Source/NSText.m: caret drawing now works.
|
||||||
|
* Source/NSTextField.m: fixes to allow for single click and type
|
||||||
|
usage of textFields.
|
||||||
|
* Source/NSView.m: fixed bug in viewWillMoveToWindow: which could
|
||||||
|
cause an X11 protocol error in the backend.
|
||||||
|
|
||||||
1999-08-20 Michael Hanni <mhanni@sprintmail.com>
|
1999-08-20 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
* Source/NSSlider.m: added missing [self unlockFocus];.
|
* Source/NSSlider.m: added missing [self unlockFocus];.
|
||||||
|
|
|
@ -270,6 +270,8 @@
|
||||||
encoded. */
|
encoded. */
|
||||||
upperObjectRepresentation = lastObjectRepresentation;
|
upperObjectRepresentation = lastObjectRepresentation;
|
||||||
|
|
||||||
|
// Removed by patch, was archiving templates and all kinds of naughty
|
||||||
|
// stuff.
|
||||||
// anObject = [anObject replacementObjectForModelArchiver: self];
|
// anObject = [anObject replacementObjectForModelArchiver: self];
|
||||||
archiveClass = [anObject classForModelArchiver];
|
archiveClass = [anObject classForModelArchiver];
|
||||||
|
|
||||||
|
|
|
@ -427,47 +427,22 @@ static Class imageClass;
|
||||||
delegate: (id)anObject
|
delegate: (id)anObject
|
||||||
event: (NSEvent *)theEvent
|
event: (NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
NSRect bRect;
|
if (!controlView || !textObject || !cell_font ||
|
||||||
|
(cell_type != NSTextCellType))
|
||||||
if (cell_type != NSTextCellType)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[controlView lockFocus];
|
|
||||||
[[controlView window] makeFirstResponder: textObject];
|
|
||||||
|
|
||||||
bRect = [controlView convertRect:aRect toView:[[controlView window] contentView]];
|
|
||||||
// cellFrame.origin = [super_view convertPoint: frame.origin
|
|
||||||
// toView: [window contentView]];
|
|
||||||
|
|
||||||
NSLog(@"editWithFrame: aRect. x = %d, y = %d, width = %d, height = %d\n",
|
|
||||||
(int)aRect.origin.x,
|
|
||||||
(int)aRect.origin.y,
|
|
||||||
(int)aRect.size.width,
|
|
||||||
(int)aRect.size.height);
|
|
||||||
|
|
||||||
NSLog(@"editWithFrame: bRect. x = %d, y = %d, width = %d, height = %d\n",
|
|
||||||
(int)bRect.origin.x,
|
|
||||||
(int)bRect.origin.y,
|
|
||||||
(int)bRect.size.width,
|
|
||||||
(int)bRect.size.height);
|
|
||||||
|
|
||||||
bRect.origin.x -= 2;
|
|
||||||
bRect.size.width += 2;
|
|
||||||
|
|
||||||
[textObject setDelegate: anObject];
|
[textObject setDelegate: anObject];
|
||||||
|
|
||||||
[textObject setFrame: bRect];
|
aRect.origin.y -= 1;
|
||||||
NSEraseRect(aRect);
|
|
||||||
|
|
||||||
|
[textObject setFrame: aRect];
|
||||||
[textObject setText: [self stringValue]];
|
[textObject setText: [self stringValue]];
|
||||||
|
[controlView addSubview:textObject];
|
||||||
|
|
||||||
[[[controlView window] contentView] addSubview: textObject];
|
[[controlView window] makeFirstResponder: textObject];
|
||||||
|
|
||||||
if ([theEvent type] == NSLeftMouseDown)
|
if ([theEvent type] == NSLeftMouseDown)
|
||||||
[textObject mouseDown:theEvent];
|
[textObject mouseDown:theEvent];
|
||||||
|
|
||||||
[textObject display];
|
|
||||||
[controlView unlockFocus];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -477,6 +452,7 @@ static Class imageClass;
|
||||||
- (void) endEditing: (NSText*)textObject
|
- (void) endEditing: (NSText*)textObject
|
||||||
{
|
{
|
||||||
[textObject setDelegate: nil];
|
[textObject setDelegate: nil];
|
||||||
|
[textObject retain];
|
||||||
[textObject removeFromSuperview];
|
[textObject removeFromSuperview];
|
||||||
[self setStringValue: [textObject text]];
|
[self setStringValue: [textObject text]];
|
||||||
[textObject setString:@""];
|
[textObject setString:@""];
|
||||||
|
@ -807,6 +783,8 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
||||||
{
|
{
|
||||||
NSView *cv = [NSView focusView];
|
NSView *cv = [NSView focusView];
|
||||||
|
|
||||||
|
NSLog(@"performClick:");
|
||||||
|
|
||||||
[self highlight: YES withFrame: [cv frame] inView: cv];
|
[self highlight: YES withFrame: [cv frame] inView: cv];
|
||||||
if ([self action])
|
if ([self action])
|
||||||
{
|
{
|
||||||
|
|
|
@ -662,8 +662,9 @@ nil];
|
||||||
plainContent=[[NSMutableString stringWithString:string] retain];
|
plainContent=[[NSMutableString stringWithString:string] retain];
|
||||||
[lineLayoutInformation autorelease]; lineLayoutInformation=nil; // force complete re-layout
|
[lineLayoutInformation autorelease]; lineLayoutInformation=nil; // force complete re-layout
|
||||||
[self setRichText:NO];
|
[self setRichText:NO];
|
||||||
|
[self setSelectedRangeNoDrawing:NSMakeRange(0,0)];
|
||||||
[self setNeedsDisplay:YES];
|
// [self rebuildLineLayoutInformationStartingAtLine:0];
|
||||||
|
// [self setNeedsDisplay:YES];
|
||||||
}
|
}
|
||||||
-(void) setText:(NSString *)string {[self setString:string];}
|
-(void) setText:(NSString *)string {[self setString:string];}
|
||||||
|
|
||||||
|
@ -845,7 +846,8 @@ NSLog(@"did set font");
|
||||||
}
|
}
|
||||||
-(void) drawInsertionPointAtIndex:(unsigned)index color:(NSColor *)color turnedOn:(BOOL)flag
|
-(void) drawInsertionPointAtIndex:(unsigned)index color:(NSColor *)color turnedOn:(BOOL)flag
|
||||||
{ NSRect startRect=[self rectForCharacterIndex:index];
|
{ NSRect startRect=[self rectForCharacterIndex:index];
|
||||||
[self drawInsertionPointInRect:NSMakeRect(startRect.origin.x, startRect.origin.y,0.5,startRect.size.height)
|
// [self drawInsertionPointInRect:NSMakeRect(startRect.origin.x, startRect.origin.y,0.5,startRect.size.height)
|
||||||
|
[self drawInsertionPointInRect:NSMakeRect(startRect.origin.x, startRect.origin.y,1,startRect.size.height)
|
||||||
color:[NSColor blackColor] turnedOn:flag];
|
color:[NSColor blackColor] turnedOn:flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,8 +989,6 @@ NSLog(@"did set font");
|
||||||
{
|
{
|
||||||
NSRect sizeToRect=[self frame];
|
NSRect sizeToRect=[self frame];
|
||||||
|
|
||||||
NSLog(@"- sizeToFit called.\n");
|
|
||||||
|
|
||||||
if ([self isFieldEditor]) // if we are a field editor we don't have to handle the size.
|
if ([self isFieldEditor]) // if we are a field editor we don't have to handle the size.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1244,7 +1244,8 @@ currentCursorY=[self rectForCharacterIndex:NSMaxRange([self selectedRange])].ori
|
||||||
//<!> make this non-blocking (or make use of timed entries)
|
//<!> make this non-blocking (or make use of timed entries)
|
||||||
for(currentEvent= [[self window] nextEventMatchingMask:NSLeftMouseDraggedMask|NSLeftMouseUpMask];[currentEvent type] != NSLeftMouseUp;
|
for(currentEvent= [[self window] nextEventMatchingMask:NSLeftMouseDraggedMask|NSLeftMouseUpMask];[currentEvent type] != NSLeftMouseUp;
|
||||||
(currentEvent= [[self window] nextEventMatchingMask:NSLeftMouseDraggedMask|NSLeftMouseUpMask]), prevChosenRange=chosenRange) // run modal loop
|
(currentEvent= [[self window] nextEventMatchingMask:NSLeftMouseDraggedMask|NSLeftMouseUpMask]), prevChosenRange=chosenRange) // run modal loop
|
||||||
{ BOOL didScroll=[self autoscroll:currentEvent];
|
{
|
||||||
|
BOOL didScroll= [self autoscroll:currentEvent];
|
||||||
point = [self convertPoint:[currentEvent locationInWindow] fromView:nil];
|
point = [self convertPoint:[currentEvent locationInWindow] fromView:nil];
|
||||||
proposedRange=MakeRangeFromAbs([self characterIndexForPoint:point],startIndex);
|
proposedRange=MakeRangeFromAbs([self characterIndexForPoint:point],startIndex);
|
||||||
chosenRange=[self selectionRangeForProposedRange:proposedRange granularity:granularity];
|
chosenRange=[self selectionRangeForProposedRange:proposedRange granularity:granularity];
|
||||||
|
@ -1256,7 +1257,6 @@ currentCursorY=[self rectForCharacterIndex:NSMaxRange([self selectedRange])].ori
|
||||||
}
|
}
|
||||||
else continue;
|
else continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this changes the selection without needing instance drawing (carefully thought out ;-)
|
// this changes the selection without needing instance drawing (carefully thought out ;-)
|
||||||
if(!didScroll)
|
if(!didScroll)
|
||||||
{ [self drawSelectionAsRangeNoCaret:MakeRangeFromAbs(MIN(chosenRange.location, prevChosenRange.location),
|
{ [self drawSelectionAsRangeNoCaret:MakeRangeFromAbs(MIN(chosenRange.location, prevChosenRange.location),
|
||||||
|
@ -1282,7 +1282,6 @@ currentCursorY=[self rectForCharacterIndex:NSMaxRange([self selectedRange])].ori
|
||||||
|
|
||||||
currentCursorX=[self rectForCharacterIndex:chosenRange.location].origin.x; // remember for column stable cursor up/down
|
currentCursorX=[self rectForCharacterIndex:chosenRange.location].origin.x; // remember for column stable cursor up/down
|
||||||
currentCursorY=[self rectForCharacterIndex:chosenRange.location].origin.y; // remember for column stable cursor up/down
|
currentCursorY=[self rectForCharacterIndex:chosenRange.location].origin.y; // remember for column stable cursor up/down
|
||||||
|
|
||||||
[self unlockFocus];
|
[self unlockFocus];
|
||||||
[[self window] flushWindow];
|
[[self window] flushWindow];
|
||||||
}
|
}
|
||||||
|
@ -1491,6 +1490,17 @@ NSLog(NSStringFromRange(redrawLineRange));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/* fixme */
|
||||||
|
case 0x09:
|
||||||
|
if ([self isFieldEditor])
|
||||||
|
{
|
||||||
|
[[self window] makeFirstResponder:[self nextResponder]];
|
||||||
|
[self textDidEndEditing:[NSNotification
|
||||||
|
notificationWithName:NSTextDidEndEditingNotification object:self
|
||||||
|
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:NSTabTextMovement],@"NSTextMovement",nil]]];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fixme */
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
NSLog(@"keycode:%x",keyCode);
|
NSLog(@"keycode:%x",keyCode);
|
||||||
|
@ -1509,9 +1519,9 @@ NSLog(@"keycode:%x",keyCode);
|
||||||
-(BOOL) resignFirstResponder
|
-(BOOL) resignFirstResponder
|
||||||
{ if([self shouldDrawInsertionPoint])
|
{ if([self shouldDrawInsertionPoint])
|
||||||
{
|
{
|
||||||
[self lockFocus];
|
// [self lockFocus];
|
||||||
[self drawInsertionPointAtIndex:[self selectedRange].location color:nil turnedOn:NO];
|
[self drawInsertionPointAtIndex:[self selectedRange].location color:nil turnedOn:NO];
|
||||||
[self unlockFocus];
|
// [self unlockFocus];
|
||||||
|
|
||||||
//<!> stop timed entry
|
//<!> stop timed entry
|
||||||
}
|
}
|
||||||
|
@ -1520,13 +1530,14 @@ NSLog(@"keycode:%x",keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL) becomeFirstResponder
|
-(BOOL) becomeFirstResponder
|
||||||
{ if([self shouldDrawInsertionPoint])
|
{
|
||||||
{
|
// if([self shouldDrawInsertionPoint])
|
||||||
|
// {
|
||||||
// [self lockFocus];
|
// [self lockFocus];
|
||||||
[self drawInsertionPointAtIndex:[self selectedRange].location color:[NSColor blackColor] turnedOn:YES];
|
// [self drawInsertionPointAtIndex:[self selectedRange].location color:[NSColor blackColor] turnedOn:YES];
|
||||||
// [self unlockFocus];
|
// [self unlockFocus];
|
||||||
//<!> restart timed entry
|
// //<!> restart timed entry
|
||||||
}
|
// }
|
||||||
if([self isEditable] && [self textShouldBeginEditing:(NSText*)self]) return YES;
|
if([self isEditable] && [self textShouldBeginEditing:(NSText*)self]) return YES;
|
||||||
else return NO;
|
else return NO;
|
||||||
}
|
}
|
||||||
|
@ -1936,7 +1947,7 @@ NSLog(@"opti hook 1 (preferred)");
|
||||||
else if(currentLineIndex-1 == insertionLineIndex && ABS(insertionDelta)== 1)
|
else if(currentLineIndex-1 == insertionLineIndex && ABS(insertionDelta)== 1)
|
||||||
{ erg=2; // return 2: redisplay only this and previous line
|
{ erg=2; // return 2: redisplay only this and previous line
|
||||||
}
|
}
|
||||||
#if 1
|
#if 0
|
||||||
NSLog(@"opti for:%d",erg);
|
NSLog(@"opti for:%d",erg);
|
||||||
#endif
|
#endif
|
||||||
return erg;
|
return erg;
|
||||||
|
|
|
@ -91,6 +91,7 @@ id _nsTextfieldCellClass = nil;
|
||||||
[cell setState: 1];
|
[cell setState: 1];
|
||||||
[cell setBezeled: YES];
|
[cell setBezeled: YES];
|
||||||
[cell setSelectable: YES];
|
[cell setSelectable: YES];
|
||||||
|
[cell setEnabled: YES];
|
||||||
[cell setEditable: YES];
|
[cell setEditable: YES];
|
||||||
[cell setDrawsBackground: YES];
|
[cell setDrawsBackground: YES];
|
||||||
text_cursor = [[NSCursor IBeamCursor] retain];
|
text_cursor = [[NSCursor IBeamCursor] retain];
|
||||||
|
@ -373,7 +374,7 @@ fprintf(stderr, " TextField mouseDown --- ");
|
||||||
unsigned int key_code = [theEvent keyCode];
|
unsigned int key_code = [theEvent keyCode];
|
||||||
id nextResponder;
|
id nextResponder;
|
||||||
|
|
||||||
NSDebugLog(@"NSTextField: -keyDown %s\n", [[theEvent characters] cString]);
|
NSLog(@"NSTextField: -keyDown %s\n", [[theEvent characters] cString]);
|
||||||
|
|
||||||
// If TAB, SHIFT-TAB or RETURN key then make another text the first
|
// If TAB, SHIFT-TAB or RETURN key then make another text the first
|
||||||
// responder. This depends on key.
|
// responder. This depends on key.
|
||||||
|
@ -454,7 +455,7 @@ fprintf(stderr, " TextField mouseDown --- ");
|
||||||
|
|
||||||
- (BOOL) acceptsFirstResponder
|
- (BOOL) acceptsFirstResponder
|
||||||
{
|
{
|
||||||
if ([self isSelectable])
|
if ([self isSelectable] || [self isEditable])
|
||||||
return YES;
|
return YES;
|
||||||
else
|
else
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -518,9 +519,6 @@ fprintf(stderr, " TextField mouseDown --- ");
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self display];
|
|
||||||
[window flushWindow];
|
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -483,7 +483,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
|
|
||||||
- (void) viewWillMoveToWindow: (NSWindow*)newWindow
|
- (void) viewWillMoveToWindow: (NSWindow*)newWindow
|
||||||
{
|
{
|
||||||
if (newWindow == window)
|
if (newWindow == window || !newWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_rFlags.has_draginfo)
|
if (_rFlags.has_draginfo)
|
||||||
|
|
|
@ -1162,6 +1162,8 @@ static NSRecursiveLock *windowsLock;
|
||||||
if ((first_responder) && (![first_responder resignFirstResponder]))
|
if ((first_responder) && (![first_responder resignFirstResponder]))
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
// [first_responder resignFirstResponder];
|
||||||
first_responder = aResponder;
|
first_responder = aResponder;
|
||||||
[first_responder becomeFirstResponder];
|
[first_responder becomeFirstResponder];
|
||||||
return YES;
|
return YES;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue