add QMDSP library to ardev file so that its discoverable as we try to load VAMP stuff
[ardour.git] / gtk2_ardour / vst_pluginui.cc
index 6c1b359fd4b0e232e0728d24d49d840257bb1714..b3942235fd28a59d22fb52df770b4d16ef9ab977 100644 (file)
@@ -23,7 +23,7 @@
 #include "ardour/plugin_insert.h"
 #include "ardour/vst_plugin.h"
 
-#include "plugin_ui.h"
+#include "vst_pluginui.h"
 
 #include <gdk/gdkx.h>
 
@@ -35,17 +35,16 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
        : 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());
 
@@ -61,11 +60,10 @@ 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
@@ -138,41 +136,48 @@ VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket)
 }
 
 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);
-
-       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);
        }
 }