Skip to content

Commit

Permalink
Fix GUI layout issues with scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Feb 25, 2025
1 parent 70a4582 commit 8eec072
Show file tree
Hide file tree
Showing 40 changed files with 437 additions and 287 deletions.
3 changes: 2 additions & 1 deletion GUI/Controls/Changeset.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion GUI/Controls/ChooseProvidedMods.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion GUI/Controls/ChooseRecommendedMods.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion GUI/Controls/DeleteDirectories.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion GUI/Controls/EditModSearch.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion GUI/Controls/EditModSearchDetails.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions GUI/Controls/EditModSearches.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 4 additions & 11 deletions GUI/Controls/EditModSearches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public EditModSearches()
{
InitializeComponent();
ToolTip.SetToolTip(AddSearchButton, Properties.Resources.EditModSearchesTooltipAddSearchButton);
ActiveControl = AddSearch();
}

public event Action? SurrenderFocus;
Expand Down Expand Up @@ -69,6 +68,10 @@ public void SetSearches(List<ModSearch> searches)
{
RemoveSearch(editors[^1]);
}
if (editors.Count < 1)
{
ActiveControl = AddSearch();
}
if (searches.Count < 1)
{
if (//editors is [var editor]
Expand Down Expand Up @@ -116,8 +119,6 @@ private void AddSearchButton_Click(object? sender, EventArgs? e)

private EditModSearch AddSearch()
{
SuspendLayout();

var ctl = new EditModSearch()
{
// Dock handles the layout for us
Expand All @@ -136,9 +137,6 @@ private EditModSearch AddSearch()
// Still need to be able to see the add button, without this it's covered up
AddSearchButton.BringToFront();

ResumeLayout(false);
PerformLayout();

Height = editors.Sum(ems => ems.Height);

return ctl;
Expand All @@ -148,8 +146,6 @@ private void RemoveSearch(EditModSearch which)
{
if (editors.Count >= 2)
{
SuspendLayout();

if (which == ActiveControl)
{
// Move focus to next control, or previous if last in list
Expand All @@ -169,9 +165,6 @@ private void RemoveSearch(EditModSearch which)
editor.ShowLabel = true;
}

ResumeLayout(false);
PerformLayout();

Height = editors.Sum(ems => ems.Height);
}
}
Expand Down
3 changes: 2 additions & 1 deletion GUI/Controls/EditModpack.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions GUI/Controls/InstallationHistory.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions GUI/Controls/InstallationHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ public InstallationHistory()
InitializeComponent();
}

public void LoadHistory(GameInstance inst, GUIConfiguration config, RepositoryDataManager repoData)
public void LoadHistory(GameInstance inst,
GUIConfiguration config,
RepositoryDataManager repoData)
{
this.inst = inst;
registry = RegistryManager.Instance(inst, repoData).registry;
this.config = config;
this.inst = inst;
registry = RegistryManager.Instance(inst, repoData).registry;
this.config = config;
Util.Invoke(this, () =>
{
HistoryListView.Items.Clear();
ModsListView.Items.Clear();
ModsListView.Items.Add(LoadingMessage);
UseWaitCursor = true;
Task.Factory.StartNew(() =>
{
Expand All @@ -38,7 +43,6 @@ public void LoadHistory(GameInstance inst, GUIConfiguration config, RepositoryDa
Util.Invoke(this, () =>
{
HistoryListView.BeginUpdate();
HistoryListView.Items.Clear();
HistoryListView.Items.AddRange(items);
HistoryListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
Splitter.Panel1MinSize = Splitter.SplitterDistance =
Expand Down
1 change: 1 addition & 0 deletions GUI/Controls/InstallationHistory.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<data name="AuthorColumn.Text" xml:space="preserve"><value>Authors</value></data>
<data name="DescriptionColumn.Text" xml:space="preserve"><value>Description</value></data>
<data name="SelectInstallMessage.Text" xml:space="preserve"><value>Click a timestamp at the left to see which mods were installed</value></data>
<data name="LoadingMessage.Text" xml:space="preserve"><value>Loading installation history...</value></data>
<data name="NoModsMessage.Text" xml:space="preserve"><value>No mods were installed</value></data>
<data name="InstallButton.Text" xml:space="preserve"><value>Install</value></data>
<data name="OKButton.Text" xml:space="preserve"><value>OK</value></data>
Expand Down
6 changes: 4 additions & 2 deletions GUI/Controls/ManageMods.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions GUI/Controls/ManageMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,23 @@ public ManageMods()
ModListContextMenuStrip.Renderer = new FlatToolStripRenderer();
ModListHeaderContextMenuStrip.Renderer = new FlatToolStripRenderer();
LabelsContextMenuStrip.Renderer = new FlatToolStripRenderer();

ModGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
ResizeColumnHeaders();
ModGrid.ColumnWidthChanged += (sender, e) => ResizeColumnHeaders();
}
}

private void ResizeColumnHeaders()
{
var g = CreateGraphics();
ModGrid.ColumnHeadersHeight = ModGrid.Columns.OfType<DataGridViewColumn>().Max(col =>
ModGrid.ColumnHeadersDefaultCellStyle.Padding.Vertical
+ Util.StringHeight(g, col.HeaderText,
col.HeaderCell?.Style?.Font ?? ModGrid.ColumnHeadersDefaultCellStyle.Font,
col.Width - (2 * ModGrid.ColumnHeadersDefaultCellStyle.Padding.Horizontal)));
}

private static readonly ILog log = LogManager.GetLogger(typeof(ManageMods));
private readonly RepositoryDataManager repoData;
private DateTime lastSearchTime;
Expand Down
26 changes: 25 additions & 1 deletion GUI/Controls/ModInfo.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8eec072

Please sign in to comment.