#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 (sigc::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());
}
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
}
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);
-
- preset_model = ListStore::create (preset_columns);
+ if (ev->type == GDK_KEY_PRESS) {
- for (int i = 0; i < fst->plugin->numPrograms; ++i) {
- char buf[100];
- TreeModel::Row row = *(preset_model->append());
+ FST* fst = vst->fst ();
+ pthread_mutex_lock (&fst->lock);
- 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);
+ 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;
+ }
- CellRenderer* renderer = manage (new CellRendererText());
- vst_preset_combo.pack_start (*renderer, true);
- vst_preset_combo.add_attribute (*renderer, "text", 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++;
- if (vst->fst()->current_program != -1) {
- vst_preset_combo.set_active (vst->fst()->current_program);
- } else {
- vst_preset_combo.set_active (0);
+ pthread_mutex_unlock (&fst->lock);
}
}