button_release_can_deselect = true;
canvas_idle_queued = false;
_dragging_playhead = false;
+ _dragging_edit_point = false;
_dragging_hscrollbar = false;
scrubbing_direction = 0;
void
Editor::edit_point_clock_changed()
{
+ if (_dragging_edit_point) {
+ return;
+ }
+
if (selection->markers.empty()) {
return;
}
}
nframes64_t
-Editor::get_preferred_edit_position() const
+Editor::get_preferred_edit_position()
{
bool ignored;
nframes64_t where = 0;
- // XXX EDIT CURSOR used to sync with edit cursor clock
-
switch (_edit_point) {
case EditAtPlayhead:
where = session->audible_frame();
Location* loc = find_location_from_marker (selection->markers.front(), whocares);
if (loc) {
where = loc->start();
+ break;
}
}
/* fallthru */
default:
case EditAtMouse:
if (!mouse_frame (where, ignored)) {
- /* XXX not right */
+ /* XXX not right but what can we do ? */
return 0;
}
+ snap_to (where);
+ break;
}
- // XXX MAKE ME SNAP
- // snap_to (where);
return where;
}
void reset_zoom (double);
void reposition_and_zoom (nframes_t, double);
- nframes64_t get_preferred_edit_position () const;
+ nframes64_t get_preferred_edit_position ();
bool update_mouse_speed ();
bool decelerate_mouse_speed ();
void reset_focus ();
+ void split ();
+
void cut ();
void copy ();
void paste (float times);
void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
bool _dragging_playhead;
+ bool _dragging_edit_point;
void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
void track_canvas_allocate (Gtk::Allocation alloc);
bool track_canvas_size_allocated ();
- void set_playhead_cursor (GdkEvent* event);
+ void set_playhead_cursor ();
void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
- void kbd_set_playhead_cursor ();
- void kbd_set_edit_point ();
void kbd_mute_unmute_region ();
- void kbd_split ();
void kbd_set_sync_position ();
- void kbd_align (ARDOUR::RegionPoint);
- void kbd_align_relative (ARDOUR::RegionPoint);
void kbd_brush ();
void kbd_audition ();
- void kbd_do_split (GdkEvent*);
void kbd_do_set_sync_position (GdkEvent* ev);
- void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
- void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
void kbd_do_brush (GdkEvent*);
void kbd_do_audition (GdkEvent*);
Gtk::ComboBoxText edit_point_selector;
void set_edit_point_preference (Editing::EditPoint ep);
- void set_edit_point (GdkEvent* ev);
+ void set_edit_point ();
void edit_point_selection_done ();
void edit_point_chosen (Editing::EditPoint);
Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("Mute/Unmute Region"), mem_fun(*this, &Editor::kbd_mute_unmute_region));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "set-playhead", _("Set Playhead"), mem_fun(*this, &Editor::kbd_set_playhead_cursor));
+ act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::kbd_set_sync_position));
+ ActionManager::session_sensitive_actions.push_back (act);
+
+ act = ActionManager::register_action (editor_actions, "set-playhead", _("Set Playhead"), mem_fun(*this, &Editor::set_playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "set-edit-point", _("Set Edit Point"), mem_fun(*this, &Editor::kbd_set_edit_point));
+ act = ActionManager::register_action (editor_actions, "set-edit-point", _("Set Edit Point"), mem_fun(*this, &Editor::set_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), mem_fun(*this, &Editor::kbd_split));
- ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::kbd_set_sync_position));
+ act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), mem_fun(*this, &Editor::split));
ActionManager::session_sensitive_actions.push_back (act);
undo_action = act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U));
break;
}
- if (where < 0) {
- return;
- }
-
SrcQuality quality = sfbrowser->get_src_quality();
if (sfbrowser->copy_files_btn.get_active()) {
if (sources[0]->natural_position() != 0) {
pos = sources[0]->natural_position();
} else {
- // XXX is this the best alternative ?
pos = get_preferred_edit_position ();
}
}
}
}
-void
-Editor::set_edit_point (GdkEvent* event)
-{
- if (selection->markers.empty()) {
- nframes64_t where = event_frame (event);
-
- snap_to (where);
- mouse_add_new_marker (where);
-
- } else {
- bool ignored;
-
- Location* loc = find_location_from_marker (selection->markers.front(), ignored);
-
- if (loc) {
- nframes64_t where = event_frame (event);
- snap_to (where);
- loc->move_to (where);
- }
- }
-}
-
-void
-Editor::set_playhead_cursor (GdkEvent* event)
-{
- if (entered_marker) {
- session->request_locate (entered_marker->position(), session->transport_rolling());
- } else {
- nframes_t pointer_frame = event_frame (event);
-
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
- snap_to (pointer_frame);
- }
-
- if (session) {
- session->request_locate (pointer_frame, session->transport_rolling());
- }
- }
-}
-
-void
-Editor::kbd_set_edit_point ()
-{
- kbd_driver (mem_fun(*this, &Editor::set_edit_point), true, true, false);
-}
-
-void
-Editor::kbd_set_playhead_cursor ()
-{
- kbd_driver (mem_fun(*this, &Editor::set_playhead_cursor), true, true, false);
-}
-
-void
-Editor::kbd_do_split (GdkEvent* ev)
-{
- if (entered_regionview) {
-
- nframes_t where = get_preferred_edit_position();
-
- if (selection->regions.contains (entered_regionview)) {
- split_regions_at (where, selection->regions);
- } else {
- RegionSelection s;
- s.add (entered_regionview);
- split_regions_at (where, s);
- }
-
- } else if (entered_marker) {
-
- if (!selection->regions.empty()) {
- split_regions_at (entered_marker->position(), selection->regions);
- } else {
- RegionSelection rs;
- rs = get_regions_at (entered_marker->position(), selection->tracks);
- split_regions_at (entered_marker->position(), rs);
- }
- }
-}
-
-void
-Editor::kbd_split ()
-{
- kbd_driver (mem_fun(*this, &Editor::kbd_do_split), true, true, false);
-}
-
void
Editor::kbd_mute_unmute_region ()
{
}
}
-void
-Editor::kbd_do_align (GdkEvent* ev, ARDOUR::RegionPoint what)
-{
- if (entered_regionview) {
-
- nframes_t where = event_frame (ev);
- snap_to (where);
-
- if (selection->regions.contains (entered_regionview)) {
- align_selection (what, where, selection->regions);
- } else {
- RegionSelection s;
- s.add (entered_regionview);
- align_selection (what, where, s);
- }
-
- } else if (entered_marker) {
-
- if (!selection->regions.empty()) {
- align_selection (what, entered_marker->position(), selection->regions);
- } else {
- RegionSelection rs;
- rs = get_regions_at (entered_marker->position(), selection->tracks);
- align_selection (what, entered_marker->position(), rs);
- }
- }
-}
-
-void
-Editor::kbd_do_align_relative (GdkEvent* ev, ARDOUR::RegionPoint what)
-{
- if (entered_regionview) {
-
- nframes_t where = event_frame (ev);
- snap_to (where);
-
- if (selection->regions.contains (entered_regionview)) {
- align_selection_relative (what, where, selection->regions);
- } else {
- RegionSelection s;
- s.add (entered_regionview);
- align_selection_relative (what, where, s);
- }
-
- } else if (entered_marker) {
-
- if (!selection->regions.empty()) {
- align_selection_relative (what, entered_marker->position(), selection->regions);
- } else {
- RegionSelection rs;
- rs = get_regions_at (entered_marker->position(), selection->tracks);
- align_selection_relative (what, entered_marker->position(), rs);
- }
- }
-}
-
-void
-Editor::kbd_align (ARDOUR::RegionPoint what)
-{
- kbd_driver (bind (mem_fun(*this, &Editor::kbd_do_align), what));
-}
-
-void
-Editor::kbd_align_relative (ARDOUR::RegionPoint what)
-{
- kbd_driver (bind (mem_fun(*this, &Editor::kbd_do_align), what), true, true, false);
-}
-
void
Editor::kbd_do_brush (GdkEvent *ev)
{
start_grab (event);
+ _dragging_edit_point = true;
+
drag_info.copied_location = new Location (*location);
drag_info.pointer_frame_offset = drag_info.grab_frame - (is_start ? location->start() : location->end());
bool is_start;
bool move_both = false;
-
nframes_t newframe;
if (drag_info.pointer_frame_offset <= drag_info.current_pointer_frame) {
newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
LocationMarkers* lm = find_location_markers (real_location);
lm->set_position (copy_location->start(), copy_location->end());
-
+ edit_point_clock.set (copy_location->start());
+
show_verbose_time_cursor (newframe, 10);
}
marker_drag_motion_callback (item, event);
}
+
+ _dragging_edit_point = false;
Marker* marker = (Marker *) drag_info.data;
bool is_start;
void
Editor::align (RegionPoint what)
{
- align_selection (what, get_preferred_edit_position(), selection->regions);
+ nframes64_t where = get_preferred_edit_position();
+
+ if (!selection->regions.empty()) {
+ align_selection (what, where, selection->regions);
+ } else {
+
+ RegionSelection rs;
+ rs = get_regions_at (where, selection->tracks);
+ align_selection (what, where, rs);
+ }
}
void
Editor::align_relative (RegionPoint what)
{
- align_selection_relative (what, get_preferred_edit_position(), selection->regions);
+ nframes64_t where = get_preferred_edit_position();
+
+ if (!selection->regions.empty()) {
+ align_selection_relative (what, where, selection->regions);
+ } else {
+
+ RegionSelection rs;
+ rs = get_regions_at (where, selection->tracks);
+ align_selection_relative (what, where, rs);
+ }
}
struct RegionSortByTime {
}
}
}
+
+void
+Editor::set_edit_point ()
+{
+ nframes64_t where;
+ bool ignored;
+
+ if (!mouse_frame (where, ignored)) {
+ return;
+ }
+
+ snap_to (where);
+
+ if (selection->markers.empty()) {
+
+ mouse_add_new_marker (where);
+
+ } else {
+ bool ignored;
+
+ Location* loc = find_location_from_marker (selection->markers.front(), ignored);
+
+ if (loc) {
+ loc->move_to (where);
+ }
+ }
+}
+
+void
+Editor::set_playhead_cursor ()
+{
+ if (entered_marker) {
+ session->request_locate (entered_marker->position(), session->transport_rolling());
+ } else {
+ nframes64_t where;
+ bool ignored;
+
+ if (!mouse_frame (where, ignored)) {
+ return;
+ }
+
+ snap_to (where);
+
+ if (session) {
+ session->request_locate (where, session->transport_rolling());
+ }
+ }
+}
+
+void
+Editor::split ()
+{
+ nframes64_t where = get_preferred_edit_position();
+
+ if (!selection->regions.empty()) {
+
+ split_regions_at (where, selection->regions);
+
+ } else {
+
+ RegionSelection rs;
+ rs = get_regions_at (where, selection->tracks);
+ split_regions_at (where, rs);
+ }
+}
line->property_width_pixels() = 1;
line->property_points() = *line_points;
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
+ line->property_first_arrowhead() = TRUE;
+ line->property_last_arrowhead() = TRUE;
+ line->property_arrow_shape_a() = 11.0;
+ line->property_arrow_shape_b() = 0.0;
+ line->property_arrow_shape_c() = 9.0;
+
+ line->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
}
show_line ();
virtual void remove_last_capture () = 0;
virtual void maximise_editing_space() = 0;
virtual void restore_editing_space() = 0;
- virtual nframes64_t get_preferred_edit_position () const = 0;
+ virtual nframes64_t get_preferred_edit_position () = 0;
sigc::signal<void> ZoomFocusChanged;
sigc::signal<void> ZoomChanged;