From 3eaefdea6b038c416fb742e579587d52d076b976 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 5 Jun 2023 15:44:32 -0300 Subject: [PATCH] Framework Update and Code improvements --- Definitions.lua | 306 ------------- Details.toc | 1 + Details_Vanilla.toc | 153 +++++++ Details_Wrath.toc | 2 + Libs/DF/button.lua | 363 +++++++++++---- Libs/DF/fw.lua | 2 +- Libs/DF/icon.lua | 487 ++++++++++++++++++++ Libs/DF/load.xml | 1 + Libs/DF/panel.lua | 495 ++------------------- Libs/DF/spells.lua | 3 + Libs/LibLuaServer/LuaServerDefinitions.lua | 305 +++++++++++++ classes/class_combat.lua | 6 +- functions/benchmark.lua | 9 + functions/timedata.lua | 25 +- images/icons.tga | Bin 1048620 -> 1048620 bytes 15 files changed, 1289 insertions(+), 869 deletions(-) create mode 100644 Details_Vanilla.toc create mode 100644 Libs/DF/icon.lua create mode 100644 Libs/LibLuaServer/LuaServerDefinitions.lua create mode 100644 functions/benchmark.lua diff --git a/Definitions.lua b/Definitions.lua index d987b3ee..b9bd7ffe 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -1,310 +1,4 @@ ---uiobject: is an object that represents a UI element, such as a frame, a texture, or a button. UIObjects are the base class for all UI elements in the WoW API. ---3D World: is an object which is placed behind|below all UI elements, cannot be parent of any object, in the 3D World object is where the game world is rendered ---size: corresponds to the height and height of an object, it is measure in pixels, must be bigger than zero. ---scale: the size of an object is multiplied by this value, it is measure in percentage, must be between 0.65 and 2.40. ---alpha: corresponds to the transparency of an object, the bigger is the value less transparent is the object, it is measure in percentage, must be between 0 and 1, zero is fully transparent and one is fully opaque. - - ----@class _G ----@field RegisterAttributeDriver fun(statedriver: frame, attribute: string, conditional: string) ----@field RegisterStateDriver fun(statedriver: frame, attribute: string, conditional: string) ----@field UnitGUID fun(unit: unit): string ----@field UnitName fun(unit: unit): string ----@field GetCursorPosition fun(): number, number return the position of the cursor on the screen, in pixels, relative to the bottom left corner of the screen. - ----@class unixtime : number const - ----@class timer : table ----@field Cancel fun(self: timer) ----@field IsCancelled fun(self: timer): boolean - ----@class C_Timer ----@field After fun(delay: number, func: function) ----@field NewTimer fun(delay: number, func: function): timer ----@field NewTicker fun(interval: number, func: function, iterations: number|nil): timer - ----@class C_ChallengeMode : table ----@field GetActiveKeystoneInfo fun(): number, number[], boolean @returns keystoneLevel, affixIDs, wasActive - ----@class tablesize : {H: number, W: number} ----@class tablecoords : {L: number, R: number, T: number, B: number} ----@class texturecoords: {left: number, right: number, top: number, bottom: number} ----@class objectsize : {height: number, width: number} ----@class texturetable : {texture: string, coords: texturecoords, size: objectsize} - ----@class spellid : number ----@class actorname : string ----@class spellname : string ----@class actorid : string ----@class red : number color value representing the red component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color) ----@class green : number color value representing the green component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color) ----@class blue : number color value representing the blue component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color) ----@class alpha : number @number(0-1.0) value representing the alpha (transparency) of a UIObject, the value must be between 0 and 1. 0 is fully transparent, 1 is fully opaque. ----@class color : table, string @table(r: red|number, g: green|number, b: blue|number, a: alpha|number) @string(color name) @hex (000000-ffffff) value representing a color, the value must be a table with the following fields: r, g, b, a. r, g, b are numbers between 0 and 1, a is a number between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color) ----@class scale : number @number(0.65-2.40) value representing the scale factor of the UIObject, the value must be between 0.65 and 2.40, the width and height of the UIObject will be multiplied by this value. ----@class texture : string, number is an object that represents a graphical image. Textures are used to display visual elements such as icons, backgrounds, borders, and more. ----@class frame : uiobject represents a container for other UI elements, such as textures, buttons, text, and more. Gotten from the first result of GetWidth() or from the first result of GetSize(). It is expected a GetWidth() or GetSize() when the type 'width' is used. ----@class width : number property that represents the horizontal size of a UI element, such as a frame or a texture. ----@class height : number property that represents the vertical size of a UI element, such as a frame or a texture. Gotten from the first result of GetHeight() or from the second result of GetSize(). It is expected a GetHeight() or GetSize() when the type 'height' is used. ----@class script : string, function is a piece of code that is executed in response to a specific event, such as a button click or a frame update. Scripts can be used to implement behavior and logic for UI elements. ----@class event : string is a notification that is sent to a frame when something happens, such as a button click or a frame update. Events can be used to trigger scripts. ----@class framestrata : string @string(BACKGROUND, LOW, MEDIUM, HIGH, DIALOG, FULLSCREEN, FULLSCREEN_DIALOG, TOOLTIP) property that determines the stacking order of frames. Higher strata values indicate frames that should be displayed on top of frames with lower strata values. ----@class backdrop : table @table(bgFile: string, edgeFile: string, tile: edgeSize: number, backgroundColor: color, borderColor: color) is a table that contains information about the backdrop of a frame. The backdrop is the background of a frame, which can be a solid color, a gradient, or a texture. ----@class unit : string string that represents a unit in the game, such as the player, a party member, or a raid member. ----@class health : number amount of hit points (health) of a unit. This value can be changed by taking damage or healing. ----@class role : string @string(TANK, HEALER, DAMAGER, NONE) is a string that represents the role of a unit, such as tank, healer, or damage dealer. ----@class point : string @string(topleft, topright, bottomleft, bottomright, top, bottom, left, right, center) is a string that represents a point on a frame. Points are used to position frames relative to each other. - ----@class uiobject ----@field GetObjectType fun(self: uiobject) : string ----@field Show fun(self: uiobject) make the object be shown on the user screen ----@field Hide fun(self: uiobject) make the object be hidden from the user screen ----@field SetShown fun(self: uiobject, state: boolean) show or hide the object ----@field IsShown fun(self: uiobject) : boolean return if the object is shown or not ----@field SetAllPoints fun(self: uiobject) set the object to be the same size as its parent ----@field SetParent fun(self: uiobject, parent: frame) set the parent object of the object ----@field SetSize fun(self: uiobject, width: width|number, height: height|number) set the width and height of the object ----@field SetWidth fun(self: uiobject, width: width|number) set only the width of the object ----@field SetHeight fun(self: uiobject, height: height|number) set only the height of the object ----@field SetAlpha fun(self: uiobject, alpha: alpha|number) set the transparency of the object ----@field SetScale fun(self: uiobject, scale: scale|number) ----@field GetWidth fun(self: uiobject) : width|number ----@field GetHeight fun(self: uiobject) : height|number ----@field GetScale fun(self: uiobject) : scale|number ----@field GetAlpha fun(self: uiobject) : alpha|number ----@field GetSize fun(self: uiobject) : width|number, height|number ----@field GetParent fun(self: uiobject) : frame ----@field GetPoint fun(self: uiobject, index: number): string, frame, string, number, number ----@field GetCenter fun(self: uiobject): number, number ----@field SetPoint fun(self: uiobject, point: "topleft"|"topright"|"bottomleft"|"bottomright"|"top"|"bottom"|"left"|"right"|"center", relativeFrame: uiobject, relativePoint: "topleft"|"topright"|"bottomleft"|"bottomright"|"top"|"bottom"|"left"|"right"|"center", xOffset: number, yOffset: number) ----@field ClearAllPoints fun(self: uiobject) ----@field CreateAnimationGroup fun(self: uiobject, name: string|nil, templateName: string|nil) : animationgroup - ----@class animationgroup : uiobject ----@field CreateAnimation fun(self: animationgroup, animationType: string, name: string|nil, inheritsFrom: string|nil) : animation ----@field GetAnimation fun(self: animationgroup, name: string) : animation ----@field GetAnimations fun(self: animationgroup) : table ----@field GetDuration fun(self: animationgroup) : number ----@field GetEndDelay fun(self: animationgroup) : number ----@field GetLoopState fun(self: animationgroup) : boolean ----@field GetScript fun(self: animationgroup, event: string) : function ----@field GetSmoothProgress fun(self: animationgroup) : boolean ----@field IsDone fun(self: animationgroup) : boolean ----@field IsPaused fun(self: animationgroup) : boolean ----@field IsPlaying fun(self: animationgroup) : boolean ----@field Pause fun(self: animationgroup) ----@field Play fun(self: animationgroup) ----@field Resume fun(self: animationgroup) ----@field SetDuration fun(self: animationgroup, duration: number) ----@field SetEndDelay fun(self: animationgroup, delay: number) ----@field SetLooping fun(self: animationgroup, loop: boolean) ----@field SetScript fun(self: animationgroup, event: string, handler: function|nil) "OnEvent"|"OnShow" ----@field SetSmoothProgress fun(self: animationgroup, smooth: boolean) ----@field Stop fun(self: animationgroup) - ----@class animation : uiobject ----@field GetDuration fun(self: animation) : number ----@field GetEndDelay fun(self: animation) : number ----@field GetOrder fun(self: animation) : number ----@field GetScript fun(self: animation, event: string) : function ----@field GetSmoothing fun(self: animation) : string ----@field IsDone fun(self: animation) : boolean ----@field IsPaused fun(self: animation) : boolean ----@field IsPlaying fun(self: animation) : boolean ----@field Pause fun(self: animation) ----@field Play fun(self: animation) ----@field Resume fun(self: animation) ----@field SetDuration fun(self: animation, duration: number) ----@field SetEndDelay fun(self: animation, delay: number) ----@field SetOrder fun(self: animation, order: number) ----@field SetScript fun(self: animation, event: string, handler: function|nil) ----@field SetSmoothing fun(self: animation, smoothing: string) ----@field Stop fun(self: animation) - ----@class frame : uiobject ----@field SetAttribute fun(self: frame, name: string, value: any) ----@field SetScript fun(self: frame, event: string, handler: function|nil) ----@field GetScript fun(self: frame, event: string) : function ----@field SetFrameStrata fun(self: frame, strata: framestrata|"background"|"low"|"medium"|"high"|"dialog"|"fullscreen"|"fullscreen_dialog"|"tooltip") ----@field SetFrameLevel fun(self: frame, level: number) ----@field SetClampedToScreen fun(self: frame, clamped: boolean) ----@field SetClampRectInsets fun(self: frame, left: number, right: number, top: number, bottom: number) ----@field SetMovable fun(self: frame, movable: boolean) ----@field SetUserPlaced fun(self: frame, userPlaced: boolean) ----@field SetBackdrop fun(self: frame, backdrop: backdrop|table) ----@field SetBackdropColor fun(self: frame, red: red|number, green: green|number, blue: blue|number, alpha: alpha|number) ----@field SetBackdropBorderColor fun(self: frame, red: red|number, green: green|number, blue: blue|number, alpha: alpha|number) ----@field SetHitRectInsets fun(self: frame, left: number, right: number, top: number, bottom: number) ----@field SetToplevel fun(self: frame, toplevel: boolean) ----@field SetPropagateKeyboardInput fun(self: frame, propagate: boolean) ----@field SetPropagateGamepadInput fun(self: frame, propagate: boolean) ----@field StartMoving fun(self: frame) ----@field IsMovable fun(self: frame) : boolean ----@field StartSizing fun(self: frame, point: "top"|"topright"|"right"|"bottomright"|"bottom"|"bottomleft"|"left"|"topleft") ----@field StopMovingOrSizing fun(self: frame) ----@field GetAttribute fun(self: frame, name: string) : any ----@field GetFrameLevel fun(self: frame) : number ----@field GetFrameStrata fun(self: frame) : framestrata|string ----@field GetNumChildren fun(self: frame) : number ----@field GetNumPoints fun(self: frame) : number ----@field GetNumRegions fun(self: frame) : number ----@field GetName fun(self: frame) : string ----@field GetChildren fun(self: frame) : frame[] ----@field GetRegions fun(self: frame) : region[] ----@field CreateTexture fun(self: frame, name: string|nil, layer: "background"|"border"|"artwork"|"overlay"|"highlight", inherits: string|nil, subLayer: number|nil) : texture ----@field CreateFontString fun(self: frame, name: string|nil, layer: "background"|"border"|"artwork"|"overlay"|"highlight", inherits: string|nil, subLayer: number|nil) : fontstring ----@field EnableMouse fun(self: frame, enable: boolean) ----@field SetResizable fun(self: frame, enable: boolean) ----@field EnableMouseWheel fun(self: frame, enable: boolean) ----@field RegisterForDrag fun(self: frame, button: string) ----@field SetResizeBounds fun(self: frame, minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) ----@field RegisterEvent fun(self: frame, event: string) - ----@class button : frame ----@field Click fun(self: button) ----@field SetNormalTexture fun(self: button, texture: texture) ----@field SetPushedTexture fun(self: button, texture: texture) ----@field SetHighlightTexture fun(self: button, texture: texture) ----@field SetDisabledTexture fun(self: button, texture: texture) ----@field SetCheckedTexture fun(self: button, texture: texture) ----@field SetNormalFontObject fun(self: button, fontString: fontstring) ----@field SetHighlightFontObject fun(self: button, fontString: fontstring) ----@field SetDisabledFontObject fun(self: button, fontString: fontstring) ----@field SetText fun(self: button, text: string) ----@field GetText fun(self: button) : string ----@field SetTextInsets fun(self: button, left: number, right: number, top: number, bottom: number) ----@field GetTextInsets fun(self: button) : number, number, number, number ----@field SetDisabledTextColor fun(self: button, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field GetDisabledTextColor fun(self: button) : number, number, number, number ----@field SetFontString fun(self: button, fontString: fontstring) ----@field GetFontString fun(self: button) : fontstring ----@field SetButtonState fun(self: button, state: string, enable: boolean) ----@field GetButtonState fun(self: button, state: string) : boolean ----@field RegisterForClicks fun(self: button, button1: nil|"AnyUp"|"AnyDown"|"LeftButtonDown"|"LeftButtonUp"|"MiddleButtonUp"|"MiddleButtonDown"|"RightButtonDown"|"RightButtonUp"|"Button4Up"|"Button4Down"|"Button5Up"|"Button5Down", button2: nil|"AnyUp"|"AnyDown"|"LeftButtonDown"|"LeftButtonUp"|"MiddleButtonUp"|"MiddleButtonDown"|"RightButtonDown"|"RightButtonUp"|"Button4Up"|"Button4Down"|"Button5Up"|"Button5Down") ----@field GetNormalTexture fun(self: button) : texture ----@field GetPushedTexture fun(self: button) : texture ----@field GetHighlightTexture fun(self: button) : texture ----@field GetDisabledTexture fun(self: button) : texture - ----@class statusbar : frame ----@field SetStatusBarColor fun(self: statusbar, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field SetStatusBarTexture fun(self: statusbar, path: string) ----@field SetMinMaxValues fun(self: statusbar, minValue: number, maxValue: number) ----@field SetValue fun(self: statusbar, value: number) ----@field SetValueStep fun(self: statusbar, valueStep: number) ----@field SetOrientation fun(self: statusbar, orientation: string) ----@field SetReverseFill fun(self: statusbar, reverseFill: boolean) ----@field GetMinMaxValues fun(self: statusbar) : number, number ----@field GetValue fun(self: statusbar) : number ----@field GetValueStep fun(self: statusbar) : number ----@field GetOrientation fun(self: statusbar) : string ----@field GetReverseFill fun(self: statusbar) : boolean - ----@class scrollframe : frame ----@field SetScrollChild fun(self: scrollframe, child: frame) ----@field GetScrollChild fun(self: scrollframe) : frame ----@field SetHorizontalScroll fun(self: scrollframe, offset: number) ----@field SetVerticalScroll fun(self: scrollframe, offset: number) ----@field GetHorizontalScroll fun(self: scrollframe) : number ----@field GetVerticalScroll fun(self: scrollframe) : number ----@field GetHorizontalScrollRange fun(self: scrollframe) : number ----@field GetVerticalScrollRange fun(self: scrollframe) : number - ----@class region : uiobject - ----@class fontstring : region ----@field SetDrawLayer fun(self: fontstring, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) ----@field SetFont fun(self: fontstring, font: string, size: number, flags: string) ----@field SetText fun(self: fontstring, text: string|number) ----@field GetText fun(self: fontstring) : string ----@field GetFont fun(self: fontstring) : string, number, string ----@field GetStringWidth fun(self: fontstring) : number return the width of the string in pixels ----@field SetShadowColor fun(self: fontstring, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field GetShadowColor fun(self: fontstring) : number, number, number, number ----@field SetShadowOffset fun(self: fontstring, offsetX: number, offsetY: number) ----@field GetShadowOffset fun(self: fontstring) : number, number ----@field SetTextColor fun(self: fontstring, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field GetTextColor fun(self: fontstring) : number, number, number, number ----@field SetJustifyH fun(self: fontstring, justifyH: string) ----@field GetJustifyH fun(self: fontstring) : string ----@field SetJustifyV fun(self: fontstring, justifyV: string) ----@field GetJustifyV fun(self: fontstring) : string ----@field SetNonSpaceWrap fun(self: fontstring, nonSpaceWrap: boolean) ----@field GetNonSpaceWrap fun(self: fontstring) : boolean ----@field SetIndentedWordWrap fun(self: fontstring, indentedWordWrap: boolean) ----@field GetIndentedWordWrap fun(self: fontstring) : boolean ----@field SetMaxLines fun(self: fontstring, maxLines: number) ----@field GetMaxLines fun(self: fontstring) : number ----@field SetWordWrap fun(self: fontstring, wordWrap: boolean) ----@field GetWordWrap fun(self: fontstring) : boolean ----@field SetSpacing fun(self: fontstring, spacing: number) ----@field GetSpacing fun(self: fontstring) : number ----@field SetLineSpacing fun(self: fontstring, lineSpacing: number) ----@field GetLineSpacing fun(self: fontstring) : number ----@field SetMaxLetters fun(self: fontstring, maxLetters: number) ----@field GetMaxLetters fun(self: fontstring) : number ----@field SetTextInsets fun(self: fontstring, left: number, right: number, top: number, bottom: number) ----@field GetTextInsets fun(self: fontstring) : number, number, number, number ----@field SetTextJustification fun(self: fontstring, justifyH: string, justifyV: string) ----@field GetTextJustification fun(self: fontstring) : string, string ----@field SetTextShadowColor fun(self: fontstring, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field GetTextShadowColor fun(self: fontstring) : number, number, number, number ----@field SetTextShadowOffset fun(self: fontstring, offsetX: number, offsetY: number) ----@field GetTextShadowOffset fun(self: fontstring) : number, number ----@field SetTextShadow fun(self: fontstring, offsetX: number, offsetY: number, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field SetTextTruncate fun(self: fontstring, truncate: string) ----@field GetTextTruncate fun(self: fontstring) : string ----@field SetTextTruncateWidth fun(self: fontstring, width: number) ----@field GetTextTruncateWidth fun(self: fontstring) : number ----@field SetTextTruncateLines fun(self: fontstring, lines: number) ----@field GetTextTruncateLines fun(self: fontstring) : number - ----@class texture : region ----@field SetDrawLayer fun(self: texture, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) ----@field SetTexture fun(self: texture, path: string) ----@field SetColorTexture fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) ----@field SetDesaturated fun(self: texture, desaturate: boolean) ----@field SetBlendMode fun(self: texture, mode: "ADD"|"BLEND"|"DISABLE"|"MOD"|"MOD2X"|"OVERLAY"|"REPLACE"|"SUBTRACT") ----@field SetVertexColor fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) ----@field GetPoint fun(self: texture, index: number) : string, table, string, number, number ----@field SetShown fun(self: texture, state: boolean) ----@field IsShown fun(self: texture) : boolean ----@field GetParent fun(self: texture) : table ----@field SetTexCoord fun(self: texture, left: number, right: number, top: number, bottom: number) ----@field GetTexCoord fun(self: texture) : number, number, number, number ----@field SetRotation fun(self: texture, rotation: number) ----@field GetRotation fun(self: texture) : number ----@field SetRotationRadians fun(self: texture, rotation: number) ----@field GetRotationRadians fun(self: texture) : number ----@field SetRotationDegrees fun(self: texture, rotation: number) ----@field GetRotationDegrees fun(self: texture) : number ----@field SetMask fun(self: texture, mask: table) ----@field GetMask fun(self: texture) : table ----@field SetMaskTexture fun(self: texture, maskTexture: table) ----@field GetMaskTexture fun(self: texture) : table ----@field GetDesaturated fun(self: texture) : boolean ----@field SetGradient fun(self: texture, gradient: string) ----@field GetGradient fun(self: texture) : string ----@field SetGradientAlpha fun(self: texture, gradient: string) ----@field GetGradientAlpha fun(self: texture) : string ----@field SetGradientRotation fun(self: texture, rotation: number) ----@field GetGradientRotation fun(self: texture) : number ----@field SetGradientRotationRadians fun(self: texture, rotation: number) ----@field GetGradientRotationRadians fun(self: texture) : number ----@field SetGradientRotationDegrees fun(self: texture, rotation: number) ----@field GetGradientRotationDegrees fun(self: texture) : number ----@field SetGradientColors fun(self: texture, ...) ----@field GetGradientColors fun(self: texture) : number, number, number, number, number, number, number, number, number, number, number, number ----@field GetBlendMode fun(self: texture) : string ----@field GetVertexColor fun(self: texture) : number, number, number, number - - - - - - - ---@class details ---@field SpellTableMixin spelltablemixin ---@field GetInstance fun(self: details) : instance diff --git a/Details.toc b/Details.toc index 1aab0cb2..6a97ea65 100644 --- a/Details.toc +++ b/Details.toc @@ -5,6 +5,7 @@ ## SavedVariablesPerCharacter: _detalhes_database ## OptionalDeps: Ace3, LibSharedMedia-3.0, LibWindow-1.1, LibDBIcon-1.0, NickTag-1.0, LibDataBroker-1.1, LibGraph-2.0 ## Version: #@project-version@ +## IconTexture: Interface\AddOns\Details\images\minimap ## X-Curse-Project-ID: 61284 ## X-Wago-ID: 25NRDlK3 diff --git a/Details_Vanilla.toc b/Details_Vanilla.toc new file mode 100644 index 00000000..2db4db07 --- /dev/null +++ b/Details_Vanilla.toc @@ -0,0 +1,153 @@ +## Interface: 11403 +## Title: Details! Damage Meter +## Notes: Essential tool to impress that chick in your raid. +## SavedVariables: _detalhes_global, __details_backup +## SavedVariablesPerCharacter: _detalhes_database +## OptionalDeps: Ace3, LibSharedMedia-3.0, LibWindow-1.1, LibDBIcon-1.0, NickTag-1.0, LibDataBroker-1.1, LibItemUpgradeInfo-1.0, LibGroupInSpecT-1.1, LibCompress, LibGraph-2.0 +## Version: #@project-version@ +## IconTexture: Interface\AddOns\Details\images\minimap + +#@no-lib-strip@ +Libs\libs.xml +#@end-no-lib-strip@ + +locales\Details-enUS.lua +locales\Details-deDE.lua +locales\Details-esES.lua +locales\Details-esMX.lua +locales\Details-frFR.lua +locales\Details-itIT.lua +locales\Details-koKR.lua +locales\Details-ptBR.lua +locales\Details-ruRU.lua +locales\Details-zhCN.lua +locales\Details-zhTW.lua + +Definitions.lua + +boot.lua +indent.lua +core\util.lua +functions\mixin.lua +API.lua + +functions\private.lua +functions\profiles.lua +functions\hooks.lua +functions\bossmods.lua +functions\coach.lua +functions\skins.lua +functions\boss.lua +functions\spells.lua +functions\events.lua +functions\classes.lua +functions\buff.lua +functions\spellcache.lua +functions\attributes.lua +functions\savedata.lua +functions\slash.lua +functions\playerclass.lua +functions\timedata.lua +functions\report.lua +functions\rowanimation.lua +functions\raidinfo.lua +functions\dungeon.lua +functions\pack.lua +functions\mythicdungeon.lua +functions\immersion.lua +functions\schedules.lua +functions\autorun.lua +functions\deathrecap.lua +functions\plater.lua +functions\deathmenu.lua +functions\macros.lua +functions\testbars.lua +functions\warcraftlogs.lua +functions\textures.lua + +core\timemachine.lua + +frames\anime.lua +frames\anime.xml +frames\fw_mods.lua +frames\toolbar_button.xml + +frames\window_copy.lua +frames\window_options2.lua +frames\window_options2_sections.lua +frames\window_api.lua +frames\window_cdtracker.lua +frames\window_playerbreakdown.lua +frames\window_playerbreakdown_list.lua +frames\window_playerbreakdown_compare.lua +frames\window_playerbreakdown_avoidance.lua +frames\window_playerbreakdown_auras.lua +frames\window_playerbreakdown_spells.lua +frames\window_playerbreakdown_spells_options.lua +frames\window_report.lua +frames\window_main.lua +frames\window_custom.lua +frames\window_welcome.lua +frames\window_news.lua +frames\window_wa.lua +frames\window_spellcategory.lua +frames\window_forge.lua +frames\window_switch.lua +frames\window_scrolldamage.lua +frames\window_dump.lua +frames\window_eventtracker.lua +frames\window_currentdps.lua +frames\window_benchmark.lua +frames\window_runcode.lua +frames\window_plater.lua +frames\window_macros.lua +frames\window_profiler.lua +frames\window_rowtexteditor.lua +frames\window_brokertexteditor.lua +frames\window_bookmark.lua +frames\window_classcolor.lua +frames\window_statistics.lua + +classes\class_error.lua +classes\class_spelltable.lua +classes\class_combat.lua +classes\class_damage.lua +classes\class_spelldamage.lua +classes\class_heal.lua +classes\class_spellhealing.lua +classes\class_resources.lua +classes\class_spellresources.lua +classes\class_utility.lua +classes\class_spellutility.lua +classes\include_instance.lua +classes\class_instance.lua + +classes\class_custom.lua +classes\custom_damagedone.lua +classes\custom_healingdone.lua + +core\control.lua + +classes\container_actors.lua +classes\container_spells.lua +classes\container_segments.lua +classes\container_pets.lua + +core\plugins.lua +core\plugins_toolbar.lua +core\plugins_statusbar.lua +core\plugins_raid.lua +core\plugins_solo.lua +core\gears.lua +core\windows.lua +core\meta.lua +core\network.lua + +core\parser.lua +#core\parser_timewalk.lua + +functions\loaddata.lua + +startup.lua + +functions\api2.lua diff --git a/Details_Wrath.toc b/Details_Wrath.toc index ff23a3ff..1ed6a6c4 100644 --- a/Details_Wrath.toc +++ b/Details_Wrath.toc @@ -5,6 +5,8 @@ ## SavedVariablesPerCharacter: _detalhes_database ## OptionalDeps: Ace3, LibSharedMedia-3.0, LibWindow-1.1, LibDBIcon-1.0, NickTag-1.0, LibDataBroker-1.1, LibItemUpgradeInfo-1.0, LibGroupInSpecT-1.1, LibCompress, LibGraph-2.0 ## Version: #@project-version@ +## IconTexture: Interface\AddOns\Details\images\minimap + #@no-lib-strip@ Libs\libs.xml #@end-no-lib-strip@ diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index 216f2b2c..bdc67dcd 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -1,26 +1,27 @@ -local DF = _G["DetailsFramework"] +local detailsFramework = _G["DetailsFramework"] -if (not DF or not DetailsFrameworkCanLoad) then +if (not detailsFramework or not DetailsFrameworkCanLoad) then return end local _ +local unpack = unpack local emptyFunction = function() end local APIButtonFunctions = false do local metaPrototype = { WidgetType = "button", - dversion = DF.dversion + dversion = detailsFramework.dversion } --check if there's a metaPrototype already existing - if (_G[DF.GlobalWidgetControlNames["button"]]) then + if (_G[detailsFramework.GlobalWidgetControlNames["button"]]) then --get the already existing metaPrototype - local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["button"]] + local oldMetaPrototype = _G[detailsFramework.GlobalWidgetControlNames["button"]] --check if is older - if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < detailsFramework.dversion) ) then --the version is older them the currently loading one --copy the new values into the old metatable for funcName, _ in pairs(metaPrototype) do @@ -29,23 +30,23 @@ do end else --first time loading the framework - _G[DF.GlobalWidgetControlNames["button"]] = metaPrototype + _G[detailsFramework.GlobalWidgetControlNames["button"]] = metaPrototype end end -local ButtonMetaFunctions = _G[DF.GlobalWidgetControlNames["button"]] +local ButtonMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames["button"]] -DF:Mixin(ButtonMetaFunctions, DF.SetPointMixin) -DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) -DF:Mixin(ButtonMetaFunctions, DF.TooltipHandlerMixin) -DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) +detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.SetPointMixin) +detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.FrameMixin) +detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.TooltipHandlerMixin) +detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables ButtonMetaFunctions.__call = function(self) local frameWidget = self.widget - DF:CoreDispatch((frameWidget:GetName() or "Button") .. ":__call()", self.func, frameWidget, "LeftButton", self.param1, self.param2) + detailsFramework:CoreDispatch((frameWidget:GetName() or "Button") .. ":__call()", self.func, frameWidget, "LeftButton", self.param1, self.param2) end ------------------------------------------------------------------------------------------------------------ @@ -194,18 +195,18 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) --text color local smember_textcolor = function(object, value) - local value1, value2, value3, value4 = DF:ParseColors(value) + local value1, value2, value3, value4 = detailsFramework:ParseColors(value) return object.button.text:SetTextColor(value1, value2, value3, value4) end --text font local smember_textfont = function(object, value) - return DF:SetFontFace (object.button.text, value) + return detailsFramework:SetFontFace (object.button.text, value) end --text size local smember_textsize = function(object, value) - return DF:SetFontSize(object.button.text, value) + return detailsFramework:SetFontSize(object.button.text, value) end --texture @@ -331,7 +332,7 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) ---set the color of the button text ---@param ... any function ButtonMetaFunctions:SetTextColor(...) - local red, green, blue, alpha = DF:ParseColors(...) + local red, green, blue, alpha = detailsFramework:ParseColors(...) self.button.text:SetTextColor(red, green, blue, alpha) end ButtonMetaFunctions.SetFontColor = ButtonMetaFunctions.SetTextColor --alias @@ -339,13 +340,13 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) ---set the size of the button text ---@param ... number function ButtonMetaFunctions:SetFontSize(...) - DF:SetFontSize(self.button.text, ...) + detailsFramework:SetFontSize(self.button.text, ...) end ---set the font into the button text ---@param font string function ButtonMetaFunctions:SetFontFace(font) - DF:SetFontFace(self.button.text, font) + detailsFramework:SetFontFace(self.button.text, font) end ---comment @@ -425,14 +426,14 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) if (isAtlas) then self.icon:SetAtlas(texture) - elseif (DF:IsHtmlColor(texture)) then - local r, g, b, a = DF:ParseColors(texture) + elseif (detailsFramework:IsHtmlColor(texture)) then + local r, g, b, a = detailsFramework:ParseColors(texture) self.icon:SetColorTexture(r, g, b, a) else self.icon:SetTexture(texture) end elseif (type(texture) == "table") then - local r, g, b, a = DF:ParseColors(texture) + local r, g, b, a = detailsFramework:ParseColors(texture) self.icon:SetColorTexture(r, g, b, a) else self.icon:SetTexture(texture) @@ -449,7 +450,7 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) if (overlay) then if (type(overlay) == "string") then - local r, g, b, a = DF:ParseColors(overlay) + local r, g, b, a = detailsFramework:ParseColors(overlay) self.icon:SetVertexColor(r, g, b, a) else self.icon:SetVertexColor(unpack(overlay)) @@ -476,7 +477,7 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) loop = false break else - DF:SetFontSize(self.button.text, textSize) + detailsFramework:SetFontSize(self.button.text, textSize) textWidth = self.button.text:GetStringWidth() textSize = textSize - 1 end @@ -506,25 +507,25 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) ---simulate a click on the button function ButtonMetaFunctions:Exec() local frameWidget = self.widget - DF:CoreDispatch((frameWidget:GetName() or "Button") .. ":Exec()", self.func, frameWidget, "LeftButton", self.param1, self.param2) + detailsFramework:CoreDispatch((frameWidget:GetName() or "Button") .. ":Exec()", self.func, frameWidget, "LeftButton", self.param1, self.param2) end ---simulate a click on the button, but this function is called with a different name function ButtonMetaFunctions:Click() local frameWidget = self.widget - DF:CoreDispatch((frameWidget:GetName() or "Button") .. ":Click()", self.func, frameWidget, "LeftButton", self.param1, self.param2) + detailsFramework:CoreDispatch((frameWidget:GetName() or "Button") .. ":Click()", self.func, frameWidget, "LeftButton", self.param1, self.param2) end ---simulate a right click on the button function ButtonMetaFunctions:RightClick() local frameWidget = self.widget - DF:CoreDispatch((frameWidget:GetName() or "Button") .. ":RightClick()", self.funcright, frameWidget, "RightButton", self.param1, self.param2) + detailsFramework:CoreDispatch((frameWidget:GetName() or "Button") .. ":RightClick()", self.funcright, frameWidget, "RightButton", self.param1, self.param2) end --custom textures function ButtonMetaFunctions:InstallCustomTexture() --function deprecated, now just set a the standard template - self:SetTemplate(DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) + self:SetTemplate(detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) end ------------------------------------------------------------------------------------------------------------ @@ -649,8 +650,8 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) button.mouse_down = GetTime() local x, y = GetCursorPosition() - button.x = floor(x) - button.y = floor(y) + button.x = math.floor(x) + button.y = math.floor(y) if (not object.container.isLocked and object.container:IsMovable()) then if (not button.isLocked and button:IsMovable()) then @@ -662,9 +663,9 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) if (object.options.OnGrab) then if (type(object.options.OnGrab) == "string" and object.options.OnGrab == "PassClick") then if (buttontype == "LeftButton") then - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", object.func, button, buttontype, object.param1, object.param2) + detailsFramework:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", object.func, button, buttontype, object.param1, object.param2) else - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", object.funcright, button, buttontype, object.param1, object.param2) + detailsFramework:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", object.funcright, button, buttontype, object.param1, object.param2) end end end @@ -727,16 +728,16 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) end local x, y = GetCursorPosition() - x = floor(x) - y = floor(y) + x = math.floor(x) + y = math.floor(y) button.mouse_down = button.mouse_down or 0 --avoid issues when the button was pressed while disabled and release when enabled if ((x == button.x and y == button.y) or (button.mouse_down + 0.5 > GetTime() and button:IsMouseOver())) then if (buttonType == "LeftButton") then - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", object.func, button, buttonType, object.param1, object.param2) + detailsFramework:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", object.func, button, buttonType, object.param1, object.param2) else - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", object.funcright, button, buttonType, object.param1, object.param2) + detailsFramework:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", object.funcright, button, buttonType, object.param1, object.param2) end end end @@ -749,11 +750,11 @@ DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) ---@param template table function ButtonMetaFunctions:SetTemplate(template) if (type(template) == "string") then - template = DF:GetTemplate("button", template) + template = detailsFramework:GetTemplate("button", template) end if (not template) then - DF:Error("template not found") + detailsFramework:Error("template not found") return end @@ -770,34 +771,34 @@ function ButtonMetaFunctions:SetTemplate(template) end if (template.backdropcolor) then - local r, g, b, a = DF:ParseColors(template.backdropcolor) + local r, g, b, a = detailsFramework:ParseColors(template.backdropcolor) self:SetBackdropColor(r, g, b, a) self.onleave_backdrop = {r, g, b, a} end if (template.backdropbordercolor) then - local r, g, b, a = DF:ParseColors(template.backdropbordercolor) + local r, g, b, a = detailsFramework:ParseColors(template.backdropbordercolor) self:SetBackdropBorderColor(r, g, b, a) self.onleave_backdrop_border_color = {r, g, b, a} end if (template.onentercolor) then - local r, g, b, a = DF:ParseColors(template.onentercolor) + local r, g, b, a = detailsFramework:ParseColors(template.onentercolor) self.onenter_backdrop = {r, g, b, a} end if (template.onleavecolor) then - local r, g, b, a = DF:ParseColors(template.onleavecolor) + local r, g, b, a = detailsFramework:ParseColors(template.onleavecolor) self.onleave_backdrop = {r, g, b, a} end if (template.onenterbordercolor) then - local r, g, b, a = DF:ParseColors(template.onenterbordercolor) + local r, g, b, a = detailsFramework:ParseColors(template.onenterbordercolor) self.onenter_backdrop_border_color = {r, g, b, a} end if (template.onleavebordercolor) then - local r, g, b, a = DF:ParseColors(template.onleavebordercolor) + local r, g, b, a = detailsFramework:ParseColors(template.onleavebordercolor) self.onleave_backdrop_border_color = {r, g, b, a} end @@ -842,7 +843,7 @@ end self.text:SetJustifyH("CENTER") self.text:SetPoint("CENTER", self, "CENTER", 0, 0) self:SetFontString(self.text) - DF:SetFontSize(self.text, 10) + detailsFramework:SetFontSize(self.text, 10) self.texture_disabled = self:CreateTexture("$parent_TextureDisabled", "OVERLAY") self.texture_disabled:SetAllPoints() @@ -853,6 +854,36 @@ end self:SetScript("OnEnable", onEnableFunc) end + ---@class df_button : button + ---@field tooltip string + ---@field shown boolean + ---@field width number + ---@field height number + ---@field text string + ---@field clickfunction function + ---@field texture string + ---@field locked boolean + ---@field fontcolor any + ---@field fontface string + ---@field fontsize number + ---@field textcolor any + ---@field textfont string + ---@field textsize number + ---@field SetTemplate fun(self: df_button, template: table) set the button visual by a template + ---@field RightClick fun(self: df_button) right click the button executing its right click function + ---@field Exec fun(self: df_button) execute the button function for the left button + ---@field Disable fun(self: df_button) disable the button + ---@field Enable fun(self: df_button) enable the button + ---@field IsEnabled fun(self: df_button) : boolean returns true if the button is enabled + ---@field SetIcon fun(self: df_button,texture: string, width: number|nil, height: number|nil, layout: string|nil, texcoord: table|nil, overlay: table|nil, textDistance: number|nil, leftPadding: number|nil, textHeight: number|nil, shortMethod: any|nil) + ---@field GetIconTexture fun(self: df_button) : string returns the texture path of the button icon + ---@field SetTexture fun(self: df_button, normalTexture: string, highlightTexture: string, pressedTexture: string, disabledTexture: string) set the regular button textures + ---@field SetFontFace fun(self: df_button, font: string) set the button font + ---@field SetFontSize fun(self: df_button, size: number) set the button font size + ---@field SetTextColor fun(self: df_button, color: any) set the button text color + ---@field SetText fun(self: df_button, text: string) set the button text + ---@field SetClickFunction fun(self: df_button, func: function, param1: any, param2: any, clickType: "left"|"right"|nil) + ---create a Details Framework button ---@param parent table ---@param func function @@ -867,22 +898,23 @@ end ---@param shortMethod boolean|nil ---@param buttonTemplate table|nil ---@param textTemplate table|nil - ---@return table|nil - function DF:CreateButton(parent, func, width, height, text, param1, param2, texture, member, name, shortMethod, buttonTemplate, textTemplate) - return DF:NewButton(parent, parent, name, member, width, height, func, param1, param2, texture, text, shortMethod, buttonTemplate, textTemplate) + ---@return df_button + function detailsFramework:CreateButton(parent, func, width, height, text, param1, param2, texture, member, name, shortMethod, buttonTemplate, textTemplate) + return detailsFramework:NewButton(parent, parent, name, member, width, height, func, param1, param2, texture, text, shortMethod, buttonTemplate, textTemplate) end - function DF:NewButton(parent, container, name, member, width, height, func, param1, param2, texture, text, shortMethod, buttonTemplate, textTemplate) + ---@return df_button + function detailsFramework:NewButton(parent, container, name, member, width, height, func, param1, param2, texture, text, shortMethod, buttonTemplate, textTemplate) if (not name) then - name = "DetailsFrameworkButtonNumber" .. DF.ButtonCounter - DF.ButtonCounter = DF.ButtonCounter + 1 + name = "DetailsFrameworkButtonNumber" .. detailsFramework.ButtonCounter + detailsFramework.ButtonCounter = detailsFramework.ButtonCounter + 1 elseif (not parent) then - return error("Details! FrameWork: parent not found.", 2) + error("Details! FrameWork: parent not found.", 2) end if (name:find("$parent")) then - local parentName = DF.GetParentName(parent) + local parentName = detailsFramework.GetParentName(parent) name = name:gsub("$parent", parentName) end @@ -904,7 +936,7 @@ end buttonObject.options = {OnGrab = false} buttonObject.button = CreateFrame("button", name, parent, "BackdropTemplate") - DF:Mixin(buttonObject.button, DF.WidgetFunctions) + detailsFramework:Mixin(buttonObject.button, detailsFramework.WidgetFunctions) createButtonWidgets(buttonObject.button) buttonObject.button:SetSize(width or 100, height or 20) @@ -934,7 +966,7 @@ end buttonObject.button:SetHighlightTexture(texture, "ADD") local locTable = text - DF.Language.SetTextWithLocTableWithDefault(buttonObject.button.text, locTable, text) + detailsFramework.Language.SetTextWithLocTableWithDefault(buttonObject.button.text, locTable, text) buttonObject.button.text:SetPoint("center", buttonObject.button, "center") @@ -954,7 +986,7 @@ end loop = false break else - DF:SetFontSize(buttonObject.button.text, textsize) + detailsFramework:SetFontSize(buttonObject.button.text, textsize) textWidth = buttonObject.button.text:GetStringWidth() textsize = textsize - 1 end @@ -972,18 +1004,18 @@ end if (textTemplate) then if (textTemplate.size) then - DF:SetFontSize(buttonObject.button.text, textTemplate.size) + detailsFramework:SetFontSize(buttonObject.button.text, textTemplate.size) end if (textTemplate.color) then - local r, g, b, a = DF:ParseColors(textTemplate.color) + local r, g, b, a = detailsFramework:ParseColors(textTemplate.color) buttonObject.button.text:SetTextColor(r, g, b, a) end if (textTemplate.font) then local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") local font = SharedMedia:Fetch("font", textTemplate.font) - DF:SetFontFace(buttonObject.button.text, font) + detailsFramework:SetFontFace(buttonObject.button.text, font) end end @@ -1015,24 +1047,23 @@ end ------------------------------------------------------------------------------------------------------------ --color picker button - local pickcolorCallback = function(self, red, green, blue, alpha, button) - alpha = abs(alpha - 1) + alpha = math.abs(alpha - 1) button.MyObject.color_texture:SetVertexColor(red, green, blue, alpha) --safecall - DF:CoreDispatch((self:GetName() or "ColorPicker") .. ".pickcolor_callback()", button.MyObject.color_callback, button.MyObject, red, green, blue, alpha) + detailsFramework:CoreDispatch((self:GetName() or "ColorPicker") .. ".pickcolor_callback()", button.MyObject.color_callback, button.MyObject, red, green, blue, alpha) button.MyObject:RunHooksForWidget("OnColorChanged", button.MyObject, red, green, blue, alpha) end local pickcolor = function(self) local red, green, blue, alpha = self.MyObject.color_texture:GetVertexColor() - alpha = abs(alpha - 1) - DF:ColorPick(self, red, green, blue, alpha, pickcolorCallback) + alpha = math.abs(alpha - 1) + detailsFramework:ColorPick(self, red, green, blue, alpha, pickcolorCallback) end local setColorPickColor = function(button, ...) - local red, green, blue, alpha = DF:ParseColors(...) + local red, green, blue, alpha = detailsFramework:ParseColors(...) button.color_texture:SetVertexColor(red, green, blue, alpha) end @@ -1052,13 +1083,13 @@ end ---@param alpha number|nil ---@param buttonTemplate table|nil ---@return table|nil - function DF:CreateColorPickButton(parent, name, member, callback, alpha, buttonTemplate) - return DF:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate) + function detailsFramework:CreateColorPickButton(parent, name, member, callback, alpha, buttonTemplate) + return detailsFramework:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate) end - function DF:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate) + function detailsFramework:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate) --button - local colorPickButton = DF:NewButton(parent, _, name, member, 16, 16, pickcolor, alpha, "param2", nil, nil, nil, buttonTemplate) + local colorPickButton = detailsFramework:NewButton(parent, _, name, member, 16, 16, pickcolor, alpha, "param2", nil, nil, nil, buttonTemplate) colorPickButton.color_callback = callback colorPickButton.Cancel = colorpickCancel colorPickButton.SetColor = setColorPickColor @@ -1067,7 +1098,7 @@ end colorPickButton.HookList.OnColorChanged = {} if (not buttonTemplate) then - colorPickButton:SetTemplate(DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) + colorPickButton:SetTemplate(detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) end --background showing a grid to indicate the transparency @@ -1079,7 +1110,7 @@ end background:SetAlpha(0.3) --texture which shows the texture color - local colorTexture = DF:NewImage(colorPickButton, nil, 16, 16, nil, nil, "color_texture", "$parentTex") + local colorTexture = detailsFramework:NewImage(colorPickButton, nil, 16, 16, nil, nil, "color_texture", "$parentTex") colorTexture:SetColorTexture(1, 1, 1) colorTexture:SetPoint("topleft", colorPickButton.widget, "topleft", 0, 0) colorTexture:SetPoint("bottomright", colorPickButton.widget, "bottomright", 0, 0) @@ -1088,7 +1119,7 @@ end return colorPickButton end - function DF:SetRegularButtonTexture(button, texture, left, right, top, bottom) + function detailsFramework:SetRegularButtonTexture(button, texture, left, right, top, bottom) if (type(left) == "table") then left, right, top, bottom = unpack(left) end @@ -1124,8 +1155,8 @@ end end end - function DF:SetRegularButtonVertexColor(button, ...) - local r, g, b, a = DF:ParseColor(...) + function detailsFramework:SetRegularButtonVertexColor(button, ...) + local r, g, b, a = detailsFramework:ParseColor(...) local normalTexture = button:GetNormalTexture() local pushedTexture = button:GetPushedTexture() local highlightTexture = button:GetHightlightTexture() @@ -1135,4 +1166,186 @@ end pushedTexture:SetVertexColor(r, g, b, a) highlightTexture:SetVertexColor(r, g, b, a) disabledTexture:SetVertexColor(r, g, b, a) - end \ No newline at end of file + end + + +------------------------------------------------------------------------------------------------------------ +--tab button + +---@class df_tabbutton : button +---@field LeftTexture texture +---@field RightTexture texture +---@field MiddleTexture texture +---@field SelectedTexture texture +---@field Text fontstring +---@field CloseButton df_closebutton +---@field leftTextureName string +---@field rightTextureName string +---@field middleTextureName string +---@field leftTextureSelectedName string +---@field rightTextureSelectedName string +---@field middleTextureSelectedName string +---@field bIsSelected boolean +---@field SetText fun(self: df_tabbutton, text: string) +---@field SetSelected fun(self: df_tabbutton, selected: boolean) +---@field IsSelected fun(self: df_tabbutton): boolean +---@field Reset fun(self: df_tabbutton) + +detailsFramework.TabButtonMixin = { + ---set the text of the tab button + ---@param self df_tabbutton + ---@param text string + SetText = function(self, text) + self.Text:SetText(text) + --adjust the width of the tab button to fit the text + local fontStringLength = self.Text:GetStringWidth() + self:SetWidth(fontStringLength + 20) + end, + + ---highlight the tab textures to indicate the tab is selected + ---@param self df_tabbutton + ---@param selected boolean + SetSelected = function(self, selected) + self.LeftTexture:SetAtlas(selected and self.leftTextureSelectedName or self.leftTextureName) + self.RightTexture:SetAtlas(selected and self.rightTextureSelectedName or self.rightTextureName) + self.MiddleTexture:SetAtlas(selected and self.middleTextureSelectedName or self.middleTextureName) + self.SelectedTexture:SetShown(selected) + self.bIsSelected = selected + end, + + ---get a boolean representing if the tab is selected + ---@param self df_tabbutton + ---@return boolean + IsSelected = function(self) + return self.bIsSelected + end, + + ---set all textures to their default values, set the text to an empty string, set the selected state to false + ---@param self df_tabbutton + Reset = function(self) + self.LeftTexture:SetAtlas(self.leftTextureName) + self.RightTexture:SetAtlas(self.rightTextureName) + self.MiddleTexture:SetAtlas(self.middleTextureName) + self.Text:SetText("") + self.bIsSelected = false + self.SelectedTexture:Hide() + end, + +} + +---create a button which can be used as a tab button, has textures for left, right, middle and a text +---@param parent frame +---@param frameName string|nil +---@return df_tabbutton +function detailsFramework:CreateTabButton(parent, frameName) + ---@type df_tabbutton + local tabButton = CreateFrame("button", frameName, parent) + tabButton:SetSize(50, 20) + tabButton.bIsSelected = false + + detailsFramework:Mixin(tabButton, detailsFramework.TabButtonMixin) + + tabButton.LeftTexture = tabButton:CreateTexture(nil, "artwork") + tabButton.RightTexture = tabButton:CreateTexture(nil, "artwork") + tabButton.MiddleTexture = tabButton:CreateTexture(nil, "artwork") + tabButton.SelectedTexture = tabButton:CreateTexture(nil, "overlay") + tabButton.SelectedTexture:SetBlendMode("ADD") + tabButton.SelectedTexture:SetAlpha(0.5) + tabButton.SelectedTexture:Hide() + tabButton.Text = tabButton:CreateFontString(nil, "overlay", "GameFontNormal") + tabButton.CloseButton = detailsFramework:CreateCloseButton(tabButton, "$parentCloseButton") + + tabButton.Text:SetPoint("center", tabButton, "center", 0, 0) + tabButton.CloseButton:SetPoint("topright", tabButton, "topright", 0, 0) + + tabButton.LeftTexture:SetPoint("bottomleft", tabButton, "bottomleft", 0, 0) + tabButton.LeftTexture:SetPoint("topleft", tabButton, "topleft", 0, 0) + + tabButton.RightTexture:SetPoint("bottomright", tabButton, "bottomright", 0, 0) + tabButton.RightTexture:SetPoint("topright", tabButton, "topright", 0, 0) + + tabButton.MiddleTexture:SetPoint("topleft", tabButton.LeftTexture, "topright", 0, 0) + tabButton.MiddleTexture:SetPoint("topright", tabButton.RightTexture, "topleft", 0, 0) + + tabButton.SelectedTexture:SetAllPoints(tabButton.MiddleTexture) + + tabButton.leftTextureName = "Options_Tab_Left" + tabButton.rightTextureName = "Options_Tab_Right" + tabButton.middleTextureName = "Options_Tab_Middle" + + tabButton.leftTextureSelectedName = "Options_Tab_Active_Left" + tabButton.rightTextureSelectedName = "Options_Tab_Active_Right" + tabButton.middleTextureSelectedName = "Options_Tab_Active_Middle" + + tabButton.LeftTexture:SetAtlas(tabButton.leftTextureName) + tabButton.LeftTexture:SetWidth(2) + + tabButton.RightTexture:SetAtlas(tabButton.rightTextureName) + tabButton.RightTexture:SetWidth(2) + + tabButton.MiddleTexture:SetAtlas(tabButton.middleTextureName) + tabButton.MiddleTexture:SetHeight(20) + + tabButton.SelectedTexture:SetTexture([[Interface\PaperDollInfoFrame\UI-Character-Tab-Highlight-yellow]]) + + tabButton.Text:SetText("") + + return tabButton +end + +------------------------------------------------------------------------------------------------------------ +--close button + +detailsFramework.CloseButtonMixin = { + OnClick = function(self) + self:GetParent():Hide() + end, + OnEnter = function(self) + self:GetNormalTexture():SetVertexColor(1, 0, 0) + end, + OnLeave = function(self) + self:GetNormalTexture():SetVertexColor(1, 1, 1) + end, +} + +---@class df_closebutton : button +---@field OnClick fun(self: df_closebutton) +---@field OnEnter fun(self: df_closebutton) +---@field OnLeave fun(self: df_closebutton) + +---create a close button which when clicked will hide the parent frame +---@param parent frame +---@param frameName string|nil +---@return df_closebutton +function detailsFramework:CreateCloseButton(parent, frameName) + ---@type df_closebutton + local closeButton = CreateFrame("button", frameName, parent) + closeButton:SetFrameLevel(parent:GetFrameLevel() + 1) + closeButton:SetSize(16, 16) + + detailsFramework:Mixin(closeButton, detailsFramework.CloseButtonMixin) + + closeButton:SetNormalTexture([[Interface\GLUES\LOGIN\Glues-CheckBox-Check]]) + closeButton:SetHighlightTexture([[Interface\GLUES\LOGIN\Glues-CheckBox-Check]]) + closeButton:SetPushedTexture([[Interface\GLUES\LOGIN\Glues-CheckBox-Check]]) + closeButton:GetNormalTexture():SetDesaturated(true) + closeButton:GetHighlightTexture():SetDesaturated(true) + closeButton:GetPushedTexture():SetDesaturated(true) + + closeButton:SetAlpha(0.7) + closeButton:SetScript("OnClick", closeButton.OnClick) + closeButton:SetScript("OnEnter", closeButton.OnEnter) + closeButton:SetScript("OnLeave", closeButton.OnLeave) + + return closeButton +end + +--[=[ + --example: + local frame = CreateFrame("frame", "MyTestFrameForCloseButton", UIParent) + frame:SetSize(200, 200) + frame:SetPoint("center", UIParent, "center", 0, 0) + + local closeButton = detailsFramework:CreateCloseButton(frame, "$parentCloseButton") + closeButton:SetPoint("topright", frame, "topright", 0, 0) +--]=] \ No newline at end of file diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index d18108a2..9b7d195a 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 430 +local dversion = 436 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/icon.lua b/Libs/DF/icon.lua new file mode 100644 index 00000000..6ff6dcd0 --- /dev/null +++ b/Libs/DF/icon.lua @@ -0,0 +1,487 @@ + +local detailsFramework = DetailsFramework + +if (not detailsFramework or not DetailsFrameworkCanLoad) then + return +end + +local unpack = unpack +local CreateFrame = CreateFrame +local PixelUtil = PixelUtil + +detailsFramework.IconMixin = { + ---create a new icon frame + ---@param self frame the parent frame + ---@param iconName string the name of the icon frame + ---@return frame + CreateIcon = function(self, iconName) + local iconFrame = CreateFrame("frame", iconName, self, "BackdropTemplate") + + iconFrame.Texture = iconFrame:CreateTexture(nil, "artwork") + PixelUtil.SetPoint(iconFrame.Texture, "topleft", iconFrame, "topleft", 1, -1) + PixelUtil.SetPoint(iconFrame.Texture, "bottomright", iconFrame, "bottomright", -1, 1) + + iconFrame.Border = iconFrame:CreateTexture(nil, "background") + iconFrame.Border:SetAllPoints() + iconFrame.Border:SetColorTexture(0, 0, 0) + + iconFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) + iconFrame:SetBackdropBorderColor(0, 0, 0, 0) + iconFrame:EnableMouse(false) + + local cooldownFrame = CreateFrame("cooldown", "$parentCooldown", iconFrame, "CooldownFrameTemplate, BackdropTemplate") + cooldownFrame:SetAllPoints() + cooldownFrame:EnableMouse(false) + cooldownFrame:SetFrameLevel(iconFrame:GetFrameLevel()+1) + iconFrame.Cooldown = cooldownFrame + + iconFrame.CountdownText = cooldownFrame:CreateFontString(nil, "overlay", "GameFontNormal") + iconFrame.CountdownText:SetPoint("center", iconFrame, "center", 0, 0) + iconFrame.CountdownText:Hide() + + iconFrame.StackText = iconFrame:CreateFontString(nil, "overlay", "GameFontNormal") + iconFrame.StackText:SetPoint("center", iconFrame, "bottomright", 0, 0) + iconFrame.StackText:Hide() + + iconFrame.Desc = iconFrame:CreateFontString(nil, "overlay", "GameFontNormal") + iconFrame.Desc:SetPoint("bottom", iconFrame, "top", 0, 2) + iconFrame.Desc:Hide() + + return iconFrame + end, + + GetIcon = function(self) + local iconFrame = self.IconPool[self.NextIcon] + + if (not iconFrame) then + local newIconFrame = self:CreateIcon("$parentIcon" .. self.NextIcon) + newIconFrame.parentIconRow = self + newIconFrame.Cooldown:SetHideCountdownNumbers(self.options.surpress_blizzard_cd_timer) + newIconFrame.Cooldown.noCooldownCount = self.options.surpress_tulla_omni_cc + + newIconFrame.CountdownText:ClearAllPoints() + newIconFrame.CountdownText:SetPoint(self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0) + newIconFrame.StackText:ClearAllPoints() + newIconFrame.StackText:SetPoint(self.options.stack_text_anchor or "center", iconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0) + newIconFrame.Desc:ClearAllPoints() + newIconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", iconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2) + + self.IconPool[self.NextIcon] = newIconFrame + iconFrame = newIconFrame + end + + iconFrame:ClearAllPoints() + + local anchor = self.options.anchor + local anchorTo = self.NextIcon == 1 and self or self.IconPool[self.NextIcon - 1] + local xPadding = self.NextIcon == 1 and self.options.left_padding or self.options.icon_padding or 1 + local growDirection = self.options.grow_direction + + if (growDirection == 1) then --grow to right + if (self.NextIcon == 1) then + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "left", xPadding, 0) + else + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "right", xPadding, 0) + end + + elseif (growDirection == 2) then --grow to left + if (self.NextIcon == 1) then + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "right", xPadding, 0) + else + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "left", xPadding, 0) + end + + end + + detailsFramework:SetFontColor(iconFrame.CountdownText, self.options.text_color) + + self.NextIcon = self.NextIcon + 1 + return iconFrame + end, + + --adds only if not existing already in the cache + AddSpecificIcon = function(self, identifierKey, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff) + if (not identifierKey or identifierKey == "") then + return + end + + if (not self.AuraCache[identifierKey]) then + local icon = self:SetIcon(spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff or false) + icon.identifierKey = identifierKey + self.AuraCache[identifierKey] = true + end + end, + + SetIcon = function(self, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff, modRate) + local actualSpellName, _, spellIcon = GetSpellInfo(spellId) + + if forceTexture then + spellIcon = forceTexture + end + + spellName = spellName or actualSpellName or "unknown_aura" + modRate = modRate or 1 + + if (spellIcon) then + local iconFrame = self:GetIcon() + iconFrame.Texture:SetTexture(spellIcon) + iconFrame.Texture:SetTexCoord(unpack(self.options.texcoord)) + + if (borderColor) then + iconFrame:SetBackdropBorderColor(detailsFramework:ParseColors(borderColor)) + else + iconFrame:SetBackdropBorderColor(0, 0, 0 ,0) + end + + if (startTime) then + CooldownFrame_Set(iconFrame.Cooldown, startTime, duration, true, true, modRate) + + if (self.options.show_text) then + iconFrame.CountdownText:Show() + + local now = GetTime() + + iconFrame.timeRemaining = (startTime + duration - now) / modRate + iconFrame.expirationTime = startTime + duration + + local formattedTime = (iconFrame.timeRemaining > 0) and self.options.decimal_timer and iconFrame.parentIconRow.FormatCooldownTimeDecimal(iconFrame.timeRemaining) or iconFrame.parentIconRow.FormatCooldownTime(iconFrame.timeRemaining) or "" + iconFrame.CountdownText:SetText(formattedTime) + + iconFrame.CountdownText:SetPoint(self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0) + detailsFramework:SetFontSize(iconFrame.CountdownText, self.options.text_size) + detailsFramework:SetFontFace (iconFrame.CountdownText, self.options.text_font) + detailsFramework:SetFontOutline (iconFrame.CountdownText, self.options.text_outline) + + if self.options.on_tick_cooldown_update then + iconFrame.lastUpdateCooldown = now + iconFrame:SetScript("OnUpdate", self.OnIconTick) + else + iconFrame:SetScript("OnUpdate", nil) + end + + else + iconFrame:SetScript("OnUpdate", nil) + iconFrame.CountdownText:Hide() + end + + iconFrame.Cooldown:SetReverse(self.options.cooldown_reverse) + iconFrame.Cooldown:SetDrawSwipe(self.options.cooldown_swipe_enabled) + iconFrame.Cooldown:SetEdgeTexture(self.options.cooldown_edge_texture) + iconFrame.Cooldown:SetHideCountdownNumbers(self.options.surpress_blizzard_cd_timer) + else + iconFrame.timeRemaining = nil + iconFrame.expirationTime = nil + iconFrame:SetScript("OnUpdate", nil) + iconFrame.CountdownText:Hide() + end + + if (descText and self.options.desc_text) then + iconFrame.Desc:Show() + iconFrame.Desc:SetText(descText.text) + iconFrame.Desc:SetTextColor(detailsFramework:ParseColors(descText.text_color or self.options.desc_text_color)) + iconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", iconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2) + detailsFramework:SetFontSize(iconFrame.Desc, descText.text_size or self.options.desc_text_size) + detailsFramework:SetFontFace(iconFrame.Desc, self.options.desc_text_font) + detailsFramework:SetFontOutline(iconFrame.Desc, self.options.desc_text_outline) + else + iconFrame.Desc:Hide() + end + + if (count and count > 1 and self.options.stack_text) then + iconFrame.StackText:Show() + iconFrame.StackText:SetText(count) + iconFrame.StackText:SetTextColor(detailsFramework:ParseColors(self.options.stack_text_color)) + iconFrame.StackText:SetPoint(self.options.stack_text_anchor or "center", iconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0) + detailsFramework:SetFontSize(iconFrame.StackText, self.options.stack_text_size) + detailsFramework:SetFontFace(iconFrame.StackText, self.options.stack_text_font) + detailsFramework:SetFontOutline(iconFrame.StackText, self.options.stack_text_outline) + else + iconFrame.StackText:Hide() + end + + PixelUtil.SetSize(iconFrame, self.options.icon_width, self.options.icon_height) + iconFrame:Show() + + --update the size of the frame + self:SetWidth((self.options.left_padding * 2) + (self.options.icon_padding * (self.NextIcon-2)) + (self.options.icon_width * (self.NextIcon - 1))) + self:SetHeight(self.options.icon_height + (self.options.top_padding * 2)) + + --make information available + iconFrame.spellId = spellId + iconFrame.startTime = startTime + iconFrame.duration = duration + iconFrame.count = count + iconFrame.debuffType = debuffType + iconFrame.caster = caster + iconFrame.canStealOrPurge = canStealOrPurge + iconFrame.isBuff = isBuff + iconFrame.spellName = spellName + + iconFrame.identifierKey = nil -- only used for "specific" add/remove + + --add the spell into the cache + self.AuraCache[spellId or -1] = true + self.AuraCache[spellName] = true + self.AuraCache.canStealOrPurge = self.AuraCache.canStealOrPurge or canStealOrPurge + self.AuraCache.hasEnrage = self.AuraCache.hasEnrage or debuffType == "" --yes, enrages are empty-string... + + --show the frame + self:Show() + + return iconFrame + end + end, + + OnIconTick = function(self, deltaTime) + local now = GetTime() + if (self.lastUpdateCooldown + 0.05) <= now then + self.timeRemaining = self.expirationTime - now + if self.timeRemaining > 0 then + if self.parentIconRow.options.decimal_timer then + self.CountdownText:SetText(self.parentIconRow.FormatCooldownTimeDecimal(self.timeRemaining)) + else + self.CountdownText:SetText(self.parentIconRow.FormatCooldownTime(self.timeRemaining)) + end + else + self.CountdownText:SetText("") + end + self.lastUpdateCooldown = now + end + end, + + FormatCooldownTime = function(formattedTime) + if (formattedTime >= 3600) then + formattedTime = math.floor(formattedTime / 3600) .. "h" + + elseif (formattedTime >= 60) then + formattedTime = math.floor(formattedTime / 60) .. "m" + + else + formattedTime = math.floor(formattedTime) + end + return formattedTime + end, + + FormatCooldownTimeDecimal = function(formattedTime) + if formattedTime < 10 then + return ("%.1f"):format(formattedTime) + + elseif formattedTime < 60 then + return ("%d"):format(formattedTime) + + elseif formattedTime < 3600 then + return ("%d:%02d"):format(formattedTime/60%60, formattedTime%60) + + elseif formattedTime < 86400 then + return ("%dh %02dm"):format(formattedTime/(3600), formattedTime/60%60) + + else + return ("%dd %02dh"):format(formattedTime/86400, (formattedTime/3600) - (math.floor(formattedTime/86400) * 24)) + end + end, + + RemoveSpecificIcon = function(self, identifierKey) + if (not identifierKey or identifierKey == "") then + return + end + + table.wipe(self.AuraCache) + + local iconPool = self.IconPool + local countStillShown = 0 + + for i = 1, self.NextIcon -1 do + local iconFrame = iconPool[i] + if (iconFrame.identifierKey and iconFrame.identifierKey == identifierKey) then + iconFrame:Hide() + iconFrame:ClearAllPoints() + iconFrame.identifierKey = nil + else + self.AuraCache[iconFrame.spellId] = true + self.AuraCache[iconFrame.spellName] = true + self.AuraCache.canStealOrPurge = self.AuraCache.canStealOrPurge or iconFrame.canStealOrPurge + self.AuraCache.hasEnrage = self.AuraCache.hasEnrage or iconFrame.debuffType == "" --yes, enrages are empty-string... + countStillShown = countStillShown + 1 + end + end + + self:AlignAuraIcons() + end, + + ClearIcons = function(self, resetBuffs, resetDebuffs) + resetBuffs = resetBuffs ~= false + resetDebuffs = resetDebuffs ~= false + table.wipe(self.AuraCache) + + local iconPool = self.IconPool + + for i = 1, self.NextIcon -1 do + local iconFrame = iconPool[i] + if (iconFrame.isBuff == nil) then + iconFrame:Hide() + iconFrame:ClearAllPoints() + + elseif (resetBuffs and iconFrame.isBuff) then + iconFrame:Hide() + iconFrame:ClearAllPoints() + + elseif (resetDebuffs and not iconFrame.isBuff) then + iconFrame:Hide() + iconFrame:ClearAllPoints() + + else + self.AuraCache[iconFrame.spellId] = true + self.AuraCache[iconFrame.spellName] = true + self.AuraCache.canStealOrPurge = self.AuraCache.canStealOrPurge or iconFrame.canStealOrPurge + self.AuraCache.hasEnrage = self.AuraCache.hasEnrage or iconFrame.debuffType == "" --yes, enrages are empty-string... + end + end + + self:AlignAuraIcons() + end, + + AlignAuraIcons = function(self) + local iconPool = self.IconPool + local iconAmount = #iconPool + local countStillShown = 0 + + table.sort(iconPool, function(i1, i2) return i1:IsShown() and not i2:IsShown() end) + + if iconAmount == 0 then + self:Hide() + else + --re-anchor not hidden + for i = 1, iconAmount do + local iconFrame = iconPool[i] + local anchor = self.options.anchor + local anchorTo = i == 1 and self or self.IconPool[i - 1] + local xPadding = i == 1 and self.options.left_padding or self.options.icon_padding or 1 + local growDirection = self.options.grow_direction + + countStillShown = countStillShown + (iconFrame:IsShown() and 1 or 0) + + iconFrame:ClearAllPoints() + if (growDirection == 1) then --grow to right + if (i == 1) then + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "left", xPadding, 0) + else + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "right", xPadding, 0) + end + elseif (growDirection == 2) then --grow to left + if (i == 1) then + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "right", xPadding, 0) + else + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "left", xPadding, 0) + end + end + end + end + + self.NextIcon = countStillShown + 1 + end, + + GetIconGrowDirection = function(self) + local side = self.options.anchor.side + + if (side == 1) then + return 1 + elseif (side == 2) then + return 2 + elseif (side == 3) then + return 1 + elseif (side == 4) then + return 1 + elseif (side == 5) then + return 2 + elseif (side == 6) then + return 1 + elseif (side == 7) then + return 2 + elseif (side == 8) then + return 1 + elseif (side == 9) then + return 1 + elseif (side == 10) then + return 1 + elseif (side == 11) then + return 2 + elseif (side == 12) then + return 1 + elseif (side == 13) then + return 1 + end + end, + + OnOptionChanged = function(self, optionName) + self:SetBackdropColor(unpack(self.options.backdrop_color)) + self:SetBackdropBorderColor(unpack(self.options.backdrop_border_color)) + end, +} + +local default_icon_row_options = { + icon_width = 20, + icon_height = 20, + texcoord = {.1, .9, .1, .9}, + show_text = true, + text_color = {1, 1, 1, 1}, + text_size = 12, + text_font = "Arial Narrow", + text_outline = "NONE", + text_anchor = "center", + text_rel_anchor = "center", + text_x_offset = 0, + text_y_offset = 0, + desc_text = true, + desc_text_color = {1, 1, 1, 1}, + desc_text_size = 7, + desc_text_font = "Arial Narrow", + desc_text_outline = "NONE", + desc_text_anchor = "bottom", + desc_text_rel_anchor = "top", + desc_text_x_offset = 0, + desc_text_y_offset = 2, + stack_text = true, + stack_text_color = {1, 1, 1, 1}, + stack_text_size = 10, + stack_text_font = "Arial Narrow", + stack_text_outline = "NONE", + stack_text_anchor = "center", + stack_text_rel_anchor = "bottomright", + stack_text_x_offset = 0, + stack_text_y_offset = 0, + left_padding = 1, --distance between right and left + top_padding = 1, --distance between top and bottom + icon_padding = 1, --distance between each icon + backdrop = {}, + backdrop_color = {0, 0, 0, 0.5}, + backdrop_border_color = {0, 0, 0, 1}, + anchor = {side = 6, x = 2, y = 0}, + grow_direction = 1, --1 = to right 2 = to left + surpress_blizzard_cd_timer = false, + surpress_tulla_omni_cc = false, + on_tick_cooldown_update = true, + decimal_timer = false, + cooldown_reverse = false, + cooldown_swipe_enabled = true, + cooldown_edge_texture = "Interface\\Cooldown\\edge", +} + +function detailsFramework:CreateIconRow(parent, name, options) + local newIconRowFrame = CreateFrame("frame", name, parent, "BackdropTemplate") + newIconRowFrame.IconPool = {} + newIconRowFrame.NextIcon = 1 + newIconRowFrame.AuraCache = {} + + detailsFramework:Mixin(newIconRowFrame, detailsFramework.IconMixin) + detailsFramework:Mixin(newIconRowFrame, detailsFramework.OptionsFunctions) + + newIconRowFrame:BuildOptionsTable(default_icon_row_options, options) + + newIconRowFrame:SetSize(newIconRowFrame.options.icon_width, newIconRowFrame.options.icon_height + (newIconRowFrame.options.top_padding * 2)) + + newIconRowFrame:SetBackdrop(newIconRowFrame.options.backdrop) + newIconRowFrame:SetBackdropColor(unpack(newIconRowFrame.options.backdrop_color)) + newIconRowFrame:SetBackdropBorderColor(unpack(newIconRowFrame.options.backdrop_border_color)) + + return newIconRowFrame +end \ No newline at end of file diff --git a/Libs/DF/load.xml b/Libs/DF/load.xml index 89bccc2a..b1bae6a3 100644 --- a/Libs/DF/load.xml +++ b/Libs/DF/load.xml @@ -32,6 +32,7 @@ +