Ardour  9.0-pre0-582-g084a23a80d
midi_region_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 <string>
28 #include <vector>
29 #include <stdint.h>
30 
31 #include "pbd/signals.h"
32 
33 #include "ardour/midi_model.h"
34 #include "ardour/types.h"
35 
36 #include "editing.h"
37 #include "region_view.h"
38 #include "midi_time_axis.h"
39 #include "midi_view.h"
40 #include "time_axis_view_item.h"
41 #include "editor_automation_line.h"
42 #include "enums.h"
43 
44 namespace ARDOUR {
45  class MidiRegion;
46  class MidiModel;
47  class Filter;
48 };
49 
50 namespace MIDI {
51  namespace Name {
52  struct PatchPrimaryKey;
53  };
54 };
55 
56 class SysEx;
57 class Note;
58 class Hit;
59 class MidiTimeAxisView;
60 class NoteBase;
61 class GhostRegion;
64 class MidiCutBuffer;
65 class MidiListEditor;
66 class EditNoteDialog;
67 class PatchChange;
68 class ItemCounts;
69 class CursorContext;
71 class EditingContext;
72 
73 class MidiRegionView : public RegionView, public MidiView
74 {
75 public:
78 
82  std::shared_ptr<ARDOUR::MidiRegion> r,
83  double samples_per_pixel,
84  uint32_t basic_color);
85 
89  std::shared_ptr<ARDOUR::MidiRegion> r,
90  double samples_per_pixel,
91  uint32_t basic_color,
92  bool recording,
94 
95 
97  MidiRegionView (const MidiRegionView& other, std::shared_ptr<ARDOUR::MidiRegion>);
98 
100 
101  void init (bool wfd);
102  bool display_is_enabled() const;
103 
104  void set_selected (bool yn);
105 
106  const std::shared_ptr<ARDOUR::MidiRegion> midi_region() const;
107 
108  inline MidiTimeAxisView* midi_view() const
109  { return dynamic_cast<MidiTimeAxisView*>(&trackview); }
110 
112  { return midi_view()->midi_view(); }
113 
114  void set_height (double);
115  void set_model (std::shared_ptr<ARDOUR::MidiModel>);
116 
117  inline ARDOUR::ColorMode color_mode() const { return midi_view()->color_mode(); }
118 
119  std::string get_modifier_name() const;
120 
122 
124 
125  double height() const;
126  void redisplay (bool);
127 
129  void select_self (bool add);
130  void unselect_self ();
132  void begin_drag_edit (std::string const & why);
133 
135 
137 
138  protected:
140  void parameter_changed (std::string const & p);
141  uint32_t get_fill_color() const;
142  void color_handler ();
145  void add_control_points_to_selection (Temporal::timepos_t const &, Temporal::timepos_t const &, double y0, double y1);
146 
147  private:
148 
151  friend class NoteDrag;
152  friend class NoteCreateDrag;
153  friend class HitCreateDrag;
154  friend class MidiGhostRegion;
155 
156  friend class EditNoteDialog;
157 
164 
171 
172  void enter_internal (uint32_t state);
173  void leave_internal ();
175 
177 
179 };
180 
181 
std::multiset< NotePtr, EarlierNoteComparator > Notes
Definition: Sequence.h:157
Definition: Filter.h:21
Definition: hit.h:30
ArdourCanvas::Item * drag_group() const
const std::shared_ptr< ARDOUR::MidiRegion > midi_region() const
GhostRegion * add_ghost(TimeAxisView &)
void leave_internal()
MidiRegionView(ArdourCanvas::Container *parent, EditingContext &, RouteTimeAxisView &tv, std::shared_ptr< ARDOUR::MidiRegion > r, double samples_per_pixel, uint32_t basic_color)
void clear_ghost_events()
void set_height(double)
std::string get_modifier_name() const
void enter_internal(uint32_t state)
void connect_to_diskstream()
bool enter_notify(GdkEventCrossing *)
void ghost_remove_note(NoteBase *)
void select_self_uniquely()
void color_handler()
void ghosts_model_changed()
void parameter_changed(std::string const &p)
MidiStreamView * midi_stream_view() const
void ghost_sync_selection(NoteBase *)
void unselect_self()
void ghost_add_note(NoteBase *)
MidiTimeAxisView * midi_view() const
void region_resized(const PBD::PropertyChange &)
MidiRegionView(const MidiRegionView &other)
void redisplay(bool)
void begin_drag_edit(std::string const &why)
void select_self(bool add)
bool motion(GdkEventMotion *)
uint32_t get_fill_color() const
double contents_height() const
bool scroll(GdkEventScroll *)
void set_visibility_note_range(MidiViewBackground::VisibleNoteRange, bool)
double height() const
bool canvas_group_event(GdkEvent *)
ARDOUR::ColorMode color_mode() const
void set_model(std::shared_ptr< ARDOUR::MidiModel >)
bool leave_notify(GdkEventCrossing *)
bool button_press(GdkEventButton *)
void set_selected(bool yn)
bool button_release(GdkEventButton *)
void mouse_mode_changed()
void init(bool wfd)
void add_control_points_to_selection(Temporal::timepos_t const &, Temporal::timepos_t const &, double y0, double y1)
Evoral::Note< Temporal::Beats > NoteType
Evoral::Sequence< Temporal::Beats >::Notes Notes
void ghosts_view_changed()
MidiRegionView(ArdourCanvas::Container *parent, EditingContext &, RouteTimeAxisView &tv, std::shared_ptr< ARDOUR::MidiRegion > r, double samples_per_pixel, uint32_t basic_color, bool recording, Visibility visibility)
ARDOUR::InstrumentInfo & instrument_info() const
MidiRegionView(const MidiRegionView &other, std::shared_ptr< ARDOUR::MidiRegion >)
MergeableLine * make_merger()
bool display_is_enabled() const
void reset_width_dependent_items(double pixel_width)
ARDOUR::ColorMode color_mode() const
MidiStreamView * midi_view()
Definition: sys_ex.h:30
static double NAME_HIGHLIGHT_SIZE
TimeAxisView & trackview
void add(const Gtk::StockItem &item)
int pixel_width(const std::string &str, const Pango::FontDescription &font)