Quantcast

- Bag : Locale cleanup

urnati [01-20-24 - 03:31]
- Bag : Locale cleanup
- Clock : Code cleanup
- Volume : Locale cleanup
Filename
TitanBag/TitanBag.lua
TitanClock/TitanClock.lua
TitanVolume/TitanVolume.lua
diff --git a/TitanBag/TitanBag.lua b/TitanBag/TitanBag.lua
index a3e9d64..67e8b4f 100644
--- a/TitanBag/TitanBag.lua
+++ b/TitanBag/TitanBag.lua
@@ -289,13 +289,7 @@ function TitanPanelBagButton_OnEvent(self, event, a1, a2, ...)
 		if a1 == true and TITAN_ID == "Titan" then -- 10.* / Retail
 			-- initial login

-			TitanPrint(""
-			.." "..tostring("Feature :")..""
-			.." "..tostring(OPENING or "Opening of")..""
-			.." "..tostring(INVTYPE_BAG or "Bags")..""
-			.." "..tostring(ADDON_DISABLED or "Disabled")..""
-			.." "..tostring("Until taint is fixed or work around found.")..""
-			, "warning")
+			TitanPrint(L["TITAN_BAG_TAINT_TEXT"], "warning")
 		else -- either Classic version
 			local open = TitanGetVar(TITAN_BAG_ID, "OpenBagsClassic")
 			if open == "new_install" then --
@@ -461,9 +455,7 @@ function TitanPanelRightClickMenu_PrepareBagMenu()
 			TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

 			info = {};
-			info.text = (LEFT_BUTTON_STRING or "Left Click")
-				.." "..(OPENING or "to Open")
-				.." "..(INVTYPE_BAG or "Bags")
+			info.text =  L["TITAN_BAG_MENU_OPEN_BAGS"]
 			info.func = function()
 				TitanToggleVar(TITAN_BAG_ID, "OpenBags")
 				end
diff --git a/TitanClock/TitanClock.lua b/TitanClock/TitanClock.lua
index 863cf11..262a66e 100644
--- a/TitanClock/TitanClock.lua
+++ b/TitanClock/TitanClock.lua
@@ -15,8 +15,8 @@ local TITAN_CLOCK_FORMAT_24H = "24H";
 local TITAN_CLOCK_FRAME_SHOW_TIME = 0.5;
 local _G = getfenv(0);
 -- ******************************** Variables *******************************
-local L = {} -- For AceLocale
-local AceTimer = {}
+local AceTimer = LibStub("AceTimer-3.0")
+local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)
 local ClockTimer = nil;
 local updateTable = {TITAN_CLOCK_ID, TITAN_PANEL_UPDATE_ALL };
 local realmName = GetRealmName();
@@ -95,7 +95,6 @@ function TitanPanelClockButton_OnHide()
 	ClockTimer = nil;
 end

-
 function TitanPanelClockButton_OnEvent(self, event, ...)
 	if (event == "PLAYER_ENTERING_WORLD") then
 		-- If the user wants the minimap clock or calendar hidden then hide them
@@ -112,7 +111,6 @@ function TitanPanelClockButton_OnEvent(self, event, ...)
 	end
 end

-
 function TitanPanelClockButton_OnClick(self, button)
 	if button == "LeftButton" and IsShiftKeyDown() then
 		TitanUtils_CloseAllControlFrames();
@@ -172,7 +170,6 @@ function TitanPanelClockButton_GetButtonText()
 	return labeltext, clocktime, labeltext2, clocktime2
 end

-
 function TitanPanelClockButton_GetTime(displaytype, offset)
 	-- Calculate the hour/minutes considering the offset
 	local hour, minute = GetGameTime();
@@ -610,9 +607,4 @@ local function Create_Frames()
 --]===]
 end

-
-if TITAN_ID then -- it exists
-	AceTimer = LibStub("AceTimer-3.0")
-	L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)
-	Create_Frames() -- do the work
-end
+Create_Frames() -- do the work
diff --git a/TitanVolume/TitanVolume.lua b/TitanVolume/TitanVolume.lua
index 47126e1..567de1b 100644
--- a/TitanVolume/TitanVolume.lua
+++ b/TitanVolume/TitanVolume.lua
@@ -12,7 +12,7 @@ local TITAN_VOLUME_BUTTON = "TitanPanel"..TITAN_VOLUME_ID.."Button"
 local TITAN_VOLUME_FRAME_SHOW_TIME = 0.5;
 local TITAN_VOLUME_ARTWORK_PATH = "Interface\\AddOns\\TitanVolume\\Artwork\\";
 local _G = getfenv(0);
-local L = {} -- For AceLocale
+local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)

 function TitanPanelVolumeButton_OnLoad(self)
 	local notes = ""
@@ -80,7 +80,8 @@ end

 -- 'Master'
 function TitanPanelMasterVolumeControlSlider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MASTER_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_MasterVolume")));
+--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MASTER_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_MasterVolume")));
+	self.tooltipText = ""
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
 	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
 	TitanUtils_StopFrameCounting(self:GetParent());
@@ -94,8 +95,8 @@ end

 function TitanPanelMasterVolumeControlSlider_OnShow(self)
 	_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(GetCVar("Sound_MasterVolume")));
-	_G[self:GetName().."High"]:SetText(LOW);
-	_G[self:GetName().."Low"]:SetText(HIGH);
+	_G[self:GetName().."High"]:SetText(Titan.literals.low);
+	_G[self:GetName().."Low"]:SetText(Titan.literals.high);
 	self:SetMinMaxValues(0, 1);
 	self:SetValueStep(0.01);
 	self:SetObeyStepOnDrag(true) -- since 5.4.2 (Mists of Pandaria)
@@ -132,7 +133,8 @@ end

 -- 'Music'
 function TitanPanelMusicVolumeControlSlider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MUSIC_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_MusicVolume")));
+--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_MUSIC_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_MusicVolume")));
+	self.tooltipText = ""
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
 	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
 	TitanUtils_StopFrameCounting(self:GetParent());
@@ -146,8 +148,8 @@ end

 function TitanPanelMusicVolumeControlSlider_OnShow(self)
 	_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(GetCVar("Sound_MusicVolume")));
-	_G[self:GetName().."High"]:SetText(LOW);
-	_G[self:GetName().."Low"]:SetText(HIGH);
+	_G[self:GetName().."High"]:SetText(Titan.literals.low);
+	_G[self:GetName().."Low"]:SetText(Titan.literals.high);
 	self:SetMinMaxValues(0, 1);
 	self:SetValueStep(0.01);
 	self:SetValue(1 - GetCVar("Sound_MusicVolume"));
@@ -168,7 +170,8 @@ end

 -- 'Sound Effects'
 function TitanPanelSoundVolumeControlSlider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_FX_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_SFXVolume")));
+--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_FX_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_SFXVolume")));
+	self.tooltipText = ""
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
 	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
 	TitanUtils_StopFrameCounting(self:GetParent());
@@ -182,8 +185,8 @@ end

 function TitanPanelSoundVolumeControlSlider_OnShow(self)
 	_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(GetCVar("Sound_SFXVolume")));
-	_G[self:GetName().."High"]:SetText(LOW);
-	_G[self:GetName().."Low"]:SetText(HIGH);
+	_G[self:GetName().."High"]:SetText(Titan.literals.low);
+	_G[self:GetName().."Low"]:SetText(Titan.literals.high);
 	self:SetMinMaxValues(0, 1);
 	self:SetValueStep(0.01);
 	self:SetValue(1 - GetCVar("Sound_SFXVolume"));
@@ -204,7 +207,8 @@ end

 -- 'Ambience'
 function TitanPanelAmbienceVolumeControlSlider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_AMBIENCE_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_AmbienceVolume")));
+--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_AMBIENCE_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_AmbienceVolume")));
+	self.tooltipText = ""
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
 	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
 	TitanUtils_StopFrameCounting(self:GetParent());
@@ -218,8 +222,8 @@ end

 function TitanPanelAmbienceVolumeControlSlider_OnShow(self)
 	_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(GetCVar("Sound_AmbienceVolume")));
-	_G[self:GetName().."High"]:SetText(LOW);
-	_G[self:GetName().."Low"]:SetText(HIGH);
+	_G[self:GetName().."High"]:SetText(Titan.literals.low);
+	_G[self:GetName().."Low"]:SetText(Titan.literals.high);
 	self:SetMinMaxValues(0, 1);
 	self:SetValueStep(0.01);
 	self:SetValue(1 - GetCVar("Sound_AmbienceVolume"));
@@ -242,7 +246,8 @@ end

 -- 'Dialog'
 function TitanPanelDialogVolumeControlSlider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_DIALOG_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_DialogVolume")));
+--	self.tooltipText = TitanOptionSlider_TooltipText(OPTION_TOOLTIP_DIALOG_VOLUME, TitanPanelVolume_GetVolumeText(GetCVar("Sound_DialogVolume")));
+	self.tooltipText = ""
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
 	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
 	TitanUtils_StopFrameCounting(self:GetParent());
@@ -256,8 +261,8 @@ end

 function TitanPanelDialogVolumeControlSlider_OnShow(self)
 	_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(GetCVar("Sound_DialogVolume")));
-	_G[self:GetName().."High"]:SetText(LOW);
-	_G[self:GetName().."Low"]:SetText(HIGH);
+	_G[self:GetName().."High"]:SetText(Titan.literals.low);
+	_G[self:GetName().."Low"]:SetText(Titan.literals.high);
 	self:SetMinMaxValues(0, 1);
 	self:SetValueStep(0.01);
 	self:SetValue(1 - GetCVar("Sound_DialogVolume"));
@@ -283,87 +288,13 @@ function TitanPanelVolume_GetVolumeText(volume)
 	return tostring(floor(100 * volume + 0.5)) .. "%";
 end

---[[
--- 'Microphone'
-function TitanPanelMicrophoneVolumeControlSlider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_VOLUME_CONTROL_TOOLTIP"], TitanPanelVolume_GetVolumeText(GetCVar("OutboundChatVolume")));
-	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	TitanUtils_StopFrameCounting(self:GetParent());
-end
-
-function TitanPanelMicrophoneVolumeControlSlider_OnLeave(self)
-	self.tooltipText = nil;
-	GameTooltip:Hide();
-	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_VOLUME_FRAME_SHOW_TIME);
-end
-
-function TitanPanelMicrophoneVolumeControlSlider_OnShow(self)
-	_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(GetCVar("OutboundChatVolume")));
-	_G[self:GetName().."High"]:SetText(LOW);
-	_G[self:GetName().."Low"]:SetText(HIGH);
-	self:SetMinMaxValues(-1.50, 0.75);
-	self:SetValueStep(0.01);
-	self:SetValue(1 - GetCVar("OutboundChatVolume"));
-end
-
-function TitanPanelMicrophoneVolumeControlSlider_OnValueChanged(self, a1)
-_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(1 - self:GetValue()));
-
-	SetCVar("OutboundChatVolume", 1 - self:GetValue());
-	TitanSetVar(TITAN_VOLUME_ID, "VolumeOutboundChat", 1 - self:GetValue())
-
-	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_VOLUME_CONTROL_TOOLTIP"], TitanPanelVolume_GetVolumeText(1 - self:GetValue()));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
-end
-
--- 'Speaker'
-function TitanPanelSpeakerVolumeControlSlider_OnEnter(self)
-	self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_VOLUME_CONTROL_TOOLTIP"], TitanPanelVolume_GetVolumeText(GetCVar("InboundChatVolume")));
-	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
-	GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	TitanUtils_StopFrameCounting(self:GetParent());
-end
-
-function TitanPanelSpeakerVolumeControlSlider_OnLeave(self)
-	self.tooltipText = nil;
-	GameTooltip:Hide();
-	TitanUtils_StartFrameCounting(self:GetParent(), TITAN_VOLUME_FRAME_SHOW_TIME);
-end
-
-function TitanPanelSpeakerVolumeControlSlider_OnShow(self)
-	_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(GetCVar("InboundChatVolume")));
-	_G[self:GetName().."High"]:SetText(LOW);
-	_G[self:GetName().."Low"]:SetText(HIGH);
-	self:SetMinMaxValues(0, 1);
-	self:SetValueStep(0.01);
-	self:SetValue(1 - GetCVar("InboundChatVolume"));
-end
-
-function TitanPanelSpeakerVolumeControlSlider_OnValueChanged(self, a1)
-_G[self:GetName().."Text"]:SetText(TitanPanelVolume_GetVolumeText(1 - self:GetValue()));
-
-	SetCVar("InboundChatVolume", 1 - self:GetValue());
-	TitanSetVar(TITAN_VOLUME_ID, "VolumeInboundChat", 1 - self:GetValue())
-
-	-- Update GameTooltip
-	if (self.tooltipText) then
-		self.tooltipText = TitanOptionSlider_TooltipText(L["TITAN_VOLUME_CONTROL_TOOLTIP"], TitanPanelVolume_GetVolumeText(1 - self:GetValue()));
-		GameTooltip:SetText(self.tooltipText, nil, nil, nil, nil, 1);
-	end
-end
-]]--
-
 function TitanPanelVolumeControlFrame_OnLoad(self)
-	_G[self:GetName().."Title"]:SetText(SOUND_OPTIONS); -- VOLUME
-	_G[self:GetName().."MasterTitle"]:SetText(VOLUME); --MASTER_VOLUME
-	_G[self:GetName().."MusicTitle"]:SetText(MUSIC_VOLUME);
-	_G[self:GetName().."SoundTitle"]:SetText(ENABLE_SOUNDFX); -- FX_VOLUME
-	_G[self:GetName().."AmbienceTitle"]:SetText(AMBIENCE_VOLUME);
-	_G[self:GetName().."DialogTitle"]:SetText(DIALOG_VOLUME);
+	_G[self:GetName().."Title"]:SetText(L["TITAN_VOLUME_CONTROL_TITLE"]); -- VOLUME
+	_G[self:GetName().."MasterTitle"]:SetText(L["TITAN_VOLUME_MASTER_CONTROL_TITLE"]); --MASTER_VOLUME
+	_G[self:GetName().."MusicTitle"]:SetText(L["TITAN_VOLUME_MUSIC_CONTROL_TITLE"]);
+	_G[self:GetName().."SoundTitle"]:SetText(L["TITAN_VOLUME_SOUND_CONTROL_TITLE"]); -- FX_VOLUME
+	_G[self:GetName().."AmbienceTitle"]:SetText(L["TITAN_VOLUME_AMBIENCE_CONTROL_TITLE"]);
+	_G[self:GetName().."DialogTitle"]:SetText(L["TITAN_VOLUME_DIALOG_CONTROL_TITLE"]);
 --	_G[self:GetName().."MicrophoneTitle"]:SetText(L["TITAN_VOLUME_MICROPHONE_CONTROL_TITLE"]);
 --	_G[self:GetName().."SpeakerTitle"]:SetText(L["TITAN_VOLUME_SPEAKER_CONTROL_TITLE"]);
 --[[
@@ -403,11 +334,11 @@ function TitanPanelVolumeButton_GetTooltipText()
 --	local volumeMicrophoneText = TitanPanelVolume_GetVolumeText(GetCVar("OutboundChatVolume"));
 --	local volumeSpeakerText = TitanPanelVolume_GetVolumeText(GetCVar("InboundChatVolume"));
 	return ""..
-		MASTER_VOLUME.."\t"..TitanUtils_GetHighlightText(volumeMasterText).."\n"..
-		SOUND.." "..VOLUME.."\t"..TitanUtils_GetHighlightText(volumeSoundText).."\n"..
-		MUSIC_VOLUME.."\t"..TitanUtils_GetHighlightText(volumeMusicText).."\n"..
-		AMBIENCE_VOLUME.."\t"..TitanUtils_GetHighlightText(volumeAmbienceText).."\n"..
-		DIALOG_VOLUME.."\t"..TitanUtils_GetHighlightText(volumeDialogText).."\n"..
+		L["TITAN_VOLUME_MASTER_TOOLTIP_VALUE"].."\t"..TitanUtils_GetHighlightText(volumeMasterText).."\n"..
+		L["TITAN_VOLUME_SOUND_TOOLTIP_VALUE"].."\t"..TitanUtils_GetHighlightText(volumeSoundText).."\n"..
+		L["TITAN_VOLUME_MUSIC_TOOLTIP_VALUE"].."\t"..TitanUtils_GetHighlightText(volumeMusicText).."\n"..
+		L["TITAN_VOLUME_AMBIENCE_TOOLTIP_VALUE"].."\t"..TitanUtils_GetHighlightText(volumeAmbienceText).."\n"..
+		L["TITAN_VOLUME_DIALOG_TOOLTIP_VALUE"].."\t"..TitanUtils_GetHighlightText(volumeDialogText).."\n"..
 --		L["TITAN_VOLUME_MICROPHONE_TOOLTIP_VALUE"].."\t"..TitanUtils_GetHighlightText(volumeMicrophoneText).."\n"..
 --		L["TITAN_VOLUME_SPEAKER_TOOLTIP_VALUE"].."\t"..TitanUtils_GetHighlightText(volumeSpeakerText).."\n"..
 		TitanUtils_GetGreenText(L["TITAN_VOLUME_TOOLTIP_HINT1"]).."\n"..
@@ -614,8 +545,4 @@ local function Create_Frames()
 --]===]
 end

-
-if TITAN_ID then -- it exists
-	L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)
-	Create_Frames() -- do the work
-end
+Create_Frames() -- do the work