mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
Merge pull request #612 from goatcorp/superman
scrollbar, implicit types
This commit is contained in:
commit
76edc0c7d4
3 changed files with 47 additions and 58 deletions
|
|
@ -149,10 +149,10 @@ namespace Dalamud.Interface.Internal
|
||||||
foreach (var tag in pluginCategoryTags)
|
foreach (var tag in pluginCategoryTags)
|
||||||
{
|
{
|
||||||
// only tags from whitelist can be accepted
|
// only tags from whitelist can be accepted
|
||||||
int matchIdx = Array.FindIndex(this.CategoryList, x => x.Tag.Equals(tag, StringComparison.InvariantCultureIgnoreCase));
|
var matchIdx = Array.FindIndex(this.CategoryList, x => x.Tag.Equals(tag, StringComparison.InvariantCultureIgnoreCase));
|
||||||
if (matchIdx >= 0)
|
if (matchIdx >= 0)
|
||||||
{
|
{
|
||||||
int categoryId = this.CategoryList[matchIdx].CategoryId;
|
var categoryId = this.CategoryList[matchIdx].CategoryId;
|
||||||
if (categoryId >= FirstTagBasedCategoryId)
|
if (categoryId >= FirstTagBasedCategoryId)
|
||||||
{
|
{
|
||||||
categoryList.Add(categoryId);
|
categoryList.Add(categoryId);
|
||||||
|
|
@ -202,7 +202,7 @@ namespace Dalamud.Interface.Internal
|
||||||
{
|
{
|
||||||
var groupInfo = this.groupList[this.currentGroupIdx];
|
var groupInfo = this.groupList[this.currentGroupIdx];
|
||||||
|
|
||||||
bool includeAll = (this.currentCategoryIdx == 0) || (groupInfo.GroupKind != GroupKind.Available);
|
var includeAll = (this.currentCategoryIdx == 0) || (groupInfo.GroupKind != GroupKind.Available);
|
||||||
if (includeAll)
|
if (includeAll)
|
||||||
{
|
{
|
||||||
result.AddRange(plugins);
|
result.AddRange(plugins);
|
||||||
|
|
@ -215,7 +215,7 @@ namespace Dalamud.Interface.Internal
|
||||||
{
|
{
|
||||||
if (this.mapPluginCategories.TryGetValue(plugin, out var pluginCategoryIds))
|
if (this.mapPluginCategories.TryGetValue(plugin, out var pluginCategoryIds))
|
||||||
{
|
{
|
||||||
int matchIdx = Array.IndexOf(pluginCategoryIds, selectedCategoryInfo.CategoryId);
|
var matchIdx = Array.IndexOf(pluginCategoryIds, selectedCategoryInfo.CategoryId);
|
||||||
if (matchIdx >= 0)
|
if (matchIdx >= 0)
|
||||||
{
|
{
|
||||||
result.Add(plugin);
|
result.Add(plugin);
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,6 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
this.DrawHeader();
|
this.DrawHeader();
|
||||||
// this.DrawPluginTabBar();
|
|
||||||
this.DrawPluginCategories();
|
this.DrawPluginCategories();
|
||||||
this.DrawFooter();
|
this.DrawFooter();
|
||||||
this.DrawErrorModal();
|
this.DrawErrorModal();
|
||||||
|
|
@ -470,6 +469,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private void DrawPluginTabBar()
|
private void DrawPluginTabBar()
|
||||||
{
|
{
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - (5 * ImGuiHelpers.GlobalScale));
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - (5 * ImGuiHelpers.GlobalScale));
|
||||||
|
|
@ -490,7 +490,9 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
private void DrawPluginTab(string title, Action drawPluginList)
|
private void DrawPluginTab(string title, Action drawPluginList)
|
||||||
{
|
{
|
||||||
if (ImGui.BeginTabItem(title))
|
if (ImGui.BeginTabItem(title))
|
||||||
|
|
@ -511,6 +513,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private void DrawAvailablePluginList()
|
private void DrawAvailablePluginList()
|
||||||
{
|
{
|
||||||
|
|
@ -522,30 +525,38 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var filteredList = pluginList
|
var filteredManifests = pluginList
|
||||||
.Where(rm => !this.IsManifestFiltered(rm))
|
.Where(rm => !this.IsManifestFiltered(rm))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (filteredList.Count == 0)
|
if (filteredManifests.Count == 0)
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching);
|
ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var i = 0;
|
// reset opened list of collapsibles when switching between categories
|
||||||
foreach (var manifest in filteredList)
|
if (this.categoryManager.IsContentDirty)
|
||||||
{
|
{
|
||||||
var (isInstalled, plugin) = this.IsManifestInstalled(manifest);
|
this.openPluginCollapsibles.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
var categoryManifestsList = this.categoryManager.GetCurrentCategoryContent(filteredManifests);
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
foreach (var manifest in categoryManifestsList)
|
||||||
|
{
|
||||||
|
var remoteManifest = manifest as RemotePluginManifest;
|
||||||
|
var (isInstalled, plugin) = this.IsManifestInstalled(remoteManifest);
|
||||||
|
|
||||||
ImGui.PushID($"{manifest.InternalName}{manifest.AssemblyVersion}");
|
ImGui.PushID($"{manifest.InternalName}{manifest.AssemblyVersion}");
|
||||||
|
|
||||||
if (isInstalled)
|
if (isInstalled)
|
||||||
{
|
{
|
||||||
this.DrawInstalledPlugin(plugin, i++, true);
|
this.DrawInstalledPlugin(plugin, i++, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.DrawAvailablePlugin(manifest, i++);
|
this.DrawAvailablePlugin(remoteManifest, i++);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopID();
|
ImGui.PopID();
|
||||||
|
|
@ -610,10 +621,10 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
private void DrawPluginCategories()
|
private void DrawPluginCategories()
|
||||||
{
|
{
|
||||||
float useContentHeight = -40; // button height + spacing
|
var useContentHeight = -40f; // button height + spacing
|
||||||
float useMenuWidth = 180; // works fine as static value, table can be resized by user
|
var useMenuWidth = 180f; // works fine as static value, table can be resized by user
|
||||||
|
|
||||||
float useContentWidth = ImGui.GetContentRegionAvail().X;
|
var useContentWidth = ImGui.GetContentRegionAvail().X;
|
||||||
|
|
||||||
if (ImGui.BeginChild("InstallerCategories", new Vector2(useContentWidth, useContentHeight * ImGuiHelpers.GlobalScale)))
|
if (ImGui.BeginChild("InstallerCategories", new Vector2(useContentWidth, useContentHeight * ImGuiHelpers.GlobalScale)))
|
||||||
{
|
{
|
||||||
|
|
@ -628,12 +639,12 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
this.DrawPluginCategorySelectors();
|
this.DrawPluginCategorySelectors();
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if (ImGui.BeginChild($"ScrollingPlugins", new Vector2(useContentWidth, 0), false, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground))
|
if (ImGui.BeginChild("ScrollingPlugins", new Vector2(-1, 0), false, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground))
|
||||||
{
|
{
|
||||||
this.DrawPluginCategoryContent();
|
this.DrawPluginCategoryContent();
|
||||||
ImGui.EndChild();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.EndChild();
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -654,7 +665,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int groupIdx = 0; groupIdx < this.categoryManager.GroupList.Length; groupIdx++)
|
for (var groupIdx = 0; groupIdx < this.categoryManager.GroupList.Length; groupIdx++)
|
||||||
{
|
{
|
||||||
var groupInfo = this.categoryManager.GroupList[groupIdx];
|
var groupInfo = this.categoryManager.GroupList[groupIdx];
|
||||||
var canShowGroup = (groupInfo.GroupKind != PluginCategoryManager.GroupKind.DevTools) || this.hasDevPlugins;
|
var canShowGroup = (groupInfo.GroupKind != PluginCategoryManager.GroupKind.DevTools) || this.hasDevPlugins;
|
||||||
|
|
@ -673,11 +684,11 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
ImGui.Indent();
|
ImGui.Indent();
|
||||||
var categoryItemSize = new Vector2(ImGui.GetContentRegionAvail().X - (5 * ImGuiHelpers.GlobalScale), ImGui.GetTextLineHeight());
|
var categoryItemSize = new Vector2(ImGui.GetContentRegionAvail().X - (5 * ImGuiHelpers.GlobalScale), ImGui.GetTextLineHeight());
|
||||||
for (int categoryIdx = 0; categoryIdx < groupInfo.Categories.Count; categoryIdx++)
|
for (var categoryIdx = 0; categoryIdx < groupInfo.Categories.Count; categoryIdx++)
|
||||||
{
|
{
|
||||||
var categoryInfo = Array.Find(this.categoryManager.CategoryList, x => x.CategoryId == groupInfo.Categories[categoryIdx]);
|
var categoryInfo = Array.Find(this.categoryManager.CategoryList, x => x.CategoryId == groupInfo.Categories[categoryIdx]);
|
||||||
|
|
||||||
bool hasSearchHighlight = this.categoryManager.IsCategoryHighlighted(categoryInfo.CategoryId);
|
var hasSearchHighlight = this.categoryManager.IsCategoryHighlighted(categoryInfo.CategoryId);
|
||||||
if (hasSearchHighlight)
|
if (hasSearchHighlight)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, colorSearchHighlight);
|
ImGui.PushStyleColor(ImGuiCol.Text, colorSearchHighlight);
|
||||||
|
|
@ -712,6 +723,8 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImGuiHelpers.ScaledVector2(1, 3));
|
||||||
|
|
||||||
var groupInfo = this.categoryManager.GroupList[this.categoryManager.CurrentGroupIdx];
|
var groupInfo = this.categoryManager.GroupList[this.categoryManager.CurrentGroupIdx];
|
||||||
if (groupInfo.GroupKind == PluginCategoryManager.GroupKind.DevTools)
|
if (groupInfo.GroupKind == PluginCategoryManager.GroupKind.DevTools)
|
||||||
{
|
{
|
||||||
|
|
@ -737,42 +750,10 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var pluginList = this.pluginListAvailable;
|
this.DrawAvailablePluginList();
|
||||||
if (pluginList.Count > 0)
|
|
||||||
{
|
|
||||||
// reset opened list of collapsibles when switching between categories
|
|
||||||
if (this.categoryManager.IsContentDirty)
|
|
||||||
{
|
|
||||||
this.openPluginCollapsibles.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
var filteredManifests = pluginList.Where(rm => !this.IsManifestFiltered(rm) && !this.IsManifestInstalled(rm).IsInstalled);
|
|
||||||
var categoryManifestsList = this.categoryManager.GetCurrentCategoryContent(filteredManifests);
|
|
||||||
|
|
||||||
if (categoryManifestsList.Count > 0)
|
|
||||||
{
|
|
||||||
var i = 0;
|
|
||||||
foreach (var manifest in categoryManifestsList)
|
|
||||||
{
|
|
||||||
var rmManifest = manifest as RemotePluginManifest;
|
|
||||||
if (rmManifest != null)
|
|
||||||
{
|
|
||||||
ImGui.PushID($"{rmManifest.InternalName}{rmManifest.AssemblyVersion}");
|
|
||||||
this.DrawAvailablePlugin(rmManifest, i++);
|
|
||||||
ImGui.PopID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui.Text(Locs.TabBody_SearchNoMatching);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui.Text(Locs.TabBody_SearchNoCompatible);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawImageTester()
|
private void DrawImageTester()
|
||||||
|
|
@ -2166,6 +2147,10 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
if (didAny)
|
if (didAny)
|
||||||
{
|
{
|
||||||
Log.Verbose($"Plugin images for {manifest.InternalName} loaded from disk");
|
Log.Verbose($"Plugin images for {manifest.InternalName} loaded from disk");
|
||||||
|
|
||||||
|
if (pluginImages.Contains(null))
|
||||||
|
pluginImages = pluginImages.Where(image => image != null).ToArray();
|
||||||
|
|
||||||
this.pluginImagesMap[manifest.InternalName] = pluginImages;
|
this.pluginImagesMap[manifest.InternalName] = pluginImages;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -2218,6 +2203,10 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
if (didAny)
|
if (didAny)
|
||||||
{
|
{
|
||||||
Log.Verbose($"Plugin images for {manifest.InternalName} downloaded");
|
Log.Verbose($"Plugin images for {manifest.InternalName} downloaded");
|
||||||
|
|
||||||
|
if (pluginImages.Contains(null))
|
||||||
|
pluginImages = pluginImages.Where(image => image != null).ToArray();
|
||||||
|
|
||||||
this.pluginImagesMap[manifest.InternalName] = pluginImages;
|
this.pluginImagesMap[manifest.InternalName] = pluginImages;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -165,11 +165,11 @@ namespace Dalamud.Plugin
|
||||||
#region IPC
|
#region IPC
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an IPC publisher.
|
/// Gets an IPC provider.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TRet">The return type for funcs. Use object if this is unused.</typeparam>
|
/// <typeparam name="TRet">The return type for funcs. Use object if this is unused.</typeparam>
|
||||||
/// <param name="name">The name of the IPC registration.</param>
|
/// <param name="name">The name of the IPC registration.</param>
|
||||||
/// <returns>An IPC publisher.</returns>
|
/// <returns>An IPC provider.</returns>
|
||||||
/// <exception cref="IpcTypeMismatchError">This is thrown when the requested types do not match the previously registered types are different.</exception>
|
/// <exception cref="IpcTypeMismatchError">This is thrown when the requested types do not match the previously registered types are different.</exception>
|
||||||
public ICallGateProvider<TRet> GetIpcProvider<TRet>(string name)
|
public ICallGateProvider<TRet> GetIpcProvider<TRet>(string name)
|
||||||
=> new CallGatePubSub<TRet>(name);
|
=> new CallGatePubSub<TRet>(name);
|
||||||
|
|
@ -211,7 +211,7 @@ namespace Dalamud.Plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TRet">The return type for funcs. Use object if this is unused.</typeparam>
|
/// <typeparam name="TRet">The return type for funcs. Use object if this is unused.</typeparam>
|
||||||
/// <param name="name">The name of the IPC registration.</param>
|
/// <param name="name">The name of the IPC registration.</param>
|
||||||
/// <returns>An IPC publisher.</returns>
|
/// <returns>An IPC subscriber.</returns>
|
||||||
public ICallGateSubscriber<TRet> GetIpcSubscriber<TRet>(string name)
|
public ICallGateSubscriber<TRet> GetIpcSubscriber<TRet>(string name)
|
||||||
=> new CallGatePubSub<TRet>(name);
|
=> new CallGatePubSub<TRet>(name);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue