- added variable text size for the menus
- added disenchanting and prospecting to the menu
- changed the text on the option to hide the main button to standalone button
This commit is contained in:
Anch
2023-10-25 14:03:09 +13:00
parent 5b9beb5c3e
commit ccc268d5cc
3 changed files with 67 additions and 35 deletions
+34 -32
View File
@@ -7,7 +7,7 @@ local defIcon = "Interface\\Icons\\achievement_guildperk_bountifulbags"
local icon = LibStub('LibDBIcon-1.0')
local CYAN = "|cff00ffff"
local WHITE = "|cffFFFFFF"
local
PROFESSIONMENU_MINIMAP = LibStub:GetLibrary('LibDataBroker-1.1'):NewDataObject(addonName, {
type = 'data source',
text = "ProfessionMenu",
@@ -22,6 +22,7 @@ local DefaultSettings = {
{ TableName = "HideMenu", false, Frame = "ProfessionMenuFrame", CheckBox = "ProfessionMenuOptions_HideMenu"},
{ TableName = "DeleteItem", false, CheckBox = "ProfessionMenuOptions_DeleteMenu"},
{ TableName = "minimap", false, CheckBox = "ProfessionMenuOptions_HideMinimap"},
{ TableName = "txtSize", 12 }
}
--[[ TableName = Name of the saved setting
@@ -195,8 +196,8 @@ function PM:AddItem(itemID)
'icon', icon,
'secure', secure,
'func', function() if not PM:HasItem(itemID) then RequestDeliverVanityCollectionItem(itemID) else if PM.db.DeleteItem then PM:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") end dewdrop:Close() end end,
'textHeight', 12,
'textWidth', 12
'textHeight', PM.db.txtSize,
'textWidth', PM.db.txtSize
)
end
@@ -205,8 +206,8 @@ function PM:AddDividerLine(maxLenght)
local text = WHITE.."----------------------------------------------------------------------------------------------------"
dewdrop:AddLine(
'text' , text:sub(1, maxLenght),
'textHeight', 12,
'textWidth', 12,
'textHeight', PM.db.txtSize,
'textWidth', PM.db.txtSize,
'isTitle', true,
"notCheckable", true
)
@@ -221,8 +222,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
'children', function(level, value)
dewdrop:AddLine(
'text', "|cffffff00Professions",
'textHeight', 12,
'textWidth', 12,
'textHeight', PM.db.txtSize,
'textWidth', PM.db.txtSize,
'isTitle', true,
'notCheckable', true
)
@@ -239,8 +240,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
'icon', icon,
'secure', secure,
'closeWhenClicked', true,
'textHeight', 12,
'textWidth', 12
'textHeight', PM.db.txtSize,
'textWidth', PM.db.txtSize
)
end
end
@@ -252,26 +253,29 @@ local function ProfessionMenu_DewdropRegister(self, frame)
end
if CA_IsSpellKnown(750750) then
local name, _, icon = GetSpellInfo(750750)
local secure = {
type1 = 'spell',
spell = name
}
dewdrop:AddLine(
'text', name,
'icon', icon,
'secure', secure,
'closeWhenClicked', true,
'textHeight', 12,
'textWidth', 12
)
local secure = { type1 = 'spell', spell = name }
dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize)
end
end
if CA_IsSpellKnown(13262) or CA_IsSpellKnown(31252) then
PM:AddDividerLine(35)
end
if CA_IsSpellKnown(13262) then
local name, _, icon = GetSpellInfo(13262)
local secure = { type1 = 'spell', spell = name }
dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize)
end
if CA_IsSpellKnown(31252) then
local name, _, icon = GetSpellInfo(31252)
local secure = { type1 = 'spell', spell = name }
dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize)
end
PM:AddDividerLine(35)
if frame == "ProfessionMenuFrame_Menu" then
dewdrop:AddLine(
'text', "Unlock Frame",
'textHeight', 12,
'textWidth', 12,
'textHeight', PM.db.txtSize,
'textWidth', PM.db.txtSize,
'func', PM.UnlockFrame,
'notCheckable', true,
'closeWhenClicked', true
@@ -279,8 +283,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
end
dewdrop:AddLine(
'text', "Options",
'textHeight', 12,
'textWidth', 12,
'textHeight', PM.db.txtSize,
'textWidth', PM.db.txtSize,
'func', PM.Options_Toggle,
'notCheckable', true,
'closeWhenClicked', true
@@ -290,8 +294,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
'textR', 0,
'textG', 1,
'textB', 1,
'textHeight', 12,
'textWidth', 12,
'textHeight', PM.db.txtSize,
'textWidth', PM.db.txtSize,
'closeWhenClicked', true,
'notCheckable', true
)
@@ -469,11 +473,9 @@ end
function minimap.OnClick(self, button)
GameTooltip:Hide()
if button == "LeftButton" then
if dewdrop:IsOpen() then dewdrop:Close() return end
ProfessionMenu_DewdropRegister(self)
dewdrop:Open(self)
end
if dewdrop:IsOpen() then dewdrop:Close() return end
ProfessionMenu_DewdropRegister(self)
dewdrop:Open(self)
end
function minimap.OnLeave()
+1 -1
View File
@@ -7,6 +7,6 @@
## X-Category: Profession
## X-OptionsFrame: ProfessionMenuOptionsFrame
## DefaultState: enabled
## Version: 0.2
## Version: 0.3
embeds.xml
+32 -2
View File
@@ -10,6 +10,8 @@ end
function PM:OpenOptions()
if InterfaceOptionsFrame:GetWidth() < 850 then InterfaceOptionsFrame:SetWidth(850) end
PM:DropDownInitialize()
UIDropDownMenu_SetText(ProfessionMenuOptions_TxtSizeMenu, PM.db.txtSize)
end
--Creates the options frame and all its assets
@@ -27,7 +29,7 @@ end
hideMenu.Lable = hideMenu:CreateFontString(nil , "BORDER", "GameFontNormal")
hideMenu.Lable:SetJustifyH("LEFT")
hideMenu.Lable:SetPoint("LEFT", 30, 0)
hideMenu.Lable:SetText("Hide Main Menu")
hideMenu.Lable:SetText("Hide Standalone Button")
hideMenu:SetScript("OnClick", function()
if PM.db.HideMenu then
ProfessionMenuFrame:Show()
@@ -68,10 +70,38 @@ end
hideMinimap:SetScript("OnClick", function() PM:ToggleMinimap() end)
local itemDel = CreateFrame("CheckButton", "ProfessionMenuOptions_DeleteMenu", ProfessionMenuOptionsFrame, "UICheckButtonTemplate")
itemDel:SetPoint("TOPLEFT", 15, -160)
itemDel:SetPoint("TOPLEFT", 15, -165)
itemDel.Lable = itemDel:CreateFontString(nil , "BORDER", "GameFontNormal")
itemDel.Lable:SetJustifyH("LEFT")
itemDel.Lable:SetPoint("LEFT", 30, 0)
itemDel.Lable:SetText("Delete anvil after summoning")
itemDel:SetScript("OnClick", function() PM.db.DeleteItem = not PM.db.DeleteItem end)
local txtSize = CreateFrame("Button", "ProfessionMenuOptions_TxtSizeMenu", ProfessionMenuOptionsFrame, "UIDropDownMenuTemplate")
txtSize:SetPoint("TOPLEFT", 15, -200)
txtSize.Lable = txtSize:CreateFontString(nil , "BORDER", "GameFontNormal")
txtSize.Lable:SetJustifyH("LEFT")
txtSize.Lable:SetPoint("LEFT", txtSize, 190, 0)
txtSize.Lable:SetText("Menu Text Size")
local function options_Menu_Initialize()
local info
for i = 10, 25 do
info = {
text = i;
func = function()
PM.db.txtSize = i
local thisID = this:GetID();
UIDropDownMenu_SetSelectedID(ProfessionMenuOptions_TxtSizeMenu, thisID)
end;
};
UIDropDownMenu_AddButton(info);
end
end
function PM:DropDownInitialize()
--Setup for Dropdown menus in the settings
UIDropDownMenu_Initialize(ProfessionMenuOptions_TxtSizeMenu, options_Menu_Initialize)
UIDropDownMenu_SetSelectedID(ProfessionMenuOptions_TxtSizeMenu)
UIDropDownMenu_SetWidth(ProfessionMenuOptions_TxtSizeMenu, 150)
end