X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fvst_pluginui.cc;h=b3942235fd28a59d22fb52df770b4d16ef9ab977;hb=b461bc1dc1970a9e147c43a721d3155f6215f8c7;hp=a31187264eb085624300c5a4a8f21f8089264aab;hpb=a4b8955f3eb87405ceafe5c8680d9439f441458e;p=ardour.git diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index a31187264e..b3942235fd 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -1,5 +1,5 @@ /* - 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 @@ -20,10 +20,10 @@ #include #include #include -#include "ardour/insert.h" +#include "ardour/plugin_insert.h" #include "ardour/vst_plugin.h" -#include "plugin_ui.h" +#include "vst_pluginui.h" #include @@ -35,22 +35,22 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr 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 (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 () @@ -60,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 @@ -84,12 +83,12 @@ VSTPluginUI::package (Gtk::Window& win) { /* 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()); @@ -137,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); + 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); } } @@ -180,7 +186,7 @@ static Display *the_gtk_display; 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) {