#include "widgets/tooltips.h"
#include "plugin_ui.h"
+#include "plugin_display.h"
#include "gui_thread.h"
#include "automation_controller.h"
#include "gain_meter.h"
main_contents.pack_start (*constraint_hbox, false, false);
- if (is_scrollable) {
- Gtk::ScrolledWindow *scroller = manage (new Gtk::ScrolledWindow());
- scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
- scroller->set_name ("PluginEditor");
- scroller->add (hpacker);
- main_contents.pack_start (*scroller, true, true);
- } else {
- main_contents.pack_start (hpacker, false, false);
- }
-
pi->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr<Processor>(pi)), gui_context());
bypass_button.set_active (!pi->enabled());
+ /* ScrolledWindow will wrap hpacker in a Viewport */
+ scroller.add (hpacker);
+ Viewport* view = static_cast<Viewport*>(scroller.get_child());
+ view->set_shadow_type(Gtk::SHADOW_NONE);
+
+ main_contents.pack_start (scroller, true, true);
+
prefheight = 0;
build ();
+ if (is_scrollable) {
+ scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+ scroller.set_name ("PluginEditor");
+ } else {
+ scroller.signal_size_request().connect (sigc::mem_fun(*this, &GenericPluginUI::scroller_size_request));
+ scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER);
+ }
+
+
/* Listen for property changes that are not notified normally because
* AutomationControl has only support for numeric values currently.
* The only case is Variant::PATH for now */
}
}
+void
+GenericPluginUI::scroller_size_request (Gtk::Requisition* a)
+{
+ Glib::RefPtr<Gdk::Screen> screen = get_screen();
+ if (!screen)
+ screen = Gdk::Screen::get_default();
+
+ int maximum_width;
+ {
+ Gdk::Rectangle monitor;
+ const int monitor_num = screen->get_monitor_at_window (get_window ());
+ screen->get_monitor_geometry (
+ (monitor_num < 0) ? 0 : monitor_num,
+ monitor);
+
+ maximum_width = monitor.get_width() * 0.9;
+ }
+
+ GtkRequisition request = hpacker.size_request();
+
+ if (request.width > maximum_width) {
+ for (vector<ControlUI*>::const_iterator cuip = input_controls.begin();
+ cuip != input_controls.end();
+ ++cuip) {
+ if (!(*cuip)->short_autostate)
+ set_short_autostate(*cuip, true);
+ }
+ request = hpacker.size_request();
+ }
+
+ a->width = min(request.width, maximum_width);
+}
+
// Some functions for calculating the 'similarity' of two plugin
// control labels.
} else {
delete output_table;
}
+
+ if (plugin->has_inline_display () && plugin->inline_display_in_gui ()) {
+ PluginDisplay* pd = manage (new PluginDisplay (plugin, 300));
+ hpacker.pack_end (*pd, true, true);
+ }
show_all();
}
layout->attach (*cui, cui->x0, cui->x1, cui->y0, cui->y1, FILL, SHRINK, 2, 2);
}
hpacker.pack_start (*layout, true, true);
+
+ if (plugin->has_inline_display () && plugin->inline_display_in_gui ()) {
+ PluginDisplay* pd = manage (new PluginDisplay (plugin, 300));
+ hpacker.pack_end (*pd, true, true);
+ }
}
GenericPluginUI::ControlUI::ControlUI (const Evoral::Parameter& p)
automate_button.set_name ("plugin automation state button");
set_tooltip (automate_button, _("Automation control"));
- /* XXX translators: use a string here that will be at least as long
- as the longest automation label (see ::automation_state_changed()
- below). be sure to include a descender.
- */
-
- automate_button.set_sizing_text(_("Mgnual"));
-
ignore_change = false;
update_pending = false;
button = false;
}
}
+void
+GenericPluginUI::set_short_autostate (ControlUI* cui, bool value)
+{
+ cui->short_autostate = value;
+ if (value) {
+ cui->automate_button.set_sizing_text("M");
+ } else {
+ /* XXX translators: use a string here that will be at least as long
+ as the longest automation label (see ::automation_state_changed()
+ below). be sure to include a descender. */
+ cui->automate_button.set_sizing_text(_("Mgnual"));
+ }
+ automation_state_changed(cui);
+}
+
void
GenericPluginUI::automation_state_changed (ControlUI* cui)
{
cui->automate_button.set_active((state != ARDOUR::Off));
- if (cui->knobtable) {
+ if (cui->short_autostate) {
cui->automate_button.set_text (
GainMeterBase::astate_string (state));
return;
control_ui->label.set_alignment (0.0, 0.5);
control_ui->label.set_name ("PluginParameterLabel");
control_ui->set_spacing (5);
+ set_short_autostate(control_ui, false);
if (is_input) {
}
if (use_knob) {
- control_ui->automate_button.set_sizing_text("M");
+ set_short_autostate(control_ui, true);
control_ui->label.set_alignment (0.5, 0.5);
control_ui->knobtable = manage (new Table());