Revision: 15736
          http://sourceforge.net/p/skim-app/code/15736
Author:   hofman
Date:     2025-10-30 17:09:19 +0000 (Thu, 30 Oct 2025)
Log Message:
-----------
move NSFont method to NSGraphics as function

Modified Paths:
--------------
    trunk/NSGraphics_SKExtensions.h
    trunk/NSGraphics_SKExtensions.m
    trunk/SKMainToolbarController.m
    trunk/SKOutlineView.m
    trunk/SKTableView.m
    trunk/Skim.xcodeproj/project.pbxproj

Removed Paths:
-------------
    trunk/NSFont_SKExtensions.h
    trunk/NSFont_SKExtensions.m

Deleted: trunk/NSFont_SKExtensions.h
===================================================================
--- trunk/NSFont_SKExtensions.h 2025-10-30 16:50:04 UTC (rev 15735)
+++ trunk/NSFont_SKExtensions.h 2025-10-30 17:09:19 UTC (rev 15736)
@@ -1,47 +0,0 @@
-//
-//  NSFont_SKExtensions.h
-//  Skim
-//
-//  Created by Christiaan Hofman on 2/17/10.
-/*
- This software is Copyright (c)  2010
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface NSFont (SKExtensions)
-@property (nonatomic, readonly) CGFloat defaultViewLineHeight;
-@end
-
-NS_ASSUME_NONNULL_END

Deleted: trunk/NSFont_SKExtensions.m
===================================================================
--- trunk/NSFont_SKExtensions.m 2025-10-30 16:50:04 UTC (rev 15735)
+++ trunk/NSFont_SKExtensions.m 2025-10-30 17:09:19 UTC (rev 15736)
@@ -1,52 +0,0 @@
-//
-//  NSFont_SKExtensions.m
-//  Skim
-//
-//  Created by Christiaan Hofman on 2/17/10.
-/*
- This software is Copyright (c) 2010
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "NSFont_SKExtensions.h"
-
-
-@implementation NSFont (SKExtensions)
-
-- (CGFloat)defaultViewLineHeight {
-    static NSTextFieldCell *cell = nil;
-    if (cell == nil)
-        cell = [[NSTextFieldCell alloc] init];
-    [cell setFont:self];
-    return [cell cellSize].height;
-}
-
-@end

Modified: trunk/NSGraphics_SKExtensions.h
===================================================================
--- trunk/NSGraphics_SKExtensions.h     2025-10-30 16:50:04 UTC (rev 15735)
+++ trunk/NSGraphics_SKExtensions.h     2025-10-30 17:09:19 UTC (rev 15736)
@@ -51,6 +51,10 @@
 
 #pragma mark -
 
+extern CGFloat SKDefaultLineHeightForFont(NSFont *font);
+
+#pragma mark -
+
 extern void SKDrawTextFieldBezel(NSRect rect, NSView *controlView);
 
 #pragma mark -

Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m     2025-10-30 16:50:04 UTC (rev 15735)
+++ trunk/NSGraphics_SKExtensions.m     2025-10-30 17:09:19 UTC (rev 15736)
@@ -147,6 +147,16 @@
 
 #pragma mark -
 
+extern CGFloat SKDefaultLineHeightForFont(NSFont *font) {
+    static NSTextFieldCell *cell = nil;
+    if (cell == nil)
+        cell = [[NSTextFieldCell alloc] initTextCell:@""];
+    [cell setFont:font];
+    return [cell cellSize].height;
+}
+
+#pragma mark -
+
 void SKDrawTextFieldBezel(NSRect rect, NSView *controlView) {
     static NSTextFieldCell *cell = nil;
     if (cell == nil) {

Modified: trunk/SKMainToolbarController.m
===================================================================
--- trunk/SKMainToolbarController.m     2025-10-30 16:50:04 UTC (rev 15735)
+++ trunk/SKMainToolbarController.m     2025-10-30 17:09:19 UTC (rev 15736)
@@ -61,7 +61,7 @@
 #import "PDFAnnotation_SKExtensions.h"
 #import "PDFDocument_SKExtensions.h"
 #import "SKShareMenuController.h"
-#import "NSFont_SKExtensions.h"
+#import "NSGraphics_SKExtensions.h"
 #import "SKNoteToolbarController.h"
 #import "NSObject_SKExtensions.h"
 
@@ -1562,7 +1562,7 @@
 
 - (NSRect)drawingRectForBounds:(NSRect)rect {
     NSRect r = [super drawingRectForBounds:rect];
-    r.size.height = [[self font] defaultViewLineHeight];
+    r.size.height = SKDefaultLineHeightForFont([self font]);
     r.origin.y = floor(0.5 * (NSHeight(rect) - NSHeight(r)));
     return r;
 }

Modified: trunk/SKOutlineView.m
===================================================================
--- trunk/SKOutlineView.m       2025-10-30 16:50:04 UTC (rev 15735)
+++ trunk/SKOutlineView.m       2025-10-30 17:09:19 UTC (rev 15736)
@@ -40,7 +40,7 @@
 #import "SKTypeSelectHelper.h"
 #import "SKImageToolTipWindow.h"
 #import "NSEvent_SKExtensions.h"
-#import "NSFont_SKExtensions.h"
+#import "NSGraphics_SKExtensions.h"
 
 #define SKImageToolTipRowNumberKey @"SKImageToolTipRowView"
 
@@ -221,7 +221,7 @@
                 [cell setFont:font];
         }
         
-        CGFloat rowHeight = [font defaultViewLineHeight];
+        CGFloat rowHeight = SKDefaultLineHeightForFont(font);
         if ([self selectionHighlightStyle] == 
NSTableViewSelectionHighlightStyleSourceList)
             rowHeight += 2.0;
         [self setRowHeight:rowHeight];

Modified: trunk/SKTableView.m
===================================================================
--- trunk/SKTableView.m 2025-10-30 16:50:04 UTC (rev 15735)
+++ trunk/SKTableView.m 2025-10-30 17:09:19 UTC (rev 15736)
@@ -39,7 +39,7 @@
 #import "SKTableView.h"
 #import "SKTypeSelectHelper.h"
 #import "NSEvent_SKExtensions.h"
-#import "NSFont_SKExtensions.h"
+#import "NSGraphics_SKExtensions.h"
 #import "SKImageToolTipWindow.h"
 
 #define SKImageToolTipRowNumberKey @"SKImageToolTipRow"
@@ -211,7 +211,7 @@
                 [cell setFont:font];
         }
         
-        [self setRowHeight:[font defaultViewLineHeight]];
+        [self setRowHeight:SKDefaultLineHeightForFont(font)];
         [self reloadData];
     }
 }

Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj        2025-10-30 16:50:04 UTC (rev 
15735)
+++ trunk/Skim.xcodeproj/project.pbxproj        2025-10-30 17:09:19 UTC (rev 
15736)
@@ -87,7 +87,6 @@
                CE209FAA0C9D38C6007C72F9 /* SKProgressController.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CE209FA80C9D38C6007C72F9 /* 
SKProgressController.m */; };
                CE20B1950C9F23CC007C72F9 /* NSView_SKExtensions.m in Sources */ 
= {isa = PBXBuildFile; fileRef = CE20B1930C9F23CC007C72F9 /* 
NSView_SKExtensions.m */; };
                CE21F736239944990078B257 /* SKColorMenuView.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE21F735239944990078B257 /* SKColorMenuView.m 
*/; };
-               CE24875C112C9651006B4FA5 /* NSFont_SKExtensions.m in Sources */ 
= {isa = PBXBuildFile; fileRef = CE24875B112C9651006B4FA5 /* 
NSFont_SKExtensions.m */; };
                CE2526362B3834E40084F43D /* NSToolbarItem_SKExtensions.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CE2526352B3834E40084F43D /* 
NSToolbarItem_SKExtensions.m */; };
                CE25BB6B163FFB770046A348 /* Skim.help in Resources */ = {isa = 
PBXBuildFile; fileRef = CE25BB43163FFB770046A348 /* Skim.help */; };
                CE26175F16CCFC4900BDCE7C /* SKSyncDot.m in Sources */ = {isa = 
PBXBuildFile; fileRef = CE26175E16CCFC4900BDCE7C /* SKSyncDot.m */; };
@@ -858,8 +857,6 @@
                CE20B1930C9F23CC007C72F9 /* NSView_SKExtensions.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= NSView_SKExtensions.m; sourceTree = "<group>"; };
                CE21F734239944990078B257 /* SKColorMenuView.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SKColorMenuView.h; 
sourceTree = "<group>"; };
                CE21F735239944990078B257 /* SKColorMenuView.m */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
SKColorMenuView.m; sourceTree = "<group>"; };
-               CE24875A112C9651006B4FA5 /* NSFont_SKExtensions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
NSFont_SKExtensions.h; sourceTree = "<group>"; };
-               CE24875B112C9651006B4FA5 /* NSFont_SKExtensions.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= NSFont_SKExtensions.m; sourceTree = "<group>"; };
                CE2526342B3834E40084F43D /* NSToolbarItem_SKExtensions.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
NSToolbarItem_SKExtensions.h; sourceTree = "<group>"; };
                CE2526352B3834E40084F43D /* NSToolbarItem_SKExtensions.m */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
NSToolbarItem_SKExtensions.m; sourceTree = "<group>"; };
                CE25BB43163FFB770046A348 /* Skim.help */ = {isa = 
PBXFileReference; lastKnownFileType = folder; path = Skim.help; sourceTree = 
"<group>"; };
@@ -2149,8 +2146,6 @@
                                CE0ECD1B0DE73604006EEDDB /* 
NSDocument_SKExtensions.m */,
                                CE34FFA60DFF58FB00A7FFE6 /* 
NSEvent_SKExtensions.h */,
                                CE34FFA70DFF58FB00A7FFE6 /* 
NSEvent_SKExtensions.m */,
-                               CE24875A112C9651006B4FA5 /* 
NSFont_SKExtensions.h */,
-                               CE24875B112C9651006B4FA5 /* 
NSFont_SKExtensions.m */,
                                CE139A151450207500E9C069 /* 
NSGraphics_SKExtensions.h */,
                                CE139A161450207500E9C069 /* 
NSGraphics_SKExtensions.m */,
                                CECDC4FC0C5966A80026AAEC /* 
NSImage_SKExtensions.h */,
@@ -2949,7 +2944,6 @@
                                CE455394111DA4290060CAC9 /* 
SKImageToolTipContext.m in Sources */,
                                CE099663112577A000EDB88F /* SKNotesPage.m in 
Sources */,
                                CE91C7962449F56600D04039 /* SKFileShare.m in 
Sources */,
-                               CE24875C112C9651006B4FA5 /* 
NSFont_SKExtensions.m in Sources */,
                                CE454B51226E33150034FD6B /* 
SKHighlightingTableRowView.m in Sources */,
                                CEF60F28114C53B40074ACC4 /* 
SKGeneralPreferences.m in Sources */,
                                CEF60F2C114C53DC0074ACC4 /* 
SKDisplayPreferences.m in Sources */,

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to