Old 05-17-2018, 08:17 PM   #1
Human being with feelings
mikeroephonics's Avatar
Join Date: Nov 2006
Posts: 2,484
Default Problems with envcp.margin WALTER code

Hi. I'm having some trouble getting my envelope control panels to stay vertically lined up nicely with their track control panels when using folder tracks. They look just as I'd like them to without folders in the project, but when the project has folder tracks, in some cases, envelope control panel elements remain in their "non-folder" positions.

Here's how things look with no folders. Nice and flush. Note how the envcp_namebg.png is lined up vertically with the tcp_namebg.png. That's what I'm aiming for at all times, regardless of folder track(s).

Here's that same track as above (now track #4), with its envelope control panels, in a folder. This is how I'd like things to line up, regardless of how many folders exist in the project, and regardless of if the envelope control panel's TCP is in a folder.

But I run into problems when I start adding folder tracks in different ways than shown above. The following picture shows 4 tracks. The top 3 tracks are part of a folder hierarchy. But the 4th track, which holds envelope control panels, is outside of the folder. Notice how the envelope control panel elements are in their normal "non-folder" position, however, their TCP elements are moved over to the right (as I'd like them to be.) I'd also like the envelope control panels elements pushed to the right by exactly same amount as its TCP elements, so that they're both flush like in my first "no folders" picture.

Here's the WALTER I'm using for the above 3 pictures:
set envcp.margin folderstate=0 [0 0 0 0]
set envcp.margin folderstate=0 +:maxfolderdepth:>=1 [23 0 0 0]
set envcp.margin folderstate=1 [23 0 0 0] +:folderdepth:=0 [ 3 0 0 0]

Here's a .gif of the folder behavior in action. Note how the envelope control panel elements remain on the left when their TCP is outside of a folder:

Side note:
Also, I don't understand what the colon symbols mean in ":maxfolderdepth:" and ":folderdepth:". I didn't see them mentioned in the SDK.

Thanks for any advice!

- Mike
Please check out these MIDI requests: http://forum.cockos.com/showthread.php?t=103192

Last edited by mikeroephonics; 05-18-2018 at 01:52 AM.
mikeroephonics is offline   Reply With Quote
Old 05-18-2018, 04:34 AM   #2
mister happy
Human being with feelings
mister happy's Avatar
Join Date: Mar 2017
Location: in the moment
Posts: 60

I checked the theme I am working on and think that it behaves as you wish yours will.

I am not using any "folderstate" statements. Perhaps you can try and or adopt this code?:

set tcp.margin +:folderdepth:1 [-10 0 0 0]
set tcp.margin +:maxfolderdepth:1 [10 0 0 0]

set master.tcp.margin +:folderdepth:1 [-10 0 0 0]
set master.tcp.margin +:maxfolderdepth:1 [10 0 0 0]

set envcp.margin +:folderdepth:1 [-10 0 0 0]
set envcp.margin +:maxfolderdepth:1 [10 0 0 0]

This code was appropriated almost directly from the WALTER theme guide and seems to work good in the theme I am working with.
REAPER 5.979, Win 7 x64
mister happy is offline   Reply With Quote
Old 05-18-2018, 08:33 AM   #3
White Tie
Pixel Pusher
White Tie's Avatar
Join Date: Mar 2007
Location: Blighty
Posts: 2,546

The complex combinators with the colon are described on the Walter SDK page. They only there as a convenient way of cleaning up code (they don't do anything special) and I've stopped using them myself because they always make my head hurt when I come back to my code.

+:val1:val2   --   val1*(first expression) + val2*(second expression)
They're annoying and it doesn't matter because you're using them wrong anyway Kill 'em, kill 'em all!

folderstate is very simple; its just a number; the number of folders deep the track is. So if you do:
 set button + [0 0 20 20] * [23 0 0 0] folderdepth
then your 20x20 button would be drawn at 0,0 and then bumped right by 23 pixels for each folder depth it was at. So, for a track 4 levels deep it would be:

 set button + [0 0 20 20] * [23 0 0 0] 4

--which is--

set button + [0 0 20 20] [92 0 0 0]

--which is--

[92 0 20 20]
folderdepth does this for the track in question
maxfolderdepth does this for the maximum folderdepth of any track in the project.


Also, I think mister happy is right; you don't need any folderstate business at all, so you can dump that too.
The House of White Tie
White Tie is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 01:08 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.