static global definition for track-header width
authorRobin Gareus <robin@gareus.org>
Tue, 2 Sep 2014 16:12:39 +0000 (18:12 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 2 Sep 2014 16:12:39 +0000 (18:12 +0200)
the track-header minimum width is defined by
the name-label (IFF the 2nd row fader is not visible,
but the fader is rather small by default and and grows)

track-header width in almost all cases is:
   name-label width
 + width of three button (1 char each)
 + max size of all meters (if visible)
 + width of MIDI scroomer (if visible)
 + 2px table cellspacing (per column)

gtk2_ardour/route_time_axis.cc
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h

index 95a58013b449b176c19eed4db1bafc1ee876976a..53124723ef19a5e2d23753ee237ac91d6d739685 100644 (file)
@@ -432,10 +432,11 @@ RouteTimeAxisView::update_track_number_visibility ()
                const int tnw = std::max(2u, _session->track_number_decimals()) * 8; // TODO 8 = max_width_of_digit_0_to_9()
                number_label.set_size_request(3 + tnw, -1);
                number_label.show ();
-               name_hbox.set_size_request(95 - tnw, 0);
+               // -5 = -2 for table border - 3 for padding ^^
+               name_hbox.set_size_request(TimeAxisView::name_width_px - 5 - tnw, 0);
        } else {
                number_label.hide ();
-               name_hbox.set_size_request(100, 0);
+               name_hbox.set_size_request(TimeAxisView::name_width_px, 0);
        }
 }
 
index 2ac021f4cb63b2b75a1cc5ad48a73128a6080728..13b0546d46ff4d1febd18abe2f22e0c8b3780d01 100644 (file)
@@ -70,6 +70,7 @@ const double trim_handle_size = 6.0; /* pixels */
 uint32_t TimeAxisView::button_height = 0;
 uint32_t TimeAxisView::extra_height = 0;
 int const TimeAxisView::_max_order = 512;
+unsigned int TimeAxisView::name_width_px = 100; // TODO adjust with font-scaling on style-change
 PBD::Signal1<void,TimeAxisView*> TimeAxisView::CatchDeletion;
 Glib::RefPtr<Gtk::SizeGroup> TimeAxisView::controls_meters_size_group = Glib::RefPtr<Gtk::SizeGroup>();
 
@@ -134,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(100, 0);
+       name_hbox.set_size_request(name_width_px, 0);
 
        name_hbox.show ();
        name_label.show ();
index 90c05761c085f496d623880a534af741c7a002e8..bfdcf9f4f114c3c9f73ea4e2bd87c6da9cfbbc73 100644 (file)
@@ -201,6 +201,7 @@ class TimeAxisView : public virtual AxisView
 
        protected:
        static Glib::RefPtr<Gtk::SizeGroup> controls_meters_size_group;
+       static unsigned int name_width_px;
        /* The Standard LHS Controls */
        Gtk::Table             controls_table;
        Glib::RefPtr<Gtk::SizeGroup> controls_button_size_group;