static global definition for track-header width
[ardour.git] / gtk2_ardour / time_axis_view.cc
index 4dc34b1129fcd1c16b457100d008526b362c3262..13b0546d46ff4d1febd18abe2f22e0c8b3780d01 100644 (file)
@@ -36,6 +36,8 @@
 #include "canvas/rectangle.h"
 #include "canvas/debug.h"
 
+#include "ardour/profile.h"
+
 #include "ardour_ui.h"
 #include "ardour_dialog.h"
 #include "global_signals.h"
@@ -68,11 +70,13 @@ 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>();
 
 TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
        : AxisView (sess)
-       , controls_table (4, 4)
+       , controls_table (3, 3)
        , controls_button_size_group (Gtk::SizeGroup::create (Gtk::SIZE_GROUP_BOTH))
        , _name_editing (false)
        , height (0)
@@ -95,6 +99,9 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        , _have_preresize_cursor (false)
        , _ebox_release_can_act (true)
 {
+       if (!controls_meters_size_group) {
+               controls_meters_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
+       }
        if (extra_height == 0) {
                compute_heights ();
        }
@@ -126,7 +133,10 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        delete an_entry;
 
        name_hbox.pack_end (name_label, true, true);
-       name_hbox.set_size_request(100, 0); // XXX min header width (if fader is not visible)
+
+       // set min. track-header width if fader is not visible
+       name_hbox.set_size_request(name_width_px, 0);
+
        name_hbox.show ();
        name_label.show ();
 
@@ -134,7 +144,11 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        controls_table.set_col_spacings (2);
        controls_table.set_border_width (2);
 
-       controls_table.attach (name_hbox, 4, 5, 0, 2,  Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+       if (ARDOUR::Profile->get_mixbus() ) {
+               controls_table.attach (name_hbox, 4, 5, 0, 2,  Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+       } else {
+               controls_table.attach (name_hbox, 1, 2, 0, 2,  Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+       }
        controls_table.show_all ();
        controls_table.set_no_show_all ();
 
@@ -144,7 +158,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        top_hbox.pack_start (controls_vbox, true, true);
        top_hbox.show ();
 
-       //controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
        controls_ebox.add (top_hbox);
        controls_ebox.add_events (Gdk::BUTTON_PRESS_MASK|
                                  Gdk::BUTTON_RELEASE_MASK|
@@ -162,10 +175,19 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
        controls_ebox.signal_leave_notify_event().connect (sigc::mem_fun (*this, &TimeAxisView::controls_ebox_leave));
        controls_ebox.show ();
 
-       time_axis_frame.set_shadow_type (Gtk::SHADOW_OUT);
+       time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE);
        time_axis_frame.add(controls_ebox);
        time_axis_frame.show();
 
+       HSeparator* separator = manage (new HSeparator());
+       separator->set_name("TrackSeparator");
+       separator->set_size_request(-1, 1);
+       separator->show();
+
+       time_axis_vbox.pack_start (time_axis_frame, true, true);
+       time_axis_vbox.pack_end (*separator, false, false);
+       time_axis_vbox.show();
+
        ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler));
 
        GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&TimeAxisView::erase_ghost, this, _1), gui_context());
@@ -214,7 +236,7 @@ TimeAxisView::hide ()
        _canvas_display->hide ();
 
        if (control_parent) {
-               control_parent->remove (time_axis_frame);
+               control_parent->remove (time_axis_vbox);
                control_parent = 0;
        }
 
@@ -246,11 +268,11 @@ guint32
 TimeAxisView::show_at (double y, int& nth, VBox *parent)
 {
        if (control_parent) {
-               control_parent->reorder_child (time_axis_frame, nth);
+               control_parent->reorder_child (time_axis_vbox, nth);
        } else {
                control_parent = parent;
-               parent->pack_start (time_axis_frame, false, false);
-               parent->reorder_child (time_axis_frame, nth);
+               parent->pack_start (time_axis_vbox, false, false);
+               parent->reorder_child (time_axis_vbox, nth);
        }
 
        _order = nth;
@@ -508,7 +530,7 @@ TimeAxisView::set_height (uint32_t h)
                h = preset_height (HeightSmall);
        }
 
-       time_axis_frame.property_height_request () = h;
+       time_axis_vbox.property_height_request () = h;
        height = h;
 
        char buf[32];
@@ -755,11 +777,13 @@ TimeAxisView::set_selected (bool yn)
                time_axis_frame.set_name ("MixerStripSelectedFrame");
                controls_ebox.set_name (controls_base_selected_name);
                controls_vbox.set_name (controls_base_selected_name);
+               time_axis_vbox.set_name (controls_base_selected_name);
        } else {
-               time_axis_frame.set_shadow_type (Gtk::SHADOW_OUT);
+               time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE);
                time_axis_frame.set_name (controls_base_unselected_name);
                controls_ebox.set_name (controls_base_unselected_name);
                controls_vbox.set_name (controls_base_unselected_name);
+               time_axis_vbox.set_name (controls_base_unselected_name);
 
                hide_selection ();
 
@@ -1093,7 +1117,7 @@ TimeAxisView::compute_heights ()
 {
        // TODO this function should be re-evaluated when font-scaling changes (!)
        Gtk::Window window (Gtk::WINDOW_TOPLEVEL);
-       Gtk::Table one_row_table (1, 8);
+       Gtk::Table one_row_table (1, 1);
        ArdourButton* test_button = manage (new ArdourButton);
        const int border_width = 2;
        const int frame_height = 2;