diff --git a/SaftUI/SaftUI.xml b/SaftUI/SaftUI.xml index b345829..072e89f 100644 --- a/SaftUI/SaftUI.xml +++ b/SaftUI/SaftUI.xml @@ -12,6 +12,7 @@ <Script file="frames\killframes.lua"/> <Script file="frames\reparentframes.lua"/> <Script file="frames\moveframes.lua"/> + <Script file="frames\datatext.lua"/> <Script file="core\move.lua"/> <Script file="core\developer.lua"/> diff --git a/SaftUI/config/config.lua b/SaftUI/config/config.lua index 6295887..f66180b 100644 --- a/SaftUI/config/config.lua +++ b/SaftUI/config/config.lua @@ -1,44 +1,48 @@ local T, C, L = unpack(Tukui) -C.media.pixelfont = [=[Interface\Addons\SaftUI\SEMPRG__.TTF]=] -C.pFont = { C.media.pixelfont, 8, "MONOCHROMEOUTLINE" } +do + C.media.pixelfont = [=[Interface\Addons\SaftUI\SEMPRG__.TTF]=] + C.pFont = { C.media.pixelfont, 8, "MONOCHROMEOUTLINE" } +end -C["classbar"] = { - --["module"] = { enabled, width, height } - ["runeBars"] = { true, 256, 12 }, - ["eclipseBar"] = { true, 256, 12 }, - ["holyPower"] = { true, 256, 12 }, - ["comboPoints"] = { true, 256, 12 }, - ["totemTimers"] = { true, 256, 12 }, - ["fulmTracker"] = { true, 256, 12 }, - ["soulShards"] = { true, 256, 12 }, - ["arcaneBlast"] = { true, 256, 12 }, - ["thunderclap"] = { true, 256, 12 }, -} +do + C["classbar"] = { + --["module"] = { enabled, width, height } + ["runeBars"] = { true, 256, 12 }, + ["eclipseBar"] = { true, 256, 12 }, + ["holyPower"] = { true, 256, 12 }, + ["comboPoints"] = { true, 256, 12 }, + ["totemTimers"] = { true, 256, 12 }, + ["fulmTracker"] = { true, 256, 12 }, + ["soulShards"] = { true, 256, 12 }, + ["arcaneBlast"] = { true, 256, 12 }, + ["thunderclap"] = { true, 256, 12 }, + } +end ---UnitFrames To Show -C.unitframes.Units = { - ["player"] = { enable = true, width = 239, height = 39 }, - ["target"] = { enable = true, width = 239, height = 39 }, - ["pet"] = { enable = true, width = 160, height = 15 }, - ["targettarget"] = { enable = true, width = 160, height = 15 }, - ["focus"] = { enable = true, width = 160, height = 15 }, - ["focustarget"] = { enable = true, width = 160, height = 15 }, - ["arena"] = { enable = true, width = 239, height = 38 }, - ["boss"] = { enable = true, width = 239, height = 38 }, -} +do + --UnitFrames To Show + C.unitframes.Units = { + ["player"] = { enable = true, width = 239, height = 39 }, + ["target"] = { enable = true, width = 239, height = 39 }, + ["pet"] = { enable = true, width = 160, height = 15 }, + ["targettarget"] = { enable = true, width = 160, height = 15 }, + ["focus"] = { enable = true, width = 160, height = 15 }, + ["focustarget"] = { enable = true, width = 160, height = 15 }, + ["arena"] = { enable = true, width = 239, height = 38 }, + ["boss"] = { enable = true, width = 239, height = 38 }, + } + C.unitframes.Groups = { + ["TukuiRaidHealerGrid"] = { width = 47, height = 35 }, + ["TukuiRaidHealer15"] = { width = 239, height = 38 }, + ["TukuiRaid40"] = { width = 120, height = 12 }, + ["TukuiRaid25"] = { width = 120, height = 16 }, + } + C.unitframes.FlatBars = false + C.unitframes.statusbarcolor = { .3, .3, .3 } --used for unicolor + C.unitframes.fillAlpha = 1 + C.unitframes.rangeAlpha = 0.4 + C.unitframes.gridonly = true +end -C.unitframes.Groups = { - ["TukuiRaidHealerGrid"] = { width = 47, height = 35 }, - ["TukuiRaidHealer15"] = { width = 239, height = 38 }, - ["TukuiRaid40"] = { width = 120, height = 12 }, - ["TukuiRaid25"] = { width = 120, height = 16 }, -} - ---StatusBar Config -C.unitframes.FlatBars = false -C.unitframes.statusbarcolor = { .3, .3, .3 } --used for unicolor -C.unitframes.fillAlpha = 1 -C.unitframes.rangeAlpha = 0.4 - -C.unitframes.gridonly = true \ No newline at end of file +C.chat.rightLoot = true \ No newline at end of file diff --git a/SaftUI/core/functions.lua b/SaftUI/core/functions.lua index 1f24111..b7bc1e0 100644 --- a/SaftUI/core/functions.lua +++ b/SaftUI/core/functions.lua @@ -137,7 +137,7 @@ T.GetHealthColor = function(self, unit) r, g, b = c[1], c[2], c[3] else local c = T.UnitColor.class[select(2, UnitClass(unit))] - r, g, b = C[1], c[2], c[3] + r, g, b = c[1], c[2], c[3] end end diff --git a/SaftUI/frames/datatext.lua b/SaftUI/frames/datatext.lua new file mode 100644 index 0000000..e31e00c --- /dev/null +++ b/SaftUI/frames/datatext.lua @@ -0,0 +1,52 @@ +local T, C, L = unpack(Tukui) + +local datatext = { + "Guild", + "Friends", + "Gold", + "FPS", + "System", + "Bags", + "Gold", + "Time", + "Durability", + "Heal", + "Damage", + "Power", + "Haste", + "Crit", + "Avoidance", + "Armor", + "Currency", + "Hit", + "Mastery", + "MicroMenu", + "Regen", + "Talent", + "CallToArms", +} + +local function SkinDataText() + for _, dt in pairs(datatext) do + local stat = _G["TukuiStat"..dt.."Text"] + if stat then + stat:SetFont(T.GetPixelFont()) + end + end + + TukuiInfoLeft:SetBackdrop(nil) + TukuiInfoRight:SetBackdrop(nil) + TukuiInfoBackdrop = CreateFrame("Frame", "TukuiInfoBackdrop", UIParent) + TukuiInfoBackdrop:SetTemplate("Transparent") + TukuiInfoBackdrop:ThickBorder() + TukuiInfoBackdrop:SetPoint("TOPLEFT", TukuiInfoLeft) + TukuiInfoBackdrop:SetPoint("BOTTOMRIGHT", TukuiInfoRight) + TukuiInfoBackdrop:SetFrameStrata("BACKGROUND") + TukuiInfoBackdrop:SetFrameLevel(0) +end + +local OnLoad = CreateFrame("Frame") +OnLoad:RegisterEvent("PLAYER_ENTERING_WORLD") +OnLoad:SetScript("OnEvent", function() + SkinDataText() +end) \ No newline at end of file diff --git a/SaftUI/frames/killframes.lua b/SaftUI/frames/killframes.lua index 18bea70..be1b200 100644 --- a/SaftUI/frames/killframes.lua +++ b/SaftUI/frames/killframes.lua @@ -8,48 +8,14 @@ local frames = { TukuiInfoLeftLineVertical, TukuiInfoRightLineVertical, TukuiLineToPetActionBarBackground, - TukuiInfoLeft, - TukuiInfoRight, TukuiCubeLeft, TukuiCubeRight, - TukuiChatBackgroundRight, - TukuiTabsRightBackground, TukuiMinimapStatsLeft, TukuiMinimapStatsRight, TukuiExitVehicleButtonRight, TukuiInfoLeftBattleGround, } -local datatext = { - "Guild", - "Friends", - "Gold", - "FPS", - "System", - "Bags", - "Gold", - "Time", - "Durability", - "Heal", - "Damage", - "Power", - "Haste", - "Crit", - "Avoidance", - "Armor", - "Currency", - "Hit", - "Mastery", - "MicroMenu", - "Regen", - "Talent", - "CallToArms", -} - -for _, dt in pairs(datatext) do - tinsert(frames, _G["TukuiStat"..dt]) -end - for _, f in pairs(frames) do if f then f:Kill() end end diff --git a/SaftUI/frames/moveframes.lua b/SaftUI/frames/moveframes.lua index 293a766..511d0c2 100644 --- a/SaftUI/frames/moveframes.lua +++ b/SaftUI/frames/moveframes.lua @@ -1,7 +1,10 @@ local T, C, L = unpack(Tukui) local frames = { - ["TukuiRollAnchor"] = {"BOTTOM", TukuiChatBackgroundLeft or ChatFrame1, "TOP", 0, 5}, + ["TukuiRollAnchor"] = {"BOTTOM", TukuiChatBackgroundLeft or ChatFrame1, "TOP", 0, 5}, + ["TukuiInfoLeft"] = {"TOPLEFT", UIParent, "TOPLEFT", 6, -6}, + ["TukuiInfoRight"] = {"LEFT", TukuiInfoLeft, "RIGHT", 0, 0}, + ["TukuiTooltipAnchor"] = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0}, } local function FixVehicleButton() @@ -26,4 +29,16 @@ OnLoad:SetScript("OnEvent", function() FixVehicleButton() end) - +hooksecurefunc(Stuffing, "CreateBagFrame", function(self, w) + local f + print("Tukui" .. w) + if w == "Bank" then + f = TukuiBank + f:SetPoint("BOTTOMRIGHT", TukuiBags, "BOTTOMLEFT", -6, 0) + else + f = TukuiBags + f:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6) + end + f:SetTemplate("Transparent") + f:ThickBorder() +end) \ No newline at end of file diff --git a/SaftUI/modules/actionbars.lua b/SaftUI/modules/actionbars.lua index dfd56a6..67cb4f6 100644 --- a/SaftUI/modules/actionbars.lua +++ b/SaftUI/modules/actionbars.lua @@ -56,16 +56,11 @@ function T.GetActionButtons(query) return Buttons end + + local function style(self) local name = self:GetName() - --> fixing a taint issue while changing totem flyout button in combat. - if name:match("MultiCast") then return end - - --> don't skin the boss encounter extra button to match texture (4.3 patch) - --> http://www.tukui.org/storage/viewer.php?id=913811extrabar.jpg - if name:match("ExtraActionButton") then return end - local Count = _G[name.."Count"] local HotKey = _G[name.."HotKey"] local Border = _G[name.."Panel"] @@ -77,7 +72,7 @@ local function style(self) Border:AllPoints(self) Border:SetTemplate("Transparent") end -hooksecurefunc("ActionButton_Update", style) +hooksecurefunc(T, "StyleActionBarButton", style) function T.UpdateAllActionBars() if InCombatLockdown() then return end diff --git a/SaftUI/modules/chat - Copy.lua b/SaftUI/modules/chat - Copy.lua new file mode 100644 index 0000000..f7c57ab --- /dev/null +++ b/SaftUI/modules/chat - Copy.lua @@ -0,0 +1,218 @@ +local T, C, L = unpack(Tukui) + +local chatBGLeft = TukuiChatBackgroundLeft +local tabBGLeft = TukuiTabsLeftBackground +local chatBGRight = TukuiChatBackgroundRight +local tabBGRight = TukuiTabsRightBackground + +local function SetupChat(self) + self:UnregisterAllEvents() + + if C.chat.background == true then + tabBGLeft:ClearAllPoints() + tabBGLeft:SetPoint("TOPLEFT", chatBGLeft, "TOPLEFT", 6, -6) + tabBGLeft:SetPoint("TOPRIGHT", TukuiButtonCF1, "TOPLEFT", -4, 0) + tabBGLeft:SetHeight(16) + tabBGLeft:SetTemplate("Transparent") + tabBGLeft:ThickBorder() + + chatBGLeft:SetTemplate("Transparent") + chatBGLeft:ThickBorder() + chatBGLeft:SetMovable(true) + tinsert(T.AllowFrameMoving, chatBGLeft) + if not chatBGLeft:IsUserPlaced() then + chatBGLeft:ClearAllPoints() + chatBGLeft:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 6) + end + + if C.chat.rightLoot then + tabBGRight:ClearAllPoints() + tabBGRight:SetPoint("TOPLEFT", chatBGRight, "TOPLEFT", 6, -6) + tabBGRight:SetPoint("TOPRIGHT", TukuiButtonCF4, "TOPLEFT", -4, 0) + tabBGRight:SetHeight(16) + tabBGRight:SetTemplate("Transparent") + tabBGRight:ThickBorder() + + chatBGRight:SetTemplate("Transparent") + chatBGRight:ThickBorder() + chatBGRight:SetMovable(true) + tinsert(T.AllowFrameMoving, chatBGRight) + if not chatBGRight:IsUserPlaced() then + chatBGRight:ClearAllPoints() + chatBGRight:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6) + end + else + chatBGRight:Kill() + tabBGRight:Kill() + end + end + + for i = 1, NUM_CHAT_WINDOWS do + local frameName = format("ChatFrame%s", i) + local frame = _G[frameName] + local tab = _G[frameName.."Tab"] + local tabText = _G[frameName.."TabText"] + local ID = frame:GetID() + local copyButton = _G[format("TukuiButtonCF%s", i)] + local editbox = _G[frameName.."EditBox"] + + + editbox:ClearAllPoints() + if tabBGLeft then + editbox:AllPoints(tabBGLeft) + editbox:SetTemplate() + editbox:ThickBorder() + else + editbox:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 0, -2) + editbox:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", 0, -2) + end + TukuiChatchatEditBoxBackground:Kill() + + + copyButton:ClearAllPoints() + copyButton:SetPoint("TOPRIGHT", (i == 4 and chatBGRight or chatBGLeft) or frame, "TOPRIGHT", -6, -6) + copyButton:SetParent(frame) + copyButton:SetHeight(tabBGLeft and tabBGLeft:GetHeight() or 16) + copyButton:SetWidth(tabBGLeft and tabBGLeft:GetHeight() or 16) + copyButton:SetAlpha(C.chat.background and 1 or 0) + copyButton:SetScript("OnEnter", function(self) + if C.chat.background then + T.SetModifiedBackdrop(self) + else + self:SetAlpha(1) + end + end) + copyButton:SetScript("OnLeave", function(self) + if C.chat.background then + T.SetOriginalBackdrop(self) + else + self:SetAlpha(0) + end + end) + + if C.chat.background then + frame:ClearAllPoints() + frame:SetPoint("BOTTOMLEFT", chatBGLeft, "BOTTOMLEFT", 6, 6) + frame:SetPoint("TOPRIGHT", chatBGLeft, "TOPRIGHT", -6, -28) + end + + -- FCF_SetLocked(frame, 1) + if i==4 then + if C.chat.rightLoot then + FCF_DockFrame(frame) + else + FCF_UndockFrame(frame) + frame:ClearAllPoints() + frame:SetPoint("BOTTOMLEFT", chatBGRight, "BOTTOMLEFT", 6, 6) + frame:SetPoint("TOPRIGHT", chatBGRight, "TOPRIGHT", -6, -28) + frame:SetJustifyH("RIGHT") + end + end + + tabText:SetFont(unpack(C.pFont)) + tabText:SetShadowOffset(0, 0) + end + + if C.chat.background then + local ConfigFrame = CreateFrame("Frame", nil, chatBGLeft) + ConfigFrame:SetAllPoints(chatBGLeft) + ConfigFrame:AddEditBox("width", 30, 14, {"BOTTOMRIGHT", -6, 6}) + ConfigFrame.width:AddText("label", "Width", "RIGHT", ConfigFrame.width, "LEFT", -3, 0) + ConfigFrame:AddEditBox("height", 30, 14, {"BOTTOM", ConfigFrame.width, "TOP", 0, 4}) + ConfigFrame.height:AddText("label", "Height", "RIGHT", ConfigFrame.height, "LEFT", -3, 0) + ConfigFrame:Hide() + if SaftUISaved and SaftUISaved.Chat then + chatSaved = SaftUISaved.Chat + C.chat.width = chatSaved.width + C.chat.height = chatSaved.height + else + C.chat.width = floor(chatBGLeft:GetWidth()) + C.chat.height = floor(chatBGLeft:GetHeight()) + end + ConfigFrame:RegisterEvent("PLAYER_LOGOUT") + ConfigFrame:SetScript("OnEvent", function(self, event) + if event=="PLAYER_LOGOUT" then + if not SaftUISaved then SaftUISaved = {} end + if not SaftUISaved["Chat"] then SaftUISaved["Chat"] = {} end + chatSaved = SaftUISaved.Chat + chatSaved.width = C.chat.width + chatSaved.height = C.chat.height + end + end) + + ConfigFrame.width:SetText(format("%d", floor(C.chat.width))) + ConfigFrame.width:SetScript("OnEnterPressed", function(self) + self:ClearFocus() + if not tonumber(self:GetText()) then self:SetText(format("%d", floor(C.chat.width))) return end + local newChatWidth = tonumber(self:GetText()) + if newChatWidth > 500 then newChatWidth = 500; self:SetText("500") end + if newChatWidth < 200 then newChatWidth = 200; self:SetText("200") end + C.chat.width = newChatWidth + chatBGLeft:SetWidth(C.chat.width) + end) + ConfigFrame.height:SetText(C.chat.height) + ConfigFrame.height:SetScript("OnEnterPressed", function(self) + self:ClearFocus() + if not tonumber(self:GetText()) then self:SetText(C.chat.height) return end + local newChatHeight = tonumber(self:GetText()) + if newChatHeight > 300 then newChatHeight = 300; self:SetText("500") end + if newChatHeight < 50 then newChatHeight = 50; self:SetText("50") end + C.chat.height = newChatHeight + chatBGLeft:SetHeight(C.chat.height) + end) + + chatBGLeft:SetWidth(C.chat.width) + chatBGLeft:SetHeight(C.chat.height) + local enable = true + local function MoveUI() + if InCombatLockdown() then return end + if not chatBGLeft.moveText then chatBGLeft:AddText("moveText", "", "CENTER", 0, 1) end + + if enable then + chatBGLeft:SetTemplate("Transparent") + chatBGLeft:SetBackdropBorderColor(1, 0, 0) + chatBGLeft.moveText:SetText(chatBGLeft:GetName()) + chatBGLeft:SetFrameStrata("MEDIUM") + chatBGLeft:EnableMouse(true) + ConfigFrame:Show() + else + chatBGLeft:SetTemplate("Transparent") + chatBGLeft:ThickBorder() + tabBGLeft:SetTemplate("Transparent") + tabBGLeft:ThickBorder() + chatBGLeft.moveText:SetText("") + chatBGLeft:SetFrameStrata("BACKGROUND") + chatBGLeft:EnableMouse(false) + ConfigFrame:Hide() + end + + if enable then enable = false else enable = true end + end + hooksecurefunc(_G.SlashCmdList, "MOVING", MoveUI) + end +end + +local OnLoad = CreateFrame("Frame") +OnLoad:RegisterEvent("PLAYER_ENTERING_WORLD") +OnLoad:SetScript("OnEvent", SetupChat) + +local numlines = 1 +function FloatingChatFrame_OnMouseScroll(self, delta) + if delta < 0 then + if IsShiftKeyDown() then + self:ScrollToBottom() + else + for i=1, numlines do + self:ScrollDown() + end + end + elseif delta > 0 then + if IsShiftKeyDown() then + self:ScrollToTop() + else + for i=1, numlines do + self:ScrollUp() + end + end + end +end diff --git a/SaftUI/modules/chat.lua b/SaftUI/modules/chat.lua index 02e6ee5..287ce57 100644 --- a/SaftUI/modules/chat.lua +++ b/SaftUI/modules/chat.lua @@ -1,33 +1,62 @@ local T, C, L = unpack(Tukui) -local chatBG = TukuiChatBackgroundLeft -local tabBG = TukuiTabsLeftBackground +local leftBG = TukuiChatBackgroundLeft +local leftTabs = TukuiTabsLeftBackground +local rightBG = TukuiChatBackgroundRight +local rightTabs = TukuiTabsRightBackground -local function SetupChat(self) - self:UnregisterAllEvents() +local function UpdateChatSizes() + rightBG:SetSize(C.chat.rightWidth, C.chat.rightHeight) + leftBG:SetSize(C.chat.leftWidth, C.chat.leftHeight) +end + +local function SetupBackgrounds() + if not leftBG:IsUserPlaced() then + leftBG:ClearAllPoints() + leftBG:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 6) + end + leftTabs:ClearAllPoints() + leftTabs:SetPoint("TOPLEFT", leftBG, "TOPLEFT", 6, -6) + leftTabs:SetPoint("TOPRIGHT", TukuiButtonCF1, "TOPLEFT", -4, 0) + leftTabs:SetHeight(16) + leftTabs:SetTemplate("Transparent") + leftTabs:ThickBorder() - if tabBG then - tabBG:ClearAllPoints() - tabBG:SetPoint("TOPLEFT", chatBG, "TOPLEFT", 6, -6) - tabBG:SetPoint("TOPRIGHT", TukuiButtonCF1, "TOPLEFT", -4, 0) - tabBG:SetHeight(16) + tinsert(T.AllowFrameMoving, leftBG) + if C.chat.rightLoot then + tinsert(T.AllowFrameMoving, rightBG) + if not rightBG:IsUserPlaced() then + rightBG:ClearAllPoints() + rightBG:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -6, 6) + end + rightTabs:ClearAllPoints() + rightTabs:SetPoint("TOPLEFT", rightBG, "TOPLEFT", 6, -6) + rightTabs:SetPoint("TOPRIGHT", TukuiButtonCF4, "TOPLEFT", -4, 0) + rightTabs:SetHeight(16) + else + rightBG:Kill() + rightTabs:Kill() end + leftBG:SetMovable(true) + rightBG:SetMovable(true) - if chatBG then - chatBG:SetTemplate("Transparent") - chatBG:ThickBorder() - tabBG:SetTemplate("Transparent") - tabBG:ThickBorder() - - chatBG:SetMovable(true) - tinsert(T.AllowFrameMoving, chatBG) - - if not chatBG:IsUserPlaced() then - chatBG:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 6, 6) + if C.chat.background == true then + for _, frame in pairs({leftBG, rightBG, leftTabs, rightTabs}) do + if frame then + frame:SetTemplate("Transparent") + frame:ThickBorder() + end end + else + rightTabs:Kill() + leftTabs:Kill() + leftBG:SetBackdrop(nil) + rightBG:SetBackdrop(nil) end - +end + +local function PositionChatWindows() for i = 1, NUM_CHAT_WINDOWS do local frameName = format("ChatFrame%s", i) local frame = _G[frameName] @@ -37,10 +66,9 @@ local function SetupChat(self) local copyButton = _G[format("TukuiButtonCF%s", i)] local editbox = _G[frameName.."EditBox"] - editbox:ClearAllPoints() - if tabBG then - editbox:AllPoints(tabBG) + if C.chat.background then + editbox:AllPoints(leftTabs) editbox:SetTemplate() editbox:ThickBorder() else @@ -48,13 +76,21 @@ local function SetupChat(self) editbox:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", 0, -2) end TukuiChatchatEditBoxBackground:Kill() - - + copyButton:ClearAllPoints() - copyButton:SetPoint("TOPRIGHT", chatBG or frame, "TOPRIGHT", -6, -6) + if C.chat.background then + if i == 4 and C.chat.rightLoot then + copyButton:SetPoint("TOPRIGHT", rightBG, "TOPRIGHT", -6, -6) + else + copyButton:SetPoint("TOPRIGHT", leftBG, "TOPRIGHT", -6, -6) + end + else + copyButton:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -6, -6) + end + + copyButton:SetHeight(leftTabs:GetHeight()) + copyButton:SetWidth(leftTabs:GetHeight()) copyButton:SetParent(frame) - copyButton:SetHeight(tabBG and tabBG:GetHeight() or 16) - copyButton:SetWidth(tabBG and tabBG:GetHeight() or 16) copyButton:SetAlpha(C.chat.background and 1 or 0) copyButton:SetScript("OnEnter", function(self) if C.chat.background then @@ -71,98 +107,166 @@ local function SetupChat(self) end end) - if C.chat.background then - frame:ClearAllPoints() - frame:SetPoint("BOTTOMLEFT", chatBG, "BOTTOMLEFT", 6, 6) - frame:SetPoint("TOPRIGHT", chatBG, "TOPRIGHT", -6, -28) + local anchor = leftBG + if i==4 and C.chat.rightLoot then + anchor = rightBG + FCF_UnDockFrame(frame) + frame:SetJustifyH("RIGHT") + else + frame:SetJustifyH("LEFT") end + frame:ClearAllPoints() + frame:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", 6, 6) + frame:SetPoint("TOPRIGHT", anchor, "TOPRIGHT", -6, -28) - if i==4 then - FCF_SetLocked(frame, 1) - FCF_DockFrame(frame) - end tabText:SetFont(unpack(C.pFont)) tabText:SetShadowOffset(0, 0) end +end + +local function LoadConfig() + local leftConfig = CreateFrame("Frame", nil, leftBG) + leftConfig:SetAllPoints(leftBG) + leftConfig:AddEditBox("width", 30, 14, {"BOTTOMRIGHT", -6, 6}) + leftConfig.width:AddText("label", "Width", "RIGHT", leftConfig.width, "LEFT", -3, 0) + leftConfig:AddEditBox("height", 30, 14, {"BOTTOM", leftConfig.width, "TOP", 0, 4}) + leftConfig.height:AddText("label", "Height", "RIGHT", leftConfig.height, "LEFT", -3, 0) + leftConfig:Hide() + leftConfig.width:SetText(format("%d", floor(C.chat.leftWidth))) + leftConfig.width:SetScript("OnEnterPressed", function(self) + self:ClearFocus() + if not tonumber(self:GetText()) then self:SetText(format("%d", floor(C.chat.leftWidth))) return end + local newChatWidth = tonumber(self:GetText()) + if newChatWidth > 500 then newChatWidth = 500; self:SetText("500") end + if newChatWidth < 200 then newChatWidth = 200; self:SetText("200") end + C.chat.leftWidth = newChatWidth + UpdateChatSizes() + end) + leftConfig.height:SetText(C.chat.leftHeight) + leftConfig.height:SetScript("OnEnterPressed", function(self) + self:ClearFocus() + if not tonumber(self:GetText()) then self:SetText(C.chat.leftHeight) return end + local newChatHeight = tonumber(self:GetText()) + if newChatHeight > 300 then newChatHeight = 300; self:SetText("500") end + if newChatHeight < 50 then newChatHeight = 50; self:SetText("50") end + C.chat.leftHeight = newChatHeight + UpdateChatSizes() + end) - if C.chat.background then - local ConfigFrame = CreateFrame("Frame", nil, chatBG) - ConfigFrame:SetAllPoints(chatBG) - ConfigFrame:AddEditBox("width", 30, 14, {"BOTTOMRIGHT", -6, 6}) - ConfigFrame.width:AddText("label", "Width", "RIGHT", ConfigFrame.width, "LEFT", -3, 0) - ConfigFrame:AddEditBox("height", 30, 14, {"BOTTOM", ConfigFrame.width, "TOP", 0, 4}) - ConfigFrame.height:AddText("label", "Height", "RIGHT", ConfigFrame.height, "LEFT", -3, 0) - ConfigFrame:Hide() - if SaftUISaved and SaftUISaved.Chat then - chatSaved = SaftUISaved.Chat - C.chat.width = chatSaved.width - C.chat.height = chatSaved.height - else - C.chat.width = floor(chatBG:GetWidth()) - C.chat.height = floor(chatBG:GetHeight()) - end - ConfigFrame:RegisterEvent("PLAYER_LOGOUT") - ConfigFrame:SetScript("OnEvent", function(self, event) - if event=="PLAYER_LOGOUT" then - if not SaftUISaved then SaftUISaved = {} end - if not SaftUISaved["Chat"] then SaftUISaved["Chat"] = {} end - chatSaved = SaftUISaved.Chat - chatSaved.width = C.chat.width - chatSaved.height = C.chat.height - end - end) - - ConfigFrame.width:SetText(format("%d", floor(C.chat.width))) - ConfigFrame.width:SetScript("OnEnterPressed", function(self) + local rightConfig + if C.chat.rightLoot then + rightConfig = CreateFrame("Frame", nil, rightBG) + rightConfig:SetAllPoints(rightBG) + rightConfig:AddEditBox("width", 30, 14, {"BOTTOMRIGHT", -6, 6}) + rightConfig.width:AddText("label", "Width", "RIGHT", rightConfig.width, "LEFT", -3, 0) + rightConfig:AddEditBox("height", 30, 14, {"BOTTOM", rightConfig.width, "TOP", 0, 4}) + rightConfig.height:AddText("label", "Height", "RIGHT", rightConfig.height, "LEFT", -3, 0) + rightConfig:Hide() + rightConfig.width:SetText(format("%d", floor(C.chat.rightWidth))) + rightConfig.width:SetScript("OnEnterPressed", function(self) self:ClearFocus() - if not tonumber(self:GetText()) then self:SetText(format("%d", floor(C.chat.width))) return end + if not tonumber(self:GetText()) then self:SetText(format("%d", floor(C.chat.rightWidth))) return end local newChatWidth = tonumber(self:GetText()) if newChatWidth > 500 then newChatWidth = 500; self:SetText("500") end if newChatWidth < 200 then newChatWidth = 200; self:SetText("200") end - C.chat.width = newChatWidth - chatBG:SetWidth(C.chat.width) + C.chat.rightWidth = newChatWidth + UpdateChatSizes() end) - ConfigFrame.height:SetText(C.chat.height) - ConfigFrame.height:SetScript("OnEnterPressed", function(self) + rightConfig.height:SetText(C.chat.rightHeight) + rightConfig.height:SetScript("OnEnterPressed", function(self) self:ClearFocus() - if not tonumber(self:GetText()) then self:SetText(C.chat.height) return end + if not tonumber(self:GetText()) then self:SetText(C.chat.rightHeight) return end local newChatHeight = tonumber(self:GetText()) if newChatHeight > 300 then newChatHeight = 300; self:SetText("500") end if newChatHeight < 50 then newChatHeight = 50; self:SetText("50") end - C.chat.height = newChatHeight - chatBG:SetHeight(C.chat.height) + C.chat.rightHeight = newChatHeight + UpdateChatSizes() end) + end + local enable = false + local function MoveUI() + if InCombatLockdown() then return end + if not leftBG.moveText then leftBG:AddText("moveText", "", "CENTER", 0, 1) end + if not rightBG.moveText then rightBG:AddText("moveText", "", "CENTER", 0, 1) end + if enable then enable = false else enable = true end - chatBG:SetWidth(C.chat.width) - chatBG:SetHeight(C.chat.height) - local enable = true - local function MoveUI() - if InCombatLockdown() then return end - if not chatBG.moveText then chatBG:AddText("moveText", "", "CENTER", 0, 1) end + if enable then + leftBG:SetTemplate("Transparent") + leftBG:SetBackdropBorderColor(1, 0, 0) + leftBG.moveText:SetText(leftBG:GetName()) + leftBG:SetFrameStrata("MEDIUM") + leftBG:EnableMouse(true) + leftConfig:Show() - if enable then - chatBG:SetTemplate("Transparent") - chatBG:SetBackdropBorderColor(1, 0, 0) - chatBG.moveText:SetText(chatBG:GetName()) - chatBG:SetFrameStrata("MEDIUM") - chatBG:EnableMouse(true) - ConfigFrame:Show() + rightBG:SetTemplate("Transparent") + rightBG:SetBackdropBorderColor(1, 0, 0) + rightBG.moveText:SetText(rightBG:GetName()) + rightBG:SetFrameStrata("MEDIUM") + rightBG:EnableMouse(true) + rightConfig:Show() + else + if C.chat.background then + leftBG:SetTemplate("Transparent") + rightBG:SetTemplate("Transparent") else - chatBG:SetTemplate("Transparent") - chatBG:ThickBorder() - tabBG:SetTemplate("Transparent") - tabBG:ThickBorder() - chatBG.moveText:SetText("") - chatBG:SetFrameStrata("BACKGROUND") - chatBG:EnableMouse(false) - ConfigFrame:Hide() + leftBG:SetBackdrop(nil) + rightBG:SetBackdrop(nil) end + leftBG.moveText:SetText("") + leftBG:SetFrameStrata("BACKGROUND") + leftBG:EnableMouse(false) + leftConfig:Hide() - if enable then enable = false else enable = true end + rightBG.moveText:SetText("") + rightBG:SetFrameStrata("BACKGROUND") + rightBG:EnableMouse(false) + rightConfig:Hide() end - hooksecurefunc(_G.SlashCmdList, "MOVING", MoveUI) + + + end + hooksecurefunc(_G.SlashCmdList, "MOVING", MoveUI) +end + +local function RestoreSavedVariables() + if SaftUISaved and SaftUISaved.Chat then + chatSaved = SaftUISaved.Chat + C.chat.rightWidth = chatSaved.rightWidth or rightBG:GetWidth() + C.chat.rightHeight = chatSaved.rightHeight or rightBG:GetHeight() + C.chat.leftWidth = chatSaved.leftWidth or leftBG:GetWidth() + C.chat.leftHeight = chatSaved.leftHeight or leftBG:GetHeight() + else + C.chat.rightWidth = rightBG:GetWidth() + C.chat.rightHeight = rightBG:GetHeight() + C.chat.leftWidth = leftBG:GetWidth() + C.chat.leftHeight = leftBG:GetHeight() end + UpdateChatSizes() +end + + + +local function SaveVariables() + if not SaftUISaved then SaftUISaved = {} end + if not SaftUISaved["Chat"] then SaftUISaved["Chat"] = {} end + chatSaved = SaftUISaved.Chat + + chatSaved.rightWidth = C.chat.rightWidth + chatSaved.rightHeight = C.chat.rightHeight + chatSaved.leftWidth = C.chat.leftWidth + chatSaved.leftHeight = C.chat.leftHeight +end + +local function SetupChat(self) + self:UnregisterAllEvents() + RestoreSavedVariables() + SetupBackgrounds() + PositionChatWindows() + LoadConfig() + + self:RegisterEvent("PLAYER_LOGOUT") + self:SetScript("OnEvent", SaveVariables) end local OnLoad = CreateFrame("Frame") diff --git a/SaftUI/modules/unitframes/groups/general.lua b/SaftUI/modules/unitframes/groups/general.lua index a458672..c4ccd6e 100644 --- a/SaftUI/modules/unitframes/groups/general.lua +++ b/SaftUI/modules/unitframes/groups/general.lua @@ -6,6 +6,9 @@ local barTex = T.GetBarTexture() T.groupframefuncs["general"] = function(self) self:ThickBorder() + self:SetTemplate("Transparent") + + if self.Health.bg then self.Health.bg:Kill() end self.Health:ClearAllPoints() self.Health:AllPoints(self, 2) diff --git a/SaftUI/modules/unitframes/oUF.lua b/SaftUI/modules/unitframes/oUF.lua index a824f61..3426b0b 100644 --- a/SaftUI/modules/unitframes/oUF.lua +++ b/SaftUI/modules/unitframes/oUF.lua @@ -3,23 +3,6 @@ if not C.unitframes.enable then return end local oUF = oUFTukui or oUF ------------------------------------------------------------------ --- Change oUF Colors ----------------------------------------------- ------------------------------------------------------------------- - -oUF.colors.power["MANA"] = {0/255, 170/255, 255/255} - -oUF.colors.reaction = { - [1] = { 155/255, 55/255, 55/255 }, - [2] = { 155/255, 55/255, 55/255 }, - [3] = { 155/255, 55/255, 55/255 }, - [4] = { 155/255, 155/255, 55/255 }, - [5] = { 55/255, 155/255, 55/255 }, - [6] = { 55/255, 155/255, 55/255 }, - [7] = { 55/255, 155/255, 55/255 }, - [8] = { 55/255, 155/255, 55/255 }, -} - ------------------------------------------------------------------- -- Custom oUF Tags ----------------------------------------------- ------------------------------------------------------------------ diff --git a/SaftUI/modules/unitframes/units/target.lua b/SaftUI/modules/unitframes/units/target.lua index 08fca47..03dfab0 100644 --- a/SaftUI/modules/unitframes/units/target.lua +++ b/SaftUI/modules/unitframes/units/target.lua @@ -39,18 +39,18 @@ T.unitframefuncs["TukuiTarget"] = function(self) f:SetHeight(f.size) end buffs:ClearAllPoints() - buffs:SetPoint("BOTTOMRIGHT", self.Health, "TOPRIGHT", 0, 5) + buffs:SetPoint("BOTTOMRIGHT", health, "TOPRIGHT", 0, 5) debuffs:ClearAllPoints() debuffs:SetPoint("BOTTOM", buffs, "TOP", 0, buffs.spacing) end - if self.Castbar and self.Castbar.button then - self.Castbar.button:ClearAllPoints() - self.Castbar.button:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 2, -5) - self.Castbar.button:ThickBorder() - self.Castbar.button.shadow:Kill() - local size = self.Castbar:GetHeight()+self.Power:GetHeight()+11 - self.Castbar.button:SetSize(size, size) + if castbar and castbar.button then + castbar.button:ClearAllPoints() + castbar.button:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT", 2, -5) + castbar.button:ThickBorder() + castbar.button.shadow:Kill() + local size = castbar:GetHeight()+power:GetHeight()+11 + castbar.button:SetSize(size, size) end T.KillClassBars(self) diff --git a/SaftUI/modules/unitframes/units/targettarget.lua b/SaftUI/modules/unitframes/units/targettarget.lua index 7a69df9..37c7584 100644 --- a/SaftUI/modules/unitframes/units/targettarget.lua +++ b/SaftUI/modules/unitframes/units/targettarget.lua @@ -6,19 +6,19 @@ T.unitframefuncs["TukuiTargetTarget"] = function(self) local enabled, width, height = T.GetUnitConfig("targettarget") local health = self.Health - local panel = self.panel - local nameText = self.Name + local power = self.Power local castbar = self.Castbar + local nameText = self.Name health:ClearAllPoints() health:AllPoints(self, 2) - if self.Power then self.Power:Kill() end + if power then power:Kill() end if castbar then castbar:Kill() end - self.Name:ClearAllPoints() - self.Name:SetPoint("LEFT", health, "LEFT", 5, 0) - self:Tag(self.Name, '[st:nameshort] [Tukui:diffcolor][level] [shortclassification]') + nameText:ClearAllPoints() + nameText:SetPoint("LEFT", health, "LEFT", 5, 0) + self:Tag(nameText, '[Tukui:namelong] [Tukui:diffcolor][st:level]') self:AddDetail(10, height, "RIGHT", self, "LEFT", -3, 0) -- self:CreateAuraTracker(height, "RIGHT", self.Detail, "LEFT", -3, 0)