From f9897534c2debf2633b7ef91700cab4daf93968d Mon Sep 17 00:00:00 2001 From: Vysci <84870873+Vysci@users.noreply.github.com> Date: Tue, 14 Sep 2021 13:25:42 -0700 Subject: [PATCH] Added Working Version of Font Size Ability to toggle whole 3 options for font size. Fixed the issue that made it not work for everyone but me --- LFGBulletinBoard/Chat.lua | 2 + LFGBulletinBoard/GroupBulletinBoard.lua | 7 +++- LFGBulletinBoard/GroupList.lua | 2 +- LFGBulletinBoard/LFGBulletinBoard.toc | 4 +- LFGBulletinBoard/LibGPIOptions.lua | 55 +++++++++++++++++++++++++ LFGBulletinBoard/Localization.lua | 1 + LFGBulletinBoard/Options.lua | 4 ++ LFGBulletinBoard/RequestList.lua | 8 +++- LFGBulletinBoard/changelog.txt | 8 ++++ 9 files changed, 84 insertions(+), 7 deletions(-) diff --git a/LFGBulletinBoard/Chat.lua b/LFGBulletinBoard/Chat.lua index d6c8b79..9071ac4 100644 --- a/LFGBulletinBoard/Chat.lua +++ b/LFGBulletinBoard/Chat.lua @@ -108,6 +108,8 @@ function GBB.SendMessage(ChannelName, Msg) end function GBB.AnnounceInit() + GroupBulletinBoardFrameSelectChannel:SetNormalFontObject(GBB.DB.FontSize) + GroupBulletinBoardFrameAnnounce:SetNormalFontObject(GBB.DB.FontSize) GroupBulletinBoardFrameAnnounceMsg:SetTextColor(0.6,0.6,0.6) GroupBulletinBoardFrameAnnounceMsg:SetText(GBB.L["msgRequestHere"]) GroupBulletinBoardFrameAnnounce:SetText(GBB.L["BtnPostMsg"]) diff --git a/LFGBulletinBoard/GroupBulletinBoard.lua b/LFGBulletinBoard/GroupBulletinBoard.lua index 1ed34c0..af6c8bc 100644 --- a/LFGBulletinBoard/GroupBulletinBoard.lua +++ b/LFGBulletinBoard/GroupBulletinBoard.lua @@ -400,6 +400,8 @@ function GBB.Init() if not GBB.DB.Custom then GBB.DB.Custom={} end if not GBB.DB.CustomLocales then GBB.DB.CustomLocales={} end if not GBB.DB.CustomLocalesDungeon then GBB.DB.CustomLocalesDungeon={} end + if not GBB.DB.FontSize then GBB.DB.FontSize = GameFontNormal end + if not GBB.DB.DisplayLFG then GBB.DB.DisplayLFG = false end GBB.DB.Server=nil -- old settings if GBB.DB.OnDebug == nil then GBB.DB.OnDebug=false end @@ -498,7 +500,7 @@ function GBB.Init() }, }, }) - + -- Create options and initalize! GBB.OptionsInit() @@ -517,6 +519,7 @@ function GBB.Init() ) GBB.FramePullDownChannel=CreateFrame("Frame", "GBB.PullDownMenu", UIParent, "UIDropDownMenuTemplate") + GroupBulletinBoardFrameTitle:SetFontObject(GBB.DB.FontSize) if GBB.DB.AnnounceChannel == nil then if GBB.L["lfg_channel"] ~= "" then GBB.DB.AnnounceChannel = GBB.L["lfg_channel"] @@ -524,6 +527,7 @@ function GBB.Init() _, GBB.DB.AnnounceChannel = GetChannelList() end end + GroupBulletinBoardFrameSelectChannel:SetText(GBB.DB.AnnounceChannel) GBB.ResizeFrameList() @@ -553,7 +557,6 @@ function GBB.Init() GBB.PopupDynamic=GBB.Tool.CreatePopup(GBB.OptionsUpdate) GBB.InitGroupList() - GBB.Tool.AddTab(GroupBulletinBoardFrame,GBB.L.TabRequest,GroupBulletinBoardFrame_ScrollFrame) GBB.Tool.AddTab(GroupBulletinBoardFrame,GBB.L.TabGroup,GroupBulletinBoardFrame_GroupFrame) GBB.Tool.SelectTab(GroupBulletinBoardFrame,1) diff --git a/LFGBulletinBoard/GroupList.lua b/LFGBulletinBoard/GroupList.lua index 75a2e66..78df51d 100644 --- a/LFGBulletinBoard/GroupList.lua +++ b/LFGBulletinBoard/GroupList.lua @@ -215,7 +215,7 @@ function GBB.InitGroupList() GroupBulletinBoardFrame_GroupFrame:SetFading(false); - GroupBulletinBoardFrame_GroupFrame:SetFontObject(GameFontNormal); + GroupBulletinBoardFrame_GroupFrame:SetFontObject(GBB.DB.FontSize); GroupBulletinBoardFrame_GroupFrame:SetJustifyH("LEFT"); GroupBulletinBoardFrame_GroupFrame:SetHyperlinksEnabled(true); GroupBulletinBoardFrame_GroupFrame:SetScript("OnHyperlinkClick",ClickHyperlink) diff --git a/LFGBulletinBoard/LFGBulletinBoard.toc b/LFGBulletinBoard/LFGBulletinBoard.toc index c9837d9..02accf1 100644 --- a/LFGBulletinBoard/LFGBulletinBoard.toc +++ b/LFGBulletinBoard/LFGBulletinBoard.toc @@ -1,7 +1,7 @@ ## Interface: 20502 ## Title: LFG Bulletin Board ## Notes: Sort LFG/LFM Messages -## Version: 2.59 +## Version: 2.61 ## Author: Vyscî-Whitemane ## DefaultState: enabled ## SavedVariables: GroupBulletinBoardDB @@ -17,4 +17,4 @@ RequestList.lua Options.lua GroupList.Lua GroupBulletinBoard.lua -GroupBulletinBoard.xml +GroupBulletinBoard.xml \ No newline at end of file diff --git a/LFGBulletinBoard/LibGPIOptions.lua b/LFGBulletinBoard/LibGPIOptions.lua index 6e32af4..5df0e56 100644 --- a/LFGBulletinBoard/LibGPIOptions.lua +++ b/LFGBulletinBoard/LibGPIOptions.lua @@ -397,6 +397,61 @@ function Options.AddColorButton(DB,Var,Init,Text,width) return but end +function Options.AddDrop(DB,Var,Init,MenuItems) + local c=Options.Frames.count+1 + Options.Frames.count=c + local ButtonName=Options.Prefix .."BUTTON_"..c + Options.Vars[ButtonName]=Var + Options.Vars[ButtonName.."_init"]=Init + Options.Vars[ButtonName.."_db"]=DB + + if DB~=nil and Var~=nil then + if DB[Var] == nil then DB[Var]=Init end + end + + Options.Btn[ButtonName] = CreateFrame("Frame", ButtonName , Options.CurrentPanel, "UIDropDownMenuTemplate") + if Options.inLine~=true or Options.LineRelativ ==nil then + Options.Btn[ButtonName]:SetPoint("TOPLEFT", Options.NextRelativ,"BOTTOMLEFT", Options.NextRelativX, Options.NextRelativY) + Options.NextRelativ=ButtonName + Options.LineRelativ=ButtonName + Options.NextRelativX=0 + Options.NextRelativY=0 + else + Options.Btn[ButtonName]:SetPoint("TOP", Options.LineRelativ,"TOP", 0, 0) + Options.Btn[ButtonName]:SetPoint("LEFT", Options.LineRelativ.."Text","RIGHT", 0, 0) + Options.LineRelativ=ButtonName + end + + local dropdown_width = 0 + local dd_title = Options.Btn[ButtonName]:CreateFontString(Options.Btn[ButtonName], 'OVERLAY', 'GameFontNormal') + for _, item in pairs(MenuItems) do -- Sets the dropdown width to the largest item string width. + dd_title:SetText(item) + local text_width = dd_title:GetStringWidth() + 20 + if text_width > dropdown_width then + dropdown_width = text_width + end + end + UIDropDownMenu_SetWidth(Options.Btn[ButtonName], dropdown_width) + UIDropDownMenu_SetText(Options.Btn[ButtonName], DB[Var]) + + -- Create and bind the initialization function to the dropdown menu + UIDropDownMenu_Initialize(Options.Btn[ButtonName], function(self, level, menuList) + local info = UIDropDownMenu_CreateInfo() + for k, v in pairs(MenuItems) do + info.text = v + info.func = function(b) + UIDropDownMenu_SetText(Options.Btn[ButtonName], b.value) + DB[Var] = b.value + Init = b.value + end + UIDropDownMenu_AddButton(info) + end + end) + +end + + + function Options.EditCheckBox(toEdit,DB,Var,Init,Text,width) diff --git a/LFGBulletinBoard/Localization.lua b/LFGBulletinBoard/Localization.lua index e00cfe4..5465b34 100644 --- a/LFGBulletinBoard/Localization.lua +++ b/LFGBulletinBoard/Localization.lua @@ -23,6 +23,7 @@ GBB.locales = { ["heroicAbr"]="H", ["normalAbr"]="N", ["raidAbr"]="R", + ["msgFontSize"] = "Font Size (Requires /reload)", -- option panel diff --git a/LFGBulletinBoard/Options.lua b/LFGBulletinBoard/Options.lua index 107e3c1..4676dbc 100644 --- a/LFGBulletinBoard/Options.lua +++ b/LFGBulletinBoard/Options.lua @@ -158,6 +158,10 @@ function GBB.OptionsInit () GBB.Options.AddSpace() CheckBox("ShowTotalTime",false) CheckBox("OrderNewTop",true) + GBB.Options.AddSpace() + GBB.Options.AddText(GBB.L["msgFontSize"],-20) + GBB.Options.AddDrop(GBB.DB,"FontSize", "GameFontNormal", {"GameFontNormalSmall", "GameFontNormal", "GameFontNormalLarge"}) + CheckBox("CombineSubDungeons",false) GBB.Options.AddSpace() CheckBox("NotifySound",false) diff --git a/LFGBulletinBoard/RequestList.lua b/LFGBulletinBoard/RequestList.lua index 2344eba..e04b0db 100644 --- a/LFGBulletinBoard/RequestList.lua +++ b/LFGBulletinBoard/RequestList.lua @@ -73,9 +73,9 @@ local function CreateHeader(yy,dungeon) GBB.FramesEntries[dungeon]:SetPoint("RIGHT", _G[AnchorRight], "RIGHT", 0, 0) _G[ItemFrameName.."_name"]:SetPoint("RIGHT",GBB.FramesEntries[dungeon], "RIGHT", 0,0) local fname,h=_G[ItemFrameName.."_name"]:GetFont() - _G[ItemFrameName.."_name"]:SetHeight(h) _G[ItemFrameName]:SetHeight(h+5) + _G[ItemFrameName.."_name"]:SetFontObject(GBB.DB.FontSize) end @@ -106,7 +106,7 @@ local function CreateHeader(yy,dungeon) end _G[ItemFrameName.."_name"]:SetText(colTXT..GBB.dungeonNames[dungeon].." |cFFAAAAAA"..GBB.LevelRange(dungeon).."|r") - + _G[ItemFrameName.."_name"]:SetFontObject(GBB.DB.FontSize) GBB.FramesEntries[dungeon]:SetPoint("TOPLEFT",_G[AnchorTop], "TOPLEFT", 0,-yy) GBB.FramesEntries[dungeon]:Show() @@ -123,10 +123,14 @@ local function CreateItem(yy,i,doCompact,req,forceHight) if GBB.FramesEntries[i]==nil then GBB.FramesEntries[i]=CreateFrame("Frame",ItemFrameName , GroupBulletinBoardFrame_ScrollChildFrame, "GroupBulletinBoard_TmpRequest") GBB.FramesEntries[i]:SetPoint("RIGHT", _G[AnchorRight], "RIGHT", 0, 0) + _G[ItemFrameName.."_name"]:SetPoint("TOPLEFT") _G[ItemFrameName.."_time"]:SetPoint("TOP",_G[ItemFrameName.."_name"], "TOP",0,0) _G[ItemFrameName.."_message"]:SetNonSpaceWrap(false) + _G[ItemFrameName.."_message"]:SetFontObject(GBB.DB.FontSize) + _G[ItemFrameName.."_name"]:SetFontObject(GBB.DB.FontSize) + _G[ItemFrameName.."_time"]:SetFontObject(GBB.DB.FontSize) if GBB.DontTrunicate then GBB.ClearNeeded=true end diff --git a/LFGBulletinBoard/changelog.txt b/LFGBulletinBoard/changelog.txt index ab21cc9..631fce1 100644 --- a/LFGBulletinBoard/changelog.txt +++ b/LFGBulletinBoard/changelog.txt @@ -2,6 +2,14 @@ Group Bulletin Board +2.61 +- Added option to adjust font size. 3 whole options, don't ask for more +- Fixed the thing that made the addon not working for everyone except me +- LFG bar defaulted to being off (its ugly af) + +2.60 + - I cant remember what happened here. I was drunk + 2.59 - Fixed interference with other addons - Make LFG bar optional (configured in setting)