WoWInterface SVN NeedToKnow-Updated

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /branches
    from Rev 95 to Rev 98
    Reverse comparison

Rev 95 → Rev 98

Kitjan/NeedToKnow/NeedToKnow_Options.xml
1,619 → 1,518
<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/
..\..\..\Blizza~1\FrameXML\UI.xsd">
<Frame name="NeedToKnow_GroupOptionsTemplate" virtual="true">
<Size>
<AbsDimension x="128" y="26"/>
</Size>
<Frames>
<CheckButton name="$parentEnableButton" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent" relativePoint="LEFT" />
</Anchors>
<HitRectInsets>
<AbsInset left="0" right="-70" top="0" bottom="0"/>
</HitRectInsets>
<Scripts>
<OnLoad>
local text = getglobal(self:GetName().."Text");
text:SetText(NEEDTOKNOW.UIPANEL_BARGROUP..self:GetParent():GetID());
</OnLoad>
<OnClick>
NeedToKnow.GroupEnableButton_OnClick(self);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_TOOLTIP_ENABLEGROUP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
</Scripts>
</CheckButton>
<Frame name="$parentNumberbarsWidget">
<Size>
<AbsDimension x="64" y="32"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="LEFT">
<Offset>
<AbsDimension x="125" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentText" inherits="GameFontHighlight" justifyH="CENTER" text="X">
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER" />
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentLeftButton">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parent" relativePoint="CENTER">
<Offset>
<AbsDimension x="-8" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
NeedToKnow.NumberbarsButton_OnClick(self, -1);
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Up"/>
<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Down"/>
<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Disabled"/>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button>
<Button name="$parentRightButton">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parent" relativePoint="CENTER">
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
NeedToKnow.NumberbarsButton_OnClick(self, 1);
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Up"/>
<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Down"/>
<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Disabled"/>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button>
</Frames>
</Frame>
<EditBox name="$parentFixedDurationBox" numeric="true" letters="3" autoFocus="false">
<Size>
<AbsDimension x="30" y="20"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parentNumberbarsWidget" relativePoint="RIGHT">
<Offset>
<AbsDimension x="40" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" file="Interface\Common\Common-Input-Border">
<Size>
<AbsDimension x="8" y="20"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.0625" top="0" bottom="0.625"/>
</Texture>
<Texture name="$parentRight" file="Interface\Common\Common-Input-Border">
<Size>
<AbsDimension x="8" y="20"/>
</Size>
<Anchors>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.9375" right="1.0" top="0" bottom="0.625"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\Common\Common-Input-Border">
<Size>
<AbsDimension x="10" y="20"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"/>
</Anchors>
<TexCoords left="0.0625" right="0.9375" top="0" bottom="0.625"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_TOOLTIP_FIXEDDURATION, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
<OnTabPressed>
if ( IsShiftKeyDown() ) then
local prevGroup = max(1, self:GetParent():GetID() - 1);
_G[self:GetParent():GetParent():GetName().."Group"..prevGroup.."FixedDurationBox"]:SetFocus();
else
local nextGroup = min(NEEDTOKNOW.MAXGROUPS, self:GetParent():GetID() + 1);
_G[self:GetParent():GetParent():GetName().."Group"..nextGroup.."FixedDurationBox"]:SetFocus();
end
</OnTabPressed>
<OnEnterPressed>
EditBox_ClearFocus(self);
</OnEnterPressed>
<OnEscapePressed>
EditBox_ClearFocus(self);
</OnEscapePressed>
<OnTextChanged>
NeedToKnow.FixedDurationEditBox_OnTextChanged(self);
</OnTextChanged>
<OnEditFocusLost>
EditBox_ClearHighlight(self);
</OnEditFocusLost>
<OnEditFocusGained>
EditBox_HighlightText(self);
</OnEditFocusGained>
</Scripts>
<FontString inherits="ChatFontNormal"/>
</EditBox>
</Frames>
</Frame>
<Frame name="NeedToKnow_DropDownTemplate" inherits="UIDropDownMenuTemplate" virtual="true">
<Anchors>
<Anchor point="TOP"/>
</Anchors>
<Scripts>
<OnLoad>
UIDropDownMenu_Initialize(self, NeedToKnowRMB.BarMenu_Initialize, "MENU");
</OnLoad>
<OnShow>
UIDropDownMenu_Initialize(self, NeedToKnowRMB.BarMenu_Initialize, "MENU");
</OnShow>
</Scripts>
</Frame>
 
<Button name="NeedToKnow_ColorButtonTemplate" virtual="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentSwatch">
<Size>
<AbsDimension x="14" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Color r="1.0" g="1.0" b="1.0"/>
</Texture>
</Layer>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\ChatFrameColorSwatch"/>
</Button>
 
<Frame name="InterfaceOptionsNeedToKnowPanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentTitle" text="NeedToKnow" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentVersion" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTitle" relativePoint="RIGHT">
<Offset>
<AbsDimension x="4" y="-0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSubText1" inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP">
<Size>
<AbsDimension y="24" x="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-24" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentNumberbarsLabel" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="BOTTOM" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="133" y="-28"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFixedDurationLabel" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="BOTTOM" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="203" y="-28"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self.name = "NeedToKnow";
self.default = NeedToKnow.Reset;
self.cancel = NeedToKnow.Cancel;
InterfaceOptions_AddCategory(self);
NeedToKnow.UIPanel_OnLoad(self);
</OnLoad>
<OnShow>
NeedToKnow_OldSettings = CopyTable(NeedToKnow_Settings);
NeedToKnow.UIPanel_OnShow();
</OnShow>
</Scripts>
<Frames>
<Frame name="$parentGroup1" inherits="NeedToKnow_GroupOptionsTemplate" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset x="8" y="-40"/>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentGroup2" inherits="NeedToKnow_GroupOptionsTemplate" id="2">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentGroup1" relativePoint="BOTTOMLEFT">
<Offset x="0" y="-8"/>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentGroup3" inherits="NeedToKnow_GroupOptionsTemplate" id="3">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentGroup2" relativePoint="BOTTOMLEFT">
<Offset x="0" y="-8"/>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentGroup4" inherits="NeedToKnow_GroupOptionsTemplate" id="4">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentGroup3" relativePoint="BOTTOMLEFT">
<Offset x="0" y="-8"/>
</Anchor>
</Anchors>
</Frame>
<Button name="$parentConfigModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE);
</OnLoad>
<OnClick>
PlaySound("gsTitleOptionOK");
NeedToKnow_Settings["Locked"] = false;
NeedToKnow.Update();
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
<Button name="$parentPlayModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE);
</OnLoad>
<OnClick>
PlaySound("gsTitleOptionOK");
NeedToKnow_Settings["Locked"] = true;
NeedToKnow.Update();
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
</Frames>
</Frame>
<Frame name="NeedToKnow_GroupOptionsTemplate" virtual="true">
<Size>
<AbsDimension x="128" y="26"/>
</Size>
<Frames>
<CheckButton name="$parentEnableButton" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent" relativePoint="LEFT" />
</Anchors>
<HitRectInsets>
<AbsInset left="0" right="-70" top="0" bottom="0"/>
</HitRectInsets>
<Scripts>
<OnLoad>
local text = getglobal(self:GetName().."Text");
text:SetText(NEEDTOKNOW.UIPANEL_BARGROUP..self:GetParent():GetID());
</OnLoad>
<OnClick>
NeedToKnowOptions.GroupEnableButton_OnClick(self);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_TOOLTIP_ENABLEGROUP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
</Scripts>
</CheckButton>
<Frame name="$parentNumberbarsWidget">
<Size>
<AbsDimension x="64" y="32"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="LEFT">
<Offset>
<AbsDimension x="125" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentText" inherits="GameFontHighlight" justifyH="CENTER" text="X">
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER" />
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentLeftButton">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parent" relativePoint="CENTER">
<Offset>
<AbsDimension x="-8" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.NumberbarsButton_OnClick(self, -1);
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Up"/>
<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Down"/>
<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Disabled"/>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button>
<Button name="$parentRightButton">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parent" relativePoint="CENTER">
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.NumberbarsButton_OnClick(self, 1);
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Up"/>
<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Down"/>
<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Disabled"/>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button>
</Frames>
</Frame>
<EditBox name="$parentFixedDurationBox" numeric="true" letters="3" autoFocus="false">
<Size>
<AbsDimension x="30" y="20"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parentNumberbarsWidget" relativePoint="RIGHT">
<Offset>
<AbsDimension x="40" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" file="Interface\Common\Common-Input-Border">
<Size>
<AbsDimension x="8" y="20"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.0625" top="0" bottom="0.625"/>
</Texture>
<Texture name="$parentRight" file="Interface\Common\Common-Input-Border">
<Size>
<AbsDimension x="8" y="20"/>
</Size>
<Anchors>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.9375" right="1.0" top="0" bottom="0.625"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\Common\Common-Input-Border">
<Size>
<AbsDimension x="10" y="20"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"/>
</Anchors>
<TexCoords left="0.0625" right="0.9375" top="0" bottom="0.625"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_TOOLTIP_FIXEDDURATION, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
<OnTabPressed>
--if ( IsShiftKeyDown() ) then
-- local prevGroup = max(1, self:GetParent():GetID() - 1);
-- _G[self:GetParent():GetParent():GetName().."Group"..prevGroup.."FixedDurationBox"]:SetFocus();
--else
-- local nextGroup = min(NEEDTOKNOW.MAXGROUPS, self:GetParent():GetID() + 1);
-- _G[self:GetParent():GetParent():GetName().."Group"..nextGroup.."FixedDurationBox"]:SetFocus();
--end
</OnTabPressed>
<OnEnterPressed>
EditBox_ClearFocus(self);
</OnEnterPressed>
<OnEscapePressed>
EditBox_ClearFocus(self);
</OnEscapePressed>
<OnTextChanged>
NeedToKnowOptions.FixedDurationEditBox_OnTextChanged(self);
</OnTextChanged>
<OnEditFocusLost>
EditBox_ClearHighlight(self);
</OnEditFocusLost>
<OnEditFocusGained>
EditBox_HighlightText(self);
</OnEditFocusGained>
</Scripts>
<FontString inherits="ChatFontNormal"/>
</EditBox>
</Frames>
</Frame>
 
<Button name="NeedToKnow_ColorButtonTemplate" virtual="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentSwatch">
<Size>
<AbsDimension x="14" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Color r="1.0" g="1.0" b="1.0"/>
</Texture>
</Layer>
<Layer level="ARTWORK">
<FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\ChatFrameColorSwatch"/>
</Button>
 
<Frame name="InterfaceOptionsNeedToKnowAppearancePanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentTitle" text="NeedToKnow" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentVersion" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTitle" relativePoint="RIGHT">
<Offset>
<AbsDimension x="4" y="-0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSubText1" inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP">
<Size>
<AbsDimension y="24" x="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-24" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self.name = NEEDTOKNOW.UIPANEL_APPEARANCE;
self.parent = "NeedToKnow";
self.default = NeedToKnow.Reset;
-- self.cancel = NeedToKnow.Cancel;
-- need different way to handle cancel? users might open appearance panel without opening main panel
InterfaceOptions_AddCategory(self);
NeedToKnow.UIPanel_Appearance_OnLoad(self)
</OnLoad>
<OnShow>
NeedToKnow.UIPanel_Appearance_OnShow();
</OnShow>
<OnHide>
</OnHide>
</Scripts>
<Frames>
<Button name="$parentBackgroundColorButton" inherits="NeedToKnow_ColorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Label"]:SetText(NEEDTOKNOW.UIPANEL_BACKGROUNDCOLOR);
self:RegisterForClicks("LeftButtonUp");
</OnLoad>
<OnClick>
NeedToKnow.ChooseColor("BkgdColor");
</OnClick>
</Scripts>
</Button>
<Slider name="$parentBarSpacingSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBackgroundColorButton" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-32"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_BARSPACING);
</OnLoad>
<OnValueChanged>
NeedToKnow_Settings["BarSpacing"] = value;
NeedToKnow.Update();
</OnValueChanged>
</Scripts>
</Slider>
<Slider name="$parentBarPaddingSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBarSpacingSlider" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-32"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_BARPADDING);
</OnLoad>
<OnValueChanged>
NeedToKnow_Settings["BarPadding"] = value;
NeedToKnow.Update();
</OnValueChanged>
</Scripts>
</Slider>
<Slider name="$parentBarTextureSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBarSpacingSlider" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="166" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontHighlight">
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="40" y="-30"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
</OnLoad>
<OnValueChanged>
NeedToKnow.UpdateBarTextureSlider(self, value);
</OnValueChanged>
</Scripts>
</Slider>
<Frame name="InterfaceOptionsNeedToKnowPanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentTitle" text="NeedToKnow" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentVersion" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTitle" relativePoint="RIGHT">
<Offset>
<AbsDimension x="4" y="-0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSubText1" inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP">
<Size>
<AbsDimension y="24" x="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-24" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentNumberbarsLabel" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="BOTTOM" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="133" y="-28"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFixedDurationLabel" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="BOTTOM" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="203" y="-28"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self.name = "NeedToKnow";
self.default = NeedToKnow.ResetCharacter;
self.cancel = NeedToKnowOptions.Cancel;
InterfaceOptions_AddCategory(self);
NeedToKnowOptions.UIPanel_OnLoad(self);
</OnLoad>
<OnShow>
--NeedToKnow_OldSettings = CopyTable(NeedToKnow_Settings);
NeedToKnowOptions.UIPanel_OnShow();
</OnShow>
</Scripts>
<Frames>
<Frame name="$parentGroup1" inherits="NeedToKnow_GroupOptionsTemplate" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset x="8" y="-40"/>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentGroup2" inherits="NeedToKnow_GroupOptionsTemplate" id="2">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentGroup1" relativePoint="BOTTOMLEFT">
<Offset x="0" y="-8"/>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentGroup3" inherits="NeedToKnow_GroupOptionsTemplate" id="3">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentGroup2" relativePoint="BOTTOMLEFT">
<Offset x="0" y="-8"/>
</Anchor>
</Anchors>
</Frame>
<Frame name="$parentGroup4" inherits="NeedToKnow_GroupOptionsTemplate" id="4">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentGroup3" relativePoint="BOTTOMLEFT">
<Offset x="0" y="-8"/>
</Anchor>
</Anchors>
</Frame>
<Button name="$parentConfigModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE);
</OnLoad>
<OnClick>
NeedToKnow.LockToggle(false);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
<Button name="$parentPlayModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE);
</OnLoad>
<OnClick>
NeedToKnow.LockToggle(true);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
</Frames>
</Frame>
 
<Slider name="$parentBarFontSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBarTextureSlider" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-30" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontHighlight">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
</OnLoad>
<OnValueChanged>
NeedToKnow.UpdateBarFontSlider(self, value);
</OnValueChanged>
</Scripts>
</Slider>
<Button name="NeedToKnowScrollItemTemplate" virtual="true">
<Size x="169" y="22"/>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND" >
<Texture name="$parentBg" parentKey="Bg">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="1" y="-0.99"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-1" y="0.99"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture name="$parentCheck" file="Interface\Buttons\UI-CheckBox-Check" parentKey="Check" hidden="true">
<Size x="16" y="16"/>
<Anchors>
<Anchor point="LEFT">
<Offset x="8" y="0"/>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
--Bg.SetPoint("TOPLEFT",GetParent(),"TOPLEFT",1,-1);
--Bg.SetPoint("BOTTOMRIGHT",GetParent(),"BOTTOMRIGHT",-1,1);
</OnLoad>
<OnClick>
local panel = self:GetParent():GetParent():GetParent()
panel.fnClick(self)
</OnClick>
</Scripts>
<ButtonText name="$parentTitleText" inherits="GameFontNormalSmallLeft" justifyH="LEFT" parentKey="text">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentCheck" relativePoint="RIGHT" x="3" y="0"/>
<Anchor point="RIGHT" x="-3" y="0"/>
</Anchors>
</ButtonText>
<HighlightTexture file="Interface\FriendsFrame\UI-FriendsFrame-HighlightBar-Blue" alphaMode="ADD"/>
</Button>
 
<Button name="$parentConfigModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE);
</OnLoad>
<OnClick>
PlaySound("gsTitleOptionOK");
NeedToKnow_Settings["Locked"] = false;
NeedToKnow.Update();
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
<Button name="$parentPlayModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE);
</OnLoad>
<OnClick>
PlaySound("gsTitleOptionOK");
NeedToKnow_Settings["Locked"] = true;
NeedToKnow.Update();
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
</Frames>
</Frame>
<Frame name="NeedToKnowScrollFrameTemplate" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentTitle" text="ScrollBar" inherits="GameFontNormalSmall" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</FontString>
<FontString name="$parentValue" text="Value" inherits="GameFontHighlightSmall" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="TOPRIGHT" x="4"/>
<Anchor point="RIGHT"/>
<!-- Wish I didn't have to explicitly set the bottom, but have it based on the font-->
<Anchor point="BOTTOM" relativePoint="TOP" y="-14"/>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Frame name="$parentFrame">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT" />
<Anchor point="BOTTOMRIGHT" x="-24"/>
</Anchors>
<Backdrop name="$parentBackdrop" edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true">
<EdgeSize>
<AbsValue val="8"/>
</EdgeSize>
<TileSize>
<AbsValue val="8"/>
</TileSize>
</Backdrop>
</Frame>
<ScrollFrame name="$parentList" inherits="HybridScrollFrameTemplate" parentKey="List">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFrame" x="3" y="-7" />
<Anchor point="BOTTOMRIGHT" relativeTo="$parentFrame" x="-3" y="7"/>
</Anchors>
<Scripts>
<NotVerticalScroll>
NeedToKnowOptions.OnScrollFrameScrolled(self)
</NotVerticalScroll>
<OnSizeChanged>
NeedToKnowOptions.OnScrollFrameSized(self)
</OnSizeChanged>
</Scripts>
<Frames>
<Slider name="$parentScrollBar" inherits="HybridScrollBarTemplate" parentKey="scrollBar">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" x="3" y="-13" />
</Anchors>
</Slider>
</Frames>
</ScrollFrame>
</Frames>
</Frame>
 
<Frame name="InterfaceOptionsNeedToKnowProfilePanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Frame name="NeedToKnowScrollButtonTemplate" virtual="true">
<Layers>
<Layer name="ARTWORK">
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Left">
<Size>
<AbsDimension x="190" y="20"/>
</Size>
</Texture>
</Layer>
</Layers>
</Frame>
 
<Frame name="InterfaceOptionsNeedToKnowAppearancePanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentTitle" text="NeedToKnow" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
650,38 → 549,387
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentCurrentProfileLabel" inherits="GameFontNormalSmall">
</Layer>
</Layers>
<Scripts>
<OnLoad>
NeedToKnowOptions.UIPanel_Appearance_OnLoad(self)
</OnLoad>
<OnShow>
NeedToKnowOptions.UIPanel_Appearance_OnShow(self);
</OnShow>
<OnHide>
</OnHide>
<OnSizeChanged>
NeedToKnowOptions.UIPanel_Appearance_OnSizeChanged(self)
</OnSizeChanged>
</Scripts>
<Frames>
<Button name="$parentBackgroundColorButton" inherits="NeedToKnow_ColorButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Label"]:SetText(NEEDTOKNOW.UIPANEL_BACKGROUNDCOLOR);
self:RegisterForClicks("LeftButtonUp");
</OnLoad>
<OnClick>
NeedToKnowOptions.ChooseColor("BkgdColor");
</OnClick>
</Scripts>
</Button>
 
<Slider name="$parentBarSpacingSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBackgroundColorButton" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-32"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnValueChanged>
NeedToKnow.ProfileSettings["BarSpacing"] = value;
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_BARSPACING..": "..value);
NeedToKnow.Update();
</OnValueChanged>
</Scripts>
</Slider>
 
<Slider name="$parentBarPaddingSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBarSpacingSlider" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="20" y="0" />
</Offset>
</Anchor>
</Anchors>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBarSpacingSlider" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-32"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnValueChanged>
NeedToKnow.ProfileSettings["BarPadding"] = value;
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_BARPADDING..": "..value);
NeedToKnow.Update();
</OnValueChanged>
</Scripts>
</Slider>
 
<Slider name="$parentFontSizeSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parentBackgroundColorButton" />
<Anchor point="LEFT" relativeTo="$parentBarPaddingSlider" />
</Anchors>
<Scripts>
<OnValueChanged>
NeedToKnow.ProfileSettings["FontSize"] = value;
_G[self:GetName().."Text"]:SetText("Font Size: "..value); -- FIXME: LOCALIZATION
NeedToKnow.Update();
</OnValueChanged>
</Scripts>
</Slider>
 
<Button name="$parentConfigModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE);
</OnLoad>
<OnClick>
NeedToKnow.LockToggle(false);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_CONFIGMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
 
<Button name="$parentPlayModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-24" y="24"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE);
</OnLoad>
<OnClick>
NeedToKnow.LockToggle(true);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PLAYMODE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
 
<Frame name="$parentTextures" inherits="NeedToKnowScrollFrameTemplate" parentKey="Textures">
<Anchors>
<Anchor point="TOP" relativeTo="$parentBarSpacingSlider" relativePoint="BOTTOM" y="-20"/>
<Anchor point="LEFT" relativePoint="LEFT" x="14"/>
<Anchor point="BOTTOM" relativeTo="$parentConfigModeButton" relativePoint="TOP" y="10"/>
</Anchors>
</Frame>
 
<Frame name="$parentFonts" inherits="NeedToKnowScrollFrameTemplate" parentKey="Fonts">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTextures" relativePoint="TOPRIGHT" x="10"/>
<Anchor point="BOTTOM" relativeTo="$parentConfigModeButton" relativePoint="TOP" y="10"/>
<Anchor point="RIGHT" x ="-10"/>
</Anchors>
</Frame>
</Frames>
</Frame>
 
<Frame name="InterfaceOptionsNeedToKnowProfilePanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentTitle" text="NeedToKnow" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-16"/>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentCurrentProfile" inherits="GameFontHightlightSmall">
<FontString name="$parentVersion" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentCurrentProfileLabel" relativePoint="TOPRIGHT">
<Anchor point="LEFT" relativeTo="$parentTitle" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0"/>
<AbsDimension x="4" y="-0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSubText1" inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP">
<Size>
<AbsDimension y="24" x="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-24" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentSwitchToBtn" text="Switch To" inherits="UIPanelButtonTemplate" parentKey="SwitchToBtn">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="TOP" relativeTo="$parentSubText1" relativePoint="BOTTOM" y="-16"/>
<Anchor point="RIGHT" x ="-10" />
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.UIPanel_Profile_SwitchToSelected(self:GetParent());
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_SWITCHPROFILE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
 
<Button name="$parentDeleteBtn" text="Delete" inherits="UIPanelButtonTemplate" parentKey="DeleteBtn">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentSwitchToBtn" relativePoint="BOTTOMRIGHT" y="-16"/>
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.UIPanel_Profile_DeleteSelected(self:GetParent());
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_DELETEPROFILE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
</Frames>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentEditLabel" inherits="GameFontNormalSmall" text="New profile name:" nonspacewrap="true" maxLines="1" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentDeleteBtn" relativePoint="BOTTOMLEFT" y="-20"/>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<EditBox name="$parentNewName" inherits="InputBoxTemplate" letters="256" historyLines="0" autoFocus="false" parentKey="NewName">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentEditLabel" relativePoint="BOTTOMLEFT"/>
</Anchors>
<Scripts>
<OnEscapePressed>
self:ClearFocus()
</OnEscapePressed>
<OnTabPressed>
self:ClearFocus()
</OnTabPressed>
<OnChar>
NeedToKnowOptions.UpdateProfileList()
</OnChar>
<OnLoad>
self:SetTextColor(1,1,1)
</OnLoad>
</Scripts>
</EditBox>
 
<Button name="$parentCopyBtn" text="Duplicate" inherits="UIPanelButtonTemplate" parentKey="CopyBtn">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="TOP" relativeTo="$parentNewName" relativePoint="BOTTOM" y="-16"/>
<Anchor point="RIGHT" relativeTo="$parentDeleteBtn" relativePoint="RIGHT" x="-2"/>
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.UIPanel_Profile_CopySelected(self:GetParent());
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_COPYPROFILE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
 
<Button name="$parentRenameBtn" text="Rename" inherits="UIPanelButtonTemplate" parentKey="RenameBtn">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentCopyBtn" relativePoint="BOTTOMRIGHT" y="-16"/>
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.UIPanel_Profile_RenameSelected(self:GetParent());
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_RENAMEPROFILE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
 
<!--Button name="$parentPublicBtn" text="Make Public" inherits="UIPanelButtonTemplate" parentKey="PublicBtn">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentRenameBtn" relativePoint="BOTTOMRIGHT" y="-16"/>
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.UIPanel_Profile_PublicizeSelected(self:GetParent(), true);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PUBLICPROFILE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
 
 
<Button name="$parentPrivateBtn" text="Make Private" inherits="UIPanelButtonTemplate" parentKey="PrivateBtn">
<Size>
<AbsDimension x="128" y="22"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentRenameBtn" relativePoint="BOTTOMRIGHT" y="-16"/>
</Anchors>
<Scripts>
<OnClick>
NeedToKnowOptions.UIPanel_Profile_PrivatizeSelected(self:GetParent(), false);
</OnClick>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PRIVATEPROFILE_TOOLTIP, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button-->
 
<Frame name="$parentProfiles" inherits="NeedToKnowScrollFrameTemplate" parentKey="Profiles">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT" y="-16"/>
<Anchor point="BOTTOM" y="10"/>
<Anchor point="RIGHT" relativeTo="$parentSwitchToBtn" relativePoint="LEFT" x ="-4"/>
</Anchors>
</Frame>
</Frames>
<Scripts>
<OnLoad>
self.name = NEEDTOKNOW.UIPANEL_PROFILE;
self.parent = "NeedToKnow";
self.default = NeedToKnow.Reset;
-- self.cancel = NeedToKnow.Cancel;
-- need different way to handle cancel? users might open appearance panel without opening main panel
InterfaceOptions_AddCategory(self);
NeedToKnow.UIPanel_Profile_OnLoad(self)
NeedToKnowOptions.UIPanel_Profile_OnLoad(self)
</OnLoad>
<OnShow>
NeedToKnow.UIPanel_Profile_OnShow();
NeedToKnowOptions.UIPanel_Profile_OnShow(self);
</OnShow>
<OnHide>
</OnHide>
Kitjan/NeedToKnow/NeedToKnow_Options.lua
5,6 → 5,9
local textureList = LSM:List("statusbar");
local fontList = LSM:List("font");
 
NeedToKnowOptions = {}
NeedToKnowRMB = {}
 
function NeedToKnow.SlashCommand(cmd)
local args = {}
for arg in cmd:gmatch("(%S+)") do
24,7 → 27,21
NeedToKnow.Show(false);
elseif ( cmd == NEEDTOKNOW.CMD_PROFILE ) then
if args[1] then
NeedToKnow.ChangeProfile(table.concat(args, " "))
local profileName = table.concat(args, " ")
local key
for k,t in pairs(NeedToKnow_Profiles) do
if t.name == profileName then
if key then
printf("Warning! Ambiguity between account-wide and per-character profile.")
end
key = k
end
end
if key then
NeedToKnow.ChangeProfile(key)
else
print("Could not find a profile named '",profileName,"'");
end
else
local spec = GetActiveTalentGroup()
local profile = NeedToKnow.CharSettings.Specs[spec]
35,16 → 52,23
end
end
 
function NeedToKnow.LockToggle()
if ( NeedToKnow.CharSettings["Locked"] ) then
NeedToKnow.CharSettings["Locked"] = false;
else
NeedToKnow.CharSettings["Locked"] = true;
function NeedToKnow.LockToggle(bLock)
if nil == bLock then
if NeedToKnow.CharSettings["Locked"] then
bLock = false;
else
bLock = true;
end
end
 
NeedToKnow.Show(true);
PlaySound("UChatScrollButton");
NeedToKnow.last_cast = {};
NeedToKnow.Update();
 
if NeedToKnow.CharSettings["Locked"] ~= bLock then
NeedToKnow.CharSettings["Locked"] = bLock;
NeedToKnow.last_cast = {};
NeedToKnow.Update();
end
end
 
 
52,10 → 76,10
-- INTERFACE OPTIONS PANEL: MAIN
-- -----------------------------
 
function NeedToKnow.UIPanel_OnLoad(self)
function NeedToKnowOptions.UIPanel_OnLoad(self)
local panelName = self:GetName();
local numberbarsLabel = _G[panelName.."NumberbarsLabel"];
local fixedDurationLabel = _G[panelName.."FixedDurationLabel"];
local fixedDurationLabel = _G[panelName.."FixedDurationLabel"];
_G[panelName.."Version"]:SetText(NEEDTOKNOW.VERSION);
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_SUBTEXT1);
numberbarsLabel:SetText(NEEDTOKNOW.UIPANEL_NUMBERBARS);
64,30 → 88,30
fixedDurationLabel:SetWidth(50);
end
 
function NeedToKnow.UIPanel_OnShow()
function NeedToKnowOptions.UIPanel_OnShow()
NeedToKnow_OldSettings = CopyTable(NeedToKnow.ProfileSettings);
NeedToKnow.UIPanel_Update();
NeedToKnowOptions.UIPanel_Update();
end
 
function NeedToKnow.UIPanel_Update()
function NeedToKnowOptions.UIPanel_Update()
local panelName = "InterfaceOptionsNeedToKnowPanel";
if not _G[panelName]:IsVisible() then return end
 
local settings = NeedToKnow.ProfileSettings;
 
for groupID = 1, settings.nGroups do
NeedToKnow.GroupEnableButton_Update(groupID);
NeedToKnow.NumberbarsWidget_Update(groupID);
NeedToKnowOptions.GroupEnableButton_Update(groupID);
NeedToKnowOptions.NumberbarsWidget_Update(groupID);
_G[panelName.."Group"..groupID.."FixedDurationBox"]:SetText(settings.Groups[groupID]["FixedDuration"] or "");
end
end
 
function NeedToKnow.GroupEnableButton_Update(groupID)
function NeedToKnowOptions.GroupEnableButton_Update(groupID)
local button = _G["InterfaceOptionsNeedToKnowPanelGroup"..groupID.."EnableButton"];
button:SetChecked(NeedToKnow.ProfileSettings.Groups[groupID]["Enabled"]);
end
 
function NeedToKnow.GroupEnableButton_OnClick(self)
function NeedToKnowOptions.GroupEnableButton_OnClick(self)
local groupID = self:GetParent():GetID();
if ( self:GetChecked() ) then
NeedToKnow.ProfileSettings.Groups[groupID]["Enabled"] = true;
97,7 → 121,7
NeedToKnow.Update();
end
 
function NeedToKnow.NumberbarsWidget_Update(groupID)
function NeedToKnowOptions.NumberbarsWidget_Update(groupID)
local widgetName = "InterfaceOptionsNeedToKnowPanelGroup"..groupID.."NumberbarsWidget";
local text = _G[widgetName.."Text"];
local leftButton = _G[widgetName.."LeftButton"];
113,7 → 137,7
end
end
 
function NeedToKnow.NumberbarsButton_OnClick(self, increment)
function NeedToKnowOptions.NumberbarsButton_OnClick(self, increment)
local groupID = self:GetParent():GetParent():GetID();
local oldNumber = NeedToKnow.ProfileSettings.Groups[groupID]["NumberBars"];
if ( oldNumber == 1 ) and ( increment < 0 ) then
123,10 → 147,10
end
NeedToKnow.ProfileSettings.Groups[groupID]["NumberBars"] = oldNumber + increment;
NeedToKnow.Group_Update(groupID);
NeedToKnow.NumberbarsWidget_Update(groupID);
NeedToKnowOptions.NumberbarsWidget_Update(groupID);
end
 
function NeedToKnow.FixedDurationEditBox_OnTextChanged(self)
function NeedToKnowOptions.FixedDurationEditBox_OnTextChanged(self)
local enteredText = self:GetText();
if enteredText == "" then
NeedToKnow.ProfileSettings.Groups[self:GetParent():GetID()]["FixedDuration"] = nil;
136,8 → 160,10
NeedToKnow.Update();
end
 
function NeedToKnow.Cancel()
NeedToKnow.ProfileSettings = CopyTable(NeedToKnow_OldSettings);
function NeedToKnowOptions.Cancel()
-- Can't copy the table here since ProfileSettings needs to point to the right place in
-- NeedToKnow_Globals.Profiles or in NeedToKnow_CharSettings.Profiles
NeedToKnow.RestoreTableFromCopy(NeedToKnow.ProfileSettings, NeedToKnow_OldSettings);
-- FIXME: Close context menu if it's open; it may be referring to bar that doesn't exist
NeedToKnow.Update();
end
146,24 → 172,81
-- -----------------------------------
-- INTERFACE OPTIONS PANEL: APPEARANCE
-- -----------------------------------
NeedToKnowOptions.DefaultSelectedColor = { 0.1, 0.6, 0.8, 1 }
NeedToKnowOptions.DefaultNormalColor = { 0.7, 0.7, 0.7, 0 }
 
function NeedToKnow.UIPanel_Appearance_OnLoad(self)
local panelName = self:GetName();
_G[panelName.."Version"]:SetText(NEEDTOKNOW.VERSION);
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_SUBTEXT1);
function NeedToKnowOptions.UIPanel_Appearance_OnLoad(self)
self.name = NEEDTOKNOW.UIPANEL_APPEARANCE;
self.parent = "NeedToKnow"
self.default = NeedToKnow.ResetCharacter
self.cancel = NeedToKnowOptions.Cancel
-- need different way to handle cancel? users might open appearance panel without opening main panel
InterfaceOptions_AddCategory(self)
 
local panelName = self:GetName()
_G[panelName.."Version"]:SetText(NEEDTOKNOW.VERSION)
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_SUBTEXT1)
 
self.Textures.fnClick = NeedToKnowOptions.OnClickTextureItem
self.Textures.configure = function(i, btn, label)
btn.Bg:SetTexture(NeedToKnow.LSM:Fetch("statusbar",label))
end
self.Textures.List.update = NeedToKnowOptions.UpdateBarTextureDropDown
self.Textures.normal_color = { 0.7, 0.7, 0.7, 1 }
 
self.Fonts.fnClick = NeedToKnowOptions.OnClickFontItem
self.Fonts.configure = function(i, btn, label)
local fontPath = NeedToKnow.LSM:Fetch("font",label)
btn.text:SetFont(fontPath, 12)
btn.Bg:SetTexture(NeedToKnow.LSM:Fetch("statusbar","Minimalist"))
end
self.Fonts.List.update = NeedToKnowOptions.UpdateBarFontDropDown
 
_G[panelName.."TexturesTitle"]:SetText("Texture:") -- FIXME localization
_G[panelName.."FontsTitle"]:SetText("Font:") -- FIXME localization
end
 
function NeedToKnow.UIPanel_Appearance_OnShow()
NeedToKnow.UIPanel_Appearance_Update();
function NeedToKnowOptions.UIPanel_Appearance_OnShow(self)
NeedToKnowOptions.UIPanel_Appearance_Update();
 
-- todo: Cache this? Update needs it to
local idxCurrent = 1
for i = 1, #textureList do
if NeedToKnow.ProfileSettings["BarTexture"] == textureList[i] then
idxCurrent = i
break;
end
end
local idxScroll = idxCurrent - 3
if idxScroll < 0 then
idxScroll = 0
end
self.Textures.List.scrollBar:SetValue(idxScroll * self.Textures.List.buttonHeight+0.1)
HybridScrollFrame_OnMouseWheel(self.Textures.List, 1, 0.1);
 
for i = 1, #fontList do
if NeedToKnow.ProfileSettings["BarFont"] == fontList[i] then
idxCurrent = i
break;
end
end
idxScroll = idxCurrent - 3
if idxScroll < 0 then
idxScroll = 0
end
self.Fonts.List.scrollBar:SetValue(idxScroll * self.Fonts.List.buttonHeight+0.1)
HybridScrollFrame_OnMouseWheel(self.Fonts.List, 1, 0.1);
end
 
function NeedToKnow.UIPanel_Appearance_Update()
function NeedToKnowOptions.UIPanel_Appearance_Update()
local panelName = "InterfaceOptionsNeedToKnowAppearancePanel";
if not _G[panelName]:IsVisible() then return end
local panel = _G[panelName]
if not panel or not panel:IsVisible() then return end
 
local settings = NeedToKnow.ProfileSettings;
local barSpacingSlider = _G[panelName.."BarSpacingSlider"];
local barPaddingSlider = _G[panelName.."BarPaddingSlider"];
local fontSizeSlider = _G[panelName.."FontSizeSlider"];
 
-- Mimic the behavior of the context menu, and force the alpha to one in the swatch
local r,g,b = unpack(settings.BkgdColor);
171,62 → 254,290
 
barSpacingSlider:SetMinMaxValues(0, NEEDTOKNOW.MAXBARSPACING);
barSpacingSlider:SetValue(settings.BarSpacing);
barSpacingSlider:SetValueStep(0.25);
barPaddingSlider:SetMinMaxValues(0, NEEDTOKNOW.MAXBARPADDING);
barPaddingSlider:SetValue(settings.BarPadding);
barPaddingSlider:SetValueStep(0.25);
fontSizeSlider:SetMinMaxValues(5,20);
fontSizeSlider:SetValue(settings.FontSize);
fontSizeSlider:SetValueStep(0.5);
 
NeedToKnow.UpdateBarTextureDropDown(panelName);
NeedToKnow.UpdateBarFontDropDown(panelName);
NeedToKnowOptions.UpdateBarTextureDropDown(_G[panelName.."Textures"]);
NeedToKnowOptions.UpdateBarFontDropDown(_G[panelName.."Fonts"]);
end
 
-- -----------------------------------
-- INTERFACE OPTIONS PANEL: PROFILE
-- -----------------------------------
 
function NeedToKnow.UIPanel_Profile_OnLoad(self)
function NeedToKnowOptions.UIPanel_Profile_OnLoad(self)
self.name = NEEDTOKNOW.UIPANEL_PROFILE;
self.parent = "NeedToKnow";
self.default = NeedToKnow.ResetCharacter;
---- self.cancel = NeedToKnow.Cancel;
---- need different way to handle cancel? users might open appearance panel without opening main panel
InterfaceOptions_AddCategory(self);
 
local panelName = self:GetName();
_G[panelName.."Version"]:SetText(NEEDTOKNOW.VERSION);
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_SUBTEXT1);
_G[panelName.."ProfilesTitle"]:SetText("Current Profile:") -- FIXME localization
 
local CurProfileLabel = _G[panelName.."CurrentProfileLabel"];
CurProfileLabel:SetText("Current Profile:"); -- FIXME: Localization
CurProfileLabel:SetWidth(50);
self.Profiles.configure = function(i, btn, label)
btn.Bg:SetTexture(NeedToKnow.LSM:Fetch("statusbar","Minimalist"))
end
self.Profiles.List.update = NeedToKnowOptions.UpdateProfileList
self.Profiles.fnClick = function(self)
local scrollPanel = self:GetParent():GetParent():GetParent()
scrollPanel.curSel = self.text:GetText()
NeedToKnowOptions.UpdateProfileList(scrollPanel)
end
end
 
function NeedToKnow.UIPanel_Profile_OnShow()
NeedToKnow.UIPanel_Profile_Update();
function NeedToKnowOptions.UIPanel_Profile_OnShow(self)
NeedToKnowOptions.RebuildProfileList(self)
NeedToKnowOptions.UIPanel_Profile_Update();
end
 
function NeedToKnow.UIPanel_Profile_Update()
function NeedToKnowOptions.UIPanel_Profile_Update()
local panelName = "InterfaceOptionsNeedToKnowProfilePanel";
if not _G[panelName]:IsVisible() then return end
local self = _G[panelName]
if not self:IsVisible() then return end
NeedToKnowOptions.UpdateProfileList()
end
 
function NeedToKnowOptions.RebuildProfileList(profilePanel)
local scrollPanel = profilePanel.Profiles
if not scrollPanel.profileNames then
scrollPanel.profileNames = { }
end
if not scrollPanel.profileMap then
scrollPanel.profileMap = { }
end
local allNames = scrollPanel.profileNames
local allRefs = scrollPanel.profileMap
local n = 0
 
local subList = NeedToKnow_Profiles
if subList then
for profKey, rProfile in pairs(subList) do
n = n + 1
local profName
if profKey:byte(1) == 71 then -- G
profName = 'Account:'..rProfile.name -- FIXME: Localization
else
profName = 'Character:'..rProfile.name -- Fixme: Character-Server:
end
allNames[n] = profName
allRefs[profName] = { ref = rProfile, global=true, key=profKey }
end
end
while n < #allNames do
table.remove(allNames)
end
 
table.sort(allNames, function(lhs,rhs) return string.upper(lhs)<string.upper(rhs) end )
NeedToKnowOptions.UpdateProfileList(scrollPanel)
end
 
function NeedToKnowOptions.IsProfileNameAvailable(newName)
if not newName or newName == "" then
return false;
end
 
for k, profile in pairs(NeedToKnow_Profiles) do
if profile.name == newName then
return false;
end
end
return true;
end
 
function NeedToKnowOptions.UpdateProfileList()
local panel = _G["InterfaceOptionsNeedToKnowProfilePanel"]
local scrollPanel = panel.Profiles
if scrollPanel.profileNames then
local curProfile
for n,r in pairs(scrollPanel.profileMap) do
if r.ref == NeedToKnow.ProfileSettings then
curProfile = n
break;
end
end
 
if not scrollPanel.curSel then
scrollPanel.curSel = curProfile
end
local curSel = scrollPanel.curSel
 
NeedToKnowOptions.UpdateScrollPanel(scrollPanel, scrollPanel.profileNames, curSel, curProfile)
 
local optionsPanel = scrollPanel:GetParent()
if curSel == curProfile then
optionsPanel.SwitchToBtn:Disable()
else
optionsPanel.SwitchToBtn:Enable()
end
 
if curSel == curProfile then
optionsPanel.DeleteBtn:Disable()
else
optionsPanel.DeleteBtn:Enable()
end
 
local curEntry = optionsPanel.NewName:GetText()
if NeedToKnowOptions.IsProfileNameAvailable(curEntry) then
optionsPanel.RenameBtn:Enable()
optionsPanel.CopyBtn:Enable()
else
optionsPanel.RenameBtn:Disable()
optionsPanel.CopyBtn:Disable()
end
--local btnScope
--if scrollPanel.profileMap[curSel].global then
--optionsPanel.PublicBtn:Hide()
--optionsPanel.PrivateBtn:Show()
--btnScope = optionsPanel.PrivateBtn
--else
--optionsPanel.PublicBtn:Show()
--optionsPanel.PrivateBtn:Hide()
--btnScope = optionsPanel.PublicBtn
--end
--
--local profileName = scrollPanel.profileMap[curSel].name
--if scrollPanel.profileMap[ profileName ] == 2 then
--btnScope:Disable()
--else
--btnScope:Enable()
--end
end
end
 
function NeedToKnowOptions.UIPanel_Profile_SwitchToSelected(panel)
local scrollPanel = panel.Profiles
local curSel = scrollPanel.curSel
if curSel then
NeedToKnow.ChangeProfile( scrollPanel.profileMap[curSel].key )
NeedToKnowOptions.UpdateProfileList()
end
end
 
StaticPopupDialogs["NEEDTOKNOW.CONFIRMDLG"] = {
button1 = YES,
button2 = NO,
timeout = 0,
hideOnEscape = 1,
OnShow = function(self)
self.oldStrata = self:GetFrameStrata()
self:SetFrameStrata("TOOLTIP")
end,
OnHide = function(self)
if self.oldStrata then
self:SetFrameStrata(self.oldStrata)
end
end
};
function NeedToKnowOptions.UIPanel_Profile_DeleteSelected(panel)
local scrollPanel = panel.Profiles
local curSel = scrollPanel.curSel
if curSel then
local k = scrollPanel.profileMap[curSel].key
local dlgInfo = StaticPopupDialogs["NEEDTOKNOW.CONFIRMDLG"]
dlgInfo.text = "Are you sure you want to delete the profile: ".. curSel .."?"
dlgInfo.OnAccept = function(self, data)
if NeedToKnow_Profiles[k] == NeedToKnow.ProfileSettings then
print("NeedToKnow: Won't delete the active profile!")
else
NeedToKnow_Profiles[k] = nil;
if (k:byte(1) == 71) and NeedToKnow_Globals.Profiles[k] then -- G
print("NeedToKnow: deleted account-wide profile", NeedToKnow_Globals.Profiles[k].name) -- FIXME: Localization
NeedToKnow_Globals.Profiles[k] = nil;
elseif NeedToKnow_CharSettings.Profiles[k] then -- C
print("NeedToKnow: deleted character profile", NeedToKnow_CharSettings.Profiles[k].name) -- FIXME: Localization
NeedToKnow_CharSettings.Profiles[k] = nil;
end
NeedToKnowOptions.RebuildProfileList(panel)
end
end
StaticPopup_Show("NEEDTOKNOW.CONFIRMDLG");
end
end
 
function NeedToKnowOptions.UIPanel_Profile_CopySelected(panel)
local scrollPanel = panel.Profiles
local curSel = scrollPanel.curSel
local edit = panel.NewName
local newName = edit:GetText()
edit:ClearFocus()
if scrollPanel.curSel and NeedToKnowOptions.IsProfileNameAvailable(newName) then
local keyNew = NeedToKnow.CreateProfile(CopyTable(scrollPanel.profileMap[curSel].ref), nil, newName)
NeedToKnow.ChangeProfile(NeedToKnow_Globals[keyNew])
NeedToKnowOptions.RebuildProfileList(panel)
print("NeedToKnow: Copied",curSel,"to",newName,"and made it the active profile")
end
end
 
 
function NeedToKnowOptions.UIPanel_Profile_RenameSelected(panel)
local scrollPanel = panel.Profiles
local edit = panel.NewName
local newName = edit:GetText()
edit:ClearFocus()
if scrollPanel.curSel and NeedToKnowOptions.IsProfileNameAvailable(newName) then
local key = scrollPanel.profileMap[scrollPanel.curSel].key
print("NeedToKnow: Renaming profile",NeedToKnow_Profiles[key].name,"to",newName)
NeedToKnow_Profiles[key].name = newName;
NeedToKnowOptions.RebuildProfileList(panel)
end
end
 
--function NeedToKnowOptions.UIPanel_Profile_PublicizeSelected(panel)
--local scrollPanel = panel.Profiles
--if scrollPanel.curSel then
--local profileName = scrollPanel.profileMap[scrollPanel.curSel].name
--local ref = NeedToKnow_Settings.Profiles[profileName]
--NeedToKnow_Globals.Profiles[profileName] = ref
--NeedToKnow_Settings.Profiles[profileName] = nil
--NeedToKnowOptions.RebuildProfileList(scrollPanel)
--end
--end
--
--function NeedToKnowOptions.UIPanel_Profile_PrivatizeSelected(panel)
--local scrollPanel = panel.Profiles
--if scrollPanel.curSel then
--local profileName = scrollPanel.profileMap[scrollPanel.curSel].name
--local ref = NeedToKnow_Globals.Profiles[profileName]
--NeedToKnow_Settings.Profiles[profileName] = ref
--NeedToKnow_Globals.Profiles[profileName] = nil
--NeedToKnowOptions.RebuildProfileList(scrollPanel)
--end
--end
--
-- -----
 
function NeedToKnow.UpdateBarTextureSlider(info, value)
getglobal(info:GetName().."Label"):SetText(textureList[value]);
NeedToKnow.ProfileSettings["BarTexture"] = textureList[value];
NeedToKnow.Update();
function NeedToKnowOptions.OnClickTextureItem(self)
NeedToKnow.ProfileSettings["BarTexture"] = self.text:GetText()
NeedToKnow.Update()
NeedToKnowOptions.UIPanel_Appearance_Update()
end
 
function NeedToKnow.UpdateBarFontSlider(info, value)
local fontName = fontList[value];
local fontPath = LSM:Fetch("font", fontName);
getglobal(info:GetName().."Label"):SetText(fontName);
NeedToKnow.ProfileSettings["BarFont"] = fontPath;
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
 
function NeedToKnowOptions.OnClickFontItem(self)
NeedToKnow.ProfileSettings["BarFont"] = self.text:GetText()
NeedToKnow.Update()
NeedToKnowOptions.UIPanel_Appearance_Update()
end
 
 
function NeedToKnow.ChooseColor(variable)
 
function NeedToKnowOptions.ChooseColor(variable)
info = UIDropDownMenu_CreateInfo();
info.r, info.g, info.b, info.opacity = unpack(NeedToKnow.ProfileSettings[variable]);
info.opacity = 1 - info.opacity;
info.hasOpacity = true;
info.opacityFunc = NeedToKnow.SetOpacity;
info.swatchFunc = NeedToKnow.SetColor;
info.cancelFunc = NeedToKnow.CancelColor;
info.opacityFunc = NeedToKnowOptions.SetOpacity;
info.swatchFunc = NeedToKnowOptions.SetColor;
info.cancelFunc = NeedToKnowOptions.CancelColor;
info.extraInfo = variable;
-- Not sure if I should leave this state around or not. It seems like the
-- correct strata to have it at anyway, so I'm going to leave it there for now
234,73 → 545,119
OpenColorPicker(info);
end
 
function NeedToKnow.SetColor()
function NeedToKnowOptions.SetColor()
local variable = ColorPickerFrame.extraInfo;
local r,g,b = ColorPickerFrame:GetColorRGB();
NeedToKnow.ProfileSettings[variable][1] = r;
NeedToKnow.ProfileSettings[variable][2] = g;
NeedToKnow.ProfileSettings[variable][3] = b;
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
NeedToKnowOptions.UIPanel_Appearance_Update();
end
 
function NeedToKnow.SetOpacity()
function NeedToKnowOptions.SetOpacity()
local variable = ColorPickerFrame.extraInfo;
NeedToKnow.ProfileSettings[variable][4] = 1 - OpacitySliderFrame:GetValue();
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
NeedToKnowOptions.UIPanel_Appearance_Update();
end
 
function NeedToKnow.CancelColor(previousValues)
function NeedToKnowOptions.CancelColor(previousValues)
if ( previousValues ) then
local variable = ColorPickerFrame.extraInfo;
NeedToKnow.ProfileSettings[variable] = {previousValues.r, previousValues.g, previousValues.b, previousValues.opacity};
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
NeedToKnowOptions.UIPanel_Appearance_Update();
end
end
 
function NeedToKnow.UpdateBarTextureDropDown(panelName)
local barTextureSlider = _G[panelName.."BarTextureSlider"];
barTextureSlider:SetMinMaxValues(1, #(textureList));
barTextureSlider:SetValueStep(1);
getglobal(panelName.."BarTextureSliderLow"):SetText('');
getglobal(panelName.."BarTextureSliderHigh"):SetText('');
local textureLabel = getglobal(panelName.."BarTextureSliderLabel");
textureLabel:SetText(NeedToKnow.ProfileSettings["BarTexture"]);
local fn = textureLabel:GetFont();
textureLabel:SetFont(fn, 10); -- There's got to be some way to say this in the xml
getglobal(panelName.."BarTextureSliderText"):SetText(NEEDTOKNOW.UIPANEL_BARTEXTURE);
for i=1, #(textureList) do
if textureList[i] == NeedToKnow.ProfileSettings.BarTexture then
barTextureSlider:SetValue(i);
end
function NeedToKnowOptions.UIPanel_Appearance_OnSizeChanged(self)
-- Despite my best efforts, the scroll bars insist on being outside the width of their
local mid = self:GetWidth()/2 --+ _G[self:GetName().."TexturesListScrollBar"]:GetWidth()
local textures = self.Textures
local leftTextures = textures:GetLeft()
if mid and mid > 0 and textures and leftTextures then
local ofs = leftTextures - self:GetLeft()
textures:SetWidth(mid - ofs)
end
end
 
function NeedToKnow.UpdateBarFontDropDown(panelName)
local barFontSlider = _G[panelName.."BarFontSlider"];
barFontSlider:SetMinMaxValues(1, #(fontList));
barFontSlider:SetValueStep(1);
getglobal(panelName.."BarFontSliderLow"):SetText('');
getglobal(panelName.."BarFontSliderHigh"):SetText('');
getglobal(panelName.."BarFontSliderText"):SetText(NEEDTOKNOW.UIPANEL_BARFONT);
 
for i=1, #(fontList) do
if ( LSM:Fetch("font", fontList[i]) == NeedToKnow.ProfileSettings.BarFont ) then
barFontSlider:SetValue(i);
local lbl = getglobal(panelName.."BarFontSliderLabel");
lbl:SetText(fontList[i]);
lbl:SetFont(NeedToKnow.ProfileSettings.BarFont, 10);
 
function NeedToKnowOptions.OnScrollFrameSized(self)
local old_value = self.scrollBar:GetValue();
local scrollFrame = self:GetParent();
 
HybridScrollFrame_CreateButtons(self, "NeedToKnowScrollItemTemplate")
--scrollFrame.Update(scrollFrame)
 
local max_value = self.range or self:GetHeight()
self.scrollBar:SetValue(min(old_value, max_value));
-- Work around a bug in HybridScrollFrame; it can't scroll by whole items (wow 4.1)
--self.stepSize = self.buttons[1]:GetHeight()*.9
end
 
 
function NeedToKnowOptions.UpdateScrollPanel(panel, list, selected, checked)
local Value = _G[panel:GetName().."Value"]
Value:SetText(checked)
 
local PanelList = panel.List
local buttons = PanelList.buttons
HybridScrollFrame_Update(PanelList, #(list) * buttons[1]:GetHeight() , PanelList:GetHeight())
 
local numButtons = #buttons;
local scrollOffset = HybridScrollFrame_GetOffset(PanelList);
local label;
for i = 1, numButtons do
local idx = i + scrollOffset
label = list[idx]
if ( label ) then
buttons[i]:Show();
buttons[i].text:SetText(label);
 
if ( label == checked ) then
buttons[i].Check:Show();
else
buttons[i].Check:Hide();
end
if ( label == selected ) then
local color = panel.selected_color
if not color then color = NeedToKnowOptions.DefaultSelectedColor end
buttons[i].Bg:SetVertexColor(unpack(color));
else
local color = panel.normal_color
if not color then color = NeedToKnowOptions.DefaultNormalColor end
buttons[i].Bg:SetVertexColor(unpack(color));
end
 
panel.configure(i, buttons[i], label)
else
buttons[i]:Hide();
end
end
end
 
--function NeedToKnowOptions.OnScrollFrameScrolled(self)
--local scrollPanel = self:GetParent()
--local fn = scrollPanel.Update
--if fn then fn(scrollPanel) end
--end
--
function NeedToKnowOptions.UpdateBarTextureDropDown()
local scrollPanel = _G["InterfaceOptionsNeedToKnowAppearancePanelTextures"]
NeedToKnowOptions.UpdateScrollPanel(scrollPanel, textureList, NeedToKnow.ProfileSettings.BarTexture, NeedToKnow.ProfileSettings.BarTexture)
end
 
function NeedToKnowOptions.UpdateBarFontDropDown()
local scrollPanel = _G["InterfaceOptionsNeedToKnowAppearancePanelFonts"]
NeedToKnowOptions.UpdateScrollPanel(scrollPanel, fontList, nil, NeedToKnow.ProfileSettings.BarFont)
end
 
-- --------
-- BAR GUI
-- --------
 
NeedToKnow.CurrentBar = { groupID = 1, barID = 1 }; -- a dirty hack, i know.
NeedToKnowRMB.CurrentBar = { groupID = 1, barID = 1 }; -- a dirty hack, i know.
 
StaticPopupDialogs["NEEDTOKNOW.CHOOSENAME_DIALOG"] = {
text = NEEDTOKNOW.CHOOSENAME_DIALOG,
312,15 → 669,11
local text = self.editBox:GetText();
local variable = self.variable;
if ( nil ~= variable ) then
NeedToKnow.BarMenu_ChooseName(text, variable);
NeedToKnowRMB.BarMenu_ChooseName(text, variable);
end
end,
EditBoxOnEnterPressed = function(self)
local text = self:GetParent().editBox:GetText();
local variable = self:GetParent().variable;
if ( nil ~= variable ) then
NeedToKnow.BarMenu_ChooseName(text, variable);
end
StaticPopupDialogs["NEEDTOKNOW.CHOOSENAME_DIALOG"].OnAccept(self:GetParent())
self:GetParent():Hide();
end,
EditBoxOnEscapePressed = function(self)
340,7 → 693,7
hideOnEscape = 1,
};
 
NeedToKnow.BarMenu_MoreOptions = {
NeedToKnowRMB.BarMenu_MoreOptions = {
{ VariableName = "Enabled", MenuText = NEEDTOKNOW.BARMENU_ENABLE },
{ VariableName = "AuraName", MenuText = NEEDTOKNOW.BARMENU_CHOOSENAME, Type = "Dialog", DialogText = "CHOOSENAME_DIALOG" },
{ VariableName = "BuffOrDebuff", MenuText = NEEDTOKNOW.BARMENU_BUFFORDEBUFF, Type = "Submenu" },
353,7 → 706,7
{ VariableName = "BarColor", MenuText = NEEDTOKNOW.BARMENU_BARCOLOR, Type = "Color" },
}
 
NeedToKnow.BarMenu_SubMenus = {
NeedToKnowRMB.BarMenu_SubMenus = {
-- the keys on this table need to match the settings variable names
BuffOrDebuff = {
{ Setting = "HELPFUL", MenuText = NEEDTOKNOW.BARMENU_HELPFUL },
424,27 → 777,24
},
};
 
NeedToKnow.BarMenu_SubMenus.Opt_HARMFUL = NeedToKnow.BarMenu_SubMenus.Opt_HELPFUL;
NeedToKnowRMB.BarMenu_SubMenus.Opt_HARMFUL = NeedToKnowRMB.BarMenu_SubMenus.Opt_HELPFUL;
 
function NeedToKnow.Bar_OnMouseUp(self, button)
if ( button == "RightButton" ) then
PlaySound("UChatScrollButton");
NeedToKnow.CurrentBar["barID"] = self:GetID();
NeedToKnow.CurrentBar["groupID"] = self:GetParent():GetID();
if not NeedToKnow.DropDown then
NeedToKnow.DropDown = CreateFrame("Frame", "NeedToKnowDropDown", nil, "NeedToKnow_DropDownTemplate")
end
 
-- There's no OpenDropDownMenu that forces it to show in the new place,
-- so we have to check if the first Toggle opened or closed it
ToggleDropDownMenu(1, nil, NeedToKnow.DropDown, "cursor", 0, 0);
if not DropDownList1:IsShown() then
ToggleDropDownMenu(1, nil, NeedToKnow.DropDown, "cursor", 0, 0);
end
end
function NeedToKnowRMB.ShowMenu(bar)
NeedToKnowRMB.CurrentBar["barID"] = bar:GetID();
NeedToKnowRMB.CurrentBar["groupID"] = bar:GetParent():GetID();
if not NeedToKnowRMB.DropDown then
NeedToKnowRMB.DropDown = CreateFrame("Frame", "NeedToKnowDropDown", nil, "NeedToKnow_DropDownTemplate")
end
 
-- There's no OpenDropDownMenu that forces it to show in the new place,
-- so we have to check if the first Toggle opened or closed it
ToggleDropDownMenu(1, nil, NeedToKnowRMB.DropDown, "cursor", 0, 0);
if not DropDownList1:IsShown() then
ToggleDropDownMenu(1, nil, NeedToKnowRMB.DropDown, "cursor", 0, 0);
end
end
 
function NeedToKnow.BarMenu_AddButton(barSettings, i_desc, i_parent)
function NeedToKnowRMB.BarMenu_AddButton(barSettings, i_desc, i_parent)
info = UIDropDownMenu_CreateInfo();
local item_type = i_desc["Type"];
info.text = i_desc["MenuText"];
473,14 → 823,15
info.keepShownOnClick = true;
 
if ( not item_type and not text and not info.value ) then
info.func = NeedToKnow.BarMenu_IgnoreToggle;
info.func = NeedToKnowRMB.BarMenu_IgnoreToggle;
info.disabled = true;
elseif ( nil == item_type or item_type == "Check" ) then
info.func = NeedToKnow.BarMenu_ToggleSetting;
info.func = NeedToKnowRMB.BarMenu_ToggleSetting;
info.checked = (nil ~= varSettings and varSettings);
info.notCheckable = false;
info.isNotRadio = true;
elseif ( item_type == "SetVar" ) then
info.func = NeedToKnow.BarMenu_ChooseSetting;
info.func = NeedToKnowRMB.BarMenu_ChooseSetting;
info.value = i_desc["Setting"];
info.checked = (varSettings == info.value);
info.notCheckable = false;
488,10 → 839,11
elseif ( item_type == "Submenu" ) then
info.hasArrow = true;
--info.notCheckable = true;
-- The above doesn't really do what we want, so do it ourselves
info.func = NeedToKnow.BarMenu_IgnoreToggle;
-- The above doesn't really do what we want, so hack it
info.isNotRadio = true;
info.func = NeedToKnowRMB.BarMenu_IgnoreToggle;
elseif ( item_type == "Dialog" ) then
info.func = NeedToKnow.BarMenu_ShowNameDialog;
info.func = NeedToKnowRMB.BarMenu_ShowNameDialog;
info.keepShownOnClick = false;
info.value = {variable = i_desc.VariableName, text = i_desc.DialogText, numeric = i_desc.Numeric };
elseif ( item_type == "Color" ) then
501,9 → 853,9
info.g = varSettings.g;
info.b = varSettings.b;
info.opacity = 1 - varSettings.a;
info.swatchFunc = NeedToKnow.BarMenu_SetColor;
info.opacityFunc = NeedToKnow.BarMenu_SetOpacity;
info.cancelFunc = NeedToKnow.BarMenu_CancelColor;
info.swatchFunc = NeedToKnowRMB.BarMenu_SetColor;
info.opacityFunc = NeedToKnowRMB.BarMenu_SetOpacity;
info.cancelFunc = NeedToKnowRMB.BarMenu_CancelColor;
 
info.func = UIDropDownMenuButton_OpenColorPicker;
info.keepShownOnClick = false;
523,15 → 875,15
end
end
 
function NeedToKnow.BarMenu_Initialize()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
function NeedToKnowRMB.BarMenu_Initialize()
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
 
if ( barSettings.MissingBlink.a == 0 ) then
barSettings.blink_enabled = false;
end
NeedToKnow.BarMenu_SubMenus.Options = NeedToKnow.BarMenu_SubMenus["Opt_"..barSettings.BuffOrDebuff];
NeedToKnowRMB.BarMenu_SubMenus.Options = NeedToKnowRMB.BarMenu_SubMenus["Opt_"..barSettings.BuffOrDebuff];
 
if ( UIDROPDOWNMENU_MENU_LEVEL > 1 ) then
if ( UIDROPDOWNMENU_MENU_VALUE == "VisualCastTime" ) then
554,13 → 906,13
UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
end
end
local subMenus = NeedToKnow.BarMenu_SubMenus;
local subMenus = NeedToKnowRMB.BarMenu_SubMenus;
for index, value in ipairs(subMenus[UIDROPDOWNMENU_MENU_VALUE]) do
NeedToKnow.BarMenu_AddButton(barSettings, value, UIDROPDOWNMENU_MENU_VALUE);
NeedToKnowRMB.BarMenu_AddButton(barSettings, value, UIDROPDOWNMENU_MENU_VALUE);
end
 
if ( false == barSettings.OnlyMine and UIDROPDOWNMENU_MENU_LEVEL == 2 ) then
NeedToKnow.BarMenu_UncheckAndDisable(2, "bDetectExtends", false);
NeedToKnowRMB.BarMenu_UncheckAndDisable(2, "bDetectExtends", false);
end
return;
end
573,9 → 925,9
UIDropDownMenu_AddButton(info);
end
 
local moreOptions = NeedToKnow.BarMenu_MoreOptions;
local moreOptions = NeedToKnowRMB.BarMenu_MoreOptions;
for index, value in ipairs(moreOptions) do
NeedToKnow.BarMenu_AddButton(barSettings, moreOptions[index]);
NeedToKnowRMB.BarMenu_AddButton(barSettings, moreOptions[index]);
end
 
info = UIDropDownMenu_CreateInfo();
585,14 → 937,14
-- clear settings
info = UIDropDownMenu_CreateInfo();
info.text = NEEDTOKNOW.BARMENU_CLEARSETTINGS;
info.func = NeedToKnow.BarMenu_ClearSettings;
info.func = NeedToKnowRMB.BarMenu_ClearSettings;
UIDropDownMenu_AddButton(info);
 
NeedToKnow.BarMenu_UpdateSettings(barSettings);
NeedToKnowRMB.BarMenu_UpdateSettings(barSettings);
end
 
function NeedToKnow.BarMenu_IgnoreToggle(self, a1, a2, checked)
local button = NeedToKnow.BarMenu_GetItem(NeedToKnow.BarMenu_GetItemLevel(self), self.value);
function NeedToKnowRMB.BarMenu_IgnoreToggle(self, a1, a2, checked)
local button = NeedToKnowRMB.BarMenu_GetItem(NeedToKnowRMB.BarMenu_GetItemLevel(self), self.value);
if ( button ) then
local checkName = button:GetName() .. "Check";
_G[checkName]:Hide();
600,19 → 952,19
end
end
 
function NeedToKnow.BarMenu_ToggleSetting(self, a1, a2, checked)
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
function NeedToKnowRMB.BarMenu_ToggleSetting(self, a1, a2, checked)
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
barSettings[self.value] = self.checked;
local level = NeedToKnow.BarMenu_GetItemLevel(self);
local level = NeedToKnowRMB.BarMenu_GetItemLevel(self);
 
if ( self.value == "OnlyMine" ) then
if ( false == self.checked ) then
NeedToKnow.BarMenu_UncheckAndDisable(level, "bDetectExtends", false);
NeedToKnowRMB.BarMenu_UncheckAndDisable(level, "bDetectExtends", false);
else
NeedToKnow.BarMenu_EnableItem(level, "bDetectExtends");
NeedToKnow.BarMenu_CheckItem(level, "show_all_stacks", false);
NeedToKnowRMB.BarMenu_EnableItem(level, "bDetectExtends");
NeedToKnowRMB.BarMenu_CheckItem(level, "show_all_stacks", false);
end
elseif ( self.value == "blink_enabled" ) then
if ( true == self.checked and barSettings.MissingBlink.a == 0 ) then
620,19 → 972,19
end
elseif ( self.value == "show_all_stacks" ) then
if ( true == self.checked ) then
NeedToKnow.BarMenu_CheckItem(level, "OnlyMine", false);
NeedToKnowRMB.BarMenu_CheckItem(level, "OnlyMine", false);
end
end
NeedToKnow.Bar_Update(groupID, barID);
end
 
function NeedToKnow.BarMenu_GetItemLevel(i_button)
function NeedToKnowRMB.BarMenu_GetItemLevel(i_button)
local path = i_button:GetName();
local levelStr = path:match("%d+");
return tonumber(levelStr);
end
 
function NeedToKnow.BarMenu_GetItem(i_level, i_valueName)
function NeedToKnowRMB.BarMenu_GetItem(i_level, i_valueName)
local listFrame = _G["DropDownList"..i_level];
local listFrameName = listFrame:GetName();
local n = listFrame.numButtons;
646,8 → 998,8
return nil;
end
 
function NeedToKnow.BarMenu_CheckItem(i_level, i_valueName, i_bCheck)
local button = NeedToKnow.BarMenu_GetItem(i_level, i_valueName);
function NeedToKnowRMB.BarMenu_CheckItem(i_level, i_valueName, i_bCheck)
local button = NeedToKnowRMB.BarMenu_GetItem(i_level, i_valueName);
if ( button ) then
local checkName = button:GetName() .. "Check";
local check = _G[checkName];
658,31 → 1010,31
check:Hide();
button.checked = false;
end
NeedToKnow.BarMenu_ToggleSetting(button);
NeedToKnowRMB.BarMenu_ToggleSetting(button);
end
end
 
function NeedToKnow.BarMenu_EnableItem(i_level, i_valueName)
local button = NeedToKnow.BarMenu_GetItem(i_level, i_valueName)
function NeedToKnowRMB.BarMenu_EnableItem(i_level, i_valueName)
local button = NeedToKnowRMB.BarMenu_GetItem(i_level, i_valueName)
if ( button ) then
button:Enable();
end
end
 
function NeedToKnow.BarMenu_UncheckAndDisable(i_level, i_valueName)
local button = NeedToKnow.BarMenu_GetItem(i_level, i_valueName);
function NeedToKnowRMB.BarMenu_UncheckAndDisable(i_level, i_valueName)
local button = NeedToKnowRMB.BarMenu_GetItem(i_level, i_valueName);
if ( button ) then
NeedToKnow.BarMenu_CheckItem(i_level, i_valueName, false);
NeedToKnowRMB.BarMenu_CheckItem(i_level, i_valueName, false);
button:Disable();
end
end
 
function NeedToKnow.BarMenu_UpdateSettings(barSettings)
function NeedToKnowRMB.BarMenu_UpdateSettings(barSettings)
local type = barSettings.BuffOrDebuff;
local Opt = NeedToKnow.BarMenu_SubMenus["Opt_"..type];
local Opt = NeedToKnowRMB.BarMenu_SubMenus["Opt_"..type];
if ( not Opt ) then Opt = {} end
NeedToKnow.BarMenu_SubMenus.Options = Opt;
local button = NeedToKnow.BarMenu_GetItem(1, "Options");
NeedToKnowRMB.BarMenu_SubMenus.Options = Opt;
local button = NeedToKnowRMB.BarMenu_GetItem(1, "Options");
if button then
local arrow = _G[button:GetName().."ExpandArrow"]
local lbl = ""
699,20 → 1051,20
end
end
 
function NeedToKnow.BarMenu_ChooseSetting(self, a1, a2, checked)
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
function NeedToKnowRMB.BarMenu_ChooseSetting(self, a1, a2, checked)
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID]
barSettings[UIDROPDOWNMENU_MENU_VALUE] = self.value;
NeedToKnow.Bar_Update(groupID, barID);
 
if ( UIDROPDOWNMENU_MENU_VALUE == "BuffOrDebuff" ) then
NeedToKnow.BarMenu_UpdateSettings(barSettings)
NeedToKnowRMB.BarMenu_UpdateSettings(barSettings)
end
end
 
-- TODO: There has to be a better way to do this, this has pretty bad user feel
function NeedToKnow.EditBox_Numeric_OnTextChanged(self, isUserInput)
function NeedToKnowRMB.EditBox_Numeric_OnTextChanged(self, isUserInput)
if ( isUserInput ) then
local txt = self:GetText();
local culled = txt:gsub("[^0-9.]",""); -- Remove non-digits
727,19 → 1079,19
end
end
 
if ( NeedToKnow.EditBox_Original_OnTextChanged ) then
NeedToKnow.EditBox_Original_OnTextChanged(self, isUserInput);
if ( NeedToKnowRMB.EditBox_Original_OnTextChanged ) then
NeedToKnowRMB.EditBox_Original_OnTextChanged(self, isUserInput);
end
end
 
function NeedToKnow.BarMenu_ShowNameDialog(self, a1, a2, checked)
function NeedToKnowRMB.BarMenu_ShowNameDialog(self, a1, a2, checked)
StaticPopupDialogs["NEEDTOKNOW.CHOOSENAME_DIALOG"].text = NEEDTOKNOW[self.value.text];
local dialog = StaticPopup_Show("NEEDTOKNOW.CHOOSENAME_DIALOG");
dialog.variable = self.value.variable;
 
local edit = _G[dialog:GetName().."EditBox"];
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
local curval;
if ( dialog.variable ~= "ImportExport" ) then
750,22 → 1102,22
 
local numeric = self.value.numeric or false;
-- TODO: There has to be a better way to do this, this has pretty bad user feel
if ( nil == NeedToKnow.EditBox_Original_OnTextChanged ) then
NeedToKnow.EditBox_Original_OnTextChanged = edit:GetScript("OnTextChanged");
if ( nil == NeedToKnowRMB.EditBox_Original_OnTextChanged ) then
NeedToKnowRMB.EditBox_Original_OnTextChanged = edit:GetScript("OnTextChanged");
end
if ( numeric ) then
edit:SetScript("OnTextChanged", NeedToKnow.EditBox_Numeric_OnTextChanged);
edit:SetScript("OnTextChanged", NeedToKnowRMB.EditBox_Numeric_OnTextChanged);
else
edit:SetScript("OnTextChanged", NeedToKnow.EditBox_Original_OnTextChanged);
edit:SetScript("OnTextChanged", NeedToKnowRMB.EditBox_Original_OnTextChanged);
end
 
edit:SetFocus();
edit:SetText(curval);
end
 
function NeedToKnow.BarMenu_ChooseName(text, variable)
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
function NeedToKnowRMB.BarMenu_ChooseName(text, variable)
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
if ( variable ~= "ImportExport" ) then
barSettings[variable] = text;
810,28 → 1162,28
 
end
 
function NeedToKnow.BarMenu_SetColor()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
function NeedToKnowRMB.BarMenu_SetColor()
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local varSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
 
varSettings.r,varSettings.g,varSettings.b = ColorPickerFrame:GetColorRGB();
NeedToKnow.Bar_Update(groupID, barID);
end
 
function NeedToKnow.BarMenu_SetOpacity()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
function NeedToKnowRMB.BarMenu_SetOpacity()
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local varSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
 
varSettings.a = 1 - OpacitySliderFrame:GetValue();
NeedToKnow.Bar_Update(groupID, barID);
end
 
function NeedToKnow.BarMenu_CancelColor(previousValues)
function NeedToKnowRMB.BarMenu_CancelColor(previousValues)
if ( previousValues.r ) then
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
local varSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
 
varSettings.r = previousValues.r;
842,9 → 1194,9
end
end
 
function NeedToKnow.BarMenu_ClearSettings()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
function NeedToKnowRMB.BarMenu_ClearSettings()
local groupID = NeedToKnowRMB.CurrentBar["groupID"];
local barID = NeedToKnowRMB.CurrentBar["barID"];
NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID] = CopyTable(NEEDTOKNOW.BAR_DEFAULTS);
NeedToKnow.Bar_Update(groupID, barID);
CloseDropDownMenus();
871,7 → 1223,6
-- group:ClearAllPoints();
-- group:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", group.oldX, group.oldY);
self.oldCursorX, self.oldCursorY = GetCursorPosition(UIParent);
trace(self, self:GetName(), group, group:GetName())
self.oldWidth = _G[group:GetName().."Bar1"]:GetWidth();
self:SetScript("OnUpdate", NeedToKnow.Sizing_OnUpdate);
end
Kitjan/NeedToKnow/NeedToKnow.xml
1,211 → 1,197
<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/
..\..\..\Blizza~1\FrameXML\UI.xsd">
 
<Script file="NeedToKnow_Localization.lua"/>
<Script file="NeedToKnow_Localization.lua"/>
<Script file="NeedToKnow.lua"/>
<Script file="NeedToKnow_Options.lua"/>
<Script file="NeedToKnow_Options.lua"/>
 
<Frame name="NeedToKnow_DropDownTemplate" inherits="UIDropDownMenuTemplate" virtual="true">
<Anchors>
<Anchor point="TOP"/>
</Anchors>
<Scripts>
<OnLoad>
UIDropDownMenu_Initialize(self, NeedToKnow.BarMenu_Initialize, "MENU");
</OnLoad>
<OnShow>
UIDropDownMenu_Initialize(self, NeedToKnow.BarMenu_Initialize, "MENU");
</OnShow>
</Scripts>
</Frame>
<Frame name="NeedToKnow_GroupTemplate" virtual="true">
<Size>
<AbsDimension x="1" y="1"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture setAllPoints="true">
<Color r="0" g="0" b="0" a="0"/>
</Texture>
</Layer>
</Layers>
<Frames>
<Button name="$parentResizeButton">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentTexture" file="Interface\AddOns\NeedToKnow\Textures\Resize">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
getglobal(self:GetName().."Texture"):SetVertexColor(0.6, 0.6, 0.6);
</OnLoad>
<OnMouseDown>
NeedToKnow.StartSizing(self, button);
</OnMouseDown>
<OnMouseUp>
NeedToKnow.StopSizing(self, button);
</OnMouseUp>
<OnEnter>
NeedToKnow.Resizebutton_OnEnter(self);
getglobal(self:GetName().."Texture"):SetVertexColor(1, 1, 1);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
getglobal(self:GetName().."Texture"):SetVertexColor(0.6, 0.6, 0.6);
</OnLeave>
</Scripts>
</Button>
</Frames>
</Frame>
 
<Frame name="NeedToKnow_GroupTemplate" virtual="true">
<Size>
<AbsDimension x="1" y="1"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture setAllPoints="true">
<Color r="0" g="0" b="0" a="0"/>
</Texture>
</Layer>
</Layers>
<Frames>
<Button name="$parentResizeButton">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT"/>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentTexture" file="Interface\AddOns\NeedToKnow\Textures\Resize">
<Size>
<AbsDimension x="10" y="10"/>
</Size>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
getglobal(self:GetName().."Texture"):SetVertexColor(0.6, 0.6, 0.6);
</OnLoad>
<OnMouseDown>
NeedToKnow.StartSizing(self, button);
</OnMouseDown>
<OnMouseUp>
NeedToKnow.StopSizing(self, button);
</OnMouseUp>
<OnEnter>
NeedToKnow.Resizebutton_OnEnter(self);
getglobal(self:GetName().."Texture"):SetVertexColor(1, 1, 1);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
getglobal(self:GetName().."Texture"):SetVertexColor(0.6, 0.6, 0.6);
</OnLeave>
</Scripts>
</Button>
</Frames>
</Frame>
<Frame name="NeedToKnow_BarTemplate" toplevel="true" enableMouse="true" virtual="true">
<Size>
<AbsDimension x="271" y="18"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" setAllPoints="true">
<Color r="1" g="1" b="1" a="1"/>
<Size>
<AbsDimension x="277" y="24"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture name="$parentTexture">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="-0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="OVERLAY">
<FontString name="$parentText" inherits="GameFontHighlight" justifyH="LEFT">
<Size>
<AbsDimension x="180" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="10" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTime" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="40" y="16"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parent" relativePoint="RIGHT">
<Offset>
<AbsDimension x="-10" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<Texture name="$parentSpark" file="Interface\CastingBar\UI-CastingBar-Spark" alphaMode="ADD">
<Size>
<AbsDimension x="32" y="60"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="RIGHT"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self:RegisterForDrag("LeftButton");
</OnLoad>
<OnEnter>
local tooltip = _G["GameTooltip"];
tooltip:SetOwner(self:GetParent(), "ANCHOR_TOPLEFT");
tooltip:AddLine(NEEDTOKNOW.BAR_TOOLTIP1, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b, 1);
tooltip:AddLine(NEEDTOKNOW.BAR_TOOLTIP2, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
tooltip:Show();
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
<OnMouseUp>
NeedToKnow.Bar_OnMouseUp(self, button);
</OnMouseUp>
<OnSizeChanged>
NeedToKnow.Bar_OnSizeChanged(self)
</OnSizeChanged>
<OnDragStart>
self:GetParent():StartMoving();
</OnDragStart>
<OnDragStop>
self:GetParent():StopMovingOrSizing();
NeedToKnow.SavePosition(self:GetParent(), self:GetParent():GetID());
</OnDragStop>
</Scripts>
</Frame>
 
<Frame name="NeedToKnow_BarTemplate" toplevel="true" enableMouse="true" virtual="true">
<Size>
<AbsDimension x="271" y="18"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" setAllPoints="true">
<Color r="1" g="1" b="1" a="1"/>
<Size>
<AbsDimension x="277" y="24"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture name="$parentTexture">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="-0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="OVERLAY">
<FontString name="$parentText" inherits="GameFontHighlight" justifyH="LEFT">
<Size>
<AbsDimension x="180" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="10" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentTime" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="40" y="16"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parent" relativePoint="RIGHT">
<Offset>
<AbsDimension x="-10" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<Texture name="$parentSpark" file="Interface\CastingBar\UI-CastingBar-Spark" alphaMode="ADD">
<Size>
<AbsDimension x="32" y="60"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="RIGHT"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self:RegisterForDrag("LeftButton");
</OnLoad>
<OnEnter>
local tooltip = _G["GameTooltip"];
tooltip:SetOwner(self:GetParent(), "ANCHOR_TOPLEFT");
tooltip:AddLine(NEEDTOKNOW.BAR_TOOLTIP1, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b, 1);
tooltip:AddLine(NEEDTOKNOW.BAR_TOOLTIP2, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1);
tooltip:Show();
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
<OnMouseUp>
NeedToKnow.Bar_OnMouseUp(self, button);
</OnMouseUp>
<OnSizeChanged>
NeedToKnow.Bar_OnSizeChanged(self)
</OnSizeChanged>
<OnDragStart>
self:GetParent():StartMoving();
</OnDragStart>
<OnDragStop>
self:GetParent():StopMovingOrSizing();
NeedToKnow.SavePosition(self:GetParent(), self:GetParent():GetID());
</OnDragStop>
</Scripts>
</Frame>
<Frame name="NeedToKnow_Group1" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-200"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="NeedToKnow_Group2" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="2">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-300"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="NeedToKnow_Group3" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="3">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-400"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="NeedToKnow_Group4" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="4">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-500"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
 
<Frame name="NeedToKnow_Group1" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-200"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="NeedToKnow_Group2" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="2">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-300"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="NeedToKnow_Group3" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="3">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-400"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
<Frame name="NeedToKnow_Group4" inherits="NeedToKnow_GroupTemplate" toplevel="true" movable="true" parent="UIParent" id="4">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="100" y="-500"/>
</Offset>
</Anchor>
</Anchors>
</Frame>
 
</Ui>
Kitjan/NeedToKnow/NeedToKnow.lua
96,7 → 96,7
Width = 270,
Bars = { NEEDTOKNOW.BAR_DEFAULTS, NEEDTOKNOW.BAR_DEFAULTS, NEEDTOKNOW.BAR_DEFAULTS },
Position = { "TOPLEFT", "TOPLEFT", 100, -100 },
FixedDuration = nil,
FixedDuration = 0,
}
NEEDTOKNOW.DEFAULTS = {
Version = NEEDTOKNOW.VERSION,
107,15 → 107,18
NEEDTOKNOW.CHARACTER_DEFAULTS = {
Specs = {},
Locked = false,
Profiles = {},
}
NEEDTOKNOW.PROFILE_DEFAULTS = {
name = "Default",
nGroups = 1,
Groups = { NEEDTOKNOW.GROUP_DEFAULTS },
BarTexture = "BantoBar",
BarFont = GameFontHighlight:GetFont(),
BarFont = "Fritz Quadrata TT",
BkgdColor = { 0, 0, 0, 0.8 },
BarSpacing = 3,
BarPadding = 3,
FontSize = 12,
}
 
 
178,12 → 181,12
end
end
 
function NeedToKnow.ExecutiveFrame_COMBAT_LOG_EVENT_UNFILTERED(tod, event, guidCaster, ...)
function NeedToKnow.ExecutiveFrame_COMBAT_LOG_EVENT_UNFILTERED(tod, event, hideCaster, guidCaster, ...)
-- the time that's passed in appears to be time of day, not game time like everything else.
local time = GetTime()
-- TODO: Is checking r.state sufficient or must event be checked instead?
if ( guidCaster == NeedToKnow.guidPlayer ) then
local guidTarget, _, _, _, spell = select(3, ...)
local guidTarget, _, _, _, _, spell = select(4, ...)
local r = NeedToKnow.last_cast[spell]
if ( r and r.state == 2) then
r.state = 0
281,7 → 284,7
 
function NeedToKnow.RemoveDefaultValues(t, def, k)
if not k then k = "" end
if not def then
if def == nil then
-- Some obsolete setting, or perhaps bUncompressed
return true
end
310,11 → 313,7
end
 
function NeedToKnow.CompressProfile(profileSettings)
for k,p in pairs(NeedToKnow_Globals.Profiles) do
if p == profileSettings then
trace("Compressing",k)
end
end
trace("Compressing",profileSettings)
-- Remove unused bars/groups
for iG,vG in ipairs(profileSettings["Groups"]) do
if iG > profileSettings.nGroups then
334,7 → 333,7
-- DEBUG: remove k, it's just for debugging
function NeedToKnow.AddDefaultsToTable(t, def, k)
if type(t) ~= "table" then return end
if not def then
if def == nil then
return
end
if not k then k = "" end
342,8 → 341,8
if n > 0 then
for i=1,n do
local rhs = def[i]
if not rhs then rhs = def[1] end
if not t[i] then
if rhs == nil then rhs = def[1] end
if t[i] == nil then
t[i] = NeedToKnow.DeepCopy(rhs)
else
NeedToKnow.AddDefaultsToTable(t[i], rhs, k .. " " .. i)
351,7 → 350,7
end
else
for kD,vD in pairs(def) do
if not t[kD] then
if t[kD] == nil then
if type(vD) == "table" then
t[kD] = NeedToKnow.DeepCopy(vD)
else
388,31 → 387,24
end
end
 
for k,p in pairs(NeedToKnow_Globals.Profiles) do
if p == profileSettings then
trace("Uncompressing",k)
end
end
trace("Uncompressing",profileSettings.name)
 
NeedToKnow.AddDefaultsToTable(profileSettings, NEEDTOKNOW.PROFILE_DEFAULTS)
if ( not profileSettings["BarFont"] or profileSettings["BarFont"] == "DEFAULT" ) then
profileSettings["BarFont"] = GameFontHighlight:GetFont()
end
NeedToKnow.AddDefaultsToTable(profileSettings, NEEDTOKNOW.PROFILE_DEFAULTS)
 
profileSettings.bUncompressed = true
end
 
 
function NeedToKnow.ChangeProfile(profile)
if NeedToKnow_Globals.Profiles[profile] and
NeedToKnow.ProfileSettings ~= NeedToKnow_Globals.Profiles[profile] then
function NeedToKnow.ChangeProfile(profile)
if NeedToKnow_Profiles[profile] and
NeedToKnow.ProfileSettings ~= NeedToKnow_Profiles[profile] then
-- Compress the old profile by removing defaults
if NeedToKnow.ProfileSettings and NeedToKnow.ProfileSettings.bUncompressed then
NeedToKnow.CompressProfile(NeedToKnow.ProfileSettings)
end
 
-- Switch to the new profile
NeedToKnow.ProfileSettings = NeedToKnow_Globals.Profiles[profile]
NeedToKnow.ProfileSettings = NeedToKnow_Profiles[profile]
local spec = GetActiveTalentGroup()
NeedToKnow.CharSettings.Specs[spec] = profile
 
431,8 → 423,8
 
-- Update the bars and options panel (if it's open)
NeedToKnow.Update()
NeedToKnow.UIPanel_Update()
elseif not NeedToKnow_Globals.Profiles[profile] then
NeedToKnowOptions.UIPanel_Update()
elseif not NeedToKnow_Profiles[profile] then
print("NeedToKnow profile",profile,"does not exist!") -- FIXME: Localization!
end
end
445,6 → 437,12
if pct0 > 1 then pct0 = 1 end
end
 
-- This happened to me when there was lag right around the time
-- a bar was ending
if value < 0 then
value = 0
end
 
local pct = value / bar.max_value
texture.cur_value = value
if pct > 1 then pct = 1 end
470,8 → 468,8
 
function NeedToKnow.ResetCharacter(bCreateSpecProfile)
local charKey = UnitName("player") .. ' - ' .. GetRealmName();
NeedToKnow_Globals.Chars[charKey] = CopyTable(NEEDTOKNOW.CHARACTER_DEFAULTS)
NeedToKnow.CharSettings = NeedToKnow_Globals.Chars[charKey]
NeedToKnow_CharSettings = CopyTable(NEEDTOKNOW.CHARACTER_DEFAULTS)
NeedToKnow.CharSettings = NeedToKnow_CharSettings
if bCreateSpecProfile == nil or bCreateSpecProfile then
NeedToKnow.ExecutiveFrame_PLAYER_TALENT_UPDATE()
end
482,15 → 480,37
if not nameProfile then
nameProfile = UnitName("player") .. "-"..GetRealmName() .. "." .. idxSpec
end
if NeedToKnow_Globals.Profiles[nameProfile] then
settings.name = nameProfile
 
local keyProfile
for k,t in pairs(NeedToKnow_Globals.Profiles) do
if t.name == nameProfile then
keyProfile = k
break;
end
end
 
if not keyProfile then
local n=NeedToKnow_Globals.NextProfile or 1
while NeedToKnow_Globals.Profiles["G"..n] do
n = n+1
end
NeedToKnow_Globals.NextProfile = n+1
keyProfile = "G"..n
end
 
if NeedToKnow_Globals.Profiles[keyProfile] then
print("NeedToKnow: Clearing profile ",nameProfile); -- FIXME - Localization
else
print("NeedToKnow: Adding profile",nameProfile) -- FIXME - Localization
end
 
NeedToKnow.CharSettings.Specs[idxSpec] = nameProfile
NeedToKnow_Globals.Profiles[nameProfile] = settings
return nameProfile
if idxSpec then
NeedToKnow.CharSettings.Specs[idxSpec] = keyProfile
end
NeedToKnow_Globals.Profiles[keyProfile] = settings
NeedToKnow_Profiles[keyProfile] = settings
return keyProfile
end
 
 
518,6 → 538,7
specSettings.Spec = nil
specSettings.Locked = nil
specSettings.nGroups = 4
specSettings.BarFont = NeedToKnowLoader.FindFontName(specSettings.BarFont)
NeedToKnow.CreateProfile(specSettings, idxSpec)
return true
end
544,7 → 565,7
NeedToKnow.CharSettings["Locked"] = oldSettings["Locked"]
 
local bOK
if ( oldSettings["Spec"] ) then -- The Spec member existed from versions 2.4 to 3.1.7
if ( oldSettings["Spec"] ) then -- The Spec member existed from versions 2.4 to 3.1.7
for idxSpec = 1,2 do
local newprofile = oldSettings.Spec[idxSpec]
for kD,_ in pairs(NEEDTOKNOW.PROFILE_DEFAULTS) do
575,23 → 596,44
end
 
 
function NeedToKnowLoader.FindFontName(fontPath)
local fontList = NeedToKnow.LSM:List("font")
for i=1,#fontList do
local fontName = fontList[i]
local iPath = NeedToKnow.LSM:Fetch("font", fontName)
if iPath == fontPath then
return fontName
end
end
return NEEDTOKNOW.PROFILE_DEFAULTS.BarFont
end
 
function NeedToKnowLoader.SafeUpgrade()
local defPath = GameFontHighlight:GetFont()
NEEDTOKNOW.PROFILE_DEFAULTS.BarFont = NeedToKnowLoader.FindFontName(defPath)
NeedToKnow_Profiles = {}
 
-- If there had been an error during the previous upgrade, NeedToKnow_Settings
-- may be in an inconsistent, halfway state.
if not NeedToKnow_Globals then
NeedToKnowLoader.Reset(false)
end
 
if NeedToKnow_Settings then -- prior to 3.2
if NeedToKnow_Settings then -- prior to 3.3
NeedToKnowLoader.MigrateCharacterSettings()
end
-- 3.2 settings sanity check
if not NeedToKnow.CharSettings then
-- we'll call talent update right after this, so we pass false now
NeedToKnow.ResetCharacter(false)
end
 
-- 3.3 settings sanity check
if not NeedToKnow_Globals or
not NeedToKnow_Globals["Version"] or
not NeedToKnow_Globals.Profiles or
not NeedToKnow_Globals.Chars then
not NeedToKnow_Globals.Profiles
then
print("NeedToKnow settings corrupted, resetting")
NeedToKnowLoader.Reset()
NeedToKnowLoader.Reset()
end
 
for iS,vS in pairs(NeedToKnow_Globals.Profiles) do
600,13 → 642,14
if vS.bUncompressed then
NeedToKnow.CompressProfile(vS)
end
end
 
local charKey = UnitName("player") .. ' - ' .. GetRealmName();
NeedToKnow.CharSettings = NeedToKnow_Globals.Chars[charKey]
if not NeedToKnow.CharSettings then
NeedToKnow.ResetCharacter(false)
NeedToKnow_Profiles[iS] = vS
end
if NeedToKnow_CharSettings.Profiles then
for iS,vS in pairs(NeedToKnow_CharSettings.Profiles) do
NeedToKnow_Profiles[iS] = vS
end
end
 
-- TODO: check the required members for existence and delete any corrupted profiles
end
647,6 → 690,24
--return _copy(object)
--end
 
function NeedToKnow.RestoreTableFromCopy(dest, source)
for key,value in pairs(source) do
if type(value) == "table" then
if dest[key] then
NeedToKnow.RestoreTableFromCopy(dest[key], value)
else
dest[key] = value
end
else
dest[key] = value
end
end
for key,value in pairs(dest) do
if not source[key] then
dest[key] = nil
end
end
end
 
function NeedToKnow.Update()
if UnitExists("player") and NeedToKnow.ProfileSettings then
776,6 → 837,7
betterSpell = NeedToKnow.TryToFindSpellWithCD(barSpell)
if nil ~= betterSpell then
bar.spells[idx] = betterSpell
bar.cd_functions[idx] = NeedToKnow.GetSpellCooldown
elseif not GetSpellCooldown(barSpell) then
bar.cd_functions[idx] = NeedToKnow.GetUnresolvedCooldown
end
830,6 → 892,9
bar.nextUpdate = GetTime() + NEEDTOKNOW.UPDATE_INTERVAL
 
bar.fixedDuration = tonumber(groupSettings.FixedDuration)
if ( 0 >= bar.fixedDuration ) then
bar.fixedDuration = nil
end
 
bar.max_value = 1
SetStatusBarValue(bar,bar.bar1,1)
837,11 → 902,10
if ( bar.bar2 ) then
bar.bar2:SetTexture(NeedToKnow.LSM:Fetch("statusbar", NeedToKnow.ProfileSettings["BarTexture"]))
end
local fontPath = NeedToKnow.ProfileSettings["BarFont"]
local fontPath = NeedToKnow.LSM:Fetch("font", NeedToKnow.ProfileSettings["BarFont"])
if ( fontPath ) then
-- TODO: I'd like to get that 12 from something rather than hard-code it
bar.text:SetFont(fontPath, 12)
bar.time:SetFont(fontPath, 12)
bar.text:SetFont(fontPath, NeedToKnow.ProfileSettings["FontSize"])
bar.time:SetFont(fontPath, NeedToKnow.ProfileSettings["FontSize"])
end
 
bar:SetWidth(groupSettings.Width)
1012,10 → 1076,19
end
end
 
 
function NeedToKnow.CheckCombatLogRegistration(bar, force)
if UnitExists(bar.unit) then
bar:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
bar:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
end
 
 
function NeedToKnow.SetScripts(bar)
bar:SetScript("OnEvent", NeedToKnow.Bar_OnEvent)
bar:SetScript("OnUpdate", NeedToKnow.Bar_OnUpdate)
 
if ( "TOTEM" == bar.settings.BuffOrDebuff ) then
bar:RegisterEvent("PLAYER_TOTEM_UPDATE")
elseif ( "CASTCD" == bar.settings.BuffOrDebuff ) then
1034,7 → 1107,7
bar:RegisterEvent("PLAYER_TARGET_CHANGED")
bar:RegisterEvent("UNIT_TARGET")
-- WORKAROUND: Don't get UNIT_AURA for targettarget
bar:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
NeedToKnow.CheckCombatLogRegistration(bar)
else
bar:RegisterEvent("UNIT_AURA")
if ( bar.unit == "focus" ) then
1073,6 → 1146,13
bar:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
end
 
function NeedToKnow.Bar_OnMouseUp(self, button)
if ( button == "RightButton" ) then
PlaySound("UChatScrollButton");
NeedToKnowRMB.ShowMenu(self);
end
end
 
function NeedToKnow.Bar_OnSizeChanged(self)
if (self.bar1.cur_value) then SetStatusBarValue(self, self.bar1, self.bar1.cur_value) end
if (self.bar2) then SetStatusBarValue(self, self.bar2, self.bar2.cur_value, self.bar1.cur_value) end
1083,17 → 1163,20
local combatEvent = select(2, ...)
 
if ( NEEDTOKNOW.AURAEVENTS[combatEvent] ) then
local guidTarget = select(6, ...)
local guidTarget = select(8, ...)
if ( guidTarget == UnitGUID(self.unit) ) then
local idSpell, nameSpell = select(9, ...)
local idSpell, nameSpell = select(12, ...)
if (self.auraName:find(idSpell) or
self.auraName:find(nameSpell))
then
NeedToKnow.Bar_AuraCheck(self)
end
end
elseif ( combatEvent == "UNIT_DIED" ) and ( select(6, ...) == UnitGUID(self.unit) ) then
NeedToKnow.Bar_AuraCheck(self)
elseif ( combatEvent == "UNIT_DIED" ) then
local guidDeceased = select(8, ...)
if ( guidDeceased == UnitGUID(self.unit) ) then
NeedToKnow.Bar_AuraCheck(self)
end
end
elseif ( event == "PLAYER_TOTEM_UPDATE" ) or
( event == "ACTIONBAR_UPDATE_COOLDOWN" ) or
1109,15 → 1192,22
NeedToKnow.UpdateWeaponEnchants()
NeedToKnow.Bar_AuraCheck(self)
elseif ( event == "PLAYER_TARGET_CHANGED" ) or ( event == "PLAYER_FOCUS_CHANGED" ) then
if self.unit == "targettarget" then
NeedToKnow.CheckCombatLogRegistration(self)
end
NeedToKnow.Bar_AuraCheck(self)
elseif ( event == "UNIT_TARGET" and select(1, ...) == "target" ) then
if self.unit == "targettarget" then
NeedToKnow.CheckCombatLogRegistration(self)
end
NeedToKnow.Bar_AuraCheck(self)
elseif ( event == "UNIT_PET" and select(1, ...) == "player" ) then
NeedToKnow.Bar_AuraCheck(self)
elseif ( event == "UNIT_SPELLCAST_SENT" ) then
local unit, spell = select(1, ...)
if ( self.settings.bDetectExtends ) then
if unit == "player" and self.buffName == spell then
-- FIXME: This really does not belong on the individual bar
if unit == "player" then --and self.buffName == spell then
local r = NeedToKnow.last_cast[spell]
if ( r and r.state == 0 ) then
r.state = 1
1527,6 → 1617,17
local start, cd_len, enable = GetSpellCooldown(barSpell)
if start and start > 0 then
local spellName, spellRank, spellIconPath, _, _, spellPower = GetSpellInfo(barSpell)
if not spellName then
if not NeedToKnow.GSIBroken then
NeedToKnow.GSIBroken = {}
end
if not NeedToKnow.GSIBroken[barSpell] then
print("NeedToKnow: Warning! Unable to get spell info for "..barSpell..". Try using Spell ID instead.")
NeedToKnow.GSIBroken[barSpell] = true;
end
spellName = barSpell
end
 
if 0 == enable then
-- Filter out conditions like Stealth while stealthed
start = nil
1832,6 → 1933,8
local matchID
if isSpellID then matchID = tonumber(barSpell) end
local all_stacks = bar.all_stacks
local settings = bar.settings
local filter = settings.BuffOrDebuff
 
while true do
local buffName, _, iconPath, count, _, duration, expirationTime, caster, _, _, spellID
1910,7 → 2013,7
local _, nDigits = barSpell:find("^%d+")
local isSpellID = ( nDigits == barSpell:len() )
 
duration, buffName, count, expirationTime, iconPath, caster
duration, buffName, count, expirationTime, iconPath, caster
= bar.fnCheck(bar, idx, barSpell, isSpellID);
 
if duration then
Kitjan/NeedToKnow/NeedToKnow.toc
1,15 → 1,14
## Interface: 30300
## Interface: 040200
## Title: NeedToKnow
## Author: Kitjan, lieandswell
## Version: 3.3.0
## Notes: Timer bars for buffs, debuffs, cooldowns, etc.
## X-Compatible-With: 40000
## X-Credits: Bilt, Fxfighter EU-Echsenkessel, metalchoir, sp00n, Vlakarados, wowui.cn
## X-Category: Buffs, Combat
## OptionalDeps: LibStub,LibSharedMedia-3.0
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariablesPerCharacter: NeedToKnow_Settings
## SavedVariablesPerCharacter: NeedToKnow_Settings, NeedToKnow_CharSettings
## SavedVariables: NeedToKnow_Globals
libs\LibStub\LibStub.lua
libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
Kitjan/NeedToKnow/NeedToKnow_Localization.lua
58,6 → 58,12
NEEDTOKNOW.UIPANEL_BARFONT = "Bar font";
NEEDTOKNOW.UIPANEL_FONT = "Font";
NEEDTOKNOW.UIPANEL_PROFILE = "Profile";
NEEDTOKNOW.UIPANEL_SWITCHPROFILE_TOOLTIP = "Switch to using the currently selected profile";
NEEDTOKNOW.UIPANEL_DELETEPROFILE_TOOLTIP = "Permanently delete the currently selected profile";
NEEDTOKNOW.UIPANEL_COPYPROFILE_TOOLTIP = "Create a new profile based on the currently selected profile";
NEEDTOKNOW.UIPANEL_PRIVATEPROFILE_TOOLTIP = "Make the selected profile accessible only to the current character";
NEEDTOKNOW.UIPANEL_PUBLICPROFILE_TOOLTIP = "Make the selected profile accessible to all the characters on the same account";
NEEDTOKNOW.UIPANEL_RENAMEPROFILE_TOOLTIP = "Change the name of this profile";
 
NEEDTOKNOW.BARMENU_TOTEM = "Totem";
NEEDTOKNOW.BARMENU_CASTCD = "Spell Cooldown";