#include "ardour/session.h"
#include "ardour/types.h"
-#include "ardour_ui.h"
#include "actions.h"
#include "editor.h"
#include "time_axis_view.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
+ 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.
Editor::mouse_mode_object_range_toggled()
{
MouseMode m = mouse_mode;
-
+
Glib::RefPtr<Action> act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-range"));
assert (act);
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
}
set_gain_envelope_visibility ();
-
+
update_time_selection_display ();
update_all_enter_cursors ();
break;
case MouseContent:
/* This handles internal edit.
- Clear everything except points and notes.
+ Clear everything except points and notes.
*/
selection->clear_regions();
selection->clear_lines();
if (((mouse_mode != MouseObject) &&
(mouse_mode != MouseAudition || item_type != RegionItem) &&
(mouse_mode != MouseTimeFX || item_type != RegionItem) &&
- (mouse_mode != MouseDraw)) ||
+ (mouse_mode != MouseDraw) &&
+ (mouse_mode != MouseContent || item_type == RegionItem)) ||
((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3)) {
return;
}
break;
case ControlPointItem:
- set_selected_track_as_side_effect (op);
+ /* for object/track exclusivity, we don't call set_selected_track_as_side_effect (op); */
+
if (eff_mouse_mode != MouseRange) {
_mouse_changed_selection |= set_selected_control_point_from_click (press, op);
}
Editing::MouseMode eff = effective_mouse_mode ();
/* special case: allow drag of region fade in/out in object mode with join object/range enabled */
- if (get_smart_mode()) {
+ if (get_smart_mode()) {
switch (item_type) {
case FadeInHandleItem:
case FadeInTrimHandleItem:
}
return true;
+ case GainLineItem:
+ _drags->set (new LineDrag (this, item), event);
+ return true;
+ break;
+
case ControlPointItem:
_drags->set (new ControlPointDrag (this, item), event);
return true;
break;
+ case AutomationLineItem:
+ _drags->set (new LineDrag (this, item), event);
+ return true;
+ break;
+
case StreamItem:
//in the past, we created a new midi region here, but perhaps that is best left to the Draw mode
break;
case StartCrossFadeItem:
case EndCrossFadeItem:
- /* we might allow user to grab inside the fade to trim a region with preserve_fade_anchor. for not this is not fully implemented */
+ /* we might allow user to grab inside the fade to trim a region with preserve_fade_anchor. for not this is not fully implemented */
// if (!clicked_regionview->region()->locked()) {
// _drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer(), true), event);
// return true;
return false;
}
-
+
bool
Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
}
//not rolling, range mode click + join_play_range : locate the PH here
- if ( !_drags->active () && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && ARDOUR_UI::config()->get_follow_edits() ) {
+ if ( !_drags->active () && _session && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && UIConfiguration::instance().get_follow_edits() ) {
framepos_t where = canvas_event_sample (event);
snap_to(where);
_session->request_locate (where, false);
if (!Keyboard::is_context_menu_event (&event->button)) {
/* 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;
}
-
+
were_dragging = true;
}
break;
case TempoMarkerItem: {
- Marker* marker;
+ ArdourMarker* marker;
TempoMarker* tempo_marker;
-
- if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
+
+ if ((marker = reinterpret_cast<ArdourMarker *> (item->get_data ("marker"))) == 0) {
fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
abort(); /*NOTREACHED*/
}
-
+
if ((tempo_marker = dynamic_cast<TempoMarker*> (marker)) == 0) {
fatal << _("programming error: marker for tempo is not a tempo marker!") << endmsg;
abort(); /*NOTREACHED*/
}
-
+
edit_tempo_marker (*tempo_marker);
break;
}
case MeterMarkerItem: {
- Marker* marker;
+ ArdourMarker* marker;
MeterMarker* meter_marker;
-
- if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
+
+ if ((marker = reinterpret_cast<ArdourMarker *> (item->get_data ("marker"))) == 0) {
fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
abort(); /*NOTREACHED*/
}
-
+
if ((meter_marker = dynamic_cast<MeterMarker*> (marker)) == 0) {
fatal << _("programming error: marker for meter is not a meter marker!") << endmsg;
abort(); /*NOTREACHED*/
case SelectionItem:
popup_track_context_menu (1, event->button.time, item_type, true);
break;
-
+
case AutomationTrackItem:
popup_track_context_menu (1, event->button.time, item_type, false);
break;
case MouseDraw:
return true;
-
+
case MouseRange:
// x_style_paste (where, 1.0);
return true;
Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
ControlPoint* cp;
- Marker * marker;
+ ArdourMarker * marker;
double fraction;
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
+ * will have already been set as appropriate. Things are done this
* way because this method isn't passed a pointer to a variable type of
* thing that is entered (which may or may not be canvas item).
* (e.g. the actual entered regionview)
if (mouse_mode == MouseDraw) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line) {
- line->set_outline_color (ARDOUR_UI::config()->color ("entered gain line"));
+ line->set_outline_color (UIConfiguration::instance().color ("entered gain line"));
}
}
break;
if (mouse_mode == MouseDraw || mouse_mode == MouseObject) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line) {
- line->set_outline_color (ARDOUR_UI::config()->color ("entered automation line"));
+ line->set_outline_color (UIConfiguration::instance().color ("entered automation line"));
}
}
break;
break;
case MarkerItem:
- if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
+ if ((marker = static_cast<ArdourMarker *> (item->get_data ("marker"))) == 0) {
break;
}
entered_marker = marker;
- marker->set_color_rgba (ARDOUR_UI::config()->color ("entered marker"));
+ marker->set_color_rgba (UIConfiguration::instance().color ("entered marker"));
// fall through
case MeterMarkerItem:
case TempoMarkerItem:
case SelectionItem:
break;
+ case WaveItem:
+ {
+ if (entered_regionview) {
+ entered_regionview->entered();
+ }
+ }
+ break;
+
default:
break;
}
Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
{
AutomationLine* al;
- Marker *marker;
+ ArdourMarker *marker;
Location *loc;
bool is_start;
bool ret = true;
switch (item_type) {
case ControlPointItem:
- _verbose_cursor->hide ();
+ _verbose_cursor->hide ();
break;
case GainLineItem:
break;
case MarkerItem:
- if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
+ if ((marker = static_cast<ArdourMarker *> (item->get_data ("marker"))) == 0) {
break;
}
entered_marker = 0;
{
ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
if (rect) {
- rect->set_fill_color (ARDOUR_UI::config()->color ("inactive fade handle"));
+ rect->set_fill_color (UIConfiguration::instance().color ("inactive fade handle"));
}
}
break;
case FeatureLineItem:
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
- line->set_outline_color (ARDOUR_UI::config()->color ("zero line"));
+ line->set_outline_color (UIConfiguration::instance().color ("zero line"));
}
break;
current_stepping_trackview = 0;
step_timeout.disconnect ();
}
-
+
if (_session && _session->actively_recording()) {
/* Sorry. no dragging stuff around while we record */
return true;
}
-
+
update_join_object_range_location (event->motion.y);
-
+
if (_drags->active ()) {
return _drags->motion_handler (event, from_autoscroll);
}
}
selection->time.clear ();
clicked_selection = 0;
-}
+}
void
Editor::point_trim (GdkEvent* event, framepos_t new_bound)
void
Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* /*event*/)
{
- Marker* marker;
+ ArdourMarker* marker;
bool is_start;
- if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
+ if ((marker = static_cast<ArdourMarker *> (item->get_data ("marker"))) == 0) {
fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
abort(); /*NOTREACHED*/
}
// playlist is frozen, so we have to update manually XXX this is disgusting
- playlist->RegionAdded (new_region); /* EMIT SIGNAL */
+ //playlist->RegionAdded (new_region); /* EMIT SIGNAL */
}
gint
}
_drags->add (new RegionMoveDrag (this, item, region_view, selection->regions.by_layer(), true, false));
-
- begin_reversible_command (Operations::drag_region_brush);
}
/** Start a grab where a time range is selected, track(s) are selected, and the
/* A selection grab currently creates two undo/redo operations, one for
creating the new region and another for moving it.
*/
-
begin_reversible_command (Operations::selection_grab);
boost::shared_ptr<Playlist> playlist = clicked_axisview->playlist();
if (latest_regionviews.empty()) {
/* something went wrong */
+ abort_reversible_command ();
return;
}
} else if (entered_track) {
RouteTimeAxisView* entered_route_view = dynamic_cast<RouteTimeAxisView*> (entered_track);
-
+
if (entered_route_view) {
double cx = 0;
entered_route_view->canvas_display()->canvas_to_item (cx, cy);
double track_height = entered_route_view->view()->child_height();
- if (ARDOUR_UI::config()->get_show_name_highlight()) {
+ if (UIConfiguration::instance().get_show_name_highlight()) {
track_height -= TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
}
double const c = cy / track_height;