void set_zoom_focus (Editing::ZoomFocus);
Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
- samplecnt_t get_current_zoom () const { return samples_per_pixel; }
+ samplecnt_t get_current_zoom () const { return samples_per_pixel; }
void cycle_zoom_focus ();
void temporal_zoom_step (bool zoom_out);
void temporal_zoom_step_scale (bool zoom_out, double scale);
void reposition_and_zoom (samplepos_t, double);
samplepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE,
- bool use_context_click = false,
- bool from_outside_canvas = false);
+ bool use_context_click = false,
+ bool from_outside_canvas = false);
bool update_mouse_speed ();
bool decelerate_mouse_speed ();
ARDOUR::SrcQuality quality,
ARDOUR::MidiTrackNameSource mts,
ARDOUR::MidiTempoMapDisposition mtd,
- samplepos_t& pos,
+ samplepos_t& pos,
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
void do_embed (std::vector<std::string> paths,
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
- samplepos_t& pos,
+ samplepos_t& pos,
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions, bool src_comparison);
TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
void snap_to (ARDOUR::MusicSample& first,
- ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
- ARDOUR::SnapPref pref = ARDOUR::SnapToAny_Visual,
- bool ensure_snap = false);
+ ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+ ARDOUR::SnapPref pref = ARDOUR::SnapToAny_Visual,
+ bool ensure_snap = false);
void snap_to_with_modifier (ARDOUR::MusicSample& first,
- GdkEvent const * ev,
- ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
- ARDOUR::SnapPref pref = ARDOUR::SnapToAny_Visual);
+ GdkEvent const * ev,
+ ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+ ARDOUR::SnapPref pref = ARDOUR::SnapToAny_Visual);
void set_snapped_cursor_position (samplepos_t pos);
VisualState (bool with_tracks);
~VisualState ();
double y_position;
- samplecnt_t samples_per_pixel;
- samplepos_t _leftmost_sample;
+ samplecnt_t samples_per_pixel;
+ samplepos_t _leftmost_sample;
Editing::ZoomFocus zoom_focus;
GUIObjectState* gui_state;
};
VideoTimeline = 0x8
};
- Type pending;
+ Type pending;
samplepos_t time_origin;
- samplecnt_t samples_per_pixel;
- double y_origin;
+ samplecnt_t samples_per_pixel;
+ double y_origin;
int idle_handler_id;
/** true if we are currently in the idle handler */
/* CUT/COPY/PASTE */
samplepos_t last_paste_pos;
- unsigned paste_count;
+ unsigned paste_count;
void cut_copy (Editing::CutCopyOp);
bool can_cut_copy () const;
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
ARDOUR::SrcQuality quality,
- samplepos_t& pos,
+ samplepos_t& pos,
int target_regions,
int target_tracks,
boost::shared_ptr<ARDOUR::Track>& track,
bool& check_sample_rate,
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
- samplepos_t& pos,
+ samplepos_t& pos,
int target_regions,
int target_tracks,
boost::shared_ptr<ARDOUR::Track>& track,
int add_sources (std::vector<std::string> paths,
ARDOUR::SourceList& sources,
- samplepos_t& pos,
+ samplepos_t& pos,
Editing::ImportDisposition disposition,
Editing::ImportMode mode,
int target_regions,
int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region,
uint32_t in_chans,
uint32_t out_chans,
- samplepos_t& pos,
+ samplepos_t& pos,
Editing::ImportMode mode,
boost::shared_ptr<ARDOUR::Track>& existing_track,
const std::string& new_track_name,
ARDOUR::SnapPref gpref);
void snap_to_internal (ARDOUR::MusicSample& first,
- ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
- ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual,
- bool ensure_snap = false);
+ ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
+ ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual,
+ bool ensure_snap = false);
- samplepos_t snap_to_marker (samplepos_t presnap,
- ARDOUR::RoundMode direction = ARDOUR::RoundNearest);
+ samplepos_t snap_to_marker (samplepos_t presnap,
+ ARDOUR::RoundMode direction = ARDOUR::RoundNearest);
RhythmFerret* rhythm_ferret;
bool
Editor::mouse_sample (samplepos_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().
- */
-
- if (!within_track_canvas) {
+ /* 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().
+ */
+
+ if (!within_track_canvas) {
return false;
- }
+ }
int x, y;
Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->_track_canvas->get_window();
/* Switch snap type/mode if we're moving to/from an internal tool. Note
this must toggle the actions and not call set_snap_*() directly,
otherwise things get out of sync and the combo box stops working. */
- if (!UIConfiguration::instance().get_grid_follows_internal()) {
+ if (!UIConfiguration::instance().get_grid_follows_internal()) {
grid_type_action(pre_internal_grid_type)->set_active(true);
snap_mode_action(pre_internal_snap_mode)->set_active(true);
- } else if (!was_internal && internal_editing()) {
+ } else if (!was_internal && internal_editing()) {
grid_type_action(internal_grid_type)->set_active(true);
snap_mode_action(internal_snap_mode)->set_active(true);
} else if (was_internal && !internal_editing()) {
void
Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
-
- /* in object/audition/timefx/gain-automation mode,
- any button press sets the selection if the object
- can be selected. this is a bit of hack, because
- we want to avoid this if the mouse operation is a
- region alignment.
-
- note: not dbl-click or triple-click
-
- Also note that there is no region selection in internal edit mode, otherwise
- for operations operating on the selection (e.g. cut) it is not obvious whether
- to cut notes or regions.
- */
+ /* in object/audition/timefx/gain-automation mode,
+ * any button press sets the selection if the object
+ * can be selected. this is a bit of hack, because
+ * we want to avoid this if the mouse operation is a
+ * region alignment.
+ *
+ * note: not dbl-click or triple-click
+ *
+ * Also note that there is no region selection in internal edit mode, otherwise
+ * for operations operating on the selection (e.g. cut) it is not obvious whether
+ * to cut notes or regions.
+ */
MouseMode eff_mouse_mode = effective_mouse_mode ();
if (get_smart_mode() && eff_mouse_mode == MouseRange && event->button.button == 3 && item_type == RegionItem) {
/* context clicks are always about object properties, even if
- we're in range mode within smart mode.
- */
+ we're in range mode within smart mode.
+ */
eff_mouse_mode = MouseObject;
}
/* special case: allow drag of region fade in/out in object mode with join object/range enabled */
if (get_smart_mode()) {
switch (item_type) {
- case FadeInHandleItem:
- case FadeInTrimHandleItem:
- case FadeOutHandleItem:
- case FadeOutTrimHandleItem:
- eff_mouse_mode = MouseObject;
- break;
- default:
- break;
+ case FadeInHandleItem:
+ case FadeInTrimHandleItem:
+ case FadeOutHandleItem:
+ case FadeOutTrimHandleItem:
+ eff_mouse_mode = MouseObject;
+ break;
+ default:
+ break;
}
}
if (((mouse_mode != MouseObject) &&
- (mouse_mode != MouseAudition || item_type != RegionItem) &&
- (mouse_mode != MouseTimeFX || item_type != RegionItem) &&
- (mouse_mode != MouseDraw) &&
- (mouse_mode != MouseContent || item_type == RegionItem)) ||
- ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3)) {
+ (mouse_mode != MouseAudition || item_type != RegionItem) &&
+ (mouse_mode != MouseTimeFX || item_type != RegionItem) &&
+ (mouse_mode != MouseDraw) &&
+ (mouse_mode != MouseContent || item_type == RegionItem)) ||
+ ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3)) {
return;
}
/* almost no selection action on modified button-2 or button-3 events */
if ((item_type != RegionItem && event->button.button != 2)
- /* for selection of control points prior to delete (shift-right click) */
- && !(item_type == ControlPointItem && event->button.button == 3 && event->type == GDK_BUTTON_PRESS)) {
+ /* for selection of control points prior to delete (shift-right click) */
+ && !(item_type == ControlPointItem && event->button.button == 3 && event->type == GDK_BUTTON_PRESS)) {
return;
}
}
}
switch (item_type) {
- case RegionItem:
- if (eff_mouse_mode == MouseDraw) {
- break;
- }
- if (press) {
- if (eff_mouse_mode != MouseRange) {
- _mouse_changed_selection = set_selected_regionview_from_click (press, op);
+ case RegionItem:
+ if (eff_mouse_mode == MouseDraw) {
+ break;
+ }
+ if (press) {
+ if (eff_mouse_mode != MouseRange) {
+ _mouse_changed_selection = set_selected_regionview_from_click (press, op);
+ } else {
+ /* don't change the selection unless the
+ clicked track is not currently selected. if
+ so, "collapse" the selection to just this
+ track
+ */
+ if (!selection->selected (clicked_axisview)) {
+ set_selected_track_as_side_effect (Selection::Set);
+ }
+ }
} else {
- /* don't change the selection unless the
- clicked track is not currently selected. if
- so, "collapse" the selection to just this
- track
- */
- if (!selection->selected (clicked_axisview)) {
- set_selected_track_as_side_effect (Selection::Set);
+ if (eff_mouse_mode != MouseRange) {
+ _mouse_changed_selection |= set_selected_regionview_from_click (press, op);
}
}
- } else {
- if (eff_mouse_mode != MouseRange) {
+ break;
+
+ case RegionViewNameHighlight:
+ case RegionViewName:
+ case LeftFrameHandle:
+ case RightFrameHandle:
+ case FadeInHandleItem:
+ case FadeInTrimHandleItem:
+ case FadeInItem:
+ case FadeOutHandleItem:
+ case FadeOutTrimHandleItem:
+ case FadeOutItem:
+ case StartCrossFadeItem:
+ case EndCrossFadeItem:
+ if (get_smart_mode() || eff_mouse_mode != MouseRange) {
_mouse_changed_selection |= set_selected_regionview_from_click (press, op);
+ } else if (event->type == GDK_BUTTON_PRESS) {
+ set_selected_track_as_side_effect (op);
}
- }
- break;
-
- case RegionViewNameHighlight:
- case RegionViewName:
- case LeftFrameHandle:
- case RightFrameHandle:
- case FadeInHandleItem:
- case FadeInTrimHandleItem:
- case FadeInItem:
- case FadeOutHandleItem:
- case FadeOutTrimHandleItem:
- case FadeOutItem:
- case StartCrossFadeItem:
- case EndCrossFadeItem:
- if (get_smart_mode() || eff_mouse_mode != MouseRange) {
- _mouse_changed_selection |= set_selected_regionview_from_click (press, op);
- } else if (event->type == GDK_BUTTON_PRESS) {
- set_selected_track_as_side_effect (op);
- }
- break;
+ break;
- case ControlPointItem:
- /* for object/track exclusivity, we don't call set_selected_track_as_side_effect (op); */
+ case ControlPointItem:
+ /* for object/track exclusivity, we don't call set_selected_track_as_side_effect (op); */
- if (eff_mouse_mode != MouseRange) {
- if (event->button.button != 3) {
- _mouse_changed_selection |= set_selected_control_point_from_click (press, op);
- } else {
- _mouse_changed_selection |= set_selected_control_point_from_click (press, Selection::Set);
+ if (eff_mouse_mode != MouseRange) {
+ if (event->button.button != 3) {
+ _mouse_changed_selection |= set_selected_control_point_from_click (press, op);
+ } else {
+ _mouse_changed_selection |= set_selected_control_point_from_click (press, Selection::Set);
+ }
}
- }
- break;
+ break;
- case GainLineItem:
- if (eff_mouse_mode != MouseRange) {
- AutomationLine* argl = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
+ case GainLineItem:
+ if (eff_mouse_mode != MouseRange) {
+ AutomationLine* argl = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
- std::list<Selectable*> selectables;
- uint32_t before, after;
- samplecnt_t const where = (samplecnt_t) floor (event->button.x * samples_per_pixel) - clicked_regionview->region ()->position ();
+ std::list<Selectable*> selectables;
+ uint32_t before, after;
+ samplecnt_t const where = (samplecnt_t) floor (event->button.x * samples_per_pixel) - clicked_regionview->region ()->position ();
- if (!argl || !argl->control_points_adjacent (where, before, after)) {
- break;
- }
+ if (!argl || !argl->control_points_adjacent (where, before, after)) {
+ break;
+ }
- selectables.push_back (argl->nth (before));
- selectables.push_back (argl->nth (after));
+ selectables.push_back (argl->nth (before));
+ selectables.push_back (argl->nth (after));
- switch (op) {
- case Selection::Set:
- if (press) {
- selection->set (selectables);
- _mouse_changed_selection = true;
- }
- break;
- case Selection::Add:
- if (press) {
- selection->add (selectables);
- _mouse_changed_selection = true;
- }
- break;
- case Selection::Toggle:
- if (press) {
- selection->toggle (selectables);
- _mouse_changed_selection = true;
- }
- break;
+ switch (op) {
+ case Selection::Set:
+ if (press) {
+ selection->set (selectables);
+ _mouse_changed_selection = true;
+ }
+ break;
+ case Selection::Add:
+ if (press) {
+ selection->add (selectables);
+ _mouse_changed_selection = true;
+ }
+ break;
+ case Selection::Toggle:
+ if (press) {
+ selection->toggle (selectables);
+ _mouse_changed_selection = true;
+ }
+ break;
- case Selection::Extend:
- /* XXX */
- break;
+ case Selection::Extend:
+ /* XXX */
+ break;
+ }
}
- }
- break;
+ break;
- case AutomationLineItem:
- if (eff_mouse_mode != MouseRange) {
- AutomationLine* al = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
- std::list<Selectable*> selectables;
- double mx = event->button.x;
- double my = event->button.y;
+ case AutomationLineItem:
+ if (eff_mouse_mode != MouseRange) {
+ AutomationLine* al = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
+ std::list<Selectable*> selectables;
+ double mx = event->button.x;
+ double my = event->button.y;
- al->grab_item().canvas_to_item (mx, my);
+ al->grab_item().canvas_to_item (mx, my);
- uint32_t before, after;
- samplecnt_t const where = (samplecnt_t) floor (mx * samples_per_pixel);
+ uint32_t before, after;
+ samplecnt_t const where = (samplecnt_t) floor (mx * samples_per_pixel);
- if (!al || !al->control_points_adjacent (where, before, after)) {
- break;
- }
+ if (!al || !al->control_points_adjacent (where, before, after)) {
+ break;
+ }
- selectables.push_back (al->nth (before));
- selectables.push_back (al->nth (after));
+ selectables.push_back (al->nth (before));
+ selectables.push_back (al->nth (after));
- switch (op) {
- case Selection::Set:
- if (press) {
- selection->set (selectables);
- _mouse_changed_selection = true;
- }
- break;
- case Selection::Add:
- if (press) {
- selection->add (selectables);
- _mouse_changed_selection = true;
- }
- break;
- case Selection::Toggle:
- if (press) {
- selection->toggle (selectables);
- _mouse_changed_selection = true;
- }
- break;
+ switch (op) {
+ case Selection::Set:
+ if (press) {
+ selection->set (selectables);
+ _mouse_changed_selection = true;
+ }
+ break;
+ case Selection::Add:
+ if (press) {
+ selection->add (selectables);
+ _mouse_changed_selection = true;
+ }
+ break;
+ case Selection::Toggle:
+ if (press) {
+ selection->toggle (selectables);
+ _mouse_changed_selection = true;
+ }
+ break;
- case Selection::Extend:
- /* XXX */
- break;
+ case Selection::Extend:
+ /* XXX */
+ break;
+ }
}
- }
- break;
+ break;
- case StreamItem:
- /* for context click, select track */
- if (event->button.button == 3) {
- selection->clear_tracks ();
- set_selected_track_as_side_effect (op);
+ case StreamItem:
+ /* for context click, select track */
+ if (event->button.button == 3) {
+ selection->clear_tracks ();
+ set_selected_track_as_side_effect (op);
- /* We won't get a release.*/
- begin_reversible_selection_op (X_("Button 3 Menu Select"));
- commit_reversible_selection_op ();
- }
- break;
+ /* We won't get a release.*/
+ begin_reversible_selection_op (X_("Button 3 Menu Select"));
+ commit_reversible_selection_op ();
+ }
+ break;
- case AutomationTrackItem:
- if (eff_mouse_mode != MouseDraw && op == Selection::Set) {
- set_selected_track_as_side_effect (op);
- }
- break;
+ case AutomationTrackItem:
+ if (eff_mouse_mode != MouseDraw && op == Selection::Set) {
+ set_selected_track_as_side_effect (op);
+ }
+ break;
- case NoteItem:
- if (press && event->button.button == 3) {
- NoteBase* cnote = reinterpret_cast<NoteBase*> (item->get_data ("notebase"));
- assert (cnote);
- if (cnote->region_view().selection_size() == 0 || !cnote->selected()) {
- selection->clear_points();
- cnote->region_view().unique_select (cnote);
- /* we won't get the release, so store the selection change now */
- begin_reversible_selection_op (X_("Button 3 Note Selection"));
- commit_reversible_selection_op ();
+ case NoteItem:
+ if (press && event->button.button == 3) {
+ NoteBase* cnote = reinterpret_cast<NoteBase*> (item->get_data ("notebase"));
+ assert (cnote);
+ if (cnote->region_view().selection_size() == 0 || !cnote->selected()) {
+ selection->clear_points();
+ cnote->region_view().unique_select (cnote);
+ /* we won't get the release, so store the selection change now */
+ begin_reversible_selection_op (X_("Button 3 Note Selection"));
+ commit_reversible_selection_op ();
+ }
}
- }
- break;
+ break;
- default:
- break;
+ default:
+ break;
}
if ((!press) && _mouse_changed_selection) {
bool
Editor::button_press_dispatch (GdkEventButton* ev)
{
- /* this function is intended only for buttons 4 and above.
- */
+ /* this function is intended only for buttons 4 and above. */
- Gtkmm2ext::MouseButton b (ev->state, ev->button);
- return button_bindings->activate (b, Gtkmm2ext::Bindings::Press);
+ Gtkmm2ext::MouseButton b (ev->state, ev->button);
+ return button_bindings->activate (b, Gtkmm2ext::Bindings::Press);
}
bool
Editor::button_release_dispatch (GdkEventButton* ev)
{
- /* this function is intended only for buttons 4 and above.
- */
+ /* this function is intended only for buttons 4 and above. */
- Gtkmm2ext::MouseButton b (ev->state, ev->button);
- return button_bindings->activate (b, Gtkmm2ext::Bindings::Release);
+ Gtkmm2ext::MouseButton b (ev->state, ev->button);
+ return button_bindings->activate (b, Gtkmm2ext::Bindings::Release);
}
bool