ok here we go
here is a practical example in my theme API beta v5.12
first, sorry about the esoteric custom variables names, but I spent a lot of time on this and I try to make it fun...
So, I have 4 modules, from top to bottom:
- rec module: with recarm and fx in
- rec extended module: with monitor options, recomde and input select
- rooting module: with send/recieve
- fx module: with fx and fx bp
When the track is normal, I want to have all the module displayed exepted the rec extended, witch i don't need in normal state
When the track is armed, I want the rec extended module to appear below the rec module, so the rooting and fx modules have to move down
When the track is a folder, I want every recording related modules to disapear, so the rooting and fx has to move up
When the track is both folder and recarm (whitch won't happen anyway) I want the priority to rec
I also want to have all values in the same place, so in the future, if I need to change the size of a button, I do it only once.
so first the values:
Code:
; REC
def mcp_recarm [8 209 21 21]
def mcp_fxin [44 220 32 13]
; REC EX
def mcp_recmode [8 237 21 21]
def mcp_recinput [4 261 73 20]
def mcp_recmon [8 284 21 21]
; ROOT
def mcp_io [8 258 21 21]
; INS
def mcp_fxbyp [8 293 21 21]
def mcp_fx [44 297 32 13]
Then the variables: some defined values to use to have thing going up or down
Code:
def var_norec -21
def var_recx 61
Then I can write marcos to call each module.
To have them react properly I will need 9 inputs for each marco:
IS: when the track is normal
- is_born: type 1 if I want the module to exist in this normal state, 0 if not
- is_life: px to add to the defaut y position in this normal state
- is_dead: minimum tcp size before the module die in this normal state
REC: when the track is recarmed
- rec_born: type 1 if I want the module to exist in this rec state, 0 if not
- rec_life: px to add to the IS y position in this rec state
- rec_dead: px to add to the IS minimum tcp size before the module die in this rec state
BUS: when the track is a folder,
- rec_born: type 1 if I want the module to exist in this bus state, 0 if not
- rec_life: px to add to the IS y position in this bus state
- rec_dead: px to add to the IS minimum tcp size before the module die in this bus state
So here is the first module marco:
Code:
macro mcp_mod_rec is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
set tobe_rec + [is_life] [rec_life]
set nottobe_rec + [is_dead] [rec_dead]
set tobe_bus + [is_life] [bus_life]
set nottobe_bus + [is_dead] [bus_dead]
set life ?recarm tobe_rec{x} folderstate>0 tobe_bus{x} is_life
set dead ?recarm nottobe_rec{x} folderstate>0 nottobe_bus{x} [is_dead]
set existence 0
set existence rec_born==1 recarm=1 1
set existence is_born==1 recarm=0 folderstate=0 1
set existence bus_born==1 recarm=0 folderstate!=0 1
set mcp.recarm existence{x}==0 [0] h<dead{x} [0] + mcp_recarm [0 life]
set mcp.fxin existence{x}==0 [0] h<dead{x} [0] + mcp_fxin [0 life]
endmacro
(yeah about the 4 lines existence variable, I can't figure how to write it in one line, Each time I give it a try, I have some bugs)
But wait, does it mean I will have to write that for all the modules?! that's way too much for a lazy man like me!
Let's forget that, and make a sub macro that will make the modules born, live and die...
Code:
macro mcp_mod_destiny is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
set tobe_rec + [is_life] [rec_life]
set nottobe_rec + [is_dead] [rec_dead]
set tobe_bus + [is_life] [bus_life]
set nottobe_bus + [is_dead] [bus_dead]
set life ?recarm tobe_rec{x} folderstate>0 tobe_bus{x} is_life
set dead ?recarm nottobe_rec{x} folderstate>0 nottobe_bus{x} [is_dead]
set existence 0
set existence rec_born==1 recarm=1 1
set existence is_born==1 recarm=0 folderstate=0 1
set existence bus_born==1 recarm=0 folderstate!=0 1
endmacro
And now, we can make our modules
Code:
macro mcp_mod_rec is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
mcp_mod_destiny is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
set mcp.recarm existence{x}==0 [0] h<dead{x} [0] + mcp_recarm [0 life]
set mcp.fxin existence{x}==0 [0] h<dead{x} [0] + mcp_fxin [0 life]
endmacro
macro mcp_mod_recex is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
mcp_mod_destiny is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
set mcp.recmode existence{x}==0 [0] h<dead{x} [0] + mcp_recmode [0 life]
set mcp.recinput existence{x}==0 [0] h<dead{x} [0] + mcp_recinput [0 life]
set mcp.recmon existence{x}==0 [0] h<dead{x} [0] + mcp_recmon [0 life]
endmacro
macro mcp_mod_rout is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
mcp_mod_destiny is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
set mcp.io existence{x}==0 [0] h<dead{x} [0] + mcp_io [0 life]
endmacro
macro mcp_mod_ins is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
mcp_mod_destiny is_born is_life is_dead rec_born rec_life rec_dead bus_born bus_life bus_dead
set mcp.fxbyp existence{x}==0 [0] h<dead{x} [0] + mcp_fxbyp [0 life]
set mcp.fx existence{x}==0 [0] h<dead{x} [0] + mcp_fx [0 life]
endmacro
Now, If I track to react as said above, i have to write on my layout:
Code:
mcp_mod_rec 1 0 625 1 0 0 0 0 0
mcp_mod_recex 0 0 0 1 0 690 0 0 0
mcp_mod_rout 1 0 664 1 var_recx var_recx 1 var_norec var_norec
mcp_mod_ins 1 0 694 1 var_recx var_recx 1 var_norec var_norec
So it's a lot of work at first but now I can create as many layouts as I want, and also, it opens the posibility for the user to create its own layout by combining block and reactions as he wants, without any knowledge of walter.
But maybe there is some more efficient ways to get that result...