8.3.0 > 9.0.1
This commit is contained in:
@@ -30,3 +30,4 @@ Libs/LibTranslit/.pkgmeta
|
||||
a.lua
|
||||
functions/pack2.lua
|
||||
*.json
|
||||
*.afphoto
|
||||
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
lightweight tag 5bd30e291f18247a7ed005a957407eab6f25176a v8.2.0.7177.140
|
||||
Author: Tercioo <terciob19@hotmail.com>
|
||||
Date: Sat Aug 17 09:50:52 2019 -0300
|
||||
lightweight tag 899ac439a17c19a799d30a6a2a0e2faf5cc215e1 DetailsRetail.8.3.0.7348.141
|
||||
Author: Tercio Jose <terciob19@hotmail.com>
|
||||
Date: Mon Jul 6 11:27:35 2020 -0300
|
||||
|
||||
commit 5bd30e291f18247a7ed005a957407eab6f25176a
|
||||
Author: Tercioo <terciob19@hotmail.com>
|
||||
Date: Sat Aug 17 09:50:52 2019 -0300
|
||||
commit 899ac439a17c19a799d30a6a2a0e2faf5cc215e1
|
||||
Author: Tercio Jose <terciob19@hotmail.com>
|
||||
Date: Mon Jul 6 11:27:35 2020 -0300
|
||||
|
||||
Fixed bookmark panel where sometimes it gives errors, version number correction and fixed the classic version warning.
|
||||
Fixed an issue affecting the Auto Hide for some users
|
||||
|
||||
|
||||
+62
-34
@@ -1,4 +1,4 @@
|
||||
## Interface: 80300
|
||||
## Interface: 90001
|
||||
## Title: Details! Damage Meter
|
||||
## Notes: Essential tool to impress that chick in your raid.
|
||||
## SavedVariables: _detalhes_global
|
||||
@@ -27,13 +27,13 @@ API.lua
|
||||
|
||||
functions\profiles.lua
|
||||
functions\hooks.lua
|
||||
functions\bossmods.lua
|
||||
functions\skins.lua
|
||||
functions\boss.lua
|
||||
functions\spells.lua
|
||||
functions\events.lua
|
||||
functions\classes.lua
|
||||
functions\buff.lua
|
||||
functions\link.lua
|
||||
functions\spellcache.lua
|
||||
functions\attributes.lua
|
||||
functions\savedata.lua
|
||||
@@ -45,46 +45,74 @@ functions\rowanimation.lua
|
||||
functions\raidinfo.lua
|
||||
functions\dungeon.lua
|
||||
functions\pack.lua
|
||||
functions\mythicdungeon.lua
|
||||
functions\immersion.lua
|
||||
functions\schedules.lua
|
||||
functions\autorun.lua
|
||||
functions\deathrecap.lua
|
||||
functions\plater.lua
|
||||
functions\deathmenu.lua
|
||||
functions\macros.lua
|
||||
functions\testbars.lua
|
||||
|
||||
core\timemachine.lua
|
||||
|
||||
gumps\anime.lua
|
||||
gumps\anime.xml
|
||||
gumps\janela_copy.lua
|
||||
gumps\janela_options.lua
|
||||
gumps\janela_info.lua
|
||||
gumps\janela_report.lua
|
||||
gumps\janela_principal.lua
|
||||
gumps\janela_custom.lua
|
||||
gumps\janela_welcome.lua
|
||||
gumps\janela_news.lua
|
||||
gumps\fw_mods.lua
|
||||
gumps\switch.lua
|
||||
gumps\toolbar_button.xml
|
||||
frames\anime.lua
|
||||
frames\anime.xml
|
||||
frames\fw_mods.lua
|
||||
frames\toolbar_button.xml
|
||||
|
||||
classes\classe_error.lua
|
||||
classes\classe_combate.lua
|
||||
classes\classe_damage.lua
|
||||
classes\classe_damage_habilidade.lua
|
||||
classes\classe_heal.lua
|
||||
classes\classe_heal_habilidade.lua
|
||||
classes\classe_energy.lua
|
||||
classes\classe_energy_habilidade.lua
|
||||
classes\classe_others.lua
|
||||
classes\classe_others_habilidade.lua
|
||||
classes\classe_instancia_include.lua
|
||||
classes\classe_instancia.lua
|
||||
classes\classe_target.lua
|
||||
frames\window_copy.lua
|
||||
frames\window_options2.lua
|
||||
frames\window_options2_sections.lua
|
||||
frames\window_api.lua
|
||||
frames\window_playerbreakdown.lua
|
||||
frames\window_playerbreakdown_list.lua
|
||||
frames\window_report.lua
|
||||
frames\window_main.lua
|
||||
frames\window_custom.lua
|
||||
frames\window_welcome.lua
|
||||
frames\window_news.lua
|
||||
frames\window_wa.lua
|
||||
frames\window_forge.lua
|
||||
frames\window_switch.lua
|
||||
frames\window_scrolldamage.lua
|
||||
frames\window_dump.lua
|
||||
frames\window_eventtracker.lua
|
||||
frames\window_currentdps.lua
|
||||
frames\window_benchmark.lua
|
||||
frames\window_runcode.lua
|
||||
frames\window_plater.lua
|
||||
frames\window_macros.lua
|
||||
frames\window_profiler.lua
|
||||
frames\window_rowtexteditor.lua
|
||||
frames\window_brokertexteditor.lua
|
||||
frames\window_bookmark.lua
|
||||
frames\window_classcolor.lua
|
||||
frames\window_statistics.lua
|
||||
|
||||
classes\classe_custom.lua
|
||||
classes\custom_damage_done.lua
|
||||
classes\custom_healing_done.lua
|
||||
classes\class_error.lua
|
||||
classes\class_combat.lua
|
||||
classes\class_damage.lua
|
||||
classes\class_spelldamage.lua
|
||||
classes\class_heal.lua
|
||||
classes\class_spellhealing.lua
|
||||
classes\class_resources.lua
|
||||
classes\class_spellresources.lua
|
||||
classes\class_utility.lua
|
||||
classes\class_spellutility.lua
|
||||
classes\include_instance.lua
|
||||
classes\class_instance.lua
|
||||
|
||||
classes\class_custom.lua
|
||||
classes\custom_damagedone.lua
|
||||
classes\custom_healingdone.lua
|
||||
|
||||
core\control.lua
|
||||
|
||||
classes\container_combatentes.lua
|
||||
classes\container_habilidades.lua
|
||||
classes\container_historico.lua
|
||||
classes\container_actors.lua
|
||||
classes\container_spells.lua
|
||||
classes\container_segments.lua
|
||||
classes\container_pets.lua
|
||||
|
||||
core\plugins.lua
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
--- A bucket to catch events in. **AceBucket-3.0** provides throttling of events that fire in bursts and
|
||||
-- your addon only needs to know about the full burst.
|
||||
--
|
||||
-- This Bucket implementation works as follows:\\
|
||||
-- Initially, no schedule is running, and its waiting for the first event to happen.\\
|
||||
-- The first event will start the bucket, and get the scheduler running, which will collect all
|
||||
-- events in the given interval. When that interval is reached, the bucket is pushed to the
|
||||
-- callback and a new schedule is started. When a bucket is empty after its interval, the scheduler is
|
||||
-- stopped, and the bucket is only listening for the next event to happen, basically back in its initial state.
|
||||
--
|
||||
-- In addition, the buckets collect information about the "arg1" argument of the events that fire, and pass those as a
|
||||
-- table to your callback. This functionality was mostly designed for the UNIT_* events.\\
|
||||
-- The table will have the different values of "arg1" as keys, and the number of occurances as their value, e.g.\\
|
||||
-- { ["player"] = 2, ["target"] = 1, ["party1"] = 1 }
|
||||
--
|
||||
-- **AceBucket-3.0** can be embeded into your addon, either explicitly by calling AceBucket:Embed(MyAddon) or by
|
||||
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
|
||||
-- and can be accessed directly, without having to explicitly call AceBucket itself.\\
|
||||
-- It is recommended to embed AceBucket, otherwise you'll have to specify a custom `self` on all calls you
|
||||
-- make into AceBucket.
|
||||
-- @usage
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("BucketExample", "AceBucket-3.0")
|
||||
--
|
||||
-- function MyAddon:OnEnable()
|
||||
-- -- Register a bucket that listens to all the HP related events,
|
||||
-- -- and fires once per second
|
||||
-- self:RegisterBucketEvent({"UNIT_HEALTH", "UNIT_MAXHEALTH"}, 1, "UpdateHealth")
|
||||
-- end
|
||||
--
|
||||
-- function MyAddon:UpdateHealth(units)
|
||||
-- if units.player then
|
||||
-- print("Your HP changed!")
|
||||
-- end
|
||||
-- end
|
||||
-- @class file
|
||||
-- @name AceBucket-3.0.lua
|
||||
-- @release $Id: AceBucket-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
|
||||
local MAJOR, MINOR = "AceBucket-3.0", 4
|
||||
local AceBucket, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceBucket then return end -- No Upgrade needed
|
||||
|
||||
AceBucket.buckets = AceBucket.buckets or {}
|
||||
AceBucket.embeds = AceBucket.embeds or {}
|
||||
|
||||
-- the libraries will be lazyly bound later, to avoid errors due to loading order issues
|
||||
local AceEvent, AceTimer
|
||||
|
||||
-- Lua APIs
|
||||
local tconcat = table.concat
|
||||
local type, next, pairs, select = type, next, pairs, select
|
||||
local tonumber, tostring, rawset = tonumber, tostring, rawset
|
||||
local assert, loadstring, error = assert, loadstring, error
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub, geterrorhandler
|
||||
|
||||
local bucketCache = setmetatable({}, {__mode='k'})
|
||||
|
||||
--[[
|
||||
xpcall safecall implementation
|
||||
]]
|
||||
local xpcall = xpcall
|
||||
|
||||
local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function safecall(func, ...)
|
||||
if func then
|
||||
return xpcall(func, errorhandler, ...)
|
||||
end
|
||||
end
|
||||
|
||||
-- FireBucket ( bucket )
|
||||
--
|
||||
-- send the bucket to the callback function and schedule the next FireBucket in interval seconds
|
||||
local function FireBucket(bucket)
|
||||
local received = bucket.received
|
||||
|
||||
-- we dont want to fire empty buckets
|
||||
if next(received) ~= nil then
|
||||
local callback = bucket.callback
|
||||
if type(callback) == "string" then
|
||||
safecall(bucket.object[callback], bucket.object, received)
|
||||
else
|
||||
safecall(callback, received)
|
||||
end
|
||||
|
||||
for k in pairs(received) do
|
||||
received[k] = nil
|
||||
end
|
||||
|
||||
-- if the bucket was not empty, schedule another FireBucket in interval seconds
|
||||
bucket.timer = AceTimer.ScheduleTimer(bucket, FireBucket, bucket.interval, bucket)
|
||||
else -- if it was empty, clear the timer and wait for the next event
|
||||
bucket.timer = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- BucketHandler ( event, arg1 )
|
||||
--
|
||||
-- callback func for AceEvent
|
||||
-- stores arg1 in the received table, and schedules the bucket if necessary
|
||||
local function BucketHandler(self, event, arg1)
|
||||
if arg1 == nil then
|
||||
arg1 = "nil"
|
||||
end
|
||||
|
||||
self.received[arg1] = (self.received[arg1] or 0) + 1
|
||||
|
||||
-- if we are not scheduled yet, start a timer on the interval for our bucket to be cleared
|
||||
if not self.timer then
|
||||
self.timer = AceTimer.ScheduleTimer(self, FireBucket, self.interval, self)
|
||||
end
|
||||
end
|
||||
|
||||
-- RegisterBucket( event, interval, callback, isMessage )
|
||||
--
|
||||
-- event(string or table) - the event, or a table with the events, that this bucket listens to
|
||||
-- interval(int) - time between bucket fireings
|
||||
-- callback(func or string) - function pointer, or method name of the object, that gets called when the bucket is cleared
|
||||
-- isMessage(boolean) - register AceEvent Messages instead of game events
|
||||
local function RegisterBucket(self, event, interval, callback, isMessage)
|
||||
-- try to fetch the librarys
|
||||
if not AceEvent or not AceTimer then
|
||||
AceEvent = LibStub:GetLibrary("AceEvent-3.0", true)
|
||||
AceTimer = LibStub:GetLibrary("AceTimer-3.0", true)
|
||||
if not AceEvent or not AceTimer then
|
||||
error(MAJOR .. " requires AceEvent-3.0 and AceTimer-3.0", 3)
|
||||
end
|
||||
end
|
||||
|
||||
if type(event) ~= "string" and type(event) ~= "table" then error("Usage: RegisterBucket(event, interval, callback): 'event' - string or table expected.", 3) end
|
||||
if not callback then
|
||||
if type(event) == "string" then
|
||||
callback = event
|
||||
else
|
||||
error("Usage: RegisterBucket(event, interval, callback): cannot omit callback when event is not a string.", 3)
|
||||
end
|
||||
end
|
||||
if not tonumber(interval) then error("Usage: RegisterBucket(event, interval, callback): 'interval' - number expected.", 3) end
|
||||
if type(callback) ~= "string" and type(callback) ~= "function" then error("Usage: RegisterBucket(event, interval, callback): 'callback' - string or function or nil expected.", 3) end
|
||||
if type(callback) == "string" and type(self[callback]) ~= "function" then error("Usage: RegisterBucket(event, interval, callback): 'callback' - method not found on target object.", 3) end
|
||||
|
||||
local bucket = next(bucketCache)
|
||||
if bucket then
|
||||
bucketCache[bucket] = nil
|
||||
else
|
||||
bucket = { handler = BucketHandler, received = {} }
|
||||
end
|
||||
bucket.object, bucket.callback, bucket.interval = self, callback, tonumber(interval)
|
||||
|
||||
local regFunc = isMessage and AceEvent.RegisterMessage or AceEvent.RegisterEvent
|
||||
|
||||
if type(event) == "table" then
|
||||
for _,e in pairs(event) do
|
||||
regFunc(bucket, e, "handler")
|
||||
end
|
||||
else
|
||||
regFunc(bucket, event, "handler")
|
||||
end
|
||||
|
||||
local handle = tostring(bucket)
|
||||
AceBucket.buckets[handle] = bucket
|
||||
|
||||
return handle
|
||||
end
|
||||
|
||||
--- Register a Bucket for an event (or a set of events)
|
||||
-- @param event The event to listen for, or a table of events.
|
||||
-- @param interval The Bucket interval (burst interval)
|
||||
-- @param callback The callback function, either as a function reference, or a string pointing to a method of the addon object.
|
||||
-- @return The handle of the bucket (for unregistering)
|
||||
-- @usage
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceBucket-3.0")
|
||||
-- MyAddon:RegisterBucketEvent("BAG_UPDATE", 0.2, "UpdateBags")
|
||||
--
|
||||
-- function MyAddon:UpdateBags()
|
||||
-- -- do stuff
|
||||
-- end
|
||||
function AceBucket:RegisterBucketEvent(event, interval, callback)
|
||||
return RegisterBucket(self, event, interval, callback, false)
|
||||
end
|
||||
|
||||
--- Register a Bucket for an AceEvent-3.0 addon message (or a set of messages)
|
||||
-- @param message The message to listen for, or a table of messages.
|
||||
-- @param interval The Bucket interval (burst interval)
|
||||
-- @param callback The callback function, either as a function reference, or a string pointing to a method of the addon object.
|
||||
-- @return The handle of the bucket (for unregistering)
|
||||
-- @usage
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceBucket-3.0")
|
||||
-- MyAddon:RegisterBucketEvent("SomeAddon_InformationMessage", 0.2, "ProcessData")
|
||||
--
|
||||
-- function MyAddon:ProcessData()
|
||||
-- -- do stuff
|
||||
-- end
|
||||
function AceBucket:RegisterBucketMessage(message, interval, callback)
|
||||
return RegisterBucket(self, message, interval, callback, true)
|
||||
end
|
||||
|
||||
--- Unregister any events and messages from the bucket and clear any remaining data.
|
||||
-- @param handle The handle of the bucket as returned by RegisterBucket*
|
||||
function AceBucket:UnregisterBucket(handle)
|
||||
local bucket = AceBucket.buckets[handle]
|
||||
if bucket then
|
||||
AceEvent.UnregisterAllEvents(bucket)
|
||||
AceEvent.UnregisterAllMessages(bucket)
|
||||
|
||||
-- clear any remaining data in the bucket
|
||||
for k in pairs(bucket.received) do
|
||||
bucket.received[k] = nil
|
||||
end
|
||||
|
||||
if bucket.timer then
|
||||
AceTimer.CancelTimer(bucket, bucket.timer)
|
||||
bucket.timer = nil
|
||||
end
|
||||
|
||||
AceBucket.buckets[handle] = nil
|
||||
-- store our bucket in the cache
|
||||
bucketCache[bucket] = true
|
||||
end
|
||||
end
|
||||
|
||||
--- Unregister all buckets of the current addon object (or custom "self").
|
||||
function AceBucket:UnregisterAllBuckets()
|
||||
-- hmm can we do this more efficient? (it is not done often so shouldn't matter much)
|
||||
for handle, bucket in pairs(AceBucket.buckets) do
|
||||
if bucket.object == self then
|
||||
AceBucket.UnregisterBucket(self, handle)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- embedding and embed handling
|
||||
local mixins = {
|
||||
"RegisterBucketEvent",
|
||||
"RegisterBucketMessage",
|
||||
"UnregisterBucket",
|
||||
"UnregisterAllBuckets",
|
||||
}
|
||||
|
||||
-- Embeds AceBucket into the target object making the functions from the mixins list available on target:..
|
||||
-- @param target target object to embed AceBucket in
|
||||
function AceBucket:Embed( target )
|
||||
for _, v in pairs( mixins ) do
|
||||
target[v] = self[v]
|
||||
end
|
||||
self.embeds[target] = true
|
||||
return target
|
||||
end
|
||||
|
||||
function AceBucket:OnEmbedDisable( target )
|
||||
target:UnregisterAllBuckets()
|
||||
end
|
||||
|
||||
for addon in pairs(AceBucket.embeds) do
|
||||
AceBucket:Embed(addon)
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceBucket-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,58 +0,0 @@
|
||||
--- AceConfig-3.0 wrapper library.
|
||||
-- Provides an API to register an options table with the config registry,
|
||||
-- as well as associate it with a slash command.
|
||||
-- @class file
|
||||
-- @name AceConfig-3.0
|
||||
-- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
|
||||
--[[
|
||||
AceConfig-3.0
|
||||
|
||||
Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole.
|
||||
|
||||
]]
|
||||
|
||||
local cfgreg = LibStub("AceConfigRegistry-3.0")
|
||||
local cfgcmd = LibStub("AceConfigCmd-3.0")
|
||||
|
||||
local MAJOR, MINOR = "AceConfig-3.0", 3
|
||||
local AceConfig = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConfig then return end
|
||||
|
||||
--TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true)
|
||||
--TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true)
|
||||
|
||||
-- Lua APIs
|
||||
local pcall, error, type, pairs = pcall, error, type, pairs
|
||||
|
||||
-- -------------------------------------------------------------------
|
||||
-- :RegisterOptionsTable(appName, options, slashcmd, persist)
|
||||
--
|
||||
-- - appName - (string) application name
|
||||
-- - options - table or function ref, see AceConfigRegistry
|
||||
-- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command
|
||||
|
||||
--- Register a option table with the AceConfig registry.
|
||||
-- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly.
|
||||
-- @paramsig appName, options [, slashcmd]
|
||||
-- @param appName The application name for the config table.
|
||||
-- @param options The option table (or a function to generate one on demand). http://www.wowace.com/addons/ace3/pages/ace-config-3-0-options-tables/
|
||||
-- @param slashcmd A slash command to register for the option table, or a table of slash commands.
|
||||
-- @usage
|
||||
-- local AceConfig = LibStub("AceConfig-3.0")
|
||||
-- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"})
|
||||
function AceConfig:RegisterOptionsTable(appName, options, slashcmd)
|
||||
local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options)
|
||||
if not ok then error(msg, 2) end
|
||||
|
||||
if slashcmd then
|
||||
if type(slashcmd) == "table" then
|
||||
for _,cmd in pairs(slashcmd) do
|
||||
cfgcmd:CreateChatCommand(cmd, appName)
|
||||
end
|
||||
else
|
||||
cfgcmd:CreateChatCommand(slashcmd, appName)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Include file="AceConfigRegistry-3.0\AceConfigRegistry-3.0.xml"/>
|
||||
<Include file="AceConfigCmd-3.0\AceConfigCmd-3.0.xml"/>
|
||||
<Include file="AceConfigDialog-3.0\AceConfigDialog-3.0.xml"/>
|
||||
<!--<Include file="AceConfigDropdown-3.0\AceConfigDropdown-3.0.xml"/>-->
|
||||
<Script file="AceConfig-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,794 +0,0 @@
|
||||
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames.
|
||||
-- @class file
|
||||
-- @name AceConfigCmd-3.0
|
||||
-- @release $Id: AceConfigCmd-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
|
||||
--[[
|
||||
AceConfigCmd-3.0
|
||||
|
||||
Handles commandline optionstable access
|
||||
|
||||
REQUIRES: AceConsole-3.0 for command registration (loaded on demand)
|
||||
|
||||
]]
|
||||
|
||||
-- TODO: plugin args
|
||||
|
||||
local cfgreg = LibStub("AceConfigRegistry-3.0")
|
||||
|
||||
local MAJOR, MINOR = "AceConfigCmd-3.0", 14
|
||||
local AceConfigCmd = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConfigCmd then return end
|
||||
|
||||
AceConfigCmd.commands = AceConfigCmd.commands or {}
|
||||
local commands = AceConfigCmd.commands
|
||||
|
||||
local AceConsole -- LoD
|
||||
local AceConsoleName = "AceConsole-3.0"
|
||||
|
||||
-- Lua APIs
|
||||
local strsub, strsplit, strlower, strmatch, strtrim = string.sub, string.split, string.lower, string.match, string.trim
|
||||
local format, tonumber, tostring = string.format, tonumber, tostring
|
||||
local tsort, tinsert = table.sort, table.insert
|
||||
local select, pairs, next, type = select, pairs, next, type
|
||||
local error, assert = error, assert
|
||||
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub, SELECTED_CHAT_FRAME, DEFAULT_CHAT_FRAME
|
||||
|
||||
|
||||
local L = setmetatable({}, { -- TODO: replace with proper locale
|
||||
__index = function(self,k) return k end
|
||||
})
|
||||
|
||||
|
||||
|
||||
local function print(msg)
|
||||
(SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg)
|
||||
end
|
||||
|
||||
-- constants used by getparam() calls below
|
||||
|
||||
local handlertypes = {["table"]=true}
|
||||
local handlermsg = "expected a table"
|
||||
|
||||
local functypes = {["function"]=true, ["string"]=true}
|
||||
local funcmsg = "expected function or member name"
|
||||
|
||||
|
||||
-- pickfirstset() - picks the first non-nil value and returns it
|
||||
|
||||
local function pickfirstset(...)
|
||||
for i=1,select("#",...) do
|
||||
if select(i,...)~=nil then
|
||||
return select(i,...)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- err() - produce real error() regarding malformed options tables etc
|
||||
|
||||
local function err(info,inputpos,msg )
|
||||
local cmdstr=" "..strsub(info.input, 1, inputpos-1)
|
||||
error(MAJOR..": /" ..info[0] ..cmdstr ..": "..(msg or "malformed options table"), 2)
|
||||
end
|
||||
|
||||
|
||||
-- usererr() - produce chatframe message regarding bad slash syntax etc
|
||||
|
||||
local function usererr(info,inputpos,msg )
|
||||
local cmdstr=strsub(info.input, 1, inputpos-1);
|
||||
print("/" ..info[0] .. " "..cmdstr ..": "..(msg or "malformed options table"))
|
||||
end
|
||||
|
||||
|
||||
-- callmethod() - call a given named method (e.g. "get", "set") with given arguments
|
||||
|
||||
local function callmethod(info, inputpos, tab, methodtype, ...)
|
||||
local method = info[methodtype]
|
||||
if not method then
|
||||
err(info, inputpos, "'"..methodtype.."': not set")
|
||||
end
|
||||
|
||||
info.arg = tab.arg
|
||||
info.option = tab
|
||||
info.type = tab.type
|
||||
|
||||
if type(method)=="function" then
|
||||
return method(info, ...)
|
||||
elseif type(method)=="string" then
|
||||
if type(info.handler[method])~="function" then
|
||||
err(info, inputpos, "'"..methodtype.."': '"..method.."' is not a member function of "..tostring(info.handler))
|
||||
end
|
||||
return info.handler[method](info.handler, info, ...)
|
||||
else
|
||||
assert(false) -- type should have already been checked on read
|
||||
end
|
||||
end
|
||||
|
||||
-- callfunction() - call a given named function (e.g. "name", "desc") with given arguments
|
||||
|
||||
local function callfunction(info, tab, methodtype, ...)
|
||||
local method = tab[methodtype]
|
||||
|
||||
info.arg = tab.arg
|
||||
info.option = tab
|
||||
info.type = tab.type
|
||||
|
||||
if type(method)=="function" then
|
||||
return method(info, ...)
|
||||
else
|
||||
assert(false) -- type should have already been checked on read
|
||||
end
|
||||
end
|
||||
|
||||
-- do_final() - do the final step (set/execute) along with validation and confirmation
|
||||
|
||||
local function do_final(info, inputpos, tab, methodtype, ...)
|
||||
if info.validate then
|
||||
local res = callmethod(info,inputpos,tab,"validate",...)
|
||||
if type(res)=="string" then
|
||||
usererr(info, inputpos, "'"..strsub(info.input, inputpos).."' - "..res)
|
||||
return
|
||||
end
|
||||
end
|
||||
-- console ignores .confirm
|
||||
|
||||
callmethod(info,inputpos,tab,methodtype, ...)
|
||||
end
|
||||
|
||||
|
||||
-- getparam() - used by handle() to retreive and store "handler", "get", "set", etc
|
||||
|
||||
local function getparam(info, inputpos, tab, depth, paramname, types, errormsg)
|
||||
local old,oldat = info[paramname], info[paramname.."_at"]
|
||||
local val=tab[paramname]
|
||||
if val~=nil then
|
||||
if val==false then
|
||||
val=nil
|
||||
elseif not types[type(val)] then
|
||||
err(info, inputpos, "'" .. paramname.. "' - "..errormsg)
|
||||
end
|
||||
info[paramname] = val
|
||||
info[paramname.."_at"] = depth
|
||||
end
|
||||
return old,oldat
|
||||
end
|
||||
|
||||
|
||||
-- iterateargs(tab) - custom iterator that iterates both t.args and t.plugins.*
|
||||
local dummytable={}
|
||||
|
||||
local function iterateargs(tab)
|
||||
if not tab.plugins then
|
||||
return pairs(tab.args)
|
||||
end
|
||||
|
||||
local argtabkey,argtab=next(tab.plugins)
|
||||
local v
|
||||
|
||||
return function(_, k)
|
||||
while argtab do
|
||||
k,v = next(argtab, k)
|
||||
if k then return k,v end
|
||||
if argtab==tab.args then
|
||||
argtab=nil
|
||||
else
|
||||
argtabkey,argtab = next(tab.plugins, argtabkey)
|
||||
if not argtabkey then
|
||||
argtab=tab.args
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function checkhidden(info, inputpos, tab)
|
||||
if tab.cmdHidden~=nil then
|
||||
return tab.cmdHidden
|
||||
end
|
||||
local hidden = tab.hidden
|
||||
if type(hidden) == "function" or type(hidden) == "string" then
|
||||
info.hidden = hidden
|
||||
hidden = callmethod(info, inputpos, tab, 'hidden')
|
||||
info.hidden = nil
|
||||
end
|
||||
return hidden
|
||||
end
|
||||
|
||||
local function showhelp(info, inputpos, tab, depth, noHead)
|
||||
if not noHead then
|
||||
print("|cff33ff99"..info.appName.."|r: Arguments to |cffffff78/"..info[0].."|r "..strsub(info.input,1,inputpos-1)..":")
|
||||
end
|
||||
|
||||
local sortTbl = {} -- [1..n]=name
|
||||
local refTbl = {} -- [name]=tableref
|
||||
|
||||
for k,v in iterateargs(tab) do
|
||||
if not refTbl[k] then -- a plugin overriding something in .args
|
||||
tinsert(sortTbl, k)
|
||||
refTbl[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
tsort(sortTbl, function(one, two)
|
||||
local o1 = refTbl[one].order or 100
|
||||
local o2 = refTbl[two].order or 100
|
||||
if type(o1) == "function" or type(o1) == "string" then
|
||||
info.order = o1
|
||||
info[#info+1] = one
|
||||
o1 = callmethod(info, inputpos, refTbl[one], "order")
|
||||
info[#info] = nil
|
||||
info.order = nil
|
||||
end
|
||||
if type(o2) == "function" or type(o1) == "string" then
|
||||
info.order = o2
|
||||
info[#info+1] = two
|
||||
o2 = callmethod(info, inputpos, refTbl[two], "order")
|
||||
info[#info] = nil
|
||||
info.order = nil
|
||||
end
|
||||
if o1<0 and o2<0 then return o1<o2 end
|
||||
if o2<0 then return true end
|
||||
if o1<0 then return false end
|
||||
if o1==o2 then return tostring(one)<tostring(two) end -- compare names
|
||||
return o1<o2
|
||||
end)
|
||||
|
||||
for i = 1, #sortTbl do
|
||||
local k = sortTbl[i]
|
||||
local v = refTbl[k]
|
||||
if not checkhidden(info, inputpos, v) then
|
||||
if v.type ~= "description" and v.type ~= "header" then
|
||||
-- recursively show all inline groups
|
||||
local name, desc = v.name, v.desc
|
||||
if type(name) == "function" then
|
||||
name = callfunction(info, v, 'name')
|
||||
end
|
||||
if type(desc) == "function" then
|
||||
desc = callfunction(info, v, 'desc')
|
||||
end
|
||||
if v.type == "group" and pickfirstset(v.cmdInline, v.inline, false) then
|
||||
print(" "..(desc or name)..":")
|
||||
local oldhandler,oldhandler_at = getparam(info, inputpos, v, depth, "handler", handlertypes, handlermsg)
|
||||
showhelp(info, inputpos, v, depth, true)
|
||||
info.handler,info.handler_at = oldhandler,oldhandler_at
|
||||
else
|
||||
local key = k:gsub(" ", "_")
|
||||
print(" |cffffff78"..key.."|r - "..(desc or name or ""))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function keybindingValidateFunc(text)
|
||||
if text == nil or text == "NONE" then
|
||||
return nil
|
||||
end
|
||||
text = text:upper()
|
||||
local shift, ctrl, alt
|
||||
local modifier
|
||||
while true do
|
||||
if text == "-" then
|
||||
break
|
||||
end
|
||||
modifier, text = strsplit('-', text, 2)
|
||||
if text then
|
||||
if modifier ~= "SHIFT" and modifier ~= "CTRL" and modifier ~= "ALT" then
|
||||
return false
|
||||
end
|
||||
if modifier == "SHIFT" then
|
||||
if shift then
|
||||
return false
|
||||
end
|
||||
shift = true
|
||||
end
|
||||
if modifier == "CTRL" then
|
||||
if ctrl then
|
||||
return false
|
||||
end
|
||||
ctrl = true
|
||||
end
|
||||
if modifier == "ALT" then
|
||||
if alt then
|
||||
return false
|
||||
end
|
||||
alt = true
|
||||
end
|
||||
else
|
||||
text = modifier
|
||||
break
|
||||
end
|
||||
end
|
||||
if text == "" then
|
||||
return false
|
||||
end
|
||||
if not text:find("^F%d+$") and text ~= "CAPSLOCK" and text:len() ~= 1 and (text:byte() < 128 or text:len() > 4) and not _G["KEY_" .. text] then
|
||||
return false
|
||||
end
|
||||
local s = text
|
||||
if shift then
|
||||
s = "SHIFT-" .. s
|
||||
end
|
||||
if ctrl then
|
||||
s = "CTRL-" .. s
|
||||
end
|
||||
if alt then
|
||||
s = "ALT-" .. s
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
-- handle() - selfrecursing function that processes input->optiontable
|
||||
-- - depth - starts at 0
|
||||
-- - retfalse - return false rather than produce error if a match is not found (used by inlined groups)
|
||||
|
||||
local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
if not(type(tab)=="table" and type(tab.type)=="string") then err(info,inputpos) end
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Grab hold of handler,set,get,func,etc if set (and remember old ones)
|
||||
-- Note that we do NOT validate if method names are correct at this stage,
|
||||
-- the handler may change before they're actually used!
|
||||
|
||||
local oldhandler,oldhandler_at = getparam(info,inputpos,tab,depth,"handler",handlertypes,handlermsg)
|
||||
local oldset,oldset_at = getparam(info,inputpos,tab,depth,"set",functypes,funcmsg)
|
||||
local oldget,oldget_at = getparam(info,inputpos,tab,depth,"get",functypes,funcmsg)
|
||||
local oldfunc,oldfunc_at = getparam(info,inputpos,tab,depth,"func",functypes,funcmsg)
|
||||
local oldvalidate,oldvalidate_at = getparam(info,inputpos,tab,depth,"validate",functypes,funcmsg)
|
||||
--local oldconfirm,oldconfirm_at = getparam(info,inputpos,tab,depth,"confirm",functypes,funcmsg)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Act according to .type of this table
|
||||
|
||||
if tab.type=="group" then
|
||||
------------ group --------------------------------------------
|
||||
|
||||
if type(tab.args)~="table" then err(info, inputpos) end
|
||||
if tab.plugins and type(tab.plugins)~="table" then err(info,inputpos) end
|
||||
|
||||
-- grab next arg from input
|
||||
local _,nextpos,arg = (info.input):find(" *([^ ]+) *", inputpos)
|
||||
if not arg then
|
||||
showhelp(info, inputpos, tab, depth)
|
||||
return
|
||||
end
|
||||
nextpos=nextpos+1
|
||||
|
||||
-- loop .args and try to find a key with a matching name
|
||||
for k,v in iterateargs(tab) do
|
||||
if not(type(k)=="string" and type(v)=="table" and type(v.type)=="string") then err(info,inputpos, "options table child '"..tostring(k).."' is malformed") end
|
||||
|
||||
-- is this child an inline group? if so, traverse into it
|
||||
if v.type=="group" and pickfirstset(v.cmdInline, v.inline, false) then
|
||||
info[depth+1] = k
|
||||
if handle(info, inputpos, v, depth+1, true)==false then
|
||||
info[depth+1] = nil
|
||||
-- wasn't found in there, but that's ok, we just keep looking down here
|
||||
else
|
||||
return -- done, name was found in inline group
|
||||
end
|
||||
-- matching name and not a inline group
|
||||
elseif strlower(arg)==strlower(k:gsub(" ", "_")) then
|
||||
info[depth+1] = k
|
||||
return handle(info,nextpos,v,depth+1)
|
||||
end
|
||||
end
|
||||
|
||||
-- no match
|
||||
if retfalse then
|
||||
-- restore old infotable members and return false to indicate failure
|
||||
info.handler,info.handler_at = oldhandler,oldhandler_at
|
||||
info.set,info.set_at = oldset,oldset_at
|
||||
info.get,info.get_at = oldget,oldget_at
|
||||
info.func,info.func_at = oldfunc,oldfunc_at
|
||||
info.validate,info.validate_at = oldvalidate,oldvalidate_at
|
||||
--info.confirm,info.confirm_at = oldconfirm,oldconfirm_at
|
||||
return false
|
||||
end
|
||||
|
||||
-- couldn't find the command, display error
|
||||
usererr(info, inputpos, "'"..arg.."' - " .. L["unknown argument"])
|
||||
return
|
||||
end
|
||||
|
||||
local str = strsub(info.input,inputpos);
|
||||
|
||||
if tab.type=="execute" then
|
||||
------------ execute --------------------------------------------
|
||||
do_final(info, inputpos, tab, "func")
|
||||
|
||||
|
||||
|
||||
elseif tab.type=="input" then
|
||||
------------ input --------------------------------------------
|
||||
|
||||
local res = true
|
||||
if tab.pattern then
|
||||
if not(type(tab.pattern)=="string") then err(info, inputpos, "'pattern' - expected a string") end
|
||||
if not strmatch(str, tab.pattern) then
|
||||
usererr(info, inputpos, "'"..str.."' - " .. L["invalid input"])
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", str)
|
||||
|
||||
|
||||
|
||||
elseif tab.type=="toggle" then
|
||||
------------ toggle --------------------------------------------
|
||||
local b
|
||||
local str = strtrim(strlower(str))
|
||||
if str=="" then
|
||||
b = callmethod(info, inputpos, tab, "get")
|
||||
|
||||
if tab.tristate then
|
||||
--cycle in true, nil, false order
|
||||
if b then
|
||||
b = nil
|
||||
elseif b == nil then
|
||||
b = false
|
||||
else
|
||||
b = true
|
||||
end
|
||||
else
|
||||
b = not b
|
||||
end
|
||||
|
||||
elseif str==L["on"] then
|
||||
b = true
|
||||
elseif str==L["off"] then
|
||||
b = false
|
||||
elseif tab.tristate and str==L["default"] then
|
||||
b = nil
|
||||
else
|
||||
if tab.tristate then
|
||||
usererr(info, inputpos, format(L["'%s' - expected 'on', 'off' or 'default', or no argument to toggle."], str))
|
||||
else
|
||||
usererr(info, inputpos, format(L["'%s' - expected 'on' or 'off', or no argument to toggle."], str))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", b)
|
||||
|
||||
|
||||
elseif tab.type=="range" then
|
||||
------------ range --------------------------------------------
|
||||
local val = tonumber(str)
|
||||
if not val then
|
||||
usererr(info, inputpos, "'"..str.."' - "..L["expected number"])
|
||||
return
|
||||
end
|
||||
if type(info.step)=="number" then
|
||||
val = val- (val % info.step)
|
||||
end
|
||||
if type(info.min)=="number" and val<info.min then
|
||||
usererr(info, inputpos, val.." - "..format(L["must be equal to or higher than %s"], tostring(info.min)) )
|
||||
return
|
||||
end
|
||||
if type(info.max)=="number" and val>info.max then
|
||||
usererr(info, inputpos, val.." - "..format(L["must be equal to or lower than %s"], tostring(info.max)) )
|
||||
return
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", val)
|
||||
|
||||
|
||||
elseif tab.type=="select" then
|
||||
------------ select ------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
|
||||
local values = tab.values
|
||||
if type(values) == "function" or type(values) == "string" then
|
||||
info.values = values
|
||||
values = callmethod(info, inputpos, tab, "values")
|
||||
info.values = nil
|
||||
end
|
||||
|
||||
if str == "" then
|
||||
local b = callmethod(info, inputpos, tab, "get")
|
||||
local fmt = "|cffffff78- [%s]|r %s"
|
||||
local fmt_sel = "|cffffff78- [%s]|r %s |cffff0000*|r"
|
||||
print(L["Options for |cffffff78"..info[#info].."|r:"])
|
||||
for k, v in pairs(values) do
|
||||
if b == k then
|
||||
print(fmt_sel:format(k, v))
|
||||
else
|
||||
print(fmt:format(k, v))
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local ok
|
||||
for k,v in pairs(values) do
|
||||
if strlower(k)==str then
|
||||
str = k -- overwrite with key (in case of case mismatches)
|
||||
ok = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not ok then
|
||||
usererr(info, inputpos, "'"..str.."' - "..L["unknown selection"])
|
||||
return
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", str)
|
||||
|
||||
elseif tab.type=="multiselect" then
|
||||
------------ multiselect -------------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
|
||||
local values = tab.values
|
||||
if type(values) == "function" or type(values) == "string" then
|
||||
info.values = values
|
||||
values = callmethod(info, inputpos, tab, "values")
|
||||
info.values = nil
|
||||
end
|
||||
|
||||
if str == "" then
|
||||
local fmt = "|cffffff78- [%s]|r %s"
|
||||
local fmt_sel = "|cffffff78- [%s]|r %s |cffff0000*|r"
|
||||
print(L["Options for |cffffff78"..info[#info].."|r (multiple possible):"])
|
||||
for k, v in pairs(values) do
|
||||
if callmethod(info, inputpos, tab, "get", k) then
|
||||
print(fmt_sel:format(k, v))
|
||||
else
|
||||
print(fmt:format(k, v))
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
--build a table of the selections, checking that they exist
|
||||
--parse for =on =off =default in the process
|
||||
--table will be key = true for options that should toggle, key = [on|off|default] for options to be set
|
||||
local sels = {}
|
||||
for v in str:gmatch("[^ ]+") do
|
||||
--parse option=on etc
|
||||
local opt, val = v:match('(.+)=(.+)')
|
||||
--get option if toggling
|
||||
if not opt then
|
||||
opt = v
|
||||
end
|
||||
|
||||
--check that the opt is valid
|
||||
local ok
|
||||
for k,v in pairs(values) do
|
||||
if strlower(k)==opt then
|
||||
opt = k -- overwrite with key (in case of case mismatches)
|
||||
ok = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not ok then
|
||||
usererr(info, inputpos, "'"..opt.."' - "..L["unknown selection"])
|
||||
return
|
||||
end
|
||||
|
||||
--check that if val was supplied it is valid
|
||||
if val then
|
||||
if val == L["on"] or val == L["off"] or (tab.tristate and val == L["default"]) then
|
||||
--val is valid insert it
|
||||
sels[opt] = val
|
||||
else
|
||||
if tab.tristate then
|
||||
usererr(info, inputpos, format(L["'%s' '%s' - expected 'on', 'off' or 'default', or no argument to toggle."], v, val))
|
||||
else
|
||||
usererr(info, inputpos, format(L["'%s' '%s' - expected 'on' or 'off', or no argument to toggle."], v, val))
|
||||
end
|
||||
return
|
||||
end
|
||||
else
|
||||
-- no val supplied, toggle
|
||||
sels[opt] = true
|
||||
end
|
||||
end
|
||||
|
||||
for opt, val in pairs(sels) do
|
||||
local newval
|
||||
|
||||
if (val == true) then
|
||||
--toggle the option
|
||||
local b = callmethod(info, inputpos, tab, "get", opt)
|
||||
|
||||
if tab.tristate then
|
||||
--cycle in true, nil, false order
|
||||
if b then
|
||||
b = nil
|
||||
elseif b == nil then
|
||||
b = false
|
||||
else
|
||||
b = true
|
||||
end
|
||||
else
|
||||
b = not b
|
||||
end
|
||||
newval = b
|
||||
else
|
||||
--set the option as specified
|
||||
if val==L["on"] then
|
||||
newval = true
|
||||
elseif val==L["off"] then
|
||||
newval = false
|
||||
elseif val==L["default"] then
|
||||
newval = nil
|
||||
end
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", opt, newval)
|
||||
end
|
||||
|
||||
|
||||
elseif tab.type=="color" then
|
||||
------------ color --------------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
if str == "" then
|
||||
--TODO: Show current value
|
||||
return
|
||||
end
|
||||
|
||||
local r, g, b, a
|
||||
|
||||
local hasAlpha = tab.hasAlpha
|
||||
if type(hasAlpha) == "function" or type(hasAlpha) == "string" then
|
||||
info.hasAlpha = hasAlpha
|
||||
hasAlpha = callmethod(info, inputpos, tab, 'hasAlpha')
|
||||
info.hasAlpha = nil
|
||||
end
|
||||
|
||||
if hasAlpha then
|
||||
if str:len() == 8 and str:find("^%x*$") then
|
||||
--parse a hex string
|
||||
r,g,b,a = tonumber(str:sub(1, 2), 16) / 255, tonumber(str:sub(3, 4), 16) / 255, tonumber(str:sub(5, 6), 16) / 255, tonumber(str:sub(7, 8), 16) / 255
|
||||
else
|
||||
--parse seperate values
|
||||
r,g,b,a = str:match("^([%d%.]+) ([%d%.]+) ([%d%.]+) ([%d%.]+)$")
|
||||
r,g,b,a = tonumber(r), tonumber(g), tonumber(b), tonumber(a)
|
||||
end
|
||||
if not (r and g and b and a) then
|
||||
usererr(info, inputpos, format(L["'%s' - expected 'RRGGBBAA' or 'r g b a'."], str))
|
||||
return
|
||||
end
|
||||
|
||||
if r >= 0.0 and r <= 1.0 and g >= 0.0 and g <= 1.0 and b >= 0.0 and b <= 1.0 and a >= 0.0 and a <= 1.0 then
|
||||
--values are valid
|
||||
elseif r >= 0 and r <= 255 and g >= 0 and g <= 255 and b >= 0 and b <= 255 and a >= 0 and a <= 255 then
|
||||
--values are valid 0..255, convert to 0..1
|
||||
r = r / 255
|
||||
g = g / 255
|
||||
b = b / 255
|
||||
a = a / 255
|
||||
else
|
||||
--values are invalid
|
||||
usererr(info, inputpos, format(L["'%s' - values must all be either in the range 0..1 or 0..255."], str))
|
||||
end
|
||||
else
|
||||
a = 1.0
|
||||
if str:len() == 6 and str:find("^%x*$") then
|
||||
--parse a hex string
|
||||
r,g,b = tonumber(str:sub(1, 2), 16) / 255, tonumber(str:sub(3, 4), 16) / 255, tonumber(str:sub(5, 6), 16) / 255
|
||||
else
|
||||
--parse seperate values
|
||||
r,g,b = str:match("^([%d%.]+) ([%d%.]+) ([%d%.]+)$")
|
||||
r,g,b = tonumber(r), tonumber(g), tonumber(b)
|
||||
end
|
||||
if not (r and g and b) then
|
||||
usererr(info, inputpos, format(L["'%s' - expected 'RRGGBB' or 'r g b'."], str))
|
||||
return
|
||||
end
|
||||
if r >= 0.0 and r <= 1.0 and g >= 0.0 and g <= 1.0 and b >= 0.0 and b <= 1.0 then
|
||||
--values are valid
|
||||
elseif r >= 0 and r <= 255 and g >= 0 and g <= 255 and b >= 0 and b <= 255 then
|
||||
--values are valid 0..255, convert to 0..1
|
||||
r = r / 255
|
||||
g = g / 255
|
||||
b = b / 255
|
||||
else
|
||||
--values are invalid
|
||||
usererr(info, inputpos, format(L["'%s' - values must all be either in the range 0-1 or 0-255."], str))
|
||||
end
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", r,g,b,a)
|
||||
|
||||
elseif tab.type=="keybinding" then
|
||||
------------ keybinding --------------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
if str == "" then
|
||||
--TODO: Show current value
|
||||
return
|
||||
end
|
||||
local value = keybindingValidateFunc(str:upper())
|
||||
if value == false then
|
||||
usererr(info, inputpos, format(L["'%s' - Invalid Keybinding."], str))
|
||||
return
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", value)
|
||||
|
||||
elseif tab.type=="description" then
|
||||
------------ description --------------------
|
||||
-- ignore description, GUI config only
|
||||
else
|
||||
err(info, inputpos, "unknown options table item type '"..tostring(tab.type).."'")
|
||||
end
|
||||
end
|
||||
|
||||
--- Handle the chat command.
|
||||
-- This is usually called from a chat command handler to parse the command input as operations on an aceoptions table.\\
|
||||
-- AceConfigCmd uses this function internally when a slash command is registered with `:CreateChatCommand`
|
||||
-- @param slashcmd The slash command WITHOUT leading slash (only used for error output)
|
||||
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
||||
-- @param input The commandline input (as given by the WoW handler, i.e. without the command itself)
|
||||
-- @usage
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceConsole-3.0")
|
||||
-- -- Use AceConsole-3.0 to register a Chat Command
|
||||
-- MyAddon:RegisterChatCommand("mychat", "ChatCommand")
|
||||
--
|
||||
-- -- Show the GUI if no input is supplied, otherwise handle the chat input.
|
||||
-- function MyAddon:ChatCommand(input)
|
||||
-- -- Assuming "MyOptions" is the appName of a valid options table
|
||||
-- if not input or input:trim() == "" then
|
||||
-- LibStub("AceConfigDialog-3.0"):Open("MyOptions")
|
||||
-- else
|
||||
-- LibStub("AceConfigCmd-3.0").HandleCommand(MyAddon, "mychat", "MyOptions", input)
|
||||
-- end
|
||||
-- end
|
||||
function AceConfigCmd:HandleCommand(slashcmd, appName, input)
|
||||
|
||||
local optgetter = cfgreg:GetOptionsTable(appName)
|
||||
if not optgetter then
|
||||
error([[Usage: HandleCommand("slashcmd", "appName", "input"): 'appName' - no options table "]]..tostring(appName)..[[" has been registered]], 2)
|
||||
end
|
||||
local options = assert( optgetter("cmd", MAJOR) )
|
||||
|
||||
local info = { -- Don't try to recycle this, it gets handed off to callbacks and whatnot
|
||||
[0] = slashcmd,
|
||||
appName = appName,
|
||||
options = options,
|
||||
input = input,
|
||||
self = self,
|
||||
handler = self,
|
||||
uiType = "cmd",
|
||||
uiName = MAJOR,
|
||||
}
|
||||
|
||||
handle(info, 1, options, 0) -- (info, inputpos, table, depth)
|
||||
end
|
||||
|
||||
--- Utility function to create a slash command handler.
|
||||
-- Also registers tab completion with AceTab
|
||||
-- @param slashcmd The slash command WITHOUT leading slash (only used for error output)
|
||||
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
||||
function AceConfigCmd:CreateChatCommand(slashcmd, appName)
|
||||
if not AceConsole then
|
||||
AceConsole = LibStub(AceConsoleName)
|
||||
end
|
||||
if AceConsole.RegisterChatCommand(self, slashcmd, function(input)
|
||||
AceConfigCmd.HandleCommand(self, slashcmd, appName, input) -- upgradable
|
||||
end,
|
||||
true) then -- succesfully registered so lets get the command -> app table in
|
||||
commands[slashcmd] = appName
|
||||
end
|
||||
end
|
||||
|
||||
--- Utility function that returns the options table that belongs to a slashcommand.
|
||||
-- Designed to be used for the AceTab interface.
|
||||
-- @param slashcmd The slash command WITHOUT leading slash (only used for error output)
|
||||
-- @return The options table associated with the slash command (or nil if the slash command was not registered)
|
||||
function AceConfigCmd:GetChatCommandOptions(slashcmd)
|
||||
return commands[slashcmd]
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceConfigCmd-3.0.lua"/>
|
||||
</Ui>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceConfigDialog-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,371 +0,0 @@
|
||||
--- AceConfigRegistry-3.0 handles central registration of options tables in use by addons and modules.\\
|
||||
-- Options tables can be registered as raw tables, OR as function refs that return a table.\\
|
||||
-- Such functions receive three arguments: "uiType", "uiName", "appName". \\
|
||||
-- * Valid **uiTypes**: "cmd", "dropdown", "dialog". This is verified by the library at call time. \\
|
||||
-- * The **uiName** field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.\\
|
||||
-- * The **appName** field is the options table name as given at registration time \\
|
||||
--
|
||||
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName".
|
||||
-- @class file
|
||||
-- @name AceConfigRegistry-3.0
|
||||
-- @release $Id: AceConfigRegistry-3.0.lua 1207 2019-06-23 12:08:33Z nevcairiel $
|
||||
local CallbackHandler = LibStub("CallbackHandler-1.0")
|
||||
|
||||
local MAJOR, MINOR = "AceConfigRegistry-3.0", 20
|
||||
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConfigRegistry then return end
|
||||
|
||||
AceConfigRegistry.tables = AceConfigRegistry.tables or {}
|
||||
|
||||
if not AceConfigRegistry.callbacks then
|
||||
AceConfigRegistry.callbacks = CallbackHandler:New(AceConfigRegistry)
|
||||
end
|
||||
|
||||
-- Lua APIs
|
||||
local tinsert, tconcat = table.insert, table.concat
|
||||
local strfind, strmatch = string.find, string.match
|
||||
local type, tostring, select, pairs = type, tostring, select, pairs
|
||||
local error, assert = error, assert
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- Validating options table consistency:
|
||||
|
||||
|
||||
AceConfigRegistry.validated = {
|
||||
-- list of options table names ran through :ValidateOptionsTable automatically.
|
||||
-- CLEARED ON PURPOSE, since newer versions may have newer validators
|
||||
cmd = {},
|
||||
dropdown = {},
|
||||
dialog = {},
|
||||
}
|
||||
|
||||
|
||||
|
||||
local function err(msg, errlvl, ...)
|
||||
local t = {}
|
||||
for i=select("#",...),1,-1 do
|
||||
tinsert(t, (select(i, ...)))
|
||||
end
|
||||
error(MAJOR..":ValidateOptionsTable(): "..tconcat(t,".")..msg, errlvl+2)
|
||||
end
|
||||
|
||||
|
||||
local isstring={["string"]=true, _="string"}
|
||||
local isstringfunc={["string"]=true,["function"]=true, _="string or funcref"}
|
||||
local istable={["table"]=true, _="table"}
|
||||
local ismethodtable={["table"]=true,["string"]=true,["function"]=true, _="methodname, funcref or table"}
|
||||
local optstring={["nil"]=true,["string"]=true, _="string"}
|
||||
local optstringfunc={["nil"]=true,["string"]=true,["function"]=true, _="string or funcref"}
|
||||
local optstringnumberfunc={["nil"]=true,["string"]=true,["number"]=true,["function"]=true, _="string, number or funcref"}
|
||||
local optnumber={["nil"]=true,["number"]=true, _="number"}
|
||||
local optmethodfalse={["nil"]=true,["string"]=true,["function"]=true,["boolean"]={[false]=true}, _="methodname, funcref or false"}
|
||||
local optmethodnumber={["nil"]=true,["string"]=true,["function"]=true,["number"]=true, _="methodname, funcref or number"}
|
||||
local optmethodtable={["nil"]=true,["string"]=true,["function"]=true,["table"]=true, _="methodname, funcref or table"}
|
||||
local optmethodbool={["nil"]=true,["string"]=true,["function"]=true,["boolean"]=true, _="methodname, funcref or boolean"}
|
||||
local opttable={["nil"]=true,["table"]=true, _="table"}
|
||||
local optbool={["nil"]=true,["boolean"]=true, _="boolean"}
|
||||
local optboolnumber={["nil"]=true,["boolean"]=true,["number"]=true, _="boolean or number"}
|
||||
local optstringnumber={["nil"]=true,["string"]=true,["number"]=true, _="string or number"}
|
||||
|
||||
local basekeys={
|
||||
type=isstring,
|
||||
name=isstringfunc,
|
||||
desc=optstringfunc,
|
||||
descStyle=optstring,
|
||||
order=optmethodnumber,
|
||||
validate=optmethodfalse,
|
||||
confirm=optmethodbool,
|
||||
confirmText=optstring,
|
||||
disabled=optmethodbool,
|
||||
hidden=optmethodbool,
|
||||
guiHidden=optmethodbool,
|
||||
dialogHidden=optmethodbool,
|
||||
dropdownHidden=optmethodbool,
|
||||
cmdHidden=optmethodbool,
|
||||
icon=optstringnumberfunc,
|
||||
iconCoords=optmethodtable,
|
||||
handler=opttable,
|
||||
get=optmethodfalse,
|
||||
set=optmethodfalse,
|
||||
func=optmethodfalse,
|
||||
arg={["*"]=true},
|
||||
width=optstringnumber,
|
||||
}
|
||||
|
||||
local typedkeys={
|
||||
header={
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
description={
|
||||
image=optstringnumberfunc,
|
||||
imageCoords=optmethodtable,
|
||||
imageHeight=optnumber,
|
||||
imageWidth=optnumber,
|
||||
fontSize=optstringfunc,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
group={
|
||||
args=istable,
|
||||
plugins=opttable,
|
||||
inline=optbool,
|
||||
cmdInline=optbool,
|
||||
guiInline=optbool,
|
||||
dropdownInline=optbool,
|
||||
dialogInline=optbool,
|
||||
childGroups=optstring,
|
||||
},
|
||||
execute={
|
||||
image=optstringnumberfunc,
|
||||
imageCoords=optmethodtable,
|
||||
imageHeight=optnumber,
|
||||
imageWidth=optnumber,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
input={
|
||||
pattern=optstring,
|
||||
usage=optstring,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
multiline=optboolnumber,
|
||||
},
|
||||
toggle={
|
||||
tristate=optbool,
|
||||
image=optstringnumberfunc,
|
||||
imageCoords=optmethodtable,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
tristate={
|
||||
},
|
||||
range={
|
||||
min=optnumber,
|
||||
softMin=optnumber,
|
||||
max=optnumber,
|
||||
softMax=optnumber,
|
||||
step=optnumber,
|
||||
bigStep=optnumber,
|
||||
isPercent=optbool,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
select={
|
||||
values=ismethodtable,
|
||||
sorting=optmethodtable,
|
||||
style={
|
||||
["nil"]=true,
|
||||
["string"]={dropdown=true,radio=true},
|
||||
_="string: 'dropdown' or 'radio'"
|
||||
},
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
itemControl=optstring,
|
||||
},
|
||||
multiselect={
|
||||
values=ismethodtable,
|
||||
style=optstring,
|
||||
tristate=optbool,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
color={
|
||||
hasAlpha=optmethodbool,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
keybinding={
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
}
|
||||
|
||||
local function validateKey(k,errlvl,...)
|
||||
errlvl=(errlvl or 0)+1
|
||||
if type(k)~="string" then
|
||||
err("["..tostring(k).."] - key is not a string", errlvl,...)
|
||||
end
|
||||
if strfind(k, "[%c\127]") then
|
||||
err("["..tostring(k).."] - key name contained control characters", errlvl,...)
|
||||
end
|
||||
end
|
||||
|
||||
local function validateVal(v, oktypes, errlvl,...)
|
||||
errlvl=(errlvl or 0)+1
|
||||
local isok=oktypes[type(v)] or oktypes["*"]
|
||||
|
||||
if not isok then
|
||||
err(": expected a "..oktypes._..", got '"..tostring(v).."'", errlvl,...)
|
||||
end
|
||||
if type(isok)=="table" then -- isok was a table containing specific values to be tested for!
|
||||
if not isok[v] then
|
||||
err(": did not expect "..type(v).." value '"..tostring(v).."'", errlvl,...)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function validate(options,errlvl,...)
|
||||
errlvl=(errlvl or 0)+1
|
||||
-- basic consistency
|
||||
if type(options)~="table" then
|
||||
err(": expected a table, got a "..type(options), errlvl,...)
|
||||
end
|
||||
if type(options.type)~="string" then
|
||||
err(".type: expected a string, got a "..type(options.type), errlvl,...)
|
||||
end
|
||||
|
||||
-- get type and 'typedkeys' member
|
||||
local tk = typedkeys[options.type]
|
||||
if not tk then
|
||||
err(".type: unknown type '"..options.type.."'", errlvl,...)
|
||||
end
|
||||
|
||||
-- make sure that all options[] are known parameters
|
||||
for k,v in pairs(options) do
|
||||
if not (tk[k] or basekeys[k]) then
|
||||
err(": unknown parameter", errlvl,tostring(k),...)
|
||||
end
|
||||
end
|
||||
|
||||
-- verify that required params are there, and that everything is the right type
|
||||
for k,oktypes in pairs(basekeys) do
|
||||
validateVal(options[k], oktypes, errlvl,k,...)
|
||||
end
|
||||
for k,oktypes in pairs(tk) do
|
||||
validateVal(options[k], oktypes, errlvl,k,...)
|
||||
end
|
||||
|
||||
-- extra logic for groups
|
||||
if options.type=="group" then
|
||||
for k,v in pairs(options.args) do
|
||||
validateKey(k,errlvl,"args",...)
|
||||
validate(v, errlvl,k,"args",...)
|
||||
end
|
||||
if options.plugins then
|
||||
for plugname,plugin in pairs(options.plugins) do
|
||||
if type(plugin)~="table" then
|
||||
err(": expected a table, got '"..tostring(plugin).."'", errlvl,tostring(plugname),"plugins",...)
|
||||
end
|
||||
for k,v in pairs(plugin) do
|
||||
validateKey(k,errlvl,tostring(plugname),"plugins",...)
|
||||
validate(v, errlvl,k,tostring(plugname),"plugins",...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Validates basic structure and integrity of an options table \\
|
||||
-- Does NOT verify that get/set etc actually exist, since they can be defined at any depth
|
||||
-- @param options The table to be validated
|
||||
-- @param name The name of the table to be validated (shown in any error message)
|
||||
-- @param errlvl (optional number) error level offset, default 0 (=errors point to the function calling :ValidateOptionsTable)
|
||||
function AceConfigRegistry:ValidateOptionsTable(options,name,errlvl)
|
||||
errlvl=(errlvl or 0)+1
|
||||
name = name or "Optionstable"
|
||||
if not options.name then
|
||||
options.name=name -- bit of a hack, the root level doesn't really need a .name :-/
|
||||
end
|
||||
validate(options,errlvl,name)
|
||||
end
|
||||
|
||||
--- Fires a "ConfigTableChange" callback for those listening in on it, allowing config GUIs to refresh.
|
||||
-- You should call this function if your options table changed from any outside event, like a game event
|
||||
-- or a timer.
|
||||
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
||||
function AceConfigRegistry:NotifyChange(appName)
|
||||
if not AceConfigRegistry.tables[appName] then return end
|
||||
AceConfigRegistry.callbacks:Fire("ConfigTableChange", appName)
|
||||
end
|
||||
|
||||
-- -------------------------------------------------------------------
|
||||
-- Registering and retreiving options tables:
|
||||
|
||||
|
||||
-- validateGetterArgs: helper function for :GetOptionsTable (or, rather, the getter functions returned by it)
|
||||
|
||||
local function validateGetterArgs(uiType, uiName, errlvl)
|
||||
errlvl=(errlvl or 0)+2
|
||||
if uiType~="cmd" and uiType~="dropdown" and uiType~="dialog" then
|
||||
error(MAJOR..": Requesting options table: 'uiType' - invalid configuration UI type, expected 'cmd', 'dropdown' or 'dialog'", errlvl)
|
||||
end
|
||||
if not strmatch(uiName, "[A-Za-z]%-[0-9]") then -- Expecting e.g. "MyLib-1.2"
|
||||
error(MAJOR..": Requesting options table: 'uiName' - badly formatted or missing version number. Expected e.g. 'MyLib-1.2'", errlvl)
|
||||
end
|
||||
end
|
||||
|
||||
--- Register an options table with the config registry.
|
||||
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
||||
-- @param options The options table, OR a function reference that generates it on demand. \\
|
||||
-- See the top of the page for info on arguments passed to such functions.
|
||||
-- @param skipValidation Skip options table validation (primarily useful for extremely huge options, with a noticeable slowdown)
|
||||
function AceConfigRegistry:RegisterOptionsTable(appName, options, skipValidation)
|
||||
if type(options)=="table" then
|
||||
if options.type~="group" then -- quick sanity checker
|
||||
error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - missing type='group' member in root group", 2)
|
||||
end
|
||||
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl)
|
||||
errlvl=(errlvl or 0)+1
|
||||
validateGetterArgs(uiType, uiName, errlvl)
|
||||
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then
|
||||
AceConfigRegistry:ValidateOptionsTable(options, appName, errlvl) -- upgradable
|
||||
AceConfigRegistry.validated[uiType][appName] = true
|
||||
end
|
||||
return options
|
||||
end
|
||||
elseif type(options)=="function" then
|
||||
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl)
|
||||
errlvl=(errlvl or 0)+1
|
||||
validateGetterArgs(uiType, uiName, errlvl)
|
||||
local tab = assert(options(uiType, uiName, appName))
|
||||
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then
|
||||
AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable
|
||||
AceConfigRegistry.validated[uiType][appName] = true
|
||||
end
|
||||
return tab
|
||||
end
|
||||
else
|
||||
error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - expected table or function reference", 2)
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns an iterator of ["appName"]=funcref pairs
|
||||
function AceConfigRegistry:IterateOptionsTables()
|
||||
return pairs(AceConfigRegistry.tables)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--- Query the registry for a specific options table.
|
||||
-- If only appName is given, a function is returned which you
|
||||
-- can call with (uiType,uiName) to get the table.\\
|
||||
-- If uiType&uiName are given, the table is returned.
|
||||
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
||||
-- @param uiType The type of UI to get the table for, one of "cmd", "dropdown", "dialog"
|
||||
-- @param uiName The name of the library/addon querying for the table, e.g. "MyLib-1.0"
|
||||
function AceConfigRegistry:GetOptionsTable(appName, uiType, uiName)
|
||||
local f = AceConfigRegistry.tables[appName]
|
||||
if not f then
|
||||
return nil
|
||||
end
|
||||
|
||||
if uiType then
|
||||
return f(uiType,uiName,1) -- get the table for us
|
||||
else
|
||||
return f -- return the function
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceConfigRegistry-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,250 +0,0 @@
|
||||
--- **AceConsole-3.0** provides registration facilities for slash commands.
|
||||
-- You can register slash commands to your custom functions and use the `GetArgs` function to parse them
|
||||
-- to your addons individual needs.
|
||||
--
|
||||
-- **AceConsole-3.0** can be embeded into your addon, either explicitly by calling AceConsole:Embed(MyAddon) or by
|
||||
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
|
||||
-- and can be accessed directly, without having to explicitly call AceConsole itself.\\
|
||||
-- It is recommended to embed AceConsole, otherwise you'll have to specify a custom `self` on all calls you
|
||||
-- make into AceConsole.
|
||||
-- @class file
|
||||
-- @name AceConsole-3.0
|
||||
-- @release $Id: AceConsole-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
local MAJOR,MINOR = "AceConsole-3.0", 7
|
||||
|
||||
local AceConsole, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConsole then return end -- No upgrade needed
|
||||
|
||||
AceConsole.embeds = AceConsole.embeds or {} -- table containing objects AceConsole is embedded in.
|
||||
AceConsole.commands = AceConsole.commands or {} -- table containing commands registered
|
||||
AceConsole.weakcommands = AceConsole.weakcommands or {} -- table containing self, command => func references for weak commands that don't persist through enable/disable
|
||||
|
||||
-- Lua APIs
|
||||
local tconcat, tostring, select = table.concat, tostring, select
|
||||
local type, pairs, error = type, pairs, error
|
||||
local format, strfind, strsub = string.format, string.find, string.sub
|
||||
local max = math.max
|
||||
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: DEFAULT_CHAT_FRAME, SlashCmdList, hash_SlashCmdList
|
||||
|
||||
local tmp={}
|
||||
local function Print(self,frame,...)
|
||||
local n=0
|
||||
if self ~= AceConsole then
|
||||
n=n+1
|
||||
tmp[n] = "|cff33ff99"..tostring( self ).."|r:"
|
||||
end
|
||||
for i=1, select("#", ...) do
|
||||
n=n+1
|
||||
tmp[n] = tostring(select(i, ...))
|
||||
end
|
||||
frame:AddMessage( tconcat(tmp," ",1,n) )
|
||||
end
|
||||
|
||||
--- Print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function)
|
||||
-- @paramsig [chatframe ,] ...
|
||||
-- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function)
|
||||
-- @param ... List of any values to be printed
|
||||
function AceConsole:Print(...)
|
||||
local frame = ...
|
||||
if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member?
|
||||
return Print(self, frame, select(2,...))
|
||||
else
|
||||
return Print(self, DEFAULT_CHAT_FRAME, ...)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Formatted (using format()) print to DEFAULT_CHAT_FRAME or given ChatFrame (anything with an .AddMessage function)
|
||||
-- @paramsig [chatframe ,] "format"[, ...]
|
||||
-- @param chatframe Custom ChatFrame to print to (or any frame with an .AddMessage function)
|
||||
-- @param format Format string - same syntax as standard Lua format()
|
||||
-- @param ... Arguments to the format string
|
||||
function AceConsole:Printf(...)
|
||||
local frame = ...
|
||||
if type(frame) == "table" and frame.AddMessage then -- Is first argument something with an .AddMessage member?
|
||||
return Print(self, frame, format(select(2,...)))
|
||||
else
|
||||
return Print(self, DEFAULT_CHAT_FRAME, format(...))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--- Register a simple chat command
|
||||
-- @param command Chat command to be registered WITHOUT leading "/"
|
||||
-- @param func Function to call when the slash command is being used (funcref or methodname)
|
||||
-- @param persist if false, the command will be soft disabled/enabled when aceconsole is used as a mixin (default: true)
|
||||
function AceConsole:RegisterChatCommand( command, func, persist )
|
||||
if type(command)~="string" then error([[Usage: AceConsole:RegisterChatCommand( "command", func[, persist ]): 'command' - expected a string]], 2) end
|
||||
|
||||
if persist==nil then persist=true end -- I'd rather have my addon's "/addon enable" around if the author screws up. Having some extra slash regged when it shouldnt be isn't as destructive. True is a better default. /Mikk
|
||||
|
||||
local name = "ACECONSOLE_"..command:upper()
|
||||
|
||||
if type( func ) == "string" then
|
||||
SlashCmdList[name] = function(input, editBox)
|
||||
self[func](self, input, editBox)
|
||||
end
|
||||
else
|
||||
SlashCmdList[name] = func
|
||||
end
|
||||
_G["SLASH_"..name.."1"] = "/"..command:lower()
|
||||
AceConsole.commands[command] = name
|
||||
-- non-persisting commands are registered for enabling disabling
|
||||
if not persist then
|
||||
if not AceConsole.weakcommands[self] then AceConsole.weakcommands[self] = {} end
|
||||
AceConsole.weakcommands[self][command] = func
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--- Unregister a chatcommand
|
||||
-- @param command Chat command to be unregistered WITHOUT leading "/"
|
||||
function AceConsole:UnregisterChatCommand( command )
|
||||
local name = AceConsole.commands[command]
|
||||
if name then
|
||||
SlashCmdList[name] = nil
|
||||
_G["SLASH_" .. name .. "1"] = nil
|
||||
hash_SlashCmdList["/" .. command:upper()] = nil
|
||||
AceConsole.commands[command] = nil
|
||||
end
|
||||
end
|
||||
|
||||
--- Get an iterator over all Chat Commands registered with AceConsole
|
||||
-- @return Iterator (pairs) over all commands
|
||||
function AceConsole:IterateChatCommands() return pairs(AceConsole.commands) end
|
||||
|
||||
|
||||
local function nils(n, ...)
|
||||
if n>1 then
|
||||
return nil, nils(n-1, ...)
|
||||
elseif n==1 then
|
||||
return nil, ...
|
||||
else
|
||||
return ...
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Retreive one or more space-separated arguments from a string.
|
||||
-- Treats quoted strings and itemlinks as non-spaced.
|
||||
-- @param str The raw argument string
|
||||
-- @param numargs How many arguments to get (default 1)
|
||||
-- @param startpos Where in the string to start scanning (default 1)
|
||||
-- @return Returns arg1, arg2, ..., nextposition\\
|
||||
-- Missing arguments will be returned as nils. 'nextposition' is returned as 1e9 at the end of the string.
|
||||
function AceConsole:GetArgs(str, numargs, startpos)
|
||||
numargs = numargs or 1
|
||||
startpos = max(startpos or 1, 1)
|
||||
|
||||
local pos=startpos
|
||||
|
||||
-- find start of new arg
|
||||
pos = strfind(str, "[^ ]", pos)
|
||||
if not pos then -- whoops, end of string
|
||||
return nils(numargs, 1e9)
|
||||
end
|
||||
|
||||
if numargs<1 then
|
||||
return pos
|
||||
end
|
||||
|
||||
-- quoted or space separated? find out which pattern to use
|
||||
local delim_or_pipe
|
||||
local ch = strsub(str, pos, pos)
|
||||
if ch=='"' then
|
||||
pos = pos + 1
|
||||
delim_or_pipe='([|"])'
|
||||
elseif ch=="'" then
|
||||
pos = pos + 1
|
||||
delim_or_pipe="([|'])"
|
||||
else
|
||||
delim_or_pipe="([| ])"
|
||||
end
|
||||
|
||||
startpos = pos
|
||||
|
||||
while true do
|
||||
-- find delimiter or hyperlink
|
||||
local ch,_
|
||||
pos,_,ch = strfind(str, delim_or_pipe, pos)
|
||||
|
||||
if not pos then break end
|
||||
|
||||
if ch=="|" then
|
||||
-- some kind of escape
|
||||
|
||||
if strsub(str,pos,pos+1)=="|H" then
|
||||
-- It's a |H....|hhyper link!|h
|
||||
pos=strfind(str, "|h", pos+2) -- first |h
|
||||
if not pos then break end
|
||||
|
||||
pos=strfind(str, "|h", pos+2) -- second |h
|
||||
if not pos then break end
|
||||
elseif strsub(str,pos, pos+1) == "|T" then
|
||||
-- It's a |T....|t texture
|
||||
pos=strfind(str, "|t", pos+2)
|
||||
if not pos then break end
|
||||
end
|
||||
|
||||
pos=pos+2 -- skip past this escape (last |h if it was a hyperlink)
|
||||
|
||||
else
|
||||
-- found delimiter, done with this arg
|
||||
return strsub(str, startpos, pos-1), AceConsole:GetArgs(str, numargs-1, pos+1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- search aborted, we hit end of string. return it all as one argument. (yes, even if it's an unterminated quote or hyperlink)
|
||||
return strsub(str, startpos), nils(numargs-1, 1e9)
|
||||
end
|
||||
|
||||
|
||||
--- embedding and embed handling
|
||||
|
||||
local mixins = {
|
||||
"Print",
|
||||
"Printf",
|
||||
"RegisterChatCommand",
|
||||
"UnregisterChatCommand",
|
||||
"GetArgs",
|
||||
}
|
||||
|
||||
-- Embeds AceConsole into the target object making the functions from the mixins list available on target:..
|
||||
-- @param target target object to embed AceBucket in
|
||||
function AceConsole:Embed( target )
|
||||
for k, v in pairs( mixins ) do
|
||||
target[v] = self[v]
|
||||
end
|
||||
self.embeds[target] = true
|
||||
return target
|
||||
end
|
||||
|
||||
function AceConsole:OnEmbedEnable( target )
|
||||
if AceConsole.weakcommands[target] then
|
||||
for command, func in pairs( AceConsole.weakcommands[target] ) do
|
||||
target:RegisterChatCommand( command, func, false, true ) -- nonpersisting and silent registry
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceConsole:OnEmbedDisable( target )
|
||||
if AceConsole.weakcommands[target] then
|
||||
for command, func in pairs( AceConsole.weakcommands[target] ) do
|
||||
target:UnregisterChatCommand( command ) -- TODO: this could potentially unregister a command from another application in case of command conflicts. Do we care?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for addon in pairs(AceConsole.embeds) do
|
||||
AceConsole:Embed(addon)
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceConsole-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,744 +0,0 @@
|
||||
--- **AceDB-3.0** manages the SavedVariables of your addon.
|
||||
-- It offers profile management, smart defaults and namespaces for modules.\\
|
||||
-- Data can be saved in different data-types, depending on its intended usage.
|
||||
-- The most common data-type is the `profile` type, which allows the user to choose
|
||||
-- the active profile, and manage the profiles of all of his characters.\\
|
||||
-- The following data types are available:
|
||||
-- * **char** Character-specific data. Every character has its own database.
|
||||
-- * **realm** Realm-specific data. All of the players characters on the same realm share this database.
|
||||
-- * **class** Class-specific data. All of the players characters of the same class share this database.
|
||||
-- * **race** Race-specific data. All of the players characters of the same race share this database.
|
||||
-- * **faction** Faction-specific data. All of the players characters of the same faction share this database.
|
||||
-- * **factionrealm** Faction and realm specific data. All of the players characters on the same realm and of the same faction share this database.
|
||||
-- * **locale** Locale specific data, based on the locale of the players game client.
|
||||
-- * **global** Global Data. All characters on the same account share this database.
|
||||
-- * **profile** Profile-specific data. All characters using the same profile share this database. The user can control which profile should be used.
|
||||
--
|
||||
-- Creating a new Database using the `:New` function will return a new DBObject. A database will inherit all functions
|
||||
-- of the DBObjectLib listed here. \\
|
||||
-- If you create a new namespaced child-database (`:RegisterNamespace`), you'll get a DBObject as well, but note
|
||||
-- that the child-databases cannot individually change their profile, and are linked to their parents profile - and because of that,
|
||||
-- the profile related APIs are not available. Only `:RegisterDefaults` and `:ResetProfile` are available on child-databases.
|
||||
--
|
||||
-- For more details on how to use AceDB-3.0, see the [[AceDB-3.0 Tutorial]].
|
||||
--
|
||||
-- You may also be interested in [[libdualspec-1-0|LibDualSpec-1.0]] to do profile switching automatically when switching specs.
|
||||
--
|
||||
-- @usage
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("DBExample")
|
||||
--
|
||||
-- -- declare defaults to be used in the DB
|
||||
-- local defaults = {
|
||||
-- profile = {
|
||||
-- setting = true,
|
||||
-- }
|
||||
-- }
|
||||
--
|
||||
-- function MyAddon:OnInitialize()
|
||||
-- -- Assuming the .toc says ## SavedVariables: MyAddonDB
|
||||
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)
|
||||
-- end
|
||||
-- @class file
|
||||
-- @name AceDB-3.0.lua
|
||||
-- @release $Id: AceDB-3.0.lua 1217 2019-07-11 03:06:18Z funkydude $
|
||||
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 27
|
||||
local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
|
||||
|
||||
if not AceDB then return end -- No upgrade needed
|
||||
|
||||
-- Lua APIs
|
||||
local type, pairs, next, error = type, pairs, next, error
|
||||
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
|
||||
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub
|
||||
|
||||
AceDB.db_registry = AceDB.db_registry or {}
|
||||
AceDB.frame = AceDB.frame or CreateFrame("Frame")
|
||||
|
||||
local CallbackHandler
|
||||
local CallbackDummy = { Fire = function() end }
|
||||
|
||||
local DBObjectLib = {}
|
||||
|
||||
--[[-------------------------------------------------------------------------
|
||||
AceDB Utility Functions
|
||||
---------------------------------------------------------------------------]]
|
||||
|
||||
-- Simple shallow copy for copying defaults
|
||||
local function copyTable(src, dest)
|
||||
if type(dest) ~= "table" then dest = {} end
|
||||
if type(src) == "table" then
|
||||
for k,v in pairs(src) do
|
||||
if type(v) == "table" then
|
||||
-- try to index the key first so that the metatable creates the defaults, if set, and use that table
|
||||
v = copyTable(v, dest[k])
|
||||
end
|
||||
dest[k] = v
|
||||
end
|
||||
end
|
||||
return dest
|
||||
end
|
||||
|
||||
-- Called to add defaults to a section of the database
|
||||
--
|
||||
-- When a ["*"] default section is indexed with a new key, a table is returned
|
||||
-- and set in the host table. These tables must be cleaned up by removeDefaults
|
||||
-- in order to ensure we don't write empty default tables.
|
||||
local function copyDefaults(dest, src)
|
||||
-- this happens if some value in the SV overwrites our default value with a non-table
|
||||
--if type(dest) ~= "table" then return end
|
||||
for k, v in pairs(src) do
|
||||
if k == "*" or k == "**" then
|
||||
if type(v) == "table" then
|
||||
-- This is a metatable used for table defaults
|
||||
local mt = {
|
||||
-- This handles the lookup and creation of new subtables
|
||||
__index = function(t,k)
|
||||
if k == nil then return nil end
|
||||
local tbl = {}
|
||||
copyDefaults(tbl, v)
|
||||
rawset(t, k, tbl)
|
||||
return tbl
|
||||
end,
|
||||
}
|
||||
setmetatable(dest, mt)
|
||||
-- handle already existing tables in the SV
|
||||
for dk, dv in pairs(dest) do
|
||||
if not rawget(src, dk) and type(dv) == "table" then
|
||||
copyDefaults(dv, v)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Values are not tables, so this is just a simple return
|
||||
local mt = {__index = function(t,k) return k~=nil and v or nil end}
|
||||
setmetatable(dest, mt)
|
||||
end
|
||||
elseif type(v) == "table" then
|
||||
if not rawget(dest, k) then rawset(dest, k, {}) end
|
||||
if type(dest[k]) == "table" then
|
||||
copyDefaults(dest[k], v)
|
||||
if src['**'] then
|
||||
copyDefaults(dest[k], src['**'])
|
||||
end
|
||||
end
|
||||
else
|
||||
if rawget(dest, k) == nil then
|
||||
rawset(dest, k, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called to remove all defaults in the default table from the database
|
||||
local function removeDefaults(db, defaults, blocker)
|
||||
-- remove all metatables from the db, so we don't accidentally create new sub-tables through them
|
||||
setmetatable(db, nil)
|
||||
-- loop through the defaults and remove their content
|
||||
for k,v in pairs(defaults) do
|
||||
if k == "*" or k == "**" then
|
||||
if type(v) == "table" then
|
||||
-- Loop through all the actual k,v pairs and remove
|
||||
for key, value in pairs(db) do
|
||||
if type(value) == "table" then
|
||||
-- if the key was not explicitly specified in the defaults table, just strip everything from * and ** tables
|
||||
if defaults[key] == nil and (not blocker or blocker[key] == nil) then
|
||||
removeDefaults(value, v)
|
||||
-- if the table is empty afterwards, remove it
|
||||
if next(value) == nil then
|
||||
db[key] = nil
|
||||
end
|
||||
-- if it was specified, only strip ** content, but block values which were set in the key table
|
||||
elseif k == "**" then
|
||||
removeDefaults(value, v, defaults[key])
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif k == "*" then
|
||||
-- check for non-table default
|
||||
for key, value in pairs(db) do
|
||||
if defaults[key] == nil and v == value then
|
||||
db[key] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif type(v) == "table" and type(db[k]) == "table" then
|
||||
-- if a blocker was set, dive into it, to allow multi-level defaults
|
||||
removeDefaults(db[k], v, blocker and blocker[k])
|
||||
if next(db[k]) == nil then
|
||||
db[k] = nil
|
||||
end
|
||||
else
|
||||
-- check if the current value matches the default, and that its not blocked by another defaults table
|
||||
if db[k] == defaults[k] and (not blocker or blocker[k] == nil) then
|
||||
db[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- This is called when a table section is first accessed, to set up the defaults
|
||||
local function initSection(db, section, svstore, key, defaults)
|
||||
local sv = rawget(db, "sv")
|
||||
|
||||
local tableCreated
|
||||
if not sv[svstore] then sv[svstore] = {} end
|
||||
if not sv[svstore][key] then
|
||||
sv[svstore][key] = {}
|
||||
tableCreated = true
|
||||
end
|
||||
|
||||
local tbl = sv[svstore][key]
|
||||
|
||||
if defaults then
|
||||
copyDefaults(tbl, defaults)
|
||||
end
|
||||
rawset(db, section, tbl)
|
||||
|
||||
return tableCreated, tbl
|
||||
end
|
||||
|
||||
-- Metatable to handle the dynamic creation of sections and copying of sections.
|
||||
local dbmt = {
|
||||
__index = function(t, section)
|
||||
local keys = rawget(t, "keys")
|
||||
local key = keys[section]
|
||||
if key then
|
||||
local defaultTbl = rawget(t, "defaults")
|
||||
local defaults = defaultTbl and defaultTbl[section]
|
||||
|
||||
if section == "profile" then
|
||||
local new = initSection(t, section, "profiles", key, defaults)
|
||||
if new then
|
||||
-- Callback: OnNewProfile, database, newProfileKey
|
||||
t.callbacks:Fire("OnNewProfile", t, key)
|
||||
end
|
||||
elseif section == "profiles" then
|
||||
local sv = rawget(t, "sv")
|
||||
if not sv.profiles then sv.profiles = {} end
|
||||
rawset(t, "profiles", sv.profiles)
|
||||
elseif section == "global" then
|
||||
local sv = rawget(t, "sv")
|
||||
if not sv.global then sv.global = {} end
|
||||
if defaults then
|
||||
copyDefaults(sv.global, defaults)
|
||||
end
|
||||
rawset(t, section, sv.global)
|
||||
else
|
||||
initSection(t, section, section, key, defaults)
|
||||
end
|
||||
end
|
||||
|
||||
return rawget(t, section)
|
||||
end
|
||||
}
|
||||
|
||||
local function validateDefaults(defaults, keyTbl, offset)
|
||||
if not defaults then return end
|
||||
offset = offset or 0
|
||||
for k in pairs(defaults) do
|
||||
if not keyTbl[k] or k == "profiles" then
|
||||
error(("Usage: AceDBObject:RegisterDefaults(defaults): '%s' is not a valid datatype."):format(k), 3 + offset)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local preserve_keys = {
|
||||
["callbacks"] = true,
|
||||
["RegisterCallback"] = true,
|
||||
["UnregisterCallback"] = true,
|
||||
["UnregisterAllCallbacks"] = true,
|
||||
["children"] = true,
|
||||
}
|
||||
|
||||
local realmKey = GetRealmName()
|
||||
local charKey = UnitName("player") .. " - " .. realmKey
|
||||
local _, classKey = UnitClass("player")
|
||||
local _, raceKey = UnitRace("player")
|
||||
local factionKey = UnitFactionGroup("player")
|
||||
local factionrealmKey = factionKey .. " - " .. realmKey
|
||||
local localeKey = GetLocale():lower()
|
||||
|
||||
local regionTable = { "US", "KR", "EU", "TW", "CN" }
|
||||
local regionKey = regionTable[GetCurrentRegion()]
|
||||
local factionrealmregionKey = factionrealmKey .. " - " .. regionKey
|
||||
|
||||
-- Actual database initialization function
|
||||
local function initdb(sv, defaults, defaultProfile, olddb, parent)
|
||||
-- Generate the database keys for each section
|
||||
|
||||
-- map "true" to our "Default" profile
|
||||
if defaultProfile == true then defaultProfile = "Default" end
|
||||
|
||||
local profileKey
|
||||
if not parent then
|
||||
-- Make a container for profile keys
|
||||
if not sv.profileKeys then sv.profileKeys = {} end
|
||||
|
||||
-- Try to get the profile selected from the char db
|
||||
profileKey = sv.profileKeys[charKey] or defaultProfile or charKey
|
||||
|
||||
-- save the selected profile for later
|
||||
sv.profileKeys[charKey] = profileKey
|
||||
else
|
||||
-- Use the profile of the parents DB
|
||||
profileKey = parent.keys.profile or defaultProfile or charKey
|
||||
|
||||
-- clear the profileKeys in the DB, namespaces don't need to store them
|
||||
sv.profileKeys = nil
|
||||
end
|
||||
|
||||
-- This table contains keys that enable the dynamic creation
|
||||
-- of each section of the table. The 'global' and 'profiles'
|
||||
-- have a key of true, since they are handled in a special case
|
||||
local keyTbl= {
|
||||
["char"] = charKey,
|
||||
["realm"] = realmKey,
|
||||
["class"] = classKey,
|
||||
["race"] = raceKey,
|
||||
["faction"] = factionKey,
|
||||
["factionrealm"] = factionrealmKey,
|
||||
["factionrealmregion"] = factionrealmregionKey,
|
||||
["profile"] = profileKey,
|
||||
["locale"] = localeKey,
|
||||
["global"] = true,
|
||||
["profiles"] = true,
|
||||
}
|
||||
|
||||
validateDefaults(defaults, keyTbl, 1)
|
||||
|
||||
-- This allows us to use this function to reset an entire database
|
||||
-- Clear out the old database
|
||||
if olddb then
|
||||
for k,v in pairs(olddb) do if not preserve_keys[k] then olddb[k] = nil end end
|
||||
end
|
||||
|
||||
-- Give this database the metatable so it initializes dynamically
|
||||
local db = setmetatable(olddb or {}, dbmt)
|
||||
|
||||
if not rawget(db, "callbacks") then
|
||||
-- try to load CallbackHandler-1.0 if it loaded after our library
|
||||
if not CallbackHandler then CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0", true) end
|
||||
db.callbacks = CallbackHandler and CallbackHandler:New(db) or CallbackDummy
|
||||
end
|
||||
|
||||
-- Copy methods locally into the database object, to avoid hitting
|
||||
-- the metatable when calling methods
|
||||
|
||||
if not parent then
|
||||
for name, func in pairs(DBObjectLib) do
|
||||
db[name] = func
|
||||
end
|
||||
else
|
||||
-- hack this one in
|
||||
db.RegisterDefaults = DBObjectLib.RegisterDefaults
|
||||
db.ResetProfile = DBObjectLib.ResetProfile
|
||||
end
|
||||
|
||||
-- Set some properties in the database object
|
||||
db.profiles = sv.profiles
|
||||
db.keys = keyTbl
|
||||
db.sv = sv
|
||||
--db.sv_name = name
|
||||
db.defaults = defaults
|
||||
db.parent = parent
|
||||
|
||||
-- store the DB in the registry
|
||||
AceDB.db_registry[db] = true
|
||||
|
||||
return db
|
||||
end
|
||||
|
||||
-- handle PLAYER_LOGOUT
|
||||
-- strip all defaults from all databases
|
||||
-- and cleans up empty sections
|
||||
local function logoutHandler(frame, event)
|
||||
if event == "PLAYER_LOGOUT" then
|
||||
for db in pairs(AceDB.db_registry) do
|
||||
db.callbacks:Fire("OnDatabaseShutdown", db)
|
||||
db:RegisterDefaults(nil)
|
||||
|
||||
-- cleanup sections that are empty without defaults
|
||||
local sv = rawget(db, "sv")
|
||||
for section in pairs(db.keys) do
|
||||
if rawget(sv, section) then
|
||||
-- global is special, all other sections have sub-entrys
|
||||
-- also don't delete empty profiles on main dbs, only on namespaces
|
||||
if section ~= "global" and (section ~= "profiles" or rawget(db, "parent")) then
|
||||
for key in pairs(sv[section]) do
|
||||
if not next(sv[section][key]) then
|
||||
sv[section][key] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if not next(sv[section]) then
|
||||
sv[section] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
AceDB.frame:RegisterEvent("PLAYER_LOGOUT")
|
||||
AceDB.frame:SetScript("OnEvent", logoutHandler)
|
||||
|
||||
|
||||
--[[-------------------------------------------------------------------------
|
||||
AceDB Object Method Definitions
|
||||
---------------------------------------------------------------------------]]
|
||||
|
||||
--- Sets the defaults table for the given database object by clearing any
|
||||
-- that are currently set, and then setting the new defaults.
|
||||
-- @param defaults A table of defaults for this database
|
||||
function DBObjectLib:RegisterDefaults(defaults)
|
||||
if defaults and type(defaults) ~= "table" then
|
||||
error(("Usage: AceDBObject:RegisterDefaults(defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
|
||||
end
|
||||
|
||||
validateDefaults(defaults, self.keys)
|
||||
|
||||
-- Remove any currently set defaults
|
||||
if self.defaults then
|
||||
for section,key in pairs(self.keys) do
|
||||
if self.defaults[section] and rawget(self, section) then
|
||||
removeDefaults(self[section], self.defaults[section])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Set the DBObject.defaults table
|
||||
self.defaults = defaults
|
||||
|
||||
-- Copy in any defaults, only touching those sections already created
|
||||
if defaults then
|
||||
for section,key in pairs(self.keys) do
|
||||
if defaults[section] and rawget(self, section) then
|
||||
copyDefaults(self[section], defaults[section])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Changes the profile of the database and all of it's namespaces to the
|
||||
-- supplied named profile
|
||||
-- @param name The name of the profile to set as the current profile
|
||||
function DBObjectLib:SetProfile(name)
|
||||
if type(name) ~= "string" then
|
||||
error(("Usage: AceDBObject:SetProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||
end
|
||||
|
||||
-- changing to the same profile, dont do anything
|
||||
if name == self.keys.profile then return end
|
||||
|
||||
local oldProfile = self.profile
|
||||
local defaults = self.defaults and self.defaults.profile
|
||||
|
||||
-- Callback: OnProfileShutdown, database
|
||||
self.callbacks:Fire("OnProfileShutdown", self)
|
||||
|
||||
if oldProfile and defaults then
|
||||
-- Remove the defaults from the old profile
|
||||
removeDefaults(oldProfile, defaults)
|
||||
end
|
||||
|
||||
self.profile = nil
|
||||
self.keys["profile"] = name
|
||||
|
||||
-- if the storage exists, save the new profile
|
||||
-- this won't exist on namespaces.
|
||||
if self.sv.profileKeys then
|
||||
self.sv.profileKeys[charKey] = name
|
||||
end
|
||||
|
||||
-- populate to child namespaces
|
||||
if self.children then
|
||||
for _, db in pairs(self.children) do
|
||||
DBObjectLib.SetProfile(db, name)
|
||||
end
|
||||
end
|
||||
|
||||
-- Callback: OnProfileChanged, database, newProfileKey
|
||||
self.callbacks:Fire("OnProfileChanged", self, name)
|
||||
end
|
||||
|
||||
--- Returns a table with the names of the existing profiles in the database.
|
||||
-- You can optionally supply a table to re-use for this purpose.
|
||||
-- @param tbl A table to store the profile names in (optional)
|
||||
function DBObjectLib:GetProfiles(tbl)
|
||||
if tbl and type(tbl) ~= "table" then
|
||||
error(("Usage: AceDBObject:GetProfiles(tbl): 'tbl' - table or nil expected, got %q."):format(type(tbl)), 2)
|
||||
end
|
||||
|
||||
-- Clear the container table
|
||||
if tbl then
|
||||
for k,v in pairs(tbl) do tbl[k] = nil end
|
||||
else
|
||||
tbl = {}
|
||||
end
|
||||
|
||||
local curProfile = self.keys.profile
|
||||
|
||||
local i = 0
|
||||
for profileKey in pairs(self.profiles) do
|
||||
i = i + 1
|
||||
tbl[i] = profileKey
|
||||
if curProfile and profileKey == curProfile then curProfile = nil end
|
||||
end
|
||||
|
||||
-- Add the current profile, if it hasn't been created yet
|
||||
if curProfile then
|
||||
i = i + 1
|
||||
tbl[i] = curProfile
|
||||
end
|
||||
|
||||
return tbl, i
|
||||
end
|
||||
|
||||
--- Returns the current profile name used by the database
|
||||
function DBObjectLib:GetCurrentProfile()
|
||||
return self.keys.profile
|
||||
end
|
||||
|
||||
--- Deletes a named profile. This profile must not be the active profile.
|
||||
-- @param name The name of the profile to be deleted
|
||||
-- @param silent If true, do not raise an error when the profile does not exist
|
||||
function DBObjectLib:DeleteProfile(name, silent)
|
||||
if type(name) ~= "string" then
|
||||
error(("Usage: AceDBObject:DeleteProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||
end
|
||||
|
||||
if self.keys.profile == name then
|
||||
error(("Cannot delete the active profile (%q) in an AceDBObject."):format(name), 2)
|
||||
end
|
||||
|
||||
if not rawget(self.profiles, name) and not silent then
|
||||
error(("Cannot delete profile %q as it does not exist."):format(name), 2)
|
||||
end
|
||||
|
||||
self.profiles[name] = nil
|
||||
|
||||
-- populate to child namespaces
|
||||
if self.children then
|
||||
for _, db in pairs(self.children) do
|
||||
DBObjectLib.DeleteProfile(db, name, true)
|
||||
end
|
||||
end
|
||||
|
||||
-- switch all characters that use this profile back to the default
|
||||
if self.sv.profileKeys then
|
||||
for key, profile in pairs(self.sv.profileKeys) do
|
||||
if profile == name then
|
||||
self.sv.profileKeys[key] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Callback: OnProfileDeleted, database, profileKey
|
||||
self.callbacks:Fire("OnProfileDeleted", self, name)
|
||||
end
|
||||
|
||||
--- Copies a named profile into the current profile, overwriting any conflicting
|
||||
-- settings.
|
||||
-- @param name The name of the profile to be copied into the current profile
|
||||
-- @param silent If true, do not raise an error when the profile does not exist
|
||||
function DBObjectLib:CopyProfile(name, silent)
|
||||
if type(name) ~= "string" then
|
||||
error(("Usage: AceDBObject:CopyProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||
end
|
||||
|
||||
if name == self.keys.profile then
|
||||
error(("Cannot have the same source and destination profiles (%q)."):format(name), 2)
|
||||
end
|
||||
|
||||
if not rawget(self.profiles, name) and not silent then
|
||||
error(("Cannot copy profile %q as it does not exist."):format(name), 2)
|
||||
end
|
||||
|
||||
-- Reset the profile before copying
|
||||
DBObjectLib.ResetProfile(self, nil, true)
|
||||
|
||||
local profile = self.profile
|
||||
local source = self.profiles[name]
|
||||
|
||||
copyTable(source, profile)
|
||||
|
||||
-- populate to child namespaces
|
||||
if self.children then
|
||||
for _, db in pairs(self.children) do
|
||||
DBObjectLib.CopyProfile(db, name, true)
|
||||
end
|
||||
end
|
||||
|
||||
-- Callback: OnProfileCopied, database, sourceProfileKey
|
||||
self.callbacks:Fire("OnProfileCopied", self, name)
|
||||
end
|
||||
|
||||
--- Resets the current profile to the default values (if specified).
|
||||
-- @param noChildren if set to true, the reset will not be populated to the child namespaces of this DB object
|
||||
-- @param noCallbacks if set to true, won't fire the OnProfileReset callback
|
||||
function DBObjectLib:ResetProfile(noChildren, noCallbacks)
|
||||
local profile = self.profile
|
||||
|
||||
for k,v in pairs(profile) do
|
||||
profile[k] = nil
|
||||
end
|
||||
|
||||
local defaults = self.defaults and self.defaults.profile
|
||||
if defaults then
|
||||
copyDefaults(profile, defaults)
|
||||
end
|
||||
|
||||
-- populate to child namespaces
|
||||
if self.children and not noChildren then
|
||||
for _, db in pairs(self.children) do
|
||||
DBObjectLib.ResetProfile(db, nil, noCallbacks)
|
||||
end
|
||||
end
|
||||
|
||||
-- Callback: OnProfileReset, database
|
||||
if not noCallbacks then
|
||||
self.callbacks:Fire("OnProfileReset", self)
|
||||
end
|
||||
end
|
||||
|
||||
--- Resets the entire database, using the string defaultProfile as the new default
|
||||
-- profile.
|
||||
-- @param defaultProfile The profile name to use as the default
|
||||
function DBObjectLib:ResetDB(defaultProfile)
|
||||
if defaultProfile and type(defaultProfile) ~= "string" then
|
||||
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or nil expected, got %q."):format(type(defaultProfile)), 2)
|
||||
end
|
||||
|
||||
local sv = self.sv
|
||||
for k,v in pairs(sv) do
|
||||
sv[k] = nil
|
||||
end
|
||||
|
||||
initdb(sv, self.defaults, defaultProfile, self)
|
||||
|
||||
-- fix the child namespaces
|
||||
if self.children then
|
||||
if not sv.namespaces then sv.namespaces = {} end
|
||||
for name, db in pairs(self.children) do
|
||||
if not sv.namespaces[name] then sv.namespaces[name] = {} end
|
||||
initdb(sv.namespaces[name], db.defaults, self.keys.profile, db, self)
|
||||
end
|
||||
end
|
||||
|
||||
-- Callback: OnDatabaseReset, database
|
||||
self.callbacks:Fire("OnDatabaseReset", self)
|
||||
-- Callback: OnProfileChanged, database, profileKey
|
||||
self.callbacks:Fire("OnProfileChanged", self, self.keys["profile"])
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Creates a new database namespace, directly tied to the database. This
|
||||
-- is a full scale database in it's own rights other than the fact that
|
||||
-- it cannot control its profile individually
|
||||
-- @param name The name of the new namespace
|
||||
-- @param defaults A table of values to use as defaults
|
||||
function DBObjectLib:RegisterNamespace(name, defaults)
|
||||
if type(name) ~= "string" then
|
||||
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||
end
|
||||
if defaults and type(defaults) ~= "table" then
|
||||
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
|
||||
end
|
||||
if self.children and self.children[name] then
|
||||
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - a namespace called %q already exists."):format(name), 2)
|
||||
end
|
||||
|
||||
local sv = self.sv
|
||||
if not sv.namespaces then sv.namespaces = {} end
|
||||
if not sv.namespaces[name] then
|
||||
sv.namespaces[name] = {}
|
||||
end
|
||||
|
||||
local newDB = initdb(sv.namespaces[name], defaults, self.keys.profile, nil, self)
|
||||
|
||||
if not self.children then self.children = {} end
|
||||
self.children[name] = newDB
|
||||
return newDB
|
||||
end
|
||||
|
||||
--- Returns an already existing namespace from the database object.
|
||||
-- @param name The name of the new namespace
|
||||
-- @param silent if true, the addon is optional, silently return nil if its not found
|
||||
-- @usage
|
||||
-- local namespace = self.db:GetNamespace('namespace')
|
||||
-- @return the namespace object if found
|
||||
function DBObjectLib:GetNamespace(name, silent)
|
||||
if type(name) ~= "string" then
|
||||
error(("Usage: AceDBObject:GetNamespace(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||
end
|
||||
if not silent and not (self.children and self.children[name]) then
|
||||
error(("Usage: AceDBObject:GetNamespace(name): 'name' - namespace %q does not exist."):format(name), 2)
|
||||
end
|
||||
if not self.children then self.children = {} end
|
||||
return self.children[name]
|
||||
end
|
||||
|
||||
--[[-------------------------------------------------------------------------
|
||||
AceDB Exposed Methods
|
||||
---------------------------------------------------------------------------]]
|
||||
|
||||
--- Creates a new database object that can be used to handle database settings and profiles.
|
||||
-- By default, an empty DB is created, using a character specific profile.
|
||||
--
|
||||
-- You can override the default profile used by passing any profile name as the third argument,
|
||||
-- or by passing //true// as the third argument to use a globally shared profile called "Default".
|
||||
--
|
||||
-- Note that there is no token replacement in the default profile name, passing a defaultProfile as "char"
|
||||
-- will use a profile named "char", and not a character-specific profile.
|
||||
-- @param tbl The name of variable, or table to use for the database
|
||||
-- @param defaults A table of database defaults
|
||||
-- @param defaultProfile The name of the default profile. If not set, a character specific profile will be used as the default.
|
||||
-- You can also pass //true// to use a shared global profile called "Default".
|
||||
-- @usage
|
||||
-- -- Create an empty DB using a character-specific default profile.
|
||||
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB")
|
||||
-- @usage
|
||||
-- -- Create a DB using defaults and using a shared default profile
|
||||
-- self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)
|
||||
function AceDB:New(tbl, defaults, defaultProfile)
|
||||
if type(tbl) == "string" then
|
||||
local name = tbl
|
||||
tbl = _G[name]
|
||||
if not tbl then
|
||||
tbl = {}
|
||||
_G[name] = tbl
|
||||
end
|
||||
end
|
||||
|
||||
if type(tbl) ~= "table" then
|
||||
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'tbl' - table expected, got %q."):format(type(tbl)), 2)
|
||||
end
|
||||
|
||||
if defaults and type(defaults) ~= "table" then
|
||||
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaults' - table expected, got %q."):format(type(defaults)), 2)
|
||||
end
|
||||
|
||||
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
|
||||
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
|
||||
end
|
||||
|
||||
return initdb(tbl, defaults, defaultProfile)
|
||||
end
|
||||
|
||||
-- upgrade existing databases
|
||||
for db in pairs(AceDB.db_registry) do
|
||||
if not db.parent then
|
||||
for name,func in pairs(DBObjectLib) do
|
||||
db[name] = func
|
||||
end
|
||||
else
|
||||
db.RegisterDefaults = DBObjectLib.RegisterDefaults
|
||||
db.ResetProfile = DBObjectLib.ResetProfile
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceDB-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,460 +0,0 @@
|
||||
--- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles.
|
||||
-- @class file
|
||||
-- @name AceDBOptions-3.0
|
||||
-- @release $Id: AceDBOptions-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 15
|
||||
local AceDBOptions = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR)
|
||||
|
||||
if not AceDBOptions then return end -- No upgrade needed
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, next = pairs, next
|
||||
|
||||
-- WoW APIs
|
||||
local UnitClass = UnitClass
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: NORMAL_FONT_COLOR_CODE, FONT_COLOR_CODE_CLOSE
|
||||
|
||||
AceDBOptions.optionTables = AceDBOptions.optionTables or {}
|
||||
AceDBOptions.handlers = AceDBOptions.handlers or {}
|
||||
|
||||
--[[
|
||||
Localization of AceDBOptions-3.0
|
||||
]]
|
||||
|
||||
local L = {
|
||||
choose = "Existing Profiles",
|
||||
choose_desc = "You can either create a new profile by entering a name in the editbox, or choose one of the already existing profiles.",
|
||||
choose_sub = "Select one of your currently available profiles.",
|
||||
copy = "Copy From",
|
||||
copy_desc = "Copy the settings from one existing profile into the currently active profile.",
|
||||
current = "Current Profile:",
|
||||
default = "Default",
|
||||
delete = "Delete a Profile",
|
||||
delete_confirm = "Are you sure you want to delete the selected profile?",
|
||||
delete_desc = "Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.",
|
||||
delete_sub = "Deletes a profile from the database.",
|
||||
intro = "You can change the active database profile, so you can have different settings for every character.",
|
||||
new = "New",
|
||||
new_sub = "Create a new empty profile.",
|
||||
profiles = "Profiles",
|
||||
profiles_sub = "Manage Profiles",
|
||||
reset = "Reset Profile",
|
||||
reset_desc = "Reset the current profile back to its default values, in case your configuration is broken, or you simply want to start over.",
|
||||
reset_sub = "Reset the current profile to the default",
|
||||
}
|
||||
|
||||
local LOCALE = GetLocale()
|
||||
if LOCALE == "deDE" then
|
||||
L["choose"] = "Vorhandene Profile"
|
||||
L["choose_desc"] = "Du kannst ein neues Profil erstellen, indem du einen neuen Namen in der Eingabebox 'Neu' eingibst, oder wähle eines der vorhandenen Profile aus."
|
||||
L["choose_sub"] = "Wählt ein bereits vorhandenes Profil aus."
|
||||
L["copy"] = "Kopieren von..."
|
||||
L["copy_desc"] = "Kopiere die Einstellungen von einem vorhandenen Profil in das aktive Profil."
|
||||
L["current"] = "Aktuelles Profil:"
|
||||
L["default"] = "Standard"
|
||||
L["delete"] = "Profil löschen"
|
||||
L["delete_confirm"] = "Willst du das ausgewählte Profil wirklich löschen?"
|
||||
L["delete_desc"] = "Lösche vorhandene oder unbenutzte Profile aus der Datenbank, um Platz zu sparen und die SavedVariables-Datei 'sauber' zu halten."
|
||||
L["delete_sub"] = "Löscht ein Profil aus der Datenbank."
|
||||
L["intro"] = "Hier kannst du das aktive Datenbankprofil ändern, damit du verschiedene Einstellungen für jeden Charakter erstellen kannst, wodurch eine sehr flexible Konfiguration möglich wird."
|
||||
L["new"] = "Neu"
|
||||
L["new_sub"] = "Ein neues Profil erstellen."
|
||||
L["profiles"] = "Profile"
|
||||
L["profiles_sub"] = "Profile verwalten"
|
||||
L["reset"] = "Profil zurücksetzen"
|
||||
L["reset_desc"] = "Setzt das momentane Profil auf Standardwerte zurück, für den Fall, dass mit der Konfiguration etwas schief lief oder weil du einfach neu starten willst."
|
||||
L["reset_sub"] = "Das aktuelle Profil auf Standard zurücksetzen."
|
||||
elseif LOCALE == "frFR" then
|
||||
L["choose"] = "Profils existants"
|
||||
L["choose_desc"] = "Vous pouvez créer un nouveau profil en entrant un nouveau nom dans la boîte de saisie, ou en choississant un des profils déjà existants."
|
||||
L["choose_sub"] = "Permet de choisir un des profils déjà disponibles."
|
||||
L["copy"] = "Copier à partir de"
|
||||
L["copy_desc"] = "Copie les paramètres d'un profil déjà existant dans le profil actuellement actif."
|
||||
L["current"] = "Profil actuel :"
|
||||
L["default"] = "Défaut"
|
||||
L["delete"] = "Supprimer un profil"
|
||||
L["delete_confirm"] = "Etes-vous sûr de vouloir supprimer le profil sélectionné ?"
|
||||
L["delete_desc"] = "Supprime les profils existants inutilisés de la base de données afin de gagner de la place et de nettoyer le fichier SavedVariables."
|
||||
L["delete_sub"] = "Supprime un profil de la base de données."
|
||||
L["intro"] = "Vous pouvez changer le profil actuel afin d'avoir des paramètres différents pour chaque personnage, permettant ainsi d'avoir une configuration très flexible."
|
||||
L["new"] = "Nouveau"
|
||||
L["new_sub"] = "Créée un nouveau profil vierge."
|
||||
L["profiles"] = "Profils"
|
||||
L["profiles_sub"] = "Gestion des profils"
|
||||
L["reset"] = "Réinitialiser le profil"
|
||||
L["reset_desc"] = "Réinitialise le profil actuel au cas où votre configuration est corrompue ou si vous voulez tout simplement faire table rase."
|
||||
L["reset_sub"] = "Réinitialise le profil actuel avec les paramètres par défaut."
|
||||
elseif LOCALE == "koKR" then
|
||||
L["choose"] = "저장 중인 프로필"
|
||||
L["choose_desc"] = "입력창에 새로운 이름을 입력하거나 저장 중인 프로필 중 하나를 선택하여 새로운 프로필을 만들 수 있습니다."
|
||||
L["choose_sub"] = "현재 이용할 수 있는 프로필 중 하나를 선택합니다."
|
||||
L["copy"] = "복사해오기"
|
||||
L["copy_desc"] = "현재 사용 중인 프로필에 선택한 프로필의 설정을 복사합니다."
|
||||
L["current"] = "현재 프로필:"
|
||||
L["default"] = "기본값"
|
||||
L["delete"] = "프로필 삭제"
|
||||
L["delete_confirm"] = "정말로 선택한 프로필을 삭제할까요?"
|
||||
L["delete_desc"] = "저장 공간 절약과 SavedVariables 파일의 정리를 위해 데이터베이스에서 사용하지 않는 프로필을 삭제하세요."
|
||||
L["delete_sub"] = "데이터베이스의 프로필을 삭제합니다."
|
||||
L["intro"] = "활성 데이터베이스 프로필을 변경할 수 있고, 각 캐릭터 별로 다른 설정을 할 수 있습니다."
|
||||
L["new"] = "새로운 프로필"
|
||||
L["new_sub"] = "새로운 프로필을 만듭니다."
|
||||
L["profiles"] = "프로필"
|
||||
L["profiles_sub"] = "프로필 관리"
|
||||
L["reset"] = "프로필 초기화"
|
||||
L["reset_desc"] = "설정이 깨졌거나 처음부터 다시 설정을 원하는 경우, 현재 프로필을 기본값으로 초기화하세요."
|
||||
L["reset_sub"] = "현재 프로필을 기본값으로 초기화합니다"
|
||||
elseif LOCALE == "esES" or LOCALE == "esMX" then
|
||||
L["choose"] = "Perfiles existentes"
|
||||
L["choose_desc"] = "Puedes crear un nuevo perfil introduciendo un nombre en el recuadro o puedes seleccionar un perfil de los ya existentes."
|
||||
L["choose_sub"] = "Selecciona uno de los perfiles disponibles."
|
||||
L["copy"] = "Copiar de"
|
||||
L["copy_desc"] = "Copia los ajustes de un perfil existente al perfil actual."
|
||||
L["current"] = "Perfil actual:"
|
||||
L["default"] = "Por defecto"
|
||||
L["delete"] = "Borrar un Perfil"
|
||||
L["delete_confirm"] = "¿Estas seguro que quieres borrar el perfil seleccionado?"
|
||||
L["delete_desc"] = "Borra los perfiles existentes y sin uso de la base de datos para ganar espacio y limpiar el archivo SavedVariables."
|
||||
L["delete_sub"] = "Borra un perfil de la base de datos."
|
||||
L["intro"] = "Puedes cambiar el perfil activo de tal manera que cada personaje tenga diferentes configuraciones."
|
||||
L["new"] = "Nuevo"
|
||||
L["new_sub"] = "Crear un nuevo perfil vacio."
|
||||
L["profiles"] = "Perfiles"
|
||||
L["profiles_sub"] = "Manejar Perfiles"
|
||||
L["reset"] = "Reiniciar Perfil"
|
||||
L["reset_desc"] = "Reinicia el perfil actual a los valores por defectos, en caso de que se haya estropeado la configuración o quieras volver a empezar de nuevo."
|
||||
L["reset_sub"] = "Reinicar el perfil actual al de por defecto"
|
||||
elseif LOCALE == "zhTW" then
|
||||
L["choose"] = "現有的設定檔"
|
||||
L["choose_desc"] = "您可以在文字方塊內輸入名字以建立新的設定檔,或是選擇一個現有的設定檔使用。"
|
||||
L["choose_sub"] = "從當前可用的設定檔裡面選擇一個。"
|
||||
L["copy"] = "複製自"
|
||||
L["copy_desc"] = "從一個現有的設定檔,將設定複製到現在使用中的設定檔。"
|
||||
L["current"] = "目前設定檔:"
|
||||
L["default"] = "預設"
|
||||
L["delete"] = "刪除一個設定檔"
|
||||
L["delete_confirm"] = "確定要刪除所選擇的設定檔嗎?"
|
||||
L["delete_desc"] = "從資料庫裡刪除不再使用的設定檔,以節省空間,並且清理 SavedVariables 檔案。"
|
||||
L["delete_sub"] = "從資料庫裡刪除一個設定檔。"
|
||||
L["intro"] = "您可以從資料庫中選擇一個設定檔來使用,如此就可以讓每個角色使用不同的設定。"
|
||||
L["new"] = "新建"
|
||||
L["new_sub"] = "新建一個空的設定檔。"
|
||||
L["profiles"] = "設定檔"
|
||||
L["profiles_sub"] = "管理設定檔"
|
||||
L["reset"] = "重置設定檔"
|
||||
L["reset_desc"] = "將現用的設定檔重置為預設值;用於設定檔損壞,或者單純想要重來的情況。"
|
||||
L["reset_sub"] = "將目前的設定檔重置為預設值"
|
||||
elseif LOCALE == "zhCN" then
|
||||
L["choose"] = "现有的配置文件"
|
||||
L["choose_desc"] = "你可以通过在文本框内输入一个名字创立一个新的配置文件,也可以选择一个已经存在的配置文件。"
|
||||
L["choose_sub"] = "从当前可用的配置文件里面选择一个。"
|
||||
L["copy"] = "复制自"
|
||||
L["copy_desc"] = "从当前某个已保存的配置文件复制到当前正使用的配置文件。"
|
||||
L["current"] = "当前配置文件:"
|
||||
L["default"] = "默认"
|
||||
L["delete"] = "删除一个配置文件"
|
||||
L["delete_confirm"] = "你确定要删除所选择的配置文件么?"
|
||||
L["delete_desc"] = "从数据库里删除不再使用的配置文件,以节省空间,并且清理SavedVariables文件。"
|
||||
L["delete_sub"] = "从数据库里删除一个配置文件。"
|
||||
L["intro"] = "你可以选择一个活动的数据配置文件,这样你的每个角色就可以拥有不同的设置值,可以给你的插件配置带来极大的灵活性。"
|
||||
L["new"] = "新建"
|
||||
L["new_sub"] = "新建一个空的配置文件。"
|
||||
L["profiles"] = "配置文件"
|
||||
L["profiles_sub"] = "管理配置文件"
|
||||
L["reset"] = "重置配置文件"
|
||||
L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。"
|
||||
L["reset_sub"] = "将当前的配置文件恢复为默认值"
|
||||
elseif LOCALE == "ruRU" then
|
||||
L["choose"] = "Существующие профили"
|
||||
L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей."
|
||||
L["choose_sub"] = "Выбор одиного из уже доступных профилей"
|
||||
L["copy"] = "Скопировать из"
|
||||
L["copy_desc"] = "Скопировать настройки из выбранного профиля в активный."
|
||||
L["current"] = "Текущий профиль:"
|
||||
L["default"] = "По умолчанию"
|
||||
L["delete"] = "Удалить профиль"
|
||||
L["delete_confirm"] = "Вы уверены, что вы хотите удалить выбранный профиль?"
|
||||
L["delete_desc"] = "Удалить существующий и неиспользуемый профиль из БД для сохранения места, и очистить SavedVariables файл."
|
||||
L["delete_sub"] = "Удаление профиля из БД"
|
||||
L["intro"] = "Изменяя активный профиль, вы можете задать различные настройки модификаций для каждого персонажа."
|
||||
L["new"] = "Новый"
|
||||
L["new_sub"] = "Создать новый чистый профиль"
|
||||
L["profiles"] = "Профили"
|
||||
L["profiles_sub"] = "Управление профилями"
|
||||
L["reset"] = "Сброс профиля"
|
||||
L["reset_desc"] = "Сбросить текущий профиль к стандартным настройкам, если ваша конфигурация испорчена или вы хотите настроить всё заново."
|
||||
L["reset_sub"] = "Сброс текущего профиля на стандартный"
|
||||
elseif LOCALE == "itIT" then
|
||||
L["choose"] = "Profili Esistenti"
|
||||
L["choose_desc"] = "Puoi creare un nuovo profilo digitando il nome della casella di testo, oppure scegliendone uno tra i profili già esistenti."
|
||||
L["choose_sub"] = "Seleziona uno dei profili attualmente disponibili."
|
||||
L["copy"] = "Copia Da"
|
||||
L["copy_desc"] = "Copia le impostazioni da un profilo esistente, nel profilo attivo in questo momento."
|
||||
L["current"] = "Profilo Attivo:"
|
||||
L["default"] = "Standard"
|
||||
L["delete"] = "Cancella un Profilo"
|
||||
L["delete_confirm"] = "Sei sicuro di voler cancellare il profilo selezionato?"
|
||||
L["delete_desc"] = "Cancella i profili non utilizzati dal database per risparmiare spazio e mantenere puliti i file di configurazione SavedVariables."
|
||||
L["delete_sub"] = "Cancella un profilo dal Database."
|
||||
L["intro"] = "Puoi cambiare il profilo attivo, in modo da usare impostazioni diverse per ogni personaggio."
|
||||
L["new"] = "Nuovo"
|
||||
L["new_sub"] = "Crea un nuovo profilo vuoto."
|
||||
L["profiles"] = "Profili"
|
||||
L["profiles_sub"] = "Gestisci Profili"
|
||||
L["reset"] = "Reimposta Profilo"
|
||||
L["reset_desc"] = "Riporta il tuo profilo attivo alle sue impostazioni predefinite, nel caso in cui la tua configurazione si sia corrotta, o semplicemente tu voglia re-inizializzarla."
|
||||
L["reset_sub"] = "Reimposta il profilo ai suoi valori predefiniti."
|
||||
elseif LOCALE == "ptBR" then
|
||||
L["choose"] = "Perfis Existentes"
|
||||
L["choose_desc"] = "Você pode tanto criar um perfil novo tanto digitando um nome na caixa de texto, quanto escolher um dos perfis já existentes."
|
||||
L["choose_sub"] = "Selecione um de seus perfis atualmente disponíveis."
|
||||
L["copy"] = "Copiar De"
|
||||
L["copy_desc"] = "Copia as definições de um perfil existente no perfil atualmente ativo."
|
||||
L["current"] = "Perfil Autal:"
|
||||
L["default"] = "Padrão"
|
||||
L["delete"] = "Remover um Perfil"
|
||||
L["delete_confirm"] = "Tem certeza que deseja remover o perfil selecionado?"
|
||||
L["delete_desc"] = "Remove perfis existentes e inutilizados do banco de dados para economizar espaço, e limpar o arquivo SavedVariables."
|
||||
L["delete_sub"] = "Remove um perfil do banco de dados."
|
||||
L["intro"] = "Você pode alterar o perfil do banco de dados ativo, para que possa ter definições diferentes para cada personagem."
|
||||
L["new"] = "Novo"
|
||||
L["new_sub"] = "Cria um novo perfil vazio."
|
||||
L["profiles"] = "Perfis"
|
||||
L["profiles_sub"] = "Gerenciar Perfis"
|
||||
L["reset"] = "Resetar Perfil"
|
||||
L["reset_desc"] = "Reseta o perfil atual para os valores padrões, no caso de sua configuração estar quebrada, ou simplesmente se deseja começar novamente."
|
||||
L["reset_sub"] = "Resetar o perfil atual ao padrão"
|
||||
end
|
||||
|
||||
local defaultProfiles
|
||||
local tmpprofiles = {}
|
||||
|
||||
-- Get a list of available profiles for the specified database.
|
||||
-- You can specify which profiles to include/exclude in the list using the two boolean parameters listed below.
|
||||
-- @param db The db object to retrieve the profiles from
|
||||
-- @param common If true, getProfileList will add the default profiles to the return list, even if they have not been created yet
|
||||
-- @param nocurrent If true, then getProfileList will not display the current profile in the list
|
||||
-- @return Hashtable of all profiles with the internal name as keys and the display name as value.
|
||||
local function getProfileList(db, common, nocurrent)
|
||||
local profiles = {}
|
||||
|
||||
-- copy existing profiles into the table
|
||||
local currentProfile = db:GetCurrentProfile()
|
||||
for i,v in pairs(db:GetProfiles(tmpprofiles)) do
|
||||
if not (nocurrent and v == currentProfile) then
|
||||
profiles[v] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- add our default profiles to choose from ( or rename existing profiles)
|
||||
for k,v in pairs(defaultProfiles) do
|
||||
if (common or profiles[k]) and not (nocurrent and k == currentProfile) then
|
||||
profiles[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
return profiles
|
||||
end
|
||||
|
||||
--[[
|
||||
OptionsHandlerPrototype
|
||||
prototype class for handling the options in a sane way
|
||||
]]
|
||||
local OptionsHandlerPrototype = {}
|
||||
|
||||
--[[ Reset the profile ]]
|
||||
function OptionsHandlerPrototype:Reset()
|
||||
self.db:ResetProfile()
|
||||
end
|
||||
|
||||
--[[ Set the profile to value ]]
|
||||
function OptionsHandlerPrototype:SetProfile(info, value)
|
||||
self.db:SetProfile(value)
|
||||
end
|
||||
|
||||
--[[ returns the currently active profile ]]
|
||||
function OptionsHandlerPrototype:GetCurrentProfile()
|
||||
return self.db:GetCurrentProfile()
|
||||
end
|
||||
|
||||
--[[
|
||||
List all active profiles
|
||||
you can control the output with the .arg variable
|
||||
currently four modes are supported
|
||||
|
||||
(empty) - return all available profiles
|
||||
"nocurrent" - returns all available profiles except the currently active profile
|
||||
"common" - returns all avaialble profiles + some commonly used profiles ("char - realm", "realm", "class", "Default")
|
||||
"both" - common except the active profile
|
||||
]]
|
||||
function OptionsHandlerPrototype:ListProfiles(info)
|
||||
local arg = info.arg
|
||||
local profiles
|
||||
if arg == "common" and not self.noDefaultProfiles then
|
||||
profiles = getProfileList(self.db, true, nil)
|
||||
elseif arg == "nocurrent" then
|
||||
profiles = getProfileList(self.db, nil, true)
|
||||
elseif arg == "both" then -- currently not used
|
||||
profiles = getProfileList(self.db, (not self.noDefaultProfiles) and true, true)
|
||||
else
|
||||
profiles = getProfileList(self.db)
|
||||
end
|
||||
|
||||
return profiles
|
||||
end
|
||||
|
||||
function OptionsHandlerPrototype:HasNoProfiles(info)
|
||||
local profiles = self:ListProfiles(info)
|
||||
return ((not next(profiles)) and true or false)
|
||||
end
|
||||
|
||||
--[[ Copy a profile ]]
|
||||
function OptionsHandlerPrototype:CopyProfile(info, value)
|
||||
self.db:CopyProfile(value)
|
||||
end
|
||||
|
||||
--[[ Delete a profile from the db ]]
|
||||
function OptionsHandlerPrototype:DeleteProfile(info, value)
|
||||
self.db:DeleteProfile(value)
|
||||
end
|
||||
|
||||
--[[ fill defaultProfiles with some generic values ]]
|
||||
local function generateDefaultProfiles(db)
|
||||
defaultProfiles = {
|
||||
["Default"] = L["default"],
|
||||
[db.keys.char] = db.keys.char,
|
||||
[db.keys.realm] = db.keys.realm,
|
||||
[db.keys.class] = UnitClass("player")
|
||||
}
|
||||
end
|
||||
|
||||
--[[ create and return a handler object for the db, or upgrade it if it already existed ]]
|
||||
local function getOptionsHandler(db, noDefaultProfiles)
|
||||
if not defaultProfiles then
|
||||
generateDefaultProfiles(db)
|
||||
end
|
||||
|
||||
local handler = AceDBOptions.handlers[db] or { db = db, noDefaultProfiles = noDefaultProfiles }
|
||||
|
||||
for k,v in pairs(OptionsHandlerPrototype) do
|
||||
handler[k] = v
|
||||
end
|
||||
|
||||
AceDBOptions.handlers[db] = handler
|
||||
return handler
|
||||
end
|
||||
|
||||
--[[
|
||||
the real options table
|
||||
]]
|
||||
local optionsTable = {
|
||||
desc = {
|
||||
order = 1,
|
||||
type = "description",
|
||||
name = L["intro"] .. "\n",
|
||||
},
|
||||
descreset = {
|
||||
order = 9,
|
||||
type = "description",
|
||||
name = L["reset_desc"],
|
||||
},
|
||||
reset = {
|
||||
order = 10,
|
||||
type = "execute",
|
||||
name = L["reset"],
|
||||
desc = L["reset_sub"],
|
||||
func = "Reset",
|
||||
},
|
||||
current = {
|
||||
order = 11,
|
||||
type = "description",
|
||||
name = function(info) return L["current"] .. " " .. NORMAL_FONT_COLOR_CODE .. info.handler:GetCurrentProfile() .. FONT_COLOR_CODE_CLOSE end,
|
||||
width = "default",
|
||||
},
|
||||
choosedesc = {
|
||||
order = 20,
|
||||
type = "description",
|
||||
name = "\n" .. L["choose_desc"],
|
||||
},
|
||||
new = {
|
||||
name = L["new"],
|
||||
desc = L["new_sub"],
|
||||
type = "input",
|
||||
order = 30,
|
||||
get = false,
|
||||
set = "SetProfile",
|
||||
},
|
||||
choose = {
|
||||
name = L["choose"],
|
||||
desc = L["choose_sub"],
|
||||
type = "select",
|
||||
order = 40,
|
||||
get = "GetCurrentProfile",
|
||||
set = "SetProfile",
|
||||
values = "ListProfiles",
|
||||
arg = "common",
|
||||
},
|
||||
copydesc = {
|
||||
order = 50,
|
||||
type = "description",
|
||||
name = "\n" .. L["copy_desc"],
|
||||
},
|
||||
copyfrom = {
|
||||
order = 60,
|
||||
type = "select",
|
||||
name = L["copy"],
|
||||
desc = L["copy_desc"],
|
||||
get = false,
|
||||
set = "CopyProfile",
|
||||
values = "ListProfiles",
|
||||
disabled = "HasNoProfiles",
|
||||
arg = "nocurrent",
|
||||
},
|
||||
deldesc = {
|
||||
order = 70,
|
||||
type = "description",
|
||||
name = "\n" .. L["delete_desc"],
|
||||
},
|
||||
delete = {
|
||||
order = 80,
|
||||
type = "select",
|
||||
name = L["delete"],
|
||||
desc = L["delete_sub"],
|
||||
get = false,
|
||||
set = "DeleteProfile",
|
||||
values = "ListProfiles",
|
||||
disabled = "HasNoProfiles",
|
||||
arg = "nocurrent",
|
||||
confirm = true,
|
||||
confirmText = L["delete_confirm"],
|
||||
},
|
||||
}
|
||||
|
||||
--- Get/Create a option table that you can use in your addon to control the profiles of AceDB-3.0.
|
||||
-- @param db The database object to create the options table for.
|
||||
-- @return The options table to be used in AceConfig-3.0
|
||||
-- @usage
|
||||
-- -- Assuming `options` is your top-level options table and `self.db` is your database:
|
||||
-- options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
|
||||
function AceDBOptions:GetOptionsTable(db, noDefaultProfiles)
|
||||
local tbl = AceDBOptions.optionTables[db] or {
|
||||
type = "group",
|
||||
name = L["profiles"],
|
||||
desc = L["profiles_sub"],
|
||||
}
|
||||
|
||||
tbl.handler = getOptionsHandler(db, noDefaultProfiles)
|
||||
tbl.args = optionsTable
|
||||
|
||||
AceDBOptions.optionTables[db] = tbl
|
||||
return tbl
|
||||
end
|
||||
|
||||
-- upgrade existing tables
|
||||
for db,tbl in pairs(AceDBOptions.optionTables) do
|
||||
tbl.handler = getOptionsHandler(db)
|
||||
tbl.args = optionsTable
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceDBOptions-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,126 +0,0 @@
|
||||
--- AceEvent-3.0 provides event registration and secure dispatching.
|
||||
-- All dispatching is done using **CallbackHandler-1.0**. AceEvent is a simple wrapper around
|
||||
-- CallbackHandler, and dispatches all game events or addon message to the registrees.
|
||||
--
|
||||
-- **AceEvent-3.0** can be embeded into your addon, either explicitly by calling AceEvent:Embed(MyAddon) or by
|
||||
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
|
||||
-- and can be accessed directly, without having to explicitly call AceEvent itself.\\
|
||||
-- It is recommended to embed AceEvent, otherwise you'll have to specify a custom `self` on all calls you
|
||||
-- make into AceEvent.
|
||||
-- @class file
|
||||
-- @name AceEvent-3.0
|
||||
-- @release $Id: AceEvent-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
local CallbackHandler = LibStub("CallbackHandler-1.0")
|
||||
|
||||
local MAJOR, MINOR = "AceEvent-3.0", 4
|
||||
local AceEvent = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceEvent then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
AceEvent.frame = AceEvent.frame or CreateFrame("Frame", "AceEvent30Frame") -- our event frame
|
||||
AceEvent.embeds = AceEvent.embeds or {} -- what objects embed this lib
|
||||
|
||||
-- APIs and registry for blizzard events, using CallbackHandler lib
|
||||
if not AceEvent.events then
|
||||
AceEvent.events = CallbackHandler:New(AceEvent,
|
||||
"RegisterEvent", "UnregisterEvent", "UnregisterAllEvents")
|
||||
end
|
||||
|
||||
function AceEvent.events:OnUsed(target, eventname)
|
||||
AceEvent.frame:RegisterEvent(eventname)
|
||||
end
|
||||
|
||||
function AceEvent.events:OnUnused(target, eventname)
|
||||
AceEvent.frame:UnregisterEvent(eventname)
|
||||
end
|
||||
|
||||
|
||||
-- APIs and registry for IPC messages, using CallbackHandler lib
|
||||
if not AceEvent.messages then
|
||||
AceEvent.messages = CallbackHandler:New(AceEvent,
|
||||
"RegisterMessage", "UnregisterMessage", "UnregisterAllMessages"
|
||||
)
|
||||
AceEvent.SendMessage = AceEvent.messages.Fire
|
||||
end
|
||||
|
||||
--- embedding and embed handling
|
||||
local mixins = {
|
||||
"RegisterEvent", "UnregisterEvent",
|
||||
"RegisterMessage", "UnregisterMessage",
|
||||
"SendMessage",
|
||||
"UnregisterAllEvents", "UnregisterAllMessages",
|
||||
}
|
||||
|
||||
--- Register for a Blizzard Event.
|
||||
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
|
||||
-- Any arguments to the event will be passed on after that.
|
||||
-- @name AceEvent:RegisterEvent
|
||||
-- @class function
|
||||
-- @paramsig event[, callback [, arg]]
|
||||
-- @param event The event to register for
|
||||
-- @param callback The callback function to call when the event is triggered (funcref or method, defaults to a method with the event name)
|
||||
-- @param arg An optional argument to pass to the callback function
|
||||
|
||||
--- Unregister an event.
|
||||
-- @name AceEvent:UnregisterEvent
|
||||
-- @class function
|
||||
-- @paramsig event
|
||||
-- @param event The event to unregister
|
||||
|
||||
--- Register for a custom AceEvent-internal message.
|
||||
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
|
||||
-- Any arguments to the event will be passed on after that.
|
||||
-- @name AceEvent:RegisterMessage
|
||||
-- @class function
|
||||
-- @paramsig message[, callback [, arg]]
|
||||
-- @param message The message to register for
|
||||
-- @param callback The callback function to call when the message is triggered (funcref or method, defaults to a method with the event name)
|
||||
-- @param arg An optional argument to pass to the callback function
|
||||
|
||||
--- Unregister a message
|
||||
-- @name AceEvent:UnregisterMessage
|
||||
-- @class function
|
||||
-- @paramsig message
|
||||
-- @param message The message to unregister
|
||||
|
||||
--- Send a message over the AceEvent-3.0 internal message system to other addons registered for this message.
|
||||
-- @name AceEvent:SendMessage
|
||||
-- @class function
|
||||
-- @paramsig message, ...
|
||||
-- @param message The message to send
|
||||
-- @param ... Any arguments to the message
|
||||
|
||||
|
||||
-- Embeds AceEvent into the target object making the functions from the mixins list available on target:..
|
||||
-- @param target target object to embed AceEvent in
|
||||
function AceEvent:Embed(target)
|
||||
for k, v in pairs(mixins) do
|
||||
target[v] = self[v]
|
||||
end
|
||||
self.embeds[target] = true
|
||||
return target
|
||||
end
|
||||
|
||||
-- AceEvent:OnEmbedDisable( target )
|
||||
-- target (object) - target object that is being disabled
|
||||
--
|
||||
-- Unregister all events messages etc when the target disables.
|
||||
-- this method should be called by the target manually or by an addon framework
|
||||
function AceEvent:OnEmbedDisable(target)
|
||||
target:UnregisterAllEvents()
|
||||
target:UnregisterAllMessages()
|
||||
end
|
||||
|
||||
-- Script to fire blizzard events into the event listeners
|
||||
local events = AceEvent.events
|
||||
AceEvent.frame:SetScript("OnEvent", function(this, event, ...)
|
||||
events:Fire(event, ...)
|
||||
end)
|
||||
|
||||
--- Finally: upgrade our old embeds
|
||||
for target, v in pairs(AceEvent.embeds) do
|
||||
AceEvent:Embed(target)
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceEvent-3.0.lua"/>
|
||||
</Ui>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceGUI-3.0.lua"/>
|
||||
<!-- Container -->
|
||||
<Script file="widgets\AceGUIContainer-BlizOptionsGroup.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-DropDownGroup.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-Frame.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-InlineGroup.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-ScrollFrame.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-SimpleGroup.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-TabGroup.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-TreeGroup.lua"/>
|
||||
<Script file="widgets\AceGUIContainer-Window.lua"/>
|
||||
<!-- Widgets -->
|
||||
<Script file="widgets\AceGUIWidget-Button.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-CheckBox.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-ColorPicker.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-DropDown.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-DropDown-Items.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-EditBox.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-Heading.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-Icon.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-InteractiveLabel.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-Keybinding.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-Label.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-MultiLineEditBox.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-Slider.lua"/>
|
||||
</Ui>
|
||||
@@ -1,138 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
BlizOptionsGroup Container
|
||||
Simple container widget for the integration of AceGUI into the Blizzard Interface Options
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "BlizOptionsGroup", 21
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
local function OnShow(frame)
|
||||
frame.obj:Fire("OnShow")
|
||||
end
|
||||
|
||||
local function OnHide(frame)
|
||||
frame.obj:Fire("OnHide")
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
local function okay(frame)
|
||||
frame.obj:Fire("okay")
|
||||
end
|
||||
|
||||
local function cancel(frame)
|
||||
frame.obj:Fire("cancel")
|
||||
end
|
||||
|
||||
local function default(frame)
|
||||
frame.obj:Fire("default")
|
||||
end
|
||||
|
||||
local function refresh(frame)
|
||||
frame.obj:Fire("refresh")
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetName()
|
||||
self:SetTitle()
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
local contentwidth = width - 63
|
||||
if contentwidth < 0 then
|
||||
contentwidth = 0
|
||||
end
|
||||
content:SetWidth(contentwidth)
|
||||
content.width = contentwidth
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
local contentheight = height - 26
|
||||
if contentheight < 0 then
|
||||
contentheight = 0
|
||||
end
|
||||
content:SetHeight(contentheight)
|
||||
content.height = contentheight
|
||||
end,
|
||||
|
||||
["SetName"] = function(self, name, parent)
|
||||
self.frame.name = name
|
||||
self.frame.parent = parent
|
||||
end,
|
||||
|
||||
["SetTitle"] = function(self, title)
|
||||
local content = self.content
|
||||
content:ClearAllPoints()
|
||||
if not title or title == "" then
|
||||
content:SetPoint("TOPLEFT", 10, -10)
|
||||
self.label:SetText("")
|
||||
else
|
||||
content:SetPoint("TOPLEFT", 10, -40)
|
||||
self.label:SetText(title)
|
||||
end
|
||||
content:SetPoint("BOTTOMRIGHT", -10, 10)
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:Hide()
|
||||
|
||||
-- support functions for the Blizzard Interface Options
|
||||
frame.okay = okay
|
||||
frame.cancel = cancel
|
||||
frame.default = default
|
||||
frame.refresh = refresh
|
||||
|
||||
frame:SetScript("OnHide", OnHide)
|
||||
frame:SetScript("OnShow", OnShow)
|
||||
|
||||
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
|
||||
label:SetPoint("TOPLEFT", 10, -15)
|
||||
label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45)
|
||||
label:SetJustifyH("LEFT")
|
||||
label:SetJustifyV("TOP")
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, frame)
|
||||
content:SetPoint("TOPLEFT", 10, -10)
|
||||
content:SetPoint("BOTTOMRIGHT", -10, 10)
|
||||
|
||||
local widget = {
|
||||
label = label,
|
||||
frame = frame,
|
||||
content = content,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,157 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
DropdownGroup Container
|
||||
Container controlled by a dropdown on the top.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "DropdownGroup", 22
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local assert, pairs, type = assert, pairs, type
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function SelectedGroup(self, event, value)
|
||||
local group = self.parentgroup
|
||||
local status = group.status or group.localstatus
|
||||
status.selected = value
|
||||
self.parentgroup:Fire("OnGroupSelected", value)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self.dropdown:SetText("")
|
||||
self:SetDropdownWidth(200)
|
||||
self:SetTitle("")
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self.dropdown.list = nil
|
||||
self.status = nil
|
||||
for k in pairs(self.localstatus) do
|
||||
self.localstatus[k] = nil
|
||||
end
|
||||
end,
|
||||
|
||||
["SetTitle"] = function(self, title)
|
||||
self.titletext:SetText(title)
|
||||
self.dropdown.frame:ClearAllPoints()
|
||||
if title and title ~= "" then
|
||||
self.dropdown.frame:SetPoint("TOPRIGHT", -2, 0)
|
||||
else
|
||||
self.dropdown.frame:SetPoint("TOPLEFT", -1, 0)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetGroupList"] = function(self,list,order)
|
||||
self.dropdown:SetList(list,order)
|
||||
end,
|
||||
|
||||
["SetStatusTable"] = function(self, status)
|
||||
assert(type(status) == "table")
|
||||
self.status = status
|
||||
end,
|
||||
|
||||
["SetGroup"] = function(self,group)
|
||||
self.dropdown:SetValue(group)
|
||||
local status = self.status or self.localstatus
|
||||
status.selected = group
|
||||
self:Fire("OnGroupSelected", group)
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
local contentwidth = width - 26
|
||||
if contentwidth < 0 then
|
||||
contentwidth = 0
|
||||
end
|
||||
content:SetWidth(contentwidth)
|
||||
content.width = contentwidth
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
local contentheight = height - 63
|
||||
if contentheight < 0 then
|
||||
contentheight = 0
|
||||
end
|
||||
content:SetHeight(contentheight)
|
||||
content.height = contentheight
|
||||
end,
|
||||
|
||||
["LayoutFinished"] = function(self, width, height)
|
||||
self:SetHeight((height or 0) + 63)
|
||||
end,
|
||||
|
||||
["SetDropdownWidth"] = function(self, width)
|
||||
self.dropdown:SetWidth(width)
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local PaneBackdrop = {
|
||||
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 5, bottom = 3 }
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:SetHeight(100)
|
||||
frame:SetWidth(100)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
titletext:SetPoint("TOPLEFT", 4, -5)
|
||||
titletext:SetPoint("TOPRIGHT", -4, -5)
|
||||
titletext:SetJustifyH("LEFT")
|
||||
titletext:SetHeight(18)
|
||||
|
||||
local dropdown = AceGUI:Create("Dropdown")
|
||||
dropdown.frame:SetParent(frame)
|
||||
dropdown.frame:SetFrameLevel(dropdown.frame:GetFrameLevel() + 2)
|
||||
dropdown:SetCallback("OnValueChanged", SelectedGroup)
|
||||
dropdown.frame:SetPoint("TOPLEFT", -1, 0)
|
||||
dropdown.frame:Show()
|
||||
dropdown:SetLabel("")
|
||||
|
||||
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
border:SetPoint("TOPLEFT", 0, -26)
|
||||
border:SetPoint("BOTTOMRIGHT", 0, 3)
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
border:SetBackdropColor(0.1,0.1,0.1,0.5)
|
||||
border:SetBackdropBorderColor(0.4,0.4,0.4)
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, border)
|
||||
content:SetPoint("TOPLEFT", 10, -10)
|
||||
content:SetPoint("BOTTOMRIGHT", -10, 10)
|
||||
|
||||
local widget = {
|
||||
frame = frame,
|
||||
localstatus = {},
|
||||
titletext = titletext,
|
||||
dropdown = dropdown,
|
||||
border = border,
|
||||
content = content,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
dropdown.parentgroup = widget
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,316 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Frame Container
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Frame", 27
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, assert, type = pairs, assert, type
|
||||
local wipe = table.wipe
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: CLOSE
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Button_OnClick(frame)
|
||||
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
|
||||
frame.obj:Hide()
|
||||
end
|
||||
|
||||
local function Frame_OnShow(frame)
|
||||
frame.obj:Fire("OnShow")
|
||||
end
|
||||
|
||||
local function Frame_OnClose(frame)
|
||||
frame.obj:Fire("OnClose")
|
||||
end
|
||||
|
||||
local function Frame_OnMouseDown(frame)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function Title_OnMouseDown(frame)
|
||||
frame:GetParent():StartMoving()
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function MoverSizer_OnMouseUp(mover)
|
||||
local frame = mover:GetParent()
|
||||
frame:StopMovingOrSizing()
|
||||
local self = frame.obj
|
||||
local status = self.status or self.localstatus
|
||||
status.width = frame:GetWidth()
|
||||
status.height = frame:GetHeight()
|
||||
status.top = frame:GetTop()
|
||||
status.left = frame:GetLeft()
|
||||
end
|
||||
|
||||
local function SizerSE_OnMouseDown(frame)
|
||||
frame:GetParent():StartSizing("BOTTOMRIGHT")
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function SizerS_OnMouseDown(frame)
|
||||
frame:GetParent():StartSizing("BOTTOM")
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function SizerE_OnMouseDown(frame)
|
||||
frame:GetParent():StartSizing("RIGHT")
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function StatusBar_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnterStatusBar")
|
||||
end
|
||||
|
||||
local function StatusBar_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeaveStatusBar")
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self.frame:SetParent(UIParent)
|
||||
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
self:SetTitle()
|
||||
self:SetStatusText()
|
||||
self:ApplyStatus()
|
||||
self:Show()
|
||||
self:EnableResize(true)
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self.status = nil
|
||||
wipe(self.localstatus)
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
local contentwidth = width - 34
|
||||
if contentwidth < 0 then
|
||||
contentwidth = 0
|
||||
end
|
||||
content:SetWidth(contentwidth)
|
||||
content.width = contentwidth
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
local contentheight = height - 57
|
||||
if contentheight < 0 then
|
||||
contentheight = 0
|
||||
end
|
||||
content:SetHeight(contentheight)
|
||||
content.height = contentheight
|
||||
end,
|
||||
|
||||
["SetTitle"] = function(self, title)
|
||||
self.titletext:SetText(title)
|
||||
self.titlebg:SetWidth((self.titletext:GetWidth() or 0) + 10)
|
||||
end,
|
||||
|
||||
["SetStatusText"] = function(self, text)
|
||||
self.statustext:SetText(text)
|
||||
end,
|
||||
|
||||
["Hide"] = function(self)
|
||||
self.frame:Hide()
|
||||
end,
|
||||
|
||||
["Show"] = function(self)
|
||||
self.frame:Show()
|
||||
end,
|
||||
|
||||
["EnableResize"] = function(self, state)
|
||||
local func = state and "Show" or "Hide"
|
||||
self.sizer_se[func](self.sizer_se)
|
||||
self.sizer_s[func](self.sizer_s)
|
||||
self.sizer_e[func](self.sizer_e)
|
||||
end,
|
||||
|
||||
-- called to set an external table to store status in
|
||||
["SetStatusTable"] = function(self, status)
|
||||
assert(type(status) == "table")
|
||||
self.status = status
|
||||
self:ApplyStatus()
|
||||
end,
|
||||
|
||||
["ApplyStatus"] = function(self)
|
||||
local status = self.status or self.localstatus
|
||||
local frame = self.frame
|
||||
self:SetWidth(status.width or 700)
|
||||
self:SetHeight(status.height or 500)
|
||||
frame:ClearAllPoints()
|
||||
if status.top and status.left then
|
||||
frame:SetPoint("TOP", UIParent, "BOTTOM", 0, status.top)
|
||||
frame:SetPoint("LEFT", UIParent, "LEFT", status.left, 0)
|
||||
else
|
||||
frame:SetPoint("CENTER")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local FrameBackdrop = {
|
||||
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
|
||||
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
|
||||
tile = true, tileSize = 32, edgeSize = 32,
|
||||
insets = { left = 8, right = 8, top = 8, bottom = 8 }
|
||||
}
|
||||
|
||||
local PaneBackdrop = {
|
||||
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 5, bottom = 3 }
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetMovable(true)
|
||||
frame:SetResizable(true)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
frame:SetBackdrop(FrameBackdrop)
|
||||
frame:SetBackdropColor(0, 0, 0, 1)
|
||||
frame:SetMinResize(400, 200)
|
||||
frame:SetToplevel(true)
|
||||
frame:SetScript("OnShow", Frame_OnShow)
|
||||
frame:SetScript("OnHide", Frame_OnClose)
|
||||
frame:SetScript("OnMouseDown", Frame_OnMouseDown)
|
||||
|
||||
local closebutton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
|
||||
closebutton:SetScript("OnClick", Button_OnClick)
|
||||
closebutton:SetPoint("BOTTOMRIGHT", -27, 17)
|
||||
closebutton:SetHeight(20)
|
||||
closebutton:SetWidth(100)
|
||||
closebutton:SetText(CLOSE)
|
||||
|
||||
local statusbg = CreateFrame("Button", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
statusbg:SetPoint("BOTTOMLEFT", 15, 15)
|
||||
statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
|
||||
statusbg:SetHeight(24)
|
||||
statusbg:SetBackdrop(PaneBackdrop)
|
||||
statusbg:SetBackdropColor(0.1,0.1,0.1)
|
||||
statusbg:SetBackdropBorderColor(0.4,0.4,0.4)
|
||||
statusbg:SetScript("OnEnter", StatusBar_OnEnter)
|
||||
statusbg:SetScript("OnLeave", StatusBar_OnLeave)
|
||||
|
||||
local statustext = statusbg:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
statustext:SetPoint("TOPLEFT", 7, -2)
|
||||
statustext:SetPoint("BOTTOMRIGHT", -7, 2)
|
||||
statustext:SetHeight(20)
|
||||
statustext:SetJustifyH("LEFT")
|
||||
statustext:SetText("")
|
||||
|
||||
local titlebg = frame:CreateTexture(nil, "OVERLAY")
|
||||
titlebg:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
|
||||
titlebg:SetTexCoord(0.31, 0.67, 0, 0.63)
|
||||
titlebg:SetPoint("TOP", 0, 12)
|
||||
titlebg:SetWidth(100)
|
||||
titlebg:SetHeight(40)
|
||||
|
||||
local title = CreateFrame("Frame", nil, frame)
|
||||
title:EnableMouse(true)
|
||||
title:SetScript("OnMouseDown", Title_OnMouseDown)
|
||||
title:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
|
||||
title:SetAllPoints(titlebg)
|
||||
|
||||
local titletext = title:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
titletext:SetPoint("TOP", titlebg, "TOP", 0, -14)
|
||||
|
||||
local titlebg_l = frame:CreateTexture(nil, "OVERLAY")
|
||||
titlebg_l:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
|
||||
titlebg_l:SetTexCoord(0.21, 0.31, 0, 0.63)
|
||||
titlebg_l:SetPoint("RIGHT", titlebg, "LEFT")
|
||||
titlebg_l:SetWidth(30)
|
||||
titlebg_l:SetHeight(40)
|
||||
|
||||
local titlebg_r = frame:CreateTexture(nil, "OVERLAY")
|
||||
titlebg_r:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
|
||||
titlebg_r:SetTexCoord(0.67, 0.77, 0, 0.63)
|
||||
titlebg_r:SetPoint("LEFT", titlebg, "RIGHT")
|
||||
titlebg_r:SetWidth(30)
|
||||
titlebg_r:SetHeight(40)
|
||||
|
||||
local sizer_se = CreateFrame("Frame", nil, frame)
|
||||
sizer_se:SetPoint("BOTTOMRIGHT")
|
||||
sizer_se:SetWidth(25)
|
||||
sizer_se:SetHeight(25)
|
||||
sizer_se:EnableMouse()
|
||||
sizer_se:SetScript("OnMouseDown",SizerSE_OnMouseDown)
|
||||
sizer_se:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
|
||||
|
||||
local line1 = sizer_se:CreateTexture(nil, "BACKGROUND")
|
||||
line1:SetWidth(14)
|
||||
line1:SetHeight(14)
|
||||
line1:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||
local x = 0.1 * 14/17
|
||||
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||
|
||||
local line2 = sizer_se:CreateTexture(nil, "BACKGROUND")
|
||||
line2:SetWidth(8)
|
||||
line2:SetHeight(8)
|
||||
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||
line2:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||
local x = 0.1 * 8/17
|
||||
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||
|
||||
local sizer_s = CreateFrame("Frame", nil, frame)
|
||||
sizer_s:SetPoint("BOTTOMRIGHT", -25, 0)
|
||||
sizer_s:SetPoint("BOTTOMLEFT")
|
||||
sizer_s:SetHeight(25)
|
||||
sizer_s:EnableMouse(true)
|
||||
sizer_s:SetScript("OnMouseDown", SizerS_OnMouseDown)
|
||||
sizer_s:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
|
||||
|
||||
local sizer_e = CreateFrame("Frame", nil, frame)
|
||||
sizer_e:SetPoint("BOTTOMRIGHT", 0, 25)
|
||||
sizer_e:SetPoint("TOPRIGHT")
|
||||
sizer_e:SetWidth(25)
|
||||
sizer_e:EnableMouse(true)
|
||||
sizer_e:SetScript("OnMouseDown", SizerE_OnMouseDown)
|
||||
sizer_e:SetScript("OnMouseUp", MoverSizer_OnMouseUp)
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, frame)
|
||||
content:SetPoint("TOPLEFT", 17, -27)
|
||||
content:SetPoint("BOTTOMRIGHT", -17, 40)
|
||||
|
||||
local widget = {
|
||||
localstatus = {},
|
||||
titletext = titletext,
|
||||
statustext = statustext,
|
||||
titlebg = titlebg,
|
||||
sizer_se = sizer_se,
|
||||
sizer_s = sizer_s,
|
||||
sizer_e = sizer_e,
|
||||
content = content,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
closebutton.obj, statusbg.obj = widget, widget
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,103 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
InlineGroup Container
|
||||
Simple container widget that creates a visible "box" with an optional title.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "InlineGroup", 22
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetWidth(300)
|
||||
self:SetHeight(100)
|
||||
self:SetTitle("")
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetTitle"] = function(self,title)
|
||||
self.titletext:SetText(title)
|
||||
end,
|
||||
|
||||
|
||||
["LayoutFinished"] = function(self, width, height)
|
||||
if self.noAutoHeight then return end
|
||||
self:SetHeight((height or 0) + 40)
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
local contentwidth = width - 20
|
||||
if contentwidth < 0 then
|
||||
contentwidth = 0
|
||||
end
|
||||
content:SetWidth(contentwidth)
|
||||
content.width = contentwidth
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
local contentheight = height - 20
|
||||
if contentheight < 0 then
|
||||
contentheight = 0
|
||||
end
|
||||
content:SetHeight(contentheight)
|
||||
content.height = contentheight
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local PaneBackdrop = {
|
||||
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 5, bottom = 3 }
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
titletext:SetPoint("TOPLEFT", 14, 0)
|
||||
titletext:SetPoint("TOPRIGHT", -14, 0)
|
||||
titletext:SetJustifyH("LEFT")
|
||||
titletext:SetHeight(18)
|
||||
|
||||
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
border:SetPoint("TOPLEFT", 0, -17)
|
||||
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
|
||||
border:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, border)
|
||||
content:SetPoint("TOPLEFT", 10, -10)
|
||||
content:SetPoint("BOTTOMRIGHT", -10, 10)
|
||||
|
||||
local widget = {
|
||||
frame = frame,
|
||||
content = content,
|
||||
titletext = titletext,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,215 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
ScrollFrame Container
|
||||
Plain container that scrolls its content and doesn't grow in height.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "ScrollFrame", 26
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, assert, type = pairs, assert, type
|
||||
local min, max, floor = math.min, math.max, math.floor
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function FixScrollOnUpdate(frame)
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
frame.obj:FixScroll()
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function ScrollFrame_OnMouseWheel(frame, value)
|
||||
frame.obj:MoveScroll(value)
|
||||
end
|
||||
|
||||
local function ScrollFrame_OnSizeChanged(frame)
|
||||
frame:SetScript("OnUpdate", FixScrollOnUpdate)
|
||||
end
|
||||
|
||||
local function ScrollBar_OnScrollValueChanged(frame, value)
|
||||
frame.obj:SetScroll(value)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetScroll(0)
|
||||
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self.status = nil
|
||||
for k in pairs(self.localstatus) do
|
||||
self.localstatus[k] = nil
|
||||
end
|
||||
self.scrollframe:SetPoint("BOTTOMRIGHT")
|
||||
self.scrollbar:Hide()
|
||||
self.scrollBarShown = nil
|
||||
self.content.height, self.content.width, self.content.original_width = nil, nil, nil
|
||||
end,
|
||||
|
||||
["SetScroll"] = function(self, value)
|
||||
local status = self.status or self.localstatus
|
||||
local viewheight = self.scrollframe:GetHeight()
|
||||
local height = self.content:GetHeight()
|
||||
local offset
|
||||
|
||||
if viewheight > height then
|
||||
offset = 0
|
||||
else
|
||||
offset = floor((height - viewheight) / 1000.0 * value)
|
||||
end
|
||||
self.content:ClearAllPoints()
|
||||
self.content:SetPoint("TOPLEFT", 0, offset)
|
||||
self.content:SetPoint("TOPRIGHT", 0, offset)
|
||||
status.offset = offset
|
||||
status.scrollvalue = value
|
||||
end,
|
||||
|
||||
["MoveScroll"] = function(self, value)
|
||||
local status = self.status or self.localstatus
|
||||
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
|
||||
|
||||
if self.scrollBarShown then
|
||||
local diff = height - viewheight
|
||||
local delta = 1
|
||||
if value < 0 then
|
||||
delta = -1
|
||||
end
|
||||
self.scrollbar:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
|
||||
end
|
||||
end,
|
||||
|
||||
["FixScroll"] = function(self)
|
||||
if self.updateLock then return end
|
||||
self.updateLock = true
|
||||
local status = self.status or self.localstatus
|
||||
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
|
||||
local offset = status.offset or 0
|
||||
-- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys
|
||||
-- No-one is going to miss 2 pixels at the bottom of the frame, anyhow!
|
||||
if viewheight < height + 2 then
|
||||
if self.scrollBarShown then
|
||||
self.scrollBarShown = nil
|
||||
self.scrollbar:Hide()
|
||||
self.scrollbar:SetValue(0)
|
||||
self.scrollframe:SetPoint("BOTTOMRIGHT")
|
||||
if self.content.original_width then
|
||||
self.content.width = self.content.original_width
|
||||
end
|
||||
self:DoLayout()
|
||||
end
|
||||
else
|
||||
if not self.scrollBarShown then
|
||||
self.scrollBarShown = true
|
||||
self.scrollbar:Show()
|
||||
self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0)
|
||||
if self.content.original_width then
|
||||
self.content.width = self.content.original_width - 20
|
||||
end
|
||||
self:DoLayout()
|
||||
end
|
||||
local value = (offset / (viewheight - height) * 1000)
|
||||
if value > 1000 then value = 1000 end
|
||||
self.scrollbar:SetValue(value)
|
||||
self:SetScroll(value)
|
||||
if value < 1000 then
|
||||
self.content:ClearAllPoints()
|
||||
self.content:SetPoint("TOPLEFT", 0, offset)
|
||||
self.content:SetPoint("TOPRIGHT", 0, offset)
|
||||
status.offset = offset
|
||||
end
|
||||
end
|
||||
self.updateLock = nil
|
||||
end,
|
||||
|
||||
["LayoutFinished"] = function(self, width, height)
|
||||
self.content:SetHeight(height or 0 + 20)
|
||||
|
||||
-- update the scrollframe
|
||||
self:FixScroll()
|
||||
|
||||
-- schedule another update when everything has "settled"
|
||||
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
|
||||
end,
|
||||
|
||||
["SetStatusTable"] = function(self, status)
|
||||
assert(type(status) == "table")
|
||||
self.status = status
|
||||
if not status.scrollvalue then
|
||||
status.scrollvalue = 0
|
||||
end
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
content.width = width - (self.scrollBarShown and 20 or 0)
|
||||
content.original_width = width
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
content.height = height
|
||||
end
|
||||
}
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
local num = AceGUI:GetNextWidgetNum(Type)
|
||||
|
||||
local scrollframe = CreateFrame("ScrollFrame", nil, frame)
|
||||
scrollframe:SetPoint("TOPLEFT")
|
||||
scrollframe:SetPoint("BOTTOMRIGHT")
|
||||
scrollframe:EnableMouseWheel(true)
|
||||
scrollframe:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel)
|
||||
scrollframe:SetScript("OnSizeChanged", ScrollFrame_OnSizeChanged)
|
||||
|
||||
local scrollbar = CreateFrame("Slider", ("AceConfigDialogScrollFrame%dScrollBar"):format(num), scrollframe, "UIPanelScrollBarTemplate")
|
||||
scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, -16)
|
||||
scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 4, 16)
|
||||
scrollbar:SetMinMaxValues(0, 1000)
|
||||
scrollbar:SetValueStep(1)
|
||||
scrollbar:SetValue(0)
|
||||
scrollbar:SetWidth(16)
|
||||
scrollbar:Hide()
|
||||
-- set the script as the last step, so it doesn't fire yet
|
||||
scrollbar:SetScript("OnValueChanged", ScrollBar_OnScrollValueChanged)
|
||||
|
||||
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
||||
scrollbg:SetAllPoints(scrollbar)
|
||||
scrollbg:SetColorTexture(0, 0, 0, 0.4)
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, scrollframe)
|
||||
content:SetPoint("TOPLEFT")
|
||||
content:SetPoint("TOPRIGHT")
|
||||
content:SetHeight(400)
|
||||
scrollframe:SetScrollChild(content)
|
||||
|
||||
local widget = {
|
||||
localstatus = { scrollvalue = 0 },
|
||||
scrollframe = scrollframe,
|
||||
scrollbar = scrollbar,
|
||||
content = content,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
scrollframe.obj, scrollbar.obj = widget, widget
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,69 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
SimpleGroup Container
|
||||
Simple container widget that just groups widgets.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "SimpleGroup", 20
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetWidth(300)
|
||||
self:SetHeight(100)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["LayoutFinished"] = function(self, width, height)
|
||||
if self.noAutoHeight then return end
|
||||
self:SetHeight(height or 0)
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
content:SetWidth(width)
|
||||
content.width = width
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
content:SetHeight(height)
|
||||
content.height = height
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, frame)
|
||||
content:SetPoint("TOPLEFT")
|
||||
content:SetPoint("BOTTOMRIGHT")
|
||||
|
||||
local widget = {
|
||||
frame = frame,
|
||||
content = content,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,349 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
TabGroup Container
|
||||
Container that uses tabs on top to switch between groups.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "TabGroup", 37
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: PanelTemplates_TabResize, PanelTemplates_SetDisabledTabState, PanelTemplates_SelectTab, PanelTemplates_DeselectTab
|
||||
|
||||
-- local upvalue storage used by BuildTabs
|
||||
local widths = {}
|
||||
local rowwidths = {}
|
||||
local rowends = {}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function UpdateTabLook(frame)
|
||||
if frame.disabled then
|
||||
PanelTemplates_SetDisabledTabState(frame)
|
||||
elseif frame.selected then
|
||||
PanelTemplates_SelectTab(frame)
|
||||
else
|
||||
PanelTemplates_DeselectTab(frame)
|
||||
end
|
||||
end
|
||||
|
||||
local function Tab_SetText(frame, text)
|
||||
frame:_SetText(text)
|
||||
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
|
||||
PanelTemplates_TabResize(frame, 0, nil, nil, width, frame:GetFontString():GetStringWidth())
|
||||
end
|
||||
|
||||
local function Tab_SetSelected(frame, selected)
|
||||
frame.selected = selected
|
||||
UpdateTabLook(frame)
|
||||
end
|
||||
|
||||
local function Tab_SetDisabled(frame, disabled)
|
||||
frame.disabled = disabled
|
||||
UpdateTabLook(frame)
|
||||
end
|
||||
|
||||
local function BuildTabsOnUpdate(frame)
|
||||
local self = frame.obj
|
||||
self:BuildTabs()
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Tab_OnClick(frame)
|
||||
if not (frame.selected or frame.disabled) then
|
||||
PlaySound(841) -- SOUNDKIT.IG_CHARACTER_INFO_TAB
|
||||
frame.obj:SelectTab(frame.value)
|
||||
end
|
||||
end
|
||||
|
||||
local function Tab_OnEnter(frame)
|
||||
local self = frame.obj
|
||||
self:Fire("OnTabEnter", self.tabs[frame.id].value, frame)
|
||||
end
|
||||
|
||||
local function Tab_OnLeave(frame)
|
||||
local self = frame.obj
|
||||
self:Fire("OnTabLeave", self.tabs[frame.id].value, frame)
|
||||
end
|
||||
|
||||
local function Tab_OnShow(frame)
|
||||
_G[frame:GetName().."HighlightTexture"]:SetWidth(frame:GetTextWidth() + 30)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetTitle()
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self.status = nil
|
||||
for k in pairs(self.localstatus) do
|
||||
self.localstatus[k] = nil
|
||||
end
|
||||
self.tablist = nil
|
||||
for _, tab in pairs(self.tabs) do
|
||||
tab:Hide()
|
||||
end
|
||||
end,
|
||||
|
||||
["CreateTab"] = function(self, id)
|
||||
local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id)
|
||||
local tab = CreateFrame("Button", tabname, self.border, "OptionsFrameTabButtonTemplate")
|
||||
tab.obj = self
|
||||
tab.id = id
|
||||
|
||||
tab.text = _G[tabname .. "Text"]
|
||||
tab.text:ClearAllPoints()
|
||||
tab.text:SetPoint("LEFT", 14, -3)
|
||||
tab.text:SetPoint("RIGHT", -12, -3)
|
||||
|
||||
tab:SetScript("OnClick", Tab_OnClick)
|
||||
tab:SetScript("OnEnter", Tab_OnEnter)
|
||||
tab:SetScript("OnLeave", Tab_OnLeave)
|
||||
tab:SetScript("OnShow", Tab_OnShow)
|
||||
|
||||
tab._SetText = tab.SetText
|
||||
tab.SetText = Tab_SetText
|
||||
tab.SetSelected = Tab_SetSelected
|
||||
tab.SetDisabled = Tab_SetDisabled
|
||||
|
||||
return tab
|
||||
end,
|
||||
|
||||
["SetTitle"] = function(self, text)
|
||||
self.titletext:SetText(text or "")
|
||||
if text and text ~= "" then
|
||||
self.alignoffset = 25
|
||||
else
|
||||
self.alignoffset = 18
|
||||
end
|
||||
self:BuildTabs()
|
||||
end,
|
||||
|
||||
["SetStatusTable"] = function(self, status)
|
||||
assert(type(status) == "table")
|
||||
self.status = status
|
||||
end,
|
||||
|
||||
["SelectTab"] = function(self, value)
|
||||
local status = self.status or self.localstatus
|
||||
local found
|
||||
for i, v in ipairs(self.tabs) do
|
||||
if v.value == value then
|
||||
v:SetSelected(true)
|
||||
found = true
|
||||
else
|
||||
v:SetSelected(false)
|
||||
end
|
||||
end
|
||||
status.selected = value
|
||||
if found then
|
||||
self:Fire("OnGroupSelected",value)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetTabs"] = function(self, tabs)
|
||||
self.tablist = tabs
|
||||
self:BuildTabs()
|
||||
end,
|
||||
|
||||
|
||||
["BuildTabs"] = function(self)
|
||||
local hastitle = (self.titletext:GetText() and self.titletext:GetText() ~= "")
|
||||
local tablist = self.tablist
|
||||
local tabs = self.tabs
|
||||
|
||||
if not tablist then return end
|
||||
|
||||
local width = self.frame.width or self.frame:GetWidth() or 0
|
||||
|
||||
wipe(widths)
|
||||
wipe(rowwidths)
|
||||
wipe(rowends)
|
||||
|
||||
--Place Text into tabs and get thier initial width
|
||||
for i, v in ipairs(tablist) do
|
||||
local tab = tabs[i]
|
||||
if not tab then
|
||||
tab = self:CreateTab(i)
|
||||
tabs[i] = tab
|
||||
end
|
||||
|
||||
tab:Show()
|
||||
tab:SetText(v.text)
|
||||
tab:SetDisabled(v.disabled)
|
||||
tab.value = v.value
|
||||
|
||||
widths[i] = tab:GetWidth() - 6 --tabs are anchored 10 pixels from the right side of the previous one to reduce spacing, but add a fixed 4px padding for the text
|
||||
end
|
||||
|
||||
for i = (#tablist)+1, #tabs, 1 do
|
||||
tabs[i]:Hide()
|
||||
end
|
||||
|
||||
--First pass, find the minimum number of rows needed to hold all tabs and the initial tab layout
|
||||
local numtabs = #tablist
|
||||
local numrows = 1
|
||||
local usedwidth = 0
|
||||
|
||||
for i = 1, #tablist do
|
||||
--If this is not the first tab of a row and there isn't room for it
|
||||
if usedwidth ~= 0 and (width - usedwidth - widths[i]) < 0 then
|
||||
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
||||
rowends[numrows] = i - 1
|
||||
numrows = numrows + 1
|
||||
usedwidth = 0
|
||||
end
|
||||
usedwidth = usedwidth + widths[i]
|
||||
end
|
||||
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
||||
rowends[numrows] = #tablist
|
||||
|
||||
--Fix for single tabs being left on the last row, move a tab from the row above if applicable
|
||||
if numrows > 1 then
|
||||
--if the last row has only one tab
|
||||
if rowends[numrows-1] == numtabs-1 then
|
||||
--if there are more than 2 tabs in the 2nd last row
|
||||
if (numrows == 2 and rowends[numrows-1] > 2) or (rowends[numrows] - rowends[numrows-1] > 2) then
|
||||
--move 1 tab from the second last row to the last, if there is enough space
|
||||
if (rowwidths[numrows] + widths[numtabs-1]) <= width then
|
||||
rowends[numrows-1] = rowends[numrows-1] - 1
|
||||
rowwidths[numrows] = rowwidths[numrows] + widths[numtabs-1]
|
||||
rowwidths[numrows-1] = rowwidths[numrows-1] - widths[numtabs-1]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--anchor the rows as defined and resize tabs to fill thier row
|
||||
local starttab = 1
|
||||
for row, endtab in ipairs(rowends) do
|
||||
local first = true
|
||||
for tabno = starttab, endtab do
|
||||
local tab = tabs[tabno]
|
||||
tab:ClearAllPoints()
|
||||
if first then
|
||||
tab:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, -(hastitle and 14 or 7)-(row-1)*20 )
|
||||
first = false
|
||||
else
|
||||
tab:SetPoint("LEFT", tabs[tabno-1], "RIGHT", -10, 0)
|
||||
end
|
||||
end
|
||||
|
||||
-- equal padding for each tab to fill the available width,
|
||||
-- if the used space is above 75% already
|
||||
-- the 18 pixel is the typical width of a scrollbar, so we can have a tab group inside a scrolling frame,
|
||||
-- and not have the tabs jump around funny when switching between tabs that need scrolling and those that don't
|
||||
local padding = 0
|
||||
if not (numrows == 1 and rowwidths[1] < width*0.75 - 18) then
|
||||
padding = (width - rowwidths[row]) / (endtab - starttab+1)
|
||||
end
|
||||
|
||||
for i = starttab, endtab do
|
||||
PanelTemplates_TabResize(tabs[i], padding + 4, nil, nil, width, tabs[i]:GetFontString():GetStringWidth())
|
||||
end
|
||||
starttab = endtab + 1
|
||||
end
|
||||
|
||||
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)
|
||||
self.border:SetPoint("TOPLEFT", 1, -self.borderoffset)
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
local contentwidth = width - 60
|
||||
if contentwidth < 0 then
|
||||
contentwidth = 0
|
||||
end
|
||||
content:SetWidth(contentwidth)
|
||||
content.width = contentwidth
|
||||
self:BuildTabs(self)
|
||||
self.frame:SetScript("OnUpdate", BuildTabsOnUpdate)
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
local contentheight = height - (self.borderoffset + 23)
|
||||
if contentheight < 0 then
|
||||
contentheight = 0
|
||||
end
|
||||
content:SetHeight(contentheight)
|
||||
content.height = contentheight
|
||||
end,
|
||||
|
||||
["LayoutFinished"] = function(self, width, height)
|
||||
if self.noAutoHeight then return end
|
||||
self:SetHeight((height or 0) + (self.borderoffset + 23))
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local PaneBackdrop = {
|
||||
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 5, bottom = 3 }
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local num = AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Frame",nil,UIParent)
|
||||
frame:SetHeight(100)
|
||||
frame:SetWidth(100)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
local titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal")
|
||||
titletext:SetPoint("TOPLEFT", 14, 0)
|
||||
titletext:SetPoint("TOPRIGHT", -14, 0)
|
||||
titletext:SetJustifyH("LEFT")
|
||||
titletext:SetHeight(18)
|
||||
titletext:SetText("")
|
||||
|
||||
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
border:SetPoint("TOPLEFT", 1, -27)
|
||||
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
|
||||
border:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
|
||||
local content = CreateFrame("Frame", nil, border)
|
||||
content:SetPoint("TOPLEFT", 10, -7)
|
||||
content:SetPoint("BOTTOMRIGHT", -10, 7)
|
||||
|
||||
local widget = {
|
||||
num = num,
|
||||
frame = frame,
|
||||
localstatus = {},
|
||||
alignoffset = 18,
|
||||
titletext = titletext,
|
||||
border = border,
|
||||
borderoffset = 27,
|
||||
tabs = {},
|
||||
content = content,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,715 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
TreeGroup Container
|
||||
Container that uses a tree control to switch between groups.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "TreeGroup", 45
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
|
||||
local math_min, math_max, floor = math.min, math.max, floor
|
||||
local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: FONT_COLOR_CODE_CLOSE
|
||||
|
||||
-- Recycling functions
|
||||
local new, del
|
||||
do
|
||||
local pool = setmetatable({},{__mode='k'})
|
||||
function new()
|
||||
local t = next(pool)
|
||||
if t then
|
||||
pool[t] = nil
|
||||
return t
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
function del(t)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
pool[t] = true
|
||||
end
|
||||
end
|
||||
|
||||
local DEFAULT_TREE_WIDTH = 175
|
||||
local DEFAULT_TREE_SIZABLE = true
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function GetButtonUniqueValue(line)
|
||||
local parent = line.parent
|
||||
if parent and parent.value then
|
||||
return GetButtonUniqueValue(parent).."\001"..line.value
|
||||
else
|
||||
return line.value
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateButton(button, treeline, selected, canExpand, isExpanded)
|
||||
local self = button.obj
|
||||
local toggle = button.toggle
|
||||
local text = treeline.text or ""
|
||||
local icon = treeline.icon
|
||||
local iconCoords = treeline.iconCoords
|
||||
local level = treeline.level
|
||||
local value = treeline.value
|
||||
local uniquevalue = treeline.uniquevalue
|
||||
local disabled = treeline.disabled
|
||||
|
||||
button.treeline = treeline
|
||||
button.value = value
|
||||
button.uniquevalue = uniquevalue
|
||||
if selected then
|
||||
button:LockHighlight()
|
||||
button.selected = true
|
||||
else
|
||||
button:UnlockHighlight()
|
||||
button.selected = false
|
||||
end
|
||||
button.level = level
|
||||
if ( level == 1 ) then
|
||||
button:SetNormalFontObject("GameFontNormal")
|
||||
button:SetHighlightFontObject("GameFontHighlight")
|
||||
button.text:SetPoint("LEFT", (icon and 16 or 0) + 8, 2)
|
||||
else
|
||||
button:SetNormalFontObject("GameFontHighlightSmall")
|
||||
button:SetHighlightFontObject("GameFontHighlightSmall")
|
||||
button.text:SetPoint("LEFT", (icon and 16 or 0) + 8 * level, 2)
|
||||
end
|
||||
|
||||
if disabled then
|
||||
button:EnableMouse(false)
|
||||
button.text:SetText("|cff808080"..text..FONT_COLOR_CODE_CLOSE)
|
||||
else
|
||||
button.text:SetText(text)
|
||||
button:EnableMouse(true)
|
||||
end
|
||||
|
||||
if icon then
|
||||
button.icon:SetTexture(icon)
|
||||
button.icon:SetPoint("LEFT", 8 * level, (level == 1) and 0 or 1)
|
||||
else
|
||||
button.icon:SetTexture(nil)
|
||||
end
|
||||
|
||||
if iconCoords then
|
||||
button.icon:SetTexCoord(unpack(iconCoords))
|
||||
else
|
||||
button.icon:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
|
||||
if canExpand then
|
||||
if not isExpanded then
|
||||
toggle:SetNormalTexture(130838) -- Interface\\Buttons\\UI-PlusButton-UP
|
||||
toggle:SetPushedTexture(130836) -- Interface\\Buttons\\UI-PlusButton-DOWN
|
||||
else
|
||||
toggle:SetNormalTexture(130821) -- Interface\\Buttons\\UI-MinusButton-UP
|
||||
toggle:SetPushedTexture(130820) -- Interface\\Buttons\\UI-MinusButton-DOWN
|
||||
end
|
||||
toggle:Show()
|
||||
else
|
||||
toggle:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function ShouldDisplayLevel(tree)
|
||||
local result = false
|
||||
for k, v in ipairs(tree) do
|
||||
if v.children == nil and v.visible ~= false then
|
||||
result = true
|
||||
elseif v.children then
|
||||
result = result or ShouldDisplayLevel(v.children)
|
||||
end
|
||||
if result then return result end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function addLine(self, v, tree, level, parent)
|
||||
local line = new()
|
||||
line.value = v.value
|
||||
line.text = v.text
|
||||
line.icon = v.icon
|
||||
line.iconCoords = v.iconCoords
|
||||
line.disabled = v.disabled
|
||||
line.tree = tree
|
||||
line.level = level
|
||||
line.parent = parent
|
||||
line.visible = v.visible
|
||||
line.uniquevalue = GetButtonUniqueValue(line)
|
||||
if v.children then
|
||||
line.hasChildren = true
|
||||
else
|
||||
line.hasChildren = nil
|
||||
end
|
||||
self.lines[#self.lines+1] = line
|
||||
return line
|
||||
end
|
||||
|
||||
--fire an update after one frame to catch the treeframes height
|
||||
local function FirstFrameUpdate(frame)
|
||||
local self = frame.obj
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
self:RefreshTree(nil, true)
|
||||
end
|
||||
|
||||
local function BuildUniqueValue(...)
|
||||
local n = select('#', ...)
|
||||
if n == 1 then
|
||||
return ...
|
||||
else
|
||||
return (...).."\001"..BuildUniqueValue(select(2,...))
|
||||
end
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Expand_OnClick(frame)
|
||||
local button = frame.button
|
||||
local self = button.obj
|
||||
local status = (self.status or self.localstatus).groups
|
||||
status[button.uniquevalue] = not status[button.uniquevalue]
|
||||
self:RefreshTree()
|
||||
end
|
||||
|
||||
local function Button_OnClick(frame)
|
||||
local self = frame.obj
|
||||
self:Fire("OnClick", frame.uniquevalue, frame.selected)
|
||||
if not frame.selected then
|
||||
self:SetSelected(frame.uniquevalue)
|
||||
frame.selected = true
|
||||
frame:LockHighlight()
|
||||
self:RefreshTree()
|
||||
end
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function Button_OnDoubleClick(button)
|
||||
local self = button.obj
|
||||
local status = (self.status or self.localstatus).groups
|
||||
status[button.uniquevalue] = not status[button.uniquevalue]
|
||||
self:RefreshTree()
|
||||
end
|
||||
|
||||
local function Button_OnEnter(frame)
|
||||
local self = frame.obj
|
||||
self:Fire("OnButtonEnter", frame.uniquevalue, frame)
|
||||
|
||||
if self.enabletooltips then
|
||||
local tooltip = AceGUI.tooltip
|
||||
tooltip:SetOwner(frame, "ANCHOR_NONE")
|
||||
tooltip:ClearAllPoints()
|
||||
tooltip:SetPoint("LEFT",frame,"RIGHT")
|
||||
tooltip:SetText(frame.text:GetText() or "", 1, .82, 0, true)
|
||||
|
||||
tooltip:Show()
|
||||
end
|
||||
end
|
||||
|
||||
local function Button_OnLeave(frame)
|
||||
local self = frame.obj
|
||||
self:Fire("OnButtonLeave", frame.uniquevalue, frame)
|
||||
|
||||
if self.enabletooltips then
|
||||
AceGUI.tooltip:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function OnScrollValueChanged(frame, value)
|
||||
if frame.obj.noupdate then return end
|
||||
local self = frame.obj
|
||||
local status = self.status or self.localstatus
|
||||
status.scrollvalue = floor(value + 0.5)
|
||||
self:RefreshTree()
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function Tree_OnSizeChanged(frame)
|
||||
frame.obj:RefreshTree()
|
||||
end
|
||||
|
||||
local function Tree_OnMouseWheel(frame, delta)
|
||||
local self = frame.obj
|
||||
if self.showscroll then
|
||||
local scrollbar = self.scrollbar
|
||||
local min, max = scrollbar:GetMinMaxValues()
|
||||
local value = scrollbar:GetValue()
|
||||
local newvalue = math_min(max,math_max(min,value - delta))
|
||||
if value ~= newvalue then
|
||||
scrollbar:SetValue(newvalue)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function Dragger_OnLeave(frame)
|
||||
frame:SetBackdropColor(1, 1, 1, 0)
|
||||
end
|
||||
|
||||
local function Dragger_OnEnter(frame)
|
||||
frame:SetBackdropColor(1, 1, 1, 0.8)
|
||||
end
|
||||
|
||||
local function Dragger_OnMouseDown(frame)
|
||||
local treeframe = frame:GetParent()
|
||||
treeframe:StartSizing("RIGHT")
|
||||
end
|
||||
|
||||
local function Dragger_OnMouseUp(frame)
|
||||
local treeframe = frame:GetParent()
|
||||
local self = treeframe.obj
|
||||
local treeframeParent = treeframe:GetParent()
|
||||
treeframe:StopMovingOrSizing()
|
||||
--treeframe:SetScript("OnUpdate", nil)
|
||||
treeframe:SetUserPlaced(false)
|
||||
--Without this :GetHeight will get stuck on the current height, causing the tree contents to not resize
|
||||
treeframe:SetHeight(0)
|
||||
treeframe:ClearAllPoints()
|
||||
treeframe:SetPoint("TOPLEFT", treeframeParent, "TOPLEFT",0,0)
|
||||
treeframe:SetPoint("BOTTOMLEFT", treeframeParent, "BOTTOMLEFT",0,0)
|
||||
|
||||
local status = self.status or self.localstatus
|
||||
status.treewidth = treeframe:GetWidth()
|
||||
|
||||
treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth())
|
||||
-- recalculate the content width
|
||||
treeframe.obj:OnWidthSet(status.fullwidth)
|
||||
-- update the layout of the content
|
||||
treeframe.obj:DoLayout()
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE)
|
||||
self:EnableButtonTooltips(true)
|
||||
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self.status = nil
|
||||
self.tree = nil
|
||||
self.frame:SetScript("OnUpdate", nil)
|
||||
for k, v in pairs(self.localstatus) do
|
||||
if k == "groups" then
|
||||
for k2 in pairs(v) do
|
||||
v[k2] = nil
|
||||
end
|
||||
else
|
||||
self.localstatus[k] = nil
|
||||
end
|
||||
end
|
||||
self.localstatus.scrollvalue = 0
|
||||
self.localstatus.treewidth = DEFAULT_TREE_WIDTH
|
||||
self.localstatus.treesizable = DEFAULT_TREE_SIZABLE
|
||||
end,
|
||||
|
||||
["EnableButtonTooltips"] = function(self, enable)
|
||||
self.enabletooltips = enable
|
||||
end,
|
||||
|
||||
["CreateButton"] = function(self)
|
||||
local num = AceGUI:GetNextWidgetNum("TreeGroupButton")
|
||||
local button = CreateFrame("Button", ("AceGUI30TreeButton%d"):format(num), self.treeframe, "OptionsListButtonTemplate")
|
||||
button.obj = self
|
||||
|
||||
local icon = button:CreateTexture(nil, "OVERLAY")
|
||||
icon:SetWidth(14)
|
||||
icon:SetHeight(14)
|
||||
button.icon = icon
|
||||
|
||||
button:SetScript("OnClick",Button_OnClick)
|
||||
button:SetScript("OnDoubleClick", Button_OnDoubleClick)
|
||||
button:SetScript("OnEnter",Button_OnEnter)
|
||||
button:SetScript("OnLeave",Button_OnLeave)
|
||||
|
||||
button.toggle.button = button
|
||||
button.toggle:SetScript("OnClick",Expand_OnClick)
|
||||
|
||||
button.text:SetHeight(14) -- Prevents text wrapping
|
||||
|
||||
return button
|
||||
end,
|
||||
|
||||
["SetStatusTable"] = function(self, status)
|
||||
assert(type(status) == "table")
|
||||
self.status = status
|
||||
if not status.groups then
|
||||
status.groups = {}
|
||||
end
|
||||
if not status.scrollvalue then
|
||||
status.scrollvalue = 0
|
||||
end
|
||||
if not status.treewidth then
|
||||
status.treewidth = DEFAULT_TREE_WIDTH
|
||||
end
|
||||
if status.treesizable == nil then
|
||||
status.treesizable = DEFAULT_TREE_SIZABLE
|
||||
end
|
||||
self:SetTreeWidth(status.treewidth,status.treesizable)
|
||||
self:RefreshTree()
|
||||
end,
|
||||
|
||||
--sets the tree to be displayed
|
||||
["SetTree"] = function(self, tree, filter)
|
||||
self.filter = filter
|
||||
if tree then
|
||||
assert(type(tree) == "table")
|
||||
end
|
||||
self.tree = tree
|
||||
self:RefreshTree()
|
||||
end,
|
||||
|
||||
["BuildLevel"] = function(self, tree, level, parent)
|
||||
local groups = (self.status or self.localstatus).groups
|
||||
|
||||
for i, v in ipairs(tree) do
|
||||
if v.children then
|
||||
if not self.filter or ShouldDisplayLevel(v.children) then
|
||||
local line = addLine(self, v, tree, level, parent)
|
||||
if groups[line.uniquevalue] then
|
||||
self:BuildLevel(v.children, level+1, line)
|
||||
end
|
||||
end
|
||||
elseif v.visible ~= false or not self.filter then
|
||||
addLine(self, v, tree, level, parent)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate)
|
||||
local buttons = self.buttons
|
||||
local lines = self.lines
|
||||
|
||||
for i, v in ipairs(buttons) do
|
||||
v:Hide()
|
||||
end
|
||||
while lines[1] do
|
||||
local t = tremove(lines)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
del(t)
|
||||
end
|
||||
|
||||
if not self.tree then return end
|
||||
--Build the list of visible entries from the tree and status tables
|
||||
local status = self.status or self.localstatus
|
||||
local groupstatus = status.groups
|
||||
local tree = self.tree
|
||||
|
||||
local treeframe = self.treeframe
|
||||
|
||||
status.scrollToSelection = status.scrollToSelection or scrollToSelection -- needs to be cached in case the control hasn't been drawn yet (code bails out below)
|
||||
|
||||
self:BuildLevel(tree, 1)
|
||||
|
||||
local numlines = #lines
|
||||
|
||||
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
|
||||
if maxlines <= 0 then return end
|
||||
|
||||
if self.frame:GetParent() == UIParent and not fromOnUpdate then
|
||||
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
|
||||
return
|
||||
end
|
||||
|
||||
local first, last
|
||||
|
||||
scrollToSelection = status.scrollToSelection
|
||||
status.scrollToSelection = nil
|
||||
|
||||
if numlines <= maxlines then
|
||||
--the whole tree fits in the frame
|
||||
status.scrollvalue = 0
|
||||
self:ShowScroll(false)
|
||||
first, last = 1, numlines
|
||||
else
|
||||
self:ShowScroll(true)
|
||||
--scrolling will be needed
|
||||
self.noupdate = true
|
||||
self.scrollbar:SetMinMaxValues(0, numlines - maxlines)
|
||||
--check if we are scrolled down too far
|
||||
if numlines - status.scrollvalue < maxlines then
|
||||
status.scrollvalue = numlines - maxlines
|
||||
end
|
||||
self.noupdate = nil
|
||||
first, last = status.scrollvalue+1, status.scrollvalue + maxlines
|
||||
--show selection?
|
||||
if scrollToSelection and status.selected then
|
||||
local show
|
||||
for i,line in ipairs(lines) do -- find the line number
|
||||
if line.uniquevalue==status.selected then
|
||||
show=i
|
||||
end
|
||||
end
|
||||
if not show then
|
||||
-- selection was deleted or something?
|
||||
elseif show>=first and show<=last then
|
||||
-- all good
|
||||
else
|
||||
-- scrolling needed!
|
||||
if show<first then
|
||||
status.scrollvalue = show-1
|
||||
else
|
||||
status.scrollvalue = show-maxlines
|
||||
end
|
||||
first, last = status.scrollvalue+1, status.scrollvalue + maxlines
|
||||
end
|
||||
end
|
||||
if self.scrollbar:GetValue() ~= status.scrollvalue then
|
||||
self.scrollbar:SetValue(status.scrollvalue)
|
||||
end
|
||||
end
|
||||
|
||||
local buttonnum = 1
|
||||
for i = first, last do
|
||||
local line = lines[i]
|
||||
local button = buttons[buttonnum]
|
||||
if not button then
|
||||
button = self:CreateButton()
|
||||
|
||||
buttons[buttonnum] = button
|
||||
button:SetParent(treeframe)
|
||||
button:SetFrameLevel(treeframe:GetFrameLevel()+1)
|
||||
button:ClearAllPoints()
|
||||
if buttonnum == 1 then
|
||||
if self.showscroll then
|
||||
button:SetPoint("TOPRIGHT", -22, -10)
|
||||
button:SetPoint("TOPLEFT", 0, -10)
|
||||
else
|
||||
button:SetPoint("TOPRIGHT", 0, -10)
|
||||
button:SetPoint("TOPLEFT", 0, -10)
|
||||
end
|
||||
else
|
||||
button:SetPoint("TOPRIGHT", buttons[buttonnum-1], "BOTTOMRIGHT",0,0)
|
||||
button:SetPoint("TOPLEFT", buttons[buttonnum-1], "BOTTOMLEFT",0,0)
|
||||
end
|
||||
end
|
||||
|
||||
UpdateButton(button, line, status.selected == line.uniquevalue, line.hasChildren, groupstatus[line.uniquevalue] )
|
||||
button:Show()
|
||||
buttonnum = buttonnum + 1
|
||||
end
|
||||
|
||||
end,
|
||||
|
||||
["SetSelected"] = function(self, value)
|
||||
local status = self.status or self.localstatus
|
||||
if status.selected ~= value then
|
||||
status.selected = value
|
||||
self:Fire("OnGroupSelected", value)
|
||||
end
|
||||
end,
|
||||
|
||||
["Select"] = function(self, uniquevalue, ...)
|
||||
self.filter = false
|
||||
local status = self.status or self.localstatus
|
||||
local groups = status.groups
|
||||
local path = {...}
|
||||
for i = 1, #path do
|
||||
groups[tconcat(path, "\001", 1, i)] = true
|
||||
end
|
||||
status.selected = uniquevalue
|
||||
self:RefreshTree(true)
|
||||
self:Fire("OnGroupSelected", uniquevalue)
|
||||
end,
|
||||
|
||||
["SelectByPath"] = function(self, ...)
|
||||
self:Select(BuildUniqueValue(...), ...)
|
||||
end,
|
||||
|
||||
["SelectByValue"] = function(self, uniquevalue)
|
||||
self:Select(uniquevalue, ("\001"):split(uniquevalue))
|
||||
end,
|
||||
|
||||
["ShowScroll"] = function(self, show)
|
||||
self.showscroll = show
|
||||
if show then
|
||||
self.scrollbar:Show()
|
||||
if self.buttons[1] then
|
||||
self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",-22,-10)
|
||||
end
|
||||
else
|
||||
self.scrollbar:Hide()
|
||||
if self.buttons[1] then
|
||||
self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",0,-10)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
local content = self.content
|
||||
local treeframe = self.treeframe
|
||||
local status = self.status or self.localstatus
|
||||
status.fullwidth = width
|
||||
|
||||
local contentwidth = width - status.treewidth - 20
|
||||
if contentwidth < 0 then
|
||||
contentwidth = 0
|
||||
end
|
||||
content:SetWidth(contentwidth)
|
||||
content.width = contentwidth
|
||||
|
||||
local maxtreewidth = math_min(400, width - 50)
|
||||
|
||||
if maxtreewidth > 100 and status.treewidth > maxtreewidth then
|
||||
self:SetTreeWidth(maxtreewidth, status.treesizable)
|
||||
end
|
||||
treeframe:SetMaxResize(maxtreewidth, 1600)
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
local content = self.content
|
||||
local contentheight = height - 20
|
||||
if contentheight < 0 then
|
||||
contentheight = 0
|
||||
end
|
||||
content:SetHeight(contentheight)
|
||||
content.height = contentheight
|
||||
end,
|
||||
|
||||
["SetTreeWidth"] = function(self, treewidth, resizable)
|
||||
if not resizable then
|
||||
if type(treewidth) == 'number' then
|
||||
resizable = false
|
||||
elseif type(treewidth) == 'boolean' then
|
||||
resizable = treewidth
|
||||
treewidth = DEFAULT_TREE_WIDTH
|
||||
else
|
||||
resizable = false
|
||||
treewidth = DEFAULT_TREE_WIDTH
|
||||
end
|
||||
end
|
||||
self.treeframe:SetWidth(treewidth)
|
||||
self.dragger:EnableMouse(resizable)
|
||||
|
||||
local status = self.status or self.localstatus
|
||||
status.treewidth = treewidth
|
||||
status.treesizable = resizable
|
||||
|
||||
-- recalculate the content width
|
||||
if status.fullwidth then
|
||||
self:OnWidthSet(status.fullwidth)
|
||||
end
|
||||
end,
|
||||
|
||||
["GetTreeWidth"] = function(self)
|
||||
local status = self.status or self.localstatus
|
||||
return status.treewidth or DEFAULT_TREE_WIDTH
|
||||
end,
|
||||
|
||||
["LayoutFinished"] = function(self, width, height)
|
||||
if self.noAutoHeight then return end
|
||||
self:SetHeight((height or 0) + 20)
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local PaneBackdrop = {
|
||||
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 5, bottom = 3 }
|
||||
}
|
||||
|
||||
local DraggerBackdrop = {
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = nil,
|
||||
tile = true, tileSize = 16, edgeSize = 1,
|
||||
insets = { left = 3, right = 3, top = 7, bottom = 7 }
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local num = AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
|
||||
local treeframe = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
treeframe:SetPoint("TOPLEFT")
|
||||
treeframe:SetPoint("BOTTOMLEFT")
|
||||
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
|
||||
treeframe:EnableMouseWheel(true)
|
||||
treeframe:SetBackdrop(PaneBackdrop)
|
||||
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
|
||||
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
treeframe:SetResizable(true)
|
||||
treeframe:SetMinResize(100, 1)
|
||||
treeframe:SetMaxResize(400, 1600)
|
||||
treeframe:SetScript("OnUpdate", FirstFrameUpdate)
|
||||
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
|
||||
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
|
||||
|
||||
local dragger = CreateFrame("Frame", nil, treeframe, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
dragger:SetWidth(8)
|
||||
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
|
||||
dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT")
|
||||
dragger:SetBackdrop(DraggerBackdrop)
|
||||
dragger:SetBackdropColor(1, 1, 1, 0)
|
||||
dragger:SetScript("OnEnter", Dragger_OnEnter)
|
||||
dragger:SetScript("OnLeave", Dragger_OnLeave)
|
||||
dragger:SetScript("OnMouseDown", Dragger_OnMouseDown)
|
||||
dragger:SetScript("OnMouseUp", Dragger_OnMouseUp)
|
||||
|
||||
local scrollbar = CreateFrame("Slider", ("AceConfigDialogTreeGroup%dScrollBar"):format(num), treeframe, "UIPanelScrollBarTemplate")
|
||||
scrollbar:SetScript("OnValueChanged", nil)
|
||||
scrollbar:SetPoint("TOPRIGHT", -10, -26)
|
||||
scrollbar:SetPoint("BOTTOMRIGHT", -10, 26)
|
||||
scrollbar:SetMinMaxValues(0,0)
|
||||
scrollbar:SetValueStep(1)
|
||||
scrollbar:SetValue(0)
|
||||
scrollbar:SetWidth(16)
|
||||
scrollbar:SetScript("OnValueChanged", OnScrollValueChanged)
|
||||
|
||||
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
||||
scrollbg:SetAllPoints(scrollbar)
|
||||
scrollbg:SetColorTexture(0,0,0,0.4)
|
||||
|
||||
local border = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT")
|
||||
border:SetPoint("BOTTOMRIGHT")
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
|
||||
border:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, border)
|
||||
content:SetPoint("TOPLEFT", 10, -10)
|
||||
content:SetPoint("BOTTOMRIGHT", -10, 10)
|
||||
|
||||
local widget = {
|
||||
frame = frame,
|
||||
lines = {},
|
||||
levels = {},
|
||||
buttons = {},
|
||||
hasChildren = {},
|
||||
localstatus = { groups = {}, scrollvalue = 0 },
|
||||
filter = false,
|
||||
treeframe = treeframe,
|
||||
dragger = dragger,
|
||||
scrollbar = scrollbar,
|
||||
border = border,
|
||||
content = content,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
treeframe.obj, dragger.obj, scrollbar.obj = widget, widget, widget
|
||||
|
||||
return AceGUI:RegisterAsContainer(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,336 +0,0 @@
|
||||
local AceGUI = LibStub("AceGUI-3.0")
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, assert, type = pairs, assert, type
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GameFontNormal
|
||||
|
||||
----------------
|
||||
-- Main Frame --
|
||||
----------------
|
||||
--[[
|
||||
Events :
|
||||
OnClose
|
||||
|
||||
]]
|
||||
do
|
||||
local Type = "Window"
|
||||
local Version = 6
|
||||
|
||||
local function frameOnShow(this)
|
||||
this.obj:Fire("OnShow")
|
||||
end
|
||||
|
||||
local function frameOnClose(this)
|
||||
this.obj:Fire("OnClose")
|
||||
end
|
||||
|
||||
local function closeOnClick(this)
|
||||
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
|
||||
this.obj:Hide()
|
||||
end
|
||||
|
||||
local function frameOnMouseDown(this)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function titleOnMouseDown(this)
|
||||
this:GetParent():StartMoving()
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function frameOnMouseUp(this)
|
||||
local frame = this:GetParent()
|
||||
frame:StopMovingOrSizing()
|
||||
local self = frame.obj
|
||||
local status = self.status or self.localstatus
|
||||
status.width = frame:GetWidth()
|
||||
status.height = frame:GetHeight()
|
||||
status.top = frame:GetTop()
|
||||
status.left = frame:GetLeft()
|
||||
end
|
||||
|
||||
local function sizerseOnMouseDown(this)
|
||||
this:GetParent():StartSizing("BOTTOMRIGHT")
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function sizersOnMouseDown(this)
|
||||
this:GetParent():StartSizing("BOTTOM")
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function sizereOnMouseDown(this)
|
||||
this:GetParent():StartSizing("RIGHT")
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function sizerOnMouseUp(this)
|
||||
this:GetParent():StopMovingOrSizing()
|
||||
end
|
||||
|
||||
local function SetTitle(self,title)
|
||||
self.titletext:SetText(title)
|
||||
end
|
||||
|
||||
local function SetStatusText(self,text)
|
||||
-- self.statustext:SetText(text)
|
||||
end
|
||||
|
||||
local function Hide(self)
|
||||
self.frame:Hide()
|
||||
end
|
||||
|
||||
local function Show(self)
|
||||
self.frame:Show()
|
||||
end
|
||||
|
||||
local function OnAcquire(self)
|
||||
self.frame:SetParent(UIParent)
|
||||
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
self:ApplyStatus()
|
||||
self:EnableResize(true)
|
||||
self:Show()
|
||||
end
|
||||
|
||||
local function OnRelease(self)
|
||||
self.status = nil
|
||||
for k in pairs(self.localstatus) do
|
||||
self.localstatus[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- called to set an external table to store status in
|
||||
local function SetStatusTable(self, status)
|
||||
assert(type(status) == "table")
|
||||
self.status = status
|
||||
self:ApplyStatus()
|
||||
end
|
||||
|
||||
local function ApplyStatus(self)
|
||||
local status = self.status or self.localstatus
|
||||
local frame = self.frame
|
||||
self:SetWidth(status.width or 700)
|
||||
self:SetHeight(status.height or 500)
|
||||
if status.top and status.left then
|
||||
frame:SetPoint("TOP",UIParent,"BOTTOM",0,status.top)
|
||||
frame:SetPoint("LEFT",UIParent,"LEFT",status.left,0)
|
||||
else
|
||||
frame:SetPoint("CENTER",UIParent,"CENTER")
|
||||
end
|
||||
end
|
||||
|
||||
local function OnWidthSet(self, width)
|
||||
local content = self.content
|
||||
local contentwidth = width - 34
|
||||
if contentwidth < 0 then
|
||||
contentwidth = 0
|
||||
end
|
||||
content:SetWidth(contentwidth)
|
||||
content.width = contentwidth
|
||||
end
|
||||
|
||||
|
||||
local function OnHeightSet(self, height)
|
||||
local content = self.content
|
||||
local contentheight = height - 57
|
||||
if contentheight < 0 then
|
||||
contentheight = 0
|
||||
end
|
||||
content:SetHeight(contentheight)
|
||||
content.height = contentheight
|
||||
end
|
||||
|
||||
local function EnableResize(self, state)
|
||||
local func = state and "Show" or "Hide"
|
||||
self.sizer_se[func](self.sizer_se)
|
||||
self.sizer_s[func](self.sizer_s)
|
||||
self.sizer_e[func](self.sizer_e)
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame",nil,UIParent)
|
||||
local self = {}
|
||||
self.type = "Window"
|
||||
|
||||
self.Hide = Hide
|
||||
self.Show = Show
|
||||
self.SetTitle = SetTitle
|
||||
self.OnRelease = OnRelease
|
||||
self.OnAcquire = OnAcquire
|
||||
self.SetStatusText = SetStatusText
|
||||
self.SetStatusTable = SetStatusTable
|
||||
self.ApplyStatus = ApplyStatus
|
||||
self.OnWidthSet = OnWidthSet
|
||||
self.OnHeightSet = OnHeightSet
|
||||
self.EnableResize = EnableResize
|
||||
|
||||
self.localstatus = {}
|
||||
|
||||
self.frame = frame
|
||||
frame.obj = self
|
||||
frame:SetWidth(700)
|
||||
frame:SetHeight(500)
|
||||
frame:SetPoint("CENTER",UIParent,"CENTER",0,0)
|
||||
frame:EnableMouse()
|
||||
frame:SetMovable(true)
|
||||
frame:SetResizable(true)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
frame:SetScript("OnMouseDown", frameOnMouseDown)
|
||||
|
||||
frame:SetScript("OnShow",frameOnShow)
|
||||
frame:SetScript("OnHide",frameOnClose)
|
||||
frame:SetMinResize(240,240)
|
||||
frame:SetToplevel(true)
|
||||
|
||||
local titlebg = frame:CreateTexture(nil, "BACKGROUND")
|
||||
titlebg:SetTexture(251966) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Title-Background
|
||||
titlebg:SetPoint("TOPLEFT", 9, -6)
|
||||
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
|
||||
|
||||
local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
|
||||
dialogbg:SetTexture(137056) -- Interface\\Tooltips\\UI-Tooltip-Background
|
||||
dialogbg:SetPoint("TOPLEFT", 8, -24)
|
||||
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
|
||||
dialogbg:SetVertexColor(0, 0, 0, .75)
|
||||
|
||||
local topleft = frame:CreateTexture(nil, "BORDER")
|
||||
topleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
topleft:SetWidth(64)
|
||||
topleft:SetHeight(64)
|
||||
topleft:SetPoint("TOPLEFT")
|
||||
topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
|
||||
|
||||
local topright = frame:CreateTexture(nil, "BORDER")
|
||||
topright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
topright:SetWidth(64)
|
||||
topright:SetHeight(64)
|
||||
topright:SetPoint("TOPRIGHT")
|
||||
topright:SetTexCoord(0.625, 0.75, 0, 1)
|
||||
|
||||
local top = frame:CreateTexture(nil, "BORDER")
|
||||
top:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
top:SetHeight(64)
|
||||
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
|
||||
top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
|
||||
top:SetTexCoord(0.25, 0.369140625, 0, 1)
|
||||
|
||||
local bottomleft = frame:CreateTexture(nil, "BORDER")
|
||||
bottomleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
bottomleft:SetWidth(64)
|
||||
bottomleft:SetHeight(64)
|
||||
bottomleft:SetPoint("BOTTOMLEFT")
|
||||
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
|
||||
|
||||
local bottomright = frame:CreateTexture(nil, "BORDER")
|
||||
bottomright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
bottomright:SetWidth(64)
|
||||
bottomright:SetHeight(64)
|
||||
bottomright:SetPoint("BOTTOMRIGHT")
|
||||
bottomright:SetTexCoord(0.875, 1, 0, 1)
|
||||
|
||||
local bottom = frame:CreateTexture(nil, "BORDER")
|
||||
bottom:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
bottom:SetHeight(64)
|
||||
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
|
||||
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
|
||||
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
|
||||
|
||||
local left = frame:CreateTexture(nil, "BORDER")
|
||||
left:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
left:SetWidth(64)
|
||||
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
|
||||
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
|
||||
left:SetTexCoord(0.001953125, 0.125, 0, 1)
|
||||
|
||||
local right = frame:CreateTexture(nil, "BORDER")
|
||||
right:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||
right:SetWidth(64)
|
||||
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
|
||||
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
|
||||
right:SetTexCoord(0.1171875, 0.2421875, 0, 1)
|
||||
|
||||
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
|
||||
close:SetPoint("TOPRIGHT", 2, 1)
|
||||
close:SetScript("OnClick", closeOnClick)
|
||||
self.closebutton = close
|
||||
close.obj = self
|
||||
|
||||
local titletext = frame:CreateFontString(nil, "ARTWORK")
|
||||
titletext:SetFontObject(GameFontNormal)
|
||||
titletext:SetPoint("TOPLEFT", 12, -8)
|
||||
titletext:SetPoint("TOPRIGHT", -32, -8)
|
||||
self.titletext = titletext
|
||||
|
||||
local title = CreateFrame("Button", nil, frame)
|
||||
title:SetPoint("TOPLEFT", titlebg)
|
||||
title:SetPoint("BOTTOMRIGHT", titlebg)
|
||||
title:EnableMouse()
|
||||
title:SetScript("OnMouseDown",titleOnMouseDown)
|
||||
title:SetScript("OnMouseUp", frameOnMouseUp)
|
||||
self.title = title
|
||||
|
||||
local sizer_se = CreateFrame("Frame",nil,frame)
|
||||
sizer_se:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0)
|
||||
sizer_se:SetWidth(25)
|
||||
sizer_se:SetHeight(25)
|
||||
sizer_se:EnableMouse()
|
||||
sizer_se:SetScript("OnMouseDown",sizerseOnMouseDown)
|
||||
sizer_se:SetScript("OnMouseUp", sizerOnMouseUp)
|
||||
self.sizer_se = sizer_se
|
||||
|
||||
local line1 = sizer_se:CreateTexture(nil, "BACKGROUND")
|
||||
self.line1 = line1
|
||||
line1:SetWidth(14)
|
||||
line1:SetHeight(14)
|
||||
line1:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||
local x = 0.1 * 14/17
|
||||
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||
|
||||
local line2 = sizer_se:CreateTexture(nil, "BACKGROUND")
|
||||
self.line2 = line2
|
||||
line2:SetWidth(8)
|
||||
line2:SetHeight(8)
|
||||
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||
line2:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||
local x = 0.1 * 8/17
|
||||
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||
|
||||
local sizer_s = CreateFrame("Frame",nil,frame)
|
||||
sizer_s:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-25,0)
|
||||
sizer_s:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0)
|
||||
sizer_s:SetHeight(25)
|
||||
sizer_s:EnableMouse()
|
||||
sizer_s:SetScript("OnMouseDown",sizersOnMouseDown)
|
||||
sizer_s:SetScript("OnMouseUp", sizerOnMouseUp)
|
||||
self.sizer_s = sizer_s
|
||||
|
||||
local sizer_e = CreateFrame("Frame",nil,frame)
|
||||
sizer_e:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,25)
|
||||
sizer_e:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0)
|
||||
sizer_e:SetWidth(25)
|
||||
sizer_e:EnableMouse()
|
||||
sizer_e:SetScript("OnMouseDown",sizereOnMouseDown)
|
||||
sizer_e:SetScript("OnMouseUp", sizerOnMouseUp)
|
||||
self.sizer_e = sizer_e
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame",nil,frame)
|
||||
self.content = content
|
||||
content.obj = self
|
||||
content:SetPoint("TOPLEFT",frame,"TOPLEFT",12,-32)
|
||||
content:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-12,13)
|
||||
|
||||
AceGUI:RegisterAsContainer(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type,Constructor,Version)
|
||||
end
|
||||
@@ -1,103 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Button Widget
|
||||
Graphical Button.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Button", 24
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Button_OnClick(frame, ...)
|
||||
AceGUI:ClearFocus()
|
||||
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
|
||||
frame.obj:Fire("OnClick", ...)
|
||||
end
|
||||
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
-- restore default values
|
||||
self:SetHeight(24)
|
||||
self:SetWidth(200)
|
||||
self:SetDisabled(false)
|
||||
self:SetAutoWidth(false)
|
||||
self:SetText()
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetText"] = function(self, text)
|
||||
self.text:SetText(text)
|
||||
if self.autoWidth then
|
||||
self:SetWidth(self.text:GetStringWidth() + 30)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetAutoWidth"] = function(self, autoWidth)
|
||||
self.autoWidth = autoWidth
|
||||
if self.autoWidth then
|
||||
self:SetWidth(self.text:GetStringWidth() + 30)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.frame:Disable()
|
||||
else
|
||||
self.frame:Enable()
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnClick", Button_OnClick)
|
||||
frame:SetScript("OnEnter", Control_OnEnter)
|
||||
frame:SetScript("OnLeave", Control_OnLeave)
|
||||
|
||||
local text = frame:GetFontString()
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint("TOPLEFT", 15, -1)
|
||||
text:SetPoint("BOTTOMRIGHT", -15, 1)
|
||||
text:SetJustifyV("MIDDLE")
|
||||
|
||||
local widget = {
|
||||
text = text,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,296 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Checkbox Widget
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "CheckBox", 26
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local select, pairs = select, pairs
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: SetDesaturation, GameFontHighlight
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function AlignImage(self)
|
||||
local img = self.image:GetTexture()
|
||||
self.text:ClearAllPoints()
|
||||
if not img then
|
||||
self.text:SetPoint("LEFT", self.checkbg, "RIGHT")
|
||||
self.text:SetPoint("RIGHT")
|
||||
else
|
||||
self.text:SetPoint("LEFT", self.image, "RIGHT", 1, 0)
|
||||
self.text:SetPoint("RIGHT")
|
||||
end
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function CheckBox_OnMouseDown(frame)
|
||||
local self = frame.obj
|
||||
if not self.disabled then
|
||||
if self.image:GetTexture() then
|
||||
self.text:SetPoint("LEFT", self.image,"RIGHT", 2, -1)
|
||||
else
|
||||
self.text:SetPoint("LEFT", self.checkbg, "RIGHT", 1, -1)
|
||||
end
|
||||
end
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function CheckBox_OnMouseUp(frame)
|
||||
local self = frame.obj
|
||||
if not self.disabled then
|
||||
self:ToggleChecked()
|
||||
|
||||
if self.checked then
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
else -- for both nil and false (tristate)
|
||||
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
|
||||
end
|
||||
|
||||
self:Fire("OnValueChanged", self.checked)
|
||||
AlignImage(self)
|
||||
end
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetType()
|
||||
self:SetValue(false)
|
||||
self:SetTriState(nil)
|
||||
-- height is calculated from the width and required space for the description
|
||||
self:SetWidth(200)
|
||||
self:SetImage()
|
||||
self:SetDisabled(nil)
|
||||
self:SetDescription(nil)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
if self.desc then
|
||||
self.desc:SetWidth(width - 30)
|
||||
if self.desc:GetText() and self.desc:GetText() ~= "" then
|
||||
self:SetHeight(28 + self.desc:GetStringHeight())
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.frame:Disable()
|
||||
self.text:SetTextColor(0.5, 0.5, 0.5)
|
||||
SetDesaturation(self.check, true)
|
||||
if self.desc then
|
||||
self.desc:SetTextColor(0.5, 0.5, 0.5)
|
||||
end
|
||||
else
|
||||
self.frame:Enable()
|
||||
self.text:SetTextColor(1, 1, 1)
|
||||
if self.tristate and self.checked == nil then
|
||||
SetDesaturation(self.check, true)
|
||||
else
|
||||
SetDesaturation(self.check, false)
|
||||
end
|
||||
if self.desc then
|
||||
self.desc:SetTextColor(1, 1, 1)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
["SetValue"] = function(self, value)
|
||||
local check = self.check
|
||||
self.checked = value
|
||||
if value then
|
||||
SetDesaturation(check, false)
|
||||
check:Show()
|
||||
else
|
||||
--Nil is the unknown tristate value
|
||||
if self.tristate and value == nil then
|
||||
SetDesaturation(check, true)
|
||||
check:Show()
|
||||
else
|
||||
SetDesaturation(check, false)
|
||||
check:Hide()
|
||||
end
|
||||
end
|
||||
self:SetDisabled(self.disabled)
|
||||
end,
|
||||
|
||||
["GetValue"] = function(self)
|
||||
return self.checked
|
||||
end,
|
||||
|
||||
["SetTriState"] = function(self, enabled)
|
||||
self.tristate = enabled
|
||||
self:SetValue(self:GetValue())
|
||||
end,
|
||||
|
||||
["SetType"] = function(self, type)
|
||||
local checkbg = self.checkbg
|
||||
local check = self.check
|
||||
local highlight = self.highlight
|
||||
|
||||
local size
|
||||
if type == "radio" then
|
||||
size = 16
|
||||
checkbg:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
|
||||
checkbg:SetTexCoord(0, 0.25, 0, 1)
|
||||
check:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
|
||||
check:SetTexCoord(0.25, 0.5, 0, 1)
|
||||
check:SetBlendMode("ADD")
|
||||
highlight:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
|
||||
highlight:SetTexCoord(0.5, 0.75, 0, 1)
|
||||
else
|
||||
size = 24
|
||||
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up
|
||||
checkbg:SetTexCoord(0, 1, 0, 1)
|
||||
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
|
||||
check:SetTexCoord(0, 1, 0, 1)
|
||||
check:SetBlendMode("BLEND")
|
||||
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight
|
||||
highlight:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
checkbg:SetHeight(size)
|
||||
checkbg:SetWidth(size)
|
||||
end,
|
||||
|
||||
["ToggleChecked"] = function(self)
|
||||
local value = self:GetValue()
|
||||
if self.tristate then
|
||||
--cycle in true, nil, false order
|
||||
if value then
|
||||
self:SetValue(nil)
|
||||
elseif value == nil then
|
||||
self:SetValue(false)
|
||||
else
|
||||
self:SetValue(true)
|
||||
end
|
||||
else
|
||||
self:SetValue(not self:GetValue())
|
||||
end
|
||||
end,
|
||||
|
||||
["SetLabel"] = function(self, label)
|
||||
self.text:SetText(label)
|
||||
end,
|
||||
|
||||
["SetDescription"] = function(self, desc)
|
||||
if desc then
|
||||
if not self.desc then
|
||||
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
||||
desc:ClearAllPoints()
|
||||
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
|
||||
desc:SetWidth(self.frame.width - 30)
|
||||
desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
|
||||
desc:SetJustifyH("LEFT")
|
||||
desc:SetJustifyV("TOP")
|
||||
self.desc = desc
|
||||
end
|
||||
self.desc:Show()
|
||||
--self.text:SetFontObject(GameFontNormal)
|
||||
self.desc:SetText(desc)
|
||||
self:SetHeight(28 + self.desc:GetStringHeight())
|
||||
else
|
||||
if self.desc then
|
||||
self.desc:SetText("")
|
||||
self.desc:Hide()
|
||||
end
|
||||
--self.text:SetFontObject(GameFontHighlight)
|
||||
self:SetHeight(24)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetImage"] = function(self, path, ...)
|
||||
local image = self.image
|
||||
image:SetTexture(path)
|
||||
|
||||
if image:GetTexture() then
|
||||
local n = select("#", ...)
|
||||
if n == 4 or n == 8 then
|
||||
image:SetTexCoord(...)
|
||||
else
|
||||
image:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
end
|
||||
AlignImage(self)
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Button", nil, UIParent)
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnEnter", Control_OnEnter)
|
||||
frame:SetScript("OnLeave", Control_OnLeave)
|
||||
frame:SetScript("OnMouseDown", CheckBox_OnMouseDown)
|
||||
frame:SetScript("OnMouseUp", CheckBox_OnMouseUp)
|
||||
|
||||
local checkbg = frame:CreateTexture(nil, "ARTWORK")
|
||||
checkbg:SetWidth(24)
|
||||
checkbg:SetHeight(24)
|
||||
checkbg:SetPoint("TOPLEFT")
|
||||
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up
|
||||
|
||||
local check = frame:CreateTexture(nil, "OVERLAY")
|
||||
check:SetAllPoints(checkbg)
|
||||
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
|
||||
|
||||
local text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
|
||||
text:SetJustifyH("LEFT")
|
||||
text:SetHeight(18)
|
||||
text:SetPoint("LEFT", checkbg, "RIGHT")
|
||||
text:SetPoint("RIGHT")
|
||||
|
||||
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
||||
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight
|
||||
highlight:SetBlendMode("ADD")
|
||||
highlight:SetAllPoints(checkbg)
|
||||
|
||||
local image = frame:CreateTexture(nil, "OVERLAY")
|
||||
image:SetHeight(16)
|
||||
image:SetWidth(16)
|
||||
image:SetPoint("LEFT", checkbg, "RIGHT", 1, 0)
|
||||
|
||||
local widget = {
|
||||
checkbg = checkbg,
|
||||
check = check,
|
||||
text = text,
|
||||
highlight = highlight,
|
||||
image = image,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,190 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
ColorPicker Widget
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "ColorPicker", 25
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: ColorPickerFrame, OpacitySliderFrame
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function ColorCallback(self, r, g, b, a, isAlpha)
|
||||
if not self.HasAlpha then
|
||||
a = 1
|
||||
end
|
||||
self:SetColor(r, g, b, a)
|
||||
if ColorPickerFrame:IsVisible() then
|
||||
--colorpicker is still open
|
||||
self:Fire("OnValueChanged", r, g, b, a)
|
||||
else
|
||||
--colorpicker is closed, color callback is first, ignore it,
|
||||
--alpha callback is the final call after it closes so confirm now
|
||||
if isAlpha then
|
||||
self:Fire("OnValueConfirmed", r, g, b, a)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function ColorSwatch_OnClick(frame)
|
||||
ColorPickerFrame:Hide()
|
||||
local self = frame.obj
|
||||
if not self.disabled then
|
||||
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
|
||||
ColorPickerFrame:SetClampedToScreen(true)
|
||||
|
||||
ColorPickerFrame.func = function()
|
||||
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||
local a = 1 - OpacitySliderFrame:GetValue()
|
||||
ColorCallback(self, r, g, b, a)
|
||||
end
|
||||
|
||||
ColorPickerFrame.hasOpacity = self.HasAlpha
|
||||
ColorPickerFrame.opacityFunc = function()
|
||||
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||
local a = 1 - OpacitySliderFrame:GetValue()
|
||||
ColorCallback(self, r, g, b, a, true)
|
||||
end
|
||||
|
||||
local r, g, b, a = self.r, self.g, self.b, self.a
|
||||
if self.HasAlpha then
|
||||
ColorPickerFrame.opacity = 1 - (a or 0)
|
||||
end
|
||||
ColorPickerFrame:SetColorRGB(r, g, b)
|
||||
|
||||
ColorPickerFrame.cancelFunc = function()
|
||||
ColorCallback(self, r, g, b, a, true)
|
||||
end
|
||||
|
||||
ColorPickerFrame:Show()
|
||||
end
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetHeight(24)
|
||||
self:SetWidth(200)
|
||||
self:SetHasAlpha(false)
|
||||
self:SetColor(0, 0, 0, 1)
|
||||
self:SetDisabled(nil)
|
||||
self:SetLabel(nil)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetLabel"] = function(self, text)
|
||||
self.text:SetText(text)
|
||||
end,
|
||||
|
||||
["SetColor"] = function(self, r, g, b, a)
|
||||
self.r = r
|
||||
self.g = g
|
||||
self.b = b
|
||||
self.a = a or 1
|
||||
self.colorSwatch:SetVertexColor(r, g, b, a)
|
||||
end,
|
||||
|
||||
["SetHasAlpha"] = function(self, HasAlpha)
|
||||
self.HasAlpha = HasAlpha
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if self.disabled then
|
||||
self.frame:Disable()
|
||||
self.text:SetTextColor(0.5, 0.5, 0.5)
|
||||
else
|
||||
self.frame:Enable()
|
||||
self.text:SetTextColor(1, 1, 1)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Button", nil, UIParent)
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnEnter", Control_OnEnter)
|
||||
frame:SetScript("OnLeave", Control_OnLeave)
|
||||
frame:SetScript("OnClick", ColorSwatch_OnClick)
|
||||
|
||||
local colorSwatch = frame:CreateTexture(nil, "OVERLAY")
|
||||
colorSwatch:SetWidth(19)
|
||||
colorSwatch:SetHeight(19)
|
||||
colorSwatch:SetTexture(130939) -- Interface\\ChatFrame\\ChatFrameColorSwatch
|
||||
colorSwatch:SetPoint("LEFT")
|
||||
|
||||
local texture = frame:CreateTexture(nil, "BACKGROUND")
|
||||
colorSwatch.background = texture
|
||||
texture:SetWidth(16)
|
||||
texture:SetHeight(16)
|
||||
texture:SetColorTexture(1, 1, 1)
|
||||
texture:SetPoint("CENTER", colorSwatch)
|
||||
texture:Show()
|
||||
|
||||
local checkers = frame:CreateTexture(nil, "BACKGROUND")
|
||||
colorSwatch.checkers = checkers
|
||||
checkers:SetWidth(14)
|
||||
checkers:SetHeight(14)
|
||||
checkers:SetTexture(188523) -- Tileset\\Generic\\Checkers
|
||||
checkers:SetTexCoord(.25, 0, 0.5, .25)
|
||||
checkers:SetDesaturated(true)
|
||||
checkers:SetVertexColor(1, 1, 1, 0.75)
|
||||
checkers:SetPoint("CENTER", colorSwatch)
|
||||
checkers:Show()
|
||||
|
||||
local text = frame:CreateFontString(nil,"OVERLAY","GameFontHighlight")
|
||||
text:SetHeight(24)
|
||||
text:SetJustifyH("LEFT")
|
||||
text:SetTextColor(1, 1, 1)
|
||||
text:SetPoint("LEFT", colorSwatch, "RIGHT", 2, 0)
|
||||
text:SetPoint("RIGHT")
|
||||
|
||||
--local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
||||
--highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight
|
||||
--highlight:SetBlendMode("ADD")
|
||||
--highlight:SetAllPoints(frame)
|
||||
|
||||
local widget = {
|
||||
colorSwatch = colorSwatch,
|
||||
text = text,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,471 +0,0 @@
|
||||
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1202 2019-05-15 23:11:22Z nevcairiel $ ]]--
|
||||
|
||||
local AceGUI = LibStub("AceGUI-3.0")
|
||||
|
||||
-- Lua APIs
|
||||
local select, assert = select, assert
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local function fixlevels(parent,...)
|
||||
local i = 1
|
||||
local child = select(i, ...)
|
||||
while child do
|
||||
child:SetFrameLevel(parent:GetFrameLevel()+1)
|
||||
fixlevels(child, child:GetChildren())
|
||||
i = i + 1
|
||||
child = select(i, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local function fixstrata(strata, parent, ...)
|
||||
local i = 1
|
||||
local child = select(i, ...)
|
||||
parent:SetFrameStrata(strata)
|
||||
while child do
|
||||
fixstrata(strata, child, child:GetChildren())
|
||||
i = i + 1
|
||||
child = select(i, ...)
|
||||
end
|
||||
end
|
||||
|
||||
-- ItemBase is the base "class" for all dropdown items.
|
||||
-- Each item has to use ItemBase.Create(widgetType) to
|
||||
-- create an initial 'self' value.
|
||||
-- ItemBase will add common functions and ui event handlers.
|
||||
-- Be sure to keep basic usage when you override functions.
|
||||
|
||||
local ItemBase = {
|
||||
-- NOTE: The ItemBase version is added to each item's version number
|
||||
-- to ensure proper updates on ItemBase changes.
|
||||
-- Use at least 1000er steps.
|
||||
version = 1000,
|
||||
counter = 0,
|
||||
}
|
||||
|
||||
function ItemBase.Frame_OnEnter(this)
|
||||
local self = this.obj
|
||||
|
||||
if self.useHighlight then
|
||||
self.highlight:Show()
|
||||
end
|
||||
self:Fire("OnEnter")
|
||||
|
||||
if self.specialOnEnter then
|
||||
self.specialOnEnter(self)
|
||||
end
|
||||
end
|
||||
|
||||
function ItemBase.Frame_OnLeave(this)
|
||||
local self = this.obj
|
||||
|
||||
self.highlight:Hide()
|
||||
self:Fire("OnLeave")
|
||||
|
||||
if self.specialOnLeave then
|
||||
self.specialOnLeave(self)
|
||||
end
|
||||
end
|
||||
|
||||
-- exported, AceGUI callback
|
||||
function ItemBase.OnAcquire(self)
|
||||
self.frame:SetToplevel(true)
|
||||
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
end
|
||||
|
||||
-- exported, AceGUI callback
|
||||
function ItemBase.OnRelease(self)
|
||||
self:SetDisabled(false)
|
||||
self.pullout = nil
|
||||
self.frame:SetParent(nil)
|
||||
self.frame:ClearAllPoints()
|
||||
self.frame:Hide()
|
||||
end
|
||||
|
||||
-- exported
|
||||
-- NOTE: this is called by a Dropdown-Pullout.
|
||||
-- Do not call this method directly
|
||||
function ItemBase.SetPullout(self, pullout)
|
||||
self.pullout = pullout
|
||||
|
||||
self.frame:SetParent(nil)
|
||||
self.frame:SetParent(pullout.itemFrame)
|
||||
self.parent = pullout.itemFrame
|
||||
fixlevels(pullout.itemFrame, pullout.itemFrame:GetChildren())
|
||||
end
|
||||
|
||||
-- exported
|
||||
function ItemBase.SetText(self, text)
|
||||
self.text:SetText(text or "")
|
||||
end
|
||||
|
||||
-- exported
|
||||
function ItemBase.GetText(self)
|
||||
return self.text:GetText()
|
||||
end
|
||||
|
||||
-- exported
|
||||
function ItemBase.SetPoint(self, ...)
|
||||
self.frame:SetPoint(...)
|
||||
end
|
||||
|
||||
-- exported
|
||||
function ItemBase.Show(self)
|
||||
self.frame:Show()
|
||||
end
|
||||
|
||||
-- exported
|
||||
function ItemBase.Hide(self)
|
||||
self.frame:Hide()
|
||||
end
|
||||
|
||||
-- exported
|
||||
function ItemBase.SetDisabled(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.useHighlight = false
|
||||
self.text:SetTextColor(.5, .5, .5)
|
||||
else
|
||||
self.useHighlight = true
|
||||
self.text:SetTextColor(1, 1, 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
-- NOTE: this is called by a Dropdown-Pullout.
|
||||
-- Do not call this method directly
|
||||
function ItemBase.SetOnLeave(self, func)
|
||||
self.specialOnLeave = func
|
||||
end
|
||||
|
||||
-- exported
|
||||
-- NOTE: this is called by a Dropdown-Pullout.
|
||||
-- Do not call this method directly
|
||||
function ItemBase.SetOnEnter(self, func)
|
||||
self.specialOnEnter = func
|
||||
end
|
||||
|
||||
function ItemBase.Create(type)
|
||||
-- NOTE: Most of the following code is copied from AceGUI-3.0/Dropdown widget
|
||||
local count = AceGUI:GetNextWidgetNum(type)
|
||||
local frame = CreateFrame("Button", "AceGUI30DropDownItem"..count)
|
||||
local self = {}
|
||||
self.frame = frame
|
||||
frame.obj = self
|
||||
self.type = type
|
||||
|
||||
self.useHighlight = true
|
||||
|
||||
frame:SetHeight(17)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
local text = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
|
||||
text:SetTextColor(1,1,1)
|
||||
text:SetJustifyH("LEFT")
|
||||
text:SetPoint("TOPLEFT",frame,"TOPLEFT",18,0)
|
||||
text:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-8,0)
|
||||
self.text = text
|
||||
|
||||
local highlight = frame:CreateTexture(nil, "OVERLAY")
|
||||
highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight
|
||||
highlight:SetBlendMode("ADD")
|
||||
highlight:SetHeight(14)
|
||||
highlight:ClearAllPoints()
|
||||
highlight:SetPoint("RIGHT",frame,"RIGHT",-3,0)
|
||||
highlight:SetPoint("LEFT",frame,"LEFT",5,0)
|
||||
highlight:Hide()
|
||||
self.highlight = highlight
|
||||
|
||||
local check = frame:CreateTexture("OVERLAY")
|
||||
check:SetWidth(16)
|
||||
check:SetHeight(16)
|
||||
check:SetPoint("LEFT",frame,"LEFT",3,-1)
|
||||
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
|
||||
check:Hide()
|
||||
self.check = check
|
||||
|
||||
local sub = frame:CreateTexture("OVERLAY")
|
||||
sub:SetWidth(16)
|
||||
sub:SetHeight(16)
|
||||
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
|
||||
sub:SetTexture(130940) -- Interface\\ChatFrame\\ChatFrameExpandArrow
|
||||
sub:Hide()
|
||||
self.sub = sub
|
||||
|
||||
frame:SetScript("OnEnter", ItemBase.Frame_OnEnter)
|
||||
frame:SetScript("OnLeave", ItemBase.Frame_OnLeave)
|
||||
|
||||
self.OnAcquire = ItemBase.OnAcquire
|
||||
self.OnRelease = ItemBase.OnRelease
|
||||
|
||||
self.SetPullout = ItemBase.SetPullout
|
||||
self.GetText = ItemBase.GetText
|
||||
self.SetText = ItemBase.SetText
|
||||
self.SetDisabled = ItemBase.SetDisabled
|
||||
|
||||
self.SetPoint = ItemBase.SetPoint
|
||||
self.Show = ItemBase.Show
|
||||
self.Hide = ItemBase.Hide
|
||||
|
||||
self.SetOnLeave = ItemBase.SetOnLeave
|
||||
self.SetOnEnter = ItemBase.SetOnEnter
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-- Register a dummy LibStub library to retrieve the ItemBase, so other addons can use it.
|
||||
local IBLib = LibStub:NewLibrary("AceGUI-3.0-DropDown-ItemBase", ItemBase.version)
|
||||
if IBLib then
|
||||
IBLib.GetItemBase = function() return ItemBase end
|
||||
end
|
||||
|
||||
--[[
|
||||
Template for items:
|
||||
|
||||
-- Item:
|
||||
--
|
||||
do
|
||||
local widgetType = "Dropdown-Item-"
|
||||
local widgetVersion = 1
|
||||
|
||||
local function Constructor()
|
||||
local self = ItemBase.Create(widgetType)
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
||||
end
|
||||
--]]
|
||||
|
||||
-- Item: Header
|
||||
-- A single text entry.
|
||||
-- Special: Different text color and no highlight
|
||||
do
|
||||
local widgetType = "Dropdown-Item-Header"
|
||||
local widgetVersion = 1
|
||||
|
||||
local function OnEnter(this)
|
||||
local self = this.obj
|
||||
self:Fire("OnEnter")
|
||||
|
||||
if self.specialOnEnter then
|
||||
self.specialOnEnter(self)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnLeave(this)
|
||||
local self = this.obj
|
||||
self:Fire("OnLeave")
|
||||
|
||||
if self.specialOnLeave then
|
||||
self.specialOnLeave(self)
|
||||
end
|
||||
end
|
||||
|
||||
-- exported, override
|
||||
local function SetDisabled(self, disabled)
|
||||
ItemBase.SetDisabled(self, disabled)
|
||||
if not disabled then
|
||||
self.text:SetTextColor(1, 1, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local self = ItemBase.Create(widgetType)
|
||||
|
||||
self.SetDisabled = SetDisabled
|
||||
|
||||
self.frame:SetScript("OnEnter", OnEnter)
|
||||
self.frame:SetScript("OnLeave", OnLeave)
|
||||
|
||||
self.text:SetTextColor(1, 1, 0)
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
||||
end
|
||||
|
||||
-- Item: Execute
|
||||
-- A simple button
|
||||
do
|
||||
local widgetType = "Dropdown-Item-Execute"
|
||||
local widgetVersion = 1
|
||||
|
||||
local function Frame_OnClick(this, button)
|
||||
local self = this.obj
|
||||
if self.disabled then return end
|
||||
self:Fire("OnClick")
|
||||
if self.pullout then
|
||||
self.pullout:Close()
|
||||
end
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local self = ItemBase.Create(widgetType)
|
||||
|
||||
self.frame:SetScript("OnClick", Frame_OnClick)
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
||||
end
|
||||
|
||||
-- Item: Toggle
|
||||
-- Some sort of checkbox for dropdown menus.
|
||||
-- Does not close the pullout on click.
|
||||
do
|
||||
local widgetType = "Dropdown-Item-Toggle"
|
||||
local widgetVersion = 4
|
||||
|
||||
local function UpdateToggle(self)
|
||||
if self.value then
|
||||
self.check:Show()
|
||||
else
|
||||
self.check:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function OnRelease(self)
|
||||
ItemBase.OnRelease(self)
|
||||
self:SetValue(nil)
|
||||
end
|
||||
|
||||
local function Frame_OnClick(this, button)
|
||||
local self = this.obj
|
||||
if self.disabled then return end
|
||||
self.value = not self.value
|
||||
if self.value then
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
else
|
||||
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
|
||||
end
|
||||
UpdateToggle(self)
|
||||
self:Fire("OnValueChanged", self.value)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetValue(self, value)
|
||||
self.value = value
|
||||
UpdateToggle(self)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function GetValue(self)
|
||||
return self.value
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local self = ItemBase.Create(widgetType)
|
||||
|
||||
self.frame:SetScript("OnClick", Frame_OnClick)
|
||||
|
||||
self.SetValue = SetValue
|
||||
self.GetValue = GetValue
|
||||
self.OnRelease = OnRelease
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
||||
end
|
||||
|
||||
-- Item: Menu
|
||||
-- Shows a submenu on mouse over
|
||||
-- Does not close the pullout on click
|
||||
do
|
||||
local widgetType = "Dropdown-Item-Menu"
|
||||
local widgetVersion = 2
|
||||
|
||||
local function OnEnter(this)
|
||||
local self = this.obj
|
||||
self:Fire("OnEnter")
|
||||
|
||||
if self.specialOnEnter then
|
||||
self.specialOnEnter(self)
|
||||
end
|
||||
|
||||
self.highlight:Show()
|
||||
|
||||
if not self.disabled and self.submenu then
|
||||
self.submenu:Open("TOPLEFT", self.frame, "TOPRIGHT", self.pullout:GetRightBorderWidth(), 0, self.frame:GetFrameLevel() + 100)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnHide(this)
|
||||
local self = this.obj
|
||||
if self.submenu then
|
||||
self.submenu:Close()
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetMenu(self, menu)
|
||||
assert(menu.type == "Dropdown-Pullout")
|
||||
self.submenu = menu
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function CloseMenu(self)
|
||||
self.submenu:Close()
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local self = ItemBase.Create(widgetType)
|
||||
|
||||
self.sub:Show()
|
||||
|
||||
self.frame:SetScript("OnEnter", OnEnter)
|
||||
self.frame:SetScript("OnHide", OnHide)
|
||||
|
||||
self.SetMenu = SetMenu
|
||||
self.CloseMenu = CloseMenu
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
||||
end
|
||||
|
||||
-- Item: Separator
|
||||
-- A single line to separate items
|
||||
do
|
||||
local widgetType = "Dropdown-Item-Separator"
|
||||
local widgetVersion = 2
|
||||
|
||||
-- exported, override
|
||||
local function SetDisabled(self, disabled)
|
||||
ItemBase.SetDisabled(self, disabled)
|
||||
self.useHighlight = false
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local self = ItemBase.Create(widgetType)
|
||||
|
||||
self.SetDisabled = SetDisabled
|
||||
|
||||
local line = self.frame:CreateTexture(nil, "OVERLAY")
|
||||
line:SetHeight(1)
|
||||
line:SetColorTexture(.5, .5, .5)
|
||||
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
|
||||
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
|
||||
|
||||
self.text:Hide()
|
||||
|
||||
self.useHighlight = false
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
||||
end
|
||||
@@ -1,742 +0,0 @@
|
||||
--[[ $Id: AceGUIWidget-DropDown.lua 1237 2020-07-17 22:50:38Z nevcairiel $ ]]--
|
||||
local AceGUI = LibStub("AceGUI-3.0")
|
||||
|
||||
-- Lua APIs
|
||||
local min, max, floor = math.min, math.max, math.floor
|
||||
local select, pairs, ipairs, type, tostring = select, pairs, ipairs, type, tostring
|
||||
local tsort = table.sort
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local UIParent, CreateFrame = UIParent, CreateFrame
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: CLOSE
|
||||
|
||||
local function fixlevels(parent,...)
|
||||
local i = 1
|
||||
local child = select(i, ...)
|
||||
while child do
|
||||
child:SetFrameLevel(parent:GetFrameLevel()+1)
|
||||
fixlevels(child, child:GetChildren())
|
||||
i = i + 1
|
||||
child = select(i, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local function fixstrata(strata, parent, ...)
|
||||
local i = 1
|
||||
local child = select(i, ...)
|
||||
parent:SetFrameStrata(strata)
|
||||
while child do
|
||||
fixstrata(strata, child, child:GetChildren())
|
||||
i = i + 1
|
||||
child = select(i, ...)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local widgetType = "Dropdown-Pullout"
|
||||
local widgetVersion = 4
|
||||
|
||||
--[[ Static data ]]--
|
||||
|
||||
local backdrop = {
|
||||
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
|
||||
edgeSize = 32,
|
||||
tileSize = 32,
|
||||
tile = true,
|
||||
insets = { left = 11, right = 12, top = 12, bottom = 11 },
|
||||
}
|
||||
local sliderBackdrop = {
|
||||
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
|
||||
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
|
||||
tile = true, tileSize = 8, edgeSize = 8,
|
||||
insets = { left = 3, right = 3, top = 3, bottom = 3 }
|
||||
}
|
||||
|
||||
local defaultWidth = 200
|
||||
local defaultMaxHeight = 600
|
||||
|
||||
--[[ UI Event Handlers ]]--
|
||||
|
||||
-- HACK: This should be no part of the pullout, but there
|
||||
-- is no other 'clean' way to response to any item-OnEnter
|
||||
-- Used to close Submenus when an other item is entered
|
||||
local function OnEnter(item)
|
||||
local self = item.pullout
|
||||
for k, v in ipairs(self.items) do
|
||||
if v.CloseMenu and v ~= item then
|
||||
v:CloseMenu()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- See the note in Constructor() for each scroll related function
|
||||
local function OnMouseWheel(this, value)
|
||||
this.obj:MoveScroll(value)
|
||||
end
|
||||
|
||||
local function OnScrollValueChanged(this, value)
|
||||
this.obj:SetScroll(value)
|
||||
end
|
||||
|
||||
local function OnSizeChanged(this)
|
||||
this.obj:FixScroll()
|
||||
end
|
||||
|
||||
--[[ Exported methods ]]--
|
||||
|
||||
-- exported
|
||||
local function SetScroll(self, value)
|
||||
local status = self.scrollStatus
|
||||
local frame, child = self.scrollFrame, self.itemFrame
|
||||
local height, viewheight = frame:GetHeight(), child:GetHeight()
|
||||
|
||||
local offset
|
||||
if height > viewheight then
|
||||
offset = 0
|
||||
else
|
||||
offset = floor((viewheight - height) / 1000 * value)
|
||||
end
|
||||
child:ClearAllPoints()
|
||||
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
|
||||
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", self.slider:IsShown() and -12 or 0, offset)
|
||||
status.offset = offset
|
||||
status.scrollvalue = value
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function MoveScroll(self, value)
|
||||
local status = self.scrollStatus
|
||||
local frame, child = self.scrollFrame, self.itemFrame
|
||||
local height, viewheight = frame:GetHeight(), child:GetHeight()
|
||||
|
||||
if height > viewheight then
|
||||
self.slider:Hide()
|
||||
else
|
||||
self.slider:Show()
|
||||
local diff = height - viewheight
|
||||
local delta = 1
|
||||
if value < 0 then
|
||||
delta = -1
|
||||
end
|
||||
self.slider:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function FixScroll(self)
|
||||
local status = self.scrollStatus
|
||||
local frame, child = self.scrollFrame, self.itemFrame
|
||||
local height, viewheight = frame:GetHeight(), child:GetHeight()
|
||||
local offset = status.offset or 0
|
||||
|
||||
if viewheight < height then
|
||||
self.slider:Hide()
|
||||
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, offset)
|
||||
self.slider:SetValue(0)
|
||||
else
|
||||
self.slider:Show()
|
||||
local value = (offset / (viewheight - height) * 1000)
|
||||
if value > 1000 then value = 1000 end
|
||||
self.slider:SetValue(value)
|
||||
self:SetScroll(value)
|
||||
if value < 1000 then
|
||||
child:ClearAllPoints()
|
||||
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
|
||||
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -12, offset)
|
||||
status.offset = offset
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- exported, AceGUI callback
|
||||
local function OnAcquire(self)
|
||||
self.frame:SetParent(UIParent)
|
||||
--self.itemFrame:SetToplevel(true)
|
||||
end
|
||||
|
||||
-- exported, AceGUI callback
|
||||
local function OnRelease(self)
|
||||
self:Clear()
|
||||
self.frame:ClearAllPoints()
|
||||
self.frame:Hide()
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function AddItem(self, item)
|
||||
self.items[#self.items + 1] = item
|
||||
|
||||
local h = #self.items * 16
|
||||
self.itemFrame:SetHeight(h)
|
||||
self.frame:SetHeight(min(h + 34, self.maxHeight)) -- +34: 20 for scrollFrame placement (10 offset) and +14 for item placement
|
||||
|
||||
item.frame:SetPoint("LEFT", self.itemFrame, "LEFT")
|
||||
item.frame:SetPoint("RIGHT", self.itemFrame, "RIGHT")
|
||||
|
||||
item:SetPullout(self)
|
||||
item:SetOnEnter(OnEnter)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function Open(self, point, relFrame, relPoint, x, y)
|
||||
local items = self.items
|
||||
local frame = self.frame
|
||||
local itemFrame = self.itemFrame
|
||||
|
||||
frame:SetPoint(point, relFrame, relPoint, x, y)
|
||||
|
||||
|
||||
local height = 8
|
||||
for i, item in pairs(items) do
|
||||
if i == 1 then
|
||||
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
|
||||
else
|
||||
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
|
||||
end
|
||||
|
||||
item:Show()
|
||||
|
||||
height = height + 16
|
||||
end
|
||||
itemFrame:SetHeight(height)
|
||||
fixstrata("TOOLTIP", frame, frame:GetChildren())
|
||||
frame:Show()
|
||||
self:Fire("OnOpen")
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function Close(self)
|
||||
self.frame:Hide()
|
||||
self:Fire("OnClose")
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function Clear(self)
|
||||
local items = self.items
|
||||
for i, item in pairs(items) do
|
||||
AceGUI:Release(item)
|
||||
items[i] = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function IterateItems(self)
|
||||
return ipairs(self.items)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetHideOnLeave(self, val)
|
||||
self.hideOnLeave = val
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetMaxHeight(self, height)
|
||||
self.maxHeight = height or defaultMaxHeight
|
||||
if self.frame:GetHeight() > height then
|
||||
self.frame:SetHeight(height)
|
||||
elseif (self.itemFrame:GetHeight() + 34) < height then
|
||||
self.frame:SetHeight(self.itemFrame:GetHeight() + 34) -- see :AddItem
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function GetRightBorderWidth(self)
|
||||
return 6 + (self.slider:IsShown() and 12 or 0)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function GetLeftBorderWidth(self)
|
||||
return 6
|
||||
end
|
||||
|
||||
--[[ Constructor ]]--
|
||||
|
||||
local function Constructor()
|
||||
local count = AceGUI:GetNextWidgetNum(widgetType)
|
||||
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
local self = {}
|
||||
self.count = count
|
||||
self.type = widgetType
|
||||
self.frame = frame
|
||||
frame.obj = self
|
||||
|
||||
self.OnAcquire = OnAcquire
|
||||
self.OnRelease = OnRelease
|
||||
|
||||
self.AddItem = AddItem
|
||||
self.Open = Open
|
||||
self.Close = Close
|
||||
self.Clear = Clear
|
||||
self.IterateItems = IterateItems
|
||||
self.SetHideOnLeave = SetHideOnLeave
|
||||
|
||||
self.SetScroll = SetScroll
|
||||
self.MoveScroll = MoveScroll
|
||||
self.FixScroll = FixScroll
|
||||
|
||||
self.SetMaxHeight = SetMaxHeight
|
||||
self.GetRightBorderWidth = GetRightBorderWidth
|
||||
self.GetLeftBorderWidth = GetLeftBorderWidth
|
||||
|
||||
self.items = {}
|
||||
|
||||
self.scrollStatus = {
|
||||
scrollvalue = 0,
|
||||
}
|
||||
|
||||
self.maxHeight = defaultMaxHeight
|
||||
|
||||
frame:SetBackdrop(backdrop)
|
||||
frame:SetBackdropColor(0, 0, 0)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
frame:SetClampedToScreen(true)
|
||||
frame:SetWidth(defaultWidth)
|
||||
frame:SetHeight(self.maxHeight)
|
||||
--frame:SetToplevel(true)
|
||||
|
||||
-- NOTE: The whole scroll frame code is copied from the AceGUI-3.0 widget ScrollFrame
|
||||
local scrollFrame = CreateFrame("ScrollFrame", nil, frame)
|
||||
local itemFrame = CreateFrame("Frame", nil, scrollFrame)
|
||||
|
||||
self.scrollFrame = scrollFrame
|
||||
self.itemFrame = itemFrame
|
||||
|
||||
scrollFrame.obj = self
|
||||
itemFrame.obj = self
|
||||
|
||||
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
slider:SetOrientation("VERTICAL")
|
||||
slider:SetHitRectInsets(0, 0, -10, 0)
|
||||
slider:SetBackdrop(sliderBackdrop)
|
||||
slider:SetWidth(8)
|
||||
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Vertical")
|
||||
slider:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
self.slider = slider
|
||||
slider.obj = self
|
||||
|
||||
scrollFrame:SetScrollChild(itemFrame)
|
||||
scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 6, -12)
|
||||
scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -6, 12)
|
||||
scrollFrame:EnableMouseWheel(true)
|
||||
scrollFrame:SetScript("OnMouseWheel", OnMouseWheel)
|
||||
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
|
||||
scrollFrame:SetToplevel(true)
|
||||
scrollFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
itemFrame:SetPoint("TOPLEFT", scrollFrame, "TOPLEFT", 0, 0)
|
||||
itemFrame:SetPoint("TOPRIGHT", scrollFrame, "TOPRIGHT", -12, 0)
|
||||
itemFrame:SetHeight(400)
|
||||
itemFrame:SetToplevel(true)
|
||||
itemFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
|
||||
slider:SetPoint("TOPLEFT", scrollFrame, "TOPRIGHT", -16, 0)
|
||||
slider:SetPoint("BOTTOMLEFT", scrollFrame, "BOTTOMRIGHT", -16, 0)
|
||||
slider:SetScript("OnValueChanged", OnScrollValueChanged)
|
||||
slider:SetMinMaxValues(0, 1000)
|
||||
slider:SetValueStep(1)
|
||||
slider:SetValue(0)
|
||||
|
||||
scrollFrame:Show()
|
||||
itemFrame:Show()
|
||||
slider:Hide()
|
||||
|
||||
self:FixScroll()
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
|
||||
end
|
||||
|
||||
do
|
||||
local widgetType = "Dropdown"
|
||||
local widgetVersion = 35
|
||||
|
||||
--[[ Static data ]]--
|
||||
|
||||
--[[ UI event handler ]]--
|
||||
|
||||
local function Control_OnEnter(this)
|
||||
this.obj.button:LockHighlight()
|
||||
this.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(this)
|
||||
this.obj.button:UnlockHighlight()
|
||||
this.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function Dropdown_OnHide(this)
|
||||
local self = this.obj
|
||||
if self.open then
|
||||
self.pullout:Close()
|
||||
end
|
||||
end
|
||||
|
||||
local function Dropdown_TogglePullout(this)
|
||||
local self = this.obj
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
if self.open then
|
||||
self.open = nil
|
||||
self.pullout:Close()
|
||||
AceGUI:ClearFocus()
|
||||
else
|
||||
self.open = true
|
||||
self.pullout:SetWidth(self.pulloutWidth or self.frame:GetWidth())
|
||||
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0)
|
||||
AceGUI:SetFocus(self)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnPulloutOpen(this)
|
||||
local self = this.userdata.obj
|
||||
local value = self.value
|
||||
|
||||
if not self.multiselect then
|
||||
for i, item in this:IterateItems() do
|
||||
item:SetValue(item.userdata.value == value)
|
||||
end
|
||||
end
|
||||
|
||||
self.open = true
|
||||
self:Fire("OnOpened")
|
||||
end
|
||||
|
||||
local function OnPulloutClose(this)
|
||||
local self = this.userdata.obj
|
||||
self.open = nil
|
||||
self:Fire("OnClosed")
|
||||
end
|
||||
|
||||
local function ShowMultiText(self)
|
||||
local text
|
||||
for i, widget in self.pullout:IterateItems() do
|
||||
if widget.type == "Dropdown-Item-Toggle" then
|
||||
if widget:GetValue() then
|
||||
if text then
|
||||
text = text..", "..widget:GetText()
|
||||
else
|
||||
text = widget:GetText()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self:SetText(text)
|
||||
end
|
||||
|
||||
local function OnItemValueChanged(this, event, checked)
|
||||
local self = this.userdata.obj
|
||||
|
||||
if self.multiselect then
|
||||
self:Fire("OnValueChanged", this.userdata.value, checked)
|
||||
ShowMultiText(self)
|
||||
else
|
||||
if checked then
|
||||
self:SetValue(this.userdata.value)
|
||||
self:Fire("OnValueChanged", this.userdata.value)
|
||||
else
|
||||
this:SetValue(true)
|
||||
end
|
||||
if self.open then
|
||||
self.pullout:Close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[[ Exported methods ]]--
|
||||
|
||||
-- exported, AceGUI callback
|
||||
local function OnAcquire(self)
|
||||
local pullout = AceGUI:Create("Dropdown-Pullout")
|
||||
self.pullout = pullout
|
||||
pullout.userdata.obj = self
|
||||
pullout:SetCallback("OnClose", OnPulloutClose)
|
||||
pullout:SetCallback("OnOpen", OnPulloutOpen)
|
||||
self.pullout.frame:SetFrameLevel(self.frame:GetFrameLevel() + 1)
|
||||
fixlevels(self.pullout.frame, self.pullout.frame:GetChildren())
|
||||
|
||||
self:SetHeight(44)
|
||||
self:SetWidth(200)
|
||||
self:SetLabel()
|
||||
self:SetPulloutWidth(nil)
|
||||
self.list = {}
|
||||
end
|
||||
|
||||
-- exported, AceGUI callback
|
||||
local function OnRelease(self)
|
||||
if self.open then
|
||||
self.pullout:Close()
|
||||
end
|
||||
AceGUI:Release(self.pullout)
|
||||
self.pullout = nil
|
||||
|
||||
self:SetText("")
|
||||
self:SetDisabled(false)
|
||||
self:SetMultiselect(false)
|
||||
|
||||
self.value = nil
|
||||
self.list = nil
|
||||
self.open = nil
|
||||
self.hasClose = nil
|
||||
|
||||
self.frame:ClearAllPoints()
|
||||
self.frame:Hide()
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetDisabled(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.text:SetTextColor(0.5,0.5,0.5)
|
||||
self.button:Disable()
|
||||
self.button_cover:Disable()
|
||||
self.label:SetTextColor(0.5,0.5,0.5)
|
||||
else
|
||||
self.button:Enable()
|
||||
self.button_cover:Enable()
|
||||
self.label:SetTextColor(1,.82,0)
|
||||
self.text:SetTextColor(1,1,1)
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function ClearFocus(self)
|
||||
if self.open then
|
||||
self.pullout:Close()
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetText(self, text)
|
||||
self.text:SetText(text or "")
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetLabel(self, text)
|
||||
if text and text ~= "" then
|
||||
self.label:SetText(text)
|
||||
self.label:Show()
|
||||
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-14)
|
||||
self:SetHeight(40)
|
||||
self.alignoffset = 26
|
||||
else
|
||||
self.label:SetText("")
|
||||
self.label:Hide()
|
||||
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,0)
|
||||
self:SetHeight(26)
|
||||
self.alignoffset = 12
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetValue(self, value)
|
||||
self:SetText(self.list[value] or "")
|
||||
self.value = value
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function GetValue(self)
|
||||
return self.value
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetItemValue(self, item, value)
|
||||
if not self.multiselect then return end
|
||||
for i, widget in self.pullout:IterateItems() do
|
||||
if widget.userdata.value == item then
|
||||
if widget.SetValue then
|
||||
widget:SetValue(value)
|
||||
end
|
||||
end
|
||||
end
|
||||
ShowMultiText(self)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetItemDisabled(self, item, disabled)
|
||||
for i, widget in self.pullout:IterateItems() do
|
||||
if widget.userdata.value == item then
|
||||
widget:SetDisabled(disabled)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function AddListItem(self, value, text, itemType)
|
||||
if not itemType then itemType = "Dropdown-Item-Toggle" end
|
||||
local exists = AceGUI:GetWidgetVersion(itemType)
|
||||
if not exists then error(("The given item type, %q, does not exist within AceGUI-3.0"):format(tostring(itemType)), 2) end
|
||||
|
||||
local item = AceGUI:Create(itemType)
|
||||
item:SetText(text)
|
||||
item.userdata.obj = self
|
||||
item.userdata.value = value
|
||||
item:SetCallback("OnValueChanged", OnItemValueChanged)
|
||||
self.pullout:AddItem(item)
|
||||
end
|
||||
|
||||
local function AddCloseButton(self)
|
||||
if not self.hasClose then
|
||||
local close = AceGUI:Create("Dropdown-Item-Execute")
|
||||
close:SetText(CLOSE)
|
||||
self.pullout:AddItem(close)
|
||||
self.hasClose = true
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local sortlist = {}
|
||||
local function sortTbl(x,y)
|
||||
local num1, num2 = tonumber(x), tonumber(y)
|
||||
if num1 and num2 then -- numeric comparison, either two numbers or numeric strings
|
||||
return num1 < num2
|
||||
else -- compare everything else tostring'ed
|
||||
return tostring(x) < tostring(y)
|
||||
end
|
||||
end
|
||||
local function SetList(self, list, order, itemType)
|
||||
self.list = list or {}
|
||||
self.pullout:Clear()
|
||||
self.hasClose = nil
|
||||
if not list then return end
|
||||
|
||||
if type(order) ~= "table" then
|
||||
for v in pairs(list) do
|
||||
sortlist[#sortlist + 1] = v
|
||||
end
|
||||
tsort(sortlist, sortTbl)
|
||||
|
||||
for i, key in ipairs(sortlist) do
|
||||
AddListItem(self, key, list[key], itemType)
|
||||
sortlist[i] = nil
|
||||
end
|
||||
else
|
||||
for i, key in ipairs(order) do
|
||||
AddListItem(self, key, list[key], itemType)
|
||||
end
|
||||
end
|
||||
if self.multiselect then
|
||||
ShowMultiText(self)
|
||||
AddCloseButton(self)
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function AddItem(self, value, text, itemType)
|
||||
self.list[value] = text
|
||||
AddListItem(self, value, text, itemType)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetMultiselect(self, multi)
|
||||
self.multiselect = multi
|
||||
if multi then
|
||||
ShowMultiText(self)
|
||||
AddCloseButton(self)
|
||||
end
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function GetMultiselect(self)
|
||||
return self.multiselect
|
||||
end
|
||||
|
||||
local function SetPulloutWidth(self, width)
|
||||
self.pulloutWidth = width
|
||||
end
|
||||
|
||||
--[[ Constructor ]]--
|
||||
|
||||
local function Constructor()
|
||||
local count = AceGUI:GetNextWidgetNum(widgetType)
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
local dropdown = CreateFrame("Frame", "AceGUI30DropDown"..count, frame, "UIDropDownMenuTemplate")
|
||||
|
||||
local self = {}
|
||||
self.type = widgetType
|
||||
self.frame = frame
|
||||
self.dropdown = dropdown
|
||||
self.count = count
|
||||
frame.obj = self
|
||||
dropdown.obj = self
|
||||
|
||||
self.OnRelease = OnRelease
|
||||
self.OnAcquire = OnAcquire
|
||||
|
||||
self.ClearFocus = ClearFocus
|
||||
|
||||
self.SetText = SetText
|
||||
self.SetValue = SetValue
|
||||
self.GetValue = GetValue
|
||||
self.SetList = SetList
|
||||
self.SetLabel = SetLabel
|
||||
self.SetDisabled = SetDisabled
|
||||
self.AddItem = AddItem
|
||||
self.SetMultiselect = SetMultiselect
|
||||
self.GetMultiselect = GetMultiselect
|
||||
self.SetItemValue = SetItemValue
|
||||
self.SetItemDisabled = SetItemDisabled
|
||||
self.SetPulloutWidth = SetPulloutWidth
|
||||
|
||||
self.alignoffset = 26
|
||||
|
||||
frame:SetScript("OnHide",Dropdown_OnHide)
|
||||
|
||||
dropdown:ClearAllPoints()
|
||||
dropdown:SetPoint("TOPLEFT",frame,"TOPLEFT",-15,0)
|
||||
dropdown:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",17,0)
|
||||
dropdown:SetScript("OnHide", nil)
|
||||
|
||||
local left = _G[dropdown:GetName() .. "Left"]
|
||||
local middle = _G[dropdown:GetName() .. "Middle"]
|
||||
local right = _G[dropdown:GetName() .. "Right"]
|
||||
|
||||
middle:ClearAllPoints()
|
||||
right:ClearAllPoints()
|
||||
|
||||
middle:SetPoint("LEFT", left, "RIGHT", 0, 0)
|
||||
middle:SetPoint("RIGHT", right, "LEFT", 0, 0)
|
||||
right:SetPoint("TOPRIGHT", dropdown, "TOPRIGHT", 0, 17)
|
||||
|
||||
local button = _G[dropdown:GetName() .. "Button"]
|
||||
self.button = button
|
||||
button.obj = self
|
||||
button:SetScript("OnEnter",Control_OnEnter)
|
||||
button:SetScript("OnLeave",Control_OnLeave)
|
||||
button:SetScript("OnClick",Dropdown_TogglePullout)
|
||||
|
||||
local button_cover = CreateFrame("BUTTON",nil,self.frame)
|
||||
self.button_cover = button_cover
|
||||
button_cover.obj = self
|
||||
button_cover:SetPoint("TOPLEFT",self.frame,"BOTTOMLEFT",0,25)
|
||||
button_cover:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT")
|
||||
button_cover:SetScript("OnEnter",Control_OnEnter)
|
||||
button_cover:SetScript("OnLeave",Control_OnLeave)
|
||||
button_cover:SetScript("OnClick",Dropdown_TogglePullout)
|
||||
|
||||
local text = _G[dropdown:GetName() .. "Text"]
|
||||
self.text = text
|
||||
text.obj = self
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint("RIGHT", right, "RIGHT" ,-43, 2)
|
||||
text:SetPoint("LEFT", left, "LEFT", 25, 2)
|
||||
|
||||
local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
|
||||
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
|
||||
label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0)
|
||||
label:SetJustifyH("LEFT")
|
||||
label:SetHeight(18)
|
||||
label:Hide()
|
||||
self.label = label
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion)
|
||||
end
|
||||
@@ -1,263 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
EditBox Widget
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "EditBox", 28
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local tostring, pairs = tostring, pairs
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
if not AceGUIEditBoxInsertLink then
|
||||
-- upgradeable hook
|
||||
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
|
||||
end
|
||||
|
||||
function _G.AceGUIEditBoxInsertLink(text)
|
||||
for i = 1, AceGUI:GetWidgetCount(Type) do
|
||||
local editbox = _G["AceGUI-3.0EditBox"..i]
|
||||
if editbox and editbox:IsVisible() and editbox:HasFocus() then
|
||||
editbox:Insert(text)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function ShowButton(self)
|
||||
if not self.disablebutton then
|
||||
self.button:Show()
|
||||
self.editbox:SetTextInsets(0, 20, 3, 3)
|
||||
end
|
||||
end
|
||||
|
||||
local function HideButton(self)
|
||||
self.button:Hide()
|
||||
self.editbox:SetTextInsets(0, 0, 3, 3)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function Frame_OnShowFocus(frame)
|
||||
frame.obj.editbox:SetFocus()
|
||||
frame:SetScript("OnShow", nil)
|
||||
end
|
||||
|
||||
local function EditBox_OnEscapePressed(frame)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function EditBox_OnEnterPressed(frame)
|
||||
local self = frame.obj
|
||||
local value = frame:GetText()
|
||||
local cancel = self:Fire("OnEnterPressed", value)
|
||||
if not cancel then
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
HideButton(self)
|
||||
end
|
||||
end
|
||||
|
||||
local function EditBox_OnReceiveDrag(frame)
|
||||
local self = frame.obj
|
||||
local type, id, info = GetCursorInfo()
|
||||
local name
|
||||
if type == "item" then
|
||||
name = info
|
||||
elseif type == "spell" then
|
||||
name = GetSpellInfo(id, info)
|
||||
elseif type == "macro" then
|
||||
name = GetMacroInfo(id)
|
||||
end
|
||||
if name then
|
||||
self:SetText(name)
|
||||
self:Fire("OnEnterPressed", name)
|
||||
ClearCursor()
|
||||
HideButton(self)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
end
|
||||
|
||||
local function EditBox_OnTextChanged(frame)
|
||||
local self = frame.obj
|
||||
local value = frame:GetText()
|
||||
if tostring(value) ~= tostring(self.lasttext) then
|
||||
self:Fire("OnTextChanged", value)
|
||||
self.lasttext = value
|
||||
ShowButton(self)
|
||||
end
|
||||
end
|
||||
|
||||
local function EditBox_OnFocusGained(frame)
|
||||
AceGUI:SetFocus(frame.obj)
|
||||
end
|
||||
|
||||
local function Button_OnClick(frame)
|
||||
local editbox = frame.obj.editbox
|
||||
editbox:ClearFocus()
|
||||
EditBox_OnEnterPressed(editbox)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
-- height is controlled by SetLabel
|
||||
self:SetWidth(200)
|
||||
self:SetDisabled(false)
|
||||
self:SetLabel()
|
||||
self:SetText()
|
||||
self:DisableButton(false)
|
||||
self:SetMaxLetters(0)
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self:ClearFocus()
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.editbox:EnableMouse(false)
|
||||
self.editbox:ClearFocus()
|
||||
self.editbox:SetTextColor(0.5,0.5,0.5)
|
||||
self.label:SetTextColor(0.5,0.5,0.5)
|
||||
else
|
||||
self.editbox:EnableMouse(true)
|
||||
self.editbox:SetTextColor(1,1,1)
|
||||
self.label:SetTextColor(1,.82,0)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetText"] = function(self, text)
|
||||
self.lasttext = text or ""
|
||||
self.editbox:SetText(text or "")
|
||||
self.editbox:SetCursorPosition(0)
|
||||
HideButton(self)
|
||||
end,
|
||||
|
||||
["GetText"] = function(self, text)
|
||||
return self.editbox:GetText()
|
||||
end,
|
||||
|
||||
["SetLabel"] = function(self, text)
|
||||
if text and text ~= "" then
|
||||
self.label:SetText(text)
|
||||
self.label:Show()
|
||||
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18)
|
||||
self:SetHeight(44)
|
||||
self.alignoffset = 30
|
||||
else
|
||||
self.label:SetText("")
|
||||
self.label:Hide()
|
||||
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0)
|
||||
self:SetHeight(26)
|
||||
self.alignoffset = 12
|
||||
end
|
||||
end,
|
||||
|
||||
["DisableButton"] = function(self, disabled)
|
||||
self.disablebutton = disabled
|
||||
if disabled then
|
||||
HideButton(self)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetMaxLetters"] = function (self, num)
|
||||
self.editbox:SetMaxLetters(num or 0)
|
||||
end,
|
||||
|
||||
["ClearFocus"] = function(self)
|
||||
self.editbox:ClearFocus()
|
||||
self.frame:SetScript("OnShow", nil)
|
||||
end,
|
||||
|
||||
["SetFocus"] = function(self)
|
||||
self.editbox:SetFocus()
|
||||
if not self.frame:IsShown() then
|
||||
self.frame:SetScript("OnShow", Frame_OnShowFocus)
|
||||
end
|
||||
end,
|
||||
|
||||
["HighlightText"] = function(self, from, to)
|
||||
self.editbox:HighlightText(from, to)
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local num = AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
frame:Hide()
|
||||
|
||||
local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate")
|
||||
editbox:SetAutoFocus(false)
|
||||
editbox:SetFontObject(ChatFontNormal)
|
||||
editbox:SetScript("OnEnter", Control_OnEnter)
|
||||
editbox:SetScript("OnLeave", Control_OnLeave)
|
||||
editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
|
||||
editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
|
||||
editbox:SetScript("OnTextChanged", EditBox_OnTextChanged)
|
||||
editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag)
|
||||
editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag)
|
||||
editbox:SetScript("OnEditFocusGained", EditBox_OnFocusGained)
|
||||
editbox:SetTextInsets(0, 0, 3, 3)
|
||||
editbox:SetMaxLetters(256)
|
||||
editbox:SetPoint("BOTTOMLEFT", 6, 0)
|
||||
editbox:SetPoint("BOTTOMRIGHT")
|
||||
editbox:SetHeight(19)
|
||||
|
||||
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
|
||||
label:SetPoint("TOPLEFT", 0, -2)
|
||||
label:SetPoint("TOPRIGHT", 0, -2)
|
||||
label:SetJustifyH("LEFT")
|
||||
label:SetHeight(18)
|
||||
|
||||
local button = CreateFrame("Button", nil, editbox, "UIPanelButtonTemplate")
|
||||
button:SetWidth(40)
|
||||
button:SetHeight(20)
|
||||
button:SetPoint("RIGHT", -2, 0)
|
||||
button:SetText(OKAY)
|
||||
button:SetScript("OnClick", Button_OnClick)
|
||||
button:Hide()
|
||||
|
||||
local widget = {
|
||||
alignoffset = 30,
|
||||
editbox = editbox,
|
||||
label = label,
|
||||
button = button,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
editbox.obj, button.obj = widget, widget
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,78 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Heading Widget
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Heading", 20
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetText()
|
||||
self:SetFullWidth()
|
||||
self:SetHeight(18)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetText"] = function(self, text)
|
||||
self.label:SetText(text or "")
|
||||
if text and text ~= "" then
|
||||
self.left:SetPoint("RIGHT", self.label, "LEFT", -5, 0)
|
||||
self.right:Show()
|
||||
else
|
||||
self.left:SetPoint("RIGHT", -3, 0)
|
||||
self.right:Hide()
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
frame:Hide()
|
||||
|
||||
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
|
||||
label:SetPoint("TOP")
|
||||
label:SetPoint("BOTTOM")
|
||||
label:SetJustifyH("CENTER")
|
||||
|
||||
local left = frame:CreateTexture(nil, "BACKGROUND")
|
||||
left:SetHeight(8)
|
||||
left:SetPoint("LEFT", 3, 0)
|
||||
left:SetPoint("RIGHT", label, "LEFT", -5, 0)
|
||||
left:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||
left:SetTexCoord(0.81, 0.94, 0.5, 1)
|
||||
|
||||
local right = frame:CreateTexture(nil, "BACKGROUND")
|
||||
right:SetHeight(8)
|
||||
right:SetPoint("RIGHT", -3, 0)
|
||||
right:SetPoint("LEFT", label, "RIGHT", 5, 0)
|
||||
right:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||
right:SetTexCoord(0.81, 0.94, 0.5, 1)
|
||||
|
||||
local widget = {
|
||||
label = label,
|
||||
left = left,
|
||||
right = right,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,140 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Icon Widget
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Icon", 21
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local select, pairs, print = select, pairs, print
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function Button_OnClick(frame, button)
|
||||
frame.obj:Fire("OnClick", button)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetHeight(110)
|
||||
self:SetWidth(110)
|
||||
self:SetLabel()
|
||||
self:SetImage(nil)
|
||||
self:SetImageSize(64, 64)
|
||||
self:SetDisabled(false)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetLabel"] = function(self, text)
|
||||
if text and text ~= "" then
|
||||
self.label:Show()
|
||||
self.label:SetText(text)
|
||||
self:SetHeight(self.image:GetHeight() + 25)
|
||||
else
|
||||
self.label:Hide()
|
||||
self:SetHeight(self.image:GetHeight() + 10)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetImage"] = function(self, path, ...)
|
||||
local image = self.image
|
||||
image:SetTexture(path)
|
||||
|
||||
if image:GetTexture() then
|
||||
local n = select("#", ...)
|
||||
if n == 4 or n == 8 then
|
||||
image:SetTexCoord(...)
|
||||
else
|
||||
image:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
["SetImageSize"] = function(self, width, height)
|
||||
self.image:SetWidth(width)
|
||||
self.image:SetHeight(height)
|
||||
--self.frame:SetWidth(width + 30)
|
||||
if self.label:IsShown() then
|
||||
self:SetHeight(height + 25)
|
||||
else
|
||||
self:SetHeight(height + 10)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.frame:Disable()
|
||||
self.label:SetTextColor(0.5, 0.5, 0.5)
|
||||
self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5)
|
||||
else
|
||||
self.frame:Enable()
|
||||
self.label:SetTextColor(1, 1, 1)
|
||||
self.image:SetVertexColor(1, 1, 1, 1)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Button", nil, UIParent)
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnEnter", Control_OnEnter)
|
||||
frame:SetScript("OnLeave", Control_OnLeave)
|
||||
frame:SetScript("OnClick", Button_OnClick)
|
||||
|
||||
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight")
|
||||
label:SetPoint("BOTTOMLEFT")
|
||||
label:SetPoint("BOTTOMRIGHT")
|
||||
label:SetJustifyH("CENTER")
|
||||
label:SetJustifyV("TOP")
|
||||
label:SetHeight(18)
|
||||
|
||||
local image = frame:CreateTexture(nil, "BACKGROUND")
|
||||
image:SetWidth(64)
|
||||
image:SetHeight(64)
|
||||
image:SetPoint("TOP", 0, -5)
|
||||
|
||||
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
||||
highlight:SetAllPoints(image)
|
||||
highlight:SetTexture(136580) -- Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight
|
||||
highlight:SetTexCoord(0, 1, 0.23, 0.77)
|
||||
highlight:SetBlendMode("ADD")
|
||||
|
||||
local widget = {
|
||||
label = label,
|
||||
image = image,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,94 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
InteractiveLabel Widget
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "InteractiveLabel", 21
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local select, pairs = select, pairs
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function Label_OnClick(frame, button)
|
||||
frame.obj:Fire("OnClick", button)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:LabelOnAcquire()
|
||||
self:SetHighlight()
|
||||
self:SetHighlightTexCoord()
|
||||
self:SetDisabled(false)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetHighlight"] = function(self, ...)
|
||||
self.highlight:SetTexture(...)
|
||||
end,
|
||||
|
||||
["SetHighlightTexCoord"] = function(self, ...)
|
||||
local c = select("#", ...)
|
||||
if c == 4 or c == 8 then
|
||||
self.highlight:SetTexCoord(...)
|
||||
else
|
||||
self.highlight:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self,disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.frame:EnableMouse(false)
|
||||
self.label:SetTextColor(0.5, 0.5, 0.5)
|
||||
else
|
||||
self.frame:EnableMouse(true)
|
||||
self.label:SetTextColor(1, 1, 1)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
-- create a Label type that we will hijack
|
||||
local label = AceGUI:Create("Label")
|
||||
|
||||
local frame = label.frame
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnEnter", Control_OnEnter)
|
||||
frame:SetScript("OnLeave", Control_OnLeave)
|
||||
frame:SetScript("OnMouseDown", Label_OnClick)
|
||||
|
||||
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
||||
highlight:SetTexture(nil)
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetBlendMode("ADD")
|
||||
|
||||
label.highlight = highlight
|
||||
label.type = Type
|
||||
label.LabelOnAcquire = label.OnAcquire
|
||||
for method, func in pairs(methods) do
|
||||
label[method] = func
|
||||
end
|
||||
|
||||
return label
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
|
||||
@@ -1,249 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Keybinding Widget
|
||||
Set Keybindings in the Config UI.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Keybinding", 26
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: NOT_BOUND
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function Keybinding_OnClick(frame, button)
|
||||
if button == "LeftButton" or button == "RightButton" then
|
||||
local self = frame.obj
|
||||
if self.waitingForKey then
|
||||
frame:EnableKeyboard(false)
|
||||
frame:EnableMouseWheel(false)
|
||||
self.msgframe:Hide()
|
||||
frame:UnlockHighlight()
|
||||
self.waitingForKey = nil
|
||||
else
|
||||
frame:EnableKeyboard(true)
|
||||
frame:EnableMouseWheel(true)
|
||||
self.msgframe:Show()
|
||||
frame:LockHighlight()
|
||||
self.waitingForKey = true
|
||||
end
|
||||
end
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local ignoreKeys = {
|
||||
["BUTTON1"] = true, ["BUTTON2"] = true,
|
||||
["UNKNOWN"] = true,
|
||||
["LSHIFT"] = true, ["LCTRL"] = true, ["LALT"] = true,
|
||||
["RSHIFT"] = true, ["RCTRL"] = true, ["RALT"] = true,
|
||||
}
|
||||
local function Keybinding_OnKeyDown(frame, key)
|
||||
local self = frame.obj
|
||||
if self.waitingForKey then
|
||||
local keyPressed = key
|
||||
if keyPressed == "ESCAPE" then
|
||||
keyPressed = ""
|
||||
else
|
||||
if ignoreKeys[keyPressed] then return end
|
||||
if IsShiftKeyDown() then
|
||||
keyPressed = "SHIFT-"..keyPressed
|
||||
end
|
||||
if IsControlKeyDown() then
|
||||
keyPressed = "CTRL-"..keyPressed
|
||||
end
|
||||
if IsAltKeyDown() then
|
||||
keyPressed = "ALT-"..keyPressed
|
||||
end
|
||||
end
|
||||
|
||||
frame:EnableKeyboard(false)
|
||||
frame:EnableMouseWheel(false)
|
||||
self.msgframe:Hide()
|
||||
frame:UnlockHighlight()
|
||||
self.waitingForKey = nil
|
||||
|
||||
if not self.disabled then
|
||||
self:SetKey(keyPressed)
|
||||
self:Fire("OnKeyChanged", keyPressed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function Keybinding_OnMouseDown(frame, button)
|
||||
if button == "LeftButton" or button == "RightButton" then
|
||||
return
|
||||
elseif button == "MiddleButton" then
|
||||
button = "BUTTON3"
|
||||
elseif button == "Button4" then
|
||||
button = "BUTTON4"
|
||||
elseif button == "Button5" then
|
||||
button = "BUTTON5"
|
||||
end
|
||||
Keybinding_OnKeyDown(frame, button)
|
||||
end
|
||||
|
||||
local function Keybinding_OnMouseWheel(frame, direction)
|
||||
local button
|
||||
if direction >= 0 then
|
||||
button = "MOUSEWHEELUP"
|
||||
else
|
||||
button = "MOUSEWHEELDOWN"
|
||||
end
|
||||
Keybinding_OnKeyDown(frame, button)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetWidth(200)
|
||||
self:SetLabel("")
|
||||
self:SetKey("")
|
||||
self.waitingForKey = nil
|
||||
self.msgframe:Hide()
|
||||
self:SetDisabled(false)
|
||||
self.button:EnableKeyboard(false)
|
||||
self.button:EnableMouseWheel(false)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.button:Disable()
|
||||
self.label:SetTextColor(0.5,0.5,0.5)
|
||||
else
|
||||
self.button:Enable()
|
||||
self.label:SetTextColor(1,1,1)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetKey"] = function(self, key)
|
||||
if (key or "") == "" then
|
||||
self.button:SetText(NOT_BOUND)
|
||||
self.button:SetNormalFontObject("GameFontNormal")
|
||||
else
|
||||
self.button:SetText(key)
|
||||
self.button:SetNormalFontObject("GameFontHighlight")
|
||||
end
|
||||
end,
|
||||
|
||||
["GetKey"] = function(self)
|
||||
local key = self.button:GetText()
|
||||
if key == NOT_BOUND then
|
||||
key = nil
|
||||
end
|
||||
return key
|
||||
end,
|
||||
|
||||
["SetLabel"] = function(self, label)
|
||||
self.label:SetText(label or "")
|
||||
if (label or "") == "" then
|
||||
self.alignoffset = nil
|
||||
self:SetHeight(24)
|
||||
else
|
||||
self.alignoffset = 30
|
||||
self:SetHeight(44)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
local ControlBackdrop = {
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 3, bottom = 3 }
|
||||
}
|
||||
|
||||
local function keybindingMsgFixWidth(frame)
|
||||
frame:SetWidth(frame.msg:GetWidth() + 10)
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
|
||||
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate")
|
||||
|
||||
button:EnableMouse(true)
|
||||
button:EnableMouseWheel(false)
|
||||
button:RegisterForClicks("AnyDown")
|
||||
button:SetScript("OnEnter", Control_OnEnter)
|
||||
button:SetScript("OnLeave", Control_OnLeave)
|
||||
button:SetScript("OnClick", Keybinding_OnClick)
|
||||
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
|
||||
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
|
||||
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
|
||||
button:SetPoint("BOTTOMLEFT")
|
||||
button:SetPoint("BOTTOMRIGHT")
|
||||
button:SetHeight(24)
|
||||
button:EnableKeyboard(false)
|
||||
|
||||
local text = button:GetFontString()
|
||||
text:SetPoint("LEFT", 7, 0)
|
||||
text:SetPoint("RIGHT", -7, 0)
|
||||
|
||||
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
|
||||
label:SetPoint("TOPLEFT")
|
||||
label:SetPoint("TOPRIGHT")
|
||||
label:SetJustifyH("CENTER")
|
||||
label:SetHeight(18)
|
||||
|
||||
local msgframe = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
msgframe:SetHeight(30)
|
||||
msgframe:SetBackdrop(ControlBackdrop)
|
||||
msgframe:SetBackdropColor(0,0,0)
|
||||
msgframe:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
msgframe:SetFrameLevel(1000)
|
||||
msgframe:SetToplevel(true)
|
||||
|
||||
local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.")
|
||||
msgframe.msg = msg
|
||||
msg:SetPoint("TOPLEFT", 5, -5)
|
||||
msgframe:SetScript("OnUpdate", keybindingMsgFixWidth)
|
||||
msgframe:SetPoint("BOTTOM", button, "TOP")
|
||||
msgframe:Hide()
|
||||
|
||||
local widget = {
|
||||
button = button,
|
||||
label = label,
|
||||
msgframe = msgframe,
|
||||
frame = frame,
|
||||
alignoffset = 30,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
button.obj = widget
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,179 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Label Widget
|
||||
Displays text and optionally an icon.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Label", 27
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local max, select, pairs = math.max, select, pairs
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GameFontHighlightSmall
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
local function UpdateImageAnchor(self)
|
||||
if self.resizing then return end
|
||||
local frame = self.frame
|
||||
local width = frame.width or frame:GetWidth() or 0
|
||||
local image = self.image
|
||||
local label = self.label
|
||||
local height
|
||||
|
||||
label:ClearAllPoints()
|
||||
image:ClearAllPoints()
|
||||
|
||||
if self.imageshown then
|
||||
local imagewidth = image:GetWidth()
|
||||
if (width - imagewidth) < 200 or (label:GetText() or "") == "" then
|
||||
-- image goes on top centered when less than 200 width for the text, or if there is no text
|
||||
image:SetPoint("TOP")
|
||||
label:SetPoint("TOP", image, "BOTTOM")
|
||||
label:SetPoint("LEFT")
|
||||
label:SetWidth(width)
|
||||
height = image:GetHeight() + label:GetStringHeight()
|
||||
else
|
||||
-- image on the left
|
||||
image:SetPoint("TOPLEFT")
|
||||
if image:GetHeight() > label:GetStringHeight() then
|
||||
label:SetPoint("LEFT", image, "RIGHT", 4, 0)
|
||||
else
|
||||
label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0)
|
||||
end
|
||||
label:SetWidth(width - imagewidth - 4)
|
||||
height = max(image:GetHeight(), label:GetStringHeight())
|
||||
end
|
||||
else
|
||||
-- no image shown
|
||||
label:SetPoint("TOPLEFT")
|
||||
label:SetWidth(width)
|
||||
height = label:GetStringHeight()
|
||||
end
|
||||
|
||||
-- avoid zero-height labels, since they can used as spacers
|
||||
if not height or height == 0 then
|
||||
height = 1
|
||||
end
|
||||
|
||||
self.resizing = true
|
||||
frame:SetHeight(height)
|
||||
frame.height = height
|
||||
self.resizing = nil
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
-- set the flag to stop constant size updates
|
||||
self.resizing = true
|
||||
-- height is set dynamically by the text and image size
|
||||
self:SetWidth(200)
|
||||
self:SetText()
|
||||
self:SetImage(nil)
|
||||
self:SetImageSize(16, 16)
|
||||
self:SetColor()
|
||||
self:SetFontObject()
|
||||
self:SetJustifyH("LEFT")
|
||||
self:SetJustifyV("TOP")
|
||||
|
||||
-- reset the flag
|
||||
self.resizing = nil
|
||||
-- run the update explicitly
|
||||
UpdateImageAnchor(self)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["OnWidthSet"] = function(self, width)
|
||||
UpdateImageAnchor(self)
|
||||
end,
|
||||
|
||||
["SetText"] = function(self, text)
|
||||
self.label:SetText(text)
|
||||
UpdateImageAnchor(self)
|
||||
end,
|
||||
|
||||
["SetColor"] = function(self, r, g, b)
|
||||
if not (r and g and b) then
|
||||
r, g, b = 1, 1, 1
|
||||
end
|
||||
self.label:SetVertexColor(r, g, b)
|
||||
end,
|
||||
|
||||
["SetImage"] = function(self, path, ...)
|
||||
local image = self.image
|
||||
image:SetTexture(path)
|
||||
|
||||
if image:GetTexture() then
|
||||
self.imageshown = true
|
||||
local n = select("#", ...)
|
||||
if n == 4 or n == 8 then
|
||||
image:SetTexCoord(...)
|
||||
else
|
||||
image:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
else
|
||||
self.imageshown = nil
|
||||
end
|
||||
UpdateImageAnchor(self)
|
||||
end,
|
||||
|
||||
["SetFont"] = function(self, font, height, flags)
|
||||
self.label:SetFont(font, height, flags)
|
||||
UpdateImageAnchor(self)
|
||||
end,
|
||||
|
||||
["SetFontObject"] = function(self, font)
|
||||
self:SetFont((font or GameFontHighlightSmall):GetFont())
|
||||
end,
|
||||
|
||||
["SetImageSize"] = function(self, width, height)
|
||||
self.image:SetWidth(width)
|
||||
self.image:SetHeight(height)
|
||||
UpdateImageAnchor(self)
|
||||
end,
|
||||
|
||||
["SetJustifyH"] = function(self, justifyH)
|
||||
self.label:SetJustifyH(justifyH)
|
||||
end,
|
||||
|
||||
["SetJustifyV"] = function(self, justifyV)
|
||||
self.label:SetJustifyV(justifyV)
|
||||
end,
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
frame:Hide()
|
||||
|
||||
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
|
||||
local image = frame:CreateTexture(nil, "BACKGROUND")
|
||||
|
||||
-- create widget
|
||||
local widget = {
|
||||
label = label,
|
||||
image = image,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,366 +0,0 @@
|
||||
local Type, Version = "MultiLineEditBox", 29
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local GetCursorInfo, GetSpellInfo, ClearCursor = GetCursorInfo, GetSpellInfo, ClearCursor
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: ACCEPT, ChatFontNormal
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
if not AceGUIMultiLineEditBoxInsertLink then
|
||||
-- upgradeable hook
|
||||
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
|
||||
end
|
||||
|
||||
function _G.AceGUIMultiLineEditBoxInsertLink(text)
|
||||
for i = 1, AceGUI:GetWidgetCount(Type) do
|
||||
local editbox = _G[("MultiLineEditBox%uEdit"):format(i)]
|
||||
if editbox and editbox:IsVisible() and editbox:HasFocus() then
|
||||
editbox:Insert(text)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function Layout(self)
|
||||
self:SetHeight(self.numlines * 14 + (self.disablebutton and 19 or 41) + self.labelHeight)
|
||||
|
||||
if self.labelHeight == 0 then
|
||||
self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23)
|
||||
else
|
||||
self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19)
|
||||
end
|
||||
|
||||
if self.disablebutton then
|
||||
self.scrollBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 21)
|
||||
self.scrollBG:SetPoint("BOTTOMLEFT", 0, 4)
|
||||
else
|
||||
self.scrollBar:SetPoint("BOTTOM", self.button, "TOP", 0, 18)
|
||||
self.scrollBG:SetPoint("BOTTOMLEFT", self.button, "TOPLEFT")
|
||||
end
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function OnClick(self) -- Button
|
||||
self = self.obj
|
||||
self.editBox:ClearFocus()
|
||||
if not self:Fire("OnEnterPressed", self.editBox:GetText()) then
|
||||
self.button:Disable()
|
||||
end
|
||||
end
|
||||
|
||||
local function OnCursorChanged(self, _, y, _, cursorHeight) -- EditBox
|
||||
self, y = self.obj.scrollFrame, -y
|
||||
local offset = self:GetVerticalScroll()
|
||||
if y < offset then
|
||||
self:SetVerticalScroll(y)
|
||||
else
|
||||
y = y + cursorHeight - self:GetHeight()
|
||||
if y > offset then
|
||||
self:SetVerticalScroll(y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function OnEditFocusLost(self) -- EditBox
|
||||
self:HighlightText(0, 0)
|
||||
self.obj:Fire("OnEditFocusLost")
|
||||
end
|
||||
|
||||
local function OnEnter(self) -- EditBox / ScrollFrame
|
||||
self = self.obj
|
||||
if not self.entered then
|
||||
self.entered = true
|
||||
self:Fire("OnEnter")
|
||||
end
|
||||
end
|
||||
|
||||
local function OnLeave(self) -- EditBox / ScrollFrame
|
||||
self = self.obj
|
||||
if self.entered then
|
||||
self.entered = nil
|
||||
self:Fire("OnLeave")
|
||||
end
|
||||
end
|
||||
|
||||
local function OnMouseUp(self) -- ScrollFrame
|
||||
self = self.obj.editBox
|
||||
self:SetFocus()
|
||||
self:SetCursorPosition(self:GetNumLetters())
|
||||
end
|
||||
|
||||
local function OnReceiveDrag(self) -- EditBox / ScrollFrame
|
||||
local type, id, info = GetCursorInfo()
|
||||
if type == "spell" then
|
||||
info = GetSpellInfo(id, info)
|
||||
elseif type ~= "item" then
|
||||
return
|
||||
end
|
||||
ClearCursor()
|
||||
self = self.obj
|
||||
local editBox = self.editBox
|
||||
if not editBox:HasFocus() then
|
||||
editBox:SetFocus()
|
||||
editBox:SetCursorPosition(editBox:GetNumLetters())
|
||||
end
|
||||
editBox:Insert(info)
|
||||
self.button:Enable()
|
||||
end
|
||||
|
||||
local function OnSizeChanged(self, width, height) -- ScrollFrame
|
||||
self.obj.editBox:SetWidth(width)
|
||||
end
|
||||
|
||||
local function OnTextChanged(self, userInput) -- EditBox
|
||||
if userInput then
|
||||
self = self.obj
|
||||
self:Fire("OnTextChanged", self.editBox:GetText())
|
||||
self.button:Enable()
|
||||
end
|
||||
end
|
||||
|
||||
local function OnTextSet(self) -- EditBox
|
||||
self:HighlightText(0, 0)
|
||||
self:SetCursorPosition(self:GetNumLetters())
|
||||
self:SetCursorPosition(0)
|
||||
self.obj.button:Disable()
|
||||
end
|
||||
|
||||
local function OnVerticalScroll(self, offset) -- ScrollFrame
|
||||
local editBox = self.obj.editBox
|
||||
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
|
||||
end
|
||||
|
||||
local function OnShowFocus(frame)
|
||||
frame.obj.editBox:SetFocus()
|
||||
frame:SetScript("OnShow", nil)
|
||||
end
|
||||
|
||||
local function OnEditFocusGained(frame)
|
||||
AceGUI:SetFocus(frame.obj)
|
||||
frame.obj:Fire("OnEditFocusGained")
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self.editBox:SetText("")
|
||||
self:SetDisabled(false)
|
||||
self:SetWidth(200)
|
||||
self:DisableButton(false)
|
||||
self:SetNumLines()
|
||||
self.entered = nil
|
||||
self:SetMaxLetters(0)
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self:ClearFocus()
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
local editBox = self.editBox
|
||||
if disabled then
|
||||
editBox:ClearFocus()
|
||||
editBox:EnableMouse(false)
|
||||
editBox:SetTextColor(0.5, 0.5, 0.5)
|
||||
self.label:SetTextColor(0.5, 0.5, 0.5)
|
||||
self.scrollFrame:EnableMouse(false)
|
||||
self.button:Disable()
|
||||
else
|
||||
editBox:EnableMouse(true)
|
||||
editBox:SetTextColor(1, 1, 1)
|
||||
self.label:SetTextColor(1, 0.82, 0)
|
||||
self.scrollFrame:EnableMouse(true)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetLabel"] = function(self, text)
|
||||
if text and text ~= "" then
|
||||
self.label:SetText(text)
|
||||
if self.labelHeight ~= 10 then
|
||||
self.labelHeight = 10
|
||||
self.label:Show()
|
||||
end
|
||||
elseif self.labelHeight ~= 0 then
|
||||
self.labelHeight = 0
|
||||
self.label:Hide()
|
||||
end
|
||||
Layout(self)
|
||||
end,
|
||||
|
||||
["SetNumLines"] = function(self, value)
|
||||
if not value or value < 4 then
|
||||
value = 4
|
||||
end
|
||||
self.numlines = value
|
||||
Layout(self)
|
||||
end,
|
||||
|
||||
["SetText"] = function(self, text)
|
||||
self.editBox:SetText(text)
|
||||
end,
|
||||
|
||||
["GetText"] = function(self)
|
||||
return self.editBox:GetText()
|
||||
end,
|
||||
|
||||
["SetMaxLetters"] = function (self, num)
|
||||
self.editBox:SetMaxLetters(num or 0)
|
||||
end,
|
||||
|
||||
["DisableButton"] = function(self, disabled)
|
||||
self.disablebutton = disabled
|
||||
if disabled then
|
||||
self.button:Hide()
|
||||
else
|
||||
self.button:Show()
|
||||
end
|
||||
Layout(self)
|
||||
end,
|
||||
|
||||
["ClearFocus"] = function(self)
|
||||
self.editBox:ClearFocus()
|
||||
self.frame:SetScript("OnShow", nil)
|
||||
end,
|
||||
|
||||
["SetFocus"] = function(self)
|
||||
self.editBox:SetFocus()
|
||||
if not self.frame:IsShown() then
|
||||
self.frame:SetScript("OnShow", OnShowFocus)
|
||||
end
|
||||
end,
|
||||
|
||||
["HighlightText"] = function(self, from, to)
|
||||
self.editBox:HighlightText(from, to)
|
||||
end,
|
||||
|
||||
["GetCursorPosition"] = function(self)
|
||||
return self.editBox:GetCursorPosition()
|
||||
end,
|
||||
|
||||
["SetCursorPosition"] = function(self, ...)
|
||||
return self.editBox:SetCursorPosition(...)
|
||||
end,
|
||||
|
||||
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local backdrop = {
|
||||
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
|
||||
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 16,
|
||||
insets = { left = 4, right = 3, top = 4, bottom = 3 }
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
frame:Hide()
|
||||
|
||||
local widgetNum = AceGUI:GetNextWidgetNum(Type)
|
||||
|
||||
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
|
||||
label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4)
|
||||
label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4)
|
||||
label:SetJustifyH("LEFT")
|
||||
label:SetText(ACCEPT)
|
||||
label:SetHeight(10)
|
||||
|
||||
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate")
|
||||
button:SetPoint("BOTTOMLEFT", 0, 4)
|
||||
button:SetHeight(22)
|
||||
button:SetWidth(label:GetStringWidth() + 24)
|
||||
button:SetText(ACCEPT)
|
||||
button:SetScript("OnClick", OnClick)
|
||||
button:Disable()
|
||||
|
||||
local text = button:GetFontString()
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint("TOPLEFT", button, "TOPLEFT", 5, -5)
|
||||
text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
|
||||
text:SetJustifyV("MIDDLE")
|
||||
|
||||
local scrollBG = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
scrollBG:SetBackdrop(backdrop)
|
||||
scrollBG:SetBackdropColor(0, 0, 0)
|
||||
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
|
||||
local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate")
|
||||
|
||||
local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"]
|
||||
scrollBar:ClearAllPoints()
|
||||
scrollBar:SetPoint("TOP", label, "BOTTOM", 0, -19)
|
||||
scrollBar:SetPoint("BOTTOM", button, "TOP", 0, 18)
|
||||
scrollBar:SetPoint("RIGHT", frame, "RIGHT")
|
||||
|
||||
scrollBG:SetPoint("TOPRIGHT", scrollBar, "TOPLEFT", 0, 19)
|
||||
scrollBG:SetPoint("BOTTOMLEFT", button, "TOPLEFT")
|
||||
|
||||
scrollFrame:SetPoint("TOPLEFT", scrollBG, "TOPLEFT", 5, -6)
|
||||
scrollFrame:SetPoint("BOTTOMRIGHT", scrollBG, "BOTTOMRIGHT", -4, 4)
|
||||
scrollFrame:SetScript("OnEnter", OnEnter)
|
||||
scrollFrame:SetScript("OnLeave", OnLeave)
|
||||
scrollFrame:SetScript("OnMouseUp", OnMouseUp)
|
||||
scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
|
||||
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
|
||||
scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
|
||||
|
||||
local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
|
||||
editBox:SetAllPoints()
|
||||
editBox:SetFontObject(ChatFontNormal)
|
||||
editBox:SetMultiLine(true)
|
||||
editBox:EnableMouse(true)
|
||||
editBox:SetAutoFocus(false)
|
||||
editBox:SetCountInvisibleLetters(false)
|
||||
editBox:SetScript("OnCursorChanged", OnCursorChanged)
|
||||
editBox:SetScript("OnEditFocusLost", OnEditFocusLost)
|
||||
editBox:SetScript("OnEnter", OnEnter)
|
||||
editBox:SetScript("OnEscapePressed", editBox.ClearFocus)
|
||||
editBox:SetScript("OnLeave", OnLeave)
|
||||
editBox:SetScript("OnMouseDown", OnReceiveDrag)
|
||||
editBox:SetScript("OnReceiveDrag", OnReceiveDrag)
|
||||
editBox:SetScript("OnTextChanged", OnTextChanged)
|
||||
editBox:SetScript("OnTextSet", OnTextSet)
|
||||
editBox:SetScript("OnEditFocusGained", OnEditFocusGained)
|
||||
|
||||
|
||||
scrollFrame:SetScrollChild(editBox)
|
||||
|
||||
local widget = {
|
||||
button = button,
|
||||
editBox = editBox,
|
||||
frame = frame,
|
||||
label = label,
|
||||
labelHeight = 10,
|
||||
numlines = 4,
|
||||
scrollBar = scrollBar,
|
||||
scrollBG = scrollBG,
|
||||
scrollFrame = scrollFrame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -1,284 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Slider Widget
|
||||
Graphical Slider, like, for Range values.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Slider", 23
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local min, max, floor = math.min, math.max, math.floor
|
||||
local tonumber, pairs = tonumber, pairs
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GameFontHighlightSmall
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function UpdateText(self)
|
||||
local value = self.value or 0
|
||||
if self.ispercent then
|
||||
self.editbox:SetText(("%s%%"):format(floor(value * 1000 + 0.5) / 10))
|
||||
else
|
||||
self.editbox:SetText(floor(value * 100 + 0.5) / 100)
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateLabels(self)
|
||||
local min, max = (self.min or 0), (self.max or 100)
|
||||
if self.ispercent then
|
||||
self.lowtext:SetFormattedText("%s%%", (min * 100))
|
||||
self.hightext:SetFormattedText("%s%%", (max * 100))
|
||||
else
|
||||
self.lowtext:SetText(min)
|
||||
self.hightext:SetText(max)
|
||||
end
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function Frame_OnMouseDown(frame)
|
||||
frame.obj.slider:EnableMouseWheel(true)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function Slider_OnValueChanged(frame, newvalue)
|
||||
local self = frame.obj
|
||||
if not frame.setup then
|
||||
if self.step and self.step > 0 then
|
||||
local min_value = self.min or 0
|
||||
newvalue = floor((newvalue - min_value) / self.step + 0.5) * self.step + min_value
|
||||
end
|
||||
if newvalue ~= self.value and not self.disabled then
|
||||
self.value = newvalue
|
||||
self:Fire("OnValueChanged", newvalue)
|
||||
end
|
||||
if self.value then
|
||||
UpdateText(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function Slider_OnMouseUp(frame)
|
||||
local self = frame.obj
|
||||
self:Fire("OnMouseUp", self.value)
|
||||
end
|
||||
|
||||
local function Slider_OnMouseWheel(frame, v)
|
||||
local self = frame.obj
|
||||
if not self.disabled then
|
||||
local value = self.value
|
||||
if v > 0 then
|
||||
value = min(value + (self.step or 1), self.max)
|
||||
else
|
||||
value = max(value - (self.step or 1), self.min)
|
||||
end
|
||||
self.slider:SetValue(value)
|
||||
end
|
||||
end
|
||||
|
||||
local function EditBox_OnEscapePressed(frame)
|
||||
frame:ClearFocus()
|
||||
end
|
||||
|
||||
local function EditBox_OnEnterPressed(frame)
|
||||
local self = frame.obj
|
||||
local value = frame:GetText()
|
||||
if self.ispercent then
|
||||
value = value:gsub('%%', '')
|
||||
value = tonumber(value) / 100
|
||||
else
|
||||
value = tonumber(value)
|
||||
end
|
||||
|
||||
if value then
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
self.slider:SetValue(value)
|
||||
self:Fire("OnMouseUp", value)
|
||||
end
|
||||
end
|
||||
|
||||
local function EditBox_OnEnter(frame)
|
||||
frame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
|
||||
end
|
||||
|
||||
local function EditBox_OnLeave(frame)
|
||||
frame:SetBackdropBorderColor(0.3, 0.3, 0.3, 0.8)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetWidth(200)
|
||||
self:SetHeight(44)
|
||||
self:SetDisabled(false)
|
||||
self:SetIsPercent(nil)
|
||||
self:SetSliderValues(0,100,1)
|
||||
self:SetValue(0)
|
||||
self.slider:EnableMouseWheel(false)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.slider:EnableMouse(false)
|
||||
self.label:SetTextColor(.5, .5, .5)
|
||||
self.hightext:SetTextColor(.5, .5, .5)
|
||||
self.lowtext:SetTextColor(.5, .5, .5)
|
||||
--self.valuetext:SetTextColor(.5, .5, .5)
|
||||
self.editbox:SetTextColor(.5, .5, .5)
|
||||
self.editbox:EnableMouse(false)
|
||||
self.editbox:ClearFocus()
|
||||
else
|
||||
self.slider:EnableMouse(true)
|
||||
self.label:SetTextColor(1, .82, 0)
|
||||
self.hightext:SetTextColor(1, 1, 1)
|
||||
self.lowtext:SetTextColor(1, 1, 1)
|
||||
--self.valuetext:SetTextColor(1, 1, 1)
|
||||
self.editbox:SetTextColor(1, 1, 1)
|
||||
self.editbox:EnableMouse(true)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetValue"] = function(self, value)
|
||||
self.slider.setup = true
|
||||
self.slider:SetValue(value)
|
||||
self.value = value
|
||||
UpdateText(self)
|
||||
self.slider.setup = nil
|
||||
end,
|
||||
|
||||
["GetValue"] = function(self)
|
||||
return self.value
|
||||
end,
|
||||
|
||||
["SetLabel"] = function(self, text)
|
||||
self.label:SetText(text)
|
||||
end,
|
||||
|
||||
["SetSliderValues"] = function(self, min, max, step)
|
||||
local frame = self.slider
|
||||
frame.setup = true
|
||||
self.min = min
|
||||
self.max = max
|
||||
self.step = step
|
||||
frame:SetMinMaxValues(min or 0,max or 100)
|
||||
UpdateLabels(self)
|
||||
frame:SetValueStep(step or 1)
|
||||
if self.value then
|
||||
frame:SetValue(self.value)
|
||||
end
|
||||
frame.setup = nil
|
||||
end,
|
||||
|
||||
["SetIsPercent"] = function(self, value)
|
||||
self.ispercent = value
|
||||
UpdateLabels(self)
|
||||
UpdateText(self)
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local SliderBackdrop = {
|
||||
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
|
||||
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
|
||||
tile = true, tileSize = 8, edgeSize = 8,
|
||||
insets = { left = 3, right = 3, top = 6, bottom = 6 }
|
||||
}
|
||||
|
||||
local ManualBackdrop = {
|
||||
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
||||
tile = true, edgeSize = 1, tileSize = 5,
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnMouseDown", Frame_OnMouseDown)
|
||||
|
||||
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
label:SetPoint("TOPLEFT")
|
||||
label:SetPoint("TOPRIGHT")
|
||||
label:SetJustifyH("CENTER")
|
||||
label:SetHeight(15)
|
||||
|
||||
local slider = CreateFrame("Slider", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
slider:SetOrientation("HORIZONTAL")
|
||||
slider:SetHeight(15)
|
||||
slider:SetHitRectInsets(0, 0, -10, 0)
|
||||
slider:SetBackdrop(SliderBackdrop)
|
||||
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
|
||||
slider:SetPoint("TOP", label, "BOTTOM")
|
||||
slider:SetPoint("LEFT", 3, 0)
|
||||
slider:SetPoint("RIGHT", -3, 0)
|
||||
slider:SetValue(0)
|
||||
slider:SetScript("OnValueChanged",Slider_OnValueChanged)
|
||||
slider:SetScript("OnEnter", Control_OnEnter)
|
||||
slider:SetScript("OnLeave", Control_OnLeave)
|
||||
slider:SetScript("OnMouseUp", Slider_OnMouseUp)
|
||||
slider:SetScript("OnMouseWheel", Slider_OnMouseWheel)
|
||||
|
||||
local lowtext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
||||
lowtext:SetPoint("TOPLEFT", slider, "BOTTOMLEFT", 2, 3)
|
||||
|
||||
local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
||||
hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
|
||||
|
||||
local editbox = CreateFrame("EditBox", nil, frame, BackdropTemplateMixin and "BackdropTemplate" or nil)
|
||||
editbox:SetAutoFocus(false)
|
||||
editbox:SetFontObject(GameFontHighlightSmall)
|
||||
editbox:SetPoint("TOP", slider, "BOTTOM")
|
||||
editbox:SetHeight(14)
|
||||
editbox:SetWidth(70)
|
||||
editbox:SetJustifyH("CENTER")
|
||||
editbox:EnableMouse(true)
|
||||
editbox:SetBackdrop(ManualBackdrop)
|
||||
editbox:SetBackdropColor(0, 0, 0, 0.5)
|
||||
editbox:SetBackdropBorderColor(0.3, 0.3, 0.30, 0.80)
|
||||
editbox:SetScript("OnEnter", EditBox_OnEnter)
|
||||
editbox:SetScript("OnLeave", EditBox_OnLeave)
|
||||
editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
|
||||
editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
|
||||
|
||||
local widget = {
|
||||
label = label,
|
||||
slider = slider,
|
||||
lowtext = lowtext,
|
||||
hightext = hightext,
|
||||
editbox = editbox,
|
||||
alignoffset = 25,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
slider.obj, editbox.obj = widget, widget
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type,Constructor,Version)
|
||||
@@ -1,511 +0,0 @@
|
||||
--- **AceHook-3.0** offers safe Hooking/Unhooking of functions, methods and frame scripts.
|
||||
-- Using AceHook-3.0 is recommended when you need to unhook your hooks again, so the hook chain isn't broken
|
||||
-- when you manually restore the original function.
|
||||
--
|
||||
-- **AceHook-3.0** can be embeded into your addon, either explicitly by calling AceHook:Embed(MyAddon) or by
|
||||
-- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
|
||||
-- and can be accessed directly, without having to explicitly call AceHook itself.\\
|
||||
-- It is recommended to embed AceHook, otherwise you'll have to specify a custom `self` on all calls you
|
||||
-- make into AceHook.
|
||||
-- @class file
|
||||
-- @name AceHook-3.0
|
||||
-- @release $Id: AceHook-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
local ACEHOOK_MAJOR, ACEHOOK_MINOR = "AceHook-3.0", 8
|
||||
local AceHook, oldminor = LibStub:NewLibrary(ACEHOOK_MAJOR, ACEHOOK_MINOR)
|
||||
|
||||
if not AceHook then return end -- No upgrade needed
|
||||
|
||||
AceHook.embeded = AceHook.embeded or {}
|
||||
AceHook.registry = AceHook.registry or setmetatable({}, {__index = function(tbl, key) tbl[key] = {} return tbl[key] end })
|
||||
AceHook.handlers = AceHook.handlers or {}
|
||||
AceHook.actives = AceHook.actives or {}
|
||||
AceHook.scripts = AceHook.scripts or {}
|
||||
AceHook.onceSecure = AceHook.onceSecure or {}
|
||||
AceHook.hooks = AceHook.hooks or {}
|
||||
|
||||
-- local upvalues
|
||||
local registry = AceHook.registry
|
||||
local handlers = AceHook.handlers
|
||||
local actives = AceHook.actives
|
||||
local scripts = AceHook.scripts
|
||||
local onceSecure = AceHook.onceSecure
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, next, type = pairs, next, type
|
||||
local format = string.format
|
||||
local assert, error = assert, error
|
||||
|
||||
-- WoW APIs
|
||||
local issecurevariable, hooksecurefunc = issecurevariable, hooksecurefunc
|
||||
local _G = _G
|
||||
|
||||
-- functions for later definition
|
||||
local donothing, createHook, hook
|
||||
|
||||
local protectedScripts = {
|
||||
OnClick = true,
|
||||
}
|
||||
|
||||
-- upgrading of embeded is done at the bottom of the file
|
||||
|
||||
local mixins = {
|
||||
"Hook", "SecureHook",
|
||||
"HookScript", "SecureHookScript",
|
||||
"Unhook", "UnhookAll",
|
||||
"IsHooked",
|
||||
"RawHook", "RawHookScript"
|
||||
}
|
||||
|
||||
-- AceHook:Embed( target )
|
||||
-- target (object) - target object to embed AceHook in
|
||||
--
|
||||
-- Embeds AceEevent into the target object making the functions from the mixins list available on target:..
|
||||
function AceHook:Embed( target )
|
||||
for k, v in pairs( mixins ) do
|
||||
target[v] = self[v]
|
||||
end
|
||||
self.embeded[target] = true
|
||||
-- inject the hooks table safely
|
||||
target.hooks = target.hooks or {}
|
||||
return target
|
||||
end
|
||||
|
||||
-- AceHook:OnEmbedDisable( target )
|
||||
-- target (object) - target object that is being disabled
|
||||
--
|
||||
-- Unhooks all hooks when the target disables.
|
||||
-- this method should be called by the target manually or by an addon framework
|
||||
function AceHook:OnEmbedDisable( target )
|
||||
target:UnhookAll()
|
||||
end
|
||||
|
||||
function createHook(self, handler, orig, secure, failsafe)
|
||||
local uid
|
||||
local method = type(handler) == "string"
|
||||
if failsafe and not secure then
|
||||
-- failsafe hook creation
|
||||
uid = function(...)
|
||||
if actives[uid] then
|
||||
if method then
|
||||
self[handler](self, ...)
|
||||
else
|
||||
handler(...)
|
||||
end
|
||||
end
|
||||
return orig(...)
|
||||
end
|
||||
-- /failsafe hook
|
||||
else
|
||||
-- all other hooks
|
||||
uid = function(...)
|
||||
if actives[uid] then
|
||||
if method then
|
||||
return self[handler](self, ...)
|
||||
else
|
||||
return handler(...)
|
||||
end
|
||||
elseif not secure then -- backup on non secure
|
||||
return orig(...)
|
||||
end
|
||||
end
|
||||
-- /hook
|
||||
end
|
||||
return uid
|
||||
end
|
||||
|
||||
function donothing() end
|
||||
|
||||
function hook(self, obj, method, handler, script, secure, raw, forceSecure, usage)
|
||||
if not handler then handler = method end
|
||||
|
||||
-- These asserts make sure AceHooks's devs play by the rules.
|
||||
assert(not script or type(script) == "boolean")
|
||||
assert(not secure or type(secure) == "boolean")
|
||||
assert(not raw or type(raw) == "boolean")
|
||||
assert(not forceSecure or type(forceSecure) == "boolean")
|
||||
assert(usage)
|
||||
|
||||
-- Error checking Battery!
|
||||
if obj and type(obj) ~= "table" then
|
||||
error(format("%s: 'object' - nil or table expected got %s", usage, type(obj)), 3)
|
||||
end
|
||||
if type(method) ~= "string" then
|
||||
error(format("%s: 'method' - string expected got %s", usage, type(method)), 3)
|
||||
end
|
||||
if type(handler) ~= "string" and type(handler) ~= "function" then
|
||||
error(format("%s: 'handler' - nil, string, or function expected got %s", usage, type(handler)), 3)
|
||||
end
|
||||
if type(handler) == "string" and type(self[handler]) ~= "function" then
|
||||
error(format("%s: 'handler' - Handler specified does not exist at self[handler]", usage), 3)
|
||||
end
|
||||
if script then
|
||||
if not obj or not obj.GetScript or not obj:HasScript(method) then
|
||||
error(format("%s: You can only hook a script on a frame object", usage), 3)
|
||||
end
|
||||
if not secure and obj.IsProtected and obj:IsProtected() and protectedScripts[method] then
|
||||
error(format("Cannot hook secure script %q; Use SecureHookScript(obj, method, [handler]) instead.", method), 3)
|
||||
end
|
||||
else
|
||||
local issecure
|
||||
if obj then
|
||||
issecure = onceSecure[obj] and onceSecure[obj][method] or issecurevariable(obj, method)
|
||||
else
|
||||
issecure = onceSecure[method] or issecurevariable(method)
|
||||
end
|
||||
if issecure then
|
||||
if forceSecure then
|
||||
if obj then
|
||||
onceSecure[obj] = onceSecure[obj] or {}
|
||||
onceSecure[obj][method] = true
|
||||
else
|
||||
onceSecure[method] = true
|
||||
end
|
||||
elseif not secure then
|
||||
error(format("%s: Attempt to hook secure function %s. Use `SecureHook' or add `true' to the argument list to override.", usage, method), 3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local uid
|
||||
if obj then
|
||||
uid = registry[self][obj] and registry[self][obj][method]
|
||||
else
|
||||
uid = registry[self][method]
|
||||
end
|
||||
|
||||
if uid then
|
||||
if actives[uid] then
|
||||
-- Only two sane choices exist here. We either a) error 100% of the time or b) always unhook and then hook
|
||||
-- choice b would likely lead to odd debuging conditions or other mysteries so we're going with a.
|
||||
error(format("Attempting to rehook already active hook %s.", method))
|
||||
end
|
||||
|
||||
if handlers[uid] == handler then -- turn on a decative hook, note enclosures break this ability, small memory leak
|
||||
actives[uid] = true
|
||||
return
|
||||
elseif obj then -- is there any reason not to call unhook instead of doing the following several lines?
|
||||
if self.hooks and self.hooks[obj] then
|
||||
self.hooks[obj][method] = nil
|
||||
end
|
||||
registry[self][obj][method] = nil
|
||||
else
|
||||
if self.hooks then
|
||||
self.hooks[method] = nil
|
||||
end
|
||||
registry[self][method] = nil
|
||||
end
|
||||
handlers[uid], actives[uid], scripts[uid] = nil, nil, nil
|
||||
uid = nil
|
||||
end
|
||||
|
||||
local orig
|
||||
if script then
|
||||
orig = obj:GetScript(method) or donothing
|
||||
elseif obj then
|
||||
orig = obj[method]
|
||||
else
|
||||
orig = _G[method]
|
||||
end
|
||||
|
||||
if not orig then
|
||||
error(format("%s: Attempting to hook a non existing target", usage), 3)
|
||||
end
|
||||
|
||||
uid = createHook(self, handler, orig, secure, not (raw or secure))
|
||||
|
||||
if obj then
|
||||
self.hooks[obj] = self.hooks[obj] or {}
|
||||
registry[self][obj] = registry[self][obj] or {}
|
||||
registry[self][obj][method] = uid
|
||||
|
||||
if not secure then
|
||||
self.hooks[obj][method] = orig
|
||||
end
|
||||
|
||||
if script then
|
||||
if not secure then
|
||||
obj:SetScript(method, uid)
|
||||
else
|
||||
obj:HookScript(method, uid)
|
||||
end
|
||||
else
|
||||
if not secure then
|
||||
obj[method] = uid
|
||||
else
|
||||
hooksecurefunc(obj, method, uid)
|
||||
end
|
||||
end
|
||||
else
|
||||
registry[self][method] = uid
|
||||
|
||||
if not secure then
|
||||
_G[method] = uid
|
||||
self.hooks[method] = orig
|
||||
else
|
||||
hooksecurefunc(method, uid)
|
||||
end
|
||||
end
|
||||
|
||||
actives[uid], handlers[uid], scripts[uid] = true, handler, script and true or nil
|
||||
end
|
||||
|
||||
--- Hook a function or a method on an object.
|
||||
-- The hook created will be a "safe hook", that means that your handler will be called
|
||||
-- before the hooked function ("Pre-Hook"), and you don't have to call the original function yourself,
|
||||
-- however you cannot stop the execution of the function, or modify any of the arguments/return values.\\
|
||||
-- This type of hook is typically used if you need to know if some function got called, and don't want to modify it.
|
||||
-- @paramsig [object], method, [handler], [hookSecure]
|
||||
-- @param object The object to hook a method from
|
||||
-- @param method If object was specified, the name of the method, or the name of the function to hook.
|
||||
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked function)
|
||||
-- @param hookSecure If true, AceHook will allow hooking of secure functions.
|
||||
-- @usage
|
||||
-- -- create an addon with AceHook embeded
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
|
||||
--
|
||||
-- function MyAddon:OnEnable()
|
||||
-- -- Hook ActionButton_UpdateHotkeys, overwriting the secure status
|
||||
-- self:Hook("ActionButton_UpdateHotkeys", true)
|
||||
-- end
|
||||
--
|
||||
-- function MyAddon:ActionButton_UpdateHotkeys(button, type)
|
||||
-- print(button:GetName() .. " is updating its HotKey")
|
||||
-- end
|
||||
function AceHook:Hook(object, method, handler, hookSecure)
|
||||
if type(object) == "string" then
|
||||
method, handler, hookSecure, object = object, method, handler, nil
|
||||
end
|
||||
|
||||
if handler == true then
|
||||
handler, hookSecure = nil, true
|
||||
end
|
||||
|
||||
hook(self, object, method, handler, false, false, false, hookSecure or false, "Usage: Hook([object], method, [handler], [hookSecure])")
|
||||
end
|
||||
|
||||
--- RawHook a function or a method on an object.
|
||||
-- The hook created will be a "raw hook", that means that your handler will completly replace
|
||||
-- the original function, and your handler has to call the original function (or not, depending on your intentions).\\
|
||||
-- The original function will be stored in `self.hooks[object][method]` or `self.hooks[functionName]` respectively.\\
|
||||
-- This type of hook can be used for all purposes, and is usually the most common case when you need to modify arguments
|
||||
-- or want to control execution of the original function.
|
||||
-- @paramsig [object], method, [handler], [hookSecure]
|
||||
-- @param object The object to hook a method from
|
||||
-- @param method If object was specified, the name of the method, or the name of the function to hook.
|
||||
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked function)
|
||||
-- @param hookSecure If true, AceHook will allow hooking of secure functions.
|
||||
-- @usage
|
||||
-- -- create an addon with AceHook embeded
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
|
||||
--
|
||||
-- function MyAddon:OnEnable()
|
||||
-- -- Hook ActionButton_UpdateHotkeys, overwriting the secure status
|
||||
-- self:RawHook("ActionButton_UpdateHotkeys", true)
|
||||
-- end
|
||||
--
|
||||
-- function MyAddon:ActionButton_UpdateHotkeys(button, type)
|
||||
-- if button:GetName() == "MyButton" then
|
||||
-- -- do stuff here
|
||||
-- else
|
||||
-- self.hooks.ActionButton_UpdateHotkeys(button, type)
|
||||
-- end
|
||||
-- end
|
||||
function AceHook:RawHook(object, method, handler, hookSecure)
|
||||
if type(object) == "string" then
|
||||
method, handler, hookSecure, object = object, method, handler, nil
|
||||
end
|
||||
|
||||
if handler == true then
|
||||
handler, hookSecure = nil, true
|
||||
end
|
||||
|
||||
hook(self, object, method, handler, false, false, true, hookSecure or false, "Usage: RawHook([object], method, [handler], [hookSecure])")
|
||||
end
|
||||
|
||||
--- SecureHook a function or a method on an object.
|
||||
-- This function is a wrapper around the `hooksecurefunc` function in the WoW API. Using AceHook
|
||||
-- extends the functionality of secure hooks, and adds the ability to unhook once the hook isn't
|
||||
-- required anymore, or the addon is being disabled.\\
|
||||
-- Secure Hooks should be used if the secure-status of the function is vital to its function,
|
||||
-- and taint would block execution. Secure Hooks are always called after the original function was called
|
||||
-- ("Post Hook"), and you cannot modify the arguments, return values or control the execution.
|
||||
-- @paramsig [object], method, [handler]
|
||||
-- @param object The object to hook a method from
|
||||
-- @param method If object was specified, the name of the method, or the name of the function to hook.
|
||||
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked function)
|
||||
function AceHook:SecureHook(object, method, handler)
|
||||
if type(object) == "string" then
|
||||
method, handler, object = object, method, nil
|
||||
end
|
||||
|
||||
hook(self, object, method, handler, false, true, false, false, "Usage: SecureHook([object], method, [handler])")
|
||||
end
|
||||
|
||||
--- Hook a script handler on a frame.
|
||||
-- The hook created will be a "safe hook", that means that your handler will be called
|
||||
-- before the hooked script ("Pre-Hook"), and you don't have to call the original function yourself,
|
||||
-- however you cannot stop the execution of the function, or modify any of the arguments/return values.\\
|
||||
-- This is the frame script equivalent of the :Hook safe-hook. It would typically be used to be notified
|
||||
-- when a certain event happens to a frame.
|
||||
-- @paramsig frame, script, [handler]
|
||||
-- @param frame The Frame to hook the script on
|
||||
-- @param script The script to hook
|
||||
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked script)
|
||||
-- @usage
|
||||
-- -- create an addon with AceHook embeded
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
|
||||
--
|
||||
-- function MyAddon:OnEnable()
|
||||
-- -- Hook the OnShow of FriendsFrame
|
||||
-- self:HookScript(FriendsFrame, "OnShow", "FriendsFrameOnShow")
|
||||
-- end
|
||||
--
|
||||
-- function MyAddon:FriendsFrameOnShow(frame)
|
||||
-- print("The FriendsFrame was shown!")
|
||||
-- end
|
||||
function AceHook:HookScript(frame, script, handler)
|
||||
hook(self, frame, script, handler, true, false, false, false, "Usage: HookScript(object, method, [handler])")
|
||||
end
|
||||
|
||||
--- RawHook a script handler on a frame.
|
||||
-- The hook created will be a "raw hook", that means that your handler will completly replace
|
||||
-- the original script, and your handler has to call the original script (or not, depending on your intentions).\\
|
||||
-- The original script will be stored in `self.hooks[frame][script]`.\\
|
||||
-- This type of hook can be used for all purposes, and is usually the most common case when you need to modify arguments
|
||||
-- or want to control execution of the original script.
|
||||
-- @paramsig frame, script, [handler]
|
||||
-- @param frame The Frame to hook the script on
|
||||
-- @param script The script to hook
|
||||
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked script)
|
||||
-- @usage
|
||||
-- -- create an addon with AceHook embeded
|
||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("HookDemo", "AceHook-3.0")
|
||||
--
|
||||
-- function MyAddon:OnEnable()
|
||||
-- -- Hook the OnShow of FriendsFrame
|
||||
-- self:RawHookScript(FriendsFrame, "OnShow", "FriendsFrameOnShow")
|
||||
-- end
|
||||
--
|
||||
-- function MyAddon:FriendsFrameOnShow(frame)
|
||||
-- -- Call the original function
|
||||
-- self.hooks[frame].OnShow(frame)
|
||||
-- -- Do our processing
|
||||
-- -- .. stuff
|
||||
-- end
|
||||
function AceHook:RawHookScript(frame, script, handler)
|
||||
hook(self, frame, script, handler, true, false, true, false, "Usage: RawHookScript(object, method, [handler])")
|
||||
end
|
||||
|
||||
--- SecureHook a script handler on a frame.
|
||||
-- This function is a wrapper around the `frame:HookScript` function in the WoW API. Using AceHook
|
||||
-- extends the functionality of secure hooks, and adds the ability to unhook once the hook isn't
|
||||
-- required anymore, or the addon is being disabled.\\
|
||||
-- Secure Hooks should be used if the secure-status of the function is vital to its function,
|
||||
-- and taint would block execution. Secure Hooks are always called after the original function was called
|
||||
-- ("Post Hook"), and you cannot modify the arguments, return values or control the execution.
|
||||
-- @paramsig frame, script, [handler]
|
||||
-- @param frame The Frame to hook the script on
|
||||
-- @param script The script to hook
|
||||
-- @param handler The handler for the hook, a funcref or a method name. (Defaults to the name of the hooked script)
|
||||
function AceHook:SecureHookScript(frame, script, handler)
|
||||
hook(self, frame, script, handler, true, true, false, false, "Usage: SecureHookScript(object, method, [handler])")
|
||||
end
|
||||
|
||||
--- Unhook from the specified function, method or script.
|
||||
-- @paramsig [obj], method
|
||||
-- @param obj The object or frame to unhook from
|
||||
-- @param method The name of the method, function or script to unhook from.
|
||||
function AceHook:Unhook(obj, method)
|
||||
local usage = "Usage: Unhook([obj], method)"
|
||||
if type(obj) == "string" then
|
||||
method, obj = obj, nil
|
||||
end
|
||||
|
||||
if obj and type(obj) ~= "table" then
|
||||
error(format("%s: 'obj' - expecting nil or table got %s", usage, type(obj)), 2)
|
||||
end
|
||||
if type(method) ~= "string" then
|
||||
error(format("%s: 'method' - expeting string got %s", usage, type(method)), 2)
|
||||
end
|
||||
|
||||
local uid
|
||||
if obj then
|
||||
uid = registry[self][obj] and registry[self][obj][method]
|
||||
else
|
||||
uid = registry[self][method]
|
||||
end
|
||||
|
||||
if not uid or not actives[uid] then
|
||||
-- Declining to error on an unneeded unhook since the end effect is the same and this would just be annoying.
|
||||
return false
|
||||
end
|
||||
|
||||
actives[uid], handlers[uid] = nil, nil
|
||||
|
||||
if obj then
|
||||
registry[self][obj][method] = nil
|
||||
registry[self][obj] = next(registry[self][obj]) and registry[self][obj] or nil
|
||||
|
||||
-- if the hook reference doesnt exist, then its a secure hook, just bail out and dont do any unhooking
|
||||
if not self.hooks[obj] or not self.hooks[obj][method] then return true end
|
||||
|
||||
if scripts[uid] and obj:GetScript(method) == uid then -- unhooks scripts
|
||||
obj:SetScript(method, self.hooks[obj][method] ~= donothing and self.hooks[obj][method] or nil)
|
||||
scripts[uid] = nil
|
||||
elseif obj and self.hooks[obj] and self.hooks[obj][method] and obj[method] == uid then -- unhooks methods
|
||||
obj[method] = self.hooks[obj][method]
|
||||
end
|
||||
|
||||
self.hooks[obj][method] = nil
|
||||
self.hooks[obj] = next(self.hooks[obj]) and self.hooks[obj] or nil
|
||||
else
|
||||
registry[self][method] = nil
|
||||
|
||||
-- if self.hooks[method] doesn't exist, then this is a SecureHook, just bail out
|
||||
if not self.hooks[method] then return true end
|
||||
|
||||
if self.hooks[method] and _G[method] == uid then -- unhooks functions
|
||||
_G[method] = self.hooks[method]
|
||||
end
|
||||
|
||||
self.hooks[method] = nil
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--- Unhook all existing hooks for this addon.
|
||||
function AceHook:UnhookAll()
|
||||
for key, value in pairs(registry[self]) do
|
||||
if type(key) == "table" then
|
||||
for method in pairs(value) do
|
||||
self:Unhook(key, method)
|
||||
end
|
||||
else
|
||||
self:Unhook(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Check if the specific function, method or script is already hooked.
|
||||
-- @paramsig [obj], method
|
||||
-- @param obj The object or frame to unhook from
|
||||
-- @param method The name of the method, function or script to unhook from.
|
||||
function AceHook:IsHooked(obj, method)
|
||||
-- we don't check if registry[self] exists, this is done by evil magicks in the metatable
|
||||
if type(obj) == "string" then
|
||||
if registry[self][obj] and actives[registry[self][obj]] then
|
||||
return true, handlers[registry[self][obj]]
|
||||
end
|
||||
else
|
||||
if registry[self][obj] and registry[self][obj][method] and actives[registry[self][obj][method]] then
|
||||
return true, handlers[registry[self][obj][method]]
|
||||
end
|
||||
end
|
||||
|
||||
return false, nil
|
||||
end
|
||||
|
||||
--- Upgrade our old embeded
|
||||
for target, v in pairs( AceHook.embeded ) do
|
||||
AceHook:Embed( target )
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceHook-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,446 +0,0 @@
|
||||
--- AceTab-3.0 provides support for tab-completion.
|
||||
-- Note: This library is not yet finalized.
|
||||
-- @class file
|
||||
-- @name AceTab-3.0
|
||||
-- @release $Id: AceTab-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
|
||||
local ACETAB_MAJOR, ACETAB_MINOR = 'AceTab-3.0', 9
|
||||
local AceTab, oldminor = LibStub:NewLibrary(ACETAB_MAJOR, ACETAB_MINOR)
|
||||
|
||||
if not AceTab then return end -- No upgrade needed
|
||||
|
||||
AceTab.registry = AceTab.registry or {}
|
||||
|
||||
-- local upvalues
|
||||
local _G = _G
|
||||
local pairs = pairs
|
||||
local ipairs = ipairs
|
||||
local type = type
|
||||
local registry = AceTab.registry
|
||||
|
||||
local strfind = string.find
|
||||
local strsub = string.sub
|
||||
local strlower = string.lower
|
||||
local strformat = string.format
|
||||
local strmatch = string.match
|
||||
|
||||
local function printf(...)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(strformat(...))
|
||||
end
|
||||
|
||||
local function getTextBeforeCursor(this, start)
|
||||
return strsub(this:GetText(), start or 1, this:GetCursorPosition())
|
||||
end
|
||||
|
||||
-- Hook OnTabPressed and OnTextChanged for the frame, give it an empty matches table, and set its curMatch to 0, if we haven't done so already.
|
||||
local function hookFrame(f)
|
||||
if f.hookedByAceTab3 then return end
|
||||
f.hookedByAceTab3 = true
|
||||
if f == ChatEdit_GetActiveWindow() then
|
||||
local origCTP = ChatEdit_CustomTabPressed
|
||||
function ChatEdit_CustomTabPressed(...)
|
||||
if AceTab:OnTabPressed(f) then
|
||||
return origCTP(...)
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
else
|
||||
local origOTP = f:GetScript('OnTabPressed')
|
||||
if type(origOTP) ~= 'function' then
|
||||
origOTP = function() end
|
||||
end
|
||||
f:SetScript('OnTabPressed', function(...)
|
||||
if AceTab:OnTabPressed(f) then
|
||||
return origOTP(...)
|
||||
end
|
||||
end)
|
||||
end
|
||||
f.at3curMatch = 0
|
||||
f.at3matches = {}
|
||||
end
|
||||
|
||||
local firstPMLength
|
||||
|
||||
local fallbacks, notfallbacks = {}, {} -- classifies completions into those which have preconditions and those which do not. Those without preconditions are only considered if no other completions have matches.
|
||||
local pmolengths = {} -- holds the number of characters to overwrite according to pmoverwrite and the current prematch
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- RegisterTabCompletion( descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite )
|
||||
-- See http://www.wowace.com/wiki/AceTab-2.0 for detailed API documentation
|
||||
--
|
||||
-- descriptor string Unique identifier for this tab completion set
|
||||
--
|
||||
-- prematches string|table|nil String match(es) AFTER which this tab completion will apply.
|
||||
-- AceTab will ignore tabs NOT preceded by the string(s).
|
||||
-- If no value is passed, will check all tabs pressed in the specified editframe(s) UNLESS a more-specific tab complete applies.
|
||||
--
|
||||
-- wordlist function|table Function that will be passed a table into which it will insert strings corresponding to all possible completions, or an equivalent table.
|
||||
-- The text in the editbox, the position of the start of the word to be completed, and the uncompleted partial word
|
||||
-- are passed as second, third, and fourth arguments, to facilitate pre-filtering or conditional formatting, if desired.
|
||||
--
|
||||
-- usagefunc function|boolean|nil Usage statement function. Defaults to the wordlist, one per line. A boolean true squelches usage output.
|
||||
--
|
||||
-- listenframes string|table|nil EditFrames to monitor. Defaults to ChatFrameEditBox.
|
||||
--
|
||||
-- postfunc function|nil Post-processing function. If supplied, matches will be passed through this function after they've been identified as a match.
|
||||
--
|
||||
-- pmoverwrite boolean|number|nil Offset the beginning of the completion string in the editbox when making a completion. Passing a boolean true indicates that we want to overwrite
|
||||
-- the entire prematch string, and passing a number will overwrite that many characters prior to the cursor.
|
||||
-- This is useful when you want to use the prematch as an indicator character, but ultimately do not want it as part of the text, itself.
|
||||
--
|
||||
-- no return
|
||||
-- ------------------------------------------------------------------------------
|
||||
function AceTab:RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite)
|
||||
-- Arg checks
|
||||
if type(descriptor) ~= 'string' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'descriptor' - string expected.", 3) end
|
||||
if prematches and type(prematches) ~= 'string' and type(prematches) ~= 'table' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'prematches' - string, table, or nil expected.", 3) end
|
||||
if type(wordlist) ~= 'function' and type(wordlist) ~= 'table' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'wordlist' - function or table expected.", 3) end
|
||||
if usagefunc and type(usagefunc) ~= 'function' and type(usagefunc) ~= 'boolean' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'usagefunc' - function or boolean expected.", 3) end
|
||||
if listenframes and type(listenframes) ~= 'string' and type(listenframes) ~= 'table' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'listenframes' - string or table expected.", 3) end
|
||||
if postfunc and type(postfunc) ~= 'function' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'postfunc' - function expected.", 3) end
|
||||
if pmoverwrite and type(pmoverwrite) ~= 'boolean' and type(pmoverwrite) ~= 'number' then error("Usage: RegisterTabCompletion(descriptor, prematches, wordlist, usagefunc, listenframes, postfunc, pmoverwrite): 'pmoverwrite' - boolean or number expected.", 3) end
|
||||
|
||||
local pmtable
|
||||
|
||||
if type(prematches) == 'table' then
|
||||
pmtable = prematches
|
||||
notfallbacks[descriptor] = true
|
||||
else
|
||||
pmtable = {}
|
||||
-- Mark this group as a fallback group if no value was passed.
|
||||
if not prematches then
|
||||
pmtable[1] = ""
|
||||
fallbacks[descriptor] = true
|
||||
-- Make prematches into a one-element table if it was passed as a string.
|
||||
elseif type(prematches) == 'string' then
|
||||
pmtable[1] = prematches
|
||||
if prematches == "" then
|
||||
fallbacks[descriptor] = true
|
||||
else
|
||||
notfallbacks[descriptor] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Make listenframes into a one-element table if it was not passed a table of frames.
|
||||
if not listenframes then -- default
|
||||
listenframes = {}
|
||||
for i = 1, NUM_CHAT_WINDOWS do
|
||||
listenframes[i] = _G["ChatFrame"..i.."EditBox"]
|
||||
end
|
||||
elseif type(listenframes) ~= 'table' or type(listenframes[0]) == 'userdata' and type(listenframes.IsObjectType) == 'function' then -- single frame or framename
|
||||
listenframes = { listenframes }
|
||||
end
|
||||
|
||||
-- Hook each registered listenframe and give it a matches table.
|
||||
for _, f in pairs(listenframes) do
|
||||
if type(f) == 'string' then
|
||||
f = _G[f]
|
||||
end
|
||||
if type(f) ~= 'table' or type(f[0]) ~= 'userdata' or type(f.IsObjectType) ~= 'function' then
|
||||
error(format(ACETAB_MAJOR..": Cannot register frame %q; it does not exist", f:GetName()))
|
||||
end
|
||||
if f then
|
||||
if f:GetObjectType() ~= 'EditBox' then
|
||||
error(format(ACETAB_MAJOR..": Cannot register frame %q; it is not an EditBox", f:GetName()))
|
||||
else
|
||||
hookFrame(f)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Everything checks out; register this completion.
|
||||
if not registry[descriptor] then
|
||||
registry[descriptor] = { prematches = pmtable, wordlist = wordlist, usagefunc = usagefunc, listenframes = listenframes, postfunc = postfunc, pmoverwrite = pmoverwrite }
|
||||
end
|
||||
end
|
||||
|
||||
function AceTab:IsTabCompletionRegistered(descriptor)
|
||||
return registry and registry[descriptor]
|
||||
end
|
||||
|
||||
function AceTab:UnregisterTabCompletion(descriptor)
|
||||
registry[descriptor] = nil
|
||||
pmolengths[descriptor] = nil
|
||||
fallbacks[descriptor] = nil
|
||||
notfallbacks[descriptor] = nil
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- gcbs( s1, s2 )
|
||||
--
|
||||
-- s1 string First string to be compared
|
||||
--
|
||||
-- s2 string Second string to be compared
|
||||
--
|
||||
-- returns the greatest common substring beginning s1 and s2
|
||||
-- ------------------------------------------------------------------------------
|
||||
local function gcbs(s1, s2)
|
||||
if not s1 and not s2 then return end
|
||||
if not s1 then s1 = s2 end
|
||||
if not s2 then s2 = s1 end
|
||||
if #s2 < #s1 then
|
||||
s1, s2 = s2, s1
|
||||
end
|
||||
if strfind(strlower(s2), "^"..strlower(s1)) then
|
||||
return s1
|
||||
else
|
||||
return gcbs(strsub(s1, 1, -2), s2)
|
||||
end
|
||||
end
|
||||
|
||||
local cursor -- Holds cursor position. Set in :OnTabPressed().
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- cycleTab()
|
||||
-- For when a tab press has multiple possible completions, we need to allow the user to press tab repeatedly to cycle through them.
|
||||
-- If we have multiple possible completions, all tab presses after the first will call this function to cycle through and insert the different possible matches.
|
||||
-- This function will stop being called after OnTextChanged() is triggered by something other than AceTab (i.e. the user inputs a character).
|
||||
-- ------------------------------------------------------------------------------
|
||||
local previousLength, cMatch, matched, postmatch
|
||||
local function cycleTab(this)
|
||||
cMatch = 0 -- Counter across all sets. The pseudo-index relevant to this value and corresponding to the current match is held in this.at3curMatch
|
||||
matched = false
|
||||
|
||||
-- Check each completion group registered to this frame.
|
||||
for desc, compgrp in pairs(this.at3matches) do
|
||||
|
||||
-- Loop through the valid completions for this set.
|
||||
for m, pm in pairs(compgrp) do
|
||||
cMatch = cMatch + 1
|
||||
if cMatch == this.at3curMatch then -- we're back to where we left off last time through the combined list
|
||||
this.at3lastMatch = m
|
||||
this.at3lastWord = pm
|
||||
this.at3curMatch = cMatch + 1 -- save the new cMatch index
|
||||
matched = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if matched then break end
|
||||
end
|
||||
|
||||
-- If our index is beyond the end of the list, reset the original uncompleted substring and let the cycle start over next time tab is pressed.
|
||||
if not matched then
|
||||
this.at3lastMatch = this.at3origMatch
|
||||
this.at3lastWord = this.at3origWord
|
||||
this.at3curMatch = 1
|
||||
end
|
||||
|
||||
-- Insert the completion.
|
||||
this:HighlightText(this.at3matchStart-1, cursor)
|
||||
this:Insert(this.at3lastWord or '')
|
||||
this.at3_last_precursor = getTextBeforeCursor(this) or ''
|
||||
end
|
||||
|
||||
local IsSecureCmd = IsSecureCmd
|
||||
|
||||
local cands, candUsage = {}, {}
|
||||
local numMatches = 0
|
||||
local firstMatch, hasNonFallback, allGCBS, setGCBS, usage
|
||||
local text_precursor, text_all, text_pmendToCursor
|
||||
local matches, usagefunc -- convenience locals
|
||||
|
||||
-- Fill the this.at3matches[descriptor] tables with matching completion pairs for each entry, based on
|
||||
-- the partial string preceding the cursor position and using the corresponding registered wordlist.
|
||||
--
|
||||
-- The entries of the matches tables are of the format raw_match = formatted_match, where raw_match is the plaintext completion and
|
||||
-- formatted_match is the match after being formatted/altered/processed by the registered postfunc.
|
||||
-- If no postfunc exists, then the formatted and raw matches are the same.
|
||||
local pms, pme, pmt, prematchStart, prematchEnd, text_prematch, entry
|
||||
local function fillMatches(this, desc, fallback)
|
||||
entry = registry[desc]
|
||||
-- See what frames are registered for this completion group. If the frame in which we pressed tab is one of them, then we start building matches.
|
||||
for _, f in ipairs(entry.listenframes) do
|
||||
if f == this then
|
||||
|
||||
-- Try each precondition string registered for this completion group.
|
||||
for _, prematch in ipairs(entry.prematches) do
|
||||
|
||||
-- Test if our prematch string is satisfied.
|
||||
-- If it is, then we find its last occurence prior to the cursor, calculate and store its pmoverwrite value (if applicable), and start considering completions.
|
||||
if fallback then prematch = "%s" end
|
||||
|
||||
-- Find the last occurence of the prematch before the cursor.
|
||||
pms, pme, pmt = nil, 1, ''
|
||||
text_prematch, prematchEnd, prematchStart = nil, nil, nil
|
||||
while true do
|
||||
pms, pme, pmt = strfind(text_precursor, "("..prematch..")", pme)
|
||||
if pms then
|
||||
prematchStart, prematchEnd, text_prematch = pms, pme, pmt
|
||||
pme = pme + 1
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not prematchStart and fallback then
|
||||
prematchStart, prematchEnd, text_prematch = 0, 0, ''
|
||||
end
|
||||
if prematchStart then
|
||||
-- text_pmendToCursor should be the sub-word/phrase to be completed.
|
||||
text_pmendToCursor = strsub(text_precursor, prematchEnd + 1)
|
||||
|
||||
-- How many characters should we eliminate before the completion before writing it in.
|
||||
pmolengths[desc] = entry.pmoverwrite == true and #text_prematch or entry.pmoverwrite or 0
|
||||
|
||||
-- This is where we will insert completions, taking the prematch overwrite into account.
|
||||
this.at3matchStart = prematchEnd + 1 - (pmolengths[desc] or 0)
|
||||
|
||||
-- We're either a non-fallback set or all completions thus far have been fallback sets, and the precondition matches.
|
||||
-- Create cands from the registered wordlist, filling it with all potential (unfiltered) completion strings.
|
||||
local wordlist = entry.wordlist
|
||||
local cands = type(wordlist) == 'table' and wordlist or {}
|
||||
if type(wordlist) == 'function' then
|
||||
wordlist(cands, text_all, prematchEnd + 1, text_pmendToCursor)
|
||||
end
|
||||
if cands ~= false then
|
||||
matches = this.at3matches[desc] or {}
|
||||
for i in pairs(matches) do matches[i] = nil end
|
||||
|
||||
-- Check each of the entries in cands to see if it completes the word before the cursor.
|
||||
-- Finally, increment our match count and set firstMatch, if appropriate.
|
||||
for _, m in ipairs(cands) do
|
||||
if strfind(strlower(m), strlower(text_pmendToCursor), 1, 1) == 1 then -- we have a matching completion!
|
||||
hasNonFallback = hasNonFallback or (not fallback)
|
||||
matches[m] = entry.postfunc and entry.postfunc(m, prematchEnd + 1, text_all) or m
|
||||
numMatches = numMatches + 1
|
||||
if numMatches == 1 then
|
||||
firstMatch = matches[m]
|
||||
firstPMLength = pmolengths[desc] or 0
|
||||
end
|
||||
end
|
||||
end
|
||||
this.at3matches[desc] = numMatches > 0 and matches or nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceTab:OnTabPressed(this)
|
||||
if this:GetText() == '' then return true end
|
||||
|
||||
-- allow Blizzard to handle slash commands, themselves
|
||||
if this == ChatEdit_GetActiveWindow() then
|
||||
local command = this:GetText()
|
||||
if strfind(command, "^/[%a%d_]+$") then
|
||||
return true
|
||||
end
|
||||
local cmd = strmatch(command, "^/[%a%d_]+")
|
||||
if cmd and IsSecureCmd(cmd) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
cursor = this:GetCursorPosition()
|
||||
|
||||
text_all = this:GetText()
|
||||
text_precursor = getTextBeforeCursor(this) or ''
|
||||
|
||||
-- If we've already found some matches and haven't done anything since the last tab press, then (continue) cycling matches.
|
||||
-- Otherwise, reset this frame's matches and proceed to creating our list of possible completions.
|
||||
this.at3lastMatch = this.at3curMatch > 0 and (this.at3lastMatch or this.at3origWord)
|
||||
-- Detects if we've made any edits since the last tab press. If not, continue cycling completions.
|
||||
if text_precursor == this.at3_last_precursor then
|
||||
return cycleTab(this)
|
||||
else
|
||||
for i in pairs(this.at3matches) do this.at3matches[i] = nil end
|
||||
this.at3curMatch = 0
|
||||
this.at3origWord = nil
|
||||
this.at3origMatch = nil
|
||||
this.at3lastWord = nil
|
||||
this.at3lastMatch = nil
|
||||
this.at3_last_precursor = text_precursor
|
||||
end
|
||||
|
||||
numMatches = 0
|
||||
firstMatch = nil
|
||||
firstPMLength = 0
|
||||
hasNonFallback = false
|
||||
for i in pairs(pmolengths) do pmolengths[i] = nil end
|
||||
|
||||
for desc in pairs(notfallbacks) do
|
||||
fillMatches(this, desc)
|
||||
end
|
||||
if not hasNonFallback then
|
||||
for desc in pairs(fallbacks) do
|
||||
fillMatches(this, desc, true)
|
||||
end
|
||||
end
|
||||
|
||||
if not firstMatch then
|
||||
this.at3_last_precursor = "\0"
|
||||
return true
|
||||
end
|
||||
|
||||
-- We want to replace the entire word with our completion, so highlight it up to the cursor.
|
||||
-- If only one match exists, then stick it in there and append a space.
|
||||
if numMatches == 1 then
|
||||
-- HighlightText takes the value AFTER which the highlighting starts, so we have to subtract 1 to have it start before the first character.
|
||||
this:HighlightText(this.at3matchStart-1, cursor)
|
||||
|
||||
this:Insert(firstMatch)
|
||||
this:Insert(" ")
|
||||
else
|
||||
-- Otherwise, we want to begin cycling through the valid completions.
|
||||
-- Beginning a cycle also causes the usage statement to be printed, if one exists.
|
||||
|
||||
-- Print usage statements for each possible completion (and gather up the GCBS of all matches while we're walking the tables).
|
||||
allGCBS = nil
|
||||
for desc, matches in pairs(this.at3matches) do
|
||||
-- Don't print usage statements for fallback completion groups if we have 'real' completion groups with matches.
|
||||
if hasNonFallback and fallbacks[desc] then break end
|
||||
|
||||
-- Use the group's description as a heading for its usage statements.
|
||||
DEFAULT_CHAT_FRAME:AddMessage(desc..":")
|
||||
|
||||
usagefunc = registry[desc].usagefunc
|
||||
if not usagefunc then
|
||||
-- No special usage processing; just print a list of the (formatted) matches.
|
||||
for m, fm in pairs(matches) do
|
||||
DEFAULT_CHAT_FRAME:AddMessage(fm)
|
||||
allGCBS = gcbs(allGCBS, m)
|
||||
end
|
||||
else
|
||||
-- Print a usage statement based on the corresponding registered usagefunc.
|
||||
-- candUsage is the table passed to usagefunc to be filled with candidate = usage_statement pairs.
|
||||
if type(usagefunc) == 'function' then
|
||||
for i in pairs(candUsage) do candUsage[i] = nil end
|
||||
|
||||
-- usagefunc takes the greatest common substring of valid matches as one of its args, so let's find that now.
|
||||
-- TODO: Make the GCBS function accept a vararg or table, after which we can just pass in the list of matches.
|
||||
setGCBS = nil
|
||||
for m in pairs(matches) do
|
||||
setGCBS = gcbs(setGCBS, m)
|
||||
end
|
||||
allGCBS = gcbs(allGCBS, setGCBS)
|
||||
usage = usagefunc(candUsage, matches, setGCBS, strsub(text_precursor, 1, prematchEnd))
|
||||
|
||||
-- If the usagefunc returns a string, then the entire usage statement has been taken care of by usagefunc, and we need only to print it...
|
||||
if type(usage) == 'string' then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(usage)
|
||||
|
||||
-- ...otherwise, it should have filled candUsage with candidate-usage statement pairs, and we need to print the matching ones.
|
||||
elseif next(candUsage) and numMatches > 0 then
|
||||
for m, fm in pairs(matches) do
|
||||
if candUsage[m] then DEFAULT_CHAT_FRAME:AddMessage(strformat("%s - %s", fm, candUsage[m])) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if next(matches) then
|
||||
-- Replace the original string with the greatest common substring of all valid completions.
|
||||
this.at3curMatch = 1
|
||||
this.at3origWord = strsub(text_precursor, this.at3matchStart, this.at3matchStart + pmolengths[desc] - 1) .. allGCBS or ""
|
||||
this.at3origMatch = allGCBS or ""
|
||||
this.at3lastWord = this.at3origWord
|
||||
this.at3lastMatch = this.at3origMatch
|
||||
|
||||
this:HighlightText(this.at3matchStart-1, cursor)
|
||||
this:Insert(this.at3origWord)
|
||||
this.at3_last_precursor = getTextBeforeCursor(this) or ''
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceTab-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,9 +1,9 @@
|
||||
## Interface: 80000
|
||||
## Title: Lib: LibDFramework-1.0
|
||||
## Notes: Base Framework for many Addons
|
||||
|
||||
#@no-lib-strip@
|
||||
embeds.xml
|
||||
#@end-no-lib-strip@
|
||||
|
||||
load.xml
|
||||
## Interface: 80000
|
||||
## Title: Lib: LibDFramework-1.0
|
||||
## Notes: Base Framework for many Addons
|
||||
|
||||
#@no-lib-strip@
|
||||
embeds.xml
|
||||
#@end-no-lib-strip@
|
||||
|
||||
load.xml
|
||||
|
||||
+62
-62
@@ -1,62 +1,62 @@
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
local _
|
||||
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
function DF:CreateAddOn (name, global_saved, global_table, options_table, broker)
|
||||
|
||||
local addon = LibStub ("AceAddon-3.0"):NewAddon (name, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "DetailsFramework-1.0", "AceComm-3.0")
|
||||
_G [name] = addon
|
||||
addon.__name = name
|
||||
|
||||
function addon:OnInitialize()
|
||||
|
||||
if (global_saved) then
|
||||
if (broker and broker.Minimap and not global_table.Minimap) then
|
||||
DF:Msg (name, "broker.Minimap is true but no global.Minimap declared.")
|
||||
end
|
||||
self.db = LibStub ("AceDB-3.0"):New (global_saved, global_table or {}, true)
|
||||
end
|
||||
|
||||
if (options_table) then
|
||||
LibStub ("AceConfig-3.0"):RegisterOptionsTable (name, options_table)
|
||||
addon.OptionsFrame1 = LibStub ("AceConfigDialog-3.0"):AddToBlizOptions (name, name)
|
||||
|
||||
LibStub ("AceConfig-3.0"):RegisterOptionsTable (name .. "-Profiles", LibStub ("AceDBOptions-3.0"):GetOptionsTable (self.db))
|
||||
addon.OptionsFrame2 = LibStub ("AceConfigDialog-3.0"):AddToBlizOptions (name .. "-Profiles", "Profiles", name)
|
||||
end
|
||||
|
||||
if (broker) then
|
||||
local broker_click_function = broker.OnClick
|
||||
if (not broker_click_function and options_table) then
|
||||
broker_click_function = function()
|
||||
InterfaceOptionsFrame_OpenToCategory (name)
|
||||
InterfaceOptionsFrame_OpenToCategory (name)
|
||||
end
|
||||
end
|
||||
|
||||
local databroker = LibStub ("LibDataBroker-1.1"):NewDataObject (name, {
|
||||
type = broker.type or "launcher",
|
||||
icon = broker.icon or [[Interface\PvPRankBadges\PvPRank15]],
|
||||
text = broker.text or "",
|
||||
OnTooltipShow = broker.OnTooltipShow,
|
||||
OnClick = broker_click_function
|
||||
})
|
||||
|
||||
if (databroker and broker.Minimap and global_table.Minimap) then
|
||||
LibStub ("LibDBIcon-1.0"):Register (name, databroker, addon.db.profile.Minimap)
|
||||
end
|
||||
end
|
||||
|
||||
if (addon.OnInit) then
|
||||
xpcall (addon.OnInit, geterrorhandler(), addon)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return addon
|
||||
|
||||
end
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
local _
|
||||
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
function DF:CreateAddOn (name, global_saved, global_table, options_table, broker)
|
||||
|
||||
local addon = LibStub ("AceAddon-3.0"):NewAddon (name, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "DetailsFramework-1.0", "AceComm-3.0")
|
||||
_G [name] = addon
|
||||
addon.__name = name
|
||||
|
||||
function addon:OnInitialize()
|
||||
|
||||
if (global_saved) then
|
||||
if (broker and broker.Minimap and not global_table.Minimap) then
|
||||
DF:Msg (name, "broker.Minimap is true but no global.Minimap declared.")
|
||||
end
|
||||
self.db = LibStub ("AceDB-3.0"):New (global_saved, global_table or {}, true)
|
||||
end
|
||||
|
||||
if (options_table) then
|
||||
LibStub ("AceConfig-3.0"):RegisterOptionsTable (name, options_table)
|
||||
addon.OptionsFrame1 = LibStub ("AceConfigDialog-3.0"):AddToBlizOptions (name, name)
|
||||
|
||||
LibStub ("AceConfig-3.0"):RegisterOptionsTable (name .. "-Profiles", LibStub ("AceDBOptions-3.0"):GetOptionsTable (self.db))
|
||||
addon.OptionsFrame2 = LibStub ("AceConfigDialog-3.0"):AddToBlizOptions (name .. "-Profiles", "Profiles", name)
|
||||
end
|
||||
|
||||
if (broker) then
|
||||
local broker_click_function = broker.OnClick
|
||||
if (not broker_click_function and options_table) then
|
||||
broker_click_function = function()
|
||||
InterfaceOptionsFrame_OpenToCategory (name)
|
||||
InterfaceOptionsFrame_OpenToCategory (name)
|
||||
end
|
||||
end
|
||||
|
||||
local databroker = LibStub ("LibDataBroker-1.1"):NewDataObject (name, {
|
||||
type = broker.type or "launcher",
|
||||
icon = broker.icon or [[Interface\PvPRankBadges\PvPRank15]],
|
||||
text = broker.text or "",
|
||||
OnTooltipShow = broker.OnTooltipShow,
|
||||
OnClick = broker_click_function
|
||||
})
|
||||
|
||||
if (databroker and broker.Minimap and global_table.Minimap) then
|
||||
LibStub ("LibDBIcon-1.0"):Register (name, databroker, addon.db.profile.Minimap)
|
||||
end
|
||||
end
|
||||
|
||||
if (addon.OnInit) then
|
||||
xpcall (addon.OnInit, geterrorhandler(), addon)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return addon
|
||||
|
||||
end
|
||||
|
||||
+12
-12
@@ -50,7 +50,7 @@ function DF:LoadAllSpells (hashMap, indexTable, allSpellsSameName)
|
||||
--pre checking which tables to fill to avoid checking if the table exists during the gigantic loop for performance
|
||||
|
||||
if (not DF.LoadingAuraAlertFrame) then
|
||||
DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent)
|
||||
DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent, "BackdropTemplate")
|
||||
DF.LoadingAuraAlertFrame:SetSize (340, 75)
|
||||
DF.LoadingAuraAlertFrame:SetPoint ("center")
|
||||
DF.LoadingAuraAlertFrame:SetFrameStrata ("TOOLTIP")
|
||||
@@ -137,7 +137,7 @@ do
|
||||
--check if there's a metaPrototype already existing
|
||||
if (_G[DF.GlobalWidgetControlNames["aura_tracker"]]) then
|
||||
--get the already existing metaPrototype
|
||||
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["aura_tracker"]]
|
||||
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["aura_tracker"]]
|
||||
--check if is older
|
||||
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
|
||||
--the version is older them the currently loading one
|
||||
@@ -148,11 +148,11 @@ do
|
||||
end
|
||||
else
|
||||
--first time loading the framework
|
||||
_G[DF.GlobalWidgetControlNames ["aura_tracker"]] = metaPrototype
|
||||
_G[DF.GlobalWidgetControlNames["aura_tracker"]] = metaPrototype
|
||||
end
|
||||
end
|
||||
|
||||
local AuraTrackerMetaFunctions = _G[DF.GlobalWidgetControlNames ["aura_tracker"]]
|
||||
local AuraTrackerMetaFunctions = _G[DF.GlobalWidgetControlNames["aura_tracker"]]
|
||||
|
||||
--create panels
|
||||
local on_profile_changed = function (self, newdb)
|
||||
@@ -210,15 +210,15 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
|
||||
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
|
||||
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
|
||||
|
||||
local f = CreateFrame ("frame", name, parent)
|
||||
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
f.db = db
|
||||
f.OnProfileChanged = on_profile_changed
|
||||
f.LocTexts = texts
|
||||
options = options or {}
|
||||
self.table.deploy (options, aura_panel_defaultoptions)
|
||||
|
||||
local f_auto = CreateFrame ("frame", "$parent_Automatic", f)
|
||||
local f_manual = CreateFrame ("frame", "$parent_Manual", f)
|
||||
local f_auto = CreateFrame ("frame", "$parent_Automatic", f, "BackdropTemplate")
|
||||
local f_manual = CreateFrame ("frame", "$parent_Manual", f, "BackdropTemplate")
|
||||
f_auto:SetPoint ("topleft", f, "topleft", 0, -24)
|
||||
f_manual:SetPoint ("topleft", f, "topleft", 0, -24)
|
||||
f_auto:SetSize (600, 600)
|
||||
@@ -256,7 +256,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
|
||||
end
|
||||
end
|
||||
|
||||
local background_method_selection = CreateFrame ("frame", nil, f)
|
||||
local background_method_selection = CreateFrame ("frame", nil, f, "BackdropTemplate")
|
||||
background_method_selection:SetHeight (82)
|
||||
background_method_selection:SetPoint ("topleft", f, "topleft", 0, 0)
|
||||
background_method_selection:SetPoint ("topright", f, "topright", 0, 0)
|
||||
@@ -342,12 +342,12 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
|
||||
local textEntryWidth = 120
|
||||
|
||||
--create the background
|
||||
local background_add_blacklist = CreateFrame ("frame", nil, f_auto)
|
||||
local background_add_blacklist = CreateFrame ("frame", nil, f_auto, "BackdropTemplate")
|
||||
background_add_blacklist:SetSize (textEntryWidth + 10, 135)
|
||||
DF:ApplyStandardBackdrop (background_add_blacklist)
|
||||
background_add_blacklist.__background:SetVertexColor (0.47, 0.27, 0.27)
|
||||
|
||||
local background_add_tracklist = CreateFrame ("frame", nil, f_auto)
|
||||
local background_add_tracklist = CreateFrame ("frame", nil, f_auto, "BackdropTemplate")
|
||||
background_add_tracklist:SetSize (textEntryWidth + 10, 135)
|
||||
DF:ApplyStandardBackdrop (background_add_tracklist)
|
||||
background_add_tracklist.__background:SetVertexColor (0.27, 0.27, 0.47)
|
||||
@@ -651,7 +651,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
|
||||
end
|
||||
|
||||
local createLineFunc = function (self, index)
|
||||
local line = CreateFrame ("button", "$parentLine" .. index, self)
|
||||
local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate")
|
||||
line:SetPoint ("topleft", self, "topleft", 1, - ((index - 1) * (lineHeight + 1)) - 1)
|
||||
line:SetSize (scrollWidth - 2, lineHeight)
|
||||
line:SetScript ("OnEnter", autoTrackList_LineOnEnter)
|
||||
@@ -815,7 +815,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t
|
||||
end
|
||||
|
||||
local scroll_createline = function (self, index)
|
||||
local line = CreateFrame ("button", "$parentLine" .. index, self)
|
||||
local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate")
|
||||
line:SetPoint ("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1)
|
||||
line:SetSize (scroll_width - 2, scroll_line_height)
|
||||
line:SetScript ("OnEnter", line_onenter)
|
||||
|
||||
+13
-1
@@ -429,6 +429,18 @@ local ButtonMetaFunctions = _G[DF.GlobalWidgetControlNames ["button"]]
|
||||
return self.icon:GetTexture()
|
||||
end
|
||||
end
|
||||
|
||||
function ButtonMetaFunctions:SetBackdrop(...)
|
||||
return self.button:SetBackdrop(...)
|
||||
end
|
||||
|
||||
function ButtonMetaFunctions:SetBackdropColor(...)
|
||||
return self.button:SetBackdropColor(...)
|
||||
end
|
||||
|
||||
function ButtonMetaFunctions:SetBackdropBorderColor(...)
|
||||
return self.button:SetBackdropBorderColor(...)
|
||||
end
|
||||
|
||||
function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight, short_method)
|
||||
if (not self.icon) then
|
||||
@@ -1053,7 +1065,7 @@ function DF:NewButton (parent, container, name, member, w, h, func, param1, para
|
||||
ButtonObject.container = container
|
||||
ButtonObject.options = {OnGrab = false}
|
||||
|
||||
ButtonObject.button = CreateFrame ("button", name, parent)
|
||||
ButtonObject.button = CreateFrame ("button", name, parent,"BackdropTemplate")
|
||||
DF:Mixin (ButtonObject.button, DF.WidgetFunctions)
|
||||
|
||||
build_button (ButtonObject.button)
|
||||
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="button.lua"/>
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="button.lua"/>
|
||||
</Ui>
|
||||
|
||||
+178
-178
@@ -1,178 +1,178 @@
|
||||
do
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
DF.alias_text_colors = DF.alias_text_colors or {}
|
||||
|
||||
local defaultColors = {
|
||||
["HUNTER"] = {0.67, 0.83, 0.45},
|
||||
["WARLOCK"] = {0.58, 0.51, 0.79},
|
||||
["PRIEST"] = {1.0, 1.0, 1.0},
|
||||
["PALADIN"] = {0.96, 0.55, 0.73},
|
||||
["MAGE"] = {0.41, 0.8, 0.94},
|
||||
["ROGUE"] = {1.0, 0.96, 0.41},
|
||||
["DRUID"] = {1.0, 0.49, 0.04},
|
||||
["SHAMAN"] = {0.0, 0.44, 0.87},
|
||||
["WARRIOR"] = {0.78, 0.61, 0.43},
|
||||
["DEATHKNIGHT"] = {0.77, 0.12, 0.23},
|
||||
["MONK"] = {0.0, 1.00, 0.59},
|
||||
["DEMONHUNTER"] = {0.64, 0.19, 0.79},
|
||||
|
||||
["aliceblue"] = {0.941176, 0.972549, 1, 1},
|
||||
["antiquewhite"] = {0.980392, 0.921569, 0.843137, 1},
|
||||
["aqua"] = {0, 1, 1, 1},
|
||||
["aquamarine"] = {0.498039, 1, 0.831373, 1},
|
||||
["azure"] = {0.941176, 1, 1, 1},
|
||||
["beige"] = {0.960784, 0.960784, 0.862745, 1},
|
||||
["bisque"] = {1, 0.894118, 0.768627, 1},
|
||||
["black"] = {0, 0, 0, 1},
|
||||
["blanchedalmond"] = {1, 0.921569, 0.803922, 1},
|
||||
["blue"] = {0, 0, 1, 1},
|
||||
["blueviolet"] = {0.541176, 0.168627, 0.886275, 1},
|
||||
["brown"] = {0.647059, 0.164706, 0.164706, 1},
|
||||
["burlywood"] = {0.870588, 0.721569, 0.529412, 1},
|
||||
["cadetblue"] = {0.372549, 0.619608, 0.627451, 1},
|
||||
["chartreuse"] = {0.498039, 1, 0, 1},
|
||||
["chocolate"] = {0.823529, 0.411765, 0.117647, 1},
|
||||
["coral"] = {1, 0.498039, 0.313725, 1},
|
||||
["cornflowerblue"] = {0.392157, 0.584314, 0.929412, 1},
|
||||
["cornsilk"] = {1, 0.972549, 0.862745, 1},
|
||||
["crimson"] = {0.862745, 0.0784314, 0.235294, 1},
|
||||
["cyan"] = {0, 1, 1, 1},
|
||||
["darkblue"] = {0, 0, 0.545098, 1},
|
||||
["darkcyan"] = {0, 0.545098, 0.545098, 1},
|
||||
["darkgoldenrod"] = {0.721569, 0.52549, 0.0431373, 1},
|
||||
["darkgray"] = {0.662745, 0.662745, 0.662745, 1},
|
||||
["darkgreen"] = {0, 0.392157, 0, 1},
|
||||
["darkkhaki"] = {0.741176, 0.717647, 0.419608, 1},
|
||||
["darkmagenta"] = {0.545098, 0, 0.545098, 1},
|
||||
["darkolivegreen"] = {0.333333, 0.419608, 0.184314, 1},
|
||||
["darkorange"] = {1, 0.54902, 0, 1},
|
||||
["darkorchid"] = {0.6, 0.196078, 0.8, 1},
|
||||
["darkred"] = {0.545098, 0, 0, 1},
|
||||
["darksalmon"] = {0.913725, 0.588235, 0.478431, 1},
|
||||
["darkseagreen"] = {0.560784, 0.737255, 0.560784, 1},
|
||||
["darkslateblue"] = {0.282353, 0.239216, 0.545098, 1},
|
||||
["darkslategray"] = {0.184314, 0.309804, 0.309804, 1},
|
||||
["darkturquoise"] = {0, 0.807843, 0.819608, 1},
|
||||
["darkviolet"] = {0.580392, 0, 0.827451, 1},
|
||||
["deeppink"] = {1, 0.0784314, 0.576471, 1},
|
||||
["deepskyblue"] = {0, 0.74902, 1, 1},
|
||||
["dimgray"] = {0.411765, 0.411765, 0.411765, 1},
|
||||
["dimgrey"] = {0.411765, 0.411765, 0.411765, 1},
|
||||
["dodgerblue"] = {0.117647, 0.564706, 1, 1},
|
||||
["firebrick"] = {0.698039, 0.133333, 0.133333, 1},
|
||||
["floralwhite"] = {1, 0.980392, 0.941176, 1},
|
||||
["forestgreen"] = {0.133333, 0.545098, 0.133333, 1},
|
||||
["fuchsia"] = {1, 0, 1, 1},
|
||||
["gainsboro"] = {0.862745, 0.862745, 0.862745, 1},
|
||||
["ghostwhite"] = {0.972549, 0.972549, 1, 1},
|
||||
["gold"] = {1, 0.843137, 0, 1},
|
||||
["goldenrod"] = {0.854902, 0.647059, 0.12549, 1},
|
||||
["gray"] = {0.501961, 0.501961, 0.501961, 1},
|
||||
["green"] = {0, 0.501961, 0, 1},
|
||||
["greenyellow"] = {0.678431, 1, 0.184314, 1},
|
||||
["honeydew"] = {0.941176, 1, 0.941176, 1},
|
||||
["hotpink"] = {1, 0.411765, 0.705882, 1},
|
||||
["indianred"] = {0.803922, 0.360784, 0.360784, 1},
|
||||
["indigo"] = {0.294118, 0, 0.509804, 1},
|
||||
["ivory"] = {1, 1, 0.941176, 1},
|
||||
["khaki"] = {0.941176, 0.901961, 0.54902, 1},
|
||||
["lavender"] = {0.901961, 0.901961, 0.980392, 1},
|
||||
["lavenderblush"] = {1, 0.941176, 0.960784, 1},
|
||||
["lawngreen"] = {0.486275, 0.988235, 0, 1},
|
||||
["lemonchiffon"] = {1, 0.980392, 0.803922, 1},
|
||||
["lightblue"] = {0.678431, 0.847059, 0.901961, 1},
|
||||
["lightcoral"] = {0.941176, 0.501961, 0.501961, 1},
|
||||
["lightcyan"] = {0.878431, 1, 1, 1},
|
||||
["lightgoldenrodyellow"] = {0.980392, 0.980392, 0.823529, 1},
|
||||
["lightgray"] = {0.827451, 0.827451, 0.827451, 1},
|
||||
["lightgreen"] = {0.564706, 0.933333, 0.564706, 1},
|
||||
["lightpink"] = {1, 0.713725, 0.756863, 1},
|
||||
["lightsalmon"] = {1, 0.627451, 0.478431, 1},
|
||||
["lightseagreen"] = {0.12549, 0.698039, 0.666667, 1},
|
||||
["lightskyblue"] = {0.529412, 0.807843, 0.980392, 1},
|
||||
["lightslategray"] = {0.466667, 0.533333, 0.6, 1},
|
||||
["lightsteelblue"] = {0.690196, 0.768627, 0.870588, 1},
|
||||
["lightyellow"] = {1, 1, 0.878431, 1},
|
||||
["lime"] = {0, 1, 0, 1},
|
||||
["limegreen"] = {0.196078, 0.803922, 0.196078, 1},
|
||||
["linen"] = {0.980392, 0.941176, 0.901961, 1},
|
||||
["magenta"] = {1, 0, 1, 1},
|
||||
["maroon"] = {0.501961, 0, 0, 1},
|
||||
["mediumaquamarine"] = {0.4, 0.803922, 0.666667, 1},
|
||||
["mediumblue"] = {0, 0, 0.803922, 1},
|
||||
["mediumorchid"] = {0.729412, 0.333333, 0.827451, 1},
|
||||
["mediumpurple"] = {0.576471, 0.439216, 0.858824, 1},
|
||||
["mediumseagreen"] = {0.235294, 0.701961, 0.443137, 1},
|
||||
["mediumslateblue"] = {0.482353, 0.407843, 0.933333, 1},
|
||||
["mediumspringgreen"] = {0, 0.980392, 0.603922, 1},
|
||||
["mediumturquoise"] = {0.282353, 0.819608, 0.8, 1},
|
||||
["mediumvioletred"] = {0.780392, 0.0823529, 0.521569, 1},
|
||||
["midnightblue"] = {0.0980392, 0.0980392, 0.439216, 1},
|
||||
["mintcream"] = {0.960784, 1, 0.980392, 1},
|
||||
["mistyrose"] = {1, 0.894118, 0.882353, 1},
|
||||
["moccasin"] = {1, 0.894118, 0.709804, 1},
|
||||
["navajowhite"] = {1, 0.870588, 0.678431, 1},
|
||||
["navy"] = {0, 0, 0.501961, 1},
|
||||
["none"] ={0, 0, 0, 0},
|
||||
["oldlace"] = {0.992157, 0.960784, 0.901961, 1},
|
||||
["olive"] = {0.501961, 0.501961, 0, 1},
|
||||
["olivedrab"] = {0.419608, 0.556863, 0.137255, 1},
|
||||
["orange"] = {1, 0.647059, 0, 1},
|
||||
["orangered"] = {1, 0.270588, 0, 1},
|
||||
["orchid"] = {0.854902, 0.439216, 0.839216, 1},
|
||||
["palegoldenrod"] = {0.933333, 0.909804, 0.666667, 1},
|
||||
["palegreen"] = {0.596078, 0.984314, 0.596078, 1},
|
||||
["paleturquoise"] = {0.686275, 0.933333, 0.933333, 1},
|
||||
["palevioletred"] = {0.858824, 0.439216, 0.576471, 1},
|
||||
["papayawhip"] = {1, 0.937255, 0.835294, 1},
|
||||
["peachpuff"] = {1, 0.854902, 0.72549, 1},
|
||||
["peru"] = {0.803922, 0.521569, 0.247059, 1},
|
||||
["pink"] = {1, 0.752941, 0.796078, 1},
|
||||
["plum"] = {0.866667, 0.627451, 0.866667, 1},
|
||||
["powderblue"] = {0.690196, 0.878431, 0.901961, 1},
|
||||
["purple"] = {0.501961, 0, 0.501961, 1},
|
||||
["red"] = {1, 0, 0, 1},
|
||||
["rosybrown"] = {0.737255, 0.560784, 0.560784, 1},
|
||||
["royalblue"] = {0.254902, 0.411765, 0.882353, 1},
|
||||
["saddlebrown"] = {0.545098, 0.270588, 0.0745098, 1},
|
||||
["salmon"] = {0.980392, 0.501961, 0.447059, 1},
|
||||
["sandybrown"] = {0.956863, 0.643137, 0.376471, 1},
|
||||
["seagreen"] = {0.180392, 0.545098, 0.341176, 1},
|
||||
["seashell"] = {1, 0.960784, 0.933333, 1},
|
||||
["sienna"] = {0.627451, 0.321569, 0.176471, 1},
|
||||
["silver"] = {0.752941, 0.752941, 0.752941, 1},
|
||||
["skyblue"] = {0.529412, 0.807843, 0.921569, 1},
|
||||
["slateblue"] = {0.415686, 0.352941, 0.803922, 1},
|
||||
["slategray"] = {0.439216, 0.501961, 0.564706, 1},
|
||||
["snow"] = {1, 0.980392, 0.980392, 1},
|
||||
["springgreen"] = {0, 1, 0.498039, 1},
|
||||
["steelblue"] = {0.27451, 0.509804, 0.705882, 1},
|
||||
["tan"] = {0.823529, 0.705882, 0.54902, 1},
|
||||
["teal"] = {0, 0.501961, 0.501961, 1},
|
||||
["thistle"] = {0.847059, 0.74902, 0.847059, 1},
|
||||
["tomato"] = {1, 0.388235, 0.278431, 1},
|
||||
["transparent"] ={0, 0, 0, 0},
|
||||
["turquoise"] = {0.25098, 0.878431, 0.815686, 1},
|
||||
["violet"] = {0.933333, 0.509804, 0.933333, 1},
|
||||
["wheat"] = {0.960784, 0.870588, 0.701961, 1},
|
||||
["white"] = {1, 1, 1, 1},
|
||||
["whitesmoke"] = {0.960784, 0.960784, 0.960784, 1},
|
||||
["yellow"] = {1, 1, 0, 1},
|
||||
["yellowgreen"] = {0.603922, 0.803922, 0.196078, 1}
|
||||
}
|
||||
|
||||
function DF:GetDefaultColorList()
|
||||
return defaultColors
|
||||
end
|
||||
|
||||
for colorName, colorTable in pairs (defaultColors) do
|
||||
DF.alias_text_colors [colorName] = colorTable
|
||||
end
|
||||
|
||||
end
|
||||
do
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
DF.alias_text_colors = DF.alias_text_colors or {}
|
||||
|
||||
local defaultColors = {
|
||||
["HUNTER"] = {0.67, 0.83, 0.45},
|
||||
["WARLOCK"] = {0.58, 0.51, 0.79},
|
||||
["PRIEST"] = {1.0, 1.0, 1.0},
|
||||
["PALADIN"] = {0.96, 0.55, 0.73},
|
||||
["MAGE"] = {0.41, 0.8, 0.94},
|
||||
["ROGUE"] = {1.0, 0.96, 0.41},
|
||||
["DRUID"] = {1.0, 0.49, 0.04},
|
||||
["SHAMAN"] = {0.0, 0.44, 0.87},
|
||||
["WARRIOR"] = {0.78, 0.61, 0.43},
|
||||
["DEATHKNIGHT"] = {0.77, 0.12, 0.23},
|
||||
["MONK"] = {0.0, 1.00, 0.59},
|
||||
["DEMONHUNTER"] = {0.64, 0.19, 0.79},
|
||||
|
||||
["aliceblue"] = {0.941176, 0.972549, 1, 1},
|
||||
["antiquewhite"] = {0.980392, 0.921569, 0.843137, 1},
|
||||
["aqua"] = {0, 1, 1, 1},
|
||||
["aquamarine"] = {0.498039, 1, 0.831373, 1},
|
||||
["azure"] = {0.941176, 1, 1, 1},
|
||||
["beige"] = {0.960784, 0.960784, 0.862745, 1},
|
||||
["bisque"] = {1, 0.894118, 0.768627, 1},
|
||||
["black"] = {0, 0, 0, 1},
|
||||
["blanchedalmond"] = {1, 0.921569, 0.803922, 1},
|
||||
["blue"] = {0, 0, 1, 1},
|
||||
["blueviolet"] = {0.541176, 0.168627, 0.886275, 1},
|
||||
["brown"] = {0.647059, 0.164706, 0.164706, 1},
|
||||
["burlywood"] = {0.870588, 0.721569, 0.529412, 1},
|
||||
["cadetblue"] = {0.372549, 0.619608, 0.627451, 1},
|
||||
["chartreuse"] = {0.498039, 1, 0, 1},
|
||||
["chocolate"] = {0.823529, 0.411765, 0.117647, 1},
|
||||
["coral"] = {1, 0.498039, 0.313725, 1},
|
||||
["cornflowerblue"] = {0.392157, 0.584314, 0.929412, 1},
|
||||
["cornsilk"] = {1, 0.972549, 0.862745, 1},
|
||||
["crimson"] = {0.862745, 0.0784314, 0.235294, 1},
|
||||
["cyan"] = {0, 1, 1, 1},
|
||||
["darkblue"] = {0, 0, 0.545098, 1},
|
||||
["darkcyan"] = {0, 0.545098, 0.545098, 1},
|
||||
["darkgoldenrod"] = {0.721569, 0.52549, 0.0431373, 1},
|
||||
["darkgray"] = {0.662745, 0.662745, 0.662745, 1},
|
||||
["darkgreen"] = {0, 0.392157, 0, 1},
|
||||
["darkkhaki"] = {0.741176, 0.717647, 0.419608, 1},
|
||||
["darkmagenta"] = {0.545098, 0, 0.545098, 1},
|
||||
["darkolivegreen"] = {0.333333, 0.419608, 0.184314, 1},
|
||||
["darkorange"] = {1, 0.54902, 0, 1},
|
||||
["darkorchid"] = {0.6, 0.196078, 0.8, 1},
|
||||
["darkred"] = {0.545098, 0, 0, 1},
|
||||
["darksalmon"] = {0.913725, 0.588235, 0.478431, 1},
|
||||
["darkseagreen"] = {0.560784, 0.737255, 0.560784, 1},
|
||||
["darkslateblue"] = {0.282353, 0.239216, 0.545098, 1},
|
||||
["darkslategray"] = {0.184314, 0.309804, 0.309804, 1},
|
||||
["darkturquoise"] = {0, 0.807843, 0.819608, 1},
|
||||
["darkviolet"] = {0.580392, 0, 0.827451, 1},
|
||||
["deeppink"] = {1, 0.0784314, 0.576471, 1},
|
||||
["deepskyblue"] = {0, 0.74902, 1, 1},
|
||||
["dimgray"] = {0.411765, 0.411765, 0.411765, 1},
|
||||
["dimgrey"] = {0.411765, 0.411765, 0.411765, 1},
|
||||
["dodgerblue"] = {0.117647, 0.564706, 1, 1},
|
||||
["firebrick"] = {0.698039, 0.133333, 0.133333, 1},
|
||||
["floralwhite"] = {1, 0.980392, 0.941176, 1},
|
||||
["forestgreen"] = {0.133333, 0.545098, 0.133333, 1},
|
||||
["fuchsia"] = {1, 0, 1, 1},
|
||||
["gainsboro"] = {0.862745, 0.862745, 0.862745, 1},
|
||||
["ghostwhite"] = {0.972549, 0.972549, 1, 1},
|
||||
["gold"] = {1, 0.843137, 0, 1},
|
||||
["goldenrod"] = {0.854902, 0.647059, 0.12549, 1},
|
||||
["gray"] = {0.501961, 0.501961, 0.501961, 1},
|
||||
["green"] = {0, 0.501961, 0, 1},
|
||||
["greenyellow"] = {0.678431, 1, 0.184314, 1},
|
||||
["honeydew"] = {0.941176, 1, 0.941176, 1},
|
||||
["hotpink"] = {1, 0.411765, 0.705882, 1},
|
||||
["indianred"] = {0.803922, 0.360784, 0.360784, 1},
|
||||
["indigo"] = {0.294118, 0, 0.509804, 1},
|
||||
["ivory"] = {1, 1, 0.941176, 1},
|
||||
["khaki"] = {0.941176, 0.901961, 0.54902, 1},
|
||||
["lavender"] = {0.901961, 0.901961, 0.980392, 1},
|
||||
["lavenderblush"] = {1, 0.941176, 0.960784, 1},
|
||||
["lawngreen"] = {0.486275, 0.988235, 0, 1},
|
||||
["lemonchiffon"] = {1, 0.980392, 0.803922, 1},
|
||||
["lightblue"] = {0.678431, 0.847059, 0.901961, 1},
|
||||
["lightcoral"] = {0.941176, 0.501961, 0.501961, 1},
|
||||
["lightcyan"] = {0.878431, 1, 1, 1},
|
||||
["lightgoldenrodyellow"] = {0.980392, 0.980392, 0.823529, 1},
|
||||
["lightgray"] = {0.827451, 0.827451, 0.827451, 1},
|
||||
["lightgreen"] = {0.564706, 0.933333, 0.564706, 1},
|
||||
["lightpink"] = {1, 0.713725, 0.756863, 1},
|
||||
["lightsalmon"] = {1, 0.627451, 0.478431, 1},
|
||||
["lightseagreen"] = {0.12549, 0.698039, 0.666667, 1},
|
||||
["lightskyblue"] = {0.529412, 0.807843, 0.980392, 1},
|
||||
["lightslategray"] = {0.466667, 0.533333, 0.6, 1},
|
||||
["lightsteelblue"] = {0.690196, 0.768627, 0.870588, 1},
|
||||
["lightyellow"] = {1, 1, 0.878431, 1},
|
||||
["lime"] = {0, 1, 0, 1},
|
||||
["limegreen"] = {0.196078, 0.803922, 0.196078, 1},
|
||||
["linen"] = {0.980392, 0.941176, 0.901961, 1},
|
||||
["magenta"] = {1, 0, 1, 1},
|
||||
["maroon"] = {0.501961, 0, 0, 1},
|
||||
["mediumaquamarine"] = {0.4, 0.803922, 0.666667, 1},
|
||||
["mediumblue"] = {0, 0, 0.803922, 1},
|
||||
["mediumorchid"] = {0.729412, 0.333333, 0.827451, 1},
|
||||
["mediumpurple"] = {0.576471, 0.439216, 0.858824, 1},
|
||||
["mediumseagreen"] = {0.235294, 0.701961, 0.443137, 1},
|
||||
["mediumslateblue"] = {0.482353, 0.407843, 0.933333, 1},
|
||||
["mediumspringgreen"] = {0, 0.980392, 0.603922, 1},
|
||||
["mediumturquoise"] = {0.282353, 0.819608, 0.8, 1},
|
||||
["mediumvioletred"] = {0.780392, 0.0823529, 0.521569, 1},
|
||||
["midnightblue"] = {0.0980392, 0.0980392, 0.439216, 1},
|
||||
["mintcream"] = {0.960784, 1, 0.980392, 1},
|
||||
["mistyrose"] = {1, 0.894118, 0.882353, 1},
|
||||
["moccasin"] = {1, 0.894118, 0.709804, 1},
|
||||
["navajowhite"] = {1, 0.870588, 0.678431, 1},
|
||||
["navy"] = {0, 0, 0.501961, 1},
|
||||
["none"] ={0, 0, 0, 0},
|
||||
["oldlace"] = {0.992157, 0.960784, 0.901961, 1},
|
||||
["olive"] = {0.501961, 0.501961, 0, 1},
|
||||
["olivedrab"] = {0.419608, 0.556863, 0.137255, 1},
|
||||
["orange"] = {1, 0.647059, 0, 1},
|
||||
["orangered"] = {1, 0.270588, 0, 1},
|
||||
["orchid"] = {0.854902, 0.439216, 0.839216, 1},
|
||||
["palegoldenrod"] = {0.933333, 0.909804, 0.666667, 1},
|
||||
["palegreen"] = {0.596078, 0.984314, 0.596078, 1},
|
||||
["paleturquoise"] = {0.686275, 0.933333, 0.933333, 1},
|
||||
["palevioletred"] = {0.858824, 0.439216, 0.576471, 1},
|
||||
["papayawhip"] = {1, 0.937255, 0.835294, 1},
|
||||
["peachpuff"] = {1, 0.854902, 0.72549, 1},
|
||||
["peru"] = {0.803922, 0.521569, 0.247059, 1},
|
||||
["pink"] = {1, 0.752941, 0.796078, 1},
|
||||
["plum"] = {0.866667, 0.627451, 0.866667, 1},
|
||||
["powderblue"] = {0.690196, 0.878431, 0.901961, 1},
|
||||
["purple"] = {0.501961, 0, 0.501961, 1},
|
||||
["red"] = {1, 0, 0, 1},
|
||||
["rosybrown"] = {0.737255, 0.560784, 0.560784, 1},
|
||||
["royalblue"] = {0.254902, 0.411765, 0.882353, 1},
|
||||
["saddlebrown"] = {0.545098, 0.270588, 0.0745098, 1},
|
||||
["salmon"] = {0.980392, 0.501961, 0.447059, 1},
|
||||
["sandybrown"] = {0.956863, 0.643137, 0.376471, 1},
|
||||
["seagreen"] = {0.180392, 0.545098, 0.341176, 1},
|
||||
["seashell"] = {1, 0.960784, 0.933333, 1},
|
||||
["sienna"] = {0.627451, 0.321569, 0.176471, 1},
|
||||
["silver"] = {0.752941, 0.752941, 0.752941, 1},
|
||||
["skyblue"] = {0.529412, 0.807843, 0.921569, 1},
|
||||
["slateblue"] = {0.415686, 0.352941, 0.803922, 1},
|
||||
["slategray"] = {0.439216, 0.501961, 0.564706, 1},
|
||||
["snow"] = {1, 0.980392, 0.980392, 1},
|
||||
["springgreen"] = {0, 1, 0.498039, 1},
|
||||
["steelblue"] = {0.27451, 0.509804, 0.705882, 1},
|
||||
["tan"] = {0.823529, 0.705882, 0.54902, 1},
|
||||
["teal"] = {0, 0.501961, 0.501961, 1},
|
||||
["thistle"] = {0.847059, 0.74902, 0.847059, 1},
|
||||
["tomato"] = {1, 0.388235, 0.278431, 1},
|
||||
["transparent"] ={0, 0, 0, 0},
|
||||
["turquoise"] = {0.25098, 0.878431, 0.815686, 1},
|
||||
["violet"] = {0.933333, 0.509804, 0.933333, 1},
|
||||
["wheat"] = {0.960784, 0.870588, 0.701961, 1},
|
||||
["white"] = {1, 1, 1, 1},
|
||||
["whitesmoke"] = {0.960784, 0.960784, 0.960784, 1},
|
||||
["yellow"] = {1, 1, 0, 1},
|
||||
["yellowgreen"] = {0.603922, 0.803922, 0.196078, 1}
|
||||
}
|
||||
|
||||
function DF:GetDefaultColorList()
|
||||
return defaultColors
|
||||
end
|
||||
|
||||
for colorName, colorTable in pairs (defaultColors) do
|
||||
DF.alias_text_colors [colorName] = colorTable
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
+2
-2
@@ -272,7 +272,7 @@ function DF:CreateCoolTip()
|
||||
--> main frame
|
||||
local frame1
|
||||
if (not GameCooltipFrame1) then
|
||||
frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent)
|
||||
frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent,"TooltipBackdropTemplate")
|
||||
|
||||
tinsert (UISpecialFrames, "GameCooltipFrame1")
|
||||
DF:CreateFlashAnimation (frame1)
|
||||
@@ -299,7 +299,7 @@ function DF:CreateCoolTip()
|
||||
--> secondary frame
|
||||
local frame2
|
||||
if (not GameCooltipFrame2) then
|
||||
frame2 = CreateFrame ("Frame", "GameCooltipFrame2", UIParent)
|
||||
frame2 = CreateFrame ("Frame", "GameCooltipFrame2", UIParent,"TooltipBackdropTemplate")
|
||||
|
||||
tinsert (UISpecialFrames, "GameCooltipFrame2")
|
||||
DF:CreateFlashAnimation (frame2)
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
|
||||
<Script file="cooltip.lua"/>
|
||||
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
|
||||
<Script file="cooltip.lua"/>
|
||||
|
||||
</Ui>
|
||||
|
||||
+19
-6
@@ -184,6 +184,19 @@ local DropDownMetaFunctions = _G[DF.GlobalWidgetControlNames ["dropdown"]]
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function DropDownMetaFunctions:SetBackdrop(...)
|
||||
return self.dropdown:SetBackdrop(...)
|
||||
end
|
||||
|
||||
function DropDownMetaFunctions:SetBackdropColor(...)
|
||||
return self.dropdown:SetBackdropColor(...)
|
||||
end
|
||||
|
||||
function DropDownMetaFunctions:SetBackdropBorderColor(...)
|
||||
return self.dropdown:SetBackdropBorderColor(...)
|
||||
end
|
||||
|
||||
--> methods
|
||||
function DropDownMetaFunctions:IsShown()
|
||||
return self.dropdown:IsShown()
|
||||
@@ -1109,7 +1122,7 @@ function DF:NewDropDown (parent, container, name, member, w, h, func, default, t
|
||||
end
|
||||
|
||||
if (template) then
|
||||
DropDownObject:SetTemplate (template)
|
||||
DropDownObject:SetTemplate(template)
|
||||
end
|
||||
|
||||
return DropDownObject
|
||||
@@ -1122,7 +1135,7 @@ local border_backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1
|
||||
local child_backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 256, insets = {left = 0, right = 0, top = 0, bottom = 0}}
|
||||
|
||||
function DF:CreateNewDropdownFrame (parent, name)
|
||||
local f = CreateFrame ("button", name, parent)
|
||||
local f = CreateFrame ("button", name, parent,"BackdropTemplate")
|
||||
f:SetBackdrop (default_backdrop)
|
||||
f:SetSize (150, 20)
|
||||
|
||||
@@ -1171,7 +1184,7 @@ function DF:CreateNewDropdownFrame (parent, name)
|
||||
f.arrowTexture2:SetDrawLayer ("OVERLAY", 2)
|
||||
|
||||
--dropdown
|
||||
local border = CreateFrame ("frame", "$Parent_Border", f)
|
||||
local border = CreateFrame ("frame", "$Parent_Border", f,"BackdropTemplate")
|
||||
border:Hide()
|
||||
border:SetFrameStrata ("FULLSCREEN")
|
||||
border:SetSize (150, 150)
|
||||
@@ -1182,14 +1195,14 @@ function DF:CreateNewDropdownFrame (parent, name)
|
||||
border:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
f.dropdownborder = border
|
||||
|
||||
local scroll = CreateFrame ("ScrollFrame", "$Parent_ScrollFrame", f)
|
||||
local scroll = CreateFrame ("ScrollFrame", "$Parent_ScrollFrame", f,"BackdropTemplate")
|
||||
scroll:Hide()
|
||||
scroll:SetFrameStrata ("FULLSCREEN")
|
||||
scroll:SetSize (150, 150)
|
||||
scroll:SetPoint ("topleft", f, "bottomleft", 0, 0)
|
||||
f.dropdownframe = scroll
|
||||
|
||||
local child = CreateFrame ("frame", "$Parent_ScrollChild", scroll)
|
||||
local child = CreateFrame ("frame", "$Parent_ScrollChild", scroll,"BackdropTemplate")
|
||||
child:SetSize (150, 150)
|
||||
child:SetPoint ("topleft", scroll, "topleft", 0, 0)
|
||||
child:SetBackdrop (child_backdrop)
|
||||
@@ -1221,7 +1234,7 @@ end
|
||||
|
||||
function DF:CreateDropdownButton (parent, name)
|
||||
|
||||
local f = CreateFrame ("button", name, parent)
|
||||
local f = CreateFrame ("button", name, parent,"BackdropTemplate")
|
||||
f:SetSize (150, 20)
|
||||
|
||||
local statusbar = f:CreateTexture ("$parent_StatusBarTexture", "ARTWORK")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="dropdown.lua"/>
|
||||
</Ui>
|
||||
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="dropdown.lua"/>
|
||||
</Ui>
|
||||
|
||||
|
||||
+18
-18
@@ -1,18 +1,18 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
<Script file="Libs\LibStub\LibStub.lua"/>
|
||||
<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"/>
|
||||
<Include file="Libs\LibSharedMedia-3.0\lib.xml"/>
|
||||
<Include file="Libs\AceGUI-3.0\AceGUI-3.0.xml"/>
|
||||
<Include file="Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
|
||||
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml" />
|
||||
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml" />
|
||||
<Include file="Libs\AceDB-3.0\AceDB-3.0.xml" />
|
||||
<Include file="Libs\AceTimer-3.0\AceTimer-3.0.xml" />
|
||||
<Include file="Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
|
||||
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
|
||||
<Include file="Libs\AceComm-3.0\AceComm-3.0.xml" />
|
||||
<Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
|
||||
<Include file="Libs\AceSerializer-3.0\AceSerializer-3.0.xml"/>
|
||||
<Script file="Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/>
|
||||
<Script file="Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua"/>
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
<Script file="Libs\LibStub\LibStub.lua"/>
|
||||
<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"/>
|
||||
<Include file="Libs\LibSharedMedia-3.0\lib.xml"/>
|
||||
<Include file="Libs\AceGUI-3.0\AceGUI-3.0.xml"/>
|
||||
<Include file="Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
|
||||
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml" />
|
||||
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml" />
|
||||
<Include file="Libs\AceDB-3.0\AceDB-3.0.xml" />
|
||||
<Include file="Libs\AceTimer-3.0\AceTimer-3.0.xml" />
|
||||
<Include file="Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
|
||||
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
|
||||
<Include file="Libs\AceComm-3.0\AceComm-3.0.xml" />
|
||||
<Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
|
||||
<Include file="Libs\AceSerializer-3.0\AceSerializer-3.0.xml"/>
|
||||
<Script file="Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/>
|
||||
<Script file="Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua"/>
|
||||
</Ui>
|
||||
|
||||
+249
-47
@@ -1,12 +1,12 @@
|
||||
|
||||
local dversion = 195
|
||||
local dversion = 211
|
||||
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary (major, minor)
|
||||
|
||||
if (not DF) then
|
||||
DetailsFrameworkCanLoad = false
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
DetailsFrameworkCanLoad = true
|
||||
@@ -1059,7 +1059,7 @@ end
|
||||
|
||||
--volatile menu can be called several times, each time all settings are reset and a new menu is built using the same widgets
|
||||
function DF:BuildMenuVolatile (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template, value_change_hook)
|
||||
|
||||
|
||||
if (not parent.widget_list) then
|
||||
DF:SetAsOptionsPanel (parent)
|
||||
end
|
||||
@@ -1069,6 +1069,8 @@ end
|
||||
local cur_y = y_offset
|
||||
local max_x = 0
|
||||
|
||||
local latestInlineWidget
|
||||
|
||||
local widgetIndexes = {
|
||||
label = 1,
|
||||
dropdown = 1,
|
||||
@@ -1083,9 +1085,15 @@ end
|
||||
height = height*-1
|
||||
|
||||
for index, widget_table in ipairs(menu) do
|
||||
|
||||
|
||||
local widget_created
|
||||
|
||||
if (latestInlineWidget) then
|
||||
if (not widget_table.inline) then
|
||||
latestInlineWidget = nil
|
||||
cur_y = cur_y - 20
|
||||
end
|
||||
end
|
||||
|
||||
if (not widget_table.novolatile) then
|
||||
|
||||
--step a line
|
||||
@@ -1097,20 +1105,18 @@ end
|
||||
local label = getMenuWidgetVolative(parent, "label", widgetIndexes)
|
||||
widget_created = label
|
||||
|
||||
label.text = widget_table.get() or widget_table.text or ""
|
||||
label.color = widget_table.color
|
||||
|
||||
if (widget_table.font) then
|
||||
label.fontface = widget_table.font
|
||||
end
|
||||
|
||||
if (widget_table.text_template or text_template) then
|
||||
label:SetTemplate(widget_table.text_template or text_template)
|
||||
else
|
||||
label.fontsize = widget_table.size or 10
|
||||
end
|
||||
|
||||
if (label.fontface) then
|
||||
label.fontface = widget_table.font or "GameFontHighlightSmall"
|
||||
end
|
||||
if (widget_table.color) then
|
||||
label.fontcolor = widget_table.color
|
||||
end
|
||||
|
||||
label.text = widget_table.get() or widget_table.text or ""
|
||||
|
||||
label._get = widget_table.get
|
||||
label.widget_type = "label"
|
||||
@@ -1191,6 +1197,13 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
if (widget_table.width) then
|
||||
switch:SetWidth(widget_table.width)
|
||||
end
|
||||
if (widget_table.height) then
|
||||
switch:SetHeight(widget_table.height)
|
||||
end
|
||||
|
||||
switch.hasLabel.text = widget_table.name .. (use_two_points and ": " or "")
|
||||
switch.hasLabel:SetTemplate(widget_table.text_template or text_template)
|
||||
|
||||
@@ -1332,7 +1345,18 @@ end
|
||||
button.textsize = textTemplate.size
|
||||
button.text = widget_table.name
|
||||
|
||||
button:SetPoint (cur_x, cur_y)
|
||||
if (widget_table.inline) then
|
||||
if (latestInlineWidget) then
|
||||
button:SetPoint ("left", latestInlineWidget, "right", 2, 0)
|
||||
latestInlineWidget = button
|
||||
else
|
||||
button:SetPoint (cur_x, cur_y)
|
||||
latestInlineWidget = button
|
||||
end
|
||||
else
|
||||
button:SetPoint (cur_x, cur_y)
|
||||
end
|
||||
|
||||
button.tooltip = widget_table.desc
|
||||
button.widget_type = "execute"
|
||||
|
||||
@@ -1345,6 +1369,13 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
if (widget_table.width) then
|
||||
button:SetWidth(widget_table.width)
|
||||
end
|
||||
if (widget_table.height) then
|
||||
button:SetHeight(widget_table.height)
|
||||
end
|
||||
|
||||
if (widget_table.id) then
|
||||
parent.widgetids [widget_table.id] = button
|
||||
end
|
||||
@@ -1360,7 +1391,7 @@ end
|
||||
local textentry = getMenuWidgetVolative(parent, "textentry", widgetIndexes)
|
||||
widget_created = textentry
|
||||
|
||||
textentry:SetCommitFunction(widget_table.func)
|
||||
textentry:SetCommitFunction(widget_table.func or widget_table.set)
|
||||
textentry:SetTemplate(widget_table.template or widget_table.button_template or button_template)
|
||||
textentry:SetSize(widget_table.width or 120, widget_table.height or 18)
|
||||
|
||||
@@ -1368,18 +1399,15 @@ end
|
||||
textentry.text = widget_table.get()
|
||||
textentry._get = widget_table.get
|
||||
textentry.widget_type = "textentry"
|
||||
textentry:SetHook ("OnEnterPressed", widget_table.set)
|
||||
textentry:SetHook ("OnEditFocusLost", widget_table.set)
|
||||
textentry:SetHook ("OnEnterPressed", widget_table.func or widget_table.set)
|
||||
textentry:SetHook ("OnEditFocusLost", widget_table.func or widget_table.set)
|
||||
|
||||
textentry.hasLabel.text = widget_table.name .. (use_two_points and ": " or "")
|
||||
textentry.hasLabel:SetTemplate(widget_table.text_template or text_template)
|
||||
textentry:SetPoint ("left", textentry.hasLabel, "right", 2)
|
||||
textentry.hasLabel:SetPoint (cur_x, cur_y)
|
||||
|
||||
if (value_change_hook) then
|
||||
textentry:SetHook("OnEnterPressed", value_change_hook)
|
||||
textentry:SetHook("OnEditFocusLost", value_change_hook)
|
||||
end
|
||||
--> text entry doesn't trigger global callback
|
||||
|
||||
--> hook list
|
||||
if (widget_table.hooks) then
|
||||
@@ -1403,10 +1431,12 @@ end
|
||||
tinsert (disable_on_combat, widget_created)
|
||||
end
|
||||
|
||||
if (widget_table.spacement) then
|
||||
cur_y = cur_y - 30
|
||||
else
|
||||
cur_y = cur_y - 20
|
||||
if (not widget_table.inline) then
|
||||
if (widget_table.spacement) then
|
||||
cur_y = cur_y - 30
|
||||
else
|
||||
cur_y = cur_y - 20
|
||||
end
|
||||
end
|
||||
|
||||
if (widget_table.type == "breakline" or cur_y < height) then
|
||||
@@ -1415,7 +1445,7 @@ end
|
||||
line_widgets_created = 0
|
||||
max_x = 0
|
||||
end
|
||||
|
||||
|
||||
if widget_created then
|
||||
widget_created:Show()
|
||||
end
|
||||
@@ -1436,12 +1466,20 @@ end
|
||||
local max_x = 0
|
||||
local line_widgets_created = 0 --how many widgets has been created on this line loop pass
|
||||
|
||||
local latestInlineWidget
|
||||
|
||||
height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
|
||||
height = height*-1
|
||||
|
||||
for index, widget_table in ipairs (menu) do
|
||||
for index, widget_table in ipairs (menu) do
|
||||
|
||||
local widget_created
|
||||
if (latestInlineWidget) then
|
||||
if (not widget_table.inline) then
|
||||
latestInlineWidget = nil
|
||||
cur_y = cur_y - 28
|
||||
end
|
||||
end
|
||||
|
||||
if (widget_table.type == "blank" or widget_table.type == "space") then
|
||||
-- do nothing
|
||||
@@ -1522,7 +1560,14 @@ end
|
||||
switch:SetHook (hookName, hookFunc)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if (widget_table.width) then
|
||||
switch:SetWidth(widget_table.width)
|
||||
end
|
||||
if (widget_table.height) then
|
||||
switch:SetHeight(widget_table.height)
|
||||
end
|
||||
|
||||
local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
||||
if (widget_table.boxfirst) then
|
||||
switch:SetPoint (cur_x, cur_y)
|
||||
@@ -1647,22 +1692,45 @@ end
|
||||
button:InstallCustomTexture()
|
||||
end
|
||||
|
||||
button:SetPoint (cur_x, cur_y)
|
||||
if (widget_table.inline) then
|
||||
if (latestInlineWidget) then
|
||||
button:SetPoint ("left", latestInlineWidget, "right", 2, 0)
|
||||
latestInlineWidget = button
|
||||
else
|
||||
button:SetPoint (cur_x, cur_y)
|
||||
latestInlineWidget = button
|
||||
end
|
||||
else
|
||||
button:SetPoint (cur_x, cur_y)
|
||||
end
|
||||
|
||||
button.tooltip = widget_table.desc
|
||||
button.widget_type = "execute"
|
||||
|
||||
--> execute doesn't trigger global callback
|
||||
--notice: execute doesn't trigger global callback
|
||||
|
||||
--> hook list
|
||||
--button icon
|
||||
if (widget_table.icontexture) then
|
||||
button:SetIcon(widget_table.icontexture, nil, nil, nil, widget_table.icontexcoords, nil, nil, 2)
|
||||
end
|
||||
|
||||
--hook list
|
||||
if (widget_table.hooks) then
|
||||
for hookName, hookFunc in pairs (widget_table.hooks) do
|
||||
button:SetHook (hookName, hookFunc)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (widget_table.id) then
|
||||
parent.widgetids [widget_table.id] = button
|
||||
end
|
||||
|
||||
if (widget_table.width) then
|
||||
button:SetWidth(widget_table.width)
|
||||
end
|
||||
if (widget_table.height) then
|
||||
button:SetHeight(widget_table.height)
|
||||
end
|
||||
|
||||
local size = button:GetWidth() + 4
|
||||
if (size > max_x) then
|
||||
@@ -1677,13 +1745,13 @@ end
|
||||
line_widgets_created = line_widgets_created + 1
|
||||
|
||||
elseif (widget_table.type == "textentry") then
|
||||
local textentry = DF:CreateTextEntry (parent, widget_table.func, 120, 18, nil, "$parentWidget" .. index, nil, button_template)
|
||||
local textentry = DF:CreateTextEntry (parent, widget_table.func or widget_table.set, 120, 18, nil, "$parentWidget" .. index, nil, button_template)
|
||||
textentry.tooltip = widget_table.desc
|
||||
textentry.text = widget_table.get()
|
||||
textentry._get = widget_table.get
|
||||
textentry.widget_type = "textentry"
|
||||
textentry:SetHook ("OnEnterPressed", widget_table.set)
|
||||
textentry:SetHook ("OnEditFocusLost", widget_table.set)
|
||||
textentry:SetHook ("OnEnterPressed", widget_table.func or widget_table.set)
|
||||
textentry:SetHook ("OnEditFocusLost", widget_table.func or widget_table.set)
|
||||
|
||||
local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
|
||||
textentry:SetPoint ("left", label, "right", 2)
|
||||
@@ -1721,10 +1789,12 @@ end
|
||||
tinsert (disable_on_combat, widget_created)
|
||||
end
|
||||
|
||||
if (widget_table.spacement) then
|
||||
cur_y = cur_y - 30
|
||||
else
|
||||
cur_y = cur_y - 20
|
||||
if (not widget_table.inline) then
|
||||
if (widget_table.spacement) then
|
||||
cur_y = cur_y - 30
|
||||
else
|
||||
cur_y = cur_y - 20
|
||||
end
|
||||
end
|
||||
|
||||
if (widget_table.type == "breakline" or cur_y < height) then
|
||||
@@ -2055,6 +2125,8 @@ function DF:GetBestFontForLanguage (language, western, cyrillic, china, korean,
|
||||
end
|
||||
end
|
||||
|
||||
--DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
|
||||
--DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
|
||||
DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = DF:GetBestFontForLanguage()}
|
||||
DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = DF:GetBestFontForLanguage()}
|
||||
|
||||
@@ -2232,8 +2304,9 @@ function DF:SetHook (hookType, func)
|
||||
if (not isRemoval) then
|
||||
tinsert (self.HookList [hookType], func)
|
||||
end
|
||||
else
|
||||
else
|
||||
if (DF.debug) then
|
||||
print (debugstack())
|
||||
error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".")
|
||||
end
|
||||
end
|
||||
@@ -2709,6 +2782,7 @@ local glow_overlay_play = function (self)
|
||||
self.animOut:Stop()
|
||||
end
|
||||
if (not self.animIn:IsPlaying()) then
|
||||
self.animIn:Stop()
|
||||
self.animIn:Play()
|
||||
end
|
||||
end
|
||||
@@ -3097,9 +3171,11 @@ function DF:ReskinSlider (slider, heightOffset)
|
||||
slider.cima:GetPushedTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
||||
slider.cima:GetDisabledTexture():SetPoint ("center", slider.cima, "center", 1, 1)
|
||||
slider.cima:SetSize (16, 16)
|
||||
--[=[
|
||||
slider.cima:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
||||
slider.cima:SetBackdropColor (0, 0, 0, 0.3)
|
||||
slider.cima:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
]=]
|
||||
|
||||
slider.baixo:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]])
|
||||
slider.baixo:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]])
|
||||
@@ -3111,6 +3187,7 @@ function DF:ReskinSlider (slider, heightOffset)
|
||||
slider.baixo:GetPushedTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
||||
slider.baixo:GetDisabledTexture():SetPoint ("center", slider.baixo, "center", 1, -5)
|
||||
slider.baixo:SetSize (16, 16)
|
||||
--[=[
|
||||
slider.baixo:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
||||
slider.baixo:SetBackdropColor (0, 0, 0, 0.35)
|
||||
slider.baixo:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
@@ -3118,6 +3195,7 @@ function DF:ReskinSlider (slider, heightOffset)
|
||||
slider.slider:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]})
|
||||
slider.slider:SetBackdropColor (0, 0, 0, 0.35)
|
||||
slider.slider:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
]=]
|
||||
|
||||
--slider.slider:Altura (164)
|
||||
slider.slider:cimaPoint (0, 13)
|
||||
@@ -3156,10 +3234,11 @@ function DF:ReskinSlider (slider, heightOffset)
|
||||
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", offset, 0)
|
||||
|
||||
slider.ScrollBar.ScrollUpButton:SetSize (16, 16)
|
||||
--[=[
|
||||
slider.ScrollBar.ScrollUpButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
||||
slider.ScrollBar.ScrollUpButton:SetBackdropColor (0, 0, 0, 0.3)
|
||||
slider.ScrollBar.ScrollUpButton:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
|
||||
]=]
|
||||
--it was having problems with the texture anchor when calling ClearAllPoints() and setting new points different from the original
|
||||
--now it is using the same points from the original with small offsets tp align correctly
|
||||
end
|
||||
@@ -3189,9 +3268,11 @@ function DF:ReskinSlider (slider, heightOffset)
|
||||
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", offset, -4)
|
||||
|
||||
slider.ScrollBar.ScrollDownButton:SetSize (16, 16)
|
||||
--[=[
|
||||
slider.ScrollBar.ScrollDownButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
||||
slider.ScrollBar.ScrollDownButton:SetBackdropColor (0, 0, 0, 0.3)
|
||||
slider.ScrollBar.ScrollDownButton:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
]=]
|
||||
|
||||
--<Anchor point="TOP" relativePoint="BOTTOM"/>
|
||||
--slider.ScrollBar.ScrollDownButton:SetPoint ("top", slider.ScrollBar, "bottom", 0, 0)
|
||||
@@ -3211,10 +3292,11 @@ function DF:ReskinSlider (slider, heightOffset)
|
||||
slider.ScrollBar.ThumbTexture:SetSize (12, 8)
|
||||
|
||||
--
|
||||
|
||||
--[=[
|
||||
slider.ScrollBar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
|
||||
slider.ScrollBar:SetBackdropColor (0, 0, 0, 0.35)
|
||||
slider.ScrollBar:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
]=]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3300,7 +3382,7 @@ function DF:CoreDispatch (context, func, ...)
|
||||
local okay, result1, result2, result3, result4 = pcall (func, ...)
|
||||
|
||||
if (not okay) then
|
||||
local stack = debugstack (2)
|
||||
local stack = debugstack(2)
|
||||
local errortext = "D!Framework (" .. context .. ") error: " .. result1 .. "\n====================\n" .. stack .. "\n====================\n"
|
||||
error (errortext)
|
||||
end
|
||||
@@ -3339,6 +3421,7 @@ DF.ClassIndexToFileName = {
|
||||
[2] = "PALADIN",
|
||||
}
|
||||
|
||||
|
||||
DF.ClassFileNameToIndex = {
|
||||
["DEATHKNIGHT"] = 6,
|
||||
["WARRIOR"] = 1,
|
||||
@@ -3907,12 +3990,13 @@ end
|
||||
do
|
||||
local get = function(self)
|
||||
local object = tremove(self.notUse, #self.notUse)
|
||||
if (object) then
|
||||
if (object) then
|
||||
tinsert(self.inUse, object)
|
||||
return object, false
|
||||
|
||||
else
|
||||
--need to create the new object
|
||||
local newObject = self.newObjectFunc(self, unpack(self.payload))
|
||||
local newObject = self.newObjectFunc(self, unpack(self.payload))
|
||||
if (newObject) then
|
||||
tinsert(self.inUse, newObject)
|
||||
return newObject, true
|
||||
@@ -3957,7 +4041,7 @@ do
|
||||
|
||||
--return the amount of objects
|
||||
local getamount = function(self)
|
||||
return #self.notUse + #self.inUse
|
||||
return #self.notUse + #self.inUse, #self.notUse, #self.inUse
|
||||
end
|
||||
|
||||
local poolMixin = {
|
||||
@@ -3991,3 +4075,121 @@ do
|
||||
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> forbidden functions on scripts
|
||||
|
||||
--these are functions which scripts cannot run due to security issues
|
||||
local forbiddenFunction = {
|
||||
--block mail, trades, action house, banks
|
||||
["C_AuctionHouse"] = true,
|
||||
["C_Bank"] = true,
|
||||
["C_GuildBank"] = true,
|
||||
["SetSendMailMoney"] = true,
|
||||
["SendMail"] = true,
|
||||
["SetTradeMoney"] = true,
|
||||
["AddTradeMoney"] = true,
|
||||
["PickupTradeMoney"] = true,
|
||||
["PickupPlayerMoney"] = true,
|
||||
["AcceptTrade"] = true,
|
||||
|
||||
--frames
|
||||
["BankFrame"] = true,
|
||||
["TradeFrame"] = true,
|
||||
["GuildBankFrame"] = true,
|
||||
["MailFrame"] = true,
|
||||
["EnumerateFrames"] = true,
|
||||
|
||||
--block run code inside code
|
||||
["RunScript"] = true,
|
||||
["securecall"] = true,
|
||||
["getfenv"] = true,
|
||||
["getfenv"] = true,
|
||||
["loadstring"] = true,
|
||||
["pcall"] = true,
|
||||
["xpcall"] = true,
|
||||
["getglobal"] = true,
|
||||
["setmetatable"] = true,
|
||||
["DevTools_DumpCommand"] = true,
|
||||
|
||||
--avoid creating macros
|
||||
["SetBindingMacro"] = true,
|
||||
["CreateMacro"] = true,
|
||||
["EditMacro"] = true,
|
||||
["hash_SlashCmdList"] = true,
|
||||
["SlashCmdList"] = true,
|
||||
|
||||
--block guild commands
|
||||
["GuildDisband"] = true,
|
||||
["GuildUninvite"] = true,
|
||||
|
||||
--other things
|
||||
["C_GMTicketInfo"] = true,
|
||||
|
||||
--deny messing addons with script support
|
||||
["PlaterDB"] = true,
|
||||
["_detalhes_global"] = true,
|
||||
["WeakAurasSaved"] = true,
|
||||
}
|
||||
|
||||
local C_RestrictedSubFunctions = {
|
||||
["C_GuildInfo"] = {
|
||||
["RemoveFromGuild"] = true,
|
||||
},
|
||||
}
|
||||
|
||||
--not in use, can't find a way to check within the environment handle
|
||||
local addonRestrictedFunctions = {
|
||||
["DetailsFramework"] = {
|
||||
["SetEnvironment"] = true,
|
||||
},
|
||||
|
||||
["Plater"] = {
|
||||
["ImportScriptString"] = true,
|
||||
["db"] = true,
|
||||
},
|
||||
|
||||
["WeakAuras"] = {
|
||||
["Add"] = true,
|
||||
["AddMany"] = true,
|
||||
["Delete"] = true,
|
||||
["NewAura"] = true,
|
||||
},
|
||||
}
|
||||
|
||||
local C_SubFunctionsTable = {}
|
||||
for globalTableName, functionTable in pairs(C_RestrictedSubFunctions) do
|
||||
C_SubFunctionsTable [globalTableName] = {}
|
||||
for functionName, functionObject in pairs(_G[globalTableName]) do
|
||||
if (not functionTable[functionName]) then
|
||||
C_SubFunctionsTable [globalTableName][functionName] = functionObject
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DF.DefaultSecureScriptEnvironmentHandle = {
|
||||
__index = function (env, key)
|
||||
|
||||
if (forbiddenFunction[key]) then
|
||||
return nil
|
||||
|
||||
elseif (key == "_G") then
|
||||
return env
|
||||
|
||||
elseif (C_SubFunctionsTable[key]) then
|
||||
return C_SubFunctionsTable[key]
|
||||
end
|
||||
|
||||
return _G[key]
|
||||
end
|
||||
}
|
||||
|
||||
function DF:SetEnvironment(func, environmentHandle)
|
||||
environmentHandle = environmentHandle or DF.DefaultSecureScriptEnvironmentHandle
|
||||
|
||||
local newEnvironment = {}
|
||||
|
||||
setmetatable(newEnvironment, environmentHandle)
|
||||
_G.setfenv(func, newEnvironment)
|
||||
end
|
||||
|
||||
|
||||
+123
-123
@@ -1,123 +1,123 @@
|
||||
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local _
|
||||
local _rawset = rawset --> lua local
|
||||
local _rawget = rawget --> lua local
|
||||
|
||||
local APIHelpFunctions = false
|
||||
local HelpMetaFunctions = {}
|
||||
|
||||
local get_members_function_index = {}
|
||||
|
||||
HelpMetaFunctions.__index = function (_table, _member_requested)
|
||||
|
||||
local func = get_members_function_index [_member_requested]
|
||||
if (func) then
|
||||
return func (_table, _member_requested)
|
||||
end
|
||||
|
||||
local fromMe = _rawget (_table, _member_requested)
|
||||
if (fromMe) then
|
||||
return fromMe
|
||||
end
|
||||
|
||||
return HelpMetaFunctions [_member_requested]
|
||||
end
|
||||
|
||||
local set_members_function_index = {}
|
||||
|
||||
HelpMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
local func = set_members_function_index [_key]
|
||||
if (func) then
|
||||
return func (_table, _value)
|
||||
else
|
||||
return _rawset (_table, _key, _value)
|
||||
end
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:AddHelp (width, height, x, y, buttonX, buttonY, text, anchor)
|
||||
self.helpTable [#self.helpTable + 1] = {
|
||||
HighLightBox = {x = x, y = y, width = width, height = height},
|
||||
ButtonPos = { x = buttonX, y = buttonY},
|
||||
ToolTipDir = anchor or "RIGHT",
|
||||
ToolTipText = text
|
||||
}
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self)
|
||||
if (not v1) then
|
||||
print ("Invalid parameter for SetPoint")
|
||||
return
|
||||
end
|
||||
return self.widget:SetPoint (v1, v2, v3, v4, v5)
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:ShowHelp()
|
||||
if (not HelpPlate_IsShowing (self.helpTable)) then
|
||||
HelpPlate_Show (self.helpTable, self.frame, self.button, true)
|
||||
else
|
||||
HelpPlate_Hide (true)
|
||||
end
|
||||
end
|
||||
|
||||
local nameCounter = 1
|
||||
function DF:NewHelp (parent, width, height, x, y, buttonWidth, buttonHeight, name)
|
||||
|
||||
local help = {}
|
||||
|
||||
if (parent.dframework) then
|
||||
parent = parent.widget
|
||||
end
|
||||
|
||||
local helpButton = CreateFrame ("button", name or "DetailsFrameworkHelpButton"..nameCounter, parent, "MainHelpPlateButton")
|
||||
nameCounter = nameCounter + 1
|
||||
|
||||
if (not APIHelpFunctions) then
|
||||
APIHelpFunctions = true
|
||||
local idx = getmetatable (helpButton).__index
|
||||
for funcName, funcAddress in pairs (idx) do
|
||||
if (not HelpMetaFunctions [funcName]) then
|
||||
HelpMetaFunctions [funcName] = function (object, ...)
|
||||
local x = loadstring ( "return _G."..object.button:GetName()..":"..funcName.."(...)")
|
||||
return x (...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (buttonWidth and buttonHeight) then
|
||||
helpButton:SetWidth (buttonWidth)
|
||||
helpButton:SetHeight (buttonHeight)
|
||||
helpButton.I:SetWidth (buttonWidth*0.8)
|
||||
helpButton.I:SetHeight (buttonHeight*0.8)
|
||||
helpButton.Ring:SetWidth (buttonWidth)
|
||||
helpButton.Ring:SetHeight (buttonHeight)
|
||||
helpButton.Ring:SetPoint ("center", buttonWidth*.2, -buttonWidth*.2)
|
||||
end
|
||||
|
||||
help.helpTable = {
|
||||
FramePos = {x = x, y = y},
|
||||
FrameSize = {width = width, height = height}
|
||||
}
|
||||
|
||||
help.frame = parent
|
||||
help.button = helpButton
|
||||
help.widget = helpButton
|
||||
help.I = helpButton.I
|
||||
help.Ring = helpButton.Ring
|
||||
|
||||
helpButton:SetScript ("OnClick", function()
|
||||
help:ShowHelp()
|
||||
end)
|
||||
|
||||
setmetatable (help, HelpMetaFunctions)
|
||||
|
||||
return help
|
||||
|
||||
end
|
||||
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local _
|
||||
local _rawset = rawset --> lua local
|
||||
local _rawget = rawget --> lua local
|
||||
|
||||
local APIHelpFunctions = false
|
||||
local HelpMetaFunctions = {}
|
||||
|
||||
local get_members_function_index = {}
|
||||
|
||||
HelpMetaFunctions.__index = function (_table, _member_requested)
|
||||
|
||||
local func = get_members_function_index [_member_requested]
|
||||
if (func) then
|
||||
return func (_table, _member_requested)
|
||||
end
|
||||
|
||||
local fromMe = _rawget (_table, _member_requested)
|
||||
if (fromMe) then
|
||||
return fromMe
|
||||
end
|
||||
|
||||
return HelpMetaFunctions [_member_requested]
|
||||
end
|
||||
|
||||
local set_members_function_index = {}
|
||||
|
||||
HelpMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
local func = set_members_function_index [_key]
|
||||
if (func) then
|
||||
return func (_table, _value)
|
||||
else
|
||||
return _rawset (_table, _key, _value)
|
||||
end
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:AddHelp (width, height, x, y, buttonX, buttonY, text, anchor)
|
||||
self.helpTable [#self.helpTable + 1] = {
|
||||
HighLightBox = {x = x, y = y, width = width, height = height},
|
||||
ButtonPos = { x = buttonX, y = buttonY},
|
||||
ToolTipDir = anchor or "RIGHT",
|
||||
ToolTipText = text
|
||||
}
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self)
|
||||
if (not v1) then
|
||||
print ("Invalid parameter for SetPoint")
|
||||
return
|
||||
end
|
||||
return self.widget:SetPoint (v1, v2, v3, v4, v5)
|
||||
end
|
||||
|
||||
function HelpMetaFunctions:ShowHelp()
|
||||
if (not HelpPlate_IsShowing (self.helpTable)) then
|
||||
HelpPlate_Show (self.helpTable, self.frame, self.button, true)
|
||||
else
|
||||
HelpPlate_Hide (true)
|
||||
end
|
||||
end
|
||||
|
||||
local nameCounter = 1
|
||||
function DF:NewHelp (parent, width, height, x, y, buttonWidth, buttonHeight, name)
|
||||
|
||||
local help = {}
|
||||
|
||||
if (parent.dframework) then
|
||||
parent = parent.widget
|
||||
end
|
||||
|
||||
local helpButton = CreateFrame ("button", name or "DetailsFrameworkHelpButton"..nameCounter, parent, "MainHelpPlateButton")
|
||||
nameCounter = nameCounter + 1
|
||||
|
||||
if (not APIHelpFunctions) then
|
||||
APIHelpFunctions = true
|
||||
local idx = getmetatable (helpButton).__index
|
||||
for funcName, funcAddress in pairs (idx) do
|
||||
if (not HelpMetaFunctions [funcName]) then
|
||||
HelpMetaFunctions [funcName] = function (object, ...)
|
||||
local x = loadstring ( "return _G."..object.button:GetName()..":"..funcName.."(...)")
|
||||
return x (...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (buttonWidth and buttonHeight) then
|
||||
helpButton:SetWidth (buttonWidth)
|
||||
helpButton:SetHeight (buttonHeight)
|
||||
helpButton.I:SetWidth (buttonWidth*0.8)
|
||||
helpButton.I:SetHeight (buttonHeight*0.8)
|
||||
helpButton.Ring:SetWidth (buttonWidth)
|
||||
helpButton.Ring:SetHeight (buttonHeight)
|
||||
helpButton.Ring:SetPoint ("center", buttonWidth*.2, -buttonWidth*.2)
|
||||
end
|
||||
|
||||
help.helpTable = {
|
||||
FramePos = {x = x, y = y},
|
||||
FrameSize = {width = width, height = height}
|
||||
}
|
||||
|
||||
help.frame = parent
|
||||
help.button = helpButton
|
||||
help.widget = helpButton
|
||||
help.I = helpButton.I
|
||||
help.Ring = helpButton.Ring
|
||||
|
||||
helpButton:SetScript ("OnClick", function()
|
||||
help:ShowHelp()
|
||||
end)
|
||||
|
||||
setmetatable (help, HelpMetaFunctions)
|
||||
|
||||
return help
|
||||
|
||||
end
|
||||
|
||||
+351
-351
@@ -1,351 +1,351 @@
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local _
|
||||
local _rawset = rawset --> lua local
|
||||
local _rawget = rawget --> lua local
|
||||
local _setmetatable = setmetatable --> lua local
|
||||
local _unpack = unpack --> lua local
|
||||
local _type = type --> lua local
|
||||
local _math_floor = math.floor --> lua local
|
||||
local loadstring = loadstring --> lua local
|
||||
|
||||
local cleanfunction = function() end
|
||||
local APILabelFunctions = false
|
||||
|
||||
do
|
||||
local metaPrototype = {
|
||||
WidgetType = "label",
|
||||
SetHook = DF.SetHook,
|
||||
RunHooksForWidget = DF.RunHooksForWidget,
|
||||
|
||||
dversion = DF.dversion,
|
||||
}
|
||||
|
||||
--check if there's a metaPrototype already existing
|
||||
if (_G[DF.GlobalWidgetControlNames["label"]]) then
|
||||
--get the already existing metaPrototype
|
||||
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["label"]]
|
||||
--check if is older
|
||||
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
|
||||
--the version is older them the currently loading one
|
||||
--copy the new values into the old metatable
|
||||
for funcName, _ in pairs(metaPrototype) do
|
||||
oldMetaPrototype[funcName] = metaPrototype[funcName]
|
||||
end
|
||||
end
|
||||
else
|
||||
--first time loading the framework
|
||||
_G[DF.GlobalWidgetControlNames ["label"]] = metaPrototype
|
||||
end
|
||||
end
|
||||
|
||||
local LabelMetaFunctions = _G[DF.GlobalWidgetControlNames ["label"]]
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> metatables
|
||||
|
||||
LabelMetaFunctions.__call = function (_table, value)
|
||||
return self.label:SetText (value)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> members
|
||||
|
||||
--> shown
|
||||
local gmember_shown = function (_object)
|
||||
return _object:IsShown()
|
||||
end
|
||||
--> frame width
|
||||
local gmember_width = function (_object)
|
||||
return _object.label:GetStringWidth()
|
||||
end
|
||||
--> frame height
|
||||
local gmember_height = function (_object)
|
||||
return _object.label:GetStringHeight()
|
||||
end
|
||||
--> text
|
||||
local gmember_text = function (_object)
|
||||
return _object.label:GetText()
|
||||
end
|
||||
--> text color
|
||||
local gmember_textcolor = function (_object)
|
||||
return _object.label:GetTextColor()
|
||||
end
|
||||
--> text font
|
||||
local gmember_textfont = function (_object)
|
||||
local fontface = _object.label:GetFont()
|
||||
return fontface
|
||||
end
|
||||
--> text size
|
||||
local gmember_textsize = function (_object)
|
||||
local _, fontsize = _object.label:GetFont()
|
||||
return fontsize
|
||||
end
|
||||
|
||||
LabelMetaFunctions.GetMembers = LabelMetaFunctions.GetMembers or {}
|
||||
LabelMetaFunctions.GetMembers ["shown"] = gmember_shown
|
||||
LabelMetaFunctions.GetMembers ["width"] = gmember_width
|
||||
LabelMetaFunctions.GetMembers ["height"] = gmember_height
|
||||
LabelMetaFunctions.GetMembers ["text"] = gmember_text
|
||||
LabelMetaFunctions.GetMembers ["fontcolor"] = gmember_textcolor
|
||||
LabelMetaFunctions.GetMembers ["fontface"] = gmember_textfont
|
||||
LabelMetaFunctions.GetMembers ["fontsize"] = gmember_textsize
|
||||
LabelMetaFunctions.GetMembers ["textcolor"] = gmember_textcolor --alias
|
||||
LabelMetaFunctions.GetMembers ["textfont"] = gmember_textfont --alias
|
||||
LabelMetaFunctions.GetMembers ["textsize"] = gmember_textsize --alias
|
||||
|
||||
LabelMetaFunctions.__index = function (_table, _member_requested)
|
||||
|
||||
local func = LabelMetaFunctions.GetMembers [_member_requested]
|
||||
if (func) then
|
||||
return func (_table, _member_requested)
|
||||
end
|
||||
|
||||
local fromMe = _rawget (_table, _member_requested)
|
||||
if (fromMe) then
|
||||
return fromMe
|
||||
end
|
||||
|
||||
return LabelMetaFunctions [_member_requested]
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--> show
|
||||
local smember_show = function (_object, _value)
|
||||
if (_value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> hide
|
||||
local smember_hide = function (_object, _value)
|
||||
if (not _value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> text
|
||||
local smember_text = function (_object, _value)
|
||||
return _object.label:SetText (_value)
|
||||
end
|
||||
--> text color
|
||||
local smember_textcolor = function (_object, _value)
|
||||
local _value1, _value2, _value3, _value4 = DF:ParseColors (_value)
|
||||
return _object.label:SetTextColor (_value1, _value2, _value3, _value4)
|
||||
end
|
||||
--> text font
|
||||
local smember_textfont = function (_object, _value)
|
||||
return DF:SetFontFace (_object.label, _value)
|
||||
end
|
||||
--> text size
|
||||
local smember_textsize = function (_object, _value)
|
||||
return DF:SetFontSize (_object.label, _value)
|
||||
end
|
||||
--> text align
|
||||
local smember_textalign = function (_object, _value)
|
||||
if (_value == "<") then
|
||||
_value = "left"
|
||||
elseif (_value == ">") then
|
||||
_value = "right"
|
||||
elseif (_value == "|") then
|
||||
_value = "center"
|
||||
end
|
||||
return _object.label:SetJustifyH (_value)
|
||||
end
|
||||
--> text valign
|
||||
local smember_textvalign = function (_object, _value)
|
||||
if (_value == "^") then
|
||||
_value = "top"
|
||||
elseif (_value == "_") then
|
||||
_value = "bottom"
|
||||
elseif (_value == "|") then
|
||||
_value = "middle"
|
||||
end
|
||||
return _object.label:SetJustifyV (_value)
|
||||
end
|
||||
--> field size width
|
||||
local smember_width = function (_object, _value)
|
||||
return _object.label:SetWidth (_value)
|
||||
end
|
||||
--> field size height
|
||||
local smember_height = function (_object, _value)
|
||||
return _object.label:SetHeight (_value)
|
||||
end
|
||||
--> outline (shadow)
|
||||
local smember_outline = function (_object, _value)
|
||||
DF:SetFontOutline (_object.label, _value)
|
||||
end
|
||||
|
||||
LabelMetaFunctions.SetMembers = LabelMetaFunctions.SetMembers or {}
|
||||
LabelMetaFunctions.SetMembers["show"] = smember_show
|
||||
LabelMetaFunctions.SetMembers["hide"] = smember_hide
|
||||
LabelMetaFunctions.SetMembers["align"] = smember_textalign
|
||||
LabelMetaFunctions.SetMembers["valign"] = smember_textvalign
|
||||
LabelMetaFunctions.SetMembers["text"] = smember_text
|
||||
LabelMetaFunctions.SetMembers["width"] = smember_width
|
||||
LabelMetaFunctions.SetMembers["height"] = smember_height
|
||||
LabelMetaFunctions.SetMembers["fontcolor"] = smember_textcolor
|
||||
LabelMetaFunctions.SetMembers["color"] = smember_textcolor--alias
|
||||
LabelMetaFunctions.SetMembers["fontface"] = smember_textfont
|
||||
LabelMetaFunctions.SetMembers["fontsize"] = smember_textsize
|
||||
LabelMetaFunctions.SetMembers["textcolor"] = smember_textcolor--alias
|
||||
LabelMetaFunctions.SetMembers["textfont"] = smember_textfont--alias
|
||||
LabelMetaFunctions.SetMembers["textsize"] = smember_textsize--alias
|
||||
LabelMetaFunctions.SetMembers["shadow"] = smember_outline
|
||||
LabelMetaFunctions.SetMembers["outline"] = smember_outline--alias
|
||||
|
||||
LabelMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
local func = LabelMetaFunctions.SetMembers [_key]
|
||||
if (func) then
|
||||
return func (_table, _value)
|
||||
else
|
||||
return _rawset (_table, _key, _value)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> methods
|
||||
|
||||
--> show & hide
|
||||
function LabelMetaFunctions:IsShown()
|
||||
return self.label:IsShown()
|
||||
end
|
||||
function LabelMetaFunctions:Show()
|
||||
return self.label:Show()
|
||||
end
|
||||
function LabelMetaFunctions:Hide()
|
||||
return self.label:Hide()
|
||||
end
|
||||
|
||||
--text text
|
||||
function LabelMetaFunctions:SetTextTruncated (text, maxWidth)
|
||||
self.widget:SetText (text)
|
||||
DF:TruncateText (self.widget, maxWidth)
|
||||
end
|
||||
|
||||
-- textcolor
|
||||
function LabelMetaFunctions:SetTextColor (color, arg2, arg3, arg4)
|
||||
if (arg2) then
|
||||
return self.label:SetTextColor (color, arg2, arg3, arg4 or 1)
|
||||
end
|
||||
local _value1, _value2, _value3, _value4 = DF:ParseColors (color)
|
||||
return self.label:SetTextColor (_value1, _value2, _value3, _value4)
|
||||
end
|
||||
|
||||
-- setpoint
|
||||
function LabelMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self)
|
||||
if (not v1) then
|
||||
print ("Invalid parameter for SetPoint")
|
||||
return
|
||||
end
|
||||
return self.widget:SetPoint (v1, v2, v3, v4, v5)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function LabelMetaFunctions:SetTemplate (template)
|
||||
if (template.size) then
|
||||
DF:SetFontSize (self.label, template.size)
|
||||
end
|
||||
if (template.color) then
|
||||
local r, g, b, a = DF:ParseColors (template.color)
|
||||
self:SetTextColor (r, g, b, a)
|
||||
end
|
||||
if (template.font) then
|
||||
local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
|
||||
local font = SharedMedia:Fetch ("font", template.font)
|
||||
DF:SetFontFace (self.label, font)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> object constructor
|
||||
function DF:CreateLabel (parent, text, size, color, font, member, name, layer)
|
||||
return DF:NewLabel (parent, nil, name, member, text, font, size, color, layer)
|
||||
end
|
||||
|
||||
function DF:NewLabel (parent, container, name, member, text, font, size, color, layer)
|
||||
|
||||
if (not parent) then
|
||||
return error ("Details! FrameWork: parent not found.", 2)
|
||||
end
|
||||
if (not container) then
|
||||
container = parent
|
||||
end
|
||||
|
||||
if (not name) then
|
||||
name = "DetailsFrameworkLabelNumber" .. DF.LabelNameCounter
|
||||
DF.LabelNameCounter = DF.LabelNameCounter + 1
|
||||
end
|
||||
|
||||
if (name:find ("$parent")) then
|
||||
local parentName = DF.GetParentName (parent)
|
||||
name = name:gsub ("$parent", parentName)
|
||||
end
|
||||
|
||||
local LabelObject = {type = "label", dframework = true}
|
||||
|
||||
if (member) then
|
||||
parent [member] = LabelObject
|
||||
--container [member] = LabelObject.label
|
||||
end
|
||||
|
||||
if (parent.dframework) then
|
||||
parent = parent.widget
|
||||
end
|
||||
if (container.dframework) then
|
||||
container = container.widget
|
||||
end
|
||||
|
||||
font = font == "" and "GameFontHighlightSmall" or font or "GameFontHighlightSmall"
|
||||
|
||||
LabelObject.label = parent:CreateFontString (name, layer or "OVERLAY", font)
|
||||
LabelObject.widget = LabelObject.label
|
||||
|
||||
LabelObject.label.MyObject = LabelObject
|
||||
|
||||
if (not APILabelFunctions) then
|
||||
APILabelFunctions = true
|
||||
local idx = getmetatable (LabelObject.label).__index
|
||||
for funcName, funcAddress in pairs (idx) do
|
||||
if (not LabelMetaFunctions [funcName]) then
|
||||
LabelMetaFunctions [funcName] = function (object, ...)
|
||||
local x = loadstring ( "return _G['"..object.label:GetName().."']:"..funcName.."(...)")
|
||||
return x (...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
LabelObject.label:SetText (text)
|
||||
|
||||
if (color) then
|
||||
local r, g, b, a = DF:ParseColors (color)
|
||||
LabelObject.label:SetTextColor (r, g, b, a)
|
||||
end
|
||||
|
||||
if (size and type (size) == "number") then
|
||||
DF:SetFontSize (LabelObject.label, size)
|
||||
end
|
||||
|
||||
LabelObject.HookList = {
|
||||
}
|
||||
|
||||
LabelObject.label:SetJustifyH ("LEFT")
|
||||
|
||||
setmetatable (LabelObject, LabelMetaFunctions)
|
||||
|
||||
if (size and type (size) == "table") then
|
||||
LabelObject:SetTemplate (size)
|
||||
end
|
||||
|
||||
return LabelObject
|
||||
end
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local _
|
||||
local _rawset = rawset --> lua local
|
||||
local _rawget = rawget --> lua local
|
||||
local _setmetatable = setmetatable --> lua local
|
||||
local _unpack = unpack --> lua local
|
||||
local _type = type --> lua local
|
||||
local _math_floor = math.floor --> lua local
|
||||
local loadstring = loadstring --> lua local
|
||||
|
||||
local cleanfunction = function() end
|
||||
local APILabelFunctions = false
|
||||
|
||||
do
|
||||
local metaPrototype = {
|
||||
WidgetType = "label",
|
||||
SetHook = DF.SetHook,
|
||||
RunHooksForWidget = DF.RunHooksForWidget,
|
||||
|
||||
dversion = DF.dversion,
|
||||
}
|
||||
|
||||
--check if there's a metaPrototype already existing
|
||||
if (_G[DF.GlobalWidgetControlNames["label"]]) then
|
||||
--get the already existing metaPrototype
|
||||
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["label"]]
|
||||
--check if is older
|
||||
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
|
||||
--the version is older them the currently loading one
|
||||
--copy the new values into the old metatable
|
||||
for funcName, _ in pairs(metaPrototype) do
|
||||
oldMetaPrototype[funcName] = metaPrototype[funcName]
|
||||
end
|
||||
end
|
||||
else
|
||||
--first time loading the framework
|
||||
_G[DF.GlobalWidgetControlNames ["label"]] = metaPrototype
|
||||
end
|
||||
end
|
||||
|
||||
local LabelMetaFunctions = _G[DF.GlobalWidgetControlNames ["label"]]
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> metatables
|
||||
|
||||
LabelMetaFunctions.__call = function (_table, value)
|
||||
return self.label:SetText (value)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> members
|
||||
|
||||
--> shown
|
||||
local gmember_shown = function (_object)
|
||||
return _object:IsShown()
|
||||
end
|
||||
--> frame width
|
||||
local gmember_width = function (_object)
|
||||
return _object.label:GetStringWidth()
|
||||
end
|
||||
--> frame height
|
||||
local gmember_height = function (_object)
|
||||
return _object.label:GetStringHeight()
|
||||
end
|
||||
--> text
|
||||
local gmember_text = function (_object)
|
||||
return _object.label:GetText()
|
||||
end
|
||||
--> text color
|
||||
local gmember_textcolor = function (_object)
|
||||
return _object.label:GetTextColor()
|
||||
end
|
||||
--> text font
|
||||
local gmember_textfont = function (_object)
|
||||
local fontface = _object.label:GetFont()
|
||||
return fontface
|
||||
end
|
||||
--> text size
|
||||
local gmember_textsize = function (_object)
|
||||
local _, fontsize = _object.label:GetFont()
|
||||
return fontsize
|
||||
end
|
||||
|
||||
LabelMetaFunctions.GetMembers = LabelMetaFunctions.GetMembers or {}
|
||||
LabelMetaFunctions.GetMembers ["shown"] = gmember_shown
|
||||
LabelMetaFunctions.GetMembers ["width"] = gmember_width
|
||||
LabelMetaFunctions.GetMembers ["height"] = gmember_height
|
||||
LabelMetaFunctions.GetMembers ["text"] = gmember_text
|
||||
LabelMetaFunctions.GetMembers ["fontcolor"] = gmember_textcolor
|
||||
LabelMetaFunctions.GetMembers ["fontface"] = gmember_textfont
|
||||
LabelMetaFunctions.GetMembers ["fontsize"] = gmember_textsize
|
||||
LabelMetaFunctions.GetMembers ["textcolor"] = gmember_textcolor --alias
|
||||
LabelMetaFunctions.GetMembers ["textfont"] = gmember_textfont --alias
|
||||
LabelMetaFunctions.GetMembers ["textsize"] = gmember_textsize --alias
|
||||
|
||||
LabelMetaFunctions.__index = function (_table, _member_requested)
|
||||
|
||||
local func = LabelMetaFunctions.GetMembers [_member_requested]
|
||||
if (func) then
|
||||
return func (_table, _member_requested)
|
||||
end
|
||||
|
||||
local fromMe = _rawget (_table, _member_requested)
|
||||
if (fromMe) then
|
||||
return fromMe
|
||||
end
|
||||
|
||||
return LabelMetaFunctions [_member_requested]
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--> show
|
||||
local smember_show = function (_object, _value)
|
||||
if (_value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> hide
|
||||
local smember_hide = function (_object, _value)
|
||||
if (not _value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> text
|
||||
local smember_text = function (_object, _value)
|
||||
return _object.label:SetText (_value)
|
||||
end
|
||||
--> text color
|
||||
local smember_textcolor = function (_object, _value)
|
||||
local _value1, _value2, _value3, _value4 = DF:ParseColors (_value)
|
||||
return _object.label:SetTextColor (_value1, _value2, _value3, _value4)
|
||||
end
|
||||
--> text font
|
||||
local smember_textfont = function (_object, _value)
|
||||
return DF:SetFontFace (_object.label, _value)
|
||||
end
|
||||
--> text size
|
||||
local smember_textsize = function (_object, _value)
|
||||
return DF:SetFontSize (_object.label, _value)
|
||||
end
|
||||
--> text align
|
||||
local smember_textalign = function (_object, _value)
|
||||
if (_value == "<") then
|
||||
_value = "left"
|
||||
elseif (_value == ">") then
|
||||
_value = "right"
|
||||
elseif (_value == "|") then
|
||||
_value = "center"
|
||||
end
|
||||
return _object.label:SetJustifyH (_value)
|
||||
end
|
||||
--> text valign
|
||||
local smember_textvalign = function (_object, _value)
|
||||
if (_value == "^") then
|
||||
_value = "top"
|
||||
elseif (_value == "_") then
|
||||
_value = "bottom"
|
||||
elseif (_value == "|") then
|
||||
_value = "middle"
|
||||
end
|
||||
return _object.label:SetJustifyV (_value)
|
||||
end
|
||||
--> field size width
|
||||
local smember_width = function (_object, _value)
|
||||
return _object.label:SetWidth (_value)
|
||||
end
|
||||
--> field size height
|
||||
local smember_height = function (_object, _value)
|
||||
return _object.label:SetHeight (_value)
|
||||
end
|
||||
--> outline (shadow)
|
||||
local smember_outline = function (_object, _value)
|
||||
DF:SetFontOutline (_object.label, _value)
|
||||
end
|
||||
|
||||
LabelMetaFunctions.SetMembers = LabelMetaFunctions.SetMembers or {}
|
||||
LabelMetaFunctions.SetMembers["show"] = smember_show
|
||||
LabelMetaFunctions.SetMembers["hide"] = smember_hide
|
||||
LabelMetaFunctions.SetMembers["align"] = smember_textalign
|
||||
LabelMetaFunctions.SetMembers["valign"] = smember_textvalign
|
||||
LabelMetaFunctions.SetMembers["text"] = smember_text
|
||||
LabelMetaFunctions.SetMembers["width"] = smember_width
|
||||
LabelMetaFunctions.SetMembers["height"] = smember_height
|
||||
LabelMetaFunctions.SetMembers["fontcolor"] = smember_textcolor
|
||||
LabelMetaFunctions.SetMembers["color"] = smember_textcolor--alias
|
||||
LabelMetaFunctions.SetMembers["fontface"] = smember_textfont
|
||||
LabelMetaFunctions.SetMembers["fontsize"] = smember_textsize
|
||||
LabelMetaFunctions.SetMembers["textcolor"] = smember_textcolor--alias
|
||||
LabelMetaFunctions.SetMembers["textfont"] = smember_textfont--alias
|
||||
LabelMetaFunctions.SetMembers["textsize"] = smember_textsize--alias
|
||||
LabelMetaFunctions.SetMembers["shadow"] = smember_outline
|
||||
LabelMetaFunctions.SetMembers["outline"] = smember_outline--alias
|
||||
|
||||
LabelMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
local func = LabelMetaFunctions.SetMembers [_key]
|
||||
if (func) then
|
||||
return func (_table, _value)
|
||||
else
|
||||
return _rawset (_table, _key, _value)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> methods
|
||||
|
||||
--> show & hide
|
||||
function LabelMetaFunctions:IsShown()
|
||||
return self.label:IsShown()
|
||||
end
|
||||
function LabelMetaFunctions:Show()
|
||||
return self.label:Show()
|
||||
end
|
||||
function LabelMetaFunctions:Hide()
|
||||
return self.label:Hide()
|
||||
end
|
||||
|
||||
--text text
|
||||
function LabelMetaFunctions:SetTextTruncated (text, maxWidth)
|
||||
self.widget:SetText (text)
|
||||
DF:TruncateText (self.widget, maxWidth)
|
||||
end
|
||||
|
||||
-- textcolor
|
||||
function LabelMetaFunctions:SetTextColor (color, arg2, arg3, arg4)
|
||||
if (arg2) then
|
||||
return self.label:SetTextColor (color, arg2, arg3, arg4 or 1)
|
||||
end
|
||||
local _value1, _value2, _value3, _value4 = DF:ParseColors (color)
|
||||
return self.label:SetTextColor (_value1, _value2, _value3, _value4)
|
||||
end
|
||||
|
||||
-- setpoint
|
||||
function LabelMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self)
|
||||
if (not v1) then
|
||||
print ("Invalid parameter for SetPoint")
|
||||
return
|
||||
end
|
||||
return self.widget:SetPoint (v1, v2, v3, v4, v5)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function LabelMetaFunctions:SetTemplate (template)
|
||||
if (template.size) then
|
||||
DF:SetFontSize (self.label, template.size)
|
||||
end
|
||||
if (template.color) then
|
||||
local r, g, b, a = DF:ParseColors (template.color)
|
||||
self:SetTextColor (r, g, b, a)
|
||||
end
|
||||
if (template.font) then
|
||||
local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
|
||||
local font = SharedMedia:Fetch ("font", template.font)
|
||||
DF:SetFontFace (self.label, font)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> object constructor
|
||||
function DF:CreateLabel (parent, text, size, color, font, member, name, layer)
|
||||
return DF:NewLabel (parent, nil, name, member, text, font, size, color, layer)
|
||||
end
|
||||
|
||||
function DF:NewLabel (parent, container, name, member, text, font, size, color, layer)
|
||||
|
||||
if (not parent) then
|
||||
return error ("Details! FrameWork: parent not found.", 2)
|
||||
end
|
||||
if (not container) then
|
||||
container = parent
|
||||
end
|
||||
|
||||
if (not name) then
|
||||
name = "DetailsFrameworkLabelNumber" .. DF.LabelNameCounter
|
||||
DF.LabelNameCounter = DF.LabelNameCounter + 1
|
||||
end
|
||||
|
||||
if (name:find ("$parent")) then
|
||||
local parentName = DF.GetParentName (parent)
|
||||
name = name:gsub ("$parent", parentName)
|
||||
end
|
||||
|
||||
local LabelObject = {type = "label", dframework = true}
|
||||
|
||||
if (member) then
|
||||
parent [member] = LabelObject
|
||||
--container [member] = LabelObject.label
|
||||
end
|
||||
|
||||
if (parent.dframework) then
|
||||
parent = parent.widget
|
||||
end
|
||||
if (container.dframework) then
|
||||
container = container.widget
|
||||
end
|
||||
|
||||
font = font == "" and "GameFontHighlightSmall" or font or "GameFontHighlightSmall"
|
||||
|
||||
LabelObject.label = parent:CreateFontString (name, layer or "OVERLAY", font)
|
||||
LabelObject.widget = LabelObject.label
|
||||
|
||||
LabelObject.label.MyObject = LabelObject
|
||||
|
||||
if (not APILabelFunctions) then
|
||||
APILabelFunctions = true
|
||||
local idx = getmetatable (LabelObject.label).__index
|
||||
for funcName, funcAddress in pairs (idx) do
|
||||
if (not LabelMetaFunctions [funcName]) then
|
||||
LabelMetaFunctions [funcName] = function (object, ...)
|
||||
local x = loadstring ( "return _G['"..object.label:GetName().."']:"..funcName.."(...)")
|
||||
return x (...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
LabelObject.label:SetText (text)
|
||||
|
||||
if (color) then
|
||||
local r, g, b, a = DF:ParseColors (color)
|
||||
LabelObject.label:SetTextColor (r, g, b, a)
|
||||
end
|
||||
|
||||
if (size and type (size) == "number") then
|
||||
DF:SetFontSize (LabelObject.label, size)
|
||||
end
|
||||
|
||||
LabelObject.HookList = {
|
||||
}
|
||||
|
||||
LabelObject.label:SetJustifyH ("LEFT")
|
||||
|
||||
setmetatable (LabelObject, LabelMetaFunctions)
|
||||
|
||||
if (size and type (size) == "table") then
|
||||
LabelObject:SetTemplate (size)
|
||||
end
|
||||
|
||||
return LabelObject
|
||||
end
|
||||
|
||||
+25
-25
@@ -1,25 +1,25 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
|
||||
<Script file="fw.lua"/>
|
||||
<Script file="addon.lua"/>
|
||||
<Script file="colors.lua"/>
|
||||
<Script file="help.lua"/>
|
||||
<Script file="label.lua"/>
|
||||
<Script file="picture.lua"/>
|
||||
<Script file="slider.lua"/>
|
||||
<Script file="scrollbar.lua"/>
|
||||
<Script file="spells.lua"/>
|
||||
<Script file="math.lua"/>
|
||||
|
||||
<Include file="tutorial_alert.xml"/>
|
||||
<Include file="split_bar.xml"/>
|
||||
<Include file="textentry.xml"/>
|
||||
<Include file="button.xml"/>
|
||||
<Include file="cooltip.xml"/>
|
||||
<Include file="dropdown.xml"/>
|
||||
<Include file="normal_bar.xml"/>
|
||||
<Include file="panel.xml"/>
|
||||
|
||||
<Script file="pictureedit.lua"/>
|
||||
<Script file="auras.lua"/>
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
|
||||
<Script file="fw.lua"/>
|
||||
<Script file="addon.lua"/>
|
||||
<Script file="colors.lua"/>
|
||||
<Script file="help.lua"/>
|
||||
<Script file="label.lua"/>
|
||||
<Script file="picture.lua"/>
|
||||
<Script file="slider.lua"/>
|
||||
<Script file="scrollbar.lua"/>
|
||||
<Script file="spells.lua"/>
|
||||
<Script file="math.lua"/>
|
||||
|
||||
<Include file="tutorial_alert.xml"/>
|
||||
<Include file="split_bar.xml"/>
|
||||
<Include file="textentry.xml"/>
|
||||
<Include file="button.xml"/>
|
||||
<Include file="cooltip.xml"/>
|
||||
<Include file="dropdown.xml"/>
|
||||
<Include file="normal_bar.xml"/>
|
||||
<Include file="panel.xml"/>
|
||||
|
||||
<Script file="pictureedit.lua"/>
|
||||
<Script file="auras.lua"/>
|
||||
</Ui>
|
||||
|
||||
+114
-114
@@ -1,114 +1,114 @@
|
||||
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local UnitExists = UnitExists
|
||||
local atan2 = math.atan2
|
||||
local pi = math.pi
|
||||
local abs = math.abs
|
||||
|
||||
SMALL_FLOAT = 0.000001
|
||||
|
||||
--find distance between two players
|
||||
function DF:GetDistance_Unit (unit1, unit2)
|
||||
if (UnitExists (unit1) and UnitExists (unit2)) then
|
||||
local u1X, u1Y = UnitPosition (unit1)
|
||||
local u2X, u2Y = UnitPosition (unit2)
|
||||
|
||||
local dX = u2X - u1X
|
||||
local dY = u2Y - u1Y
|
||||
|
||||
return ((dX*dX) + (dY*dY)) ^ .5
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--find distance between two points
|
||||
function DF:GetDistance_Point (x1, y1, x2, y2)
|
||||
local dx = x2 - x1
|
||||
local dy = y2 - y1
|
||||
return ((dx * dx) + (dy * dy)) ^ .5
|
||||
end
|
||||
|
||||
--find a rotation for an object from a point to another point
|
||||
function DF:FindLookAtRotation (x1, y1, x2, y2)
|
||||
return atan2 (y2 - y1, x2 - x1) + pi
|
||||
end
|
||||
|
||||
--find the value scale between two given values. e.g: value of 500 in a range 0-100 result in 10 in a scale for 0-10
|
||||
function DF:MapRangeClamped (inputX, inputY, outputX, outputY, value)
|
||||
return DF:GetRangeValue (outputX, outputY, Clamp (DF:GetRangePercent (inputX, inputY, value), 0, 1))
|
||||
end
|
||||
|
||||
--find the value scale between two given values. e.g: value of 75 in a range 0-100 result in 7.5 in a scale for 0-10
|
||||
function DF:MapRangeUnclamped (inputX, inputY, outputX, outputY, value)
|
||||
return DF:GetRangeValue (outputX, outputY, DF:GetRangePercent (inputX, inputY, value))
|
||||
end
|
||||
|
||||
--find the normalized percent of the value in the range. e.g range of 200-400 and a value of 250 result in 0.25
|
||||
function DF:GetRangePercent (minValue, maxValue, value)
|
||||
return (value - minValue) / (maxValue - minValue)
|
||||
end
|
||||
|
||||
--find the value in the range given from a normalized percent. e.g range of 200-400 and a percent of 0.8 result in 360
|
||||
function DF:GetRangeValue (minValue, maxValue, percent)
|
||||
return Lerp (minValue, maxValue, percent)
|
||||
end
|
||||
|
||||
--dot product of two 2D Vectors
|
||||
function DF:GetDotProduct (value1, value2)
|
||||
return (value1.x * value2.x) + (value1.y * value2.y)
|
||||
end
|
||||
|
||||
--normalized value 0-1 result in the value on the range given, e.g 200-400 range with a value of .5 result in 300
|
||||
function DF:LerpNorm (minValue, maxValue, value)
|
||||
return (minValue + value * (maxValue - minValue))
|
||||
end
|
||||
|
||||
--change the color by the deltaTime
|
||||
function DF:LerpLinearColor (deltaTime, interpSpeed, r1, g1, b1, r2, g2, b2)
|
||||
deltaTime = deltaTime * interpSpeed
|
||||
local r = r1 + (r2 - r1) * deltaTime
|
||||
local g = g1 + (g2 - g1) * deltaTime
|
||||
local b = b1 + (b2 - b1) * deltaTime
|
||||
return r, g, b
|
||||
end
|
||||
|
||||
--check if a number is near another number by a tolerance
|
||||
function DF:IsNearlyEqual (value1, value2, tolerance)
|
||||
tolerance = tolerance or SMALL_FLOAT
|
||||
return abs (value1 - value2) <= tolerance
|
||||
end
|
||||
|
||||
--check if a number is near zero
|
||||
function DF:IsNearlyZero (value, tolerance)
|
||||
tolerance = tolerance or SMALL_FLOAT
|
||||
return abs (value) <= tolerance
|
||||
end
|
||||
|
||||
--check if a number is within a two other numbers, if isInclusive is true, it'll include the max value
|
||||
function DF:IsWithin (minValue, maxValue, value, isInclusive)
|
||||
if (isInclusive) then
|
||||
return ((value >= minValue) and (value <= maxValue))
|
||||
else
|
||||
return ((value >= minValue) and (value < maxValue))
|
||||
end
|
||||
end
|
||||
|
||||
--dont allow a number ot be lower or bigger than a certain range
|
||||
function DF:Clamp (minValue, maxValue, value)
|
||||
return value < minValue and minValue or value < maxValue and value or maxValue
|
||||
end
|
||||
|
||||
--from http://lua-users.org/wiki/SimpleRound cut fractions on a float
|
||||
function DF:Round (num, numDecimalPlaces)
|
||||
local mult = 10^(numDecimalPlaces or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
function DF:ScaleBack ()
|
||||
|
||||
end
|
||||
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local UnitExists = UnitExists
|
||||
local atan2 = math.atan2
|
||||
local pi = math.pi
|
||||
local abs = math.abs
|
||||
|
||||
SMALL_FLOAT = 0.000001
|
||||
|
||||
--find distance between two players
|
||||
function DF:GetDistance_Unit (unit1, unit2)
|
||||
if (UnitExists (unit1) and UnitExists (unit2)) then
|
||||
local u1X, u1Y = UnitPosition (unit1)
|
||||
local u2X, u2Y = UnitPosition (unit2)
|
||||
|
||||
local dX = u2X - u1X
|
||||
local dY = u2Y - u1Y
|
||||
|
||||
return ((dX*dX) + (dY*dY)) ^ .5
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--find distance between two points
|
||||
function DF:GetDistance_Point (x1, y1, x2, y2)
|
||||
local dx = x2 - x1
|
||||
local dy = y2 - y1
|
||||
return ((dx * dx) + (dy * dy)) ^ .5
|
||||
end
|
||||
|
||||
--find a rotation for an object from a point to another point
|
||||
function DF:FindLookAtRotation (x1, y1, x2, y2)
|
||||
return atan2 (y2 - y1, x2 - x1) + pi
|
||||
end
|
||||
|
||||
--find the value scale between two given values. e.g: value of 500 in a range 0-100 result in 10 in a scale for 0-10
|
||||
function DF:MapRangeClamped (inputX, inputY, outputX, outputY, value)
|
||||
return DF:GetRangeValue (outputX, outputY, Clamp (DF:GetRangePercent (inputX, inputY, value), 0, 1))
|
||||
end
|
||||
|
||||
--find the value scale between two given values. e.g: value of 75 in a range 0-100 result in 7.5 in a scale for 0-10
|
||||
function DF:MapRangeUnclamped (inputX, inputY, outputX, outputY, value)
|
||||
return DF:GetRangeValue (outputX, outputY, DF:GetRangePercent (inputX, inputY, value))
|
||||
end
|
||||
|
||||
--find the normalized percent of the value in the range. e.g range of 200-400 and a value of 250 result in 0.25
|
||||
function DF:GetRangePercent (minValue, maxValue, value)
|
||||
return (value - minValue) / max((maxValue - minValue), SMALL_FLOAT)
|
||||
end
|
||||
|
||||
--find the value in the range given from a normalized percent. e.g range of 200-400 and a percent of 0.8 result in 360
|
||||
function DF:GetRangeValue (minValue, maxValue, percent)
|
||||
return Lerp (minValue, maxValue, percent)
|
||||
end
|
||||
|
||||
--dot product of two 2D Vectors
|
||||
function DF:GetDotProduct (value1, value2)
|
||||
return (value1.x * value2.x) + (value1.y * value2.y)
|
||||
end
|
||||
|
||||
--normalized value 0-1 result in the value on the range given, e.g 200-400 range with a value of .5 result in 300
|
||||
function DF:LerpNorm (minValue, maxValue, value)
|
||||
return (minValue + value * (maxValue - minValue))
|
||||
end
|
||||
|
||||
--change the color by the deltaTime
|
||||
function DF:LerpLinearColor (deltaTime, interpSpeed, r1, g1, b1, r2, g2, b2)
|
||||
deltaTime = deltaTime * interpSpeed
|
||||
local r = r1 + (r2 - r1) * deltaTime
|
||||
local g = g1 + (g2 - g1) * deltaTime
|
||||
local b = b1 + (b2 - b1) * deltaTime
|
||||
return r, g, b
|
||||
end
|
||||
|
||||
--check if a number is near another number by a tolerance
|
||||
function DF:IsNearlyEqual (value1, value2, tolerance)
|
||||
tolerance = tolerance or SMALL_FLOAT
|
||||
return abs (value1 - value2) <= tolerance
|
||||
end
|
||||
|
||||
--check if a number is near zero
|
||||
function DF:IsNearlyZero (value, tolerance)
|
||||
tolerance = tolerance or SMALL_FLOAT
|
||||
return abs (value) <= tolerance
|
||||
end
|
||||
|
||||
--check if a number is within a two other numbers, if isInclusive is true, it'll include the max value
|
||||
function DF:IsWithin (minValue, maxValue, value, isInclusive)
|
||||
if (isInclusive) then
|
||||
return ((value >= minValue) and (value <= maxValue))
|
||||
else
|
||||
return ((value >= minValue) and (value < maxValue))
|
||||
end
|
||||
end
|
||||
|
||||
--dont allow a number ot be lower or bigger than a certain range
|
||||
function DF:Clamp (minValue, maxValue, value)
|
||||
return value < minValue and minValue or value < maxValue and value or maxValue
|
||||
end
|
||||
|
||||
--from http://lua-users.org/wiki/SimpleRound cut fractions on a float
|
||||
function DF:Round (num, numDecimalPlaces)
|
||||
local mult = 10^(numDecimalPlaces or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
function DF:ScaleBack ()
|
||||
|
||||
end
|
||||
|
||||
+864
-864
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="normal_bar.lua"/>
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="normal_bar.lua"/>
|
||||
</Ui>
|
||||
|
||||
+119
-109
@@ -654,7 +654,7 @@ function DF:NewPanel (parent, container, name, member, w, h, backdrop, backdropc
|
||||
PanelObject.container = container
|
||||
PanelObject.rightButtonClose = false
|
||||
|
||||
PanelObject.frame = CreateFrame ("frame", name, parent)
|
||||
PanelObject.frame = CreateFrame ("frame", name, parent,"BackdropTemplate")
|
||||
PanelObject.frame:SetSize (100, 100)
|
||||
PanelObject.frame.Gradient = {
|
||||
["OnEnter"] = {0.3, 0.3, 0.3, 0.5},
|
||||
@@ -773,7 +773,8 @@ local align_rows = function (self)
|
||||
end
|
||||
|
||||
local cur_width = 0
|
||||
local row_width = self._width / rows_shown
|
||||
local row_width = self._width / max (rows_shown, 0.0001)
|
||||
|
||||
|
||||
local sindex = 1
|
||||
|
||||
@@ -1074,13 +1075,11 @@ local create_panel_entry = function (self, row)
|
||||
pcall (editbox.onleave_func, editbox)
|
||||
end
|
||||
end)
|
||||
|
||||
editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1})
|
||||
editbox:SetBackdropColor (1, 1, 1, 0.1)
|
||||
editbox:SetBackdropBorderColor (1, 1, 1, 0.1)
|
||||
|
||||
editbox.editbox.current_bordercolor = {1, 1, 1, 0.1}
|
||||
|
||||
editbox:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
|
||||
editbox:SetBackdropColor (.2, .2, .2, 0.7)
|
||||
|
||||
tinsert (row.entry_available, editbox)
|
||||
end
|
||||
@@ -1121,7 +1120,6 @@ end
|
||||
local create_panel_icon = function (self, row)
|
||||
row.icon_total = row.icon_total + 1
|
||||
local iconbutton = DF:NewButton (row, nil, "$parentIconButton" .. row.icon_total, "iconbutton", 22, 20)
|
||||
iconbutton:InstallCustomTexture()
|
||||
|
||||
iconbutton:SetHook ("OnEnter", button_on_enter)
|
||||
iconbutton:SetHook ("OnLeave", button_on_leave)
|
||||
@@ -1324,6 +1322,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
|
||||
if (type (results [index]) == "string") then
|
||||
local result = results [index]:gsub (".-%\\", "")
|
||||
iconwidget._icon.texture = results [index]
|
||||
iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9)
|
||||
|
||||
elseif (type (results [index]) == "table") then
|
||||
iconwidget._icon:SetTexture (results [index].texture)
|
||||
@@ -1332,7 +1331,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
|
||||
if (textCoord) then
|
||||
iconwidget._icon:SetTexCoord (unpack(textCoord))
|
||||
else
|
||||
iconwidget._icon:SetTexCoord (0, 1, 0, 1)
|
||||
iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9)
|
||||
end
|
||||
|
||||
local color = results [index].color
|
||||
@@ -1344,6 +1343,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
|
||||
end
|
||||
else
|
||||
iconwidget._icon:SetTexture (results [index])
|
||||
iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9)
|
||||
end
|
||||
|
||||
iconwidget:Show()
|
||||
@@ -1408,7 +1408,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
|
||||
panel.scrollframe:Show()
|
||||
end
|
||||
|
||||
local scrollframe = CreateFrame ("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate")
|
||||
local scrollframe = CreateFrame ("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate", "BackdropTemplate")
|
||||
scrollframe:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, panel.Refresh) end)
|
||||
scrollframe:SetPoint ("topleft", panel.widget, "topleft", 0, -21)
|
||||
scrollframe:SetPoint ("topright", panel.widget, "topright", -23, -21)
|
||||
@@ -1426,7 +1426,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro
|
||||
local amount = math.floor (((panel._height-21) / size))
|
||||
|
||||
for i = #scrollframe.lines+1, amount do
|
||||
local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget)
|
||||
local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget,"BackdropTemplate")
|
||||
row:SetSize (1, size)
|
||||
row.color = {1, 1, 1, .2}
|
||||
|
||||
@@ -1518,7 +1518,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
|
||||
local string_lower = string.lower
|
||||
|
||||
DF.IconPickFrame = CreateFrame ("frame", "DetailsFrameworkIconPickFrame", UIParent)
|
||||
DF.IconPickFrame = CreateFrame ("frame", "DetailsFrameworkIconPickFrame", UIParent, "BackdropTemplate")
|
||||
tinsert (UISpecialFrames, "DetailsFrameworkIconPickFrame")
|
||||
DF.IconPickFrame:SetFrameStrata ("TOOLTIP")
|
||||
|
||||
@@ -1553,7 +1553,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
DF.IconPickFrame.emptyFunction = function() end
|
||||
DF.IconPickFrame.callback = DF.IconPickFrame.emptyFunction
|
||||
|
||||
DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent)
|
||||
DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent, "BackdropTemplate")
|
||||
DF.IconPickFrame.preview:SetFrameStrata ("tooltip")
|
||||
DF.IconPickFrame.preview:SetFrameLevel (6001)
|
||||
DF.IconPickFrame.preview:SetSize (76, 76)
|
||||
@@ -1612,7 +1612,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
end)
|
||||
|
||||
--> close button
|
||||
local close_button = CreateFrame ("button", nil, DF.IconPickFrame, "UIPanelCloseButton")
|
||||
local close_button = CreateFrame ("button", nil, DF.IconPickFrame, "UIPanelCloseButton", "BackdropTemplate")
|
||||
close_button:SetWidth (32)
|
||||
close_button:SetHeight (32)
|
||||
close_button:SetPoint ("TOPRIGHT", DF.IconPickFrame, "TOPRIGHT", -8, -7)
|
||||
@@ -1651,8 +1651,9 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
for j = offset, tabEnd - 1 do
|
||||
--to get spell info by slot, you have to pass in a pet argument
|
||||
local spellType, ID = GetSpellBookItemInfo (j, "player")
|
||||
if (spellType ~= "FUTURESPELL") then
|
||||
if (spellType ~= "FLYOUT") then
|
||||
MACRO_ICON_FILENAMES [index] = GetSpellBookItemTexture (j, "player") or 0
|
||||
SPELLNAMES_CACHE [index] = GetSpellInfo (ID)
|
||||
index = index + 1
|
||||
|
||||
elseif (spellType == "FLYOUT") then
|
||||
@@ -1662,6 +1663,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo (ID, k)
|
||||
if (isKnown) then
|
||||
MACRO_ICON_FILENAMES [index] = GetSpellTexture (spellID) or 0
|
||||
SPELLNAMES_CACHE [index] = GetSpellInfo (spellID)
|
||||
index = index + 1
|
||||
end
|
||||
end
|
||||
@@ -1684,6 +1686,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
|
||||
DF.IconPickFrame:SetScript ("OnHide", function()
|
||||
wipe (MACRO_ICON_FILENAMES)
|
||||
wipe (SPELLNAMES_CACHE)
|
||||
DF.IconPickFrame.preview:Hide()
|
||||
collectgarbage()
|
||||
end)
|
||||
@@ -1714,7 +1717,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
insets = {left = 0, right = 0, top = 0, bottom = 0}, edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10}
|
||||
|
||||
for i = 0, 9 do
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..(i+1), DF.IconPickFrame)
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..(i+1), DF.IconPickFrame, "BackdropTemplate")
|
||||
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..(i+1).."Icon", "overlay")
|
||||
newcheck.icon = image
|
||||
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
|
||||
@@ -1731,7 +1734,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
newcheck:SetScript ("OnLeave", onleave)
|
||||
end
|
||||
for i = 11, 20 do
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
|
||||
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
|
||||
newcheck.icon = image
|
||||
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
|
||||
@@ -1748,7 +1751,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
newcheck:SetScript ("OnLeave", onleave)
|
||||
end
|
||||
for i = 21, 30 do
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
|
||||
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
|
||||
newcheck.icon = image
|
||||
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
|
||||
@@ -1765,7 +1768,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
newcheck:SetScript ("OnLeave", onleave)
|
||||
end
|
||||
for i = 31, 40 do
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
|
||||
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
|
||||
newcheck.icon = image
|
||||
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
|
||||
@@ -1782,7 +1785,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
newcheck:SetScript ("OnLeave", onleave)
|
||||
end
|
||||
for i = 41, 50 do
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
|
||||
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
|
||||
newcheck.icon = image
|
||||
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
|
||||
@@ -1799,7 +1802,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
newcheck:SetScript ("OnLeave", onleave)
|
||||
end
|
||||
for i = 51, 60 do
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame)
|
||||
local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate")
|
||||
local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay")
|
||||
newcheck.icon = image
|
||||
image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2)
|
||||
@@ -1816,7 +1819,7 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
newcheck:SetScript ("OnLeave", onleave)
|
||||
end
|
||||
|
||||
local scroll = CreateFrame ("ScrollFrame", "DetailsFrameworkIconPickFrameScroll", DF.IconPickFrame, "ListScrollFrameTemplate")
|
||||
local scroll = CreateFrame ("ScrollFrame", "DetailsFrameworkIconPickFrameScroll", DF.IconPickFrame, "ListScrollFrameTemplate", "BackdropTemplate")
|
||||
DF:ReskinSlider (scroll)
|
||||
|
||||
local ChecksFrame_Update = function (self)
|
||||
@@ -1836,23 +1839,10 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
local shown = 0
|
||||
|
||||
if (filter and filter ~= "") then
|
||||
if (#SPELLNAMES_CACHE == 0) then
|
||||
--build name cache
|
||||
local GetSpellInfo = GetSpellInfo
|
||||
for i = 1, #MACRO_ICON_FILENAMES do
|
||||
local spellName = GetSpellInfo (MACRO_ICON_FILENAMES [i])
|
||||
if (spellName) then
|
||||
SPELLNAMES_CACHE [i] = spellName
|
||||
else
|
||||
SPELLNAMES_CACHE [i] = MACRO_ICON_FILENAMES [i]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--do the filter
|
||||
pool = {}
|
||||
for i = 1, #SPELLNAMES_CACHE do
|
||||
if (SPELLNAMES_CACHE [i]:find (filter)) then
|
||||
if (SPELLNAMES_CACHE [i] and SPELLNAMES_CACHE [i]:lower():find (filter)) then
|
||||
pool [#pool+1] = MACRO_ICON_FILENAMES [i]
|
||||
shown = shown + 1
|
||||
end
|
||||
@@ -1917,7 +1907,7 @@ end
|
||||
|
||||
function DF:ShowPanicWarning (text)
|
||||
if (not DF.PanicWarningWindow) then
|
||||
DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent)
|
||||
DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent, "BackdropTemplate")
|
||||
DF.PanicWarningWindow:SetHeight (80)
|
||||
DF.PanicWarningWindow:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
||||
DF.PanicWarningWindow:SetBackdropColor (1, 0, 0, 0.2)
|
||||
@@ -2015,7 +2005,7 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options, db)
|
||||
|
||||
panel_options = panel_options or no_options
|
||||
|
||||
local f = CreateFrame ("frame", name, UIParent)
|
||||
local f = CreateFrame ("frame", name, UIParent,"BackdropTemplate")
|
||||
f:SetSize (w or 400, h or 250)
|
||||
f:SetPoint ("center", UIParent, "center", 0, 0)
|
||||
f:SetFrameStrata ("FULLSCREEN")
|
||||
@@ -2031,7 +2021,7 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options, db)
|
||||
tinsert (UISpecialFrames, name)
|
||||
end
|
||||
|
||||
local title_bar = CreateFrame ("frame", name .. "TitleBar", f)
|
||||
local title_bar = CreateFrame ("frame", name .. "TitleBar", f,"BackdropTemplate")
|
||||
title_bar:SetPoint ("topleft", f, "topleft", 2, -3)
|
||||
title_bar:SetPoint ("topright", f, "topright", -2, -3)
|
||||
title_bar:SetHeight (20)
|
||||
@@ -2190,7 +2180,7 @@ local Panel1PxHasPosition = function (self)
|
||||
end
|
||||
|
||||
function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_special_frame)
|
||||
local f = CreateFrame ("frame", name, parent or UIParent)
|
||||
local f = CreateFrame ("frame", name, parent or UIParent, "BackdropTemplate")
|
||||
f:SetSize (w or 100, h or 75)
|
||||
f:SetPoint ("center", UIParent, "center")
|
||||
|
||||
@@ -2213,7 +2203,7 @@ function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_
|
||||
--print (config.position.x, config.position.x)
|
||||
Panel1PxReadConfig (f)
|
||||
|
||||
local close = CreateFrame ("button", name and name .. "CloseButton", f)
|
||||
local close = CreateFrame ("button", name and name .. "CloseButton", f, "BackdropTemplate")
|
||||
close:SetSize (16, 16)
|
||||
close:SetNormalTexture (DF.folder .. "icons")
|
||||
close:SetHighlightTexture (DF.folder .. "icons")
|
||||
@@ -2223,7 +2213,7 @@ function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_
|
||||
close:GetPushedTexture():SetTexCoord (0, 16/128, 0, 1)
|
||||
close:SetAlpha (0.7)
|
||||
|
||||
local lock = CreateFrame ("button", name and name .. "LockButton", f)
|
||||
local lock = CreateFrame ("button", name and name .. "LockButton", f, "BackdropTemplate")
|
||||
lock:SetSize (16, 16)
|
||||
lock:SetNormalTexture (DF.folder .. "icons")
|
||||
lock:SetHighlightTexture (DF.folder .. "icons")
|
||||
@@ -2272,7 +2262,7 @@ end
|
||||
function DF:ShowPromptPanel (message, func_true, func_false, no_repeated, width)
|
||||
|
||||
if (not DetailsFrameworkPromptSimple) then
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkPromptSimple", UIParent)
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkPromptSimple", UIParent, "BackdropTemplate")
|
||||
f:SetSize (400, 80)
|
||||
f:SetFrameStrata ("DIALOG")
|
||||
f:SetPoint ("center", UIParent, "center", 0, 300)
|
||||
@@ -2373,7 +2363,7 @@ function DF:ShowTextPromptPanel (message, callback)
|
||||
|
||||
if (not DF.text_prompt_panel) then
|
||||
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent)
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent, "BackdropTemplate")
|
||||
f:SetSize (400, 120)
|
||||
f:SetFrameStrata ("FULLSCREEN")
|
||||
f:SetPoint ("center", UIParent, "center", 0, 100)
|
||||
@@ -2446,7 +2436,7 @@ end
|
||||
--> options button -- ~options
|
||||
function DF:CreateOptionsButton (parent, callback, name)
|
||||
|
||||
local b = CreateFrame ("button", name, parent)
|
||||
local b = CreateFrame ("button", name, parent, "BackdropTemplate")
|
||||
b:SetSize (14, 14)
|
||||
b:SetNormalTexture (DF.folder .. "icons")
|
||||
b:SetHighlightTexture (DF.folder .. "icons")
|
||||
@@ -2474,7 +2464,7 @@ end
|
||||
--> feedback panel -- ~feedback
|
||||
|
||||
function DF:CreateFeedbackButton (parent, callback, name)
|
||||
local b = CreateFrame ("button", name, parent)
|
||||
local b = CreateFrame ("button", name, parent, "BackdropTemplate")
|
||||
b:SetSize (12, 13)
|
||||
b:SetNormalTexture (DF.folder .. "mail")
|
||||
b:SetPushedTexture (DF.folder .. "mail")
|
||||
@@ -2543,7 +2533,7 @@ local feedback_get_fb_line = function (self)
|
||||
|
||||
local line = self.feedback_lines [self.next_feedback]
|
||||
if (not line) then
|
||||
line = CreateFrame ("frame", "AddonFeedbackPanelFB" .. self.next_feedback, self)
|
||||
line = CreateFrame ("frame", "AddonFeedbackPanelFB" .. self.next_feedback, self, "BackdropTemplate")
|
||||
line:SetBackdrop (backdrop_fb_line)
|
||||
line:SetBackdropColor (0, 0, 0, 0.3)
|
||||
line:SetSize (390, 42)
|
||||
@@ -2664,7 +2654,7 @@ local feedback_get_addons_line = function (self)
|
||||
local line = self.addons_lines [self.next_addons]
|
||||
if (not line) then
|
||||
|
||||
line = CreateFrame ("frame", "AddonFeedbackPanelSA" .. self.next_addons, self)
|
||||
line = CreateFrame ("frame", "AddonFeedbackPanelSA" .. self.next_addons, self, "BackdropTemplate")
|
||||
line:SetSize (128, 64)
|
||||
|
||||
if (self.next_addons == 1) then
|
||||
@@ -2977,7 +2967,7 @@ local create_box = function (self, next_box)
|
||||
thisbox.check = checktexture
|
||||
thisbox.enabled = true
|
||||
|
||||
local button = CreateFrame ("button", nil, self.Graphic)
|
||||
local button = CreateFrame ("button", nil, self.Graphic, "BackdropTemplate")
|
||||
button:SetSize (20, 20)
|
||||
button:SetScript ("OnClick", function()
|
||||
chart_panel_enable_line (self, thisbox)
|
||||
@@ -3475,7 +3465,7 @@ function DF:CreateChartPanel (parent, w, h, name)
|
||||
w = w or 800
|
||||
h = h or 500
|
||||
|
||||
local f = CreateFrame ("frame", name, parent)
|
||||
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
f:SetSize (w or 500, h or 400)
|
||||
f:EnableMouse (true)
|
||||
f:SetMovable (true)
|
||||
@@ -3486,7 +3476,7 @@ function DF:CreateChartPanel (parent, w, h, name)
|
||||
f:SetBackdrop (chart_panel_backdrop)
|
||||
f:SetBackdropColor (.3, .3, .3, .3)
|
||||
|
||||
local c = CreateFrame ("Button", nil, f, "UIPanelCloseButton")
|
||||
local c = CreateFrame ("Button", nil, f, "UIPanelCloseButton", "BackdropTemplate")
|
||||
c:SetWidth (32)
|
||||
c:SetHeight (32)
|
||||
c:SetPoint ("TOPRIGHT", f, "TOPRIGHT", -3, -7)
|
||||
@@ -3625,7 +3615,7 @@ end
|
||||
local gframe_create_line = function (self)
|
||||
local index = #self._lines+1
|
||||
|
||||
local f = CreateFrame ("frame", nil, self)
|
||||
local f = CreateFrame ("frame", nil, self, "BackdropTemplate")
|
||||
self._lines [index] = f
|
||||
f.id = index
|
||||
f:SetScript ("OnEnter", gframe_on_enter_line)
|
||||
@@ -3653,7 +3643,7 @@ local gframe_create_line = function (self)
|
||||
b:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
|
||||
b:SetSize (16, 16)
|
||||
f.ball = b
|
||||
local anchor = CreateFrame ("frame", nil, f)
|
||||
local anchor = CreateFrame ("frame", nil, f, "BackdropTemplate")
|
||||
anchor:SetAllPoints (b)
|
||||
b.tooltip_anchor = anchor
|
||||
|
||||
@@ -3760,7 +3750,7 @@ local gframe_update = function (self, lines)
|
||||
end
|
||||
|
||||
function DF:CreateGFrame (parent, w, h, linewidth, onenter, onleave, member, name)
|
||||
local f = CreateFrame ("frame", name, parent)
|
||||
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
f:SetSize (w or 450, h or 150)
|
||||
--f.CustomLine = [[Interface\AddOns\Details\Libs\LibGraph-2.0\line]]
|
||||
|
||||
@@ -3791,7 +3781,7 @@ end
|
||||
-- ~buttoncontainer
|
||||
|
||||
function DF:CreateButtonContainer (parent, name)
|
||||
local f = CreateFrame ("frame", name, parent)
|
||||
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
-- f.
|
||||
end
|
||||
|
||||
@@ -3923,7 +3913,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
|
||||
local button_anchor_y = options_table.button_y or -32
|
||||
local button_text_size = options_table.button_text_size or 10
|
||||
|
||||
local mainFrame = CreateFrame ("frame", frame_name, parent.widget or parent)
|
||||
local mainFrame = CreateFrame ("frame", frame_name, parent.widget or parent, "BackdropTemplate")
|
||||
mainFrame:SetAllPoints()
|
||||
DF:Mixin (mainFrame, DF.TabContainerFunctions)
|
||||
|
||||
@@ -3946,7 +3936,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t
|
||||
end
|
||||
|
||||
for i, frame in ipairs (frame_list) do
|
||||
local f = CreateFrame ("frame", "$parent" .. frame.name, mainFrame)
|
||||
local f = CreateFrame ("frame", "$parent" .. frame.name, mainFrame, "BackdropTemplate")
|
||||
f:SetAllPoints()
|
||||
f:SetFrameLevel (210)
|
||||
f:Hide()
|
||||
@@ -4163,7 +4153,7 @@ local simple_list_box_SetData = function (self, t)
|
||||
end
|
||||
|
||||
function DF:CreateSimpleListBox (parent, name, title, empty_text, list_table, onclick, options)
|
||||
local f = CreateFrame ("frame", name, parent)
|
||||
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
|
||||
f.ResetWidgets = simple_list_box_ResetWidgets
|
||||
f.GetOrCreateWidget = simple_list_box_GetOrCreateWidget
|
||||
@@ -4380,7 +4370,7 @@ DF.ScrollBoxFunctions.OnSizeChanged = function (self)
|
||||
end
|
||||
|
||||
function DF:CreateScrollBox (parent, name, refresh_func, data, width, height, line_amount, line_height, create_line_func, auto_amount, no_scroll)
|
||||
local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate")
|
||||
local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate,BackdropTemplate")
|
||||
|
||||
DF:ApplyStandardBackdrop (scroll)
|
||||
|
||||
@@ -4413,8 +4403,8 @@ function DF:CreateResizeGrips (parent)
|
||||
if (parent) then
|
||||
local parentName = parent:GetName()
|
||||
|
||||
local leftResizer = CreateFrame ("button", parentName and parentName .. "LeftResizer" or nil, parent)
|
||||
local rightResizer = CreateFrame ("button", parentName and parentName .. "RightResizer" or nil, parent)
|
||||
local leftResizer = CreateFrame ("button", parentName and parentName .. "LeftResizer" or nil, parent, "BackdropTemplate")
|
||||
local rightResizer = CreateFrame ("button", parentName and parentName .. "RightResizer" or nil, parent, "BackdropTemplate")
|
||||
|
||||
leftResizer:SetPoint ("bottomleft", parent, "bottomleft")
|
||||
rightResizer:SetPoint ("bottomright", parent, "bottomright")
|
||||
@@ -4509,11 +4499,11 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
|
||||
local SCROLL_ROLL_AMOUNT = line_amount
|
||||
|
||||
--keybind set frame
|
||||
local new_keybind_frame = CreateFrame ("frame", name, parent)
|
||||
local new_keybind_frame = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
new_keybind_frame:SetSize (width, height)
|
||||
|
||||
-- keybind scrollframe
|
||||
local keybindScroll = CreateFrame ("scrollframe", "$parentScrollFrame", new_keybind_frame, "FauxScrollFrameTemplate")
|
||||
local keybindScroll = CreateFrame ("scrollframe", "$parentScrollFrame", new_keybind_frame, "FauxScrollFrameTemplate, BackdropTemplate")
|
||||
keybindScroll:SetSize (1019, 348)
|
||||
keybindScroll.Frames = {}
|
||||
new_keybind_frame.keybindScroll = keybindScroll
|
||||
@@ -4607,7 +4597,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
|
||||
spec4:SetPoint ("topleft", specsTitle, "bottomleft", 0, -70)
|
||||
end
|
||||
|
||||
local enter_the_key = CreateFrame ("frame", nil, new_keybind_frame)
|
||||
local enter_the_key = CreateFrame ("frame", nil, new_keybind_frame, "BackdropTemplate")
|
||||
enter_the_key:SetFrameStrata ("tooltip")
|
||||
enter_the_key:SetSize (200, 60)
|
||||
enter_the_key:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
|
||||
@@ -4817,7 +4807,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
|
||||
local font = "GameFontHighlightSmall"
|
||||
|
||||
for i = 1, SCROLL_ROLL_AMOUNT do
|
||||
local f = CreateFrame ("frame", "$KeyBindFrame" .. i, keybindScroll)
|
||||
local f = CreateFrame ("frame", "$KeyBindFrame" .. i, keybindScroll, "BackdropTemplate")
|
||||
f:SetSize (1009, 20)
|
||||
f:SetPoint ("topleft", keybindScroll, "topleft", 0, -(i-1)*29)
|
||||
f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
||||
@@ -4866,7 +4856,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_
|
||||
f.ActionText:SetAsAutoComplete ("WordList")
|
||||
end
|
||||
|
||||
local header = CreateFrame ("frame", "$parentOptionsPanelFrameHeader", keybindScroll)
|
||||
local header = CreateFrame ("frame", "$parentOptionsPanelFrameHeader", keybindScroll, "BackdropTemplate")
|
||||
header:SetPoint ("bottomleft", keybindScroll, "topleft", 0, 2)
|
||||
header:SetPoint ("bottomright", keybindScroll, "topright", 0, 2)
|
||||
header:SetHeight (16)
|
||||
@@ -5009,6 +4999,10 @@ end
|
||||
function DF:ApplyStandardBackdrop (f, darkTheme, alphaScale)
|
||||
alphaScale = alphaScale or 1.0
|
||||
|
||||
if(not f.SetBackdrop)then
|
||||
print(debugstack(1,2,1))
|
||||
end
|
||||
|
||||
if (darkTheme) then
|
||||
f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Cooldown\cooldown2]], tileSize = 32, tile = true})
|
||||
f:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
@@ -5058,7 +5052,7 @@ DF.TitleFunctions = {
|
||||
|
||||
function DF:CreateTitleBar (f, titleText)
|
||||
|
||||
local titleBar = CreateFrame ("frame", f:GetName() and f:GetName() .. "TitleBar" or nil, f)
|
||||
local titleBar = CreateFrame ("frame", f:GetName() and f:GetName() .. "TitleBar" or nil, f,"BackdropTemplate")
|
||||
titleBar:SetPoint ("topleft", f, "topleft", 2, -3)
|
||||
titleBar:SetPoint ("topright", f, "topright", -2, -3)
|
||||
titleBar:SetHeight (20)
|
||||
@@ -5066,7 +5060,7 @@ function DF:CreateTitleBar (f, titleText)
|
||||
titleBar:SetBackdropColor (.2, .2, .2, 1)
|
||||
titleBar:SetBackdropBorderColor (0, 0, 0, 1)
|
||||
|
||||
local closeButton = CreateFrame ("button", titleBar:GetName() and titleBar:GetName() .. "CloseButton" or nil, titleBar)
|
||||
local closeButton = CreateFrame ("button", titleBar:GetName() and titleBar:GetName() .. "CloseButton" or nil, titleBar, "BackdropTemplate")
|
||||
closeButton:SetSize (16, 16)
|
||||
closeButton:SetNormalTexture (DF.folder .. "icons")
|
||||
closeButton:SetHighlightTexture (DF.folder .. "icons")
|
||||
@@ -5090,6 +5084,9 @@ function DF:CreateTitleBar (f, titleText)
|
||||
f.CloseButton = closeButton
|
||||
f.TitleLabel = titleLabel
|
||||
|
||||
titleBar.CloseButton = closeButton
|
||||
titleBar.Text = titleLabel
|
||||
|
||||
DF:Mixin (f, DF.TitleFunctions)
|
||||
|
||||
return titleBar
|
||||
@@ -5105,7 +5102,7 @@ DF.IconRowFunctions = {
|
||||
local iconFrame = self.IconPool [self.NextIcon]
|
||||
|
||||
if (not iconFrame) then
|
||||
local newIconFrame = CreateFrame ("frame", "$parentIcon" .. self.NextIcon, self)
|
||||
local newIconFrame = CreateFrame ("frame", "$parentIcon" .. self.NextIcon, self, "BackdropTemplate")
|
||||
|
||||
newIconFrame.Texture = newIconFrame:CreateTexture (nil, "artwork")
|
||||
PixelUtil.SetPoint (newIconFrame.Texture, "topleft", newIconFrame, "topleft", 1, -1)
|
||||
@@ -5119,7 +5116,7 @@ DF.IconRowFunctions = {
|
||||
newIconFrame:SetBackdropBorderColor (0, 0, 0, 0)
|
||||
newIconFrame:EnableMouse (false)
|
||||
|
||||
local cooldownFrame = CreateFrame ("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate")
|
||||
local cooldownFrame = CreateFrame ("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate, BackdropTemplate")
|
||||
cooldownFrame:SetAllPoints()
|
||||
cooldownFrame:EnableMouse (false)
|
||||
cooldownFrame:SetFrameLevel (newIconFrame:GetFrameLevel()+1)
|
||||
@@ -5352,7 +5349,7 @@ local default_icon_row_options = {
|
||||
}
|
||||
|
||||
function DF:CreateIconRow (parent, name, options)
|
||||
local f = CreateFrame ("frame", name, parent)
|
||||
local f = CreateFrame("frame", name, parent, "BackdropTemplate")
|
||||
f.IconPool = {}
|
||||
f.NextIcon = 1
|
||||
|
||||
@@ -5696,7 +5693,7 @@ DF.HeaderCoreFunctions = {
|
||||
|
||||
if (not columnHeader) then
|
||||
--create a new column header
|
||||
local newHeader = CreateFrame ("button", "$parentHeaderIndex" .. nextHeader, self)
|
||||
local newHeader = CreateFrame ("button", "$parentHeaderIndex" .. nextHeader, self,"BackdropTemplate")
|
||||
newHeader:SetScript ("OnClick", DF.HeaderFunctions.OnClick)
|
||||
|
||||
--header icon
|
||||
@@ -5764,7 +5761,7 @@ local default_header_options = {
|
||||
}
|
||||
|
||||
function DF:CreateHeader (parent, headerTable, options, frameName)
|
||||
local f = CreateFrame ("frame", frameName or "$parentHeaderLine", parent)
|
||||
local f = CreateFrame ("frame", frameName or "$parentHeaderLine", parent,"BackdropTemplate")
|
||||
|
||||
DF:Mixin (f, DF.OptionsFunctions)
|
||||
DF:Mixin (f, DF.HeaderCoreFunctions)
|
||||
@@ -5929,7 +5926,7 @@ DF.RadioGroupCoreFunctions = {
|
||||
anchorOptions: override options for default_framelayout_options table
|
||||
--]=]
|
||||
function DF:CreateRadionGroup (parent, radioOptions, name, options, anchorOptions)
|
||||
local f = CreateFrame ("frame", name, parent)
|
||||
local f = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
|
||||
DF:Mixin (f, DF.OptionsFunctions)
|
||||
DF:Mixin (f, DF.RadioGroupCoreFunctions)
|
||||
@@ -6233,8 +6230,8 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
pvptalent = {x2StartAt, -70},
|
||||
group = {x2StartAt, -210},
|
||||
affix = {x2StartAt, -270},
|
||||
encounter_ids = {x2StartAt, -360},
|
||||
map_ids = {x2StartAt, -400},
|
||||
encounter_ids = {x2StartAt, -400},
|
||||
map_ids = {x2StartAt, -440},
|
||||
}
|
||||
|
||||
local editingLabel = DF:CreateLabel (f, "Load Conditions For:")
|
||||
@@ -6336,7 +6333,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
|
||||
do
|
||||
--create a frame to show talents selected in other specs or characters
|
||||
local otherTalents = CreateFrame ("frame", nil, f)
|
||||
local otherTalents = CreateFrame ("frame", nil, f, "BackdropTemplate")
|
||||
otherTalents:SetSize (26, 26)
|
||||
otherTalents:SetPoint ("left", talentGroup.Title.widget, "right", 10, -2)
|
||||
otherTalents.Texture = DF:CreateImage (otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24)
|
||||
@@ -6434,7 +6431,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
|
||||
do
|
||||
--create a frame to show talents selected in other specs or characters
|
||||
local otherTalents = CreateFrame ("frame", nil, f)
|
||||
local otherTalents = CreateFrame ("frame", nil, f, "BackdropTemplate")
|
||||
otherTalents:SetSize (26, 26)
|
||||
otherTalents:SetPoint ("left", pvpTalentGroup.Title.widget, "right", 10, -2)
|
||||
otherTalents.Texture = DF:CreateImage (otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24)
|
||||
@@ -6713,7 +6710,7 @@ DF.DataScrollFunctions = {
|
||||
|
||||
CreateLine = function (self, index)
|
||||
--create a new line
|
||||
local line = CreateFrame ("button", "$parentLine" .. index, self)
|
||||
local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate")
|
||||
line.Update = self.options.update_line_func
|
||||
|
||||
--set its parameters
|
||||
@@ -6944,7 +6941,6 @@ end
|
||||
]]
|
||||
|
||||
function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString)
|
||||
|
||||
local authorName = DF:CreateLabel (f, "" .. (addonBy or "An addon by") .. "|cFFFFFFFF" .. (authorsNameString or "Terciob") .. "|r")
|
||||
authorName.textcolor = "silver"
|
||||
local discordLabel = DF:CreateLabel (f, "Discord: ")
|
||||
@@ -6969,6 +6965,9 @@ function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString)
|
||||
discordTextEntry:HighlightText()
|
||||
end)
|
||||
|
||||
f.authorName = authorName
|
||||
f.discordLabel = discordLabel
|
||||
f.discordTextEntry = discordTextEntry
|
||||
end
|
||||
|
||||
local statusbar_default_options = {
|
||||
@@ -6976,7 +6975,7 @@ local statusbar_default_options = {
|
||||
}
|
||||
|
||||
function DF:CreateStatusBar(f, options)
|
||||
local statusBar = CreateFrame ("frame", nil, f)
|
||||
local statusBar = CreateFrame ("frame", nil, f, "BackdropTemplate")
|
||||
|
||||
DF:Mixin (statusBar, DF.OptionsFunctions)
|
||||
DF:Mixin (statusBar, DF.LayoutFrame)
|
||||
@@ -7109,6 +7108,7 @@ DF.StatusBarFunctions = {
|
||||
|
||||
dversion = DF.dversion,
|
||||
}
|
||||
|
||||
--check if there's a metaPrototype already existing
|
||||
if (_G[DF.GlobalWidgetControlNames["healthBar"]]) then
|
||||
--get the already existing metaPrototype
|
||||
@@ -7163,9 +7163,9 @@ DF.StatusBarFunctions = {
|
||||
|
||||
healthBarMetaFunctions.HealthBarEvents = {
|
||||
{"PLAYER_ENTERING_WORLD"},
|
||||
--{"UNIT_HEALTH", true},
|
||||
{"UNIT_HEALTH", true},
|
||||
{"UNIT_MAXHEALTH", true},
|
||||
{"UNIT_HEALTH_FREQUENT", true},
|
||||
--{"UNIT_HEALTH_FREQUENT", true},
|
||||
{"UNIT_HEAL_PREDICTION", true},
|
||||
{"UNIT_ABSORB_AMOUNT_CHANGED", true},
|
||||
{"UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true},
|
||||
@@ -7401,7 +7401,7 @@ function DF:CreateHealthBar (parent, name, settingsOverride)
|
||||
|
||||
assert (name or parent:GetName(), "DetailsFramework:CreateHealthBar parameter 'name' omitted and parent has no name.")
|
||||
|
||||
local healthBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "HealthBar"), parent)
|
||||
local healthBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "HealthBar"), parent, "BackdropTemplate")
|
||||
do --layers
|
||||
--background
|
||||
healthBar.background = healthBar:CreateTexture (nil, "background")
|
||||
@@ -7599,10 +7599,13 @@ DF.PowerFrameFunctions = {
|
||||
--> when a event different from unit_power_update is triggered, update which type of power the unit should show
|
||||
UpdatePowerInfo = function (self)
|
||||
if (self.Settings.ShowAlternatePower) then
|
||||
local _, minPower, _, _, _, _, showOnRaid = UnitAlternatePowerInfo (self.displayedUnit)
|
||||
if (showOnRaid and IsInGroup()) then
|
||||
local barID = UnitPowerBarID(self.displayedUnit)
|
||||
local barInfo = GetUnitPowerBarInfoByID(barID)
|
||||
--local name, tooltip, cost = GetUnitPowerBarStringsByID(barID);
|
||||
--barInfo.barType,barInfo.minPower, barInfo.startInset, barInfo.endInset, barInfo.smooth, barInfo.hideFromOthers, barInfo.showOnRaid, barInfo.opaqueSpark, barInfo.opaqueFlash, barInfo.anchorTop, name, tooltip, cost, barInfo.ID, barInfo.forcePercentage, barInfo.sparkUnderFrame;
|
||||
if (barInfo and barInfo.showOnRaid and IsInGroup()) then
|
||||
self.powerType = ALTERNATE_POWER_INDEX
|
||||
self.minPower = minPower
|
||||
self.minPower = barInfo.minPower
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -7672,7 +7675,7 @@ function DF:CreatePowerBar (parent, name, settingsOverride)
|
||||
|
||||
assert (name or parent:GetName(), "DetailsFramework:CreatePowerBar parameter 'name' omitted and parent has no name.")
|
||||
|
||||
local powerBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "PowerBar"), parent)
|
||||
local powerBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "PowerBar"), parent, "BackdropTemplate")
|
||||
do --layers
|
||||
--background
|
||||
powerBar.background = powerBar:CreateTexture (nil, "background")
|
||||
@@ -8300,7 +8303,7 @@ DF.CastFrameFunctions = {
|
||||
|
||||
self.flashTexture:Hide()
|
||||
self:Animation_StopAllAnimations()
|
||||
|
||||
|
||||
self:SetAlpha (1)
|
||||
|
||||
--> set the statusbar color
|
||||
@@ -8312,7 +8315,7 @@ DF.CastFrameFunctions = {
|
||||
|
||||
self.Spark:Show()
|
||||
self:Show()
|
||||
|
||||
|
||||
--> update the interrupt cast border
|
||||
self:UpdateInterruptState()
|
||||
|
||||
@@ -8362,14 +8365,14 @@ DF.CastFrameFunctions = {
|
||||
|
||||
--> set the statusbar color
|
||||
self:UpdateCastColor()
|
||||
|
||||
|
||||
if (not self:IsShown()) then
|
||||
self:Animation_FadeIn()
|
||||
end
|
||||
|
||||
self.Spark:Show()
|
||||
self:Show()
|
||||
|
||||
|
||||
--> update the interrupt cast border
|
||||
self:UpdateInterruptState()
|
||||
|
||||
@@ -8539,7 +8542,7 @@ function DF:CreateCastBar (parent, name, settingsOverride)
|
||||
|
||||
assert (name or parent:GetName(), "DetailsFramework:CreateCastBar parameter 'name' omitted and parent has no name.")
|
||||
|
||||
local castBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "CastBar"), parent)
|
||||
local castBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "CastBar"), parent, "BackdropTemplate")
|
||||
|
||||
do --layers
|
||||
|
||||
@@ -8657,7 +8660,7 @@ function DF:CreateBorderFrame (parent, name)
|
||||
|
||||
local parentName = name or "DetailsFrameworkBorderFrame" .. tostring (math.random (1, 100000000))
|
||||
|
||||
local f = CreateFrame ("frame", parentName, parent)
|
||||
local f = CreateFrame ("frame", parentName, parent, "BackdropTemplate")
|
||||
f:SetFrameLevel (f:GetFrameLevel()+1)
|
||||
f:SetAllPoints()
|
||||
|
||||
@@ -9162,7 +9165,7 @@ function DF:CreateUnitFrame (parent, name, unitFrameSettingsOverride, healthBarS
|
||||
local parentName = name or ("DetailsFrameworkUnitFrame" .. tostring (math.random (1, 100000000)))
|
||||
|
||||
--> create the main unit frame
|
||||
local f = CreateFrame ("button", parentName, parent)
|
||||
local f = CreateFrame ("button", parentName, parent, "BackdropTemplate")
|
||||
|
||||
--> base level
|
||||
local baseFrameLevel = f:GetFrameLevel()
|
||||
@@ -9188,7 +9191,7 @@ function DF:CreateUnitFrame (parent, name, unitFrameSettingsOverride, healthBarS
|
||||
f.border = borderFrame
|
||||
|
||||
--> overlay frame (widgets that need to stay above the unit frame)
|
||||
local overlayFrame = CreateFrame ("frame", "$parentOverlayFrame", f)
|
||||
local overlayFrame = CreateFrame ("frame", "$parentOverlayFrame", f, "BackdropTemplate")
|
||||
borderFrame:SetFrameLevel (f:GetFrameLevel() + 6)
|
||||
f.overlayFrame = overlayFrame
|
||||
|
||||
@@ -9362,7 +9365,7 @@ DF.TimeLineElapsedTimeFunctions = {
|
||||
|
||||
--creates a frame to show the elapsed time in a row
|
||||
function DF:CreateElapsedTimeFrame (parent, name, options)
|
||||
local elapsedTimeFrame = CreateFrame ("frame", name, parent)
|
||||
local elapsedTimeFrame = CreateFrame ("frame", name, parent, "BackdropTemplate")
|
||||
|
||||
DF:Mixin (elapsedTimeFrame, DF.OptionsFunctions)
|
||||
DF:Mixin (elapsedTimeFrame, DF.LayoutFrame)
|
||||
@@ -9429,7 +9432,7 @@ DF.TimeLineBlockFunctions = {
|
||||
else
|
||||
self.icon:SetTexture (nil)
|
||||
self.text:SetText (lineData.text or "")
|
||||
text:SetPoint ("left", self, "left", 2, 0)
|
||||
self.text:SetPoint ("left", self, "left", 2, 0)
|
||||
end
|
||||
|
||||
if (self.dataIndex % 2 == 1) then
|
||||
@@ -9439,12 +9442,14 @@ DF.TimeLineBlockFunctions = {
|
||||
self:SetBackdropColor (r, g, b, a)
|
||||
end
|
||||
|
||||
self:SetWidth (5000)
|
||||
self:SetWidth(5000)
|
||||
|
||||
local timelineData = lineData.timeline
|
||||
local spellId = lineData.spellId
|
||||
local useIconOnBlock = data.useIconOnBlocks
|
||||
|
||||
local baseFrameLevel = parent:GetFrameLevel() + 10
|
||||
|
||||
for i = 1, #timelineData do
|
||||
local blockInfo = timelineData [i]
|
||||
|
||||
@@ -9453,6 +9458,8 @@ DF.TimeLineBlockFunctions = {
|
||||
local isAura = blockInfo [3]
|
||||
local auraDuration = blockInfo [4]
|
||||
|
||||
local payload = blockInfo.payload
|
||||
|
||||
local xOffset = pixelPerSecond * time
|
||||
local width = pixelPerSecond * length
|
||||
|
||||
@@ -9460,13 +9467,16 @@ DF.TimeLineBlockFunctions = {
|
||||
xOffset = xOffset / 2.5
|
||||
end
|
||||
|
||||
local block = self:GetBlock (i)
|
||||
local block = self:GetBlock(i)
|
||||
block:Show()
|
||||
PixelUtil.SetPoint (block, "left", self, "left", xOffset + headerWidth, 0)
|
||||
block:SetFrameLevel(baseFrameLevel + i)
|
||||
|
||||
PixelUtil.SetPoint(block, "left", self, "left", xOffset + headerWidth, 0)
|
||||
|
||||
block.info.spellId = spellId
|
||||
block.info.time = time
|
||||
block.info.duration = auraDuration
|
||||
block.info.payload = payload
|
||||
|
||||
if (useIconOnBlock) then
|
||||
block.icon:SetTexture (lineData.icon)
|
||||
@@ -9502,7 +9512,7 @@ DF.TimeLineBlockFunctions = {
|
||||
GetBlock = function (self, index)
|
||||
local block = self.blocks [index]
|
||||
if (not block) then
|
||||
block = CreateFrame ("frame", nil, self)
|
||||
block = CreateFrame ("frame", nil, self, "BackdropTemplate")
|
||||
self.blocks [index] = block
|
||||
|
||||
local background = block:CreateTexture (nil, "background")
|
||||
@@ -9549,7 +9559,7 @@ DF.TimeLineFunctions = {
|
||||
local line = self.lines [index]
|
||||
if (not line) then
|
||||
--create a new line
|
||||
line = CreateFrame ("frame", "$parentLine" .. index, self.body)
|
||||
line = CreateFrame ("frame", "$parentLine" .. index, self.body, "BackdropTemplate")
|
||||
DF:Mixin (line, DF.TimeLineBlockFunctions)
|
||||
self.lines [index] = line
|
||||
|
||||
@@ -9680,7 +9690,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
|
||||
local scrollWidth = 800 --placeholder until the timeline receives data
|
||||
local scrollHeight = 800 --placeholder until the timeline receives data
|
||||
|
||||
local frameCanvas = CreateFrame ("scrollframe", name, parent)
|
||||
local frameCanvas = CreateFrame ("scrollframe", name, parent, "BackdropTemplate")
|
||||
DF:Mixin (frameCanvas, DF.TimeLineFunctions)
|
||||
|
||||
frameCanvas.data = {}
|
||||
@@ -9693,7 +9703,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
|
||||
insets = {left = 1, right = 1, top = 0, bottom = 1},})
|
||||
frameCanvas:SetBackdropColor (.1, .1, .1, .3)
|
||||
|
||||
local frameBody = CreateFrame ("frame", nil, frameCanvas)
|
||||
local frameBody = CreateFrame ("frame", nil, frameCanvas, "BackdropTemplate")
|
||||
frameBody:SetSize (scrollWidth, scrollHeight)
|
||||
|
||||
frameCanvas:SetScrollChild (frameBody)
|
||||
@@ -9708,7 +9718,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
|
||||
frameCanvas.elapsedTimeFrame = DF:CreateElapsedTimeFrame (frameBody, frameCanvas:GetName() and frameCanvas:GetName() .. "ElapsedTimeFrame", timelineOptions)
|
||||
|
||||
--create horizontal slider
|
||||
local horizontalSlider = CreateFrame ("slider", nil, parent)
|
||||
local horizontalSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate")
|
||||
horizontalSlider.bg = horizontalSlider:CreateTexture (nil, "background")
|
||||
horizontalSlider.bg:SetAllPoints (true)
|
||||
horizontalSlider.bg:SetTexture (0, 0, 0, 0.5)
|
||||
@@ -9731,7 +9741,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
|
||||
horizontalSlider:SetValue (0)
|
||||
horizontalSlider:SetScript ("OnValueChanged", function (self)
|
||||
local _, maxValue = horizontalSlider:GetMinMaxValues()
|
||||
local stepValue = ceil (ceil(self:GetValue() * maxValue)/maxValue)
|
||||
local stepValue = ceil (ceil(self:GetValue() * maxValue) / max(maxValue, SMALL_FLOAT))
|
||||
if (stepValue ~= horizontalSlider.currentValue) then
|
||||
horizontalSlider.currentValue = stepValue
|
||||
frameCanvas:SetHorizontalScroll (stepValue)
|
||||
@@ -9741,7 +9751,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
|
||||
frameCanvas.horizontalSlider = horizontalSlider
|
||||
|
||||
--create scale slider
|
||||
local scaleSlider = CreateFrame ("slider", nil, parent)
|
||||
local scaleSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate")
|
||||
scaleSlider.bg = scaleSlider:CreateTexture (nil, "background")
|
||||
scaleSlider.bg:SetAllPoints (true)
|
||||
scaleSlider.bg:SetTexture (0, 0, 0, 0.5)
|
||||
@@ -9775,7 +9785,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
|
||||
end)
|
||||
|
||||
--create vertical slider
|
||||
local verticalSlider = CreateFrame ("slider", nil, parent)
|
||||
local verticalSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate")
|
||||
verticalSlider.bg = verticalSlider:CreateTexture (nil, "background")
|
||||
verticalSlider.bg:SetAllPoints (true)
|
||||
verticalSlider.bg:SetTexture (0, 0, 0, 0.5)
|
||||
@@ -9890,7 +9900,7 @@ f:Hide()
|
||||
function DF:ShowErrorMessage (errorMessage, titleText)
|
||||
|
||||
if (not DF.ErrorMessagePanel) then
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkErrorMessagePanel", UIParent)
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkErrorMessagePanel", UIParent, "BackdropTemplate")
|
||||
f:SetSize (400, 120)
|
||||
f:SetFrameStrata ("FULLSCREEN")
|
||||
f:SetPoint ("center", UIParent, "center", 0, 100)
|
||||
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="panel.lua"/>
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="panel.lua"/>
|
||||
</Ui>
|
||||
|
||||
+313
-313
@@ -1,313 +1,313 @@
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local _
|
||||
local _rawset = rawset --> lua local
|
||||
local _rawget = rawget --> lua local
|
||||
local _setmetatable = setmetatable --> lua local
|
||||
local _unpack = unpack --> lua local
|
||||
local _type = type --> lua local
|
||||
local _math_floor = math.floor --> lua local
|
||||
local loadstring = loadstring --> lua local
|
||||
|
||||
local cleanfunction = function() end
|
||||
local APIImageFunctions = false
|
||||
|
||||
do
|
||||
local metaPrototype = {
|
||||
WidgetType = "image",
|
||||
SetHook = DF.SetHook,
|
||||
RunHooksForWidget = DF.RunHooksForWidget,
|
||||
|
||||
dversion = DF.dversion,
|
||||
}
|
||||
|
||||
--check if there's a metaPrototype already existing
|
||||
if (_G[DF.GlobalWidgetControlNames["image"]]) then
|
||||
--get the already existing metaPrototype
|
||||
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["image"]]
|
||||
--check if is older
|
||||
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
|
||||
--the version is older them the currently loading one
|
||||
--copy the new values into the old metatable
|
||||
for funcName, _ in pairs(metaPrototype) do
|
||||
oldMetaPrototype[funcName] = metaPrototype[funcName]
|
||||
end
|
||||
end
|
||||
else
|
||||
--first time loading the framework
|
||||
_G[DF.GlobalWidgetControlNames ["image"]] = metaPrototype
|
||||
end
|
||||
end
|
||||
|
||||
local ImageMetaFunctions = _G[DF.GlobalWidgetControlNames ["image"]]
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> metatables
|
||||
|
||||
ImageMetaFunctions.__call = function (_table, value)
|
||||
return self.image:SetTexture (value)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> members
|
||||
|
||||
--> shown
|
||||
local gmember_shown = function (_object)
|
||||
return _object:IsShown()
|
||||
end
|
||||
--> frame width
|
||||
local gmember_width = function (_object)
|
||||
return _object.image:GetWidth()
|
||||
end
|
||||
--> frame height
|
||||
local gmember_height = function (_object)
|
||||
return _object.image:GetHeight()
|
||||
end
|
||||
--> texture
|
||||
local gmember_texture = function (_object)
|
||||
return _object.image:GetTexture()
|
||||
end
|
||||
--> alpha
|
||||
local gmember_alpha = function (_object)
|
||||
return _object.image:GetAlpha()
|
||||
end
|
||||
|
||||
ImageMetaFunctions.GetMembers = ImageMetaFunctions.GetMembers or {}
|
||||
ImageMetaFunctions.GetMembers ["shown"] = gmember_shown
|
||||
ImageMetaFunctions.GetMembers ["alpha"] = gmember_alpha
|
||||
ImageMetaFunctions.GetMembers ["width"] = gmember_width
|
||||
ImageMetaFunctions.GetMembers ["height"] = gmember_height
|
||||
ImageMetaFunctions.GetMembers ["texture"] = gmember_texture
|
||||
|
||||
ImageMetaFunctions.__index = function (_table, _member_requested)
|
||||
|
||||
local func = ImageMetaFunctions.GetMembers [_member_requested]
|
||||
if (func) then
|
||||
return func (_table, _member_requested)
|
||||
end
|
||||
|
||||
local fromMe = _rawget (_table, _member_requested)
|
||||
if (fromMe) then
|
||||
return fromMe
|
||||
end
|
||||
|
||||
return ImageMetaFunctions [_member_requested]
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--> show
|
||||
local smember_show = function (_object, _value)
|
||||
if (_value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> hide
|
||||
local smember_hide = function (_object, _value)
|
||||
if (not _value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> texture
|
||||
local smember_texture = function (_object, _value)
|
||||
if (type (_value) == "table") then
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetTexture (r, g, b, a or 1)
|
||||
else
|
||||
if (DF:IsHtmlColor (_value)) then
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetTexture (r, g, b, a or 1)
|
||||
else
|
||||
_object.image:SetTexture (_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
--> width
|
||||
local smember_width = function (_object, _value)
|
||||
return _object.image:SetWidth (_value)
|
||||
end
|
||||
--> height
|
||||
local smember_height = function (_object, _value)
|
||||
return _object.image:SetHeight (_value)
|
||||
end
|
||||
--> alpha
|
||||
local smember_alpha = function (_object, _value)
|
||||
return _object.image:SetAlpha (_value)
|
||||
end
|
||||
--> color
|
||||
local smember_color = function (_object, _value)
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetColorTexture (r, g, b, a or 1)
|
||||
end
|
||||
--> vertex color
|
||||
local smember_vertexcolor = function (_object, _value)
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetVertexColor (r, g, b, a or 1)
|
||||
end
|
||||
--> desaturated
|
||||
local smember_desaturated = function (_object, _value)
|
||||
if (_value) then
|
||||
_object:SetDesaturated (true)
|
||||
else
|
||||
_object:SetDesaturated (false)
|
||||
end
|
||||
end
|
||||
--> texcoords
|
||||
local smember_texcoord = function (_object, _value)
|
||||
if (_value) then
|
||||
_object:SetTexCoord (unpack (_value))
|
||||
else
|
||||
_object:SetTexCoord (0, 1, 0, 1)
|
||||
end
|
||||
end
|
||||
|
||||
ImageMetaFunctions.SetMembers = ImageMetaFunctions.SetMembers or {}
|
||||
ImageMetaFunctions.SetMembers ["show"] = smember_show
|
||||
ImageMetaFunctions.SetMembers ["hide"] = smember_hide
|
||||
ImageMetaFunctions.SetMembers ["alpha"] = smember_alpha
|
||||
ImageMetaFunctions.SetMembers ["width"] = smember_width
|
||||
ImageMetaFunctions.SetMembers ["height"] = smember_height
|
||||
ImageMetaFunctions.SetMembers ["texture"] = smember_texture
|
||||
ImageMetaFunctions.SetMembers ["texcoord"] = smember_texcoord
|
||||
ImageMetaFunctions.SetMembers ["color"] = smember_color
|
||||
ImageMetaFunctions.SetMembers ["vertexcolor"] = smember_vertexcolor
|
||||
ImageMetaFunctions.SetMembers ["blackwhite"] = smember_desaturated
|
||||
|
||||
ImageMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
local func = ImageMetaFunctions.SetMembers [_key]
|
||||
if (func) then
|
||||
return func (_table, _value)
|
||||
else
|
||||
return _rawset (_table, _key, _value)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> methods
|
||||
--> show & hide
|
||||
function ImageMetaFunctions:IsShown()
|
||||
return self.image:IsShown()
|
||||
end
|
||||
function ImageMetaFunctions:Show()
|
||||
return self.image:Show()
|
||||
end
|
||||
function ImageMetaFunctions:Hide()
|
||||
return self.image:Hide()
|
||||
end
|
||||
|
||||
-- setpoint
|
||||
function ImageMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self)
|
||||
if (not v1) then
|
||||
print ("Invalid parameter for SetPoint")
|
||||
return
|
||||
end
|
||||
return self.widget:SetPoint (v1, v2, v3, v4, v5)
|
||||
end
|
||||
|
||||
-- sizes
|
||||
function ImageMetaFunctions:SetSize (w, h)
|
||||
if (w) then
|
||||
self.image:SetWidth (w)
|
||||
end
|
||||
if (h) then
|
||||
return self.image:SetHeight (h)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> scripts
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> object constructor
|
||||
|
||||
function DF:CreateImage (parent, texture, w, h, layer, coords, member, name)
|
||||
return DF:NewImage (parent, texture, w, h, layer, coords, member, name)
|
||||
end
|
||||
|
||||
function DF:NewImage (parent, texture, w, h, layer, coords, member, name)
|
||||
|
||||
if (not parent) then
|
||||
return error ("Details! FrameWork: parent not found.", 2)
|
||||
end
|
||||
|
||||
if (not name) then
|
||||
name = "DetailsFrameworkPictureNumber" .. DF.PictureNameCounter
|
||||
DF.PictureNameCounter = DF.PictureNameCounter + 1
|
||||
end
|
||||
|
||||
if (name:find ("$parent")) then
|
||||
local parentName = DF.GetParentName (parent)
|
||||
name = name:gsub ("$parent", parentName)
|
||||
end
|
||||
|
||||
local ImageObject = {type = "image", dframework = true}
|
||||
|
||||
if (member) then
|
||||
parent [member] = ImageObject
|
||||
end
|
||||
|
||||
if (parent.dframework) then
|
||||
parent = parent.widget
|
||||
end
|
||||
|
||||
texture = texture or ""
|
||||
|
||||
ImageObject.image = parent:CreateTexture (name, layer or "OVERLAY")
|
||||
ImageObject.widget = ImageObject.image
|
||||
DF:Mixin (ImageObject.image, DF.WidgetFunctions)
|
||||
|
||||
if (not APIImageFunctions) then
|
||||
APIImageFunctions = true
|
||||
local idx = getmetatable (ImageObject.image).__index
|
||||
for funcName, funcAddress in pairs (idx) do
|
||||
if (not ImageMetaFunctions [funcName]) then
|
||||
ImageMetaFunctions [funcName] = function (object, ...)
|
||||
local x = loadstring ( "return _G['"..object.image:GetName().."']:"..funcName.."(...)")
|
||||
return x (...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ImageObject.image.MyObject = ImageObject
|
||||
|
||||
if (w) then
|
||||
ImageObject.image:SetWidth (w)
|
||||
end
|
||||
if (h) then
|
||||
ImageObject.image:SetHeight (h)
|
||||
end
|
||||
if (texture) then
|
||||
if (type (texture) == "table") then
|
||||
local r, g, b = DF:ParseColors (texture)
|
||||
ImageObject.image:SetTexture (r,g,b)
|
||||
else
|
||||
if (DF:IsHtmlColor (texture)) then
|
||||
local r, g, b = DF:ParseColors (texture)
|
||||
ImageObject.image:SetTexture (r, g, b)
|
||||
else
|
||||
ImageObject.image:SetTexture (texture)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (coords and type (coords) == "table" and coords [4]) then
|
||||
ImageObject.image:SetTexCoord (unpack (coords))
|
||||
end
|
||||
|
||||
ImageObject.HookList = {
|
||||
}
|
||||
|
||||
setmetatable (ImageObject, ImageMetaFunctions)
|
||||
|
||||
return ImageObject
|
||||
end
|
||||
|
||||
local DF = _G ["DetailsFramework"]
|
||||
if (not DF or not DetailsFrameworkCanLoad) then
|
||||
return
|
||||
end
|
||||
|
||||
local _
|
||||
local _rawset = rawset --> lua local
|
||||
local _rawget = rawget --> lua local
|
||||
local _setmetatable = setmetatable --> lua local
|
||||
local _unpack = unpack --> lua local
|
||||
local _type = type --> lua local
|
||||
local _math_floor = math.floor --> lua local
|
||||
local loadstring = loadstring --> lua local
|
||||
|
||||
local cleanfunction = function() end
|
||||
local APIImageFunctions = false
|
||||
|
||||
do
|
||||
local metaPrototype = {
|
||||
WidgetType = "image",
|
||||
SetHook = DF.SetHook,
|
||||
RunHooksForWidget = DF.RunHooksForWidget,
|
||||
|
||||
dversion = DF.dversion,
|
||||
}
|
||||
|
||||
--check if there's a metaPrototype already existing
|
||||
if (_G[DF.GlobalWidgetControlNames["image"]]) then
|
||||
--get the already existing metaPrototype
|
||||
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["image"]]
|
||||
--check if is older
|
||||
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
|
||||
--the version is older them the currently loading one
|
||||
--copy the new values into the old metatable
|
||||
for funcName, _ in pairs(metaPrototype) do
|
||||
oldMetaPrototype[funcName] = metaPrototype[funcName]
|
||||
end
|
||||
end
|
||||
else
|
||||
--first time loading the framework
|
||||
_G[DF.GlobalWidgetControlNames ["image"]] = metaPrototype
|
||||
end
|
||||
end
|
||||
|
||||
local ImageMetaFunctions = _G[DF.GlobalWidgetControlNames ["image"]]
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> metatables
|
||||
|
||||
ImageMetaFunctions.__call = function (_table, value)
|
||||
return self.image:SetTexture (value)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> members
|
||||
|
||||
--> shown
|
||||
local gmember_shown = function (_object)
|
||||
return _object:IsShown()
|
||||
end
|
||||
--> frame width
|
||||
local gmember_width = function (_object)
|
||||
return _object.image:GetWidth()
|
||||
end
|
||||
--> frame height
|
||||
local gmember_height = function (_object)
|
||||
return _object.image:GetHeight()
|
||||
end
|
||||
--> texture
|
||||
local gmember_texture = function (_object)
|
||||
return _object.image:GetTexture()
|
||||
end
|
||||
--> alpha
|
||||
local gmember_alpha = function (_object)
|
||||
return _object.image:GetAlpha()
|
||||
end
|
||||
|
||||
ImageMetaFunctions.GetMembers = ImageMetaFunctions.GetMembers or {}
|
||||
ImageMetaFunctions.GetMembers ["shown"] = gmember_shown
|
||||
ImageMetaFunctions.GetMembers ["alpha"] = gmember_alpha
|
||||
ImageMetaFunctions.GetMembers ["width"] = gmember_width
|
||||
ImageMetaFunctions.GetMembers ["height"] = gmember_height
|
||||
ImageMetaFunctions.GetMembers ["texture"] = gmember_texture
|
||||
|
||||
ImageMetaFunctions.__index = function (_table, _member_requested)
|
||||
|
||||
local func = ImageMetaFunctions.GetMembers [_member_requested]
|
||||
if (func) then
|
||||
return func (_table, _member_requested)
|
||||
end
|
||||
|
||||
local fromMe = _rawget (_table, _member_requested)
|
||||
if (fromMe) then
|
||||
return fromMe
|
||||
end
|
||||
|
||||
return ImageMetaFunctions [_member_requested]
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--> show
|
||||
local smember_show = function (_object, _value)
|
||||
if (_value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> hide
|
||||
local smember_hide = function (_object, _value)
|
||||
if (not _value) then
|
||||
return _object:Show()
|
||||
else
|
||||
return _object:Hide()
|
||||
end
|
||||
end
|
||||
--> texture
|
||||
local smember_texture = function (_object, _value)
|
||||
if (type (_value) == "table") then
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetTexture (r, g, b, a or 1)
|
||||
else
|
||||
if (DF:IsHtmlColor (_value)) then
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetTexture (r, g, b, a or 1)
|
||||
else
|
||||
_object.image:SetTexture (_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
--> width
|
||||
local smember_width = function (_object, _value)
|
||||
return _object.image:SetWidth (_value)
|
||||
end
|
||||
--> height
|
||||
local smember_height = function (_object, _value)
|
||||
return _object.image:SetHeight (_value)
|
||||
end
|
||||
--> alpha
|
||||
local smember_alpha = function (_object, _value)
|
||||
return _object.image:SetAlpha (_value)
|
||||
end
|
||||
--> color
|
||||
local smember_color = function (_object, _value)
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetColorTexture (r, g, b, a or 1)
|
||||
end
|
||||
--> vertex color
|
||||
local smember_vertexcolor = function (_object, _value)
|
||||
local r, g, b, a = DF:ParseColors (_value)
|
||||
_object.image:SetVertexColor (r, g, b, a or 1)
|
||||
end
|
||||
--> desaturated
|
||||
local smember_desaturated = function (_object, _value)
|
||||
if (_value) then
|
||||
_object:SetDesaturated (true)
|
||||
else
|
||||
_object:SetDesaturated (false)
|
||||
end
|
||||
end
|
||||
--> texcoords
|
||||
local smember_texcoord = function (_object, _value)
|
||||
if (_value) then
|
||||
_object:SetTexCoord (unpack (_value))
|
||||
else
|
||||
_object:SetTexCoord (0, 1, 0, 1)
|
||||
end
|
||||
end
|
||||
|
||||
ImageMetaFunctions.SetMembers = ImageMetaFunctions.SetMembers or {}
|
||||
ImageMetaFunctions.SetMembers ["show"] = smember_show
|
||||
ImageMetaFunctions.SetMembers ["hide"] = smember_hide
|
||||
ImageMetaFunctions.SetMembers ["alpha"] = smember_alpha
|
||||
ImageMetaFunctions.SetMembers ["width"] = smember_width
|
||||
ImageMetaFunctions.SetMembers ["height"] = smember_height
|
||||
ImageMetaFunctions.SetMembers ["texture"] = smember_texture
|
||||
ImageMetaFunctions.SetMembers ["texcoord"] = smember_texcoord
|
||||
ImageMetaFunctions.SetMembers ["color"] = smember_color
|
||||
ImageMetaFunctions.SetMembers ["vertexcolor"] = smember_vertexcolor
|
||||
ImageMetaFunctions.SetMembers ["blackwhite"] = smember_desaturated
|
||||
|
||||
ImageMetaFunctions.__newindex = function (_table, _key, _value)
|
||||
local func = ImageMetaFunctions.SetMembers [_key]
|
||||
if (func) then
|
||||
return func (_table, _value)
|
||||
else
|
||||
return _rawset (_table, _key, _value)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> methods
|
||||
--> show & hide
|
||||
function ImageMetaFunctions:IsShown()
|
||||
return self.image:IsShown()
|
||||
end
|
||||
function ImageMetaFunctions:Show()
|
||||
return self.image:Show()
|
||||
end
|
||||
function ImageMetaFunctions:Hide()
|
||||
return self.image:Hide()
|
||||
end
|
||||
|
||||
-- setpoint
|
||||
function ImageMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self)
|
||||
if (not v1) then
|
||||
print ("Invalid parameter for SetPoint")
|
||||
return
|
||||
end
|
||||
return self.widget:SetPoint (v1, v2, v3, v4, v5)
|
||||
end
|
||||
|
||||
-- sizes
|
||||
function ImageMetaFunctions:SetSize (w, h)
|
||||
if (w) then
|
||||
self.image:SetWidth (w)
|
||||
end
|
||||
if (h) then
|
||||
return self.image:SetHeight (h)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> scripts
|
||||
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
--> object constructor
|
||||
|
||||
function DF:CreateImage (parent, texture, w, h, layer, coords, member, name)
|
||||
return DF:NewImage (parent, texture, w, h, layer, coords, member, name)
|
||||
end
|
||||
|
||||
function DF:NewImage (parent, texture, w, h, layer, coords, member, name)
|
||||
|
||||
if (not parent) then
|
||||
return error ("Details! FrameWork: parent not found.", 2)
|
||||
end
|
||||
|
||||
if (not name) then
|
||||
name = "DetailsFrameworkPictureNumber" .. DF.PictureNameCounter
|
||||
DF.PictureNameCounter = DF.PictureNameCounter + 1
|
||||
end
|
||||
|
||||
if (name:find ("$parent")) then
|
||||
local parentName = DF.GetParentName (parent)
|
||||
name = name:gsub ("$parent", parentName)
|
||||
end
|
||||
|
||||
local ImageObject = {type = "image", dframework = true}
|
||||
|
||||
if (member) then
|
||||
parent [member] = ImageObject
|
||||
end
|
||||
|
||||
if (parent.dframework) then
|
||||
parent = parent.widget
|
||||
end
|
||||
|
||||
texture = texture or ""
|
||||
|
||||
ImageObject.image = parent:CreateTexture (name, layer or "OVERLAY")
|
||||
ImageObject.widget = ImageObject.image
|
||||
DF:Mixin (ImageObject.image, DF.WidgetFunctions)
|
||||
|
||||
if (not APIImageFunctions) then
|
||||
APIImageFunctions = true
|
||||
local idx = getmetatable (ImageObject.image).__index
|
||||
for funcName, funcAddress in pairs (idx) do
|
||||
if (not ImageMetaFunctions [funcName]) then
|
||||
ImageMetaFunctions [funcName] = function (object, ...)
|
||||
local x = loadstring ( "return _G['"..object.image:GetName().."']:"..funcName.."(...)")
|
||||
return x (...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ImageObject.image.MyObject = ImageObject
|
||||
|
||||
if (w) then
|
||||
ImageObject.image:SetWidth (w)
|
||||
end
|
||||
if (h) then
|
||||
ImageObject.image:SetHeight (h)
|
||||
end
|
||||
if (texture) then
|
||||
if (type (texture) == "table") then
|
||||
local r, g, b = DF:ParseColors (texture)
|
||||
ImageObject.image:SetTexture (r,g,b)
|
||||
else
|
||||
if (DF:IsHtmlColor (texture)) then
|
||||
local r, g, b = DF:ParseColors (texture)
|
||||
ImageObject.image:SetTexture (r, g, b)
|
||||
else
|
||||
ImageObject.image:SetTexture (texture)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (coords and type (coords) == "table" and coords [4]) then
|
||||
ImageObject.image:SetTexCoord (unpack (coords))
|
||||
end
|
||||
|
||||
ImageObject.HookList = {
|
||||
}
|
||||
|
||||
setmetatable (ImageObject, ImageMetaFunctions)
|
||||
|
||||
return ImageObject
|
||||
end
|
||||
|
||||
+624
-625
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ end
|
||||
|
||||
function DF:NewScrollBar (master, slave, x, y)
|
||||
|
||||
local new_slider = CreateFrame ("Slider", nil, master)
|
||||
local new_slider = CreateFrame ("Slider", nil, master,"BackdropTemplate")
|
||||
new_slider.scrollMax = 560 --default - tamanho da janela de fundo
|
||||
|
||||
-- ///// SLIDER /////
|
||||
@@ -32,7 +32,7 @@ function DF:NewScrollBar (master, slave, x, y)
|
||||
new_slider:SetValue(0)
|
||||
new_slider.ultimo = 0
|
||||
|
||||
local botao_cima = CreateFrame ("Button", nil, master)
|
||||
local botao_cima = CreateFrame ("Button", nil, master,"BackdropTemplate")
|
||||
|
||||
botao_cima:SetPoint ("BOTTOM", new_slider, "TOP", 0, -12)
|
||||
botao_cima.x = 0
|
||||
@@ -46,7 +46,7 @@ function DF:NewScrollBar (master, slave, x, y)
|
||||
botao_cima:Show()
|
||||
botao_cima:Disable()
|
||||
|
||||
local botao_baixo = CreateFrame ("Button", nil, master)
|
||||
local botao_baixo = CreateFrame ("Button", nil, master,"BackdropTemplate")
|
||||
botao_baixo:SetPoint ("TOP", new_slider, "BOTTOM", 0, 12)
|
||||
botao_baixo.x = 0
|
||||
botao_baixo.y = 12
|
||||
|
||||
+19
-7
@@ -25,8 +25,8 @@ do
|
||||
HasHook = DF.HasHook,
|
||||
ClearHooks = DF.ClearHooks,
|
||||
RunHooksForWidget = DF.RunHooksForWidget,
|
||||
|
||||
dversion = DF.dversion,
|
||||
|
||||
dversion = DF.dversion
|
||||
}
|
||||
|
||||
--check if there's a metaPrototype already existing
|
||||
@@ -247,6 +247,18 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
|
||||
return self.thumb:SetSize (w, h)
|
||||
end
|
||||
|
||||
function DFSliderMetaFunctions:SetBackdrop(...)
|
||||
return self.slider:SetBackdrop(...)
|
||||
end
|
||||
|
||||
function DFSliderMetaFunctions:SetBackdropColor(...)
|
||||
return self.slider:SetBackdropColor(...)
|
||||
end
|
||||
|
||||
function DFSliderMetaFunctions:SetBackdropBorderColor(...)
|
||||
return self.slider:SetBackdropBorderColor(...)
|
||||
end
|
||||
|
||||
|
||||
-- setpoint
|
||||
function DFSliderMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
|
||||
@@ -424,7 +436,7 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
|
||||
end
|
||||
|
||||
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkSliderButtons1", UIParent)
|
||||
local f = CreateFrame ("frame", "DetailsFrameworkSliderButtons1", UIParent, "BackdropTemplate")
|
||||
f:Hide()
|
||||
f:SetHeight (18)
|
||||
|
||||
@@ -461,8 +473,8 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
|
||||
f:SetScript ("OnUpdate", going_hide)
|
||||
end
|
||||
|
||||
local button_plus = CreateFrame ("button", "DetailsFrameworkSliderButtonsPlusButton", f)
|
||||
local button_minor = CreateFrame ("button", "DetailsFrameworkSliderButtonsMinorButton", f)
|
||||
local button_plus = CreateFrame ("button", "DetailsFrameworkSliderButtonsPlusButton", f, "BackdropTemplate")
|
||||
local button_minor = CreateFrame ("button", "DetailsFrameworkSliderButtonsMinorButton", f, "BackdropTemplate")
|
||||
button_plus:SetFrameStrata (f:GetFrameStrata())
|
||||
button_minor:SetFrameStrata (f:GetFrameStrata())
|
||||
|
||||
@@ -638,7 +650,7 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]
|
||||
|
||||
if (not DFSliderMetaFunctions.editbox_typevalue) then
|
||||
|
||||
local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent)
|
||||
local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent, "BackdropTemplate")
|
||||
|
||||
editbox:SetSize (40, 20)
|
||||
editbox:SetJustifyH ("center")
|
||||
@@ -1160,7 +1172,7 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de
|
||||
SliderObject.lockdown = false
|
||||
SliderObject.container = container
|
||||
|
||||
SliderObject.slider = CreateFrame ("slider", name, parent)
|
||||
SliderObject.slider = CreateFrame ("slider", name, parent,"BackdropTemplate")
|
||||
SliderObject.widget = SliderObject.slider
|
||||
|
||||
SliderObject.useDecimals = isDecemal or false
|
||||
|
||||
+253
-172
@@ -14,6 +14,8 @@ DF.CooldownsBySpec = {
|
||||
-- 4 raid defensive cooldown
|
||||
-- 5 personal utility cooldown
|
||||
|
||||
--Shadowlands 9.0.2 revision by Juliana Maison
|
||||
|
||||
--MAGE
|
||||
--arcane
|
||||
[62] = {
|
||||
@@ -22,6 +24,7 @@ DF.CooldownsBySpec = {
|
||||
[45438] = 2, --Ice Block
|
||||
[12051] = 5, --Evocation
|
||||
[110960] = 5, --Greater Invisibility
|
||||
[235450] = 5, --Prismatic Barrier
|
||||
},
|
||||
--fire
|
||||
[63] = {
|
||||
@@ -29,36 +32,42 @@ DF.CooldownsBySpec = {
|
||||
[55342] = 1, --Mirror Image
|
||||
[45438] = 2, --Ice Block
|
||||
[66] = 5, --Invisibility
|
||||
[235313] = 5, --Blazing Barrier
|
||||
},
|
||||
--frost
|
||||
[64] = {
|
||||
[12472] = 1, --Icy Veins
|
||||
[205021] = 1, --Ray of Frost
|
||||
[205021] = 1, --Ray of Frost (talent)
|
||||
[55342] = 1, --Mirror Image
|
||||
[45438] = 2, --Ice Block
|
||||
[66] = 5, --Invisibility
|
||||
[235219] = 5, --Cold Snap
|
||||
[11426] = 5, --Ice Barrier
|
||||
[113724] = 5, --Ring of Frost (talent)
|
||||
},
|
||||
|
||||
--PRIEST
|
||||
--discipline
|
||||
[256] = {
|
||||
[10060] = 1, --Power Infusion
|
||||
[34433] = 1, --Shadowfiend
|
||||
[123040] = 1, --Mindbender
|
||||
[33206] = 3, --Pain Suppression
|
||||
[62618] = 4, --Power Word: Barrier
|
||||
[271466] = 4, --Luminous Barrier (talent)
|
||||
[109964] = 4, --Spirit Shell (talent)
|
||||
[47536] = 5, --Rapture
|
||||
[19236] = 5, --Desperate Prayer
|
||||
[8122] = 5, --Psychic Scream
|
||||
},
|
||||
--holy
|
||||
[257] = {
|
||||
[10060] = 1, --Power Infusion
|
||||
[200183] = 2, --Apotheosis
|
||||
[47788] = 3, --Guardian Spirit
|
||||
[64844] = 4, --Divine Hymn
|
||||
[64901] = 4, --Symbol of Hope
|
||||
[265202] = 4, --Holy Word: Salvation
|
||||
[265202] = 4, --Holy Word: Salvation (talent)
|
||||
[88625] = 5, --Holy Word: Chastise
|
||||
[34861] = 5, --Holy Word: Sanctify
|
||||
[2050] = 5, --Holy Word: Serenity
|
||||
@@ -67,13 +76,17 @@ DF.CooldownsBySpec = {
|
||||
},
|
||||
--shadow priest
|
||||
[258] = {
|
||||
[10060] = 1, --Power Infusion
|
||||
[34433] = 1, --Shadowfiend
|
||||
[200174] = 1, --Mindbender
|
||||
[205385] = 1, --Shadow Clash
|
||||
[193223] = 1, --Surrender to Madness
|
||||
[47585] = 2, --Dispersion
|
||||
[15286] = 4, --Vampiric Embrace
|
||||
[19236] = 5, --Desperate Prayer
|
||||
[64044] = 5, --Psychic Horror
|
||||
[8122] = 5, --Psychic Scream
|
||||
[205369] = 5, --Mind Bomb
|
||||
},
|
||||
|
||||
--ROGUE
|
||||
@@ -84,6 +97,7 @@ DF.CooldownsBySpec = {
|
||||
[5277] = 2, --Evasion
|
||||
[31224] = 2, --Cloak of Shadows
|
||||
[2094] = 5, --Blind
|
||||
[185311] = 5, --Crimson Vial
|
||||
[114018] = 5, --Shroud of Concealment
|
||||
},
|
||||
--outlaw
|
||||
@@ -92,9 +106,12 @@ DF.CooldownsBySpec = {
|
||||
[51690] = 1, --Killing Spree (talent)
|
||||
[199754] = 2, --Riposte
|
||||
[31224] = 2, --Cloak of Shadows
|
||||
[5277] = 2, --Evasion
|
||||
[1856] = 2, --Vanish
|
||||
[2094] = 5, --Blind
|
||||
[185311] = 5, --Crimson Vial
|
||||
[114018] = 5, --Shroud of Concealment
|
||||
[343142] = 5, --Dreadblades
|
||||
},
|
||||
--subtlety
|
||||
[261] = {
|
||||
@@ -103,6 +120,7 @@ DF.CooldownsBySpec = {
|
||||
[1856] = 2, --Vanish
|
||||
[5277] = 2, --Evasion
|
||||
[2094] = 5, --Blind
|
||||
[185311] = 5, --Crimson Vial
|
||||
[114018] = 5, --Shroud of Concealment
|
||||
},
|
||||
|
||||
@@ -110,17 +128,19 @@ DF.CooldownsBySpec = {
|
||||
--affliction
|
||||
[265] = {
|
||||
[205180] = 1, --Summon Darkglare
|
||||
[342601] = 1, --Ritual of Doom
|
||||
[113860] = 1, --Dark Soul: Misery (talent)
|
||||
[104773] = 2, --Unending Resolve
|
||||
|
||||
[108416] = 2, --Dark Pact (talent)
|
||||
|
||||
[104773] = 2, --Unending Resolve
|
||||
[108416] = 2, --Dark Pact (talent)
|
||||
[30283] = 5, --Shadowfury
|
||||
[6789] = 5, --Mortal Coil
|
||||
[6789] = 5, --Mortal Coil (talent)
|
||||
[333889] = 5, --Fel Domination
|
||||
},
|
||||
--demo
|
||||
--demonology
|
||||
[266] = {
|
||||
[265187] = 1, --Summon Demonic Tyrant
|
||||
[342601] = 1, --Ritual of Doom
|
||||
[267171] = 1, --Demonic Strength (talent)
|
||||
[111898] = 1, --Grimoire: Felguard (talent)
|
||||
[267217] = 1, --Nether Portal (talent)
|
||||
|
||||
@@ -128,31 +148,31 @@ DF.CooldownsBySpec = {
|
||||
[108416] = 2, --Dark Pact (talent)
|
||||
|
||||
[30283] = 5, --Shadowfury
|
||||
[6789] = 5, --Mortal Coil
|
||||
[6789] = 5, --Mortal Coil (talent)
|
||||
[5484] = 5, --Howl of Terror (talent)
|
||||
[333889] = 5, --Fel Domination
|
||||
},
|
||||
--destro
|
||||
--destruction
|
||||
[267] = {
|
||||
[1122] = 1, --Summon Infernal
|
||||
[113858] = 1, --Dark Soul: Instability (talent)
|
||||
|
||||
[342601] = 1, --Ritual of Doom
|
||||
[113858] = 1, --Dark Soul: Instability (talent)
|
||||
[104773] = 2, --Unending Resolve
|
||||
[108416] = 2, --Dark Pact (talent)
|
||||
|
||||
[6789] = 5, --Mortal Coil
|
||||
[108416] = 2, --Dark Pact (talent)
|
||||
[6789] = 5, --Mortal Coil (talent)
|
||||
[30283] = 5, --Shadowfury
|
||||
[333889] = 5, --Fel Domination
|
||||
},
|
||||
|
||||
--WARRIOR
|
||||
--Arms
|
||||
[71] = {
|
||||
[107574] = 1, --Avatar
|
||||
[107574] = 1, --Avatar (talent)
|
||||
[227847] = 1, --Bladestorm
|
||||
[152277] = 1, --Ravager (talent)
|
||||
|
||||
[118038] = 2, --Die by the Sword
|
||||
|
||||
[97462] = 4, --Rallying Cry
|
||||
|
||||
[64382] = 5, --Shattering Throw
|
||||
[18499] = 5, --Berserker Rage
|
||||
[5246] = 5, --Intimidating Shout
|
||||
},
|
||||
@@ -160,11 +180,9 @@ DF.CooldownsBySpec = {
|
||||
[72] = {
|
||||
[1719] = 1, --Recklessness
|
||||
[46924] = 1, --Bladestorm (talent)
|
||||
|
||||
[184364] = 2, --Enraged Regeneration
|
||||
|
||||
[97462] = 4, --Rallying Cry
|
||||
|
||||
[64382] = 5, --Shattering Throw
|
||||
[18499] = 5, --Berserker Rage
|
||||
[5246] = 5, --Intimidating Shout
|
||||
},
|
||||
@@ -172,12 +190,10 @@ DF.CooldownsBySpec = {
|
||||
[73] = {
|
||||
[228920] = 1, --Ravager (talent)
|
||||
[107574] = 1, --Avatar
|
||||
|
||||
[12975] = 2, --Last Stand
|
||||
[871] = 2, --Shield Wall
|
||||
|
||||
[97462] = 4, --Rallying Cry
|
||||
|
||||
[64382] = 5, --Shattering Throw
|
||||
[18499] = 5, --Berserker Rage
|
||||
[5246] = 5, --Intimidating Shout
|
||||
},
|
||||
@@ -186,17 +202,15 @@ DF.CooldownsBySpec = {
|
||||
--holy
|
||||
[65] = {
|
||||
[31884] = 1, --Avenging Wrath
|
||||
[216331] = 1, --Avenging Crusader (talent)
|
||||
|
||||
[216331] = 1, --Avenging Crusader (talent)
|
||||
[498] = 2, --Divine Protection
|
||||
[642] = 2, --Divine Shield
|
||||
[105809] = 2, --Holy Avenger (talent)
|
||||
|
||||
[1022] = 3, --Blessing of Protection
|
||||
[152262] = 2, --Seraphim
|
||||
[633] = 3, --Lay on Hands
|
||||
|
||||
[1022] = 3, --Blessing of Protection
|
||||
[6940] = 3, --Blessing of Sacrifice
|
||||
[31821] = 4, --Aura Mastery
|
||||
|
||||
[1044] = 5, --Blessing of Freedom
|
||||
[853] = 5, --Hammer of Justice
|
||||
[115750] = 5, --Blinding Light (talent)
|
||||
@@ -205,16 +219,14 @@ DF.CooldownsBySpec = {
|
||||
--protection
|
||||
[66] = {
|
||||
[31884] = 1, --Avenging Wrath
|
||||
|
||||
[327193] = 1, --Moment of Glory (talent)
|
||||
[31850] = 2, --Ardent Defender
|
||||
[86659] = 2, --Guardian of Ancient Kings
|
||||
|
||||
[105809] = 2, --Holy Avenger (talent)
|
||||
[152262] = 2, --Seraphim
|
||||
[1022] = 3, --Blessing of Protection
|
||||
[204018] = 3, --Blessing of Spellwarding (talent)
|
||||
[6940] = 3, --Blessing of Sacrifice
|
||||
|
||||
[204150] = 4, --Aegis of Light (talent)
|
||||
|
||||
[1044] = 5, --Blessing of Freedom
|
||||
[853] = 5, --Hammer of Justice
|
||||
[115750] = 5, --Blinding Light (talent)
|
||||
@@ -224,13 +236,12 @@ DF.CooldownsBySpec = {
|
||||
[70] = {
|
||||
[31884] = 1, --Avenging Wrath
|
||||
[231895] = 1, --Crusade (talent)
|
||||
|
||||
[205191] = 2, --Eye for an Eye (talent)
|
||||
[184662] = 2, --Shield of Vengeance
|
||||
[642] = 2, --Divine Shield
|
||||
|
||||
[1022] = 3, --Blessing of Protection
|
||||
[6940] = 3, --Blessing of Sacrifice
|
||||
[633] = 3, --Lay on Hands
|
||||
|
||||
[1044] = 5, --Blessing of Freedom
|
||||
[853] = 5, --Hammer of Justice
|
||||
[115750] = 5, --Blinding Light (talent)
|
||||
@@ -239,20 +250,24 @@ DF.CooldownsBySpec = {
|
||||
--DEMON HUNTER
|
||||
--havoc
|
||||
[577] = {
|
||||
[162264] = 1, --Metamorphosis
|
||||
[206491] = 1, --Nemesis (talent)
|
||||
|
||||
[200166] = 1, --Metamorphosis
|
||||
[198589] = 2, --Blur
|
||||
[196555] = 2, --Netherwalk (talent)
|
||||
|
||||
[196718] = 4, --Darkness
|
||||
[188501] = 5, --Spectral Sight
|
||||
[179057] = 5, --Chaos Nova
|
||||
[211881] = 5, --Fel Eruption (talent)
|
||||
},
|
||||
--vengeance
|
||||
[581] = {
|
||||
[320341] = 1, --Bulk Extraction (talent)
|
||||
[187827] = 2, --Metamorphosis
|
||||
|
||||
[204021] = 2, --Fiery Brand
|
||||
[263648] = 2, --Soul Barrier (talent)
|
||||
[207684] = 5, --Sigil of Misery
|
||||
[202137] = 5, --Sigil of Silence
|
||||
[202138] = 5, --Sigil of Chains (talent)
|
||||
[188501] = 5, --Spectral Sight
|
||||
},
|
||||
|
||||
--DEATH KNIGHT
|
||||
@@ -261,78 +276,95 @@ DF.CooldownsBySpec = {
|
||||
[275699] = 1, --Apocalypse
|
||||
[42650] = 1, --Army of the Dead
|
||||
[49206] = 1, --Summon Gargoyle (talent)
|
||||
|
||||
[207289] = 1, --Unholy Assault (talent)
|
||||
[48707] = 2, --Anti-magic Shell
|
||||
[48792] = 2, --Icebound Fortitude
|
||||
[48743] = 2, --Death Pact (talent)
|
||||
[51052] = 4, --Anti-magic Zone
|
||||
[108194] = 5, --Asphyxiate (talent)
|
||||
[287081] = 5, --Lichborne
|
||||
[212552] = 5, --Wraith walk (talent)
|
||||
|
||||
},
|
||||
--frost
|
||||
[251] = {
|
||||
[152279] = 1, --Breath of Sindragosa (talent)
|
||||
[47568] = 1, --Empower Rune Weapon
|
||||
[279302] = 1, --Frostwyrm's Fury (talent)
|
||||
|
||||
[279302] = 1, --Frostwyrm's Fury
|
||||
[48707] = 2, --Anti-magic Shell
|
||||
[48792] = 2, --Icebound Fortitude
|
||||
[48743] = 2, --Death Pact (talent)
|
||||
|
||||
[51052] = 4, --Anti-magic Zone
|
||||
[207167] = 5, --Blinding Sleet (talent)
|
||||
[108194] = 5, --Asphyxiate (talent)
|
||||
[287081] = 5, --Lichborne
|
||||
[212552] = 5, --Wraith walk (talent)
|
||||
},
|
||||
--blood
|
||||
[250] = {
|
||||
[49028] = 1, --Dancing Rune Weapon
|
||||
|
||||
[48707] = 2, --Anti-magic Shell
|
||||
[48743] = 2, --Death Pact (talent)
|
||||
[219809] = 2, --Tombstone (talent)
|
||||
[55233] = 2, --Vampiric Blood
|
||||
[48792] = 2, --Icebound Fortitude
|
||||
|
||||
[51052] = 4, --Anti-magic Zone
|
||||
[108199] = 5, --Gorefiend's Grasp
|
||||
[221562] = 5, --Asphyxiate
|
||||
[212552] = 5, --Wraith walk (talent)
|
||||
},
|
||||
|
||||
--DRUID
|
||||
--balance
|
||||
--Balance
|
||||
[102] = {
|
||||
[194223] = 1, --Celestial Alignment
|
||||
[102560] = 1, --Incarnation: Chosen of Elune (talent)
|
||||
|
||||
[22812] = 2, --Barkskin
|
||||
[108238] = 2, --Renewal (talent)
|
||||
|
||||
[29166] = 3, --Innervate
|
||||
|
||||
[77761] = 4, --Stampeding Roar
|
||||
[99] = 5, --Incapacitating Roar
|
||||
[319454] = 5, --Heart of the Wild (talent)
|
||||
[132469] = 5, --Typhoon
|
||||
[78675] = 5, --Solar Beam
|
||||
},
|
||||
--feral
|
||||
--Feral
|
||||
[103] = {
|
||||
[106951] = 1, --Berserk
|
||||
[102543] = 1, --Incarnation: King of the Jungle (talent)
|
||||
|
||||
[22812] = 2, --Barkskin
|
||||
[61336] = 2, --Survival Instincts
|
||||
[108238] = 2, --Renewal (talent)
|
||||
|
||||
[77764] = 4, --Stampeding Roar
|
||||
[132469] = 5, --Typhoon
|
||||
[319454] = 5, --Heart of the Wild (talent)
|
||||
},
|
||||
--guardian
|
||||
--Guardian
|
||||
[104] = {
|
||||
[106951] = 1, --Berserk
|
||||
[204066] = 1, --Lunar Beam
|
||||
[22812] = 2, --Barkskin
|
||||
[61336] = 2, --Survival Instincts
|
||||
[102558] = 2, --Incarnation: Guardian of Ursoc (talent)
|
||||
|
||||
[108238] = 2, --Renewal (talent)
|
||||
[77761] = 4, --Stampeding Roar
|
||||
|
||||
[132469] = 5, --Typhoon
|
||||
[99] = 5, --Incapacitating Roar
|
||||
[319454] = 5, --Heart of the Wild (talent)
|
||||
},
|
||||
--restoration
|
||||
--Restoration
|
||||
[105] = {
|
||||
|
||||
[22812] = 2, --Barkskin
|
||||
[108238] = 2, --Renewal (talent)
|
||||
[33891] = 2, --Incarnation: Tree of Life (talent)
|
||||
|
||||
[102342] = 3, --Ironbark
|
||||
[29166] = 3, --Innervate
|
||||
|
||||
[203651] = 3, --Overgrowth (talent)
|
||||
[740] = 4, --Tranquility
|
||||
[197721] = 4, --Flourish (talent)
|
||||
|
||||
[77761] = 4, --Stampeding Roar
|
||||
[319454] = 5, --Heart of the Wild (talent)
|
||||
[102793] = 5, --Ursol's Vortex
|
||||
},
|
||||
|
||||
@@ -342,31 +374,32 @@ DF.CooldownsBySpec = {
|
||||
[193530] = 1, --Aspect of the Wild
|
||||
[19574] = 1, --Bestial Wrath
|
||||
[201430] = 1, --Stampede (talent)
|
||||
[194407] = 1, --Spitting Cobra (talent)
|
||||
|
||||
[186265] = 2, --Aspect of the Turtle
|
||||
[109304] = 2, --Exhilaration
|
||||
|
||||
[199483] = 2, --Camouflage (talent)
|
||||
[186257] = 5, --Aspect of the cheetah
|
||||
[19577] = 5, --Intimidation
|
||||
[109248] = 5, --Binding Shot (talent)
|
||||
[187650] = 5, --Freezing Trap
|
||||
},
|
||||
--marksmanship
|
||||
[254] = {
|
||||
[193526] = 1, --Trueshot
|
||||
|
||||
[260402] = 1, --Double tap
|
||||
[186265] = 2, --Aspect of the Turtle
|
||||
[199483] = 2, --Camouflage (talent)
|
||||
[109304] = 2, --Exhilaration
|
||||
[281195] = 2, --Survival of the Fittest
|
||||
|
||||
[186257] = 5, --Aspect of the cheetah
|
||||
[187650] = 5, --Freezing Trap
|
||||
},
|
||||
--survival
|
||||
[255] = {
|
||||
[266779] = 1, --Coordinated Assault
|
||||
|
||||
[186265] = 2, --Aspect of the Turtle
|
||||
[199483] = 2, --Camouflage (talent)
|
||||
[109304] = 2, --Exhilaration
|
||||
|
||||
[186289] = 5, --Aspect of the eagle
|
||||
[19577] = 5, --Intimidation
|
||||
[187650] = 5, --Freezing Trap
|
||||
},
|
||||
@@ -374,33 +407,41 @@ DF.CooldownsBySpec = {
|
||||
--MONK
|
||||
--brewmaster
|
||||
[268] = {
|
||||
[132578] = 1, --Invoke Niuzao, the Black Ox
|
||||
[115080] = 1, --Touch of Death
|
||||
[115203] = 2, --Fortifying Brew
|
||||
[115399] = 2, --Black Ox brew (talent)
|
||||
[115176] = 2, --Zen Meditation
|
||||
[122278] = 2, --Dampen Harm (talent)
|
||||
[116844] = 5, --Ring of peace (talent)
|
||||
[119381] = 5, --Leg Sweep
|
||||
},
|
||||
--windwalker
|
||||
[269] = {
|
||||
[137639] = 1, --Storm, Earth, and Fire
|
||||
[123904] = 1, --Invoke Xuen, the White Tiger (talent)
|
||||
[123904] = 1, --Invoke Xuen, the White Tiger
|
||||
[152173] = 1, --Serenity (talent)
|
||||
|
||||
[115080] = 1, --Touch of Death
|
||||
[115203] = 2, --Fortifying Brew
|
||||
[122470] = 2, --Touch of Karma
|
||||
[122278] = 2, --Dampen Harm (talent)
|
||||
[122783] = 2, --Diffuse Magic (talent)
|
||||
|
||||
[116844] = 5, --Ring of peace (talent)
|
||||
[119381] = 5, --Leg Sweep
|
||||
},
|
||||
--mistweaver
|
||||
[270] = {
|
||||
[115080] = 1, --Touch of Death
|
||||
[122278] = 2, --Dampen Harm (talent)
|
||||
[243435] = 2, --Fortifying Brew
|
||||
[122783] = 2, --Diffuse Magic (talent)
|
||||
|
||||
[116849] = 3, --Life Cocoon
|
||||
|
||||
[322118] = 4, --Invoke Yulon, the Jade serpent
|
||||
[198664] = 4, --Invoke Chi-Ji, the Red Crane (talent)
|
||||
|
||||
[115310] = 4, --Revival
|
||||
[116844] = 5, --Ring of peace (talent)
|
||||
[197908] = 5, --Mana tea (talent)
|
||||
[119381] = 5, --Leg Sweep
|
||||
},
|
||||
|
||||
--SHAMAN
|
||||
@@ -409,17 +450,23 @@ DF.CooldownsBySpec = {
|
||||
[198067] = 1, --Fire Elemental
|
||||
[192249] = 1, --Storm Elemental (talent)
|
||||
[114050] = 1, --Ascendance (talent)
|
||||
|
||||
[108271] = 2, --Astral Shift
|
||||
|
||||
[108281] = 4, --Ancestral Guidance (talent)
|
||||
[198103] = 4, --Earth Elemental
|
||||
[79206] = 5, --Spiritwalkers grace
|
||||
[65992] = 5, --Tremor Totem
|
||||
[192058] = 5, --Capacitor Totem
|
||||
[192077] = 5, --Wind Rush Totem (talent)
|
||||
},
|
||||
--enhancement
|
||||
[263] = {
|
||||
[51533] = 1, --Feral Spirit
|
||||
[114051] = 1, --Ascendance (talent)
|
||||
|
||||
[108271] = 2, --Astral Shift
|
||||
[198103] = 4, --Earth Elemental
|
||||
[65992] = 5, --Tremor Totem
|
||||
[192058] = 5, --Capacitor Totem
|
||||
|
||||
},
|
||||
--restoration
|
||||
[263] = {
|
||||
@@ -427,7 +474,11 @@ DF.CooldownsBySpec = {
|
||||
[114052] = 2, --Ascendance (talent)
|
||||
[98008] = 4, --Spirit Link Totem
|
||||
[108280] = 4, --Healing Tide Totem
|
||||
[16191] = 4, --Mana Tide Totem
|
||||
[198103] = 4, --Earth Elemental
|
||||
[207399] = 4, --Ancestral Protection Totem (talent)
|
||||
[198103] = 4, --Earth Elemental
|
||||
[65992] = 5, --Tremor Totem
|
||||
},
|
||||
}
|
||||
|
||||
@@ -439,16 +490,20 @@ DF.CooldownsInfo = {
|
||||
[498] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Divine Protection
|
||||
[642] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Divine Shield
|
||||
[105809] = {cooldown = 90, duration = 20, talent = 22164, charges = 1, class = "PALADIN", type = 2}, --Holy Avenger (talent)
|
||||
[1022] = {cooldown = 300, duration = 10, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Protection
|
||||
[152262] = { cooldown = 45, duration = 15, talent = 17601, charges = 1, class = "PALADIN", type = 2}, --Seraphim
|
||||
[633] = {cooldown = 600, duration = false, talent = false, charges = 1, class = "PALADIN", type = 3}, --Lay on Hands
|
||||
[1022] = {cooldown = 300, duration = 10, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Protection
|
||||
[6940] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Sacrifice
|
||||
[31821] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 4}, --Aura Mastery
|
||||
[1044] = {cooldown = 25, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 5}, --Blessing of Freedom
|
||||
[853] = {cooldown = 60, duration = 6, talent = false, charges = 1, class = "PALADIN", type = 5}, --Hammer of Justice
|
||||
[115750] = {cooldown = 90, duration = 6, talent = 21811, charges = 1, class = "PALADIN", type = 5}, --Blinding Light(talent)
|
||||
[327193] = {cooldown = 90, duration = 15, talent = 23468, charges = 1, class = "PALADIN", type = 1}, --Moment of Glory (talent)
|
||||
[31850] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Ardent Defender
|
||||
[86659] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Guardian of Ancient Kings
|
||||
[204018] = {cooldown = 180, duration = 10, talent = 22435, charges = 1, class = "PALADIN", type = 3}, --Blessing of Spellwarding (talent)
|
||||
[6940] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Sacrifice
|
||||
[204150] = {cooldown = 180, duration = 6, talent = 23087, charges = 1, class = "PALADIN", type = 4}, --Aegis of Light (talent)
|
||||
[231895] = {cooldown = 120, duration = 25, talent = 22215, charges = 1, class = "PALADIN", type = 1}, --Crusade (talent)
|
||||
[205191] = {cooldown = 60, duration = 10, talent = 22183, charges = 1, class = "PALADIN", type = 2}, --Eye for an Eye (talent)
|
||||
[184662] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "PALADIN", type = 2}, --Shield of Vengeance
|
||||
|
||||
--> warrior
|
||||
@@ -463,55 +518,79 @@ DF.CooldownsInfo = {
|
||||
[228920] = {cooldown = 60, duration = 6, talent = 23099, charges = 1, class = "WARRIOR", type = 1}, --Ravager (talent)
|
||||
[12975] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Last Stand
|
||||
[871] = {cooldown = 8, duration = 240, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Shield Wall
|
||||
[64382] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "WARRIOR", type = 5}, --Shattering Throw
|
||||
[5246] = {cooldown = 90, duration = 8, talent = false, charges = 1, class = "WARRIOR", type = 5}, --Intimidating Shout
|
||||
|
||||
|
||||
--> warlock
|
||||
[205180] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Darkglare
|
||||
[342601] = {cooldown = 3600, duration = false, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Ritual of Doom
|
||||
[113860] = {cooldown = 120, duration = 20, talent = 19293, charges = 1, class = "WARLOCK", type = 1}, --Dark Soul: Misery (talent)
|
||||
[104773] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "WARLOCK", type = 2}, --Unending Resolve
|
||||
[108416] = {cooldown = 60, duration = 20, talent = 19286, charges = 1, class = "WARLOCK", type = 2}, --Dark Pact (talent)
|
||||
[265187] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Demonic Tyrant
|
||||
[111898] = {cooldown = 120, duration = 15, talent = 21717, charges = 1, class = "WARLOCK", type = 1}, --Grimoire: Felguard
|
||||
[111898] = {cooldown = 120, duration = 15, talent = 21717, charges = 1, class = "WARLOCK", type = 1}, --Grimoire: Felguard (talent)
|
||||
[267171] = {cooldown = 60, duration = false, talent = 23138, charges = 1, class = "WARLOCK", type = 1}, --Demonic Strength (talent)
|
||||
[267217] = {cooldown = 180, duration = 20, talent = 23091, charges = 1, class = "WARLOCK", type = 1}, --Nether Portal
|
||||
[1122] = {cooldown = 180, duration = 30, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Infernal
|
||||
[113858] = {cooldown = 120, duration = 20, talent = 23092, charges = 1, class = "WARLOCK", type = 1}, --Dark Soul: Instability (talent)
|
||||
[30283] = {cooldown = 60, duration = 3, talent = false, charges = 1, class = "WARLOCK", type = 5}, --Shadowfury
|
||||
[333889] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "WARLOCK", type = 5}, --Fel Domination
|
||||
|
||||
--> shaman
|
||||
[198067] = {cooldown = 150, duration = 30, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Fire Elemental
|
||||
[192249] = {cooldown = 150, duration = 30, talent = 19272, charges = 1, class = "SHAMAN", type = 1}, --Storm Elemental (talent)
|
||||
[114050] = {cooldown = 180, duration = 15, talent = 21675, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
|
||||
[108271] = {cooldown = 90, duration = 8, talent = false, charges = 1, class = "SHAMAN", type = 2}, --Astral Shift
|
||||
[108281] = {cooldown = 120, duration = 10, talent = 22172, charges = 1, class = "SHAMAN", type = 4}, --Ancestral Guidance (talent)
|
||||
[51533] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Feral Spirit
|
||||
[114050] = {cooldown = 180, duration = 15, talent = 21675, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
|
||||
[114051] = {cooldown = 180, duration = 15, talent = 21972, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent)
|
||||
[114052] = {cooldown = 180, duration = 15, talent = 22359, charges = 1, class = "SHAMAN", type = 2}, --Ascendance (talent)
|
||||
[98008] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Spirit Link Totem
|
||||
[108280] = {cooldown = 180, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Healing Tide Totem
|
||||
[207399] = {cooldown = 240, duration = 30, talent = 22323, charges = 1, class = "SHAMAN", type = 4}, --Ancestral Protection Totem (talent)
|
||||
[16191] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Mana Tide Totem
|
||||
[198103] = {cooldown = 300, duration = 60, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Earth Elemental
|
||||
[192058] = {cooldown = 60, duration = false, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Capacitor Totem
|
||||
[65992] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Tremor Totem
|
||||
[192077] = {cooldown = 120, duration = 15, talent = 21966, charges = 1, class = "SHAMAN", type = 5}, --Wind Rush Totem (talent)
|
||||
|
||||
--> monk
|
||||
[132578] = {cooldown = 180, duration = 25, talent = false, charges = 1, class = "MONK", type = 1}, --Invoke Niuzao, the Black Ox
|
||||
[115080] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "MONK", type = 1}, --Touch of Death
|
||||
[115203] = {cooldown = 420, duration = 15, talent = false, charges = 1, class = "MONK", type = 2}, --Fortifying Brew
|
||||
[115176] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "MONK", type = 2}, --Zen Meditation
|
||||
[115399] = {cooldown = 120, duration = false, talent = 19992, charges = 1, class = "MONK", type = 2}, --Black Ox brew (talent)
|
||||
[122278] = {cooldown = 120, duration = 10, talent = 20175, charges = 1, class = "MONK", type = 2}, --Dampen Harm (talent)
|
||||
[137639] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "MONK", type = 1}, --Storm, Earth, and Fire
|
||||
[123904] = {cooldown = 120, duration = 20, talent = 22102, charges = 1, class = "MONK", type = 1}, --Invoke Xuen, the White Tiger (talent)
|
||||
[123904] = {cooldown = 120, duration = 24, talent = false, charges = 1, class = "MONK", type = 1}, --Invoke Xuen, the White Tiger
|
||||
[152173] = {cooldown = 90, duration = 12, talent = 21191, charges = 1, class = "MONK", type = 1}, --Serenity (talent)
|
||||
[122470] = {cooldown = 90, duration = 6, talent = false, charges = 1, class = "MONK", type = 2}, --Touch of Karma
|
||||
[322118] = {cooldown = 180, duration = 25, talent = false, charges = 1, class = "MONK", type = 4}, --Invoke Yulon, the Jade serpent
|
||||
[198664] = {cooldown = 180, duration = 25, talent = 22214, charges = 1, class = "MONK", type = 4}, --Invoke Chi-Ji, the Red Crane (talent)
|
||||
[243435] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "MONK", type = 2}, --Fortifying Brew
|
||||
[122783] = {cooldown = 90, duration = 6, talent = 20173, charges = 1, class = "MONK", type = 2}, --Diffuse Magic (talent)
|
||||
[116849] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "MONK", type = 3}, --Life Cocoon
|
||||
[115310] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "MONK", type = 4}, --Revival
|
||||
[197908] = {cooldown = 90, duration = 10, talent = 22166, charges = 1, class = "MONK", type = 5}, --Mana tea (talent)
|
||||
[116844] = {cooldown = 45, duration = 5, talent = 19995, charges = 1, class = "MONK", type = 5}, --Ring of peace (talent)
|
||||
[119381] = {cooldown = 50, duration = 3, talent = false, charges = 1, class = "MONK", type = 5}, --Leg Sweep
|
||||
|
||||
--> hunter
|
||||
[193530] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Aspect of the Wild
|
||||
[19574] = {cooldown = 90, duration = 12, talent = false, charges = 1, class = "HUNTER", type = 1}, --Bestial Wrath
|
||||
[201430] = {cooldown = 180, duration = 12, talent = 23044, charges = 1, class = "HUNTER", type = 1}, --Stampede (talent)
|
||||
[194407] = {cooldown = 90, duration = 20, talent = 22295, charges = 1, class = "HUNTER", type = 1}, --Spitting Cobra (talent)
|
||||
[193526] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 1}, --Trueshot
|
||||
[281195] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest
|
||||
[199483] = {cooldown = 60, duration = 60, talent = 23100, charges = 1, class = "HUNTER", type = 2}, --Camouflage (talent)
|
||||
[281195] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest
|
||||
[266779] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Coordinated Assault
|
||||
[186265] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "HUNTER", type = 2}, --Aspect of the Turtle
|
||||
[109304] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "HUNTER", type = 2}, --Exhilaration
|
||||
[186257] = {cooldown = 144, duration = 14, talent = false, charges = 1, class = "HUNTER", type = 5}, --Aspect of the cheetah
|
||||
[19577] = {cooldown = 60, duration = 5, talent = false, charges = 1, class = "HUNTER", type = 5}, --Intimidation
|
||||
[109248] = {cooldown = 45, duration = 10, talent = 22499, charges = 1, class = "HUNTER", type = 5}, --Binding Shot (talent)
|
||||
[187650] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "HUNTER", type = 5}, --Freezing Trap
|
||||
[186289] = {cooldown = 72, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 5}, --Aspect of the eagle
|
||||
|
||||
--> druid
|
||||
[194223] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "DRUID", type = 1}, --Celestial Alignment
|
||||
@@ -527,42 +606,67 @@ DF.CooldownsInfo = {
|
||||
[102558] = {cooldown = 180, duration = 30, talent = 22388, charges = 1, class = "DRUID", type = 2}, --Incarnation: Guardian of Ursoc (talent)
|
||||
[33891] = {cooldown = 180, duration = 30, talent = 22421, charges = 1, class = "DRUID", type = 2}, --Incarnation: Tree of Life (talent)
|
||||
[102342] = {cooldown = 60, duration = 12, talent = false, charges = 1, class = "DRUID", type = 3}, --Ironbark
|
||||
[203651] = {cooldown = 60, duration = false, talent = 22422, charges = 1, class = "DRUID", type = 3}, --Overgrowth (talent)
|
||||
[740] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DRUID", type = 4}, --Tranquility
|
||||
[197721] = {cooldown = 90, duration = 8, talent = 22404, charges = 1, class = "DRUID", type = 4}, --Flourish (talent)
|
||||
[132469] = {cooldown = 30, duration = false, talent = false, charges = 1, class = "DRUID", type = 5}, --Typhoon
|
||||
[319454] = {cooldown = 300, duration = 45, talent = 18577, charges = 1, class = "DRUID", type = 5}, --Heart of the Wild (talent)
|
||||
|
||||
--> death knight
|
||||
[275699] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Apocalypse
|
||||
[42650] = {cooldown = 480, duration = 30, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Army of the Dead
|
||||
[49206] = {cooldown = 180, duration = 30, talent = 22538, charges = 1, class = "DEATHKNIGHT", type = 1}, --Summon Gargoyle (talent)
|
||||
[49206] = {cooldown = 180, duration = 30, talent = 22110, charges = 1, class = "DEATHKNIGHT", type = 1}, --Summon Gargoyle (talent)
|
||||
[207289] = {cooldown = 78, duration = 12, talent = 22538, charges = 1, class = "DEATHKNIGHT", type = 1}, --Unholy Assault (talent)
|
||||
[48743] = {cooldown = 120, duration = 15, talent = 23373, charges = 1, class = "DEATHKNIGHT", type = 2}, --Death Pact (talent)
|
||||
[48707] = {cooldown = 60, duration = 10, talent = 23373, charges = 1, class = "DEATHKNIGHT", type = 2}, --Anti-magic Shell
|
||||
[152279] = {cooldown = 120, duration = 5, talent = 22537, charges = 1, class = "DEATHKNIGHT", type = 1}, --Breath of Sindragosa (talent)
|
||||
[47568] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Empower Rune Weapon
|
||||
[279302] = {cooldown = 120, duration = 10, talent = 22535, charges = 1, class = "DEATHKNIGHT", type = 1}, --Frostwyrm's Fury (talent)
|
||||
[49028] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Dancing Rune Weapon
|
||||
[55233] = {cooldown = 90, duration = 10, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Vampiric Blood
|
||||
[48792] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Icebound Fortitude
|
||||
[108199] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Gorefiend's Grasp (utility)
|
||||
[51052] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "DEATHKNIGHT", type = 4}, --Anti-magic Zone
|
||||
[219809] = {cooldown = 60, duration = 8, talent = 23454, charges = 1, class = "DEATHKNIGHT", type = 2}, --Tombstone (talent)
|
||||
[108199] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Gorefiend's Grasp
|
||||
[207167] = {cooldown = 60, duration = 5, talent = 22519, charges = 1, class = "DEATHKNIGHT", type = 5}, --Blinding Sleet (talent)
|
||||
[108194] = {cooldown = 45, duration = 4, talent = 22520, charges = 1, class = "DEATHKNIGHT", type = 5}, --Asphyxiate (talent)
|
||||
[221562] = {cooldown = 45, duration = 5, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Asphyxiate
|
||||
|
||||
--> demon hunter
|
||||
[162264] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis
|
||||
[206491] = {cooldown = 120, duration = 60, talent = 22547, charges = 1, class = "DEMONHUNTER", type = 1}, --Nemesis (talent)
|
||||
[200166] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis
|
||||
[198589] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Blur
|
||||
[196555] = {cooldown = 120, duration = 5, talent = 21865, charges = 1, class = "DEMONHUNTER", type = 2}, --Netherwalk (talent)
|
||||
[196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness
|
||||
[187827] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Metamorphosis
|
||||
[196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness
|
||||
[188501] = {cooldown = 30, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Spectral Sight
|
||||
[179057] = {cooldown = 60, duration = 2, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Chaos Nova
|
||||
[211881] = {cooldown = 30, duration = 4, talent = 22767, charges = 1, class = "DEMONHUNTER", type = 5}, --Fel Eruption (talent)
|
||||
[320341] = {cooldown = 90, duration = false, talent = 21902, charges = 1, class = "DEMONHUNTER", type = 1}, --Bulk Extraction (talent)
|
||||
[204021] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Fiery Brand
|
||||
[263648] = {cooldown = 30, duration = 12, talent = 22768, charges = 1, class = "DEMONHUNTER", type = 2}, --Soul Barrier (talent)
|
||||
[207684] = {cooldown = 90, duration = 12, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Misery
|
||||
[202137] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Silence
|
||||
[202138] = {cooldown = 90, duration = 6, talent = 22511, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Chains (talent)
|
||||
|
||||
--> mage
|
||||
[12042] = {cooldown = 90, duration = 10, talent = false, charges = 1, class = "MAGE", type = 1}, --Arcane Power
|
||||
[12051] = {cooldown = 90, duration = 6, talent = false, charges = 1, class = "MAGE", type = 1}, --Evocation
|
||||
[110960] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "MAGE", type = 2}, --Greater Invisibility
|
||||
[235450] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Prismatic Barrier
|
||||
[235313] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Blazing Barrier
|
||||
[11426] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Ice Barrier
|
||||
[190319] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "MAGE", type = 1}, --Combustion
|
||||
[55342] = {cooldown = 120, duration = 40, talent = 22445, charges = 1, class = "MAGE", type = 1}, --Mirror Image (talent)
|
||||
[55342] = {cooldown = 120, duration = 40, talent = 22445, charges = 1, class = "MAGE", type = 1}, --Mirror Image
|
||||
[66] = {cooldown = 300, duration = 20, talent = false, charges = 1, class = "MAGE", type = 2}, --Invisibility
|
||||
[12472] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "MAGE", type = 1}, --Icy Veins
|
||||
[205021] = {cooldown = 78, duration = 5, talent = 22309, charges = 1, class = "MAGE", type = 1}, --Ray of Frost (talent)
|
||||
[45438] = {cooldown = 240, duration = 10, talent = false, charges = 1, class = "MAGE", type = 2}, --Ice Block
|
||||
[235219] = {cooldown = 300, duration = false, talent = false, charges = 1, class = "MAGE", type = 5}, --Cold Snap
|
||||
[113724] = {cooldown = 45, duration = 10, talent = 22471, charges = 1, class = "MAGE", type = 5}, --Ring of Frost (talent)
|
||||
|
||||
--> priest
|
||||
[10060] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "PRIEST", type = 1}, --Power Infusion
|
||||
[34433] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "PRIEST", type = 1}, --Shadowfiend
|
||||
[123040] = {cooldown = 60, duration = 12, talent = 22094, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent)
|
||||
[33206] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 3}, --Pain Suppression
|
||||
@@ -575,6 +679,7 @@ DF.CooldownsInfo = {
|
||||
[64844] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 4}, --Divine Hymn
|
||||
[64901] = {cooldown = 300, duration = 6, talent = false, charges = 1, class = "PRIEST", type = 4}, --Symbol of Hope
|
||||
[265202] = {cooldown = 720, duration = false, talent = 23145, charges = 1, class = "PRIEST", type = 4}, --Holy Word: Salvation (talent)
|
||||
[109964] = {cooldown = 60, duration = 12, talent = 21184, charges = 1, class = "PRIEST", type = 4}, --Spirit Shell (talent)
|
||||
[8122] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 5}, --Psychic Scream
|
||||
[200174] = {cooldown = 60, duration = 15, talent = 21719, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent)
|
||||
[193223] = {cooldown = 240, duration = 60, talent = 21979, charges = 1, class = "PRIEST", type = 1}, --Surrender to Madness (talent)
|
||||
@@ -588,10 +693,13 @@ DF.CooldownsInfo = {
|
||||
[31224] = {cooldown = 120, duration = 5, talent = false, charges = 1, class = "ROGUE", type = 2}, --Cloak of Shadows
|
||||
[2094] = {cooldown = 120, duration = 60, talent = false, charges = 1, class = "ROGUE", type = 5}, --Blind
|
||||
[114018] = {cooldown = 360, duration = 15, talent = false, charges = 1, class = "ROGUE", type = 5}, --Shroud of Concealment
|
||||
[185311] = {cooldown = 30, duration = 15, talent = false, charges = 1, class = "ROGUE", type = 5}, --Crimson Vial
|
||||
[13750] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Adrenaline Rush
|
||||
[51690] = {cooldown = 120, duration = 2, talent = 23175, charges = 1, class = "ROGUE", type = 1}, --Killing Spree (talent)
|
||||
[199754] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "ROGUE", type = 2}, --Riposte
|
||||
[121471] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Shadow Blades
|
||||
[343142] = {cooldown = 90, duration = 10, talent = 19250, charges = 1, class = "ROGUE", type = 5}, --Dreadblades
|
||||
[121471] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Shadow Blades
|
||||
}
|
||||
|
||||
-- {cooldown = , duration = , talent = false, charges = 1}
|
||||
@@ -636,7 +744,6 @@ DF.CrowdControlSpells = {
|
||||
[408] = "ROGUE", --Kidney Shot
|
||||
[6770] = "ROGUE", --Sap
|
||||
[1776] = "ROGUE", --Gouge
|
||||
[199804] = "ROGUE", --Between the Eyes
|
||||
|
||||
[853] = "PALADIN", --Hammer of Justice
|
||||
[20066] = "PALADIN", --Repentance (talent)
|
||||
@@ -659,8 +766,8 @@ DF.CrowdControlSpells = {
|
||||
[209753] = "DRUID", --Cyclone (from pvp talent)
|
||||
[33786] = "DRUID", --Cyclone (from pvp talent - resto druid)
|
||||
|
||||
[3355] = "HUNTER", --Freezing Trap
|
||||
[203337] = "HUNTER", --Diamond Ice (from pvp talent)
|
||||
[3355] = "HUNTER", --Freezing Trap
|
||||
[3355] = "HUNTER", --Diamond Ice (from pvp talent)
|
||||
[19577] = "HUNTER", --Intimidation
|
||||
[190927] = "HUNTER", --Harpoon
|
||||
[162480] = "HUNTER", --Steel Trap
|
||||
@@ -790,93 +897,67 @@ end
|
||||
--consumables
|
||||
|
||||
DF.FlaskIDs = {
|
||||
[251836] = true, -- Flask of the Currents agility
|
||||
[251837] = true, -- Flask of Endless Fathoms intellect
|
||||
[251838] = true, -- Flask of the Vast Horizon stamina
|
||||
[251839] = true, -- Flask of the Undertow strength
|
||||
--Shadowlands
|
||||
[307185] = true, --Spectral Flask of Power
|
||||
[307187] = true, --Spectral Stamina Flask
|
||||
[307166] = true, --Eternal Flask
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--revision ny nullKomplex july 07 2019
|
||||
[298836] = true, -- Greater Flask of the Currents agility
|
||||
[298837] = true, -- Greater Flask of Endless Fathoms intellect
|
||||
[298839] = true, -- Greater Flask of the Vast Horizon stamina
|
||||
[298841] = true, -- Greater Flask of the Undertow strength
|
||||
}
|
||||
|
||||
DF.FoodIDs = {
|
||||
[257422] = 41, --Mon'Dazi versatility
|
||||
[257413] = 41, --Ravenberry Tarts haste
|
||||
[257418] = 41, --Loa Loaf mastery
|
||||
[257408] = 41, --Kul Tiramisu critical
|
||||
|
||||
[257424] = 55, --Spiced Snapper versatility
|
||||
[257415] = 55, --Swamp Fish 'n Chips haste
|
||||
[257420] = 55, --Sailor's Pie mastery
|
||||
[257410] = 55, --Honey-Glazed Haunches critical
|
||||
|
||||
[259448] = 75, --Galley Banquet agility
|
||||
[259449] = 75, --Galley Banquet intellect
|
||||
[259453] = 75, --Galley Banquet stamina
|
||||
[259452] = 75, --Galley Banquet strength
|
||||
|
||||
[259454] = 100, --Bountiful Captain's Feast agility
|
||||
[259455] = 100, --Bountiful Captain's Feast intellect
|
||||
[259457] = 100, --Bountiful Captain's Feast stamina
|
||||
[257427] = 100, --Bountiful Captain's Feast strength
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--revision ny nullKomplex july 07 2019
|
||||
[288074] = 113, -- Wild Berry Bread stamina (maybe fake it as 41?)
|
||||
|
||||
[285721] = 60, -- Druid Rebirth trait agility
|
||||
[285719] = 60, -- Druid Rebirth trait intellect
|
||||
[285720] = 60, -- Druid Rebirth trait strength
|
||||
|
||||
-- Put in 70 section:
|
||||
[288075] = 150, -- Seasoned Steak and Potatoes (70?)
|
||||
|
||||
[290467] = 85, -- Boralus Blood Sausage agility
|
||||
[290468] = 85, -- Boralus Blood Sausage intellect
|
||||
[290469] = 85, -- Boralus Blood Sausage strength
|
||||
|
||||
[297037] = 93, -- Bil'Tong versatility
|
||||
[297034] = 93, -- Baked Port Tato haste
|
||||
[297035] = 93, -- Abyssal-Fried Rissole mastery
|
||||
[297039] = 93, -- Mech-Dowel's "Big Mech" critical
|
||||
[297040] = 198, -- Fragrant Kakavia stamina (93?)
|
||||
|
||||
[297116] = 131, -- Famine Evaluator And Snack Table agility
|
||||
[297117] = 131, -- Famine Evaluator And Snack Table intellect
|
||||
[297118] = 131, -- Famine Evaluator And Snack Table strength
|
||||
--shadowlands tier 1
|
||||
[259454] = 1, -- (agility) Feast of Gluttonous Hedonism
|
||||
[308434] = 1, -- (critical) Phantasmal Souffle and Fries
|
||||
[308488] = 1, -- (haste) Tenebrous Crown Roast Aspic
|
||||
[308506] = 1, -- (mastery) Crawler Ravioli with Apple Sauce
|
||||
[308525] = 1, -- (stamina) Banana Beef Pudding
|
||||
[308514] = 1, -- (versatility) Steak a la Mode
|
||||
[327851] = 1, -- (periodicaly heal out of combat) Seraph Tenders
|
||||
[308637] = 1, -- (periodicaly damage) Smothered Shank
|
||||
[327715] = 1, -- (speed) Fried Bonefish
|
||||
}
|
||||
|
||||
DF.PotionIDs = {
|
||||
[279152] = true, --Battle Potion of Agility
|
||||
[279151] = true, --Battle Potion of Intellect
|
||||
[279154] = true, --Battle Potion of Stamina
|
||||
[279153] = true, --Battle Potion of Strength
|
||||
|
||||
[269853] = true, --Potion of Rising Death (range)
|
||||
[251316] = true, --Potion of Bursting Blood (melee)
|
||||
[251231] = true, --Steelskin Potion (tank)
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--revision ny nullKomplex july 07 2019
|
||||
[298146] = true, -- Superior Battle Potion of Agility
|
||||
[298152] = true, -- Superior Battle Potion of Intellect
|
||||
[298153] = true, -- Superior Battle Potion of Stamina
|
||||
[298154] = true, -- Superior Battle Potion of Strength
|
||||
--Shadowlands
|
||||
[307159] = true, --Potion of Spectral Agility
|
||||
[307163] = true, --Potion of Spectral Stamina
|
||||
[307164] = true, --Potion of Spectral Strength
|
||||
[307160] = true, --Potion of Hardened Shadows
|
||||
[307162] = true, --Potion of Spectral Intellect
|
||||
[307494] = true, --Potion of Empowered Exorcisms
|
||||
[307495] = true, --Potion of Phantom Fire
|
||||
[307496] = true, --Potion of Divine Awakening
|
||||
[307161] = true, --Potion of Spiritual Clarity
|
||||
[307496] = true, --Potion of Divine Awakening
|
||||
[307501] = true, --Potion of Specter Swiftness
|
||||
[322302] = true, --Potion of Sacrificial Anima
|
||||
[307497] = true, --Potion of Deathly Fixation
|
||||
[307195] = true, --Potion of the Hidden Spirit
|
||||
[307199] = true, --Potion of Soul Purity
|
||||
[307196] = true, --Potion of Shadow Sight
|
||||
[307192] = true, --Spiritual Healing Potion
|
||||
[307194] = true, --Spiritual Rejuvenation Potion
|
||||
[307193] = true, --Spiritual Mana Potion
|
||||
[323436] = true, --Purify Soul (greek convent)
|
||||
-- [] = true, --
|
||||
|
||||
[307165] = true, --Spiritual Anti-Venom
|
||||
|
||||
|
||||
}
|
||||
|
||||
DF.FeastIDs = {
|
||||
[308462] = true, --Feast of Gluttonous Hedonism
|
||||
[307153] = true, --Eternal Cauldron
|
||||
|
||||
|
||||
|
||||
[298317] = true, -- Potion of Focused Resolve (crit)
|
||||
[300714] = true, -- Potion of Unbridled Fury (fire damage)
|
||||
[298225] = true, -- Potion of Empowered Proximity (main stat per enemy)
|
||||
[298155] = true, -- Superior Steelskin Potion (tank)
|
||||
[300741] = true, -- Potion of Wild Mending (healer)
|
||||
}
|
||||
|
||||
DF.RuneIDs = {
|
||||
[270058] = true, --Battle-Scarred Augment Rune
|
||||
[317065] = true, --Lightning-Forged Augment Rune
|
||||
|
||||
}
|
||||
|
||||
-- /dump UnitAura ("player", 1)
|
||||
|
||||
+683
-683
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="split_bar.lua"/>
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ .. \FrameXML\UI.xsd">
|
||||
<Script file="split_bar.lua"/>
|
||||
</Ui>
|
||||
|
||||
+21
-9
@@ -245,6 +245,18 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1
|
||||
end
|
||||
end
|
||||
|
||||
function TextEntryMetaFunctions:SetBackdrop(...)
|
||||
return self.editbox:SetBackdrop(...)
|
||||
end
|
||||
|
||||
function TextEntryMetaFunctions:SetBackdropColor(...)
|
||||
return self.editbox:SetBackdropColor(...)
|
||||
end
|
||||
|
||||
function TextEntryMetaFunctions:SetBackdropBorderColor(...)
|
||||
return self.editbox:SetBackdropBorderColor(...)
|
||||
end
|
||||
|
||||
--> select all text
|
||||
function TextEntryMetaFunctions:SelectAll()
|
||||
self.editbox:HighlightText()
|
||||
@@ -608,7 +620,7 @@ function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, p
|
||||
TextEntryObject.container = container
|
||||
TextEntryObject.have_tooltip = nil
|
||||
|
||||
TextEntryObject.editbox = CreateFrame ("EditBox", name, parent)
|
||||
TextEntryObject.editbox = CreateFrame ("EditBox", name, parent,"BackdropTemplate")
|
||||
TextEntryObject.editbox:SetSize (232, 20)
|
||||
TextEntryObject.editbox:SetBackdrop ({bgFile = [["Interface\DialogFrame\UI-DialogBox-Background"]], tileSize = 64, tile = true, edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 0}})
|
||||
|
||||
@@ -1111,17 +1123,17 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
|
||||
name = name:gsub ("$parent", parentName)
|
||||
end
|
||||
|
||||
local borderframe = CreateFrame ("Frame", name, parent)
|
||||
local borderframe = CreateFrame ("Frame", name, parent,"BackdropTemplate")
|
||||
borderframe:SetSize (w, h)
|
||||
|
||||
if (member) then
|
||||
parent [member] = borderframe
|
||||
end
|
||||
|
||||
local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate")
|
||||
local scrollframeNumberLines = CreateFrame ("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate")
|
||||
local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate")
|
||||
local scrollframeNumberLines = CreateFrame ("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate")
|
||||
|
||||
scrollframe.editbox = CreateFrame ("editbox", "$parentEditBox", scrollframe)
|
||||
scrollframe.editbox = CreateFrame ("editbox", "$parentEditBox", scrollframe,"BackdropTemplate")
|
||||
scrollframe.editbox:SetMultiLine (true)
|
||||
scrollframe.editbox:SetAutoFocus (false)
|
||||
scrollframe.editbox:SetScript ("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged)
|
||||
@@ -1131,7 +1143,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
|
||||
|
||||
--line number
|
||||
if (showLineNumbers) then
|
||||
scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines)
|
||||
scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines, "BackdropTemplate")
|
||||
scrollframeNumberLines.editbox:SetMultiLine (true)
|
||||
scrollframeNumberLines.editbox:SetAutoFocus (false)
|
||||
scrollframeNumberLines.editbox:SetEnabled (false)
|
||||
@@ -1147,7 +1159,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
|
||||
|
||||
for i = 1, 1000 do
|
||||
scrollframeNumberLines.editbox:Insert (i .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
--place the lua code field 20 pixels to the right to make run to the lines scroll
|
||||
scrollframe:SetPoint ("topleft", borderframe, "topleft", 30, -10)
|
||||
@@ -1190,7 +1202,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
|
||||
scrollframeNumberLines:SetPoint ("bottomright", borderframe, "bottomright", -10, 10)
|
||||
scrollframeNumberLines:Hide()
|
||||
end
|
||||
--16:40
|
||||
|
||||
borderframe.SetAsAutoComplete = TextEntryMetaFunctions.SetAsAutoComplete
|
||||
|
||||
scrollframe:SetScript ("OnSizeChanged", function (self)
|
||||
@@ -1260,7 +1272,7 @@ local function bit (x,b)
|
||||
end
|
||||
|
||||
local function lor (x,y)
|
||||
result = 0
|
||||
local result = 0
|
||||
for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end
|
||||
return result
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
<Script file="textentry.lua"/>
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
<Script file="textentry.lua"/>
|
||||
</Ui>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
</Ui>
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
</Ui>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--[[--
|
||||
LibDeflate 1.0.0-release <br>
|
||||
LibDeflate 1.0.2-release <br>
|
||||
Pure Lua compressor and decompressor with high compression ratio using
|
||||
DEFLATE/zlib format.
|
||||
|
||||
@file LibDeflate.lua
|
||||
@author Haoqian He (Github: SafeteeWoW; World of Warcraft: Safetyy-Illidan(US))
|
||||
@copyright LibDeflate <2018> Haoqian He
|
||||
@license GNU General Public License Version 3 or later
|
||||
@copyright LibDeflate <2018-2020> Haoqian He
|
||||
@license zlib License
|
||||
|
||||
This library is implemented according to the following specifications. <br>
|
||||
Report a bug if LibDeflate is not fully compliant with those specs. <br>
|
||||
@@ -16,8 +16,10 @@ https://tools.ietf.org/html/rfc1951 <br>
|
||||
2. RFC1951: ZLIB Compressed Data Format Specification version 3.3 <br>
|
||||
https://tools.ietf.org/html/rfc1950 <br>
|
||||
|
||||
This library requires Lua 5.1/5.2/5.3 interpreter or LuaJIT v2.0+. <br>
|
||||
This library requires Lua 5.1/5.2/5.3/5.4 interpreter or LuaJIT v2.0+. <br>
|
||||
This library does not have any dependencies. <br>
|
||||
Note at the time of this release, Lua 5.4 final is not released yet. <br>
|
||||
For Lua 5.4, This library is tested with its rc6 version. <br>
|
||||
<br>
|
||||
This file "LibDeflate.lua" is the only source file of
|
||||
the library. <br>
|
||||
@@ -26,20 +28,33 @@ https://github.com/safeteeWow/LibDeflate/issues
|
||||
]]
|
||||
|
||||
--[[
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
any later version.
|
||||
zlib License
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
(C) 2018-2020 Haoqian He
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
Credits and Disclaimer:
|
||||
The following projects are used to the help to test the correctness
|
||||
of this program. The code of this program (LibDeflate.lua) does not
|
||||
use their code directly, but uses their ideas and algorithms. Their original
|
||||
licenses shall be comply when used.
|
||||
|
||||
Credits:
|
||||
1. zlib, by Jean-loup Gailly (compression) and Mark Adler (decompression).
|
||||
http://www.zlib.net/
|
||||
Licensed under zlib License. http://www.zlib.net/zlib_license.html
|
||||
@@ -61,9 +76,9 @@ Credits:
|
||||
--[[
|
||||
Curseforge auto-packaging replacements:
|
||||
|
||||
Project Date: 2018-07-29T18:58:38Z
|
||||
Project Hash: 420f583c8c1ad0d4fc12398c86e99a65cf37a79a
|
||||
Project Version: 1.0.0-release
|
||||
Project Date: 2020-06-26T15:11:26Z
|
||||
Project Hash: c19f978f053ebd22950eb6f1df4445677a4b0160
|
||||
Project Version: 1.0.2-release
|
||||
--]]
|
||||
|
||||
local LibDeflate
|
||||
@@ -73,23 +88,34 @@ do
|
||||
-- Suffix can be alpha1, alpha2, beta1, beta2, rc1, rc2, etc.
|
||||
-- NOTE: Two version numbers needs to modify.
|
||||
-- 1. On the top of LibDeflate.lua
|
||||
-- 2. HERE
|
||||
local _VERSION = "1.0.0-release"
|
||||
-- 2. _VERSION
|
||||
-- 3. _MINOR
|
||||
|
||||
-- version to store the official version of LibDeflate
|
||||
local _VERSION = "1.0.2-release"
|
||||
|
||||
-- When MAJOR is changed, I should name it as LibDeflate2
|
||||
local _MAJOR = "LibDeflate"
|
||||
|
||||
-- Update this whenever a new version, for LibStub version registration.
|
||||
-- 0 : v0.x
|
||||
-- 1 : v1.0.0
|
||||
-- 2 : v1.0.1
|
||||
-- 3 : v1.0.2
|
||||
local _MINOR = 3
|
||||
|
||||
local _COPYRIGHT =
|
||||
"LibDeflate ".._VERSION
|
||||
.." Copyright (C) 2018 Haoqian He."
|
||||
.." License GPLv3+: GNU GPL version 3 or later"
|
||||
.." Copyright (C) 2018-2020 Haoqian He."
|
||||
.." Licensed under the zlib License"
|
||||
|
||||
-- Register in the World of Warcraft library "LibStub" if detected.
|
||||
if LibStub then
|
||||
local MAJOR, MINOR = "LibDeflate", -1
|
||||
-- When MAJOR is changed, I should name it as LibDeflate2
|
||||
local lib, minor = LibStub:GetLibrary(MAJOR, true)
|
||||
if lib and minor and minor >= MINOR then -- No need to update.
|
||||
local lib, minor = LibStub:GetLibrary(_MAJOR, true)
|
||||
if lib and minor and minor >= _MINOR then -- No need to update.
|
||||
return lib
|
||||
else -- Update or first time register
|
||||
LibDeflate = LibStub:NewLibrary(MAJOR, _VERSION)
|
||||
LibDeflate = LibStub:NewLibrary(_MAJOR, _MINOR)
|
||||
-- NOTE: It is important that new version has implemented
|
||||
-- all exported APIs and tables in the old version,
|
||||
-- so the old library is fully garbage collected,
|
||||
@@ -100,6 +126,8 @@ do
|
||||
end
|
||||
|
||||
LibDeflate._VERSION = _VERSION
|
||||
LibDeflate._MAJOR = _MAJOR
|
||||
LibDeflate._MINOR = _MINOR
|
||||
LibDeflate._COPYRIGHT = _COPYRIGHT
|
||||
end
|
||||
|
||||
@@ -1205,6 +1233,8 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
|
||||
end
|
||||
end
|
||||
|
||||
local dict_string_len_plus3 = dict_string_len + 3
|
||||
|
||||
hash = (string_table[block_start-offset] or 0)*256
|
||||
+ (string_table[block_start+1-offset] or 0)
|
||||
|
||||
@@ -1235,6 +1265,7 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
|
||||
-- because I think this is easier for me to maintain it.
|
||||
while (index <= index_end) do
|
||||
local string_table_index = index - offset
|
||||
local offset_minus_three = offset - 3
|
||||
prev_len = cur_len
|
||||
prev_dist = cur_dist
|
||||
cur_len = 0
|
||||
@@ -1272,6 +1303,11 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
|
||||
(config_use_lazy and prev_len >= config_good_prev_length)
|
||||
and config_good_hash_chain or config_max_hash_chain
|
||||
|
||||
local max_len_minus_one = block_end - index
|
||||
max_len_minus_one = (max_len_minus_one >= 257) and 257 or max_len_minus_one
|
||||
max_len_minus_one = max_len_minus_one + string_table_index
|
||||
local string_table_index_plus_three = string_table_index + 3
|
||||
|
||||
while chain_index >= 1 and depth > 0 do
|
||||
local prev = cur_chain[chain_index]
|
||||
|
||||
@@ -1279,35 +1315,26 @@ local function GetBlockLZ77Result(level, string_table, hash_tables, block_start,
|
||||
break
|
||||
end
|
||||
if prev < index then
|
||||
local j = 3
|
||||
local sj = string_table_index_plus_three
|
||||
|
||||
if prev >= -257 then
|
||||
local prev_table_index = prev-offset
|
||||
-- NOTE for author:
|
||||
-- j < 258 and index + j <= block_end
|
||||
-- This is the right condition
|
||||
while (j < 258 and index + j <= block_end) do
|
||||
if (string_table[prev_table_index+j]
|
||||
== string_table[string_table_index+j]) then
|
||||
j = j + 1
|
||||
else
|
||||
break
|
||||
end
|
||||
local pj = prev - offset_minus_three
|
||||
while (sj <= max_len_minus_one
|
||||
and string_table[pj]
|
||||
== string_table[sj]) do
|
||||
sj = sj + 1
|
||||
pj = pj + 1
|
||||
end
|
||||
else
|
||||
local prev_table_index = dict_string_len+prev
|
||||
-- NOTE for author:
|
||||
-- j < 258 and index + j <= block_end
|
||||
-- This is the right condition
|
||||
while (j < 258 and index + j <= block_end) do
|
||||
if (dict_string_table[prev_table_index+j]
|
||||
== string_table[string_table_index+j]) then
|
||||
j = j + 1
|
||||
else
|
||||
break
|
||||
end
|
||||
local pj = dict_string_len_plus3 + prev
|
||||
while (sj <= max_len_minus_one
|
||||
and dict_string_table[pj]
|
||||
== string_table[sj]) do
|
||||
sj = sj + 1
|
||||
pj = pj + 1
|
||||
end
|
||||
end
|
||||
local j = sj - string_table_index
|
||||
if j > cur_len then
|
||||
cur_len = j
|
||||
cur_dist = index - prev
|
||||
|
||||
@@ -37,6 +37,15 @@
|
||||
-- }
|
||||
-- ...
|
||||
-- }
|
||||
-- .pvp_talents = {
|
||||
-- [<talent_id>] = {
|
||||
-- .name_localized
|
||||
-- .icon
|
||||
-- .talent_id
|
||||
-- .spell_id
|
||||
-- }
|
||||
-- ...
|
||||
-- }
|
||||
-- .lku -- last known unit id
|
||||
-- .not_visible
|
||||
--
|
||||
@@ -62,7 +71,7 @@
|
||||
-- Returns an array with the set of unit ids for the current group.
|
||||
--]]
|
||||
|
||||
local MAJOR, MINOR = "LibGroupInSpecT-1.1", 90
|
||||
local MAJOR, MINOR = "LibGroupInSpecT-1.1", 91
|
||||
|
||||
if not LibStub then error(MAJOR.." requires LibStub") end
|
||||
local lib = LibStub:NewLibrary (MAJOR, MINOR)
|
||||
@@ -90,7 +99,7 @@ local MAX_ATTEMPTS = 2
|
||||
lib.debug = false
|
||||
local function debug (...)
|
||||
if lib.debug then -- allow programmatic override of debug output by client addons
|
||||
print (...)
|
||||
print (...)
|
||||
end
|
||||
end
|
||||
--@end-debug@]===]
|
||||
@@ -154,13 +163,17 @@ local GetClassInfo = _G.GetClassInfo
|
||||
local GetNumSubgroupMembers = _G.GetNumSubgroupMembers
|
||||
local GetNumSpecializationsForClassID = _G.GetNumSpecializationsForClassID
|
||||
local GetPlayerInfoByGUID = _G.GetPlayerInfoByGUID
|
||||
local GetInspectSelectedPvpTalent = _G.C_SpecializationInfo.GetInspectSelectedPvpTalent
|
||||
local GetInspectSpecialization = _G.GetInspectSpecialization
|
||||
local GetSpecialization = _G.GetSpecialization
|
||||
local GetSpecializationInfo = _G.GetSpecializationInfo
|
||||
local GetSpecializationInfoForClassID = _G.GetSpecializationInfoForClassID
|
||||
local GetSpecializationRoleByID = _G.GetSpecializationRoleByID
|
||||
local GetSpellInfo = _G.GetSpellInfo
|
||||
local GetPvpTalentInfoByID = _G.GetPvpTalentInfoByID
|
||||
local GetPvpTalentSlotInfo = _G.C_SpecializationInfo.GetPvpTalentSlotInfo
|
||||
local GetTalentInfo = _G.GetTalentInfo
|
||||
local GetTalentInfoByID = _G.GetTalentInfoByID
|
||||
local IsInRaid = _G.IsInRaid
|
||||
--local NotifyInspect = _G.NotifyInspect -- Don't cache, as to avoid missing future hooks
|
||||
local GetNumClasses = _G.GetNumClasses
|
||||
@@ -172,7 +185,12 @@ local UnitIsConnected = _G.UnitIsConnected
|
||||
local UnitIsPlayer = _G.UnitIsPlayer
|
||||
local UnitIsUnit = _G.UnitIsUnit
|
||||
local UnitName = _G.UnitName
|
||||
local SendAddonMessage = C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage -- XXX 8.0 compat
|
||||
local SendAddonMessage = _G.C_ChatInfo.SendAddonMessage
|
||||
local RegisterAddonMessagePrefix = _G.C_ChatInfo.RegisterAddonMessagePrefix
|
||||
|
||||
local MAX_TALENT_TIERS = _G.MAX_TALENT_TIERS
|
||||
local NUM_TALENT_COLUMNS = _G.NUM_TALENT_COLUMNS
|
||||
local NUM_PVP_TALENT_SLOTS = 4
|
||||
|
||||
|
||||
local global_spec_id_roles_detailed = {
|
||||
@@ -255,11 +273,7 @@ function lib:PLAYER_LOGIN ()
|
||||
frame:RegisterEvent ("UNIT_NAME_UPDATE")
|
||||
frame:RegisterEvent ("UNIT_AURA")
|
||||
frame:RegisterEvent ("CHAT_MSG_ADDON")
|
||||
if C_ChatInfo then -- XXX 8.0 compat
|
||||
C_ChatInfo.RegisterAddonMessagePrefix (COMMS_PREFIX)
|
||||
else
|
||||
RegisterAddonMessagePrefix (COMMS_PREFIX)
|
||||
end
|
||||
RegisterAddonMessagePrefix (COMMS_PREFIX)
|
||||
|
||||
local guid = UnitGUID ("player")
|
||||
local info = self:BuildInfo ("player")
|
||||
@@ -307,26 +321,17 @@ lib.static_cache.class_to_class_id = {} -- [CLASS] -> class_id
|
||||
-- The talents cache can no longer be pre-fetched on login, but is now constructed class-by-class as we inspect people.
|
||||
-- This probably means we want to only ever access it through the GetCachedTalentInfo() helper function below.
|
||||
lib.static_cache.talents = {} -- [talent_id] -> { .spell_id, .talent_id, .name_localized, .icon, .tier, .column }
|
||||
|
||||
-- Dridzt: I'd love another way but none of the GetTalent* functions return spellID, GetTalentLink() and parsing the link gives talentID that's not related to spellID as well
|
||||
-- A quick tooltip scan is cheap though so elegance aside this is a good workaround considering this only runs once
|
||||
local tip = CreateFrame ("GameTooltip", MAJOR.."ScanTip", nil, "GameTooltipTemplate")
|
||||
tip:SetOwner (UIParent, "ANCHOR_NONE")
|
||||
lib.static_cache.pvp_talents = {} -- [talent_id] -> { .spell_id, .talent_id, .name_localized, .icon }
|
||||
|
||||
function lib:GetCachedTalentInfo (class_id, tier, col, group, is_inspect, unit)
|
||||
local talents = self.static_cache.talents
|
||||
local talent_id, name, icon, sel, avail = GetTalentInfo (tier, col, group, is_inspect, unit)
|
||||
if not talent_id or not class_id then
|
||||
local talent_id, name, icon, sel, _, spell_id = GetTalentInfo (tier, col, group, is_inspect, unit)
|
||||
if not talent_id then
|
||||
--[===[@debug@
|
||||
debug ("GetCachedTalentInfo("..tostring(class_id)..","..tier..","..col..","..group..","..tostring(is_inspect)..","..tostring(unit)..") returned nil") --@end-debug@]===]
|
||||
return {}
|
||||
end
|
||||
talents[class_id] = talents[class_id] or {}
|
||||
local class_talents = talents[class_id]
|
||||
local class_talents = self.static_cache.talents
|
||||
if not class_talents[talent_id] then
|
||||
tip:ClearLines ()
|
||||
tip:SetTalent (talent_id, is_inspect, group)
|
||||
local _, _,spell_id = tip:GetSpell ()
|
||||
class_talents[talent_id] = {
|
||||
spell_id = spell_id,
|
||||
talent_id = talent_id,
|
||||
@@ -339,6 +344,45 @@ function lib:GetCachedTalentInfo (class_id, tier, col, group, is_inspect, unit)
|
||||
return class_talents[talent_id], sel
|
||||
end
|
||||
|
||||
function lib:GetCachedTalentInfoByID (talent_id)
|
||||
local class_talents = self.static_cache.talents
|
||||
if talent_id and not class_talents[talent_id] then
|
||||
local _, name, icon, _, _, spell_id, _, row, col = GetTalentInfoByID (talent_id)
|
||||
if not name then
|
||||
--[===[@debug@
|
||||
debug ("GetCachedTalentInfoByID("..tostring(talent_id)..") returned nil") --@end-debug@]===]
|
||||
return nil
|
||||
end
|
||||
class_talents[talent_id] = {
|
||||
spell_id = spell_id,
|
||||
talent_id = talent_id,
|
||||
name_localized = name,
|
||||
icon = icon,
|
||||
tier = row,
|
||||
column = col,
|
||||
}
|
||||
end
|
||||
return class_talents[talent_id]
|
||||
end
|
||||
|
||||
function lib:GetCachedPvpTalentInfoByID (talent_id)
|
||||
local pvp_talents = self.static_cache.pvp_talents
|
||||
if talent_id and not pvp_talents[talent_id] then
|
||||
local _, name, icon, _, _, spell_id = GetPvpTalentInfoByID (talent_id)
|
||||
if not name then
|
||||
--[===[@debug@
|
||||
debug ("GetCachedPvpTalentInfo("..tostring(talent_id)..") returned nil") --@end-debug@]===]
|
||||
return nil
|
||||
end
|
||||
pvp_talents[talent_id] = {
|
||||
spell_id = spell_id,
|
||||
talent_id = talent_id,
|
||||
name_localized = name,
|
||||
icon = icon,
|
||||
}
|
||||
end
|
||||
return pvp_talents[talent_id]
|
||||
end
|
||||
|
||||
function lib:CacheGameData ()
|
||||
local gspecs = self.static_cache.global_specs
|
||||
@@ -507,13 +551,13 @@ function lib:BuildInfo (unit)
|
||||
|
||||
local is_inspect = not UnitIsUnit (unit, "player")
|
||||
local spec = GetSpecialization ()
|
||||
info.global_spec_id = is_inspect and GetInspectSpecialization (unit) or spec and GetSpecializationInfo (spec)
|
||||
local gspec_id = is_inspect and GetInspectSpecialization (unit) or spec and GetSpecializationInfo (spec)
|
||||
|
||||
local gspecs = self.static_cache.global_specs
|
||||
if not info.global_spec_id or not gspecs[info.global_spec_id] then -- not a valid spec_id
|
||||
if not gspec_id or not gspecs[gspec_id] then -- not a valid spec_id
|
||||
info.global_spec_id = nil
|
||||
else
|
||||
local gspec_id = info.global_spec_id
|
||||
info.global_spec_id = gspec_id
|
||||
local spec_info = gspecs[gspec_id]
|
||||
info.spec_index = spec_info.idx
|
||||
info.spec_name_localized = spec_info.name_localized
|
||||
@@ -528,22 +572,42 @@ function lib:BuildInfo (unit)
|
||||
if not info.spec_role_detailed then info.spec_role_detailed = class and class_fixed_roles_detailed[class] end
|
||||
|
||||
info.talents = info.talents or {}
|
||||
info.pvp_talents = info.pvp_talents or {}
|
||||
|
||||
-- If GetPlayerInfoByGUID didn't return the class, we can't do talents yet
|
||||
if info.class_id then
|
||||
-- Only scan talents when we have player data
|
||||
if info.spec_index then
|
||||
info.spec_group = GetActiveSpecGroup (is_inspect)
|
||||
wipe (info.talents) -- Due to spec-specific talents we might leave things in on a spec-change otherwise
|
||||
wipe (info.talents)
|
||||
for tier = 1, MAX_TALENT_TIERS do
|
||||
for col = 1, NUM_TALENT_COLUMNS do
|
||||
local talent, sel = self:GetCachedTalentInfo (info.class_id, tier, col, info.spec_group, is_inspect, unit)
|
||||
if talent and talent.talent_id and sel then
|
||||
if sel then
|
||||
info.talents[talent.talent_id] = talent
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
wipe (info.pvp_talents)
|
||||
if is_inspect then
|
||||
for index = 1, NUM_PVP_TALENT_SLOTS do
|
||||
local talent_id = GetInspectSelectedPvpTalent (unit, index)
|
||||
if talent_id then
|
||||
info.pvp_talents[talent_id] = self:GetCachedPvpTalentInfoByID (talent_id)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- C_SpecializationInfo.GetAllSelectedPvpTalentIDs will sometimes return a lot of extra talents
|
||||
for index = 1, NUM_PVP_TALENT_SLOTS do
|
||||
local slot_info = GetPvpTalentSlotInfo (index)
|
||||
local talent_id = slot_info and slot_info.selectedTalentID
|
||||
if talent_id then
|
||||
info.pvp_talents[talent_id] = self:GetCachedPvpTalentInfoByID (talent_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
info.glyphs = wipe (info.glyphs or {}) -- kept for addons that still refer to this
|
||||
info.glyphs = info.glyphs or {} -- kept for addons that still refer to this
|
||||
|
||||
if is_inspect and not UnitIsVisible (unit) and UnitIsConnected (unit) then info.not_visible = true end
|
||||
|
||||
@@ -635,7 +699,7 @@ function lib:SendLatestSpecData ()
|
||||
local info = self.cache[guid]
|
||||
if not info then return end
|
||||
|
||||
-- fmt, guid, global_spec_id, talent1 -> MAX_TALENT_TIERS
|
||||
-- fmt, guid, global_spec_id, talent1 -> MAX_TALENT_TIERS, pvptalent1 -> NUM_PVP_TALENT_SLOTS
|
||||
-- sequentially, allow no gaps for missing talents we decode by index on the receiving end.
|
||||
local datastr = COMMS_FMT..COMMS_DELIM..guid..COMMS_DELIM..(info.global_spec_id or 0)
|
||||
local talentCount = 1
|
||||
@@ -646,6 +710,14 @@ function lib:SendLatestSpecData ()
|
||||
for i=talentCount,MAX_TALENT_TIERS do
|
||||
datastr = datastr..COMMS_DELIM..0
|
||||
end
|
||||
talentCount = 1
|
||||
for k in pairs(info.pvp_talents) do
|
||||
datastr = datastr..COMMS_DELIM..k
|
||||
talentCount = talentCount + 1
|
||||
end
|
||||
for i=talentCount,NUM_PVP_TALENT_SLOTS do
|
||||
datastr = datastr..COMMS_DELIM..0
|
||||
end
|
||||
|
||||
--[===[@debug@
|
||||
debug ("Sending LGIST update to "..scope) --@end-debug@]===]
|
||||
@@ -664,11 +736,13 @@ end
|
||||
|
||||
-- Indicies for various parts of the split data msg
|
||||
local msg_idx = {}
|
||||
msg_idx.fmt = 1
|
||||
msg_idx.guid = msg_idx.fmt + 1
|
||||
msg_idx.global_spec_id = msg_idx.guid + 1
|
||||
msg_idx.talents = msg_idx.global_spec_id + 1
|
||||
msg_idx.end_talents = msg_idx.talents + MAX_TALENT_TIERS - 1
|
||||
msg_idx.fmt = 1
|
||||
msg_idx.guid = msg_idx.fmt + 1
|
||||
msg_idx.global_spec_id = msg_idx.guid + 1
|
||||
msg_idx.talents = msg_idx.global_spec_id + 1
|
||||
msg_idx.end_talents = msg_idx.talents + MAX_TALENT_TIERS
|
||||
msg_idx.pvp_talents = msg_idx.end_talents + 1
|
||||
msg_idx.end_pvp_talents = msg_idx.pvp_talents + NUM_PVP_TALENT_SLOTS - 1
|
||||
|
||||
function lib:CHAT_MSG_ADDON (prefix, datastr, scope, sender)
|
||||
if prefix ~= COMMS_PREFIX or scope ~= self.commScope then return end
|
||||
@@ -713,27 +787,34 @@ function lib:CHAT_MSG_ADDON (prefix, datastr, scope, sender)
|
||||
info.spec_role = gspecs[gspec_id].role
|
||||
info.spec_role_detailed = global_spec_id_roles_detailed[gspec_id]
|
||||
|
||||
local need_inspect = nil
|
||||
local need_inspect = nil -- shouldn't be needed, but just in case
|
||||
info.talents = wipe (info.talents or {})
|
||||
local talents = self.static_cache.talents[info.class_id]
|
||||
if talents then -- The group entry is created before we have inspect-data, so may not have cached talents yet
|
||||
for i = msg_idx.talents, msg_idx.end_talents do
|
||||
local talent_id = tonumber (data[i])
|
||||
if talent_id and talent_id > 0 then
|
||||
if talents[talent_id] then
|
||||
info.talents[talent_id] = talents[talent_id]
|
||||
else
|
||||
-- While we had some talents for this class, we apparently didn't have all for this particular spec, so mark for inspect
|
||||
need_inspect = 1
|
||||
end
|
||||
for i = msg_idx.talents, msg_idx.end_talents do
|
||||
local talent_id = tonumber (data[i]) or 0
|
||||
if talent_id > 0 then
|
||||
local talent = self:GetCachedTalentInfoByID (talent_id)
|
||||
if talent then
|
||||
info.talents[talent_id] = talent
|
||||
else
|
||||
need_inspect = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Talents weren't pre-cached, so mark for inspect
|
||||
need_inspect = 1
|
||||
end
|
||||
|
||||
info.glyphs = wipe (info.glyphs or {}) -- kept for addons that still refer to this
|
||||
info.pvp_talents = wipe (info.pvp_talents or {})
|
||||
for i = msg_idx.pvp_talents, msg_idx.end_pvp_talents do
|
||||
local talent_id = tonumber (data[i]) or 0
|
||||
if talent_id > 0 then
|
||||
local talent = self:GetCachedPvpTalentInfoByID (talent_id)
|
||||
if talent then
|
||||
info.pvp_talents[talent_id] = talent
|
||||
else
|
||||
need_inspect = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
info.glyphs = info.glyphs or {} -- kept for addons that still refer to this
|
||||
|
||||
local mainq, staleq = self.state.mainq, self.state.staleq
|
||||
local want_inspect = not need_inspect and self.inspect_ready_used and (mainq[guid] or staleq[guid]) and 1 or nil
|
||||
@@ -741,7 +822,7 @@ function lib:CHAT_MSG_ADDON (prefix, datastr, scope, sender)
|
||||
if need_inspect or want_inspect then self.frame:Show () end
|
||||
|
||||
--[===[@debug@
|
||||
debug ("Firing LGIST update event for unit "..unit..", GUID "..guid) --@end-debug@]===]
|
||||
debug ("Firing LGIST update event for unit "..unit..", GUID "..guid..", inspect "..tostring(not not need_inspect)) --@end-debug@]===]
|
||||
self.events:Fire (UPDATE_EVENT, guid, unit, info)
|
||||
self.events:Fire (QUEUE_EVENT)
|
||||
end
|
||||
@@ -817,8 +898,8 @@ function lib:UNIT_AURA (unit)
|
||||
end
|
||||
|
||||
|
||||
function lib:UNIT_SPELLCAST_SUCCEEDED (unit, spellname, rank, lineid, spellid)
|
||||
if spellid == 200749 then
|
||||
function lib:UNIT_SPELLCAST_SUCCEEDED (unit, _, spell_id)
|
||||
if spell_id == 200749 then -- Activating Specialization
|
||||
self:Query (unit) -- Definitely changed, so high prio refresh
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## Interface: 70300
|
||||
## Interface: 80300
|
||||
## Title: Lib: GroupInSpecT-1.1
|
||||
## Notes: Keeps track of group members and keeps an up-to-date cache of their specialization and talents.
|
||||
## Version: r92
|
||||
## Version: 1.4.0
|
||||
## Author: Anyia of HordeYakka (Jubei'Thos)
|
||||
## X-Category: Library
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
## Author: Vardex
|
||||
## X-Category: Library
|
||||
## X-License: BSD
|
||||
## Version: @project-version@
|
||||
## Version: DetailsRetail.8.3.0.7348.141
|
||||
## DefaultState: Enabled
|
||||
## LoadOnDemand: 0
|
||||
|
||||
|
||||
@@ -775,7 +775,7 @@ end
|
||||
|
||||
--> choose avatar window
|
||||
do
|
||||
local avatar_pick_frame = CreateFrame ("frame", "AvatarPickFrame", UIParent)
|
||||
local avatar_pick_frame = CreateFrame ("frame", "AvatarPickFrame", UIParent,"BackdropTemplate")
|
||||
avatar_pick_frame:SetFrameStrata ("DIALOG")
|
||||
avatar_pick_frame:SetBackdrop ({bgFile = [[Interface\FrameGeneral\UI-Background-Marble]], edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], tile = true, tileSize = 256, edgeSize = 32, insets = {left = 11, right = 12, top = 12, bottom = 11}})
|
||||
avatar_pick_frame:SetBackdropColor (.3, .3, .3, .9)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,27 +1,27 @@
|
||||
do
|
||||
local _detalhes = _G._detalhes
|
||||
|
||||
local _error = {
|
||||
["error"] = true,
|
||||
["errortext"] = ""
|
||||
}
|
||||
_error.__index = _error
|
||||
_error.__newindex = function()
|
||||
assert (false, "Attempt to modify an read-only object.\nUse object() or object.errortext\n"..debugstack (2, 1 , 0))
|
||||
return
|
||||
end
|
||||
_error.__tostring = function()
|
||||
return _error.errortext
|
||||
end
|
||||
_error.__call = function (_this)
|
||||
print (_this.errortext)
|
||||
end
|
||||
|
||||
function _detalhes:NewError (_msg)
|
||||
local this_error = {}
|
||||
this_error.errortext = _msg
|
||||
setmetatable (this_error, _error)
|
||||
return this_error
|
||||
end
|
||||
|
||||
end
|
||||
do
|
||||
local _detalhes = _G._detalhes
|
||||
|
||||
local _error = {
|
||||
["error"] = true,
|
||||
["errortext"] = ""
|
||||
}
|
||||
_error.__index = _error
|
||||
_error.__newindex = function()
|
||||
assert (false, "Attempt to modify an read-only object.\nUse object() or object.errortext\n"..debugstack (2, 1 , 0))
|
||||
return
|
||||
end
|
||||
_error.__tostring = function()
|
||||
return _error.errortext
|
||||
end
|
||||
_error.__call = function (_this)
|
||||
print (_this.errortext)
|
||||
end
|
||||
|
||||
function _detalhes:NewError (_msg)
|
||||
local this_error = {}
|
||||
this_error.errortext = _msg
|
||||
setmetatable (this_error, _error)
|
||||
return this_error
|
||||
end
|
||||
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,212 +1,212 @@
|
||||
-- damage ability file
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
local _ipairs = ipairs--lua local
|
||||
local _pairs = pairs--lua local
|
||||
local _UnitAura = UnitAura--api local
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_dano = _detalhes.habilidade_dano
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
local _recording_ability_with_buffs = false
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_dano:NovaTabela (id, link, token)
|
||||
|
||||
local _newDamageSpell = {
|
||||
|
||||
total = 0, --total damage
|
||||
counter = 0, --counter
|
||||
id = id, --spellid
|
||||
successful_casted = 0, --successful casted times (only for enemies)
|
||||
|
||||
--> multistrike (deprecated)
|
||||
m_amt = 0,
|
||||
m_dmg = 0,
|
||||
m_crit = 0,
|
||||
--off_amt = 0,
|
||||
--off_dmg = 0,
|
||||
--main_amt = 0,
|
||||
|
||||
--> normal hits
|
||||
n_min = 0,
|
||||
n_max = 0,
|
||||
n_amt = 0,
|
||||
n_dmg = 0,
|
||||
|
||||
--> critical hits
|
||||
c_min = 0,
|
||||
c_max = 0,
|
||||
c_amt = 0,
|
||||
c_dmg = 0,
|
||||
|
||||
--> glacing hits
|
||||
g_amt = 0,
|
||||
g_dmg = 0,
|
||||
|
||||
--> resisted
|
||||
r_amt = 0,
|
||||
r_dmg = 0,
|
||||
|
||||
--> blocked
|
||||
b_amt = 0,
|
||||
b_dmg = 0,
|
||||
|
||||
--> obsorved
|
||||
a_amt = 0,
|
||||
a_dmg = 0,
|
||||
|
||||
targets = {},
|
||||
extra = {}
|
||||
}
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
_detalhes:SpellIsDot (id)
|
||||
end
|
||||
|
||||
return _newDamageSpell
|
||||
end
|
||||
|
||||
function habilidade_dano:AddMiss (serial, nome, flags, who_nome, missType)
|
||||
self.counter = self.counter + 1
|
||||
self [missType] = (self [missType] or 0) + 1
|
||||
|
||||
self.targets [nome] = self.targets [nome] or 0
|
||||
end
|
||||
|
||||
function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token, isoffhand, isreflected)
|
||||
|
||||
self.total = self.total + amount
|
||||
|
||||
--if is reflected add the spellId into the extra table
|
||||
--this is too show which spells has been reflected
|
||||
if (isreflected) then
|
||||
self.extra [isreflected] = (self.extra [isreflected] or 0) + amount
|
||||
end
|
||||
|
||||
self.targets [nome] = (self.targets [nome] or 0) + amount
|
||||
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (resisted and resisted > 0) then
|
||||
self.r_dmg = self.r_dmg+amount --> tabela.total � o total de dano
|
||||
self.r_amt = self.r_amt+1 --> tabela.total � o total de dano
|
||||
end
|
||||
|
||||
if (blocked and blocked > 0) then
|
||||
self.b_dmg = self.b_dmg+amount --> amount � o total de dano
|
||||
self.b_amt = self.b_amt+1 --> amount � o total de dano
|
||||
end
|
||||
|
||||
if (absorbed and absorbed > 0) then
|
||||
self.a_dmg = self.a_dmg+amount --> amount � o total de dano
|
||||
self.a_amt = self.a_amt+1 --> amount � o total de dano
|
||||
end
|
||||
|
||||
if (glacing) then
|
||||
self.g_dmg = self.g_dmg+amount --> amount � o total de dano
|
||||
self.g_amt = self.g_amt+1 --> amount � o total de dano
|
||||
|
||||
elseif (critical) then
|
||||
self.c_dmg = self.c_dmg+amount --> amount � o total de dano
|
||||
self.c_amt = self.c_amt+1 --> amount � o total de dano
|
||||
if (amount > self.c_max) then
|
||||
self.c_max = amount
|
||||
end
|
||||
if (self.c_min > amount or self.c_min == 0) then
|
||||
self.c_min = amount
|
||||
end
|
||||
|
||||
else
|
||||
self.n_dmg = self.n_dmg+amount
|
||||
self.n_amt = self.n_amt+1
|
||||
if (amount > self.n_max) then
|
||||
self.n_max = amount
|
||||
end
|
||||
if (self.n_min > amount or self.n_min == 0) then
|
||||
self.n_min = amount
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if (_recording_ability_with_buffs) then
|
||||
if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada
|
||||
|
||||
local buffsNames = _detalhes.SoloTables.BuffsTableNameCache
|
||||
|
||||
local SpellBuffDetails = self.BuffTable
|
||||
if (not SpellBuffDetails) then
|
||||
self.BuffTable = {}
|
||||
SpellBuffDetails = self.BuffTable
|
||||
end
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
--> precisa ver se ele tinha na hora que aplicou
|
||||
local SoloDebuffPower = _detalhes.tabela_vigente.SoloDebuffPower
|
||||
if (SoloDebuffPower) then
|
||||
local ThisDebuff = SoloDebuffPower [self.id]
|
||||
if (ThisDebuff) then
|
||||
local ThisDebuffOnTarget = ThisDebuff [serial]
|
||||
if (ThisDebuffOnTarget) then
|
||||
for index, buff_name in _ipairs (ThisDebuffOnTarget.buffs) do
|
||||
local buff_info = SpellBuffDetails [buff_name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [buff_name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
for BuffName, _ in _pairs (_detalhes.Buffs.BuffsTable) do
|
||||
local name = _UnitAura ("player", BuffName)
|
||||
if (name ~= nil) then
|
||||
local buff_info = SpellBuffDetails [name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> core
|
||||
|
||||
function _detalhes:UpdateDamageAbilityGears()
|
||||
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
|
||||
end
|
||||
|
||||
--[[
|
||||
if (isoffhand) then
|
||||
self.off_amt = self.off_amt + 1
|
||||
self.off_dmg = self.off_dmg + amount
|
||||
else
|
||||
self.main_amt = self.main_amt + 1
|
||||
end
|
||||
--]]
|
||||
-- damage ability file
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
local _ipairs = ipairs--lua local
|
||||
local _pairs = pairs--lua local
|
||||
local _UnitAura = UnitAura--api local
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_dano = _detalhes.habilidade_dano
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
local _recording_ability_with_buffs = false
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_dano:NovaTabela (id, link, token)
|
||||
|
||||
local _newDamageSpell = {
|
||||
|
||||
total = 0, --total damage
|
||||
counter = 0, --counter
|
||||
id = id, --spellid
|
||||
successful_casted = 0, --successful casted times (only for enemies)
|
||||
|
||||
--> multistrike (deprecated)
|
||||
m_amt = 0,
|
||||
m_dmg = 0,
|
||||
m_crit = 0,
|
||||
--off_amt = 0,
|
||||
--off_dmg = 0,
|
||||
--main_amt = 0,
|
||||
|
||||
--> normal hits
|
||||
n_min = 0,
|
||||
n_max = 0,
|
||||
n_amt = 0,
|
||||
n_dmg = 0,
|
||||
|
||||
--> critical hits
|
||||
c_min = 0,
|
||||
c_max = 0,
|
||||
c_amt = 0,
|
||||
c_dmg = 0,
|
||||
|
||||
--> glacing hits
|
||||
g_amt = 0,
|
||||
g_dmg = 0,
|
||||
|
||||
--> resisted
|
||||
r_amt = 0,
|
||||
r_dmg = 0,
|
||||
|
||||
--> blocked
|
||||
b_amt = 0,
|
||||
b_dmg = 0,
|
||||
|
||||
--> obsorved
|
||||
a_amt = 0,
|
||||
a_dmg = 0,
|
||||
|
||||
targets = {},
|
||||
extra = {}
|
||||
}
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
_detalhes:SpellIsDot (id)
|
||||
end
|
||||
|
||||
return _newDamageSpell
|
||||
end
|
||||
|
||||
function habilidade_dano:AddMiss (serial, nome, flags, who_nome, missType)
|
||||
self.counter = self.counter + 1
|
||||
self [missType] = (self [missType] or 0) + 1
|
||||
|
||||
self.targets [nome] = self.targets [nome] or 0
|
||||
end
|
||||
|
||||
function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token, isoffhand, isreflected)
|
||||
|
||||
self.total = self.total + amount
|
||||
|
||||
--if is reflected add the spellId into the extra table
|
||||
--this is too show which spells has been reflected
|
||||
if (isreflected) then
|
||||
self.extra [isreflected] = (self.extra [isreflected] or 0) + amount
|
||||
end
|
||||
|
||||
self.targets [nome] = (self.targets [nome] or 0) + amount
|
||||
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (resisted and resisted > 0) then
|
||||
self.r_dmg = self.r_dmg+amount --> tabela.total � o total de dano
|
||||
self.r_amt = self.r_amt+1 --> tabela.total � o total de dano
|
||||
end
|
||||
|
||||
if (blocked and blocked > 0) then
|
||||
self.b_dmg = self.b_dmg+amount --> amount � o total de dano
|
||||
self.b_amt = self.b_amt+1 --> amount � o total de dano
|
||||
end
|
||||
|
||||
if (absorbed and absorbed > 0) then
|
||||
self.a_dmg = self.a_dmg+amount --> amount � o total de dano
|
||||
self.a_amt = self.a_amt+1 --> amount � o total de dano
|
||||
end
|
||||
|
||||
if (glacing) then
|
||||
self.g_dmg = self.g_dmg+amount --> amount � o total de dano
|
||||
self.g_amt = self.g_amt+1 --> amount � o total de dano
|
||||
|
||||
elseif (critical) then
|
||||
self.c_dmg = self.c_dmg+amount --> amount � o total de dano
|
||||
self.c_amt = self.c_amt+1 --> amount � o total de dano
|
||||
if (amount > self.c_max) then
|
||||
self.c_max = amount
|
||||
end
|
||||
if (self.c_min > amount or self.c_min == 0) then
|
||||
self.c_min = amount
|
||||
end
|
||||
|
||||
else
|
||||
self.n_dmg = self.n_dmg+amount
|
||||
self.n_amt = self.n_amt+1
|
||||
if (amount > self.n_max) then
|
||||
self.n_max = amount
|
||||
end
|
||||
if (self.n_min > amount or self.n_min == 0) then
|
||||
self.n_min = amount
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if (_recording_ability_with_buffs) then
|
||||
if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada
|
||||
|
||||
local buffsNames = _detalhes.SoloTables.BuffsTableNameCache
|
||||
|
||||
local SpellBuffDetails = self.BuffTable
|
||||
if (not SpellBuffDetails) then
|
||||
self.BuffTable = {}
|
||||
SpellBuffDetails = self.BuffTable
|
||||
end
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
--> precisa ver se ele tinha na hora que aplicou
|
||||
local SoloDebuffPower = _detalhes.tabela_vigente.SoloDebuffPower
|
||||
if (SoloDebuffPower) then
|
||||
local ThisDebuff = SoloDebuffPower [self.id]
|
||||
if (ThisDebuff) then
|
||||
local ThisDebuffOnTarget = ThisDebuff [serial]
|
||||
if (ThisDebuffOnTarget) then
|
||||
for index, buff_name in _ipairs (ThisDebuffOnTarget.buffs) do
|
||||
local buff_info = SpellBuffDetails [buff_name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [buff_name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
for BuffName, _ in _pairs (_detalhes.Buffs.BuffsTable) do
|
||||
local name = _UnitAura ("player", BuffName)
|
||||
if (name ~= nil) then
|
||||
local buff_info = SpellBuffDetails [name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> core
|
||||
|
||||
function _detalhes:UpdateDamageAbilityGears()
|
||||
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
|
||||
end
|
||||
|
||||
--[[
|
||||
if (isoffhand) then
|
||||
self.off_amt = self.off_amt + 1
|
||||
self.off_dmg = self.off_dmg + amount
|
||||
else
|
||||
self.main_amt = self.main_amt + 1
|
||||
end
|
||||
--]]
|
||||
@@ -1,119 +1,119 @@
|
||||
-- heal ability file
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_cura = _detalhes.habilidade_cura
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_cura:NovaTabela (id, link)
|
||||
|
||||
local _newHealSpell = {
|
||||
|
||||
id = id,
|
||||
counter = 0,
|
||||
|
||||
--> totals
|
||||
total = 0,
|
||||
totalabsorb = 0,
|
||||
absorbed = 0,
|
||||
overheal = 0,
|
||||
totaldenied = 0,
|
||||
|
||||
--> multistrike
|
||||
m_amt = 0,
|
||||
m_healed = 0,
|
||||
m_crit = 0,
|
||||
|
||||
--> normal hits
|
||||
n_min = 0,
|
||||
n_max = 0,
|
||||
n_amt = 0,
|
||||
n_curado = 0,
|
||||
|
||||
--> critical hits
|
||||
c_min = 0,
|
||||
c_max = 0,
|
||||
c_amt = 0,
|
||||
c_curado = 0,
|
||||
|
||||
--> targets containers
|
||||
targets = {},
|
||||
targets_overheal = {},
|
||||
targets_absorbs = {}
|
||||
}
|
||||
|
||||
return _newHealSpell
|
||||
end
|
||||
|
||||
function habilidade_cura:Add (serial, nome, flag, amount, extraSpellID, absorbed, critical, overhealing, is_shield)
|
||||
|
||||
amount = amount or 0
|
||||
self.targets [nome] = (self.targets [nome] or 0) + amount
|
||||
|
||||
if (absorbed == "SPELL_HEAL_ABSORBED") then
|
||||
self.counter = self.counter + 1
|
||||
self.totaldenied = self.totaldenied + amount
|
||||
|
||||
local healerName = critical
|
||||
|
||||
--create the denied table spells, on the fly
|
||||
if (not self.heal_denied) then
|
||||
self.heal_denied = {}
|
||||
self.heal_denied_healers = {}
|
||||
end
|
||||
|
||||
self.heal_denied [extraSpellID] = (self.heal_denied [extraSpellID] or 0) + amount
|
||||
self.heal_denied_healers [healerName] = (self.heal_denied_healers [healerName] or 0) + amount
|
||||
else
|
||||
|
||||
self.total = self.total + amount
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (absorbed and absorbed > 0) then
|
||||
self.absorbed = self.absorbed + absorbed
|
||||
end
|
||||
|
||||
if (overhealing and overhealing > 0) then
|
||||
self.overheal = self.overheal + overhealing
|
||||
self.targets_overheal [nome] = (self.targets_overheal [nome] or 0) + overhealing
|
||||
end
|
||||
|
||||
if (is_shield) then
|
||||
self.totalabsorb = self.totalabsorb + amount
|
||||
self.targets_absorbs [nome] = (self.targets_absorbs [nome] or 0) + amount
|
||||
end
|
||||
|
||||
if (critical) then
|
||||
self.c_curado = self.c_curado+amount --> amount � o total de dano
|
||||
self.c_amt = self.c_amt+1 --> amount � o total de dano
|
||||
if (amount > self.c_max) then
|
||||
self.c_max = amount
|
||||
end
|
||||
if (self.c_min > amount or self.c_min == 0) then
|
||||
self.c_min = amount
|
||||
end
|
||||
else
|
||||
self.n_curado = self.n_curado+amount
|
||||
self.n_amt = self.n_amt+1
|
||||
if (amount > self.n_max) then
|
||||
self.n_max = amount
|
||||
end
|
||||
if (self.n_min > amount or self.n_min == 0) then
|
||||
self.n_min = amount
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- heal ability file
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_cura = _detalhes.habilidade_cura
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_cura:NovaTabela (id, link)
|
||||
|
||||
local _newHealSpell = {
|
||||
|
||||
id = id,
|
||||
counter = 0,
|
||||
|
||||
--> totals
|
||||
total = 0,
|
||||
totalabsorb = 0,
|
||||
absorbed = 0,
|
||||
overheal = 0,
|
||||
totaldenied = 0,
|
||||
|
||||
--> multistrike
|
||||
m_amt = 0,
|
||||
m_healed = 0,
|
||||
m_crit = 0,
|
||||
|
||||
--> normal hits
|
||||
n_min = 0,
|
||||
n_max = 0,
|
||||
n_amt = 0,
|
||||
n_curado = 0,
|
||||
|
||||
--> critical hits
|
||||
c_min = 0,
|
||||
c_max = 0,
|
||||
c_amt = 0,
|
||||
c_curado = 0,
|
||||
|
||||
--> targets containers
|
||||
targets = {},
|
||||
targets_overheal = {},
|
||||
targets_absorbs = {}
|
||||
}
|
||||
|
||||
return _newHealSpell
|
||||
end
|
||||
|
||||
function habilidade_cura:Add (serial, nome, flag, amount, extraSpellID, absorbed, critical, overhealing, is_shield)
|
||||
|
||||
amount = amount or 0
|
||||
self.targets [nome] = (self.targets [nome] or 0) + amount
|
||||
|
||||
if (absorbed == "SPELL_HEAL_ABSORBED") then
|
||||
self.counter = self.counter + 1
|
||||
self.totaldenied = self.totaldenied + amount
|
||||
|
||||
local healerName = critical
|
||||
|
||||
--create the denied table spells, on the fly
|
||||
if (not self.heal_denied) then
|
||||
self.heal_denied = {}
|
||||
self.heal_denied_healers = {}
|
||||
end
|
||||
|
||||
self.heal_denied [extraSpellID] = (self.heal_denied [extraSpellID] or 0) + amount
|
||||
self.heal_denied_healers [healerName] = (self.heal_denied_healers [healerName] or 0) + amount
|
||||
else
|
||||
|
||||
self.total = self.total + amount
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (absorbed and absorbed > 0) then
|
||||
self.absorbed = self.absorbed + absorbed
|
||||
end
|
||||
|
||||
if (overhealing and overhealing > 0) then
|
||||
self.overheal = self.overheal + overhealing
|
||||
self.targets_overheal [nome] = (self.targets_overheal [nome] or 0) + overhealing
|
||||
end
|
||||
|
||||
if (is_shield) then
|
||||
self.totalabsorb = self.totalabsorb + amount
|
||||
self.targets_absorbs [nome] = (self.targets_absorbs [nome] or 0) + amount
|
||||
end
|
||||
|
||||
if (critical) then
|
||||
self.c_curado = self.c_curado+amount --> amount � o total de dano
|
||||
self.c_amt = self.c_amt+1 --> amount � o total de dano
|
||||
if (amount > self.c_max) then
|
||||
self.c_max = amount
|
||||
end
|
||||
if (self.c_min > amount or self.c_min == 0) then
|
||||
self.c_min = amount
|
||||
end
|
||||
else
|
||||
self.n_curado = self.n_curado+amount
|
||||
self.n_amt = self.n_amt+1
|
||||
if (amount > self.n_max) then
|
||||
self.n_max = amount
|
||||
end
|
||||
if (self.n_min > amount or self.n_min == 0) then
|
||||
self.n_min = amount
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
-- energy ability file
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
|
||||
local _setmetatable = setmetatable --lua local
|
||||
local _ipairs = ipairs --lua local
|
||||
local _UnitAura = UnitAura --api local
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_energy = _detalhes.habilidade_e_energy
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_energy:NovaTabela (id, link, token)
|
||||
|
||||
local _newEnergySpell = {
|
||||
id = id,
|
||||
counter = 0,
|
||||
total = 0,
|
||||
totalover = 0,
|
||||
targets = {}
|
||||
}
|
||||
|
||||
return _newEnergySpell
|
||||
end
|
||||
|
||||
function habilidade_energy:Add (serial, nome, flag, amount, who_nome, powertype, overpower)
|
||||
|
||||
self.counter = self.counter + 1
|
||||
self.total = self.total + amount
|
||||
self.totalover = self.totalover + overpower
|
||||
self.targets [nome] = (self.targets [nome] or 0) + amount
|
||||
|
||||
end
|
||||
-- energy ability file
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
|
||||
local _setmetatable = setmetatable --lua local
|
||||
local _ipairs = ipairs --lua local
|
||||
local _UnitAura = UnitAura --api local
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_energy = _detalhes.habilidade_e_energy
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_energy:NovaTabela (id, link, token)
|
||||
|
||||
local _newEnergySpell = {
|
||||
id = id,
|
||||
counter = 0,
|
||||
total = 0,
|
||||
totalover = 0,
|
||||
targets = {}
|
||||
}
|
||||
|
||||
return _newEnergySpell
|
||||
end
|
||||
|
||||
function habilidade_energy:Add (serial, nome, flag, amount, who_nome, powertype, overpower)
|
||||
|
||||
self.counter = self.counter + 1
|
||||
self.total = self.total + amount
|
||||
self.totalover = self.totalover + overpower
|
||||
self.targets [nome] = (self.targets [nome] or 0) + amount
|
||||
|
||||
end
|
||||
@@ -1,162 +1,162 @@
|
||||
-- misc ability file
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
|
||||
local _setmetatable = setmetatable --lua local
|
||||
local _ipairs = ipairs --lua local
|
||||
local _UnitAura = UnitAura --api local
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_misc = _detalhes.habilidade_misc
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_misc:NovaTabela (id, link, token)
|
||||
|
||||
local _newMiscSpell = {
|
||||
id = id,
|
||||
counter = 0,
|
||||
targets = {}
|
||||
}
|
||||
|
||||
if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then
|
||||
_newMiscSpell.uptime = 0
|
||||
_newMiscSpell.actived = false
|
||||
_newMiscSpell.activedamt = 0 --s�o quantos estao ativados no momento
|
||||
_newMiscSpell.refreshamt = 0
|
||||
_newMiscSpell.appliedamt = 0
|
||||
|
||||
elseif (token == "SPELL_INTERRUPT") then
|
||||
_newMiscSpell.interrompeu_oque = {}
|
||||
|
||||
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
|
||||
_newMiscSpell.dispell_oque = {}
|
||||
|
||||
elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
|
||||
_newMiscSpell.cc_break_oque = {}
|
||||
|
||||
end
|
||||
|
||||
return _newMiscSpell
|
||||
end
|
||||
|
||||
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
|
||||
|
||||
--print (self.id, GetSpellInfo (self.id))
|
||||
|
||||
if (spellID == "BUFF_OR_DEBUFF") then
|
||||
|
||||
if (spellName == "COOLDOWN") then
|
||||
self.counter = self.counter + 1
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_REFRESH") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
self.refreshamt = self.refreshamt + 1
|
||||
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
|
||||
end
|
||||
self.actived_at = _detalhes._tempo
|
||||
self.actived = true
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_OUT") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
|
||||
end
|
||||
self.actived = false
|
||||
self.actived_at = nil
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_IN" or spellName == "DEBUFF_UPTIME_IN") then
|
||||
self.actived = true
|
||||
self.activedamt = self.activedamt + 1
|
||||
self.appliedamt = self.appliedamt + 1
|
||||
|
||||
if (self.actived_at and self.actived and spellName == "DEBUFF_UPTIME_IN") then
|
||||
--> ja esta ativo em outro mob e jogou num novo
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
|
||||
self.actived_at = _detalhes._tempo
|
||||
|
||||
elseif (spellName == "DEBUFF_UPTIME_REFRESH") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
self.refreshamt = self.refreshamt + 1
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
self.actived_at = _detalhes._tempo
|
||||
self.actived = true
|
||||
|
||||
elseif (spellName == "DEBUFF_UPTIME_OUT") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
|
||||
end
|
||||
|
||||
self.activedamt = self.activedamt - 1
|
||||
|
||||
if (self.activedamt == 0) then
|
||||
self.actived = false
|
||||
self.actived_at = nil
|
||||
else
|
||||
self.actived_at = _detalhes._tempo
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
elseif (token == "SPELL_INTERRUPT") then
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (not self.interrompeu_oque [spellID]) then
|
||||
self.interrompeu_oque [spellID] = 1
|
||||
else
|
||||
self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1
|
||||
end
|
||||
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_RESURRECT") then
|
||||
self.ress = (self.ress or 0) + 1
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
|
||||
self.dispell = (self.dispell or 0) + 1
|
||||
|
||||
if (not self.dispell_oque [spellID]) then
|
||||
self.dispell_oque [spellID] = 1
|
||||
else
|
||||
self.dispell_oque [spellID] = self.dispell_oque [spellID] + 1
|
||||
end
|
||||
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then
|
||||
self.cc_break = (self.cc_break or 0) + 1
|
||||
|
||||
if (not self.cc_break_oque [spellID]) then
|
||||
self.cc_break_oque [spellID] = 1
|
||||
else
|
||||
self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1
|
||||
end
|
||||
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
end
|
||||
|
||||
end
|
||||
-- misc ability file
|
||||
local _detalhes = _G._detalhes
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
|
||||
local _setmetatable = setmetatable --lua local
|
||||
local _ipairs = ipairs --lua local
|
||||
local _UnitAura = UnitAura --api local
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local habilidade_misc = _detalhes.habilidade_misc
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function habilidade_misc:NovaTabela (id, link, token)
|
||||
|
||||
local _newMiscSpell = {
|
||||
id = id,
|
||||
counter = 0,
|
||||
targets = {}
|
||||
}
|
||||
|
||||
if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then
|
||||
_newMiscSpell.uptime = 0
|
||||
_newMiscSpell.actived = false
|
||||
_newMiscSpell.activedamt = 0 --s�o quantos estao ativados no momento
|
||||
_newMiscSpell.refreshamt = 0
|
||||
_newMiscSpell.appliedamt = 0
|
||||
|
||||
elseif (token == "SPELL_INTERRUPT") then
|
||||
_newMiscSpell.interrompeu_oque = {}
|
||||
|
||||
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
|
||||
_newMiscSpell.dispell_oque = {}
|
||||
|
||||
elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
|
||||
_newMiscSpell.cc_break_oque = {}
|
||||
|
||||
end
|
||||
|
||||
return _newMiscSpell
|
||||
end
|
||||
|
||||
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
|
||||
|
||||
--print (self.id, GetSpellInfo (self.id))
|
||||
|
||||
if (spellID == "BUFF_OR_DEBUFF") then
|
||||
|
||||
if (spellName == "COOLDOWN") then
|
||||
self.counter = self.counter + 1
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_REFRESH") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
self.refreshamt = self.refreshamt + 1
|
||||
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
|
||||
end
|
||||
self.actived_at = _detalhes._tempo
|
||||
self.actived = true
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_OUT") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
|
||||
end
|
||||
self.actived = false
|
||||
self.actived_at = nil
|
||||
|
||||
elseif (spellName == "BUFF_UPTIME_IN" or spellName == "DEBUFF_UPTIME_IN") then
|
||||
self.actived = true
|
||||
self.activedamt = self.activedamt + 1
|
||||
self.appliedamt = self.appliedamt + 1
|
||||
|
||||
if (self.actived_at and self.actived and spellName == "DEBUFF_UPTIME_IN") then
|
||||
--> ja esta ativo em outro mob e jogou num novo
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
|
||||
self.actived_at = _detalhes._tempo
|
||||
|
||||
elseif (spellName == "DEBUFF_UPTIME_REFRESH") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
self.refreshamt = self.refreshamt + 1
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
|
||||
end
|
||||
self.actived_at = _detalhes._tempo
|
||||
self.actived = true
|
||||
|
||||
elseif (spellName == "DEBUFF_UPTIME_OUT") then
|
||||
if (self.actived_at and self.actived) then
|
||||
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
|
||||
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
|
||||
end
|
||||
|
||||
self.activedamt = self.activedamt - 1
|
||||
|
||||
if (self.activedamt == 0) then
|
||||
self.actived = false
|
||||
self.actived_at = nil
|
||||
else
|
||||
self.actived_at = _detalhes._tempo
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
elseif (token == "SPELL_INTERRUPT") then
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (not self.interrompeu_oque [spellID]) then
|
||||
self.interrompeu_oque [spellID] = 1
|
||||
else
|
||||
self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1
|
||||
end
|
||||
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_RESURRECT") then
|
||||
self.ress = (self.ress or 0) + 1
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
|
||||
self.dispell = (self.dispell or 0) + 1
|
||||
|
||||
if (not self.dispell_oque [spellID]) then
|
||||
self.dispell_oque [spellID] = 1
|
||||
else
|
||||
self.dispell_oque [spellID] = self.dispell_oque [spellID] + 1
|
||||
end
|
||||
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
|
||||
elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then
|
||||
self.cc_break = (self.cc_break or 0) + 1
|
||||
|
||||
if (not self.cc_break_oque [spellID]) then
|
||||
self.cc_break_oque [spellID] = 1
|
||||
else
|
||||
self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1
|
||||
end
|
||||
|
||||
--> target
|
||||
self.targets [nome] = (self.targets [nome] or 0) + 1
|
||||
end
|
||||
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,51 +0,0 @@
|
||||
-- class target file
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
|
||||
local _setmetatable = setmetatable --lua local
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internals
|
||||
|
||||
function alvo_da_habilidade:NovaTabela (link)
|
||||
|
||||
local esta_tabela = {total = 0}
|
||||
_setmetatable (esta_tabela, alvo_da_habilidade)
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
function alvo_da_habilidade:AddQuantidade (amt)
|
||||
self.total = self.total + amt
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> core
|
||||
|
||||
function _detalhes.refresh:r_alvo_da_habilidade (este_alvo, shadow)
|
||||
_setmetatable (este_alvo, alvo_da_habilidade)
|
||||
este_alvo.__index = alvo_da_habilidade
|
||||
este_alvo.shadow = shadow._ActorTable [shadow._NameIndexTable [este_alvo.nome]]
|
||||
end
|
||||
|
||||
function _detalhes.clear:c_alvo_da_habilidade (este_alvo)
|
||||
este_alvo.shadow = nil
|
||||
--este_alvo.__index = {}
|
||||
este_alvo.__index = nil
|
||||
end
|
||||
|
||||
alvo_da_habilidade.__sub = function (tabela1, tabela2)
|
||||
tabela1.total = tabela1.total - tabela2.total
|
||||
if (tabela1.overheal) then
|
||||
tabela1.overheal = tabela1.overheal - tabela2.overheal
|
||||
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
+23
-38
@@ -1,15 +1,14 @@
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
local container_pets = _detalhes.container_pets
|
||||
|
||||
-- api locals
|
||||
local _UnitGUID = UnitGUID
|
||||
local _UnitName = UnitName
|
||||
local _GetUnitName = GetUnitName
|
||||
local _IsInRaid = IsInRaid
|
||||
local _IsInGroup = IsInGroup
|
||||
local _GetNumGroupMembers = GetNumGroupMembers
|
||||
local _UnitGUID = _G.UnitGUID
|
||||
local _UnitName = _G.UnitName
|
||||
local _GetUnitName = _G.GetUnitName
|
||||
local _IsInRaid = _G.IsInRaid
|
||||
local _IsInGroup = _G.IsInGroup
|
||||
local _GetNumGroupMembers = _G.GetNumGroupMembers
|
||||
|
||||
-- lua locals
|
||||
local _setmetatable = setmetatable
|
||||
@@ -43,19 +42,17 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags)
|
||||
--> buscar pelo pet no container de pets
|
||||
local busca = self.pets [pet_serial]
|
||||
if (busca) then
|
||||
|
||||
--in merging operations, make sure to not add the owner name a second time in the name
|
||||
--in merging operations, make sure to not add the owner name a second time in the name
|
||||
|
||||
--check if the pet name already has the owner name in, if not, add it
|
||||
if (not pet_nome:find ("<")) then
|
||||
--get the owner name
|
||||
local ownerName = busca[1]
|
||||
--add the owner name to the pet name
|
||||
pet_nome = pet_nome .. " <".. ownerName ..">"
|
||||
end
|
||||
|
||||
--check if the pet name already has the owner name in, if not, add it
|
||||
if (not pet_nome:find ("<")) then
|
||||
--get the owner name
|
||||
local ownerName = busca[1]
|
||||
--add the owner name to the pet name
|
||||
pet_nome = pet_nome .. " <".. ownerName ..">"
|
||||
end
|
||||
|
||||
return pet_nome, busca[1], busca[2], busca[3] --> [1] dono nome [2] dono serial [3] dono flag
|
||||
|
||||
return pet_nome, busca[1], busca[2], busca[3] --> [1] dono nome [2] dono serial [3] dono flag
|
||||
end
|
||||
|
||||
--> buscar pelo pet na raide
|
||||
@@ -122,9 +119,6 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags)
|
||||
is_ignored [pet_serial] = true
|
||||
end
|
||||
end
|
||||
|
||||
--> n�o pode encontrar o dono do pet, coloca-lo na ignore
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
@@ -220,19 +214,11 @@ function container_pets:Remover (pet_serial)
|
||||
end
|
||||
|
||||
function container_pets:Adicionar (pet_serial, pet_nome, pet_flags, dono_serial, dono_nome, dono_flags)
|
||||
|
||||
if (pet_flags and _bit_band (pet_flags, OBJECT_TYPE_PET) ~= 0 and _bit_band (pet_flags, EM_GRUPO) ~= 0) then
|
||||
self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, true, pet_nome, pet_serial}
|
||||
--if (pet_nome == "Guardian of Ancient Kings") then --remover
|
||||
-- print ("SUMMON", "Adicionou ao container")
|
||||
--end
|
||||
else
|
||||
self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, false, pet_nome, pet_serial}
|
||||
--if (pet_nome == "Guardian of Ancient Kings") then --remover
|
||||
-- print ("SUMMON", "Adicionou ao container")
|
||||
--end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function _detalhes:WipePets()
|
||||
@@ -240,17 +226,15 @@ function _detalhes:WipePets()
|
||||
end
|
||||
|
||||
function _detalhes:LimparPets()
|
||||
--> elimina pets antigos
|
||||
local _new_PetTable = {}
|
||||
--> erase old pet table by creating a new one
|
||||
local newPetTable = {}
|
||||
--> minimum of 90 minutes to clean a pet from the pet table data
|
||||
for PetSerial, PetTable in _pairs (_detalhes.tabela_pets.pets) do
|
||||
if ( (PetTable[4] + 5400 > _detalhes._tempo + 1) or (PetTable[5] and PetTable[4] + 43200 > _detalhes._tempo) ) then
|
||||
_new_PetTable [PetSerial] = PetTable
|
||||
newPetTable [PetSerial] = PetTable
|
||||
end
|
||||
end
|
||||
--a tabela antiga ser� descartada pelo garbage collector.
|
||||
--_table_wipe (_detalhes.tabela_pets.pets)
|
||||
_detalhes.tabela_pets.pets = _new_PetTable
|
||||
_detalhes.tabela_pets.pets = newPetTable
|
||||
_detalhes:UpdateContainerCombatentes()
|
||||
|
||||
end
|
||||
@@ -265,11 +249,12 @@ function _detalhes:SchedulePetUpdate (seconds)
|
||||
return
|
||||
end
|
||||
have_schedule = true
|
||||
_detalhes:ScheduleTimer ("UpdatePets", seconds or 5)
|
||||
|
||||
--_detalhes:ScheduleTimer ("UpdatePets", seconds or 5)
|
||||
Details.Schedules.NewTimer(seconds or 5, Details.UpdatePets, Details)
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_container_pets (container)
|
||||
_setmetatable (container, container_pets)
|
||||
--container.__index = container_pets
|
||||
end
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user