diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2017-08-26 23:32:02 -0500 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2017-08-26 23:32:02 -0500 |
commit | 7e300c93f22ec27f0ee1f4172d7c86e2bfef2062 (patch) | |
tree | c7b738493523cf7fcf52d70b9f9a2aa29ec51b53 /gtk2_ardour/editor_summary.cc | |
parent | 631629b8e7d3ca826fc55901653c1c795a8a5083 (diff) |
Editor zooming: right-click on summary -> context menu -> reset to session extents.
Diffstat (limited to 'gtk2_ardour/editor_summary.cc')
-rw-r--r-- | gtk2_ardour/editor_summary.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 728773e6b7..95b54cdf02 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -21,6 +21,9 @@ #include "canvas/debug.h" +#include <gtkmm/menu.h> +#include <gtkmm/menuitem.h> + #include "time_axis_view.h" #include "streamview.h" #include "editor_summary.h" @@ -35,6 +38,8 @@ #include "route_time_axis.h" #include "ui_config.h" +#include "pbd/i18n.h" + using namespace std; using namespace ARDOUR; using Gtkmm2ext::Keyboard; @@ -424,6 +429,8 @@ EditorSummary::on_key_release_event (GdkEventKey* key) return false; } +#include "gtkmm2ext/utils.h" + /** Handle a button press. * @param ev GTK event. */ @@ -432,6 +439,16 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) { _old_follow_playhead = _editor->follow_playhead (); + if (ev->button == 3) { //right-click: show the reset menu action + using namespace Gtk::Menu_Helpers; + Gtk::Menu* m = manage (new Gtk::Menu); + MenuList& items = m->items (); + items.push_back(MenuElem(_("Reset Summary to Extents"), + sigc::mem_fun(*this, &EditorSummary::reset_to_extents))); + m->popup (ev->button, ev->time); + return true; + } + if (ev->button != 1) { return true; } @@ -557,6 +574,18 @@ EditorSummary::get_position (double x, double y) const } void +EditorSummary::reset_to_extents() +{ + //reset as if the user never went anywhere outside the extents + _leftmost = max_framepos; + _rightmost = 0; + + _editor->temporal_zoom_extents (); + set_background_dirty (); +} + + +void EditorSummary::set_cursor (Position p) { switch (p) { |