/*
- Copyright (C) 2004 Paul Davis
+ Copyright (C) 2004 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <fst.h>
#include <gtk/gtk.h>
#include <gtk/gtksocket.h>
-#include "ardour/insert.h"
+#include "ardour/plugin_insert.h"
#include "ardour/vst_plugin.h"
-#include "plugin_ui.h"
+#include "vst_pluginui.h"
#include <gdk/gdkx.h>
: PlugUIBase (pi),
vst (vp)
{
- create_preset_store ();
-
fst_run_editor (vst->fst());
preset_box.set_spacing (6);
preset_box.set_border_width (6);
+ preset_box.pack_end (focus_button, false, false);
preset_box.pack_end (bypass_button, false, false, 10);
+ preset_box.pack_end (delete_button, false, false);
preset_box.pack_end (save_button, false, false);
- preset_box.pack_end (vst_preset_combo, false, false);
-
- vst_preset_combo.signal_changed().connect (mem_fun (*this, &VSTPluginUI::preset_chosen));
+ preset_box.pack_end (add_button, false, false);
+ preset_box.pack_end (_preset_box, false, false);
bypass_button.set_active (!insert->active());
-
+
pack_start (preset_box, false, false);
pack_start (socket, true, true);
+ pack_start (plugin_analysis_expander, true, true);
}
VSTPluginUI::~VSTPluginUI ()
}
void
-VSTPluginUI::preset_chosen ()
+VSTPluginUI::preset_selected ()
{
- // we can't dispatch directly here, too many plugins only expects one GUI thread.
- vst->fst()->want_program = vst_preset_combo.get_active_row_number ();
socket.grab_focus ();
+ PlugUIBase::preset_selected ();
}
int
{
/* forward configure events to plugin window */
- win.signal_configure_event().connect (bind (mem_fun (*this, &VSTPluginUI::configure_handler), &socket), false);
+ win.signal_configure_event().connect (sigc::bind (sigc::mem_fun (*this, &VSTPluginUI::configure_handler), &socket), false);
/*
this assumes that the window's owner understands the XEmbed protocol.
*/
-
+
socket.add_id (fst_get_XID (vst->fst()));
fst_move_window_into_view (vst->fst());
}
void
-VSTPluginUI::create_preset_store ()
+VSTPluginUI::forward_key_event (GdkEventKey* ev)
{
- FST *fst = vst->fst();
- int vst_version = fst->plugin->dispatcher (fst->plugin, effGetVstVersion, 0, 0, NULL, 0.0f);
+ if (ev->type == GDK_KEY_PRESS) {
- preset_model = ListStore::create (preset_columns);
+ FST* fst = vst->fst ();
+ pthread_mutex_lock (&fst->lock);
- for (int i = 0; i < fst->plugin->numPrograms; ++i) {
- char buf[100];
- TreeModel::Row row = *(preset_model->append());
-
- snprintf (buf, 90, "preset %d", i);
-
- if (vst_version >= 2) {
- fst->plugin->dispatcher (fst->plugin, 29, i, 0, buf, 0.0);
+ if (fst->n_pending_keys == (sizeof (fst->pending_keys) * sizeof (FSTKey))) {
+ /* buffer full */
+ return;
}
-
- row[preset_columns.name] = buf;
- row[preset_columns.number] = i;
- }
-
- if (fst->plugin->numPrograms > 0) {
- fst->plugin->dispatcher( fst->plugin, effSetProgram, 0, 0, NULL, 0.0 );
- }
-
- vst_preset_combo.set_model (preset_model);
- CellRenderer* renderer = manage (new CellRendererText());
- vst_preset_combo.pack_start (*renderer, true);
- vst_preset_combo.add_attribute (*renderer, "text", 0);
+ int special_windows_key = 0;
+ int character_windows_key = 0;
+
+ switch (ev->keyval) {
+ case GDK_Left:
+ special_windows_key = 0x25;
+ break;
+ case GDK_Right:
+ special_windows_key = 0x27;
+ break;
+ case GDK_Up:
+ special_windows_key = 0x26;
+ break;
+ case GDK_Down:
+ special_windows_key = 0x28;
+ break;
+ case GDK_Return:
+ case GDK_KP_Enter:
+ special_windows_key = 0xd;
+ break;
+ default:
+ character_windows_key = ev->keyval;
+ break;
+ }
- if (vst->fst()->current_program != -1) {
- vst_preset_combo.set_active (vst->fst()->current_program);
- } else {
- vst_preset_combo.set_active (0);
+ fst->pending_keys[fst->n_pending_keys].special = special_windows_key;
+ fst->pending_keys[fst->n_pending_keys].character = character_windows_key;
+ fst->n_pending_keys++;
+
+ pthread_mutex_unlock (&fst->lock);
}
}
static error_handler_t wine_error_handler;
static error_handler_t gtk_error_handler;
-static int
+static int
fst_xerror_handler( Display *disp, XErrorEvent *ev )
{
if (disp == the_gtk_display) {