Revision: 12472
          http://sourceforge.net/p/skim-app/code/12472
Author:   hofman
Date:     2021-10-27 22:21:19 +0000 (Wed, 27 Oct 2021)
Log Message:
-----------
Swet minimum sizies using constraints on tab view. Add some >= constraints 
around table view. Make sure tables use plain style.

Modified Paths:
--------------
    trunk/Base.lproj/InfoWindow.xib
    trunk/SKCompatibility.h
    trunk/SKInfoWindowController.m

Modified: trunk/Base.lproj/InfoWindow.xib
===================================================================
--- trunk/Base.lproj/InfoWindow.xib     2021-10-27 09:12:36 UTC (rev 12471)
+++ trunk/Base.lproj/InfoWindow.xib     2021-10-27 22:21:19 UTC (rev 12472)
@@ -19,23 +19,26 @@
         <window title="Document Info" 
allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" 
hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" 
animationBehavior="default" id="5" userLabel="Window" customClass="NSPanel">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" 
miniaturizable="YES" resizable="YES" utility="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" 
rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
-            <rect key="contentRect" x="50" y="489" width="460" height="315"/>
+            <rect key="contentRect" x="50" y="489" width="460" height="308"/>
             <rect key="screenRect" x="0.0" y="0.0" width="1280" height="775"/>
-            <value key="minSize" type="size" width="280" height="295"/>
             <view key="contentView" id="6">
-                <rect key="frame" x="0.0" y="0.0" width="460" height="313"/>
+                <rect key="frame" x="0.0" y="0.0" width="460" height="308"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <tabView controlSize="small" 
translatesAutoresizingMaskIntoConstraints="NO" id="91">
-                        <rect key="frame" x="13" y="10" width="434" 
height="286"/>
+                        <rect key="frame" x="13" y="10" width="434" 
height="281"/>
+                        <constraints>
+                            <constraint firstAttribute="height" 
relation="greaterThanOrEqual" constant="268" id="5LP-bN-TfT"/>
+                            <constraint firstAttribute="width" 
relation="greaterThanOrEqual" constant="240" id="EgC-Zz-dXX"/>
+                        </constraints>
                         <tabViewItems>
                             <tabViewItem label="Summary" identifier="1" 
id="94">
                                 <view key="view" id="95">
-                                    <rect key="frame" x="10" y="25" 
width="414" height="250"/>
+                                    <rect key="frame" x="10" y="25" 
width="414" height="243"/>
                                     <autoresizingMask key="autoresizingMask" 
widthSizable="YES" heightSizable="YES"/>
                                     <subviews>
-                                        <scrollView focusRingType="none" 
borderType="none" autohidesScrollers="YES" horizontalLineScroll="22" 
horizontalPageScroll="10" verticalLineScroll="22" verticalPageScroll="10" 
hasHorizontalScroller="NO" hasVerticalScroller="NO" 
usesPredominantAxisScrolling="NO" 
translatesAutoresizingMaskIntoConstraints="NO" id="222">
-                                            <rect key="frame" x="17" y="24" 
width="380" height="220"/>
+                                        <scrollView focusRingType="none" 
horizontalCompressionResistancePriority="250" borderType="none" 
autohidesScrollers="YES" horizontalLineScroll="22" horizontalPageScroll="10" 
verticalLineScroll="22" verticalPageScroll="10" hasHorizontalScroller="NO" 
hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" 
horizontalScrollElasticity="none" verticalScrollElasticity="none" 
translatesAutoresizingMaskIntoConstraints="NO" id="222">
+                                            <rect key="frame" x="17" y="17" 
width="380" height="220"/>
                                             <clipView key="contentView" 
drawsBackground="NO" copiesOnScroll="NO" id="bhH-BC-5lo">
                                                 <rect key="frame" x="0.0" 
y="0.0" width="380" height="220"/>
                                                 <autoresizingMask 
key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -142,6 +145,7 @@
                                         </scrollView>
                                     </subviews>
                                     <constraints>
+                                        <constraint firstAttribute="bottom" 
relation="greaterThanOrEqual" secondItem="222" secondAttribute="bottom" 
constant="17" id="8V0-9f-Kt3"/>
                                         <constraint firstAttribute="trailing" 
secondItem="222" secondAttribute="trailing" constant="17" id="Wkt-m6-g59"/>
                                         <constraint firstItem="222" 
firstAttribute="leading" secondItem="95" secondAttribute="leading" 
constant="17" id="aMx-5P-2XI"/>
                                         <constraint firstItem="222" 
firstAttribute="top" secondItem="95" secondAttribute="top" constant="6" 
id="jjY-Cb-oW4"/>
@@ -150,20 +154,20 @@
                             </tabViewItem>
                             <tabViewItem label="Attributes" identifier="2" 
id="92">
                                 <view key="view" id="93">
-                                    <rect key="frame" x="10" y="25" 
width="414" height="248"/>
+                                    <rect key="frame" x="10" y="25" 
width="414" height="243"/>
                                     <autoresizingMask key="autoresizingMask" 
widthSizable="YES" heightSizable="YES"/>
                                     <subviews>
-                                        <scrollView focusRingType="none" 
borderType="none" autohidesScrollers="YES" horizontalLineScroll="22" 
horizontalPageScroll="10" verticalLineScroll="22" verticalPageScroll="10" 
hasHorizontalScroller="NO" hasVerticalScroller="NO" 
usesPredominantAxisScrolling="NO" 
translatesAutoresizingMaskIntoConstraints="NO" id="234">
-                                            <rect key="frame" x="17" y="17" 
width="380" height="225"/>
+                                        <scrollView focusRingType="none" 
borderType="none" autohidesScrollers="YES" horizontalLineScroll="22" 
horizontalPageScroll="10" verticalLineScroll="22" verticalPageScroll="10" 
hasHorizontalScroller="NO" hasVerticalScroller="NO" 
usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" 
verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" 
id="234">
+                                            <rect key="frame" x="17" y="17" 
width="380" height="220"/>
                                             <clipView key="contentView" 
drawsBackground="NO" copiesOnScroll="NO" id="0HB-s2-5Dm">
-                                                <rect key="frame" x="0.0" 
y="0.0" width="380" height="225"/>
+                                                <rect key="frame" x="0.0" 
y="0.0" width="380" height="220"/>
                                                 <autoresizingMask 
key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                 <subviews>
                                                     <tableView 
focusRingType="none" verticalHuggingPriority="750" 
allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" 
columnReordering="NO" columnResizing="NO" multipleSelection="NO" 
autosaveColumns="NO" typeSelect="NO" rowHeight="20" viewBased="YES" id="235">
-                                                        <rect key="frame" 
x="0.0" y="0.0" width="409" height="225"/>
+                                                        <rect key="frame" 
x="0.0" y="0.0" width="409" height="220"/>
                                                         <autoresizingMask 
key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                         <constraints>
-                                                            <constraint 
firstAttribute="height" constant="225" placeholder="YES" id="ebQ-b6-Tlw"/>
+                                                            <constraint 
firstAttribute="height" constant="220" placeholder="YES" id="ebQ-b6-Tlw"/>
                                                         </constraints>
                                                         <size 
key="intercellSpacing" width="3" height="2"/>
                                                         <color 
key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" 
colorSpace="calibratedRGB"/>

Modified: trunk/SKCompatibility.h
===================================================================
--- trunk/SKCompatibility.h     2021-10-27 09:12:36 UTC (rev 12471)
+++ trunk/SKCompatibility.h     2021-10-27 22:21:19 UTC (rev 12472)
@@ -127,6 +127,16 @@
 #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
 #endif
 
+#if SDK_BEFORE(10_11)
+
+enum {
+    NSVisualEffectMaterialMenu = 5,
+    NSVisualEffectMaterialPopover = 6,
+    NSVisualEffectMaterialSidebar = 7,
+};
+
+#endif
+
 #if SDK_BEFORE(10_12)
 
 typedef NS_ENUM(NSInteger, NSWindowUserTabbingPreference) {
@@ -174,20 +184,6 @@
 + (NSSegmentedControl *)segmentedControlWithLabels:(NSArray *)labels 
trackingMode:(NSSegmentSwitchTracking)trackingMode target:(id)target 
action:(SEL)action;
 @end
 
-#endif
-
-#if SDK_BEFORE(10_11)
-
-enum {
-    NSVisualEffectMaterialMenu = 5,
-    NSVisualEffectMaterialPopover = 6,
-    NSVisualEffectMaterialSidebar = 7,
-};
-
-#endif
-
-#if SDK_BEFORE(10_12)
-
 @interface NSVisualEffectView (SKSierraDeclarations)
 @property (getter=isEmphasized) BOOL emphasized;
 @end
@@ -208,6 +204,10 @@
     NSVisualEffectMaterialUnderPageBackground = 22
 };
 
+@interface NSView (SKMojaveExtensions)
+- (void)viewDidChangeEffectiveAppearance;
+@end
+
 #endif
 
 #if SDK_BEFORE(11_0)
@@ -225,13 +225,16 @@
 - (void)setToolbarStyle:(NSWindowToolbarStyle)style;
 @end
 
-#endif
+typedef NS_ENUM(NSInteger, NSTableViewStyle) {
+    NSTableViewStyleAutomatic,
+    NSTableViewStyleFullWidth,
+    NSTableViewStyleInset,
+    NSTableViewStyleSourceList,
+    NSTableViewStylePlain
+};
 
-#if SDK_BEFORE(10_14)
-
-@interface NSView (SKMojaveExtensions)
-- (void)viewDidChangeEffectiveAppearance;
+@interface NSTableView (BDSKBigSurDeclarations)
+@property NSTableViewStyle style;
 @end
 
 #endif
-

Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m      2021-10-27 09:12:36 UTC (rev 12471)
+++ trunk/SKInfoWindowController.m      2021-10-27 22:21:19 UTC (rev 12472)
@@ -154,6 +154,14 @@
 - (void)windowDidLoad {
     [self updateForDocument:[[[NSApp mainWindow] windowController] document]];
     
+    if ([summaryTableView respondsToSelector:@selector(setStyle:)]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpartial-availability"
+        [summaryTableView setStyle:NSTableViewStylePlain];
+        [attributesTableView setStyle:NSTableViewStylePlain];
+#pragma clang diagnostic pop
+    }
+    
     NSArray *tables = [NSArray arrayWithObjects:summaryTableView, 
attributesTableView, nil];
     NSTableView *tv;
     CGFloat width = 0.0;
@@ -164,10 +172,8 @@
         NSUInteger row, rowMax = [tv numberOfRows];
         for (row = 0; row < rowMax; row++) {
             NSString *key = [keys objectAtIndex:row];
-            id value = nil;
-            if ([key length])
-                value = [labels objectForKey:key] ?: [key 
stringByAppendingString:@":"];
-            [cell setStringValue:value ?: @""];
+            if ([key length] == 0) continue;
+            [cell setStringValue:[labels objectForKey:key] ?: [key 
stringByAppendingString:@":"]];
             width = fmax(width, ceil([cell cellSize].width));
         }
     }
@@ -358,7 +364,7 @@
         }
     }
     [[view textField] setObjectValue:value];
-    if ([tv isEqual:attributesTableView] && [[tableColumn identifier] 
isEqualToString:LABEL_COLUMN_ID])
+    if ([tv isEqual:attributesTableView] && [[tableColumn identifier] 
isEqualToString:VALUE_COLUMN_ID])
         [[view textField] setLineBreakMode:row == [tv numberOfRows] - 1 ? 
NSLineBreakByWordWrapping : NSLineBreakByTruncatingTail];
     return view;
 }

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to