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__
28 #include <AppKit/AppKit.h>
29 #include <Carbon/Carbon.h>
30 #include <AudioUnit/AudioUnitCarbonView.h>
31 #include <AudioUnit/AudioUnit.h>
33 /* fix up stupid apple macros */
46 #include <gtkmm/box.h>
47 #include <gtkmm/eventbox.h>
48 #include <gtkmm/combobox.h>
49 #include <gtkmm/button.h>
50 #include <gtkmm/label.h>
52 #include "plugin_ui.h"
62 @interface NotificationObject : NSObject {
64 AUPluginUI* plugin_ui;
65 NSWindow* cocoa_parent;
66 NSWindow* top_level_parent;
70 @interface LiveResizeNotificationObject : NSObject {
72 AUPluginUI* plugin_ui;
76 class AUPluginUI : public PlugUIBase, public Gtk::VBox
79 AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
82 gint get_preferred_width () { return req_width; }
83 gint get_preferred_height () { return req_height; }
84 bool start_updating(GdkEventAny*);
85 bool stop_updating(GdkEventAny*);
90 bool non_gtk_gui() const { return true; }
92 void lower_box_realized ();
93 bool lower_box_visibility_notify (GdkEventVisibility*);
95 void lower_box_map ();
96 void lower_box_unmap ();
97 void lower_box_size_request (GtkRequisition*);
98 void lower_box_size_allocate (Gtk::Allocation&);
99 bool lower_box_expose (GdkEventExpose*);
101 void cocoa_view_resized ();
104 void forward_key_event (GdkEventKey*);
106 bool on_window_show (const std::string& /*title*/);
107 void on_window_hide ();
109 OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
111 void start_live_resize ();
112 void end_live_resize ();
116 boost::shared_ptr<ARDOUR::AUPlugin> au;
121 Gtk::EventBox low_box;
123 Gtk::Label automation_mode_label;
124 Gtk::ComboBoxText automation_mode_selector;
125 Gtk::Label preset_label;
127 static std::vector<std::string> automation_mode_strings;
135 NSWindow* cocoa_window;
137 NSRect last_au_frame;
139 uint32_t plugin_requested_resize;
143 NSWindow* cocoa_parent;
144 ComponentDescription carbon_descriptor;
145 AudioUnitCarbonView editView;
146 WindowRef carbon_window;
147 EventHandlerRef carbon_event_handler;
148 bool _activating_from_app;
152 NotificationObject* _notify;
153 LiveResizeNotificationObject* _resize_notify;
155 bool test_cocoa_view_support ();
156 bool test_carbon_view_support ();
157 int create_carbon_view ();
158 int create_cocoa_view ();
160 int parent_carbon_window ();
161 int parent_cocoa_window ();
162 NSWindow* get_nswindow();
164 void update_view_size ();
166 bool plugin_class_valid (Class pluginClass);
168 static bool idle_meter();
169 static int64_t last_idle;
170 static bool idle_meter_needed;
174 #endif /* __gtk2_ardour_auplugin_ui_h__ */