<Template>
  <SetVariable name="ArcRadius"><Variable name="ArcRadiusCompact"/></SetVariable>
  <SetVariable name="ArcThickness"><Variable name="ArcThicknessBig"/></SetVariable>
  <SetVariable name="ArcUnipolar">true</SetVariable>

  <!-- Let's create Singletons for widgets we use multiple times
      at different places in each effect unit:
      * Meta knob
      * Effect selector
      * Effect toggle
      * Fx unit label
      * expand/collapse button
      -->
  <Template src="skins:LateNight/fx/singletons.xml">
    <SetVariable name="FxUnit">1</SetVariable>
    <SetVariable name="ArcColorSuper"><Variable name="ArcColorFx12Quick"/></SetVariable>
    <SetVariable name="KnobColor"><Variable name="KnobColorFx12"/></SetVariable>
  </Template>
  <Template src="skins:LateNight/fx/singletons.xml">
    <SetVariable name="FxUnit">2</SetVariable>
    <SetVariable name="ArcColorSuper"><Variable name="ArcColorFx12Quick"/></SetVariable>
    <SetVariable name="KnobColor"><Variable name="KnobColorFx12"/></SetVariable>
  </Template>
  <Template src="skins:LateNight/fx/singletons.xml">
    <SetVariable name="FxUnit">3</SetVariable>
    <SetVariable name="ArcColorSuper"><Variable name="ArcColorFx34"/></SetVariable>
    <SetVariable name="KnobColor"><Variable name="KnobColorFx34"/></SetVariable>
  </Template>
  <Template src="skins:LateNight/fx/singletons.xml">
    <SetVariable name="FxUnit">4</SetVariable>
    <SetVariable name="ArcColorSuper"><Variable name="ArcColorFx34"/></SetVariable>
    <SetVariable name="KnobColor"><Variable name="KnobColorFx34"/></SetVariable>
  </Template>

  <WidgetGroup>
    <ObjectName>AlignTop</ObjectName>
    <Layout>horizontal</Layout>
    <SizePolicy>me,max</SizePolicy>
    <Children>
      <!-- These two  racks host 4 effect units total which can be displayed
          in various combinations:
          * 1 effect unit
          * 2 effect units
          * with controller mappings:
            only those effect units the controller is currently mapped to
            (matching the default midi-components.js mapping:
             left side: units 1 and 3, right side: units 2 and 4)
          -->

      <!-- EffectUnit 1 + 3 -->
      <WidgetGroup>
        <Layout>vertical</Layout>
        <SizePolicy>me,min</SizePolicy>
        <Children>

          <!-- EffectUnit 1 -->
          <WidgetGroup>
            <Layout>vertical</Layout>
            <SizePolicy>i,min</SizePolicy>
            <Children>
              <Template src="skins:LateNight/fx/unit.xml">
                <SetVariable name="FxUnit">1</SetVariable>
              </Template>

              <WidgetGroup>
                <ObjectName>FxRackFillerL</ObjectName>
                <SizePolicy>min,me</SizePolicy>
                <Connection>
                  <ConfigKey>[EffectRack1_EffectUnit2],show_parameters</ConfigKey>
                  <BindProperty>visible</BindProperty>
                </Connection>
              </WidgetGroup>
            </Children>
          </WidgetGroup>

          <!-- EffectUnit 3 -->
          <WidgetGroup>
            <Layout>vertical</Layout>
            <SizePolicy>i,min</SizePolicy>
            <Children>
              <Template src="skins:LateNight/fx/unit.xml">
                <SetVariable name="FxUnit">3</SetVariable>
              </Template>

              <WidgetGroup>
                <ObjectName>FxRackFillerL</ObjectName>
                <SizePolicy>min,me</SizePolicy>
                <Connection>
                  <ConfigKey>[EffectRack1_EffectUnit4],show_parameters</ConfigKey>
                  <BindProperty>visible</BindProperty>
                </Connection>
              </WidgetGroup>
            </Children>
            <Connection>
              <ConfigKey>[Skin],show_4effectunits</ConfigKey>
              <BindProperty>visible</BindProperty>
            </Connection>
          </WidgetGroup>
        </Children>
      </WidgetGroup><!-- EffectUnit 1 + 3 -->

      <!-- EffectUnit 2 + 4 -->
      <WidgetGroup>
        <Layout>vertical</Layout>
        <SizePolicy>me,min</SizePolicy>
        <Children>
          <!-- EffectUnit 2 -->
          <WidgetGroup>
            <Layout>vertical</Layout>
            <SizePolicy>i,min</SizePolicy>
            <Children>
              <Template src="skins:LateNight/fx/unit.xml">
                <SetVariable name="FxUnit">2</SetVariable>
              </Template>

              <WidgetGroup>
                <ObjectName>FxRackFillerR</ObjectName>
                <SizePolicy>min,me</SizePolicy>
                <Connection>
                  <ConfigKey>[EffectRack1_EffectUnit1],show_parameters</ConfigKey>
                  <BindProperty>visible</BindProperty>
                </Connection>
              </WidgetGroup>
            </Children>
          </WidgetGroup>

          <!-- EffectUnit 4 -->
          <WidgetGroup>
            <Layout>vertical</Layout>
            <SizePolicy>i,min</SizePolicy>
            <Children>
              <Template src="skins:LateNight/fx/unit.xml">
                <SetVariable name="FxUnit">4</SetVariable>
              </Template>

              <WidgetGroup>
                <ObjectName>FxRackFillerR</ObjectName>
                <SizePolicy>min,me</SizePolicy>
                <Connection>
                  <ConfigKey>[EffectRack1_EffectUnit3],show_parameters</ConfigKey>
                  <BindProperty>visible</BindProperty>
                </Connection>
              </WidgetGroup>
            </Children>
            <Connection>
              <ConfigKey>[Skin],show_4effectunits</ConfigKey>
              <BindProperty>visible</BindProperty>
            </Connection>
          </WidgetGroup>
        </Children>
      </WidgetGroup><!-- EffectUnit 2 + 4 -->

    </Children>
    <Connection>
      <ConfigKey>[Skin],show_effectrack</ConfigKey>
      <BindProperty>visible</BindProperty>
    </Connection>
  </WidgetGroup>
</Template>
