Move advanced editing to a tab button.

This commit is contained in:
Ottermandias 2022-06-08 15:22:28 +02:00
parent 35cff163f8
commit d89c1abc3b
2 changed files with 29 additions and 21 deletions

View file

@ -171,24 +171,6 @@ public partial class ConfigWindow
{
Process.Start( new ProcessStartInfo( _mod.MetaFile.FullName ) { UseShellExecute = true } );
}
if( ImGui.Button( "Edit Mod Details", reducedSize ) )
{
_window.ModEditPopup.ChangeMod( _mod );
_window.ModEditPopup.ChangeOption( -1, 0 );
_window.ModEditPopup.IsOpen = true;
}
ImGui.SameLine();
fileExists = File.Exists( _mod.DefaultFile );
tt = fileExists
? "Open the default option json file in the text editor of your choice."
: "The default option json file does not exist.";
if( ImGuiUtil.DrawDisabledButton( $"{FontAwesomeIcon.FileExport.ToIconString()}##defaultFile", _window._iconButtonSize, tt,
!fileExists, true ) )
{
Process.Start( new ProcessStartInfo( _mod.DefaultFile ) { UseShellExecute = true } );
}
}
// Do some edits outside of iterations.
@ -213,12 +195,24 @@ public partial class ConfigWindow
public static void Draw( ConfigWindow window, Mod mod )
{
ImGui.SetNextItemWidth( window._inputTextWidth.X );
using var spacing = ImRaii.PushStyle( ImGuiStyleVar.ItemSpacing, new Vector2( 3 * ImGuiHelpers.GlobalScale ) );
ImGui.SetNextItemWidth( window._inputTextWidth.X - window._iconButtonSize.X - 3 * ImGuiHelpers.GlobalScale );
ImGui.InputTextWithHint( "##newGroup", "Add new option group...", ref _newGroupName, 256 );
ImGui.SameLine();
var fileExists = File.Exists( mod.DefaultFile );
var tt = fileExists
? "Open the default option json file in the text editor of your choice."
: "The default option json file does not exist.";
if( ImGuiUtil.DrawDisabledButton( $"{FontAwesomeIcon.FileExport.ToIconString()}##defaultFile", window._iconButtonSize, tt,
!fileExists, true ) )
{
Process.Start( new ProcessStartInfo( mod.DefaultFile ) { UseShellExecute = true } );
}
ImGui.SameLine();
var nameValid = Mod.Manager.VerifyFileName( mod, null, _newGroupName, false );
var tt = nameValid ? "Add new option group to the mod." : "Can not add a group of this name.";
tt = nameValid ? "Add new option group to the mod." : "Can not add a group of this name.";
if( ImGuiUtil.DrawDisabledButton( FontAwesomeIcon.Plus.ToIconString(), window._iconButtonSize,
tt, !nameValid, true ) )
{

View file

@ -34,7 +34,7 @@ public partial class ConfigWindow
private static readonly Utf8String DescriptionTabHeader = Utf8String.FromStringUnsafe( "Description", false );
private static readonly Utf8String SettingsTabHeader = Utf8String.FromStringUnsafe( "Settings", false );
private static readonly Utf8String ChangedItemsTabHeader = Utf8String.FromStringUnsafe( "Changed Items", false );
private static readonly Utf8String EditModTabHeader = Utf8String.FromStringUnsafe( "Edit Mod", false );
private static readonly Utf8String EditModTabHeader = Utf8String.FromStringUnsafe( "Edit Mod Meta", false );
private void DrawTabBar()
{
@ -56,6 +56,20 @@ public partial class ConfigWindow
DrawChangedItemsTab();
DrawConflictsTab();
DrawEditModTab();
if( ImGui.TabItemButton( "Open Advanced Edit Window", ImGuiTabItemFlags.Trailing | ImGuiTabItemFlags.NoTooltip ) )
{
_window.ModEditPopup.ChangeMod( _mod );
_window.ModEditPopup.ChangeOption( -1, 0 );
_window.ModEditPopup.IsOpen = true;
}
ImGuiUtil.HoverTooltip(
"Clicking this will open a new window in which you can\nedit the following things per option for this mod:\n\n"
+ "\t\t- file redirections\n"
+ "\t\t- file swaps\n"
+ "\t\t- metadata manipulations\n"
+ "\t\t- model materials\n"
+ "\t\t- duplicates" );
}
// Just a simple text box with the wrapped description, if it exists.