Compare commits
4 Commits
c7e5f38aa5
...
25daebbaf2
Author | SHA1 | Date |
---|---|---|
Ben Loftis | 25daebbaf2 | |
Ben Loftis | 082c009e1b | |
Ben Loftis | 7672ea9cfe | |
Ben Loftis | e99305c4dd |
|
@ -3217,6 +3217,16 @@ Editor::snap_to_internal (timepos_t& start, Temporal::RoundMode direction, SnapP
|
|||
timepos_t dist = timepos_t::max (start.time_domain()); // this records the distance of the best snap result we've found so far
|
||||
timepos_t best = timepos_t::max (start.time_domain()); // this records the best snap-result we've found so far
|
||||
|
||||
/* check Grid */
|
||||
if ( (_grid_type != GridTypeNone) && (uic.get_snap_target () != SnapTargetOther) ) {
|
||||
timepos_t pre (presnap);
|
||||
timepos_t post (snap_to_grid (pre, direction, pref));
|
||||
check_best_snap (presnap, post, dist, best);
|
||||
if (uic.get_snap_target () == SnapTargetGrid) {
|
||||
goto check_distance;
|
||||
}
|
||||
}
|
||||
|
||||
/* check snap-to-marker */
|
||||
if ((pref == SnapToAny_Visual) && uic.get_snap_to_marks ()) {
|
||||
test = snap_to_marker (presnap, direction);
|
||||
|
@ -3261,18 +3271,12 @@ Editor::snap_to_internal (timepos_t& start, Temporal::RoundMode direction, SnapP
|
|||
check_best_snap (presnap, test, dist, best);
|
||||
}
|
||||
|
||||
/* check Grid */
|
||||
if (uic.get_snap_to_grid () && (_grid_type != GridTypeNone)) {
|
||||
timepos_t pre (presnap);
|
||||
timepos_t post (snap_to_grid (pre, direction, pref));
|
||||
check_best_snap (presnap, post, dist, best);
|
||||
}
|
||||
check_distance:
|
||||
|
||||
if (timepos_t::max (start.time_domain()) == best) {
|
||||
return;
|
||||
}
|
||||
|
||||
check_distance:
|
||||
/* now check "magnetic" state: is the grid within reasonable on-screen distance to trigger a snap?
|
||||
* this also helps to avoid snapping to somewhere the user can't see. (i.e.: I clicked on a region and it disappeared!!)
|
||||
* ToDo: Perhaps this should only occur if EditPointMouse?
|
||||
|
|
|
@ -3426,8 +3426,20 @@ These settings will only take effect after %1 is restarted.\n\
|
|||
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_rulers_follow_grid)
|
||||
));
|
||||
|
||||
add_option (_("Editor/Snap"), new OptionEditorHeading (_("When \"Snap\" is enabled, snap to:")));
|
||||
add_option (_("Editor/Snap"), new OptionEditorHeading (_("Snap Target Mode:")));
|
||||
|
||||
ComboOption<SnapTarget> *stm = new ComboOption<SnapTarget> (
|
||||
"snap-target",
|
||||
_("When the Grid is enabled, snap to"),
|
||||
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_snap_target),
|
||||
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_snap_target));
|
||||
|
||||
stm->add(SnapTargetGrid, _("Grid"));
|
||||
stm->add(SnapTargetOther, _("Snap Targets"));
|
||||
stm->add(SnapTargetBoth, _("Both the Grid and Snap Targets"));
|
||||
add_option (_("Editor/Snap"), stm);
|
||||
|
||||
add_option (_("Editor/Snap"), new OptionEditorHeading (_("Snap Targets:")));
|
||||
|
||||
add_option (_("Editor/Snap"),
|
||||
new BoolOption (
|
||||
|
@ -3469,14 +3481,6 @@ These settings will only take effect after %1 is restarted.\n\
|
|||
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_snap_to_region_end)
|
||||
));
|
||||
|
||||
add_option (_("Editor/Snap"),
|
||||
new BoolOption (
|
||||
"snap-to-grid",
|
||||
_("Grid"),
|
||||
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_snap_to_grid),
|
||||
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_snap_to_grid)
|
||||
));
|
||||
|
||||
add_option (_("Editor/Modifiers"), new OptionEditorHeading (_("Keyboard Modifiers")));
|
||||
add_option (_("Editor/Modifiers"), new KeyboardOptions);
|
||||
add_option (_("Editor/Modifiers"), new OptionEditorBlank ());
|
||||
|
|
|
@ -134,12 +134,12 @@ UI_CONFIG_VARIABLE (bool, use_note_color_for_velocity, "use-note-color-for-veloc
|
|||
UI_CONFIG_VARIABLE (bool, show_snapped_cursor, "show-snapped-cursor", true)
|
||||
UI_CONFIG_VARIABLE (uint32_t, snap_threshold, "snap-threshold", 25)
|
||||
UI_CONFIG_VARIABLE (uint32_t, ruler_granularity, "ruler-granularity", 25)
|
||||
UI_CONFIG_VARIABLE (ARDOUR::SnapTarget, snap_target, "snap-target", ARDOUR::SnapTargetGrid)
|
||||
UI_CONFIG_VARIABLE (bool, snap_to_marks, "snap-to-marks", true)
|
||||
UI_CONFIG_VARIABLE (bool, snap_to_playhead, "snap-to-playhead", true)
|
||||
UI_CONFIG_VARIABLE (bool, snap_to_region_sync, "snap-to-region-sync", true)
|
||||
UI_CONFIG_VARIABLE (bool, snap_to_region_start, "snap-to-region-start", true)
|
||||
UI_CONFIG_VARIABLE (bool, snap_to_region_end, "snap-to-region-end", true)
|
||||
UI_CONFIG_VARIABLE (bool, snap_to_grid, "snap-to-grid", true)
|
||||
UI_CONFIG_VARIABLE (bool, show_selection_marker, "show-selection-marker", true)
|
||||
UI_CONFIG_VARIABLE (bool, show_grids_ruler, "show-grids-ruler", true)
|
||||
UI_CONFIG_VARIABLE (bool, rulers_follow_grid, "rulers-follow-grid", false)
|
||||
|
|
|
@ -435,6 +435,12 @@ enum EditMode {
|
|||
Lock
|
||||
};
|
||||
|
||||
enum SnapTarget {
|
||||
SnapTargetGrid,
|
||||
SnapTargetOther,
|
||||
SnapTargetBoth
|
||||
};
|
||||
|
||||
enum RippleMode {
|
||||
RippleSelected,
|
||||
RippleAll,
|
||||
|
|
|
@ -62,6 +62,7 @@ DEFINE_ENUM_CONVERT(ARDOUR::ShuttleUnits)
|
|||
DEFINE_ENUM_CONVERT(ARDOUR::ClockDeltaMode)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::DenormalModel)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::FadeShape)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::SnapTarget)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::RegionSelectionAfterSplit)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::RangeSelectionAfterSplit)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::TimeSelectionAfterSectionPaste)
|
||||
|
|
|
@ -107,6 +107,7 @@ setup_enum_writer ()
|
|||
TimecodeFormat _Session_TimecodeFormat;
|
||||
Session::PullupFormat _Session_PullupFormat;
|
||||
FadeShape _FadeShape;
|
||||
SnapTarget _SnapTarget;
|
||||
RegionSelectionAfterSplit _RegionSelectionAfterSplit;
|
||||
RangeSelectionAfterSplit _RangeSelectionAfterSplit;
|
||||
TimeSelectionAfterSectionPaste _TimeSelectionAfterSectionPaste;
|
||||
|
@ -574,6 +575,11 @@ setup_enum_writer ()
|
|||
REGISTER (_RegionSelectionAfterSplit);
|
||||
REGISTER (_RangeSelectionAfterSplit);
|
||||
|
||||
REGISTER_ENUM (SnapTargetGrid);
|
||||
REGISTER_ENUM (SnapTargetOther);
|
||||
REGISTER_ENUM (SnapTargetBoth);
|
||||
REGISTER (_SnapTarget);
|
||||
|
||||
REGISTER_ENUM(SectionSelectNoop);
|
||||
REGISTER_ENUM(SectionSelectClear);
|
||||
REGISTER_ENUM(SectionSelectRetain);
|
||||
|
|
|
@ -2619,6 +2619,11 @@ LuaBindings::common (lua_State* L)
|
|||
.addConst ("ExternalMonitoring", ARDOUR::MonitorModel(ExternalMonitoring))
|
||||
.endNamespace ()
|
||||
|
||||
.beginNamespace ("SnapTarget")
|
||||
.addConst ("SnapTargetGrid", ARDOUR::SnapTarget(SnapTargetGrid))
|
||||
.addConst ("SnapTargetOther", ARDOUR::SnapTarget(SnapTargetOther))
|
||||
.addConst ("SnapTargetBoth", ARDOUR::SnapTarget(SnapTargetBoth))
|
||||
|
||||
.beginNamespace ("RegionSelectionAfterSplit")
|
||||
.addConst ("None", ARDOUR::RegionSelectionAfterSplit(None))
|
||||
.addConst ("NewlyCreatedLeft", ARDOUR::RegionSelectionAfterSplit(NewlyCreatedLeft))
|
||||
|
|
Loading…
Reference in New Issue