vrtc / chorus (public) (License: CC0) (since 2023-08-12) (hash sha1)
World of Warcraft add-on stub. The overall goal is to create a specialized raid frame.

/src/ChorusFrame.lua (8ddb83a287b3a264fd0a1de0aaa73a2032604c24) (1848 bytes) (mode 100644) (type blob)

--[[--
@submodule chorus
]]

local UIParent = UIParent

local Chorus = Chorus

local function runeFrame()
	local x = ((ChorusPlayerFrame:GetWidth() or 0) - (RuneFrame:GetWidth() or 0)) / 2
	local y = -60
	RuneFrame:SetPoint('TOPLEFT', ChorusPlayerFrame, 'TOPLEFT', x, y)
	RuneFrame:SetPoint('CENTER', ChorusPlayerFrame, 'CENTER', 0, 0)
end

local function disableNativeFrames()
	local t = {
		FocusFrame,
		PlayerFrame,
		TargetFrame,
		PartyMemberFrame1,
		PartyMemberFrame2,
		PartyMemberFrame3,
		PartyMemberFrame4,
		PartyMemberBackground,
	}
	local i = 0
	while (i < #t) do
		i = i + 1
		local e = t[i]
		if e then
			e:UnregisterAllEvents()
			e:SetScript('OnEvent', nil)
			e:SetScript('OnUpdate', nil)
			e:SetScript('OnShow', function(self1)
				self1:Hide()
			end)
			e:SetScript('OnHide', nil)
			e:Hide()
		end
	end

	runeFrame()
end

local function applyLayout(self)
	assert(self ~= nil)
	assert(UIParent ~= nil)

	self:UnregisterAllEvents();
	self:SetScript('OnEvent', nil)

	ChorusPlayerFrameHealthFrame.strategy = 'UnitClass'
	ChorusFocusFrameHealthFrame.strategy = 'UnitIsFriend'
	ChorusFocusFrameUnitNameFrame.strategy = 'UnitClass'

	ChorusTargetFrameHealthFrame.strategy = 'UnitIsFriend'
	ChorusTargetFrameUnitNameFrame.strategy = 'UnitClass'

end

--[[--
`ChorusFrame` is a concrete (not virtual tempalte) frame instance, that
orchestrates all over frames.

`ChorusFrame` is effectively a singleton.

@function chorusFrameMain
@tparam fram self
]]
local function chorusFrameMain(self)
	--[[ Wait for the game to finish loading completely, only then apply
	changes. ]]--

	self:SetScript('OnEvent', function(self0)
		applyLayout(self0)
		disableNativeFrames()
	end)

	self:RegisterEvent('PLAYER_ENTERING_WORLD');
	self:RegisterEvent('PLAYER_LOGIN');
end

Chorus.chorusFrameMain = function(...)
	return chorusFrameMain(...)
end


Mode Type Size Ref File
100644 blob 35 5c40e6e2862d70b5c51c326a13073a4012ac05c7 .gitignore
100644 blob 3606 f73da473168d1897963fd2e32d89841ca0461ec0 README.adoc
040000 tree - 271296b4bafcaa151458a0192fd313641ca9b409 bin
100644 blob 228 c7dd24afa7d5c2375ff60a91c73623a304b808f9 chorus.toc
040000 tree - 99c99c3cbc641f8954a5be291e61681cb5e74629 conf
040000 tree - efa7258757edf7b888ea13c215e14b497fef8a16 doc
100644 blob 2391 1b0ca1bc25f74a34476360e5a8f14e28767b204e makefile
040000 tree - b9d3ea9d61b99ee71b5fcdbc6b18843df20c8c3c src
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/chorus

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/chorus

Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/chorus

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main