#include "pbd/enumwriter.h"
#include "pbd/memento_command.h"
#include "pbd/unknown_type.h"
-#include "pbd/stacktrace.h"
+#include "pbd/unwind.h"
#include <glibmm/miscutils.h>
#include <gtkmm/image.h>
N_("Timecode Minutes"),
N_("Seconds"),
N_("Minutes"),
+ N_("Beats/128"),
+ N_("Beats/64"),
N_("Beats/32"),
N_("Beats/28"),
N_("Beats/24"),
layering_order_editor = 0;
no_save_visual = false;
resize_idle_id = -1;
+ within_track_canvas = false;
scrubbing_direction = 0;
set_snap_mode (_snap_mode);
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();
instant_save ();
switch (_snap_type) {
+ case SnapToBeatDiv128:
+ case SnapToBeatDiv64:
case SnapToBeatDiv32:
case SnapToBeatDiv28:
case SnapToBeatDiv24:
}
if ((prop = node.property ("zoom-focus"))) {
- set_zoom_focus ((ZoomFocus) atoi (prop->value()));
+ set_zoom_focus ((ZoomFocus) string_2_enum (prop->value(), zoom_focus));
}
if ((prop = node.property ("zoom"))) {
}
if ((prop = node.property ("snap-to"))) {
- set_snap_to ((SnapType) atoi (prop->value()));
+ set_snap_to ((SnapType) string_2_enum (prop->value(), _snap_type));
}
if ((prop = node.property ("snap-mode"))) {
- set_snap_mode ((SnapMode) atoi (prop->value()));
+ set_snap_mode ((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"))) {
maybe_add_mixer_strip_width (*node);
- snprintf (buf, sizeof(buf), "%d", (int) zoom_focus);
- node->add_property ("zoom-focus", buf);
+ node->add_property ("zoom-focus", enum_2_string (zoom_focus));
snprintf (buf, sizeof(buf), "%f", frames_per_unit);
node->add_property ("zoom", buf);
- snprintf (buf, sizeof(buf), "%d", (int) _snap_type);
- node->add_property ("snap-to", buf);
- snprintf (buf, sizeof(buf), "%d", (int) _snap_mode);
- node->add_property ("snap-mode", 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), "%" PRIi64, playhead_cursor->current_frame);
start = _session->tempo_map().round_to_beat (start, direction);
break;
+ case SnapToBeatDiv128:
+ start = _session->tempo_map().round_to_beat_subdivision (start, 128, direction);
+ break;
+ case SnapToBeatDiv64:
+ start = _session->tempo_map().round_to_beat_subdivision (start, 64, direction);
+ break;
case SnapToBeatDiv32:
start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction);
break;
snaptype = SnapToBeatDiv28;
} else if (choice == _("Beats/32")) {
snaptype = SnapToBeatDiv32;
+ } else if (choice == _("Beats/64")) {
+ snaptype = SnapToBeatDiv64;
+ } else if (choice == _("Beats/128")) {
+ snaptype = SnapToBeatDiv128;
} else if (choice == _("Beats")) {
snaptype = SnapToBeat;
} else if (choice == _("Bars")) {
return 1.0;
break;
+ case SnapToBeatDiv128:
+ return 1.0/128.0;
+ break;
+ case SnapToBeatDiv64:
+ return 1.0/64.0;
+ break;
case SnapToBeatDiv32:
return 1.0/32.0;
break;
}
}
-Editor::VisualState::VisualState ()
- : gui_state (new GUIObjectState)
+Editor::VisualState::VisualState (bool with_tracks)
+ : gui_state (with_tracks ? new GUIObjectState : 0)
{
}
Editor::VisualState*
Editor::current_visual_state (bool with_tracks)
{
- VisualState* vs = new VisualState;
+ VisualState* vs = new VisualState (with_tracks);
vs->y_position = vertical_adjustment.get_value();
vs->frames_per_unit = frames_per_unit;
vs->leftmost_frame = leftmost_frame;
vs->zoom_focus = zoom_focus;
if (with_tracks) {
- *(vs->gui_state) = *ARDOUR_UI::instance()->gui_object_state;
+ *vs->gui_state = *ARDOUR_UI::instance()->gui_object_state;
}
return vs;
return;
}
- redo_visual_stack.push_back (current_visual_state());
-
VisualState* vs = undo_visual_stack.back();
undo_visual_stack.pop_back();
+
+
+ redo_visual_stack.push_back (current_visual_state (vs ? vs->gui_state != 0 : false));
+
use_visual_state (*vs);
}
return;
}
- undo_visual_stack.push_back (current_visual_state());
-
VisualState* vs = redo_visual_stack.back();
redo_visual_stack.pop_back();
+
+ undo_visual_stack.push_back (current_visual_state (vs ? vs->gui_state != 0 : false));
+
use_visual_state (*vs);
}
void
Editor::use_visual_state (VisualState& vs)
{
- no_save_visual = true;
+ PBD::Unwinder<bool> nsv (no_save_visual, true);
_routes->suspend_redisplay ();
set_zoom_focus (vs.zoom_focus);
reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit);
- *ARDOUR_UI::instance()->gui_object_state = *vs.gui_state;
-
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->reset_visual_state ();
+ if (vs.gui_state) {
+ *ARDOUR_UI::instance()->gui_object_state = *vs.gui_state;
+
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ (*i)->reset_visual_state ();
+ }
}
_routes->update_visibility ();
_routes->resume_redisplay ();
-
- no_save_visual = false;
}
void