From fc4b228303620109fc3ff24db9453763c51d25ad Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 1 Dec 2008 10:33:16 -0500 Subject: [PATCH] Use automatic validation of UI items for the toolbar buttons, rather than manually enabling/disabling them * Source/DebuggerController.h: Remove the outlets for the toolbar items * Source/DebuggerController.m: (validateUserInterfaceItem:): Validate the reconnect button (setStatus:): Remove the block of code that sets button states (updateStackViewer): ditto * English.lproj/Debugger.xib: Remove the outlets and set all the toolbar items to autovalidate --- English.lproj/Debugger.xib | 64 +++++-------------------------------- Source/DebuggerController.h | 6 ---- Source/DebuggerController.m | 25 ++------------- 3 files changed, 10 insertions(+), 85 deletions(-) diff --git a/English.lproj/Debugger.xib b/English.lproj/Debugger.xib index d0782d7..a58c123 100644 --- a/English.lproj/Debugger.xib +++ b/English.lproj/Debugger.xib @@ -8,7 +8,7 @@ 352.00 YES - + YES @@ -76,7 +76,7 @@ {0, 0} {0, 0} YES - NO + YES -1 YES 0 @@ -98,7 +98,7 @@ {0, 0} {0, 0} YES - NO + YES -1 YES 0 @@ -120,7 +120,7 @@ {0, 0} {0, 0} YES - NO + YES -1 YES 0 @@ -142,7 +142,7 @@ {0, 0} {0, 0} YES - NO + YES -1 YES 0 @@ -164,7 +164,7 @@ {0, 0} {0, 0} YES - NO + YES -1 YES 0 @@ -1140,46 +1140,6 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ 488 - - - stepInButton - - - - 489 - - - - stepOutButton - - - - 490 - - - - stepOverButton - - - - 491 - - - - runButton - - - - 492 - - - - reconnectButton - - - - 493 - sourceViewer @@ -1707,6 +1667,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ 467.IBShouldRemoveOnLegacySave 468.IBShouldRemoveOnLegacySave 469.IBShouldRemoveOnLegacySave + 471.IBEditorWindowLastContentRect 471.IBPluginDependency 471.editorWindowContentRectSynchronizationRect 474.IBPluginDependency @@ -1786,6 +1747,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ + {{401, 738}, {617, 0}} com.apple.InterfaceBuilder.CocoaPlugin {{418, 770}, {617, 0}} com.apple.InterfaceBuilder.CocoaPlugin @@ -1901,30 +1863,20 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ YES errormsg - reconnectButton registerController registerView - runButton sourceViewer stackArrayController statusmsg - stepInButton - stepOutButton - stepOverButton YES NSTextField - NSToolbarItem NSTreeController NSOutlineView - NSToolbarItem BSSourceView NSArrayController NSTextField - NSToolbarItem - NSToolbarItem - NSToolbarItem diff --git a/Source/DebuggerController.h b/Source/DebuggerController.h index 7cdd097..c0fb046 100644 --- a/Source/DebuggerController.h +++ b/Source/DebuggerController.h @@ -35,12 +35,6 @@ IBOutlet NSTextField *errormsg; IBOutlet BSSourceView *sourceViewer; - - IBOutlet NSToolbarItem *stepInButton; - IBOutlet NSToolbarItem *stepOutButton; - IBOutlet NSToolbarItem *stepOverButton; - IBOutlet NSToolbarItem *runButton; - IBOutlet NSToolbarItem *reconnectButton; } @property(readonly) GDBpConnection *connection; diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index 24eb990..212cf0b 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -96,6 +96,8 @@ return ([connection isConnected] && [stackController.stack count] > 1); else if (action == @selector(stepIn:) || action == @selector(stepOver:) || action == @selector(run:)) return [connection isConnected]; + else if (action == @selector(reconnect:)) + return ![connection isConnected]; return [[self window] validateUserInterfaceItem:anItem]; } @@ -117,25 +119,6 @@ [errormsg setHidden:YES]; [statusmsg setStringValue:aStatus]; [[self window] setTitle:[NSString stringWithFormat:@"GDBp @ %@:%d/%@", [connection remoteHost], [connection port], [connection session]]]; - - [stepInButton setEnabled:NO]; - [stepOutButton setEnabled:NO]; - [stepOverButton setEnabled:NO]; - [runButton setEnabled:NO]; - [reconnectButton setEnabled:NO]; - - if ([connection isConnected]) - { - if ([aStatus isEqualToString:@"Starting"]) - { - [stepInButton setEnabled:YES]; - [runButton setEnabled:YES]; - } - } - else - { - [reconnectButton setEnabled:YES]; - } } /** @@ -298,10 +281,6 @@ { [stackArrayController rearrangeObjects]; [stackArrayController setSelectionIndex:0]; - - [stepInButton setEnabled:YES]; - [stepOverButton setEnabled:YES]; - [runButton setEnabled:YES]; } #pragma mark BSSourceView Delegate -- 2.43.5