From 9d9489e1abfc427eb349f9e2fe2f78852acc8131 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 26 Feb 2022 14:07:32 -0500 Subject: [PATCH] Constrain the size of the debugger split views. It was possible to resize the split view panes so that one side became invisible, with no easy way to get it back. --- CHANGES | 5 +++++ Source/DebuggerController.h | 2 +- Source/DebuggerController.m | 17 +++++++++++++++++ en.lproj/Debugger.xib | 36 +++++++++++++++++++++--------------- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 78d3b8f..198895e 100644 --- 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. diff --git a/Source/DebuggerController.h b/Source/DebuggerController.h index 1bc5363..ebe7917 100644 --- a/Source/DebuggerController.h +++ b/Source/DebuggerController.h @@ -22,7 +22,7 @@ @class DebuggerBackEnd; @class DebuggerModel; -@interface DebuggerController : NSWindowController +@interface DebuggerController : NSWindowController @property(readonly) DebuggerBackEnd* connection; @property(readonly) DebuggerModel* model; diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index 961ff92..33383a0 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -403,4 +403,21 @@ #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 diff --git a/en.lproj/Debugger.xib b/en.lproj/Debugger.xib index f1e6ee1..a5d0408 100644 --- a/en.lproj/Debugger.xib +++ b/en.lproj/Debugger.xib @@ -81,7 +81,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -196,7 +196,7 @@ - + @@ -216,7 +216,7 @@ - + @@ -232,7 +232,7 @@ - + @@ -252,7 +252,7 @@ - + @@ -301,12 +301,18 @@ + + + + + + @@ -315,7 +321,7 @@