Use automatic validation of UI items for the toolbar buttons, rather than manually...
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Dec 2008 15:33:16 +0000 (10:33 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Dec 2008 15:33:16 +0000 (10:33 -0500)
* 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
Source/DebuggerController.h
Source/DebuggerController.m

index d0782d72edf3c6eaba44ff5f3aeed8c6e8c4667c..a58c123529b84a47f459e465eebee632b756a7d4 100644 (file)
@@ -8,7 +8,7 @@
                <string key="IBDocument.HIToolboxVersion">352.00</string>
                <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
                        <bool key="EncodedWithXMLCoder">YES</bool>
-                       <integer value="46"/>
+                       <integer value="7"/>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -76,7 +76,7 @@
                                                                <string key="NSToolbarItemMinSize">{0, 0}</string>
                                                                <string key="NSToolbarItemMaxSize">{0, 0}</string>
                                                                <bool key="NSToolbarItemEnabled">YES</bool>
-                                                               <bool key="NSToolbarItemAutovalidates">NO</bool>
+                                                               <bool key="NSToolbarItemAutovalidates">YES</bool>
                                                                <int key="NSToolbarItemTag">-1</int>
                                                                <bool key="NSToolbarIsUserRemovable">YES</bool>
                                                                <int key="NSToolbarItemVisibilityPriority">0</int>
@@ -98,7 +98,7 @@
                                                                <string key="NSToolbarItemMinSize">{0, 0}</string>
                                                                <string key="NSToolbarItemMaxSize">{0, 0}</string>
                                                                <bool key="NSToolbarItemEnabled">YES</bool>
-                                                               <bool key="NSToolbarItemAutovalidates">NO</bool>
+                                                               <bool key="NSToolbarItemAutovalidates">YES</bool>
                                                                <int key="NSToolbarItemTag">-1</int>
                                                                <bool key="NSToolbarIsUserRemovable">YES</bool>
                                                                <int key="NSToolbarItemVisibilityPriority">0</int>
                                                                <string key="NSToolbarItemMinSize">{0, 0}</string>
                                                                <string key="NSToolbarItemMaxSize">{0, 0}</string>
                                                                <bool key="NSToolbarItemEnabled">YES</bool>
-                                                               <bool key="NSToolbarItemAutovalidates">NO</bool>
+                                                               <bool key="NSToolbarItemAutovalidates">YES</bool>
                                                                <int key="NSToolbarItemTag">-1</int>
                                                                <bool key="NSToolbarIsUserRemovable">YES</bool>
                                                                <int key="NSToolbarItemVisibilityPriority">0</int>
                                                                <string key="NSToolbarItemMinSize">{0, 0}</string>
                                                                <string key="NSToolbarItemMaxSize">{0, 0}</string>
                                                                <bool key="NSToolbarItemEnabled">YES</bool>
-                                                               <bool key="NSToolbarItemAutovalidates">NO</bool>
+                                                               <bool key="NSToolbarItemAutovalidates">YES</bool>
                                                                <int key="NSToolbarItemTag">-1</int>
                                                                <bool key="NSToolbarIsUserRemovable">YES</bool>
                                                                <int key="NSToolbarItemVisibilityPriority">0</int>
                                                                <string key="NSToolbarItemMinSize">{0, 0}</string>
                                                                <string key="NSToolbarItemMaxSize">{0, 0}</string>
                                                                <bool key="NSToolbarItemEnabled">YES</bool>
-                                                               <bool key="NSToolbarItemAutovalidates">NO</bool>
+                                                               <bool key="NSToolbarItemAutovalidates">YES</bool>
                                                                <int key="NSToolbarItemTag">-1</int>
                                                                <bool key="NSToolbarIsUserRemovable">YES</bool>
                                                                <int key="NSToolbarItemVisibilityPriority">0</int>
@@ -1140,46 +1140,6 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                        </object>
                                        <int key="connectionID">488</int>
                                </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" key="connection">
-                                               <string key="label">stepInButton</string>
-                                               <reference key="source" ref="78922448"/>
-                                               <reference key="destination" ref="966497091"/>
-                                       </object>
-                                       <int key="connectionID">489</int>
-                               </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" key="connection">
-                                               <string key="label">stepOutButton</string>
-                                               <reference key="source" ref="78922448"/>
-                                               <reference key="destination" ref="121644564"/>
-                                       </object>
-                                       <int key="connectionID">490</int>
-                               </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" key="connection">
-                                               <string key="label">stepOverButton</string>
-                                               <reference key="source" ref="78922448"/>
-                                               <reference key="destination" ref="822794044"/>
-                                       </object>
-                                       <int key="connectionID">491</int>
-                               </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" key="connection">
-                                               <string key="label">runButton</string>
-                                               <reference key="source" ref="78922448"/>
-                                               <reference key="destination" ref="578309120"/>
-                                       </object>
-                                       <int key="connectionID">492</int>
-                               </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" key="connection">
-                                               <string key="label">reconnectButton</string>
-                                               <reference key="source" ref="78922448"/>
-                                               <reference key="destination" ref="524686954"/>
-                                       </object>
-                                       <int key="connectionID">493</int>
-                               </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBOutletConnection" key="connection">
                                                <string key="label">sourceViewer</string>
@@ -1707,6 +1667,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                        <string>467.IBShouldRemoveOnLegacySave</string>
                                        <string>468.IBShouldRemoveOnLegacySave</string>
                                        <string>469.IBShouldRemoveOnLegacySave</string>
+                                       <string>471.IBEditorWindowLastContentRect</string>
                                        <string>471.IBPluginDependency</string>
                                        <string>471.editorWindowContentRectSynchronizationRect</string>
                                        <string>474.IBPluginDependency</string>
@@ -1786,6 +1747,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                        <reference ref="9"/>
                                        <reference ref="9"/>
                                        <reference ref="9"/>
+                                       <string>{{401, 738}, {617, 0}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>{{418, 770}, {617, 0}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1901,30 +1863,20 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
                                                <object class="NSMutableArray" key="dict.sortedKeys">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <string>errormsg</string>
-                                                       <string>reconnectButton</string>
                                                        <string>registerController</string>
                                                        <string>registerView</string>
-                                                       <string>runButton</string>
                                                        <string>sourceViewer</string>
                                                        <string>stackArrayController</string>
                                                        <string>statusmsg</string>
-                                                       <string>stepInButton</string>
-                                                       <string>stepOutButton</string>
-                                                       <string>stepOverButton</string>
                                                </object>
                                                <object class="NSMutableArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <string>NSTextField</string>
-                                                       <string>NSToolbarItem</string>
                                                        <string>NSTreeController</string>
                                                        <string>NSOutlineView</string>
-                                                       <string>NSToolbarItem</string>
                                                        <string>BSSourceView</string>
                                                        <string>NSArrayController</string>
                                                        <string>NSTextField</string>
-                                                       <string>NSToolbarItem</string>
-                                                       <string>NSToolbarItem</string>
-                                                       <string>NSToolbarItem</string>
                                                </object>
                                        </object>
                                        <object class="IBClassDescriptionSource" key="sourceIdentifier">
index 7cdd097797346f58fd50198d89fead000b9a4585..c0fb046031bf1214d2cf0db009f51d947a32c74e 100644 (file)
        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;
index 24eb990ee58c4cb32a66a481a48440cf7ef11cdf..212cf0b195c572d30bd88c9064e83e626b2b298a 100644 (file)
@@ -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];
 }
        [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];
-       }
 }
 
 /**
 {
        [stackArrayController rearrangeObjects];
        [stackArrayController setSelectionIndex:0];
-       
-       [stepInButton setEnabled:YES];
-       [stepOverButton setEnabled:YES];
-       [runButton setEnabled:YES];
 }
 
 #pragma mark BSSourceView Delegate