put JACK time master option into Session -> Properties -> Timecode, and fully remove...
[ardour.git] / gtk2_ardour / vst_pluginui.cc
index 8de5ebe63b48cf5e9244c2120d79c2b2267bd0ee..8548c535d7bcd125d69b0cb788a7e2807c4ed848 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)
 {
-       update_presets ();
-
        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 (add_button, false, false);
-       preset_box.pack_end (preset_combo, false, false);
+       preset_box.pack_end (_preset_box, false, false);
 
        bypass_button.set_active (!insert->active());
 
@@ -61,22 +60,10 @@ VSTPluginUI::~VSTPluginUI ()
 }
 
 void
-VSTPluginUI::setting_selected ()
+VSTPluginUI::preset_selected ()
 {
-       int const r = preset_combo.get_active_row_number ();
-
-       if (r < vst->first_user_preset_index()) {
-               /* This is a plugin-provided preset.
-                  We can't dispatch directly here; too many plugins expects only one GUI thread.
-               */
-               vst->fst()->want_program = r;
-       } else {
-               /* This is a user preset.  This method knows about the direct dispatch restriction, too */
-               plugin->load_preset (preset_combo.get_active_text());
-       }
-       
        socket.grab_focus ();
-       update_sensitivity ();
+       PlugUIBase::preset_selected ();
 }
 
 int
@@ -148,6 +135,52 @@ VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket)
        return false;
 }
 
+void
+VSTPluginUI::forward_key_event (GdkEventKey* ev)
+{
+       if (ev->type == GDK_KEY_PRESS) {
+
+               FST* fst = vst->fst ();
+               pthread_mutex_lock (&fst->lock);
+
+               if (fst->n_pending_keys == (sizeof (fst->pending_keys) * sizeof (FSTKey))) {
+                       /* buffer full */
+                       return;
+               }
+
+               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;
+               }
+
+               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);
+       }
+}
+
 typedef int (*error_handler_t)( Display *, XErrorEvent *);
 static Display *the_gtk_display;
 static error_handler_t wine_error_handler;