<!--
Description:
  An effect chain widget.
  * EffectSlots, with or without highlight/focus option
  * mixer with Wet/Dry knob and Super knob (optional)
  * assignment buttons for main & headphone
Variables:
  FxUnit:   number of effect unit for FX label
-->
<Template>
  <SetVariable name="FxRack_FxUnit">EffectRack<Variable name="FxRack"/>_EffectUnit<Variable name="FxUnit"/></SetVariable>

  <WidgetGroup>
    <ObjectName>FxUnitMini</ObjectName>
    <Layout>horizontal</Layout>
    <SizePolicy>me,max</SizePolicy>
    <Children>

      <WidgetGroup><ObjectName>Spacer33</ObjectName><Size>0me,1min</Size></WidgetGroup>

      <WidgetGroup><ObjectName>Spacer0f</ObjectName><Size>1f,1min</Size></WidgetGroup>

      <WidgetGroup><!-- EffectSlots + Underlays -->
        <ObjectName>Spacer0f</ObjectName>
        <Layout>stacked</Layout>
        <SizePolicy>max,min</SizePolicy>
        <Children>

          <WidgetGroup><!-- EffectSlots, optional focus button -->
            <Layout>horizontal</Layout>
            <Size>-1max,-1min</Size>
            <Children>
              <WidgetGroup><!-- Effect 1 -->
                <ObjectName>AlignVCenter</ObjectName>
                <Layout>horizontal</Layout>
                <SizePolicy>me,me</SizePolicy>
                <Children>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                  <Template src="skins:Tango/fx/toggle_selector.xml"><SetVariable name="FxNum">1</SetVariable></Template>
                  <Template src="skins:Tango/fx/metaknob.xml"><SetVariable name="FxNum">1</SetVariable></Template>
                  <Template src="skins:Tango/fx/focus_button.xml"><SetVariable name="FxNum">1</SetVariable></Template>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                </Children>
              </WidgetGroup>

              <WidgetGroup><!-- Effect 2 -->
                <ObjectName>AlignVCenter</ObjectName>
                <Layout>horizontal</Layout>
                <SizePolicy>me,me</SizePolicy>
                <Children>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                  <Template src="skins:Tango/fx/toggle_selector.xml"><SetVariable name="FxNum">2</SetVariable></Template>
                  <Template src="skins:Tango/fx/metaknob.xml"><SetVariable name="FxNum">2</SetVariable></Template>
                  <Template src="skins:Tango/fx/focus_button.xml"><SetVariable name="FxNum">2</SetVariable></Template>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                </Children>
              </WidgetGroup>

              <WidgetGroup><!-- Effect 3 -->
                <ObjectName>AlignVCenter</ObjectName>
                <Layout>horizontal</Layout>
                <SizePolicy>me,me</SizePolicy>
                <Children>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                  <Template src="skins:Tango/fx/toggle_selector.xml"><SetVariable name="FxNum">3</SetVariable></Template>
                  <Template src="skins:Tango/fx/metaknob.xml"><SetVariable name="FxNum">3</SetVariable></Template>
                  <Template src="skins:Tango/fx/focus_button.xml"><SetVariable name="FxNum">3</SetVariable></Template>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                </Children>
              </WidgetGroup>
            </Children>
          </WidgetGroup><!-- /EffectSlots, optional focus button -->

          <WidgetGroup><!-- Underlays, no focus -->
            <Layout>horizontal</Layout>
            <SizePolicy>min,min</SizePolicy>
            <Children>
              <WidgetGroup><!-- EffectSlot 1 -->
                <ObjectName>FxFlow_focus_background</ObjectName>
                <SizePolicy>me,min</SizePolicy>
              </WidgetGroup>

              <WidgetGroup>
                <ObjectName>FxFlow_mini_separator</ObjectName>
                <Size>11f,30f</Size>
              </WidgetGroup>

              <WidgetGroup><!-- EffectSlot 2 -->
                <ObjectName>FxFlow_focus_background</ObjectName>
                <SizePolicy>me,min</SizePolicy>
              </WidgetGroup>

              <WidgetGroup>
                <ObjectName>FxFlow_mini_separator</ObjectName>
                <Size>11f,30f</Size>
              </WidgetGroup>

              <WidgetGroup><!-- EffectSlot 3 -->
                <ObjectName>FxFlow_focus_background</ObjectName>
                <SizePolicy>me,min</SizePolicy>
              </WidgetGroup>

              <WidgetGroup>
                <ObjectName>FxFlow_focus_background</ObjectName>
                <Size>11f,30f</Size>
              </WidgetGroup>
            </Children>
            <Connection>
              <ConfigKey>[<Variable name="FxRack_FxUnit"/>],show_focus</ConfigKey>
              <Transform><Not/></Transform>
              <BindProperty>visible</BindProperty>
            </Connection>
          </WidgetGroup><!-- /Underlays, no focus -->

          <WidgetGroup><!-- Underlays with focus -->
            <Layout>horizontal</Layout>
            <SizePolicy>min,min</SizePolicy>
            <Children>
              <!-- EffectSlot 1 -->
              <Template src="skins:Tango/fx/flow_focus_background.xml">
                <SetVariable name="Size">-1me,-1min</SetVariable>
                <SetVariable name="FxNum">1</SetVariable>
              </Template>

              <WidgetGroup>
                <ObjectName>FxFlow_mini_focus_separator1-2</ObjectName>
                <Size>11f,30f</Size>
                <Connection>
                  <ConfigKey>[<Variable name="FxRack_FxUnit"/>],focused_effect</ConfigKey>
                  <BindProperty>highlight</BindProperty>
                </Connection>
              </WidgetGroup>

              <!-- EffectSlot 2 -->
              <Template src="skins:Tango/fx/flow_focus_background.xml">
                <SetVariable name="Size">-1me,-1min</SetVariable>
                <SetVariable name="FxNum">2</SetVariable>
              </Template>

              <WidgetGroup>
                <ObjectName>FxFlow_mini_focus_separator2-3</ObjectName>
                <Size>11f,30f</Size>
                <Connection>
                  <ConfigKey>[<Variable name="FxRack_FxUnit"/>],focused_effect</ConfigKey>
                  <BindProperty>highlight</BindProperty>
                </Connection>
              </WidgetGroup>

              <!-- EffectSlot 3 -->
              <Template src="skins:Tango/fx/flow_focus_background.xml">
                <SetVariable name="Size">-1me,-1min</SetVariable>
                <SetVariable name="FxNum">3</SetVariable>
              </Template>
              <Template src="skins:Tango/fx/flow_focus_background.xml">
                <SetVariable name="Size">11f,30f</SetVariable>
                <SetVariable name="FxNum">3</SetVariable>
              </Template>
            </Children>
            <Connection>
              <ConfigKey>[<Variable name="FxRack_FxUnit"/>],show_focus</ConfigKey>
              <BindProperty>visible</BindProperty>
            </Connection>
          </WidgetGroup><!-- /Underlays with focus -->

        </Children>
      </WidgetGroup><!-- /EffectSlots + Underlays -->

      <WidgetGroup><ObjectName>Spacer0f</ObjectName><Size>1f,1me</Size></WidgetGroup>

      <WidgetGroup><!-- Headphone + Super + Wet/Dry + FX label + expand toggle -->
        <ObjectName>FxUnitMixerLeft_mini</ObjectName>
        <Layout>horizontal</Layout>
        <SizePolicy>max,min</SizePolicy>
        <Children>

          <WidgetGroup><!-- Headphone FX button -->
            <ObjectName>AlignCenter</ObjectName>
            <SizePolicy>max,min</SizePolicy>
            <Layout>horizontal</Layout>
            <Children>
              <WidgetGroup>
                <SizePolicy>max,max</SizePolicy>
                <Layout>stacked</Layout>
                <Children>
                  <!-- Greyed out if no headphone device is configured -->
                  <Template src="skins:Tango/helpers/pfl_cover.xml"/>
                  <Template src="skins:Tango/controls/button_2state.xml">
                    <SetVariable name="ObjectName">PflButton</SetVariable>
                    <SetVariable name="TooltipId">EffectUnit_headphones_enabled</SetVariable>
                    <SetVariable name="Size">20f,20f</SetVariable>
                    <SetVariable name="state_0_icon">pfl_off.svg</SetVariable>
                    <SetVariable name="state_1_icon">pfl_on.svg</SetVariable>
                    <SetVariable name="ConfigKey">[EffectRack1_EffectUnit<Variable name="FxUnit"/>],group_[Headphone]_enable</SetVariable>
                  </Template>
                </Children>
              </WidgetGroup>
            </Children>
          </WidgetGroup><!-- /Headphone FX button -->

          <WidgetGroup>
            <SizePolicy>max,min</SizePolicy>
            <Layout>vertical</Layout>
            <Children>
              <Template src="skins:Tango/controls/knob_textless.xml">
                <SetVariable name="ObjectName">SuperWetDryKnob</SetVariable>
                <SetVariable name="TooltipId">EffectUnit_super1</SetVariable>
                <SetVariable name="Size">30f,30f</SetVariable>
                <SetVariable name="group">[<Variable name="FxRack_FxUnit"/>]</SetVariable>
                <SetVariable name="ConfigKey">super1</SetVariable>
                <SetVariable name="Color">blue</SetVariable>
              </Template>
            </Children>
            <Connection>
              <ConfigKey persist="true">[Skin],show_superknobs</ConfigKey>
              <BindProperty>visible</BindProperty>
            </Connection>
          </WidgetGroup>

          <WidgetGroup>
            <Size>3f,1min</Size>
            <Connection>
              <ConfigKey persist="true">[Skin],show_superknobs</ConfigKey>
              <Transform><Not/></Transform>
              <BindProperty>visible</BindProperty>
            </Connection>
          </WidgetGroup>

          <WidgetGroup><!-- Effect chain selector -->
            <ObjectName>AlignCenter</ObjectName>
            <SizePolicy>max,min</SizePolicy>
            <Layout>horizontal</Layout>
            <Children>
              <EffectChainPresetButton>
                <ObjectName>EffectChainPresetButtonLeft</ObjectName>
                <EffectUnit><Variable name="FxUnit"/></EffectUnit>
                <Size>20f,20f</Size>
              </EffectChainPresetButton>
            </Children>
          </WidgetGroup>

          <Template src="skins:Tango/controls/button_2state_persist.xml">
            <SetVariable name="ObjectName">MixModeButton</SetVariable>
            <SetVariable name="TooltipId">EffectUnit_mix_mode</SetVariable>
            <SetVariable name="Size">24f,18f</SetVariable>
            <SetVariable name="state_0_icon">fx_mixmode_d-w.svg</SetVariable>
            <SetVariable name="state_1_icon">fx_mixmode_d+w.svg</SetVariable>
            <SetVariable name="ConfigKey">[EffectRack1_EffectUnit<Variable name="FxUnit"/>],mix_mode</SetVariable>
          </Template>

          <Template src="skins:Tango/controls/knob_textless.xml">
            <SetVariable name="ObjectName">SuperWetDryKnob</SetVariable>
            <SetVariable name="TooltipId">EffectUnit_mix</SetVariable>
            <SetVariable name="Size">30f,30f</SetVariable>
            <SetVariable name="group">[<Variable name="FxRack_FxUnit"/>]</SetVariable>
            <SetVariable name="ConfigKey">mix</SetVariable>
            <SetVariable name="Color">red</SetVariable>
          </Template>
        </Children>
      </WidgetGroup><!-- /Headphone + Super + Wet/Dry + FX label + expand toggle -->

      <WidgetGroup><!-- FX label + FX expand button -->
        <ObjectName>FxUnitControls</ObjectName>
        <Layout>stacked</Layout>
        <Size>30f,30f</Size>
        <Children>
          <Template src="skins:Tango/controls/button_2state_persist.xml">
            <SetVariable name="ObjectName">FxMiniMaxi</SetVariable>
            <SetVariable name="TooltipId">EffectUnit_show_parameters</SetVariable>
            <SetVariable name="Size">30f,30f</SetVariable>
            <SetVariable name="ConfigKey">[<Variable name="FxRack_FxUnit"/>],show_parameters</SetVariable>
          </Template>
          <Label>
            <ObjectName>FxUnitLabel</ObjectName>
            <Size>30f,15f</Size>
            <Text>&#8201;FX&#8202;<Variable name="FxUnit"/></Text>
          </Label>
        </Children>
      </WidgetGroup><!-- /FX label + FX expand button -->

    </Children>
  </WidgetGroup><!-- /EffectUnit -->
</Template>
