Skip to content

Commit

Permalink
Stop hard coding row heights (fixes #34)
Browse files Browse the repository at this point in the history
It seems Chinese characters are taller than 16px, who knew?
  • Loading branch information
HebaruSan committed Jun 24, 2024
1 parent 5002506 commit 7e7e7db
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions GameData/Astrogator/Astrogator-Changelog.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ KERBALCHANGELOG
change = Ignore NREs from FlightGlobals.ActiveVessel
type = Fix
}
CHANGE
{
change = Stop hard coding row heights
type = Fix
}
}
VERSION
{
Expand Down
8 changes: 4 additions & 4 deletions Source/AstrogationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void createHeaders()
if (col.header != "") {
ColumnHeaders.AddChild(headerButton(
col.header + columnSortIndicator(col),
col.headerStyle, Localizer.Format("astrogator_columnHeaderTooltip"), width, rowHeight, () => {
col.headerStyle, Localizer.Format("astrogator_columnHeaderTooltip"), width, -1, () => {
SortClicked(col.sortKey);
}
));
Expand Down Expand Up @@ -194,7 +194,7 @@ private string settingsToggleTooltip {
}
}
}

private Rect geometry {
get {
// UI_SCALE is handled by calculating distance from this Y coordinate,
Expand Down Expand Up @@ -283,7 +283,7 @@ private static double estimateLeftEdgeLogarithmic(double scale)
const double estimateConst = 0.072429060773288;
return estimateCoeff * Math.Log(scale) + estimateConst;
}

/// <summary>
/// Launch a PopupDialog containing the view.
/// Use Dismiss() to get rid of it.
Expand Down Expand Up @@ -332,7 +332,7 @@ public PopupDialog Show()
}
return dialog;
}

/// <summary>
/// React to the user closing all dialogs with Esc,
/// doesn't get called when dismissing programmatically
Expand Down
2 changes: 1 addition & 1 deletion Source/SettingsView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public SettingsView(AstrogationView.ResetCallback reset, int width)

AddChild(headerButton(
Localizer.Format("astrogator_manualLink"),
linkStyle, Localizer.Format("astrogator_manualLinkTooltip"), RowWidthWithoutVessel, rowHeight,
linkStyle, Localizer.Format("astrogator_manualLinkTooltip"), RowWidthWithoutVessel, -1,
() => { Application.OpenURL(docsURL); }
));

Expand Down
12 changes: 6 additions & 6 deletions Source/TransferView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,32 +140,32 @@ private void CreateLayout()
case ContentEnum.PlanetName:
AddChild(LabelWithStyleAndSize(
Localizer.Format("astrogator_planetLabel", TheName(model.destination)),
col.contentStyle, col.width, rowHeight));
col.contentStyle, col.width));
break;

case ContentEnum.YearsTillBurn:
AddChild(LabelWithStyleAndSize(getYearValue,
col.contentStyle, col.width, rowHeight));
col.contentStyle, col.width));
break;

case ContentEnum.DaysTillBurn:
AddChild(LabelWithStyleAndSize(getDayValue,
col.contentStyle, col.width, rowHeight));
col.contentStyle, col.width));
break;

case ContentEnum.HoursTillBurn:
AddChild(LabelWithStyleAndSize(getHourValue,
col.contentStyle, col.width, rowHeight));
col.contentStyle, col.width));
break;

case ContentEnum.MinutesTillBurn:
AddChild(LabelWithStyleAndSize(getMinuteValue,
col.contentStyle, col.width, rowHeight));
col.contentStyle, col.width));
break;

case ContentEnum.SecondsTillBurn:
AddChild(LabelWithStyleAndSize(getSecondValue,
col.contentStyle, col.width, rowHeight));
col.contentStyle, col.width));
break;

case ContentEnum.DeltaV:
Expand Down
2 changes: 1 addition & 1 deletion Source/ViewTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class ViewTools {
/// <value>
/// Height of a row of our table.
/// </value>
public const int rowHeight = 16;
private const int rowHeight = 16;

/// <value>
/// Size of font to use in our table.
Expand Down

0 comments on commit 7e7e7db

Please sign in to comment.