/TelUI_AddonSkins/skins/Quartz.lua

http://github.com/Asphyxia/Tukui · Lua · 78 lines · 51 code · 9 blank · 18 comment · 5 complexity · 23b3cc20c6134987894e7736eee28b0a MD5 · raw file

  1. local T, C, L = unpack(Tukui) -- Import: T - functions, constants, variables; C - config; L - locales
  2. --[[
  3. Quartz3 skin by Darth Android / Telroth-The Venture Co.
  4. Todo:
  5. + Remove useless options
  6. (C)2010 Darth Android / Telroth-The Venture Co.
  7. File version v91.109
  8. ]]
  9. if not Mod_AddonSkins or not IsAddOnLoaded("Quartz") then return end
  10. local Q3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
  11. if not Q3 then return end
  12. Mod_AddonSkins:RegisterSkin("Quartz",function(Skin, skin, Layout, layout, config)
  13. -- Skin and Layout overrides
  14. Skin.SkinQuartzBar = function(self, bar)
  15. self:SkinFrame(bar)
  16. -- Skin Icon
  17. if not bar.IconBorder then
  18. -- Can't skin a texture, so we create a frame for this
  19. bar.IconBorder = CreateFrame("Frame",nil,bar)
  20. self:SkinBackgroundFrame(bar.IconBorder)
  21. bar.IconBorder:SetPoint("TOPLEFT",bar.Icon,"TOPLEFT",-config.borderWidth,config.borderWidth)
  22. bar.IconBorder:SetPoint("BOTTOMRIGHT",bar.Icon,"BOTTOMRIGHT",config.borderWidth,-config.borderWidth)
  23. bar.IconBorder:SetFrameStrata("LOW")
  24. end
  25. if bar.config.hideicon then
  26. bar.IconBorder:Hide()
  27. else
  28. bar.IconBorder:Show()
  29. end
  30. -- Fonts
  31. bar.Text:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
  32. bar.TimeText:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
  33. -- Bar Texture
  34. bar.Bar:SetStatusBarTexture(C.media.normTex)
  35. end
  36. Layout.PositionQuartzBar = dummy
  37. -- Hook Bar Template
  38. local template = Q3.CastBarTemplate.template
  39. template.ApplySettings_ = template.ApplySettings
  40. template.ApplySettings = function (self)
  41. self:ApplySettings_()
  42. self:SetWidth(self.config.w + config.borderWidth * 2)
  43. self:SetHeight(self.config.h + config.borderWidth * 2)
  44. skin:SkinQuartzBar(self)
  45. self.Bar:SetFrameStrata("HIGH")
  46. self:SetFrameStrata("HIGH")
  47. end
  48. -- Hook spellcasts to reskin after the shield disrupts it.
  49. template.UNIT_SPELLCAST_NOT_INTERRUPTIBLE_ = template.UNIT_SPELLCAST_NOT_INTERRUPTIBLE
  50. template.UNIT_SPELLCAST_NOT_INTERRUPTIBLE = function(self, event, unit)
  51. self:UNIT_SPELLCAST_NOT_INTERRUPTIBLE_(event, unit)
  52. skin:SkinQuartzBar(self)
  53. end
  54. template.UNIT_SPELLCAST_START_ = template.UNIT_SPELLCAST_START
  55. template.UNIT_SPELLCAST_START = function(self, event, unit)
  56. self:UNIT_SPELLCAST_START_(event, unit)
  57. skin:SkinQuartzBar(self)
  58. end
  59. -- Fix for uninterruptable channeled casts - Provided by Caulk on the TukUI forums.
  60. template.UNIT_SPELLCAST_CHANNEL_START_ = template.UNIT_SPELLCAST_CHANNEL_START
  61. template.UNIT_SPELLCAST_CHANNEL_START = function(self, event, unit)
  62. self:UNIT_SPELLCAST_CHANNEL_START_(event, unit)
  63. skin:SkinQuartzBar(self)
  64. end
  65. -- Force updates
  66. Q3:ApplySettings()
  67. end)