Remove the dedicated Breakpoints source view.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 4 Dec 2016 05:41:49 +0000 (00:41 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 4 Dec 2016 05:41:49 +0000 (00:41 -0500)
Use the same source view for the stack as the breakpoints.

English.lproj/Breakpoints.xib
Source/BreakpointController.h
Source/BreakpointController.m
Source/BreakpointManager.m
Source/DebuggerController.m

index 774a213c8025cb950420370a99876ae659a7ac30..832ff6a8e9d27522ebf5302f6e4c520705c16ce3 100644 (file)
@@ -9,7 +9,6 @@
         <customObject id="-2" userLabel="File's Owner" customClass="BreakpointController">
             <connections>
                 <outlet property="arrayController" destination="28" id="35"/>
-                <outlet property="sourceView" destination="hds-fn-ZMp" id="xJW-ll-wla"/>
                 <outlet property="view" destination="uUK-Ll-YSm" id="ujh-9q-BWz"/>
             </connections>
         </customObject>
             <rect key="frame" x="0.0" y="0.0" width="574" height="484"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
-                <splitView dividerStyle="thin" id="dSm-S9-gg1">
-                    <rect key="frame" x="0.0" y="0.0" width="574" height="484"/>
+                <button verticalHuggingPriority="750" misplaced="YES" id="NEA-NE-e2L">
+                    <rect key="frame" x="23" y="-1" width="24" height="23"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                    <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="RTj-JH-bdO">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                        <string key="keyEquivalent">\7f</string>
+                    </buttonCell>
+                    <connections>
+                        <action selector="removeBreakpoint:" target="-2" id="65m-Li-WgP"/>
+                    </connections>
+                </button>
+                <button verticalHuggingPriority="750" misplaced="YES" id="lru-8s-P8q">
+                    <rect key="frame" x="0.0" y="-1" width="24" height="23"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                    <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7HD-4r-sdn">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
+                    <connections>
+                        <action selector="addBreakpoint:" target="-2" id="qiy-D7-vZp"/>
+                    </connections>
+                </button>
+                <scrollView focusRingType="none" misplaced="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="QUj-nl-H1n">
+                    <rect key="frame" x="0.0" y="20" width="574" height="464"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                    <subviews>
-                        <customView id="hds-fn-ZMp" customClass="BSSourceView">
-                            <rect key="frame" x="0.0" y="0.0" width="574" height="221"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                            <connections>
-                                <outlet property="delegate" destination="-2" id="yPG-gl-ySf"/>
-                            </connections>
-                        </customView>
-                        <customView id="siI-sb-Ohb">
-                            <rect key="frame" x="0.0" y="222" width="574" height="262"/>
-                            <autoresizingMask key="autoresizingMask"/>
-                            <subviews>
-                                <button verticalHuggingPriority="750" misplaced="YES" id="NEA-NE-e2L">
-                                    <rect key="frame" x="23" y="-1" width="26" height="23"/>
-                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                    <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="RTj-JH-bdO">
-                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                        <font key="font" metaFont="system"/>
-                                        <string key="keyEquivalent">\7f</string>
-                                    </buttonCell>
-                                    <connections>
-                                        <action selector="removeBreakpoint:" target="-2" id="65m-Li-WgP"/>
-                                    </connections>
-                                </button>
-                                <button verticalHuggingPriority="750" misplaced="YES" id="lru-8s-P8q">
-                                    <rect key="frame" x="0.0" y="-1" width="24" height="23"/>
-                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                    <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7HD-4r-sdn">
-                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                        <font key="font" metaFont="system"/>
-                                    </buttonCell>
-                                    <connections>
-                                        <action selector="addBreakpoint:" target="-2" id="qiy-D7-vZp"/>
-                                    </connections>
-                                </button>
-                                <scrollView misplaced="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="QUj-nl-H1n">
-                                    <rect key="frame" x="0.0" y="20" width="574" height="242"/>
-                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                    <clipView key="contentView" id="vnD-I2-3RC">
-                                        <rect key="frame" x="1" y="0.0" width="572" height="241"/>
-                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        <subviews>
-                                            <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnSelection="YES" autosaveColumns="NO" headerView="XI3-4j-eHA" id="d8X-q7-NYd">
-                                                <rect key="frame" x="0.0" y="0.0" width="572" height="218"/>
-                                                <autoresizingMask key="autoresizingMask"/>
-                                                <size key="intercellSpacing" width="3" height="2"/>
-                                                <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
-                                                <tableColumns>
-                                                    <tableColumn width="425" minWidth="40" maxWidth="1000" id="RCP-bP-B4d">
-                                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="File">
-                                                            <font key="font" metaFont="smallSystem"/>
-                                                            <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
-                                                            <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
-                                                        </tableHeaderCell>
-                                                        <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="IV1-Sj-2od">
-                                                            <font key="font" metaFont="smallSystem"/>
-                                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                        </textFieldCell>
-                                                        <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
-                                                        <connections>
-                                                            <binding destination="28" name="value" keyPath="arrangedObjects.file" id="8aj-3i-nGj"/>
-                                                        </connections>
-                                                    </tableColumn>
-                                                    <tableColumn width="141" minWidth="40" maxWidth="1000" id="MvD-nE-8qa">
-                                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Line">
-                                                            <font key="font" metaFont="smallSystem"/>
-                                                            <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
-                                                            <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
-                                                        </tableHeaderCell>
-                                                        <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="kPe-Mi-bAY">
-                                                            <font key="font" metaFont="smallSystem"/>
-                                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                        </textFieldCell>
-                                                        <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
-                                                        <connections>
-                                                            <binding destination="28" name="value" keyPath="arrangedObjects.line" id="keh-Aa-ayp"/>
-                                                        </connections>
-                                                    </tableColumn>
-                                                </tableColumns>
-                                                <connections>
-                                                    <outlet property="delegate" destination="-2" id="Tc8-nD-s4R"/>
-                                                </connections>
-                                            </tableView>
-                                        </subviews>
-                                    </clipView>
-                                    <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="Abm-OM-c9d">
-                                        <rect key="frame" x="1" y="223" width="557" height="15"/>
-                                        <autoresizingMask key="autoresizingMask"/>
-                                    </scroller>
-                                    <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="NaV-vD-Og8">
-                                        <rect key="frame" x="558" y="17" width="15" height="206"/>
-                                        <autoresizingMask key="autoresizingMask"/>
-                                    </scroller>
-                                    <tableHeaderView key="headerView" id="XI3-4j-eHA">
-                                        <rect key="frame" x="0.0" y="0.0" width="572" height="23"/>
-                                        <autoresizingMask key="autoresizingMask"/>
-                                    </tableHeaderView>
-                                </scrollView>
-                            </subviews>
-                        </customView>
-                    </subviews>
-                    <holdingPriorities>
-                        <real value="250"/>
-                        <real value="250"/>
-                    </holdingPriorities>
-                </splitView>
+                    <clipView key="contentView" id="vnD-I2-3RC">
+                        <rect key="frame" x="1" y="0.0" width="572" height="463"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnSelection="YES" autosaveColumns="NO" headerView="XI3-4j-eHA" id="d8X-q7-NYd">
+                                <rect key="frame" x="0.0" y="0.0" width="572" height="440"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                                <size key="intercellSpacing" width="3" height="2"/>
+                                <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                <tableColumns>
+                                    <tableColumn width="425" minWidth="40" maxWidth="1000" id="RCP-bP-B4d">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="File">
+                                            <font key="font" metaFont="smallSystem"/>
+                                            <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
+                                        </tableHeaderCell>
+                                        <textFieldCell key="dataCell" lineBreakMode="truncatingMiddle" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="IV1-Sj-2od">
+                                            <font key="font" metaFont="smallSystem"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                        <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                        <connections>
+                                            <binding destination="28" name="value" keyPath="arrangedObjects.file" id="8aj-3i-nGj"/>
+                                        </connections>
+                                    </tableColumn>
+                                    <tableColumn width="141" minWidth="40" maxWidth="1000" id="MvD-nE-8qa">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Line">
+                                            <font key="font" metaFont="smallSystem"/>
+                                            <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
+                                        </tableHeaderCell>
+                                        <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="kPe-Mi-bAY">
+                                            <font key="font" metaFont="smallSystem"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                        <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                        <connections>
+                                            <binding destination="28" name="value" keyPath="arrangedObjects.line" id="keh-Aa-ayp"/>
+                                        </connections>
+                                    </tableColumn>
+                                </tableColumns>
+                                <connections>
+                                    <outlet property="delegate" destination="-2" id="Tc8-nD-s4R"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                    </clipView>
+                    <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="Abm-OM-c9d">
+                        <rect key="frame" x="1" y="223" width="557" height="15"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                    <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="NaV-vD-Og8">
+                        <rect key="frame" x="558" y="17" width="15" height="206"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                    <tableHeaderView key="headerView" id="XI3-4j-eHA">
+                        <rect key="frame" x="0.0" y="0.0" width="572" height="23"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </tableHeaderView>
+                </scrollView>
             </subviews>
         </view>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <arrayController objectClassName="Breakpoint" automaticallyPreparesContent="YES" automaticallyRearrangesObjects="YES" id="28">
+        <arrayController objectClassName="Breakpoint" automaticallyPreparesContent="YES" preservesSelection="NO" selectsInsertedObjects="NO" avoidsEmptySelection="NO" automaticallyRearrangesObjects="YES" id="28">
             <declaredKeys>
                 <string>file</string>
                 <string>line</string>
             </declaredKeys>
             <connections>
-                <binding destination="-2" name="contentArray" keyPath="manager.breakpoints" id="30"/>
+                <binding destination="-2" name="contentArray" keyPath="_manager.breakpoints" id="3RA-Ia-VZL"/>
             </connections>
         </arrayController>
         <userDefaultsController representsSharedInstance="YES" id="43"/>
index c5c4069e15af9a47480be45ac22a41f3de82ceee..c19f83e6688d25572d91f60645ab42d0e0bc5247 100644 (file)
 #import "BSSourceView.h"
 
 @interface BreakpointController : NSViewController<BSSourceViewDelegate>
-{
-  BreakpointManager* manager;
-  
-  IBOutlet NSArrayController* arrayController;
-  IBOutlet BSSourceView* sourceView;
-}
 
-@property(readonly) BSSourceView* sourceView;
-@property(readonly) NSArrayController* arrayController;
+@property(nonatomic, assign) IBOutlet NSArrayController* arrayController;
+
+- (instancetype)initWithSourceView:(BSSourceView*)sourceView;
 
 - (IBAction)addBreakpoint:(id)sender;
 - (IBAction)removeBreakpoint:(id)sender;
index 1b71ce2daf215ef0a801e72285b15155fb918b0b..318422d41dee1ac1d6c750f1b7c43b811d110f15 100644 (file)
 #import "AppDelegate.h"
 #import "PreferenceNames.h"
 
-@implementation BreakpointController
+@implementation BreakpointController {
+  BreakpointManager* _manager;
 
-@synthesize sourceView, arrayController;
+  BSSourceView* _sourceView;
+  NSArrayController* _arrayController;
+}
 
 /**
  * Constructor
  */
-- (id)init
+- (id)initWithSourceView:(BSSourceView*)sourceView
 {
-  if (self = [super initWithNibName:@"Breakpoints" bundle:nil])
-  {
-    manager = [BreakpointManager sharedManager];
+  if ((self = [super initWithNibName:@"Breakpoints" bundle:nil])) {
+    _manager = [BreakpointManager sharedManager];
+    _sourceView = sourceView;
   }
   return self;
 }
@@ -48,7 +51,7 @@
     return;
   }
   
-  [sourceView setFile:[[panel URL] path]];
+  [_sourceView setFile:[[panel URL] path]];
 }
 
 /**
@@ -56,7 +59,7 @@
  */
 - (IBAction)removeBreakpoint:(id)sender
 {
-  NSArray* selection = [arrayController selectedObjects];
+  NSArray* selection = [_arrayController selectedObjects];
   if ([selection count] < 1)
   {
     return;
@@ -64,7 +67,7 @@
   
   for (Breakpoint* bp in selection)
   {
-    [manager removeBreakpointAt:[bp line] inFile:[bp file]];
+    [_manager removeBreakpointAt:[bp line] inFile:[bp file]];
   }
 }
 
  */
 - (void)tableViewSelectionDidChange:(NSNotification*)notif
 {
-  NSArray* selection = [arrayController selectedObjects];
+  NSArray* selection = [_arrayController selectedObjects];
   if ([selection count] < 1)
   {
     return;
   }
   
   Breakpoint* bp = [selection objectAtIndex:0];
-  [sourceView setFile:[bp file]];
-  [sourceView scrollToLine:[bp line]];
-  [sourceView setMarkers:[manager breakpointsForFile:bp.file]];
+  [_sourceView setFile:[bp file]];
+  [_sourceView scrollToLine:[bp line]];
+  [_sourceView setMarkers:[_manager breakpointsForFile:bp.file]];
 }
 
 #pragma mark BSSourceView Delegate
 
-/**
- * The gutter was clicked, which indicates that a breakpoint needs to be changed
- */
-- (void)gutterClickedAtLine:(NSUInteger)line forFile:(NSString*)file
-{
-  if ([manager hasBreakpointAt:line inFile:file])
-  {
-    [manager removeBreakpointAt:line inFile:file];
-  }
-  else
-  {
-    Breakpoint* bp = [[Breakpoint alloc] initWithLine:line inFile:file];
-    [manager addBreakpoint:bp];
-    [bp release];
-  }
-  
-  [sourceView setMarkers:[manager breakpointsForFile:file]];
-}
-
 /**
  * Accepts a file dragged to set the contents of the display.
  */
index 2a3e2c07dace97209c4ef9884adbbf26c7903c6d..64ff5f6eaf9cf973fd39d481e959edb90b965699 100644 (file)
 {
   if (![breakpoints containsObject:bp])
   {
+    [self willChangeValueForKey:@"breakpoints"];
     [breakpoints addObject:bp];
+    [self didChangeValueForKey:@"breakpoints"];
+
     [connection addBreakpoint:bp];
     
     [savedBreakpoints addObject:[bp dictionary]];
       // array.
       [[b retain] autorelease];
 
+      [self willChangeValueForKey:@"breakpoints"];
       [breakpoints removeObject:b];
+      [self didChangeValueForKey:@"breakpoints"];
+
       [connection removeBreakpoint:b];
       
       [savedBreakpoints removeObject:[b dictionary]];
 {
   AppDelegate* appDel = [NSApp delegate];
   [[[appDel breakpoint] arrayController] rearrangeObjects];
-  [[[appDel breakpoint] sourceView] setNeedsDisplay:YES];
-  [[[appDel breakpoint] sourceView] setMarkers:[self breakpointsForFile:file]];
   [[[appDel debugger] sourceViewer] setNeedsDisplay:YES];
   [[[appDel debugger] sourceViewer] setMarkers:[self breakpointsForFile:file]];
 }
index 352eecb1f0efc86e4b138e8feef653167b5c27b7..b6a3e43121984426d490e9fb109618ec15a10cdb 100644 (file)
   self.connection.autoAttach = [attachedCheckbox_ state] == NSOnState;
 
   // Load view controllers into the tab views.
-  _breakpointsController = [[BreakpointController alloc] init];
+  _breakpointsController = [[BreakpointController alloc] initWithSourceView:sourceViewer];
   [[self.tabView tabViewItemAtIndex:1] setView:_breakpointsController.view];
 
   _evalController = [[EvalController alloc] initWithBackEnd:connection];