vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | TITAN_TRANS_ID = "Trans"; |
2 | TITAN_TRANS_FRAME_SHOW_TIME = 0.5; |
||
3 | |||
4 | function TitanPanelTransButton_OnLoad() |
||
5 | this.registry = { |
||
6 | id = TITAN_TRANS_ID, |
||
7 | builtIn = 1, |
||
8 | version = TITAN_VERSION, |
||
9 | menuText = TITAN_TRANS_MENU_TEXT, |
||
10 | tooltipTitle = TITAN_TRANS_TOOLTIP, |
||
11 | tooltipTextFunction = "TitanPanelTransButton_GetTooltipText", |
||
12 | icon = TITAN_ARTWORK_PATH.."TitanPanelTrans", |
||
13 | }; |
||
14 | end |
||
15 | |||
16 | function TitanPanelTransButton_GetTooltipText() |
||
17 | local transText = TitanPanelTrans_GetAlphaText(TitanPanelGetVar("Transparency")); |
||
18 | return "".. |
||
19 | TITAN_TRANS_TOOLTIP_VALUE.."\t"..TitanUtils_GetHighlightText(transText).."\n".. |
||
20 | TitanUtils_GetGreenText(TITAN_TRANS_TOOLTIP_HINT1).."\n".. |
||
21 | TitanUtils_GetGreenText(TITAN_TRANS_TOOLTIP_HINT2); |
||
22 | end |
||
23 | |||
24 | function TitanPanelTransControlSlider_OnEnter() |
||
25 | this.tooltipText = TitanOptionSlider_TooltipText(TITAN_TRANS_CONTROL_TOOLTIP, TitanPanelTrans_GetAlphaText(TitanPanelGetVar("Transparency"))); |
||
26 | GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT"); |
||
27 | GameTooltip:SetText(this.tooltipText, nil, nil, nil, nil, 1); |
||
28 | TitanUtils_StopFrameCounting(this:GetParent()); |
||
29 | end |
||
30 | |||
31 | function TitanPanelTransControlSlider_OnLeave() |
||
32 | this.tooltipText = nil; |
||
33 | GameTooltip:Hide(); |
||
34 | TitanUtils_StartFrameCounting(this:GetParent(), TITAN_TRANS_FRAME_SHOW_TIME); |
||
35 | end |
||
36 | |||
37 | function TitanPanelTransControlSlider_OnShow() |
||
38 | getglobal(this:GetName().."Text"):SetText(TitanPanelTrans_GetAlphaText(TitanPanelGetVar("Transparency"))); |
||
39 | getglobal(this:GetName().."High"):SetText(TITAN_TRANS_CONTROL_LOW); |
||
40 | getglobal(this:GetName().."Low"):SetText(TITAN_TRANS_CONTROL_HIGH); |
||
41 | this:SetMinMaxValues(0, 1); |
||
42 | this:SetValueStep(0.01); |
||
43 | this:SetValue(1 - TitanPanelGetVar("Transparency")); |
||
44 | |||
45 | position = TitanUtils_GetRealPosition(TITAN_TRANS_ID); |
||
46 | |||
47 | TitanPanelTransControlFrame:SetPoint("BOTTOMRIGHT", "TitanPanel" .. TitanUtils_GetWhichBar(TITAN_TRANS_ID) .."Button", "TOPRIGHT", 0, 0); |
||
48 | if (position == TITAN_PANEL_PLACE_TOP) then |
||
49 | TitanPanelTransControlFrame:ClearAllPoints(); |
||
50 | TitanPanelTransControlFrame:SetPoint("TOPLEFT", "TitanPanel" .. TitanUtils_GetWhichBar(TITAN_TRANS_ID) .."Button", "BOTTOMLEFT", UIParent:GetRight() - TitanPanelTransControlFrame:GetWidth(), -4); |
||
51 | else |
||
52 | TitanPanelTransControlFrame:ClearAllPoints(); |
||
53 | TitanPanelTransControlFrame:SetPoint("BOTTOMLEFT", "TitanPanel" .. TitanUtils_GetWhichBar(TITAN_TRANS_ID) .."Button", "TOPLEFT", UIParent:GetRight() - TitanPanelTransControlFrame:GetWidth(), 0); |
||
54 | end |
||
55 | |||
56 | end |
||
57 | |||
58 | function TitanPanelTransControlSlider_OnValueChanged() |
||
59 | getglobal(this:GetName().."Text"):SetText(TitanPanelTrans_GetAlphaText(1 - this:GetValue())); |
||
60 | TitanPanelBarButton:SetAlpha(1 - this:GetValue()); |
||
61 | TitanPanelAuxBarButton:SetAlpha(1 - this:GetValue()); |
||
62 | TitanPanelSetVar("Transparency", 1 - this:GetValue()); |
||
63 | |||
64 | -- Update GameTooltip |
||
65 | if (this.tooltipText) then |
||
66 | this.tooltipText = TitanOptionSlider_TooltipText(TITAN_TRANS_CONTROL_TOOLTIP, TitanPanelTrans_GetAlphaText(1 - this:GetValue())); |
||
67 | GameTooltip:SetText(this.tooltipText, nil, nil, nil, nil, 1); |
||
68 | end |
||
69 | end |
||
70 | |||
71 | function TitanPanelTrans_GetAlphaText(alpha) |
||
72 | return tostring(floor(100 * alpha + 0.5)) .. "%"; |
||
73 | end |
||
74 | |||
75 | function TitanPanelTransControlFrame_OnLoad() |
||
76 | getglobal(this:GetName().."Title"):SetText(TITAN_TRANS_CONTROL_TITLE); |
||
77 | this:SetBackdropBorderColor(1, 1, 1); |
||
78 | this:SetBackdropColor(0, 0, 0, 1); |
||
79 | end |
||
80 | |||
81 | -- If dropdown is visible then see if its timer has expired, if so hide the frame |
||
82 | function TitanPanelTransControlFrame_OnUpdate(elapsed) |
||
83 | TitanUtils_CheckFrameCounting(this, elapsed); |
||
84 | end |
||
85 | |||
86 | function TitanPanelRightClickMenu_PrepareTransMenu() |
||
87 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_TRANS_ID].menuText); |
||
88 | TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_TRANS_ID, TITAN_PANEL_MENU_FUNC_HIDE); |
||
89 | end |