From acf1490e45034a961b7703154c5eabaf6a9aec55 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 10 Dec 2007 21:32:27 +0000 Subject: [PATCH] AU support; mv LADSPA gui to Generic; small fix(?) for NSD issue with absolute/full pathnames git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2755 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/SConscript | 6 +- gtk2_ardour/ardour_ui.cc | 14 +- gtk2_ardour/au_pluginui.cc | 53 -- gtk2_ardour/au_pluginui.h | 78 ++- gtk2_ardour/au_pluginui.mm | 496 ++++++++++++++++++ gtk2_ardour/cocoacarbon.cc | 35 ++ gtk2_ardour/editor_timefx.cc | 14 +- ...ladspa_pluginui.cc => generic_pluginui.cc} | 102 ++-- gtk2_ardour/keyboard.cc | 2 +- gtk2_ardour/new_session_dialog.cc | 6 +- gtk2_ardour/plugin_selector.cc | 368 ++++--------- gtk2_ardour/plugin_selector.h | 90 +--- gtk2_ardour/plugin_ui.cc | 107 +++- gtk2_ardour/plugin_ui.h | 21 +- gtk2_ardour/redirect_box.cc | 80 ++- gtk2_ardour/route_params_ui.cc | 10 +- gtk2_ardour/route_ui.cc | 2 +- gtk2_ardour/vst_pluginui.cc | 6 + 18 files changed, 929 insertions(+), 561 deletions(-) delete mode 100644 gtk2_ardour/au_pluginui.cc create mode 100644 gtk2_ardour/au_pluginui.mm rename gtk2_ardour/{ladspa_pluginui.cc => generic_pluginui.cc} (84%) diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index a6c94a3172..ce9e938f8d 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -84,7 +84,7 @@ connection_editor.cc """) audiounit_files=Split(""" -au_pluginui.cc +au_pluginui.mm """) gtkosx_files=Split(""" @@ -161,6 +161,7 @@ export_region_dialog.cc export_range_markers_dialog.cc gain_automation_time_axis.cc gain_meter.cc +generic_pluginui.cc ghostregion.cc gtk-custom-hruler.c gtk-custom-ruler.c @@ -173,7 +174,6 @@ imageframe_view.cc io_selector.cc keyboard.cc keyeditor.cc -ladspa_pluginui.cc level_meter.cc location_ui.cc main.cc @@ -272,6 +272,8 @@ if env['VST']: if gtkardour['GTKOSX']: extra_sources += gtkosx_files gtkardour.Append (CCFLAGS="-DTOP_MENUBAR -DGTKOSX") + gtkardour.Append (LINKFLAGS=" -framework AppKit -framework CoreAudioKit") + else: extra_sources += x11_files diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 338eae4af4..c808b500b4 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -2017,12 +2018,23 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e int response = Gtk::RESPONSE_NONE; + Glib::ustring dir = Glib::path_get_dirname (string (predetermined_path)); + Glib::ustring name = basename_nosuffix (string (predetermined_path)); + new_session_dialog->set_modal(true); - new_session_dialog->set_name (predetermined_path); + + if (name.length()) { + new_session_dialog->set_session_name (name); + } + if (dir.length()) { + new_session_dialog->set_session_folder (dir); + } new_session_dialog->reset_recent(); new_session_dialog->set_position (WIN_POS_CENTER); new_session_dialog->set_current_page (0); + cerr << "NSD with " << predetermined_path << endl; + do { new_session_dialog->set_have_engine (have_engine); diff --git a/gtk2_ardour/au_pluginui.cc b/gtk2_ardour/au_pluginui.cc deleted file mode 100644 index ce8771bc94..0000000000 --- a/gtk2_ardour/au_pluginui.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2006 Paul Davis - Written by Taybin Rutkin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include - -#include - -#include "au_pluginui.h" -#include "gui_thread.h" - -#include -#include - -#include - -#include "i18n.h" - -using namespace ARDOUR; -using namespace PBD; - -AUPluginUI::AUPluginUI (boost::shared_ptr insert) -{ - if ((au = boost::dynamic_pointer_cast (insert->plugin())) == 0) { - error << _("unknown type of editor-supplying plugin (note: no AudioUnit support in this version of ardour)") << endmsg; - throw failed_constructor (); - } - - info << "AUPluginUI created" << endmsg; -} - -AUPluginUI::~AUPluginUI () -{ - // nothing to do here - plugin destructor destroys the GUI -} - diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index f52605217a..f6f995fe92 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -1,44 +1,72 @@ -/* - Copyright (C) 2006 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __au_plugin_ui_h__ -#define __au_plugin_ui_h__ - -#include +#ifndef __gtk2_ardour_auplugin_ui_h__ +#define __gtk2_ardour_auplugin_ui_h__ +#include #include #include +/* fix up stupid apple macros */ + +#undef check +#undef require +#undef verify + +#include +#include "plugin_ui.h" + namespace ARDOUR { class AUPlugin; class PluginInsert; class Redirect; } -class AUPluginUI +class AUPluginUI : public PlugUIBase, public Gtk::VBox { public: AUPluginUI (boost::shared_ptr); ~AUPluginUI (); + gint get_preferred_height () { return prefheight; } + gint get_preferred_width () { return prefwidth; } + bool start_updating(GdkEventAny*); + bool stop_updating(GdkEventAny*); + + void on_realize (); + void on_show (); + + OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event); + private: boost::shared_ptr au; + int prefheight; + int prefwidth; + + /* Cocoa */ + + NSWindow* cocoa_window; + NSScrollView* scroll_view; + + /* Carbon */ + + NSWindow* cocoa_parent; + ComponentDescription carbon_descriptor; + AudioUnitCarbonView editView; + WindowRef carbon_window; + EventHandlerRef carbon_event_handler; + bool carbon_parented; + bool cocoa_parented; + + void test_view_support (bool&, bool&); + bool test_cocoa_view_support (); + bool test_carbon_view_support (); + int create_carbon_view (bool generic); + int create_cocoa_view (); + + int parent_carbon_window (); + int parent_cocoa_window (); + NSWindow* get_nswindow(); + + bool plugin_class_valid (Class pluginClass); }; -#endif // __au_plugin_ui_h__ +#endif /* __gtk2_ardour_auplugin_ui_h__ */ diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm new file mode 100644 index 0000000000..e1d7302b60 --- /dev/null +++ b/gtk2_ardour/au_pluginui.mm @@ -0,0 +1,496 @@ +#include +#include +#include + +#include + +#include "au_pluginui.h" +#include "gui_thread.h" + +#include +#include + +#import +#import + +#include "i18n.h" + +using namespace ARDOUR; +using namespace Gtk; +using namespace sigc; +using namespace std; +using namespace PBD; + +static const float kOffsetForAUView_X = 220; +static const float kOffsetForAUView_Y = 90; + +AUPluginUI::AUPluginUI (boost::shared_ptr insert) + : PlugUIBase (insert) +{ + if ((au = boost::dynamic_pointer_cast (insert->plugin())) == 0) { + error << _("unknown type of editor-supplying plugin (note: no AudioUnit support in this version of ardour)") << endmsg; + throw failed_constructor (); + } + + bool has_carbon; + bool has_cocoa; + + carbon_parented = false; + cocoa_parented = false; + cocoa_parent = 0; + cocoa_window = 0; + + test_view_support (has_carbon, has_cocoa); + + cerr << "plugin has carbon ? " << has_carbon << " cocoa ? " << has_cocoa << endl; + + if (has_cocoa) { + create_cocoa_view (); + } else { + create_carbon_view (has_carbon); + } +} + + +AUPluginUI::~AUPluginUI () +{ + if (carbon_parented) { + NSWindow* win = get_nswindow(); + RemoveEventHandler(carbon_event_handler); + [win removeChildWindow:cocoa_parent]; + } +} + +void +AUPluginUI::test_view_support (bool& has_carbon, bool& has_cocoa) +{ + has_carbon = test_carbon_view_support(); + has_cocoa = test_cocoa_view_support(); +} + +bool +AUPluginUI::test_carbon_view_support () +{ + bool ret = true; // there is always the generic GUI + + carbon_descriptor.componentType = kAudioUnitCarbonViewComponentType; + carbon_descriptor.componentSubType = 'gnrc'; + carbon_descriptor.componentManufacturer = 'appl'; + carbon_descriptor.componentFlags = 0; + carbon_descriptor.componentFlagsMask = 0; + + OSStatus err; + + // ask the AU for its first editor component + UInt32 propertySize; + err = AudioUnitGetPropertyInfo(*au->get_au(), kAudioUnitProperty_GetUIComponentList, kAudioUnitScope_Global, 0, &propertySize, NULL); + if (!err) { + int nEditors = propertySize / sizeof(ComponentDescription); + ComponentDescription *editors = new ComponentDescription[nEditors]; + err = AudioUnitGetProperty(*au->get_au(), kAudioUnitProperty_GetUIComponentList, kAudioUnitScope_Global, 0, editors, &propertySize); + if (!err) { + // just pick the first one for now + carbon_descriptor = editors[0]; + ret = true; + } + delete[] editors; + } + + return ret; +} + +bool +AUPluginUI::test_cocoa_view_support () +{ + UInt32 dataSize = 0; + Boolean isWritable = 0; + OSStatus err = AudioUnitGetPropertyInfo(*au->get_au(), + kAudioUnitProperty_CocoaUI, kAudioUnitScope_Global, + 0, &dataSize, &isWritable); + + return dataSize > 0 && err == noErr; +} + +bool +AUPluginUI::plugin_class_valid (Class pluginClass) +{ + if([pluginClass conformsToProtocol: @protocol(AUCocoaUIBase)]) { + if([pluginClass instancesRespondToSelector: @selector(interfaceVersion)] && + [pluginClass instancesRespondToSelector: @selector(uiViewForAudioUnit:withSize:)]) { + return true; + } + } + return false; +} + +int +AUPluginUI::create_cocoa_view () +{ + NSView *AUView = nil; + BOOL wasAbleToLoadCustomView = NO; + AudioUnitCocoaViewInfo* cocoaViewInfo = NULL; + UInt32 numberOfClasses = 0; + UInt32 dataSize; + Boolean isWritable; + NSString* factoryClassName = 0; + NSURL* CocoaViewBundlePath; + + OSStatus result = AudioUnitGetPropertyInfo (*au->get_au(), + kAudioUnitProperty_CocoaUI, + kAudioUnitScope_Global, + 0, + &dataSize, + &isWritable ); + + + if (result != noErr) { + return -1; + } + + numberOfClasses = (dataSize - sizeof(CFURLRef)) / sizeof(CFStringRef); + + // Does view have custom Cocoa UI? + + if ((result == noErr) && (numberOfClasses > 0) ) { + cocoaViewInfo = (AudioUnitCocoaViewInfo *)malloc(dataSize); + if(AudioUnitGetProperty(*au->get_au(), + kAudioUnitProperty_CocoaUI, + kAudioUnitScope_Global, + 0, + cocoaViewInfo, + &dataSize) == noErr) { + + CocoaViewBundlePath = (NSURL *)cocoaViewInfo->mCocoaAUViewBundleLocation; + + // we only take the first view in this example. + factoryClassName = (NSString *)cocoaViewInfo->mCocoaAUViewClass[0]; + + } else { + + if (cocoaViewInfo != NULL) { + free (cocoaViewInfo); + cocoaViewInfo = NULL; + } + } + } + + cocoa_window = [NSWindow alloc]; + + NSRect frameRect = [[cocoa_window contentView] frame]; + scroll_view = [[[NSScrollView alloc] initWithFrame:frameRect] autorelease]; + [scroll_view setDrawsBackground:NO]; + [scroll_view setHasHorizontalScroller:YES]; + [scroll_view setHasVerticalScroller:YES]; + + [cocoa_window setContentView:scroll_view]; + + // [A] Show custom UI if view has it + + if (CocoaViewBundlePath && factoryClassName) { + NSBundle *viewBundle = [NSBundle bundleWithPath:[CocoaViewBundlePath path]]; + if (viewBundle == nil) { + error << _("AUPluginUI: error loading AU view's bundle") << endmsg; + return -1; + } else { + Class factoryClass = [viewBundle classNamed:factoryClassName]; + if (!factoryClass) { + error << _("AUPluginUI: error getting AU view's factory class from bundle") << endmsg; + return -1; + } + + // make sure 'factoryClass' implements the AUCocoaUIBase protocol + if (!plugin_class_valid (factoryClass)) { + error << _("AUPluginUI: U view's factory class does not properly implement the AUCocoaUIBase protocol") << endmsg; + return -1; + } + // make a factory + id factoryInstance = [[[factoryClass alloc] init] autorelease]; + if (factoryInstance == nil) { + error << _("AUPluginUI: Could not create an instance of the AU view factory") << endmsg; + return -1; + } + + // make a view + AUView = [factoryInstance uiViewForAudioUnit:*au->get_au() + withSize:[[scroll_view contentView] bounds].size]; + + // cleanup + [CocoaViewBundlePath release]; + if (cocoaViewInfo) { + UInt32 i; + for (i = 0; i < numberOfClasses; i++) + CFRelease(cocoaViewInfo->mCocoaAUViewClass[i]); + + free (cocoaViewInfo); + } + wasAbleToLoadCustomView = YES; + } + } + + if (!wasAbleToLoadCustomView) { + // [B] Otherwise show generic Cocoa view + AUView = [[AUGenericView alloc] initWithAudioUnit:*au->get_au()]; + [(AUGenericView *)AUView setShowsExpertParameters:YES]; + } + + // Display view + NSRect viewFrame = [AUView frame]; + NSSize frameSize = [NSScrollView frameSizeForContentSize:viewFrame.size + hasHorizontalScroller:[scroll_view hasHorizontalScroller] + hasVerticalScroller:[scroll_view hasVerticalScroller] + borderType:[scroll_view borderType]]; + + + NSRect newFrame; + newFrame.origin = [scroll_view frame].origin; + newFrame.size = frameSize; + + NSRect currentFrame = [scroll_view frame]; + [scroll_view setFrame:newFrame]; + [scroll_view setDocumentView:AUView]; + + NSSize oldContentSize = [[cocoa_window contentView] frame].size; + NSSize newContentSize = oldContentSize; + newContentSize.width += (newFrame.size.width - currentFrame.size.width); + newContentSize.height += (newFrame.size.height - currentFrame.size.height); + + [cocoa_window setContentSize:newContentSize]; + + return 0; +} + +int +AUPluginUI::create_carbon_view (bool generic) +{ + OSStatus err; + ControlRef root_control; + + Component editComponent = FindNextComponent(NULL, &carbon_descriptor); + + OpenAComponent(editComponent, &editView); + if (!editView) { + error << _("AU Carbon view: cannot open AU Component") << endmsg; + return -1; + } + + Rect r = { 100, 100, 100, 100 }; + WindowAttributes attr = WindowAttributes (kWindowStandardHandlerAttribute | + kWindowCompositingAttribute| + kWindowNoShadowAttribute| + kWindowNoTitleBarAttribute); + + if ((err = CreateNewWindow(kFloatingWindowClass, attr, &r, &carbon_window)) != noErr) { + error << string_compose (_("AUPluginUI: cannot create carbon window (err: %1)"), err) << endmsg; + return -1; + } + + if ((err = GetRootControl(carbon_window, &root_control)) != noErr) { + error << string_compose (_("AUPlugin: cannot get root control of carbon window (err: %1)"), err) << endmsg; + return -1; + } + + ControlRef viewPane; + Float32Point location = { 0.0, 0.0 }; + Float32Point size = { 0.0, 0.0 } ; + + if ((err = AudioUnitCarbonViewCreate (editView, *au->get_au(), carbon_window, root_control, &location, &size, &viewPane)) != noErr) { + error << string_compose (_("AUPluginUI: cannot create carbon plugin view (err: %1)"), err) << endmsg; + return -1; + } + + // resize window + + Rect bounds; + GetControlBounds(viewPane, &bounds); + size.x = bounds.right-bounds.left; + size.y = bounds.bottom-bounds.top; + SizeWindow(carbon_window, (short) (size.x + 0.5), (short) (size.y + 0.5), true); + + prefwidth = (int) (size.x + 0.5); + prefheight = (int) (size.y + 0.5); + +#if 0 + mViewPaneResizer->WantEventTypes (GetControlEventTarget(mAUViewPane), GetEventTypeCount(resizeEvent), resizeEvent); +#endif + return 0; +} + +NSWindow* +AUPluginUI::get_nswindow () +{ + Gtk::Container* toplevel = get_toplevel(); + + if (!toplevel || !toplevel->is_toplevel()) { + error << _("AUPluginUI: no top level window!") << endmsg; + return 0; + } + + NSWindow* true_parent = gdk_quartz_window_get_nswindow (toplevel->get_window()->gobj()); + + if (!true_parent) { + error << _("AUPluginUI: no top level window!") << endmsg; + return 0; + } + + return true_parent; +} + + +OSStatus +_carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event, void *userData) +{ + return ((AUPluginUI*)userData)->carbon_event (nextHandlerRef, event); +} + +OSStatus +AUPluginUI::carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event) +{ + UInt32 eventKind = GetEventKind(event); + ClickActivationResult howToHandleClick; + + cerr << "Carbon event for " << au->name(); + + switch (eventKind) { + case kEventWindowHandleDeactivate: + // don't allow window to get deactivated while app is active + // (do this only if you are a floating window that doesn't hide) + cerr << " deactivate!"; + ActivateWindow(carbon_window, TRUE); + break; + + case kEventWindowGetClickActivation: + cerr << " click activate!"; + howToHandleClick = kActivateAndHandleClick; + SetEventParameter(event, kEventParamClickActivation, typeClickActivationResult, + sizeof(ClickActivationResult), &howToHandleClick); + break; + } + + cerr << "\n"; + + return noErr; +} + +int +AUPluginUI::parent_carbon_window () +{ + NSWindow* win = get_nswindow (); + int x, y; + + if (!win) { + return -1; + } + + Gtk::Container* toplevel = get_toplevel(); + + if (!toplevel || !toplevel->is_toplevel()) { + error << _("AUPluginUI: no top level window!") << endmsg; + return -1; + } + + toplevel->get_window()->get_root_origin (x, y); + + /* compute how tall the title bar is, because we have to offset the position of the carbon window + by that much. + */ + + NSRect content_frame = [NSWindow contentRectForFrameRect:[win frame] styleMask:[win styleMask]]; + NSRect wm_frame = [NSWindow frameRectForContentRect:content_frame styleMask:[win styleMask]]; + + int titlebar_height = wm_frame.size.height - content_frame.size.height; + + MoveWindow (carbon_window, x, y + titlebar_height, false); + ShowWindow (carbon_window); + + // create the cocoa window for the carbon one and make it visible + cocoa_parent = [[NSWindow alloc] initWithWindowRef: carbon_window]; + + EventTypeSpec windowEventTypes[] = { + {kEventClassWindow, kEventWindowGetClickActivation }, + {kEventClassWindow, kEventWindowHandleDeactivate } + }; + + EventHandlerUPP ehUPP = NewEventHandlerUPP(_carbon_event); + OSStatus result = InstallWindowEventHandler (carbon_window, ehUPP, + sizeof(windowEventTypes) / sizeof(EventTypeSpec), + windowEventTypes, this, &carbon_event_handler); + if (result != noErr) { + return -1; + } + + [win addChildWindow:cocoa_parent ordered:NSWindowAbove]; + [win setLevel:NSFloatingWindowLevel]; + + carbon_parented = true; + + return 0; +} + +int +AUPluginUI::parent_cocoa_window () +{ + NSWindow* win = get_nswindow (); + + if (!win) { + return -1; + } + + [win addChildWindow:cocoa_window ordered:NSWindowAbove]; + [win setLevel:NSFloatingWindowLevel]; + + cocoa_parented = true; + + return 0; +} + +void +AUPluginUI::on_realize () +{ + VBox::on_realize (); + + if (cocoa_window) { + + if (parent_cocoa_window ()) { + } + + } else if (carbon_window) { + + if (parent_carbon_window ()) { + // ShowWindow (carbon_window); + } + } +} + +void +AUPluginUI::on_show () +{ + cerr << "AU plugin window shown\n"; + + VBox::on_show (); + + if (cocoa_window) { + // [cocoa_window setIsVisible:YES]; + } else if (carbon_window) { + // [cocoa_parent setIsVisible:YES]; + } +} + +bool +AUPluginUI::start_updating (GdkEventAny* any) +{ + return false; +} + +bool +AUPluginUI::stop_updating (GdkEventAny* any) +{ + return false; +} + +PlugUIBase* +create_au_gui (boost::shared_ptr plugin_insert, VBox** box) +{ + AUPluginUI* aup = new AUPluginUI (plugin_insert); + (*box) = aup; + return aup; +} diff --git a/gtk2_ardour/cocoacarbon.cc b/gtk2_ardour/cocoacarbon.cc index 04376cf30d..4ab3992d12 100644 --- a/gtk2_ardour/cocoacarbon.cc +++ b/gtk2_ardour/cocoacarbon.cc @@ -23,6 +23,9 @@ #include "actions.h" #include "sync-menu.h" +sigc::signal ApplicationActivationChanged; +static EventHandlerRef application_event_handler_ref; + /* Called for clicks on the dock icon. Can be used to unminimize or * create a new window for example. */ @@ -47,6 +50,27 @@ handle_quit_application (const AppleEvent *inAppleEvent, return noErr; } +static OSStatus +application_event_handler (EventHandlerCallRef nextHandlerRef, EventRef event, void *userData) +{ + UInt32 eventKind = GetEventKind (event); + + switch (eventKind) { + case kEventAppActivated: + ApplicationActivationChanged (true); // EMIT SIGNAL + return eventNotHandledErr; + + case kEventAppDeactivated: + ApplicationActivationChanged (false); // EMIT SIGNAL + return eventNotHandledErr; + + default: + // pass-thru all kEventClassApplication events we're not interested in. + break; + } + return eventNotHandledErr; +} + void ARDOUR_UI::platform_specific () { @@ -71,5 +95,16 @@ ARDOUR_UI::platform_specific () if (widget) { ige_mac_menu_add_app_menu_item (group, (GtkMenuItem*) widget->gobj(), 0); } + + EventTypeSpec applicationEventTypes[] = { + {kEventClassApplication, kEventAppActivated }, + {kEventClassApplication, kEventAppDeactivated } + }; + + EventHandlerUPP ehUPP = NewEventHandlerUPP (application_event_handler); + + InstallApplicationEventHandler (ehUPP, sizeof(applicationEventTypes) / sizeof(EventTypeSpec), + applicationEventTypes, 0, &application_event_handler_ref); } + diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc index b87c80b38e..0a8deee0dd 100644 --- a/gtk2_ardour/editor_timefx.cc +++ b/gtk2_ardour/editor_timefx.cc @@ -255,11 +255,14 @@ Editor::do_timefx (TimeFXDialog& dialog) Track* t; boost::shared_ptr playlist; boost::shared_ptr new_region; + bool in_command = false; for (RegionSelection::iterator i = dialog.regions.begin(); i != dialog.regions.end(); ) { AudioRegionView* arv = dynamic_cast(*i); - if (!arv) + + if (!arv) { continue; + } boost::shared_ptr region (arv->audio_region()); TimeAxisView* tv = &(arv->get_time_axis_view()); @@ -308,6 +311,11 @@ Editor::do_timefx (TimeFXDialog& dialog) if (!fx->results.empty()) { new_region = fx->results.front(); + if (!in_command) { + begin_reversible_command (dialog.pitching ? _("pitch shift") : _("time stretch")); + in_command = true; + } + XMLNode &before = playlist->get_state(); playlist->replace_region (region, new_region, region->position()); XMLNode &after = playlist->get_state(); @@ -318,6 +326,10 @@ Editor::do_timefx (TimeFXDialog& dialog) delete fx; } + if (in_command) { + commit_reversible_command (); + } + dialog.status = 0; dialog.request.done = true; } diff --git a/gtk2_ardour/ladspa_pluginui.cc b/gtk2_ardour/generic_pluginui.cc similarity index 84% rename from gtk2_ardour/ladspa_pluginui.cc rename to gtk2_ardour/generic_pluginui.cc index 10377d4421..e3be1cc266 100644 --- a/gtk2_ardour/ladspa_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -56,7 +56,7 @@ using namespace Gtkmm2ext; using namespace Gtk; using namespace sigc; -LadspaPluginUI::LadspaPluginUI (boost::shared_ptr pi, bool scrollable) +GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrollable) : PlugUIBase (pi), button_table (initial_button_rows, initial_button_cols), output_table (initial_output_rows, initial_output_cols), @@ -103,13 +103,13 @@ LadspaPluginUI::LadspaPluginUI (boost::shared_ptr pi, bool scrolla pack_start (hpacker, false, false); } - insert->active_changed.connect (mem_fun(*this, &LadspaPluginUI::redirect_active_changed)); + insert->active_changed.connect (mem_fun(*this, &GenericPluginUI::redirect_active_changed)); bypass_button.set_active (!insert->active()); build (); } -LadspaPluginUI::~LadspaPluginUI () +GenericPluginUI::~GenericPluginUI () { if (output_controls.size() > 0) { screen_update_connection.disconnect(); @@ -117,7 +117,7 @@ LadspaPluginUI::~LadspaPluginUI () } void -LadspaPluginUI::build () +GenericPluginUI::build () { guint32 i = 0; @@ -288,7 +288,7 @@ LadspaPluginUI::build () button_table.show_all (); } -LadspaPluginUI::ControlUI::ControlUI () +GenericPluginUI::ControlUI::ControlUI () : automate_button (X_("")) // force creation of a label { automate_button.set_name ("PluginAutomateButton"); @@ -310,7 +310,7 @@ LadspaPluginUI::ControlUI::ControlUI () meterinfo = 0; } -LadspaPluginUI::ControlUI::~ControlUI() +GenericPluginUI::ControlUI::~ControlUI() { if (adjustment) { delete adjustment; @@ -323,7 +323,7 @@ LadspaPluginUI::ControlUI::~ControlUI() } void -LadspaPluginUI::automation_state_changed (ControlUI* cui) +GenericPluginUI::automation_state_changed (ControlUI* cui) { /* update button label */ @@ -353,13 +353,13 @@ static void integer_printer (char buf[32], Adjustment &adj, void *arg) } void -LadspaPluginUI::print_parameter (char *buf, uint32_t len, uint32_t param) +GenericPluginUI::print_parameter (char *buf, uint32_t len, uint32_t param) { plugin->print_parameter (param, buf, len); } -LadspaPluginUI::ControlUI* -LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontrol) +GenericPluginUI::ControlUI* +GenericPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontrol) { ControlUI* control_ui; @@ -386,16 +386,19 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro boost::shared_ptr lp; if ((lp = boost::dynamic_pointer_cast(plugin)) != 0) { - - lrdf_defaults* defaults = lrdf_get_scale_values(lp->unique_id(), port_index); + + // all LADPSA plugins have a numeric unique ID + uint32_t id = atol (lp->unique_id().c_str()); + + lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index); if (defaults && defaults->count > 0) { control_ui->combo = new Gtk::ComboBoxText; //control_ui->combo->set_value_in_list(true, false); set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); - control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &LadspaPluginUI::control_combo_changed), control_ui)); - plugin->ParameterChanged.connect (bind (mem_fun (*this, &LadspaPluginUI::parameter_changed), control_ui)); + control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui)); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); @@ -418,7 +421,7 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro control_ui->pack_start (*control_ui->button, false, true); control_ui->pack_start (control_ui->automate_button, false, false); - control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &LadspaPluginUI::control_port_toggled), control_ui)); + control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::control_port_toggled), control_ui)); if(plugin->get_parameter (port_index) == 1){ control_ui->button->set_active(true); @@ -456,7 +459,7 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->clickbox, "g9999999", 2, 2); control_ui->clickbox->set_print_func (integer_printer, 0); } else { - sigc::slot pslot = sigc::bind (mem_fun(*this, &LadspaPluginUI::print_parameter), (uint32_t) port_index); + sigc::slot pslot = sigc::bind (mem_fun(*this, &GenericPluginUI::print_parameter), (uint32_t) port_index); control_ui->control = new BarController (*control_ui->adjustment, *mcontrol, pslot); control_ui->control->set_size_request (200, req.height); @@ -464,8 +467,8 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro control_ui->control->set_style (BarController::LeftToRight); control_ui->control->set_use_parent (true); - control_ui->control->StartGesture.connect (bind (mem_fun(*this, &LadspaPluginUI::start_touch), control_ui)); - control_ui->control->StopGesture.connect (bind (mem_fun(*this, &LadspaPluginUI::stop_touch), control_ui)); + control_ui->control->StartGesture.connect (bind (mem_fun(*this, &GenericPluginUI::start_touch), control_ui)); + control_ui->control->StopGesture.connect (bind (mem_fun(*this, &GenericPluginUI::stop_touch), control_ui)); } @@ -488,14 +491,14 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro } control_ui->pack_start (control_ui->automate_button, false, false); - control_ui->adjustment->signal_value_changed().connect (bind (mem_fun(*this, &LadspaPluginUI::control_adjustment_changed), control_ui)); - control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &LadspaPluginUI::astate_clicked), control_ui, (uint32_t) port_index)); + control_ui->adjustment->signal_value_changed().connect (bind (mem_fun(*this, &GenericPluginUI::control_adjustment_changed), control_ui)); + control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::astate_clicked), control_ui, (uint32_t) port_index)); automation_state_changed (control_ui); - plugin->ParameterChanged.connect (bind (mem_fun(*this, &LadspaPluginUI::parameter_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun(*this, &GenericPluginUI::parameter_changed), control_ui)); insert->automation_list (port_index).automation_state_changed.connect - (bind (mem_fun(*this, &LadspaPluginUI::automation_state_changed), control_ui)); + (bind (mem_fun(*this, &GenericPluginUI::automation_state_changed), control_ui)); } else if (plugin->parameter_is_output (port_index)) { @@ -517,7 +520,7 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro MeterInfo * info = new MeterInfo(port_index); control_ui->meterinfo = info; - info->meter = new FastMeter (5, 5, FastMeter::Vertical); + info->meter = new FastMeter (5, 100, FastMeter::Vertical); info->min_unbound = desc.min_unbound; info->max_unbound = desc.max_unbound; @@ -544,24 +547,24 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro output_controls.push_back (control_ui); } - plugin->ParameterChanged.connect (bind (mem_fun(*this, &LadspaPluginUI::parameter_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun(*this, &GenericPluginUI::parameter_changed), control_ui)); return control_ui; } void -LadspaPluginUI::start_touch (LadspaPluginUI::ControlUI* cui) +GenericPluginUI::start_touch (GenericPluginUI::ControlUI* cui) { insert->automation_list (cui->port_index).start_touch (); } void -LadspaPluginUI::stop_touch (LadspaPluginUI::ControlUI* cui) +GenericPluginUI::stop_touch (GenericPluginUI::ControlUI* cui) { insert->automation_list (cui->port_index).stop_touch (); } void -LadspaPluginUI::astate_clicked (ControlUI* cui, uint32_t port) +GenericPluginUI::astate_clicked (ControlUI* cui, uint32_t port) { using namespace Menu_Helpers; @@ -574,25 +577,25 @@ LadspaPluginUI::astate_clicked (ControlUI* cui, uint32_t port) items.clear (); items.push_back (MenuElem (_("Manual"), - bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Off, cui))); + bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Off, cui))); items.push_back (MenuElem (_("Play"), - bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Play, cui))); + bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Play, cui))); items.push_back (MenuElem (_("Write"), - bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Write, cui))); + bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Write, cui))); items.push_back (MenuElem (_("Touch"), - bind (mem_fun(*this, &LadspaPluginUI::set_automation_state), (AutoState) Touch, cui))); + bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Touch, cui))); automation_menu->popup (1, gtk_get_current_event_time()); } void -LadspaPluginUI::set_automation_state (AutoState state, ControlUI* cui) +GenericPluginUI::set_automation_state (AutoState state, ControlUI* cui) { insert->set_port_automation_state (cui->port_index, state); } void -LadspaPluginUI::control_adjustment_changed (ControlUI* cui) +GenericPluginUI::control_adjustment_changed (ControlUI* cui) { if (cui->ignore_change) { return; @@ -608,18 +611,18 @@ LadspaPluginUI::control_adjustment_changed (ControlUI* cui) } void -LadspaPluginUI::parameter_changed (uint32_t abs_port_id, float val, ControlUI* cui) +GenericPluginUI::parameter_changed (uint32_t abs_port_id, float val, ControlUI* cui) { if (cui->port_index == abs_port_id) { if (!cui->update_pending) { cui->update_pending = true; - Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &LadspaPluginUI::update_control_display), cui)); + Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &GenericPluginUI::update_control_display), cui)); } } } void -LadspaPluginUI::update_control_display (ControlUI* cui) +GenericPluginUI::update_control_display (ControlUI* cui) { /* XXX how do we handle logarithmic stuff here ? */ @@ -656,7 +659,7 @@ LadspaPluginUI::update_control_display (ControlUI* cui) } void -LadspaPluginUI::control_port_toggled (ControlUI* cui) +GenericPluginUI::control_port_toggled (ControlUI* cui) { if (!cui->ignore_change) { insert->set_parameter (cui->port_index, cui->button->get_active()); @@ -664,7 +667,7 @@ LadspaPluginUI::control_port_toggled (ControlUI* cui) } void -LadspaPluginUI::control_combo_changed (ControlUI* cui) +GenericPluginUI::control_combo_changed (ControlUI* cui) { if (!cui->ignore_change) { string value = cui->combo->get_active_text(); @@ -675,26 +678,26 @@ LadspaPluginUI::control_combo_changed (ControlUI* cui) } void -LadspaPluginUI::redirect_active_changed (Redirect* r, void* src) +GenericPluginUI::redirect_active_changed (Redirect* r, void* src) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &LadspaPluginUI::redirect_active_changed), r, src)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &GenericPluginUI::redirect_active_changed), r, src)); bypass_button.set_active (!r->active()); } bool -LadspaPluginUI::start_updating (GdkEventAny* ignored) +GenericPluginUI::start_updating (GdkEventAny* ignored) { if (output_controls.size() > 0 ) { screen_update_connection.disconnect(); screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect - (mem_fun(*this, &LadspaPluginUI::output_update)); + (mem_fun(*this, &GenericPluginUI::output_update)); } return false; } bool -LadspaPluginUI::stop_updating (GdkEventAny* ignored) +GenericPluginUI::stop_updating (GdkEventAny* ignored) { if (output_controls.size() > 0 ) { screen_update_connection.disconnect(); @@ -703,7 +706,7 @@ LadspaPluginUI::stop_updating (GdkEventAny* ignored) } void -LadspaPluginUI::output_update () +GenericPluginUI::output_update () { for (vector::iterator i = output_controls.begin(); i != output_controls.end(); ++i) { float val = plugin->get_parameter ((*i)->port_index); @@ -737,13 +740,20 @@ LadspaPluginUI::output_update () } vector -LadspaPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) +GenericPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) { vector enums; boost::shared_ptr lp = boost::dynamic_pointer_cast (plugin); + if (!lp) { + return enums; + } + + // all LADPSA plugins have a numeric unique ID + uint32_t id = atol (lp->unique_id().c_str()); + cui->combo_map = new std::map; - lrdf_defaults* defaults = lrdf_get_scale_values(lp->unique_id(), port_index); + lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index); if (defaults) { for (uint32_t i = 0; i < defaults->count; ++i) { enums.push_back(defaults->items[i].label); diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index 2ea5074de7..cc81eddb19 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -195,7 +195,7 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) if (find (state.begin(), state.end(), keyval) == state.end()) { state.push_back (keyval); sort (state.begin(), state.end()); - } + } } else if (event->type == GDK_KEY_RELEASE) { diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc index e5b289a067..1ae412af41 100644 --- a/gtk2_ardour/new_session_dialog.cc +++ b/gtk2_ardour/new_session_dialog.cc @@ -464,15 +464,15 @@ NewSessionDialog::set_have_engine (bool yn) } void -NewSessionDialog::set_session_name(const Glib::ustring& name) +NewSessionDialog::set_session_name (const Glib::ustring& name) { - m_name->set_text(name); + m_name->set_text (name); } void NewSessionDialog::set_session_folder(const Glib::ustring& dir) { - // XXX DO SOMETHING + m_folder->set_current_folder (dir); } std::string diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 6a2b334013..c48a5b775e 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -65,20 +65,20 @@ PluginSelector::PluginSelector (PluginManager *mgr) manager = mgr; session = 0; - current_selection = ARDOUR::LADSPA; - - lmodel = Gtk::ListStore::create(lcols); - ladspa_display.set_model (lmodel); - ladspa_display.append_column (_("Available LADSPA Plugins"), lcols.name); - ladspa_display.append_column (_("Type"), lcols.type); - ladspa_display.append_column (_("# Inputs"),lcols.ins); - ladspa_display.append_column (_("# Outputs"), lcols.outs); - ladspa_display.set_headers_visible (true); - ladspa_display.set_headers_clickable (true); - ladspa_display.set_reorderable (false); - lscroller.set_border_width(10); - lscroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - lscroller.add(ladspa_display); + plugin_model = Gtk::ListStore::create (plugin_columns); + plugin_display.set_model (plugin_model); + plugin_display.append_column (_("Available Plugins"), plugin_columns.name); + plugin_display.append_column (_("Type"), plugin_columns.type_name); + plugin_display.append_column (_("Category"), plugin_columns.category); + plugin_display.append_column (_("Creator"), plugin_columns.creator); + plugin_display.append_column (_("# Inputs"),plugin_columns.ins); + plugin_display.append_column (_("# Outputs"), plugin_columns.outs); + plugin_display.set_headers_visible (true); + plugin_display.set_headers_clickable (true); + plugin_display.set_reorderable (false); + scroller.set_border_width(10); + scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scroller.add(plugin_display); amodel = Gtk::ListStore::create(acols); added_list.set_model (amodel); @@ -87,48 +87,10 @@ PluginSelector::PluginSelector (PluginManager *mgr) added_list.set_reorderable (false); for (int i = 0; i <=3; i++) { - Gtk::TreeView::Column* column = ladspa_display.get_column(i); + Gtk::TreeView::Column* column = plugin_display.get_column(i); column->set_sort_column(i); } -#ifdef VST_SUPPORT - vmodel = ListStore::create(vcols); - vst_display.set_model (vmodel); - vst_display.append_column (_("Available plugins"), vcols.name); - vst_display.append_column (_("# Inputs"), vcols.ins); - vst_display.append_column (_("# Outputs"), vcols.outs); - vst_display.set_headers_visible (true); - vst_display.set_headers_clickable (true); - vst_display.set_reorderable (false); - vscroller.set_border_width(10); - vscroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - vscroller.add(vst_display); - - for (int i = 0; i <=2; i++) { - Gtk::TreeView::Column* column = vst_display.get_column(i); - column->set_sort_column(i); - } -#endif - -#ifdef HAVE_AUDIOUNIT - aumodel = ListStore::create(aucols); - au_display.set_model (aumodel); - au_display.append_column (_("Available plugins"), aucols.name); - au_display.append_column (_("# Inputs"), aucols.ins); - au_display.append_column (_("# Outputs"), aucols.outs); - au_display.set_headers_visible (true); - au_display.set_headers_clickable (true); - au_display.set_reorderable (false); - auscroller.set_border_width(10); - auscroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - auscroller.add(au_display); - - for (int i = 0; i <=2; i++) { - Gtk::TreeView::Column* column = au_display.get_column(i); - column->set_sort_column(i); - } -#endif - ascroller.set_border_width(10); ascroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); ascroller.add(added_list); @@ -146,7 +108,7 @@ PluginSelector::PluginSelector (PluginManager *mgr) Gtk::Table* table = manage(new Gtk::Table(7, 11)); table->set_size_request(750, 500); - table->attach(notebook, 0, 7, 0, 5); + table->attach(scroller, 0, 7, 0, 5); HBox* filter_box = manage (new HBox); @@ -176,98 +138,26 @@ PluginSelector::PluginSelector (PluginManager *mgr) table->attach(ascroller, 0, 7, 8, 10); add_button (Stock::CANCEL, RESPONSE_CANCEL); - add_button (Stock::CONNECT, RESPONSE_APPLY); + add_button (_("Insert Plugin(s)"), RESPONSE_APPLY); set_default_response (RESPONSE_APPLY); set_response_sensitive (RESPONSE_APPLY, false); get_vbox()->pack_start (*table); - - // Notebook tab order must be the same in here as in set_correct_focus() - using namespace Notebook_Helpers; - notebook.pages().push_back (TabElem (lscroller, _("LADSPA"))); - -#ifdef VST_SUPPORT - if (Config->get_use_vst()) { - notebook.pages().push_back (TabElem (vscroller, _("VST"))); - } -#endif - -#ifdef HAVE_AUDIOUNIT - notebook.pages().push_back (TabElem (auscroller, _("AudioUnit"))); -#endif - table->set_name("PluginSelectorTable"); - ladspa_display.set_name("PluginSelectorDisplay"); - //ladspa_display.set_name("PluginSelectorList"); + plugin_display.set_name("PluginSelectorDisplay"); + //plugin_display.set_name("PluginSelectorList"); added_list.set_name("PluginSelectorList"); - ladspa_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked)); - ladspa_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::ladspa_display_selection_changed)); - ladspa_display.grab_focus(); + plugin_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked)); + plugin_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::display_selection_changed)); + plugin_display.grab_focus(); -#ifdef VST_SUPPORT - if (Config->get_use_vst()) { - vst_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked)); - vst_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::vst_display_selection_changed)); - } -#endif - -#ifdef HAVE_AUDIOUNIT - au_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked)); - au_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::au_display_selection_changed)); -#endif - btn_update->signal_clicked().connect (mem_fun(*this, &PluginSelector::btn_update_clicked)); btn_add->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_add_clicked)); btn_remove->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_remove_clicked)); added_list.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::added_list_selection_changed)); - ladspa_refiller (); - -#ifdef VST_SUPPORT - vst_refiller (); -#endif - -#ifdef HAVE_AUDIOUNIT - au_refiller (); -#endif - - signal_show().connect (mem_fun (*this, &PluginSelector::set_correct_focus)); -} - -/** - * Makes sure keyboard focus is always in the plugin list - * of the selected notebook tab. - **/ -void -PluginSelector::set_correct_focus() -{ - int cp = notebook.get_current_page(); - - if (cp == 0) { - ladspa_display.grab_focus(); - return; - } - -#ifdef VST_SUPPORT - if (Config->get_use_vst()) { - cp--; - - if (cp == 0) { - vst_display.grab_focus(); - return; - } - } -#endif - -#ifdef HAVE_AUDIOUNIT - cp--; - - if (cp == 0) { - au_display.grab_focus(); - return; - } -#endif + refill (); } void @@ -290,7 +180,7 @@ PluginSelector::set_session (Session* s) } bool -PluginSelector::show_this_plugin (PluginInfoPtr& info, const std::string& filterstr) +PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& filterstr) { std::string compstr; std::string mode = filter_mode.get_active_text (); @@ -328,126 +218,84 @@ PluginSelector::setup_filter_string (string& filterstr) } void -PluginSelector::ladspa_refiller () +PluginSelector::refill () { - guint row; - PluginInfoList &plugs = manager->ladspa_plugin_info (); - PluginInfoList::iterator i; - char ibuf[16], obuf[16]; - - lmodel->clear(); - std::string filterstr; + + plugin_model->clear (); + setup_filter_string (filterstr); - for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) { + ladspa_refiller (filterstr); + vst_refiller (filterstr); + au_refiller (filterstr); +} + +void +PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filterstr, const char* type) +{ + char buf[16]; + + for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) { if (show_this_plugin (*i, filterstr)) { - snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs); - snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs); - TreeModel::Row newrow = *(lmodel->append()); - newrow[lcols.name] = (*i)->name.c_str(); - newrow[lcols.type] = (*i)->category.c_str(); - newrow[lcols.ins] = ibuf; - newrow[lcols.outs] = obuf; - newrow[lcols.plugin] = *i; - } - } + TreeModel::Row newrow = *(plugin_model->append()); + newrow[plugin_columns.name] = (*i)->name; + newrow[plugin_columns.type_name] = type; + newrow[plugin_columns.category] = (*i)->category; - lmodel->set_sort_column (0, SORT_ASCENDING); + + string creator = (*i)->creator; + string::size_type pos = 0; + + /* stupid LADSPA creator strings */ + + while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; + creator = creator.substr (0, pos); + + newrow[plugin_columns.creator] = creator; + + if ((*i)->n_inputs < 0) { + newrow[plugin_columns.ins] = "various"; + } else { + snprintf (buf, sizeof(buf), "%d", (*i)->n_inputs); + newrow[plugin_columns.ins] = buf; + } + if ((*i)->n_outputs < 0) { + newrow[plugin_columns.outs] = "various"; + } else { + snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs); + newrow[plugin_columns.outs] = buf; + } + + newrow[plugin_columns.plugin] = *i; + } + } } +void +PluginSelector::ladspa_refiller (const std::string& filterstr) +{ + refiller (manager->ladspa_plugin_info(), filterstr, "LADSPA"); +} + +void +PluginSelector::vst_refiller (const std::string& filterstr) +{ #ifdef VST_SUPPORT - -void -PluginSelector::vst_refiller () -{ - guint row; - PluginInfoList &plugs = manager->vst_plugin_info (); - PluginInfoList::iterator i; - char ibuf[16], obuf[16]; - vmodel->clear(); - - std::string filterstr; - setup_filter_string (filterstr); - - for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) { - - if (show_this_plugin (*i, filterstr)) { - snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs); - snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs); - - TreeModel::Row newrow = *(vmodel->append()); - newrow[vcols.name] = (*i)->name.c_str(); - newrow[vcols.ins] = ibuf; - newrow[vcols.outs] = obuf; - newrow[vcols.plugin] = *i; - } - } - vmodel->set_sort_column (0, SORT_ASCENDING); + refiller (manager->vst_plugin_info(), filterstr, "VST"); +#endif } void -PluginSelector::vst_display_selection_changed() +PluginSelector::au_refiller (const std::string& filterstr) { - if (vst_display.get_selection()->count_selected_rows() != 0) { - btn_add->set_sensitive (true); - } else { - btn_add->set_sensitive (false); - } - - current_selection = ARDOUR::VST; +#ifdef HAVE_AUDIOUNITS + refiller (manager->au_plugin_info(), filterstr, "AU"); +#endif } -#endif //VST_SUPPORT - -#ifdef HAVE_AUDIOUNIT - -void -PluginSelector::au_refiller () -{ - guint row; - PluginInfoList plugs (AUPluginInfo::discover ()); - PluginInfoList::iterator i; - char ibuf[16], obuf[16]; - aumodel->clear(); - - std::string filterstr; - setup_filter_string (filterstr); - - for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) { - - if (show_this_plugin (*i, filterstr)) { - - snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs); - snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs); - - TreeModel::Row newrow = *(aumodel->append()); - newrow[aucols.name] = (*i)->name.c_str(); - newrow[aucols.ins] = ibuf; - newrow[aucols.outs] = obuf; - newrow[aucols.plugin] = *i; - } - } - - aumodel->set_sort_column (0, SORT_ASCENDING); -} - -void -PluginSelector::au_display_selection_changed() -{ - if (au_display.get_selection()->count_selected_rows() != 0) { - btn_add->set_sensitive (true); - } else { - btn_add->set_sensitive (false); - } - - current_selection = ARDOUR::AudioUnit; -} - -#endif //HAVE_AUDIOUNIT - void PluginSelector::use_plugin (PluginInfoPtr pi) { @@ -468,33 +316,11 @@ PluginSelector::btn_add_clicked() std::string name; PluginInfoPtr pi; TreeModel::Row newrow = *(amodel->append()); - TreeModel::Row row; - switch (current_selection) { - case ARDOUR::LADSPA: - row = *(ladspa_display.get_selection()->get_selected()); - name = row[lcols.name]; - pi = row[lcols.plugin]; - break; - case ARDOUR::VST: -#ifdef VST_SUPPORT - row = *(vst_display.get_selection()->get_selected()); - name = row[vcols.name]; - pi = row[vcols.plugin]; -#endif - break; - case ARDOUR::AudioUnit: -#ifdef HAVE_AUDIOUNIT - row = *(au_display.get_selection()->get_selected()); - name = row[aucols.name]; - pi = row[aucols.plugin]; -#endif - break; - default: - error << "Programming error. Unknown plugin selected." << endmsg; - return; - } + row = *(plugin_display.get_selection()->get_selected()); + name = row[plugin_columns.name]; + pi = row[plugin_columns.plugin]; newrow[acols.text] = name; newrow[acols.plugin] = pi; @@ -523,27 +349,13 @@ PluginSelector::btn_update_clicked() } void -PluginSelector::refill() +PluginSelector::display_selection_changed() { - ladspa_refiller (); -#ifdef VST_SUPPORT - vst_refiller (); -#endif -#ifdef HAVE_AUDIOUNIT - au_refiller (); -#endif -} - -void -PluginSelector::ladspa_display_selection_changed() -{ - if (ladspa_display.get_selection()->count_selected_rows() != 0) { + if (plugin_display.get_selection()->count_selected_rows() != 0) { btn_add->set_sensitive (true); } else { btn_add->set_sensitive (false); } - - current_selection = ARDOUR::LADSPA; } void diff --git a/gtk2_ardour/plugin_selector.h b/gtk2_ardour/plugin_selector.h index 5994e7b3ef..ac300638d7 100644 --- a/gtk2_ardour/plugin_selector.h +++ b/gtk2_ardour/plugin_selector.h @@ -44,10 +44,7 @@ class PluginSelector : public ArdourDialog private: ARDOUR::Session* session; - Gtk::Notebook notebook; - Gtk::ScrolledWindow lscroller; // ladspa - Gtk::ScrolledWindow vscroller; // vst - Gtk::ScrolledWindow auscroller; // AudioUnit + Gtk::ScrolledWindow scroller; // Available plugins Gtk::ScrolledWindow ascroller; // Added plugins Gtk::ComboBoxText filter_mode; @@ -58,27 +55,27 @@ class PluginSelector : public ArdourDialog void filter_entry_changed (); void filter_mode_changed (); - ARDOUR::PluginType current_selection; - - // page 1 - struct LadspaColumns : public Gtk::TreeModel::ColumnRecord { - LadspaColumns () { + struct PluginColumns : public Gtk::TreeModel::ColumnRecord { + PluginColumns () { add (name); - add (type); + add (type_name); + add (category); + add (creator); add (ins); add (outs); add (plugin); } - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn type; + Gtk::TreeModelColumn name; + Gtk::TreeModelColumn type_name; + Gtk::TreeModelColumn category; + Gtk::TreeModelColumn creator; Gtk::TreeModelColumn ins; Gtk::TreeModelColumn outs; - Gtk::TreeModelColumn plugin; + Gtk::TreeModelColumn plugin; }; - LadspaColumns lcols; - Glib::RefPtr lmodel; - Glib::RefPtr lselection; - Gtk::TreeView ladspa_display; + PluginColumns plugin_columns; + Glib::RefPtr plugin_model; + Gtk::TreeView plugin_display; Gtk::Button* btn_add; Gtk::Button* btn_remove; @@ -92,72 +89,27 @@ class PluginSelector : public ArdourDialog }; AddedColumns acols; Glib::RefPtr amodel; - Glib::RefPtr aselection; Gtk::TreeView added_list; -#ifdef VST_SUPPORT - // page 2 - struct VstColumns : public Gtk::TreeModel::ColumnRecord { - VstColumns () { - add (name); - add (ins); - add (outs); - add (plugin); - } - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn ins; - Gtk::TreeModelColumn outs; - Gtk::TreeModelColumn plugin; - }; - VstColumns vcols; - Glib::RefPtr vmodel; - Glib::RefPtr vselection; - Gtk::TreeView vst_display; - void vst_refiller (); - void vst_display_selection_changed(); -#endif // VST_SUPPORT - -#ifdef HAVE_AUDIOUNIT - // page 3 - struct AUColumns : public Gtk::TreeModel::ColumnRecord { - AUColumns () { - add (name); - add (ins); - add (outs); - add (plugin); - } - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn ins; - Gtk::TreeModelColumn outs; - Gtk::TreeModelColumn plugin; - }; - AUColumns aucols; - Glib::RefPtr aumodel; - Glib::RefPtr auselection; - Gtk::TreeView au_display; - void au_refiller (); - void au_display_selection_changed(); -#endif //HAVE_AUDIOUNIT + void refill (); + void refiller (const ARDOUR::PluginInfoList& plugs, const::std::string& filterstr, const char* type); + void ladspa_refiller (const std::string&); + void vst_refiller (const std::string&); + void au_refiller (const std::string&); ARDOUR::PluginManager *manager; - static void _ladspa_refiller (void *); - - void ladspa_refiller (); void row_clicked(GdkEventButton *); void btn_add_clicked(); void btn_remove_clicked(); void btn_update_clicked(); void added_list_selection_changed(); - void ladspa_display_selection_changed(); + void display_selection_changed(); void btn_apply_clicked(); void use_plugin (ARDOUR::PluginInfoPtr); void cleanup (); - void refill (); - bool show_this_plugin (ARDOUR::PluginInfoPtr&, const std::string&); + bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&); void setup_filter_string (std::string&); - - void set_correct_focus(); }; #endif // __ardour_plugin_selector_h__ diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 1f028691cb..9b2874d87d 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -42,6 +42,9 @@ #ifdef VST_SUPPORT #include #endif +#ifndef HAVE_AUDIOUNITS +#include +#endif #include @@ -64,41 +67,42 @@ using namespace sigc; PluginUIWindow::PluginUIWindow (boost::shared_ptr insert, bool scrollable) : ArdourDialog ("plugin ui") { + bool have_gui = false; + non_gtk_gui = false; + if (insert->plugin()->has_editor()) { + switch (insert->type()) { + case ARDOUR::VST: + have_gui = create_vst_editor (insert); + break; -#ifdef VST_SUPPORT + case ARDOUR::AudioUnit: + have_gui = create_audiounit_editor (insert); + break; + + case ARDOUR::LADSPA: + error << _("Eh? LADSPA plugins don't have editors!") << endmsg; + break; - boost::shared_ptr vp; - - if ((vp = boost::dynamic_pointer_cast (insert->plugin())) != 0) { - - - VSTPluginUI* vpu = new VSTPluginUI (insert, vp); - - _pluginui = vpu; - get_vbox()->add (*vpu); - vpu->package (*this); - - } else { -#endif + default: error << _("unknown type of editor-supplying plugin (note: no VST support in this version of ardour)") << endmsg; throw failed_constructor (); -#ifdef VST_SUPPORT } -#endif - } else { + } - LadspaPluginUI* pu = new LadspaPluginUI (insert, scrollable); + if (!have_gui) { + + GenericPluginUI* pu = new GenericPluginUI (insert, scrollable); _pluginui = pu; get_vbox()->add (*pu); set_wmclass (X_("ardour_plugin_editor"), "Ardour"); - signal_map_event().connect (mem_fun (*pu, &LadspaPluginUI::start_updating)); - signal_unmap_event().connect (mem_fun (*pu, &LadspaPluginUI::stop_updating)); + signal_map_event().connect (mem_fun (*pu, &GenericPluginUI::start_updating)); + signal_unmap_event().connect (mem_fun (*pu, &GenericPluginUI::stop_updating)); } set_position (Gtk::WIN_POS_MOUSE); @@ -108,21 +112,80 @@ PluginUIWindow::PluginUIWindow (boost::shared_ptr insert, bool scr signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast (this))); insert->GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away)); + gint h = _pluginui->get_preferred_height (); + gint w = _pluginui->get_preferred_width (); + if (scrollable) { - gint h = _pluginui->get_preferred_height (); if (h > 600) h = 600; - set_default_size (450, h); + if (w > 600) w = 600; + + if (w < 0) { + w = 450; + } } + set_default_size (w, h); } PluginUIWindow::~PluginUIWindow () { } +bool +PluginUIWindow::create_vst_editor(boost::shared_ptr insert) +{ +#ifndef VST_SUPPORT + return false; +#else + VSTPluginUI* vpu = new VSTPluginUI (insert, vp); + + _pluginui = vpu; + get_vbox()->add (*vpu); + vpu->package (*this); + + non_gtk_gui = true; + return true; +#endif +} + +bool +PluginUIWindow::create_audiounit_editor (boost::shared_ptr insert) +{ +#if !defined(HAVE_AUDIOUNITS) || !defined(GTKOSX) + return false; +#else + VBox* box; + _pluginui = create_au_gui (insert, &box); + get_vbox()->add (*box); + non_gtk_gui = true; + + extern sigc::signal ApplicationActivationChanged; + ApplicationActivationChanged.connect (mem_fun (*this, &PluginUIWindow::app_activated)); + + return true; +#endif +} + +void +PluginUIWindow::app_activated (bool yn) +{ +#if defined(HAVE_AUDIOUNITS) && defined(GTKOSX) + if (yn) { + ARDOUR_UI::instance()->the_editor().ensure_float (*this); + show (); + } else { + hide (); + } +#endif +} + bool PluginUIWindow::on_key_press_event (GdkEventKey* event) { + if (non_gtk_gui) { + return false; + } + if (!key_press_focus_accelerator_handler (*this, event)) { return PublicEditor::instance().on_key_press_event(event); } else { diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 2f15356c61..ad91ebb991 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -70,6 +70,7 @@ class PlugUIBase : public virtual sigc::trackable virtual ~PlugUIBase() {} virtual gint get_preferred_height () = 0; + virtual gint get_preferred_width () = 0; virtual bool start_updating(GdkEventAny*) = 0; virtual bool stop_updating(GdkEventAny*) = 0; @@ -85,14 +86,15 @@ class PlugUIBase : public virtual sigc::trackable void bypass_toggled(); }; -class LadspaPluginUI : public PlugUIBase, public Gtk::VBox +class GenericPluginUI : public PlugUIBase, public Gtk::VBox { public: - LadspaPluginUI (boost::shared_ptr plug, bool scrollable=false); - ~LadspaPluginUI (); + GenericPluginUI (boost::shared_ptr plug, bool scrollable=false); + ~GenericPluginUI (); gint get_preferred_height () { return prefheight; } - + gint get_preferred_width () { return -1; } + bool start_updating(GdkEventAny*); bool stop_updating(GdkEventAny*); @@ -206,7 +208,12 @@ class PluginUIWindow : public ArdourDialog private: PlugUIBase* _pluginui; + bool non_gtk_gui; + void app_activated (bool); void plugin_going_away (); + + bool create_vst_editor (boost::shared_ptr); + bool create_audiounit_editor (boost::shared_ptr); }; #ifdef VST_SUPPORT @@ -217,6 +224,7 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox ~VSTPluginUI (); gint get_preferred_height (); + gint get_preferred_width (); bool start_updating(GdkEventAny*) {return false;} bool stop_updating(GdkEventAny*) {return false;} @@ -233,4 +241,9 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox }; #endif // VST_SUPPORT +#ifdef HAVE_AUDIOUNITS +/* this function has to be in a .mm file */ +extern PlugUIBase* create_au_gui (boost::shared_ptr, Gtk::VBox**); +#endif + #endif /* __ardour_plugin_ui_h__ */ diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index ce137260c1..95f6b4dac8 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -65,8 +65,8 @@ #include "i18n.h" -#ifdef HAVE_AUDIOUNIT -#include "au_pluginui.h" +#ifdef HAVE_AUDIOUNITS +class AUPluginUI; #endif using namespace sigc; @@ -1077,67 +1077,47 @@ RedirectBox::edit_redirect (boost::shared_ptr redirect) } else { /* it's an insert */ + + cerr << "the plugin insert, that is\n"; boost::shared_ptr plugin_insert; boost::shared_ptr port_insert; if ((plugin_insert = boost::dynamic_pointer_cast (insert)) != 0) { - ARDOUR::PluginType type = plugin_insert->type(); - - if (type == ARDOUR::LADSPA || type == ARDOUR::VST) { - PluginUIWindow *plugin_ui; + PluginUIWindow *plugin_ui; - if (plugin_insert->get_gui() == 0) { - - plugin_ui = new PluginUIWindow (plugin_insert); - - if (_owner_is_mixer) { - ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui); - } else { - ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui); - } - - WindowTitle title(Glib::get_application_name()); - title += generate_redirect_title (plugin_insert); - plugin_ui->set_title (title.get_string()); - - plugin_insert->set_gui (plugin_ui); - - // change window title when route name is changed - _route->name_changed.connect (bind (mem_fun(*this, &RedirectBox::route_name_changed), plugin_ui, boost::weak_ptr (plugin_insert))); - + if (plugin_insert->get_gui() == 0) { + plugin_ui = new PluginUIWindow (plugin_insert); + + if (_owner_is_mixer) { + ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui); } else { - plugin_ui = reinterpret_cast (plugin_insert->get_gui()); - } - - if (plugin_ui->is_visible()) { - plugin_ui->get_window()->raise (); - } else { - plugin_ui->show_all (); - plugin_ui->present (); - } -#ifdef HAVE_AUDIOUNIT - } else if (type == ARDOUR::AudioUnit) { - AUPluginUI* plugin_ui; - if (plugin_insert->get_gui() == 0) { - plugin_ui = new AUPluginUI (plugin_insert); - } else { - plugin_ui = reinterpret_cast (plugin_insert->get_gui()); + ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui); } - if (plugin_ui->is_visible()) { - plugin_ui->get_window()->raise (); - } else { - plugin_ui->show_all (); - plugin_ui->present (); - } -#endif + WindowTitle title(Glib::get_application_name()); + title += generate_redirect_title (plugin_insert); + plugin_ui->set_title (title.get_string()); + + plugin_insert->set_gui (plugin_ui); + + // change window title when route name is changed + _route->name_changed.connect (bind (mem_fun(*this, &RedirectBox::route_name_changed), plugin_ui, boost::weak_ptr (plugin_insert))); + + } else { - warning << "Unsupported plugin sent to RedirectBox::edit_redirect()" << endmsg; - return; + plugin_ui = reinterpret_cast (plugin_insert->get_gui()); } + + if (plugin_ui->is_visible()) { + plugin_ui->get_window()->raise (); + } else { + plugin_ui->show_all (); + plugin_ui->present (); + } + } else if ((port_insert = boost::dynamic_pointer_cast (insert)) != 0) { if (!_session.engine().connected()) { diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 8d125a566d..9904359fc2 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -294,9 +294,9 @@ void RouteParams_UI::cleanup_pre_view (bool stopupdate) { if (_active_pre_view) { - LadspaPluginUI * plugui = 0; + GenericPluginUI * plugui = 0; - if (stopupdate && (plugui = dynamic_cast(_active_pre_view)) != 0) { + if (stopupdate && (plugui = dynamic_cast(_active_pre_view)) != 0) { plugui->stop_updating (0); } @@ -311,9 +311,9 @@ void RouteParams_UI::cleanup_post_view (bool stopupdate) { if (_active_post_view) { - LadspaPluginUI * plugui = 0; + GenericPluginUI * plugui = 0; - if (stopupdate && (plugui = dynamic_cast(_active_post_view)) != 0) { + if (stopupdate && (plugui = dynamic_cast(_active_post_view)) != 0) { plugui->stop_updating (0); } _post_plugin_conn.disconnect(); @@ -564,7 +564,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr redirect, if ((plugin_insert = boost::dynamic_pointer_cast (insert)) != 0) { - LadspaPluginUI *plugin_ui = new LadspaPluginUI (plugin_insert, true); + GenericPluginUI *plugin_ui = new GenericPluginUI (plugin_insert, true); if (place == PreFader) { cleanup_pre_view(); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 43745b7764..afc9089c01 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -270,7 +270,7 @@ RouteUI::solo_press(GdkEventButton* ev) } else { /* click: solo this route */ - + reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this); } } diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index 1320ccdc7a..b9c6684ebb 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -57,6 +57,12 @@ VSTPluginUI::get_preferred_height () return vst->fst()->height; } +int +VSTPluginUI::get_preferred_width () +{ + return vst->fst()->width; +} + int VSTPluginUI::package (Gtk::Window& win) {