Commit 235809da authored by Merathilis's avatar Merathilis
Browse files

A lot of styling updates to cargBags.

parent 712fa6e0
......@@ -246,12 +246,10 @@ end
]]
local function ItemButton_UpdateQuest(self, item)
if item.questID or item.isQuestItem then
self.Border:SetBackdropBorderColor(1, 1, 0, 1)
self.Border:SetBackdropBorderColor(1, 0.3, 0.3, 1)
elseif item.rarity and item.rarity > 1 then
local r, g, b = GetItemQualityColor(item.rarity)
self.Border:SetBackdropBorderColor(r, g, b, 1)
else
self.Border:SetBackdropBorderColor(0, 0, 0, 1)
end
if(self.OnUpdateQuest) then self:OnUpdateQuest(item) end
......
......@@ -49,57 +49,52 @@ BagButton.itemFadeAlpha = 0.2
local buttonNum = 0
function BagButton:Create(bagID)
buttonNum = buttonNum+1
local name = addon.."BagButton"..buttonNum
local button = setmetatable(CreateFrame("CheckButton", name, nil, "ItemButtonTemplate"), self.__index)
local invID = ContainerIDToInventoryID(bagID)
button.invID = invID
button.bagID = bagID
button.isBag = 1
if button.bagID <= 4 then
-- Inventory
button:SetID(invID)
button.UpdateTooltip = BagSlotButton_OnEnter
elseif button.bagID >= 5 then
-- Bank
button:SetID(invID - 67) -- bank IDs don't use the actual invID
button.GetInventorySlot = ButtonInventorySlot
button.UpdateTooltip = BankFrameItemButton_OnEnter
end
button:RegisterForDrag("LeftButton", "RightButton")
button:RegisterForClicks("anyUp")
button:SetCheckedTexture(self.checkedTex, "ADD")
button:SetSize(32, 32)
button.Icon = _G[name.."IconTexture"]
button.Count = _G[name.."Count"]
button.Cooldown = _G[name.."Cooldown"]
button.Quest = _G[name.."IconQuestTexture"]
button.Border = _G[name.."NormalTexture"]
button.bg = CreateFrame("Frame", nil, button)
button.bg:SetAllPoints(button)
button.bg:SetBackdrop({
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Buttons\\WHITE8x8",
tile = false, tileSize = 16, edgeSize = 1,
})
button.bg:SetBackdropColor(1, 1, 1, 0)
button.bg:SetBackdropBorderColor(0, 0, 0, 1)
button.Icon:SetTexCoord(.08, .92, .08, .92)
button.Icon:SetVertexColor(0.8, 0.8, 0.8)
button.Border:SetAlpha(0)
cargBags.SetScriptHandlers(button, "OnClick", "OnReceiveDrag", "OnEnter", "OnLeave", "OnDragStart")
if(button.OnCreate) then button:OnCreate(bagID) end
return button
buttonNum = buttonNum+1
local name = addon.."BagButton"..buttonNum
local button = setmetatable(CreateFrame("CheckButton", name, nil, "ItemButtonTemplate"), self.__index)
local invID = ContainerIDToInventoryID(bagID)
button.invID = invID
button.bagID = bagID
button.isBag = 1
if button.bagID <= 4 then
-- Inventory
button:SetID(invID)
button.UpdateTooltip = BagSlotButton_OnEnter
elseif button.bagID >= 5 then
-- Bank
button:SetID(invID - 67) -- bank IDs don't use the actual invID
button.GetInventorySlot = ButtonInventorySlot
button.UpdateTooltip = BankFrameItemButton_OnEnter
end
button:RegisterForDrag("LeftButton", "RightButton")
button:RegisterForClicks("anyUp")
button:SetCheckedTexture(self.checkedTex, "ADD")
button:SetSize(32, 32)
button:SetHighlightTexture("")
button:SetPushedTexture("")
button:SetNormalTexture("")
button:SetTemplate("Transparent")
button:StyleButton()
button.Icon = _G[name.."IconTexture"]
button.Count = _G[name.."Count"]
button.Cooldown = _G[name.."Cooldown"]
button.Quest = _G[name.."IconQuestTexture"]
button.Border = _G[name.."NormalTexture"]
button.Icon:SetTexCoord(.08, .92, .08, .92)
button.Icon:SetPoint("TOPLEFT", 2, -2)
button.Icon:SetPoint("BOTTOMRIGHT", -2, 2)
cargBags.SetScriptHandlers(button, "OnClick", "OnReceiveDrag", "OnEnter", "OnLeave", "OnDragStart")
if(button.OnCreate) then button:OnCreate(bagID) end
return button
end
function BagButton:Update()
......
......@@ -84,21 +84,14 @@ end
cargBags:RegisterPlugin("SearchBar", function(self, target)
local search = CreateFrame("EditBox", nil, self)
if FreeUI then
local F, C, L = unpack(FreeUI)
local locale = GetLocale()
if ElvUI then
local searchFont = {
C.font.normal,
ElvUI[1].media.normFont,
12,
"OUTLINE"
}
if locale == "zhCN" or locale == "zhTW" then
search:SetFont(unpack(searchFont))
else
F.SetFS(search)
end
search:SetFont(unpack(searchFont))
else
search:SetFont(unpack(ns.options.fonts.standard))
end
......
......@@ -99,7 +99,7 @@ do --Replacement for UIDropDownMenu
end
function f:UpdatePosition(frame, point, relativepoint, ofsX, ofsY)
point, relativepoint, ofsX, ofsY = point or "TOPLEFT", relativepoint or "BOTTOMLEFT", ofsX or 0, ofsY or 0
point, relativepoint, ofsX, ofsY = point or "BOTTOMRIGHT", relativepoint or "BOTTOMLEFT", ofsX or -25, ofsY or 138
self:ClearAllPoints()
self:SetPoint(point, frame, relativepoint, ofsX, ofsY)
......@@ -301,14 +301,8 @@ function cargBags_Nivaya:ADDON_LOADED(event, addon)
cB_Bags.main :SetMultipleFilters(true, cB_Filters.fBags, cB_Filters.fHideEmpty)
for _,v in pairs(cB_CustomBags) do cB_Bags[v.name]:SetExtendedFilter(cB_Filters.fItemClass, v.name) end
if ElvUI then
local E, L, V, P, G = unpack(ElvUI)
cB_Bags.main:SetPoint("BOTTOMRIGHT", E.UIParent, "BOTTOMRIGHT", -28, 50)
cB_Bags.bank:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 10, 50)
else
cB_Bags.main:SetPoint("BOTTOMRIGHT", -99, 26)
cB_Bags.bank:SetPoint("TOPLEFT", 20, -20)
end
cB_Bags.main:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -28, 50)
cB_Bags.bank:SetPoint("TOPLEFT", 20, -20)
cbNivaya:CreateAnchors()
cbNivaya:Init()
......
local addon, ns = ...
ns.options = {
itemSlotSize = 39, -- Size of item slots
sizes = {
bags = {
columnsSmall = 10,
columnsLarge = 10,
largeItemCount = 64, -- Switch to columnsLarge when >= this number of items in your bags
},
bank = {
columnsSmall = 12,
columnsLarge = 12,
largeItemCount = 96, -- Switch to columnsLarge when >= this number of items in the bank
},
},
fonts = {
-- Font to use for bag captions and other strings
-- Default Fonts
standard = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
9, -- Font Size
"OUTLINE", -- Flags
itemSlotSize = 35,
itemSlotPadding = 6,
sizes = {
bags = {
columnsSmall = 10,
columnsLarge = 10,
largeItemCount = 64, -- Switch to columnsLarge when >= this number of items in your bags
},
bank = {
columnsSmall = 12,
columnsLarge = 12,
largeItemCount = 96, -- Switch to columnsLarge when >= this number of items in the bank
},
},
--Font to use for the dropdown menu
dropdown = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
10, -- Font Size
"OUTLINE", -- Flags
},
-- Font to use for durability and item level
itemInfo = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
10, -- Font Size
"OUTLINE", -- Flags
fonts = {
-- Font to use for bag captions and other strings
standard = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
9, -- Font Size
"OUTLINE", -- Flags
},
--Font to use for the dropdown menu
dropdown = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
10, -- Font Size
"OUTLINE", -- Flags
},
-- Font to use for durability and item level
itemInfo = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
10, -- Font Size
"OUTLINE", -- Flags
},
-- Font to use for number of items in a stack
itemCount = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
11, -- Font Size
"OUTLINE", -- Flags
},
},
-- Font to use for number of items in a stack
itemCount = {
[[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], -- Font path
11, -- Font Size
"OUTLINE", -- Flags
colors = {
background = {0.05, 0.05, 0.05, 1}, -- r, g, b, opacity
},
},
colors = {
background = {0.05, 0.05, 0.05, 1}, -- r, g, b, opacity
},
}
\ No newline at end of file
......@@ -38,39 +38,47 @@ if gl == "deDE" then
cBnivL.MarkAsKnown = "Als bekannt markieren"
cBnivL.bagCaptions.cBniv_Stuff = "Cooles Zeugs"
cBnivL.bagCaptions.cBniv_NewItems = "Neue Items"
cBnivL.hint = "Strg + Alt + Rechts Klick auf ein Gegenstand um eine Kategory auszuwählen"
elseif gl == "ruRU" then
cBnivL.MarkAsNew = "Перенести в Новые предметы"
cBnivL.MarkAsKnown = "Перенести в Известные предметы"
cBnivL.bagCaptions.cBniv_Stuff = "Разное"
cBnivL.bagCaptions.cBniv_NewItems = "Новые предметы"
cBnivL.hint = "Ctrl + Alt + Right Click an item to assign category"
elseif gl == "zhTW" then
cBnivL.MarkAsNew = "Mark as New"
cBnivL.MarkAsKnown = "Mark as Known"
cBnivL.bagCaptions.cBniv_Stuff = "施法材料"
cBnivL.bagCaptions.cBniv_NewItems = "新增"
cBnivL.hint = "Ctrl + Alt + Right Click an item to assign category"
elseif gl == "zhCN" then
cBnivL.MarkAsNew = "Mark as New"
cBnivL.MarkAsKnown = "Mark as Known"
cBnivL.bagCaptions.cBniv_Stuff = "施法材料"
cBnivL.bagCaptions.cBniv_NewItems = "新增"
cBnivL.hint = "Ctrl + Alt + Right Click an item to assign category"
elseif gl == "koKR" then
cBnivL.MarkAsNew = "Mark as New"
cBnivL.MarkAsKnown = "Mark as Known"
cBnivL.bagCaptions.cBniv_Stuff = "지정"
cBnivL.bagCaptions.cBniv_NewItems = "신규"
cBnivL.hint = "Ctrl + Alt + Right Click an item to assign category"
elseif gl == "frFR" then
cBnivL.MarkAsNew = "Marquer comme Neuf"
cBnivL.MarkAsKnown = "Marquer comme Connu"
cBnivL.bagCaptions.cBniv_Stuff = "Divers"
cBnivL.bagCaptions.cBniv_NewItems = "Nouveaux Objets"
cBnivL.hint = "Ctrl + Alt + Right Click an item to assign category"
elseif gl == "itIT" then
cBnivL.MarkAsNew = "Segna come Nuovo"
cBnivL.MarkAsKnown = "Segna come Conosciuto"
cBnivL.bagCaptions.cBniv_Stuff = "Cose Interessanti"
cBnivL.bagCaptions.cBniv_NewItems = "Oggetti Nuovi"
cBnivL.hint = "Ctrl + Alt + Right Click an item to assign category"
else
cBnivL.MarkAsNew = "Mark as New"
cBnivL.MarkAsKnown = "Mark as Known"
cBnivL.bagCaptions.cBniv_Stuff = "Cool Stuff"
cBnivL.bagCaptions.cBniv_NewItems = "New Items"
cBnivL.hint = "Ctrl + Alt + Right Click an item to assign category"
end
......@@ -22,6 +22,7 @@ local Textures = {
}
local itemSlotSize = ns.options.itemSlotSize
local itemSlotPadding = ns.options.itemSlotPadding
------------------------------------------
-- MyContainer specific
------------------------------------------
......@@ -101,9 +102,9 @@ function MyContainer:OnContentsChanged()
for _,v in ipairs(buttonIDs) do
local button = v[3]
button:ClearAllPoints()
local xPos = col * (itemSlotSize + 2) + 2
local yPos = (-1 * row * (itemSlotSize + 2)) - yPosOffs
local xPos = col * (itemSlotSize + itemSlotPadding) + 2
local yPos = (-1 * row * (itemSlotSize + itemSlotPadding)) - yPosOffs
button:SetPoint("TOPLEFT", self, "TOPLEFT", xPos, yPos)
if(col >= self.Columns-1) then
......@@ -116,8 +117,8 @@ function MyContainer:OnContentsChanged()
end
if cBnivCfg.CompressEmpty then
local xPos = col * (itemSlotSize + 2) + 2
local yPos = (-1 * row * (itemSlotSize + 2)) - yPosOffs
local xPos = col * (itemSlotSize + itemSlotPadding) + 2
local yPos = (-1 * row * (itemSlotSize + itemSlotPadding)) - yPosOffs
local tDrop = self.DropTarget
if tDrop then
......@@ -137,7 +138,7 @@ function MyContainer:OnContentsChanged()
end
-- This variable stores the size of the item button container
self.ContainerHeight = (row + (col > 0 and 1 or 0)) * (itemSlotSize + 2)
self.ContainerHeight = (row + (col > 0 and 1 or 0)) * (itemSlotSize + itemSlotPadding)
if (self.UpdateDimensions) then self:UpdateDimensions() end -- Update the bag's height
local t = (tName == "cBniv_Bag") or (tName == "cBniv_Bank") or (tName == "cBniv_BankReagent")
......@@ -231,9 +232,9 @@ function cbNivResetNew()
end
local UpdateDimensions = function(self)
local height = 0 -- Normal margin space
local height = 5 -- Normal margin space
if self.BagBar and self.BagBar:IsShown() then
height = height + 40 -- Bag button space
height = height + 35 -- Bag button space
end
if self.Space then
height = height + 16 -- additional info display space
......@@ -442,7 +443,7 @@ function MyContainer:OnCreate(name, settings)
end
self.ContainerHeight = 0
self:UpdateDimensions()
self:SetWidth((itemSlotSize + 2) * self.Columns + 2)
self:SetWidth((itemSlotSize + itemSlotPadding) * self.Columns + 2)
-- The frame background
local tBankCustom = (tBankBags and not cBnivCfg.BankBlack)
......@@ -454,8 +455,7 @@ function MyContainer:OnCreate(name, settings)
-- The frame background
local background = CreateFrame("Frame", nil, self)
if ElvUI then
background:CreateBackdrop("Transparent")
background.backdrop:SetAllPoints()
background:SetTemplate("Transparent")
else
background:SetBackdrop{
bgFile = Textures.Background,
......@@ -495,13 +495,13 @@ function MyContainer:OnCreate(name, settings)
local close = CreateFrame("Button", nil, self, "UIPanelCloseButton")
if ElvUI then
ElvUI[1]:GetModule("Skins"):HandleCloseButton(close)
close:SetPoint("TOPRIGHT", 7, 7)
close:SetPoint("TOPRIGHT", 0, 0)
close:SetWidth(22)
close:SetHeight(22)
else
close:SetPoint("TOPRIGHT", 8, 8)
close:SetDisabledTexture("Interface\\AddOns\\cargBags_Nivaya\\media\\CloseButton\\UI-Panel-MinimizeButton-Disabled")
close:SetNormalTexture("Interface\\AddOns\\cargBags_Nivaya\\media\\CloseButton\\UI-Panel-MinimizeButton-Up")
close:SetPushedTexture("Interface\\AddOns\\cargBags_Nivaya\\media\\CloseButton\\UI-Panel-MinimizeButton-Down")
close:SetHighlightTexture("Interface\\AddOns\\cargBags_Nivaya\\media\\CloseButton\\UI-Panel-MinimizeButton-Highlight", "ADD")
close:SetPoint("TOPRIGHT", 5, 5)
close:SetWidth(25)
close:SetHeight(25)
end
close:SetScript("OnClick", function(self) if cbNivaya:AtBank() then CloseBankFrame() else CloseAllBags() end end)
end
......@@ -574,7 +574,7 @@ function MyContainer:OnCreate(name, settings)
bagButtons.highlightFunction = function(button, match) button:SetAlpha(match and 1 or 0.1) end
bagButtons.isGlobal = true
bagButtons:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -2, 25)
bagButtons:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -2, 30)
bagButtons:Hide()
-- main window gets a fake bag button for toggling key ring
......@@ -586,12 +586,12 @@ function MyContainer:OnCreate(name, settings)
self.bagToggle:SetScript("OnClick", function()
if(self.BagBar:IsShown()) then
self.BagBar:Hide()
-- if self.hint then self.hint:Show() end
-- self.hintShown = true
if self.hint then self.hint:Show() end
self.hintShown = true
else
self.BagBar:Show()
-- if self.hint then self.hint:Hide() end
-- self.hintShown = false
if self.hint then self.hint:Hide() end
self.hintShown = false
end
self:UpdateDimensions()
end)
......@@ -696,6 +696,7 @@ function MyContainer:OnCreate(name, settings)
local dtNT = _G[self.DropTarget:GetName().."NormalTexture"]
if dtNT then dtNT:SetTexture(nil) end
--[[
self.DropTarget.bg = CreateFrame("Frame", nil, self)
self.DropTarget.bg:SetAllPoints(self.DropTarget)
self.DropTarget.bg:SetBackdrop({
......@@ -707,6 +708,15 @@ function MyContainer:OnCreate(name, settings)
self.DropTarget.bg:SetBackdropBorderColor(0, 0, 0, 1)
self.DropTarget:SetWidth(itemSlotSize - 1)
self.DropTarget:SetHeight(itemSlotSize - 1)
]]
self.DropTarget:SetHighlightTexture("")
self.DropTarget:SetPushedTexture("")
self.DropTarget:SetNormalTexture("")
self.DropTarget:SetTemplate("Transparent")
self.DropTarget:StyleButton()
self.DropTarget:SetWidth(itemSlotSize - 1)
self.DropTarget:SetHeight(itemSlotSize - 1)
local DropTargetProcessItem = function()
-- if CursorHasItem() then -- Commented out to fix Guild Bank -> Bags item dragging
......@@ -754,16 +764,29 @@ function MyContainer:OnCreate(name, settings)
searchIcon:SetWidth(16)
searchIcon:SetHeight(16)
-- The money display
local money = self:SpawnPlugin("TagDisplay", "[money]", self)
money:SetPoint("TOPRIGHT", self, -30, -2.5)
-- Hint
self.hint = background:CreateFontString(nil, "OVERLAY", nil)
self.hint:SetPoint("BOTTOMLEFT", infoFrame, -0.5, 31.5)
if ElvUI then
money:SetFont(ElvUI[1].media.normFont, 11, "OUTLINE")
self.hint:SetFont(ElvUI[1].media.normFont, 10, "OUTLINE")
else
money:SetFont(unpack(ns.options.fonts.standard))
self.hint:SetFont(unpack(ns.options.fonts.standard))
end
money:SetJustifyH("RIGHT")
money:SetShadowColor(0, 0, 0, 0)
self.hint:SetTextColor(1, 1, 1, 0.4)
self.hint:SetText(L.hint)
self.hint:SetWidth(self:GetWidth())
self.hintShown = true
-- The money display
-- local money = self:SpawnPlugin("TagDisplay", "[money]", self)
-- money:SetPoint("TOPRIGHT", self, -30, -2.5)
-- if ElvUI then
-- money:SetFont(ElvUI[1].media.normFont, 11, "OUTLINE")
-- else
-- money:SetFont(unpack(ns.options.fonts.standard))
-- end
-- money:SetJustifyH("RIGHT")
-- money:SetShadowColor(0, 0, 0, 0)
end
self:SetScale(cBnivCfg.scale)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment