ctrl-click on nudge buttons only moves playhead

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2926 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-01-16 23:49:33 +00:00
parent 73cc81a2f5
commit fd62d7aa3c
4 changed files with 42 additions and 16 deletions

View file

@ -1821,8 +1821,8 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
MenuList& nudge_items = nudge_menu->items();
nudge_menu->set_name ("ArdourContextMenu");
nudge_items.push_back (MenuElem (_("Nudge fwd"), (bind (mem_fun(*this, &Editor::nudge_forward), false))));
nudge_items.push_back (MenuElem (_("Nudge bwd"), (bind (mem_fun(*this, &Editor::nudge_backward), false))));
nudge_items.push_back (MenuElem (_("Nudge fwd"), (bind (mem_fun(*this, &Editor::nudge_forward), false, false))));
nudge_items.push_back (MenuElem (_("Nudge bwd"), (bind (mem_fun(*this, &Editor::nudge_backward), false, false))));
nudge_items.push_back (MenuElem (_("Nudge fwd by capture offset"), (mem_fun(*this, &Editor::nudge_forward_capture_offset))));
nudge_items.push_back (MenuElem (_("Nudge bwd by capture offset"), (mem_fun(*this, &Editor::nudge_backward_capture_offset))));
@ -2775,8 +2775,8 @@ Editor::setup_toolbar ()
nudge_box->set_spacing(1);
nudge_box->set_border_width (2);
nudge_forward_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::nudge_forward), false));
nudge_backward_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::nudge_backward), false));
nudge_forward_button.signal_button_release_event().connect (mem_fun(*this, &Editor::nudge_forward_release), false);
nudge_backward_button.signal_button_release_event().connect (mem_fun(*this, &Editor::nudge_backward_release), false);
nudge_box->pack_start (nudge_backward_button, false, false);
nudge_box->pack_start (nudge_forward_button, false, false);

View file

@ -286,8 +286,8 @@ class Editor : public PublicEditor
/* nudge is initiated by transport controls owned by ARDOUR_UI */
void nudge_forward (bool next);
void nudge_backward (bool next);
void nudge_forward (bool next, bool force_playhead);
void nudge_backward (bool next, bool force_playhead);
/* nudge initiated from context menu */
@ -1960,6 +1960,9 @@ class Editor : public PublicEditor
AudioClock nudge_clock;
nframes_t get_nudge_distance (nframes_t pos, nframes_t& next);
bool nudge_forward_release (GdkEventButton*);
bool nudge_backward_release (GdkEventButton*);
/* audio filters */

View file

@ -194,13 +194,13 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false));
act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), bind (mem_fun(*this, &Editor::nudge_forward), true));
act = ActionManager::register_action (editor_actions, "nudge-next-forward", _("Nudge Next Forward"), bind (mem_fun(*this, &Editor::nudge_forward), true, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-backward", _("Nudge Backward"), bind (mem_fun(*this, &Editor::nudge_backward), false));
act = ActionManager::register_action (editor_actions, "nudge-backward", _("Nudge Backward"), bind (mem_fun(*this, &Editor::nudge_backward), false, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), bind (mem_fun(*this, &Editor::nudge_backward), true));
act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), bind (mem_fun(*this, &Editor::nudge_backward), true, false));
ActionManager::session_sensitive_actions.push_back (act);

View file

@ -61,6 +61,7 @@
#include "editing.h"
#include "gtk-custom-hruler.h"
#include "gui_thread.h"
#include "keyboard.h"
#include "i18n.h"
@ -327,16 +328,38 @@ Editor::extend_selection_to_start_of_region (bool previous)
commit_reversible_command ();
}
bool
Editor::nudge_forward_release (GdkEventButton* ev)
{
if (ev->state & Keyboard::PrimaryModifier) {
nudge_forward (false, true);
} else {
nudge_forward (false, false);
}
return false;
}
bool
Editor::nudge_backward_release (GdkEventButton* ev)
{
if (ev->state & Keyboard::PrimaryModifier) {
nudge_backward (false, true);
} else {
nudge_backward (false, false);
}
return false;
}
void
Editor::nudge_forward (bool next)
Editor::nudge_forward (bool next, bool force_playhead)
{
nframes_t distance;
nframes_t next_distance;
if (!session) return;
if (!selection->regions.empty()) {
if (!force_playhead && !selection->regions.empty()) {
begin_reversible_command (_("nudge regions forward"));
@ -358,7 +381,7 @@ Editor::nudge_forward (bool next)
commit_reversible_command ();
} else if (!selection->markers.empty()) {
} else if (!force_playhead && !selection->markers.empty()) {
bool is_start;
Location* loc = find_location_from_marker (selection->markers.front(), is_start);
@ -402,14 +425,14 @@ Editor::nudge_forward (bool next)
}
void
Editor::nudge_backward (bool next)
Editor::nudge_backward (bool next, bool force_playhead)
{
nframes_t distance;
nframes_t next_distance;
if (!session) return;
if (!selection->regions.empty()) {
if (!force_playhead && !selection->regions.empty()) {
begin_reversible_command (_("nudge regions backward"));
@ -435,7 +458,7 @@ Editor::nudge_backward (bool next)
commit_reversible_command ();
} else if (!selection->markers.empty()) {
} else if (!force_playhead && !selection->markers.empty()) {
bool is_start;
Location* loc = find_location_from_marker (selection->markers.front(), is_start);