- 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 icon = LibStub('LibDBIcon-1.0')
local CYAN = "|cff00ffff" local CYAN = "|cff00ffff"
local WHITE = "|cffFFFFFF" local WHITE = "|cffFFFFFF"
local
PROFESSIONMENU_MINIMAP = LibStub:GetLibrary('LibDataBroker-1.1'):NewDataObject(addonName, { PROFESSIONMENU_MINIMAP = LibStub:GetLibrary('LibDataBroker-1.1'):NewDataObject(addonName, {
type = 'data source', type = 'data source',
text = "ProfessionMenu", text = "ProfessionMenu",
@@ -22,6 +22,7 @@ local DefaultSettings = {
{ TableName = "HideMenu", false, Frame = "ProfessionMenuFrame", CheckBox = "ProfessionMenuOptions_HideMenu"}, { TableName = "HideMenu", false, Frame = "ProfessionMenuFrame", CheckBox = "ProfessionMenuOptions_HideMenu"},
{ TableName = "DeleteItem", false, CheckBox = "ProfessionMenuOptions_DeleteMenu"}, { TableName = "DeleteItem", false, CheckBox = "ProfessionMenuOptions_DeleteMenu"},
{ TableName = "minimap", false, CheckBox = "ProfessionMenuOptions_HideMinimap"}, { TableName = "minimap", false, CheckBox = "ProfessionMenuOptions_HideMinimap"},
{ TableName = "txtSize", 12 }
} }
--[[ TableName = Name of the saved setting --[[ TableName = Name of the saved setting
@@ -195,8 +196,8 @@ function PM:AddItem(itemID)
'icon', icon, 'icon', icon,
'secure', secure, '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, '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, 'textHeight', PM.db.txtSize,
'textWidth', 12 'textWidth', PM.db.txtSize
) )
end end
@@ -205,8 +206,8 @@ function PM:AddDividerLine(maxLenght)
local text = WHITE.."----------------------------------------------------------------------------------------------------" local text = WHITE.."----------------------------------------------------------------------------------------------------"
dewdrop:AddLine( dewdrop:AddLine(
'text' , text:sub(1, maxLenght), 'text' , text:sub(1, maxLenght),
'textHeight', 12, 'textHeight', PM.db.txtSize,
'textWidth', 12, 'textWidth', PM.db.txtSize,
'isTitle', true, 'isTitle', true,
"notCheckable", true "notCheckable", true
) )
@@ -221,8 +222,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
'children', function(level, value) 'children', function(level, value)
dewdrop:AddLine( dewdrop:AddLine(
'text', "|cffffff00Professions", 'text', "|cffffff00Professions",
'textHeight', 12, 'textHeight', PM.db.txtSize,
'textWidth', 12, 'textWidth', PM.db.txtSize,
'isTitle', true, 'isTitle', true,
'notCheckable', true 'notCheckable', true
) )
@@ -239,8 +240,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
'icon', icon, 'icon', icon,
'secure', secure, 'secure', secure,
'closeWhenClicked', true, 'closeWhenClicked', true,
'textHeight', 12, 'textHeight', PM.db.txtSize,
'textWidth', 12 'textWidth', PM.db.txtSize
) )
end end
end end
@@ -252,26 +253,29 @@ local function ProfessionMenu_DewdropRegister(self, frame)
end end
if CA_IsSpellKnown(750750) then if CA_IsSpellKnown(750750) then
local name, _, icon = GetSpellInfo(750750) local name, _, icon = GetSpellInfo(750750)
local secure = { local secure = { type1 = 'spell', spell = name }
type1 = 'spell', dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize)
spell = name
}
dewdrop:AddLine(
'text', name,
'icon', icon,
'secure', secure,
'closeWhenClicked', true,
'textHeight', 12,
'textWidth', 12
)
end end
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) PM:AddDividerLine(35)
if frame == "ProfessionMenuFrame_Menu" then if frame == "ProfessionMenuFrame_Menu" then
dewdrop:AddLine( dewdrop:AddLine(
'text', "Unlock Frame", 'text', "Unlock Frame",
'textHeight', 12, 'textHeight', PM.db.txtSize,
'textWidth', 12, 'textWidth', PM.db.txtSize,
'func', PM.UnlockFrame, 'func', PM.UnlockFrame,
'notCheckable', true, 'notCheckable', true,
'closeWhenClicked', true 'closeWhenClicked', true
@@ -279,8 +283,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
end end
dewdrop:AddLine( dewdrop:AddLine(
'text', "Options", 'text', "Options",
'textHeight', 12, 'textHeight', PM.db.txtSize,
'textWidth', 12, 'textWidth', PM.db.txtSize,
'func', PM.Options_Toggle, 'func', PM.Options_Toggle,
'notCheckable', true, 'notCheckable', true,
'closeWhenClicked', true 'closeWhenClicked', true
@@ -290,8 +294,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
'textR', 0, 'textR', 0,
'textG', 1, 'textG', 1,
'textB', 1, 'textB', 1,
'textHeight', 12, 'textHeight', PM.db.txtSize,
'textWidth', 12, 'textWidth', PM.db.txtSize,
'closeWhenClicked', true, 'closeWhenClicked', true,
'notCheckable', true 'notCheckable', true
) )
@@ -469,11 +473,9 @@ end
function minimap.OnClick(self, button) function minimap.OnClick(self, button)
GameTooltip:Hide() GameTooltip:Hide()
if button == "LeftButton" then if dewdrop:IsOpen() then dewdrop:Close() return end
if dewdrop:IsOpen() then dewdrop:Close() return end ProfessionMenu_DewdropRegister(self)
ProfessionMenu_DewdropRegister(self) dewdrop:Open(self)
dewdrop:Open(self)
end
end end
function minimap.OnLeave() function minimap.OnLeave()
+1 -1
View File
@@ -7,6 +7,6 @@
## X-Category: Profession ## X-Category: Profession
## X-OptionsFrame: ProfessionMenuOptionsFrame ## X-OptionsFrame: ProfessionMenuOptionsFrame
## DefaultState: enabled ## DefaultState: enabled
## Version: 0.2 ## Version: 0.3
embeds.xml embeds.xml
+32 -2
View File
@@ -10,6 +10,8 @@ end
function PM:OpenOptions() function PM:OpenOptions()
if InterfaceOptionsFrame:GetWidth() < 850 then InterfaceOptionsFrame:SetWidth(850) end if InterfaceOptionsFrame:GetWidth() < 850 then InterfaceOptionsFrame:SetWidth(850) end
PM:DropDownInitialize()
UIDropDownMenu_SetText(ProfessionMenuOptions_TxtSizeMenu, PM.db.txtSize)
end end
--Creates the options frame and all its assets --Creates the options frame and all its assets
@@ -27,7 +29,7 @@ end
hideMenu.Lable = hideMenu:CreateFontString(nil , "BORDER", "GameFontNormal") hideMenu.Lable = hideMenu:CreateFontString(nil , "BORDER", "GameFontNormal")
hideMenu.Lable:SetJustifyH("LEFT") hideMenu.Lable:SetJustifyH("LEFT")
hideMenu.Lable:SetPoint("LEFT", 30, 0) hideMenu.Lable:SetPoint("LEFT", 30, 0)
hideMenu.Lable:SetText("Hide Main Menu") hideMenu.Lable:SetText("Hide Standalone Button")
hideMenu:SetScript("OnClick", function() hideMenu:SetScript("OnClick", function()
if PM.db.HideMenu then if PM.db.HideMenu then
ProfessionMenuFrame:Show() ProfessionMenuFrame:Show()
@@ -68,10 +70,38 @@ end
hideMinimap:SetScript("OnClick", function() PM:ToggleMinimap() end) hideMinimap:SetScript("OnClick", function() PM:ToggleMinimap() end)
local itemDel = CreateFrame("CheckButton", "ProfessionMenuOptions_DeleteMenu", ProfessionMenuOptionsFrame, "UICheckButtonTemplate") 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 = itemDel:CreateFontString(nil , "BORDER", "GameFontNormal")
itemDel.Lable:SetJustifyH("LEFT") itemDel.Lable:SetJustifyH("LEFT")
itemDel.Lable:SetPoint("LEFT", 30, 0) itemDel.Lable:SetPoint("LEFT", 30, 0)
itemDel.Lable:SetText("Delete anvil after summoning") itemDel.Lable:SetText("Delete anvil after summoning")
itemDel:SetScript("OnClick", function() PM.db.DeleteItem = not PM.db.DeleteItem end) 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