From 60d6e5ee3e54fbb16aec776caabb2e5f2114f005 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Mon, 1 Oct 2018 10:08:18 -0400 Subject: [PATCH] working on config stil --- XanChat.lua | 18 ++++++++++-------- config.lua | 39 ++++++++++++++++++++++++++++++++++----- locale/enUS.lua | 21 +++++++-------------- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/XanChat.lua b/XanChat.lua index 0e0cc6b..2c9b649 100644 --- a/XanChat.lua +++ b/XanChat.lua @@ -2,7 +2,7 @@ --Sharing it with the world in case anybody wants to actually use this. local ADDON_NAME, addon = ... -if not _G[ADDON_NAME] then _G[ADDON_NAME] = addon +if not _G[ADDON_NAME] then _G[ADDON_NAME] = addon end addon.eventFrame = CreateFrame("frame","xanChatEvent_Frame",UIParent) local eFrame = addon.eventFrame @@ -812,13 +812,15 @@ function eFrame:PLAYER_LOGIN() end DEFAULT_CHAT_FRAME:AddMessage("xanChat") - DEFAULT_CHAT_FRAME:AddMessage(L.SlashSocialInfo) - DEFAULT_CHAT_FRAME:AddMessage(L.SlashScrollInfo) - DEFAULT_CHAT_FRAME:AddMessage(L.SlashShortNamesInfo) - DEFAULT_CHAT_FRAME:AddMessage(L.SlashEditBoxInfo) - DEFAULT_CHAT_FRAME:AddMessage(L.SlashTabsInfo) - DEFAULT_CHAT_FRAME:AddMessage(L.SlashShadowInfo) - DEFAULT_CHAT_FRAME:AddMessage(L.SlashVoiceInfo) + + local preText = "/xanchat " + DEFAULT_CHAT_FRAME:AddMessage(preText..L.SlashSocial.." - "..L.SlashSocialInfo) + DEFAULT_CHAT_FRAME:AddMessage(preText..L.SlashScroll.." - "..L.SlashScrollInfo) + DEFAULT_CHAT_FRAME:AddMessage(preText..L.SlashShortNames.." - "..L.SlashShortNamesInfo) + DEFAULT_CHAT_FRAME:AddMessage(preText..L.SlashEditBox.." - "..L.SlashEditBoxInfo) + DEFAULT_CHAT_FRAME:AddMessage(preText..L.SlashTabs.." - "..L.SlashTabsInfo) + DEFAULT_CHAT_FRAME:AddMessage(preText..L.SlashShadow.." - "..L.SlashShadowInfo) + DEFAULT_CHAT_FRAME:AddMessage(preText..L.SlashVoice.." - "..L.SlashVoiceInfo) end local ver = GetAddOnMetadata("xanChat","Version") or '1.0' diff --git a/config.lua b/config.lua index 7f4c246..ec16104 100644 --- a/config.lua +++ b/config.lua @@ -1,18 +1,32 @@ local ADDON_NAME, addon = ... -if not _G[ADDON_NAME] then _G[ADDON_NAME] = addon +if not _G[ADDON_NAME] then _G[ADDON_NAME] = addon end local chkBoxIndex = 1 -function createCheckbutton(parentFrame, xPos, yPos, displayText) +function createCheckbutton(parentFrame, displayText) chkBoxIndex = chkBoxIndex + 1 local checkbutton = CreateFrame("CheckButton", ADDON_NAME.."_config_chkbtn_" .. chkBoxIndex, parentFrame, "ChatConfigCheckButtonTemplate") - checkbutton:SetPoint("TOPLEFT", xPos, yPos) - getglobal(checkbutton:GetName() .. 'Text'):SetText(displayText) + getglobal(checkbutton:GetName() .. 'Text'):SetText(" "..displayText) return checkbutton end +local yModifer = 30 +local startY = -150 +local currY = 0 + +local function addConfigEntry(objEntry) + + if currY == 0 then + currY = startY + else + currY = currY - yModifer + end + + objEntry:SetPoint("TOPLEFT", 20, currY) +end + local function LoadAboutFrame() --Code inspired from tekKonfigAboutPanel @@ -63,4 +77,19 @@ local function LoadAboutFrame() return about end -addon.aboutPanel = LoadAboutFrame() \ No newline at end of file +addon.aboutPanel = LoadAboutFrame() + +myCheckButton = createCheckbutton(addon.aboutPanel, "A Checkbox") +myCheckButton:SetScript("OnClick", function() + print('click') +end) +addConfigEntry(myCheckButton) + +myCheckButton2 = createCheckbutton(addon.aboutPanel, "A Checkbox") +myCheckButton2:SetScript("OnClick", function() + print('click') +end) +addConfigEntry(myCheckButton2) + + + diff --git a/locale/enUS.lua b/locale/enUS.lua index 2b95594..13cc0df 100644 --- a/locale/enUS.lua +++ b/locale/enUS.lua @@ -53,41 +53,34 @@ L.CHAT_RAID_WARNING_GET = [[|Hchannel:RaidWarning|h[RW|TInterface\GroupFrame\ L.SlashSocial = "social" L.SlashSocialOn = "xanChat: Social buttons are now [|cFF99CC33ON|r]" L.SlashSocialOff = "xanChat: Social buttons are now [|cFF99CC33OFF|r]" -L.SlashSocialInfoShort = "Toggles the chat social buttons" -L.SlashSocialInfo = "/xanchat "..L.SlashSocial.." - "..L.SlashSocialInfoShort +L.SlashSocialInfo = "Toggles the chat social buttons" L.SlashScroll = "scroll" L.SlashScrollOn = "xanChat: Scroll buttons are now [|cFF99CC33ON|r]" L.SlashScrollOff = "xanChat: Scroll buttons are now [|cFF99CC33OFF|r]" -L.SlashScrollInfoShort = "Toggles the chat scroll bars" -L.SlashScrollInfo = "/xanchat "..L.SlashScroll.." - "..L.SlashScrollInfoShort +L.SlashScrollInfo = "Toggles the chat scroll bars" L.SlashShortNames = "shortnames" L.SlashShortNamesOn = "xanChat: Short channel names are now [|cFF99CC33ON|r]" L.SlashShortNamesOff = "xanChat: Short channel names are now [|cFF99CC33OFF|r]" -L.SlashShortNamesInfoShort = "Toggles short channels names" -L.SlashShortNamesInfo = "/xanchat "..L.SlashShortNames.." - "..L.SlashShortNamesInfoShort +L.SlashShortNamesInfo = "Toggles short channels names" L.SlashEditBox = "editbox" L.SlashEditBoxBottom = "xanChat: The edit box is now at the [|cFF99CC33BOTTOM|r]" L.SlashEditBoxTop = "xanChat: The edit box is now at the [|cFF99CC33TOP|r]" -L.SlashEditBoxInfoShort = "Toggles editbox to show at the top or the bottom" -L.SlashEditBoxInfo = "/xanchat "..L.SlashEditBox.." - "..L.SlashEditBoxInfoShort +L.SlashEditBoxInfo = "Toggles editbox to show at the top or the bottom" L.SlashTabs = "tabs" L.SlashTabsOn = "xanChat: The chat tabs are now [|cFF99CC33ON|r]" L.SlashTabsOff = "xanChat: The chat tabs are now [|cFF99CC33OFF|r]" -L.SlashTabsInfoShort = "Toggles the chat tabs on or off" -L.SlashTabsInfo = "/xanchat "..L.SlashTabs.." - "..L.SlashTabsInfoShort +L.SlashTabsInfo = "Toggles the chat tabs on or off" L.SlashShadow = "shadow" L.SlashShadowOn = "xanChat: Chat font shadows are now [|cFF99CC33ON|r]" L.SlashShadowOff = "xanChat: Chat font shadows are now [|cFF99CC33OFF|r]" -L.SlashShadowInfoShort = "Toggles text shadows for chat fonts on or off" -L.SlashShadowInfo = "/xanchat "..L.SlashShadow.." - "..L.SlashShadowInfoShort +L.SlashShadowInfo= "Toggles text shadows for chat fonts on or off" L.SlashVoice = "voice" L.SlashVoiceOn = "xanChat: Voice chat buttons are now [|cFF99CC33ON|r]" L.SlashVoiceOff = "xanChat: Voice chat buttons are now [|cFF99CC33OFF|r]" -L.SlashVoiceInfoShort = "Toggles voice chat buttons on or off" -L.SlashVoiceInfo = "/xanchat "..L.SlashVoice.." - "..L.SlashVoiceInfoShort +L.SlashVoiceInfo = "Toggles voice chat buttons on or off" -- 1.7.9.5