Diverse gui patches by Wolfgang Lux <wolfgang.lux@gmail.com>.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25451 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-09-04 23:29:05 +00:00
parent 347b646c1d
commit 9a371e74bd
4 changed files with 165 additions and 126 deletions

View file

@ -1582,6 +1582,7 @@ void NSBeginInformationalAlertSheet(NSString *title,
{
GSAlertPanel *panel;
NSString *title;
unsigned nbut = [_buttons count];
panel = [[GSAlertPanel alloc] init];
_window = panel;
@ -1603,9 +1604,9 @@ void NSBeginInformationalAlertSheet(NSString *title,
icon: _icon
title: _informative_text
message: _message_text
def: [[_buttons objectAtIndex: 0] title]
alt: [[_buttons objectAtIndex: 1] title]
other: [[_buttons objectAtIndex: 2] title]];
def: (nbut > 0) ? [[_buttons objectAtIndex: 0] title] : (NSString*)nil
alt: (nbut > 1) ? [[_buttons objectAtIndex: 1] title] : (NSString*)nil
other: (nbut > 2) ? [[_buttons objectAtIndex: 2] title] : (NSString*)nil];
}
}

View file

@ -233,7 +233,12 @@ withContentsOfURL: (NSURL *)url
{
[self setFileURL: [NSURL fileURLWithPath: fileName]];
}
else
{
ASSIGN(_file_name, fileName);
ASSIGN(_file_url, [NSURL fileURLWithPath: fileName]);
[self setLastComponentOfFileName: [_file_name lastPathComponent]];
}
[self setLastComponentOfFileName: [_file_name lastPathComponent]];
}
@ -269,6 +274,7 @@ withContentsOfURL: (NSURL *)url
else
{
ASSIGN(_file_url, url);
ASSIGN(_file_name, (url && [url isFileURL]) ? [url path] : (NSString*)nil);
[self setLastComponentOfFileName: [[_file_url path] lastPathComponent]];
}
}
@ -537,6 +543,7 @@ withContentsOfURL: (NSURL *)url
{
if (OVERRIDDEN(dataRepresentationOfType:))
{
*error = nil;
return [self dataRepresentationOfType: type];
}
@ -569,6 +576,7 @@ withContentsOfURL: (NSURL *)url
if (OVERRIDDEN(fileWrapperRepresentationOfType:))
{
*error = nil;
return [self fileWrapperRepresentationOfType: type];
}
@ -654,6 +662,7 @@ withContentsOfURL: (NSURL *)url
{
if (OVERRIDDEN(loadFileWrapperRepresentation:ofType:))
{
*error = nil;
return [self loadFileWrapperRepresentation: wrapper ofType: type];
}
@ -665,6 +674,7 @@ withContentsOfURL: (NSURL *)url
}
// FIXME: Set error
*error = nil;
return NO;
}
@ -678,6 +688,7 @@ withContentsOfURL: (NSURL *)url
if (OVERRIDDEN(readFromFile:ofType:))
{
*error = nil;
return [self readFromFile: [url path] ofType: type];
}
else
@ -691,6 +702,7 @@ withContentsOfURL: (NSURL *)url
}
// FIXME: Set error
*error = nil;
return NO;
}
@ -821,6 +833,7 @@ withContentsOfURL: (NSURL *)url
saveOp = NSSaveToOperation;
}
*error = nil;
return [self writeWithBackupToFile: [url path]
ofType: type
saveOperation: saveOp];
@ -828,6 +841,8 @@ withContentsOfURL: (NSURL *)url
if (!isNativeType || (url == nil))
{
// FIXME: Set error
*error = nil;
return NO;
}
@ -846,6 +861,7 @@ withContentsOfURL: (NSURL *)url
toFile: backupFilename])
{
// FIXME: Set error.
*error = nil;
return NO;
}
}
@ -891,6 +907,7 @@ withContentsOfURL: (NSURL *)url
if (OVERRIDDEN(writeToFile:ofType:))
{
*error = nil;
return [self writeToFile: [url path] ofType: type];
}
@ -898,9 +915,12 @@ withContentsOfURL: (NSURL *)url
error: error];
if (wrapper == nil)
{
// FIXME: Set error
*error = nil;
return NO;
}
*error = nil;
return [wrapper writeToFile: [url path] atomically: YES updateFilenames: YES];
}
@ -914,6 +934,7 @@ originalContentsURL: (NSURL *)orig
{
if (saveOp == NSAutosaveOperation)
{
*error = nil;
saveOp = NSSaveToOperation;
}
@ -1249,6 +1270,7 @@ originalContentsURL: (NSURL *)orig
- (NSPrintOperation *)printOperationWithSettings: (NSDictionary *)settings
error: (NSError **)error
{
*error = nil;
return nil;
}
@ -1363,6 +1385,7 @@ originalContentsURL: (NSURL *)orig
error:(NSError **)error
{
// FIXME: Implement. Should set NSFileExtensionHidden
*error = nil;
return [NSDictionary dictionary];
}

View file

@ -696,8 +696,9 @@ anything visible
last_visible = lf->pos;
for (j = lp->pos - glyph_pos; j + glyph_pos < lp->pos + lp->length;)
{
if (r->glyphs[j].isNotShown || r->glyphs[j].g == NSControlGlyph ||
!r->glyphs[j].g)
// Don't ignore invisble glyphs.
// if (r->glyphs[j].isNotShown || r->glyphs[j].g == NSControlGlyph ||
if (!r->glyphs[j].g)
{
GLYPH_STEP_FORWARD(r, j, glyph_pos, char_pos)
continue;

View file

@ -1793,7 +1793,8 @@ here. */
TODO: make sure this is only called when _layoutManager is known non-nil,
or add guards
*/
- (unsigned int) characterIndexForPoint: (NSPoint)point
- (unsigned int) _characterIndexForPoint: (NSPoint)point
respectFraction: (BOOL)respectFraction
{
unsigned index;
float fraction;
@ -1808,13 +1809,22 @@ or add guards
return (unsigned int)-1;
index = [_layoutManager characterIndexForGlyphAtIndex: index];
if (fraction > 0.5 && index < [_textStorage length])
if (respectFraction && fraction > 0.5 && index < [_textStorage length] &&
[[_textStorage string] characterAtIndex:index] != '\n')
{
index++;
}
return index;
}
// This method takes screen coordinates as input.
- (unsigned int) characterIndexForPoint: (NSPoint)point
{
point = [[self window] convertScreenToBase: point];
point = [self convertPoint:point fromView: nil];
return [self _characterIndexForPoint: point respectFraction: NO];
}
- (NSRange) markedRange
{
return NSMakeRange(NSNotFound, 0);
@ -4267,7 +4277,8 @@ other than copy/paste or dragging. */
dragPoint = [sender draggingLocation];
dragPoint = [self convertPoint: dragPoint fromView: nil];
dragIndex = [self characterIndexForPoint: dragPoint];
dragIndex = [self _characterIndexForPoint: dragPoint
respectFraction: YES];
dragRange = NSMakeRange (dragIndex, 0);
range = [self selectionRangeForProposedRange: dragRange
@ -4302,7 +4313,8 @@ other than copy/paste or dragging. */
dragPoint = [sender draggingLocation];
dragPoint = [self convertPoint: dragPoint fromView: nil];
dragIndex = [self characterIndexForPoint: dragPoint];
dragIndex = [self _characterIndexForPoint: dragPoint
respectFraction: YES];
dragRange = NSMakeRange (dragIndex, 0);
range = [self selectionRangeForProposedRange: dragRange
@ -4416,7 +4428,8 @@ other than copy/paste or dragging. */
possible) */
startPoint = [self convertPoint: [theEvent locationInWindow] fromView: nil];
startIndex = [self characterIndexForPoint: startPoint];
startIndex = [self _characterIndexForPoint: startPoint
respectFraction: [theEvent clickCount] == 1];
if (startIndex == (unsigned int)-1)
{
@ -4620,7 +4633,8 @@ other than copy/paste or dragging. */
point = [self convertPoint: [lastEvent locationInWindow]
fromView: nil];
proposedRange = MakeRangeFromAbs([self characterIndexForPoint: point],
proposedRange = MakeRangeFromAbs([self _characterIndexForPoint: point
respectFraction: YES],
startIndex);
chosenRange = [self selectionRangeForProposedRange: proposedRange
granularity: granularity];