summaryrefslogtreecommitdiffstats
path: root/res/skins/LateNight/helpers/skin_helper_deck_size.xml
blob: ef10a8e580744503e20f77039904ecef2c814d37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!--

  Purpose:

      Inside deck.xml there are differently sized deck variants
        FULL
        Compact
        minimal
        (none)
      to be shown, depending on how the user has currently configured the skin.
      Controls taken into account are
        [Master],maximize_library
        [LateNight],max_lib_show_decks
        [Master],show_mixer
        [LateNight],deck_size_without_mixer
      deck.xml would be very complex if we'd want to cover all combinations there.
      To have a slim deck template this switch here does the selection and thus allows
      to remote-control what to show in deck.xml

      This is a widget hack to compensate the lack of proper GUI scripting (as of Mixxx 2.3)
      It is basically an analogue version of a simple script similiar to this:
      if (Library is maximized && minimal deck selected) {
          show minimal deck;
      } else {
          if (Mixer is shown) {
              enforce full deck;
          } else {
              show pre-selected deck;
          }
      }


  The Structure:

      The outer container is a WidgetGroup with a fixed width and a horizontal layout.

      On the left there are fixed-width blocks, where each is shown or hidden according
      to the state of one of the skin controls listed above.
      So, depending on how the user has configured the skin via the skin settings menu,
      those blocks define the remaining space on the right.

      At the right, there's a SizeAwareStack. It can react to the available space and show
      a fitting child widget at a time (if there is one that matches the current 'gap').

      The SizeAwareStack is packed with WidgetStacks.
      A WidgetStack can host several top-level child widgets but only one is shown at a time.
      Each child widget can have 'trigger' control that (when set to 1 elsewhere) would enforce
      the widget to be shown.
      When a hidden WidgetStack is shown and no child's trigger is addressed the first child is picked.
      As soon as that first child is shown its trigger control is set to 1 while the triggers of all
      siblings are set to 0. Consider this example:
        <WidgetStack>
          <Children>
            <WidgetGroup trigger="[LateNight],show_mini_deck">  // set to 1
            <WidgetGroup trigger="[LateNight],show_no_deck">    // set to 0
            <WidgetGroup trigger="[LateNight],show_full_deck">  // set to 0
          </Children>
        </WidgetStack>

      The hack here is to use [LateNight],show_mini_deck to show/hide a widget in an entirely
      different skin template and abuse the 1st-child trigger to remote-control it from here.


-->

<Template>
  <!-- Extra wrapper so we can put multiple, independent size detectors in here. -->
  <!-- Set height to 0f to hide it. -->
  <!-- Increase children's height >0 when needed for visual debugging -->
  <WidgetGroup>
    <Size>0me,0f</Size>
    <Layout>vertical</Layout>
    <ObjectName>AlignRight</ObjectName>
    <Children>

      <WidgetGroup>
        <Layout>horizontal</Layout>
        <Size>300f,0f</Size>
        <Children>

  <!-- Widgets that define the remaining space according to enabled skin controls -->
          <!-- maximize_library -->
          <WidgetGroup>
            <Connection>
              <ConfigKey>[Master],maximize_library</ConfigKey>
              <BindProperty>visible</BindProperty>
            </Connection>
            <Layout>horizontal</Layout>
            <SizePolicy>min,f</SizePolicy>
            <MinimumSize>200,0</MinimumSize>
            <MaximumSize>300,0</MaximumSize>
            <Children>
              <!-- minimal deck selected -->
              <WidgetGroup>
                <Size>300f,0f</Size>
                <Connection>
                  <ConfigKey persist="true">[LateNight],max_lib_show_decks</ConfigKey>
                  <Transform><Not/></Transform>
                  <BindProperty>visible</BindProperty>
                </Connection>
              </WidgetGroup>
            </Children>
          </WidgetGroup>
          <!-- maximize_library -->

          <!-- regular library -->
          <WidgetGroup>
            <Connection>
              <ConfigKey>[Master],maximize_library</ConfigKey>
              <Transform><Not/></Transform>
              <BindProperty>visible</BindProperty>
            </Connection>
            <Layout>horizontal</Layout>
            <SizePolicy>min,f</SizePolicy>
            <MinimumSize>0,0</MinimumSize>
            <MaximumSize>200,0</MaximumSize>
            <Children>

              <!-- no mixer -->
              <WidgetGroup>
                <Connection>
                  <ConfigKey>[Master],show_mixer</ConfigKey>
                  <Transform><Not/></Transform>
                  <BindProperty>visible</BindProperty>
                </Connection>
                <Layout>horizontal</Layout>
                <SizePolicy>min,f</SizePolicy>
                <MinimumSize>0,0</MinimumSize>
                <MaximumSize>200,0</MaximumSize>
                <Children>

                  <!-- Compact deck selected -->
                  <WidgetGroup>
                    <Size>100f,0f</Size>
                    <ObjectName>SET_COMPACT</ObjectName>
                    <Connection>
                      <ConfigKey persist="true">[LateNight],deck_size_without_mixer</ConfigKey>
                      <Transform><IsEqual>1</IsEqual></Transform>
                      <BindProperty>visible</BindProperty>
                    </Connection>
                  </WidgetGroup>

                  <!-- minimal deck selected -->
                  <WidgetGroup>
                    <Size>200f,0f</Size>
                    <ObjectName>SET_MINI</ObjectName>
                    <Connection>
                      <ConfigKey persist="true">[LateNight],deck_size_without_mixer</ConfigKey>
                      <Transform><IsEqual>0</IsEqual></Transform>
                      <BindProperty>visible</BindProperty>
                    </Connection>
                  </WidgetGroup>

                </Children>
              </WidgetGroup>
              <!-- no mixer -->

            </Children>
          </WidgetGroup>
          <!-- regular library -->


  <!-- Deck size detector -->
          <SizeAwareStack>
            <Children>
      <!-- control triggers -->

              <!-- no decks -->
              <!-- maximized library && decks disabled -->
              <WidgetStack>
                <SizePolicy>me,f</SizePolicy>
                <MinimumSize>0,0</MinimumSize>
                <MaximumSize>0,0</MaximumSize>
                <Children>
                  <WidgetGroup trigger="[LateNight],show_no_deck"><Size>0f,0f</Size></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_mini_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_compact_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_full_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                </Children>
              </WidgetStack>

              <!-- minimal deck -->
              <!-- maximized library || (mixer hidden && minimal deck selected) -->
              <WidgetStack>
                <SizePolicy>me,f</SizePolicy>
                <MinimumSize>100,0</MinimumSize>
                <MaximumSize>100,0</MaximumSize>
                <Children>
                  <WidgetGroup trigger="[LateNight],show_mini_deck"><Size>100f,0f</Size></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_compact_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_full_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_no_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                </Children>
              </WidgetStack>

              <!-- Compact deck -->
              <!-- mixer hidden && compact deck selected -->
              <WidgetStack>
                <SizePolicy>me,f</SizePolicy>
                <MinimumSize>200,0</MinimumSize>
                <MaximumSize>200,0</MaximumSize>
                <Children>
                  <WidgetGroup trigger="[LateNight],show_compact_deck"><Size>200f,0f</Size></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_full_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_mini_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_no_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                </Children>
              </WidgetStack>

              <!-- FULL deck -->
              <!-- mixer shown || (mixer hidden && full deck selected) -->
              <WidgetStack>
                <SizePolicy>me,f</SizePolicy>
                <MinimumSize>300,0</MinimumSize>
                <MaximumSize>300,0</MaximumSize>
                <Children>
                  <WidgetGroup trigger="[LateNight],show_full_deck"><Size>300f,0f</Size></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_compact_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_mini_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                  <WidgetGroup trigger="[LateNight],show_no_deck"><SizePolicy>me,me</SizePolicy></WidgetGroup>
                </Children>
              </WidgetStack>
            </Children>
          </SizeAwareStack>

        </Children>
      </WidgetGroup>
    </Children>
  </WidgetGroup>
</Template>