; Copyright (C) 2015 and onward Cockos Inc
; LICENSE: LGPL v2 or later - http://www.gnu.org/licenses/lgpl.html

version 7.0
use_pngs 1
use_overlays 1
warnings all
tinttcp 298
peaksedges 0
tcp_showborders 0
mcp_showborders 0
trans_showborders 0
tcp_folderindent 0
tcp_heights 5 25 54 64
envcp_min_height 27
mcp_min_height 220 80
misc_dpi_translate 50 100
misc_dpi_translate 134 150
misc_dpi_translate 174 200

tcp_vol_zeroline FF666666
;tcp_pan_zeroline 66000000
mcp_vol_zeroline 85000000
;mcp_pan_zeroline 85000000
trans_speed_zeroline FF888888
gen_vol_zeroline FF777777
gen_pan_zeroline FF777777

tcp_voltext_flags 13
tcp_master_voltext_flags 13
mcp_voltext_flags 13
;mcp_master_voltext_flags 13

adjuster_script "Default_7.0_theme_adjuster.lua"

; font #1/6/11 - calibri 8
; font #2/7/12 - calibri 9
; font #3/8/13 - calibri 10
; font #4/9/14 - calibri 11
; font #5/10/15 - calibri 12

macro drawTcpCustomButtons 

;----------------------------------User Area------------------------------------------------------------------------------

;-------"ButtonText" ActionID "This Text Appears on Mouseover"------------------------------------------

;----------------------------Custom Buttons Set 1------------------------------------------------------

    custom tcp.custom.x1                "C" 40360 "Track: Set to one random color"
    custom tcp.custom.y1                "D" 40062 "Track: Duplicate tracks"
    custom tcp.custom.z1                "FOLDR" 42785 "Track: Move tracks to new folder"

;----------------------------Custom Buttons Set 2------------------------------------------------------

    custom tcp.custom.x2                "W" _RS8971d98edc3d0bbfc747e3717f63e4143b267fc2 "Toggle Width Knob"
    custom tcp.custom.y2                "FX" 40298 "Toggle FX bypass"
    custom tcp.custom.z2                "ENV" _RS6d1222409505f37395e00b5fcad4667a27324de2 "Show/hide track envelope for last touched FX parameter"
    custom tcp.custom.u2                "DUPLI" _RSfbab3f4cea44cdaa45c4aa6c0d726f9e2e724be8 "Script: Duplicate Track And Selected Items.lua"

;----------------------------------End of User Area----------------------------------------------------------------------

endmacro

macro Line value margin r g b ; tcp
    custom tcp.custom.##value
          set  tcp.custom.##value  [0 margin value{0} 2 0 0 0 0]
          set  tcp.custom.##value##.color [r g b 255 r g b 255] 
    front tcp.custom.##value
endmacro

macro Line2 value margin r g b  ; env
    custom envcp.custom.##value
          set  envcp.custom.##value  [0 margin value{0} 2 0 0 0 0]
          set  envcp.custom.##value##.color [r g b 255 r g b 255] 
    front envcp.custom.##value
endmacro

macro Line3 value margin r g b  ; mcp
    custom mcp.custom.##value
          set  mcp.custom.##value  [0 margin value{0} 2 0 0 0 0]
          set  mcp.custom.##value##.color [r g b 255 r g b 255] 
    front mcp.custom.##value
endmacro

macro brightnessFromRGB R G B output
	set output / + + * R 299 * G 587 * B 114 1000
endmacro

;raw params separator
;define_parameter aa0 				'' 0 0 1
define_parameter aa1 				'GLOBAL' 1 0 0
define_parameter aa2 				'_______________________________________________________________' 0 0 0
define_parameter aa3 				'_______________________________________________________________' 0 0 0


define_parameter textBrightness 				'Text Brightness' 100 50 150
define_parameter tcpBgColAll						'Background Brightness' 51 0 255
define_parameter NumberSectionSat                           'Soft Color Number Section' 1 0 1
define_parameter customColorDepthParam 			'Custom Color Strength' 2 0 100
define_parameter selectStrength 				'Selection Overlay Strength' 15 0 100
define_parameter colorTrackLabels 				'Custom Color Track Labels' 1 0 1
define_parameter selInvertLabels 				'Selection Highlights Labels' 0 0 1
define_parameter ColoredSelection                              'Colored Track Selection' 0 0 1
define_parameter selDot 						'Selection Dot' 0 0 1


set tcpBgColR tcpBgColAll
set tcpBgColG tcpBgColAll
set tcpBgColB tcpBgColAll

set masterTcpBgColR tcpBgColR
set masterTcpBgColG tcpBgColG
set masterTcpBgColB tcpBgColB

set envcpBgColR tcpBgColR
set envcpBgColG tcpBgColG
set envcpBgColB tcpBgColB

set mcpBgColR tcpBgColR
set mcpBgColG tcpBgColG
set mcpBgColB tcpBgColB

set masterMcpBgColR tcpBgColR
set masterMcpBgColG tcpBgColG
set masterMcpBgColB tcpBgColB

brightnessFromRGB 								trackcolor_r trackcolor_g trackcolor_b cColorBrightness
set cColorTextOnDark							cColorBrightness{0}<75 + [100 100 100] * 2 [trackcolor_r trackcolor_g trackcolor_b] [trackcolor_r trackcolor_g trackcolor_b] 
set customColorDepthParam                                    *   customColorDepthParam 2.55
set customColorRatio 							?trackcolor_valid / customColorDepthParam{0} 100 0
set selectColRatio 								?track_selected / selectStrength{0} 100 0

#>---------------------------- TRACK CONTROL PANELS -----------------------------------

;--GLOBAL TCP PARAMS --


;define_parameter aaa0 				'' 0 0 0
define_parameter aaa1 				'TRACK CONTROL PANEL' 1 0 0
define_parameter aaa2 				'_______________________________________________________________' 0 0 0
define_parameter aaa3 				'_______________________________________________________________' 0 0 0


set visSections 					0
set sectionMargin 					 6
set xMargin 						 4
set yMargin 						 6
set tcpfolderBalanceType			 0
set IndentInfillColor                                   [0 0 0 0 31 31 31]


macro drawTcp thisLayout Scale 

drawTcpCustomButtons

clear tcp.*

set   tcpFXPanelOn    + tcp_fxlist_enabled{0} tcp_sends_enabled{0} 
set   tcpFXPanelOn  tcpFXPanelOn{0}>0  ?Layout##thisLayout##-tcpFXPanelOff{0} 0 1
set tcpfolderIndentSizeN        * tcpfolderIndentSize -1
set ShowRecInput             !Layout##thisLayout##-ShowRecIn{0}=2        [1]        ?recarm [1]  [0]      
set ShowRecInput          ?Layout##thisLayout##-ShowRecIn{0}=0      [0] 
set tcpFXPanelSize   - Layout##thisLayout##-tcpFXPanelSize{0} 22
set tcpFXPanelSize   tcpFXPanelOn{0}>0 [tcpFXPanelSize] [-22]   ; if disabled in Reaper options  
set TranspFXSect        +   * [Layout##thisLayout##-TranspFXSect{0}] [-1] [256] 
set tcpMeterSize   + Layout##thisLayout##-tcpMeterSize 1
set tcpMeterSize2   - Layout##thisLayout##-tcpMeterSize2 1
set Mcorr * tcpMeterSize -1


;-- HOUSEKEEPING --

set Scale 										[Scale Scale Scale Scale Scale Scale Scale Scale] ; ohOK
set tcp.size 							+	[tcpFXPanelSize{0} 0 0] 	* Scale - [175 100 40] h>=43 [Mcorr{0} 0 0] [0 0 0]
set singleRowH 									* Scale + 20 * 2 sectionMargin{0}
set ySqueeze 									h<singleRowH{0} - * Scale sectionMargin{0} * 0.5 - singleRowH{0} - h 1 * Scale sectionMargin{0}	
set supercollapsedMinH							* Scale 5						  
set supercollapsedH								h<supercollapsedMinH{0} 1 0
set textBrightnessMult							* textBrightness{0} 0.01		

;-- TCP SECTIONS (pt.1) --	

set thisTcpfolderIndent							* - maxfolderdepth - maxfolderdepth folderdepth tcpfolderIndentSize
set tcpFolderBalancer							tcpfolderBalanceType{0}>0 * - maxfolderdepth folderdepth tcpfolderIndentSize

set tcpFoldB                                            tcpfolderBalType{0}>0   maxfolderdepth  folderdepth
set tcpFoldB2                                          tcpfolderBalType{0}==2    tcpFoldB    folderdepth

;----------SELECTION DOT----------------
custom tcp.custom.tcpDiv
	set tcp.custom.tcpDiv 						- + * Scale * [1 0 -1] thisTcpfolderIndent [0 h w 1] [0 1] 
	set tcp.custom.tcpDiv.color 				* Scale [0 0 0 0 0 0 0 Layout##thisLayout##-tcpDivOpacity{0}]								
custom tcp.custom.sectionNumber
	set tcp.custom.sectionNumber 				+ - [0 0 0 h] [0 0 0 1] * Scale [thisTcpfolderIndent 0 20]
	set tcp.custom.sectionNumber.color 		!NumberSectionSat	?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b] [0 0 0 0 100 110 120 255] ?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b 170] [0 0 0 0 100 105 110 255] 	

;----------FOLDER----------------
	set tcp.foldercomp							?supercollapsedH{0} [0] + [tcp.custom.sectionNumber] * Scale [0 0 20 18]
	set tcp.folder                  			?supercollapsedH{0} [0] + [tcp.custom.sectionNumber h] * Scale [0 -15 20 15]
	front tcp.folder
	set tcp_folder_min							* Scale folderstate==1 52 34
	set tcp.folder                				h<tcp_folder_min{0} folderstate<0 . [0] .
	brightnessFromRGB 							trackcolor_r trackcolor_g trackcolor_b tcpSectionNumberBrightness

;----------TRACK NUMBER----------------
	set tcp.trackidx				h>5			?supercollapsedH{0} [0] + tcp.custom.sectionNumber * Scale folderstate==1 [0 16 0 -16] folderstate<0 [0 -10 0 10] [0]
	set tcp.trackidx.margin						+ [0 0 0 0 0.5] trackidx<100 - * 0.5 + ?selDot{0} [0 0 8] [0] [0 tcp.trackidx{3} 0 tcp.trackidx{3}] [0 10 0 10] [3 0 7 0]
	set tcp.trackidx.color 			!NumberSectionSat		 	tcpSectionNumberBrightness{0}>135 [0 0 0 255 0 0 0 0] [255 255 255 255 0 0 0 0] tcpSectionNumberBrightness{0}>138 [0 0 0 255 0 0 0 0] [225 225 225 255 0 0 0 0] 	 	
	set tcp.trackidx.font						trackidx<100  [3] [3] 


set tcp.dragdropinfo 							+ [0 tcp.custom.sectionNumber{2}] * Scale [thisTcpfolderIndent thisTcpfolderIndent]	
custom tcp.custom.indentInfill
	set tcp.custom.indentInfill					[0 0 tcp.custom.sectionNumber{0} h]
	set tcp.custom.indentInfill.color			IndentInfillColor

;----------TRACK NUMBER DIVIDER----------------
custom tcp.custom.sectionNumberDiv
	set tcp.custom.sectionNumberDiv				+ + [tcp.custom.sectionNumber tcp.custom.sectionNumber 1 tcp.custom.sectionNumber] [tcp.custom.sectionNumber{2}] [-1]
	set tcp.custom.sectionNumberDiv.color		* Scale [0 0 0 0 0 0 0 Layout##thisLayout##-tcpDivOpacity{0}]
	front tcp.custom.sectionNumberDiv
	
custom tcp.custom.tcp_selectionDot 				'' 0 '' 'tcp_selectionDot'
set tcp.custom.tcp_selectionDot 				!selDot{0} [0] ?track_selected [0] + + [tcp.custom.sectionNumber] - [tcp.custom.sectionNumber{2} tcp.custom.sectionNumber{3}] * 0.5 [0 tcp.custom.sectionNumber{3}] * Scale [-4 -4 8 8]
custom tcp.custom.tcp_selectionDotSel			'' 0 '' 'tcp_selectionDot_sel'	
set tcp.custom.tcp_selectionDotSel 				!selDot{0} [0] !track_selected [0] + + [tcp.custom.sectionNumber] - [tcp.custom.sectionNumber{2} tcp.custom.sectionNumber{3}] * 0.5 [0 tcp.custom.sectionNumber{3}] * Scale [-4 -4 8 8]
front tcp.custom.tcp_selectionDot tcp.custom.tcp_selectionDotSel	


;----------METER----------------
set PlusSize_pre  tcpMeterSize2

set tcp.size  h<43 + tcp.size - [PlusSize_pre 0 0] [20 0 0]

set PlusSize     - PlusSize_pre 20

set Mwc  +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0]  - 209 Mcorr{0} ;211
set W43MeterMin   + [255] [PlusSize]

set   tcpFXPanelSize      !tcpFXPanelOn{0}>0  h>=43   w<Mwc{0} [0] [-22]

set   tcpFXPanelSize_x    tcpFXPanelOn{0}>0   + tcpFXPanelSize{0} 10        -12  


custom tcp.custom.sectionMeter
	set tcp.custom.sectionMeter 		h>=43	  w<Mwc{0}    +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0]  +  [161 0 tcpMeterSize h 0 0 0 0] [tcp.custom.sectionMeter{2} 0 0 0]	+  [tcpFXPanelSize{0} 0 0 0]	+ + [135 0 0 h 1 0 1 0] [0] * Scale [12 0 tcpMeterSize -1]     
   	set tcp.custom.sectionMeter        w>W43MeterMin{0}        h<43       +	[tcpFXPanelSize{0} 0 0 0]            + +   [97 0 0 h 1 0 1 0] * Scale - [12 1 PlusSize_pre -2] [3 0 -2]  
   	set tcp.custom.sectionMeter         w<=W43MeterMin{0}       h<43       +	[0 0 tcpFXPanelSize_x{0} 0]            + +   [180 0 -91 h 0 0 1 0] * Scale - [12 1 PlusSize_pre -2] [3 0 0]   
	set tcp.custom.sectionMeter.color    			?visSections{0} [0 0 0 0 210 255 10 255] [0 0 0 0 38 38 38 255]


set tcp.meter 		              					+ + - tcp.custom.sectionMeter [-1 0 0 1] * Scale [0 0] \
													* -2 * Scale [0 0 0 0] 

set tcp.meter w<Mwc{0}  h>=43   [0]
set tcp.meter 	w<Mwc{0}	h>=43		+:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] 	+ + [162 0 tcpMeterSize h 0 0 0 0] * Scale [0 -1 0 0]

	set tcp.meter.vu.div                    	[Layout##thisLayout##-tcpMeterBorder -1]
	set tcp.meter.readout.color     !Layout##thisLayout##-tcpMeterReadout{0} [0 0 0 0 0 0 0 0]  * [180 180 180 0 40 40 40 0]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1 1]
	set tcp.meter.scale.color.lit.bottom    ?Layout##thisLayout##-TcpMeterVals{0}<2	!Layout##thisLayout##-TcpMeterVals{0} [0 0 0 0 0 0 0 0] [51 51 51 0 0 0 0 0]  ?Layout##thisLayout##-TcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set tcp.meter.scale.color.lit.top      ?Layout##thisLayout##-TcpMeterVals{0}<2	!Layout##thisLayout##-TcpMeterVals{0} [0 0 0 0 0 0 0 0] [51 51 51 0 0 0 0 0]  ?Layout##thisLayout##-TcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set tcp.meter.scale.color.unlit.bottom    *  textBrightnessMult{0}	!Layout##thisLayout##-TcpMeterVals{0} [0 0 0 0 0 0 0 0] ?recarm [235 64 0 255 0 0 0 0]   !Layout##thisLayout##-TcpMeterVals{0}==3       +  - 1 [0 0 0 100] [90 90 90 0 0 0 0 0] 
	set tcp.meter.scale.color.unlit.top     *  textBrightnessMult{0} 	!Layout##thisLayout##-TcpMeterVals{0} [0 0 0 0 0 0 0 0] ?recarm [235 64 0 255 0 0 0 0]     !Layout##thisLayout##-TcpMeterVals{0}==3           +  - 1 [0 0 0 100] [90 90 90 0 0 0 0 0]

	set tcp.meter.inputlabel.color  * textBrightnessMult{0} [180 180 180 255] 
	set tcp.meter.inputlabelbox.color * textBrightnessMult{0} [38 38 38 200 138 138 138 200]


custom  tcp.custom.unclickable_meter   '' 40527 '' ''  
     set     tcp.custom.unclickable_meter  unclckbl_mtr{0}==1 tcp.meter
     front     tcp.custom.unclickable_meter


;-- POPULATE MAIN --

;reset values for 'follow' macro
set biggestY 0
set xOffs 0
set noSpace 0

custom tcp.custom.panBlock
custom tcp.custom.labelBlock 
custom tcp.custom.inputBlock

set tcpNullMargin                                                     26
set tcpNullMarginNeg                                              *  tcpNullMargin -1


set W400   +:tcpFoldB{0}:1 [20 0 0 0]  +  470  PlusSize  ; 

set width_corr    w>W400{0}    +:tcpFoldB{0}:1 [tcpfolderIndentSizeN 0 0 0] +   trackpanmode>=5  [-30] [0]      [tcpFXPanelSize{0}]

set folder_corr     	+:tcpFoldB{0}:1 [tcpfolderIndentSize] + [215]    -   [tcpFXPanelSize{0}] [Mcorr{0}]

set FldMrgn3    +:tcpFoldB{0}:1 [tcpfolderIndentSize] + [470] [PlusSize] 
set FldMrgn4    +:tcpFoldB2{0}:1 [tcpfolderIndentSize] + + [390] [PlusSize] [tcpfolderIndentSizeN] 


; Calculate sectionRight widths now so that sectionMain can use them
set sectionRightWidth2     tcpFXPanelSize{0} ;

;----------CUSTOM ELEMENTS----------------

custom tcp.custom.sectionRightWidth ; FX area background
     set tcp.custom.sectionRightWidth h>=43 + [125 0 sectionRightWidth2 99 1 0 1 1] [0 0 22 0]
     set tcp.custom.sectionRightWidth w<folder_corr{0} h>=43 [0]
    set maxfolderW     * tcpFoldB{0} tcpfolderIndentSize
    set sectionRightWidth3  -  - sectionRightWidth2 w<folder_corr{0} [maxfolderW{0}] [0] 
     set tcp.custom.sectionRightWidth  w<folder_corr{0} h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] +  [160 0 sectionRightWidth3{0} 99 0 0 1 1] 
     set tcp.custom.sectionRightWidth.color [0 0 0 255 38 38 38 TranspFXSect{0}]


custom tcp.custom.myCustomElement ; M S Phase area background
     set tcp.custom.myCustomElement   h>=43  + - [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 0 0] w>=Mwc{0}  [147 0 50 100 1 0 1 1] +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + - + [162 0 15 100 0 0 1 1] [0 0 tcpFXPanelSize{0} 0] [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 tcpMeterSize{0} 0]
     set tcp.custom.myCustomElement   h>=43 tcp_iconsize>0  +  - tcp.custom.myCustomElement [0 0 20 0]     w>=Mwc{0} [0 0 0 0] ?tcpFXPanelOn{0}==0 [0 0 0 0] [0 0 20 0]
     set tcp.custom.myCustomElement h<43  + + [tcpFXPanelSize{0} 0 0 0] [PlusSize 0 0 0]   [125 0 50 99 1 0 1 1]
     set tcp.custom.myCustomElement.color [0 0 0 255 38 38 38 255]
     front tcp.custom.myCustomElement

custom tcp.custom.myCustomElement1 ; M S Phase track separator horz line
     set tcp.custom.myCustomElement1   h>=43  + - [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 0 0] w>=Mwc{0} + [147 99 150 100 1 1 1 1] [Mcorr{0} 0 tcpMeterSize{0} 0] +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + - + [162 99 150 100 0 1 1 1] [0 0 tcpFXPanelSize{0} 0] [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 tcpMeterSize{0} 0]
     set tcp.custom.myCustomElement1 h<43  + + [tcpFXPanelSize{0} 0 0 0] [PlusSize 0 0 0]   [125 99 150 80 1 1 1 1]
     set tcp.custom.myCustomElement1.color [0 0 0 255 50 50 50 255]
     front tcp.custom.myCustomElement1

custom tcp.custom.myCustomElement3 ; add (between vol and pan)
     set tcp.custom.myCustomElement3 h<43 w>W400{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [width_corr] +  [37 0 6 23 1 0 1 0] [0]
     set tcp.custom.myCustomElement3.color [0 0 0 255 50 50 50 255] 
     front tcp.custom.myCustomElement3

custom tcp.custom.myCustomElement4 ; add (between pan and width)
     set tcp.custom.myCustomElement4 h<43 w>W400{0} trackpanmode==5 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [width_corr] + [100 0 2 23 1 0 1 0]  [0]
     set tcp.custom.myCustomElement4.color [0 0 0 255 50 50 50 255] 
     front tcp.custom.myCustomElement4

custom tcp.custom.myCustomElement5 ; add (?selected between lable and vol) 
     set tcp.custom.myCustomElement5 w<=235     h<43 + + [125 0 6 24 1 0 1 0] [PlusSize 0 0 0] [tcpFXPanelSize{0}]   [0]      
     set tcp.custom.myCustomElement5 w<=W43MeterMin{0}   w>235     h<43   [184 0 6 24 0 0 0 0]  [0]
     set tcp.custom.myCustomElement5 h<43 w>FldMrgn3{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [width_corr] + [-106 0 6 24 1 0 1 0] [0]
     set tcp.custom.myCustomElement5 h<43 w<=FldMrgn3{0} w>W43MeterMin{0}  + [201] + + [-100 0 6 24 1 0 1 0] [tcpFXPanelSize{0} 0 0 0] [0]
     set tcp.custom.myCustomElement5 h<43 w<=FldMrgn3{0} w>FldMrgn4{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + +:tcpFoldB{0}:1 [tcpfolderIndentSizeN 0 0 0] [196] + + [-232 0 6 24 1 0 1 0] [tcpFXPanelSize{0} 0 0 0] [0]

	set tcp.custom.myCustomElement5.color 		!ColoredSelection=1	!track_selected [0 0 0 255 50 50 50 255]    ?selectStrength>0  [0 0 0 255 100 100 100 255] [0 0 0 255 90 90 90 255]
	set tcp.custom.myCustomElement5.color 		!ColoredSelection=0	!track_selected [0 0 0 255 50 50 50 255]	?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b 180] [0 0 0 0 150 150 150 200]

     front tcp.custom.myCustomElement5



set tcpFXPanelcorr   tcpFXPanelOn{0}>0   h<43 [0] [0] ; [-22] [-22] 
set tcpFXPanelcorr2     +  tcpFXPanelcorr 4

set env_io_width_corr2                                       ?trackpanmode>=5  [30] [0] 

set FXPanelOff    w<Mwc{0}     ?Layout##thisLayout##-tcpFXPanelOff{0}==1 [19] [0]

custom tcp.custom.myCustomElement6 ; add to end of labelBlock

     set tcp.custom.myCustomElement6    tcpfolderBalType{0}==0   h>=43 w<folder_corr{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] [65 4 92 24 0 0 0 0]  [0]
     set tcp.custom.myCustomElement6  tcpfolderBalType{0}>0 h>=43 w<folder_corr{0} +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + [65 4 92 24 0 0 0 0] * [0 0 tcpfolderIndentSize 0] maxfolderdepth [0]                                                                               
     
     set tcp.custom.myCustomElement6 h>=43 w>=folder_corr{0} +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + - [65 4 56 24 0 0 1 0] [FXPanelOff{0} 0 0 0] [0] 
     
     set tcp.custom.myCustomElement6   h<43 w<235 +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0]  +  [65 0 45 24 0 0 1 0] + + [0 0 tcpFXPanelSize{0} 0] [0 0 tcpMeterSize2{0} 0]    tcpFXPanelOn{0}<=1 [0 0 0 0] [0 0 16 0]   [0] 
     set tcp.custom.myCustomElement6   h<43 w<=W43MeterMin{0} w>=235 +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0]  +  [65 0 120 24 0 0 0 0]  + [0 0 tcpFXPanelcorr2{0} 0]    tcpFXPanelOn{0}<=1 [0 0 0 0] [0 0 16 0]
     set tcp.custom.myCustomElement6   h<43 w<=FldMrgn4{0} w>W43MeterMin{0} +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + - [65 0 32 24 0 0 1 0] [0] + [0 0 tcpFXPanelSize{0} 0] [0 0 tcpFXPanelcorr2{0} 0] 
     set tcp.custom.myCustomElement6   h<43 w<=FldMrgn3{0} w>FldMrgn4{0} +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + - [65 0 -100 24 0 0 1 0] [0] + [0 0 tcpFXPanelSize{0} 0] [0 0 tcpFXPanelcorr{0} 0] 
     set tcp.custom.myCustomElement6   h<43 w>FldMrgn3{0}  +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + - [65 0 -170 24 0 0 1 0] [0] + [0 0 tcpFXPanelSize{0} 0] - [0 0 tcpFXPanelcorr{0} 0] [0 0 env_io_width_corr2{0} 0]

     set tcp.custom.myCustomElement6.color    [0 0 0 255 38 38 38 255]
     set tcp.custom.myCustomElement6.color    ?selInvertLabels{0} ?track_selected ?recarm [0 0 0 255 181 176 175 255] [0 0 0 255 176 177 178 255]  . .


custom tcp.custom.myCustomElement8 ; add to end of labelBlock (tint selection layer)
    set tcp.custom.myCustomElement8                tcp.custom.myCustomElement6
    set tcp.custom.myCustomElement8.color  ?ColoredSelection=1  ?track_selected  [0 0 0 255 trackcolor_r trackcolor_g trackcolor_b 12] [0 0 0 255 trackcolor_r trackcolor_g trackcolor_b 4]
    set tcp.custom.myCustomElement8.color   ?ColoredSelection=0  ?track_selected [0 0 0 255 176 177 178 5]
    front tcp.custom.myCustomElement8


custom tcp.custom.myCustomElement2 ; add (background behind the vol/pan/lable/meter)
     set tcp.custom.myCustomElement2 h<43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + + + [65 0 110 24 0 0 1 0] [0 0 PlusSize 0] [0 0 tcpFXPanelSize{0} 0] [0]
     set tcp.custom.myCustomElement2.color [0 0 0 255 38 38 38 255]



;--------------LABEL BLOCK--------------				
custom tcp.custom.labelBlockBg 					'' 0 '' 'tcp_labelBlock_bg'  
	custom tcp.custom.labelBlockBgSel			'' 0 '' 'tcp_labelBlock_bg_sel'
	set tcp.custom.labelBlockBg		 h>=43          ?selInvertLabels{0} ?track_selected     [0]       [26 6 90 20  0 0 0 0] [26 6 90 20  0 0 0 0] 
	set tcp.custom.labelBlockBg		+:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 0 0]  h<43          ?selInvertLabels{0} ?track_selected     [0]       [26 2 90 20  0 0 0 0] [26 2 90 20  0 0 0 0] 
	set tcp.custom.labelBlockBgSel	          h>=43	      ?selInvertLabels{0} ?track_selected    [26 6 90 20  0 0 0 0]  [0] 
	set tcp.custom.labelBlockBgSel		+:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 0 0]  h<43		?selInvertLabels{0} ?track_selected  +  [26 2 90 20  0 0 0 0] [0 0 tcpFXPanelSize{0} 0]  [0] 

;--------------RECARM--RECMON--------------	
set tcp.recarm 									+:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 0 0] + h>=43  [28 6 20 20  0 0 0 0] [28 2 20 20  0 0 0 0]
set tcp.recmon									+:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 0 0] + h>=43  [48 6 14 20  0 0 0 0] [48 2 14 20  0 0 0 0]


;--------------ROUTE--------------
set tcp_io_corr2  + ?trackpanmode>=5 [-30 0] [0]   [tcpFXPanelSize{0}]

set tcp_io_corr3   +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [214] - [tcpFXPanelSize{0}]  [Mcorr{0}]
set tcp_io_corr4   +:tcpFoldB2{0}:1 [tcpfolderIndentSize 0 0 0]  + [405] [PlusSize]

set tcp.io w>tcp_io_corr3{0} h>=43  - [97 6 22 22 1 0 1 0] [FXPanelOff{0} 0 0 0] [0] w<=tcp_io_corr3{0} h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] [133 6 22 22 0 0 0 0] [0]
set tcp.io w>FldMrgn3{0} h<43 w>FldMrgn3{0}  + [tcp_io_corr2] [-130 2 22 22 1 0 1 0]

set tcp.io w<=FldMrgn3{0} h<43  + [tcpFXPanelSize{0}] [-60 2 22 22 1 0 1 0]
set tcp.io w<tcp_io_corr4{0} h<43 [0]

set tcp_io_corr5   +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [217] - [tcpFXPanelSize{0}]  [Mcorr{0}]
set tcp.io w<tcp_io_corr5{0} h<43 [110 2 22 22 1 0 1 0]

front tcp.io

set tcp.io	!Layout##thisLayout##-hideIO{0} [0] 

 
;--------------LABEL--------------
set  tcplblcorr        w<tcp_io_corr4{0}  h<43  1  0
set tcp.label           +    tcp.custom.myCustomElement6    Layout##thisLayout##-hideIO{0}>0  tcplblcorr{0}==0 [-2 0 -25 0] [-2 0 -2 0] [-2 0 -2 0]
set tcp.label  h<43  +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] [60 2 60 20]

	set tcp.label.margin 						* Scale [6 0 2 0]
	set tcp.label.font 						+ Layout##thisLayout##-tcpLabelSize{0} [0]
	set tcp.label.color 			* textBrightnessMult{0}			?recarm [255 80 100] ?trackcolor_valid ?colorTrackLabels cColorTextOnDark * textBrightnessMult{0} [200 200 200] * textBrightnessMult{0} [200 200 200] 
	set tcp.label.color							?selInvertLabels{0} ?track_selected ?recarm [110 0 10] * / textBrightnessMult{0} 5 [trackcolor_r trackcolor_g trackcolor_b] . .

;--------------VOLUME--------------
set tcpVolLength      131
set tcp.volume							  +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6] h>=43  * Scale  [-184 tcpNullMargin tcpVolLength 25] \
                                                                                                                     h<43 w>W400{0} + [width_corr]  [-308 -5 tcpVolLength 25 1 0 1 0]
set tcp.volume h<43 h>42 [0]

set tcp.volume h<43 w<=FldMrgn3{0} w>FldMrgn4{0} + [-30 0 tcpVolLength 25 1 0 1 0] [tcpFXPanelSize{0} 0 0 0]

 front  tcp.volume                                                                                                                                      
	set tcp.volume.fadermode 					[1]
set tcp.volume.label  tcp.volume
front tcp.volume.label
set tcp.volume.label.font						[Layout##thisLayout##-tcpVolPanFontSize]
	set tcp.volume.label.color				* textBrightnessMult{0}	[150 160 170]
	set tcp.volume.label.margin					* Scale [0 25 3 20 1] 
	
;--------------M-S-R--------------		
set tcp.mute   h>=43	  w<Mwc{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0]  + [167 2 20 20 0 0 0 0] [tcp.custom.sectionMeter{2} 0 0 0]			+ [153 2 20 20 1 0 1 0] - [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 0 0]  + + [131 2 20 20 1 0 1 0] [PlusSize 0 0 0] [tcpFXPanelSize{0} 0 0 0]    
set tcp.solo     h>=43	  w<Mwc{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0]  +  [167 24 20 20 0 0 0 0] [tcp.custom.sectionMeter{2} 0 0 0]				+ [153 24 20 20 1 0 1 0] - [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 0 0]  + + [153 2 20 20 1 0 1 0] [PlusSize 0 0 0] [tcpFXPanelSize{0} 0 0 0]
set tcp.phase 	h>=84	  w<Mwc{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0]  +  [169 56 16 20 0 1 0 1] [tcp.custom.sectionMeter{2} 0 0 0]				+ [155 56 16 20 1 1 1 1] - [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 0 0]    [0]

;--------------LAYERS (custom button)--------------	
custom tcp.custom.track_layer 					 '' _RSc6ae0ad4f106f0040d13a68666ad92d2a6177cb6 'Fixed item lanes' 'track_layer'  
       set tcp.custom.track_layer    Layout##thisLayout##-TcpCBMode{0}=2	 h>=63  w<Mwc{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0]  +  [167 77 20 20 0 1 0 1] [tcp.custom.sectionMeter{2} 0 0 0]	         	+	- [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 0 0] 	  	 [153 77 20 20  1 1 1 1] [0]
       front tcp.custom.track_layer

set tcp.custom.track_layer   Layout##thisLayout##-TcpCBMode{0}<=1   0

custom tcp.custom.track_layer2 					 '' 42430 'Fixed item lanes' 'track_layer'  
       set tcp.custom.track_layer2		Layout##thisLayout##-TcpCBMode{0}<=1	h>=63  w<Mwc{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0]  +  [167 77 20 20 0 1 0 1] [tcp.custom.sectionMeter{2} 0 0 0]	         	+	- [tcpFXPanelSize{0} 0 0 0] [Mcorr{0} 0 0 0] 	  	 [153 77 20 20  1 1 1 1] [0]
       front tcp.custom.track_layer2


;--------------PAN--------------	
set tcpPanLength 58
set tcpDualPanLength 86
set tcpDualPanLength2 86 ;h<43
set panLabelW 30
 
set wid_pan                                  +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + 270    - [tcpFXPanelSize{0}] [Mcorr{0}]
set wid_pan_width                                  +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + 300  + ?trackpanmode==6 [tcpFXPanelSize{0}] [0] - [tcpFXPanelSize{0}] [Mcorr{0}]

set tcp.pan							h>=43		+:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6]  trackpanmode==5 w>=wid_pan_width{0}  [-50 tcpNullMargin tcpPanLength 25] [-184 52 tcpPanLength 25] \
                                                                                                                                      trackpanmode<=3 w>=wid_pan{0}  [-50 tcpNullMargin tcpPanLength 25] [-184 52 tcpPanLength 25] \
                                                                                                                                      trackpanmode==6 w>=wid_pan_width{0}  [-50 tcpNullMargin tcpDualPanLength 10] [-184 52 tcpDualPanLength 10] 

set tcp.pan								h<43   w>FldMrgn3{0}	+:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6] + [width_corr]  trackpanmode<=5  [-168 -5 tcpPanLength 25 1 0 1 0]     \
                                                                                                                                                          trackpanmode==6 [-168 -5 tcpDualPanLength2 10 1 0 1 0]    
front tcp.pan

	set tcp.pan.fadermode 				trackpanmode==6 [0]	[1]

set tcp.pan.label  tcp.pan
set tcp.pan.label.font					?trackpanmode==6  [3] [Layout##thisLayout##-tcpVolPanFontSize] 
	set tcp.pan.label.color				* textBrightnessMult{0}	[160 150 160]
	set tcp.pan.label.margin			?trackpanmode==6         [0 19 5 20 1]  [1 25 0 20 0.5] 
front tcp.pan.label

;--------------WIDTH--------------	
set tcpNM  +  tcpNullMargin [12] 

set tcp.width							h>=43		+:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6] trackpanmode==5 w>=wid_pan_width{0} [-4 tcpNullMargin tcpPanLength 22]  [-138 52 tcpPanLength 22] \
                                                                                                                                            trackpanmode==6 w>=wid_pan_width{0} [-48 tcpNM{0} tcpDualPanLength 10]  [-184 64 tcpDualPanLength 10]

set tcp.width       h<43  w>W400{0}	+:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6] + [width_corr] trackpanmode==5  [-103 -5 22 22 1 0 1 0]  \
                                                                                                                  trackpanmode==6 [-168 5 tcpDualPanLength2 10 1 0 1 0] [0] 
set tcp.width.fadermode trackpanmode==6 [0]	[1]

set tcp.width.label							?trackpanmode==6 	tcp.pan
																				     
	set tcp.width.label.color					[150 160 150]
	set tcp.width.label.margin					?trackpanmode==6         [5 43 5 20 -1]  [0]
	set tcp.width.label.font					tcp.pan.label.font
front tcp.width.label


set tcpwcorr  +  [tcp.width] [13]

custom tcp.custom.myCustomElement7 ; add (between pan and width)
set tcp.custom.myCustomElement7 h>43 trackpanmode==5  [tcpwcorr tcp.width 2 22 0 0 0 0] [0]
set tcp.custom.myCustomElement7.color [0 0 0 255 50 50 50 255] 
front tcp.custom.myCustomElement7

;--------------RECMODE--FXIN--RECINPUT--------------	
set tcp.recmode                         ?ShowRecInput{0}                                +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6] trackpanmode>=5 w>=wid_pan_width{0} * Scale [-184 52 47 20] [-184 78 47 20] \
                                                                                                                             trackpanmode<=3 w>=wid_pan{0} * Scale [-184 52 47 20] [-184 78 47 20]
set tcp.fxin				?ShowRecInput{0}				+:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6]  trackpanmode>=5 w>=wid_pan_width{0} * Scale [-134 52 20 20] [-134 78 20 20] \
                                                                                                                              trackpanmode<=3 w>=wid_pan{0} * Scale [-134 52 20 20] [-134 78 20 20] 
set tcp.recinput				?ShowRecInput{0}	w<wid_pan{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] [96 84 25 20 0 0 1 0] \
	                                                                        +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [210 6]  trackpanmode>=5 w>=wid_pan_width{0} * Scale [-114 52 150 20] [-114 78 125 20] \
                                                                                                                           trackpanmode<=3 w>=wid_pan{0} * Scale [-114 52 122 20] [-114 78 125 20] 

       set tcp.recinput ?ShowRecInput{0} w<folder_corr{0}  [0]
       set tcp.recinput ?ShowRecInput{0}  w<folder_corr{0} h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] [96 84 61 20 0 0 0 0]
                                                                                                                                          
	set tcp.recinput.color 					* textBrightnessMult{0}	[180 180 180]         		
	set tcp.recinput.font						+ Layout##thisLayout##-tcpInputFontSize{0} Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
	set tcp.recinput.margin 					+ [0 0 0 0 0.5] * Scale [2 0 20] 



;--------------BACKGROUNDS--------------	
custom tcp.custom.tcpSelBox
	set SelectionColorDepth 						* selectStrength 2.55
	set tcp.custom.tcpSelBox 					!track_selected [0] selectStrength{0}>0 [0 0 w h] [0]
	set tcp.custom.tcpSelBox.color 		!ColoredSelection=1		+ * / selectStrength{0} 100 [0 0 0 0 0 0 0 255] [0 0 0 0 255 255 255]
	set tcp.custom.tcpSelBox.color 		!ColoredSelection=0		?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b SelectionColorDepth{0}] [0 0 0 0 200 200 200 SelectionColorDepth{0}]

custom tcp.custom.colourBox
	set customColorDepth 				        customColorDepthParam
	set customColorDepthParam2 			*	customColorDepthParam 0.8
	set tcp.custom.colourBox 					customColorDepthParam2{0}>0 + + * [1 0 -1] tcp.custom.sectionNumber{w} [1 0 w h] [-1 0 -1] [0]
	set tcp.custom.colourBox.color 				?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b customColorDepthParam2{0}] [0 0 0 0 0 0 0 0]

custom tcp.custom.tcpBgBox
	set tcp.custom.tcpBgBox 					[0 0 w h] 
	set tcp.custom.tcpBgBox.color 				[0 0 0 0 tcpBgColR tcpBgColG tcpBgColB 255]
	
;--------------FX PANEL--------------	
set tcpFXPanelSize2           + tcpFXPanelSize{0} 22 
set fxWcorr        +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] 245
set fxWcorr2        +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] 239
set fxWcorr3          +  200 tcpFXPanelSize{0}
set wdthLimit           w>fxWcorr3{0}      fxWcorr3{0}   w 
set autoWscrollTcp     / wdthLimit{0} 50  
set fxElmSz            Layout##thisLayout##-tcpFXFontSize{0}>=6      26   24 

	set tcp.fxparm	+	- [0 0 tcpFXPanelSize2{0} 0] [0 0 9 0]     h>=43	      [130 4 0 120 1 0 1 1]  
           set tcp.fxparm   w<folder_corr{0} h>=43 [0]
           set tcp.fxparm        w<folder_corr{0}  h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + [165 4 -43 120 0 0 1 1] [0 0 tcpFXPanelSize2{0} 0]    [0]
	set tcp.fxparm.font       +	[0 0 tcpFXPanelSize2{0} tcpFXPanelSize2{0}]          [Layout##thisLayout##-tcpFXFontSize fxElmSz{0} 0 -16 -1 0 2 autoWscrollTcp{0}]
        set tcp.fxparm.margin          	      [1 0 3 0 1 14 0.5 6]
        set tcp.fxparm.visflags [1 0 0]       
        set tcp.fxparm.visflags  w<fxWcorr{0}   [-1 0 0]      
        set tcp.fxparm.visflags  w<fxWcorr2{0}   [-1 0 -1]     

           set tcp.fxparm        w<tcp_io_corr5{0}  h<43 + [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + [115 0 -43 120 1 0 1 0] [0 0 tcpFXPanelSize2{0} 0] 

;--------------FX EMBED--------------	
        set embedFldMrg     -      +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + ?trackpanmode>=5 [299] [269] - [tcpFXPanelSize{0}] [Mcorr{0}]
        set embedFldMrg2    -       +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [211] - [tcpFXPanelSize{0}] [Mcorr{0}]
        set embedFldMrg3    -       +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] +   ?trackpanmode>=5 [345] [318]  [tcpFXPanelSize{0}]

        set EnvShift     Layout##thisLayout##-TcpFX_Env{0}>=1   Layout##thisLayout##-TcpFX_Env{0}<3        [0 0 0 -26]
        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}>0 w>embedFldMrg{0}  + EnvShift + +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] +  ?ShowRecInput{0} [23 82 47 20 0 0 1 1] [23 58 47 44 0 0 1 1]   
        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}>0 w<=embedFldMrg{0} + EnvShift + +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + ?ShowRecInput{0} [23 109 47 -7 0 0 1 1] [23 85 47 17 0 0 1 1] 
        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}>0 w<=embedFldMrg2{0} 0
        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}>0 w<=embedFldMrg2{0} + EnvShift + +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + ?ShowRecInput{0} [23 109 85 -7 0 0 0 1] [23 85 85 17 0 0 0 1] 

        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}=0 w>embedFldMrg3{0} + EnvShift + +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] +  ?ShowRecInput{0} [23 82 95 20 0 0 1 1] [23 58 95 44 0 0 1 1]   
        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}=0 w<=embedFldMrg3{0} + EnvShift + +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] +  ?ShowRecInput{0} [23 108 95 -7 0 0 1 1] [23 84 95 17 0 0 1 1]  
        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}=0 w<=embedFldMrg2{0} 0
        set tcp.fxembed Layout##thisLayout##-TcpCBMode{0}=0 w<=embedFldMrg2{0} + EnvShift + +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + ?ShowRecInput{0} [23 108 134 -7 0 0 0 1] [23 84 134 17 0 0 0 1] 

	set tcp.fxembedheader.color			* textBrightnessMult{0}	!track_selected	[160 160 160] [200 200 200] 


set mTW    h>=43	+ [maxfolderW] [tcp.custom.sectionNumber{2}] [0] 
set minTcpW										+ + + \
												  * Scale + mTW{0} -98 \
												  142 \
												  + + 0 0 0 \
												  + + 146 0 0 
set minTcpW  -  + minTcpW      tcpMeterSize   25   
set tcp.size 									[. . minTcpW]	

 

;_________ Classic Buttons (Env, FX) ____________________________________________________

set envMcorr{0}W   +:tcpFoldB{0}:1 [tcpfolderIndentSize]   +  270 - tcpFXPanelSize{0}  Mcorr{0}
set envMrgCorr   w>=envMcorr{0}W{0}  [-25] [0]
set envMrg  +  [envMrgCorr{0}]  ?ShowRecInput{0} [131] [106]

set tcp.env Layout##thisLayout##-TcpFX_Env{0}>=1 Layout##thisLayout##-TcpFX_Env{0}<3 h>=envMrg{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] [26 74 22 22 0 1 0 1] 
front tcp.env


set fxWidthMrg       +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] +   ?trackpanmode>=5 [345] [318] - [tcpFXPanelSize{0}]  [Mcorr{0}]
set fxFldMrg           +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + ?trackpanmode>=5 [299] [269] - [tcpFXPanelSize{0}] [Mcorr{0}]
set RecCorrFx  ?ShowRecInput{0} [82] [58]

set tcp.fx   Layout##thisLayout##-TcpFX_Env{0}>=2   h>=43   w>=fxWidthMrg{0}    [77 32 22 22 1 0 1 0]    w<=fxFldMrg{0}  +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [113 58 22 22 0 0 0 0]
set tcp.fxbyp   Layout##thisLayout##-TcpFX_Env{0}>=2   h>=43   w>=fxWidthMrg{0}   [99 32 22 22 1 0 1 0]   w<=fxFldMrg{0} +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [135 58 22 22 0 0 0 0]   

set tcp.fx   Layout##thisLayout##-TcpFX_Env{0}>=2   h>=43   w<fxWidthMrg{0}      w>fxFldMrg{0}  [77 RecCorrFx{0} 22 22 1 0 1 0]
set tcp.fxbyp   Layout##thisLayout##-TcpFX_Env{0}>=2   h>=43   w<fxWidthMrg{0}     w>fxFldMrg{0}  [99 RecCorrFx{0} 22 22 1 0 1 0]   
front tcp.fx  
front tcp.fxbyp

;_________ Classic Buttons end________________________________________________________

   set minWshift     1

;_________ CUSTOM BUTTONs2, from here________________________________________________ 

    set customMrg                           ?ShowRecInput{0} [150] [126]  
    set customMrg3                           ?trackpanmode>=5 [345] [318]
    set customMargin                      h<customMrg{0}       +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + [customMrg3{0}] - [tcpFXPanelSize{0}]  [Mcorr{0}]
    set customControl_w                             75
    set customButton_h                                20
    set customButton_w                                 44 
    set tcp.custom.button.font                      Layout##thisLayout##-tcpCBFontSize
    set tcp.custom.button.margin                  [3 0 0 0 0]
    set tcp.custom.button.color              *       ?track_selected [170 170 170 243 40 40 42 243] [110 110 110 140 45 45 47 243]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1] 
    set tcp.custom.button                           +  [1 0 0 0 1 1 1 1] [customControl_w 10 customButton_w customButton_h 0 1 0 1]
    set tcp.custom.button w<folder_corr{0} h>=43 [0]
    set hh + h  [-90] 
    set tcp.custom.button w<folder_corr{0} h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [112 hh{0} customButton_w customButton_h 0 0 0 0] 

    set smallButton_w                                 21
 
    set tcp.custom.button_small                           +  [1 0 0 0 1 1 1 1] [customControl_w 10 smallButton_w customButton_h 0 1 0 1]
    set tcp.custom.button_small w<folder_corr{0} h>=43 [0]
    set hh2 + h  [-90] 
    set tcp.custom.button_small w<folder_corr{0} h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [112 hh2{0} smallButton_w customButton_h 0 0 0 0] 

    set customMrg2       ?ShowRecInput{0} [100] [80]
    set tcpbttncorr      +  [customButton_h]  [2]
    set tcpbttncorr2     w<customMargin{0}  [customMrg2{0}] [50]

    set customMrgRec    +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] +  ?trackpanmode>=5 [300] [270]  - [tcpFXPanelSize{0}] [Mcorr{0}]
    set tcpbttncorrRec      w<customMrgRec{0} ?ShowRecInput{0} [80] [0]
    set tcpbttncorrRec2    w<customMrgRec{0} ?ShowRecInput{0} [20] [0]
 
    set customMrgRec2   +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + ?ShowRecInput{0} [-125]  [255] - [tcpFXPanelSize{0}] [Mcorr{0}]
    set tcpbttncorrRec3    w>customMrgRec2{0} w<customMrgRec{0} ?ShowRecInput{0} [tcpbttncorrRec]  [-30]
    set tcpbttncorrRec4    w>customMrgRec2{0} w<customMrgRec{0} ?ShowRecInput{0} [tcpbttncorrRec2]  [-30]


    set TFE  w<=fxFldMrg{0} + [42] !ShowRecInput{0} [55] [0]  w>=fxWidthMrg{0} + [70] !ShowRecInput{0} [0] [0]  w<fxWidthMrg{0}     w>fxFldMrg{0} + [120] !ShowRecInput{0} [-22] [0]    
    set TFE2  w<=fxFldMrg{0} + [30] !ShowRecInput{0} [40] [0]  w>=fxWidthMrg{0} + [48] !ShowRecInput{0} [0] [0]  w<fxWidthMrg{0}     w>fxFldMrg{0} + [73] !ShowRecInput{0} [-20] [0]    
    set TFE3  w<=fxFldMrg{0} + [8] !ShowRecInput{0} [15] [0]  w>=fxWidthMrg{0} + [25] !ShowRecInput{0} [0] [0]  w<fxWidthMrg{0}     w>fxFldMrg{0} + [28] !ShowRecInput{0} [-5] [0]    

    set TFE !Layout##thisLayout##-TcpFX_Env{0}>=2  [42] [TFE]    
    set TFE2 !Layout##thisLayout##-TcpFX_Env{0}>=2  [23] [TFE2]    
    set TFE3 !Layout##thisLayout##-TcpFX_Env{0}>=2  [0] [TFE3]   

    set tcpbttncorr3  + [tcpbttncorr2{0}] + [TFE{0}]   [tcpbttncorrRec3]  ; 
    set tcpbttncorr4  + [tcpbttncorr2{0}] + [TFE2{0}]   [tcpbttncorrRec4]   ; 
    set tcpbttncorr5  + [tcpbttncorr2{0}] + [TFE3{0}]    [tcpbttncorrRec4]  ;
    set tcpbttnhide [0]
    set tcpbttnhide  h<tcpbttncorr3{0}  [1] 
    set tcpbttnhide  h<tcpbttncorr4{0} + [1] 
    set tcpbttnhide  h<tcpbttncorr5{0} + [1] 



    set tcpbttnhide + [1]  ;floor 3
    set tcp.custom.x2       Layout##thisLayout##-TcpCBMode{0}=2          h>=50      +    + tcp.custom.button_small  * [1 tcpbttnhide{0}] [0 tcpbttncorr{0}]  [minWshift 0 0 0]
    set tcp.custom.x2.font                       tcp.custom.button.font 
    set tcp.custom.x2.margin                     [0 0 0 0 0.5] 
    set tcp.custom.x2.color               *       ?track_selected [180 110 180 140 40 40 42 243] [140 80 140 140 45 45 47 243]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1]
    front tcp.custom.x2

    set tcp.custom.y2        Layout##thisLayout##-TcpCBMode{0}=2         h>=50      +    + tcp.custom.button_small * [1 tcpbttnhide{0}] [23 tcpbttncorr{0}]  [minWshift 0 0 0] 
    set tcp.custom.y2.font                       tcp.custom.button.font 
    set tcp.custom.y2.margin                     [0 0 0 0 0.5] 
    set tcp.custom.y2.color                 *     ?track_selected [110 180 110 140 40 40 42 243] [80 140 80 140 45 45 47 243]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1]
    front tcp.custom.y2

    set tcpbttnhide + [1]  ;floor 2
    set tcp.custom.button                             ?tcpbttnhide{0}==4    + [tcp.custom.button] + [0 5]
    set tcp.custom.z2      Layout##thisLayout##-TcpCBMode{0}=2     h>=50         +    + tcp.custom.button * [1 tcpbttnhide{0}] [0 tcpbttncorr{0}]  [minWshift 0 0 0]              ; first action from below
    set tcp.custom.z2.font                   tcp.custom.button.font 
    set tcp.custom.z2.margin                 tcp.custom.button.margin 
    set tcp.custom.z2.color                  tcp.custom.button.color 
    front tcp.custom.z2

    set tcpbttnhide + [1] ;floor 1
    set tcp.custom.button                             ?tcpbttnhide{0}==4    + [tcp.custom.button] + [0 5]
    set tcp.custom.u2      Layout##thisLayout##-TcpCBMode{0}=2      h>=50        +     + tcp.custom.button * [1 tcpbttnhide{0}] [0 tcpbttncorr{0}]  [minWshift 0 0 0]
    set tcp.custom.u2.font                       tcp.custom.button.font 
    set tcp.custom.u2.margin                     tcp.custom.button.margin 
    set tcp.custom.u2.color                      tcp.custom.button.color 
    front tcp.custom.u2

;_________ CUSTOM BUTTONs2, end________________________________________________________



;_________ CUSTOM BUTTONs1, from here________________________________________________ 

    set custom2Mrg                           ?ShowRecInput{0} [130] [106]
    set custom2Mrg3                           ?trackpanmode>=5 [345] [318]
    set custom2Margin                      h<custom2Mrg{0}    +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 tcpfolderIndentSizeN 0] + [custom2Mrg3{0}] - [tcpFXPanelSize{0}] [Mcorr{0}]
    set custom2Control_w                             75
    set custom2Button_h                                20
    set custom2Button_w                                 44 
    set tcp.custom.button.font                      Layout##thisLayout##-tcpCBFontSize
    set tcp.custom.button.margin                  [3 0 0 0 0]
    set tcp.custom.button.color                *     ?track_selected [170 170 170 243 40 40 42 243] [110 110 110 140 45 45 47 243]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1]
    set tcp.custom.button                           +  [1 0 0 0 1 1 1 1] [custom2Control_w 10 custom2Button_w custom2Button_h 0 1 0 1]
    set tcp.custom.button w<folder_corr{0} h>=43 [0]
    set h2h + h [-90] 
    set tcp.custom.button w<folder_corr{0} h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [112 h2h{0} custom2Button_w custom2Button_h 0 0 0 0] 

    set small2Button_w                                 21
 
    set tcp.custom.button_small2                           +  [1 0 0 0 1 1 1 1] [custom2Control_w 10 small2Button_w custom2Button_h 0 1 0 1]
    set tcp.custom.button_small2 w<folder_corr{0} h>=43 [0]
    set h2h2 + h [-90] 
    set tcp.custom.button_small2 w<folder_corr{0} h>=43 +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + [112 h2h2{0} small2Button_w custom2Button_h 0 0 0 0] 

    set custom2Mrg2       ?ShowRecInput{0} [75] [55] 
    set tcpbttn2corr      +  [custom2Button_h] [2]
    set tcpbttn2corr2     w<custom2Margin{0}  [custom2Mrg2{0}] [30] 

    set custom2MrgRec    +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] +  ?trackpanmode>=5 [300] [270] - [tcpFXPanelSize{0}] [Mcorr{0}]
    set tcpbttncorr2Rec      w<custom2MrgRec{0} ?ShowRecInput{0} [75] [0]
    set tcpbttncorr2Rec2    w<custom2MrgRec{0} ?ShowRecInput{0} [20] [0]
 
    set customMrg2Rec2    +:tcpFoldB{0}:1 [tcpfolderIndentSize 0 0 0] + ?ShowRecInput{0} [-125]  [255]  - [tcpFXPanelSize{0}] [Mcorr{0}]
    set tcpbttncorr2Rec3    w>customMrg2Rec2{0} w<custom2MrgRec{0} ?ShowRecInput{0} [tcpbttncorr2Rec]  [-30]
    set tcpbttncorr2Rec4    w>customMrg2Rec2{0} w<custom2MrgRec{0} ?ShowRecInput{0} [tcpbttncorr2Rec2]  [-30]


    set T2FE  w<=fxFldMrg{0} + [42] !ShowRecInput{0} [55] [0]  w>=fxWidthMrg{0} + [70] !ShowRecInput{0} [0] [0]  w<fxWidthMrg{0}     w>fxFldMrg{0} + [120] !ShowRecInput{0} [-22] [0]    
    set T2FE2  w<=fxFldMrg{0} + [30] !ShowRecInput{0} [40] [0]  w>=fxWidthMrg{0} + [48] !ShowRecInput{0} [0] [0]  w<fxWidthMrg{0}     w>fxFldMrg{0} + [73] !ShowRecInput{0} [-20] [0]    
    set T2FE3  w<=fxFldMrg{0} + [8] !ShowRecInput{0} [15] [0]  w>=fxWidthMrg{0} + [25] !ShowRecInput{0} [0] [0]  w<fxWidthMrg{0}     w>fxFldMrg{0} + [28] !ShowRecInput{0} [-5] [0]    

    set T2FE !Layout##thisLayout##-TcpFX_Env{0}>=2  [42] [T2FE]    
    set T2FE2 !Layout##thisLayout##-TcpFX_Env{0}>=2  [23] [T2FE2]    
    set T2FE3 !Layout##thisLayout##-TcpFX_Env{0}>=2  [0] [T2FE3]   

    set tcpbttn2corr3  + [tcpbttn2corr2{0}] + [T2FE{0}]   [tcpbttncorr2Rec3]
    set tcpbttn2corr4  + [tcpbttn2corr2{0}] + [T2FE2{0}]   [tcpbttncorr2Rec4]
    ;set tcpbttn2corr5  + [tcpbttn2corr2{0}] + [T2FE3{0}]    [tcpbttncorr2Rec4]
    set tcpbttn2hide [0]
    set tcpbttn2hide  h<tcpbttn2corr3{0}  [1]
    set tcpbttn2hide  h<tcpbttn2corr4{0} + [1] 
    ;set tcpbttn2hide  h<tcpbttn2corr5{0} + [1] 


    set tcpbttn2hide + [2] ;floor 3
    set tcp.custom.x1        Layout##thisLayout##-TcpCBMode{0}=1         h>=50     +     + tcp.custom.button_small2 * [1 tcpbttn2hide{0}] [0 tcpbttn2corr{0}]  [minWshift 0 0 0] 
    set tcp.custom.x1.font                       tcp.custom.button.font 
    set tcp.custom.x1.margin                     [0 0 0 0 0.5] 
    set tcp.custom.x1.color               *       ?track_selected [110 180 110 140 40 40 42 243] [80 140 80 140 45 45 47 243]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1]
    front tcp.custom.x1

    set tcp.custom.y1        Layout##thisLayout##-TcpCBMode{0}=1         h>=50      +    + tcp.custom.button_small2 * [1 tcpbttn2hide{0}] [23 tcpbttn2corr{0}]  [minWshift 0 0 0] 
    set tcp.custom.y1.font                       tcp.custom.button.font 
    set tcp.custom.y1.margin                     [0 0 0 0 0.5] 
    set tcp.custom.y1.color                *      ?track_selected [180 110 180 140 40 40 42 243] [140 80 140 140 45 45 47 243]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1]
    front tcp.custom.y1

    set tcpbttn2hide + [1]  ;floor 2
    set tcp.custom.button                             ?tcpbttn2hide{0}==4    + [tcp.custom.button] + [0 5]
    set tcp.custom.z1    Layout##thisLayout##-TcpCBMode{0}=1       h>=50          +   + tcp.custom.button * [1 tcpbttn2hide{0}] [0 tcpbttn2corr{0}]  [minWshift 0 0 0]              ; first action from below
    set tcp.custom.z1.font                   tcp.custom.button.font 
    set tcp.custom.z1.margin                 tcp.custom.button.margin 
    set tcp.custom.z1.color                  tcp.custom.button.color 
    front tcp.custom.z1

;_________ CUSTOM BUTTONs1, end________________________________________________________


endmacro							


define_parameter LayoutA-tcpLabelSize 					'TCP Label Font Size' 7 1 9
define_parameter LayoutA-tcpInputFontSize 				'TCP Input Font Size' 1 1 5
define_parameter LayoutA-tcpVolPanFontSize 			'TCP Vol and Pan Font Size' 3 1 7
define_parameter LayoutA-tcpFXFontSize 				'TCP FX Font Size' 4 1 9
define_parameter LayoutA-tcpCBFontSize 				'TCP Custom Buttons Font Size' 3 1 5
define_parameter LayoutA-tcpDivOpacity 					'TCP Divider Opacity' 100 0 255
define_parameter tcpfolderIndentSize			 'TCP Folder Indent' 20 0 40
define_parameter tcpfolderBalType 			'TCP Folder Balance Type' 0 0 2
define_parameter LayoutA-hideIO                                            'TCP Show Route' 1 0 1
define_parameter LayoutA-ShowRecIn			 'TCP Show Rec Input' 2 0 2
define_parameter LayoutA-tcpFXPanelSize			 'TCP FX/Sends Panel Size' 140 50 300
define_parameter LayoutA-TranspFXSect                           'FX Panel Transparency' 50 0 255
define_parameter LayoutA-tcpFXPanelOff			 'TCP Hide FX/Sends Panel' 0 0 1
define_parameter LayoutA-TcpFX_Env					'TCP Show Classic FX and Envelope' 2 0 3
define_parameter LayoutA-TcpCBMode					'TCP Custom Buttons Mode' 0 0 2
define_parameter LayoutA-TcpMeterVals			'TCP Meter Values' 1 0 3
define_parameter LayoutA-tcpMeterSize			 'TCP Meter Width' 21 1 700
define_parameter LayoutA-tcpMeterSize2			 'TCP Meter Width (thin)' 7 1 700
define_parameter LayoutA-tcpMeterReadout                'TCP Meter Readout' 1 0 1
define_parameter LayoutA-tcpMeterBorder			 'TCP Meter Border' 1 0 1
define_parameter unclckbl_mtr                                  'TCP Hide Meter Menu (Careful)' 0 0 1
drawTcp A 1
Layout "Default"
drawTcp A 1
endLayout




#<
#>------------------------- MASTER TRACK CONTROL PANEL --------------------------------


macro masterFollow this thisW thisH xOffs noSpace

	set thisWs * Scale thisW
	set thisHs * Scale thisH
	set xOffsS * Scale ?xOffs{0} 0 .
	set thisXMargin * Scale !noSpace{0} xMargin 0
	set thisYMargin * Scale yMargin{0}
	set this + + + [previous previous] [previous{2}] [thisXMargin 0 thisWs{0} thisHs{0}] [xOffs{0}] ; position it at the end of the current row
	
	set sectionRHS + masterTcpSectionMainMargin{0} masterTcpSectionMainMargin{2}
	set thisRHS + this{0} this{2}
	set thisBS + this{1} this{3}
	
; if it'll fit in this row, its already there now, use it to possbly set a new biggestY
	set biggestY thisRHS{0}<=sectionRHS{0} thisBS{0}>biggestY{0} thisBS{0} .  

; -- move to next row--	
; if it WON'T fit in this row, use it to start the next row at biggestY + thisYMargin	
	set this thisRHS{0}>sectionRHS{0} + [masterTcpSectionMainMargin thisYMargin{0} this this] [0 biggestY{0}] .
; it didn't fit in the row, so it was used (in previous line) to start the next row, which means it will now be the new biggestY
	set biggestY thisRHS{0}>sectionRHS{0} + this{1} this{3}
; it didn't fit in the row, so it was used to start the next row, so the containing section will now need extra height
	set masterTcpSectionMain thisRHS{0}>sectionRHS{0} + + [0 0 0 this{1}] [masterTcpSectionMain masterTcpSectionMain masterTcpSectionMain this] [0 0 0 masterTcpSectionMainMargin{1}]
	
; -- cull if it extends below the height of the panel --	
	set thisBS + this{1} this{3} ; do that again because it might have moved rows
	set this thisBS{0}>h [this this 0 this] !previous{3} [this this 0 0] .   ; cull method is to set width to zero
	
; -- cull if it is itself too wide for the section
	set thisWPlus2Margins + this{2} * Scale + xMargin{0} xMargin{0}
	set this thisWPlus2Margins{0}>masterTcpSectionMain{2} [this this 0 0] .
	
; -- cull if previous element is zero height
	set this previous{3}==0 [this this 0 0] .

	set previous this
	
endmacro

;raw params separator
;define_parameter aaaa 				'' 0 0 0
;define_parameter aaaa0 				'' 0 0 0
define_parameter aaaa1 				'TRACK MASTER' 1 0 0
define_parameter aaaa2 				'_______________________________________________________________' 0 0 0
define_parameter aaaa3 				'_______________________________________________________________' 0 0 0

define_parameter masterTcpMeterWidth 				'Master TCP Meter Width' 73 10 700
define_parameter masterTcpMeterVals					'Master TCP Meter Values' 1 0 3
define_parameter masterTcpMtrBorder 				'Master TCP Meter Border' 1 0 1
set masterTcpVals					1
set masterTcpLabels					1
;define_parameter masterTcpBgColR 					'Master TCP Background Colour R' 51 0 255
;define_parameter masterTcpBgColG 					'Master TCP Background Colour G' 51 0 255
;define_parameter masterTcpBgColB 					'Master TCP Background Colour B' 51 0 255 
set masterTcpVolumeLength 				40


macro drawMasterTcp Scale

set master.tcp.size									[300 100 500]

custom master.tcp.custom.sectionMeter
	set masterTcpMeterWidthS						* Scale masterTcpMeterWidth{0}
	set master.tcp.custom.sectionMeter 				- [w 0 masterTcpMeterWidthS{0} h] [masterTcpMeterWidthS{0}]
	set master.tcp.custom.sectionMeter.color 		[0 0 0 0 38 38 38 255]

set masterTcpMeterBorder 0

set masterTcpMeterBorderS							* Scale masterTcpMeterBorder{0}
set master.tcp.meter 								+ + master.tcp.custom.sectionMeter [masterTcpMeterBorderS{0} masterTcpMeterBorderS{0}] * -2 [0 0 masterTcpMeterBorderS{0} masterTcpMeterBorderS{0}]
	set master.tcp.meter.vu.div                    	[masterTcpMtrBorder -1]
	set master.tcp.meter.readout.color             	[180 180 180 255 40 40 40 255]
	set master.tcp.meter.scale.color.lit.bottom    ?masterTcpMeterVals<2	!masterTcpMeterVals{0} [0 0 0 0 0 0 0 0] [0 0 0 190 0 0 0 0]   ?masterTcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set master.tcp.meter.scale.color.lit.top     ?masterTcpMeterVals<2  	!masterTcpMeterVals{0} [0 0 0 0 0 0 0 0] [0 0 0 190 0 0 0 0]  ?masterTcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set master.tcp.meter.scale.color.unlit.bottom  	!masterTcpMeterVals{0} [0 0 0 0 0 0 0 0] * textBrightnessMult{0}  !masterTcpMeterVals{0}==3  [110 110 110 0 0 0 0 0]  [0 0 0 0 0 0 0 0] 
	set master.tcp.meter.scale.color.unlit.top     	!masterTcpMeterVals{0} [0 0 0 0 0 0 0 0] * textBrightnessMult{0} !masterTcpMeterVals{0}==3 [110 110 110 0 0 0 0 0]  [0 0 0 0 0 0 0 0] 	

set masterTcpSectionMain							+ - [0 0 w] [0 0 master.tcp.custom.sectionMeter{2}] * Scale + [0 0 0 20] * 2 [0 0 0 sectionMargin{0}] 
	set masterTcpSectionMainMargin					+ masterTcpSectionMain * Scale + [sectionMargin{0} sectionMargin{0}] * -2 [0 0 sectionMargin{0} sectionMargin{0}]
	
set masterTcpSelectColRatio 					?track_selected / selectStrength{0} 100 0	
set masterTcpCol								+ * - 1 masterTcpSelectColRatio \
													[masterTcpBgColR masterTcpBgColG masterTcpBgColB] \
												* masterTcpSelectColRatio [255 255 255] 													
brightnessFromRGB 								masterTcpCol{0} masterTcpCol{1} masterTcpCol{2} masterTcpColBrightness	

;reset values for 'masterFollow' macro
set biggestY 0
set xOffs 0
set noSpace 0

set previous									+ [masterTcpSectionMainMargin masterTcpSectionMainMargin] * Scale [0 0 0 20] 
set masterTcpVolumeLength 						masterTcpVolumeLength{0}==20 20 . ; convert to a knob
custom master.tcp.custom.labelBlock 			'' 0 '' 'tcp_labelBlock_bg'
custom master.tcp.custom.labelBlockSel 			'' 0 '' 'tcp_labelBlock_bg_sel'
set masterTcpVolLabelBlockW						+ masterTcpVolumeLength{0} ?masterTcpLabels{0} 110 25
set master.tcp.size								* Scale + + [. . masterTcpVolLabelBlockW{0}] [0 0 masterTcpMeterWidth{0}] * 2 [0 0 sectionMargin{0}] ; set the y-axis tooSmall
masterFollow masterTcpLabelBlock				masterTcpVolLabelBlockW{0} 18 0 1	
	set master.tcp.custom.labelBlock 			?selInvertLabels{0} ?track_selected [0] masterTcpLabelBlock masterTcpLabelBlock
	set master.tcp.custom.labelBlock                + [ 0 1]
	set master.tcp.custom.labelBlockSel			?selInvertLabels{0} ?track_selected masterTcpLabelBlock [0] [0]
	set master.tcp.custom.labelBlockSel               + [ 0 1]
	set master.tcp.label						+ [masterTcpLabelBlock masterTcpLabelBlock] * Scale ?masterTcpLabels{0} [1 0 68 20] [0 0 0 20]
	set master.tcp.label.color					* textBrightnessMult{0} [220 220 220]
	set master.tcp.label.color					?selInvertLabels{0} ?track_selected [38 38 38] . .
	set master.tcp.label.font					+ 4 Scale{0}==1 [0] Scale{0}==1.5 [5] [10]

set master.tcp.volume.fadermode 					[1]
set master.tcp.volume							- + + [masterTcpLabelBlock masterTcpLabelBlock masterTcpLabelBlock] [master.tcp.label{2}] * Scale [0 -1 50 25] [0 0 master.tcp.label]
set masterTcpVolLabelW							masterTcpVals{0}>0 48 0
masterFollow master.tcp.volume.label			44 20 0 0
	set master.tcp.volume.label.font			tcp.volume.label.font
	set master.tcp.volume.label.color			* textBrightnessMult{0}  [150 160 170]
	set master.tcp.volume.label.margin			[-10 8 2 0 1]
front master.tcp.volume.label





set masterTcpPanBlockW							trackpanmode<=3 masterTcpVals{0}>0 58 20 trackpanmode==5 masterTcpVals{0}>0 80 42 trackpanmode==6 masterTcpVals{0}>0 86 60
masterFollow masterTcpPanBlock 					masterTcpPanBlockW 20 0 0
	custom master.tcp.custom.panBlock
	set master.tcp.custom.panBlock				?visSections{0} masterTcpPanBlock [0]
	set master.tcp.custom.panBlock.color 		?visSections{0} [0 0 0 0 255 255 100 255] [0 0 0 0 0 0 0]


set masterPanLabelW								* Scale masterTcpVals{0}>0 0 0
set master.tcp.pan.label						!masterTcpPanBlock{2} [0] trackpanmode<=3 + [masterTcpPanBlock masterTcpPanBlock masterPanLabelW{0}] * Scale [0 0 0 20] \
													+ + [masterTcpPanBlock masterTcpPanBlock masterPanLabelW{0}] \
													* Scale [0 0 0 10] trackpanmode==6 * Scale [0 10] [0]

	set master.tcp.pan.label.color				* textBrightnessMult{0}  [160 150 160]
	set master.tcp.pan.label.margin				?trackpanmode==6         [0 19 5 20 1]  [1 25 0 20 0.5] 
	set master.tcp.pan.label.font				tcp.pan.label.font
        front master.tcp.pan.label


set master.tcp.pan								!masterTcpPanBlock{2} [0] trackpanmode<6 + + [master.tcp.pan.label master.tcp.pan.label] [master.tcp.pan.label{2}] * Scale [0 -1 tcpPanLength 25] \
																				   + + [ masterTcpPanBlock masterTcpPanBlock] [master.tcp.pan.label{2}] * Scale [0 -1 86 10]
	set master.tcp.pan.fadermode				trackpanmode==6 [-1] [1] ;


set master.tcp.pan.label master.tcp.pan


set master.tcp.width							!masterTcpPanBlock{2} [0] trackpanmode<=3 [0] trackpanmode<6 + + [master.tcp.pan master.tcp.pan] [master.tcp.pan{2}] * Scale [2 0 22 22] \
																									   + + [masterTcpPanBlock masterTcpPanBlock] [master.tcp.pan.label{2}] * Scale [-86 11 86 10]
	set master.tcp.width.fadermode				master.tcp.pan.fadermode
set master.tcp.width.label						!masterTcpPanBlock{2} [0] trackpanmode<=3 [0] trackpanmode<6 + [master.tcp.pan.label master.tcp.pan.label masterPanLabelW{0}] * Scale [0 10 0 10] \
																									   + [masterTcpPanBlock masterTcpPanBlock masterPanLabelW{0}] * Scale [3 11 50 10]
	set master.tcp.width.label.color			[150 160 150]
	set master.tcp.width.label.margin			?trackpanmode==6         [0 19 5 20 0]  [1 25 0 20 0.5]
	set master.tcp.width.label.font				tcp.pan.label.font
front master.tcp.width.label


masterFollow master.tcp.io 				 		22 22 0 0
masterFollow masterTcpFxBlock 					44 22 0 0
set master.tcp.fx								!masterTcpFxBlock{2} [0] + [masterTcpFxBlock masterTcpFxBlock] * Scale [0 0 22 22]
set master.tcp.fxbyp							!masterTcpFxBlock{2} [0] + [master.tcp.fx master.tcp.fx] * Scale [22 0 22 22]
front master.tcp.fxbyp 


masterFollow master.tcp.env 				 	22 22 -1 0

masterFollow master.tcp.mute 					20 20 0 0
set master.tcp.mute                                         + [0 0] 
set master.tcp.solo				 	master.tcp.mute 
set master.tcp.solo                                         + [21 0 0 0] 

set masterTcpMonoW								?masterTcpLabels{0} 20 20
masterFollow master.tcp.mono 				  	masterTcpMonoW{0} 20 20 0

set masterTcpSelDotY							* 0.5 h<masterTcpSectionMain{3} h masterTcpSectionMain{3}
custom master.tcp.custom.tcp_selectionDot 		'' 0 '' 'tcp_selectionDot'
set master.tcp.custom.tcp_selectionDot 			!selDot{0} [0] ?track_selected [0] + + [masterTcpSectionMain masterTcpSectionMain] [masterTcpSectionMain{2} masterTcpSelDotY{0}] * Scale [-4 -4 8 8]
custom master.tcp.custom.tcp_selectionDotSel	'' 0 '' 'tcp_selectionDot_sel'	
set master.tcp.custom.tcp_selectionDotSel 		!selDot{0} [0] !track_selected [0] + + [masterTcpSectionMain masterTcpSectionMain] [masterTcpSectionMain{2} masterTcpSelDotY{0}] * Scale [-4 -4 8 8]
front master.tcp.custom.tcp_selectionDot master.tcp.custom.tcp_selectionDotSel

custom master.tcp.custom.sectionMain																
	set master.tcp.custom.sectionMain			masterTcpSectionMain
	set master.tcp.custom.sectionMain.color 	?visSections{0} [0 0 0 0 50 50 255 100] [0 0 0 0 masterTcpCol{0} masterTcpCol{1} masterTcpCol{2} 255]

custom master.tcp.custom.sectionBottom
	set master.tcp.custom.sectionBottom 		- [0 masterTcpSectionMain{3} masterTcpSectionMain h] [0 0 0 masterTcpSectionMain{3}] 
	set master.tcp.custom.sectionBottom.color 	?visSections{0} [0 0 0 0 100 255 100 150] [0 0 0 0 38 38 38 205]	
	set masterTcpSectionBottomMargin			+ master.tcp.custom.sectionBottom * Scale * sectionMargin{0} [1 1 -2 -2]

set master.tcp.fxparm							masterTcpSectionBottomMargin
	set master.tcp.fxparm.margin 				* Scale [3 0 4 0 1 0 0.5 4]
	set master.tcp.fxparm.font 					+ * Scale [0 24 60 100] + [4] 

custom master.tcp.custom.sectionBottom2  ;fx block
	set master.tcp.custom.sectionBottom2 		- [0 masterTcpSectionMain{3} 117 h] [0 0 0 0] 
	set master.tcp.custom.sectionBottom2.color 	[0 0 0 0 38 38 38 255]	

	
endMacro

drawMasterTcp 1

endLayout


	
#<
#> -------------------------- ENVELOPE CONTROL PANELS ---------------------------------

macro envFollow this thisW thisH xOffs noSpace
	set thisYMarginPlus10     0
	set thisWs * Scale thisW
	set thisHs * Scale thisH
	set xOffsS * Scale xOffs
	set thisXMargin * Scale !noSpace{0} xMargin 0
	set thisYMargin * Scale yMargin
	set this + + + [previous previous] [previous{2}] [thisXMargin 0 thisWs thisHs] [xOffsS] ; position it at the end of the current row
	set this ?hide_##this{0} + [previous] [previous{2} . 0 .] . ; apply hide by setting w to zero and ignoring both thisXMargin and xOffs
	
	set sectionRHS + envcp.custom.sectionMain{0} envcp.custom.sectionMain{2}
	set thisRHS + this{0} this{2}
	set thisBS + this{1} this{3}
	
; if it'll fit in this row, its already there now, use it to possbly set a new biggestY
	set biggestY thisRHS{0}<=sectionRHS{0} thisBS{0}>biggestY{0} thisBS{0} .  

; -- move to next row--	
; if it WON'T fit in this row, use it to start the next row at biggestY + thisYMargin	
	set this thisRHS{0}>sectionRHS{0} + [envMargin thisYMargin{0} this this] [0 biggestY{0}]
; it didn't fit in the row, so it was used (in previous line) to start the next row, which means it will now be the new biggestY
	set biggestY thisRHS{0}>sectionRHS{0} + this{1} this{3}
	
; -- cull if it extends below the height of the panel --	
	set thisBS + this{1} this{3} ; do that again because it might have moved rows
	set this thisBS{0}>h \
				h<singleRowH{0} \
					this{1}>thisYMarginPlus10{0} [this this 0 0] . \
					[this this 0 this] \
				!previous{3} [this this 0 0] .   ; cull method is to set width to zero
 
; -- cull if it is itself too wide for the section
	set thisWPlus2Margins + + this{2} thisXMargin{0} thisXMargin{0}}
	set this thisWPlus2Margins{0}>envcp.custom.sectionMain{2} [this this 0 0] .
	
; -- cull if previous element is zero height
	set this previous{3}==0 [this this 0 0] .
	
; -- this is the new previous	
	set previous this
	
endmacro

;raw params separator
;define_parameter bbbb0 				'' 0 0 0
define_parameter bbbb1 				'ENVELOPE CONTROL PANEL' 1 0 0
define_parameter bbbb2 				'_______________________________________________________________' 0 0 0
define_parameter bbbb3 				'_______________________________________________________________' 0 0 0

define_parameter envcpFontSize 						'Env Label Font Size' 5 1 9
define_parameter envValueFontSize 			                        'Env Value Font Size' 3 1 7
define_parameter showEnvValue 						'Show envelope value' 1 0 1
set MarginEnvcp 						1
set indentEnvcp 						1
set envcpFaderLength 					40

;define_parameter envcpBgColR 						'Env Background Colour R' 51 0 255
;define_parameter envcpBgColG 						'Env Background Colour G' 51 0 255
;define_parameter envcpBgColB 						'Env Background Colour B' 51 0 255
define_parameter envCustomColorDepth 				'Env Custom Color Strength' 15 0 100
define_parameter envcpDivOpacity 					'Env Divider Opacity' 80 0 255
define_parameter FollowTCPFoldBal 					'Follow TCP Folder Balance' 1 0 1

set tcpFoldB3       ?FollowTCPFoldBal{0}>0    tcpFoldB2{0}  folderdepth

set envCustomColorDepth                                              /    envCustomColorDepth 1.25
set envCustomColorRatio 							?trackcolor_valid / envCustomColorDepth{0} 100 0

macro drawEnvCP Scale

set envcp.size										* Scale [300 100 40] 
set singleRowH 										* Scale + 20 * 2 sectionMargin{0}
set ySqueeze 										h<singleRowH{0} - * Scale sectionMargin{0} * 0.5 - singleRowH{0} h * Scale sectionMargin{0}	
set thisTcpfolderIndentS							* Scale thisTcpfolderIndent{0}
custom envcp.custom.sectionMain	
	set envcp.custom.sectionMain					?indentEnvcp{0} - [thisTcpfolderIndentS{0} ySqueeze w h] [0 0 thisTcpfolderIndentS{0}] [0 ySqueeze w h] 
	set envcp.custom.sectionMain.color				?visSections{0} [0 0 0 0 100 255 150 150] [0 0 0 0 0 0 0 0]

set biggestY 0
set xOffs 0
set noSpace 0

set envMgInt    MarginEnvcp{0}>0            [26]   tcpfolderBalType{0}==2  [26]   [5] 

set envMargin   +   +:tcpFoldB3{0}:1 [tcpfolderIndentSize 0 0 0]  [envMgInt{0}] 
set previous										+ [envMargin{0} envcp.custom.sectionMain] * Scale [0 -1 0 20]
	
set hide_envcpLabelBlock							0
set hide_envcp.fader								0
set hide_envcp.value								?showEnvValue{0}  0 1
set hide_envcp.mod									envcp_type==4 0 1	;4 if FX envelope (can display additional controls)
set hide_envcp.learn								envcp_type==4 0 1
set hide_envcp.hide									0											

set envhide    +:tcpFoldB3{0}:1 [tcpfolderIndentSize] MarginEnvcp{0}>0 [85] [60]

set hide_envcpLabelBlock		w<envhide{0}					1
set hide_envcp.fader			w<envhide{0}					1
set hide_envcp.value			w<envhide{0}					1
set hide_envcp.mod			w<envhide{0}					1
set hide_envcp.learn			w<envhide{0}					1
set hide_envcp.hide			w<envhide{0}					1

set envcpLabelLength   +  +   +:tcpFoldB3{0}:1 [tcpfolderIndentSizeN]  w    -85     MarginEnvcp{0}>0   0   tcpfolderBalType{0}<2  20

;reset values for 'envFollow' macro 
set biggestY 0
set xOffs 0
set noSpace 0
		
; Calculate background color color now, for use in text brightness judgement	
set envSelectColRatio 							?env_selected / selectStrength{0} 100 0
set envcpCol									+ * - 1 envSelectColRatio + \
													* envCustomColorRatio [trackcolor_r trackcolor_g trackcolor_b] \
													* - 1 envCustomColorRatio [envcpBgColR envcpBgColG envcpBgColB] \
											!ColoredSelection==0	 * envSelectColRatio [trackcolor_r trackcolor_g trackcolor_b] \
 											!ColoredSelection==1	 * envSelectColRatio [255 255 255] 
brightnessFromRGB 								envcpCol{0} envcpCol{1} envcpCol{2} envcpColBrightness	
				
set thisEnvcpLabelLength							?indentEnvcp{0} tcpfolderBalanceType{0}==0 + envcpLabelLength tcpFolderBalancer envcpLabelLength envcpLabelLength
set envcpFaderLength 							envcpFaderLength{0}<=40 20 .
set envcpLabelBlockW								+ + + thisEnvcpLabelLength{0} envcpFaderLength{0}<=40 20 0 20 15    ; 20 is the recarm width, 15 is the bypass width
envFollow envcpLabelBlock	 						envcpLabelBlockW{0} 20 0 1 ;this thisW thisH xOffs noSpace

custom envcp.custom.labelBlock 					
	custom envcp.custom.labelBlockBg 				'' 0 '' 'tcp_labelBlock_bg' 
	custom envcp.custom.labelBlockBgSel				'' 0 '' 'tcp_labelBlock_bg_sel'
	set envcp.custom.labelBlockBg					?selInvertLabels{0} ?env_selected [0] envcpLabelBlock envcpLabelBlock
	set envcp.custom.labelBlockBgSel				?selInvertLabels{0} ?env_selected envcpLabelBlock [0] [0]

set envcp.arm  										envcpLabelBlock{2}==0 [0] + [envcpLabelBlock envcpLabelBlock] * Scale [2 0 20 20]
set envcp.bypass  									envcpLabelBlock{2}==0 [0] + + [envcp.arm envcp.arm] * Scale [2 0 14 20] [envcp.arm{2}]

set enlbl_ind    +:tcpFoldB3{0}:1 [tcpfolderIndentSize]  100
set envcp.label   						w>enlbl_ind{0}			envcpLabelBlock{2}==0 [0] + + [envcp.bypass envcp.bypass] * Scale [0 0 thisEnvcpLabelLength{0} 20] [envcp.bypass{2}]   0
set envcp.label.margin     							* Scale [2 0 4 0 0]
	set envcp.label.color							* textBrightnessMult{0} ?selInvertLabels{0} ?env_selected [28 28 28] [150 150 150] + 80 [envcpCol{0} envcpCol{1} envcpCol{2} 150 51 51 51 255] 
	set envcp.label.font							+ [envcpFontSize] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]

set envFaderXoffset									envcpFaderLength{0}<=40 -25 6
envFollow envcp.fader 	 							envcpFaderLength{0} 20 envFaderXoffset{0} 0
	set envcp.fader.fadermode 						envcpFaderLength{0}<=40 [1] [0]



set enval_ind_minW    +:tcpFoldB3{0}:1 [tcpfolderIndentSize]  180


;------------VALUE BACKGROUND---------------
custom envcp.custom.TxtBgnd
	set envcp.custom.TxtBgnd	   ?showEnvValue{0}			+	[envcp.fader envcp.fader envcp.fader envcp.fader] + - [-100 0 80 0]  [envValueFontSize{0} 0 0 0] [0 0 envValueFontSize{0} 0]
        set envcp.custom.TxtBgnd       h>=51  0     w<enval_ind_minW{0}  0		
	set envcp.custom.TxtBgnd.color			?selInvertLabels{0} ?env_selected  	 [0 0 0 0 179 179 179 220] [0 0 0 0 40 40 40 220]         [0 0 0 0 38 38 38 210] 
front envcp.custom.TxtBgnd	


;------------VALUE TEXT---------------
set envcp.value 	 	!showEnvValue{0}   0      h<51    +  [w envcpLabelBlock 100 20]  [-130 0 0 0]       +  [w 30 100 20]  [-105 0 0 0] 

set envcp.value  h<51  w<enval_ind_minW{0}  0
set enval_ind1    +:tcpFoldB3{0}:1 [tcpfolderIndentSize]  + 200 envValueFontSize{0}
set enval_ind2     +:tcpFoldB3{0}:1 [tcpfolderIndentSize]  + 150 envValueFontSize{0}
set envcp.value ?envcp_type==4  w<enval_ind1{0}  0 
set envcp.value ?envcp_type<4    w<enval_ind2{0} 0

	set envcp.value.font       						[envValueFontSize]
	set envcp.value.color     h<51 	    +	?selInvertLabels{0} ?env_selected    [28 28 28]  [165 165 165]              * textBrightnessMult{0}  [165 165 165] 
	set envcp.value.color     h>=51 	    +	?env_selected    [28 28 28]  [0 0 0]              * textBrightnessMult{0} envcpColBrightness{0}<115 [165 165 165] [10 10 10]      
	set envcp.value.margin     		[0 0 0 0 1] 
front envcp.value



;------------MOD--LEARN--HIDE---------------
envFollow envcp.mod 							20 20 0 0
envFollow envcp.learn								20 20 0 0
envFollow envcp.hide								36 20 0 0




custom envcp.custom.indentInfill
	set envcp.custom.indentInfill					?indentEnvcp{0} * Scale [0 0 thisTcpfolderIndent{0} h] [0 0 0 0]
	set envcp.custom.indentInfill.color				IndentInfillColor

custom envcp.custom.envcpDiv
	set envcp.custom.envcpDiv 						- [0 h w 1] [0 1]
	set envcp.custom.envcpDiv.color 				* Scale [0 0 0 0 0 0 0 envcpDivOpacity{0}]

custom envcp.custom.sectionMainBg
	set envcp.custom.sectionMainBg					[envcp.custom.sectionMain 0 envcp.custom.sectionMain h]
	set envcp.custom.sectionMainBg.color			?visSections{0} [0 0 0 0 255 50 255 60] [0 0 0 0 envcpCol{0} envcpCol{1} envcpCol{2} 255]




endMacro

drawEnvCP 1

endLayout


#<
#>---------------------------------- THE MIXER ----------------------------------------

;-- GLOABL MCP PARAMS --

;raw params separator
;define_parameter cccc0 				'' 0 0 0
define_parameter cccc1 				'MIXER CONTROL PANEL' 1 0 0
define_parameter cccc2 				'_______________________________________________________________' 0 0 0
define_parameter cccc3 				'_______________________________________________________________' 0 0 0

define_parameter mcpLabelSize 				'MCP Label Font Size' 5 1 9
define_parameter mcpFXFontSize 				'MCP FX Font Size' 3 1 9
define_parameter mcpVolPanFontSize 				'MCP Vol/Pan Font Size' 3 1 5
define_parameter mcpInputFontSize 				'MCP Input Font Size' 1 1 5
define_parameter LayoutA-verboseMcp 				'MCP Show Vol/Pan Values' 1 0 1
define_parameter LayoutA-McpLabels 				'MCP Show Lables' 1 0 1
define_parameter LayoutA-mcpTintBackground		'MCP Tint Background' 1 0 1
define_parameter mcpDivOpacity 				'MCP Divider Opacity' 180 0 255
define_parameter mcpfolderIndentSize		'MCP Folder Indent' 10 0 40
define_parameter mcpfolderBalanceType		'MCP Folder Balance' 0 0 1
;define_parameter mcpBgColR 					'MCP Background Colour R' 51 0 255
;define_parameter mcpBgColG 					'MCP Background Colour G' 51 0 255
;define_parameter mcpBgColB 					'MCP Background Colour B' 51 0 255


macro mcpFollow this thisW thisH yOffs noSpace Form

	set thisWs * Scale thisW
	set thisHs * Scale thisH
	set yOffsS * Scale yOffs
	set thisYMargin * Scale !noSpace{0} 6 0 ; hard coding margin as 6
	
	set this mcpForm{0}==Form{0} + + + [previous previous] [0 previous{3}] [0 thisYMargin{0} thisWs thisHs] [0 yOffsS]
	set this mcpForm{0}==Form{0} ?hide_##this{0} + [previous previous] [0 previous{3} . 0] . ; apply hide by setting h to zero and ignoring both thisYMargin and yOffs
	
	set thisBS	mcpForm{0}==Form{0} + + this{1} this{3} thisYMargin{0}
	set sectionButtonsBS mcpForm{0}==Form{0} + mcp.custom.sectionButtons{1} mcp.custom.sectionButtons{3}
	set this mcpForm{0}==Form{0} thisBS{0}>sectionButtonsBS{0} [. . . 0] . ; cull if extending below buttons section
	set biggestY mcpForm{0}==Form{0} thisBS{0}>biggestY{0} thisBS{0}

	; -- this is the new previous	
	set previous mcpForm{0}==Form{0} this
	
endMacro


macro drawMcp thisLayout Scale

;-- HOUSEKEEPING --

clear mcp.*

set thisMcpfolderIndent						* folderdepth mcpfolderIndentSize
set hAfterIndent							- h * Scale thisMcpfolderIndent{0}

 
set mcpNchanGrowPx							tracknch<3 0 * - tracknch 2 ?recarm Layout##thisLayout##-mcpNchanGrowRecarm ?track_selected Layout##thisLayout##-mcpNchanGrowSel Layout##thisLayout##-mcpNchanGrow
set mcpWidth 								* Scale + mcpNchanGrowPx{0} ?recarm Layout##thisLayout##-mcpWidthRecarm ?track_selected Layout##thisLayout##-mcpWidthSel Layout##thisLayout##-mcpWidth
set mcpFormW								* Scale [22 58]
set mcpForm								[3] ; 1=Strip, 2=Intermediate, 3=Normal
set addSidebar								?recarm ?Layout##thisLayout##-mcpSidebarRecarm{0} 1 0 ?track_selected ?Layout##thisLayout##-mcpSidebarSel{0} 1 0 ?Layout##thisLayout##-mcpSidebar{0} 1 0
set sidebarWidth							* Scale ?addSidebar{0} Layout##thisLayout##-sidebarWidth{0} 0
												


;-- SECTIONS --

custom mcp.custom.mcpDiv
	set mcp.custom.mcpDiv 					- [0 0 1 h] * Scale [0 0 0 thisMcpfolderIndent{0}]
	set mcp.custom.mcpDiv.color 			* Scale [0 0 0 0 0 0 0 mcpDivOpacity{0}]

; calculate sectionBottom height
set sectionBottomH							* Scale + 44 thisMcpfolderIndent{0} 
set maxSectionBottomH						* Scale + 44 * mcp_maxfolderdepth mcpfolderIndentSize
set sectionBottomH							?mcpfolderBalanceType{0} maxSectionBottomH  .
set stripSectionBottomH						* Scale + + 20 88 * mcp_maxfolderdepth mcpfolderIndentSize

; calculate sectionButtons height

set centW									* 0.5 mcpWidth{0}											
set firstThirdW								+ sidebarWidth * 0.3333 mcpWidth{0}
set secondThirdW							+ sidebarWidth * 0.6666 mcpWidth{0}	



;--Top Section--

custom mcp.custom.sectionTop 
custom mcp.custom.recinputBg_h				'' 0 '' 'dropdownBg_h'
custom mcp.custom.recinputBg_v				'' 0 '' 'dropdownBg_v'
custom mcp.custom.recmodeBg_h				'' 0 '' 'dropdownBg_h'
custom mcp.custom.recmodeBg_v				'' 0 '' 'dropdownBg_v'

; Normal Width
set mcp.custom.sectionTop					mcpForm{0}==3 + [sidebarWidth 0 mcpWidth{0}] * Scale hAfterIndent{0}>Layout##thisLayout##-mcpNormalShowSecIn{0} [0 0 0 50] [0]
set mcp.custom.recinputBg_v					mcpForm{0}==3 [0]
set mcp.custom.recmodeBg_v					mcpForm{0}==3 [0]
set mcp.custom.recinputBg_h					mcpForm{0}==3 !mcp.custom.sectionTop{3} [0] + [mcp.custom.sectionTop] + [0 0 mcpWidth{0}] * Scale [6 6 -12 20] 
set mcp.recinput							mcp.custom.recinputBg_h
set mcp.custom.recmodeBg_h					mcpForm{0}==3 !mcp.custom.sectionTop{3} [0] + [mcp.custom.sectionTop] * Scale [6 30 40 20] 
set mcp.recmode								mcp.custom.recmodeBg_h 
set mcp.fxin								mcpForm{0}==3 !mcp.custom.sectionTop{3} [0] + + [mcp.custom.sectionTop] [mcp.custom.sectionTop{2}] * Scale [-26 30 20 20] 


set mcp.custom.sectionTop.color 			?visSections{0} [0 0 0 0 255 100 100 150] [0 0 0 1 0 0 0 0]
set mcp.recinput.font						[mcpInputFontSize]
set mcp.recinput.color 						* textBrightnessMult{0} [185 185 185] 
set mcp.recinput.margin						* Scale mcp.recinput{3}>mcp.recinput{2} [1 4 0 20] [4 1 20 0] 



;--Pan Section--

custom mcp.custom.sectionPan
; Calculate resulting color for use in text brightness judgement	
set mcpMainSecCol								+ * - 1 selectColRatio + \
													* customColorRatio [trackcolor_r trackcolor_g trackcolor_b] \
													* - 1 customColorRatio [mcpBgColR mcpBgColG mcpBgColB] \
												* selectColRatio [255 255 255] 
brightnessFromRGB 								mcpMainSecCol{0} mcpMainSecCol{1} mcpMainSecCol{2} mcpMainSecColBrightness
		
set mcpPanWidthCorr     -   /  mcpWidth   20 ;  
set mcpPanWidthCorr  -   /  * mcpPanWidthCorr  * mcpPanWidthCorr 1.5  2  12
set mcpWidthDiv      -   / mcpWidth 2 40
set mcpPanWidthCorr       ?mcpPanWidthCorr{0}>mcpWidthDiv{0}   - mcpWidthDiv{0} 2

								
; Normal Width
set mcp.custom.sectionPan 					mcpForm{0}==3 + + [sidebarWidth 0 mcpWidth{0}] [0 mcp.custom.sectionTop{3}] hAfterIndent{0}<Layout##thisLayout##-mcpNormalShowSecPan{0} [0] * Scale !Layout##thisLayout##-verboseMcp{0} [0 0 0 30] [0 0 0 46]
set mcp.custom.sectionPan.color 			mcpForm{0}==3 [0 0 0 1 0 0 0 0]
set mcp.pan.label							mcpForm{0}==3 mcp.custom.sectionPan{3}==0 [0] !Layout##thisLayout##-verboseMcp{0} [mcp.custom.sectionPan mcp.custom.sectionPan] \
												+ [mcp.custom.sectionPan mcp.custom.sectionPan mcp.custom.sectionPan] * Scale [0 0 0 14]
set mcp.pan.label.margin					mcpForm{0}==3 * [Scale Scale Scale Scale 1] trackpanmode>=4 [mcpPanWidthCorr{0} 2 0 0 0] [6 2 6 0 0.5]
set mcp.pan.label.color						mcpForm{0}==3 * textBrightnessMult{0} mcpMainSecColBrightness{0}<120 [180 180 180] [38 38 38]
set mcp.pan									mcpForm{0}==3 mcp.custom.sectionPan{3}==0 [0] \
												trackpanmode==6  + + * Scale [6 14 -12 10] [0 mcp.pan.label{3}] [mcp.pan.label mcp.pan.label mcp.custom.sectionPan] \
												+ + [centW mcp.pan.label{3}] [mcp.custom.sectionPan mcp.pan.label] * Scale trackpanmode>=4 [-20 4 20 20] [-10 4 20 20]
set mcp.width								mcpForm{0}==3 mcp.custom.sectionPan{3}==0 [0] \
												trackpanmode==6 + + * Scale [6 4 -12 10] [0 mcp.pan.label{3}] [mcp.pan.label mcp.pan.label mcp.custom.sectionPan] \
												trackpanmode>=4 + [mcp.pan mcp.pan] * Scale [22 0 20 20] [0]
set mcp.width.label							mcpForm{0}==3 mcp.custom.sectionPan{3}==0 [0] trackpanmode>=4 !Layout##thisLayout##-verboseMcp{0} [0] \
												+ [mcp.custom.sectionPan mcp.custom.sectionPan mcp.custom.sectionPan] * Scale [0 0 0 14] [0]
set mcp.width.label.margin					mcpForm{0}==3 * [Scale Scale Scale Scale 1] [0 2 mcpPanWidthCorr{0} 0 1]


	set mcp.custom.sectionPan.color 		?visSections{0} [0 0 0 0 100 255 100 100]
	set mcp.pan.label.font					[mcpVolPanFontSize]
	set mcp.pan.fadermode					trackpanmode==6 [-1] [1]
	set mcp.width.fadermode					trackpanmode==6 [-1] [1]
	set mcp.width.label.font				[mcpVolPanFontSize]
	set mcp.width.label.color				mcp.pan.label.color



;--Button Section--	
	
set mcpTrTint 120

custom mcp.custom.sectionButtons
set mcpIoH									?Layout##thisLayout##-McpLabels{0} 32 22
set mcpEnvH									?Layout##thisLayout##-McpLabels{0} 30 22

; Normal Width
set mcp.custom.sectionButtons				mcpForm{0}==3 + [sidebarWidth] + [mcpWidth{0} mcp.custom.sectionPan] - + * Scale [-32 0 32] [0 mcp.custom.sectionPan{3} 0 h]	\
												+ + [0 0 0 mcp.custom.sectionPan{1}] [0 0 0 mcp.custom.sectionPan{3}] [0 0 0 sectionBottomH{0}]	
set mcp.custom.sectionButtons.color			mcpForm{0}==3 ?Layout##thisLayout##-mcpTintBackground{0} [0 0 0 1 24 24 24 mcpTrTint{0}]  [0 0 0 1 38 38 38 255]

set biggestY								0
set hide_mcp.mute							0
set hide_mcp.solo							0
set hide_mcp.io								!Layout##thisLayout##-mcpNormalShowRoute{0} 1 0
set hide_mcp.fxGroup						!Layout##thisLayout##-mcpNormalShowSecFx{0} 1 0
set hide_mcp.env							!Layout##thisLayout##-mcpNormalShowEnv{0} 1 0
;set hide_mcp.phase							!Layout##thisLayout##-mcpNormalShowPhase{0} 1 0
set previous								mcpForm{0}==3 + [mcp.custom.sectionButtons mcp.custom.sectionButtons] * Scale [6 6 0 0] ; Null object	
mcpFollow mcp.mute							20 20 0 1 3
mcpFollow mcp.solo							20 20 1 1 3
mcpFollow mcp.io							20 mcpIoH{0} 0 0 3
mcpFollow mcp.fxGroup						20 36 0 0 3
set mcp.fx									mcp.fxGroup{3}>0 + [mcp.fxGroup mcp.fxGroup] * Scale + [0 0 20 20] ?Layout##thisLayout##-McpLabels{0} [0 0] [0 -3] [0]
set mcp.fxbyp								mcp.fxGroup{3}>0 + + [mcp.fxGroup mcp.fxGroup] [0 mcp.fx{3}] * Scale + [0 0 20 16] ?Layout##thisLayout##-McpLabels{0} [0 0] [0 -3] [0]
mcpFollow mcp.env							22 mcpEnvH{0} 0 0 3
 set mcp.env + ?Layout##thisLayout##-McpLabels{0} [0 0] [0 -4]
 set mcp.env + !Layout##thisLayout##-mcpNormalShowSecFx{0} [0 2] [0 0]
set fdmcp +:folderdepth:1 [mcpfolderIndentSize 0 0 0] + [SectionBottomH] [130]
set fdmcp2 + [maxSectionBottomH] [260]
set mcp.phase		?Layout##thisLayout##-mcpNormalShowPhase{0} 		+   + [mcp.env mcp.env] * Scale [2 34 16 20]  !Layout##thisLayout##-mcpNormalShowEnv{0} [0 -32 0 0] [0 0 0 0] 
set mcp.phase   ?mcpfolderBalanceType{0}==0    h<fdmcp{0}    [0]
 set mcp.phase + ?Layout##thisLayout##-McpLabels{0} [0 0] !Layout##thisLayout##-mcpNormalShowEnv{0} [0 2] [0 -12]
 ;set mcp.phase + !Layout##thisLayout##-mcpNormalShowSecFx{0} !Layout##thisLayout##-McpLabels{0} [0 2] [0 0] [0 0] 

;--Dark Box Section--	

custom mcp.custom.mcpDarkBox

; Normal Width
set mcp.custom.mcpDarkBox					mcpForm{0}==3 + + [sidebarWidth mcp.custom.sectionPan w h] [0 mcp.custom.sectionPan{3}] \
												* -1 + + [0 0 mcp.custom.sectionButtons sectionBottomH] [0 0 sidebarWidth mcp.custom.sectionPan{1}] [0 0 0 mcp.custom.sectionPan{3}]
set standardDarkBoxMinH						- h + + maxSectionBottomH mcp.custom.sectionPan{1} mcp.custom.sectionPan{3}												

set VolVerboseSpace 20

set   mcpMW                                *      -  / 160 mcpWidth  2   -1
set   mcpMWdef                       + 0.9       / + mcpMW 0.5  / + 10  Layout##thisLayout##-mcpMeterWidth 10 
set   mcpMeterWdth                               /  mcp.custom.mcpDarkBox{2} mcpMWdef  ; 
set   mcpMmarg_corr               +   / Layout##thisLayout##-mcpMeterWidth 25 2

set   mcpMeterPos                                                 +   /   -    mcp.custom.mcpDarkBox{2}   [mcpMeterWdth] mcpMmarg_corr{0}  mcp.custom.mcpDarkBox{0}

set mcp.meter								mcpForm{0}==3 + + * Scale [4 15 -32 -54] [mcpMeterPos{0} mcp.custom.mcpDarkBox mcpMeterWdth{0} mcp.custom.mcpDarkBox] \
												* [0 1 0 -1] ?Layout##thisLayout##-verboseMcp{0} [0 VolVerboseSpace 0 VolVerboseSpace] ;
set mcp_vol_corr                         +  *  -   /  mcp.custom.mcpDarkBox{2} 8  11   -1 sidebarWidth
        


set mcp.volume								mcpForm{0}==3 + + [mcp_vol_corr{0} mcp.custom.mcpDarkBox 0 mcp.custom.mcpDarkBox] + [mcp.custom.mcpDarkBox{2}] * Scale  [-28 6 25 -36]  \
												* [0 1 0 -1] ?Layout##thisLayout##-verboseMcp{0} [0 VolVerboseSpace 0 VolVerboseSpace] 
set mcp.volume.label                     	mcpForm{0}==3 !Layout##thisLayout##-verboseMcp{0} [0] + + [mcp.volume mcp.volume] * [0.5 1] [mcp.volume{2} mcp.volume{4}] * Scale - [-52 -24 100 20] mcpWidth{0}<100 [8 0 0 0]

set mcpVolKnobH								* Scale 60												
set mcp.volume								mcpForm{0}==3 mcp.volume{3}<mcpVolKnobH{0} + [. . ] * Scale [0 0 20 20] ; turn into a knob												
set mcp.recarm								mcpForm{0}==3 + + [mcp.volume mcp.volume] * [0.5 1] [mcp.volume{2} mcp.volume{3}] * Scale [-10 4 20 20]
set mcp.recmon								mcpForm{0}==3 + + + [mcp.meter mcp.meter] * Scale [-10 13 20 20] [0 mcp.meter{3}] * 0.5 [mcp.meter{2}]
 


set mcp.custom.mcpDarkBox.color 			?Layout##thisLayout##-mcpTintBackground{0}  [0 0 0 1 24 24 24 mcpTrTint{0}] [0 0 0 1 38 38 38 255]
          set mcp.volume.label.color            		* textBrightnessMult{0} mcpMainSecColBrightness{0}<220 [170 170 170] [18 18 18]
	  set mcp.volume.label.font			[mcpVolPanFontSize]
	  set mcp.volume.label.margin           * [Scale Scale Scale Scale 1] [0 6 0 0 0.5]
set mcp.meter.vu.div                   		* Scale [Layout##thisLayout##-mcpMeterBorder -1]
	set mcp.meter.readout.color            	!Layout##thisLayout##-mcpMeterReadout{0} [0 0 0 0 0 0 0 0] * textBrightnessMult{0} [170 170 170 255 30 30 30 255]
	set showMcpMeterVals					?Layout##thisLayout##-mcpMeterVals{0} 1 0

	set mcp.meter.scale.color.lit.bottom   ?Layout##thisLayout##-mcpMeterVals{0}<2 	!showMcpMeterVals{0} [0 0 0 0 0 0 0 0] [0 0 0 190 0 0 0 0] ?Layout##thisLayout##-mcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set mcp.meter.scale.color.lit.top      ?Layout##thisLayout##-mcpMeterVals{0}<2	!showMcpMeterVals{0} [0 0 0 0 0 0 0 0] [0 0 0 190 0 0 0 0] ?Layout##thisLayout##-mcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set mcp.meter.scale.color.unlit.bottom 	* textBrightnessMult{0}       !showMcpMeterVals{0} [0 0 0 0 0 0 0 0] ?recarm [235 64 0 255 0 0 0 0] !Layout##thisLayout##-mcpMeterVals{0}==3 +  - 1 [0 0 0 100] [90 90 90 0 0 0 0 0]
	set mcp.meter.scale.color.unlit.top   * textBrightnessMult{0} 	!showMcpMeterVals{0} [0 0 0 0 0 0 0 0] ?recarm [235 64 0 255 0 0 0 0] !Layout##thisLayout##-mcpMeterVals{0}==3 +  - 1 [0 0 0 100] [90 90 90 0 0 0 0 0]

custom  mcp.custom.unclickable_meter   '' 40527 '' ''  
    set     mcp.custom.unclickable_meter  mcp_unclckbl_mtr{0}==1 mcp.meter
    front     mcp.custom.unclickable_meter

;--Bottom Section & Sidebar--	

custom mcp.custom.sectionBottom
custom mcp.custom.mcpNameBg
custom mcp.custom.indentInfill
custom mcp.custom.mcpIdxBg
custom mcp.custom.mcp_selectionDot 				'' 0 '' 'tcp_selectionDot'
custom mcp.custom.mcp_selectionDotSel			'' 0 '' 'tcp_selectionDot_sel'	
custom mcp.custom.sidebarBg
set mcpFolderBalance						!mcpfolderBalanceType 0  * - mcp_maxfolderdepth folderdepth mcpfolderIndentSize

; Normal Width
set mcp.custom.sectionBottom				mcpForm{0}==3 + [0 mcp.custom.sectionButtons mcpWidth sectionBottomH] [0 mcp.custom.mcpDarkBox{3} sidebarWidth]
set mcp.custom.mcpNameBg 					mcpForm{0}==3 + + [0 mcp.custom.sectionBottom mcpWidth] * Scale + [0 0 0 24] [0 0 0 mcpFolderBalance{0}] [0 0 sidebarWidth]
set mcp.label 								mcpForm{0}==3 mcp.custom.mcpNameBg
set mcp.label.margin 						mcpForm{0}==3 * [Scale Scale Scale Scale 1] [4 0 4 0 0.5]
set mcp.custom.mcpIdxBg 					mcpForm{0}==3 + + [0 mcp.custom.mcpNameBg mcpWidth] * Scale [0 0 0 20] [0 mcp.custom.mcpNameBg{3} sidebarWidth]
set mcp.custom.sidebarBg					mcpForm{0}==3 - [0 0 sidebarWidth{0} h] [0 0 0 mcp.custom.sectionBottom{3}]
set mcp.extmixer.mode        				mcpForm{0}==3 ?addSidebar{0} [1] [-1]

set mcp.custom.sectionBottom.color 			?visSections{0} [0 0 0 0 50 150 200 100] [0 0 0 1 0 0 0 0]												

     set mcp.custom.mcpNameBg.color    [0 0 0 255 38 38 38 255]
     set mcp.custom.mcpNameBg.color    ?selInvertLabels{0} ?track_selected ?recarm [0 0 0 255 181 176 175 255] [0 0 0 255 176 177 178 255]  . .


custom mcp.custom.mcpNameBg_layer ; labelBlock (tint selection layer)
set mcp.custom.mcpNameBg_layer                mcp.custom.mcpNameBg
    set mcp.custom.mcpNameBg_layer.color  ?ColoredSelection=1  ?track_selected  [0 0 0 255 trackcolor_r trackcolor_g trackcolor_b 15] [0 0 0 255 trackcolor_r trackcolor_g trackcolor_b 5]
    set mcp.custom.mcpNameBg_layer.color   ?ColoredSelection=0  ?track_selected [0 0 0 255 176 177 178 7]
    front mcp.custom.mcpNameBg_layer


set mcp.label.font 							+ mcpLabelSize{0} Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
set mcp.label.color 					* textBrightnessMult{0}	?recarm [255 80 100] ?trackcolor_valid ?colorTrackLabels cColorTextOnDark * textBrightnessMult{0} [200 200 200] * textBrightnessMult{0} [200 200 200] 
set mcp.label.color 						?selInvertLabels{0} ?track_selected ?recarm [110 0 10] * / textBrightnessMult{0} 5 [trackcolor_r trackcolor_g trackcolor_b] . .
set mcp.custom.indentInfill					+ + [0 mcp.custom.sectionBottom mcpWidth mcp.custom.sectionBottom] [0 mcp.custom.mcpNameBg{3} sidebarWidth] * Scale [0 20] ; 20 is about to be the indexBg h
set mcp.custom.indentInfill.color			IndentInfillColor
set mcp.custom.mcpIdxBg.color 		!NumberSectionSat	?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b] [0 0 0 0 100 110 120 255] ?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b 170] [0 0 0 0 100 105 110 255] 

set mcp.custom.mcp_selectionDot 			!selDot{0} [0] ?track_selected [0] + * 0.5 + [mcp.custom.mcpIdxBg{2}] folderstate==1 * Scale [18] [0] + [0 mcp.custom.mcpIdxBg] * Scale [-4 -4 8 8]
set mcp.custom.mcp_selectionDotSel 			!selDot{0} [0] !track_selected [0] + * 0.5 + [mcp.custom.mcpIdxBg{2}] folderstate==1 * Scale [18] [0] + [0 mcp.custom.mcpIdxBg] * Scale [-4 -4 8 8]
front mcp.custom.mcp_selectionDot mcp.custom.mcp_selectionDotSel
set mcp.trackidx                         	+ * 0.5 + [mcp.custom.mcpIdxBg{2}] folderstate==1 * Scale [18] [0] + [0 mcp.custom.mcpIdxBg] * Scale [-15 0 28 20]
	set mcp.trackidx.margin                	* [Scale Scale Scale Scale 1] [0 0 0 0 0.5]
	set mcp.trackidx.color 			!NumberSectionSat		 	tcpSectionNumberBrightness{0}>135 [0 0 0 255 0 0 0 0] [255 255 255 255 0 0 0 0]  tcpSectionNumberBrightness{0}>138 [0 0 0 255 0 0 0 0] [225 225 225 255 0 0 0 0] 
		 	
	set mcp.trackidx.font						trackidx<100  [3] [3] 


set mcp.folder								folderstate<0 + + [mcp.custom.mcpIdxBg mcp.custom.mcpIdxBg] [mcp.custom.mcpIdxBg{2}] * Scale [-6 0 6 20] + [mcp.custom.mcpIdxBg mcp.custom.mcpIdxBg] * Scale [0 0 20 20] 
set mcp.custom.sidebarBg.color				[0 0 0 0 38 38 38]		
set mcp.extmixer.position					mcp.extmixer.mode{0}>0 + mcp.custom.sidebarBg * Scale [2 0 -2] \
												mcpDivOpacity{0}>0 [2 0 -4 0] [1 0 -2 0]
set mcpW   +  / mcpWidth 40  2
set sidebarW   +  / sidebarWidth 40  2

set autoWscroll    ?addSidebar{0}     sidebarW{0}  mcpW{0}  

set MCPfxElmSz           +    21  mcpFXFontSize{0}
set  mcpSendFontSize   mcpFXFontSize{0}>1   -  mcpFXFontSize{0} 1   1

set mcp.fxparm.font 						+ * Scale [1 25] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
	set mcp.fxparm.margin					* [Scale Scale Scale Scale 1 Scale Scale Scale] [3 0 4 6 0.5 0 0 2]												
set mcp.fxlist.font 						+ * Scale [mcpFXFontSize MCPfxElmSz{0} 200 200 0 0 2 autoWscroll{0}] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
	set mcp.fxlist.margin					* [Scale Scale Scale Scale 1 Scale Scale Scale] [3 0 4 6 0.5 0 20 2]
set mcp.sendlist.font 						+ * Scale [mcpSendFontSize 24 200 200 0 0 2 autoWscroll{0}] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]	
	set mcp.sendlist.margin 				* [Scale Scale Scale Scale 1 Scale Scale Scale] [2 0 0 0 0 0 0 0 2]
front mcp.extmixer
	
;--MCP Size--
	
set minH									mcpForm{0}==3 + + + mcp.custom.sectionTop{3} mcp.custom.sectionPan{3} maxSectionBottomH{0} * Scale 90
set mcp.size 								+ + [mcpWidth 0 0 minH{0}] [sidebarWidth] * Scale [0 360]	


;--Custom BGs--

custom mcp.custom.tcpSelBox
	set mcp.custom.tcpSelBox 				!track_selected [0] selectStrength{0}>0 + [0 0 mcp.size{0} 0 0 0 1 1] * Scale [0 0 0 360] [0]
	set mcp.custom.tcpSelBox.color 		!ColoredSelection=1	       + * / selectStrength{0} 100 [0 0 0 0 0 0 0 255] [0 0 0 0 255 255 255]	
        set mcp.custom.tcpSelBox.color          !ColoredSelection=0         ?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b SelectionColorDepth{0}] [0 0 0 0 200 200 200 SelectionColorDepth{0}]

custom mcp.custom.mcpColBox
	set mcp.custom.mcpColBox 				!customColorDepth{0} [0] + [0 0 mcp.size{0} 0 0 0 1 1]  * Scale [0 0 0 360]
	set mcp.custom.mcpColBox.color 			?trackcolor_valid [0 0 0 0 trackcolor_r trackcolor_g trackcolor_b customColorDepth{0}] [0 0 0 0 0]

custom mcp.custom.mcpBgBox
	set mcp.custom.mcpBgBox 				+ [0 0 mcp.size{0} 0 0 0 1 1] * Scale [0 0 0 360]
	set mcp.custom.mcpBgBox.color 			[0 0 0 0 mcpBgColR mcpBgColG mcpBgColB 255]

endLayout

endMacro



define_parameter LayoutA-mcpNormalShowRoute			'MCP Show Route' 1 0 1
define_parameter LayoutA-mcpNormalShowSecFx			'MCP Show Fx' 1 0 1
define_parameter LayoutA-mcpNormalShowEnv			'MCP Show Envelope' 1 0 1
define_parameter LayoutA-mcpNormalShowPhase		'MCP Show Phase' 1 0 1
define_parameter LayoutA-sidebarWidth				'MCP Sidebar Width' 91 30 300
define_parameter LayoutA-mcpSidebar					'MCP Mixer Sidebar' 0 0 1
define_parameter LayoutA-mcpSidebarSel				'MCP Selected Mixer Sidebar' 0 0 1
define_parameter LayoutA-mcpSidebarRecarm			'MCP Armed Mixer Sidebar' 0 0 1
define_parameter LayoutA-mcpWidth					'MCP Mixer Panel Width' 105 80 300
define_parameter LayoutA-mcpWidthSel				'MCP Selected Mixer Panel Width' 105 80 300
define_parameter LayoutA-mcpWidthRecarm				'MCP Armed Mixer Panel Width' 105 80 300
define_parameter LayoutA-mcpMeterVals				'MCP Meter Values' 1 0 3
define_parameter LayoutA-mcpMeterWidth		'MCP Meter Width' 26 1 50
define_parameter LayoutA-mcpMeterReadout			'MCP Meter Readout' 1 0 1
define_parameter LayoutA-mcpMeterBorder		'MCP Meter Border' 1 0 1
define_parameter mcp_unclckbl_mtr                                  'MCP Hide Meter Menu (Careful)' 0 0 1
set LayoutA-mcpNormalShowSecIn			320
set LayoutA-mcpNormalShowSecPan		260
set LayoutA-mcpNchanGrow			2
set LayoutA-mcpNchanGrowSel			2
set LayoutA-mcpNchanGrowRecarm		2

drawMcp A 1
Layout "Default"
drawMcp A 1
endLayout





#<

#>--------------------------------- MASTER MIXER --------------------------------------

;raw params separator
;define_parameter dddd 				'' 0 0 0
define_parameter dddd0 				'' 0 0 0
define_parameter dddd1 				'MIXER MASTER' 1 0 0
define_parameter dddd2 				'_______________________________________________________________' 0 0 0
define_parameter dddd3 				'_______________________________________________________________' 0 0 0

define_parameter masterMcpFXFontSize 				'Master MCP FX Font Size' 2 1 8
define_parameter masterMcpValsFontSize 				'Master MCP Vol/Pan Font Size' 2 1 7
define_parameter masterMcpVals						'Master MCP Show Vol/Pan Values' 1 0 1
define_parameter masterMcpLabels					'Master MCP Labels' 1 0 1
define_parameter masterMcpWidth						'Master Mixer Panel Width' 151 90 300
define_parameter masterMcpMeterVals					'Master MCP Meter Values' 1 0 3
define_parameter masterMcpMeterReadout					'Master MCP Meter Readout' 1 0 1
define_parameter masterMcpMtrBorder 				'Master MCP Meter Border' 1 0 1
;define_parameter masterMcpBgColR 					'Master MCP Background Colour R' 51 0 255
;define_parameter masterMcpBgColG 					'Master MCP Background Colour G' 51 0 255
;define_parameter masterMcpBgColB 					'Master MCP Background Colour B' 51 0 255


macro masterMcpFollow this thisW thisH yOffs noSpace

	set thisWs * Scale thisW
	set thisHs * Scale thisH
	set yOffsS * Scale yOffs
	set thisYMargin * Scale !noSpace{0} 6 0 ; hard coding margin as 6
	
	set this + + + [previous previous] [0 previous{3}] [0 thisYMargin{0} thisWs thisHs] [0 yOffsS]
	
	set thisBS	+ + this{1} this{3} thisYMargin{0}
	set sectionButtonsBS + master.mcp.custom.sectionButtons{1} master.mcp.custom.sectionButtons{3}

	set this thisBS{0}>sectionButtonsBS{0} [. . . 0] . ; cull if extending below buttons section

	; -- this is the new previous	
	set previous this
	
endMacro

macro drawMasterMcp Scale

set master.mcp.size									* Scale [masterMcpWidth{0} 360 0 120]

set masterMcpSelectColRatio 						?track_selected / selectStrength{0} 0 0  ;def 100 0
set masterMcpCol									+ * - 1 masterMcpSelectColRatio \
														[masterMcpBgColR masterMcpBgColG masterMcpBgColB] \
													* masterMcpSelectColRatio [255 255 255] 												
brightnessFromRGB 									masterMcpCol{0} masterMcpCol{1} masterMcpCol{2} masterMcpColBrightness

custom master.mcp.custom.sectionPan
	set master.mcp.custom.sectionPan 				+ [0 0 master.mcp.size{0}] * Scale + [0 0 -32] !masterMcpVals{0} [0 0 0 30] [0 0 0 46]  
	set master.mcp.custom.sectionPan.color 			?visSections{0} [0 0 0 0 100 255 100 150] [0 0 0 1 0 0 0 0]
	set master.mcp.pan.label						!masterMcpVals{0} [0 master.mcp.custom.sectionPan] + [master.mcp.custom.sectionPan master.mcp.custom.sectionPan master.mcp.custom.sectionPan] * Scale [0 0 0 14]
	set master.mcp.pan.label.font					[masterMcpValsFontSize]
	set master.mcp.pan.label.margin             	trackpanmode>=4 [2 6 0 0 0] [6 2 6 0 0.5]
	set master.mcp.pan.label.color					* textBrightnessMult{0} masterMcpColBrightness{0}<120 [185 185 185] [38 38 38]
	set masterSectionPanCentW						* 0.5 master.mcp.custom.sectionPan{2}
set master.mcp.pan									master.mcp.custom.sectionPan{3}==0 [0] trackpanmode==6 + + * Scale [6 14 -12] [0 master.mcp.pan.label{3}] [master.mcp.pan.label master.mcp.pan.label master.mcp.custom.sectionPan 10] \
														+ + [0 master.mcp.pan.label{3}] [master.mcp.custom.sectionPan master.mcp.pan.label] + [masterSectionPanCentW] * Scale trackpanmode>=4 [-20 4 20 20] [-10 4 20 20]
	set master.mcp.pan.fadermode					trackpanmode==6 [-1] [1]
set master.mcp.width								master.mcp.custom.sectionPan{3}==0 [0] trackpanmode==6 + + * Scale [6 4 -12] [0 master.mcp.pan.label{3}] [master.mcp.pan.label master.mcp.pan.label master.mcp.custom.sectionPan 10] \
														trackpanmode>=4 + [master.mcp.pan master.mcp.pan] * Scale [22 0 20 20] [0]
	set master.mcp.width.fadermode					trackpanmode==6 [-1] [1]
	set master.mcp.width.label						trackpanmode>=4 !masterMcpVals{0} [0] + [master.mcp.custom.sectionPan master.mcp.custom.sectionPan master.mcp.custom.sectionPan] * Scale [0 0 0 14] [0]
	set master.mcp.width.label.font					+ [1] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
	set master.mcp.width.label.margin           	* [Scale Scale Scale Scale 1] [0 6 2 0 1]
	set master.mcp.width.label.color				master.mcp.pan.label.color	
custom master.mcp.custom.darkBox
	set master.mcp.custom.darkBox 					- + + * Scale [6 0 -38] [0 master.mcp.custom.sectionPan master.mcp.size{0} h] [0 master.mcp.custom.sectionPan{3}] [0 0 0 master.mcp.custom.sectionPan]
	set master.mcp.custom.darkBox.color				?visSections{0} [0 0 0 0 255 100 255 150] [0 0 0 1 38 38 38 255]

custom master.mcp.custom.sectionButtons
	set master.mcp.custom.sectionButtons			+ [master.mcp.size{0}] * Scale [-32 0 32 h]
 	set master.mcp.custom.sectionButtons.color		?visSections{0} [0 0 0 0 100 100 255 150] [0 0 0 1 0 0 0 0]
set masterMcpMonoH									?masterMcpLabels{0} 32 22	
set masterMcpIoH									?masterMcpLabels{0} 32 22
set masterMcpEnvH									?masterMcpLabels{0} 30 22
set previous										+ [master.mcp.custom.sectionButtons master.mcp.custom.sectionButtons] * Scale [6 6 0 0] ; Null object	
masterMcpFollow master.mcp.mono						20 masterMcpMonoH{0} 0 1
masterMcpFollow master.mcp.mute						20 20 -2 0
masterMcpFollow master.mcp.solo						20 20 1 1
front master.mcp.solo
masterMcpFollow master.mcp.io						20 masterMcpIoH{0} 0 0
masterMcpFollow master.mcp.fxGroup					20 36 0 0
set master.mcp.fx									master.mcp.fxGroup{3}>0 + [master.mcp.fxGroup master.mcp.fxGroup] * Scale [0 0 20 20] [0]
set master.mcp.fxbyp								master.mcp.fxGroup{3}>0 + + [master.mcp.fxGroup master.mcp.fxGroup] [0 master.mcp.fx{3}] * Scale [0 0 20 16] [0]
masterMcpFollow master.mcp.env						22 masterMcpEnvH{0} 0 0
masterMcpFollow master.mcp.menubutton				20 20 0 0

set master.mcp.volume.label							+ [master.mcp.custom.darkBox master.mcp.custom.darkBox master.mcp.custom.darkBox 0] !masterMcpVals{0} [0] * Scale [0 0 0 20]
	set master.mcp.volume.label.font				[masterMcpValsFontSize]
	set master.mcp.volume.label.margin				* [Scale Scale Scale Scale 1] [0 0 0 0 0.5]
	set master.mcp.volume.label.color				* textBrightnessMult{0} masterMcpColBrightness{0}<220 [175 175 175] [18 18 18]
set master.mcp.meter								+ master.mcp.custom.darkBox * Scale + !masterMcpLabels{0} [0 6 -24 -12] [0 6 -24 -26] !masterMcpVals{0} [0] [0 14 0 -14]
	set master.mcp.meter.vu.div                   	* Scale [masterMcpMtrBorder{0} -2]
	set master.mcp.meter.readout.color            	!masterMcpMeterReadout{0} [0 0 0 0 0 0 0 0] * textBrightnessMult{0} [240 240 240]
	set master.mcp.meter.scale.color.lit.bottom   ?masterMcpMeterVals<2 	!masterMcpMeterVals{0} [0 0 0 0 0 0 0 0] [0 0 0 200 0 0 0 0] ?masterMcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set master.mcp.meter.scale.color.lit.top   ?masterMcpMeterVals<2   	!masterMcpMeterVals{0} [0 0 0 0 0 0 0 0] [0 0 0 200 0 0 0 0] ?masterMcpMeterVals{0}==3 [51 51 51 0 0 0 0 0] 
	set master.mcp.meter.scale.color.unlit.bottom 	!masterMcpMeterVals{0} [0 0 0 0 0 0 0 0] * textBrightnessMult{0} !masterMcpMeterVals{0}==3 [255 255 255 150 0 0 0 0] [0 0 0 0 0 0 0 0] 
	set master.mcp.meter.scale.color.unlit.top    	!masterMcpMeterVals{0} [0 0 0 0 0 0 0 0] * textBrightnessMult{0} !masterMcpMeterVals{0}==3 [255 255 255 150 0 0 0 0] [0 0 0 0 0 0 0 0] 
	set master.mcp.meter.vu.rmsdiv                	* Scale [1 -2]
	set master.mcp.meter.rmsreadout.color         	!masterMcpMeterVals{0} [0 0 0] * textBrightnessMult{0} [200 200 200]
set master.mcp.volume								+ + [master.mcp.meter master.mcp.meter 0 master.mcp.meter] [master.mcp.meter{2}] * Scale [0 0 24]
set master.mcp.label 								+ + [master.mcp.custom.darkBox master.mcp.custom.darkBox master.mcp.custom.darkBox] [0 master.mcp.custom.darkBox{3}] ?masterMcpLabels{0} * Scale [-10 -20 0 20] [0] 
	set master.mcp.label.color						* textBrightnessMult{0} [220 220 220]
	set master.mcp.label.color						?selInvertLabels{0} ?track_selected [38 38 38] . .
	set master.mcp.label.font						+ 3 Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
custom master.mcp.custom.masterMcpNameBg
set master.mcp.custom.masterMcpNameBg				master.mcp.label
set master.mcp.custom.masterMcpNameBg.color 		?selInvertLabels{0} ?track_selected [0 0 0 0 255 255 255 200] [0 0 0 0 38 38 38] [0 0 0 0 38 38 38]
front master.mcp.custom.masterMcpNameBg	master.mcp.label

set autoWscrollM{0}     +  / master.mcp.size{0} 40  2

set fxElmSzM           +    21  masterMcpFXFontSize{0}
set  masterMcpSendFontSize   masterMcpFXFontSize{0}>1   -  masterMcpFXFontSize{0} 1   1

set master.mcp.fxlist.font 							+ * Scale [masterMcpFXFontSize fxElmSzM{0} 200 200 0 0 2 autoWscrollM{0}] [2]
	set master.mcp.fxlist.margin					* [Scale Scale Scale Scale 1 Scale Scale Scale] [3 0 4 6 0.5 0 20 2]
set master.mcp.sendlist.font 						+ * Scale [masterMcpSendFontSize 24 200 200 0 0 2 autoWscrollM{0}] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]	
	set master.mcp.sendlist.margin 					* [Scale Scale Scale Scale 1 Scale Scale Scale] [2 0 0 0 0 0 0 0 2]
set master.mcp.fxparm.font 							+ * Scale [1 25] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
 	set master.mcp.fxparm.margin					* [Scale Scale Scale Scale 1 Scale Scale Scale] [3 0 4 6 0.5 0 0 2]	

custom master.mcp.custom.mcp_selectionDot 			'' 0 '' 'tcp_selectionDot'
set master.mcp.custom.mcp_selectionDot 				!selDot{0} [0] ?track_selected [0] + + [master.mcp.custom.darkBox master.mcp.custom.darkBox] [master.mcp.custom.darkBox{2} master.mcp.custom.darkBox{3}] * Scale [-4 -14 8 8]
custom master.mcp.custom.mcp_selectionDotSel		'' 0 '' 'tcp_selectionDot_sel'	
set master.mcp.custom.mcp_selectionDotSel 			!selDot{0} [0] !track_selected [0] + + [master.mcp.custom.darkBox master.mcp.custom.darkBox] [master.mcp.custom.darkBox{2} master.mcp.custom.darkBox{3}] * Scale [-4 -14 8 8]
front master.mcp.custom.mcp_selectionDot master.mcp.custom.mcp_selectionDotSel

custom master.mcp.custom.mcpBgBox
set master.mcp.custom.mcpBgBox 						[0 0 w h] 
set master.mcp.custom.mcpBgBox.color 				[0 0 0 0 masterMcpCol{0} masterMcpCol{1} masterMcpCol{2} 255]



endMacro

drawMasterMcp 1

endLayout



#<

#>---------------------------------- TRANSPORT ----------------------------------------

macro transFollow this thisW thisH
	
	set thisWs								* Scale thisW
	set thisHs								* Scale thisH
	set this 								- - [previous previous thisWs thisHs] [transMargin] [thisWs]  ; position it to the left of the current row
	set this 								?hide_##this{0} + [previous . 0] * Scale [0 0 0 36] ; apply hide by setting w to zero and ignoring transMargin

; -- move to next row--	
; if it WON'T fit in this row, use it to start the next row at 36 + transMargin	
	set this 								this{0}<trans.custom.sectionRight{0} - + [w previous this this] * Scale + [0 36] [0 transMargin{0}] + [this{2}] * Scale [transMargin]

; -- cull if it extends below the height of the panel --	
	set thisBS 								+ this{1} this{3}
	set this 								thisBS{0}>h [this this 0 this] !previous{3} [this this 0 0] .   ; cull method is to set width to zero
 
; -- cull if it is itself too wide for the section
	set thisWPlus2Margins 					+ this{2} * Scale + transMargin transMargin
	set this 								thisWPlus2Margins{0}>trans.custom.sectionRight{2} [this this 0 0] .
	
; -- this is the new previous	
	set previous 							this
	
endmacro

;raw params separator
;define_parameter eeee 				'' 0 0 0
define_parameter eeee0 				'' 0 0 0
define_parameter eeee1 				'TRANSPORT' 1 0 0
define_parameter eeee2 				'_______________________________________________________________' 0 0 0
define_parameter eeee3 				'_______________________________________________________________' 0 0 0

define_parameter transFontSize 				'Transport Font Size' 7 5 8
define_parameter transMargin 				'Transport Margins' 6 0 12
define_parameter transStatusWidth 			'Transport Status Width' 450 150 700
define_parameter transRateFaderWidth 		'Transport Rate Width' 38 38 400
define_parameter transSelectionWidth 		'Transport Selection Width' 350 240 700

;raw params separator
;define_parameter ffff 				'' 0 0 0
define_parameter ffff0 				'' 0 0 0
define_parameter ffffx1				'' 0 0 0
define_parameter ffffx 				'' 0 0 0
define_parameter ffffx0 				'' 0 0 0
;define_parameter ffff1 				'TRANSPORT' 1 0 0
;define_parameter ffff2 				'_______________________________________________________________' 0 0 0
;define_parameter ffff3 				'_______________________________________________________________' 0 0 0

Macro drawTrans Scale

set trans.size 								* Scale [1000 37]
set trans.size.minmax 						* Scale + [100 37 2000 144] * 4 [0 0 0 transMargin{0}]
set trans.size.dockedheight 				* Scale [37]

custom trans.custom.sectionLeft  
set trans.custom.sectionLeft				* Scale [0 0 1000 36] ; just to start with
set trans.custom.sectionLeft.color			?visSections{0} [0 0 0 0 50 255 100 60] [0 0 0 0 0 0 0 0]
custom trans.custom.sectionButtons
set trans.custom.sectionButtons				+ * Scale [-5 4 200 30] ?trans_center - / [w] 2 * Scale [100] [0]
set trans.custom.sectionButtons.color		?visSections{0} [0 0 0 0 100 100 255 150] [0 0 0 1 0 0 0 0]

set trans.rew 								+ [trans.custom.sectionButtons trans.custom.sectionButtons] * Scale [0 2 29 29]
set trans.fwd 								+ + [trans.rew trans.rew] * Scale [0 0 28 29] [trans.rew{2}]
set trans.rec								+ + [trans.fwd trans.fwd] * Scale [0 -3 34 35] [trans.fwd{2}]
set trans.play 								+ + [trans.rec trans.rec] * Scale [0 0 33 35] [trans.rec{2}]
set trans.repeat							+ + [trans.play trans.play] * Scale [0 3 27 29] [trans.play{2}]
set trans.stop 								+ + [trans.repeat trans.repeat] * Scale [0 0 29 29] [trans.repeat{2}]
set trans.pause 							+ + [trans.stop trans.stop] * Scale [0 0 29 29] [trans.stop{2}]

custom trans.custom.sectionStatus
set trans.custom.sectionStatus				+ ?trans_center [0] + [trans.custom.sectionButtons] [trans.custom.sectionButtons{2}] * Scale [transMargin 0 transStatusWidth{0} 36]
; set trans.custom.sectionLeft 				+ [0 0 trans.custom.sectionStatus trans.custom.sectionStatus] [0 0 trans.custom.sectionStatus{0}]

; Break section left if not enough y-space
set sectionLeftBreakW						+ + trans.custom.sectionButtons{2} trans.custom.sectionStatus{2} * 2 * Scale transMargin{0}
set trans.custom.sectionLeft 				w>sectionLeftBreakW{0} .  + * Scale [0 0 transMargin{0} transMargin{0}] \
											trans.custom.sectionStatus{2}>trans.custom.sectionButtons{2} [0 0 trans.custom.sectionStatus{2} 72] [0 0 trans.custom.sectionButtons{2} 72]
; ...and move status to the next row
set trans.custom.sectionStatus				w>sectionLeftBreakW{0} . * Scale + [transMargin{0} transMargin{0}] [0 36 transStatusWidth{0} 36]

; do the above but for centered mode
set sectionLeftBreakW						?trans_center + trans.custom.sectionStatus{2} * 2 transMargin{0} 
set trans.custom.sectionLeft				?trans_center trans.custom.sectionButtons{0}<sectionLeftBreakW{0} + [0 0 0 transMargin{0}] [. . . 72] .
set trans.custom.sectionStatus				?trans_center trans.custom.sectionButtons{0}<sectionLeftBreakW{0} + * 0.5 - [w] * Scale [transStatusWidth{0}] * Scale + [0 transMargin{0}] [0 36 transStatusWidth{0} 36] .

; populate status
set trans.status							trans.custom.sectionStatus
set trans.status.margin						* Scale [transMargin{0} 0 transMargin{0} 0]
set trans.status.color						+ + ?visSections{0} [255 0 0 255 100 50 100 255] [0] [0 0 0 0 0 0 0 0] * textBrightnessMult{0} [160 160 160]

custom trans.custom.sectionRight
custom trans.custom.sectionRate
custom trans.custom.sectionBpm				'' 0 '' 'transSectionBg'
custom trans.custom.sectionSig				'' 0 '' 'transSectionBg'
custom trans.custom.sectionSel				'' 0 '' 'transSectionBg'

	set rateFaderSwapW						100
	set transSectionRateW					+ transRateFaderWidth{0} transRateFaderWidth{0}>rateFaderSwapW{0} 0 60
	set sectionRightW						- w + + trans.custom.sectionButtons{2} trans.custom.sectionStatus{2} * Scale + transMargin transMargin
	set transDoubleH						* Scale + 72 transMargin
	set trans.custom.sectionRight			h>transDoubleH{0} + [0 0 w h] * Scale + [0 trans.custom.sectionLeft{3}] [0 transMargin{0}] \
															  - + [w 0 sectionRightW{0}] * Scale [0 0 0 36] [sectionRightW{0}]
	set trans.custom.sectionRight			?trans_center h>transDoubleH{0} . \
											- + [trans.custom.sectionButtons . w .] * [1 0 1] [trans.custom.sectionButtons{2} 0 trans.custom.sectionButtons{2}] [0 0 trans.custom.sectionButtons{0}]
	set trans.custom.sectionRight.color		?visSections{0} [0 0 0 0 255 255 120 60] [0]

set previous 								+ [w trans.custom.sectionRight] * Scale [0 0 0 36]

set hide_trans.custom.sectionRate 			!trans_flags&2 1 0
transFollow trans.custom.sectionRate 		transSectionRateW{0} 36
	set trans.custom.sectionRate.color		?visSections{0} [0 0 0 0 100 255 100 80] [0 0 0 1 0 0 0 0]
	set trans.rate.fader 					!trans.custom.sectionRate{2} [0] + [trans.custom.sectionRate trans.custom.sectionRate] \
												* Scale + [0 0 transRateFaderWidth{0}] transRateFaderWidth{0}>rateFaderSwapW{0} [0 16 0 20] [0 0 0 36]
	custom trans.custom.rateFaderBg			'' 0 '' 'transRateFaderBg'
	set trans.custom.rateFaderBg			transRateFaderWidth{0}>rateFaderSwapW{0} trans.rate.fader [0]
	set trans.rate.fader.fadermode 			transRateFaderWidth{0}>rateFaderSwapW{0} [0] [1]
	set trans.rate							!trans.custom.sectionRate{2} [0] transRateFaderWidth{0}>rateFaderSwapW{0} + + [trans.custom.sectionRate trans.custom.sectionRate] * Scale [-40 -1 85 17] * 0.5 [trans.custom.sectionRate{2}] \
												+ + [trans.rate.fader trans.rate.fader] * Scale [0 -5 55 42] [trans.rate.fader{2}}]
	set trans.rate.margin 					[0 0 0 0 0]
	set trans.rate.font						- [transFontSize] 1
	set trans.rate.color 					* textBrightnessMult{0} [160 160 160] 
	set trans.rate.fader.color 				[180 180 180 255] ; pointer line of the knob

set hide_trans.automode 					0
transFollow trans.automode 					58 36
set hide_trans.custom.sectionBpm 			0
transFollow trans.custom.sectionBpm			60 36


 
	
set hide_trans.custom.sectionSig 			 0
transFollow trans.custom.sectionSig			60 36
	set trans.custom.sectionSig.color		?visSections{0} [0 0 0 0 255 100 100 150] [0 0 0 1 0 0 0 0]
set sig_margin                   +   [trans.custom.sectionSig{1}]  + [7]   transFontSize==8  [1]
        set trans.curtimesig                           + + [trans.custom.sectionSig] [trans.custom.sectionSig{w}] [-60 sig_margin{0} 59 22]
	set trans.curtimesig.font  				- [transFontSize] 1
	set trans.curtimesig.color 			*	[80 180 200 255 0 0 0 0]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1 1]
set bpm_margin                   +   [trans.custom.sectionBpm{1}]  - [5]  transFontSize==8  [1]
        set trans.bpm.edit                              + + [trans.custom.sectionBpm] [trans.custom.sectionBpm{w}] [-60 bpm_margin{0} 60 28]
	set trans.bpm.edit.font  				[transFontSize]
	set trans.bpm.edit.color 			*	[90 200 90 255 130 130 130 130]  [textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} textBrightnessMult{0} 1 1 1 1 1]

	set trans.bpm.tap 						+ [trans.custom.sectionBpm trans.custom.sectionBpm trans.custom.sectionBpm] * Scale [0 0 0 12]
	set trans.bpm.tap.font  				+ [1] Scale{0}==1 [0] Scale{0}==1.5 [5] [10]
	set trans.bpm.tap.color 				 [40 40 40]
	set trans.bpm.tap.margin 				+ * Scale [0 0 0 0] [0 0 0 0 0.5]	

set hide_trans.custom.sectionSel 			0
transFollow trans.custom.sectionSel			transSelectionWidth{0} 36
	set trans.sel							+ trans.custom.sectionSel * Scale [10 7 -10 -12]						
	set trans.sel.color      	  			* textBrightnessMult{0} [160 160 160] 
	set trans.sel.font        	 			- [transFontSize] 1
	set trans.sel.margin				[0 0 0 0 0]

endMacro
	
	
drawTrans 1

endLayout


;raw params separator
;define_parameter cccE 				'' 0 0 0
;define_parameter cccE0 				'' 0 0 0
define_parameter cccE1 				'LAYOUTS (If used)' 1 0 0
define_parameter cccE2 				'' 1 0 0
define_parameter cccE3 				'' 1 0 0

;---------------------------------TCP LAYOUTS-------------------------------------------------
;define_parameter aaaQ 				'' 0 0 0
;define_parameter aaaQ0 				'' 0 0 0
define_parameter aaaQ1 				'TRACK CONTROL PANEL (Wide Meters Layout)' 1 0 0
define_parameter aaaQ2 				'_______________________________________________________________' 0 0 0
define_parameter aaaQ3 				'_______________________________________________________________' 0 0 0

set LayoutB-tcpLabelSize 					LayoutA-tcpLabelSize
set LayoutB-tcpInputFontSize 				LayoutA-tcpInputFontSize 
set LayoutB-tcpVolPanFontSize 		LayoutA-tcpVolPanFontSize
set LayoutB-tcpFXFontSize 				LayoutA-tcpFXFontSize
set LayoutB-tcpCBFontSize 			LayoutA-tcpCBFontSize
set LayoutB-tcpDivOpacity 				LayoutA-tcpDivOpacity 
define_parameter LayoutB-hideIO                                          'TCP Show Route' 1 0 1
define_parameter LayoutB-TcpFX_Env					'TCP Show Classic FX and Envelope' 2 0 3
define_parameter LayoutB-TcpCBMode					'TCP Custom Buttons Mode' 0 0 2
set LayoutB-TcpMeterVals				LayoutA-TcpMeterVals
set LayoutB-tcpMeterReadout           LayoutA-tcpMeterReadout
define_parameter LayoutB-ShowRecIn			  'TCP Show Rec Input' 2 0 2
define_parameter LayoutB-tcpFXPanelSize			  'TCP FX/Sends Panel Size' 125 50 300
set LayoutB-TranspFXSect                           LayoutA-TranspFXSect
set LayoutB-tcpFXPanelOff			LayoutA-tcpFXPanelOff	
define_parameter LayoutB-tcpMeterSize			'TCP Meter Width' 500 1 700
define_parameter LayoutB-tcpMeterSize2			'TCP Meter Width (thin)' 500 1 700
define_parameter LayoutB-tcpMeterBorder		'TCP Meter Border' 1 0 1
Layout "Wide Meters"
drawTcp B 1
endLayout

;define_parameter aaaW 				'' 0 0 0
define_parameter aaaW0 				'' 0 0 0
define_parameter aaaW1 				'TRACK CONTROL PANEL (Minimalistic Layout)' 1 0 0
define_parameter aaaW2 				'_______________________________________________________________' 0 0 0
define_parameter aaaW3 				'_______________________________________________________________' 0 0 0

set LayoutC-tcpLabelSize 					LayoutA-tcpLabelSize
set LayoutC-tcpInputFontSize 				LayoutA-tcpInputFontSize 
set LayoutC-tcpVolPanFontSize 		LayoutA-tcpVolPanFontSize
set LayoutC-tcpFXFontSize 				LayoutA-tcpFXFontSize
set LayoutC-tcpCBFontSize 			LayoutA-tcpCBFontSize
set LayoutC-tcpDivOpacity 				LayoutA-tcpDivOpacity 
define_parameter LayoutC-hideIO                                         'TCP Show Route' 0 0 1
define_parameter LayoutC-TcpFX_Env				'TCP Show Classic FX and Envelope' 2 0 3
define_parameter LayoutC-TcpCBMode					'TCP Custom Buttons Mode' 0 0 2
set LayoutC-TcpMeterVals				LayoutA-TcpMeterVals
set LayoutC-tcpMeterReadout           LayoutA-tcpMeterReadout
define_parameter LayoutC-ShowRecIn			 'TCP Show Rec Input' 2 0 2
set LayoutC-tcpFXPanelSize			95
set LayoutC-TranspFXSect                           LayoutA-TranspFXSect
define_parameter LayoutC-tcpFXPanelOff			'TCP Hide FX/Sends Panel' 1 0 1
define_parameter LayoutC-tcpMeterSize			'TCP Meter Width' 5 1 700
define_parameter LayoutC-tcpMeterSize2			'TCP Meter Width (thin)' 5 1 700
define_parameter LayoutC-tcpMeterBorder		'TCP Meter Border' 0 0 1
Layout "Minimalistic"
drawTcp C 1
endLayout

	

;---------------------------------MCP LAYOUTS-------------------------------------------------
;raw params separator
;define_parameter ccca 				'' 0 0 0
define_parameter ccca0 				'' 0 0 0
define_parameter ccca1 				'MIXER CONTROL PANEL (Thin Strip Layout)' 1 0 0
define_parameter ccca2 				'_______________________________________________________________' 0 0 0
define_parameter ccca3 				'_______________________________________________________________' 0 0 0

set LayoutB-verboseMcp 				LayoutA-verboseMcp 
set LayoutB-McpLabels 		                LayoutA-McpLabels 
set LayoutB-mcpTintBackground		LayoutA-mcpTintBackground
define_parameter LayoutB-mcpWidth					'MCP Mixer Panel Width' 80 80 300
define_parameter LayoutB-mcpWidthSel				'MCP Selected Mixer Panel Width' 80 80 300
define_parameter LayoutB-mcpWidthRecarm				'MCP Armed Mixer Panel Width' 80 80 300
set LayoutB-mcpSidebar				0
set LayoutB-mcpSidebarSel				0
set LayoutB-mcpSidebarRecarm			0
set LayoutB-mcpNormalShowRoute			LayoutA-mcpNormalShowRoute
set LayoutB-mcpNormalShowSecFx			LayoutA-mcpNormalShowSecFx
set LayoutB-sidebarWidth				LayoutA-sidebarWidth
define_parameter LayoutB-mcpMeterVals				'MCP Meter Values' 1 0 3
define_parameter LayoutB-mcpMeterWidth		'MCP Meter Width' 10 1 50
define_parameter LayoutB-mcpMeterReadout			'MCP Meter Readout' 1 0 1
define_parameter LayoutB-mcpMeterBorder		'MCP Meter Border' 1 0 1
set LayoutB-mcpNormalShowSecIn			320
set LayoutB-mcpNormalShowSecPan		260
set LayoutB-mcpNchanGrow			LayoutA-mcpNchanGrow
set LayoutB-mcpNchanGrowSel			LayoutA-mcpNchanGrowSel
set LayoutB-mcpNchanGrowRecarm		LayoutA-mcpNchanGrowRecarm
set LayoutB-mcpNormalShowEnv			LayoutA-mcpNormalShowEnv
set LayoutB-mcpNormalShowPhase		LayoutA-mcpNormalShowPhase
Layout "Thin Strip"
drawMcp B 1
endLayout

;raw params separator
define_parameter cccB 				'' 0 0 0
define_parameter cccB0 				'' 0 0 0
define_parameter cccB1 				'MIXER CONTROL PANEL (Wide Strip Layout)' 1 0 0
define_parameter cccB2 				'_______________________________________________________________' 0 0 0
define_parameter cccB3 				'_______________________________________________________________' 0 0 0

set LayoutD-verboseMcp 				LayoutA-verboseMcp 
set LayoutD-McpLabels 		                LayoutA-McpLabels 
set LayoutD-mcpTintBackground		LayoutA-mcpTintBackground
define_parameter LayoutD-mcpWidth					'MCP Mixer Panel Width' 300 80 300
define_parameter LayoutD-mcpWidthSel				'MCP Selected Mixer Panel Width' 300 80 300
define_parameter LayoutD-mcpWidthRecarm				'MCP Armed Mixer Panel Width' 300 80 300
set LayoutD-mcpSidebar				0
set LayoutD-mcpSidebarSel				0
set LayoutD-mcpSidebarRecarm			0
set LayoutD-mcpNormalShowRoute			LayoutA-mcpNormalShowRoute
set LayoutD-mcpNormalShowSecFx			LayoutA-mcpNormalShowSecFx
set LayoutD-sidebarWidth				LayoutA-sidebarWidth
define_parameter LayoutD-mcpMeterVals				'MCP Meter Values' 1 0 3
define_parameter LayoutD-mcpMeterWidth		'MCP Meter Width' 25 1 50
define_parameter LayoutD-mcpMeterReadout			'MCP Meter Readout' 1 0 1
define_parameter LayoutD-mcpMeterBorder		'MCP Meter Border' 1 0 1
set LayoutD-mcpNormalShowSecIn			320
set LayoutD-mcpNormalShowSecPan		260
set LayoutD-mcpNchanGrow			LayoutA-mcpNchanGrow
set LayoutD-mcpNchanGrowSel			LayoutA-mcpNchanGrowSel
set LayoutD-mcpNchanGrowRecarm		LayoutA-mcpNchanGrowRecarm
set LayoutD-mcpNormalShowEnv			LayoutA-mcpNormalShowEnv
set LayoutD-mcpNormalShowPhase		LayoutA-mcpNormalShowPhase
Layout "Wide Strip"
drawMcp D 1
endLayout

;raw params separator
define_parameter cccD 				'' 0 0 0
define_parameter cccD0 				'' 0 0 0
define_parameter cccD1 				'MIXER CONTROL PANEL (Sidebar Layout)' 1 0 0
define_parameter cccD2 				'_______________________________________________________________' 0 0 0
define_parameter cccD3 				'_______________________________________________________________' 0 0 0

set LayoutE-verboseMcp 				LayoutA-verboseMcp 
set LayoutE-McpLabels 		LayoutA-McpLabels 
set LayoutE-mcpTintBackground		LayoutA-mcpTintBackground
define_parameter LayoutE-mcpWidth					'MCP Mixer Panel Width' 105 80 300
define_parameter LayoutE-mcpWidthSel				'MCP Selected Mixer Panel Width' 105 80 300
define_parameter LayoutE-mcpWidthRecarm				'MCP Armed Mixer Panel Width' 105 80 300
set LayoutE-mcpSidebar				1
set LayoutE-mcpSidebarSel				1
set LayoutE-mcpSidebarRecarm			1
set LayoutE-mcpNormalShowRoute			LayoutA-mcpNormalShowRoute
set LayoutE-mcpNormalShowSecFx			LayoutA-mcpNormalShowSecFx
define_parameter LayoutE-mcpMeterVals				'MCP Meter Values' 1 0 3
define_parameter LayoutE-mcpMeterWidth		'MCP Meter Width' 25 1 50
define_parameter LayoutE-mcpMeterReadout			'MCP Meter Readout' 1 0 1
define_parameter LayoutE-mcpMeterBorder		'MCP Meter Border' 1 0 1
set LayoutE-mcpNormalShowSecIn			320
set LayoutE-mcpNormalShowSecPan		260
set LayoutE-mcpNchanGrow			LayoutA-mcpNchanGrow
set LayoutE-mcpNchanGrowSel			LayoutA-mcpNchanGrowSel
set LayoutE-mcpNchanGrowRecarm		LayoutA-mcpNchanGrowRecarm
set LayoutE-mcpNormalShowEnv			LayoutA-mcpNormalShowEnv
set LayoutE-mcpNormalShowPhase		LayoutA-mcpNormalShowPhase
define_parameter LayoutE-sidebarWidth				'MCP Sidebar Width' 91 30 300
Layout "Sidebar"
drawMcp E 1
endLayout

define_parameter zzzz 				'' 0 0 0
define_parameter zzzz1 				'' 0 0 0
define_parameter zzzz2 				'' 0 0 0