|
|
|
05-20-2019, 01:52 PM
|
#521
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Anyway something I've noticed after playing with LICE,GDI etc last 20 days.
Sometimes one bitmap renders over others and sometimes below. I'm not sure why is that happening. You can see that in my last post here regarding touchscreen:
You can see that "menu" highlight bitmap is behind main one, but one of 30 times it will get rendered above it. Is there any control over it or the code just needs to be:
first - second - last regarding drawing?
EDIT: Just as I've try to test something it appeared
You can see that last one menu highlight is rendered above everything along with its background
Last edited by Sexan; 05-20-2019 at 01:59 PM.
|
|
|
05-20-2019, 02:10 PM
|
#522
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Sexan
Is there any control over it or the code just needs to be:
first - second - last regarding drawing?
|
ATM there is no control over the order in which linked bitmaps get drawn on the screen.
|
|
|
05-21-2019, 05:30 AM
|
#523
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by nofish
|
How hard would it be to port it over to Lua?
|
|
|
05-21-2019, 05:57 AM
|
#524
|
Human being with feelings
Join Date: Apr 2014
Posts: 4,171
|
Hey Julian,
Something in the latest dev build 521 - causes reaper to hard crash when I run some of my scripts which use your API.
I remove your extension dll - and although my scripts lose some functionality - they work ok again.
I'm generally using Mouse and Window functions - some GDI functions (and load mouse cursor - but still crashed when I removed this).
Trying to narrow down the problem...
EDIT:
Strangely - it seems to be your JS_ReaScriptAPI_Version() function which is crashing Reaper.
Last edited by lb0; 05-21-2019 at 06:15 AM.
|
|
|
05-21-2019, 06:05 AM
|
#525
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Would it be to much to ask for an API to set global project startup actions. It would work similar to SWS/S&M: Set global startup action but it would get called on every project load.
I know we can create project templates with SWS/S&M: Set project startup action, but that doesn't always really work
|
|
|
05-21-2019, 06:35 AM
|
#526
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by lb0
Strangely - it seems to be your JS_ReaScriptAPI_Version() function which is crashing Reaper.
|
This is indeed strange. What OS and REAPER version are you using?
Does even a single-line script "v = reaper.JS_ReaScript_Version()" crash your system?
|
|
|
05-21-2019, 06:43 AM
|
#527
|
Human being with feelings
Join Date: Apr 2014
Posts: 4,171
|
Quote:
Originally Posted by juliansader
This is indeed strange. What OS and REAPER version are you using?
Does even a single-line script "v = reaper.JS_ReaScript_Version()" crash your system?
|
Yeah- I went through all the commands I use in Stripper in a separate Lua file - and the version API was the cause.
I'm on windows 10 64bit - latest dev build of Reaper - dev521
This crash was reported to me by Stevie - so it's not just me.
The latest dev build has this:
Code:
+ API: support optional arguments in extension-supplied functions when called from ReaScript/Lua [t=219455]
which might be the cause?
|
|
|
05-21-2019, 11:05 AM
|
#528
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Julian I have small issue that i cannot figure out how to fix so if you can please assist:
Image of the item is not shrinking/stretching it just reveal its content and disappears when its off the original.
Drawing code
Code:
for j = 1, #tbl.info[i].items do
local as_item = tbl.info[i].items[j]
local item_bm = item_ghosts[as_item].bm
local item_start, item_lenght = item_blit(as_item, tbl.time_start, tbl.time_end, pos)
reaper.JS_Composite(track_window,
math.ceil(item_start * zoom_lvl) - Arr_pixel, -- X
item_t - y_view_start + item_bar, -- Y
math.ceil(item_lenght * zoom_lvl), -- W
item_h, -- H
item_bm,
0, --x
0, --y
math.ceil((item_lenght * zoom_lvl)), --w
item_h) --h
end
grabbing code
Code:
for j = 1, #tbl.info[i].items do
local as_tr, as_item = tbl.info[i].track, tbl.info[i].items[j]
local item_t, item_h, item_b = TBH[as_tr].t, TBH[as_tr].h, TBH[as_tr].b
local item_bar = (item_h > 42) and 15 or 0
local item_start, item_lenght = item_blit(as_item, tbl.time_start, tbl.time_end)
local bm = reaper.JS_LICE_CreateBitmap(true, math.ceil(item_lenght * zoom_lvl), item_h)
local dc = reaper.JS_LICE_GetDC(bm)
reaper.JS_GDI_Blit(dc, 0, 0, track_window_dc, -- SOURCE - DESTINATION
math.floor(item_start * zoom_lvl) - Arr_pixel, -- X
((item_t + item_bar) - y_view_start), -- Y
math.ceil(item_lenght * zoom_lvl), -- W
item_h - 19) -- H (-19 TO COMPENSATE ITEM BAR REMOVING)
item_ghosts[as_item] = {bm = bm , dc = dc }
end
Last edited by Sexan; 05-21-2019 at 11:13 AM.
|
|
|
05-21-2019, 11:36 AM
|
#529
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
At first glance, this drawing code might be the problem:
Code:
reaper.JS_Composite(track_window,
math.ceil(item_start * zoom_lvl) - Arr_pixel, -- X
item_t - y_view_start + item_bar, -- Y
math.ceil(item_lenght * zoom_lvl), -- W
item_h, -- H
item_bm,
0, --x
0, --y
math.ceil((item_lenght * zoom_lvl)), --w
item_h) --h
end
The last --w and --h lines probably cut off part of the bitmap. To shrink and expand the ghost, the entire source bitmap must be composited, so (source w and h remain constant), and only the image size W and H in the track window changes.
|
|
|
05-21-2019, 11:51 AM
|
#530
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Yeah thats whats happening, so the last two should be zero or I need to store original sizes also ? Probably second one
Last edited by Sexan; 05-21-2019 at 11:59 AM.
|
|
|
05-21-2019, 11:58 AM
|
#531
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Sexan
Yeah thats whats happening, so the last two should be zero or I need to store original sizes also ?
|
You will need to store the original size.
|
|
|
05-21-2019, 12:07 PM
|
#532
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Yes, now it works thank you
Last edited by Sexan; 05-21-2019 at 12:14 PM.
|
|
|
05-22-2019, 01:48 AM
|
#533
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Breeder
Would it be to much to ask for an API to set global project startup actions. It would work similar to SWS/S&M: Set global startup action but it would get called on every project load.
|
I would be happy to - if I knew how. Is there a C++ function to set such startup actions, or do you know some alternative trick? I took a look at SnM's code, and they seem to use "plugin_register("timer"", but I couldn't find any reference to "timer" in reaper_plugin_functions.h or reaper_plugin.h.
Quote:
I know we can create project templates with SWS/S&M: Set project startup action, but that doesn't always really work
|
Oops. If SnM's trick doesn't always work, I'm not sure that I can do better...
(BTW, anyone can contribute to this extension, so if you have any API code that you would like me to include, you are welcome to send it to me or make a pull request on github.)
|
|
|
05-22-2019, 02:45 AM
|
#534
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Sexan
Awesome thank you! If its not too much trouble can you please help me with that VK_Key cutoff (2 posts above you)? Not sure how the code should look like
|
The code from my own scripts above is probably the best example I can give.
Depending on exactly which keys you would like to include or exclude, you may need a combination of GetState and GetDown or GetUp:
In case of "press and hold" functions that run as long as the key is held down, use GetState to get the currently active keys. To include the shortcut keys that were used to call the scripts, use GetState(startTimeOfScript-1).
To get keys that were newly pressed, I use a combination of GetState and GetDown: GetDown(prevCycleTime) gets KEYDOWNs since the last defer cycle, and then compares it against GetState(startTime-1) from the *previous* defer cycle (which was called at prevCycleTime), to exclude repeated KEYDOWNs that are being sent by keys that were already down in the previous cycle.
|
|
|
05-22-2019, 04:54 AM
|
#535
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by juliansader
I would be happy to - if I knew how. Is there a C++ function to set such startup actions, or do you know some alternative trick? I took a look at SnM's code, and they seem to use "plugin_register("timer"", but I couldn't find any reference to "timer" in reaper_plugin_functions.h or reaper_plugin.h.
|
Hey, thanks man!
He firsts creates this static variable:
https://github.com/reaper-oss/sws/bl....cpp#L421-L422
The he registers it on reaper startup:
https://github.com/reaper-oss/sws/bl....cpp#L430-L431
And then during every project save/load these 3 functions get called by REAPER:
https://github.com/reaper-oss/sws/bl....cpp#L391-L419
And in those functions you check if there's anything you would like to run during that time. In global project action case, you simply read the action in question during extension load and run it in ProcessExtensionLine.
The timer he is using is just to postpone running the action until the whole project loads (at least I think...I do remember these updates and I remember we had some trouble until we used the timer trick...I think it's the same thing as doing defer() from .lua script )
So instead of just doing Main_OnCommand(cmdId, 0) - he registers a timer:
https://github.com/reaper-oss/sws/bl....cpp#L401-L402
And then deregisters that same timer from itself and calls Main_OnCommand(cmdId, 0) there:
https://github.com/reaper-oss/sws/bl....cpp#L224-L236
And also makes sure timer gets deregistered properly on REAPER exit (not sure if this actually might be necessary because timer deregisters itself, but it's good practice anyway and we always strived to make sure everything deregistered properly during REAPER exit):
https://github.com/reaper-oss/sws/bl....cpp#L436-L437
If you got any specific question, feel free to ask. While working on SWS, both Jeffos and myself met with a lot of small quirks like this one (registering a timer like this)...SWS is like a small encyclopedia on how to deal with a lot of small idiosyncrasies inherent to REAPER This is the exact reason I was always for unification of C++ extensions and was afraid SWS will go to hell if people start doing their own extensions instead of contributing directly to SWS...
Regarding contributing - I actually wouldn't mind contributing but I just can't find the time to go through the whole visual studio setup etc...I had a lot of work on setting things up since I got back to REAPER and now I'm in the middle of writing an album.
I must confess that after writing countless scripts these days, I do miss C++. Who knows, when I finish this period of life, I just might give it another round. No promises, lol - who knows where this music making will take me ;D
Quote:
Originally Posted by juliansader
Oops. If SnM's trick doesn't always work, I'm not sure that I can do better...
|
No, no...it works! But the problem is that you have to set up project action for every project you want it to use. There's currently no known way to have REAPER run something on EVERY project load without setting the project up.
That's why I tried to differentiate between PROJECT action and GLOBAL PROJECT action when describing the issue. I remember actually wanting to add that, but that being Jeffos part of code, I just hoped he would add it. And then he abruptly left and I had a breakdown and switched to Cubase and then abandoned music all together until now
Last edited by Breeder; 05-22-2019 at 05:09 AM.
|
|
|
05-22-2019, 07:33 AM
|
#536
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
osX users have trouble with
Code:
local _, scroll, _, _, _ = reaper.JS_Window_GetScrollInfo(track_window, "SB_VERT")
SInce by API it expects string what can I do about this?
And while we are at it I also have
Code:
local mixer_wnd = reaper.JS_Window_Find("mixer", true) -- DONT KNOW ITS ID
local track = reaper.JS_Window_GetLongPtr(handl, "USER") -- DONT KNOW HOW OTHER PLATFORMS SEE THIS
local window = reaper.JS_Window_GetRelated(track_window, "NEXT")
reaper.JS_Window_GetRelated(window, "CHILD")
reaper.JS_Window_GetLongPtr(window, "USERDATA")
I know mixer will be a problem with other platforms but do not know how to convert it to ID. This other strings also I'm not sure if they will pass on other platforms but I dont know how to fix it
|
|
|
05-22-2019, 08:09 AM
|
#537
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Sexan
osX users have trouble with
Code:
local _, scroll, _, _, _ = reaper.JS_Window_GetScrollInfo(track_window, "SB_VERT")
SInce by API it expects string what can I do about this?
|
deeb's error report refers to argument 1, the void*. This is because the line to get track_window uses Window_Find:
Code:
local track_window = reaper.JS_Window_Find("trackview", true) -- GET TRACK VIEW
For cross-platform usage, you should rather use ID (check out Mespotine's long list above):
Code:
local track_window = reaper.JS_Window_FindChildByID(main_wnd, 1000)
Quote:
And while we are at it I also have
|
I would recommend caution when using GetRelated(hwnd, "NEXT"), since it might not always get the same sequence of windows. Even stuff such as presence of docks or other child windows may change the sequence.
Regarding cross-platform testing, please see PM.
|
|
|
05-22-2019, 12:26 PM
|
#538
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
function with "NEXT" is the most important function in the script I do not know how to refactor this if its problematic, but I did not encountered any problem with it yet
Code:
local function GetTrackFromMouseRange(t, b)
if l_r_t ~= t or l_r_b ~= b then -- GET TRACKS ONLY IF MOUSE RANGE CHANGED
local range_tracks = {}
local trackview_window
local _, _, arr_top = reaper.JS_Window_GetRect(track_window)
local window = reaper.JS_Window_GetRelated(track_window, "NEXT")
while window do
local _, _, top = reaper.JS_Window_GetRect(window)
if top == arr_top then trackview_window = reaper.JS_Window_GetRelated(window, "CHILD") end
window = reaper.JS_Window_GetRelated(window, "NEXT")
end
-- loop over track and envelope windows
local window = reaper.JS_Window_GetRelated(trackview_window, "CHILD")
while window do
if reaper.JS_Window_IsVisible(window) then
-- windows visible in arrange view only
local _, _, top, _, bottom = reaper.JS_Window_GetRect(window)
if top >= t and bottom <= b then -- IF TRACK IS IN THE MOUSE ZONE RANGE
local pointer = reaper.JS_Window_GetLongPtr(window, "USERDATA")
if reaper.ValidatePtr(pointer, "MediaTrack*") then
if not Has_val(range_tracks, pointer) then range_tracks[#range_tracks+1] = {track = pointer} end -- ADD TRACKS TO TABLE IF THEY ARE NOT ALREADY THERE
elseif reaper.ValidatePtr(pointer, "TrackEnvelope*") then
if not Has_val(range_tracks, pointer) then range_tracks[#range_tracks+1] = {track = pointer} end
end
end
end
window = reaper.JS_Window_GetRelated(window, "NEXT")
end
l_r_t, l_r_b, last_tracks = t, b, range_tracks
return range_tracks
else
return last_tracks -- IF MOUSE RANGE IS SAME AS LAST RETURN SAVED TRACKS
end
end
Is there any other approach to it?
This is the ONLY way to get both tracks and envelopes, I've tried other methods many times before but non did it as it should. It is also CPU hungry but I've managed that to only check when actual track changed
I give it Y range and it gives me all the tracks AND envelopes in that range
Last edited by Sexan; 05-22-2019 at 12:32 PM.
|
|
|
05-22-2019, 03:33 PM
|
#539
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Your function avoids the problem with GetRelated and "NEXT" that I referred to above, since it finds trackview_window by checking "if top == arr_top", instead of assuming that trackview_window will always be the Xth (fourth, for example) child window returned by GetRelated.
|
|
|
05-24-2019, 08:16 PM
|
#540
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Update on the window pinning issue - it was partly on my side. I mistyped the variable name I was passing in, so I was giving nil as the HWND argument to JS_Window_Find. Working fine now on Windows 8 and 10.
I would have expected that to cause an error from the extension though, but it returns a UserData pointer without complaining.
|
|
|
06-03-2019, 07:08 AM
|
#541
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
While looking into that thread: https://forum.cockos.com/showthread.php?t=221481
I wondered, if it would be any useful, if you could add CreateWindowExW and such to JS-extension-plugin as well.
This could allow us to add system-ui-elements into windows. Would be helpful for lokasenna as well, as he's currently refactoring his Gui-Lib. If he could add also system-ui-elements, it would be fantastic and help making guis look more like system-stuff.
In other news:
You request as work in progress...
|
|
|
06-03-2019, 08:34 AM
|
#542
|
Human being with feelings
Join Date: Apr 2014
Posts: 4,171
|
Quote:
Originally Posted by mespotine
While looking into that thread: https://forum.cockos.com/showthread.php?t=221481
I wondered, if it would be any useful, if you could add CreateWindowExW and such to JS-extension-plugin as well.
This could allow us to add system-ui-elements into windows. Would be helpful for lokasenna as well, as he's currently refactoring his Gui-Lib. If he could add also system-ui-elements, it would be fantastic and help making guis look more like system-stuff.
In other news:
You request as work in progress...
|
+1
Interestingly - I was thinking along similar lines regarding adding create window api.
My thought's were to intercept multitouch messages in a transparent overlay window - store the data somewhere - in order to get multitouch into script GUI's.
However - so far - it's just thoughts going round my head and may not even be feasible...
|
|
|
06-04-2019, 06:42 AM
|
#543
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Damn lb0, that would be fantastic, if that was possible!
|
|
|
06-04-2019, 02:48 PM
|
#544
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Julian is there some function which returns screen resolution? I have some problems with track heights:
Code:
function GetTrackTBH(tbl)
local total_h = 0
local t, b, h, nt
for i = #tbl , 1, -1 do -- NEEDS TO BE REVERSED OR IT DRAWS WEIRD
local track = tbl[i].track
t, b, h = TBH[track].t, TBH[track].b, TBH[track].h
total_h = total_h + h
if t ~= 2344 then nt = t else total_h = total_h - h end -- NEED TO FIX THIS,RESOLUTION DEPENDANT -- FIX FOR WHEN THE TOP OF AS IS OUT PROJECT TOP IT WOULD EXPAND THE BOTTOM WHEN THE TOP TRACK IS OUT OF VIEW
end
if total_h == 0 then nt = 0 end
return nt, total_h, b
end
Code:
if t ~= 2344 then nt = t else total_h = total_h - h end
If track is off the screen it returns in screen resolution, in my case I own QHD monitor so I need to set 2344 or it gets broken, if its 1080p then it needs to be around 1860-70 something in that range (need to check whats returned). Spotted this issue while was working on notebook
Last edited by Sexan; 06-04-2019 at 02:54 PM.
|
|
|
06-04-2019, 03:35 PM
|
#545
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Indeed there is: JS_Window_GetViewportFromRect
|
|
|
06-05-2019, 12:45 AM
|
#546
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
hm.... not sure how to calculate this
Code:
Resolution 2560 x 1440
TOP OFFSET - 2344
Code:
Resolution 1920 X 1080
TOP OFFSET - 1984
Do not know what it takes into account when calculating this offset (track height when track is not in the view any more)?
Edit: nvm, added track visibility parameter to main tbl
Last edited by Sexan; 06-05-2019 at 01:13 AM.
|
|
|
06-09-2019, 11:56 PM
|
#547
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Julian does JS_destroy_bitmap releases dc or I need to manually delete it?
second question:
Is it possible to get what is the current mouse cursor (want to track elements when cursor changes)?
and third, Julian take a look at PM
Last edited by Sexan; 06-10-2019 at 11:55 AM.
|
|
|
06-10-2019, 06:32 PM
|
#548
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 565
|
Question about JS_Window_Find
If I use JS_Window_Find to get the HWND from a window that doesn't exist, like:
Code:
reaper.JS_Window_Find ("Render to File", True)
If the Render to File window is closed and I run this script, then Reaper hang.
|
|
|
06-10-2019, 07:13 PM
|
#549
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by dsyrock
Question about JS_Window_Find
If I use JS_Window_Find to get the HWND from a window that doesn't exist, like:
Code:
reaper.JS_Window_Find ("Render to File", True)
If the Render to File window is closed and I run this script, then Reaper hang.
|
What does the rest of your code look like? It just returns nil for me on Linux and W10.
|
|
|
06-10-2019, 08:28 PM
|
#550
|
Human being with feelings
Join Date: Sep 2018
Location: China
Posts: 565
|
Quote:
Originally Posted by Lokasenna
What does the rest of your code look like? It just returns nil for me on Linux and W10.
|
Wait maybe I did something wrong, I'll try it again, thanks.
|
|
|
06-11-2019, 01:39 PM
|
#551
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by Sexan
Julian does JS_destroy_bitmap releases dc or I need to manually delete it?
|
I am not aware of a function to release LICE bitmap dc's, so I think the dc is destroyed along with the bitmap.
Quote:
Originally Posted by Sexan
Is it possible to get what is the current mouse cursor (want to track elements when cursor changes)?
|
This is an excellent idea for getting a more detailed cursor context. I quickly tested it, and it seems to work well. I will soon upload a new version with a Mouse_GetCursor function (and perhaps some window creation functions).
|
|
|
06-12-2019, 05:42 AM
|
#552
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Julian I cannot reuse same bitmap do draw it again but on other place? I need to blit it to new bitmap?
If its the second part what would be the most simplest code to duplicate it?
Use case : Draw it multiple times on different coordinates
Last edited by Sexan; 06-12-2019 at 05:50 AM.
|
|
|
06-12-2019, 01:13 PM
|
#553
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Q; How to refresh media explorer after scroll via API ?
Hi,
I'm tryong to scroll Media Explorer to a certain arbitrary pos,
the code works but the display isn't refreshed,
we can see the scrollbar scrolled a little to the bottom,
but the File List isn't refreshed, even when JS_Window_SetScrollPos return true.
Code:
local hWnd = reaper.JS_Window_Find("Media Explorer", true)
if hWnd == nil then return end
local container = reaper.JS_Window_FindChildByID(hWnd, 0)
local file_LV = reaper.JS_Window_FindChildByID(container, 1000)
a = reaper.JS_Window_SetScrollPos( file_LV, "v", 80 )
reaper.JS_Window_Update( hWnd )
reaper.JS_Window_Update( container )
reaper.JS_Window_Update( file_LV )
I tried to push various Window Update without success.
What do I miss ?
|
|
|
06-12-2019, 01:42 PM
|
#554
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
v0.988 uploaded with GetCursor.
Quote:
Originally Posted by Sexan
Julian I cannot reuse same bitmap do draw it again but on other place? I need to blit it to new bitmap?
If its the second part what would be the most simplest code to duplicate it?
|
Yes, you need to blit to a new bitmap: simply create a new bitmap of the same size, and LICE_Blit in "COPY" mode.
|
|
|
06-12-2019, 02:18 PM
|
#555
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by X-Raym
I'm tryong to scroll Media Explorer to a certain arbitrary pos,
|
If all else fails maybe send "WM_VSCROLL" msgs?
Code:
local SB_LINEUP = 0
local SB_LINEDOWN = 1
local SB_TOP = 6
local SB_BOTTOM = 7
-- go to top
reaper.JS_WindowMessage_Send(file_LV, "WM_VSCROLL", SB_TOP, 0,0,0)
-- scroll down to line #
for n = 1, 7 do
reaper.JS_WindowMessage_Send(file_LV, "WM_VSCROLL", SB_LINEDOWN, 0,0,0)
end
|
|
|
06-12-2019, 02:19 PM
|
#556
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
GetCursor works EXTREMELY well for what I wanted! Thank you!
Last edited by Sexan; 06-12-2019 at 02:26 PM.
|
|
|
06-12-2019, 03:13 PM
|
#557
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@edgemeal
Hmmm nope, this just make file list disapear :/
|
|
|
06-12-2019, 04:42 PM
|
#558
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by X-Raym
@edgemeal
Hmmm nope, this just make file list disapear :/
|
Seems to works fine on Win7.
Code:
local hWnd = reaper.JS_Window_Find("Media Explorer", true)
if hWnd == nil then return end
local container = reaper.JS_Window_FindChildByID(hWnd, 0)
local file_LV = reaper.JS_Window_FindChildByID(container, 1000)
local SB_LINEUP = 0
local SB_LINEDOWN = 1
local SB_TOP = 6
local SB_BOTTOM = 7
-- go to top
reaper.JS_WindowMessage_Send(file_LV, "WM_VSCROLL", SB_TOP, 0,0,0)
-- scroll down # of lines
for n = 1, 7 do
reaper.JS_WindowMessage_Send(file_LV, "WM_VSCROLL", SB_LINEDOWN, 0,0,0)
end
|
|
|
06-12-2019, 04:49 PM
|
#559
|
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,618
|
Is there a regression in JS_Window_AttachTopmostPin? This used to work for me (though when I'm not entirely sure), but at least as of 0.988 with Reaper 5.978 this isn't working:
Code:
gfx.init('blargh!', 640, 480, 0, 100, 100)
local hwnd = reaper.JS_Window_Find('blargh!', true)
reaper.ShowConsoleMsg('found hwnd: ' .. tostring(hwnd) .. '\n')
reaper.JS_Window_AttachTopmostPin(hwnd)
function go()
gfx.update()
reaper.defer(go)
end
go()
The console does report a non-nil hwnd. But the pin isn't showing on the window. Anyone else see this?
Windows 10 x64 (build 1809).
|
|
|
06-12-2019, 08:42 PM
|
#560
|
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,618
|
Also, how might one fetch the hwnd of a docked gfx script that matches the hwnd returned by JS_Window_GetFocus() when the docked script is focused?
JS_Window_Find(title_passed_to_gfx_init, true) != JS_Window_GetFocus() when the docked script is focused. However this does work when the script is undocked and floating.
(I swear this used to work, in fact I even went out of my way to add a comment to that effect but either I was wrong at the time or the behavior changed, because it doesn't seem to work anymore.)
|
|
|
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 04:25 PM.
|