From 81e54ee9b5119ebdabfbb352f3b079c9a956e6eb Mon Sep 17 00:00:00 2001
From: Struma <strix@struma.me>
Date: Mon, 22 Feb 2021 15:13:30 -0500
Subject: [PATCH] Adjust sizes of keybinding menu cells

---
 macos/views/settingsmenu.xib | 46 +++++++++++++++++++-----------------
 src/settingsmenu.cpp         |  4 ++--
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/macos/views/settingsmenu.xib b/macos/views/settingsmenu.xib
index e402c4af..201da9a5 100644
--- a/macos/views/settingsmenu.xib
+++ b/macos/views/settingsmenu.xib
@@ -42,18 +42,19 @@
                     <scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="17" horizontalPageScroll="10" verticalLineScroll="17" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uYd-t4-S8p">
                         <rect key="frame" x="20" y="19" width="470" height="244"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                        <clipView key="contentView" id="KOM-hX-frH">
+                        <clipView key="contentView" drawsBackground="NO" id="KOM-hX-frH">
                             <rect key="frame" x="1" y="1" width="468" height="242"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" enabled="NO" rowSizeStyle="automatic" headerView="mPo-GX-PE3" viewBased="YES" id="40b-Cg-BV2">
+                                <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="reverseSequential" tableStyle="fullWidth" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" enabled="NO" rowSizeStyle="automatic" headerView="mPo-GX-PE3" viewBased="YES" id="40b-Cg-BV2">
                                     <rect key="frame" x="0.0" y="0.0" width="468" height="214"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <size key="intercellSpacing" width="17" height="0.0"/>
                                     <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    <tableViewGridLines key="gridStyleMask" vertical="YES" horizontal="YES"/>
                                     <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                     <tableColumns>
-                                        <tableColumn identifier="action" editable="NO" width="46" minWidth="40" maxWidth="1000" id="57F-2v-asd">
+                                        <tableColumn identifier="action" editable="NO" width="68" minWidth="40" maxWidth="1000" id="57F-2v-asd">
                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" enabled="NO" borderStyle="border" title="Action">
                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -63,14 +64,14 @@
                                                 <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                             </textFieldCell>
-                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
                                             <prototypeCellViews>
                                                 <tableCellView id="ew8-Bt-N3s">
-                                                    <rect key="frame" x="18" y="0.0" width="44" height="24"/>
+                                                    <rect key="frame" x="8" y="0.0" width="66" height="24"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
                                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QyE-hO-3xd">
-                                                            <rect key="frame" x="0.0" y="4" width="44" height="16"/>
+                                                            <rect key="frame" x="0.0" y="4" width="66" height="16"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                             <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="zsF-4Z-mNc">
                                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -85,7 +86,7 @@
                                                 </tableCellView>
                                             </prototypeCellViews>
                                         </tableColumn>
-                                        <tableColumn identifier="1" editable="NO" width="74" minWidth="40" maxWidth="1000" id="ych-Ib-Nti">
+                                        <tableColumn identifier="1" editable="NO" width="80" minWidth="40" maxWidth="1000" id="ych-Ib-Nti">
                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" enabled="NO" borderStyle="border" title="Binding 1">
                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -95,14 +96,14 @@
                                                 <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                             </textFieldCell>
-                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
                                             <prototypeCellViews>
                                                 <tableCellView id="Qfe-ct-Dr0">
-                                                    <rect key="frame" x="79" y="0.0" width="74" height="24"/>
+                                                    <rect key="frame" x="91" y="0.0" width="80" height="24"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
                                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JYY-ei-12j">
-                                                            <rect key="frame" x="0.0" y="4" width="74" height="16"/>
+                                                            <rect key="frame" x="0.0" y="4" width="80" height="16"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                             <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="iXG-jd-46d">
                                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -117,7 +118,7 @@
                                                 </tableCellView>
                                             </prototypeCellViews>
                                         </tableColumn>
-                                        <tableColumn identifier="2" editable="NO" width="82.5" minWidth="10" maxWidth="3.4028234663852886e+38" id="TET-Zo-QNV">
+                                        <tableColumn identifier="2" editable="NO" width="80" minWidth="10" maxWidth="3.4028234663852886e+38" id="TET-Zo-QNV">
                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" enabled="NO" borderStyle="border" alignment="left" title="Binding 2">
                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -127,14 +128,14 @@
                                                 <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                             </textFieldCell>
-                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
                                             <prototypeCellViews>
                                                 <tableCellView id="aX8-jO-E1t">
-                                                    <rect key="frame" x="170" y="0.0" width="83" height="17"/>
+                                                    <rect key="frame" x="188" y="0.0" width="80" height="17"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
                                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="43H-GL-Wav">
-                                                            <rect key="frame" x="0.0" y="1" width="83" height="16"/>
+                                                            <rect key="frame" x="0.0" y="1" width="80" height="16"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                             <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="YAO-qv-Z2K">
                                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -149,7 +150,7 @@
                                                 </tableCellView>
                                             </prototypeCellViews>
                                         </tableColumn>
-                                        <tableColumn identifier="3" editable="NO" width="82" minWidth="10" maxWidth="3.4028234663852886e+38" id="Jbd-2C-DrJ">
+                                        <tableColumn identifier="3" editable="NO" width="80" minWidth="10" maxWidth="3.4028234663852886e+38" id="Jbd-2C-DrJ">
                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" enabled="NO" borderStyle="border" alignment="left" title="Binding 3">
                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -159,14 +160,14 @@
                                                 <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                             </textFieldCell>
-                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
                                             <prototypeCellViews>
                                                 <tableCellView id="9gE-hw-Qot">
-                                                    <rect key="frame" x="270" y="0.0" width="82" height="17"/>
+                                                    <rect key="frame" x="285" y="0.0" width="80" height="17"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
                                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xsf-aW-zSl">
-                                                            <rect key="frame" x="0.0" y="1" width="82" height="16"/>
+                                                            <rect key="frame" x="0.0" y="1" width="80" height="16"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                             <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="2ao-Zk-Ysi">
                                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -181,7 +182,7 @@
                                                 </tableCellView>
                                             </prototypeCellViews>
                                         </tableColumn>
-                                        <tableColumn identifier="4" editable="NO" width="103.5" minWidth="10" maxWidth="3.4028234663852886e+38" id="l1k-H7-XNn">
+                                        <tableColumn identifier="4" editable="NO" width="80" minWidth="10" maxWidth="3.4028234663852886e+38" id="l1k-H7-XNn">
                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" enabled="NO" borderStyle="border" alignment="left" title="Binding 4">
                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -191,14 +192,14 @@
                                                 <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                             </textFieldCell>
-                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
                                             <prototypeCellViews>
                                                 <tableCellView id="7so-8C-lMW">
-                                                    <rect key="frame" x="369" y="0.0" width="100" height="17"/>
+                                                    <rect key="frame" x="382" y="0.0" width="77" height="17"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
                                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OJ2-lV-fUt">
-                                                            <rect key="frame" x="0.0" y="1" width="100" height="16"/>
+                                                            <rect key="frame" x="0.0" y="1" width="77" height="16"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                             <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="hez-Uw-EuZ">
                                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -216,6 +217,7 @@
                                     </tableColumns>
                                 </tableView>
                             </subviews>
+                            <nil key="backgroundColor"/>
                         </clipView>
                         <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="TjW-Vq-xOU">
                             <rect key="frame" x="1" y="227" width="468" height="16"/>
diff --git a/src/settingsmenu.cpp b/src/settingsmenu.cpp
index f4df9aa9..d6f38387 100644
--- a/src/settingsmenu.cpp
+++ b/src/settingsmenu.cpp
@@ -37,7 +37,7 @@
 #include <algorithm>
 #include <assert.h>
 
-const Vec2i winSize(640, 356);
+const Vec2i winSize(840, 356);
 
 const uint8_t cBgNorm = 50;
 const uint8_t cBgDark = 20;
@@ -767,7 +767,7 @@ void Widget::click(int x, int y, uint8_t button)
 }
 
 /* Ratio of cell area to total widget width */
-#define BW_CELL_R 0.75f
+#define BW_CELL_R 0.55f
 
 void BindingWidget::drawHandler(SDL_Surface *surf)
 {