04-26-08, 11:22 AM | #1 |
Cleaning up code
I'm working on my addon called Urk UI again, and I'm looking for some help cleaning up the code for it. The first thing i want to do is clean up the code that discplays the art.
Here it is: Code:
local UrkChatl = CreateFrame("Frame",nil,UIParent) UrkChatl:SetFrameStrata("LOW") UrkChatl:SetWidth(341.5) -- Set These to whatever height/width is needed UrkChatl:SetHeight(341.5) -- for your Texture local a = UrkChatl:CreateTexture(nil,"LOW") a:SetTexture("Interface\\AddOns\\Urk\\Custom\\chatl.tga") a:SetAllPoints(UrkChatl) UrkChatl.texture = a UrkChatl:SetPoint("BOTTOMLEFT",0,0) UrkChatl:Show() local UrkMainl = CreateFrame("Frame",nil,UIParent) UrkMainl:SetFrameStrata("LOW") UrkMainl:SetWidth(341.5) UrkMainl:SetHeight(341.5) local b = UrkMainl:CreateTexture(nil,"LOW") b:SetTexture("Interface\\AddOns\\Urk\\Custom\\mainl.tga") b:SetAllPoints(UrkMainl) UrkMainl.texture = b UrkMainl:SetPoint("BOTTOMLEFT",341.5,0) UrkMainl:Show() local UrkMainr = CreateFrame("Frame",nil,UIParent) UrkMainr:SetFrameStrata("LOW") UrkMainr:SetWidth(341.5) UrkMainr:SetHeight(341.5) local c = UrkMainr:CreateTexture(nil,"LOW") c:SetTexture("Interface\\AddOns\\Urk\\Custom\\mainr.tga") c:SetAllPoints(UrkMainr) UrkMainr.texture = c UrkMainr:SetPoint("BOTTOMRIGHT",-341.5,0) UrkMainr:Show() local UrkChatr = CreateFrame("Frame",nil,UIParent) UrkChatr:SetFrameStrata("LOW") UrkChatr:SetWidth(341.5) UrkChatr:SetHeight(341.5) local d = UrkChatr:CreateTexture(nil,"LOW") d:SetTexture("Interface\\AddOns\\Urk\\Custom\\chatr.tga") d:SetAllPoints(UrkChatr) UrkChatr.texture = d UrkChatr:SetPoint("BOTTOMRIGHT",0,0) UrkChatr:Show() local UrkTopl = CreateFrame("Frame",nil,UIParent) UrkTopl:SetFrameStrata("MEDIUM") UrkTopl:SetWidth(341.5) UrkTopl:SetHeight(341.5) local e = UrkTopl:CreateTexture(nil,"MEDIUM") e:SetTexture("Interface\\AddOns\\Urk\\Custom\\topl.tga") e:SetAllPoints(UrkTopl) UrkTopl.texture = e UrkTopl:SetPoint("TOPLEFT",48,0) UrkTopl:Show() local UrkTop = CreateFrame("Frame",nil,UIParent) UrkTop:SetFrameStrata("MEDIUM") UrkTop:SetWidth(341.5) UrkTop:SetHeight(341.5) local f = UrkTop:CreateTexture(nil,"MEDIUM") f:SetTexture("Interface\\AddOns\\Urk\\Custom\\top.tga") f:SetAllPoints(UrkTop) UrkTop.texture = f UrkTop:SetPoint("TOPLEFT",361.5,0) UrkTop:Show() local UrkTopt = CreateFrame("Frame",nil,UIParent) UrkTopt:SetFrameStrata("MEDIUM") UrkTopt:SetWidth(341.5) UrkTopt:SetHeight(341.5) local g = UrkTopt:CreateTexture(nil,"MEDIUM") g:SetTexture("Interface\\AddOns\\Urk\\Custom\\top.tga") g:SetAllPoints(UrkTopt) UrkTopt.texture = g UrkTopt:SetPoint("TOPRIGHT",-361.5,0) UrkTopt:Show() local UrkTopr = CreateFrame("Frame",nil,UIParent) UrkTopr:SetFrameStrata("MEDIUM") UrkTopr:SetWidth(341.5) UrkTopr:SetHeight(341.5) local h = UrkTopr:CreateTexture(nil,"MEDIUM") h:SetTexture("Interface\\AddOns\\Urk\\Custom\\topr.tga") h:SetAllPoints(UrkTopr) UrkTopr.texture = h UrkTopr:SetPoint("TOPRIGHT",-48,0) UrkTopr:Show() local UrkSidel = CreateFrame("Frame",nil,UIParent) UrkSidel:SetFrameStrata("BACKGROUND") UrkSidel:SetWidth(341.5) UrkSidel:SetHeight(341.5) local i = UrkSidel:CreateTexture(nil,"BACKGROUND") i:SetTexture("Interface\\AddOns\\Urk\\Custom\\sidel.tga") i:SetAllPoints(UrkSidel) UrkSidel.texture = i UrkSidel:SetPoint("TOPLEFT",48,-109.5) UrkSidel:Show() local UrkSidel2 = CreateFrame("Frame",nil,UIParent) UrkSidel2:SetFrameStrata("BACKGROUND") UrkSidel2:SetWidth(341.5) UrkSidel2:SetHeight(341.5) local j = UrkSidel2:CreateTexture(nil,"BACKGROUND") j:SetTexture("Interface\\AddOns\\Urk\\Custom\\sidel.tga") j:SetAllPoints(UrkSidel2) UrkSidel2.texture = j UrkSidel2:SetPoint("TOPLEFT",48,-451) UrkSidel2:Show() local UrkSidel3 = CreateFrame("Frame",nil,UIParent) UrkSidel3:SetFrameStrata("BACKGROUND") UrkSidel3:SetWidth(341.5) UrkSidel3:SetHeight(341.5) local k = UrkSidel3:CreateTexture(nil,"BACKGROUND") k:SetTexture("Interface\\AddOns\\Urk\\Custom\\sidel.tga") k:SetAllPoints(UrkSidel3) UrkSidel3.texture = k UrkSidel3:SetPoint("TOPLEFT",48,-792.5) UrkSidel3:Show() local UrkSider = CreateFrame("Frame",nil,UIParent) UrkSider:SetFrameStrata("BACKGROUND") UrkSider:SetWidth(341.5) UrkSider:SetHeight(341.5) local l = UrkSider:CreateTexture(nil,"BACKGROUND") l:SetTexture("Interface\\AddOns\\Urk\\Custom\\sider.tga") l:SetAllPoints(UrkSider) UrkSider.texture = i UrkSider:SetPoint("TOPRIGHT",-48,-109.5) UrkSider:Show() local UrkSider2 = CreateFrame("Frame",nil,UIParent) UrkSider2:SetFrameStrata("BACKGROUND") UrkSider2:SetWidth(341.5) UrkSider2:SetHeight(341.5) local m = UrkSider2:CreateTexture(nil,"BACKGROUND") m:SetTexture("Interface\\AddOns\\Urk\\Custom\\sider.tga") m:SetAllPoints(UrkSider2) UrkSider2.texture = m UrkSider2:SetPoint("TOPRIGHT",-48,-451) UrkSider2:Show() local UrkSider3 = CreateFrame("Frame",nil,UIParent) UrkSider3:SetFrameStrata("BACKGROUND") UrkSider3:SetWidth(341.5) UrkSider3:SetHeight(341.5) local n = UrkSider3:CreateTexture(nil,"BACKGROUND") n:SetTexture("Interface\\AddOns\\Urk\\Custom\\sider.tga") n:SetAllPoints(UrkSider3) UrkSider3.texture = n UrkSider3:SetPoint("TOPRIGHT",-48,-792.5) UrkSider3:Show() local UrkFocus = CreateFrame("Frame",nil,UIParent) UrkFocus:SetFrameStrata("BACKGROUND") UrkFocus:SetWidth(341.5) UrkFocus:SetHeight(341.5) local o = UrkFocus:CreateTexture(nil,"LOW") o:SetTexture("Interface\\AddOns\\Urk\\Custom\\focus.tga") o:SetAllPoints(UrkFocus) UrkFocus.texture = o UrkFocus:SetPoint("BOTTOM",70,16) UrkFocus:Show() local UrkTot = CreateFrame("Frame",nil,UIParent) UrkTot:SetFrameStrata("BACKGROUND") UrkTot:SetWidth(341.5) UrkTot:SetHeight(341.5) local p = UrkTot:CreateTexture(nil,"LOW") p:SetTexture("Interface\\AddOns\\Urk\\Custom\\tot.tga") p:SetAllPoints(UrkTot) UrkTot.texture = p UrkTot:SetPoint("BOTTOM",-70,16) UrkTot:Show() local UrkMe = CreateFrame("Frame",nil,UIParent) UrkMe:SetFrameStrata("BACKGROUND") UrkMe:SetWidth(341.5) UrkMe:SetHeight(341.5) local q = UrkMe:CreateTexture(nil,"BACKGROUND") q:SetTexture("Interface\\AddOns\\Urk\\Custom\\me.tga") q:SetAllPoints(UrkMe) UrkMe.texture = q UrkMe:SetPoint("BOTTOM",0,-14) UrkMe:Show() local UrkParty1 = CreateFrame("Frame",nil,UIParent) UrkParty1:SetFrameStrata("MEDIUM") UrkParty1:SetWidth(366) UrkParty1:SetHeight(366) local r = UrkParty1:CreateTexture(nil,"MEDIUM") r:SetTexture("Interface\\AddOns\\Urk\\Custom\\party.tga") r:SetAllPoints(UrkParty1) UrkParty1.texture = r UrkParty1:SetPoint("TOPLEFT",88,-15) UrkParty1:Show() --toggle arts --thanks to Slakah@wowinterface local OnShow = DUF_FocusFrame:GetScript("OnShow") DUF_FocusFrame:SetScript("OnShow", function(...) UrkFocus:Show() return OnShow(...) end) local OnHide = DUF_FocusFrame:GetScript("OnHide") DUF_FocusFrame:SetScript("OnHide", function(...) UrkFocus:Hide() return OnHide(...) end) local OnShow = DUF_TargetOfTargetFrame:GetScript("OnShow") DUF_TargetOfTargetFrame:SetScript("OnShow", function(...) UrkTot:Show() return OnShow(...) end) local OnHide = DUF_TargetOfTargetFrame:GetScript("OnHide") DUF_TargetOfTargetFrame:SetScript("OnHide", function(...) UrkTot:Hide() return OnHide(...) end) Thanks for any help.
__________________
Funtoo - Plan 9 - Windows 7 |
|
WoWInterface » Developer Discussions » Lua/XML Help » Cleaning up code |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|