X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftime_axis_view.cc;h=2923f630761454ab405a0511dd7fd8817c0d28c1;hb=4167e83972331e8a5be08c76cc3dccd409c6ac5e;hp=ca6cd887ced536a29ef43379ea9aa77ecf8a1397;hpb=098a6980520183796f3c2faac6262224a6b0b4b3;p=ardour.git diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index ca6cd887ce..2923f63076 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -66,16 +66,19 @@ using namespace Editing; using namespace ArdourCanvas; using Gtkmm2ext::Keyboard; +#define TOP_LEVEL_WIDGET controls_ebox + 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 TimeAxisView::CatchDeletion; -Glib::RefPtr TimeAxisView::controls_meters_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL); +Glib::RefPtr TimeAxisView::controls_meters_size_group = Glib::RefPtr(); 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) @@ -98,14 +101,23 @@ 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 (); } - _canvas_display = new ArdourCanvas::Container (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0)); + _canvas_display = new ArdourCanvas::Container (ed.get_trackview_group (), ArdourCanvas::Duple (1.0, 0.0)); CANVAS_DEBUG_NAME (_canvas_display, "main for TAV"); _canvas_display->hide(); // reveal as needed + _canvas_separator = new ArdourCanvas::Line(ed.get_trackview_group ()); + CANVAS_DEBUG_NAME (_canvas_separator, "separator for TAV"); + _canvas_separator->set_outline_color(RGBA_TO_UINT (0, 0, 0, 255)); + _canvas_separator->set_outline_width(1.0); + _canvas_separator->hide(); + selection_group = new ArdourCanvas::Container (_canvas_display); CANVAS_DEBUG_NAME (selection_group, "selection for TAV"); selection_group->set_data (X_("timeselection"), (void *) 1); @@ -131,11 +143,8 @@ 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 - if (ARDOUR::Profile->get_mixbus() ) { - name_hbox.set_size_request(100, 0); - } else { - name_hbox.set_size_request(90, 0); - } + name_hbox.set_size_request(name_width_px, -1); + name_hbox.show (); name_label.show (); @@ -144,9 +153,9 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie controls_table.set_border_width (2); if (ARDOUR::Profile->get_mixbus() ) { - controls_table.attach (name_hbox, 4, 5, 0, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (name_hbox, 4, 5, 0, 2, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK, 0, 0); } else { - controls_table.attach (name_hbox, 1, 2, 0, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (name_hbox, 1, 2, 0, 2, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK, 0, 0); } controls_table.show_all (); controls_table.set_no_show_all (); @@ -157,8 +166,7 @@ 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 (time_axis_hbox); controls_ebox.add_events (Gdk::BUTTON_PRESS_MASK| Gdk::BUTTON_RELEASE_MASK| Gdk::POINTER_MOTION_MASK| @@ -175,10 +183,21 @@ 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.add(controls_ebox); + time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE); + time_axis_frame.add(top_hbox); 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 (*separator, false, false); + time_axis_vbox.pack_start (time_axis_frame, true, true); + time_axis_vbox.show(); + time_axis_hbox.pack_start (time_axis_vbox, true, true); + time_axis_hbox.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()); @@ -211,6 +230,9 @@ TimeAxisView::~TimeAxisView() delete _canvas_display; _canvas_display = 0; + delete _canvas_separator; + _canvas_separator = 0; + delete display_menu; display_menu = 0; @@ -225,9 +247,10 @@ TimeAxisView::hide () } _canvas_display->hide (); + _canvas_separator->hide (); if (control_parent) { - control_parent->remove (time_axis_frame); + control_parent->remove (TOP_LEVEL_WIDGET); control_parent = 0; } @@ -259,24 +282,27 @@ 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 (TOP_LEVEL_WIDGET, nth); } else { control_parent = parent; - parent->pack_start (time_axis_frame, false, false); - parent->reorder_child (time_axis_frame, nth); + parent->pack_start (TOP_LEVEL_WIDGET, false, false); + parent->reorder_child (TOP_LEVEL_WIDGET, nth); } _order = nth; if (_y_position != y) { - _canvas_display->set_y_position (y); + _canvas_separator->set (ArdourCanvas::Duple(0, y), ArdourCanvas::Duple(ArdourCanvas::COORD_MAX, y)); + _canvas_display->set_y_position (y + 1); _y_position = y; - } _canvas_display->raise_to_top (); _canvas_display->show (); + _canvas_separator->raise_to_top (); + _canvas_separator->show (); + _hidden = false; _effective_height = current_height (); @@ -521,7 +547,7 @@ TimeAxisView::set_height (uint32_t h) h = preset_height (HeightSmall); } - time_axis_frame.property_height_request () = h; + TOP_LEVEL_WIDGET.property_height_request () = h; height = h; char buf[32]; @@ -757,6 +783,10 @@ TimeAxisView::popup_display_menu (guint32 when) void TimeAxisView::set_selected (bool yn) { + if (can_edit_name() && name_entry && name_entry->get_visible()) { + end_name_edit (RESPONSE_CANCEL); + } + if (yn == _selected) { return; } @@ -768,11 +798,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 (); @@ -873,7 +905,7 @@ TimeAxisView::show_selection (TimeSelection& ts) // trim boxes are at the top for selections if (x2 > x1) { - rect->start_trim->set (ArdourCanvas::Rect (x1, 1, x1 + trim_handle_size, y2)); + rect->start_trim->set (ArdourCanvas::Rect (x1, 0, x1 + trim_handle_size, y2)); rect->end_trim->set (ArdourCanvas::Rect (x2 - trim_handle_size, 1, x2, y2)); rect->start_trim->show(); @@ -1106,7 +1138,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; @@ -1115,6 +1147,7 @@ TimeAxisView::compute_heights () window.add (one_row_table); test_button->set_name ("mute button"); test_button->set_text (_("M")); + test_button->set_tweaks (ArdourButton::TrackHeader); one_row_table.set_border_width (border_width); one_row_table.set_row_spacings (2);