Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: removed the toggle feature. You can use the macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 23, 2024
1 parent 7ebea5d commit 7d0fea7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 57 deletions.
5 changes: 1 addition & 4 deletions ActionTimelineEx/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class Plugin : IDalamudPlugin
public Plugin(IDalamudPluginInterface pluginInterface)
{
ECommonsMain.Init(pluginInterface, this);
XIVConfigUIMain.Init(pluginInterface, "/atle", "Opens the ActionTimelineEx configuration window.\n\"/atle reset\" to reset the rotation helper count.\n\"/atle toggle\" to toggle the rotation helper's visibility.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString));
XIVConfigUIMain.Init(pluginInterface, "/atle", "Opens the ActionTimelineEx configuration window.\n\"/atle reset\" to reset the rotation helper count.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString));
XIVDrawerMain.Init(pluginInterface, "ActionTimelineExOverlay");

Svc.PluginInterface.UiBuilder.Draw += Draw;
Expand Down Expand Up @@ -116,9 +116,6 @@ public static void PluginCommand(string str)
case "reset":
RotationHelper.Clear();
return;
case "toggle":
RotationHelperWindow._open = !RotationHelperWindow._open;
return;
}
_settingsWindow.Toggle();
}
Expand Down
75 changes: 22 additions & 53 deletions ActionTimelineEx/Windows/RotationHelperWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
namespace ActionTimelineEx.Windows;
internal static class RotationHelperWindow
{
private static Vector2 _size = default;
internal static bool _open = true;
private static bool _changed = false;
public static void Draw()
{
var setting = Plugin.Settings;
Expand All @@ -28,71 +25,43 @@ public static void Draw()
{
flag |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
}
if (!_open)
{
flag |= ImGuiWindowFlags.AlwaysAutoResize;
}


Vector4 bgColor = setting.RotationLocked ? setting.RotationLockedBackgroundColor : setting.RotationUnlockedBackgroundColor;
using var bgColorPush = ImRaii.PushColor(ImGuiCol.WindowBg, bgColor);

ImGui.SetNextWindowSize(new Vector2(560, 100) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);

if (_changed)
{
ImGui.SetNextWindowSize(_size);
_changed = false;
}

if (ImGui.Begin("Rotation Helper Window", flag))
{
var rotations = Plugin.Settings.RotationHelper;

if (ImGui.Checkbox("##Open", ref _open))
var index = rotations.ChoiceIndex;
if (ImGuiHelper.SelectableCombo("Change Rotation", [.. rotations.RotationSettings.Select(i => i.Name)], ref index))
{
if (_open)
{
_changed = true;
ImGui.End();
return;
}
else
{
_size = ImGui.GetWindowSize();
}
rotations.ChoiceIndex = index;
}

var heightReduce = ImGui.GetCursorPosY();

if (_open)
//Double click to clear.
if (DrawHelper.IsInRect(ImGui.GetWindowPos(), ImGui.GetWindowSize()) && ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left))
{
ImGui.SameLine();
var index = rotations.ChoiceIndex;
if (ImGuiHelper.SelectableCombo("Change Rotation", [.. rotations.RotationSettings.Select(i => i.Name)], ref index))
{
rotations.ChoiceIndex = index;
}

//Double click to clear.
if (DrawHelper.IsInRect(ImGui.GetWindowPos(), ImGui.GetWindowSize()) && ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left))
{
RotationHelper.Clear();
}
RotationHelper.Clear();
}

var padding = ImGui.GetStyle().WindowPadding;
var border = ImGui.GetStyle().WindowBorderSize;
ImGui.GetStyle().WindowPadding = default;
ImGui.GetStyle().WindowBorderSize = 0;
try
{
RotationHelper.RotationSetting.Draw(heightReduce);
}
finally
{
ImGui.End();
ImGui.GetStyle().WindowPadding = padding;
ImGui.GetStyle().WindowBorderSize = border;
}
var heightReduce = ImGui.GetCursorPosY();
var padding = ImGui.GetStyle().WindowPadding;
var border = ImGui.GetStyle().WindowBorderSize;
ImGui.GetStyle().WindowPadding = default;
ImGui.GetStyle().WindowBorderSize = 0;
try
{
RotationHelper.RotationSetting.Draw(heightReduce);
}
finally
{
ImGui.End();
ImGui.GetStyle().WindowPadding = padding;
ImGui.GetStyle().WindowBorderSize = border;
}
}
}
Expand Down

0 comments on commit 7d0fea7

Please sign in to comment.