View Single Post
Old 08-13-2019, 11:27 AM   #148
Human being with feelings
Fabian's Avatar
Join Date: Sep 2008
Location: Sweden
Posts: 5,637

BTW, I modded Eugene's script so that it docks, and remembers its docking position. This makes it so much easier to use (for me).

I'm not sure about reposting Eugene's code edited by myself, but here are instructions so you can do the mod yourself. Line numbers below refer to line numbers in the original code, as on GitHub (see Eugene's first post on this); the line numbers will change after the new code has been input, of course.

Start by making a copy of the script, and work on the copied version. Open it in a text editor, I think that is the easiest, but of course the built in IDE would also work.

Paste the following code:
//////////////////// Dock state stuff (by MF, part code from BRSO Articulate)
function InitDockstate()
  local(width, height, dockstate, xpos, ypos)
  // Dock state - V5 only!
  HasExtState(SCRIPTNAME, "dock") ? 
    GetExtState(#dockstate, SCRIPTNAME, "dock");
    match("%d", #dockstate, dockstate);
  ) : (dockstate = 513);
  dockstate_last = dockstate;

  atexit("SaveDockstate();");  // Register exit function

function SaveDockstate()
  // (dockstate != dockstate_last) ?
    dockstate = gfx_dock(-1);  
    #dockstate = sprintf(#, "%d", dockstate);
    SetExtState(SCRIPTNAME, "dock", #dockstate, 1); // store "dockstate" string
    dockstate_last = dockstate;
on line number 495, which is an empty line. It doesn't really have to go there, could be anywhere, but now we know exactly where the new code is.

Next you replace the (original) line numbers 500-501 (the first two lines inside the gui.init() function) with this code:
  w = 520; h = 280;
  dockstate = InitDockstate();
  x = 100; y = 500;   
  gfx_init(SCRIPTNAME, w, h, dockstate, x, y);
Finally, put this line:
SCRIPTNAME = "Envelope-based Compressor v212:dockmod";
on the empty line number 10, right before the imports (again, it doesn't really have to be there, but this is a good place as any). You can give the script whatever name you like, this is used on the docker tab, as well as in the project file to store the docking information.

I hope I got all of that right. Else, let me know.
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote