Ardour  9.2-541-gc1841a13dd
pianoroll_midi_view.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2015 David Robillard <d@drobilla.net>
3  * Copyright (C) 2008-2012 Hans Baier <hansfbaier@googlemail.com>
4  * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
7  * Copyright (C) 2015-2017 Nick Mainsbridge <mainsbridge@gmail.com>
8  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 #pragma once
26 
27 #include <map>
28 
29 #include "ardour/types.h"
30 
31 #include "midi_view.h"
32 #include "pianoroll.h"
33 
34 class VelocityDisplay;
36 
37 namespace ArdourCanvas {
38  class Box;
39 }
40 
42 {
43  public:
44  PianorollMidiView (std::shared_ptr<ARDOUR::MidiTrack> mt,
45  ArdourCanvas::Item& parent,
46  ArdourCanvas::Item& noscroll_parent,
47  EditingContext& ec,
49  );
50 
52 
53  void set_region (std::shared_ptr<ARDOUR::MidiRegion>);
54  void set_samples_per_pixel (double);
55  void set_height (double);
56 
63 
65 
66  std::list<SelectableOwner*> selectable_owners();
68 
72 
74  void clear_selection ();
75 
76  sigc::signal<void> AutomationStateChange;
77 
78  void set_overlay_text (std::string const &);
81 
83 
89 
91 
92  void get_selectables (Evoral::Parameter const & param, Temporal::timepos_t const & start, Temporal::timepos_t const & end, double x, double y, std::list<Selectable*>& sl, bool within = false);
93  void set_sensitive (bool yn);
94 
96  void set_automation_state (XMLNode const &);
97 
98  protected:
99  bool scroll (GdkEventScroll* ev);
100 
103 
104  typedef std::shared_ptr<PianorollAutomationLine> CueAutomationLine;
105  typedef std::shared_ptr<ARDOUR::AutomationControl> CueAutomationControl;
106 
107  struct AutomationLane {
108 
110  : control (ctl), line (ln), velocity_display (nullptr), parent (par) {}
112  : control (nullptr), line (nullptr), velocity_display (&vdisp), parent (par) {}
113 
115 
120 
121  void set_sensitive (bool);
122  void set_height (double);
123  };
124 
125  typedef std::map<Evoral::Parameter, AutomationLane*> CueAutomationMap;
127 
130 
131  std::shared_ptr<Temporal::TempoMap const> tempo_map;
133 
135  void update_hit (Hit *);
136 
137  double _height;
138 
142 
144 
146  void cut_copy_points (Editing::CutCopyOp op, Temporal::timepos_t const & earliest_time);
147 };
Definition: hit.h:30
Temporal::timepos_t start() const
Selection const & selection() const
Definition: midi_view.h:324
std::set< NoteBase * > Selection
Definition: midi_view.h:323
void get_selectables(Evoral::Parameter const &param, Temporal::timepos_t const &start, Temporal::timepos_t const &end, double x, double y, std::list< Selectable * > &sl, bool within=false)
Evoral::Parameter active_automation_parameter
sigc::signal< void > AutomationStateChange
void show_overlay_text()
void line_drag_click(GdkEvent *, Temporal::timepos_t const &)
void cut_copy_clear_one(AutomationLine &line, ::Selection &selection, Editing::CutCopyOp op)
void set_active_automation(Evoral::Parameter const &)
bool midi_canvas_group_event(GdkEvent *)
void cut_copy_clear(::Selection &selection, Editing::CutCopyOp)
void ghost_remove_note(NoteBase *)
void update_hit(Hit *)
ArdourCanvas::Item * drag_group() const
void set_height(double)
std::list< SelectableOwner * > selectable_owners()
std::shared_ptr< ARDOUR::AutomationControl > CueAutomationControl
void ghost_sync_selection(NoteBase *)
std::shared_ptr< Temporal::TempoMap const > tempo_map
bool automation_group_event(GdkEvent *)
void set_samples_per_pixel(double)
PianorollMidiView(std::shared_ptr< ARDOUR::MidiTrack > mt, ArdourCanvas::Item &parent, ArdourCanvas::Item &noscroll_parent, EditingContext &ec, MidiViewBackground &bg)
void remove_all_automation()
bool velocity_rb_click(GdkEvent *, Temporal::timepos_t const &)
Gtkmm2ext::Color line_color_for(Evoral::Parameter const &)
void ghosts_model_changed()
void update_sustained(Note *)
MergeableLine * make_merger()
bool automation_rb_click(GdkEvent *, Temporal::timepos_t const &, Evoral::Parameter)
void set_automation_state(XMLNode const &)
std::map< Evoral::Parameter, AutomationLane * > CueAutomationMap
void set_overlay_text(std::string const &)
void hide_overlay_text()
void point_selection_changed()
void add_automation_lane(Evoral::Parameter const &, Pianoroll::AutomationLane &lane_parent)
void reset_width_dependent_items(double pixel_width)
void set_sensitive(bool yn)
void swap_automation_channel(int)
void cut_copy_points(Editing::CutCopyOp op, Temporal::timepos_t const &earliest_time)
ArdourCanvas::Rectangle * event_rect
ArdourCanvas::Item * _noscroll_parent
void set_region(std::shared_ptr< ARDOUR::MidiRegion >)
std::shared_ptr< PianorollAutomationLine > CueAutomationLine
void ghost_add_note(NoteBase *)
void ghosts_view_changed()
void remove_automation_lane(Evoral::Parameter const &, Pianoroll::AutomationLane &lane_parent)
ArdourCanvas::Text * overlay_text
bool scroll(GdkEventScroll *ev)
CueAutomationMap automation_map
void clear_ghost_events()
AutomationLane * automation_lane_by_param(Evoral::Parameter const &)
XMLNode * automation_state() const
Definition: xml++.h:114
CutCopyOp
Definition: editing.h:241
uint32_t Color
Definition: colors.h:33
int pixel_width(const std::string &str, const Pango::FontDescription &font)
Pianoroll::AutomationLane & parent
AutomationLane(VelocityDisplay &vdisp, bool vis, Pianoroll::AutomationLane &par)
AutomationLane(CueAutomationControl ctl, CueAutomationLine ln, bool vis, Pianoroll::AutomationLane &par)