WoWInterface SVN NeedToKnow-Updated

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /branches
    from Rev 62 to Rev 63
    Reverse comparison

Rev 62 → Rev 63

lieandswell/NeedToKnow/NeedToKnow_Options.xml
289,9 → 289,6
NeedToKnow_OldSettings = CopyTable(NeedToKnow_Settings);
NeedToKnow.UIPanel_OnShow();
</OnShow>
<OnHide>
NeedToKnow.UIPanel_OnHide();
</OnHide>
</Scripts>
<Frames>
<Frame name="$parentGroup1" inherits="NeedToKnow_GroupOptionsTemplate" id="1">
494,11 → 491,11
</OnValueChanged>
</Scripts>
</Slider>
<Frame name="$parentBarTextureDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true">
<Slider name="$parentBarTextureSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Anchor point="TOPLEFT" relativeTo="$parentBarSpacingSlider" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="192" y="-32"/>
<AbsDimension x="166" y="0" />
</Offset>
</Anchor>
</Anchors>
506,9 → 503,9
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontHighlight">
<Anchors>
<Anchor point="BOTTOM" relativePoint="TOP">
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="3"/>
<AbsDimension x="40" y="-30"/>
</Offset>
</Anchor>
</Anchors>
517,20 → 514,18
</Layers>
<Scripts>
<OnLoad>
_G[self:GetName().."Label"]:SetText(NEEDTOKNOW.UIPANEL_BARTEXTURE);
UIDropDownMenu_SetWidth(self, 128);
UIDropDownMenu_Initialize(self, NeedToKnow.BarTextureDropDown);
</OnLoad>
<OnShow>
UIDropDownMenu_Initialize(this, NeedToKnow.BarTextureDropDown);
</OnShow>
<OnValueChanged>
NeedToKnow.UpdateBarTextureSlider(self, value);
</OnValueChanged>
</Scripts>
</Frame>
<Frame name="$parentBarFontDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true">
</Slider>
 
<Slider name="$parentBarFontSlider" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBarTextureDropDown" relativePoint="BOTTOMLEFT">
<Anchor point="TOPLEFT" relativeTo="$parentBarTextureSlider" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-24"/>
<AbsDimension x="0" y="-30" />
</Offset>
</Anchor>
</Anchors>
538,9 → 533,9
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontHighlight">
<Anchors>
<Anchor point="BOTTOM" relativePoint="TOP">
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="3"/>
<AbsDimension x="0" y="-4"/>
</Offset>
</Anchor>
</Anchors>
549,15 → 544,13
</Layers>
<Scripts>
<OnLoad>
_G[self:GetName().."Label"]:SetText(NEEDTOKNOW.UIPANEL_FONT);
UIDropDownMenu_SetWidth(self, 128);
UIDropDownMenu_Initialize(self, NeedToKnow.BarFontDropDown);
</OnLoad>
<OnShow>
UIDropDownMenu_Initialize(this, NeedToKnow.BarFontDropDown);
</OnShow>
<OnValueChanged>
NeedToKnow.UpdateBarFontSlider(self, value);
</OnValueChanged>
</Scripts>
</Frame>
</Slider>
 
<Button name="$parentConfigModeButton" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="128" y="22"/>
lieandswell/NeedToKnow/NeedToKnow_Options.lua
49,22 → 49,14
 
function NeedToKnow.UIPanel_OnShow()
NeedToKnow_OldSettings = CopyTable(NeedToKnow_Settings);
NeedToKnow.bUIPanelVisible = true;
-- Why is this here? Would it be better to use a self:IsVisible() check? -- lieandswell
NeedToKnow.UIPanel_Update();
end
 
function NeedToKnow.UIPanel_OnHide()
NeedToKnow.bUIPanelVisible = nil;
-- Why is this here? Would it be better to use a self:IsVisible() check? -- lieandswell
end
 
function NeedToKnow.UIPanel_Update()
if ( not NeedToKnow.bUIPanelVisible ) then return ; end
-- Why is this here? Would it be better to use a self:IsVisible() check? -- lieandswell
local panelName = "InterfaceOptionsNeedToKnowPanel";
if not _G[panelName]:IsVisible() then return end
 
local settings = NeedToKnow_Settings;
local panelName = "InterfaceOptionsNeedToKnowPanel";
 
for groupID = 1, NEEDTOKNOW.MAXGROUPS do
NeedToKnow.GroupEnableButton_Update(groupID);
138,6 → 130,7
end
NeedToKnow.Update();
NeedToKnow.UIPanel_Update();
NeedToKnow.UIPanel_Appearance_Update();
end
 
function NeedToKnow.Cancel()
161,22 → 154,43
end
 
function NeedToKnow.UIPanel_Appearance_Update()
local settings = NeedToKnow_Settings;
local panelName = "InterfaceOptionsNeedToKnowAppearancePanel";
if not _G[panelName]:IsVisible() then return end
 
local settings = NeedToKnow_Settings;
local barSpacingSlider = _G[panelName.."BarSpacingSlider"];
local barPaddingSlider = _G[panelName.."BarPaddingSlider"];
 
_G[panelName.."BackgroundColorButtonNormalTexture"]:SetVertexColor(unpack(settings.BkgdColor));
-- Mimic the behavior of the context menu, and force the alpha to one in the swatch
local r,g,b = unpack(settings.BkgdColor);
_G[panelName.."BackgroundColorButtonNormalTexture"]:SetVertexColor(r,g,b,1);
 
barSpacingSlider:SetMinMaxValues(0, NEEDTOKNOW.MAXBARSPACING);
barSpacingSlider:SetValue(settings.BarSpacing);
barPaddingSlider:SetMinMaxValues(0, NEEDTOKNOW.MAXBARPADDING);
barPaddingSlider:SetValue(settings.BarPadding);
 
NeedToKnow.UpdateBarTextureDropDown();
NeedToKnow.UpdateBarFontDropDown();
NeedToKnow.UpdateBarTextureDropDown(panelName);
NeedToKnow.UpdateBarFontDropDown(panelName);
end
 
 
function NeedToKnow.UpdateBarTextureSlider(info, value)
getglobal(info:GetName().."Label"):SetText(textureList[value]);
NeedToKnow_Settings["BarTexture"] = textureList[value];
NeedToKnow.Update();
end
 
function NeedToKnow.UpdateBarFontSlider(info, value)
local fontName = fontList[value];
local fontPath = LSM:Fetch("font", fontName);
getglobal(info:GetName().."Label"):SetText(fontName);
NeedToKnow_Settings["BarFont"] = fontPath;
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
end
 
 
function NeedToKnow.ChooseColor(variable)
info = UIDropDownMenu_CreateInfo();
info.r, info.g, info.b, info.opacity = unpack(NeedToKnow_Settings[variable]);
199,14 → 213,14
NeedToKnow_Settings[variable][2] = g;
NeedToKnow_Settings[variable][3] = b;
NeedToKnow.Update();
NeedToKnow.UIPanel_Update();
NeedToKnow.UIPanel_Appearance_Update();
end
 
function NeedToKnow.SetOpacity()
local variable = ColorPickerFrame.extraInfo;
NeedToKnow_Settings[variable][4] = 1 - OpacitySliderFrame:GetValue();
NeedToKnow.Update();
NeedToKnow.UIPanel_Update();
NeedToKnow.UIPanel_Appearance_Update();
end
 
function NeedToKnow.CancelColor(previousValues)
214,65 → 228,46
local variable = ColorPickerFrame.extraInfo;
NeedToKnow_Settings[variable] = {previousValues.r, previousValues.g, previousValues.b, previousValues.opacity};
NeedToKnow.Update();
NeedToKnow.UIPanel_Update();
NeedToKnow.UIPanel_Appearance_Update();
end
end
 
function NeedToKnow.UpdateBarTextureDropDown()
_G["InterfaceOptionsNeedToKnowAppearancePanelBarTextureDropDownText"]:SetText(NeedToKnow_Settings["BarTexture"]);
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_Settings["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_Settings.BarTexture then
barTextureSlider:SetValue(i);
end
end
end
 
function NeedToKnow.BarTextureDropDown(self)
if ( NeedToKnow_Settings ) then
for key, textureName in ipairs(textureList) do
info = UIDropDownMenu_CreateInfo();
info.value = textureName;
info.text = textureName;
info.checked = ( NeedToKnow_Settings["BarTexture"] == textureName );
info.func = NeedToKnow.ChooseBarTexture;
UIDropDownMenu_AddButton(info);
end
end
end
 
function NeedToKnow.ChooseBarTexture()
NeedToKnow_Settings["BarTexture"] = this.value;
NeedToKnow.Update();
NeedToKnow.UpdateBarTextureDropDown();
end
 
function NeedToKnow.UpdateBarFontDropDown()
local settings = NeedToKnow_Settings;
local barFontDropdownText = _G["InterfaceOptionsNeedToKnowAppearancePanelBarFontDropDownText"];
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]) == settings.BarFont ) then
barFontDropdownText:SetText(fontList[i]);
if ( LSM:Fetch("font", fontList[i]) == NeedToKnow_Settings.BarFont ) then
barFontSlider:SetValue(i);
local lbl = getglobal(panelName.."BarFontSliderLabel");
lbl:SetText(fontList[i]);
lbl:SetFont(NeedToKnow_Settings.BarFont, 10);
end
end
end
 
function NeedToKnow.BarFontDropDown(self)
if ( NeedToKnow_Settings ) then
for key, fontName in ipairs(fontList) do
local fontPath = LSM:Fetch("font", fontName);
info = UIDropDownMenu_CreateInfo();
info.value = fontPath;
info.text = fontName;
info.checked = ( NeedToKnow_Settings["BarFont"] == fontPath );
info.func = NeedToKnow.ChooseBarFont;
UIDropDownMenu_AddButton(info);
end
end
end
 
function NeedToKnow.ChooseBarFont()
NeedToKnow_Settings["BarFont"] = this.value;
NeedToKnow.Update();
NeedToKnow.UpdateBarFontDropDown();
end
 
 
 
-- --------
-- BAR GUI
-- --------