#ifndef __gtk2_ardour_auplugin_ui_h__
#define __gtk2_ardour_auplugin_ui_h__
+#include <vector>
+#include <string>
+
#include <AppKit/AppKit.h>
#include <Carbon/Carbon.h>
#include <AudioUnit/AudioUnitCarbonView.h>
#undef verify
#include <gtkmm/box.h>
+#include <gtkmm/combobox.h>
+#include <gtkmm/button.h>
+#include <gtkmm/label.h>
+
#include "plugin_ui.h"
namespace ARDOUR {
Gtk::HBox top_box;
Gtk::EventBox low_box;
Gtk::VBox vpacker;
+ Gtk::Label automation_mode_label;
+ Gtk::ComboBoxText automation_mode_selector;
+ Gtk::Label preset_label;
+
+ static std::vector<std::string> automation_mode_strings;
/* Cocoa */
#include <gtkmm/button.h>
#include <gdk/gdkquartz.h>
+#include <gtkmm2ext/utils.h>
+
#include "au_pluginui.h"
#include "gui_thread.h"
using namespace ARDOUR;
using namespace Gtk;
+using namespace Gtkmm2ext;
using namespace sigc;
using namespace std;
using namespace PBD;
-static const float kOffsetForAUView_X = 220;
-static const float kOffsetForAUView_Y = 90;
+vector<string> AUPluginUI::automation_mode_strings;
+
+static const gchar* _automation_mode_strings[] = {
+ X_("Manual"),
+ X_("Play"),
+ X_("Write"),
+ X_("Touch"),
+ 0
+};
AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
: PlugUIBase (insert)
+ , automation_mode_label (_("Automation"))
+ , preset_label (_("Presets"))
+
{
+ if (automation_mode_strings.empty()) {
+ automation_mode_strings = I18N (_automation_mode_strings);
+ }
+
+ set_popdown_strings (automation_mode_selector, automation_mode_strings);
+ automation_mode_selector.set_active_text (automation_mode_strings.front());
+
if ((au = boost::dynamic_pointer_cast<AUPlugin> (insert->plugin())) == 0) {
error << _("unknown type of editor-supplying plugin (note: no AudioUnit support in this version of ardour)") << endmsg;
throw failed_constructor ();
/* stuff some stuff into the top of the window */
- Gtk::Button* button = manage (new Gtk::Button ("press me"));
- Gtk::Label* label = manage (new Gtk::Label ("hello, world!"));
-
top_box.set_spacing (6);
top_box.set_border_width (6);
- top_box.pack_start (*button, false, false);
- top_box.pack_start (*label, false, true);
+
+ top_box.pack_end (bypass_button, false, true);
+ top_box.pack_end (automation_mode_selector, false, false);
+ top_box.pack_end (automation_mode_label, false, false);
+ top_box.pack_end (save_button, false, false);
+ top_box.pack_end (preset_combo, false, false);
+ top_box.pack_end (preset_label, false, false);
set_spacing (6);
pack_start (top_box, false, false);
pack_start (low_box, false, false);
- button->show ();
- label->show ();
+ preset_label.show ();
+ preset_combo.show ();
+ automation_mode_label.show ();
+ automation_mode_selector.show ();
+ bypass_button.show ();
top_box.show ();
low_box.show ();
UInt32 eventKind = GetEventKind(event);
ClickActivationResult howToHandleClick;
- Gtk::Container* toplevel = get_toplevel();
NSWindow* win = get_nswindow ();
cerr << "window " << win << " carbon event type " << eventKind << endl;
{
NSWindow* win = get_nswindow ();
int x, y;
- int tbx, tby;
-
if (!win) {
return -1;
cerr << "au plugin focus out\n";
return false;
}
+
combo_label->set_use_markup (true);
smaller_hbox->pack_start (*combo_label, false, false, 10);
- smaller_hbox->pack_start (combo, false, false);
+ smaller_hbox->pack_start (preset_combo, false, false);
smaller_hbox->pack_start (save_button, false, false);
constraint_hbox->set_spacing (5);
save_button(_("Add")),
bypass_button (_("Bypass"))
{
- //combo.set_use_arrows_always(true);
- set_popdown_strings (combo, plugin->get_presets());
- combo.set_size_request (100, -1);
- combo.set_active_text ("");
- combo.signal_changed().connect(mem_fun(*this, &PlugUIBase::setting_selected));
+ //preset_combo.set_use_arrows_always(true);
+ set_popdown_strings (preset_combo, plugin->get_presets());
+ preset_combo.set_size_request (100, -1);
+ preset_combo.set_active_text ("");
+ preset_combo.signal_changed().connect(mem_fun(*this, &PlugUIBase::setting_selected));
save_button.set_name ("PluginSaveButton");
save_button.signal_clicked().connect(mem_fun(*this, &PlugUIBase::save_plugin_setting));
+ insert->active_changed.connect (mem_fun(*this, &PlugUIBase::redirect_active_changed));
+ bypass_button.set_active (!pi->active());
+
bypass_button.set_name ("PluginBypassButton");
bypass_button.signal_toggled().connect (mem_fun(*this, &PlugUIBase::bypass_toggled));
}
+void
+PlugUIBase::redirect_active_changed (Redirect* r, void* src)
+{
+ ENSURE_GUI_THREAD(bind (mem_fun(*this, &PlugUIBase::redirect_active_changed), r, src));
+ bypass_button.set_active (!r->active());
+}
+
void
PlugUIBase::setting_selected()
{
- if (combo.get_active_text().length() > 0) {
- if (!plugin->load_preset(combo.get_active_text())) {
- warning << string_compose(_("Plugin preset %1 not found"), combo.get_active_text()) << endmsg;
+ if (preset_combo.get_active_text().length() > 0) {
+ if (!plugin->load_preset(preset_combo.get_active_text())) {
+ warning << string_compose(_("Plugin preset %1 not found"), preset_combo.get_active_text()) << endmsg;
}
}
-
}
void
if (name.length()) {
if(plugin->save_preset(name)){
- set_popdown_strings (combo, plugin->get_presets());
- combo.set_active_text (name);
+ set_popdown_strings (preset_combo, plugin->get_presets());
+ preset_combo.set_active_text (name);
}
}
break;
protected:
boost::shared_ptr<ARDOUR::PluginInsert> insert;
boost::shared_ptr<ARDOUR::Plugin> plugin;
- Gtk::ComboBoxText combo;
+ Gtk::ComboBoxText preset_combo;
Gtk::Button save_button;
Gtk::ToggleButton bypass_button;
void setting_selected();
void save_plugin_setting (void);
void bypass_toggled();
+ void redirect_active_changed (ARDOUR::Redirect* r, void* src);
};
class GenericPluginUI : public PlugUIBase, public Gtk::VBox