update number label geometry
authorRobin Gareus <robin@gareus.org>
Thu, 4 Sep 2014 01:09:38 +0000 (03:09 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 4 Sep 2014 01:09:38 +0000 (03:09 +0200)
the number label can be significantly wider than other
ctrl buttons and does not lend itself or be 'square'.

gtk2_ardour/route_time_axis.cc
gtk2_ardour/time_axis_view.cc

index c6e2689021125bfbe01368760aaadaf5918c8601..800ed96ca95a08f77ead1e51435f8cc30d0a33fb 100644 (file)
@@ -257,7 +257,6 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        playlist_button.set_tweaks(ArdourButton::Square);
        automation_button.set_tweaks(ArdourButton::Square);
        route_group_button.set_tweaks(ArdourButton::Square);
-       number_label.set_tweaks(ArdourButton::Square);
 
        if (is_midi_track()) {
                ARDOUR_UI::instance()->set_tip(automation_button, _("MIDI Controllers and Automation"));
@@ -419,17 +418,21 @@ RouteTimeAxisView::update_track_number_visibility ()
        }
        if (show_label) {
                if (ARDOUR::Profile->get_mixbus()) {
-                       controls_table.attach (number_label, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 1, 0);
+                       controls_table.attach (number_label, 3, 4, 0, 1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND, 1, 0);
                } else {
-                       controls_table.attach (number_label, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 1, 0);
+                       controls_table.attach (number_label, 0, 1, 0, 1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND, 1, 0);
                }
-               const int tnw = 9 + std::max(2u, _session->track_number_decimals()) * number_label.char_pixel_width();
+               // see ArdourButton::on_size_request(), we should probably use a global size-group here instead.
+               // except the width of the number label is subtracted from the name-hbox, so we
+               // need to explictly calculate it anyway until the name-label & entry become ArdourWidgets.
+               int tnw = (2 + std::max(2u, _session->track_number_decimals())) * number_label.char_pixel_width();
+               if (tnw & 1) --tnw;
                number_label.set_size_request(tnw, -1);
                number_label.show ();
-               name_hbox.set_size_request(TimeAxisView::name_width_px - 2 - tnw, 0); // -2 = cellspacing
+               name_hbox.set_size_request(TimeAxisView::name_width_px - 2 - tnw, -1); // -2 = cellspacing
        } else {
                number_label.hide ();
-               name_hbox.set_size_request(TimeAxisView::name_width_px, 0);
+               name_hbox.set_size_request(TimeAxisView::name_width_px, -1);
        }
 }
 
index 31b5e2f145447713e79b47783df3d5a104eec710..a30e024f9ae1b325374de5d8ea070ffcaa2a4399 100644 (file)
@@ -135,7 +135,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        name_hbox.pack_end (name_label, true, true);
 
        // set min. track-header width if fader is not visible
-       name_hbox.set_size_request(name_width_px, 0);
+       name_hbox.set_size_request(name_width_px, -1);
 
        name_hbox.show ();
        name_label.show ();