Use explicit strip widths and button heights for the mixer
authorBen Loftis <ben@harrisonconsoles.com>
Wed, 6 Aug 2014 20:47:22 +0000 (15:47 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Wed, 6 Aug 2014 20:47:22 +0000 (15:47 -0500)
The goal is to preserve a consistent layout and sizing of the buttons.
Button height should not resize based on text, because font styles differ and this leads to inconsistent button heights
Button width should not be based on text or font size;  instead, font size just determines how many chars will be visible in the button
There are some elements of the editor page which _do_ scale based on the text width, and thats probably sensible because the text is predefined, and needs to fit

gtk2_ardour/mixer_strip.cc

index 41d04e417e4f0a89f3928b0f8da3de3504bcccbf..68044d47e53a0444e0e34c0b14ebae50401657f6 100644 (file)
@@ -167,21 +167,14 @@ MixerStrip::init ()
        input_button.set_name ("mixer strip button");
        input_button.set_size_request (-1, 20);
        input_button_box.pack_start (input_button, true, true);
        input_button.set_name ("mixer strip button");
        input_button.set_size_request (-1, 20);
        input_button_box.pack_start (input_button, true, true);
-       Gtkmm2ext::set_height_request_to_display_any_text (input_button, _button_vpad);
 
        output_button.set_text (_("Output"));
        output_button.set_name ("mixer strip button");
 
        output_button.set_text (_("Output"));
        output_button.set_name ("mixer strip button");
-       Gtkmm2ext::set_size_request_to_display_given_text (output_button, longest_label.c_str(), 4, 4);
-       Gtkmm2ext::set_height_request_to_display_any_text (output_button, _button_vpad);
+       output_button.set_size_request (-1, 20);
 
        ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Click to select metering point"), "");
        meter_point_button.set_name ("mixer strip button");
 
 
        ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Click to select metering point"), "");
        meter_point_button.set_name ("mixer strip button");
 
-       /* TRANSLATORS: this string should be longest of the strings
-          used to describe meter points. In english, it's "input".
-       */
-       set_size_request_to_display_given_text_width (meter_point_button, _("tupni"), 2, _button_vpad);
-
        bottom_button_table.attach (meter_point_button, 2, 3, 0, 1);
 
        meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
        bottom_button_table.attach (meter_point_button, 2, 3, 0, 1);
 
        meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
@@ -267,15 +260,14 @@ MixerStrip::init ()
        name_button.layout()->set_ellipsize (Pango::ELLIPSIZE_END);
        name_button.signal_size_allocate().connect (sigc::mem_fun (*this, &MixerStrip::name_button_resized));
        name_button.set_size_request (-1, 20);
        name_button.layout()->set_ellipsize (Pango::ELLIPSIZE_END);
        name_button.signal_size_allocate().connect (sigc::mem_fun (*this, &MixerStrip::name_button_resized));
        name_button.set_size_request (-1, 20);
-       Gtkmm2ext::set_height_request_to_display_any_text (name_button, _button_vpad);
 
        ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
        group_button.set_name ("mixer strip button");
 
        ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
        group_button.set_name ("mixer strip button");
-       Gtkmm2ext::set_size_request_to_display_given_text_width (group_button, "Grp", 2, _button_vpad);
+       group_button.set_size_request (-1, 20);
 
        _comment_button.set_name (X_("mixer strip button"));
        _comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
 
        _comment_button.set_name (X_("mixer strip button"));
        _comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
-       Gtkmm2ext::set_size_request_to_display_given_text_width (_comment_button, "Cmt", 2, _button_vpad);
+       _comment_button.set_size_request (-1, 20);
 
        global_vpacker.set_border_width (1);
        global_vpacker.set_spacing (0);
 
        global_vpacker.set_border_width (1);
        global_vpacker.set_spacing (0);
@@ -717,9 +709,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
                }
 
 
                }
 
 
-               Gtkmm2ext::set_size_request_to_display_given_text_width (name_button, longest_label.c_str(), 2, _button_vpad);
                set_size_request (max (110, gpm.get_gm_width()+5), -1);
                set_size_request (max (110, gpm.get_gm_width()+5), -1);
-//             set_size_request (-1, -1);
                break;
 
        case Narrow:
                break;
 
        case Narrow:
@@ -741,8 +731,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
                        panners.short_astate_string(_route->panner()->automation_state()));
                }
 
                        panners.short_astate_string(_route->panner()->automation_state()));
                }
 
-               Gtkmm2ext::set_size_request_to_display_given_text_width (name_button, "long", 2, _button_vpad);
-               set_size_request (max (50, gpm.get_gm_width()), -1);
+               set_size_request (max (60, gpm.get_gm_width() + 10), -1);
                break;
        }
 
                break;
        }
 
@@ -1378,8 +1367,6 @@ MixerStrip::setup_comment_button ()
                _comment_button, _route->comment().empty() ? _("Click to Add/Edit Comments") : _route->comment()
                );
 
                _comment_button, _route->comment().empty() ? _("Click to Add/Edit Comments") : _route->comment()
                );
 
-       Gtkmm2ext::set_size_request_to_display_given_text_width (
-               _comment_button, _comment_button.get_text().c_str(), 2, _button_vpad);
 }
 
 bool
 }
 
 bool
@@ -1587,9 +1574,6 @@ MixerStrip::name_changed ()
                break;
        }
 
                break;
        }
 
-       Gtkmm2ext::set_size_request_to_display_given_text_width (
-               name_button, name_button.get_text().c_str(), 2, _button_vpad);
-
        ARDOUR_UI::instance()->set_tip (name_button, _route->name());
 }
 
        ARDOUR_UI::instance()->set_tip (name_button, _route->name());
 }
 
@@ -1995,18 +1979,6 @@ MixerStrip::set_button_names ()
        } else {
                meter_point_button.set_text ("");
        }
        } else {
                meter_point_button.set_text ("");
        }
-
-       // Update size request of changed buttons
-       Gtkmm2ext::set_size_request_to_display_given_text_width (
-               *rec_enable_button, rec_enable_button->get_text().c_str(), 2, _button_vpad);
-       Gtkmm2ext::set_size_request_to_display_given_text_width (
-               *mute_button, mute_button->get_text().c_str(), 2, _button_vpad);
-       Gtkmm2ext::set_size_request_to_display_given_text_width (
-               *monitor_input_button, monitor_input_button->get_text().c_str(), 2, _button_vpad);
-       Gtkmm2ext::set_size_request_to_display_given_text_width (
-               *monitor_disk_button, monitor_disk_button->get_text().c_str(), 2, _button_vpad);
-       Gtkmm2ext::set_size_request_to_display_given_text_width (
-               *solo_button, solo_button->get_text().c_str(), 2, _button_vpad);
 }
 
 PluginSelector*
 }
 
 PluginSelector*