From bf034f48cefc5bca164a3358151bfbce07a4857b Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Mon, 11 Aug 2014 12:57:48 -0500 Subject: [PATCH] New track header layout. Vertical alignment no longer depends on number of meters shown. Looking for comments. --- gtk2_ardour/route_time_axis.cc | 31 +++++++++++++------------------ gtk2_ardour/time_axis_view.cc | 25 +++++++++++++++++++------ gtk2_ardour/time_axis_view.h | 2 ++ 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index d54d1949eb..5fa2e6989e 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -105,7 +105,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCan , playlist_action_menu (0) , mode_menu (0) , color_mode_menu (0) - , gm (sess, true, 125, 18) + , gm (sess, true, 75, 20) , _ignore_set_layer_display (false) { number_label.set_name("tracknumber label"); @@ -178,7 +178,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) break; } - controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (*rec_enable_button, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); if (is_midi_track()) { ARDOUR_UI::instance()->set_tip(*rec_enable_button, _("Record (Right-click for Step Edit)")); @@ -200,7 +200,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) Gtk::VBox *mtrbox = manage(new Gtk::VBox()); mtrbox->pack_start(gm.get_level_meter(), false, false, 2); - controls_hbox.pack_start(*mtrbox, false, false, 4); + controls_hbox.pack_end(*mtrbox, false, false, 4); mtrbox->show(); _route->meter_change.connect (*this, invalidator (*this), bind (&RouteTimeAxisView::meter_changed, this), gui_context()); @@ -208,17 +208,17 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) _route->output()->changed.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::io_changed, this, _1, _2), gui_context()); _route->track_number_changed.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::label_view, this), gui_context()); - controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (*mute_button, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); if (!_route->is_master()) { - controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (*solo_button, 2, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); } if (!ARDOUR::Profile->get_trx()) { - controls_table.attach (route_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); - controls_table.attach (gm.get_gain_slider(), 0, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::AttachOptions (0), 3, 0); + controls_table.attach (route_group_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + name_table.attach (gm.get_gain_slider(), 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 2); } - + ARDOUR_UI::instance()->set_tip(*solo_button,_("Solo")); ARDOUR_UI::instance()->set_tip(*mute_button,_("Mute")); ARDOUR_UI::instance()->set_tip(route_group_button, _("Route Group")); @@ -233,11 +233,11 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) label_view (); if (!ARDOUR::Profile->get_trx()) { - controls_table.attach (automation_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.attach (automation_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); } if (!ARDOUR::Profile->get_trx() && is_track() && track()->mode() == ARDOUR::Normal) { - controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.attach (playlist_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); } _y_position = -1; @@ -368,18 +368,13 @@ RouteTimeAxisView::update_track_number_visibility () if (number_label.get_parent()) { controls_table.remove (number_label); } - if (name_hbox.get_parent()) { - controls_table.remove (name_hbox); - } if (show_label) { - controls_table.attach (number_label, 0, 1, 0, 1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND, 3, 0); - controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0); + controls_table.resize ( 2, 4 ); + controls_table.attach (number_label, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); number_label.set_size_request(3 + _session->track_number_decimals() * 8, -1); - name_hbox.show (); number_label.show (); } else { - controls_table.attach (name_hbox, 0, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0); - name_hbox.show (); + controls_table.resize ( 2, 3 ); number_label.hide (); } } diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index a5d91c7bc2..b8be4955f8 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -72,7 +72,8 @@ PBD::Signal1 TimeAxisView::CatchDeletion; TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/) : AxisView (sess) - , controls_table (2, 8) + , controls_table (2, 3) + , name_table (2, 1) , _name_editing (false) , height (0) , display_menu (0) @@ -114,28 +115,32 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie name_label.set_name ("TrackLabel"); name_label.set_alignment (0.0, 0.5); + name_label.set_width_chars (12); ARDOUR_UI::instance()->set_tip (name_label, _("Track/Bus name (double click to edit)")); Gtk::Entry* an_entry = new Gtk::Entry; Gtk::Requisition req; an_entry->size_request (req); name_label.set_size_request (-1, req.height); + name_label.set_ellipsize (Pango::ELLIPSIZE_MIDDLE); delete an_entry; name_hbox.pack_start (name_label, true, true); name_hbox.show (); name_label.show (); - - controls_table.set_size_request (200); + controls_table.set_row_spacings (2); controls_table.set_col_spacings (2); controls_table.set_border_width (2); controls_table.set_homogeneous (true); - controls_table.attach (name_hbox, 0, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0); controls_table.show_all (); controls_table.set_no_show_all (); + name_table.attach (name_hbox, 0, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0); + name_table.show_all (); + name_table.set_no_show_all (); + HSeparator* separator = manage (new HSeparator()); separator->set_name("TrackSeparator"); separator->set_size_request(-1, 1); @@ -144,7 +149,13 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie controls_vbox.pack_start (controls_table, false, false); controls_vbox.show (); - controls_hbox.pack_start (controls_vbox, true, true); + name_vbox.pack_start (name_table, false, false); + name_vbox.show (); + + controls_hbox.pack_start (controls_vbox, false, false); + controls_hbox.show (); + + controls_hbox.pack_start (name_vbox, true, true); controls_hbox.show (); //controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected"); @@ -590,6 +601,8 @@ TimeAxisView::begin_name_edit () name_entry = manage (new Gtkmm2ext::FocusEntry); + name_entry->set_width_chars(15); + name_entry->set_name ("EditorTrackNameDisplay"); name_entry->signal_key_press_event().connect (sigc::mem_fun (*this, &TimeAxisView::name_entry_key_press), false); name_entry->signal_key_release_event().connect (sigc::mem_fun (*this, &TimeAxisView::name_entry_key_release), false); @@ -601,7 +614,7 @@ TimeAxisView::begin_name_edit () name_hbox.remove (name_label); } - name_hbox.pack_start (*name_entry); + name_hbox.pack_start (*name_entry, false, false); name_entry->show (); name_entry->select_region (0, -1); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index c2c7f7db53..2560005a89 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -203,8 +203,10 @@ class TimeAxisView : public virtual AxisView /* The Standard LHS Controls */ Gtk::HBox controls_hbox; Gtk::Table controls_table; + Gtk::Table name_table; Gtk::EventBox controls_ebox; Gtk::VBox controls_vbox; + Gtk::VBox name_vbox; Gtk::VBox time_axis_vbox; Gtk::HBox name_hbox; Gtk::Label name_label;