mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 05:50:37 +00:00
Added nextKeyView to views withing gmodel to allow user to tab between buttons. Fixed a bug in NSBrowser. Made some corrections to NSSpellChecker and [NSTextView checkSpelling:]
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10641 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a77949a8e6
commit
016e021fc1
5 changed files with 173 additions and 69 deletions
|
@ -2474,77 +2474,79 @@ static double rint(double a)
|
|||
IMP lcarc = [self methodForSelector: lcarcSel];
|
||||
|
||||
selectedColumn = [self selectedColumn];
|
||||
bc = [_browserColumns objectAtIndex:
|
||||
selectedColumn];
|
||||
matrix = [bc columnMatrix];
|
||||
n = [matrix numberOfRows];
|
||||
s = [matrix selectedRow];
|
||||
|
||||
if (!_charBuffer)
|
||||
if(selectedColumn != -1)
|
||||
{
|
||||
_charBuffer = [characters substringToIndex: 1];
|
||||
RETAIN(_charBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (([theEvent timestamp] - _lastKeyPressed < 2000.0)
|
||||
&& (_alphaNumericalLastColumn == selectedColumn))
|
||||
bc = [_browserColumns objectAtIndex:
|
||||
selectedColumn];
|
||||
matrix = [bc columnMatrix];
|
||||
n = [matrix numberOfRows];
|
||||
s = [matrix selectedRow];
|
||||
|
||||
if (!_charBuffer)
|
||||
{
|
||||
NSString *transition;
|
||||
transition = [_charBuffer
|
||||
stringByAppendingString:
|
||||
[characters substringToIndex: 1]];
|
||||
RELEASE(_charBuffer);
|
||||
_charBuffer = transition;
|
||||
_charBuffer = [characters substringToIndex: 1];
|
||||
RETAIN(_charBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASE(_charBuffer);
|
||||
_charBuffer = [characters substringToIndex: 1];
|
||||
RETAIN(_charBuffer);
|
||||
if (([theEvent timestamp] - _lastKeyPressed < 2000.0)
|
||||
&& (_alphaNumericalLastColumn == selectedColumn))
|
||||
{
|
||||
NSString *transition;
|
||||
transition = [_charBuffer
|
||||
stringByAppendingString:
|
||||
[characters substringToIndex: 1]];
|
||||
RELEASE(_charBuffer);
|
||||
_charBuffer = transition;
|
||||
RETAIN(_charBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASE(_charBuffer);
|
||||
_charBuffer = [characters substringToIndex: 1];
|
||||
RETAIN(_charBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_alphaNumericalLastColumn = selectedColumn;
|
||||
_lastKeyPressed = [theEvent timestamp];
|
||||
|
||||
sv = [((*lcarc)(self, lcarcSel, s, selectedColumn))
|
||||
stringValue];
|
||||
|
||||
if (([sv length] > 0)
|
||||
&& ([sv hasPrefix: _charBuffer]))
|
||||
return;
|
||||
|
||||
for (i = s+1; i < n; i++)
|
||||
{
|
||||
sv = [((*lcarc)(self, lcarcSel, i, selectedColumn))
|
||||
|
||||
_alphaNumericalLastColumn = selectedColumn;
|
||||
_lastKeyPressed = [theEvent timestamp];
|
||||
|
||||
sv = [((*lcarc)(self, lcarcSel, s, selectedColumn))
|
||||
stringValue];
|
||||
|
||||
if (([sv length] > 0)
|
||||
&& ([sv hasPrefix: _charBuffer]))
|
||||
return;
|
||||
|
||||
for (i = s+1; i < n; i++)
|
||||
{
|
||||
[self selectRow: i
|
||||
inColumn: selectedColumn];
|
||||
[matrix scrollCellToVisibleAtRow: i column: 0];
|
||||
[matrix performClick: self];
|
||||
return;
|
||||
sv = [((*lcarc)(self, lcarcSel, i, selectedColumn))
|
||||
stringValue];
|
||||
if (([sv length] > 0)
|
||||
&& ([sv hasPrefix: _charBuffer]))
|
||||
{
|
||||
[self selectRow: i
|
||||
inColumn: selectedColumn];
|
||||
[matrix scrollCellToVisibleAtRow: i column: 0];
|
||||
[matrix performClick: self];
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < s; i++)
|
||||
{
|
||||
sv = [((*lcarc)(self, lcarcSel, i, selectedColumn))
|
||||
stringValue];
|
||||
if (([sv length] > 0)
|
||||
&& ([sv hasPrefix: _charBuffer]))
|
||||
{
|
||||
[self selectRow: i
|
||||
inColumn: selectedColumn];
|
||||
[matrix scrollCellToVisibleAtRow: i column: 0];
|
||||
[matrix performClick: self];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < s; i++)
|
||||
{
|
||||
sv = [((*lcarc)(self, lcarcSel, i, selectedColumn))
|
||||
stringValue];
|
||||
if (([sv length] > 0)
|
||||
&& ([sv hasPrefix: _charBuffer]))
|
||||
{
|
||||
[self selectRow: i
|
||||
inColumn: selectedColumn];
|
||||
[matrix scrollCellToVisibleAtRow: i column: 0];
|
||||
[matrix performClick: self];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_lastKeyPressed = 0.;
|
||||
}
|
||||
|
||||
|
|
|
@ -333,9 +333,7 @@ static int __documentTag = 0;
|
|||
{
|
||||
int wordCount = 0;
|
||||
NSRange r = NSMakeRange(0,0);
|
||||
id responder = [[[[NSApplication sharedApplication] mainWindow] contentView] documentView];
|
||||
|
||||
_currentTag = [responder spellCheckerDocumentTag];
|
||||
|
||||
r = [self checkSpellingOfString: stringToCheck
|
||||
startingAt: startingOffset
|
||||
language: _language
|
||||
|
@ -505,7 +503,7 @@ inSpellDocumentWithTag:(int)tag
|
|||
- _findNext: (id)sender
|
||||
{
|
||||
BOOL processed = NO;
|
||||
id responder = [[[[NSApplication sharedApplication] mainWindow] contentView] documentView];
|
||||
id responder = [[[NSApplication sharedApplication] mainWindow] firstResponder];
|
||||
|
||||
processed = [responder tryToPerform: @selector(checkSpelling:)
|
||||
with: _spellPanel];
|
||||
|
@ -565,7 +563,7 @@ inSpellDocumentWithTag:(int)tag
|
|||
- _ignore: (id)sender
|
||||
{
|
||||
BOOL processed = NO;
|
||||
id responder = [[[[NSApplication sharedApplication] mainWindow] contentView] documentView];
|
||||
id responder = [[[NSApplication sharedApplication] mainWindow] firstResponder];
|
||||
|
||||
processed = [responder tryToPerform: @selector(ignoreSpelling:)
|
||||
with: _wordField];
|
||||
|
@ -589,7 +587,7 @@ inSpellDocumentWithTag:(int)tag
|
|||
- _correct: (id)sender
|
||||
{
|
||||
BOOL processed = NO;
|
||||
id responder = [[[[NSApplication sharedApplication] mainWindow] contentView] documentView];
|
||||
id responder = [[[NSApplication sharedApplication] mainWindow] firstResponder];
|
||||
|
||||
processed = [responder tryToPerform: @selector(changeSpelling:)
|
||||
with: _wordField];
|
||||
|
@ -648,6 +646,17 @@ inSpellDocumentWithTag:(int)tag
|
|||
[[NSApp _listener] _languagesForPopUpButton]];
|
||||
[_accessoryView setDelegate: self];
|
||||
[_accessoryView setDoubleAction: @selector(_correct:)];
|
||||
|
||||
[_findNextButton setKeyEquivalent: @"n"];
|
||||
[_ignoreButton setKeyEquivalent: @"i"];
|
||||
[_learnButton setKeyEquivalent: @"l"];
|
||||
[_forgetButton setKeyEquivalent: @"f"];
|
||||
[_guessButton setKeyEquivalent: @"g"];
|
||||
[_correctButton setKeyEquivalent: @"c"];
|
||||
[_correctButton setImagePosition: NSImageRight];
|
||||
[_correctButton setImage: [NSImage imageNamed: @"common_ret"]];
|
||||
[_correctButton setAlternateImage: [NSImage imageNamed: @"common_retH"]];
|
||||
[_spellPanel makeFirstResponder: _correctButton];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -813,11 +813,15 @@ static NSNotificationCenter *nc;
|
|||
- (void) checkSpelling: (id)sender
|
||||
{
|
||||
NSSpellChecker *sp = [NSSpellChecker sharedSpellChecker];
|
||||
|
||||
NSRange errorRange;
|
||||
int count = 0;
|
||||
|
||||
errorRange = [sp checkSpellingOfString: [_textStorage string]
|
||||
startingAt: NSMaxRange (_selected_range)];
|
||||
errorRange = [sp checkSpellingOfString: [self string]
|
||||
startingAt: NSMaxRange (_selected_range)
|
||||
language: [sp language]
|
||||
wrap: YES
|
||||
inSpellDocumentWithTag: [self spellCheckerDocumentTag]
|
||||
wordCount: &count];
|
||||
|
||||
if (errorRange.length)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue