Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat metapackage depends as not auto installed #3008

Merged
merged 1 commit into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void InstallList(ICollection<CkanModule> modules, RelationshipResolverOpt
User.RaiseProgress(String.Format("Installing mod \"{0}\"", modsToInstall[i]),
percent_complete);

Install(modsToInstall[i], resolver.ReasonFor(modsToInstall[i]) is SelectionReason.Depends, registry_manager.registry);
Install(modsToInstall[i], resolver.IsAutoInstalled(modsToInstall[i]), registry_manager.registry);
}

User.RaiseProgress("Updating registry", 70);
Expand Down
15 changes: 15 additions & 0 deletions Core/Relationships/RelationshipResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,21 @@ public SelectionReason ReasonFor(CkanModule mod)

return reasons[mod];
}

/// <summary>
/// Indicates whether a module should be considered auto-installed in this change set.
/// A mod is auto-installed if it is in the list because it's a dependency
/// and if its depending mod is not a metpaackage.
/// </summary>
/// <param name="mod">Module to check</param>
/// <returns>
/// true if auto-installed, false otherwise
/// </returns>
public bool IsAutoInstalled(CkanModule mod)
{
var reason = ReasonFor(mod);
return reason is SelectionReason.Depends && !reason.Parent.IsMetapackage;
}
}

/// <summary>
Expand Down
19 changes: 14 additions & 5 deletions GUI/Controls/ThemedTabControl.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Drawing;
using System.Windows.Forms;

Expand All @@ -21,11 +22,19 @@ protected override void OnDrawItem(DrawItemEventArgs e)
bgRect.Inflate(-2, -1);
bgRect.Offset(0, 1);
e.Graphics.FillRectangle(new SolidBrush(BackColor), bgRect);
// Text
var tabPage = TabPages[e.Index];
Rectangle rect = e.Bounds;
TextRenderer.DrawText(e.Graphics, tabPage.Text, tabPage.Font,
rect, tabPage.ForeColor);
// e.Index can be invalid (!!), so we need try/catch
try
{
// Text
var tabPage = TabPages[e.Index];
Rectangle rect = e.Bounds;
TextRenderer.DrawText(e.Graphics, tabPage.Text, tabPage.Font,
rect, tabPage.ForeColor);
}
catch (ArgumentOutOfRangeException)
{
// No such tab page, oh well
}
// Alert event subscribers
base.OnDrawItem(e);
}
Expand Down