|
|
|
09-26-2016, 05:20 AM
|
#1
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Q: ReaScripts, Dockers and Screensets
Is there a way for a reascript to know which screenset is loaded?
It seems loading a screenset refreshes windows and dockers positions etc, but nothing is stored anywhere to say, current screenset is number 1 or number 2 for example.
I want to be able to automatically change docker of a reascript window in a different one if a different screenset is loaded.
Or maybe the solution is to force a certain docker to have certain ID before saving the screenset. so the reascript can always have the same docker ID, but that docker can be positioned in different locations.
there are some docker functions but I have no idea how they work.
Dock_UpdateDockID
DockIsChildOfDock
DockWindowActivate
DockWindowAdd
DockWindowAddEx
DockWindowRefresh
DockWindowRefreshForHWND
DockWindowRemove
I've tried reaper.Dock_UpdateDockID(desireddockid, currentdockid)
but it doesn't work.
Anyone knows what all these dock functions do?
|
|
|
09-27-2016, 07:20 PM
|
#3
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
I track and load the dockstate and other options of some scripts in the REAPER EXT state. The ext_option function defines a default and writes the value to the EXT state if it is not present, otherwise loads the stored one. The init_ext_options just shows how I handle loading gfx_init.
IN EEL (so you'll need to translate to lua - good luck)
Code:
function ext_option(extname,key,default,newval,setnewval)local(getvalue,setvalue,value)
// int int_option("section", "key", int default, int newval, bool setnewval)
//saves key in reaper-extstate.ini
(
getvalue=#; setvalue=#;
!HasExtState(extname, key) ? (
sprintf(setvalue,"%i",default);
SetExtState(extname, key, setvalue, 1);
);
setnewval ? (
sprintf(setvalue,"%i",newval);
SetExtState(extname, key, setvalue, 1);
setnewval=0;
);
HasExtState(extname, key) ? (
GetExtState(getvalue, extname, key); match("%i",getvalue,value);
);
value;
);
//init_ext_options("EXAMPLE",dockstate,width,height);
function init_ext_options(section_string,dockdefault,widthdefault,heightdefault)
local(proj,dockstate,width,height)
(
proj=EnumProjects(-1, "");
dockstate=ext_option(section_string,"dockstate",dockdefault,0,0);
width=ext_option(section_string,"display_width",widthdefault,0,0);
height=ext_option(section_string,"display_height",heightdefault,0,0);
gfx_init(section_string, width, height ,dockstate);
);
So you could use a similar scheme, but create EXTstate values for each screenset.
If there isn't a way to track the screensets, I guess you could script your own screenset changer - which would setnewvalues to the EXT state for each particular Section (script) - and those scripts would have to monitor for changes to the ext state and set themselves accordingly.
within a script, I use the following scheme to store the options whenever they change.
This is for width and height (I just relize my dockstate scheme isn't exactly right at the moment but yeah I just cache the values and check for changes)
Code:
width=ext_option(#section,"display_width",150,max(gfx_w,150),gfx_w!=wcache);
wcache=gfx_w;
height=ext_option(#section,"display_height",500,gfx_h,gfx_h!=hcache);
wcache=gfx_h;
This should work in reverse as well. So if some other script changes the EXT state it should just change. (but not %100 on that - might need to rework it.)
Last edited by James HE; 09-27-2016 at 08:09 PM.
|
|
|
09-28-2016, 09:26 AM
|
#4
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Thanks James, the problem is not storing the variables, the problem is not knowing which is the last active screenset. When you click to load a screenset it loads it and changes all the windows and dockers, and the screenset font gets bold indicating that you loaded that one, but it is not stored anywhere that particular screenset was loaded. At least I can't find it. And if you restart REAPER, and open the screensets window again, the last loaded screenset is not bold anymore. So that's the problem.
I was wondering about that Dock_UpdateDockID function in particular. But I don't know how it works or what it does.
|
|
|
07-30-2020, 07:54 AM
|
#5
|
Human being with feelings
Join Date: Feb 2017
Location: Belgrade, Serbia
Posts: 338
|
Four years later is this still a mystery?
|
|
|
07-30-2020, 12:44 PM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Isn't the last screenset stored in reaper.ini?
|
|
|
07-31-2020, 12:32 AM
|
#7
|
Human being with feelings
Join Date: Feb 2017
Location: Belgrade, Serbia
Posts: 338
|
I don't know, maybe, didn't look. Thanks for that.
But, what about those docker functions?
If I am correct most of them are still undocumented.
|
|
|
07-31-2020, 06:55 PM
|
#8
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Ok, at last I can answer one question for now: you cannot find out currently, what the last or the currently used screenset is, as it's only stored in memory of Reaper and nowhere else.
In regards of the docker-functions: I have this feature-request which I'm dropping in here, for completion of docker-related functions, as some are missing from the whole docker-business.
https://forum.cockos.com/showthread.php?t=222314
Feel free to chime in. With them added, I can document them all.
|
|
|
08-07-2020, 05:02 AM
|
#9
|
Human being with feelings
Join Date: Feb 2017
Location: Belgrade, Serbia
Posts: 338
|
Thank you very much.
This is already helpful.
|
|
|
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 05:22 AM.
|