Quantcast

Added config option to show/not show class names in the tooltip

Kevin Lyles [11-20-09 - 22:46]
Added config option to show/not show class names in the tooltip
Filename
config.lua
config.xml
defaults.lua
diff --git a/config.lua b/config.lua
index d32eda4..23f7cb5 100644
--- a/config.lua
+++ b/config.lua
@@ -78,3 +78,21 @@ function ModifierKeyDropDownOnClick(choice, dropdown)
 	UIDropDownMenu_SetSelectedValue(dropdown, choice.value, false)
 	ww_vars.options.tooltip[dropdown:GetText()] = choice.value
 end
+
+function ShowClassNameDropDownInitialize(dropdown)
+	local info = {}
+
+	info.func = ShowClassNameDropDownOnClick
+	info.arg1 = dropdown
+	for _, value in ipairs(classNameOptions) do
+		info.text = classNameOptions[value]
+		info.value = value
+		info.checked = nil
+		UIDropDownMenu_AddButton(info)
+	end
+end
+
+function ShowClassNameDropDownOnClick(choice, dropdown)
+	UIDropDownMenu_SetSelectedValue(dropdown, choice.value, false)
+	ww_vars.options.tooltip.showClassNames = choice.value
+end
diff --git a/config.xml b/config.xml
index cee1e11..39807d9 100644
--- a/config.xml
+++ b/config.xml
@@ -75,6 +75,15 @@
 						</Anchor>
 					</Anchors>
 				</FontString>
+				<FontString name="$parentShowClassNamesLabel" parentKey="showClassNamesLabel" text="Show class names:" inherits="GameFontNormal">
+					<Anchors>
+						<Anchor point="TOPLEFT">
+							<Offset>
+								<AbsDimension x="5" y="-290"/>
+							</Offset>
+						</Anchor>
+					</Anchors>
+				</FontString>
 			</Layer>
 		</Layers>
 		<Frames>
@@ -143,6 +152,24 @@
 			<Button name="$parentShowIdealWeights" parentKey="showIdealWeights" inherits="ww_modifierKeyDropDown" text="showIdealWeights"/>
 			<Button name="$parentShowIdealGems" parentKey="showIdealGems" inherits="ww_modifierKeyDropDown" text="showIdealGems"/>
 			<Button name="$parentShowIdealGemStats" parentKey="showIdealGemStats" inherits="ww_modifierKeyDropDown" text="showIdealGemStats"/>
+			<Button name="$parentShowClassNames" parentKey="showClassNames" inherits="UIDropDownMenuTemplate">
+				<Anchors>
+					<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentShowClassNamesLabel">
+						<Offset>
+							<AbsDimension y="-5"/>
+						</Offset>
+					</Anchor>
+				</Anchors>
+				<Scripts>
+					<OnLoad>
+						UIDropDownMenu_JustifyText(self, "LEFT")
+					</OnLoad>
+					<OnShow>
+						UIDropDownMenu_Initialize(self, ShowClassNameDropDownInitialize)
+						UIDropDownMenu_SetSelectedValue(self, ww_vars.options.tooltip.showClassNames)
+					</OnShow>
+				</Scripts>
+			</Button>
 		</Frames>
 		<Scripts>
 			<OnLoad>
diff --git a/defaults.lua b/defaults.lua
index 14cfd95..7bf3fd6 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -125,6 +125,15 @@ keyDetectors = {
 	["Control"] = IsControlKeyDown,
 }

+classNameOptions = {
+	[1] = "Always",
+	[2] = "Others",
+	[3] = "Never",
+	["Always"] = "Always",
+	["Others"] = "Other Classes",
+	["Never"] = "Never",
+}
+
 defaultVars = {
 	dataMajorVersion = 0,
 	dataMinorVersion = 10,