Making tests with LibWindow-1.1
This commit is contained in:
@@ -0,0 +1,317 @@
|
||||
--[[
|
||||
Name: LibWindow-1.1
|
||||
Revision: $Rev: 8 $
|
||||
Author(s): Mikk (dpsgnome@mail.com)
|
||||
Website: http://old.wowace.com/wiki/LibWindow-1.1
|
||||
Documentation: http://old.wowace.com/wiki/LibWindow-1.1
|
||||
SVN: http://svn.wowace.com/root/trunk/WindowLib/Window-1.0
|
||||
Description: A library that handles the basics of "window" style frames: scaling, smart position saving, dragging..
|
||||
Dependencies: none
|
||||
License: Public Domain
|
||||
]]
|
||||
|
||||
local MAJOR = "LibWindow-1.1"
|
||||
local MINOR = tonumber(("$Revision: 8 $"):match("(%d+)"))
|
||||
|
||||
local lib = LibStub:NewLibrary(MAJOR,MINOR)
|
||||
if not lib then return end
|
||||
|
||||
local min,max,abs = min,max,abs
|
||||
local pairs = pairs
|
||||
local tostring = tostring
|
||||
local UIParent,GetScreenWidth,GetScreenHeight,IsAltKeyDown = UIParent,GetScreenWidth,GetScreenHeight,IsAltKeyDown
|
||||
-- GLOBALS: error, ChatFrame1, assert
|
||||
|
||||
local function print(msg) ChatFrame1:AddMessage(MAJOR..": "..tostring(msg)) end
|
||||
|
||||
lib.utilFrame = lib.utilFrame or CreateFrame("Frame")
|
||||
lib.delayedSavePosition = lib.delayedSavePosition or {}
|
||||
lib.windowData = lib.windowData or {}
|
||||
--[frameref]={
|
||||
-- names={optional names data from .RegisterConfig()}
|
||||
-- storage= -- tableref where config data is read/written
|
||||
-- altEnable=true/false
|
||||
--}
|
||||
|
||||
|
||||
lib.embeds = lib.embeds or {}
|
||||
|
||||
local mixins = {} -- "FuncName"=true
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- UTILITIES
|
||||
---------------------------------------------------------
|
||||
|
||||
|
||||
local function getStorageName(frame, name)
|
||||
local names = lib.windowData[frame].names
|
||||
if names then
|
||||
if names[name] then
|
||||
return names[name]
|
||||
end
|
||||
if names.prefix then
|
||||
return names.prefix .. name;
|
||||
end
|
||||
end
|
||||
return name;
|
||||
end
|
||||
|
||||
local function setStorage(frame, name, value)
|
||||
lib.windowData[frame].storage[getStorageName(frame, name)] = value
|
||||
end
|
||||
|
||||
local function getStorage(frame, name)
|
||||
return lib.windowData[frame].storage[getStorageName(frame, name)]
|
||||
end
|
||||
|
||||
|
||||
lib.utilFrame:SetScript("OnUpdate", function(this)
|
||||
this:Hide()
|
||||
for frame,_ in pairs(lib.delayedSavePosition) do
|
||||
lib.delayedSavePosition[frame] = nil
|
||||
lib.SavePosition(frame)
|
||||
end
|
||||
end)
|
||||
|
||||
local function queueSavePosition(frame)
|
||||
lib.delayedSavePosition[frame] = true
|
||||
lib.utilFrame:Show()
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- IMPORTANT APIS
|
||||
---------------------------------------------------------
|
||||
|
||||
mixins["RegisterConfig"]=true
|
||||
function lib.RegisterConfig(frame, storage, names)
|
||||
if not lib.windowData[frame] then
|
||||
lib.windowData[frame] = {}
|
||||
end
|
||||
lib.windowData[frame].names = names
|
||||
lib.windowData[frame].storage = storage
|
||||
|
||||
--[[ debug
|
||||
frame.tx = frame:CreateTexture()
|
||||
frame.tx:SetTexture(0,0,0, 0.4)
|
||||
frame.tx:SetAllPoints(frame)
|
||||
frame.tx:Show()
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- POSITIONING AND SCALING
|
||||
---------------------------------------------------------
|
||||
|
||||
local nilParent = {
|
||||
GetWidth = function()
|
||||
return GetScreenWidth() * UIParent:GetScale()
|
||||
end,
|
||||
GetHeight = function()
|
||||
return GetScreenHeight() * UIParent:GetScale()
|
||||
end,
|
||||
GetScale = function()
|
||||
return 1
|
||||
end,
|
||||
}
|
||||
|
||||
mixins["SavePosition"]=true
|
||||
function lib.SavePosition(frame)
|
||||
local parent = frame:GetParent() or nilParent
|
||||
-- No, this won't work very well with frames that aren't parented to nil or UIParent
|
||||
local s = frame:GetScale()
|
||||
local left,top = frame:GetLeft()*s, frame:GetTop()*s
|
||||
local right,bottom = frame:GetRight()*s, frame:GetBottom()*s
|
||||
local pwidth, pheight = parent:GetWidth(), parent:GetHeight()
|
||||
|
||||
local x,y,point;
|
||||
if left < (pwidth-right) and left < abs((left+right)/2 - pwidth/2) then
|
||||
x = left;
|
||||
point="LEFT";
|
||||
elseif (pwidth-right) < abs((left+right)/2 - pwidth/2) then
|
||||
x = right-pwidth;
|
||||
point="RIGHT";
|
||||
else
|
||||
x = (left+right)/2 - pwidth/2;
|
||||
point="";
|
||||
end
|
||||
|
||||
if bottom < (pheight-top) and bottom < abs((bottom+top)/2 - pheight/2) then
|
||||
y = bottom;
|
||||
point="BOTTOM"..point;
|
||||
elseif (pheight-top) < abs((bottom+top)/2 - pheight/2) then
|
||||
y = top-pheight;
|
||||
point="TOP"..point;
|
||||
else
|
||||
y = (bottom+top)/2 - pheight/2;
|
||||
-- point=""..point;
|
||||
end
|
||||
|
||||
if point=="" then
|
||||
point = "CENTER"
|
||||
end
|
||||
|
||||
setStorage(frame, "x", x)
|
||||
setStorage(frame, "y", y)
|
||||
setStorage(frame, "point", point)
|
||||
setStorage(frame, "scale", s)
|
||||
|
||||
frame:ClearAllPoints()
|
||||
frame:SetPoint(point, frame:GetParent(), point, x/s, y/s);
|
||||
end
|
||||
|
||||
|
||||
mixins["RestorePosition"]=true
|
||||
function lib.RestorePosition(frame)
|
||||
local x = getStorage(frame, "x")
|
||||
local y = getStorage(frame, "y")
|
||||
local point = getStorage(frame, "point")
|
||||
|
||||
local s = getStorage(frame, "scale")
|
||||
if s then
|
||||
(frame.lw11origSetScale or frame.SetScale)(frame,s)
|
||||
else
|
||||
s = frame:GetScale()
|
||||
end
|
||||
|
||||
if not x or not y then -- nothing stored in config yet, smack it in the center
|
||||
x=0; y=0; point="CENTER"
|
||||
end
|
||||
|
||||
x = x/s
|
||||
y = y/s
|
||||
|
||||
frame:ClearAllPoints()
|
||||
if not point and y==0 then -- errr why did i do this check again? must have been a reason, but i can't remember it =/
|
||||
point="CENTER"
|
||||
end
|
||||
|
||||
if not point then -- we have position, but no point, which probably means we're going from data stored by the addon itself before LibWindow was added to it. It was PROBABLY topleft->bottomleft anchored. Most do it that way.
|
||||
frame:SetPoint("TOPLEFT", frame:GetParent(), "BOTTOMLEFT", x, y)
|
||||
-- make it compute a better attachpoint (on next update)
|
||||
queueSavePosition(frame)
|
||||
return
|
||||
end
|
||||
|
||||
frame:SetPoint(point, frame:GetParent(), point, x, y)
|
||||
end
|
||||
|
||||
|
||||
mixins["SetScale"]=true
|
||||
function lib.SetScale(frame, scale)
|
||||
setStorage(frame, "scale", scale);
|
||||
(frame.lw11origSetScale or frame.SetScale)(frame,scale)
|
||||
lib.RestorePosition(frame)
|
||||
end
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- DRAG SUPPORT
|
||||
---------------------------------------------------------
|
||||
|
||||
|
||||
function lib.OnDragStart(frame)
|
||||
lib.windowData[frame].isDragging = true
|
||||
frame:StartMoving()
|
||||
end
|
||||
|
||||
|
||||
function lib.OnDragStop(frame)
|
||||
frame:StopMovingOrSizing()
|
||||
lib.SavePosition(frame)
|
||||
lib.windowData[frame].isDragging = false
|
||||
if lib.windowData[frame].altEnable and not IsAltKeyDown() then
|
||||
frame:EnableMouse(false)
|
||||
end
|
||||
end
|
||||
|
||||
local function onDragStart(...) return lib.OnDragStart(...) end -- upgradable
|
||||
local function onDragStop(...) return lib.OnDragStop(...) end -- upgradable
|
||||
|
||||
mixins["MakeDraggable"]=true
|
||||
function lib.MakeDraggable(frame)
|
||||
assert(lib.windowData[frame])
|
||||
frame:SetMovable(true)
|
||||
frame:SetScript("OnDragStart", onDragStart)
|
||||
frame:SetScript("OnDragStop", onDragStop)
|
||||
frame:RegisterForDrag("LeftButton")
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- MOUSEWHEEL
|
||||
---------------------------------------------------------
|
||||
|
||||
function lib.OnMouseWheel(frame, dir)
|
||||
local scale = getStorage(frame, "scale")
|
||||
if dir<0 then
|
||||
scale=max(scale*0.9, 0.1)
|
||||
else
|
||||
scale=min(scale/0.9, 3)
|
||||
end
|
||||
lib.SetScale(frame, scale)
|
||||
end
|
||||
|
||||
local function onMouseWheel(...) return lib.OnMouseWheel(...) end -- upgradable
|
||||
|
||||
mixins["EnableMouseWheelScaling"]=true
|
||||
function lib.EnableMouseWheelScaling(frame)
|
||||
frame:SetScript("OnMouseWheel", onMouseWheel)
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- ENABLEMOUSE-ON-ALT
|
||||
---------------------------------------------------------
|
||||
|
||||
lib.utilFrame:SetScript("OnEvent", function(this, event, key, state)
|
||||
if event=="MODIFIER_STATE_CHANGED" then
|
||||
if key == "LALT" or key == "RALT" then
|
||||
for frame,_ in pairs(lib.altEnabledFrames) do
|
||||
if not lib.windowData[frame].isDragging then -- if it's already dragging, it'll disable mouse on DragStop instead
|
||||
frame:EnableMouse(state == 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
mixins["EnableMouseOnAlt"]=true
|
||||
function lib.EnableMouseOnAlt(frame)
|
||||
assert(lib.windowData[frame])
|
||||
lib.windowData[frame].altEnable = true
|
||||
frame:EnableMouse(not not IsAltKeyDown())
|
||||
if not lib.altEnabledFrames then
|
||||
lib.altEnabledFrames = {}
|
||||
lib.utilFrame:RegisterEvent("MODIFIER_STATE_CHANGED")
|
||||
end
|
||||
lib.altEnabledFrames[frame] = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Embed support (into FRAMES, not addons!)
|
||||
---------------------------------------------------------
|
||||
|
||||
function lib:Embed(target)
|
||||
if not target or not target[0] or not target.GetObjectType then
|
||||
error("Usage: LibWindow:Embed(frame)", 1)
|
||||
end
|
||||
target.lw11origSetScale = target.SetScale
|
||||
for name, _ in pairs(mixins) do
|
||||
target[name] = self[name]
|
||||
end
|
||||
lib.embeds[target] = true
|
||||
return target
|
||||
end
|
||||
|
||||
for target, _ in pairs(lib.embeds) do
|
||||
lib:Embed(target)
|
||||
end
|
||||
@@ -12,5 +12,6 @@
|
||||
<Script file="LibDataBroker-1.1\LibDataBroker-1.1.lua"/>
|
||||
<Script file="LibDBIcon-1.0\LibDBIcon-1.0.lua"/>
|
||||
<Script file="LibGraph-2.0\LibGraph-2.0.lua"/>
|
||||
<Script file="LibWindow-1.1\LibWindow-1.1.lua"/>
|
||||
<Include file="LibCompress\lib.xml"/>
|
||||
</Ui>
|
||||
@@ -1406,7 +1406,7 @@ function _detalhes:RestauraJanela (index, temp, load_only)
|
||||
self.oldwith = self.baseframe:GetWidth()
|
||||
self:RestoreMainWindowPosition()
|
||||
self:ReajustaGump()
|
||||
self:SaveMainWindowPosition()
|
||||
--self:SaveMainWindowPosition()
|
||||
|
||||
if (not load_only) then
|
||||
self.iniciada = true
|
||||
|
||||
@@ -43,6 +43,7 @@ _detalhes.instance_skin_ignored_values = {
|
||||
["switch_tank_in_combat"] = true,
|
||||
["strata"] = true,
|
||||
["grab_on_top"] = true,
|
||||
["libwindow"] = true,
|
||||
}
|
||||
|
||||
function _detalhes:ResetInstanceConfigKeepingValues (maintainsnap)
|
||||
@@ -92,6 +93,7 @@ _detalhes.instance_defaults = {
|
||||
skin = "Minimalistic v2",
|
||||
--scale
|
||||
window_scale = 1.0,
|
||||
libwindow = {},
|
||||
--following
|
||||
following = {enabled = false, bar_color = {1, 1, 1}, text_color = {1, 1, 1}},
|
||||
--baseframe backdrop
|
||||
|
||||
+179
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
local libwindow = LibStub ("LibWindow-1.1")
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
@@ -206,9 +207,171 @@
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------------------------------
|
||||
--> LibWindow-1.1
|
||||
--this is the restore function from Libs\LibWindow-1.1\LibWindow-1.1.lua we can't schedule and we save it inside the instance without frame references.
|
||||
|
||||
function _detalhes:RestoreLibWindow()
|
||||
local frame = self.baseframe
|
||||
if (frame) then
|
||||
if (self.libwindow.x) then
|
||||
|
||||
local x = self.libwindow.x
|
||||
local y = self.libwindow.y
|
||||
local point = self.libwindow.point
|
||||
local s = self.libwindow.scale
|
||||
|
||||
if s then
|
||||
(frame.lw11origSetScale or frame.SetScale)(frame,s)
|
||||
else
|
||||
s = frame:GetScale()
|
||||
end
|
||||
|
||||
if not x or not y then -- nothing stored in config yet, smack it in the center
|
||||
x=0; y=0; point="CENTER"
|
||||
end
|
||||
|
||||
x = x/s
|
||||
y = y/s
|
||||
|
||||
frame:ClearAllPoints()
|
||||
if not point and y==0 then -- errr why did i do this check again? must have been a reason, but i can't remember it =/
|
||||
point="CENTER"
|
||||
end
|
||||
|
||||
if not point then -- we have position, but no point, which probably means we're going from data stored by the addon itself before LibWindow was added to it. It was PROBABLY topleft->bottomleft anchored. Most do it that way.
|
||||
frame:SetPoint("TOPLEFT", frame:GetParent(), "BOTTOMLEFT", x, y)
|
||||
-- make it compute a better attachpoint (on next update)
|
||||
--_detalhes:ScheduleTimer ("SaveLibWindow", 0.05, self)
|
||||
return
|
||||
end
|
||||
|
||||
frame:SetPoint(point, frame:GetParent(), point, x, y)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--> LibWindow-1.1
|
||||
--this is the save function from Libs\LibWindow-1.1\LibWindow-1.1.lua, we save it inside the instance without frame references.
|
||||
|
||||
function _detalhes:SaveLibWindow()
|
||||
local frame = self.baseframe
|
||||
if (frame) then
|
||||
local left = frame:GetLeft()
|
||||
if (not left) then
|
||||
return _detalhes:ScheduleTimer ("SaveLibWindow", 0.05, self)
|
||||
end
|
||||
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "SAVING 1: " .. (self.libwindow.x or 0))
|
||||
|
||||
--> LibWindow-1.1 ----------------
|
||||
local parent = frame:GetParent() or nilParent
|
||||
-- No, this won't work very well with frames that aren't parented to nil or UIParent
|
||||
local s = frame:GetScale()
|
||||
local left,top = frame:GetLeft()*s, frame:GetTop()*s
|
||||
local right,bottom = frame:GetRight()*s, frame:GetBottom()*s
|
||||
local pwidth, pheight = parent:GetWidth(), parent:GetHeight()
|
||||
|
||||
local x,y,point;
|
||||
if left < (pwidth-right) and left < abs((left+right)/2 - pwidth/2) then
|
||||
x = left;
|
||||
point="LEFT";
|
||||
elseif (pwidth-right) < abs((left+right)/2 - pwidth/2) then
|
||||
x = right-pwidth;
|
||||
point="RIGHT";
|
||||
else
|
||||
x = (left+right)/2 - pwidth/2;
|
||||
point="";
|
||||
end
|
||||
|
||||
if bottom < (pheight-top) and bottom < abs((bottom+top)/2 - pheight/2) then
|
||||
y = bottom;
|
||||
point="BOTTOM"..point;
|
||||
elseif (pheight-top) < abs((bottom+top)/2 - pheight/2) then
|
||||
y = top-pheight;
|
||||
point="TOP"..point;
|
||||
else
|
||||
y = (bottom+top)/2 - pheight/2;
|
||||
-- point=""..point;
|
||||
end
|
||||
|
||||
if point=="" then
|
||||
point = "CENTER"
|
||||
end
|
||||
----------------------------------------
|
||||
|
||||
self.libwindow.x = x
|
||||
self.libwindow.y = y
|
||||
self.libwindow.point = point
|
||||
self.libwindow.scale = scale
|
||||
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "SAVING 2: " .. (self.libwindow.x or 0))
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function _detalhes:SaveMainWindowSize()
|
||||
local baseframe_width = self.baseframe:GetWidth()
|
||||
if (not baseframe_width) then
|
||||
return _detalhes:ScheduleTimer ("SaveMainWindowSize", 1, self)
|
||||
end
|
||||
local baseframe_height = self.baseframe:GetHeight()
|
||||
|
||||
--> calc position
|
||||
local _x, _y = self:GetPositionOnScreen()
|
||||
if (not _x) then
|
||||
return _detalhes:ScheduleTimer ("SaveMainWindowSize", 1, self)
|
||||
end
|
||||
|
||||
--> save the position
|
||||
local _w = baseframe_width
|
||||
local _h = baseframe_height
|
||||
|
||||
local mostrando = self.mostrando
|
||||
|
||||
self.posicao[mostrando].x = _x
|
||||
self.posicao[mostrando].y = _y
|
||||
self.posicao[mostrando].w = _w
|
||||
self.posicao[mostrando].h = _h
|
||||
|
||||
--> update the 4 points for window groups
|
||||
local metade_largura = _w/2
|
||||
local metade_altura = _h/2
|
||||
|
||||
local statusbar_y_mod = 0
|
||||
if (not self.show_statusbar) then
|
||||
statusbar_y_mod = 14 * self.baseframe:GetScale()
|
||||
end
|
||||
|
||||
if (not self.ponto1) then
|
||||
self.ponto1 = {x = _x - metade_largura, y = _y + metade_altura + (statusbar_y_mod*-1)} --topleft
|
||||
self.ponto2 = {x = _x - metade_largura, y = _y - metade_altura + statusbar_y_mod} --bottomleft
|
||||
self.ponto3 = {x = _x + metade_largura, y = _y - metade_altura + statusbar_y_mod} --bottomright
|
||||
self.ponto4 = {x = _x + metade_largura, y = _y + metade_altura + (statusbar_y_mod*-1)} --topright
|
||||
else
|
||||
self.ponto1.x = _x - metade_largura
|
||||
self.ponto1.y = _y + metade_altura + (statusbar_y_mod*-1)
|
||||
self.ponto2.x = _x - metade_largura
|
||||
self.ponto2.y = _y - metade_altura + statusbar_y_mod
|
||||
self.ponto3.x = _x + metade_largura
|
||||
self.ponto3.y = _y - metade_altura + statusbar_y_mod
|
||||
self.ponto4.x = _x + metade_largura
|
||||
self.ponto4.y = _y + metade_altura + (statusbar_y_mod*-1)
|
||||
end
|
||||
|
||||
self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight() - end_window_spacement --> espaço para o final da janela
|
||||
|
||||
return {altura = self.baseframe:GetHeight(), largura = self.baseframe:GetWidth(), x = _x, y = _y}
|
||||
end
|
||||
|
||||
function _detalhes:SaveMainWindowPosition (instance)
|
||||
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "SaveMainWindowPosition: " .. debugstack())
|
||||
|
||||
if (instance) then
|
||||
self = instance
|
||||
end
|
||||
@@ -227,6 +390,8 @@
|
||||
return _detalhes:ScheduleTimer ("SaveMainWindowPosition", 1, self)
|
||||
end
|
||||
|
||||
self:SaveLibWindow()
|
||||
|
||||
--> save the position
|
||||
local _w = baseframe_width
|
||||
local _h = baseframe_height
|
||||
@@ -268,6 +433,20 @@
|
||||
|
||||
function _detalhes:RestoreMainWindowPosition (pre_defined)
|
||||
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "Restoring " .. ( self.libwindow.x or "NONE") .. " " .. (self.libwindow.point or "NONE"))
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "")
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, debugstack())
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "")
|
||||
|
||||
if (not pre_defined and self.libwindow.x and self.mostrando == "normal") then
|
||||
self.baseframe:SetWidth (self.posicao[self.mostrando].w)
|
||||
self.baseframe:SetHeight (self.posicao[self.mostrando].h)
|
||||
|
||||
self:RestoreLibWindow()
|
||||
self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight() - end_window_spacement --> espaço para o final da janela
|
||||
return
|
||||
end
|
||||
|
||||
local _scale = self.baseframe:GetEffectiveScale()
|
||||
local _UIscale = _UIParent:GetScale()
|
||||
|
||||
@@ -287,7 +466,6 @@
|
||||
self.baseframe:ClearAllPoints()
|
||||
self.baseframe:SetPoint ("CENTER", _UIParent, "CENTER", novo_x, novo_y)
|
||||
|
||||
self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight() - end_window_spacement --> espaço para o final da janela
|
||||
end
|
||||
|
||||
function _detalhes:RestoreMainWindowPositionNoResize (pre_defined, x, y)
|
||||
|
||||
@@ -379,7 +379,8 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
|
||||
|
||||
--> load data saved for this character only
|
||||
instance:LoadLocalInstanceConfig()
|
||||
if (skin.__was_opened) then
|
||||
if (skin.__was_opened) then
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "libwindow X (383): " .. (instance.libwindow.x or 0))
|
||||
instance:AtivarInstancia()
|
||||
else
|
||||
instance.ativa = false
|
||||
@@ -421,9 +422,11 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
|
||||
end
|
||||
|
||||
instance:LockInstance (instance.isLocked)
|
||||
|
||||
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "libwindow X (427): " .. (instance.libwindow.x or 0))
|
||||
instance:RestoreMainWindowPosition()
|
||||
instance:ReajustaGump()
|
||||
instance:SaveMainWindowPosition()
|
||||
--instance:SaveMainWindowPosition()
|
||||
instance:ChangeSkin()
|
||||
|
||||
else
|
||||
|
||||
+24
-2
@@ -4,11 +4,33 @@ local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
local g = _detalhes.gump
|
||||
local _
|
||||
|
||||
function _detalhes:OpenNewsWindow()
|
||||
function _detalhes:OpenNewsWindow (text_to_show, dumpvalues)
|
||||
local news_window = _detalhes:CreateOrOpenNewsWindow()
|
||||
|
||||
news_window:Title (Loc ["STRING_NEWS_TITLE"])
|
||||
news_window:Text (Loc ["STRING_VERSION_LOG"])
|
||||
|
||||
if (text_to_show and type (text_to_show) == "table") then
|
||||
local s = ""
|
||||
for _, text in ipairs (text_to_show) do
|
||||
if (type (text) == "string") then
|
||||
s = s .. text .. "\n"
|
||||
end
|
||||
end
|
||||
|
||||
if (dumpvalues) then
|
||||
for key, value in pairs (text_to_show) do
|
||||
if (type (value) == "function" or type (value) == "table") then
|
||||
s = s .. "[" .. key .. "] = " .. type (value) .. "\n"
|
||||
else
|
||||
s = s .. "[" .. key .. "] = " .. value .. "\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
news_window:Text (s)
|
||||
else
|
||||
news_window:Text (text_to_show or Loc ["STRING_VERSION_LOG"])
|
||||
end
|
||||
|
||||
news_window:Icon ([[Interface\AddOns\Details\images\icons2]], {108/512, 189/512, 319/512, 400/512})
|
||||
|
||||
|
||||
@@ -1050,7 +1050,7 @@ end
|
||||
|
||||
--> scripts do base frame
|
||||
local BFrame_scripts_onsizechange = function (self)
|
||||
self._instance:SaveMainWindowPosition()
|
||||
self._instance:SaveMainWindowSize()
|
||||
self._instance:ReajustaGump()
|
||||
self._instance.oldwith = self:GetWidth()
|
||||
_detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, self._instance)
|
||||
|
||||
+4
-203
@@ -329,42 +329,7 @@ function _G._detalhes:Start()
|
||||
|
||||
--> check is this is the first run of this version
|
||||
if (self.is_version_first_run) then
|
||||
|
||||
if (_detalhes_database.last_version and _detalhes.userversion == "v3.8.1") then
|
||||
--_detalhes:SetTutorialCVar ("UPDATE_WARNING_SPECICONS1", false)
|
||||
if (not _detalhes:GetTutorialCVar ("UPDATE_WARNING_SPECICONS1")) then
|
||||
_detalhes:SetTutorialCVar ("UPDATE_WARNING_SPECICONS1", true)
|
||||
local func = function()
|
||||
|
||||
local window1 = _detalhes:GetInstance(1)
|
||||
if (window1 and window1:IsEnabled()) then
|
||||
window1:SetBarSpecIconSettings (true, [[Interface\AddOns\Details\images\spec_icons_normal]], true)
|
||||
end
|
||||
local window2 = _detalhes:GetInstance(2)
|
||||
if (window2 and window2:IsEnabled()) then
|
||||
window2:SetBarSpecIconSettings (true, [[Interface\AddOns\Details\images\spec_icons_normal]], true)
|
||||
end
|
||||
|
||||
_detalhes:CreateTestBars()
|
||||
|
||||
_detalhes:Ask ("Keep Changes? You may change later on Options Panel -> Rows: Settings", function()
|
||||
end)
|
||||
|
||||
_detalhes.yesNo ["no"]:SetClickFunction (function()
|
||||
if (window1 and window1:IsEnabled()) then
|
||||
window1:SetBarSpecIconSettings (false)
|
||||
end
|
||||
if (window2 and window2:IsEnabled()) then
|
||||
window2:SetBarSpecIconSettings (false)
|
||||
end
|
||||
_detalhes.yesNo:Hide()
|
||||
end)
|
||||
|
||||
end
|
||||
_detalhes:GetFramework():ShowTutorialAlertFrame ("Spec Icons!", "Now Available, click here!", func)
|
||||
end
|
||||
end
|
||||
|
||||
local enable_reset_warning = true
|
||||
|
||||
local lower_instance = _detalhes:GetLowerInstanceNumber()
|
||||
@@ -530,174 +495,10 @@ function _G._detalhes:Start()
|
||||
DBM:RegisterCallback ("pull", dbm_callback_pull)
|
||||
end
|
||||
|
||||
--> register molten core
|
||||
local molten_core = {
|
||||
|
||||
id = 409,
|
||||
ej_id = 0, --encounter journal id
|
||||
|
||||
name = "Molten Core",
|
||||
|
||||
icons = [[Interface\AddOns\Details_RaidInfo-BlackrockFoundry\boss_faces]],
|
||||
icon = [[Interface\AddOns\Details_RaidInfo-BlackrockFoundry\icon256x128]],
|
||||
|
||||
is_raid = true,
|
||||
|
||||
backgroundFile = {file = [[Interface\Glues\LOADINGSCREENS\LoadingScreen_BlackrockFoundry]], coords = {0, 1, 132/512, 439/512}},
|
||||
backgroundEJ = [[Interface\EncounterJournal\UI-EJ-LOREBG-BlackrockFoundry]],
|
||||
|
||||
boss_names = {
|
||||
--[[ 1 ]] "Lucifron",
|
||||
--[[ 2 ]] "Magmadar",
|
||||
--[[ 3 ]] "Gehennas",
|
||||
--[[ 4 ]] "Garr",
|
||||
--[[ 5 ]] "Baron Geddon",
|
||||
--[[ 6 ]] "Shazzrah",
|
||||
--[[ 7 ]] "Sulfuron Harbinger",
|
||||
--[[ 8 ]] "Golemagg the Incinerator",
|
||||
--[[ 9 ]] "Majordomo Executus",
|
||||
--[[ 10 ]] "Ragnaros",
|
||||
},
|
||||
|
||||
encounter_ids = { --encounter journal encounter id
|
||||
--> Ids by Index
|
||||
1161, 1202, 1122, 1123, 1155, 1147, 1154, 1162, 1203, 959,
|
||||
|
||||
--> Boss Index
|
||||
[1161] = 1,
|
||||
[1202] = 2,
|
||||
[1122] = 3,
|
||||
[1123] = 4,
|
||||
[1155] = 5,
|
||||
[1147] = 6,
|
||||
[1154] = 7,
|
||||
[1162] = 8,
|
||||
[1203] = 9,
|
||||
[959] = 10,
|
||||
},
|
||||
|
||||
encounter_ids2 = {
|
||||
--combatlog encounter id
|
||||
[1694] = 3, --Beastlord Darmac
|
||||
[1689] = 4, --Flamebender Ka'graz
|
||||
[1693] = 5, --Hans'gar & Franzok
|
||||
[1692] = 6, --Operator Thogar
|
||||
[1713] = 8, --Kromog, Legend of the Mountain
|
||||
[1695] = 9, --The Iron Maidens
|
||||
},
|
||||
|
||||
boss_ids = {
|
||||
--npc ids
|
||||
[12118] = 1, --
|
||||
[11982] = 2, --
|
||||
[12259] = 3, --
|
||||
[12057] = 4, --
|
||||
[12056] = 5, --
|
||||
[12264] = 6, --
|
||||
[12098] = 7, --
|
||||
[11988] = 8, --
|
||||
[12018] = 9, --
|
||||
[11502] = 10, --
|
||||
},
|
||||
|
||||
encounters = {
|
||||
|
||||
[1] = {
|
||||
boss = "Gruul",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Gruul]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[2] = {
|
||||
boss = "Oregorger",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Oregorger]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[3] = {
|
||||
boss = "Beastlord Darmac",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Beastlord Darmac]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[4] = {
|
||||
boss = "Flamebender Ka'graz",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Flamebender Kagraz]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[5] = {
|
||||
boss = "Hans'gar and Franzok",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Franzok]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[6] = {
|
||||
boss = "Operator Thogar",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Operator Thogar]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[7] = {
|
||||
boss = "The Blast Furnace",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-The Blast Furnace]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[8] = {
|
||||
boss = "Kromog, Legend of the Mountain",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Kromog]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[9] = {
|
||||
boss = "The Iron Maidens",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Iron Maidens]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
[10] = {
|
||||
boss = "Blackhand",
|
||||
portrait = [[Interface\ENCOUNTERJOURNAL\UI-EJ-BOSS-Warlord Blackhand]],
|
||||
|
||||
--> spell list
|
||||
continuo = {
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
_detalhes:InstallEncounter (molten_core)
|
||||
|
||||
--function _detalhes:TestResize()
|
||||
-- _detalhes:OpenNewsWindow (_detalhes.resize_debug)
|
||||
--end
|
||||
--_detalhes:ScheduleTimer ("TestResize", 3)
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user