mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-19 03:45:47 +01:00
tidy up AU GUIs, make bypass button work and add preset/automation placeholders
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3043 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
72da1b892d
commit
ea41f0f37b
5 changed files with 70 additions and 25 deletions
|
|
@ -1,6 +1,9 @@
|
|||
#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>
|
||||
|
|
@ -13,6 +16,10 @@
|
|||
#undef verify
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/combobox.h>
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
||||
#include "plugin_ui.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
|
@ -53,6 +60,11 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
|
|||
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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include <gtkmm/button.h>
|
||||
#include <gdk/gdkquartz.h>
|
||||
|
||||
#include <gtkmm2ext/utils.h>
|
||||
|
||||
#include "au_pluginui.h"
|
||||
#include "gui_thread.h"
|
||||
|
||||
|
|
@ -20,16 +22,34 @@
|
|||
|
||||
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 ();
|
||||
|
|
@ -37,20 +57,25 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
|
|||
|
||||
/* 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 ();
|
||||
|
||||
|
|
@ -350,7 +375,6 @@ AUPluginUI::carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event)
|
|||
|
||||
UInt32 eventKind = GetEventKind(event);
|
||||
ClickActivationResult howToHandleClick;
|
||||
Gtk::Container* toplevel = get_toplevel();
|
||||
NSWindow* win = get_nswindow ();
|
||||
|
||||
cerr << "window " << win << " carbon event type " << eventKind << endl;
|
||||
|
|
@ -389,8 +413,6 @@ AUPluginUI::parent_carbon_window ()
|
|||
{
|
||||
NSWindow* win = get_nswindow ();
|
||||
int x, y;
|
||||
int tbx, tby;
|
||||
|
||||
|
||||
if (!win) {
|
||||
return -1;
|
||||
|
|
@ -602,3 +624,4 @@ AUPluginUI::on_focus_out_event (GdkEventFocus* ev)
|
|||
cerr << "au plugin focus out\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -245,28 +245,37 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
|
|||
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
|
||||
|
|
@ -288,8 +297,8 @@ PlugUIBase::save_plugin_setting ()
|
|||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -80,13 +80,14 @@ class PlugUIBase : public virtual sigc::trackable
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue