@@ -456,96 +456,63 @@ local function CreatePowerBarSettings(containerParent, unit)
456456
457457 local TogglesContainer = CreateInlineGroup (BarContainer , " Toggles" )
458458
459- local function GUIRefresh ()
460- if not PowerBarDB .Enabled then
461- DeepDisable (BarContainer , true , UUFGUI .EnableCheckBox )
462- DeepDisable (UUFGUI .TextContainer , true , UUFGUI .EnableTextCheckBox )
463- ScrollFrame :DoLayout ()
464- return
465- end
466- DeepDisable (BarContainer , false , nil )
467-
468- if not PowerBarDB .Text .Enabled then
469- DeepDisable (UUFGUI .TextContainer , true , UUFGUI .EnableTextCheckBox )
470- ScrollFrame :DoLayout ()
471- return
472- end
473-
474- DeepDisable (UUFGUI .TextContainer , false , nil )
475-
476- if PowerBarDB .ColourByType then
477- TextColourPicker :SetDisabled (true )
478- else
479- TextColourPicker :SetDisabled (false )
480- end
481-
482- ScrollFrame :DoLayout ()
483- end
484-
485459 local EnableCheckBox = AG :Create (" CheckBox" )
486460 EnableCheckBox :SetLabel (" Enable Power Bar" )
487461 EnableCheckBox :SetValue (PowerBarDB .Enabled )
488462 EnableCheckBox :SetRelativeWidth (0.5 )
489- EnableCheckBox :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Enabled = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end GUIRefresh () UUFGUI .EnableTextCheckBox :SetDisabled (not value ) end )
490- UUFGUI .EnableCheckBox = EnableCheckBox
463+ EnableCheckBox :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Enabled = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end DeepDisable (Wrapper , not value , EnableCheckBox ) end )
491464 TogglesContainer :AddChild (EnableCheckBox )
492465
493466 local ColourByType = AG :Create (" CheckBox" )
494467 ColourByType :SetLabel (" Colour By Power Type" )
495468 ColourByType :SetValue (PowerBarDB .ColourByType )
496469 ColourByType :SetRelativeWidth (0.5 )
497- ColourByType :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .ColourByType = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end UUFGUI . FGColourPicker :SetDisabled (value ) end )
470+ ColourByType :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .ColourByType = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end FGColourPicker :SetDisabled (value ) end )
498471 TogglesContainer :AddChild (ColourByType )
499472
500473 local ColourBackgroundByType = AG :Create (" CheckBox" )
501474 ColourBackgroundByType :SetLabel (" Colour Background By Power Type" )
502475 ColourBackgroundByType :SetValue (PowerBarDB .ColourBackgroundByType )
503476 ColourBackgroundByType :SetRelativeWidth (0.5 )
504- ColourBackgroundByType :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .ColourBackgroundByType = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end UUFGUI . BGColourPicker :SetDisabled (value ) UUFGUI . DarkenFactorSlider :SetDisabled (not value ) end )
477+ ColourBackgroundByType :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .ColourBackgroundByType = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end BGColourPicker :SetDisabled (value ) DarkenFactorSlider :SetDisabled (not value ) end )
505478 TogglesContainer :AddChild (ColourBackgroundByType )
506479
507480 local InverseGrowthCheckBox = AG :Create (" CheckBox" )
508481 InverseGrowthCheckBox :SetLabel (" Inverse Growth" )
509482 InverseGrowthCheckBox :SetValue (PowerBarDB .InverseGrowth )
510483 InverseGrowthCheckBox :SetRelativeWidth (0.5 )
511484 InverseGrowthCheckBox :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .InverseGrowth = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
512- InverseGrowthCheckBox :SetCallback (" OnEnter" , function () GameTooltip :SetOwner (InverseGrowthCheckBox .frame , " ANCHOR_CURSOR" ) GameTooltip :AddLine (" |cFF8080FFInverse Health Bar|r will adjust the growth direction from |cFFFFCC00Right to Left|r to |cFFFFCC00Left to Right|r" , 1 , 1 , 1 ) GameTooltip :Show () end )
485+ InverseGrowthCheckBox :SetCallback (" OnEnter" , function () GameTooltip :SetOwner (InverseGrowthCheckBox .frame , " ANCHOR_CURSOR" ) GameTooltip :AddLine (" |cFF8080FFInverse Power Bar|r will adjust the growth direction from |cFFFFCC00Right to Left|r to |cFFFFCC00Left to Right|r" , 1 , 1 , 1 ) GameTooltip :Show () end )
513486 InverseGrowthCheckBox :SetCallback (" OnLeave" , function () GameTooltip :Hide () end )
514487 TogglesContainer :AddChild (InverseGrowthCheckBox )
515488
516- local ColourContainer = CreateInlineGroup (BarContainer , " Colours" )
517- UUFGUI .ColourContainer = ColourContainer
518-
519- local FGColourPicker = AG :Create (" ColorPicker" )
489+ local ColoursContainer = CreateInlineGroup (ScrollFrame , " Colours" )
490+ FGColourPicker = AG :Create (" ColorPicker" )
520491 FGColourPicker :SetLabel (" Foreground Colour" )
521492 FGColourPicker :SetColor (unpack (PowerBarDB .FGColour ))
522493 FGColourPicker :SetHasAlpha (true )
523- FGColourPicker :SetCallback (" OnValueChanged" , function (_ , _ , r , g , b , a ) PowerBarDB .FGColour = {r , g , b , a } if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
524494 FGColourPicker :SetRelativeWidth (0.33 )
525- ColourContainer : AddChild ( FGColourPicker )
526- UUFGUI . FGColourPicker = FGColourPicker
495+ FGColourPicker : SetCallback ( " OnValueChanged " , function ( _ , _ , r , g , b , a ) PowerBarDB . FGColour = { r , g , b , a } if unit == " boss " then UUF : UpdateAllBossFrames () else UUF : UpdateUnitFrame ( unit ) end end )
496+ ColoursContainer : AddChild ( FGColourPicker )
527497
528- local BGColourPicker = AG :Create (" ColorPicker" )
498+ BGColourPicker = AG :Create (" ColorPicker" )
529499 BGColourPicker :SetLabel (" Background Colour" )
530500 BGColourPicker :SetColor (unpack (PowerBarDB .BGColour ))
531501 BGColourPicker :SetHasAlpha (true )
532- BGColourPicker :SetCallback (" OnValueChanged" , function (_ , _ , r , g , b , a ) PowerBarDB .BGColour = {r , g , b , a } if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
533502 BGColourPicker :SetRelativeWidth (0.33 )
534- ColourContainer : AddChild ( BGColourPicker )
535- UUFGUI . BGColourPicker = BGColourPicker
503+ BGColourPicker : SetCallback ( " OnValueChanged " , function ( _ , _ , r , g , b , a ) PowerBarDB . BGColour = { r , g , b , a } if unit == " boss " then UUF : UpdateAllBossFrames () else UUF : UpdateUnitFrame ( unit ) end end )
504+ ColoursContainer : AddChild ( BGColourPicker )
536505
537- local DarkenFactorSlider = AG :Create (" Slider" )
506+ DarkenFactorSlider = AG :Create (" Slider" )
538507 DarkenFactorSlider :SetLabel (" Background Darken Factor" )
539508 DarkenFactorSlider :SetValue (PowerBarDB .DarkenFactor )
540- DarkenFactorSlider :SetSliderValues (0.1 , 1.0 , 0.01 )
509+ DarkenFactorSlider :SetSliderValues (0 , 1 , 0.01 )
510+ DarkenFactorSlider :SetIsPercent (true )
541511 DarkenFactorSlider :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .DarkenFactor = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
542512 DarkenFactorSlider :SetRelativeWidth (0.33 )
543- ColourContainer :AddChild (DarkenFactorSlider )
544- UUFGUI .DarkenFactorSlider = DarkenFactorSlider
545-
546- local LayoutContainer = CreateInlineGroup (BarContainer , " Layout" )
547- UUFGUI .LayoutContainer = LayoutContainer
513+ ColoursContainer :AddChild (DarkenFactorSlider )
548514
515+ local LayoutContainer = CreateInlineGroup (ScrollFrame , " Layout" )
549516 local HeightSlider = AG :Create (" Slider" )
550517 HeightSlider :SetLabel (" Height" )
551518 HeightSlider :SetValue (PowerBarDB .Height )
@@ -562,94 +529,10 @@ local function CreatePowerBarSettings(containerParent, unit)
562529 AlignmentDropdown :SetRelativeWidth (0.5 )
563530 LayoutContainer :AddChild (AlignmentDropdown )
564531
565- local TextContainer = CreateInlineGroup (ScrollFrame , " Text" )
566- UUFGUI .TextContainer = TextContainer
567-
568- local TextToggleContainer = CreateInlineGroup (TextContainer , " Toggles" )
532+ DeepDisable (Wrapper , not PowerBarDB .Enabled , EnableCheckBox )
569533
570- local EnableTextCheckBox = AG :Create (" CheckBox" )
571- EnableTextCheckBox :SetLabel (" Enable Power Text" )
572- EnableTextCheckBox :SetValue (PowerBarDB .Text .Enabled )
573- EnableTextCheckBox :SetRelativeWidth (0.5 )
574- EnableTextCheckBox :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .Enabled = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end DeepDisable (TextContainer , not value , EnableTextCheckBox ) GUIRefresh () end )
575- UUFGUI .EnableTextCheckBox = EnableTextCheckBox
576- TextToggleContainer :AddChild (EnableTextCheckBox )
577-
578- local ColourTextByPowerType = AG :Create (" CheckBox" )
579- ColourTextByPowerType :SetLabel (" Colour Text By Power Type" )
580- ColourTextByPowerType :SetValue (PowerBarDB .Text .ColourByType )
581- ColourTextByPowerType :SetRelativeWidth (0.5 )
582- ColourTextByPowerType :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .ColourByType = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end TextColourPicker :SetDisabled (value ) end )
583- TextToggleContainer :AddChild (ColourTextByPowerType )
584-
585- local TextColourContainer = CreateInlineGroup (TextContainer , " Colours" )
586-
587- TextColourPicker = AG :Create (" ColorPicker" )
588- TextColourPicker :SetLabel (" Text Colour" )
589- TextColourPicker :SetColor (unpack (PowerBarDB .Text .Colour ))
590- TextColourPicker :SetHasAlpha (true )
591- TextColourPicker :SetCallback (" OnValueChanged" , function (_ , _ , r , g , b , a ) PowerBarDB .Text .Colour = {r , g , b , a } if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
592- TextColourPicker :SetRelativeWidth (0.5 )
593- TextColourContainer :AddChild (TextColourPicker )
594-
595- local TextLayoutContainer = CreateInlineGroup (TextContainer , " Layout" )
596-
597- local AnchorFromDropdown = AG :Create (" Dropdown" )
598- AnchorFromDropdown :SetLabel (" Anchor From" )
599- AnchorFromDropdown :SetList (AnchorPoints [1 ], AnchorPoints [2 ])
600- AnchorFromDropdown :SetValue (PowerBarDB .Text .AnchorFrom )
601- AnchorFromDropdown :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .AnchorFrom = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
602- AnchorFromDropdown :SetRelativeWidth (0.3 )
603- TextLayoutContainer :AddChild (AnchorFromDropdown )
604-
605- local AnchorParentDropdown = AG :Create (" Dropdown" )
606- AnchorParentDropdown :SetLabel (" Anchor Parent" )
607- AnchorParentDropdown :SetList ({ [" POWER" ] = " Power Bar" , [" FRAME" ] = " Unit Frame" , })
608- AnchorParentDropdown :SetValue (PowerBarDB .Text .AnchorParent )
609- AnchorParentDropdown :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .AnchorParent = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
610- AnchorParentDropdown :SetRelativeWidth (0.33 )
611- TextLayoutContainer :AddChild (AnchorParentDropdown )
612-
613- local AnchorToDropdown = AG :Create (" Dropdown" )
614- AnchorToDropdown :SetLabel (" Anchor To" )
615- AnchorToDropdown :SetList (AnchorPoints [1 ], AnchorPoints [2 ])
616- AnchorToDropdown :SetValue (PowerBarDB .Text .AnchorTo )
617- AnchorToDropdown :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .AnchorTo = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
618- AnchorToDropdown :SetRelativeWidth (0.33 )
619- TextLayoutContainer :AddChild (AnchorToDropdown )
620-
621- local XPositionSlider = AG :Create (" Slider" )
622- XPositionSlider :SetLabel (" X Offset" )
623- XPositionSlider :SetValue (PowerBarDB .Text .OffsetX )
624- XPositionSlider :SetSliderValues (- 500 , 500 , 0.1 )
625- XPositionSlider :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .OffsetX = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
626- XPositionSlider :SetRelativeWidth (0.33 )
627- TextLayoutContainer :AddChild (XPositionSlider )
628-
629- local YPositionSlider = AG :Create (" Slider" )
630- YPositionSlider :SetLabel (" Y Offset" )
631- YPositionSlider :SetValue (PowerBarDB .Text .OffsetY )
632- YPositionSlider :SetSliderValues (- 500 , 500 , 0.1 )
633- YPositionSlider :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .OffsetY = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
634- YPositionSlider :SetRelativeWidth (0.33 )
635- TextLayoutContainer :AddChild (YPositionSlider )
636-
637- local FontSizeSlider = AG :Create (" Slider" )
638- FontSizeSlider :SetLabel (" Font Size" )
639- FontSizeSlider :SetValue (PowerBarDB .Text .FontSize )
640- FontSizeSlider :SetSliderValues (6 , 72 , 1 )
641- FontSizeSlider :SetCallback (" OnValueChanged" , function (_ , _ , value ) PowerBarDB .Text .FontSize = value if unit == " boss" then UUF :UpdateAllBossFrames () else UUF :UpdateUnitFrame (unit ) end end )
642- FontSizeSlider :SetRelativeWidth (0.33 )
643- TextLayoutContainer :AddChild (FontSizeSlider )
644-
645- GUIRefresh ()
646-
647- FGColourPicker :SetDisabled (PowerBarDB .ColourByType )
648- BGColourPicker :SetDisabled (PowerBarDB .ColourBackgroundByType )
649- DarkenFactorSlider :SetDisabled (not PowerBarDB .ColourBackgroundByType )
650- EnableTextCheckBox :SetDisabled (not PowerBarDB .Enabled )
651-
652- ScrollFrame :DoLayout ()
534+ if PowerBarDB .ColourByType then FGColourPicker :SetDisabled (true ) end
535+ if PowerBarDB .ColourBackgroundByType then BGColourPicker :SetDisabled (true ) DarkenFactorSlider :SetDisabled (false ) end
653536
654537 return ScrollFrame
655538end
0 commit comments