X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fplugin_ui.cc;h=cb00cff41ef79133a1e1babeccaa827d6b3a4441;hb=d9fcab88f01f7ada6f52482f1ee60fc41c91235c;hp=011151e29b3c668d21edb54173d0be6e81d5c12a;hpb=1f5ebc54853446a786925941bd014666e75221d2;p=ardour.git diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 011151e29b..cb00cff41e 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -70,7 +70,9 @@ #include "processor_box.h" #include "keyboard.h" #include "latency_gui.h" +#include "plugin_dspload_ui.h" #include "plugin_eq_gui.h" +#include "timers.h" #include "new_plugin_preset_dialog.h" #include "pbd/i18n.h" @@ -83,6 +85,7 @@ using namespace PBD; using namespace Gtkmm2ext; using namespace Gtk; + PluginUIWindow::PluginUIWindow ( boost::shared_ptr insert, bool scrollable, @@ -429,12 +432,12 @@ PluginUIWindow::on_key_release_event (GdkEventKey *event) if (_pluginui->non_gtk_gui()) { _pluginui->forward_key_event (event); } - return true; } - return false; } else { - return true; + gtk_window_propagate_key_event (GTK_WINDOW(gobj()), event); } + /* don't forward releases */ + return true; } void @@ -460,9 +463,11 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi) , pin_management_button (_("Pinout")) , description_expander (_("Description")) , plugin_analysis_expander (_("Plugin analysis")) + , cpuload_expander (_("CPU Profile")) , latency_gui (0) , latency_dialog (0) , eqgui (0) + , stats_gui (0) { _preset_modified.set_size_request (16, -1); _preset_combo.set_text("(default)"); @@ -520,6 +525,9 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi) plugin_analysis_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_plugin_analysis)); plugin_analysis_expander.set_expanded(false); + cpuload_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_cpuload_display)); + cpuload_expander.set_expanded(false); + insert->DropReferences.connect (death_connection, invalidator (*this), boost::bind (&PlugUIBase::plugin_going_away, this), gui_context()); plugin->PresetAdded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ()); @@ -535,6 +543,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi) PlugUIBase::~PlugUIBase() { delete eqgui; + delete stats_gui; delete latency_gui; } @@ -549,8 +558,8 @@ PlugUIBase::plugin_going_away () void PlugUIBase::set_latency_label () { - framecnt_t const l = insert->effective_latency (); - framecnt_t const sr = insert->session().frame_rate (); + samplecnt_t const l = insert->effective_latency (); + samplecnt_t const sr = insert->session().sample_rate (); string t; @@ -567,7 +576,7 @@ void PlugUIBase::latency_button_clicked () { if (!latency_gui) { - latency_gui = new LatencyGUI (*(insert.get()), insert->session().frame_rate(), insert->session().get_block_size()); + latency_gui = new LatencyGUI (*(insert.get()), insert->session().sample_rate(), insert->session().get_block_size()); latency_dialog = new ArdourWindow (_("Edit Latency")); /* use both keep-above and transient for to try cover as many different WM's as possible. @@ -774,11 +783,9 @@ PlugUIBase::toggle_description() wr.height -= child_height; toplevel->resize (wr.width, wr.height); } - } } - void PlugUIBase::toggle_plugin_analysis() { @@ -813,6 +820,37 @@ PlugUIBase::toggle_plugin_analysis() } } +void +PlugUIBase::toggle_cpuload_display() +{ + if (cpuload_expander.get_expanded() && !cpuload_expander.get_child()) { + if (stats_gui == 0) { + stats_gui = new PluginLoadStatsGui (insert); + } + cpuload_expander.add (*stats_gui); + cpuload_expander.show_all(); + stats_gui->start_updating (); + } + + if (!cpuload_expander.get_expanded()) { + const int child_height = cpuload_expander.get_child ()->get_height (); + + stats_gui->hide (); + stats_gui->stop_updating (); + cpuload_expander.remove(); + + Gtk::Window *toplevel = (Gtk::Window*) cpuload_expander.get_ancestor (GTK_TYPE_WINDOW); + + if (toplevel) { + Gtk::Requisition wr; + toplevel->get_size (wr.width, wr.height); + wr.height -= child_height; + toplevel->resize (wr.width, wr.height); + } + } + +} + void PlugUIBase::update_preset_list () {