#ifndef __ardour_editor_h__
#define __ardour_editor_h__
+#include <sys/time.h>
+
+#include <cmath>
#include <list>
#include <map>
#include <set>
-#include <stack>
#include <string>
-#include <sys/time.h>
-#include <cmath>
+#include <vector>
#include <boost/optional.hpp>
#include "enums.h"
#include "editor_items.h"
#include "region_selection.h"
+#include "selection_memento.h"
namespace Gtkmm2ext {
class TearOff;
class BundleManager;
class ButtonJoiner;
class ControlPoint;
+class CursorContext;
class DragManager;
class EditNoteDialog;
class EditorCursor;
double visible_canvas_height () const {
return _visible_canvas_height;
}
- double trackviews_height() const;
+ double trackviews_height () const;
void cycle_snap_mode ();
void next_snap_choice ();
Editing::MidiEditMode current_midi_edit_mode () const;
void remove_midi_note (ArdourCanvas::Item *, GdkEvent *);
- bool internal_editing() const { return _internal_editing ; }
- void set_internal_edit (bool yn);
- bool toggle_internal_editing_from_double_click (GdkEvent*);
+ bool internal_editing() const;
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
void add_to_idle_resize (TimeAxisView*, int32_t);
/* selection */
Selection& get_selection() const { return *selection; }
+ bool get_selection_extents ( framepos_t &start, framepos_t &end ); // the time extents of the current selection, whether Range, Region(s), Control Points, or Notes
Selection& get_cut_buffer() const { return *cut_buffer; }
void track_mixer_selection ();
framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next);
framecnt_t get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t duration);
- Evoral::MusicalTime get_grid_type_as_beats (bool& success, framepos_t position);
+ unsigned get_grid_beat_divisions(framepos_t position);
+ Evoral::Beats get_grid_type_as_beats (bool& success, framepos_t position);
void nudge_forward (bool next, bool force_playhead);
void nudge_backward (bool next, bool force_playhead);
void update_tearoff_visibility();
void reattach_all_tearoffs ();
+ double get_y_origin () const;
void reset_x_origin (framepos_t);
void reset_x_origin_to_follow_playhead ();
void reset_y_origin (double);
int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region>);
- void do_import (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t&);
- void do_embed (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, framepos_t&);
+ void do_import (std::vector<std::string> paths,
+ Editing::ImportDisposition disposition,
+ Editing::ImportMode mode,
+ ARDOUR::SrcQuality quality,
+ framepos_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,
+ framepos_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);
+ void get_regionviews_by_id (PBD::ID const & id, RegionSelection & regions) const;
+
void center_screen (framepos_t);
TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
ARDOUR::RoundMode direction = ARDOUR::RoundNearest,
bool for_mark = false);
+ void begin_selection_op_history ();
+ void begin_reversible_selection_op (std::string cmd_name);
+ void commit_reversible_selection_op ();
+ void undo_selection_op ();
+ void redo_selection_op ();
void begin_reversible_command (std::string cmd_name);
void begin_reversible_command (GQuark);
void commit_reversible_command ();
void maybe_autoscroll (bool, bool, bool);
bool autoscroll_active() const;
- Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
- void set_canvas_cursor (Gdk::Cursor*, bool save=false);
-
- void push_canvas_cursor (Gdk::Cursor*);
- void pop_canvas_cursor ();
+ Gdk::Cursor* get_canvas_cursor () const;
void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
void get_pointer_position (double &, double &) const;
+ /** Context for mouse entry (stored in a stack). */
+ struct EnterContext {
+ ItemType item_type;
+ boost::shared_ptr<CursorContext> cursor_ctx;
+ };
+
+ /** Get the topmost enter context for the given item type.
+ *
+ * This is used to change the cursor associated with a given enter context,
+ * which may not be on the top of the stack.
+ */
+ EnterContext* get_enter_context(ItemType type);
+
TimeAxisView* stepping_axis_view () {
return _stepping_axis_view;
}
void set_samples_per_pixel (framecnt_t);
Editing::MouseMode mouse_mode;
- Editing::MouseMode pre_internal_mouse_mode;
Editing::SnapType pre_internal_snap_type;
Editing::SnapMode pre_internal_snap_mode;
Editing::SnapType internal_snap_type;
Editing::SnapMode internal_snap_mode;
- bool _internal_editing;
Editing::MouseMode effective_mouse_mode () const;
enum JoinObjectRangeState {
void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
void select_all_tracks ();
- void select_all_internal_edit (Selection::Operation);
+ bool select_all_internal_edit (Selection::Operation);
bool set_selected_control_point_from_click (bool press, Selection::Operation op = Selection::Set);
void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
void popup_control_point_context_menu (ArdourCanvas::Item *, GdkEvent *);
Gtk::Menu _control_point_context_menu;
+ void popup_note_context_menu (ArdourCanvas::Item *, GdkEvent *);
+ Gtk::Menu _note_context_menu;
+
void add_routes (ARDOUR::RouteList&);
void timeaxisview_deleted (TimeAxisView *);
Gtk::VBox global_vpacker;
Gtk::VBox vpacker;
- std::stack<Gdk::Cursor*> _cursor_stack;
- Gdk::Cursor* current_canvas_cursor;
+ /* Cursor stuff. Do not use directly, use via CursorContext. */
+ friend class CursorContext;
+ std::vector<Gdk::Cursor*> _cursor_stack;
+ void set_canvas_cursor (Gdk::Cursor*);
+ size_t push_canvas_cursor (Gdk::Cursor*);
+ void pop_canvas_cursor ();
+
Gdk::Cursor* which_grabber_cursor () const;
Gdk::Cursor* which_track_cursor () const;
Gdk::Cursor* which_mode_cursor () const;
Gdk::Cursor* which_trim_cursor (bool left_side) const;
- bool reset_canvas_cursor ();
- void choose_canvas_cursor_on_entry (GdkEventCrossing*, ItemType);
+ Gdk::Cursor* which_canvas_cursor (ItemType type) const;
+
+ /** Push the appropriate enter/cursor context on item entry. */
+ void choose_canvas_cursor_on_entry (ItemType);
+
+ /** Update all enter cursors based on current settings. */
+ void update_all_enter_cursors ();
ArdourCanvas::GtkCanvas* _track_canvas;
ArdourCanvas::GtkCanvasViewport* _track_canvas_viewport;
ArdourCanvas::Ruler* samples_ruler;
ArdourCanvas::Ruler* minsec_ruler;
- static const double timebar_height;
+ static double timebar_height;
guint32 visible_timebars;
Gtk::Menu *editor_ruler_menu;
framepos_t cut_buffer_start;
framecnt_t cut_buffer_length;
- Gdk::Cursor* pre_press_cursor;
+ boost::shared_ptr<CursorContext> _press_cursor_ctx; ///< Button press cursor context
+
boost::weak_ptr<ARDOUR::Trimmable> _trimmable;
boost::weak_ptr<ARDOUR::Movable> _movable;
void cut_copy (Editing::CutCopyOp);
bool can_cut_copy () const;
- void cut_copy_points (Editing::CutCopyOp, Evoral::MusicalTime earliest=Evoral::MusicalTime(), bool midi=false);
+ void cut_copy_points (Editing::CutCopyOp, Evoral::Beats earliest=Evoral::Beats(), bool midi=false);
void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
void cut_copy_ranges (Editing::CutCopyOp);
void cut_copy_midi (Editing::CutCopyOp);
void reset_region_scale_amplitude ();
void adjust_region_gain (bool up);
void quantize_region ();
+ void quantize_regions (const RegionSelection& rs);
void legatize_region (bool shrink_only);
+ void legatize_regions (const RegionSelection& rs, bool shrink_only);
+ void transform_region ();
+ void transform_regions (const RegionSelection& rs);
void insert_patch_change (bool from_context);
void fork_region ();
void calc_extra_zoom_edges(framepos_t &start, framepos_t &end);
void temporal_zoom_selection (bool both_axes = false);
void temporal_zoom_region (bool both_axes);
- void zoom_to_region (bool both_axes);
void temporal_zoom_session ();
void temporal_zoom (framecnt_t samples_per_pixel);
void temporal_zoom_by_frame (framepos_t start, framepos_t end);
bool idle_drop_paths (std::vector<std::string> paths, framepos_t frame, double ypos, bool copy);
void drop_paths_part_two (const std::vector<std::string>& paths, framepos_t frame, double ypos, bool copy);
- int import_sndfiles (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode,
- ARDOUR::SrcQuality, framepos_t& pos,
- int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
- int embed_sndfiles (std::vector<std::string> paths, bool multiple_files, bool& check_sample_rate,
- Editing::ImportDisposition disposition, Editing::ImportMode mode,
- framepos_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
-
- int add_sources (std::vector<std::string> paths, ARDOUR::SourceList& sources, framepos_t& pos,
- Editing::ImportDisposition, Editing::ImportMode,
- int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
-
- int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, framepos_t& pos, Editing::ImportMode mode,
- boost::shared_ptr<ARDOUR::Track>& existing_track, const std::string& new_track_name);
+ int import_sndfiles (std::vector<std::string> paths,
+ Editing::ImportDisposition disposition,
+ Editing::ImportMode mode,
+ ARDOUR::SrcQuality quality,
+ framepos_t& pos,
+ int target_regions,
+ int target_tracks,
+ boost::shared_ptr<ARDOUR::Track>& track,
+ bool replace,
+ boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
+
+ int embed_sndfiles (std::vector<std::string> paths,
+ bool multiple_files,
+ bool& check_sample_rate,
+ Editing::ImportDisposition disposition,
+ Editing::ImportMode mode,
+ framepos_t& pos,
+ int target_regions,
+ int target_tracks,
+ boost::shared_ptr<ARDOUR::Track>& track,
+ boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
+
+ int add_sources (std::vector<std::string> paths,
+ ARDOUR::SourceList& sources,
+ framepos_t& pos,
+ Editing::ImportDisposition disposition,
+ Editing::ImportMode mode,
+ int target_regions,
+ int target_tracks,
+ boost::shared_ptr<ARDOUR::Track>& track,
+ bool add_channel_suffix,
+ boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
+
+ int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region,
+ uint32_t in_chans,
+ uint32_t out_chans,
+ framepos_t& pos,
+ Editing::ImportMode mode,
+ boost::shared_ptr<ARDOUR::Track>& existing_track,
+ const std::string& new_track_name,
+ boost::shared_ptr<ARDOUR::PluginInfo> instrument);
boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
void set_session_extents_from_selection ();
- void set_loop_from_edit_range (bool play);
void set_loop_from_region (bool play);
- void set_punch_from_edit_range ();
void set_loop_range (framepos_t start, framepos_t end, std::string cmd);
void set_punch_range (framepos_t start, framepos_t end, std::string cmd);
void edit_tempo_marker (TempoMarker&);
void edit_meter_marker (MeterMarker&);
void edit_control_point (ArdourCanvas::Item*);
- void edit_notes (TimeAxisViewItem&);
+ void edit_notes (MidiRegionView*);
void marker_menu_edit ();
void marker_menu_remove ();
ArdourButton mouse_draw_button;
ArdourButton mouse_move_button;
ArdourButton mouse_timefx_button;
+ ArdourButton mouse_content_button;
ArdourButton mouse_audition_button;
ArdourButton mouse_cut_button;
void mouse_mode_object_range_toggled ();
bool ignore_mouse_mode_toggle;
- ArdourButton internal_edit_button;
- void toggle_internal_editing ();
-
bool mouse_select_button_release (GdkEventButton*);
Gtk::VBox automation_box;
Selection* selection;
Selection* cut_buffer;
+ SelectionMemento* _selection_memento;
void time_selection_changed ();
void update_time_selection_display ();
void write_selection ();
- XMLNode *before; /* used in *_reversible_command */
+ uint32_t selection_op_cmd_depth;
+ uint32_t selection_op_history_it;
+
+ std::list<XMLNode *> selection_op_history; /* used in *_reversible_selection_op */
+ std::list<XMLNode *> before; /* used in *_reversible_command */
void update_title ();
void update_title_s (const std::string & snapshot_name);
void apply_filter (ARDOUR::Filter&, std::string cmd, ProgressReporter* progress = 0);
Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
- void apply_midi_note_edit_op (ARDOUR::MidiOperator& op);
+ void apply_midi_note_edit_op (ARDOUR::MidiOperator& op, const RegionSelection& rs);
/* handling cleanup */
*/
RegionView* entered_regionview;
+ std::vector<EnterContext> _enter_stack;
+
bool clear_entered_track;
bool left_track_canvas (GdkEventCrossing*);
bool entered_track_canvas (GdkEventCrossing*);
Glib::RefPtr<Gtk::Action> undo_action;
Glib::RefPtr<Gtk::Action> redo_action;
+ Glib::RefPtr<Gtk::Action> alternate_redo_action;
+ Glib::RefPtr<Gtk::Action> alternate_alternate_redo_action;
+ Glib::RefPtr<Gtk::Action> selection_undo_action;
+ Glib::RefPtr<Gtk::Action> selection_redo_action;
void history_changed ();