diff --git a/README.md b/README.md index 3bd76bd8..c7cba457 100644 --- a/README.md +++ b/README.md @@ -466,7 +466,7 @@ that you use one of these commands: | `/dump ` | Shows a Lua value in the chat frame. It shows tables and all return values. Use it to examine the return values of `GetSpellInfo`, `C_Item.GetItemInfoInstant`, and other functions. | | `/etrace` | Opens the event trace window. Other forms: `/etrace start`, `/etrace stop`, `/etrace add EVENT`, and more. | | `/framestack [showHidden [showRegions]]` (or `/fstack`) | Shows a tooltip with a list of the frames under the cursor. A `-->` mark shows one frame, with its anchors and the file and line that made it. Left Alt and Right Alt move the mark. Ctrl opens the marked frame in the table inspector. Shift shows its texture files. | -| `/tinspect ` (or `/tins`) | Opens the table inspector on the result of ``. | +| `/tinspect [expr]` (or `/tins`) | Opens a table inspector on the result of `expr`. With no table, it opens on the frame under the cursor. The window shows the anchors and the fields of the table, grouped by type. You can edit numbers, strings and booleans, filter the lines, and open a child table or frame. | | `/luaerrors` (or `/scripterrors`) | Opens the Lua error window. | ## Building diff --git a/src/embed/AddOns/!!!ClassicAPI/!!!ClassicAPI.toc b/src/embed/AddOns/!!!ClassicAPI/!!!ClassicAPI.toc index f7fa9db9..ed0d8a8c 100644 --- a/src/embed/AddOns/!!!ClassicAPI/!!!ClassicAPI.toc +++ b/src/embed/AddOns/!!!ClassicAPI/!!!ClassicAPI.toc @@ -65,6 +65,8 @@ Util\MacroOptions.lua Util\SecureStateDriver.lua Util\MacroIconSelection.lua +FrameXML\SharedUIPanelTemplates.xml + Options\Panel.lua APIDocumentation\BaseAPIMixin.lua diff --git a/src/embed/AddOns/!!!ClassicAPI/FrameXML/SharedUIPanelTemplates.lua b/src/embed/AddOns/!!!ClassicAPI/FrameXML/SharedUIPanelTemplates.lua new file mode 100644 index 00000000..1b7371cd --- /dev/null +++ b/src/embed/AddOns/!!!ClassicAPI/FrameXML/SharedUIPanelTemplates.lua @@ -0,0 +1,114 @@ +-- Backport of two templates from retail's +-- Blizzard_SharedXML/Mainline/SharedUIPanelTemplates.lua. +-- +-- Difference from the retail source: PanelDragBarMixin:UpdateCursor does +-- nothing. 1.12's cursor table has no UI_MOVE_CURSOR. + +function TruncatedTooltipScript_OnEnter(self) + local text = self.truncatedTooltipScriptText or self.Text; + if text:IsTruncated() then + local tooltip = GetAppropriateTooltip(); + tooltip:SetOwner(self, "ANCHOR_RIGHT"); + GameTooltip_AddNormalLine(tooltip, text:GetText()); + tooltip:Show(); + end +end + +function TruncatedTooltipScript_OnLeave(self) + local tooltip = GetAppropriateTooltip(); + if tooltip:GetOwner() == self then + tooltip:Hide(); + end +end + +PanelDragBarMixin = {}; + +function PanelDragBarMixin:OnLoad() + self:RegisterForDrag("LeftButton"); + self:SetTarget(self:GetParent()); + self.suspendDrag = false; +end + +function PanelDragBarMixin:SetDragSuspended(suspendDrag) + self.suspendDrag = suspendDrag; +end + +function PanelDragBarMixin:Init(target) + self:SetTarget(target); +end + +function PanelDragBarMixin:SetTarget(target) + self.target = target; + self.isMovingTarget = false; +end + +function PanelDragBarMixin:OnDragStart() + if self.suspendDrag then + return; + end + + local target = self.target; + + local continueDragStart = true; + if target.onDragStartCallback then + continueDragStart = target.onDragStartCallback(self); + end + + if self.onDragStartCallback then + continueDragStart = self.onDragStartCallback(self); + end + + if continueDragStart then + self.isMovingTarget = true; + target:StartMoving(); + end + + self:UpdateCursor(); +end + +function PanelDragBarMixin:OnDragStop() + if self.suspendDrag then + return; + end + + local target = self.target; + + local continueDragStop = true; + if target.onDragStopCallback then + continueDragStop = target.onDragStopCallback(self); + end + + if self.onDragStopCallback then + continueDragStop = self.onDragStopCallback(self); + end + + if continueDragStop then + self.isMovingTarget = false; + target:StopMovingOrSizing(); + end + + self:UpdateCursor(); +end + +function PanelDragBarMixin:SetOnDragStartCallback(onDragStartCallback) + self.onDragStartCallback = onDragStartCallback; +end + +function PanelDragBarMixin:SetOnDragStopCallback(onDragStopCallback) + self.onDragStopCallback = onDragStopCallback; +end + +function PanelDragBarMixin:OnEnter() + if self.showCursorOnHover then + self:UpdateCursor(); + end +end + +function PanelDragBarMixin:OnLeave() + if self.showCursorOnHover then + self:UpdateCursor(); + end +end + +function PanelDragBarMixin:UpdateCursor() +end diff --git a/src/embed/AddOns/!!!ClassicAPI/FrameXML/SharedUIPanelTemplates.xml b/src/embed/AddOns/!!!ClassicAPI/FrameXML/SharedUIPanelTemplates.xml new file mode 100644 index 00000000..6aa8ea08 --- /dev/null +++ b/src/embed/AddOns/!!!ClassicAPI/FrameXML/SharedUIPanelTemplates.xml @@ -0,0 +1,25 @@ + + +