Skip to content

Commit

Permalink
Profiling window: increase spike & time column width, and make the wi…
Browse files Browse the repository at this point in the history
…ndow resizable
  • Loading branch information
mrbuds committed May 14, 2024
1 parent 6f5fef7 commit 35ef729
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 16 deletions.
33 changes: 29 additions & 4 deletions WeakAuras/Profiling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,17 @@ end
local COLUMN_INFO = {
{
title = L["Name"],
width = 300,
width = 1,
attribute = "name",
},
{
title = L["Time"],
width = 80,
width = 100,
attribute = "time",
},
{
title = L["Spike"],
width = 80,
width = 100,
attribute = "spike",
},
}
Expand All @@ -475,6 +475,7 @@ local modes = {
}
WeakAurasProfilingMixin = {}

local MinPanelWidth, MinPanelHeight = 500, 300
function WeakAurasProfilingMixin:OnShow()
if self.initialised then
return
Expand All @@ -483,7 +484,8 @@ function WeakAurasProfilingMixin:OnShow()

ButtonFrameTemplate_HidePortrait(self)
self:SetTitle(L["WeakAuras Profiling"])
self:SetSize(500, 300)
self:SetSize(MinPanelWidth, MinPanelHeight)
self.ResizeButton:Init(self, MinPanelWidth, MinPanelHeight);
self.mode = 1
UIDropDownMenu_SetText(self.buttons.modeDropDown, modes[1])

Expand Down Expand Up @@ -519,6 +521,29 @@ function WeakAurasProfilingMixin:OnShow()

self.ColumnDisplay:LayoutColumns(COLUMN_INFO)

-- LayoutColumns doesn't handle resizable columns, fix it
local headers = {}
for header in self.ColumnDisplay.columnHeaders:EnumerateActive() do
headers[header:GetID()] = header
end
local prevHeader
for i, header in ipairs_reverse(headers) do
header:ClearAllPoints()
local info = COLUMN_INFO[i]
if info.width ~= 1 then
header:SetWidth(info.width)
end
if prevHeader == nil then
header:SetPoint("BOTTOMRIGHT", -25, 1)
else
header:SetPoint("BOTTOMRIGHT", prevHeader, "BOTTOMLEFT", 2, 0)
end
if i == 1 then
header:SetPoint("BOTTOMLEFT", 3, 0)
end
prevHeader = header
end

local view = CreateScrollBoxListLinearView()
view:SetElementInitializer("WeakAurasProfilingLineTemplate", function(frame, elementData)
frame:Init(elementData)
Expand Down
30 changes: 18 additions & 12 deletions WeakAuras/Profiling.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
<Size y="20"/>
<Layers>
<Layer level="overlay">
<FontString parentKey="time" font="Interface\AddOns\WeakAuras\Media\Fonts\FiraMono-Medium.ttf" justifyH="RIGHT">
<Size x="60" y="0"/>
<FontString parentKey="spike" font="Interface\AddOns\WeakAuras\Media\Fonts\FiraMono-Medium.ttf" justifyH="RIGHT">
<Size x="100" y="0"/>
<FontHeight val="12"/>
<Anchors>
<Anchor x="305" y="-2"/>
<Anchor point="RIGHT" x= "-5" y="-2"/>
</Anchors>
<Scripts>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:AddLine(self:GetParent().timeTooltip, 1, 1, 1, true)
GameTooltip:AddLine(self:GetParent().spikeTooltip, 1, 1, 1, true)
GameTooltip:Show()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</FontString>
<FontString parentKey="spike" font="Interface\AddOns\WeakAuras\Media\Fonts\FiraMono-Medium.ttf" justifyH="RIGHT">
<Size x="60" y="0"/>
<FontString parentKey="time" font="Interface\AddOns\WeakAuras\Media\Fonts\FiraMono-Medium.ttf" justifyH="RIGHT">
<Size x="100" y="0"/>
<FontHeight val="12"/>
<Anchors>
<Anchor x="385" y="-2"/>
<Anchor point="RIGHT" relativeKey="$parent.spike" relativePoint="LEFT" y="-2"/>
</Anchors>
<Scripts>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:AddLine(self:GetParent().spikeTooltip, 1, 1, 1, true)
GameTooltip:AddLine(self:GetParent().timeTooltip, 1, 1, 1, true)
GameTooltip:Show()
</OnEnter>
<OnLeave>
Expand All @@ -46,17 +46,17 @@
<StatusBar parentKey="progressBar" drawLayer="BACKGROUND" minValue="0" maxValue="100" defaultValue="0">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeKey="$parent" x="1" y="0"/>
<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMLEFT" relativeKey="$parent" x="299" y="0"/>
<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMLEFT" relativeKey="$parent.time" x="-2" y="0"/>
</Anchors>
<BarTexture file="Interface\Addons\WeakAuras\Media\Textures\Square_FullWhite.tga"/>
<Layers>
<Layer level="OVERLAY">
<FontString parentKey="name" font="Interface\AddOns\WeakAuras\Media\Fonts\FiraMono-Medium.ttf" justifyH="LEFT">
<FontString parentKey="name" font="Interface\AddOns\WeakAuras\Media\Fonts\FiraMono-Medium.ttf" justifyH="LEFT" wordwrap="false">
<Color r="1.0" g="0.82" b="0"/>
<FontHeight val="12"/>
<Size x="300" y="0"/>
<Anchors>
<Anchor point="LEFT" x="5"/>
<Anchor point="RIGHT" relativeKey="$parent.$parent.time" relativePoint="LEFT" x="-2" y="0"/>
</Anchors>
</FontString>
</Layer>
Expand All @@ -65,7 +65,7 @@
</Frames>
</Frame>

<Frame name="WeakAurasProfilingFrame" mixin="WeakAurasProfilingMixin" inherits="PortraitFrameTemplate" parent="UIParent" toplevel="true" movable="true" enableMouse="true" clampedToScreen="true" frameStrata="DIALOG" hidden="true">
<Frame name="WeakAurasProfilingFrame" mixin="WeakAurasProfilingMixin" inherits="PortraitFrameTemplate" parent="UIParent" toplevel="true" movable="true" resizable="true" enableMouse="true" clampedToScreen="true" frameStrata="DIALOG" hidden="true">
<Size x="450" y="400"/>
<Anchors>
<Anchor point="CENTER"/>
Expand Down Expand Up @@ -187,6 +187,12 @@
</Frames>
</Frame>

<Button parentKey="ResizeButton" inherits="PanelResizeButtonTemplate">
<Anchors>
<Anchor point="BOTTOMRIGHT" x="-4" y="4"/>
</Anchors>
</Button>

<Frame parentKey="ColumnDisplay" useParentLevel="true" inherits="ColumnDisplayTemplate">
<Anchors>
<Anchor point="TOPLEFT" x="10" y="-30"/>
Expand Down

0 comments on commit 35ef729

Please sign in to comment.