GUI modifications to improve VCA strips and their placement in the mixer

Note that this includes some changes that actually make mixer pane settings get restored,
which has been broken for some time. Of course, they are not restored perfectly, yet.
This commit is contained in:
Paul Davis 2016-03-03 11:47:01 -05:00
parent c5c6be4170
commit 419c7e95f3
4 changed files with 126 additions and 28 deletions

View File

@ -243,8 +243,13 @@ Mixer_UI::Mixer_UI ()
list_vpacker.pack_start (rhs_pane2, true, true);
global_hpacker.pack_start (scroller, true, true);
global_hpacker.pack_start (vca_packer, false, false);
vca_scroller.add (vca_packer);
vca_scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
inner_pane.pack1 (scroller);
inner_pane.pack2 (vca_scroller);
global_hpacker.pack_start (inner_pane, true, true);
global_hpacker.pack_start (out_packer, false, false);
list_hpane.pack1(list_vpacker, false, true);
@ -256,6 +261,8 @@ Mixer_UI::Mixer_UI ()
static_cast<Gtk::Paned*> (&rhs_pane2)));
list_hpane.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler),
static_cast<Gtk::Paned*> (&list_hpane)));
inner_pane.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler),
static_cast<Gtk::Paned*> (&inner_pane)));
_content.pack_start (list_hpane, true, true);
@ -284,6 +291,8 @@ Mixer_UI::Mixer_UI ()
rhs_pane1.show();
rhs_pane2.show();
strip_packer.show();
inner_pane.show ();
vca_scroller.show();
vca_packer.show();
out_packer.show();
list_hpane.show();
@ -1858,9 +1867,13 @@ Mixer_UI::get_state ()
node->add_child_nocopy (Tabbable::get_state());
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (const_cast<GtkPaned*>(static_cast<const Paned*>(&rhs_pane1)->gobj())));
node->add_property(X_("mixer_rhs_pane1_pos"), string(buf));
node->add_property(X_("mixer-rhs-pane1-pos"), string(buf));
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (const_cast<GtkPaned*>(static_cast<const Paned*>(&rhs_pane2)->gobj())));
node->add_property(X_("mixer-rhs_pane2-pos"), string(buf));
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (const_cast<GtkPaned*>(static_cast<const Paned*>(&list_hpane)->gobj())));
node->add_property(X_("mixer_list_hpane_pos"), string(buf));
node->add_property(X_("mixer-list-hpane-pos"), string(buf));
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (const_cast<GtkPaned*>(static_cast<const Paned*>(&inner_pane)->gobj())));
node->add_property(X_("mixer-inner-pane-pos"), string(buf));
node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no");
node->add_property ("show-mixer", _visible ? "yes" : "no");
@ -1888,23 +1901,10 @@ void
Mixer_UI::pane_allocation_handler (Allocation&, Gtk::Paned* which)
{
int pos;
XMLProperty const * prop = 0;
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
XMLNode* geometry;
int height;
static int32_t done[3] = { 0, 0, 0 };
height = default_height;
if ((geometry = find_named_node (*node, "geometry")) != 0) {
if ((prop = geometry->property ("y_size")) == 0) {
prop = geometry->property ("y-size");
}
if (prop) {
height = atoi (prop->value());
}
}
XMLProperty* prop = 0;
XMLNode* geometry = ARDOUR_UI::instance()->mixer_settings();
int height = default_height;
static bool done[4] = { false, false, false, false };
if (which == static_cast<Gtk::Paned*> (&rhs_pane1)) {
@ -1918,7 +1918,7 @@ Mixer_UI::pane_allocation_handler (Allocation&, Gtk::Paned* which)
pos = atoi (prop->value());
}
if ((done[0] = GTK_WIDGET(rhs_pane1.gobj())->allocation.height > pos)) {
if ((done[0] = (GTK_WIDGET(rhs_pane1.gobj())->allocation.height > pos))) {
rhs_pane1.set_position (pos);
}
@ -1933,7 +1933,7 @@ Mixer_UI::pane_allocation_handler (Allocation&, Gtk::Paned* which)
pos = atoi (prop->value());
}
if ((done[1] = GTK_WIDGET(rhs_pane2.gobj())->allocation.height > pos)) {
if ((done[1] = (GTK_WIDGET(rhs_pane2.gobj())->allocation.height > pos))) {
rhs_pane2.set_position (pos);
}
} else if (which == static_cast<Gtk::Paned*> (&list_hpane)) {
@ -1948,11 +1948,31 @@ Mixer_UI::pane_allocation_handler (Allocation&, Gtk::Paned* which)
pos = max (36, atoi (prop->value ()));
}
if ((done[2] = GTK_WIDGET(list_hpane.gobj())->allocation.width > pos)) {
if ((done[2] = (GTK_WIDGET(list_hpane.gobj())->allocation.width > pos))) {
list_hpane.set_position (pos);
}
} else if (which == static_cast<Gtk::Paned*> (&inner_pane)) {
if (done[3]) {
return;
}
if (!geometry || (prop = geometry->property("mixer-inner-pane-pos")) == 0) {
cerr << "using default value\n";
pos = std::max ((float)100, rintf ((float) 125 * UIConfiguration::instance().get_ui_scale()));
} else {
cerr << "using " << prop->value() << endl;
pos = max (36, atoi (prop->value ()));
}
cerr << "Setting inner pane pos to " << pos << endl;
if ((done[3] = (GTK_WIDGET(inner_pane.gobj())->allocation.width > pos))) {
inner_pane.set_position (pos);
}
}
}
void
Mixer_UI::scroll_left ()
{

View File

@ -141,7 +141,9 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p
Gtk::Frame favorite_plugins_frame;
Gtk::VPaned rhs_pane1;
Gtk::VPaned rhs_pane2;
Gtk::HPaned inner_pane;
Gtk::HBox strip_packer;
Gtk::ScrolledWindow vca_scroller;
Gtk::HBox vca_packer;
Gtk::HBox out_packer;
Gtk::HPaned list_hpane;

View File

@ -16,11 +16,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pbd/convert.h"
#include "ardour/vca.h"
#include "tooltips.h"
#include "vca_master_strip.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace Gtkmm2ext;
using std::string;
VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
@ -33,13 +40,57 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
boost::shared_ptr<Amp>(),
_vca->control());
hide_button.set_icon (ArdourIcon::CloseCross);
set_tooltip (&hide_button, _("Hide this VCA strip"));
width_button.set_icon (ArdourIcon::StripWidth);
set_tooltip (width_button, _("Click to toggle the width of this VCA strip."));
width_button.signal_button_press_event().connect (sigc::mem_fun(*this, &VCAMasterStrip::width_button_pressed), false);
hide_button.signal_clicked.connect (sigc::mem_fun(*this, &VCAMasterStrip::hide_clicked));
width_hide_box.set_spacing (2);
width_hide_box.pack_start (width_button, false, true);
width_hide_box.pack_start (number_label, true, true);
width_hide_box.pack_end (hide_button, false, true);
number_label.set_text (PBD::to_string (v->number(), std::dec));
number_label.set_elements((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive));
number_label.set_no_show_all ();
number_label.set_name ("tracknumber label");
number_label.set_fixed_colors (0x80808080, 0x80808080);
number_label.set_alignment (.5, .5);
number_label.set_fallthrough_to_parent (true);
name_button.set_text (_vca->name());
active_button.set_text ("active");
pack_start (active_button, false, false);
pack_start (name_button, false, false);
pack_start (gain_meter, true, true);
top_padding.set_size_request (-1, 16); /* must match height in GroupTabs::set_size_request() */
bottom_padding.set_size_request (-1, 50); /* this one is a hack. there's no trivial way to compute it */
global_vpacker.set_border_width (1);
global_vpacker.set_spacing (0);
global_vpacker.pack_start (top_padding, false, false);
global_vpacker.pack_start (width_hide_box, false, false);
global_vpacker.pack_start (active_button, false, false);
global_vpacker.pack_start (name_button, false, false);
global_vpacker.pack_start (vertical_padding, true, true);
global_vpacker.pack_start (gain_meter, false, false);
global_vpacker.pack_start (bottom_padding, false, false);
global_frame.add (global_vpacker);
global_frame.set_shadow_type (Gtk::SHADOW_IN);
global_frame.set_name ("BaseFrame");
add (global_frame);
global_vpacker.show ();
global_frame.show ();
top_padding.show ();
bottom_padding.show ();
vertical_padding.show ();
width_hide_box.show_all ();
active_button.show_all ();
name_button.show_all ();
gain_meter.show_all ();
@ -50,3 +101,14 @@ VCAMasterStrip::name() const
{
return _vca->name();
}
void
VCAMasterStrip::hide_clicked ()
{
}
bool
VCAMasterStrip::width_button_pressed (GdkEventButton* ev)
{
return false;
}

View File

@ -32,7 +32,7 @@ namespace ARDOUR {
class VCA;
}
class VCAMasterStrip : public AxisView, public Gtk::VBox
class VCAMasterStrip : public AxisView, public Gtk::EventBox
{
public:
VCAMasterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::VCA>);
@ -43,9 +43,23 @@ class VCAMasterStrip : public AxisView, public Gtk::VBox
private:
boost::shared_ptr<ARDOUR::VCA> _vca;
Gtk::HBox vertical_padding;
ArdourButton name_button;
ArdourButton active_button;
GainMeter gain_meter;
Gtk::Frame global_frame;
Gtk::VBox global_vpacker;
Gtk::HBox top_padding;
Gtk::HBox bottom_padding;
ArdourButton width_button;
ArdourButton color_button;
ArdourButton hide_button;
ArdourButton number_label;
Gtk::HBox width_hide_box;
void hide_clicked();
bool width_button_pressed (GdkEventButton *);
};