<!--
Description:
  Container for both minimal and full Sampler.
  Play button and Cover Art are loaded as Singleton, they appear
  in both minimal and full version.
Variables:
  samNum          : sampler deck number
  row             : number of the parent sampler row, use for expand/collapse
  PlayedOverlayColor  : defined in skin.xml
-->
<Template>
  <SetVariable name="sourceType">sampler</SetVariable>
  <SetVariable name="group">[Sampler<Variable name="samNum"/>]</SetVariable>
  <SingletonDefinition>
    <ObjectName>Sampler<Variable name="samNum"/>_Play_Cover</ObjectName>
    <Children>
      <WidgetGroup>
        <Layout>stacked</Layout>
        <Children>
          <Template src="skin:button_2state_right_display.xml">
            <SetVariable name="ObjectName">SamplerPlayCue</SetVariable>
            <SetVariable name="TooltipId">cue_gotoandplay_cue_default</SetVariable>
            <SetVariable name="Size">34f,34f</SetVariable>
            <SetVariable name="state_0_icon">play_sampler.svg</SetVariable>
            <SetVariable name="state_1_icon">pause_sampler.svg</SetVariable>
            <SetVariable name="ConfigKey"><Variable name="group"/>,cue_gotoandplay</SetVariable>
            <SetVariable name="ConfigKeyRight"><Variable name="group"/>,cue_default</SetVariable>
            <SetVariable name="ConfigKeyDisp"><Variable name="group"/>,play_indicator</SetVariable>
          </Template>
      <!-- Second layer is CoverArt. DefaultCover is transparent, bg-color #333 -->
          <CoverArt>
            <ObjectName>SamplerCover</ObjectName>
            <Size>34f,34f</Size>
            <Group><Variable name="group"/></Group>
            <DefaultCover>graphics/blank_1x1.svg</DefaultCover>
          </CoverArt>
      <!-- Background turns Orange when playing preview from Cue/HotCue.
          Only visible when play_indicator=0 -->
          <Template src="skin:button_2state.xml">
            <SetVariable name="ObjectName">SamplerPlayCueUnderlay</SetVariable>
            <SetVariable name="Size">34f,34f</SetVariable>
            <SetVariable name="ConfigKey"><Variable name="group"/>,play</SetVariable>
          </Template>
        </Children>
      </WidgetGroup>
    </Children>
  </SingletonDefinition>

  <WidgetGroup><!-- mini Sampler -->
    <Layout>horizontal</Layout>
    <ObjectName>SamplerDeck</ObjectName>
    <SizePolicy>me,min</SizePolicy>
    <Children>

      <WidgetGroup><!-- Play/Cue + Cover-->
        <ObjectName>SamplerPlayBox_mini</ObjectName>
        <Layout>horizontal</Layout>
        <Size>35f,34f</Size>
        <Children>
          <SingletonContainer>
            <ObjectName>Sampler<Variable name="samNum"/>_Play_Cover</ObjectName>
          </SingletonContainer>
        </Children>
      </WidgetGroup>

      <WidgetGroup><!-- Title + [Sync, CF assign, Volume] -->
        <ObjectName>Spacer33</ObjectName>
        <Layout>vertical</Layout>
        <Size>84me,34f</Size>
        <Children>

          <TrackProperty>
            <ObjectName>SamplerTitle_mini</ObjectName>
            <TooltipId>text</TooltipId>
            <Size>i,14f</Size>
            <Group><Variable name="group"/></Group>
            <Property>title</Property>
          </TrackProperty>

          <WidgetGroup><!-- Sync, CF assign, Volume -->
            <Layout>horizontal</Layout>
            <Size>82me,20f</Size>
            <Children>

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

              <WidgetGroup>
                <ObjectName>SamplerGainKnob</ObjectName>
                <Layout>vertical</Layout>
                <Children>
                  <KnobComposed>
                    <TooltipId>pregain</TooltipId>
                    <Size>24f,20f</Size>
                    <Knob>knobs_sliders/knob_tiny_red.svg</Knob>
                    <BackPath>knobs_sliders/knob_bg.svg</BackPath>
                    <MinAngle><Variable name="PotiMinAngle"/></MinAngle>
                    <MaxAngle><Variable name="PotiMaxAngle"/></MaxAngle>
                    <KnobCenterYOffset>1.364</KnobCenterYOffset>
                    <Connection>
                      <ConfigKey><Variable name="group"/>,volume</ConfigKey>
                    </Connection>
                  </KnobComposed>
                </Children>
              </WidgetGroup>

              <!-- Instead of a plain spacer I chose <TrackProperty> here,
                  so that tracks from library can be dropped on 'empty space' -->
              <TrackProperty>
                <ObjectName>Text33</ObjectName>
                <TooltipId>text</TooltipId>
                <Size>1me,1min</Size>
                <Group><Variable name="group"/></Group>
                <Property>durationFormatted</Property>
              </TrackProperty>

              <Template src="skin:button_3state.xml">
                <SetVariable name="TooltipId">orientation</SetVariable>
                <SetVariable name="ObjectName">SamplerButton</SetVariable>
                <SetVariable name="Size">16f,16f</SetVariable>
                <SetVariable name="state_0_icon">sampler_xfader_left_white.svg</SetVariable>
                <SetVariable name="state_1_icon">sampler_xfader_center.svg</SetVariable>
                <SetVariable name="state_2_icon">sampler_xfader_right_white.svg</SetVariable>
                <SetVariable name="ConfigKey"><Variable name="group"/>,orientation</SetVariable>
              </Template>

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

              <Template src="skin:button_1state_right.xml">
                <SetVariable name="TooltipId">beatsync_beatsync_tempo</SetVariable>
                <SetVariable name="ObjectName">SamplerSyncButton</SetVariable>
                <SetVariable name="Size">18f,18f</SetVariable>
                <SetVariable name="state_0_unpressed">sampler_sync_off.svg</SetVariable>
                <SetVariable name="state_0_pressed">sampler_sync_on.svg</SetVariable>
                <SetVariable name="ConfigKey"><Variable name="group"/>,beatsync</SetVariable>
                <SetVariable name="ConfigKeyRight"><Variable name="group"/>,beatsync_tempo</SetVariable>
              </Template>

              <WidgetGroup><Size>1f,1min</Size></WidgetGroup>
            </Children>
          </WidgetGroup><!-- Sync, CF assign, Volume -->

        </Children>
      </WidgetGroup><!-- /Title + [Sync, CF assign, Volume] -->

    </Children>
    <Connection>
      <ConfigKey persist="true">[SamplerRow<Variable name="row"/>],expanded</ConfigKey>
      <Transform><Not/></Transform>
      <BindProperty>visible</BindProperty>
    </Connection>
  </WidgetGroup><!-- /mini Sampler -->

  <WidgetGroup><!-- Maxi Sampler -->
    <ObjectName>SamplerDeck</ObjectName>
    <Layout>vertical</Layout>
    <SizePolicy>me,min</SizePolicy>
    <Children>

      <WidgetGroup><!-- [ Title + [Play / Overview] ] + VU / Tempo -->
        <ObjectName></ObjectName>
        <Layout>horizontal</Layout>
        <Size>119me,54f</Size>
        <Children>
          <WidgetGroup><!-- Title + [Play / Overview] -->
            <ObjectName></ObjectName>
            <Layout>vertical</Layout>
            <Size>89me,54f</Size>
            <Children>

              <TrackProperty>
                <ObjectName>SamplerTitle</ObjectName>
                <TooltipId>text</TooltipId>
                <Size>i,18f</Size>
                <Group><Variable name="group"/></Group>
                <Property>title</Property>
                <Elide>right</Elide>
              </TrackProperty>

              <WidgetGroup><!-- Play / Overview -->
                <Layout>horizontal</Layout>
                <Size>1me,36f</Size>
                <ObjectName></ObjectName>
                <Children>

                  <WidgetGroup><!-- Play/Cue + Cover-->
                    <ObjectName>SamplerPlayBox</ObjectName>
                    <Layout>vertical</Layout>
                    <Size>35f,36f</Size>
                    <Children>
                      <WidgetGroup><Size>0min,1f</Size></WidgetGroup>
                      <SingletonContainer>
                        <ObjectName>Sampler<Variable name="samNum"/>_Play_Cover</ObjectName>
                      </SingletonContainer>
                      <WidgetGroup><Size>0min,1f</Size></WidgetGroup>
                    </Children>
                  </WidgetGroup>

                  <Overview>
                    <ObjectName>SamplerOverview</ObjectName>
                    <TooltipId>waveform_overview</TooltipId>
                    <SizePolicy>me,min</SizePolicy>
                    <Group><Variable name="group"/></Group>
                    <BgColor>#151515</BgColor>
                    <SignalColor>#bababa</SignalColor>
                    <PlayPosColor>#FF4300</PlayPosColor>
                    <PlayedOverlayColor><Variable name="PlayedOverlayColor"/></PlayedOverlayColor>
                    <MarkerColor>#00FF00</MarkerColor>
                    <DefaultMark>
                      <Align>bottom|right</Align>
                      <Color>#00FF00</Color>
                      <TextColor>#FFFFFF</TextColor>
                      <Text> %1 </Text>
                    </DefaultMark>
                    <Mark>
                      <Control>cue_point</Control>
                      <Text>Q</Text>
                      <Align>top|right</Align>
                      <Color>#FF0080</Color>
                      <TextColor>#FFFFFF</TextColor>
                    </Mark>
                    <Connection>
                      <ConfigKey><Variable name="group"/>,playposition</ConfigKey>
                    </Connection>
                  </Overview>

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

                  <Template src="skin:vumeter_mini.xml">
                    <SetVariable name="Size">6f,1me</SetVariable>
                  </Template>

                </Children>
              </WidgetGroup><!-- /Play / Overview -->

            </Children>
          </WidgetGroup><!-- /Title + [Play / Overview] -->
    
          <SliderComposed>
            <ObjectName>SamplerPitchSlider</ObjectName>
            <TooltipId>rate</TooltipId>
            <Size>20f,54f</Size>
            <Handle scalemode="STRETCH_ASPECT">knobs_sliders/pitch_sampler_handle.svg</Handle>
            <Slider scalemode="STRETCH_ASPECT">knobs_sliders/pitch_sampler_scale.svg</Slider>
            <Horizontal>false</Horizontal>
            <Connection>
              <ConfigKey><Variable name="group"/>,rate</ConfigKey>
            </Connection>
          </SliderComposed>

        </Children>
      </WidgetGroup><!-- /[ Title + [Play / Overview] ] + VU / Tempo -->

      <WidgetGroup><!-- Sampler Buttons -->
        <ObjectName>Spacer33</ObjectName>
        <Layout>horizontal</Layout>
        <Size>1me,20f</Size>
        <Children>

          <WidgetGroup><!-- Gain knob, expanding to be centered below Play/Cover -->
            <ObjectName>SamplerGainKnob</ObjectName>
            <Layout>horizontal</Layout>
            <MinimumSize>20,20</MinimumSize>
            <MaximumSize>34,20</MaximumSize>
            <SizePolicy>me,f</SizePolicy>
            <Children>
              <KnobComposed>
                <TooltipId>pregain</TooltipId>
                <Size>24f,20f</Size>
                <Knob>knobs_sliders/knob_tiny_red.svg</Knob>
                <BackPath>knobs_sliders/knob_bg.svg</BackPath>
                <MinAngle><Variable name="PotiMinAngle"/></MinAngle>
                <MaxAngle><Variable name="PotiMaxAngle"/></MaxAngle>
                <KnobCenterYOffset>1.364</KnobCenterYOffset>
                <Connection>
                  <ConfigKey><Variable name="group"/>,volume</ConfigKey>
                </Connection>
              </KnobComposed>
            </Children>
          </WidgetGroup>

          <WidgetGroup><!-- Pfl button -->
            <Size>20f,20f</Size>
            <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="TooltipId">pfl</SetVariable>
                <SetVariable name="ObjectName">PflButton</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"><Variable name="group"/>,pfl</SetVariable>
              </Template>
            </Children>
          </WidgetGroup><!-- /Pfl button -->

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

          <Template src="skin:button_2state.xml">
            <SetVariable name="TooltipId">repeat</SetVariable>
            <SetVariable name="ObjectName">SamplerButton</SetVariable>
            <SetVariable name="Size">16f,16f</SetVariable>
            <SetVariable name="state_0_icon">sampler_repeat_off.svg</SetVariable>
            <SetVariable name="state_1_icon">sampler_repeat_on.svg</SetVariable>
            <SetVariable name="ConfigKey"><Variable name="group"/>,repeat</SetVariable>
          </Template>

          <Template src="skin:button_1state.xml">
            <SetVariable name="TooltipId">eject</SetVariable>
            <SetVariable name="ObjectName">SamplerButton</SetVariable>
            <SetVariable name="Size">14f,16f</SetVariable>
            <SetVariable name="state_0_pressed">sampler_eject_pressed.svg</SetVariable>
            <SetVariable name="state_0_unpressed">sampler_eject.svg</SetVariable>
            <SetVariable name="ConfigKey"><Variable name="group"/>,eject</SetVariable>
          </Template>

          <Template src="skin:button_2state.xml">
            <SetVariable name="TooltipId">keylock</SetVariable>
            <SetVariable name="ObjectName">SamplerButton</SetVariable>
            <SetVariable name="Size">14f,16f</SetVariable>
            <SetVariable name="state_0_icon">sampler_keylock_off.svg</SetVariable>
            <SetVariable name="state_1_icon">sampler_keylock_on.svg</SetVariable>
            <SetVariable name="ConfigKey"><Variable name="group"/>,keylock</SetVariable>
          </Template>

          <Template src="skin:button_3state.xml">
            <SetVariable name="TooltipId">orientation</SetVariable>
            <SetVariable name="ObjectName">SamplerButton</SetVariable>
            <SetVariable name="Size">16f,16f</SetVariable>
            <SetVariable name="state_0_icon">sampler_xfader_left_white.svg</SetVariable>
            <SetVariable name="state_1_icon">sampler_xfader_center.svg</SetVariable>
            <SetVariable name="state_2_icon">sampler_xfader_right_white.svg</SetVariable>
            <SetVariable name="ConfigKey"><Variable name="group"/>,orientation</SetVariable>
          </Template>

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

          <Template src="skin:button_1state_right.xml">
            <SetVariable name="TooltipId">beatsync_beatsync_tempo</SetVariable>
            <SetVariable name="ObjectName">SamplerSyncButton</SetVariable>
            <SetVariable name="Size">18f,18f</SetVariable>
            <SetVariable name="state_0_unpressed">sampler_sync_off.svg</SetVariable>
            <SetVariable name="state_0_pressed">sampler_sync_on.svg</SetVariable>
            <SetVariable name="ConfigKey"><Variable name="group"/>,beatsync</SetVariable>
            <SetVariable name="ConfigKeyRight"><Variable name="group"/>,beatsync_tempo</SetVariable>
          </Template>

          <WidgetGroup><Size>1f,1min</Size></WidgetGroup>
        </Children>
      </WidgetGroup><!-- /Sampler Buttons -->

      <Template src="skin:hotcues_sampler_preview.xml"/>

    </Children>
    <Connection>
      <ConfigKey persist="true">[SamplerRow<Variable name="row"/>],expanded</ConfigKey>
      <BindProperty>visible</BindProperty>
    </Connection>
  </WidgetGroup><!-- /Maxi Sampler -->
</Template>
