Constrain the size of the debugger split views.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 26 Feb 2022 19:07:32 +0000 (14:07 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 26 Feb 2022 19:07:32 +0000 (14:07 -0500)
It was possible to resize the split view panes so that one side became
invisible, with no easy way to get it back.

CHANGES
Source/DebuggerController.h
Source/DebuggerController.m
en.lproj/Debugger.xib

diff --git a/CHANGES b/CHANGES
index 78d3b8f28ff622b4d721b6b9a1f7428dac7b9549..198895ea0d855e30518e24784168f37e429f2f1d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
 MacGDBp                                                               CHANGE LOG
 ================================================================================
 
+2.1.1
+#####################
+- Fix: Constrain the minimum size of the debugger split views, so that panes
+  cannot be permanently hidden.
+
 2.1
 #####################
 - New: Native support for Apple Silicon.
index 1bc5363a15fa70fd752b263bec5d948147ae448e..ebe791767ba4caa9880c8b1e70de787274b38f65 100644 (file)
@@ -22,7 +22,7 @@
 @class DebuggerBackEnd;
 @class DebuggerModel;
 
-@interface DebuggerController : NSWindowController <NSWindowDelegate>
+@interface DebuggerController : NSWindowController <NSWindowDelegate, NSSplitViewDelegate>
 
 @property(readonly) DebuggerBackEnd* connection;
 @property(readonly) DebuggerModel* model;
index 961ff92ba585e644d58e458f089227d78cf3f5c6..33383a0c56b111954426f529a93f8d305add1ad8 100644 (file)
 #endif  // USE_APP_SANDBOX
 }
 
+#pragma mark NSSplitView Delegate
+
+- (CGFloat)splitView:(NSSplitView*)splitView
+constrainSplitPosition:(CGFloat)proposedPosition
+         ofSubviewAt:(NSInteger)dividerIndex
+{
+  const NSSize splitViewSize = splitView.bounds.size;
+  const CGFloat minimumSplit = 150;
+  const CGFloat maximumSplit = (splitView.isVertical ? splitViewSize.width : splitViewSize.height) - minimumSplit;
+
+  if (proposedPosition < minimumSplit)
+    return minimumSplit;
+  if (proposedPosition > maximumSplit)
+    return maximumSplit;
+  return proposedPosition;
+}
+
 @end
index f1e6ee14ba4b2014da608a0b2e8bfdc1e4f19aa0..a5d0408e7ae8ed04e76a7c51513faf31ad1ed293 100644 (file)
@@ -81,7 +81,7 @@
                                                                         <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                         <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                                                         <tableColumns>
-                                                                            <tableColumn editable="NO" width="73.5" minWidth="16" maxWidth="1000" id="14">
+                                                                            <tableColumn editable="NO" width="64" minWidth="16" maxWidth="1000" id="14">
                                                                                 <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Variable">
                                                                                     <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                                     <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
                                                                                     </binding>
                                                                                 </connections>
                                                                             </tableColumn>
-                                                                            <tableColumn editable="NO" width="94.5" minWidth="8" maxWidth="1000" id="13">
+                                                                            <tableColumn editable="NO" width="85" minWidth="8" maxWidth="1000" id="13">
                                                                                 <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Value">
                                                                                     <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                                     <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
                                                                                     </binding>
                                                                                 </connections>
                                                                             </tableColumn>
-                                                                            <tableColumn editable="NO" width="112.75439" minWidth="29.754390000000001" maxWidth="1000" id="81">
+                                                                            <tableColumn editable="NO" width="103.25439" minWidth="29.754390000000001" maxWidth="1000" id="81">
                                                                                 <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Type">
                                                                                     <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                                     <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
                                                     <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                     <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                                     <tableColumns>
-                                                        <tableColumn identifier="index" editable="NO" width="26.5" minWidth="10" maxWidth="30" id="17">
+                                                        <tableColumn identifier="index" editable="NO" width="19" minWidth="10" maxWidth="30" id="17">
                                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="#">
                                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                 <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
                                                                 </binding>
                                                             </connections>
                                                         </tableColumn>
-                                                        <tableColumn identifier="filename" editable="NO" width="128.5" minWidth="8" maxWidth="1000" id="18">
+                                                        <tableColumn identifier="filename" editable="NO" width="121" minWidth="8" maxWidth="1000" id="18">
                                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="File">
                                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                 <color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
                                                                 <binding destination="36" name="value" keyPath="arrangedObjects.filename" id="44"/>
                                                             </connections>
                                                         </tableColumn>
-                                                        <tableColumn identifier="lineNumber" editable="NO" width="147.5" minWidth="26" maxWidth="1000" id="42">
+                                                        <tableColumn identifier="lineNumber" editable="NO" width="140" minWidth="26" maxWidth="1000" id="42">
                                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Line">
                                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                 <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
                                                                 </binding>
                                                             </connections>
                                                         </tableColumn>
-                                                        <tableColumn identifier="function" editable="NO" width="234.5" minWidth="50.0625" maxWidth="1000" id="48">
+                                                        <tableColumn identifier="function" editable="NO" width="228" minWidth="50.0625" maxWidth="1000" id="48">
                                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Function">
                                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                 <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
                                     <real value="250"/>
                                     <real value="250"/>
                                 </holdingPriorities>
+                                <connections>
+                                    <outlet property="delegate" destination="-2" id="yEB-lm-I75"/>
+                                </connections>
                             </splitView>
                         </subviews>
                         <holdingPriorities>
                             <real value="250"/>
                             <real value="250"/>
                         </holdingPriorities>
+                        <connections>
+                            <outlet property="delegate" destination="-2" id="uQh-vz-JzN"/>
+                        </connections>
                     </splitView>
                 </subviews>
             </view>
                     <toolbarItem implicitItemIdentifier="69AE2ACB-C36A-4083-9D2B-3572B7A21CA0" label="Step In" paletteLabel="Step In" toolTip="Step In" image="StepInTemplate" sizingBehavior="auto" id="wHU-wT-jc4" customClass="ValidatingNSToolbarItem">
                         <button key="view" verticalHuggingPriority="750" id="YNB-SH-ciO">
                             <rect key="frame" x="0.0" y="14" width="45" height="25"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="StepInTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="9sF-Wx-nCI">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                     <toolbarItem implicitItemIdentifier="BCF9D13D-041F-4A9B-9D75-6AC074995436" label="Step Out" paletteLabel="Step Out" toolTip="Step Out" image="StepOutTemplate" sizingBehavior="auto" id="ufJ-5Q-WL7" customClass="ValidatingNSToolbarItem">
                         <button key="view" verticalHuggingPriority="750" id="Mjb-90-kNO">
                             <rect key="frame" x="5" y="14" width="45" height="25"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="StepOutTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3kU-ib-eyA">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                     <toolbarItem implicitItemIdentifier="EC9FAEF4-0C25-4E7D-9F3D-443E4672DE6E" label="Step Over" paletteLabel="Step Over" toolTip="Step Over" image="StepOverTemplate" sizingBehavior="auto" id="5k5-MH-RDF" customClass="ValidatingNSToolbarItem">
                         <button key="view" verticalHuggingPriority="750" id="bvu-m4-jMC">
                             <rect key="frame" x="8" y="14" width="45" height="25"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="StepOverTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mga-QP-Tfn">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                     <toolbarItem implicitItemIdentifier="58386453-DE59-433C-B30B-4B0D4B5A649C" label="Run" paletteLabel="Run" toolTip="Run" image="Run" sizingBehavior="auto" id="tdv-j4-098" customClass="ValidatingNSToolbarItem">
                         <button key="view" verticalHuggingPriority="750" id="arO-TR-gYF">
                             <rect key="frame" x="0.0" y="14" width="45" height="25"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="Run" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mkt-pQ-lBx">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                     <toolbarItem implicitItemIdentifier="127468BC-789B-4F17-900B-E11D3BBC1CA2" label="Stop" paletteLabel="Stop" toolTip="Stop" image="Stop" sizingBehavior="auto" id="2FY-E7-O5U" customClass="ValidatingNSToolbarItem">
                         <button key="view" verticalHuggingPriority="750" id="yYe-sC-BgP">
                             <rect key="frame" x="0.0" y="14" width="45" height="25"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="Stop" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="z8L-fC-wzL">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                     <toolbarItem implicitItemIdentifier="1004F2E7-E87F-4BF2-ADEC-2AB74BD70EC3" label="Variable Inspector" paletteLabel="Variable Inspector" toolTip="Variable Inspector" image="HUDIcon" sizingBehavior="auto" id="U1g-Xu-m4W" customClass="ValidatingNSToolbarItem">
                         <button key="view" verticalHuggingPriority="750" id="oqt-mU-aZ3">
                             <rect key="frame" x="29" y="14" width="45" height="25"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="HUDIcon" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3nN-nX-5rn">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                         <nil key="toolTip"/>
                         <textField key="view" horizontalHuggingPriority="251" verticalHuggingPriority="750" id="qX0-Gp-ynT">
                             <rect key="frame" x="0.0" y="14" width="150" height="17"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="center" title="Status" bezelStyle="round" id="rIc-hM-8tF">
                                 <font key="font" metaFont="smallSystem"/>
                                 <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                         <nil key="toolTip"/>
                         <button key="view" verticalHuggingPriority="750" id="591">
                             <rect key="frame" x="0.0" y="14" width="83" height="19"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <buttonCell key="cell" type="recessed" title="Attached" bezelStyle="recessed" alignment="center" state="on" borderStyle="border" inset="2" id="592">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
                                 <font key="font" metaFont="systemBold" size="12"/>