Revision: 13451
http://sourceforge.net/p/skim-app/code/13451
Author: hofman
Date: 2023-06-07 17:34:57 +0000 (Wed, 07 Jun 2023)
Log Message:
-----------
Make spelling settings sticky. Share the settings between note window textview
and text note editor.
Modified Paths:
--------------
trunk/InitialUserDefaults.plist
trunk/SKNoteTextView.m
trunk/SKStringConstants.h
trunk/SKStringConstants.m
trunk/SKTextNoteEditor.m
Modified: trunk/InitialUserDefaults.plist
===================================================================
--- trunk/InitialUserDefaults.plist 2023-06-07 17:08:39 UTC (rev 13450)
+++ trunk/InitialUserDefaults.plist 2023-06-07 17:34:57 UTC (rev 13451)
@@ -234,6 +234,12 @@
<true/>
<key>SKCaseInsensitiveFind</key>
<true/>
+ <key>SKSpellCheckingEnabled</key>
+ <true/>
+ <key>SKGrammarCheckingEnabled</key>
+ <false/>
+ <key>SKSpellingCorrectionEnabled</key>
+ <true/>
</dict>
<key>ResettableKeys</key>
<dict>
Modified: trunk/SKNoteTextView.m
===================================================================
--- trunk/SKNoteTextView.m 2023-06-07 17:08:39 UTC (rev 13450)
+++ trunk/SKNoteTextView.m 2023-06-07 17:34:57 UTC (rev 13451)
@@ -38,6 +38,7 @@
#import "SKNoteTextView.h"
#import "NSUserDefaultsController_SKExtensions.h"
+#import "SKStringConstants.h"
static char SKNoteTextViewDefaultsObservationContext;
@@ -47,6 +48,28 @@
@synthesize usesDefaultFontSize;
+- (id)initWithFrame:(NSRect)frameRect {
+ self = [super initWithFrame:frameRect];
+ if (self) {
+ NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+ [self setContinuousSpellCheckingEnabled:[sud
boolForKey:SKSpellCheckingEnabledKey]];
+ [self setGrammarCheckingEnabled:[sud
boolForKey:SKGrammarCheckingEnabledKey]];
+ [self setAutomaticSpellingCorrectionEnabled:[sud
boolForKey:SKSpellingCorrectionEnabledKey]];
+ }
+ return self;
+}
+
+- (id)initWithCoder:(NSCoder *)coder {
+ self = [super initWithCoder:coder];
+ if (self) {
+ NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+ [self setContinuousSpellCheckingEnabled:[sud
boolForKey:SKSpellCheckingEnabledKey]];
+ [self setGrammarCheckingEnabled:[sud
boolForKey:SKGrammarCheckingEnabledKey]];
+ [self setAutomaticSpellingCorrectionEnabled:[sud
boolForKey:SKSpellingCorrectionEnabledKey]];
+ }
+ return self;
+}
+
- (void)dealloc {
if (usesDefaultFontSize)
SKENSURE_MAIN_THREAD( [[NSUserDefaultsController
sharedUserDefaultsController] removeObserver:self forKey:SKNoteTextFontSizeKey
context:&SKNoteTextViewDefaultsObservationContext]; );
@@ -87,4 +110,19 @@
}
}
+- (void)toggleContinuousSpellChecking:(id)sender {
+ [super toggleContinuousSpellChecking:sender];
+ [[NSUserDefaults standardUserDefaults] setBool:[self
isContinuousSpellCheckingEnabled] forKey:SKSpellCheckingEnabledKey];
+}
+
+- (void)toggleGrammarChecking:(id)sender {
+ [super toggleGrammarChecking:sender];
+ [[NSUserDefaults standardUserDefaults] setBool:[self
isGrammarCheckingEnabled] forKey:SKGrammarCheckingEnabledKey];
+}
+
+- (void)toggleAutomaticSpellingCorrection:(id)sender {
+ [super toggleAutomaticSpellingCorrection:sender];
+ [[NSUserDefaults standardUserDefaults] setBool:[self
isAutomaticSpellingCorrectionEnabled] forKey:SKSpellingCorrectionEnabledKey];
+}
+
@end
Modified: trunk/SKStringConstants.h
===================================================================
--- trunk/SKStringConstants.h 2023-06-07 17:08:39 UTC (rev 13450)
+++ trunk/SKStringConstants.h 2023-06-07 17:34:57 UTC (rev 13451)
@@ -137,6 +137,9 @@
extern NSString *SKCaseInsensitiveNoteSearchKey;
extern NSString *SKCaseInsensitiveFilterKey;
extern NSString *SKCaseInsensitiveFindKey;
+extern NSString *SKSpellCheckingEnabledKey;
+extern NSString *SKGrammarCheckingEnabledKey;
+extern NSString *SKSpellingCorrectionEnabledKey;
extern NSString *SKDownloadsDirectoryKey;
extern NSString *SKDisableSearchAfterSpotlighKey;
extern NSString *SKDisplayNoteBoundsKey;
Modified: trunk/SKStringConstants.m
===================================================================
--- trunk/SKStringConstants.m 2023-06-07 17:08:39 UTC (rev 13450)
+++ trunk/SKStringConstants.m 2023-06-07 17:34:57 UTC (rev 13451)
@@ -138,6 +138,9 @@
NSString *SKCaseInsensitiveNoteSearchKey = @"SKCaseInsensitiveNoteSearch";
NSString *SKCaseInsensitiveFilterKey = @"SKCaseInsensitiveFilter";
NSString *SKCaseInsensitiveFindKey = @"SKCaseInsensitiveFind";
+NSString *SKSpellCheckingEnabledKey = @"SKSpellCheckingEnabled";
+NSString *SKGrammarCheckingEnabledKey = @"SKGrammarCheckingEnabled";
+NSString *SKSpellingCorrectionEnabledKey = @"SKSpellingCorrectionEnabled";
NSString *SKDownloadsDirectoryKey = @"SKDownloadsDirectory";
NSString *SKDisableSearchAfterSpotlighKey = @"SKDisableSearchAfterSpotligh";
NSString *SKDisplayNoteBoundsKey = @"SKDisplayNoteBounds";
Modified: trunk/SKTextNoteEditor.m
===================================================================
--- trunk/SKTextNoteEditor.m 2023-06-07 17:08:39 UTC (rev 13450)
+++ trunk/SKTextNoteEditor.m 2023-06-07 17:34:57 UTC (rev 13451)
@@ -44,6 +44,7 @@
#import "NSGraphics_SKExtensions.h"
#import "NSEvent_SKExtensions.h"
#import "SKTextUndoManager.h"
+#import "SKStringConstants.h"
#import <SkimNotes/SkimNotes.h>
static char SKPDFAnnotationPropertiesObservationContext;
@@ -134,7 +135,6 @@
[textView setVerticallyResizable:YES];
[textView setAutoresizingMask:NSViewWidthSizable];
[textView setUsesFontPanel:NO];
- [textView setContinuousSpellCheckingEnabled:YES];
[textView setAllowsUndo:YES];
[textView setDelegate:self];
[textView setString:[annotation string] ?: @""];
@@ -322,6 +322,17 @@
@implementation SKTextNoteTextView
+- (id)initWithFrame:(NSRect)frameRect {
+ self = [super initWithFrame:frameRect];
+ if (self) {
+ NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+ [self setContinuousSpellCheckingEnabled:[sud
boolForKey:SKSpellCheckingEnabledKey]];
+ [self setGrammarCheckingEnabled:[sud
boolForKey:SKGrammarCheckingEnabledKey]];
+ [self setAutomaticSpellingCorrectionEnabled:[sud
boolForKey:SKSpellingCorrectionEnabledKey]];
+ }
+ return self;
+}
+
- (BOOL)respondsToSelector:(SEL)aSelector {
if (aSelector == @selector(changeFont:) || aSelector ==
@selector(changeAttributes:) || aSelector == @selector(changeColor:) ||
aSelector == @selector(alignLeft:) || aSelector == @selector(alignRight:) ||
aSelector == @selector(alignCenter:))
return NO;
@@ -337,4 +348,19 @@
[super keyDown:theEvent];
}
+- (void)toggleContinuousSpellChecking:(id)sender {
+ [super toggleContinuousSpellChecking:sender];
+ [[NSUserDefaults standardUserDefaults] setBool:[self
isContinuousSpellCheckingEnabled] forKey:SKSpellCheckingEnabledKey];
+}
+
+- (void)toggleGrammarChecking:(id)sender {
+ [super toggleGrammarChecking:sender];
+ [[NSUserDefaults standardUserDefaults] setBool:[self
isGrammarCheckingEnabled] forKey:SKGrammarCheckingEnabledKey];
+}
+
+- (void)toggleAutomaticSpellingCorrection:(id)sender {
+ [super toggleAutomaticSpellingCorrection:sender];
+ [[NSUserDefaults standardUserDefaults] setBool:[self
isAutomaticSpellingCorrectionEnabled] forKey:SKSpellingCorrectionEnabledKey];
+}
+
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit