ardour
au_pluginui.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 Paul Davis
3 
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.
8 
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.
13 
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.
17 
18 */
19 
20 #ifndef __gtk2_ardour_auplugin_ui_h__
21 #define __gtk2_ardour_auplugin_ui_h__
22 
23 #include <vector>
24 #include <string>
25 
26 #include <AppKit/AppKit.h>
27 #include <Carbon/Carbon.h>
28 #include <AudioUnit/AudioUnitCarbonView.h>
29 #include <AudioUnit/AudioUnit.h>
30 
31 /* fix up stupid apple macros */
32 
33 #undef check
34 #undef require
35 #undef verify
36 
37 #ifdef YES
38 #undef YES
39 #endif
40 #ifdef NO
41 #undef NO
42 #endif
43 
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>
49 
50 #include "plugin_ui.h"
51 
52 namespace ARDOUR {
53  class AUPlugin;
54  class PluginInsert;
55  class IOProcessor;
56 }
57 
58 class AUPluginUI;
59 
60 @interface NotificationObject : NSObject {
61  @private
63  NSWindow* cocoa_parent;
64  NSWindow* top_level_parent;
65 }
66 @end
67 
68 class AUPluginUI : public PlugUIBase, public Gtk::VBox
69 {
70  public:
72  ~AUPluginUI ();
73 
74  gint get_preferred_height () { return prefheight; }
75  gint get_preferred_width () { return prefwidth; }
76  bool start_updating(GdkEventAny*);
77  bool stop_updating(GdkEventAny*);
78 
79  void activate ();
80  void deactivate ();
81 
82  bool non_gtk_gui() const { return true; }
83 
84  void lower_box_realized ();
85  bool lower_box_visibility_notify (GdkEventVisibility*);
86 
87  void cocoa_view_resized ();
88  void on_realize ();
89  void grab_focus();
90  void forward_key_event (GdkEventKey*);
91 
92  bool on_window_show (const std::string& /*title*/);
93  void on_window_hide ();
94 
95  OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
96 
97  private:
98  WindowRef wr;
102 
103  Gtk::HBox top_box;
104  Gtk::EventBox low_box;
105  Gtk::VBox vpacker;
107  Gtk::ComboBoxText automation_mode_selector;
108  Gtk::Label preset_label;
109 
110  static std::vector<std::string> automation_mode_strings;
111 
112  /* Cocoa */
113 
114  NSWindow* cocoa_window;
115  NSView* au_view;
117 
118  /* Carbon */
119 
120  NSWindow* cocoa_parent;
121  ComponentDescription carbon_descriptor;
122  AudioUnitCarbonView editView;
123  WindowRef carbon_window;
124  EventHandlerRef carbon_event_handler;
127 
128  bool test_cocoa_view_support ();
129  bool test_carbon_view_support ();
130  int create_carbon_view ();
131  int create_cocoa_view ();
132 
133  int parent_carbon_window ();
134  int parent_cocoa_window ();
135  NSWindow* get_nswindow();
136 
137  bool plugin_class_valid (Class pluginClass);
138 };
139 
140 #endif /* __gtk2_ardour_auplugin_ui_h__ */
AudioUnitCarbonView editView
Definition: au_pluginui.h:122
void cocoa_view_resized()
Definition: au_pluginui.mm:442
NotificationObject * _notify
Definition: au_pluginui.h:126
WindowRef carbon_window
Definition: au_pluginui.h:123
Gtk::HBox top_box
Definition: au_pluginui.h:103
int prefheight
Definition: au_pluginui.h:100
int create_cocoa_view()
Definition: au_pluginui.mm:318
void activate()
Definition: au_pluginui.mm:575
AUPluginUI(boost::shared_ptr< ARDOUR::PluginInsert >)
Definition: au_pluginui.mm:132
int parent_cocoa_window()
Definition: au_pluginui.mm:649
NSWindow * get_nswindow()
Definition: au_pluginui.mm:555
NSWindow * top_level_parent
Definition: au_pluginui.h:64
NSWindow * cocoa_parent
Definition: au_pluginui.h:120
void on_realize()
Definition: au_pluginui.mm:722
bool test_cocoa_view_support()
Definition: au_pluginui.mm:294
void grab_focus()
Definition: au_pluginui.mm:693
AUPluginUI * plugin_ui
Definition: au_pluginui.h:62
static std::vector< std::string > automation_mode_strings
Definition: au_pluginui.h:110
void on_window_hide()
Definition: au_pluginui.mm:758
NSWindow * cocoa_parent
Definition: au_pluginui.h:63
bool _activating_from_app
Definition: au_pluginui.h:125
Gtk::VBox vpacker
Definition: au_pluginui.h:105
Gtk::EventBox low_box
Definition: au_pluginui.h:104
Definition: amp.h:29
boost::shared_ptr< ARDOUR::AUPlugin > au
Definition: au_pluginui.h:99
NSView * au_view
Definition: au_pluginui.h:115
gint get_preferred_height()
Definition: au_pluginui.h:74
ComponentDescription carbon_descriptor
Definition: au_pluginui.h:121
EventHandlerRef carbon_event_handler
Definition: au_pluginui.h:124
OSStatus carbon_event(EventHandlerCallRef nextHandlerRef, EventRef event)
Gtk::Label automation_mode_label
Definition: au_pluginui.h:106
bool start_updating(GdkEventAny *)
Definition: au_pluginui.mm:796
bool lower_box_visibility_notify(GdkEventVisibility *)
Definition: au_pluginui.mm:745
NSWindow * cocoa_window
Definition: au_pluginui.h:114
bool stop_updating(GdkEventAny *)
Definition: au_pluginui.mm:802
void forward_key_event(GdkEventKey *)
Definition: au_pluginui.mm:700
bool plugin_class_valid(Class pluginClass)
Definition: au_pluginui.mm:306
void deactivate()
Definition: au_pluginui.mm:583
Gtk::Label preset_label
Definition: au_pluginui.h:108
int parent_carbon_window()
Definition: au_pluginui.mm:591
WindowRef wr
Definition: au_pluginui.h:98
bool non_gtk_gui() const
Definition: au_pluginui.h:82
gint get_preferred_width()
Definition: au_pluginui.h:75
Gtk::ComboBoxText automation_mode_selector
Definition: au_pluginui.h:107
int create_carbon_view()
Definition: au_pluginui.mm:490
NSRect last_au_frame
Definition: au_pluginui.h:116
bool on_window_show(const std::string &)
Definition: au_pluginui.mm:777
bool test_carbon_view_support()
Definition: au_pluginui.mm:259
void lower_box_realized()
Definition: au_pluginui.mm:735