mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Restore snap when switching to/from internal.
This commit is contained in:
parent
9cf18bd5f0
commit
11773e29da
3 changed files with 49 additions and 1 deletions
|
|
@ -668,6 +668,11 @@ Editor::Editor ()
|
||||||
set_snap_mode (_snap_mode);
|
set_snap_mode (_snap_mode);
|
||||||
previous_mouse_mode = MouseObject;
|
previous_mouse_mode = MouseObject;
|
||||||
set_mouse_mode (MouseObject, true);
|
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);
|
set_edit_point_preference (EditAtMouse, true);
|
||||||
|
|
||||||
_playlist_selector = new PlaylistSelector();
|
_playlist_selector = new PlaylistSelector();
|
||||||
|
|
@ -2080,6 +2085,12 @@ Editor::set_snap_mode (SnapMode mode)
|
||||||
{
|
{
|
||||||
string str = snap_mode_strings[(int)mode];
|
string str = snap_mode_strings[(int)mode];
|
||||||
|
|
||||||
|
if (internal_editing()) {
|
||||||
|
internal_snap_mode = mode;
|
||||||
|
} else {
|
||||||
|
pre_internal_snap_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
_snap_mode = mode;
|
_snap_mode = mode;
|
||||||
|
|
||||||
if (str != snap_mode_selector.get_text ()) {
|
if (str != snap_mode_selector.get_text ()) {
|
||||||
|
|
@ -2231,6 +2242,22 @@ Editor::set_state (const XMLNode& node, int /*version*/)
|
||||||
snap_mode_selection_done((SnapMode) string_2_enum (prop->value(), _snap_mode));
|
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"))) {
|
if ((prop = node.property ("mouse-mode"))) {
|
||||||
MouseMode m = str2mousemode(prop->value());
|
MouseMode m = str2mousemode(prop->value());
|
||||||
set_mouse_mode (m, true);
|
set_mouse_mode (m, true);
|
||||||
|
|
@ -2422,6 +2449,10 @@ Editor::get_state ()
|
||||||
node->add_property ("zoom", buf);
|
node->add_property ("zoom", buf);
|
||||||
node->add_property ("snap-to", enum_2_string (_snap_type));
|
node->add_property ("snap-to", enum_2_string (_snap_type));
|
||||||
node->add_property ("snap-mode", enum_2_string (_snap_mode));
|
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));
|
node->add_property ("edit-point", enum_2_string (_edit_point));
|
||||||
snprintf (buf, sizeof(buf), "%d", _visible_track_count);
|
snprintf (buf, sizeof(buf), "%d", _visible_track_count);
|
||||||
node->add_property ("visible-track-count", buf);
|
node->add_property ("visible-track-count", buf);
|
||||||
|
|
|
||||||
|
|
@ -541,6 +541,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
|
|
||||||
Editing::MouseMode mouse_mode;
|
Editing::MouseMode mouse_mode;
|
||||||
Editing::MouseMode previous_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;
|
Editing::MouseMode effective_mouse_mode () const;
|
||||||
|
|
||||||
enum JoinObjectRangeState {
|
enum JoinObjectRangeState {
|
||||||
|
|
|
||||||
|
|
@ -293,16 +293,28 @@ Editor::mouse_mode_toggled (MouseMode m)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouse_mode == 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<Action> pact = get_mouse_mode_action(previous_mouse_mode);
|
||||||
Glib::RefPtr<ToggleAction> ptact = Glib::RefPtr<ToggleAction>::cast_dynamic(pact);
|
Glib::RefPtr<ToggleAction> ptact = Glib::RefPtr<ToggleAction>::cast_dynamic(pact);
|
||||||
ptact->set_active(true);
|
ptact->set_active(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool was_internal = internal_editing();
|
||||||
|
|
||||||
previous_mouse_mode = mouse_mode;
|
previous_mouse_mode = mouse_mode;
|
||||||
mouse_mode = m;
|
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 ();
|
instant_save ();
|
||||||
|
|
||||||
/* this should generate a new enter event which will
|
/* this should generate a new enter event which will
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue