_item->grab ();
- if (event->motion.state & Keyboard::PrimaryModifier) {
+ if (event->motion.state & Keyboard::note_size_relative_modifier ()) {
relative = false;
} else {
relative = true;
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");
}
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);
} 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);
}
}
+ 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);
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) {
ar->set_fade_out_active(true);
}
}
+ if (_jump_position_when_done) {
+ i->view->region()->set_position (i->initial_end - i->view->region()->length());
+ }
}
}
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;
}
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;
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;
}
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 ();
}
{
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;
}
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;
Operation _operation;
bool _preserve_fade_anchor;
+ bool _jump_position_when_done;
};
/** Meter marker drag */
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:")));
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);
}
}
+ 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());
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;
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; }
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;
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
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;
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);
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", ¬e_size_relative_mod);
+ }
+
if ((prop = node.property ("insert-note-button")) != 0) {
sscanf (prop->value().c_str(), "%d", &insert_note_but);
}
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)
{