13
0

cleanup AU GUI support, which was broken because prefheight and prefwidth were left unset after a cleanup attempt some months ago. add a few more tweaks based on current 2.x code and some tricks found elsewhere that dont' change behaviour but are just better

This commit is contained in:
Paul Davis 2013-04-30 11:15:23 -04:00
parent 07a5372eea
commit d54a35a671
3 changed files with 32 additions and 15 deletions

View File

@ -93,7 +93,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
int prefwidth;
Gtk::HBox top_box;
Gtk::EventBox low_box;
Gtk::HBox low_box;
Gtk::VBox vpacker;
Gtk::Label automation_mode_label;
Gtk::ComboBoxText automation_mode_selector;

View File

@ -1,5 +1,3 @@
#include <gtkmm/stock.h>
#undef Marker
#define Marker FuckYouAppleAndYourLackOfNameSpaces
@ -170,13 +168,16 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
top_box.show ();
low_box.show ();
_activating_from_app = false;
cocoa_parent = 0;
_notify = 0;
cocoa_window = 0;
carbon_window = 0;
#ifdef WITH_CARBBON
_activating_from_app = false;
_notify = 0;
au_view = 0;
editView = 0;
carbon_window = 0;
#endif
/* prefer cocoa, fall back to cocoa, but use carbon if its there */
@ -227,6 +228,7 @@ AUPluginUI::~AUPluginUI ()
bool
AUPluginUI::test_carbon_view_support ()
{
#ifdef WITH_CARBON
bool ret = false;
carbon_descriptor.componentType = kAudioUnitCarbonViewComponentType;
@ -253,6 +255,9 @@ AUPluginUI::test_carbon_view_support ()
}
return ret;
#else
return false;
#endif
}
bool
@ -282,7 +287,7 @@ AUPluginUI::plugin_class_valid (Class pluginClass)
int
AUPluginUI::create_cocoa_view ()
{
BOOL wasAbleToLoadCustomView = NO;
bool wasAbleToLoadCustomView = false;
AudioUnitCocoaViewInfo* cocoaViewInfo = NULL;
UInt32 numberOfClasses = 0;
UInt32 dataSize;
@ -380,7 +385,7 @@ AUPluginUI::create_cocoa_view ()
free (cocoaViewInfo);
}
wasAbleToLoadCustomView = YES;
wasAbleToLoadCustomView = true;
}
}
@ -390,14 +395,16 @@ AUPluginUI::create_cocoa_view ()
au->get_au()));
au_view = [[AUGenericView alloc] initWithAudioUnit:*au->get_au()];
DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("view created @ %1\n", au_view));
[(AUGenericView *)au_view setShowsExpertParameters:YES];
[(AUGenericView *)au_view setShowsExpertParameters:1];
}
// Get the initial size of the new AU View's frame
NSRect rect = [au_view frame];
prefheight = rect.size.height;
prefwidth = rect.size.width;
low_box.set_size_request (rect.size.width, rect.size.height);
return 0;
}
@ -409,7 +416,7 @@ AUPluginUI::cocoa_view_resized ()
NSSize oldContentSize= [window contentRectForFrameRect:[window frame]].size;
NSSize newContentSize= [au_view frame].size;
NSRect windowFrame= [window frame];
oldContentSize.height -= topsize.height;
float dy = oldContentSize.height - newContentSize.height;
@ -427,7 +434,7 @@ AUPluginUI::cocoa_view_resized ()
NSUInteger old_auto_resize = [au_view autoresizingMask];
[au_view setAutoresizingMask:NSViewNotSizable];
[window setFrame:windowFrame display:YES];
[window setFrame:windowFrame display:1];
[au_view setAutoresizingMask:old_auto_resize];
[[NSNotificationCenter defaultCenter] addObserver:_notify
@ -603,7 +610,7 @@ AUPluginUI::parent_cocoa_window ()
return -1;
}
[win setAutodisplay:YES]; // turn of GTK stuff for this window
[win setAutodisplay:1]; // turn of GTK stuff for this window
Gtk::Container* toplevel = get_toplevel();
@ -620,7 +627,7 @@ AUPluginUI::parent_cocoa_window ()
NSPoint origin = { 0, a.height };
[au_view setFrameOrigin:origin];
[view addSubview:au_view positioned:NSWindowBelow relativeTo:nil];
[view addSubview:au_view positioned:NSWindowBelow relativeTo:nil];
// watch for size changes of the view
@ -681,7 +688,7 @@ AUPluginUI::on_realize ()
NSWindow* win = get_nswindow ();
if (win) {
[win setShowsResizeIndicator:NO];
[win setShowsResizeIndicator:0];
}
}

View File

@ -226,6 +226,12 @@ PluginUIWindow::on_show ()
}
if (_pluginui) {
#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
if (pre_deactivate_x >= 0) {
move (pre_deactivate_x, pre_deactivate_y);
}
#endif
if (_pluginui->on_window_show (_title)) {
Window::on_show ();
}
@ -239,6 +245,10 @@ PluginUIWindow::on_show ()
void
PluginUIWindow::on_hide ()
{
#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
get_position (pre_deactivate_x, pre_deactivate_y);
#endif
Window::on_hide ();
if (_pluginui) {