@@ -3,17 +3,7 @@ local _, MPT = ...
33local LDB = LibStub and LibStub :GetLibrary (" LibDataBroker-1.1" , true )
44local LDBIcon = LibStub (" LibDBIcon-1.0" , true )
55local AceConfigdialog = LibStub (" AceConfigDialog-3.0" )
6- local fontlist = MPT .LSM :List (" font" )
7- local fontTable = {}
8- for _ , font in ipairs (fontlist ) do
9- fontTable [font ] = font
10- end
116
12- local texturelist = MPT .LSM :List (" statusbar" )
13- local textureTable = {}
14- for _ , texture in ipairs (texturelist ) do
15- textureTable [texture ] = texture
16- end
177
188
199function MPT :CreateMiniMapButton ()
@@ -50,6 +40,33 @@ StaticPopupDialogs["MPT_RESET_PROFILE"] = {
5040 end
5141}
5242
43+ function MPT :GetAllFonts ()
44+ local fontlist = MPT .LSM :List (" font" )
45+ local fontTable = {}
46+ for _ , font in ipairs (fontlist ) do
47+ fontTable [font ] = font
48+ end
49+ return fontTable
50+ end
51+
52+ function MPT :GetAllTextures ()
53+ local texturelist = MPT .LSM :List (" statusbar" )
54+ local textureTable = {}
55+ for _ , texture in ipairs (texturelist ) do
56+ textureTable [texture ] = texture
57+ end
58+ return textureTable
59+ end
60+
61+ function MPTAPI :GetAllTextures ()
62+ local texturelist = MPT .LSM :List (" statusbar" )
63+ local textureTable = {}
64+ for _ , texture in ipairs (texturelist ) do
65+ textureTable [texture ] = texture
66+ end
67+ return textureTable
68+ end
69+
5370function MPT :CreateTextSetting (name , key , order , Color )
5471 local settings = {
5572 type = " group" ,
@@ -62,7 +79,7 @@ function MPT:CreateTextSetting(name, key, order, Color)
6279 settings .args .RelativeTo = self :CreateDropDown (3 , {[" LEFT" ] = " LEFT" , [" RIGHT" ] = " RIGHT" , [" CENTER" ] = " CENTER" , [" TOPLEFT" ] = " TOPLEFT" , [" TOPRIGHT" ] = " TOPRIGHT" , [" BOTTOMLEFT" ] = " BOTTOMLEFT" , [" BOTTOMRIGHT" ] = " BOTTOMRIGHT" }, " Relative To" , " " , {key , " RelativeTo" }, true )
6380 settings .args .xOffset = self :CreateRange (4 , " X Offset" , " X Offset of the Text" , - 200 , 200 , 1 , {key , " xOffset" }, true )
6481 settings .args .yOffset = self :CreateRange (5 , " Y Offset" , " Y Offset of the Text" , - 200 , 200 , 1 , {key , " yOffset" }, true )
65- settings .args .Font = self :CreateDropDown (6 , fontTable , " Font" , " " , {key , " Font" }, true )
82+ settings .args .Font = self :CreateDropDown (6 , " fonts " , " Font" , " " , {key , " Font" }, true )
6683 settings .args .FontSize = self :CreateRange (7 , " Font Size" , " Size of the Font" , 6 , 40 , 1 , {key , " FontSize" }, true )
6784 settings .args .Outline = self :CreateDropDown (8 , {[" NONE" ] = " None" , [" OUTLINE" ] = " Outline" , [" THICKOUTLINE" ] = " Thick Outline" , [" MONOCHROME" ] = " Monochrome" }, " Font Outline" , " " , {key , " Outline" }, true )
6885 if Color then settings .args .Color = self :CreateColor (9 , " Color" , " " , {key , " Color" }, true ) end
@@ -82,7 +99,7 @@ function MPT:CreateStatusBarSettings(name, key, order)
8299 }
83100 settings .args .Width = self :CreateRange (4 , " Width" , " Width of the Status Bar" , 50 , 1000 , 1 , {key , " Width" }, true )
84101 settings .args .Height = self :CreateRange (5 , " Height" , " Height of the Status Bar" , 6 , 100 , 1 , {key , " Height" }, true )
85- settings .args .Texture = self :CreateDropDown (6 , textureTable , " Texture" , " " , {key , " Texture" }, true )
102+ settings .args .Texture = self :CreateDropDown (6 , " textures " , " Texture" , " " , {key , " Texture" }, true )
86103 settings .args .xOffset = self :CreateRange (7 , " X Offset" , " X Offset of the Status Bar" , - 300 , 300 , 1 , {key , " xOffset" }, true )
87104 settings .args .yOffset = self :CreateRange (8 , " Y Offset" , " Y Offset of the Status Bar" , - 300 , 300 , 1 , {key , " yOffset" }, true )
88105 settings .args .SizeGap = self :CreateSpace (9 )
118135function MPT :CreateDropDown (order , values , name , desc , key , update )
119136 local t = {}
120137 t .order = order
121- t .values = values
138+ if values == " textures" then
139+ t .values = function () return self :GetAllTextures () end
140+ elseif values == " fonts" then
141+ t .values = function () return self :GetAllFonts () end
142+ else
143+ t .values = values
144+ end
145+
122146 t .type = " select"
123147 t .name = name
124148 t .desc = desc
@@ -264,7 +288,7 @@ local GeneralOptions = {
264288 order = 5 ,
265289 name = " Change All Fonts" ,
266290 desc = " Changes all fonts used in the main display of the addon at once - doesn't apply to settings / best times UI" ,
267- values = fontTable ,
291+ values = function () return MPT : GetAllFonts () end ,
268292 set = function (_ , value )
269293 MPT :SetSV ({" KeyLevel" , " Font" }, value , false )
270294 MPT :SetSV ({" DungeonName" , " Font" }, value , false )
@@ -293,7 +317,7 @@ local GeneralOptions = {
293317 order = 8 ,
294318 name = " Change All Textures" ,
295319 desc = " Changes all bar textures at once" ,
296- values = textureTable ,
320+ values = function () return MPT : GetAllTextures () end ,
297321 set = function (_ , value )
298322 MPT :SetSV ({" TimerBar" , " Texture" }, value , false )
299323 MPT :SetSV ({" ForcesBar" , " Texture" }, value , false )
@@ -534,7 +558,7 @@ local CurrentPullBar = {
534558 args = {
535559 enabled = MPT :CreateToggle (1 , " Enable" , " Enable Current Pull Bar" , {" CurrentPullBar" , " enabled" }, true ),
536560 Color = MPT :CreateColor (2 , " Color" , " Color of the Current Pull Bar" , {" CurrentPullBar" , " Color" }, true ),
537- texture = MPT :CreateDropDown (3 , textureTable , " Texture" , " " , {" CurrentPullBar" , " Texture" }, true ),
561+ texture = MPT :CreateDropDown (3 , " textures " , " Texture" , " " , {" CurrentPullBar" , " Texture" }, true ),
538562 Realenabled = MPT :CreateToggle (4 , " RealCount Pull" , " Show Current Pull Real Count" , {" RealCount" , " pullcount" }, true ),
539563 Percentenabled = MPT :CreateToggle (5 , " Percent Pull" , " Show Current Pull Percent" , {" PercentCount" , " pullcount" }, true ),
540564 Gap1 = MPT :CreateSpace (6 ),
0 commit comments