the edit cursor is dead, long live the edit point; plus a few fixes; plus location locking

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2610 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-11-09 03:36:24 +00:00
parent a8d2605f9a
commit 96fa1cd0b6
27 changed files with 462 additions and 214 deletions

View file

@ -56,7 +56,7 @@ vector<RefPtr<Gtk::Action> > ActionManager::range_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::jack_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::jack_opposite_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::transport_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::edit_cursor_in_region_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::edit_point_in_region_sensitive_actions;
RefPtr<UIManager> ActionManager::ui_manager;
string ActionManager::unbound_string = "--";

View file

@ -56,7 +56,7 @@ class ActionManager
static std::vector<Glib::RefPtr<Gtk::Action> > transport_sensitive_actions;
static std::vector<Glib::RefPtr<Gtk::Action> > jack_sensitive_actions;
static std::vector<Glib::RefPtr<Gtk::Action> > jack_opposite_sensitive_actions;
static std::vector<Glib::RefPtr<Gtk::Action> > edit_cursor_in_region_sensitive_actions;
static std::vector<Glib::RefPtr<Gtk::Action> > edit_point_in_region_sensitive_actions;
static void map_some_state (const char* group, const char* action, bool (ARDOUR::Configuration::*get)() const);
static void toggle_config_state (const char* group, const char* action, bool (ARDOUR::Configuration::*set)(bool), bool (ARDOUR::Configuration::*get)(void) const);

View file

@ -76,7 +76,7 @@
<menuitem action='editor-delete'/>
<menuitem action='editor-copy'/>
<menuitem action='editor-paste'/>
<menuitem action='set-edit-cursor'/>
<menuitem action='set-edit-point'/>
<menuitem action='remove-last-capture'/>
<separator/>
<menu action="EditSelectRangeOptions">

View file

@ -130,7 +130,7 @@
<menu name='KeyMouse Actions' action='KeyMouse Actions'>
<menuitem action='audition-at-mouse'/>
<menuitem action='brush-at-mouse'/>
<menuitem action='set-edit-cursor'/>
<menuitem action='set-edit-point'/>
<menuitem action='mute-unmute-region'/>
<menuitem action='set-playhead'/>
<menuitem action='split-region'/>

View file

@ -81,7 +81,7 @@
<Option name="FrameHandle" value="7c00ff96"/>
<Option name="TrimHandleLocked" value="ea0f0f28"/>
<Option name="TrimHandle" value="1900ff44"/>
<Option name="EditCursor" value="0000ffff"/>
<Option name="EditPoint" value="0000ffff"/>
<Option name="PlayHead" value="ff0000ff"/>
</Canvas>
</Ardour>

View file

@ -1693,7 +1693,7 @@ void
ARDOUR_UI::update_clocks ()
{
if (!editor || !editor->dragging_playhead()) {
Clock (session->audible_frame(), false, editor->edit_cursor_position(false)); /* EMIT_SIGNAL */
Clock (session->audible_frame(), false, editor->get_preferred_edit_position()); /* EMIT_SIGNAL */
}
}
@ -2358,7 +2358,6 @@ ARDOUR_UI::load_session (const string & path, const string & snap_name, string*
session->set_clean ();
}
editor->edit_cursor_position (true);
enable_screen_updates ();
flush_pending ();
retval = 0;
@ -2933,13 +2932,13 @@ void
ARDOUR_UI::update_transport_clocks (nframes_t pos)
{
if (Config->get_primary_clock_delta_edit_cursor()) {
primary_clock.set (pos, false, editor->edit_cursor_position(false), 1);
primary_clock.set (pos, false, editor->get_preferred_edit_position(), 1);
} else {
primary_clock.set (pos, 0, true);
}
if (Config->get_secondary_clock_delta_edit_cursor()) {
secondary_clock.set (pos, false, editor->edit_cursor_position(false), 2);
secondary_clock.set (pos, false, editor->get_preferred_edit_position(), 2);
} else {
secondary_clock.set (pos);
}

View file

@ -78,5 +78,5 @@ CANVAS_VARIABLE(canvasvar_NameHighlightOutline, "NameHighlightOutline")
CANVAS_VARIABLE(canvasvar_FrameHandle, "FrameHandle")
CANVAS_VARIABLE(canvasvar_TrimHandleLocked, "TrimHandleLocked")
CANVAS_VARIABLE(canvasvar_TrimHandle, "TrimHandle")
CANVAS_VARIABLE(canvasvar_EditCursor, "EditCursor")
CANVAS_VARIABLE(canvasvar_EditPoint, "EditPoint")
CANVAS_VARIABLE(canvasvar_PlayHead, "PlayHead")

View file

@ -33,7 +33,7 @@ SNAPTYPE(SnapToAThirdBeat)
SNAPTYPE(SnapToBeat)
SNAPTYPE(SnapToBar)
SNAPTYPE(SnapToMark)
SNAPTYPE(SnapToEditCursor)
SNAPTYPE(SnapToEditPoint)
SNAPTYPE(SnapToRegionStart)
SNAPTYPE(SnapToRegionEnd)
SNAPTYPE(SnapToRegionSync)
@ -82,7 +82,7 @@ IMPORTMODE(ImportAsTapeTrack=3)
// if this is changed, remember to update the string table in sfdb_ui.cc
IMPORTPOSITION(ImportAtTimestamp=0)
IMPORTPOSITION(ImportAtEditCursor=1)
IMPORTPOSITION(ImportAtEditPoint=1)
IMPORTPOSITION(ImportAtPlayhead=2)
IMPORTPOSITION(ImportAtStart=3)

View file

@ -121,7 +121,7 @@ static const gchar *_snap_type_strings[] = {
N_("Beats"),
N_("Bars"),
N_("Marks"),
N_("Edit Cursor"),
N_("Edit Point"),
N_("Region starts"),
N_("Region ends"),
N_("Region syncs"),
@ -148,7 +148,7 @@ static const gchar *_zoom_focus_strings[] = {
N_("Center"),
N_("Playhead"),
N_("Mouse"),
N_("Edit Cursor"),
N_("Marker"),
0
};
@ -252,7 +252,7 @@ Editor::Editor ()
set_snap_mode (snap_mode);
_edit_point = EditAtMouse;
set_edit_point (_edit_point);
set_edit_point_preference (_edit_point);
snap_threshold = 5.0;
bbt_beat_subdivision = 4;
@ -312,7 +312,6 @@ Editor::Editor ()
current_timestretch = 0;
in_edit_group_row_change = false;
last_canvas_frame = 0;
edit_cursor = 0;
playhead_cursor = 0;
button_release_can_deselect = true;
canvas_idle_queued = false;
@ -848,7 +847,6 @@ Editor::tie_vertical_scrolling ()
double y1 = vertical_adjustment.get_value();
playhead_cursor->set_y_axis (y1);
edit_cursor->set_y_axis (y1);
if (logo_item) {
logo_item->property_y() = y1;
}
@ -886,12 +884,8 @@ Editor::instant_save ()
void
Editor::edit_cursor_clock_changed()
{
if (edit_cursor->current_frame != edit_cursor_clock.current_time()) {
edit_cursor->set_position (edit_cursor_clock.current_time());
}
}
void
Editor::zoom_adjustment_changed ()
{
@ -1406,9 +1400,9 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type,
if (!with_selection) {
if (region_edit_menu_split_item) {
if (clicked_regionview && clicked_regionview->region()->covers (get_preferred_edit_position())) {
ActionManager::set_sensitive (ActionManager::edit_cursor_in_region_sensitive_actions, true);
ActionManager::set_sensitive (ActionManager::edit_point_in_region_sensitive_actions, true);
} else {
ActionManager::set_sensitive (ActionManager::edit_cursor_in_region_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::edit_point_in_region_sensitive_actions, false);
}
}
/*
@ -1692,7 +1686,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
items.push_back (MenuElem (_("Raise to top layer"), mem_fun(*this, &Editor::raise_region_to_top)));
items.push_back (MenuElem (_("Lower to bottom layer"), mem_fun (*this, &Editor::lower_region_to_bottom)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Define sync point"), mem_fun(*this, &Editor::set_region_sync_from_edit_cursor)));
items.push_back (MenuElem (_("Define sync point"), mem_fun(*this, &Editor::set_region_sync_from_edit_point)));
items.push_back (MenuElem (_("Remove sync point"), mem_fun(*this, &Editor::remove_region_sync)));
items.push_back (SeparatorElem());
@ -1807,8 +1801,8 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
MenuList& trim_items = trim_menu->items();
trim_menu->set_name ("ArdourContextMenu");
trim_items.push_back (MenuElem (_("Start to edit cursor"), mem_fun(*this, &Editor::trim_region_from_edit_cursor)));
trim_items.push_back (MenuElem (_("Edit cursor to end"), mem_fun(*this, &Editor::trim_region_to_edit_cursor)));
trim_items.push_back (MenuElem (_("Start to edit point"), mem_fun(*this, &Editor::trim_region_from_edit_point)));
trim_items.push_back (MenuElem (_("Edit point to end"), mem_fun(*this, &Editor::trim_region_to_edit_point)));
items.push_back (MenuElem (_("Trim"), *trim_menu));
items.push_back (SeparatorElem());
@ -1895,7 +1889,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
MenuList& play_items = play_menu->items();
play_menu->set_name ("ArdourContextMenu");
play_items.push_back (MenuElem (_("Play from edit cursor"), mem_fun(*this, &Editor::play_from_edit_cursor)));
play_items.push_back (MenuElem (_("Play from edit point"), mem_fun(*this, &Editor::play_from_edit_point)));
play_items.push_back (MenuElem (_("Play from start"), mem_fun(*this, &Editor::play_from_start)));
play_items.push_back (MenuElem (_("Play region"), mem_fun(*this, &Editor::play_selected_region)));
play_items.push_back (SeparatorElem());
@ -1917,11 +1911,11 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
select_items.push_back (MenuElem (_("Set range to loop range"), mem_fun(*this, &Editor::set_selection_from_loop)));
select_items.push_back (MenuElem (_("Set range to punch range"), mem_fun(*this, &Editor::set_selection_from_punch)));
select_items.push_back (SeparatorElem());
select_items.push_back (MenuElem (_("Select all after edit cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, true)));
select_items.push_back (MenuElem (_("Select all before edit cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, false)));
select_items.push_back (MenuElem (_("Select all after edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
select_items.push_back (MenuElem (_("Select all before edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
select_items.push_back (MenuElem (_("Select all after playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
select_items.push_back (MenuElem (_("Select all before playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
select_items.push_back (MenuElem (_("Select all between cursors"), bind (mem_fun(*this, &Editor::select_all_selectables_between_cursors), playhead_cursor, edit_cursor)));
select_items.push_back (MenuElem (_("Select all between cursors"), mem_fun(*this, &Editor::select_all_selectables_between)));
select_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Select"), *select_menu));
@ -1934,8 +1928,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
cutnpaste_items.push_back (MenuElem (_("Cut"), mem_fun(*this, &Editor::cut)));
cutnpaste_items.push_back (MenuElem (_("Copy"), mem_fun(*this, &Editor::copy)));
cutnpaste_items.push_back (MenuElem (_("Paste at edit cursor"), bind (mem_fun(*this, &Editor::paste), 1.0f)));
cutnpaste_items.push_back (MenuElem (_("Paste at mouse"), mem_fun(*this, &Editor::mouse_paste)));
cutnpaste_items.push_back (MenuElem (_("Paste"), bind (mem_fun(*this, &Editor::paste), 1.0f)));
cutnpaste_items.push_back (SeparatorElem());
@ -1962,9 +1955,9 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
edit_items.push_back (SeparatorElem());
nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, true))));
nudge_items.push_back (MenuElem (_("Nudge track after edit cursor fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true))));
nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true))));
nudge_items.push_back (MenuElem (_("Nudge entire track bwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, false))));
nudge_items.push_back (MenuElem (_("Nudge track after edit cursor bwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, false))));
nudge_items.push_back (MenuElem (_("Nudge track after edit point bwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, false))));
edit_items.push_back (MenuElem (_("Nudge"), *nudge_menu));
}
@ -1980,7 +1973,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
MenuList& play_items = play_menu->items();
play_menu->set_name ("ArdourContextMenu");
play_items.push_back (MenuElem (_("Play from edit cursor"), mem_fun(*this, &Editor::play_from_edit_cursor)));
play_items.push_back (MenuElem (_("Play from edit point"), mem_fun(*this, &Editor::play_from_edit_point)));
play_items.push_back (MenuElem (_("Play from start"), mem_fun(*this, &Editor::play_from_start)));
edit_items.push_back (MenuElem (_("Play"), *play_menu));
@ -1995,8 +1988,8 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
select_items.push_back (MenuElem (_("Invert selection in track"), mem_fun(*this, &Editor::invert_selection_in_track)));
select_items.push_back (MenuElem (_("Invert selection"), mem_fun(*this, &Editor::invert_selection)));
select_items.push_back (SeparatorElem());
select_items.push_back (MenuElem (_("Select all after edit cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, true)));
select_items.push_back (MenuElem (_("Select all before edit cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, false)));
select_items.push_back (MenuElem (_("Select all after edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
select_items.push_back (MenuElem (_("Select all before edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
select_items.push_back (MenuElem (_("Select all after playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
select_items.push_back (MenuElem (_("Select all before playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
@ -2018,9 +2011,9 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
edit_items.push_back (SeparatorElem());
nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, true))));
nudge_items.push_back (MenuElem (_("Nudge track after edit cursor fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true))));
nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true))));
nudge_items.push_back (MenuElem (_("Nudge entire track bwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, false))));
nudge_items.push_back (MenuElem (_("Nudge track after edit cursor bwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, false))));
nudge_items.push_back (MenuElem (_("Nudge track after edit point bwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, false))));
edit_items.push_back (MenuElem (_("Nudge"), *nudge_menu));
}
@ -2065,7 +2058,7 @@ Editor::set_snap_mode (SnapMode mode)
instant_save ();
}
void
Editor::set_edit_point (EditPoint ep)
Editor::set_edit_point_preference (EditPoint ep)
{
_edit_point = ep;
string str = edit_point_strings[(int)ep];
@ -2126,13 +2119,6 @@ Editor::set_state (const XMLNode& node)
horizontal_adjustment.set_value (0);
}
if (session && (prop = node.property ("edit-cursor"))) {
nframes_t pos = atol (prop->value().c_str());
edit_cursor->set_position (pos);
} else {
edit_cursor->set_position (0);
}
if ((prop = node.property ("mixer-width"))) {
editor_mixer_strip_width = Width (string_2_enum (prop->value(), editor_mixer_strip_width));
}
@ -2154,7 +2140,7 @@ Editor::set_state (const XMLNode& node)
}
if ((prop = node.property ("edit-point"))) {
set_edit_point ((EditPoint) string_2_enum (prop->value(), _edit_point));
set_edit_point_preference ((EditPoint) string_2_enum (prop->value(), _edit_point));
}
if ((prop = node.property ("mouse-mode"))) {
@ -2296,8 +2282,6 @@ Editor::get_state ()
snprintf (buf, sizeof (buf), "%" PRIu32, playhead_cursor->current_frame);
node->add_property ("playhead", buf);
snprintf (buf, sizeof (buf), "%" PRIu32, edit_cursor->current_frame);
node->add_property ("edit-cursor", buf);
node->add_property ("show-waveforms", _show_waveforms ? "yes" : "no");
node->add_property ("show-waveforms-recording", _show_waveforms_recording ? "yes" : "no");
@ -2454,7 +2438,7 @@ Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
start = session->tempo_map().round_to_beat_subdivision (start, 3);
break;
case SnapToEditCursor:
case SnapToEditPoint:
start = get_preferred_edit_position ();
break;
@ -2669,7 +2653,7 @@ Editor::setup_toolbar ()
ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to Session"));
zoom_focus_selector.set_name ("ZoomFocusSelector");
Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, "Edit Cursor", FUDGE, 0);
Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, "Playhead", FUDGE, 0);
set_popdown_strings (zoom_focus_selector, zoom_focus_strings);
zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done));
ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus"));
@ -2679,8 +2663,6 @@ Editor::setup_toolbar ()
zoom_box.pack_start (zoom_in_button, false, false);
zoom_box.pack_start (zoom_out_full_button, false, false);
/* Edit Cursor / Snap */
snap_box.set_spacing (1);
snap_box.set_border_width (2);
@ -3107,8 +3089,8 @@ Editor::snap_type_selection_done ()
snaptype = SnapToBar;
} else if (choice == _("Marks")) {
snaptype = SnapToMark;
} else if (choice == _("Edit Cursor")) {
snaptype = SnapToEditCursor;
} else if (choice == _("Edit Point")) {
snaptype = SnapToEditPoint;
} else if (choice == _("Region starts")) {
snaptype = SnapToRegionStart;
} else if (choice == _("Region ends")) {
@ -3195,7 +3177,7 @@ Editor::zoom_focus_selection_done ()
focus_type = ZoomFocusPlayhead;
} else if (choice == _("Mouse")) {
focus_type = ZoomFocusMouse;
} else if (choice == _("Edit Cursor")) {
} else if (choice == _("Edit Point")) {
focus_type = ZoomFocusEdit;
}
@ -3900,7 +3882,6 @@ Editor::set_frames_per_unit (double fpu)
reset_hscrollbar_stepping ();
reset_scrolling_region ();
if (edit_cursor) edit_cursor->set_position (edit_cursor->current_frame);
if (playhead_cursor) playhead_cursor->set_position (playhead_cursor->current_frame);
instant_save ();
@ -3972,22 +3953,14 @@ Editor::sort_track_selection ()
selection->tracks.sort (cmp);
}
nframes_t
Editor::edit_cursor_position(bool sync)
{
if (sync && edit_cursor->current_frame != edit_cursor_clock.current_time()) {
edit_cursor_clock.set(edit_cursor->current_frame, true);
}
return edit_cursor->current_frame;
}
nframes64_t
Editor::get_preferred_edit_position() const
{
bool ignored;
nframes64_t where;
// XXX EDIT CURSOR used to sync with edit cursor clock
switch (_edit_point) {
case EditAtPlayhead:
return playhead_cursor->current_frame;

View file

@ -344,7 +344,6 @@ class Editor : public PublicEditor
void reset_zoom (double);
void reposition_and_zoom (nframes_t, double);
nframes_t edit_cursor_position(bool);
nframes64_t get_preferred_edit_position () const;
bool update_mouse_speed ();
@ -638,7 +637,6 @@ class Editor : public PublicEditor
*/
Cursor* playhead_cursor;
Cursor* edit_cursor;
ArdourCanvas::Group* cursor_group;
void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
@ -646,8 +644,16 @@ class Editor : public PublicEditor
void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
void cursor_to_selection_start (Cursor *);
void cursor_to_selection_end (Cursor *);
void edit_point_to_next_region_point (ARDOUR::RegionPoint);
void edit_point_to_previous_region_point (ARDOUR::RegionPoint);
void edit_point_to_region_point (ARDOUR::RegionPoint, int32_t dir);
void edit_point_to_selection_start ();
void edit_point_to_selection_end ();
void select_all_selectables_using_cursor (Cursor *, bool);
void select_all_selectables_between_cursors (Cursor *, Cursor *);
void select_all_selectables_using_edit (bool);
void select_all_selectables_between ();
boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
@ -900,7 +906,7 @@ class Editor : public PublicEditor
void split_regions_at (nframes_t, RegionSelection&);
void crop_region_to_selection ();
void set_a_regions_sync_position (boost::shared_ptr<ARDOUR::Region>, nframes_t);
void set_region_sync_from_edit_cursor ();
void set_region_sync_from_edit_point ();
void remove_region_sync();
void align_selection (ARDOUR::RegionPoint, nframes_t position, const RegionSelection&);
void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position, const RegionSelection&);
@ -950,7 +956,7 @@ class Editor : public PublicEditor
void rename_region_finished (bool);
void play_from_start ();
void play_from_edit_cursor ();
void play_from_edit_point ();
void play_selected_region ();
void audition_selected_region ();
void loop_selected_region ();
@ -1029,7 +1035,7 @@ class Editor : public PublicEditor
void move_to_end ();
void goto_frame ();
void center_playhead ();
void center_edit_cursor ();
void center_edit_point ();
void edit_cursor_backward ();
void edit_cursor_forward ();
void playhead_backward ();
@ -1211,7 +1217,6 @@ class Editor : public PublicEditor
/* non-public event handlers */
bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
bool track_canvas_scroll (GdkEventScroll* event);
bool track_canvas_scroll_event (GdkEventScroll* event);
@ -1224,12 +1229,11 @@ class Editor : public PublicEditor
void track_canvas_allocate (Gtk::Allocation alloc);
bool track_canvas_size_allocated ();
void set_edit_cursor (GdkEvent* event);
void set_playhead_cursor (GdkEvent* event);
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_cursor ();
void kbd_set_edit_point ();
void kbd_mute_unmute_region ();
void kbd_split ();
void kbd_set_sync_position ();
@ -1286,6 +1290,7 @@ class Editor : public PublicEditor
void marker_menu_edit ();
void marker_menu_remove ();
void marker_menu_rename ();
void marker_menu_lock (bool yn);
void marker_menu_hide ();
void marker_menu_loop_range ();
void marker_menu_select_all_selectables_using_range ();
@ -1619,8 +1624,8 @@ class Editor : public PublicEditor
void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
void thaw_region_after_trim (RegionView& rv);
void trim_region_to_edit_cursor ();
void trim_region_from_edit_cursor ();
void trim_region_to_edit_point ();
void trim_region_from_edit_point ();
bool show_gain_after_trim;
@ -1790,7 +1795,7 @@ class Editor : public PublicEditor
/* nudging tracks */
void nudge_track (bool use_edit_cursor, bool forwards);
void nudge_track (bool use_edit_point, bool forwards);
/* xfades */
@ -1909,7 +1914,8 @@ class Editor : public PublicEditor
Gtk::ComboBoxText edit_point_selector;
void set_edit_point (Editing::EditPoint ep);
void set_edit_point_preference (Editing::EditPoint ep);
void set_edit_point (GdkEvent* ev);
void edit_point_selection_done ();
void edit_point_chosen (Editing::EditPoint);
Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);

View file

@ -45,9 +45,9 @@ Editor::register_actions ()
/* non-operative menu items for menu bar */
ActionManager::register_action (editor_actions, X_("Edit"), _("Edit"));
ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select regions"));
ActionManager::register_action (editor_actions, X_("EditSelectRangeOptions"), _("Select range operations"));
ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move edit cursor"));
ActionManager::register_action (editor_actions, X_("EditSelectRegionOptions"), _("Select Regions"));
ActionManager::register_action (editor_actions, X_("EditSelectRangeOptions"), _("Select Range Operations"));
ActionManager::register_action (editor_actions, X_("EditCursorMovementOptions"), _("Move Selected Marker"));
ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations"));
ActionManager::register_action (editor_actions, X_("Tools"), _("Tools"));
ActionManager::register_action (editor_actions, X_("View"), _("View"));
@ -97,18 +97,23 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "playhead-to-previous-region-sync", _("Playhead to Previous Region Sync"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), playhead_cursor, RegionPoint (SyncPoint)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-start", _("Edit Cursor to Next Region Start"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (Start)));
act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-start", _("Edit Cursor to Next Region Start"), bind (mem_fun(*this, &Editor::edit_point_to_next_region_point), RegionPoint (Start)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-end", _("Edit Cursor to Next Region End"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (End)));
act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-end", _("Edit Cursor to Next Region End"), bind (mem_fun(*this, &Editor::edit_point_to_next_region_point), RegionPoint (End)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-sync", _("Edit Cursor to Next Region Sync"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (SyncPoint)));
act = ActionManager::register_action (editor_actions, "edit-cursor-to-next-region-sync", _("Edit Cursor to Next Region Sync"), bind (mem_fun(*this, &Editor::edit_point_to_next_region_point), RegionPoint (SyncPoint)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-start", _("Edit Cursor to Previous Region Start"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (Start)));
act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-start", _("Edit Cursor to Previous Region Start"), bind (mem_fun(*this, &Editor::edit_point_to_previous_region_point), RegionPoint (Start)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-end", _("Edit Cursor to Previous Region End"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (End)));
act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-end", _("Edit Cursor to Previous Region End"), bind (mem_fun(*this, &Editor::edit_point_to_previous_region_point), RegionPoint (End)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-sync", _("Edit Cursor to Previous Region Sync"), bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (SyncPoint)));
act = ActionManager::register_action (editor_actions, "edit-cursor-to-previous-region-sync", _("Edit Cursor to Previous Region Sync"), bind (mem_fun(*this, &Editor::edit_point_to_previous_region_point), RegionPoint (SyncPoint)));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-start", _("Edit Cursor to Range Start"), mem_fun(*this, &Editor::edit_point_to_selection_start));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-end", _("Edit Cursor to Range End"), mem_fun(*this, &Editor::edit_point_to_selection_end));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "playhead-to-range-start", _("Playhead to Range Start"), bind (mem_fun(*this, &Editor::cursor_to_selection_start), playhead_cursor));
@ -116,23 +121,18 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "playhead-to-range-end", _("Playhead to Range End"), bind (mem_fun(*this, &Editor::cursor_to_selection_end), playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-start", _("Edit Cursor to Range Start"), bind (mem_fun(*this, &Editor::cursor_to_selection_start), edit_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-end", _("Edit Cursor to Range End"), bind (mem_fun(*this, &Editor::cursor_to_selection_end), edit_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all", _("select all"), bind (mem_fun(*this, &Editor::select_all), Selection::Set));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, true));
act = ActionManager::register_action (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, false));
act = ActionManager::register_action (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-after-playhead", _("Select All After Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-before-playhead", _("Select All Before Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Between Cursors"), bind (mem_fun(*this, &Editor::select_all_selectables_between_cursors), playhead_cursor, edit_cursor));
act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Between Cursors"), mem_fun(*this, &Editor::select_all_selectables_between));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-in-punch-range", _("Select All in Punch Range"), mem_fun(*this, &Editor::select_all_selectables_using_punch));
@ -180,7 +180,7 @@ Editor::register_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "center-playhead", _("Center Playhead"), mem_fun(*this, &Editor::center_playhead));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("Center Edit Cursor"), mem_fun(*this, &Editor::center_edit_cursor));
act = ActionManager::register_action (editor_actions, "center-edit-cursor", _("Center Edit Point"), mem_fun(*this, &Editor::center_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "scroll-playhead-forward", _("Playhead forward"), bind (mem_fun(*this, &Editor::scroll_playhead), true));;
@ -211,12 +211,12 @@ Editor::register_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("Brush at Mouse"), mem_fun(*this, &Editor::kbd_brush));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-edit-cursor", _("Set Edit Cursor"), mem_fun(*this, &Editor::kbd_set_edit_cursor));
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));
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));
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));
@ -256,8 +256,8 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "split-at-edit-cursor", _("Split at edit cursor"), mem_fun(*this, &Editor::split_region));
ActionManager::edit_cursor_in_region_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "split-at-edit-cursor", _("Split At Edit Point"), mem_fun(*this, &Editor::split_region));
ActionManager::edit_point_in_region_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "start-range", _("Start Range"), mem_fun(*this, &Editor::keyboard_selection_begin));
ActionManager::session_sensitive_actions.push_back (act);
@ -331,7 +331,7 @@ Editor::register_actions ()
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-beat"), _("Snap to beat"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeat)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-bar"), _("Snap to bar"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBar)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-mark"), _("Snap to mark"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMark)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-edit-cursor"), _("Snap to edit cursor"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToEditCursor)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-edit-cursor"), _("Snap to edit point"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToEditPoint)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-start"), _("Snap to region start"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionStart)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-end"), _("Snap to region end"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionEnd)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-sync"), _("Snap to region sync"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionSync)));
@ -739,7 +739,7 @@ Editor::snap_type_action (SnapType type)
case Editing::SnapToMark:
action = "snap-to-mark";
break;
case Editing::SnapToEditCursor:
case Editing::SnapToEditPoint:
action = "snap-to-edit-cursor";
break;
case Editing::SnapToRegionStart:
@ -875,7 +875,7 @@ Editor::edit_point_chosen (EditPoint ep)
RefPtr<RadioAction> ract = edit_point_action (ep);
if (ract && ract->get_active()) {
set_edit_point (ep);
set_edit_point_preference (ep);
}
}

View file

@ -142,7 +142,7 @@ Editor::external_audio_dialog ()
nframes64_t where;
switch (pos) {
case ImportAtEditCursor:
case ImportAtEditPoint:
where = get_preferred_edit_position ();
break;
case ImportAtTimestamp:

View file

@ -245,7 +245,6 @@ Editor::initialize_canvas ()
double time_width = FLT_MAX/frames_per_unit;
time_canvas.set_scroll_region(0.0, 0.0, time_width, time_height);
edit_cursor = new Cursor (*this, &Editor::canvas_edit_cursor_event);
playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event);
initial_ruler_update_required = true;
@ -305,19 +304,14 @@ Editor::track_canvas_size_allocated ()
}
zoom_range_clock.set ((nframes_t) floor ((canvas_width * frames_per_unit)));
edit_cursor->set_position (edit_cursor->current_frame);
playhead_cursor->set_position (playhead_cursor->current_frame);
reset_hscrollbar_stepping ();
reset_scrolling_region ();
if (edit_cursor) edit_cursor->set_length (canvas_height);
if (playhead_cursor) playhead_cursor->set_length (canvas_height);
if (marker_drag_line) {
marker_drag_line_points.back().set_y(canvas_height);
marker_drag_line->property_points() = marker_drag_line_points;
}
// EDIT CURSOR XXX set line height for selected markers here
if (range_marker_drag_rect) {
range_marker_drag_rect->property_y1() = 0.0;
@ -718,7 +712,6 @@ Editor::canvas_horizontally_scrolled ()
void
Editor::color_handler()
{
edit_cursor->canvas_item.property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditCursor.get();
playhead_cursor->canvas_item.property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_PlayHead.get();
verbose_canvas_cursor->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VerboseCanvasCursor.get();

View file

@ -854,12 +854,6 @@ Editor::canvas_playhead_cursor_event (GdkEvent *event, ArdourCanvas::Item* item)
return typed_event (item, event, PlayheadCursorItem);
}
bool
Editor::canvas_edit_cursor_event (GdkEvent *event, ArdourCanvas::Item* item)
{
return typed_event (item, event, EditCursorItem);
}
bool
Editor::canvas_zoom_rect_event (GdkEvent *event, ArdourCanvas::Item* item)
{

View file

@ -24,7 +24,6 @@ enum ItemType {
RegionItem,
StreamItem,
PlayheadCursorItem,
EditCursorItem,
MarkerItem,
MarkerBarItem,
RangeMarkerBarItem,

View file

@ -19,6 +19,8 @@
#include <ardour/audioregion.h>
#include <ardour/playlist.h>
#include <ardour/location.h>
#include <pbd/memento_command.h>
#include "editor.h"
@ -28,6 +30,8 @@
#include "i18n.h"
using namespace ARDOUR;
void
Editor::kbd_driver (sigc::slot<void,GdkEvent*> theslot, bool use_track_canvas, bool use_time_canvas, bool can_select)
{
@ -71,6 +75,28 @@ 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)
{
@ -89,18 +115,18 @@ Editor::set_playhead_cursor (GdkEvent* event)
}
}
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_set_edit_cursor ()
{
kbd_driver (mem_fun(*this, &Editor::set_edit_cursor), true, true, false);
}
void
Editor::kbd_do_split (GdkEvent* ev)
{

View file

@ -299,6 +299,14 @@ Editor::mouse_add_new_marker (nframes_t where)
XMLNode &after = session->locations()->get_state();
session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
session->commit_reversible_command ();
/* find the marker we just added */
LocationMarkers *lam = find_location_markers (location);
if (lam) {
/* make it the selected marker */
selection->set (lam->start);
}
}
}
@ -464,17 +472,21 @@ Editor::build_marker_menu (bool start_or_end)
MenuList& items = markerMenu->items();
markerMenu->set_name ("ArdourContextMenu");
items.push_back (MenuElem (_("Locate to Mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
items.push_back (MenuElem (_("Play from Mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
items.push_back (MenuElem (_("Set Mark from Playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
items.push_back (MenuElem (_("Locate to here"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
items.push_back (MenuElem (_("Play from here"), mem_fun(*this, &Editor::marker_menu_play_from)));
items.push_back (MenuElem (_("Move Mark to Playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Hide Mark"), mem_fun(*this, &Editor::marker_menu_hide)));
items.push_back (MenuElem (_("Hide"), mem_fun(*this, &Editor::marker_menu_hide)));
if (start_or_end) return;
items.push_back (MenuElem (_("Rename Mark"), mem_fun(*this, &Editor::marker_menu_rename)));
items.push_back (MenuElem (_("Remove Mark"), mem_fun(*this, &Editor::marker_menu_remove)));
items.push_back (MenuElem (_("Rename"), mem_fun(*this, &Editor::marker_menu_rename)));
items.push_back (MenuElem (_("Lock"), bind (mem_fun(*this, &Editor::marker_menu_lock), true)));
items.push_back (MenuElem (_("Unlock"), bind (mem_fun(*this, &Editor::marker_menu_lock), false)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Remove"), mem_fun(*this, &Editor::marker_menu_remove)));
}
void
@ -837,6 +849,31 @@ Editor::marker_menu_remove ()
}
}
void
Editor::marker_menu_lock (bool yn)
{
Marker* marker;
if ((marker = reinterpret_cast<Marker *> (marker_menu_item->get_data ("marker"))) == 0) {
fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
/*NOTREACHED*/
}
Location* loc;
bool ignored;
loc = find_location_from_marker (marker, ignored);
if (!loc) return;
if (yn) {
loc->lock();
} else {
loc->unlock ();
}
}
void
Editor::marker_menu_rename ()
{

View file

@ -463,7 +463,6 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
*/
switch (item_type) {
case EditCursorItem:
case PlayheadCursorItem:
start_cursor_grab (item, event);
return true;
@ -977,7 +976,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
switch (item_type) {
/* see comments in button_press_handler */
case EditCursorItem:
case PlayheadCursorItem:
case MarkerItem:
case GainLineItem:
@ -1222,7 +1220,6 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
}
break;
case EditCursorItem:
case PlayheadCursorItem:
if (is_drawable()) {
track_canvas.get_window()->set_cursor (*grabber_cursor);
@ -1364,7 +1361,6 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case RegionViewNameHighlight:
case StartSelectionTrimItem:
case EndSelectionTrimItem:
case EditCursorItem:
case PlayheadCursorItem:
/* <CMT Additions> */
case ImageFrameHandleStartItem:
@ -1579,7 +1575,6 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
switch (item_type) {
case PlayheadCursorItem:
case EditCursorItem:
case MarkerItem:
case GainControlPointItem:
case RedirectAutomationControlPointItem:
@ -1767,21 +1762,6 @@ Editor::end_grab (ArdourCanvas::Item* item, GdkEvent* event)
return did_drag;
}
void
Editor::set_edit_cursor (GdkEvent* event)
{
nframes_t pointer_frame = event_frame (event);
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
if (snap_type != SnapToEditCursor) {
snap_to (pointer_frame);
}
}
edit_cursor->set_position (pointer_frame);
edit_cursor_clock.set (pointer_frame);
}
void
Editor::start_fade_in_grab (ArdourCanvas::Item* item, GdkEvent* event)
{
@ -2052,7 +2032,7 @@ Editor::cursor_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
}
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
if (cursor != edit_cursor || snap_type != SnapToEditCursor) {
if (cursor == playhead_cursor && snap_type != SnapToEditPoint) {
snap_to (adjusted_frame);
}
}
@ -2061,11 +2041,7 @@ Editor::cursor_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
cursor->set_position (adjusted_frame);
if (cursor == edit_cursor) {
edit_cursor_clock.set (cursor->current_frame);
} else {
UpdateAllTransportClocks (cursor->current_frame);
}
UpdateAllTransportClocks (cursor->current_frame);
show_verbose_time_cursor (cursor->current_frame, 10);
@ -2086,9 +2062,6 @@ Editor::cursor_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
if (session) {
session->request_locate (playhead_cursor->current_frame, drag_info.was_rolling);
}
} else if (item == &edit_cursor->canvas_item) {
edit_cursor->set_position (edit_cursor->current_frame);
edit_cursor_clock.set (edit_cursor->current_frame);
}
}
@ -2197,7 +2170,13 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
/* call this to find out if its the start or end */
real_location = find_location_from_marker (marker, is_start);
if ((real_location = find_location_from_marker (marker, is_start)) == 0) {
return;
}
if (real_location->locked()) {
return;
}
/* use the copy that we're "dragging" around */
@ -2267,13 +2246,17 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
Marker* marker = (Marker *) drag_info.data;
bool is_start;
begin_reversible_command ( _("move marker") );
XMLNode &before = session->locations()->get_state();
Location * location = find_location_from_marker (marker, is_start);
if (location) {
if (location->locked()) {
return;
}
if (location->is_mark()) {
location->set_start (drag_info.copied_location->start());
} else {
@ -5040,7 +5023,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes_t pos)
switch (snap_type) {
case SnapToFrame:
case SnapToMark:
case SnapToEditCursor:
case SnapToEditPoint:
return;
default:

View file

@ -789,6 +789,160 @@ Editor::cursor_to_selection_end (Cursor *cursor)
}
}
void
Editor::edit_point_to_region_point (RegionPoint point, int32_t dir)
{
boost::shared_ptr<Region> r;
nframes_t pos;
Location* loc;
bool ignored;
if (!session || _edit_point != EditAtSelectedMarker || selection->markers.empty()) {
return;
}
if ((loc = find_location_from_marker (selection->markers.front(), ignored)) == 0) {
return;
}
TimeAxisView *ontrack = 0;
pos = loc->start();
// so we don't find the current region again..
if (dir>0 || pos>0)
pos+=dir;
if (!selection->tracks.empty()) {
r = find_next_region (pos, point, dir, selection->tracks, &ontrack);
} else if (clicked_trackview) {
TrackViewList t;
t.push_back (clicked_trackview);
r = find_next_region (pos, point, dir, t, &ontrack);
} else {
r = find_next_region (pos, point, dir, track_views, &ontrack);
}
if (r == 0) {
return;
}
switch (point){
case Start:
pos = r->first_frame ();
break;
case End:
pos = r->last_frame ();
break;
case SyncPoint:
pos = r->adjust_to_sync (r->first_frame());
break;
}
float speed = 1.0f;
AudioTimeAxisView *atav;
if ( ontrack != 0 && (atav = dynamic_cast<AudioTimeAxisView*>(ontrack)) != 0 ) {
if (atav->get_diskstream() != 0) {
speed = atav->get_diskstream()->speed();
}
}
pos = track_frame_to_session_frame(pos, speed);
loc->move_to (pos);
}
void
Editor::edit_point_to_next_region_point (RegionPoint point)
{
edit_point_to_region_point (point, 1);
}
void
Editor::edit_point_to_previous_region_point (RegionPoint point)
{
edit_point_to_region_point (point, -1);
}
void
Editor::edit_point_to_selection_start ()
{
nframes_t pos = 0;
Location* loc;
bool ignored;
if (!session || _edit_point != EditAtSelectedMarker || selection->markers.empty()) {
return;
}
if ((loc = find_location_from_marker (selection->markers.front(), ignored)) == 0) {
return;
}
switch (mouse_mode) {
case MouseObject:
if (!selection->regions.empty()) {
pos = selection->regions.start();
}
break;
case MouseRange:
if (!selection->time.empty()) {
pos = selection->time.start ();
}
break;
default:
return;
}
loc->move_to (pos);
}
void
Editor::edit_point_to_selection_end ()
{
nframes_t pos = 0;
Location* loc;
bool ignored;
if (!session || _edit_point != EditAtSelectedMarker || selection->markers.empty()) {
return;
}
if ((loc = find_location_from_marker (selection->markers.front(), ignored)) == 0) {
return;
}
switch (mouse_mode) {
case MouseObject:
if (!selection->regions.empty()) {
pos = selection->regions.end_frame();
}
break;
case MouseRange:
if (!selection->time.empty()) {
pos = selection->time.end_frame ();
}
break;
default:
return;
}
loc->move_to (pos);
}
void
Editor::scroll_playhead (bool forward)
{
@ -940,7 +1094,7 @@ Editor::edit_cursor_backward ()
pos -= cnt;
}
edit_cursor->set_position (pos);
// EDIT CURSOR edit_cursor->set_position (pos);
}
void
@ -961,8 +1115,8 @@ Editor::edit_cursor_forward ()
}
}
pos = edit_cursor->current_frame;
edit_cursor->set_position (pos+cnt);
// pos = edit_cursor->current_frame;
// EDIT CURSOR edit_cursor->set_position (pos+cnt);
}
void
@ -1198,7 +1352,7 @@ Editor::temporal_zoom (gdouble fpu)
break;
case ZoomFocusEdit:
/* try to keep the edit cursor in the center */
/* try to keep the edit point in the center */
if (get_preferred_edit_position() > new_page/2) {
leftmost_after_zoom = get_preferred_edit_position() - (new_page/2);
} else {
@ -1722,7 +1876,7 @@ Editor::play_from_start ()
}
void
Editor::play_from_edit_cursor ()
Editor::play_from_edit_point ()
{
session->request_locate (get_preferred_edit_position(), true);
}
@ -2349,19 +2503,19 @@ Editor::set_a_regions_sync_position (boost::shared_ptr<Region> region, nframes_t
}
void
Editor::set_region_sync_from_edit_cursor ()
Editor::set_region_sync_from_edit_point ()
{
if (clicked_regionview == 0) {
return;
}
if (!clicked_regionview->region()->covers (get_preferred_edit_position())) {
error << _("Place the edit cursor at the desired sync point") << endmsg;
error << _("Place the edit point at the desired sync point") << endmsg;
return;
}
boost::shared_ptr<Region> region (clicked_regionview->region());
begin_reversible_command (_("set sync from edit cursor"));
begin_reversible_command (_("set sync from edit point"));
XMLNode &before = region->playlist()->get_state();
region->set_sync_position (get_preferred_edit_position());
XMLNode &after = region->playlist()->get_state();
@ -2526,7 +2680,7 @@ Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint poi
}
void
Editor::trim_region_to_edit_cursor ()
Editor::trim_region_to_edit_point ()
{
if (clicked_regionview == 0) {
return;
@ -2552,7 +2706,7 @@ Editor::trim_region_to_edit_cursor ()
}
void
Editor::trim_region_from_edit_cursor ()
Editor::trim_region_from_edit_point ()
{
if (clicked_regionview == 0) {
return;
@ -3158,15 +3312,13 @@ void
Editor::center_playhead ()
{
float page = canvas_width * frames_per_unit;
center_screen_internal (playhead_cursor->current_frame, page);
}
void
Editor::center_edit_cursor ()
Editor::center_edit_point ()
{
float page = canvas_width * frames_per_unit;
center_screen_internal (get_preferred_edit_position(), page);
}
@ -3182,14 +3334,14 @@ Editor::clear_playlist (boost::shared_ptr<Playlist> playlist)
}
void
Editor::nudge_track (bool use_edit_cursor, bool forwards)
Editor::nudge_track (bool use_edit, bool forwards)
{
boost::shared_ptr<Playlist> playlist;
nframes_t distance;
nframes_t next_distance;
nframes_t start;
if (use_edit_cursor) {
if (use_edit) {
start = get_preferred_edit_position();
} else {
start = 0;

View file

@ -163,12 +163,12 @@ Editor::ruler_button_press (GdkEventButton* ev)
break;
case 2:
/* edit cursor */
if (snap_type != Editing::SnapToEditCursor) {
/* edit point */
if (snap_type != Editing::SnapToEditPoint) {
snap_to (where);
}
edit_cursor->set_position (where);
edit_cursor_clock.set (where);
// EDIT CURSOR XXX what to do here edit_cursor->set_position (where);
// EDIT CURSOR XXX what to do here edit_cursor_clock.set (where);
break;
default:
@ -206,12 +206,12 @@ Editor::ruler_button_release (GdkEventButton* ev)
break;
case 2:
/* edit cursor */
if (snap_type != Editing::SnapToEditCursor) {
/* edit point */
if (snap_type != Editing::SnapToEditPoint) {
snap_to (where);
}
edit_cursor->set_position (where);
edit_cursor_clock.set (where);
// EDIT CURSOR XXX what to do here edit_cursor->set_position (where);
// ditto XXX edit_cursor_clock.set (where);
break;
case 3:
@ -298,8 +298,8 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
break;
case 2:
/* edit cursor */
cursor = edit_cursor;
/* edit point */
// EDIT CURSOR XXX do something useful
break;
default:
@ -309,9 +309,7 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
if (cursor) {
cursor->set_position (where);
if (cursor == edit_cursor) {
edit_cursor_clock.set (where);
} else if (cursor == playhead_cursor) {
if (cursor == playhead_cursor) {
UpdateAllTransportClocks (cursor->current_frame);
}
}

View file

@ -1003,26 +1003,61 @@ Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after)
}
void
Editor::select_all_selectables_between_cursors (Cursor *cursor, Cursor *other_cursor)
Editor::select_all_selectables_using_edit (bool after)
{
nframes_t start;
nframes_t end;
list<Selectable *> touched;
bool other_cursor_is_first = cursor->current_frame > other_cursor->current_frame;
if (cursor->current_frame == other_cursor->current_frame) {
if (after) {
begin_reversible_command (_("select all after edit"));
start = get_preferred_edit_position();
end = session->current_end_frame();
} else {
if ((end = get_preferred_edit_position()) > 1) {
begin_reversible_command (_("select all before edit"));
start = 0;
end -= 1;
} else {
return;
}
}
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {
continue;
}
(*iter)->get_selectables (start, end, 0, DBL_MAX, touched);
}
selection->set (touched);
commit_reversible_command ();
}
void
Editor::select_all_selectables_between ()
{
nframes64_t start;
nframes64_t end;
list<Selectable *> touched;
if (_edit_point == EditAtPlayhead) {
return;
}
start = get_preferred_edit_position();
end = playhead_cursor->current_frame;
if (start == end) {
return;
}
begin_reversible_command (_("select all between cursors"));
if (other_cursor_is_first) {
start = other_cursor->current_frame;
end = cursor->current_frame - 1;
} else {
start = cursor->current_frame;
end = other_cursor->current_frame - 1;
if (start > end) {
swap (start, end);
}
begin_reversible_command (_("select all between cursors"));
end -= 1;
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {

View file

@ -294,6 +294,10 @@ LocationEditRow::set_location (Location *loc)
}
start_clock.set_sensitive (!location->locked());
end_clock.set_sensitive (!location->locked());
length_clock.set_sensitive (!location->locked());
start_changed_connection = location->start_changed.connect (mem_fun(*this, &LocationEditRow::start_changed));
end_changed_connection = location->end_changed.connect (mem_fun(*this, &LocationEditRow::end_changed));
name_changed_connection = location->name_changed.connect (mem_fun(*this, &LocationEditRow::name_changed));
@ -573,6 +577,10 @@ LocationEditRow::location_changed (ARDOUR::Location *loc)
end_clock.set (location->end());
length_clock.set (location->length());
start_clock.set_sensitive (!location->locked());
end_clock.set_sensitive (!location->locked());
length_clock.set_sensitive (!location->locked());
i_am_the_modifier--;
}

View file

@ -296,7 +296,7 @@ Marker::add_line (ArdourCanvas::Group* group, double initial_height)
line = new ArdourCanvas::Line (*group);
line->property_width_pixels() = 1;
line->property_points() = *line_points;
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditCursor.get();
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
}
show_line ();

View file

@ -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 nframes_t edit_cursor_position(bool sync) = 0;
virtual nframes64_t get_preferred_edit_position () const = 0;
sigc::signal<void> ZoomFocusChanged;
sigc::signal<void> ZoomChanged;

View file

@ -987,7 +987,7 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
str.clear ();
str.push_back (_("use file timestamp"));
str.push_back (_("at edit cursor"));
str.push_back (_("at edit point"));
str.push_back (_("at playhead"));
str.push_back (_("at session start"));
set_popdown_strings (where_combo, str);
@ -1123,8 +1123,8 @@ SoundFileOmega::get_position() const
if (str == _("use file timestamp")) {
return ImportAtTimestamp;
} else if (str == _("at edit cursor")) {
return ImportAtEditCursor;
} else if (str == _("at edit point")) {
return ImportAtEditPoint;
} else if (str == _("at playhead")) {
return ImportAtPlayhead;
} else {

View file

@ -74,6 +74,10 @@ class Location : public PBD::StatefulDestructible
Location (const XMLNode&);
Location* operator= (const Location& other);
bool locked() const { return _locked; }
void lock() { _locked = true; changed (this); }
void unlock() { _locked = false; changed (this); }
nframes_t start() { return _start; }
nframes_t end() { return _end; }
nframes_t length() { return _end - _start; }
@ -82,6 +86,8 @@ class Location : public PBD::StatefulDestructible
int set_end (nframes_t e);
int set (nframes_t start, nframes_t end);
int move_to (nframes_t pos);
const string& name() { return _name; }
void set_name (const string &str) { _name = str; name_changed(this); }
@ -124,6 +130,7 @@ class Location : public PBD::StatefulDestructible
nframes_t _start;
nframes_t _end;
Flags _flags;
bool _locked;
void set_mark (bool yn);
bool set_flag_internal (bool yn, Flags flag);
@ -136,7 +143,7 @@ class Locations : public PBD::StatefulDestructible
Locations ();
~Locations ();
void add (Location *, bool make_current = false);
void remove (Location *);
void clear ();
@ -182,8 +189,8 @@ class Locations : public PBD::StatefulDestructible
private:
LocationList locations;
Location *current_location;
LocationList locations;
Location *current_location;
mutable Glib::Mutex lock;
int set_current_unlocked (Location *);

View file

@ -52,6 +52,7 @@ Location::Location (const Location& other)
_flags = Flags (_flags & ~IsStart);
_flags = Flags (_flags & ~IsEnd);
_locked = false;
}
Location::Location (const XMLNode& node)
@ -72,6 +73,7 @@ Location::operator= (const Location& other)
_start = other._start;
_end = other._end;
_flags = other._flags;
_locked = false;
/* "changed" not emitted on purpose */
@ -81,6 +83,10 @@ Location::operator= (const Location& other)
int
Location::set_start (nframes_t s)
{
if (_locked) {
return -1;
}
if (is_mark()) {
if (_start != s) {
@ -117,6 +123,10 @@ Location::set_start (nframes_t s)
int
Location::set_end (nframes_t e)
{
if (_locked) {
return -1;
}
if (is_mark()) {
if (_start != e) {
_start = e;
@ -140,6 +150,10 @@ Location::set_end (nframes_t e)
int
Location::set (nframes_t start, nframes_t end)
{
if (_locked) {
return -1;
}
if (is_mark() && start != end) {
return -1;
} else if (((is_auto_punch() || is_auto_loop()) && start >= end) || (start > end)) {
@ -158,6 +172,23 @@ Location::set (nframes_t start, nframes_t end)
return 0;
}
int
Location::move_to (nframes_t pos)
{
if (_locked) {
return -1;
}
if (_start != pos) {
_start = pos;
_end = _start + length();
changed (this); /* EMIT SIGNAL */
}
return 0;
}
void
Location::set_hidden (bool yn, void *src)
{
@ -284,6 +315,7 @@ Location::get_state (void)
snprintf (buf, sizeof (buf), "%u", end());
node->add_property ("end", buf);
node->add_property ("flags", enum_2_string (_flags));
node->add_property ("locked", (_locked ? "yes" : "no"));
return *node;
}
@ -343,6 +375,12 @@ Location::set_state (const XMLNode& node)
_flags = Flags (string_2_enum (prop->value(), _flags));
if ((prop = node.property ("locked")) != 0) {
_locked = (prop->value() == "yes");
} else {
_locked = false;
}
for (cd_iter = cd_list.begin(); cd_iter != cd_list.end(); ++cd_iter) {
cd_node = *cd_iter;