WoWInterface SVN MacroSequence

Compare Revisions

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

Rev 1 → Rev 2

trunk/MacroSequence/MacroSequence.lua New file
0,0 → 1,335
MacroSequence = MacroSequence or {}
local L = MacroSequenceLocals
local print = CogsUtils:GetPrint(L.PRINT_HEADER)
 
 
 
-- Initialize saved variable from Sequences.lua
if MacroSequence.sequences then
MacroSequenceSequences = MacroSequence.sequences
print(L.IMPORTED)
end
 
 
 
function MacroSequence:Initialize()
if not MacroSequenceSequences then
MacroSequenceSequences = {}
end
 
for name, data in pairs(MacroSequenceSequences) do
if _G[name] then
print(format(L.NAME_EXISTS, name))
else
self:CreateSequence(name, data)
end
end
end
 
 
 
-- No global variable of name should exist
function MacroSequence:CreateSequence(name, data)
local button = self:NewButton(name)
 
if #data == 0 then
return
end
 
self:ApplySettings(button, data)
end
 
 
 
function MacroSequence:ApplySettings(button, data)
-- Add entries to the sequence
self:CreateSequenceEntries(button, data)
 
-- Only add states and reset conditions if there are multiple entries
if #data > 1 then
-- Set up a newstate attribute to cycle through each possible state
button:SetAttribute("newstate", "0-"..(#data - 1))
 
-- Set up reset conditions for the sequence
self:ApplyResetConditions(button, data)
end
end
 
 
 
function MacroSequence:RemoveSettings(button)
button:GetParent():SetAttribute("state", 0)
for attribute in pairs(button.attributes) do
button:SetAttribute(attribute, nil)
end
end
 
 
 
MacroSequence.freeHeaders = {}
MacroSequence.usedHeaders = {}
MacroSequence.namedButtons = {}
function MacroSequence:NewButton(name)
local header = tremove(self.freeHeaders) or CreateFrame(
"Frame",
nil,
nil,
"SecureStateHeaderTemplate"
)
self.usedHeaders[name] = header -- Add the header to the used pool
 
local button = self.namedButtons[name]
if not button then
button = CreateFrame(
"Button",
name,
header,
"SecureActionButtonTemplate"
)
self.namedButtons[name] = button
 
button:SetAttribute("type", "macro")
 
-- Store attributes for possible removal
button.attributes = {}
button:SetScript("OnAttributeChanged", function(button, name, value)
if value == nil then
button.attributes[name] = nil
if name == "_combatreset" then
button:UnregisterEvent("PLAYER_REGEN_ENABLED")
end
else
button.attributes[name] = true
if name == "_combatreset" then
button:RegisterEvent("PLAYER_REGEN_ENABLED")
end
end
end)
 
-- Used for combat reset, if present
button:SetScript("OnEvent", function(button)
header:SetAttribute("state", 0)
end)
end
header:SetAttribute("addchild", button)
header.button = button
_G[name] = button -- Make a global reference to the button
 
return header.button
end
 
 
 
-- Unused child buttons are parented to this header to satisfy assumptions made
-- by the state header code
local dummyHeader = CreateFrame(
"Frame",
"MacroSequenceDummyHeader",
UIParent,
"SecureStateHeaderTemplate"
)
function MacroSequence:RemoveSequence(name)
local header = self.usedHeaders[name]
local button = header.button
 
-- Clear the button's attributes
self:RemoveSettings(button)
button:SetParent(dummyHeader)
 
-- Remove the sequence from various tables
MacroSequenceSequences[name] = nil
_G[name] = nil
self.usedHeaders[name] = nil
 
-- Put the header into the free pool
tinsert(self.freeHeaders, header)
end
 
 
 
local function deepCopy(inTable)
local outTable = {}
for k, v in pairs(inTable) do
if type(v) == "table" then
outTable[k] = deepCopy(v)
else
outTable[k] = v
end
end
return outTable
end
 
 
 
-- There must not be a global variable named the same as new
function MacroSequence:CopySequence(old, new)
MacroSequenceSequences[new] = deepCopy(MacroSequenceSequences[old])
self:CreateSequence(new, MacroSequenceSequences[new])
 
local oldHeader = self.usedHeaders[old]
local newHeader = self.usedHeaders[new]
local oldButton = oldHeader.button
local newButton = newHeader.button
 
-- Copy attributes between buttons
for name in pairs(oldButton.attributes) do
newButton:SetAttribute(name, oldButton:GetAttribute(name))
end
 
-- Copy state from header
newHeader:SetAttribute("state", oldHeader:GetAttribute("state"))
end
 
 
 
function MacroSequence:RenameSequence(old, new)
self:CopySequence(old, new)
self:RemoveSequence(old)
end
 
 
 
function MacroSequence:CreateSequenceEntries(button, data)
local statebutton = ""
for state, macro in ipairs(data) do
state = state - 1
-- Add a statebutton entry for the current macro in the form "0:b0;"
statebutton = statebutton..format("%d:b%1$d;", state)
-- Create a macrotext attribute using the new statebutton
button:SetAttribute("*macrotext-b"..state, macro)
end
button:SetAttribute("statebutton", statebutton)
end
 
 
 
-- This table describes which prefixes to use for each reset modifier's newstate
-- attribute. For the sake of simplicity, ApplyModifierResets will rewrite
-- certain attributes if multiple modifier resets are used on a single sequence.
local modifierPrefixes = {
alt = {
"alt",
"alt-ctrl",
"alt-shift",
"alt-ctrl-shift"
},
ctrl = {
"ctrl",
"alt-ctrl",
"ctrl-shift",
"alt-ctrl-shift"
},
shift = {
"shift",
"alt-shift",
"ctrl-shift",
"alt-ctrl-shift"
}
}
 
 
 
local resetFuncs = {
-- Combat
function(button, data)
if data.reset.combat then
button:SetAttribute("_combatreset", true)
end
end,
 
 
 
-- Timer
function(button, data)
local seconds = data.reset.seconds
if seconds and seconds > 0 then
-- Switch to state 0 after the specified delay unless the state changes by
-- other means first
button:SetAttribute("delaystate", "0")
button:SetAttribute("delaytime", seconds)
end
end,
 
 
 
-- Modifiers
function(button, data)
for modifier, prefixes in pairs(modifierPrefixes) do
if data.reset[modifier] then
for _, prefix in ipairs(prefixes) do
-- Make the modified click run the first macro in the sequence
button:SetAttribute(prefix.."-statebutton*", "b0")
-- And then move on to the next
button:SetAttribute(prefix.."-newstate*", "1")
end
end
end
end,
 
 
 
-- Cycle
function(button, data)
local cycle = tonumber(data.reset.cycle)
if cycle and cycle < #data then
-- This converts a newstate attribute from, e.g. "0-5" to "5:3;0-5"
button:SetAttribute("newstate", format(
"%d:%d;%s",
#data - 1,
#data - cycle,
button:GetAttribute("newstate")
))
end
end
}
 
 
function MacroSequence:ApplyResetConditions(button, data)
if not data.reset then
return
end
for _, func in ipairs(resetFuncs) do
func(button, data)
end
end
 
 
 
function MacroSequence:ShowGUI()
if not IsAddOnLoaded("MacroSequenceGUI") then
LoadAddOn("MacroSequenceGUI")
end
MacroSequenceGUI:Show()
end
 
 
 
local events = {
["VARIABLES_LOADED"] = function()
MacroSequence:Initialize()
end,
["PLAYER_DEAD"] = function()
for _, header in ipairs(MacroSequence.usedHeaders) do
header:SetAttribute("state", 0)
end
end,
}
local handler = CreateFrame("Frame")
for name, func in pairs(events) do
handler:RegisterEvent(name)
end
handler:SetScript("OnEvent", function(self, event, ...)
local func = events[event]
if func then
func(event, ...)
end
end)
 
 
 
SLASH_MACROSEQUENCE1 = "/macrosequence"
SLASH_MACROSEQUENCE2 = "/sequence"
SLASH_MACROSEQUENCE3 = "/seq"
SlashCmdList["MACROSEQUENCE"] = function(msg)
MacroSequence:ShowGUI()
end
trunk/MacroSequence/MacroSequence.toc New file
0,0 → 1,12
## Interface: 20300
## Title: MacroSequence
## Author: Cogwheel
## Notes: Provides a framework to run macro sequences similar to the /castsequence command. See Sequences.lua.
## SavedVariables: MacroSequenceSequences
 
CogsUtils\CogsUtils.lua
 
Sequences.lua
 
Localization.enUS.lua
MacroSequence.lua
trunk/MacroSequence/Localization.enUS.lua New file
0,0 → 1,41
MacroSequenceLocals = {
PRINT_HEADER = "|cffffee66MacroSequence:|r ",
IMPORTED = "Sequences from previous version have been imported. Please remove |cffffee66Sequences.lua|r from |cffffee66Interface\\AddOns\\MacroSequence|r. This message will continue to appear until then, but no changes to Sequences.lua will take effect from now on.",
NAME_EXISTS = "A global variable named |cffffee66%s|r already exists. Please rename this sequence.",
 
MOVE_UP = "Move Up",
MOVE_DOWN = "Move Down",
 
SEQUENCE_TOOLTIP = "Click to select. Right-click for other options.",
 
columns = {
name = {
label = NAME,
tooltip = "Use the name in a /click command to activate the sequence.",
},
combat = {
label = "Combat",
tooltip = "Reset after leaving combat.",
},
time = {
label = "Time",
tooltip = "Reset after the given number of seconds |cfffffffffrom the last activation|r.",
},
alt = {
label = "Alt",
tooltip = "Reset the sequence if you run it while holding the Alt key.",
},
shift = {
label = "Shift",
tooltip = "Reset the sequence if you run it while holding the Shift key.",
},
ctrl = {
label = "Ctrl",
tooltip = "Reset the sequence if you run it while holding the Ctrl key.",
},
cycle = {
label = "Cycle",
tooltip = "Repeat the given number of macros at the end of the sequence. Use the reset conditions to return to the beginning.",
},
},
}
trunk/MacroSequenceGUI/MacroSequenceGUI.toc New file
0,0 → 1,12
## Interface: 20300
## Title: MacroSequenceGUI
## Notes: Graphical front-end for MacroSequence
## Author: Cogwheel
## Dependencies: MacroSequence
## LoadOnDemand: 1
 
Templates.lua
Templates.xml
 
MacroSequenceGUI.lua
MacroSequenceGUI.xml
trunk/MacroSequenceGUI/images/TopLeft.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
trunk/MacroSequenceGUI/images/Separator.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
trunk/MacroSequenceGUI/images/Line.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
trunk/MacroSequenceGUI/images/Icon.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
trunk/MacroSequenceGUI/fonts/VeraMono.ttf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
trunk/MacroSequenceGUI/fonts/COPYRIGHT.TXT New file
0,0 → 1,124
Bitstream Vera Fonts Copyright
 
The fonts have a generous copyright, allowing derivative works (as
long as "Bitstream" or "Vera" are not in the names), and full
redistribution (so long as they are not *sold* by themselves). They
can be be bundled, redistributed and sold with any software.
 
The fonts are distributed under the following copyright:
 
Copyright
=========
 
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
Vera is a trademark of Bitstream, Inc.
 
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute
the Font Software, including without limitation the rights to use,
copy, merge, publish, distribute, and/or sell copies of the Font
Software, and to permit persons to whom the Font Software is furnished
to do so, subject to the following conditions:
 
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
 
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Bitstream" or the word "Vera".
 
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Bitstream Vera" names.
 
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
 
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
 
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font
Software without prior written authorization from the Gnome Foundation
or Bitstream Inc., respectively. For further information, contact:
fonts at gnome dot org.
 
Copyright FAQ
=============
 
1. I don't understand the resale restriction... What gives?
 
Bitstream is giving away these fonts, but wishes to ensure its
competitors can't just drop the fonts as is into a font sale system
and sell them as is. It seems fair that if Bitstream can't make money
from the Bitstream Vera fonts, their competitors should not be able to
do so either. You can sell the fonts as part of any software package,
however.
 
2. I want to package these fonts separately for distribution and
sale as part of a larger software package or system. Can I do so?
 
Yes. A RPM or Debian package is a "larger software package" to begin
with, and you aren't selling them independently by themselves.
See 1. above.
 
3. Are derivative works allowed?
Yes!
 
4. Can I change or add to the font(s)?
Yes, but you must change the name(s) of the font(s).
 
5. Under what terms are derivative works allowed?
 
You must change the name(s) of the fonts. This is to ensure the
quality of the fonts, both to protect Bitstream and Gnome. We want to
ensure that if an application has opened a font specifically of these
names, it gets what it expects (though of course, using fontconfig,
substitutions could still could have occurred during font
opening). You must include the Bitstream copyright. Additional
copyrights can be added, as per copyright law. Happy Font Hacking!
 
6. If I have improvements for Bitstream Vera, is it possible they might get
adopted in future versions?
 
Yes. The contract between the Gnome Foundation and Bitstream has
provisions for working with Bitstream to ensure quality additions to
the Bitstream Vera font family. Please contact us if you have such
additions. Note, that in general, we will want such additions for the
entire family, not just a single font, and that you'll have to keep
both Gnome and Jim Lyles, Vera's designer, happy! To make sense to add
glyphs to the font, they must be stylistically in keeping with Vera's
design. Vera cannot become a "ransom note" font. Jim Lyles will be
providing a document describing the design elements used in Vera, as a
guide and aid for people interested in contributing to Vera.
 
7. I want to sell a software package that uses these fonts: Can I do so?
 
Sure. Bundle the fonts with your software and sell your software
with the fonts. That is the intent of the copyright.
 
8. If applications have built the names "Bitstream Vera" into them,
can I override this somehow to use fonts of my choosing?
 
This depends on exact details of the software. Most open source
systems and software (e.g., Gnome, KDE, etc.) are now converting to
use fontconfig (see www.fontconfig.org) to handle font configuration,
selection and substitution; it has provisions for overriding font
names and subsituting alternatives. An example is provided by the
supplied local.conf file, which chooses the family Bitstream Vera for
"sans", "serif" and "monospace". Other software (e.g., the XFree86
core server) has other mechanisms for font substitution.
 
trunk/MacroSequenceGUI/Templates.xml New file
0,0 → 1,454
<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/
..\UI.xsd">
 
<Button name="MacroSequenceColumnHeaderTemplate" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" file="Interface\FriendsFrame\WhoFrame-ColumnTabs">
<Size x="5" y="18"/>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset x="0" y="3"/>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.078125" top="0" bottom="0.5"/>
</Texture>
<Texture name="$parentRight" file="Interface\FriendsFrame\WhoFrame-ColumnTabs">
<Size x="4" y="18"/>
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset x="0" y="3"/>
</Anchor>
</Anchors>
<TexCoords left="0.90625" right="0.96875" top="0" bottom="0.5"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\FriendsFrame\WhoFrame-ColumnTabs">
<Size x="53" y="18"/>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"/>
</Anchors>
<TexCoords left="0.078125" right="0.90625" top="0" bottom="0.5"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEnter>
MacroSequence:ColumnTooltip(self)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<ButtonText name="$parentText">
<Anchors>
<Anchor point="LEFT">
<Offset x="4" y="0"/>
</Anchor>
</Anchors>
</ButtonText>
<NormalFont inherits="GameFontHighlightSmall"/>
<HighlightTexture name="$parentHighlightTexture" file="Interface\PaperDollInfoFrame\UI-Character-Tab-Highlight" alphaMode="ADD">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentLeft">
<Offset x="-2" y="5"/>
</Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentRight">
<Offset x="2" y="-7"/>
</Anchor>
</Anchors>
</HighlightTexture>
</Button>
 
<Frame name="MacroSequenceSequenceCheckTemplate" virtual="true">
<Size y="16"/>
<Anchors>
<Anchor point="TOP"/>
</Anchors>
<Frames>
<CheckButton name="$parentCheck">
<Size x="12" y="12"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<NormalTexture file="Interface\Buttons\UI-CheckBox-Up">
<TexCoords left="0.125" right="0.84375" top="0.125" bottom="0.84375"/>
</NormalTexture>
<PushedTexture file="Interface\Buttons\UI-CheckBox-Down">
<TexCoords left="0.125" right="0.84375" top="0.125" bottom="0.84375"/>
</PushedTexture>
<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD">
<TexCoords left="0.125" right="0.84375" top="0.125" bottom="0.84375"/>
</HighlightTexture>
<CheckedTexture file="Interface\Buttons\UI-CheckBox-Check">
<TexCoords left="0.125" right="0.84375" top="0.125" bottom="0.84375"/>
</CheckedTexture>
<DisabledCheckedTexture file="Interface\Buttons\UI-CheckBox-Check-Disabled">
<TexCoords left="0.125" right="0.84375" top="0.125" bottom="0.84375"/>
</DisabledCheckedTexture>
</CheckButton>
</Frames>
</Frame>
 
<Frame name="MacroSequenceSequenceEditTemplate" virtual="true">
<Size y="16"/>
<Anchors>
<Anchor point="TOP"/>
</Anchors>
<Frames>
<EditBox name="$parentEdit" autoFocus="false" numeric="true" letters="3">
<Size x="24" y="12"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" file="Interface\Common\Common-Input-Border">
<Size x="8" y="16"/>
<Anchors>
<Anchor point="LEFT"/>
</Anchors>
<TexCoords left="0" right="0.0625" top="0" bottom="0.625"/>
</Texture>
<Texture name="$parentRight" file="Interface\Common\Common-Input-Border">
<Size x="8" y="16"/>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
<TexCoords left="0.9375" right="1.0" top="0" bottom="0.625"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\Common\Common-Input-Border">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentLeft" relativePoint="TOPRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentRight" relativePoint="BOTTOMLEFT"/>
</Anchors>
<TexCoords left="0.0625" right="0.9375" top="0" bottom="0.625"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEditFocusGained>
self:HighlightText()
</OnEditFocusGained>
<OnEditFocusLost>
self:HighlightText(0,0)
</OnEditFocusLost>
<OnEnterPressed>
self:ClearFocus()
</OnEnterPressed>
<OnEscapePressed>
self:ClearFocus()
</OnEscapePressed>
</Scripts>
<FontString inherits="ChatFontSmall" justifyH="CENTER">
<Anchors>
<Anchor point="CENTER">
<Offset x="-4" y="-3"/>
</Anchor>
</Anchors>
</FontString>
</EditBox>
</Frames>
</Frame>
 
<Button name="MacroSequenceSequenceTemplate" virtual="true">
<Size y="16"/>
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScroll"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScroll"/>
</Anchors>
<Layers>
<Layer level="BORDER">
<FontString name="$parentName" inherits="GameFontHighlightSmall" justifyH="LEFT" justifyV="MIDDLE">
<Size y="16"/>
<Anchors>
<Anchor point="TOP">
<Offset x="0" y="1"/>
</Anchor>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScrollName">
<Offset x="3" y="0"/>
</Anchor>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScrollName">
<Offset x="-3" y="0"/>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Frame name="$parentCombat" inherits="MacroSequenceSequenceCheckTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScrollCombat"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScrollCombat"/>
</Anchors>
</Frame>
<Frame name="$parentTime" inherits="MacroSequenceSequenceEditTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScrollTime"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScrollTime"/>
</Anchors>
</Frame>
<Frame name="$parentAlt" inherits="MacroSequenceSequenceCheckTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScrollAlt"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScrollAlt"/>
</Anchors>
</Frame>
<Frame name="$parentShift" inherits="MacroSequenceSequenceCheckTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScrollShift"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScrollShift"/>
</Anchors>
</Frame>
<Frame name="$parentCtrl" inherits="MacroSequenceSequenceCheckTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScrollCtrl"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScrollCtrl"/>
</Anchors>
</Frame>
<Frame name="$parentCycle" inherits="MacroSequenceSequenceEditTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIListScrollCycle"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIListScrollCycle"/>
</Anchors>
</Frame>
</Frames>
<Scripts>
<OnLoad>
self:RegisterForClicks("LeftButtonUp", "RightButtonUp")
</OnLoad>
<OnClick>
MacroSequence:SequenceClick(self, button)
</OnClick>
<OnEnter>
MacroSequence:SequenceTooltip(self)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<HighlightTexture file="Interface\FriendsFrame\UI-FriendsFrame-HighlightBar" alphaMode="ADD">
<Anchors>
<Anchor point="TOPLEFT"/>
<Anchor point="BOTTOMRIGHT"/>
</Anchors>
</HighlightTexture>
</Button>
 
<Frame name="MacroSequenceMacroTemplate" virtual="true">
<Size y="96"/>
<Anchors>
<Anchor point="LEFT" relativeTo="MacroSequenceGUIMacroScroll"/>
<Anchor point="RIGHT" relativeTo="MacroSequenceGUIMacroScroll"/>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLabel" font="Fonts\FRIZQT__.ttf" inherits="MasterFont" justifyH="CENTER">
<Size x="24" y="18"/>
<Anchors>
<Anchor point="TOP" relativePoint="TOPLEFT">
<Offset x="12" y="-5"/>
</Anchor>
</Anchors>
<FontHeight val="18"/>
<Color r="1" g="1" b="1"/>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentDelete">
<Size x="16" y="16"/>
<Anchors>
<Anchor point="CENTER" relativePoint="LEFT">
<Offset x="12" y="-10"/>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
MacroSequence:DeleteMacro(self)
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
GameTooltip:SetText(DELETE, 1, 1, 1)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Up">
<TexCoords left="0.1875" right="0.78125" top="0.1875" bottom="0.78125"/>
</NormalTexture>
<PushedTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Down">
<TexCoords left="0.1875" right="0.78125" top="0.1875" bottom="0.78125"/>
</PushedTexture>
<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD">
<TexCoords left="0.1875" right="0.78125" top="0.1875" bottom="0.78125"/>
</HighlightTexture>
</Button>
<Button name="$parentUp" inherits="UIPanelScrollUpButtonTemplate">
<Anchors>
<Anchor point="BOTTOM" relativeTo="$parentDelete" relativePoint="TOP">
<Offset x="0" y="5"/>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
MacroSequence:MoveUp(self)
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
GameTooltip:SetText(MacroSequenceLocals.MOVE_UP, 1, 1, 1)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</Button>
<Button name="$parentDown" inherits="UIPanelScrollDownButtonTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parentDelete" relativePoint="BOTTOM">
<Offset x="0" y="-5"/>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
MacroSequence:MoveDown(self)
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
GameTooltip:SetText(MacroSequenceLocals.MOVE_DOWN, 1, 1, 1)
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</Button>
<Frame name="$parentEditBG">
<Anchors>
<Anchor point="RIGHT">
<Offset x="0" y="0"/>
</Anchor>
<Anchor point="TOPLEFT">
<Offset x="24" y="0"/>
</Anchor>
<Anchor point="BOTTOMLEFT">
<Offset x="24" y="0"/>
</Anchor>
</Anchors>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize val="16"/>
<TileSize val="16"/>
<BackgroundInsets left="5" right="5" top="5" bottom="5"/>
</Backdrop>
<Scripts>
<OnLoad>
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b)
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b)
</OnLoad>
</Scripts>
</Frame>
<ScrollFrame name="$parentEdit" inherits="UIPanelScrollFrameTemplate">
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentEditBG">
<Offset x="-27" y="0"/>
</Anchor>
<Anchor point="TOPLEFT" relativeTo="$parentEditBG">
<Offset x="5" y="-5"/>
</Anchor>
<Anchor point="BOTTOMLEFT" relativeTo="$parentEditBG">
<Offset x="5" y="5"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
self:GetScrollChild():SetWidth(self:GetWidth())
ScrollFrame_OnLoad()
</OnLoad>
<OnSizeChanged>
self:GetScrollChild():SetWidth(w)
</OnSizeChanged>
</Scripts>
<ScrollChild>
<EditBox name="$parentText" multiLine="true" letters="9999" autoFocus="false">
<Scripts>
<OnEscapePressed>
self:ClearFocus()
</OnEscapePressed>
<OnTabPressed>
MacroSequence:MacroOnTab(self)
</OnTabPressed>
<OnCursorChanged>
ScrollingEdit_OnCursorChanged(x,y,w,h)
_G[self:GetParent():GetName().."ScrollBar"]:SetValue(self:GetParent():GetVerticalScroll())
</OnCursorChanged>
<OnUpdate>
ScrollingEdit_OnUpdate(self:GetParent())
</OnUpdate>
</Scripts>
<FontString font="Interface\AddOns\MacroSequenceGUI\fonts\VeraMono.ttf">
<FontHeight val="12"/>
<Shadow>
<Offset x="1" y="-1"/>
</Shadow>
</FontString>
</EditBox>
</ScrollChild>
</ScrollFrame>
<Button name="$parentEditFocusGrabber">
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentEdit"/>
<Anchor point="TOPLEFT" relativeTo="$parentEdit"/>
<Anchor point="BOTTOMLEFT" relativeTo="$parentEdit"/>
</Anchors>
<Scripts>
<OnClick>
_G[self:GetParent():GetName().."EditText"]:SetFocus()
</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
 
<ScrollFrame name="MacroSequenceScrollTemplate" inherits="UIPanelScrollFrameTemplate2" virtual="true">
<Layers>
<Layer level="OVERLAY">
<Texture name="$parentLineLeft" file="Interface\AddOns\MacroSequenceGUI\images\Line">
<Size x="10" y="8"/>
<Anchors>
<Anchor point="LEFT" relativePoint="TOPLEFT">
<Offset x="-4" y="2"/>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.0390625" top="0" bottom="1"/>
</Texture>
<Texture name="$parentLineRight" file="Interface\AddOns\MacroSequenceGUI\images\Line">
<Size x="10" y="8"/>
<Anchors>
<Anchor point="RIGHT" relativePoint="TOPRIGHT">
<Offset x="6" y="2"/>
</Anchor>
</Anchors>
<TexCoords left="0.9609375" right="1" top="0" bottom="1"/>
</Texture>
<Texture name="$parentLineMiddle" file="Interface\AddOns\MacroSequenceGUI\images\Line">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentLineLeft" relativePoint="TOPRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentLineRight" relativePoint="BOTTOMLEFT"/>
</Anchors>
<TexCoords left="0.0390625" right="0.9609375" top="0" bottom="1"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
MacroSequence:ScrollFrameLoad(self)
</OnLoad>
</Scripts>
<ScrollChild>
<Frame name="$parentChild">
<Size x="1" y="1"/>
</Frame>
</ScrollChild>
</ScrollFrame>
 
</Ui>
\ No newline at end of file
trunk/MacroSequenceGUI/MacroSequenceGUI.xml New file
0,0 → 1,340
<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/
..\UI.xsd">
 
<Frame name="MacroSequenceGUI" toplevel="true" frameStrata="MEDIUM" hidden="true" movable="true" enableMouse="true" parent="UIParent">
<Size x="680" y="435"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBG1" file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-TopBackground">
<Size x="256" y="64"/>
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="13" y="-18"/>
</Anchor>
</Anchors>
</Texture>
<Texture name="$parentBG2" file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-TopBackground">
<Size x="256" y="64"/>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentBG1" relativePoint="RIGHT"/>
</Anchors>
</Texture>
<Texture name="$parentBG3" file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-TopBackground">
<Size x="153" y="64"/>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentBG2" relativePoint="RIGHT"/>
</Anchors>
<TexCoords top="0" bottom="1" left="0" right="0.56640625"/>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture file="Interface\AddOns\MacroSequenceGUI\images\Icon">
<Size x="60" y="60"/>
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="7" y="-6"/>
</Anchor>
</Anchors>
</Texture>
<Texture name="$parentTopLeft" file="Interface\AddOns\MacroSequenceGUI\images\TopLeft">
<Size x="128" y="256"/>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
<Texture name="$parentTopRight" file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-TopRight">
<Size x="140" y="242"/>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset x="0" y="-14"/>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.546875" top="0" bottom="0.9453125"/>
</Texture>
<Texture file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-Top">
<Size y="242"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeft" relativePoint="TOPRIGHT">
<Offset x="0" y="-14"/>
</Anchor>
<Anchor point="TOPRIGHT" relativeTo="$parentTopRight" relativePoint="TOPLEFT">
<Offset x="0" y="0"/>
</Anchor>
</Anchors>
<TexCoords left="0.3" right="0.35" top="0" bottom="0.9453125"/>
</Texture>
<Texture name="$parentBotLeft" file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-BotLeft">
<Size x="128" y="168"/>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset x="8" y="0"/>
</Anchor>
</Anchors>
<TexCoords left="0" right="1" top="0" bottom="0.65625"/>
</Texture>
<Texture name="$parentBotRight" file="Interface\WorldStateframe\WorldStateFinalScoreFrame-BotRight">
<Size x="140" y="168"/>
<Anchors>
<Anchor point="BOTTOMRIGHT"/>
</Anchors>
<TexCoords left="0" right="0.546875" top="0" bottom="0.65625"/>
</Texture>
<Texture file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-BotLeft">
<Size y="168"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBotLeft" relativePoint="TOPRIGHT"/>
<Anchor point="TOPRIGHT" relativeTo="$parentBotRight" relativePoint="TOPLEFT"/>
</Anchors>
<TexCoords left="0.25" right="0.5" top="0" bottom="0.65625"/>
</Texture>
<Texture name="$parentMidLeft" file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-TopLeft">
<Size x="128" y="10"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeft" relativePoint="BOTTOMLEFT">
<Offset x="8" y="0"/>
</Anchor>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBotLeft" relativePoint="TOPLEFT">
<Offset x="8" y="0"/>
</Anchor>
</Anchors>
<TexCoords left="0" right="1" top="0.9375" bottom="1"/>
</Texture>
<Texture name="$parentMidRight" file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-TopRight">
<Size x="140" y="10"/>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentTopRight" relativePoint="BOTTOMRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBotRight" relativePoint="TOPRIGHT"/>
</Anchors>
<TexCoords left="0" right="0.546875" top="0.9375" bottom="1"/>
</Texture>
<Texture file="Interface\WorldStateFrame\WorldStateFinalScoreFrame-TopLeft">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentMidLeft" relativePoint="TOPRIGHT"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentMidRight" relativePoint="BOTTOMLEFT"/>
</Anchors>
<TexCoords left="0.25" right="0.5" top="0.25" bottom="0.5"/>
</Texture>
</Layer>
<Layer level="ARTWORK">
<FontString name="$parentTitle" inherits="GameFontNormal" text="MacroSequence">
<Anchors>
<Anchor point="TOP">
<Offset x="15" y="-19"/>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="OVERLAY">
<Texture name="$parentSeparatorTop" file="Interface\AddOns\MacroSequenceGUI\images\Separator">
<Size x="16" y="75"/>
<Anchors>
<Anchor point="TOP">
<Offset x="15" y="-66"/>
</Anchor>
</Anchors>
<TexCoords left="0.25" right="0.5" top="0.70703125" bottom="1"/>
</Texture>
<Texture name="$parentSeparatorBottom" file="Interface\AddOns\MacroSequenceGUI\images\Separator">
<Size x="16" y="71"/>
<Anchors>
<Anchor point="BOTTOM">
<Offset x="15" y="0"/>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.25" top="0.70703125" bottom="0.984375"/>
</Texture>
<Texture name="$parentSeparatorMiddle" file="Interface\AddOns\MacroSequenceGUI\images\Separator">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSeparatorTop" relativePoint="BOTTOMLEFT"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentSeparatorBottom" relativePoint="TOPRIGHT"/>
</Anchors>
<TexCoords left="0" right="0.25" top="0" bottom="0.70703125"/>
</Texture>
</Layer>
</Layers>
<Frames>
<Button name="$parentClose" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT">
<Offset x="5" y="-10"/>
</Anchor>
</Anchors>
</Button>
<Button name="$parentDragHeader">
<Size y="60"/>
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="0" y="-13"/>
</Anchor>
<Anchor point="TOPRIGHT">
<Offset x="0" y="-13"/>
</Anchor>
</Anchors>
<Scripts>
<OnMouseDown>
local parent = self:GetParent()
if parent:IsMovable() then
parent:StartMoving()
end
</OnMouseDown>
<OnMouseUp>
local parent = self:GetParent()
parent:StopMovingOrSizing()
</OnMouseUp>
</Scripts>
</Button>
<ScrollFrame name="$parentListScroll" inherits="MacroSequenceScrollTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset x="18" y="-94"/>
</Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentSeparatorBottom" relativePoint="BOTTOMLEFT">
<Offset x="-26" y="4"/>
</Anchor>
</Anchors>
<Frames>
<Button name="$parentCycle" inherits="MacroSequenceColumnHeaderTemplate">
<Size x="37" y="24"/>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativePoint="TOPRIGHT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
MacroSequence:InitColumn(self, "cycle")
</OnLoad>
</Scripts>
</Button>
<Button name="$parentCtrl" inherits="MacroSequenceColumnHeaderTemplate">
<Size x="27" y="24"/>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentCycle" relativePoint="LEFT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
MacroSequence:InitColumn(self, "ctrl")
</OnLoad>
</Scripts>
</Button>
<Button name="$parentShift" inherits="MacroSequenceColumnHeaderTemplate">
<Size x="32" y="24"/>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentCtrl" relativePoint="LEFT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
MacroSequence:InitColumn(self, "shift")
</OnLoad>
</Scripts>
</Button>
<Button name="$parentAlt" inherits="MacroSequenceColumnHeaderTemplate">
<Size x="24" y="24"/>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentShift" relativePoint="LEFT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
MacroSequence:InitColumn(self, "alt")
</OnLoad>
</Scripts>
</Button>
<Button name="$parentTime" inherits="MacroSequenceColumnHeaderTemplate">
<Size x="34" y="24"/>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentAlt" relativePoint="LEFT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
MacroSequence:InitColumn(self, "time")
</OnLoad>
</Scripts>
</Button>
<Button name="$parentCombat" inherits="MacroSequenceColumnHeaderTemplate">
<Size x="50" y="24"/>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentTime" relativePoint="LEFT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
MacroSequence:InitColumn(self, "combat")
</OnLoad>
</Scripts>
</Button>
<Button name="$parentName" inherits="MacroSequenceColumnHeaderTemplate">
<Size y="24"/>
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset x="-2" y="0"/>
</Anchor>
<Anchor point="RIGHT" relativeTo="$parentCombat" relativePoint="LEFT">
<Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
MacroSequence:InitColumn(self, "name")
</OnLoad>
</Scripts>
</Button>
</Frames>
</ScrollFrame>
<ScrollFrame name="$parentMacroScroll" inherits="MacroSequenceScrollTemplate">
<Anchors>
<Anchor point="TOPRIGHT">
<Offset x="-32" y="-94"/>
</Anchor>
<Anchor point="BOTTOMLEFT" relativeTo="$parentSeparatorBottom" relativePoint="BOTTOMRIGHT">
<Offset x="-2" y="4"/>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentLeftLabel" inherits="GameFontHighlight" text="TestSequence3" justifyH="LEFT">
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset x="3" y="7"/>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentRightLabel" inherits="GameFontHighlight" text="Macros: |cff00ff004" justifyH="RIGHT">
<Anchors>
<Anchor point="BOTTOMRIGHT" relativePoint="TOPRIGHT">
<Offset x="-3" y="7"/>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</ScrollFrame>
</Frames>
<Scripts>
<OnLoad>
MacroSequence:OnLoad(self)
</OnLoad>
<OnShow>
MacroSequence:OnShow(self)
</OnShow>
<OnEvent>
MacroSequence:OnEvent(self, event, ...)
</OnEvent>
<OnHide>
MacroSequence:OnHide(self)
</OnHide>
</Scripts>
</Frame>
 
</Ui>
trunk/MacroSequenceGUI/Templates.lua New file
0,0 → 1,234
MacroSequence = MacroSequence or {}
local L = MacroSequenceLocals
local print = CogsUtils:GetPrint(L.PRINT_HEADER)
 
--[[
Set up scroll frame functionality. These first few parts allow the frames to
resize themselves when the scroll bars show or hide.
]]
 
-- UIParent is just an arbitrary frame from which to grab the original show &
-- hide methods
local _show = UIParent.Show
local _hide = UIParent.Hide
-- This determines how far to nudge the right anchor point
local NUDGE_OFFSET = 26
 
 
 
-- The next two hook functions do the nudging whenever the scroll bar is shown
-- or hidden
local function showHook(self, ...)
if not self:IsShown() then
MacroSequence:NudgeRight(self:GetParent(), -NUDGE_OFFSET)
end
return _show(self, ...)
end
 
local function hideHook(self, ...)
if self:IsShown() then
MacroSequence:NudgeRight(self:GetParent(), NUDGE_OFFSET)
end
return _hide(self, ...)
end
 
 
 
-- This function sets up some features specific to the macrosequence scroll bars
function MacroSequence:ScrollFrameLoad(frame, which)
-- Built-in OnLoad
ScrollFrame_OnLoad()
 
-- Set up offsets
local bar = _G[frame:GetName().."ScrollBar"]
bar:SetPoint("TOPLEFT", frame, "TOPRIGHT", 8, 2)
_G[frame:GetName().."Top"]:SetPoint("TOPLEFT", _G[bar:GetName().."ScrollUpButton"], "TOPLEFT", -8, 5)
_G[frame:GetName().."Bottom"]:SetPoint("BOTTOMLEFT", _G[bar:GetName().."ScrollDownButton"], "BOTTOMLEFT", -8, -2)
 
-- Hook show/hide
bar.Show = showHook
bar.Hide = hideHook
 
frame.bar = bar
frame.scrollBarHideable = true
ScrollFrame_OnScrollRangeChanged()
end
 
 
 
-- This function moves the RIGHT anchor point horizontally by offset
function MacroSequence:NudgeRight(frame, offset)
for i = 1, frame:GetNumPoints() do
local point, relTo, relPoint, ofsx, ofsy = frame:GetPoint(i)
if strfind(point, "RIGHT") then
frame:SetPoint(point, relTo, relPoint, ofsx + offset, ofsy)
end
end
end
 
 
 
-- Set up labels on column headers
function MacroSequence:InitColumn(frame, which)
frame:SetText(L.columns[which].label)
frame.which = which
end
 
 
 
-- This function makes it easier to deal with RGB tables
local function rgb(tbl, ...)
return tbl.r, tbl.g, tbl.b, ...
end
 
 
 
-- Shows a tooltip when you mouse over a column header
function MacroSequence:ColumnTooltip(frame)
GameTooltip:SetOwner(frame)
GameTooltip:AddLine(frame:GetText(), rgb(HIGHLIGHT_FONT_COLOR))
GameTooltip:AddLine(L.columns[frame.which].tooltip, rgb(NORMAL_FONT_COLOR, 1))
GameTooltip:Show()
end
 
 
 
-- Shows a tooltip when you mouse over a sequence row
function MacroSequence:SequenceTooltip(frame)
GameTooltip:SetOwner(frame)
GameTooltip:AddLine(_G[frame:GetName().."Name"]:GetText(), rgb(HIGHLIGHT_FONT_COLOR))
GameTooltip:AddLine(L.SEQUENCE_TOOLTIP, rgb(NORMAL_FONT_COLOR, 1))
GameTooltip:Show()
end
 
 
 
--[[
Sequence selection handlers. These methods determine what happens as you click
on different sequence rows.
]]
 
 
 
-- Index for selected frames
MacroSequence.selected = {}
 
 
 
-- Handles clicks on sequence rows
function MacroSequence:SequenceClick(frame, button)
if button == "RightButton" then
-- Right button displays a context menu
print("menu", frame:GetName())
--self:SequenceMenu(frame)
 
elseif IsShiftKeyDown() and self.lastSelected then
-- Shift-clicks select a contiguous range
self:SelectNone()
self:SelectTo(frame)
 
elseif IsControlKeyDown() then
-- Ctrl-click toggles selection of the clicked row, ignoring all others
self:ToggleSelect(frame, true)
 
else
-- Normal click selects a single row
self:SelectNone()
self:Select(frame, true)
end
end
 
 
 
-- Selects a row. The click param means that the selection was directly
-- triggered by a click (rather than via SelectTo, for instance).
function MacroSequence:Select(frame, click)
if self.selected[frame] then
return
end
self.selected[frame] = true
if click then
self.lastSelected = frame
end
frame:LockHighlight()
self:UpdateMacroList()
end
 
 
 
function MacroSequence:Deselect(frame)
if not self.selected[frame] then
return
end
self.selected[frame] = nil
frame:UnlockHighlight()
self:UpdateMacroList()
end
 
 
 
function MacroSequence:ToggleSelect(frame, click)
if self.selected[frame] then
self:Deselect(frame)
else
self:Select(frame, click)
end
end
 
 
 
function MacroSequence:SelectTo(frame)
local current, finish, field = self.lastSelected, frame, "next"
if current:GetID() > finish:GetID() then
current, finish = frame, self.lastSelected, "previous"
end
while true do
self:Select(current)
if current == finish then
break
end
current = current[field]
end
end
 
 
 
function MacroSequence:SelectNone()
for frame in pairs(self.selected) do
self:Deselect(frame)
end
end
 
 
function MacroSequence:MacroOnTab(frame)
local target = frame.next
if IsShiftKeyDown() then
target = frame.previous
end
if target then
target:SetFocus()
end
end
 
 
 
function MacroSequence:MoveUp(index)
print("up", index)
end
 
 
 
function MacroSequence:MoveDown(index)
print("down", index)
end
 
 
 
function MacroSequence:DeleteMacro(index)
print("delete", index)
end
 
 
 
function MacroSequence:SaveSequence()
end
trunk/MacroSequenceGUI/MacroSequenceGUI.lua New file
0,0 → 1,102
MacroSequence = MacroSequence or {}
local L = MacroSequenceLocals
local print = CogsUtils:GetPrint(L.PRINT_HEADER)
 
function MacroSequence:OnLoad(frame)
end
 
 
 
function MacroSequence:OnShow(frame)
tinsert(UISpecialFrames, "MacroSequenceGUI")
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
PlaySound("igMainMenuOpen")
end
 
 
 
function MacroSequence:OnEvent(frame, event, ...)
if event == "PLAYER_REGEN_DISABLED" then
frame:Hide()
end
end
 
 
 
function MacroSequence:OnHide(frame)
self:SaveSequence()
frame:UnregisterEvent("PLAYER_REGEN_DISABLED")
PlaySound("igMainMenuQuit")
end
 
 
 
do -- Scoping locals
local last
local curNum = 1
 
function MacroSequence:AddSequenceFrame(text)
local frame = CreateFrame(
"Button",
"MacroSequenceSequence"..curNum,
MacroSequenceGUIListScrollChild,
"MacroSequenceSequenceTemplate"
)
frame:SetID(curNum)
if last then
frame:SetPoint("TOP", last, "BOTTOM")
else
frame:SetPoint("TOP")
end
_G[frame:GetName().."Name"]:SetText(text)
frame.previous = last
if last then
last.next = frame
end
last = frame
curNum = curNum + 1
 
return frame
end
end
 
 
 
do -- Scoping locals
local last
local curNum = 1
 
function MacroSequence:AddMacroFrame()
local frame = CreateFrame(
"Frame",
"MacroSequenceMacro"..curNum,
MacroSequenceGUIMacroScrollChild,
"MacroSequenceMacroTemplate"
)
frame:SetID(curNum)
if last then
frame:SetPoint("TOP", last, "BOTTOM")--, 0, -8)
else
frame:SetPoint("TOP")
end
_G[frame:GetName().."Label"]:SetText(curNum)
frame.previous = last
if last then
last.next = frame
end
last = frame
curNum = curNum + 1
 
return frame
end
end
 
 
 
function MacroSequence:UpdateSequenceList()
end
 
 
 
function MacroSequence:UpdateMacroList()
end