diff --git a/bindings.xml b/bindings.xml index bf12bc2..9fe99e9 100644 --- a/bindings.xml +++ b/bindings.xml @@ -1,5 +1,5 @@ - + GLOBAL_TodoChecklisterFrameToggle() \ No newline at end of file diff --git a/pkgmeta.yaml b/pkgmeta.yaml index 77368cf..fa93850 100644 --- a/pkgmeta.yaml +++ b/pkgmeta.yaml @@ -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 \ No newline at end of file + - 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 \ No newline at end of file diff --git a/src/components/TodoChecklister.lua b/src/components/TodoChecklister.lua index ad330bc..8129abe 100644 --- a/src/components/TodoChecklister.lua +++ b/src/components/TodoChecklister.lua @@ -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) @@ -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() @@ -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 @@ -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 @@ -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 diff --git a/src/components/TodoChecklister.xml b/src/components/TodoChecklister.xml index b99423c..8d048d3 100644 --- a/src/components/TodoChecklister.xml +++ b/src/components/TodoChecklister.xml @@ -193,6 +193,12 @@ OnSizeChanged(self) + + OnEnter(self) + + + OnLeave(self) + diff --git a/src/config/interfaceOptions.lua b/src/config/interfaceOptions.lua index c29eab1..9d07af6 100644 --- a/src/config/interfaceOptions.lua +++ b/src/config/interfaceOptions.lua @@ -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 @@ -29,6 +31,7 @@ function InterfaceOptions:Defaults() -- This will also call Settings:Defaults TodoAddon.TodoChecklisterFrame:Defaults() self:LoadCFG() + TodoAddon.MinimapIcon:LoadCFG() end --- @@ -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 @@ -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 diff --git a/src/config/interfaceOptions.xml b/src/config/interfaceOptions.xml index 8ecdb6f..4758c4f 100644 --- a/src/config/interfaceOptions.xml +++ b/src/config/interfaceOptions.xml @@ -103,6 +103,105 @@ + + + + + + self.Text:SetText("Display linked items amount from bag"); + + + PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); + DisplayLinkedCountClick(self) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + self.Text:SetText("Display minimap icon"); + + + PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); + ToggleMapClick(self) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + self.Text:SetText("Mute all chat messages"); + + + PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); + MuteChatClick(self) + + + + + + + + + + + + + + + + + + + + + + + @@ -117,7 +216,7 @@ - + @@ -136,21 +235,21 @@ - + - self.Text:SetText("Display linked items amount from bag"); + self.Text:SetText("Count from bank on linked items"); PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); - DisplayLinkedCountClick(self) + DisplayBankClick(self) - + @@ -169,9 +268,42 @@ + + + + + + self.Text:SetText("Count charges on linked items"); + + + PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON); + DisplayChargesClick(self) + + + + + + + + + + + + + + + + + + + + + + + - + @@ -212,6 +344,49 @@ + +