Revision: 29131
http://sourceforge.net/p/bibdesk/svn/29131
Author: hofman
Date: 2025-04-18 14:31:21 +0000 (Fri, 18 Apr 2025)
Log Message:
-----------
Calculate frame size directly
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-18
09:38:57 UTC (rev 29130)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-18
14:31:21 UTC (rev 29131)
@@ -1206,16 +1206,8 @@
#pragma mark Drawing layout
-- (CGFloat)_frameWidth {
- return ceil( [self _columnWidth] * _numberOfColumns - _padding.width +
[self _leftMargin] + [self _rightMargin] );
-}
-
-- (CGFloat)_frameHeight {
- return ceil( [self _rowHeight] * _numberOfRows + [self _topMargin] + [self
_bottomMargin] );
-}
-
- (void)_getIconSize:(NSSize *)iconSize padding:(NSSize *)padding
fittingContentWidth:(CGFloat)width {
- // calculate the column width, inverting the calculation in _frameWidth
+ // calculate the column width, inverting the calculation of the frame width
// make sure fractional widths won't bring back scrollers
CGFloat colWidth = ( floor(width) - 2 * DEFAULT_MARGIN.width ) /
_numberOfColumns;
// guess the iconScale, ignoring the rounding of the variable padding as
that can't be inverted
@@ -1227,7 +1219,7 @@
}
- (void)_getIconSize:(NSSize *)iconSize padding:(NSSize *)padding
fittingContentHeight:(CGFloat)height {
- // calculate the row height, inverting the calculation in _frameHeight
+ // calculate the row height, inverting the calculation of the frame height
// make sure fractional heights won't bring back scrollers
CGFloat rowHeight = ( floor(height) - DEFAULT_MARGIN.height ) /
_numberOfRows;
// guess the iconScale, ignoring the rounding of the variable padding as
that can't be inverted
@@ -1289,7 +1281,7 @@
// if we have an auto-hiding vertical scroller, we may or may not have
scroll bars, which affects the effective width
if (autoHidesScrollers && [scrollView hasVerticalScroller]) {
- // the _frameWidth for the MIN_AUTO_SCALE
+ // the frame width for the MIN_AUTO_SCALE
CGFloat minWidth = ceil( [self
_paddingForScale:MIN_AUTO_ICON_SCALE].width + MIN_AUTO_ICON_SCALE *
DEFAULT_ICON_SIZE.width + 2 * DEFAULT_MARGIN.width );
// first assume we need a vertical scroller...
@@ -1335,7 +1327,7 @@
// if we have an auto-hiding horizontal scroller, we may or may not
have scroll bars, which affects the effective height
if (autoHidesScrollers && [scrollView hasHorizontalScroller]) {
- // the _frameHeight for the MIN_AUTO_SCALE
+ // the frame height for the MIN_AUTO_SCALE
CGFloat minHeight = ceil( [self
_paddingForScale:MIN_AUTO_ICON_SCALE].height + MIN_AUTO_ICON_SCALE *
DEFAULT_ICON_SIZE.height + DEFAULT_MARGIN.height );
// first assume we need a horizontal scroller...
@@ -1380,7 +1372,7 @@
// if we have an auto-hiding vertical scroller, we may or may not have
scroll bars, which affects the effective width
if (autoHidesScrollers && [scrollView hasVerticalScroller]) {
- // the _frameWidth for a single column
+ // the frame width for a single column
CGFloat minWidth = ceil( [self _columnWidth] + 2 *
DEFAULT_MARGIN.width );
// first assume we don't need a vertical scroller...
@@ -1387,7 +1379,7 @@
contentSize =
_contentSizeForScrollViewHavingVerticalScroller(scrollView, minWidth, NO);
[self _getColumns:&numberOfColumns rows:&numberOfRows
fittingContentWidth:contentSize.width];
- if (contentSize.height < ceil( [self _rowHeight] * numberOfRows +
[self _topMargin] + [self _bottomMargin] )) {
+ if (contentSize.height < ceil( [self _rowHeight] * numberOfRows +
DEFAULT_MARGIN.height )) {
// we have insufficient height to fit all icons, so
recalculate with vertical scroller
contentSize =
_contentSizeForScrollViewHavingVerticalScroller(scrollView, minWidth, YES);
[self _getColumns:&numberOfColumns rows:&numberOfRows
fittingContentWidth:contentSize.width];
@@ -1404,7 +1396,9 @@
}
if (scrollView) {
- NSRect frame = NSMakeRect(0.0, 0.0, fmax([self _frameWidth],
contentSize.width), fmax([self _frameHeight], contentSize.height));
+ NSRect frame = NSZeroRect;
+ frame.size.width = fmax(contentSize.width, ceil( [self _columnWidth] *
_numberOfColumns + 2 * DEFAULT_MARGIN.width ));
+ frame.size.height = fmax(contentSize.height, ceil( [self _rowHeight] *
_numberOfRows + DEFAULT_MARGIN.height ));
if (NSEqualRects([self frame], frame) == NO) {
[super setFrame:frame];
[scrollView reflectScrolledClipView:[scrollView contentView]];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit