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 */
44 #include <gtkmm/box.h>
45 #include <gtkmm/eventbox.h>
46 #include <gtkmm/combobox.h>
47 #include <gtkmm/button.h>
48 #include <gtkmm/label.h>
50 #include "plugin_ui.h"
60 @interface NotificationObject : NSObject {
62 AUPluginUI* plugin_ui;
63 NSWindow* cocoa_parent;
64 NSWindow* top_level_parent;
68 class AUPluginUI : public PlugUIBase, public Gtk::VBox
71 AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>);
74 gint get_preferred_width () { return req_width; }
75 gint get_preferred_height () { return req_height; }
76 bool start_updating(GdkEventAny*);
77 bool stop_updating(GdkEventAny*);
82 bool non_gtk_gui() const { return true; }
84 void lower_box_realized ();
85 bool lower_box_visibility_notify (GdkEventVisibility*);
87 void lower_box_map ();
88 void lower_box_unmap ();
89 void lower_box_size_request (GtkRequisition*);
90 void lower_box_size_allocate (Gtk::Allocation&);
91 gboolean lower_box_expose (GdkEventExpose*);
93 void cocoa_view_resized ();
96 void forward_key_event (GdkEventKey*);
98 bool on_window_show (const std::string& /*title*/);
99 void on_window_hide ();
101 OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
105 boost::shared_ptr<ARDOUR::AUPlugin> au;
110 Gtk::EventBox low_box;
112 Gtk::Label automation_mode_label;
113 Gtk::ComboBoxText automation_mode_selector;
114 Gtk::Label preset_label;
116 static std::vector<std::string> automation_mode_strings;
129 NSWindow* cocoa_window;
131 NSRect last_au_frame;
135 NSWindow* cocoa_parent;
136 ComponentDescription carbon_descriptor;
137 AudioUnitCarbonView editView;
138 WindowRef carbon_window;
139 EventHandlerRef carbon_event_handler;
140 bool _activating_from_app;
141 NotificationObject* _notify;
143 bool test_cocoa_view_support ();
144 bool test_carbon_view_support ();
145 int create_carbon_view ();
146 int create_cocoa_view ();
148 int parent_carbon_window ();
149 int parent_cocoa_window ();
150 NSWindow* get_nswindow();
152 void update_view_size ();
154 bool plugin_class_valid (Class pluginClass);
157 #endif /* __gtk2_ardour_auplugin_ui_h__ */