+ /* we can get here for two reasons:
+
+ 1) the plugin window was resized by the user, a new size was
+ allocated to the window, ::update_view_size() was called, and we
+ explicitly/manually resized the AU NSView.
+
+ 2) the plugin decided to resize itself (probably in response to user
+ action, but not in response to an actual window resize)
+
+ We only want to proceed with a window resizing in the second case.
+ */
+
+ if (in_live_resize) {
+ /* ::update_view_size() will be called at the right times and
+ * will update the view size. We don't need to anything while a
+ * live resize in underway.
+ */
+ return;
+ }
+
+ if (plugin_requested_resize) {
+ /* we tried to change the plugin frame from inside this method
+ * (to adjust the origin), and the plugin changed its size
+ * again. Ignore this second call.
+ */
+ std::cerr << plugin->name() << " re-entrant call to cocoa_view_resized, ignored\n";
+ return;
+ }
+
+ plugin_requested_resize = 1;
+
+ ProcessorWindowProxy* wp = insert->window_proxy();
+ if (wp) {
+ /* Once a plugin has requested a resize of its own window, do
+ * NOT save the window. The user may save state with the plugin
+ * editor expanded to show "extra detail" - the plugin will not
+ * refill this space when the editor is first
+ * instantiated. Leaving the window in the "too big" state
+ * cannot be recovered from.
+ *
+ * The window will be sized to fit the plugin's own request. Done.
+ */
+ wp->set_state_mask (WindowProxy::Position);
+ }
+
+ NSRect new_frame = [au_view frame];
+
+ std::cerr << "Plugin " << plugin->name() << " requested update (prs now = " << plugin_requested_resize << ")\n";
+ std::cerr << "\tAU NSView frame : " << [ NSStringFromRect (new_frame) UTF8String] << std::endl;
+ std::cerr << "\tlast au frame : " << [ NSStringFromRect (last_au_frame) UTF8String] << std::endl;
+
+ /* from here on, we know that we've been called because the plugin
+ * decided to change the NSView frame itself.
+ */
+
+ /* step one: compute the change in the frame size.
+ */
+
+ float dy = new_frame.size.height - last_au_frame.size.height;
+ float dx = new_frame.size.width - last_au_frame.size.width;
+