18 Commits

Author SHA1 Message Date
florian.berthold ad2a536efe fix(dispels): add Curse to Witch Doctor dispel set (Hexbreak 806240)
release / release (push) Successful in 3s
WITCHDOCTOR could only flag Disease/Poison (Cleansing Idol). Hexbreak
(806240) is a single-target Curse remover, so add Curse=true. highlight.lua
reads this via GetCoaDispels, so the dispellable-debuff highlight picks it up.
2026-05-31 14:45:28 +02:00
florian.berthold 50f6e30f71 fix(libs): pcall AceGUI OnGamePadButtonDown (3.3.5 has no gamepad script type)
release / release (push) Successful in 3s
2026-05-29 20:23:33 +02:00
florian.berthold efbc200ba7 fix(dispels): drop C_Player.IsCustomClass gate from getCoaDispels
release / release (push) Successful in 4s
Witchdoctor (and likely other CoA classes intermittently) never got the
"On curable debuff" border highlight on raid/party frames: the
C_Player.IsCustomClass() check in getCoaDispels could return false at
scan time and cache playerCoaDispels = false, after which the highlight
manual-scan path was never entered and the fallback RAID filter (which
doesn't know about COA dispel spells) silently returned nothing.

COA_CLASS_DISPELS only contains custom-class tokens (CHRONOMANCER,
WITCHDOCTOR, MONK = Templar, PROPHET = Venomancer, etc.) so any token
match already implies the player is a dispelling custom class — the
IsCustomClass call is redundant. Trust the table directly. Vanilla
classes whose tokens aren't in the table still get false → RAID filter
path, unchanged.

Bump v3.3.0-coa.2.
2026-05-27 22:55:04 +02:00
florian.berthold eba2da8400 ci: respect GITHUB_REPOSITORY + tolerate per-asset upload failures
release / release (push) Successful in 2s
2026-05-25 12:16:55 +02:00
florian.berthold 1558e6b18f ci: add Gitea Actions release workflow (per-addon git-archive zip)
release / release (push) Successful in 3s
2026-05-25 12:01:40 +02:00
florian.berthold 3686bb4f9f fix(totems): raise frame level so right-click reaches the totem strip
Parent unit button registers AnyUp clicks and opens the unit popup via
frame.menu — and was z-above the totem (which sat at frame level 1),
so right-clicks fell through to the popup instead of dismissing the
totem. Lift the totem to topFrameLevel + 5 so it wins the click.
2026-05-25 11:57:54 +02:00
florian.berthold c0a23544f1 feat(totems): right-click dismiss, Witchdoctor 3-slot cap, seconds counter
- Right-click on a populated totem slot calls DestroyTotem(slot).
  EnableMouse on the strip absorbs clicks (loses click-to-target on
  the totem-bar pixels only; health/power bar still targets normally).
- COA_CLASS_TOTEMS table overrides MAX_TOTEMS per class. WITCHDOCTOR
  capped to 3 so the 4th unused slot no longer renders. Easy to extend
  for any future custom totem classes.
- Integer-seconds countdown text centred on each slot. totemMonitor
  only repaints the FontString when the integer changes so OnUpdate
  stays cheap. Cleared on expiry / dismiss.
2026-05-25 11:51:11 +02:00
florian.berthold 5035f39364 fix(highlight): manual debuff scan for CoA dispel classes
UnitDebuff(unit, 1, "RAID") ignores CoA custom classes, so on a
Witchdoctor/Templar/etc. hasDebuff was always nil and the unit-frame
border highlight never lit up on curable Poison/Disease/Magic/Curse.

Fix mirrors the auras.lua shim: if ShadowUF.GetCoaDispels() returns a
dispel set, scan UnitDebuff entries manually and match by dispelType.
Expose getCoaDispels on the ShadowUF namespace so highlight.lua can
reuse the single source of truth (COA_CLASS_DISPELS lives in auras.lua).
2026-05-25 11:51:03 +02:00
florian.berthold 83bbe12a87 feat(dispels): include 4 more CoA classes in raid-frame dispel filter
COA_CLASS_DISPELS was missing Sun Cleric, Primalist (WILDWALKER token),
Witchdoctor, and Tinker — so members of those classes saw no dispel
highlighting on raid frames despite being able to cleanse. Sourced
dispel types from coa-decursive's DCR_init.lua spell map (Sanctify,
Soothing Touch, Cleansing Idol, Nanobot Cleanser), which is verified
against gameplay rather than DBC misc_value.

Also adds inline display-name comments for MONK / PROPHET / WILDWALKER
since the in-game class names don't match the internal tokens.
2026-05-25 11:23:42 +02:00
florian.berthold 1e2408fd0a chore: remove .github/ (upstream templates, not relevant on Gitea) 2026-05-25 11:02:51 +02:00
florian.berthold f8214b6b6c fix(libs): pick up coa-ace3 9583952 (AceDB falsy-defaults PR #10 backport)
Re-sync after coa-ace3 9583952 backported WoWUIDev/Ace3 PR #10 which fixes
the AceDB-3.0 simple-value defaults metatable: previously falsy defaults
like ["*"] = false read back as nil because of `k2~=nil and v or nil`
short-circuiting. Now they round-trip correctly.
2026-05-24 19:31:45 +02:00
florian.berthold 6605c1ca12 fix(libs): pick up coa-ace3 3ec2009 (BlizOptionsGroup + Settings.* CoA-compat)
Re-sync after coa-ace3 3ec2009 added two CoA-compat patches:
  - AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua: parent
    falls back to UIParent when InterfaceOptionsFramePanelContainer is nil
  - AceConfig-3.0/AceConfigDialog-3.0: Settings.* block guarded with
    fallback to InterfaceOptions_AddCategory on WotLK-era clients

Without these, every addon registering a Blizzard Interface Options
panel via AceConfigDialog errors on load on the CoA client.
2026-05-24 17:41:32 +02:00
florian.berthold 5d9749a920 fix: include CoA custom classes in portrait/totems/raid-grouping
portrait.lua: guard CLASS_ICON_TCOORDS[classToken] lookup. CoA custom
classes (Witchdoctor, Templar, …) have no entry in the vanilla
CLASS_ICON_TCOORDS table, so the old SetTexCoord call crashed with a
nil-index whenever a custom-class unit was shown. Cache the lookup
into a local and fall through to blank texture on miss.

totems.lua: file-level class gate registered the totem bar only for
SHAMAN (and a 1-slot DK guardian variant), locking out Witchdoctor and
any future CoA totem class. Probe MAX_TOTEMS > 1 / HasMultiCastActionBar
(Bartender's pattern) and register without a class filter when the
player has the multi-cast totem bar, so any CoA totem class picks it up.

units.lua: raid-header groupingOrder was the hardcoded 10-class vanilla
string, which dumped the 11 CoA custom classes into an unsorted tail
when GROUP BY CLASS was active. Build the order dynamically from
RAID_CLASS_COLORS (CoA populates this with all 21 classes via the
CUSTOM_CLASS_COLORS mechanism) at the call site.
2026-05-24 17:39:05 +02:00
florian.berthold ede7d2b23d chore(libs): sync shared LibStub-registered libs to canonical highest
Bumps in this fork:
  - LibSharedMedia-3.0

Brings these libs in line with the highest version any Exiles fork currently
bundles, so LibStub resolution is predictable regardless of load order.
2026-05-24 17:07:54 +02:00
florian.berthold 2d7349cafb fix(libs): pick up coa-ace3 d422ad3 (FileDataID → string paths)
Re-sync after coa-ace3 d422ad3 which converted 42 numeric FileDataIDs in
Set*Texture() calls back to string paths. Upstream Ace3 uses FDIDs which
silently fail on WoW 3.3.5 / CoA, rendering color swatches, checkboxes
and window chrome as solid-red placeholders.
2026-05-23 14:03:46 +02:00
florian.berthold da942631f0 chore(libs): sync Ace3 to coa-ace3 (WoWUIDev master @ 52e5f2c)
Bring every embedded Ace3 / CallbackHandler / LibStub copy in line with the
canonical Exiles/coa-ace3 bundle so LibStub resolution is predictable across
all Exiles forks regardless of which addons are enabled.

Libraries updated in this fork:
  AceConfig-3.0          3  (2 → 3)
  AceConfigCmd-3.0       14  (12 → 14)
  AceConfigDialog-3.0    92  (48 → 92)
  AceConfigRegistry-3.0  22  (12 → 22)
  AceDB-3.0              33  (21 → 33)
  AceDBOptions-3.0       15  (12 → 15)
  AceGUI-3.0             41  (33 → 41)
  CallbackHandler-1.0    8  (5 → 8)
  LibStub                2
2026-05-23 13:42:19 +02:00
florian.berthold 48ebec985b coa: fix CoA dispel detection timing in SUF aura scan
Previous approach baked playerCoaDispels into group.coaRaidFilter during
OnLayoutApplied, which can fire before PLAYER_LOGIN when C_Player isn't
ready yet — Venomancer and other CoA classes got cached as false and
never re-evaluated.

Fix: move all CoA logic into scan() itself so it runs on every
PLAYER_ENTERING_WORLD update. getCoaDispels() no longer caches when
C_Player is unavailable (returns nil without storing), so the first
successful in-world call populates it correctly.

updateGroup() is restored to its original form — no group.coaRaidFilter.
scan() intercepts filter=="HARMFUL|RAID", calls getCoaDispels(), and if
a dispel set is found strips |RAID and applies the per-type check inline.
2026-05-17 10:52:50 +02:00
florian.berthold 9679966f37 coa: fix "Show curable only" debuff filter for CoA custom classes
UnitAura "HARMFUL|RAID" only honours vanilla class dispel knowledge in
the 3.3.5 client — CoA custom classes (Chronomancer, Monk/Templar,
Prophet/Venomancer, etc.) were silently filtered to zero debuffs.

Fix: in updateGroup(), detect CoA dispellers via C_Player:IsCustomClass()
and store their per-class dispel set on group.coaRaidFilter instead of
appending |RAID.  scan() skips debuffs whose auraType is not in that
set, preserving contiguous button layout with no gaps.

Class → dispel types (sourced from coa-decursive):
  CHRONOMANCER  Magic/Curse/Disease/Poison (Roll Back 804490)
  MONK          Magic/Disease/Poison (Rebuke 525051)
  PROPHET       Poison (Antivenom 800905; curse-dispel doesn't fire)
  PYROMANCER    Disease/Poison
  RANGER        Disease/Poison
  CULTIST       Curse
  SONOFARUGAL   Curse
  SPIRITMAGE    Magic
  STARCALLER    Magic
  WITCHHUNTER   Curse
2026-05-17 06:08:34 +02:00
58 changed files with 12482 additions and 11800 deletions
+71
View File
@@ -0,0 +1,71 @@
name: release
on:
push:
tags:
- '*-coa.*' # Asc-1.1.6-coa.2, 9.1.40-coa.3, etc.
- 'v*' # v0.3.0 for repos without an upstream version
jobs:
release:
runs-on: linux-amd64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # build_zip uses git archive HEAD; full history is fine
- name: Build per-addon zip(s)
run: bash tools/build_zip.sh
- name: Publish release (Gitea API direct; no action dependency)
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
API: ${{ github.server_url }}/api/v1
# Gitea attachment ceiling is 200 MiB (see roles/gitea config).
# Skip anything larger so one oversized asset doesn't fail the job.
MAX_BYTES: 209715200
run: |
set -euo pipefail
# Create the release (or reuse if it already exists for this tag).
RID=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
"$API/repos/$REPO/releases/tags/$TAG" 2>/dev/null \
| jq -r '.id // empty')
if [ -z "$RID" ]; then
RID=$(curl -sf -X POST -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
"$API/repos/$REPO/releases" \
-d "$(jq -nc --arg t "$TAG" '{tag_name:$t,name:$t,draft:false,prerelease:false}')" \
| jq -r '.id')
fi
echo "release id: $RID"
# Upload every dist/*.zip. Per-asset failures don't fail the job —
# we want partial releases to still publish rather than block the
# whole pipeline on one big file.
failed=0
uploaded=0
for f in dist/*.zip; do
name=$(basename "$f")
size=$(stat -c '%s' "$f")
if [ "$size" -gt "$MAX_BYTES" ]; then
echo "::warning::skip $name (${size} B > ${MAX_BYTES} B Gitea limit; host on CDN instead)"
failed=$((failed+1))
continue
fi
echo "uploading $name ($(numfmt --to=iec "$size"))"
if curl -sf -X POST -H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@$f" \
"$API/repos/$REPO/releases/$RID/assets?name=$name" \
| jq -r '" -> " + .browser_download_url'; then
uploaded=$((uploaded+1))
else
echo "::warning::upload failed for $name"
failed=$((failed+1))
fi
done
echo "release published: $uploaded uploaded, $failed skipped/failed"
# Only fail the job if NO assets uploaded — a release with zero
# attachments isn't useful to anyone.
[ "$uploaded" -gt 0 ]
-77
View File
@@ -1,77 +0,0 @@
name: "Bug Report"
description: Create a report to help us improve this addon
labels: '🐛 Bug'
body:
- type: markdown
attributes:
value: |
Please search for existing issues before creating a new one.
- type: textarea
attributes:
label: Description
description: What did you expect to happen and what happened instead?
validations:
required: true
- type: dropdown
id: flavor
attributes:
label: Realm
description: What realm did this occur on?
options:
- Area 52 (Default)
- Seasonal
- Grizzly Hills
- Rexxar
- Other
validations:
required: true
- type: checkboxes
id: testing
attributes:
label: Tested with only this addon
description: Did you try having just this addon as the only enabled addon and everything else disabled?
options:
- label: "Yes"
- label: "No"
validations:
required: true
- type: textarea
attributes:
label: Lua Error
description: |
Do you have an error log of what happened? If you don't see any errors, make sure that error reporting is enabled (`/console scriptErrors 1`)
validations:
required: false
- type: textarea
attributes:
label: Reproduction Steps
description: Please list out the steps to reproduce your bug.
placeholder: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: true
- type: input
attributes:
label: Last Good Version
description: |
Was it working in a previous version? If yes, which update did it stop working? If you don't know, when was the last date you were aware it was working
placeholder: "MM/DD/YYYY"
validations:
required: false
- type: textarea
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
placeholder: Click here to attach your screenshots via the editor button in the top right.
validations:
required: false
-1
View File
@@ -1 +0,0 @@
blank_issues_enabled: false
-20
View File
@@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
-28
View File
@@ -1,28 +0,0 @@
# Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
<!-- A #issueNumber will be sufficient. -->
Fixes #(issue)
## Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
## How Has This Been Tested
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
## Checklist
<!-- These can be checked off after the pull request is submitted, in case you want discussion before they are completely ready -->
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
<!-- Is there any additional work that needs to be done? If so, add it to the above list -->
+1
View File
@@ -5,3 +5,4 @@
.lua/* .lua/*
.vscode .vscode
.idea .idea
dist/
@@ -3,7 +3,7 @@
-- as well as associate it with a slash command. -- as well as associate it with a slash command.
-- @class file -- @class file
-- @name AceConfig-3.0 -- @name AceConfig-3.0
-- @release $Id: AceConfig-3.0.lua 877 2009-11-02 15:56:50Z nevcairiel $ -- @release $Id$
--[[ --[[
AceConfig-3.0 AceConfig-3.0
@@ -12,21 +12,22 @@ Very light wrapper library that combines all the AceConfig subcomponents into on
]] ]]
local MAJOR, MINOR = "AceConfig-3.0", 2 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) local AceConfig = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfig then return end if not AceConfig then return end
local cfgreg = LibStub("AceConfigRegistry-3.0") --TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true)
local cfgcmd = LibStub("AceConfigCmd-3.0") --TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true)
local cfgdlg = LibStub("AceConfigDialog-3.0")
--TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0")
-- Lua APIs -- Lua APIs
local pcall, error, type, pairs = pcall, error, type, pairs local pcall, error, type, pairs = pcall, error, type, pairs
-- ------------------------------------------------------------------- -- -------------------------------------------------------------------
-- :RegisterOptionsTable(appName, options, slashcmd, persist) -- :RegisterOptionsTable(appName, options, slashcmd)
-- --
-- - appName - (string) application name -- - appName - (string) application name
-- - options - table or function ref, see AceConfigRegistry -- - options - table or function ref, see AceConfigRegistry
@@ -36,7 +37,7 @@ local pcall, error, type, pairs = pcall, error, type, pairs
-- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly. -- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly.
-- @paramsig appName, options [, slashcmd] -- @paramsig appName, options [, slashcmd]
-- @param appName The application name for the config table. -- @param appName The application name for the config table.
-- @param options The option table (or a function to generate one on demand) -- @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. -- @param slashcmd A slash command to register for the option table, or a table of slash commands.
-- @usage -- @usage
-- local AceConfig = LibStub("AceConfig-3.0") -- local AceConfig = LibStub("AceConfig-3.0")
@@ -1,7 +1,7 @@
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames. --- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames.
-- @class file -- @class file
-- @name AceConfigCmd-3.0 -- @name AceConfigCmd-3.0
-- @release $Id: AceConfigCmd-3.0.lua 904 2009-12-13 11:56:37Z nevcairiel $ -- @release $Id$
--[[ --[[
AceConfigCmd-3.0 AceConfigCmd-3.0
@@ -14,8 +14,9 @@ REQUIRES: AceConsole-3.0 for command registration (loaded on demand)
-- TODO: plugin args -- TODO: plugin args
local cfgreg = LibStub("AceConfigRegistry-3.0")
local MAJOR, MINOR = "AceConfigCmd-3.0", 12 local MAJOR, MINOR = "AceConfigCmd-3.0", 14
local AceConfigCmd = LibStub:NewLibrary(MAJOR, MINOR) local AceConfigCmd = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigCmd then return end if not AceConfigCmd then return end
@@ -23,7 +24,6 @@ if not AceConfigCmd then return end
AceConfigCmd.commands = AceConfigCmd.commands or {} AceConfigCmd.commands = AceConfigCmd.commands or {}
local commands = AceConfigCmd.commands local commands = AceConfigCmd.commands
local cfgreg = LibStub("AceConfigRegistry-3.0")
local AceConsole -- LoD local AceConsole -- LoD
local AceConsoleName = "AceConsole-3.0" local AceConsoleName = "AceConsole-3.0"
@@ -37,17 +37,10 @@ local error, assert = error, assert
-- WoW APIs -- WoW APIs
local _G = _G 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 local L = setmetatable({}, { -- TODO: replace with proper locale
__index = function(self,k) return k end __index = function(self,k) return k end
}) })
local function print(msg) local function print(msg)
(SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg) (SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg)
end end
@@ -401,7 +394,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
return return
end end
local str = strsub(info.input,inputpos); local strInput = strsub(info.input,inputpos);
if tab.type=="execute" then if tab.type=="execute" then
------------ execute -------------------------------------------- ------------ execute --------------------------------------------
@@ -414,21 +407,21 @@ local function handle(info, inputpos, tab, depth, retfalse)
local res = true local res = true
if tab.pattern then if tab.pattern then
if not(type(tab.pattern)=="string") then err(info, inputpos, "'pattern' - expected a string") end if type(tab.pattern)~="string" then err(info, inputpos, "'pattern' - expected a string") end
if not strmatch(str, tab.pattern) then if not strmatch(strInput, tab.pattern) then
usererr(info, inputpos, "'"..str.."' - " .. L["invalid input"]) usererr(info, inputpos, "'"..strInput.."' - " .. L["invalid input"])
return return
end end
end end
do_final(info, inputpos, tab, "set", str) do_final(info, inputpos, tab, "set", strInput)
elseif tab.type=="toggle" then elseif tab.type=="toggle" then
------------ toggle -------------------------------------------- ------------ toggle --------------------------------------------
local b local b
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
if str=="" then if str=="" then
b = callmethod(info, inputpos, tab, "get") b = callmethod(info, inputpos, tab, "get")
@@ -465,9 +458,9 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="range" then elseif tab.type=="range" then
------------ range -------------------------------------------- ------------ range --------------------------------------------
local val = tonumber(str) local val = tonumber(strInput)
if not val then if not val then
usererr(info, inputpos, "'"..str.."' - "..L["expected number"]) usererr(info, inputpos, "'"..strInput.."' - "..L["expected number"])
return return
end end
if type(info.step)=="number" then if type(info.step)=="number" then
@@ -487,7 +480,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="select" then elseif tab.type=="select" then
------------ select ------------------------------------ ------------ select ------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
local values = tab.values local values = tab.values
if type(values) == "function" or type(values) == "string" then if type(values) == "function" or type(values) == "string" then
@@ -528,7 +521,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="multiselect" then elseif tab.type=="multiselect" then
------------ multiselect ------------------------------------------- ------------ multiselect -------------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
local values = tab.values local values = tab.values
if type(values) == "function" or type(values) == "string" then if type(values) == "function" or type(values) == "string" then
@@ -565,7 +558,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
--check that the opt is valid --check that the opt is valid
local ok local ok
for k,v in pairs(values) do for k in pairs(values) do
if strlower(k)==opt then if strlower(k)==opt then
opt = k -- overwrite with key (in case of case mismatches) opt = k -- overwrite with key (in case of case mismatches)
ok = true ok = true
@@ -634,7 +627,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="color" then elseif tab.type=="color" then
------------ color -------------------------------------------- ------------ color --------------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
if str == "" then if str == "" then
--TODO: Show current value --TODO: Show current value
return return
@@ -642,7 +635,14 @@ local function handle(info, inputpos, tab, depth, retfalse)
local r, g, b, a local r, g, b, a
if tab.hasAlpha then 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 if str:len() == 8 and str:find("^%x*$") then
--parse a hex string --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 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
@@ -699,7 +699,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="keybinding" then elseif tab.type=="keybinding" then
------------ keybinding -------------------------------------------- ------------ keybinding --------------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
if str == "" then if str == "" then
--TODO: Show current value --TODO: Show current value
return return
File diff suppressed because it is too large Load Diff
@@ -8,16 +8,16 @@
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName". -- :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 -- @class file
-- @name AceConfigRegistry-3.0 -- @name AceConfigRegistry-3.0
-- @release $Id: AceConfigRegistry-3.0.lua 921 2010-05-09 15:49:14Z nevcairiel $ -- @release $Id$
local MAJOR, MINOR = "AceConfigRegistry-3.0", 12 local CallbackHandler = LibStub("CallbackHandler-1.0")
local MAJOR, MINOR = "AceConfigRegistry-3.0", 22
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR) local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigRegistry then return end if not AceConfigRegistry then return end
AceConfigRegistry.tables = AceConfigRegistry.tables or {} AceConfigRegistry.tables = AceConfigRegistry.tables or {}
local CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0")
if not AceConfigRegistry.callbacks then if not AceConfigRegistry.callbacks then
AceConfigRegistry.callbacks = CallbackHandler:New(AceConfigRegistry) AceConfigRegistry.callbacks = CallbackHandler:New(AceConfigRegistry)
end end
@@ -57,8 +57,8 @@ local istable={["table"]=true, _="table"}
local ismethodtable={["table"]=true,["string"]=true,["function"]=true, _="methodname, funcref or table"} local ismethodtable={["table"]=true,["string"]=true,["function"]=true, _="methodname, funcref or table"}
local optstring={["nil"]=true,["string"]=true, _="string"} local optstring={["nil"]=true,["string"]=true, _="string"}
local optstringfunc={["nil"]=true,["string"]=true,["function"]=true, _="string or funcref"} 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 optnumber={["nil"]=true,["number"]=true, _="number"}
local optmethod={["nil"]=true,["string"]=true,["function"]=true, _="methodname or funcref"}
local optmethodfalse={["nil"]=true,["string"]=true,["function"]=true,["boolean"]={[false]=true}, _="methodname, funcref or false"} 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 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 optmethodtable={["nil"]=true,["string"]=true,["function"]=true,["table"]=true, _="methodname, funcref or table"}
@@ -66,6 +66,7 @@ local optmethodbool={["nil"]=true,["string"]=true,["function"]=true,["boolean"]=
local opttable={["nil"]=true,["table"]=true, _="table"} local opttable={["nil"]=true,["table"]=true, _="table"}
local optbool={["nil"]=true,["boolean"]=true, _="boolean"} local optbool={["nil"]=true,["boolean"]=true, _="boolean"}
local optboolnumber={["nil"]=true,["boolean"]=true,["number"]=true, _="boolean or number"} local optboolnumber={["nil"]=true,["boolean"]=true,["number"]=true, _="boolean or number"}
local optstringnumber={["nil"]=true,["string"]=true,["number"]=true, _="string or number"}
local basekeys={ local basekeys={
type=isstring, type=isstring,
@@ -82,24 +83,33 @@ local basekeys={
dialogHidden=optmethodbool, dialogHidden=optmethodbool,
dropdownHidden=optmethodbool, dropdownHidden=optmethodbool,
cmdHidden=optmethodbool, cmdHidden=optmethodbool,
icon=optstringfunc, tooltipHyperlink=optstringfunc,
icon=optstringnumberfunc,
iconCoords=optmethodtable, iconCoords=optmethodtable,
handler=opttable, handler=opttable,
get=optmethodfalse, get=optmethodfalse,
set=optmethodfalse, set=optmethodfalse,
func=optmethodfalse, func=optmethodfalse,
arg={["*"]=true}, arg={["*"]=true},
width=optstring, width=optstringnumber,
relWidth=optnumber,
} }
local typedkeys={ local typedkeys={
header={}, header={
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
},
description={ description={
image=optstringfunc, image=optstringnumberfunc,
imageCoords=optmethodtable, imageCoords=optmethodtable,
imageHeight=optnumber, imageHeight=optnumber,
imageWidth=optnumber, imageWidth=optnumber,
fontSize=optstringfunc, fontSize=optstringfunc,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
}, },
group={ group={
args=istable, args=istable,
@@ -112,10 +122,13 @@ local typedkeys={
childGroups=optstring, childGroups=optstring,
}, },
execute={ execute={
image=optstringfunc, image=optstringnumberfunc,
imageCoords=optmethodtable, imageCoords=optmethodtable,
imageHeight=optnumber, imageHeight=optnumber,
imageWidth=optnumber, imageWidth=optnumber,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
}, },
input={ input={
pattern=optstring, pattern=optstring,
@@ -127,8 +140,11 @@ local typedkeys={
}, },
toggle={ toggle={
tristate=optbool, tristate=optbool,
image=optstringfunc, image=optstringnumberfunc,
imageCoords=optmethodtable, imageCoords=optmethodtable,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
}, },
tristate={ tristate={
}, },
@@ -140,9 +156,13 @@ local typedkeys={
step=optnumber, step=optnumber,
bigStep=optnumber, bigStep=optnumber,
isPercent=optbool, isPercent=optbool,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
}, },
select={ select={
values=ismethodtable, values=ismethodtable,
sorting=optmethodtable,
style={ style={
["nil"]=true, ["nil"]=true,
["string"]={dropdown=true,radio=true}, ["string"]={dropdown=true,radio=true},
@@ -151,6 +171,7 @@ local typedkeys={
control=optstring, control=optstring,
dialogControl=optstring, dialogControl=optstring,
dropdownControl=optstring, dropdownControl=optstring,
itemControl=optstring,
}, },
multiselect={ multiselect={
values=ismethodtable, values=ismethodtable,
@@ -161,10 +182,15 @@ local typedkeys={
dropdownControl=optstring, dropdownControl=optstring,
}, },
color={ color={
hasAlpha=optbool, hasAlpha=optmethodbool,
control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
}, },
keybinding={ keybinding={
-- TODO control=optstring,
dialogControl=optstring,
dropdownControl=optstring,
}, },
} }
@@ -287,7 +313,8 @@ end
-- @param appName The application name as given to `:RegisterOptionsTable()` -- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param options The options table, OR a function reference that generates it on demand. \\ -- @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. -- See the top of the page for info on arguments passed to such functions.
function AceConfigRegistry:RegisterOptionsTable(appName, options) -- @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 type(options)=="table" then
if options.type~="group" then -- quick sanity checker if options.type~="group" then -- quick sanity checker
error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - missing type='group' member in root group", 2) error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - missing type='group' member in root group", 2)
@@ -295,7 +322,7 @@ function AceConfigRegistry:RegisterOptionsTable(appName, options)
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl) AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl)
errlvl=(errlvl or 0)+1 errlvl=(errlvl or 0)+1
validateGetterArgs(uiType, uiName, errlvl) validateGetterArgs(uiType, uiName, errlvl)
if not AceConfigRegistry.validated[uiType][appName] then if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then
AceConfigRegistry:ValidateOptionsTable(options, appName, errlvl) -- upgradable AceConfigRegistry:ValidateOptionsTable(options, appName, errlvl) -- upgradable
AceConfigRegistry.validated[uiType][appName] = true AceConfigRegistry.validated[uiType][appName] = true
end end
@@ -306,7 +333,7 @@ function AceConfigRegistry:RegisterOptionsTable(appName, options)
errlvl=(errlvl or 0)+1 errlvl=(errlvl or 0)+1
validateGetterArgs(uiType, uiName, errlvl) validateGetterArgs(uiType, uiName, errlvl)
local tab = assert(options(uiType, uiName, appName)) local tab = assert(options(uiType, uiName, appName))
if not AceConfigRegistry.validated[uiType][appName] then if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then
AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable
AceConfigRegistry.validated[uiType][appName] = true AceConfigRegistry.validated[uiType][appName] = true
end end
@@ -1,9 +1,9 @@
--- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles. --- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles.
-- @class file -- @class file
-- @name AceDBOptions-3.0 -- @name AceDBOptions-3.0
-- @release $Id: AceDBOptions-3.0.lua 938 2010-06-13 07:21:38Z nevcairiel $ -- @release $Id$
local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 12 local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 15
local AceDBOptions, oldminor = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR) local AceDBOptions = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR)
if not AceDBOptions then return end -- No upgrade needed if not AceDBOptions then return end -- No upgrade needed
@@ -13,10 +13,6 @@ local pairs, next = pairs, next
-- WoW APIs -- WoW APIs
local UnitClass = UnitClass 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.optionTables = AceDBOptions.optionTables or {}
AceDBOptions.handlers = AceDBOptions.handlers or {} AceDBOptions.handlers = AceDBOptions.handlers or {}
@@ -25,168 +21,208 @@ AceDBOptions.handlers = AceDBOptions.handlers or {}
]] ]]
local L = { local L = {
default = "Default", choose = "Existing Profiles",
intro = "You can change the active database profile, so you can have different settings for every character.",
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 = "Reset Profile",
reset_sub = "Reset the current profile to the default",
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_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 = "New",
new_sub = "Create a new empty profile.", new_sub = "Create a new empty profile.",
choose = "Existing Profiles",
choose_sub = "Select one of your currently available profiles.",
copy_desc = "Copy the settings from one existing profile into the currently active profile.",
copy = "Copy From",
delete_desc = "Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.",
delete = "Delete a Profile",
delete_sub = "Deletes a profile from the database.",
delete_confirm = "Are you sure you want to delete the selected profile?",
profiles = "Profiles", profiles = "Profiles",
profiles_sub = "Manage Profiles", profiles_sub = "Manage Profiles",
current = "Current Profile:", 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() local LOCALE = GetLocale()
if LOCALE == "deDE" then 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["default"] = "Standard"
L["intro"] = "Hier kannst du das aktive Datenbankprofile \195\164ndern, damit du verschiedene Einstellungen f\195\188r jeden Charakter erstellen kannst, wodurch eine sehr flexible Konfiguration m\195\182glich wird." L["delete"] = "Profil löschen"
L["reset_desc"] = "Setzt das momentane Profil auf Standardwerte zur\195\188ck, f\195\188r den Fall das mit der Konfiguration etwas schief lief oder weil du einfach neu starten willst." L["delete_confirm"] = "Willst du das ausgewählte Profil wirklich löschen?"
L["reset"] = "Profil zur\195\188cksetzen" L["delete_desc"] = "Lösche vorhandene oder unbenutzte Profile aus der Datenbank, um Platz zu sparen und die SavedVariables-Datei 'sauber' zu halten."
L["reset_sub"] = "Das aktuelle Profil auf Standard zur\195\188cksetzen." L["delete_sub"] = "Löscht ein Profil aus der Datenbank."
L["choose_desc"] = "Du kannst ein neues Profil erstellen, indem du einen neuen Namen in der Eingabebox 'Neu' eingibst, oder w\195\164hle eines der vorhandenen Profile aus." 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"] = "Neu"
L["new_sub"] = "Ein neues Profil erstellen." L["new_sub"] = "Ein neues Profil erstellen."
L["choose"] = "Vorhandene Profile"
L["choose_sub"] = "W\195\164hlt ein bereits vorhandenes Profil aus."
L["copy_desc"] = "Kopiere die Einstellungen von einem vorhandenen Profil in das aktive Profil."
L["copy"] = "Kopieren von..."
L["delete_desc"] = "L\195\182sche vorhandene oder unbenutzte Profile aus der Datenbank um Platz zu sparen und um die SavedVariables Datei 'sauber' zu halten."
L["delete"] = "Profil l\195\182schen"
L["delete_sub"] = "L\195\182scht ein Profil aus der Datenbank."
L["delete_confirm"] = "Willst du das ausgew\195\164hlte Profil wirklich l\195\182schen?"
L["profiles"] = "Profile" L["profiles"] = "Profile"
L["profiles_sub"] = "Profile verwalten" L["profiles_sub"] = "Profile verwalten"
--L["current"] = "Current Profile:" 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 elseif LOCALE == "frFR" then
L["default"] = "D\195\169faut"
L["intro"] = "Vous pouvez changer le profil actuel afin d'avoir des param\195\168tres diff\195\169rents pour chaque personnage, permettant ainsi d'avoir une configuration tr\195\168s flexible."
L["reset_desc"] = "R\195\169initialise le profil actuel au cas o\195\185 votre configuration est corrompue ou si vous voulez tout simplement faire table rase."
L["reset"] = "R\195\169initialiser le profil"
L["reset_sub"] = "R\195\169initialise le profil actuel avec les param\195\168tres par d\195\169faut."
L["choose_desc"] = "Vous pouvez cr\195\169er un nouveau profil en entrant un nouveau nom dans la bo\195\174te de saisie, ou en choississant un des profils d\195\169j\195\160 existants."
L["new"] = "Nouveau"
L["new_sub"] = "Cr\195\169\195\169e un nouveau profil vierge."
L["choose"] = "Profils existants" L["choose"] = "Profils existants"
L["choose_sub"] = "Permet de choisir un des profils d\195\169j\195\160 disponibles." 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["copy_desc"] = "Copie les param\195\168tres d'un profil d\195\169j\195\160 existant dans le profil actuellement actif." L["choose_sub"] = "Permet de choisir un des profils déjà disponibles."
L["copy"] = "Copier \195\160 partir de" L["copy"] = "Copier à partir de"
L["delete_desc"] = "Supprime les profils existants inutilis\195\169s de la base de donn\195\169es afin de gagner de la place et de nettoyer le fichier SavedVariables." 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"] = "Supprimer un profil"
L["delete_sub"] = "Supprime un profil de la base de donn\195\169es." L["delete_confirm"] = "Etes-vous sûr de vouloir supprimer le profil sélectionné ?"
L["delete_confirm"] = "Etes-vous s\195\187r de vouloir supprimer le profil s\195\169lectionn\195\169 ?" 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"] = "Profils"
L["profiles_sub"] = "Gestion des profils" L["profiles_sub"] = "Gestion des profils"
--L["current"] = "Current Profile:" 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 elseif LOCALE == "koKR" then
L["choose"] = "기존 프로필"
L["choose_desc"] = "편집 상자에 이름을 입력하여 새로운 프로필을 만들거나 이미 존재하는 프로필 중 하나를 선택할 수 있습니다."
L["choose_sub"] = "현재 이용할 수 있는 프로필 중 하나를 선택합니다."
L["copy"] = "복사해 올 프로필"
L["copy_desc"] = "기존 프로필의 설정을 현재 활성화된 프로필로 복사합니다."
L["current"] = "현재 프로필:"
L["default"] = "기본값" L["default"] = "기본값"
L["intro"] = "모든 캐릭터의 다양한 설정과 사용중인 데이터베이스 프로필, 어느것이던지 매우 다루기 쉽게 바꿀수 있습니다."
L["reset_desc"] = "단순히 다시 새롭게 구성을 원하는 경우, 현재 프로필을 기본값으로 초기화 합니다."
L["reset"] = "프로필 초기화"
L["reset_sub"] = "현재의 프로필을 기본값으로 초기화 합니다"
L["choose_desc"] = "새로운 이름을 입력하거나, 이미 있는 프로필중 하나를 선택하여 새로운 프로필을 만들 수 있습니다."
L["new"] = "새로운 프로필"
L["new_sub"] = "새로운 프로필을 만듭니다."
L["choose"] = "프로필 선택"
L["choose_sub"] = "당신이 현재 이용할수 있는 프로필을 선택합니다."
L["copy_desc"] = "현재 사용중인 프로필에, 선택한 프로필의 설정을 복사합니다."
L["copy"] = "복사"
L["delete_desc"] = "데이터베이스에 사용중이거나 저장된 프로파일 삭제로 SavedVariables 파일의 정리와 공간 절약이 됩니다."
L["delete"] = "프로필 삭제" L["delete"] = "프로필 삭제"
L["delete_sub"] = "데이터베이스의 프로필을 삭제합니다." L["delete_confirm"] = "선택한 프로필을 삭제하시겠습니까?"
L["delete_confirm"] = "정말로 선택한 프로필 삭제를 원하십니까?" L["delete_desc"] = "데이터베이스에서 기존 프로필과 사용하지 않는 프로필 삭제하여 공간을 절약하고 SavedVariables 파일을 정리합니다."
L["delete_sub"] = "데이터베이스에서 프로필을 삭제합니다."
L["intro"] = "활성 데이터베이스 프로필을 변경할 수 있으며, 모든 캐릭터마다 서로 다른 설정을 지정할 수 있습니다."
L["new"] = "새로운 프로필"
L["new_sub"] = "비어 있는 프로필을 새로 만듭니다."
L["profiles"] = "프로필" L["profiles"] = "프로필"
L["profiles_sub"] = "프로필 설정" L["profiles_sub"] = "프로필 관리"
--L["current"] = "Current Profile:" L["reset"] = "프로필 재설정"
L["reset_desc"] = "구성이 손상되었거나 처음부터 다시 시작하고 싶은 경우 현재 프로필을 기본값으로 재설정하세요."
L["reset_sub"] = "현재 프로필을 기본값으로 재설정합니다"
elseif LOCALE == "esES" or LOCALE == "esMX" then elseif LOCALE == "esES" or LOCALE == "esMX" then
L["default"] = "Por defecto" L["choose"] = "Perfiles existentes"
L["intro"] = "Puedes cambiar el perfil activo de tal manera que cada personaje tenga diferentes configuraciones."
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"] = "Reiniciar Perfil"
L["reset_sub"] = "Reinicar el perfil actual al de por defecto"
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_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"] = "Nuevo"
L["new_sub"] = "Crear un nuevo perfil vacio." L["new_sub"] = "Crear un nuevo perfil vacio."
L["choose"] = "Perfiles existentes"
L["choose_sub"] = "Selecciona uno de los perfiles disponibles."
L["copy_desc"] = "Copia los ajustes de un perfil existente al perfil actual."
L["copy"] = "Copiar de"
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"] = "Borrar un Perfil"
L["delete_sub"] = "Borra un perfil de la base de datos."
L["delete_confirm"] = "¿Estas seguro que quieres borrar el perfil seleccionado?"
L["profiles"] = "Perfiles" L["profiles"] = "Perfiles"
L["profiles_sub"] = "Manejar Perfiles" L["profiles_sub"] = "Manejar Perfiles"
--L["current"] = "Current Profile:" 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 elseif LOCALE == "zhTW" then
L["choose"] = "現有的設定檔"
L["choose_desc"] = "您可以在文字方塊內輸入名字以建立新的設定檔,或是選擇一個現有的設定檔使用。"
L["choose_sub"] = "從當前可用的設定檔裡面選擇一個。"
L["copy"] = "複製自"
L["copy_desc"] = "從一個現有的設定檔,將設定複製到現在使用中的設定檔。"
L["current"] = "目前設定檔:"
L["default"] = "預設" L["default"] = "預設"
L["intro"] = "你可以選擇一個活動的資料設定檔,這樣你的每個角色就可以擁有不同的設定值,可以給你的插件設定帶來極大的靈活性。" L["delete"] = "刪除一個設定檔"
L["reset_desc"] = "將當前的設定檔恢復到它的預設值,用於你的設定檔損壞,或者你只是想重來的情況。" L["delete_confirm"] = "確定要刪除所選擇的設定檔嗎?"
L["reset"] = "重置設定檔" L["delete_desc"] = "從資料庫裡刪除不再使用的設定檔,以節省空間,並且清理 SavedVariables 檔案。"
L["reset_sub"] = "將當前的設定檔恢復為預設值" L["delete_sub"] = "從資料庫裡刪除一個設定檔。"
L["choose_desc"] = "可以通過在文本框內輸入一個名字創立一個新的設定檔,也可以選擇一個已經存在的設定" L["intro"] = "可以從資料庫中選擇一個設定檔來使用,如此就可以讓每個角色使用不同的設定。"
L["new"] = "新建" L["new"] = "新建"
L["new_sub"] = "新建一個空的設定檔。" L["new_sub"] = "新建一個空的設定檔。"
L["choose"] = "現有的設定檔"
L["choose_sub"] = "從當前可用的設定檔裏面選擇一個。"
L["copy_desc"] = "從當前某個已保存的設定檔複製到當前正使用的設定檔。"
L["copy"] = "複製自"
L["delete_desc"] = "從資料庫裏刪除不再使用的設定檔,以節省空間,並且清理SavedVariables檔。"
L["delete"] = "刪除一個設定檔"
L["delete_sub"] = "從資料庫裏刪除一個設定檔。"
L["delete_confirm"] = "你確定要刪除所選擇的設定檔嗎?"
L["profiles"] = "設定檔" L["profiles"] = "設定檔"
L["profiles_sub"] = "管理設定檔" L["profiles_sub"] = "管理設定檔"
--L["current"] = "Current Profile:" L["reset"] = "重置設定檔"
L["reset_desc"] = "將現用的設定檔重置為預設值;用於設定檔損壞,或者單純想要重來的情況。"
L["reset_sub"] = "將目前的設定檔重置為預設值"
elseif LOCALE == "zhCN" then elseif LOCALE == "zhCN" then
L["default"] = "默认" L["choose"] = "现有的配置文件"
L["intro"] = "你可以选择一个活动的数据配置文件,这样你的每个角色就可以拥有不同的设置值,可以给你的插件配置带来极大的灵活性。"
L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。"
L["reset"] = "重置配置文件"
L["reset_sub"] = "将当前的配置文件恢复为默认值"
L["choose_desc"] = "你可以通过在文本框内输入一个名字创立一个新的配置文件,也可以选择一个已经存在的配置文件。" 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"] = "新建"
L["new_sub"] = "新建一个空的配置文件。" L["new_sub"] = "新建一个空的配置文件。"
L["choose"] = "现有的配置文件"
L["choose_sub"] = "从当前可用的配置文件里面选择一个。"
L["copy_desc"] = "从当前某个已保存的配置文件复制到当前正使用的配置文件。"
L["copy"] = "复制自"
L["delete_desc"] = "从数据库里删除不再使用的配置文件,以节省空间,并且清理SavedVariables文件。"
L["delete"] = "删除一个配置文件"
L["delete_sub"] = "从数据库里删除一个配置文件。"
L["delete_confirm"] = "你确定要删除所选择的配置文件么?"
L["profiles"] = "配置文件" L["profiles"] = "配置文件"
L["profiles_sub"] = "管理配置文件" L["profiles_sub"] = "管理配置文件"
--L["current"] = "Current Profile:" L["reset"] = "重置配置文件"
L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。"
L["reset_sub"] = "将当前的配置文件恢复为默认值"
elseif LOCALE == "ruRU" then elseif LOCALE == "ruRU" then
L["default"] = "По умолчанию"
L["intro"] = "Изменяя активный профиль, вы можете задать различные настройки модификаций для каждого персонажа."
L["reset_desc"] = "Если ваша конфигурации испорчена или если вы хотите настроить всё заново - сбросьте текущий профиль на стандартные значения."
L["reset"] = "Сброс профиля"
L["reset_sub"] = "Сброс текущего профиля на стандартный"
L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей."
L["new"] = "Новый"
L["new_sub"] = "Создать новый чистый профиль"
L["choose"] = "Существующие профили" L["choose"] = "Существующие профили"
L["choose_sub"] = "Выбор одиного из уже доступных профилей" L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей."
L["copy_desc"] = "Скопировать настройки из выбранного профиля в активный." L["choose_sub"] = "Выбор одного из уже доступных профилей."
L["copy"] = "Скопировать из" L["copy"] = "Скопировать из"
L["delete_desc"] = "Удалить существующий и неиспользуемый профиль из БД для сохранения места, и очистить SavedVariables файл." L["copy_desc"] = "Копирование настроек из выбранного профиля в активный."
L["current"] = "Текущий профиль:"
L["default"] = "По умолчанию"
L["delete"] = "Удалить профиль" L["delete"] = "Удалить профиль"
L["delete_sub"] = "Удаление профиля из БД" L["delete_confirm"] = "Вы уверены, что хотите удалить выбранный профиль?"
L["delete_confirm"] = "Вы уверены, что вы хотите удалить выбранный профиль?" L["delete_desc"] = "Удаление существующего и неиспользуемого профиля из базы данных для сохранения места, и очистка файла SavedVariables."
L["delete_sub"] = "Удаление профиля из базы данных."
L["intro"] = "Изменяя активный профиль, Вы можете задать разные настройки для каждого персонажа."
L["new"] = "Новый"
L["new_sub"] = "Создание нового чистого профиля."
L["profiles"] = "Профили" L["profiles"] = "Профили"
L["profiles_sub"] = "Управление профилями" L["profiles_sub"] = "Управление профилями"
--L["current"] = "Current Profile:" 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"] = "Predefinito"
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 end
local defaultProfiles local defaultProfiles
+294 -79
View File
@@ -24,33 +24,28 @@
-- f:AddChild(btn) -- f:AddChild(btn)
-- @class file -- @class file
-- @name AceGUI-3.0 -- @name AceGUI-3.0
-- @release $Id: AceGUI-3.0.lua 924 2010-05-13 15:12:20Z nevcairiel $ -- @release $Id$
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 33 local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 41
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
if not AceGUI then return end -- No upgrade needed if not AceGUI then return end -- No upgrade needed
-- Lua APIs -- Lua APIs
local tconcat, tremove, tinsert = table.concat, table.remove, table.insert local tinsert, wipe = table.insert, table.wipe
local select, pairs, next, type = select, pairs, next, type local select, pairs, next, type = select, pairs, next, type
local error, assert, loadstring = error, assert, loadstring local error, assert = error, assert
local setmetatable, rawget, rawset = setmetatable, rawget, rawset local setmetatable, rawget = setmetatable, rawget
local math_max = math.max local math_max, math_min, math_ceil = math.max, math.min, math.ceil
-- WoW APIs -- WoW APIs
local UIParent = UIParent local UIParent = 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: geterrorhandler, LibStub
--local con = LibStub("AceConsole-3.0",true)
AceGUI.WidgetRegistry = AceGUI.WidgetRegistry or {} AceGUI.WidgetRegistry = AceGUI.WidgetRegistry or {}
AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {} AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {}
AceGUI.WidgetBase = AceGUI.WidgetBase or {} AceGUI.WidgetBase = AceGUI.WidgetBase or {}
AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {} AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {}
AceGUI.WidgetVersions = AceGUI.WidgetVersions or {} AceGUI.WidgetVersions = AceGUI.WidgetVersions or {}
AceGUI.tooltip = AceGUI.tooltip or CreateFrame("GameTooltip", "AceGUITooltip", UIParent, "GameTooltipTemplate")
-- local upvalues -- local upvalues
local WidgetRegistry = AceGUI.WidgetRegistry local WidgetRegistry = AceGUI.WidgetRegistry
@@ -66,39 +61,10 @@ local function errorhandler(err)
return geterrorhandler()(err) return geterrorhandler()(err)
end end
local function CreateDispatcher(argCount)
local code = [[
local xpcall, eh = ...
local method, ARGS
local function call() return method(ARGS) end
local function dispatch(func, ...)
method = func
if not method then return end
ARGS = ...
return xpcall(call, eh)
end
return dispatch
]]
local ARGS = {}
for i = 1, argCount do ARGS[i] = "arg"..i end
code = code:gsub("ARGS", tconcat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
end
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})
Dispatchers[0] = function(func)
return xpcall(func, errorhandler)
end
local function safecall(func, ...) local function safecall(func, ...)
return Dispatchers[select("#", ...)](func, ...) if func then
return xpcall(func, errorhandler, ...)
end
end end
-- Recycling functions -- Recycling functions
@@ -122,38 +88,38 @@ do
AceGUI.objPools = AceGUI.objPools or {} AceGUI.objPools = AceGUI.objPools or {}
local objPools = AceGUI.objPools local objPools = AceGUI.objPools
--Returns a new instance, if none are available either returns a new table or calls the given contructor --Returns a new instance, if none are available either returns a new table or calls the given contructor
function newWidget(type) function newWidget(widgetType)
if not WidgetRegistry[type] then if not WidgetRegistry[widgetType] then
error("Attempt to instantiate unknown widget type", 2) error("Attempt to instantiate unknown widget type", 2)
end end
if not objPools[type] then if not objPools[widgetType] then
objPools[type] = {} objPools[widgetType] = {}
end end
local newObj = next(objPools[type]) local newObj = next(objPools[widgetType])
if not newObj then if not newObj then
newObj = WidgetRegistry[type]() newObj = WidgetRegistry[widgetType]()
newObj.AceGUIWidgetVersion = WidgetVersions[type] newObj.AceGUIWidgetVersion = WidgetVersions[widgetType]
else else
objPools[type][newObj] = nil objPools[widgetType][newObj] = nil
-- if the widget is older then the latest, don't even try to reuse it -- if the widget is older then the latest, don't even try to reuse it
-- just forget about it, and grab a new one. -- just forget about it, and grab a new one.
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[type] then if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[widgetType] then
return newWidget(type) return newWidget(widgetType)
end end
end end
return newObj return newObj
end end
-- Releases an instance to the Pool -- Releases an instance to the Pool
function delWidget(obj,type) function delWidget(obj,widgetType)
if not objPools[type] then if not objPools[widgetType] then
objPools[type] = {} objPools[widgetType] = {}
end end
if objPools[type][obj] then if objPools[widgetType][obj] then
error("Attempt to Release Widget that is already released", 2) error("Attempt to Release Widget that is already released", 2)
end end
objPools[type][obj] = true objPools[widgetType][obj] = true
end end
end end
@@ -169,9 +135,9 @@ end
-- OnAcquire function on it, before returning. -- OnAcquire function on it, before returning.
-- @param type The type of the widget. -- @param type The type of the widget.
-- @return The newly created widget. -- @return The newly created widget.
function AceGUI:Create(type) function AceGUI:Create(widgetType)
if WidgetRegistry[type] then if WidgetRegistry[widgetType] then
local widget = newWidget(type) local widget = newWidget(widgetType)
if rawget(widget, "Acquire") then if rawget(widget, "Acquire") then
widget.OnAcquire = widget.Acquire widget.OnAcquire = widget.Acquire
@@ -189,7 +155,7 @@ function AceGUI:Create(type)
if widget.OnAcquire then if widget.OnAcquire then
widget:OnAcquire() widget:OnAcquire()
else else
error(("Widget type %s doesn't supply an OnAcquire Function"):format(type)) error(("Widget type %s doesn't supply an OnAcquire Function"):format(widgetType))
end end
-- Set the default Layout ("List") -- Set the default Layout ("List")
safecall(widget.SetLayout, widget, "List") safecall(widget.SetLayout, widget, "List")
@@ -204,7 +170,10 @@ end
-- If this widget is a Container-Widget, all of its Child-Widgets will be releases as well. -- If this widget is a Container-Widget, all of its Child-Widgets will be releases as well.
-- @param widget The widget to release -- @param widget The widget to release
function AceGUI:Release(widget) function AceGUI:Release(widget)
if widget.isQueuedForRelease then return end
widget.isQueuedForRelease = true
safecall(widget.PauseLayout, widget) safecall(widget.PauseLayout, widget)
widget.frame:Hide()
widget:Fire("OnRelease") widget:Fire("OnRelease")
safecall(widget.ReleaseChildren, widget) safecall(widget.ReleaseChildren, widget)
@@ -233,9 +202,26 @@ function AceGUI:Release(widget)
widget.content.width = nil widget.content.width = nil
widget.content.height = nil widget.content.height = nil
end end
widget.isQueuedForRelease = nil
delWidget(widget, widget.type) delWidget(widget, widget.type)
end end
--- Check if a widget is currently in the process of being released
-- This function check if this widget, or any of its parents (in which case it'll be released shortly as well)
-- are currently being released. This allows addon to handle any callbacks accordingly.
-- @param widget The widget to check
function AceGUI:IsReleasing(widget)
if widget.isQueuedForRelease then
return true
end
if widget.parent and widget.parent.AceGUIWidgetVersion then
return AceGUI:IsReleasing(widget.parent)
end
return false
end
----------- -----------
-- Focus -- -- Focus --
----------- -----------
@@ -362,6 +348,10 @@ do
AceGUI:Release(self) AceGUI:Release(self)
end end
WidgetBase.IsReleasing = function(self)
return AceGUI:IsReleasing(self)
end
WidgetBase.SetPoint = function(self, ...) WidgetBase.SetPoint = function(self, ...)
return self.frame:SetPoint(...) return self.frame:SetPoint(...)
end end
@@ -593,25 +583,25 @@ AceGUI.counts = AceGUI.counts or {}
-- This is used by widgets that require a named frame, e.g. when a Blizzard -- This is used by widgets that require a named frame, e.g. when a Blizzard
-- Template requires it. -- Template requires it.
-- @param type The widget type -- @param type The widget type
function AceGUI:GetNextWidgetNum(type) function AceGUI:GetNextWidgetNum(widgetType)
if not self.counts[type] then if not self.counts[widgetType] then
self.counts[type] = 0 self.counts[widgetType] = 0
end end
self.counts[type] = self.counts[type] + 1 self.counts[widgetType] = self.counts[widgetType] + 1
return self.counts[type] return self.counts[widgetType]
end end
--- Return the number of created widgets for this type. --- Return the number of created widgets for this type.
-- In contrast to GetNextWidgetNum, the number is not incremented. -- In contrast to GetNextWidgetNum, the number is not incremented.
-- @param type The widget type -- @param widgetType The widget type
function AceGUI:GetWidgetCount(type) function AceGUI:GetWidgetCount(widgetType)
return self.counts[type] or 0 return self.counts[widgetType] or 0
end end
--- Return the version of the currently registered widget type. --- Return the version of the currently registered widget type.
-- @param type The widget type -- @param widgetType The widget type
function AceGUI:GetWidgetVersion(type) function AceGUI:GetWidgetVersion(widgetType)
return WidgetVersions[type] return WidgetVersions[widgetType]
end end
------------- -------------
@@ -667,14 +657,23 @@ AceGUI:RegisterLayout("Fill",
if children[1] then if children[1] then
children[1]:SetWidth(content:GetWidth() or 0) children[1]:SetWidth(content:GetWidth() or 0)
children[1]:SetHeight(content:GetHeight() or 0) children[1]:SetHeight(content:GetHeight() or 0)
children[1].frame:ClearAllPoints()
children[1].frame:SetAllPoints(content) children[1].frame:SetAllPoints(content)
children[1].frame:Show() children[1].frame:Show()
safecall(content.obj.LayoutFinished, content.obj, nil, children[1].frame:GetHeight()) safecall(content.obj.LayoutFinished, content.obj, nil, children[1].frame:GetHeight())
end end
end) end)
local layoutrecursionblock = nil
local function safelayoutcall(object, func, ...)
layoutrecursionblock = true
object[func](object, ...)
layoutrecursionblock = nil
end
AceGUI:RegisterLayout("Flow", AceGUI:RegisterLayout("Flow",
function(content, children) function(content, children)
if layoutrecursionblock then return end
--used height so far --used height so far
local height = 0 local height = 0
--width used in the current row --width used in the current row
@@ -682,14 +681,12 @@ AceGUI:RegisterLayout("Flow",
--height of the current row --height of the current row
local rowheight = 0 local rowheight = 0
local rowoffset = 0 local rowoffset = 0
local lastrowoffset
local width = content.width or content:GetWidth() or 0 local width = content.width or content:GetWidth() or 0
--control at the start of the row --control at the start of the row
local rowstart local rowstart
local rowstartoffset local rowstartoffset
local lastrowstart
local isfullheight local isfullheight
local frameoffset local frameoffset
@@ -762,12 +759,11 @@ AceGUI:RegisterLayout("Flow",
end end
if child.width == "fill" then if child.width == "fill" then
child:SetWidth(width) safelayoutcall(child, "SetWidth", width)
frame:SetPoint("RIGHT", content) frame:SetPoint("RIGHT", content)
usedwidth = 0 usedwidth = 0
rowstart = frame rowstart = frame
rowstartoffset = frameoffset
if child.DoLayout then if child.DoLayout then
child:DoLayout() child:DoLayout()
@@ -776,7 +772,7 @@ AceGUI:RegisterLayout("Flow",
rowoffset = child.alignoffset or (rowheight / 2) rowoffset = child.alignoffset or (rowheight / 2)
rowstartoffset = rowoffset rowstartoffset = rowoffset
elseif child.width == "relative" then elseif child.width == "relative" then
child:SetWidth(width * child.relWidth) safelayoutcall(child, "SetWidth", width * child.relWidth)
if child.DoLayout then if child.DoLayout then
child:DoLayout() child:DoLayout()
@@ -803,3 +799,222 @@ AceGUI:RegisterLayout("Flow",
height = height + rowheight + 3 height = height + rowheight + 3
safecall(content.obj.LayoutFinished, content.obj, nil, height) safecall(content.obj.LayoutFinished, content.obj, nil, height)
end) end)
-- Get alignment method and value. Possible alignment methods are a callback, a number, "start", "middle", "end", "fill" or "TOPLEFT", "BOTTOMRIGHT" etc.
local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
local fn = cellObj and (cellObj["align" .. dir] or cellObj.align)
or colObj and (colObj["align" .. dir] or colObj.align)
or tableObj["align" .. dir] or tableObj.align
or "CENTERLEFT"
local val
child, cell = child or 0, cell or 0
if type(fn) == "string" then
fn = fn:lower()
fn = dir == "V" and (fn:sub(1, 3) == "top" and "start" or fn:sub(1, 6) == "bottom" and "end" or fn:sub(1, 6) == "center" and "middle")
or dir == "H" and (fn:sub(-4) == "left" and "start" or fn:sub(-5) == "right" and "end" or fn:sub(-6) == "center" and "middle")
or fn
val = (fn == "start" or fn == "fill") and 0 or fn == "end" and cell - child or (cell - child) / 2
elseif type(fn) == "function" then
val = fn(child or 0, cell, dir)
else
val = fn
end
return fn, math_max(0, math_min(val, cell))
end
-- Get width or height for multiple cells combined
local GetCellDimension = function (dir, laneDim, from, to, space)
local dim = 0
for cell=from,to do
dim = dim + (laneDim[cell] or 0)
end
return dim + math_max(0, to - from) * (space or 0)
end
--[[ Options
============
Container:
- columns ({col, col, ...}): Column settings. "col" can be a number (<= 0: content width, <1: rel. width, <10: weight, >=10: abs. width) or a table with column setting.
- space, spaceH, spaceV: Overall, horizontal and vertical spacing between cells.
- align, alignH, alignV: Overall, horizontal and vertical cell alignment. See GetCellAlign() for possible values.
Columns:
- width: Fixed column width (nil or <=0: content width, <1: rel. width, >=1: abs. width).
- min or 1: Min width for content based width
- max or 2: Max width for content based width
- weight: Flexible column width. The leftover width after accounting for fixed-width columns is distributed to weighted columns according to their weights.
- align, alignH, alignV: Overwrites the container setting for alignment.
Cell:
- colspan: Makes a cell span multiple columns.
- rowspan: Makes a cell span multiple rows.
- align, alignH, alignV: Overwrites the container and column setting for alignment.
]]
AceGUI:RegisterLayout("Table",
function (content, children)
local obj = content.obj
obj:PauseLayout()
local tableObj = obj:GetUserData("table")
local cols = tableObj.columns
local spaceH = tableObj.spaceH or tableObj.space or 0
local spaceV = tableObj.spaceV or tableObj.space or 0
local totalH = (content:GetWidth() or content.width or 0) - spaceH * (#cols - 1)
-- We need to reuse these because layout events can come in very frequently
local layoutCache = obj:GetUserData("layoutCache")
if not layoutCache then
layoutCache = {{}, {}, {}, {}, {}, {}}
obj:SetUserData("layoutCache", layoutCache)
end
local t, laneH, laneV, rowspans, rowStart, colStart = unpack(layoutCache)
-- Create the grid
local n, slotFound = 0
for i,child in ipairs(children) do
if child:IsShown() then
repeat
n = n + 1
local col = (n - 1) % #cols + 1
local row = math_ceil(n / #cols)
local rowspan = rowspans[col]
local cell = rowspan and rowspan.child or child
local cellObj = cell:GetUserData("cell")
slotFound = not rowspan
-- Rowspan
if not rowspan and cellObj and cellObj.rowspan then
rowspan = {child = child, from = row, to = row + cellObj.rowspan - 1}
rowspans[col] = rowspan
end
if rowspan and i == #children then
rowspan.to = row
end
-- Colspan
local colspan = math_max(0, math_min((cellObj and cellObj.colspan or 1) - 1, #cols - col))
n = n + colspan
-- Place the cell
if not rowspan or rowspan.to == row then
t[n] = cell
rowStart[cell] = rowspan and rowspan.from or row
colStart[cell] = col
if rowspan then
rowspans[col] = nil
end
end
until slotFound
end
end
local rows = math_ceil(n / #cols)
-- Determine fixed size cols and collect weights
local extantH, totalWeight = totalH, 0
for col,colObj in ipairs(cols) do
laneH[col] = 0
if type(colObj) == "number" then
colObj = {[colObj >= 1 and colObj < 10 and "weight" or "width"] = colObj}
cols[col] = colObj
end
if colObj.weight then
-- Weight
totalWeight = totalWeight + (colObj.weight or 1)
else
if not colObj.width or colObj.width <= 0 then
-- Content width
for row=1,rows do
local child = t[(row - 1) * #cols + col]
if child then
local f = child.frame
f:ClearAllPoints()
local childH = f:GetWidth() or 0
laneH[col] = math_max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH))
end
end
laneH[col] = math_max(colObj.min or colObj[1] or 0, math_min(laneH[col], colObj.max or colObj[2] or laneH[col]))
else
-- Rel./Abs. width
laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width
end
extantH = math_max(0, extantH - laneH[col])
end
end
-- Determine sizes based on weight
local scale = totalWeight > 0 and extantH / totalWeight or 0
for col,colObj in pairs(cols) do
if colObj.weight then
laneH[col] = scale * colObj.weight
end
end
-- Arrange children
for row=1,rows do
local rowV = 0
-- Horizontal placement and sizing
for col=1,#cols do
local child = t[(row - 1) * #cols + col]
if child then
local colObj = cols[colStart[child]]
local cellObj = child:GetUserData("cell")
local offsetH = GetCellDimension("H", laneH, 1, colStart[child] - 1, spaceH) + (colStart[child] == 1 and 0 or spaceH)
local cellH = GetCellDimension("H", laneH, colStart[child], col, spaceH)
local f = child.frame
f:ClearAllPoints()
local childH = f:GetWidth() or 0
local alignFn, align = GetCellAlign("H", tableObj, colObj, cellObj, cellH, childH)
f:SetPoint("LEFT", content, offsetH + align, 0)
if child:IsFullWidth() or alignFn == "fill" or childH > cellH then
f:SetPoint("RIGHT", content, "LEFT", offsetH + align + cellH, 0)
end
if child.DoLayout then
child:DoLayout()
end
rowV = math_max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV))
end
end
laneV[row] = rowV
-- Vertical placement and sizing
for col=1,#cols do
local child = t[(row - 1) * #cols + col]
if child then
local colObj = cols[colStart[child]]
local cellObj = child:GetUserData("cell")
local offsetV = GetCellDimension("V", laneV, 1, rowStart[child] - 1, spaceV) + (rowStart[child] == 1 and 0 or spaceV)
local cellV = GetCellDimension("V", laneV, rowStart[child], row, spaceV)
local f = child.frame
local childV = f:GetHeight() or 0
local alignFn, align = GetCellAlign("V", tableObj, colObj, cellObj, cellV, childV)
if child:IsFullHeight() or alignFn == "fill" then
f:SetHeight(cellV)
end
f:SetPoint("TOP", content, 0, -(offsetV + align))
end
end
end
-- Calculate total height
local totalV = GetCellDimension("V", laneV, 1, #laneV, spaceV)
-- Cleanup
for _,v in pairs(layoutCache) do wipe(v) end
safecall(obj.LayoutFinished, obj, nil, totalV)
obj:ResumeLayout()
end)
@@ -2,7 +2,7 @@
BlizOptionsGroup Container BlizOptionsGroup Container
Simple container widget for the integration of AceGUI into the Blizzard Interface Options Simple container widget for the integration of AceGUI into the Blizzard Interface Options
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "BlizOptionsGroup", 20 local Type, Version = "BlizOptionsGroup", 26
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -36,8 +36,12 @@ local function cancel(frame)
frame.obj:Fire("cancel") frame.obj:Fire("cancel")
end end
local function defaults(frame) local function default(frame)
frame.obj:Fire("defaults") frame.obj:Fire("default")
end
local function refresh(frame)
frame.obj:Fire("refresh")
end end
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
@@ -95,13 +99,23 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame") -- CoA-compat: InterfaceOptionsFramePanelContainer is a global from the stock 3.3.5
-- Interface Options frame; on the CoA reworked FrameXML it can be nil at the time
-- AceGUI widgets are constructed. Fall back to UIParent so CreateFrame doesn't blow up.
local _parent = InterfaceOptionsFramePanelContainer or UIParent
local frame = CreateFrame("Frame", nil, _parent)
frame:Hide() frame:Hide()
-- support functions for the Blizzard Interface Options -- support functions for the Blizzard Interface Options
frame.okay = okay frame.okay = okay
frame.cancel = cancel frame.cancel = cancel
frame.defaults = defaults frame.default = default
frame.refresh = refresh
-- 10.0 support function aliases (cancel has been removed)
frame.OnCommit = okay
frame.OnDefault = default
frame.OnRefresh = refresh
frame:SetScript("OnHide", OnHide) frame:SetScript("OnHide", OnHide)
frame:SetScript("OnShow", OnShow) frame:SetScript("OnShow", OnShow)
@@ -1,4 +1,10 @@
local AceGUI = LibStub("AceGUI-3.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 -- Lua APIs
local assert, pairs, type = assert, pairs, type local assert, pairs, type = assert, pairs, type
@@ -6,83 +12,61 @@ local assert, pairs, type = assert, pairs, type
-- WoW APIs -- WoW APIs
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
--[[ --[[-----------------------------------------------------------------------------
Selection Group controls all have an interface to select a group for thier contents Scripts
None of them will auto size to thier contents, and should usually be used with a scrollframe -------------------------------------------------------------------------------]]
unless you know that the controls will fit inside 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
-------------------------- --[[-----------------------------------------------------------------------------
-- Dropdown Group -- Methods
-------------------------- -------------------------------------------------------------------------------]]
--[[ local methods = {
Events : ["OnAcquire"] = function(self)
OnGroupSelected
]]
do
local Type = "DropdownGroup"
local Version = 13
local function OnAcquire(self)
self.dropdown:SetText("") self.dropdown:SetText("")
self:SetDropdownWidth(200) self:SetDropdownWidth(200)
self:SetTitle("") self:SetTitle("")
end end,
local function OnRelease(self) ["OnRelease"] = function(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.dropdown.list = nil self.dropdown.list = nil
self.status = nil self.status = nil
for k in pairs(self.localstatus) do for k in pairs(self.localstatus) do
self.localstatus[k] = nil self.localstatus[k] = nil
end end
end end,
local PaneBackdrop = { ["SetTitle"] = function(self, title)
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 SetTitle(self,title)
self.titletext:SetText(title) self.titletext:SetText(title)
self.dropdown.frame:ClearAllPoints() self.dropdown.frame:ClearAllPoints()
if title and title ~= "" then if title and title ~= "" then
self.dropdown.frame:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -2, 0) self.dropdown.frame:SetPoint("TOPRIGHT", -2, 0)
else else
self.dropdown.frame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", -1, 0) self.dropdown.frame:SetPoint("TOPLEFT", -1, 0)
end end
end end,
["SetGroupList"] = function(self,list,order)
self.dropdown:SetList(list,order)
end,
local function SelectedGroup(self,event,value) ["SetStatusTable"] = function(self, status)
local group = self.parentgroup
local status = group.status or group.localstatus
status.selected = value
self.parentgroup:Fire("OnGroupSelected", value)
end
local function SetGroupList(self,list)
self.dropdown:SetList(list)
end
-- called to set an external table to store status in
local function SetStatusTable(self, status)
assert(type(status) == "table") assert(type(status) == "table")
self.status = status self.status = status
end end,
local function SetGroup(self,group) ["SetGroup"] = function(self,group)
self.dropdown:SetValue(group) self.dropdown:SetValue(group)
local status = self.status or self.localstatus local status = self.status or self.localstatus
status.selected = group status.selected = group
self:Fire("OnGroupSelected", group) self:Fire("OnGroupSelected", group)
end end,
local function OnWidthSet(self, width) ["OnWidthSet"] = function(self, width)
local content = self.content local content = self.content
local contentwidth = width - 26 local contentwidth = width - 26
if contentwidth < 0 then if contentwidth < 0 then
@@ -90,10 +74,9 @@ do
end end
content:SetWidth(contentwidth) content:SetWidth(contentwidth)
content.width = contentwidth content.width = contentwidth
end end,
["OnHeightSet"] = function(self, height)
local function OnHeightSet(self, height)
local content = self.content local content = self.content
local contentheight = height - 63 local contentheight = height - 63
if contentheight < 0 then if contentheight < 0 then
@@ -101,78 +84,74 @@ do
end end
content:SetHeight(contentheight) content:SetHeight(contentheight)
content.height = contentheight content.height = contentheight
end end,
local function LayoutFinished(self, width, height) ["LayoutFinished"] = function(self, width, height)
self:SetHeight((height or 0) + 63) self:SetHeight((height or 0) + 63)
end end,
local function SetDropdownWidth(self, width) ["SetDropdownWidth"] = function(self, width)
self.dropdown:SetWidth(width) self.dropdown:SetWidth(width)
end end
}
local function Constructor() --[[-----------------------------------------------------------------------------
local frame = CreateFrame("Frame") Constructor
local self = {} -------------------------------------------------------------------------------]]
self.type = Type 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 }
}
self.OnRelease = OnRelease local function Constructor()
self.OnAcquire = OnAcquire local frame = CreateFrame("Frame")
frame:SetHeight(100)
frame:SetWidth(100)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
self.SetTitle = SetTitle local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
self.SetGroupList = SetGroupList titletext:SetPoint("TOPLEFT", 4, -5)
self.SetGroup = SetGroup titletext:SetPoint("TOPRIGHT", -4, -5)
self.SetStatusTable = SetStatusTable titletext:SetJustifyH("LEFT")
self.SetDropdownWidth = SetDropdownWidth titletext:SetHeight(18)
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
self.LayoutFinished = LayoutFinished
self.localstatus = {} 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("")
self.frame = frame local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
frame.obj = self 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)
frame:SetHeight(100) --Container Support
frame:SetWidth(100) local content = CreateFrame("Frame", nil, border)
frame:SetFrameStrata("FULLSCREEN_DIALOG") content:SetPoint("TOPLEFT", 10, -10)
content:SetPoint("BOTTOMRIGHT", -10, 10)
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") local widget = {
titletext:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -5) frame = frame,
titletext:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -4, -5) localstatus = {},
titletext:SetJustifyH("LEFT") titletext = titletext,
titletext:SetHeight(18) dropdown = dropdown,
self.titletext = titletext border = border,
content = content,
local dropdown = AceGUI:Create("Dropdown") type = Type
self.dropdown = dropdown }
dropdown.frame:SetParent(frame) for method, func in pairs(methods) do
dropdown.frame:SetFrameLevel(dropdown.frame:GetFrameLevel() + 2) widget[method] = func
dropdown.parentgroup = self
dropdown:SetCallback("OnValueChanged",SelectedGroup)
dropdown.frame:SetPoint("TOPLEFT",frame,"TOPLEFT", -1, 0)
dropdown.frame:Show()
dropdown:SetLabel("")
local border = CreateFrame("Frame",nil,frame)
self.border = border
border:SetPoint("TOPLEFT",frame,"TOPLEFT",0,-26)
border:SetPoint("BOTTOMRIGHT",frame,"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)
self.content = content
content.obj = self
content:SetPoint("TOPLEFT",border,"TOPLEFT",10,-10)
content:SetPoint("BOTTOMRIGHT",border,"BOTTOMRIGHT",-10,10)
AceGUI:RegisterAsContainer(self)
return self
end end
dropdown.parentgroup = widget
AceGUI:RegisterWidgetType(Type,Constructor,Version) return AceGUI:RegisterAsContainer(widget)
end end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Frame Container Frame Container
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Frame", 20 local Type, Version = "Frame", 30
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -13,18 +13,18 @@ local wipe = table.wipe
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 Scripts
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Button_OnClick(frame) local function Button_OnClick(frame)
PlaySound("gsTitleOptionExit") PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
frame.obj:Hide() frame.obj:Hide()
end end
local function Frame_OnShow(frame)
frame.obj:Fire("OnShow")
end
local function Frame_OnClose(frame) local function Frame_OnClose(frame)
frame.obj:Fire("OnClose") frame.obj:Fire("OnClose")
end end
@@ -64,6 +64,14 @@ local function SizerE_OnMouseDown(frame)
AceGUI:ClearFocus() AceGUI:ClearFocus()
end end
local function StatusBar_OnEnter(frame)
frame.obj:Fire("OnEnterStatusBar")
end
local function StatusBar_OnLeave(frame)
frame.obj:Fire("OnLeaveStatusBar")
end
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Methods Methods
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -71,10 +79,12 @@ local methods = {
["OnAcquire"] = function(self) ["OnAcquire"] = function(self)
self.frame:SetParent(UIParent) self.frame:SetParent(UIParent)
self.frame:SetFrameStrata("FULLSCREEN_DIALOG") self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
self.frame:SetFrameLevel(100) -- Lots of room to draw under it
self:SetTitle() self:SetTitle()
self:SetStatusText() self:SetStatusText()
self:ApplyStatus() self:ApplyStatus()
self:Show() self:Show()
self:EnableResize(true)
end, end,
["OnRelease"] = function(self) ["OnRelease"] = function(self)
@@ -104,6 +114,7 @@ local methods = {
["SetTitle"] = function(self, title) ["SetTitle"] = function(self, title)
self.titletext:SetText(title) self.titletext:SetText(title)
self.titlebg:SetWidth((self.titletext:GetWidth() or 0) + 10)
end, end,
["SetStatusText"] = function(self, text) ["SetStatusText"] = function(self, text)
@@ -118,6 +129,13 @@ local methods = {
self.frame:Show() self.frame:Show()
end, 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 -- called to set an external table to store status in
["SetStatusTable"] = function(self, status) ["SetStatusTable"] = function(self, status)
assert(type(status) == "table") assert(type(status) == "table")
@@ -158,17 +176,23 @@ local PaneBackdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
frame:Hide() frame:Hide()
frame:EnableMouse(true) frame:EnableMouse(true)
frame:SetMovable(true) frame:SetMovable(true)
frame:SetResizable(true) frame:SetResizable(true)
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetFrameLevel(100) -- Lots of room to draw under it
frame:SetBackdrop(FrameBackdrop) frame:SetBackdrop(FrameBackdrop)
frame:SetBackdropColor(0, 0, 0, 1) frame:SetBackdropColor(0, 0, 0, 1)
frame:SetMinResize(400, 200) if frame.SetResizeBounds then -- WoW 10.0
frame:SetResizeBounds(400, 200)
else
frame:SetMinResize(400, 200)
end
frame:SetToplevel(true) frame:SetToplevel(true)
frame:SetScript("OnShow", Frame_OnShow)
frame:SetScript("OnHide", Frame_OnClose) frame:SetScript("OnHide", Frame_OnClose)
frame:SetScript("OnMouseDown", Frame_OnMouseDown) frame:SetScript("OnMouseDown", Frame_OnMouseDown)
@@ -179,13 +203,15 @@ local function Constructor()
closebutton:SetWidth(100) closebutton:SetWidth(100)
closebutton:SetText(CLOSE) closebutton:SetText(CLOSE)
local statusbg = CreateFrame("Frame", nil, frame) local statusbg = CreateFrame("Button", nil, frame, "BackdropTemplate")
statusbg:SetPoint("BOTTOMLEFT", 15, 15) statusbg:SetPoint("BOTTOMLEFT", 15, 15)
statusbg:SetPoint("BOTTOMRIGHT", -132, 15) statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
statusbg:SetHeight(24) statusbg:SetHeight(24)
statusbg:SetBackdrop(PaneBackdrop) statusbg:SetBackdrop(PaneBackdrop)
statusbg:SetBackdropColor(0.1,0.1,0.1) statusbg:SetBackdropColor(0.1,0.1,0.1)
statusbg:SetBackdropBorderColor(0.4,0.4,0.4) 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") local statustext = statusbg:CreateFontString(nil, "OVERLAY", "GameFontNormal")
statustext:SetPoint("TOPLEFT", 7, -2) statustext:SetPoint("TOPLEFT", 7, -2)
@@ -245,7 +271,7 @@ local function Constructor()
line2:SetHeight(8) line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8) line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
local x = 0.1 * 8/17 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) 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) local sizer_s = CreateFrame("Frame", nil, frame)
@@ -273,6 +299,10 @@ local function Constructor()
localstatus = {}, localstatus = {},
titletext = titletext, titletext = titletext,
statustext = statustext, statustext = statustext,
titlebg = titlebg,
sizer_se = sizer_se,
sizer_s = sizer_s,
sizer_e = sizer_e,
content = content, content = content,
frame = frame, frame = frame,
type = Type type = Type
@@ -280,7 +310,7 @@ local function Constructor()
for method, func in pairs(methods) do for method, func in pairs(methods) do
widget[method] = func widget[method] = func
end end
closebutton.obj = widget closebutton.obj, statusbg.obj = widget, widget
return AceGUI:RegisterAsContainer(widget) return AceGUI:RegisterAsContainer(widget)
end end
@@ -1,72 +1,40 @@
local AceGUI = LibStub("AceGUI-3.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 -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
------------- --[[-----------------------------------------------------------------------------
-- Widgets -- Methods
------------- -------------------------------------------------------------------------------]]
--[[ local methods = {
Widgets must provide the following functions ["OnAcquire"] = function(self)
Acquire() - Called when the object is aquired, should set everything to a default hidden state
Release() - Called when the object is Released, should remove any anchors and hide the Widget
And the following members
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes
type - the type of the object, same as the name given to :RegisterWidget()
Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet
It will be cleared automatically when a widget is released
Placing values directly into a widget object should be avoided
If the Widget can act as a container for other Widgets the following
content - frame or derivitive that children will be anchored to
The Widget can supply the following Optional Members
]]
--------------------------
-- Inline Group --
--------------------------
--[[
This is a simple grouping container, no selection
It will resize automatically to the height of the controls added to it
]]
do
local Type = "InlineGroup"
local Version = 6
local function OnAcquire(self)
self:SetWidth(300) self:SetWidth(300)
self:SetHeight(100) self:SetHeight(100)
end self:SetTitle("")
end,
local function OnRelease(self) -- ["OnRelease"] = nil,
self.frame:ClearAllPoints()
self.frame:Hide()
end
local PaneBackdrop = { ["SetTitle"] = function(self,title)
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 SetTitle(self,title)
self.titletext:SetText(title) self.titletext:SetText(title)
end end,
local function LayoutFinished(self, width, height) ["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end if self.noAutoHeight then return end
self:SetHeight((height or 0) + 40) self:SetHeight((height or 0) + 40)
end end,
local function OnWidthSet(self, width) ["OnWidthSet"] = function(self, width)
local content = self.content local content = self.content
local contentwidth = width - 20 local contentwidth = width - 20
if contentwidth < 0 then if contentwidth < 0 then
@@ -74,10 +42,9 @@ do
end end
content:SetWidth(contentwidth) content:SetWidth(contentwidth)
content.width = contentwidth content.width = contentwidth
end end,
["OnHeightSet"] = function(self, height)
local function OnHeightSet(self, height)
local content = self.content local content = self.content
local contentheight = height - 20 local contentheight = height - 20
if contentheight < 0 then if contentheight < 0 then
@@ -86,53 +53,51 @@ do
content:SetHeight(contentheight) content:SetHeight(contentheight)
content.height = contentheight content.height = contentheight
end end
}
local function Constructor() --[[-----------------------------------------------------------------------------
local frame = CreateFrame("Frame",nil,UIParent) Constructor
local self = {} -------------------------------------------------------------------------------]]
self.type = Type 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 }
}
self.OnRelease = OnRelease local function Constructor()
self.OnAcquire = OnAcquire local frame = CreateFrame("Frame", nil, UIParent)
self.SetTitle = SetTitle frame:SetFrameStrata("FULLSCREEN_DIALOG")
self.frame = frame
self.LayoutFinished = LayoutFinished
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
frame.obj = self local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titletext:SetPoint("TOPLEFT", 14, 0)
titletext:SetPoint("TOPRIGHT", -14, 0)
titletext:SetJustifyH("LEFT")
titletext:SetHeight(18)
frame:SetHeight(100) local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
frame:SetWidth(100) border:SetPoint("TOPLEFT", 0, -17)
frame:SetFrameStrata("FULLSCREEN_DIALOG") 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 titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal") --Container Support
titletext:SetPoint("TOPLEFT",frame,"TOPLEFT",14,0) local content = CreateFrame("Frame", nil, border)
titletext:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-14,0) content:SetPoint("TOPLEFT", 10, -10)
titletext:SetJustifyH("LEFT") content:SetPoint("BOTTOMRIGHT", -10, 10)
titletext:SetHeight(18)
self.titletext = titletext local widget = {
frame = frame,
local border = CreateFrame("Frame",nil,frame) content = content,
self.border = border titletext = titletext,
border:SetPoint("TOPLEFT",frame,"TOPLEFT",0,-17) type = Type
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-1,3) }
for method, func in pairs(methods) do
border:SetBackdrop(PaneBackdrop) widget[method] = func
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)
self.content = content
content.obj = self
content:SetPoint("TOPLEFT",border,"TOPLEFT",10,-10)
content:SetPoint("BOTTOMRIGHT",border,"BOTTOMRIGHT",-10,10)
AceGUI:RegisterAsContainer(self)
return self
end end
AceGUI:RegisterWidgetType(Type,Constructor,Version) return AceGUI:RegisterAsContainer(widget)
end end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,4 +1,10 @@
local AceGUI = LibStub("AceGUI-3.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 -- Lua APIs
local pairs, assert, type = pairs, assert, type local pairs, assert, type = pairs, assert, type
@@ -7,59 +13,50 @@ local min, max, floor = math.min, math.max, math.floor
-- WoW APIs -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function FixScrollOnUpdate(frame)
frame:SetScript("OnUpdate", nil)
frame.obj:FixScroll()
end
------------- --[[-----------------------------------------------------------------------------
-- Widgets -- Scripts
------------- -------------------------------------------------------------------------------]]
--[[ local function ScrollFrame_OnMouseWheel(frame, value)
Widgets must provide the following functions frame.obj:MoveScroll(value)
Acquire() - Called when the object is aquired, should set everything to a default hidden state end
Release() - Called when the object is Released, should remove any anchors and hide the Widget
And the following members local function ScrollFrame_OnSizeChanged(frame)
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes frame:SetScript("OnUpdate", FixScrollOnUpdate)
type - the type of the object, same as the name given to :RegisterWidget() end
Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet local function ScrollBar_OnScrollValueChanged(frame, value)
It will be cleared automatically when a widget is released frame.obj:SetScroll(value)
Placing values directly into a widget object should be avoided end
If the Widget can act as a container for other Widgets the following --[[-----------------------------------------------------------------------------
content - frame or derivitive that children will be anchored to Methods
-------------------------------------------------------------------------------]]
The Widget can supply the following Optional Members local methods = {
["OnAcquire"] = function(self)
]]
--------------------------
-- Scroll Frame --
--------------------------
do
local Type = "ScrollFrame"
local Version = 9
local function OnAcquire(self)
end
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.status = nil
-- do SetScroll after niling status, but before clearing localstatus
-- so the scroll value isnt populated back into status, but not kept in localstatus either
self:SetScroll(0) self:SetScroll(0)
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
end,
["OnRelease"] = function(self)
self.status = nil
for k in pairs(self.localstatus) do for k in pairs(self.localstatus) do
self.localstatus[k] = nil self.localstatus[k] = nil
end end
self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",0,0) self.scrollframe:SetPoint("BOTTOMRIGHT")
self.scrollbar:Hide() self.scrollbar:Hide()
self.scrollBarShown = nil self.scrollBarShown = nil
self.content.height, self.content.width = nil, nil self.content.height, self.content.width, self.content.original_width = nil, nil, nil
end end,
local function SetScroll(self, value) ["SetScroll"] = function(self, value)
local status = self.status or self.localstatus local status = self.status or self.localstatus
local viewheight = self.scrollframe:GetHeight() local viewheight = self.scrollframe:GetHeight()
local height = self.content:GetHeight() local height = self.content:GetHeight()
@@ -71,20 +68,17 @@ do
offset = floor((height - viewheight) / 1000.0 * value) offset = floor((height - viewheight) / 1000.0 * value)
end end
self.content:ClearAllPoints() self.content:ClearAllPoints()
self.content:SetPoint("TOPLEFT", self.scrollframe, "TOPLEFT", 0, offset) self.content:SetPoint("TOPLEFT", 0, offset)
self.content:SetPoint("TOPRIGHT", self.scrollframe, "TOPRIGHT", 0, offset) self.content:SetPoint("TOPRIGHT", 0, offset)
status.offset = offset status.offset = offset
status.scrollvalue = value status.scrollvalue = value
end end,
local function MoveScroll(self, value) ["MoveScroll"] = function(self, value)
local status = self.status or self.localstatus local status = self.status or self.localstatus
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
if height > viewheight then if self.scrollBarShown then
self.scrollbar:Hide()
else
self.scrollbar:Show()
local diff = height - viewheight local diff = height - viewheight
local delta = 1 local delta = 1
if value < 0 then if value < 0 then
@@ -92,29 +86,35 @@ do
end end
self.scrollbar:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000)) self.scrollbar:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
end end
end end,
["FixScroll"] = function(self)
local function FixScroll(self)
if self.updateLock then return end if self.updateLock then return end
self.updateLock = true self.updateLock = true
local status = self.status or self.localstatus local status = self.status or self.localstatus
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
local offset = status.offset or 0 local offset = status.offset or 0
local curvalue = self.scrollbar:GetValue() -- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys
if viewheight < height then -- No-one is going to miss 2 pixels at the bottom of the frame, anyhow!
if viewheight < height + 2 then
if self.scrollBarShown then if self.scrollBarShown then
self.scrollBarShown = nil self.scrollBarShown = nil
self.scrollbar:Hide() self.scrollbar:Hide()
self.scrollbar:SetValue(0) self.scrollbar:SetValue(0)
self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",0,0) self.scrollframe:SetPoint("BOTTOMRIGHT")
if self.content.original_width then
self.content.width = self.content.original_width
end
self:DoLayout() self:DoLayout()
end end
else else
if not self.scrollBarShown then if not self.scrollBarShown then
self.scrollBarShown = true self.scrollBarShown = true
self.scrollbar:Show() self.scrollbar:Show()
self.scrollframe:SetPoint("BOTTOMRIGHT", self.frame,"BOTTOMRIGHT",-20,0) self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0)
if self.content.original_width then
self.content.width = self.content.original_width - 20
end
self:DoLayout() self:DoLayout()
end end
local value = (offset / (viewheight - height) * 1000) local value = (offset / (viewheight - height) * 1000)
@@ -123,119 +123,93 @@ do
self:SetScroll(value) self:SetScroll(value)
if value < 1000 then if value < 1000 then
self.content:ClearAllPoints() self.content:ClearAllPoints()
self.content:SetPoint("TOPLEFT", self.scrollframe, "TOPLEFT", 0, offset) self.content:SetPoint("TOPLEFT", 0, offset)
self.content:SetPoint("TOPRIGHT", self.scrollframe, "TOPRIGHT", 0, offset) self.content:SetPoint("TOPRIGHT", 0, offset)
status.offset = offset status.offset = offset
end end
end end
self.updateLock = nil self.updateLock = nil
end end,
local function OnMouseWheel(this, value) ["LayoutFinished"] = function(self, width, height)
this.obj:MoveScroll(value)
end
local function OnScrollValueChanged(this, value)
this.obj:SetScroll(value)
end
local function FixScrollOnUpdate(this)
this:SetScript("OnUpdate", nil)
this.obj:FixScroll()
end
local function OnSizeChanged(this)
this:SetScript("OnUpdate", FixScrollOnUpdate)
end
local function LayoutFinished(self, width, height)
self.content:SetHeight(height or 0 + 20) self.content:SetHeight(height or 0 + 20)
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
end
-- called to set an external table to store status in -- update the scrollframe
local function SetStatusTable(self, status) self:FixScroll()
-- schedule another update when everything has "settled"
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate)
end,
["SetStatusTable"] = function(self, status)
assert(type(status) == "table") assert(type(status) == "table")
self.status = status self.status = status
if not status.scrollvalue then if not status.scrollvalue then
status.scrollvalue = 0 status.scrollvalue = 0
end end
end end,
local function OnWidthSet(self, width) ["OnWidthSet"] = function(self, width)
local content = self.content local content = self.content
content.width = width content.width = width - (self.scrollBarShown and 20 or 0)
end content.original_width = width
end,
["OnHeightSet"] = function(self, height)
local function OnHeightSet(self, height)
local content = self.content local content = self.content
content.height = height content.height = height
end end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
local num = AceGUI:GetNextWidgetNum(Type)
local function Constructor() local scrollframe = CreateFrame("ScrollFrame", nil, frame)
local frame = CreateFrame("Frame", nil, UIParent) scrollframe:SetPoint("TOPLEFT")
local self = {} scrollframe:SetPoint("BOTTOMRIGHT")
self.type = Type scrollframe:EnableMouseWheel(true)
scrollframe:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel)
scrollframe:SetScript("OnSizeChanged", ScrollFrame_OnSizeChanged)
self.OnRelease = OnRelease local scrollbar = CreateFrame("Slider", ("AceConfigDialogScrollFrame%dScrollBar"):format(num), scrollframe, "UIPanelScrollBarTemplate")
self.OnAcquire = OnAcquire 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)
self.MoveScroll = MoveScroll local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
self.FixScroll = FixScroll scrollbg:SetAllPoints(scrollbar)
self.SetScroll = SetScroll scrollbg:SetColorTexture(0, 0, 0, 0.4)
self.LayoutFinished = LayoutFinished
self.SetStatusTable = SetStatusTable
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
self.localstatus = {} --Container Support
self.frame = frame local content = CreateFrame("Frame", nil, scrollframe)
frame.obj = self content:SetPoint("TOPLEFT")
content:SetPoint("TOPRIGHT")
content:SetHeight(400)
scrollframe:SetScrollChild(content)
--Container Support local widget = {
local scrollframe = CreateFrame("ScrollFrame", nil, frame) localstatus = { scrollvalue = 0 },
scrollframe.obj = self scrollframe = scrollframe,
scrollframe:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, 0) scrollbar = scrollbar,
scrollframe:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 0, 0) content = content,
scrollframe:EnableMouseWheel(true) frame = frame,
scrollframe:SetScript("OnMouseWheel", OnMouseWheel) type = Type
scrollframe:SetScript("OnSizeChanged", OnSizeChanged) }
self.scrollframe = scrollframe for method, func in pairs(methods) do
widget[method] = func
local content = CreateFrame("Frame", nil, scrollframe)
content.obj = self
content:SetPoint("TOPLEFT", scrollframe, "TOPLEFT", 0, 0)
content:SetPoint("TOPRIGHT", scrollframe, "TOPRIGHT", 0, 0)
content:SetHeight(400)
self.content = content
scrollframe:SetScrollChild(content)
local num = AceGUI:GetNextWidgetNum(Type)
local name = ("AceConfigDialogScrollFrame%dScrollBar"):format(num)
local scrollbar = CreateFrame("Slider", name, scrollframe, "UIPanelScrollBarTemplate")
scrollbar.obj = self
scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, -16)
scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 4, 16)
scrollbar:SetScript("OnValueChanged", OnScrollValueChanged)
scrollbar:SetMinMaxValues(0, 1000)
scrollbar:SetValueStep(1)
scrollbar:SetValue(0)
scrollbar:SetWidth(16)
scrollbar:Hide()
self.scrollbar = scrollbar
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetTexture(0, 0, 0, 0.4)
self.localstatus.scrollvalue = 0
--self:FixScroll()
AceGUI:RegisterAsContainer(self)
--AceGUI:RegisterAsWidget(self)
return self
end end
scrollframe.obj, scrollbar.obj = widget, widget
AceGUI:RegisterWidgetType(Type,Constructor,Version) return AceGUI:RegisterAsContainer(widget)
end end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,99 +1,69 @@
local AceGUI = LibStub("AceGUI-3.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 -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
-------------
-- Widgets --
-------------
--[[
Widgets must provide the following functions
Acquire() - Called when the object is aquired, should set everything to a default hidden state
Release() - Called when the object is Released, should remove any anchors and hide the Widget
And the following members --[[-----------------------------------------------------------------------------
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes Methods
type - the type of the object, same as the name given to :RegisterWidget() -------------------------------------------------------------------------------]]
local methods = {
Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet ["OnAcquire"] = function(self)
It will be cleared automatically when a widget is released
Placing values directly into a widget object should be avoided
If the Widget can act as a container for other Widgets the following
content - frame or derivitive that children will be anchored to
The Widget can supply the following Optional Members
]]
--------------------------
-- Simple Group --
--------------------------
--[[
This is a simple grouping container, no selection, no borders
It will resize automatically to the height of the controls added to it
]]
do
local Type = "SimpleGroup"
local Version = 5
local function OnAcquire(self)
self:SetWidth(300) self:SetWidth(300)
self:SetHeight(100) self:SetHeight(100)
end end,
local function OnRelease(self) -- ["OnRelease"] = nil,
self.frame:ClearAllPoints()
self.frame:Hide()
end
local function LayoutFinished(self, width, height) ["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end if self.noAutoHeight then return end
self:SetHeight(height or 0) self:SetHeight(height or 0)
end end,
local function OnWidthSet(self, width) ["OnWidthSet"] = function(self, width)
local content = self.content local content = self.content
content:SetWidth(width) content:SetWidth(width)
content.width = width content.width = width
end end,
local function OnHeightSet(self, height) ["OnHeightSet"] = function(self, height)
local content = self.content local content = self.content
content:SetHeight(height) content:SetHeight(height)
content.height = height content.height = height
end end
}
local function Constructor() --[[-----------------------------------------------------------------------------
local frame = CreateFrame("Frame",nil,UIParent) Constructor
local self = {} -------------------------------------------------------------------------------]]
self.type = Type local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
self.OnRelease = OnRelease --Container Support
self.OnAcquire = OnAcquire local content = CreateFrame("Frame", nil, frame)
self.frame = frame content:SetPoint("TOPLEFT")
self.LayoutFinished = LayoutFinished content:SetPoint("BOTTOMRIGHT")
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
frame.obj = self local widget = {
frame = frame,
frame:SetHeight(100) content = content,
frame:SetWidth(100) type = Type
frame:SetFrameStrata("FULLSCREEN_DIALOG") }
for method, func in pairs(methods) do
--Container Support widget[method] = func
local content = CreateFrame("Frame",nil,frame)
self.content = content
content.obj = self
content:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
content:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0)
AceGUI:RegisterAsContainer(self)
return self
end end
AceGUI:RegisterWidgetType(Type,Constructor,Version) return AceGUI:RegisterAsContainer(widget)
end end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -1,63 +1,229 @@
local AceGUI = LibStub("AceGUI-3.0") --[[-----------------------------------------------------------------------------
TabGroup Container
Container that uses tabs on top to switch between groups.
-------------------------------------------------------------------------------]]
local Type, Version = "TabGroup", 38
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs -- Lua APIs
local pairs, ipairs, assert, type = pairs, ipairs, assert, type local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, table.wipe
-- WoW APIs -- WoW APIs
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- local upvalue storage used by BuildTabs
-- List them here for Mikk's FindGlobals script local widths = {}
-- GLOBALS: PanelTemplates_TabResize, PanelTemplates_SetDisabledTabState, PanelTemplates_SelectTab, PanelTemplates_DeselectTab local rowwidths = {}
local rowends = {}
------------- --[[-----------------------------------------------------------------------------
-- Widgets -- Support functions
------------- -------------------------------------------------------------------------------]]
--[[
Widgets must provide the following functions
Acquire() - Called when the object is aquired, should set everything to a default hidden state
Release() - Called when the object is Released, should remove any anchors and hide the Widget
And the following members local function PanelTemplates_TabResize(tab, padding, absoluteSize, minWidth, maxWidth, absoluteTextSize)
frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes local tabName = tab:GetName();
type - the type of the object, same as the name given to :RegisterWidget()
Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet local buttonMiddle = tab.Middle or tab.middleTexture or _G[tabName.."Middle"];
It will be cleared automatically when a widget is released local buttonMiddleDisabled = tab.MiddleDisabled or (tabName and _G[tabName.."MiddleDisabled"]);
Placing values directly into a widget object should be avoided local left = tab.Left or tab.leftTexture or _G[tabName.."Left"];
local sideWidths = 2 * left:GetWidth();
If the Widget can act as a container for other Widgets the following local tabText = tab.Text or _G[tab:GetName().."Text"];
content - frame or derivitive that children will be anchored to local highlightTexture = tab.HighlightTexture or (tabName and _G[tabName.."HighlightTexture"]);
The Widget can supply the following Optional Members
]]
--------------------------
-- Tab Group --
--------------------------
do
local Type = "TabGroup"
local Version = 25
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 OnAcquire(self)
local width, tabWidth;
local textWidth;
if ( absoluteTextSize ) then
textWidth = absoluteTextSize;
else
tabText:SetWidth(0);
textWidth = tabText:GetWidth();
end
-- If there's an absolute size specified then use it
if ( absoluteSize ) then
if ( absoluteSize < sideWidths) then
width = 1;
tabWidth = sideWidths
else
width = absoluteSize - sideWidths;
tabWidth = absoluteSize
end
tabText:SetWidth(width);
else
-- Otherwise try to use padding
if ( padding ) then
width = textWidth + padding;
else
width = textWidth + 24;
end
-- If greater than the maxWidth then cap it
if ( maxWidth and width > maxWidth ) then
if ( padding ) then
width = maxWidth + padding;
else
width = maxWidth + 24;
end
tabText:SetWidth(width);
else
tabText:SetWidth(0);
end
if (minWidth and width < minWidth) then
width = minWidth;
end
tabWidth = width + sideWidths;
end end
local function OnRelease(self) if ( buttonMiddle ) then
self.frame:ClearAllPoints() buttonMiddle:SetWidth(width);
self.frame:Hide() end
if ( buttonMiddleDisabled ) then
buttonMiddleDisabled:SetWidth(width);
end
tab:SetWidth(tabWidth);
if ( highlightTexture ) then
highlightTexture:SetWidth(tabWidth);
end
end
local function PanelTemplates_DeselectTab(tab)
local name = tab:GetName();
local left = tab.Left or _G[name.."Left"];
local middle = tab.Middle or _G[name.."Middle"];
local right = tab.Right or _G[name.."Right"];
left:Show();
middle:Show();
right:Show();
--tab:UnlockHighlight();
tab:Enable();
local text = tab.Text or _G[name.."Text"];
text:SetPoint("CENTER", tab, "CENTER", (tab.deselectedTextX or 0), (tab.deselectedTextY or 2));
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
leftDisabled:Hide();
middleDisabled:Hide();
rightDisabled:Hide();
end
local function PanelTemplates_SelectTab(tab)
local name = tab:GetName();
local left = tab.Left or _G[name.."Left"];
local middle = tab.Middle or _G[name.."Middle"];
local right = tab.Right or _G[name.."Right"];
left:Hide();
middle:Hide();
right:Hide();
--tab:LockHighlight();
tab:Disable();
tab:SetDisabledFontObject(GameFontHighlightSmall);
local text = tab.Text or _G[name.."Text"];
text:SetPoint("CENTER", tab, "CENTER", (tab.selectedTextX or 0), (tab.selectedTextY or -3));
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
leftDisabled:Show();
middleDisabled:Show();
rightDisabled:Show();
if GameTooltip:IsOwned(tab) then
GameTooltip:Hide();
end
end
local function PanelTemplates_SetDisabledTabState(tab)
local name = tab:GetName();
local left = tab.Left or _G[name.."Left"];
local middle = tab.Middle or _G[name.."Middle"];
local right = tab.Right or _G[name.."Right"];
left:Show();
middle:Show();
right:Show();
--tab:UnlockHighlight();
tab:Disable();
tab.text = tab:GetText();
-- Gray out text
tab:SetDisabledFontObject(GameFontDisableSmall);
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
leftDisabled:Hide();
middleDisabled:Hide();
rightDisabled:Hide();
end
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 self.status = nil
for k in pairs(self.localstatus) do for k in pairs(self.localstatus) do
self.localstatus[k] = nil self.localstatus[k] = nil
@@ -66,70 +232,75 @@ do
for _, tab in pairs(self.tabs) do for _, tab in pairs(self.tabs) do
tab:Hide() tab:Hide()
end end
self:SetTitle() end,
end
local function Tab_SetText(self, text) ["CreateTab"] = function(self, id)
self:_SetText(text) local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id)
local width = self.obj.frame.width or self.obj.frame:GetWidth() or 0 local tab = CreateFrame("Button", tabname, self.border)
PanelTemplates_TabResize(self, 0, nil, width) tab:SetSize(115, 24)
end tab.deselectedTextY = -3
tab.selectedTextY = -2
local function UpdateTabLook(self) tab.LeftDisabled = tab:CreateTexture(tabname .. "LeftDisabled", "BORDER")
if self.disabled then tab.LeftDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
PanelTemplates_SetDisabledTabState(self) tab.LeftDisabled:SetSize(20, 24)
elseif self.selected then tab.LeftDisabled:SetPoint("BOTTOMLEFT", 0, -3)
PanelTemplates_SelectTab(self) tab.LeftDisabled:SetTexCoord(0, 0.15625, 0, 1.0)
else
PanelTemplates_DeselectTab(self)
end
end
local function Tab_SetSelected(self, selected) tab.MiddleDisabled = tab:CreateTexture(tabname .. "MiddleDisabled", "BORDER")
self.selected = selected tab.MiddleDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
UpdateTabLook(self) tab.MiddleDisabled:SetSize(88, 24)
end tab.MiddleDisabled:SetPoint("LEFT", tab.LeftDisabled, "RIGHT")
tab.MiddleDisabled:SetTexCoord(0.15625, 0.84375, 0, 1.0)
local function Tab_OnClick(self) tab.RightDisabled = tab:CreateTexture(tabname .. "RightDisabled", "BORDER")
if not (self.selected or self.disabled) then tab.RightDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
PlaySound("igCharacterInfoTab") tab.RightDisabled:SetSize(20, 24)
self.obj:SelectTab(self.value) tab.RightDisabled:SetPoint("LEFT", tab.MiddleDisabled, "RIGHT")
end tab.RightDisabled:SetTexCoord(0.84375, 1.0, 0, 1.0)
end
local function Tab_SetDisabled(self, disabled) tab.Left = tab:CreateTexture(tabname .. "Left", "BORDER")
self.disabled = disabled tab.Left:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
UpdateTabLook(self) tab.Left:SetSize(20, 24)
end tab.Left:SetPoint("TOPLEFT")
tab.Left:SetTexCoord(0, 0.15625, 0, 1.0)
local function Tab_OnEnter(this) tab.Middle = tab:CreateTexture(tabname .. "Middle", "BORDER")
local self = this.obj tab.Middle:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
self:Fire("OnTabEnter", self.tabs[this.id].value, this) tab.Middle:SetSize(88, 24)
end tab.Middle:SetPoint("LEFT", tab.Left, "RIGHT")
tab.Middle:SetTexCoord(0.15625, 0.84375, 0, 1.0)
local function Tab_OnLeave(this) tab.Right = tab:CreateTexture(tabname .. "Right", "BORDER")
local self = this.obj tab.Right:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
self:Fire("OnTabLeave", self.tabs[this.id].value, this) tab.Right:SetSize(20, 24)
end tab.Right:SetPoint("LEFT", tab.Middle, "RIGHT")
tab.Right:SetTexCoord(0.84375, 1.0, 0, 1.0)
local function Tab_OnShow(this) tab.Text = tab:CreateFontString(tabname .. "Text")
_G[this:GetName().."HighlightTexture"]:SetWidth(this:GetTextWidth() + 30) tab:SetFontString(tab.Text)
end
tab:SetNormalFontObject(GameFontNormalSmall)
tab:SetHighlightFontObject(GameFontHighlightSmall)
tab:SetDisabledFontObject(GameFontHighlightSmall)
tab:SetHighlightTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight", "ADD")
tab.HighlightTexture = tab:GetHighlightTexture()
tab.HighlightTexture:ClearAllPoints()
tab.HighlightTexture:SetPoint("LEFT", tab, "LEFT", 10, -4)
tab.HighlightTexture:SetPoint("RIGHT", tab, "RIGHT", -10, -4)
_G[tabname .. "HighlightTexture"] = tab.HighlightTexture
local function CreateTab(self, id)
local tabname = "AceGUITabGroup"..self.num.."Tab"..id
local tab = CreateFrame("Button",tabname,self.border,"OptionsFrameTabButtonTemplate")
tab.obj = self tab.obj = self
tab.id = id tab.id = id
tab.text = _G[tabname .. "Text"] tab.text = tab.Text -- compat
tab.text:ClearAllPoints() tab.text:ClearAllPoints()
tab.text:SetPoint("LEFT", tab, "LEFT", 14, -3) tab.text:SetPoint("LEFT", 14, -3)
tab.text:SetPoint("RIGHT", tab, "RIGHT", -12, -3) tab.text:SetPoint("RIGHT", -12, -3)
tab:SetScript("OnClick",Tab_OnClick) tab:SetScript("OnClick", Tab_OnClick)
tab:SetScript("OnEnter",Tab_OnEnter) tab:SetScript("OnEnter", Tab_OnEnter)
tab:SetScript("OnLeave",Tab_OnLeave) tab:SetScript("OnLeave", Tab_OnLeave)
tab:SetScript("OnShow", Tab_OnShow) tab:SetScript("OnShow", Tab_OnShow)
tab._SetText = tab.SetText tab._SetText = tab.SetText
@@ -138,9 +309,9 @@ do
tab.SetDisabled = Tab_SetDisabled tab.SetDisabled = Tab_SetDisabled
return tab return tab
end end,
local function SetTitle(self, text) ["SetTitle"] = function(self, text)
self.titletext:SetText(text or "") self.titletext:SetText(text or "")
if text and text ~= "" then if text and text ~= "" then
self.alignoffset = 25 self.alignoffset = 25
@@ -148,17 +319,15 @@ do
self.alignoffset = 18 self.alignoffset = 18
end end
self:BuildTabs() self:BuildTabs()
end end,
-- called to set an external table to store status in ["SetStatusTable"] = function(self, status)
local function SetStatusTable(self, status)
assert(type(status) == "table") assert(type(status) == "table")
self.status = status self.status = status
end end,
local function SelectTab(self, value) ["SelectTab"] = function(self, value)
local status = self.status or self.localstatus local status = self.status or self.localstatus
local found local found
for i, v in ipairs(self.tabs) do for i, v in ipairs(self.tabs) do
if v.value == value then if v.value == value then
@@ -172,20 +341,16 @@ do
if found then if found then
self:Fire("OnGroupSelected",value) self:Fire("OnGroupSelected",value)
end end
end end,
local function SetTabs(self, tabs) ["SetTabs"] = function(self, tabs)
self.tablist = tabs self.tablist = tabs
self:BuildTabs() self:BuildTabs()
end end,
local widths = {} ["BuildTabs"] = function(self)
local rowwidths = {}
local rowends = {}
local function BuildTabs(self)
local hastitle = (self.titletext:GetText() and self.titletext:GetText() ~= "") local hastitle = (self.titletext:GetText() and self.titletext:GetText() ~= "")
local status = self.status or self.localstatus
local tablist = self.tablist local tablist = self.tablist
local tabs = self.tabs local tabs = self.tabs
@@ -193,15 +358,9 @@ do
local width = self.frame.width or self.frame:GetWidth() or 0 local width = self.frame.width or self.frame:GetWidth() or 0
for i = #widths, 1, -1 do wipe(widths)
widths[i] = nil wipe(rowwidths)
end wipe(rowends)
for i = #rowwidths, 1, -1 do
rowwidths[i] = nil
end
for i = #rowends, 1, -1 do
rowends[i] = nil
end
--Place Text into tabs and get thier initial width --Place Text into tabs and get thier initial width
for i, v in ipairs(tablist) do for i, v in ipairs(tablist) do
@@ -274,27 +433,24 @@ do
-- equal padding for each tab to fill the available width, -- equal padding for each tab to fill the available width,
-- if the used space is above 75% already -- 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 local padding = 0
if not (numrows == 1 and rowwidths[1] < width*0.75) then if not (numrows == 1 and rowwidths[1] < width*0.75 - 18) then
padding = (width - rowwidths[row]) / (endtab - starttab+1) padding = (width - rowwidths[row]) / (endtab - starttab+1)
end end
for i = starttab, endtab do for i = starttab, endtab do
PanelTemplates_TabResize(tabs[i], padding + 4, nil, width) PanelTemplates_TabResize(tabs[i], padding + 4, nil, nil, width, tabs[i]:GetFontString():GetStringWidth())
end end
starttab = endtab + 1 starttab = endtab + 1
end end
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20) self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)
self.border:SetPoint("TOPLEFT",self.frame,"TOPLEFT",1,-self.borderoffset) self.border:SetPoint("TOPLEFT", 1, -self.borderoffset)
end end,
local function BuildTabsOnUpdate(this) ["OnWidthSet"] = function(self, width)
BuildTabs(this.obj)
this:SetScript("OnUpdate", nil)
end
local function OnWidthSet(self, width)
local content = self.content local content = self.content
local contentwidth = width - 60 local contentwidth = width - 60
if contentwidth < 0 then if contentwidth < 0 then
@@ -302,12 +458,11 @@ do
end end
content:SetWidth(contentwidth) content:SetWidth(contentwidth)
content.width = contentwidth content.width = contentwidth
BuildTabs(self) self:BuildTabs(self)
self.frame:SetScript("OnUpdate", BuildTabsOnUpdate) self.frame:SetScript("OnUpdate", BuildTabsOnUpdate)
end end,
["OnHeightSet"] = function(self, height)
local function OnHeightSet(self, height)
local content = self.content local content = self.content
local contentheight = height - (self.borderoffset + 23) local contentheight = height - (self.borderoffset + 23)
if contentheight < 0 then if contentheight < 0 then
@@ -315,75 +470,66 @@ do
end end
content:SetHeight(contentheight) content:SetHeight(contentheight)
content.height = contentheight content.height = contentheight
end end,
local function LayoutFinished(self, width, height) ["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end if self.noAutoHeight then return end
self:SetHeight((height or 0) + (self.borderoffset + 23)) self:SetHeight((height or 0) + (self.borderoffset + 23))
end end
}
local function Constructor() --[[-----------------------------------------------------------------------------
local frame = CreateFrame("Frame",nil,UIParent) Constructor
local self = {} -------------------------------------------------------------------------------]]
self.type = Type 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 }
}
self.num = AceGUI:GetNextWidgetNum(Type) local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame",nil,UIParent)
frame:SetHeight(100)
frame:SetWidth(100)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
self.localstatus = {} 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("")
self.OnRelease = OnRelease local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
self.OnAcquire = OnAcquire border:SetPoint("TOPLEFT", 1, -27)
self.SetTitle = SetTitle border:SetPoint("BOTTOMRIGHT", -1, 3)
self.CreateTab = CreateTab border:SetBackdrop(PaneBackdrop)
self.SelectTab = SelectTab border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
self.BuildTabs = BuildTabs border:SetBackdropBorderColor(0.4, 0.4, 0.4)
self.SetStatusTable = SetStatusTable
self.SetTabs = SetTabs
self.LayoutFinished = LayoutFinished
self.frame = frame
self.OnWidthSet = OnWidthSet local content = CreateFrame("Frame", nil, border)
self.OnHeightSet = OnHeightSet content:SetPoint("TOPLEFT", 10, -7)
content:SetPoint("BOTTOMRIGHT", -10, 7)
frame.obj = self local widget = {
num = num,
frame:SetHeight(100) frame = frame,
frame:SetWidth(100) localstatus = {},
frame:SetFrameStrata("FULLSCREEN_DIALOG") alignoffset = 18,
titletext = titletext,
self.alignoffset = 18 border = border,
borderoffset = 27,
local titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal") tabs = {},
titletext:SetPoint("TOPLEFT",frame,"TOPLEFT",14,0) content = content,
titletext:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-14,0) type = Type
titletext:SetJustifyH("LEFT") }
titletext:SetHeight(18) for method, func in pairs(methods) do
titletext:SetText("") widget[method] = func
self.titletext = titletext
local border = CreateFrame("Frame",nil,frame)
self.border = border
self.borderoffset = 27
border:SetPoint("TOPLEFT",frame,"TOPLEFT",1,-27)
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-1,3)
border:SetBackdrop(PaneBackdrop)
border:SetBackdropColor(0.1,0.1,0.1,0.5)
border:SetBackdropBorderColor(0.4,0.4,0.4)
self.tabs = {}
--Container Support
local content = CreateFrame("Frame",nil,border)
self.content = content
content.obj = self
content:SetPoint("TOPLEFT",border,"TOPLEFT",10,-7)
content:SetPoint("BOTTOMRIGHT",border,"BOTTOMRIGHT",-10,7)
AceGUI:RegisterAsContainer(self)
return self
end end
AceGUI:RegisterWidgetType(Type,Constructor,Version) return AceGUI:RegisterAsContainer(widget)
end end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
File diff suppressed because it is too large Load Diff
@@ -7,10 +7,6 @@ local pairs, assert, type = pairs, assert, type
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 -- -- Main Frame --
---------------- ----------------
@@ -21,14 +17,18 @@ local CreateFrame, UIParent = CreateFrame, UIParent
]] ]]
do do
local Type = "Window" local Type = "Window"
local Version = 4 local Version = 8
local function frameOnShow(this)
this.obj:Fire("OnShow")
end
local function frameOnClose(this) local function frameOnClose(this)
this.obj:Fire("OnClose") this.obj:Fire("OnClose")
end end
local function closeOnClick(this) local function closeOnClick(this)
PlaySound("gsTitleOptionExit") PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
this.obj:Hide() this.obj:Hide()
end end
@@ -180,72 +180,77 @@ do
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetScript("OnMouseDown", frameOnMouseDown) frame:SetScript("OnMouseDown", frameOnMouseDown)
frame:SetScript("OnShow",frameOnShow)
frame:SetScript("OnHide",frameOnClose) frame:SetScript("OnHide",frameOnClose)
frame:SetMinResize(240,240) if frame.SetResizeBounds then -- WoW 10.0
frame:SetResizeBounds(240,240)
else
frame:SetMinResize(240,240)
end
frame:SetToplevel(true) frame:SetToplevel(true)
local titlebg = frame:CreateTexture(nil, "BACKGROUND") local titlebg = frame:CreateTexture(nil, "BACKGROUND")
titlebg:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]]) titlebg:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Title-Background")
titlebg:SetPoint("TOPLEFT", 9, -6) titlebg:SetPoint("TOPLEFT", 9, -6)
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24) titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
local dialogbg = frame:CreateTexture(nil, "BACKGROUND") local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
dialogbg:SetTexture([[Interface\Tooltips\UI-Tooltip-Background]]) dialogbg:SetTexture("Interface\\Tooltips\\UI-Tooltip-Background")
dialogbg:SetPoint("TOPLEFT", 8, -24) dialogbg:SetPoint("TOPLEFT", 8, -24)
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8) dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
dialogbg:SetVertexColor(0, 0, 0, .75) dialogbg:SetVertexColor(0, 0, 0, .75)
local topleft = frame:CreateTexture(nil, "BORDER") local topleft = frame:CreateTexture(nil, "BORDER")
topleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) topleft:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
topleft:SetWidth(64) topleft:SetWidth(64)
topleft:SetHeight(64) topleft:SetHeight(64)
topleft:SetPoint("TOPLEFT") topleft:SetPoint("TOPLEFT")
topleft:SetTexCoord(0.501953125, 0.625, 0, 1) topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
local topright = frame:CreateTexture(nil, "BORDER") local topright = frame:CreateTexture(nil, "BORDER")
topright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) topright:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
topright:SetWidth(64) topright:SetWidth(64)
topright:SetHeight(64) topright:SetHeight(64)
topright:SetPoint("TOPRIGHT") topright:SetPoint("TOPRIGHT")
topright:SetTexCoord(0.625, 0.75, 0, 1) topright:SetTexCoord(0.625, 0.75, 0, 1)
local top = frame:CreateTexture(nil, "BORDER") local top = frame:CreateTexture(nil, "BORDER")
top:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) top:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
top:SetHeight(64) top:SetHeight(64)
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT") top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
top:SetPoint("TOPRIGHT", topright, "TOPLEFT") top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
top:SetTexCoord(0.25, 0.369140625, 0, 1) top:SetTexCoord(0.25, 0.369140625, 0, 1)
local bottomleft = frame:CreateTexture(nil, "BORDER") local bottomleft = frame:CreateTexture(nil, "BORDER")
bottomleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) bottomleft:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
bottomleft:SetWidth(64) bottomleft:SetWidth(64)
bottomleft:SetHeight(64) bottomleft:SetHeight(64)
bottomleft:SetPoint("BOTTOMLEFT") bottomleft:SetPoint("BOTTOMLEFT")
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1) bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
local bottomright = frame:CreateTexture(nil, "BORDER") local bottomright = frame:CreateTexture(nil, "BORDER")
bottomright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) bottomright:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
bottomright:SetWidth(64) bottomright:SetWidth(64)
bottomright:SetHeight(64) bottomright:SetHeight(64)
bottomright:SetPoint("BOTTOMRIGHT") bottomright:SetPoint("BOTTOMRIGHT")
bottomright:SetTexCoord(0.875, 1, 0, 1) bottomright:SetTexCoord(0.875, 1, 0, 1)
local bottom = frame:CreateTexture(nil, "BORDER") local bottom = frame:CreateTexture(nil, "BORDER")
bottom:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) bottom:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
bottom:SetHeight(64) bottom:SetHeight(64)
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT") bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT") bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1) bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
local left = frame:CreateTexture(nil, "BORDER") local left = frame:CreateTexture(nil, "BORDER")
left:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) left:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
left:SetWidth(64) left:SetWidth(64)
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT") left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT") left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
left:SetTexCoord(0.001953125, 0.125, 0, 1) left:SetTexCoord(0.001953125, 0.125, 0, 1)
local right = frame:CreateTexture(nil, "BORDER") local right = frame:CreateTexture(nil, "BORDER")
right:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) right:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
right:SetWidth(64) right:SetWidth(64)
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT") right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT") right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
@@ -295,7 +300,7 @@ do
line2:SetHeight(8) line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8) line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
local x = 0.1 * 8/17 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) 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) local sizer_s = CreateFrame("Frame",nil,frame)
@@ -2,7 +2,7 @@
Button Widget Button Widget
Graphical Button. Graphical Button.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Button", 20 local Type, Version = "Button", 24
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -17,9 +17,9 @@ local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
Scripts Scripts
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Button_OnClick(frame, ...) local function Button_OnClick(frame, ...)
PlaySound("igMainMenuOption")
frame.obj:Fire("OnClick", ...)
AceGUI:ClearFocus() AceGUI:ClearFocus()
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
frame.obj:Fire("OnClick", ...)
end end
local function Control_OnEnter(frame) local function Control_OnEnter(frame)
@@ -39,6 +39,7 @@ local methods = {
self:SetHeight(24) self:SetHeight(24)
self:SetWidth(200) self:SetWidth(200)
self:SetDisabled(false) self:SetDisabled(false)
self:SetAutoWidth(false)
self:SetText() self:SetText()
end, end,
@@ -46,6 +47,16 @@ local methods = {
["SetText"] = function(self, text) ["SetText"] = function(self, text)
self.text:SetText(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, end,
["SetDisabled"] = function(self, disabled) ["SetDisabled"] = function(self, disabled)
@@ -63,7 +74,7 @@ Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2") local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
frame:Hide() frame:Hide()
frame:EnableMouse(true) frame:EnableMouse(true)
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Checkbox Widget Checkbox Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "CheckBox", 21 local Type, Version = "CheckBox", 26
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -12,10 +12,6 @@ local select, pairs = select, pairs
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -26,7 +22,7 @@ local function AlignImage(self)
self.text:SetPoint("LEFT", self.checkbg, "RIGHT") self.text:SetPoint("LEFT", self.checkbg, "RIGHT")
self.text:SetPoint("RIGHT") self.text:SetPoint("RIGHT")
else else
self.text:SetPoint("LEFT", self.image,"RIGHT", 1, 0) self.text:SetPoint("LEFT", self.image, "RIGHT", 1, 0)
self.text:SetPoint("RIGHT") self.text:SetPoint("RIGHT")
end end
end end
@@ -60,9 +56,9 @@ local function CheckBox_OnMouseUp(frame)
self:ToggleChecked() self:ToggleChecked()
if self.checked then if self.checked then
PlaySound("igMainMenuOptionCheckBoxOn") PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
else -- for both nil and false (tristate) else -- for both nil and false (tristate)
PlaySound("igMainMenuOptionCheckBoxOff") PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
end end
self:Fire("OnValueChanged", self.checked) self:Fire("OnValueChanged", self.checked)
@@ -91,7 +87,7 @@ local methods = {
if self.desc then if self.desc then
self.desc:SetWidth(width - 30) self.desc:SetWidth(width - 30)
if self.desc:GetText() and self.desc:GetText() ~= "" then if self.desc:GetText() and self.desc:GetText() ~= "" then
self:SetHeight(28 + self.desc:GetHeight()) self:SetHeight(28 + self.desc:GetStringHeight())
end end
end end
end, end,
@@ -102,6 +98,9 @@ local methods = {
self.frame:Disable() self.frame:Disable()
self.text:SetTextColor(0.5, 0.5, 0.5) self.text:SetTextColor(0.5, 0.5, 0.5)
SetDesaturation(self.check, true) SetDesaturation(self.check, true)
if self.desc then
self.desc:SetTextColor(0.5, 0.5, 0.5)
end
else else
self.frame:Enable() self.frame:Enable()
self.text:SetTextColor(1, 1, 1) self.text:SetTextColor(1, 1, 1)
@@ -110,23 +109,26 @@ local methods = {
else else
SetDesaturation(self.check, false) SetDesaturation(self.check, false)
end end
if self.desc then
self.desc:SetTextColor(1, 1, 1)
end
end end
end, end,
["SetValue"] = function(self,value) ["SetValue"] = function(self, value)
local check = self.check local check = self.check
self.checked = value self.checked = value
if value then if value then
SetDesaturation(self.check, false) SetDesaturation(check, false)
self.check:Show() check:Show()
else else
--Nil is the unknown tristate value --Nil is the unknown tristate value
if self.tristate and value == nil then if self.tristate and value == nil then
SetDesaturation(self.check, true) SetDesaturation(check, true)
self.check:Show() check:Show()
else else
SetDesaturation(self.check, false) SetDesaturation(check, false)
self.check:Hide() check:Hide()
end end
end end
self:SetDisabled(self.disabled) self:SetDisabled(self.disabled)
@@ -193,18 +195,19 @@ local methods = {
["SetDescription"] = function(self, desc) ["SetDescription"] = function(self, desc)
if desc then if desc then
if not self.desc then if not self.desc then
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") local f = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
desc:ClearAllPoints() f:ClearAllPoints()
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21) f:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
desc:SetWidth(self.frame.width - 30) f:SetWidth(self.frame.width - 30)
desc:SetJustifyH("LEFT") f:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
desc:SetJustifyV("TOP") f:SetJustifyH("LEFT")
self.desc = desc f:SetJustifyV("TOP")
self.desc = f
end end
self.desc:Show() self.desc:Show()
--self.text:SetFontObject(GameFontNormal) --self.text:SetFontObject(GameFontNormal)
self.desc:SetText(desc) self.desc:SetText(desc)
self:SetHeight(28 + self.desc:GetHeight()) self:SetHeight(28 + self.desc:GetStringHeight())
else else
if self.desc then if self.desc then
self.desc:SetText("") self.desc:SetText("")
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
ColorPicker Widget ColorPicker Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "ColorPicker", 20 local Type, Version = "ColorPicker", 28
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -11,17 +11,24 @@ local pairs = pairs
-- WoW APIs -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- Unfortunately we have no way to realistically detect if a client uses inverted alpha
-- List them here for Mikk's FindGlobals script -- as no API will tell you. Wrath uses the old colorpicker, era uses the new one, both are inverted
-- GLOBALS: ShowUIPanel, HideUIPanel, ColorPickerFrame, OpacitySliderFrame local INVERTED_ALPHA = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Support functions Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function ColorCallback(self, r, g, b, a, isAlpha) local function ColorCallback(self, r, g, b, a, isAlpha)
if INVERTED_ALPHA and a then
a = 1 - a
end
if not self.HasAlpha then if not self.HasAlpha then
a = 1 a = 1
end end
-- no change, skip update
if r == self.r and g == self.g and b == self.b and a == self.a then
return
end
self:SetColor(r, g, b, a) self:SetColor(r, g, b, a)
if ColorPickerFrame:IsVisible() then if ColorPickerFrame:IsVisible() then
--colorpicker is still open --colorpicker is still open
@@ -47,35 +54,70 @@ local function Control_OnLeave(frame)
end end
local function ColorSwatch_OnClick(frame) local function ColorSwatch_OnClick(frame)
HideUIPanel(ColorPickerFrame) ColorPickerFrame:Hide()
local self = frame.obj local self = frame.obj
if not self.disabled then if not self.disabled then
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG") ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG")
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
ColorPickerFrame:SetClampedToScreen(true)
ColorPickerFrame.func = function() if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul
local r, g, b = ColorPickerFrame:GetColorRGB() local r2, g2, b2, a2 = self.r, self.g, self.b, (self.a or 1)
local a = 1 - OpacitySliderFrame:GetValue() if INVERTED_ALPHA then
ColorCallback(self, r, g, b, a) a2 = 1 - a2
end
local info = {
swatchFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a)
end,
hasOpacity = self.HasAlpha,
opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a, true)
end,
opacity = a2,
cancelFunc = function()
ColorCallback(self, r2, g2, b2, a2, true)
end,
r = r2,
g = g2,
b = b2,
}
ColorPickerFrame:SetupColorPickerAndShow(info)
else
ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end
ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end
local r, g, b, a = self.r, self.g, self.b, 1 - (self.a or 1)
if self.HasAlpha then
ColorPickerFrame.opacity = a
end
ColorPickerFrame:SetColorRGB(r, g, b)
ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
end
ColorPickerFrame:Show()
end 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
ShowUIPanel(ColorPickerFrame)
end end
AceGUI:ClearFocus() AceGUI:ClearFocus()
end end
@@ -142,13 +184,15 @@ local function Constructor()
colorSwatch:SetPoint("LEFT") colorSwatch:SetPoint("LEFT")
local texture = frame:CreateTexture(nil, "BACKGROUND") local texture = frame:CreateTexture(nil, "BACKGROUND")
colorSwatch.background = texture
texture:SetWidth(16) texture:SetWidth(16)
texture:SetHeight(16) texture:SetHeight(16)
texture:SetTexture(1, 1, 1) texture:SetColorTexture(1, 1, 1)
texture:SetPoint("CENTER", colorSwatch) texture:SetPoint("CENTER", colorSwatch)
texture:Show() texture:Show()
local checkers = frame:CreateTexture(nil, "BACKGROUND") local checkers = frame:CreateTexture(nil, "BACKGROUND")
colorSwatch.checkers = checkers
checkers:SetWidth(14) checkers:SetWidth(14)
checkers:SetHeight(14) checkers:SetHeight(14)
checkers:SetTexture("Tileset\\Generic\\Checkers") checkers:SetTexture("Tileset\\Generic\\Checkers")
@@ -1,4 +1,4 @@
--[[ $Id: AceGUIWidget-DropDown-Items.lua 916 2010-03-15 12:24:36Z nevcairiel $ ]]-- --[[ $Id$ ]]--
local AceGUI = LibStub("AceGUI-3.0") local AceGUI = LibStub("AceGUI-3.0")
@@ -41,7 +41,7 @@ local ItemBase = {
-- NOTE: The ItemBase version is added to each item's version number -- NOTE: The ItemBase version is added to each item's version number
-- to ensure proper updates on ItemBase changes. -- to ensure proper updates on ItemBase changes.
-- Use at least 1000er steps. -- Use at least 1000er steps.
version = 1000, version = 2000,
counter = 0, counter = 0,
} }
@@ -178,7 +178,7 @@ function ItemBase.Create(type)
highlight:Hide() highlight:Hide()
self.highlight = highlight self.highlight = highlight
local check = frame:CreateTexture("OVERLAY") local check = frame:CreateTexture(nil, "OVERLAY")
check:SetWidth(16) check:SetWidth(16)
check:SetHeight(16) check:SetHeight(16)
check:SetPoint("LEFT",frame,"LEFT",3,-1) check:SetPoint("LEFT",frame,"LEFT",3,-1)
@@ -186,7 +186,7 @@ function ItemBase.Create(type)
check:Hide() check:Hide()
self.check = check self.check = check
local sub = frame:CreateTexture("OVERLAY") local sub = frame:CreateTexture(nil, "OVERLAY")
sub:SetWidth(16) sub:SetWidth(16)
sub:SetHeight(16) sub:SetHeight(16)
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1) sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
@@ -215,6 +215,12 @@ function ItemBase.Create(type)
return self return self
end 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: Template for items:
@@ -317,7 +323,7 @@ end
-- Does not close the pullout on click. -- Does not close the pullout on click.
do do
local widgetType = "Dropdown-Item-Toggle" local widgetType = "Dropdown-Item-Toggle"
local widgetVersion = 3 local widgetVersion = 4
local function UpdateToggle(self) local function UpdateToggle(self)
if self.value then if self.value then
@@ -337,9 +343,9 @@ do
if self.disabled then return end if self.disabled then return end
self.value = not self.value self.value = not self.value
if self.value then if self.value then
PlaySound("igMainMenuOptionCheckBoxOn") PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
else else
PlaySound("igMainMenuOptionCheckBoxOff") PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
end end
UpdateToggle(self) UpdateToggle(self)
self:Fire("OnValueChanged", self.value) self:Fire("OnValueChanged", self.value)
@@ -434,7 +440,7 @@ end
-- A single line to separate items -- A single line to separate items
do do
local widgetType = "Dropdown-Item-Separator" local widgetType = "Dropdown-Item-Separator"
local widgetVersion = 1 local widgetVersion = 2
-- exported, override -- exported, override
local function SetDisabled(self, disabled) local function SetDisabled(self, disabled)
@@ -449,7 +455,7 @@ do
local line = self.frame:CreateTexture(nil, "OVERLAY") local line = self.frame:CreateTexture(nil, "OVERLAY")
line:SetHeight(1) line:SetHeight(1)
line:SetTexture(.5, .5, .5) line:SetColorTexture(.5, .5, .5)
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0) line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0) line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
@@ -1,9 +1,9 @@
--[[ $Id: AceGUIWidget-DropDown.lua 916 2010-03-15 12:24:36Z nevcairiel $ ]]-- --[[ $Id$ ]]--
local AceGUI = LibStub("AceGUI-3.0") local AceGUI = LibStub("AceGUI-3.0")
-- Lua APIs -- Lua APIs
local min, max, floor = math.min, math.max, math.floor local min, max, floor = math.min, math.max, math.floor
local select, pairs, ipairs = select, pairs, ipairs local select, pairs, ipairs, type, tostring = select, pairs, ipairs, type, tostring
local tsort = table.sort local tsort = table.sort
-- WoW APIs -- WoW APIs
@@ -11,10 +11,6 @@ local PlaySound = PlaySound
local UIParent, CreateFrame = UIParent, CreateFrame local UIParent, CreateFrame = UIParent, CreateFrame
local _G = _G 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 function fixlevels(parent,...)
local i = 1 local i = 1
local child = select(i, ...) local child = select(i, ...)
@@ -39,7 +35,7 @@ end
do do
local widgetType = "Dropdown-Pullout" local widgetType = "Dropdown-Pullout"
local widgetVersion = 3 local widgetVersion = 5
--[[ Static data ]]-- --[[ Static data ]]--
@@ -193,12 +189,7 @@ do
local height = 8 local height = 8
for i, item in pairs(items) do for i, item in pairs(items) do
if i == 1 then item:SetPoint("TOP", itemFrame, "TOP", 0, -2 + (i - 1) * -16)
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
else
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
end
item:Show() item:Show()
height = height + 16 height = height + 16
@@ -258,7 +249,7 @@ do
local function Constructor() local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType) local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent) local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent, "BackdropTemplate")
local self = {} local self = {}
self.count = count self.count = count
self.type = widgetType self.type = widgetType
@@ -309,7 +300,7 @@ do
scrollFrame.obj = self scrollFrame.obj = self
itemFrame.obj = self itemFrame.obj = self
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame) local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame, "BackdropTemplate")
slider:SetOrientation("VERTICAL") slider:SetOrientation("VERTICAL")
slider:SetHitRectInsets(0, 0, -10, 0) slider:SetHitRectInsets(0, 0, -10, 0)
slider:SetBackdrop(sliderBackdrop) slider:SetBackdrop(sliderBackdrop)
@@ -356,17 +347,19 @@ end
do do
local widgetType = "Dropdown" local widgetType = "Dropdown"
local widgetVersion = 22 local widgetVersion = 36
--[[ Static data ]]-- --[[ Static data ]]--
--[[ UI event handler ]]-- --[[ UI event handler ]]--
local function Control_OnEnter(this) local function Control_OnEnter(this)
this.obj.button:LockHighlight()
this.obj:Fire("OnEnter") this.obj:Fire("OnEnter")
end end
local function Control_OnLeave(this) local function Control_OnLeave(this)
this.obj.button:UnlockHighlight()
this.obj:Fire("OnLeave") this.obj:Fire("OnLeave")
end end
@@ -379,14 +372,13 @@ do
local function Dropdown_TogglePullout(this) local function Dropdown_TogglePullout(this)
local self = this.obj local self = this.obj
PlaySound("igMainMenuOptionCheckBoxOn") -- missleading name, but the Blizzard code uses this sound
if self.open then if self.open then
self.open = nil self.open = nil
self.pullout:Close() self.pullout:Close()
AceGUI:ClearFocus() AceGUI:ClearFocus()
else else
self.open = true self.open = true
self.pullout:SetWidth(self.frame:GetWidth()) self.pullout:SetWidth(self.pulloutWidth or self.frame:GetWidth())
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0) self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0)
AceGUI:SetFocus(self) AceGUI:SetFocus(self)
end end
@@ -403,6 +395,7 @@ do
end end
self.open = true self.open = true
self:Fire("OnOpened")
end end
local function OnPulloutClose(this) local function OnPulloutClose(this)
@@ -460,6 +453,9 @@ do
self:SetHeight(44) self:SetHeight(44)
self:SetWidth(200) self:SetWidth(200)
self:SetLabel()
self:SetPulloutWidth(nil)
self.list = {}
end end
-- exported, AceGUI callback -- exported, AceGUI callback
@@ -471,7 +467,6 @@ do
self.pullout = nil self.pullout = nil
self:SetText("") self:SetText("")
self:SetLabel("")
self:SetDisabled(false) self:SetDisabled(false)
self:SetMultiselect(false) self:SetMultiselect(false)
@@ -490,9 +485,11 @@ do
if disabled then if disabled then
self.text:SetTextColor(0.5,0.5,0.5) self.text:SetTextColor(0.5,0.5,0.5)
self.button:Disable() self.button:Disable()
self.button_cover:Disable()
self.label:SetTextColor(0.5,0.5,0.5) self.label:SetTextColor(0.5,0.5,0.5)
else else
self.button:Enable() self.button:Enable()
self.button_cover:Enable()
self.label:SetTextColor(1,.82,0) self.label:SetTextColor(1,.82,0)
self.text:SetTextColor(1,1,1) self.text:SetTextColor(1,1,1)
end end
@@ -515,21 +512,21 @@ do
if text and text ~= "" then if text and text ~= "" then
self.label:SetText(text) self.label:SetText(text)
self.label:Show() self.label:Show()
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-18) self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-14)
self.frame:SetHeight(44) self:SetHeight(40)
self.alignoffset = 26
else else
self.label:SetText("") self.label:SetText("")
self.label:Hide() self.label:Hide()
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,0) self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,0)
self.frame:SetHeight(26) self:SetHeight(26)
self.alignoffset = 12
end end
end end
-- exported -- exported
local function SetValue(self, value) local function SetValue(self, value)
if self.list then self:SetText(self.list[value] or "")
self:SetText(self.list[value] or "")
end
self.value = value self.value = value
end end
@@ -560,8 +557,12 @@ do
end end
end end
local function AddListItem(self, value, text) local function AddListItem(self, value, text, itemType)
local item = AceGUI:Create("Dropdown-Item-Toggle") 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:SetText(text)
item.userdata.obj = self item.userdata.obj = self
item.userdata.value = value item.userdata.value = value
@@ -580,20 +581,34 @@ do
-- exported -- exported
local sortlist = {} local sortlist = {}
local function SetList(self, list) local function sortTbl(x,y)
self.list = list 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.pullout:Clear()
self.hasClose = nil self.hasClose = nil
if not list then return end if not list then return end
for v in pairs(list) do if type(order) ~= "table" then
sortlist[#sortlist + 1] = v for v in pairs(list) do
end sortlist[#sortlist + 1] = v
tsort(sortlist) end
tsort(sortlist, sortTbl)
for i, value in pairs(sortlist) do for i, key in ipairs(sortlist) do
AddListItem(self, value, list[value]) AddListItem(self, key, list[key], itemType)
sortlist[i] = nil sortlist[i] = nil
end
else
for i, key in ipairs(order) do
AddListItem(self, key, list[key], itemType)
end
end end
if self.multiselect then if self.multiselect then
ShowMultiText(self) ShowMultiText(self)
@@ -602,11 +617,9 @@ do
end end
-- exported -- exported
local function AddItem(self, value, text) local function AddItem(self, value, text, itemType)
if self.list then self.list[value] = text
self.list[value] = text AddListItem(self, value, text, itemType)
AddListItem(self, value, text)
end
end end
-- exported -- exported
@@ -623,6 +636,10 @@ do
return self.multiselect return self.multiselect
end end
local function SetPulloutWidth(self, width)
self.pulloutWidth = width
end
--[[ Constructor ]]-- --[[ Constructor ]]--
local function Constructor() local function Constructor()
@@ -654,11 +671,10 @@ do
self.GetMultiselect = GetMultiselect self.GetMultiselect = GetMultiselect
self.SetItemValue = SetItemValue self.SetItemValue = SetItemValue
self.SetItemDisabled = SetItemDisabled self.SetItemDisabled = SetItemDisabled
self.SetPulloutWidth = SetPulloutWidth
self.alignoffset = 31 self.alignoffset = 26
frame:SetHeight(44)
frame:SetWidth(200)
frame:SetScript("OnHide",Dropdown_OnHide) frame:SetScript("OnHide",Dropdown_OnHide)
dropdown:ClearAllPoints() dropdown:ClearAllPoints()
@@ -684,6 +700,15 @@ do
button:SetScript("OnLeave",Control_OnLeave) button:SetScript("OnLeave",Control_OnLeave)
button:SetScript("OnClick",Dropdown_TogglePullout) 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"] local text = _G[dropdown:GetName() .. "Text"]
self.text = text self.text = text
text.obj = self text.obj = self
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
EditBox Widget EditBox Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "EditBox", 20 local Type, Version = "EditBox", 29
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -10,20 +10,20 @@ local tostring, pairs = tostring, pairs
-- WoW APIs -- WoW APIs
local PlaySound = PlaySound local PlaySound = PlaySound
local GetCursorInfo, ClearCursor, GetSpellName = GetCursorInfo, ClearCursor, GetSpellName local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
if not AceGUIEditBoxInsertLink then if not AceGUIEditBoxInsertLink then
-- upgradeable hook -- upgradeable hook
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end) if ChatFrameUtil and ChatFrameUtil.InsertLink then
hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
elseif ChatEdit_InsertLink then
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
end
end end
function _G.AceGUIEditBoxInsertLink(text) function _G.AceGUIEditBoxInsertLink(text)
@@ -59,6 +59,11 @@ local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave") frame.obj:Fire("OnLeave")
end end
local function Frame_OnShowFocus(frame)
frame.obj.editbox:SetFocus()
frame:SetScript("OnShow", nil)
end
local function EditBox_OnEscapePressed(frame) local function EditBox_OnEscapePressed(frame)
AceGUI:ClearFocus() AceGUI:ClearFocus()
end end
@@ -68,29 +73,33 @@ local function EditBox_OnEnterPressed(frame)
local value = frame:GetText() local value = frame:GetText()
local cancel = self:Fire("OnEnterPressed", value) local cancel = self:Fire("OnEnterPressed", value)
if not cancel then if not cancel then
PlaySound("igMainMenuOptionCheckBoxOn") PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
HideButton(self) HideButton(self)
end end
end end
local function EditBox_OnReceiveDrag(frame) local function EditBox_OnReceiveDrag(frame)
local self = frame.obj local self = frame.obj
local type, id, info = GetCursorInfo() local type, id, info, extra = GetCursorInfo()
local name
if type == "item" then if type == "item" then
self:SetText(info) name = info
self:Fire("OnEnterPressed", info)
ClearCursor()
elseif type == "spell" then elseif type == "spell" then
local name, rank = GetSpellName(id, info) if C_Spell and C_Spell.GetSpellName then
if rank and rank:match("%d") then name = C_Spell.GetSpellName(extra)
name = name.."("..rank..")" else
name = GetSpellInfo(id, info)
end end
elseif type == "macro" then
name = GetMacroInfo(id)
end
if name then
self:SetText(name) self:SetText(name)
self:Fire("OnEnterPressed", name) self:Fire("OnEnterPressed", name)
ClearCursor() ClearCursor()
HideButton(self)
AceGUI:ClearFocus()
end end
HideButton(self)
AceGUI:ClearFocus()
end end
local function EditBox_OnTextChanged(frame) local function EditBox_OnTextChanged(frame)
@@ -103,6 +112,10 @@ local function EditBox_OnTextChanged(frame)
end end
end end
local function EditBox_OnFocusGained(frame)
AceGUI:SetFocus(frame.obj)
end
local function Button_OnClick(frame) local function Button_OnClick(frame)
local editbox = frame.obj.editbox local editbox = frame.obj.editbox
editbox:ClearFocus() editbox:ClearFocus()
@@ -120,9 +133,12 @@ local methods = {
self:SetLabel() self:SetLabel()
self:SetText() self:SetText()
self:DisableButton(false) self:DisableButton(false)
self:SetMaxLetters(0)
end, end,
-- ["OnRelease"] = nil, ["OnRelease"] = function(self)
self:ClearFocus()
end,
["SetDisabled"] = function(self, disabled) ["SetDisabled"] = function(self, disabled)
self.disabled = disabled self.disabled = disabled
@@ -145,6 +161,10 @@ local methods = {
HideButton(self) HideButton(self)
end, end,
["GetText"] = function(self, text)
return self.editbox:GetText()
end,
["SetLabel"] = function(self, text) ["SetLabel"] = function(self, text)
if text and text ~= "" then if text and text ~= "" then
self.label:SetText(text) self.label:SetText(text)
@@ -163,6 +183,29 @@ local methods = {
["DisableButton"] = function(self, disabled) ["DisableButton"] = function(self, disabled)
self.disablebutton = 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 end
} }
@@ -184,6 +227,7 @@ local function Constructor()
editbox:SetScript("OnTextChanged", EditBox_OnTextChanged) editbox:SetScript("OnTextChanged", EditBox_OnTextChanged)
editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag) editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag)
editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag) editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag)
editbox:SetScript("OnEditFocusGained", EditBox_OnFocusGained)
editbox:SetTextInsets(0, 0, 3, 3) editbox:SetTextInsets(0, 0, 3, 3)
editbox:SetMaxLetters(256) editbox:SetMaxLetters(256)
editbox:SetPoint("BOTTOMLEFT", 6, 0) editbox:SetPoint("BOTTOMLEFT", 6, 0)
@@ -1,12 +1,12 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Icon Widget Icon Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Icon", 20 local Type, Version = "Icon", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs -- Lua APIs
local select, pairs = select, pairs local select, pairs, print = select, pairs, print
-- WoW APIs -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
@@ -87,7 +87,7 @@ local methods = {
else else
self.frame:Enable() self.frame:Enable()
self.label:SetTextColor(1, 1, 1) self.label:SetTextColor(1, 1, 1)
self.image:SetVertexColor(1, 1, 1) self.image:SetVertexColor(1, 1, 1, 1)
end end
end end
} }
@@ -131,12 +131,8 @@ local function Constructor()
for method, func in pairs(methods) do for method, func in pairs(methods) do
widget[method] = func widget[method] = func
end end
-- SetText is deprecated, but keep it around for a while. (say, to WoW 4.0)
if (select(4, GetBuildInfo()) < 40000) then widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end
widget.SetText = widget.SetLabel
else
widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end
end
return AceGUI:RegisterAsWidget(widget) return AceGUI:RegisterAsWidget(widget)
end end
@@ -1,20 +1,13 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
InteractiveLabel Widget InteractiveLabel Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "InteractiveLabel", 20 local Type, Version = "InteractiveLabel", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs -- Lua APIs
local select, pairs = select, pairs local select, pairs = 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
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Scripts Scripts
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -2,7 +2,7 @@
Keybinding Widget Keybinding Widget
Set Keybindings in the Config UI. Set Keybindings in the Config UI.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Keybinding", 21 local Type, Version = "Keybinding", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -13,10 +13,6 @@ local pairs = pairs
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
local CreateFrame, UIParent = CreateFrame, UIParent 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 Scripts
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -34,11 +30,15 @@ local function Keybinding_OnClick(frame, button)
local self = frame.obj local self = frame.obj
if self.waitingForKey then if self.waitingForKey then
frame:EnableKeyboard(false) frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
frame:EnableGamePadButton(false)
self.msgframe:Hide() self.msgframe:Hide()
frame:UnlockHighlight() frame:UnlockHighlight()
self.waitingForKey = nil self.waitingForKey = nil
else else
frame:EnableKeyboard(true) frame:EnableKeyboard(true)
frame:EnableMouseWheel(true)
frame:EnableGamePadButton(true)
self.msgframe:Show() self.msgframe:Show()
frame:LockHighlight() frame:LockHighlight()
self.waitingForKey = true self.waitingForKey = true
@@ -73,6 +73,8 @@ local function Keybinding_OnKeyDown(frame, key)
end end
frame:EnableKeyboard(false) frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
frame:EnableGamePadButton(false)
self.msgframe:Hide() self.msgframe:Hide()
frame:UnlockHighlight() frame:UnlockHighlight()
self.waitingForKey = nil self.waitingForKey = nil
@@ -97,6 +99,16 @@ local function Keybinding_OnMouseDown(frame, button)
Keybinding_OnKeyDown(frame, button) Keybinding_OnKeyDown(frame, button)
end 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 Methods
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -108,6 +120,9 @@ local methods = {
self.waitingForKey = nil self.waitingForKey = nil
self.msgframe:Hide() self.msgframe:Hide()
self:SetDisabled(false) self:SetDisabled(false)
self.button:EnableKeyboard(false)
self.button:EnableMouseWheel(false)
self.button:EnableGamePadButton(false)
end, end,
-- ["OnRelease"] = nil, -- ["OnRelease"] = nil,
@@ -173,18 +188,23 @@ local function Constructor()
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type) local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", nil, UIParent)
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2") local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate")
button:EnableMouse(true) button:EnableMouse(true)
button:EnableMouseWheel(false)
button:RegisterForClicks("AnyDown") button:RegisterForClicks("AnyDown")
button:SetScript("OnEnter", Control_OnEnter) button:SetScript("OnEnter", Control_OnEnter)
button:SetScript("OnLeave", Control_OnLeave) button:SetScript("OnLeave", Control_OnLeave)
button:SetScript("OnClick", Keybinding_OnClick) button:SetScript("OnClick", Keybinding_OnClick)
button:SetScript("OnKeyDown", Keybinding_OnKeyDown) button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
button:SetScript("OnMouseDown", Keybinding_OnMouseDown) button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
pcall(button.SetScript, button, "OnGamePadButtonDown", Keybinding_OnKeyDown)
button:SetPoint("BOTTOMLEFT") button:SetPoint("BOTTOMLEFT")
button:SetPoint("BOTTOMRIGHT") button:SetPoint("BOTTOMRIGHT")
button:SetHeight(24) button:SetHeight(24)
button:EnableKeyboard(false)
button:EnableGamePadButton(false)
local text = button:GetFontString() local text = button:GetFontString()
text:SetPoint("LEFT", 7, 0) text:SetPoint("LEFT", 7, 0)
@@ -196,12 +216,13 @@ local function Constructor()
label:SetJustifyH("CENTER") label:SetJustifyH("CENTER")
label:SetHeight(18) label:SetHeight(18)
local msgframe = CreateFrame("Frame", nil, UIParent) local msgframe = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
msgframe:SetHeight(30) msgframe:SetHeight(30)
msgframe:SetBackdrop(ControlBackdrop) msgframe:SetBackdrop(ControlBackdrop)
msgframe:SetBackdropColor(0,0,0) msgframe:SetBackdropColor(0,0,0)
msgframe:SetFrameStrata("FULLSCREEN_DIALOG") msgframe:SetFrameStrata("FULLSCREEN_DIALOG")
msgframe:SetFrameLevel(1000) msgframe:SetFrameLevel(1000)
msgframe:SetToplevel(true)
local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal") 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.") msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.")
@@ -2,7 +2,7 @@
Label Widget Label Widget
Displays text and optionally an icon. Displays text and optionally an icon.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Label", 21 local Type, Version = "Label", 28
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -12,10 +12,6 @@ local max, select, pairs = math.max, select, pairs
-- WoW APIs -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -39,19 +35,28 @@ local function UpdateImageAnchor(self)
label:SetPoint("TOP", image, "BOTTOM") label:SetPoint("TOP", image, "BOTTOM")
label:SetPoint("LEFT") label:SetPoint("LEFT")
label:SetWidth(width) label:SetWidth(width)
height = image:GetHeight() + label:GetHeight() height = image:GetHeight() + label:GetStringHeight()
else else
-- image on the left -- image on the left
image:SetPoint("TOPLEFT") image:SetPoint("TOPLEFT")
label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0) 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) label:SetWidth(width - imagewidth - 4)
height = max(image:GetHeight(), label:GetHeight()) height = max(image:GetHeight(), label:GetStringHeight())
end end
else else
-- no image shown -- no image shown
label:SetPoint("TOPLEFT") label:SetPoint("TOPLEFT")
label:SetWidth(width) label:SetWidth(width)
height = label:GetHeight() height = label:GetStringHeight()
end
-- avoid zero-height labels, since they can used as spacers
if not height or height == 0 then
height = 1
end end
self.resizing = true self.resizing = true
@@ -74,6 +79,8 @@ local methods = {
self:SetImageSize(16, 16) self:SetImageSize(16, 16)
self:SetColor() self:SetColor()
self:SetFontObject() self:SetFontObject()
self:SetJustifyH("LEFT")
self:SetJustifyV("TOP")
-- reset the flag -- reset the flag
self.resizing = nil self.resizing = nil
@@ -118,11 +125,16 @@ local methods = {
end, end,
["SetFont"] = function(self, font, height, flags) ["SetFont"] = function(self, font, height, flags)
self.label:SetFont(font, height, flags) if not self.fontObject then
self.fontObject = CreateFont("AceGUI30LabelFont" .. AceGUI:GetNextWidgetNum(Type))
end
self.fontObject:SetFont(font, height, flags)
self:SetFontObject(self.fontObject)
end, end,
["SetFontObject"] = function(self, font) ["SetFontObject"] = function(self, font)
self:SetFont((font or GameFontHighlightSmall):GetFont()) self.label:SetFontObject(font or GameFontHighlightSmall)
UpdateImageAnchor(self)
end, end,
["SetImageSize"] = function(self, width, height) ["SetImageSize"] = function(self, width, height)
@@ -130,6 +142,14 @@ local methods = {
self.image:SetHeight(height) self.image:SetHeight(height)
UpdateImageAnchor(self) UpdateImageAnchor(self)
end, end,
["SetJustifyH"] = function(self, justifyH)
self.label:SetJustifyH(justifyH)
end,
["SetJustifyV"] = function(self, justifyV)
self.label:SetJustifyV(justifyV)
end,
} }
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
@@ -140,9 +160,6 @@ local function Constructor()
frame:Hide() frame:Hide()
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall") local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
label:SetJustifyH("LEFT")
label:SetJustifyV("TOP")
local image = frame:CreateTexture(nil, "BACKGROUND") local image = frame:CreateTexture(nil, "BACKGROUND")
-- create widget -- create widget
@@ -1,4 +1,4 @@
local Type, Version = "MultiLineEditBox", 20 local Type, Version = "MultiLineEditBox", 33
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -6,13 +6,51 @@ if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
local pairs = pairs local pairs = pairs
-- WoW APIs -- WoW APIs
local GetCursorInfo, GetSpellName, ClearCursor = GetCursorInfo, GetSpellName, ClearCursor local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G 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 Support functions
-- GLOBALS: ACCEPT, ChatFontNormal -------------------------------------------------------------------------------]]
if not AceGUIMultiLineEditBoxInsertLink then
-- upgradeable hook
if ChatFrameUtil and ChatFrameUtil.InsertLink then
hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
elseif ChatEdit_InsertLink then
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
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 Scripts
@@ -40,6 +78,7 @@ end
local function OnEditFocusLost(self) -- EditBox local function OnEditFocusLost(self) -- EditBox
self:HighlightText(0, 0) self:HighlightText(0, 0)
self.obj:Fire("OnEditFocusLost")
end end
local function OnEnter(self) -- EditBox / ScrollFrame local function OnEnter(self) -- EditBox / ScrollFrame
@@ -65,11 +104,12 @@ local function OnMouseUp(self)
end end
local function OnReceiveDrag(self) -- EditBox / ScrollFrame local function OnReceiveDrag(self) -- EditBox / ScrollFrame
local type, id, info = GetCursorInfo() local type, id, info, extra = GetCursorInfo()
if type == "spell" then if type == "spell" then
info, id = GetSpellName(id, info) if C_Spell and C_Spell.GetSpellName then
if id and id:match("%d") then info = C_Spell.GetSpellName(extra)
info = info .. "(" .. id .. ")" else
info = GetSpellInfo(id, info)
end end
elseif type ~= "item" then elseif type ~= "item" then
return return
@@ -109,25 +149,40 @@ local function OnVerticalScroll(self, offset)
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight()) editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
end end
local function OnScrollRangeChanged(self, xrange, yrange)
if yrange == 0 then
self.obj.editBox:SetHitRectInsets(0, 0, 0, 0)
else
OnVerticalScroll(self, self:GetVerticalScroll())
end
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 Methods
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local methods = { local methods = {
["GetText"] = function(self)
return self.editBox:GetText()
end,
["OnAcquire"] = function(self) ["OnAcquire"] = function(self)
self.editBox:SetText("") self.editBox:SetText("")
self:SetDisabled(false) self:SetDisabled(false)
self:SetWidth(200) self:SetWidth(200)
self:DisableButton(false)
self:SetNumLines() self:SetNumLines()
self.entered = nil self.entered = nil
self:SetMaxLetters(0)
end, end,
["OnRelease"] = function(self) ["OnRelease"] = function(self)
self.frame:ClearAllPoints() self:ClearFocus()
self.frame:Hide()
end, end,
["SetDisabled"] = function(self, disabled) ["SetDisabled"] = function(self, disabled)
@@ -152,28 +207,68 @@ local methods = {
self.label:SetText(text) self.label:SetText(text)
if self.labelHeight ~= 10 then if self.labelHeight ~= 10 then
self.labelHeight = 10 self.labelHeight = 10
self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19)
self:SetHeight(self.frame.height + 10)
self.label:Show() self.label:Show()
end end
elseif self.labelHeight ~= 0 then elseif self.labelHeight ~= 0 then
self.labelHeight = 0 self.labelHeight = 0
self.label:Hide() self.label:Hide()
self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23)
self:SetHeight(self.frame.height - 10)
end end
Layout(self)
end, end,
["SetNumLines"] = function(self, value) ["SetNumLines"] = function(self, value)
if not value or value < 4 then if not value or value < 4 then
value = 4 value = 4
end end
self:SetHeight(value * 14 + 41 + self.labelHeight) self.numlines = value
Layout(self)
end, end,
["SetText"] = function(self, text) ["SetText"] = function(self, text)
self.editBox:SetText(text) self.editBox:SetText(text)
end 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,
} }
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
@@ -198,8 +293,8 @@ local function Constructor()
label:SetText(ACCEPT) label:SetText(ACCEPT)
label:SetHeight(10) label:SetHeight(10)
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate2") local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate")
button:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, 4) button:SetPoint("BOTTOMLEFT", 0, 4)
button:SetHeight(22) button:SetHeight(22)
button:SetWidth(label:GetStringWidth() + 24) button:SetWidth(label:GetStringWidth() + 24)
button:SetText(ACCEPT) button:SetText(ACCEPT)
@@ -212,7 +307,7 @@ local function Constructor()
text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1) text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
text:SetJustifyV("MIDDLE") text:SetJustifyV("MIDDLE")
local scrollBG = CreateFrame("Frame", nil, frame) local scrollBG = CreateFrame("Frame", nil, frame, "BackdropTemplate")
scrollBG:SetBackdrop(backdrop) scrollBG:SetBackdrop(backdrop)
scrollBG:SetBackdropColor(0, 0, 0) scrollBG:SetBackdropColor(0, 0, 0)
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4) scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
@@ -236,8 +331,9 @@ local function Constructor()
scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag) scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged) scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll) scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
scrollFrame:HookScript("OnScrollRangeChanged", OnScrollRangeChanged)
local editBox = CreateFrame("EditBox", nil, scrollFrame) local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
editBox:SetAllPoints() editBox:SetAllPoints()
editBox:SetFontObject(ChatFontNormal) editBox:SetFontObject(ChatFontNormal)
editBox:SetMultiLine(true) editBox:SetMultiLine(true)
@@ -253,6 +349,8 @@ local function Constructor()
editBox:SetScript("OnReceiveDrag", OnReceiveDrag) editBox:SetScript("OnReceiveDrag", OnReceiveDrag)
editBox:SetScript("OnTextChanged", OnTextChanged) editBox:SetScript("OnTextChanged", OnTextChanged)
editBox:SetScript("OnTextSet", OnTextSet) editBox:SetScript("OnTextSet", OnTextSet)
editBox:SetScript("OnEditFocusGained", OnEditFocusGained)
scrollFrame:SetScrollChild(editBox) scrollFrame:SetScrollChild(editBox)
@@ -262,7 +360,9 @@ local function Constructor()
frame = frame, frame = frame,
label = label, label = label,
labelHeight = 10, labelHeight = 10,
numlines = 4,
scrollBar = scrollBar, scrollBar = scrollBar,
scrollBG = scrollBG,
scrollFrame = scrollFrame, scrollFrame = scrollFrame,
type = Type type = Type
} }
@@ -271,8 +371,7 @@ local function Constructor()
end end
button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget
AceGUI:RegisterAsWidget(widget) return AceGUI:RegisterAsWidget(widget)
return widget
end end
AceGUI:RegisterWidgetType(Type, Constructor, Version) AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -2,22 +2,18 @@
Slider Widget Slider Widget
Graphical Slider, like, for Range values. Graphical Slider, like, for Range values.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Slider", 20 local Type, Version = "Slider", 24
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs -- Lua APIs
local min, max, floor = math.min, math.max, math.floor local min, max, floor = math.min, math.max, math.floor
local tonumber = tonumber local tonumber, pairs = tonumber, pairs
-- WoW APIs -- WoW APIs
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -31,13 +27,13 @@ local function UpdateText(self)
end end
local function UpdateLabels(self) local function UpdateLabels(self)
local min, max = (self.min or 0), (self.max or 100) local min_value, max_value = (self.min or 0), (self.max or 100)
if self.ispercent then if self.ispercent then
self.lowtext:SetFormattedText("%s%%", (min * 100)) self.lowtext:SetFormattedText("%s%%", (min_value * 100))
self.hightext:SetFormattedText("%s%%", (max * 100)) self.hightext:SetFormattedText("%s%%", (max_value * 100))
else else
self.lowtext:SetText(min) self.lowtext:SetText(min_value)
self.hightext:SetText(max) self.hightext:SetText(max_value)
end end
end end
@@ -57,10 +53,13 @@ local function Frame_OnMouseDown(frame)
AceGUI:ClearFocus() AceGUI:ClearFocus()
end end
local function Slider_OnValueChanged(frame) local function Slider_OnValueChanged(frame, newvalue)
local self = frame.obj local self = frame.obj
if not frame.setup then if not frame.setup then
local newvalue = frame:GetValue() 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 if newvalue ~= self.value and not self.disabled then
self.value = newvalue self.value = newvalue
self:Fire("OnValueChanged", newvalue) self:Fire("OnValueChanged", newvalue)
@@ -104,7 +103,7 @@ local function EditBox_OnEnterPressed(frame)
end end
if value then if value then
PlaySound("igMainMenuOptionCheckBoxOn") PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
self.slider:SetValue(value) self.slider:SetValue(value)
self:Fire("OnMouseUp", value) self:Fire("OnMouseUp", value)
end end
@@ -172,13 +171,13 @@ local methods = {
self.label:SetText(text) self.label:SetText(text)
end, end,
["SetSliderValues"] = function(self, min, max, step) ["SetSliderValues"] = function(self, min_value, max_value, step)
local frame = self.slider local frame = self.slider
frame.setup = true frame.setup = true
self.min = min self.min = min_value
self.max = max self.max = max_value
self.step = step self.step = step
frame:SetMinMaxValues(min or 0,max or 100) frame:SetMinMaxValues(min_value or 0,max_value or 100)
UpdateLabels(self) UpdateLabels(self)
frame:SetValueStep(step or 1) frame:SetValueStep(step or 1)
if self.value then if self.value then
@@ -222,7 +221,7 @@ local function Constructor()
label:SetJustifyH("CENTER") label:SetJustifyH("CENTER")
label:SetHeight(15) label:SetHeight(15)
local slider = CreateFrame("Slider", nil, frame) local slider = CreateFrame("Slider", nil, frame, "BackdropTemplate")
slider:SetOrientation("HORIZONTAL") slider:SetOrientation("HORIZONTAL")
slider:SetHeight(15) slider:SetHeight(15)
slider:SetHitRectInsets(0, 0, -10, 0) slider:SetHitRectInsets(0, 0, -10, 0)
@@ -244,7 +243,7 @@ local function Constructor()
local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3) hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
local editbox = CreateFrame("EditBox", nil, frame) local editbox = CreateFrame("EditBox", nil, frame, "BackdropTemplate")
editbox:SetAutoFocus(false) editbox:SetAutoFocus(false)
editbox:SetFontObject(GameFontHighlightSmall) editbox:SetFontObject(GameFontHighlightSmall)
editbox:SetPoint("TOP", slider, "BOTTOM") editbox:SetPoint("TOP", slider, "BOTTOM")
@@ -274,6 +273,7 @@ local function Constructor()
widget[method] = func widget[method] = func
end end
slider.obj, editbox.obj = widget, widget slider.obj, editbox.obj = widget, widget
C_Timer.After(0.3, function() editbox:SetText(" ") UpdateText(widget) end) -- Workaround for font loading issue, making the editboxes blank until the text is changed
return AceGUI:RegisterAsWidget(widget) return AceGUI:RegisterAsWidget(widget)
end end
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: Shadowed Unit Frames ## Title: Shadowed Unit Frames
## Notes: An apple a day keeps the raptor away, or so they say ## Notes: An apple a day keeps the raptor away, or so they say
## Author: Shadowed ## Author: Shadowed
## Version: v3.3.0 ## Version: v3.3.0-coa.2
## SavedVariables: ShadowedUFDB ## SavedVariables: ShadowedUFDB
## OptionalDeps: Ace3, LibSharedMedia-3.0, LibHealComm-4.0, AceGUI-3.0-SharedMediaWidgets ## OptionalDeps: Ace3, LibSharedMedia-3.0, LibHealComm-4.0, AceGUI-3.0-SharedMediaWidgets
## X-Curse-Packaged-Version: v3.2.12 ## X-Curse-Packaged-Version: v3.2.12
+111 -34
View File
@@ -10,6 +10,7 @@
-- * **race** Race-specific data. All of the players characters of the same race 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. -- * **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. -- * **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. -- * **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. -- * **profile** Profile-specific data. All characters using the same profile share this database. The user can control which profile should be used.
-- --
@@ -39,23 +40,19 @@
-- end -- end
-- @class file -- @class file
-- @name AceDB-3.0.lua -- @name AceDB-3.0.lua
-- @release $Id: AceDB-3.0.lua 940 2010-06-19 08:01:47Z nevcairiel $ -- @release $Id$
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 21 local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 33
local AceDB, oldminor = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR) local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
if not AceDB then return end -- No upgrade needed if not AceDB then return end -- No upgrade needed
-- Lua APIs -- Lua APIs
local type, pairs, next, error = type, pairs, next, error local type, pairs, next, error = type, pairs, next, error
local setmetatable, getmetatable, rawset, rawget = setmetatable, getmetatable, rawset, rawget local setmetatable, rawset, rawget = setmetatable, rawset, rawget
-- WoW APIs -- WoW APIs
local _G = _G 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.db_registry = AceDB.db_registry or {}
AceDB.frame = AceDB.frame or CreateFrame("Frame") AceDB.frame = AceDB.frame or CreateFrame("Frame")
@@ -97,11 +94,11 @@ local function copyDefaults(dest, src)
-- This is a metatable used for table defaults -- This is a metatable used for table defaults
local mt = { local mt = {
-- This handles the lookup and creation of new subtables -- This handles the lookup and creation of new subtables
__index = function(t,k) __index = function(t,k2)
if k == nil then return nil end if k2 == nil then return nil end
local tbl = {} local tbl = {}
copyDefaults(tbl, v) copyDefaults(tbl, v)
rawset(t, k, tbl) rawset(t, k2, tbl)
return tbl return tbl
end, end,
} }
@@ -114,7 +111,15 @@ local function copyDefaults(dest, src)
end end
else else
-- Values are not tables, so this is just a simple return -- 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} -- (PR #10 backport: the old `k2~=nil and v or nil` short-circuits to
-- nil whenever the default `v` itself is falsy — so `["*"] = false`
-- defaults silently became nil. Make the read explicit instead.)
local mt = {
__index = function(t,k2)
if k2 == nil then return nil end
return v
end,
}
setmetatable(dest, mt) setmetatable(dest, mt)
end end
elseif type(v) == "table" then elseif type(v) == "table" then
@@ -260,6 +265,12 @@ local _, classKey = UnitClass("player")
local _, raceKey = UnitRace("player") local _, raceKey = UnitRace("player")
local factionKey = UnitFactionGroup("player") local factionKey = UnitFactionGroup("player")
local factionrealmKey = factionKey .. " - " .. realmKey local factionrealmKey = factionKey .. " - " .. realmKey
local localeKey = GetLocale():lower()
local regionTable = { "US", "KR", "EU", "TW", "CN" }
local regionKey = regionTable[GetCurrentRegion()] or GetCurrentRegionName() or "TR"
local factionrealmregionKey = factionrealmKey .. " - " .. regionKey
-- Actual database initialization function -- Actual database initialization function
local function initdb(sv, defaults, defaultProfile, olddb, parent) local function initdb(sv, defaults, defaultProfile, olddb, parent)
-- Generate the database keys for each section -- Generate the database keys for each section
@@ -295,7 +306,9 @@ local function initdb(sv, defaults, defaultProfile, olddb, parent)
["race"] = raceKey, ["race"] = raceKey,
["faction"] = factionKey, ["faction"] = factionKey,
["factionrealm"] = factionrealmKey, ["factionrealm"] = factionrealmKey,
["factionrealmregion"] = factionrealmregionKey,
["profile"] = profileKey, ["profile"] = profileKey,
["locale"] = localeKey,
["global"] = true, ["global"] = true,
["profiles"] = true, ["profiles"] = true,
} }
@@ -355,7 +368,7 @@ local function logoutHandler(frame, event)
-- cleanup sections that are empty without defaults -- cleanup sections that are empty without defaults
local sv = rawget(db, "sv") local sv = rawget(db, "sv")
for section in pairs(db.keys) do for section in pairs(rawget(db, "keys")) do
if rawget(sv, section) then if rawget(sv, section) then
-- global is special, all other sections have sub-entrys -- global is special, all other sections have sub-entrys
-- also don't delete empty profiles on main dbs, only on namespaces -- also don't delete empty profiles on main dbs, only on namespaces
@@ -372,6 +385,26 @@ local function logoutHandler(frame, event)
end end
end end
end end
-- second pass after everything else is cleaned up to remove empty namespaces
-- can't be run in-loop above since there is no guaranteed order
for db in pairs(AceDB.db_registry) do
local sv = rawget(db, "sv")
local namespaces = rawget(sv, "namespaces")
if namespaces then
for name in pairs(namespaces) do
-- cleanout empty profiles table, if still present
if namespaces[name].profiles and not next(namespaces[name].profiles) then
namespaces[name].profiles = nil
end
-- remove entire namespace, if needed
if not next(namespaces[name]) then
namespaces[name] = nil
end
end
end
end
end end
end end
@@ -388,7 +421,7 @@ AceDB.frame:SetScript("OnEvent", logoutHandler)
-- @param defaults A table of defaults for this database -- @param defaults A table of defaults for this database
function DBObjectLib:RegisterDefaults(defaults) function DBObjectLib:RegisterDefaults(defaults)
if defaults and type(defaults) ~= "table" then if defaults and type(defaults) ~= "table" then
error("Usage: AceDBObject:RegisterDefaults(defaults): 'defaults' - table or nil expected.", 2) error(("Usage: AceDBObject:RegisterDefaults(defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
end end
validateDefaults(defaults, self.keys) validateDefaults(defaults, self.keys)
@@ -420,7 +453,7 @@ end
-- @param name The name of the profile to set as the current profile -- @param name The name of the profile to set as the current profile
function DBObjectLib:SetProfile(name) function DBObjectLib:SetProfile(name)
if type(name) ~= "string" then if type(name) ~= "string" then
error("Usage: AceDBObject:SetProfile(name): 'name' - string expected.", 2) error(("Usage: AceDBObject:SetProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end end
-- changing to the same profile, dont do anything -- changing to the same profile, dont do anything
@@ -462,7 +495,7 @@ end
-- @param tbl A table to store the profile names in (optional) -- @param tbl A table to store the profile names in (optional)
function DBObjectLib:GetProfiles(tbl) function DBObjectLib:GetProfiles(tbl)
if tbl and type(tbl) ~= "table" then if tbl and type(tbl) ~= "table" then
error("Usage: AceDBObject:GetProfiles(tbl): 'tbl' - table or nil expected.", 2) error(("Usage: AceDBObject:GetProfiles(tbl): 'tbl' - table or nil expected, got %q."):format(type(tbl)), 2)
end end
-- Clear the container table -- Clear the container table
@@ -500,15 +533,15 @@ end
-- @param silent If true, do not raise an error when the profile does not exist -- @param silent If true, do not raise an error when the profile does not exist
function DBObjectLib:DeleteProfile(name, silent) function DBObjectLib:DeleteProfile(name, silent)
if type(name) ~= "string" then if type(name) ~= "string" then
error("Usage: AceDBObject:DeleteProfile(name): 'name' - string expected.", 2) error(("Usage: AceDBObject:DeleteProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end end
if self.keys.profile == name then if self.keys.profile == name then
error("Cannot delete the active profile in an AceDBObject.", 2) error(("Cannot delete the active profile (%q) in an AceDBObject."):format(name), 2)
end end
if not rawget(self.profiles, name) and not silent then if not rawget(self.profiles, name) and not silent then
error("Cannot delete profile '" .. name .. "'. It does not exist.", 2) error(("Cannot delete profile %q as it does not exist."):format(name), 2)
end end
self.profiles[name] = nil self.profiles[name] = nil
@@ -520,6 +553,26 @@ function DBObjectLib:DeleteProfile(name, silent)
end end
end end
-- remove from unloaded namespaces
if self.sv.namespaces then
for nsname, data in pairs(self.sv.namespaces) do
if self.children and self.children[nsname] then
-- already a mapped namespace
elseif data.profiles then
data.profiles[name] = nil
end
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 -- Callback: OnProfileDeleted, database, profileKey
self.callbacks:Fire("OnProfileDeleted", self, name) self.callbacks:Fire("OnProfileDeleted", self, name)
end end
@@ -530,15 +583,15 @@ end
-- @param silent If true, do not raise an error when the profile does not exist -- @param silent If true, do not raise an error when the profile does not exist
function DBObjectLib:CopyProfile(name, silent) function DBObjectLib:CopyProfile(name, silent)
if type(name) ~= "string" then if type(name) ~= "string" then
error("Usage: AceDBObject:CopyProfile(name): 'name' - string expected.", 2) error(("Usage: AceDBObject:CopyProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
end end
if name == self.keys.profile then if name == self.keys.profile then
error("Cannot have the same source and destination profiles.", 2) error(("Cannot have the same source and destination profiles (%q)."):format(name), 2)
end end
if not rawget(self.profiles, name) and not silent then if not rawget(self.profiles, name) and not silent then
error("Cannot copy profile '" .. name .. "'. It does not exist.", 2) error(("Cannot copy profile %q as it does not exist."):format(name), 2)
end end
-- Reset the profile before copying -- Reset the profile before copying
@@ -556,6 +609,20 @@ function DBObjectLib:CopyProfile(name, silent)
end end
end end
-- copy unloaded namespaces
if self.sv.namespaces then
for nsname, data in pairs(self.sv.namespaces) do
if self.children and self.children[nsname] then
-- already a mapped namespace
elseif data.profiles then
-- reset the current profile
data.profiles[self.keys.profile] = {}
-- copy data
copyTable(data.profiles[name], data.profiles[self.keys.profile])
end
end
end
-- Callback: OnProfileCopied, database, sourceProfileKey -- Callback: OnProfileCopied, database, sourceProfileKey
self.callbacks:Fire("OnProfileCopied", self, name) self.callbacks:Fire("OnProfileCopied", self, name)
end end
@@ -582,6 +649,18 @@ function DBObjectLib:ResetProfile(noChildren, noCallbacks)
end end
end end
-- reset unloaded namespaces
if self.sv.namespaces and not noChildren then
for nsname, data in pairs(self.sv.namespaces) do
if self.children and self.children[nsname] then
-- already a mapped namespace
elseif data.profiles then
-- reset the current profile
data.profiles[self.keys.profile] = nil
end
end
end
-- Callback: OnProfileReset, database -- Callback: OnProfileReset, database
if not noCallbacks then if not noCallbacks then
self.callbacks:Fire("OnProfileReset", self) self.callbacks:Fire("OnProfileReset", self)
@@ -592,8 +671,8 @@ end
-- profile. -- profile.
-- @param defaultProfile The profile name to use as the default -- @param defaultProfile The profile name to use as the default
function DBObjectLib:ResetDB(defaultProfile) function DBObjectLib:ResetDB(defaultProfile)
if defaultProfile and type(defaultProfile) ~= "string" then if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
error("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or nil expected.", 2) error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
end end
local sv = self.sv local sv = self.sv
@@ -601,8 +680,6 @@ function DBObjectLib:ResetDB(defaultProfile)
sv[k] = nil sv[k] = nil
end end
local parent = self.parent
initdb(sv, self.defaults, defaultProfile, self) initdb(sv, self.defaults, defaultProfile, self)
-- fix the child namespaces -- fix the child namespaces
@@ -629,13 +706,13 @@ end
-- @param defaults A table of values to use as defaults -- @param defaults A table of values to use as defaults
function DBObjectLib:RegisterNamespace(name, defaults) function DBObjectLib:RegisterNamespace(name, defaults)
if type(name) ~= "string" then if type(name) ~= "string" then
error("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - string expected.", 2) error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - string expected, got %q."):format(type(name)), 2)
end end
if defaults and type(defaults) ~= "table" then if defaults and type(defaults) ~= "table" then
error("Usage: AceDBObject:RegisterNamespace(name, defaults): 'defaults' - table or nil expected.", 2) error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
end end
if self.children and self.children[name] then if self.children and self.children[name] then
error ("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - a namespace with that name already exists.", 2) error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - a namespace called %q already exists."):format(name), 2)
end end
local sv = self.sv local sv = self.sv
@@ -659,10 +736,10 @@ end
-- @return the namespace object if found -- @return the namespace object if found
function DBObjectLib:GetNamespace(name, silent) function DBObjectLib:GetNamespace(name, silent)
if type(name) ~= "string" then if type(name) ~= "string" then
error("Usage: AceDBObject:GetNamespace(name): 'name' - string expected.", 2) error(("Usage: AceDBObject:GetNamespace(name): 'name' - string expected, got %q."):format(type(name)), 2)
end end
if not silent and not (self.children and self.children[name]) then if not silent and not (self.children and self.children[name]) then
error ("Usage: AceDBObject:GetNamespace(name): 'name' - namespace does not exist.", 2) error(("Usage: AceDBObject:GetNamespace(name): 'name' - namespace %q does not exist."):format(name), 2)
end end
if not self.children then self.children = {} end if not self.children then self.children = {} end
return self.children[name] return self.children[name]
@@ -701,15 +778,15 @@ function AceDB:New(tbl, defaults, defaultProfile)
end end
if type(tbl) ~= "table" then if type(tbl) ~= "table" then
error("Usage: AceDB:New(tbl, defaults, defaultProfile): 'tbl' - table expected.", 2) error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'tbl' - table expected, got %q."):format(type(tbl)), 2)
end end
if defaults and type(defaults) ~= "table" then if defaults and type(defaults) ~= "table" then
error("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaults' - table expected.", 2) error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaults' - table expected, got %q."):format(type(defaults)), 2)
end end
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
error("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaultProfile' - string or true expected.", 2) error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
end end
return initdb(tbl, defaults, defaultProfile) return initdb(tbl, defaults, defaultProfile)
@@ -1,61 +1,26 @@
--[[ $Id: CallbackHandler-1.0.lua 9 2009-09-17 10:38:10Z mikk $ ]] --[[ $Id: CallbackHandler-1.0.lua 25 2022-12-12 15:02:36Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 5 local MAJOR, MINOR = "CallbackHandler-1.0", 8
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
if not CallbackHandler then return end -- No upgrade needed if not CallbackHandler then return end -- No upgrade needed
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
local type = type -- Lua APIs
local pcall = pcall local securecallfunction, error = securecallfunction, error
local pairs = pairs local setmetatable, rawget = setmetatable, rawget
local assert = assert local next, select, pairs, type, tostring = next, select, pairs, type, tostring
local concat = table.concat
local loadstring = loadstring
local next = next
local select = select
local type = type
local xpcall = xpcall
local function errorhandler(err)
return geterrorhandler()(err) local function Dispatch(handlers, ...)
local index, method = next(handlers)
if not method then return end
repeat
securecallfunction(method, ...)
index, method = next(handlers, index)
until not method
end end
local function CreateDispatcher(argCount)
local code = [[
local next, xpcall, eh = ...
local method, ARGS
local function call() method(ARGS) end
local function dispatch(handlers, ...)
local index
index, method = next(handlers)
if not method then return end
local OLD_ARGS = ARGS
ARGS = ...
repeat
xpcall(call, eh)
index, method = next(handlers, index)
until not method
ARGS = OLD_ARGS
end
return dispatch
]]
local ARGS, OLD_ARGS = {}, {}
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
code = code:gsub("OLD_ARGS", concat(OLD_ARGS, ", ")):gsub("ARGS", concat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
end
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})
-------------------------------------------------------------------------- --------------------------------------------------------------------------
-- CallbackHandler:New -- CallbackHandler:New
-- --
@@ -64,9 +29,7 @@ end})
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" -- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. -- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused) function CallbackHandler.New(_self, target, RegisterName, UnregisterName, UnregisterAllName)
-- TODO: Remove this after beta has gone out
assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused")
RegisterName = RegisterName or "RegisterCallback" RegisterName = RegisterName or "RegisterCallback"
UnregisterName = UnregisterName or "UnregisterCallback" UnregisterName = UnregisterName or "UnregisterCallback"
@@ -88,19 +51,19 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
local oldrecurse = registry.recurse local oldrecurse = registry.recurse
registry.recurse = oldrecurse + 1 registry.recurse = oldrecurse + 1
Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...) Dispatch(events[eventname], eventname, ...)
registry.recurse = oldrecurse registry.recurse = oldrecurse
if registry.insertQueue and oldrecurse==0 then if registry.insertQueue and oldrecurse==0 then
-- Something in one of our callbacks wanted to register more callbacks; they got queued -- Something in one of our callbacks wanted to register more callbacks; they got queued
for eventname,callbacks in pairs(registry.insertQueue) do for event,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. local first = not rawget(events, event) or not next(events[event]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for self,func in pairs(callbacks) do for object,func in pairs(callbacks) do
events[eventname][self] = func events[event][object] = func
-- fire OnUsed callback? -- fire OnUsed callback?
if first and registry.OnUsed then if first and registry.OnUsed then
registry.OnUsed(registry, target, eventname) registry.OnUsed(registry, target, event)
first = nil first = nil
end end
end end
@@ -146,9 +109,9 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
regfunc = function(...) self[method](self,...) end regfunc = function(...) self[method](self,...) end
end end
else else
-- function ref with self=object or self="addonId" -- function ref with self=object or self="addonId" or self=thread
if type(self)~="table" and type(self)~="string" then if type(self)~="table" and type(self)~="string" and type(self)~="thread" then
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string expected.", 2) error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2)
end end
if select("#",...)>=1 then -- this is not the same as testing for arg==nil! if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
@@ -10,7 +10,7 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then
function LibStub:NewLibrary(major, minor) function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") minor = assert(tonumber(string.match(minor, "%d+")), "Minor version must either be a number or contain a number.")
local oldminor = self.minors[major] local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end if oldminor and oldminor >= minor then return nil end
@@ -1,239 +0,0 @@
--[[ $Id: CallbackHandler-1.0.lua 60548 2008-02-07 11:04:06Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 3
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
if not CallbackHandler then return end -- No upgrade needed
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
local type = type
local pcall = pcall
local pairs = pairs
local assert = assert
local concat = table.concat
local loadstring = loadstring
local next = next
local select = select
local type = type
local xpcall = xpcall
local function errorhandler(err)
return geterrorhandler()(err)
end
local function CreateDispatcher(argCount)
local code = [[
local next, xpcall, eh = ...
local method, ARGS
local function call() method(ARGS) end
local function dispatch(handlers, ...)
local index
index, method = next(handlers)
if not method then return end
local OLD_ARGS = ARGS
ARGS = ...
repeat
xpcall(call, eh)
index, method = next(handlers, index)
until not method
ARGS = OLD_ARGS
end
return dispatch
]]
local ARGS, OLD_ARGS = {}, {}
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
code = code:gsub("OLD_ARGS", concat(OLD_ARGS, ", ")):gsub("ARGS", concat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
end
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})
--------------------------------------------------------------------------
-- CallbackHandler:New
--
-- target - target object to embed public APIs in
-- RegisterName - name of the callback registration API, default "RegisterCallback"
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused)
-- TODO: Remove this after beta has gone out
assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused")
RegisterName = RegisterName or "RegisterCallback"
UnregisterName = UnregisterName or "UnregisterCallback"
if UnregisterAllName==nil then -- false is used to indicate "don't want this method"
UnregisterAllName = "UnregisterAllCallbacks"
end
-- we declare all objects and exported APIs inside this closure to quickly gain access
-- to e.g. function names, the "target" parameter, etc
-- Create the registry object
local events = setmetatable({}, meta)
local registry = { recurse=0, events=events }
-- registry:Fire() - fires the given event/message into the registry
function registry:Fire(eventname, ...)
if not rawget(events, eventname) or not next(events[eventname]) then return end
local oldrecurse = registry.recurse
registry.recurse = oldrecurse + 1
Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
registry.recurse = oldrecurse
if registry.insertQueue and oldrecurse==0 then
-- Something in one of our callbacks wanted to register more callbacks; they got queued
for eventname,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for self,func in pairs(callbacks) do
events[eventname][self] = func
-- fire OnUsed callback?
if first and registry.OnUsed then
registry.OnUsed(registry, target, eventname)
first = nil
end
end
end
registry.insertQueue = nil
end
end
-- Registration of a callback, handles:
-- self["method"], leads to self["method"](self, ...)
-- self with function ref, leads to functionref(...)
-- "addonId" (instead of self) with function ref, leads to functionref(...)
-- all with an optional arg, which, if present, gets passed as first argument (after self if present)
target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]])
if type(eventname) ~= "string" then
error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2)
end
method = method or eventname
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
if type(method) ~= "string" and type(method) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2)
end
local regfunc
if type(method) == "string" then
-- self["method"] calling style
if type(self) ~= "table" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
elseif self==target then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
elseif type(self[method]) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
end
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) self[method](self,arg,...) end
else
regfunc = function(...) self[method](self,...) end
end
else
-- function ref with self=object or self="addonId"
if type(self)~="table" and type(self)~="string" then
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string expected.", 2)
end
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) method(arg,...) end
else
regfunc = method
end
end
if events[eventname][self] or registry.recurse<1 then
-- if registry.recurse<1 then
-- we're overwriting an existing entry, or not currently recursing. just set it.
events[eventname][self] = regfunc
-- fire OnUsed callback?
if registry.OnUsed and first then
registry.OnUsed(registry, target, eventname)
end
else
-- we're currently processing a callback in this registry, so delay the registration of this new entry!
-- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency
registry.insertQueue = registry.insertQueue or setmetatable({},meta)
registry.insertQueue[eventname][self] = regfunc
end
end
-- Unregister a callback
target[UnregisterName] = function(self, eventname)
if not self or self==target then
error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
end
if type(eventname) ~= "string" then
error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2)
end
if rawget(events, eventname) and events[eventname][self] then
events[eventname][self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(events[eventname]) then
registry.OnUnused(registry, target, eventname)
end
end
if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then
registry.insertQueue[eventname][self] = nil
end
end
-- OPTIONAL: Unregister all callbacks for given selfs/addonIds
if UnregisterAllName then
target[UnregisterAllName] = function(...)
if select("#",...)<1 then
error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
end
if select("#",...)==1 and ...==target then
error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
end
for i=1,select("#",...) do
local self = select(i,...)
if registry.insertQueue then
for eventname, callbacks in pairs(registry.insertQueue) do
if callbacks[self] then
callbacks[self] = nil
end
end
end
for eventname, callbacks in pairs(events) do
if callbacks[self] then
callbacks[self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(callbacks) then
registry.OnUnused(registry, target, eventname)
end
end
end
end
end
end
return registry
end
-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it
-- try to upgrade old implicit embeds since the system is selfcontained and
-- relies on closures to work.
@@ -1,6 +1,6 @@
--[[ --[[
Name: LibSharedMedia-3.0 Name: LibSharedMedia-3.0
Revision: $Revision: 53 $ Revision: $Revision: 62 $
Author: Elkano (elkano@gmx.de) Author: Elkano (elkano@gmx.de)
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com) Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
Website: http://www.wowace.com/projects/libsharedmedia-3-0/ Website: http://www.wowace.com/projects/libsharedmedia-3-0/
@@ -9,7 +9,7 @@ Dependencies: LibStub, CallbackHandler-1.0
License: LGPL v2.1 License: LGPL v2.1
]] ]]
local MAJOR, MINOR = "LibSharedMedia-3.0", 90000 + tonumber(("$Revision: 53 $"):match("(%d+)")) local MAJOR, MINOR = "LibSharedMedia-3.0", 3030002 -- 3.3.5 / increase manually on changes
local lib = LibStub:NewLibrary(MAJOR, MINOR) local lib = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end if not lib then return end
@@ -20,8 +20,6 @@ local pairs = _G.pairs
local type = _G.type local type = _G.type
local band = _G.bit.band local band = _G.bit.band
local table_insert = _G.table.insert
local table_sort = _G.table.sort local table_sort = _G.table.sort
local locale = GetLocale() local locale = GetLocale()
@@ -59,21 +57,31 @@ lib.MediaType.SOUND = "sound" -- sound files
-- populate lib with default Blizzard data -- populate lib with default Blizzard data
-- BACKGROUND -- BACKGROUND
if not lib.MediaTable.background then lib.MediaTable.background = {} end if not lib.MediaTable.background then lib.MediaTable.background = {} end
lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]] lib.MediaTable.background["None"] = [[]]
lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]] lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]]
lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]] lib.MediaTable.background["Blizzard Dialog Background Dark"] = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]]
lib.MediaTable.background["Blizzard Parchment"] = [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]] lib.MediaTable.background["Blizzard Dialog Background Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]]
lib.MediaTable.background["Blizzard Parchment 2"] = [[Interface\AchievementFrame\UI-Achievement-Parchment]] lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]]
lib.MediaTable.background["Blizzard Tabard Background"] = [[Interface\TabardFrame\TabardFrameBackground]] lib.MediaTable.background["Blizzard Marble"] = [[Interface\FrameGeneral\UI-Background-Marble]]
lib.MediaTable.background["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Background]] lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]]
lib.MediaTable.background["Solid"] = [[Interface\Buttons\WHITE8X8]] lib.MediaTable.background["Blizzard Parchment"] = [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]]
lib.MediaTable.background["Blizzard Parchment 2"] = [[Interface\AchievementFrame\UI-GuildAchievement-Parchment-Horizontal]]
lib.MediaTable.background["Blizzard Rock"] = [[Interface\FrameGeneral\UI-Background-Rock]]
lib.MediaTable.background["Blizzard Tabard Background"] = [[Interface\TabardFrame\TabardFrameBackground]]
lib.MediaTable.background["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Background]]
lib.MediaTable.background["Solid"] = [[Interface\Buttons\WHITE8X8]]
lib.DefaultMedia.background = "None"
-- BORDER -- BORDER
if not lib.MediaTable.border then lib.MediaTable.border = {} end if not lib.MediaTable.border then lib.MediaTable.border = {} end
lib.MediaTable.border["None"] = [[Interface\None]] lib.MediaTable.border["None"] = [[]]
lib.MediaTable.border["Blizzard Achievement Wood"] = [[Interface\AchievementFrame\UI-Achievement-WoodBorder]]
lib.MediaTable.border["Blizzard Chat Bubble"] = [[Interface\Tooltips\ChatBubble-Backdrop]]
lib.MediaTable.border["Blizzard Dialog"] = [[Interface\DialogFrame\UI-DialogBox-Border]] lib.MediaTable.border["Blizzard Dialog"] = [[Interface\DialogFrame\UI-DialogBox-Border]]
lib.MediaTable.border["Blizzard Dialog Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Border]] lib.MediaTable.border["Blizzard Dialog Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Border]]
lib.MediaTable.border["Blizzard Party"] = [[Interface\CHARACTERFRAME\UI-Party-Border]]
lib.MediaTable.border["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Border]] lib.MediaTable.border["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Border]]
lib.DefaultMedia.border = "None"
-- FONT -- FONT
if not lib.MediaTable.font then lib.MediaTable.font = {} end if not lib.MediaTable.font then lib.MediaTable.font = {} end
@@ -91,9 +99,9 @@ if locale == "koKR" then
elseif locale == "zhCN" then elseif locale == "zhCN" then
LOCALE_MASK = lib.LOCALE_BIT_zhCN LOCALE_MASK = lib.LOCALE_BIT_zhCN
-- --
SML_MT_font["伤害数字"] = [[Fonts\ZYKai_C.ttf]] SML_MT_font["伤害数字"] = [[Fonts\ARKai_C.ttf]]
SML_MT_font["默认"] = [[Fonts\ZYKai_T.ttf]] SML_MT_font["默认"] = [[Fonts\ARKai_T.ttf]]
SML_MT_font["聊天"] = [[Fonts\ZYHei.ttf]] SML_MT_font["聊天"] = [[Fonts\ARHei.ttf]]
-- --
lib.DefaultMedia["font"] = "默认" -- someone from zhCN please adjust if needed lib.DefaultMedia["font"] = "默认" -- someone from zhCN please adjust if needed
-- --
@@ -110,11 +118,17 @@ elseif locale == "zhTW" then
elseif locale == "ruRU" then elseif locale == "ruRU" then
LOCALE_MASK = lib.LOCALE_BIT_ruRU LOCALE_MASK = lib.LOCALE_BIT_ruRU
-- --
SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]] SML_MT_font["2002"] = [[Fonts\2002.TTF]]
SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT__.TTF]] SML_MT_font["2002 Bold"] = [[Fonts\2002B.TTF]]
SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS.TTF]] SML_MT_font["AR CrystalzcuheiGBK Demibold"] = [[Fonts\ARHei.TTF]]
SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]] SML_MT_font["AR ZhongkaiGBK Medium (Combat)"] = [[Fonts\ARKai_C.TTF]]
SML_MT_font["Skurri"] = [[Fonts\SKURRI.TTF]] SML_MT_font["AR ZhongkaiGBK Medium"] = [[Fonts\ARKai_T.TTF]]
SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]]
SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT___CYR.TTF]]
SML_MT_font["MoK"] = [[Fonts\K_Pagetext.TTF]]
SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS_CYR.TTF]]
SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]]
SML_MT_font["Skurri"] = [[Fonts\SKURRI_CYR.TTF]]
-- --
lib.DefaultMedia.font = "Friz Quadrata TT" lib.DefaultMedia.font = "Friz Quadrata TT"
-- --
@@ -122,10 +136,17 @@ else
LOCALE_MASK = lib.LOCALE_BIT_western LOCALE_MASK = lib.LOCALE_BIT_western
locale_is_western = true locale_is_western = true
-- --
SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]] SML_MT_font["2002"] = [[Fonts\2002.TTF]]
SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT__.TTF]] SML_MT_font["2002 Bold"] = [[Fonts\2002B.TTF]]
SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS.TTF]] SML_MT_font["AR CrystalzcuheiGBK Demibold"] = [[Fonts\ARHei.TTF]]
SML_MT_font["Skurri"] = [[Fonts\SKURRI.TTF]] SML_MT_font["AR ZhongkaiGBK Medium (Combat)"] = [[Fonts\ARKai_C.TTF]]
SML_MT_font["AR ZhongkaiGBK Medium"] = [[Fonts\ARKai_T.TTF]]
SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]]
SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT__.TTF]]
SML_MT_font["MoK"] = [[Fonts\K_Pagetext.TTF]]
SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS_CYR.TTF]]
SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]]
SML_MT_font["Skurri"] = [[Fonts\SKURRI_CYR.TTF]]
-- --
lib.DefaultMedia.font = "Friz Quadrata TT" lib.DefaultMedia.font = "Friz Quadrata TT"
-- --
@@ -134,11 +155,13 @@ end
-- STATUSBAR -- STATUSBAR
if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end
lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]] lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]]
lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]]
lib.MediaTable.statusbar["Solid"] = [[Interface\Buttons\WHITE8X8]]
lib.DefaultMedia.statusbar = "Blizzard" lib.DefaultMedia.statusbar = "Blizzard"
-- SOUND -- SOUND
if not lib.MediaTable.sound then lib.MediaTable.sound = {} end if not lib.MediaTable.sound then lib.MediaTable.sound = {} end
lib.MediaTable.sound["None"] = [[Interface\Quiet.mp3]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input. lib.MediaTable.sound["None"] = [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on these values.
lib.DefaultMedia.sound = "None" lib.DefaultMedia.sound = "None"
local function rebuildMediaList(mediatype) local function rebuildMediaList(mediatype)
@@ -162,8 +185,18 @@ function lib:Register(mediatype, key, data, langmask)
if type(key) ~= "string" then if type(key) ~= "string" then
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key)) error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
end end
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end
mediatype = mediatype:lower() mediatype = mediatype:lower()
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then
-- ignore fonts that aren't flagged as supporting local glyphs on non-western clients
return false
end
if mediatype == lib.MediaType.SOUND and type(data) == "string" then
local path = data:lower()
if not path:find(".ogg", nil, true) and not path:find(".mp3", nil, true) and not path:find(".wav", nil, true) then
-- Only wav, ogg and mp3 are valid sounds.
return false
end
end
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end if not mediaTable[mediatype] then mediaTable[mediatype] = {} end
local mtable = mediaTable[mediatype] local mtable = mediaTable[mediatype]
if mtable[key] then return false end if mtable[key] then return false end
@@ -178,8 +211,7 @@ function lib:Fetch(mediatype, key, noDefault)
local mtt = mediaTable[mediatype] local mtt = mediaTable[mediatype]
local overridekey = overrideMedia[mediatype] local overridekey = overrideMedia[mediatype]
local result = mtt and ((overridekey and mtt[overridekey] or mtt[key]) or (not noDefault and defaultMedia[mediatype] and mtt[defaultMedia[mediatype]])) or nil local result = mtt and ((overridekey and mtt[overridekey] or mtt[key]) or (not noDefault and defaultMedia[mediatype] and mtt[defaultMedia[mediatype]])) or nil
return result ~= "" and result or nil
return result
end end
function lib:IsValid(mediatype, key) function lib:IsValid(mediatype, key)
@@ -1,20 +0,0 @@
## Interface: 30000
## X-Curse-Packaged-Version: 2
## X-Curse-Project-Name: LibSharedMedia-3.0
## X-Curse-Project-ID: libsharedmedia-3-0
## X-Curse-Repository-ID: wow/libsharedmedia-3-0/mainline
## Title: Lib: SharedMedia-3.0
## Notes: Shared handling of media data (fonts, sounds, textures, ...) between addons.
## Author: Elkano
## Version: 3.0-59
## X-Website: http://www.wowace.com/projects/libsharedmedia-3-0/
## X-Category: Library
## X-Revision: 59
## X-Date: 2009-03-06T10:12:34Z
LibStub\LibStub.lua
CallbackHandler-1.0\CallbackHandler-1.0.lua
LibSharedMedia-3.0\lib.xml
@@ -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="LibSharedMedia-3.0.lua" />
</Ui>
@@ -1,30 +0,0 @@
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
function LibStub:IterateLibraries() return pairs(self.libs) end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
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">
<Include file="LibSharedMedia-3.0\lib.xml" />
</Ui>
+49 -1
View File
@@ -1,6 +1,47 @@
local Auras = {} local Auras = {}
local stealableColor = {r = 1, g = 1, b = 1} local stealableColor = {r = 1, g = 1, b = 1}
local playerUnits = {player = true, vehicle = true, pet = true} local playerUnits = {player = true, vehicle = true, pet = true}
-- CoA: UnitAura "HARMFUL|RAID" only honours vanilla class dispels; custom classes
-- need a manual type check. playerCoaDispels is nil until first checked, false if
-- the player is not a dispelling CoA class, or a {type=true} set if they are.
local playerCoaDispels
-- Class tokens: MONK = Templar, PROPHET = Venomancer, WILDWALKER = Primalist
-- (CoA in-game display names differ from internal class tokens).
local COA_CLASS_DISPELS = {
["CHRONOMANCER"] = { Magic = true, Curse = true, Disease = true, Poison = true },
["MONK"] = { Magic = true, Disease = true, Poison = true }, -- Templar (Rebuke)
["PROPHET"] = { Poison = true }, -- Venomancer (Antivenom)
["PYROMANCER"] = { Disease = true, Poison = true },
["RANGER"] = { Disease = true, Poison = true },
["CULTIST"] = { Curse = true },
["SONOFARUGAL"] = { Curse = true },
["SPIRITMAGE"] = { Magic = true },
["STARCALLER"] = { Magic = true },
["WITCHHUNTER"] = { Curse = true },
["SUNCLERIC"] = { Magic = true, Disease = true, Poison = true }, -- Sanctify
["WILDWALKER"] = { Disease = true, Poison = true }, -- Primalist (Soothing Touch — DBC says Magic, gameplay is Poison/Disease)
["WITCHDOCTOR"] = { Curse = true, Disease = true, Poison = true }, -- Hexbreak (806240, single-target Curse) + Cleansing Idol (504840, AoE Disease/Poison)
["TINKER"] = { Disease = true, Poison = true }, -- Nanobot Cleanser
}
local function getCoaDispels()
if playerCoaDispels ~= nil then return playerCoaDispels end
-- Trust the COA_CLASS_DISPELS table directly: it only contains custom-class
-- tokens, so any token-match implies the player IS a dispelling custom
-- class. Avoids C_Player.IsCustomClass timing/availability issues (the
-- API isn't reliable for every class on every login — Witchdoctor in
-- particular was getting cached as false on raid frames).
local _, token = UnitClass("player")
if not token or token == "" then
-- UnitClass not ready yet (very early init); don't cache — retry on
-- the next scan so we pick it up once in-world.
return nil
end
playerCoaDispels = COA_CLASS_DISPELS[token] or false
return playerCoaDispels
end
-- Expose for other modules (highlight.lua) so the dispel set stays single-source.
ShadowUF.GetCoaDispels = getCoaDispels
local mainHand, offHand = {time = 0}, {time = 0} local mainHand, offHand = {time = 0}, {time = 0}
local tempEnchantScan local tempEnchantScan
ShadowUF:RegisterModule(Auras, "auras", ShadowUF.L["Auras"]) ShadowUF:RegisterModule(Auras, "auras", ShadowUF.L["Auras"])
@@ -479,6 +520,13 @@ end
local function scan(parent, frame, type, config, filter) local function scan(parent, frame, type, config, filter)
if( frame.totalAuras >= frame.maxAuras or not config.enabled ) then return end if( frame.totalAuras >= frame.maxAuras or not config.enabled ) then return end
-- CoA: |RAID is not honoured for custom classes; override with manual type check.
local coaFilter
if filter == "HARMFUL|RAID" then
coaFilter = getCoaDispels()
if coaFilter then filter = "HARMFUL" end
end
local isFriendly = UnitIsFriend(frame.parent.unit, "player") local isFriendly = UnitIsFriend(frame.parent.unit, "player")
local index = 0 local index = 0
while( true ) do while( true ) do
@@ -486,7 +534,7 @@ local function scan(parent, frame, type, config, filter)
local name, rank, texture, count, auraType, duration, endTime, caster, isStealable = UnitAura(frame.parent.unit, index, filter) local name, rank, texture, count, auraType, duration, endTime, caster, isStealable = UnitAura(frame.parent.unit, index, filter)
if( not name ) then break end if( not name ) then break end
if( ( not config.player or playerUnits[caster] ) and ( not parent.whitelist[type] and not parent.blacklist[type] or parent.whitelist[type] and parent.whitelist[name] or parent.blacklist[type] and not parent.blacklist[name] ) ) then if( ( not coaFilter or (auraType and coaFilter[auraType]) ) and ( not config.player or playerUnits[caster] ) and ( not parent.whitelist[type] and not parent.blacklist[type] or parent.whitelist[type] and parent.whitelist[name] or parent.blacklist[type] and not parent.blacklist[name] ) ) then
-- Create any buttons we need -- Create any buttons we need
frame.totalAuras = frame.totalAuras + 1 frame.totalAuras = frame.totalAuras + 1
if( #(frame.buttons) < frame.totalAuras ) then if( #(frame.buttons) < frame.totalAuras ) then
+24 -1
View File
@@ -150,6 +150,29 @@ end
function Highlight:UpdateAura(frame) function Highlight:UpdateAura(frame)
-- In theory, we don't need aura scanning because the first debuff returned is always one we can cure... in theory -- In theory, we don't need aura scanning because the first debuff returned is always one we can cure... in theory
frame.highlight.hasDebuff = UnitIsFriend(frame.unit, "player") and select(5, UnitDebuff(frame.unit, 1, "RAID")) or nil if not UnitIsFriend(frame.unit, "player") then
frame.highlight.hasDebuff = nil
return self:Update(frame)
end
-- CoA: "RAID" filter doesn't know about custom dispel classes (Witchdoctor, Templar, …);
-- if the player is one of those, scan all debuffs and match against our dispel set.
local coaDispels = ShadowUF.GetCoaDispels and ShadowUF.GetCoaDispels()
if coaDispels then
local hit
local i = 1
while true do
local name, _, _, _, dispelType = UnitDebuff(frame.unit, i)
if not name then break end
if dispelType and coaDispels[dispelType] then
hit = dispelType
break
end
i = i + 1
end
frame.highlight.hasDebuff = hit
else
frame.highlight.hasDebuff = select(5, UnitDebuff(frame.unit, 1, "RAID")) or nil
end
self:Update(frame) self:Update(frame)
end end
+4 -2
View File
@@ -70,10 +70,12 @@ function Portrait:Update(frame, event)
-- Use class thingy -- Use class thingy
if( type == "class" ) then if( type == "class" ) then
local classToken = select(2, UnitClass(frame.unitOwner)) local classToken = select(2, UnitClass(frame.unitOwner))
if( classToken ) then local coords = classToken and CLASS_ICON_TCOORDS[classToken]
if( coords ) then
frame.portrait:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes") frame.portrait:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes")
frame.portrait:SetTexCoord(CLASS_ICON_TCOORDS[classToken][1], CLASS_ICON_TCOORDS[classToken][2], CLASS_ICON_TCOORDS[classToken][3], CLASS_ICON_TCOORDS[classToken][4]) frame.portrait:SetTexCoord(coords[1], coords[2], coords[3], coords[4])
else else
-- CoA custom classes (Witchdoctor/Templar/…) have no CLASS_ICON_TCOORDS entry; blank instead of crash
frame.portrait:SetTexture("") frame.portrait:SetTexture("")
end end
-- Use 2D character image -- Use 2D character image
+57 -4
View File
@@ -2,12 +2,32 @@ local Totems = {}
local totemColors = {} local totemColors = {}
local MAX_TOTEMS = MAX_TOTEMS local MAX_TOTEMS = MAX_TOTEMS
-- CoA: per-class slot count override (different from shaman's 4).
local COA_CLASS_TOTEMS = {
WITCHDOCTOR = 3,
}
-- Death Knights untalented ghouls are guardians and are considered totems........... so set it up for them -- Death Knights untalented ghouls are guardians and are considered totems........... so set it up for them
if( select(2, UnitClass("player")) == "DEATHKNIGHT" ) then local playerClass = select(2, UnitClass("player"))
if( playerClass == "DEATHKNIGHT" ) then
MAX_TOTEMS = 1 MAX_TOTEMS = 1
ShadowUF:RegisterModule(Totems, "totemBar", ShadowUF.L["Guardian bar"], true, "DEATHKNIGHT") ShadowUF:RegisterModule(Totems, "totemBar", ShadowUF.L["Guardian bar"], true, "DEATHKNIGHT")
else else
ShadowUF:RegisterModule(Totems, "totemBar", ShadowUF.L["Totem bar"], true, "SHAMAN") -- CoA: SHAMAN is the vanilla totem class, but CoA custom classes (Witchdoctor, …) also use the
-- multi-cast totem bar. Detect via MAX_TOTEMS > 1 (set by FrameXML for totem classes) or the
-- HasMultiCastActionBar API (Bartender uses the same probe). Register with class=nil so the
-- module is available to any CoA totem class, not just SHAMAN.
local hasTotems = (MAX_TOTEMS and MAX_TOTEMS > 1)
or (type(HasMultiCastActionBar) == "function" and HasMultiCastActionBar())
or playerClass == "SHAMAN"
if COA_CLASS_TOTEMS[playerClass] then
MAX_TOTEMS = COA_CLASS_TOTEMS[playerClass]
end
if( hasTotems ) then
ShadowUF:RegisterModule(Totems, "totemBar", ShadowUF.L["Totem bar"], true)
else
ShadowUF:RegisterModule(Totems, "totemBar", ShadowUF.L["Totem bar"], true, "SHAMAN")
end
end end
function Totems:OnEnable(frame) function Totems:OnEnable(frame)
@@ -17,11 +37,27 @@ function Totems:OnEnable(frame)
for id=1, MAX_TOTEMS do for id=1, MAX_TOTEMS do
local totem = ShadowUF.Units:CreateBar(frame) local totem = ShadowUF.Units:CreateBar(frame)
totem:SetFrameLevel(1) -- Sit above the parent unit button (RegisterForClicks "AnyUp" + frame.menu)
-- so right-clicks land on the totem strip instead of opening the unit popup.
totem:SetFrameLevel((frame.topFrameLevel or 5) + 5)
totem:SetMinMaxValues(0, 1) totem:SetMinMaxValues(0, 1)
totem:SetValue(0) totem:SetValue(0)
totem.id = MAX_TOTEMS == 1 and 1 or TOTEM_PRIORITIES[id] totem.id = MAX_TOTEMS == 1 and 1 or TOTEM_PRIORITIES[id]
-- Right-click dismisses the totem in this slot. EnableMouse on the strip
-- absorbs clicks here (loses click-to-target on the totem bar only).
totem:EnableMouse(true)
totem:SetScript("OnMouseUp", function(self, button)
if button == "RightButton" and self.have then
DestroyTotem(self.id)
end
end)
-- Seconds-remaining text, centred on the bar; updated by totemMonitor.
totem.timeText = totem:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
totem.timeText:SetPoint("CENTER", totem, "CENTER", 0, 0)
totem.timeText:SetText("")
if( id > 1 ) then if( id > 1 ) then
totem:SetPoint("TOPLEFT", frame.totemBar.totems[id - 1], "TOPRIGHT", 1, 0) totem:SetPoint("TOPLEFT", frame.totemBar.totems[id - 1], "TOPRIGHT", 1, 0)
else else
@@ -74,10 +110,23 @@ end
local function totemMonitor(self, elapsed) local function totemMonitor(self, elapsed)
local time = GetTime() local time = GetTime()
self:SetValue(self.endTime - time) local remaining = self.endTime - time
self:SetValue(remaining)
if self.timeText then
local intSec = remaining > 0 and math.floor(remaining) or 0
if intSec ~= self.lastIntSec then
self.lastIntSec = intSec
self.timeText:SetText(intSec > 0 and intSec or "")
end
end
if( time >= self.endTime ) then if( time >= self.endTime ) then
self:SetValue(0) self:SetValue(0)
if self.timeText then
self.timeText:SetText("")
self.lastIntSec = nil
end
self:SetScript("OnUpdate", nil) self:SetScript("OnUpdate", nil)
end end
end end
@@ -101,6 +150,10 @@ function Totems:Update(frame)
indicator:SetScript("OnUpdate", nil) indicator:SetScript("OnUpdate", nil)
indicator:SetMinMaxValues(0, 1) indicator:SetMinMaxValues(0, 1)
indicator:SetValue(0) indicator:SetValue(0)
if indicator.timeText then
indicator.timeText:SetText("")
indicator.lastIntSec = nil
end
end end
end end
+9 -1
View File
@@ -753,7 +753,15 @@ function Units:SetHeaderAttributes(frame, type)
frame:SetAttribute("groupFilter", filter or "1,2,3,4,5,6,7,8") frame:SetAttribute("groupFilter", filter or "1,2,3,4,5,6,7,8")
if( config.groupBy == "CLASS" ) then if( config.groupBy == "CLASS" ) then
frame:SetAttribute("groupingOrder", "DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,ROGUE,SHAMAN,WARLOCK,WARRIOR") -- CoA: build groupingOrder dynamically from RAID_CLASS_COLORS so all 21 CoA custom
-- classes (populated via CUSTOM_CLASS_COLORS) are included. Hardcoding the 10
-- vanilla classes silently drops Witchdoctor/Templar/… into an unsorted tail.
local orderedClasses = {}
for classToken in pairs(RAID_CLASS_COLORS) do
table.insert(orderedClasses, classToken)
end
table.sort(orderedClasses)
frame:SetAttribute("groupingOrder", table.concat(orderedClasses, ","))
frame:SetAttribute("groupBy", "CLASS") frame:SetAttribute("groupBy", "CLASS")
else else
frame:SetAttribute("groupingOrder", "1,2,3,4,5,6,7,8") frame:SetAttribute("groupingOrder", "1,2,3,4,5,6,7,8")
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# Build per-addon zip artefacts from HEAD via git-archive.
#
# - Discovers top-level addon folders (Foo/Foo.toc).
# - Re-creates dist/ each run.
# - Always archives HEAD, so the working tree state is irrelevant.
# - If more than one addon folder is present, also emits <repo>-all.zip
# with every addon folder side-by-side at the zip root.
# - When run inside Gitea Actions the working tree lives under a
# per-job dir like /var/lib/act_runner/work/.../hostexecutor, so the
# repo name comes from $GITHUB_REPOSITORY (set by the runner) and
# only falls back to the toplevel basename for local invocations.
set -euo pipefail
root=$(git rev-parse --show-toplevel)
cd "$root"
# Gitea Actions sets GITHUB_REPOSITORY=owner/repo. The basename of
# `git rev-parse --show-toplevel` inside the runner is the worker dir
# (e.g. `hostexecutor`), which would name the bundle wrong.
if [ -n "${GITHUB_REPOSITORY:-}" ]; then
repo_name="${GITHUB_REPOSITORY##*/}"
else
repo_name=$(basename "$root")
fi
dist="$root/dist"
# Find Foo/Foo.toc pairs at depth 1; ignore libs nested deeper.
addons=()
while IFS= read -r toc; do
dir=$(dirname "$toc")
folder=$(basename "$dir")
base=$(basename "$toc" .toc)
# Accept Foo.toc and Foo_Wrath.toc style flavour variants; folder must match
# at least one toc basename prefix (Foo).
case "$base" in
"$folder"|"$folder"_*) addons+=("$folder") ;;
esac
done < <(command find . -mindepth 2 -maxdepth 2 -type f -name '*.toc' | sed 's|^\./||' | sort)
# Dedupe (a folder with Foo.toc + Foo_Wrath.toc shows up twice).
if [ ${#addons[@]} -gt 0 ]; then
mapfile -t addons < <(printf '%s\n' "${addons[@]}" | awk '!seen[$0]++')
fi
if [ ${#addons[@]} -eq 0 ]; then
echo "no addon folders found (looking for */Foo.toc with matching folder name)" >&2
exit 1
fi
rm -rf "$dist"
mkdir -p "$dist"
for folder in "${addons[@]}"; do
out="$dist/$folder.zip"
# No --prefix: the folder already sits at the repo root, so git-archive
# emits entries as <folder>/... which is exactly what
# Interface/AddOns/ expects after extraction.
git archive HEAD --format=zip -o "$out" -- "$folder"
echo "built dist/$folder.zip"
done
# Combined bundle only makes sense when there are multiple addons.
if [ ${#addons[@]} -gt 1 ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
git archive HEAD --format=tar -- "${addons[@]}" | tar -x -C "$tmp"
out="$dist/$repo_name-all.zip"
( cd "$tmp" && zip -qr "$out" "${addons[@]}" )
echo "built dist/$repo_name-all.zip"
fi