various OS X fixes, mostly related to AU support
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 7 Jan 2008 20:41:51 +0000 (20:41 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 7 Jan 2008 20:41:51 +0000 (20:41 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2836 d708f5d6-7413-0410-9779-e7cbd77b26cf

17 files changed:
gtk2_ardour/SConscript
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/au_pluginui.h
gtk2_ardour/au_pluginui.mm
gtk2_ardour/cocoacarbon.cc [deleted file]
gtk2_ardour/cocoacarbon.mm [new file with mode: 0644]
gtk2_ardour/opts.cc
gtk2_ardour/opts.h
gtk2_ardour/plugin_ui.cc
gtk2_ardour/plugin_ui.h
gtk2_ardour/redirect_box.cc
gtk2_ardour/x11.cc
libs/glibmm2/glibmm/convert.cc
libs/glibmm2/glibmm/date.cc
libs/glibmm2/glibmm/error.cc
libs/glibmm2/glibmm/exception.cc

index a4107432530ce5f3ad19af0699bf692969748fd1..39f9a21dd42a378a7b69f163820df70930ba9623 100644 (file)
@@ -89,7 +89,7 @@ au_pluginui.mm
 
 gtkosx_files=Split("""
 sync-menu.c
-cocoacarbon.cc
+cocoacarbon.mm
 """)
 
 x11_files=Split("""
index ab3d5e5e8cc68dd4a420aa4e31d8537dbcb95a8d..77c70d088865e1278e8080a82eb299b8d07588ac 100644 (file)
@@ -245,6 +245,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
 
        starting.connect (mem_fun(*this, &ARDOUR_UI::startup));
        stopping.connect (mem_fun(*this, &ARDOUR_UI::shutdown));
+
+       platform_setup ();
+
 }
 
 int
@@ -2017,6 +2020,8 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
                                                    Gtk::BUTTONS_NONE);
        }
 
+
+       cerr << "PDP = " << predetermined_path << endl;
                
        int response = Gtk::RESPONSE_NONE;
 
@@ -2230,11 +2235,6 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
 
                                }
                                
-                               //XXX This is needed because session constructor wants a 
-                               //non-existant path. hopefully this will be fixed at some point.
-                               
-                               session_path = Glib::build_filename (session_path, session_name);
-                               
                                if (!should_be_new) {
 
                                        if (load_session (session_path, session_name)) {
index 51a7a68b14febd8cd3f46dba0433e8e400df1253..97dbb17223aa5e33b81f9177d21804ce60072ed9 100644 (file)
@@ -749,6 +749,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        Gtk::MessageDialog* loading_dialog;
 
        void platform_specific ();
+       void platform_setup ();
        void fontconfig_dialog ();
 };
 
index f6f995fe928e9119947b3fdc525fca0b5920f788..ab816f9630c3e027b0e19f8b322f74edf7a311d0 100644 (file)
@@ -31,6 +31,9 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
        bool start_updating(GdkEventAny*);
        bool stop_updating(GdkEventAny*);
        
+       virtual void activate ();
+       virtual void deactivate ();
+
        void on_realize ();
        void on_show ();
 
@@ -45,6 +48,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
 
        NSWindow*           cocoa_window;
        NSScrollView*       scroll_view;
+       NSView*             au_view;
 
        /* Carbon */
 
index e1d7302b609de13f59ff7da3fbb794f4621ea16b..51f73199f75bd045436b2904ce1fa8d2dfd4fb44 100644 (file)
@@ -34,7 +34,7 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
 
        bool has_carbon;
        bool has_cocoa;
-       
+
        carbon_parented = false;
        cocoa_parented = false;
        cocoa_parent = 0;
@@ -42,12 +42,13 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
 
        test_view_support (has_carbon, has_cocoa);
 
-       cerr << "plugin has carbon ? " << has_carbon <<  " cocoa ? " << has_cocoa << endl;
-
        if (has_cocoa) {
                create_cocoa_view ();
-       } else {
+       } else if (has_carbon) {
                create_carbon_view (has_carbon);
+       } else {
+               /* fallback to cocoa */
+               create_cocoa_view ();
        }
 }
 
@@ -71,7 +72,7 @@ AUPluginUI::test_view_support (bool& has_carbon, bool& has_cocoa)
 bool
 AUPluginUI::test_carbon_view_support ()
 {
-       bool ret = true; // there is always the generic GUI
+       bool ret = false;
        
        carbon_descriptor.componentType = kAudioUnitCarbonViewComponentType;
        carbon_descriptor.componentSubType = 'gnrc';
@@ -126,7 +127,6 @@ AUPluginUI::plugin_class_valid (Class pluginClass)
 int
 AUPluginUI::create_cocoa_view ()
 {
-       NSView *AUView = nil;
        BOOL wasAbleToLoadCustomView = NO;
        AudioUnitCocoaViewInfo* cocoaViewInfo = NULL;
        UInt32               numberOfClasses = 0;
@@ -142,11 +142,6 @@ AUPluginUI::create_cocoa_view ()
                                                    &dataSize,
                                                    &isWritable );
 
-
-       if (result != noErr) {
-               return -1;
-       }
-
        numberOfClasses = (dataSize - sizeof(CFURLRef)) / sizeof(CFStringRef);
        
        // Does view have custom Cocoa UI?
@@ -174,15 +169,7 @@ AUPluginUI::create_cocoa_view ()
                }
        }
 
-       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];
+       NSRect crect = { { 0, 0 }, { 1, 1} };
 
        // [A] Show custom UI if view has it
 
@@ -211,8 +198,7 @@ AUPluginUI::create_cocoa_view ()
                        }
 
                        // make a view
-                       AUView = [factoryInstance uiViewForAudioUnit:*au->get_au()
-                                                 withSize:[[scroll_view contentView] bounds].size];
+                       au_view = [factoryInstance uiViewForAudioUnit:*au->get_au() withSize:crect.size];
                        
                        // cleanup
                        [CocoaViewBundlePath release];
@@ -229,32 +215,17 @@ AUPluginUI::create_cocoa_view ()
 
        if (!wasAbleToLoadCustomView) {
                // [B] Otherwise show generic Cocoa view
-               AUView = [[AUGenericView alloc] initWithAudioUnit:*au->get_au()];
-               [(AUGenericView *)AUView setShowsExpertParameters:YES];
+               au_view = [[AUGenericView alloc] initWithAudioUnit:*au->get_au()];
+               [(AUGenericView *)au_view 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;
+       /* make a child cocoa window */
 
-       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];
+       cocoa_window = [[NSWindow alloc] 
+                       initWithContentRect:crect
+                       styleMask:NSBorderlessWindowMask
+                       backing:NSBackingStoreBuffered
+                       defer:NO];
 
        return 0;
 }
@@ -279,7 +250,7 @@ AUPluginUI::create_carbon_view (bool generic)
                                                  kWindowNoShadowAttribute|
                                                  kWindowNoTitleBarAttribute);
 
-       if ((err = CreateNewWindow(kFloatingWindowClass, attr, &r, &carbon_window)) != noErr) {
+       if ((err = CreateNewWindow(kDocumentWindowClass, attr, &r, &carbon_window)) != noErr) {
                error << string_compose (_("AUPluginUI: cannot create carbon window (err: %1)"), err) << endmsg;
                return -1;
        }
@@ -335,6 +306,24 @@ AUPluginUI::get_nswindow ()
        return true_parent;
 }
 
+void
+AUPluginUI::activate ()
+{
+       NSWindow* win = get_nswindow ();
+       [win setLevel:NSFloatingWindowLevel];
+       
+       if (carbon_parented) {
+               [cocoa_parent makeKeyAndOrderFront:nil];
+               ActivateWindow (carbon_window, TRUE);
+       } 
+}
+
+void
+AUPluginUI::deactivate ()
+{
+       /* nothing to do here */
+}
+
 
 OSStatus 
 _carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event, void *userData) 
@@ -347,27 +336,25 @@ AUPluginUI::carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event)
 {
        UInt32 eventKind = GetEventKind(event);
        ClickActivationResult howToHandleClick;
-
-       cerr << "Carbon event for " << au->name();
+       NSWindow* win = get_nswindow ();
 
        switch (eventKind) {
+       case kEventWindowHandleActivate:
+               [win makeMainWindow];
+               return eventNotHandledErr;
+               break;
+
        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);
+               return eventNotHandledErr;
                break;
                
        case kEventWindowGetClickActivation:
-               cerr << " click activate!";
                howToHandleClick = kActivateAndHandleClick;
                SetEventParameter(event, kEventParamClickActivation, typeClickActivationResult, 
                                  sizeof(ClickActivationResult), &howToHandleClick);
                break;
        }
 
-       cerr << "\n";
-
        return noErr;
 }
 
@@ -407,7 +394,8 @@ AUPluginUI::parent_carbon_window ()
 
        EventTypeSpec   windowEventTypes[] = {
                {kEventClassWindow, kEventWindowGetClickActivation },
-               {kEventClassWindow, kEventWindowHandleDeactivate }
+               {kEventClassWindow, kEventWindowHandleDeactivate },
+               {kEventClassWindow, kEventWindowHandleActivate }
        };
        
        EventHandlerUPP   ehUPP = NewEventHandlerUPP(_carbon_event);
@@ -420,6 +408,7 @@ AUPluginUI::parent_carbon_window ()
 
        [win addChildWindow:cocoa_parent ordered:NSWindowAbove];
        [win setLevel:NSFloatingWindowLevel];
+       [win setHidesOnDeactivate:YES];
 
        carbon_parented = true;
                
@@ -435,8 +424,90 @@ AUPluginUI::parent_cocoa_window ()
                return -1;
        }
 
+       Gtk::Container* toplevel = get_toplevel();
+
+       if (!toplevel || !toplevel->is_toplevel()) {
+               error << _("AUPluginUI: no top level window!") << endmsg;
+               return -1;
+       }
+       
+       // Get the size of the new AU View's frame 
+       NSRect au_view_frame = [au_view frame];
+
+       if (au_view_frame.size.width > 500 || au_view_frame.size.height > 500) {
+               
+               /* its too big - use a scrollview */
+
+               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];
+
+               NSSize frameSize = [NSScrollView  frameSizeForContentSize:au_view_frame.size
+                                   hasHorizontalScroller:[scroll_view hasHorizontalScroller]
+                                   hasVerticalScroller:[scroll_view hasVerticalScroller]
+                                   borderType:[scroll_view borderType]];
+               
+               // Create a new frame with same origin as current
+               // frame but size equal to the size of the new view
+               NSRect newFrame;
+               newFrame.origin = [scroll_view frame].origin;
+               newFrame.size = frameSize;
+               
+               // Set the new frame and document views on the scroll view
+               NSRect currentFrame = [scroll_view frame];
+               [scroll_view setFrame:newFrame];
+               [scroll_view setDocumentView:au_view];
+               
+               cerr << "scroll view size is " << newFrame.size.width << " x " << newFrame.size.height << endl;
+               
+               NSSize oldContentSize = [[cocoa_window contentView] frame].size;
+               NSSize newContentSize = oldContentSize;
+               
+               cerr << "original size is " << newContentSize.width << " x " << newContentSize.height << endl;
+               
+               newContentSize.width += (newFrame.size.width - currentFrame.size.width);
+               newContentSize.height += (newFrame.size.height - currentFrame.size.height);
+               
+               [cocoa_window setContentSize:newContentSize];
+               [cocoa_window setContentView:scroll_view];
+               
+       } else {
+
+               [cocoa_window setContentSize:au_view_frame.size];
+               [cocoa_window setContentView:au_view];
+
+       }
+
+       /* compute how tall the title bar is, because we have to offset the position of the child 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;
+
+       // move cocoa window into position relative to the toplevel window
+
+       NSRect view_frame = [[cocoa_window contentView] frame];
+       view_frame.origin.x = content_frame.origin.x;
+       view_frame.origin.y = content_frame.origin.y;
+
+       [cocoa_window setFrame:view_frame display:NO];
+
+       /* make top level window big enough to hold cocoa window and titlebar */
+       
+       content_frame.size.width = view_frame.size.width;
+       content_frame.size.height = view_frame.size.height + titlebar_height;
+
+       [win setFrame:content_frame display:NO];
+
+       /* now make cocoa window a child of this top level */
+
        [win addChildWindow:cocoa_window ordered:NSWindowAbove];
-       [win setLevel:NSFloatingWindowLevel];
+       // [win setLevel:NSFloatingWindowLevel];
+       [win setHidesOnDeactivate:YES];
 
        cocoa_parented = true;
 
@@ -469,9 +540,9 @@ AUPluginUI::on_show ()
        VBox::on_show ();
 
        if (cocoa_window) {
-               // [cocoa_window setIsVisible:YES];
+               [cocoa_window setIsVisible:YES];
        } else if (carbon_window) {
-               // [cocoa_parent setIsVisible:YES];
+               [cocoa_parent setIsVisible:YES];
        }
 }
 
diff --git a/gtk2_ardour/cocoacarbon.cc b/gtk2_ardour/cocoacarbon.cc
deleted file mode 100644 (file)
index 4ab3992..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-    Copyright (C) 2007 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.
-*/
-
-#include <Carbon/Carbon.h>
-#undef check // stupid, stupid carbon
-
-#include "ardour_ui.h"
-#include "actions.h"
-#include "sync-menu.h"
-
-sigc::signal<void,bool> 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.
- */
-
-static OSErr
-handle_reopen_application (const AppleEvent *inAppleEvent, 
-                           AppleEvent       *outAppleEvent, 
-                           long              inHandlerRefcon)
-{
-       cerr << "reopen app\n";
-        return noErr;
-}
-
-static OSErr
-handle_quit_application (const AppleEvent *inAppleEvent, 
-                         AppleEvent       *outAppleEvent, 
-                         long              inHandlerRefcon)
-{
-       cerr << "quit app\n";
-       ARDOUR_UI::instance()->quit ();
-
-        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 ()
-{
-        AEInstallEventHandler (kCoreEventClass, kAEReopenApplication, 
-                               handle_reopen_application, 0, true);
-
-        AEInstallEventHandler (kCoreEventClass, kAEQuitApplication, 
-                               handle_quit_application, 0, true);
-
-       Gtk::Widget* widget = ActionManager::get_widget ("/ui/Main/Session/Quit");
-       if (widget) {
-               ige_mac_menu_set_quit_menu_item ((GtkMenuItem*) widget->gobj());
-       }
-
-       IgeMacMenuGroup* group = ige_mac_menu_add_app_menu_group ();
-
-       widget = ActionManager::get_widget ("/ui/Main/Session/About");
-       if (widget) {
-               ige_mac_menu_add_app_menu_item (group, (GtkMenuItem*) widget->gobj(), 0);
-       }
-       widget = ActionManager::get_widget ("/ui/Main/Session/ToggleOptionsEditor");
-       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/cocoacarbon.mm b/gtk2_ardour/cocoacarbon.mm
new file mode 100644 (file)
index 0000000..b60352e
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+    Copyright (C) 2007 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.
+*/
+
+#include <Carbon/Carbon.h>
+#undef check // stupid, stupid carbon
+
+#include "ardour_ui.h"
+#include "actions.h"
+#include "opts.h"
+#include "sync-menu.h"
+
+#include <Appkit/Appkit.h>
+
+sigc::signal<void,bool> 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.
+ */
+
+static OSErr
+handle_reopen_application (const AppleEvent *inAppleEvent, 
+                           AppleEvent       *outAppleEvent, 
+                           long              inHandlerRefcon)
+{
+       cerr << "reopen app\n";
+        return noErr;
+}
+
+static OSErr
+handle_quit_application (const AppleEvent *inAppleEvent, 
+                         AppleEvent       *outAppleEvent, 
+                         long              inHandlerRefcon)
+{
+       cerr << "quit app\n";
+       ARDOUR_UI::instance()->quit ();
+
+        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 ()
+{
+        AEInstallEventHandler (kCoreEventClass, kAEReopenApplication, 
+                               handle_reopen_application, 0, true);
+
+        AEInstallEventHandler (kCoreEventClass, kAEQuitApplication, 
+                               handle_quit_application, 0, true);
+
+       Gtk::Widget* widget = ActionManager::get_widget ("/ui/Main/Session/Quit");
+       if (widget) {
+               ige_mac_menu_set_quit_menu_item ((GtkMenuItem*) widget->gobj());
+       }
+
+       IgeMacMenuGroup* group = ige_mac_menu_add_app_menu_group ();
+
+       widget = ActionManager::get_widget ("/ui/Main/Session/About");
+       if (widget) {
+               ige_mac_menu_add_app_menu_item (group, (GtkMenuItem*) widget->gobj(), 0);
+       }
+       widget = ActionManager::get_widget ("/ui/Main/Session/ToggleOptionsEditor");
+       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);
+}
+
+void
+ARDOUR_UI::platform_setup ()
+{
+       if (!ARDOUR_COMMAND_LINE::finder_invoked_ardour) {
+               
+               /* if invoked from the command line, make sure we're visible */
+               
+               [NSApp activateIgnoringOtherApps:YES];
+       } 
+}
index 85681b03c3602def2d2c484d413db3b4a601670c..e2189f9226443e22999c030fbaf5dcf4e1467a87 100644 (file)
@@ -40,6 +40,7 @@ char* ARDOUR_COMMAND_LINE::curvetest_file = 0;
 bool ARDOUR_COMMAND_LINE::try_hw_optimization = true;
 Glib::ustring ARDOUR_COMMAND_LINE::keybindings_path = ""; /* empty means use builtin default */
 Glib::ustring ARDOUR_COMMAND_LINE::menus_file = "ardour.menus";
+bool ARDOUR_COMMAND_LINE::finder_invoked_ardour = false;
 
 using namespace ARDOUR_COMMAND_LINE;
 
@@ -142,6 +143,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
 
                case 'p':
                        //undocumented OS X finder -psn_XXXXX argument
+                       finder_invoked_ardour = true;
                        break;
                
                case 'S':
index ff3bf0b481a57fdb9268dfd13b61114a399e4342..efa26568163852a1d4569a125e13873c2e6ce496 100644 (file)
@@ -37,6 +37,7 @@ extern bool   try_hw_optimization;
 extern bool   use_gtk_theme;
 extern Glib::ustring keybindings_path;
 extern Glib::ustring menus_file;
+extern bool   finder_invoked_ardour;
 
 extern int32_t parse_opts (int argc, char *argv[]);
 
index 64e41bedb9aa270e92221a15eb1adcd350ad6373..dc51db46b641de21351badf9bf113aed97d5ef56 100644 (file)
@@ -175,13 +175,11 @@ PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert> insert)
 void
 PluginUIWindow::app_activated (bool yn)
 {
-#if defined(HAVE_AUDIOUNITS) && defined(GTKOSX)
+#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
        if (yn) {
-               ARDOUR_UI::instance()->the_editor().ensure_float (*this);
-               show ();
-       } else {
-               hide ();
+               _pluginui->activate ();
        }
+       cerr << "activated ? " << yn << endl;
 #endif
 }
 
index ad91ebb99175a0ef9fda57800c18ab6771010239..dec4db3481d72b5588ac76b2d41aff69fd87fabd 100644 (file)
@@ -73,6 +73,9 @@ class PlugUIBase : public virtual sigc::trackable
        virtual gint get_preferred_width () = 0;
        virtual bool start_updating(GdkEventAny*) = 0;
        virtual bool stop_updating(GdkEventAny*) = 0;
+       
+       virtual void activate () {}
+       virtual void deactivate () {}
 
   protected:
        boost::shared_ptr<ARDOUR::PluginInsert> insert;
index 95f6b4dac8b3f2c23022093992793be402e3703a..f3193d6924b13bc03bea8ce45cd7bc974d8e93bc 100644 (file)
@@ -1078,8 +1078,6 @@ RedirectBox::edit_redirect (boost::shared_ptr<Redirect> redirect)
                
                /* it's an insert */
 
-               cerr << "the plugin insert, that is\n";
-               
                boost::shared_ptr<PluginInsert> plugin_insert;
                boost::shared_ptr<PortInsert> port_insert;
                
index 330d459abc4be3b60afdf7200e69c9cc9e5749a5..c29c7db078a4001fb28a758758143b67d0e70315 100644 (file)
@@ -4,3 +4,8 @@ void
 ARDOUR_UI::platform_specific ()
 {
 }
+
+void
+ARDOUR_UI::platform_setup ()
+{
+}
index 1cd334bcd1ec71581e4586b9403abbba111b6e00..a655e8aefba0c5f3461c1cf637259b79303a1609 100644 (file)
@@ -26,6 +26,9 @@
 #include <glib/gconvert.h>
 #include <glib/gmessages.h>
 #include <glib/gunicode.h>
+#ifndef g_assert
+#include <glib/gtestutils.h>
+#endif
 #include <glibmm/utility.h>
 
 
index 8058376e2ad7e5653f7a5adeaea04dbe3767e90b..c535e92ec28bb01c390b9e391270a60d9bffd0e3 100644 (file)
@@ -25,6 +25,9 @@
 
 #include <glib/gmem.h>
 #include <glib/gmessages.h>
+#ifndef g_assert
+#include <glib/gtestutils.h>
+#endif
 
 #include <ctime>
 #include <algorithm>
index 2e8f0723223d93213e0569f82044c9c83203173e..834fd203430ac4d7dccef7942452b13ac1305a8d 100644 (file)
@@ -22,6 +22,9 @@
 
 #include <glib/gerror.h>
 #include <glib/gmessages.h>
+#ifndef g_assert
+#include <glib/gtestutils.h>
+#endif
 
 #include <map>
 #include <glibmmconfig.h>
index 22345b2853b6438784f3079973cbd26a788428c8..19de7c3b93285dd3be6208f575526e1b656d93b3 100644 (file)
@@ -21,6 +21,9 @@
  */
 
 #include <glib/gmessages.h>
+#ifndef g_assert
+#include <glib/gtestutils.h>
+#endif
 #include <glibmm/exception.h>