diff options
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 56 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 5 |
4 files changed, 47 insertions, 19 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index ede62d8d9b..59d09093c6 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6187,7 +6187,7 @@ Editor::set_track_height (Height h) TrackSelection& ts (selection->tracks); for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) { - (*x)->set_height (h); + (*x)->set_height_enum (h); } } diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 4ec62f5fcc..00007bab58 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -442,6 +442,9 @@ RouteTimeAxisView::build_display_menu () items.push_back (MenuElem (_("Color..."), sigc::mem_fun(*this, &RouteTimeAxisView::select_track_color))); + build_size_menu (); + items.push_back (MenuElem (_("Height"), *_size_menu)); + items.push_back (SeparatorElem()); if (!Profile->get_sae()) { diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 6dc1382c3d..136f6a85ba 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -75,6 +75,7 @@ PBD::Signal1<void,TimeAxisView*> TimeAxisView::CatchDeletion; TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/) : AxisView (sess), controls_table (2, 8), + _size_menu (0), _y_position (0), _editor (ed), _order (0) @@ -216,6 +217,8 @@ TimeAxisView::~TimeAxisView() delete display_menu; display_menu = 0; + + delete _size_menu; } /** Display this TimeAxisView as the nth component of the parent box, at y. @@ -386,25 +389,25 @@ TimeAxisView::step_height (bool bigger) if (bigger) { if (height == preset_height(HeightSmall)) { - set_height (preset_height(HeightSmaller)); + set_height_enum (HeightSmaller); } else if (height == preset_height(HeightSmaller)) { - set_height (preset_height(HeightNormal)); + set_height_enum (HeightNormal); } else { set_height (height + step); } } else { - if ( height == preset_height(HeightSmall)){ + if (height == preset_height (HeightSmall)) { return; } if (height <= preset_height (HeightSmaller) && height > preset_height (HeightSmall)) { - set_height (preset_height(HeightSmall)); + set_height_enum (HeightSmall); } - else if ( height <= preset_height (HeightNormal) && height > preset_height (HeightSmaller)){ - set_height (preset_height(HeightSmaller)); + else if (height <= preset_height (HeightNormal) && height > preset_height (HeightSmaller)) { + set_height_enum (HeightSmaller); } else { set_height (height - step); @@ -423,7 +426,7 @@ TimeAxisView::set_heights (uint32_t h) } void -TimeAxisView::set_height (Height h) +TimeAxisView::set_height_enum (Height h) { set_height (preset_height (h)); } @@ -493,7 +496,7 @@ TimeAxisView::name_entry_key_release (GdkEventKey* ev) /* resize to show editable name display */ if ((*i)->current_height() <= preset_height (HeightSmaller)) { - (*i)->set_height (HeightSmaller); + (*i)->set_height_enum (HeightSmaller); } (*i)->name_entry.grab_focus(); @@ -1016,20 +1019,20 @@ TimeAxisView::set_state (const XMLNode& node, int /*version*/) if ((prop = node.property ("track-height")) != 0) { if (prop->value() == "largest") { - set_height (HeightLargest); + set_height_enum (HeightLargest); } else if (prop->value() == "large") { - set_height (HeightLarge); + set_height_enum (HeightLarge); } else if (prop->value() == "larger") { - set_height (HeightLarger); + set_height_enum (HeightLarger); } else if (prop->value() == "normal") { - set_height (HeightNormal); + set_height_enum (HeightNormal); } else if (prop->value() == "smaller") { - set_height (HeightSmaller); + set_height_enum (HeightSmaller); } else if (prop->value() == "small") { - set_height (HeightSmall); + set_height_enum (HeightSmall); } else { error << string_compose(_("unknown track height name \"%1\" in XML GUI information"), prop->value()) << endmsg; - set_height (HeightNormal); + set_height_enum (HeightNormal); } } else if ((prop = node.property ("height")) != 0) { @@ -1038,14 +1041,14 @@ TimeAxisView::set_state (const XMLNode& node, int /*version*/) } else { - set_height (HeightNormal); + set_height_enum (HeightNormal); } return 0; } void -TimeAxisView::reset_height() +TimeAxisView::reset_height () { set_height (height); @@ -1344,4 +1347,23 @@ TimeAxisView::get_child_list () return c; } +void +TimeAxisView::build_size_menu () +{ + if (_size_menu) { + return; + } + + using namespace Menu_Helpers; + _size_menu = new Menu; + _size_menu->set_name ("ArdourContextMenu"); + MenuList& items = _size_menu->items(); + + items.push_back (MenuElem (_("Largest"), sigc::bind (sigc::mem_fun (*this, &TimeAxisView::set_height_enum), HeightLargest))); + items.push_back (MenuElem (_("Larger"), sigc::bind (sigc::mem_fun (*this, &TimeAxisView::set_height_enum), HeightLarger))); + items.push_back (MenuElem (_("Large"), sigc::bind (sigc::mem_fun (*this, &TimeAxisView::set_height_enum), HeightLarge))); + items.push_back (MenuElem (_("Normal"), sigc::bind (sigc::mem_fun (*this, &TimeAxisView::set_height_enum), HeightNormal))); + items.push_back (MenuElem (_("Smaller"), sigc::bind (sigc::mem_fun (*this, &TimeAxisView::set_height_enum), HeightSmaller))); + items.push_back (MenuElem (_("Small"), sigc::bind (sigc::mem_fun (*this, &TimeAxisView::set_height_enum), HeightSmall))); +} diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index b376ba2aba..55553fafe9 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -149,7 +149,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful virtual void exited () {} virtual void set_height (uint32_t h); - void set_height (Height); + void set_height_enum (Height); void reset_height(); std::pair<TimeAxisView*, ARDOUR::layer_t> covers_y_position (double); @@ -310,6 +310,9 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful void conditionally_add_to_selection (); + void build_size_menu (); + Gtk::Menu* _size_menu; + ArdourCanvas::Group* _canvas_display; double _y_position; PublicEditor& _editor; |