Allow all drag -related modifiers to be set, re-instate "jump after trim"

- Copy modifier still doesn't save
	- Testers please edit the Extra section of ~/.ardourN/config to allow
	defaults to "take"
	- Note that the current defaults overlap.
	- warning - absolute snap modifier has no default and will be always
	"on" unless you set it!
This commit is contained in:
nick_m 2015-05-21 01:30:57 +10:00
parent 66221d1dea
commit ae0759ae88
5 changed files with 302 additions and 12 deletions

View File

@ -2352,7 +2352,7 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
_item->grab ();
if (event->motion.state & Keyboard::PrimaryModifier) {
if (event->motion.state & Keyboard::note_size_relative_modifier ()) {
relative = false;
} else {
relative = true;
@ -2592,6 +2592,7 @@ VideoTimeLineDrag::aborted (bool)
TrimDrag::TrimDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool preserve_fade_anchor)
: RegionDrag (e, i, p, v)
, _preserve_fade_anchor (preserve_fade_anchor)
, _jump_position_when_done (false)
{
DEBUG_TRACE (DEBUG::Drags, "New TrimDrag\n");
}
@ -2623,7 +2624,7 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
if (pf < (region_start + region_length/2)) {
/* closer to front */
_operation = StartTrim;
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::trim_anchored_modifier ())) {
Drag::start_grab (event, _editor->cursors()->anchored_left_side_trim);
} else {
Drag::start_grab (event, _editor->cursors()->left_side_trim);
@ -2631,7 +2632,7 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
} else {
/* closer to end */
_operation = EndTrim;
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::trim_anchored_modifier ())) {
Drag::start_grab (event, _editor->cursors()->anchored_right_side_trim);
} else {
Drag::start_grab (event, _editor->cursors()->right_side_trim);
@ -2639,6 +2640,10 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
}
}
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::trim_jump_modifier ())) {
_jump_position_when_done = true;
}
switch (_operation) {
case StartTrim:
show_verbose_cursor_time (region_start);
@ -2838,6 +2843,9 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
ar->set_fade_in_active(true);
}
}
if (_jump_position_when_done) {
i->view->region()->set_position (i->initial_position);
}
}
} else if (_operation == EndTrim) {
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
@ -2850,6 +2858,9 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
ar->set_fade_out_active(true);
}
}
if (_jump_position_when_done) {
i->view->region()->set_position (i->initial_end - i->view->region()->length());
}
}
}
@ -3724,7 +3735,7 @@ MarkerDrag::motion (GdkEvent* event, bool)
framepos_t const newframe = adjusted_current_frame (event);
framepos_t next = newframe;
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::push_points_modifier ())) {
move_both = true;
}
@ -3991,7 +4002,7 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction));
_pushing = Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier);
_pushing = Keyboard::modifier_state_contains (event->button.state, Keyboard::push_points_modifier ());
if (!_point->can_slide ()) {
_x_constrained = true;
@ -4004,7 +4015,7 @@ ControlPointDrag::motion (GdkEvent* event, bool)
double dx = _drags->current_pointer_x() - last_pointer_x();
double dy = current_pointer_y() - last_pointer_y();
if (event->button.state & Keyboard::SecondaryModifier) {
if (event->button.state & Keyboard::fine_adjust_modifier ()) {
dx *= 0.1;
dy *= 0.1;
}
@ -4059,7 +4070,7 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred)
if (!movement_occurred) {
/* just a click */
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask (Keyboard::PrimaryModifier | Keyboard::TertiaryModifier))) {
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask (Keyboard::TertiaryModifier))) {
_editor->reset_point_selection ();
}
@ -4143,7 +4154,7 @@ LineDrag::motion (GdkEvent* event, bool)
{
double dy = current_pointer_y() - last_pointer_y();
if (event->button.state & Keyboard::SecondaryModifier) {
if (event->button.state & Keyboard::fine_adjust_modifier ()) {
dy *= 0.1;
}
@ -4935,7 +4946,7 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
case CreateTransportMarker:
case CreateCDMarker:
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) {
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::CopyModifier)) {
_copy = true;
} else {
_copy = false;

View File

@ -654,6 +654,7 @@ private:
Operation _operation;
bool _preserve_fade_anchor;
bool _jump_position_when_done;
};
/** Meter marker drag */

View File

@ -477,6 +477,69 @@ public:
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
t->attach (_trim_contents_combo, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL);
++row;
col = 1;
/* anchored trim */
set_popdown_strings (_trim_anchored_combo, dumb);
_trim_anchored_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::trim_anchored_modifier_chosen));
for (int x = 0; modifiers[x].name; ++x) {
if (modifiers[x].modifier == (guint) Keyboard::trim_anchored_modifier ()) {
_trim_anchored_combo.set_active_text (S_(modifiers[x].name));
break;
}
}
l = manage (left_aligned_label (_("Anchored trim using:")));
l->set_name ("OptionsLabel");
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
++col;
t->attach (_trim_anchored_combo, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
++row;
col = 1;
/* jump trim */
set_popdown_strings (_trim_jump_combo, dumb);
_trim_jump_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::trim_jump_modifier_chosen));
for (int x = 0; modifiers[x].name; ++x) {
if (modifiers[x].modifier == (guint) Keyboard::trim_jump_modifier ()) {
_trim_jump_combo.set_active_text (S_(modifiers[x].name));
break;
}
}
l = manage (left_aligned_label (_("Jump after trim using:")));
l->set_name ("OptionsLabel");
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
++col;
t->attach (_trim_jump_combo, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
++row;
col = 1;
/* note resize relative */
set_popdown_strings (_note_size_relative_combo, dumb);
_note_size_relative_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::note_size_relative_modifier_chosen));
for (int x = 0; modifiers[x].name; ++x) {
if (modifiers[x].modifier == (guint) Keyboard::note_size_relative_modifier ()) {
_note_size_relative_combo.set_active_text (S_(modifiers[x].name));
break;
}
}
l = manage (left_aligned_label (_("Resize notes relatively using:")));
l->set_name ("OptionsLabel");
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
++col;
t->attach (_note_size_relative_combo, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
++row;
l = manage (left_aligned_label (_("While Dragging:")));
@ -550,6 +613,51 @@ public:
t->attach (_trim_overlap_combo, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL);
++row;
l = manage (left_aligned_label (_("While Dragging Control Points:")));
l->set_name ("OptionEditorHeading");
t->attach (*l, 0, 1, row, row + 1, FILL | EXPAND, FILL);
++row;
col = 1;
/* fine adjust */
set_popdown_strings (_fine_adjust_combo, dumb);
_fine_adjust_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::fine_adjust_modifier_chosen));
for (int x = 0; modifiers[x].name; ++x) {
if (modifiers[x].modifier == (guint) Keyboard::fine_adjust_modifier ()) {
_fine_adjust_combo.set_active_text (S_(modifiers[x].name));
break;
}
}
l = manage (left_aligned_label (_("Fine adjust using:")));
l->set_name ("OptionsLabel");
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
t->attach (_fine_adjust_combo, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL);
++row;
col = 1;
/* push points */
set_popdown_strings (_push_points_combo, dumb);
_push_points_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::push_points_modifier_chosen));
for (int x = 0; modifiers[x].name; ++x) {
if (modifiers[x].modifier == (guint) Keyboard::push_points_modifier ()) {
_push_points_combo.set_active_text (S_(modifiers[x].name));
break;
}
}
l = manage (left_aligned_label (_("Push points using:")));
l->set_name ("OptionsLabel");
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
t->attach (_push_points_combo, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL);
++row;
_box->pack_start (*t, false, false);
@ -678,6 +786,66 @@ private:
}
}
void trim_anchored_modifier_chosen ()
{
string const txt = _trim_anchored_combo.get_active_text();
for (int i = 0; modifiers[i].name; ++i) {
if (txt == _(modifiers[i].name)) {
Keyboard::set_trim_anchored_modifier (modifiers[i].modifier);
break;
}
}
}
void trim_jump_modifier_chosen ()
{
string const txt = _trim_jump_combo.get_active_text();
for (int i = 0; modifiers[i].name; ++i) {
if (txt == _(modifiers[i].name)) {
Keyboard::set_trim_jump_modifier (modifiers[i].modifier);
break;
}
}
}
void fine_adjust_modifier_chosen ()
{
string const txt = _fine_adjust_combo.get_active_text();
for (int i = 0; modifiers[i].name; ++i) {
if (txt == _(modifiers[i].name)) {
Keyboard::set_fine_adjust_modifier (modifiers[i].modifier);
break;
}
}
}
void push_points_modifier_chosen ()
{
string const txt = _push_points_combo.get_active_text();
for (int i = 0; modifiers[i].name; ++i) {
if (txt == _(modifiers[i].name)) {
Keyboard::set_push_points_modifier (modifiers[i].modifier);
break;
}
}
}
void note_size_relative_modifier_chosen ()
{
string const txt = _note_size_relative_combo.get_active_text();
for (int i = 0; modifiers[i].name; ++i) {
if (txt == _(modifiers[i].name)) {
Keyboard::set_note_size_relative_modifier (modifiers[i].modifier);
break;
}
}
}
void delete_button_changed ()
{
Keyboard::set_delete_button (_delete_button_spin.get_value_as_int());
@ -702,6 +870,11 @@ private:
ComboBoxText _snap_delta_combo;
ComboBoxText _trim_contents_combo;
ComboBoxText _trim_overlap_combo;
ComboBoxText _trim_anchored_combo;
ComboBoxText _trim_jump_combo;
ComboBoxText _fine_adjust_combo;
ComboBoxText _push_points_combo;
ComboBoxText _note_size_relative_combo;
Adjustment _delete_button_adjustment;
SpinButton _delete_button_spin;
Adjustment _edit_button_adjustment;

View File

@ -132,10 +132,35 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
static ModifierMask trim_contents_modifier () { return ModifierMask (trim_contents_mod); }
static void set_trim_overlap_modifier (guint);
/** @return Modifier mask to remove region overlaps after trim;
/** @return Modifier mask to remove region overlaps during trim;
*/
static ModifierMask trim_overlap_modifier () { return ModifierMask (trim_overlap_mod); }
static void set_trim_anchored_modifier (guint);
/** @return Modifier mask to use anchored trim;
*/
static ModifierMask trim_anchored_modifier () { return ModifierMask (trim_anchored_mod); }
static void set_fine_adjust_modifier (guint);
/** @return Modifier mask to fine adjust (control points only atm);
*/
static ModifierMask fine_adjust_modifier () { return ModifierMask (fine_adjust_mod); }
static void set_push_points_modifier (guint);
/** @return Modifier mask to push proceeding points;
*/
static ModifierMask push_points_modifier () { return ModifierMask (push_points_mod); }
static void set_note_size_relative_modifier (guint);
/** @return Modifier mask to resize notes relatively;
*/
static ModifierMask note_size_relative_modifier () { return ModifierMask (note_size_relative_mod); }
static void set_trim_jump_modifier (guint);
/** @return Modifier mask to jump position after trim;
*/
static ModifierMask trim_jump_modifier () { return ModifierMask (trim_jump_mod); }
static guint edit_button() { return edit_but; }
static void set_edit_button (guint);
static guint edit_modifier() { return edit_mod; }
@ -203,6 +228,11 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
static guint snap_delta_mod;
static guint trim_contents_mod;
static guint trim_overlap_mod;
static guint trim_anchored_mod;
static guint fine_adjust_mod;
static guint push_points_mod;
static guint note_size_relative_mod;
static guint trim_jump_mod;
static guint button2_modifiers;
static Gtk::Window* current_window;
static std::string user_keybindings_path;

View File

@ -60,8 +60,6 @@ guint Keyboard::insert_note_but = 1;
guint Keyboard::insert_note_mod = GDK_CONTROL_MASK;
guint Keyboard::snap_mod = GDK_MOD3_MASK;
guint Keyboard::snap_delta_mod = 0;
guint Keyboard::trim_contents_mod = 0;
guint Keyboard::trim_overlap_mod = 0;
#ifdef GTKOSX
@ -106,6 +104,13 @@ guint Keyboard::ScrollZoomVerticalModifier = Keyboard::SecondaryModifier;
guint Keyboard::ScrollZoomHorizontalModifier = Keyboard::PrimaryModifier;
guint Keyboard::ScrollHorizontalModifier = Keyboard::TertiaryModifier;
guint Keyboard::trim_contents_mod = Keyboard::PrimaryModifier;
guint Keyboard::trim_overlap_mod = Keyboard::TertiaryModifier;
guint Keyboard::trim_anchored_mod = Keyboard::TertiaryModifier;
guint Keyboard::trim_jump_mod = Keyboard::TertiaryModifier;
guint Keyboard::fine_adjust_mod = Keyboard::SecondaryModifier;
guint Keyboard::push_points_mod = Keyboard::PrimaryModifier;
guint Keyboard::note_size_relative_mod = Keyboard::PrimaryModifier;
Keyboard* Keyboard::_the_keyboard = 0;
Gtk::Window* Keyboard::current_window = 0;
@ -188,6 +193,16 @@ Keyboard::get_state (void)
node->add_property ("trim-contents-modifier", buf);
snprintf (buf, sizeof (buf), "%d", trim_overlap_mod);
node->add_property ("trim-overlap-modifier", buf);
snprintf (buf, sizeof (buf), "%d", trim_anchored_mod);
node->add_property ("trim-anchored-modifier", buf);
snprintf (buf, sizeof (buf), "%d", trim_jump_mod);
node->add_property ("trim-jump-modifier", buf);
snprintf (buf, sizeof (buf), "%d", fine_adjust_mod);
node->add_property ("fine-adjust-modifier", buf);
snprintf (buf, sizeof (buf), "%d", push_points_mod);
node->add_property ("push-points-modifier", buf);
snprintf (buf, sizeof (buf), "%d", note_size_relative_mod);
node->add_property ("note-size-relative-modifier", buf);
snprintf (buf, sizeof (buf), "%d", insert_note_but);
node->add_property ("insert-note-button", buf);
snprintf (buf, sizeof (buf), "%d", insert_note_mod);
@ -233,6 +248,26 @@ Keyboard::set_state (const XMLNode& node, int /*version*/)
sscanf (prop->value().c_str(), "%d", &trim_overlap_mod);
}
if ((prop = node.property ("trim-anchored-modifier")) != 0) {
sscanf (prop->value().c_str(), "%d", &trim_anchored_mod);
}
if ((prop = node.property ("trim-jump-modifier")) != 0) {
sscanf (prop->value().c_str(), "%d", &trim_jump_mod);
}
if ((prop = node.property ("fine-adjust-modifier")) != 0) {
sscanf (prop->value().c_str(), "%d", &fine_adjust_mod);
}
if ((prop = node.property ("push-points-modifier")) != 0) {
sscanf (prop->value().c_str(), "%d", &push_points_mod);
}
if ((prop = node.property ("note-size-relative-modifier")) != 0) {
sscanf (prop->value().c_str(), "%d", &note_size_relative_mod);
}
if ((prop = node.property ("insert-note-button")) != 0) {
sscanf (prop->value().c_str(), "%d", &insert_note_but);
}
@ -511,6 +546,46 @@ Keyboard::set_trim_overlap_modifier (guint mod)
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | trim_overlap_mod);
}
void
Keyboard::set_trim_anchored_modifier (guint mod)
{
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~trim_anchored_mod);
trim_anchored_mod = mod;
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | trim_anchored_mod);
}
void
Keyboard::set_trim_jump_modifier (guint mod)
{
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~trim_jump_mod);
trim_jump_mod = mod;
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | trim_jump_mod);
}
void
Keyboard::set_fine_adjust_modifier (guint mod)
{
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~fine_adjust_mod);
fine_adjust_mod = mod;
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | fine_adjust_mod);
}
void
Keyboard::set_push_points_modifier (guint mod)
{
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~push_points_mod);
push_points_mod = mod;
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | push_points_mod);
}
void
Keyboard::set_note_size_relative_modifier (guint mod)
{
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~note_size_relative_mod);
note_size_relative_mod = mod;
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | note_size_relative_mod);
}
bool
Keyboard::is_edit_event (GdkEventButton *ev)
{