minor tweaks to Cut Time dialog. Use an enum to tell preferred_edit_location what to ignore, so cut and insert dialogs will never use mouse location.

This commit is contained in:
ben 2013-10-20 16:02:56 -05:00 committed by Ben Loftis
parent 84f0dceefb
commit e2afdb21c3
6 changed files with 26 additions and 15 deletions

View File

@ -208,6 +208,13 @@ enum XFadeType {
At
};
enum EditIgnoreOption {
EDIT_IGNORE_NONE,
EDIT_IGNORE_PHEAD,
EDIT_IGNORE_MOUSE,
EDIT_IGNORE_MARKER
};
} // namespace Editing
#endif // __gtk_ardour_editing_h__

View File

@ -1796,7 +1796,7 @@ Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, boost::sha
_popup_region_menu_item->set_label (menu_item_name);
}
const framepos_t position = get_preferred_edit_position (false, true);
const framepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, true);
edit_items.push_back (*_popup_region_menu_item);
if (track->playlist()->count_regions_at (position) > 1 && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
@ -4655,7 +4655,7 @@ Editor::sort_track_selection (TrackViewList& sel)
}
framepos_t
Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_menu, bool from_outside_canvas)
Editor::get_preferred_edit_position (EditIgnoreOption ignore, bool from_context_menu, bool from_outside_canvas)
{
bool ignored;
framepos_t where = 0;
@ -4676,10 +4676,14 @@ Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_men
return entered_marker->position();
}
if (ignore_playhead && ep == EditAtPlayhead) {
if ( (ignore==EDIT_IGNORE_PHEAD) && ep == EditAtPlayhead) {
ep = EditAtSelectedMarker;
}
if ( (ignore==EDIT_IGNORE_MOUSE) && ep == EditAtMouse) {
ep = EditAtPlayhead;
}
switch (ep) {
case EditAtPlayhead:
if (_dragging_playhead) {
@ -5773,7 +5777,7 @@ Editor::show_editor_list (bool yn)
void
Editor::change_region_layering_order (bool from_context_menu)
{
const framepos_t position = get_preferred_edit_position (false, from_context_menu);
const framepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context_menu);
if (!clicked_routeview) {
if (layering_order_editor) {

View File

@ -385,7 +385,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void reset_zoom (framecnt_t);
void reposition_and_zoom (framepos_t, double);
framepos_t get_preferred_edit_position (bool ignore_playhead = false,
framepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE,
bool use_context_click = false,
bool from_outside_canvas = false);

View File

@ -2435,7 +2435,7 @@ Editor::play_from_edit_point_and_return ()
framepos_t start_frame;
framepos_t return_frame;
start_frame = get_preferred_edit_position (true);
start_frame = get_preferred_edit_position ( EDIT_IGNORE_PHEAD );
if (_session->transport_rolling()) {
_session->request_locate (start_frame, false);
@ -4533,7 +4533,7 @@ Editor::paste (float times, bool from_context)
{
DEBUG_TRACE (DEBUG::CutNPaste, "paste to preferred edit pos\n");
paste_internal (get_preferred_edit_position (false, from_context), times);
paste_internal (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), times);
}
void
@ -5204,7 +5204,7 @@ Editor::insert_patch_change (bool from_context)
return;
}
const framepos_t p = get_preferred_edit_position (false, from_context);
const framepos_t p = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context);
/* XXX: bit of a hack; use the MIDNAM from the first selected region;
there may be more than one, but the PatchChangeDialog can only offer
@ -7025,15 +7025,15 @@ Editor::do_cut_time ()
return;
}
framepos_t pos = get_preferred_edit_position ();
framepos_t pos = get_preferred_edit_position (EDIT_IGNORE_MOUSE);
ArdourDialog d (*this, _("Cut Time"));
VButtonBox button_box;
VBox option_box;
CheckButton glue_button (_("Move Glued Regions"));
CheckButton marker_button (_("Move Markers"));
CheckButton tempo_button (_("Move Tempo & Meters"));
AudioClock clock ("insertTimeClock", true, X_("InsertTimeClock"), true, true, true);
CheckButton glue_button (_("Move Glued Regions")); glue_button.set_active();
CheckButton marker_button (_("Move Markers")); marker_button.set_active();
CheckButton tempo_button (_("Move Tempo & Meters")); tempo_button.set_active();
AudioClock clock ("cutTimeClock", true, "", true, false, true, false);
HBox clock_box;
clock.set (0);

View File

@ -35,7 +35,7 @@ InsertTimeDialog::InsertTimeDialog (PublicEditor& e)
{
set_session (_editor.session ());
framepos_t const pos = _editor.get_preferred_edit_position ();
framepos_t const pos = _editor.get_preferred_edit_position (EDIT_IGNORE_MOUSE);
get_vbox()->set_border_width (12);
get_vbox()->set_spacing (4);

View File

@ -282,7 +282,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void restore_editing_space () = 0;
virtual void update_tearoff_visibility () = 0;
virtual void reattach_all_tearoffs () = 0;
virtual framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool from_context_menu = false, bool from_outside_canvas = false) = 0;
virtual framepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE, bool from_context_menu = false, bool from_outside_canvas = false) = 0;
virtual void toggle_meter_updating() = 0;
virtual void split_regions_at (framepos_t, RegionSelection&) = 0;
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;