<Ui>
	
	<Frame name="$parentAnimations" inherits="TellMeWhen_EventContainer" parentKey="Animations">
		<Frames>
			<Frame name="$parentSubHandlerList" parentKey="SubHandlerList">
				<Size x="150" y="10"/>
				<Anchors>
					<Anchor point="TOPLEFT" />
					<Anchor point="BOTTOM" y="-0"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						TMW:ConvertContainerToScrollFrame(self, true, nil, 8)
					</OnLoad>
				</Scripts>
			</Frame>
			
			<Frame name="$parentConfigFrames" parentKey="ConfigFrames">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentSubHandlerListScrollFrame" relativePoint="TOPRIGHT" x="5" y="0"/>
					<Anchor point="BOTTOMRIGHT" x="-0" y="0"/>
				</Anchors>
				<Frames>
					<Slider name="$parentDuration" parentKey="Duration" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" valuestep="0.1" >
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "Duration",
								})
								
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(0.1, math.huge)
								self:SetRange(10)
								self:SetValueStep(0.1)
								self:SetTextFormatter(TMW.C.Formatter.S_SECONDS, TMW.C.Formatter.F_1)

							</OnLoad>
						</Scripts>
					</Slider>

					<CheckButton name="$parentInfinite" inherits="TellMeWhen_EventHandler_ColumnConfig_CheckTemplate" parentKey="Infinite">
						<Scripts>
							<OnLoad>
								hooksecurefunc(self, "SetChecked", function(self, value)
									if value then
										self:GetParent().Duration:Disable()
									else
										self:GetParent().Duration:Enable()
									end
								end)
							</OnLoad>
							<OnClick>
								self:SetChecked(self:GetChecked()) -- trigger the hook
								TMW.EVENTS:GetEventSettings().Infinite = not not self:GetChecked()
							</OnClick>
						</Scripts>
					</CheckButton>

					<Slider name="$parentMagnitude" parentKey="Magnitude" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" valuestep="1">
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "Magnitude",
								})
								
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(0, math.huge)
								self:SetRange(10)
								self:SetTextFormatter(TMW.C.Formatter.PIXELS, TMW.C.Formatter.PASS)
							</OnLoad>
						</Scripts>
					</Slider>

					<Slider name="$parentPeriod" parentKey="Period" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" valuestep="0.1" >
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "Period",
								})
								
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(0, math.huge)
								self:SetRange(10)
								self:SetTextFormatter(TMW.C.Formatter.S_SECONDS, TMW.C.Formatter.F_1)
							</OnLoad>
						</Scripts>
					</Slider>
					

					<Button name="$parentColor" parentKey="Color">
						<Size x="20" y="20"/>
						<Anchors>
							<!-- <Anchor point="TOPLEFT" relativeTo="$parentPeriod" relativePoint="BOTTOMLEFT" x="0" y="-25"/> -->
							<Anchor point="LEFT" x="10" />
						</Anchors>
						<Layers>
							<Layer level="BACKGROUND">
								<Texture parentKey="background">
									<Size x="17.5" y="17.5"/>
									<Anchors>
										<Anchor point="CENTER"/>
									</Anchors>
									<Color r="1.0" g="1.0" b="1.0"/>
								</Texture>
								<FontString name="$parenttext" parentKey="text" justifyH="LEFT" inherits="GameFontHighlightSmall">
									<Anchors>
										<Anchor point="LEFT" relativePoint="RIGHT" x="2"/>
									</Anchors>
								</FontString>
							</Layer>
						</Layers>
						<Scripts>
							<OnLoad>
								self.text:SetText(TMW.L["ANIM_COLOR"])
								TMW:TT(self, "ANIM_COLOR", "ANIM_COLOR_DESC")
								self.func = function()
									local settings = TMW.EVENTS:GetEventSettings()
									local r, g, b = ColorPickerFrame:GetColorRGB()
									settings.r_anim = r
									settings.g_anim = g
									settings.b_anim = b
									self:GetNormalTexture():SetVertexColor(r, g, b, 1)
									TMW.IE:ScheduleIconSetup()
								end
								self.opacityFunc = function()
									local settings = TMW.EVENTS:GetEventSettings()
									local a = 1 - OpacitySliderFrame:GetValue()
									settings.a_anim = a
									self.background:SetAlpha(a)
									TMW.IE:ScheduleIconSetup()
								end
								self.cancel = function()
									local settings = TMW.EVENTS:GetEventSettings()
									local r, g, b, a = self.br, self.bg, self.bb, self.ba
									settings.r_anim = r
									settings.g_anim = g
									settings.b_anim = b
									settings.a_anim = a
									self:GetNormalTexture():SetVertexColor(r, g, b, 1)
									self.background:SetAlpha(a)
									TMW.IE:ScheduleIconSetup()
								end
							</OnLoad>
							<OnClick>
								local settings = TMW.EVENTS:GetEventSettings()
								local r, g, b, a = settings.r_anim, settings.g_anim, settings.b_anim, settings.a_anim
								self.br, self.bg, self.bb, self.ba = r, g, b, a

								ColorPickerFrame.func, ColorPickerFrame.opacityFunc, ColorPickerFrame.cancelFunc = self.func, self.opacityFunc, self.cancel
								ColorPickerFrame:SetColorRGB(r, g, b)
								ColorPickerFrame.hasOpacity = true
								ColorPickerFrame.opacity = 1 - a
								ColorPickerFrame:Show()
							</OnClick>
						</Scripts>
						<NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\ChatFrameColorSwatch"/>
					</Button>


					<EditBox name="$parentImage" inherits="TellMeWhen_InputBoxTemplate" parentKey="Image" autoFocus="false">
						<Size y="15"/>
						<Anchors>
							<!-- <Anchor point="TOPLEFT" relativeTo="$parentPeriod" relativePoint="BOTTOMLEFT" x="4" y="-25"/> -->
							<Anchor point="LEFT" x="15" />
							<Anchor point="RIGHT" x="-15" />
						</Anchors>
						<Scripts>
							<OnLoad>
								TMW:TT(self, "ANIM_TEX", "ANIM_TEX_DESC")
								self.label = TMW.L["ANIM_TEX"]
								self.BackgroundText:SetWidth(self:GetWidth())
								TMW.SUG:EnableEditBox(self, "texture", true)
							</OnLoad>
							<OnEditFocusLost>
								EditBox_ClearHighlight(self)

								self:SetText(self:GetText():gsub([[\\]], [[\]]))

								if TMW.CI.ics then
									TMW.EVENTS:GetEventSettings().Image = TMW:CleanString(self)
									TMW.IE:ScheduleIconSetup()
								end

								self:GetScript("OnTextChanged")(self)
							</OnEditFocusLost>
						</Scripts>
					</EditBox>

					<CheckButton name="$parentFade" inherits="TellMeWhen_EventHandler_ColumnConfig_CheckTemplate" parentKey="Fade">
					</CheckButton>

					<Slider name="$parentAlphaStandalone" parentKey="AlphaStandalone" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" >
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "a_anim",
								})
								
								self:SetMinMaxValues(0, 1)
								self:SetValueStep(0.01)
								self:SetTextFormatter(TMW.C.Formatter.PERCENT100)

							</OnLoad>
						</Scripts>
					</Slider>
					
					
					<Slider name="$parentThickness" parentKey="Thickness" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" >
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "Thickness",
								})
								
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(0.1, math.huge)
								self:SetValueStep(0.1)
								self:SetRange(10)
								self:SetTextFormatter(TMW.C.Formatter.PIXELS, TMW.C.Formatter.F_1)

							</OnLoad>
						</Scripts>
					</Slider>
					
					<Slider name="$parentSize_anim" parentKey="Size_anim" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" >
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "Size_anim",
								})
								
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(-math.huge, math.huge)
								self:SetValueStep(0.1)
								self:SetRange(10)
								self:SetTextFormatter(TMW.C.Formatter.PIXELS, TMW.C.Formatter.F_1)

							</OnLoad>
						</Scripts>
					</Slider>

					<Slider name="$parentSizeX" parentKey="SizeX" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" >
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "SizeX",
								})
								
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(1, math.huge)
								self:SetValueStep(1)
								self:SetRange(100)
								self:SetTextFormatter(TMW.C.Formatter.PIXELS, TMW.C.Formatter.PASS)

							</OnLoad>
						</Scripts>
					</Slider>

					<Slider name="$parentSizeY" parentKey="SizeY" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" >
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "SizeY",
								})
								
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(1, math.huge)
								self:SetValueStep(1)
								self:SetRange(100)
								self:SetTextFormatter(TMW.C.Formatter.PIXELS, TMW.C.Formatter.PASS)

							</OnLoad>
						</Scripts>
					</Slider>

					<Frame name="$parentAnchorTo" parentKey="AnchorTo" inherits="TMW_DropDownMenuTemplate">
						<Anchors>
							<Anchor point="LEFT" x="9" />
							<Anchor point="RIGHT" x="-9" />
						</Anchors>
						<Layers>
							<Layer level="ARTWORK">
								<FontString name="$parentText" parentKey="text" inherits="GameFontHighlightSmall" justifyH="CENTER" justifyV="BOTTOM">
									<Anchors>
										<Anchor point="BOTTOM" relativePoint="TOP" y="-1"/>
										<Anchor point="LEFT" x="-5"/>
										<Anchor point="RIGHT" x="5"/>
									</Anchors>
								</FontString>
							</Layer>
						</Layers>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									title = TMW.L["ANCHORTO"],
									--tooltip = TMW.L[""],
									func = TMW.EVENTS:GetEventHandler("Animations").AnchorTo_Dropdown,
								})
								self.text:SetText(TMW.L["ANCHORTO"])
							
							</OnLoad>
						</Scripts>
					</Frame>

				</Frames>
			</Frame>
		</Frames>
		<Layers>
			<Layer level="OVERLAY">
				<FontString name="$parentListHeader" inherits="GameFontNormalLarge" parentKey="ListHeader" justifyH="LEFT" text="">
					<Anchors>
						<Anchor point="BOTTOM" relativeTo="$parentSubHandlerListScrollFrame" relativePoint="TOP" y="1"/>
					</Anchors>
				</FontString>
				
				<FontString name="$parentSettingsHeader" inherits="GameFontNormalLarge" parentKey="SettingsHeader" justifyH="CENTER" text="">
					<Anchors>
						<Anchor point="BOTTOM" relativeTo="$parentSubHandlerListScrollFrame" relativePoint="TOP" />
						<Anchor point="LEFT" relativeTo="$parentConfigFrames"/>
						<Anchor point="RIGHT" relativeTo="$parentConfigFrames"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
	</Frame>

</Ui>