Skip to content

Commit

Permalink
✨ Added MUCH MORE options to the interface options menu
Browse files Browse the repository at this point in the history
  • Loading branch information
AssisrMatheus committed Sep 25, 2019
1 parent c42a03e commit 5e23e62
Show file tree
Hide file tree
Showing 26 changed files with 1,441 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bindings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Bindings>
<Binding name="TC_TOGGLE_FRAME" description="TodoChecklister binidings" header="TC_HEADER">
<Binding name="TC_TOGGLE_FRAME" description="TodoChecklister bindings" header="TC_HEADER" category="ADDONS">
GLOBAL_TodoChecklisterFrameToggle()
</Binding>
</Bindings>
10 changes: 9 additions & 1 deletion pkgmeta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@ ignore: # Files and directories beginning with a dot (such as .git) are automati
- button.png
- demo.gif
- icon.png
- README.md
- README.md

externals:
src/libs/LibStub:
url: https://repos.wowace.com/wow/libstub/trunk
tag: latest
src/libs/LibDBIcon-1.0:
url: https://repos.wowace.com/wow/libdbicon-1-0/trunk/LibDBIcon-1.0
tag: latest
44 changes: 36 additions & 8 deletions src/components/TodoChecklister.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,23 @@ function TodoChecklisterFrame:PaintItem(frame, todoItem, index)

if (en) then
-- Set the final string to:
finalString =
table.concat {
finalString, -- Current final string
remainingString:sub(1, en), -- Current string until now
"(",
GetItemCount(remainingString), -- Amount from bag
") "
}
local count = GetItemCount(remainingString, self.displayBankOnLinked, self.displayChargesOnLinked)
if (count and count > 0) then
finalString =
table.concat {
finalString, -- Current final string
remainingString:sub(1, en), -- Current string until now
"(",
count,
")"
}
else
finalString =
table.concat {
finalString, -- Current final string
remainingString:sub(1, en) -- Current string until now
}
end

-- Remove the current linked item from the remaining string to continue the process
remainingString = remainingString:sub(en + 1)
Expand Down Expand Up @@ -460,6 +469,7 @@ function TodoChecklisterFrame:Defaults()
self.frame:SetPoint("BOTTOMRIGHT", "$parent", "BOTTOMRIGHT", -120, 30)
self.frame:SetScale(1)
self.frame:SetAlpha(1)
self.memoizationId = 0

Settings:Defaults()
self:LoadCFG()
Expand All @@ -475,6 +485,7 @@ function TodoChecklisterFrame:LoadCFG()
self.frame.KeepFocus:Hide()
end

self.memoizationId = self.memoizationId + 1
self.frame.KeepFocus:SetChecked(Settings:KeepFocus())

if (not Settings:KeepFocus()) then
Expand All @@ -487,11 +498,14 @@ function TodoChecklisterFrame:LoadCFG()

-- Set up scroll bar
self.frame.ScrollFrame.update = function()
self.memoizationId = self.memoizationId + 1
self:OnUpdate()
end
HybridScrollFrame_CreateButtons(self.frame.ScrollFrame, "TodoItemTemplate")

self.displayLinked = Settings:DisplayLinked()
self.displayBankOnLinked = Settings:DisplayBankOnLinked()
self.displayChargesOnLinked = Settings:DisplayChargesOnLinked()

self:OnUpdate()
end
Expand Down Expand Up @@ -621,3 +635,17 @@ end
function ToggleFocusLoad(frame)
frame:SetChecked(Settings:KeepFocus())
end

function OnEnter(frame)
-- if (Settings:OpacityOnHover()) then
-- frame:SetAlpha(Settings:OpacityOnHover())
-- end
end

function OnLeave(frame)
-- if (Settings:Opacity()) then
-- frame:SetAlpha(Settings:Opacity())
-- else
-- frame:SetAlpha(1)
-- end
end
6 changes: 6 additions & 0 deletions src/components/TodoChecklister.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@
<OnSizeChanged>
OnSizeChanged(self)
</OnSizeChanged>
<OnEnter>
OnEnter(self)
</OnEnter>
<OnLeave>
OnLeave(self)
</OnLeave>
</Scripts>

<Anchors>
Expand Down
40 changes: 40 additions & 0 deletions src/config/interfaceOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ local addonName = select(1, ...)
local Constants = TodoAddon.Constants
---@class Settings
local Settings = TodoAddon.Settings
---@class MinimapIcon
local MinimapIcon = TodoAddon.MinimapIcon

--------------------------------------
-- Declarations
Expand All @@ -29,6 +31,7 @@ function InterfaceOptions:Defaults()
-- This will also call Settings:Defaults
TodoAddon.TodoChecklisterFrame:Defaults()
self:LoadCFG()
TodoAddon.MinimapIcon:LoadCFG()
end

---
Expand All @@ -45,8 +48,19 @@ function InterfaceOptions:LoadCFG()
self.frame.SettingsContainer.Opacity.Value:SetText(string.format("%d%s", Settings:Opacity() * 100, "%"))
end

if (Settings:OpacityOnHover()) then
self.frame.SettingsContainer.OpacityOnHover:SetValue(Settings:OpacityOnHover())
self.frame.SettingsContainer.OpacityOnHover.Value:SetText(
string.format("%d%s", Settings:OpacityOnHover() * 100, "%")
)
end

self.frame.SettingsContainer.FanfareCheck:SetChecked(Settings:PlayFanfare())
self.frame.SettingsContainer.LinkedCounterCheckButton:SetChecked(Settings:DisplayLinked())
self.frame.SettingsContainer.MuteChatCheckButton:SetChecked(Settings:ChatMuted())
self.frame.SettingsContainer.ToggleMapButton:SetChecked(Settings:DisplayMinimapIcon())
self.frame.SettingsContainer.DisplayBankOnLinked:SetChecked(Settings:DisplayBankOnLinked())
self.frame.SettingsContainer.DisplayChargesOnLinked:SetChecked(Settings:DisplayChargesOnLinked())
end

if (TodoAddon.TodoChecklisterFrame) then
Expand Down Expand Up @@ -136,3 +150,29 @@ function DisplayLinkedCountClick(frame)
Settings:SetDisplayLinked(frame:GetChecked())
InterfaceOptions:LoadCFG()
end

function ToggleMapClick(frame)
Settings:SetDisplayMinimapIcon(frame:GetChecked())
TodoAddon.MinimapIcon:LoadCFG()
end

function MuteChatClick(frame)
Settings:SetChatMuted(frame:GetChecked())
end

function OpacityOnHoverValueChanged(frame)
if (InterfaceOptions.frame) then
Settings:SetOpacityOnHover(frame:GetValue())
InterfaceOptions:LoadCFG()
end
end

function DisplayBankClick(frame)
Settings:SetDisplayBankOnLinked(frame:GetChecked())
InterfaceOptions:LoadCFG()
end

function DisplayChargesClick(frame)
Settings:SetDisplayChargesOnLinked(frame:GetChecked())
InterfaceOptions:LoadCFG()
end
Loading

0 comments on commit 5e23e62

Please sign in to comment.