mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +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
1a943b9250
commit
43e9b45cd3
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>
|
||||
|
||||
* Source/NSSlider.m: added missing [self unlockFocus];.
|
||||
|
|
|
@ -270,6 +270,8 @@
|
|||
encoded. */
|
||||
upperObjectRepresentation = lastObjectRepresentation;
|
||||
|
||||
// Removed by patch, was archiving templates and all kinds of naughty
|
||||
// stuff.
|
||||
// anObject = [anObject replacementObjectForModelArchiver: self];
|
||||
archiveClass = [anObject classForModelArchiver];
|
||||
|
||||
|
|
|
@ -427,47 +427,22 @@ static Class imageClass;
|
|||
delegate: (id)anObject
|
||||
event: (NSEvent *)theEvent
|
||||
{
|
||||
NSRect bRect;
|
||||
|
||||
if (cell_type != NSTextCellType)
|
||||
if (!controlView || !textObject || !cell_font ||
|
||||
(cell_type != NSTextCellType))
|
||||
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 setFrame: bRect];
|
||||
NSEraseRect(aRect);
|
||||
aRect.origin.y -= 1;
|
||||
|
||||
[textObject setFrame: aRect];
|
||||
[textObject setText: [self stringValue]];
|
||||
|
||||
[[[controlView window] contentView] addSubview: textObject];
|
||||
[controlView addSubview:textObject];
|
||||
|
||||
[[controlView window] makeFirstResponder: textObject];
|
||||
|
||||
if ([theEvent type] == NSLeftMouseDown)
|
||||
[textObject mouseDown:theEvent];
|
||||
|
||||
[textObject display];
|
||||
[controlView unlockFocus];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -477,6 +452,7 @@ static Class imageClass;
|
|||
- (void) endEditing: (NSText*)textObject
|
||||
{
|
||||
[textObject setDelegate: nil];
|
||||
[textObject retain];
|
||||
[textObject removeFromSuperview];
|
||||
[self setStringValue: [textObject text]];
|
||||
[textObject setString:@""];
|
||||
|
@ -807,6 +783,8 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
{
|
||||
NSView *cv = [NSView focusView];
|
||||
|
||||
NSLog(@"performClick:");
|
||||
|
||||
[self highlight: YES withFrame: [cv frame] inView: cv];
|
||||
if ([self action])
|
||||
{
|
||||
|
|
|
@ -662,8 +662,9 @@ nil];
|
|||
plainContent=[[NSMutableString stringWithString:string] retain];
|
||||
[lineLayoutInformation autorelease]; lineLayoutInformation=nil; // force complete re-layout
|
||||
[self setRichText:NO];
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setSelectedRangeNoDrawing:NSMakeRange(0,0)];
|
||||
// [self rebuildLineLayoutInformationStartingAtLine:0];
|
||||
// [self setNeedsDisplay:YES];
|
||||
}
|
||||
-(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
|
||||
{ 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];
|
||||
}
|
||||
|
||||
|
@ -987,8 +989,6 @@ NSLog(@"did set font");
|
|||
{
|
||||
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.
|
||||
return;
|
||||
|
||||
|
@ -1244,7 +1244,8 @@ currentCursorY=[self rectForCharacterIndex:NSMaxRange([self selectedRange])].ori
|
|||
//<!> make this non-blocking (or make use of timed entries)
|
||||
for(currentEvent= [[self window] nextEventMatchingMask:NSLeftMouseDraggedMask|NSLeftMouseUpMask];[currentEvent type] != NSLeftMouseUp;
|
||||
(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];
|
||||
proposedRange=MakeRangeFromAbs([self characterIndexForPoint:point],startIndex);
|
||||
chosenRange=[self selectionRangeForProposedRange:proposedRange granularity:granularity];
|
||||
|
@ -1256,7 +1257,6 @@ currentCursorY=[self rectForCharacterIndex:NSMaxRange([self selectedRange])].ori
|
|||
}
|
||||
else continue;
|
||||
}
|
||||
|
||||
// this changes the selection without needing instance drawing (carefully thought out ;-)
|
||||
if(!didScroll)
|
||||
{ [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
|
||||
currentCursorY=[self rectForCharacterIndex:chosenRange.location].origin.y; // remember for column stable cursor up/down
|
||||
|
||||
[self unlockFocus];
|
||||
[[self window] flushWindow];
|
||||
}
|
||||
|
@ -1346,7 +1345,7 @@ NSLog(NSStringFromRange(redrawLineRange));
|
|||
|
||||
-(void) insertText:insertObjc
|
||||
{ NSRange selectedRange=[self selectedRange];
|
||||
int lineIndex=[self lineLayoutIndexForCharacterIndex:selectedRange.location],origLineIndex=lineIndex,caretLineIndex=lineIndex;
|
||||
int lineIndex=[self lineLayoutIndexForCharacterIndex:selectedRange.location],origLineIndex=lineIndex,caretLineIndex=lineIndex;
|
||||
NSRange redrawLineRange;
|
||||
NSString *insertString=nil;
|
||||
|
||||
|
@ -1491,6 +1490,17 @@ NSLog(NSStringFromRange(redrawLineRange));
|
|||
return;
|
||||
}
|
||||
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
|
||||
NSLog(@"keycode:%x",keyCode);
|
||||
|
@ -1509,9 +1519,9 @@ NSLog(@"keycode:%x",keyCode);
|
|||
-(BOOL) resignFirstResponder
|
||||
{ if([self shouldDrawInsertionPoint])
|
||||
{
|
||||
[self lockFocus];
|
||||
// [self lockFocus];
|
||||
[self drawInsertionPointAtIndex:[self selectedRange].location color:nil turnedOn:NO];
|
||||
[self unlockFocus];
|
||||
// [self unlockFocus];
|
||||
|
||||
//<!> stop timed entry
|
||||
}
|
||||
|
@ -1520,13 +1530,14 @@ NSLog(@"keycode:%x",keyCode);
|
|||
}
|
||||
|
||||
-(BOOL) becomeFirstResponder
|
||||
{ if([self shouldDrawInsertionPoint])
|
||||
{
|
||||
{
|
||||
// if([self shouldDrawInsertionPoint])
|
||||
// {
|
||||
// [self lockFocus];
|
||||
[self drawInsertionPointAtIndex:[self selectedRange].location color:[NSColor blackColor] turnedOn:YES];
|
||||
// [self drawInsertionPointAtIndex:[self selectedRange].location color:[NSColor blackColor] turnedOn:YES];
|
||||
// [self unlockFocus];
|
||||
//<!> restart timed entry
|
||||
}
|
||||
// //<!> restart timed entry
|
||||
// }
|
||||
if([self isEditable] && [self textShouldBeginEditing:(NSText*)self]) return YES;
|
||||
else return NO;
|
||||
}
|
||||
|
@ -1936,7 +1947,7 @@ NSLog(@"opti hook 1 (preferred)");
|
|||
else if(currentLineIndex-1 == insertionLineIndex && ABS(insertionDelta)== 1)
|
||||
{ erg=2; // return 2: redisplay only this and previous line
|
||||
}
|
||||
#if 1
|
||||
#if 0
|
||||
NSLog(@"opti for:%d",erg);
|
||||
#endif
|
||||
return erg;
|
||||
|
|
|
@ -91,6 +91,7 @@ id _nsTextfieldCellClass = nil;
|
|||
[cell setState: 1];
|
||||
[cell setBezeled: YES];
|
||||
[cell setSelectable: YES];
|
||||
[cell setEnabled: YES];
|
||||
[cell setEditable: YES];
|
||||
[cell setDrawsBackground: YES];
|
||||
text_cursor = [[NSCursor IBeamCursor] retain];
|
||||
|
@ -373,7 +374,7 @@ fprintf(stderr, " TextField mouseDown --- ");
|
|||
unsigned int key_code = [theEvent keyCode];
|
||||
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
|
||||
// responder. This depends on key.
|
||||
|
@ -454,7 +455,7 @@ fprintf(stderr, " TextField mouseDown --- ");
|
|||
|
||||
- (BOOL) acceptsFirstResponder
|
||||
{
|
||||
if ([self isSelectable])
|
||||
if ([self isSelectable] || [self isEditable])
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
|
@ -518,9 +519,6 @@ fprintf(stderr, " TextField mouseDown --- ");
|
|||
return NO;
|
||||
}
|
||||
|
||||
[self display];
|
||||
[window flushWindow];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
|
||||
- (void) viewWillMoveToWindow: (NSWindow*)newWindow
|
||||
{
|
||||
if (newWindow == window)
|
||||
if (newWindow == window || !newWindow)
|
||||
return;
|
||||
|
||||
if (_rFlags.has_draginfo)
|
||||
|
|
|
@ -1162,6 +1162,8 @@ static NSRecursiveLock *windowsLock;
|
|||
if ((first_responder) && (![first_responder resignFirstResponder]))
|
||||
return NO;
|
||||
|
||||
// FIXME
|
||||
// [first_responder resignFirstResponder];
|
||||
first_responder = aResponder;
|
||||
[first_responder becomeFirstResponder];
|
||||
return YES;
|
||||
|
|
Loading…
Reference in a new issue