mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-01 19:37:45 +01:00
fix up nudge for marker motion; make keyboard handling do the right thing when numlock is pressed and an un-modified key press event occurs
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2807 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
2315c433e2
commit
146e5baec2
2 changed files with 77 additions and 13 deletions
|
|
@ -338,7 +338,7 @@ Editor::nudge_forward (bool next)
|
|||
|
||||
if (!selection->regions.empty()) {
|
||||
|
||||
begin_reversible_command (_("nudge forward"));
|
||||
begin_reversible_command (_("nudge regions forward"));
|
||||
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
boost::shared_ptr<Region> r ((*i)->region());
|
||||
|
|
@ -360,12 +360,39 @@ Editor::nudge_forward (bool next)
|
|||
|
||||
} else if (!selection->markers.empty()) {
|
||||
|
||||
bool ignored;
|
||||
Location* loc = find_location_from_marker (selection->markers.front(), ignored);
|
||||
bool is_start;
|
||||
Location* loc = find_location_from_marker (selection->markers.front(), is_start);
|
||||
|
||||
if (loc) {
|
||||
distance = get_nudge_distance (loc->start(), next_distance);
|
||||
loc->set_start (loc->start() + distance);
|
||||
|
||||
begin_reversible_command (_("nudge location forward"));
|
||||
|
||||
XMLNode& before (loc->get_state());
|
||||
|
||||
if (is_start) {
|
||||
distance = get_nudge_distance (loc->start(), next_distance);
|
||||
if (next) {
|
||||
distance = next_distance;
|
||||
}
|
||||
if (max_frames - distance > loc->start() + loc->length()) {
|
||||
loc->set_start (loc->start() + distance);
|
||||
} else {
|
||||
loc->set_start (max_frames - loc->length());
|
||||
}
|
||||
} else {
|
||||
distance = get_nudge_distance (loc->end(), next_distance);
|
||||
if (next) {
|
||||
distance = next_distance;
|
||||
}
|
||||
if (max_frames - distance > loc->end()) {
|
||||
loc->set_end (loc->end() + distance);
|
||||
} else {
|
||||
loc->set_end (max_frames);
|
||||
}
|
||||
}
|
||||
XMLNode& after (loc->get_state());
|
||||
session->add_command (new MementoCommand<Location>(*loc, &before, &after));
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -384,7 +411,7 @@ Editor::nudge_backward (bool next)
|
|||
|
||||
if (!selection->regions.empty()) {
|
||||
|
||||
begin_reversible_command (_("nudge forward"));
|
||||
begin_reversible_command (_("nudge regions backward"));
|
||||
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
boost::shared_ptr<Region> r ((*i)->region());
|
||||
|
|
@ -408,6 +435,44 @@ Editor::nudge_backward (bool next)
|
|||
|
||||
commit_reversible_command ();
|
||||
|
||||
} else if (!selection->markers.empty()) {
|
||||
|
||||
bool is_start;
|
||||
Location* loc = find_location_from_marker (selection->markers.front(), is_start);
|
||||
|
||||
if (loc) {
|
||||
|
||||
begin_reversible_command (_("nudge location forward"));
|
||||
XMLNode& before (loc->get_state());
|
||||
|
||||
if (is_start) {
|
||||
distance = get_nudge_distance (loc->start(), next_distance);
|
||||
if (next) {
|
||||
distance = next_distance;
|
||||
}
|
||||
if (distance < loc->start()) {
|
||||
loc->set_start (loc->start() - distance);
|
||||
} else {
|
||||
loc->set_start (0);
|
||||
}
|
||||
} else {
|
||||
distance = get_nudge_distance (loc->end(), next_distance);
|
||||
|
||||
if (next) {
|
||||
distance = next_distance;
|
||||
}
|
||||
|
||||
if (distance < loc->end() - loc->length()) {
|
||||
loc->set_end (loc->end() - distance);
|
||||
} else {
|
||||
loc->set_end (loc->length());
|
||||
}
|
||||
}
|
||||
|
||||
XMLNode& after (loc->get_state());
|
||||
session->add_command (new MementoCommand<Location>(*loc, &before, &after));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
|
|||
GtkWidget* focus = gtk_window_get_focus (win);
|
||||
bool special_handling_of_unmodified_accelerators = false;
|
||||
|
||||
#undef DEBUG_ACCELERATOR_HANDLING
|
||||
#undef DEBUG_ACCELERATOR_HANDLING
|
||||
#ifdef DEBUG_ACCELERATOR_HANDLING
|
||||
bool debug = (getenv ("ARDOUR_DEBUG_ACCELERATOR_HANDLING") != 0);
|
||||
#endif
|
||||
|
|
@ -488,12 +488,11 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
|
|||
}
|
||||
}
|
||||
|
||||
if (!special_handling_of_unmodified_accelerators ||
|
||||
ev->state & (Gdk::MOD1_MASK|
|
||||
Gdk::MOD3_MASK|
|
||||
Gdk::MOD4_MASK|
|
||||
Gdk::MOD5_MASK|
|
||||
Gdk::CONTROL_MASK)) {
|
||||
/* consider all relevant modifiers but not LOCK or SHIFT */
|
||||
|
||||
guint mask = (Keyboard::RelevantModifierKeyMask & ~(Gdk::SHIFT_MASK|Gdk::LOCK_MASK));
|
||||
|
||||
if (!special_handling_of_unmodified_accelerators || (ev->state & mask)) {
|
||||
|
||||
/* no special handling or there are modifiers in effect: accelerate first */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue