diff options
author | stuconnolly <stuart02@gmail.com> | 2013-02-17 11:57:48 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2013-02-17 11:57:48 +0000 |
commit | de952b797635d1d19a0357ba396b5e6be9f40624 (patch) | |
tree | cb3158a3348f1c09277ef11e1b6687c9adb864d5 /Source/SPEditSheetTextView.m | |
parent | 37253fa9894c9ff40b07c001b77c77b3e7e59368 (diff) | |
download | sequelpro-de952b797635d1d19a0357ba396b5e6be9f40624.tar.gz sequelpro-de952b797635d1d19a0357ba396b5e6be9f40624.tar.bz2 sequelpro-de952b797635d1d19a0357ba396b5e6be9f40624.zip |
Fix more warnings.
Diffstat (limited to 'Source/SPEditSheetTextView.m')
-rw-r--r-- | Source/SPEditSheetTextView.m | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m index c605c850..788ba575 100644 --- a/Source/SPEditSheetTextView.m +++ b/Source/SPEditSheetTextView.m @@ -47,32 +47,38 @@ - (IBAction)undo:(id)sender { textWasChanged = NO; + [[self undoManager] undo]; + // Due to the undoManager implementation it could happen that // an action will be recoreded which actually didn't change the // text buffer. That's why repeat undo. - if(!textWasChanged) [[self undoManager] undo]; - if(!textWasChanged) [[self undoManager] undo]; + if (!textWasChanged) [[self undoManager] undo]; + if (!textWasChanged) [[self undoManager] undo]; } - (IBAction)redo:(id)sender { textWasChanged = NO; + [[self undoManager] redo]; + // Due to the undoManager implementation it could happen that // an action will be recoreded which actually didn't change the // text buffer. That's why repeat redo. - if(!textWasChanged) [[self undoManager] redo]; - if(!textWasChanged) [[self undoManager] redo]; + if (!textWasChanged) [[self undoManager] redo]; + if (!textWasChanged) [[self undoManager] redo]; } - (IBAction)paste:(id)sender { #ifndef SP_CODA // Try to create an undo group - if([[self delegate] respondsToSelector:@selector(setWasCutPaste)]) - [[self delegate] setWasCutPaste]; + if ([[self delegate] respondsToSelector:@selector(setWasCutPaste)]) { + [(SPFieldEditorController *)[self delegate] setWasCutPaste]; + } #endif + [super paste:sender]; } @@ -80,9 +86,11 @@ { #ifndef SP_CODA // Try to create an undo group - if([[self delegate] respondsToSelector:@selector(setWasCutPaste)]) - [[self delegate] setWasCutPaste]; + if ([[self delegate] respondsToSelector:@selector(setWasCutPaste)]) { + [(SPFieldEditorController *)[self delegate] setWasCutPaste]; + } #endif + [super cut:sender]; } @@ -108,15 +116,13 @@ - (void)keyDown:(NSEvent *)theEvent { - long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask); // Check if user pressed ⌥ to allow composing of accented characters. // e.g. for US keyboard "⌥u a" to insert ä // or for non-US keyboards to allow to enter dead keys // e.g. for German keyboard ` is a dead key, press space to enter ` - if (([theEvent modifierFlags] & allFlags) == NSAlternateKeyMask || [[theEvent characters] length] == 0) - { + if (([theEvent modifierFlags] & allFlags) == NSAlternateKeyMask || [[theEvent characters] length] == 0) { [super keyDown: theEvent]; return; } @@ -124,20 +130,22 @@ NSString *charactersIgnMod = [theEvent charactersIgnoringModifiers]; long curFlags = ([theEvent modifierFlags] & allFlags); - if(curFlags & NSCommandKeyMask) { - if([charactersIgnMod isEqualToString:@"+"] || [charactersIgnMod isEqualToString:@"="]) // increase text size by 1; ⌘+ and numpad + + if (curFlags & NSCommandKeyMask) { + if ([charactersIgnMod isEqualToString:@"+"] || [charactersIgnMod isEqualToString:@"="]) // increase text size by 1; ⌘+ and numpad + { [self makeTextSizeLarger]; [self saveChangedFontInUserDefaults]; return; } - if([charactersIgnMod isEqualToString:@"-"]) // decrease text size by 1; ⌘- and numpad - + + if ([charactersIgnMod isEqualToString:@"-"]) // decrease text size by 1; ⌘- and numpad - { [self makeTextSizeSmaller]; [self saveChangedFontInUserDefaults]; return; } - if([charactersIgnMod isEqualToString:@"0"]) // return the text size to the default size; ⌘0 + + if ([charactersIgnMod isEqualToString:@"0"]) // return the text size to the default size; ⌘0 { [self makeTextStandardSize]; [self saveChangedFontInUserDefaults]; @@ -148,16 +156,15 @@ #ifndef SP_CODA // Allow undo grouping if user typed a ' ' (for word level undo) // or a RETURN but not for each char due to writing speed - if([charactersIgnMod isEqualToString:@" "] - || [theEvent keyCode] == 36 - || [theEvent modifierFlags] & (NSCommandKeyMask|NSControlKeyMask|NSAlternateKeyMask) - ) { - [[self delegate] setDoGroupDueToChars]; + if ([charactersIgnMod isEqualToString:@" "] || + [theEvent keyCode] == 36 || + [theEvent modifierFlags] & (NSCommandKeyMask|NSControlKeyMask|NSAlternateKeyMask)) + { + [(SPFieldEditorController *)[self delegate] setDoGroupDueToChars]; } #endif [super keyDown: theEvent]; - } /* |