WoWInterface SVN ChatScroll

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

trunk/ChatScroll/Libs/LibStub.lua New file
0,0 → 1,30
-- 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
Property changes : Added: svn:executable + *
trunk/ChatScroll/ChatScroll.lua
9,6 → 9,9
-ChatFrame Mouse Wheel Scroll
 
Change List
v3.1
- More agressive button hiding
- Better saved variable initialization
v3.0
- Updated for WoW 3.0
- Added Portfolio Options, Removed Khaos Options
41,12 → 44,8
 
ChatScroll = {};
 
-- For manually changing settings use these two variables (these will not override Khaos settings)
ChatScroll.Enabled = true;
ChatScroll.Hide_Buttons = false;
 
function ChatScroll.OnMouseWheel(chatframe, value)
if ( ChatScroll.Enabled ) then
if ( ChatScroll_SavedVars and ChatScroll_SavedVars.EnableScrolling == "1" ) then
if ( IsShiftKeyDown() ) then
if ( value > 0 ) then
chatframe:ScrollToTop()
73,45 → 72,51
SELECTED_DOCK_FRAME:ScrollToTop();
end
 
function ChatScroll.UpdateScrollButtons()
ChatScroll.SetScrollButtonVisibility(ChatScroll.Hide_Buttons)
end
 
function ChatScroll.SetScrollButtonVisibility(toggle)
if (toggle) then
ChatScroll.Hide_Buttons = true;
function ChatScroll.UpdateButtons()
local hidden = ChatScroll_SavedVars and ChatScroll_SavedVars.HideChatButtons == "1"
if hidden then
ChatFrameMenuButton:Hide()
else
ChatScroll.Hide_Buttons = false;
ChatFrameMenuButton:Show()
end
 
local frameName
local frameName, up, down, bottom
for i=1, NUM_CHAT_WINDOWS do
frameName = "ChatFrame"..i
if (toggle) then
getglobal(frameName.."UpButton"):Hide()
getglobal(frameName.."DownButton"):Hide()
getglobal(frameName.."BottomButton"):Hide()
up = getglobal(frameName.."UpButton")
down = getglobal(frameName.."DownButton")
bottom = getglobal(frameName.."BottomButton")
if hidden then
up:Hide()
down:Hide()
bottom:Hide()
else
getglobal(frameName.."UpButton"):Show()
getglobal(frameName.."DownButton"):Show()
getglobal(frameName.."BottomButton"):Show()
up:Show()
down:Show()
bottom:Show()
end
end
end
 
function ChatScroll.SetScrollEnabled(toggle)
ChatScroll.Enabled = toggle;
end
 
-- <= == == == == == == == == == == == == =>
-- => Execution
-- => Init Hooks
-- <= == == == == == == == == == == == == =>
 
-- Set up hooks
local function ScrollButton_OnShow(self)
if (ChatScroll_SavedVars and ChatScroll_SavedVars.HideChatButtons) then
self:Hide()
end
end
 
hooksecurefunc(ChatFrameMenuButton, "Show", ScrollButton_OnShow)
 
for i=1, NUM_CHAT_WINDOWS do
local frame = getglobal("ChatFrame"..i);
local frameName = "ChatFrame"..i
hooksecurefunc(_G[frameName.."UpButton"], "Show", ScrollButton_OnShow)
hooksecurefunc(_G[frameName.."DownButton"], "Show", ScrollButton_OnShow)
hooksecurefunc(_G[frameName.."BottomButton"], "Show", ScrollButton_OnShow)
 
local frame = _G[frameName];
frame:EnableMouseWheel(1);
if (type(frame:GetScript("OnMouseWheel")) == "function") then
frame:HookScript("OnMouseWheel", ChatScroll.OnMouseWheel);
119,12 → 124,14
frame:SetScript("OnMouseWheel", ChatScroll.OnMouseWheel);
end
end
hooksecurefunc("FCF_UpdateButtonSide", ChatScroll.UpdateScrollButtons);
 
-- Update Button Visibility
ChatScroll.SetScrollButtonVisibility(ChatScroll.Hide_Buttons)
-- <= == == == == == == == == == == == == =>
-- => Portfolio GUI Config
-- <= == == == == == == == == == == == == =>
 
-- Register with Portfolio
local savedVarTableName = "ChatScroll_SavedVars"
 
local Portfolio = LibStub("Portfolio")
if (Portfolio) then
local optionSet = {
id="ChatScroll";
133,25 → 140,27
options={
{
id="EnableScrolling";
tvar="Enabled";
text= CHATSCROLL_CONFIG_ENABLE;
tooltipText= CHATSCROLL_CONFIG_ENABLE_INFO;
text=CHATSCROLL_CONFIG_ENABLE;
tooltipText=CHATSCROLL_CONFIG_ENABLE_INFO;
type=CONTROLTYPE_CHECKBOX;
callback=function(value) ChatScroll.SetScrollEnabled(value=="1") end;
defaultValue = "1";
};
{
id="HideChatButtons";
tvar="Hide_Buttons";
text=CHATSCROLL_BUTTONS_HIDE;
tooltipText=CHATSCROLL_BUTTONS_HIDE_INFO;
type=CONTROLTYPE_CHECKBOX;
callback=function(value) ChatScroll.SetScrollButtonVisibility(value=="1") end;
callback=ChatScroll.UpdateButtons;
defaultValue = "0";
};
};
savedVarTable = "ChatScroll_SavedVars",
loadVars = true,
savedVarTable = savedVarTableName,
};
Portfolio.RegisterOptionSet(optionSet);
else
local loader = LibStub("LibDefaults")
local addonName = "ChatScroll"
loader:SetDefault(addonName, savedVarTableName, "EnableScrolling", "1")
loader:SetDefault(addonName, savedVarTableName, "HideChatButtons", "0")
loader:SetScript(addonName, ChatScroll.UpdateButtons)
end
trunk/ChatScroll/ChatScroll.toc
6,14 → 6,11
## Author: AnduinLothar
## OptionalDeps: Portfolio
## SavedVariables: ChatScroll_SavedVars
## Version: 3.0
## X-Date: Oct 14 2008
## Version: 3.1
## X-Date: Oct 25 2008
## X-Category: Chat
## X-Website: http://www.wowinterface.com/downloads/info5359-ChatScroll.html
## X-Email: karlkfi@yahoo.com
## X-Localizations: enUS, deDE, frFR
## X-CompatibleLocales: enUS, enGB, deDE, frFR
localization.en.lua
localization.de.lua
localization.fr.lua
ChatScroll.lua
Loader.xml
trunk/ChatScroll/Loader.xml New file
0,0 → 1,17
<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">
 
<!-- Libs -->
<Script file="Libs\LibStub.lua"/>
<Script file="Libs\LibDefaults.lua"/>
 
<!-- Localization -->
<Script file="localization.en.lua"/>
<Script file="localization.de.lua"/>
<Script file="localization.fr.lua"/>
 
<!-- ChatScroll -->
<Script file="ChatScroll.lua"/>
 
</Ui>