#include "ardour/session.h"
#include "ardour/types.h"
+#include "widgets/prompter.h"
+
#include "actions.h"
#include "ardour_ui.h"
#include "editor.h"
#include "region_gain_line.h"
#include "automation_time_axis.h"
#include "control_point.h"
-#include "prompter.h"
#include "selection.h"
#include "keyboard.h"
#include "editing.h"
Editor::mouse_frame (framepos_t& where, bool& in_track_canvas) const
{
/* gdk_window_get_pointer() has X11's XQueryPointer semantics in that it only
- pays attentions to subwindows. this means that menu windows are ignored, and
- if the pointer is in a menu, the return window from the call will be the
- the regular subwindow *under* the menu.
-
- this matters quite a lot if the pointer is moving around in a menu that overlaps
- the track canvas because we will believe that we are within the track canvas
- when we are not. therefore, we track enter/leave events for the track canvas
- and allow that to override the result of gdk_window_get_pointer().
+ pays attentions to subwindows. this means that menu windows are ignored, and
+ if the pointer is in a menu, the return window from the call will be the
+ the regular subwindow *under* the menu.
+
+ this matters quite a lot if the pointer is moving around in a menu that overlaps
+ the track canvas because we will believe that we are within the track canvas
+ when we are not. therefore, we track enter/leave events for the track canvas
+ and allow that to override the result of gdk_window_get_pointer().
*/
if (!within_track_canvas) {
- return false;
+ return false;
}
int x, y;
break;
case MouseObject:
selection->clear_time ();
- selection->clear_tracks ();
selection->clear_midi_notes ();
break;
case MouseDraw:
case TempoMarkerItem:
{
- _drags->set (
- new TempoMarkerDrag (
- this,
- item,
- ArdourKeyboard::indicates_copy (event->button.state)
- ),
- event
- );
+ if (ArdourKeyboard::indicates_constraint (event->button.state)) {
+ _drags->set (
+ new TempoEndDrag (
+ this,
+ item
+ ),
+ event
+ );
+ } else {
+ _drags->set (
+ new TempoMarkerDrag (
+ this,
+ item,
+ ArdourKeyboard::indicates_copy (event->button.state)
+ ),
+ event
+ );
+ }
+
return true;
}
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)
&& !ArdourKeyboard::indicates_constraint (event->button.state)) {
_drags->set (new CursorDrag (this, *playhead_cursor, false), event);
+ } else if (ArdourKeyboard::indicates_constraint (event->button.state)
+ && Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier)) {
+ _drags->set (new TempoTwistDrag (this, item), event);
} else if (ArdourKeyboard::indicates_constraint (event->button.state)) {
_drags->set (new BBTRulerDrag (this, item), event);
}
return true;
}
- //not rolling, range mode click + join_play_range : locate the PH here
- if ( !_drags->active () && _session && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && UIConfiguration::instance().get_follow_edits() && !_session->config.get_external_sync() ) {
- framepos_t where = canvas_event_sample (event);
- snap_to(where);
- _session->request_locate (where, false);
+ /* not rolling, effectively in range mode, follow edits enabled (likely
+ * to start range drag), not in a fade handle (since that means we are
+ * not starting a range drag): locate the PH here
+ */
+
+ if ((item_type != FadeInHandleItem) &&
+ (item_type != FadeOutHandleItem) &&
+ !_drags->active () &&
+ _session &&
+ !_session->transport_rolling() &&
+ (effective_mouse_mode() == MouseRange) &&
+ UIConfiguration::instance().get_follow_edits() &&
+ !_session->config.get_external_sync()) {
+
+ MusicFrame where (canvas_event_sample (event), 0);
+ snap_to (where);
+ _session->request_locate (where.frame, false);
}
switch (event->button.button) {
break;
default:
- return button_press_dispatch (&event->button);
+ return button_press_dispatch (&event->button);
break;
}
bool
Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
- framepos_t where = canvas_event_sample (event);
+ MusicFrame where (canvas_event_sample (event), 0);
AutomationTimeAxisView* atv = 0;
_press_cursor_ctx.reset();
return true;
}
- bool were_dragging = false;
+ bool were_dragging = false;
if (!Keyboard::is_context_menu_event (&event->button)) {
- /* see if we're finishing a drag */
+ /* see if we're finishing a drag */
- if (_drags->active ()) {
- bool const r = _drags->end_grab (event);
- if (r) {
- /* grab dragged, so do nothing else */
- return true;
- }
+ if (_drags->active ()) {
+ bool const r = _drags->end_grab (event);
+ if (r) {
+ /* grab dragged, so do nothing else */
+ return true;
+ }
- were_dragging = true;
- }
+ were_dragging = true;
+ }
- update_region_layering_order_editor ();
- }
+ update_region_layering_order_editor ();
+ }
/* edit events get handled here */
case SamplesRulerItem:
case MinsecRulerItem:
case BBTRulerItem:
- popup_ruler_menu (where, item_type);
+ popup_ruler_menu (where.frame, item_type);
break;
case MarkerItem:
case MarkerBarItem:
if (!_dragging_playhead) {
snap_to_with_modifier (where, event, RoundNearest, true);
- mouse_add_new_marker (where);
+ mouse_add_new_marker (where.frame);
}
return true;
if (!_dragging_playhead) {
// if we get here then a dragged range wasn't done
snap_to_with_modifier (where, event, RoundNearest, true);
- mouse_add_new_marker (where, true);
+ mouse_add_new_marker (where.frame, true);
}
return true;
case TempoBarItem:
case TempoCurveItem:
- if (!_dragging_playhead) {
+ if (!_dragging_playhead && Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
snap_to_with_modifier (where, event);
- mouse_add_new_tempo_event (where);
+ mouse_add_new_tempo_event (where.frame);
}
return true;
case MeterBarItem:
- if (!_dragging_playhead) {
+ if (!_dragging_playhead && Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
mouse_add_new_meter_event (pixel_to_sample (event->button.x));
}
return true;
bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
if (atv) {
- atv->add_automation_event (event, where, event->button.y, with_guard_points);
+ atv->add_automation_event (event, where.frame, event->button.y, with_guard_points);
}
return true;
break;
}
- /* do any (de)selection operations that should occur on button release */
+ /* do any (de)selection operations that should occur on button release */
button_selection (item, event, item_type);
return true;
MeterMarker* m_marker = 0;
TempoMarker* t_marker = 0;
double fraction;
- bool ret = true;
+ bool ret = true;
/* by the time we reach here, entered_regionview and entered trackview
* will have already been set as appropriate. Things are done this
void
Editor::note_edit_done (int r, EditNoteDialog* d)
{
- begin_reversible_command (_("edit note(s)"));
-
d->done (r);
delete d;
+}
- commit_reversible_command();
+void
+Editor::edit_region (RegionView* rv)
+{
+ if (UIConfiguration::instance().get_use_double_click_to_zoom_to_selection()) {
+ temporal_zoom_selection (Both);
+ } else {
+ rv->show_region_editor ();
+ }
}
void
if (Keyboard::modifier_state_contains (event->state, Keyboard::PrimaryModifier)) {
TimeAxisView* tv = &rv.get_time_axis_view();
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tv);
- double speed = 1.0;
- if (rtv && rtv->is_track()) {
- speed = rtv->track()->speed();
- }
framepos_t where = get_preferred_edit_position();
if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
- align_region (rv.region(), SyncPoint, (framepos_t) (where * speed));
+ align_region (rv.region(), SyncPoint, where);
} else if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
- align_region (rv.region(), End, (framepos_t) (where * speed));
+ align_region (rv.region(), End, where);
} else {
- align_region (rv.region(), Start, (framepos_t) (where * speed));
+ align_region (rv.region(), Start, where);
}
}
}
{
using namespace Gtkmm2ext;
- ArdourPrompter prompter (false);
+ ArdourWidgets::Prompter prompter (false);
prompter.set_prompt (_("Name for region:"));
prompter.set_initial_text (clicked_regionview->region()->name());
}
boost::shared_ptr<Playlist> playlist = rtv->playlist();
- double speed = rtv->track()->speed();
playlist->clear_changes ();
boost::shared_ptr<Region> new_region (RegionFactory::create (rv->region(), true));
- playlist->add_region (new_region, (framepos_t) (pos * speed));
+ playlist->add_region (new_region, pos);
_session->add_command (new StatefulDiffCommand (playlist));
// playlist is frozen, so we have to update manually XXX this is disgusting
if (entered_regionview) {
+ //ToDo: there is currently a bug here(?)
+ //when we are inside a region fade handle, it acts as though we are in range mode because it is in the top half of the region
+ //can it be fixed here?
+
ArdourCanvas::Duple const item_space = entered_regionview->get_canvas_group()->canvas_to_item (ArdourCanvas::Duple (0, y));
double const c = item_space.y / entered_regionview->height();