Re-add height menu to tracks (#3761).

git-svn-id: svn://localhost/ardour2/branches/3.0@8872 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-02-16 17:59:28 +00:00
parent ccc8facdc7
commit 738b2b85f5
4 changed files with 47 additions and 19 deletions

View File

@ -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);
}
}

View File

@ -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()) {

View File

@ -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)));
}

View File

@ -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;