Ardour  8.12
midi_streamview.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
3  * Copyright (C) 2007 Doug McLain <doug@nostar.net>
4  * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #ifndef __ardour_midi_streamview_h__
24 #define __ardour_midi_streamview_h__
25 
26 #include <list>
27 #include <cmath>
28 
29 #include "ardour/location.h"
30 #include "enums.h"
31 #include "streamview.h"
32 #include "time_axis_view_item.h"
33 #include "route_time_axis.h"
34 
35 namespace Gdk {
36  class Color;
37 }
38 
39 namespace ARDOUR {
40  class Crossfade;
41  class MidiModel;
42  class MidiRegion;
43  class Route;
44  class Source;
45  struct PeakData;
46 }
47 
48 namespace ArdourCanvas {
49  class LineSet;
50 }
51 
52 class PublicEditor;
53 class Selectable;
54 class MidiTimeAxisView;
55 class MidiRegionView;
56 class RegionSelection;
57 class CrossfadeView;
58 class Selection;
59 
60 class MidiStreamView : public StreamView
61 {
62 public:
65 
66  void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
68 
72  };
73 
75 
77 
78  inline uint8_t lowest_note() const { return _lowest_note; }
79  inline uint8_t highest_note() const { return _highest_note; }
80 
81  void update_note_range(uint8_t note_num);
82 
84  //bool can_change_layer_display() const { return false; } // revert this change for now. Although stacked view is weirdly implemented wrt the "scroomer", it is still necessary to be able to manage layered regions.
85  void redisplay_track ();
86 
87  inline double contents_height() const {
89  }
90 
91  inline double note_to_y(uint8_t note) const {
92  return contents_height() - (note + 1 - lowest_note()) * note_height() + 1;
93  }
94 
95  uint8_t y_to_note(double y) const;
96 
97  inline double note_height() const {
98  return contents_height() / (double)contents_note_range();
99  }
100 
101  inline uint8_t contents_note_range() const {
102  return highest_note() - lowest_note() + 1;
103  }
104 
105  sigc::signal<void> NoteRangeChanged;
106 
107  RegionView* create_region_view (std::shared_ptr<ARDOUR::Region>, bool, bool);
108 
109  bool paste (Temporal::timepos_t const & pos, const Selection& selection, PasteContext& ctx);
110 
111  void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views);
112 
114  void resume_updates ();
115 
117 
118  void parameter_changed (std::string const &);
119 
120 protected:
121  void setup_rec_box ();
122  void update_rec_box ();
123 
125 
126 private:
127 
129  std::shared_ptr<ARDOUR::Region>,
130  bool wait_for_waves,
131  bool recording = false);
132 
133  void display_region(MidiRegionView* region_view, bool load_model);
134  void display_track (std::shared_ptr<ARDOUR::Track> tr);
135 
137 
139  bool update_data_note_range(uint8_t min, uint8_t max);
140  void update_contents_metrics(std::shared_ptr<ARDOUR::Region> r);
141 
142  void color_handler ();
143 
146 
149  uint8_t _lowest_note;
150  uint8_t _highest_note;
151  uint8_t _data_note_min;
152  uint8_t _data_note_max;
156 };
157 
158 #endif /* __ardour_midi_streamview_h__ */
void parameter_changed(std::string const &)
uint8_t _data_note_min
in data
void resume_updates()
void display_region(MidiRegionView *region_view, bool load_model)
uint8_t contents_note_range() const
void display_track(std::shared_ptr< ARDOUR::Track > tr)
void color_handler()
uint8_t _lowest_note
currently visible
void update_contents_metrics(std::shared_ptr< ARDOUR::Region > r)
bool update_data_note_range(uint8_t min, uint8_t max)
ArdourCanvas::Container * _region_group
void update_contents_height()
uint8_t highest_note() const
void get_inverted_selectables(Selection &, std::list< Selectable * > &results)
void redisplay_track()
void update_note_range(uint8_t note_num)
uint8_t y_to_note(double y) const
void get_regions_with_selected_data(RegionSelection &)
bool paste(Temporal::timepos_t const &pos, const Selection &selection, PasteContext &ctx)
void suspend_updates()
void apply_note_range_to_regions()
void note_range_adjustment_changed()
RegionView * create_region_view(std::shared_ptr< ARDOUR::Region >, bool, bool)
double contents_height() const
void set_layer_display(LayerDisplay)
double note_height() const
Gtk::Adjustment note_range_adjustment
ArdourCanvas::LineSet * _note_lines
void draw_note_lines()
ArdourCanvas::Container * region_canvas() const
void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views)
void update_rec_box()
sigc::signal< void > NoteRangeChanged
void set_note_range(VisibleNoteRange r)
double note_to_y(uint8_t note) const
uint8_t _data_note_max
in data
uint8_t lowest_note() const
MidiStreamView(MidiTimeAxisView &)
void setup_rec_box()
RegionView * add_region_view_internal(std::shared_ptr< ARDOUR::Region >, bool wait_for_waves, bool recording=false)
uint8_t _highest_note
currently visible
Representation of the interface of the Editor class.
Lists of selected things.
double child_height() const
static double NAME_HIGHLIGHT_SIZE
LayerDisplay
uint32_t Color
Definition: colors.h:33
link region and track selection