<plugin resizable="true">
	<ui:set id="channels" value="${(ex :in_16) ? 16 : (ex :in_8) ? 8 : 4}"/>
	<ui:set id="has_solo" value="
	    :cs_1 or :cs_2 or :cs_3 or :cs_4 or
	    ((ex :cs_8) ? :cs_5 or :cs_6 or :cs_7 or :cs_8 : false) or
	    ((ex :cs_16) ? :cs_9 or :cs_10 or :cs_11 or :cs_12 or :cs_13 or :cs_14 or :cs_15 or :cs_16 : false)
	"/>

	<grid rows="9" cols="${3 * :channels + 2}" transpose="true" bg.color="bg_schema">
		<!-- Input channels -->
		<ui:for id="i" first="1" count=":channels">
			<!-- Column 1 -->
			<ui:if test=":i ieq 1">
				<cell cols="12">
					<hbox>
						<shmlink id="return" pad.v="4" pad.l="6"/>
						<shmlink id="send" pad.v="4" pad.h="6"/>
						<vsep bg.color="bg" pad.h="2" hreduce="true" hexpand="false"/>
						<void hexpand="true"/>
					</hbox>
				</cell>
			</ui:if>
			<ui:if test=":i igt 4">
				<cell cols="3" pad.v="4">
					<label/>
				</cell>
			</ui:if>
			<cell cols="3" bg.color="bg" pad.v="2" vreduce="true" vexpand="false">
				<hsep/>
			</cell>

			<cell cols="2" pad.v="4" pad.h="4">
				<edit ui:id="channel_name_${i}" bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? 0.75 : 1.0" bg.bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? :const_bg_darken : 1.0"/>
			</cell>
			<cell cols="2" bg.color="bg" pad.v="2" vreduce="true" vexpand="false">
				<hsep/>
			</cell>
			<cell cols="2" pad.v="4" pad.h="6">
				<shmlink id="ret_${i}" value.maxlen="3" text.clip="true" hfill="true"/>
			</cell>
			<cell cols="2" bg.color="bg" pad.v="2" vreduce="true" vexpand="false">
				<hsep/>
			</cell>
			<ui:with bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? 0.75 : 1.0" bg.bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? :const_bg_darken : 1.0">
				<cell cols="2" pad.v="4" pad.h="6">
					<hbox>
						<button id="cs_${i}" text="labels.chan.S_olo" ui:inject="Button_green_8" font.size="8" pad.r="6" hfill="true" expand="false"/>
						<button id="cm_${i}" text="labels.chan.M_ute" ui:inject="Button_red_8" font.size="8" pad.r="6" hfill="true" expand="false"/>
						<button id="ci_${i}" text="labels.chan.P_hase" ui:inject="Button_yellow_8" font.size="8" hfill="true" expand="false"/>
					</hbox>
				</cell>
			</ui:with>
			<cell cols="2" bg.color="bg" pad.v="2" vreduce="true" vexpand="false">
				<hsep/>
			</cell>
			<ui:with bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? 0.75 : 1.0" bg.bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? :const_bg_darken : 1.0">
				<vbox vexpand="true">
					<fader id="cg_${i}" vexpand="true" angle="1" pad.t="4" scolor="!(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? 'fader' : 'fader_inactive'"/>
					<value id="cg_${i}" vreduce="true" width.min="48" pad.b="4"/>
				</vbox>
			</ui:with>
			<ledmeter height.min="256" vexpand="true" angle="1" bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? :const_led_darken : 1.0" bg.bright="(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? :const_bg_darken : 1.0">
				<ledchannel
					id="cl_${i}"
					min="-72 db"
					max="12 db"
					log="true"
					type="rms_peak"
					peak.visibility="true"
					value.color="!(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? 'mono' : 'cycle_inactive'"
					yellow.color="!(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? 'meter_yellow' : 'cycle_inactive'"
					red.color="!(:cm_${i} or ((${has_solo}) and !:cs_${i})) ? 'meter_red' : 'cycle_inactive'"/>
			</ledmeter>

			<!-- Column 3 -->
			<cell rows="9" bg.color="bg" pad.h="2" hreduce="true" hexpand="false">
				<vsep/>
			</cell>

		</ui:for>

		<!-- Master section -->
		<!-- Column 1 -->
		<cell cols="2" rows="5">
			<label text="labels.chan.output"/>
		</cell>

		<cell cols="2" bg.color="bg" pad.v="2" vreduce="true" vexpand="false">
			<hsep/>
		</cell>

		<cell rows="9" cols="2" expand="false">

			<vbox>
				<grid rows="2" cols="5">
					<cell cols="5">
						<grid rows="4" cols="2">
							<label text="labels.signal.dry" pad.v="4" pad.h="6"/>
							<label text="labels.signal.wet" pad.v="4" pad.r="6"/>
							<knob id="dry" size="20" scolor="dry" pad.h="6"/>
							<knob id="wet" size="20" scolor="wet" pad.r="6"/>
							<value id="dry" sline="true" pad.l="6" width.min="48" pad.v="4" pad.r="6"/>
							<value id="wet" sline="true" pad.r="6" width.min="48" pad.v="4"/>

							<cell cols="2" bg.color="bg" pad.v="2" vreduce="true" vexpand="false">
								<hsep/>
							</cell>
						</grid>
					</cell>
					<vbox vexpand="true" bg.color="bg_schema">
						<label text="labels.chan.in" pad.b="3" pad.t="3"/>
						<ledmeter height.min="256" vexpand="true" angle="1">
							<ledchannel id="ilm" min="-72 db" max="12 db" log="true" type="rms_peak" peak.visibility="true" value.color="mono"/>
						</ledmeter>
					</vbox>
					<vsep bg.color="bg" pad.h="2" hreduce="true" hexpand="false"/>
					<vbox>
						<fader id="g_out" vexpand="true" angle="1" pad.t="4"/>
						<value id="g_out" vreduce="true" width.min="32" pad.b="4"/>
					</vbox>
					<vsep bg.color="bg" pad.h="2" hreduce="true" hexpand="false"/>
					<vbox vexpand="true" bg.color="bg_schema">
						<label text="labels.chan.out" pad.b="3" pad.t="3"/>
						<ledmeter height.min="256" vexpand="true" angle="1">
							<ledchannel id="olm" min="-72 db" max="12 db" log="true" type="rms_peak" peak.visibility="true" value.color="mono"/>
						</ledmeter>
					</vbox>
				</grid>
			</vbox>
		</cell>

	</grid>
</plugin>
