From b45490ba8d48e478d2a083894e9f9be0ab8ae404 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 4 Dec 2016 20:04:52 -0500 Subject: [PATCH] Store the last-used debugger segment in prefs. --- Source/AppDelegate.m | 3 ++- Source/DebuggerController.m | 6 ++++++ Source/PreferenceNames.h | 3 +++ Source/PreferenceNames.m | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index d1a9ba1..681bf21 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -38,7 +38,8 @@ kPrefInspectorWindowVisible : @YES, kPrefPathReplacements : [NSMutableArray array], kPrefBreakOnFirstLine : @YES, - kPrefDebuggerAttached : @YES + kPrefDebuggerAttached : @YES, + kPrefSelectedDebuggerSegment : @1, }; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; } diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index 997b767..a5765e7 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -121,6 +121,10 @@ forKeyPath:@"frame" options:0 context:nil]; + + NSUInteger selectedSegment = + [[[NSUserDefaults standardUserDefaults] valueForKey:kPrefSelectedDebuggerSegment] intValue]; + [[_segmentControl cell] setSelectedSegment:selectedSegment]; [self updateSegmentControl]; } @@ -142,6 +146,8 @@ else [self debuggerDisconnected]; } else if (object == _segmentControl.cell) { + [[NSUserDefaults standardUserDefaults] setValue:@(_segmentControl.selectedSegment) + forKey:kPrefSelectedDebuggerSegment]; [_tabView selectTabViewItemAtIndex:_segmentControl.selectedSegment - 1]; } else if (object == _segmentControl.superview) { [self updateSegmentControl]; diff --git a/Source/PreferenceNames.h b/Source/PreferenceNames.h index 3a38ac1..92c4b50 100644 --- a/Source/PreferenceNames.h +++ b/Source/PreferenceNames.h @@ -38,3 +38,6 @@ extern NSString* const kPrefUnstableVersionCast; // NSMutableArray of breakpoints. extern NSString* const kPrefBreakpoints; + +// The selected segment in the DebuggerController. +extern NSString* const kPrefSelectedDebuggerSegment; diff --git a/Source/PreferenceNames.m b/Source/PreferenceNames.m index 787b648..c58c91a 100644 --- a/Source/PreferenceNames.m +++ b/Source/PreferenceNames.m @@ -29,3 +29,5 @@ NSString* const kPrefDebuggerAttached = @"DebuggerAttached"; NSString* const kPrefUnstableVersionCast = @"UnstableVersionCast"; NSString* const kPrefBreakpoints = @"Breakpoints"; + +NSString* const kPrefSelectedDebuggerSegment = @"DebuggerSegment"; -- 2.43.5