Commit 8051b72c authored by Darth Predator's avatar Darth Predator
Browse files

Movable frames improvement.

This closes #41
parent b88c69fd
......@@ -63,7 +63,11 @@ V["sle"] = {
["module"] = {
["screensaver"] = false,
["blizzmove"] = true,
["blizzmove"] = {
["enable"] = true,
["remember"] = false,
["points"] = {},
},
["shadows"] = {
["vehicle"] = false,
["player"] = false,
......
......@@ -273,6 +273,8 @@ L["Apply transparent template on bag and bank slots."] = true
--Blizzard
L["Move Blizzard frames"] = true
L["Allow some Blizzard frames to be moved around."] = true
L["Remember"] = true
L["Remember positions of frames after moving them."] = true
L["Pet Battles skinning"] = true
L["Make some elements of pet battles movable via toggle anchors."] = true
L["Vehicle Seat Scale"] = true
......
......@@ -264,6 +264,8 @@ L["Apply transparent template on bag and bank slots."] = "Wendet die Transparent
--Blizzard
L["Move Blizzard frames"] = "Bewege Blizzard Fenster"
L["Allow some Blizzard frames to be moved around."] = "Erlaubt das Bewegen einiger Blizzard Fenster"
L["Remember"] = true
L["Remember positions of frames after moving them."] = true
L["Pet Battles skinning"] = "Haustierkampf Skin"
L["Make some elements of pet battles movable via toggle anchors."] = "Erlaubt das Verschieben einiger Haustierkampf Elemente via Anker umschalten."
L["Vehicle Seat Scale"] = "Fahrzeugsanzeige Skallierung"
......
......@@ -261,6 +261,8 @@ L["Apply transparent template on bag and bank slots."] = "Использоват
--Blizzard
L["Move Blizzard frames"] = "Перемещение фреймов Blizzard"
L["Allow some Blizzard frames to be moved around."] = "Разрешить перемещение некоторых фреймов Blizzard."
L["Remember"] = "Запомнить"
L["Remember positions of frames after moving them."] = "Запомнить позицию фрейма после перемещения."
L["Pet Battles skinning"] = "Скин битв питомцев"
L["Make some elements of pet battles movable via toggle anchors."] = "Дает возможность перемещать некоторые элементы боев питомцев при пмощи фиксаторов."
L["Vehicle Seat Scale"] = "Масштаб фрейма транспорта."
......
......@@ -11,12 +11,17 @@ local StopMovingOrSizing = StopMovingOrSizing
B.Frames = {
"AddonList",
"AudioOptionsFrame",
"BankFrame",
"BonusRollFrame",
"BonusRollLootWonFrame",
"BonusRollMoneyWonFrame",
"CharacterFrame",
"ChatConfigFrame",
"CinematicFrame",
"DressUpFrame",
"FriendsFrame",
"FriendsFriendsFrame",
"GameMenuFrame",
"GossipFrame",
"GuildInviteFrame",
......@@ -24,6 +29,9 @@ B.Frames = {
"HelpFrame",
"InterfaceOptionsFrame",
"ItemTextFrame",
"LFDRoleCheckPopup",
"LFGDungeonReadyDialog",
"LFGDungeonReadyStatus",
"LootFrame",
"MailFrame",
"MerchantFrame",
......@@ -31,13 +39,23 @@ B.Frames = {
"PVEFrame",
"PetStableFrame",
"PetitionFrame",
"PVPReadyDialog",
"QuestFrame",
"QuestLogPopupDetailFrame",
"RaidBrowserFrame",
"RaidInfoFrame",
"RaidParentFrame",
"ReadyCheckFrame",
"ReportCheatingDialog",
"RolePollPopup",
"ScrollOfResurrectionSelectionFrame",
"SpellBookFrame",
"SplashFrame",
"StackSplitFrame",
"StaticPopup1",
"StaticPopup2",
"StaticPopup3",
"StaticPopup4",
"TabardFrame",
"TaxiFrame",
"TimeManagerFrame",
......@@ -48,57 +66,110 @@ B.Frames = {
}
B.AddonsList = {
["Blizzard_AchievementUI"] = {"AchievementFrame","AchievementFrameHeader"},
["Blizzard_ArchaeologyUI"] = "ArchaeologyFrame",
["Blizzard_AuctionUI"] = "AuctionFrame",
["Blizzard_Calendar"] = "CalendarFrame",
['Blizzard_ChallengesUI'] = "ChallengesKeystoneFrame",
["Blizzard_Collections"] = "CollectionsJournal",
["Blizzard_EncounterJournal"] = "EncounterJournal",
["Blizzard_GarrisonUI"] = {"GarrisonLandingPage", "GarrisonMissionFrame", "GarrisonCapacitiveDisplayFrame", "GarrisonBuildingFrame", "GarrisonRecruiterFrame", "GarrisonRecruitSelectFrame", "GarrisonShipyardFrame"},
["Blizzard_GuildBankUI"] = "GuildBankFrame",
["Blizzard_GuildControlUI"] = "GuildControlUI",
["Blizzard_GuildUI"] = "GuildFrame",
["Blizzard_InspectUI"] = "InspectFrame",
["Blizzard_ItemAlterationUI"] = "TransmogrifyFrame",
["Blizzard_ItemSocketingUI"] = "ItemSocketingFrame",
["Blizzard_ItemUpgradeUI"] = "ItemUpgradeFrame",
["Blizzard_LookingForGuildUI"] = "LookingForGuildFrame",
["Blizzard_MacroUI"] = "MacroFrame",
["Blizzard_TalentUI"] = "PlayerTalentFrame",
["Blizzard_TradeSkillUI"] = "TradeSkillFrame",
["Blizzard_VoidStorageUI"] = "VoidStorageFrame",
["Blizzard_AchievementUI"] = { "AchievementFrame" },
["Blizzard_ArchaeologyUI"] = { "ArchaeologyFrame" },
["Blizzard_ArtifactUI"] = { "ArtifactRelicForgeFrame" },
["Blizzard_AuctionUI"] = { "AuctionFrame" },
["Blizzard_BarberShopUI"] = { "BarberShopFrame" },
["Blizzard_BindingUI"] = { "KeyBindingFrame" },
["Blizzard_BlackMarketUI"] = { "BlackMarketFrame" },
["Blizzard_Calendar"] = { "CalendarCreateEventFrame", "CalendarFrame", "CalendarViewEventFrame", "CalendarViewHolidayFrame" },
["Blizzard_ChallengesUI"] = { "ChallengesKeystoneFrame" }, -- 'ChallengesLeaderboardFrame'
["Blizzard_Collections"] = { "CollectionsJournal" },
["Blizzard_EncounterJournal"] = { "EncounterJournal" },
["Blizzard_GarrisonUI"] = { "GarrisonLandingPage", "GarrisonMissionFrame", "GarrisonCapacitiveDisplayFrame", "GarrisonBuildingFrame", "GarrisonRecruiterFrame", "GarrisonRecruitSelectFrame", "GarrisonShipyardFrame" },
["Blizzard_GMChatUI"] = { "GMChatStatusFrame" },
["Blizzard_GMSurveyUI"] = { "GMSurveyFrame" },
["Blizzard_GuildBankUI"] = { "GuildBankFrame" },
["Blizzard_GuildControlUI"] = { "GuildControlUI" },
["Blizzard_GuildUI"] = { "GuildFrame", "GuildLogFrame" },
["Blizzard_InspectUI"] = { "InspectFrame" },
["Blizzard_ItemAlterationUI"] = { "TransmogrifyFrame" },
["Blizzard_ItemSocketingUI"] = { "ItemSocketingFrame" },
["Blizzard_ItemUpgradeUI"] = { "ItemUpgradeFrame" },
["Blizzard_LookingForGuildUI"] = { "LookingForGuildFrame" },
["Blizzard_MacroUI"] = { "MacroFrame" },
["Blizzard_OrderHallUI"] = { "OrderHallTalentFrame" },
["Blizzard_QuestChoice"] = { "QuestChoiceFrame" },
["Blizzard_TalentUI"] = { "PlayerTalentFrame" },
["Blizzard_TalkingHeadUI"] = { "TalkingHeadFrame" },
["Blizzard_TradeSkillUI"] = { "TradeSkillFrame" },
["Blizzard_TrainerUI"] = { "ClassTrainerFrame" },
["Blizzard_VoidStorageUI"] = { "VoidStorageFrame" },
}
function B:MakeMovable(frame)
local function LoadPosition(self)
if self.IsMoving == true then return end
local Name = self:GetName()
if E.private.sle.module.blizzmove.remember and E.private.sle.module.blizzmove.points[Name] then
self:ClearAllPoints()
self:SetPoint(T.unpack(E.private.sle.module.blizzmove.points[Name]))
end
end
local function OnDragStart(self)
self.IsMoving = true
self:StartMoving()
end
local function OnDragStop(self)
self:StopMovingOrSizing()
self.IsMoving = false
local Name = self:GetName()
if E.private.sle.module.blizzmove.remember then
local a, b, c, d, e = self:GetPoint()
b = self:GetParent():GetName() or UIParent
if Name == "QuestFrame" or Name == "GossipFrame" then
E.private.sle.module.blizzmove.points["GossipFrame"] = {a, b, c, d, e}
E.private.sle.module.blizzmove.points["QuestFrame"] = {a, b, c, d, e}
else
E.private.sle.module.blizzmove.points[Name] = {a, b, c, d, e}
end
else
self:SetUserPlaced(false)
end
end
function B:MakeMovable(frameName)
local frame = _G[frameName]
if not frame then
SLE:ErrorPrint("Doesn't exist: "..B.Frames[i])
SLE:ErrorPrint("Frame to move doesn't exist: "..(frameName or "Unknown"))
return
end
if frame then
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetClampedToScreen(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", function(self) self:StartMoving() end)
frame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
if frame.TitleMouseover then B:MakeMovable(frame.TitleMouseover) end
end
local Name = frame:GetName()
if not Name then return end
if Name == "AchievementFrame" then AchievementFrameHeader:EnableMouse(false) end
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetClampedToScreen(true)
frame:RegisterForDrag("LeftButton")
frame:HookScript("OnShow", LoadPosition)
frame:HookScript("OnDragStart", OnDragStart)
frame:HookScript("OnDragStop", OnDragStop)
frame:HookScript("OnHide", OnDragStop)
C_Timer.After(0, function()
if E.private.sle.module.blizzmove.remember and E.private.sle.module.blizzmove.points[Name] then
frame:ClearAllPoints()
frame:SetPoint(T.unpack(E.private.sle.module.blizzmove.points[Name]))
end
end)
end
function B:Addons(event, addon)
local frame
addon = B.AddonsList[addon]
if not addon then return end
if T.type(addon) == "table" then
for i = 1, #addon do
frame = _G[addon[i]]
B:MakeMovable(frame)
B:MakeMovable(addon[i])
end
else
frame = _G[addon]
B:MakeMovable(frame)
B:MakeMovable(addon)
end
B.addonCount = B.addonCount + 1
if B.addonCount == #B.AddonsList then B:UnregisterEvent(event) end
......@@ -118,12 +189,22 @@ function B:Initialize()
B.db = E.db.sle.blizzard
if not SLE.initialized then return end
B.addonCount = 0
if E.private.sle.module.blizzmove then
if E.private.sle.module.blizzmove and T.type(E.private.sle.module.blizzmove) == "boolean" then E.private.sle.module.blizzmove = V.sle.module.blizzmove end --Old setting conversions
if E.private.sle.module.blizzmove.enable then
for i = 1, #B.Frames do
local frame = _G[B.Frames[i]]
if frame then B:MakeMovable(frame) end
B:MakeMovable(B.Frames[i])
end
self:RegisterEvent("ADDON_LOADED", "Addons")
-- Check Forced Loaded AddOns
for AddOn, Table in T.pairs(B.AddonsList) do
if IsAddOnLoaded(AddOn) then
for _, frame in T.pairs(Table) do
B:MakeMovable(frame)
end
end
end
end
E:Delay(1, B.VehicleScale)
......
......@@ -15,12 +15,29 @@ local function configTable()
name = "Blizzard",
},
blizzmove = {
order = 1,
type = "toggle",
order = 12,
type = "group",
name = L["Move Blizzard frames"],
desc = L["Allow some Blizzard frames to be moved around."],
get = function(info) return E.private.sle.module.blizzmove end,
set = function(info, value) E.private.sle.module.blizzmove = value; E:StaticPopup_Show("PRIVATE_RL") end,
guiInline = true,
args = {
enable = {
order = 1,
type = "toggle",
name = L["Enable"],
desc = L["Allow some Blizzard frames to be moved around."],
get = function(info) return E.private.sle.module.blizzmove.enable end,
set = function(info, value) E.private.sle.module.blizzmove.enable = value; E:StaticPopup_Show("PRIVATE_RL") end,
},
remember = {
order = 2,
type = "toggle",
name = L["Remember"],
desc = L["Remember positions of frames after moving them."],
get = function(info) return E.private.sle.module.blizzmove.remember end,
set = function(info, value) E.private.sle.module.blizzmove.remember = value; end,
disabled = function() return not E.private.sle.module.blizzmove.enable end,
},
}
},
rumouseover = {
order = 2,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment