Skip to content
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
16 changes: 8 additions & 8 deletions Questionable/Windows/Common/Ui/QstTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ internal static class QstTheme
public static readonly Vector4 TextMuted = Rgb(156, 163, 175);
public static readonly Vector4 TextFaint = Rgb(117, 123, 134);

public static readonly Vector4 PanelBg = Rgba(26, 26, 26, 0.96f);
public static readonly Vector4 PanelBg = Rgba(21, 21, 21, 0.96f);
public static readonly Vector4 PanelDark = Rgb(14, 14, 14);
public static readonly Vector4 InputBg = Rgb(19, 19, 19);
public static readonly Vector4 Raised = Rgb(38, 38, 38);
public static readonly Vector4 RaisedHovered = Rgb(48, 48, 48);
public static readonly Vector4 RaisedActive = Rgb(58, 58, 58);
public static readonly Vector4 Edge = Rgb(46, 46, 46);
public static readonly Vector4 Raised = Rgb(56, 56, 56);
public static readonly Vector4 RaisedHovered = Rgb(72, 72, 72);
public static readonly Vector4 RaisedActive = Rgb(88, 88, 88);
public static readonly Vector4 Edge = Rgb(64, 64, 64);

public static Vector4 WithAlpha(Vector4 color, float alpha) => color with { W = alpha };

Expand All @@ -38,7 +38,7 @@ internal sealed class WindowStyleScope : IDisposable
internal WindowStyleScope()
{
_colors = ImRaii.PushColor(ImGuiCol.WindowBg, PanelBg)
.Push(ImGuiCol.PopupBg, Rgba(27, 27, 27, 0.98f))
.Push(ImGuiCol.PopupBg, Rgba(22, 22, 22, 0.98f))
.Push(ImGuiCol.Border, Edge)
.Push(ImGuiCol.Separator, Edge)
.Push(ImGuiCol.FrameBg, InputBg)
Expand All @@ -55,9 +55,9 @@ internal WindowStyleScope()
.Push(ImGuiCol.HeaderActive, RaisedActive)
.Push(ImGuiCol.Tab, Rgb(26, 26, 26))
.Push(ImGuiCol.TabHovered, RaisedHovered)
.Push(ImGuiCol.TabActive, Rgb(43, 43, 43))
.Push(ImGuiCol.TabActive, Rgb(60, 60, 60))
.Push(ImGuiCol.TabUnfocused, Rgb(26, 26, 26))
.Push(ImGuiCol.TabUnfocusedActive, Rgb(36, 36, 36))
.Push(ImGuiCol.TabUnfocusedActive, Rgb(46, 46, 46))
.Push(ImGuiCol.CheckMark, Accent)
.Push(ImGuiCol.SliderGrab, Accent)
.Push(ImGuiCol.SliderGrabActive, AccentActive)
Expand Down
11 changes: 7 additions & 4 deletions Questionable/Windows/Common/Ui/QstWidgets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ public static bool SectionHeader(string label, string id, int? count = null, boo
ImRaii.PushColor(ImGuiCol.HeaderActive, QstTheme.WithAlpha(QstTheme.Text, 0.09f));
using ImRaii.ColorDisposable textColor = ImRaii.PushColor(ImGuiCol.Text, QstTheme.TextMuted);

bool open = ImGui.CollapsingHeader($"{label.ToUpper(CultureInfo.CurrentUICulture)}###{id}", flags);
string headerLabel = label.ToUpper(CultureInfo.CurrentUICulture);
bool open = ImGui.CollapsingHeader($"{headerLabel}###{id}", flags);

if (count != null)
{
string countText = count.Value.ToString(CultureInfo.CurrentCulture);
Vector2 textSize = ImGui.CalcTextSize(countText);
Vector2 min = ImGui.GetItemRectMin();
Vector2 max = ImGui.GetItemRectMax();
float labelEnd = ImGui.GetFontSize() + ImGui.GetStyle().FramePadding.X * 3
+ ImGui.CalcTextSize(headerLabel).X;
Vector2 pos = new(
max.X - textSize.X - ImGui.GetStyle().FramePadding.X * 2,
min.X + labelEnd + ImGui.GetStyle().ItemInnerSpacing.X * 2,
min.Y + (max.Y - min.Y - textSize.Y) / 2f);
ImGui.GetWindowDrawList().AddText(pos, QstTheme.ToU32(QstTheme.TextMuted), countText);
}
Expand Down Expand Up @@ -110,7 +113,7 @@ public static void ThinProgressBar(float fraction, Vector4 color, float height =
drawList.AddRectFilled(pos, pos + new Vector2(width * clamped, barHeight),
QstTheme.ToU32(color), rounding);

ImGui.Dummy(new Vector2(width, barHeight));
ImGui.Dummy(new Vector2(0, barHeight));
}

// Small rounded label.
Expand Down Expand Up @@ -200,7 +203,7 @@ public void Dispose()
drawList.ChannelsMerge();

ImGui.SetCursorScreenPos(new Vector2(_topLeft.X, bottomRight.Y));
ImGui.Dummy(new Vector2(_width, 0));
ImGui.Dummy(new Vector2(0, 0));
}
}

Expand Down
23 changes: 11 additions & 12 deletions Questionable/Windows/QuestComponents/ActiveQuestComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ public void Draw(bool isMinimized)
else if (_questController.CurrentTaskState is { } currentTaskState)
{
using ImRaii.ColorDisposable _ = ImRaii.PushColor(ImGuiCol.Text, QstTheme.Accent);
using ImRaii.TextWrapDisposable wrap = ImRaii.TextWrapPos(0);
ImGui.TextUnformatted(currentTaskState);
}
else
{
using ImRaii.DisabledDisposable _ = ImRaii.Disabled();
using ImRaii.TextWrapDisposable wrap = ImRaii.TextWrapPos(0);
ImGui.TextUnformatted(_questController.DebugState ?? string.Empty);
}

Expand All @@ -96,22 +98,26 @@ public void Draw(bool isMinimized)
{
bool manualStep = currentStep is { InteractionType: EInteractionType.Instruction or EInteractionType.WaitForManualProgress or EInteractionType.Snipe };
using ImRaii.ColorDisposable color = ImRaii.PushColor(ImGuiCol.Text, manualStep ? QstTheme.Accent : QstTheme.TextMuted);
using ImRaii.TextWrapDisposable wrap = ImRaii.TextWrapPos(0);
ImGui.TextUnformatted(comment);
}

string stats = _questController.ToStatString();
if (!string.IsNullOrWhiteSpace(stats))
{
using ImRaii.DisabledDisposable _ = ImRaii.Disabled();
ImGui.Text(stats);
using ImRaii.TextWrapDisposable wrap = ImRaii.TextWrapPos(0);
ImGui.TextUnformatted(stats);
}
}

DrawQuestButtons(currentQuest, currentStep, questWork, isMinimized);
}
catch (Exception e)
{
ImGui.TextColored(QstTheme.Danger, e.ToString());
using ImRaii.ColorDisposable _ = ImRaii.PushColor(ImGuiCol.Text, QstTheme.Danger);
using ImRaii.TextWrapDisposable wrap = ImRaii.TextWrapPos(0);
ImGui.TextUnformatted(e.ToString());
_logger.LogError(e, "Could not handle active quest buttons");
}

Expand Down Expand Up @@ -267,14 +273,7 @@ private void DrawQuestNames(QuestController.QuestProgress currentQuest,
bool showStopClock = hasLevelCondition || hasCompleteQuestConditions || hasAcceptQuestConditions;
bool showPriorityCrystal = anyAvailable || anyUnavailable;
if (showStopClock || showPriorityCrystal)
{
float clockWidth = ImGui.CalcTextSize(SeIconChar.Clock.ToIconString()).X;
float crystalWidth = ImGui.CalcTextSize(SeIconChar.Hyadelyn.ToIconString()).X;
float iconsWidth = (showStopClock ? clockWidth : 0f)
+ (showPriorityCrystal ? crystalWidth : 0f)
+ (showStopClock && showPriorityCrystal ? ImGui.GetStyle().ItemSpacing.X : 0f);
ImGui.SameLine(ImGui.GetWindowContentRegionMax().X - iconsWidth);
}
ImGui.SameLine();

if (showStopClock)
{
Expand Down Expand Up @@ -411,7 +410,6 @@ private void DrawQuestNames(QuestController.QuestProgress currentQuest,

if (metaSequence?.FindStep(currentQuest.Step) is { } metaStep)
{
ImGui.SameLine();
QstWidgets.Chip(metaStep.InteractionType.ToString(), QstTheme.Accent);
if (metaStep.DataId is { } metaDataId)
{
Expand Down Expand Up @@ -457,7 +455,8 @@ private void DrawQuestNames(QuestController.QuestProgress currentQuest,
}

using ImRaii.ColorDisposable styleColor = ImRaii.PushColor(ImGuiCol.Text, color);
ImGui.Text($"{questWork}");
using (ImRaii.TextWrapPos(0))
ImGui.TextUnformatted($"{questWork}");

if (ImGui.IsItemClicked())
{
Expand Down
Loading