Restore snap when switching to/from internal.
This commit is contained in:
parent
6031308520
commit
66870ddf09
@ -670,6 +670,11 @@ Editor::Editor ()
|
||||
set_snap_mode (_snap_mode);
|
||||
previous_mouse_mode = MouseObject;
|
||||
set_mouse_mode (MouseObject, true);
|
||||
pre_internal_mouse_mode = MouseObject;
|
||||
pre_internal_snap_type = _snap_type;
|
||||
pre_internal_snap_mode = _snap_mode;
|
||||
internal_snap_type = _snap_type;
|
||||
internal_snap_mode = _snap_mode;
|
||||
set_edit_point_preference (EditAtMouse, true);
|
||||
|
||||
_playlist_selector = new PlaylistSelector();
|
||||
@ -2087,6 +2092,12 @@ Editor::set_snap_mode (SnapMode mode)
|
||||
{
|
||||
string str = snap_mode_strings[(int)mode];
|
||||
|
||||
if (internal_editing()) {
|
||||
internal_snap_mode = mode;
|
||||
} else {
|
||||
pre_internal_snap_mode = mode;
|
||||
}
|
||||
|
||||
_snap_mode = mode;
|
||||
|
||||
if (str != snap_mode_selector.get_text ()) {
|
||||
@ -2238,6 +2249,22 @@ Editor::set_state (const XMLNode& node, int /*version*/)
|
||||
snap_mode_selection_done((SnapMode) string_2_enum (prop->value(), _snap_mode));
|
||||
}
|
||||
|
||||
if ((prop = node.property ("internal-snap-to"))) {
|
||||
internal_snap_type = (SnapType) string_2_enum (prop->value(), internal_snap_type);
|
||||
}
|
||||
|
||||
if ((prop = node.property ("internal-snap-mode"))) {
|
||||
internal_snap_mode = (SnapMode) string_2_enum (prop->value(), internal_snap_mode);
|
||||
}
|
||||
|
||||
if ((prop = node.property ("pre-internal-snap-to"))) {
|
||||
pre_internal_snap_type = (SnapType) string_2_enum (prop->value(), pre_internal_snap_type);
|
||||
}
|
||||
|
||||
if ((prop = node.property ("pre-internal-snap-mode"))) {
|
||||
pre_internal_snap_mode = (SnapMode) string_2_enum (prop->value(), pre_internal_snap_mode);
|
||||
}
|
||||
|
||||
if ((prop = node.property ("mouse-mode"))) {
|
||||
MouseMode m = str2mousemode(prop->value());
|
||||
set_mouse_mode (m, true);
|
||||
@ -2429,6 +2456,10 @@ Editor::get_state ()
|
||||
node->add_property ("zoom", buf);
|
||||
node->add_property ("snap-to", enum_2_string (_snap_type));
|
||||
node->add_property ("snap-mode", enum_2_string (_snap_mode));
|
||||
node->add_property ("internal-snap-to", enum_2_string (internal_snap_type));
|
||||
node->add_property ("internal-snap-mode", enum_2_string (internal_snap_mode));
|
||||
node->add_property ("pre-internal-snap-to", enum_2_string (pre_internal_snap_type));
|
||||
node->add_property ("pre-internal-snap-mode", enum_2_string (pre_internal_snap_mode));
|
||||
node->add_property ("edit-point", enum_2_string (_edit_point));
|
||||
snprintf (buf, sizeof(buf), "%d", _visible_track_count);
|
||||
node->add_property ("visible-track-count", buf);
|
||||
|
@ -545,6 +545,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
|
||||
Editing::MouseMode mouse_mode;
|
||||
Editing::MouseMode previous_mouse_mode;
|
||||
Editing::MouseMode pre_internal_mouse_mode;
|
||||
Editing::SnapType pre_internal_snap_type;
|
||||
Editing::SnapMode pre_internal_snap_mode;
|
||||
Editing::SnapType internal_snap_type;
|
||||
Editing::SnapMode internal_snap_mode;
|
||||
Editing::MouseMode effective_mouse_mode () const;
|
||||
|
||||
enum JoinObjectRangeState {
|
||||
|
@ -293,16 +293,28 @@ Editor::mouse_mode_toggled (MouseMode m)
|
||||
}
|
||||
|
||||
if (mouse_mode == m) {
|
||||
/* switch "in to" the same mode, act like a toggle and switch back to previous mode */
|
||||
/* switch to the same mode, act like a toggle and switch back to previous mode */
|
||||
Glib::RefPtr<Action> pact = get_mouse_mode_action(previous_mouse_mode);
|
||||
Glib::RefPtr<ToggleAction> ptact = Glib::RefPtr<ToggleAction>::cast_dynamic(pact);
|
||||
ptact->set_active(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool was_internal = internal_editing();
|
||||
|
||||
previous_mouse_mode = mouse_mode;
|
||||
mouse_mode = m;
|
||||
|
||||
if (!was_internal && internal_editing()) {
|
||||
/* switched to internal, switch to internal snap settings */
|
||||
set_snap_to(internal_snap_type);
|
||||
set_snap_mode(internal_snap_mode);
|
||||
} else if (was_internal && !internal_editing()) {
|
||||
/* switched out of internal, switch to non-internal snap settings */
|
||||
set_snap_to(pre_internal_snap_type);
|
||||
set_snap_mode(pre_internal_snap_mode);
|
||||
}
|
||||
|
||||
instant_save ();
|
||||
|
||||
/* this should generate a new enter event which will
|
||||
|
Loading…
Reference in New Issue
Block a user