Closed p0nce closed 3 years ago
In AU sometimes getting the view frame yield surprising results, currently disabled. This will be something to fix before considering resizeable UI.
I would like to work on this one next. It would be very beneficial for Convergence. Do you foresee any major complications besides the AU view frame issue?
This is how I think it should work, some of the work was put in place years ago already:
bool _client.hostCommand().requestResize(width, height);
from dplug.client.client.IHostCommand
to request a resize. This is implementation-specific depending on VST2 / VST3 / AU / LV2 / AAX.After that, when and if the host does resize the parent window:
IWindowListener
receives an onResized
event in guigraphics.d
, which it passes on the GUI root by calling reflow
.
Override reflow
to position all your widgets along-side the UI.
Implementing this call is implementation-specific depending on X11 / Cocoa / Win32.The method that becomes important is reflow
, a virtual method from UIElement
in which all lines touching .position
of widgets should go.
UIElement.reflow
is completely overriden by the background widgets, so the default implementation in UIElement should be empty.
I don't think we'll support live resize (the window is resizeable, reflow while resizing the window), sounds more complicated.
There is more to this than I had considered. I was thinking that resizing would only be from the windowing side of things. I was only considering the case where the plug-in window could be "stretched" to fit the window when it was resized (from the host). In my mind, we would be able to use bi-linear interpolation to draw to the new window size. I'm going to have to put much more thought into this clearly.
Actually the two solutions are possible and are independent.
I think both type of resizing are needed in the end.
One is about IGraphics having a changing size. (the one I described)
One is about the Windows having a different size than the IGraphics object. Useful for HiDPI(?) and iPad. It's not that easy since rect invalidation is already messy on Windows and currently the code convert IGraphics unit into Window unit without care.
Both can be implemented independently but in both we also need a way to resize an image first (probably could be another subpackage). I think Voxengo has an image resizing library.
Trying to clarify the situation we want to be in.
EDIT : NOT ACCURATE AT ALL
Important concept:
There is a problem right now:
For proper invalidation, onResized must be put outside WM_PAINT. (EDIT: OK)
Here are the messages seen when creating a plugin window sequence:
Inside CreateWindowEx:
129 WM_NCCREATE
131 WM_NCCALCSIZE
1 WM_CREATE
5 WM_SIZE
3 WM_MOVE
24 WM_SHOWWINDOW
70 WM_WINDOWPOSCHANGING
133 WM_NCPAINT
20 WM_ERASEBKGND
71 WM_WINDOWPOSCHANGED
// following messages are after CreateWindowEx, so you can access the Win32Window
641 WM_IME_SETCONTEXT
7 WM_SETFOCUS
8 WM_KILLFOCUS
641 WM_IME_SETCONTEXT
642 WM_IME_NOTIFY
3 WM_MOVE
15 WM_PAINT
I'm happy to say that plugin resizing is now supported! That was the oldest ticket alive. Support in 11.0.8+
Remaining known issues:
Is there a code example?
Distort and ClipIt now have a resizing widget in the bottom-right corner. They are the reference examples to copy.
Didn't see any issue with Cubase 12 + Win 11 + VST2 or VST3
reflow
, it now is called when setting position, and is only concern with psitionning children.position
call reflow and the various setDirtyrenderBuffer
has different size from GUIGraphics size (one is seen by the window, the other is internal to the plugin)GUIGraphics
UIImageKnob
resizingUIImageKnob
andUIFilmStripKnob
should have a resizing that consider each sub-image independently, to avoid leaking and coordinates problems. Currently, there is a slight offset while turning such a resized knob. It should also take less space.resizer.d
should have a linear mode that go faster and uses less memory, and probably a lanczos2 option too.resizer.d
should have a mode that is blurry. Lanczos2 or lanczos3 are really bad for resizing depth values, because small amount of ringing provokes comparatively large change in output with the PBR algorithms.UIELement
whose_position
is outside the UI.box2i.scaleWithFactor
should use rounding then.audioMasterSizeWindow
. It would be too simple.