WoWInterface SVN TipTop

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/TipTop/libs
    from Rev 31 to Rev 32
    Reverse comparison

Rev 31 → Rev 32

AceGUI-3.0/widgets/AceGUIWidget-ScrollFrame.lua New file
0,0 → 1,225
local AceGUI = LibStub("AceGUI-3.0")
 
-------------
-- 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
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
 
 
]]
 
--------------------------
-- Scroll Frame --
--------------------------
do
local Type = "ScrollFrame"
local Version = 3
 
local function OnAcquire(self)
 
end
 
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
self.status = nil
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
end
 
local function SetScroll(self, value)
 
local status = self.status or self.localstatus
 
local frame, child = self.scrollframe, self.content
local viewheight = frame:GetHeight()
local height = child:GetHeight()
local offset
if viewheight > height then
offset = 0
else
offset = floor((height - viewheight) / 1000.0 * value)
end
child:ClearAllPoints()
child:SetPoint("TOPLEFT",frame,"TOPLEFT",0,offset)
child:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,offset)
status.offset = offset
status.scrollvalue = value
end
 
local function MoveScroll(self, value)
local status = self.status or self.localstatus
local frame, child = self.scrollframe, self.content
local height, viewheight = frame:GetHeight(), child:GetHeight()
if height > viewheight then
self.scrollbar:Hide()
else
self.scrollbar:Show()
local diff = height - viewheight
local delta = 1
if value < 0 then
delta = -1
end
self.scrollbar:SetValue(math.min(math.max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000))
end
end
 
 
local function FixScroll(self)
local status = self.status or self.localstatus
local frame, child = self.scrollframe, self.content
local height, viewheight = frame:GetHeight(), child:GetHeight()
local offset = status.offset
if not offset then
offset = 0
end
local curvalue = self.scrollbar:GetValue()
if viewheight < height then
self.scrollbar:Hide()
self.scrollbar:SetValue(0)
--self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",0,0)
else
self.scrollbar:Show()
--self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",-16,0)
local value = (offset / (viewheight - height) * 1000)
if value > 1000 then value = 1000 end
self.scrollbar:SetValue(value)
self:SetScroll(value)
if value < 1000 then
child:ClearAllPoints()
child:SetPoint("TOPLEFT",frame,"TOPLEFT",0,offset)
child:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,offset)
status.offset = offset
end
end
end
 
local function OnMouseWheel(this,value)
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)
this.obj:FixScroll()
end
 
local function LayoutFinished(self,width,height)
self.content:SetHeight(height or 0 + 20)
self:FixScroll()
end
 
-- called to set an external table to store status in
local function SetStatusTable(self, status)
assert(type(status) == "table")
self.status = status
if not status.scrollvalue then
status.scrollvalue = 0
end
end
 
 
local createdcount = 0
 
local function OnWidthSet(self, width)
local content = self.content
content.width = width
end
 
 
local function OnHeightSet(self, height)
local content = self.content
content.height = height
end
 
local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent)
local self = {}
self.type = Type
 
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
 
self.MoveScroll = MoveScroll
self.FixScroll = FixScroll
self.SetScroll = SetScroll
self.LayoutFinished = LayoutFinished
self.SetStatusTable = SetStatusTable
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
 
self.localstatus = {}
self.frame = frame
frame.obj = self
 
--Container Support
local scrollframe = CreateFrame("ScrollFrame",nil,frame)
local content = CreateFrame("Frame",nil,scrollframe)
createdcount = createdcount + 1
local scrollbar = CreateFrame("Slider",("AceConfigDialogScrollFrame%dScrollBar"):format(createdcount),scrollframe,"UIPanelScrollBarTemplate")
local scrollbg = scrollbar:CreateTexture(nil,"BACKGROUND")
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetTexture(0,0,0,0.4)
self.scrollframe = scrollframe
self.content = content
self.scrollbar = scrollbar
 
scrollbar.obj = self
scrollframe.obj = self
content.obj = self
 
scrollframe:SetScrollChild(content)
scrollframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",-16,0)
scrollframe:EnableMouseWheel(true)
scrollframe:SetScript("OnMouseWheel", OnMouseWheel)
scrollframe:SetScript("OnSizeChanged", OnSizeChanged)
 
 
content:SetPoint("TOPLEFT",scrollframe,"TOPLEFT",0,0)
content:SetPoint("TOPRIGHT",scrollframe,"TOPRIGHT",0,0)
content:SetHeight(400)
 
scrollbar:SetPoint("TOPLEFT",scrollframe,"TOPRIGHT",0,-16)
scrollbar:SetPoint("BOTTOMLEFT",scrollframe,"BOTTOMRIGHT",0,16)
scrollbar:SetScript("OnValueChanged", OnScrollValueChanged)
scrollbar:SetMinMaxValues(0,1000)
scrollbar:SetValueStep(1)
scrollbar:SetValue(0)
scrollbar:SetWidth(16)
 
self.localstatus.scrollvalue = 0
 
 
self:FixScroll()
AceGUI:RegisterAsContainer(self)
--AceGUI:RegisterAsWidget(self)
return self
end
 
AceGUI:RegisterWidgetType(Type,Constructor,Version)
end
Property changes : Added: svn:eol-style + native Added: svn:mime-type + text/plain
AceGUI-3.0/widgets/AceGUIWidget-TreeGroup.lua
27,7 → 27,7
 
do
local Type = "TreeGroup"
local Version = 16
local Version = 17
 
local DEFAULT_TREE_WIDTH = 175
local DEFAULT_TREE_SIZABLE = true
286,7 → 286,8
},
}
]]
local function SetTree(self, tree)
local function SetTree(self, tree, filter)
self.filter = filter
if tree then
assert(type(tree) == "table")
end
294,33 → 295,52
self:RefreshTree()
end
 
local function ShouldDisplayLevel(tree)
local result = false
for k, v in ipairs(tree) do
if v.children == nil and v.visible ~= false then
result = true
elseif v.children then
result = result or ShouldDisplayLevel(v.children)
end
if result then return result end
end
return false
end
 
local function addLine(self, v, tree, level, parent)
local line = new()
line.value = v.value
line.text = v.text
line.disabled = v.disabled
line.tree = tree
line.level = level
line.parent = parent
line.visible = v.visible
line.uniquevalue = GetButtonUniqueValue(line)
if v.children then
line.hasChildren = true
else
line.hasChildren = nil
end
self.lines[#self.lines+1] = line
return line
end
 
local function BuildLevel(self, tree, level, parent)
local lines = self.lines
 
local status = (self.status or self.localstatus)
local groups = status.groups
local groups = (self.status or self.localstatus).groups
local hasChildren = self.hasChildren
 
for i, v in ipairs(tree) do
local line = new()
lines[#lines+1] = line
line.value = v.value
line.text = v.text
line.disabled = v.disabled
line.tree = tree
line.level = level
line.parent = parent
line.uniquevalue = GetButtonUniqueValue(line)
 
if v.children then
line.hasChildren = true
else
line.hasChildren = nil
end
if v.children then
if groups[line.uniquevalue] then
self:BuildLevel(v.children, level+1, line)
if not self.filter or ShouldDisplayLevel(v.children) then
local line = addLine(self, v, tree, level, parent)
if groups[line.uniquevalue] then
self:BuildLevel(v.children, level+1, line)
end
end
elseif v.visible ~= false or not self.filter then
addLine(self, v, tree, level, parent)
end
end
end
337,7 → 357,7
end
 
local function RefreshTree(self)
local buttons = self.buttons
local buttons = self.buttons
local lines = self.lines
 
for i, v in ipairs(buttons) do
436,6 → 456,7
end
 
local function Select(self, uniquevalue, ...)
self.filter = false
local status = self.status or self.localstatus
local groups = status.groups
for i = 1, select('#', ...) do
577,6 → 598,7
self.hasChildren = {}
self.localstatus = {}
self.localstatus.groups = {}
self.filter = false
 
local treeframe = CreateFrame("Frame",nil,frame)
treeframe.obj = self
626,6 → 648,7
self.OnWidthSet = OnWidthSet
self.OnHeightSet = OnHeightSet
self.EnableButtonTooltips = EnableButtonTooltips
self.Filter = Filter
 
self.frame = frame
frame.obj = self
AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua
11,7 → 11,7
]]
do
local Type = "EditBox"
local Version = 8
local Version = 9
 
local function OnAcquire(self)
self:SetDisabled(false)
124,11 → 124,13
self.label:Show()
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18)
self.frame:SetHeight(44)
self.alignoffset = 30
else
self.label:SetText("")
self.label:Hide()
self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0)
self.frame:SetHeight(26)
self.alignoffset = 12
end
end
 
AceGUI-3.0/widgets/AceGUIWidget-Label.lua New file
0,0 → 1,132
local AceGUI = LibStub("AceGUI-3.0")
 
--------------------------
-- Label --
--------------------------
do
local Type = "Label"
local Version = 8
 
local function OnAcquire(self)
self:SetText("")
self:SetImage(nil)
self:SetColor()
end
 
local function OnRelease(self)
self.frame:ClearAllPoints()
self.frame:Hide()
end
 
local function UpdateImageAnchor(self)
local width = self.frame.width or self.frame:GetWidth() or 0
local image = self.image
local label = self.label
local frame = self.frame
local height
 
label:ClearAllPoints()
image:ClearAllPoints()
 
if self.imageshown then
local imagewidth = image:GetWidth()
if (width - imagewidth) < 200 or (label:GetText() or "") == "" then
--image goes on top centered when less than 200 width for the text, or if there is no text
image:SetPoint("TOP",frame,"TOP",0,0)
label:SetPoint("TOP",image,"BOTTOM",0,0)
label:SetPoint("LEFT",frame,"LEFT",0,0)
label:SetWidth(width)
height = image:GetHeight() + label:GetHeight()
else
--image on the left
image:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
label:SetPoint("TOPLEFT",image,"TOPRIGHT",0,0)
label:SetWidth(width - imagewidth)
height = math.max(image:GetHeight(), label:GetHeight())
end
else
--no image shown
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
label:SetWidth(width)
height = self.label:GetHeight()
end
 
self.resizing = true
self.frame:SetHeight(height)
self.frame.height = height
self.resizing = nil
end
 
local function SetText(self, text)
self.label:SetText(text or "")
UpdateImageAnchor(self)
end
 
local function SetColor(self, r, g, b)
if not (r and g and b) then
r, g, b = 1, 1, 1
end
self.label:SetVertexColor(r, g, b)
end
 
local function OnWidthSet(self, width)
if self.resizing then return end
UpdateImageAnchor(self)
end
 
local function SetImage(self, path, ...)
local image = self.image
image:SetTexture(path)
 
if image:GetTexture() then
self.imageshown = true
local n = select('#', ...)
if n == 4 or n == 8 then
image:SetTexCoord(...)
end
else
self.imageshown = nil
end
UpdateImageAnchor(self)
end
 
local function SetImageSize(self, width, height)
self.image:SetWidth(width)
self.image:SetHeight(height)
UpdateImageAnchor(self)
end
 
local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent)
local self = {}
self.type = Type
 
self.OnRelease = OnRelease
self.OnAcquire = OnAcquire
self.SetText = SetText
self.SetColor = SetColor
self.frame = frame
self.OnWidthSet = OnWidthSet
self.SetImage = SetImage
self.SetImageSize = SetImageSize
frame.obj = self
 
frame:SetHeight(18)
frame:SetWidth(200)
local label = frame:CreateFontString(nil,"BACKGROUND","GameFontHighlightSmall")
label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
label:SetWidth(200)
label:SetJustifyH("LEFT")
label:SetJustifyV("TOP")
self.label = label
 
local image = frame:CreateTexture(nil,"BACKGROUND")
self.image = image
 
AceGUI:RegisterAsWidget(self)
return self
end
 
AceGUI:RegisterWidgetType(Type,Constructor,Version)
end
 
Property changes : Added: svn:mime-type + text/plain Added: svn:eol-style + native
AceGUI-3.0/AceGUI-3.0.lua
1,4 → 1,7
--[[ $Id: AceGUI-3.0.lua 681 2008-09-06 13:01:59Z nargiddley $ ]]
--- AceGUI-3.0 provides access to numerous widgets which can be used to create GUIs.
-- @class file
-- @name AceGUI-3.0
-- @release $Id: AceGUI-3.0.lua 710 2008-12-19 10:14:39Z nevcairiel $
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 16
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
 
LibSharedMedia-3.0/LibSharedMedia-3.0.lua
1,6 → 1,6
--[[
Name: LibSharedMedia-3.0
Revision: $Revision: 49 $
Revision: $Revision: 53 $
Author: Elkano (elkano@gmx.de)
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
Website: http://www.wowace.com/projects/libsharedmedia-3-0/
9,7 → 9,7
License: LGPL v2.1
]]
 
local MAJOR, MINOR = "LibSharedMedia-3.0", 90000 + tonumber(("$Revision: 49 $"):match("(%d+)"))
local MAJOR, MINOR = "LibSharedMedia-3.0", 90000 + tonumber(("$Revision: 53 $"):match("(%d+)"))
local lib = LibStub:NewLibrary(MAJOR, MINOR)
 
if not lib then return end
156,6 → 156,12
end
 
function lib:Register(mediatype, key, data, langmask)
if type(mediatype) ~= "string" then
error(MAJOR..":Register(mediatype, key, data, langmask) - mediatype must be string, got "..type(mediatype))
end
if type(key) ~= "string" then
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
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()
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end
AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua
1,16 → 1,12
--[[
AceConfigRegistry-3.0:
 
Handle central registration of options tables in use by addons and modules. Do nothing else.
 
Options tables can be registered as raw tables, or as function refs that return a table.
These functions receive two arguments: "uiType" and "uiName".
- Valid "uiTypes": "cmd", "dropdown", "dialog". This is verified by the library at call time.
- The "uiName" field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.
 
:IterateOptionsTables() and :GetOptionsTable() always return a function reference that the requesting config handling addon must call with the above arguments.
]]
 
--- AceConfigRegistry-3.0 handles central registration of options tables in use by addons and modules.
-- Options tables can be registered as raw tables, or as function refs that return a table.<br>
-- These functions receive two arguments: "uiType" and "uiName". <br>
-- Valid "uiTypes": "cmd", "dropdown", "dialog". This is verified by the library at call time. <br>
-- The "uiName" field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.<br>
-- :IterateOptionsTables() and :GetOptionsTable() always return a function reference that the requesting config handling addon must call with the above arguments.
-- @class file
-- @name AceConfigRegistry-3.0
-- @release $Id: AceConfigRegistry-3.0.lua 710 2008-12-19 10:14:39Z nevcairiel $
local MAJOR, MINOR = "AceConfigRegistry-3.0", 6
local lib = LibStub:NewLibrary(MAJOR, MINOR)
 
AceConfig-3.0/AceConfig-3.0.lua
1,4 → 1,10
--[[ $Id: AceConfig-3.0.lua 494 2008-02-03 13:03:56Z nevcairiel $ ]]
--- AceConfig-3.0 wrapper library.
-- Provides an API to register an options table with the config registry,
-- as well as associate it with a slash command.
-- @class file
-- @name AceConfig-3.0
-- @release $Id: AceConfig-3.0.lua 710 2008-12-19 10:14:39Z nevcairiel $
 
--[[
AceConfig-3.0
 
AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua
1,7 → 1,8
--[[
AceConfigDialog-3.0
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
-- @class file
-- @name AceConfigDialog-3.0
-- @release $Id: AceConfigDialog-3.0.lua 710 2008-12-19 10:14:39Z nevcairiel $
 
]]
local LibStub = LibStub
local MAJOR, MINOR = "AceConfigDialog-3.0", 25
local lib = LibStub:NewLibrary(MAJOR, MINOR)
AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua
1,3 → 1,7
--- AceConfigCmd-3.0 handles access to optionstable through the "command line" interface via the ChatFrames.
-- @class file
-- @name AceConfigCmd-3.0
-- @release $Id: AceConfigCmd-3.0.lua 710 2008-12-19 10:14:39Z nevcairiel $
 
--[[
AceConfigCmd-3.0
AceDB-3.0/AceDB-3.0.lua
1,5 → 1,8
--[[ $Id: AceDB-3.0.lua 667 2008-06-11 14:34:58Z nevcairiel $ ]]
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 8
--- AceDB-3.0 allows you to create profiles and smart default values for the SavedVariables of your addon.
-- @class file
-- @name AceDB-3.0
-- @release $Id: AceDB-3.0.lua 717 2009-01-04 10:29:29Z nevcairiel $
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 9
local AceDB, oldminor = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
 
if not AceDB then return end -- No upgrade needed
355,6 → 358,9
local oldProfile = self.profile
local defaults = self.defaults and self.defaults.profile
 
-- Callback: OnProfileShutdown, database
self.callbacks:Fire("OnProfileShutdown", self)
 
if oldProfile and defaults then
-- Remove the defaults from the old profile
removeDefaults(oldProfile, defaults)