Old 05-06-2020, 10:10 AM   #1
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default How to get minimum track height?

When I minimize a track, e.g. like this


or zoom out TCP via scroll wheel etc., track height seems to be 24 pixels here.
Is this a hardcoded value, or theme/HiDPI dependent, if so, how to get that value?
nofish is offline   Reply With Quote
Old 05-06-2020, 10:21 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

From my unfinished StateChunk-docs, the trackheight is between 24 and 443 pixels for regular tracks in TCP and 24 to 260 for the master-track in tcp.

The mastertrackheight I gave sounds wrong to me, so this could be an error on my side(there's a reason, why my statechunk-docs are unreleased yet )
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 10:32 AM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default

Thanks. According to this 24 pixels seems indeed hardcoded min. track height.
nofish is offline   Reply With Quote
Old 05-06-2020, 11:15 AM   #4
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,827
Default

I think it depends on the theme.
in walter look for the "tcp_heights"

tcp_heights 4 24 35 58 ; supercollapsed, collapsed, small(norecarm), recarm size
heda is offline   Reply With Quote
Old 05-06-2020, 11:33 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

Quote:
Originally Posted by heda View Post
I think it depends on the theme.
in walter look for the "tcp_heights"

tcp_heights 4 24 35 58 ; supercollapsed, collapsed, small(norecarm), recarm size
If I get this right, it doesn't define the limits, rather the sizes when collapsing them.
Means, the limits are still 24 as the smallest one, though you can define others for collapsed states.

Though it's worth an experiment, whether its possible to set them to smaller than 24px for collapsed ones.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 11:34 AM   #6
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default

Quote:
Originally Posted by heda View Post
I think it depends on the theme.
in walter look for the "tcp_heights"

tcp_heights 4 24 35 58 ; supercollapsed, collapsed, small(norecarm), recarm size
Thanks.
But how to get this value in ReaScript then?
I'd like to do a minimize (i.e. collaps) tracks function.
nofish is offline   Reply With Quote
Old 05-06-2020, 11:37 AM   #7
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,145
Default

Setting I_HEIGHTOVERRIDE to 1 should result in the theme's minimum track height being used.
cfillion is offline   Reply With Quote
Old 05-06-2020, 11:37 AM   #8
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

Unless they are exposed via the Theme get/setlayout parameters, its difficult.
If the theme is unpacked, you can simply read the rtconfig-file. If not, you need to unpack the file first.
Julian is planning to add an (un)zipper to his extension, which could be useful in this case.

Edit: cfillion was faster and more accurate than me
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 11:43 AM   #9
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

Quote:
Originally Posted by cfillion View Post
Setting I_HEIGHTOVERRIDE to 1 should result in the theme's minimum track height being used.

Hmm, this sets the collapsed trackheight, but only after I clicked on the track to select it. Before that, it will be ignored.
Not even UpdateArrange seems to have an effect on that.

Code:
fromTrack = reaper.GetTrack(0,0)
A,B=reaper.SetMediaTrackInfo_Value(fromTrack, "I_HEIGHTOVERRIDE", 1)
reaper.UpdateArrange()
Edit: Correction: will be updated only, when I change the track-selection-state of a track.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 11:47 AM   #10
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default

Quote:
Originally Posted by cfillion View Post
Setting I_HEIGHTOVERRIDE to 1 should result in the theme's minimum track height being used.
Isn't that "setting I_HEIGHTOVERRIDE to 0" (as SWS does)?

That's exactly what I want to work around as it disables track height lock:
https://forum.cockos.com/showthread.php?t=227045

Trying to fix this:
https://github.com/reaper-oss/sws/issues/1221
nofish is offline   Reply With Quote
Old 05-06-2020, 11:48 AM   #11
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,145
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Hmm, this sets the collapsed trackheight, but only after I clicked on the track to select it. Before that, it will be ignored.
TrackList_AdjustWindows is needed to apply the new height (not UpdateArrange).

Quote:
Originally Posted by nofish View Post
Isn't that "setting I_HEIGHTOVERRIDE to 0" (as SWS does)?
0 disables the height lock but 1 just results in the theme's minimum height.

EDIT: When the height lock is enabled, it uses the given 1px height as-is, so this won't work...

Last edited by cfillion; 05-06-2020 at 12:09 PM.
cfillion is offline   Reply With Quote
Old 05-06-2020, 11:55 AM   #12
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

Quote:
Originally Posted by cfillion View Post
TrackList_AdjustWindows is needed to apply the new height (not UpdateArrange).
Thanks. Do you have an idea, what the parameter "isminor" actually does?
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 12:19 PM   #13
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Thanks. Do you have an idea, what the parameter "isminor" actually does?
https://forum.cockos.com/showthread.php?t=208275
nofish is offline   Reply With Quote
Old 05-06-2020, 12:21 PM   #14
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default

Quote:
Originally Posted by cfillion View Post
EDIT: When the height lock is enabled, it uses the given 1px height as-is, so this won't work...
Yes, noticed this too.
nofish is offline   Reply With Quote
Old 05-06-2020, 12:23 PM   #15
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

Could this help as a workaround?

Code:
  local lockstate = reaper.GetMediaTrackInfo_Value(track, "B_HEIGHTLOCK", 0) -- get current lockstate
  reaper.SetMediaTrackInfo_Value(track, "B_HEIGHTLOCK", 0) -- unlock track
  reaper.SetMediaTrackInfo_Value(track, "I_HEIGHTOVERRIDE", 10) -- set new height
  reaper.TrackList_AdjustWindows(false) -- update TCP
  reaper.SetMediaTrackInfo_Value(track, "B_HEIGHTLOCK", lockstate) -- restore lockstate of track
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 12:28 PM   #16
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

Quote:
Originally Posted by nofish View Post
Thanks. Added that information to my API-docs.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 12:28 PM   #17
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,145
Default

I_TCPH can be used to get the minimum height but it probably flickers on Windows because it requires TrackList_AdjustWindows. (It cannot be used with PreventUIRefresh as TrackList_AdjustWindows would do nothing.)

Code:
local track = reaper.GetTrack(nil, 0)

reaper.SetMediaTrackInfo_Value(track, 'I_HEIGHTOVERRIDE', 1)
reaper.SetMediaTrackInfo_Value(track, 'B_HEIGHTLOCK', 0)
reaper.TrackList_AdjustWindows(true)
minimumHeight = reaper.GetMediaTrackInfo_Value(track, 'I_TCPH')

reaper.SetMediaTrackInfo_Value(track, 'I_HEIGHTOVERRIDE', minimumHeight)
reaper.SetMediaTrackInfo_Value(track, 'B_HEIGHTLOCK', 1)
reaper.TrackList_AdjustWindows(true)
cfillion is offline   Reply With Quote
Old 05-06-2020, 12:32 PM   #18
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default

Hm..maybe the easiest fix is indeed keeping the function as is and just restore the lock state afterwards (as Meo-Ada Mespotine said).

edit:
Nah, doesn't work because once I_HEIGHTOVERRIDE == 0 the tracks can't be heightlocked anymore, duh, I think I give up.

Last edited by nofish; 05-06-2020 at 01:10 PM.
nofish is offline   Reply With Quote
Old 05-06-2020, 12:40 PM   #19
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,145
Default

As long as I_HEIGHTOVERRIDE is never smaller than the theme's minimum height when the track is re-locked, yes.

EDIT: VertZoomRange already ensures that:

Code:
int minTrackHeight = SNM_GetIconTheme()->tcp_small_height; // nice!

if (iEachHeight < minTrackHeight)
  iEachHeight = minTrackHeight;

Last edited by cfillion; 05-06-2020 at 12:51 PM.
cfillion is offline   Reply With Quote
Old 05-06-2020, 12:44 PM   #20
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

If you temporarily disable tracklock, this is no problem. Have tested it. The minimum trackheight is only overriden, when track is locked.

Which results in nice possibilities. Will write a function to do that for my API
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-06-2020, 01:21 PM   #21
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,636
Default

Quote:
Originally Posted by cfillion View Post
Code:
int minTrackHeight = SNM_GetIconTheme()->tcp_small_height; // nice!
Ohhh totally missed that! I think I can work with it, thanks.

edit:
Quote:
As long as I_HEIGHTOVERRIDE is never smaller than the theme's minimum height when the track is re-locked, yes.
That would still not solve the unintended unlocking of the minimized tracks.
https://github.com/reaper-oss/sws/issues/1221

But I think this can be replaced with this nice minTrackHeight.

Last edited by nofish; 05-06-2020 at 01:30 PM.
nofish is offline   Reply With Quote
Old 05-06-2020, 05:06 PM   #22
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 285
Default

Nice funfact:

If you set the trackheight with trackheight locked, the maximum height of all tracks combined can be up to 2147483586 pixels.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1111 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper
Meo-Ada Mespotine is offline   Reply With Quote
Reply

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 09:23 PM.


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