summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-11-12 15:01:56 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-11-12 15:01:56 +0000
commit0901000abb9bf6feffecfb72c7d804fe52939293 (patch)
tree070cb6a0153b9a9cb0a42228852643dbbb688775
parentea81cb17bc452f1c2f0039e9e45f2025348e829a (diff)
add arrow head to selected marker line; fix no-import-embed when selecting "use timestamp"; make split/align use edit point and other integrated editing changes
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2621 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.cc16
-rw-r--r--gtk2_ardour/editor.h17
-rw-r--r--gtk2_ardour/editor_actions.cc11
-rw-r--r--gtk2_ardour/editor_audio_import.cc5
-rw-r--r--gtk2_ardour/editor_keyboard.cc153
-rw-r--r--gtk2_ardour/editor_mouse.cc8
-rw-r--r--gtk2_ardour/editor_ops.cc87
-rw-r--r--gtk2_ardour/marker.cc7
-rw-r--r--gtk2_ardour/public_editor.h2
9 files changed, 121 insertions, 185 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 6756b40fcf..33214d2cbd 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -316,6 +316,7 @@ Editor::Editor ()
button_release_can_deselect = true;
canvas_idle_queued = false;
_dragging_playhead = false;
+ _dragging_edit_point = false;
_dragging_hscrollbar = false;
scrubbing_direction = 0;
@@ -884,6 +885,10 @@ Editor::instant_save ()
void
Editor::edit_point_clock_changed()
{
+ if (_dragging_edit_point) {
+ return;
+ }
+
if (selection->markers.empty()) {
return;
}
@@ -3970,13 +3975,11 @@ Editor::sort_track_selection ()
}
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();
@@ -3988,6 +3991,7 @@ Editor::get_preferred_edit_position() const
Location* loc = find_location_from_marker (selection->markers.front(), whocares);
if (loc) {
where = loc->start();
+ break;
}
}
/* fallthru */
@@ -3995,13 +3999,13 @@ Editor::get_preferred_edit_position() const
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;
}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 0ad5339995..7d87776df5 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -344,7 +344,7 @@ class Editor : public PublicEditor
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 ();
@@ -942,6 +942,8 @@ class Editor : public PublicEditor
void reset_focus ();
+ void split ();
+
void cut ();
void copy ();
void paste (float times);
@@ -1139,6 +1141,7 @@ class Editor : public PublicEditor
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*);
@@ -1234,23 +1237,15 @@ class Editor : public PublicEditor
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*);
@@ -1920,7 +1915,7 @@ class Editor : public PublicEditor
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);
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 937d83c7c8..6e5e9fc49a 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -219,13 +219,14 @@ Editor::register_actions ()
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));
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index 475c103b31..714a41577f 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -156,10 +156,6 @@ Editor::external_audio_dialog ()
break;
}
- if (where < 0) {
- return;
- }
-
SrcQuality quality = sfbrowser->get_src_quality();
if (sfbrowser->copy_files_btn.get_active()) {
@@ -594,7 +590,6 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
if (sources[0]->natural_position() != 0) {
pos = sources[0]->natural_position();
} else {
- // XXX is this the best alternative ?
pos = get_preferred_edit_position ();
}
}
diff --git a/gtk2_ardour/editor_keyboard.cc b/gtk2_ardour/editor_keyboard.cc
index 8eb0d1a6e4..2912e2f4ee 100644
--- a/gtk2_ardour/editor_keyboard.cc
+++ b/gtk2_ardour/editor_keyboard.cc
@@ -76,91 +76,6 @@ Editor::kbd_driver (sigc::slot<void,GdkEvent*> theslot, bool use_track_canvas, b
}
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 ()
{
if (entered_regionview) {
@@ -199,74 +114,6 @@ Editor::kbd_do_set_sync_position (GdkEvent* ev)
}
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)
{
brush (event_frame (ev, 0, 0));
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index ebc17e41f7..2b7360f41c 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -2103,6 +2103,8 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event)
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());
@@ -2150,7 +2152,6 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
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;
@@ -2231,7 +2232,8 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
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);
}
@@ -2242,6 +2244,8 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
marker_drag_motion_callback (item, event);
}
+
+ _dragging_edit_point = false;
Marker* marker = (Marker *) drag_info.data;
bool is_start;
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 2a57d4e41c..7b303dc352 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2583,13 +2583,31 @@ Editor::naturalize ()
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 {
@@ -3835,3 +3853,68 @@ Editor::update_xfade_visibility ()
}
}
}
+
+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);
+ }
+}
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 505e577c42..63a6a8bc51 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -299,6 +299,13 @@ Marker::add_line (ArdourCanvas::Group* group, double initial_height)
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 ();
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 3badc327e6..bd8e71f269 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -155,7 +155,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
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;