X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginlv2gui.C;h=fd9a6f51174b1a42fad30b5d5b61abd5ff713916;hp=9e17f9cd8e5da8bb57f7e3865cefb2656021097d;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hpb=803cf48f8f7ee246eb5473e55fc2125e8b398250;ds=sidebyside diff --git a/cinelerra-5.1/cinelerra/pluginlv2gui.C b/cinelerra-5.1/cinelerra/pluginlv2gui.C index 9e17f9cd..fd9a6f51 100644 --- a/cinelerra-5.1/cinelerra/pluginlv2gui.C +++ b/cinelerra-5.1/cinelerra/pluginlv2gui.C @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#ifdef HAVE_LV2 #include "clip.h" #include "cstrdup.h" @@ -29,6 +30,7 @@ #include "pluginlv2config.h" #include "pluginlv2gui.h" #include "pluginserver.h" +#include "preferences.h" #include "samples.h" #include @@ -68,7 +70,7 @@ PluginLV2ClientReset:: int PluginLV2ClientReset::handle_event() { PluginLV2Client *client = gui->client; - client->config.init_lv2(client->lilv); + client->config.init_lv2(client->lilv, client); client->config.update(); client->update_lv2(); gui->update(0); @@ -210,12 +212,8 @@ void PluginLV2ClientWindow::create_objects() BC_Title *title; int x = 10, y = 10, x1; add_subwindow(title = new BC_Title(x, y, client->title)); -#ifdef HAVE_LV2UI x1 = get_w() - BC_GenericButton::calculate_w(this, _("UI")) - 8; - add_subwindow(ui = new PluginLV2ClientUI(this, x1, y)); -#else - ui = 0; -#endif + add_subwindow(client_ui = new PluginLV2ClientUI(this, x1, y)); y += title->get_h() + 10; add_subwindow(varbl = new BC_Title(x, y, "")); add_subwindow(range = new BC_Title(x+160, y, "")); @@ -231,7 +229,6 @@ void PluginLV2ClientWindow::create_objects() add_subwindow(slider = new PluginLV2ClientSlider(this, x1, y+10)); y += pot->get_h() + 10; - client->init_lv2(); client->load_configuration(); client->config.update(); @@ -242,15 +239,19 @@ void PluginLV2ClientWindow::create_objects() add_subwindow(panel); panel->update(); show_window(1); + + if( client->server->mwindow->preferences->autostart_lv2ui ) { + client_ui->disable(); + PluginLV2ParentUI *ui = get_ui(); + ui->show(); + } } int PluginLV2ClientWindow::resize_event(int w, int h) { int x1; -#ifdef HAVE_LV2UI - x1 = w - ui->get_w() - 8; - ui->reposition_window(x1, ui->get_y()); -#endif + x1 = w - client_ui->get_w() - 8; + client_ui->reposition_window(x1, client_ui->get_y()); x1 = w - reset->get_w() - 8; reset->reposition_window(x1, reset->get_y()); x1 = w - apply->get_w() - 8; @@ -271,10 +272,8 @@ void PluginLV2ClientWindow::update_selected() if( !selected ) return; PluginLV2ParentUI *ui = find_ui(); if( !ui ) return; - control_bfr_t ctl_bfr; - ctl_bfr.idx = selected->idx; - ctl_bfr.value = selected->get_value(); - ui->send_child(LV2_SET, &ctl_bfr, sizeof(ctl_bfr)); + PluginLV2ClientConfig &conf = client->config; + ui->send_child(LV2_UPDATE, conf.ctls, sizeof(float)*conf.nb_ports); } int PluginLV2ClientWindow::scalar(float f, char *rp) @@ -313,7 +312,10 @@ void PluginLV2ClientWindow::update(PluginLV2Client_Opt *opt) cp += sprintf(cp, " )"); float v = opt->get_value(); sprintf(val, "%f", v); + float p = (max-min) / slider->get_w(); + slider->set_precision(p); slider->update(slider->get_w(), v, min, max); + pot->set_precision(p); pot->update(v, min, max); } else { @@ -353,3 +355,11 @@ void PluginLV2ClientWindow::lv2_set(int idx, float val) lv2_update(); } +void PluginLV2ClientWindow::lv2_ui_enable() +{ + lock_window("PluginLV2ClientWindow::lv2_update"); + client_ui->enable(); + unlock_window(); +} + +#endif