2 Copyright (C) 2012 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk2_ardour_auplugin_ui_h__
21 #define __gtk2_ardour_auplugin_ui_h__
26 #include <AppKit/AppKit.h>
27 #include <Carbon/Carbon.h>
28 #include <AudioUnit/AudioUnitCarbonView.h>
29 #include <AudioUnit/AudioUnit.h>
31 /* fix up stupid apple macros */
37 #include <gtkmm/box.h>
38 #include <gtkmm/combobox.h>
39 #include <gtkmm/button.h>
40 #include <gtkmm/label.h>
42 #include "plugin_ui.h"
52 @interface NotificationObject : NSObject {
54 AUPluginUI* plugin_ui;
55 NSWindow* cocoa_parent;
56 NSWindow* top_level_parent;
60 class AUPluginUI : public PlugUIBase, public Gtk::VBox
63 AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
66 gint get_preferred_height () { return prefheight; }
67 gint get_preferred_width () { return prefwidth; }
68 bool start_updating(GdkEventAny*);
69 bool stop_updating(GdkEventAny*);
74 bool non_gtk_gui() const { return true; }
76 void lower_box_realized ();
77 void cocoa_view_resized ();
79 void forward_key_event (GdkEventKey*);
81 bool on_window_show (const std::string& /*title*/);
82 void on_window_hide ();
84 OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
88 boost::shared_ptr<ARDOUR::AUPlugin> au;
95 Gtk::Label automation_mode_label;
96 Gtk::ComboBoxText automation_mode_selector;
97 Gtk::Label preset_label;
99 static std::vector<std::string> automation_mode_strings;
103 NSWindow* cocoa_window;
105 NSRect last_au_frame;
109 NSWindow* cocoa_parent;
110 ComponentDescription carbon_descriptor;
111 AudioUnitCarbonView editView;
112 WindowRef carbon_window;
113 EventHandlerRef carbon_event_handler;
114 bool _activating_from_app;
115 NotificationObject* _notify;
117 bool test_cocoa_view_support ();
118 bool test_carbon_view_support ();
119 int create_carbon_view ();
120 int create_cocoa_view ();
122 int parent_carbon_window ();
123 int parent_cocoa_window ();
124 NSWindow* get_nswindow();
126 bool plugin_class_valid (Class pluginClass);
129 #endif /* __gtk2_ardour_auplugin_ui_h__ */