<!--
Description:
  An effect chain widget.
  * EffectSlots, with or without highlight/focus option
  * mixer with Wet/Dry knob and Super knob (optional)
  * assignment buttons for master & 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>
    <Layout>horizontal</Layout>
    <SizePolicy>me,min</SizePolicy>
    <Children>

      <WidgetGroup><!-- FxUnitControls -->
        <ObjectName>FxUnitControls</ObjectName>
        <Layout>vertical</Layout>
        <SizePolicy>min,me</SizePolicy>
        <Children>
          <WidgetGroup><!-- FX label + FX expand button -->
            <ObjectName>AlignCenter</ObjectName>
            <Layout>vertical</Layout>
            <SizePolicy>min,min</SizePolicy>
            <Children>
              <Label>
                <ObjectName>FxUnitLabel</ObjectName>
                <Size>28f,15f</Size>
                <Text>FX&#8202;<Variable name="FxUnit"/></Text>
                <Alignment>left</Alignment>
              </Label>

              <WidgetGroup><Size>1min,2f</Size></WidgetGroup>

              <Template src="skin:button_2state_persist.xml">
                <SetVariable name="ObjectName">FxSamplersMiniMaxi</SetVariable>
                <SetVariable name="TooltipId">EffectUnit_show_parameters</SetVariable>
                <SetVariable name="Size">30f,15f</SetVariable>
                <SetVariable name="ConfigKey">[<Variable name="FxRack_FxUnit"/>],show_parameters</SetVariable>
              </Template>

              <WidgetGroup><Size>1min,2f</Size></WidgetGroup>
            </Children>
          </WidgetGroup><!-- /FX label + FX expand button -->

          <WidgetGroup><!-- FxUnitMixer + Pfl button -->
            <ObjectName>Spacer0f</ObjectName>
            <Layout>horizontal</Layout>
            <SizePolicy>min,me</SizePolicy>
            <Children>

              <WidgetGroup><!-- FxUnitMixer -->
                <ObjectName>FxUnitMixer</ObjectName>
                <Layout>vertical</Layout>
                <SizePolicy>min,me</SizePolicy>
                <Children>

                  <Template src="skin:knob_textless.xml">
                    <SetVariable name="TooltipId">EffectUnit_mix</SetVariable>
                    <SetVariable name="ObjectName">SuperWetDryKnob</SetVariable>
                    <SetVariable name="Size">30min,26f</SetVariable>
                    <SetVariable name="group">[<Variable name="FxRack_FxUnit"/>]</SetVariable>
                    <SetVariable name="ConfigKey">mix</SetVariable>
                    <SetVariable name="Color">red</SetVariable>
                  </Template>

                  <Template src="skin:button_2state_persist.xml">
                    <SetVariable name="ObjectName">MixModeButton</SetVariable>
                    <SetVariable name="TooltipId">EffectUnit_mix_mode</SetVariable>
                    <SetVariable name="Size">30f,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>

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

                  <WidgetGroup><!-- Super Knob, if enabled -->
                    <SizePolicy>min,min</SizePolicy>
                    <Layout>vertical</Layout>
                    <Children>
                      <Template src="skin:knob_textless.xml">
                        <SetVariable name="TooltipId">EffectUnit_super1</SetVariable>
                        <SetVariable name="ObjectName">SuperWetDryKnob</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">[Master],show_superknobs</ConfigKey>
                      <BindProperty>visible</BindProperty>
                    </Connection>
                  </WidgetGroup><!-- /Super Knob, if enabled -->

                  <WidgetGroup><!-- additional spacer for Super Knob, if enabled -->
                    <SizePolicy>min,me</SizePolicy>
                    <Connection>
                      <ConfigKey persist="true">[Master],show_superknobs</ConfigKey>
                      <BindProperty>visible</BindProperty>
                    </Connection>
                  </WidgetGroup><!-- /additional spacer for Super Knob, if enabled -->

                  <WidgetGroup><!-- Headphone FX button -->
                    <ObjectName>AlignCenter</ObjectName>
                    <SizePolicy>min,max</SizePolicy>
                    <Layout>vertical</Layout>
                    <Children>
                      <WidgetGroup><!-- Headphone FX button -->
                        <SizePolicy>max,max</SizePolicy>
                        <Layout>stacked</Layout>
                        <Children>
                          <!-- index 0 due to bug -->
                          <WidgetGroup><Size>0f,0f</Size></WidgetGroup>

                          <!-- Greyed out if no headphone device is configured -->
                          <Template src="skin:pfl_cover.xml"/>

                          <Template src="skin:button_2state.xml">
                            <SetVariable name="ObjectName">PflButton</SetVariable>
                            <SetVariable name="TooltipId">EffectUnit_headphones_enabled</SetVariable>
                            <SetVariable name="Size">24f,24f</SetVariable>
                            <SetVariable name="state_0_icon">pfl_off.svg</SetVariable>
                            <SetVariable name="state_1_icon">pfl_on.svg</SetVariable>
                            <SetVariable name="ConfigKey">[<Variable name="FxRack_FxUnit"/>],group_[Headphone]_enable</SetVariable>
                          </Template>
                        </Children>
                      </WidgetGroup>
                    </Children>
                  </WidgetGroup><!-- /Headphone FX button -->

                </Children>
              </WidgetGroup><!-- /FxUnitMixer -->

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

            </Children>
          </WidgetGroup><!-- /FxUnitMixer + Pfl button -->
        </Children>
      </WidgetGroup><!-- /FxUnitControls -->

      <WidgetGroup><!-- EffectSlots + Underlays, with focus button -->
        <ObjectName>Spacer0f</ObjectName>
        <Layout>stacked</Layout>
        <SizePolicy>me,min</SizePolicy>
        <Children>
          <WidgetGroup><!-- EffectSlots with -->
            <Layout>vertical</Layout>
            <SizePolicy>min,min</SizePolicy>
            <Children>
              <WidgetGroup><!-- EffectSlot 1 -->
                <ObjectName>AlignLeft</ObjectName>
                <SizePolicy>min,min</SizePolicy>
                <Layout>horizontal</Layout>
                <Children>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_focus_button.xml"><SetVariable name="FxNum">1</SetVariable></Template>
                  <Template src="skin:fx_metaknob.xml"><SetVariable name="FxNum">1</SetVariable></Template>
                  <WidgetGroup><Size>2f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_toggle_selector.xml"><SetVariable name="FxNum">1</SetVariable></Template>
                  <WidgetGroup><Size>5f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_parameter_row.xml">
                    <SetVariable name="FxNum">1</SetVariable>
                    <SetVariable name="Side">Right</SetVariable>
                  </Template>
                  <WidgetGroup><Size>0min,1min</Size></WidgetGroup>
                </Children>
              </WidgetGroup><!-- /EffectSlot 1 -->

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

              <WidgetGroup><!-- EffectSlot 2 -->
                <ObjectName>AlignLeft</ObjectName>
                <SizePolicy>min,min</SizePolicy>
                <Layout>horizontal</Layout>
                <Children>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_focus_button.xml"><SetVariable name="FxNum">2</SetVariable></Template>
                  <Template src="skin:fx_metaknob.xml"><SetVariable name="FxNum">2</SetVariable></Template>
                  <WidgetGroup><Size>2f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_toggle_selector.xml"><SetVariable name="FxNum">2</SetVariable></Template>
                  <WidgetGroup><Size>5f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_parameter_row.xml">
                    <SetVariable name="FxNum">2</SetVariable>
                    <SetVariable name="Side">Right</SetVariable>
                  </Template>
                  <WidgetGroup><Size>0min,1min</Size></WidgetGroup>
                </Children>
              </WidgetGroup><!-- /EffectSlot 2 -->

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

              <WidgetGroup><!-- EffectSlot 3 -->
                <ObjectName>AlignLeft</ObjectName>
                <SizePolicy>min,min</SizePolicy>
                <Layout>horizontal</Layout>
                <Children>
                  <WidgetGroup><Size>4f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_focus_button.xml"><SetVariable name="FxNum">3</SetVariable></Template>
                  <Template src="skin:fx_metaknob.xml"><SetVariable name="FxNum">3</SetVariable></Template>
                  <WidgetGroup><Size>2f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_toggle_selector.xml"><SetVariable name="FxNum">3</SetVariable></Template>
                  <WidgetGroup><Size>5f,1min</Size></WidgetGroup>
                  <Template src="skin:fx_parameter_row.xml">
                    <SetVariable name="FxNum">3</SetVariable>
                    <SetVariable name="Side">Right</SetVariable>
                  </Template>
                </Children>
              </WidgetGroup><!-- /EffectSlot 3 -->
            </Children>
          </WidgetGroup><!-- /EffectSlots -->

          <WidgetGroup><!-- Underlays, no focus -->
            <ObjectName>Spacer0f</ObjectName>
            <Layout>vertical</Layout>
            <SizePolicy>me,min</SizePolicy>
            <Children>
              <WidgetGroup><!-- EffectSlot 1 -->
                <ObjectName>FxFlow_focus_background</ObjectName>
                <Size>-1me,8f</Size>
              </WidgetGroup>
              <WidgetGroup>
                <ObjectName>FxFlow_focus_background</ObjectName>
                <SizePolicy>me,me</SizePolicy>
              </WidgetGroup>

              <Template src="skin:fx_flow_noFocus_separator.xml">
                <SetVariable name="widthLeft">57f</SetVariable>
                <SetVariable name="widthRight">-1me</SetVariable>
              </Template>

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

              <Template src="skin:fx_flow_noFocus_separator.xml">
                <SetVariable name="widthLeft">57f</SetVariable>
                <SetVariable name="widthRight">-1me</SetVariable>
              </Template>

              <WidgetGroup><!-- EffectSlot 3 -->
                <ObjectName>FxFlow_focus_background</ObjectName>
                <SizePolicy>me,me</SizePolicy>
              </WidgetGroup>
              <WidgetGroup>
                <ObjectName>FxFlow_focus_background</ObjectName>
                <Size>-1me,8f</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 -->
            <ObjectName>Spacer0f</ObjectName>
            <Layout>vertical</Layout>
            <SizePolicy>me,min</SizePolicy>
            <Children>
              <Template src="skin:fx_flow_focus_background.xml">
                <SetVariable name="Size">-1me,8f</SetVariable>
                <SetVariable name="FxNum">1</SetVariable>
              </Template>
              <Template src="skin:fx_flow_focus_background.xml">
                <SetVariable name="Size">-1me-1me</SetVariable>
                <SetVariable name="FxNum">1</SetVariable>
              </Template>

              <Template src="skin:fx_flow_focus_separator.xml">
                <SetVariable name="widthLeft">71f</SetVariable>
                <SetVariable name="widthRight">-1me</SetVariable>
                <SetVariable name="FxTop">1</SetVariable>
                <SetVariable name="FxBottom">2</SetVariable>
              </Template>

              <Template src="skin:fx_flow_focus_background.xml">
                <SetVariable name="Size">-1me-1me</SetVariable>
                <SetVariable name="FxNum">2</SetVariable>
              </Template>

              <Template src="skin:fx_flow_focus_separator.xml">
                <SetVariable name="widthLeft">71f</SetVariable>
                <SetVariable name="widthRight">-1me</SetVariable>
                <SetVariable name="FxTop">2</SetVariable>
                <SetVariable name="FxBottom">3</SetVariable>
              </Template>

              <Template src="skin:fx_flow_focus_background.xml">
                <SetVariable name="Size">-1me-1me</SetVariable>
                <SetVariable name="FxNum">3</SetVariable>
              </Template>
              <Template src="skin:fx_flow_focus_background.xml">
                <SetVariable name="Size">-1me,8f</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, no focus -->
    </Children>
  </WidgetGroup><!-- /EffectUnit -->
</Template>
