View Single Post
11-05-14, 05:25 AM   #28
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
FrameXML/Cooldown.xml has the corresponding template.

But in that template is no FontString described.

So here is the button from the InterfaceOptionPanels.xml

Code:
			<CheckButton name="$parentCountdownCooldowns" inherits="InterfaceOptionsCheckButtonTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentSecureAbilityToggle" relativePoint="BOTTOMLEFT" x="0" y="-8"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						self.type = CONTROLTYPE_CHECKBOX;
						self.cvar = "countdownForCooldowns";
						BlizzardOptionsPanel_RegisterControl(self, self:GetParent());
					</OnLoad>
				</Scripts>
			</CheckButton>
In the Lua: countdownForCooldowns = "COUNTDOWN_FOR_COOLDOWNS_TEXT"
Problem is. That CVAR is nowhere being used. Thus I assume it is added C-side?!

But we could try parsing the button regions.
lua Code:
  1. local function CheckRegions(f)
  2.   for _, child in pairs({ f:GetChildren() }) do
  3.     CheckRegions(child)
  4.   end
  5.   for _, region in pairs({ f:GetRegions() }) do
  6.     print("region",region:GetName(),region:GetObjectType())
  7.   end
  8. end
  9.  
  10. CheckRegions(ActionButton1)

macro
Code:
/run local function CR(f) for _,c in pairs({f:GetChildren()}) do CR(c) end for _,r in pairs({f:GetRegions()}) do print("region",r:GetName(),r:GetObjectType()) end end; CR(ActionButton1)
Ok I got it. macro
Code:
/run local function CR(f) for _,c in pairs({f:GetChildren()}) do CR(c) end for _,r in pairs({f:GetRegions()}) do if r:GetObjectType() == "FontString" then print("region",r:GetName(),r:GetFont(),r:GetText()) end end end; CR(ActionButton1)
I ran a cooldown on button1 and there is a fontstring that has no name. But the text it is spitting out is exactly my cooldown.


If you disable the interface option the font string is still there.

I checked the child name. So the child that is inheriting the fontstring is _G["ActionButton1Cooldown"]. Easy as that. Parse over all actionbutton cooldowns and track down that fontstring. Actionally making it accessable via key would be best. Actionbuttons have a key for the cooldown child: Actionbutton1.cooldown would be your cooldown frame.

Tested it. It is working properly.

Lua Code:
  1. local bu = ActionButton1
  2.     for _, region in next, {bu.cooldown:GetRegions()} do
  3.       if region:GetObjectType() == "FontString" then
  4.         bu.cooldown.cooldownText = region      
  5.       end
  6.     end
  7.     bu.cooldown.cooldownText:SetFont(cfg.font, cfg.hotkeys.fontsize, "OUTLINE")

Btw. Tuller is hooking OnSizeChanced on the cooldown and adjusts the size of the cooldown text based on button size/scale. Pretty important if your cooldowns on buffs become huge.

I would still use OmniCC/tullaCC any day long instead.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 11-05-14 at 06:25 AM.
  Reply With Quote