File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed
Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" standalone =" no" ?>
2- <document type =" com.apple.InterfaceBuilder3.Cocoa.XIB" version =" 3.0" toolsVersion =" 6254" systemVersion =" 14C81f " targetRuntime =" MacOSX.Cocoa" propertyAccessControl =" none" useAutolayout =" YES" >
2+ <document type =" com.apple.InterfaceBuilder3.Cocoa.XIB" version =" 3.0" toolsVersion =" 6254" systemVersion =" 14C109 " targetRuntime =" MacOSX.Cocoa" propertyAccessControl =" none" useAutolayout =" YES" >
33 <dependencies >
44 <deployment identifier =" macosx" />
55 <plugIn identifier =" com.apple.InterfaceBuilder.CocoaPlugin" version =" 6254" />
161161 <modifierMask key =" keyEquivalentModifierMask" />
162162 <menu key =" submenu" title =" View" id =" HyV-fh-RgO" >
163163 <items >
164+ <menuItem title =" Show Arrows" id =" DO8-UC-n47" >
165+ <modifierMask key =" keyEquivalentModifierMask" />
166+ <connections >
167+ <action selector =" toggleShowArrows:" target =" -1" id =" Fzv-jI-NKO" />
168+ </connections >
169+ </menuItem >
164170 <menuItem title =" Flip Board" keyEquivalent =" f" id =" 5zt-BF-g52" >
165171 <connections >
166172 <action selector =" flipBoard:" target =" -1" id =" gET-4O-ZRD" />
Original file line number Diff line number Diff line change 2323+ (NSData *)sandboxBookmarkData ;
2424+ (void )setSandboxBookmarkData : (NSData *)data ;
2525
26+ + (BOOL )arrowsEnabled ;
27+ + (void )setArrowsEnabled : (BOOL )enabled ;
28+
2629@end
Original file line number Diff line number Diff line change 1313#define UCI_CONTEMPT @" uci_contempt"
1414#define UCI_SKILL_LEVEL @" uci_skill_level"
1515#define SANDBOX_BOOKMARK_DATA @" sandbox_bookmark_data"
16+ #define ARROWS_ENABLED @" arrows_enabled"
1617
1718@implementation SFMUserDefaults
1819
@@ -60,4 +61,15 @@ + (void)setSandboxBookmarkData:(NSData *)data {
6061 [[NSUserDefaults standardUserDefaults ] setObject: data forKey: SANDBOX_BOOKMARK_DATA];
6162}
6263
64+ + (BOOL )arrowsEnabled {
65+ if (![[NSUserDefaults standardUserDefaults ] objectForKey: ARROWS_ENABLED]) {
66+ [SFMUserDefaults setArrowsEnabled: YES ];
67+ }
68+ return [[NSUserDefaults standardUserDefaults ] boolForKey: ARROWS_ENABLED];
69+ }
70+
71+ + (void )setArrowsEnabled : (BOOL )enabled {
72+ [[NSUserDefaults standardUserDefaults ] setBool: enabled forKey: ARROWS_ENABLED];
73+ }
74+
6375@end
Original file line number Diff line number Diff line change 1313#import " SFMMove.h"
1414#import " SFMUCILine.h"
1515#import " SFMPosition.h"
16+ #import " SFMUserDefaults.h"
1617
1718@interface SFMWindowController ()
1819
@@ -115,6 +116,12 @@ - (IBAction)increaseVariations:(id)sender {
115116- (IBAction )decreaseVariations : (id )sender {
116117 self.engine .multipv --;
117118}
119+ - (IBAction )toggleShowArrows : (id )sender {
120+ [SFMUserDefaults setArrowsEnabled: ![SFMUserDefaults arrowsEnabled ]];
121+ if (![SFMUserDefaults arrowsEnabled ]) {
122+ self.boardView .arrows = nil ;
123+ }
124+ }
118125
119126#pragma mark - Helper methods
120127- (void )syncToViewsAndEngine
@@ -216,6 +223,8 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem
216223 return ![self .currentGame atEnd ];
217224 } else if ([menuItem action ] == @selector (decreaseVariations: )) {
218225 return self.engine .multipv != 1 ;
226+ } else if ([menuItem action ] == @selector (toggleShowArrows: )) {
227+ [menuItem setState: [SFMUserDefaults arrowsEnabled ] ? NSOnState : NSOffState ];
219228 }
220229 return YES ;
221230}
@@ -264,7 +273,7 @@ - (void)uciEngine:(SFMUCIEngine *)engine didGetNewLine:(NSDictionary *)lines {
264273 [self uciEngine: engine didGetNewCurrentMove: nil number: 0 depth: pv.depth];
265274
266275 // Draw an arrow
267- if ([pv.moves count ] > 0 ) {
276+ if ([pv.moves count ] > 0 && [SFMUserDefaults arrowsEnabled ] ) {
268277 self.boardView .arrows = @[[pv.moves firstObject ]];
269278 }
270279 }
You can’t perform that action at this time.
0 commit comments