|
|
|
05-06-2020, 10:10 AM
|
#1
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
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?
|
|
|
05-06-2020, 10:21 AM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
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 )
|
|
|
05-06-2020, 10:32 AM
|
#3
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Thanks. According to this 24 pixels seems indeed hardcoded min. track height.
|
|
|
05-06-2020, 11:15 AM
|
#4
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
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
|
|
|
05-06-2020, 11:33 AM
|
#5
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by heda
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.
|
|
|
05-06-2020, 11:34 AM
|
#6
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by heda
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.
|
|
|
05-06-2020, 11:37 AM
|
#7
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
Setting I_HEIGHTOVERRIDE to 1 should result in the theme's minimum track height being used.
|
|
|
05-06-2020, 11:37 AM
|
#8
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
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
|
|
|
05-06-2020, 11:43 AM
|
#9
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by cfillion
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.
|
|
|
05-06-2020, 11:48 AM
|
#11
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
Quote:
Originally Posted by Meo-Ada Mespotine
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
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.
|
|
|
05-06-2020, 11:55 AM
|
#12
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by cfillion
TrackList_AdjustWindows is needed to apply the new height (not UpdateArrange).
|
Thanks. Do you have an idea, what the parameter "isminor" actually does?
|
|
|
05-06-2020, 12:19 PM
|
#13
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by Meo-Ada Mespotine
Thanks. Do you have an idea, what the parameter "isminor" actually does?
|
https://forum.cockos.com/showthread.php?t=208275
|
|
|
05-06-2020, 12:21 PM
|
#14
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by cfillion
EDIT: When the height lock is enabled, it uses the given 1px height as-is, so this won't work...
|
Yes, noticed this too.
|
|
|
05-06-2020, 12:23 PM
|
#15
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
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
|
|
|
05-06-2020, 12:28 PM
|
#16
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by nofish
|
Thanks. Added that information to my API-docs.
|
|
|
05-06-2020, 12:28 PM
|
#17
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
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)
|
|
|
05-06-2020, 12:32 PM
|
#18
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
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.
|
|
|
05-06-2020, 12:40 PM
|
#19
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
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.
|
|
|
05-06-2020, 12:44 PM
|
#20
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
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
|
|
|
05-06-2020, 01:21 PM
|
#21
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by cfillion
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.
|
|
|
05-06-2020, 05:06 PM
|
#22
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Nice funfact:
If you set the trackheight with trackheight locked, the maximum height of all tracks combined can be up to 2147483586 pixels.
|
|
|
12-16-2021, 11:17 AM
|
#23
|
Human being with feelings
Join Date: Apr 2021
Location: Brest, France
Posts: 52
|
Quote:
Originally Posted by cfillion
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;
|
Hello, quite old post, I know but I'm trying to figure out what you mean with this reference to something that doesn't seems to be LUA, or at least "lua accessible" ?
I'm trying to get the minimum track height of a theme.
|
|
|
12-16-2021, 08:09 PM
|
#24
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Quote:
Originally Posted by MathieuC
Hello, quite old post, I know but I'm trying to figure out what you mean with this reference to something that doesn't seems to be LUA, or at least "lua accessible" ?
I'm trying to get the minimum track height of a theme.
|
Hi, I'm the thread starter and my question was related to an issue in SWS extension, so what cfillion posted is C++ code, only useable from within the SWS code base.
I still don't know of a way to do this in Lua, sorry.
|
|
|
12-17-2021, 06:01 AM
|
#25
|
Human being with feelings
Join Date: Apr 2021
Location: Brest, France
Posts: 52
|
Hi NoFish,
Thanks for your reply, ok, I guess I have to wait for an API implementation of such a feature.
|
|
|
12-30-2023, 05:01 AM
|
#26
|
Human being with feelings
Join Date: Apr 2021
Location: Brest, France
Posts: 52
|
Hello folks,
An updated version of this script, if it can help... :
Code:
--- get the minimum track height on a project. This size is theme related so it may change from on theme to another.
-- this is a workaround by CFillion : [https://forum.cockos.com/showpost.php?p=2283520&postcount=17](https://forum.cockos.com/showpost.php?p=2283520&postcount=17)
-- @warning due to the workaround use here, screen will quickly blink once while looking for min track height.
function minimumTrackHeight()
--get first track avoiding folders and track with fixed lanes
nbrTracks= reaper.CountTracks(0)
for i=0, nbrTracks-1 do
track=reaper.GetTrack(0, i)
--if no lanes, nbr_f_lanes will be 1
nbr_f_lanes=reaper.GetMediaTrackInfo_Value( track, "I_NUMFIXEDLANES" )
if reaper.GetMediaTrackInfo_Value( track, "I_FOLDERDEPTH") ~= 1 and
reaper.IsTrackVisible(track,false )and
nbr_f_lanes < 1 then
--if the track is not a folder, is visible and hasn't lanes wee keep it
track=reaper.GetTrack(0, i)
break
end
end
--1st track size info and lock it
local tr_lock_state=reaper.GetMediaTrackInfo_Value(track, "B_HEIGHTLOCK")
local tr_height=reaper.GetMediaTrackInfo_Value(track, "I_TCPH")
--remove potential refresh lock state. Potentialy toggling "reaper.TrackList_AdjustWindows(true)" function in a disable state
reaper.PreventUIRefresh(-1)
--minimization of 1rst track to minimum tarck height
reaper.SetMediaTrackInfo_Value(track, "I_HEIGHTOVERRIDE", 1)
reaper.TrackList_AdjustWindows(true)
minimumHeight = reaper.GetMediaTrackInfo_Value(track, "I_TCPH")
--restore 1rst track size and unlock
reaper.SetMediaTrackInfo_Value(track,"B_HEIGHTLOCK",tr_lock_state)
reaper.SetMediaTrackInfo_Value(track,"I_HEIGHTOVERRIDE",tr_height)
reaper.TrackList_AdjustWindows(true)
--return to previous refresh UI state
reaper.PreventUIRefresh(1)
return minimumHeight
end
|
|
|
12-30-2023, 09:16 AM
|
#27
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by MathieuC
Hello folks,
An updated version of this script, if it can help... :
|
FWIW that solution only works when I remove the reaper.PreventUIRefresh() lines. Surprisingly it doesn't always flicker.
Also if source track is height locked it returns 1.0 here.
Win10_x64, REAPER v7.07
Last edited by Edgemeal; 12-30-2023 at 09:33 AM.
|
|
|
12-30-2023, 11:56 AM
|
#28
|
Human being with feelings
Join Date: Apr 2021
Location: Brest, France
Posts: 52
|
Quote:
Originally Posted by Edgemeal
FWIW that solution only works when I remove the reaper.PreventUIRefresh() lines. Surprisingly it doesn't always flicker.
Also if source track is height locked it returns 1.0 here.
|
Yes, this is more a snippet you can, of course, tweak regarding your needs
You can also replace the fixed item lanes detection by
Code:
is_tr_fil, _ = reaper.GetSetMediaTrackInfo_String( tr, "P_LANENAME:0", "", 0 )
instead of
Code:
reaper.GetMediaTrackInfo_Value( track, "I_NUMFIXEDLANES" )
|
|
|
12-31-2023, 08:22 AM
|
#29
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by MathieuC
Yes, this is more a snippet you can, of course, tweak regarding your needs
|
Just wanted to point out, your code won't work with height-locked tracks, I do it similar to post #17, I check if source track is Height Locked, if it is then I unlock it first, then resize, etc,, then restore track back to its original height and set height-lock state if needed. Happy New Year!
Last edited by Edgemeal; 12-31-2023 at 08:36 AM.
|
|
|
12-31-2023, 08:37 AM
|
#30
|
Human being with feelings
Join Date: Apr 2021
Location: Brest, France
Posts: 52
|
Regarding my previous post, I present another version that is more to my liking.
Code:
function minimumTrackHeight()
--get first track avoiding folders and fixed lanes
local nbr_tr= reaper.CountTracks(0)
for i=0, nbr_tr-1 do
track=reaper.GetTrack(0, i)
tr_lock_state=reaper.GetMediaTrackInfo_Value(track, "B_HEIGHTLOCK")
tr_height=reaper.GetMediaTrackInfo_Value(track, "I_TCPH")
is_tr_fil, _ = reaper.GetSetMediaTrackInfo_String( track, "P_LANENAME:0", "", 0 ) -- check track to get FIL true/false
if reaper.GetMediaTrackInfo_Value( track, "I_FOLDERDEPTH") ~= 1 and
reaper.IsTrackVisible(track,false ) and
tr_lock_state == 0.0 and
is_tr_fil == false then
--if the track is not a folder, is visible and hasn't lanes wee keep it
track=reaper.GetTrack(0, i)
break
end
end
--remove potential refresh lock state. Potentialy toggling "reaper.TrackList_AdjustWindows(true)" function in a disable state
reaper.PreventUIRefresh(-1)
--minimization of 1rst track to minimum tarck height
reaper.SetMediaTrackInfo_Value(track, "I_HEIGHTOVERRIDE", 1)
reaper.TrackList_AdjustWindows(true)
minimumHeight = reaper.GetMediaTrackInfo_Value(track, "I_TCPH")
--restore 1rst track size and unlock
reaper.SetMediaTrackInfo_Value(track,"B_HEIGHTLOCK",tr_lock_state)
reaper.SetMediaTrackInfo_Value(track,"I_HEIGHTOVERRIDE",tr_height)
reaper.TrackList_AdjustWindows(true)
--return to previous refresh UI state
reaper.PreventUIRefresh(1)
return minimumHeight
end
Last edited by MathieuC; 12-31-2023 at 09:02 AM.
|
|
|
12-31-2023, 08:39 AM
|
#31
|
Human being with feelings
Join Date: Apr 2021
Location: Brest, France
Posts: 52
|
Quote:
Originally Posted by Edgemeal
Just wanted to point out, your code won't work with height-locked tracks, I do it similar to post #17, I check if source track is Height Locked, if it is then I unlock it first, then resize, etc,, then restore track back to its original height and set height-lock state if needed. Happy New Year!
|
Oh yes, thanks, the script i'm working on check this parameter in another place. I add it in the previous post with the edited code.
Last edited by MathieuC; 12-31-2023 at 09:03 AM.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:42 AM.
|